Skip to content

Commit

Permalink
add center tag cvar to fix giveaway center tag display (tks Koen for …
Browse files Browse the repository at this point in the history
…reporting)
  • Loading branch information
nuclearsilo583 committed Oct 29, 2022
1 parent f6d26f5 commit 6edea08
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 21 deletions.
2 changes: 1 addition & 1 deletion addons/sourcemod/scripting/store.sp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#define PLUGIN_NAME "Store - The Resurrection with preview system"
#define PLUGIN_AUTHOR "Zephyrus, nuclear silo, AiDN™"
#define PLUGIN_DESCRIPTION "A completely new Store system with preview rewritten by nuclear silo"
#define PLUGIN_VERSION "7.0.9"
#define PLUGIN_VERSION "7.1.0"
#define PLUGIN_URL ""

#define SERVER_LOCK_IP ""
Expand Down
12 changes: 8 additions & 4 deletions addons/sourcemod/scripting/store/cvars.sp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,10 @@ int gc_iDescription = -1;
int gc_iReloadType = -1;
int gc_iReloadDelay = -1;
int gc_iReloadNotify = -1;
ConVar g_cvarChatTag2;
ConVar g_cvarChatTag;

#pragma unused g_cvarCenterTag
ConVar g_cvarCenterTag;

void Store_Cvars_OnPluginStart()
{
Expand Down Expand Up @@ -61,7 +64,8 @@ void Store_Cvars_OnPluginStart()
g_cvarCreditMessages = RegisterConVar("sm_store_credit_messages", "1", "Enable/disable messages when a player earns credits.", TYPE_INT);

//g_cvarChatTag = RegisterConVar("sm_store_chat_tag", "[Store] ", "The chat tag to use for displaying messages.", TYPE_STRING);
g_cvarChatTag2 = AutoExecConfig_CreateConVar("sm_store_chat_tag_plugins", "[Store] ", "The chat tag to use for displaying messages.");
g_cvarChatTag = AutoExecConfig_CreateConVar("sm_store_chat_tag_plugins", "[Store] ", "The chat tag to use for displaying messages.");
g_cvarCenterTag = AutoExecConfig_CreateConVar("sm_store_center_tag", "[Store] ", "The chat tag to use for displaying messages in hint text box.");

g_cvarShowSTEAM = RegisterConVar("sm_store_show_steam_items", "0", "If you enable this STEAM items will be shown in grey.", TYPE_INT);
g_cvarShowVIP = RegisterConVar("sm_store_show_vip_items", "0", "If you enable this VIP items will be shown in grey.", TYPE_INT);
Expand All @@ -78,7 +82,7 @@ void Store_Cvars_OnPluginStart()
gc_iReloadNotify = RegisterConVar("sm_store_reload_config_notify", "1", "Store reloadconfig notify player", TYPE_INT);


g_cvarChatTag2.AddChangeHook(OnSettingChanged);
g_cvarChatTag.AddChangeHook(OnSettingChanged);

// After every module was loaded we are ready to generate the cfg
//AutoExecConfig();
Expand All @@ -88,7 +92,7 @@ void Store_Cvars_OnPluginStart()

public void OnSettingChanged(ConVar convar, const char[] oldValue, const char[] newValue)
{
if (convar == g_cvarChatTag2)
if (convar == g_cvarChatTag)
{
strcopy(g_sChatPrefix, sizeof(g_sChatPrefix), newValue);
}
Expand Down
2 changes: 1 addition & 1 deletion addons/sourcemod/scripting/store/natives.sp
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ public int Native_SetClientCredits(Handle plugin,int numParams)
int client = GetNativeCell(1);
int m_iCredits = GetNativeCell(2);
Store_LogMessage(client, m_iCredits-g_eClients[client].iCredits, "Set by external plugin");
g_eClients[client].iCredits = m_iCredits;
g_eClients[client].iCredits = g_eClients[client].iCredits + m_iCredits <= 0 ? 0 : m_iCredits;
Store_SaveClientData(client);
return 1;
}
Expand Down
14 changes: 9 additions & 5 deletions addons/sourcemod/scripting/store_combine.sp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#define PLUGIN_NAME "Store - The Resurrection with preview system"
#define PLUGIN_AUTHOR "Zephyrus, nuclear silo, AiDN™"
#define PLUGIN_DESCRIPTION "A completely new Store system with preview rewritten by nuclear silo"
#define PLUGIN_VERSION "7.0.9"
#define PLUGIN_VERSION "7.1.0"
#define PLUGIN_URL ""

#define SERVER_LOCK_IP ""
Expand Down Expand Up @@ -161,7 +161,10 @@ int hTime;

Handle ReloadTimer = INVALID_HANDLE;

ConVar g_cvarChatTag2;
ConVar g_cvarChatTag;

#pragma unused g_cvarCenterTag
ConVar g_cvarCenterTag;

//////////////////////////////
// MODULES //
Expand Down Expand Up @@ -302,7 +305,8 @@ public void OnPluginStart()
g_cvarCreditMessages = RegisterConVar("sm_store_credit_messages", "1", "Enable/disable messages when a player earns credits.", TYPE_INT);

//g_cvarChatTag = RegisterConVar("sm_store_chat_tag", "[Store] ", "The chat tag to use for displaying messages.", TYPE_STRING);
g_cvarChatTag2 = AutoExecConfig_CreateConVar("sm_store_chat_tag_plugins", "[Store] ", "The chat tag to use for displaying messages.");
g_cvarChatTag = AutoExecConfig_CreateConVar("sm_store_chat_tag_plugins", "[Store] ", "The chat tag to use for displaying messages.");
g_cvarCenterTag = AutoExecConfig_CreateConVar("sm_store_center_tag", "[Store] ", "The chat tag to use for displaying messages in hint text box.");

g_cvarShowSTEAM = RegisterConVar("sm_store_show_steam_items", "0", "If you enable this STEAM items will be shown in grey.", TYPE_INT);
g_cvarShowVIP = RegisterConVar("sm_store_show_vip_items", "0", "If you enable this VIP items will be shown in grey.", TYPE_INT);
Expand All @@ -318,8 +322,8 @@ public void OnPluginStart()
gc_iReloadDelay = RegisterConVar("sm_store_reload_config_delay", "10", "Time in second to reload current map on store reload config. Dependence: \"sm_store_reload_config_type\" 0", TYPE_INT);
gc_iReloadNotify = RegisterConVar("sm_store_reload_config_notify", "1", "Store reloadconfig notify player", TYPE_INT);

g_cvarChatTag.AddChangeHook(OnSettingChanged);

g_cvarChatTag2.AddChangeHook(OnSettingChanged);

// Register Commands
RegConsoleCmd("sm_store", Command_Store);
Expand Down Expand Up @@ -519,7 +523,7 @@ public void OnLibraryAdded(const char[] name)

public void OnSettingChanged(ConVar convar, const char[] oldValue, const char[] newValue)
{
if (convar == g_cvarChatTag2)
if (convar == g_cvarChatTag)
{
strcopy(g_sChatPrefix, sizeof(g_sChatPrefix), newValue);
}
Expand Down
12 changes: 7 additions & 5 deletions addons/sourcemod/scripting/store_misc_giveaway.sp
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@ ConVar gc_iCredits;
ConVar gc_iMinPlayer;
ConVar gc_iTimeInfo;
ConVar gc_bAdmin;
ConVar g_cvCenterTag;

char g_sChatPrefix[128];
char g_sCenterPrefix[128];

//char g_sTag[32];
char admins[MAX_NAME_LENGTH];
Expand All @@ -23,7 +25,7 @@ public Plugin myinfo = {
name = "Store Giveaway",
author = "nuclear silo",
description = "Giveaway plugin compatible with zephyrus store.",
version = "1.6",
version = "1.7",
url = ""
}

Expand All @@ -40,14 +42,14 @@ public void OnPluginStart()
AutoExecConfig(true, "giveaway", "sourcemod/store");

LoadTranslations("store.phrases");

// Supress warnings about unused variables.....
if(g_cvarChatTag){}
}

public void Store_OnConfigExecuted(char[] prefix)
{
strcopy(g_sChatPrefix, sizeof(g_sChatPrefix), prefix);

g_cvCenterTag = FindConVar("sm_store_center_tag");
g_cvCenterTag.GetString(g_sCenterPrefix, sizeof(g_sCenterPrefix));
}

public int PlayerCount()
Expand Down Expand Up @@ -140,7 +142,7 @@ public Action TimerGiveaway(Handle timer, any client)
else randomNumber = GetRandomPlayerNoAdmin();
GetClientName(randomNumber, name, MAX_NAME_LENGTH);

Format(sBuffer, sizeof(sBuffer), "%t", "Giveaway winner hint text", g_sChatPrefix, name)
Format(sBuffer, sizeof(sBuffer), "%t", "Giveaway winner hint text", g_sCenterPrefix, name)
PrintCenterTextAll(sBuffer);
CPrintToChatAll("%t", "Giveaway winner chat", g_sChatPrefix, name, credits);

Expand Down
13 changes: 8 additions & 5 deletions addons/sourcemod/scripting/store_misc_giveaway_aidnversion.sp
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,10 @@ ConVar gc_iCredits,
gc_bOwnCredits,
gc_vFlagStart;

//ConVar gc_sTag;
ConVar g_cvCenterTag;

char g_sChatPrefix[128];
char g_sCenterPrefix[128];

//char g_sTag[32];
char admins[MAX_NAME_LENGTH];
Expand All @@ -28,7 +30,7 @@ public Plugin myinfo = {
name = "Store Giveaway AiDN™ version",
author = "nuclear silo, AiDN™",
description = "Giveaway plugin compatible with zephyrus store.",
version = "1.2",
version = "1.3",
url = ""
}

Expand All @@ -48,13 +50,14 @@ public void OnPluginStart()

LoadTranslations("store.phrases");

// Supress warnings about unused variables.....
if(g_cvarChatTag){}
}

public void Store_OnConfigExecuted(char[] prefix)
{
strcopy(g_sChatPrefix, sizeof(g_sChatPrefix), prefix);

g_cvCenterTag = FindConVar("sm_store_center_tag");
g_cvCenterTag.GetString(g_sCenterPrefix, sizeof(g_sCenterPrefix));
}

public int PlayerCount()
Expand Down Expand Up @@ -195,7 +198,7 @@ public Action TimerGiveaway(Handle timer, any client)
else randomNumber = GetRandomPlayerNoAdmin();
GetClientName(randomNumber, name, MAX_NAME_LENGTH);

Format(sBuffer, sizeof(sBuffer), "%t", "Giveaway winner hint text", g_sChatPrefix, name)
Format(sBuffer, sizeof(sBuffer), "%t", "Giveaway winner hint text", g_sCenterPrefix, name)
PrintCenterTextAll(sBuffer);
CPrintToChatAll("%t", "Giveaway winner chat", g_sChatPrefix, name, credits);

Expand Down

0 comments on commit 6edea08

Please sign in to comment.