Destroy Vehicle After Spawn Another One
#3

Quote:
Originally Posted by MouseBreaker
Посмотреть сообщение
The script is really messy.

But you can save the vehicle ID in a variable and remove it after spawn another one.

pawn Код:
new SpawnedVehicle[MAX_PLAYERS];

if(IsValidVehicle(SpawnedVehicle[playerid]))
    DestroyVehicle(SpawnedVehicle[playerid]);
   
SpawnedVehicle[playerid] = CreateVehicle(...);
Important! Don't forgot to reset the variable and remove the vehicle after the player leaves the server.

pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
    if(IsValidVehicle(SpawnedVehicle[playerid]))
        DestroyVehicle(SpawnedVehicle[playerid]);
       
    SpawnedVehicle[playerid] = INVALID_VEHICLE_ID;
    return 1;
}
The function IsValidVehicle is not defined in a_samp include, because of that don't forgot to add.

pawn Код:
native IsValidVehicle(vehicleid);
Top of your script.
umm i don't understand the part
pawn Код:
SpawnedVehicle[playerid] = CreateVehicle(...);
what should i put in the (...) ?
Reply


Messages In This Thread
Destroy Vehicle After Spawn Another One - by wasabi1798 - 16.06.2013, 11:20
AW: Destroy Vehicle After Spawn Another One - by Skimmer - 16.06.2013, 12:15
Re: AW: Destroy Vehicle After Spawn Another One - by wasabi1798 - 17.06.2013, 11:42
Re: Destroy Vehicle After Spawn Another One - by wasabi1798 - 21.06.2013, 04:10
Re: Destroy Vehicle After Spawn Another One - by xFirex - 21.06.2013, 04:21

Forum Jump:


Users browsing this thread: 2 Guest(s)