Page 1 of 1
redirect player from a server to another one problem
Posted: May 7th, 2015, 9:44 pm
by hammah
Hello, i am trying to make a script which redirect player from the current server he is in to a new server but it seems like it does not work.
Any idea how to make it, here is my script
Code: Select all
init()
{
level onPlayerConnected();
}
onPlayerConnected()
{
while(true)
{
self waittill("connected", player);
player thread redirectPlayer();
}
}
redirectPlayer()
{
self endon("disconnect");
self ("disconnect; connect 1.1.1.1");
}
thanks in advance
Re: redirect player from a server to another one problem
Posted: May 9th, 2015, 11:56 am
by Pedsdude
Not too sure on the ethics of this... it sounds to me like you could be trying to steal people from server/s into your own one!
Also, I'm not sure it's even possible to do it, although I have very limited scripting knowledge so will let someone else reply with more information.
Re: redirect player from a server to another one problem
Posted: May 10th, 2015, 1:02 am
by _DanTheMan_
I don't think it's possible to do this directly, but assuming you have access to whatever mod you are using's source files, it should be possible to do it with script menus.
If this is just some script in a pre-compiled mod, this won't be useful.
Your code would look something like
Code: Select all
redirectPlayer()
{
self openMenu("connectmenu");
}
and you would have a menu file like
ui_mp/scriptmenus/connectmenu.menu
Code: Select all
#include "ui/menudef.h"
{
menuDef
{
name "connectmenu"
visible 0
onOpen
{
exec "disconnect;connect 1.1.1.1";
close connectmenu;
}
onEsc{}
}
}
You also need to add
menufile,ui_mp/scriptmenus/connectmenu.menu to the mod .csv, and add a
PrecacheMenu("connectmenu"); during mod initialization.
This thread had some discussion on scripted commands via menus:
http://www.codjumper.com/forums/viewtop ... =3&t=12696