Skip to content

Commit

Permalink
Small improvements to OnConfigExecuted
Browse files Browse the repository at this point in the history
  • Loading branch information
azalty authored and nuclearsilo583 committed Aug 6, 2022
1 parent 5776364 commit c29ea28
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 19 deletions.
13 changes: 4 additions & 9 deletions addons/sourcemod/scripting/store_item_cpsupport.sp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public Plugin myinfo =
name = "Store - Chat Processor item module with Scoreboard Tag",
author = "nuclear silo, Mesharsky, AiDN™",
description = "Chat Processor item module by nuclear silo, the Scoreboard Tag for Zephyrus's by Mesharksy, for nuclear silo's edited store by AiDN™",
version = "2.7",
version = "2.8",
url = ""
};

Expand Down Expand Up @@ -213,18 +213,13 @@ public Action Command_TGS(int client, int args)
}

public void Store_OnConfigExecuted(char[] prefix)
{
// If it's already connected we are good to go
if(g_hDatabase != INVALID_HANDLE)
return;

g_cvDatabaseEntry = FindConVar("sm_store_database");

{
strcopy(g_sChatPrefix, sizeof(g_sChatPrefix), prefix);

if(FileEnable)
if(FileEnable && !g_hDatabase)
{
char buffer[128];
g_cvDatabaseEntry = FindConVar("sm_store_database");
g_cvDatabaseEntry.GetString(buffer, 128);
SQL_TConnect(SQLCallback_Connect, buffer);
}
Expand Down
18 changes: 8 additions & 10 deletions addons/sourcemod/scripting/store_misc_voucher.sp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public Plugin myinfo =
name = "Store - Voucher module",
author = "shanapu, nuclear silo", // If you should change the code, even for your private use, please PLEASE add your name to the author here
description = "",
version = "2.0", // If you should change the code, even for your private use, please PLEASE make a mark here at the version number
version = "2.1", // If you should change the code, even for your private use, please PLEASE make a mark here at the version number
url = ""
};

Expand Down Expand Up @@ -98,19 +98,17 @@ public void OnAllPluginsLoaded()

public void Store_OnConfigExecuted(char[] prefix)
{
// If it's already connected we are good to go
if(g_hDatabase != INVALID_HANDLE)
return;

strcopy(g_sChatPrefix, sizeof(g_sChatPrefix), prefix);

ReadCoreCFG();

g_cvDatabaseEntry = FindConVar("sm_store_database");
char buffer[128];
g_cvDatabaseEntry.GetString(buffer, 128);
SQL_TConnect(SQLCallback_Connect, buffer);

if (!g_hDatabase) // If it's already connected we are good to go
{
g_cvDatabaseEntry = FindConVar("sm_store_database");
char buffer[128];
g_cvDatabaseEntry.GetString(buffer, 128);
SQL_TConnect(SQLCallback_Connect, buffer);
}
}

public void SQLCallback_Connect(Handle owner, Handle hndl, const char[] error, any data)
Expand Down

0 comments on commit c29ea28

Please sign in to comment.