From 8c120cf9a18a9333bd27839d28bb5006875c4242 Mon Sep 17 00:00:00 2001 From: azalty <36737524+azalty@users.noreply.github.com> Date: Mon, 23 Jan 2023 15:56:02 +0100 Subject: [PATCH] Fixed load queries going through map changes --- addons/sourcemod/scripting/store/sql.sp | 6 +++--- addons/sourcemod/scripting/store_combine.sp | 11 ++++------- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/addons/sourcemod/scripting/store/sql.sp b/addons/sourcemod/scripting/store/sql.sp index 3e17c34..6be5dad 100644 --- a/addons/sourcemod/scripting/store/sql.sp +++ b/addons/sourcemod/scripting/store/sql.sp @@ -170,7 +170,7 @@ public void SQLCallback_LoadClientInventory_Credits(Handle owner, Handle hndl, c else { int client = GetClientOfUserId(userid); - if(!client) + if (!client || !IsClientInGame(client)) return; char m_szQuery[256]; @@ -226,7 +226,7 @@ public void SQLCallback_LoadClientInventory_Items(Handle owner, Handle hndl, con else { int client = GetClientOfUserId(userid); - if(!client) + if (!client || !IsClientInGame(client)) return; char m_szQuery[256]; @@ -280,7 +280,7 @@ public void SQLCallback_LoadClientInventory_Equipment(Handle owner, Handle hndl, else { int client = GetClientOfUserId(userid); - if(!client) + if (!client || !IsClientInGame(client)) return; char m_szUniqueId[PLATFORM_MAX_PATH]; diff --git a/addons/sourcemod/scripting/store_combine.sp b/addons/sourcemod/scripting/store_combine.sp index 1fe04b4..e6257fa 100644 --- a/addons/sourcemod/scripting/store_combine.sp +++ b/addons/sourcemod/scripting/store_combine.sp @@ -3596,7 +3596,7 @@ public void SQLCallback_LoadClientInventory_Credits(Handle owner, Handle hndl, c else { int client = GetClientOfUserId(userid); - if(!client) + if (!client || !IsClientInGame(client)) return; char m_szQuery[256]; @@ -3652,7 +3652,7 @@ public void SQLCallback_LoadClientInventory_Items(Handle owner, Handle hndl, con else { int client = GetClientOfUserId(userid); - if(!client) + if (!client || !IsClientInGame(client)) return; char m_szQuery[256]; @@ -3706,7 +3706,7 @@ public void SQLCallback_LoadClientInventory_Equipment(Handle owner, Handle hndl, else { int client = GetClientOfUserId(userid); - if(!client) + if (!client || !IsClientInGame(client)) return; char m_szUniqueId[PLATFORM_MAX_PATH]; @@ -4092,10 +4092,7 @@ public void Store_SellItem(int client,int itemid) g_eClients[client].iCredits += m_iCredits; //Chat(client, "%t", "Chat Sold Item", g_eItems[itemid].szName, g_eTypeHandlers[g_eItems[itemid].iHandler].szType); - if (IsClientInGame(client)) // Prevents a rare error case where a restricted item would be auto-sold during a map change - { - CPrintToChat(client, "%s%t", g_sChatPrefix, "Chat Sold Item", g_eItems[itemid].szName, g_eTypeHandlers[g_eItems[itemid].iHandler].szType); - } + CPrintToChat(client, "%s%t", g_sChatPrefix, "Chat Sold Item", g_eItems[itemid].szName, g_eTypeHandlers[g_eItems[itemid].iHandler].szType); Store_UnequipItem(client, itemid);