SA-MP Forums Archive
Bool variable 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: Bool variable for vehicle (/showthread.php?tid=636624)



Bool variable for vehicle - ElMaestro123 - 01.07.2017

Hello, how to make a bool variable for a specific vehicle and how to do checks with variables?


Re: Bool variable for vehicle - Bigwebicek - 01.07.2017

Код:
new bool:variableName[MAX_VEHICLES]; // on top of your script, default is FALSE

//checking boolean
if(variableName[vehicleid] == false) // if boolean equals false
if(variableName[vehicleid] == true) // if boolean equals true

//assigning boolean
variableName[vehicleid] = true; // sets that boolean to true
variableName[vehicleid] = false; // sets that boolean to false

// you should reload the variable (for that vehicle) when the new vehicle is spawned