use this. this is more simple.
add this to top of your script.
pawn Код:
new SpawnedVehicle[MAX_PLAYERS];
and put this every where you want
pawn Код:
stock SpawnCar(playerid,vehicleid)
{
if(SpawnedVehicle[playerid] != 0)
{
DestroyVehicle(SpawnedVehicle[playerid]);
}
new Float:X, Float:Y, Float:Z, Float:Angle;
GetPlayerPos(playerid, Float:X, Float:Y, Float:Z);
GetPlayerFacingAngle(playerid, Float:Angle);
SpawnedVehicle[playerid] = CreateVehicle(vehicleid, X, Y, Z + 2.0, Angle + 90.0, -1, -1, 600);
SetVehicleVirtualWorld(SpawnedVehicle[playerid], GetPlayerVirtualWorld(playerid));
LinkVehicleToInterior(SpawnedVehicle[playerid], GetPlayerInterior(playerid));
PutPlayerInVehicle(playerid, SpawnedVehicle[playerid], 0);
}
Command like this:
if you use zcmd:
pawn Код:
CMD:heli(playerid,params[])
{
SpawnCar(playerid,411);
return 1;
}
if use normal command
pawn Код:
if(!strcmp(cmdtext, "/heli", true, 5))
{
SpawnCar(playerid,411);
}