├── LICENSE ├── NoScope Detector ├── scripting │ └── noscope_detector 1.3.1.sp ├── sounds.zip └── translations │ ├── noscope_detector.phrases.txt │ ├── ru │ └── noscope_detector.phrases.txt │ └── tr │ └── noscope_detector.phrases.txt ├── README.md ├── SM └── scripting │ ├── ExplodeString2StringMap.sp │ ├── Format_a_number_with_grouped_thousands.sp │ ├── Preview 1.2.2_08.10.2022.sp │ ├── SpawnProtection 1.5.3 no_warmup.sp │ ├── afk_check.sp │ ├── auto_reload_plugins 1.3.0_23.08.2022.sp │ ├── bomb_mark fastdl texture.zip │ ├── bomb_mark server texture.zip │ ├── bomb_mark.sp │ ├── button_test.sp │ ├── buyzone_protector 2.2.0.sp │ ├── c_nmrih_diffmoder 1.0.3_09.03.2025.sp │ ├── cmds_list 1.1.0.sp │ ├── countrynick.phrases.txt │ ├── countrynick.sp │ ├── csgo_allies_icon 1.0.1.sp │ ├── css_gunmenu.sp │ ├── fix_angles.sp │ ├── franug_csgosprays 1.4.6.sp │ ├── hex2rgba.sp │ ├── hitbox_marker 1.3.0.sp │ ├── hitbox_marker.phrases.txt │ ├── hitkillsounds 1.3.0_25.11.2022.sp │ ├── hitkillsounds 1.3.0_25.11.2022_fix2.sp │ ├── hud_dmg_info.sp │ ├── include │ ├── UTF-8-string.inc │ └── steamcore.inc │ ├── ins_battleye_disabler 1.0.0.sp │ ├── lang 1.1.0_07.09.2023.sp │ ├── medic 09.09.2020y.sp │ ├── nmrih_codes.sp │ ├── nmrih_events.sp │ ├── nmrih_flashlight 1.0.3_23.02.2023.sp │ ├── nmrih_hav.phrases.txt │ ├── nmrih_hav.sp │ ├── nmrih_healthstation_health.sp │ ├── nmrih_infinity.sp │ ├── nmrih_keycodes.phrases.txt │ ├── nmrih_npcs_hp.sp │ ├── no_tspawn_camp.sp │ ├── plugins_list_log.sp │ ├── properties.sp │ ├── random_plant_blocker.phrases.txt │ ├── random_plant_blocker.sp │ ├── revival.inc │ ├── shield_enable.sp │ ├── simple_afk_checker.sp │ ├── simple_announce 1.1.1.sp │ ├── sm_bosshud.sp │ ├── sm_christmasification.sp │ ├── sm_doublejump.sp │ ├── sm_find_cmd.sp │ ├── sm_fragtag 1.0.1_18.08.2022.sp │ ├── sm_healing_light 2.0.0.sp │ ├── sm_killfeed_ctrl.sp │ ├── sm_laser_tag 1.0.0_31.03.2025.sp │ ├── sm_medic.sp │ ├── sm_parachute_lite 2.5.2.sp │ ├── sm_prop_ctrl.sp │ ├── sm_punishment_for_rejoin 1.0.0_16.08.2023.sp │ ├── sm_revival translations.zip │ ├── sm_revival.sp │ ├── sm_revival_reward 1.0.2.sp │ ├── sm_speed.sp │ ├── sm_stringtable_dumper 1.1.1.sp │ ├── sm_tcl 1.0.1.sp │ ├── sm_telemanager 1.1.0_01.06.2024.sp │ ├── sm_wpnclnr 1.0.0.sp │ ├── steam_profile_view 1.0.3_23.04.2025.sp │ ├── supremeredirect 1.2.0_23.03.2025.sp │ ├── tools_cvarlist.sp │ ├── weak_throw_grenade.phrases.txt │ ├── weak_throw_grenade.sp │ ├── weapons_movement_speed 1.0.1_11.02.2023.sp │ ├── weapons_movement_speed.ini │ └── zone_borders.sp ├── Server WH ├── scripting │ └── sm_server_wh 1.0.3_03.10.2023.sp └── sm_server_wh texture.zip ├── [CSGO] Player Hint Info ├── scripting │ └── csgo_player_hint_info 1.1.0.sp └── translations │ ├── csgo_hint_info.phrases.txt │ ├── fr │ └── csgo_hint_info.phrases.txt │ └── ru │ └── csgo_hint_info.phrases.txt └── _config.yml /NoScope Detector/scripting/noscope_detector 1.3.1.sp: -------------------------------------------------------------------------------- 1 | #pragma semicolon 1 2 | #pragma newdecls required 3 | 4 | #include 5 | #include 6 | 7 | static const char CLR[][][] = 8 | {// name CSGO CSS CSSv34 9 | {"{WHITE}", "\x01", "\x07FFFFFF", ""}, 10 | {"{DEFAULT}", "\x01", "\x01", "\x01"}, 11 | {"{RED}", "\x02", "\x07FF0000", ""}, 12 | {"{TEAM}", "\x03", "\x03", "\x03"}, 13 | {"{GREEN}", "\x04", "\x04", "\x04"}, 14 | {"{LIME}", "\x05", "\x05", ""}, 15 | {"{LIGHTGREEN}","\x06", "\x0799FF99", ""}, 16 | {"{LIGHTRED}", "\x07", "\x07FF4040", ""}, 17 | {"{GRAY}", "\x08", "\x07CCCCCC", ""}, 18 | {"{LIGHTOLIVE}","\x09", "\x07FFBD6B", ""}, 19 | {"{OLIVE}", "\x10", "\x07FA8B00", ""}, 20 | {"{BLUEGREY}", "\x0A", "\x076699CC", ""}, 21 | {"{LIGHTBLUE}", "\x0B", "\x0799CCFF", ""}, 22 | {"{BLUE}", "\x0C", "\x073D46FF", ""}, 23 | {"{PURPLE}", "\x0E", "\x07FA00FA", ""}, 24 | {"{LIGHTRED2}", "\x0F", "\x07FF8080", ""} 25 | }; 26 | 27 | enum 28 | { 29 | E_Unknown, 30 | E_CSGO, 31 | E_CSS, 32 | E_Old 33 | }; 34 | 35 | int 36 | iEngine, 37 | iKills[MAXPLAYERS+1], 38 | iHS[MAXPLAYERS+1]; 39 | bool 40 | bProto, 41 | bMsg, 42 | bAllSnipers, 43 | bSounds; 44 | char 45 | sPathKill[PLATFORM_MAX_PATH], 46 | sPathHs[PLATFORM_MAX_PATH], 47 | sSndKill[PLATFORM_MAX_PATH], 48 | sSndHs[PLATFORM_MAX_PATH]; 49 | 50 | public Plugin myinfo = 51 | { 52 | name = "NoScope Detector", 53 | author = "Ak0 (rewritten by Grey83)", 54 | version = "1.3.1", 55 | url = "https://forums.alliedmods.net/showthread.php?t=290241" 56 | } 57 | 58 | public void OnPluginStart() 59 | { 60 | if(!HookEventEx("player_death", Event_Death)) SetFailState("Can't hook event 'player_death'!"); 61 | 62 | switch(GetEngineVersion()) 63 | { 64 | case Engine_CSGO: 65 | iEngine = E_CSGO; 66 | case Engine_CSS: 67 | iEngine = E_CSS; 68 | case Engine_SourceSDK2006: 69 | iEngine = E_Old; 70 | default: SetFailState("Can't work with this game!"); 71 | } 72 | 73 | bProto = GetFeatureStatus(FeatureType_Native, "GetUserMessageType") == FeatureStatus_Available && GetUserMessageType() == UM_Protobuf; 74 | 75 | LoadTranslations("core.phrases"); 76 | LoadTranslations("noscope_detector.phrases"); 77 | 78 | ConVar cvar; 79 | cvar = CreateConVar("sm_noscope_enable", "1", "0/1 - Disable/Enable messages", FCVAR_NOTIFY, true, 0.0, true, 1.0); 80 | cvar.AddChangeHook(CVarChanged_Msg); 81 | bMsg = cvar.BoolValue; 82 | 83 | cvar = CreateConVar("sm_noscope_allsnipers", "0", "0/1 - Disable/Enable no-scope detection for all weapons w/o crosshairs (g3sg1, scar20, sg550)", FCVAR_NOTIFY, true, 0.0, true, 1.0); 84 | cvar.AddChangeHook(CVarChanged_AllSnipers); 85 | bAllSnipers = cvar.BoolValue; 86 | 87 | cvar = CreateConVar("sm_noscope_sounds", "1", "0/1 - Disable/Enable quake announcer sounds on a no-scope kill", FCVAR_NOTIFY, true, 0.0, true, 1.0); 88 | cvar.AddChangeHook(CVarChanged_Sounds); 89 | bSounds = cvar.BoolValue; 90 | 91 | cvar = CreateConVar("sm_noscope_snd_kill", "quake/ultrakill.mp3", "Sound for common kill (empty string = disabled)", FCVAR_PRINTABLEONLY); 92 | cvar.AddChangeHook(CVarChanged_Kill); 93 | cvar.GetString(sPathKill, sizeof(sPathKill)); 94 | 95 | cvar = CreateConVar("sm_noscope_snd_hs", "quake/godlike.mp3", "Sound for headshot (empty string = disabled)", FCVAR_PRINTABLEONLY); 96 | cvar.AddChangeHook(CVarChanged_Hs); 97 | cvar.GetString(sPathHs, sizeof(sPathHs)); 98 | 99 | RegConsoleCmd("noscopes", Cmd_NoScopes, "Shows number NoScope iKills and HS"); 100 | RegConsoleCmd("ns", Cmd_NoScopes, "Shows number NoScope iKills and HS"); 101 | } 102 | 103 | public void CVarChanged_Msg(ConVar cvar, const char[] oldValue, const char[] newValue) 104 | { 105 | bMsg = cvar.BoolValue; 106 | } 107 | 108 | public void CVarChanged_AllSnipers(ConVar cvar, const char[] oldValue, const char[] newValue) 109 | { 110 | bAllSnipers = cvar.BoolValue; 111 | } 112 | 113 | public void CVarChanged_Sounds(ConVar cvar, const char[] oldValue, const char[] newValue) 114 | { 115 | bSounds = cvar.BoolValue; 116 | } 117 | 118 | public void CVarChanged_Kill(ConVar cvar, const char[] oldVal, const char[] newVal) 119 | { 120 | cvar.GetString(sPathKill, sizeof(sPathKill)); 121 | 122 | int len = strlen(sPathKill) - 4; 123 | if(len < 4 || strcmp(sPathKill[len], ".mp3", false) && strcmp(sPathKill[len], ".wav", false)) 124 | sPathKill[0] = 0; 125 | } 126 | 127 | public void CVarChanged_Hs(ConVar cvar, const char[] oldVal, const char[] newVal) 128 | { 129 | cvar.GetString(sPathHs, sizeof(sPathHs)); 130 | 131 | int len = strlen(sPathHs) - 4; 132 | if(len < 1 || strcmp(sPathHs[len], ".mp3", false) && strcmp(sPathHs[len], ".wav", false)) 133 | sPathHs[0] = 0; 134 | } 135 | 136 | stock void AddKillSound() 137 | { 138 | FormatEx(sSndKill, sizeof(sSndKill), "sound/%s", sPathKill); 139 | AddFileToDownloadsTable(sSndKill); 140 | if(iEngine == E_CSGO) 141 | { 142 | FormatEx(sSndKill, sizeof(sSndKill), "*%s", sPathKill); 143 | AddToStringTable(FindStringTable("soundprecache"), sSndKill); 144 | } 145 | else 146 | { 147 | FormatEx(sSndKill, sizeof(sSndKill), "%s", sPathKill); 148 | PrecacheSound(sSndKill, true); 149 | } 150 | } 151 | 152 | stock void AddHSSound() 153 | { 154 | FormatEx(sSndHs, sizeof(sSndHs), "sound/%s", sPathHs); 155 | AddFileToDownloadsTable(sSndHs); 156 | if(iEngine == E_CSGO) 157 | { 158 | FormatEx(sSndHs, sizeof(sSndHs), "*%s", sPathHs); 159 | AddToStringTable(FindStringTable("soundprecache"), sSndHs); 160 | } 161 | else 162 | { 163 | FormatEx(sSndHs, sizeof(sSndHs), "%s", sPathHs); 164 | PrecacheSound(sSndHs, true); 165 | } 166 | } 167 | 168 | public void OnMapStart() 169 | { 170 | if(sPathKill[0]) AddKillSound(); 171 | 172 | if(!sPathHs[0]) 173 | { 174 | if(!sPathKill[0]) return; 175 | else FormatEx(sPathHs, sizeof(sPathHs), sPathKill); 176 | } 177 | 178 | AddHSSound(); 179 | } 180 | 181 | public void OnClientConnected(int client) 182 | { 183 | iKills[client] = iHS[client] = 0; 184 | } 185 | 186 | public void Event_Death(Event event, const char[] name, bool dontBroadcast) 187 | { 188 | static int attacker, wpn, i, clients[MAXPLAYERS]; 189 | static char weapon[8]; 190 | if(!IsClientValid((attacker = GetClientOfUserId(event.GetInt("attacker"))), false) 191 | || !IsClientValid(GetClientOfUserId(event.GetInt("userid")))) 192 | return; 193 | 194 | event.GetString("weapon", weapon, sizeof(weapon)); 195 | if(weapon[0] && ((!strcmp(weapon, "awp") || !strcmp(weapon, iEngine == E_CSGO ? "ssg08" : "scout")) 196 | || (bAllSnipers && (!strcmp(weapon, "g3sg1") || !strcmp(weapon, iEngine == E_CSGO ? "scar20" : "sg550")))) 197 | && (wpn = GetEntPropEnt(attacker, Prop_Send, "m_hActiveWeapon")) != -1 && !GetEntProp(wpn, Prop_Send, "m_weaponMode")) 198 | { 199 | iKills[attacker]++; 200 | bool headshot; 201 | if((headshot = event.GetBool("headshot"))) iHS[attacker]++; 202 | 203 | if(bMsg) 204 | { 205 | static char attacker_name[MAX_NAME_LENGTH]; 206 | GetClientName(attacker, attacker_name, sizeof(attacker_name)); 207 | PrintToChatAllClr("%t%t", "TAG", headshot ? "HS2All" : "Kill2All", attacker_name); 208 | PrintToChatClr(attacker, "%t", "Progress", iHS[attacker], iKills[attacker]); 209 | } 210 | 211 | if(!bSounds || !sSndKill[0] && (!headshot || !sSndHs[0])) return; 212 | 213 | for(i = 1, wpn = 0; i <= MaxClients; i++) if(IsClientInGame(i) && !IsFakeClient(i)) clients[wpn++] = i; 214 | if(wpn) EmitSound(clients, wpn, headshot && sSndHs[0] ? sSndHs : sSndKill, attacker); 215 | } 216 | } 217 | 218 | stock bool IsClientValid(int client, bool allow_bots = true) 219 | { 220 | return client && (allow_bots || !IsFakeClient(client)); 221 | } 222 | 223 | public Action Cmd_NoScopes(int client, int args) 224 | { 225 | if(client && IsClientInGame(client)) 226 | { 227 | if(!bMsg) ReplyToCommand(client, "[SM] %T", "No Access", client); 228 | else PrintToChatClr(client, "%t", "Progress", iHS[client], iKills[client]); 229 | } 230 | return Plugin_Handled; 231 | } 232 | 233 | stock void PrintToChatAllClr(const char[] msg, any ...) 234 | { 235 | static char buffer[PLATFORM_MAX_PATH]; 236 | for(int i = 1; i <= MaxClients; i++) if(IsClientInGame(i) && !IsFakeClient(i)) 237 | { 238 | VFormat(buffer, sizeof(buffer), msg, 2); 239 | PrintToChatClr(i, "%s", buffer); 240 | } 241 | } 242 | 243 | stock void PrintToChatClr(int client, const char[] msg, any ...) 244 | { 245 | Handle hBuffer = StartMessageOne("SayText2", client, USERMSG_RELIABLE|USERMSG_BLOCKHOOKS); 246 | if(!hBuffer) return; 247 | 248 | SetGlobalTransTarget(client); 249 | static char buffer[PLATFORM_MAX_PATH], new_msg[PLATFORM_MAX_PATH]; 250 | if(iEngine != E_Unknown) FormatEx(buffer, sizeof(buffer), "%s\x01%s", iEngine == E_CSGO ? " " : "", msg); 251 | VFormat(new_msg, sizeof(new_msg), buffer, 3); 252 | 253 | if(iEngine) for(int i; i < 16; i++) ReplaceString(new_msg, sizeof(new_msg), CLR[i][0], CLR[i][iEngine]); 254 | else for(int i; i < 16; i++) ReplaceString(new_msg, sizeof(new_msg), CLR[i][0], NULL_STRING); 255 | 256 | if(bProto) 257 | { 258 | PbSetInt(hBuffer, "ent_idx", 0); 259 | PbSetBool(hBuffer, "chat", true); 260 | PbSetString(hBuffer, "msg_name", new_msg); 261 | PbAddString(hBuffer, "params", ""); 262 | PbAddString(hBuffer, "params", ""); 263 | PbAddString(hBuffer, "params", ""); 264 | PbAddString(hBuffer, "params", ""); 265 | } 266 | else 267 | { 268 | BfWriteByte(hBuffer, 0); 269 | BfWriteByte(hBuffer, true); 270 | BfWriteString(hBuffer, new_msg); 271 | } 272 | EndMessage(); 273 | } 274 | -------------------------------------------------------------------------------- /NoScope Detector/sounds.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Grey83/SourceMod-plugins/dfa77f1fb3842f03010d6c7512f21d50f49e65e2/NoScope Detector/sounds.zip -------------------------------------------------------------------------------- /NoScope Detector/translations/noscope_detector.phrases.txt: -------------------------------------------------------------------------------- 1 | // You can use this tags for set text color: {WHITE}, {DEFAULT}, {RED}, {TEAM}, {GREEN}, {LIME}, {LIGHTGREEN}, {LIGHTRED}, 2 | // {GRAY}, {LIGHTOLIVE}, {OLIVE}", {BLUEGREY}, {LIGHTBLUE}, {BLUE}, {PURPLE}, {LIGHTRED2} 3 | "Phrases" 4 | { 5 | "TAG" 6 | { 7 | "en" "{RED}☆ {GREEN}" 8 | } 9 | "HS2All" 10 | { 11 | "#format" "{1:s}" // name 12 | "en" "{1} {WHITE}Noscope {LIGHTGREEN}+ {WHITE}Headshot." 13 | } 14 | "Kill2All" 15 | { 16 | "#format" "{1:s}" // name 17 | "en" "{1} {WHITE}Noscope." 18 | } 19 | "Progress" 20 | { 21 | "#format" "{1:d},{2:d}" // Number of headshots and kills 22 | "en" "{WHITE}Total number of noscopes: {GREEN}{1}{LIGHTGREEN}/{GREEN}{2}" 23 | } 24 | } -------------------------------------------------------------------------------- /NoScope Detector/translations/ru/noscope_detector.phrases.txt: -------------------------------------------------------------------------------- 1 | // Ты можешь использовать эти теги для раскрашивания текста: {WHITE}, {DEFAULT}, {RED}, {TEAM}, {GREEN}, {LIME}, 2 | // {LIGHTGREEN}, {LIGHTRED}, {GRAY}, {LIGHTOLIVE}, {OLIVE}", {BLUEGREY}, {LIGHTBLUE}, {BLUE}, {PURPLE}, {LIGHTRED2} 3 | "Phrases" 4 | { 5 | "TAG" 6 | { 7 | "ru" "{RED}☆ {GREEN}" 8 | } 9 | "HS2All" 10 | { 11 | "ru" "{2} {WHITE}сделал {LIGHTGREEN}хэдшот без прицела." 12 | } 13 | "Kill2All" 14 | { 15 | "ru" "{2} {WHITE}убил {LIGHTGREEN}без прицела." 16 | } 17 | "Progress" 18 | { 19 | "ru" "{WHITE}Всего убийств без прицела: {GREEN}{1}{LIGHTGREEN}/{GREEN}{2}" 20 | } 21 | } -------------------------------------------------------------------------------- /NoScope Detector/translations/tr/noscope_detector.phrases.txt: -------------------------------------------------------------------------------- 1 | // You can use this tags for set text color: {WHITE}, {DEFAULT}, {RED}, {TEAM}, {GREEN}, {LIME}, {LIGHTGREEN}, {LIGHTRED}, 2 | // {GRAY}, {LIGHTOLIVE}, {OLIVE}", {BLUEGREY}, {LIGHTBLUE}, {BLUE}, {PURPLE}, {LIGHTRED2} 3 | "Phrases" 4 | { 5 | "TAG" 6 | { 7 | "tr" "{RED}☆ " 8 | } 9 | "HS2All" 10 | { 11 | "tr" "{1} {WHITE}Dürbünsüz {LIGHTGREEN}+ {WHITE}Headshot {LIGHTGREEN}Vurdu." 12 | } 13 | "Kill2All" 14 | { 15 | "tr" "{1} {WHITE}Dürbünsüz {LIGHTGREEN}Vurdu." 16 | } 17 | "Progress" 18 | { 19 | "tr" "{WHITE}Noscope ile vurduğun toplam kişi sayısı: {GREEN}{1}{LIGHTGREEN}/{GREEN}{2}" 20 | } 21 | } -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [![license](https://img.shields.io/github/license/cinit/TMoe.svg)](https://www.gnu.org/licenses/gpl-3.0.html) 2 | # SourceMod-plugins 3 | 4 | Some of my plugins 5 | -------------------------------------------------------------------------------- /SM/scripting/ExplodeString2StringMap.sp: -------------------------------------------------------------------------------- 1 | static const char STRING[] = "sfbbvnfvg;gb gvf; gfvbn gvcnb; ; ; vfbvb" 2 | 3 | public void OnPluginStart() 4 | { 5 | StringMap list; 6 | ExplodeString2StringMap(STRING, ";", list, _, true); 7 | list = CreateTrie(); 8 | ExplodeString2StringMap(STRING, ";", list, _, true); 9 | ExplodeString2StringMap(STRING, ";", list, true, _); 10 | ExplodeString2StringMap(STRING, " ", list, _, true); 11 | delete list; 12 | } 13 | 14 | /** 15 | * Breaks a string into pieces and stores each piece into a StringMap. 16 | * 17 | * @param text The string to split. 18 | * @param split The string to use as a split delimiter. 19 | * @param str_map StringMap to store chunks of text. 20 | * @param add False (default) to keep only new strings, true add strings to existing strings. 21 | * @param copyRemainder False (default) discard excess pieces, true to ignore 22 | * delimiters after last piece. 23 | * @return Number of strings retrieved. 24 | */ 25 | 26 | stock int ExplodeString2StringMap(const char[] text, const char[] split, StringMap &str_map, const bool add = false, const bool copyRemainder = false) 27 | { 28 | PrintToServer("\n\nText: \"%s\"", text); 29 | PrintToServer("Split: \"%s\" StringMap: #%i", split, view_as(str_map)); 30 | 31 | // если StringMap не существует или разделитель - пустая строка, то завершаем выполнение разбивки 32 | if(!str_map || !split[0]) 33 | return 0; 34 | 35 | int num; 36 | if(!add) str_map.Clear(); 37 | else num = str_map.Size 38 | 39 | int len = strlen(text), bytes = GetCharBytes(split); 40 | char[] source = new char[len+1]; 41 | 42 | strcopy(source, len+1, text); 43 | PrintToServer("Copy: \"%s\" (%i)", source, len); 44 | 45 | int i, size, start; 46 | while(i < len && text[i]) 47 | { 48 | if(text[i] == split[0] && (bytes == 1 || !strncmp(split, text[i], bytes))) // разделитель обнаружен 49 | { 50 | // вычисляем размер копируемого куска и сохраняем его, если он не нулевой 51 | if((size = i - start) > 0) 52 | { 53 | strcopy(source, size+1, text[start]); 54 | if(TrimString(source)) // удаляем пробелы в начале и конце куска 55 | { 56 | str_map.SetValue(source, start, true); // сохраняем кусок строки в StringMap 57 | 58 | PrintToServer("| %2i) \"%s\" (%i)", str_map.Size, source, size); 59 | } 60 | } 61 | 62 | start = i+bytes; // запоминаем положение первого символа после разделителя 63 | if(bytes > 1) i = start - 1; // смещаем положение проверки на размер разделителя, если он больше одного байта 64 | } 65 | i++; 66 | } 67 | 68 | PrintToServer("copyRemainder: %s", copyRemainder ? "true" : "false"); 69 | if(copyRemainder && (size = len - start) > 0) 70 | { 71 | strcopy(source, size+1, text[start]); 72 | if(TrimString(source)) // удаляем пробелы в начале и конце куска 73 | { 74 | str_map.SetValue(source, start, true); // сохраняем кусок строки в StringMap 75 | 76 | PrintToServer("| %2i) \"%s\" (%i)", str_map.Size, source, size); 77 | } 78 | } 79 | 80 | PrintToServer("Added: %i", str_map.Size - num); 81 | PrintToServer("\n", source); 82 | 83 | return str_map.Size - num; 84 | } 85 | /* 86 | 87 | Text: "sfbbvnfvg;gb gvf; gfvbn gvcnb; ; ; vfbvb" 88 | Split: ";" StringMap: #0 89 | 90 | 91 | Text: "sfbbvnfvg;gb gvf; gfvbn gvcnb; ; ; vfbvb" 92 | Split: ";" StringMap: #358548061 93 | Copy: "sfbbvnfvg;gb gvf; gfvbn gvcnb; ; ; vfbvb" (43) 94 | | 1) "sfbbvnfvg" (9) 95 | | 2) "gb gvf" (6) 96 | | 3) "gfvbn gvcnb" (13) 97 | copyRemainder: true 98 | | 4) "vfbvb" (6) 99 | Added: 4 100 | 101 | 102 | 103 | Text: "sfbbvnfvg;gb gvf; gfvbn gvcnb; ; ; vfbvb" 104 | Split: ";" StringMap: #358548061 105 | Copy: "sfbbvnfvg;gb gvf; gfvbn gvcnb; ; ; vfbvb" (43) 106 | | 4) "sfbbvnfvg" (9) 107 | | 4) "gb gvf" (6) 108 | | 4) "gfvbn gvcnb" (13) 109 | copyRemainder: false 110 | Added: 0 111 | 112 | 113 | 114 | Text: "sfbbvnfvg;gb gvf; gfvbn gvcnb; ; ; vfbvb" 115 | Split: " " StringMap: #358548061 116 | Copy: "sfbbvnfvg;gb gvf; gfvbn gvcnb; ; ; vfbvb" (43) 117 | | 1) "sfbbvnfvg;gb" (12) 118 | | 2) "gvf;" (4) 119 | | 3) "gfvbn" (5) 120 | | 4) "gvcnb;" (6) 121 | | 5) ";" (1) 122 | | 5) ";" (1) 123 | copyRemainder: true 124 | | 6) "vfbvb" (5) 125 | Added: 6 126 | 127 | */ 128 | -------------------------------------------------------------------------------- /SM/scripting/Format_a_number_with_grouped_thousands.sp: -------------------------------------------------------------------------------- 1 | static const int NUM[] = {2147483649, -1000000000, (1 << 31), 2147483647}; 2 | 3 | 4 | public void OnPluginStart() 5 | { 6 | PrintToServer("\n%i = %s", NUM[0], SplitInt(NUM[0])); 7 | PrintToServer("%i = %s", NUM[1], SplitInt(NUM[1])); 8 | PrintToServer("%i = %s", NUM[2], SplitInt(NUM[2])); 9 | PrintToServer("%i = %s\n", NUM[3], SplitInt(NUM[3])); 10 | } 11 | 12 | stock char SplitInt(int number) 13 | { 14 | static const int JOIN = ' '; 15 | static bool kkk, kk, k; 16 | static int i, j; 17 | static char buffer[16]; 18 | 19 | buffer[0] = buffer[1] = 0; 20 | if(number & (1 << 31)) 21 | { 22 | buffer[0] = '-'; 23 | j = ~number; 24 | if(number != (1<<31)) j++; 25 | } 26 | else j = number; 27 | 28 | if((kkk = (i = j/1000000000) > 0)) 29 | Format(buffer, sizeof(buffer), "%s%i%c", buffer, i, JOIN); 30 | if((kk = (i = j/1000000%1000) > 0) || kkk) 31 | Format(buffer, sizeof(buffer), kkk ? "%s%03i%c" : "%s%i%c", buffer, i, JOIN); 32 | if((k = (i = j/1000%1000) > 0) || kk || kkk) 33 | Format(buffer, sizeof(buffer), kk || kkk ? "%s%03i%c" : "%s%i%c", buffer, i, JOIN); 34 | i = j%1000; 35 | if(number == (1<<31)) i++; 36 | Format(buffer, sizeof(buffer), k || kk || kkk ? "%s%03i%c": "%s%d%c", buffer, i, JOIN); 37 | 38 | return buffer; 39 | } -------------------------------------------------------------------------------- /SM/scripting/Preview 1.2.2_08.10.2022.sp: -------------------------------------------------------------------------------- 1 | #pragma newdecls required 2 | #pragma semicolon 1 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | 12 | static const char 13 | PL_NAME[] = "Preview", 14 | PL_VER[] = "1.2.2_08.10.2022", 15 | 16 | SCFG[] = "configs/preview/settings.ini", 17 | DCFG[] = "configs/preview/download.ini", 18 | 19 | PRE_CSS[] = "\x07FF0000", 20 | PRE_CSGO[] = " \x07"; 21 | 22 | Menu 23 | hList, 24 | hPreview; 25 | bool 26 | bCSGO; 27 | int 28 | iItem[MAXPLAYERS+1], 29 | iRef[MAXPLAYERS+1]; 30 | 31 | public Plugin myinfo = 32 | { 33 | name = PL_NAME, 34 | author = "Drumanid, Grey83", 35 | description = "Preview of available player models", 36 | version = PL_VER, 37 | url = "http://vk.com/drumanid https://steamcommunity.com/groups/grey83ds" 38 | } 39 | 40 | public void OnPluginStart() 41 | { 42 | CreateConVar("sm_preview_version", PL_VER, PL_NAME, FCVAR_DONTRECORD|FCVAR_NOTIFY|FCVAR_SPONLY); 43 | 44 | bCSGO = GetEngineVersion() == Engine_CSGO; 45 | 46 | RegConsoleCmd("sm_pre", Cmd_Preview); 47 | RegConsoleCmd("sm_preview", Cmd_Preview); 48 | 49 | RegAdminCmd("sm_preview_reload", Cmd_Reload, ADMFLAG_CONFIG, "Reload \"Preview\" plugin configurations"); 50 | 51 | hList = new Menu(Menu_List); 52 | hList.ExitButton = true; 53 | 54 | hPreview = new Menu(Menu_Preview, MenuAction_DisplayItem); 55 | hPreview.SetTitle("Демонстрация модели\nПревью появится на позиции вашего прицела!\n "); 56 | hPreview.AddItem("", "Превью"); 57 | hPreview.ExitBackButton = true; 58 | hPreview.ExitButton = true; 59 | } 60 | 61 | public void OnMapStart() 62 | { 63 | for(int i = 1; i <= MaxClients; i++) 64 | { 65 | iItem[i] = 0; 66 | OnClientDisconnect(i); 67 | } 68 | hList.RemoveAllItems(); 69 | 70 | char buffer[PLATFORM_MAX_PATH]; 71 | KeyValues kv = new KeyValues("Preview"); 72 | BuildPath(Path_SM, buffer, sizeof(buffer), SCFG); 73 | if(!kv.ImportFromFile(buffer)) SetFailState("No found: %s", buffer); 74 | 75 | kv.Rewind(); 76 | if(kv.GotoFirstSubKey()) 77 | { 78 | int val; 79 | char name[64], model[128]; 80 | do 81 | { 82 | kv.GetSectionName(name, sizeof(name)); 83 | kv.GetString("model", model, sizeof(model)); 84 | if((val = strlen(model) - 4) < 1 || strcmp(model[val], ".mdl", true)) 85 | LogError("Wrong '%s' model path: '%s'", name, model); 86 | else hList.AddItem(model, name); 87 | } while(kv.GotoNextKey()); 88 | } 89 | 90 | iItem[0] = hList.ItemCount; 91 | hList.SetTitle("Скины (%i):\n ", iItem[0]); 92 | if(!iItem[0]) 93 | { 94 | hList.AddItem(NULL_STRING, "Нет скинов для просмотра", ITEMDRAW_DISABLED); 95 | LogError("Empty or invalid config '%s'", buffer); 96 | return; 97 | } 98 | 99 | BuildPath(Path_SM, buffer, sizeof(buffer), DCFG); 100 | File file = OpenFile(buffer, "r"); 101 | if(!file) SetFailState("No found: %s", buffer); 102 | 103 | while(file.ReadLine(buffer, sizeof(buffer))) 104 | { 105 | TrimString(buffer); 106 | if(IsCharAlpha(buffer[0]) && StrContains(buffer, "//") == -1 && FileExists(buffer)) 107 | { 108 | AddFileToDownloadsTable(buffer); 109 | PrecacheModel(buffer, true); 110 | } 111 | } 112 | 113 | delete file; 114 | } 115 | 116 | public Action CS_OnTerminateRound(float& delay, CSRoundEndReason& reason) 117 | { 118 | for(int i = 1; i <= MaxClients; i++) iRef[i] = -1; 119 | return Plugin_Continue; 120 | } 121 | 122 | public Action Cmd_Reload(int client, int args) 123 | { 124 | OnMapStart(); 125 | ReplyToCommand(client, "Added models to preview menu: %i", iItem[0]); 126 | 127 | return Plugin_Handled; 128 | } 129 | 130 | public Action Cmd_Preview(int client, int args) 131 | { 132 | if(client) hList.DisplayAt(client, ((iItem[client] & 0xfff000) >> 12), MENU_TIME_FOREVER); 133 | return Plugin_Handled; 134 | } 135 | 136 | public void OnClientDisconnect(int client) 137 | { 138 | RemoveMdl(client); 139 | iItem[client] = 0; 140 | } 141 | 142 | public int Menu_List(Menu menu, MenuAction action, int client, int option) 143 | { 144 | if(action == MenuAction_Select) 145 | { 146 | iItem[client] = option | (hList.Selection << 12); 147 | hPreview.Display(client, MENU_TIME_FOREVER); 148 | } 149 | return 0; 150 | } 151 | 152 | public int Menu_Preview(Menu menu, MenuAction action, int client, int param) 153 | { 154 | static char buffer[128]; 155 | switch(action) 156 | { 157 | case MenuAction_DisplayItem: 158 | { 159 | hList.GetItem((iItem[client]&0xfff), "", 0, _, buffer, sizeof(buffer)); 160 | Format(buffer, sizeof(buffer), "%s модель\n %s", iRef[client] != -1 ? "Скрыть" : "Показать", buffer); 161 | return RedrawMenuItem(buffer); 162 | } 163 | case MenuAction_Select: 164 | { 165 | if(iRef[client] == -1) 166 | ShowModel(client); 167 | else RemoveMdl(client); 168 | hPreview.Display(client, MENU_TIME_FOREVER); 169 | } 170 | case MenuAction_Cancel: 171 | if(param == MenuCancel_ExitBack) hList.DisplayAt(client, ((iItem[client] & 0xfff000) >> 12), MENU_TIME_FOREVER); 172 | } 173 | return 0; 174 | } 175 | 176 | stock void ShowModel(int client) 177 | { 178 | RemoveMdl(client); 179 | 180 | char mdl[128]; 181 | hList.GetItem((iItem[client]&0xfff), mdl, sizeof(mdl)); 182 | 183 | if(!IsModelPrecached(mdl)) 184 | { 185 | LogError("Model '%s' not cached.", mdl); 186 | PrintToChat(client, "%sК сожалению сервер не может показать вам эту модель!", bCSGO ? PRE_CSGO : PRE_CSS); 187 | return; 188 | } 189 | 190 | int ent = CreateEntityByName("prop_physics_override"); 191 | if(ent == -1) 192 | { 193 | LogError("Failed to create entity 'prop_physics_override'."); 194 | return; 195 | } 196 | 197 | DispatchKeyValue(ent, "model", mdl); 198 | DispatchKeyValue(ent, "physicsmode", "2"); 199 | DispatchKeyValue(ent, "massScale", "1.0"); 200 | DispatchKeyValue(ent, "spawnflags", "0"); 201 | DispatchKeyValue(ent, "CollisionGroup", "1"); 202 | 203 | float fPos[3], fAng[3]; 204 | GetClientEyePosition(client, fPos); 205 | GetClientEyeAngles(client, fAng); 206 | TR_TraceRayFilter(fPos, fAng, MASK_SOLID, RayType_Infinite, Filter, client); 207 | TR_GetEndPosition(fPos); 208 | GetClientAbsAngles(client, fAng); fAng[1] -= 180.0; 209 | TeleportEntity(ent, fPos, fAng, NULL_VECTOR); 210 | 211 | if(!DispatchSpawn(ent)) 212 | { 213 | LogError("Failed to spawn entity 'prop_physics_override'."); 214 | return; 215 | } 216 | 217 | SetEntProp(ent, Prop_Send, "m_usSolidFlags", 8); 218 | SetEntityMoveType(ent, MOVETYPE_NONE); 219 | 220 | SDKHook(ent, SDKHook_SetTransmit, SetTransmit); 221 | 222 | iRef[client] = EntIndexToEntRef(ent); 223 | } 224 | 225 | stock void RemoveMdl(int client) 226 | { 227 | if(IsMdlExist(client)) AcceptEntityInput(iRef[client], "Kill"); 228 | iRef[client] = -1; 229 | } 230 | 231 | public bool Filter(int ent, int mask, any entity) 232 | { 233 | return ent != entity; 234 | } 235 | 236 | public Action SetTransmit(int entity, int client) 237 | { 238 | return iRef[client] != -1 && EntRefToEntIndex(iRef[client]) == entity ? Plugin_Continue : Plugin_Handled; 239 | } 240 | 241 | stock bool IsMdlExist(int client) 242 | { 243 | return iRef[client] != -1 && GetMdlId(client) != -1; 244 | } 245 | 246 | stock int GetMdlId(int client) 247 | { 248 | return EntRefToEntIndex(iRef[client]); 249 | } -------------------------------------------------------------------------------- /SM/scripting/SpawnProtection 1.5.3 no_warmup.sp: -------------------------------------------------------------------------------- 1 | #pragma semicolon 1 2 | 3 | #include 4 | 5 | #define VERSION "1.5.3 no_warmup" 6 | 7 | new RenderOffs; 8 | 9 | new bool:bEnabled, 10 | Float:fTime, 11 | bool:bNotify, 12 | iColor[2][4]; 13 | 14 | new TeamSpec, 15 | TeamFist, 16 | bool:NoTeams, 17 | bActive[MAXPLAYERS+1], 18 | bool:bCSGO; 19 | 20 | public Plugin:myinfo = 21 | { 22 | name = "Spawn Protection", 23 | author = "Fredd (optimized by Grey83)", 24 | description = "Adds spawn protection", 25 | version = VERSION, 26 | url = "www.sourcemod.net" 27 | } 28 | 29 | public OnPluginStart() 30 | { 31 | decl String:buffer[16]; 32 | GetGameFolderName(buffer, sizeof(buffer)); 33 | if(StrEqual(buffer, "cstrike", false) || StrEqual(buffer, "dod", false) || StrEqual(buffer, "csgo", false) || StrEqual(buffer, "tf", false)) 34 | { 35 | TeamSpec = 1; 36 | TeamFist = 2; 37 | bCSGO = buffer[2] == 'g'; 38 | } 39 | else if(StrEqual(buffer, "Insurgency", false)) 40 | { 41 | TeamSpec = 3; 42 | TeamFist = 1; 43 | } 44 | else if(StrEqual(buffer, "hl2mp", false)) 45 | NoTeams = true; 46 | else SetFailState("%s is an unsupported mod", buffer); 47 | 48 | CreateConVar("spawnprotection_version", VERSION, "Spawn Protection Version", FCVAR_SPONLY|FCVAR_REPLICATED|FCVAR_NOTIFY); 49 | 50 | new Handle:CVar; 51 | CVar = CreateConVar("sp_on", "1", _, _, true, _, true, 1.0); 52 | HookConVarChange(CVar, CVarChanged_Enabled); 53 | bEnabled = GetConVarBool(CVar); 54 | 55 | CVar = CreateConVar("sp_time", "5", _, _, true, 1.0); 56 | HookConVarChange(CVar, CVarChanged_Time); 57 | fTime = GetConVarFloat(CVar); 58 | 59 | CVar = CreateConVar("sp_notify", "1", _, _, true, _, true, 1.0); 60 | HookConVarChange(CVar, CVarChanged_Notify); 61 | bNotify = GetConVarBool(CVar); 62 | 63 | CVar = CreateConVar(NoTeams ? "sp_color" : "sp_color_first", "255 31 0 120", _, FCVAR_PRINTABLEONLY); 64 | HookConVarChange(CVar, CVarChanged_ColorFirst); 65 | GetColor(CVar); 66 | 67 | if(!NoTeams) 68 | { 69 | CVar = CreateConVar("sp_color_second", "0 31 255 120", _, FCVAR_PRINTABLEONLY); 70 | HookConVarChange(CVar, CVarChanged_ColorSecond); 71 | GetColor(CVar, 1); 72 | } 73 | 74 | AutoExecConfig(true, "spawn_protection"); 75 | 76 | RenderOffs = FindSendPropInfo("CBasePlayer", "m_clrRender"); 77 | 78 | HookEvent("player_spawn", OnPlayerSpawn); 79 | } 80 | 81 | public CVarChanged_Enabled(Handle:CVar, const String:oldValue[], const String:newValue[]) 82 | { 83 | bEnabled = GetConVarBool(CVar); 84 | } 85 | 86 | public CVarChanged_Time(Handle:CVar, const String:oldValue[], const String:newValue[]) 87 | { 88 | fTime = GetConVarFloat(CVar); 89 | } 90 | 91 | public CVarChanged_Notify(Handle:CVar, const String:oldValue[], const String:newValue[]) 92 | { 93 | bNotify = GetConVarBool(CVar); 94 | } 95 | 96 | public CVarChanged_ColorFirst(Handle:CVar, const String:oldValue[], const String:newValue[]) 97 | { 98 | GetColor(CVar); 99 | } 100 | 101 | public CVarChanged_ColorSecond(Handle:CVar, const String:oldValue[], const String:newValue[]) 102 | { 103 | GetColor(CVar, 1); 104 | } 105 | 106 | GetColor(Handle:CVar, pos = 0) 107 | { 108 | new String:buffer[16], String:s_color[4][4]; 109 | GetConVarString(CVar, buffer, sizeof(buffer)); 110 | ExplodeString(buffer, " ", s_color, 4, 4); 111 | for(new i, color; i < 4; i++) 112 | { 113 | color = StringToInt(s_color[i]); 114 | if(color < 1) iColor[pos][i] = 0; 115 | else if(color > 254) iColor[pos][i] = 255; 116 | else iColor[pos][i] = color; 117 | } 118 | } 119 | 120 | public Action:OnPlayerSpawn(Handle:event, const String:name[], bool:dontBroadcast) 121 | { 122 | if(bEnabled) 123 | { 124 | if(bCSGO && GameRules_GetProp("m_bWarmupPeriod")) 125 | return Plugin_Continue; 126 | 127 | new client = GetClientOfUserId(GetEventInt(event, "userid")); 128 | if(!IsPlayerAlive(client)) 129 | return Plugin_Continue; 130 | 131 | new team; 132 | if(!NoTeams) 133 | { 134 | if(!(team = GetClientTeam(client)) || team == TeamSpec) 135 | return Plugin_Continue; 136 | team -= TeamFist; 137 | } 138 | 139 | bActive[client] = true; 140 | SetEntProp(client, Prop_Data, "m_takedamage", 0, 1); 141 | CreateTimer(fTime, Timer_RemoveProtection, GetClientUserId(client), TIMER_FLAG_NO_MAPCHANGE); 142 | set_rendering(client, RENDERFX_DISTORT, iColor[team][0], iColor[team][1], iColor[team][2], RENDER_TRANSADD, iColor[team][3]); 143 | if(bNotify) PrintToChat(client, "\x04[SpawnProtection] \x01Spawn protection \x04enabled \x01for \x04%i \x01seconds", RoundFloat(fTime)); 144 | } 145 | return Plugin_Continue; 146 | } 147 | 148 | public Action:Timer_RemoveProtection(Handle:timer, any:client) 149 | { 150 | if((client = GetClientOfUserId(client)) && bActive[client]) RemoveProtection(client); 151 | } 152 | 153 | public Action:OnPlayerRunCmd(client, &buttons, &impulse, Float:velocity[3], Float:angles[3], &weapon, &weaponSub, &command, &tick, &randomSeed, mouseDir[2]) 154 | { 155 | if(bActive[client] && IsPlayerAlive(client) && buttons & IN_ATTACK) RemoveProtection(client); 156 | return Plugin_Continue; 157 | } 158 | 159 | RemoveProtection(client) 160 | { 161 | bActive[client] = false; 162 | SetEntProp(client, Prop_Data, "m_takedamage", 2, 1); 163 | set_rendering(client); 164 | if(bNotify) PrintToChat(client, "\x04[SpawnProtection] \x01Spawn protection is now \x04disabled"); 165 | } 166 | 167 | stock set_rendering(client, RenderFx:fx=RENDERFX_NONE, r=255, g=255, b=255, RenderMode:render=RENDER_NORMAL, amount=255) 168 | { 169 | if(RenderOffs == -1) return; 170 | 171 | SetEntProp(client, Prop_Send, "m_nRenderFX", fx, 1); 172 | SetEntProp(client, Prop_Send, "m_nRenderMode", render, 1); 173 | SetEntData(client, RenderOffs, r, 1, true); 174 | SetEntData(client, RenderOffs + 1, g, 1, true); 175 | SetEntData(client, RenderOffs + 2, b, 1, true); 176 | SetEntData(client, RenderOffs + 3, amount, 1, true); 177 | } -------------------------------------------------------------------------------- /SM/scripting/afk_check.sp: -------------------------------------------------------------------------------- 1 | #pragma semicolon 1 2 | #pragma newdecls required 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | static const char PL_NAME[] = "AFK check", 9 | PL_VER[] = "1.0.1"; 10 | 11 | static const int check[] = {10, 20, 30}; // бездействие, сек. (предупреждение, в наблюдатели, кик) 12 | 13 | bool bLate, 14 | bCS, 15 | bEnabled, 16 | bAFK[MAXPLAYERS+1], 17 | bNew[MAXPLAYERS+1], 18 | bAdmin[MAXPLAYERS+1]; 19 | int iTeams, 20 | iLastGood[MAXPLAYERS+1]; 21 | 22 | public Plugin myinfo = 23 | { 24 | name = PL_NAME, 25 | author = "Grey83", 26 | description = "Check the player is AFK or not", 27 | version = PL_VER, 28 | url = "http://steamcommunity.com/groups/grey83ds" 29 | } 30 | 31 | public APLRes AskPluginLoad2(Handle myself, bool late, char[] error, int err_max) 32 | { 33 | bLate = late; 34 | return APLRes_Success; 35 | } 36 | 37 | public void OnPluginStart() 38 | { 39 | CreateConVar("sm_afk_check", PL_VER, PL_NAME, FCVAR_NOTIFY|FCVAR_DONTRECORD); 40 | 41 | EngineVersion engine = GetEngineVersion(); 42 | if(!(bCS = engine == Engine_CSGO || engine == Engine_CSS)) iTeams = GetTeamCount(); 43 | 44 | HookEvent("round_start", Event_Start, EventHookMode_PostNoCopy); 45 | HookEvent("round_end", Event_End, EventHookMode_PostNoCopy); 46 | HookEvent("player_spawn", Event_Spawn); 47 | 48 | if(bLate) 49 | { 50 | bLate = false; 51 | bEnabled = true; 52 | for(int i = 1; i <= MaxClients; i++) if(IsClientInGame(i)) 53 | { 54 | OnClientPostAdminCheck(i); 55 | bNew[i] = false; 56 | } 57 | } 58 | } 59 | 60 | public void Event_Start(Event event, const char[] name, bool dontBroadcast) 61 | { 62 | bEnabled = true; 63 | for(int i = 1, time = GetTime(); i <= MaxClients; i++) if(IsClientInGame(i)) 64 | { 65 | iLastGood[i] = time; 66 | bNew[i] = false; 67 | } 68 | } 69 | 70 | public void Event_End(Event event, const char[] name, bool dontBroadcast) 71 | { 72 | bEnabled = false; 73 | } 74 | 75 | public void Event_Spawn(Event event, const char[] name, bool dontBroadcast) 76 | { 77 | bNew[GetClientOfUserId(event.GetInt("userid"))] = false; 78 | } 79 | 80 | public void OnClientPostAdminCheck(int client) 81 | { 82 | if(0 < client <= MaxClients && !IsFakeClient(client)) 83 | { 84 | bAdmin[client] = CheckCommandAccess(client, "sm_admin", ADMFLAG_GENERIC); 85 | bNew[client] = true; 86 | } 87 | } 88 | 89 | public Action OnPlayerRunCmd(int client, int &buttons) 90 | { 91 | if(!bEnabled || bNew[client] || bAdmin[client] || IsFakeClient(client) || IsClientReplay(client) || IsClientSourceTV(client)) 92 | return Plugin_Continue; 93 | 94 | static int old_buttons[MAXPLAYERS+1], time; 95 | time = GetTime(); 96 | if(!(bAFK[client] = buttons == old_buttons[client])) iLastGood[client] = time; 97 | old_buttons[client] = buttons; 98 | 99 | if(time > iLastGood[client] + check[2]) 100 | KickClient(client, "AFK больше %i секунд. Goodnight, sweet prince", check[2]); 101 | else if(time > iLastGood[client] + check[1]) 102 | { 103 | PrintCenterText(client, "За пребывание AFK через %i секунд\nВы будете кикнуты с сервера!", check[2] - check[1]); 104 | if(bCS) CS_SwitchTeam(client, CS_TEAM_SPECTATOR); 105 | else if(iTeams > 3) ChangeClientTeam(client, CS_TEAM_SPECTATOR); 106 | else ForcePlayerSuicide(client); 107 | } 108 | else if(time > iLastGood[client] + check[0]) 109 | PrintCenterText(client, "За пребывание AFK через %i секунд\nВы будете перемещены в наблюдатели!", check[1] - check[0]); 110 | 111 | return Plugin_Continue; 112 | } 113 | 114 | public void OnClientDisconnect_Post(int client) 115 | { 116 | bNew[client] = true; 117 | } 118 | -------------------------------------------------------------------------------- /SM/scripting/auto_reload_plugins 1.3.0_23.08.2022.sp: -------------------------------------------------------------------------------- 1 | #pragma semicolon 1 2 | 3 | StringMap smPlugins; 4 | 5 | public Plugin myinfo = 6 | { 7 | name = "АвтоПерезапуск плагинов", 8 | version = "1.3.0_23.08.2022 (rewritten by Grey83)", 9 | author = "Rustgame (VK: Rustgamesteam)", 10 | description = "Автоматический перезапуск плагинов, если вы изменили их." 11 | } 12 | 13 | public void OnPluginStart() 14 | { 15 | smPlugins = new StringMap(); 16 | } 17 | 18 | public void OnMapStart() 19 | { 20 | CreateTimer(10.0, Timer_CheckPlugins, TIMER_REPEAT|TIMER_FLAG_NO_MAPCHANGE); 21 | } 22 | 23 | public Action Timer_CheckPlugins(Handle timer) 24 | { 25 | char dir[512], plugin[256], path[128], stime[64]; 26 | int val, time; 27 | BuildPath(Path_SM, dir, sizeof(dir), "plugins/autorestart"); 28 | DirectoryListing files = OpenDirectory(dir); 29 | while(files.GetNext(plugin, sizeof(plugin))) 30 | { 31 | if((val = strlen(plugin) - 4) > 0 && !strcmp(plugin[val], ".smx", true)) 32 | { 33 | FormatEx(path, sizeof(path), "%s/%s", dir, plugin); 34 | time = GetFileTime(path, FileTime_LastChange); 35 | if(!smPlugins.GetValue(plugin, val)) 36 | { 37 | smPlugins.SetValue(plugin, GetFileTime(path, FileTime_LastChange)); 38 | PrintToServer("> Плагин '%s' добавлен.", plugin); 39 | } 40 | else if(val != time) 41 | { 42 | FormatTime(stime, sizeof(stime), "%D - %T", time); 43 | PrintToServer("\n> Плагин %s перезапущен!\n| Размер файла: %i bytes\n| Дата изменения: %s\n", plugin, FileSize(path), stime); 44 | smPlugins.SetValue(plugin, time); 45 | ServerCommand("sm plugins reload \"autorestart/%s\"", plugin); 46 | } 47 | } 48 | } 49 | 50 | return Plugin_Continue; 51 | } -------------------------------------------------------------------------------- /SM/scripting/bomb_mark fastdl texture.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Grey83/SourceMod-plugins/dfa77f1fb3842f03010d6c7512f21d50f49e65e2/SM/scripting/bomb_mark fastdl texture.zip -------------------------------------------------------------------------------- /SM/scripting/bomb_mark server texture.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Grey83/SourceMod-plugins/dfa77f1fb3842f03010d6c7512f21d50f49e65e2/SM/scripting/bomb_mark server texture.zip -------------------------------------------------------------------------------- /SM/scripting/bomb_mark.sp: -------------------------------------------------------------------------------- 1 | #pragma semicolon 1 2 | #pragma newdecls required 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #tryinclude 10 | 11 | static const char 12 | MARK[] = "materials/sprites/bomb_mark.vmt"; 13 | static const float 14 | SIZE = 0.3; // размер меток 15 | 16 | bool 17 | bShow[MAXPLAYERS+1]; 18 | int 19 | iMarkRef = -1; 20 | 21 | public Plugin myinfo = 22 | { 23 | name = "Bomb mark", 24 | version = "1.0.1_22.01.2023", 25 | description = "Creates a mark on the bomb that only the terrorist team can see.", 26 | author = "Grey83", 27 | url = "https://steamcommunity.com/groups/grey83ds" 28 | } 29 | 30 | public void OnMapStart() 31 | { 32 | iMarkRef = -1; 33 | if(!ManageHooks()) return; 34 | 35 | char vtf[sizeof(MARK)]; 36 | vtf = MARK; 37 | int pos = strlen(MARK) - 2; 38 | vtf[pos] = 't', vtf[pos+1] = 'f'; 39 | AddFileToDownloadsTable(vtf); 40 | AddFileToDownloadsTable(MARK); 41 | PrecacheModel(MARK, true); 42 | } 43 | 44 | stock bool ManageHooks() 45 | { 46 | static bool hooked; 47 | if(!GameRules_GetProp("m_bMapHasBombTarget") == !hooked) 48 | return hooked; 49 | 50 | if((hooked ^= true)) 51 | { 52 | HookEvent("bomb_defused", Event_Bomb, EventHookMode_PostNoCopy); 53 | HookEvent("bomb_exploded", Event_Bomb, EventHookMode_PostNoCopy); 54 | HookEvent("player_spawn", Event_Player); 55 | HookEvent("player_death", Event_Player); 56 | } 57 | else 58 | { 59 | UnhookEvent("bomb_defused", Event_Bomb, EventHookMode_PostNoCopy); 60 | UnhookEvent("bomb_exploded", Event_Bomb, EventHookMode_PostNoCopy); 61 | UnhookEvent("player_spawn", Event_Player); 62 | UnhookEvent("player_death", Event_Player); 63 | } 64 | return hooked; 65 | } 66 | 67 | public void Event_Bomb(Event event, const char[] name, bool dontBroadcast) 68 | { 69 | RemoveMark(); 70 | } 71 | 72 | public void Event_Player(Event event, const char[] name, bool dontBroadcast) 73 | { 74 | static int client; 75 | if((client = GetClientOfUserId(event.GetInt("userid"))) && !IsFakeClient(client)) 76 | bShow[client] = GetClientTeam(client) == 2 && name[7] == 's'; 77 | } 78 | 79 | public void OnClientConnected(int client) 80 | { 81 | bShow[client] = false; 82 | } 83 | 84 | public void OnEntityCreated(int ent, const char[] cls) 85 | { 86 | if(ent > MaxClients && (!strcmp(cls, "weapon_c4", false) || !strcmp(cls, "planted_c4", false))) 87 | RequestFrame(cls[0] == 'p' ? Frame_Planted : Frame_Weapon, EntIndexToEntRef(ent)); 88 | } 89 | 90 | public void Frame_Weapon(int bomb) 91 | { 92 | MarkSpawn(bomb, 0x7f); 93 | } 94 | 95 | public void Frame_Planted(int bomb) 96 | { 97 | MarkSpawn(bomb, 0x1f); 98 | } 99 | 100 | stock void MarkSpawn(int bomb, const int green) 101 | { 102 | if((bomb = EntRefToEntIndex(bomb)) == INVALID_ENT_REFERENCE) 103 | return; 104 | 105 | RemoveMark(); 106 | 107 | int mark; 108 | if((mark = CreateEntityByName("env_sprite")) == -1) 109 | return; 110 | 111 | iMarkRef = EntIndexToEntRef(mark); 112 | 113 | float pos[3]; 114 | GetEntPropVector(bomb, Prop_Data, "m_vecAbsOrigin", pos); 115 | pos[2] += 4; 116 | DispatchKeyValueVector(mark, "origin", pos); 117 | DispatchKeyValue(mark, "model", MARK); 118 | DispatchKeyValue(mark, "classname", "bomb_mark"); 119 | DispatchKeyValue(mark, "spawnflags", "1"); 120 | DispatchKeyValueFloat(mark, "scale", SIZE); 121 | SetVariantInt(0xff); 122 | AcceptEntityInput(mark, "ColorRedValue"); 123 | SetVariantInt(green); 124 | AcceptEntityInput(mark, "ColorGreenValue"); 125 | SetVariantInt(0x1f); 126 | AcceptEntityInput(mark, "ColorBlueValue"); 127 | DispatchKeyValue(mark, "rendermode", "5"); 128 | SetVariantString("!activator"); 129 | AcceptEntityInput(mark, "SetParent", bomb, mark, 0); 130 | if(DispatchSpawn(mark)) SDKHook(mark, SDKHook_SetTransmit, Hook_Transmit); 131 | } 132 | 133 | public Action Hook_Transmit(int mark, int client) 134 | { 135 | return bShow[client] ? Plugin_Continue : Plugin_Handled; 136 | } 137 | 138 | stock void RemoveMark() 139 | { 140 | if(iMarkRef != -1 && (iMarkRef = EntRefToEntIndex(iMarkRef)) != -1) 141 | #if SOURCEMOD_V_MAJOR == 1 && SOURCEMOD_V_MINOR < 10 142 | AcceptEntityInput(iMarkRef, "Kill"); 143 | #else 144 | RemoveEntity(iMarkRef); 145 | #endif 146 | iMarkRef = -1; 147 | } 148 | 149 | public void OnPluginEnd() 150 | { 151 | RemoveMark(); 152 | } 153 | -------------------------------------------------------------------------------- /SM/scripting/button_test.sp: -------------------------------------------------------------------------------- 1 | #pragma semicolon 1 2 | #pragma newdecls required 3 | 4 | #include 5 | 6 | static const int iColor[]= {0, 255, 0}; // R, G, B 7 | static const float fPosX = -1.0, // position (from left to right) 8 | fPosY = -1.0; // (from top to bottom) 9 | 10 | bool bIsAdmin[MAXPLAYERS+1]; 11 | 12 | public void OnPluginStart() 13 | { 14 | RegAdminCmd("sm_bt", Cmd_ButtonInfoToggle, ADMFLAG_ROOT); 15 | } 16 | 17 | public Action Cmd_ButtonInfoToggle(int client, int args) 18 | { 19 | if(!client) return Plugin_Handled; 20 | 21 | bIsAdmin[client] = !bIsAdmin[client]; 22 | PrintToChat(client, "\x03Button info is \x04%sabled\x03!", bIsAdmin[client] ? "en" : "dis"); 23 | 24 | return Plugin_Handled; 25 | } 26 | 27 | public Action OnPlayerRunCmd(int client, int &buttons, int &impulse, float vel[3], float angles[3], int &weapon, int &subtype, int &cmdnum, int &tickcount, int &seed, int mouse[2]) 28 | { 29 | static int i, prev_buttons[MAXPLAYERS+1]; 30 | if(bIsAdmin[client] && buttons != prev_buttons[client] && IsPlayerAlive(client)) 31 | { 32 | static char buffer[256]; 33 | buffer[0] = i = 0; 34 | for(; i < 32; i++) if(buttons & (1< %s", i++, GetFlagName(flags), name, desc); 103 | } 104 | } 105 | PrintToConsole(client, SEPARATOR); 106 | 107 | if(i == 1) PrintToConsole(client, "Results not found"); 108 | 109 | return Plugin_Handled; 110 | } 111 | 112 | stock char GetFlagName(int flags) 113 | { 114 | static char buffer[PLATFORM_MAX_PATH]; 115 | if(!flags) 116 | { 117 | buffer = " "; 118 | return buffer; 119 | } 120 | 121 | buffer[0] = 0; 122 | 123 | int i; 124 | for(; i < AdminFlags_TOTAL; i++) if(flags & (1< 5 | #include 6 | 7 | static const char 8 | PL_NAME[] = "Country Nick", 9 | PL_VER[] = "1.2.4_21.11.2021", 10 | 11 | SEPARATOR[] = "--+-+---+-----------------+---------------+----+-------------------------------"; 12 | 13 | static const int 14 | HOOKS[] = {'[', ']'}; 15 | 16 | bool 17 | bLate, 18 | bLongTag, 19 | bMsg; 20 | 21 | public Plugin myinfo = 22 | { 23 | name = PL_NAME, 24 | version = PL_VER, 25 | description = "Add country of the player near his nick", 26 | author = "Antoine LIBERT aka AeN0 (rewrited by Grey83)", 27 | url = "https://forums.alliedmods.net/showthread.php?p=738756" 28 | } 29 | 30 | public APLRes AskPluginLoad2(Handle myself, bool late, char[] error, int err_max) 31 | { 32 | bLate = late; 33 | } 34 | 35 | public void OnPluginStart() 36 | { 37 | LoadTranslations("countrynick.phrases"); 38 | 39 | CreateConVar("countrynick_version", PL_VER, PL_NAME, FCVAR_DONTRECORD|FCVAR_NOTIFY|FCVAR_SPONLY); 40 | 41 | ConVar cvar; 42 | cvar = CreateConVar("sm_countrynick_tagsize", "3", "Size of the country tag", _, true, 2.0, true, 3.0); 43 | cvar.AddChangeHook(CVarChanged_Size); 44 | bLongTag = cvar.IntValue == 3; 45 | 46 | cvar = CreateConVar("sm_countrynick_msg", "1", "1/0 - Switch On/Off announcement connecting of a players (and error logging)", _, true, _, true, 1.0); 47 | cvar.AddChangeHook(CVarChanged_Msg); 48 | bMsg = cvar.BoolValue; 49 | 50 | RegAdminCmd("list", Cmd_List, ADMFLAG_GENERIC, "Show info about players (Admin or non-admin, UserID, IP, Country, SteamID, Nick) on the server"); 51 | 52 | HookEvent("player_changename", Event_PlayerChangename, EventHookMode_Pre); 53 | 54 | AutoExecConfig(true, "countrynick"); 55 | 56 | if(bLate) 57 | { 58 | RefreshNames(); 59 | bLate = false; 60 | } 61 | } 62 | 63 | public void CVarChanged_Size(ConVar cvar, const char[] oldValue, const char[] newValue) 64 | { 65 | if(bLongTag != (bLongTag = cvar.IntValue == 3)) RefreshNames(); 66 | } 67 | 68 | stock void RefreshNames() 69 | { 70 | char name[MAX_NAME_LENGTH]; 71 | for(int i = 1; i <= MaxClients; i++) if(IsClientInGame(i) && !IsFakeClient(i) && GetClientName(i, name, sizeof(name))) 72 | SetNewName(i, name); 73 | } 74 | 75 | public void CVarChanged_Msg(ConVar cvar, const char[] oldValue, const char[] newValue) 76 | { 77 | bMsg = cvar.BoolValue; 78 | } 79 | 80 | public Action Cmd_List(int client, int args) 81 | { 82 | PrintToConsole(client, SEPARATOR); 83 | PrintToConsole(client, " # A %-3.3s %-17.17s %-15.15s %-4.4s %s", "UID", "SteamID", "IP", "From", "Nick"); 84 | PrintToConsole(client, SEPARATOR); 85 | 86 | bool find; 87 | char IP[16], SId[18], name[29], code[4]; 88 | for(int i = 1, admin, num; i <= MaxClients; i++) if(IsClientInGame(i)) 89 | { 90 | num++; 91 | if(!IsFakeClient(i)) 92 | { 93 | admin = GetUserAdmin(i) == INVALID_ADMIN_ID ? '-' : 'A'; 94 | GetClientIP(i, IP, sizeof(IP)); 95 | find = GeoipCode3(IP, code); 96 | GetClientAuthId(i, AuthId_SteamID64, SId, sizeof(SId)); 97 | } 98 | else 99 | { 100 | admin = ' '; 101 | strcopy(IP, 16, "Bot"); 102 | find = true; 103 | code[0] = 0; 104 | SId[0] = 0; 105 | } 106 | GetClientName(i, name, sizeof(name)); 107 | PrintToConsole(client, "%2.2d %c %3.3d %-17.17s %-15.15s %-4.4s %-30.30s", num, admin, GetClientUserId(i), SId, IP, find ? code : "-?-", name[GetPos(name)]); 108 | } 109 | 110 | PrintToConsole(client, SEPARATOR); 111 | } 112 | 113 | public void OnClientPutInServer(int client) 114 | { 115 | if(!client || IsFakeClient(client)) 116 | return; 117 | 118 | char name[MAX_NAME_LENGTH]; 119 | if(GetClientName(client, name, sizeof(name))) SetNewName(client, name); 120 | 121 | if(!bMsg) 122 | return; 123 | 124 | char ip[16], country[45]; 125 | GetClientIP(client, ip, sizeof(ip)); 126 | if(GeoipCountry(ip, country, sizeof(country))) 127 | PrintToChatAll("\x03%t", "Announcer country found", client, country); 128 | else 129 | { 130 | PrintToChatAll("\x03%t", "Announcer country not found", client); 131 | LogError("[Country Nick] Warning : %L uses %s that is not listed in GEOIP database", client, ip); 132 | } 133 | } 134 | 135 | public Action Event_PlayerChangename(Event event, const char[] name, bool dontBroadcast) 136 | { 137 | int client = GetClientOfUserId(GetEventInt(event, "userid")); 138 | if(!client || IsFakeClient(client)) 139 | return Plugin_Continue; 140 | 141 | char new_name[MAX_NAME_LENGTH]; 142 | GetEventString(event, "newname", new_name, sizeof(new_name)); 143 | SetNewName(client, new_name); 144 | 145 | return Plugin_Changed; // avoid printing the change to the chat 146 | } 147 | 148 | stock void SetNewName(int client, char[] name) 149 | { 150 | static char ip[16]; 151 | if(!GetClientIP(client, ip, sizeof(ip))) 152 | return; 153 | 154 | static char code[4]; 155 | if(!(bLongTag ? GeoipCode3(ip, code) : GeoipCode2(ip, code))) 156 | FormatEx(code, sizeof(code), "-%s-", bLongTag ? "?" : ""); 157 | 158 | Format(name, MAX_NAME_LENGTH, "%c%s%c%s", HOOKS[0], code, HOOKS[1], name[GetPos(name)]); 159 | SetClientInfo(client, "name", name); 160 | } 161 | 162 | stock int GetPos(char[] name) 163 | { 164 | static int pos; 165 | pos = 0; 166 | if(name[0] == HOOKS[0]) 167 | { 168 | if(name[3] == HOOKS[1]) 169 | pos = 4; 170 | else if(name[4] == HOOKS[1]) 171 | pos = 5; 172 | } 173 | 174 | return pos; 175 | } -------------------------------------------------------------------------------- /SM/scripting/csgo_allies_icon 1.0.1.sp: -------------------------------------------------------------------------------- 1 | #pragma semicolon 1 2 | #pragma newdecls required 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #if SOURCEMOD_V_MINOR >= 9 9 | #include 10 | #endif 11 | 12 | static const char PATH[] = "materials/vgui/hud/icon_arrow_down.vmt"; // путь файлу vmt, отвечающему за иконку 13 | 14 | bool 15 | bLate; 16 | int 17 | iTeam[MAXPLAYERS+1], 18 | iIcon[MAXPLAYERS+1]; 19 | 20 | public Plugin myinfo = 21 | { 22 | name = "[CSGO] Allies icon", 23 | version = "1.0.1", 24 | description = "Shows the icon above the allies", 25 | author = "Grey83", 26 | url = "https://steamcommunity.com/groups/grey83ds" 27 | }; 28 | 29 | public APLRes AskPluginLoad2(Handle myself, bool late, char[] error, int err_max) 30 | { 31 | bLate = late; 32 | return APLRes_Success; 33 | } 34 | 35 | public void OnPluginStart() 36 | { 37 | HookEvent("player_team", Event_Team); 38 | HookEvent("player_death", Event_State); 39 | HookEvent("player_spawn", Event_State); 40 | 41 | if(bLate) for(int i = 1; i <= MaxClients; i++) if(IsClientInGame(i) && (iTeam[i] = GetClientTeam(i))) CreateIcon(i); 42 | } 43 | 44 | public void OnMapStart() 45 | { 46 | PrecacheModel(PATH, true); 47 | // раскомментировать код ниже, если текстура отсутствует в ресурсах игры 48 | /* AddFileToDownloadsTable(PATH); 49 | 50 | char buffer[64]; 51 | Handle vtf = CreateKeyValues("UnlitGeneric"); 52 | FileToKeyValues(vtf, PATH); 53 | KvGetString(vtf, "$basetexture", buffer, sizeof(buffer), buffer); 54 | CloseHandle(vtf); 55 | Format(buffer, sizeof(buffer), "materials/%s.vtf", buffer); 56 | AddFileToDownloadsTable(buffer);*/ 57 | } 58 | 59 | public void Event_Team(Event event, const char[] name, bool dontBroadcast) 60 | { 61 | int client = GetClientOfUserId(event.GetInt("userid")); 62 | if(!client) return; 63 | 64 | iTeam[client] = event.GetInt("team"); 65 | CreateIcon(client); 66 | } 67 | 68 | public void Event_State(Event event, const char[] name, bool dontBroadcast) 69 | { 70 | int client = GetClientOfUserId(event.GetInt("userid")); 71 | if(client) CreateIcon(client); 72 | } 73 | 74 | public void OnClientDisconnect(int client) 75 | { 76 | ClearIcon(client); 77 | iTeam[client] = 0; 78 | } 79 | 80 | stock bool CreateIcon(int client) 81 | { 82 | ClearIcon(client); 83 | if(iTeam[client] < 2 || !IsPlayerAlive(client)) return false; 84 | 85 | static int ent; 86 | if(!(ent = CreateEntityByName("env_sprite"))) return false; 87 | 88 | DispatchKeyValue(ent, "model", PATH); 89 | DispatchKeyValue(ent, "classname", "allies_icon"); 90 | DispatchKeyValue(ent, "spawnflags", "1"); 91 | DispatchKeyValue(ent, "scale", "0.08"); 92 | // https://developer.valvesoftware.com/wiki/Render_Modes 93 | // Normal (0), Color (1), Texture (2), Glow (3), Solid (4), Additive (5), Additive Fractional Frame (7), Alpha Add (8), World Space Glow (9), Don't Render (10) 94 | DispatchKeyValue(ent, "rendermode", "5"); 95 | DispatchKeyValue(ent, "rendercolor", "255 255 255"); 96 | if(!DispatchSpawn(ent)) return false; 97 | 98 | iIcon[client] = EntIndexToEntRef(ent); 99 | 100 | static float pos[3], max[3]; 101 | GetClientAbsOrigin(client, pos); 102 | GetEntPropVector(client, Prop_Data, "m_vecMaxs", max); 103 | pos[2] += max[2] + 10.0; 104 | TeleportEntity(ent, pos, NULL_VECTOR, NULL_VECTOR); 105 | 106 | static char buffer[16]; 107 | Format(buffer, sizeof(buffer), "client%d", client); 108 | DispatchKeyValue(client, "targetname", buffer); 109 | SetVariantString(buffer); 110 | AcceptEntityInput(ent, "SetParent", ent, ent, 0); 111 | SDKHook(ent, SDKHook_SetTransmit, iTeam[client] == 2 ? ShouldHideMark_T : ShouldHideMark_Ct); 112 | return true; 113 | } 114 | 115 | stock void ClearIcon(int client) 116 | { 117 | if(!iIcon[client])) return; 118 | 119 | if(EntRefToEntIndex(iIcon[client]) != INVALID_ENT_REFERENCE) AcceptEntityInput(iIcon[client], "Kill"); 120 | iIcon[client] = 0; 121 | } 122 | 123 | public Action ShouldHideMark_T(int ent, int client) 124 | { 125 | return iTeam[client] == 2 ? Plugin_Continue : Plugin_Handled; 126 | } 127 | 128 | public Action ShouldHideMark_Ct(int ent, int client) 129 | { 130 | return iTeam[client] == 3 ? Plugin_Continue : Plugin_Handled; 131 | } -------------------------------------------------------------------------------- /SM/scripting/fix_angles.sp: -------------------------------------------------------------------------------- 1 | #pragma semicolon 1 2 | #pragma newdecls required 3 | 4 | #include 5 | 6 | static const char PLUGIN_NAME[] = "Fix angles"; 7 | static const char PLUGIN_VERSION[] = "1.0.3"; 8 | 9 | bool bEnable, 10 | bMsg; 11 | float fTime; 12 | 13 | Handle AngTimer; 14 | 15 | public Plugin myinfo = 16 | { 17 | name = PLUGIN_NAME, 18 | author = "Grey83", 19 | description = "Fixes error 'Bad SetLocalAngles' in server console", 20 | version = PLUGIN_VERSION, 21 | url = "https://forums.alliedmods.net/showthread.php?t=285750" 22 | } 23 | 24 | public void OnPluginStart() 25 | { 26 | CreateConVar("sm_fix_angles_version", PLUGIN_VERSION, PLUGIN_NAME, FCVAR_SPONLY|FCVAR_REPLICATED|FCVAR_NOTIFY|FCVAR_DONTRECORD); 27 | 28 | ConVar CVar; 29 | (CVar = CreateConVar("sm_fix_angles_enable","1", "Enables/disables the plugin", _, true, 0.0, true, 1.0)).AddChangeHook(CVarChanged_Enable); 30 | bEnable = CVar.BoolValue; 31 | (CVar = CreateConVar("sm_fix_angles_msg", "0", "Enables/disables messages in the server console", _, true, 0.0, true, 1.0)).AddChangeHook(CVarChanged_Msg); 32 | bMsg = CVar.BoolValue; 33 | (CVar = CreateConVar("sm_fix_angles_time", "30", "The time between inspections of entities angles", _, true, 10.0, true, 120.0)).AddChangeHook(CVarChanged_Time); 34 | fTime = CVar.FloatValue; 35 | 36 | AutoExecConfig(true, "fix_angles"); 37 | } 38 | 39 | public void CVarChanged_Enable(ConVar CVar, const char[] oldValue, const char[] newValue) 40 | { 41 | bEnable = CVar.BoolValue; 42 | if(bEnable && AngTimer == null) AngTimer = CreateTimer(fTime, CheckAngles, _, TIMER_REPEAT|TIMER_FLAG_NO_MAPCHANGE); 43 | else if(!bEnable && AngTimer != null) KillAngTimer(); 44 | } 45 | 46 | public void CVarChanged_Msg(ConVar CVar, const char[] oldValue, const char[] newValue) 47 | { 48 | bMsg = CVar.BoolValue; 49 | } 50 | 51 | public void CVarChanged_Time(ConVar CVar, const char[] oldValue, const char[] newValue) 52 | { 53 | fTime = CVar.FloatValue; 54 | if(AngTimer != null) 55 | { 56 | KillAngTimer(); 57 | AngTimer = CreateTimer(fTime, CheckAngles, _, TIMER_REPEAT|TIMER_FLAG_NO_MAPCHANGE); 58 | } 59 | } 60 | 61 | void KillAngTimer() 62 | { 63 | KillTimer(AngTimer); 64 | AngTimer = null; 65 | } 66 | 67 | public void OnMapStart() 68 | { 69 | if(bEnable) AngTimer = CreateTimer(fTime, CheckAngles, _, TIMER_REPEAT|TIMER_FLAG_NO_MAPCHANGE); 70 | } 71 | 72 | public Action CheckAngles(Handle timer) 73 | { 74 | if(!bEnable) return Plugin_Stop; 75 | 76 | static int MaxEnt; 77 | MaxEnt = GetMaxEntities(); 78 | for(int i = MaxClients + 1; i <= MaxEnt; i++) 79 | { 80 | if(IsValidEntity(i) && HasEntProp(i, Prop_Send, "m_angRotation")) 81 | { 82 | static bool wrongAngle; 83 | static float ang[3], old_ang[3]; 84 | GetEntPropVector(i, Prop_Send, "m_angRotation", ang); 85 | old_ang = ang; 86 | wrongAngle = false; 87 | for(int j; j < 3; j++) 88 | { 89 | if(FloatAbs(ang[j]) > 360) 90 | { 91 | wrongAngle = true; 92 | ang[j] = FloatFraction(ang[j]) + RoundToZero(ang[j]) % 360; 93 | } 94 | } 95 | if(wrongAngle) 96 | { 97 | SetEntPropVector(i, Prop_Send, "m_angRotation", ang); 98 | if(!bMsg) continue; 99 | 100 | static char class[64], name[64]; 101 | class[0] = name[0] = 0; 102 | GetEdictClassname(i, class, 64); 103 | GetEntPropString(i, Prop_Data, "m_iName", name, 64); 104 | PrintToServer("> Wrong angles of the prop '%s' (#%d, '%s'):\n %.2f, %.2f, %.2f (fixed to: %.2f, %.2f, %.2f)", class, i, name, old_ang[0], old_ang[1], old_ang[2], ang[0], ang[1], ang[2]); 105 | } 106 | } 107 | } 108 | return Plugin_Continue; 109 | } 110 | -------------------------------------------------------------------------------- /SM/scripting/hex2rgba.sp: -------------------------------------------------------------------------------- 1 | #pragma semicolon 1 2 | #pragma newdecls required 3 | 4 | public void OnPluginStart() 5 | { 6 | RegConsoleCmd("sm_hex", Cmd_Hex); 7 | } 8 | 9 | public Action Cmd_Hex(int client, int args) 10 | { 11 | if(!args) 12 | return Plugin_Handled; 13 | 14 | static char buffer[16]; 15 | GetCmdArg(1, buffer, sizeof(buffer)); 16 | int clr, num; 17 | if((num = IsColorValid(buffer))) 18 | { 19 | if(num < 5) 20 | { 21 | // PrintToServer("\nOld color value: '%s'", buffer); 22 | FormatEx(buffer, sizeof(buffer), ConvertColor(buffer, num)); 23 | // PrintToServer("New color value: '%s'\n", buffer); 24 | } 25 | StringToIntEx(buffer, clr, 16); 26 | if(num%4) ReplyToCommand(client, "HEX color '%s' (0x%x) is '%d %d %d'!", buffer, clr, (clr & 0xFF0000) >> 16, (clr & 0xFF00) >> 8, clr & 0xFF); 27 | else ReplyToCommand(client, "HEX color '%s' is (0x%x) '%d %d %d %d'!", buffer, clr, (clr & 0xFF000000) >>> 24, (clr & 0xFF0000) >> 16, (clr & 0xFF00) >> 8, clr & 0xFF); 28 | } 29 | else ReplyToCommand(client, "HEX color '%s' is invalid!", buffer); 30 | 31 | return Plugin_Handled; 32 | } 33 | 34 | stock int IsColorValid(const char[] buffer) 35 | { 36 | int i; 37 | while(buffer[i]) 38 | { 39 | if(!(buffer[i] >= '0' && buffer[i] <= '9') 40 | && !(buffer[i] >= 'A' && buffer[i] <= 'F') 41 | && !(buffer[i] >= 'a' && buffer[i] <= 'f')) 42 | return 0; 43 | i++; 44 | } 45 | return i == 3 || i == 4 || i == 6 || i == 8 ? i : 0; 46 | } 47 | 48 | stock char ConvertColor(const char[] hex, int num) 49 | { 50 | static char result[12]; 51 | int i, j; 52 | for(; i <= num; i++) result[j++] = result[j++] = hex[i]; 53 | result[j] = 0; 54 | return result; 55 | } 56 | -------------------------------------------------------------------------------- /SM/scripting/hitbox_marker.phrases.txt: -------------------------------------------------------------------------------- 1 | // Теги для отображения информации: 2 | // голова - "{Head}", шея - "{Neck}", гр.клетка - "{Chest}", правая рука - "{RArm}", левая рука - "{LArm}", 3 | // живот - "{Belly}", правая нога - "{RLeg}", левая нога - "{LLeg}", перевод строки - "{NL}". 4 | // Отступ (для HUD) - " ", конец закрашивания (только для текста "NoCount_*") - "{/Clr}" 5 | 6 | "Phrases" 7 | { 8 | // Меню 9 | "Menu_Title" 10 | { 11 | "en" "Hitbox marker" 12 | "ru" "Hitbox marker" 13 | } 14 | "Menu_Show" 15 | { 16 | "en" "Show" 17 | "ru" "Отображать" 18 | } 19 | "Menu_InfoFull" 20 | { 21 | "en" "Full info" 22 | "ru" "Всю информацию" 23 | } 24 | "Menu_InfoHits" 25 | { 26 | "en" "Hits only" 27 | "ru" "Только попадения" 28 | } 29 | "Menu_Disable" 30 | { 31 | "en" "Disable" 32 | "ru" "Отключить" 33 | } 34 | "Menu_Place" 35 | { 36 | "en" "Show in the" 37 | "ru" "Отображать в" 38 | } 39 | "Menu_HUD" 40 | { 41 | "en" "HUD" 42 | "ru" "HUD" 43 | } 44 | "Menu_HintHits" 45 | { 46 | "en" "Hint (hits)" 47 | "ru" "" 48 | } 49 | "Menu_HintNoHits" 50 | { 51 | "en" "Hint (no hits)" 52 | "ru" "" 53 | } 54 | "Menu_After" 55 | { 56 | "en" "Show after" 57 | "ru" "Отображать после" 58 | } 59 | "Menu_Death" 60 | { 61 | "en" "Death" 62 | "ru" "Смерти" 63 | } 64 | "Menu_Hit" 65 | { 66 | "en" "Hit" 67 | "ru" "Попадения" 68 | } 69 | 70 | // Вывод в HUD 71 | "HUD_HitsInfo" 72 | { 73 | "en" " ({Head}){NL} {Neck}{NL} =-{RArm}--[{Chest}]--{LArm}-={NL} [{Belly}]{NL} {RLeg} {LLeg}{NL} _/ \\_" 74 | "ru" " ({Head}){NL} {Neck}{NL} =-{RArm}--[{Chest}]--{LArm}-={NL} [{Belly}]{NL} {RLeg} {LLeg}{NL} _/ \\_" 75 | } 76 | "HUD_FullInfo" 77 | { 78 | "en" " ({Head}){NL} {Neck}{NL} =-{RArm}--[{Chest}]--{LArm}-={NL} [{Belly}]{NL} {RLeg} {LLeg}{NL} _/ \\_{NL} TOTAL HITS: {Hits}{NL} HEALTH: {Health}{NL} ARMOR: {Armor}" 79 | "ru" " ({Head}){NL} {Neck}{NL} =-{RArm}--[{Chest}]--{LArm}-={NL} [{Belly}]{NL} {RLeg} {LLeg}{NL} _/ \\_{NL} Попадений: {Hits}{NL} Здоровье: {Health}{NL} Броня: {Armor}" 80 | } 81 | 82 | // Вывод в Hint с количеством попаданий в хитбокс 83 | "Hint_HitsInfo" 84 | { 85 | "en" "({Head}){NL}{Neck}{NL}=-{RArm}--[{Chest}]--{LArm}-={NL}[{Belly}]{NL}{RLeg} {LLeg}{NL}_/ \\_" 86 | "ru" "({Head}){NL}{Neck}{NL}=-{RArm}--[{Chest}]--{LArm}-={NL}[{Belly}]{NL}{RLeg} {LLeg}{NL}_/ \\_" 87 | } 88 | "Hint_FullInfo" 89 | { 90 | "en" "({Head}){NL}{Neck}{NL}=-{RArm}--[{Chest}]--{LArm}-={NL}[{Belly}]{NL}{RLeg} {LLeg}{NL}_/ \\_{NL}TOTAL HITS: {Hits}{NL}HEALTH: {Health}{NL}ARMOR: {Armor}" 91 | "ru" "({Head}){NL}{Neck}{NL}=-{RArm}--[{Chest}]--{LArm}-={NL}[{Belly}]{NL}{RLeg} {LLeg}{NL}_/ \\_{NL}Попадений: {Hits}{NL}Здоровье: {Health}{NL}Броня: {Armor}" 92 | } 93 | 94 | // Вывод в Hint без количества попаданий в хитбокс 95 | "NoCount_HitsInfo" 96 | { 97 | "en" "{Head}( ){/Clr}{NL}{Neck}|{/Clr}{NL}{RArm}=---{/Clr}{Chest}[]{/Clr}{LArm}---={/Clr}{NL}{Belly}[]{/Clr}{NL}{RLeg}/{/Clr} {LLeg}\\{/Clr}{NL}{RLeg}_/{/Clr} {LLeg}\\_{/Clr}" 98 | "ru" "{Head}( ){/Clr}{NL}{Neck}|{/Clr}{NL}{RArm}=---{/Clr}{Chest}[]{/Clr}{LArm}---={/Clr}{NL}{Belly}[]{/Clr}{NL}{RLeg}/{/Clr} {LLeg}\\{/Clr}{NL}{RLeg}_/{/Clr} {LLeg}\\_{/Clr}" 99 | } 100 | "NoCount_FullInfo" 101 | { 102 | "en" "{Head}( ){/Clr}{NL}{Neck}|{/Clr}{NL}{RArm}=---{/Clr}{Chest}[]{/Clr}{LArm}---={/Clr}{NL}{Belly}[]{/Clr}{NL}{RLeg}/{/Clr} {LLeg}\\{/Clr}{NL}{RLeg}_/{/Clr} {LLeg}\\_{/Clr}{NL}TOTAL HITS: {Hits}{NL}HEALTH: {Health}{NL}ARMOR: {Armor}" 103 | "ru" "{Head}( ){/Clr}{NL}{Neck}|{/Clr}{NL}{RArm}----{/Clr}{Chest}[]{/Clr}{LArm}----{/Clr}{NL}{Belly}[]{/Clr}{NL}{RLeg}/{/Clr} {LLeg}\\{/Clr}{NL}{RLeg}_/{/Clr} {LLeg}\\_{/Clr}{NL}Попадений: {Hits}{NL}Здоровье: {Health}{NL}Броня: {Armor}" 104 | } 105 | } -------------------------------------------------------------------------------- /SM/scripting/hud_dmg_info.sp: -------------------------------------------------------------------------------- 1 | #pragma semicolon 1 2 | #pragma newdecls required 3 | 4 | #include 5 | 6 | static const char 7 | PL_NAME[] = "Damage Info", 8 | PL_VER[] = "1.1.2", 9 | 10 | CHAT_TITLE[]= " \n\x04Top%i \x01by damage:", 11 | CHAT_ROW[] = "\x01%2i) \x04%N\x01: \x04%i\x01dmg with \x04%i\x01kills"; 12 | 13 | static const int MAX_TOP = 10; 14 | 15 | enum 16 | {// 1+16 = On+Center+Spec 17 | enable, // 0 (1) 18 | ff, // 1 (2) 19 | self, // 2 (4) 20 | spec, // 3 (8) 21 | bots // 4 (16) 22 | }; 23 | 24 | Handle 25 | hCookies, 26 | hHUD; 27 | bool 28 | bShow[MAXPLAYERS+1]; 29 | int 30 | iMode, 31 | iColor, 32 | iDmg[MAXPLAYERS+1], 33 | iKills[MAXPLAYERS+1]; 34 | float 35 | fPosX, 36 | fPosY, 37 | fTime; 38 | 39 | public Plugin myinfo = 40 | { 41 | name = PL_NAME, 42 | author = "Grey83", 43 | version = PL_VER, 44 | url = "https://steamcommunity.com/groups/grey83ds" 45 | } 46 | 47 | public void OnPluginStart() 48 | { 49 | CreateConVar("sm_dmg_info_version", PL_VER, PL_NAME, FCVAR_SPONLY|FCVAR_NOTIFY|FCVAR_DONTRECORD); 50 | 51 | ConVar cvar; 52 | cvar = CreateConVar("sm_dmg_info_mode", "25", "Set Show damage functionality: 1 - enable plugin, 2 - show FF damage, 4 - show self damage, 8 - show info to the spectators, 16 - show bots in TOP", _, true, _, true, 31.0); 53 | cvar.AddChangeHook(CVarChanged_Mode); 54 | CVarChanged_Mode(cvar, NULL_STRING, NULL_STRING); 55 | 56 | cvar = CreateConVar("sm_dmg_info_color", "F80", "HUD info color. Set by HEX (RGB, RGBA, RRGGBB or RRGGBBAA, values 0 - F or 00 - FF, resp.). Wrong color code = white", FCVAR_PRINTABLEONLY); 57 | cvar.AddChangeHook(CVarChanged_Color); 58 | CVarChanged_Color(cvar, NULL_STRING, NULL_STRING); 59 | 60 | cvar = CreateConVar("sm_dmg_info_x", "-1.0", "HUD info position X (0.0 - 1.0 left to right or -1 for center)", _, true, -2.0, true, 1.0); 61 | cvar.AddChangeHook(CVarChanged_PosX); 62 | fPosX = cvar.FloatValue; 63 | 64 | cvar = CreateConVar("sm_dmg_info_y", "0.45", "HUD info position Y (0.0 - 1.0 top to bottom or -1 for center)", _, true, -2.0, true, 1.0); 65 | cvar.AddChangeHook(CVarChanged_PosY); 66 | fPosY = cvar.FloatValue; 67 | 68 | cvar = CreateConVar("sm_dmg_info_time", "1.0", "Information display time", _, true, _, true, 5.0); 69 | cvar.AddChangeHook(CVarChanged_Time); 70 | fTime = cvar.FloatValue; 71 | 72 | HookEvent("round_start", Event_RoundStart, EventHookMode_PostNoCopy); 73 | HookEvent("player_hurt", Event_PlayerHurt); 74 | HookEvent("player_death", Event_PlayerDeath); 75 | HookEvent("round_end", Event_RoundEnd, EventHookMode_PostNoCopy); 76 | 77 | hHUD = CreateHudSynchronizer(); 78 | 79 | RegConsoleCmd("sm_top", Cmd_ShowDamage, "Shows top damagers"); 80 | 81 | AutoExecConfig(true, "dmg_info"); 82 | 83 | hCookies = RegClientCookie(PL_NAME, "Show damage caused", CookieAccess_Private); 84 | SetCookieMenuItem(Cookie_DamageInfo, 0, PL_NAME); 85 | } 86 | 87 | public void CVarChanged_Mode(ConVar cvar, const char[] oldValue, const char[] newValue) 88 | { 89 | iMode = cvar.IntValue; 90 | } 91 | 92 | public void CVarChanged_Color(ConVar CVar, const char[] oldValue, const char[] newValue) 93 | { 94 | char clr[16]; 95 | CVar.GetString(clr, sizeof(clr)); 96 | clr[9] = 0; // чтобы проверялось максимум 9 первых символов 97 | 98 | int i; 99 | while(clr[i]) 100 | { 101 | if(!(clr[i] >= '0' && clr[i] <= '9') && !(clr[i] >= 'A' && clr[i] <= 'F') && !(clr[i] >= 'a' && clr[i] <= 'f')) 102 | { // не HEX-число 103 | iColor = -1; 104 | LogError("\nHEX color '%s' isn't valid!\nHUD color is 0x%x (%d %d %d %d)!\n", clr, iColor, (iColor & 0xFF000000) >>> 24, (iColor & 0xFF0000) >> 16, (iColor & 0xFF00) >> 8, iColor & 0xFF); 105 | return; 106 | } 107 | i++; 108 | } 109 | 110 | clr[8] = 0; 111 | if(i == 6) // добавляем прозрачность 112 | { 113 | clr[6] = clr[7] = 'F'; 114 | i = 8; 115 | } 116 | else if(i == 3 || i == 4) // короткая форма => полная форма 117 | { 118 | if(i == 3) clr[6] = clr[7] = 'F'; // добавляем прозрачность 119 | else clr[6] = clr[7] = clr[3]; 120 | clr[4] = clr[5] = clr[2]; 121 | clr[2] = clr[3] = clr[1]; 122 | clr[1] = clr[0]; 123 | i = 8; 124 | } 125 | 126 | if(i != 8) iColor = -1; // невалидный цвет => 0xFFFFFFFF 127 | else StringToIntEx(clr, iColor, 16); 128 | 129 | PrintToServer("\nHUD color is 0x%x (%d %d %d %d)!\n", iColor, (iColor & 0xFF000000) >>> 24, (iColor & 0xFF0000) >> 16, (iColor & 0xFF00) >> 8, iColor & 0xFF); 130 | } 131 | 132 | public void CVarChanged_PosX(ConVar CVar, const char[] oldValue, const char[] newValue) 133 | { 134 | fPosX = CVar.FloatValue; 135 | } 136 | 137 | public void CVarChanged_PosY(ConVar CVar, const char[] oldValue, const char[] newValue) 138 | { 139 | fPosY = CVar.FloatValue; 140 | } 141 | 142 | public void CVarChanged_Time(ConVar CVar, const char[] oldValue, const char[] newValue) 143 | { 144 | fTime = CVar.FloatValue; 145 | } 146 | 147 | public void Cookie_DamageInfo(int client, CookieMenuAction action, any info, char[] buffer, int maxlen) 148 | { 149 | if(action == CookieMenuAction_DisplayOption) 150 | Format(buffer, maxlen, "%s: %s", PL_NAME, bShow[client] ? "☑" : "☐"); 151 | else if(action == CookieMenuAction_SelectOption) 152 | { 153 | bShow[client] = !bShow[client]; 154 | SetClientCookie(client, hCookies, bShow[client] ? "1" : "0"); 155 | ShowCookieMenu(client); 156 | } 157 | } 158 | 159 | public void OnClientCookiesCached(int client) 160 | { 161 | char buffer[4]; 162 | GetClientCookie(client, hCookies, buffer, sizeof(buffer)); 163 | bShow[client] = buffer[0] != '0'; 164 | } 165 | 166 | public void OnClientPostAdminCheck(int client) 167 | { 168 | iDmg[client] = iKills[client] = 0; 169 | } 170 | 171 | public void Event_RoundStart(Event event, const char[] name, bool dontBroadcast) 172 | { 173 | for(int i = 1; i <= MaxClients; i++) iDmg[i] = iKills[i] = 0; 174 | } 175 | 176 | public void Event_PlayerHurt(Event event, const char[] name, bool dontBroadcast) 177 | { 178 | static int victim, attacker, damage; 179 | if(!(victim = GetClientOfUserId(event.GetInt("userid"))) 180 | || !(attacker = GetClientOfUserId(event.GetInt("attacker"))) 181 | || (damage = event.GetInt("dmg_health")) < 1) 182 | return; 183 | 184 | if(victim == attacker) 185 | { 186 | if(!(iMode & (1 << self))) 187 | return; 188 | } 189 | else if(!(iMode & (1 << ff)) && GetClientTeam(victim) == GetClientTeam(attacker)) 190 | return; 191 | 192 | if(victim != attacker) iDmg[attacker] += damage; 193 | 194 | if(!(iMode & (1 << enable))) 195 | return; 196 | 197 | SetHudTextParams(fPosX, fPosY, fTime + 0.1, (iColor & 0xFF000000) >>> 24, (iColor & 0xFF0000) >> 16, (iColor & 0xFF00) >> 8, iColor & 0xFF, _, 0.0, _, 0.1); 198 | if(!IsFakeClient(attacker) && bShow[attacker]) ShowSyncHudText(attacker, hHUD, "- %i HP", damage); 199 | 200 | if(iMode & (1 << spec)) for(int i = 1, mode; i <= MaxClients; i++) 201 | if(i != attacker && IsClientInGame(i) && IsClientObserver(i) && bShow[i] 202 | && GetEntPropEnt(i, Prop_Send, "m_hObserverTarget") == attacker 203 | && ((mode = GetEntProp(i, Prop_Send, "m_iObserverMode")) == 4 || mode == 5)) 204 | ShowSyncHudText(i, hHUD, "- %i HP", damage); 205 | } 206 | 207 | public void Event_PlayerDeath(Event event, const char[] name, bool dontBroadcast) 208 | { 209 | static int victim, attacker; 210 | if(!(victim = GetClientOfUserId(event.GetInt("userid"))) 211 | || !(attacker = GetClientOfUserId(event.GetInt("attacker")))) 212 | return; 213 | 214 | iKills[attacker]++; 215 | if(IsFakeClient(victim)) return; 216 | 217 | static char weapon[32]; 218 | GetEventString(event, "weapon", weapon, sizeof(weapon)); 219 | PrintToChat(victim, "\x01\x04%N \x01killed You with \x04%s", attacker, weapon); 220 | } 221 | 222 | public void Event_RoundEnd(Event event, const char[] name, bool dontBroadcast) 223 | { 224 | if(iMode & (1 << enable)) ShowDamage(); 225 | } 226 | 227 | public Action Cmd_ShowDamage(int client, int args) 228 | { 229 | if(!(iMode & (1 << enable))) 230 | return Plugin_Handled; 231 | 232 | int num; 233 | if(args) 234 | { 235 | char buffer[4]; 236 | GetCmdArg(1, buffer, sizeof(buffer)); 237 | num = StringToInt(buffer); 238 | } 239 | ShowDamage(client, num); 240 | 241 | return Plugin_Handled; 242 | } 243 | 244 | stock void ShowDamage(int client = 0, int places = 0) 245 | { 246 | if(places < 1 || places > MAX_TOP) places = MAX_TOP; 247 | static int i, j, num, max, lst, place, dmg, clients[MAXPLAYERS+1], list[MAXPLAYERS+1][2]; 248 | max = lst = place = 0; 249 | 250 | for(i = 1, num = 0; i <= MaxClients; i++) if(IsClientInGame(i) && (iMode & (1 << bots) || !IsFakeClient(i)) && iDmg[i]) 251 | { 252 | clients[num++] = i; 253 | if(max < iDmg[i]) 254 | { 255 | lst = i; 256 | max = iDmg[i]; 257 | } 258 | } 259 | if(!num) 260 | { 261 | if(client) PrintToChat(client, "\x01No players in \x04TOP%i \x01yet", places); 262 | return; 263 | } 264 | 265 | // заполняем массив 266 | for(i = 0; i < num && place < places;) 267 | { 268 | // переходим к следующему месту 269 | place++; 270 | // находим первого игрока на месте place по дамагу 271 | if(place > 1) for(j = 0, dmg = 0; j < num; j++) if(iDmg[clients[j]] < max && iDmg[clients[j]] > dmg) 272 | { 273 | lst = clients[j]; 274 | dmg = iDmg[clients[j]]; 275 | } 276 | list[i][0] = place; // место 277 | list[i][1] = lst; // id 278 | max = iDmg[lst]; // запоминаем максимальный урон на этом месте 279 | i++; 280 | 281 | // находим всех игроков на этом же месте 282 | for(j = 0; j < num && i < num; j++) if(clients[j] != lst && iDmg[clients[j]] == max) 283 | { 284 | list[i][0] = place; 285 | list[i][1] = clients[j]; 286 | i++; 287 | } 288 | } 289 | 290 | num = i; 291 | if(!client) 292 | { 293 | PrintToChatAll(CHAT_TITLE, places); 294 | for(i = 0; i < num; i++) PrintToChatAll(CHAT_ROW, list[i][0], list[i][1], iDmg[list[i][1]], iKills[list[i][1]]); 295 | PrintToChatAll(" \n"); 296 | return; 297 | } 298 | PrintToChat(client, CHAT_TITLE, places); 299 | for(i = 0; i < num; i++) PrintToChat(client, CHAT_ROW, list[i][0], list[i][1], iDmg[list[i][1]], iKills[list[i][1]]); 300 | PrintToChat(client, " \n"); 301 | } -------------------------------------------------------------------------------- /SM/scripting/include/UTF-8-string.inc: -------------------------------------------------------------------------------- 1 | /************************************************************************** 2 | * UTF-8 string * 3 | * Автор: Феникс(komashchenko) * 4 | * Version: 1.2 * 5 | * http://zizt.ru/ http://hlmod.ru/ * 6 | * 03.05.2015 - V1.0: Релиз * 7 | * 02.06.2015 - V1.1: Исправлены баги * 8 | * 09.01.2018 - V1.2: Переведено на новый синтаксис, добавлена функция * 9 | * (by Grey83) UTF8CharInverse(), немного оптимизировано * 10 | **************************************************************************/ 11 | 12 | 13 | //#include // нет никакой необходимости добавлять этот инклюд ещё раз 14 | 15 | enum 16 | { 17 | CType_strncmp, 18 | CType_strcmp, 19 | CType_StrContains 20 | }; 21 | 22 | /** 23 | * Returns whether two strings are equal. 24 | * 25 | * @param str1 First string (left). 26 | * @param str2 Second string (right). 27 | * @param caseSensitive If true (default), comparison is case sensitive. 28 | * If false, comparison is case insensitive. 29 | * @return True if equal, false otherwise. 30 | */ 31 | stock bool UTF8StrEqual(const char[] str1, const char[] str2, bool caseSensitive=true) 32 | { 33 | return !UTF8strcmp(str1, str2, caseSensitive); 34 | } 35 | 36 | /** 37 | * Compares two strings parts lexographically. 38 | * 39 | * @param str1 First string (left). 40 | * @param str2 Second string (right). 41 | * @param num Number of characters to compare. 42 | * @param caseSensitive If true (default), comparison is case sensitive. 43 | * If false, comparison is case insensitive. 44 | * @return -1 if str1 < str2 45 | * 0 if str1 == str2 46 | * 1 if str1 > str2 47 | */ 48 | stock int UTF8strncmp(const char[] str1, const char[] str2, int num, bool caseSensitive=true) 49 | { 50 | return caseSensitive ? strncmp(str1, str2, num, true) : CheckStrings(str1, str2, CT_strncmp, num); 51 | } 52 | 53 | /** 54 | * Compares two strings lexographically. 55 | * 56 | * @param str1 First string (left). 57 | * @param str2 Second string (right). 58 | * @param caseSensitive If true (default), comparison is case sensitive. 59 | * If false, comparison is case insensitive. 60 | * @return -1 if str1 < str2 61 | * 0 if str1 == str2 62 | * 1 if str1 > str2 63 | */ 64 | stock int UTF8strcmp(const char[] str1, const char[] str2, bool caseSensitive=true) 65 | { 66 | return caseSensitive ? strcmp(str1, str2, true) : CheckStrings(str1, str2, CT_strcmp); 67 | } 68 | 69 | /** 70 | * Tests whether a string is found inside another string. 71 | * 72 | * @param str String to search in. 73 | * @param substr Substring to find inside the original string. 74 | * @param caseSensitive If true (default), search is case sensitive. 75 | * If false, search is case insensitive. 76 | * @return -1 on failure (no match found). Any other value 77 | * indicates a position in the string where the match starts. 78 | */ 79 | stock int UTF8StrContains(const char[] str, const char[] substr, bool caseSensitive=true) 80 | { 81 | return caseSensitive ? StrContains(str, substr, true) : CheckStrings(str, substr); 82 | } 83 | 84 | stock int CheckStrings(const char[] str1, const char[] str2, int type = CType_StrContains, int num = 0) 85 | { 86 | int a = strlen(str1)+190, b = strlen(str2)+190; 87 | char[] aa = new char[a]; 88 | char[] bb = new char[b]; 89 | strcopy(aa, a, str1); 90 | strcopy(bb, b, str2); 91 | UTF8CharToLower(aa); 92 | UTF8CharToLower(bb); 93 | switch(type) 94 | { 95 | case CType_strncmp: return strncmp(aa, bb, num, true); 96 | case CType_strcmp: return strcmp(aa, bb, true); 97 | } 98 | return StrContains(aa, bb, true); 99 | } 100 | 101 | /** 102 | * Делает из нижнего регистра верхний. 103 | * 104 | * @param string строка для конвертации. 105 | * @return количество символов которые были переведены в верхний регистр 106 | */ 107 | stock int UTF8CharToUpper(char[] string) 108 | { 109 | int I, Byte, K; 110 | while(string[I]) 111 | { 112 | Byte = string[I]; 113 | if(Byte >= 128) 114 | { 115 | if(Byte >= 240) 116 | { 117 | if(strlen(string[I]) < 4) break; 118 | else I += 4; 119 | } 120 | else if(Byte >= 224) 121 | { 122 | if(strlen(string[I]) < 3) break; 123 | else I += 3; 124 | } 125 | else if(Byte >= 192) 126 | { 127 | if(strlen(string[I]) < 2) break; 128 | Byte = (Byte % 32) * 64; 129 | Byte += (string[I+1] % 64); 130 | if(1072 <= Byte <= 1103 || Byte == 1105 || 1110 <= Byte <= 1111 || Byte == 1169) 131 | { 132 | if(1105 <= Byte <= 1111) Byte = Byte-80; 133 | else if(Byte != 1169) Byte = Byte-32; 134 | else Byte--; 135 | string[I] = 192 + Byte / 64; 136 | string[I+1] = 128 + (Byte % 64); 137 | K++; 138 | } 139 | I += 2; 140 | } 141 | else break; 142 | } 143 | else 144 | { 145 | if(97 <= Byte <= 122) 146 | { 147 | string[I] = Byte-32; 148 | K++; 149 | } 150 | I++; 151 | } 152 | } 153 | return K; 154 | } 155 | 156 | /** 157 | * Делает из верхнего регистра нижний. 158 | * 159 | * @param string строка для конвертации. 160 | * @return количество символов которые были переведены в нижний регистр 161 | */ 162 | stock int UTF8CharToLower(char[] string) 163 | { 164 | int I, Byte, K; 165 | while(string[I]) 166 | { 167 | Byte = string[I]; 168 | if(Byte >= 128) 169 | { 170 | if(Byte >= 240) 171 | { 172 | if(strlen(string[I]) < 4) break; 173 | else I += 4; 174 | } 175 | else if(Byte >= 224) 176 | { 177 | if(strlen(string[I]) < 3) break; 178 | else I += 3; 179 | } 180 | else if(Byte >= 192) 181 | { 182 | if(strlen(string[I]) < 2) break; 183 | Byte = (Byte % 32) * 64; 184 | Byte += (string[I+1] % 64); 185 | if(1040 <= Byte <= 1071 || Byte == 1025 || 1030 <= Byte <= 1031 || Byte == 1168) 186 | { 187 | if(1025 <= Byte <= 1031) Byte = Byte+80; 188 | else if(Byte != 1168) Byte = Byte+32; 189 | else Byte++; 190 | string[I] = 192 + Byte / 64; 191 | string[I+1] = 128 + (Byte % 64); 192 | K++; 193 | } 194 | I += 2; 195 | } 196 | else break; 197 | } 198 | else 199 | { 200 | if(65 <= Byte <= 90) 201 | { 202 | string[I] = Byte+32; 203 | K++; 204 | } 205 | I++; 206 | } 207 | } 208 | return K; 209 | } 210 | 211 | /** 212 | * Инвертирует регистр. 213 | * 214 | * @param string строка для конвертации. 215 | * @return количество символов, регистр которых был инвертирован 216 | */ 217 | stock int UTF8CharInverse(char[] string) 218 | { 219 | int I, Byte, K; 220 | while(string[I]) 221 | { 222 | Byte = string[I]; 223 | if(Byte >= 128) 224 | { 225 | if(Byte >= 240) 226 | { 227 | if(strlen(string[I]) < 4) break; 228 | else I += 4; 229 | } 230 | else if(Byte >= 224) 231 | { 232 | if(strlen(string[I]) < 3) break; 233 | else I += 3; 234 | } 235 | else if(Byte >= 192) 236 | { 237 | if(strlen(string[I]) < 2) break; 238 | Byte = (Byte % 32) * 64; 239 | Byte += (string[I+1] % 64); 240 | if(Byte == 1025 || 1030 <= Byte <= 1031 || 1040 <= Byte <= 1071 || Byte == 1168) 241 | { 242 | if(1025 <= Byte <= 1031) Byte = Byte+80; 243 | else if(Byte != 1168) Byte = Byte+32; 244 | else Byte++; 245 | string[I] = 192 + Byte / 64; 246 | string[I+1] = 128 + (Byte % 64); 247 | K++; 248 | } 249 | else if(1072 <= Byte <= 1103 || Byte == 1105 || 1110 <= Byte <= 1111 || Byte == 1169) 250 | { 251 | if(1105 <= Byte <= 1111) Byte = Byte-80; 252 | else if(Byte != 1169) Byte = Byte-32; 253 | else Byte--; 254 | string[I] = 192 + Byte / 64; 255 | string[I+1] = 128 + (Byte % 64); 256 | K++; 257 | } 258 | I += 2; 259 | } 260 | else break; 261 | } 262 | else 263 | { 264 | if(65 <= Byte <= 90) 265 | { 266 | string[I] = Byte+32; 267 | K++; 268 | } 269 | else if(97 <= Byte <= 122) 270 | { 271 | string[I] = Byte-32; 272 | K++; 273 | } 274 | I++; 275 | } 276 | } 277 | return K; 278 | } -------------------------------------------------------------------------------- /SM/scripting/ins_battleye_disabler 1.0.0.sp: -------------------------------------------------------------------------------- 1 | #pragma semicolon 1 2 | #pragma newdecls required 3 | 4 | public Plugin myinfo = 5 | { 6 | name = "[INS] BattlEye disabler", 7 | version = "1.0.0", 8 | description = "Disables BattlEye at server when convar \"sv_playlist\" not equal to \"custom\"", 9 | author = "Grey83", 10 | url = "https://steamcommunity.com/groups/grey83ds" 11 | } 12 | 13 | public APLRes AskPluginLoad2(Handle myself, bool late, char[] error, int err_max) 14 | { 15 | if(GetEngineVersion() == Engine_Insurgency) return APLRes_Success; 16 | 17 | FormatEx(error, err_max, "Plugin only for Insurgency (2014)"); 18 | return APLRes_Failure; 19 | } 20 | 21 | public void OnPluginStart() 22 | { 23 | 24 | ConVar cvar = FindConVar("sv_battleye"); 25 | if(!cvar) 26 | { 27 | PrintToServer("\n > Unable to find convar 'sv_battleye'\n"); 28 | return; 29 | } 30 | 31 | SetConVarBounds(cvar, ConVarBound_Lower, true, 0.0); 32 | SetConVarBounds(cvar, ConVarBound_Upper, true, 0.0); 33 | SetConVarInt(cvar, 0, true); 34 | PrintToServer("\n > BattlEye successfully disabled\n"); 35 | } -------------------------------------------------------------------------------- /SM/scripting/lang 1.1.0_07.09.2023.sp: -------------------------------------------------------------------------------- 1 | #pragma semicolon 1 2 | #pragma newdecls required 3 | 4 | #include 5 | 6 | static const char 7 | PL_NAME[] = "Language", 8 | PL_VER[] = "1.1.0_07.09.2023"; 9 | 10 | ArrayList 11 | hName, 12 | hCode; 13 | Menu 14 | hMenu; 15 | Handle 16 | hCookies; 17 | bool 18 | bLate; 19 | int 20 | iLang[MAXPLAYERS+1] = {-1, ...}; 21 | char 22 | sCode[4], 23 | sBuffer[64]; 24 | 25 | public Plugin myinfo = 26 | { 27 | name = PL_NAME, 28 | author = "Grey83", 29 | description = "Set & Save client language", 30 | version = PL_VER, 31 | url = "https://forums.alliedmods.net/showthread.php?p=2444363" 32 | } 33 | 34 | public APLRes AskPluginLoad2(Handle myself, bool late, char[] error, int err_max) 35 | { 36 | bLate = late; 37 | return APLRes_Success; 38 | } 39 | 40 | public void OnPluginStart() 41 | { 42 | CreateConVar("sm_lang_version", PL_VER, PL_NAME, FCVAR_DONTRECORD|FCVAR_NOTIFY|FCVAR_SPONLY); 43 | 44 | LoadTranslations("common.phrases"); 45 | 46 | RegConsoleCmd("sm_lang", Cmd_Lang, "Show/set own client language setting\n'sm_lang' - shows current client language\n'sm_lang ' - set own client language"); 47 | 48 | hCookies = RegClientCookie("client_lang", "Saved client language", CookieAccess_Private); 49 | SetCookieMenuItem(LangMenu, 0, "Language"); 50 | 51 | int num = GetLanguageCount(); 52 | if(num > 0) 53 | return; 54 | 55 | hCode = new ArrayList(ByteCountToCells(4)); 56 | hName = new ArrayList(ByteCountToCells(64)); 57 | 58 | hMenu = CreateMenu(LangMenuHandler, MenuAction_Display|MenuAction_DrawItem|MenuAction_DisplayItem); 59 | hMenu.SetTitle("Language:"); 60 | for(int i; i < num; i++) 61 | { 62 | GetLanguageInfo(i, sCode, sizeof(sCode), sBuffer, sizeof(sBuffer)); 63 | 64 | hCode.PushString(sCode); 65 | hName.PushString(sBuffer); 66 | 67 | hMenu.AddItem("", sBuffer); 68 | } 69 | if(num < 10) hMenu.Pagination = 0; 70 | hMenu.ExitBackButton = true; 71 | 72 | if(!bLate) 73 | return; 74 | 75 | for(int i = 1; i <= MaxClients; i++) if(IsClientInGame(i) && AreClientCookiesCached(i)) OnClientPostAdminCheck(i); 76 | } 77 | 78 | public void OnClientPostAdminCheck(int client) 79 | { 80 | if(iLang[client] == -1) OnClientCookiesCached(client); 81 | } 82 | 83 | public void OnClientCookiesCached(int client) 84 | { 85 | if(IsFakeClient(client)) 86 | return; 87 | 88 | GetClientCookie(client, hCookies, sCode, sizeof(sCode)); 89 | iLang[client] = GetLanguageByCode(sCode); 90 | if(iLang[client] != -1) SetClientLanguage(client, iLang[client]); 91 | } 92 | 93 | public void OnClientDisconnect(int client) 94 | { 95 | iLang[client] = -1; 96 | } 97 | 98 | public Action Cmd_Lang(int client, int args) 99 | { 100 | if(client) 101 | { 102 | if(!args) 103 | { 104 | int lang = iLang[client] == -1 ? GetClientLanguage(client) : iLang[client]; 105 | if(lang != -1 && lang < GetLanguageCount()) 106 | { 107 | hCode.GetString(lang, sCode, sizeof(sCode)); 108 | hName.GetString(lang, sBuffer, sizeof(sBuffer)); 109 | PrintToChat(client, "Your client language is '%s' ('%s', %d)", sBuffer, sCode, lang); 110 | } 111 | else PrintToChat(client, "Your client language is unknown!"); 112 | } 113 | else 114 | { 115 | GetCmdArg(1, sCode, sizeof(sCode)); 116 | ChangeLanuage(client, GetLanguageByCode(sCode)); 117 | } 118 | } 119 | else ReplyToCommand(client, "[SM] %t", "Command is in-game only"); 120 | 121 | return Plugin_Handled; 122 | } 123 | 124 | public void LangMenu(int client, CookieMenuAction action, any info, char[] buffer, int maxlen) 125 | { 126 | if(action == CookieMenuAction_DisplayOption) 127 | { 128 | int lang = GetClientLanguage(client); 129 | if(lang != -1) 130 | { 131 | hName.GetString(lang, sBuffer, sizeof(sBuffer)); 132 | FormatEx(buffer, maxlen, "Language: %s", sBuffer); 133 | } 134 | else FormatEx(buffer, maxlen, "Language"); 135 | } 136 | else if(action == CookieMenuAction_SelectOption) if(hMenu) hMenu.Display(client, MENU_TIME_FOREVER); 137 | } 138 | 139 | public int LangMenuHandler(Menu menu, MenuAction action, int client, int item) 140 | { 141 | switch(action) 142 | { 143 | case MenuAction_Display: 144 | { 145 | if(iLang[client] != -1) 146 | { 147 | hName.GetString(iLang[client], sBuffer, sizeof(sBuffer)); 148 | menu.SetTitle("Language:\n %s", sBuffer); 149 | } 150 | else menu.SetTitle("Language:"); 151 | } 152 | case MenuAction_DisplayItem: 153 | { 154 | hCode.GetString(item, sCode, sizeof(sCode)); 155 | hName.GetString(item, sBuffer, sizeof(sBuffer)); 156 | Format(sBuffer, sizeof(sBuffer), "%s%s", sBuffer, item == iLang[client] ? " ☑" : ""); 157 | return RedrawMenuItem(sBuffer); 158 | } 159 | case MenuAction_DrawItem: return item == iLang[client] ? ITEMDRAW_DEFAULT : ITEMDRAW_DISABLED; 160 | case MenuAction_Select: 161 | { 162 | int pos = GetMenuSelectionPosition(); 163 | ChangeLanuage(client, item); 164 | hMenu.DisplayAt(client, pos, MENU_TIME_FOREVER); 165 | } 166 | case MenuAction_Cancel: if(item == MenuCancel_ExitBack) ShowCookieMenu(client); 167 | } 168 | 169 | return 0; 170 | } 171 | 172 | void ChangeLanuage(int client, const int lang) 173 | { 174 | if(lang != -1) 175 | { 176 | hCode.GetString(lang, sCode, sizeof(sCode)); 177 | hName.GetString(lang, sBuffer, sizeof(sBuffer)); 178 | 179 | iLang[client] = lang; 180 | SetClientLanguage(client, lang); 181 | SetClientCookie(client, hCookies, sCode); 182 | PrintToChat(client, "Your client language changed to '%s' (%s, %d)", sBuffer, sCode, lang); 183 | } 184 | else PrintToChat(client, "Wrong lanuage code!"); 185 | } -------------------------------------------------------------------------------- /SM/scripting/nmrih_codes.sp: -------------------------------------------------------------------------------- 1 | #pragma semicolon 1 2 | 3 | #include 4 | //#include 5 | #include 6 | 7 | #define PLUGIN_VERSION "1.0.0" 8 | #define PLUGIN_NAME "[NMRiH] Codes" 9 | 10 | public Plugin:myinfo = 11 | { 12 | name = PLUGIN_NAME, 13 | author = "Grey83", 14 | description = "", 15 | version = PLUGIN_VERSION, 16 | url = "" 17 | }; 18 | 19 | public OnPluginStart() 20 | { 21 | LoadTranslations("nmrih_keycodes.phrases"); 22 | RegAdminCmd("sm_codes", Cmd_GetCodes, ADMFLAG_SLAY, "Show KeyPad codes in the chat"); 23 | HookEvent("keycode_enter", Event_KeycodeEnter, EventHookMode_Pre); 24 | } 25 | 26 | public Action:Cmd_GetCodes(client, args) 27 | { 28 | new entity = -1, num; 29 | while((entity = FindEntityByClassname(entity, "trigger_keypad")) != INVALID_ENT_REFERENCE){ 30 | num++; 31 | new String:sCode[16]; 32 | GetEntPropString(entity, Prop_Data, "m_pszCode", sCode, sizeof(sCode)); 33 | if(!client) PrintToServer("The keypad #%d code is: %s", num, sCode); 34 | else PrintToChat(client, "\x03%T \x04%s", "KeyPadCode", client, num, sCode); 35 | } 36 | if (!num) 37 | { 38 | if(!client) PrintToServer("None of the keyboard was not found"); 39 | else PrintToChat(client, "\x03%T", "NoKeypads", client); 40 | } 41 | return Plugin_Handled; 42 | } 43 | 44 | public Event_KeycodeEnter(Handle:event, const String:name[], bool:dontBroadcast) 45 | { 46 | new String:sCode[16],String:sKeyPadCode[16]; 47 | new client = GetEventInt(event, "player"); 48 | new KeyPad = GetEventInt(event, "keypad_idx"); 49 | GetEventString(event, "code", sCode, sizeof(sCode)); 50 | new iCode = StringToInt(sCode); 51 | GetEntPropString(KeyPad, Prop_Data, "m_pszCode", sKeyPadCode, sizeof(sKeyPadCode), 0); 52 | new iKeyPadCode = StringToInt(sKeyPadCode); 53 | 54 | if(iCode == iKeyPadCode && iKeyPadCode != 0) PrintToChatAll("\x04%N \x03%T \x01%s", client, "CorrectCode", client, sKeyPadCode); 55 | else PrintToChatAll("\x04%N \x03%T \x01%s", client, "IncorrectCode", client, sCode); 56 | } -------------------------------------------------------------------------------- /SM/scripting/nmrih_flashlight 1.0.3_23.02.2023.sp: -------------------------------------------------------------------------------- 1 | #pragma semicolon 1 2 | #pragma newdecls required 3 | 4 | static const int 5 | IN_FLASHLIGHT = (1 << 26); 6 | static const char 7 | PL_NAME[] = "[NMRiH] Flashlight", 8 | PL_VER[] = "1.0.3_23.02.2023"; 9 | 10 | bool 11 | bEnable; 12 | int 13 | m_fEffects; 14 | 15 | public Plugin myinfo = 16 | { 17 | name = PL_NAME, 18 | version = PL_VER, 19 | description = "Flashlight with any weapon in NMRiH", 20 | author = "Grey83", 21 | url = "https://steamcommunity.com/groups/grey83ds" 22 | } 23 | 24 | public APLRes AskPluginLoad2(Handle myself, bool late, char[] error, int err_max) 25 | { 26 | if((m_fEffects = FindSendPropInfo("CBaseEntity", "m_fEffects")) < 1) 27 | { 28 | FormatEx(error, err_max, "Can't find offset 'CBaseEntity::m_fEffects'!"); 29 | return APLRes_Failure; 30 | } 31 | 32 | return APLRes_Success; 33 | } 34 | 35 | public void OnPluginStart() 36 | { 37 | CreateConVar("nmrih_flashlight_version", PL_VER, PL_NAME, FCVAR_DONTRECORD|FCVAR_NOTIFY|FCVAR_SPONLY); 38 | 39 | ConVar cvar = CreateConVar("sm_flashlight_enabled", "1", "Enables/Disables flashlight", _, true, _, true, 1.0); 40 | cvar.AddChangeHook(CVarChanged_Enable); 41 | bEnable = cvar.BoolValue; 42 | } 43 | 44 | public void CVarChanged_Enable(ConVar cvar, const char[] oldValue, const char[] newValue) 45 | { 46 | bEnable = cvar.BoolValue; 47 | } 48 | 49 | public Action OnPlayerRunCmd(int client, int &buttons) 50 | { 51 | if(!bEnable || !IsPlayerAlive(client)) 52 | return Plugin_Continue; 53 | 54 | static bool flashlight[MAXPLAYERS+1]; 55 | if(buttons & IN_FLASHLIGHT && !(flashlight[client])) 56 | SetEntData(client, m_fEffects, GetEntData(client, m_fEffects) ^ 4, _, true); 57 | flashlight[client] = !!(buttons & IN_FLASHLIGHT); 58 | 59 | return Plugin_Continue; 60 | } -------------------------------------------------------------------------------- /SM/scripting/nmrih_hav.phrases.txt: -------------------------------------------------------------------------------- 1 | "Phrases" 2 | { 3 | "State_Healthy" 4 | { 5 | "en" "♡" 6 | } 7 | "State_Infected" 8 | { 9 | "en" "☣" 10 | } 11 | "State_Extracted" 12 | { 13 | "en" "☺" 14 | } 15 | "State_Dead" 16 | { 17 | "en" "☠" 18 | } 19 | 20 | "Hint_HP" 21 | { 22 | "#format" "{1:t},{2:d},{3:t}" 23 | "en" "{1}{2}HP{3}" 24 | } 25 | "Hint_AP" 26 | { 27 | "#format" "{1:d},{2:t}" 28 | "en" "{1}AP{3}" 29 | } 30 | "Hint_SP" 31 | { 32 | "#format" "{1:d}" 33 | "en" "{1}⁰⁄₀SP" 34 | } 35 | "Hint_EMPTY" // empty string, no changes needed 36 | { 37 | "en" "" 38 | } 39 | "Hint_Max" 40 | { 41 | "en" " (max)" 42 | } 43 | 44 | "HUD_HP" 45 | { 46 | "#format" "{1:t},{2:d}" 47 | "en" "{1}{2}" 48 | } 49 | "HUD_AP" 50 | { 51 | "#format" "{1:d}" 52 | "en" "♦{1}" 53 | } 54 | "HUD_SP" 55 | { 56 | "#format" "{1:d}" 57 | "en" "↔{1}⁰⁄₀" 58 | } 59 | } -------------------------------------------------------------------------------- /SM/scripting/nmrih_healthstation_health.sp: -------------------------------------------------------------------------------- 1 | #pragma semicolon 1 2 | 3 | #include 4 | #include 5 | 6 | new iHSHealthOffset; 7 | 8 | new g_BeamSprite = -1; 9 | new g_HaloSprite = -1; 10 | new aHealthStationLoc[10], 11 | aHealthStation[10]; 12 | new iNumHealthStations; 13 | 14 | new bool:g_bLateLoaded = false; 15 | 16 | public Plugin:myinfo = 17 | { 18 | name = "[NMRiH] HealthStation Health", 19 | author = "Grey83", 20 | description = "", 21 | version = "1.0", 22 | url = "" 23 | }; 24 | 25 | public APLRes:AskPluginLoad2(Handle:myself, bool:late, String:error[], err_max) 26 | { 27 | g_bLateLoaded = late; 28 | return APLRes_Success; 29 | } 30 | 31 | public OnPluginStart() 32 | { 33 | decl String:game[16]; 34 | GetGameFolderName(game, sizeof(game)); 35 | if(strcmp(game, "nmrih", false) != 0) 36 | { 37 | SetFailState("Unsupported game!"); 38 | } 39 | 40 | RegAdminCmd("sm_hsh", Cmd_HSHealth, ADMFLAG_SLAY); 41 | RegAdminCmd("sm_hst", Cmd_HSTele, ADMFLAG_SLAY); 42 | iHSHealthOffset = FindSendPropInfo("CNMRiH_HealthStationLocation", "_health"); 43 | 44 | HookEvent("state_change", Event_SC); 45 | 46 | if (g_bLateLoaded) FindHealthStations(); 47 | } 48 | 49 | public OnMapStart() 50 | { 51 | g_BeamSprite = PrecacheModel("materials/sprites/purplelaser1.vmt", true); 52 | g_HaloSprite = PrecacheModel("materials/sprites/laser/laser_dot_g.vmt", true); 53 | } 54 | 55 | public Event_SC(Handle:event, const String:name[], bool:dontBroadcast) 56 | { 57 | new iState = GetEventInt(event, "state"); 58 | new iGameType = GetEventInt(event, "game_type"); 59 | if (iState == 3 && iGameType == 1) FindHealthStations(); 60 | } 61 | 62 | public FindHealthStations() 63 | { 64 | new String:classname[30]; 65 | new numLoc = 0, numSt = 0; 66 | for(new i = MaxClients; i < GetMaxEntities(); i++) 67 | { 68 | if (IsValidEdict(i) && IsValidEntity(i)) 69 | { 70 | GetEdictClassname(i, classname, sizeof(classname)); 71 | if(strcmp(classname, "nmrih_health_station_location")==0) 72 | { 73 | aHealthStationLoc[numLoc] = i; 74 | numLoc++; 75 | } 76 | else if(strcmp(classname, "nmrih_health_station")==0) 77 | { 78 | aHealthStation[numSt] = i; 79 | numSt++; 80 | } 81 | } 82 | } 83 | iNumHealthStations = numLoc; 84 | } 85 | 86 | public Action:Cmd_HSHealth(client, args) 87 | { 88 | new Float:fNewValue, Float:fValue; 89 | if(args > 0) 90 | { 91 | new String:szBuffer[10]; 92 | GetCmdArg(1, szBuffer, sizeof( szBuffer ) ); 93 | fNewValue = StringToFloat(szBuffer); 94 | } 95 | for(new i = 0; i < iNumHealthStations; i++) 96 | { 97 | new color[4], Float:fStart, Float:fEnd; 98 | fValue = GetEntDataFloat(aHealthStationLoc[i], iHSHealthOffset); 99 | if(!args) PrintToChat(client, "\x01HealthStation %d health: \x04%.2f\x01HP", i, fValue); 100 | else if(args > 0) 101 | { 102 | if(fValue < fNewValue) 103 | { 104 | // color[0] = 0; 105 | color[1] = 255; 106 | // color[2] = 0; 107 | color[3] = 255; 108 | fStart = 10.0; 109 | fEnd = 400.0; 110 | } 111 | else if(fValue > fNewValue) 112 | { 113 | color[0] = 255; 114 | // color[1] = 0; 115 | // color[2] = 0; 116 | color[3] = 255; 117 | fStart = 400.0; 118 | fEnd = 10.0; 119 | } 120 | else 121 | { 122 | color[0] = 127; 123 | color[1] = 127; 124 | color[2] = 127; 125 | color[3] = 127; 126 | fStart = 200.0; 127 | fEnd = 201.0; 128 | } 129 | new Float:Pos[3]; 130 | GetEntPropVector(aHealthStationLoc[i], Prop_Send, "m_vecOrigin", Pos); 131 | SetEntDataFloat(aHealthStationLoc[i], iHSHealthOffset, fNewValue, true); 132 | TE_SetupBeamRingPoint(Pos, fStart, fEnd, g_BeamSprite, g_HaloSprite, 0, 15, 3.0, 5.0, 0.0, color, 10, 0); 133 | TE_SendToClient(client); 134 | } 135 | } 136 | return Plugin_Handled; 137 | } 138 | 139 | public Action:Cmd_HSTele(client, args) 140 | { 141 | for(new i = 0; i < iNumHealthStations; i++) 142 | { 143 | new Float:Pos[3]; 144 | GetEntPropVector(aHealthStationLoc[i], Prop_Send, "m_vecOrigin", Pos); 145 | TeleportEntity(aHealthStation[i], Pos, NULL_VECTOR, NULL_VECTOR); 146 | // SetEntPropVector(aHealthStation[i], Prop_Send, "m_vecOrigin", Pos); 147 | } 148 | return Plugin_Handled; 149 | } -------------------------------------------------------------------------------- /SM/scripting/nmrih_keycodes.phrases.txt: -------------------------------------------------------------------------------- 1 | "Phrases" 2 | { 3 | "KeyPadCode" 4 | { 5 | "#format" "{1:d}" 6 | "en" "The keypad #{1} code is:" 7 | "ru" "Код замка #{1}:" 8 | } 9 | "NoKeypads" 10 | { 11 | "en" "None of the keyboard was not found" 12 | "ru" "Кодовые замки не обнаружены" 13 | } 14 | "CorrectCode" 15 | { 16 | "en" "entered the correct code:" 17 | "ru" "ввёл правильный код:" 18 | } 19 | "IncorrectCode" 20 | { 21 | "en" "entered the wrong code:" 22 | "ru" "ввёл неправильный код:" 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /SM/scripting/nmrih_npcs_hp.sp: -------------------------------------------------------------------------------- 1 | #pragma semicolon 1 2 | #include 3 | #define PLUGIN_VERSION "1.0" 4 | #define CONSOLE_PREFIX "[NPCs HP]" 5 | 6 | new Handle:hEnabled, bool:bEnabled, 7 | Handle:hNHP, iNHP; 8 | 9 | public Plugin:myinfo = 10 | { 11 | // name = "[NMRiH] NPCs HP", 12 | name = " ", 13 | author = "Grey83", 14 | description = "", 15 | version = PLUGIN_VERSION, 16 | url = "" 17 | }; 18 | 19 | public OnPluginStart() 20 | { 21 | // CreateConVar("nmrih_npcs_hp_version", PLUGIN_VERSION, "[NMRiH] NPCs HP version", FCVAR_PLUGIN|FCVAR_SPONLY|FCVAR_NOTIFY|FCVAR_DONTRECORD); 22 | hEnabled = CreateConVar("sm_npcs_hp_enable", "0", "1/0 - On/Off plugin", FCVAR_NONE, true, 0.0, true, 1.0); 23 | hNHP = CreateConVar("sm_npcs_hp", "1", "The maximum number zombie's HP", FCVAR_NONE, true, 0.0); 24 | 25 | bEnabled = GetConVarBool(hEnabled); 26 | iNHP = GetConVarInt(hNHP); 27 | 28 | HookConVarChange(hEnabled, OnConVarChange); 29 | HookConVarChange(hNHP, OnConVarChange); 30 | 31 | PrintToServer("[NMRiH] NPCs HP v.%s has been successfully loaded!", PLUGIN_VERSION); 32 | 33 | if (bEnabled) LateLoad(); 34 | } 35 | 36 | public OnConVarChange(Handle:hCvar, const String:oldValue[], const String:newValue[]) 37 | { 38 | if (hCvar == hEnabled) 39 | { 40 | bEnabled = bool:StringToInt(newValue); 41 | if (bEnabled) LateLoad(); 42 | } 43 | else if (hCvar == hNHP) 44 | { 45 | iNHP = StringToInt(newValue); 46 | if (bEnabled) LateLoad(); 47 | } 48 | } 49 | 50 | public OnEntityCreated(entity, const String:classname[]) 51 | { 52 | if (bEnabled) 53 | { 54 | if (StrContains(classname, "npc_nmrih_", true) == 0) 55 | { 56 | CreateTimer(0.1, SetHP, entity); 57 | } 58 | } 59 | } 60 | 61 | public Action:SetHP(Handle:timer, any:entity) 62 | { 63 | if (IsValidEntity(entity)) 64 | { 65 | new iCurrentHP; 66 | iCurrentHP = GetEntProp(entity, Prop_Data, "m_iHealth"); 67 | if (iCurrentHP > iNHP) 68 | { 69 | SetEntProp(entity, Prop_Data, "m_iHealth", iNHP); 70 | } 71 | } 72 | } 73 | 74 | public Action:LateLoad() 75 | { 76 | new maxent = GetMaxEntities(), String:entity[64]; 77 | for (new i = GetMaxClients(); i < maxent; i++) 78 | { 79 | if ( IsValidEdict(i) && IsValidEntity(i) ) 80 | { 81 | GetEdictClassname(i, entity, sizeof(entity)); 82 | if (StrContains(entity, "npc_nmrih_", true) == 0) 83 | { 84 | new iCurrentHP; 85 | iCurrentHP = GetEntProp(i, Prop_Data, "m_iHealth"); 86 | if (iCurrentHP > iNHP) 87 | { 88 | SetEntProp(i, Prop_Data, "m_iHealth", iNHP); 89 | } 90 | } 91 | } 92 | } 93 | } -------------------------------------------------------------------------------- /SM/scripting/no_tspawn_camp.sp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #define SHORT_CD 1 6 | #define LONG_CD 5 7 | 8 | new bool:bLate, 9 | bool:bMsg, 10 | bool:bInGame[MAXPLAYERS+1], 11 | bool:bCanCauseDmg[MAXPLAYERS+1], 12 | bool:bInZone[MAXPLAYERS+1], 13 | iCooldown[MAXPLAYERS+1], 14 | iTimesRepeated[MAXPLAYERS+1], 15 | iFirstEntry[MAXPLAYERS+1], 16 | iTime, 17 | iTeam[MAXPLAYERS+1]; 18 | 19 | public Plugin:myinfo = 20 | { 21 | name = "No Tspawn camp", 22 | author = "Grey83", 23 | description = "Prohibition camp for terrorists in respawn zone", 24 | version = "1.0.0", 25 | url = "http://steamcommunity.com/groups/grey83ds" 26 | } 27 | 28 | public APLRes:AskPluginLoad2(Handle:myself, bool:late, String:error[], err_max) 29 | { 30 | bLate = late; 31 | } 32 | 33 | public OnPluginStart() 34 | { 35 | if(!LibraryExists("sm_zones")) SetFailState("Plugin 'Map Zones' not exists!"); 36 | else 37 | { 38 | new Handle:hMsg = FindConVar("sm_zones_show_messages"); 39 | if(hMsg != INVALID_HANDLE) bMsg = GetConVarBool(hMsg); 40 | } 41 | 42 | HookEvent("round_start", Event_RoundStart, EventHookMode_PostNoCopy); 43 | HookEvent("player_team", Event_TeamChanged); 44 | 45 | if(bLate) 46 | { 47 | ServerCommand("sm_actzone myzone"); 48 | for(new i = 1; i <= MaxClients; i++) if(IsClientInGame(i)) OnClientPostAdminCheck(i); 49 | bLate = false; 50 | } 51 | 52 | CreateTimer(1.0, Timer_Check, _, TIMER_REPEAT); 53 | } 54 | 55 | public OnClientPostAdminCheck(client) 56 | { 57 | bInGame[client] = true; 58 | ResetValues(client); 59 | SDKHook(client, SDKHook_OnTakeDamage, OnTakeDamage); 60 | } 61 | 62 | public OnClientDisconnect(client) 63 | { 64 | iTeam[client] = bInGame[client] = false; 65 | } 66 | 67 | public Event_RoundStart(Handle:event, const String:name[], bool:dontBroadcast) 68 | { 69 | LoopClients(); 70 | // Активируем нашу зону в начале раунда 71 | ServerCommand("sm_actzone myzone"); 72 | } 73 | 74 | public Event_TeamChanged(Handle:event, const String:name[], bool:dontBroadcast) 75 | { 76 | static client; 77 | if((client = GetClientOfUserId(GetEventInt(event, "userid")))) iTeam[client] = GetClientTeam(client); 78 | } 79 | 80 | stock LoopClients() 81 | { 82 | for(new i = 1; i <= MaxClients; i++) ResetValues(i); 83 | } 84 | 85 | stock ResetValues(client) 86 | { 87 | bCanCauseDmg[client] = true; 88 | iCooldown[client] = iTimesRepeated[client] = iFirstEntry[client] = bInZone[client] = false; 89 | } 90 | 91 | public Action:OnEnteredProtectedZone(zone, client, const String:prefix[]) 92 | { 93 | if(!IsPlayerValid(client, CS_TEAM_T) || !IsPlayerAlive(client)) 94 | return Plugin_Continue; 95 | 96 | // Проверяем наличие у зоны имени и его правильность 97 | decl String:name[MAX_NAME_LENGTH*2]; 98 | if(GetEntPropString(zone, Prop_Data, "m_iName", name, sizeof(name)) < 10 || !StrEqual(name[8], "myzone", false)) 99 | return Plugin_Continue; 100 | 101 | bInZone[client] = true; 102 | 103 | // если кулдаун закончился, то сохраняем новое время первого входа в зону и сбрасываем счётчик 104 | if(iCooldown[client] < iTime) 105 | { 106 | iFirstEntry[client] = iTime; 107 | iTimesRepeated[client] = 0; 108 | } 109 | // иначе, если со времени первого входа прошло более 39 секунд, то сразу запрещаем наносить урон 110 | // (для отсеивания самых хитрых, которые выбегают из зоны для сброса счётчика) 111 | else if(iTime - iFirstEntry[client] > 39) 112 | { 113 | iTimesRepeated[client] = 40; 114 | bCanCauseDmg[client] = false; 115 | if(!IsFakeClient(client) && bMsg) PrintToChat(client, "Вы не можете наносить урон противникам, пока находитесь в этой зоне!") 116 | } 117 | 118 | return Plugin_Continue; 119 | } 120 | 121 | public Action:Timer_Check(Handle:timer) 122 | { 123 | iTime = GetTime() 124 | static i; 125 | for(i = 1; i <= MaxClients; i++) 126 | { 127 | // Если игрок не террорист, мёртв, не в зоне или уже не может наносить урон, то переходим к следующему 128 | if(!IsPlayerValid(i, CS_TEAM_T) || !IsPlayerAlive(i) || !bInZone[i] || !bCanCauseDmg[i]) continue; 129 | 130 | switch(++iTimesRepeated[i]) 131 | { 132 | // ... через сколько секунд перестанет наноситься урон 133 | case 10,20,30: if(!IsFakeClient(i) && bMsg) PrintToChat(i, "Вы перестанtntт наносить урон, находясь на респауне, через %i сек!", 40 - iTimesRepeated[i]); 134 | case 40: // После 40 секунд отключим нанесение урона 135 | { 136 | bCanCauseDmg[i] = false; 137 | if(!IsFakeClient(i) && bMsg) PrintToChat(i, "Вы не можете наносить урон противникам, пока находитесь в этой зоне!") 138 | } 139 | } 140 | } 141 | 142 | return Plugin_Continue; 143 | } 144 | 145 | public Action:OnLeftProtectedZone(zone, client, const String:prefix[]) 146 | { 147 | if(!IsPlayerValid(client, CS_TEAM_T) || !IsPlayerAlive(client)) 148 | return Plugin_Continue; 149 | 150 | // Проверяем наличие у зоны имени и его правильность 151 | decl String:name[MAX_NAME_LENGTH*2]; 152 | if(GetEntPropString(zone, Prop_Data, "m_iName", name, sizeof(name)) < 10 || !StrEqual(name[8], "myzone", false)) 153 | return Plugin_Continue; 154 | 155 | bInZone[client] = false; 156 | 157 | // Если игроку уже запрещено наносить урон, то кулдаун будет большим, если ещё нет - коротким 158 | iCooldown[client] = iTime + (bCanCauseDmg[client] ? SHORT_CD : LONG_CD); 159 | 160 | bCanCauseDmg[client] = true; 161 | if(!IsFakeClient(client) && bMsg) PrintToChat(client, "Вы снова можете наносить урон противникам!") 162 | 163 | return Plugin_Continue; 164 | } 165 | 166 | public Action:OnTakeDamage(victim, &attacker, &inflictor, &Float:damage, &damagetype) 167 | { 168 | if(IsPlayerValid(victim, CS_TEAM_CT) && IsPlayerValid(attacker, CS_TEAM_T) && !bCanCauseDmg[attacker]) 169 | { 170 | damage = 0.0; 171 | return Plugin_Changed; 172 | } 173 | 174 | return Plugin_Continue; 175 | } 176 | 177 | stock bool:IsPlayerValid(client, team) 178 | { 179 | return 0 < client <= MaxClients && IsClientInGame(client) && iTeam[client] == team; 180 | } -------------------------------------------------------------------------------- /SM/scripting/plugins_list_log.sp: -------------------------------------------------------------------------------- 1 | public Plugin myinfo = 2 | { 3 | name = "Plugins list log", 4 | version = "1.0.0", 5 | description = "Saves plugins info to the log", 6 | author = "Grey83", 7 | url = "https://steamcommunity.com/groups/grey83ds" 8 | } 9 | 10 | public void OnAllPluginsLoaded() 11 | { 12 | int i; 13 | Handle fileh, iter, plugin; 14 | char path[PLATFORM_MAX_PATH], name[64], ver[64], author[64], file[64]; 15 | 16 | BuildPath(Path_SM, path, sizeof(path), "logs/plugins_list.log"); 17 | fileh = OpenFile(path, "a"); 18 | 19 | iter = GetPluginIterator(); 20 | while(MorePlugins(iter)) 21 | { 22 | plugin = ReadPlugin(iter); 23 | name[0] = ver[0] = author[0] = 0; 24 | GetPluginInfo(plugin, PlInfo_Name, name, sizeof(name)); 25 | GetPluginInfo(plugin, PlInfo_Version, ver, sizeof(ver)); 26 | GetPluginInfo(plugin, PlInfo_Author, author, sizeof(author)); 27 | GetPluginFilename(plugin, file, sizeof(file)); 28 | 29 | WriteFileLine(fileh, "%03i) %s\n\t \"%s\" v.%s by \"%s\"", ++i, file, name, ver, author); 30 | } 31 | WriteFileLine(fileh, "\tTotal plugins: %i\n", i); 32 | 33 | CloseHandle(iter); 34 | CloseHandle(fileh); 35 | } -------------------------------------------------------------------------------- /SM/scripting/random_plant_blocker.phrases.txt: -------------------------------------------------------------------------------- 1 | // You can use this symbols for setting colors: 2 | // "\x01" = "", "\x02" = "", "\x03" = "", "\x04" = "", "\x05" = "", "\x06" = "" 3 | // custom colors in CS:S: 4 | // "\x07" = "" (for RrGgBb), "\x08" = "" (for RrGgBbAa) 5 | // colors only for CSGO: 6 | // "\x09" = " ", "\x0B" = " ", "\x0C" = " ", "\x0E" = "", "\x0F" = "" 7 | 8 | "Phrases" 9 | { 10 | "PlantStateChanged" 11 | { 12 | "#format" "{1:c},{2:t}" 13 | "en" "ffffffSite fa00fa{1} {2}ffffff!" // CS:S 14 | "ru" "ffffffПлент fa00fa{1} {2}ffffff!" // CS:S 15 | // "en" "Site {1} {2}!" // CS:GO 16 | // "ru" "Плент {1} {2}!" // CS:GO 17 | } 18 | "Enabled" 19 | { 20 | "en" "00ff00unlocked" // CS:S 21 | "ru" "00ff00разблокирован" // CS:S 22 | // "en" "unlocked" // CS:GO 23 | // "ru" "разблокирован" // CS:GO 24 | } 25 | "Disabled" 26 | { 27 | "en" "ff4040locked" // CS:S 28 | "ru" "ff4040заблокирован" // CS:S 29 | // "en" "locked" // CS:GO 30 | // "ru" "заблокирован" // CS:GO 31 | } 32 | "NumberNotify" 33 | { 34 | "#format" "{1:i}" 35 | "en" "ffffffTo unlock need ff4040{1} ffffffmore player(s) in teams." // CS:S 36 | "ru" "ffffffДля разблокировки необходимо ещё ff4040{1} ffffffчеловек(а) в командах." // CS:S 37 | // "en" "To unlock need {1} more player(s) in teams." // CS:GO 38 | // "ru" "Для разблокировки необходимо ещё {1} человек(а) в командах." // CS:GO 39 | } 40 | 41 | "HUD_PlantStateChanged" 42 | { 43 | "#format" "{1:c},{2:t}" 44 | "en" "Site '{1}' {2}!" 45 | "ru" "Плент '{1}' {2}!" 46 | } 47 | "HUD_Enabled" 48 | { 49 | "en" "unlocked" 50 | "ru" "разблокирован" 51 | } 52 | "HUD_Disabled" 53 | { 54 | "en" "locked" 55 | "ru" "заблокирован" 56 | } 57 | "HUD_NumberNotify" 58 | { 59 | "#format" "{1:i}" 60 | "en" "To unlock need {1} more player(s) in teams." 61 | "ru" "Для разблокировки необходимо ещё {1} человек(а) в командах." 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /SM/scripting/random_plant_blocker.sp: -------------------------------------------------------------------------------- 1 | #pragma semicolon 1 2 | #pragma newdecls required 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | static const char 9 | PL_NAME[] = "Random plant blocker", 10 | PL_VER[] = "1.0.2_13.12.2022"; 11 | 12 | enum 13 | { 14 | H_Team, 15 | H_Start, 16 | H_End, 17 | H_Begin, 18 | H_Abort, 19 | 20 | H_Total 21 | }; 22 | 23 | Handle 24 | hHUD; 25 | bool 26 | bHook[H_Total], 27 | bCheck, 28 | bBlock, 29 | bPlanting; 30 | int 31 | iPlant, 32 | iPlayers, 33 | iBlockedPlant, 34 | iFuncBombTarget = -1; 35 | 36 | public Plugin myinfo = 37 | { 38 | name = PL_NAME, 39 | version = PL_VER, 40 | description = "Blocks a random plant if the players in teams are less than the set value", 41 | author = "Grey83", 42 | url = "https://steamcommunity.com/groups/grey83ds" 43 | } 44 | 45 | public void OnPluginStart() 46 | { 47 | EngineVersion ev = GetEngineVersion(); 48 | if(ev == Engine_CSS || ev == Engine_CSGO) hHUD = CreateHudSynchronizer(); 49 | 50 | LoadTranslations("random_plant_blocker.phrases"); 51 | 52 | CreateConVar("sm_rpb_version", PL_VER, PL_NAME, FCVAR_DONTRECORD|FCVAR_NOTIFY|FCVAR_SPONLY); 53 | 54 | ConVar cvar; 55 | cvar = CreateConVar("sm_rpb_plant", "1", "Block plant: -1 - random, 0 - 'A', 1 - 'B'", FCVAR_NONE, true, -1.0, true, 1.0); 56 | cvar.AddChangeHook(CVarChange_Plant); 57 | iPlant = cvar.IntValue; 58 | 59 | cvar = CreateConVar("sm_rpb_players", "6", "Minimum players to unlock all sites", FCVAR_NONE, true, _, true, MaxClients - 1.0); 60 | cvar.AddChangeHook(CVarChange_Players); 61 | iPlayers = cvar.IntValue; 62 | 63 | AutoExecConfig(true, "random_plant_blocker"); 64 | } 65 | 66 | public void OnPluginEnd() 67 | { 68 | if(bBlock) TriggerFuncBombTarget(false); 69 | } 70 | 71 | public void CVarChange_Plant(ConVar cvar, const char[] oldValue, const char[] newValue) 72 | { 73 | iPlant = cvar.IntValue; 74 | } 75 | 76 | public void CVarChange_Players(ConVar cvar, const char[] oldValue, const char[] newValue) 77 | { 78 | iPlayers = cvar.IntValue; 79 | } 80 | 81 | public void OnMapStart() 82 | { 83 | iFuncBombTarget = -1; 84 | bBlock = bPlanting = bCheck = false; 85 | if(GameRules_GetProp("m_bMapHasBombTarget")) 86 | CreateEventHooks(); 87 | else DeleteEventHooks(); 88 | } 89 | 90 | stock void CreateEventHooks() 91 | { 92 | if(!bHook[H_Team]) bHook[H_Team] = HookEventEx("player_team", Event_Team, EventHookMode_PostNoCopy); 93 | if(!bHook[H_Start]) bHook[H_Start] = HookEventEx("round_freeze_end", Event_Round, EventHookMode_PostNoCopy); 94 | if(!bHook[H_End]) bHook[H_End] = HookEventEx("round_end", Event_Round, EventHookMode_PostNoCopy); 95 | if(!bHook[H_Begin]) bHook[H_Begin] = HookEventEx("bomb_beginplant", Event_Bomb, EventHookMode_PostNoCopy); 96 | if(!bHook[H_Abort]) bHook[H_Abort] = HookEventEx("bomb_abortplant", Event_Bomb, EventHookMode_PostNoCopy); 97 | } 98 | 99 | stock void DeleteEventHooks() 100 | { 101 | if(bHook[H_Team]) 102 | { 103 | UnhookEvent("player_team", Event_Team, EventHookMode_PostNoCopy); 104 | bHook[H_Team] = false; 105 | } 106 | if(bHook[H_Start]) 107 | { 108 | UnhookEvent("round_freeze_end", Event_Round, EventHookMode_PostNoCopy); 109 | bHook[H_Start] = false; 110 | } 111 | if(bHook[H_End]) 112 | { 113 | UnhookEvent("round_end", Event_Round, EventHookMode_PostNoCopy); 114 | bHook[H_End] = false; 115 | } 116 | if(bHook[H_Begin]) 117 | { 118 | UnhookEvent("bomb_beginplant", Event_Bomb, EventHookMode_PostNoCopy); 119 | bHook[H_Begin] = false; 120 | } 121 | if(bHook[H_Abort]) 122 | { 123 | UnhookEvent("bomb_abortplant", Event_Bomb, EventHookMode_PostNoCopy); 124 | bHook[H_Abort] = false; 125 | } 126 | } 127 | 128 | public void OnClientDisconnect(int client) 129 | { 130 | if(bCheck) GetOnlinePlayers(); 131 | } 132 | 133 | public void Event_Team(Event event, const char[] name, bool dontBroadcast) 134 | { 135 | if(bCheck) GetOnlinePlayers(); 136 | } 137 | 138 | public void Event_Round(Event event, const char[] name, bool dontBroadcast) 139 | { 140 | if(bBlock) TriggerFuncBombTarget(false); 141 | bPlanting = bBlock = false; 142 | if(!(bCheck = name[6] == 'f')) 143 | return; 144 | 145 | iFuncBombTarget = -1; 146 | 147 | if(iPlant < 0) iBlockedPlant = GetRandomInt(0, 99) % 2; // выбираем случайный плент для блокировки 148 | else iBlockedPlant = iPlant; 149 | 150 | float min[3], max[3], pos[3]; 151 | int ent = MaxClients+1; 152 | if((ent = FindEntityByClassname(ent, "cs_player_manager")) != -1) 153 | { 154 | GetEntPropVector(ent, Prop_Send, iBlockedPlant ? "m_bombsiteCenterB" : "m_bombsiteCenterA", pos); 155 | } 156 | 157 | ent = MaxClients+1; 158 | while((ent = FindEntityByClassname(ent, "func_bomb_target")) != -1) 159 | { 160 | GetEntPropVector(ent, Prop_Data, "m_vecMins", min); 161 | GetEntPropVector(ent, Prop_Data, "m_vecMaxs", max); 162 | 163 | if(min[0] < pos[0] && pos[0] < max[0] && min[1] < pos[1] && pos[1] < max[1] && min[2] < pos[2] && pos[2] < max[2]) 164 | { 165 | iFuncBombTarget = EntIndexToEntRef(ent); 166 | GetOnlinePlayers(); 167 | return; 168 | } 169 | } 170 | } 171 | 172 | public void Event_Bomb(Event event, const char[] name, bool dontBroadcast) 173 | { 174 | if(!(bPlanting = name[5] == 'b')) GetOnlinePlayers(); 175 | } 176 | 177 | stock void GetOnlinePlayers() 178 | { 179 | if(bPlanting || !IsFuncBombTargetValid()) return; 180 | 181 | int num; 182 | for(int i = 1; i <= MaxClients && num <= iPlayers; i++) if(IsClientInGame(i) && GetClientTeam(i) > 1) num++; 183 | 184 | static bool blocked; 185 | blocked = bBlock; 186 | bBlock = num < iPlayers; 187 | if(blocked == bBlock) return; 188 | 189 | TriggerFuncBombTarget(bBlock); 190 | 191 | char txt[PLATFORM_MAX_PATH]; 192 | if(hHUD) SetHudTextParams(-1.0, -1.0, 3.0, 256, 128, 0, 255, 0, 0.0, 0.0, 0.5); 193 | 194 | for(int i = 1; i <= MaxClients; i++) 195 | if(IsClientInGame(i) && (!IsFakeClient(i) || IsClientSourceTV(i) || IsClientReplay(i))) 196 | { 197 | PrintToChat(i, "%t", "PlantStateChanged", 'A' + iBlockedPlant, bBlock ? "Disabled" : "Enabled"); 198 | if(bBlock) PrintToChat(i, "%t", "NumberNotify", iPlayers - num); 199 | if(!hHUD) continue; 200 | 201 | FormatEx(txt, sizeof(txt), "%T", "HUD_PlantStateChanged", i, 'A' + iBlockedPlant, bBlock ? "HUD_Disabled" : "HUD_Enabled"); 202 | if(bBlock) Format(txt, sizeof(txt), "%s\n%T", txt, "HUD_NumberNotify", i, iPlayers - num); 203 | ShowSyncHudText(i, hHUD, txt); 204 | } 205 | } 206 | 207 | stock void TriggerFuncBombTarget(bool disable) 208 | { 209 | if(IsFuncBombTargetValid()) AcceptEntityInput(iFuncBombTarget, disable ? "Disable" : "Enable"); // DisableAndEndTouch 210 | } 211 | 212 | stock bool IsFuncBombTargetValid() 213 | { 214 | return iFuncBombTarget != -1 && EntRefToEntIndex(iFuncBombTarget) != INVALID_ENT_REFERENCE; 215 | } 216 | -------------------------------------------------------------------------------- /SM/scripting/revival.inc: -------------------------------------------------------------------------------- 1 | #if defined _revival_included 2 | #endinput 3 | #endif 4 | #define _revival_included 5 | 6 | #define REVIVAL_API_VERSION 11 7 | 8 | enum 9 | { 10 | RI_Revives, // How many times during this round the player reviveded others 11 | RI_Revived, // How many times during this round the player was reviveded by others 12 | RI_Target, // Player's current target for revive 13 | RI_Percents // Progress in reviving the target 14 | }; 15 | 16 | /** 17 | * Getting current player information by selected type 18 | * 19 | * @param client Client index 20 | * @param type Information type: RI_* 21 | * @return Player information by selected type (-1 for wrong type) 22 | * @error Invalid client index, client not connected, fake client or invalid information type. 23 | */ 24 | native int Revival_GetPlayerInfo(int client, int type); 25 | 26 | /** 27 | * Setting current player values of selected type 28 | * 29 | * @param client Client index 30 | * @param type Information type: RI_* 31 | * @param value Value of choosed type 32 | * @error Invalid client index, client not connected, fake client, invalid information type or invalid value. 33 | */ 34 | native void Revival_SetPlayerInfo(int client, int type, int value); 35 | 36 | /** 37 | * Called when a client changed status. 38 | * 39 | * @param reviver Reviver index 40 | * @param target Revive target index 41 | * @param frags The number of frags that the reviver will receive 42 | * @param diff_hp The amount by which the health of the reviver will be changed 43 | * @param health The amount of health that the revival target will have (always > 0) 44 | */ 45 | forward void Revival_OnPlayerReviving(int reviver, int target, int &frags, int &diff_hp, int &health); 46 | -------------------------------------------------------------------------------- /SM/scripting/shield_enable.sp: -------------------------------------------------------------------------------- 1 | #pragma semicolon 1 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | public Plugin myinfo = 8 | { 9 | name = "[CSGO] Shield enable", 10 | version = "1.0.0_20.02.2022", 11 | description = "Makes buying a shield available on any map", 12 | author = "Grey83", 13 | url = "https://steamcommunity.com/groups/grey83ds" 14 | } 15 | 16 | public void OnMapStart() 17 | { 18 | GameRules_SetProp("m_bMapHasRescueZone", 1); 19 | 20 | float vec[3]; 21 | GetEntPropVector(0, Prop_Data, "m_WorldMaxs", vec); 22 | int ent = CreateEntityByName("func_hostage_rescue"); 23 | if(ent == -1) return; 24 | SetEntPropVector(ent, Prop_Data, "m_vecMaxs", NULL_VECTOR); 25 | SetEntPropVector(ent, Prop_Data, "m_vecMins", NULL_VECTOR); 26 | TeleportEntity(ent, vec, NULL_VECTOR, NULL_VECTOR); 27 | DispatchSpawn(ent); 28 | ActivateEntity(ent); 29 | AcceptEntityInput(ent, "Enable"); 30 | } -------------------------------------------------------------------------------- /SM/scripting/simple_afk_checker.sp: -------------------------------------------------------------------------------- 1 | static const float MAX_AFK_TIME = 180.0; // 3 minutes (3*60) to kick 2 | static const int MAX_AFK_DEATHS = 3; 3 | 4 | bool 5 | bCheck[MAXPLAYERS+1]; 6 | int 7 | iDeathAFK[MAXPLAYERS+1]; 8 | float 9 | fTimeAFK[MAXPLAYERS+1]; 10 | 11 | public void OnPluginStart() 12 | { 13 | HookEvent("player_team", Event_Team); 14 | HookEvent("player_death", Event_Player); 15 | HookEvent("player_spawn", Event_Player); 16 | } 17 | 18 | public void Event_Team(Event event, const char[] name, bool dontBroadcast) 19 | { 20 | int client = GetClientOfUserId(event.GetInt("userid")); 21 | if(!client || IsFakeClient(client)) 22 | return; 23 | 24 | if(GetUserFlagBits(client)) // ignore admins 25 | { 26 | if(bCheck[client]) bCheck[client] = false; 27 | return; 28 | } 29 | 30 | if(!(bCheck[client] = event.GetInt("team") > 1) || event.GetInt("oldteam") < 2) fTimeAFK[client] = 0.0; 31 | } 32 | 33 | public void Event_Player(Event event, const char[] name, bool dontBroadcast) 34 | { 35 | int client = GetClientOfUserId(event.GetInt("userid")); 36 | if(!client || IsFakeClient(client)) 37 | return; 38 | 39 | bool admin = !!GetUserFlagBits(client); 40 | if(!admin && bCheck[client] && fTimeAFK[client] != 0.0 && name[7] == 'd' 41 | && GetClientOfUserId(event.GetInt("attacker"))) 42 | iDeathAFK[client]++; // count AFK non-admin deaths from other players 43 | if(iDeathAFK[client] >= MAX_AFK_DEATHS) KickClient(client, "AFK death too much times (%i)", MAX_AFK_DEATHS); 44 | 45 | if((bCheck[client] = !admin && name[7] == 's' && GetClientTeam(client) > 1)) 46 | fTimeAFK[client] == 0.0; 47 | } 48 | 49 | public void OnPlayerRunCmdPost(int client, int buttons) 50 | { 51 | if(!bCheck[client]) return; 52 | 53 | static int old_buttons[MAXPLAYERS+1]; 54 | if(buttons != old_buttons[client]) 55 | { 56 | old_buttons[client] = buttons; 57 | fTimeAFK[client] = 0.0; 58 | return; 59 | } 60 | 61 | static float time; 62 | time = GetEngineTime(); 63 | if(fTimeAFK[client] == 0.0) 64 | { 65 | fTimeAFK[client] = time; 66 | return; 67 | } 68 | 69 | time -= fTimeAFK[client]; 70 | if(time > MAX_AFK_TIME) KickClient(client, "AFK too much time (%.1fsec)", time); 71 | } 72 | 73 | public void OnClientDisconnect(int client) 74 | { 75 | iDeathAFK[client] = 0; 76 | fTimeAFK[client] = 0.0; 77 | bCheck[client] = false; 78 | } -------------------------------------------------------------------------------- /SM/scripting/simple_announce 1.1.1.sp: -------------------------------------------------------------------------------- 1 | #pragma semicolon 1 2 | #pragma newdecls required 3 | 4 | static const char 5 | CLR[][][] = 6 | {// name CSGO CSS CSSv34 7 | {"{DEFAULT}", "\x01", "\x01", "\x01"}, 8 | {"{TEAM}", "\x03", "\x03", "\x03"}, 9 | {"{GREEN}", "\x04", "\x0700AD00", "\x04"}, 10 | {"{WHITE}", "\x01", "\x07FFFFFF", "\x01"}, 11 | {"{RED}", "\x02", "\x07FF0000", ""}, 12 | {"{LIME}", "\x05", "\x0700FF00", "\x04"}, 13 | {"{LIGHTGREEN}","\x06", "\x0799FF99", "\x04"}, 14 | {"{LIGHTRED}", "\x07", "\x07FF4040", ""}, 15 | {"{GRAY}", "\x08", "\x07CCCCCC", ""}, 16 | {"{LIGHTOLIVE}","\x09", "\x07FFBD6B", ""}, 17 | {"{OLIVE}", "\x10", "\x07FA8B00", ""}, 18 | {"{BLUEGREY}", "\x0A", "\x076699CC", ""}, 19 | {"{LIGHTBLUE}", "\x0B", "\x0799CCFF", ""}, 20 | {"{BLUE}", "\x0C", "\x073D46FF", ""}, 21 | {"{PURPLE}", "\x0E", "\x07FA00FA", ""}, 22 | {"{LIGHTRED2}", "\x0F", "\x07FF8080", ""} 23 | }, 24 | TYPE[][] = 25 | { 26 | "Бот", 27 | "Replay", 28 | "SourceTV", 29 | "Игрок", 30 | "Админ" 31 | }; 32 | 33 | enum 34 | { 35 | E_Unknown, 36 | E_CSGO, 37 | E_CSS, 38 | E_Old 39 | }; 40 | 41 | enum 42 | { 43 | T_Bot, 44 | T_Replay, 45 | T_STV, 46 | T_Player, 47 | T_Admin 48 | }; 49 | 50 | bool bProto; 51 | int iEngine, 52 | iMode, 53 | iType[MAXPLAYERS+1]; 54 | 55 | public Plugin myinfo = 56 | { 57 | name = "Simple announce", 58 | author = "Grey83", 59 | version = "1.0.0", 60 | url = "https://steamcommunity.com/groups/grey83ds" 61 | } 62 | 63 | public void OnPluginStart() 64 | { 65 | bProto = GetFeatureStatus(FeatureType_Native, "GetUserMessageType") == FeatureStatus_Available && GetUserMessageType() == UM_Protobuf; 66 | 67 | switch(GetEngineVersion()) 68 | { 69 | case Engine_CSGO: 70 | iEngine = E_CSGO; 71 | case Engine_CSS, Engine_HL2DM, Engine_DODS: 72 | iEngine = E_CSS; 73 | case Engine_SourceSDK2006: 74 | iEngine = E_Old; 75 | } 76 | 77 | ConVar cvar; 78 | (cvar = CreateConVar("sm_announce_admin", "3", "Add info: 0 - Nothing, 1 - SteamID, 2 - IP, 3 - SteamID & IP", _, true, 0.0, true, 3.0)).AddChangeHook(CVarChanged_Mode); 79 | iMode = cvar.IntValue; 80 | 81 | HookEvent("player_connect", Event_PlayerConnect, EventHookMode_Pre); 82 | HookEvent("player_connect_client", Event_PlayerConnect, EventHookMode_Pre); 83 | HookEvent("player_team", Event_Team, EventHookMode_Pre); 84 | HookEvent("player_disconnect", Event_Disconnect, EventHookMode_Pre); 85 | } 86 | 87 | public void CVarChanged_Mode(ConVar cvar, const char[] oldValue, const char[] newValue) 88 | { 89 | iMode = cvar.IntValue; 90 | } 91 | 92 | public Action Event_PlayerConnect(Event event, const char[] name, bool dontBroadcast) 93 | { 94 | event.BroadcastDisabled = true; 95 | return Plugin_Continue; 96 | } 97 | 98 | public void OnClientPostAdminCheck(int client) 99 | { 100 | if(!IsFakeClient(client)) 101 | iType[client] = GetUserAdmin(client) == INVALID_ADMIN_ID ? T_Player : T_Admin; 102 | else if(IsClientSourceTV(client)) iType[client] = T_STV; 103 | else if(IsClientReplay(client)) iType[client] = T_Replay; 104 | else iType[client] = T_Bot; 105 | } 106 | 107 | public Action Event_Disconnect(Event event, const char[] name, bool dontBroadcast) 108 | { 109 | if(!dontBroadcast) event.BroadcastDisabled = true; 110 | return Plugin_Continue; 111 | } 112 | 113 | public Action Event_Team(Event event, const char[] name, bool dontBroadcast) 114 | { 115 | int client = GetClientOfUserId(event.GetInt("userid")); 116 | if(client && !dontBroadcast) 117 | { 118 | event.BroadcastDisabled = true; 119 | if(event.GetBool("disconnect")) PrintConnect(client); 120 | else if(!event.GetInt("oldteam")) PrintConnect(client, true); 121 | else switch(event.GetInt("team")) 122 | { 123 | case 1: PrintToChatAllClr("Игрок {GREEN}%N {WHITE}перешёл в {GRAY}Наблюдение", client); 124 | case 2: PrintToChatAllClr("Игрок {GREEN}%N {WHITE}зашёл за {LIGHTRED}Террористов", client); 125 | case 3: PrintToChatAllClr("Игрок {GREEN}%N {WHITE}зашёл за {LIGHTBLUE}Спецназ", client); 126 | } 127 | } 128 | return Plugin_Continue; 129 | } 130 | 131 | stock void PrintConnect(int client, bool connect = false) 132 | { 133 | static char msg[PLATFORM_MAX_PATH], amsg[PLATFORM_MAX_PATH], buffer[32]; 134 | FormatEx(msg, sizeof(msg), "Игрок {GREEN}%N %s{WHITE}.", client, connect ? "{LIGHTGREEN}подключился к серверу" : "{LIGHTRED2}покидает игру"); 135 | 136 | FormatEx(amsg, sizeof(amsg), "%s {GREEN}%N{WHITE}", TYPE[iType[client]], client); 137 | if(iType[client]) 138 | { 139 | if(iMode & 1) 140 | { 141 | GetClientAuthId(client, AuthId_Steam2, buffer, sizeof(buffer)); 142 | Format(amsg, sizeof(amsg), "%s [{OLIVE}%s{WHITE}]", amsg, buffer); 143 | } 144 | if(iMode & 2) 145 | { 146 | GetClientIP(client, buffer, sizeof(buffer)); 147 | Format(amsg, sizeof(amsg), "%s [{OLIVE}%s{WHITE}]", amsg, buffer); 148 | } 149 | } 150 | Format(amsg, sizeof(amsg), "%s %s.", amsg, connect ? "{LIGHTGREEN}подключился к серверу" : "{LIGHTRED2}покидает игру"); 151 | 152 | for(int i = 1; i <= MaxClients; i++) if(IsClientValid(i)) PrintToChatClr(i, iType[i] == T_Admin ? amsg : msg); 153 | } 154 | 155 | stock void PrintToChatAllClr(const char[] msg, any ...) 156 | { 157 | static char buffer[PLATFORM_MAX_PATH]; 158 | for(int i = 1; i <= MaxClients; i++) if(IsClientValid(i)) 159 | { 160 | VFormat(buffer, sizeof(buffer), msg, 2); 161 | PrintToChatClr(i, "%s", buffer); 162 | } 163 | } 164 | 165 | stock void PrintToChatClr(int client, const char[] msg, any ...) 166 | { 167 | Handle hBuffer = StartMessageOne("SayText2", client, USERMSG_RELIABLE|USERMSG_BLOCKHOOKS); 168 | if(!hBuffer) return; 169 | 170 | SetGlobalTransTarget(client); 171 | static char buffer[PLATFORM_MAX_PATH], new_msg[PLATFORM_MAX_PATH]; 172 | if(iEngine != E_Unknown) FormatEx(buffer, sizeof(buffer), "%s\x01%s", iEngine == E_CSGO ? " " : "", msg); 173 | VFormat(new_msg, sizeof(new_msg), buffer, 3); 174 | 175 | if(iEngine) for(int i; i < 16; i++) ReplaceString(new_msg, sizeof(new_msg), CLR[i][0], CLR[i][iEngine]); 176 | else for(int i; i < 16; i++) ReplaceString(new_msg, sizeof(new_msg), CLR[i][0], ""); 177 | 178 | if(bProto) 179 | { 180 | PbSetInt(hBuffer, "ent_idx", 0); 181 | PbSetBool(hBuffer, "chat", true); 182 | PbSetString(hBuffer, "msg_name", new_msg); 183 | PbAddString(hBuffer, "params", ""); 184 | PbAddString(hBuffer, "params", ""); 185 | PbAddString(hBuffer, "params", ""); 186 | PbAddString(hBuffer, "params", ""); 187 | } 188 | else 189 | { 190 | BfWriteByte(hBuffer, 0); 191 | BfWriteByte(hBuffer, true); 192 | BfWriteString(hBuffer, new_msg); 193 | } 194 | EndMessage(); 195 | } 196 | 197 | stock bool IsClientValid(int client) 198 | { 199 | return IsClientInGame(client) && iType[client]; 200 | } -------------------------------------------------------------------------------- /SM/scripting/sm_doublejump.sp: -------------------------------------------------------------------------------- 1 | #pragma semicolon 1 2 | #pragma newdecls required 3 | 4 | #include 5 | 6 | #if SOURCEMOD_V_MINOR > 10 7 | #define PL_NAME "Double Jump" 8 | #define PL_VER "1.1.0" 9 | #else 10 | static const char 11 | PL_NAME[] = "Double Jump", 12 | PL_VER[] = "1.1.0"; 13 | #endif 14 | 15 | bool 16 | bEnable, 17 | bEvent; 18 | int 19 | iMax; 20 | float 21 | flBoost; 22 | 23 | public Plugin myinfo = 24 | { 25 | name = PL_NAME, 26 | version = PL_VER, 27 | description = "Allows double-jumping.", 28 | author = "Paegus, Grey83", 29 | url = "http://steamcommunity.com/groups/grey83ds" 30 | } 31 | 32 | public void OnPluginStart() 33 | { 34 | CreateConVar("sm_doublejump_version", PL_VER, PL_NAME, FCVAR_DONTRECORD|FCVAR_SPONLY|FCVAR_NOTIFY); 35 | 36 | ConVar cvar; 37 | cvar = CreateConVar("sm_doublejump_enabled","1", "Enables double-jumping.", _, true, _, true, 1.0); 38 | cvar.AddChangeHook(CVarChanged_Enable); 39 | bEnable = cvar.BoolValue; 40 | 41 | cvar = CreateConVar("sm_doublejump_boost", "260.0","The amount of vertical boost to apply to double jumps.", _, true, 260.0, true, 4095.0); 42 | cvar.AddChangeHook(CVarChanged_Boost); 43 | flBoost = cvar.FloatValue; 44 | 45 | cvar = CreateConVar("sm_doublejump_max", "1", "The maximum number of re-jumps allowed while already jumping. 0 = unlimited", _, true); 46 | cvar.AddChangeHook(CVarChanged_Max); 47 | iMax = cvar.IntValue; 48 | 49 | cvar = CreateConVar("sm_doublejump_event", "0", "Create event 'player_footstep' for other plugins.", _, true, _, true, 1.0); 50 | cvar.AddChangeHook(CVarChanged_Enable); 51 | bEvent = cvar.BoolValue; 52 | 53 | AutoExecConfig(true, "doublejump"); 54 | } 55 | 56 | public void CVarChanged_Enable(ConVar cvar, const char[] oldVal, const char[] newVal) 57 | { 58 | bEnable = cvar.BoolValue; 59 | } 60 | 61 | public void CVarChanged_Boost(ConVar cvar, const char[] oldVal, const char[] newVal) 62 | { 63 | flBoost = cvar.FloatValue; 64 | } 65 | 66 | public void CVarChanged_Max(ConVar cvar, const char[] oldVal, const char[] newVal) 67 | { 68 | iMax = cvar.IntValue; 69 | } 70 | 71 | public Action OnPlayerRunCmd(int client, int& buttons) 72 | { 73 | if(!bEnable || !IsPlayerAlive(client)) return Plugin_Continue; 74 | 75 | static bool ground, injump, wasjump[MAXPLAYERS+1], landed[MAXPLAYERS+1]; 76 | ground = !!(GetEntityFlags(client) & FL_ONGROUND); 77 | injump = !!(GetClientButtons(client) & IN_JUMP); 78 | 79 | if(!landed[client]) 80 | { 81 | if(iMax) 82 | { 83 | static int jumps[MAXPLAYERS+1]; 84 | if(ground) 85 | jumps[client] = 0; 86 | else if(!wasjump[client] && injump && ++jumps[client] <= iMax) 87 | NewJump(client); 88 | } 89 | else if(!ground && !wasjump[client] && injump) 90 | NewJump(client); 91 | } 92 | 93 | landed[client] = ground; 94 | wasjump[client] = injump; 95 | 96 | return Plugin_Continue; 97 | } 98 | 99 | stock void NewJump(int client) 100 | { 101 | static float vel[3]; 102 | GetEntPropVector(client, Prop_Data, "m_vecVelocity", vel); 103 | vel[2] = flBoost; 104 | TeleportEntity(client, NULL_VECTOR, NULL_VECTOR, vel); 105 | if(!bEvent) return; 106 | 107 | Event event = CreateEvent("player_footstep"); 108 | if(!event) return; 109 | 110 | event.SetInt("userid", GetClientUserId(client)); 111 | event.Fire(); 112 | } -------------------------------------------------------------------------------- /SM/scripting/sm_find_cmd.sp: -------------------------------------------------------------------------------- 1 | #pragma semicolon 1 2 | #pragma newdecls required 3 | 4 | static const char 5 | PL_NAME[] = "Find command", 6 | PL_VER[] = "1.0.0_13.03.2023"; 7 | 8 | public Plugin myinfo = 9 | { 10 | name = PL_NAME, 11 | version = PL_VER, 12 | description = "Search plugin by command", 13 | author = "Grey83", 14 | url = "https://steamcommunity.com/groups/grey83ds" 15 | } 16 | 17 | public void OnPluginStart() 18 | { 19 | CreateConVar("sm_find_cmd_version", PL_VER, PL_NAME, FCVAR_DONTRECORD|FCVAR_NOTIFY|FCVAR_SPONLY); 20 | 21 | RegAdminCmd("sm_find_cmd", Cmd_Find, ADMFLAG_ROOT); 22 | } 23 | 24 | public Action Cmd_Find(int client, int args) 25 | { 26 | if(args < 1) 27 | { 28 | ReplyToCommand(client, "[SM] Usage: sm_find_cmd "); 29 | return Plugin_Handled; 30 | } 31 | 32 | char cmd[32]; 33 | GetCmdArg(1, cmd, sizeof(cmd)); 34 | if(!TrimString(cmd)) 35 | { 36 | ReplyToCommand(client, "[SM] Usage: sm_find_cmd "); 37 | return Plugin_Handled; 38 | } 39 | 40 | if(GetCommandFlags(cmd) == INVALID_FCVAR_FLAGS) 41 | { 42 | ReplyToCommand(client, "[SM] Command '%s' don't registred", cmd); 43 | return Plugin_Handled; 44 | } 45 | 46 | ReplyToCommand(client, "\n[SM] '%s' is registered to:", cmd); 47 | 48 | CommandIterator iter = new CommandIterator(); 49 | if(!iter) 50 | { 51 | LogError("Failed to create CommandIterator =("); 52 | return Plugin_Handled; 53 | } 54 | 55 | Handle plugin; 56 | int num; 57 | char buffer[32], name[32]; 58 | while(iter.Next()) 59 | { 60 | iter.GetName(buffer, sizeof(buffer)); 61 | if(strcmp(cmd, buffer, false)) 62 | continue; 63 | 64 | num++; 65 | plugin = iter.Plugin; 66 | GetPluginFilename(plugin, name, sizeof(name)); 67 | if(GetPluginInfo(plugin, PlInfo_Name, buffer, sizeof(buffer))) 68 | ReplyToCommand(client, " \"%s\" (file: %s)", buffer, name); 69 | else ReplyToCommand(client, " (file: %s)", name); 70 | } 71 | CloseHandle(iter); 72 | 73 | ReplyToCommand(client, " -= %i matches found =-\n", num); 74 | 75 | return Plugin_Handled; 76 | } -------------------------------------------------------------------------------- /SM/scripting/sm_fragtag 1.0.1_18.08.2022.sp: -------------------------------------------------------------------------------- 1 | #pragma semicolon 1 2 | #pragma newdecls required 3 | 4 | #include 5 | #include 6 | 7 | static char 8 | PL_NAME[] = "[CSGO] FragTag", 9 | PL_VER[] = "1.0.1_18.08.2022", 10 | 11 | TAG[] = "<%i>"; // Clantag should contain only one format specifier: '%i' 12 | 13 | bool 14 | bLate; 15 | int 16 | iOffset, 17 | iManager, 18 | kills[MAXPLAYERS+1]; 19 | 20 | public Plugin myinfo = 21 | { 22 | name = PL_NAME, 23 | version = PL_VER, 24 | description = "Shows the number of frags in the clantag", 25 | author = "Grey83", 26 | url = "https://steamcommunity.com/groups/grey83ds" 27 | } 28 | 29 | public APLRes AskPluginLoad2(Handle myself, bool late, char[] error, int err_max) 30 | { 31 | if(GetEngineVersion() != Engine_CSGO) 32 | { 33 | FormatEx(error, sizeof(err_max), "Plugin for CS:GO only!"); 34 | return APLRes_Failure; 35 | } 36 | 37 | if((iOffset= FindSendPropInfo("CCSPlayerResource", "m_iKills")) < 1) 38 | { 39 | FormatEx(error, sizeof(err_max), "Unable to find offset 'CCSPlayerResource::m_iKills'!"); 40 | return APLRes_Failure; 41 | } 42 | 43 | bLate = late; 44 | return APLRes_Success; 45 | } 46 | 47 | public void OnPluginStart() 48 | { 49 | CreateConVar("sm_fragtag_version", PL_VER, PL_NAME, FCVAR_DONTRECORD|FCVAR_NOTIFY|FCVAR_SPONLY); 50 | 51 | HookEvent("player_death", Event_Player); 52 | } 53 | 54 | public void OnMapStart() 55 | { 56 | iManager = -1; 57 | if(!GetManager() || !bLate) 58 | return; 59 | 60 | bLate = false; 61 | GetEntDataArray(iManager, iOffset, kills, sizeof(kills)); 62 | for(int i = 1; i <= MaxClients; i++) if(IsPlayerValid(i)) SetPlayerClanTag(i); 63 | } 64 | 65 | public void OnClientSettingsChanged(int client) 66 | { 67 | if(IsPlayerValid(client)) Timer_Death(null, GetClientUserId(client)); 68 | } 69 | 70 | public void Event_Player(Event event, const char[] name, bool dontBroadcast) 71 | { 72 | int client = GetClientOfUserId(event.GetInt("attacker")); 73 | if(client && client != GetClientOfUserId(event.GetInt("userid")) && IsPlayerValid(client)) 74 | CreateTimer(0.1, Timer_Death, GetClientUserId(client), TIMER_FLAG_NO_MAPCHANGE); 75 | } 76 | 77 | public Action Timer_Death(Handle timer, int client) 78 | { 79 | if(!GetManager() || !(client = GetClientOfUserId(client))) 80 | return Plugin_Stop; 81 | 82 | kills[client] = GetEntProp(iManager, Prop_Send, "m_iKills", 2, client); 83 | SetPlayerClanTag(client); 84 | 85 | return Plugin_Stop; 86 | } 87 | 88 | stock void SetPlayerClanTag(int client, bool pre = false) 89 | { 90 | static char buffer[8]; 91 | FormatEx(buffer, sizeof(buffer), TAG, kills[client]); 92 | CS_SetClientClanTag(client, buffer); 93 | } 94 | 95 | stock bool GetManager() 96 | { 97 | if(iManager == -1 && (iManager = FindEntityByClassname(-1, "cs_player_manager")) == -1) 98 | { 99 | LogError("Unable to find entity 'cs_player_manager'!"); 100 | return false; 101 | } 102 | 103 | return true; 104 | } 105 | 106 | stock bool IsPlayerValid(int client) 107 | { 108 | return IsClientInGame(client) && (!IsFakeClient(client) || !IsClientReplay(client) && !IsClientSourceTV(client)); 109 | } 110 | -------------------------------------------------------------------------------- /SM/scripting/sm_killfeed_ctrl.sp: -------------------------------------------------------------------------------- 1 | #pragma semicolon 1 2 | #pragma newdecls required 3 | 4 | static const char 5 | PL_NAME[] = "Kill Feed Control", 6 | PL_VER[] = "1.0.0"; 7 | 8 | bool bCSGO; 9 | int iMode; 10 | 11 | public Plugin myinfo = 12 | { 13 | name = PL_NAME, 14 | version = PL_VER, 15 | author = "Grey83" 16 | } 17 | 18 | public void OnPluginStart() 19 | { 20 | bCSGO = GetEngineVersion() == Engine_CSGO; 21 | 22 | CreateConVar("sm_killfeed_ctrl_version", PL_VER, PL_NAME, FCVAR_NOTIFY|FCVAR_DONTRECORD); 23 | 24 | ConVar cvar; 25 | (cvar = CreateConVar("sm_killfeed_ctrl_mode", "0", "Kiilfeed: 0 = disable, 1 = enable, 2 - hide team T death, 3 - hide team CT death, 4 - hide others deaths and kills", _, true, 0.0, true, 3.0)).AddChangeHook(CVarChanged); 26 | CVarChanged(cvar, "", ""); 27 | 28 | AutoExecConfig(true, "killfeed_ctrl"); 29 | } 30 | 31 | public void CVarChanged(ConVar cvar, const char[] oldValue, const char[] newValue) 32 | { 33 | iMode = cvar.IntValue; 34 | 35 | static bool hooked; 36 | if(hooked != (iMode == 1)) return; 37 | 38 | if((hooked = !hooked)) 39 | HookEvent("player_death", Event_Death, EventHookMode_Pre); 40 | else UnhookEvent("player_death", Event_Death, EventHookMode_Pre); 41 | } 42 | 43 | public void Event_Death(Event event, const char[] name, bool dontBroadcast) 44 | { 45 | if(iMode == 1) return; 46 | 47 | static int client; 48 | if(!iMode || iMode == 4 || (client = GetClientOfUserId(event.GetInt("userid"))) && iMode == GetClientTeam(client)) 49 | event.BroadcastDisabled = true; 50 | if(iMode != 4) return; 51 | 52 | if(!IsFakeClient(client)) 53 | event.FireToClient(client); 54 | if((client = GetClientOfUserId(event.GetInt("attacker"))) && !IsFakeClient(client)) 55 | event.FireToClient(client); 56 | if(bCSGO && (client = GetClientOfUserId(event.GetInt("assister"))) && !IsFakeClient(client)) 57 | event.FireToClient(client); 58 | 59 | // event.Cancel(); // раскомментировать, если будут утечки памяти 60 | } -------------------------------------------------------------------------------- /SM/scripting/sm_laser_tag 1.0.0_31.03.2025.sp: -------------------------------------------------------------------------------- 1 | #pragma semicolon 1 2 | #pragma newdecls required 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | static const int COLOR[][] = {{0xff, 0x3f, 0x1f}, {0x1f, 0x3f, 0xff}}; // Default beam colors (T, CT) 11 | 12 | int 13 | hBeam, 14 | hHalo, 15 | iColor[2][4]; 16 | float 17 | fLife, 18 | fWidth; 19 | 20 | public Plugin myinfo = 21 | { 22 | name = "Laser Tag", 23 | version = "1.0.0_31.03.2025", 24 | description = "", 25 | author = "Grey83", 26 | url = "https://forums.alliedmods.net/showthread.php?t=350863" 27 | } 28 | 29 | public void OnPluginStart() 30 | { 31 | ConVar cvar; 32 | cvar = CreateConVar("sm_laser_tag_enable", "1", "1/0 = Enable/Disable plugin", FCVAR_NONE, true, _, true, 1.0); 33 | cvar.AddChangeHook(CVarChange_Enable); 34 | CVarChange_Enable(cvar, NULL_STRING, NULL_STRING); 35 | 36 | cvar = CreateConVar("sm_laser_tag_life", "0.3", "Laser beam life", FCVAR_NONE, true, 0.01, true, 1.0); 37 | cvar.AddChangeHook(CVarChange_Life); 38 | fLife = cvar.FloatValue; 39 | 40 | cvar = CreateConVar("sm_laser_tag_width", "3.0", "Laser beam width", FCVAR_NONE, true, 0.1, true, 100.0); 41 | cvar.AddChangeHook(CVarChange_Width); 42 | fWidth = cvar.FloatValue; 43 | 44 | cvar = CreateConVar("sm_laser_tag_alpha", "127", "Laser beam alpha", _, true, _, true, 255.0); 45 | cvar.AddChangeHook(CVarChange_Alpha); 46 | iColor[0][3] = iColor[1][3] = cvar.IntValue; 47 | 48 | cvar = CreateConVar("sm_laser_tag_t", "ff3f1f", "T laser beam color. Set by HEX (RGB or RRGGBB, values 0 - F or 00 - FF, resp.). Wrong color code = red", FCVAR_PRINTABLEONLY); 49 | cvar.AddChangeHook(CVarChange_ColorT); 50 | SetColor(cvar, 0); 51 | 52 | cvar = CreateConVar("sm_laser_tag_ct", "1f3fff", "CT laser beam color. Set by HEX (RGB or RRGGBB, values 0 - F or 00 - FF, resp.). Wrong color code = blue", FCVAR_PRINTABLEONLY); 53 | cvar.AddChangeHook(CVarChange_ColorCT); 54 | SetColor(cvar, 1); 55 | 56 | AutoExecConfig(true, "laser_tag"); 57 | } 58 | 59 | public void CVarChange_Enable(ConVar cvar, const char[] oldValue, const char[] newValue) 60 | { 61 | static bool hooked; 62 | if(hooked == cvar.BoolValue) 63 | return; 64 | 65 | if(!(hooked ^= true)) 66 | UnhookEvent("bullet_impact", Event_BulletImpact); 67 | else HookEvent("bullet_impact", Event_BulletImpact); 68 | } 69 | 70 | public void CVarChange_Life(ConVar cvar, const char[] oldValue, const char[] newValue) 71 | { 72 | fLife = cvar.FloatValue; 73 | } 74 | 75 | public void CVarChange_Width(ConVar cvar, const char[] oldValue, const char[] newValue) 76 | { 77 | fWidth = cvar.FloatValue; 78 | } 79 | 80 | public void CVarChange_Alpha(ConVar cvar, const char[] oldValue, const char[] newValue) 81 | { 82 | iColor[0][3] = iColor[1][3] = cvar.IntValue; 83 | } 84 | 85 | public void CVarChange_ColorT(ConVar cvar, const char[] oldValue, const char[] newValue) 86 | { 87 | SetColor(cvar, 0); 88 | } 89 | 90 | public void CVarChange_ColorCT(ConVar cvar, const char[] oldValue, const char[] newValue) 91 | { 92 | SetColor(cvar, 1); 93 | } 94 | 95 | void SetColor(ConVar cvar, int type) 96 | { 97 | char clr[8]; 98 | cvar.GetString(clr, sizeof(clr)); 99 | clr[7] = 0; 100 | 101 | int i; 102 | while(clr[i]) 103 | { 104 | if(!(clr[i] >= '0' && clr[i] <= '9') && !(clr[i] >= 'A' && clr[i] <= 'F') && !(clr[i] >= 'a' && clr[i] <= 'f')) 105 | { 106 | ResetColor(type, clr); 107 | return; 108 | } 109 | i++; 110 | } 111 | 112 | if(i != 6) ResetColor(type, clr); 113 | 114 | clr[6] = 0; 115 | if(i == 3) 116 | { 117 | clr[4] = clr[5] = clr[2]; 118 | clr[2] = clr[3] = clr[1]; 119 | clr[1] = clr[0]; 120 | i = 6; 121 | } 122 | 123 | StringToIntEx(clr, i, 16); 124 | SaveColor(type, (i & 0xFF0000) >> 16, (i & 0xFF00) >> 8, i & 0xFF); 125 | } 126 | 127 | void ResetColor(int type, char[] clr) 128 | { 129 | SaveColor(type); 130 | LogError("HEX color '%s' isn't valid!\nLaser beam color is 0x%2x%2x%2x (%d %d %d)!\n", clr, COLOR[type][0], COLOR[type][1], COLOR[type][2], COLOR[type][0], COLOR[type][1], COLOR[type][2]); 131 | } 132 | 133 | void SaveColor(int type, int r = -1, int g = -1, int b = -1) 134 | { 135 | if(r == -1) r = COLOR[type][0], g = COLOR[type][1], b = COLOR[type][2]; 136 | iColor[type][0] = r, iColor[type][1] = g, iColor[type][2] = b; 137 | } 138 | 139 | public void OnMapStart() 140 | { 141 | Handle gameConfig = LoadGameConfigFile("funcommands.games"); 142 | if(gameConfig == null) LogError("Unable to load game config funcommands.games"); 143 | else 144 | { 145 | char buffer[PLATFORM_MAX_PATH]; 146 | if(GameConfGetKeyValue(gameConfig, "SpriteBeam", buffer, sizeof(buffer)) && buffer[0]) 147 | hBeam = PrecacheModel(buffer); 148 | if(hBeam == -1) 149 | LogError("Can't find config for SpriteBeam!"); 150 | 151 | if(GameConfGetKeyValue(gameConfig, "SpriteHalo", buffer, sizeof(buffer)) && buffer[0]) 152 | hHalo = PrecacheModel(buffer); 153 | else hHalo = 0; 154 | } 155 | CloseHandle(gameConfig); 156 | } 157 | 158 | public void Event_BulletImpact(Event event, const char[] name, bool dontBroadcast) 159 | { 160 | if(hBeam == -1) 161 | return; 162 | 163 | int client = GetClientOfUserId(event.GetInt("userid")), type; 164 | if(!client || !IsClientInGame(client) || !IsPlayerAlive(client) || (type = GetClientTeam(client)) < 2) 165 | return; 166 | 167 | static float orig[3], vec[3]; 168 | GetClientEyePosition(client, orig); 169 | vec[0] = event.GetFloat("x"); 170 | vec[1] = event.GetFloat("y"); 171 | vec[2] = event.GetFloat("z"); 172 | 173 | TE_SetupBeamPoints(orig, vec, hBeam, hHalo, 0, 0, fLife, fWidth, fWidth, 1, 0.0, iColor[type - 2], 0); 174 | TE_SendToAll(); 175 | } -------------------------------------------------------------------------------- /SM/scripting/sm_medic.sp: -------------------------------------------------------------------------------- 1 | #pragma semicolon 1 2 | #pragma newdecls required 3 | 4 | static const char NAME[] = "Medic", 5 | VERSION[] = "1.0.0"; 6 | 7 | bool bMax, 8 | bUsed[MAXPLAYERS+1]; 9 | int iHP, 10 | m_iMaxHealth; 11 | 12 | public Plugin myinfo = 13 | { 14 | name = NAME, 15 | author = "Grey83", 16 | description = "Лечение единожды за раунд игрока, написавшего команду", 17 | version = VERSION, 18 | url = "https://steamcommunity.com/groups/grey83ds" 19 | }; 20 | 21 | public void OnPluginStart() 22 | { 23 | if((m_iMaxHealth = FindSendPropInfo("CCSPlayer", "m_iMaxHealth")) == -1) 24 | SetFailState("Can't find 'm_iMaxHealth' offset"); 25 | 26 | CreateConVar("sm_medic_version", VERSION, NAME, FCVAR_SPONLY|FCVAR_REPLICATED|FCVAR_NOTIFY|FCVAR_DONTRECORD); 27 | 28 | ConVar CVar; 29 | (CVar = CreateConVar("sm_medic_addhp", "50", "На какое значение увеличивать здоровье (0 - отключить плагин)", _, true, _)).AddChangeHook(CVarChanged_AddHP); 30 | iHP = CVar.IntValue; 31 | 32 | (CVar = CreateConVar("sm_medic_maxhp", "1", "Увеличивать здоровье: 1 - до максимального значения, 0 - выше максимального значения", _, true, _, true, 1.0)).AddChangeHook(CVarChanged_MaxHP); 33 | bMax = CVar.BoolValue; 34 | 35 | HookEvent("round_start", Event_NewRound); 36 | 37 | RegConsoleCmd("sm_medic", Cmd_Medic); 38 | RegConsoleCmd("sm_med", Cmd_Medic); 39 | 40 | AutoExecConfig(true, "medic"); 41 | } 42 | 43 | public void CVarChanged_MaxHP(ConVar CVar, const char[] oldVal, const char[] newVal) 44 | { 45 | bMax = CVar.BoolValue; 46 | } 47 | 48 | public void CVarChanged_AddHP(ConVar CVar, const char[] oldVal, const char[] newVal) 49 | { 50 | iHP = CVar.IntValue; 51 | } 52 | 53 | public void OnClientConnected(int client) 54 | { 55 | bUsed[client] = false; 56 | } 57 | 58 | public void Event_NewRound(Event event, char[] name, bool dontBroadcast) 59 | { 60 | for(int i; i <= MaxClients; i++) bUsed[i] = false; 61 | } 62 | 63 | public Action Cmd_Medic(int client, int args) 64 | { 65 | if(!client || !iHP) 66 | return Plugin_Handled; 67 | 68 | if(!IsPlayerAlive(client)) 69 | { 70 | PrintToChat(client, "Только живые могут использовать эту команду!"); 71 | return Plugin_Handled; 72 | } 73 | 74 | if(bUsed[client]) 75 | { 76 | PrintToChat(client, "Вы можете использовать эту команду только 1 раз за раунд!"); 77 | return Plugin_Handled; 78 | } 79 | 80 | int HP = GetClientHealth(client) + iHP, maxHP = GetEntData(client, m_iMaxHealth); 81 | if(bMax) 82 | { 83 | if((HP - iHP) >= maxHP) 84 | { 85 | PrintToChat(client, "У Вас слишком много здоровья для лечения!"); 86 | return Plugin_Handled; 87 | } 88 | if(HP > maxHP) HP = maxHP; 89 | } 90 | PrintToChat(client, "Ваше здоровье увеличено на %iХП!", HP); 91 | SetEntityHealth(client, HP); 92 | bUsed[client] = true; 93 | 94 | return Plugin_Handled; 95 | } -------------------------------------------------------------------------------- /SM/scripting/sm_parachute_lite 2.5.2.sp: -------------------------------------------------------------------------------- 1 | #pragma semicolon 1 2 | #pragma newdecls required 3 | 4 | #include 5 | 6 | #if SOURCEMOD_V_MINOR > 10 7 | #define PL_NAME "SM Parachute" 8 | #define PL_VER "2.5.2_reduced" 9 | #else 10 | static const char 11 | PL_NAME[] = "SM Parachute", 12 | PL_VER[] = "2.5.2_reduced"; 13 | #endif 14 | 15 | bool 16 | bLinear, 17 | bFalling, 18 | bUsed[MAXPLAYERS+1]; 19 | int 20 | m_vecVelocity = -1; 21 | float 22 | fFallSpeed, 23 | fDecrease; 24 | 25 | public Plugin myinfo = 26 | { 27 | name = PL_NAME, 28 | version = PL_VER, 29 | description = "To use your parachute press and hold SPACE(+jump) button while falling.", 30 | author = "SWAT_88 (rewritten by Grey83)", 31 | url = "https://forums.alliedmods.net/showthread.php?p=580269" 32 | } 33 | 34 | public void OnPluginStart() 35 | { 36 | LoadTranslations("sm_parachute.phrases"); 37 | 38 | CreateConVar("sm_parachute_version", PL_VER, PL_NAME, FCVAR_DONTRECORD|FCVAR_NOTIFY|FCVAR_SPONLY); 39 | 40 | ConVar cvar; 41 | HookConVarChange((cvar = CreateConVar("sm_parachute_linear","0", "0: disables linear fallspeed - 1: enables it", FCVAR_NONE, true, 0.0, true, 1.0)), CVarChanged_Linear); 42 | bLinear = cvar.BoolValue; 43 | 44 | HookConVarChange((cvar = CreateConVar("sm_parachute_fallspeed","100", "Speed of the fall when you use the parachute")), CVarChanged_FallSpeed); 45 | fFallSpeed = cvar.FloatValue; 46 | 47 | HookConVarChange((cvar = CreateConVar("sm_parachute_decrease","50", "0: dont use Realistic velocity-decrease - x: sets the velocity-decrease.")), CVarChanged_Decrease); 48 | fDecrease = cvar.FloatValue; 49 | 50 | AutoExecConfig(true, "sm_parachute_reduced"); 51 | 52 | m_vecVelocity = FindSendPropInfo("CBasePlayer", "m_vecVelocity[0]"); 53 | HookEvent("player_death",PlayerDeath); 54 | } 55 | 56 | public void CVarChanged_Linear(ConVar cvar, const char[] oldValue, const char[] newValue) 57 | { 58 | bLinear = cvar.BoolValue; 59 | if(!bLinear) for(int i = 1; i <= MaxClients; i++) if(IsClientInGame(i) && IsPlayerAlive(i) && bUsed[i]) 60 | SetEntityMoveType(i, MOVETYPE_WALK); 61 | } 62 | 63 | public void CVarChanged_FallSpeed(ConVar cvar, const char[] oldValue, const char[] newValue) 64 | { 65 | fFallSpeed = cvar.FloatValue; 66 | } 67 | 68 | public void CVarChanged_Decrease(ConVar cvar, const char[] oldValue, const char[] newValue) 69 | { 70 | fDecrease = cvar.FloatValue; 71 | } 72 | 73 | public void OnClientPutInServer(int client) 74 | { 75 | bUsed[client] = false; 76 | } 77 | 78 | public void PlayerDeath(Event event, const char[] name, bool dontBroadcast) 79 | { 80 | int client = GetClientOfUserId(event.GetInt("userid")); 81 | EndPara(client); 82 | } 83 | 84 | public void OnGameFrame() 85 | { 86 | static int i; 87 | static float speed[3], fallspeed; 88 | for(i = 1; i <= MaxClients; i++) if(IsClientInGame(i) && IsPlayerAlive(i)) 89 | { 90 | if(GetClientButtons(i) & IN_JUMP) 91 | { 92 | if(!bUsed[i]) 93 | { 94 | bUsed[i] = true; 95 | bFalling = false; 96 | } 97 | fallspeed = fFallSpeed*(-1.0); 98 | GetEntDataVector(i, m_vecVelocity, speed); 99 | if(speed[2] >= fallspeed) bFalling = true; 100 | if(speed[2] < 0.0) 101 | { 102 | if(bFalling && !bLinear) {} 103 | else if(bFalling && bLinear || !fDecrease) speed[2] = fallspeed; 104 | else speed[2] += fDecrease; 105 | TeleportEntity(i, NULL_VECTOR, NULL_VECTOR, speed); 106 | SetEntDataVector(i, m_vecVelocity, speed); 107 | SetEntityGravity(i, 0.1); 108 | } 109 | } 110 | else if(bUsed[i]) 111 | { 112 | bUsed[i] = false; 113 | EndPara(i); 114 | } 115 | GetEntDataVector(i, m_vecVelocity, speed); 116 | if(speed[2] >= 0 || GetEntityFlags(i) & FL_ONGROUND) EndPara(i); 117 | } 118 | } 119 | 120 | stock void EndPara(int client) 121 | { 122 | SetEntityGravity(client, 1.0); 123 | bUsed[client] = false; 124 | } 125 | -------------------------------------------------------------------------------- /SM/scripting/sm_punishment_for_rejoin 1.0.0_16.08.2023.sp: -------------------------------------------------------------------------------- 1 | #pragma semicolon 1 2 | #pragma newdecls required 3 | 4 | #include 5 | #include 6 | #tryinclude 7 | 8 | StringMap 9 | hSId; 10 | Handle 11 | hTimer[MAXPLAYERS+1]; 12 | char 13 | sSId[MAXPLAYERS+1][24]; 14 | 15 | static const char 16 | PL_NAME[] = "Punishment for rejoin", 17 | PL_VER[] = "1.0.0_16.08.2023"; 18 | 19 | public Plugin myinfo = 20 | { 21 | name = PL_NAME, 22 | version = PL_VER, 23 | description = "Kills a player for trying to rejoin during the round", 24 | author = "Grey83", 25 | url = "https://steamcommunity.com/groups/grey83ds" 26 | } 27 | 28 | public void OnPluginStart() 29 | { 30 | hSId = new StringMap(); 31 | 32 | HookEvent("round_start", Event_Start, EventHookMode_PostNoCopy); 33 | HookEvent("player_spawn", Event_Spawn); 34 | } 35 | 36 | public void OnMapStart() 37 | { 38 | OnMapEnd(); 39 | } 40 | 41 | public void OnMapEnd() 42 | { 43 | hSId.Clear(); 44 | 45 | for(int i = 1; i <= MaxClients; i++) 46 | { 47 | sSId[i][0] = 0; 48 | hTimer[i] = null; 49 | } 50 | } 51 | 52 | public void Event_Start(Event event, const char[] name, bool dontBroadcast) 53 | { 54 | hSId.Clear(); 55 | } 56 | 57 | public void OnClientAuthorized(int client, const char[] auth) 58 | { 59 | if(!IsFakeClient(client)) FormatEx(sSId[client], sizeof(sSId[]), auth); 60 | } 61 | 62 | public void Event_Spawn(Event event, const char[] name, bool dontBroadcast) 63 | { 64 | int client = GetClientOfUserId(event.GetInt("userid")), val; 65 | if(client && sSId[client][0] && GetClientTeam(client) > 1 && hSId.GetValue(sSId[client], val)) 66 | hTimer[client] = CreateTimer(0.5, Timer_Punish, GetClientUserId(client), TIMER_FLAG_NO_MAPCHANGE); 67 | } 68 | 69 | public Action Timer_Punish(Handle timer, int client) 70 | { 71 | if(!(client = GetClientOfUserId(client))) 72 | return Plugin_Stop; 73 | 74 | hTimer[client] = null; 75 | 76 | if(GetClientTeam(client) < 2 || !IsPlayerAlive(client)) 77 | return Plugin_Stop; 78 | 79 | IgniteEntity(client, 1.5); // Поджигаем игрока, чтобы он горел пока его бьют молнии 80 | SetVariantString("OnUser2 !self:SetHealth:1:1.4:1"); // и снижаем хп, чтобы под конец он умер 81 | 82 | PrintHintText(client, "Перезаход запрещён!"); 83 | 84 | int tesla; 85 | if((tesla = CreateEntityByName("point_tesla")) == -1) 86 | return Plugin_Stop; 87 | 88 | // https://developer.valvesoftware.com/wiki/Point_tesla 89 | float pos[3]; 90 | GetEntPropVector(client, Prop_Send, "m_vecOrigin", pos); 91 | DispatchKeyValueVector(tesla, "origin", pos); 92 | DispatchKeyValueFloat(tesla, "m_flRadius", 100.0); 93 | DispatchKeyValueFloat(tesla, "beamcount_min", 5.0); // Количество разрядов 94 | DispatchKeyValue(tesla, "texture", "sprites/physbeam.vmt"); 95 | DispatchKeyValue(tesla, "m_Color", "31 127 255"); // Цвет 96 | DispatchKeyValueFloat(tesla, "thick_min", 3.0); // Толщина разрядов 97 | DispatchKeyValueFloat(tesla, "thick_max", 7.0); 98 | DispatchKeyValueFloat(tesla, "lifetime_min", 0.2); // Время существования разряда 99 | DispatchKeyValueFloat(tesla, "lifetime_max", 0.4); 100 | DispatchKeyValueFloat(tesla, "interval_min", 0.4); // Время м/у разрядами 101 | DispatchKeyValueFloat(tesla, "interval_max", 0.6); 102 | 103 | DispatchSpawn(tesla); 104 | 105 | SetVariantString("!activator"); 106 | AcceptEntityInput(client, "SetParent", client, tesla, 0); 107 | 108 | AcceptEntityInput(tesla, "TurnOn"); 109 | AcceptEntityInput(tesla, "DoSpark"); 110 | 111 | SetVariantString("OnUser1 !self:DoSpark::0.3:5"); 112 | AcceptEntityInput(tesla, "AddOutput"); 113 | AcceptEntityInput(tesla, "FireUser1"); 114 | 115 | SetVariantString("OnUser2 !self:Kill::1.5:1"); 116 | AcceptEntityInput(tesla, "AddOutput"); 117 | AcceptEntityInput(tesla, "FireUser2"); 118 | 119 | return Plugin_Stop; 120 | } 121 | 122 | public void OnClientDisconnect(int client) 123 | { 124 | if(!sSId[client][0]) 125 | return; 126 | 127 | if(hTimer[client]) delete hTimer[client]; 128 | hSId.SetValue(sSId[client], 1); 129 | sSId[client][0] = 0; 130 | } -------------------------------------------------------------------------------- /SM/scripting/sm_revival translations.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Grey83/SourceMod-plugins/dfa77f1fb3842f03010d6c7512f21d50f49e65e2/SM/scripting/sm_revival translations.zip -------------------------------------------------------------------------------- /SM/scripting/sm_revival_reward 1.0.2.sp: -------------------------------------------------------------------------------- 1 | #pragma semicolon 1 2 | #pragma newdecls required 3 | 4 | #include 5 | 6 | int 7 | m_iAccount, 8 | iReward, 9 | iLimit = 16000; 10 | 11 | public Plugin myinfo = 12 | { 13 | name = "[Revival] Reward", 14 | version = "1.0.2", 15 | description = "Gives the player money for each player he revives.", 16 | author = "Grey83", 17 | url = "https://steamcommunity.com/groups/grey83ds" 18 | } 19 | 20 | public APLRes AskPluginLoad2(Handle myself, bool late, char[] error, int err_max) 21 | { 22 | if((m_iAccount = FindSendPropInfo("CCSPlayer", "m_iAccount")) == -1) 23 | { 24 | FormatEx(error, err_max, "Unable to find offset CCSPlayer::m_iAccount."); 25 | return APLRes_Failure; 26 | } 27 | return APLRes_Success; 28 | } 29 | 30 | public void OnPluginStart() 31 | { 32 | ConVar cvar = CreateConVar("sm_revival_reward", "300", "How much money to give for revival", _, true, _, true, 16000.0); 33 | cvar.AddChangeHook(CVarChanged_Reward); 34 | iReward = cvar.IntValue; 35 | 36 | if((cvar = FindConVar("mp_maxmoney"))) 37 | { 38 | iLimit = cvar.IntValue; 39 | cvar.AddChangeHook(CVarChanged_Limit); 40 | } 41 | } 42 | 43 | public void CVarChanged_Reward(ConVar cvar, const char[] oldValue, const char[] newValue) 44 | { 45 | iReward = cvar.IntValue; 46 | } 47 | 48 | public void CVarChanged_Limit(ConVar cvar, const char[] oldValue, const char[] newValue) 49 | { 50 | iLimit = cvar.IntValue; 51 | } 52 | 53 | public void Revival_OnPlayerReviving(int reviver, int target, int &frags, int &diff_hp, int &health) 54 | { 55 | if(!iReward) return; 56 | 57 | int money = GetEntData(reviver, m_iAccount); 58 | if(money >= iLimit) return; 59 | 60 | if((money+= iReward) > iLimit) money = iLimit; 61 | SetEntData(reviver, m_iAccount, money); 62 | } -------------------------------------------------------------------------------- /SM/scripting/sm_speed.sp: -------------------------------------------------------------------------------- 1 | #pragma semicolon 1 2 | #pragma newdecls required 3 | 4 | #include 5 | 6 | static const float 7 | MULT[] = 8 | { // https://developer.valvesoftware.com/wiki/Dimensions 9 | 1.0, // units/s 10 | 0.01905, // meters/s 11 | 0.06858, // kilometers/h 12 | 0.04261364 // miles/h 13 | }; 14 | 15 | static const char 16 | PL_NAME[] = "Speed", 17 | PL_VER[] = "1.0.1 01.07.2022", 18 | UNIT[][] = 19 | { 20 | "u/s", 21 | "m/s", 22 | "km/h", 23 | "mph" 24 | }; 25 | 26 | Handle 27 | hCookies, 28 | hTimer, 29 | hHUD; 30 | bool 31 | bLate, 32 | bVertical, 33 | bShow[MAXPLAYERS+1]; 34 | int 35 | iUnit, 36 | iColor; 37 | float 38 | fCD, 39 | fPosX, 40 | fPosY; 41 | 42 | public Plugin myinfo = 43 | { 44 | name = PL_NAME, 45 | version = PL_VER, 46 | description = "The plugin shows the player in the HUD his current speed", 47 | author = "Grey83", 48 | url = "https://steamcommunity.com/groups/grey83ds" 49 | } 50 | 51 | public APLRes AskPluginLoad2(Handle myself, bool late, char[] error, int err_max) 52 | { 53 | bLate = late; 54 | 55 | return APLRes_Success; 56 | } 57 | 58 | public void OnPluginStart() 59 | { 60 | if(!(hHUD = CreateHudSynchronizer())) SetFailState("Can't create HUD"); 61 | 62 | CreateConVar("sm_speed_version", PL_VER, PL_NAME, FCVAR_DONTRECORD|FCVAR_NOTIFY|FCVAR_SPONLY); 63 | 64 | ConVar cvar; 65 | cvar = CreateConVar("sm_speed_update", "0.5", "Speed ​​information refresh rate. 0 - disabled", _, true, _, true, 5.0); 66 | cvar.AddChangeHook(CVarChanged_CD); 67 | fCD = cvar.FloatValue; 68 | 69 | cvar = CreateConVar("sm_speed_unit", "1", "0 - units/s, 1 - meters/s, 2 - kilometers/h, 3 - miles/h", _, true, _, true, 3.0); 70 | cvar.AddChangeHook(CVarChanged_Unit); 71 | iUnit = cvar.IntValue; 72 | 73 | cvar = CreateConVar("sm_speed_vertical", "0", "Take into account the vertical component of the velocity", _, true, _, true, 1.0); 74 | cvar.AddChangeHook(CVarChanged_Vertical); 75 | bVertical = cvar.BoolValue; 76 | 77 | cvar = CreateConVar("sm_speed_color", "007fffff", "HUD info color. Set by HEX (RGB, RGBA, RRGGBB or RRGGBBAA, values 0 - F or 00 - FF, resp.). Wrong color code = white", FCVAR_PRINTABLEONLY); 78 | cvar.AddChangeHook(CVarChanged_Color); 79 | CVarChanged_Color(cvar, NULL_STRING, NULL_STRING); 80 | 81 | cvar = CreateConVar("sm_speed_x", "-1.0", "Position from left to right (-1.0 - center)", _, true, -2.0, true, 1.0); 82 | cvar.AddChangeHook(CVarChanged_PosX); 83 | fPosX = cvar.FloatValue; 84 | 85 | cvar = CreateConVar("sm_speed_y", "0.9", "Position from top to bottom (-1.0 - center)", _, true, -2.0, true, 1.0); 86 | cvar.AddChangeHook(CVarChanged_PosY); 87 | fPosY = cvar.FloatValue; 88 | 89 | AutoExecConfig(true, "sm_speed"); 90 | 91 | hCookies = RegClientCookie("sm_speed", "Show speedometer", CookieAccess_Private); 92 | SetCookieMenuItem(Cookie_Speedometer, 0, PL_NAME); 93 | 94 | if(!bLate) return; 95 | 96 | for(int i = 1; i <= MaxClients; i++) if(IsClientInGame(i) && !IsFakeClient(i)) 97 | { 98 | if(!AreClientCookiesCached(i)) 99 | bShow[i] = true; 100 | else GetCookieValue(i); 101 | } 102 | } 103 | 104 | public void CVarChanged_CD(ConVar cvar, const char[] oldValue, const char[] newValue) 105 | { 106 | fCD = cvar.FloatValue; 107 | OnMapEnd(); 108 | OnMapStart(); 109 | } 110 | 111 | public void CVarChanged_Unit(ConVar cvar, const char[] oldValue, const char[] newValue) 112 | { 113 | iUnit = cvar.IntValue; 114 | } 115 | 116 | public void CVarChanged_Vertical(ConVar cvar, const char[] oldValue, const char[] newValue) 117 | { 118 | bVertical = cvar.BoolValue; 119 | } 120 | 121 | public void CVarChanged_Color(ConVar cvar, const char[] oldValue, const char[] newValue) 122 | { 123 | char clr[12]; 124 | cvar.GetString(clr, sizeof(clr)); 125 | clr[9] = 0; // чтобы проверялось максимум 7 первых символов 126 | 127 | int i; 128 | while(clr[i]) 129 | { 130 | if(!(clr[i] >= '0' && clr[i] <= '9') && !(clr[i] >= 'A' && clr[i] <= 'F') && !(clr[i] >= 'a' && clr[i] <= 'f')) 131 | { // не HEX-число 132 | iColor = -1; // невалидный цвет => 0xFFFFFFFF 133 | LogError("HEX color '%s' isn't valid! HUD color is 0x%x (%d %d %d %d)!", clr, iColor, (iColor & 0xFF000000) >>> 24, (iColor & 0xFF0000) >> 16, (iColor & 0xFF00) >> 8, iColor & 0xFF); 134 | return; 135 | } 136 | i++; 137 | } 138 | 139 | clr[8] = 0; 140 | if(i == 6) // добавляем прозрачность 141 | { 142 | clr[6] = clr[7] = 'F'; 143 | i = 8; 144 | } 145 | if(i == 3 || i == 4) // короткая форма => полная форма 146 | { 147 | if(i == 3) clr[6] = clr[7] = 'F'; // добавляем прозрачность 148 | else clr[6] = clr[7] = clr[3]; 149 | clr[4] = clr[5] = clr[2]; 150 | clr[2] = clr[3] = clr[1]; 151 | clr[1] = clr[0]; 152 | i = 8; 153 | } 154 | 155 | if(i != 8) iColor = -1; // невалидный цвет => 0xFFFFFFFF 156 | else StringToIntEx(clr, iColor , 16); 157 | } 158 | 159 | stock bool StringIsNumeric(const char[] str) 160 | { 161 | if(!str[0]) return false; 162 | 163 | int x; 164 | while(str[x]) 165 | { 166 | if(str[x] < '0' || str[x] > '9') return false; 167 | x++; 168 | } 169 | return true; 170 | } 171 | 172 | public void CVarChanged_PosX(ConVar cvar, const char[] oldValue, const char[] newValue) 173 | { 174 | fPosX = cvar.FloatValue; 175 | } 176 | 177 | public void CVarChanged_PosY(ConVar cvar, const char[] oldValue, const char[] newValue) 178 | { 179 | fPosY = cvar.FloatValue; 180 | } 181 | 182 | public void Cookie_Speedometer(int client, CookieMenuAction action, any info, char[] buffer, int maxlen) 183 | { 184 | if(action == CookieMenuAction_DisplayOption) 185 | FormatEx(buffer, maxlen, "%s: %s", PL_NAME, bShow[client] ? "☑" : "☐"); 186 | else if(action == CookieMenuAction_SelectOption) 187 | { 188 | bShow[client] = !bShow[client]; 189 | SetClientCookie(client, hCookies, bShow[client] ? "1" : "0"); 190 | ShowCookieMenu(client); 191 | } 192 | } 193 | 194 | public void OnMapStart() 195 | { 196 | if(fCD > 0) hTimer = CreateTimer(fCD, Timer_UpdateHUD, _, TIMER_REPEAT); 197 | } 198 | 199 | public void OnClientCookiesCached(int client) 200 | { 201 | if(client && !IsFakeClient(client)) GetCookieValue(client); 202 | } 203 | 204 | stock void GetCookieValue(int client) 205 | { 206 | static char buffer[4]; 207 | GetClientCookie(client, hCookies, buffer, sizeof(buffer)); 208 | bShow[client] = buffer[0] != '0'; 209 | } 210 | 211 | public void OnClientDisconnect(int client) 212 | { 213 | bShow[client] = false; 214 | } 215 | 216 | public void OnMapEnd() 217 | { 218 | if(hTimer) delete hTimer; 219 | } 220 | 221 | public Action Timer_UpdateHUD(Handle timer) 222 | { 223 | SetHudTextParams(fPosX, fPosY, fCD + 0.1, (iColor & 0xFF000000) >>> 24, (iColor & 0xFF0000) >> 16, (iColor & 0xFF00) >> 8, iColor & 0xFF, _, 0.0, _, 0.1); 224 | for(int i = 1; i <= MaxClients; i++) 225 | if(IsClientInGame(i) && bShow[i] && GetClientTeam(i) > 1 && !IsFakeClient(i) && IsPlayerAlive(i)) ShowSpeed(i); 226 | 227 | return Plugin_Continue; 228 | } 229 | 230 | static void ShowSpeed(int client) 231 | { 232 | static float vel[3]; 233 | GetEntPropVector(client, Prop_Data, "m_vecAbsVelocity", vel); 234 | if(!bVertical) vel[2] = 0.0; 235 | 236 | ShowSyncHudText(client, hHUD, "%.3f %s", GetVectorLength(vel) * MULT[iUnit], UNIT[iUnit]); 237 | } 238 | -------------------------------------------------------------------------------- /SM/scripting/sm_stringtable_dumper 1.1.1.sp: -------------------------------------------------------------------------------- 1 | /*======================================================================================= 2 | Change Log: 3 | 4 | 1.1.1 (09-May-2020) 5 | - Some formatting improvements (indication of the number of strings and numeration in dumps). 6 | - Empty stringtables will not saved to logfiles. 7 | 8 | 1.1 (02-Apr-2020) 9 | - Fixed armument quotation (thanks to Bacardi). 10 | 11 | 1.0 (01-Feb-2019) 12 | - Initial release. 13 | 14 | ======================================================================================= 15 | 16 | Credits: 17 | - Dr. Api - for sm string table examples. 18 | 19 | =======================================================================================*/ 20 | 21 | #pragma semicolon 1 22 | #pragma newdecls required 23 | 24 | #include 25 | 26 | static const char 27 | PL_NAME[] = "[DEV] String Tables Dumper", 28 | PL_VER[] = "1.1.1"; 29 | 30 | public Plugin myinfo = 31 | { 32 | name = PL_NAME, 33 | version = PL_VER, 34 | description = "Dumps records of all string tables. For developers.", 35 | author = "Alex Dragokas", 36 | url = "https://github.com/dragokas/ https://forums.alliedmods.net/showthread.php?t=322674" 37 | } 38 | 39 | public void OnPluginStart() 40 | { 41 | CreateConVar("sm_dump_st_version", PL_VER, PL_NAME, FCVAR_DONTRECORD|FCVAR_NOTIFY|FCVAR_SPONLY); 42 | 43 | RegAdminCmd("sm_dump_st", Cmd_DumpStringtables, ADMFLAG_ROOT, " (optional). Dumps ALL stringtables to log files. Show list of stringtables to console. Set num to 1 - to dump user data as well"); 44 | RegAdminCmd("sm_dump_sti", Cmd_DumpStringtableItems, ADMFLAG_ROOT, ". Show contents of this table to console and dumps it in log file."); 45 | } 46 | 47 | public Action Cmd_DumpStringtables(int client, int args) 48 | { 49 | char buffer[PLATFORM_MAX_PATH]; 50 | BuildPath(Path_SM, buffer, sizeof(buffer), "logs/StringTables.log"); 51 | 52 | int num = GetNumStringTables(); 53 | File fileh = OpenFile(buffer, "w"); 54 | if(fileh) 55 | { 56 | fileh.WriteLine("String table list (%d tables):", num); 57 | ReplyToCommand(client, "String table list is saved to: %s", buffer); 58 | } 59 | else ReplyToCommand(client, "Cannot open file for write access: %s", buffer); 60 | 61 | int i; 62 | ReplyToCommand(client, "Listing %d stringtables:", num); 63 | 64 | char name[64]; 65 | for(; i < num; i++) 66 | { 67 | GetStringTableName(i, name, sizeof(name)); 68 | Format(buffer, sizeof(buffer), "%2d. %s (%d/%d strings)", i, name, GetStringTableNumStrings(i), GetStringTableMaxStrings(i)); 69 | ReplyToCommand(client, buffer); 70 | if(fileh) fileh.WriteLine(buffer); 71 | } 72 | if(fileh) fileh.Close(); 73 | 74 | bool dumpUserData; 75 | if(args) 76 | { 77 | char arg[4]; 78 | GetCmdArgString(arg, sizeof(arg)); 79 | dumpUserData = StringToInt(arg) != 0; 80 | } 81 | 82 | for(i = 0; i < num; i++) 83 | { 84 | GetStringTableName(i, name, sizeof(name)); 85 | DumpTable(client, name, dumpUserData); 86 | } 87 | 88 | return Plugin_Handled; 89 | } 90 | 91 | public Action Cmd_DumpStringtableItems(int client, int args) 92 | { 93 | if(!args) 94 | { 95 | ReplyToCommand(client, "Using: sm_dump_sti "); 96 | return Plugin_Handled; 97 | } 98 | 99 | char buffer[64]; 100 | GetCmdArg(1, buffer, sizeof(buffer)); 101 | DumpTable(client, buffer, false, true); 102 | 103 | return Plugin_Handled; 104 | } 105 | 106 | bool DumpTable(int client, char[] name, bool showUserData, bool showCon = false) 107 | { 108 | int table = FindStringTable(name); 109 | if(table == INVALID_STRING_TABLE) 110 | { 111 | ReplyToCommand(client, "Couldn't find %s stringtable.", name); 112 | return false; 113 | } 114 | 115 | int num = GetStringTableNumStrings(table); 116 | if(!num) 117 | { 118 | ReplyToCommand(client, "Empty %s stringtable.", name); 119 | return false; 120 | } 121 | 122 | char path[PLATFORM_MAX_PATH]; 123 | BuildPath(Path_SM, path, sizeof(path), "logs/StringTable_%s.log", name); 124 | 125 | File fileh = OpenFile(path, "w"); 126 | if(!fileh) 127 | { 128 | ReplyToCommand(client, "Cannot open file for write access: %s", path); 129 | if(!showCon) return false; 130 | } 131 | else fileh.WriteLine("Contents of string table \"%s\" (%d strings):", name, num); 132 | 133 | char str[PLATFORM_MAX_PATH], user_data[PLATFORM_MAX_PATH], format[16]; 134 | if(num < 10) 135 | format = showUserData ? "%d. %s (%s)" : "%d. %s"; 136 | else if(num < 100) 137 | format = showUserData ? "%2d. %s (%s)" : "%2d. %s"; 138 | else if(num < 1000) 139 | format = showUserData ? "%3d. %s (%s)" : "%3d. %s"; 140 | else 141 | format = showUserData ? "%4d. %s (%s)" : "%4d. %s"; 142 | 143 | for(int i; i < num;) 144 | { 145 | ReadStringTable(table, i++, str, sizeof(str)); 146 | if(showUserData) 147 | { 148 | if(!GetStringTableData(table, i, user_data, sizeof(user_data))) 149 | user_data[0] = 0; 150 | 151 | if(showCon) ReplyToCommand(client, format, i, str, user_data); 152 | if(fileh) fileh.WriteLine(format, i, str, user_data); 153 | } 154 | else 155 | { 156 | if(showCon) ReplyToCommand(client, format, i, str); 157 | if(fileh) fileh.WriteLine(format, i, str); 158 | } 159 | } 160 | 161 | if(fileh) 162 | { 163 | fileh.Close(); 164 | ReplyToCommand(client, "Dump is saved to: %s", path); 165 | } 166 | return true; 167 | } -------------------------------------------------------------------------------- /SM/scripting/sm_tcl 1.0.1.sp: -------------------------------------------------------------------------------- 1 | #pragma semicolon 1 2 | #pragma newdecls required 3 | 4 | #include 5 | 6 | static const char 7 | PL_NAME[] = "Team change limit", 8 | PL_VER[] = "1.0.1"; 9 | 10 | int 11 | iChanges[MAXPLAYERS+1], 12 | iTeam[MAXPLAYERS+1]; 13 | 14 | public Plugin myinfo = 15 | { 16 | name = PL_NAME, 17 | version = PL_VER, 18 | description = "Limits the number of team changes per round", 19 | author = "Grey83", 20 | url = "https://steamcommunity.com/groups/grey83ds" 21 | } 22 | 23 | public void OnPluginStart() 24 | { 25 | CreateConVar("sm_tcl_version", PL_VER, PL_NAME, FCVAR_DONTRECORD|FCVAR_NOTIFY); 26 | 27 | ConVar cvar; 28 | cvar = CreateConVar("sm_tcl", "3", "Team changes per round", _, true); 29 | cvar.AddChangeHook(CVarChanged); 30 | iChanges[0] = cvar.IntValue; 31 | 32 | HookEvent("player_team", Event_Team); 33 | 34 | RegConsoleCmd("sm_spec", Cmd_Spec, "Join spectators team"); 35 | 36 | AddCommandListener(Cmd_JoinTeam, "jointeam"); 37 | AddCommandListener(Cmd_TeamMenu, "teammenu"); 38 | 39 | AutoExecConfig(true, "team_change_limit"); 40 | } 41 | 42 | public void CVarChanged(ConVar cvar, const char[] oldValue, const char[] newValue) 43 | { 44 | iChanges[0] = cvar.IntValue; 45 | } 46 | 47 | public void OnClientDisconnect_Post(int client) 48 | { 49 | iChanges[client] = iTeam[client] = 0; 50 | } 51 | 52 | public Action CS_OnTerminateRound() 53 | { 54 | for(int i = 1; i <= MaxClients; i++) iChanges[i] = 0; 55 | } 56 | 57 | public void Event_Team(Event event, const char[] name, bool dontBroadcast) 58 | { 59 | static int client, t; 60 | if(!event.GetInt("disconnect") && (client = GetClientOfUserId(event.GetInt("userid"))) && !IsFakeClient(client) 61 | && !event.GetInt("autoteam") && event.GetInt("oldteam") > 1 && (t = event.GetInt("team")) > 1 && iTeam[client] != t) 62 | { 63 | iTeam[client] = t; 64 | iChanges[client]++; 65 | PrintToChat(client, "Осталось %i попыток сменить команду", iChanges[0] - iChanges[client]); 66 | } 67 | } 68 | 69 | public Action Cmd_Spec(int client, int args) 70 | { 71 | if(client) CS_SwitchTeam(client, 1); 72 | return Plugin_Handled; 73 | } 74 | 75 | public Action Cmd_JoinTeam(int client, const char[] cmd, int argc) 76 | { 77 | if(!client || !iTeam[client]) 78 | return Plugin_Continue; 79 | 80 | static char arg[8]; 81 | if(!argc || GetCmdArg(1, arg, 8) > 1 || arg[0] < '1' || arg[0] > '3') 82 | return Plugin_Handled; 83 | 84 | if(arg[0] == '1' || arg[0] - '0' == iTeam[client] || iChanges[client] < iChanges[0]) 85 | return Plugin_Continue; 86 | 87 | PrintToChat(client, "Вы исчерпали лимит переходов между командами за этот раунд."); 88 | return Plugin_Handled; 89 | } 90 | 91 | public Action Cmd_TeamMenu(int client, const char[] cmd, int argc) 92 | { 93 | if(!client || iChanges[client] < iChanges[0]) 94 | return Plugin_Continue; 95 | 96 | PrintToChat(client, "Вы исчерпали лимит переходов между командами за этот раунд.\nПерейти за наблюдателей - !spec"); 97 | return Plugin_Handled; 98 | } -------------------------------------------------------------------------------- /SM/scripting/sm_wpnclnr 1.0.0.sp: -------------------------------------------------------------------------------- 1 | #pragma semicolon 1 2 | #pragma newdecls required 3 | 4 | #include 5 | #include 6 | #include 7 | #if SOURCEMOD_V_MINOR >= 9 8 | #include 9 | #endif 10 | 11 | #if SOURCEMOD_V_MINOR > 10 12 | #define PL_NAME "Weapon cleaner" 13 | #define PL_VER "1.0.0" 14 | #endif 15 | 16 | #if SOURCEMOD_V_MINOR < 11 17 | static const char 18 | PL_NAME[] = "Weapon cleaner", 19 | PL_VER[] = "1.0.0"; 20 | #endif 21 | 22 | Handle 23 | hDropped[2048]; 24 | float 25 | fClear; 26 | 27 | 28 | public Plugin myinfo = 29 | { 30 | name = PL_NAME, 31 | version = PL_VER, 32 | description = "Clears map from dropped weapons", 33 | author = "Grey83", 34 | url = "https://steamcommunity.com/groups/grey83ds" 35 | } 36 | 37 | public void OnPluginStart() 38 | { 39 | CreateConVar("sm_wpnclnr_version", PL_VER, PL_NAME, FCVAR_DONTRECORD|FCVAR_NOTIFY|FCVAR_SPONLY); 40 | 41 | ConVar cvar = CreateConVar("sm_wpnclnr_time", "10", "Time after which the dropped weapon will be removed (-1 - disable cleaning)", _, true, -1.0, true, 86400.0); 42 | cvar.AddChangeHook(CVarChanged_Clear); 43 | CVarChanged_Clear(cvar, NULL_STRING, NULL_STRING); 44 | 45 | AutoExecConfig(true, "weapon_cleaner"); 46 | } 47 | 48 | public void CVarChanged_Clear(ConVar cvar, const char[] oldValue, const char[] newValue) 49 | { 50 | fClear = cvar.IntValue + 0.0; 51 | 52 | static bool hooked; 53 | if((fClear < 0) == !hooked) return; 54 | 55 | hooked = !hooked; 56 | if(hooked) 57 | { 58 | for(int i = 1; i <= MaxClients; i++) if(IsClientInGame(i)) OnClientPutInServer(i); 59 | } 60 | else for(int i = 1; i <= MaxClients; i++) if(IsClientInGame(i)) 61 | { 62 | SDKUnhook(i, SDKHook_WeaponDropPost, OnWeaponDropped); 63 | SDKUnhook(i, SDKHook_WeaponEquipPost, OnWeaponEqiped); 64 | } 65 | } 66 | 67 | public void OnClientPutInServer(int client) 68 | { 69 | if(fClear < 0) return; 70 | 71 | SDKHook(client, SDKHook_WeaponEquip, OnWeaponEqiped); 72 | SDKHook(client, SDKHook_WeaponDrop, OnWeaponDropped); 73 | } 74 | 75 | void OnWeaponDropped(int client, int wpn) 76 | { 77 | if(wpn <= MaxClients) return; 78 | 79 | if(hDropped[wpn]) delete hDropped[wpn]; 80 | hDropped[wpn] = CreateTimer(fClear, Timer_CheckDropped, EntIndexToEntRef(wpn)); 81 | } 82 | 83 | void OnWeaponEqiped(int client, int wpn) 84 | { 85 | if(hDropped[wpn]) delete hDropped[wpn]; 86 | } 87 | 88 | public void OnEntityDestroyed(int entity) 89 | { 90 | if(entity > MaxClients && entity < 2048 && hDropped[entity]) delete hDropped[entity]; 91 | } 92 | 93 | public Action Timer_CheckDropped(Handle timer, any wpn) 94 | { 95 | if((wpn = EntRefToEntIndex(wpn)) != INVALID_ENT_REFERENCE) 96 | { 97 | hDropped[wpn] = null; 98 | 99 | static int zone; 100 | if((zone = CreateEntityByName("env_entity_dissolver")) == -1) 101 | { 102 | AcceptEntityInput(wpn, "Kill"); 103 | return; 104 | } 105 | 106 | static char buffer[16]; 107 | FormatEx(buffer, sizeof(buffer), "dissolve_%i", wpn); 108 | DispatchKeyValue(wpn, "targetname", buffer); 109 | DispatchKeyValue(zone, "target", buffer); 110 | // тип исчезновения: 0 - Energy, 1 - Heavy electrical, 2 - Light electrical, 3 - Core effect 111 | DispatchKeyValue(zone, "dissolvetype", "3"); 112 | DispatchKeyValue(zone, "magnitude", "50"); 113 | 114 | SetVariantString("!activator"); 115 | AcceptEntityInput(zone, "SetParent", wpn, zone, 0); 116 | AcceptEntityInput(zone, "Dissolve"); 117 | } 118 | } 119 | 120 | public void OnMapEnd() 121 | { 122 | for(int i = MaxClients + 1; i < 2048; i++) if(hDropped[i]) delete hDropped[i]; 123 | } -------------------------------------------------------------------------------- /SM/scripting/steam_profile_view 1.0.3_23.04.2025.sp: -------------------------------------------------------------------------------- 1 | #pragma semicolon 1 2 | #pragma newdecls required 3 | 4 | static const char 5 | PL_NAME[] = "Steam Profile View", 6 | PL_VER[] = "1.0.3_23.04.2025"; 7 | 8 | bool 9 | bEnable, 10 | bSelf, 11 | bMotDOff[MAXPLAYERS+1]; 12 | 13 | public Plugin myinfo = 14 | { 15 | name = PL_NAME, 16 | version = PL_VER, 17 | description = "Show Players Steam Profile in MotD Window", 18 | author = "Grey83", 19 | url = "http://steamcommunity.com/groups/grey83ds" 20 | } 21 | 22 | public void OnPluginStart() 23 | { 24 | CreateConVar("sm_spview_version", PL_VER, PL_NAME, FCVAR_DONTRECORD|FCVAR_NOTIFY|FCVAR_SPONLY); 25 | 26 | ConVar cvar; 27 | cvar = CreateConVar("sm_spview_enable", "1", "1/0 - Enable/Disable Plugin", _, true, _, true, 1.0); 28 | cvar.AddChangeHook(CVarChanged_Enable); 29 | bEnable = cvar.BoolValue; 30 | 31 | cvar = CreateConVar("sm_spview_self", "1", "1/0 - Enable/Disable show player his own profile", _, true, _, true, 1.0); 32 | cvar.AddChangeHook(CVarChanged_Self); 33 | bSelf = cvar.BoolValue; 34 | 35 | AutoExecConfig(true, "spview"); 36 | 37 | LoadTranslations("common.phrases"); 38 | 39 | RegConsoleCmd("sm_profile", Cmd_SPView, "Show Players Steam Profile in MotD Window"); 40 | } 41 | 42 | public void CVarChanged_Enable(ConVar cvar, const char[] oldValue, const char[] newValue) 43 | { 44 | bEnable = cvar.BoolValue; 45 | } 46 | 47 | public void CVarChanged_Self(ConVar cvar, const char[] oldValue, const char[] newValue) 48 | { 49 | bSelf = cvar.BoolValue; 50 | } 51 | 52 | public Action Cmd_SPView(int client, int args) 53 | { 54 | if(!bEnable || !client) 55 | return Plugin_Handled; 56 | 57 | QueryClientConVar(client, "cl_disablehtmlmotd", CheckMotD); 58 | 59 | if(!bMotDOff[client]) 60 | { 61 | char name[MAX_NAME_LENGTH], SID[20]; 62 | Menu menu = new Menu(Handler_SPView); 63 | for(int i; ++i <= MaxClients;) 64 | if((client != i || bSelf) && IsClientInGame(i) && !IsFakeClient(i) 65 | && GetClientAuthId(i, AuthId_SteamID64, SID, sizeof(SID))) 66 | { 67 | GetClientName(i, name, sizeof(name)); 68 | menu.AddItem(SID, name); 69 | } 70 | 71 | if(menu.ItemCount > 0) 72 | { 73 | menu.SetTitle("Show Steam profile:"); 74 | menu.ExitButton = true; 75 | menu.Display(client, MENU_TIME_FOREVER); 76 | } 77 | else 78 | { 79 | CloseHandle(menu); 80 | ReplyToCommand(client, "[SM] %t", "No matching clients"); 81 | } 82 | } 83 | else PrintToChat(client, "You need to set 'cl_disablehtmlmotd' to '0' to be able to use this command."); 84 | 85 | return Plugin_Handled; 86 | } 87 | 88 | public void CheckMotD(QueryCookie cookie, int client, ConVarQueryResult result, const char[] cvarName, const char[] cvarValue) 89 | { 90 | bMotDOff[client] = result == ConVarQuery_Okay && StringToInt(cvarValue) > 0; 91 | } 92 | 93 | public int Handler_SPView(Menu menu, MenuAction action, int client, int param) 94 | { 95 | if(action == MenuAction_Select) 96 | { 97 | char link[56], title[MAX_NAME_LENGTH+16]; 98 | menu.GetItem(param, link, sizeof(link), _, title, sizeof(title)); 99 | 100 | KeyValues kv = new KeyValues("data"); 101 | Format(title, sizeof(title), "%s's Steam Profile", title); 102 | kv.SetString("title", title); 103 | kv.SetString("type", "2"); 104 | Format(link, sizeof(link), "http://steamcommunity.com/profiles/%s", link); 105 | kv.SetString("msg", link); 106 | ShowVGUIPanel(client, "info", kv); 107 | delete kv; 108 | 109 | menu.DisplayAt(client, GetMenuSelectionPosition(), MENU_TIME_FOREVER); 110 | } 111 | else if(action == MenuAction_End) CloseHandle(menu); 112 | 113 | return 0; 114 | } 115 | -------------------------------------------------------------------------------- /SM/scripting/supremeredirect 1.2.0_23.03.2025.sp: -------------------------------------------------------------------------------- 1 | #pragma semicolon 1 2 | #pragma newdecls required 3 | 4 | #include 5 | 6 | static const char 7 | PL_NAME[] = "Supreme Redirect System", 8 | PL_VER[] = "1.2.0_23.03.2025"; 9 | 10 | ArrayList 11 | hName, 12 | hAddress; 13 | Menu 14 | hMenu; 15 | int 16 | iMode, 17 | iNum; 18 | char 19 | szCurrentIP[24]; 20 | 21 | public Plugin myinfo = 22 | { 23 | name = PL_NAME, 24 | version = PL_VER, 25 | description = "Uses the new 'redirect' command to make a player join a different server.", 26 | author = "Mitchell, DoopieWop, Grey83", 27 | url = "https://forums.alliedmods.net/showthread.php?t=258010" 28 | } 29 | 30 | public void OnPluginStart() 31 | { 32 | CreateConVar("sm_supremeredirect_version", PL_VER, PL_NAME, FCVAR_SPONLY|FCVAR_NOTIFY|FCVAR_DONTRECORD); 33 | 34 | ConVar cvar = CreateConVar( "sm_supremeredirect_showaddress", "0", "Set to 1 to show the address of the server as a disabled item, 2 to let the player connect to the current server.", _, true, _, true, 2.0); 35 | cvar.AddChangeHook(CVarChange); 36 | iMode = cvar.IntValue; 37 | 38 | AutoExecConfig(); 39 | 40 | RegConsoleCmd("sm_servers", Cmd_Redirect); 41 | RegConsoleCmd("sm_redirect", Cmd_Redirect); 42 | RegConsoleCmd("sm_direct", Cmd_Redirect); 43 | } 44 | 45 | public void CVarChange(ConVar cvar, const char[] oldValue, const char[] newValue) 46 | { 47 | iMode = cvar.IntValue; 48 | } 49 | public Action Cmd_Redirect(int client, int args) 50 | { 51 | if(client && IsClientInGame(client) && hMenu) DisplayMenu(hMenu, client, MENU_TIME_FOREVER); 52 | return Plugin_Handled; 53 | } 54 | 55 | public void OnMapStart() 56 | { 57 | //Could probably use steam tools or something and use this as a fall back method. 58 | // this doesnt work if youre using docker or similar. using steamworks now 59 | int ipaddr[4]; 60 | SteamWorks_GetPublicIP(ipaddr); 61 | 62 | char buffer[PLATFORM_MAX_PATH]; 63 | //GetConVarString(FindConVar("ip"), sHostIP, 32); 64 | FindConVar("hostport").GetString(buffer, 6); // max value = 65535 65 | FormatEx(szCurrentIP, sizeof(szCurrentIP), "%d.%d.%d.%d:%s", ipaddr[0], ipaddr[1], ipaddr[2], ipaddr[3], buffer); 66 | 67 | iNum = 0; 68 | 69 | if(hMenu) CloseHandle(hMenu); 70 | hMenu = new Menu(Menu_Redirect); 71 | 72 | if(hName) CloseHandle(hName); 73 | if(hAddress) CloseHandle(hAddress); 74 | hName = new ArrayList(ByteCountToCells(32)), hAddress = new ArrayList(ByteCountToCells(22)); // "255.255.255.255:65535" = 22 chars 75 | 76 | BuildPath(Path_SM, buffer, sizeof(buffer),"configs/redirect.cfg"); 77 | SMCParser smc = new SMCParser(); 78 | SMC_SetReaders(smc, NewSection, KeyValue, EndSection); 79 | SMC_ParseFile(smc, buffer); 80 | CloseHandle(smc); 81 | 82 | if(!hAddress.Length) 83 | { 84 | LogError("No valid servers in the \"%s\" (%i invalid)!", buffer, iNum); 85 | CloseHandle(hMenu); 86 | } 87 | 88 | hMenu.SetTitle("Server Redirect (%i servers):", hAddress.Length); 89 | hMenu.ExitButton = true; 90 | PrintToServer("[%s] Servers found in the configuration file: %i valid, %i invalid.", PL_NAME, hAddress.Length, iNum - hAddress.Length); 91 | } 92 | 93 | public int Menu_Redirect(Menu menu, MenuAction action, int client, int param) 94 | { 95 | if(action == MenuAction_Select) 96 | { 97 | char buffer[32]; 98 | hAddress.GetString(param, buffer, sizeof(buffer)); 99 | ClientCommand(client, "redirect %s", buffer); 100 | DisplayAskConnectBox(client, 45.0, buffer); 101 | 102 | hName.GetString(param, buffer, sizeof(buffer)); 103 | PrintToChatAll("%N wants to move to server \"%s\"", client, buffer); 104 | } 105 | return 0; 106 | } 107 | 108 | public SMCResult KeyValue(SMCParser smc, const char[] name, const char[] address, bool key_quotes, bool value_quotes) 109 | { 110 | ++iNum; 111 | 112 | if(strlen(address) < 9) // 1.2.3.4:5 113 | { 114 | LogError("Server \"%s\" have invalid address \"%s\" (too short)!", name, address); 115 | return SMCParse_Continue; 116 | } 117 | 118 | int i = -1, prev, len, num; 119 | char buffer[32]; 120 | while(address[++i]) 121 | { 122 | if(!IsCharNumeric(address[i]) && address[i] != '.' && address[i] != ':') // "255.255.255.255:65535" 123 | { 124 | LogError("Server \"%s\" have invalid address \"%s\" (not IP:port)!", name, address); 125 | return SMCParse_Continue; 126 | } 127 | 128 | if(address[i] == '.' || address[i] == ':') // IP check 129 | { 130 | if(++num > 4 || (address[i] == ':' && num != 4)) 131 | { 132 | LogError("Server \"%s\" have invalid IP \"%s\"!", name, address); 133 | return SMCParse_Continue; 134 | } 135 | 136 | if((len = i - prev) < 1 || len > 3) 137 | { 138 | LogError("Server \"%s\" have invalid IP \"%s\"!", name, address); 139 | return SMCParse_Continue; 140 | } 141 | 142 | len++; 143 | FormatEx(buffer, 6, address[prev]); 144 | buffer[len] = 0; 145 | if((len = StringToInt(buffer)) < 0 || len > 255) 146 | { 147 | LogError("Server \"%s\" have invalid IP \"%s\"!", name, address); 148 | return SMCParse_Continue; 149 | } 150 | 151 | prev = i; 152 | } 153 | 154 | FormatEx(buffer, 8, address[prev]); 155 | if((len = StringToInt(buffer)) < 1 || len > 65535) // port check 156 | { 157 | LogError("Server \"%s\" have invalid port \"%s\"!", name, address); 158 | return SMCParse_Continue; 159 | } 160 | } 161 | 162 | FormatEx(buffer, sizeof(buffer), name[0] ? name : address); 163 | 164 | if(!strcmp(address, szCurrentIP)) 165 | { 166 | if(iMode) 167 | { 168 | hMenu.AddItem("", buffer, iMode == 1 ? ITEMDRAW_DISABLED : ITEMDRAW_DEFAULT); 169 | hAddress.PushString(address); 170 | hName.PushString(buffer); 171 | } 172 | 173 | return SMCParse_Continue; 174 | } 175 | 176 | hAddress.PushString(address); 177 | hName.PushString(buffer); 178 | 179 | return SMCParse_Continue; 180 | } 181 | 182 | public SMCResult NewSection(SMCParser smc, const char[] name, bool opt_quotes) { return SMCParse_Continue; } 183 | 184 | public SMCResult EndSection(SMCParser smc) { return SMCParse_Continue; } -------------------------------------------------------------------------------- /SM/scripting/tools_cvarlist.sp: -------------------------------------------------------------------------------- 1 | #pragma semicolon 1 2 | #pragma newdecls required 3 | 4 | static const char 5 | CMD_DUMP[] = "addons/sourcemod/! cmdlist_%Y.%m.%d-%H.%M.%S.cfg", 6 | CVAR_DUMP[] = "addons/sourcemod/! cvarlist_%Y.%m.%d-%H.%M.%S.cfg", 7 | FLAGS[][][] = 8 | { // old flags new flags 9 | {"UNREGISTERED", "UNREGISTERED"}, 10 | {"LAUNCHER", "DEVELOPMENTONLY"}, //new 11 | {"GAMEDLL", "GAMEDLL"}, 12 | {"CLIENTDLL", "CLIENTDLL"}, 13 | {"MATERIAL_SYSTEM", "MATERIAL_SYSTEM"}, 14 | {"PROTECTED", "PROTECTED"}, 15 | {"SPONLY", "SPONLY"}, 16 | {"ARCHIVE", "ARCHIVE"}, 17 | {"NOTIFY", "NOTIFY"}, 18 | {"USERINFO", "USERINFO"}, 19 | {"PRINTABLEONLY", "PRINTABLEONLY"}, 20 | {"UNLOGGED", "UNLOGGED"}, 21 | {"NEVER_AS_STRING", "NEVER_AS_STRING"}, 22 | {"REPLICATED", "REPLICATED"}, 23 | {"CHEAT", "CHEAT"}, 24 | {"STUDIORENDER", "SS"}, //new 25 | {"DEMO", "DEMO"}, 26 | {"DONTRECORD", "DONTRECORD"}, 27 | {"PLUGIN", "SS_ADDED"}, //new 28 | {"DATACACHE", "RELEASE"}, //new 29 | {"TOOLSYSTEM", "RELOAD_MATERIALS"}, //new 30 | {"FILESYSTEM", "FILESYSTEM"}, 31 | {"NOT_CONNECTED", "NOT_CONNECTED"}, 32 | {"SOUNDSYSTEM", "MATERIAL_SYSTEM_THREAD"}, //new 33 | {"ARCHIVE_XBOX", "ARCHIVE_XBOX"}, 34 | {"INPUTSYSTEM", "ACCESSIBLE_FROM_THREADS"}, //new 35 | {"NETWORKSYSTEM", "NETWORKSYSTEM"}, 36 | {"VPHYSICS", "VPHYSICS"}, 37 | {"", "SERVER_CAN_EXECUTE"}, //new 38 | {"", "SERVER_CANNOT_QUERY"}, //new 39 | {"", "CLIENTCMD_CAN_EXECUTE"} //new 40 | }; 41 | 42 | bool bNew; 43 | 44 | public Plugin myinfo = 45 | { 46 | name = "[TOOLS] Cvarlist & Cmdlist", 47 | author = "MCPAN(mcpan@foxmail.com) (rewritten by Grey83)", 48 | description = "List all cvar/cmd value, flags and description.", 49 | version = "1.2.0", 50 | url = "https://forums.alliedmods.net/showthread.php?t=201768" 51 | } 52 | 53 | public void OnPluginStart() 54 | { 55 | bNew = GetEngineVersion() > Engine_SourceSDK2006; 56 | RegServerCmd("tools_cvarlist", tools_cvarlist); 57 | } 58 | 59 | public Action tools_cvarlist(int argc) 60 | { 61 | bool isCommand; 62 | int flags; 63 | Handle cvarIter, cvarTrieDesc = CreateTrie(), cvarTrieFlags = CreateTrie(), cvarArray = CreateArray(ByteCountToCells(256)), cmdTrieDesc = CreateTrie(), cmdTrieFlags = CreateTrie(), 64 | cmdArray = CreateArray(ByteCountToCells(256)); 65 | char buffer[256], desc[1024]; 66 | 67 | do 68 | { 69 | if(!cvarIter) cvarIter = FindFirstConCommand(buffer, sizeof(buffer), isCommand, flags, desc, sizeof(desc)); 70 | 71 | if(isCommand) 72 | { 73 | PushArrayString(cmdArray, buffer); 74 | SetTrieString(cmdTrieDesc, buffer, desc); 75 | SetTrieValue(cmdTrieFlags, buffer, flags); 76 | continue; 77 | } 78 | 79 | PushArrayString(cvarArray, buffer); 80 | SetTrieString(cvarTrieDesc, buffer, desc); 81 | SetTrieValue(cvarTrieFlags, buffer, flags); 82 | } 83 | while(FindNextConCommand(cvarIter, buffer, sizeof(buffer), isCommand, flags, desc, sizeof(desc))); 84 | CloseHandle(cvarIter); 85 | 86 | Handle file; 87 | int size; 88 | char game[32], version[32], appid[16], map[64], path[256], flagsStr[1024], value[256]; 89 | GetCurrentMap(map, sizeof(map)); 90 | GetGameInformation(version, game, appid); 91 | 92 | FormatTime(path, sizeof(path), CMD_DUMP); 93 | file = OpenFile(path, "a+"); 94 | size = GetArraySize(cmdArray); 95 | SortADTArray(cmdArray, Sort_Ascending, Sort_String); 96 | WriteFileLine(file, "// game=%s, version=%s, appid=%s, map=%s, totalcmd=%d\n", game, version, appid, map, size); 97 | 98 | for(int i; i < size; i++) 99 | { 100 | GetArrayString(cmdArray, i, buffer, sizeof(buffer)); 101 | if(GetTrieString(cmdTrieDesc, buffer, desc, sizeof(desc)) && desc[0]) 102 | { 103 | ReplaceString(desc, sizeof(desc), "\n", "\n// "); 104 | WriteFileLine(file, "// %s", desc); 105 | } 106 | 107 | if(GetTrieValue(cmdTrieFlags, buffer, flags) && flags) 108 | { 109 | ConVarFlagsToString(flags, flagsStr, sizeof(flagsStr)); 110 | WriteFileLine(file, "// Flags: %s", flagsStr); 111 | } 112 | 113 | WriteFileLine(file, "%s\n", buffer); 114 | } 115 | CloseHandle(file); 116 | CloseHandle(cmdArray); 117 | CloseHandle(cmdTrieDesc); 118 | CloseHandle(cmdTrieFlags); 119 | PrintToServer("Command dump finished. \"%s\"", path); 120 | 121 | FormatTime(path, sizeof(path), CVAR_DUMP); 122 | file = OpenFile(path, "a+"); 123 | size = GetArraySize(cvarArray); 124 | SortADTArray(cvarArray, Sort_Ascending, Sort_String); 125 | WriteFileLine(file, "// game=%s, version=%s, appid=%s, map=%s, totalcvar=%d\n", game, version, appid, map, size); 126 | 127 | Handle hndl; 128 | float valueMin, valueMax; 129 | for(int i; i < size; i++) 130 | { 131 | GetArrayString(cvarArray, i, buffer, sizeof(buffer)); 132 | if(GetTrieString(cvarTrieDesc, buffer, desc, sizeof(desc)) && desc[0]) 133 | { 134 | ReplaceString(desc, sizeof(desc), "\n", "\n// "); 135 | WriteFileLine(file, "// %s", desc); 136 | } 137 | 138 | if(GetTrieValue(cvarTrieFlags, buffer, flags) && flags) 139 | { 140 | ConVarFlagsToString(flags, flagsStr, sizeof(flagsStr)); 141 | WriteFileLine(file, "// Flags: %s", flagsStr); 142 | } 143 | 144 | flagsStr[0] = 0; 145 | if(GetConVarBounds((hndl = FindConVar(buffer)), ConVarBound_Lower, valueMin)) 146 | { 147 | FloatToStringEx(valueMin, game, sizeof(game)); 148 | FormatEx(flagsStr, sizeof(flagsStr), " Min: \"%s\"", game); 149 | } 150 | 151 | if(GetConVarBounds(hndl, ConVarBound_Upper, valueMax)) 152 | { 153 | FloatToStringEx(valueMax, game, sizeof(game)); 154 | Format(flagsStr, sizeof(flagsStr), "%s%s Max: \"%s\"", flagsStr, flagsStr[0] ? "" : "//", game); 155 | } 156 | 157 | GetConVarDefault(hndl, value, sizeof(value)); 158 | WriteFileLine(file, "//%s Def.: \"%s\"", flagsStr, value); 159 | 160 | GetConVarString(hndl, value, sizeof(value)); 161 | WriteFileLine(file, "%s \"%s\"\n", buffer, value); 162 | } 163 | CloseHandle(file); 164 | CloseHandle(cvarTrieDesc); 165 | CloseHandle(cvarTrieFlags); 166 | CloseHandle(cvarArray); 167 | PrintToServer("ConVar dump finished. \"%s\"", path); 168 | return Plugin_Handled; 169 | } 170 | 171 | stock void ConVarFlagsToString(int flags, char[] flagsStr, int length) 172 | { 173 | flagsStr[0] = 0; 174 | for(int i; i < sizeof(FLAGS); i++) if(flags & (1 << i)) 175 | Format(flagsStr, length, "%s%sFCVAR_%s", flagsStr, flagsStr[0] ? "|" : "", FLAGS[i][view_as(bNew)]); 176 | } 177 | 178 | stock void GetGameInformation(char[] PatchVersion, char[] ProductName, char[] appID) 179 | { 180 | Handle file; 181 | if(!(file = OpenFile("steam.inf", "r"))) 182 | return; 183 | 184 | char buffer[64]; 185 | while(ReadFileLine(file, buffer, sizeof(buffer))) 186 | { 187 | if(!StrContains(buffer, "PatchVersion=")) strcopy(PatchVersion, strlen(buffer) - 13, buffer[13]); 188 | else if(!StrContains(buffer, "ProductName=")) strcopy(ProductName, strlen(buffer) - 12, buffer[12]); 189 | else if(!StrContains(buffer, "appID=")) strcopy(appID, strlen(buffer) - 6, buffer[6]); 190 | } 191 | CloseHandle(file); 192 | } 193 | 194 | stock int FloatToStringEx(float num, char[] str, int maxlength) 195 | { 196 | int len = FloatToString(num, str, maxlength); 197 | for(int i = len - 1, idx; i >= 0; i--) if(str[i] != '0') 198 | { 199 | idx = str[i] == '.' ? 1 : 0; 200 | len = i - idx + 1; 201 | str[len] = 0; 202 | break; 203 | } 204 | return len; 205 | } -------------------------------------------------------------------------------- /SM/scripting/weak_throw_grenade.phrases.txt: -------------------------------------------------------------------------------- 1 | "Phrases" 2 | { 3 | "HintInfo" 4 | { 5 | "en" "For a weak throw use RMB" 6 | "ru" "Для слабого броска используйте ПКМ" 7 | } 8 | } -------------------------------------------------------------------------------- /SM/scripting/weak_throw_grenade.sp: -------------------------------------------------------------------------------- 1 | #pragma semicolon 1 2 | #pragma newdecls required 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | #if SOURCEMOD_V_MINOR > 10 9 | #define PL_NAME "Weak throw grenade" 10 | #define PL_VER "1.3.0_02.10.2021" 11 | #else 12 | static const char 13 | PL_NAME[] = "Weak throw grenade", 14 | PL_VER[] = "1.3.0_02.10.2021"; 15 | #endif 16 | 17 | bool 18 | bLate, 19 | bAdvert[MAXPLAYERS+1], 20 | bGrenade[MAXPLAYERS+1], 21 | bInAttack2[MAXPLAYERS+1]; 22 | int 23 | m_hThrower; 24 | float 25 | fPower; 26 | 27 | public Plugin myinfo = 28 | { 29 | name = PL_NAME, 30 | version = PL_VER, 31 | description = "Weak throw grenade with hold RBM", 32 | author = "lar1ch, Grey83", 33 | url = "https://hlmod.ru/members/lar1ch.125154/" 34 | } 35 | 36 | public APLRes AskPluginLoad2(Handle myself, bool late, char[] error, int err_max) 37 | { 38 | if((m_hThrower = FindSendPropInfo("CBaseGrenade", "m_hThrower")) < 1) 39 | { 40 | FormatEx(error, err_max, "Can't find offset 'CBaseGrenade::m_hThrower'."); 41 | return APLRes_Failure; 42 | } 43 | 44 | bLate = late; 45 | return APLRes_Success; 46 | } 47 | 48 | public void OnPluginStart() 49 | { 50 | LoadTranslations("weak_throw_grenade.phrases"); 51 | 52 | CreateConVar("sm_weak_throw_version", PL_VER, PL_NAME, FCVAR_DONTRECORD|FCVAR_NOTIFY|FCVAR_SPONLY); 53 | 54 | ConVar cvar = CreateConVar("sm_weak_throw_power", "150.0", "Grenade throwing power (512 = normal throwing power)", _, true, 32.0, true, 1024.0); 55 | cvar.AddChangeHook(CVarChange_Power); 56 | fPower = cvar.FloatValue; 57 | 58 | HookEvent("player_spawn", Event_Spawn); 59 | 60 | AutoExecConfig(true, "weak_throw_grenade"); 61 | 62 | if(bLate) 63 | { 64 | for(int i = 1, wpn = FindSendPropInfo("CCSPlayer", "m_hActiveWeapon"); i <= MaxClients; i++) 65 | if(IsClientInGame(i) && !IsFakeClient(i)) 66 | { 67 | SDKHook(i, SDKHook_WeaponSwitch, OnWeaponSwitch); 68 | if(wpn > 0 && IsPlayerAlive(i)) OnWeaponSwitch(i, GetEntDataEnt2(i, wpn)); 69 | } 70 | bLate = false; 71 | } 72 | } 73 | 74 | public void CVarChange_Power(ConVar cvar, const char[] oldValue, const char[] newValue) 75 | { 76 | fPower = cvar.FloatValue; 77 | } 78 | 79 | public void OnClientPutInServer(int client) 80 | { 81 | bInAttack2[client] = bGrenade[client] = false; 82 | if(!IsFakeClient(client)) SDKHook(client, SDKHook_WeaponSwitch, OnWeaponSwitch); 83 | } 84 | 85 | public Action OnWeaponSwitch(int client, int weapon) 86 | { 87 | static char wpn[24]; 88 | GetEntityClassname(weapon, wpn, sizeof(wpn)); 89 | if((bGrenade[client] = !strcmp(wpn[7], "hegrenade") || !strcmp(wpn[7], "flashbang") || !strcmp(wpn[7], "smokegrenade")) && !bAdvert[client]) 90 | { 91 | if(TranslationPhraseExists("HintInfo")) PrintHintText(client, "%t", "HintInfo"); 92 | bAdvert[client] = true; 93 | } 94 | else bInAttack2[client] = false; 95 | } 96 | 97 | public void Event_Spawn(Event event, const char[] name, bool dontBroadcast) 98 | { 99 | bAdvert[GetClientOfUserId(event.GetInt("userid"))] = false; 100 | } 101 | 102 | public Action OnPlayerRunCmd(int client, int &buttons, int &impulse, float vel[3], float angles[3], int &weapon) 103 | { 104 | if(buttons & IN_ATTACK2 && bGrenade[client]) 105 | { 106 | bInAttack2[client] = !(buttons & IN_ATTACK); 107 | buttons |= IN_ATTACK; 108 | return Plugin_Changed; 109 | } 110 | 111 | return Plugin_Continue; 112 | } 113 | 114 | public void OnEntityCreated(int entity, const char[] classname) 115 | { 116 | if(StrContains(classname, "_projectile") > 8) RequestFrame(RequestFrame_Nade, EntIndexToEntRef(entity)); 117 | } 118 | 119 | public void RequestFrame_Nade(int entity) 120 | { 121 | static int client; 122 | if((entity = EntRefToEntIndex(entity)) == INVALID_ENT_REFERENCE 123 | || (client = GetEntDataEnt2(entity, m_hThrower)) < 1 || client > MaxClients 124 | || !bInAttack2[client]) 125 | return; 126 | 127 | float eye[3], pos[3], vel[3]; 128 | GetClientEyePosition(client, eye); 129 | GetEntPropVector(entity, Prop_Data, "m_vecOrigin", pos); 130 | MakeVectorFromPoints(eye, pos, vel); 131 | NormalizeVector(vel, vel); 132 | ScaleVector(vel, fPower); 133 | GetEntPropVector(client, Prop_Data, "m_vecAbsVelocity", pos); 134 | vel[0] += pos[0]; 135 | vel[1] += pos[1]; 136 | vel[2] += pos[2]; 137 | TeleportEntity(entity, NULL_VECTOR, NULL_VECTOR, vel); 138 | } -------------------------------------------------------------------------------- /SM/scripting/weapons_movement_speed 1.0.1_11.02.2023.sp: -------------------------------------------------------------------------------- 1 | #pragma semicolon 1 2 | #pragma newdecls required 3 | 4 | #include 5 | 6 | StringMap 7 | hSpeed; 8 | bool 9 | bLate; 10 | float 11 | fVal; 12 | char 13 | sBuffer[32]; 14 | 15 | public Plugin myinfo = 16 | { 17 | name = "Weapons movement speed", 18 | author = "Grey83", 19 | version = "1.0.1_11.02.2023", 20 | description = "Default movement speed for weapons", 21 | url = "https://steamcommunity.com/groups/grey83ds" 22 | } 23 | 24 | public APLRes AskPluginLoad2(Handle myself, bool late, char[] error, int err_max) 25 | { 26 | bLate = late; 27 | return APLRes_Success; 28 | } 29 | 30 | public void OnPluginStart() 31 | { 32 | HookEvent("round_freeze_end", Event_Start, EventHookMode_PostNoCopy); 33 | } 34 | 35 | public void OnMapStart() 36 | { 37 | if(!hSpeed) hSpeed = CreateTrie(); 38 | if(hSpeed.Size > 0) hSpeed.Clear(); 39 | 40 | char path[PLATFORM_MAX_PATH]; 41 | BuildPath(Path_SM, path, sizeof(path), "configs/weapons_movement_speed.ini"); 42 | KeyValues kv = new KeyValues("Speed"); 43 | if(kv.ImportFromFile(path)) 44 | { 45 | kv.Rewind(); 46 | if(kv.GotoFirstSubKey(false)) 47 | { 48 | do 49 | { 50 | kv.GetSectionName(sBuffer, sizeof(sBuffer)); 51 | if(TrimString(sBuffer) > 1 && (fVal = kv.GetFloat(NULL_STRING)) > 0.0 && fVal != 1.0) 52 | hSpeed.SetValue(sBuffer, fVal); 53 | } while(kv.GotoNextKey(false)); 54 | 55 | if(hSpeed.Size < 1) LogError("Config '%s' does not contain valid values.", path); 56 | } 57 | else LogError("Empty config '%s'.", path); 58 | } 59 | else LogError("Unable to load config '%s'.", path); 60 | delete kv; 61 | 62 | if(!bLate) 63 | return; 64 | 65 | bLate = false; 66 | for(int i = 1; i <= MaxClients; i++) if(IsClientInGame(i) && IsValidPlayer(i)) 67 | { 68 | OnWeaponSwitch(i, 0); 69 | SDKHook(i, SDKHook_WeaponSwitchPost, OnWeaponSwitch); 70 | } 71 | } 72 | 73 | public void Event_Start(Event event, const char[] name, bool dontBroadcast) 74 | { 75 | for(int i = 1; i <= MaxClients; i++) if(IsClientInGame(i) && IsValidPlayer(i)) OnWeaponSwitch(i, 0); 76 | } 77 | 78 | public void OnClientPutInServer(int client) 79 | { 80 | if(IsValidPlayer(client)) SDKHook(client, SDKHook_WeaponSwitchPost, OnWeaponSwitch); 81 | } 82 | 83 | public void OnWeaponSwitch(int client, int weapon) 84 | { 85 | if(hSpeed.Size < 1 || !IsPlayerAlive(client) 86 | || (weapon <= MaxClients && (weapon = GetEntPropEnt(client, Prop_Send, "m_hActiveWeapon")) == -1)) 87 | return; 88 | 89 | GetEdictClassname(weapon, sBuffer, sizeof(sBuffer)); 90 | SetEntPropFloat(client, Prop_Data, "m_flLaggedMovementValue", hSpeed.GetValue(sBuffer[7], fVal) ? fVal : 1.0); 91 | } 92 | 93 | stock bool IsValidPlayer(int client) 94 | { 95 | return !IsFakeClient(client) || !IsClientReplay(client) && !IsClientSourceTV(client); 96 | } -------------------------------------------------------------------------------- /SM/scripting/weapons_movement_speed.ini: -------------------------------------------------------------------------------- 1 | "Speed" 2 | { 3 | "ak47" "1.0" // 1.0 or 0.0 or empty string for default speed 4 | "knife" "1.2" 5 | } -------------------------------------------------------------------------------- /SM/scripting/zone_borders.sp: -------------------------------------------------------------------------------- 1 | #pragma semicolon 1 2 | #pragma newdecls required 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | static const int BORDER_COLOR[] = {127, 31, 0, 255}, 10 | BEAM_COLOR[] = {0, 255, 127, 255}; 11 | 12 | int iNumZones, 13 | hBeam; 14 | float vCorners[4][8][3]; 15 | Handle hTimer[MAXPLAYERS+1]; 16 | 17 | public void OnPluginStart() 18 | { 19 | RegAdminCmd("sm_zones", Cmd_ShowZones, ADMFLAG_ROOT); 20 | } 21 | 22 | public Action Cmd_ShowZones(int client, int args) 23 | { 24 | if(!client) return Plugin_Handled; 25 | 26 | if(hTimer[client] == null) hTimer[client] = CreateTimer(0.2, ShowZones, client, TIMER_REPEAT|TIMER_FLAG_NO_MAPCHANGE); 27 | else 28 | { 29 | KillTimer(hTimer[client]); 30 | hTimer[client] = null; 31 | } 32 | return Plugin_Handled; 33 | } 34 | 35 | public void OnMapStart() 36 | { 37 | char buffer[PLATFORM_MAX_PATH]; 38 | Handle cfg = LoadGameConfigFile("funcommands.games"); 39 | if(cfg == null) SetFailState("Unable to load game config 'funcommands.games'!"); 40 | if(GameConfGetKeyValue(cfg, "SpriteBeam", buffer, sizeof(buffer)) && buffer[0]) hBeam = PrecacheModel(buffer, true); 41 | CloseHandle(cfg); 42 | 43 | GetZonesParameters("func_buyzone"); 44 | } 45 | 46 | public void OnMapEnd() 47 | { 48 | for(int i = 1; i <= MaxClients; i++) if(hTimer[i] != null) hTimer[i] = null; 49 | } 50 | 51 | stock void GetZonesParameters(const char[] name) 52 | { 53 | iNumZones = 0; 54 | int i = -1; 55 | PrintToServer("\n"); 56 | while((i = FindEntityByClassname(i, name)) != -1 && iNumZones < 4) SaveCorners(i); 57 | PrintToServer("Total zones: %i\n", iNumZones); 58 | } 59 | 60 | stock void SaveCorners(const int ent) 61 | { 62 | float min[3], max[3], pos[3]; 63 | GetEntPropVector(ent, Prop_Send, "m_vecOrigin", pos); 64 | GetEntPropVector(ent, Prop_Data, "m_vecMins", min); 65 | GetEntPropVector(ent, Prop_Data, "m_vecMaxs", max); 66 | 67 | PrintToServer("%i) Zone parameters:\n Pos: %.2f %.2f %.2f\n Min: %.2f %.2f %.2f\n Max: %.2f %.2f %.2f", iNumZones, pos[0], pos[1], pos[2], min[0], min[1], min[2], max[0], max[1], max[2]); 68 | AddVectors(pos, min, min); 69 | AddVectors(pos, max, max); 70 | 71 | vCorners[iNumZones][0][0] = min[0]; 72 | vCorners[iNumZones][0][1] = min[1]; 73 | vCorners[iNumZones][0][2] = min[2]; 74 | 75 | vCorners[iNumZones][1][0] = max[0]; 76 | vCorners[iNumZones][1][1] = min[1]; 77 | vCorners[iNumZones][1][2] = min[2]; 78 | 79 | vCorners[iNumZones][2][0] = max[0]; 80 | vCorners[iNumZones][2][1] = max[1]; 81 | vCorners[iNumZones][2][2] = min[2]; 82 | 83 | vCorners[iNumZones][3][0] = min[0]; 84 | vCorners[iNumZones][3][1] = max[1]; 85 | vCorners[iNumZones][3][2] = min[2]; 86 | 87 | vCorners[iNumZones][4][0] = min[0]; 88 | vCorners[iNumZones][4][1] = min[1]; 89 | vCorners[iNumZones][4][2] = max[2]; 90 | 91 | vCorners[iNumZones][5][0] = max[0]; 92 | vCorners[iNumZones][5][1] = min[1]; 93 | vCorners[iNumZones][5][2] = max[2]; 94 | 95 | vCorners[iNumZones][6][0] = max[0]; 96 | vCorners[iNumZones][6][1] = max[1]; 97 | vCorners[iNumZones][6][2] = max[2]; 98 | 99 | vCorners[iNumZones][7][0] = min[0]; 100 | vCorners[iNumZones][7][1] = max[1]; 101 | vCorners[iNumZones][7][2] = max[2]; 102 | 103 | iNumZones++; 104 | } 105 | 106 | public Action ShowZones(Handle timer, any client) 107 | { 108 | static int i; 109 | static float dist[4]; 110 | static char msg[256]; 111 | msg[0] = 0; 112 | if(iNumZones) for(i = 0; i < iNumZones; i++) 113 | { 114 | dist[i] = Effect_DrawBeamBox(client, i); 115 | Format(msg, sizeof(msg), "%sДо зоны #%i: %.2f\n", msg, i, dist[i]); 116 | } 117 | SetHudTextParams(0.01, 0.8, 0.21, 63, 127, 0, 255, 0, 0.0, 0.1, 0.1); 118 | ShowHudText(client, 6, msg); 119 | 120 | return Plugin_Continue; 121 | } 122 | 123 | stock float Effect_DrawBeamBox(const int client, const int zone) 124 | { 125 | static int i, j; 126 | for(i = 0; i < 4; i++) 127 | { 128 | j = (i == 3 ? 0 : i+1); 129 | TE_SetupBeamPoints(vCorners[zone][i], vCorners[zone][j], hBeam, 0, 0, 0, 0.5, 3.0, 3.0, 1, 0.0, BORDER_COLOR, 0); 130 | TE_SendToClient(client); 131 | } 132 | 133 | for(i = 4; i < 8; i++) 134 | { 135 | j = (i == 7 ? 4 : i+1); 136 | TE_SetupBeamPoints(vCorners[zone][i], vCorners[zone][j], hBeam, 0, 0, 0, 0.5, 3.0, 3.0, 1, 0.0, BORDER_COLOR, 0); 137 | TE_SendToClient(client); 138 | } 139 | 140 | for(i = 0; i < 4; i++) 141 | { 142 | TE_SetupBeamPoints(vCorners[zone][i], vCorners[zone][i+4], hBeam, 0, 0, 0, 0.5, 3.0, 3.0, 1, 0.0, BORDER_COLOR, 0); 143 | TE_SendToClient(client); 144 | } 145 | 146 | static float pos[3], closest[3]; 147 | GetClientEyePosition(client, pos); 148 | pos[2] -= 10; 149 | closest = pos; 150 | for(i = 0; i < 3; i++) 151 | { 152 | if(pos[i] < vCorners[zone][0][i]) closest[i] = vCorners[zone][0][i]; 153 | else if(pos[i] > vCorners[zone][6][i]) closest[i] = vCorners[zone][6][i]; 154 | } 155 | 156 | TE_SetupBeamPoints(pos, closest, hBeam, 0, 0, 0, 0.21, 3.0, 3.0, 1, 0.0, BEAM_COLOR, 0); 157 | TE_SendToAll(); 158 | 159 | return GetVectorDistance(pos, closest); 160 | } -------------------------------------------------------------------------------- /Server WH/sm_server_wh texture.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Grey83/SourceMod-plugins/dfa77f1fb3842f03010d6c7512f21d50f49e65e2/Server WH/sm_server_wh texture.zip -------------------------------------------------------------------------------- /[CSGO] Player Hint Info/scripting/csgo_player_hint_info 1.1.0.sp: -------------------------------------------------------------------------------- 1 | #pragma semicolon 1 2 | #pragma newdecls required 3 | 4 | #include 5 | 6 | static const char 7 | PL_VER[] = "1.1.0", 8 | PL_NAME[] = "[CS:GO] Player Hint Info", 9 | 10 | TEAM[][] = {"Enemy", "Ally", "Terrorist", "Counter-Terrorist"}; 11 | 12 | Handle 13 | hTimer; 14 | int 15 | iShow, 16 | iHP, 17 | iTeam[MAXPLAYERS+1]; 18 | 19 | public Plugin myinfo = 20 | { 21 | name = PL_NAME, 22 | version = PL_VER, 23 | description = "Shows information about the target player in the HUD in CS:GO", 24 | author = "Grey83", 25 | url = "https://steamcommunity.com/groups/grey83ds" 26 | }; 27 | 28 | public void OnPluginStart() 29 | { 30 | if(GetEngineVersion() != Engine_CSGO) SetFailState("This plugin for CSGO only!"); 31 | 32 | CreateConVar("csgo_hint_info_version", PL_VER, PL_NAME, FCVAR_SPONLY|FCVAR_NOTIFY|FCVAR_DONTRECORD); 33 | 34 | ConVar cvar; // 35 | cvar = CreateConVar("sm_hint_info_show", "27", "Show info to the: 0 - nobody, 1 - spectators, 2 - allies, 4 - enemies, 8 - alive, 16 - dead", _, true, _, true, 31.0); 36 | cvar.AddChangeHook(CVarChanged_Show); 37 | CVarChanged_Show(cvar, NULL_STRING, NULL_STRING); 38 | 39 | cvar = CreateConVar("sm_hint_info_hp", "26", "Show health to the: 0 - nobody, 1 - spectators, 2 - allies, 4 - enemies, 8 - alive, 16 - dead", _, true, _, true, 31.0); 40 | cvar.AddChangeHook(CVarChanged_Health); 41 | iHP = cvar.IntValue; 42 | 43 | HookEvent("player_team", Event_Team); 44 | 45 | LoadTranslations("csgo_hint_info.phrases"); 46 | 47 | AutoExecConfig(true, "csgo_hint_info"); 48 | } 49 | 50 | public void CVarChanged_Show(ConVar cvar, const char[] oldValue, const char[] newValue) 51 | { 52 | iShow = cvar.IntValue; 53 | if(!iShow == !hTimer) return; 54 | 55 | if(!hTimer) NewTimer(); 56 | else delete hTimer; 57 | } 58 | 59 | public void CVarChanged_Health(ConVar cvar, const char[] oldValue, const char[] newValue) 60 | { 61 | iHP = cvar.IntValue; 62 | } 63 | 64 | public void OnMapStart() 65 | { 66 | if(iShow && !hTimer) NewTimer(); 67 | } 68 | 69 | public void OnMapEnd() 70 | { 71 | if(hTimer) delete hTimer; 72 | } 73 | 74 | stock void NewTimer() 75 | { 76 | hTimer = CreateTimer(0.5, Timer_Hint, _, TIMER_REPEAT); 77 | } 78 | 79 | public void Event_Team(Event event, const char[] name, bool dontBroadcast) 80 | { 81 | static int client; 82 | if((client = GetClientOfUserId(event.GetInt("userid")))) iTeam[client] = event.GetInt("team"); 83 | } 84 | 85 | public Action Timer_Hint(Handle timer) 86 | { 87 | static int i, j, target; 88 | static bool spec, alive, ally, hp; 89 | static char name[MAX_NAME_LENGTH]; 90 | for(i = 1; i <= MaxClients; i++) if(IsClientInGame(i) && !IsFakeClient(i) && iTeam[i]) 91 | { 92 | if((spec = iTeam[i] == 1) && !(iShow & 1) 93 | || !spec && (((alive = !spec && IsPlayerAlive(i)) && !(iShow & 8)) || (!alive && !(iShow & 16))) 94 | || (target = GetClientAimTarget(i, false)) < 1 || target > MaxClients || !IsClientInGame(target) 95 | || iTeam[target] < 2 || !IsPlayerAlive(target) 96 | || !spec && (((ally = iTeam[i] == iTeam[target]) && !(iShow & 2)) || (!ally && !(iShow & 4)))) 97 | continue; 98 | 99 | hp = spec && iHP & 1 || !spec && (ally && iHP & 2 || !ally && iHP & 4) && (alive && iHP & 8 || !alive && iHP & 16); 100 | GetClientName(target, name, sizeof(name)); 101 | j = spec ? iTeam[target] : (ally ? 1 : 0); 102 | if(hp) PrintHintText(i, "%t", "InfoHealht", name, GetClientHealth(target), TEAM[j]); 103 | else PrintHintText(i, "%t", "InfoNoHealht", name, TEAM[j]); 104 | } 105 | } -------------------------------------------------------------------------------- /[CSGO] Player Hint Info/translations/csgo_hint_info.phrases.txt: -------------------------------------------------------------------------------- 1 | "Phrases" 2 | { 3 | "InfoNoHealht" 4 | { 5 | "#format" "{1:s},{2:t}" 6 | "en" "{1}
{2}" 7 | } 8 | "InfoHealht" 9 | { 10 | "#format" "{1:s},{2:i},{3:t}" 11 | "en" "{1}
{2} HP
{3}" 12 | } 13 | 14 | "Enemy" 15 | { 16 | "en" "enemy" 17 | } 18 | "Ally" 19 | { 20 | "en" "ally" 21 | } 22 | "Terrorist" 23 | { 24 | "en" "terrorist" 25 | } 26 | "Counter-Terrorist" 27 | { 28 | "en" "counter-terrorist" 29 | } 30 | } -------------------------------------------------------------------------------- /[CSGO] Player Hint Info/translations/fr/csgo_hint_info.phrases.txt: -------------------------------------------------------------------------------- 1 | "Phrases" 2 | { 3 | "InfoNoHealht" 4 | { 5 | "fr" "{1}
{2}" 6 | } 7 | "InfoHealht" 8 | { 9 | "fr" "{1}
{2} HP
{3}" 10 | } 11 | 12 | "Enemy" 13 | { 14 | "fr" "ennemi" 15 | } 16 | "Ally" 17 | { 18 | "fr" "allié" 19 | } 20 | "Terrorist" 21 | { 22 | "fr" "terroriste" 23 | } 24 | "Counter-Terrorist" 25 | { 26 | "fr" "anti-terroriste" 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /[CSGO] Player Hint Info/translations/ru/csgo_hint_info.phrases.txt: -------------------------------------------------------------------------------- 1 | "Phrases" 2 | { 3 | "InfoNoHealht" 4 | { 5 | "ru" "{1}
{2}" 6 | } 7 | "InfoHealht" 8 | { 9 | "ru" "{1}
{2} ХП
{3}" 10 | } 11 | 12 | "Enemy" 13 | { 14 | "ru" "враг" 15 | } 16 | "Ally" 17 | { 18 | "ru" "союзник" 19 | } 20 | "Terrorist" 21 | { 22 | "ru" "террорист" 23 | } 24 | "Counter-Terrorist" 25 | { 26 | "ru" "спецназ" 27 | } 28 | } -------------------------------------------------------------------------------- /_config.yml: -------------------------------------------------------------------------------- 1 | theme: jekyll-theme-midnight --------------------------------------------------------------------------------