Guest User

Untitled

a guest
Jan 22nd, 2018
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 2.28 KB | None | 0 0
  1. # HG changeset patch
  2. # Parent f1539fcb176cb217aacf9749162d3d24f89789bf
  3. diff --git a/plugins/playercommands.sp b/plugins/playercommands.sp
  4. --- a/plugins/playercommands.sp
  5. +++ b/plugins/playercommands.sp
  6. @@ -52,6 +52,7 @@
  7.  /* Used to get the SDK / Engine version. */
  8.  /* This is used in sm_rename and sm_changeteam */
  9.  new g_ModVersion = 0;
  10. +new bool:g_bCSSRenameFix = false;
  11.  
  12.  #include "playercommands/slay.sp"
  13.  #include "playercommands/slap.sp"
  14. @@ -74,6 +75,13 @@
  15.     {
  16.         OnAdminMenuReady(topmenu);
  17.     }
  18. +  
  19. +   decl String:gamedir[64];
  20. +   GetGameFolderName(gamedir, sizeof(gamedir));
  21. +   if (!strcmp(gamedir, "cstrike"))
  22. +   {
  23. +       g_bCSSRenameFix = true;
  24. +   }
  25.  }
  26.  
  27.  public OnAdminMenuReady(Handle:topmenu)
  28. diff --git a/plugins/playercommands/rename.sp b/plugins/playercommands/rename.sp
  29. --- a/plugins/playercommands/rename.sp
  30. +++ b/plugins/playercommands/rename.sp
  31. @@ -32,15 +32,23 @@
  32.   */
  33.  
  34.  new String:g_NewName[MAXPLAYERS+1][MAX_NAME_LENGTH];
  35. +new String:g_OldName[MAXPLAYERS+1][MAX_NAME_LENGTH];
  36. +static g_CSSFix[MAXPLAYERS+1];
  37.  
  38.  PerformRename(client, target)
  39.  {
  40.     LogAction(client, target, "\"%L\" renamed \"%L\" to \"%s\")", client, target, g_NewName[target]);
  41.  
  42. +   if (g_bCSSRenameFix)
  43. +   {
  44. +       GetClientName(target, g_OldName[target], sizeof(g_OldName[]));
  45. +       SetClientInfo(target, "name", g_NewName[target]);
  46. +   }
  47.     /* Used on OB / L4D engine */
  48. -   if (g_ModVersion > SOURCE_SDK_EPISODE1)
  49. +   else if (g_ModVersion > SOURCE_SDK_EPISODE1)
  50.     {
  51.         SetClientInfo(target, "name", g_NewName[target]);
  52. +       g_NewName[target][0] = '\0';
  53.     }
  54.     else /* Used on CSS and EP1 / older engine */
  55.     {
  56. @@ -52,8 +60,27 @@
  57.             ReplyToCommand(client, "[SM] %t", "Dead Player Rename", m_TargetName);
  58.         }
  59.         ClientCommand(target, "name %s", g_NewName[target]);
  60. +       g_NewName[target][0] = '\0';
  61.     }
  62. -   g_NewName[target][0] = '\0';
  63. +}
  64. +
  65. +public OnClientSettingsChanged(client)
  66. +{
  67. +   if (g_NewName[client][0] != '\0')
  68. +   {
  69. +       if (g_CSSFix[client]++ == 0)
  70. +       {
  71. +           SetEntPropString(client, Prop_Data, "m_szNetname", g_OldName[client]);
  72. +           return;
  73. +       }
  74. +      
  75. +       if (g_CSSFix[client]++ == 1)
  76. +       {
  77. +           SetEntPropString(client, Prop_Data, "m_szNetname", g_NewName[client]);
  78. +           g_NewName[client][0] = '\0';
  79. +           g_CSSFix[client] = 0;
  80. +       }
  81. +   }
  82.  }
  83.  
  84.  public AdminMenu_Rename(Handle:topmenu,
Add Comment
Please, Sign In to add comment