adithegman Posted May 2, 2013 Posted May 2, 2013 hello guys, i'm tryng to make a script that every five minutes it cleares the chat, but... it doesn't work pls help This is client-side local cleared = 0 function timer() if ( cleared == 0 ) then setTimer ( clearChat, 60000*5, 1 ) cleared = 1 end end function clearChat() done=0 cleared = 0 while done<=200 do outputChatBox("",0,0,0,false) done = done+1 end setTimer ( timer, 1, 1 ) end addEventHandler ( "onClientResourceStart", getRootElement, timer )
PaiN^ Posted May 2, 2013 Posted May 2, 2013 Not Tested ! local check = 0 addEventHandler ( 'onClientResourceStart', resourceRoot, function ( ) while check == 0 do triggerEvent ( 'onChatClear', root, clear ) check = 1 end end ) function clear ( ) local done = 0 while done <= 200 do outputChatBox ( '', root ) done = done + 1 end setTimer ( function ( ) check = 0 end, 60000 * 5, 1 ) end addEvent ( 'onChatClear', true ) addEventHandler ( 'onChatClear', root, clear )
Guest Guest4401 Posted May 2, 2013 Posted May 2, 2013 @Pαίй Your code executes it just once @adithegman Try this: setTimer( function() for i = 1,200 do outputChatBox' ' end end,300000,0 ) You should remember that if this is clientside, chat won't be cleared at the same time for everyone.
adithegman Posted May 2, 2013 Author Posted May 2, 2013 not working... working just when start the resource
Guest Guest4401 Posted May 2, 2013 Posted May 2, 2013 not working... working just when start the resource Have your tried my code?: setTimer( function() for i = 1,200 do outputChatBox' ' end end,300000,0 ) Wait for 5 minutes after starting the resource.
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