JasperRieken Posted May 20, 2012 Posted May 20, 2012 function redirect() redirectPlayer(source, "94.23.38.142", tonumber(22006)) end addCommandHandler("freeroam",redirect) This doesn't seem to work
JasperRieken Posted May 20, 2012 Author Posted May 20, 2012 i did that, first it said permission denied. I added it to the acl now it sais bad argument line 4
Kenix Posted May 20, 2012 Posted May 20, 2012 (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 May 20, 2012 by Guest
Wei Posted May 20, 2012 Posted May 20, 2012 (edited) function redirect(playerSource) redirectPlayer (playerSource, "94.23.38.142", tonumber(22006)) end addCommandHandler("freeroam",redirect) worked for me Edited May 20, 2012 by Guest
Kenix Posted May 20, 2012 Posted May 20, 2012 source is not defined in arguments command handler-function! 3 argument should be number ( not string ).
Kenix Posted May 20, 2012 Posted May 20, 2012 (edited) Why convert number to number in this case? tonumber(22006) Edited May 20, 2012 by Guest
JasperRieken Posted May 20, 2012 Author Posted May 20, 2012 function redirect() redirectPlayer(source, "94.23.38.142", "22006") end addCommandHandler("freeroam",redirect) That doesn't work for me
Wei Posted May 20, 2012 Posted May 20, 2012 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))
Kenix Posted May 20, 2012 Posted May 20, 2012 (edited) In your code you convert number to number. It's not needed. In Wiki example string converted to number. Edited May 20, 2012 by Guest
Wei Posted May 20, 2012 Posted May 20, 2012 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
Kenix Posted May 20, 2012 Posted May 20, 2012 Handler function parameters player playerSource, string commandName, [string arg1, string arg2, ...] I guess you understand Correct code addCommandHandler( 'freeroam', function( pPlayer ) redirectPlayer( pPlayer, '94.23.38.142', 22006 ) end )
JasperRieken Posted May 20, 2012 Author Posted May 20, 2012 Thanks, this one works only the chat thing doesn't 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)
Kenix Posted May 20, 2012 Posted May 20, 2012 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.
X-SHADOW Posted May 20, 2012 Posted May 20, 2012 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)
JasperRieken Posted May 20, 2012 Author Posted May 20, 2012 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)
Wei Posted May 20, 2012 Posted May 20, 2012 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
Noneatme Posted May 20, 2012 Posted May 20, 2012 @JasperRieken I think the string is too long, remove the color-codes and try again. -Multivan
JasperRieken Posted May 20, 2012 Author Posted May 20, 2012 it's not the color codes i used this one before copied it
JasperRieken Posted May 20, 2012 Author Posted May 20, 2012 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)
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