Jump to content

Timer help needed


Newbie

Recommended Posts

Since i never worked with timers, it looks hard to unerstand to me..

function buyHay (source) 
    thePlayer = source 
    cash = getPlayerMoney(source) 
    local nick = getPlayerName(source)   
    local x,y,z = getElementPosition(source) 
    local level = getElementData(source,"Level") 
    local hay = createObject(3374, x, y, z)  
    if level > 1 and cash > 10 then 
    setTimer(hay,2000) 
    givePlayerMoney ( thePlayer, -10 )  else 
    outputChatBox("You need more cash or your level does not meet the requirements", source, 255, 255, 255, true) 
    end 
    end 
addCommandHandler("buyhay", buyHay) 

it should create hay stack after 2 secs but does it instant

Link to comment
  
  
    if level > 1 and cash > 10 then 
    setTimer(createObject,2000,1,3374, x, y, z) 
    givePlayerMoney ( thePlayer, -10 )  else 
    outputChatBox("You need more cash or your level does not meet the requirements", source, 255, 255, 255, true) 
    end 
  

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