should be fixed for good now
This commit is contained in:
parent
735acbd3e5
commit
475d1a09fa
@ -18,7 +18,7 @@ char g_cSpecialMapStart[g_dLength];
|
||||
char g_cSpecialMapEnd[g_dLength];
|
||||
static char g_sConfigzones[PLATFORM_MAX_PATH];
|
||||
float g_fStartTime[MAXPLAYERS + 1];
|
||||
char g_csTime_record[MAXPLAYERS + 1];
|
||||
char g_csTime_record[MAXPLAYERS + 1][64];
|
||||
float g_fClientVectors[MAXPLAYERS + 1][3];
|
||||
int g_iClientFrames[MAXPLAYERS + 1];
|
||||
int g_iClientSpeedInterval[MAXPLAYERS + 1];
|
||||
@ -48,7 +48,6 @@ public Plugin myinfo =
|
||||
public void OnPluginStart()
|
||||
{
|
||||
//cmds
|
||||
AutoExecConfig();
|
||||
RegConsoleCmd("sm_toptime", cmd_timerCheckTop, "checking top 10");
|
||||
RegConsoleCmd("sm_mytime", cmd_timerCheckSelf, "checking your personal time");
|
||||
RegConsoleCmd("sm_stages", cmd_timerCheckStage, "Checking race stages");
|
||||
@ -63,19 +62,11 @@ public void OnPluginStart()
|
||||
for (int i = MaxClients; i > 0; --i)
|
||||
{
|
||||
if (!AreClientCookiesCached(i))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
OnClientCookiesCached(i);
|
||||
}
|
||||
}
|
||||
|
||||
public void OnConfigsExecuted()
|
||||
{
|
||||
Database.Connect(SQL_OnDatabaseConnect, "racetimercss");
|
||||
}
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
@ -100,28 +91,20 @@ public void SQL_OnConnectFinished(Database db, DBResultSet results, const char[]
|
||||
LogError("Database error: %s", error);
|
||||
return;
|
||||
}
|
||||
OnMapStart();
|
||||
for(int i = 1; i <= MaxClients; i++)
|
||||
OnClientPostAdminCheck(i);
|
||||
}
|
||||
static Handle hHostName;
|
||||
if((hHostName = FindConVar("hostname")) == INVALID_HANDLE)
|
||||
return;
|
||||
char line[g_dLength];
|
||||
GetConVarString(hHostName, line, sizeof(line));
|
||||
if (StrContains(line, "EVENT", false) > -1)
|
||||
g_bEventBool = true;
|
||||
g_bDisplaySpecial = unloze_gBSpecialMapDisplay();
|
||||
GetCurrentMap(g_cMapname, sizeof(g_cMapname));
|
||||
startTimer();
|
||||
|
||||
public void SQL_OnQueryCompleted(Database db, DBResultSet results, const char[] error, DataPack data)
|
||||
{
|
||||
ResetPack(data);
|
||||
int client_serial = data.ReadCell();
|
||||
if (!db || strlen(error))
|
||||
{
|
||||
char sQuery[g_dLength];
|
||||
data.ReadString(sQuery, sizeof(sQuery));
|
||||
LogError("Query error 1: %s", error);
|
||||
LogError("actual query: %s", sQuery);
|
||||
return;
|
||||
}
|
||||
int client;
|
||||
if ((client = GetClientFromSerial(client_serial)) == 0)
|
||||
return;
|
||||
if (results.RowCount && results.FetchRow())
|
||||
results.FetchString(0, g_csTime_record[client], sizeof(g_csTime_record));
|
||||
for(int i = 1; i <= MaxClients; i++)
|
||||
if (IsValidClient(i))
|
||||
OnClientPostAdminCheck(i);
|
||||
}
|
||||
|
||||
public void MYSQLCheckMapEntry()
|
||||
@ -167,16 +150,7 @@ public void SQL_FinishedQuery(Database db, DBResultSet results, const char[] err
|
||||
|
||||
public void OnMapStart()
|
||||
{
|
||||
static Handle hHostName;
|
||||
if((hHostName = FindConVar("hostname")) == INVALID_HANDLE)
|
||||
return;
|
||||
char line[g_dLength];
|
||||
GetConVarString(hHostName, line, sizeof(line));
|
||||
if (StrContains(line, "EVENT", false) > -1)
|
||||
g_bEventBool = true;
|
||||
g_bDisplaySpecial = unloze_gBSpecialMapDisplay();
|
||||
GetCurrentMap(g_cMapname, sizeof(g_cMapname));
|
||||
startTimer();
|
||||
Database.Connect(SQL_OnDatabaseConnect, "racetimercss");
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
@ -527,8 +501,6 @@ public void FinishedStageRaceZone(int client)
|
||||
}
|
||||
|
||||
int l_iZoneCount = unloze_zoneCount();
|
||||
char record_client[32];
|
||||
Format(record_client, sizeof(record_client), g_csTime_record[client]);
|
||||
float client_time = client_current_race_time(client);
|
||||
char sTime[32];
|
||||
FormatPlayerTime(client_time, sTime, sizeof(sTime), false, 1);
|
||||
@ -542,7 +514,7 @@ public void FinishedStageRaceZone(int client)
|
||||
else
|
||||
Format(sQuery, sizeof(sQuery), "UPDATE `zetimer_table` SET `%sS%i` = '%s', name = '%s' WHERE steam_auth = '%s' and LENGTH(`%sS%i`) >= LENGTH('%s') and STRCMP(`%sS%i`, '%s') > 0", g_cMapname, stage, sTime, sEscapedName, sSID, g_cMapname, stage, sTime, g_cMapname, stage, sTime);
|
||||
|
||||
if (StrEqual(record_client, "0.000"))
|
||||
if (StrEqual(g_csTime_record[client], "0.000"))
|
||||
{
|
||||
CPrintToChat(client, "Your record: None yet\nCommand: !toptime !mytime !stages");
|
||||
if (l_iZoneCount < 2)
|
||||
@ -551,7 +523,7 @@ public void FinishedStageRaceZone(int client)
|
||||
Format(sQuery, sizeof(sQuery), "UPDATE `zetimer_table` SET `%sS%i` = '%s', name = '%s' WHERE steam_auth = '%s'", g_cMapname, stage, sTime, sEscapedName, sSID);
|
||||
}
|
||||
else
|
||||
CPrintToChat(client, "Your record: %s\nCommand: !toptime !mytime !stages", record_client);
|
||||
CPrintToChat(client, "Your record: %s\nCommand: !toptime !mytime !stages", g_csTime_record[client]);
|
||||
DataPack hDataPack = new DataPack();
|
||||
hDataPack.WriteString(sQuery);
|
||||
g_dDatabase.Query(SQL_FinishedQuery, sQuery, hDataPack, DBPrio_High);
|
||||
@ -574,6 +546,25 @@ public void mysql_get_player_time(int client, int stage)
|
||||
g_dDatabase.Query(SQL_OnQueryCompleted, query, hDataPack);
|
||||
}
|
||||
|
||||
public void SQL_OnQueryCompleted(Database db, DBResultSet results, const char[] error, DataPack data)
|
||||
{
|
||||
ResetPack(data);
|
||||
int client_serial = data.ReadCell();
|
||||
if (!db || strlen(error))
|
||||
{
|
||||
char sQuery[g_dLength];
|
||||
data.ReadString(sQuery, sizeof(sQuery));
|
||||
LogError("Query error 1: %s", error);
|
||||
LogError("actual query: %s", sQuery);
|
||||
return;
|
||||
}
|
||||
int client;
|
||||
if ((client = GetClientFromSerial(client_serial)) == 0)
|
||||
return;
|
||||
if (results.RowCount && results.FetchRow())
|
||||
results.FetchString(0, g_csTime_record[client], sizeof(g_csTime_record[]));
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
// Purpose: TODO implement if needed
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
@ -911,7 +902,7 @@ public void SQL_CheckSelf(Database db, DBResultSet results, const char[] error,
|
||||
return;
|
||||
}
|
||||
Format(l_cMessageContent, sizeof(l_cMessageContent), "%s - %s", sTime, l_cPlayerName);
|
||||
CPrintToChat(iclient, "Your best time: 0%s", l_cMessageContent);
|
||||
CPrintToChat(iclient, "Your best time: %s", l_cMessageContent);
|
||||
}
|
||||
else
|
||||
CPrintToChat(iclient, "You have no time yet!");
|
||||
|
Loading…
Reference in New Issue
Block a user