Moderators Pirulax Posted May 17, 2017 Moderators Posted May 17, 2017 (edited) Hello guys, for some reason debugscript is saying this..Heres my script piece: setElementData(p, "acc:admin", 7) if not getElementData(p, "acc:admin") > 0 then return end Nothing else changes acc:admin. Edit: Found the solution: setElementData(p, "acc:admin", 7) if not (getElementData(p, "acc:admin") > 0) then return end But, i still don't understand, so can someone explain me whats the difference between those code blocks? Edited May 17, 2017 by Pirulax
Amine#TN Posted May 17, 2017 Posted May 17, 2017 getElementData(p, "acc:admin") > 0 (getElementData(p, "acc:admin") > 0) the difference is in the () TN Zombies infection Project OWNERi choose a wrong partner
Moderators IIYAMA Posted May 17, 2017 Moderators Posted May 17, 2017 getElementData(p, "acc:admin") > 0 if not getElementData(p, "acc:admin") > 0 then return end local numberValue = getElementData(p, "acc:admin") -- 7 outputDebugString(not numberValue) -- false false > 0 = Attempt to compare number with boolean (getElementData(p, "acc:admin") > 0) if not (getElementData(p, "acc:admin") > 0) then return end local numberValue = getElementData(p, "acc:admin") -- 7 outputDebugString(numberValue > 0) -- true local result = numberValue > 0 -- true outputDebugString(not result) -- false ( ) <<< priority! 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