rusztamas Posted June 8, 2017 Share Posted June 8, 2017 Hello! I have the following problem: It is really annoying, because i don't know why is this happening. Whether i am in the car or not, it is spamming the debugscript, and starts, after i sat in the vehicle. function getJarmuElet() local jatekosVehicle = getPedOccupiedVehicle ( localPlayer ) local jarmuHealth = getElementHealth ( jatekosVehicle ) / 10 if jatekosVehicle and jarmuHealth then return jarmuHealth else return nil end end if jarmuHealth > 80 then dxDrawText ("Jármű: #42f448OK!", 1480/devX*jatekosX, 802.5/devY*jatekosY, _, _, _, _, "default-bold", _, _, _, _, _, true) elseif jarmuHealth <= 79 and jarmuHealth >= 51 then dxDrawText ("Jármű: #f49141STOP!", 1475/devX*jatekosX, 802.5/devY*jatekosY, _, _, _, _, "default-bold", _, _, _, _, _, true) elseif jarmuHealth <= 50 then dxDrawText ("Jármű: #f45241SERV!", 1475/devX*jatekosX, 802.5/devY*jatekosY, _, _, _, _, "default-bold", _, _, _, _, _, true) end jarmuHealth's definition in the other function: local jatekosVehicle = getPedOccupiedVehicle (localPlayer) --this one is defined as well, because later there are some things that need the vehicle element local jarmuHealth = getJarmuElet() Line 23 is the 3d line of function getJarmuElet. Sorry for hungarian namings, i already got used to it, but trying to use mixed languages in production code, and trying to use full english next time. But please help, i really don't know what the problem is. Link to comment
kikos500 Posted June 9, 2017 Share Posted June 9, 2017 function getJarmuElet() local jatekosVehicle = getPedOccupiedVehicle ( localPlayer ) if not jatekosVehicle then return end local jarmuHealth = getElementHealth ( jatekosVehicle ) / 10 if jatekosVehicle and jarmuHealth then return jarmuHealth else return nil end end try this 1 Link to comment
rusztamas Posted June 9, 2017 Author Share Posted June 9, 2017 now this error is gone, but there is an other, i will post it here as soon as i arrive home from school Link to comment
rusztamas Posted June 9, 2017 Author Share Posted June 9, 2017 Thank you for your help! You made me understand what the problem was, did this in a few cases too, fixed the buggy script. Link to comment
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