..:D&G:.. Posted February 15, 2015 Posted February 15, 2015 Hey, I am trying to make a speedometer and the script returns boolean instead of the vehicle when I try to see if the vehicle has it's lights on. local vehicle = getPedOccupiedVehicle(localPlayer) if ( getVehicleOverrideLights ( vehicle ) == 2 ) then disc = guiCreateStaticImage(screenX - globalImageWidth - globalOffsetX, screenY - globalImageHeight - ( globalOffsetY + 15 ), globalImageWidth, globalImageHeight, "speedometer/disc.png", false) Any ideas how to fix it? MTA:Rust Pre-Alpha Build v.0.3: https://forum.mtasa.com/viewtopic.php?f=114&t=97848 2Pac: ''Only God can judge me!''
Castillo Posted February 15, 2015 Posted February 15, 2015 You mean that getPedOccupiedVehicle returns a boolean instead of the vehicle element? then, I guess the player is not in a vehicle at all? San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
..:D&G:.. Posted February 15, 2015 Author Posted February 15, 2015 getVehicleOverrideLights returns boolean, and when I start the resource I get that error, and the player is not in a vehicle, but it should work when the player gets in a vehicle.. MTA:Rust Pre-Alpha Build v.0.3: https://forum.mtasa.com/viewtopic.php?f=114&t=97848 2Pac: ''Only God can judge me!''
Castillo Posted February 15, 2015 Posted February 15, 2015 getVehicleOverrideLights will return a boolean ( false in this case ) if "vehicle" is not a vehicle element. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Moderators IIYAMA Posted February 16, 2015 Moderators Posted February 16, 2015 As Solidsnake14 said, solution: if vehicle and getVehicleOverrideLights ( vehicle ) == 2 then Do you want to improve your Lua programming skills and make less mistakes? Start with Lua Language Server! Useful functions 3x Spoiler checkPassiveTimer getScreenStartPositionFromBox getPedGender Tutorials 4x Spoiler Scaling DX Events Attach an addEventHandler on a group of elements Debugging
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