abu5lf Posted March 5, 2012 Posted March 5, 2012 (edited) 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 December 25, 2012 by Guest
Aibo Posted March 5, 2012 Posted March 5, 2012 lines 1 and 2 are useless. also read about setTimer parameters, you have 1 timer repetition set.
bandi94 Posted March 5, 2012 Posted March 5, 2012 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 )
drk Posted March 5, 2012 Posted March 5, 2012 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 )
abu5lf Posted March 5, 2012 Author Posted March 5, 2012 There was a problem in the compilation of money, thank you very much @Draken
bandi94 Posted March 5, 2012 Posted March 5, 2012 @ Draken you like copy past no joke ( i saw you on some post copy paste modifing a timer and .... never mind )
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