]> icculus.org git repositories - divverent/nexuiz.git/blob - data/qcsrc/server/vote.qc
allow separate cvars for voter and master commands; make voting defaults more conserv...
[divverent/nexuiz.git] / data / qcsrc / server / vote.qc
1 float VoteCheckNasty(string cmd)
2 {
3         if(strstrofs(cmd, ";", 0) >= 0)
4                 return TRUE;
5         if(strstrofs(cmd, "\n", 0) >= 0)
6                 return TRUE;
7         if(strstrofs(cmd, "\r", 0) >= 0)
8                 return TRUE;
9         if(strstrofs(cmd, "$", 0) >= 0)
10                 return TRUE;
11         return FALSE;
12 }
13
14 entity GetKickVoteVictim(string vote, string cmd, entity caller)
15 {
16         float tokens;
17         float n, t;
18         string ns;
19         entity e;
20
21         tokens = tokenize_sane(vote);
22         ns = "";
23
24         if(tokens >= 2)
25                 if(substring(argv(1), 0, 1) == "#")
26                 {
27                         ns = substring(argv(1), 1, 999);
28                         t = 2;
29                 }
30
31         if(tokens >= 3)
32                 if(argv(1) == "#")
33                 {
34                         ns = argv(2);
35                         t = 3;
36                 }
37
38         if(ns != "")
39         {
40                 if(t < tokens)
41                         GetKickVoteVictim_reason = substring(vote, argv_start_index(t), argv_end_index(-1) - argv_start_index(t));
42                 else
43                         GetKickVoteVictim_reason = "";
44
45                 n = stof(ns);
46                 if(ns == ftos(n)) if(n >= 1) if(n <= maxclients)
47                 {
48                         e = edict_num(n);
49                         if(clienttype(e) == CLIENTTYPE_REAL)
50                         {
51                                 GetKickVoteVictim_newcommand = strcat(argv(0), " # ", ns);
52                                 return e;
53                         }
54                 }
55         }
56
57         print_to(caller, strcat("Usage: ", cmd, " ", argv(0), " #playernumber (as in \"status\")\n"));
58         return world;
59 }
60
61 string RemapVote_display;
62 string RemapVote_vote;
63 float RemapVote(string vote, string cmd, entity e)
64 {
65         float vote_argc;
66         entity victim;
67         vote_argc = tokenize_sane(vote);
68
69         if(!VoteAllowed(argv(0), cmd))
70         {
71                 return FALSE;
72         }
73
74         // VoteAllowed tokenizes!
75         vote_argc = tokenize_sane(vote);
76
77         // remap chmap to gotomap (forces intermission)
78         if(vote_argc < 2)
79                 if(argv(0) == "chmap" || argv(0) == "gotomap" || argv(0) == "kick" || argv(0) == "kickban") // won't work without arguments
80                         return FALSE;
81         if(argv(0) == "chmap")
82         {
83                 vote = strcat("gotomap ", substring(vote, argv_start_index(1), argv_end_index(-1) - argv_start_index(1)));
84                 vote_argc = tokenize_sane(vote);
85         }
86         if(argv(0) == "gotomap")
87         {
88                 if(!(vote = ValidateMap(substring(vote, argv_start_index(1), argv_end_index(-1) - argv_start_index(1)), e)))
89                         return FALSE;
90                 vote = strcat("gotomap ", vote);
91                 vote_argc = tokenize_sane(vote); // ValidateMap may have done some stuff to it
92         }
93
94         // make kick and kickban votes a bit nicer (and reject them if formatted badly)
95         if(argv(0) == "kick" || argv(0) == "kickban")
96         {
97                 if(!(victim = GetKickVoteVictim(vote, cmd, e)))
98                         return FALSE;
99                 RemapVote_vote = GetKickVoteVictim_newcommand;
100                 RemapVote_display = strcat("^1", RemapVote_vote, " (^7", victim.netname, "^1): ", GetKickVoteVictim_reason);
101         }
102         else
103         {
104                 RemapVote_vote = vote;
105                 RemapVote_display = strzone(strcat("^1", vote));
106         }
107
108         return TRUE;
109 }
110
111 float GameCommand_Vote(string s, entity e) {
112         float argc;
113         argc = tokenize_sane(s);
114         if(argv(0) == "help") {
115                 print_to(e, "  vote COMMANDS ARGUMENTS. See 'vote help' for more info.");
116                 return TRUE;
117         } else if(argv(0) == "vote") {
118                 if(argv(1) == "") {
119                         print_to(e, "^1You have to supply a vote command. See help for more info.");
120                 } else if(argv(1) == "help") {
121                         VoteHelp(e);
122                 } else if(argv(1) == "status") {
123                         if(votecalled) {
124                                 print_to(e, strcat("^7Vote for ", votecalledvote_display, "^7 called by ^7", VoteNetname(votecaller), "^7."));
125                         } else {
126                                 print_to(e, "^1No vote called.");
127                         }
128                 } else if(argv(1) == "call") {
129                         if(!e || cvar("sv_vote_call")) {
130                                 if(cvar("sv_vote_nospectators") && e.classname != "player") {
131                                         print_to(e, "^1Error: Only players can call a vote."); // TODO invent a cvar name for allowing votes by spectators during warmup anyway
132                                 }
133                                 else if(timeoutStatus) { //don't allow a vote call during a timeout
134                                         print_to(e, "^1Error: You can not call a vote while a timeout is active.");
135                                 }
136                                 else if(votecalled) {
137                                         print_to(e, "^1There is already a vote called.");
138                                 } else {
139                                         local string vote;
140                                         vote = VoteParse(s, argc);
141                                         if(vote == "") {
142                                                 print_to(e, "^1Your vote is empty. See help for more info.");
143                                         } else if(e
144                                                 && time < e.vote_next) {
145                                                         print_to(e, strcat("^1You have to wait ^2", ftos(e.vote_next - time), "^1 seconds before you can again call a vote."));
146                                         } else if(VoteCheckNasty(vote)) {
147                                                 print_to(e, "Syntax error in command. See help for more info.");
148                                         } else if(RemapVote(vote, "vcall", e)) {
149                                                 votecalledvote = strzone(RemapVote_vote);
150                                                 votecalledvote_display = strzone(RemapVote_display);
151                                                 votecalled = TRUE;
152                                                 votecalledmaster = FALSE;
153                                                 votefinished = time + cvar("sv_vote_timeout");
154                                                 votecaller = e; // remember who called the vote
155                                                 if(e) {
156                                                         e.vote_vote = 1; // of course you vote yes
157                                                         e.vote_next = time + cvar("sv_vote_wait");
158                                                 }
159                                                 bprint("\{1}^2* ^3", VoteNetname(votecaller), "^2 calls a vote for ", votecalledvote_display, "\n");
160                                                 if(cvar("sv_eventlog"))
161                                                         GameLogEcho(strcat(":vote:vcall:", ftos(votecaller.playerid), ":", votecalledvote_display));
162                                                 VoteCount(); // needed if you are the only one
163                                                 Nagger_VoteChanged();
164                                         } else {
165                                                 print_to(e, "^1This vote is not ok. See help for more info.");
166                                         }
167                                 }
168                         } else {
169                                 print_to(e, "^1Vote calling is NOT allowed.");
170                         }
171                 } else if(argv(1) == "stop") {
172                         if(!votecalled) {
173                                 print_to(e, "^1No vote called.");
174                         } else if(e == votecaller) { // the votecaller can stop a vote
175                                 VoteStop(e);
176                         } else if(!e) { // server admin / console can too
177                                 VoteStop(e);
178                         } else if(e.vote_master) { // masters can too
179                                 VoteStop(e);
180                         } else {
181                                 print_to(e, "^1You are not allowed to stop that Vote.");
182                         }
183                 } else if(argv(1) == "master") {
184                         if(cvar("sv_vote_master")) {
185                                 if(votecalled) {
186                                         print_to(e, "^1There is already a vote called.");
187                                 } else {
188                                         votecalled = TRUE;
189                                         votecalledmaster = TRUE;
190                                         votecalledvote = strzone("XXX");
191                                         votecalledvote_display = strzone("^3master");
192                                         votefinished = time + cvar("sv_vote_timeout");
193                                         votecaller = e; // remember who called the vote
194                                         if(e) {
195                                                 e.vote_vote = 1; // of course you vote yes
196                                                 e.vote_next = time + cvar("sv_vote_wait");
197                                         }
198                                         bprint("\{1}^2* ^3", VoteNetname(votecaller), "^2 calls a vote to become ^3master^2.\n");
199                                         if(cvar("sv_eventlog"))
200                                                 GameLogEcho(strcat(":vote:vcall:", ftos(votecaller.playerid), ":", votecalledvote_display));
201                                         VoteCount(); // needed if you are the only one
202                                         Nagger_VoteChanged();
203                                 }
204                         } else {
205                                 print_to(e, "^1Vote to become master is NOT allowed.");
206                         }
207                 } else if(argv(1) == "do") {
208                         if(!e || e.vote_master) {
209                                 local string dovote;
210                                 dovote = VoteParse(s, argc);
211                                 if(dovote == "") {
212                                         print_to(e, "^1Your command was empty. See help for more info.");
213                                 } else if(VoteCheckNasty(dovote)) {
214                                         print_to(e, "Syntax error in command. See help for more info.");
215                                 } else if(RemapVote(dovote, "vdo", e)) { // strcat seems to be necessary
216                                         bprint("\{1}^2* ^3", VoteNetname(e), "^2 used his ^3master^2 status to do \"^2", RemapVote_display, "^2\".\n");
217                                         if(cvar("sv_eventlog"))
218                                                 GameLogEcho(strcat(":vote:vdo:", ftos(e.playerid), ":", RemapVote_display));
219                                         localcmd(strcat(RemapVote_vote, "\n"));
220                                 } else {
221                                         print_to(e, "^1This command is not ok. See help for more info.");
222                                 }
223                         } else {
224                                 print_to(e, "^1You are NOT a master.  You might need to login or vote to become master first. See help for more info.");
225                         }
226                 } else if(argv(1) == "login") {
227                         local string masterpwd;
228                         masterpwd = cvar_string("sv_vote_master_password");
229                         if(masterpwd != "") {
230                                 local float granted;
231                                 granted = (masterpwd == argv(2));
232                                 if (e)
233                                         e.vote_master = granted;
234                                 if(granted) {
235                                         print("Accepted master login from ", VoteNetname(e), "\n");
236                                         bprint("\{1}^2* ^3", VoteNetname(e), "^2 logged in as ^3master^2\n");
237                                         if(cvar("sv_eventlog"))
238                                                 GameLogEcho(strcat(":vote:vlogin:", ftos(e.playerid)));
239                                 }
240                                 else
241                                         print("REJECTED master login from ", VoteNetname(e), "\n");
242                         }
243                         else
244                                 print_to(e, "^1Login to become master is NOT allowed.");
245                 } else if(argv(1) == "yes") {
246                         if(!votecalled) {
247                                 print_to(e, "^1No vote called.");
248                         } else if (!e) {
249                                 print_to(e, "^1You can't vote from the server console.");
250                         } else if(e.vote_vote == 0
251                                   || cvar("sv_vote_change")) {
252                                 print_to(e, "^1You accepted the vote.");
253                                 e.vote_vote = 1;
254                                 centerprint_expire(e, CENTERPRIO_VOTE);
255                                 if(!cvar("sv_vote_singlecount")) {
256                                         VoteCount();
257                                 }
258                         } else {
259                                 print_to(e, "^1You have already voted.");
260                         }
261                 } else if(argv(1) == "no") {
262                         if(!votecalled) {
263                                 print_to(e, "^1No vote called.");
264                         } else if (!e) {
265                                 print_to(e, "^1You can't vote from the server console.");
266                         } else if(e.vote_vote == 0
267                                   || cvar("sv_vote_change")) {
268                                 print_to(e, "^1You rejected the vote.");
269                                 e.vote_vote = -1;
270                                 centerprint_expire(e, CENTERPRIO_VOTE);
271                                 if(!cvar("sv_vote_singlecount")) {
272                                         VoteCount();
273                                 }
274                         } else {
275                                 print_to(e, "^1You have already voted.");
276                         }
277                 } else if(argv(1) == "abstain" || argv(1) == "dontcare") {
278                         if(!votecalled) {
279                                 print_to(e, "^1No vote called.");
280                         } else if (!e) {
281                                 print_to(e, "^1You can't vote from the server console.");
282                         } else if(e.vote_vote == 0
283                                   || cvar("sv_vote_change")) {
284                                 print_to(e, "^1You abstained from your vote.");
285                                 e.vote_vote = -2;
286                                 centerprint_expire(e, CENTERPRIO_VOTE);
287                                 if(!cvar("sv_vote_singlecount")) {
288                                         VoteCount();
289                                 }
290                         } else {
291                                 print_to(e, "^1You have already voted.");
292                         }
293                 } else {
294                         // ignore this?
295                         print_to(e, "^1Unknown vote command.");
296                 }
297                 return TRUE;
298         }
299         return FALSE;
300 }
301
302 void VoteHelp(entity e) {
303         local string vmasterdis;
304         if(!cvar("sv_vote_master")) {
305                 vmasterdis = " ^1(disabled)";
306         }
307
308         local string vlogindis;
309         if("" == cvar_string("sv_vote_master_password")) {
310                 vlogindis = " ^1(disabled)";
311         }
312
313         local string vcalldis;
314         if(!cvar("sv_vote_call")) {
315                 vcalldis = " ^1(disabled)";
316         }
317
318         print_to(e, "^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 login^7\" \"^2cmd vote do ^3COMMAND ARGUMENTS^7\" \"^2cmd vote yes^7\" \"^2cmd vote no^7\" \"^2cmd vote abstain^7\" \"^2cmd vote dontcare^7\".");
319         print_to(e, "^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\" \"^2vlogin^7\" \"^2vdo ^3COMMAND ARGUMENTS^7\" \"^2vyes^7\" \"^2vno^7\" \"^2abstain^7\" \"^2vdontcare^7\".");
320         print_to(e, "^7\"^2help^7\" shows this info.");
321         print_to(e, "^7\"^2status^7\" shows if there is a vote called and who called it.");
322         print_to(e, strcat("^7\"^2call^7\" is used to call a vote. See the list of allowed commands.", vcalldis, "^7"));
323         print_to(e, "^7\"^2stop^7\" can be used by the vote caller or an admin to stop a vote and maybe correct it.");
324         print_to(e, strcat("^7\"^2master^7\" call a vote to become master who can execute commands without a vote", vmasterdis, "^7"));
325         print_to(e, strcat("^7\"^2login^7\" login to become master who can execute commands without a vote.", vlogindis, "^7"));
326         print_to(e, "^7\"^2do^7\" executes a command if you are a master. See the list of allowed commands.");
327         print_to(e, "^7\"^2yes^7\", \"^2no^7\", \"^2abstain^7\" and \"^2dontcare^7\" to make your vote.");
328         print_to(e, "^7If enough of the players vote yes the vote is accepted.");
329         print_to(e, "^7If enough of the players vote no the vote is rejected.");
330         print_to(e, strcat("^7If neither the vote will timeout after ", cvar_string("sv_vote_timeout"), "^7 seconds."));
331         print_to(e, "^7You can call a vote for or execute these commands:");
332         print_to(e, strcat("^3", cvar_string("sv_vote_commands"), "^7 and maybe further ^3arguments^7"));
333 }
334
335 string VoteNetname(entity e)
336 {
337         if(e) {
338                 return e.netname;
339         } else {
340                 if(cvar_string("sv_adminnick") != "") {
341                         return cvar_string("sv_adminnick");
342                 } else {
343                         return cvar_string("hostname");
344                 }
345         }
346 }
347
348 string ValidateMap(string m, entity e)
349 {
350         m = MapInfo_FixName(m);
351         if(!m)
352         {
353                 print_to(e, "This map is not available on this server.");
354                 return string_null;
355         }
356         if(!cvar("sv_vote_override_mostrecent"))
357                 if(Map_IsRecent(m))
358                 {
359                         print_to(e, "This server does not allow for recent maps to be played again. Please be patient for some rounds.");
360                         return string_null;
361                 }
362         if(!MapInfo_CheckMap(m))
363         {
364                 print_to(e, strcat("^1Invalid mapname, \"^3", m, "^1\" does not support the current game mode."));
365                 return string_null;
366         }
367
368         return m;
369 }
370
371
372 void VoteThink() {
373         if(votefinished > 0) // a vote was called
374         if(time > votefinished) // time is up
375         {
376                 VoteCount();
377         }
378 }
379
380 string VoteParse(string all, float argc) {
381         if(argc < 3)
382                 return "";
383         return substring(all, argv_start_index(2), argv_end_index(-1) - argv_start_index(2));
384 }
385
386 float VoteAllowed(string votecommand, string cmd) {
387         local float index;
388
389         tokenize_sane(cvar_string("sv_vote_commands"));
390         index = 0;
391         while(argv(index) != "") {
392                 if(votecommand == argv(index)) {
393                         return TRUE;
394                 }
395                 ++index;
396         }
397
398         if(cmd == "vdo")
399                 tokenize_sane(cvar_string("sv_vote_master_commands"));
400         else
401                 tokenize_sane(cvar_string("sv_vote_only_commands"));
402         index = 0;
403         while(argv(index) != "") {
404                 if(votecommand == argv(index)) {
405                         return TRUE;
406                 }
407                 ++index;
408         }
409
410         return FALSE;
411 }
412
413 void VoteReset() {
414         local entity player;
415
416         FOR_EACH_CLIENT(player)
417         {
418                 player.vote_vote = 0;
419                 centerprint_expire(player, CENTERPRIO_VOTE);
420         }
421
422         if(votecalled)
423         {
424                 strunzone(votecalledvote);
425                 strunzone(votecalledvote_display);
426         }
427
428         votecalled = FALSE;
429         votecalledmaster = FALSE;
430         votefinished = 0;
431         Nagger_VoteChanged();
432 }
433
434 void VoteAccept() {
435         bprint("\{1}^2* ^3", VoteNetname(votecaller), "^2's vote for ^1", votecalledvote_display, "^2 was accepted\n");
436         if(votecalledmaster)
437         {
438                 if(votecaller) {
439                         votecaller.vote_master = 1;
440                 }
441         } else {
442                 localcmd(strcat(votecalledvote, "\n"));
443         }
444         if(votecaller) {
445                 votecaller.vote_next = 0; // people like your votes,
446                                           // no wait for next vote
447         }
448         VoteReset();
449 }
450
451 void VoteReject() {
452         bprint("\{1}^2* ^3", VoteNetname(votecaller), "^2's vote for ", votecalledvote_display, "^2 was rejected\n");
453         VoteReset();
454 }
455
456 void VoteTimeout() {
457         bprint("\{1}^2* ^3", VoteNetname(votecaller), "^2's vote for ", votecalledvote_display, "^2 timed out\n");
458         VoteReset();
459 }
460
461 void VoteStop(entity stopper) {
462         bprint("\{1}^2* ^3", VoteNetname(stopper), "^2 stopped ^3", VoteNetname(votecaller), "^2's vote\n");
463         if(cvar("sv_eventlog"))
464                 GameLogEcho(strcat(":vote:vstop:", ftos(stopper.playerid)));
465         if(stopper == votecaller) {
466                 // no wait for next vote so you can correct your vote
467                 if(votecaller) {
468                         votecaller.vote_next = 0;
469                 }
470         }
471         VoteReset();
472 }
473
474 void VoteSpam(float yescount, float nocount, float abstaincount, float notvoters, float mincount, string result)
475 {
476         string s;
477         if(mincount >= 0)
478         {
479                 s = strcat("\{1}^2* vote results: ^1", ftos(yescount), "^2:^1");
480                 s = strcat(s, ftos(nocount), "^2 (^1");
481                 s = strcat(s, ftos(mincount), "^2 needed), ^1");
482                 s = strcat(s, ftos(abstaincount), "^2 didn't care, ^1");
483                 s = strcat(s, ftos(notvoters), "^2 didn't vote\n");
484         }
485         else
486         {
487                 s = strcat("\{1}^2* vote results: ^1", ftos(yescount), "^2:^1");
488                 s = strcat(s, ftos(nocount), "^2, ^1");
489                 s = strcat(s, ftos(abstaincount), "^2 didn't care, ^1");
490                 s = strcat(s, ftos(notvoters), "^2 didn't have to vote\n");
491         }
492         bprint(s);
493         if(cvar("sv_eventlog"))
494         {
495                 s = strcat(":vote:v", result, ":", ftos(yescount));
496                 s = strcat(s, ":", ftos(nocount));
497                 s = strcat(s, ":", ftos(abstaincount));
498                 s = strcat(s, ":", ftos(notvoters));
499                 s = strcat(s, ":", ftos(mincount));
500                 GameLogEcho(s);
501         }
502 }
503
504 void VoteCount() {
505         local float playercount;
506         playercount = 0;
507         local float yescount;
508         yescount = 0;
509         local float nocount;
510         nocount = 0;
511         local float abstaincount;
512         abstaincount = 0;
513         local entity player;
514         //same for real players
515         local float realplayercount;
516         local float realplayeryescount;
517         local float realplayernocount;
518         local float realplayerabstaincount;
519         realplayercount = realplayernocount = realplayerabstaincount = realplayeryescount = 0;
520
521         FOR_EACH_REALCLIENT(player)
522         {
523                 if(player.vote_vote == -1) {
524                         ++nocount;
525                 } else if(player.vote_vote == 1) {
526                         ++yescount;
527                 } else if(player.vote_vote == -2) {
528                         ++abstaincount;
529                 }
530                 ++playercount;
531                 //do the same for real players
532                 if(player.classname == "player") {
533                         if(player.vote_vote == -1) {
534                                 ++realplayernocount;
535                         } else if(player.vote_vote == 1) {
536                                 ++realplayeryescount;
537                         } else if(player.vote_vote == -2) {
538                                 ++realplayerabstaincount;
539                         }
540                         ++realplayercount;
541                 }
542         }
543
544         //in tournament mode, if we have at least one player then don't make the vote dependent on spectators (so specs don't have to press F1)
545         if(cvar("sv_vote_nospectators"))
546         if(realplayercount > 0) {
547                 yescount = realplayeryescount;
548                 nocount = realplayernocount;
549                 abstaincount = realplayerabstaincount;
550                 playercount = realplayercount;
551         }
552
553
554         if(votecalledmaster
555            && playercount == 1) {
556                 // if only one player is on the server becoming vote
557                 // master is not allowed.  This could be used for
558                 // trolling or worse. 'self' is the user who has
559                 // called the vote because this function is called
560                 // by SV_ParseClientCommand. Maybe all voting should
561                 // be disabled for a single player?
562                 print_to(votecaller, "^1You are the only player on this server so you can not become vote master.");
563                 if(votecaller) {
564                         votecaller.vote_next = 0;
565                 }
566                 VoteReset();
567         } else {
568                 float votefactor, simplevotefactor;
569                 votefactor = bound(0.5, cvar("sv_vote_majority_factor"), 0.999);
570                 simplevotefactor = cvar("sv_vote_simple_majority_factor");
571                 if(yescount > (playercount - abstaincount) * votefactor)
572                 {
573                         VoteSpam(yescount, nocount, abstaincount, playercount - yescount - nocount - abstaincount, -1, "yes");
574                         VoteAccept();
575                 }
576                 else if(nocount >= (playercount - abstaincount) * (1 - votefactor)) // that means, yescount cannot reach minyes any more
577                 {
578                         VoteSpam(yescount, nocount, abstaincount, playercount - yescount - nocount - abstaincount, -1, "no");
579                         VoteReject();
580                 }
581                 else if(time > votefinished)
582                 {
583                         if(simplevotefactor)
584                         {
585                                 string result;
586                                 simplevotefactor = bound(votefactor, simplevotefactor, 0.999);
587                                 if(yescount > (yescount + nocount) * simplevotefactor)
588                                         result = "yes";
589                                 else if(yescount + nocount > 0)
590                                         result = "no";
591                                 else
592                                         result = "timeout";
593                                 VoteSpam(yescount, nocount, abstaincount, playercount - yescount - nocount - abstaincount, floor((yescount + nocount) * votefactor) + 1, result);
594                                 if(result == "yes")
595                                         VoteAccept();
596                                 else if(result == "no")
597                                         VoteReject();
598                                 else
599                                         VoteTimeout();
600                         }
601                         else
602                         {
603                                 VoteSpam(yescount, nocount, abstaincount, playercount - yescount - nocount - abstaincount, floor((playercount - abstaincount) * votefactor) + 1, "timeout");
604                                 VoteTimeout();
605                         }
606                 }
607         }
608
609         Nagger_VoteCountChanged();
610 }