Unique Posted December 19, 2020 Share Posted December 19, 2020 Code: Spoiler local hoursplayed = getElementData(localPlayer, "hoursplayed") if (jobtext=="RS Haul Delivery") then elseif (getElementData(localPlayer, "hoursplayed") or 0) < 50 then outputChatBox("You must play at least 50 hours to work as a RS haul delivery driver", 255, 0,0) return true end Somebody?! did you see where is the problem? i don't get it.. i can take the job if i got < 50 hours Link to comment
Addlibs Posted December 19, 2020 Share Posted December 19, 2020 (edited) Have you tried rudimentaly debugging steps? Have you checked /debugscript 3? Have you checked whether hoursplayed has a value and if it's numeric? You can check that with runcode (that is, make sure the runcode resource is running when attempting the following command) using /crun getElementData(localPlayer, "hoursplayed") If you're not getting debug errors in debugscript, I'd bet that hoursplayed element data is nil, and gets coalesced to 0 on this line elseif (getElementData(localPlayer, "hoursplayed") or 0) < 50 then and compared against 50, 0 is less than 50, so entire condition evaluates as false and the conditional code does not get executed. Edited December 19, 2020 by Addlibs Link to comment
Tekken Posted December 19, 2020 Share Posted December 19, 2020 Try with > insted of < Link to comment
justn Posted December 19, 2020 Share Posted December 19, 2020 You put 'elseif' as in if the job wasn't the 'RS Haul Delivery' then it would check if the hours played is below 50, which is why you were able to get the job regardless of how many hours played. Here you go though. local hoursplayed = tonumber(getElementData(localPlayer, "hoursplayed")) or 0 if (jobtext=="RS Haul Delivery") then if hoursplayed < 50 then outputChatBox("You must play at least 50 hours to work as a RS haul delivery driver", 255, 0,0) return true end end 1 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