Hi all. Trying to create command, that spawns cars. And now I have a question. How to do, that one player can spawn a lot of cars? Now if i spawn first car ant type /scar second time, first car disappears. I want to spawn a lot of cars. Also I need that, if I have spawned 3 cars for example and first car destroys, other 2 stays.
Code:
new sCar[MAX_PLAYERS];
Code:
if(!strcmp(cmdtext, "/scar", false, 5))
{
if(!strlen(cmdtext[5]) return SendClientMessage(playerid, red, "Usage: /scar [Model ID]");
new veh = strval(cmdtext[5]);
if(veh < 400 || veh > 611) return SendClientMessage(playerid, red, "ERROR: Invalid Vehicle Model");
new Float:x, Float:y, Float:z, Float:a;
GetPlayerPos(playerid, x,y,z); GetPlayerFacingAngle(playerid, a);
sCar[playerid] = CreateVehicle(veh, x,y,z, a, -1, -1, -1);
return 1;
}
Code:
public OnVehicleDeath(vehicleid)
{
for(new x; x<MAX_PLAYERS; x++)
{
if(sCar[x] != 0) continue;
if(sCar[x] == vehicleid)
{
DestroyVehicle(vehicleid);
break;
}
}
return 1;
}