almafa123 Posted October 28, 2016 Share Posted October 28, 2016 Hello function timerUnjailPlayer(jailedPlayer) local timeLeft = getElementData(jailedPlayer,"jail->Jailtime") timeLeft = timeLeft - 1 if tonumber(timeLeft) <= 0 then dbPoll ( dbQuery( connection, "UPDATE accounts SET jailedtime='0', jailed='0' WHERE id='?'", getElementData(jailedPlayer, "acc.accountID")), -1 ) setElementData(jailedPlayer, "jail->Jailtime", 0) setElementData(jailedPlayer, "jail->Timer", nil) setElementData(jailedPlayer, "jail->Time", 0) setElementPosition(jailedPlayer, 1519.7177734375, -1697.8154296875, 13.546875) setPedRotation(jailedPlayer, 269.92446899414) setElementDimension(jailedPlayer, 0) setElementInterior(jailedPlayer, 0) setCameraInterior(jailedPlayer, 0) toggleControl(jailedPlayer,'next_weapon',true) toggleControl(jailedPlayer,'previous_weapon',true) toggleControl(jailedPlayer,'fire',true) toggleControl(jailedPlayer,'aim_weapon',true) outputChatBox("#87D37CKiszabadítottak a börtönbõl! Legközelebb ésszel viselkedj!", jailedPlayer, 0, 0, 0,true) else setElementData(jailedPlayer,"jail->Jailtime",timeLeft) dbPoll ( dbQuery( connection, "UPDATE accounts SET jailedtime=? WHERE id='?'",tonumber(timeLeft), getElementData(jailedPlayer, "acc.accountID")), -1 ) end end Warning: /admin/codeserver.lua:822: Bad argument @ 'getelementdata' [Expected element at argument 1] Error: /admin/codeserver.lua:823: attempt to perform arithmetic on local 'timeLeft' (a boolean value) Please help me. Thanx. Link to comment
Dealman Posted October 28, 2016 Share Posted October 28, 2016 If there is no data available it will return false. false is a boolean value - obviously you can't do math with a boolean. Make sure there are no typos first of all, otherwise make sure it returns a valid value before trying to do math with it. Link to comment
Addlibs Posted October 28, 2016 Share Posted October 28, 2016 This seems like the function timerUnjailPlayer receives a nil instead of the player on parameter jailedPlayer (hence error at line 822) and that results in no element data being collected, creating an arithmetic error on line 823 when trying to compare no data to a number. 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