-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathadmin.qc
227 lines (213 loc) · 7.39 KB
/
admin.qc
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
217
218
219
220
221
222
223
224
225
226
227
void (entity p) BanCheater;
void () Admin_CountPlayers = {
local string st;
local float nump;
nump = TeamFortress_GetNoPlayers();
st = ftos(nump);
sprint3(self, PRINT_HIGH, "Players in game: ", st, "\n");
if (number_of_teams > 0) {
nump = TeamFortress_TeamGetNoPlayers(1);
st = ftos(nump);
sprint3(self, PRINT_HIGH, "Players in blue team: ", st, "\n");
}
if (number_of_teams > 1) {
nump = TeamFortress_TeamGetNoPlayers(2);
st = ftos(nump);
sprint3(self, PRINT_HIGH, "Players in red team: ", st, "\n");
}
if (number_of_teams > 2) {
nump = TeamFortress_TeamGetNoPlayers(3);
st = ftos(nump);
sprint3(self, PRINT_HIGH, "Players in yellow team: ", st, "\n");
}
if (number_of_teams > 3) {
nump = TeamFortress_TeamGetNoPlayers(4);
st = ftos(nump);
sprint3(self, PRINT_HIGH, "Players in green team: ", st, "\n");
}
};
void () Admin_ListIPs = {
if (TeamFortress_GetNoPlayers() <= 1) {
sprint(self, PRINT_HIGH, "No other players in the game\n");
self.admin_use = world;
return;
}
self.admin_use = find(self.admin_use, classname, "player");
while (self.admin_use != world) {
if ((self.admin_use.netname != string_null) &&
(self.admin_use != self)) {
self.admin_use.ip = infokey(self.admin_use, "ip");
sprint(self, PRINT_HIGH, self.admin_use.netname, " (",
self.admin_use.ip, ")\n");
}
self.admin_use = find(self.admin_use, classname, "player");
}
self.admin_use = find(self.admin_use, classname, "observer");
while (self.admin_use != world) {
if ((self.admin_use.netname != string_null) &&
(self.admin_use != self)) {
self.admin_use.ip = infokey(self.admin_use, "ip");
sprint(self, PRINT_HIGH, self.admin_use.netname, " (",
self.admin_use.ip, ") (SPECTATOR)\n");
}
self.admin_use = find(self.admin_use, classname, "observer");
}
sprint(self, PRINT_HIGH, "End of player list\n");
self.admin_use = world;
};
void () Admin_CycleDeal = {
if (TeamFortress_GetNoPlayers() <= 1) {
sprint(self, PRINT_HIGH, "No other players in the game\n");
self.admin_use = world;
self.admin_mode = 0;
return;
}
if (self.admin_use.classname != "observer") {
self.admin_use = find(self.admin_use, classname, "player");
while ((self.admin_use != world) &&
((self.admin_use.netname == string_null)
|| (self.admin_use == self))) {
self.admin_use = find(self.admin_use, classname, "player");
}
if (self.admin_use == world) {
self.admin_use = find(self.admin_use, classname, "observer");
while ((self.admin_use != world) &&
((self.admin_use.netname == string_null)
|| (self.admin_use == self))) {
self.admin_use =
find(self.admin_use, classname, "observer");
}
}
} else {
self.admin_use = find(self.admin_use, classname, "observer");
while ((self.admin_use != world) &&
((self.admin_use.netname == string_null)
|| (self.admin_use == self))) {
self.admin_use = find(self.admin_use, classname, "observer");
}
}
if (self.admin_use) {
self.admin_use.ip = infokey(self.admin_use, "ip");
self.admin_mode = 1;
sprint(self, PRINT_HIGH, self.admin_use.netname, " (",
self.admin_use.ip, ")");
if (self.admin_use.classname == "observer") {
sprint(self, PRINT_HIGH, " (spectator)");
}
sprint(self, PRINT_HIGH, "\n kick/ban/next?\n");
} else {
self.admin_mode = 0;
sprint(self, PRINT_HIGH, "End of player list\n");
}
};
void () Admin_DoKick = {
bprint4(PRINT_HIGH, self.admin_use.netname, " was kicked by ",
self.netname, "\n");
KickCheater(self.admin_use);
self.admin_mode = 0;
self.admin_use = world;
};
void () Admin_DoBan = {
bprint4(PRINT_HIGH, self.admin_use.netname, " was banned by ",
self.netname, "\n");
BanCheater(self.admin_use);
self.admin_mode = 0;
self.admin_use = world;
};
void () CeaseFire_think = {
local entity te;
if ((time > cb_ceasefire_time) && (self.weapon == 1) &&
(cease_fire == 1)) {
cease_fire = 0;
bprint(PRINT_HIGH, "Resume fire\n");
te = find(world, classname, "player");
while (te) {
CenterPrint3(te, "Resume fire\nCalled by: ",
self.owner.netname, "\n");
te.immune_to_check = time + 10;
te.tfstate = te.tfstate - (te.tfstate & 65536);
TeamFortress_SetSpeed(te);
te = find(te, classname, "player");
}
dremove(self);
return;
}
if (!cease_fire) {
dremove(self);
return;
}
te = find(world, classname, "player");
while (te) {
CenterPrint3(te, "CEASE FIRE\nCalled by: ", self.owner.netname,
"\n");
te = find(te, classname, "player");
}
self.nextthink = time + 5;
};
void () Admin_CeaseFire = {
local entity te;
if (!cease_fire) {
cease_fire = 1;
bprint(PRINT_HIGH, "Cease fire\n");
te = find(world, classname, "player");
while (te) {
CenterPrint3(te, "Cease fire\nCalled by: ", self.netname,
"\n");
te.immune_to_check = time + 10;
te.tfstate = te.tfstate | 65536;
TeamFortress_SetSpeed(te);
te = find(te, classname, "player");
}
te = spawn();
te.owner = self;
te.classname = "ceasefire";
te.think = CeaseFire_think;
te.nextthink = time + 5;
} else {
te = find(world, classname, "ceasefire");
if (te)
dremove(te);
cease_fire = 0;
bprint(PRINT_HIGH, "Resume fire\n");
te = find(world, classname, "player");
while (te) {
CenterPrint3(te, "Resume fire\nCalled by: ", self.netname,
"\n");
te.immune_to_check = time + 10;
te.tfstate = te.tfstate - (te.tfstate & 65536);
TeamFortress_SetSpeed(te);
te = find(te, classname, "player");
}
}
};
void (entity p) CheckAutoKick = {
local float rnum;
local entity te;
if ((p.teamkills >= autokick_kills) && (autokick_kills != 0)) {
bprint2(PRINT_HIGH, p.netname,
" was kicked for killing teammates\n");
sprint(p, PRINT_HIGH, "You were kicked for killing teammates\n");
KickCheater(p);
} else if (autokick_kills != 0) {
if (p.teamkills == (autokick_kills - 1)) {
sprint(p, PRINT_HIGH,
"Kill one more teammate, and you will get kicked out\n");
}
rnum = 0;
te = find(world, classname, "ak_timer");
while (te) {
if (te.owner == p) {
rnum = 1;
te = world;
} else
te = find(te, classname, "ak_timer");
}
if (rnum == 0) {
te = spawn();
te.classname = "ak_timer";
te.owner = p;
te.think = autokick_think;
te.nextthink = time + autokick_time;
}
}
};