├── ExtraCommands.sp ├── LICENSE ├── PrettyColors_SB.sp ├── README.md ├── bhud2.sp ├── bhud2_nomax.sp ├── bosshud_v3.sp ├── compiled ├── ExtraCommands.smx ├── PrettyColors_SB.smx ├── Spectate.smx ├── bhud2.smx ├── bhud2_nomax.smx ├── breakablehud.smx ├── countdownhud.smx ├── deadmute.smx ├── entWatch (kinda broken).smx ├── entWatch.smx ├── forceinput.smx ├── glowcolors.smx ├── godelites.smx ├── gunshop2.smx ├── icecap_extreme.smx ├── leader2.smx ├── logconnections_admin.smx ├── mirror_csgo.smx ├── mutedead.smx ├── muteonvote_teal.smx ├── particlelog.smx ├── skillbot.smx ├── skillbot_cptags.smx ├── skillbot_perks.smx ├── skillbot_scptags.smx ├── skillbot_togtags.smx ├── sm_showname.smx ├── sm_spawnlaser.smx ├── spectate_zeddy.smx └── stopsounds_zeddy.smx ├── countdownhud.sp ├── custom-chatcolors-csgo-sb.sp ├── deadmute.sp ├── entWatch.sp ├── forceinput.sp ├── glowcolor.sp ├── godelites.sp ├── gunshop2.sp ├── icecap_extreme.sp ├── include ├── colors_csgo.inc ├── entWatch.inc ├── leader.inc └── skillbot.inc ├── leader ├── materials.zip └── materials │ └── sg │ ├── sgdefend.vmt │ ├── sgdefend.vtf │ ├── sgfollow.vmt │ └── sgfollow.vtf ├── leader2.sp ├── logconnections_admin.sp ├── mutedead.sp ├── muteonvote_teal.sp ├── particlelog.sp ├── perks └── basic.sp ├── readme.txt ├── shop_skins.sp ├── skillbot.sp ├── skillbot.zip ├── skillbot └── configs │ └── skillbot │ ├── skillbot_hard.cfg │ ├── skillbot_perks.cfg │ └── skillbot_ranks.cfg ├── skillbot_cptags.sp ├── skillbot_perks.sp ├── skillbot_scptags.sp ├── skillbot_togtags.sp ├── sm_showname.sp ├── sm_spawnlaser.sp ├── spawnlaser ├── materials │ └── antiteal │ │ ├── lightblue.vmt │ │ └── lightblue.vtf ├── models │ └── AntiTeal │ │ ├── laser.dx80.vtx │ │ ├── laser.dx90.vtx │ │ ├── laser.mdl │ │ ├── laser.phy │ │ ├── laser.sw.vtx │ │ └── laser.vvd └── sound │ └── music │ └── antiteal │ └── laser.mp3 ├── spectate_zeddy.sp └── stopsounds_zeddy.sp /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 Bryce Casaje 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /PrettyColors_SB.sp: -------------------------------------------------------------------------------- 1 | #pragma semicolon 1 2 | 3 | #define PLUGIN_AUTHOR "R3TROATTACK (fat) + AntiTeal" 4 | #define PLUGIN_VERSION "SB1.2" 5 | 6 | #define TAG " \x0B[Chat Colors]\x01" 7 | 8 | #include 9 | #include 10 | //#include 11 | #include 12 | #include 13 | 14 | #pragma newdecls required 15 | 16 | char g_sColorCode[16][4] = { 17 | "\x01", "\x02", "\x03", "\x04", "\x05", "\x06", "\x07", "\x08", 18 | "\x09", "\x0A", "\x0B", "\x0C", "\x0D", "\x0E", "\x0F", "\x10" 19 | }; 20 | 21 | char g_sColorName[16][16] = { 22 | "White/None", "Dark Red", "Team Color", "Green", "Light Green", "Lime", "Red", "Gray", 23 | "Yellow", "Clear Blue", "Light Blue", "Blue", "Clear Gray", "Purple", "Dark Orange", "Orange" 24 | }; 25 | 26 | char g_sColorTagText[16][16] = { 27 | "{white}", "{darkred}", "{teamcolor}", "{green}", "{lightgreen}", "{lime}", "{red}", "{gray}", 28 | "{yellow}", "{clearblue}", "{lightblue}", "{blue}", "{cleargray}", "{purple}", "{darkorange}", "{orange}" 29 | }; 30 | 31 | char g_sPlayerTag[MAXPLAYERS + 1][20]; 32 | int g_iPlayerChatColor[MAXPLAYERS + 1]; 33 | int g_iPlayerNameColor[MAXPLAYERS + 1] = { 2, ... }; 34 | bool g_bCustomChatColor[MAXPLAYERS + 1]; 35 | bool g_bCustomNameColor[MAXPLAYERS + 1]; 36 | bool g_bCustomTag[MAXPLAYERS + 1]; 37 | 38 | Handle g_hDatabase = null; 39 | Handle g_ChatColorsForward; 40 | 41 | #include "chatcolors/db.sp" 42 | 43 | public Plugin myinfo = 44 | { 45 | name = "Chat Colors", 46 | author = PLUGIN_AUTHOR, 47 | description = "Makes chat be pretty", 48 | version = PLUGIN_VERSION, 49 | url = "http://steamcommunity.com/id/R3TROATTACK/" 50 | }; 51 | 52 | public void OnPluginStart() 53 | { 54 | ConnectDatabase(); 55 | 56 | RegAdminCmd("sm_colors", Command_Colors, ADMFLAG_RESERVATION, "Chat Colors command"); 57 | RegAdminCmd("sm_namecolor", Command_NameColor, ADMFLAG_CUSTOM3, "Name Colors command"); 58 | RegAdminCmd("sm_settag", Command_SetTag, ADMFLAG_CUSTOM6, "Custom Tag command"); 59 | 60 | g_ChatColorsForward = CreateGlobalForward("OnChatColors", ET_Ignore, Param_CellByRef, Param_Cell, Param_String, Param_String); 61 | } 62 | 63 | public void OnClientPostAdminCheck(int client) 64 | { 65 | Format(g_sPlayerTag[client], 20, ""); 66 | g_bCustomChatColor[client] = false; 67 | g_bCustomTag[client] = false; 68 | g_bCustomNameColor[client] = false; 69 | g_iPlayerChatColor[client] = 0; 70 | g_iPlayerNameColor[client] = 2; 71 | CreateTimer(3.0, Timer_GetMemes, client, TIMER_FLAG_NO_MAPCHANGE); 72 | } 73 | 74 | public Action Timer_GetMemes(Handle timer, any data) 75 | { 76 | int client = data; 77 | if(IsValidClient(client)) 78 | { 79 | if (IsClientAuthorized(client)) 80 | { 81 | GetPlayersColors(client); 82 | } 83 | } 84 | return Plugin_Stop; 85 | } 86 | 87 | public void OnClientDisconnect(int client) 88 | { 89 | Format(g_sPlayerTag[client], 20, ""); 90 | g_bCustomChatColor[client] = false; 91 | g_bCustomTag[client] = false; 92 | g_bCustomNameColor[client] = false; 93 | g_iPlayerChatColor[client] = 0; 94 | g_iPlayerNameColor[client] = 2; 95 | } 96 | 97 | public Action Command_Colors(int client, int args) 98 | { 99 | CreateColorsMenu(client); 100 | return Plugin_Handled; 101 | } 102 | 103 | public Action Command_NameColor(int client, int args) 104 | { 105 | CreateNameColorsMenu(client); 106 | return Plugin_Handled; 107 | } 108 | 109 | public void CreateColorsMenu(int client) 110 | { 111 | Menu menu = new Menu(ColorsMenuHandler); 112 | menu.SetTitle("Colors Menu"); 113 | if(GetAdminFlag(GetUserAdmin(client), Admin_Custom6, Access_Effective)) 114 | { 115 | for (int i = 0; i < 16; i++) 116 | { 117 | menu.AddItem("", g_sColorName[i]); 118 | } 119 | } 120 | else 121 | { 122 | menu.AddItem("", g_sColorName[0]); 123 | menu.AddItem("", g_sColorName[2]); 124 | } 125 | menu.ExitButton = true; 126 | menu.Display(client, 30); 127 | } 128 | 129 | public void CreateNameColorsMenu(int client) 130 | { 131 | Menu menu = new Menu(NameColorsMenuHandler); 132 | menu.SetTitle("Name Colors Menu"); 133 | for (int i = 0; i < 16; i++) 134 | { 135 | menu.AddItem("", g_sColorName[i]); 136 | } 137 | menu.ExitButton = true; 138 | menu.Display(client, 30); 139 | } 140 | 141 | public int ColorsMenuHandler(Menu menu, MenuAction action, int client, int choice) 142 | { 143 | if(action == MenuAction_Select) 144 | { 145 | if(GetAdminFlag(GetUserAdmin(client), Admin_Custom6, Access_Effective)) 146 | { 147 | g_iPlayerChatColor[client] = choice; 148 | } 149 | else 150 | { 151 | if(choice == 1) 152 | g_iPlayerChatColor[client] = 2; 153 | else if(choice == 0) 154 | g_iPlayerChatColor[client] = 0; 155 | } 156 | UpdatePlayerColors(client); 157 | PrintToChat(client, "%s Your color is now %s%s\x01.", TAG, g_sColorCode[g_iPlayerChatColor[client]], g_sColorName[g_iPlayerChatColor[client]]); 158 | 159 | if(choice != 0) 160 | g_bCustomChatColor[client] = true; 161 | else 162 | g_bCustomChatColor[client] = false; 163 | } 164 | else if(action == MenuAction_End) 165 | { 166 | delete menu; 167 | } 168 | 169 | return 0; 170 | } 171 | 172 | public int NameColorsMenuHandler(Menu menu, MenuAction action, int client, int choice) 173 | { 174 | if(action == MenuAction_Select) 175 | { 176 | g_iPlayerNameColor[client] = choice; 177 | UpdatePlayerColors(client); 178 | 179 | if(choice != 0) 180 | g_bCustomNameColor[client] = true; 181 | else 182 | g_bCustomNameColor[client] = false; 183 | } 184 | else if(action == MenuAction_End) 185 | { 186 | delete menu; 187 | } 188 | 189 | return 0; 190 | } 191 | 192 | public Action Command_SetTag(int client, int args) 193 | { 194 | if(args == 0) 195 | { 196 | char sBuffer[512]; 197 | Format(sBuffer, 512, " "); 198 | for (int i = 0; i < 16; i++) 199 | { 200 | Format(sBuffer, sizeof(sBuffer), "%s%s%s ", sBuffer, g_sColorCode[i], g_sColorTagText[i]); 201 | } 202 | PrintToChat(client, "%s", sBuffer); 203 | return Plugin_Handled; 204 | } 205 | 206 | char sArg[128]; 207 | GetCmdArg(1, sArg, sizeof(sArg)); 208 | if(StrEqual(sArg, "none", false)) 209 | { 210 | Format(g_sPlayerTag[client], 20, ""); 211 | UpdatePlayerColors(client); 212 | PrintToChat(client, "%s Your tag has been removed!", TAG); 213 | g_bCustomTag[client] = false; 214 | return Plugin_Handled; 215 | } 216 | 217 | char sBuffer[512]; 218 | GetCmdArgString(sBuffer, 512); 219 | if(StrContains(sBuffer, "%", false) != -1) 220 | { 221 | PrintToChat(client, "%s Your tag cannot contain %s", TAG, "%"); 222 | return Plugin_Handled; 223 | } 224 | 225 | for (int i = 0; i < 16; i++) 226 | { 227 | ReplaceString(sBuffer, sizeof(sBuffer), g_sColorTagText[i], g_sColorCode[i], false); 228 | } 229 | Format(g_sPlayerTag[client], 20, "%s", sBuffer); 230 | UpdatePlayerColors(client); 231 | PrintToChat(client, "%s Your new custom tag is: %s", TAG, g_sPlayerTag[client]); 232 | g_bCustomTag[client] = true; 233 | return Plugin_Handled; 234 | } 235 | 236 | public Action OnChatMessage(int &author, Handle recipients, char[] name, char[] message) 237 | { 238 | if(author == 0 || message[0] == '@') 239 | return Plugin_Continue; 240 | 241 | char rank[64]; 242 | SB_GetChatRank(author, rank, sizeof(rank)); 243 | 244 | if(strlen(rank) != 0) 245 | { 246 | CFormat(rank, sizeof(rank), author); 247 | Format(name, MAXLENGTH_NAME, "%s %s%s%s", rank, g_sPlayerTag[author], g_sColorCode[g_iPlayerNameColor[author]], name); 248 | } 249 | else 250 | { 251 | Format(name, MAXLENGTH_NAME, " %s%s%s", g_sPlayerTag[author], g_sColorCode[g_iPlayerNameColor[author]], name); 252 | } 253 | Format(message, MAXLENGTH_INPUT, "%s%s", g_sColorCode[g_iPlayerChatColor[author]], message); 254 | 255 | Call_StartForward(g_ChatColorsForward); 256 | Call_PushCellRef(author); 257 | Call_PushCell(recipients); 258 | Call_PushStringEx(name, MAXLENGTH_NAME, SM_PARAM_STRING_UTF8|SM_PARAM_STRING_COPY, SM_PARAM_COPYBACK); 259 | Call_PushStringEx(message, MAXLENGTH_INPUT, SM_PARAM_STRING_UTF8|SM_PARAM_STRING_COPY, SM_PARAM_COPYBACK); 260 | Call_Finish(); 261 | 262 | return Plugin_Changed; 263 | } 264 | 265 | bool IsValidClient(int client) 266 | { 267 | if (client <= 0 || client > MaxClients) 268 | return false; 269 | else if (!IsClientInGame(client)) 270 | return false; 271 | else if (IsFakeClient(client)) 272 | return false; 273 | 274 | return true; 275 | } -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # sourcemod-plugins 2 | a repository of all of my sourcemod plugins, especially those for the ZE (Zombie Escape) gamemode 3 | 4 | please let me know if you're gonna use them, DM me on Discord @ Strellic#2507 5 | 6 | ## SkillBot 7 | SkillBot was one of my larger plugins, it was an attempt at a custom ranking system specifically for the Zombie Escape gamemode. 8 | 9 | ### Features 10 | * Storage in MySQL / SQLite database 11 | * "Hard Map" functionality, hooks into active maps to determine whether the current map / level should give a higher multiplier 12 | * Custom point algorithm that incentivizes shooting zombies 13 | * Custom and extensible perks implementation that allows for fun items like tracers or skins based on ranks / points 14 | 15 | ### Usage 16 | Compile `skillbot.sp`, `skillbot_perks.sp`, and the specific skillbot chats plugin for the chat processor your server uses. 17 | Move the `skillbot/configs/skillbot/` folder into the `addons/sourcemod/config/` folder, and modify the configs as necessary. 18 | 19 | ## Leader 20 | A plugin that allows humans to vote for and become leaders, leading the team through the map with a custom rainbow beacon, markers, and overlays above their head. 21 | 22 | ## Countdown HUD 23 | [Alliedmodders Link](https://www.google.com/search?q=countdownhud&oq=countdownhud&aqs=chrome..69i57j0l6.3487j0j7&sourceid=chrome&ie=UTF-8) 24 | Detects whenever the map says a message that contains a timer, and counts down the exact message on a game_text hud. Has support for most phrases (feel free to tell me which ones don't work), and changes the exact message given from the map. The plugin is made for ZR servers to tell people when things are happening, but it should work on non-ZR servers. 25 | 26 | ## Boss HUD (version 2) 27 | Displays the health / value of any func_breakable or math_counter that you activate. Plugin is meant for the ZE gamemode, as it displays the current HP of any boss or breakable that you are shooting, but it can be used in other gamemodes as well. 28 | 29 | ## Boss HUD (version 3) 30 | An updated version of Boss HUD that uses GFL's boss config system to have custom implementation for certain bosses. -------------------------------------------------------------------------------- /bhud2.sp: -------------------------------------------------------------------------------- 1 | #pragma semicolon 1 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | #define PLUGIN_VERSION "2.2" 8 | #pragma newdecls required 9 | 10 | Handle BossHud_Cookie = INVALID_HANDLE, HudSync = INVALID_HANDLE; 11 | bool g_bStatus[MAXPLAYERS+1] = {false, ...}; 12 | int entityID[MAXPLAYERS+1] = -1; 13 | ConVar g_cVHudPosition, g_cVHudColor, g_cVHudSymbols, g_cVUpdateTime, g_cVDisplayType, g_cVAdminOnly; 14 | float HudPos[2]; 15 | int HudColor[3]; 16 | int UpdateTime; 17 | int DisplayType; 18 | int g_iTimer[MAXPLAYERS+1]; 19 | bool HudSymbols; 20 | bool AdminOnly; 21 | 22 | public Plugin myinfo = { 23 | name = "BossHud", 24 | author = "AntiTeal", 25 | description = "", 26 | version = PLUGIN_VERSION, 27 | url = "antiteal.com" 28 | }; 29 | 30 | public void OnPluginStart() 31 | { 32 | CreateConVar("sm_bhud_version", PLUGIN_VERSION, "BHud Version", FCVAR_SPONLY|FCVAR_REPLICATED|FCVAR_NOTIFY); 33 | BossHud_Cookie = RegClientCookie("bhud_cookie", "Status of BHud", CookieAccess_Private); 34 | for(int i = 1; i <= MaxClients; i++) 35 | { 36 | if (!AreClientCookiesCached(i)) 37 | continue; 38 | OnClientCookiesCached(i); 39 | } 40 | 41 | RegConsoleCmd("sm_bhud", Command_BHud, "Toggle BHud"); 42 | 43 | HookEntityOutput("func_physbox", "OnHealthChanged", OnDamage); 44 | HookEntityOutput("func_physbox_multiplayer", "OnHealthChanged", OnDamage); 45 | HookEntityOutput("func_breakable", "OnHealthChanged", OnDamage); 46 | HookEntityOutput("math_counter", "OutValue", OnDamageCounter); 47 | 48 | RegAdminCmd("sm_currenthp", Command_CHP, ADMFLAG_GENERIC, "See Current HP"); 49 | RegAdminCmd("sm_subtracthp", Command_SHP, ADMFLAG_GENERIC, "Subtract Current HP"); 50 | 51 | g_cVHudPosition = CreateConVar("sm_bhud_position", "-1.0 0.09", "The X and Y position for the hud."); 52 | g_cVHudColor = CreateConVar("sm_bhud_color", "255 0 0", "RGB color value for the hud."); 53 | g_cVHudSymbols = CreateConVar("sm_bhud_symbols", "1", "Determines whether >> and << are wrapped around the text."); 54 | g_cVUpdateTime = CreateConVar("sm_bhud_updatetime", "3", "How long to update the client's hud with current health for."); 55 | g_cVDisplayType = CreateConVar("sm_bhud_displaytype", "0", "Display type of HUD. (0 = game_text, 1 = center text)"); 56 | g_cVAdminOnly = CreateConVar("sm_bhud_adminonly", "0", "Determines whether BHUD is public or admin only. (0 = public, 1 = admins)"); 57 | 58 | g_cVHudPosition.AddChangeHook(ConVarChange); 59 | g_cVHudColor.AddChangeHook(ConVarChange); 60 | g_cVHudSymbols.AddChangeHook(ConVarChange); 61 | g_cVUpdateTime.AddChangeHook(ConVarChange); 62 | g_cVDisplayType.AddChangeHook(ConVarChange); 63 | g_cVAdminOnly.AddChangeHook(ConVarChange); 64 | 65 | AutoExecConfig(true); 66 | GetConVars(); 67 | 68 | CreateTimer(0.25, UpdateHUD, _, TIMER_REPEAT); 69 | } 70 | 71 | public void OnClientConnected(int client) 72 | { 73 | g_iTimer[client] = 0; 74 | } 75 | 76 | public void ColorStringToArray(const char[] sColorString, int aColor[3]) 77 | { 78 | char asColors[4][4]; 79 | ExplodeString(sColorString, " ", asColors, sizeof(asColors), sizeof(asColors[])); 80 | 81 | aColor[0] = StringToInt(asColors[0]); 82 | aColor[1] = StringToInt(asColors[1]); 83 | aColor[2] = StringToInt(asColors[2]); 84 | } 85 | 86 | public void GetConVars() 87 | { 88 | char StringPos[2][8]; 89 | char PosValue[16]; 90 | g_cVHudPosition.GetString(PosValue, sizeof(PosValue)); 91 | ExplodeString(PosValue, " ", StringPos, sizeof(StringPos), sizeof(StringPos[])); 92 | 93 | HudPos[0] = StringToFloat(StringPos[0]); 94 | HudPos[1] = StringToFloat(StringPos[1]); 95 | 96 | char ColorValue[64]; 97 | g_cVHudColor.GetString(ColorValue, sizeof(ColorValue)); 98 | 99 | ColorStringToArray(ColorValue, HudColor); 100 | 101 | HudSymbols = g_cVHudSymbols.BoolValue; 102 | AdminOnly = g_cVAdminOnly.BoolValue; 103 | UpdateTime = g_cVUpdateTime.IntValue; 104 | DisplayType = g_cVDisplayType.IntValue; 105 | } 106 | 107 | public void ConVarChange(ConVar convar, char[] oldValue, char[] newValue) 108 | { 109 | GetConVars(); 110 | } 111 | 112 | public void OnMapStart() 113 | { 114 | HudSync = CreateHudSynchronizer(); 115 | } 116 | public void OnMapEnd() 117 | { 118 | if(HudSync != INVALID_HANDLE) 119 | { 120 | CloseHandle(HudSync); 121 | HudSync = INVALID_HANDLE; 122 | } 123 | } 124 | 125 | public void OnClientCookiesCached(int client) 126 | { 127 | char sValue[8]; 128 | GetClientCookie(client, BossHud_Cookie, sValue, sizeof(sValue)); 129 | g_bStatus[client] = (sValue[0] != '\0' && StringToInt(sValue)); 130 | } 131 | 132 | public Action Command_BHud(int client, int argc) 133 | { 134 | if(IsPlayerGenericAdmin(client) || !AdminOnly) 135 | { 136 | char sValue[8]; 137 | g_bStatus[client] = !g_bStatus[client]; 138 | PrintToChat(client, "[SM] BHud has been %s.", g_bStatus[client] ? "enabled" : "disabled"); 139 | Format(sValue, sizeof(sValue), "%i", g_bStatus[client]); 140 | SetClientCookie(client, BossHud_Cookie, sValue); 141 | } 142 | else 143 | PrintToChat(client, "[SM] You do not have access to this command."); 144 | return Plugin_Handled; 145 | } 146 | 147 | bool IsValidClient(int client, bool nobots = true) 148 | { 149 | if (client <= 0 || client > MaxClients || !IsClientConnected(client) || (nobots && IsFakeClient(client))) 150 | { 151 | return false; 152 | } 153 | return IsClientInGame(client); 154 | } 155 | 156 | public void SendHudMsg(int client, char[] szMessage) 157 | { 158 | if(!IsPlayerGenericAdmin(client) && AdminOnly) 159 | return; 160 | 161 | if(DisplayType == 0) 162 | { 163 | SetHudTextParams(HudPos[0], HudPos[1], 3.0, HudColor[0], HudColor[1], HudColor[2], 255, 0, 0.0, 0.0, 0.0); 164 | ClearSyncHud(client, HudSync); 165 | ShowSyncHudText(client, HudSync, szMessage); 166 | } 167 | else 168 | { 169 | int rgb; 170 | rgb |= ((HudColor[0] & 0xFF) << 16); 171 | rgb |= ((HudColor[1] & 0xFF) << 8 ); 172 | rgb |= ((HudColor[2] & 0xFF) << 0 ); 173 | PrintCenterText(client, "%s", rgb, szMessage); 174 | } 175 | } 176 | 177 | public void OnDamage(const char[] output, int caller, int activator, float delay) 178 | { 179 | if(IsValidClient(activator) && g_bStatus[activator] && (IsPlayerGenericAdmin(activator) || !AdminOnly)) 180 | { 181 | char szName[64], szString[96]; 182 | GetEntPropString(caller, Prop_Data, "m_iName", szName, sizeof(szName)); 183 | 184 | if(strlen(szName) == 0) 185 | Format(szName, sizeof(szName), "Health"); 186 | 187 | int health = GetEntProp(caller, Prop_Data, "m_iHealth"); 188 | 189 | if(health > 0 && health <= 900000) 190 | { 191 | if(HudSymbols) 192 | Format(szString, sizeof(szString), ">> %s: %i HP <<", szName, health); 193 | else 194 | Format(szString, sizeof(szString), "%s: %i HP", szName, health); 195 | 196 | SendHudMsg(activator, szString); 197 | 198 | entityID[activator] = caller; 199 | 200 | g_iTimer[activator] = GetTime(); 201 | } 202 | } 203 | } 204 | 205 | public void OnDamageCounter(const char[] output, int caller, int activator, float delay) 206 | { 207 | if(IsValidClient(activator) && g_bStatus[activator] && (IsPlayerGenericAdmin(activator) || !AdminOnly)) 208 | { 209 | char szName[64], szString[96]; 210 | GetEntPropString(caller, Prop_Data, "m_iName", szName, sizeof(szName)); 211 | 212 | if(strlen(szName) == 0) 213 | Format(szName, sizeof(szName), "Health"); 214 | 215 | static int offset = -1; 216 | if (offset == -1) 217 | offset = FindDataMapInfo(caller, "m_OutValue"); 218 | 219 | int health = RoundFloat(GetEntDataFloat(caller, offset)); 220 | 221 | if(HudSymbols) 222 | Format(szString, sizeof(szString), ">> %s: %i HP <<", szName, health); 223 | else 224 | Format(szString, sizeof(szString), "%s: %i HP", szName, health); 225 | 226 | SendHudMsg(activator, szString); 227 | 228 | entityID[activator] = caller; 229 | 230 | g_iTimer[activator] = GetTime(); 231 | } 232 | } 233 | 234 | public Action Command_CHP(int client, int argc) 235 | { 236 | if(!IsValidEntity(entityID[client])) 237 | { 238 | PrintToChat(client, "[SM] Current entity is invalid (id %i)", entityID[client]); 239 | return Plugin_Handled; 240 | } 241 | 242 | char szName[64], szType[64]; 243 | int health; 244 | GetEntityClassname(entityID[client], szType, sizeof(szType)); 245 | GetEntPropString(entityID[client], Prop_Data, "m_iName", szName, sizeof(szName)); 246 | 247 | if(StrEqual(szType, "math_counter", false)) 248 | { 249 | static int offset = -1; 250 | if (offset == -1) 251 | offset = FindDataMapInfo(entityID[client], "m_OutValue"); 252 | 253 | health = RoundFloat(GetEntDataFloat(entityID[client], offset)); 254 | } 255 | else 256 | { 257 | health = GetEntProp(entityID[client], Prop_Data, "m_iHealth"); 258 | } 259 | 260 | PrintToChat(client, "[SM] Entity %s %i (%s): %i HP", szName, entityID[client], szType, health); 261 | return Plugin_Handled; 262 | } 263 | 264 | public Action Command_SHP(int client, int argc) 265 | { 266 | if(!IsValidEntity(entityID[client])) 267 | { 268 | PrintToChat(client, "[SM] Current entity is invalid (id %i)", entityID[client]); 269 | return Plugin_Handled; 270 | } 271 | 272 | if (argc < 1) 273 | { 274 | ReplyToCommand(client, "[SM] Usage: sm_subtracthp "); 275 | return Plugin_Handled; 276 | } 277 | 278 | char szName[64], szType[64], arg[8]; 279 | int health; 280 | 281 | GetEntityClassname(entityID[client], szType, sizeof(szType)); 282 | GetEntPropString(entityID[client], Prop_Data, "m_iName", szName, sizeof(szName)); 283 | GetCmdArg(1, arg, sizeof(arg)); 284 | SetVariantInt(StringToInt(arg)); 285 | 286 | if(StrEqual(szType, "math_counter", false)) 287 | { 288 | static int offset = -1; 289 | if (offset == -1) 290 | offset = FindDataMapInfo(entityID[client], "m_OutValue"); 291 | 292 | health = RoundFloat(GetEntDataFloat(entityID[client], offset)); 293 | AcceptEntityInput(entityID[client], "Subtract", client, client); 294 | PrintToChat(client, "[SM] %i health subtracted. (%i HP to %i HP)", StringToInt(arg), health, health - StringToInt(arg)); 295 | } 296 | else 297 | { 298 | health = GetEntProp(entityID[client], Prop_Data, "m_iHealth"); 299 | AcceptEntityInput(entityID[client], "RemoveHealth", client, client); 300 | PrintToChat(client, "[SM] %i health subtracted. (%i HP to %i HP)", StringToInt(arg), health, health - StringToInt(arg)); 301 | } 302 | 303 | return Plugin_Handled; 304 | } 305 | 306 | public Action UpdateHUD(Handle timer, any client) 307 | { 308 | for(int i = 1; i <= MaxClients; i++) 309 | { 310 | if(IsValidClient(i) && g_bStatus[i] && IsValidEntity(entityID[i]) && (IsPlayerGenericAdmin(i) || !AdminOnly)) 311 | { 312 | int time = GetTime() - g_iTimer[i]; 313 | if (time > UpdateTime) 314 | continue; 315 | 316 | char szName[64], szType[64], szString[96]; 317 | int health; 318 | 319 | GetEntityClassname(entityID[i], szType, sizeof(szType)); 320 | GetEntPropString(entityID[i], Prop_Data, "m_iName", szName, sizeof(szName)); 321 | 322 | if(strlen(szName) == 0) 323 | Format(szName, sizeof(szName), "Health"); 324 | 325 | if(StrEqual(szType, "math_counter", false)) 326 | { 327 | static int offset = -1; 328 | if (offset == -1) 329 | offset = FindDataMapInfo(entityID[i], "m_OutValue"); 330 | 331 | health = RoundFloat(GetEntDataFloat(entityID[i], offset)); 332 | } 333 | else 334 | { 335 | health = GetEntProp(entityID[i], Prop_Data, "m_iHealth"); 336 | } 337 | 338 | if(health <= 0 || health > 900000) 339 | continue; 340 | 341 | if(HudSymbols) 342 | Format(szString, sizeof(szString), ">> %s: %i HP <<", szName, health); 343 | else 344 | Format(szString, sizeof(szString), "%s: %i HP", szName, health); 345 | 346 | SendHudMsg(i, szString); 347 | } 348 | } 349 | } 350 | 351 | public bool IsPlayerGenericAdmin(int client) 352 | { 353 | return CheckCommandAccess(client, "generic_admin", ADMFLAG_GENERIC, false); 354 | } 355 | -------------------------------------------------------------------------------- /bhud2_nomax.sp: -------------------------------------------------------------------------------- 1 | #pragma semicolon 1 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | #define PLUGIN_VERSION "2.4_nomax" 9 | #pragma newdecls required 10 | 11 | Handle BossHud_Cookie = INVALID_HANDLE, HudSync = INVALID_HANDLE; 12 | bool g_bStatus[MAXPLAYERS+1] = {false, ...}; 13 | int entityID[MAXPLAYERS+1] = -1; 14 | ConVar g_cVHudPosition, g_cVHudColor, g_cVHudSymbols, g_cVUpdateTime, g_cVDisplayType, g_cVAdminOnly; 15 | float HudPos[2]; 16 | int HudColor[3]; 17 | int UpdateTime; 18 | int DisplayType; 19 | int g_iTimer[MAXPLAYERS+1]; 20 | bool HudSymbols; 21 | bool AdminOnly; 22 | 23 | public Plugin myinfo = { 24 | name = "BossHud", 25 | author = "AntiTeal", 26 | description = "", 27 | version = PLUGIN_VERSION, 28 | url = "antiteal.com" 29 | }; 30 | 31 | public void OnPluginStart() 32 | { 33 | CreateConVar("sm_bhud_version", PLUGIN_VERSION, "BHud Version", FCVAR_SPONLY|FCVAR_REPLICATED|FCVAR_NOTIFY); 34 | BossHud_Cookie = RegClientCookie("bhud_cookie", "Status of BHud", CookieAccess_Private); 35 | for(int i = 1; i <= MaxClients; i++) 36 | { 37 | if (!AreClientCookiesCached(i)) 38 | continue; 39 | OnClientCookiesCached(i); 40 | } 41 | 42 | RegConsoleCmd("sm_bhud", Command_BHud, "Toggle BHud"); 43 | 44 | HookEntityOutput("func_physbox", "OnHealthChanged", OnDamage); 45 | HookEntityOutput("func_physbox_multiplayer", "OnHealthChanged", OnDamage); 46 | HookEntityOutput("func_breakable", "OnHealthChanged", OnDamage); 47 | HookEntityOutput("math_counter", "OutValue", OnDamageCounter); 48 | 49 | RegAdminCmd("sm_currenthp", Command_CHP, ADMFLAG_GENERIC, "See Current HP"); 50 | RegAdminCmd("sm_subtracthp", Command_SHP, ADMFLAG_GENERIC, "Subtract Current HP"); 51 | RegAdminCmd("sm_addhp", Command_AHP, ADMFLAG_GENERIC, "Add Current HP"); 52 | 53 | g_cVHudPosition = CreateConVar("sm_bhud_position", "-1.0 0.09", "The X and Y position for the hud."); 54 | g_cVHudColor = CreateConVar("sm_bhud_color", "255 0 0", "RGB color value for the hud."); 55 | g_cVHudSymbols = CreateConVar("sm_bhud_symbols", "1", "Determines whether >> and << are wrapped around the text."); 56 | g_cVUpdateTime = CreateConVar("sm_bhud_updatetime", "3", "How long to update the client's hud with current health for."); 57 | g_cVDisplayType = CreateConVar("sm_bhud_displaytype", "0", "Display type of HUD. (0 = game_text, 1 = center text)"); 58 | g_cVAdminOnly = CreateConVar("sm_bhud_adminonly", "0", "Determines whether BHUD is public or admin only. (0 = public, 1 = admins)"); 59 | 60 | g_cVHudPosition.AddChangeHook(ConVarChange); 61 | g_cVHudColor.AddChangeHook(ConVarChange); 62 | g_cVHudSymbols.AddChangeHook(ConVarChange); 63 | g_cVUpdateTime.AddChangeHook(ConVarChange); 64 | g_cVDisplayType.AddChangeHook(ConVarChange); 65 | g_cVAdminOnly.AddChangeHook(ConVarChange); 66 | 67 | AutoExecConfig(true); 68 | GetConVars(); 69 | 70 | CreateTimer(0.25, UpdateHUD, _, TIMER_REPEAT); 71 | } 72 | 73 | public void OnClientConnected(int client) 74 | { 75 | g_iTimer[client] = 0; 76 | } 77 | 78 | public void ColorStringToArray(const char[] sColorString, int aColor[3]) 79 | { 80 | char asColors[4][4]; 81 | ExplodeString(sColorString, " ", asColors, sizeof(asColors), sizeof(asColors[])); 82 | 83 | aColor[0] = StringToInt(asColors[0]); 84 | aColor[1] = StringToInt(asColors[1]); 85 | aColor[2] = StringToInt(asColors[2]); 86 | } 87 | 88 | public void GetConVars() 89 | { 90 | char StringPos[2][8]; 91 | char PosValue[16]; 92 | g_cVHudPosition.GetString(PosValue, sizeof(PosValue)); 93 | ExplodeString(PosValue, " ", StringPos, sizeof(StringPos), sizeof(StringPos[])); 94 | 95 | HudPos[0] = StringToFloat(StringPos[0]); 96 | HudPos[1] = StringToFloat(StringPos[1]); 97 | 98 | char ColorValue[64]; 99 | g_cVHudColor.GetString(ColorValue, sizeof(ColorValue)); 100 | 101 | ColorStringToArray(ColorValue, HudColor); 102 | 103 | HudSymbols = g_cVHudSymbols.BoolValue; 104 | AdminOnly = g_cVAdminOnly.BoolValue; 105 | UpdateTime = g_cVUpdateTime.IntValue; 106 | DisplayType = g_cVDisplayType.IntValue; 107 | } 108 | 109 | public void ConVarChange(ConVar convar, char[] oldValue, char[] newValue) 110 | { 111 | GetConVars(); 112 | } 113 | 114 | public void OnMapStart() 115 | { 116 | HudSync = CreateHudSynchronizer(); 117 | } 118 | public void OnMapEnd() 119 | { 120 | if(HudSync != INVALID_HANDLE) 121 | { 122 | CloseHandle(HudSync); 123 | HudSync = INVALID_HANDLE; 124 | } 125 | } 126 | 127 | public void OnClientCookiesCached(int client) 128 | { 129 | char sValue[8]; 130 | GetClientCookie(client, BossHud_Cookie, sValue, sizeof(sValue)); 131 | g_bStatus[client] = (sValue[0] != '\0' && StringToInt(sValue)); 132 | } 133 | 134 | public Action Command_BHud(int client, int argc) 135 | { 136 | if(IsPlayerGenericAdmin(client) || !AdminOnly) 137 | { 138 | char sValue[8]; 139 | g_bStatus[client] = !g_bStatus[client]; 140 | PrintToChat(client, "[SM] BHud has been %s.", g_bStatus[client] ? "enabled" : "disabled"); 141 | Format(sValue, sizeof(sValue), "%i", g_bStatus[client]); 142 | SetClientCookie(client, BossHud_Cookie, sValue); 143 | } 144 | else 145 | PrintToChat(client, "[SM] You do not have access to this command."); 146 | return Plugin_Handled; 147 | } 148 | 149 | bool IsValidClient(int client, bool nobots = true) 150 | { 151 | if (client <= 0 || client > MaxClients || !IsClientConnected(client) || (nobots && IsFakeClient(client))) 152 | { 153 | return false; 154 | } 155 | return IsClientInGame(client); 156 | } 157 | 158 | public void SendHudMsg(int client, char szMessage[128]) 159 | { 160 | if(!IsPlayerGenericAdmin(client) && AdminOnly) 161 | return; 162 | 163 | if(DisplayType == 0) 164 | { 165 | SetHudTextParams(HudPos[0], HudPos[1], 3.0, HudColor[0], HudColor[1], HudColor[2], 255, 0, 0.0, 0.0, 0.0); 166 | ClearSyncHud(client, HudSync); 167 | ShowSyncHudText(client, HudSync, "%s", szMessage); 168 | } 169 | else 170 | { 171 | int rgb; 172 | rgb |= ((HudColor[0] & 0xFF) << 16); 173 | rgb |= ((HudColor[1] & 0xFF) << 8 ); 174 | rgb |= ((HudColor[2] & 0xFF) << 0 ); 175 | ReplaceString(szMessage, sizeof(szMessage), "<", "<"); 176 | PrintCenterText(client, "%s", rgb, szMessage); 177 | } 178 | } 179 | 180 | public void OnDamage(const char[] output, int caller, int activator, float delay) 181 | { 182 | if(IsValidClient(activator) && g_bStatus[activator] && (IsPlayerGenericAdmin(activator) || !AdminOnly)) 183 | { 184 | char szName[64], szString[128]; 185 | GetEntPropString(caller, Prop_Data, "m_iName", szName, sizeof(szName)); 186 | 187 | if(strlen(szName) == 0) 188 | Format(szName, sizeof(szName), "Health"); 189 | 190 | int health = GetEntProp(caller, Prop_Data, "m_iHealth"); 191 | 192 | if(health > 0 && health <= 900000) 193 | { 194 | if(HudSymbols) 195 | Format(szString, sizeof(szString), ">> %s: %i HP <<", szName, health); 196 | else 197 | Format(szString, sizeof(szString), "%s: %i HP", szName, health); 198 | 199 | SendHudMsg(activator, szString); 200 | 201 | entityID[activator] = caller; 202 | 203 | g_iTimer[activator] = GetTime(); 204 | } 205 | } 206 | } 207 | 208 | public void OnDamageCounter(const char[] output, int caller, int activator, float delay) 209 | { 210 | if(IsValidClient(activator) && g_bStatus[activator] && (IsPlayerGenericAdmin(activator) || !AdminOnly)) 211 | { 212 | char szName[64], szString[128]; 213 | GetEntPropString(caller, Prop_Data, "m_iName", szName, sizeof(szName)); 214 | 215 | if(strlen(szName) == 0) 216 | Format(szName, sizeof(szName), "Health"); 217 | 218 | static int offset = -1; 219 | if (offset == -1) 220 | offset = FindDataMapInfo(caller, "m_OutValue"); 221 | 222 | int health = RoundFloat(GetEntDataFloat(caller, offset)); 223 | 224 | if(HudSymbols) 225 | Format(szString, sizeof(szString), ">> %s: %i HP <<", szName, health); 226 | else 227 | Format(szString, sizeof(szString), "%s: %i HP", szName, health); 228 | 229 | SendHudMsg(activator, szString); 230 | 231 | entityID[activator] = caller; 232 | 233 | g_iTimer[activator] = GetTime(); 234 | } 235 | } 236 | 237 | public Action Command_CHP(int client, int argc) 238 | { 239 | if(!IsValidEntity(entityID[client])) 240 | { 241 | PrintToChat(client, "[SM] Current entity is invalid (id %i)", entityID[client]); 242 | return Plugin_Handled; 243 | } 244 | 245 | char szName[64], szType[64]; 246 | int health; 247 | GetEntityClassname(entityID[client], szType, sizeof(szType)); 248 | GetEntPropString(entityID[client], Prop_Data, "m_iName", szName, sizeof(szName)); 249 | 250 | if(StrEqual(szType, "math_counter", false)) 251 | { 252 | static int offset = -1; 253 | if (offset == -1) 254 | offset = FindDataMapInfo(entityID[client], "m_OutValue"); 255 | 256 | health = RoundFloat(GetEntDataFloat(entityID[client], offset)); 257 | } 258 | else 259 | { 260 | health = GetEntProp(entityID[client], Prop_Data, "m_iHealth"); 261 | } 262 | 263 | PrintToChat(client, "[SM] Entity %s %i (%s): %i HP", szName, entityID[client], szType, health); 264 | return Plugin_Handled; 265 | } 266 | 267 | public Action Command_SHP(int client, int argc) 268 | { 269 | if(!IsValidEntity(entityID[client])) 270 | { 271 | PrintToChat(client, "[SM] Current entity is invalid (id %i)", entityID[client]); 272 | return Plugin_Handled; 273 | } 274 | 275 | if (argc < 1) 276 | { 277 | ReplyToCommand(client, "[SM] Usage: sm_subtracthp "); 278 | return Plugin_Handled; 279 | } 280 | 281 | char szName[64], szType[64], arg[8]; 282 | int health; 283 | 284 | GetEntityClassname(entityID[client], szType, sizeof(szType)); 285 | GetEntPropString(entityID[client], Prop_Data, "m_iName", szName, sizeof(szName)); 286 | GetCmdArg(1, arg, sizeof(arg)); 287 | SetVariantInt(StringToInt(arg)); 288 | 289 | if(StrEqual(szType, "math_counter", false)) 290 | { 291 | static int offset = -1; 292 | if (offset == -1) 293 | offset = FindDataMapInfo(entityID[client], "m_OutValue"); 294 | 295 | health = RoundFloat(GetEntDataFloat(entityID[client], offset)); 296 | AcceptEntityInput(entityID[client], "Subtract", client, client); 297 | PrintToChat(client, "[SM] %i health subtracted. (%i HP to %i HP)", StringToInt(arg), health, health - StringToInt(arg)); 298 | } 299 | else 300 | { 301 | health = GetEntProp(entityID[client], Prop_Data, "m_iHealth"); 302 | AcceptEntityInput(entityID[client], "RemoveHealth", client, client); 303 | PrintToChat(client, "[SM] %i health subtracted. (%i HP to %i HP)", StringToInt(arg), health, health - StringToInt(arg)); 304 | } 305 | 306 | return Plugin_Handled; 307 | } 308 | 309 | public Action Command_AHP(int client, int argc) 310 | { 311 | if(!IsValidEntity(entityID[client])) 312 | { 313 | PrintToChat(client, "[SM] Current entity is invalid (id %i)", entityID[client]); 314 | return Plugin_Handled; 315 | } 316 | 317 | if (argc < 1) 318 | { 319 | ReplyToCommand(client, "[SM] Usage: sm_addhp "); 320 | return Plugin_Handled; 321 | } 322 | 323 | char szName[64], szType[64], arg[8]; 324 | int health; 325 | 326 | GetEntityClassname(entityID[client], szType, sizeof(szType)); 327 | GetEntPropString(entityID[client], Prop_Data, "m_iName", szName, sizeof(szName)); 328 | GetCmdArg(1, arg, sizeof(arg)); 329 | SetVariantInt(StringToInt(arg)); 330 | 331 | if(StrEqual(szType, "math_counter", false)) 332 | { 333 | static int offset = -1; 334 | if (offset == -1) 335 | offset = FindDataMapInfo(entityID[client], "m_OutValue"); 336 | 337 | health = RoundFloat(GetEntDataFloat(entityID[client], offset)); 338 | AcceptEntityInput(entityID[client], "Add", client, client); 339 | PrintToChat(client, "[SM] %i health added. (%i HP to %i HP)", StringToInt(arg), health, health + StringToInt(arg)); 340 | } 341 | else 342 | { 343 | health = GetEntProp(entityID[client], Prop_Data, "m_iHealth"); 344 | AcceptEntityInput(entityID[client], "AddHealth", client, client); 345 | PrintToChat(client, "[SM] %i health added. (%i HP to %i HP)", StringToInt(arg), health, health + StringToInt(arg)); 346 | } 347 | 348 | return Plugin_Handled; 349 | } 350 | 351 | public Action UpdateHUD(Handle timer, any client) 352 | { 353 | for(int i = 1; i <= MaxClients; i++) 354 | { 355 | if(IsValidClient(i) && g_bStatus[i] && IsValidEntity(entityID[i]) && (IsPlayerGenericAdmin(i) || !AdminOnly)) 356 | { 357 | int time = GetTime() - g_iTimer[i]; 358 | if (time > UpdateTime) 359 | continue; 360 | 361 | char szName[64], szType[64], szString[128]; 362 | int health; 363 | 364 | GetEntityClassname(entityID[i], szType, sizeof(szType)); 365 | GetEntPropString(entityID[i], Prop_Data, "m_iName", szName, sizeof(szName)); 366 | 367 | if(strlen(szName) == 0) 368 | Format(szName, sizeof(szName), "Health"); 369 | 370 | if(StrEqual(szType, "math_counter", false)) 371 | { 372 | static int offset = -1; 373 | if (offset == -1) 374 | offset = FindDataMapInfo(entityID[i], "m_OutValue"); 375 | 376 | health = RoundFloat(GetEntDataFloat(entityID[i], offset)); 377 | } 378 | else 379 | { 380 | health = GetEntProp(entityID[i], Prop_Data, "m_iHealth"); 381 | } 382 | 383 | if(health <= 0 || health > 900000) 384 | continue; 385 | 386 | if(HudSymbols) 387 | Format(szString, sizeof(szString), ">> %s: %i HP <<", szName, health); 388 | else 389 | Format(szString, sizeof(szString), "%s: %i HP", szName, health); 390 | 391 | SendHudMsg(i, szString); 392 | } 393 | } 394 | } 395 | 396 | public bool IsPlayerGenericAdmin(int client) 397 | { 398 | return CheckCommandAccess(client, "generic_admin", ADMFLAG_GENERIC, false); 399 | } 400 | -------------------------------------------------------------------------------- /compiled/ExtraCommands.smx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/strellic/sourcemod-plugins/da6c2e702cde59f3e24b56d339e0ca27deb23b85/compiled/ExtraCommands.smx -------------------------------------------------------------------------------- /compiled/PrettyColors_SB.smx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/strellic/sourcemod-plugins/da6c2e702cde59f3e24b56d339e0ca27deb23b85/compiled/PrettyColors_SB.smx -------------------------------------------------------------------------------- /compiled/Spectate.smx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/strellic/sourcemod-plugins/da6c2e702cde59f3e24b56d339e0ca27deb23b85/compiled/Spectate.smx -------------------------------------------------------------------------------- /compiled/bhud2.smx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/strellic/sourcemod-plugins/da6c2e702cde59f3e24b56d339e0ca27deb23b85/compiled/bhud2.smx -------------------------------------------------------------------------------- /compiled/bhud2_nomax.smx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/strellic/sourcemod-plugins/da6c2e702cde59f3e24b56d339e0ca27deb23b85/compiled/bhud2_nomax.smx -------------------------------------------------------------------------------- /compiled/breakablehud.smx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/strellic/sourcemod-plugins/da6c2e702cde59f3e24b56d339e0ca27deb23b85/compiled/breakablehud.smx -------------------------------------------------------------------------------- /compiled/countdownhud.smx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/strellic/sourcemod-plugins/da6c2e702cde59f3e24b56d339e0ca27deb23b85/compiled/countdownhud.smx -------------------------------------------------------------------------------- /compiled/deadmute.smx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/strellic/sourcemod-plugins/da6c2e702cde59f3e24b56d339e0ca27deb23b85/compiled/deadmute.smx -------------------------------------------------------------------------------- /compiled/entWatch (kinda broken).smx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/strellic/sourcemod-plugins/da6c2e702cde59f3e24b56d339e0ca27deb23b85/compiled/entWatch (kinda broken).smx -------------------------------------------------------------------------------- /compiled/entWatch.smx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/strellic/sourcemod-plugins/da6c2e702cde59f3e24b56d339e0ca27deb23b85/compiled/entWatch.smx -------------------------------------------------------------------------------- /compiled/forceinput.smx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/strellic/sourcemod-plugins/da6c2e702cde59f3e24b56d339e0ca27deb23b85/compiled/forceinput.smx -------------------------------------------------------------------------------- /compiled/glowcolors.smx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/strellic/sourcemod-plugins/da6c2e702cde59f3e24b56d339e0ca27deb23b85/compiled/glowcolors.smx -------------------------------------------------------------------------------- /compiled/godelites.smx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/strellic/sourcemod-plugins/da6c2e702cde59f3e24b56d339e0ca27deb23b85/compiled/godelites.smx -------------------------------------------------------------------------------- /compiled/gunshop2.smx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/strellic/sourcemod-plugins/da6c2e702cde59f3e24b56d339e0ca27deb23b85/compiled/gunshop2.smx -------------------------------------------------------------------------------- /compiled/icecap_extreme.smx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/strellic/sourcemod-plugins/da6c2e702cde59f3e24b56d339e0ca27deb23b85/compiled/icecap_extreme.smx -------------------------------------------------------------------------------- /compiled/leader2.smx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/strellic/sourcemod-plugins/da6c2e702cde59f3e24b56d339e0ca27deb23b85/compiled/leader2.smx -------------------------------------------------------------------------------- /compiled/logconnections_admin.smx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/strellic/sourcemod-plugins/da6c2e702cde59f3e24b56d339e0ca27deb23b85/compiled/logconnections_admin.smx -------------------------------------------------------------------------------- /compiled/mirror_csgo.smx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/strellic/sourcemod-plugins/da6c2e702cde59f3e24b56d339e0ca27deb23b85/compiled/mirror_csgo.smx -------------------------------------------------------------------------------- /compiled/mutedead.smx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/strellic/sourcemod-plugins/da6c2e702cde59f3e24b56d339e0ca27deb23b85/compiled/mutedead.smx -------------------------------------------------------------------------------- /compiled/muteonvote_teal.smx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/strellic/sourcemod-plugins/da6c2e702cde59f3e24b56d339e0ca27deb23b85/compiled/muteonvote_teal.smx -------------------------------------------------------------------------------- /compiled/particlelog.smx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/strellic/sourcemod-plugins/da6c2e702cde59f3e24b56d339e0ca27deb23b85/compiled/particlelog.smx -------------------------------------------------------------------------------- /compiled/skillbot.smx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/strellic/sourcemod-plugins/da6c2e702cde59f3e24b56d339e0ca27deb23b85/compiled/skillbot.smx -------------------------------------------------------------------------------- /compiled/skillbot_cptags.smx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/strellic/sourcemod-plugins/da6c2e702cde59f3e24b56d339e0ca27deb23b85/compiled/skillbot_cptags.smx -------------------------------------------------------------------------------- /compiled/skillbot_perks.smx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/strellic/sourcemod-plugins/da6c2e702cde59f3e24b56d339e0ca27deb23b85/compiled/skillbot_perks.smx -------------------------------------------------------------------------------- /compiled/skillbot_scptags.smx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/strellic/sourcemod-plugins/da6c2e702cde59f3e24b56d339e0ca27deb23b85/compiled/skillbot_scptags.smx -------------------------------------------------------------------------------- /compiled/skillbot_togtags.smx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/strellic/sourcemod-plugins/da6c2e702cde59f3e24b56d339e0ca27deb23b85/compiled/skillbot_togtags.smx -------------------------------------------------------------------------------- /compiled/sm_showname.smx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/strellic/sourcemod-plugins/da6c2e702cde59f3e24b56d339e0ca27deb23b85/compiled/sm_showname.smx -------------------------------------------------------------------------------- /compiled/sm_spawnlaser.smx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/strellic/sourcemod-plugins/da6c2e702cde59f3e24b56d339e0ca27deb23b85/compiled/sm_spawnlaser.smx -------------------------------------------------------------------------------- /compiled/spectate_zeddy.smx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/strellic/sourcemod-plugins/da6c2e702cde59f3e24b56d339e0ca27deb23b85/compiled/spectate_zeddy.smx -------------------------------------------------------------------------------- /compiled/stopsounds_zeddy.smx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/strellic/sourcemod-plugins/da6c2e702cde59f3e24b56d339e0ca27deb23b85/compiled/stopsounds_zeddy.smx -------------------------------------------------------------------------------- /countdownhud.sp: -------------------------------------------------------------------------------- 1 | #pragma semicolon 1 2 | #include 3 | #include 4 | #include 5 | 6 | #pragma newdecls required 7 | #define MAXLENGTH_INPUT 128 8 | #define PLUGIN_VERSION "1.6" 9 | 10 | int number, onumber; 11 | Handle timerHandle = INVALID_HANDLE, HudSync, CountdownHUD_Cookie = INVALID_HANDLE; 12 | 13 | public Plugin myinfo = 14 | { 15 | name = "Countdown HUD", 16 | author = "AntiTeal", 17 | description = "Countdown timers based on messages from maps.", 18 | version = PLUGIN_VERSION, 19 | url = "http://antiteal.com" 20 | } 21 | 22 | ConVar g_cVHudPosition, g_cVHudColor, g_cVHudSymbols; 23 | 24 | float HudPos[2]; 25 | int HudColor[3]; 26 | bool HudSymbols; 27 | bool g_bStatus[MAXPLAYERS+1] = {false, ...}; 28 | 29 | public void OnPluginStart() 30 | { 31 | CreateConVar("sm_cdhud_version", PLUGIN_VERSION, "CountdownHUD Version", FCVAR_SPONLY|FCVAR_REPLICATED|FCVAR_NOTIFY); 32 | 33 | AddCommandListener(Chat, "say"); 34 | HookEvent("round_start", Event_RoundStart, EventHookMode_PostNoCopy); 35 | 36 | DeleteTimer(); 37 | HudSync = CreateHudSynchronizer(); 38 | 39 | g_cVHudPosition = CreateConVar("sm_cdhud_position", "-1.0 0.125", "The X and Y position for the hud."); 40 | g_cVHudColor = CreateConVar("sm_cdhud_color", "0 255 0", "RGB color value for the hud."); 41 | g_cVHudSymbols = CreateConVar("sm_cdhud_symbols", "1", "Determines whether >> and << are wrapped around the text."); 42 | 43 | g_cVHudPosition.AddChangeHook(ConVarChange); 44 | g_cVHudColor.AddChangeHook(ConVarChange); 45 | g_cVHudSymbols.AddChangeHook(ConVarChange); 46 | 47 | AutoExecConfig(true); 48 | GetConVars(); 49 | 50 | CountdownHUD_Cookie = RegClientCookie("cdhudoff_cookie", "Is CDHud off?", CookieAccess_Protected); 51 | for(int i = 1; i <= MaxClients; i++) 52 | { 53 | if (!AreClientCookiesCached(i)) 54 | continue; 55 | OnClientCookiesCached(i); 56 | } 57 | 58 | RegConsoleCmd("sm_cdhud", Command_CDHud, "Toggle CDHud"); 59 | } 60 | 61 | public void OnClientCookiesCached(int client) 62 | { 63 | char sValue[8]; 64 | GetClientCookie(client, CountdownHUD_Cookie, sValue, sizeof(sValue)); 65 | g_bStatus[client] = (sValue[0] == '\0' || !StringToInt(sValue)); 66 | } 67 | 68 | public Action Command_CDHud(int client, int argc) 69 | { 70 | char sValue[8]; 71 | g_bStatus[client] = !g_bStatus[client]; 72 | PrintToChat(client, "[SM] CDHud has been %s.", g_bStatus[client] ? "enabled" : "disabled"); 73 | Format(sValue, sizeof(sValue), "%i", !g_bStatus[client]); 74 | SetClientCookie(client, CountdownHUD_Cookie, sValue); 75 | return Plugin_Handled; 76 | } 77 | 78 | public void ColorStringToArray(const char[] sColorString, int aColor[3]) 79 | { 80 | char asColors[4][4]; 81 | ExplodeString(sColorString, " ", asColors, sizeof(asColors), sizeof(asColors[])); 82 | 83 | aColor[0] = StringToInt(asColors[0]); 84 | aColor[1] = StringToInt(asColors[1]); 85 | aColor[2] = StringToInt(asColors[2]); 86 | } 87 | 88 | public void GetConVars() 89 | { 90 | char StringPos[2][8]; 91 | char PosValue[16]; 92 | g_cVHudPosition.GetString(PosValue, sizeof(PosValue)); 93 | ExplodeString(PosValue, " ", StringPos, sizeof(StringPos), sizeof(StringPos[])); 94 | 95 | HudPos[0] = StringToFloat(StringPos[0]); 96 | HudPos[1] = StringToFloat(StringPos[1]); 97 | 98 | char ColorValue[64]; 99 | g_cVHudColor.GetString(ColorValue, sizeof(ColorValue)); 100 | 101 | ColorStringToArray(ColorValue, HudColor); 102 | 103 | HudSymbols = g_cVHudSymbols.BoolValue; 104 | } 105 | 106 | public void ConVarChange(ConVar convar, char[] oldValue, char[] newValue) 107 | { 108 | GetConVars(); 109 | } 110 | 111 | public void Event_RoundStart(Handle event, const char[] name, bool dontBroadcast) 112 | { 113 | DeleteTimer(); 114 | } 115 | 116 | public void DeleteTimer() 117 | { 118 | if(timerHandle != INVALID_HANDLE) 119 | { 120 | KillTimer(timerHandle); 121 | timerHandle = INVALID_HANDLE; 122 | } 123 | } 124 | 125 | char Blacklist[][] = { 126 | "recharge", "recast", "cooldown", "cool" 127 | }; 128 | 129 | bool CheckString(char[] string) 130 | { 131 | for (int i = 0; i < sizeof(Blacklist); i++) 132 | { 133 | if(StrContains(string, Blacklist[i], false) != -1) 134 | { 135 | return true; 136 | } 137 | } 138 | return false; 139 | } 140 | 141 | public Action Chat(int client, const char[] command, int argc) 142 | { 143 | if(client) 144 | { 145 | return Plugin_Continue; 146 | } 147 | 148 | char ConsoleChat[MAXLENGTH_INPUT], FilterText[sizeof(ConsoleChat)+1], ChatArray[32][MAXLENGTH_INPUT]; 149 | int consoleNumber, filterPos; 150 | bool isCountable; 151 | 152 | GetCmdArgString(ConsoleChat, sizeof(ConsoleChat)); 153 | 154 | for (int i = 0; i < sizeof(ConsoleChat); i++) 155 | { 156 | if (IsCharAlpha(ConsoleChat[i]) || IsCharNumeric(ConsoleChat[i]) || IsCharSpace(ConsoleChat[i])) 157 | { 158 | FilterText[filterPos++] = ConsoleChat[i]; 159 | } 160 | } 161 | FilterText[filterPos] = '\0'; 162 | TrimString(FilterText); 163 | 164 | if(CheckString(ConsoleChat)) 165 | { 166 | return Plugin_Handled; 167 | } 168 | 169 | int words = ExplodeString(FilterText, " ", ChatArray, sizeof(ChatArray), sizeof(ChatArray[])); 170 | 171 | if(words == 1) 172 | { 173 | if(StringToInt(ChatArray[0]) != 0) 174 | { 175 | isCountable = true; 176 | consoleNumber = StringToInt(ChatArray[0]); 177 | } 178 | } 179 | 180 | for(int i = 0; i <= words; i++) 181 | { 182 | if(StringToInt(ChatArray[i]) != 0) 183 | { 184 | if(i + 1 <= words && (StrEqual(ChatArray[i + 1], "s", false) || (CharEqual(ChatArray[i + 1][0], 's') && CharEqual(ChatArray[i + 1][1], 'e')))) 185 | { 186 | consoleNumber = StringToInt(ChatArray[i]); 187 | isCountable = true; 188 | } 189 | if(!isCountable && i + 2 <= words && (StrEqual(ChatArray[i + 2], "s", false) || (CharEqual(ChatArray[i + 2][0], 's') && CharEqual(ChatArray[i + 2][1], 'e')))) 190 | { 191 | consoleNumber = StringToInt(ChatArray[i]); 192 | isCountable = true; 193 | } 194 | } 195 | if(!isCountable) 196 | { 197 | char word[MAXLENGTH_INPUT]; 198 | strcopy(word, sizeof(word), ChatArray[i]); 199 | int len = strlen(word); 200 | 201 | if(IsCharNumeric(word[0])) 202 | { 203 | if(IsCharNumeric(word[1])) 204 | { 205 | if(IsCharNumeric(word[2])) 206 | { 207 | if(CharEqual(word[3], 's')) 208 | { 209 | consoleNumber = StringEnder(word, 5, len); 210 | isCountable = true; 211 | } 212 | } 213 | else if(CharEqual(word[2], 's')) 214 | { 215 | consoleNumber = StringEnder(word, 4, len); 216 | isCountable = true; 217 | } 218 | } 219 | else if(CharEqual(word[1], 's')) 220 | { 221 | consoleNumber = StringEnder(word, 3, len); 222 | isCountable = true; 223 | } 224 | } 225 | } 226 | if(isCountable) 227 | { 228 | number = consoleNumber; 229 | onumber = consoleNumber; 230 | InitCountDown(ConsoleChat); 231 | return Plugin_Handled; 232 | } 233 | } 234 | 235 | return Plugin_Handled; 236 | } 237 | 238 | public bool CharEqual(int a, int b) 239 | { 240 | if(a == b || a == CharToLower(b) || a == CharToUpper(b)) 241 | { 242 | return true; 243 | } 244 | return false; 245 | } 246 | 247 | public int StringEnder(char[] a, int b, int c) 248 | { 249 | if(CharEqual(a[b], 'c')) 250 | { 251 | a[c - 3] = '\0'; 252 | } 253 | else 254 | { 255 | a[c - 1] = '\0'; 256 | } 257 | return StringToInt(a); 258 | } 259 | 260 | public void InitCountDown(char[] text) 261 | { 262 | if(timerHandle != INVALID_HANDLE) 263 | { 264 | KillTimer(timerHandle); 265 | timerHandle = INVALID_HANDLE; 266 | } 267 | 268 | DataPack TimerPack; 269 | timerHandle = CreateDataTimer(1.0, RepeatMSG, TimerPack, TIMER_REPEAT); 270 | char text2[MAXLENGTH_INPUT + 10]; 271 | if(HudSymbols) 272 | { 273 | Format(text2, sizeof(text2), ">> %s <<", text); 274 | } 275 | else 276 | { 277 | Format(text2, sizeof(text2), "%s", text); 278 | } 279 | 280 | TimerPack.WriteString(text2); 281 | 282 | for (int i = 1; i <= MAXPLAYERS + 1; i++) 283 | { 284 | if(IsValidClient(i)) 285 | { 286 | SendHudMsg(i, text2); 287 | } 288 | } 289 | } 290 | 291 | 292 | public Action RepeatMSG(Handle timer, Handle pack) 293 | { 294 | number--; 295 | if(number <= 0) 296 | { 297 | DeleteTimer(); 298 | for (int i = 1; i <= MAXPLAYERS + 1; i++) 299 | { 300 | if(IsValidClient(i)) 301 | { 302 | ClearSyncHud(i, HudSync); 303 | } 304 | } 305 | return Plugin_Handled; 306 | } 307 | 308 | char string[MAXLENGTH_INPUT + 10], sNumber[8], sONumber[8]; 309 | ResetPack(pack); 310 | ReadPackString(pack, string, sizeof(string)); 311 | 312 | IntToString(onumber, sONumber, sizeof(sONumber)); 313 | IntToString(number, sNumber, sizeof(sNumber)); 314 | 315 | ReplaceString(string, sizeof(string), sONumber, sNumber); 316 | 317 | for (int i = 1; i <= MAXPLAYERS + 1; i++) 318 | { 319 | if(IsValidClient(i)) 320 | { 321 | SendHudMsg(i, string); 322 | } 323 | } 324 | return Plugin_Handled; 325 | } 326 | 327 | public void SendHudMsg(int client, char[] szMessage) 328 | { 329 | if(!g_bStatus[client]) 330 | return; 331 | 332 | SetHudTextParams(HudPos[0], HudPos[1], 1.0, HudColor[0], HudColor[1], HudColor[2], 255, 0, 0.0, 0.0, 0.0); 333 | ShowSyncHudText(client, HudSync, szMessage); 334 | } 335 | 336 | bool IsValidClient(int client, bool nobots = true) 337 | { 338 | if (client <= 0 || client > MaxClients || !IsClientConnected(client) || (nobots && IsFakeClient(client))) 339 | { 340 | return false; 341 | } 342 | return IsClientInGame(client); 343 | } 344 | -------------------------------------------------------------------------------- /deadmute.sp: -------------------------------------------------------------------------------- 1 | #pragma semicolon 1 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | #pragma newdecls required 8 | #define PLUGIN_VERSION "1.0" 9 | 10 | public Plugin myinfo = 11 | { 12 | name = "Deadmute", 13 | author = "AntiTeal", 14 | description = "Allows dead players to speak for a set period of time after they die.", 15 | version = PLUGIN_VERSION, 16 | url = "https://steam-gamers.net" 17 | }; 18 | 19 | ConVar g_cVMuteDelay = null; 20 | Handle g_hMuteTimers[MAXPLAYERS+1]; 21 | bool g_bDeadMuted[MAXPLAYERS+1] = {false, ...}; 22 | 23 | public void OnPluginStart() 24 | { 25 | CreateConVar("sm_deadmute_version", PLUGIN_VERSION, "Plugin Version", FCVAR_SPONLY|FCVAR_REPLICATED|FCVAR_NOTIFY); 26 | 27 | HookEvent("player_death", Event_PlayerDeath, EventHookMode_Post); 28 | HookEvent("player_spawn", Event_PlayerSpawn, EventHookMode_Post); 29 | 30 | g_cVMuteDelay = CreateConVar("sm_deadmute_mutedelay", "10", "How long after a person dies until they are muted.", _, true, 0.0, false, _); 31 | } 32 | 33 | public int GetAlivePlayersCount(int iTeam) 34 | { 35 | int iCount, i; iCount = 0; 36 | for(i = 1; i <= MaxClients; i++) 37 | { 38 | if(IsClientInGame(i) && IsPlayerAlive(i) && GetClientTeam(i) == iTeam) 39 | { 40 | iCount++; 41 | } 42 | } 43 | return iCount; 44 | } 45 | 46 | public Action Event_PlayerDeath(Handle event, const char[] name, bool dontBroadcast) 47 | { 48 | int client = GetClientOfUserId(GetEventInt(event, "userid")); 49 | int team = GetClientTeam(client); 50 | float muteDelay = g_cVMuteDelay.FloatValue; 51 | 52 | if(GetAlivePlayersCount(team) > 0) 53 | { 54 | PrintToChat(client, "[SM] You have %.2f seconds before you are muted.", muteDelay); 55 | g_hMuteTimers[client] = CreateTimer(muteDelay, MutePlayer, client); 56 | } 57 | } 58 | 59 | public Action MutePlayer(Handle timer, any client) 60 | { 61 | for(int i = 1; i <= MaxClients; i++) 62 | { 63 | if(IsClientInGame(i) && IsPlayerAlive(i) && GetClientTeam(i) != 1) 64 | { 65 | SetListenOverride(i, client, Listen_No); 66 | g_bDeadMuted[client] = true; 67 | } 68 | } 69 | PrintToChat(client, "[SM] You are now muted!"); 70 | g_hMuteTimers[client] = null; 71 | } 72 | 73 | public void OnClientDisconnect(int client) 74 | { 75 | if (g_hMuteTimers[client] != null) 76 | { 77 | KillTimer(g_hMuteTimers[client]); 78 | g_hMuteTimers[client] = null; 79 | } 80 | g_bDeadMuted[client] = false; 81 | } 82 | 83 | public void OnPluginEnd() 84 | { 85 | for(int client = 1; client <= MaxClients; client++) 86 | { 87 | if(IsClientInGame(client) && g_bDeadMuted[client]) 88 | { 89 | for(int i = 1; i <= MaxClients; i++) 90 | { 91 | if(IsClientInGame(i)) 92 | { 93 | SetListenOverride(i, client, Listen_Default); 94 | } 95 | } 96 | } 97 | } 98 | } 99 | 100 | public Action Event_PlayerSpawn(Handle event, const char[] name, bool dontBroadcast) 101 | { 102 | int client = GetClientOfUserId(GetEventInt(event, "userid")); 103 | 104 | if (g_hMuteTimers[client] != null) 105 | { 106 | KillTimer(g_hMuteTimers[client]); 107 | g_hMuteTimers[client] = null; 108 | } 109 | 110 | if(g_bDeadMuted[client]) 111 | { 112 | g_bDeadMuted[client] = false; 113 | for(int i = 1; i <= MaxClients; i++) 114 | { 115 | if(IsClientInGame(i)) 116 | { 117 | SetListenOverride(i, client, Listen_Default); 118 | } 119 | } 120 | } 121 | } 122 | -------------------------------------------------------------------------------- /forceinput.sp: -------------------------------------------------------------------------------- 1 | //==================================================================================================== 2 | // 3 | // Name: ForceInput 4 | // Author: zaCade 5 | // Description: Allows admins to force inputs on entities. (ent_fire) 6 | // 7 | //==================================================================================================== 8 | #include 9 | #include 10 | 11 | #pragma newdecls required 12 | 13 | //---------------------------------------------------------------------------------------------------- 14 | // Purpose: 15 | //---------------------------------------------------------------------------------------------------- 16 | public Plugin myinfo = 17 | { 18 | name = "ForceInput", 19 | author = "AntiTeal + zaCade + BotoX", 20 | description = "Allows admins to force inputs on entities. (ent_fire)", 21 | version = "1.3", 22 | url = "" 23 | }; 24 | 25 | //---------------------------------------------------------------------------------------------------- 26 | // Purpose: 27 | //---------------------------------------------------------------------------------------------------- 28 | public void OnPluginStart() 29 | { 30 | LoadTranslations("common.phrases"); 31 | 32 | RegAdminCmd("sm_forceinput", Command_ForceInput, ADMFLAG_ROOT); 33 | RegAdminCmd("sm_forceinputplayer", Command_ForceInputPlayer, ADMFLAG_ROOT); 34 | } 35 | 36 | //---------------------------------------------------------------------------------------------------- 37 | // Purpose: 38 | //---------------------------------------------------------------------------------------------------- 39 | public Action Command_ForceInputPlayer(int client, int args) 40 | { 41 | if (GetCmdArgs() < 2) 42 | { 43 | ReplyToCommand(client, "[SM] Usage: sm_forceinputplayer [parameter]"); 44 | return Plugin_Handled; 45 | } 46 | 47 | char sArguments[3][256]; 48 | GetCmdArg(1, sArguments[0], sizeof(sArguments[])); 49 | GetCmdArg(2, sArguments[1], sizeof(sArguments[])); 50 | GetCmdArg(3, sArguments[2], sizeof(sArguments[])); 51 | 52 | char target_name[MAX_TARGET_LENGTH]; 53 | int target_list[MAXPLAYERS], target_count; 54 | bool tn_is_ml; 55 | 56 | if((target_count = ProcessTargetString( 57 | sArguments[0], 58 | client, 59 | target_list, 60 | MAXPLAYERS, 61 | 0, 62 | target_name, 63 | sizeof(target_name), 64 | tn_is_ml)) <= 0) 65 | { 66 | ReplyToTargetError(client, target_count); 67 | return Plugin_Handled; 68 | } 69 | 70 | for(int i = 0; i < target_count; i++) 71 | { 72 | if (sArguments[2][0]) 73 | SetVariantString(sArguments[2]); 74 | 75 | AcceptEntityInput(target_list[i], sArguments[1], target_list[i], target_list[i]); 76 | ReplyToCommand(client, "[SM] Input succesfull."); 77 | } 78 | 79 | return Plugin_Handled; 80 | } 81 | 82 | //---------------------------------------------------------------------------------------------------- 83 | // Purpose: 84 | //---------------------------------------------------------------------------------------------------- 85 | public Action Command_ForceInput(int client, int args) 86 | { 87 | if (GetCmdArgs() < 2) 88 | { 89 | ReplyToCommand(client, "[SM] Usage: sm_forceinput [parameter]"); 90 | return Plugin_Handled; 91 | } 92 | 93 | char sArguments[3][256]; 94 | GetCmdArg(1, sArguments[0], sizeof(sArguments[])); 95 | GetCmdArg(2, sArguments[1], sizeof(sArguments[])); 96 | GetCmdArg(3, sArguments[2], sizeof(sArguments[])); 97 | 98 | if (StrEqual(sArguments[0], "!self")) 99 | { 100 | if (sArguments[2][0]) 101 | SetVariantString(sArguments[2]); 102 | 103 | AcceptEntityInput(client, sArguments[1], client, client); 104 | ReplyToCommand(client, "[SM] Input succesfull."); 105 | } 106 | else if (StrEqual(sArguments[0], "!target") || StrEqual(sArguments[0], "!picker")) 107 | { 108 | int entity = INVALID_ENT_REFERENCE; 109 | 110 | float fPosition[3], fAngles[3]; 111 | GetClientEyePosition(client, fPosition); 112 | GetClientEyeAngles(client, fAngles); 113 | 114 | Handle hTrace = TR_TraceRayFilterEx(fPosition, fAngles, MASK_SOLID, RayType_Infinite, TraceRayFilter, client); 115 | 116 | if (TR_DidHit(hTrace) && ((entity = TR_GetEntityIndex(hTrace)) >= 1)) 117 | { 118 | if (IsValidEntity(entity) || IsValidEdict(entity)) 119 | { 120 | if (sArguments[2][0]) 121 | SetVariantString(sArguments[2]); 122 | 123 | AcceptEntityInput(entity, sArguments[1], client, client); 124 | ReplyToCommand(client, "[SM] Input succesfull."); 125 | } 126 | } 127 | } 128 | else 129 | { 130 | int entity = INVALID_ENT_REFERENCE; 131 | 132 | while ((entity = FindEntityByClassname(entity, "*")) != INVALID_ENT_REFERENCE) 133 | { 134 | if (IsValidEntity(entity) || IsValidEdict(entity)) 135 | { 136 | char sClassname[64], sTargetname[64]; 137 | GetEntPropString(entity, Prop_Data, "m_iClassname", sClassname, sizeof(sClassname)); 138 | GetEntPropString(entity, Prop_Data, "m_iName", sTargetname, sizeof(sTargetname)); 139 | 140 | if (StrEqual(sClassname, sArguments[0], false) || StrEqual(sTargetname, sArguments[0], false)) 141 | { 142 | if (sArguments[2][0]) 143 | SetVariantString(sArguments[2]); 144 | 145 | AcceptEntityInput(entity, sArguments[1], client, client); 146 | ReplyToCommand(client, "[SM] Input succesfull."); 147 | } 148 | } 149 | } 150 | } 151 | return Plugin_Handled; 152 | } 153 | 154 | //---------------------------------------------------------------------------------------------------- 155 | // Purpose: 156 | //---------------------------------------------------------------------------------------------------- 157 | public bool TraceRayFilter(int entity, int mask, any client) 158 | { 159 | if (entity == client) 160 | return false; 161 | 162 | return true; 163 | } 164 | -------------------------------------------------------------------------------- /glowcolor.sp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #undef REQUIRE_PLUGIN 7 | #include 8 | #define REQUIRE_PLUGIN 9 | 10 | #pragma semicolon 1 11 | #pragma newdecls required 12 | 13 | public Plugin myinfo = 14 | { 15 | name = "GlowColors", 16 | author = "BotoX + AntiTeal", 17 | description = "Change your clients colors.", 18 | version = "1.0", 19 | url = "" 20 | } 21 | 22 | Menu g_GlowColorsMenu; 23 | Handle g_hClientCookie = INVALID_HANDLE; 24 | 25 | int g_aGlowColor[MAXPLAYERS + 1][3]; 26 | float g_aRainbowFrequency[MAXPLAYERS + 1]; 27 | 28 | public void OnPluginStart() 29 | { 30 | g_hClientCookie = RegClientCookie("glowcolor", "", CookieAccess_Protected); 31 | 32 | RegConsoleCmd("sm_glow", Command_GlowColors, "Change your players glowcolor. sm_glow "); 33 | RegConsoleCmd("sm_color", Command_GlowColors, "Change your players glowcolor. sm_glow "); 34 | 35 | RegAdminCmd("sm_rainbow", Command_Rainbow, ADMFLAG_GENERIC, "Enable rainbow glowcolors. sm_rainbow [frequency]"); 36 | 37 | HookEvent("player_spawn", Event_ApplyGlowcolor, EventHookMode_Post); 38 | HookEvent("player_team", Event_ApplyGlowcolor, EventHookMode_Post); 39 | HookEvent("player_hurt", Event_ApplyGlowcolor_NoDelay, EventHookMode_Post); 40 | 41 | LoadConfig(); 42 | 43 | for(int client = 1; client <= MaxClients; client++) 44 | { 45 | if(IsClientInGame(client) && !IsFakeClient(client) && AreClientCookiesCached(client)) 46 | { 47 | OnClientCookiesCached(client); 48 | ApplyGlowColor(client); 49 | } 50 | } 51 | } 52 | 53 | public void OnPluginEnd() 54 | { 55 | for(int client = 1; client <= MaxClients; client++) 56 | { 57 | if(IsClientInGame(client) && !IsFakeClient(client) && AreClientCookiesCached(client)) 58 | { 59 | OnClientDisconnect(client); 60 | ApplyGlowColor(client); 61 | } 62 | } 63 | 64 | delete g_GlowColorsMenu; 65 | CloseHandle(g_hClientCookie); 66 | } 67 | 68 | void LoadConfig() 69 | { 70 | char sConfigFile[PLATFORM_MAX_PATH]; 71 | BuildPath(Path_SM, sConfigFile, sizeof(sConfigFile), "configs/GlowColors.cfg"); 72 | if(!FileExists(sConfigFile)) 73 | { 74 | SetFailState("Could not find config: \"%s\"", sConfigFile); 75 | } 76 | 77 | KeyValues Config = new KeyValues("GlowColors"); 78 | if(!Config.ImportFromFile(sConfigFile)) 79 | { 80 | delete Config; 81 | SetFailState("ImportFromFile() failed!"); 82 | } 83 | if(!Config.GotoFirstSubKey(false)) 84 | { 85 | delete Config; 86 | SetFailState("GotoFirstSubKey() failed!"); 87 | } 88 | 89 | g_GlowColorsMenu = new Menu(MenuHandler_GlowColorsMenu, MenuAction_Select); 90 | g_GlowColorsMenu.SetTitle("GlowColors"); 91 | g_GlowColorsMenu.ExitButton = true; 92 | 93 | g_GlowColorsMenu.AddItem("255 255 255", "None"); 94 | 95 | char sKey[32]; 96 | char sValue[16]; 97 | do 98 | { 99 | Config.GetSectionName(sKey, sizeof(sKey)); 100 | Config.GetString(NULL_STRING, sValue, sizeof(sValue)); 101 | 102 | g_GlowColorsMenu.AddItem(sValue, sKey); 103 | } 104 | while(Config.GotoNextKey(false)); 105 | } 106 | 107 | public void OnClientConnected(int client) 108 | { 109 | g_aGlowColor[client][0] = 255; 110 | g_aGlowColor[client][1] = 255; 111 | g_aGlowColor[client][2] = 255; 112 | g_aRainbowFrequency[client] = 0.0; 113 | } 114 | 115 | public void OnClientCookiesCached(int client) 116 | { 117 | if(IsClientAuthorized(client)) 118 | ReadClientCookies(client); 119 | } 120 | 121 | public void OnClientPostAdminCheck(int client) 122 | { 123 | if(AreClientCookiesCached(client)) 124 | ReadClientCookies(client); 125 | } 126 | 127 | void ReadClientCookies(int client) 128 | { 129 | char sCookie[16]; 130 | if(CheckCommandAccess(client, "sm_glowcolors", ADMFLAG_CUSTOM5)) 131 | GetClientCookie(client, g_hClientCookie, sCookie, sizeof(sCookie)); 132 | 133 | if(StrEqual(sCookie, "")) 134 | { 135 | g_aGlowColor[client][0] = 255; 136 | g_aGlowColor[client][1] = 255; 137 | g_aGlowColor[client][2] = 255; 138 | } 139 | else 140 | ColorStringToArray(sCookie, g_aGlowColor[client]); 141 | } 142 | 143 | public void OnClientDisconnect(int client) 144 | { 145 | if(CheckCommandAccess(client, "sm_glowcolors", ADMFLAG_CUSTOM5)) 146 | { 147 | if(g_aGlowColor[client][0] == 255 && 148 | g_aGlowColor[client][1] == 255 && 149 | g_aGlowColor[client][2] == 255) 150 | { 151 | SetClientCookie(client, g_hClientCookie, ""); 152 | } 153 | else 154 | { 155 | char sCookie[16]; 156 | FormatEx(sCookie, sizeof(sCookie), "%d %d %d", 157 | g_aGlowColor[client][0], 158 | g_aGlowColor[client][1], 159 | g_aGlowColor[client][2]); 160 | 161 | SetClientCookie(client, g_hClientCookie, sCookie); 162 | } 163 | } 164 | 165 | g_aGlowColor[client][0] = 255; 166 | g_aGlowColor[client][1] = 255; 167 | g_aGlowColor[client][2] = 255; 168 | 169 | if(g_aRainbowFrequency[client]) 170 | SDKUnhook(client, SDKHook_PostThinkPost, OnPostThinkPost); 171 | g_aRainbowFrequency[client] = 0.0; 172 | } 173 | 174 | public void OnPostThinkPost(int client) 175 | { 176 | float i = GetGameTime(); 177 | float Frequency = g_aRainbowFrequency[client]; 178 | 179 | int Red = RoundFloat(Sine(Frequency * i + 0.0) * 127.0 + 128.0); 180 | int Green = RoundFloat(Sine(Frequency * i + 2.0943951) * 127.0 + 128.0); 181 | int Blue = RoundFloat(Sine(Frequency * i + 4.1887902) * 127.0 + 128.0); 182 | 183 | ToolsSetEntityColor(client, Red, Green, Blue); 184 | } 185 | 186 | public Action Command_GlowColors(int client, int args) 187 | { 188 | if(args < 1) 189 | { 190 | DisplayGlowColorMenu(client); 191 | } 192 | else if(args == 1) 193 | { 194 | char sColorString[32]; 195 | GetCmdArgString(sColorString, sizeof(sColorString)); 196 | 197 | if(!IsValidHex(sColorString)) 198 | { 199 | PrintToChat(client, "Invalid HEX color code supplied."); 200 | return Plugin_Handled; 201 | } 202 | 203 | int Color = StringToInt(sColorString, 16); 204 | 205 | g_aGlowColor[client][0] = (Color >> 16) & 0xFF; 206 | g_aGlowColor[client][1] = (Color >> 8) & 0xFF; 207 | g_aGlowColor[client][2] = (Color >> 0) & 0xFF; 208 | ApplyGlowColor(client); 209 | 210 | if(GetCmdReplySource() == SM_REPLY_TO_CHAT) 211 | PrintToChat(client, "\x01[SM] Set color to: \x07%06X%06X\x01", Color, Color); 212 | } 213 | else if(args == 3) 214 | { 215 | char sColorString[32]; 216 | GetCmdArgString(sColorString, sizeof(sColorString)); 217 | 218 | if(!IsValidRGBNum(sColorString)) 219 | { 220 | PrintToChat(client, "Invalid RGB color code supplied."); 221 | return Plugin_Handled; 222 | } 223 | 224 | ColorStringToArray(sColorString, g_aGlowColor[client]); 225 | ApplyGlowColor(client); 226 | 227 | int Color = (g_aGlowColor[client][0] << 16) + 228 | (g_aGlowColor[client][1] << 8) + 229 | (g_aGlowColor[client][2] << 0); 230 | 231 | if(GetCmdReplySource() == SM_REPLY_TO_CHAT) 232 | PrintToChat(client, "\x01[SM] Set color to: \x07%06X%06X\x01", Color, Color); 233 | } 234 | else 235 | { 236 | char sCommand[32]; 237 | GetCmdArg(0, sCommand, sizeof(sCommand)); 238 | PrintToChat(client, "[SM] Usage: %s ", sCommand); 239 | } 240 | 241 | return Plugin_Handled; 242 | } 243 | 244 | public Action Command_Rainbow(int client, int args) 245 | { 246 | float Frequency = 1.0; 247 | if(args >= 1) 248 | { 249 | char sArg[32]; 250 | GetCmdArg(1, sArg, sizeof(sArg)); 251 | Frequency = StringToFloat(sArg); 252 | } 253 | 254 | if(!Frequency || (args < 1 && g_aRainbowFrequency[client])) 255 | { 256 | if(g_aRainbowFrequency[client]) 257 | SDKUnhook(client, SDKHook_PostThinkPost, OnPostThinkPost); 258 | 259 | g_aRainbowFrequency[client] = 0.0; 260 | PrintToChat(client, "[SM] Disabled rainbow glowcolors."); 261 | 262 | ApplyGlowColor(client); 263 | } 264 | else 265 | { 266 | if(Frequency > 15.0) 267 | { 268 | PrintToChat(client, "[SM] Please don't put a rainbow speed over 15!"); 269 | return Plugin_Handled; 270 | } 271 | 272 | if(!g_aRainbowFrequency[client]) 273 | SDKHook(client, SDKHook_PostThinkPost, OnPostThinkPost); 274 | 275 | g_aRainbowFrequency[client] = Frequency; 276 | PrintToChat(client, "[SM] Enabled rainbow glowcolors. (Frequency = %f)", Frequency); 277 | } 278 | return Plugin_Handled; 279 | } 280 | 281 | void DisplayGlowColorMenu(int client) 282 | { 283 | g_GlowColorsMenu.Display(client, MENU_TIME_FOREVER); 284 | } 285 | 286 | public int MenuHandler_GlowColorsMenu(Menu menu, MenuAction action, int param1, int param2) 287 | { 288 | switch(action) 289 | { 290 | case MenuAction_Select: 291 | { 292 | char aItem[16]; 293 | menu.GetItem(param2, aItem, sizeof(aItem)); 294 | 295 | ColorStringToArray(aItem, g_aGlowColor[param1]); 296 | ApplyGlowColor(param1); 297 | } 298 | } 299 | } 300 | 301 | public void Event_ApplyGlowcolor(Event event, const char[] name, bool dontBroadcast) 302 | { 303 | int client = GetClientOfUserId(GetEventInt(event, "userid")); 304 | if(!client) 305 | return; 306 | 307 | CreateTimer(1.0, DelayColors, GetClientSerial(client)); 308 | } 309 | 310 | public void Event_ApplyGlowcolor_NoDelay(Event event, const char[] name, bool dontBroadcast) 311 | { 312 | int client = GetClientOfUserId(GetEventInt(event, "userid")); 313 | if(!client) 314 | return; 315 | 316 | RequestFrame(ApplyGlowColor, client); 317 | } 318 | 319 | public Action DelayColors(Handle timer, any serial) 320 | { 321 | int client = GetClientFromSerial(serial); 322 | if (client == 0) 323 | return Plugin_Stop; 324 | 325 | ApplyGlowColor(client); 326 | return Plugin_Handled; 327 | } 328 | 329 | public int ZR_OnClientHumanPost(int client, bool respawn, bool protect) 330 | { 331 | ApplyGlowColor(client); 332 | } 333 | 334 | void ApplyGlowColor(int client) 335 | { 336 | if(IsClientInGame(client) && IsPlayerAlive(client) && ZR_IsClientHuman(client)) 337 | ToolsSetEntityColor(client, g_aGlowColor[client][0], g_aGlowColor[client][1], g_aGlowColor[client][2]); 338 | } 339 | 340 | stock void ToolsGetEntityColor(int entity, int aColor[4]) 341 | { 342 | static bool s_GotConfig = false; 343 | static char s_sProp[32]; 344 | 345 | if(!s_GotConfig) 346 | { 347 | Handle GameConf = LoadGameConfigFile("core.games"); 348 | bool Exists = GameConfGetKeyValue(GameConf, "m_clrRender", s_sProp, sizeof(s_sProp)); 349 | CloseHandle(GameConf); 350 | 351 | if(!Exists) 352 | strcopy(s_sProp, sizeof(s_sProp), "m_clrRender"); 353 | 354 | s_GotConfig = true; 355 | } 356 | 357 | int Offset = GetEntSendPropOffs(entity, s_sProp); 358 | 359 | for(int i = 0; i < 4; i++) 360 | aColor[i] = GetEntData(entity, Offset + i, 1); 361 | } 362 | 363 | stock void ToolsSetEntityColor(int client, int Red, int Green, int Blue) 364 | { 365 | int aColor[4]; 366 | ToolsGetEntityColor(client, aColor); 367 | 368 | SetEntityRenderColor(client, Red, Green, Blue, aColor[3]); 369 | } 370 | 371 | stock void ColorStringToArray(const char[] sColorString, int aColor[3]) 372 | { 373 | char asColors[4][4]; 374 | ExplodeString(sColorString, " ", asColors, sizeof(asColors), sizeof(asColors[])); 375 | 376 | aColor[0] = StringToInt(asColors[0]) & 0xFF; 377 | aColor[1] = StringToInt(asColors[1]) & 0xFF; 378 | aColor[2] = StringToInt(asColors[2]) & 0xFF; 379 | } 380 | 381 | stock bool IsValidRGBNum(char[] sString) 382 | { 383 | if(SimpleRegexMatch(sString, "^([01]?[0-9]?[0-9]|2[0-4][0-9]|25[0-5])$") == 2) 384 | return true; 385 | return false; 386 | } 387 | 388 | stock bool IsValidHex(char[] sString) 389 | { 390 | if(SimpleRegexMatch(sString, "^(#?)([A-Fa-f0-9]{6})$") == 0) 391 | return false; 392 | return true; 393 | } 394 | -------------------------------------------------------------------------------- /godelites.sp: -------------------------------------------------------------------------------- 1 | #pragma semicolon 1 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | #define PLUGIN_VERSION "1.0" 10 | #define FreezeColor {75,75,255,255} 11 | #define BOOMSOUND "weapons/hegrenade/explode4.wav" 12 | #define FREEZESOUND "physics/glass/glass_impact_bullet4.wav" 13 | 14 | #pragma newdecls required 15 | 16 | int g_beamsprite, g_ExplosionSprite; 17 | ConVar g_cVRange, g_cVDamage, g_cVTime; 18 | ArrayList GodEliteList; 19 | 20 | public Plugin myinfo = 21 | { 22 | name = "[sG] GodElites", 23 | description = "Overpowered Elites based off of NatalyaAF's plugin.", 24 | author = "sG | AntiTeal", 25 | version = PLUGIN_VERSION, 26 | url = "http://www.joinsg.net" 27 | }; 28 | 29 | public void OnPluginStart() 30 | { 31 | CreateConVar("sm_godelites_version", PLUGIN_VERSION, "Plugin Version", FCVAR_SPONLY | FCVAR_REPLICATED | FCVAR_NOTIFY); 32 | 33 | LoadTranslations("common.phrases"); 34 | LoadTranslations("core.phrases"); 35 | 36 | RegAdminCmd("sm_godelites", GiveElites, ADMFLAG_GENERIC); 37 | 38 | HookEvent("bullet_impact", Event_BulletImpact); 39 | 40 | HookEvent("round_start", Event_RoundStart); 41 | 42 | g_cVRange = CreateConVar("sm_godelites_range", "250", "Range (in units) for each effect."); 43 | g_cVDamage = CreateConVar("sm_godelites_damage", "1000", "Base damage for zombies hit by the explosion."); 44 | g_cVTime = CreateConVar("sm_godelites_time", "1.5", "Time for zombie freeze to last."); 45 | 46 | GodEliteList = CreateArray(8); 47 | } 48 | 49 | public void OnMapStart() 50 | { 51 | PrecacheSound(BOOMSOUND, true); 52 | PrecacheSound(FREEZESOUND, true); 53 | 54 | g_beamsprite = PrecacheModel("materials/sprites/laserbeam.vmt"); 55 | 56 | Handle gameConfig = LoadGameConfigFile("funcommands.games"); 57 | 58 | char buffer[PLATFORM_MAX_PATH]; 59 | if (GameConfGetKeyValue(gameConfig, "SpriteExplosion", buffer, sizeof(buffer)) && buffer[0]) 60 | { 61 | g_ExplosionSprite = PrecacheModel(buffer); 62 | } 63 | } 64 | 65 | public Action GiveElites(int client, int argc) 66 | { 67 | if(argc < 1) 68 | { 69 | CPrintToChat(client, "{green}[SM]{red} Usage: sm_godelites <#userid|name>"); 70 | return Plugin_Handled; 71 | } 72 | 73 | char arg[65]; 74 | GetCmdArg(1, arg, sizeof(arg)); 75 | 76 | char target_name[MAX_TARGET_LENGTH]; 77 | int target_list[MAXPLAYERS]; 78 | int target_count; 79 | bool tn_is_ml; 80 | 81 | if((target_count = ProcessTargetString(arg, client, target_list, MAXPLAYERS, COMMAND_FILTER_ALIVE, target_name, sizeof(target_name), tn_is_ml)) <= 0) 82 | { 83 | ReplyToTargetError(client, target_count); 84 | return Plugin_Handled; 85 | } 86 | 87 | for(int i = 0; i < target_count; i++) 88 | { 89 | SpawnElites(target_list[i]); 90 | } 91 | 92 | ShowActivity2(client, "\x01[SM] \x04", "\x01Gave \x04%s\x01 to target \x04%s", "GodElites", target_name); 93 | LogAction(client, -1, "Gave %s to target %s", "GodElites", target_name); 94 | 95 | return Plugin_Handled; 96 | } 97 | 98 | public void SpawnElites(int client) 99 | { 100 | int elite, weaponEnt = GetPlayerWeaponSlot(client, 1); 101 | if (weaponEnt != -1) 102 | { 103 | CS_DropWeapon(client, weaponEnt, false, false); 104 | } 105 | 106 | elite = GivePlayerItem(client, "weapon_elite"); 107 | PushArrayCell(GodEliteList, elite); 108 | SetEntityRenderColor(elite, 255, 0, 0, 255); 109 | 110 | CPrintToChat(client, "{green}[SM]{red} You have been given the {blue}God-Elites{red}. Use them wisely."); 111 | } 112 | 113 | public Action Event_RoundStart(Handle event, const char[] name, bool dontBroadcast) 114 | { 115 | ClearArray(GodEliteList); 116 | } 117 | 118 | public Action Event_BulletImpact(Handle event, const char[] name, bool dontBroadcast) 119 | { 120 | int client = GetClientOfUserId(GetEventInt(event, "userid")); 121 | char weap[32]; 122 | GetClientWeapon(client, weap, sizeof(weap)); 123 | if(StrContains(weap, "elite", false) != -1) 124 | { 125 | int weapon = GetPlayerWeaponSlot(client, 1); 126 | 127 | if(FindValueInArray(GodEliteList, weapon) != -1) 128 | { 129 | float m_fImpact[3], m_fOrigin[3]; 130 | 131 | GetClientEyePosition(client, m_fOrigin); 132 | 133 | m_fImpact[0] = GetEventFloat(event, "x"); 134 | m_fImpact[1] = GetEventFloat(event, "y"); 135 | m_fImpact[2] = GetEventFloat(event, "z"); 136 | 137 | //Rainbow Tracer 138 | int rainbowArray[4]; 139 | rainbowArray[0] = GetRandomInt(0, 255); 140 | rainbowArray[1] = GetRandomInt(0, 255); 141 | rainbowArray[2] = GetRandomInt(0, 255); 142 | rainbowArray[3] = 255; 143 | TE_SetupBeamPoints(m_fOrigin, m_fImpact, g_beamsprite, 0, 0, 0, 0.5, 1.0, 1.0, 1, 0.0, rainbowArray, 0); 144 | TE_SendToAll(); 145 | 146 | if(GetRandomInt(0, 1) == 0) 147 | { 148 | CreateExplosion(client, m_fImpact); 149 | } 150 | else 151 | { 152 | CreateFreeze(client, m_fImpact); 153 | } 154 | } 155 | } 156 | } 157 | 158 | public void CreateExplosion(int client, float impact[3]) 159 | { 160 | EmitAmbientSound(BOOMSOUND, impact, client, 50); 161 | TE_SetupExplosion(impact, g_ExplosionSprite, 5.0, 1, 0, g_cVRange.IntValue, 5000); 162 | TE_SendToAll(); 163 | for(int i = 1; i <= MaxClients; i++) 164 | { 165 | if(IsClientInGame(i) && IsPlayerAlive(i) && ZR_IsClientZombie(i) && client != i) 166 | { 167 | float pos[3]; 168 | GetClientAbsOrigin(i, pos); 169 | float distance = GetVectorDistance(impact, pos); 170 | 171 | if (distance > g_cVRange.FloatValue) 172 | { 173 | continue; 174 | } 175 | 176 | int damage = g_cVDamage.IntValue; 177 | damage = RoundToFloor(damage * ((g_cVRange.FloatValue - distance) / g_cVRange.FloatValue)); 178 | 179 | SDKHooks_TakeDamage(i, i, i, float(damage)); 180 | } 181 | } 182 | } 183 | 184 | public void CreateFreeze(int client, float impact[3]) 185 | { 186 | EmitAmbientSound(FREEZESOUND, impact, client, SNDLEVEL_NORMAL); 187 | float beaconVec[3]; 188 | beaconVec[0] = impact[0]; 189 | beaconVec[1] = impact[1]; 190 | beaconVec[2] = (impact[2] + 10.0); 191 | TE_SetupBeamRingPoint(beaconVec, 10.0, g_cVRange.FloatValue, g_beamsprite, g_beamsprite, 0, 15, 0.25, 5.0, 0.0, FreezeColor, 10, 0); 192 | TE_SendToAll(); 193 | for(int i = 1; i <= MaxClients; i++) 194 | { 195 | if(IsClientInGame(i) && IsPlayerAlive(i) && ZR_IsClientZombie(i) && client != i) 196 | { 197 | float pos[3]; 198 | GetClientAbsOrigin(i, pos); 199 | float distance = GetVectorDistance(impact, pos); 200 | 201 | if (distance > g_cVRange.FloatValue) 202 | { 203 | continue; 204 | } 205 | 206 | SetEntityMoveType(i, MOVETYPE_NONE); 207 | SetEntityRenderColor(i, 0, 128, 255, 192); 208 | 209 | PrintHintText(i, "You are frozen for %.3f seconds...", g_cVTime.FloatValue); 210 | CreateTimer(g_cVTime.FloatValue, UnfreezePlayer, GetClientSerial(i)); 211 | } 212 | } 213 | } 214 | 215 | public Action UnfreezePlayer(Handle timer, any serial) 216 | { 217 | int client = GetClientFromSerial(serial); 218 | 219 | if (client == 0 || !IsClientInGame(client) || !IsPlayerAlive(client)) 220 | { 221 | return Plugin_Stop; 222 | } 223 | 224 | float vec[3]; 225 | GetClientAbsOrigin(client, vec); 226 | vec[2] += 10; 227 | 228 | EmitAmbientSound(FREEZESOUND, vec, client, SNDLEVEL_RAIDSIREN); 229 | 230 | SetEntityMoveType(client, MOVETYPE_WALK); 231 | SetEntityRenderColor(client, 255, 255, 255, 255); 232 | 233 | return Plugin_Handled; 234 | } -------------------------------------------------------------------------------- /include/colors_csgo.inc: -------------------------------------------------------------------------------- 1 | /************************************************************************** 2 | * * 3 | * Colored Chat Functions * 4 | * Author: exvel, Editor: Popoklopsi, Powerlord, Bara * 5 | * Version: 1.1.3 * 6 | * * 7 | **************************************************************************/ 8 | 9 | 10 | #if defined _colors_included 11 | #endinput 12 | #endif 13 | #define _colors_included 14 | 15 | #define MAX_MESSAGE_LENGTH 250 16 | #define MAX_COLORS 16 17 | 18 | #define SERVER_INDEX 0 19 | #define NO_INDEX -1 20 | #define NO_PLAYER -2 21 | 22 | enum Colors 23 | { 24 | Color_Default = 0, 25 | Color_Darkred, 26 | Color_Pink, 27 | Color_Green, 28 | Color_Lightgreen, 29 | Color_Lime, 30 | Color_Red, 31 | Color_Grey, 32 | Color_Olive, 33 | Color_A, 34 | Color_Lightblue, 35 | Color_Blue, 36 | Color_D, 37 | Color_Purple, 38 | Color_Darkrange, 39 | Color_Orange 40 | } 41 | 42 | /* Colors' properties */ 43 | new String:CTag[][] = {"{default}", "{darkred}", "{pink}", "{green}", "{lightgreen}", "{lime}", "{red}", "{grey}", "{olive}", "{a}", "{lightblue}", "{blue}", "{d}", "{purple}", "{darkorange}", "{orange}"}; 44 | new String:CTagCode[][] = {"\x01", "\x02", "\x03", "\x04", "\x05", "\x06", "\x07", "\x08", "\x09", "\x0A", "\x0B", "\x0C", "\x0D", "\x0E", "\x0F", "\x10"}; 45 | new bool:CTagReqSayText2[] = {false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false}; 46 | new bool:CEventIsHooked = false; 47 | new bool:CSkipList[MAXPLAYERS+1] = {false,...}; 48 | 49 | /* Game default profile */ 50 | new bool:CProfile_Colors[] = {true, false, true, false, false, false, false, false, false, false, false, false, false, false, false, false}; 51 | new CProfile_TeamIndex[] = {NO_INDEX, NO_INDEX, NO_INDEX, NO_INDEX, NO_INDEX, NO_INDEX, NO_INDEX, NO_INDEX, NO_INDEX, NO_INDEX, NO_INDEX, NO_INDEX, NO_INDEX, NO_INDEX, NO_INDEX, NO_INDEX}; 52 | new bool:CProfile_SayText2 = false; 53 | 54 | /** 55 | * Prints a message to a specific client in the chat area. 56 | * Supports color tags. 57 | * 58 | * @param client Client index. 59 | * @param szMessage Message (formatting rules). 60 | * @return No return 61 | * 62 | * On error/Errors: If the client is not connected an error will be thrown. 63 | */ 64 | stock CPrintToChat(client, const String:szMessage[], any:...) 65 | { 66 | if (client <= 0 || client > MaxClients) 67 | ThrowError("Invalid client index %d", client); 68 | 69 | if (!IsClientInGame(client)) 70 | ThrowError("Client %d is not in game", client); 71 | 72 | decl String:szBuffer[MAX_MESSAGE_LENGTH]; 73 | decl String:szCMessage[MAX_MESSAGE_LENGTH]; 74 | 75 | SetGlobalTransTarget(client); 76 | 77 | Format(szBuffer, sizeof(szBuffer), "\x01%s", szMessage); 78 | VFormat(szCMessage, sizeof(szCMessage), szBuffer, 3); 79 | 80 | new index = CFormat(szCMessage, sizeof(szCMessage)); 81 | 82 | if (index == NO_INDEX) 83 | PrintToChat(client, "%s", szCMessage); 84 | else 85 | CSayText2(client, index, szCMessage); 86 | } 87 | 88 | stock CReplyToCommand(client, const String:szMessage[], any:...) 89 | { 90 | 91 | decl String:szCMessage[MAX_MESSAGE_LENGTH]; 92 | VFormat(szCMessage, sizeof(szCMessage), szMessage, 3); 93 | 94 | if (client == 0) 95 | { 96 | CRemoveTags(szCMessage, sizeof(szCMessage)); 97 | PrintToServer("%s", szCMessage); 98 | } 99 | else if (GetCmdReplySource() == SM_REPLY_TO_CONSOLE) 100 | { 101 | CRemoveTags(szCMessage, sizeof(szCMessage)); 102 | PrintToConsole(client, "%s", szCMessage); 103 | } 104 | else 105 | { 106 | CPrintToChat(client, "%s", szCMessage); 107 | } 108 | } 109 | 110 | 111 | /** 112 | * Prints a message to all clients in the chat area. 113 | * Supports color tags. 114 | * 115 | * @param client Client index. 116 | * @param szMessage Message (formatting rules) 117 | * @return No return 118 | */ 119 | stock CPrintToChatAll(const String:szMessage[], any:...) 120 | { 121 | decl String:szBuffer[MAX_MESSAGE_LENGTH]; 122 | 123 | for (new i = 1; i <= MaxClients; i++) 124 | { 125 | if (IsClientInGame(i) && !IsFakeClient(i) && !CSkipList[i]) 126 | { 127 | SetGlobalTransTarget(i); 128 | VFormat(szBuffer, sizeof(szBuffer), szMessage, 2); 129 | 130 | CPrintToChat(i, "%s", szBuffer); 131 | } 132 | 133 | CSkipList[i] = false; 134 | } 135 | } 136 | 137 | /** 138 | * Prints a message to a specific client in the chat area. 139 | * Supports color tags and teamcolor tag. 140 | * 141 | * @param client Client index. 142 | * @param author Author index whose color will be used for teamcolor tag. 143 | * @param szMessage Message (formatting rules). 144 | * @return No return 145 | * 146 | * On error/Errors: If the client or author are not connected an error will be thrown. 147 | */ 148 | stock CPrintToChatEx(client, author, const String:szMessage[], any:...) 149 | { 150 | if (client <= 0 || client > MaxClients) 151 | ThrowError("Invalid client index %d", client); 152 | 153 | if (!IsClientInGame(client)) 154 | ThrowError("Client %d is not in game", client); 155 | 156 | if (author < 0 || author > MaxClients) 157 | ThrowError("Invalid client index %d", author); 158 | 159 | decl String:szBuffer[MAX_MESSAGE_LENGTH]; 160 | decl String:szCMessage[MAX_MESSAGE_LENGTH]; 161 | 162 | SetGlobalTransTarget(client); 163 | 164 | Format(szBuffer, sizeof(szBuffer), "\x01%s", szMessage); 165 | VFormat(szCMessage, sizeof(szCMessage), szBuffer, 4); 166 | 167 | new index = CFormat(szCMessage, sizeof(szCMessage), author); 168 | 169 | if (index == NO_INDEX) 170 | PrintToChat(client, "%s", szCMessage); 171 | else 172 | CSayText2(client, author, szCMessage); 173 | } 174 | 175 | /** 176 | * Prints a message to all clients in the chat area. 177 | * Supports color tags and teamcolor tag. 178 | * 179 | * @param author Author index whos color will be used for teamcolor tag. 180 | * @param szMessage Message (formatting rules). 181 | * @return No return 182 | * 183 | * On error/Errors: If the author is not connected an error will be thrown. 184 | */ 185 | stock CPrintToChatAllEx(author, const String:szMessage[], any:...) 186 | { 187 | if (author < 0 || author > MaxClients) 188 | ThrowError("Invalid client index %d", author); 189 | 190 | if (!IsClientInGame(author)) 191 | ThrowError("Client %d is not in game", author); 192 | 193 | decl String:szBuffer[MAX_MESSAGE_LENGTH]; 194 | 195 | for (new i = 1; i <= MaxClients; i++) 196 | { 197 | if (IsClientInGame(i) && !IsFakeClient(i) && !CSkipList[i]) 198 | { 199 | SetGlobalTransTarget(i); 200 | VFormat(szBuffer, sizeof(szBuffer), szMessage, 3); 201 | 202 | CPrintToChatEx(i, author, "%s", szBuffer); 203 | } 204 | 205 | CSkipList[i] = false; 206 | } 207 | } 208 | 209 | /** 210 | * Removes color tags from the string. 211 | * 212 | * @param szMessage String. 213 | * @return No return 214 | */ 215 | stock CRemoveTags(String:szMessage[], maxlength) 216 | { 217 | for (new i = 0; i < MAX_COLORS; i++) 218 | ReplaceString(szMessage, maxlength, CTag[i], "", false); 219 | 220 | ReplaceString(szMessage, maxlength, "{teamcolor}", "", false); 221 | } 222 | 223 | /** 224 | * Checks whether a color is allowed or not 225 | * 226 | * @param tag Color Tag. 227 | * @return True when color is supported, otherwise false 228 | */ 229 | stock CColorAllowed(Colors:color) 230 | { 231 | if (!CEventIsHooked) 232 | { 233 | CSetupProfile(); 234 | 235 | CEventIsHooked = true; 236 | } 237 | 238 | return CProfile_Colors[color]; 239 | } 240 | 241 | /** 242 | * Replace the color with another color 243 | * Handle with care! 244 | * 245 | * @param color color to replace. 246 | * @param newColor color to replace with. 247 | * @noreturn 248 | */ 249 | stock CReplaceColor(Colors:color, Colors:newColor) 250 | { 251 | if (!CEventIsHooked) 252 | { 253 | CSetupProfile(); 254 | 255 | CEventIsHooked = true; 256 | } 257 | 258 | CProfile_Colors[color] = CProfile_Colors[newColor]; 259 | CProfile_TeamIndex[color] = CProfile_TeamIndex[newColor]; 260 | 261 | CTagReqSayText2[color] = CTagReqSayText2[newColor]; 262 | Format(CTagCode[color], sizeof(CTagCode[]), CTagCode[newColor]) 263 | } 264 | 265 | /** 266 | * This function should only be used right in front of 267 | * CPrintToChatAll or CPrintToChatAllEx and it tells 268 | * to those funcions to skip specified client when printing 269 | * message to all clients. After message is printed client will 270 | * no more be skipped. 271 | * 272 | * @param client Client index 273 | * @return No return 274 | */ 275 | stock CSkipNextClient(client) 276 | { 277 | if (client <= 0 || client > MaxClients) 278 | ThrowError("Invalid client index %d", client); 279 | 280 | CSkipList[client] = true; 281 | } 282 | 283 | /** 284 | * Replaces color tags in a string with color codes 285 | * 286 | * @param szMessage String. 287 | * @param maxlength Maximum length of the string buffer. 288 | * @return Client index that can be used for SayText2 author index 289 | * 290 | * On error/Errors: If there is more then one team color is used an error will be thrown. 291 | */ 292 | stock CFormat(String:szMessage[], maxlength, author=NO_INDEX) 293 | { 294 | decl String:szGameName[30]; 295 | 296 | GetGameFolderName(szGameName, sizeof(szGameName)); 297 | 298 | /* Hook event for auto profile setup on map start */ 299 | if (!CEventIsHooked) 300 | { 301 | CSetupProfile(); 302 | HookEvent("server_spawn", CEvent_MapStart, EventHookMode_PostNoCopy); 303 | 304 | CEventIsHooked = true; 305 | } 306 | 307 | new iRandomPlayer = NO_INDEX; 308 | 309 | // On CS:GO set invisible precolor 310 | if (StrEqual(szGameName, "csgo", false)) 311 | Format(szMessage, maxlength, " \x01\x0B\x01%s", szMessage); 312 | 313 | /* If author was specified replace {teamcolor} tag */ 314 | if (author != NO_INDEX) 315 | { 316 | if (CProfile_SayText2) 317 | { 318 | ReplaceString(szMessage, maxlength, "{teamcolor}", "\x03", false); 319 | 320 | iRandomPlayer = author; 321 | } 322 | /* If saytext2 is not supported by game replace {teamcolor} with green tag */ 323 | else 324 | ReplaceString(szMessage, maxlength, "{teamcolor}", CTagCode[Color_Green], false); 325 | } 326 | else 327 | ReplaceString(szMessage, maxlength, "{teamcolor}", "", false); 328 | 329 | /* For other color tags we need a loop */ 330 | for (new i = 0; i < MAX_COLORS; i++) 331 | { 332 | /* If tag not found - skip */ 333 | if (StrContains(szMessage, CTag[i], false) == -1) 334 | continue; 335 | 336 | /* If tag is not supported by game replace it with green tag */ 337 | else if (!CProfile_Colors[i]) 338 | ReplaceString(szMessage, maxlength, CTag[i], CTagCode[Color_Green], false); 339 | 340 | /* If tag doesn't need saytext2 simply replace */ 341 | else if (!CTagReqSayText2[i]) 342 | ReplaceString(szMessage, maxlength, CTag[i], CTagCode[i], false); 343 | 344 | /* Tag needs saytext2 */ 345 | else 346 | { 347 | /* If saytext2 is not supported by game replace tag with green tag */ 348 | if (!CProfile_SayText2) 349 | ReplaceString(szMessage, maxlength, CTag[i], CTagCode[Color_Green], false); 350 | 351 | /* Game supports saytext2 */ 352 | else 353 | { 354 | /* If random player for tag wasn't specified replace tag and find player */ 355 | if (iRandomPlayer == NO_INDEX) 356 | { 357 | /* Searching for valid client for tag */ 358 | iRandomPlayer = CFindRandomPlayerByTeam(CProfile_TeamIndex[i]); 359 | 360 | /* If player not found replace tag with green color tag */ 361 | if (iRandomPlayer == NO_PLAYER) 362 | ReplaceString(szMessage, maxlength, CTag[i], CTagCode[Color_Green], false); 363 | 364 | /* If player was found simply replace */ 365 | else 366 | ReplaceString(szMessage, maxlength, CTag[i], CTagCode[i], false); 367 | 368 | } 369 | /* If found another team color tag throw error */ 370 | else 371 | { 372 | //ReplaceString(szMessage, maxlength, CTag[i], ""); 373 | ThrowError("Using two team colors in one message is not allowed"); 374 | } 375 | } 376 | 377 | } 378 | } 379 | 380 | return iRandomPlayer; 381 | } 382 | 383 | /** 384 | * Founds a random player with specified team 385 | * 386 | * @param color_team Client team. 387 | * @return Client index or NO_PLAYER if no player found 388 | */ 389 | stock CFindRandomPlayerByTeam(color_team) 390 | { 391 | if (color_team == SERVER_INDEX) 392 | return 0; 393 | else 394 | { 395 | for (new i = 1; i <= MaxClients; i++) 396 | { 397 | if (IsClientInGame(i) && GetClientTeam(i) == color_team) 398 | return i; 399 | } 400 | } 401 | 402 | return NO_PLAYER; 403 | } 404 | 405 | /** 406 | * Sends a SayText2 usermessage to a client 407 | * 408 | * @param szMessage Client index 409 | * @param maxlength Author index 410 | * @param szMessage Message 411 | * @return No return. 412 | */ 413 | stock CSayText2(client, author, const String:szMessage[]) 414 | { 415 | new Handle:hBuffer = StartMessageOne("SayText2", client, USERMSG_RELIABLE|USERMSG_BLOCKHOOKS); 416 | 417 | if(GetFeatureStatus(FeatureType_Native, "GetUserMessageType") == FeatureStatus_Available && GetUserMessageType() == UM_Protobuf) 418 | { 419 | PbSetInt(hBuffer, "ent_idx", author); 420 | PbSetBool(hBuffer, "chat", true); 421 | PbSetString(hBuffer, "msg_name", szMessage); 422 | PbAddString(hBuffer, "params", ""); 423 | PbAddString(hBuffer, "params", ""); 424 | PbAddString(hBuffer, "params", ""); 425 | PbAddString(hBuffer, "params", ""); 426 | } 427 | else 428 | { 429 | BfWriteByte(hBuffer, author); 430 | BfWriteByte(hBuffer, true); 431 | BfWriteString(hBuffer, szMessage); 432 | } 433 | 434 | EndMessage(); 435 | } 436 | 437 | /** 438 | * Creates game color profile 439 | * This function must be edited if you want to add more games support 440 | * 441 | * @return No return. 442 | */ 443 | stock CSetupProfile() 444 | { 445 | decl String:szGameName[30]; 446 | GetGameFolderName(szGameName, sizeof(szGameName)); 447 | 448 | if (StrEqual(szGameName, "cstrike", false)) 449 | { 450 | CProfile_Colors[Color_Lightgreen] = true; 451 | CProfile_Colors[Color_Red] = true; 452 | CProfile_Colors[Color_Blue] = true; 453 | CProfile_Colors[Color_Olive] = true; 454 | CProfile_TeamIndex[Color_Lightgreen] = SERVER_INDEX; 455 | CProfile_TeamIndex[Color_Red] = 2; 456 | CProfile_TeamIndex[Color_Blue] = 3; 457 | CProfile_SayText2 = true; 458 | } 459 | else if (StrEqual(szGameName, "csgo", false)) 460 | { 461 | CProfile_Colors[Color_Default] = true; 462 | CProfile_Colors[Color_Darkred] = true; 463 | CProfile_Colors[Color_Pink] = true; 464 | CProfile_Colors[Color_Green] = true; 465 | CProfile_Colors[Color_Lightgreen] = true; 466 | CProfile_Colors[Color_Lime] = true; 467 | CProfile_Colors[Color_Red] = true; 468 | CProfile_Colors[Color_Grey] = true; 469 | CProfile_Colors[Color_Olive] = true; 470 | CProfile_Colors[Color_A] = true; 471 | CProfile_Colors[Color_Lightblue] = true; 472 | CProfile_Colors[Color_Blue] = true; 473 | CProfile_Colors[Color_D] = true; 474 | CProfile_Colors[Color_Purple] = true; 475 | CProfile_Colors[Color_Darkrange] = true; 476 | CProfile_Colors[Color_Orange] = true; 477 | CProfile_Colors[Color_Red] = true; 478 | CProfile_Colors[Color_Blue] = true; 479 | CProfile_Colors[Color_Olive] = true; 480 | CProfile_Colors[Color_Darkred] = true; 481 | CProfile_Colors[Color_Lime] = true; 482 | CProfile_Colors[Color_Purple] = true; 483 | CProfile_Colors[Color_Grey] = true; 484 | CProfile_Colors[Color_Orange] = true; 485 | CProfile_TeamIndex[Color_Red] = 2; 486 | CProfile_TeamIndex[Color_Blue] = 3; 487 | CProfile_SayText2 = true; 488 | } 489 | else if (StrEqual(szGameName, "tf", false)) 490 | { 491 | CProfile_Colors[Color_Lightgreen] = true; 492 | CProfile_Colors[Color_Red] = true; 493 | CProfile_Colors[Color_Blue] = true; 494 | CProfile_Colors[Color_Olive] = true; 495 | CProfile_TeamIndex[Color_Lightgreen] = SERVER_INDEX; 496 | CProfile_TeamIndex[Color_Red] = 2; 497 | CProfile_TeamIndex[Color_Blue] = 3; 498 | CProfile_SayText2 = true; 499 | } 500 | else if (StrEqual(szGameName, "left4dead", false) || StrEqual(szGameName, "left4dead2", false)) 501 | { 502 | CProfile_Colors[Color_Lightgreen] = true; 503 | CProfile_Colors[Color_Red] = true; 504 | CProfile_Colors[Color_Blue] = true; 505 | CProfile_Colors[Color_Olive] = true; 506 | CProfile_TeamIndex[Color_Lightgreen] = SERVER_INDEX; 507 | CProfile_TeamIndex[Color_Red] = 3; 508 | CProfile_TeamIndex[Color_Blue] = 2; 509 | CProfile_SayText2 = true; 510 | } 511 | else if (StrEqual(szGameName, "hl2mp", false)) 512 | { 513 | /* hl2mp profile is based on mp_teamplay convar */ 514 | if (GetConVarBool(FindConVar("mp_teamplay"))) 515 | { 516 | CProfile_Colors[Color_Red] = true; 517 | CProfile_Colors[Color_Blue] = true; 518 | CProfile_Colors[Color_Olive] = true; 519 | CProfile_TeamIndex[Color_Red] = 3; 520 | CProfile_TeamIndex[Color_Blue] = 2; 521 | CProfile_SayText2 = true; 522 | } 523 | else 524 | { 525 | CProfile_SayText2 = false; 526 | CProfile_Colors[Color_Olive] = true; 527 | } 528 | } 529 | else if (StrEqual(szGameName, "dod", false)) 530 | { 531 | CProfile_Colors[Color_Olive] = true; 532 | CProfile_SayText2 = false; 533 | } 534 | /* Profile for other games */ 535 | else 536 | { 537 | if (GetUserMessageId("SayText2") == INVALID_MESSAGE_ID) 538 | { 539 | CProfile_SayText2 = false; 540 | } 541 | else 542 | { 543 | CProfile_Colors[Color_Red] = true; 544 | CProfile_Colors[Color_Blue] = true; 545 | CProfile_TeamIndex[Color_Red] = 2; 546 | CProfile_TeamIndex[Color_Blue] = 3; 547 | CProfile_SayText2 = true; 548 | } 549 | } 550 | } 551 | 552 | public Action:CEvent_MapStart(Handle:event, const String:name[], bool:dontBroadcast) 553 | { 554 | CSetupProfile(); 555 | 556 | for (new i = 1; i <= MaxClients; i++) 557 | CSkipList[i] = false; 558 | } 559 | 560 | -------------------------------------------------------------------------------- /include/entWatch.inc: -------------------------------------------------------------------------------- 1 | #if defined _entWatch_include 2 | #endinput 3 | #endif 4 | #define _entWatch_include 5 | 6 | //---------------------------------------------------------------------------------------------------- 7 | // Purpose: SMLib 8 | //---------------------------------------------------------------------------------------------------- 9 | stock Entity_GetTargetName(entity, String:buffer[], size) 10 | { 11 | return GetEntPropString(entity, Prop_Data, "m_iName", buffer, size); 12 | } 13 | 14 | //---------------------------------------------------------------------------------------------------- 15 | // Purpose: SMLib 16 | //---------------------------------------------------------------------------------------------------- 17 | stock Entity_GetParentName(entity, String:buffer[], size) 18 | { 19 | return GetEntPropString(entity, Prop_Data, "m_iParent", buffer, size); 20 | } 21 | 22 | //---------------------------------------------------------------------------------------------------- 23 | // Purpose: SMLib 24 | //---------------------------------------------------------------------------------------------------- 25 | stock Entity_GetHammerID(entity) 26 | { 27 | return GetEntProp(entity, Prop_Data, "m_iHammerID"); 28 | } 29 | 30 | //---------------------------------------------------------------------------------------------------- 31 | // Purpose: SMLib 32 | //---------------------------------------------------------------------------------------------------- 33 | stock Entity_GetClassName(entity, String:buffer[], size) 34 | { 35 | GetEntPropString(entity, Prop_Data, "m_iClassname", buffer, size); 36 | 37 | if (buffer[0] == '\0') { 38 | return false; 39 | } 40 | 41 | return true; 42 | } 43 | 44 | //---------------------------------------------------------------------------------------------------- 45 | // Purpose: SMLib 46 | //---------------------------------------------------------------------------------------------------- 47 | stock Entity_GetEntityFromHammerID(hammerID) 48 | { 49 | for (new i = 0; i < GetEntityCount(); i++) 50 | { 51 | if (IsValidEdict(i)) 52 | { 53 | if (Entity_GetHammerID(i) == hammerID) 54 | { 55 | return i; 56 | } 57 | } 58 | } 59 | 60 | return -1; 61 | } 62 | 63 | public SharedPlugin:__pl_entWatch = 64 | { 65 | name = "entWatch", 66 | file = "entWatch.smx", 67 | #if defined REQUIRE_PLUGIN 68 | required = 1 69 | #else 70 | required = 0 71 | #endif 72 | }; -------------------------------------------------------------------------------- /include/leader.inc: -------------------------------------------------------------------------------- 1 | #if defined _leader_included_ 2 | #endinput 3 | #endif 4 | #define _leader_included_ 5 | 6 | /** 7 | * Returns current leader 8 | * 9 | * @return int Client index of the leader (-1 = null) 10 | */ 11 | native Leader_CurrentLeader(); -------------------------------------------------------------------------------- /include/skillbot.inc: -------------------------------------------------------------------------------- 1 | #if defined _skillbot_included_ 2 | #endinput 3 | #endif 4 | #define _skillbot_included_ 5 | 6 | /** 7 | * Returns character's rank formatted for chat as a string. 8 | * 9 | * @param int Client index to be checked. 10 | * @param string String to be set. 11 | * @param int Maxlength of string to be set. 12 | */ 13 | native SB_GetChatRank(client, String:rank[], maxlen); 14 | 15 | /** 16 | * Returns character's rank number. 17 | * 18 | * @param int Client index to be checked. 19 | */ 20 | native SB_GetRank(client); 21 | 22 | /** 23 | * Returns rank number formatted for menus as a string. 24 | * 25 | * @param int Rank index. 26 | * @param string String to be set. 27 | * @param int Maxlength of string to be set. 28 | */ 29 | native SB_GetRank2(ranknum, String:rank[], maxlen); 30 | 31 | /** 32 | * Sets client's point value. 33 | * 34 | * @param int Client index to be checked. 35 | */ 36 | native SB_SetPoints(client, amount); 37 | 38 | /** 39 | * Adds points to client. 40 | * 41 | * @param int Client index to be checked. 42 | */ 43 | native SB_AddPoints(client, amount); 44 | 45 | /** 46 | * Subtracts points from client. 47 | * 48 | * @param int Client index to be checked. 49 | */ 50 | native SB_SubPoints(client, amount); 51 | 52 | /** 53 | * Returns client's current point value. 54 | * 55 | * @param int Client index to be checked. 56 | */ 57 | native SB_GetPoints(client); -------------------------------------------------------------------------------- /leader/materials.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/strellic/sourcemod-plugins/da6c2e702cde59f3e24b56d339e0ca27deb23b85/leader/materials.zip -------------------------------------------------------------------------------- /leader/materials/sg/sgdefend.vmt: -------------------------------------------------------------------------------- 1 | "UnlitGeneric" 2 | { 3 | "$basetexture" "sg/sgdefend" 4 | "$translucent" 1 5 | } 6 | -------------------------------------------------------------------------------- /leader/materials/sg/sgdefend.vtf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/strellic/sourcemod-plugins/da6c2e702cde59f3e24b56d339e0ca27deb23b85/leader/materials/sg/sgdefend.vtf -------------------------------------------------------------------------------- /leader/materials/sg/sgfollow.vmt: -------------------------------------------------------------------------------- 1 | "UnlitGeneric" 2 | { 3 | "$basetexture" "sg/sgfollow" 4 | "$translucent" 1 5 | } 6 | -------------------------------------------------------------------------------- /leader/materials/sg/sgfollow.vtf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/strellic/sourcemod-plugins/da6c2e702cde59f3e24b56d339e0ca27deb23b85/leader/materials/sg/sgfollow.vtf -------------------------------------------------------------------------------- /logconnections_admin.sp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #define PLUGIN_VERSION "1.1" 5 | #define PLUGIN_NAME "Log Connections (Admin only)" 6 | 7 | public Plugin:myinfo = 8 | { 9 | name = PLUGIN_NAME, 10 | author = "Xander (Player 1)", 11 | description = "This plugin logs players' connect and disconnect times along with their Name, SteamID, and IP Address to a text file at /sourcemod/logs/connections/ seperate from the server logs.", 12 | version = PLUGIN_VERSION, 13 | url = "https://forums.alliedmods.net/showthread.php?p=1845362" 14 | } 15 | 16 | new String:g_sFilePath[PLATFORM_MAX_PATH]; 17 | 18 | public OnPluginStart() 19 | { 20 | BuildPath(Path_SM, g_sFilePath, sizeof(g_sFilePath), "logs/connections"); 21 | 22 | if (!DirExists(g_sFilePath)) 23 | { 24 | CreateDirectory(g_sFilePath, 511); 25 | 26 | if (!DirExists(g_sFilePath)) 27 | SetFailState("Failed to create directory at /sourcemod/logs/connections - Please manually create that path and reload this plugin."); 28 | } 29 | 30 | CreateConVar("sm_log_connections_version", PLUGIN_VERSION, PLUGIN_NAME, FCVAR_NOTIFY); 31 | 32 | //HookEvent("player_connect", Event_PlayerConnect, EventHookMode_Post); 33 | HookEvent("player_disconnect", Event_PlayerDisconnect, EventHookMode_Pre); 34 | } 35 | 36 | public OnMapStart() 37 | { 38 | decl String:FormatedTime[100], 39 | String:MapName[100]; 40 | 41 | new CurrentTime = GetTime(); 42 | 43 | GetCurrentMap(MapName, 100); 44 | FormatTime(FormatedTime, 100, "%d_%b_%Y", CurrentTime); //name the file 'day month year' 45 | 46 | BuildPath(Path_SM, g_sFilePath, sizeof(g_sFilePath), "/logs/connections/%s.txt", FormatedTime); 47 | 48 | new Handle:FileHandle = OpenFile(g_sFilePath, "a+"); 49 | 50 | FormatTime(FormatedTime, 100, "%X", CurrentTime); 51 | 52 | WriteFileLine(FileHandle, ""); 53 | WriteFileLine(FileHandle, "%s - ===== Map change to %s =====", FormatedTime, MapName); 54 | WriteFileLine(FileHandle, ""); 55 | 56 | CloseHandle(FileHandle); 57 | } 58 | 59 | public void OnClientPostAdminCheck(int client) 60 | { 61 | if (!client) 62 | {} 63 | 64 | else if (IsFakeClient(client)) 65 | {} 66 | 67 | else if(CheckCommandAccess(client, "generic_admin", ADMFLAG_GENERIC, false)) 68 | { 69 | decl String:PlayerName[64], 70 | String:Authid[64], 71 | String:IPAddress[64], 72 | String:Country[64], 73 | String:FormatedTime[64]; 74 | 75 | GetClientName(client, PlayerName, 64); 76 | 77 | GetClientAuthId(client, AuthId_Steam2, Authid, sizeof(Authid), false); 78 | GetClientIP(client, IPAddress, 64); 79 | FormatTime(FormatedTime, 64, "%X", GetTime()) 80 | 81 | if(!GeoipCountry(IPAddress, Country, 64)) 82 | Format(Country, 64, "Unknown"); 83 | 84 | new Handle:FileHandle = OpenFile(g_sFilePath, "a+"); 85 | 86 | WriteFileLine(FileHandle, "%s - <%s> <%s> <%s> CONNECTED from <%s>", 87 | FormatedTime, 88 | PlayerName, 89 | Authid, 90 | IPAddress, 91 | Country); 92 | 93 | CloseHandle(FileHandle); 94 | } 95 | } 96 | 97 | /* 98 | public Action:Event_PlayerConnect(Handle:event, const String:name[], bool:dontBroadcast) 99 | { 100 | CreateTimer(5.0, LogConnectionInfo, GetEventInt(event, "userid")); 101 | } 102 | 103 | public Action:LogConnectionInfo(Handle:timer, any:UserID) 104 | { 105 | new client = GetClientOfUserId(UserID); //will return 0 if the client quits, even if a new player takes his slot 106 | 107 | if (!client) 108 | {} 109 | 110 | else if (IsFakeClient(client)) 111 | {} 112 | 113 | else if (!IsClientAuthorized(client)) 114 | CreateTimer(5.0, LogConnectionInfo, UserID); //client's steamid isn't known yet; retry in 5 seconds 115 | 116 | else 117 | { 118 | decl String:PlayerName[64], 119 | String:Authid[64], 120 | String:IPAddress[64], 121 | String:Country[64], 122 | String:FormatedTime[64]; 123 | 124 | GetClientName(client, PlayerName, 64); 125 | GetClientAuthString(client, Authid, 64); 126 | GetClientIP(client, IPAddress, 64); 127 | FormatTime(FormatedTime, 64, "%X", GetTime()) 128 | 129 | if(!GeoipCountry(IPAddress, Country, 64)) 130 | Format(Country, 64, "Unknown"); 131 | 132 | new Handle:FileHandle = OpenFile(g_sFilePath, "a+"); 133 | 134 | WriteFileLine(FileHandle, "%s - <%s> <%s> <%s> CONNECTED from <%s>", 135 | FormatedTime, 136 | PlayerName, 137 | Authid, 138 | IPAddress, 139 | Country); 140 | 141 | CloseHandle(FileHandle); 142 | } 143 | } 144 | */ 145 | 146 | 147 | public Action:Event_PlayerDisconnect(Handle:event, const String:name[], bool:dontBroadcast) 148 | { 149 | new client = GetClientOfUserId(GetEventInt(event, "userid")); 150 | 151 | if (!client) 152 | {} 153 | 154 | else if (IsFakeClient(client)) 155 | {} 156 | 157 | else if(CheckCommandAccess(client, "generic_admin", ADMFLAG_GENERIC, false)) 158 | { 159 | new ConnectionTime = -1, 160 | Handle:FileHandle = OpenFile(g_sFilePath, "a+"); 161 | 162 | decl String:PlayerName[64], 163 | String:Authid[64], 164 | String:IPAddress[64], 165 | String:FormatedTime[64], 166 | String:Reason[128]; 167 | 168 | GetClientName(client, PlayerName, 64); 169 | GetClientIP(client, IPAddress, 64); 170 | FormatTime(FormatedTime, 64, "%X", GetTime()); 171 | GetEventString(event, "reason", Reason, 128); 172 | 173 | if (!GetClientAuthId(client, AuthId_Steam2, Authid, sizeof(Authid), false)) 174 | Format(Authid, 64, "Unknown SteamID"); 175 | 176 | if (IsClientInGame(client)) 177 | ConnectionTime = RoundToCeil(GetClientTime(client) / 60); 178 | 179 | 180 | WriteFileLine(FileHandle, "%s - <%s> <%s> <%s> DISCONNECTED after %d minutes. <%s>", 181 | FormatedTime, 182 | PlayerName, 183 | Authid, 184 | IPAddress, 185 | ConnectionTime, 186 | Reason); 187 | 188 | CloseHandle(FileHandle); 189 | } 190 | } 191 | -------------------------------------------------------------------------------- /mutedead.sp: -------------------------------------------------------------------------------- 1 | #pragma semicolon 1 2 | 3 | #include 4 | #include 5 | 6 | #pragma newdecls required 7 | 8 | bool g_bDeadMuted[MAXPLAYERS+1]; 9 | 10 | public Plugin myinfo = 11 | { 12 | name = "Mute Dead", 13 | description = "It mutes dead players", 14 | author = "R3TROATTACK + AntiTeal", 15 | version = "1.00", 16 | url = "www.steam-gamers.net/forum/forum.php" 17 | }; 18 | 19 | public void OnPluginStart() 20 | { 21 | RegConsoleCmd("sm_md", Command_MuteDead); 22 | HookEvent("player_death", Event_PlayerDeath, EventHookMode_Post); 23 | HookEvent("round_end", Event_RoundEnd, EventHookMode_Post); 24 | } 25 | 26 | public void OnClientPostAdminCheck(int client) 27 | { 28 | g_bDeadMuted[client] = false; 29 | } 30 | 31 | public Action Command_MuteDead(int client, int args) 32 | { 33 | if (client <= 0 || client > MaxClients) 34 | { 35 | return Plugin_Handled; 36 | } 37 | 38 | g_bDeadMuted[client] = !g_bDeadMuted[client]; 39 | if (g_bDeadMuted[client]) 40 | { 41 | PrintToChat(client, " [Mute-Dead] \x01Dead players are now muted!"); 42 | MuteDeadPlayers(client); 43 | } 44 | else 45 | { 46 | PrintToChat(client, " [Mute-Dead] \x01Dead players are now not muted!"); 47 | UnmuteDeadPlayers(client); 48 | } 49 | return Plugin_Handled; 50 | } 51 | 52 | public void Event_PlayerDeath(Event event, char[] name, bool dontBroadcast) 53 | { 54 | int client = GetClientOfUserId(event.GetInt("userid")); 55 | for(int i = 1; i <= MaxClients; i++) 56 | { 57 | if (IsClientInGame(i)) 58 | { 59 | if (!IsPlayerAlive(i) && g_bDeadMuted[client]) 60 | { 61 | SetListenOverride(client, i, Listen_No); 62 | SetListenOverride(i, client, Listen_No); 63 | } 64 | SetListenOverride(client, i, Listen_Default); 65 | SetListenOverride(i, client, Listen_Default); 66 | } 67 | } 68 | } 69 | 70 | public void Event_RoundEnd(Event event, char[] name, bool dontBroadcast) 71 | { 72 | for(int i = 1; i <= MaxClients; i++) 73 | { 74 | if (IsClientInGame(i)) 75 | { 76 | UnmuteDeadPlayers(i); 77 | } 78 | } 79 | } 80 | 81 | public void MuteDeadPlayers(int client) 82 | { 83 | for(int i = 1; i <= MaxClients; i++) 84 | { 85 | if (IsClientInGame(i)) 86 | { 87 | if (!IsPlayerAlive(i)) 88 | { 89 | SetListenOverride(client, i, Listen_No); 90 | SetListenOverride(i, client, Listen_No); 91 | } 92 | SetListenOverride(client, i, Listen_Default); 93 | SetListenOverride(i, client, Listen_Default); 94 | } 95 | } 96 | } 97 | 98 | public void UnmuteDeadPlayers(int client) 99 | { 100 | for(int i = 1; i <= MaxClients; i++) 101 | { 102 | if (IsClientInGame(i)) 103 | { 104 | SetListenOverride(client, i, Listen_Default); 105 | SetListenOverride(i, client, Listen_Default); 106 | } 107 | } 108 | } -------------------------------------------------------------------------------- /muteonvote_teal.sp: -------------------------------------------------------------------------------- 1 | #pragma semicolon 1 2 | 3 | // ====[ INCLUDES ]============================================================ 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | // ====[ DEFINES ]============================================================= 10 | #define PLUGIN_VERSION "2.2.0_teal" 11 | 12 | // ====[ HANDLES | CVARS ]===================================================== 13 | new Handle:cvarEnabled; 14 | new Handle:cvarImmunity; 15 | new Handle:cvarSBRank; 16 | 17 | // ====[ VARIABLES ]=========================================================== 18 | new g_iEnabled; 19 | new bool:g_bImmunity; 20 | new bool:g_bVoteInProgress; 21 | new bool:g_bMuted[MAXPLAYERS + 1]; 22 | new bool:g_bGagged[MAXPLAYERS + 1]; 23 | 24 | // ====[ PLUGIN ]============================================================== 25 | public Plugin:myinfo = 26 | { 27 | name = "Mute On Vote", 28 | author = "ReFlexPoison + AntiTeal", 29 | description = "Mute, gag, or silence players after a vote is started", 30 | version = PLUGIN_VERSION, 31 | url = "http://forums.alliedmods.net/showthread.php?t=184334" 32 | } 33 | 34 | // ====[ FUNCTIONS ]=========================================================== 35 | public OnPluginStart() 36 | { 37 | CreateConVar("sm_muteonvote_version", PLUGIN_VERSION, "Mute On Vote Version", FCVAR_REPLICATED | FCVAR_PLUGIN | FCVAR_SPONLY | FCVAR_DONTRECORD | FCVAR_NOTIFY); 38 | 39 | cvarEnabled = CreateConVar("sm_muteonvote_enabled", "1", "Enable Mute On Vote\n0 = Disabled\n1 = Mute\n2 = Gag\n3 = Silence", FCVAR_NONE, true, 0.0, true, 3.0); 40 | g_iEnabled = GetConVarInt(cvarEnabled); 41 | cvarImmunity = CreateConVar("sm_muteonvote_immunity", "1", "Enable admin immunity\n0 = Disabled\n1 = Enabled", FCVAR_NONE, true, 0.0, true, 1.0); 42 | g_bImmunity = GetConVarBool(cvarImmunity); 43 | 44 | cvarSBRank = CreateConVar("sm_muteonvote_sbrank", "5", "The rank at which players won't be muted (Ranks start at 0, -1 disables)"); 45 | 46 | HookConVarChange(cvarEnabled, CVarChanged); 47 | HookConVarChange(cvarImmunity, CVarChanged); 48 | 49 | LoadTranslations("muteonvote.phrases"); 50 | 51 | CreateTimer(0.1, Timer_Mute, _, TIMER_REPEAT); 52 | } 53 | 54 | public CVarChanged(Handle:hConvar, const String:strOldVal[], const String:strNewVal[]) 55 | { 56 | if(hConvar == cvarEnabled) 57 | { 58 | g_iEnabled = GetConVarInt(cvarEnabled); 59 | for(new i = 1; i <= MaxClients; i++) if(IsValidClient(i)) 60 | { 61 | UnmutePlayer(i); 62 | UngagPlayer(i); 63 | } 64 | } 65 | if(hConvar == cvarImmunity) 66 | g_bImmunity = GetConVarBool(cvarImmunity); 67 | } 68 | 69 | // ====[ TIMERS ]============================================================== 70 | public Action:Timer_Mute(Handle:hTimer) 71 | { 72 | if(g_iEnabled <= 0) 73 | return Plugin_Continue; 74 | 75 | if(IsVoteInProgress() && !g_bVoteInProgress) 76 | { 77 | switch(g_iEnabled) 78 | { 79 | case 1: 80 | { 81 | PrintToChatAll("[SM] %t", "muteall"); 82 | LogMessage("%t", "muteall"); 83 | } 84 | case 2: 85 | { 86 | PrintToChatAll("[SM] %t", "gagall"); 87 | LogMessage("%t", "gagall"); 88 | } 89 | case 3: 90 | { 91 | PrintToChatAll("[SM] %t", "silenceall"); 92 | LogMessage("%t", "silenceall"); 93 | } 94 | } 95 | for(new i = 1; i <= MaxClients; i++) if(IsValidClient(i)) 96 | { 97 | if(g_bImmunity && IsAdmin(i)) 98 | PrintToChat(i, "[SM] %t", "immunity"); 99 | else switch(g_iEnabled) 100 | { 101 | case 1: MutePlayer(i); 102 | case 2: GagPlayer(i); 103 | case 3: 104 | { 105 | MutePlayer(i); 106 | GagPlayer(i); 107 | } 108 | } 109 | g_bVoteInProgress = true; 110 | } 111 | } 112 | else if(!IsVoteInProgress() && g_bVoteInProgress) 113 | { 114 | PrintToChatAll("[SM] %t", "restore"); 115 | LogMessage("%t", "restore_server"); 116 | for(new i = 1; i <= MaxClients; i++) if(IsValidClient(i)) 117 | { 118 | UnmutePlayer(i); 119 | UngagPlayer(i); 120 | } 121 | g_bVoteInProgress = false; 122 | } 123 | return Plugin_Continue; 124 | } 125 | 126 | // ====[ STOCKS ]============================================================== 127 | stock bool:IsValidClient(iClient, bool:bReplay = true) 128 | { 129 | if(iClient <= 0 || iClient > MaxClients) 130 | return false; 131 | if(!IsClientInGame(iClient)) 132 | return false; 133 | if(bReplay && (IsClientSourceTV(iClient) || IsClientReplay(iClient))) 134 | return false; 135 | return true; 136 | } 137 | 138 | stock bool:IsAdmin(iClient) 139 | { 140 | if(CheckCommandAccess(iClient, "muteonvote_flag", ADMFLAG_GENERIC)) 141 | { 142 | return true; 143 | } 144 | 145 | int rank = GetConVarInt(cvarSBRank); 146 | if(rank != -1) 147 | { 148 | if(SB_GetRank(iClient) >= rank) 149 | { 150 | return true; 151 | } 152 | } 153 | 154 | if(Leader_CurrentLeader() == iClient) 155 | { 156 | return true; 157 | } 158 | 159 | return false; 160 | } 161 | 162 | stock MutePlayer(iClient) 163 | { 164 | g_bMuted[iClient] = BaseComm_IsClientMuted(iClient); 165 | if(!g_bMuted[iClient]) 166 | BaseComm_SetClientMute(iClient, true); 167 | } 168 | 169 | stock UnmutePlayer(iClient) 170 | { 171 | if(!g_bMuted[iClient]) 172 | BaseComm_SetClientMute(iClient, false); 173 | } 174 | 175 | stock GagPlayer(iClient) 176 | { 177 | g_bGagged[iClient] = BaseComm_IsClientGagged(iClient); 178 | if(!g_bGagged[iClient]) 179 | BaseComm_SetClientGag(iClient, true); 180 | } 181 | 182 | stock UngagPlayer(iClient) 183 | { 184 | if(!g_bGagged[iClient]) 185 | BaseComm_SetClientGag(iClient, false); 186 | } 187 | 188 | stock ClearTimer(&Handle:hTimer) 189 | { 190 | if(hTimer != INVALID_HANDLE) 191 | { 192 | KillTimer(hTimer); 193 | hTimer = INVALID_HANDLE; 194 | } 195 | } -------------------------------------------------------------------------------- /particlelog.sp: -------------------------------------------------------------------------------- 1 | #pragma semicolon 1 2 | 3 | #include 4 | #include 5 | 6 | #pragma newdecls required 7 | 8 | #define PLUGIN_VERSION "1.0" 9 | 10 | public Plugin myinfo = { 11 | name = "ParticleLog", 12 | author = "AntiTeal", 13 | description = "", 14 | version = PLUGIN_VERSION, 15 | url = "" 16 | }; 17 | 18 | Handle logFile; 19 | char particleFile[64], mapName[32]; 20 | Handle g_aParticleList; 21 | Handle g_adtArray; 22 | 23 | public void OnPluginStart() 24 | { 25 | LoadTranslations("common.phrases"); 26 | LoadTranslations("core.phrases"); 27 | } 28 | 29 | public void OnMapStart() 30 | { 31 | GetCurrentMap(mapName, sizeof(mapName)); 32 | BuildPath(Path_SM, particleFile, PLATFORM_MAX_PATH, "particlelog/%s.log", mapName); 33 | logFile = OpenFile(particleFile, "at+"); 34 | CheckFile(); 35 | } 36 | public void CheckFile() 37 | { 38 | g_aParticleList = CreateArray(255); 39 | 40 | while (!IsEndOfFile(logFile)) 41 | { 42 | char line[255]; 43 | 44 | if(!ReadFileLine(logFile, line, sizeof(line))) 45 | { 46 | break; 47 | } 48 | 49 | TrimString(line); 50 | 51 | if (!line[0]) 52 | continue; 53 | 54 | PushArrayString(g_aParticleList, line); 55 | } 56 | WriteParticles(); 57 | } 58 | 59 | public void WriteParticles() 60 | { 61 | g_adtArray = CreateArray(256); 62 | int index = -1; 63 | 64 | while ((index = FindEntityByClassname(index, "info_particle_system")) != -1) { 65 | char p[256]; 66 | GetEntPropString(index, Prop_Data, "m_iszEffectName", p, sizeof(p)); 67 | if(StrContains(p, "custom_particle_", false) == -1) 68 | { 69 | if(FindStringInArray(g_adtArray, p) == -1 && FindStringInArray(g_aParticleList, p) == -1) 70 | { 71 | PushArrayString(g_adtArray, p); 72 | WriteFileLine(logFile, p); 73 | } 74 | } 75 | } 76 | CloseHandle(logFile); 77 | CheckDelete(); 78 | } 79 | 80 | public void CheckDelete() 81 | { 82 | if(FileSize(particleFile) == 0) 83 | { 84 | DeleteFile(particleFile); 85 | } 86 | } -------------------------------------------------------------------------------- /perks/basic.sp: -------------------------------------------------------------------------------- 1 | char g_sBodyColors[PERKS_MAX_ITEMS][16]; 2 | 3 | int g_aTracerColor[MAXPLAYERS + 1][3]; 4 | char g_sTracerColor[PERKS_MAX_ITEMS][16]; 5 | int g_iBeam = -1; 6 | bool g_bRainbow[MAXPLAYERS+1] = {false, ...}; 7 | bool g_bDisableTracers[MAXPLAYERS+1] = {false, ...}; 8 | Handle gH_sTracers = INVALID_HANDLE; 9 | 10 | char g_sGrenadeSkin[PERKS_MAX_ITEMS][PLATFORM_MAX_PATH]; 11 | char g_sGrenadePlayer[MAXPLAYERS+1][PLATFORM_MAX_PATH]; 12 | 13 | enum Model { 14 | String:modelArms[PLATFORM_MAX_PATH], 15 | String:modelModel[PLATFORM_MAX_PATH] 16 | } 17 | Model Models[PERKS_MAX_ITEMS][Model]; 18 | Model PlayerModels[MAXPLAYERS+1][Model]; 19 | 20 | char g_sServerCommands[PERKS_MAX_ITEMS][64]; 21 | 22 | Handle perks_bodycolor = INVALID_HANDLE; 23 | Handle perks_tracer = INVALID_HANDLE; 24 | Handle perks_grenskin = INVALID_HANDLE; 25 | Handle perks_model = INVALID_HANDLE; 26 | 27 | public void Basic_OnPluginStart() 28 | { 29 | perks_bodycolor = RegClientCookie("perks_bodycolor", "", CookieAccess_Protected); 30 | perks_tracer = RegClientCookie("perks_tracer", "", CookieAccess_Protected); 31 | perks_grenskin = RegClientCookie("perks_grenskin", "", CookieAccess_Protected); 32 | perks_model = RegClientCookie("perks_model", "", CookieAccess_Protected); 33 | Perks_RegisterHandler("bcolor", perks_bodycolor, INVALID_FUNCTION, INVALID_FUNCTION, BodyColors_Config, BodyColors_Equip, BodyColors_Remove, true); 34 | Perks_RegisterHandler("tracer", perks_tracer, INVALID_FUNCTION, INVALID_FUNCTION, Tracer_Config, Tracer_Equip, Tracer_Remove, true); 35 | Perks_RegisterHandler("grenskin", perks_grenskin, INVALID_FUNCTION, INVALID_FUNCTION, GrenSkin_Config, GrenSkin_Equip, GrenSkin_Remove, true); 36 | Perks_RegisterHandler("model", perks_model, INVALID_FUNCTION, INVALID_FUNCTION, Model_Config, Model_Equip, Model_Remove, true); 37 | Perks_RegisterHandler("svcmd", INVALID_HANDLE, INVALID_FUNCTION, INVALID_FUNCTION, SVCMD_Config, SVCMD_Equip, INVALID_FUNCTION, false); 38 | 39 | gH_sTracers = RegClientCookie("sm_sbperks_tracerstatus", "", CookieAccess_Protected); 40 | } 41 | 42 | public void Basic_OnMapStart() 43 | { 44 | g_iBeam = PrecacheModel("materials/sprites/laserbeam.vmt", true); 45 | } 46 | 47 | public void Basic_PlayerDeath(Handle event) 48 | { 49 | int client = GetClientOfUserId(GetEventInt(event, "userid")); 50 | CreateTimer(1.0, SpawnDelay, GetClientSerial(client)); 51 | } 52 | 53 | public void Basic_PlayerSpawn(Handle event) 54 | { 55 | int client = GetClientOfUserId(GetEventInt(event, "userid")); 56 | CreateTimer(1.0, SpawnDelay, GetClientSerial(client)); 57 | CreateTimer(2.0, Timer_SetClientModel, GetClientSerial(client)); 58 | } 59 | 60 | public Action Timer_SetClientModel(Handle timer, any serial) 61 | { 62 | int player = GetClientFromSerial(serial); 63 | if (player == 0) 64 | { 65 | return Plugin_Stop; 66 | } 67 | SetClientModel(player); 68 | return Plugin_Handled; 69 | } 70 | 71 | public void Basic_Disconnect(int client) 72 | { 73 | for(int i = 0; i < 3; i++) 74 | { 75 | g_aTracerColor[client][i] = 0; 76 | } 77 | g_bRainbow[client] = false; 78 | g_bDisableTracers[client] = false; 79 | g_sGrenadePlayer[client][0] = '\0'; 80 | } 81 | 82 | public void Basic_CookiesCached(int client) 83 | { 84 | char status[8]; 85 | GetClientCookie(client, gH_sTracers, status, sizeof(status)); 86 | if(!StrEqual(status, "off", false)) 87 | g_bDisableTracers[client] = true; 88 | else 89 | g_bDisableTracers[client] = false; 90 | } 91 | 92 | public void Basic_AskPluginLoad2() 93 | { 94 | CreateNative("Perks_ToggleTracers", Native_ToggleTracers); 95 | } 96 | 97 | public Action SpawnDelay(Handle timer, any serial) 98 | { 99 | int client = GetClientFromSerial(serial); 100 | if (client == 0) 101 | { 102 | return Plugin_Stop; 103 | } 104 | 105 | Perks_Reequip(client, "bcolor"); 106 | Perks_Reequip(client, "tracer"); 107 | Perks_Reequip(client, "grenskin"); 108 | Perks_Reequip(client, "model"); 109 | return Plugin_Handled; 110 | } 111 | 112 | //START SVCMD 113 | public void SVCMD_Config(Handle &kv, int id) 114 | { 115 | KvGetString(kv, "cmd", g_sServerCommands[id], sizeof(g_sServerCommands[])); 116 | } 117 | 118 | public void SVCMD_Equip(int client, int id) 119 | { 120 | char clientname[64], clientid[8], command[64]; 121 | GetClientName(client, clientname, sizeof(clientname)); 122 | Format(clientname, sizeof(clientname), "\"%s\"", clientname); 123 | 124 | strcopy(command, sizeof(command), g_sServerCommands[id]); 125 | 126 | //Patches ServerCommand PlayerName exploit 127 | ReplaceString(clientname, sizeof(clientname), ";", ""); 128 | ReplaceString(command, sizeof(command), "{playername}", clientname); 129 | 130 | Format(clientid, sizeof(clientid), "#%i", GetClientUserId(client)); 131 | ReplaceString(command, sizeof(command), "{playerid}", clientid); 132 | 133 | ServerCommand(command); 134 | } 135 | //END SVCMD 136 | 137 | //START MODEL 138 | public void Model_Config(Handle &kv, int id) 139 | { 140 | KvGetString(kv, "model", Models[id][modelModel], PLATFORM_MAX_PATH); 141 | KvGetString(kv, "arms", Models[id][modelArms], PLATFORM_MAX_PATH); 142 | if(FileExists(Models[id][modelModel])) { 143 | PrecacheModel2(Models[id][modelModel], true); 144 | Downloader_AddFileToDownloadsTable(Models[id][modelModel]); 145 | } 146 | if(FileExists(Models[id][modelArms])) { 147 | PrecacheModel2(Models[id][modelArms], true); 148 | Downloader_AddFileToDownloadsTable(Models[id][modelArms]); 149 | } 150 | } 151 | 152 | public void Model_Equip(int client, int id) 153 | { 154 | PlayerModels[client] = Models[id]; 155 | SetClientModel(client); 156 | } 157 | 158 | public void Model_Remove(int client, int id) 159 | { 160 | PlayerModels[client][modelModel][0] = '\0'; 161 | PlayerModels[client][modelArms][0] = '\0'; 162 | } 163 | 164 | public void SetClientModel(int client) 165 | { 166 | if(!IsPlayerAlive(client) || ZR_IsClientZombie(client)) 167 | { 168 | return; 169 | } 170 | 171 | if(strlen(PlayerModels[client][modelModel]) != 0) 172 | { 173 | if(!IsModelPrecached(PlayerModels[client][modelModel])) 174 | { 175 | PrecacheModel(PlayerModels[client][modelModel]); 176 | } 177 | SetEntityModel(client, PlayerModels[client][modelModel]); 178 | } 179 | if(strlen(PlayerModels[client][modelArms]) != 0) 180 | { 181 | if(!IsModelPrecached(PlayerModels[client][modelArms])) 182 | { 183 | PrecacheModel(PlayerModels[client][modelArms]); 184 | } 185 | SetEntPropString(client, Prop_Send, "m_szArmsModel", PlayerModels[client][modelArms]); 186 | } 187 | return; 188 | } 189 | //END MODEL 190 | 191 | //START GRENSKIN 192 | public void GrenSkin_Config(Handle &kv, int id) 193 | { 194 | KvGetString(kv, "model", g_sGrenadeSkin[id], sizeof(g_sGrenadeSkin[])); 195 | PrecacheModel(g_sGrenadeSkin[id]); 196 | } 197 | 198 | public void GrenSkin_Equip(int client, int id) 199 | { 200 | strcopy(g_sGrenadePlayer[client], sizeof(g_sGrenadePlayer[]), g_sGrenadeSkin[id]); 201 | } 202 | 203 | public void GrenSkin_Remove(int client, int id) 204 | { 205 | g_sGrenadePlayer[client][0] = '\0'; 206 | } 207 | 208 | public void Basic_GrenSkin_OnEntitySpawnedPost(int entity) 209 | { 210 | int player = GetEntPropEnt(entity, Prop_Send, "m_hOwnerEntity"); 211 | if(!IsClientInGame(player) || strlen(g_sGrenadePlayer[player]) == 0) 212 | { 213 | return; 214 | } 215 | if(!IsModelPrecached(g_sGrenadePlayer[player])) 216 | { 217 | PrecacheModel(g_sGrenadePlayer[player]); 218 | } 219 | 220 | SetEntityModel(entity, g_sGrenadePlayer[player]); 221 | } 222 | //END GRENSKIN 223 | //START TRACER 224 | public int Native_ToggleTracers(Handle plugin, int numParams) 225 | { 226 | int client = GetNativeCell(1); 227 | char status[8]; 228 | GetClientCookie(client, gH_sTracers, status, sizeof(status)); 229 | 230 | if(!StrEqual(status, "off", false)) 231 | { 232 | SetClientCookie(client, gH_sTracers, "off"); 233 | PrintChat(client, "You have turned off tracers."); 234 | g_bDisableTracers[client] = true; 235 | } 236 | else 237 | { 238 | SetClientCookie(client, gH_sTracers, "on"); 239 | PrintChat(client, "You have turned on tracers."); 240 | g_bDisableTracers[client] = false; 241 | } 242 | } 243 | public void Basic_BulletImpact(Handle event) 244 | { 245 | int player = GetClientOfUserId(GetEventInt(event, "userid")); 246 | 247 | if(!g_bRainbow[player] && (g_aTracerColor[player][0] == g_aTracerColor[player][1]) && (g_aTracerColor[player][1] == g_aTracerColor[player][2])) 248 | { 249 | if(g_aTracerColor[player][2] == 255 || g_aTracerColor[player][2] == 0) 250 | { 251 | return; 252 | } 253 | } 254 | 255 | float m_fOrigin[3], m_fImpact[3]; 256 | 257 | GetClientEyePosition(player, m_fOrigin); 258 | m_fImpact[0] = GetEventFloat(event, "x"); 259 | m_fImpact[1] = GetEventFloat(event, "y"); 260 | m_fImpact[2] = GetEventFloat(event, "z"); 261 | 262 | int colorArray[4]; 263 | if(!g_bRainbow[player]) 264 | { 265 | for(int i = 0; i < 3; i++) 266 | { 267 | colorArray[i] = g_aTracerColor[player][i]; 268 | } 269 | } 270 | else 271 | { 272 | float i = GetGameTime(); 273 | float Frequency = 2.5; 274 | 275 | colorArray[0] = RoundFloat(Sine(Frequency * i + 0.0) * 127.0 + 128.0); 276 | colorArray[1] = RoundFloat(Sine(Frequency * i + 2.0943951) * 127.0 + 128.0); 277 | colorArray[2] = RoundFloat(Sine(Frequency * i + 4.1887902) * 127.0 + 128.0); 278 | } 279 | 280 | colorArray[3] = 255; 281 | 282 | TE_SetupBeamPoints(m_fOrigin, m_fImpact, g_iBeam, 0, 0, 0, 0.1, 1.0, 1.0, 1, 0.0, colorArray, 0); 283 | 284 | int[] clients = new int[MaxClients]; 285 | int client_count; 286 | for(int i = 1; i <= MaxClients; i++) 287 | { 288 | if(IsClientInGame(i) && !g_bDisableTracers[i]) 289 | { 290 | clients[client_count++] = i; 291 | } 292 | } 293 | 294 | TE_Send(clients, client_count); 295 | } 296 | 297 | public void Tracer_Config(Handle &kv, int id) 298 | { 299 | KvGetString(kv, "color", g_sTracerColor[id], sizeof(g_sTracerColor[])); 300 | } 301 | 302 | public void Tracer_Equip(int client, int id) 303 | { 304 | if(StrEqual(g_sTracerColor[id], "rainbow", false)) { 305 | g_bRainbow[client] = true; 306 | } 307 | else { 308 | ColorStringToArray(g_sTracerColor[id], g_aTracerColor[client]); 309 | g_bRainbow[client] = false; 310 | } 311 | } 312 | 313 | public void Tracer_Remove(int client, int id) 314 | { 315 | for(int i = 0; i < 3; i++) 316 | { 317 | g_aTracerColor[client][i] = 0; 318 | } 319 | g_bRainbow[client] = false; 320 | } 321 | //END TRACER 322 | 323 | //START BCOLOR 324 | public void BodyColors_Config(Handle &kv, int id) 325 | { 326 | KvGetString(kv, "color", g_sBodyColors[id], sizeof(g_sBodyColors[])); 327 | } 328 | 329 | public void BodyColors_Equip(int client, int id) 330 | { 331 | ApplyGlowColor(client, g_sBodyColors[id]); 332 | } 333 | 334 | public void BodyColors_Remove(int client, int id) 335 | { 336 | ApplyGlowColor(client, ""); 337 | } 338 | 339 | public void ColorStringToArray(const char[] sColorString, int aColor[3]) 340 | { 341 | char asColors[4][4]; 342 | ExplodeString(sColorString, " ", asColors, sizeof(asColors), sizeof(asColors[])); 343 | 344 | aColor[0] = StringToInt(asColors[0]); 345 | aColor[1] = StringToInt(asColors[1]); 346 | aColor[2] = StringToInt(asColors[2]); 347 | } 348 | 349 | public void ApplyGlowColor(int client, char[] color) 350 | { 351 | int glowColor[3]; 352 | if(StrEqual(color, "")) 353 | { 354 | ColorStringToArray("255 255 255", glowColor); 355 | } 356 | else 357 | { 358 | ColorStringToArray(color, glowColor); 359 | } 360 | 361 | if(IsClientInGame(client) && IsPlayerAlive(client)) 362 | { 363 | SetEntityRenderColor(client, glowColor[0], glowColor[1], glowColor[2], GetClientTransparency(client)); 364 | } 365 | if(StrEqual(color, "rainbow", false)) 366 | { 367 | SDKHook(client, SDKHook_PostThinkPost, Rainbow); 368 | } 369 | else 370 | { 371 | SDKUnhook(client, SDKHook_PostThinkPost, Rainbow); 372 | } 373 | return; 374 | } 375 | 376 | public void Rainbow(int client) 377 | { 378 | float i = GetGameTime(); 379 | float Frequency = 2.5; 380 | 381 | int Red = RoundFloat(Sine(Frequency * i + 0.0) * 127.0 + 128.0); 382 | int Green = RoundFloat(Sine(Frequency * i + 2.0943951) * 127.0 + 128.0); 383 | int Blue = RoundFloat(Sine(Frequency * i + 4.1887902) * 127.0 + 128.0); 384 | 385 | SetEntityRenderColor(client, Red, Green, Blue, GetClientTransparency(client)); 386 | } 387 | 388 | public int GetClientTransparency(int entity) 389 | { 390 | static bool s_GotConfig = false; 391 | static char s_sProp[32]; 392 | 393 | if(!s_GotConfig) 394 | { 395 | Handle GameConf = LoadGameConfigFile("core.games"); 396 | bool Exists = GameConfGetKeyValue(GameConf, "m_clrRender", s_sProp, sizeof(s_sProp)); 397 | CloseHandle(GameConf); 398 | 399 | if(!Exists) 400 | strcopy(s_sProp, sizeof(s_sProp), "m_clrRender"); 401 | 402 | s_GotConfig = true; 403 | } 404 | 405 | int Offset = GetEntSendPropOffs(entity, s_sProp); 406 | return GetEntData(entity, Offset + 4, 1); 407 | } 408 | //END BCOLOR 409 | -------------------------------------------------------------------------------- /readme.txt: -------------------------------------------------------------------------------- 1 | Hey. 2 | 3 | Please don't use my plugins without me giving you explicit permission. I know I can't stop you, but please, at least just ask me first. -------------------------------------------------------------------------------- /shop_skins.sp: -------------------------------------------------------------------------------- 1 | #pragma semicolon 1 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | #define PLUGIN_VERSION "2.1.4" 10 | 11 | #define CATEGORY "skins" 12 | 13 | new Float:g_fPreviewDuration; 14 | 15 | new Handle:kv; 16 | new ItemId:selected_id[MAXPLAYERS+1] = {INVALID_ITEM, ...}; 17 | 18 | new Handle:hArrayModels; 19 | new Handle:mp_forcecamera; 20 | 21 | char PlayerZModel[MAXPLAYERS+1][PLATFORM_MAX_PATH]; 22 | 23 | public Plugin:myinfo = 24 | { 25 | name = "[Shop] Skins", 26 | author = "FrozDark (arms by R1KO)", 27 | description = "Adds ability to buy skins", 28 | version = SHOP_VERSION, 29 | url = "www.hlmod.ru" 30 | } 31 | 32 | public OnPluginStart() 33 | { 34 | mp_forcecamera = FindConVar("mp_forcecamera"); 35 | 36 | HookEvent("player_spawn", Event_PlayerSpawn); 37 | HookEvent("player_team", Event_PlayerSpawn); 38 | 39 | hArrayModels = CreateArray(ByteCountToCells(PLATFORM_MAX_PATH)); 40 | 41 | if (Shop_IsStarted()) Shop_Started(); 42 | } 43 | 44 | public OnPluginEnd() 45 | { 46 | Shop_UnregisterMe(); 47 | } 48 | 49 | public OnMapStart() 50 | { 51 | decl String:buffer[PLATFORM_MAX_PATH]; 52 | for (new i = 0; i < GetArraySize(hArrayModels); i++) 53 | { 54 | GetArrayString(hArrayModels, i, buffer, sizeof(buffer)); 55 | PrecacheModel(buffer, true); 56 | } 57 | 58 | Shop_GetCfgFile(buffer, sizeof(buffer), "skins_downloads.txt"); 59 | 60 | if (!File_ReadDownloadList(buffer)) 61 | { 62 | PrintToServer("File not exists %s", buffer); 63 | } 64 | } 65 | 66 | public ZR_OnClientInfected(client, attacker, bool:motherInfect, bool:respawnOverride, bool:respawn) 67 | { 68 | decl String:sModelPath[PLATFORM_MAX_PATH]; 69 | GetEntPropString(client, Prop_Data, "m_ModelName", sModelPath, sizeof(sModelPath)); 70 | 71 | strcopy(PlayerZModel[client], sizeof(PlayerZModel[]), sModelPath); 72 | } 73 | 74 | public OnClientDisconnect_Post(client) 75 | { 76 | PlayerZModel[client][0] = '\0'; 77 | selected_id[client] = INVALID_ITEM; 78 | } 79 | 80 | public Shop_Started() 81 | { 82 | new CategoryId:category_id = Shop_RegisterCategory(CATEGORY, "Скины", ""); 83 | 84 | decl String:_buffer[PLATFORM_MAX_PATH]; 85 | Shop_GetCfgFile(_buffer, sizeof(_buffer), "skins.txt"); 86 | 87 | if (kv != INVALID_HANDLE) CloseHandle(kv); 88 | 89 | kv = CreateKeyValues("Skins"); 90 | 91 | if (!FileToKeyValues(kv, _buffer)) 92 | { 93 | ThrowError("\"%s\" not parsed", _buffer); 94 | } 95 | 96 | ClearArray(hArrayModels); 97 | 98 | KvRewind(kv); 99 | g_fPreviewDuration = KvGetFloat(kv, "preview_duration", 3.0); 100 | 101 | decl String:item[64], String:item_name[64], String:desc[64]; 102 | if (KvGotoFirstSubKey(kv)) 103 | { 104 | do 105 | { 106 | if (!KvGetSectionName(kv, item, sizeof(item))) continue; 107 | 108 | KvGetString(kv, "ModelT", _buffer, sizeof(_buffer)); 109 | new bool:result = false; 110 | if (_buffer[0]) 111 | { 112 | PrecacheModel(_buffer); 113 | if (FindStringInArray(hArrayModels, _buffer) == -1) 114 | { 115 | PushArrayString(hArrayModels, _buffer); 116 | } 117 | 118 | KvGetString(kv, "ModelT_Arms", _buffer, sizeof(_buffer)); 119 | if (_buffer[0]) 120 | { 121 | PrecacheModel(_buffer); 122 | if (FindStringInArray(hArrayModels, _buffer) == -1) 123 | { 124 | PushArrayString(hArrayModels, _buffer); 125 | } 126 | } 127 | 128 | result = true; 129 | } 130 | 131 | 132 | KvGetString(kv, "ModelCT", _buffer, sizeof(_buffer)); 133 | if (_buffer[0]) 134 | { 135 | PrecacheModel(_buffer, true); 136 | if (FindStringInArray(hArrayModels, _buffer) == -1) 137 | { 138 | PushArrayString(hArrayModels, _buffer); 139 | } 140 | 141 | KvGetString(kv, "ModelCT_Arms", _buffer, sizeof(_buffer)); 142 | if (_buffer[0]) 143 | { 144 | PrecacheModel(_buffer); 145 | if (FindStringInArray(hArrayModels, _buffer) == -1) 146 | { 147 | PushArrayString(hArrayModels, _buffer); 148 | } 149 | } 150 | } 151 | else if (!result) continue; 152 | 153 | if (Shop_StartItem(category_id, item)) 154 | { 155 | KvGetString(kv, "name", item_name, sizeof(item_name), item); 156 | KvGetString(kv, "description", desc, sizeof(desc)); 157 | Shop_SetInfo(item_name, desc, KvGetNum(kv, "price", 5000), KvGetNum(kv, "sell_price", 2500), Item_Togglable, KvGetNum(kv, "duration", 86400)); 158 | Shop_SetCallbacks(_, OnEquipItem, _, _, _, OnPreviewItem); 159 | 160 | if (KvJumpToKey(kv, "Attributes", false)) 161 | { 162 | Shop_KvCopySubKeysCustomInfo(kv); 163 | KvGoBack(kv); 164 | } 165 | 166 | Shop_EndItem(); 167 | } 168 | } 169 | while (KvGotoNextKey(kv)); 170 | } 171 | 172 | KvRewind(kv); 173 | } 174 | 175 | public ShopAction:OnEquipItem(client, CategoryId:category_id, const String:category[], ItemId:item_id, const String:item[], bool:isOn, bool:elapsed) 176 | { 177 | if (isOn || elapsed) 178 | { 179 | if(IsPlayerAlive(client) && ZR_IsClientZombie(client)) 180 | { 181 | SetEntityModel(client, PlayerZModel[client]); 182 | } 183 | else 184 | { 185 | CS_UpdateClientModel(client); 186 | } 187 | 188 | selected_id[client] = INVALID_ITEM; 189 | 190 | return Shop_UseOff; 191 | } 192 | 193 | Shop_ToggleClientCategoryOff(client, category_id); 194 | 195 | selected_id[client] = item_id; 196 | 197 | ProcessPlayer(client); 198 | 199 | return Shop_UseOn; 200 | } 201 | 202 | public OnPreviewItem(client, CategoryId:category_id, const String:category[], ItemId:item_id, const String:item[]) 203 | { 204 | decl String:buffer[PLATFORM_MAX_PATH]; 205 | 206 | KvRewind(kv); 207 | if (!KvJumpToKey(kv, item, false)) 208 | { 209 | LogError("It seems that registered item \"%s\" not exists in the settings", buffer); 210 | return; 211 | } 212 | 213 | switch (GetClientTeam(client)) 214 | { 215 | case 2 : 216 | { 217 | KvGetString(kv, "ModelT", buffer, sizeof(buffer)); 218 | } 219 | case 3 : 220 | { 221 | KvGetString(kv, "ModelCT", buffer, sizeof(buffer)); 222 | } 223 | default : 224 | { 225 | buffer[0] = 0; 226 | } 227 | } 228 | 229 | KvRewind(kv); 230 | 231 | if (buffer[0] && IsModelFile(buffer)) 232 | { 233 | Mirror(client, buffer); 234 | CreateTimer(g_fPreviewDuration, SetBackMode, GetClientUserId(client), TIMER_FLAG_NO_MAPCHANGE); 235 | } 236 | } 237 | 238 | public Action:SetBackMode(Handle:timer, any:userid) 239 | { 240 | new client = GetClientOfUserId(userid); 241 | if(client) 242 | { 243 | Mirror(client); 244 | } 245 | } 246 | 247 | Mirror(client, const String:sModel[]="") 248 | { 249 | if (sModel[0]) 250 | { 251 | SetEntPropEnt(client, Prop_Send, "m_hObserverTarget", 0); 252 | SetEntProp(client, Prop_Send, "m_iObserverMode", 1); 253 | SetEntProp(client, Prop_Send, "m_bDrawViewmodel", 0); 254 | SetEntProp(client, Prop_Send, "m_iFOV", 120); 255 | SendConVarValue(client, mp_forcecamera, "1"); 256 | SetEntityModel(client, sModel); 257 | } 258 | else 259 | { 260 | SetEntPropEnt(client, Prop_Send, "m_hObserverTarget", -1); 261 | SetEntProp(client, Prop_Send, "m_iObserverMode", 0); 262 | SetEntProp(client, Prop_Send, "m_bDrawViewmodel", 1); 263 | SetEntProp(client, Prop_Send, "m_iFOV", 90); 264 | decl String:valor[6]; 265 | GetConVarString(mp_forcecamera, valor, 6); 266 | SendConVarValue(client, mp_forcecamera, valor); 267 | CS_UpdateClientModel(client); 268 | } 269 | } 270 | 271 | public Event_PlayerSpawn(Handle:event, const String:name[], bool:dontBroadcast) 272 | { 273 | new client = GetClientOfUserId(GetEventInt(event, "userid")); 274 | if (!client || selected_id[client] == INVALID_ITEM || IsFakeClient(client) || !IsPlayerAlive(client)) 275 | { 276 | return; 277 | } 278 | 279 | ProcessPlayer(client); 280 | } 281 | 282 | ProcessPlayer(client) 283 | { 284 | decl String:buffer[PLATFORM_MAX_PATH]; 285 | 286 | if(selected_id[client] != INVALID_ITEM) 287 | { 288 | Shop_GetItemById(selected_id[client], buffer, sizeof(buffer)); 289 | 290 | KvRewind(kv); 291 | if (!KvJumpToKey(kv, buffer, false)) 292 | { 293 | LogError("It seems that registered item \"%s\" not exists in the settings", buffer); 294 | return; 295 | } 296 | 297 | decl String:sArms[PLATFORM_MAX_PATH]; 298 | 299 | switch (GetClientTeam(client)) 300 | { 301 | case 2 : 302 | { 303 | KvGetString(kv, "ModelT", buffer, sizeof(buffer)); 304 | KvGetString(kv, "ModelT_Arms", sArms, sizeof(sArms)); 305 | } 306 | case 3 : 307 | { 308 | KvGetString(kv, "ModelCT", buffer, sizeof(buffer)); 309 | KvGetString(kv, "ModelCT_Arms", sArms, sizeof(sArms)); 310 | } 311 | default : 312 | { 313 | buffer[0] = 314 | sArms[0] = '\0'; 315 | } 316 | } 317 | if (buffer[0] && IsModelFile(buffer)) 318 | { 319 | SetEntityModel(client, buffer); 320 | 321 | if (sArms[0] && IsModelFile(sArms)) 322 | { 323 | SetEntPropString(client, Prop_Send, "m_szArmsModel", sArms); 324 | } 325 | 326 | KvGetString(kv, "color", buffer, sizeof(buffer)); 327 | if (strlen(buffer) > 7) 328 | { 329 | decl color[4]; 330 | KvGetColor(kv, "color", color[0], color[1], color[2], color[3]); 331 | SetEntityRenderMode(client, RENDER_TRANSCOLOR); 332 | SetEntityRenderColor(client, color[0], color[1], color[2], color[3]); 333 | } 334 | } 335 | 336 | KvRewind(kv); 337 | } 338 | } 339 | 340 | bool:IsModelFile(const String:model[]) 341 | { 342 | decl String:buf[4]; 343 | File_GetExtension(model, buf, sizeof(buf)); 344 | 345 | return !strcmp(buf, "mdl", false); 346 | } 347 | 348 | new String:_smlib_empty_twodimstring_array[][] = { { '\0' } }; 349 | stock File_AddToDownloadsTable(String:path[], bool:recursive=true, const String:ignoreExts[][]=_smlib_empty_twodimstring_array, size=0) 350 | { 351 | if (path[0] == '\0') { 352 | return; 353 | } 354 | 355 | new len = strlen(path)-1; 356 | 357 | if (path[len] == '\\' || path[len] == '/') 358 | { 359 | path[len] = '\0'; 360 | } 361 | 362 | if (FileExists(path)) { 363 | 364 | decl String:fileExtension[4]; 365 | File_GetExtension(path, fileExtension, sizeof(fileExtension)); 366 | 367 | if (StrEqual(fileExtension, "bz2", false) || StrEqual(fileExtension, "ztmp", false)) { 368 | return; 369 | } 370 | 371 | if (Array_FindString(ignoreExts, size, fileExtension) != -1) { 372 | return; 373 | } 374 | 375 | AddFileToDownloadsTable(path); 376 | 377 | if (StrEqual(fileExtension, "mdl", false)) 378 | { 379 | PrecacheModel(path, true); 380 | } 381 | } 382 | 383 | else if (recursive && DirExists(path)) { 384 | 385 | decl String:dirEntry[PLATFORM_MAX_PATH]; 386 | new Handle:__dir = OpenDirectory(path); 387 | 388 | while (ReadDirEntry(__dir, dirEntry, sizeof(dirEntry))) { 389 | 390 | if (StrEqual(dirEntry, ".") || StrEqual(dirEntry, "..")) { 391 | continue; 392 | } 393 | 394 | Format(dirEntry, sizeof(dirEntry), "%s/%s", path, dirEntry); 395 | File_AddToDownloadsTable(dirEntry, recursive, ignoreExts, size); 396 | } 397 | 398 | CloseHandle(__dir); 399 | } 400 | else if (FindCharInString(path, '*', true)) { 401 | 402 | new String:fileExtension[4]; 403 | File_GetExtension(path, fileExtension, sizeof(fileExtension)); 404 | 405 | if (StrEqual(fileExtension, "*")) { 406 | 407 | decl 408 | String:dirName[PLATFORM_MAX_PATH], 409 | String:fileName[PLATFORM_MAX_PATH], 410 | String:dirEntry[PLATFORM_MAX_PATH]; 411 | 412 | File_GetDirName(path, dirName, sizeof(dirName)); 413 | File_GetFileName(path, fileName, sizeof(fileName)); 414 | StrCat(fileName, sizeof(fileName), "."); 415 | 416 | new Handle:__dir = OpenDirectory(dirName); 417 | while (ReadDirEntry(__dir, dirEntry, sizeof(dirEntry))) { 418 | 419 | if (StrEqual(dirEntry, ".") || StrEqual(dirEntry, "..")) { 420 | continue; 421 | } 422 | 423 | if (strncmp(dirEntry, fileName, strlen(fileName)) == 0) { 424 | Format(dirEntry, sizeof(dirEntry), "%s/%s", dirName, dirEntry); 425 | File_AddToDownloadsTable(dirEntry, recursive, ignoreExts, size); 426 | } 427 | } 428 | 429 | CloseHandle(__dir); 430 | } 431 | } 432 | 433 | return; 434 | } 435 | 436 | stock bool:File_ReadDownloadList(const String:path[]) 437 | { 438 | new Handle:file = OpenFile(path, "r"); 439 | 440 | if (file == INVALID_HANDLE) { 441 | return false; 442 | } 443 | 444 | new String:buffer[PLATFORM_MAX_PATH]; 445 | while (!IsEndOfFile(file)) { 446 | ReadFileLine(file, buffer, sizeof(buffer)); 447 | 448 | new pos; 449 | pos = StrContains(buffer, "//"); 450 | if (pos != -1) { 451 | buffer[pos] = '\0'; 452 | } 453 | 454 | pos = StrContains(buffer, "#"); 455 | if (pos != -1) { 456 | buffer[pos] = '\0'; 457 | } 458 | 459 | pos = StrContains(buffer, ";"); 460 | if (pos != -1) { 461 | buffer[pos] = '\0'; 462 | } 463 | 464 | TrimString(buffer); 465 | 466 | if (buffer[0] == '\0') { 467 | continue; 468 | } 469 | 470 | File_AddToDownloadsTable(buffer); 471 | } 472 | 473 | CloseHandle(file); 474 | 475 | return true; 476 | } 477 | 478 | stock File_GetExtension(const String:path[], String:buffer[], size) 479 | { 480 | new extpos = FindCharInString(path, '.', true); 481 | 482 | if (extpos == -1) 483 | { 484 | buffer[0] = '\0'; 485 | return; 486 | } 487 | 488 | strcopy(buffer, size, path[++extpos]); 489 | } 490 | 491 | stock Math_GetRandomInt(min, max) 492 | { 493 | new random = GetURandomInt(); 494 | 495 | if (random == 0) 496 | random++; 497 | 498 | return RoundToCeil(float(random) / (float(2147483647) / float(max - min + 1))) + min - 1; 499 | } 500 | 501 | stock Array_FindString(const String:array[][], size, const String:str[], bool:caseSensitive=true, start=0) 502 | { 503 | if (start < 0) { 504 | start = 0; 505 | } 506 | 507 | for (new i=start; i < size; i++) { 508 | 509 | if (StrEqual(array[i], str, caseSensitive)) { 510 | return i; 511 | } 512 | } 513 | 514 | return -1; 515 | } 516 | 517 | stock bool:File_GetFileName(const String:path[], String:buffer[], size) 518 | { 519 | if (path[0] == '\0') { 520 | buffer[0] = '\0'; 521 | return; 522 | } 523 | 524 | File_GetBaseName(path, buffer, size); 525 | 526 | new pos_ext = FindCharInString(buffer, '.', true); 527 | 528 | if (pos_ext != -1) { 529 | buffer[pos_ext] = '\0'; 530 | } 531 | } 532 | 533 | stock bool:File_GetDirName(const String:path[], String:buffer[], size) 534 | { 535 | if (path[0] == '\0') { 536 | buffer[0] = '\0'; 537 | return; 538 | } 539 | 540 | new pos_start = FindCharInString(path, '/', true); 541 | 542 | if (pos_start == -1) { 543 | pos_start = FindCharInString(path, '\\', true); 544 | 545 | if (pos_start == -1) { 546 | buffer[0] = '\0'; 547 | return; 548 | } 549 | } 550 | 551 | strcopy(buffer, size, path); 552 | buffer[pos_start] = '\0'; 553 | } 554 | 555 | stock bool:File_GetBaseName(const String:path[], String:buffer[], size) 556 | { 557 | if (path[0] == '\0') { 558 | buffer[0] = '\0'; 559 | return; 560 | } 561 | 562 | new pos_start = FindCharInString(path, '/', true); 563 | 564 | if (pos_start == -1) { 565 | pos_start = FindCharInString(path, '\\', true); 566 | } 567 | 568 | pos_start++; 569 | 570 | strcopy(buffer, size, path[pos_start]); 571 | } -------------------------------------------------------------------------------- /skillbot.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/strellic/sourcemod-plugins/da6c2e702cde59f3e24b56d339e0ca27deb23b85/skillbot.zip -------------------------------------------------------------------------------- /skillbot/configs/skillbot/skillbot_hard.cfg: -------------------------------------------------------------------------------- 1 | "Maps" 2 | { 3 | "A_E_S_T_H_E_T_I_C" {} 4 | "Ancient_Wrath" 5 | { 6 | "Levels" 7 | { 8 | "Showdown" 9 | { 10 | "Output" "OnTrigger" 11 | "Name" "Stage_4_initate" 12 | } 13 | } 14 | } 15 | "Fapescape_Rote" 16 | { 17 | "Levels" 18 | { 19 | "Extreme 3" 20 | { 21 | "Output" "OnTrigger" 22 | "Name" "stage_3_relay_ext" 23 | } 24 | } 25 | } 26 | "FFXII_Westersand" 27 | { 28 | "Levels" 29 | { 30 | "Epic Mode" 31 | { 32 | "Output" "OnCase04" 33 | "Name" "Level_Case" 34 | } 35 | "God Mode" 36 | { 37 | "Output" "OnCase05" 38 | "Name" "Level_Case" 39 | } 40 | } 41 | } 42 | "FFVII_Mako_Reactor" 43 | { 44 | "Levels" 45 | { 46 | "Extreme 2" 47 | { 48 | "Output" "OnStartTouch" 49 | "Name" "dificultad_i_t_extreme2" 50 | } 51 | } 52 | } 53 | "FFXIV_Wanderers_Palace" 54 | { 55 | "Levels" 56 | { 57 | "Ultimate" 58 | { 59 | "Output" "OnStartTouch" 60 | "Name" "lv5_ul_trigger" 61 | } 62 | } 63 | } 64 | "Frostdrake" {} 65 | "Frozentemple" {} 66 | "Gris" 67 | { 68 | "Levels" 69 | { 70 | "4" 71 | { 72 | "Output" "OnTrigger" 73 | "Name" "l4_first_trigger" 74 | } 75 | "RTV" 76 | { 77 | "Output" "OnTrigger" 78 | "Name" "relay_rtv2_start" 79 | } 80 | } 81 | } 82 | "Kraznov_Poopata" {} 83 | "LOTR_Minas_Tirith" 84 | { 85 | "Levels" 86 | { 87 | "Extreme" 88 | { 89 | "Output" "OnTrigger" 90 | "Name" "logica_extreme" 91 | } 92 | } 93 | } 94 | "Pirates_Port_Royal" 95 | { 96 | "Levels" 97 | { 98 | "Kraken" 99 | { 100 | "Output" "OnTrigger" 101 | "Name" "saving_relay5" 102 | } 103 | "God Kraken" 104 | { 105 | "Output" "OnTrigger" 106 | "Name" "saving_relay6" 107 | } 108 | } 109 | } 110 | "Predator_Ultimate" 111 | { 112 | "Levels" 113 | { 114 | "Ultimate" 115 | { 116 | "Output" "OnTrigger" 117 | "Name" "relay_ultimate_options" 118 | } 119 | } 120 | } 121 | "Project_Alcaria" {} 122 | "Rizomata" {} 123 | "Santassination" 124 | { 125 | "Levels" 126 | { 127 | "Act III" 128 | { 129 | "Output" "OnCase04" 130 | "Name" "overlay_framecase" 131 | } 132 | } 133 | } 134 | "ShroomForest2" 135 | { 136 | "Levels" 137 | { 138 | "The End" 139 | { 140 | "Output" "OnCase08" 141 | "Name" "Level_Case" 142 | } 143 | } 144 | } 145 | "Sky_Athletic" 146 | { 147 | "Levels" 148 | { 149 | "RTV" 150 | { 151 | "Output" "OnStartTouch" 152 | "Name" "betray_him_already" 153 | } 154 | "RTV" 155 | { 156 | "Output" "OnStartTouch" 157 | "Name" "betray_him_trigger" 158 | } 159 | } 160 | } 161 | "Temple_Raider" {} 162 | "Tilex_Ultimate" 163 | { 164 | "Levels" 165 | { 166 | "Insane" 167 | { 168 | "Output" "OnStartTouch" 169 | "Name" "stage5_trigger" 170 | } 171 | "RTV" 172 | { 173 | "Output" "OnTrigger" 174 | "Name" "stage6_relay" 175 | } 176 | } 177 | } 178 | "Undertale_G" {} 179 | "UT2004_Convoy" 180 | { 181 | "Levels" 182 | { 183 | "Godlike" 184 | { 185 | "Output" "OnStartTouch" 186 | "Name" "godlike_trigger" 187 | } 188 | } 189 | } 190 | "Bioshock" 191 | { 192 | "Levels" 193 | { 194 | "CH4 - Hephaestus" 195 | { 196 | "Output" "OnCase03" 197 | "Name" "level_case" 198 | } 199 | "1999 - Extra CH" 200 | { 201 | "Output" "OnCase06" 202 | "Name" "level_case" 203 | } 204 | } 205 | } 206 | "Diddle" {} 207 | "L0V0L" 208 | { 209 | "Levels" 210 | { 211 | "3" 212 | { 213 | "Output" "OnTrigger" 214 | "Name" "lvl6_map_relay" 215 | } 216 | } 217 | } 218 | "Luck_Matters" {} 219 | } -------------------------------------------------------------------------------- /skillbot/configs/skillbot/skillbot_perks.cfg: -------------------------------------------------------------------------------- 1 | "SkillBot Perks" 2 | { 3 | "Body Colors" 4 | { 5 | "Red Body Color" 6 | { 7 | "type" "bcolor" 8 | "rank" 4 9 | "color" "255 0 0" 10 | } 11 | "Blue Body Color" 12 | { 13 | "type" "bcolor" 14 | "rank" 4 15 | "color" "0 0 255" 16 | } 17 | "Green Body Color" 18 | { 19 | "type" "bcolor" 20 | "rank" 4 21 | "color" "0 255 0" 22 | } 23 | "Rainbow Body Color" 24 | { 25 | "type" "bcolor" 26 | "rank" 6 27 | "color" "rainbow" 28 | } 29 | } 30 | "Tracers" 31 | { 32 | "Red Tracer" 33 | { 34 | "type" "tracer" 35 | "rank" 5 36 | "color" "255 0 0" 37 | } 38 | "Blue Tracer" 39 | { 40 | "type" "tracer" 41 | "rank" 5 42 | "color" "0 0 255" 43 | } 44 | "Green Tracer" 45 | { 46 | "type" "tracer" 47 | "rank" 5 48 | "color" "0 255 0" 49 | } 50 | "Rainbow Tracer" 51 | { 52 | "type" "tracer" 53 | "rank" 7 54 | "color" "rainbow" 55 | } 56 | } 57 | "Grenade Skins" 58 | { 59 | "Banana" 60 | { 61 | "type" "grenskin" 62 | "rank" 4 63 | "model" "models/props/cs_italy/bananna.mdl" 64 | } 65 | "Orange" 66 | { 67 | "type" "grenskin" 68 | "rank" 4 69 | "model" "models/props/cs_italy/orange.mdl" 70 | } 71 | "Watermelon" 72 | { 73 | "type" "grenskin" 74 | "rank" 4 75 | "model" "models/props_junk/watermelon01.mdl" 76 | } 77 | "Snowman Head" 78 | { 79 | "type" "grenskin" 80 | "rank" 5 81 | "model" "models/props/cs_office/snowman_face.mdl" 82 | } 83 | "Chicken" 84 | { 85 | "type" "grenskin" 86 | "rank" 6 87 | "model" "models/chicken/chicken.mdl" 88 | } 89 | "Zombie Chicken" 90 | { 91 | "type" "grenskin" 92 | "rank" 8 93 | "model" "models/chicken/chicken_zombie.mdl" 94 | } 95 | } 96 | "Player Models" 97 | { 98 | "Sephiroth" 99 | { 100 | "type" "model" 101 | "model" "models/player/uuz/sephiroth/sephiroth.mdl" 102 | "arms" "models/player/uuz/sephiroth/sephiroth_arms.mdl" 103 | "rank" 8 104 | } 105 | "Deadpool" 106 | { 107 | "type" "model" 108 | "model" "models/player/custom_player/legacy/deadpool/deadpool.mdl" 109 | "rank" 8 110 | } 111 | } 112 | "Leader" 113 | { 114 | "type" "svcmd" 115 | "rank" 5 116 | "cmd" "sm_sbperks_leader {playername}" 117 | } 118 | } -------------------------------------------------------------------------------- /skillbot/configs/skillbot/skillbot_ranks.cfg: -------------------------------------------------------------------------------- 1 | "Maps" 2 | { 3 | //Please keep this ordered, the first rank should go on top, the last on bottom. 4 | //Max of 32 ranks. 5 | "0" 6 | { 7 | //How it shows up in chat 8 | "chat" "{default}[USELESS]" 9 | //How it shows in menus 10 | "menu" "[USELESS]" 11 | //How it shows as a chat tag 12 | "tag" "{default}[USELESS]" 13 | //Points 14 | "points" 0 15 | } 16 | "1" 17 | { 18 | "chat" "{default}[{darkorange}BRONZE{default}]" 19 | "menu" "[BRONZE]" 20 | "tag" "{default}[{darkorange}BRONZE{default}]" 21 | "points" 500 22 | } 23 | "2" 24 | { 25 | "chat" "{default}[{grey}SILVER{default}]" 26 | "menu" "[SILVER]" 27 | "tag" "{default}[{grey}SILVER{default}]" 28 | "points" 1000 29 | } 30 | "3" 31 | { 32 | "chat" "{default}[{orange}GOLD{default}]" 33 | "menu" "[GOLD]" 34 | "tag" "{default}[{orange}GOLD{default}]" 35 | "points" 1750 36 | } 37 | "4" 38 | { 39 | "chat" "{default}[{lightblue}PLATINUM{default}]" 40 | "menu" "[PLATINUM]" 41 | "tag" "{default}[{lightblue}PLATINUM{default}]" 42 | "points" 3000 43 | } 44 | "5" 45 | { 46 | "chat" "{default}[{blue}DIAMOND{default}]" 47 | "menu" "[DIAMOND]" 48 | "tag" "{default}[{blue}DIAMOND{default}]" 49 | "points" 5000 50 | } 51 | "6" 52 | { 53 | "chat" "{default}[{green}ELITE{default}]" 54 | "menu" "[ELITE]" 55 | "tag" "{default}[{green}ELITE{default}]" 56 | "points" 8000 57 | } 58 | "7" 59 | { 60 | "chat" "{default}[{olive}MAESTRO{default}]" 61 | "menu" "[MAESTRO]" 62 | "tag" "{default}[{olive}MAESTRO{default}]" 63 | "points" 15000 64 | } 65 | "8" 66 | { 67 | "chat" "{default}[{darkred}TRYHARD{default}]" 68 | "menu" "[TRYHARD]" 69 | "tag" "{default}[{darkred}TRYHARD{default}]" 70 | "points" 22500 71 | } 72 | "9" 73 | { 74 | "chat" "{default}[{default}L{grey}EVIATHAN{default}]" 75 | "menu" "[LEVIATHAN]" 76 | "tag" "{default}[{default}L{grey}EVIATHAN{default}]" 77 | "points" 30000 78 | } 79 | "10" 80 | { 81 | "chat" "{default}[{a}SACRED{default}]" 82 | "menu" "[SACRED]" 83 | "tag" "{default}[{a}SACRED{default}]" 84 | "points" 50000 85 | } 86 | "11" 87 | { 88 | "chat" "{default}[{red}DIOS{default}]" 89 | "menu" "[DIOS]" 90 | "tag" "{default}[{red}DIOS{default}]" 91 | "points" 75000 92 | } 93 | "12" 94 | { 95 | "chat" "{default}[{green}S{darkred}O{pink}L{purple}O{default}]" 96 | "menu" "[SOLO]" 97 | "tag" "{default}[{green}S{darkred}O{pink}L{purple}O{default}]" 98 | "points" 100000 99 | } 100 | } -------------------------------------------------------------------------------- /skillbot_cptags.sp: -------------------------------------------------------------------------------- 1 | #pragma semicolon 1 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | #pragma newdecls required 9 | #define PLUGIN_VERSION "CP1.0" 10 | 11 | public Plugin myinfo = { 12 | name = "SkillBot CP ChatTags", 13 | author = "AntiTeal", 14 | description = "Enables SkillBot chattags for servers with CP.", 15 | version = PLUGIN_VERSION, 16 | url = "antiteal.com" 17 | }; 18 | 19 | public void OnPluginStart() 20 | { 21 | CreateConVar("sm_skillbot_chattags_version", PLUGIN_VERSION, "Plugin Version", FCVAR_SPONLY | FCVAR_REPLICATED | FCVAR_NOTIFY); 22 | LoadTranslations("common.phrases"); 23 | LoadTranslations("core.phrases"); 24 | } 25 | 26 | public Action CP_OnChatMessage(int& client, ArrayList recipients, char[] flagstring, char[] name, char[] message, bool& processcolors, bool& removecolors) 27 | { 28 | char rank[64], rank2[75]; 29 | SB_GetChatRank(client, rank, sizeof(rank)); 30 | if(strlen(rank) != 0) 31 | { 32 | Format(rank2, sizeof(rank2), "%s{teamcolor}", rank); 33 | CFormat(rank2, sizeof(rank2), client); 34 | 35 | Format(name, MAXLENGTH_NAME, "%s %s", rank2, name); 36 | return Plugin_Changed; 37 | } 38 | return Plugin_Continue; 39 | } -------------------------------------------------------------------------------- /skillbot_perks.sp: -------------------------------------------------------------------------------- 1 | #pragma semicolon 1 2 | #define PLUGIN_VERSION "2.0" 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | 14 | char titleName[] = "{purple}[SkillBot]"; 15 | 16 | public Plugin myinfo = { 17 | name = "SkillBot Perks", 18 | author = "AntiTeal", 19 | description = "Perks system for SkillBot.", 20 | version = PLUGIN_VERSION, 21 | url = "https://antiteal.com" 22 | }; 23 | 24 | ConVar g_cVPerksConfig = null; 25 | char g_sHistory[MAXPLAYERS+1][512]; 26 | char sConfig[PLATFORM_MAX_PATH]; 27 | KeyValues KV; 28 | 29 | Perk_Item Items[PERKS_MAX_ITEMS][Perk_Item]; 30 | Perk_Type Types[PERKS_MAX_HANDLERS][Perk_Type]; 31 | int g_iType = 0; 32 | int g_iItems = 0; 33 | 34 | #include "perks/basic.sp" 35 | 36 | public void OnPluginStart() 37 | { 38 | RegPluginLibrary("skillbot_perks"); 39 | 40 | Basic_OnPluginStart(); 41 | 42 | g_cVPerksConfig = CreateConVar("sm_skillbot_perks", "configs/skillbot/skillbot_perks.cfg", "The location of the perks config."); 43 | AutoExecConfig(true, "skillbot_perks"); 44 | 45 | g_cVPerksConfig.AddChangeHook(ConVarChange); 46 | 47 | RegConsoleCmd("sm_perks", Command_Perks, "sm_perks"); 48 | RegAdminCmd("sm_reloadperks", Command_ReloadPerks, ADMFLAG_CONFIG); 49 | 50 | LoadConfig(); 51 | 52 | //Bunch of events for use 53 | HookEvent("round_start", Event_RoundStart, EventHookMode_Pre); 54 | HookEvent("round_end", Event_RoundEnd, EventHookMode_Pre); 55 | HookEvent("player_hurt", Event_PlayerHurt, EventHookMode_Pre); 56 | HookEvent("player_death", Event_PlayerDeath, EventHookMode_Pre); 57 | HookEvent("player_spawn", Event_PlayerSpawn, EventHookMode_Pre); 58 | HookEvent("bullet_impact", Event_BulletImpact, EventHookMode_Pre); 59 | } 60 | 61 | public Action Event_RoundStart(Handle event, const char[] name, bool dontBroadcast) 62 | { 63 | } 64 | 65 | public Action Event_RoundEnd(Handle event, const char[] name, bool dontBroadcast) 66 | { 67 | } 68 | 69 | public Action Event_PlayerHurt(Handle event, const char[] name, bool dontBroadcast) 70 | { 71 | } 72 | 73 | public Action Event_PlayerDeath(Handle event, const char[] name, bool dontBroadcast) 74 | { 75 | Basic_PlayerDeath(event); 76 | } 77 | 78 | public Action Event_PlayerSpawn(Handle event, const char[] name, bool dontBroadcast) 79 | { 80 | Basic_PlayerSpawn(event); 81 | } 82 | 83 | public Action Event_BulletImpact(Handle event, const char[] name, bool dontBroadcast) 84 | { 85 | Basic_BulletImpact(event); 86 | } 87 | 88 | public void OnClientCookiesCached(int client) 89 | { 90 | Basic_CookiesCached(client); 91 | } 92 | 93 | public void OnClientDisconnect(int client) 94 | { 95 | g_sHistory[client][0] = '\0'; 96 | Basic_Disconnect(client); 97 | } 98 | 99 | public void OnEntityCreated(int entity, const char[] classname) 100 | { 101 | if(StrContains(classname, "_projectile" ) > 0) 102 | { 103 | SDKHook(entity, SDKHook_SpawnPost, Basic_GrenSkin_OnEntitySpawnedPost); 104 | } 105 | } 106 | 107 | public void OnMapStart() 108 | { 109 | for(int i=0;i= rank) 320 | { 321 | KvGetString(KV, "type", itemtype, sizeof(itemtype)); 322 | PerkStatus(client, id, menu); 323 | } 324 | else 325 | { 326 | menu.AddItem("sys_return", "Equip", ITEMDRAW_DISABLED); 327 | } 328 | } 329 | KvGoBack(KV); 330 | return menu; 331 | } 332 | 333 | public int TheMenuHandler(Menu menu, MenuAction action, int client, int param) 334 | { 335 | if (action == MenuAction_Select) 336 | { 337 | char szInfo[64]; 338 | menu.GetItem(param, szInfo, sizeof(szInfo)); 339 | if(StrEqual(szInfo, "sys_equip")) 340 | { 341 | PlayerEquip(client); 342 | } 343 | else if(StrEqual(szInfo, "sys_unequip")) 344 | { 345 | PlayerUnequip(client); 346 | } 347 | else if(StrEqual(szInfo, "sys_return")) 348 | { 349 | CloseHandle(menu); 350 | } 351 | else 352 | { 353 | KvAddHistory(client, StringToInt(szInfo)); 354 | DrawMenu(client).Display(client, MENU_TIME_FOREVER); 355 | } 356 | } 357 | else if(action == MenuAction_End) 358 | { 359 | CloseHandle(menu); 360 | } 361 | else if (action == MenuAction_Cancel && param == MenuCancel_ExitBack) 362 | { 363 | KvRemoveHistory(client); 364 | DrawMenu(client).Display(client, MENU_TIME_FOREVER); 365 | } 366 | } 367 | 368 | public void PlayerEquip(int client) 369 | { 370 | KvRewind(KV); 371 | 372 | char SectionArray[16][64]; 373 | int actions = ExplodeString(g_sHistory[client], SectionID, SectionArray, sizeof(SectionArray), sizeof(SectionArray[])); 374 | 375 | for(int i = 0; i < actions; i++) 376 | { 377 | KvJumpToKeySymbol(KV, StringToInt(SectionArray[i])); 378 | } 379 | 380 | char itemtype[64]; 381 | KvGetString(KV, "type", itemtype, sizeof(itemtype)); 382 | 383 | char itemname[64]; 384 | KvGetSectionName(KV, itemname, sizeof(itemname)); 385 | 386 | PrintChat(client, "You have equipped {green}%s{default}.", itemname); 387 | 388 | PerkEquip(client, Perks_GetItemID(itemname)); 389 | DrawMenu(client).Display(client, MENU_TIME_FOREVER); 390 | } 391 | 392 | public void PlayerUnequip(int client) 393 | { 394 | KvRewind(KV); 395 | 396 | char SectionArray[16][64]; 397 | int actions = ExplodeString(g_sHistory[client], SectionID, SectionArray, sizeof(SectionArray), sizeof(SectionArray[])); 398 | 399 | for(int i = 0; i < actions; i++) 400 | { 401 | KvJumpToKeySymbol(KV, StringToInt(SectionArray[i])); 402 | } 403 | 404 | char itemtype[64]; 405 | KvGetString(KV, "type", itemtype, sizeof(itemtype)); 406 | 407 | char itemname[64]; 408 | KvGetSectionName(KV, itemname, sizeof(itemname)); 409 | 410 | PrintChat(client, "You have unequipped {green}%s{default}.", itemname); 411 | 412 | PerkUnequip(client, Perks_GetItemID(itemname)); 413 | DrawMenu(client).Display(client, MENU_TIME_FOREVER); 414 | } 415 | 416 | public int Perks_GetTypeHandler(char[] type) 417 | { 418 | for(int i=0; i < g_iType; i++) 419 | { 420 | if(strcmp(Types[i][szType], type)==0) 421 | return i; 422 | } 423 | return -1; 424 | } 425 | 426 | public int Perks_GetItemID(char[] name) 427 | { 428 | for(int i=0; i < g_iItems; i++) 429 | { 430 | if(strcmp(Items[i][szName], name)==0) 431 | return i; 432 | } 433 | return -1; 434 | } 435 | 436 | public APLRes AskPluginLoad2(Handle myself, bool late, char[] error, int err_max) 437 | { 438 | //char[] type, SBCallback_OnUse OnUse 439 | CreateNative("Perks_RegisterHandler", Native_RegisterHandler); 440 | CreateNative("Perks_Reequip", Native_Reequip); 441 | Basic_AskPluginLoad2(); 442 | return APLRes_Success; 443 | } 444 | 445 | public int Native_Reequip(Handle plugin, int numParams) 446 | { 447 | int client = GetNativeCell(1); 448 | char stype[ITEM_HANDLER_LENGTH]; 449 | GetNativeString(2, stype, sizeof(stype)); 450 | 451 | int type = Perks_GetTypeHandler(stype); 452 | char szCurrent[ITEM_NAME_LENGTH]; 453 | Handle cookie = Types[type][hCookie]; 454 | if(cookie == INVALID_HANDLE) return; 455 | GetClientCookie(client, cookie, szCurrent, sizeof(szCurrent)); 456 | int id = Perks_GetItemID(szCurrent); 457 | 458 | if(id != -1) 459 | { 460 | if(Types[Items[id][iType]][fnUse] != INVALID_FUNCTION) 461 | { 462 | Call_StartFunction(INVALID_HANDLE, Types[Items[id][iType]][fnUse]); 463 | Call_PushCell(client); 464 | Call_PushCell(id); 465 | Call_Finish(); 466 | } 467 | } 468 | } 469 | 470 | public int Native_RegisterHandler(Handle plugin, int numParams) 471 | { 472 | char type[ITEM_HANDLER_LENGTH]; 473 | GetNativeString(1, type, sizeof(type)); 474 | 475 | int id = g_iType; 476 | strcopy(Types[id][szType], ITEM_HANDLER_LENGTH, type); 477 | Types[id][hPlugin] = plugin; 478 | Types[id][hCookie] = GetNativeCell(2); 479 | Types[id][fnMapStart] = GetNativeCell(3); 480 | Types[id][fnReset] = GetNativeCell(4); 481 | Types[id][fnConfig] = GetNativeCell(5); 482 | Types[id][fnUse] = GetNativeCell(6); 483 | Types[id][fnRemove] = GetNativeCell(7); 484 | Types[id][useCookies] = GetNativeCell(8); 485 | 486 | g_iType++; 487 | } 488 | 489 | //Edit these sections to add more skins 490 | public void PerkEquip(int client, int id) 491 | { 492 | if(Types[Items[id][iType]][useCookies]) 493 | { 494 | Handle cookie = Types[Items[id][iType]][hCookie]; 495 | if(cookie == INVALID_HANDLE) return; 496 | 497 | SetClientCookie(client, cookie, Items[id][szName]); 498 | PrintToConsole(client, "Cookie set to %s.", Items[id][szName]); 499 | } 500 | 501 | if(Types[Items[id][iType]][fnUse] != INVALID_FUNCTION) 502 | { 503 | Call_StartFunction(INVALID_HANDLE, Types[Items[id][iType]][fnUse]); 504 | Call_PushCell(client); 505 | Call_PushCell(id); 506 | Call_Finish(); 507 | } 508 | } 509 | 510 | public void PerkUnequip(int client, int id) 511 | { 512 | if(Types[Items[id][iType]][useCookies]) 513 | { 514 | Handle cookie = Types[Items[id][iType]][hCookie]; 515 | if(cookie == INVALID_HANDLE) return; 516 | 517 | SetClientCookie(client, cookie, ""); 518 | PrintToConsole(client, "Cookie set to blank."); 519 | } 520 | 521 | if(Types[Items[id][iType]][fnRemove] != INVALID_FUNCTION) 522 | { 523 | Call_StartFunction(INVALID_HANDLE, Types[Items[id][iType]][fnRemove]); 524 | Call_PushCell(client); 525 | Call_PushCell(id); 526 | Call_Finish(); 527 | } 528 | } 529 | 530 | public void PerkStatus(int client, int id, Menu menu) 531 | { 532 | if(Types[Items[id][iType]][useCookies]) 533 | { 534 | char szCurrent[ITEM_NAME_LENGTH]; 535 | if(Types[Items[id][iType]][hCookie] == INVALID_HANDLE) return; 536 | 537 | GetClientCookie(client, Types[Items[id][iType]][hCookie], szCurrent, sizeof(szCurrent)); 538 | 539 | if(StrEqual(szCurrent, Items[id][szName])) 540 | menu.AddItem("sys_unequip", "Unequip", ITEMDRAW_DEFAULT); 541 | else menu.AddItem("sys_equip", "Equip", ITEMDRAW_DEFAULT); 542 | } 543 | else menu.AddItem("sys_equip", "Execute", ITEMDRAW_DEFAULT); 544 | } 545 | -------------------------------------------------------------------------------- /skillbot_scptags.sp: -------------------------------------------------------------------------------- 1 | #pragma semicolon 1 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | #pragma newdecls required 9 | #define PLUGIN_VERSION "SCP1.0" 10 | 11 | public Plugin myinfo = { 12 | name = "SkillBot SCP ChatTags", 13 | author = "AntiTeal", 14 | description = "Enables SkillBot chattags for servers with SCP.", 15 | version = PLUGIN_VERSION, 16 | url = "antiteal.com" 17 | }; 18 | 19 | public void OnPluginStart() 20 | { 21 | CreateConVar("sm_skillbot_chattags_version", PLUGIN_VERSION, "Plugin Version", FCVAR_SPONLY | FCVAR_REPLICATED | FCVAR_NOTIFY); 22 | LoadTranslations("common.phrases"); 23 | LoadTranslations("core.phrases"); 24 | } 25 | 26 | public Action OnChatMessage(int &client, Handle recipients, char[] sName, char[] sMessage) 27 | { 28 | char rank[64]; 29 | SB_GetChatRank(client, rank, sizeof(rank)); 30 | 31 | if(strlen(rank) != 0) 32 | { 33 | CFormat(rank, sizeof(rank), client); 34 | Format(sName, MAXLENGTH_INPUT, "%s%s", rank, sName); 35 | } 36 | } -------------------------------------------------------------------------------- /skillbot_togtags.sp: -------------------------------------------------------------------------------- 1 | #pragma semicolon 1 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | #pragma newdecls required 9 | #define PLUGIN_VERSION "TOG1.0" 10 | 11 | public Plugin myinfo = { 12 | name = "SkillBot TOG ChatTags", 13 | author = "AntiTeal", 14 | description = "Enables SkillBot chattags for servers with TOG.", 15 | version = PLUGIN_VERSION, 16 | url = "antiteal.com" 17 | }; 18 | 19 | public void OnPluginStart() 20 | { 21 | CreateConVar("sm_skillbot_chattags_version", PLUGIN_VERSION, "Plugin Version", FCVAR_SPONLY | FCVAR_REPLICATED | FCVAR_NOTIFY); 22 | LoadTranslations("common.phrases"); 23 | LoadTranslations("core.phrases"); 24 | 25 | AddCommandListener(Command_Say, "say"); 26 | AddCommandListener(Command_Say, "say_team"); 27 | } 28 | 29 | public Action Command_Say(int client, const char[] cmd, int argc) 30 | { 31 | char rank[64], name[75]; 32 | SB_GetChatRank(client, rank, sizeof(rank)); 33 | if(strlen(rank) != 0) 34 | { 35 | Format(name, sizeof(name), "%s{teamcolor}", rank); 36 | CFormat(name, sizeof(name), client); 37 | 38 | tct_SetExtTag(client, name, ""); 39 | } 40 | } -------------------------------------------------------------------------------- /sm_showname.sp: -------------------------------------------------------------------------------- 1 | #pragma semicolon 1 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | new bool:g_bShowName[MAXPLAYERS+1]; 9 | new Handle:ShowName_Cookie = INVALID_HANDLE; 10 | 11 | char humanFormat[256], zombieFormat[256], zombieFormat2[256]; 12 | 13 | #define PLUGIN_VERSION "1.5" 14 | 15 | public Plugin:myinfo = 16 | { 17 | name = "ShowNames", 18 | author = "AntiTeal", 19 | description = "Shows the name of the Player you are currently aiming at.", 20 | version = PLUGIN_VERSION, 21 | url = "www.joinsg.net" 22 | }; 23 | 24 | public OnPluginStart() 25 | { 26 | CreateConVar("sm_shownames_version", PLUGIN_VERSION, "Plugin Version", FCVAR_SPONLY | FCVAR_REPLICATED | FCVAR_NOTIFY); 27 | 28 | humanFormat = "Human: %s
Health: %i HP
ID: #%i"; 29 | zombieFormat = "Zombie: %s
Health: %i HP (-%i DMG)
ID: #%i"; 30 | zombieFormat2 = "Zombie: %s
Health: %i HP
ID: #%i"; 31 | 32 | RegConsoleCmd("sm_showname", Command_ShowNames); 33 | RegConsoleCmd("sm_shownames", Command_ShowNames); 34 | 35 | RegConsoleCmd("sm_showdamage", Command_ShowNames); 36 | RegConsoleCmd("sm_sd", Command_ShowNames); 37 | 38 | CreateTimer(0.0, AimName, _, TIMER_REPEAT); 39 | ShowName_Cookie = RegClientCookie("showname_cookie", "Toggle seeing PlayerNames in HUD.", CookieAccess_Protected); 40 | for (new i = 1; i <= MaxClients; ++i) 41 | { 42 | if (!AreClientCookiesCached(i)) 43 | { 44 | continue; 45 | } 46 | 47 | OnClientCookiesCached(i); 48 | } 49 | 50 | HookEvent("player_hurt", Event_PlayerHurt); 51 | } 52 | 53 | public OnClientCookiesCached(i) 54 | { 55 | new String:sValue[8]; 56 | GetClientCookie(i, ShowName_Cookie, sValue, sizeof(sValue)); 57 | g_bShowName[i] = (sValue[0] != '\0' && StringToInt(sValue)); 58 | } 59 | 60 | public Action:Command_ShowNames(client, args) 61 | { 62 | if (!g_bShowName[client]) 63 | { 64 | PrintToChat(client, "[SM] ShowNames enabled."); 65 | g_bShowName[client] = true; 66 | SetClientCookie(client, ShowName_Cookie, "1"); 67 | return Plugin_Handled; 68 | } 69 | if (g_bShowName[client]) 70 | { 71 | PrintToChat(client, "[SM] ShowNames disabled."); 72 | g_bShowName[client] = false; 73 | SetClientCookie(client, ShowName_Cookie, "0"); 74 | return Plugin_Handled; 75 | } 76 | return Plugin_Handled; 77 | } 78 | 79 | stock TraceClientViewEntity(client) 80 | { 81 | new Float:m_vecOrigin[3]; 82 | new Float:m_angRotation[3]; 83 | 84 | GetClientEyePosition(client, m_vecOrigin); 85 | GetClientEyeAngles(client, m_angRotation); 86 | 87 | new Handle:tr = TR_TraceRayFilterEx(m_vecOrigin, m_angRotation, MASK_VISIBLE, RayType_Infinite, TRDontHitSelf, client); 88 | new pEntity = -1; 89 | 90 | if (TR_DidHit(tr)) 91 | { 92 | pEntity = TR_GetEntityIndex(tr); 93 | CloseHandle(tr); 94 | return pEntity; 95 | } 96 | 97 | if(tr != INVALID_HANDLE) 98 | { 99 | CloseHandle(tr); 100 | } 101 | 102 | return -1; 103 | } 104 | 105 | public bool:TRDontHitSelf(entity, mask, any:data) 106 | { 107 | return (1 <= entity <= MaxClients && entity != data); 108 | } 109 | 110 | public Action:AimName(Handle:AimName, any Client) 111 | { 112 | for(new i = 1; i <= MaxClients; i++) 113 | { 114 | if (g_bShowName[i]) 115 | { 116 | if (IsClientInGame(i)) 117 | { 118 | new target = TraceClientViewEntity(i); 119 | if(target > 0 && target <= MaxClients && IsClientInGame(target) && IsPlayerAlive(target)) 120 | { 121 | new health = GetClientHealth(target); 122 | new id = GetClientUserId(target); 123 | char name[MAX_NAME_LENGTH]; 124 | 125 | GetClientName(target, name, sizeof(name)); 126 | ReplaceString(name, sizeof(name), "<", "<", false); 127 | ReplaceString(name, sizeof(name), ">", ">", false); 128 | 129 | if(IsPlayerAlive(i) && ZR_IsClientHuman(i)) 130 | { 131 | if(ZR_IsClientHuman(target)) 132 | { 133 | PrintHintText(i, humanFormat, name, health, id); 134 | } 135 | } 136 | else 137 | { 138 | if (ZR_IsClientHuman(target)) 139 | { 140 | PrintHintText(i, humanFormat, name, health, id); 141 | } 142 | if (ZR_IsClientZombie(target)) 143 | { 144 | PrintHintText(i, zombieFormat2, name, health, id); 145 | } 146 | } 147 | } 148 | } 149 | } 150 | } 151 | return Plugin_Continue; 152 | } 153 | 154 | public Action:Event_PlayerHurt(Handle:event, const String:name[], bool:dontBroadcast) 155 | { 156 | new client = GetClientOfUserId(GetEventInt(event, "attacker")); 157 | if(client && IsClientInGame(client) && g_bShowName[client]) 158 | { 159 | new victim = GetClientOfUserId(GetEventInt(event, "userid")); 160 | new health = GetClientHealth(victim); 161 | char playerName[MAX_NAME_LENGTH]; 162 | 163 | GetClientName(victim, playerName, sizeof(playerName)); 164 | ReplaceString(playerName, sizeof(playerName), "<", "<", false); 165 | ReplaceString(playerName, sizeof(playerName), ">", ">", false); 166 | 167 | if(IsPlayerAlive(client) && health > 0 && ZR_IsClientHuman(client) && ZR_IsClientZombie(victim)) 168 | { 169 | new id = GetClientUserId(victim); 170 | new damage = GetEventInt(event, "dmg_health"); 171 | PrintHintText(client, zombieFormat, playerName, health, damage, id); 172 | } 173 | } 174 | } 175 | -------------------------------------------------------------------------------- /sm_spawnlaser.sp: -------------------------------------------------------------------------------- 1 | #pragma semicolon 1 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | #define PLUGIN_VERSION "1.0" 8 | 9 | #pragma newdecls required 10 | 11 | int clientOptions[MAXPLAYERS+1][4]; 12 | float clientDelay[MAXPLAYERS+1]; 13 | float clientOrigin[MAXPLAYERS+1][3]; 14 | float clientAngles[MAXPLAYERS+1][3]; 15 | bool stopTouch[MAXPLAYERS+1]; 16 | 17 | public Plugin myinfo = 18 | { 19 | name = "[sG] Spawn Laser", 20 | description = "Spawn Laser", 21 | author = "sG | AntiTeal", 22 | version = PLUGIN_VERSION, 23 | url = "http://www.joinsg.net" 24 | }; 25 | 26 | public void OnPluginStart() 27 | { 28 | CreateConVar("sm_spawnlaser_version", PLUGIN_VERSION, "SpawnLaser Version", FCVAR_SPONLY|FCVAR_REPLICATED|FCVAR_NOTIFY); 29 | 30 | RegAdminCmd("sm_spawnlaser", Command_SpawnLaser, ADMFLAG_GENERIC); 31 | RegAdminCmd("sm_customlaser", Command_CustomLaser, ADMFLAG_GENERIC); 32 | } 33 | 34 | public void OnMapStart() 35 | { 36 | PrecacheSound("sound/music/antiteal/laser.mp3"); 37 | PrecacheModel("models/AntiTeal/Laser.mdl"); 38 | PrecacheModel("models/props/cs_militia/silo_01.mdl"); 39 | } 40 | 41 | public Action Command_SpawnLaser(int client, int argc) 42 | { 43 | Menu menu = new Menu(MenuHandler1); 44 | 45 | menu.SetTitle("SpawnLaser Menu:"); 46 | menu.AddItem("0", "Jump Laser"); 47 | menu.AddItem("1", "Crouch Laser"); 48 | menu.AddItem("2", "Random Laser"); 49 | if(clientOptions[client][2] != 0) 50 | { 51 | char type[16], previous[64]; 52 | 53 | if(clientOptions[client][0] == 0) 54 | { 55 | Format(type, sizeof(type), "Jump"); 56 | } 57 | else if(clientOptions[client][0] == 1) 58 | { 59 | Format(type, sizeof(type), "Crouch"); 60 | } 61 | else if(clientOptions[client][0] == 2) 62 | { 63 | Format(type, sizeof(type), "Random"); 64 | } 65 | 66 | Format(previous, sizeof(previous), "Previous: %s | %i units/s | %i Lasers | %.2fs Delay", type, clientOptions[client][1], clientOptions[client][2], clientDelay[client]); 67 | menu.AddItem("3", previous); 68 | } 69 | 70 | menu.ExitButton = true; 71 | menu.Display(client, MENU_TIME_FOREVER); 72 | 73 | return Plugin_Handled; 74 | } 75 | 76 | public int MenuHandler1(Handle menu, MenuAction action, int client, int position) 77 | { 78 | if (action == MenuAction_Select) 79 | { 80 | char info[32]; 81 | GetMenuItem(menu, position, info, sizeof(info)); 82 | 83 | if(StrEqual(info, "3")) 84 | { 85 | LaserInitiate(client); 86 | } 87 | else 88 | { 89 | clientOptions[client][0] = StringToInt(info); 90 | SpawnLaser2(client); 91 | } 92 | } 93 | else if (action == MenuAction_End) 94 | { 95 | CloseHandle(menu); 96 | } 97 | } 98 | 99 | public Action SpawnLaser2(int client) 100 | { 101 | Menu menu = new Menu(MenuHandler2); 102 | 103 | menu.SetTitle("LaserSpeed Menu:"); 104 | menu.AddItem("500", "500 units/s"); 105 | menu.AddItem("1000", "1000 units/s"); 106 | menu.AddItem("1500", "1500 units/s"); 107 | menu.AddItem("2000", "2000 units/s"); 108 | menu.AddItem("4000", "4000 units/s"); 109 | 110 | menu.ExitButton = false; 111 | menu.Display(client, MENU_TIME_FOREVER); 112 | } 113 | 114 | public int MenuHandler2(Handle menu, MenuAction action, int client, int position) 115 | { 116 | if (action == MenuAction_Select) 117 | { 118 | char info[32]; 119 | GetMenuItem(menu, position, info, sizeof(info)); 120 | 121 | clientOptions[client][1] = StringToInt(info); 122 | 123 | SpawnLaser3(client); 124 | } 125 | else if (action == MenuAction_End) 126 | { 127 | CloseHandle(menu); 128 | } 129 | } 130 | 131 | public Action SpawnLaser3(int client) 132 | { 133 | Menu menu = new Menu(MenuHandler3); 134 | 135 | menu.SetTitle("LaserAmount Menu:"); 136 | menu.AddItem("1", "1 Laser"); 137 | menu.AddItem("5", "5 Lasers"); 138 | menu.AddItem("10", "10 Lasers"); 139 | menu.AddItem("15", "15 Lasers"); 140 | menu.AddItem("30", "30 Lasers"); 141 | menu.AddItem("60", "60 Lasers"); 142 | 143 | menu.ExitButton = false; 144 | menu.Display(client, MENU_TIME_FOREVER); 145 | } 146 | 147 | public int MenuHandler3(Handle menu, MenuAction action, int client, int position) 148 | { 149 | if (action == MenuAction_Select) 150 | { 151 | char info[32]; 152 | GetMenuItem(menu, position, info, sizeof(info)); 153 | 154 | int num = StringToInt(info); 155 | 156 | clientOptions[client][2] = num; 157 | 158 | if(num != 1) 159 | { 160 | SpawnLaser4(client); 161 | } 162 | else 163 | { 164 | clientOptions[client][3] = 0; 165 | LaserInitiate(client); 166 | } 167 | } 168 | else if (action == MenuAction_End) 169 | { 170 | CloseHandle(menu); 171 | } 172 | } 173 | 174 | public Action SpawnLaser4(int client) 175 | { 176 | Menu menu = new Menu(MenuHandler4); 177 | 178 | menu.SetTitle("LaserDelay Menu:"); 179 | menu.AddItem("2", "2 Seconds"); 180 | menu.AddItem("1.5", "1.5 Seconds"); 181 | menu.AddItem("1", "1 Second"); 182 | menu.AddItem(".75", ".75 Seconds"); 183 | menu.AddItem(".5", ".5 Seconds"); 184 | menu.AddItem(".25", ".25 Seconds"); 185 | 186 | menu.ExitButton = false; 187 | menu.Display(client, MENU_TIME_FOREVER); 188 | } 189 | 190 | public int MenuHandler4(Handle menu, MenuAction action, int client, int position) 191 | { 192 | if (action == MenuAction_Select) 193 | { 194 | char info[32]; 195 | GetMenuItem(menu, position, info, sizeof(info)); 196 | 197 | float num = StringToFloat(info); 198 | 199 | clientDelay[client] = num; 200 | 201 | LaserInitiate(client); 202 | } 203 | else if (action == MenuAction_End) 204 | { 205 | CloseHandle(menu); 206 | } 207 | } 208 | 209 | public Action LaserInitiate(int client) 210 | { 211 | GetClientAbsOrigin(client, clientOrigin[client]); 212 | GetClientEyeAngles(client, clientAngles[client]); 213 | 214 | clientOptions[client][3] = clientOptions[client][2]; 215 | 216 | PrintToChat(client, "[SM] Spawning lasers in 5 seconds....."); 217 | 218 | CreateTimer(5.0, StartLaser, GetClientSerial(client)); 219 | } 220 | 221 | public Action StartLaser(Handle timer, any serial) 222 | { 223 | int client = GetClientFromSerial(serial); 224 | 225 | if (client == 0) 226 | { 227 | return Plugin_Stop; 228 | } 229 | 230 | CreateLaser(client); 231 | 232 | return Plugin_Handled; 233 | } 234 | 235 | public void OnStartTouch(int entity, int client) 236 | { 237 | if(!IsValidClient(client)) 238 | { 239 | return; 240 | } 241 | 242 | if(!stopTouch[client]) 243 | { 244 | stopTouch[client] = true; 245 | CreateTimer(0.4, ResetTouch, GetClientSerial(client)); 246 | PrintToChat(client, "[SM] You were hit by a laser!"); 247 | ClientCommand(client, "playgamesound Buttons.snd18"); 248 | } 249 | } 250 | 251 | public Action StopTouch(Handle timer, any serial) 252 | { 253 | int client = GetClientFromSerial(serial); 254 | 255 | if (client == 0) 256 | { 257 | return Plugin_Stop; 258 | } 259 | 260 | stopTouch[client] = false; 261 | 262 | return Plugin_Handled; 263 | } 264 | 265 | 266 | public Action CreateLaser(int client) 267 | { 268 | float fPos[3], fAng[3]; 269 | char sAng[32]; 270 | 271 | for (int i = 0; i < 3; i++) 272 | { 273 | fPos[i] = clientOrigin[client][i]; 274 | fAng[i] = clientAngles[client][i]; 275 | } 276 | 277 | Format(sAng, sizeof(sAng), "0 %i 0", RoundToNearest(fAng[1])); 278 | int lineEnt = SpawnMoveLinear(fPos, sAng, clientOptions[client][1]); 279 | 280 | fAng[0] = 0.0; 281 | fAng[2] = 0.0; 282 | 283 | if(clientOptions[client][0] == 0) 284 | { 285 | fPos[2] += 15.0; 286 | } 287 | else if(clientOptions[client][0] == 1) 288 | { 289 | fPos[2] += 60.0; 290 | } 291 | else 292 | { 293 | int num = GetRandomInt(0, 1); 294 | if(num == 0) 295 | { 296 | fPos[2] += 15.0; 297 | } 298 | else if(num == 1) 299 | { 300 | fPos[2] += 60.0; 301 | } 302 | } 303 | 304 | fAng[1] -= 90.0; 305 | 306 | int laserEnt = SpawnLaser(fPos, fAng); 307 | 308 | ParentToEntity(laserEnt, lineEnt); 309 | 310 | SDKHook(laserEnt, SDKHook_StartTouch, OnStartTouch); 311 | AcceptEntityInput(lineEnt, "Open", -1, -1); 312 | 313 | for(int i = 1; i <= MaxClients; i++) 314 | { 315 | if(IsValidClient(i)) 316 | { 317 | ClientCommand(i, "playgamesound music/antiteal/laser.mp3"); 318 | } 319 | } 320 | 321 | clientOptions[client][3]--; 322 | 323 | if(clientOptions[client][3] > 0) 324 | { 325 | CreateTimer(clientDelay[client], StartLaser, GetClientSerial(client)); 326 | } 327 | else 328 | { 329 | PrintToChat(client, "[SM] Laser sequence over!"); 330 | } 331 | 332 | HookSingleEntityOutput(lineEnt, "OnFullyOpen", OnFullyOpen, true); 333 | 334 | return Plugin_Handled; 335 | } 336 | 337 | public int SpawnLaser(float position[3], float angles[3]) 338 | { 339 | char targetname[32]; 340 | Format(targetname, sizeof(targetname), "Laser_PropDynamic&%i", GetRandomInt(0, 999)); 341 | 342 | int g_iEnt = CreateEntityByName("prop_dynamic"); 343 | DispatchKeyValue(g_iEnt, "targetname", targetname); 344 | DispatchKeyValue(g_iEnt, "model", "models/AntiTeal/Laser.mdl"); 345 | SetEntProp(g_iEnt, Prop_Send, "m_usSolidFlags", 0x0008); 346 | SetEntProp(g_iEnt, Prop_Data, "m_nSolidType", 2); 347 | SetEntProp(g_iEnt, Prop_Send, "m_CollisionGroup", 2); 348 | DispatchSpawn(g_iEnt); 349 | 350 | TeleportEntity(g_iEnt, position, angles, NULL_VECTOR); 351 | 352 | return g_iEnt; 353 | } 354 | 355 | public int SpawnMoveLinear(float position[3], char[] angles, int spd) 356 | { 357 | char targetname[32], speed[8]; 358 | Format(targetname, sizeof(targetname), "Laser_MoveLinear&%i", GetRandomInt(0, 999)); 359 | 360 | IntToString(spd, speed, sizeof(speed)); 361 | 362 | int g_iEnt = CreateEntityByName("func_movelinear"); 363 | DispatchKeyValue(g_iEnt, "targetname", targetname); 364 | DispatchKeyValue(g_iEnt, "startposition", "0"); 365 | DispatchKeyValue(g_iEnt, "speed", speed); 366 | DispatchKeyValue(g_iEnt, "spawnflags", "8"); 367 | DispatchKeyValue(g_iEnt, "movedistance", "4000"); 368 | DispatchKeyValue(g_iEnt, "movedir", angles); 369 | DispatchSpawn(g_iEnt); 370 | 371 | return g_iEnt; 372 | } 373 | public void OnFullyOpen(const char[] output, int caller, int activator, float Any) 374 | { 375 | AcceptEntityInput(caller, "KillHierarchy", -1, -1); 376 | } 377 | 378 | public Action ResetTouch(Handle timer, any serial) 379 | { 380 | int client = GetClientFromSerial(serial); 381 | 382 | if (client == 0) 383 | { 384 | return Plugin_Stop; 385 | } 386 | 387 | stopTouch[client] = false; 388 | 389 | return Plugin_Handled; 390 | } 391 | 392 | public bool ParentToEntity(int ent, int target) 393 | { 394 | SetVariantEntity(target); 395 | return AcceptEntityInput(ent, "SetParent"); 396 | } 397 | 398 | int IsValidClient(int client, bool nobots = true) 399 | { 400 | if (client <= 0 || client > MaxClients || !IsClientConnected(client) || (nobots && IsFakeClient(client))) 401 | { 402 | return false; 403 | } 404 | return IsClientInGame(client); 405 | } 406 | 407 | public Action Command_CustomLaser(int client, int argc) 408 | { 409 | if(argc < 4) 410 | { 411 | ReplyToCommand(client, "[SM] Usage: sm_customlaser [jump|crouch|random] "); 412 | return Plugin_Handled; 413 | } 414 | char arg1[32], arg2[8], arg3[8], arg4[8]; 415 | 416 | GetCmdArg(1, arg1, sizeof(arg1)); 417 | GetCmdArg(2, arg2, sizeof(arg2)); 418 | GetCmdArg(3, arg3, sizeof(arg3)); 419 | GetCmdArg(4, arg4, sizeof(arg4)); 420 | 421 | if(StrEqual(arg1, "jump")) 422 | { 423 | clientOptions[client][0] = 0; 424 | } 425 | else if(StrEqual(arg1, "crouch")) 426 | { 427 | clientOptions[client][0] = 1; 428 | } 429 | else 430 | { 431 | clientOptions[client][0] = 2; 432 | } 433 | 434 | clientOptions[client][1] = StringToInt(arg2); 435 | clientOptions[client][2] = StringToInt(arg3); 436 | clientDelay[client] = StringToFloat(arg4); 437 | 438 | ReplyToCommand(client, "[SM] Custom settings initated. Check the previous option in the SpawnLaser menu."); 439 | 440 | return Plugin_Handled; 441 | } -------------------------------------------------------------------------------- /spawnlaser/materials/antiteal/lightblue.vmt: -------------------------------------------------------------------------------- 1 | "LightmappedGeneric" 2 | { 3 | "$basetexture" "antiteal/lightblue" 4 | "$surfaceprop" "Default" 5 | $nodecal 1 6 | } 7 | -------------------------------------------------------------------------------- /spawnlaser/materials/antiteal/lightblue.vtf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/strellic/sourcemod-plugins/da6c2e702cde59f3e24b56d339e0ca27deb23b85/spawnlaser/materials/antiteal/lightblue.vtf -------------------------------------------------------------------------------- /spawnlaser/models/AntiTeal/laser.dx80.vtx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/strellic/sourcemod-plugins/da6c2e702cde59f3e24b56d339e0ca27deb23b85/spawnlaser/models/AntiTeal/laser.dx80.vtx -------------------------------------------------------------------------------- /spawnlaser/models/AntiTeal/laser.dx90.vtx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/strellic/sourcemod-plugins/da6c2e702cde59f3e24b56d339e0ca27deb23b85/spawnlaser/models/AntiTeal/laser.dx90.vtx -------------------------------------------------------------------------------- /spawnlaser/models/AntiTeal/laser.mdl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/strellic/sourcemod-plugins/da6c2e702cde59f3e24b56d339e0ca27deb23b85/spawnlaser/models/AntiTeal/laser.mdl -------------------------------------------------------------------------------- /spawnlaser/models/AntiTeal/laser.phy: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/strellic/sourcemod-plugins/da6c2e702cde59f3e24b56d339e0ca27deb23b85/spawnlaser/models/AntiTeal/laser.phy -------------------------------------------------------------------------------- /spawnlaser/models/AntiTeal/laser.sw.vtx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/strellic/sourcemod-plugins/da6c2e702cde59f3e24b56d339e0ca27deb23b85/spawnlaser/models/AntiTeal/laser.sw.vtx -------------------------------------------------------------------------------- /spawnlaser/models/AntiTeal/laser.vvd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/strellic/sourcemod-plugins/da6c2e702cde59f3e24b56d339e0ca27deb23b85/spawnlaser/models/AntiTeal/laser.vvd -------------------------------------------------------------------------------- /spawnlaser/sound/music/antiteal/laser.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/strellic/sourcemod-plugins/da6c2e702cde59f3e24b56d339e0ca27deb23b85/spawnlaser/sound/music/antiteal/laser.mp3 -------------------------------------------------------------------------------- /spectate_zeddy.sp: -------------------------------------------------------------------------------- 1 | #pragma semicolon 1 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | #pragma newdecls required 8 | 9 | public Plugin myinfo = 10 | { 11 | name = "Spectate", 12 | description = "Adds a command to spectate specific players.", 13 | author = "AntiTeal", 14 | version = "1.0", 15 | url = "" 16 | } 17 | 18 | public void OnPluginStart() 19 | { 20 | LoadTranslations("common.phrases"); 21 | 22 | RegConsoleCmd("sm_spectate", Command_Spectate, "Spectate a player."); 23 | RegConsoleCmd("sm_spec", Command_Spectate, "Spectate a player."); 24 | 25 | AddCommandListener(Command_JoinTeam, "jointeam"); 26 | } 27 | 28 | public Action Command_Spectate(int client, int argc) 29 | { 30 | if (!client) 31 | { 32 | PrintToServer("[SM] Cannot use command from server console."); 33 | return Plugin_Handled; 34 | } 35 | 36 | if (!argc) 37 | { 38 | if (GetClientTeam(client) != CS_TEAM_SPECTATOR) 39 | { 40 | ForcePlayerSuicide(client); 41 | ChangeClientTeam(client, CS_TEAM_SPECTATOR); 42 | } 43 | 44 | return Plugin_Handled; 45 | } 46 | 47 | char sTarget[MAX_TARGET_LENGTH]; 48 | GetCmdArg(1, sTarget, sizeof(sTarget)); 49 | 50 | int iTarget; 51 | if ((iTarget = FindTarget(client, sTarget, false, false)) <= 0) 52 | return Plugin_Handled; 53 | 54 | if (!IsPlayerAlive(iTarget)) 55 | { 56 | ReplyToCommand(client, "[SM] %t", "Target must be alive"); 57 | return Plugin_Handled; 58 | } 59 | 60 | if (GetClientTeam(client) != CS_TEAM_SPECTATOR) 61 | { 62 | ForcePlayerSuicide(client); 63 | ChangeClientTeam(client, CS_TEAM_SPECTATOR); 64 | } 65 | 66 | SetEntPropEnt(client, Prop_Send, "m_hObserverTarget", iTarget); 67 | 68 | PrintToChat(client, "\x01[SM] Spectating \x04%N\x01.", iTarget); 69 | 70 | return Plugin_Handled; 71 | } 72 | 73 | public Action Command_JoinTeam(int client, const char[] command, int argc) 74 | { 75 | if (!client) 76 | { 77 | return Plugin_Continue; 78 | } 79 | 80 | char szTeam[4]; 81 | GetCmdArgString(szTeam, sizeof(szTeam)); 82 | int iTeam = StringToInt(szTeam); 83 | 84 | if (1 <= iTeam <= 3) 85 | { 86 | ChangeClientTeam(client, iTeam); 87 | return Plugin_Handled; 88 | } 89 | 90 | return Plugin_Continue; 91 | } -------------------------------------------------------------------------------- /stopsounds_zeddy.sp: -------------------------------------------------------------------------------- 1 | #pragma semicolon 1 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | new g_iStopSound[MAXPLAYERS+1], bool:g_bHooked, bool:g_bSilenceSound[MAXPLAYERS+1]; 9 | new Handle:g_hClientCookie = INVALID_HANDLE; 10 | ConVar gcV_Volume; 11 | float fVolume = 1.0; 12 | 13 | public Plugin:myinfo = 14 | { 15 | name = "Stop Weapon Sounds", 16 | author = "GoD-Tony", 17 | description = "Allows clients to modify hearing weapon sounds", 18 | version = "1.0", 19 | url = "" 20 | }; 21 | 22 | public OnPluginStart() 23 | { 24 | g_hClientCookie = RegClientCookie("stopsound", "Toggle hearing weapon sounds", CookieAccess_Private); 25 | SetCookieMenuItem(StopSoundCookieHandler, g_hClientCookie, "Stop Weapon Sounds"); 26 | 27 | AddTempEntHook("Shotgun Shot", CSS_Hook_ShotgunShot); 28 | AddNormalSoundHook(Hook_NormalSound); 29 | 30 | RegConsoleCmd("sm_stopsound", Command_StopSound, "Toggle hearing weapon sounds"); 31 | RegConsoleCmd("sm_stopsounds", Command_StopSound, "Toggle hearing weapon sounds"); 32 | 33 | gcV_Volume = CreateConVar("sm_stopsounds_silencer_volume", "0.5", "", _, true, 0.0, true, 1.0); 34 | fVolume = gcV_Volume.FloatValue; 35 | gcV_Volume.AddChangeHook(OnConVarChange); 36 | 37 | for (new i = 1; i <= MaxClients; ++i) 38 | { 39 | if (!AreClientCookiesCached(i)) 40 | { 41 | continue; 42 | } 43 | 44 | OnClientCookiesCached(i); 45 | } 46 | } 47 | 48 | public void OnConVarChange(ConVar convar, const char[] oldValue, const char[] newValue) 49 | { 50 | if (convar == gcV_Volume) { 51 | fVolume = convar.FloatValue; 52 | } 53 | } 54 | 55 | public OnMapStart() 56 | { 57 | PrecacheSound("~)weapons/usp/usp1.wav", true); 58 | } 59 | 60 | public StopSoundCookieHandler(client, CookieMenuAction:action, any:info, String:buffer[], maxlen) 61 | { 62 | switch (action) 63 | { 64 | case CookieMenuAction_DisplayOption: 65 | { 66 | } 67 | 68 | case CookieMenuAction_SelectOption: 69 | { 70 | if(CheckCommandAccess(client, "sm_stopsound", 0)) 71 | { 72 | PrepareMenu(client); 73 | } 74 | else 75 | { 76 | ReplyToCommand(client, "[SM] You have no access!"); 77 | } 78 | } 79 | } 80 | } 81 | 82 | PrepareMenu(client) 83 | { 84 | new Handle:menu = CreateMenu(YesNoMenu, MENU_ACTIONS_DEFAULT|MenuAction_DrawItem|MenuAction_DisplayItem|MenuAction_Display); 85 | SetMenuTitle(menu, "Stop Weapon Sounds Menu"); 86 | AddMenuItem(menu, "0", "Disable"); 87 | AddMenuItem(menu, "1", "Stop Sound"); 88 | AddMenuItem(menu, "2", "Silencer Sound"); 89 | SetMenuExitBackButton(menu, true); 90 | DisplayMenu(menu, client, 20); 91 | } 92 | 93 | public YesNoMenu(Handle:menu, MenuAction:action, param1, param2) 94 | { 95 | switch(action) 96 | { 97 | case MenuAction_DrawItem: 98 | { 99 | if(_:g_iStopSound[param1] == param2) 100 | { 101 | return ITEMDRAW_DISABLED; 102 | } 103 | } 104 | case MenuAction_DisplayItem: 105 | { 106 | new String:dispBuf[50]; 107 | GetMenuItem(menu, param2, "", 0, _, dispBuf, sizeof(dispBuf)); 108 | Format(dispBuf, sizeof(dispBuf), "%T", dispBuf, param1); 109 | return RedrawMenuItem(dispBuf); 110 | } 111 | case MenuAction_Display: 112 | { 113 | new String:buffer[256]; 114 | new String:title[][] = { 115 | "1", 116 | "2", 117 | "3" 118 | }; 119 | GetMenuTitle(menu, buffer, sizeof(buffer)); 120 | Format(buffer, sizeof(buffer), "%s\n%T", buffer, title[g_iStopSound[param1]], param1); 121 | SetMenuTitle(menu, buffer); 122 | } 123 | case MenuAction_Select: 124 | { 125 | new String:info[50]; 126 | if(GetMenuItem(menu, param2, info, sizeof(info))) 127 | { 128 | SetClientCookie(param1, g_hClientCookie, info); 129 | g_iStopSound[param1] = StringToInt(info); 130 | if(StringToInt(info) == 2) { 131 | g_bSilenceSound[param1] = true; 132 | CReplyToCommand(param1, "\x04[StopSound]\x01 Stop weapon sounds:\x04 Silenced Sounds\x01."); 133 | } 134 | else { 135 | g_bSilenceSound[param1] = false; 136 | CReplyToCommand(param1, "\x04[StopSound]\x01 Stop weapon sounds: \x04%s\x01.", g_iStopSound[param1] != 0 ? "Enabled" : "Disabled"); 137 | } 138 | CheckHooks(); 139 | PrepareMenu(param1); 140 | } 141 | } 142 | case MenuAction_Cancel: 143 | { 144 | if( param2 == MenuCancel_ExitBack ) 145 | { 146 | ShowCookieMenu(param1); 147 | } 148 | } 149 | case MenuAction_End: 150 | { 151 | CloseHandle(menu); 152 | } 153 | } 154 | 155 | return 0; 156 | } 157 | 158 | public OnClientCookiesCached(client) 159 | { 160 | new String:sValue[8]; 161 | GetClientCookie(client, g_hClientCookie, sValue, sizeof(sValue)); 162 | if (sValue[0] == '\0') { 163 | SetClientCookie(client, g_hClientCookie, "2"); 164 | strcopy(sValue, sizeof(sValue), "2"); 165 | } 166 | g_iStopSound[client] = (StringToInt(sValue)); 167 | g_bSilenceSound[client] = StringToInt(sValue) > 1; 168 | CheckHooks(); 169 | } 170 | 171 | public Action:Command_StopSound(client, args) 172 | { 173 | if(AreClientCookiesCached(client)) 174 | { 175 | PrepareMenu(client); 176 | } 177 | else 178 | { 179 | ReplyToCommand(client, "[SM] Error: Cookies not cached yet."); 180 | } 181 | 182 | return Plugin_Handled; 183 | } 184 | 185 | public OnClientDisconnect_Post(client) 186 | { 187 | g_iStopSound[client] = 0; 188 | g_bSilenceSound[client] = false; 189 | CheckHooks(); 190 | } 191 | 192 | CheckHooks() 193 | { 194 | new bool:bShouldHook = false; 195 | 196 | for (new i = 1; i <= MaxClients; i++) 197 | { 198 | if (g_iStopSound[i] > 0) 199 | { 200 | bShouldHook = true; 201 | break; 202 | } 203 | } 204 | 205 | // Fake (un)hook because toggling actual hooks will cause server instability. 206 | g_bHooked = bShouldHook; 207 | } 208 | 209 | public Action:Hook_NormalSound(clients[64], &numClients, String:sample[PLATFORM_MAX_PATH], &entity, &channel, &Float:volume, &level, &pitch, &flags) 210 | { 211 | // Ignore non-weapon or Re-broadcasted sounds. 212 | if (!g_bHooked || StrEqual(sample, "~)weapons/usp/usp1.wav", false) || !(strncmp(sample, "weapons", 7, false) == 0 || strncmp(sample[1], "weapons", 7, false) == 0 || strncmp(sample[2], "weapons", 7, false) == 0)) 213 | return Plugin_Continue; 214 | 215 | decl i, j; 216 | 217 | for (i = 0; i < numClients; i++) 218 | { 219 | if (g_iStopSound[clients[i]] > 0) 220 | { 221 | // Remove the client from the array. 222 | for (j = i; j < numClients-1; j++) 223 | { 224 | clients[j] = clients[j+1]; 225 | } 226 | 227 | numClients--; 228 | i--; 229 | } 230 | } 231 | 232 | return (numClients > 0) ? Plugin_Changed : Plugin_Stop; 233 | } 234 | 235 | public Action:CSS_Hook_ShotgunShot(const String:te_name[], const Players[], numClients, Float:delay) 236 | { 237 | if (!g_bHooked) 238 | return Plugin_Continue; 239 | 240 | // Check which clients need to be excluded. 241 | decl newClients[MaxClients], client, i; 242 | new newTotal = 0; 243 | 244 | int clientlist[MAXPLAYERS+1]; 245 | int clientcount = 0; 246 | 247 | for (i = 0; i < numClients; i++) 248 | { 249 | client = Players[i]; 250 | 251 | if (g_iStopSound[client] <= 0) 252 | { 253 | newClients[newTotal++] = client; 254 | } 255 | if(g_bSilenceSound[client]) 256 | { 257 | clientlist[clientcount++] = client; 258 | } 259 | } 260 | 261 | // No clients were excluded. 262 | if (newTotal == numClients) 263 | return Plugin_Continue; 264 | 265 | new player = TE_ReadNum("m_iPlayer"); 266 | new entity = player + 1; 267 | for (new j = 0; j < clientcount; j++) 268 | { 269 | if (entity == clientlist[j]) 270 | { 271 | for (new k = j; k < clientcount-1; k++) 272 | { 273 | clientlist[k] = clientlist[k+1]; 274 | } 275 | 276 | clientcount--; 277 | j--; 278 | } 279 | } 280 | EmitSound(clientlist, clientcount, "~)weapons/usp/usp1.wav", entity, SNDCHAN_STATIC, SNDLEVEL_NORMAL, SND_NOFLAGS, fVolume); 281 | 282 | // All clients were excluded and there is no need to broadcast. 283 | if (newTotal == 0) 284 | return Plugin_Stop; 285 | 286 | // Re-broadcast to clients that still need it. 287 | decl Float:vTemp[3]; 288 | TE_Start("Shotgun Shot"); 289 | TE_ReadVector("m_vecOrigin", vTemp); 290 | TE_WriteVector("m_vecOrigin", vTemp); 291 | TE_WriteFloat("m_vecAngles[0]", TE_ReadFloat("m_vecAngles[0]")); 292 | TE_WriteFloat("m_vecAngles[1]", TE_ReadFloat("m_vecAngles[1]")); 293 | TE_WriteNum("m_weapon", TE_ReadNum("m_weapon")); 294 | TE_WriteNum("m_iMode", TE_ReadNum("m_iMode")); 295 | TE_WriteNum("m_iSeed", TE_ReadNum("m_iSeed")); 296 | TE_WriteNum("m_iPlayer", player); 297 | TE_WriteFloat("m_fInaccuracy", TE_ReadFloat("m_fInaccuracy")); 298 | TE_WriteFloat("m_fSpread", TE_ReadFloat("m_fSpread")); 299 | TE_Send(newClients, newTotal, delay); 300 | 301 | return Plugin_Stop; 302 | } --------------------------------------------------------------------------------