02.10.2011, 23:04
Well, I made a car spawner, but obviously the cars pile and pile and pile. I was trying to find a way to when they spawn one car it stays, then if they spawn another, the one before it gets destroyed. I'll just show you a snip of it. Any help would be greatly appreciated!
DIALOG:
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp(cmdtext, "/carmenu",true)==0)
{
if(IsPlayerConnected(playerid))
{
if(spawnedcar[playerid] != 0)
{
new scar;
scar= GetPlayerVehicleID(playerid);
RemovePlayerFromVehicle(playerid);
DestroyVehicle(scar);
ShowMenuForPlayer(CarMenu,playerid);
spawnedcar[playerid] = 0;
TogglePlayerControllable(playerid, 0);
}
else if(spawnedcar[playerid] != 1)
{
ShowMenuForPlayer(CarMenu,playerid);
spawnedcar[playerid] = 1;
TogglePlayerControllable(playerid, 0);
}
}
return 1;
}
pawn Код:
public OnPlayerSelectedMenuRow(playerid, row)
{
new Menu:CurrentMenu = GetPlayerMenu(playerid);
new Float:x, Float:y, Float:z, Float:a;
GetPlayerFacingAngle(playerid,a);
GetPlayerPos(playerid, x, y, z);
new car;
if(CurrentMenu == CarMenu)
{
switch(row)
{
case 0: //infernus
{
car=CreateVehicle(411,x,y,z+4,a,-1,-1,30000);
PutPlayerInVehicle(playerid,car,0);
spawnedcar[playerid] = 1;
SendClientMessage(playerid, 0x33CCFFAA, "<| You Have Selected the: Infernus |>");
TogglePlayerControllable(playerid, 1);
}