]> icculus.org git repositories - divverent/nexuiz.git/blob - data/qcsrc/server/clientcommands.qc
new command: vdo login (password) - if password matches sv_vote_master_password and...
[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                                         centermsg_setfor(head, CENTERMSG_TEAMSAY, 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("\"^3", votecaller.netname, "^3\" called a vote to become ^3master^3.\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                                         // remap chmap to gotomap (forces intermission)
240                                         if(strlen(dovote) >= 6)
241                                                 if(substring(dovote, 0, 6) == "chmap ")
242                                                         vote = strcat("gotomap ", substring(dovote, 6, strlen(dovote) - 6));
243                                         bprint("\"^7", strcat(self.netname, "^2 used his ^3master^2 status to do \"^2", dovote, "^2\".\n"));
244                                         localcmd(strcat(dovote, "\n"));
245                                 } else {
246                                         sprint(self, "^1This command is not ok. See help for more info.\n");
247                                 }
248                         } else {
249                                 sprint(self, "^1You are NOT a master.\n");
250                         }
251                 } else if(argv(1) == "yes") {
252                         if(!votecalled) {
253                                 sprint(self, "^1No vote called.\n");
254                         } else if(self.vote_vote == 0
255                                   || cvar("sv_vote_change")) {
256                                 sprint(self, "^1You accepted the vote.\n");
257                                 self.vote_vote = 1;
258                                 if(!cvar("sv_vote_singlecount")) {
259                                         VoteCount();
260                                 }
261                         } else {
262                                 sprint(self, "^1You have already voted.\n");
263                         }
264                 } else if(argv(1) == "no") {
265                         if(!votecalled) {
266                                 sprint(self, "^1No vote called.\n");
267                         } else if(self.vote_vote == 0
268                                   || cvar("sv_vote_change")) {
269                                 sprint(self, "^1You rejected the vote.\n");
270                                 self.vote_vote = -1;
271                                 if(!cvar("sv_vote_singlecount")) {
272                                         VoteCount();
273                                 }
274                         } else {
275                                 sprint(self, "^1You have already voted.\n");
276                         }
277                 } else {
278                         // ignore this?
279                         sprint(self, "^1Unknown vote command.\n");
280                 }
281         } else if(argv(0) == "autoswitch") {
282                 // be backwards compatible with older clients (enabled)
283                 self.autoswitch = ("0" != argv(1));
284                 local string autoswitchmsg;
285                 if (self.autoswitch) {
286                         autoswitchmsg = "on";
287                 } else {
288                         autoswitchmsg = "off";
289                 }
290                 sprint(self, strcat("^1autoswitch turned ", autoswitchmsg, "\n"));
291         } else if(argv(0) == "clientversion") {
292                 if (argv(1) == "$gameversion") {
293                         //versionmsg = "^1client is too old to get versioninfo.\nUPDATE!!! (http://www.nexuiz.com)^8";
294                         // either that or someone wants to be funny
295                         self.version = 1;
296                 } else {
297                         self.version = stof(argv(1));
298                 }
299                 if(self.version != cvar("gameversion")) 
300                 {
301                         self.classname = "observer";
302                         self.frags = -2;
303                         PutClientInServer();
304                 } else if(cvar("g_campaign") || cvar("g_balance_teams")) {
305                         //JoinBestTeam(self, 0);
306                 } else if(cvar("teamplay") && !cvar("sv_spectate")) {
307                         self.classname = "observer";
308                         stuffcmd(self,"menu_showteamselect\n");
309                 }
310         } else if(argv(0) == "reportcvar") {
311                 GetCvars(1);
312         } else if(argv(0) == "spectate") {
313                 if(cvar("g_lms") || cvar("g_arena"))
314                         return; // don't allow spectating in lms, unless player runs out of lives
315                 if(self.classname == "player" && cvar("sv_spectate") == 1) {
316                         if(self.flagcarried)
317                                 DropFlag(self.flagcarried);
318                         DistributeFragsAmongTeam(self, self.team, 1.0);
319                         self.classname = "observer";
320                         PutClientInServer();
321                 }
322         } else if(argv(0) == "join") {
323                 if(!cvar("g_arena"))
324                 if (self.classname != "player")
325                 {
326                         self.classname = "player";
327                         self.frags = 0;
328                         bprint (strcat("^4", self.netname, "^4 is playing now\n"));
329                         PutClientInServer();
330                 }
331         } else if( argv(0) == "selectteam" ) {
332                 if( !cvar("teamplay") ) {
333                         sprint( self, "selecteam can only be used in teamgames\n");
334                 } else if(cvar("g_campaign")) {
335                         //JoinBestTeam(self, 0);
336                 } else if( argv(1) == "none" ) {
337                         SV_ChangeTeam( 0 );
338                 } else if( argv(1) == "red" ) {
339                         SV_ChangeTeam( COLOR_TEAM1 - 1 );
340                 } else if( argv(1) == "blue" ) {
341                         SV_ChangeTeam( COLOR_TEAM2 - 1 );
342                 } else if( argv(1) == "pink" ) {
343                         SV_ChangeTeam( COLOR_TEAM3 - 1 );
344                 } else if( argv(1) == "yellow" ) {
345                         SV_ChangeTeam( COLOR_TEAM4 - 1 );
346                 } else if( argv(1) == "auto" ) {
347                         self.team = -1;
348                         JoinBestTeam( self, 0 );
349                 } else {
350                         sprint( self, strcat( "selectteam none/red/blue/pink/yellow/auto - \"", argv(1), "\" not recognised\n" ) );
351                 }
352         } else if(argv(0) == "ready") {
353                 if(cvar("sv_ready_restart"))
354                 {
355                         self.ready = TRUE;
356                         bprint(self.netname, "^2 is ready\n");
357                         ReadyCount();
358                 }
359         } else if(argv(0) == "maplist") {
360                 local float i, n;
361                 local string col;
362                 n = tokenize(cvar_string("g_maplist"));
363                 sprint(self, "^7Maps in list: ");
364                 for(i = 0; i < n; ++i)
365                 {
366                         if(math_mod(i, 2))
367                                 col = "^2";
368                         else
369                                 col = "^3";
370                         sprint(self, strcat(col, argv(i), " "));
371                 }
372                 sprint(self, "\n");
373         } else if(argv(0) == "say") {
374                 Say(self, FALSE, substring(s, 4, strlen(s) - 4));
375                 //clientcommand(self, formatmessage(s));
376         } else if(argv(0) == "say_team") {
377                 Say(self, TRUE, substring(s, 9, strlen(s) - 9));
378                 //clientcommand(self, formatmessage(s));
379         } else if(argv(0) == "info") {
380                 cmd = cvar_string(strcat("sv_info_", argv(1)));
381                 if(cmd == "")
382                         sprint(self, "ERROR: unsupported info command\n");
383                 else
384                         wordwrap_sprint(cmd, 1111);
385         } else {
386                 cmd = argv(0);
387                 if(cmd != "status")
388                 if(cmd != "name")
389                 //if(cmd != "say") // handled above
390                 //if(cmd != "say_team") // handled above
391                 if(cmd != "tell")
392                 if(cmd != "color")
393                 if(cmd != "kill")
394                 if(cmd != "pause")
395                 if(cmd != "kick")
396                 if(cmd != "ping")
397                 if(cmd != "pings")
398                 if(cmd != "ban")
399                 if(cmd != "pmodel")
400                 if(cmd != "rate")
401                 if(cmd != "playermodel")
402                 if(cmd != "playerskin")
403                 if(cmd != "god") if(cmd != "notarget") if(cmd != "fly") if(cmd != "give") if(cmd != "noclip")
404                 {
405                         ServerConsoleEcho(strcat("WARNING: Invalid clientcommand by ", self.netname, ": ", s), TRUE);
406                         return;
407                 }
408                 clientcommand(self,s);
409         }
410 }
411
412 float ValidateMap(string vote)
413 {
414         string ext;
415         
416         tokenize(vote);
417         if(argv(0) == "map" || argv(0) == "changelevel")
418                 ext = ".bsp";
419         else if(argv(0) == "chmap")
420                 ext = ".mapcfg";
421         else if(argv(0) == "gotomap")
422                 ext = ".mapcfg";
423         else
424                 return TRUE;
425
426         if(!TryFile(strcat("maps/", argv(1), ext)))
427         {
428                 sprint(self, strcat("^1Invalid mapname, \"^3", argv(1), "^1\" does not exist on this server.\n"));
429                 return FALSE;
430         }
431         return TRUE;
432 }
433
434
435 void VoteThink() {
436         if(votefinished > 0 // a vote was called
437             && time > votefinished) // time is up
438         {
439                 VoteCount();
440         }
441 }
442
443 string VoteParse() {
444         local float index;
445         index = 3;
446         local string vote;
447         vote = argv(2);
448         while(argv(index) != "") {
449                 vote = strcat(vote, " ", argv(index));
450                 index++;
451         }
452
453         // necessary for some of the string operations
454         vote = strzone(vote);
455
456         // now we remove some things that could be misused
457         index = 0;
458         local float found;
459         found = FALSE;
460         local float votelength;
461         votelength = strlen(vote);
462         while(!found && index < votelength)
463         {
464                 local string badchar;
465                 badchar = substring(vote, index, 1);
466                 if(badchar == ";"
467                    || badchar == "\r"
468                    || badchar == "\n")
469                 {
470                         found = TRUE;
471                 } else {
472                         index++;
473                 }
474         }
475         return substring(vote, 0, index);
476 }
477
478 float VoteAllowed(string votecommand) {
479         tokenize(cvar_string("sv_vote_commands"));
480         local float index;
481         index = 0;
482         while(argv(index) != "") {
483                 local string allowed;
484                 allowed = argv(index);
485                 if(votecommand == allowed) {
486                         return TRUE;
487                 }
488                 index++;
489         }
490         return FALSE;
491 }
492
493 void VoteReset() {
494         local string searchclass;
495         searchclass = "player";
496
497         while (TRUE)
498         {
499                 local entity player;
500                 player = find(player, classname, searchclass);
501                 while(player)
502                 {
503                         player.vote_vote = 0;
504                         player = find(player, classname, searchclass);
505                 }
506
507                 if("player" == searchclass) {
508                         searchclass = "observer";
509                 } else if("observer" == searchclass) {
510                         searchclass = "spectator";
511                 } else {
512                         break;
513                 }
514         }
515
516         votecalled = FALSE;
517         votecalledmaster = FALSE;
518         votefinished = 0;
519 }
520
521 void VoteAccept() {
522         bprint(strcat("\{1}^2* ^3", votecaller.netname, "^2's vote for ^1", votecalledvote, "^2 was accepted\n"));
523         if(votecalledmaster)
524         {
525                 votecaller.vote_master = 1;
526         } else {
527                 localcmd(strcat(votecalledvote, "\n"));
528         }
529         votecaller.vote_next = 0; // people like your votes, no wait for next vote
530         VoteReset();
531 }
532
533 void VoteReject() {
534         bprint(strcat("\{1}^2* ^3", votecaller.netname, "^2's vote for ^1", votecalledvote, "^2 was rejected\n"));
535         VoteReset();
536 }
537
538 void VoteTimeout() {
539         bprint(strcat("\{1}^2* ^3", votecaller.netname, "^2's vote for ^1", votecalledvote, "^2 timed out\n"));
540         VoteReset();
541 }
542
543 void VoteStop(entity stopper) {
544         bprint(strcat("\{1}^2* ^3", stopper.netname, "^2 stopped ^3", votecaller.netname, "^2's vote\n"));
545         if(stopper == votecaller) {
546                 // no wait for next vote so you can correct your vote
547                 votecaller.vote_next = 0;
548         }
549         VoteReset();
550 }
551
552 void VoteCount() {
553         local float playercount;
554         playercount = 0;
555         local float yescount;
556         yescount = 0;
557         local float nocount;
558         nocount = 0;
559         local string searchclass;
560         searchclass = "player";
561
562         while (TRUE)
563         {
564                 local entity player;
565                 player = find(player, classname, searchclass);
566
567                 while(player)
568                 {
569                         if(clienttype(player) != CLIENTTYPE_BOT) {
570                                 if(player.vote_vote < 0) {
571                                         nocount++;
572                                 } else if(player.vote_vote > 0) {
573                                         yescount++;
574                                 }
575                                 playercount++;
576                         }
577                         player = find(player, classname, searchclass);
578                 }
579
580                 if("player" == searchclass) {
581                         searchclass = "observer";
582                 } else if("observer" == searchclass) {
583                         searchclass = "specator";
584                 } else {
585                         break;
586                 }
587         }
588
589         if((playercount == 1) && votecalledmaster) {
590                 // if only one player is on the server becoming vote
591                 // master is not allowed.  This could be used for
592                 // trolling or worse. 'self' is the user who has
593                 // called the vote because this function is called
594                 // by SV_ParseClientCommand. Maybe all voting should
595                 // be disabled for a single player?
596                 sprint(self, "^1You are the only player on this server so you can not become vote master.\n");
597                 votecaller.vote_next = 0;
598                 VoteReset();
599         } else if((playercount / 2) < yescount) { // vote accepted
600                 VoteAccept();
601         } else if((playercount / 2) < nocount) { // vote rejected
602                 VoteReject();
603         } else if(time > votefinished) { // vote timedout
604                 VoteTimeout();
605         } // else still running
606 }
607
608
609 void ReadyCount()
610 {
611         local entity e;
612         local float r, p;
613
614         e = find(world, classname, "player");
615
616         while(e)
617         {
618                 if(clienttype(e) == CLIENTTYPE_REAL)
619                 {
620                         p += 1;
621                         if(e.ready) r += 1;
622                 }
623                 e = find(e, classname, "player");
624         }
625
626         if(p && r == p)
627         {
628                 bprint("^1Server is restarting...\n");
629                 localcmd("restart\n");
630         }
631 }