Jump to content

Problem setTimer


abu5lf

Recommended Posts

local from = get("from") 
local to = get("to") 
  
  
function consoleGiveCash (  )  
    local cx = math.random(5555,1005) 
    setPlayerMoney( getRootElement(), cx ) 
    outputChatBox(" Has Won "..cx.."$" ,root, 255, 255,0,true ) 
end 
setTimer ( consoleGiveCash, 1000, 1 ) 

Giving money, but after the passage of time does not give him

Edited by Guest
Link to comment

setTimer ( consoleGiveCash, 1000, 1 )

setTimer(function,interval,timetoexecute)

you put 1 for timetoexecute and then the tmer after 1 loop its stop you need to put 0 if you wanna that the timer run to infinity or while the resource is stoped

  
function consoleGiveCash (  ) 
    local cx = math.random(5555,1005) 
    setPlayerMoney( getRootElement(), cx ) 
    outputChatBox(" Has Won "..cx.."$" ,root, 255, 255,0,true ) 
end 
setTimer ( consoleGiveCash, 1000, 0 ) 

Link to comment
setTimer ( 
    function ( ) 
        local cx = math.random ( 1005, 5555 ) 
        for i, v in ipairs ( getElementsByType ( 'player' ) ) do 
            givePlayerMoney ( v, cx ) 
            outputChatBox( 'You won ' .. cx, v, 255, 255, 255, false ) 
        end 
    end, 
1000, 0 ) 

Link to comment

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...