Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add g_callvote_usercooldowntime cvar #394

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions source/game/g_callvotes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ cvar_t *g_callvote_electtime; // in seconds
cvar_t *g_callvote_enabled;
cvar_t *g_callvote_maxchanges;
cvar_t *g_callvote_cooldowntime;
cvar_t *g_callvote_usercooldowntime;

enum
{
Expand Down Expand Up @@ -2183,6 +2184,7 @@ static void G_CallVotes_CheckState( void )
G_AnnouncerSound( NULL, trap_SoundIndex( va( S_ANNOUNCER_CALLVOTE_FAILED_1_to_2, ( rand()&1 )+1 ) ), GS_MAX_TEAMS, true, NULL );
G_PrintMsg( NULL, "Vote %s%s%s failed\n", S_COLOR_YELLOW,
G_CallVotes_String( &callvoteState.vote ), S_COLOR_WHITE );
callvoteState.vote.caller->r.client->lastFailedCallvoteTime = game.realtime;
G_CallVotes_Reset( true );
return;
}
Expand Down Expand Up @@ -2409,6 +2411,12 @@ static void G_CallVote( edict_t *ent, bool isopcall )
return;
}

// user cooldown as opposed to global cooldown
if ( !isopcall && ent->r.client->lastFailedCallvoteTime + g_callvote_usercooldowntime->integer * 1000 > game.realtime ) {
G_PrintMsg( ent, "%sYou can not call a vote right now\n", S_COLOR_RED );
return;
}

//we got a valid type. Get the parameters if any
if( callvote->expectedargs != trap_Cmd_Argc()-2 )
{
Expand Down Expand Up @@ -2677,6 +2685,7 @@ void G_CallVotes_Init( void )
g_callvote_enabled = trap_Cvar_Get( "g_vote_allowed", "1", CVAR_ARCHIVE );
g_callvote_maxchanges = trap_Cvar_Get( "g_vote_maxchanges", "3", CVAR_ARCHIVE );
g_callvote_cooldowntime = trap_Cvar_Get( "g_vote_cooldowntime", "5", CVAR_ARCHIVE );
g_callvote_usercooldowntime = trap_Cvar_Get( "g_vote_usercooldowntime", "30", CVAR_ARCHIVE );

// register all callvotes

Expand Down
1 change: 1 addition & 0 deletions source/game/g_local.h
Original file line number Diff line number Diff line change
Expand Up @@ -1243,6 +1243,7 @@ struct gclient_s
bool isoperator;
unsigned int queueTimeStamp;
int muted; // fallback if steam auth is disabled. see SV_FilterSteamID
int lastFailedCallvoteTime;

usercmd_t ucmd;
int timeDelta; // time offset to adjust for shots collision (antilag)
Expand Down
Loading