go back a level before getting key

This commit is contained in:
oldcustard 2023-03-02 01:06:56 +11:00
parent 71c90a9270
commit 7e13d71b0b

View File

@ -1,70 +1,70 @@
#include <sourcemod> #include <sourcemod>
#include <tf2_stocks> #include <tf2_stocks>
#include <morecolors> #include <morecolors>
// ^ tf2_stocks.inc itself includes sdktools.inc and tf2.inc // ^ tf2_stocks.inc itself includes sdktools.inc and tf2.inc
#pragma semicolon 1 #pragma semicolon 1
#pragma newdecls required #pragma newdecls required
#define PLUGIN_VERSION "0.1" #define PLUGIN_VERSION "0.1"
public Plugin myinfo = public Plugin myinfo =
{ {
name = "Config Reminder", name = "Config Reminder",
author = "Rhizome", author = "Rhizome",
description = "Hassles users until they exec", description = "Hassles users until they exec",
version = PLUGIN_VERSION, version = PLUGIN_VERSION,
url = "https://rhizome.tf" url = "https://rhizome.tf"
}; };
public APLRes AskPluginLoad2(Handle myself, bool late, char[] error, int err_max) public APLRes AskPluginLoad2(Handle myself, bool late, char[] error, int err_max)
{ {
// No need for the old GetGameFolderName setup. // No need for the old GetGameFolderName setup.
EngineVersion g_engineversion = GetEngineVersion(); EngineVersion g_engineversion = GetEngineVersion();
if (g_engineversion != Engine_TF2) if (g_engineversion != Engine_TF2)
{ {
SetFailState("This plugin was made for use with Team Fortress 2 only."); SetFailState("This plugin was made for use with Team Fortress 2 only.");
} }
} }
public void OnPluginStart() public void OnPluginStart()
{ {
/** /**
* @note For the love of god, please stop using FCVAR_PLUGIN. * @note For the love of god, please stop using FCVAR_PLUGIN.
* Console.inc even explains this above the entry for the FCVAR_PLUGIN define. * Console.inc even explains this above the entry for the FCVAR_PLUGIN define.
* "No logic using this flag ever existed in a released game. It only ever appeared in the first hl2sdk." * "No logic using this flag ever existed in a released game. It only ever appeared in the first hl2sdk."
*/ */
CreateConVar("sm_pluginnamehere_version", PLUGIN_VERSION, "Standard plugin version ConVar. Please don't change me!", FCVAR_REPLICATED|FCVAR_NOTIFY|FCVAR_DONTRECORD); CreateConVar("sm_pluginnamehere_version", PLUGIN_VERSION, "Standard plugin version ConVar. Please don't change me!", FCVAR_REPLICATED|FCVAR_NOTIFY|FCVAR_DONTRECORD);
} }
public void OnMapStart() public void OnMapStart()
{ {
/** /**
* @note Precache your models, sounds, etc. here! * @note Precache your models, sounds, etc. here!
* Not in OnConfigsExecuted! Doing so leads to issues. * Not in OnConfigsExecuted! Doing so leads to issues.
*/ */
CreateTimer(15.0, PostReminder, 0, TIMER_REPEAT); CreateTimer(15.0, PostReminder, 0, TIMER_REPEAT);
HookEvent("teamplay_restart_round", BlockStart, EventHookMode_Pre); HookEvent("teamplay_restart_round", BlockStart, EventHookMode_Pre);
char config_name[64]; char config_name[64];
LoadConfig(config_name, sizeof(config_name)); LoadConfig(config_name, sizeof(config_name));
} }
Action PostReminder(Handle timer, any data) Action PostReminder(Handle timer, any data)
{ {
CPrintToChatAll("{red}No config is applied! Ensure config is applied before starting."); CPrintToChatAll("{red}No config is applied! Ensure config is applied before starting.");
return Plugin_Handled; return Plugin_Handled;
} }
Action BlockStart(Event event, const char[] name, bool dontBroadcast) Action BlockStart(Event event, const char[] name, bool dontBroadcast)
{ {
ServerCommand("mp_tournament_restart"); ServerCommand("mp_tournament_restart");
CPrintToChatAll("{red}Bad rollout! {default}(Did you forget to exec?)"); CPrintToChatAll("{red}Bad rollout! {default}(Did you forget to exec?)");
return Plugin_Handled; return Plugin_Handled;
} }
bool LoadConfig(char[] config_name, int maxlength) bool LoadConfig(char[] config_name, int maxlength)
{ {
char current_map[64]; char current_map[64];
GetCurrentMap(current_map, sizeof(current_map)); GetCurrentMap(current_map, sizeof(current_map));
@ -103,6 +103,7 @@ bool LoadConfig(char[] config_name, int maxlength)
if (StrContains(current_map, current_key, false) != -1) if (StrContains(current_map, current_key, false) != -1)
{ {
map_configs.GoBack()
map_configs.GetString(current_key, config_name, maxlength); map_configs.GetString(current_key, config_name, maxlength);
PrintToServer("[AUTOCONFIG] Found applicable config: %s", config_name); PrintToServer("[AUTOCONFIG] Found applicable config: %s", config_name);
return true; return true;