-
Notifications
You must be signed in to change notification settings - Fork 0
/
GodHit.sma
55 lines (45 loc) · 1.29 KB
/
GodHit.sma
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
#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>
new gBot
new const szSound[][] = { "player/god_hit1.wav", "player/god_hit2.wav", "player/god_hit3.wav" }
public plugin_precache()
{
for(new x = 0; x < sizeof(szSound); x ++ )
engfunc(EngFunc_PrecacheSound, szSound[x])
}
public plugin_init()
{
register_plugin("[CSGO:DM] God Hit", "1.0", "csbtedhan")
RegisterHam(Ham_TraceAttack, "player", "HamF_TraceAttack")
}
public client_putinserver(id)
{
if(is_user_bot(id) && get_cvar_num("bot_quota") && !gBot)
{
set_task(0.1, "RegHamBot", id);
}
}
public RegHamBot(id)
{
if(gBot) return;
RegisterHamFromEntity(Ham_TraceAttack, id, "HamF_TraceAttack");
gBot = 1
}
public HamF_TraceAttack(victim, attacker, Float:fDamage, Float:vDir[3], tr, DmgType)
{
if(!pev_valid(victim) || !is_user_connected(victim))
return;
static Float:end[3];
get_tr2(tr, TR_vecEndPos, end)
if(is_user_alive(victim) && pev(victim, pev_takedamage) == 0.0)
{
message_begin(MSG_BROADCAST,SVC_TEMPENTITY);
write_byte( 9 )
engfunc( EngFunc_WriteCoord , end[0] )
engfunc( EngFunc_WriteCoord , end[1] )
engfunc( EngFunc_WriteCoord , end[2] )
message_end()
engfunc(EngFunc_EmitAmbientSound, 0, end, szSound[random_num(0,2)], 1.0, 0.9, 0, 100)
}
}