redirect player from a server to another one problem

Forum for all kinds of CoD4 jumps.

Moderator: Core Staff

Post Reply
hammah
CJ Wannabe
CJ Wannabe
Posts: 1
Joined: May 7th, 2015, 9:31 pm

redirect player from a server to another one problem

Post by hammah » May 7th, 2015, 9:44 pm

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

Pedsdude
Site Admin
Site Admin
Posts: 15908
Joined: October 15th, 2004, 7:18 pm
Location: UK

Re: redirect player from a server to another one problem

Post by Pedsdude » May 9th, 2015, 11:56 am

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

_DanTheMan_
PC Team
PC Team
Posts: 294
Joined: September 6th, 2008, 2:14 am

Re: redirect player from a server to another one problem

Post by _DanTheMan_ » May 10th, 2015, 1:02 am

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
Image

Post Reply

Who is online

Users browsing this forum: No registered users and 7 guests