diff --git a/configs/shavit-styles.cfg b/configs/shavit-styles.cfg index 0bad46b7..936732c7 100644 --- a/configs/shavit-styles.cfg +++ b/configs/shavit-styles.cfg @@ -12,6 +12,7 @@ "shortname" "NM" // short style name "htmlcolor" "797FD4" // HUD style color (CS:GO only) "command" "n; nm; normal" // commands to register for style changing, leave empty for no command. use a semicolon as a delimiter - requires server restart + "clantag" "N" // short style name for the clantag, not exactly the same as shortname // jumping settings "autobhop" "1" // enable autobhopping and +ds? @@ -62,6 +63,7 @@ "shortname" "SW" "htmlcolor" "B54CB3" "command" "sw; side; sideways" + "clantag" "SW" "block_a" "1" "block_d" "1" @@ -80,6 +82,7 @@ "shortname" "W" "htmlcolor" "9A59F0" "command" "w; wonly" + "clantag" "W" "block_a" "1" "block_s" "1" @@ -98,6 +101,7 @@ "shortname" "SCR" "htmlcolor" "279BC2" "command" "le; legit; scr; scroll" + "clantag" "LE" "autobhop" "0" "easybhop" "0" @@ -118,6 +122,7 @@ "shortname" "400VEL" "htmlcolor" "C9BB8B" "command" "400; 400vel; vel" + "clantag" "400" "autobhop" "0" "easybhop" "0" @@ -139,6 +144,7 @@ "shortname" "HSW" "htmlcolor" "B54CBB" "command" "hsw; halfside; halfsideways" + "clantag" "HSW" "force_hsw" "1" @@ -156,6 +162,7 @@ "shortname" "D" "htmlcolor" "9C5BBA" "command" "d; donly" + "clantag" "D" "autobhop" "1" "easybhop" "1" @@ -180,6 +187,7 @@ "shortname" "LG" "htmlcolor" "DB88C2" "command" "lg; lowgrav" + "clantag" "LG" "gravity" "0.6" @@ -192,6 +200,7 @@ "shortname" "SLOW" "htmlcolor" "C288DB" "command" "slow; slowmo" + "clantag" "SLOW" "speed" "0.5" "halftime" "1" diff --git a/scripting/include/shavit.inc b/scripting/include/shavit.inc index 72e48b8b..8e1f1751 100644 --- a/scripting/include/shavit.inc +++ b/scripting/include/shavit.inc @@ -84,6 +84,7 @@ enum sShortName, sHTMLColor, sChangeCommand, + sClanTag, STYLESTRINGS_SIZE }; diff --git a/scripting/shavit-core.sp b/scripting/shavit-core.sp index 3c8de922..0a2fa234 100644 --- a/scripting/shavit-core.sp +++ b/scripting/shavit-core.sp @@ -1254,6 +1254,7 @@ bool LoadStyles() dStyle.GetString("shortname", gS_StyleStrings[i][sShortName], 128); dStyle.GetString("htmlcolor", gS_StyleStrings[i][sHTMLColor], 128); dStyle.GetString("command", gS_StyleStrings[i][sChangeCommand], 128); + dStyle.GetString("clantag", gS_StyleStrings[i][sClanTag], 128); gA_StyleSettings[i][bAutobhop] = dStyle.GetBool("autobhop", true); gA_StyleSettings[i][bEasybhop] = dStyle.GetBool("easybhop", true); diff --git a/scripting/shavit-misc.sp b/scripting/shavit-misc.sp index 5deb752d..284e17e1 100644 --- a/scripting/shavit-misc.sp +++ b/scripting/shavit-misc.sp @@ -41,7 +41,7 @@ #define CP_DEFAULT (CP_ANGLES|CP_VELOCITY) -#define CP_MAX 64 // this is the amount i'm willing to go for, +#define CP_MAX 64 // this is the amount i'm willing to go for // game specific EngineVersion gEV_Type = Engine_Unknown; @@ -101,6 +101,7 @@ ConVar gCV_NoclipMe = null; ConVar gCV_AdvertisementInterval = null; ConVar gCV_Checkpoints = null; ConVar gCV_RemoveRagdolls = null; +ConVar gCV_ClanTag = null; // cached cvars int gI_GodMode = 3; @@ -125,6 +126,8 @@ int gI_NoclipMe = true; float gF_AdvertisementInterval = 600.0; bool gB_Checkpoints = true; int gI_RemoveRagdolls = 1; +char gS_ClanTag[32] = "{styletag} :: {time}"; +bool gB_ClanTag = true; // dhooks Handle gH_GetPlayerMaxSpeed = null; @@ -253,6 +256,7 @@ public void OnPluginStart() gCV_AdvertisementInterval = CreateConVar("shavit_misc_advertisementinterval", "600.0", "Interval between each chat advertisement.\nConfiguration file for those is configs/shavit-advertisements.cfg.\nSet to 0.0 to disable.\nRequires server restart for changes to take effect.", 0, true, 0.0); gCV_Checkpoints = CreateConVar("shavit_misc_checkpoints", "1", "Allow players to save and teleport to checkpoints.", 0, true, 0.0, true, 1.0); gCV_RemoveRagdolls = CreateConVar("shavit_misc_removeragdolls", "1", "Remove ragdolls after death?\n0 - Disabled\n1 - Only remove replay bot ragdolls.\n2 - Remove all ragdolls.", 0, true, 0.0, true, 2.0); + gCV_ClanTag = CreateConVar("shavit_misc_clantag", "{styletag} :: {time}", "Custom clantag for players.\n0 - Disabled\n{styletag} - style settings from shavit-styles.cfg.\n{style} - style name.\n{time} - formatted time.", 0); gCV_GodMode.AddChangeHook(OnConVarChanged); gCV_PreSpeed.AddChangeHook(OnConVarChanged); @@ -276,6 +280,7 @@ public void OnPluginStart() gCV_AdvertisementInterval.AddChangeHook(OnConVarChanged); gCV_Checkpoints.AddChangeHook(OnConVarChanged); gCV_RemoveRagdolls.AddChangeHook(OnConVarChanged); + gCV_ClanTag.AddChangeHook(OnConVarChanged); AutoExecConfig(); @@ -366,6 +371,7 @@ public void Shavit_OnStyleConfigLoaded(int styles) { Shavit_GetStyleSettings(view_as(i), gA_StyleSettings[i]); Shavit_GetStyleStrings(view_as(i), sStyleName, gS_StyleStrings[i][sStyleName], 128); + Shavit_GetStyleStrings(view_as(i), sClanTag, gS_StyleStrings[i][sClanTag], 128); } } @@ -411,6 +417,8 @@ public void OnConVarChanged(ConVar convar, const char[] oldValue, const char[] n gF_AdvertisementInterval = gCV_AdvertisementInterval.FloatValue; gB_Checkpoints = gCV_Checkpoints.BoolValue; gI_RemoveRagdolls = gCV_RemoveRagdolls.IntValue; + gCV_ClanTag.GetString(gS_ClanTag, 32); + gB_ClanTag = !StrEqual(gS_ClanTag, "0"); } public void OnMapStart() @@ -617,6 +625,11 @@ public Action Timer_Scoreboard(Handle Timer) } UpdateScoreboard(i); + + if(gB_ClanTag && IsPlayerAlive(i)) + { + UpdateClanTag(i); + } } return Plugin_Continue; @@ -697,6 +710,43 @@ void UpdateScoreboard(int client) } } +void UpdateClanTag(int client) +{ + int time = RoundToFloor(Shavit_GetClientTime(client)); + char[] sTime = new char[16]; + + if(time < 60) + { + IntToString(time, sTime, 16); + } + + else + { + int minutes = (time / 60); + int seconds = (time % 60); + + if(time < 3600) + { + FormatEx(sTime, 16, "%d:%s%d", minutes, (seconds < 10)? "0":"", seconds); + } + + else + { + minutes %= 60; + + FormatEx(sTime, 16, "%d:%s%d:%s%d", (time / 3600), (minutes < 10)? "0":"", minutes, (seconds < 10)? "0":"", seconds); + } + } + + char[] sCustomTag = new char[32]; + strcopy(sCustomTag, 32, gS_ClanTag); + ReplaceString(sCustomTag, 32, "{style}", gS_StyleStrings[gBS_Style[client]][sStyleName]); + ReplaceString(sCustomTag, 32, "{styletag}", gS_StyleStrings[gBS_Style[client]][sClanTag]); + ReplaceString(sCustomTag, 32, "{time}", sTime); + + CS_SetClientClanTag(client, sCustomTag); +} + void RemoveRagdoll(int client) { int iEntity = GetEntPropEnt(client, Prop_Send, "m_hRagdoll");