michaelrw

bTimes-random.sp - added footstep mute

Dec 16th, 2017
274
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 0.97 KB | None | 0 0
  1. ConVar sv_footsteps = null;     // added from shavit-misc
  2.  
  3. public void OnPluginStart()
  4. {
  5.     sv_footsteps = FindConVar("sv_footsteps");                          // added from shavit-misc
  6.     sv_footsteps.Flags &= ~(FCVAR_NOTIFY | FCVAR_REPLICATED);           // added from shavit-misc
  7. }
  8.  
  9. public Action SM_Hide(int client, int args)
  10. {
  11.     SetCookieBool(client, g_hHideCookie, !GetCookieBool(client, g_hHideCookie));
  12.    
  13.     if(GetCookieBool(client, g_hHideCookie))
  14.     {
  15.         PrintColorText(client, "%s%sPlayers are now %sinvisible",
  16.             g_msg_start,
  17.             g_msg_textcol,
  18.             g_msg_varcol);
  19.  
  20.         UpdateFootsteps(client, 0);
  21.     }
  22.     else
  23.     {
  24.         PrintColorText(client, "%s%sPlayers are now %svisible",
  25.             g_msg_start,
  26.             g_msg_textcol,
  27.             g_msg_varcol);
  28.  
  29.         UpdateFootsteps(client, 1);
  30.     }
  31.    
  32.     return Plugin_Handled;
  33. }
  34.  
  35. void UpdateFootsteps(int client, int value)
  36. {
  37.     if(sv_footsteps != null)
  38.     {
  39.         char[] sFootsteps = new char[4];
  40.         IntToString(value, sFootsteps, 4);
  41.         sv_footsteps.ReplicateToClient(client, sFootsteps);
  42.     }
  43. }
Advertisement
Add Comment
Please, Sign In to add comment