Skip to content

Commit

Permalink
Fixed load queries going through map changes
Browse files Browse the repository at this point in the history
  • Loading branch information
azalty authored and nuclearsilo583 committed Feb 2, 2023
1 parent 652123c commit 8c120cf
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
6 changes: 3 additions & 3 deletions addons/sourcemod/scripting/store/sql.sp
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down Expand Up @@ -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];
Expand Down Expand Up @@ -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];
Expand Down
11 changes: 4 additions & 7 deletions addons/sourcemod/scripting/store_combine.sp
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down Expand Up @@ -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];
Expand Down Expand Up @@ -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];
Expand Down Expand Up @@ -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);

Expand Down

0 comments on commit 8c120cf

Please sign in to comment.