diff options
author | kai <kai@zittrig.eu> | 2020-04-27 18:07:55 +0100 |
---|---|---|
committer | kai <kai@zittrig.eu> | 2020-04-27 18:27:11 +0100 |
commit | 063cb53e13516b0ba50890dea4d64e546d2bcde1 (patch) | |
tree | 4969871cedd7006e1a7db9936919f47bacb881c5 /src/game | |
parent | a2117f122609669ac14e4ed4fa7b6bca35db15c3 (diff) |
voting improvements
Diffstat (limited to 'src/game')
-rw-r--r-- | src/game/g_cmds.c | 20 | ||||
-rw-r--r-- | src/game/g_main.c | 16 |
2 files changed, 21 insertions, 15 deletions
diff --git a/src/game/g_cmds.c b/src/game/g_cmds.c index 7a07e4d..54f4eb4 100644 --- a/src/game/g_cmds.c +++ b/src/game/g_cmds.c @@ -2075,8 +2075,11 @@ void Cmd_CallVote_f( gentity_t *ent ) G_admin_adminlog_log( ent, "vote", NULL, 0, qtrue ); - trap_SendServerCommand( -1, va( "print \"%s" S_COLOR_WHITE + trap_SendServerCommand( -1, va( "print \"^3/callvote:^7 %s" S_COLOR_WHITE " called a vote: %s" S_COLOR_WHITE "\n\"", ent->client->pers.netname, level.voteDisplayString ) ); + + trap_SendServerCommand( -1, va( "cp \"%s" S_COLOR_WHITE + " called a vote:\n%s" S_COLOR_WHITE "\"", ent->client->pers.netname, level.voteDisplayString ) ); G_LogPrintf("Vote: %s^7 called a vote: %s^7\n", ent->client->pers.netname, level.voteDisplayString ); @@ -2158,8 +2161,6 @@ void Cmd_Vote_f( gentity_t *ent ) return; } - trap_SendServerCommand( ent-g_entities, "print \"Vote cast\n\"" ); - ent->client->ps.eFlags |= EF_VOTED; trap_Argv( 1, msg, sizeof( msg ) ); @@ -2168,11 +2169,13 @@ void Cmd_Vote_f( gentity_t *ent ) { level.voteYes++; trap_SetConfigstring( CS_VOTE_YES, va( "%i", level.voteYes ) ); + trap_SendServerCommand( ent-g_entities, "print \"^3/vote: ^7vote cast: ^ZYes\n\"" ); } else { level.voteNo++; trap_SetConfigstring( CS_VOTE_NO, va( "%i", level.voteNo ) ); + trap_SendServerCommand( ent-g_entities, "print \"^3/vote: ^7vote cast: ^ANo\n\"" ); } // a majority will be determined in G_CheckVote, which will also account @@ -2536,8 +2539,11 @@ void Cmd_CallTeamVote_f( gentity_t *ent ) if( level.clients[ i ].ps.stats[ STAT_PTEAM ] == team ) { - trap_SendServerCommand( i, va("print \"%s " S_COLOR_WHITE - "called a team vote: %s^7 \n\"", ent->client->pers.netname, level.teamVoteDisplayString[ cs_offset ] ) ); + trap_SendServerCommand( i, va("print \"^3/callteamvote:^7 %s " S_COLOR_WHITE + "called a ^5team ^7vote: %s^7 \n\"", ent->client->pers.netname, level.teamVoteDisplayString[ cs_offset ] ) ); + + trap_SendServerCommand( i, va("cp \"%s " S_COLOR_WHITE + "called a ^5team ^7vote:\n%s^7 \n\"", ent->client->pers.netname, level.teamVoteDisplayString[ cs_offset ] ) ); } else if( G_admin_permission( &g_entities[ i ], ADMF_ADMINCHAT ) && ( ( !Q_stricmp( arg1, "kick" ) || !Q_stricmp( arg1, "denybuild" ) ) || @@ -2607,8 +2613,6 @@ void Cmd_TeamVote_f( gentity_t *ent ) return; } - trap_SendServerCommand( ent-g_entities, "print \"Team vote cast\n\"" ); - ent->client->ps.eFlags |= EF_TEAMVOTED; trap_Argv( 1, msg, sizeof( msg ) ); @@ -2617,11 +2621,13 @@ void Cmd_TeamVote_f( gentity_t *ent ) { level.teamVoteYes[ cs_offset ]++; trap_SetConfigstring( CS_TEAMVOTE_YES + cs_offset, va( "%i", level.teamVoteYes[ cs_offset ] ) ); + trap_SendServerCommand( ent-g_entities, "print \"^3/teamvote: ^7vote cast: ^ZYes\n\"" ); } else { level.teamVoteNo[ cs_offset ]++; trap_SetConfigstring( CS_TEAMVOTE_NO + cs_offset, va( "%i", level.teamVoteNo[ cs_offset ] ) ); + trap_SendServerCommand( ent-g_entities, "print \"^3/teamvote: ^7vote cast: ^ANo\n\"" ); } // a majority will be determined in TeamCheckVote, which will also account diff --git a/src/game/g_main.c b/src/game/g_main.c index 8cdf049..9535288 100644 --- a/src/game/g_main.c +++ b/src/game/g_main.c @@ -2575,7 +2575,7 @@ void CheckVote( void ) if( voteYesPercent> votePassThreshold || level.voteNo == 0 ) { // execute the command, then remove the vote - trap_SendServerCommand( -1, va("print \"Vote passed (%d - %d)\n\"", + trap_SendServerCommand( -1, va("print \"Vote ^Zpassed ^7(^ZYes: ^7%d | ^ANo: ^7%d)\n\"", level.voteYes, level.voteNo ) ); G_LogPrintf( "Vote: Vote passed (%d-%d)\n", level.voteYes, level.voteNo ); level.voteExecuteTime = level.time + 3000; @@ -2583,7 +2583,7 @@ void CheckVote( void ) else { // same behavior as a timeout - trap_SendServerCommand( -1, va("print \"Vote failed (%d - %d)\n\"", + trap_SendServerCommand( -1, va("print \"Vote ^Afailed ^7(^ZYes: ^7%d | ^ANo: ^7%d)\n\"", level.voteYes, level.voteNo ) ); G_LogPrintf( "Vote: Vote failed (%d - %d)\n", level.voteYes, level.voteNo ); } @@ -2594,7 +2594,7 @@ void CheckVote( void ) ( (double) votePassThreshold/100.0 ) ) ) { // execute the command, then remove the vote - trap_SendServerCommand( -1, va("print \"Vote passed (%d - %d)\n\"", + trap_SendServerCommand( -1, va("print \"Vote ^Zpassed ^7(^ZYes: ^7%d | ^ANo: ^7%d)\n\"", level.voteYes, level.voteNo ) ); G_LogPrintf( "Vote: Vote passed (%d - %d)\n", level.voteYes, level.voteNo ); level.voteExecuteTime = level.time + 3000; @@ -2603,7 +2603,7 @@ void CheckVote( void ) ( (double) ( 100.0-votePassThreshold )/ 100.0 ) ) ) { // same behavior as a timeout - trap_SendServerCommand( -1, va("print \"Vote failed (%d - %d)\n\"", + trap_SendServerCommand( -1, va("print \"Vote ^Afailed ^7(^ZYes: ^7%d | ^ANo: ^7%d)\n\"", level.voteYes, level.voteNo ) ); G_LogPrintf("Vote failed\n"); } @@ -2644,12 +2644,12 @@ void CheckTeamVote( int team ) if( level.teamVoteYes[ cs_offset ] > level.teamVoteNo[ cs_offset ] && level.teamVoteYes[ cs_offset ] >= 2 ) { // execute the command, then remove the vote - trap_SendServerCommand( -1, va("print \"Team vote passed (%d - %d)\n\"", level.teamVoteYes[ cs_offset ], level.teamVoteNo[ cs_offset ] ) ); + trap_SendServerCommand( -1, va("print \"Team vote ^Zpassed ^7(^ZYes: ^7%d | ^ANo: ^7%d)\n\"", level.teamVoteYes[ cs_offset ], level.teamVoteNo[ cs_offset ] ) ); trap_SendConsoleCommand( EXEC_APPEND, va( "%s\n", level.teamVoteString[ cs_offset ] ) ); } else { - trap_SendServerCommand( -1, va("print \"Team vote failed (%d - %d)\n\"", level.teamVoteYes[ cs_offset ], level.teamVoteNo[ cs_offset ] ) ); + trap_SendServerCommand( -1, va("print \"Team vote ^Afailed ^7(^ZYes: ^7%d | ^ANo: ^7%d)\n\"", level.teamVoteYes[ cs_offset ], level.teamVoteNo[ cs_offset ] ) ); G_LogPrintf( "Teamvote: Team vote failed (%d - %d)\n", level.teamVoteYes[ cs_offset ], level.teamVoteNo[ cs_offset ] ); } } @@ -2658,7 +2658,7 @@ void CheckTeamVote( int team ) if( level.teamVoteYes[ cs_offset ] > level.numteamVotingClients[ cs_offset ] / 2 ) { // execute the command, then remove the vote - trap_SendServerCommand( -1, va("print \"Team vote passed (%d - %d)\n\"", level.teamVoteYes[ cs_offset ], level.teamVoteNo[ cs_offset ] ) ); + trap_SendServerCommand( -1, va("print \"Team vote ^Zpassed ^7(^ZYes: ^7%d | ^ANo: ^7%d)\n\"", level.teamVoteYes[ cs_offset ], level.teamVoteNo[ cs_offset ] ) ); G_LogPrintf( "Teamvote: Team vote passed (%d - %d)\n", level.teamVoteYes[ cs_offset ], level.teamVoteNo[ cs_offset ] ); // trap_SendConsoleCommand( EXEC_APPEND, va( "%s\n", level.teamVoteString[ cs_offset ] ) ); @@ -2666,7 +2666,7 @@ void CheckTeamVote( int team ) else if( level.teamVoteNo[ cs_offset ] >= level.numteamVotingClients[ cs_offset ] / 2 ) { // same behavior as a timeout - trap_SendServerCommand( -1, va("print \"Team vote failed (%d - %d)\n\"", level.teamVoteYes[ cs_offset ], level.teamVoteNo[ cs_offset ] ) ); + trap_SendServerCommand( -1, va("print \"Team vote ^Afailed ^7(^ZYes: ^7%d | ^ANo: ^7%d)\n\"", level.teamVoteYes[ cs_offset ], level.teamVoteNo[ cs_offset ] ) ); G_LogPrintf( "Teamvote: Team vote failed (%d - %d)\n", level.teamVoteYes[ cs_offset ], level.teamVoteNo[ cs_offset ] ); } else |