Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # HG changeset patch
- # Parent f1539fcb176cb217aacf9749162d3d24f89789bf
- diff --git a/plugins/playercommands.sp b/plugins/playercommands.sp
- --- a/plugins/playercommands.sp
- +++ b/plugins/playercommands.sp
- @@ -52,6 +52,7 @@
- /* Used to get the SDK / Engine version. */
- /* This is used in sm_rename and sm_changeteam */
- new g_ModVersion = 0;
- +new bool:g_bCSSRenameFix = false;
- #include "playercommands/slay.sp"
- #include "playercommands/slap.sp"
- @@ -74,6 +75,13 @@
- {
- OnAdminMenuReady(topmenu);
- }
- +
- + decl String:gamedir[64];
- + GetGameFolderName(gamedir, sizeof(gamedir));
- + if (!strcmp(gamedir, "cstrike"))
- + {
- + g_bCSSRenameFix = true;
- + }
- }
- public OnAdminMenuReady(Handle:topmenu)
- diff --git a/plugins/playercommands/rename.sp b/plugins/playercommands/rename.sp
- --- a/plugins/playercommands/rename.sp
- +++ b/plugins/playercommands/rename.sp
- @@ -32,15 +32,23 @@
- */
- new String:g_NewName[MAXPLAYERS+1][MAX_NAME_LENGTH];
- +new String:g_OldName[MAXPLAYERS+1][MAX_NAME_LENGTH];
- +static g_CSSFix[MAXPLAYERS+1];
- PerformRename(client, target)
- {
- LogAction(client, target, "\"%L\" renamed \"%L\" to \"%s\")", client, target, g_NewName[target]);
- + if (g_bCSSRenameFix)
- + {
- + GetClientName(target, g_OldName[target], sizeof(g_OldName[]));
- + SetClientInfo(target, "name", g_NewName[target]);
- + }
- /* Used on OB / L4D engine */
- - if (g_ModVersion > SOURCE_SDK_EPISODE1)
- + else if (g_ModVersion > SOURCE_SDK_EPISODE1)
- {
- SetClientInfo(target, "name", g_NewName[target]);
- + g_NewName[target][0] = '\0';
- }
- else /* Used on CSS and EP1 / older engine */
- {
- @@ -52,8 +60,27 @@
- ReplyToCommand(client, "[SM] %t", "Dead Player Rename", m_TargetName);
- }
- ClientCommand(target, "name %s", g_NewName[target]);
- + g_NewName[target][0] = '\0';
- }
- - g_NewName[target][0] = '\0';
- +}
- +
- +public OnClientSettingsChanged(client)
- +{
- + if (g_NewName[client][0] != '\0')
- + {
- + if (g_CSSFix[client]++ == 0)
- + {
- + SetEntPropString(client, Prop_Data, "m_szNetname", g_OldName[client]);
- + return;
- + }
- +
- + if (g_CSSFix[client]++ == 1)
- + {
- + SetEntPropString(client, Prop_Data, "m_szNetname", g_NewName[client]);
- + g_NewName[client][0] = '\0';
- + g_CSSFix[client] = 0;
- + }
- + }
- }
- public AdminMenu_Rename(Handle:topmenu,
Add Comment
Please, Sign In to add comment