]> icculus.org git repositories - divverent/nexuiz.git/blob - data/qcsrc/server/clientcommands.qc
deleted clientcommands check, now just let all through (that is now safe in DP)
[divverent/nexuiz.git] / data / qcsrc / server / clientcommands.qc
1 void ReadyCount();
2 float ValidateMap(string vote);
3 void(entity e) DropFlag;
4
5 void Say(entity source, float teamsay, string msgin)
6 {
7         string msgstr, colorstr, cmsgstr;
8         entity head;
9
10         msgin = formatmessage(msgin);
11
12         if(msgin == "")
13                 return;
14
15         colorstr = Team_ColorCode(source.team);
16
17         if(!teams_matter)
18                 teamsay = FALSE;
19
20         if(source.classname != "player") // observers can't
21                 teamsay = FALSE;
22
23         // how can we prevent the message from appearing in a listen server?
24         // for now, just give "say" back and only handle say_team
25         if(!teamsay)
26         {
27                 clientcommand(self, strcat("say ", msgin));
28                 return;
29         }
30
31         if(teamsay)
32         {
33                 msgstr = strzone(strcat("\{1}", colorstr, "(^3", source.netname, colorstr, ") ^7", msgin, "\n"));
34                 cmsgstr = strcat(colorstr, "(^3", source.netname, colorstr, ")\n^7", wordwrap(msgin, 50));
35         }
36         else
37                 msgstr = strzone(strcat("\{1}^3", source.netname, "^7: ", msgin, "\n"));
38
39         head = find(world, classname, "player");
40         while(head)
41         {
42                 if(clienttype(head) == CLIENTTYPE_REAL)
43                         if(!teamsay || (head.team == source.team))
44                         {
45                                 sprint(head, msgstr);
46                                 if(teamsay)
47                                         centerprint(head, cmsgstr);
48                                 //stuffcmd(head, "play2 misc/talk.wav\n");
49                         }
50                 head = find(head, classname, "player");
51         }
52
53         if(!teamsay)
54         {
55                 head = find(world, classname, "observer");
56                 while(head)
57                 {
58                         if(clienttype(head) == CLIENTTYPE_REAL)
59                         {
60                                 sprint(head, msgstr);
61                                 //stuffcmd(head, "play2 misc/talk.wav\n");
62                         }
63                         head = find(head, classname, "observer");
64                 }
65                 head = find(world, classname, "spectator");
66                 while(head)
67                 {
68                         if(clienttype(head) == CLIENTTYPE_REAL)
69                         {
70                                 sprint(head, msgstr);
71                                 //stuffcmd(head, "play2 misc/talk.wav\n");
72                         }
73                         head = find(head, classname, "spectator");
74                 }
75                 ServerConsoleEcho(substring(msgstr, 1, strlen(msgstr) - 2), TRUE);
76         }
77
78         strunzone(msgstr);
79 }
80
81 void SV_ParseClientCommand(string s) {
82         local float index;
83         local string cmd;
84
85         tokenize(s);
86
87         if(argv(0) == "clogin") {
88                 if(cvar("sv_clientcommands")) {
89                         if(self.adminstatus < -5) {
90                                 sprint(self, "Too many unsuccessful tries.\n");
91                         } else if(argv(1) == cvar_string("sv_clientcommands_password")) {
92                                 self.adminstatus = 1;
93                                 sprint(self, "You now have remote admin status.\n");
94                                 ServerConsoleEcho(strcat("ClientCommands: ", self.netname, " received admin status"), TRUE);
95                         } else {
96                                 sprint(self, "Wrong password.\n");
97                                 // use of -- produces compiler warning in the if() line???
98                                 self.adminstatus = self.adminstatus - 1;
99                                 if(self.adminstatus == 0)
100                                 {
101                                         sprint(self, "You lost remote admin status.\n");
102                                         ServerConsoleEcho(strcat("ClientCommands: ", self.netname, " lost admin status"), TRUE);
103                                 }
104                         }
105                 } else {
106                         sprint(self, "Clientside commands NOT allowed.\n");
107                 }
108         } else if(argv(0) == "ccmd") {
109                 if(cvar("sv_clientcommands")) {
110                         if(self.adminstatus > 0) {
111                                 local string command;
112                                 command = argv(1);
113                                 index = 2;
114                                 while(argv(index) != "") {
115                                         command = strcat(command, " ", argv(index));
116                                         index++;
117                                 }
118                                 command = strzone(command);
119                                 ServerConsoleEcho(strcat("ClientCommands: ", self.netname, " issued command '", command, "'"), TRUE);
120                                 localcmd(strcat(command, "\n"));
121                                 strunzone(command);
122                         } else
123                                 sprint(self, "You don't have remote admin status.\n");
124                 } else {
125                         sprint(self, "Clientside commands NOT allowed.\n");
126                 }
127         } else if(argv(0) == "vote") {
128                 if(argv(1) == "help") {
129                         local string vmasterdis;
130                         if(!cvar("sv_vote_master")) {
131                                 vmasterdis = " ^1(disabled)";
132                         }
133                         local string vcalldis;
134                         if(!cvar("sv_vote_call")) {
135                                 vcalldis = " ^1(disabled)";
136                         }
137                         sprint(self, "^7You can use voting with \"^2cmd vote help^7\" \"^2cmd vote status^7\" \"^2cmd vote call ^3COMMAND ARGUMENTS^7\" \"^2cmd vote stop^7\" \"^2cmd vote master^7\" \"^2cmd vote do ^3COMMAND ARGUMENTS^7\" \"^2cmd vote yes^7\" \"^2cmd vote no^7\".\n");
138                         sprint(self, "^7Or if your version is up to date you can use these aliases \"^2vhelp^7\" \"^2vstatus^7\" \"^2vcall ^3COMMAND ARGUMENTS^7\" \"^2vstop^7\" \"^2vmaster^7\" \"^2vdo ^3COMMAND ARGUMENTS^7\" \"^2vyes^7\" \"^2vno^7\".\n");
139                         sprint(self, "^7\"^2help^7\" shows this info.\n");
140                         sprint(self, "^7\"^2status^7\" shows if there is a vote called and who called it.\n");
141                         sprint(self, strcat("^7\"^2call^7\" is used to call a vote. See the list of allowed commands.", vcalldis, "^7\n"));
142                         sprint(self, "^7\"^2stop^7\" can be used by the vote caller or an admin to stop a vote and maybe correct it.\n");
143                         sprint(self, strcat("^7\"^2master^7\" is used to call a vote to become a master.", vmasterdis, "^7\n"));
144                         sprint(self, "^7\"^2do^7\" If you are a master you can execute a command without a vote. See the list of allowed commands.\n");
145                         sprint(self, "^7\"^2yes^7\" and \"^2no^7\" to make your vote.\n");
146                         sprint(self, "^7If more then 50% of the players vote yes the vote is accepted.\n");
147                         sprint(self, "^7If more then 50% of the players vote no the vote is rejected.\n");
148                         sprint(self, strcat("^7The vote will end after ", cvar_string("sv_vote_timeout"), "^7 seconds.\n"));
149                         sprint(self, "^7You can call a vote for or execute these commands:\n");
150                         sprint(self, strcat("^3", cvar_string("sv_vote_commands"), "^7 and maybe further ^3arguments^7\n"));
151                 } else if(argv(1) == "status") {
152                         if(votecalled) {
153                                 sprint(self, strcat("^7Vote for \"^1", votecalledvote, "^7\" called by \"^7", votecaller.netname, "^7\".\n"));
154                         } else {
155                                 sprint(self, "^1No vote called.\n");
156                         }
157                 } else if(argv(1) == "call") {
158                         if(cvar("sv_vote_call")) {
159                                 if(votecalled) {
160                                         sprint(self, "^1There is already a vote called.\n");
161                                 } else {
162                                         local string vote;
163                                         vote = VoteParse();
164                                         if(vote == "") {
165                                                 sprint(self, "^1Your vote is empty. See help for more info.\n");
166                                         } else if(time < self.vote_next) {
167                                                 sprint(self, strcat("^1You have to wait ^2", ftos(self.vote_next - time), "^1 seconds before you can again call a vote.\n"));
168                                         } else if(VoteAllowed(strcat(argv(2)))) { // strcat seems to be necessary
169                                                 if(!ValidateMap(vote))
170                                                         return;
171                                                 votecalled = TRUE;
172                                                 votecalledmaster = FALSE;
173                                                 // remap chmap to gotomap (forces intermission)
174                                                 if(strlen(vote) >= 6)
175                                                         if(substring(vote, 0, 6) == "chmap ")
176                                                                 vote = strcat("gotomap ", substring(vote, 6, strlen(vote) - 6));
177                                                 votecalledvote = strzone(vote);
178                                                 votecaller = self; // remember who called the vote
179                                                 votefinished = time + cvar("sv_vote_timeout");
180                                                 votecaller.vote_vote = 1; // of course you vote yes
181                                                 votecaller.vote_next = time + cvar("sv_vote_wait");
182                                                 bprint(strcat("\{1}^2* ^3", votecaller.netname, "^2 calls a vote for ^1", votecalledvote, "\n"));
183                                                 VoteCount(); // needed if you are the only one
184                                         } else {
185                                                 sprint(self, "^1This vote is not ok. See help for more info.\n");
186                                         }
187                                 }
188                         } else {
189                                 sprint(self, "^1Vote calling is NOT allowed.\n");
190                         }
191                 } else if(argv(1) == "stop") {
192                         if(!votecalled) {
193                                 sprint(self, "^1No vote called.\n");
194                         } else if(self == votecaller
195                                   || self.adminstatus > 0) { // the votecaller and admins can stop a vote
196                                 VoteStop(self);
197                         } else {
198                                 sprint(self, "^1You are not allowed to stop that Vote.\n");
199                         }
200                 } else if(argv(1) == "master") {
201                         if(cvar("sv_vote_master")) {
202                                 if(votecalled) {
203                                         sprint(self, "^1There is already a vote called.\n");
204                                 } else {
205                                         votecalled = TRUE;
206                                         votecalledmaster = TRUE;
207                                         votecalledvote = strzone("^3master");
208                                         votecaller = self; // remember who called the vote
209                                         votefinished = time + cvar("sv_vote_timeout");
210                                         votecaller.vote_vote = 1; // of course you vote yes
211                                         votecaller.vote_next = time + cvar("sv_vote_wait");
212                                         bprint(strcat("\{1}^2* ^3", votecaller.netname, "^2 calls a vote to become ^3master^2.\n"));
213                                         VoteCount(); // needed if you are the only one
214                                 }
215                         } else {
216                                 sprint(self, "^1Vote to become master is NOT allowed.\n");
217                         }
218                 } else if(argv(1) == "do") {
219                         if(argv(2) == "login") {
220                                 local string masterpwd;
221                                 masterpwd = cvar_string("sv_vote_master_password");
222                                 if(masterpwd != "") {
223                                         self.vote_master = (masterpwd == argv(3));
224                                         if(self.vote_master) {
225                                                 ServerConsoleEcho(strcat("Accepted master login from ", self.netname), TRUE);
226                                                 bprint(strcat("\{1}^2* ^3", self.netname, "^2 logged in as ^3master^2\n"));
227                                         }
228                                         else
229                                                 ServerConsoleEcho(strcat("REJECTED master login from ", self.netname), TRUE);
230                                 }
231                                 else
232                                         sprint(self, "^1You are NOT a master.\n");
233                         } else if(self.vote_master) {
234                                 local string dovote;
235                                 dovote = VoteParse();
236                                 if(dovote == "") {
237                                         sprint(self, "^1Your command was empty. See help for more info.\n");
238                                 } else if(VoteAllowed(strcat(argv(2)))) { // strcat seems to be necessary
239                                         if(!ValidateMap(dovote))
240                                                 return;
241                                         // remap chmap to gotomap (forces intermission)
242                                         if(strlen(dovote) >= 6)
243                                                 if(substring(dovote, 0, 6) == "chmap ")
244                                                         vote = strcat("gotomap ", substring(dovote, 6, strlen(dovote) - 6));
245                                         bprint("\{1}^2* ^3", strcat(self.netname, "^2 used his ^3master^2 status to do \"^2", dovote, "^2\".\n"));
246                                         localcmd(strcat(dovote, "\n"));
247                                 } else {
248                                         sprint(self, "^1This command is not ok. See help for more info.\n");
249                                 }
250                         } else {
251                                 sprint(self, "^1You are NOT a master.\n");
252                         }
253                 } else if(argv(1) == "yes") {
254                         if(!votecalled) {
255                                 sprint(self, "^1No vote called.\n");
256                         } else if(self.vote_vote == 0
257                                   || cvar("sv_vote_change")) {
258                                 sprint(self, "^1You accepted the vote.\n");
259                                 self.vote_vote = 1;
260                                 if(!cvar("sv_vote_singlecount")) {
261                                         VoteCount();
262                                 }
263                         } else {
264                                 sprint(self, "^1You have already voted.\n");
265                         }
266                 } else if(argv(1) == "no") {
267                         if(!votecalled) {
268                                 sprint(self, "^1No vote called.\n");
269                         } else if(self.vote_vote == 0
270                                   || cvar("sv_vote_change")) {
271                                 sprint(self, "^1You rejected the vote.\n");
272                                 self.vote_vote = -1;
273                                 if(!cvar("sv_vote_singlecount")) {
274                                         VoteCount();
275                                 }
276                         } else {
277                                 sprint(self, "^1You have already voted.\n");
278                         }
279                 } else {
280                         // ignore this?
281                         sprint(self, "^1Unknown vote command.\n");
282                 }
283         } else if(argv(0) == "autoswitch") {
284                 // be backwards compatible with older clients (enabled)
285                 self.autoswitch = ("0" != argv(1));
286                 local string autoswitchmsg;
287                 if (self.autoswitch) {
288                         autoswitchmsg = "on";
289                 } else {
290                         autoswitchmsg = "off";
291                 }
292                 sprint(self, strcat("^1autoswitch turned ", autoswitchmsg, "\n"));
293         } else if(argv(0) == "clientversion") {
294                 if (argv(1) == "$gameversion") {
295                         //versionmsg = "^1client is too old to get versioninfo.\nUPDATE!!! (http://www.nexuiz.com)^8";
296                         // either that or someone wants to be funny
297                         self.version = 1;
298                 } else {
299                         self.version = stof(argv(1));
300                 }
301                 if(self.version != cvar("gameversion")) 
302                 {
303                         self.classname = "observer";
304                         self.frags = -2;
305                         PutClientInServer();
306                 } else if(cvar("g_campaign") || cvar("g_balance_teams")) {
307                         //JoinBestTeam(self, 0);
308                 } else if(cvar("teamplay") && !cvar("sv_spectate")) {
309                         self.classname = "observer";
310                         stuffcmd(self,"menu_showteamselect\n");
311                 }
312         } else if(argv(0) == "reportcvar") {
313                 GetCvars(1);
314         } else if(argv(0) == "spectate") {
315                 if(cvar("g_lms") || cvar("g_arena"))
316                         return; // don't allow spectating in lms, unless player runs out of lives
317                 if(self.classname == "player" && cvar("sv_spectate") == 1) {
318                         if(self.flagcarried)
319                                 DropFlag(self.flagcarried);
320                         DistributeFragsAmongTeam(self, self.team, 1.0);
321                         self.classname = "observer";
322                         PutClientInServer();
323                 }
324         } else if(argv(0) == "join") {
325                 if(!cvar("g_arena"))
326                 if (self.classname != "player")
327                 {
328                         self.classname = "player";
329                         self.frags = 0;
330                         bprint (strcat("^4", self.netname, "^4 is playing now\n"));
331                         PutClientInServer();
332                 }
333         } else if( argv(0) == "selectteam" ) {
334                 if( !cvar("teamplay") ) {
335                         sprint( self, "selecteam can only be used in teamgames\n");
336                 } else if(cvar("g_campaign")) {
337                         //JoinBestTeam(self, 0);
338                 } else if( argv(1) == "none" ) {
339                         SV_ChangeTeam( 0 );
340                 } else if( argv(1) == "red" ) {
341                         SV_ChangeTeam( COLOR_TEAM1 - 1 );
342                 } else if( argv(1) == "blue" ) {
343                         SV_ChangeTeam( COLOR_TEAM2 - 1 );
344                 } else if( argv(1) == "pink" ) {
345                         SV_ChangeTeam( COLOR_TEAM3 - 1 );
346                 } else if( argv(1) == "yellow" ) {
347                         SV_ChangeTeam( COLOR_TEAM4 - 1 );
348                 } else if( argv(1) == "auto" ) {
349                         self.team = -1;
350                         JoinBestTeam( self, 0 );
351                 } else {
352                         sprint( self, strcat( "selectteam none/red/blue/pink/yellow/auto - \"", argv(1), "\" not recognised\n" ) );
353                 }
354         } else if(argv(0) == "ready") {
355                 if(cvar("sv_ready_restart"))
356                 {
357                         self.ready = TRUE;
358                         bprint(self.netname, "^2 is ready\n");
359                         ReadyCount();
360                 }
361         } else if(argv(0) == "maplist") {
362                 local float i, n;
363                 local string col;
364                 n = tokenize(cvar_string("g_maplist"));
365                 sprint(self, "^7Maps in list: ");
366                 for(i = 0; i < n; ++i)
367                 {
368                         if(math_mod(i, 2))
369                                 col = "^2";
370                         else
371                                 col = "^3";
372                         sprint(self, strcat(col, argv(i), " "));
373                 }
374                 sprint(self, "\n");
375         } else if(argv(0) == "say") {
376                 Say(self, FALSE, substring(s, 4, strlen(s) - 4));
377                 //clientcommand(self, formatmessage(s));
378         } else if(argv(0) == "say_team") {
379                 Say(self, TRUE, substring(s, 9, strlen(s) - 9));
380                 //clientcommand(self, formatmessage(s));
381         } else if(argv(0) == "info") {
382                 cmd = cvar_string(strcat("sv_info_", argv(1)));
383                 if(cmd == "")
384                         sprint(self, "ERROR: unsupported info command\n");
385                 else
386                         wordwrap_sprint(cmd, 1111);
387         } else {
388                 cmd = argv(0);
389                 /* checks not needed any more since DP has separated clientcommands and regular commands
390                 if(cmd != "status")
391                 if(cmd != "name")
392                 //if(cmd != "say") // handled above
393                 //if(cmd != "say_team") // handled above
394                 if(cmd != "tell")
395                 if(cmd != "color")
396                 if(cmd != "kill")
397                 if(cmd != "pause")
398                 if(cmd != "kick")
399                 if(cmd != "ping")
400                 if(cmd != "pings")
401                 if(cmd != "ban")
402                 if(cmd != "pmodel")
403                 if(cmd != "rate")
404                 if(cmd != "playermodel")
405                 if(cmd != "playerskin")
406                 if(cmd != "god") if(cmd != "notarget") if(cmd != "fly") if(cmd != "give") if(cmd != "noclip")
407                 {
408                         ServerConsoleEcho(strcat("WARNING: Invalid clientcommand by ", self.netname, ": ", s), TRUE);
409                         return;
410                 }
411                 */
412                 clientcommand(self,s);
413         }
414 }
415
416 float ValidateMap(string vote)
417 {
418         string ext;
419         
420         tokenize(vote);
421         if(argv(0) == "map" || argv(0) == "changelevel")
422                 ext = ".bsp";
423         else if(argv(0) == "chmap")
424                 ext = ".mapcfg";
425         else if(argv(0) == "gotomap")
426                 ext = ".mapcfg";
427         else
428                 return TRUE;
429
430         if(!TryFile(strcat("maps/", argv(1), ext)))
431         {
432                 sprint(self, strcat("^1Invalid mapname, \"^3", argv(1), "^1\" does not exist on this server.\n"));
433                 return FALSE;
434         }
435         return TRUE;
436 }
437
438
439 void VoteThink() {
440         if(votefinished > 0 // a vote was called
441             && time > votefinished) // time is up
442         {
443                 VoteCount();
444         }
445 }
446
447 string VoteParse() {
448         local float index;
449         index = 3;
450         local string vote;
451         vote = argv(2);
452         while(argv(index) != "") {
453                 vote = strcat(vote, " ", argv(index));
454                 index++;
455         }
456
457         // necessary for some of the string operations
458         vote = strzone(vote);
459
460         // now we remove some things that could be misused
461         index = 0;
462         local float found;
463         found = FALSE;
464         local float votelength;
465         votelength = strlen(vote);
466         while(!found && index < votelength)
467         {
468                 local string badchar;
469                 badchar = substring(vote, index, 1);
470                 if(badchar == ";"
471                    || badchar == "\r"
472                    || badchar == "\n")
473                 {
474                         found = TRUE;
475                 } else {
476                         index++;
477                 }
478         }
479         return substring(vote, 0, index);
480 }
481
482 float VoteAllowed(string votecommand) {
483         tokenize(cvar_string("sv_vote_commands"));
484         local float index;
485         index = 0;
486         while(argv(index) != "") {
487                 local string allowed;
488                 allowed = argv(index);
489                 if(votecommand == allowed) {
490                         return TRUE;
491                 }
492                 index++;
493         }
494         return FALSE;
495 }
496
497 void VoteReset() {
498         local string searchclass;
499         searchclass = "player";
500
501         while (TRUE)
502         {
503                 local entity player;
504                 player = find(player, classname, searchclass);
505                 while(player)
506                 {
507                         player.vote_vote = 0;
508                         player = find(player, classname, searchclass);
509                 }
510
511                 if("player" == searchclass) {
512                         searchclass = "observer";
513                 } else if("observer" == searchclass) {
514                         searchclass = "spectator";
515                 } else {
516                         break;
517                 }
518         }
519
520         votecalled = FALSE;
521         votecalledmaster = FALSE;
522         votefinished = 0;
523 }
524
525 void VoteAccept() {
526         bprint(strcat("\{1}^2* ^3", votecaller.netname, "^2's vote for ^1", votecalledvote, "^2 was accepted\n"));
527         if(votecalledmaster)
528         {
529                 votecaller.vote_master = 1;
530         } else {
531                 localcmd(strcat(votecalledvote, "\n"));
532         }
533         votecaller.vote_next = 0; // people like your votes, no wait for next vote
534         VoteReset();
535 }
536
537 void VoteReject() {
538         bprint(strcat("\{1}^2* ^3", votecaller.netname, "^2's vote for ^1", votecalledvote, "^2 was rejected\n"));
539         VoteReset();
540 }
541
542 void VoteTimeout() {
543         bprint(strcat("\{1}^2* ^3", votecaller.netname, "^2's vote for ^1", votecalledvote, "^2 timed out\n"));
544         VoteReset();
545 }
546
547 void VoteStop(entity stopper) {
548         bprint(strcat("\{1}^2* ^3", stopper.netname, "^2 stopped ^3", votecaller.netname, "^2's vote\n"));
549         if(stopper == votecaller) {
550                 // no wait for next vote so you can correct your vote
551                 votecaller.vote_next = 0;
552         }
553         VoteReset();
554 }
555
556 void VoteCount() {
557         local float playercount;
558         playercount = 0;
559         local float yescount;
560         yescount = 0;
561         local float nocount;
562         nocount = 0;
563         local string searchclass;
564         searchclass = "player";
565
566         while (TRUE)
567         {
568                 local entity player;
569                 player = find(player, classname, searchclass);
570
571                 while(player)
572                 {
573                         if(clienttype(player) != CLIENTTYPE_BOT) {
574                                 if(player.vote_vote < 0) {
575                                         nocount++;
576                                 } else if(player.vote_vote > 0) {
577                                         yescount++;
578                                 }
579                                 playercount++;
580                         }
581                         player = find(player, classname, searchclass);
582                 }
583
584                 if("player" == searchclass) {
585                         searchclass = "observer";
586                 } else if("observer" == searchclass) {
587                         searchclass = "specator";
588                 } else {
589                         break;
590                 }
591         }
592
593         if((playercount == 1) && votecalledmaster) {
594                 // if only one player is on the server becoming vote
595                 // master is not allowed.  This could be used for
596                 // trolling or worse. 'self' is the user who has
597                 // called the vote because this function is called
598                 // by SV_ParseClientCommand. Maybe all voting should
599                 // be disabled for a single player?
600                 sprint(self, "^1You are the only player on this server so you can not become vote master.\n");
601                 votecaller.vote_next = 0;
602                 VoteReset();
603         } else if((playercount / 2) < yescount) { // vote accepted
604                 VoteAccept();
605         } else if((playercount / 2) < nocount) { // vote rejected
606                 VoteReject();
607         } else if(time > votefinished) { // vote timedout
608                 VoteTimeout();
609         } // else still running
610 }
611
612
613 void ReadyCount()
614 {
615         local entity e;
616         local float r, p;
617
618         e = find(world, classname, "player");
619
620         while(e)
621         {
622                 if(clienttype(e) == CLIENTTYPE_REAL)
623                 {
624                         p += 1;
625                         if(e.ready) r += 1;
626                 }
627                 e = find(e, classname, "player");
628         }
629
630         if(p && r == p)
631         {
632                 bprint("^1Server is restarting...\n");
633                 localcmd("restart\n");
634         }
635 }