Jump to content
maihym

Checking if a player is in a vehicle

Recommended Posts

How can I check if a player is in a vehicle? I basically want it to say this If (player is in a vehicle) then (do this).

Share this post


Link to post
Share on other sites

hi,

if !(player == vehicle player) then {do something};

But for better performance you should use objectParent:

if !(isNull objectParent player) then {do something};

cya.

 

Nikiller.

  • Like 1

Share this post


Link to post
Share on other sites

hi,

if !(player == vehicle player) then {do something};
But for better performance you should use objectParent:

if !(isNull objectParent player) then {do something};
cya.

 

Nikiller.

So that's saying that the player is in the vehicle right?

Share this post


Link to post
Share on other sites

So that's saying that the player is in the vehicle right?

Correct.

Share this post


Link to post
Share on other sites

But for better performance you should use objectParent:

if !(isNull objectParent player) then {do something};

Thanks man, didn't know about the objectParent command.

Share this post


Link to post
Share on other sites

Ok now how would I put

if !(isNull objectParent player) then {do something};

As a variable. So basically its like if(is a player and not in a car) then (do something)

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×