Jump to content

[HELP] redirectPlayer


[M]ister

Recommended Posts

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 by Guest
Link to comment
((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

Link to comment
((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.

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