-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathvetoable-announcer-chat.sp
53 lines (44 loc) · 1.43 KB
/
vetoable-announcer-chat.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
#include <vetoable>
public Plugin myinfo =
{
name = "Vetoable Chat Announcer",
author = "Sikari",
description = "",
version = VETOABLE_VERSION,
url = "https://github.com/Sikarii/vetoable"
};
public void Vetoable_OnVetoStarted(VetoableVeto veto)
{
char name[128];
veto.GetName(name, sizeof(name));
Vetoable_PrintToChatAll("\x03#%d\x01 | Started (%s)", veto.Id, name);
}
public void Vetoable_OnVetoAction(VetoableVeto veto, int voter, VetoActionType type, const char[] name, const char[] value)
{
char buf[128];
FormatAction(veto, voter, type, name, buf, sizeof(buf));
Vetoable_PrintToChatAll("\x03#%d\x01 | %s", veto.Id, buf);
}
public void Vetoable_OnVetoEnded(VetoableVeto veto, VetoEndReason reason)
{
Vetoable_PrintToChatAll("\x03#%d\x01 | Ended with reason '%s'", veto.Id, VetoEndReasonPhrases[reason]);
}
static int FormatAction(VetoableVeto veto, int voter, VetoActionType type, const char[] name, char[] buffer, int maxlength)
{
if (type == VetoActionType_Ban)
{
return Format(buffer, maxlength, "%N \x07banned\x01 %s", voter, name);
}
if (type == VetoActionType_Pick)
{
if (voter == 0 && veto.RemainingItemCount == 0)
{
return Format(buffer, maxlength, "%s is the \x09decider\x01", name);
}
else
{
return Format(buffer, maxlength, "%N \x04picked\x01 %s", voter, name);
}
}
return -1;
}