forked from TheDoctor0/CoDMod
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcod_vip.sma
More file actions
216 lines (152 loc) · 5.1 KB
/
Copy pathcod_vip.sma
File metadata and controls
216 lines (152 loc) · 5.1 KB
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
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
#include <amxmodx>
#include <cod>
#define PLUGIN "CoD VIP"
#define VERSION "1.2.2"
#define AUTHOR "O'Zone"
#define VIP_FLAG ADMIN_LEVEL_H
new Array:listVIPs, vip;
new const commandVIP[][] = { "say /vip", "say_team /vip", "say /vip", "say_team /vip", "vip" };
new const commandVIPs[][] = { "say /vips", "say_team /vips", "say /vipy", "say_team /vipy", "vipy" };
forward amxbans_admin_connect(id);
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR);
for (new i; i < sizeof commandVIP; i++) register_clcmd(commandVIP[i], "show_vip_motd");
for (new i; i < sizeof commandVIPs; i++) register_clcmd(commandVIPs[i], "show_vips");
register_message(get_user_msgid("SayText"), "say_text");
register_message(get_user_msgid("ScoreAttrib"), "vip_status");
listVIPs = ArrayCreate(MAX_NAME, MAX_PLAYERS);
}
public plugin_natives()
register_native("cod_get_user_vip", "_cod_get_user_vip", 1);
public plugin_end()
ArrayDestroy(listVIPs);
public cod_flags_changed(id, flags)
{
if (flags & VIP_FLAG) {
set_bit(id, vip);
new name[MAX_NAME], tempName[MAX_NAME], size = ArraySize(listVIPs);
get_user_name(id, name, charsmax(name));
for (new i = 0; i < size; i++) {
ArrayGetString(listVIPs, i, tempName, charsmax(tempName));
if (equal(name, tempName)) return PLUGIN_CONTINUE;
}
ArrayPushString(listVIPs, name);
} else remove_vip(id);
return PLUGIN_CONTINUE;
}
public client_disconnected(id)
remove_vip(id);
public remove_vip(id)
{
if (get_bit(id, vip)) {
rem_bit(id, vip);
new name[MAX_NAME], tempName[MAX_NAME], size = ArraySize(listVIPs);
get_user_name(id, name,charsmax(name));
for (new i = 0; i < size; i++) {
ArrayGetString(listVIPs, i, tempName, charsmax(tempName));
if (equal(tempName, name)) {
ArrayDeleteItem(listVIPs, i);
break;
}
}
}
return PLUGIN_CONTINUE;
}
public client_infochanged(id)
{
if (get_bit(id, vip)) {
new name[MAX_NAME], newName[MAX_NAME];
get_user_info(id, "name", name, charsmax(name));
get_user_name(id, newName,charsmax(newName));
if (!equal(name, newName)) {
ArrayPushString(listVIPs, name);
new tempName[MAX_NAME], size = ArraySize(listVIPs);
for (new i = 0; i < size; i++) {
ArrayGetString(listVIPs, i, tempName, charsmax(tempName));
if (equal(tempName, newName)) {
ArrayDeleteItem(listVIPs,i);
break;
}
}
}
}
return PLUGIN_CONTINUE;
}
public show_vip_motd(id)
show_motd(id, "vip.txt", "Informacje o VIPie");
public show_vips(id)
{
new message[192], name[MAX_NAME], size = ArraySize(listVIPs);
for (new i = 0; i < size; i++) {
ArrayGetString(listVIPs, i, name, charsmax(name));
add(message, charsmax(message), name);
if (i == size - 1) add(message, charsmax(message), ".");
else add(message, charsmax(message), ", ");
}
cod_print_chat(id, "^x03VIPy^x01 na serwerze:^x04 %s", message);
return PLUGIN_CONTINUE;
}
public cod_class_changed(id, class)
{
if (get_bit(id, vip) && is_user_alive(id)) {
cod_give_weapon(id, CSW_HEGRENADE);
cod_give_weapon(id, CSW_FLASHBANG, 2);
cod_give_weapon(id, CSW_SMOKEGRENADE);
}
}
public cod_spawned(id, respawn)
{
if (get_bit(id, vip) && is_user_alive(id)) {
cod_give_weapon(id, CSW_HEGRENADE);
cod_give_weapon(id, CSW_FLASHBANG, 2);
cod_give_weapon(id, CSW_SMOKEGRENADE);
}
}
public cod_damage_post(attacker, victim, weapon, Float:damage, damageBits, hitPlace)
{
if (!get_bit(attacker, vip)) return PLUGIN_CONTINUE;
cod_inflict_damage(attacker, victim, damage * 0.05, 0.0, damageBits);
return PLUGIN_CONTINUE;
}
public cod_killed(killer, victim, weaponId, hitPlace)
{
if (!get_bit(killer, vip)) return PLUGIN_CONTINUE;
new bool:hs = hitPlace == HIT_HEAD;
cod_add_user_health(killer, hs ? 15 : 10);
if (hs) cod_show_hud(killer, TYPE_DHUD, 38, 218, 116, -1.0, 0.35, 0, 0.0, 1.0, 0.0, 0.0, "HeadShot! +15HP");
else cod_show_hud(killer, TYPE_DHUD, 255, 212, 0, -1.0, 0.31, 0, 0.0, 1.0, 0.0, 0.0, "Zabiles! +10HP");
return PLUGIN_CONTINUE;
}
public vip_status()
{
new id = get_msg_arg_int(1);
if (is_user_alive(id) && get_bit(id, vip)) set_msg_arg_int(2, ARG_BYTE, get_msg_arg_int(2) | 4);
}
public say_text(msgId, msgDest, msgEnt)
{
new id = get_msg_arg_int(1);
if (is_user_connected(id) && get_bit(id, vip)) {
new tempMessage[192], message[192], chatPrefix[64], playerName[MAX_NAME];
get_msg_arg_string(2, tempMessage, charsmax(tempMessage));
formatex(chatPrefix, charsmax(chatPrefix), "^x04[VIP]");
if (!equal(tempMessage, "#Cstrike_Chat_All")) {
add(message, charsmax(message), chatPrefix);
add(message, charsmax(message), " ");
add(message, charsmax(message), tempMessage);
} else {
get_user_name(id, playerName, charsmax(playerName));
get_msg_arg_string(4, tempMessage, charsmax(tempMessage));
set_msg_arg_string(4, "");
add(message, charsmax(message), chatPrefix);
add(message, charsmax(message), "^x03 ");
add(message, charsmax(message), playerName);
add(message, charsmax(message), "^x01 : ");
add(message, charsmax(message), tempMessage);
}
set_msg_arg_string(2, message);
}
return PLUGIN_CONTINUE;
}
public _cod_get_user_vip(id)
return get_bit(id, vip);