Skip to content

Commit

Permalink
Add translation for !extend & update m_iRoundTime | Feat/extensionqol (
Browse files Browse the repository at this point in the history
…#1172)

* Add extension translation

* Set currents coreboard roundtime
  • Loading branch information
MSWS authored Sep 15, 2022
1 parent a1a1c6a commit f4cd4e9
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
21 changes: 19 additions & 2 deletions addons/sourcemod/scripting/shavit-timelimit.sp
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,15 @@ bool gB_BlockRoundEndEvent = false;
bool gB_AlternateZeroPrint = false;
Handle gH_Timer = null;
EngineVersion gEV_Type = Engine_Unknown;
chatstrings_t gS_ChatStrings;

Handle gH_Forwards_OnCountdownStart = null;

// table prefix
char gS_MySQLPrefix[32];

bool gB_Late = false;

public Plugin myinfo =
{
name = "[shavit] Dynamic Timelimits",
Expand All @@ -84,6 +87,12 @@ public Plugin myinfo =
url = "https://github.com/shavitush/bhoptimer"
}

public APLRes AskPluginLoad2(Handle plugin, bool late, char[] error, int maxlength)
{
gB_Late = late;
return APLRes_Success;
}

public void OnPluginStart()
{
gEV_Type = GetEngineVersion();
Expand Down Expand Up @@ -132,6 +141,9 @@ public void OnPluginStart()

GetTimerSQLPrefix(gS_MySQLPrefix, 32);
gH_SQL = GetTimerDatabaseHandle();

if(gB_Late)
Shavit_OnChatConfigLoaded();
}

public void OnMapStart()
Expand Down Expand Up @@ -209,6 +221,11 @@ public void OnConfigsExecuted()
}
}

public void Shavit_OnChatConfigLoaded()
{
Shavit_GetChatStringsStruct(gS_ChatStrings);
}

void StartCalculating()
{
char sMap[PLATFORM_MAX_PATH];
Expand Down Expand Up @@ -292,6 +309,7 @@ void SetLimit(int time)
if(mp_roundtime != null)
{
mp_roundtime.IntValue = time;
GameRules_SetProp("m_iRoundTime", time * 60);
}
}

Expand Down Expand Up @@ -454,7 +472,6 @@ public Action Command_Extend(int client, int args)
}

ExtendMapTimeLimit(extendtime);
Shavit_PrintToChatAll("%N extended the map by %d minutes", client, extendtime / 60);

Shavit_PrintToChatAll("%T", "Extended", LANG_SERVER, gS_ChatStrings.sVariable2, client, gS_ChatStrings.sText, gS_ChatStrings.sVariable, extendtime / 60, gS_ChatStrings.sText);
return Plugin_Handled;
}
5 changes: 5 additions & 0 deletions addons/sourcemod/translations/shavit-common.phrases.txt
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,11 @@
"#format" "{1:s}"
"en" "{1} seconds remaining."
}
"Extended"
{
"#format" "{1:s},{2:N},{3:s},{4:s},{5:d},{6:s}"
"en" "{1}{2}{3} extended the map by {4}{5}{6} minutes."
}
// ----------- Random ----------- //
"TimerLoading"
{
Expand Down

0 comments on commit f4cd4e9

Please sign in to comment.