Example of var for vehicle - 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: Example of var for vehicle (
/showthread.php?tid=634994)
Example of var for vehicle -
ElMaestro123 - 30.05.2017
I want to make sawmill job so i want to attach a tree to a dft. Attaching is not a problem, but how to make variable to see if it is or not attached, i mean how to create a variable for vehicle
Re: Example of var for vehicle -
Saddin - 30.05.2017
You can make something like this:
PHP код:
CreateVehicle...
AttachObjectToVehicle..
object_attached = true;
Later on you can check if it is attached or not like this:
PHP код:
if(object_attached == true)
{
//is attached
}
else if(object_attached == false)
{
//isn't attached
}
To define bool use this:
PHP код:
new bool:object_attached[MAX_PLAYERS]; //for each player
Hope I helped
Re: Example of var for vehicle -
ElMaestro123 - 30.05.2017
Oh thank you! This is very helpful
Re: Example of var for vehicle -
Saddin - 30.05.2017
One correction, if you use [MAX_PLAYERS] for variable definition, after when you use that variable you must put [playerid] after variable name.
Example:
PHP код:
object_attached[playerid] // or whatever ID of player you are using
Instead of just "object_attached" ...