Jump to content

Problem with timer.


Recommended Posts

Hello, i have this script:

local marker = createMarker( 206.8258972168, -1656.9514160156, 13.52540397644, "checkpoint") 
  
addEventHandler("onMarkerHit", marker, 
function(hitElement) 
if (getElementType(hitElement) == "player") then 
givePlayerMoney(hitElement, 5000) 
setTimer ( givePlayerMoney , 1000, 1) 
end 
end 
) 
  

I try to make a timer, so that i get money every second, i don't know how to do it and did alot of nonsense, any help?

Link to comment
local marker = createMarker ( 206.8258972168, -1656.9514160156, 13.52540397644, "checkpoint" ) 
  
setTimer ( 
    function ( ) 
        for _, player in ipairs ( getElementsWithinColShape ( getElementColShape ( marker ), "player" ) ) do 
            givePlayerMoney ( player, 5000 ) 
        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...