Bilal135 Posted September 12, 2015 Share 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. Link to comment
t3wz Posted September 12, 2015 Share 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. Link to comment
Bilal135 Posted September 12, 2015 Author Share Posted September 12, 2015 I've never done such thing, so can someone please put an example? Link to comment
1LoL1 Posted September 12, 2015 Share 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() Link to comment
Bilal135 Posted September 13, 2015 Author Share Posted September 13, 2015 Doesnt work ^^ Link to comment
KariiiM Posted September 13, 2015 Share Posted September 13, 2015 function timer () newValue = + 0.05 local settime = setElementData(source, "Rep", newValue) setTimer(settime ,60000, 0) end Link to comment
Bilal135 Posted September 13, 2015 Author Share 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 "+" Link to comment
1LoL1 Posted September 13, 2015 Share Posted September 13, 2015 Doesnt work ^^ What not work? I tested and worked. Link to comment
Rob Posted September 13, 2015 Share 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) Link to comment
DarkByte Posted September 23, 2015 Share Posted September 23, 2015 Bilal trying to clone groam again ha? Link to comment
Al3grab Posted September 23, 2015 Share 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) 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