30.12.2012, 22:35
You should try using player vehicles instead, so assign them to a playerid.
EDIT: At the end of CreateVehicle, there is a respawn delay parameter, you just need to set this to -1 to prevent it from respawning.
https://sampwiki.blast.hk/wiki/CreateVehicle
pawn Код:
new veh[MAX_PLAYERS];
public OnPlayerConnect(playerid)
{
veh[playerid] = -1;
return 1;
}
public OnPlayerDisconnect(playerid)
{
if(veh[playerid] != -1)
{
DestroyVehicle(veh[playerid]);
}
return 1;
}
COMMAND:car(playerid,params[])
{
new model, carc1, carc2;
new Float:x, Float:y, Float:z;
if(sscanf(params, "iii", model, carc1, carc2)) return SendClientMessage(playerid, RAUDONA, "/car [model_id] [color1] [color2]");
GetPlayerPos(playerid, x, y, z);
if(veh[playerid] != -1)
{
DestroyVehicle(veh[playerid]);
}
veh[playerid] = CreateVehicle(model, x, y+5, z+2, 0, spalva1, spalva2, 400);
TrDegalai[veh[playerid]] = 8.0;
SendClientMessage(playerid, BALTA, "Car created!");
return 1;
}
https://sampwiki.blast.hk/wiki/CreateVehicle