summaryrefslogtreecommitdiff
path: root/sourcemod/scripting/gokz-localdb/db/save_time.sp
diff options
context:
space:
mode:
authoraura <nw@moneybot.cc>2026-02-17 23:42:09 +0100
committeraura <nw@moneybot.cc>2026-02-17 23:42:09 +0100
commit5e2eb7d67ae933b7566f1944d0bb7744da03d586 (patch)
tree054acff1113270a9cd07933df760f3768c1b6853 /sourcemod/scripting/gokz-localdb/db/save_time.sp
parent341db13a008dc12bb22ceb50452d93d01476308c (diff)
move source stuff to its own folder
Diffstat (limited to 'sourcemod/scripting/gokz-localdb/db/save_time.sp')
-rw-r--r--sourcemod/scripting/gokz-localdb/db/save_time.sp83
1 files changed, 0 insertions, 83 deletions
diff --git a/sourcemod/scripting/gokz-localdb/db/save_time.sp b/sourcemod/scripting/gokz-localdb/db/save_time.sp
deleted file mode 100644
index 84589a5..0000000
--- a/sourcemod/scripting/gokz-localdb/db/save_time.sp
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- Inserts the player's time into the database.
-*/
-
-
-
-void DB_SaveTime(int client, int course, int mode, int style, float runTime, int teleportsUsed)
-{
- if (IsFakeClient(client))
- {
- return;
- }
-
- char query[1024];
- int steamID = GetSteamAccountID(client);
- int mapID = GOKZ_DB_GetCurrentMapID();
- int runTimeMS = GOKZ_DB_TimeFloatToInt(runTime);
-
- DataPack data = new DataPack();
- data.WriteCell(GetClientUserId(client));
- data.WriteCell(steamID);
- data.WriteCell(mapID);
- data.WriteCell(course);
- data.WriteCell(mode);
- data.WriteCell(style);
- data.WriteCell(runTimeMS);
- data.WriteCell(teleportsUsed);
-
- Transaction txn = SQL_CreateTransaction();
-
- // Save runTime to DB
- FormatEx(query, sizeof(query), sql_times_insert, steamID, mode, style, runTimeMS, teleportsUsed, mapID, course);
- txn.AddQuery(query);
-
- SQL_ExecuteTransaction(gH_DB, txn, DB_TxnSuccess_SaveTime, DB_TxnFailure_Generic_DataPack, data, DBPrio_Normal);
-}
-
-public void DB_TxnSuccess_SaveTime(Handle db, DataPack data, int numQueries, Handle[] results, any[] queryData)
-{
- data.Reset();
- int client = GetClientOfUserId(data.ReadCell());
- int steamID = data.ReadCell();
- int mapID = data.ReadCell();
- int course = data.ReadCell();
- int mode = data.ReadCell();
- int style = data.ReadCell();
- int runTimeMS = data.ReadCell();
- int teleportsUsed = data.ReadCell();
- delete data;
-
- if (!IsValidClient(client))
- {
- return;
- }
-
- Call_OnTimeInserted(client, steamID, mapID, course, mode, style, runTimeMS, teleportsUsed);
-}
-
-public void DB_DeleteTime(int client, int timeID)
-{
- DataPack data = new DataPack();
- data.WriteCell(client == 0 ? -1 : GetClientUserId(client)); // -1 if called from server console
- data.WriteCell(timeID);
-
- char query[1024];
- FormatEx(query, sizeof(query), sql_times_delete, timeID);
-
- Transaction txn = SQL_CreateTransaction();
- txn.AddQuery(query);
-
- SQL_ExecuteTransaction(gH_DB, txn, DB_TxnSuccess_TimeDeleted, DB_TxnFailure_Generic_DataPack, data, DBPrio_Low);
-}
-
-public void DB_TxnSuccess_TimeDeleted(Handle db, DataPack data, int numQueries, Handle[] results, any[] queryData)
-{
- data.Reset();
- int client = GetClientOfUserId(data.ReadCell());
- int timeID = data.ReadCell();
- delete data;
-
- GOKZ_PrintToChatAndLog(client, true, "%t", "Time Deleted",
- timeID);
-}