View Single Post
Old 09-13-2009, 08:05 AM   #10
TJ01
Lurker
 
Join Date: Aug 2009
Posts: 7
Hey

Theres a slight issue with the TeletoPlayer code but ive fixed it.

Code:
//	Get the name they supplied, and we'll try to work out the clientNum
	strcpy( name, ConcatArgs(1) );
	j = ClientNumberFromString  (ent, name );

	//Because G_ClientNumberFromName will return -1 if they couldn't find anything,
	//	we have to safeguard, otherwise we'd teleport to some weird location
	if ( j == -1 || j>=MAX_CLIENTS )
	{// 'j' wasn't between 0 <-> 32, so warn them and exit this function
		return;
I've used ClientNumberFromString instead as its more stable and You don't need to print an error message since that function does it for you

It also works with ClientNumbers; so /teletoplayer 2 would tele you to Client 2 no matter what their name is.

Last edited by TJ01; 09-13-2009 at 09:56 AM.
TJ01 is offline   you may: quote & reply,