-
Notifications
You must be signed in to change notification settings - Fork 3
/
MagicMedkit.as
58 lines (48 loc) · 1.3 KB
/
MagicMedkit.as
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
const array<string> answers = {
'It is certain.',
'It is decidedly so.',
'Without a doubt.',
'Yes - definitely.',
'You may rely on it.',
'As I see it, yes.',
'Most likely.',
'Outlook good.',
'Yes.',
'Signs point to yes.',
'Reply hazy, try again.',
'Ask again later.',
'Better not tell you now.',
'Cannot predict now.',
'Concentrate and ask again.',
'Don\'t count on it.',
'My reply is no.',
'My sources say no.',
'Outlook not so good.',
'Very doubtful.'
};
const uint delay = 10;
array<uint> antiflood(33);
void PluginInit() {
g_Module.ScriptInfo.SetAuthor("incognico");
g_Module.ScriptInfo.SetContactInfo("https://discord.gg/qfZxWAd");
g_Hooks.RegisterHook(Hooks::Weapon::WeaponTertiaryAttack, @WeaponTertiaryAttack);
}
void MapStart() {
antiflood.resize(0);
antiflood.resize(33);
}
HookReturnCode WeaponTertiaryAttack(CBasePlayer@ pPlayer, CBasePlayerWeapon@ wep) {
if (wep is null)
return HOOK_CONTINUE;
if (wep.GetClassname() == "weapon_medkit") {
const int idx = pPlayer.entindex();
const uint t = uint(g_EngineFuncs.Time());
const uint d = t - antiflood[idx];
if (d > delay) {
g_PlayerFuncs.ClientPrint(pPlayer, HUD_PRINTCENTER, answers[Math.RandomLong(0, answers.length()-1)] + "\n");
antiflood[idx] = t;
}
return HOOK_HANDLED;
}
return HOOK_CONTINUE;
}