Skip to content

Commit

Permalink
various bugs fixes/ improvement. Please check changelogs.txt
Browse files Browse the repository at this point in the history
  • Loading branch information
nuclearsilo583 committed Feb 2, 2023
1 parent 8c120cf commit 6c93deb
Show file tree
Hide file tree
Showing 6 changed files with 154 additions and 15 deletions.
7 changes: 7 additions & 0 deletions addons/sourcemod/configs/store/cpcolors.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,11 @@
"name" "Dark turquoise"
"color" "{darkturquoise}"
}

"6" // Rainbow
{
"name" "Rainbow"
"flag" "o"
"color" "rainbow"
}
}
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.1.0"
#define PLUGIN_VERSION "7.1.1"
#define PLUGIN_URL ""

#define SERVER_LOCK_IP ""
Expand Down
2 changes: 1 addition & 1 deletion 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.1.0"
#define PLUGIN_VERSION "7.1.1"
#define PLUGIN_URL ""

#define SERVER_LOCK_IP ""
Expand Down
117 changes: 107 additions & 10 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.9",
version = "3.0",
url = ""
};

Expand Down Expand Up @@ -280,16 +280,17 @@ public int DisplayMenuShop(int client)
if (!kvtShop.GotoFirstSubKey())
return 0;

char ItemID[150], name[50], color[20];
char ItemID[150], name[50], color[20], flag[8];
Format(sBuffer, sizeof(sBuffer), "%t", "CP Disable Color - Menu");
shopmenu.AddItem("disabled", sBuffer);
do
{
kvtShop.GetSectionName(ItemID, sizeof(ItemID));
kvtShop.GetString("name", name, sizeof(name));
kvtShop.GetString("color", color, sizeof(color));
kvtShop.GetString("flag", flag, sizeof(flag), "");
Format(sBuffer, sizeof(sBuffer), "%s", name);
shopmenu.AddItem(ItemID, name);
shopmenu.AddItem(ItemID, name, HasPermission(client, flag) ? ITEMDRAW_DEFAULT : ITEMDRAW_DISABLED);
} while (kvtShop.GotoNextKey());
shopmenu.ExitButton = true;
shopmenu.Display(client, 20);
Expand Down Expand Up @@ -445,7 +446,7 @@ public Action CP_OnChatMessage(int& author, ArrayList recipients, char[] flagstr
int iNameColor = Store_GetDataIndex(iEquippedNameColor);
if(StrEqual(g_sNameColors[iNameColor], "rainbow"))
{
String_Rainbow(name, sNameColor, sizeof(sNameColor));
Rainbow_String(name, sNameColor, sizeof(sNameColor));
//strcopy(sNameColor, sizeof(sNameColor), g_sNameColors[iNameColor]);
}
else strcopy(sNameColor, sizeof(sNameColor), g_sNameColors[iNameColor]);
Expand All @@ -454,6 +455,8 @@ public Action CP_OnChatMessage(int& author, ArrayList recipients, char[] flagstr
if(!StrEqual(g_szColors[author], "disabled", true))
{
int iNameColor;
char temp[MAXLENGTH_NAME], temp2[MAXLENGTH_NAME];

if (iEquippedNameColor >= 0)
{
iNameColor = Store_GetDataIndex(iEquippedNameColor);
Expand All @@ -465,7 +468,25 @@ public Action CP_OnChatMessage(int& author, ArrayList recipients, char[] flagstr
//PrintToChat(author, "have }");
if(iEquippedNameColor>=0 && StrEqual(g_sNameColors[iNameColor], "rainbow"))
{
Format(sName, sizeof(sName), "%s%s{teamcolor}%s", g_szColors[author], sNameTag2[1], sNameColor);
if(StrEqual(g_szColors[author], "rainbow"))
{
strcopy(temp, sizeof(temp), sNameTag2[1]);
Rainbow_String(temp, temp2, sizeof(temp2));
Format(sName, sizeof(sName), "%s{teamcolor}%s", temp2, sNameColor);
}
else Format(sName, sizeof(sName), "%s%s{teamcolor}%s", g_szColors[author], sNameTag2[1], sNameColor);
}
else if(iEquippedNameColor>=0 && StrEqual(g_szColors[author], "rainbow"))
{
strcopy(temp, sizeof(temp), sNameTag2[1]);
Rainbow_String(temp, temp2, sizeof(temp2));
Format(sName, sizeof(sName), "%s{teamcolor}%s%s", temp2, sNameColor, name);
}
else if(StrEqual(g_szColors[author], "rainbow"))
{
strcopy(temp, sizeof(temp), sNameTag2[1]);
Rainbow_String(temp, temp2, sizeof(temp2));
Format(sName, sizeof(sName), "%s{teamcolor}%s%s", temp2, sNameColor, name);
}
else Format(sName, sizeof(sName), "%s%s{teamcolor}%s%s", g_szColors[author], sNameTag2[1], sNameColor, name);
}
Expand All @@ -474,7 +495,25 @@ public Action CP_OnChatMessage(int& author, ArrayList recipients, char[] flagstr
//PrintToChat(author, "no have }");
if(iEquippedNameColor>=0 && StrEqual(g_sNameColors[iNameColor], "rainbow"))
{
Format(sName, sizeof(sName), "%s%s{teamcolor}%s", g_szColors[author], sNameTag2[1], sNameColor);
if(StrEqual(g_szColors[author], "rainbow"))
{
strcopy(temp, sizeof(temp), sNameTag2[1]);
Rainbow_String(temp, temp2, sizeof(temp2));
Format(sName, sizeof(sName), "%s{teamcolor}%s", temp2, sNameColor);
}
else Format(sName, sizeof(sName), "%s%s{teamcolor}%s", g_szColors[author], sNameTag2[1], sNameColor);
}
else if(iEquippedNameColor>=0 && StrEqual(g_szColors[author], "rainbow"))
{
strcopy(temp, sizeof(temp), sNameTag2[1]);
Rainbow_String(temp, temp2, sizeof(temp2));
Format(sName, sizeof(sName), "%s{teamcolor}%s%s", temp2, sNameColor, name);
}
else if(StrEqual(g_szColors[author], "rainbow"))
{
strcopy(temp, sizeof(temp), sNameTag2[1]);
Rainbow_String(temp, temp2, sizeof(temp2));
Format(sName, sizeof(sName), "%s{teamcolor}%s%s", temp2, sNameColor, name);
}
else Format(sName, sizeof(sName), "%s%s{teamcolor}%s%s", g_szColors[author], sNameTag, sNameColor, name);
}
Expand Down Expand Up @@ -506,7 +545,7 @@ public Action CP_OnChatMessage(int& author, ArrayList recipients, char[] flagstr
if(StrEqual(g_sMessageColors[m_iData], "rainbow"))
{
char sBuffer[256];
String_Rainbow(message, sBuffer, sizeof(sBuffer));
Rainbow_String(message, sBuffer, sizeof(sBuffer));
strcopy(message, MAXLENGTH_MESSAGE, sBuffer);
}
else Format(message, MAXLENGTH_BUFFER, "%s%s", g_sMessageColors[Store_GetDataIndex(iEquippedMsgColor)], sMessage);
Expand Down Expand Up @@ -600,7 +639,7 @@ public void Store_OnPreviewItem(int client, char[] type, int index)
{
if(StrEqual(g_sNameColors[index], "rainbow"))
{
String_Rainbow(clientname, sBuffer, sizeof(sBuffer));
Rainbow_String(clientname, sBuffer, sizeof(sBuffer));
Format(sBuffer, sizeof(sBuffer), "%s :{default}", sBuffer);
}
else
Expand All @@ -614,7 +653,7 @@ public void Store_OnPreviewItem(int client, char[] type, int index)
Format(PreviewBuffer, sizeof(PreviewBuffer), "%t", "This is the preview text");

if(StrEqual(g_sMessageColors[index], "rainbow"))
String_Rainbow(PreviewBuffer, sBuffer, sizeof(sBuffer));
Rainbow_String(PreviewBuffer, sBuffer, sizeof(sBuffer));
else
Format(sBuffer, sizeof(sBuffer), " %s%s", g_sMessageColors[index], PreviewBuffer);
CPrintToChat(client, "%t", "CP Preview", " ", Buffer, sBuffer);
Expand Down Expand Up @@ -677,6 +716,31 @@ public Action Clantag(Handle timer, int client)
}
#endif

void Rainbow_String(const char[] input, char[] output, int maxLen)
{
char sTemp[MAXLENGTH_NAME];
int len = strlen(input);
for (int i = 0; i < len; i++)
{
if (IsCharSpace(input[i]))
{
Format(sTemp, sizeof(sTemp), "%s%c", sTemp, input[i]);
continue;
}

int bytes = GetCharBytes(input[i]) + 1;
char[] c = new char[bytes];
strcopy(c, bytes, input[i]);
//Format(sTemp, sizeof(sTemp), "%s%c%s", sTemp, GetColor(++color), c);
Format(sTemp, sizeof(sTemp), "%s%c%s", sTemp, RandomColor(), c);
if (IsCharMB(input[i]))
i += bytes - 2;
}


strcopy(output, maxLen, sTemp);
}

void String_Rainbow(const char[] input, char[] output, int maxLen)
{
int bytes, buffs;
Expand Down Expand Up @@ -742,4 +806,37 @@ int RandomColor()
case 13: return '\x0B';
default: return '\x07';
}
}
}

stock bool HasPermission(int iClient, char[] flagString)
{
if (StrEqual(flagString, ""))
{
return true;
}

AdminId admin = GetUserAdmin(iClient);

if (admin != INVALID_ADMIN_ID)
{
int count, found, flags = ReadFlagString(flagString);
for (int i = 0; i <= 20; i++)
{
if (flags & (1<<i))
{
count++;

if (GetAdminFlag(admin, view_as<AdminFlag>(i)))
{
found++;
}
}
}

if (count == found) {
return true;
}
}

return false;
}
16 changes: 13 additions & 3 deletions addons/sourcemod/scripting/store_item_playerskins.sp
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public Plugin myinfo =
name = "Store - Player Skin Module (No ZR + ZR, gloves support)",
author = "nuclear silo, AiDN™, azalty", // If you should change the code, even for your private use, please PLEASE add your name to the author here
description = "",
version = "2.1", // If you should change the code, even for your private use, please PLEASE make a mark here at the version number
version = "2.2", // 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 @@ -473,19 +473,20 @@ void Store_SetClientArmsModel(int client, const char[] model, int index)

void Store_SetClientModel(int client, const char[] model, const int skin=0, const int body=0, const char[] arms="", int index)
{

SetEntityModel(client, model);

SetEntProp(client, Prop_Send, "m_nSkin", skin);

if (body > 0)
if (body >= 0)
{
// set?
SetEntProp(client, Prop_Send, "m_nBody", body);
}
else SetEntProp(client, Prop_Send, "m_nBody", 0);

//CreateTimer(0.15, Timer_RemovePlayerWeapon, GetClientUserId(client));


if(GAME_CSGO && arms[0]!=0)
{
if(!g_bGlovesPluginEnable)
Expand All @@ -503,6 +504,15 @@ void Store_SetClientModel(int client, const char[] model, const int skin=0, cons
RemoveClientGloves(client, index);
SetEntPropString(client, Prop_Send, "m_szArmsModel", arms);
}

//Create Fake event to refresh the arm if the current model is the same because changing bodygroup
Event event = CreateEvent("player_spawn", true);
if (event == null)
return;

event.SetInt("userid", GetClientUserId(client));
event.FireToClient(client);
event.Cancel();
}
}

Expand Down
25 changes: 25 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,31 @@

#Format rules: since I live in Viet Nam so the date format in here is DD/MM/YYYY not MM/DD/YYYY
================================================================================================================================
################################################################################################
Update 3/2/2023 (Thanks for you guy keep updating/fixing this store and maintain this project.)
- Merge Pull Request from #93 to #137 (Check https://github.com/nuclearsilo583/zephyrus-store-preview-new-syntax/pull/) ( by azalty and Kroytz. Thanks :) )
- Fixed gifts store module ignoring sm_store_gifts_enabled (by azalty)
- Fixed items being removed in a certain scenario (by azalty)
- Fixed problems with Native_SetClientCredits. (by azalty)
- Changed handling of restricted items when players don't have access to them anymore. (by azalty)
- Fixed load queries going through map changes. (by azalty)
- Change Chat Processor behavior on stripping rainbow string. Added rainbow tag support in !tgs.
- Fixed arms model not refresh by equiping the same model skin (with different bodygroup)
################################################################################################
Files changes:
- store_combine.sp (v7.0.7 --> v7.1.1)
- store.sp (v7.0.7 --> v7.1.1)
- Splited core include files
- scripting/store/cvars.sp
- scripting/store/natives.sp
- scripting/store/sql.sp
- scripting/store/store_functions.sp
- scripting/store/menus/item_menu.sp
- scripting/store/menus/preview_menu.sp
- gift.sp
- store_item_cpsupport.sp
- store_item_playerskins.sp

################################################################################################
Update 28/8/2022
- Re-add store core combined version (no splited files). This version and store.sp are the same and will be both updated by the time being.
Expand Down

0 comments on commit 6c93deb

Please sign in to comment.