moved db connection again to try and finally avoid invalid db handles
This commit is contained in:
parent
49469c6b56
commit
de116bb1da
@ -48,6 +48,7 @@ public Plugin myinfo =
|
|||||||
public void OnPluginStart()
|
public void OnPluginStart()
|
||||||
{
|
{
|
||||||
//cmds
|
//cmds
|
||||||
|
AutoExecConfig();
|
||||||
RegConsoleCmd("sm_toptime", cmd_timerCheckTop, "checking top 10");
|
RegConsoleCmd("sm_toptime", cmd_timerCheckTop, "checking top 10");
|
||||||
RegConsoleCmd("sm_mytime", cmd_timerCheckSelf, "checking your personal time");
|
RegConsoleCmd("sm_mytime", cmd_timerCheckSelf, "checking your personal time");
|
||||||
RegConsoleCmd("sm_stages", cmd_timerCheckStage, "Checking race stages");
|
RegConsoleCmd("sm_stages", cmd_timerCheckStage, "Checking race stages");
|
||||||
@ -66,11 +67,15 @@ public void OnPluginStart()
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
OnClientCookiesCached(i);
|
OnClientCookiesCached(i);
|
||||||
OnClientPostAdminCheck(i);
|
|
||||||
}
|
}
|
||||||
OnMapStart();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void OnConfigsExecuted()
|
||||||
|
{
|
||||||
|
Database.Connect(SQL_OnDatabaseConnect, "racetimercss");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------------------
|
||||||
// Purpose:
|
// Purpose:
|
||||||
//----------------------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------------------
|
||||||
@ -86,10 +91,6 @@ public void SQL_OnDatabaseConnect(Database db, const char[] error, any data)
|
|||||||
char sQuery[g_dLength];
|
char sQuery[g_dLength];
|
||||||
Format(sQuery, sizeof(sQuery), "CREATE TABLE IF NOT EXISTS `zetimer_table` (`steam_auth` VARCHAR(254) NOT NULL, `name` VARCHAR(254) NOT NULL, PRIMARY KEY (`steam_auth`))");
|
Format(sQuery, sizeof(sQuery), "CREATE TABLE IF NOT EXISTS `zetimer_table` (`steam_auth` VARCHAR(254) NOT NULL, `name` VARCHAR(254) NOT NULL, PRIMARY KEY (`steam_auth`))");
|
||||||
g_dDatabase.Query(SQL_OnConnectFinished, sQuery, _, DBPrio_High);
|
g_dDatabase.Query(SQL_OnConnectFinished, sQuery, _, DBPrio_High);
|
||||||
|
|
||||||
g_bDisplaySpecial = unloze_gBSpecialMapDisplay();
|
|
||||||
GetCurrentMap(g_cMapname, sizeof(g_cMapname));
|
|
||||||
startTimer();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SQL_OnConnectFinished(Database db, DBResultSet results, const char[] error, any data)
|
public void SQL_OnConnectFinished(Database db, DBResultSet results, const char[] error, any data)
|
||||||
@ -99,8 +100,9 @@ public void SQL_OnConnectFinished(Database db, DBResultSet results, const char[]
|
|||||||
LogError("Database error: %s", error);
|
LogError("Database error: %s", error);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
OnMapStart();
|
||||||
for(int i = 1; i <= MaxClients; i++)
|
for(int i = 1; i <= MaxClients; i++)
|
||||||
OnClientPostAdminCheck(i);
|
OnClientPostAdminCheck(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SQL_OnQueryCompleted(Database db, DBResultSet results, const char[] error, DataPack data)
|
public void SQL_OnQueryCompleted(Database db, DBResultSet results, const char[] error, DataPack data)
|
||||||
@ -167,14 +169,14 @@ public void OnMapStart()
|
|||||||
{
|
{
|
||||||
static Handle hHostName;
|
static Handle hHostName;
|
||||||
if((hHostName = FindConVar("hostname")) == INVALID_HANDLE)
|
if((hHostName = FindConVar("hostname")) == INVALID_HANDLE)
|
||||||
{
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
char line[g_dLength];
|
char line[g_dLength];
|
||||||
GetConVarString(hHostName, line, sizeof(line));
|
GetConVarString(hHostName, line, sizeof(line));
|
||||||
if (StrContains(line, "EVENT", false) > -1)
|
if (StrContains(line, "EVENT", false) > -1)
|
||||||
g_bEventBool = true;
|
g_bEventBool = true;
|
||||||
Database.Connect(SQL_OnDatabaseConnect, "racetimercss");
|
g_bDisplaySpecial = unloze_gBSpecialMapDisplay();
|
||||||
|
GetCurrentMap(g_cMapname, sizeof(g_cMapname));
|
||||||
|
startTimer();
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------------------
|
||||||
|
Loading…
Reference in New Issue
Block a user