Jump to content

[HELP]LUA REDIRECT


Recommended Posts

Posted (edited)
function redirect() -- You not added source to arguments function. 
redirectPlayer(source, "94.23.38.142", tonumber(22006)) -- Why convert number to number in this case? 
end 
addCommandHandler("freeroam",redirect) 

JasperRieken Read comments.

Edited by Guest
Posted (edited)
function redirect(playerSource)  
redirectPlayer (playerSource, "94.23.38.142", tonumber(22006)) 
end 
addCommandHandler("freeroam",redirect) 

worked for me

Edited by Guest
Posted

source is not defined in arguments command handler-function!

3 argument should be number ( not string ).

Posted
function redirect()  
redirectPlayer(source, "94.23.38.142", "22006") 
end 
addCommandHandler("freeroam",redirect) 

That doesn't work for me

Copy my code again.

Kenix:

on the wiki is

redirectPlayer (playerSource, serverIP, tonumber(serverPort)) 

Posted (edited)

In your code you convert number to number. It's not needed. In Wiki example string converted to number.

Edited by Guest
Posted
In your code you convert number to number. It's not needed. In Wiki example string converted to number.

Oh ok. Thanks for letting me know

Posted

Handler function parameters

player playerSource, string commandName, [string arg1, string arg2, ...] 

I guess you understand :wink:

Correct code

addCommandHandler( 'freeroam', 
    function( pPlayer ) 
        redirectPlayer( pPlayer, '94.23.38.142', 22006 ) 
    end 
) 

Posted

Thanks, this one works only the chat thing doesn't :o both of the outputchatbox don't work

function redirect1(player)  
redirectPlayer(player, "94.23.38.142", "22003") 
outputChatBox ("*#000000  [ #FF0000"..getPlayerName(source) .." #000000]#FFFF00 Has turning to the Zombie Server #ff0000!!",getRootElement(), 255, 0, 0, true ) 
end 
addCommandHandler("zombie",redirect1) 
  
function chat() 
  outputChatBox ("#FFff00~@  #00bbccTyp #000000[ #ff0000/zombie #000000] #00bbccTo connect to The#000000: #ff0000Zombie #00bbccServer #ffff00 @~",getRootElement(), 255, 255, 255, true ) 
end 
setTimer ( chat, 60000, 0) 

Posted
function redirect1(player)  
redirectPlayer(player, "94.23.38.142", "22003") -- 22003 should be number ( not string ) i said about this 
outputChatBox ("*#000000  [ #FF0000"..getPlayerName(source) .." #000000]#FFFF00 Has turning to the Zombie Server #ff0000!!",getRootElement(), 255, 0, 0, true ) -- source not defined here. You should use player variable. 
end 
addCommandHandler("zombie",redirect1) 
  
function chat() 
  outputChatBox ("#FFff00~@  #00bbccTyp #000000[ #ff0000/zombie #000000] #00bbccTo connect to The#000000: #ff0000Zombie #00bbccServer #ffff00 @~",getRootElement(), 255, 255, 255, true ) 
end 
setTimer ( chat, 60000, 0) 

Read comments.

Posted

Try This

  
addCommandHandler( 'zombie', 
function ( pPlayer ) 
redirectPlayer( pPlayer, "94.23.38.142", 22003) 
outputChatBox ("*#000000  [ #FF0000"..getPlayerName(pPlayer) .." #000000]#FFFF00 Has turning to the Zombie Server #ff0000!!",getRootElement(), 255, 0, 0, true ) 
end 
) 
  
function chat() 
  outputChatBox ("#FFff00~@  #00bbccTyp #000000[ #ff0000/zombie #000000] #00bbccTo connect to The#000000: #ff0000Zombie #00bbccServer #ffff00 @~",getRootElement(), 255, 255, 255, true ) 
end 
setTimer ( chat, 60000, 0) 

Posted

What about this part?

7.function chat()

8. outputChatBox ("#FFff00~@ #00bbccTyp #000000[ #ff0000/zombie #000000] #00bbccTo connect to The#000000: #ff0000Zombie #00bbccServer #ffff00 @~",getRootElement(), 255, 255, 255, true )

9.end

10.setTimer ( chat, 60000, 0)

Posted
setTimer( 
function() 
    outputChatBox ("#FFff00~@ #00bbccTyp #000000[ #ff0000/zombie #000000] #00bbccTo connect to The#000000: #ff0000Zombie #00bbccServer #ffff00 @~",root, 255, 255, 255, true ) 
end 
, 60000, 0) 

try

Posted

This is what i've got neither of the chatbox things work

function redirect(player)  
redirectPlayer(player, "94.23.38.142", "22006") 
outputChatBox ("*#000000  [ #FF0000"..getPlayerName(player) .." #000000]#FFFF00 Has turning to the Freeroam Server #ff0000!!",getRootElement(), 255, 0, 0, true ) 
end 
addCommandHandler("freeroam",redirect) 
  
setTimer( 
function() 
    outputChatBox ("#FFff00~@ #00bbccTyp #000000[ #ff0000/freeroam #000000] #00bbccTo connect to The#000000: #ff0000Freeroam #00bbccServer #ffff00 @~",root, 255, 255, 255, true ) 
end 
, 60000, 0) 

function redirect1(player)  
redirectPlayer(player, "94.23.38.142", "22003") 
outputChatBox ("*#000000  [ #FF0000"..getPlayerName(player) .." #000000]#FFFF00 Has turning to the Zombie Server #ff0000!!",getRootElement(), 255, 0, 0, true ) 
end 
addCommandHandler("zombie",redirect1) 
  
  
setTimer( 
function() 
    outputChatBox ("#FFff00~@ #00bbccTyp #000000[ #ff0000/zombie #000000] #00bbccTo connect to The#000000: #ff0000Zombie #00bbccServer #ffff00 @~",root, 255, 255, 255, true ) 
end 
, 60000, 0) 

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