]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/command/vote.qc
If there aren't any players at all and there is a vote called, don't automatically...
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / command / vote.qc
index 277720369bef3465542d76bb3650f97761e74885..0fd9a199cb5ab7412a64fc95a988b4d10c0e6faa 100644 (file)
@@ -250,8 +250,15 @@ void VoteCount()
        vote_factor_of_voted = bound(0.5, autocvar_sv_vote_majority_factor_of_voted, 0.999);
        vote_needed_of_voted = floor((vote_accept_count + vote_reject_count) * vote_factor_of_voted) + 1;
        
+       // are there any players at all on the server? it could be an admin vote
+       if(vote_player_count == 0)
+       {
+               VoteSpam(0, -1, "yes"); // no players at all, just accept it 
+               VoteAccept();
+               return;
+       }
        
-       // finally calculate the result of the vote     
+       // since there ARE players, finally calculate the result of the vote    
        if(vote_accept_count >= vote_needed_overall)
        {
                VoteSpam(notvoters, -1, "yes"); // there is enough acceptions to pass the vote
@@ -696,7 +703,7 @@ void VoteCommand_master(float request, entity caller, float argc, string vote_co
                                                
                                                if not(caller.vote_master) { print_to(caller, "^1You do not have vote master privelages."); }
                                                else if not(VoteCommand_checknasty(vote_command)) { print_to(caller, "^1Syntax error in command, see 'vhelp' for more info."); }
-                                               else if not(VoteCommand_parse(caller, vote_command, autocvar_sv_vote_master_commands, 3, argc)) { print_to(caller, "^1This command is not acceptable, see 'vhelp' for more info."); }
+                                               else if not(VoteCommand_parse(caller, vote_command, strcat(autocvar_sv_vote_commands, " ", autocvar_sv_vote_master_commands), 3, argc)) { print_to(caller, "^1This command is not acceptable, see 'vhelp' for more info."); }
                                                
                                                else // everything went okay, proceed with command
                                                {
@@ -728,8 +735,13 @@ void VoteCommand_master(float request, entity caller, float argc, string vote_co
                                        
                                        default: // calling a vote for master
                                        {
+                                               float spectators_allowed = ((autocvar_sv_vote_nospectators != 2) 
+                                                       || ((autocvar_sv_vote_nospectators == 1) && inWarmupStage) 
+                                                       || (autocvar_sv_vote_nospectators == 0));
+                                               
                                                if not(autocvar_sv_vote_master_callable) { print_to(caller, "^1Vote to become vote master is not allowed."); }
                                                else if(vote_called) { print_to(caller, "^1There is already a vote called."); }
+                                               else if(!spectators_allowed && (caller && (caller.classname != "player"))) { print_to(caller, "^1Only players can call a vote."); }
                                                else if(timeout_status) { print_to(caller, "^1You can not call a vote while a timeout is active."); }
                                                
                                                else // everything went okay, continue with creating vote
@@ -923,7 +935,7 @@ void VoteCommand_macro_help(entity caller, float argc)
        
        if(argc == 2) // help display listing all commands
        {
-               print("\nVoting commands:\n");
+               print_to(caller, "\nVoting commands:\n");
                #define VOTE_COMMAND(name,function,description,assignment) \
                        { if(Votecommand_check_assignment(caller, assignment)) { print_to(caller, strcat("  ^2", name, "^7: ", description)); } }