Jump to content

Syntax question


000000000000

Recommended Posts

Posted

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,

Posted
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 xD

Try this :

if ( (vehicle == false or getVehicleOccupant(vehicle, 0) ~= localPlayer) ) then 
result = true 
else 
returl = false 
end 
  

I guess it works !

Posted

@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.

Posted

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!

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...