Newbie Posted November 10, 2014 Posted November 10, 2014 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
Moderators IIYAMA Posted November 10, 2014 Moderators Posted November 10, 2014 You forgot to define how much it repeats: setTimer(hay,2000,1) 1 = 1 time 10 = 10 times 0 = infinity
Newbie Posted November 10, 2014 Author Posted November 10, 2014 Still same sh.. at argument 1, got object
Saml1er Posted November 10, 2014 Posted November 10, 2014 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
Newbie Posted November 10, 2014 Author Posted November 10, 2014 lol. Thanks Sam, and all other who helped
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