B2SX

[SM] Advanced Voice Comms

Oct 12th, 2018
231
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 1.42 KB | None | 0 0
  1. #include <sourcemod>
  2. #include <sdktools>
  3. #include <cstrike>
  4. #include <basecomm>
  5.  
  6. public Plugin myinfo =
  7. {
  8.     name = "Advanced Voice Comms",
  9.     author = "BaroNN",
  10.     description = "",
  11.     version = "1.0",
  12.     url = "http://steamcommunity.com/id/BaRoNN-Main"
  13. }
  14.  
  15. public OnPluginStart()
  16. {
  17.     HookEvent("player_death", Player_Death);
  18.     HookEvent("round_start", Round_Start);
  19. }
  20.  
  21. public void OnClientPostAdminCheck(int client)
  22. {
  23.     if(CheckCommandAccess(client, "sm_admin", ADMFLAG_GENERIC))if(IsValidMuteClient(client))SetClientListeningFlags(client, VOICE_NORMAL);
  24. }
  25.  
  26. public Action Round_Start(Handle event, const char[] name, bool dB)
  27. {
  28.     int client = GetClientOfUserId(GetEventInt(event, "userid"));
  29.     if(GetClientTeam(client) != CS_TEAM_CT && CheckCommandAccess(client, "sm_admin", ADMFLAG_GENERIC))if(IsPlayerAlive(client))if(IsValidMuteClient(client))SetClientListeningFlags(client, VOICE_NORMAL);
  30. }
  31.  
  32. public Action Player_Death(Handle event, const char[] name, bool dB)
  33. {
  34.     int client = GetClientOfUserId(GetEventInt(event, "userid"));
  35.     if(CheckCommandAccess(client, "sm_admin", ADMFLAG_GENERIC))if(IsValidMuteClient(client))SetClientListeningFlags(client, VOICE_NORMAL);
  36. }
  37.  
  38. stock bool IsValidMuteClient(int client)
  39. {
  40.     if (client >= 1 && client <= MaxClients && IsClientConnected(client) && IsClientInGame(client) && !IsFakeClient(client) && !IsClientSourceTV(client) && !BaseComm_IsClientMuted(client))return true;
  41.     return false;
  42. }
Advertisement
Add Comment
Please, Sign In to add comment