-
Notifications
You must be signed in to change notification settings - Fork 4
/
jumpkick.sma
187 lines (152 loc) · 4.85 KB
/
jumpkick.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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
#include <amxmodx>
#include <fun>
#include <cstrike>
#include <engine>
new bool:kickflag[33];
new gmsgDeathMsg;
new gmsgScoreInfo;
public plugin_init()
{
register_plugin("Jump Kick","1.2","Hawk552");
register_cvar("amx_jumpkick_radius","70.0");
register_cvar("amx_jumpkick_damage","30.0");
register_cvar("amx_jumpkick_cooldown","1.0");
register_cvar("amx_jumpkick_knockback","20");
register_cvar("amx_jumpkick","1");
gmsgDeathMsg = get_user_msgid("DeathMsg");
gmsgScoreInfo = get_user_msgid("ScoreInfo");
}
public client_putinserver(id)
kickflag[id] = false;
public client_disconnect(id)
kickflag[id] = false;
public client_PreThink(id)
{
if(!get_cvar_num("amx_jumpkick"))
{
return 0;
}
if(kickflag[id] == false && (entity_get_int(id, EV_INT_button) & 2))
{
client_cmd(id,"-jump");
new Float:radius = get_cvar_float("amx_jumpkick_radius"),ent,Float:origin[3];
entity_get_vector(id,EV_VEC_origin,origin);
while((ent = find_ent_in_sphere(ent,origin,radius)) != 0)
{
if(!is_user_alive(ent) || ent == id || get_user_team(id) == get_user_team(ent))
continue;
kickflag[id] = true;
set_task(get_cvar_float("amx_jumpkick_cooldown"),"cooldown",id);
damage_ent(ent,id);
}
}
return 0;
}
public damage_ent(vid,aid)
{
if(is_user_alive(aid) && is_user_alive(vid))
{
new Float:vorigin[3],Float:aorigin[3];
entity_get_vector(vid,EV_VEC_origin,vorigin);
entity_get_vector(aid,EV_VEC_origin,aorigin);
new i, push_factor = get_cvar_num("amx_jumpkick_knockback");
for(i = 0;i <= 2;i++)
{
vorigin[i] -= aorigin[i];
vorigin[i] *= push_factor;
}
entity_set_vector(vid,EV_VEC_velocity,vorigin);
if(get_user_health(vid) < get_cvar_num("amx_jumpkick_damage"))
{
createKill(vid,aid,"Jumpkick");
}
else
{
fakedamage(vid,"Jumpkick",get_cvar_float("amx_jumpkick_damage"),DMG_CRUSH);
new clip,ammo,weap = get_user_weapon(vid,clip,ammo);
if(weap != CSW_KNIFE && weap != CSW_HEGRENADE && weap != CSW_SMOKEGRENADE && weap != CSW_FLASHBANG)
{
client_cmd(vid,"drop");
client_print(vid,print_chat,"[AMXX] Your weapon has been kicked out of your hands!");
}
}
}
}
public cooldown(id)
kickflag[id] = false;
// --------------------------------------------------------
// Thanks to Zenith77 for this section and everything below
// --------------------------------------------------------
public createKill(id, attacker, weaponDescription[] )
{
new FFon = get_cvar_num("mp_friendlyfire");
if (FFon && get_user_team(id) == get_user_team(attacker))
{
set_user_frags(attacker, get_user_frags(attacker) - 1);
client_print(attacker,print_center,"You killed a teammate");
new money = cs_get_user_money(attacker);
if (money != 0)
cs_set_user_money(attacker,money - 150,1);
}
else if (get_user_team(id) != get_user_team(attacker))
{
set_user_frags(attacker, get_user_frags(attacker) + 1);
new money = cs_get_user_money(attacker);
if (money < 16000)
cs_set_user_money(attacker,money + 300,1);
}
logKill(attacker, id, weaponDescription);
//Kill the victim and block the messages
set_msg_block(gmsgDeathMsg,BLOCK_ONCE);
set_msg_block(gmsgScoreInfo,BLOCK_ONCE);
user_kill(id);
//user_kill removes a frag, this gives it back
set_user_frags(id,get_user_frags(id) + 1);
//Replaced HUD death message
message_begin(MSG_ALL,gmsgDeathMsg,{0,0,0},0);
write_byte(attacker);
write_byte(id);
write_byte(0);
write_string(weaponDescription);
message_end();
//Update killers scorboard with new info
message_begin(MSG_ALL,gmsgScoreInfo);
write_byte(attacker);
write_short(get_user_frags(attacker));
write_short(get_user_deaths(attacker));
write_short(0);
write_short(get_user_team(attacker));
message_end();
//Update victims scoreboard with correct info
message_begin(MSG_ALL,gmsgScoreInfo);
write_byte(id);
write_short(get_user_frags(id));
write_short(get_user_deaths(id));
write_short(0);
write_short(get_user_team(id));
message_end();
}
// ------- LOG KILL------------
public logKill(id, victim, weaponDescription[] )
{
new namea[32],namev[32],authida[35],authidv[35],teama[16],teamv[16];
//Info On Attacker
get_user_name(id,namea,31);
get_user_team(id,teama,15);
get_user_authid(id,authida,34);
//Info On Victim
get_user_name(victim,namev,31);
get_user_team(victim,teamv,15);
get_user_authid(victim,authidv,34);
//Log This Kill
if(id != victim)
{
log_message("^"%s<%d><%s><%s>^" killed ^"%s<%d><%s><%s>^" with ^"%s^"",
namea,get_user_userid(id),authida,teama,namev,get_user_userid(victim),authidv,teamv, weaponDescription );
}
else
{
log_message("^"%s<%d><%s><%s>^" committed suicide with ^"%s^"",
namea,get_user_userid(id),authida,teama, weaponDescription );
}
}