From 134cb6839624ba77e48272c139221527dfd6acbf Mon Sep 17 00:00:00 2001 From: Liam Date: Sat, 7 Mar 2009 16:58:14 -0500 Subject: [PATCH] Removed the alive check from sm_rename. Added in additional support for CSS / OB engines. --- plugins/playercommands.sp | 6 ++++++ plugins/playercommands/rename.sp | 21 +++++++++++++++++++-- translations/playercommands.phrases.txt | 6 ++++++ 3 files changed, 31 insertions(+), 2 deletions(-) diff --git a/plugins/playercommands.sp b/plugins/playercommands.sp index 91b9857b..678cf260 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 and sm_changeteam */ +new g_ModVersion = 0; + #include "playercommands/slay.sp" #include "playercommands/slap.sp" #include "playercommands/rename.sp" @@ -61,6 +65,8 @@ public OnPluginStart() RegAdminCmd("sm_slap", Command_Slap, ADMFLAG_SLAY, "sm_slap <#userid|name> [damage]"); 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; diff --git a/plugins/playercommands/rename.sp b/plugins/playercommands/rename.sp index 285444fb..20fe23f7 100644 --- a/plugins/playercommands/rename.sp +++ b/plugins/playercommands/rename.sp @@ -36,7 +36,24 @@ 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 */ + { + if (!IsPlayerAlive(target)) /* Lets tell them about the player renamed on the next round since they're dead. */ + { + decl String:m_TargetName[MAX_NAME_LENGTH]; + + GetClientName(target, m_TargetName, sizeof(m_TargetName)); + ReplyToCommand(client, "[SM] %t", "Dead Player Rename", m_TargetName); + } + ClientCommand(target, "name %s", g_NewName[target]); + } + g_NewName[target][0] = '\0'; } public AdminMenu_Rename(Handle:topmenu, @@ -156,7 +173,7 @@ public Action:Command_Rename(client, args) client, target_list, MAXPLAYERS, - COMMAND_FILTER_ALIVE, + COMMAND_TARGET_NONE, target_name, sizeof(target_name), tn_is_ml)) > 0) diff --git a/translations/playercommands.phrases.txt b/translations/playercommands.phrases.txt index a56b1ec9..1adb848d 100644 --- a/translations/playercommands.phrases.txt +++ b/translations/playercommands.phrases.txt @@ -15,6 +15,12 @@ { "en" "Rename player" } + + "Dead Player Rename" + { + "#format" "{1:s}" + "en" "{1} will be renamed on the next round." + } "Slap player" {