entWatch: Rework loading command, its instant now.
Care with using it during rounds xP
This commit is contained in:
parent
27ce245081
commit
aae20ad6bf
@ -17,8 +17,8 @@
|
|||||||
|
|
||||||
/* BOOLS */
|
/* BOOLS */
|
||||||
bool g_bLate;
|
bool g_bLate;
|
||||||
|
bool g_bLoaded;
|
||||||
bool g_bIntermission;
|
bool g_bIntermission;
|
||||||
bool g_bConfigLoadPending;
|
|
||||||
|
|
||||||
/* ARRAYS */
|
/* ARRAYS */
|
||||||
ArrayList g_hArray_Items;
|
ArrayList g_hArray_Items;
|
||||||
@ -102,16 +102,16 @@ public void OnPluginStart()
|
|||||||
//----------------------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------------------
|
||||||
public Action Command_ReloadConfig(int client, int args)
|
public Action Command_ReloadConfig(int client, int args)
|
||||||
{
|
{
|
||||||
g_bConfigLoadPending = !g_bConfigLoadPending;
|
g_bLoaded = LoadConfig();
|
||||||
|
|
||||||
if (!g_bConfigLoadPending)
|
if (g_bLoaded)
|
||||||
{
|
{
|
||||||
CReplyToCommand(client, "\x07%s[entWatch] \x07%sPending config load cancelled.", "E01B5D", "F16767");
|
CReplyToCommand(client, "\x07%s[entWatch] \x07%Config load successfull.", "E01B5D", "F16767");
|
||||||
return Plugin_Handled;
|
return Plugin_Handled;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CReplyToCommand(client, "\x07%s[entWatch] \x07%sConfig reload is now pending. (Performed on round start.)", "E01B5D", "F16767");
|
CReplyToCommand(client, "\x07%s[entWatch] \x07%Config load failed!", "E01B5D", "F16767");
|
||||||
return Plugin_Handled;
|
return Plugin_Handled;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -121,13 +121,13 @@ public Action Command_ReloadConfig(int client, int args)
|
|||||||
//----------------------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------------------
|
||||||
public void OnMapStart()
|
public void OnMapStart()
|
||||||
{
|
{
|
||||||
LoadConfig();
|
g_bLoaded = LoadConfig();
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------------------
|
||||||
// Purpose:
|
// Purpose:
|
||||||
//----------------------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------------------
|
||||||
stock void LoadConfig()
|
stock bool LoadConfig()
|
||||||
{
|
{
|
||||||
g_hArray_Items.Clear();
|
g_hArray_Items.Clear();
|
||||||
g_hArray_Configs.Clear();
|
g_hArray_Configs.Clear();
|
||||||
@ -151,7 +151,7 @@ stock void LoadConfig()
|
|||||||
LogMessage("Unable to load config \"%s\"!", sFilePathOverride);
|
LogMessage("Unable to load config \"%s\"!", sFilePathOverride);
|
||||||
|
|
||||||
delete hConfig;
|
delete hConfig;
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
else LogMessage("Loaded config \"%s\"", sFilePathOverride);
|
else LogMessage("Loaded config \"%s\"", sFilePathOverride);
|
||||||
}
|
}
|
||||||
@ -162,13 +162,11 @@ stock void LoadConfig()
|
|||||||
LogMessage("Unable to load config \"%s\"!", sFilePathDefault);
|
LogMessage("Unable to load config \"%s\"!", sFilePathDefault);
|
||||||
|
|
||||||
delete hConfig;
|
delete hConfig;
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
else LogMessage("Loaded config \"%s\"", sFilePathDefault);
|
else LogMessage("Loaded config \"%s\"", sFilePathDefault);
|
||||||
}
|
}
|
||||||
|
|
||||||
g_bConfigLoadPending = false;
|
|
||||||
|
|
||||||
if (hConfig.GotoFirstSubKey())
|
if (hConfig.GotoFirstSubKey())
|
||||||
{
|
{
|
||||||
int iConfigID;
|
int iConfigID;
|
||||||
@ -213,7 +211,7 @@ stock void LoadConfig()
|
|||||||
}
|
}
|
||||||
|
|
||||||
delete hConfig;
|
delete hConfig;
|
||||||
return;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------------------
|
||||||
@ -229,10 +227,8 @@ public void OnRoundStart(Event hEvent, const char[] sEvent, bool bDontBroadcast)
|
|||||||
//----------------------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------------------
|
||||||
public void OnRoundEnd(Event hEvent, const char[] sEvent, bool bDontBroadcast)
|
public void OnRoundEnd(Event hEvent, const char[] sEvent, bool bDontBroadcast)
|
||||||
{
|
{
|
||||||
if (g_hArray_Items.Length && !g_bConfigLoadPending)
|
if (g_hArray_Items.Length)
|
||||||
g_hArray_Items.Clear();
|
g_hArray_Items.Clear();
|
||||||
else
|
|
||||||
LoadConfig();
|
|
||||||
|
|
||||||
g_bIntermission = true;
|
g_bIntermission = true;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user