diff --git a/plugins/playercommands.sp b/plugins/playercommands.sp index 91b9857b..3b52104f 100644 --- a/plugins/playercommands.sp +++ b/plugins/playercommands.sp @@ -49,6 +49,10 @@ public Plugin:myinfo = new Handle:hTopMenu = INVALID_HANDLE; +/* Used to get the SDK / Engine version. */ +/* This is used in sm_rename. */ +new g_ModVersion = 0; + #include "playercommands/slay.sp" #include "playercommands/slap.sp" #include "playercommands/rename.sp" @@ -62,6 +66,8 @@ public OnPluginStart() RegAdminCmd("sm_slay", Command_Slay, ADMFLAG_SLAY, "sm_slay <#userid|name>"); RegAdminCmd("sm_rename", Command_Rename, ADMFLAG_SLAY, "sm_rename <#userid|name>"); + g_ModVersion = GuessSDKVersion(); + /* Account for late loading */ new Handle:topmenu; if (LibraryExists("adminmenu") && ((topmenu = GetAdminTopMenu()) != INVALID_HANDLE)) diff --git a/plugins/playercommands/rename.sp b/plugins/playercommands/rename.sp index 285444fb..319cf1c2 100644 --- a/plugins/playercommands/rename.sp +++ b/plugins/playercommands/rename.sp @@ -36,7 +36,17 @@ new String:g_NewName[MAXPLAYERS+1][MAX_NAME_LENGTH]; PerformRename(client, target) { LogAction(client, target, "\"%L\" renamed \"%L\" to \"%s\")", client, target, g_NewName[target]); - SetClientInfo(target, "name", g_NewName[target]); + + /* Used on OB / L4D engine */ + if (g_ModVersion > SOURCE_SDK_EPISODE1) + { + SetClientInfo(target, "name", g_NewName[target]); + } + else /* Used on CSS and EP1 / older engine */ + { + ClientCommand(target, "name %s", g_NewName[target]); + } + g_NewName[target][0] = '\0'; } public AdminMenu_Rename(Handle:topmenu, @@ -156,7 +166,7 @@ public Action:Command_Rename(client, args) client, target_list, MAXPLAYERS, - COMMAND_FILTER_ALIVE, + COMMAND_FILTER_NONE, target_name, sizeof(target_name), tn_is_ml)) > 0)