Hallo ich habe ein Command das heisst /cars, irgend von nem Tut, aber das spawnt bei jeder auswahlt ein neues fahrzeug und ich will das das alte immer gelöscht wird.
Pawn Code:
if(!strcmp(cmdtext, "/autos", true) || !strcmp(cmdtext, "/cars", true))
{
ShowMenuForPlayer(autospawn, playerid);
TogglePlayerControllable(playerid, false);
return 1;
}
autospawn = CreateMenu("~r~Auto Auswahl", 2, 400.0, 100.0, 150.0, 150.0);
AddMenuItem(autospawn, 0, "Infernus");
AddMenuItem(autospawn, 0, "Bullet");
AddMenuItem(autospawn, 0, "Sultan");
AddMenuItem(autospawn, 0, "Elegy");
AddMenuItem(autospawn, 0, "Turismo");
new Float:X,Float:Y,Float:Z,Float:Angle, carid;
GetPlayerPos(playerid,X,Y,Z);
GetPlayerFacingAngle(playerid,Angle);
carid = GetPlayerVehicleID(playerid);
carid = CreateVehicle(411,X,Y,Z,Angle,-1,-1,600);
PutPlayerInVehicle(playerid,carid,0);
TogglePlayerControllable(playerid, true);
return SendClientMessage(playerid, 0xFFFFFFAA, "Auto [Infernus] wurde erfolgreich gespawnt!");
}
}
case 1:
{
if(IsPlayerInAnyVehicle(playerid))
{
HideMenuForPlayer(autospawn, playerid);
SendClientMessage(playerid,0xFFFFFFAA, "Du musst das Auto verlassen, wenn du ein Auto spawnen willst!");
TogglePlayerControllable(playerid, true);
}
else
{
new Float:X,Float:Y,Float:Z,Float:Angle, carid;
GetPlayerPos(playerid,X,Y,Z);
GetPlayerFacingAngle(playerid,Angle);
carid = GetPlayerVehicleID(playerid);
carid = CreateVehicle(541,X,Y,Z,Angle,-1,-1,600);
PutPlayerInVehicle(playerid,carid,0);
TogglePlayerControllable(playerid, true);
return SendClientMessage(playerid, 0xFFFFFFAA, "Auto [Bullet] wurde erfolgreich gespawnt!");
}
}
case 2:
{
if(IsPlayerInAnyVehicle(playerid))
{
HideMenuForPlayer(autospawn, playerid);
SendClientMessage(playerid,0xFFFFFFAA, "Du musst das Auto verlassen, wenn du ein Auto spawnen willst!");
TogglePlayerControllable(playerid, true);
}
else
{
new Float:X,Float:Y,Float:Z,Float:Angle, carid;
GetPlayerPos(playerid,X,Y,Z);
GetPlayerFacingAngle(playerid,Angle);
carid = GetPlayerVehicleID(playerid);
carid = CreateVehicle(560,X,Y,Z,Angle,-1,-1,600);
PutPlayerInVehicle(playerid,carid,0);
TogglePlayerControllable(playerid, true);
return SendClientMessage(playerid, 0xFFFFFFAA, "Auto [Sultan] wurde erfolgreich gespawnt!");
}
}
case 3:
{
if(IsPlayerInAnyVehicle(playerid))
{
HideMenuForPlayer(autospawn, playerid);
SendClientMessage(playerid,0xFFFFFFAA, "Du musst das Auto verlassen, wenn du ein Auto spawnen willst!");
TogglePlayerControllable(playerid, true);
}
else
{
new Float:X,Float:Y,Float:Z,Float:Angle, carid;
GetPlayerPos(playerid,X,Y,Z);
GetPlayerFacingAngle(playerid,Angle);
carid = GetPlayerVehicleID(playerid);
carid = CreateVehicle(562,X,Y,Z,Angle,-1,-1,600);
PutPlayerInVehicle(playerid,carid,0);
TogglePlayerControllable(playerid, true);
return SendClientMessage(playerid, 0xFFFFFFAA, "Auto [Elegy] wurde erfolgreich gespawnt!");
}
}
case 4:
{
if(IsPlayerInAnyVehicle(playerid))
{
HideMenuForPlayer(autospawn, playerid);
SendClientMessage(playerid,0xFFFFFFAA, "Du musst das Auto verlassen, wenn du ein Auto spawnen willst!");
TogglePlayerControllable(playerid, true);
}
else
{
new Float:X,Float:Y,Float:Z,Float:Angle, carid;
GetPlayerPos(playerid,X,Y,Z);
GetPlayerFacingAngle(playerid,Angle);
carid = GetPlayerVehicleID(playerid);
carid = CreateVehicle(451,X,Y,Z,Angle,-1,-1,600);
PutPlayerInVehicle(playerid,carid,0);
TogglePlayerControllable(playerid, true);
return SendClientMessage(playerid, 0xFFFFFFAA, "Auto [Turismo] wurde erfolgreich gespawnt!");
}
}
}
}
return 1;
}
Das ist alles