Removed the alive check from sm_rename. Improved mod support between various engines. (Bug 3698 r=pred)
authorLiam <rbutler14@yahoo.com>
Sat Mar 07 17:11:11 2009 -0500 (2009-03-07)
changeset 26804a5403e84378
parent 2679 ae5536263760
child 2681 3243c1b63c4c
Removed the alive check from sm_rename. Improved mod support between various engines. (Bug 3698 r=pred)
plugins/playercommands.sp
plugins/playercommands/rename.sp
     1.1 --- a/plugins/playercommands.sp	Fri Mar 06 17:41:35 2009 -0500
     1.2 +++ b/plugins/playercommands.sp	Sat Mar 07 17:11:11 2009 -0500
     1.3 @@ -49,6 +49,10 @@
     1.4  
     1.5  new Handle:hTopMenu = INVALID_HANDLE;
     1.6  
     1.7 +/* Used to get the SDK / Engine version. */
     1.8 +/* This is used in sm_rename. */
     1.9 +new g_ModVersion = 0;
    1.10 +
    1.11  #include "playercommands/slay.sp"
    1.12  #include "playercommands/slap.sp"
    1.13  #include "playercommands/rename.sp"
    1.14 @@ -62,6 +66,8 @@
    1.15  	RegAdminCmd("sm_slay", Command_Slay, ADMFLAG_SLAY, "sm_slay <#userid|name>");
    1.16  	RegAdminCmd("sm_rename", Command_Rename, ADMFLAG_SLAY, "sm_rename <#userid|name>");
    1.17  	
    1.18 +	g_ModVersion = GuessSDKVersion();
    1.19 +
    1.20  	/* Account for late loading */
    1.21  	new Handle:topmenu;
    1.22  	if (LibraryExists("adminmenu") && ((topmenu = GetAdminTopMenu()) != INVALID_HANDLE))
     2.1 --- a/plugins/playercommands/rename.sp	Fri Mar 06 17:41:35 2009 -0500
     2.2 +++ b/plugins/playercommands/rename.sp	Sat Mar 07 17:11:11 2009 -0500
     2.3 @@ -36,7 +36,17 @@
     2.4  PerformRename(client, target)
     2.5  {
     2.6  	LogAction(client, target, "\"%L\" renamed \"%L\" to \"%s\")", client, target, g_NewName[target]);
     2.7 -	SetClientInfo(target, "name", g_NewName[target]);
     2.8 +
     2.9 +	/* Used on OB / L4D engine */
    2.10 +	if (g_ModVersion > SOURCE_SDK_EPISODE1)
    2.11 +	{
    2.12 +		SetClientInfo(target, "name", g_NewName[target]);
    2.13 +	}
    2.14 +	else /* Used on CSS and EP1 / older engine */
    2.15 +	{
    2.16 +		ClientCommand(target, "name %s", g_NewName[target]);
    2.17 +	}
    2.18 +	g_NewName[target][0] = '\0';
    2.19  }
    2.20  
    2.21  public AdminMenu_Rename(Handle:topmenu, 
    2.22 @@ -156,7 +166,7 @@
    2.23  			client,
    2.24  			target_list,
    2.25  			MAXPLAYERS,
    2.26 -			COMMAND_FILTER_ALIVE,
    2.27 +			COMMAND_FILTER_NONE,
    2.28  			target_name,
    2.29  			sizeof(target_name),
    2.30  			tn_is_ml)) > 0)