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