000000000000 Posted January 25, 2012 Posted January 25, 2012 Hello all, In Java I would be able to do something like this: local result = (vehicle == false or getVehicleOccupant(vehicle, 0) ~= localPlayer) This would store a boolean value in the result variable. Is there a similar way to do this in Lua? I tried searching the internet but I do not know how it's called and what to search for. Thanks in advance,
DarkLink Posted January 25, 2012 Posted January 25, 2012 Hello all,In Java I would be able to do something like this: local result = (vehicle == false or getVehicleOccupant(vehicle, 0) ~= localPlayer) This would store a boolean value in the result variable. Is there a similar way to do this in Lua? I tried searching the internet but I do not know how it's called and what to search for. Thanks in advance, I guess Lua its a bit baah compared to java Try this : if ( (vehicle == false or getVehicleOccupant(vehicle, 0) ~= localPlayer) ) then result = true else returl = false end I guess it works !
Castillo Posted January 25, 2012 Posted January 25, 2012 @Roysten: Have you even tested that? I tested it and when I wasn't on a vehicle result = true, then when I entered in a vehicle result = false, I don't know if that's what you're looking for though.
000000000000 Posted January 25, 2012 Author Posted January 25, 2012 Whoops my bad, I used it in my script and it didn't work, but there was something else not quite right (thanks to you I started looking). Now it is working though, thank you very much!
Castillo Posted January 25, 2012 Posted January 25, 2012 You're welcome. Welcome to the MTA Forums btw .
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now