Jump to content

How to see if the player is in one vehicle spawned earlier?


Noox

Recommended Posts

I want to give player some moneys when he is in a vehicle the game spawned when a key was pressed but I noticed that isInVehicle() doesn't take any arguments so I thought I might ask here, I have a Vehicle type variable named randomVehicle, how can I see if the player is inside randomVehicle?

 

EDIT: I found now currentVehicle, since I cannot try right now is the syntax

 

if(Player.Character.CurrentVehicle == randomVehicle)

?

Edited by Noox
Link to comment
Share on other sites

isInVehicle does take an argument for the vehicle.

QFEf35H.png

 

You can also check if the current vehicle equals the other vehicle (which you already wrote).

Or you can use isSittingInvehicle (which, just to make sure you know, does take an argument for the vehicle).

Edited by LetsPlayOrDy
Link to comment
Share on other sites

My Visual Studio was saying otherwise :catspider:

Link to comment
Share on other sites

My Visual Studio was saying otherwise :catspider:

What version are you using? I've had that problem before I believe, and I just updated to 2013.

Link to comment
Share on other sites

 

My Visual Studio was saying otherwise :catspider:

What version are you using? I've had that problem before I believe, and I just updated to 2013.

 

2013 just like you

Link to comment
Share on other sites

 

 

My Visual Studio was saying otherwise :catspider:

What version are you using? I've had that problem before I believe, and I just updated to 2013.

 

2013 just like you

 

Well then I have no idea! :D

(Maybe restart VS, if you already haven't done that.)

Link to comment
Share on other sites

Maro Hannover

I use MSVS 2010 Ultimate.

What is difference between 2010 and 2013

 

I 've found a way

 

USE THIS

if(Player.Character.LastVehicle == randomVehicle){//what you want to happen}
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • 1 User Currently Viewing
    0 members, 0 Anonymous, 1 Guest

×
×
  • Create New...

Important Information

By using GTAForums.com, you agree to our Terms of Use and Privacy Policy.