/
be_quiet_please.sp
78 lines (72 loc) · 1.63 KB
/
be_quiet_please.sp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#include <voiceannounce_ex>
#include <sourcemod>
#include <cstrike>
#include <sdkhooks>
#include <sdktools>
#include <warden>
#include <basecomm>
Handle h_Type = INVALID_HANDLE;
bool hint = true;
public Plugin:myinfo = {
name = "JailBreak - Be quiet, please!",
author = "Fastmancz",
description = "Be quiet, please!",
url = "cmgportal.cz"
};
public OnPluginStart()
{
h_Type = CreateConVar("notify_type", "1", "Notification type: 1 = notifiy muted client when he tries speak, 2 = notifiy all clients when warden speaks");
LoadTranslations("be_quiet_please.phrases");
}
//When Warden speaks or muted client wants to speak
public bool OnClientSpeakingEx(client)
{
if (warden_iswarden(client))
{
for (int i = 1; i <= MaxClients; i++)
{
if (IsClientInGame(i))
{
if (GetClientTeam(i) == CS_TEAM_T)
{
if (GetConVarInt(h_Type) == 2)
PrintCenterText(i, "%t", "notification");
SetClientListeningFlags(i, VOICE_MUTED);
if (GetAdminFlag(GetUserAdmin(i), Admin_Ban) && !BaseComm_IsClientMuted(i))
{
SetClientListeningFlags(i, VOICE_NORMAL);
}
}
}
}
}
if (GetConVarInt(h_Type) == 1)
{
if (hint && GetClientListeningFlags(client) == VOICE_MUTED)
{
PrintCenterText(client, "%t", "notification");
hint = false;
}
}
}
// When client stops talk
public OnClientSpeakingEnd(client)
{
for (int i = 1; i <= MaxClients; i++)
{
if(IsClientInGame(i))
{
if (GetClientTeam(i) == CS_TEAM_T && !BaseComm_IsClientMuted(i) && IsPlayerAlive(i))
{
SetClientListeningFlags(i, VOICE_NORMAL);
}
}
}
if (GetConVarInt(h_Type) == 1)
{
if (warden_iswarden(client))
{
hint = true;
}
}
}