Skip to content

Commit

Permalink
Veto message implementation (splewis#123)
Browse files Browse the repository at this point in the history
Veto message implementation

* Fix missing variable in translation
  • Loading branch information
Technoblazed authored and splewis committed Mar 19, 2017
1 parent 3be2200 commit 48fa7b2
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 2 deletions.
3 changes: 3 additions & 0 deletions scripting/get5.sp
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ ConVar g_StopCommandEnabledCvar;
ConVar g_TeamTimeToKnifeDecisionCvar;
ConVar g_TeamTimeToStartCvar;
ConVar g_TimeFormatCvar;
ConVar g_VetoCountdown;
ConVar g_WarmupCfgCvar;

// Autoset convars (not meant for users to set)
Expand Down Expand Up @@ -276,6 +277,8 @@ public void OnPluginStart() {
g_TimeFormatCvar = CreateConVar(
"get5_time_format", "%Y-%m-%d_%H",
"Time format to use when creating file names. Don't tweak this unless you know what you're doing! Avoid using spaces or colons.");
g_VetoCountdown =
CreateConVar("get5_veto_countdown", "5", "Seconds to countdown before veto process commences. Set to \"0\" to disable.");
g_WarmupCfgCvar =
CreateConVar("get5_warmup_cfg", "get5/warmup.cfg", "Config file to exec in warmup periods");

Expand Down
19 changes: 17 additions & 2 deletions scripting/get5/mapveto.sp
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,23 @@ public void CreateVeto() {
g_VetoCaptains[MatchTeam_Team1] = GetTeamCaptain(MatchTeam_Team1);
g_VetoCaptains[MatchTeam_Team2] = GetTeamCaptain(MatchTeam_Team2);
ResetReadyStatus();
MatchTeam startingTeam = OtherMatchTeam(g_LastVetoTeam);
VetoController(g_VetoCaptains[startingTeam]);
CreateTimer(1.0, Timer_VetoCountdown, _, TIMER_REPEAT);
}

public Action Timer_VetoCountdown(Handle timer) {
static int warningsPrinted = 0;
int secondsRemaining = g_VetoCountdown.IntValue;
if (warningsPrinted >= g_VetoCountdown.IntValue) {
warningsPrinted = 0;
MatchTeam startingTeam = OtherMatchTeam(g_LastVetoTeam);
VetoController(g_VetoCaptains[startingTeam]);
return Plugin_Stop;
} else {
warningsPrinted++;
secondsRemaining = secondsRemaining - warningsPrinted;
Get5_MessageToAll("%t", "VetoCountdown", secondsRemaining);
return Plugin_Continue;
}
}

static void AbortVeto() {
Expand Down
5 changes: 5 additions & 0 deletions translations/get5.phrases.txt
Original file line number Diff line number Diff line change
Expand Up @@ -330,4 +330,9 @@
"#format" "{1:s}"
"en" "Select a side for {1}"
}
"VetoCountdown"
{
"#format" "{1:i}"
"en" "Veto commencing in {GREEN}{1} {NORMAL}seconds."
}
}

0 comments on commit 48fa7b2

Please sign in to comment.