Bilal135 Posted September 12, 2015 Posted September 12, 2015 I have a problem with my reputation system. This should increase everyone's reputation 0.25 once every 1 minute, but this is not working. function timer() newValue = + 0.05 setTimer(function() setElementData(source, "Rep", newValue) end, 60000, 0) end Thanks in advance.
t3wz Posted September 12, 2015 Posted September 12, 2015 in the newValue variable you're increasing nil with + 0.05 (this will cause an error on /debugscript) also source isn't defined on the timer's function, you have to make a loop with all players and then increase him reputation.
Bilal135 Posted September 12, 2015 Author Posted September 12, 2015 I've never done such thing, so can someone please put an example?
1LoL1 Posted September 12, 2015 Posted September 12, 2015 I've never done such thing, so can someone please put an example? Try this: function timer() for _, p in ipairs(getElementsByType("player")) do setTimer ( function() setElementData(p, "Rep", getElementData(p, "Rep") + 0.05) end, 60000, 0) end end timer()
KariiiM Posted September 13, 2015 Posted September 13, 2015 function timer () newValue = + 0.05 local settime = setElementData(source, "Rep", newValue) setTimer(settime ,60000, 0) end
Bilal135 Posted September 13, 2015 Author Posted September 13, 2015 function timer () newValue = + 0.05 local settime = setElementData(source, "Rep", newValue) setTimer(settime ,60000, 0) end Error: Loading script failed, unexpected symbol near "+"
1LoL1 Posted September 13, 2015 Posted September 13, 2015 Doesnt work ^^ What not work? I tested and worked.
Rob Posted September 13, 2015 Posted September 13, 2015 setTimer(function() for k,v in ipairs(getElementsByType("player")) do local level = getElementData(v,"rep") or 0 setElementData(v,"rep",level+0.5) end end, 60000, 0)
Al3grab Posted September 23, 2015 Posted September 23, 2015 function qwe() for i,v in ipairs ( getElementsByType("player") ) do setElementData(v,"Rep",((tonumber(getElementData(v,"Rep")) or 0) + 0.05 )) end end qwe() setTimer(qwe,60 * 1000 ,0)
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