Jump to content

Problem


Bilal135

Recommended Posts

Posted

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"

Posted

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.

Posted
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() 
  

Posted
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"

Posted
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

  • 2 weeks later...
Posted

Bilal trying to clone groam again ha?

When I hear someone saying Mac is better than PC.

o0pjNKG.gif w0t?VeJXjxD.gifw0t? evspcFJ.gifw0t?

Great minds discuss ideas, average minds discuss events and small minds discuss people.

Posted
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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...