SA-MP Forums Archive
Assigning variables to vehicles - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Assigning variables to vehicles (/showthread.php?tid=461685)



Assigning variables to vehicles - Gecko75 - 02.09.2013

I'm trying to make a system, to where when you click a dialog list button, it spawns that selected vehicle on a certain spot.. But I'm trying to think of a way where I can assign it to a variable so I can despawn/destroy it later with a command.


Re: Assigning variables to vehicles - SuperViper - 02.09.2013

When you create a vehicle, it returns the vehicle ID. Ex:

pawn Код:
new mySpawnedVehicle;

public OnGameModeInit()
{
    mySpawnedVehicle = CreateVehicle(411, ...);
    return 1;
}

DestroyVehicle(mySpawnedVehicle);