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. "Get busy living or get busy dying"
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? "Get busy living or get busy dying"
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()
Bilal135 Posted September 13, 2015 Author Posted September 13, 2015 Doesnt work ^^ "Get busy living or get busy dying"
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 "+" "Get busy living or get busy dying"
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) Visit us on ngcmta.com
DarkByte Posted September 23, 2015 Posted September 23, 2015 Bilal trying to clone groam again ha? When I hear someone saying Mac is better than PC. w0t?w0t? w0t? Great minds discuss ideas, average minds discuss events and small minds discuss people.
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) ING : [xXx]~Al3grab
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