Compare commits

...

3 Commits
v1.0 ... master

Author SHA1 Message Date
Oldcustard
b787c2ec63 add oneshot blocking feature 2023-07-15 15:59:09 +10:00
Oldcustard
8ba8dd3398 reduce message frequency 2023-03-08 17:38:43 +11:00
Oldcustard
df14ed2165 changed timer frequency and clean up 2023-03-06 23:16:29 +11:00

View File

@ -6,10 +6,11 @@
#pragma semicolon 1
#pragma newdecls required
#define PLUGIN_VERSION "1.0"
#define PLUGIN_VERSION "1.1"
ConVar g_cvarConfigName;
bool g_bConfigLoaded = false;
bool g_bBlocked = false;
Handle g_reminder_timer;
public Plugin myinfo =
@ -51,7 +52,7 @@ public void OnMapStart()
* @note Precache your models, sounds, etc. here!
* Not in OnConfigsExecuted! Doing so leads to issues.
*/
g_reminder_timer = CreateTimer(15.0, PostReminder, 0, TIMER_REPEAT);
g_reminder_timer = CreateTimer(60.0, PostReminder, 0, TIMER_REPEAT);
char config_name[64];
LoadConfig(config_name, sizeof(config_name));
@ -72,6 +73,7 @@ public void OnMapEnd()
{
KillTimer(g_reminder_timer);
g_bConfigLoaded = false;
g_bBlocked = false;
g_cvarConfigName.SetString("NULL");
PrintToServer("[AUTOCONFIG] Config Loaded FALSE");
PrintToServer("[AUTOCONFIG] Blocking Match Start");
@ -95,13 +97,17 @@ Action PostReminder(Handle timer, any data)
Action BlockStart(Event event, const char[] name, bool dontBroadcast)
{
if (g_bConfigLoaded)
if (g_bConfigLoaded || g_bBlocked)
{
KillTimer(g_reminder_timer);
PrintToServer("[AUTOCONFIG] Match started, going silent.");
return Plugin_Continue;
}
g_bBlocked = true;
ServerCommand("mp_tournament_restart");
CPrintToChatAll("{yellow}Bad rollout! {default}(Did you forget to exec?)");
CPrintToChatAll("{default} RUP again to ignore warning");
PrintToServer("[AUTOCONFIG] Match start blocked due to no config");
return Plugin_Handled;
}