Example of var for vehicle
#1

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
Reply
#2

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
Reply
#3

Oh thank you! This is very helpful
Reply
#4

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" ...
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)