[M]ister Posted November 22, 2013 Posted November 22, 2013 (edited) Hello, I created a script so that after 10 seconds the player entered the server, it is redirected, more is not working Client: function timer() second = 10 timer = setTimer(function() second = second-1 end, 1000, 0) end addEventHandler("onClientResourceStart", root, timer) function timer2() if second == 0 then triggerServerEvent ( "redirection", localPlayer ) end end Server: function timer3(thePlayer) -- for index, player in ipairs ( getElementsByType ( "player" ) ) do redirectPlayer ( player, "46.163.78.135", 22004 ) -- end end addEvent( "redirection", true ) addEventHandler( "redirection", root, timer3 ) Edited November 23, 2013 by Guest
TAPL Posted November 23, 2013 Posted November 23, 2013 Why you need the client side? Server Side: addEventHandler("onPlayerJoin", root, function() setTimer(function(player) redirectPlayer(player, "46.163.78.135", 22004) end, 10000, 1, source) end)
[M]ister Posted November 23, 2013 Author Posted November 23, 2013 Thanks, but I need to use this type of count, for I will make a resource over it
xXMADEXx Posted November 23, 2013 Posted November 23, 2013 ((Not Tested)) You can try this. local s = 10 function timer2 ( ) s = s - 1 if ( s <= 0 ) then triggerServerEvent ( "redirection", localPlayer ) end end setTimer ( timer2, 1000, 0 )
Renkon Posted November 23, 2013 Posted November 23, 2013 ((Not Tested))You can try this. local s = 10 function timer2 ( ) s = s - 1 if ( s <= 0 ) then triggerServerEvent ( "redirection", localPlayer ) end end setTimer ( timer2, 1000, 0 ) That code sucks. Timer will keep on running on... You should just use a timer with 10000 instead of 1000 and then just trigger
xXMADEXx Posted November 23, 2013 Posted November 23, 2013 ((Not Tested))You can try this. local s = 10 function timer2 ( ) s = s - 1 if ( s <= 0 ) then triggerServerEvent ( "redirection", localPlayer ) end end setTimer ( timer2, 1000, 0 ) That code sucks. Timer will keep on running on... You should just use a timer with 10000 instead of 1000 and then just trigger It's on client side, the timer would stop when the player gets redirected, please, use common since. I was just setting it up for how Malig wanted it, not how I think it should be.
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