Auto erstellen,Auto löschen?

Wichtiger Hinweis: Bitte ändert nicht manuell die Schriftfarbe auf schwarz sondern belasst es bei der Standardeinstellung. Somit tragt ihr dazu bei dass euer Text auch bei Verwendung unseren dunklen Forenstils noch lesbar ist!

Tipp: Ihr wollt längere Codeausschnitte oder Logfiles bereitstellen? Benutzt unseren eigenen PasteBin-Dienst Link
  • Moin,
    ich versuche mir grad so eine Art Carsystem zu bauen.
    Ein Menu wo man Autos kaufen kann habe ich Bereits bloss wie mache ich das wen man z.B Sultan auswählt das dann ein Sultan erstellt wird und man mit diesem Fahren kann?
    Und wie ich diesen Sultan wieder löschen kann?
    Das erstellen sollte aber sehr sehr oft gehen damit andere Spieler auch ein Auto kaufen könne^^

  • Mach es doch via Menu


    Ganz oben


    new Menu:Auto;


    new Menu:Sport;
    new Menu:SportAbisF;
    new Menu:SportGbisZ;
    -------------------


    GameModeInit
    Auto = CreateMenu("Auto",2,200.0,100.0,150.0,150.0);
    AddMenuItem(Auto,0, "Sport");
    Sport = CreateMenu("Sport",2,200.0,100.0,150.0,150.0);
    AddMenuItem(Sport,0,"A bis F");
    AddMenuItem(Sport,0,"G bis Z");


    SportAbisF = CreateMenu("A bis F",2,200.0,100.0,150.0,150.0);
    AddMenuItem(SportAbisF,0,"Alpha");
    AddMenuItem(SportAbisF,0,"Blista Compact");
    AddMenuItem(SportAbisF,0,"Buffalo");
    AddMenuItem(SportAbisF,0,"Bullet");
    AddMenuItem(SportAbisF,0,"Cheeta");
    AddMenuItem(SportAbisF,0,"Club");
    AddMenuItem(SportAbisF,0,"Euros");
    AddMenuItem(SportAbisF,0,"Flash");



    SportGbisZ = CreateMenu("G-Z",2,200.0,100.0,150.0,150.0);
    AddMenuItem(SportGbisZ,0,"Hotring Racer");
    AddMenuItem(SportGbisZ,0,"Infernus");
    AddMenuItem(SportGbisZ,0,"Jester");
    AddMenuItem(SportGbisZ,0,"Phoenix");
    AddMenuItem(SportGbisZ,0,"Sultan");
    AddMenuItem(SportGbisZ,0,"Super GT");
    AddMenuItem(SportGbisZ,0,"Turismo");
    AddMenuItem(SportGbisZ,0,"Uranus");
    AddMenuItem(SportGbisZ,0,"ZR-350");


    ------------
    OnPlayerSelectMenuRow


    new Float:x,Float:y,Float:z;
    new Float:rot;
    GetPlayerPos(playerid,x,y,z);
    GetPlayerFacingAngle(playerid,rot);



    new Menu:Menu = GetPlayerMenu(playerid);



    if(Menu == Auto)
    {
    switch(row)
    {
    case 0:
    {
    ShowMenuForPlayer(Sport,playerid);
    }
    }
    }


    if(Menu == Sport)
    {
    switch(row)
    {
    case 0:
    {
    ShowMenuForPlayer(SportAbisF,playerid);
    }
    case 1:
    {
    ShowMenuForPlayer(SportGbisZ,playerid);
    }


    }
    }


    if(Menu == SportAbisF)
    {
    switch(row)
    {
    case 0:
    {
    CreateVehicle(602,x,y,z,rot,-1,-1,-1);
    SetPlayerPos(playerid,x,y,z+3);
    TogglePlayerControllable(playerid,1);
    }
    case 1:
    {
    CreateVehicle(496,x,y,z,rot,-1,-1,-1);
    SetPlayerPos(playerid,x,y,z+3);
    TogglePlayerControllable(playerid,1);
    }
    case 2:
    {
    CreateVehicle(402,x,y,z,rot,-1,-1,-1);
    SetPlayerPos(playerid,x,y,z+3);
    TogglePlayerControllable(playerid,1);
    }
    case 3:
    {
    CreateVehicle(541,x,y,z,rot,-1,-1,-1);
    SetPlayerPos(playerid,x,y,z+3);
    TogglePlayerControllable(playerid,1);
    }
    case 4:
    {
    CreateVehicle(415,x,y,z,rot,-1,-1,-1);
    SetPlayerPos(playerid,x,y,z+3);
    TogglePlayerControllable(playerid,1);
    }
    case 5:
    {
    CreateVehicle(589,x,y,z,rot,-1,-1,-1);
    SetPlayerPos(playerid,x,y,z+3);
    TogglePlayerControllable(playerid,1);
    }
    case 6:
    {
    CreateVehicle(587,x,y,z,rot,-1,-1,-1);
    SetPlayerPos(playerid,x,y,z+3);
    TogglePlayerControllable(playerid,1);
    }
    case 7:
    {
    CreateVehicle(565,x,y,z,rot,-1,-1,-1);
    SetPlayerPos(playerid,x,y,z+3);
    TogglePlayerControllable(playerid,1);
    }


    }
    }
    if(Menu == SportGbisZ)
    {
    switch(row)
    {
    case 0:
    {
    CreateVehicle(494,x,y,z,rot,-1,-1,-1);
    SetPlayerPos(playerid,x,y,z+3);
    TogglePlayerControllable(playerid,1);
    }
    case 1:
    {
    CreateVehicle(411,x,y,z,rot,-1,-1,-1);
    SetPlayerPos(playerid,x,y,z+3);
    TogglePlayerControllable(playerid,1);
    }
    case 2:
    {
    CreateVehicle(559,x,y,z,rot,-1,-1,-1);
    SetPlayerPos(playerid,x,y,z+3);
    TogglePlayerControllable(playerid,1);
    }
    case 3:
    {
    CreateVehicle(603,x,y,z,rot,-1,-1,-1);
    SetPlayerPos(playerid,x,y,z+3);
    TogglePlayerControllable(playerid,1);
    }
    case 4:
    {
    CreateVehicle(560,x,y,z,rot,-1,-1,-1);
    SetPlayerPos(playerid,x,y,z+3);
    TogglePlayerControllable(playerid,1);
    }
    case 5:
    {
    CreateVehicle(506,x,y,z,rot,-1,-1,-1);
    SetPlayerPos(playerid,x,y,z+3);
    TogglePlayerControllable(playerid,1);
    }
    case 6:
    {
    CreateVehicle(451,x,y,z,rot,-1,-1,-1);
    SetPlayerPos(playerid,x,y,z+3);
    TogglePlayerControllable(playerid,1);
    }
    case 7:
    {
    CreateVehicle(558,x,y,z,rot,-1,-1,-1);
    SetPlayerPos(playerid,x,y,z+3);
    TogglePlayerControllable(playerid,1);
    }
    case 8:
    {
    CreateVehicle(477,x,y,z,rot,-1,-1,-1);
    SetPlayerPos(playerid,x,y,z+3);
    TogglePlayerControllable(playerid,1);
    }


    }
    }


    -----------------------


    public OnPlayerCommandText(playerid, cmdtext[])
    {
    if (strcmp("/veh", cmdtext, true, 10) == 0)
    {
    if(IsPlayerConnected(playerid))
    {
    if(IsPlayerInAnyVehicle(playerid))
    {
    GameTextForPlayer(playerid,"Du kannst kein Auto spawnen, wenn du in einem Auto sitzt",5000,3);
    }
    else
    {
    ShowMenuForPlayer(Auto,playerid);
    TogglePlayerControllable(playerid,0);
    }
    }
    }


    if (strcmp("/del", cmdtext, true, 10) == 0)
    {
    if(IsPlayerInAnyVehicle(playerid))
    {
    new carid;
    carid = GetPlayerVehicleID(playerid);
    DestroyVehicle(carid);
    GameTextForPlayer(playerid,"Auto kaputt",2000,3);
    }
    }


    return 1;
    }


    MFG Hagi