├── ActionsLogs └── ActionsLogs.sp ├── afk_autokick └── afk_autokick.sp ├── amxx ├── GameMenu │ ├── addons │ │ └── amxmodx │ │ │ ├── configs │ │ │ ├── gamemenu.txt │ │ │ └── gamemenu_default.txt │ │ │ ├── data │ │ │ └── lang │ │ │ │ └── gm.txt │ │ │ └── scripting │ │ │ └── gamemenu.sma │ └── resource │ │ └── GameMenu.tga ├── Shield_Force │ ├── addons │ │ └── amxmodx │ │ │ └── scripting │ │ │ └── shield_force.sma │ ├── models │ │ └── zombie_plague │ │ │ ├── aura8.mdl │ │ │ ├── v_auragren.mdl │ │ │ └── w_aura.mdl │ └── sound │ │ └── debris │ │ ├── beamstart1.wav │ │ ├── beamstart10.wav │ │ └── beamstart6.wav ├── zp_addon_bonus_box │ ├── addons │ │ └── amxmodx │ │ │ ├── configs │ │ │ ├── zp_addon_bonusbox.cfg │ │ │ ├── zp_bx_extra_humans.ini │ │ │ └── zp_bx_extra_zombies.ini │ │ │ ├── data │ │ │ └── lang │ │ │ │ └── bonus_box.txt │ │ │ └── scripting │ │ │ └── zp_addon_bonus_box.sma │ ├── models │ │ └── zombie_plague │ │ │ └── presents.mdl │ ├── sound │ │ └── warcraft3 │ │ │ ├── impalehit.wav │ │ │ └── impalelaunch1.wav │ └── sprites │ │ └── bonusbox.spr ├── zp_extra_hook │ └── zp_extra_hook.sma ├── zp_extra_radar │ └── zp_extra_radar.sma ├── zp_extra_wallclimb │ └── zp_extra_wallclimb.sma └── zp_rand_lighting │ └── zp_rand_lighting.sma ├── antiflood └── antiflood.sp ├── basebans_mysql ├── banreasons.txt ├── bans.php ├── basebans.sp └── dump.sql ├── csgo_damagemod └── csgo_damagemod.sp ├── csgo_obuy └── csgo_obuy.sp ├── csgo_zp_semiclip ├── semiclip.phrases.txt └── zp_semiclip.sp ├── l4d2_AddonsController └── AddonsController.sp ├── l4d2_SpeakingList └── SpeakingList.sp ├── l4d2_afkmanager └── afkmanager.sp ├── l4d2_bwpu └── l4d2_bwpu.sp ├── l4d2_incap_magnum └── l4d2_incap_magnum.sp ├── l4d2_loot └── l4d2_loot.sp ├── l4d2_meleefix └── l4d2meleefix.sp ├── l4d2_meleeunlock ├── gamedata │ └── l4d2_meleeunlock.txt └── scripting │ └── l4d2_meleeunlock.sp ├── l4d2_model_select └── l4d2_model_select.sp ├── l4d2_multitanks ├── gamedata │ └── multitanks.txt └── scripting │ └── multitanks.sp ├── l4d2_srcds_crash_fix ├── srcds_crash_fix.sp └── srcds_crash_fix.txt ├── l4d2_tank_hud └── tank_hud.sp ├── l4d2_wsc └── l4d2_wsc.sp ├── l4d2mapfinalenext ├── l4d2mapfinalenext.sp └── l4d2vsmapfinalenext.sp ├── l4d2spitterautokill └── l4d2spitterautokill.sp ├── l4d_announce_spam ├── l4d_announce.txt └── l4d_announce_spam.sp ├── l4d_counters └── l4d_counters.sp ├── l4d_drop └── l4d_drop.sp ├── l4d_remove_weapons └── l4d_remove_weapons.sp ├── l4d_tanknoblock └── l4d_tanknoblock.sp ├── l4fix ├── l4fix.sp └── l4fix.txt ├── permamute └── permamute.sp ├── selfMute └── selfMute.sp ├── smac_wallhack └── smac_wallhack.sp ├── snow └── snow.sp └── tz_api ├── data └── sqlite │ └── time_zone.sq3 └── scripting ├── include └── tz.inc ├── tz_api.sp └── tz_example.sp /ActionsLogs/ActionsLogs.sp: -------------------------------------------------------------------------------- 1 | #pragma semicolon 1 2 | #include 3 | 4 | char fileCmds[PLATFORM_MAX_PATH]; 5 | char fileChat[PLATFORM_MAX_PATH]; 6 | char adminCmds[PLATFORM_MAX_PATH]; 7 | 8 | StringMap hCommandsTrie; 9 | 10 | public Plugin myinfo = 11 | { 12 | name = "Actions Logs", 13 | author = "Accelerator", 14 | description = "Logs of chat, commands and actions of administrators", 15 | version = "2.0", 16 | url = "https://github.com/accelerator74/sp-plugins" 17 | }; 18 | 19 | public void OnPluginStart() 20 | { 21 | BuildPath(Path_SM, fileCmds, sizeof(fileCmds), "logs/cmds.log"); 22 | BuildPath(Path_SM, fileChat, sizeof(fileChat), "logs/chat.log"); 23 | 24 | char buffer[PLATFORM_MAX_PATH]; 25 | BuildPath(Path_SM, buffer, sizeof(buffer), "logs/admins"); 26 | if (!DirExists(buffer)) 27 | { 28 | CreateDirectory(buffer, 511); 29 | } 30 | 31 | hCommandsTrie = new StringMap(); 32 | } 33 | 34 | public void OnMapStart() 35 | { 36 | hCommandsTrie.Clear(); 37 | 38 | char name[128]; 39 | CommandIterator it = new CommandIterator(); 40 | 41 | while (it.Next()) 42 | { 43 | it.GetName(name, sizeof(name)); 44 | hCommandsTrie.SetValue(name, it.Flags); 45 | } 46 | 47 | delete it; 48 | } 49 | 50 | public Action OnClientCommand(int client, int args) 51 | { 52 | char CommandName[128]; 53 | GetCmdArg(0, CommandName, sizeof(CommandName)); 54 | 55 | int flags; 56 | if (!hCommandsTrie.GetValue(CommandName, flags)) 57 | return Plugin_Continue; 58 | 59 | AdminId admin_id = GetUserAdmin(client); 60 | 61 | if (args > 0) 62 | { 63 | char argstring[255]; 64 | GetCmdArgString(argstring, sizeof(argstring)); 65 | LogToFileEx(fileCmds, "%N - %s [%s]", client, CommandName, argstring); 66 | 67 | if (flags && admin_id != INVALID_ADMIN_ID) 68 | { 69 | char PlayerName[MAX_NAME_LENGTH]; 70 | if (!GetAdminUsername(admin_id, PlayerName, sizeof(PlayerName))) 71 | strcopy(PlayerName, sizeof(PlayerName), "Unknown"); 72 | 73 | BuildPath(Path_SM, adminCmds, sizeof(adminCmds), "logs/admins/%s.log", PlayerName); 74 | LogToFileEx(adminCmds, "%N - %s [%s]", client, CommandName, argstring); 75 | } 76 | 77 | return Plugin_Continue; 78 | } 79 | 80 | LogToFileEx(fileCmds, "%N - %s", client, CommandName); 81 | 82 | if (flags && admin_id != INVALID_ADMIN_ID) 83 | { 84 | char PlayerName[MAX_NAME_LENGTH]; 85 | if (!GetAdminUsername(admin_id, PlayerName, sizeof(PlayerName))) 86 | strcopy(PlayerName, sizeof(PlayerName), "Unknown"); 87 | 88 | BuildPath(Path_SM, adminCmds, sizeof(adminCmds), "logs/admins/%s.log", PlayerName); 89 | LogToFileEx(adminCmds, "%N - %s", client, CommandName); 90 | } 91 | 92 | return Plugin_Continue; 93 | } 94 | 95 | public Action OnLogAction(Handle source, Identity ident, int client, int target, const char[] message) 96 | { 97 | if (client < 1) 98 | return Plugin_Continue; 99 | 100 | AdminId admin_id = GetUserAdmin(client); 101 | 102 | if (admin_id == INVALID_ADMIN_ID) 103 | return Plugin_Continue; 104 | 105 | char PlayerName[MAX_NAME_LENGTH]; 106 | if (!GetAdminUsername(admin_id, PlayerName, sizeof(PlayerName))) 107 | strcopy(PlayerName, sizeof(PlayerName), "Unknown"); 108 | 109 | BuildPath(Path_SM, adminCmds, sizeof(adminCmds), "logs/admins/%s.log", PlayerName); 110 | LogToFileEx(adminCmds, "%N - %s", client, message); 111 | 112 | return Plugin_Continue; 113 | } 114 | 115 | public Action OnClientSayCommand(int client, const char[] command, const char[] szArgs) 116 | { 117 | if (!client) 118 | return Plugin_Continue; 119 | 120 | if (!IsClientInGame(client)) 121 | return Plugin_Continue; 122 | 123 | LogToFileEx(fileChat, "[%N]: %s", client, szArgs); 124 | 125 | return Plugin_Continue; 126 | } -------------------------------------------------------------------------------- /afk_autokick/afk_autokick.sp: -------------------------------------------------------------------------------- 1 | #pragma semicolon 1 2 | #pragma newdecls required 3 | 4 | #include 5 | 6 | StringMap hUserIdTrie; 7 | 8 | public Plugin myinfo = 9 | { 10 | name = "AFK Autokick", 11 | author = "Accelerator", 12 | description = "AutoKick AFK Players", 13 | version = "5.1", 14 | url = "https://github.com/accelerator74/sp-plugins" 15 | } 16 | 17 | public void OnPluginStart() 18 | { 19 | hUserIdTrie = new StringMap(); 20 | 21 | HookEvent("player_team", Event_PlayerTeam); 22 | HookEvent("player_disconnect", Event_PlayerDisconnect); 23 | 24 | char userid[11]; 25 | for(int i = 1; i <= MaxClients; i++) 26 | { 27 | if (IsClientInGame(i) && !IsFakeClient(i) && GetClientTeam(i) <= 1) 28 | { 29 | IntToString(GetClientUserId(i), userid, sizeof(userid)); 30 | hUserIdTrie.SetValue(userid, i); 31 | } 32 | } 33 | } 34 | 35 | public void OnMapStart() 36 | { 37 | CreateTimer(60.0, TimerCheck, _, TIMER_REPEAT|TIMER_FLAG_NO_MAPCHANGE); 38 | } 39 | 40 | public Action TimerCheck(Handle timer) 41 | { 42 | int CurTime = GetTime(); 43 | 44 | int time; 45 | char userid[11]; 46 | 47 | for (int i=1; i<=MaxClients; i++) 48 | { 49 | if (IsClientInGame(i) && !IsFakeClient(i)) 50 | { 51 | if (GetClientTeam(i) == 1) 52 | { 53 | if (GetUserAdmin(i) == INVALID_ADMIN_ID) 54 | { 55 | IntToString(GetClientUserId(i), userid, sizeof(userid)); 56 | if (hUserIdTrie.GetValue(userid, time)) 57 | { 58 | int specTime = CurTime - time; 59 | if (specTime >= 360) 60 | { 61 | KickClient(i, "You were AFK for too long (%i sec)", specTime); 62 | } 63 | else 64 | { 65 | PrintToChat(i, "\x05AFK Time: \x03%i sec", specTime); 66 | } 67 | } 68 | } 69 | } 70 | } 71 | } 72 | 73 | return Plugin_Continue; 74 | } 75 | 76 | public void Event_PlayerTeam(Event event, const char[] name, bool dontBroadcast) 77 | { 78 | int userid = event.GetInt("userid"); 79 | int client = GetClientOfUserId(userid); 80 | 81 | if (!client) 82 | return; 83 | 84 | if (!IsClientInGame(client)) 85 | return; 86 | 87 | if (IsFakeClient(client)) 88 | return; 89 | 90 | char sUserID[11]; 91 | IntToString(userid, sUserID, sizeof(sUserID)); 92 | 93 | if (event.GetInt("team") <= 1) 94 | { 95 | int time; 96 | if (!hUserIdTrie.GetValue(sUserID, time)) 97 | { 98 | hUserIdTrie.SetValue(sUserID, GetTime()); 99 | } 100 | } 101 | else 102 | { 103 | hUserIdTrie.Remove(sUserID); 104 | } 105 | } 106 | 107 | public void Event_PlayerDisconnect(Event event, const char[] name, bool dontBroadcast) 108 | { 109 | char userid[11]; 110 | IntToString(event.GetInt("userid"), userid, sizeof(userid)); 111 | hUserIdTrie.Remove(userid); 112 | } 113 | -------------------------------------------------------------------------------- /amxx/GameMenu/addons/amxmodx/configs/gamemenu.txt: -------------------------------------------------------------------------------- 1 | "GameMenu" { "1" { "label" "#GameUI_GameMenu_ResumeGame" "command" "ResumeGame" "OnlyInGame" "1" } "2" { "label" "#GameUI_GameMenu_Disconnect" "command" "Disconnect" "OnlyInGame" "1" "notsingle" "1" } "4" { "label" "#GameUI_GameMenu_PlayerList" "command" "OpenPlayerListDialog" "OnlyInGame" "1" "notsingle" "1" } "5" { "label" "" "command" "" "OnlyInGame" "1" } "6" { "label" "CORE-SS / Multi [Classic, CSDM]" "command" "engine Connect multi.core-ss.org:27015" } "7" { "label" "CORE-SS / Zombie Plague" "command" "engine Connect zm.core-ss.org:27016" } "8" { "label" "" "command" "" } "9" { "label" "#GameUI_GameMenu_NewGame" "command" "OpenCreateMultiplayerGameDialog" } "10" { "label" "#GameUI_GameMenu_FindServers" "command" "OpenServerBrowser" } "11" { "label" "#GameUI_GameMenu_Options" "command" "OpenOptionsDialog" } "12" { "label" "#GameUI_GameMenu_Quit" "command" "Quit" } } -------------------------------------------------------------------------------- /amxx/GameMenu/addons/amxmodx/configs/gamemenu_default.txt: -------------------------------------------------------------------------------- 1 | "GameMenu" { "1" { "label" "#GameUI_GameMenu_ResumeGame" "command" "ResumeGame" "OnlyInGame" "1" } "2" { "label" "#GameUI_GameMenu_Disconnect" "command" "Disconnect" "OnlyInGame" "1" "notsingle" "1" } "4" { "label" "#GameUI_GameMenu_PlayerList" "command" "OpenPlayerListDialog" "OnlyInGame" "1" "notsingle" "1" } "5" { "label" "" "command" "" "OnlyInGame" "1" } "8" { "label" "" "command" "" } "9" { "label" "#GameUI_GameMenu_NewGame" "command" "OpenCreateMultiplayerGameDialog" } "10" { "label" "#GameUI_GameMenu_FindServers" "command" "OpenServerBrowser" } "11" { "label" "#GameUI_GameMenu_Options" "command" "OpenOptionsDialog" } "12" { "label" "#GameUI_GameMenu_Quit" "command" "Quit" } } -------------------------------------------------------------------------------- /amxx/GameMenu/addons/amxmodx/data/lang/gm.txt: -------------------------------------------------------------------------------- 1 | [en] 2 | SETMENUCMD = Say /setmenu or /servers to install our servers in your game menu 3 | OK = Your game menu changed! 4 | DEFAULT = Say /resmenu to reset your game menu to default 5 | 6 | [ru] 7 | SETMENUCMD = Say /setmenu или say /servers для установки наших серверов в ваше игровое меню 8 | OK = Ваше игровое меню изменено! 9 | DEFAULT = Say /resmenu чтобы вернуть ваше игровое меню в начальное состояние -------------------------------------------------------------------------------- /amxx/GameMenu/addons/amxmodx/scripting/gamemenu.sma: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/accelerator74/sp-plugins/08b3580d350d48b1936da83a36e1903dd7899429/amxx/GameMenu/addons/amxmodx/scripting/gamemenu.sma -------------------------------------------------------------------------------- /amxx/GameMenu/resource/GameMenu.tga: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/accelerator74/sp-plugins/08b3580d350d48b1936da83a36e1903dd7899429/amxx/GameMenu/resource/GameMenu.tga -------------------------------------------------------------------------------- /amxx/Shield_Force/addons/amxmodx/scripting/shield_force.sma: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | #define PLUGIN "[ZP] Extra Item: Force Field Grenade" 9 | #define VERSION "v2.1 (Fixed)" 10 | #define AUTHOR "lucas_7_94 & Accelerator" // Thanks To Users in credits too!. 11 | 12 | #define ValidTouch(%1) ( is_user_alive(%1) && ( zp_get_user_zombie(%1) || zp_get_user_nemesis(%1) ) ) 13 | 14 | /*=============================[Plugin Customization]=============================*/ 15 | #define CAMPO_TASK 16 | #define TASK_TIME 60.0 17 | 18 | //#define CAMPO_ROUND 19 | 20 | #define RANDOM_COLOR 21 | //#define ONE_COLOR 22 | 23 | new const NADE_TYPE_CAMPO = 3679 24 | 25 | #if defined ONE_COLOR 26 | new Float:CampoColors[3] = { 27 | 255.0 , // r 28 | 0.0 , // g 29 | 0.0 // b 30 | } 31 | #endif 32 | 33 | new const model_grenade[] = "models/zombie_plague/v_auragren.mdl" 34 | new const model[] = "models/zombie_plague/aura8.mdl" 35 | new const w_model[] = "models/zombie_plague/w_aura.mdl" 36 | new const gModelGlass[] = "models/glassgibs.mdl" 37 | new const sprite_grenade_trail[] = "sprites/laserbeam.spr" 38 | new const entclas[] = "campo_grenade_forze" 39 | new const recieving_sound[] = "items/9mmclip1.wav" 40 | new const gSoundTouch[] = "debris/beamstart6.wav" 41 | new const gSoundOpen[] = "debris/beamstart1.wav" 42 | new const gSoundClose[] = "debris/beamstart10.wav" 43 | 44 | new g_trailSpr, cvar_push, g_SayText, g_msgAmmoPickup, g_itemID, g_maxplayers, gGlass 45 | 46 | new bool:g_bomb[33] 47 | 48 | const item_cost = 15 49 | /*=============================[End Customization]=============================*/ 50 | 51 | public plugin_init() 52 | { 53 | register_plugin(PLUGIN, VERSION, AUTHOR) 54 | 55 | RegisterHam(Ham_Think, "grenade", "fw_ThinkGrenade") 56 | RegisterHam(Ham_Killed, "player", "fw_PlayerKilled") 57 | register_event("CurWeapon", "Event_CurWeapon", "be","1=1") 58 | register_forward(FM_SetModel, "fw_SetModel") 59 | register_forward(FM_Touch, "fw_touch") 60 | register_message(g_msgAmmoPickup, "message_ammopickup") 61 | register_event("HLTV", "event_round_start", "a", "1=0", "2=0") 62 | 63 | g_SayText = get_user_msgid("SayText") 64 | g_msgAmmoPickup = get_user_msgid("AmmoPickup") 65 | 66 | #if defined CAMPO_ROUND 67 | g_itemID = zp_register_extra_item ( "Force Shield" , item_cost * 2 , ZP_TEAM_HUMAN ) 68 | #else 69 | g_itemID = zp_register_extra_item ( "Force Shield" , item_cost , ZP_TEAM_HUMAN ) 70 | #endif 71 | 72 | // Push cvar, (Only float's numbers) 73 | cvar_push = register_cvar("zp_forze_push", "7.5") 74 | 75 | g_maxplayers = get_maxplayers() 76 | } 77 | 78 | public plugin_precache() { 79 | 80 | g_trailSpr = engfunc(EngFunc_PrecacheModel, sprite_grenade_trail) 81 | gGlass = engfunc(EngFunc_PrecacheModel, gModelGlass) 82 | engfunc(EngFunc_PrecacheModel, model_grenade) 83 | engfunc(EngFunc_PrecacheModel, model) 84 | engfunc(EngFunc_PrecacheModel, w_model) 85 | engfunc(EngFunc_PrecacheSound, recieving_sound) 86 | engfunc(EngFunc_PrecacheSound, gSoundTouch) 87 | engfunc(EngFunc_PrecacheSound, gSoundOpen) 88 | engfunc(EngFunc_PrecacheSound, gSoundClose) 89 | } 90 | 91 | public event_round_start() 92 | { 93 | for (new id=1; id<=g_maxplayers; id++) 94 | g_bomb[id] = false 95 | 96 | new ent = FM_NULLENT 97 | static string_class[] = "classname" 98 | while ((ent = engfunc(EngFunc_FindEntityByString, ent, string_class, entclas))) 99 | set_pev(ent, pev_flags, FL_KILLME) 100 | } 101 | 102 | public client_disconnect(id) 103 | g_bomb[id] = false 104 | 105 | public Event_CurWeapon(id) 106 | { 107 | if (get_user_weapon(id) == CSW_SMOKEGRENADE && g_bomb[id]) 108 | set_pev(id, pev_viewmodel2, model_grenade) 109 | } 110 | 111 | public zp_extra_item_selected(player, itemid) { 112 | 113 | if(itemid == g_itemID) 114 | { 115 | if(g_bomb[player]) 116 | Color(player, "!g[Shield]!y You already have a force field") 117 | else 118 | { 119 | g_bomb[player] = true 120 | 121 | // Already own one 122 | if (user_has_weapon(player, CSW_SMOKEGRENADE)) 123 | { 124 | // Increase BP ammo on it instead 125 | cs_set_user_bpammo(player, CSW_SMOKEGRENADE, cs_get_user_bpammo(player, CSW_SMOKEGRENADE) + 1) 126 | 127 | // Flash the ammo in hud 128 | message_begin(MSG_ONE_UNRELIABLE, g_msgAmmoPickup, _, player) 129 | write_byte(CSW_SMOKEGRENADE) 130 | write_byte(1) 131 | message_end() 132 | 133 | // Play Clip Purchase Sound 134 | emit_sound(player, CHAN_ITEM, recieving_sound, VOL_NORM, ATTN_NORM, 0, PITCH_NORM) 135 | } 136 | else 137 | fm_give_item(player, "weapon_smokegrenade") 138 | 139 | 140 | #if defined CAMPO_ROUND 141 | Color(player, "!g[Shield]!y You Bought a force field!. This, lasts 1 round complete.") 142 | #else 143 | Color(player, "!g[Shield]!y You Bought a force field!. This, lasts very little!") 144 | #endif 145 | } 146 | 147 | 148 | } 149 | 150 | } 151 | public fw_PlayerKilled(victim, attacker, shouldgib) 152 | g_bomb[victim] = false 153 | 154 | public fw_ThinkGrenade(entity) 155 | { 156 | if(!pev_valid(entity)) 157 | return HAM_IGNORED 158 | 159 | static Float:dmgtime 160 | pev(entity, pev_dmgtime, dmgtime) 161 | 162 | if (dmgtime > get_gametime()) 163 | return HAM_IGNORED 164 | 165 | if((pev(entity, pev_flTimeStepSound) == NADE_TYPE_CAMPO) && (pev(entity, pev_flags) & FL_ONGROUND)) 166 | { 167 | crear_ent(entity) 168 | return HAM_SUPERCEDE 169 | } 170 | 171 | return HAM_IGNORED 172 | } 173 | 174 | 175 | public fw_SetModel(entity, const model[]) 176 | { 177 | static Float:dmgtime 178 | pev(entity, pev_dmgtime, dmgtime) 179 | 180 | if (dmgtime == 0.0) 181 | return FMRES_IGNORED 182 | 183 | if (equal(model[7], "w_sm", 4)) 184 | { 185 | new owner = pev(entity, pev_owner) 186 | 187 | if(!zp_get_user_zombie(owner) && g_bomb[owner]) 188 | { 189 | g_bomb[owner] = false 190 | 191 | fm_set_rendering(entity, kRenderFxGlowShell, 000, 255, 255, kRenderNormal, 16) 192 | 193 | message_begin(MSG_BROADCAST, SVC_TEMPENTITY) 194 | write_byte(TE_BEAMFOLLOW) // TE id 195 | write_short(entity) // entity 196 | write_short(g_trailSpr) // sprite 197 | write_byte(10) // life 198 | write_byte(10) // width 199 | write_byte(000) // r 200 | write_byte(255) // g 201 | write_byte(255) // b 202 | write_byte(500) // brightness 203 | message_end() 204 | 205 | set_pev(entity, pev_flTimeStepSound, NADE_TYPE_CAMPO) 206 | 207 | set_task(TASK_TIME+0.1, "DeleteEntityGrenade", entity) 208 | entity_set_model(entity, w_model) 209 | return FMRES_SUPERCEDE 210 | } 211 | } 212 | return FMRES_IGNORED 213 | 214 | } 215 | 216 | public DeleteEntityGrenade(entity) 217 | { 218 | if (pev_valid(entity)) 219 | engfunc(EngFunc_RemoveEntity, entity) 220 | } 221 | 222 | public crear_ent(id) 223 | { 224 | // Create entitity 225 | new iEntity = fm_create_entity("info_target") 226 | 227 | set_pev(iEntity, pev_classname, entclas) 228 | 229 | new Float: Origin[3] 230 | pev(id, pev_origin, Origin) 231 | 232 | set_pev(iEntity, pev_origin, Origin) 233 | engfunc(EngFunc_SetModel, iEntity, model) 234 | set_pev(iEntity, pev_solid, SOLID_TRIGGER) 235 | engfunc(EngFunc_SetSize, iEntity, Float: {-100.0, -100.0, -100.0}, Float: {100.0, 100.0, 100.0}) 236 | set_pev(iEntity, pev_renderfx, kRenderFxGlowShell) 237 | set_pev(iEntity, pev_rendermode, kRenderTransAlpha) 238 | set_pev(iEntity, pev_renderamt, 50.0) 239 | 240 | #if defined RANDOM_COLOR 241 | new Float:vColor[3] 242 | 243 | for(new i = 0; i < 3; i++) 244 | vColor[i] = random_float(0.0, 255.0) 245 | 246 | set_pev(iEntity, pev_rendercolor, vColor) 247 | #endif 248 | 249 | #if defined ONE_COLOR 250 | set_pev(iEntity, pev_rendercolor, CampoColors) 251 | #endif 252 | 253 | #if defined CAMPO_TASK 254 | set_task(TASK_TIME, "DeleteEntity", iEntity) 255 | #endif 256 | 257 | emit_sound(iEntity, CHAN_AUTO, gSoundOpen, VOL_NORM, ATTN_NORM, 0, PITCH_NORM) 258 | } 259 | 260 | public zp_user_infected_post(infected, infector) 261 | { 262 | if (g_bomb[infected]) 263 | g_bomb[infected] = false 264 | } 265 | 266 | public fw_touch(toucher, touched) 267 | { 268 | if (!pev_valid(toucher)) 269 | return FMRES_IGNORED 270 | 271 | new classname[32] 272 | pev(toucher, pev_classname, classname, 31) 273 | 274 | if (!equal(classname, entclas)) 275 | return FMRES_IGNORED 276 | 277 | if( ValidTouch(touched) ) 278 | { 279 | new Float:pos_ptr[3], Float:pos_ptd[3], Float:push_power = get_pcvar_float(cvar_push) 280 | 281 | pev(toucher, pev_origin, pos_ptr) 282 | pev(touched, pev_origin, pos_ptd) 283 | 284 | for(new i = 0; i < 3; i++) 285 | { 286 | pos_ptd[i] -= pos_ptr[i] 287 | pos_ptd[i] *= push_power 288 | } 289 | set_pev(touched, pev_velocity, pos_ptd) 290 | set_pev(touched, pev_impulse, pos_ptd) 291 | 292 | emit_sound(toucher, CHAN_AUTO, gSoundTouch, VOL_NORM, ATTN_NORM, 0, PITCH_NORM) 293 | } 294 | 295 | return FMRES_IGNORED 296 | } 297 | 298 | public DeleteEntity(entity) 299 | { 300 | if(!pev_valid(entity)) 301 | return PLUGIN_HANDLED 302 | 303 | emit_sound(entity, CHAN_AUTO, gSoundClose, VOL_NORM, ATTN_NORM, 0, PITCH_NORM) 304 | 305 | static origin[3], Float:originF[3] 306 | pev(entity, pev_origin, originF) 307 | FVecIVec(originF, origin) 308 | 309 | message_begin(MSG_BROADCAST, SVC_TEMPENTITY); 310 | write_byte(TE_BREAKMODEL); 311 | write_coord(origin[0]); // x 312 | write_coord(origin[1]); // y 313 | write_coord(origin[2] + 24); // z 314 | write_coord(16); // size x 315 | write_coord(16); // size y 316 | write_coord(16); // size z 317 | write_coord(random_num(-50,50));// velocity x 318 | write_coord(random_num(-50,50));// velocity y 319 | write_coord(25); // velocity z 320 | write_byte(10); // random velocity 321 | write_short(gGlass); // model 322 | write_byte(10); // count 323 | write_byte(25); // life 324 | write_byte(0x01); // flags: BREAK_GLASS 325 | message_end(); 326 | 327 | engfunc(EngFunc_RemoveEntity, entity) 328 | 329 | return PLUGIN_HANDLED 330 | } 331 | 332 | stock Color(const id, const input[], any:...) 333 | { 334 | static msg[191] 335 | vformat(msg, 190, input, 3) 336 | 337 | replace_all(msg, 190, "!g", "^4") 338 | replace_all(msg, 190, "!y", "^1") 339 | replace_all(msg, 190, "!t", "^3") 340 | 341 | message_begin(MSG_ONE_UNRELIABLE, g_SayText, _, id) 342 | write_byte(id) 343 | write_string(msg) 344 | message_end() 345 | } -------------------------------------------------------------------------------- /amxx/Shield_Force/models/zombie_plague/aura8.mdl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/accelerator74/sp-plugins/08b3580d350d48b1936da83a36e1903dd7899429/amxx/Shield_Force/models/zombie_plague/aura8.mdl -------------------------------------------------------------------------------- /amxx/Shield_Force/models/zombie_plague/v_auragren.mdl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/accelerator74/sp-plugins/08b3580d350d48b1936da83a36e1903dd7899429/amxx/Shield_Force/models/zombie_plague/v_auragren.mdl -------------------------------------------------------------------------------- /amxx/Shield_Force/models/zombie_plague/w_aura.mdl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/accelerator74/sp-plugins/08b3580d350d48b1936da83a36e1903dd7899429/amxx/Shield_Force/models/zombie_plague/w_aura.mdl -------------------------------------------------------------------------------- /amxx/Shield_Force/sound/debris/beamstart1.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/accelerator74/sp-plugins/08b3580d350d48b1936da83a36e1903dd7899429/amxx/Shield_Force/sound/debris/beamstart1.wav -------------------------------------------------------------------------------- /amxx/Shield_Force/sound/debris/beamstart10.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/accelerator74/sp-plugins/08b3580d350d48b1936da83a36e1903dd7899429/amxx/Shield_Force/sound/debris/beamstart10.wav -------------------------------------------------------------------------------- /amxx/Shield_Force/sound/debris/beamstart6.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/accelerator74/sp-plugins/08b3580d350d48b1936da83a36e1903dd7899429/amxx/Shield_Force/sound/debris/beamstart6.wav -------------------------------------------------------------------------------- /amxx/zp_addon_bonus_box/addons/amxmodx/configs/zp_addon_bonusbox.cfg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/accelerator74/sp-plugins/08b3580d350d48b1936da83a36e1903dd7899429/amxx/zp_addon_bonus_box/addons/amxmodx/configs/zp_addon_bonusbox.cfg -------------------------------------------------------------------------------- /amxx/zp_addon_bonus_box/addons/amxmodx/configs/zp_bx_extra_humans.ini: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/accelerator74/sp-plugins/08b3580d350d48b1936da83a36e1903dd7899429/amxx/zp_addon_bonus_box/addons/amxmodx/configs/zp_bx_extra_humans.ini -------------------------------------------------------------------------------- /amxx/zp_addon_bonus_box/addons/amxmodx/configs/zp_bx_extra_zombies.ini: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/accelerator74/sp-plugins/08b3580d350d48b1936da83a36e1903dd7899429/amxx/zp_addon_bonus_box/addons/amxmodx/configs/zp_bx_extra_zombies.ini -------------------------------------------------------------------------------- /amxx/zp_addon_bonus_box/addons/amxmodx/data/lang/bonus_box.txt: -------------------------------------------------------------------------------- 1 | [en] 2 | BX_ANTIDOT = You have found Antidote 3 | BX_INFECT = You have found T-Virus 4 | BX_HEALTH_UP = You have found Health 5 | BX_HEALTH_DOWN = You lost Health 6 | BX_AMMOPACKS_UP = You got a little Bonus 7 | BX_AMMOPACKS_DOWN = You have lost a little Bonus 8 | BX_GRAVITY = Have you decreased Gravity 9 | BX_SPEED_UP = Have you increased speed 10 | BX_SPEED_DOWN = You reduce the speed of movement 11 | BX_GODMODE = You become invulnerable [%.0f sec] 12 | BX_GODMODE_DISABLE = Invulnerability mode is disabled 13 | BX_FROST = You have found Frost 14 | BX_NIGHTVISION = You have found a night vision device 15 | BX_ARMOR_UP = You have found Armor 16 | BX_ARMOR_DOWN = You have lost Armor 17 | BX_NEMESIS = %s became the NEMESIS 18 | BX_SURVIVOR = %s became the SURVIVOR 19 | BX_BRIGHTLIGHT = You got a Bright Glow 20 | BX_GRENADES = You have found a set of Grenades 21 | BX_SG550 = You have found SG550 22 | BX_G3SG1 = You have found G3SG1 23 | BX_M249 = You have found M249 24 | BX_AWP = You have found AWP 25 | BX_INVISIBLE = You are invisible now [%.0f sec] 26 | BX_INVISIBLE_REMOVE = You are not invisible any more 27 | BX_NO = Empty box 28 | BX_FOUND = %s have found bonus box 29 | BX_FOUND_ON = %s have found %s 30 | BX_BOXSPAWN = Bonus Box dropped 31 | 32 | [ru] 33 | BX_ANTIDOT = Вы нашли антидот 34 | BX_INFECT = Вы нашли T-Virus 35 | BX_HEALTH_UP = Вы нашли доп. здоровье 36 | BX_HEALTH_DOWN = Вы потеряли здоровье 37 | BX_AMMOPACKS_UP = Вы получили немного бонусов 38 | BX_AMMOPACKS_DOWN = Вы потеряли немного бонусов 39 | BX_GRAVITY = У вас уменьшилась гравитация 40 | BX_SPEED_UP = У вас увеличилась скорость движения 41 | BX_SPEED_DOWN = У вас уменьшилась скорость движения 42 | BX_GODMODE = Вы стали неуязвимы [%.0f сек] 43 | BX_GODMODE_DISABLE = Режим неуязвимости отключен 44 | BX_FROST = Вы нашли заморозку 45 | BX_NIGHTVISION = Вы нашли прибор ночного видения 46 | BX_ARMOR_UP = Вы нашли бронежелет 47 | BX_ARMOR_DOWN = Вы потеряли бронежелет 48 | BX_NEMESIS = %s стал НЕМЕЗИДОЙ 49 | BX_SURVIVOR = %s стал ВЫЖИВШИМ 50 | BX_BRIGHTLIGHT = Вы получили яркое свечение 51 | BX_GRENADES = Вы нашли комплект гранат 52 | BX_SG550 = Вы нашли SG550 53 | BX_G3SG1 = Вы нашли G3SG1 54 | BX_M249 = Вы нашли M249 55 | BX_AWP = Вы нашли AWP 56 | BX_INVISIBLE = Вы стали невидимым [%.0f сек] 57 | BX_INVISIBLE_REMOVE = Вы вновь стали видимым 58 | BX_NO = Коробка пуста 59 | BX_FOUND = %s нашёл бонусную коробку 60 | BX_FOUND_ON = %s нашёл %s 61 | BX_BOXSPAWN = Бонусная коробка выпала -------------------------------------------------------------------------------- /amxx/zp_addon_bonus_box/models/zombie_plague/presents.mdl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/accelerator74/sp-plugins/08b3580d350d48b1936da83a36e1903dd7899429/amxx/zp_addon_bonus_box/models/zombie_plague/presents.mdl -------------------------------------------------------------------------------- /amxx/zp_addon_bonus_box/sound/warcraft3/impalehit.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/accelerator74/sp-plugins/08b3580d350d48b1936da83a36e1903dd7899429/amxx/zp_addon_bonus_box/sound/warcraft3/impalehit.wav -------------------------------------------------------------------------------- /amxx/zp_addon_bonus_box/sound/warcraft3/impalelaunch1.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/accelerator74/sp-plugins/08b3580d350d48b1936da83a36e1903dd7899429/amxx/zp_addon_bonus_box/sound/warcraft3/impalelaunch1.wav -------------------------------------------------------------------------------- /amxx/zp_addon_bonus_box/sprites/bonusbox.spr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/accelerator74/sp-plugins/08b3580d350d48b1936da83a36e1903dd7899429/amxx/zp_addon_bonus_box/sprites/bonusbox.spr -------------------------------------------------------------------------------- /amxx/zp_extra_hook/zp_extra_hook.sma: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/accelerator74/sp-plugins/08b3580d350d48b1936da83a36e1903dd7899429/amxx/zp_extra_hook/zp_extra_hook.sma -------------------------------------------------------------------------------- /amxx/zp_extra_radar/zp_extra_radar.sma: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #define PLUGIN "Zombie Plague extra item - Radar" 6 | #define VERSION "1.2" 7 | #define AUTHOR "Sonic Son'edit & Accelerator" 8 | 9 | new g_msgHostageAdd, g_msgHostageDel, g_maxplayers, g_itemid_radar; 10 | 11 | new player_has_radar[33], playerz_has_radar[33]; 12 | 13 | public plugin_init() 14 | { 15 | register_plugin(PLUGIN, VERSION, AUTHOR) 16 | 17 | RegisterHam(Ham_Killed, "player", "fw_PlayerKilled") 18 | 19 | g_msgHostageAdd = get_user_msgid("HostagePos") 20 | g_msgHostageDel = get_user_msgid("HostageK") 21 | 22 | g_maxplayers = get_maxplayers() 23 | 24 | g_itemid_radar = zp_register_extra_item("Radar Scanner", 8, ZP_TEAM_HUMAN & ZP_TEAM_ZOMBIE) 25 | 26 | set_task (2.0,"radar_human",_,_,_,"b"); 27 | set_task (2.1,"radar_zombie",_,_,_,"b"); 28 | } 29 | 30 | public client_connect(id) 31 | { 32 | player_has_radar[id] = false; 33 | playerz_has_radar[id] = false; 34 | } 35 | 36 | public zp_extra_item_selected(player, itemid) 37 | { 38 | if (itemid == g_itemid_radar) 39 | { 40 | if (zp_get_user_zombie(player)) 41 | { 42 | playerz_has_radar[player] = true; 43 | } 44 | else 45 | { 46 | player_has_radar[player] = true; 47 | } 48 | client_print(player, print_chat, "[ZP] You bought Radar Scanner"); 49 | } 50 | } 51 | 52 | public radar_human() 53 | { 54 | new zombie_count = 0; 55 | new zombie_list[32]; 56 | new ZombieCoords[3]; 57 | new id, i; 58 | 59 | for (new id=1; id<=g_maxplayers; id++) 60 | { 61 | if (is_user_connected(id) && zp_get_user_zombie(id) && is_user_alive(id)) 62 | { 63 | zombie_count++; 64 | zombie_list[zombie_count]=id; 65 | } 66 | } 67 | 68 | for (id=1; id<=g_maxplayers; id++) 69 | { 70 | if (!is_user_alive(id) || !player_has_radar[id]) continue; 71 | 72 | for (i=1;i<=zombie_count;i++) 73 | { 74 | get_user_origin(zombie_list[i], ZombieCoords) 75 | 76 | message_begin(MSG_ONE_UNRELIABLE, g_msgHostageAdd, {0,0,0}, id) 77 | write_byte(id) 78 | write_byte(i) 79 | write_coord(ZombieCoords[0]) 80 | write_coord(ZombieCoords[1]) 81 | write_coord(ZombieCoords[2]) 82 | message_end() 83 | 84 | message_begin(MSG_ONE_UNRELIABLE, g_msgHostageDel, {0,0,0}, id) 85 | write_byte(i) 86 | message_end() 87 | } 88 | } 89 | } 90 | 91 | public radar_zombie() 92 | { 93 | new humans_count = 0; 94 | new humans_list[32]; 95 | new HumansCoords[3]; 96 | new id, i; 97 | 98 | for (new id=1; id<=g_maxplayers; id++) 99 | { 100 | if (is_user_connected(id) && !zp_get_user_zombie(id) && is_user_alive(id)) 101 | { 102 | humans_count++; 103 | humans_list[humans_count]=id; 104 | } 105 | } 106 | 107 | for (id=1; id<=g_maxplayers; id++) 108 | { 109 | if (!is_user_alive(id) || !playerz_has_radar[id]) continue; 110 | 111 | for (i=1;i<=humans_count;i++) 112 | { 113 | get_user_origin(humans_list[i], HumansCoords) 114 | 115 | message_begin(MSG_ONE_UNRELIABLE, g_msgHostageAdd, {0,0,0}, id) 116 | write_byte(id) 117 | write_byte(i) 118 | write_coord(HumansCoords[0]) 119 | write_coord(HumansCoords[1]) 120 | write_coord(HumansCoords[2]) 121 | message_end() 122 | 123 | message_begin(MSG_ONE_UNRELIABLE, g_msgHostageDel, {0,0,0}, id) 124 | write_byte(i) 125 | message_end() 126 | } 127 | } 128 | } 129 | 130 | public zp_user_infected_post(id, infector) 131 | player_has_radar[id] = false; 132 | 133 | public zp_user_humanized_post(id, survivor) 134 | playerz_has_radar[id] = false; 135 | 136 | public fw_PlayerKilled(victim, attacker, shouldgib) 137 | { 138 | player_has_radar[victim] = false; 139 | playerz_has_radar[victim] = false; 140 | } 141 | 142 | public zp_round_ended(winteam) 143 | { 144 | for (new id=1; id<=g_maxplayers; id++) 145 | { 146 | player_has_radar[id] = false; 147 | playerz_has_radar[id] = false; 148 | } 149 | } 150 | -------------------------------------------------------------------------------- /amxx/zp_extra_wallclimb/zp_extra_wallclimb.sma: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | new bool:g_WallClimb[33] 8 | new Float:g_wallorigin[32][3] 9 | new g_maxplayers, item_climb 10 | 11 | public plugin_init() 12 | { 13 | register_plugin("[ZP] Extra Item: Wall climb ", "1.0", "Python1320 & Accelerator") 14 | register_forward(FM_Touch, "fwd_touch") 15 | register_forward(FM_PlayerPreThink, "fwd_playerprethink") 16 | RegisterHam(Ham_Killed, "player", "fw_PlayerKilled") 17 | 18 | g_maxplayers = get_maxplayers() 19 | 20 | item_climb = zp_register_extra_item("Wall climb", 17, ZP_TEAM_ZOMBIE) 21 | } 22 | 23 | public zp_extra_item_selected(player, itemid) 24 | { 25 | if (itemid == item_climb) 26 | { 27 | g_WallClimb[player] = true 28 | client_print(player, print_chat, "[ZP] You bought Wall climb. Use button 'E' for wall climb"); 29 | } 30 | } 31 | 32 | public zp_user_infected_post(id, infector) 33 | g_WallClimb[id] = false 34 | 35 | public zp_user_humanized_post(id, survivor) 36 | g_WallClimb[id] = false 37 | 38 | public fw_PlayerKilled(victim, attacker, shouldgib) 39 | g_WallClimb[victim] = false 40 | 41 | public zp_round_ended(winteam) 42 | { 43 | for (new id=1; id<=g_maxplayers; id++) 44 | g_WallClimb[id] = false 45 | } 46 | 47 | public client_connect(id) 48 | g_WallClimb[id] = false 49 | 50 | public fwd_touch(id, world) 51 | { 52 | if(!is_user_alive(id) || !g_WallClimb[id]) 53 | return FMRES_IGNORED 54 | 55 | pev(id, pev_origin, g_wallorigin[id]) 56 | 57 | return FMRES_IGNORED 58 | } 59 | 60 | public wallclimb(id, button) 61 | { 62 | static Float:origin[3] 63 | pev(id, pev_origin, origin) 64 | 65 | if(get_distance_f(origin, g_wallorigin[id]) > 25.0) 66 | return FMRES_IGNORED // if not near wall 67 | 68 | if(fm_get_entity_flags(id) & FL_ONGROUND) 69 | return FMRES_IGNORED 70 | 71 | if(button & IN_FORWARD) 72 | { 73 | static Float:velocity[3] 74 | velocity_by_aim(id, 120, velocity) 75 | fm_set_user_velocity(id, velocity) 76 | } 77 | else if(button & IN_BACK) 78 | { 79 | static Float:velocity[3] 80 | velocity_by_aim(id, -120, velocity) 81 | fm_set_user_velocity(id, velocity) 82 | } 83 | return FMRES_IGNORED 84 | } 85 | 86 | public fwd_playerprethink(id) 87 | { 88 | if(!g_WallClimb[id]) 89 | return FMRES_IGNORED 90 | 91 | new button = fm_get_user_button(id) 92 | 93 | if(button & IN_USE) //Use button = climb 94 | wallclimb(id, button) 95 | 96 | return FMRES_IGNORED 97 | } 98 | -------------------------------------------------------------------------------- /amxx/zp_rand_lighting/zp_rand_lighting.sma: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #define PLUGIN "[ZP] Addon: Rand Lighting" 4 | #define VERSION "1.1" 5 | #define AUTHOR "Accelerator" 6 | 7 | new rand_light, cvar_rand 8 | 9 | public plugin_init() 10 | { 11 | register_plugin(PLUGIN, VERSION, AUTHOR) 12 | 13 | cvar_rand = register_cvar("zp_rand_lighting", "0") 14 | 15 | rand_light = random_num(0, 3) 16 | 17 | set_task(15.0, "light_change") 18 | } 19 | 20 | public light_change() 21 | { 22 | new Float:rand_timer 23 | 24 | if (!get_pcvar_num(cvar_rand)) 25 | { 26 | if (rand_light++ == 3) 27 | rand_light = 0 28 | } 29 | else 30 | rand_light = random_num(0, 3) 31 | 32 | switch(rand_light) 33 | { 34 | case 0: 35 | { 36 | server_cmd("zp_lighting a") 37 | rand_timer = random_float(180.0, 300.0) 38 | ChatColor(0, "!g[ZP]!y Time of Day: Night (%.0f seconds)", rand_timer) 39 | } 40 | case 1: 41 | { 42 | server_cmd("zp_lighting f") 43 | rand_timer = random_float(40.0, 75.0) 44 | ChatColor(0, "!g[ZP]!y Time of Day: Day (%.0f seconds)", rand_timer) 45 | } 46 | case 2: 47 | { 48 | server_cmd("zp_lighting c") 49 | rand_timer = random_float(120.0, 250.0) 50 | ChatColor(0, "!g[ZP]!y Time of Day: Evening (%.0f seconds)", rand_timer) 51 | } 52 | case 3: 53 | { 54 | server_cmd("zp_lighting b") 55 | rand_timer = random_float(60.0, 120.0) 56 | ChatColor(0, "!g[ZP]!y Time of Day: Twilight (%.0f seconds)", rand_timer) 57 | } 58 | } 59 | 60 | set_task(rand_timer, "light_change") 61 | } 62 | 63 | // Stock: ChatColor! 64 | stock ChatColor(const id, const input[], any:...) 65 | { 66 | new count = 1, players[32] 67 | static msg[191] 68 | vformat(msg, 190, input, 3) 69 | 70 | replace_all(msg, 190, "!g", "^4") // Green Color 71 | replace_all(msg, 190, "!y", "^1") // Default Color 72 | replace_all(msg, 190, "!team", "^3") // Team Color 73 | replace_all(msg, 190, "!team2", "^0") // Team2 Color 74 | 75 | if (id) players[0] = id; else get_players(players, count, "ch") 76 | { 77 | for (new i = 0; i < count; i++) 78 | { 79 | if (is_user_connected(players[i])) 80 | { 81 | message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, players[i]) 82 | write_byte(players[i]); 83 | write_string(msg); 84 | message_end(); 85 | } 86 | } 87 | } 88 | } -------------------------------------------------------------------------------- /antiflood/antiflood.sp: -------------------------------------------------------------------------------- 1 | #pragma semicolon 1 2 | 3 | #include 4 | 5 | #pragma newdecls required 6 | 7 | public Plugin myinfo = 8 | { 9 | name = "Anti-Flood", 10 | author = "AlliedModders LLC, Accelerator", 11 | description = "Protects against chat and console flooding", 12 | version = SOURCEMOD_VERSION, 13 | url = "http://www.sourcemod.net/" 14 | }; 15 | 16 | float g_LastTime[MAXPLAYERS + 1] = {0.0, ...}; 17 | int g_FloodTokens[MAXPLAYERS + 1] = {0, ...}; 18 | 19 | float g_LastTimeCmd[MAXPLAYERS + 1] = {0.0, ...}; 20 | int g_FloodTokensCmd[MAXPLAYERS + 1] = {0, ...}; 21 | 22 | ArrayList g_hIgnoredCmds; 23 | 24 | ConVar sm_flood_time; 25 | 26 | public void OnPluginStart() 27 | { 28 | sm_flood_time = CreateConVar("sm_flood_time", "0.75", "Amount of time allowed between chat messages and console commands"); 29 | 30 | g_hIgnoredCmds = new ArrayList(ByteCountToCells(128)); 31 | 32 | // SMAC 33 | g_hIgnoredCmds.PushString("choose_closedoor"); 34 | g_hIgnoredCmds.PushString("choose_opendoor"); 35 | g_hIgnoredCmds.PushString("buy"); 36 | g_hIgnoredCmds.PushString("buyammo1"); 37 | g_hIgnoredCmds.PushString("buyammo2"); 38 | g_hIgnoredCmds.PushString("use"); 39 | g_hIgnoredCmds.PushString("vmodenable"); 40 | g_hIgnoredCmds.PushString("vban"); 41 | g_hIgnoredCmds.PushString("bitcmd"); 42 | g_hIgnoredCmds.PushString("sg"); 43 | g_hIgnoredCmds.PushString("spec_next"); 44 | g_hIgnoredCmds.PushString("spec_mode"); 45 | g_hIgnoredCmds.PushString("spec_prev"); 46 | g_hIgnoredCmds.PushString("spec_player"); 47 | g_hIgnoredCmds.PushString("spec_scoreboard"); 48 | g_hIgnoredCmds.PushString("menuselect"); 49 | g_hIgnoredCmds.PushString("+lookatweapon"); 50 | g_hIgnoredCmds.PushString("-lookatweapon"); 51 | g_hIgnoredCmds.PushString("close_buymenu"); 52 | g_hIgnoredCmds.PushString("open_buymenu"); 53 | g_hIgnoredCmds.PushString("autobuy"); 54 | g_hIgnoredCmds.PushString("rebuy"); 55 | g_hIgnoredCmds.PushString("drop"); 56 | g_hIgnoredCmds.PushString("joingame"); 57 | g_hIgnoredCmds.PushString("jointeam"); 58 | 59 | RegAdminCmd("sm_addignorecmd", Commands_AddIgnoreCmd, ADMFLAG_ROOT, "Adds a command to ignore on command spam."); 60 | RegAdminCmd("sm_removeignorecmd", Commands_RemoveIgnoreCmd, ADMFLAG_ROOT, "Remove a command to ignore."); 61 | } 62 | 63 | public void OnClientPutInServer(int client) 64 | { 65 | g_LastTime[client] = 0.0; 66 | g_FloodTokens[client] = 0; 67 | g_LastTimeCmd[client] = 0.0; 68 | g_FloodTokensCmd[client] = 0; 69 | } 70 | 71 | float max_chat; 72 | 73 | public bool OnClientFloodCheck(int client) 74 | { 75 | max_chat = sm_flood_time.FloatValue; 76 | 77 | if (max_chat <= 0.0 78 | || CheckCommandAccess(client, "sm_flood_access", ADMFLAG_ROOT, true)) 79 | { 80 | return false; 81 | } 82 | 83 | if (g_LastTime[client] >= GetGameTime()) 84 | { 85 | if (g_FloodTokens[client] >= 3) 86 | { 87 | return true; 88 | } 89 | } 90 | 91 | return false; 92 | } 93 | 94 | public void OnClientFloodResult(int client, bool blocked) 95 | { 96 | if (max_chat <= 0.0 97 | || CheckCommandAccess(client, "sm_flood_access", ADMFLAG_ROOT, true)) 98 | { 99 | return; 100 | } 101 | 102 | float curTime = GetGameTime(); 103 | float newTime = curTime + max_chat; 104 | 105 | if (g_LastTime[client] >= curTime) 106 | { 107 | if (blocked) 108 | { 109 | newTime += 3.0; 110 | } 111 | else if (g_FloodTokens[client] < 3) 112 | { 113 | g_FloodTokens[client]++; 114 | } 115 | } 116 | else if (g_FloodTokens[client] > 0) 117 | { 118 | g_FloodTokens[client]--; 119 | } 120 | 121 | g_LastTime[client] = newTime; 122 | } 123 | 124 | public Action OnClientCommand(int client, int args) 125 | { 126 | if (client == 0) 127 | { 128 | return Plugin_Continue; 129 | } 130 | 131 | max_chat = sm_flood_time.FloatValue; 132 | 133 | if (max_chat <= 0.0 134 | || CheckCommandAccess(client, "sm_flood_access", ADMFLAG_ROOT, true)) 135 | { 136 | return Plugin_Continue; 137 | } 138 | 139 | char command[64]; 140 | GetCmdArg(0, command, sizeof(command)); 141 | StringToLower(command); 142 | 143 | if ( g_hIgnoredCmds.FindString(command) != -1 ) 144 | return Plugin_Continue; 145 | 146 | if (g_LastTimeCmd[client] >= GetGameTime()) 147 | { 148 | if (g_FloodTokensCmd[client] >= 30) 149 | { 150 | if (!IsClientInKickQueue(client)) 151 | { 152 | KickClient(client, "kicked for command spamming: %s", command); 153 | LogAction(-1, client, "%N was kicked for command spamming: %s", client, command); 154 | } 155 | return Plugin_Stop; 156 | } 157 | } 158 | 159 | float curTime = GetGameTime(); 160 | float newTime = curTime + max_chat; 161 | 162 | if (g_LastTimeCmd[client] >= curTime) 163 | { 164 | if (g_FloodTokensCmd[client] < 30) 165 | { 166 | g_FloodTokensCmd[client]++; 167 | } 168 | } 169 | else if (g_FloodTokensCmd[client] > 0) 170 | { 171 | g_FloodTokensCmd[client]--; 172 | } 173 | 174 | g_LastTimeCmd[client] = newTime; 175 | 176 | return Plugin_Continue; 177 | } 178 | 179 | // SMAC 180 | Action Commands_AddIgnoreCmd(int client, int args) 181 | { 182 | if ( args != 1 ) 183 | { 184 | ReplyToCommand(client, "Usage: sm_addignorecmd "); 185 | return Plugin_Handled; 186 | } 187 | 188 | char f_sCmdName[64]; 189 | 190 | GetCmdArg(1, f_sCmdName, sizeof(f_sCmdName)); 191 | 192 | int index = g_hIgnoredCmds.FindString(f_sCmdName); 193 | 194 | if ( index == -1 ) 195 | { 196 | g_hIgnoredCmds.PushString(f_sCmdName); 197 | ReplyToCommand(client, "You have successfully added %s to the command ignore list.", f_sCmdName); 198 | } 199 | else 200 | ReplyToCommand(client, "%s already exists in the command ignore list.", f_sCmdName); 201 | return Plugin_Handled; 202 | } 203 | 204 | Action Commands_RemoveIgnoreCmd(int client, int args) 205 | { 206 | if ( args != 1 ) 207 | { 208 | ReplyToCommand(client, "Usage: sm_removeignorecmd "); 209 | return Plugin_Handled; 210 | } 211 | 212 | char f_sCmdName[64]; 213 | GetCmdArg(1, f_sCmdName, sizeof(f_sCmdName)); 214 | 215 | int index = g_hIgnoredCmds.FindString(f_sCmdName); 216 | 217 | if ( index != -1 ) 218 | { 219 | g_hIgnoredCmds.Erase(index); 220 | ReplyToCommand(client, "You have successfully removed %s from the command ignore list.", f_sCmdName); 221 | } 222 | else 223 | ReplyToCommand(client, "%s is not in the command ignore list.", f_sCmdName); 224 | return Plugin_Handled; 225 | } 226 | 227 | void StringToLower(char[] f_sInput) 228 | { 229 | int f_iSize = strlen(f_sInput); 230 | for(int i=0;i 2 | 3 | 4 | 5 | 6 | 7 | set_charset('utf8'); 11 | 12 | $result = $db->query("SELECT * FROM `mb_bans` ORDER by date DESC"); 13 | 14 | $db->query("DELETE FROM `mb_bans` WHERE time > 0 AND time < UNIX_TIMESTAMP()"); 15 | echo '

Список забаненных

16 | '; 17 | while ($row = $result->fetch_assoc()) { 18 | if ($row['time'] == 0) 19 | $time = 'Никогда'; 20 | elseif ($row['time'] < time()) 21 | $time = 'Уже истёк'; 22 | else 23 | $time = date("d.m.Y @ H:i", $row['time']); 24 | 25 | if (!$row["name"]) 26 | $name = 'Не указан'; 27 | else 28 | $name = $row['name']; 29 | 30 | if (!$row['reason']) 31 | $reason = 'Не указана'; 32 | else 33 | $reason = $row['reason']; 34 | 35 | if (!$row["ip"]) 36 | $ip = 'Не указан'; 37 | else 38 | $ip = $row["ip"]; 39 | 40 | echo ''; 41 | } 42 | ?> 43 |
Игрок
IP
SteamID
Дата блокировки
Истекает
Причина
Админ
  '.$name.'  
'.$ip.'
'.$row['steamid'].'
'.date("d.m.Y @ H:i", $row['date']).'
'.$time.'
  '.$reason.'     '.$row['admin'].' ('.$row['immunity'].')  


44 | Всего в базе '.$db->query("SELECT * FROM `mb_bans`")->num_rows.' записей, из них '.$db->query("SELECT * FROM `mb_bans` WHERE time = 0")->num_rows.' постоянных'; 46 | $db->close(); 47 | ?>

48 | 49 | -------------------------------------------------------------------------------- /basebans_mysql/dump.sql: -------------------------------------------------------------------------------- 1 | -- phpMyAdmin SQL Dump 2 | -- version 5.1.3 3 | -- https://www.phpmyadmin.net/ 4 | -- 5 | -- Хост: localhost 6 | -- Время создания: Ноя 17 2022 г., 12:39 7 | -- Версия сервера: 10.5.18-MariaDB-1:10.5.18+maria~deb11 8 | -- Версия PHP: 7.3.33 9 | 10 | SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; 11 | START TRANSACTION; 12 | SET time_zone = "+00:00"; 13 | 14 | 15 | /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; 16 | /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; 17 | /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; 18 | /*!40101 SET NAMES utf8mb4 */; 19 | 20 | -- -------------------------------------------------------- 21 | 22 | -- 23 | -- Структура таблицы `mb_bans` 24 | -- 25 | 26 | CREATE TABLE `mb_bans` ( 27 | `name` tinyblob NOT NULL, 28 | `ip` varchar(16) NOT NULL, 29 | `steamid` varchar(32) NOT NULL, 30 | `date` int(11) NOT NULL, 31 | `time` int(11) NOT NULL, 32 | `reason` varchar(255) NOT NULL, 33 | `admin` tinyblob NOT NULL, 34 | `immunity` tinyint(4) NOT NULL DEFAULT 0 35 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci; 36 | 37 | -- 38 | -- Индексы сохранённых таблиц 39 | -- 40 | 41 | -- 42 | -- Индексы таблицы `mb_bans` 43 | -- 44 | ALTER TABLE `mb_bans` 45 | ADD PRIMARY KEY (`steamid`), 46 | ADD KEY `ip` (`ip`), 47 | ADD KEY `time` (`time`), 48 | ADD KEY `date` (`date`); 49 | COMMIT; 50 | 51 | /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; 52 | /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; 53 | /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; 54 | -------------------------------------------------------------------------------- /csgo_damagemod/csgo_damagemod.sp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | enum WpnID { 5 | wpn_none, 6 | ConVar:wpn_ak47, 7 | ConVar:wpn_aug, 8 | ConVar:wpn_awp, 9 | ConVar:wpn_bizon, 10 | ConVar:wpn_deagle, 11 | ConVar:wpn_elite, 12 | ConVar:wpn_famas, 13 | ConVar:wpn_fiveseven, 14 | ConVar:wpn_g3sg1, 15 | ConVar:wpn_galilar, 16 | ConVar:wpn_glock, 17 | ConVar:wpn_hkp2000, 18 | ConVar:wpn_knife, 19 | ConVar:wpn_m249, 20 | ConVar:wpn_m4a1, 21 | ConVar:wpn_mac10, 22 | ConVar:wpn_mag7, 23 | ConVar:wpn_mp7, 24 | ConVar:wpn_mp9, 25 | ConVar:wpn_negev, 26 | ConVar:wpn_nova, 27 | ConVar:wpn_p250, 28 | ConVar:wpn_p90, 29 | ConVar:wpn_sawedoff, 30 | ConVar:wpn_scar20, 31 | ConVar:wpn_sg556, 32 | ConVar:wpn_ssg08, 33 | ConVar:wpn_tec9, 34 | ConVar:wpn_ump45, 35 | ConVar:wpn_xm1014 36 | }; 37 | 38 | ConVar wpn_damage[WpnID]; 39 | float wpn_damage_value[WpnID]; 40 | 41 | char WeaponClassname[WpnID][] = { 42 | "", "weapon_ak47", "weapon_aug", "weapon_awp", "weapon_bizon", "weapon_deagle", "weapon_elite", "weapon_famas", "weapon_fiveseven", "weapon_g3sg1", "weapon_galilar", "weapon_glock", "weapon_hkp2000", "weapon_knife", "weapon_m249", "weapon_m4a1", "weapon_mac10", "weapon_mag7", "weapon_mp7", "weapon_mp9", "weapon_negev", "weapon_nova", "weapon_p250", "weapon_p90", "weapon_sawedoff", "weapon_scar20", "weapon_sg556", "weapon_ssg08", "weapon_tec9", "weapon_ump45", "weapon_xm1014" 43 | }; 44 | 45 | Handle hWeaponClassTrie = INVALID_HANDLE; 46 | 47 | stock void InitWeaponClassTrie() 48 | { 49 | hWeaponClassTrie = CreateTrie(); 50 | for(int i = 0; i < view_as(WpnID); i++) 51 | { 52 | SetTrieValue(hWeaponClassTrie, WeaponClassname[view_as(i)], i); 53 | } 54 | } 55 | 56 | stock WpnID WeaponClassToId(const char[] weaponClass) 57 | { 58 | WpnID id; 59 | if(hWeaponClassTrie == INVALID_HANDLE) 60 | { 61 | InitWeaponClassTrie(); 62 | } 63 | if(GetTrieValue(hWeaponClassTrie, weaponClass, id)) 64 | { 65 | return view_as(id); 66 | } 67 | return wpn_none; 68 | } 69 | 70 | public Plugin myinfo = 71 | { 72 | name = "CS:GO Weapons Damage Mod", 73 | author = "Accelerator", 74 | description = "", 75 | version = "2.0", 76 | url = "https://github.com/accelerator74/sp-plugins" 77 | }; 78 | 79 | public void OnPluginStart() 80 | { 81 | wpn_damage[wpn_ak47] = CreateConVar("damage_ak47", "1.0"); 82 | wpn_damage[wpn_aug] = CreateConVar("damage_aug", "1.0"); 83 | wpn_damage[wpn_awp] = CreateConVar("damage_awp", "1.0"); 84 | wpn_damage[wpn_bizon] = CreateConVar("damage_bizon", "1.0"); 85 | wpn_damage[wpn_deagle] = CreateConVar("damage_deagle", "1.0", "Deagle and Revolver"); 86 | wpn_damage[wpn_elite] = CreateConVar("damage_elite", "1.0"); 87 | wpn_damage[wpn_famas] = CreateConVar("damage_famas", "1.0"); 88 | wpn_damage[wpn_fiveseven] = CreateConVar("damage_fiveseven", "1.0"); 89 | wpn_damage[wpn_g3sg1] = CreateConVar("damage_g3sg1", "1.0"); 90 | wpn_damage[wpn_galilar] = CreateConVar("damage_galilar", "1.0"); 91 | wpn_damage[wpn_glock] = CreateConVar("damage_glock", "1.0"); 92 | wpn_damage[wpn_hkp2000] = CreateConVar("damage_hkp2000", "1.0", "HKP2000 and USP Silencer"); 93 | wpn_damage[wpn_knife] = CreateConVar("damage_knife", "1.0"); 94 | wpn_damage[wpn_m249] = CreateConVar("damage_m249", "1.0"); 95 | wpn_damage[wpn_m4a1] = CreateConVar("damage_m4a1", "1.0", "M4A1 and M4A1 Silencer"); 96 | wpn_damage[wpn_mac10] = CreateConVar("damage_mac10", "1.0"); 97 | wpn_damage[wpn_mag7] = CreateConVar("damage_mag7", "1.0"); 98 | wpn_damage[wpn_mp7] = CreateConVar("damage_mp7", "1.0"); 99 | wpn_damage[wpn_mp9] = CreateConVar("damage_mp9", "1.0"); 100 | wpn_damage[wpn_negev] = CreateConVar("damage_negev", "1.0"); 101 | wpn_damage[wpn_nova] = CreateConVar("damage_nova", "1.0"); 102 | wpn_damage[wpn_p250] = CreateConVar("damage_p250", "1.0", "P250 and CZ75A"); 103 | wpn_damage[wpn_p90] = CreateConVar("damage_p90", "1.0"); 104 | wpn_damage[wpn_sawedoff] = CreateConVar("damage_sawedoff", "1.0"); 105 | wpn_damage[wpn_scar20] = CreateConVar("damage_scar20", "1.0"); 106 | wpn_damage[wpn_sg556] = CreateConVar("damage_sg556", "1.0"); 107 | wpn_damage[wpn_ssg08] = CreateConVar("damage_ssg08", "1.0"); 108 | wpn_damage[wpn_tec9] = CreateConVar("damage_tec9", "1.0"); 109 | wpn_damage[wpn_ump45] = CreateConVar("damage_ump45", "1.0"); 110 | wpn_damage[wpn_xm1014] = CreateConVar("damage_xm1014", "1.0"); 111 | 112 | for (int i = 1; i <= MaxClients; i++) 113 | { 114 | if (IsClientInGame(i)) 115 | OnClientPutInServer(i); 116 | } 117 | for(int i = 1; i < view_as(WpnID); i++) 118 | { 119 | wpn_damage_value[i] = wpn_damage[i].FloatValue; 120 | HookConVarChange(wpn_damage[i], OnConVarDamageChange); 121 | } 122 | AutoExecConfig(true, "damagemod"); 123 | } 124 | 125 | public void OnConVarDamageChange(ConVar cvar, const char[] oldVal, const char[] newVal) 126 | { 127 | if (StringToFloat(newVal) == StringToFloat(oldVal)) 128 | return; 129 | 130 | for(int i = 1; i < view_as(WpnID); i++) 131 | { 132 | if (cvar == wpn_damage[i]) 133 | { 134 | wpn_damage_value[i] = wpn_damage[i].FloatValue; 135 | } 136 | } 137 | } 138 | 139 | public void OnClientPutInServer(int client) 140 | { 141 | SDKHook(client, SDKHook_OnTakeDamage, OnTakeDamage); 142 | } 143 | 144 | public Action OnTakeDamage(int victim, int &attacker, int &inflictor, float &damage, int &damagetype, int &weapon, float damageForce[3], float damagePosition[3]) 145 | { 146 | if (damage <= 0.0 || victim < 1 || victim > MaxClients || attacker < 1 || attacker > MaxClients) 147 | return Plugin_Continue; 148 | 149 | if (!IsValidEdict(weapon)) 150 | return Plugin_Continue; 151 | 152 | char clsname[32]; 153 | GetEdictClassname(weapon, clsname, sizeof(clsname)); 154 | 155 | WpnID WeaponId; 156 | if ((WeaponId = WeaponClassToId(clsname)) != wpn_none) 157 | { 158 | damage *= wpn_damage_value[WeaponId]; 159 | return Plugin_Changed; 160 | } 161 | 162 | return Plugin_Continue; 163 | } -------------------------------------------------------------------------------- /csgo_obuy/csgo_obuy.sp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #define MAX_BUY_COUNT 2 6 | 7 | int g_iBuyLeft; 8 | 9 | int WeaponBuyCount[MAXPLAYERS+1][20]; 10 | 11 | public Plugin myinfo = 12 | { 13 | name = "Opposite buy menu", 14 | author = "Accelerator", 15 | description = "", 16 | version = "2.0", 17 | url = "https://github.com/accelerator74/sp-plugins" 18 | }; 19 | 20 | public void OnPluginStart() 21 | { 22 | RegConsoleCmd("obuy", Command_OBuy); 23 | HookEvent("round_start", Event_OnRoundStart); 24 | HookEvent("round_freeze_end", Event_OnRoundStart); 25 | } 26 | 27 | public Action Event_OnRoundStart(Event hEvent, const char[] name, bool dontBroadcast) 28 | { 29 | if (StrEqual(name, "round_freeze_end")) 30 | { 31 | for (int i = 1; i <= MaxClients; i++) 32 | { 33 | for (int k = 0; k < sizeof(WeaponBuyCount[]); k++) 34 | WeaponBuyCount[i][k] = 0; 35 | } 36 | } 37 | g_iBuyLeft = GetTime() + FindConVar("mp_buytime").IntValue; 38 | 39 | return Plugin_Continue; 40 | } 41 | 42 | public Action Command_OBuy(int client, int args) 43 | { 44 | if (!client || !IsClientInGame(client) || !IsPlayerAlive(client)) 45 | return Plugin_Handled; 46 | 47 | if (!AllowBuy(client)) 48 | return Plugin_Handled; 49 | 50 | if (GetClientTeam(client) == CS_TEAM_T) 51 | { 52 | Panel bPanel = new Panel(); 53 | SetPanelTitle(bPanel, "Counter-Terrorists Buy Menu"); 54 | 55 | char Value[64]; 56 | 57 | Format(Value, sizeof(Value), "USP-S/P2000 [ %i $ ]", CS_GetWeaponPrice(client, CSWeapon_HKP2000)); 58 | bPanel.DrawItem(Value); 59 | Format(Value, sizeof(Value), "Five-SeveN [ %i $ ]", CS_GetWeaponPrice(client, CSWeapon_FIVESEVEN)); 60 | bPanel.DrawItem(Value); 61 | Format(Value, sizeof(Value), "MAG-7 [ %i $ ]", CS_GetWeaponPrice(client, CSWeapon_MAG7)); 62 | bPanel.DrawItem(Value); 63 | Format(Value, sizeof(Value), "MP9 [ %i $ ]", CS_GetWeaponPrice(client, CSWeapon_MP9)); 64 | bPanel.DrawItem(Value); 65 | Format(Value, sizeof(Value), "Famas [ %i $ ]", CS_GetWeaponPrice(client, CSWeapon_FAMAS)); 66 | bPanel.DrawItem(Value); 67 | Format(Value, sizeof(Value), "M4A1/M4A1S [ %i $ ]", CS_GetWeaponPrice(client, CSWeapon_M4A1)); 68 | bPanel.DrawItem(Value); 69 | Format(Value, sizeof(Value), "AUG [ %i $ ]", CS_GetWeaponPrice(client, CSWeapon_AUG)); 70 | bPanel.DrawItem(Value); 71 | Format(Value, sizeof(Value), "SCAR-20 [ %i $ ]", CS_GetWeaponPrice(client, CSWeapon_SCAR20)); 72 | bPanel.DrawItem(Value); 73 | Format(Value, sizeof(Value), "IncGrenade [ %i $ ]", CS_GetWeaponPrice(client, CSWeapon_INCGRENADE)); 74 | bPanel.DrawItem(Value); 75 | 76 | bPanel.Send(client, PanelHandlerCT, 10); 77 | delete bPanel; 78 | return Plugin_Continue; 79 | } 80 | if (GetClientTeam(client) == CS_TEAM_CT) 81 | { 82 | Panel bPanel = new Panel(); 83 | SetPanelTitle(bPanel, "Terrorists Buy Menu"); 84 | 85 | char Value[64]; 86 | 87 | Format(Value, sizeof(Value), "Glock-18 [ %i $ ]", CS_GetWeaponPrice(client, CSWeapon_GLOCK)); 88 | bPanel.DrawItem(Value); 89 | Format(Value, sizeof(Value), "TEC-9 [ %i $ ]", CS_GetWeaponPrice(client, CSWeapon_TEC9)); 90 | bPanel.DrawItem(Value); 91 | Format(Value, sizeof(Value), "Sawed-Off [ %i $ ]", CS_GetWeaponPrice(client, CSWeapon_SAWEDOFF)); 92 | bPanel.DrawItem(Value); 93 | Format(Value, sizeof(Value), "MAC-10 [ %i $ ]", CS_GetWeaponPrice(client, CSWeapon_MAC10)); 94 | bPanel.DrawItem(Value); 95 | Format(Value, sizeof(Value), "Galil AR [ %i $ ]", CS_GetWeaponPrice(client, CSWeapon_GALILAR)); 96 | bPanel.DrawItem(Value); 97 | Format(Value, sizeof(Value), "AK47 [ %i $ ]", CS_GetWeaponPrice(client, CSWeapon_AK47)); 98 | bPanel.DrawItem(Value); 99 | Format(Value, sizeof(Value), "SG553 [ %i $ ]", CS_GetWeaponPrice(client, CSWeapon_SG556)); 100 | bPanel.DrawItem(Value); 101 | Format(Value, sizeof(Value), "G3SG1 [ %i $ ]", CS_GetWeaponPrice(client, CSWeapon_G3SG1)); 102 | bPanel.DrawItem(Value); 103 | Format(Value, sizeof(Value), "Molotov [ %i $ ]", CS_GetWeaponPrice(client, CSWeapon_MOLOTOV)); 104 | bPanel.DrawItem(Value); 105 | 106 | bPanel.Send(client, PanelHandlerT, 10); 107 | delete bPanel; 108 | return Plugin_Continue; 109 | } 110 | 111 | return Plugin_Continue; 112 | } 113 | 114 | public int PanelHandlerCT(Menu panel, MenuAction action, int client, int option) 115 | { 116 | if (action != MenuAction_Select) 117 | return; 118 | 119 | if (!AllowBuy(client)) 120 | return; 121 | 122 | bool CallMenu = true; 123 | switch (option) 124 | { 125 | case 1: 126 | { 127 | Panel bPanel = new Panel(); 128 | SetPanelTitle(bPanel, "Select Weapon"); 129 | 130 | bPanel.DrawItem("USP-S"); 131 | bPanel.DrawItem("P2000"); 132 | 133 | bPanel.Send(client, PanelHandlerUSP, 10); 134 | delete bPanel; 135 | CallMenu = false; 136 | } 137 | case 2: 138 | { 139 | if (WeaponBuyCount[client][0]++ >= MAX_BUY_COUNT) 140 | { 141 | PrintToChat(client, "You have already bought this weapon in this round!"); 142 | Command_OBuy(client, 0); 143 | return; 144 | } 145 | int Price = CS_GetWeaponPrice(client, CSWeapon_FIVESEVEN); 146 | if (BuyWeapon(client, "weapon_fiveseven", Price, 1) == 0) 147 | { 148 | PrintToChat(client, "You doesn't have enough cash to buy an \x03Five-SeveN\x01! The price is \x03$%i\x01!", Price); 149 | } 150 | } 151 | case 3: 152 | { 153 | if (WeaponBuyCount[client][1]++ >= MAX_BUY_COUNT) 154 | { 155 | PrintToChat(client, "You have already bought this weapon in this round!"); 156 | Command_OBuy(client, 0); 157 | return; 158 | } 159 | int Price = CS_GetWeaponPrice(client, CSWeapon_MAG7); 160 | if (BuyWeapon(client, "weapon_mag7", Price, 0) == 0) 161 | { 162 | PrintToChat(client, "You doesn't have enough cash to buy an \x03MAG-7\x01! The price is \x03$%i\x01!", Price); 163 | } 164 | } 165 | case 4: 166 | { 167 | if (WeaponBuyCount[client][2]++ >= MAX_BUY_COUNT) 168 | { 169 | PrintToChat(client, "You have already bought this weapon in this round!"); 170 | Command_OBuy(client, 0); 171 | return; 172 | } 173 | int Price = CS_GetWeaponPrice(client, CSWeapon_MP9); 174 | if (BuyWeapon(client, "weapon_mp9", Price, 0) == 0) 175 | { 176 | PrintToChat(client, "You doesn't have enough cash to buy an \x03MP-9\x01! The price is \x03$%i\x01!", Price); 177 | } 178 | } 179 | case 5: 180 | { 181 | if (WeaponBuyCount[client][3]++ >= MAX_BUY_COUNT) 182 | { 183 | PrintToChat(client, "You have already bought this weapon in this round!"); 184 | Command_OBuy(client, 0); 185 | return; 186 | } 187 | int Price = CS_GetWeaponPrice(client, CSWeapon_FAMAS); 188 | if (BuyWeapon(client, "weapon_famas", Price, 0) == 0) 189 | { 190 | PrintToChat(client, "You doesn't have enough cash to buy an \x03Famas\x01! The price is \x03$%i\x01!", Price); 191 | } 192 | } 193 | case 6: 194 | { 195 | Panel bPanel = new Panel(); 196 | SetPanelTitle(bPanel, "Select Weapon"); 197 | 198 | bPanel.DrawItem("M4A1"); 199 | bPanel.DrawItem("M4A1-S"); 200 | 201 | bPanel.Send(client, PanelHandlerM4A1, 10); 202 | delete bPanel; 203 | CallMenu = false; 204 | } 205 | case 7: 206 | { 207 | if (WeaponBuyCount[client][4]++ >= MAX_BUY_COUNT) 208 | { 209 | PrintToChat(client, "You have already bought this weapon in this round!"); 210 | Command_OBuy(client, 0); 211 | return; 212 | } 213 | int Price = CS_GetWeaponPrice(client, CSWeapon_AUG); 214 | if (BuyWeapon(client, "weapon_aug", Price, 0) == 0) 215 | { 216 | PrintToChat(client, "You doesn't have enough cash to buy an \x03AUG\x01! The price is \x03$%i\x01!", Price); 217 | } 218 | } 219 | case 8: 220 | { 221 | if (WeaponBuyCount[client][5]++ >= MAX_BUY_COUNT) 222 | { 223 | PrintToChat(client, "You have already bought this weapon in this round!"); 224 | Command_OBuy(client, 0); 225 | return; 226 | } 227 | int Price = CS_GetWeaponPrice(client, CSWeapon_SCAR20); 228 | if (BuyWeapon(client, "weapon_scar20", Price, 0) == 0) 229 | { 230 | PrintToChat(client, "You doesn't have enough cash to buy an \x03SCAR-20\x01! The price is \x03$%i\x01!", Price); 231 | } 232 | } 233 | case 9: 234 | { 235 | if (WeaponBuyCount[client][6]++ >= MAX_BUY_COUNT) 236 | { 237 | PrintToChat(client, "You have already bought this weapon in this round!"); 238 | Command_OBuy(client, 0); 239 | return; 240 | } 241 | int Price = CS_GetWeaponPrice(client, CSWeapon_INCGRENADE); 242 | if (BuyWeapon(client, "weapon_incgrenade", Price) == 0) 243 | { 244 | PrintToChat(client, "You doesn't have enough cash to buy an \x03IncGrenade\x01! The price is \x03$%i\x01!", Price); 245 | } 246 | } 247 | } 248 | if (CallMenu) Command_OBuy(client, 0); 249 | } 250 | 251 | public int PanelHandlerUSP(Menu panel, MenuAction action, int client, int option) 252 | { 253 | if (action != MenuAction_Select) 254 | return; 255 | 256 | if (!AllowBuy(client)) 257 | return; 258 | 259 | switch (option) 260 | { 261 | case 1: 262 | { 263 | if (WeaponBuyCount[client][7]++ >= MAX_BUY_COUNT) 264 | { 265 | PrintToChat(client, "You have already bought this weapon in this round!"); 266 | Command_OBuy(client, 0); 267 | return; 268 | } 269 | int Price = CS_GetWeaponPrice(client, CSWeapon_HKP2000); 270 | if (BuyWeapon(client, "weapon_usp_silencer", Price, 1) == 0) 271 | { 272 | PrintToChat(client, "You doesn't have enough cash to buy an \x03USP-S\x01! The price is \x03$%i\x01!", Price); 273 | } 274 | } 275 | case 2: 276 | { 277 | if (WeaponBuyCount[client][8]++ >= MAX_BUY_COUNT) 278 | { 279 | PrintToChat(client, "You have already bought this weapon in this round!"); 280 | Command_OBuy(client, 0); 281 | return; 282 | } 283 | int Price = CS_GetWeaponPrice(client, CSWeapon_HKP2000); 284 | if (BuyWeapon(client, "weapon_hkp2000", Price, 1) == 0) 285 | { 286 | PrintToChat(client, "You doesn't have enough cash to buy an \x03P2000\x01! The price is \x03$%i\x01!", Price); 287 | } 288 | } 289 | } 290 | Command_OBuy(client, 0); 291 | } 292 | 293 | public int PanelHandlerM4A1(Menu panel, MenuAction action, int client, int option) 294 | { 295 | if (action != MenuAction_Select) 296 | return; 297 | 298 | if (!AllowBuy(client)) 299 | return; 300 | 301 | switch (option) 302 | { 303 | case 1: 304 | { 305 | if (WeaponBuyCount[client][9]++ >= MAX_BUY_COUNT) 306 | { 307 | PrintToChat(client, "You have already bought this weapon in this round!"); 308 | Command_OBuy(client, 0); 309 | return; 310 | } 311 | int Price = CS_GetWeaponPrice(client, CSWeapon_M4A1); 312 | if (BuyWeapon(client, "weapon_m4a1", Price, 0) == 0) 313 | { 314 | PrintToChat(client, "You doesn't have enough cash to buy an \x03M4A1\x01! The price is \x03$%i\x01!", Price); 315 | } 316 | } 317 | case 2: 318 | { 319 | if (WeaponBuyCount[client][10]++ >= MAX_BUY_COUNT) 320 | { 321 | PrintToChat(client, "You have already bought this weapon in this round!"); 322 | Command_OBuy(client, 0); 323 | return; 324 | } 325 | int Price = CS_GetWeaponPrice(client, CSWeapon_M4A1); 326 | if (BuyWeapon(client, "weapon_m4a1_silencer", Price, 0) == 0) 327 | { 328 | PrintToChat(client, "You doesn't have enough cash to buy an \x03M4A1-Sx01! The price is \x03$%i\x01!", Price); 329 | } 330 | } 331 | } 332 | Command_OBuy(client, 0); 333 | } 334 | 335 | public int PanelHandlerT(Menu panel, MenuAction action, int client, int option) 336 | { 337 | if (action != MenuAction_Select) 338 | return; 339 | 340 | if (!AllowBuy(client)) 341 | return; 342 | 343 | switch (option) 344 | { 345 | case 1: 346 | { 347 | if (WeaponBuyCount[client][11]++ >= MAX_BUY_COUNT) 348 | { 349 | PrintToChat(client, "You have already bought this weapon in this round!"); 350 | Command_OBuy(client, 0); 351 | return; 352 | } 353 | int Price = CS_GetWeaponPrice(client, CSWeapon_GLOCK); 354 | if (BuyWeapon(client, "weapon_glock", Price, 1) == 0) 355 | { 356 | PrintToChat(client, "You doesn't have enough cash to buy an \x03Glock-18\x01! The price is \x03$%i\x01!", Price); 357 | } 358 | } 359 | case 2: 360 | { 361 | if (WeaponBuyCount[client][12]++ >= MAX_BUY_COUNT) 362 | { 363 | PrintToChat(client, "You have already bought this weapon in this round!"); 364 | Command_OBuy(client, 0); 365 | return; 366 | } 367 | int Price = CS_GetWeaponPrice(client, CSWeapon_TEC9); 368 | if (BuyWeapon(client, "weapon_tec9", Price, 1) == 0) 369 | { 370 | PrintToChat(client, "You doesn't have enough cash to buy an \x03TEC-9\x01! The price is \x03$%i\x01!", Price); 371 | } 372 | } 373 | case 3: 374 | { 375 | if (WeaponBuyCount[client][13]++ >= MAX_BUY_COUNT) 376 | { 377 | PrintToChat(client, "You have already bought this weapon in this round!"); 378 | Command_OBuy(client, 0); 379 | return; 380 | } 381 | int Price = CS_GetWeaponPrice(client, CSWeapon_SAWEDOFF); 382 | if (BuyWeapon(client, "weapon_sawedoff", Price, 0) == 0) 383 | { 384 | PrintToChat(client, "You doesn't have enough cash to buy an \x03Sawed-Off\x01! The price is \x03$%i\x01!", Price); 385 | } 386 | } 387 | case 4: 388 | { 389 | if (WeaponBuyCount[client][14]++ >= MAX_BUY_COUNT) 390 | { 391 | PrintToChat(client, "You have already bought this weapon in this round!"); 392 | Command_OBuy(client, 0); 393 | return; 394 | } 395 | int Price = CS_GetWeaponPrice(client, CSWeapon_MAC10); 396 | if (BuyWeapon(client, "weapon_mac10", Price, 0) == 0) 397 | { 398 | PrintToChat(client, "You doesn't have enough cash to buy an \x03MAC-10\x01! The price is \x03$%i\x01!", Price); 399 | } 400 | } 401 | case 5: 402 | { 403 | if (WeaponBuyCount[client][15]++ >= MAX_BUY_COUNT) 404 | { 405 | PrintToChat(client, "You have already bought this weapon in this round!"); 406 | Command_OBuy(client, 0); 407 | return; 408 | } 409 | int Price = CS_GetWeaponPrice(client, CSWeapon_GALILAR); 410 | if (BuyWeapon(client, "weapon_galilar", Price, 0) == 0) 411 | { 412 | PrintToChat(client, "You doesn't have enough cash to buy an \x03Galil AR\x01! The price is \x03$%i\x01!", Price); 413 | } 414 | } 415 | case 6: 416 | { 417 | if (WeaponBuyCount[client][16]++ >= MAX_BUY_COUNT) 418 | { 419 | PrintToChat(client, "You have already bought this weapon in this round!"); 420 | Command_OBuy(client, 0); 421 | return; 422 | } 423 | int Price = CS_GetWeaponPrice(client, CSWeapon_AK47); 424 | if (BuyWeapon(client, "weapon_ak47", Price, 0) == 0) 425 | { 426 | PrintToChat(client, "You doesn't have enough cash to buy an \x03AK-47\x01! The price is \x03$%i\x01!", Price); 427 | } 428 | } 429 | case 7: 430 | { 431 | if (WeaponBuyCount[client][17]++ >= MAX_BUY_COUNT) 432 | { 433 | PrintToChat(client, "You have already bought this weapon in this round!"); 434 | Command_OBuy(client, 0); 435 | return; 436 | } 437 | int Price = CS_GetWeaponPrice(client, CSWeapon_SG556); 438 | if (BuyWeapon(client, "weapon_sg556", Price, 0) == 0) 439 | { 440 | PrintToChat(client, "You doesn't have enough cash to buy an \x03SG553\x01! The price is \x03$%i\x01!", Price); 441 | } 442 | } 443 | case 8: 444 | { 445 | if (WeaponBuyCount[client][18]++ >= MAX_BUY_COUNT) 446 | { 447 | PrintToChat(client, "You have already bought this weapon in this round!"); 448 | Command_OBuy(client, 0); 449 | return; 450 | } 451 | int Price = CS_GetWeaponPrice(client, CSWeapon_G3SG1); 452 | if (BuyWeapon(client, "weapon_g3sg1", Price, 0) == 0) 453 | { 454 | PrintToChat(client, "You doesn't have enough cash to buy an \x03G3SG1\x01! The price is \x03$%i\x01!", Price); 455 | } 456 | } 457 | case 9: 458 | { 459 | if (WeaponBuyCount[client][19]++ >= MAX_BUY_COUNT) 460 | { 461 | PrintToChat(client, "You have already bought this weapon in this round!"); 462 | Command_OBuy(client, 0); 463 | return; 464 | } 465 | int Price = CS_GetWeaponPrice(client, CSWeapon_MOLOTOV); 466 | if (BuyWeapon(client, "weapon_molotov", Price) == 0) 467 | { 468 | PrintToChat(client, "You doesn't have enough cash to buy an \x03Molotov\x01! The price is \x03$%i\x01!", Price); 469 | } 470 | } 471 | } 472 | Command_OBuy(client, 0); 473 | } 474 | 475 | stock int BuyWeapon(int client, const char[] weapon_name, int Price, int slotid = -1) 476 | { 477 | int Cash = GetEntProp(client, Prop_Send, "m_iAccount"); 478 | if (Cash >= Price) 479 | { 480 | if (slotid > -1) 481 | { 482 | int slot = GetPlayerWeaponSlot(client, slotid); 483 | if (slot > 0) 484 | { 485 | CS_DropWeapon(client, slot, false); 486 | } 487 | } 488 | int item = GivePlayerItem(client, weapon_name); 489 | if (item > 0) 490 | { 491 | Cash -= Price; 492 | SetEntProp(client, Prop_Send, "m_iAccount", Cash); 493 | 494 | return 1; 495 | } 496 | return -1; 497 | } 498 | return 0; 499 | } 500 | 501 | bool AllowBuy(int client) 502 | { 503 | if (FindConVar("mp_buy_anywhere").IntValue == 0) 504 | { 505 | if (!GetEntProp(client, Prop_Send, "m_bInBuyZone")) 506 | { 507 | PrintToChat(client, "You left the buy zone"); 508 | return false; 509 | } 510 | } 511 | 512 | if (GetTime() > g_iBuyLeft) 513 | { 514 | PrintToChat(client, "Buying time expired"); 515 | return false; 516 | } 517 | 518 | return true; 519 | } -------------------------------------------------------------------------------- /csgo_zp_semiclip/semiclip.phrases.txt: -------------------------------------------------------------------------------- 1 | "Phrases" 2 | { 3 | "How_Use" 4 | { 5 | "en" "Press E (use) to pass through the other players" 6 | "ru" "Нажмите E (использовать) чтобы проходить через других игроков" 7 | } 8 | "Buy_Use" 9 | { 10 | "en" " Attention! You have enabled the buy on button E (use)" 11 | "ru" " Внимание! У вас включена покупка на кнопку E (использовать)" 12 | } 13 | "Buy_Use_Disable" 14 | { 15 | "en" "For a comfortable game it is recommended to disable by entering to the console cl_use_opens_buy_menu 0" 16 | "ru" "Для комфортной игры рекомендуем её отключить, введя в консоль cl_use_opens_buy_menu 0" 17 | } 18 | } -------------------------------------------------------------------------------- /csgo_zp_semiclip/zp_semiclip.sp: -------------------------------------------------------------------------------- 1 | #pragma semicolon 1 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | #pragma newdecls required 9 | 10 | bool round_no_block = false; 11 | 12 | bool g_ShouldCollide[MAXPLAYERS + 1] = { true, ... }; 13 | float g_ShouldCollideTime[MAXPLAYERS + 1]; 14 | 15 | float EngineTime; 16 | float eTime; 17 | float LastTick; 18 | 19 | public Plugin myinfo = 20 | { 21 | name = "[ZP] Addon: Semiclip", 22 | author = "Accelerator", 23 | description = "", 24 | version = "3.0", 25 | url = "https://github.com/accelerator74/sp-plugins" 26 | }; 27 | 28 | public void OnPluginStart() 29 | { 30 | LoadTranslations("semiclip.phrases"); 31 | 32 | HookEvent( "round_start", Event_RoundStart ); 33 | HookEvent( "player_spawn", EventPlayerSpawn ); 34 | 35 | for (int i = 1; i <= MaxClients; i++) 36 | { 37 | if (IsClientConnected(i) && IsClientInGame(i)) 38 | OnClientPutInServer(i); 39 | } 40 | } 41 | 42 | public void EventPlayerSpawn(Event event, const char[] name, bool dontBroadcast) 43 | { 44 | int client = GetClientOfUserId(GetEventInt(event, "userid")); 45 | 46 | if (!client) 47 | return; 48 | 49 | if (round_no_block) 50 | { 51 | SetEntProp(client, Prop_Data, "m_CollisionGroup", 2); 52 | } 53 | } 54 | 55 | public void Event_RoundStart(Event event, const char[] name, bool dontBroadcast) 56 | { 57 | round_no_block = true; 58 | for ( int i = 1; i <= MaxClients; i++ ) 59 | { 60 | if ( IsClientConnected( i ) && IsClientInGame( i ) ) 61 | SetEntProp(i, Prop_Data, "m_CollisionGroup", 2); 62 | } 63 | } 64 | 65 | public void ZP_OnZombieModStarted(int modeIndex) 66 | { 67 | round_no_block = false; 68 | for ( int i = 1; i <= MaxClients; i++ ) 69 | { 70 | if ( IsClientConnected( i ) && IsClientInGame( i ) ) 71 | SetEntProp(i, Prop_Data, "m_CollisionGroup", 5); 72 | } 73 | CreateTimer(7.0, Timer_Info); 74 | } 75 | 76 | public Action Timer_Info(Handle timer) 77 | { 78 | PrintHintTextToAll("%t", "How_Use"); 79 | for ( int i = 1; i <= MaxClients; i++ ) 80 | { 81 | if ( IsClientConnected( i ) && IsClientInGame( i ) && !IsFakeClient( i )) 82 | QueryClientConVar(i, "cl_use_opens_buy_menu", view_as(ClientConVar), i); 83 | } 84 | } 85 | 86 | public void ClientConVar(QueryCookie cookie, int client, ConVarQueryResult result, const char[] cvarName, const char[] cvarValue) 87 | { 88 | if (StringToInt(cvarValue) == 1) 89 | { 90 | PrintToChat(client, "%t", "Buy_Use"); 91 | PrintToChat(client, "%t", "Buy_Use_Disable"); 92 | } 93 | } 94 | 95 | public void OnPlayerRunCmdPost(int client, int buttons, int impulse, const float vel[3], const float angles[3], int weapon) 96 | { 97 | if (round_no_block) 98 | return; 99 | 100 | if (buttons & IN_USE) 101 | { 102 | EngineTime = GetEngineTime(); 103 | 104 | g_ShouldCollide[client] = false; 105 | g_ShouldCollideTime[client] = EngineTime; 106 | 107 | if (EngineTime - LastTick > 0.1) 108 | { 109 | LastTick = EngineTime; 110 | 111 | float location[3], targetOrigin[3]; 112 | GetClientAbsOrigin(client, location); 113 | for (int i = 1; i <= MaxClients; i++) 114 | { 115 | if (IsClientInGame(i)) 116 | { 117 | if (IsPlayerAlive(i)) 118 | { 119 | if (GetClientTeam(client) == GetClientTeam(i)) 120 | { 121 | GetClientAbsOrigin(i, targetOrigin); 122 | 123 | if (GetVectorDistance(targetOrigin, location) <= 80.0) 124 | { 125 | g_ShouldCollide[i] = false; 126 | g_ShouldCollideTime[i] = EngineTime; 127 | } 128 | } 129 | } 130 | } 131 | } 132 | } 133 | } 134 | } 135 | 136 | public void OnGameFrame() 137 | { 138 | eTime = GetEngineTime() - 1.0; 139 | for (int i = 1; i <= MaxClients; i++) 140 | { 141 | if (g_ShouldCollideTime[i] > 0.0 && eTime >= g_ShouldCollideTime[i]) 142 | { 143 | g_ShouldCollide[i] = true; 144 | g_ShouldCollideTime[i] = 0.0; 145 | } 146 | } 147 | } 148 | 149 | public void OnClientPutInServer(int client) 150 | { 151 | SDKHook(client, SDKHook_ShouldCollide, ShouldCollide); 152 | } 153 | 154 | public bool ShouldCollide(int entity, int collisiongroup, int contentsmask, bool result) 155 | { 156 | if (contentsmask == 33636363) 157 | { 158 | if(!g_ShouldCollide[entity]) 159 | { 160 | result = false; 161 | return false; 162 | } 163 | else 164 | { 165 | result = true; 166 | return true; 167 | } 168 | } 169 | 170 | return true; 171 | } -------------------------------------------------------------------------------- /l4d2_AddonsController/AddonsController.sp: -------------------------------------------------------------------------------- 1 | #pragma semicolon 1 2 | 3 | #include 4 | #tryinclude 5 | 6 | #if !defined _l4do_included 7 | #tryinclude 8 | #if !defined _l4dh_included 9 | #error "Required Left4Downtown2 or Left4Dhooks!" 10 | #endif 11 | #endif 12 | 13 | #undef REQUIRE_PLUGIN 14 | #include 15 | 16 | new String:datafilepath[PLATFORM_MAX_PATH]; 17 | new String:datalogpath[PLATFORM_MAX_PATH]; 18 | 19 | new Handle:g_hKV = INVALID_HANDLE; 20 | new Handle:hTopMenu = INVALID_HANDLE; 21 | new g_Target[MAXPLAYERS+1]; 22 | 23 | public Plugin:myinfo = 24 | { 25 | name = "Addons Controller", 26 | author = "Accelerator", 27 | description = "Enable/Disable addons Players", 28 | version = "2.3", 29 | url = "https://github.com/accelerator74/sp-plugins" 30 | }; 31 | 32 | public OnPluginStart() 33 | { 34 | LoadTranslations("common.phrases"); 35 | 36 | BuildPath(Path_SM, datafilepath, sizeof(datafilepath), "data/AddonsController.txt"); 37 | BuildPath(Path_SM, datalogpath, sizeof(datalogpath), "logs/AddonsController.log"); 38 | 39 | RegAdminCmd("sm_banaddons", Command_BanAddons, ADMFLAG_BAN, "sm_banaddons "); 40 | RegAdminCmd("sm_unbanaddons", Command_UnbanAddons, ADMFLAG_UNBAN, "sm_unbanaddons "); 41 | 42 | new Handle:topmenu; 43 | if (LibraryExists("adminmenu") && ((topmenu = GetAdminTopMenu()) != INVALID_HANDLE)) 44 | { 45 | OnAdminMenuReady(topmenu); 46 | } 47 | 48 | g_hKV = CreateKeyValues("AddonsController"); 49 | FileToKeyValues(g_hKV, datafilepath); 50 | } 51 | 52 | public OnLibraryRemoved(const String:name[]) { 53 | if (StrEqual(name, "adminmenu")) 54 | { 55 | hTopMenu = INVALID_HANDLE; 56 | } 57 | } 58 | 59 | public OnAdminMenuReady(Handle:topmenu) 60 | { 61 | /* Block us from being called twice */ 62 | if (topmenu == hTopMenu) 63 | { 64 | return; 65 | } 66 | 67 | /* Save the Handle */ 68 | hTopMenu = topmenu; 69 | 70 | /* Find the "Player Commands" category */ 71 | new TopMenuObject:player_commands = FindTopMenuCategory(hTopMenu, ADMINMENU_PLAYERCOMMANDS); 72 | 73 | if (player_commands != INVALID_TOPMENUOBJECT) 74 | { 75 | AddToTopMenu(hTopMenu, "sm_banaddons", TopMenuObject_Item, AdminMenu_BanAddons, player_commands, "sm_banaddons", ADMFLAG_BAN); 76 | } 77 | } 78 | 79 | public AdminMenu_BanAddons(Handle:topmenu, TopMenuAction:action, TopMenuObject:object_id, param, String:buffer[], maxlength) 80 | { 81 | switch (action) 82 | { 83 | case TopMenuAction_DisplayOption: 84 | { 85 | Format(buffer, maxlength, "Addons Controller"); 86 | } 87 | case TopMenuAction_SelectOption: 88 | { 89 | DisplayPlayerMenu(param); 90 | } 91 | } 92 | } 93 | 94 | stock DisplayPlayerMenu(client) 95 | { 96 | new Handle:menu = CreateMenu(MenuHandler_Player); 97 | 98 | decl String:title[100]; 99 | Format(title, sizeof(title), "Addons Controller:"); 100 | SetMenuTitle(menu, title); 101 | SetMenuExitBackButton(menu, true); 102 | AddTargetsToMenu2(menu, client, COMMAND_FILTER_NO_BOTS|COMMAND_FILTER_CONNECTED); 103 | DisplayMenu(menu, client, MENU_TIME_FOREVER); 104 | } 105 | 106 | public MenuHandler_Player(Handle:menu, MenuAction:action, param1, param2) 107 | { 108 | switch (action) 109 | { 110 | case MenuAction_End: 111 | { 112 | CloseHandle(menu); 113 | } 114 | case MenuAction_Cancel: 115 | { 116 | if (param2 == MenuCancel_ExitBack && hTopMenu != INVALID_HANDLE) 117 | { 118 | DisplayTopMenu(hTopMenu, param1, TopMenuPosition_LastCategory); 119 | } 120 | } 121 | case MenuAction_Select: 122 | { 123 | decl String:info[32]; 124 | 125 | GetMenuItem(menu, param2, info, sizeof(info)); 126 | new userid = StringToInt(info); 127 | new target = GetClientOfUserId(userid); 128 | 129 | if (!target) 130 | { 131 | PrintToChat(param1, "%t", "Player no longer available"); 132 | } 133 | else if (!CanUserTarget(param1, target)) 134 | { 135 | PrintToChat(param1, "%t", "Unable to target"); 136 | } 137 | else 138 | { 139 | g_Target[param1] = target; 140 | DisplayTypesMenu(param1, target); 141 | } 142 | } 143 | } 144 | } 145 | 146 | stock DisplayTypesMenu(client, target) 147 | { 148 | new Handle:menu = CreateMenu(MenuHandler_Types); 149 | 150 | decl String:title[100]; 151 | Format(title, sizeof(title), "Addons Controller:"); 152 | SetMenuTitle(menu, title); 153 | SetMenuExitBackButton(menu, true); 154 | 155 | if (GetFileData(target)) 156 | { 157 | AddMenuItem(menu, "0", "Enable Addons"); 158 | } 159 | else 160 | { 161 | AddMenuItem(menu, "1", "Disable Addons"); 162 | } 163 | 164 | DisplayMenu(menu, client, MENU_TIME_FOREVER); 165 | } 166 | 167 | public MenuHandler_Types(Handle:menu, MenuAction:action, param1, param2) 168 | { 169 | switch (action) 170 | { 171 | case MenuAction_End: 172 | { 173 | CloseHandle(menu); 174 | } 175 | case MenuAction_Cancel: 176 | { 177 | if (param1 == MenuCancel_ExitBack && hTopMenu != INVALID_HANDLE) 178 | { 179 | DisplayTopMenu(hTopMenu, param1, TopMenuPosition_LastCategory); 180 | } 181 | } 182 | case MenuAction_Select: 183 | { 184 | decl String:info[32]; 185 | GetMenuItem(menu, param2, info, sizeof(info)); 186 | 187 | PerformAddons(param1, g_Target[param1], StringToInt(info)); 188 | } 189 | } 190 | } 191 | 192 | stock PerformAddons(client, target, type) 193 | { 194 | switch (type) 195 | { 196 | case 0: 197 | { 198 | SetFileData(target, client, "block", "0"); 199 | if (client) 200 | { 201 | ShowActivity2(client, "[SM] ", "Addons Enable for %N", target); 202 | } 203 | } 204 | case 1: 205 | { 206 | SetFileData(target, client, "block", "1"); 207 | if (client) 208 | { 209 | ShowActivity2(client, "[SM] ", "Addons Disable for %N", target); 210 | } 211 | } 212 | } 213 | } 214 | 215 | public Action:L4D2_OnClientDisableAddons(const String:SteamID[]) 216 | { 217 | if (GetFileData(0, SteamID)) 218 | return Plugin_Continue; 219 | 220 | return Plugin_Handled; 221 | } 222 | 223 | public Action:Command_BanAddons(client, args) 224 | { 225 | if (args < 1) 226 | { 227 | ReplyToCommand(client, "[SM] Usage: sm_banaddons "); 228 | return Plugin_Handled; 229 | } 230 | 231 | decl String:arg[50]; 232 | GetCmdArgString(arg, sizeof(arg)); 233 | 234 | ReplaceString(arg, sizeof(arg), "\"", ""); 235 | 236 | bool idValid = false; 237 | if (!strncmp(arg, "STEAM_", 6) && arg[7] == ':') 238 | idValid = true; 239 | else if (!strncmp(arg, "[U:", 3)) 240 | idValid = true; 241 | 242 | if (!idValid) 243 | { 244 | ReplyToCommand(client, "[SM] This is not SteamID!"); 245 | return Plugin_Handled; 246 | } 247 | 248 | SetFileData(0, client, "block", "1", arg); 249 | ShowActivity2(client, "[SM] ", "Addons Disable for %s", arg); 250 | return Plugin_Handled; 251 | } 252 | 253 | public Action:Command_UnbanAddons(client, args) 254 | { 255 | if (args < 1) 256 | { 257 | ReplyToCommand(client, "[SM] Usage: sm_unbanaddons "); 258 | return Plugin_Handled; 259 | } 260 | 261 | decl String:arg[50]; 262 | GetCmdArgString(arg, sizeof(arg)); 263 | 264 | ReplaceString(arg, sizeof(arg), "\"", ""); 265 | 266 | bool idValid = false; 267 | if (!strncmp(arg, "STEAM_", 6) && arg[7] == ':') 268 | idValid = true; 269 | else if (!strncmp(arg, "[U:", 3)) 270 | idValid = true; 271 | 272 | if (!idValid) 273 | { 274 | ReplyToCommand(client, "[SM] This is not SteamID!"); 275 | return Plugin_Handled; 276 | } 277 | 278 | SetFileData(0, client, "block", "0", arg); 279 | ShowActivity2(client, "[SM] ", "Addons Enable for %s", arg); 280 | return Plugin_Handled; 281 | } 282 | 283 | stock GetFileData(client, const String:data[] = "") 284 | { 285 | decl String:SteamID[50]; 286 | if (client && data[0] == '\0') 287 | { 288 | GetClientAuthId(client, AuthId_Steam2, SteamID, sizeof(SteamID)); 289 | } 290 | else 291 | { 292 | strcopy(SteamID, sizeof(SteamID), data); 293 | } 294 | 295 | KvRewind(g_hKV); 296 | if (KvJumpToKey(g_hKV, SteamID)) 297 | return true; 298 | 299 | return false; 300 | } 301 | 302 | stock SetFileData(client, admin, const String:key[], String:value[], String:SteamID[50] = "") 303 | { 304 | if (SteamID[0] == '\0' && client) 305 | { 306 | GetClientAuthId(client, AuthId_Steam2, SteamID, sizeof(SteamID)); 307 | } 308 | 309 | KvRewind(g_hKV); 310 | if (StrEqual(value, "1")) 311 | { 312 | KvJumpToKey(g_hKV, SteamID, true); 313 | KvSetString(g_hKV, key, value); 314 | KvRewind(g_hKV); 315 | LogToFileEx(datalogpath, "[%N]: Addons Disable for %s", admin, SteamID); 316 | } 317 | else 318 | { 319 | if (KvJumpToKey(g_hKV, SteamID)) 320 | { 321 | KvDeleteThis(g_hKV); 322 | KvRewind(g_hKV); 323 | LogToFileEx(datalogpath, "[%N]: Addons Enable for %s", admin, SteamID); 324 | } 325 | } 326 | KeyValuesToFile(g_hKV, datafilepath); 327 | CloseHandle(g_hKV); 328 | 329 | g_hKV = CreateKeyValues("AddonsController"); 330 | FileToKeyValues(g_hKV, datafilepath); 331 | } -------------------------------------------------------------------------------- /l4d2_SpeakingList/SpeakingList.sp: -------------------------------------------------------------------------------- 1 | #pragma semicolon 1 2 | #pragma newdecls required 3 | 4 | #include 5 | #include 6 | 7 | bool ClientSpeaked[MAXPLAYERS+1]; 8 | bool alltalk; 9 | ConVar sv_alltalk; 10 | 11 | // "L4D2 EMS HUD Functions" by "sorallll" 12 | 13 | enum 14 | { 15 | HUD_LEFT_TOP, 16 | HUD_LEFT_BOT, 17 | HUD_MID_TOP, 18 | HUD_MID_BOT, 19 | HUD_RIGHT_TOP, 20 | HUD_RIGHT_BOT, 21 | HUD_TICKER, 22 | HUD_FAR_LEFT, 23 | HUD_FAR_RIGHT, 24 | HUD_MID_BOX, 25 | HUD_SCORE_TITLE, 26 | HUD_SCORE_1, 27 | HUD_SCORE_2, 28 | HUD_SCORE_3, 29 | HUD_SCORE_4 30 | }; 31 | 32 | // custom flags for background, time, alignment, which team, pre or postfix, etc 33 | #define HUD_FLAG_PRESTR (1<<0) // do you want a string/value pair to start(pre) or end(post) with the static string (default is PRE) 34 | #define HUD_FLAG_POSTSTR (1<<1) // ditto 35 | #define HUD_FLAG_BEEP (1<<2) // Makes a countdown timer blink 36 | #define HUD_FLAG_BLINK (1<<3) // do you want this field to be blinking 37 | #define HUD_FLAG_AS_TIME (1<<4) // to do.. 38 | #define HUD_FLAG_COUNTDOWN_WARN (1<<5) // auto blink when the timer gets under 10 seconds 39 | #define HUD_FLAG_NOBG (1<<6) // dont draw the background box for this UI element 40 | #define HUD_FLAG_ALLOWNEGTIMER (1<<7) // by default Timers stop on 0:00 to avoid briefly going negative over network, this keeps that from happening 41 | #define HUD_FLAG_ALIGN_LEFT (1<<8) // Left justify this text 42 | #define HUD_FLAG_ALIGN_CENTER (1<<9) // Center justify this text 43 | #define HUD_FLAG_ALIGN_RIGHT (3<<8) // Right justify this text 44 | #define HUD_FLAG_TEAM_SURVIVORS (1<<10) // only show to the survivor team 45 | #define HUD_FLAG_TEAM_INFECTED (1<<11) // only show to the special infected team 46 | #define HUD_FLAG_TEAM_MASK (3<<10) // link HUD_FLAG_TEAM_SURVIVORS and HUD_FLAG_TEAM_INFECTED 47 | #define HUD_FLAG_UNKNOWN1 (1<<12) // ? 48 | #define HUD_FLAG_TEXT (1<<13) // ? 49 | #define HUD_FLAG_NOTVISIBLE (1<<14) // if you want to keep the slot data but keep it from displaying 50 | 51 | public Plugin myinfo = 52 | { 53 | name = "SpeakingList", 54 | author = "Accelerator", 55 | description = "Voice Announce. Print to Hud Message who Speaking.", 56 | version = "2.1", 57 | url = "https://github.com/accelerator74/sp-plugins" 58 | } 59 | 60 | public void OnPluginStart() 61 | { 62 | sv_alltalk = FindConVar("sv_alltalk"); 63 | alltalk = sv_alltalk.BoolValue; 64 | sv_alltalk.AddChangeHook(OnAllTalkChange); 65 | 66 | HookEvent("round_start", Event_RoundStart, EventHookMode_PostNoCopy); 67 | } 68 | 69 | public void OnMapStart() 70 | { 71 | GameRules_SetProp("m_bChallengeModeActive", true, _, _, true); 72 | HudSet(); 73 | CreateTimer(0.3, ShowSpeaking, _, TIMER_REPEAT|TIMER_FLAG_NO_MAPCHANGE); 74 | } 75 | 76 | public void OnClientSpeaking(int client) 77 | { 78 | ClientSpeaked[client] = true; 79 | } 80 | 81 | public void OnClientDisconnect(int client) 82 | { 83 | ClientSpeaked[client] = false; 84 | } 85 | 86 | void OnAllTalkChange(Handle convar, const char[] oldValue, const char[] newValue) 87 | { 88 | HudSet(); 89 | } 90 | 91 | void Event_RoundStart(Event hEvent, const char[] strName, bool DontBroadcast) 92 | { 93 | HudSet(); 94 | } 95 | 96 | void HudSet() 97 | { 98 | alltalk = sv_alltalk.BoolValue; 99 | 100 | RemoveHUD(HUD_RIGHT_TOP); 101 | RemoveHUD(HUD_RIGHT_BOT); 102 | 103 | if (!alltalk) 104 | { 105 | GameRules_SetProp("m_iScriptedHUDFlags", HUD_FLAG_TEXT|HUD_FLAG_NOBG|HUD_FLAG_ALIGN_LEFT|HUD_FLAG_TEAM_SURVIVORS, _, HUD_RIGHT_TOP, true); 106 | GameRules_SetProp("m_iScriptedHUDFlags", HUD_FLAG_TEXT|HUD_FLAG_NOBG|HUD_FLAG_ALIGN_LEFT|HUD_FLAG_TEAM_INFECTED, _, HUD_RIGHT_BOT, true); 107 | GameRules_SetPropFloat("m_fScriptedHUDPosX", 0.82, HUD_RIGHT_BOT, true); 108 | GameRules_SetPropFloat("m_fScriptedHUDPosY", 0.67, HUD_RIGHT_BOT, true); 109 | GameRules_SetPropFloat("m_fScriptedHUDWidth", 0.17, HUD_RIGHT_BOT, true); 110 | GameRules_SetPropFloat("m_fScriptedHUDHeight", 0.3, HUD_RIGHT_BOT, true); 111 | } 112 | else 113 | GameRules_SetProp("m_iScriptedHUDFlags", HUD_FLAG_TEXT|HUD_FLAG_NOBG|HUD_FLAG_ALIGN_LEFT, _, HUD_RIGHT_TOP, true); 114 | 115 | GameRules_SetPropFloat("m_fScriptedHUDPosX", 0.82, HUD_RIGHT_TOP, true); 116 | GameRules_SetPropFloat("m_fScriptedHUDPosY", 0.67, HUD_RIGHT_TOP, true); 117 | GameRules_SetPropFloat("m_fScriptedHUDWidth", 0.17, HUD_RIGHT_TOP, true); 118 | GameRules_SetPropFloat("m_fScriptedHUDHeight", 0.3, HUD_RIGHT_TOP, true); 119 | } 120 | 121 | void RemoveHUD(int slot) 122 | { 123 | GameRules_SetProp("m_iScriptedHUDInts", 0, _, slot, true); 124 | GameRules_SetPropFloat("m_fScriptedHUDFloats", 0.0, slot, true); 125 | GameRules_SetProp("m_iScriptedHUDFlags", HUD_FLAG_NOTVISIBLE, _, slot, true); 126 | GameRules_SetPropFloat("m_fScriptedHUDPosX", 0.0, slot, true); 127 | GameRules_SetPropFloat("m_fScriptedHUDPosY", 0.0, slot, true); 128 | GameRules_SetPropFloat("m_fScriptedHUDWidth", 0.0, slot, true); 129 | GameRules_SetPropFloat("m_fScriptedHUDHeight", 0.0, slot, true); 130 | GameRules_SetPropString("m_szScriptedHUDStringSet", "", true, slot); 131 | } 132 | 133 | Action ShowSpeaking(Handle timer) 134 | { 135 | char str[2][255], name[32]; 136 | int len, team; 137 | 138 | for (int i = 1; i <= MaxClients; i++) 139 | { 140 | if (IsClientInGame(i) && !IsFakeClient(i)) 141 | { 142 | if (ClientSpeaked[i]) 143 | { 144 | ClientSpeaked[i] = false; 145 | 146 | team = alltalk ? 0 : GetClientTeam(i)-2; 147 | if (team < 0 || team > 1) 148 | continue; 149 | 150 | if (GetClientListeningFlags(i) & VOICE_MUTED) 151 | continue; 152 | 153 | GetClientName(i, name, sizeof(name)); 154 | if (strlen(name) > 25) 155 | { 156 | name[23] = '.'; 157 | name[24] = '.'; 158 | name[25] = '.'; 159 | name[26] = 0; 160 | } 161 | 162 | len = strlen(str[team]); 163 | if (len) { 164 | Format(str[team][len], sizeof(str[])-len, "\n> %s", name); 165 | } else { 166 | FormatEx(str[team], sizeof(str[]), "> %s", name); 167 | } 168 | } 169 | } 170 | } 171 | GameRules_SetPropString("m_szScriptedHUDStringSet", str[0], true, HUD_RIGHT_TOP); 172 | GameRules_SetPropString("m_szScriptedHUDStringSet", str[1], true, HUD_RIGHT_BOT); 173 | return Plugin_Continue; 174 | } -------------------------------------------------------------------------------- /l4d2_afkmanager/afkmanager.sp: -------------------------------------------------------------------------------- 1 | #pragma semicolon 1 2 | #include 3 | #include 4 | #pragma newdecls required 5 | 6 | enum struct PlayerData { 7 | int specTime; 8 | int afkTime; 9 | int shoved; 10 | float position[3]; 11 | float angles[2]; 12 | } 13 | 14 | PlayerData playerData[MAXPLAYERS]; 15 | 16 | ConVar l4d2_afk_kick; 17 | ConVar l4d2_afk_time; 18 | 19 | int g_iAfkKick; 20 | int g_iAfkTime; 21 | 22 | public Plugin myinfo = 23 | { 24 | name = "AFK Manager", 25 | author = "Accelerator", 26 | description = "AutoKick AFK Players", 27 | version = "3.5", 28 | url = "https://github.com/accelerator74/sp-plugins" 29 | } 30 | 31 | public void OnPluginStart() 32 | { 33 | l4d2_afk_kick = CreateConVar("l4d2_afk_kick", "350", "AFK time after which you will be kicked"); 34 | l4d2_afk_time = CreateConVar("l4d2_afk_time", "60", "AFK time after which you will be moved to the Spectator team"); 35 | 36 | g_iAfkKick = l4d2_afk_kick.IntValue; 37 | g_iAfkTime = l4d2_afk_time.IntValue; 38 | 39 | l4d2_afk_kick.AddChangeHook(OnConVarChange); 40 | l4d2_afk_time.AddChangeHook(OnConVarChange); 41 | 42 | HookEvent("player_team", Event_PlayerTeam); 43 | HookEvent("player_hurt", Event_PlayerShoved); 44 | HookEvent("player_shoved", Event_PlayerShoved); 45 | 46 | HookEntityOutput("func_button_timed", "OnPressed", OnButtonPress); 47 | } 48 | 49 | public void OnMapStart() 50 | { 51 | CreateTimer(1.0, timer_AfkCheck, _, TIMER_REPEAT|TIMER_FLAG_NO_MAPCHANGE); 52 | } 53 | 54 | void OnConVarChange(Handle convar, const char[] oldValue, const char[] newValue) 55 | { 56 | g_iAfkKick = l4d2_afk_kick.IntValue; 57 | g_iAfkTime = l4d2_afk_time.IntValue; 58 | } 59 | 60 | void Event_PlayerTeam(Event event, const char[] name, bool dontBroadcast) 61 | { 62 | int client = GetClientOfUserId(event.GetInt("userid")); 63 | 64 | playerData[client].position = NULL_VECTOR; 65 | playerData[client].angles[0] = playerData[client].angles[1] = 0.0; 66 | playerData[client].specTime = 0; 67 | playerData[client].afkTime = 0; 68 | playerData[client].shoved = 0; 69 | } 70 | 71 | void Event_PlayerShoved(Event event, const char[] name, bool dontBroadcast) 72 | { 73 | playerData[GetClientOfUserId(event.GetInt("userid"))].shoved = 2; 74 | } 75 | 76 | void OnButtonPress(const char[] name, int caller, int activator, float delay) 77 | { 78 | if (activator < 1 || activator > MaxClients) 79 | return; 80 | 81 | playerData[activator].afkTime = 0; 82 | } 83 | 84 | Action timer_AfkCheck(Handle timer) 85 | { 86 | int idx; 87 | bool isAFK; 88 | float curPosition[3], curAngles[3]; 89 | 90 | for(int client = 1; client <= MaxClients; client++) 91 | { 92 | if(IsClientInGame(client) && !IsFakeClient(client)) 93 | { 94 | if(GetClientTeam(client) <= 1) 95 | { 96 | if(GetUserAdmin(client) != INVALID_ADMIN_ID) 97 | continue; 98 | 99 | playerData[client].specTime++; 100 | 101 | if(playerData[client].specTime >= g_iAfkKick) 102 | { 103 | KickClient(client, "You were AFK for too long (%i sec)", playerData[client].specTime); 104 | } 105 | else 106 | { 107 | PrintCenterText(client, "AFK autokick: %i sec", g_iAfkKick - playerData[client].specTime); 108 | } 109 | } 110 | else 111 | { 112 | if(!IsPlayerAlive(client)) 113 | continue; 114 | 115 | if(GetEntProp(client, Prop_Send, "m_isIncapacitated", 1) || GetEntProp(client, Prop_Send, "m_isHangingFromLedge", 1)) 116 | continue; 117 | 118 | GetClientAbsOrigin(client, curPosition); 119 | 120 | if (IsInSaferoom(curPosition)) 121 | continue; 122 | 123 | GetClientEyeAngles(client, curAngles); 124 | 125 | isAFK = true; 126 | 127 | if(GetVectorDistance(curPosition, playerData[client].position) > 80.0) 128 | { 129 | isAFK = false; 130 | } 131 | 132 | if(isAFK) 133 | { 134 | if(curAngles[0] != playerData[client].angles[0] && 135 | curAngles[1] != playerData[client].angles[1]) 136 | { 137 | isAFK = false; 138 | } 139 | } 140 | 141 | for(idx = 0; idx < 2; idx++) 142 | { 143 | playerData[client].position[idx] = curPosition[idx]; 144 | playerData[client].angles[idx] = curAngles[idx]; 145 | } 146 | 147 | playerData[client].position[2] = curPosition[2]; 148 | 149 | if(isAFK) 150 | { 151 | playerData[client].afkTime++; 152 | 153 | if(playerData[client].afkTime >= g_iAfkTime) 154 | { 155 | SetEntProp(client, Prop_Send, "m_iGlowType", 0); 156 | SetEntProp(client, Prop_Send, "m_glowColorOverride", 0); 157 | SetEntProp(client, Prop_Send, "m_bFlashing", 0, 1); 158 | SetEntProp(client, Prop_Send, "m_nGlowRange", 0); 159 | RequestFrame(MoveToSpectator, GetClientUserId(client)); 160 | } 161 | } 162 | else 163 | { 164 | if (playerData[client].shoved-- <= 0) 165 | playerData[client].afkTime = 0; 166 | } 167 | } 168 | } 169 | } 170 | return Plugin_Continue; 171 | } 172 | 173 | void MoveToSpectator(int client) 174 | { 175 | if ((client = GetClientOfUserId(client)) == 0) 176 | return; 177 | 178 | ChangeClientTeam(client, 1); 179 | PrintToChat(client, "\x05You moved in spectators for inaction"); 180 | } 181 | 182 | bool IsInSaferoom( const float vOrigin[3] ) 183 | { 184 | int info_changelevel = MaxClients + 1; 185 | 186 | while ( (info_changelevel = FindEntityByClassname(info_changelevel, "info_changelevel")) && IsValidEntity(info_changelevel) ) 187 | { 188 | float vMins[3], vMaxs[3]; 189 | GetEntPropVector(info_changelevel, Prop_Data, "m_vecMins", vMins); 190 | GetEntPropVector(info_changelevel, Prop_Data, "m_vecMaxs", vMaxs); 191 | 192 | if ( IsPointInBox(vOrigin, vMins, vMaxs) ) 193 | return true; 194 | } 195 | 196 | return false; 197 | } 198 | 199 | bool IsPointInBox( const float pt[3], const float boxMin[3], const float boxMax[3] ) 200 | { 201 | if ( (pt[0] > boxMax[0]) || (pt[0] < boxMin[0]) ) 202 | return false; 203 | if ( (pt[1] > boxMax[1]) || (pt[1] < boxMin[1]) ) 204 | return false; 205 | if ( (pt[2] > boxMax[2]) || (pt[2] < boxMin[2]) ) 206 | return false; 207 | 208 | return true; 209 | } -------------------------------------------------------------------------------- /l4d2_bwpu/l4d2_bwpu.sp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | enum WeaponId 5 | { 6 | WEPID_NONE = -1, WEPID_PISTOL, WEPID_SMG, WEPID_PUMPSHOTGUN, WEPID_AUTOSHOTGUN, WEPID_RIFLE, 7 | WEPID_HUNTING_RIFLE, WEPID_SMG_SILENCED, WEPID_SHOTGUN_CHROME, WEPID_RIFLE_DESERT, WEPID_SNIPER_MILITARY, 8 | WEPID_SHOTGUN_SPAS, WEPID_FIRST_AID_KIT, WEPID_MOLOTOV, WEPID_PIPE_BOMB, WEPID_PAIN_PILLS, 9 | WEPID_MELEE, WEPID_CHAINSAW, WEPID_GRENADE_LAUNCHER, WEPID_ADRENALINE, WEPID_DEFIBRILLATOR, 10 | WEPID_VOMITJAR, WEPID_RIFLE_AK47, WEPID_INCENDIARY_AMMO, WEPID_FRAG_AMMO, WEPID_PISTOL_MAGNUM, 11 | WEPID_SMG_MP5, WEPID_RIFLE_SG552, WEPID_SNIPER_AWP, WEPID_SNIPER_SCOUT, WEPID_RIFLE_M60 12 | }; 13 | 14 | enum Cvars 15 | { 16 | ConVar:PISTOL, ConVar:SMG, ConVar:PUMPSHOTGUN, ConVar:AUTOSHOTGUN, ConVar:RIFLE, 17 | ConVar:HUNTING_RIFLE, ConVar:SMG_SILENCED, ConVar:SHOTGUN_CHROME, ConVar:RIFLE_DESERT, ConVar:SNIPER_MILITARY, 18 | ConVar:SHOTGUN_SPAS, ConVar:FIRST_AID_KIT, ConVar:MOLOTOV, ConVar:PIPE_BOMB, ConVar:PAIN_PILLS, 19 | ConVar:MELEE, ConVar:CHAINSAW, ConVar:GRENADE_LAUNCHER, ConVar:ADRENALINE, ConVar:DEFIBRILLATOR, 20 | ConVar:VOMITJAR, ConVar:RIFLE_AK47, ConVar:INCENDIARY_AMMO, ConVar:FRAG_AMMO, ConVar:PISTOL_MAGNUM, 21 | ConVar:SMG_MP5, ConVar:RIFLE_SG552, ConVar:SNIPER_AWP, ConVar:SNIPER_SCOUT, ConVar:RIFLE_M60 22 | }; 23 | 24 | char WeaponNames[WeaponId][] = 25 | { 26 | "weapon_pistol", "weapon_smg", "weapon_pumpshotgun", "weapon_autoshotgun", "weapon_rifle", 27 | "weapon_hunting_rifle", "weapon_smg_silenced", "weapon_shotgun_chrome", "weapon_rifle_desert", "weapon_sniper_military", 28 | "weapon_shotgun_spas", "weapon_first_aid_kit", "weapon_molotov", "weapon_pipe_bomb", "weapon_pain_pills", 29 | "weapon_melee", "weapon_chainsaw", "weapon_grenade_launcher", "weapon_adrenaline", "weapon_defibrillator", 30 | "weapon_vomitjar", "weapon_rifle_ak47", "weapon_upgradepack_incendiary", "weapon_upgradepack_explosive", "weapon_pistol_magnum", 31 | "weapon_smg_mp5", "weapon_rifle_sg552", "weapon_sniper_awp", "weapon_sniper_scout", "weapon_rifle_m60" 32 | }; 33 | 34 | ConVar l4d2_bwpu_global; 35 | ConVar l4d2_bwpu[Cvars]; 36 | StringMap hWeaponNamesTrie = null; 37 | 38 | public Plugin myinfo = 39 | { 40 | name = "[L4D2] Bots Weapons Pick Up Control", 41 | author = "Accelerator", 42 | description = "Control Bots Weapons Pick Up", 43 | version = "1.0", 44 | url = "https://github.com/accelerator74/sp-plugins" 45 | } 46 | 47 | stock WeaponId WeaponNameToId(const char[] weaponName) 48 | { 49 | WeaponId id; 50 | if(hWeaponNamesTrie.GetValue(weaponName, id)) 51 | { 52 | return view_as(id); 53 | } 54 | return WEPID_NONE; 55 | } 56 | 57 | public void OnPluginStart() 58 | { 59 | l4d2_bwpu_global = CreateConVar("l4d2_bwpu_global", "0", "Restrict all weapons from bots"); 60 | l4d2_bwpu[FIRST_AID_KIT] = CreateConVar("l4d2_bwpu_first_aid_kit", "0"); 61 | l4d2_bwpu[DEFIBRILLATOR] = CreateConVar("l4d2_bwpu_defibrillator", "0"); 62 | l4d2_bwpu[PAIN_PILLS] = CreateConVar("l4d2_bwpu_pain_pills", "0"); 63 | l4d2_bwpu[ADRENALINE] = CreateConVar("l4d2_bwpu_adrenaline", "0"); 64 | l4d2_bwpu[MELEE] = CreateConVar("l4d2_bwpu_melee", "0"); 65 | l4d2_bwpu[CHAINSAW] = CreateConVar("l4d2_bwpu_chainsaw", "0"); 66 | l4d2_bwpu[PISTOL] = CreateConVar("l4d2_bwpu_pistol", "0"); 67 | l4d2_bwpu[PISTOL_MAGNUM] = CreateConVar("l4d2_bwpu_pistol_magnum", "0"); 68 | l4d2_bwpu[SMG] = CreateConVar("l4d2_bwpu_smg", "0"); 69 | l4d2_bwpu[SMG_SILENCED] = CreateConVar("l4d2_bwpu_smg_silenced", "0"); 70 | l4d2_bwpu[PUMPSHOTGUN] = CreateConVar("l4d2_bwpu_pumpshotgun", "0"); 71 | l4d2_bwpu[SHOTGUN_CHROME] = CreateConVar("l4d2_bwpu_shotgun_chrome", "0"); 72 | l4d2_bwpu[SHOTGUN_SPAS] = CreateConVar("l4d2_bwpu_shotgun_spas", "0"); 73 | l4d2_bwpu[AUTOSHOTGUN] = CreateConVar("l4d2_bwpu_autoshotgun", "0"); 74 | l4d2_bwpu[SNIPER_MILITARY] = CreateConVar("l4d2_bwpu_sniper_military", "0"); 75 | l4d2_bwpu[HUNTING_RIFLE] = CreateConVar("l4d2_bwpu_hunting_rifle", "0"); 76 | l4d2_bwpu[RIFLE] = CreateConVar("l4d2_bwpu_rifle", "0"); 77 | l4d2_bwpu[RIFLE_DESERT] = CreateConVar("l4d2_bwpu_rifle_desert", "0"); 78 | l4d2_bwpu[RIFLE_AK47] = CreateConVar("l4d2_bwpu_rifle_ak47", "0"); 79 | l4d2_bwpu[RIFLE_M60] = CreateConVar("l4d2_bwpu_rifle_m60", "0"); 80 | l4d2_bwpu[SMG_MP5] = CreateConVar("l4d2_bwpu_smg_mp5", "0"); 81 | l4d2_bwpu[SNIPER_SCOUT] = CreateConVar("l4d2_bwpu_sniper_scout", "0"); 82 | l4d2_bwpu[SNIPER_AWP] = CreateConVar("l4d2_bwpu_sniper_awp", "0"); 83 | l4d2_bwpu[RIFLE_SG552] = CreateConVar("l4d2_bwpu_rifle_sg552", "0"); 84 | l4d2_bwpu[GRENADE_LAUNCHER] = CreateConVar("l4d2_bwpu_grenade_launcher", "0"); 85 | l4d2_bwpu[PIPE_BOMB] = CreateConVar("l4d2_bwpu_pipe_bomb", "0"); 86 | l4d2_bwpu[MOLOTOV] = CreateConVar("l4d2_bwpu_molotov", "0"); 87 | l4d2_bwpu[VOMITJAR] = CreateConVar("l4d2_bwpu_vomitjar", "0"); 88 | l4d2_bwpu[INCENDIARY_AMMO] = CreateConVar("l4d2_bwpu_upgradepack_exp", "0"); 89 | l4d2_bwpu[FRAG_AMMO] = CreateConVar("l4d2_bwpu_upgradepack_inc", "0"); 90 | 91 | hWeaponNamesTrie = new StringMap(); 92 | int i; 93 | for(i = 0; i < view_as(WeaponId); i++) 94 | { 95 | hWeaponNamesTrie.SetValue(WeaponNames[view_as(i)], i); 96 | } 97 | for (i = 1; i <= MaxClients; i++) 98 | { 99 | if (IsClientInGame(i)) 100 | OnClientPutInServer(i); 101 | } 102 | 103 | AutoExecConfig(true, "l4d2_bwpu"); 104 | } 105 | 106 | public void OnClientPutInServer(int client) 107 | { 108 | SDKHook(client, SDKHook_WeaponCanUse, OnWeaponCanUse); 109 | } 110 | 111 | public void OnClientDisconnect(int client) 112 | { 113 | SDKUnhook(client, SDKHook_WeaponCanUse, OnWeaponCanUse); 114 | } 115 | 116 | public Action OnWeaponCanUse(int client, int weapon) 117 | { 118 | if (GetClientTeam(client) == 2) 119 | { 120 | if (IsFakeClient(client)) 121 | { 122 | char wname[32]; 123 | GetEdictClassname(weapon, wname, sizeof(wname)); 124 | 125 | if (l4d2_bwpu_global.BoolValue) 126 | { 127 | if (!StrEqual(wname, "weapon_pistol")) 128 | return Plugin_Handled; 129 | } 130 | 131 | WeaponId wepid = WeaponNameToId(wname); 132 | if (wepid != WEPID_NONE) 133 | { 134 | return l4d2_bwpu[wepid].BoolValue ? Plugin_Handled : Plugin_Continue; 135 | } 136 | } 137 | } 138 | return Plugin_Continue; 139 | } -------------------------------------------------------------------------------- /l4d2_incap_magnum/l4d2_incap_magnum.sp: -------------------------------------------------------------------------------- 1 | #pragma semicolon 1 2 | #pragma newdecls required 3 | 4 | #include 5 | #include 6 | 7 | bool incap_magnum[33]; 8 | 9 | public Plugin myinfo = { 10 | name = "L4D2 Incapped Magnum", 11 | author = "Accelerator", 12 | description = "Gives incapped players a magnum.", 13 | version = "2.0", 14 | url = "https://github.com/accelerator74/sp-plugins" 15 | } 16 | 17 | public void OnPluginStart() 18 | { 19 | HookEvent("player_incapacitated", event_PlayerIncap); 20 | HookEvent("player_incapacitated_start", Event_MeleeCheck); 21 | HookEvent("revive_success", EventReviveSuccess); 22 | } 23 | 24 | void Event_MeleeCheck(Event event, const char[] name, bool dontBroadcast) 25 | { 26 | int client = GetClientOfUserId(event.GetInt("userid")); 27 | 28 | incap_magnum[client] = false; 29 | 30 | if (IsFakeClient(client)) 31 | return; 32 | 33 | if (GetClientTeam(client) != 2) 34 | return; 35 | 36 | int slot = GetPlayerWeaponSlot(client, 1); 37 | if (slot != -1) 38 | { 39 | char weapon[32]; 40 | GetEdictClassname(slot, weapon, sizeof(weapon)); 41 | if (StrEqual(weapon, "weapon_melee") || StrEqual(weapon, "weapon_chainsaw")) 42 | incap_magnum[client] = true; 43 | } 44 | } 45 | 46 | void event_PlayerIncap(Event event, const char[] name, bool dontBroadcast) 47 | { 48 | int client = GetClientOfUserId(event.GetInt("userid")); 49 | 50 | if (IsFakeClient(client)) 51 | return; 52 | 53 | if (GetClientTeam(client) != 2) 54 | return; 55 | 56 | if (incap_magnum[client]) 57 | { 58 | int slot = GetPlayerWeaponSlot(client, 1); 59 | if (slot != -1) 60 | { 61 | char weapon[32]; 62 | GetEdictClassname(slot, weapon, sizeof(weapon)); 63 | 64 | if (StrContains(weapon, "pistol", false) != -1) 65 | { 66 | RemovePlayerItem(client, slot); 67 | RemoveEntity(slot); 68 | 69 | GivePlayerItem(client, "pistol_magnum"); 70 | } 71 | } 72 | } 73 | } 74 | 75 | void EventReviveSuccess(Event event, const char[] name, bool dontBroadcast) 76 | { 77 | int client = GetClientOfUserId(event.GetInt("subject")); 78 | 79 | if (IsFakeClient(client)) 80 | return; 81 | 82 | if (GetClientTeam(client) != 2) 83 | return; 84 | 85 | incap_magnum[client] = false; 86 | } -------------------------------------------------------------------------------- /l4d2_meleefix/l4d2meleefix.sp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #define SMOKER 1 5 | #define BOOMER 2 6 | #define HUNTER 3 7 | #define SPITTER 4 8 | #define JOCKEY 5 9 | #define CHARGER 6 10 | #define TANK 8 11 | #define WITCH 0 12 | 13 | new Handle:MeleeDmg[10]; 14 | new Handle:MeleeHeadshotDmg[9]; 15 | 16 | new Float:Damage[10]; 17 | new Float:DamageHeadshot[9]; 18 | 19 | public Plugin:myinfo = 20 | { 21 | name = "L4D2 Melee Fix", 22 | description = "Fix melee damage", 23 | author = "Accelerator", 24 | version = "1.0", 25 | url = "https://github.com/accelerator74/sp-plugins" 26 | }; 27 | 28 | public OnPluginStart() 29 | { 30 | HookEvent("witch_spawn", OnWitchSpawn_Event); 31 | HookEvent("witch_killed", OnWitchKilled_Event); 32 | 33 | MeleeDmg[SMOKER] = CreateConVar("l4d2_meleefix_smoker", "400.0", "Melee damage Smoker", FCVAR_PLUGIN); 34 | MeleeDmg[BOOMER] = CreateConVar("l4d2_meleefix_boomer", "400.0", "Melee damage Boomer", FCVAR_PLUGIN); 35 | MeleeDmg[HUNTER] = CreateConVar("l4d2_meleefix_hunter", "400.0", "Melee damage Hunter", FCVAR_PLUGIN); 36 | MeleeDmg[JOCKEY] = CreateConVar("l4d2_meleefix_jockey", "400.0", "Melee damage Jockey", FCVAR_PLUGIN); 37 | MeleeDmg[SPITTER] = CreateConVar("l4d2_meleefix_spitter", "400.0", "Melee damage Spitter", FCVAR_PLUGIN); 38 | MeleeDmg[CHARGER] = CreateConVar("l4d2_meleefix_charger", "400.0", "Melee damage Charger", FCVAR_PLUGIN); 39 | MeleeDmg[WITCH] = CreateConVar("l4d2_meleefix_witch", "400.0", "Melee damage Witch", FCVAR_PLUGIN); 40 | MeleeDmg[TANK] = CreateConVar("l4d2_meleefix_tank", "400.0", "Melee damage Tank", FCVAR_PLUGIN); 41 | 42 | MeleeHeadshotDmg[SMOKER] = CreateConVar("l4d2_meleefix_smoker_headshot", "800.0", "Headshot Melee damage Smoker", FCVAR_PLUGIN); 43 | MeleeHeadshotDmg[BOOMER] = CreateConVar("l4d2_meleefix_boomer_headshot", "800.0", "Headshot Melee damage Boomer", FCVAR_PLUGIN); 44 | MeleeHeadshotDmg[HUNTER] = CreateConVar("l4d2_meleefix_hunter_headshot", "800.0", "Headshot Melee damage Hunter", FCVAR_PLUGIN); 45 | MeleeHeadshotDmg[JOCKEY] = CreateConVar("l4d2_meleefix_jockey_headshot", "800.0", "Headshot Melee damage Jockey", FCVAR_PLUGIN); 46 | MeleeHeadshotDmg[SPITTER] = CreateConVar("l4d2_meleefix_spitter_headshot", "800.0", "Headshot Melee damage Spitter", FCVAR_PLUGIN); 47 | MeleeHeadshotDmg[CHARGER] = CreateConVar("l4d2_meleefix_charger_headshot", "800.0", "Headshot Melee damage Charger", FCVAR_PLUGIN); 48 | MeleeHeadshotDmg[TANK] = CreateConVar("l4d2_meleefix_tank_headshot", "1000.0", "Headshot Melee damage Tank", FCVAR_PLUGIN); 49 | 50 | HookConVarChange(MeleeDmg[SMOKER], ConVarChanged); 51 | HookConVarChange(MeleeDmg[BOOMER], ConVarChanged); 52 | HookConVarChange(MeleeDmg[HUNTER], ConVarChanged); 53 | HookConVarChange(MeleeDmg[JOCKEY], ConVarChanged); 54 | HookConVarChange(MeleeDmg[SPITTER], ConVarChanged); 55 | HookConVarChange(MeleeDmg[CHARGER], ConVarChanged); 56 | HookConVarChange(MeleeDmg[WITCH], ConVarChanged); 57 | HookConVarChange(MeleeDmg[TANK], ConVarChanged); 58 | HookConVarChange(MeleeHeadshotDmg[SMOKER], ConVarChanged); 59 | HookConVarChange(MeleeHeadshotDmg[BOOMER], ConVarChanged); 60 | HookConVarChange(MeleeHeadshotDmg[HUNTER], ConVarChanged); 61 | HookConVarChange(MeleeHeadshotDmg[JOCKEY], ConVarChanged); 62 | HookConVarChange(MeleeHeadshotDmg[SPITTER], ConVarChanged); 63 | HookConVarChange(MeleeHeadshotDmg[CHARGER], ConVarChanged); 64 | HookConVarChange(MeleeHeadshotDmg[TANK], ConVarChanged); 65 | 66 | AutoExecConfig(true, "l4d2_meleefix"); 67 | 68 | ConVarsInit(); 69 | } 70 | 71 | public ConVarChanged(Handle:hVariable, const String:strOldValue[], const String:strNewValue[]) 72 | { 73 | ConVarsInit(); 74 | } 75 | 76 | public ConVarsInit() 77 | { 78 | Damage[SMOKER] = GetConVarFloat(MeleeDmg[SMOKER]); 79 | Damage[BOOMER] = GetConVarFloat(MeleeDmg[BOOMER]); 80 | Damage[HUNTER] = GetConVarFloat(MeleeDmg[HUNTER]); 81 | Damage[JOCKEY] = GetConVarFloat(MeleeDmg[JOCKEY]); 82 | Damage[SPITTER] = GetConVarFloat(MeleeDmg[SPITTER]); 83 | Damage[CHARGER] = GetConVarFloat(MeleeDmg[CHARGER]); 84 | Damage[WITCH] = GetConVarFloat(MeleeDmg[WITCH]); 85 | Damage[TANK] = GetConVarFloat(MeleeDmg[TANK]); 86 | 87 | DamageHeadshot[SMOKER] = GetConVarFloat(MeleeHeadshotDmg[SMOKER]); 88 | DamageHeadshot[BOOMER] = GetConVarFloat(MeleeHeadshotDmg[BOOMER]); 89 | DamageHeadshot[HUNTER] = GetConVarFloat(MeleeHeadshotDmg[HUNTER]); 90 | DamageHeadshot[JOCKEY] = GetConVarFloat(MeleeHeadshotDmg[JOCKEY]); 91 | DamageHeadshot[SPITTER] = GetConVarFloat(MeleeHeadshotDmg[SPITTER]); 92 | DamageHeadshot[CHARGER] = GetConVarFloat(MeleeHeadshotDmg[CHARGER]); 93 | DamageHeadshot[TANK] = GetConVarFloat(MeleeHeadshotDmg[TANK]); 94 | } 95 | 96 | public OnClientPutInServer(client) 97 | { 98 | if (client) 99 | { 100 | SDKHook(client, SDKHook_TraceAttack, OnTraceAttack); 101 | } 102 | } 103 | 104 | public OnClientDisconnect(client) 105 | { 106 | if (client) 107 | { 108 | SDKUnhook(client, SDKHook_TraceAttack, OnTraceAttack); 109 | } 110 | } 111 | 112 | public OnWitchSpawn_Event(Handle:event, const String:name[], bool:dontBroadcast) 113 | { 114 | if (Damage[WITCH] == 0.0) 115 | return; 116 | 117 | new witch = GetEventInt(event, "witchid"); 118 | 119 | if (witch < 1 || !IsValidEntity(witch)) 120 | return; 121 | 122 | SDKHook(witch, SDKHook_OnTakeDamage, OnWitchTakeDamage); 123 | } 124 | 125 | public OnWitchKilled_Event(Handle:event, const String:name[], bool:dontBroadcast) 126 | { 127 | if (Damage[WITCH] == 0.0) 128 | return; 129 | 130 | new witch = GetEventInt(event, "witchid"); 131 | if (witch < 1 || !IsValidEntity(witch)) 132 | return; 133 | 134 | SDKUnhook(witch, SDKHook_OnTakeDamage, OnWitchTakeDamage); 135 | } 136 | 137 | public Action:OnWitchTakeDamage(victim, &attacker, &inflictor, &Float:damage, &damagetype) 138 | { 139 | if (!(damage > 0.0) || attacker < 1 || attacker > MaxClients || !IsClientInGame(attacker) || GetClientTeam(attacker) != 2) 140 | return Plugin_Continue; 141 | 142 | decl String:clsname[64]; 143 | GetEdictClassname(inflictor, clsname, 64); 144 | 145 | if (!StrEqual(clsname, "weapon_melee")) 146 | return Plugin_Continue; 147 | 148 | damage = Damage[WITCH]; 149 | 150 | return Plugin_Changed; 151 | } 152 | 153 | public Action:OnTraceAttack(victim, &attacker, &inflictor, &Float:damage, &damagetype, &ammotype, hitbox, hitgroup) 154 | { 155 | if (damage == 0.0 || victim < 1 || victim > MaxClients || !IsClientInGame(victim) || GetClientTeam(victim) != 3 || attacker < 1 || attacker > MaxClients || !IsClientInGame(attacker) || GetClientTeam(attacker) != 2) 156 | return Plugin_Continue; 157 | 158 | decl String:clsname[64]; 159 | GetEdictClassname(inflictor, clsname, 64); 160 | 161 | if (!StrEqual(clsname, "weapon_melee")) 162 | return Plugin_Continue; 163 | 164 | new zClass = GetEntProp(victim, Prop_Send, "m_zombieClass"); 165 | 166 | if (((zClass > 0) && (zClass < 7)) || (zClass == 8)) 167 | { 168 | if (Damage[zClass] == 0.0) 169 | return Plugin_Continue; 170 | 171 | if (hitgroup == 1) 172 | { 173 | if (DamageHeadshot[zClass] == 0.0) 174 | return Plugin_Continue; 175 | 176 | damage = DamageHeadshot[zClass]; 177 | return Plugin_Changed; 178 | } 179 | damage = Damage[zClass]; 180 | 181 | return Plugin_Changed; 182 | } 183 | 184 | return Plugin_Continue; 185 | } -------------------------------------------------------------------------------- /l4d2_meleeunlock/gamedata/l4d2_meleeunlock.txt: -------------------------------------------------------------------------------- 1 | "Games" 2 | { 3 | "#default" 4 | { 5 | "Functions" 6 | { 7 | "CDirectorItemManager::IsMeleeWeaponAllowedToExist" 8 | { 9 | "signature" "CDirectorItemManager::IsMeleeWeaponAllowedToExist" 10 | "callconv" "thiscall" 11 | "return" "int" 12 | "this" "ignore" 13 | "arguments" 14 | { 15 | "wscript_name" 16 | { 17 | "type" "charptr" 18 | } 19 | } 20 | } 21 | 22 | "CTerrorGameRules::GetMissionInfo" 23 | { 24 | "signature" "CTerrorGameRules::GetMissionInfo" 25 | "callconv" "thiscall" 26 | "return" "int" 27 | "this" "ignore" 28 | } 29 | } 30 | } 31 | "left4dead2" 32 | { 33 | "Signatures" 34 | { 35 | "CDirectorItemManager::IsMeleeWeaponAllowedToExist" // Found by V10 36 | { 37 | "library" "server" 38 | "linux" "@_ZN20CDirectorItemManager27IsMeleeWeaponAllowedToExistEPKc" 39 | "windows" "\x55\x8B\xEC\x56\x8B\xF1\x8B\x0D\x2A\x2A\x2A\x2A\x8B\x01\x8B\x90\x2A\x2A\x2A\x2A\xFF\xD2\x84\xC0\x75\x2A\x8B\x45\x2A\x6A\x2A\x68\x2A\x2A\x2A\x2A\x50\xE8\x2A\x2A\x2A\x2A\x83\xC4\x2A\x85\xC0" 40 | /* 55 8B EC 56 8B F1 8B 0D ? ? ? ? 8B 01 8B 90 ? ? ? ? FF D2 84 C0 75 ? 8B 45 ? 6A ? 68 ? ? ? ? 50 E8 ? ? ? ? 83 C4 ? 85 C0 */ 41 | } 42 | 43 | "CTerrorGameRules::GetMissionInfo" // Found by V10 44 | { 45 | "library" "server" 46 | "linux" "@_ZN16CTerrorGameRules14GetMissionInfoEv" 47 | "windows" "\x55\x8B\xEC\x51\x8B\x0D\x2A\x2A\x2A\x2A\x8B\x01\x8B\x50\x2A\x56\xFF\xD2\x8B\x10\x8B\xC8\x8B\x42\x2A\x6A\x00\xFF\xD0\x8B\xF0\x85\xF6\x75\x2A\x5E\x8B\xE5\x5D\xC3" 48 | /* 55 8B EC 51 8B 0D ? ? ? ? 8B 01 8B 50 ? 56 FF D2 8B 10 8B C8 8B 42 ? 6A 00 FF D0 8B F0 85 F6 75 ? 5E 8B E5 5D C3 */ 49 | } 50 | 51 | /* void KeyValues::SetString(const char *keyName, const char *value) */ 52 | "KeyValues::SetString" 53 | { 54 | "library" "server" 55 | "linux" "@_ZN9KeyValues9SetStringEPKcS1_" 56 | "windows" "\x55\x8B\x2A\x8B\x2A\x2A\x56\x6A\x01\x50\xE8\x2A\x2A\x2A\x2A\x8B\x2A\x85\x2A\x74\x2A\x8B\x2A\x2A\x53\x57\x51\xE8\x2A\x2A\x2A\x2A\x8B\x2A\x2A\x52\xE8\x2A\x2A\x2A\x2A\x8B\x2A\x2A\x83\x2A\x2A\xC7\x2A\x2A\x2A\x2A\x2A\x2A\x85\x2A\x75\x2A\xBB\x2A\x2A\x2A\x2A\x53" 57 | /* 55 8B ? 8B ? ? 56 6A 01 50 E8 ? ? ? ? 8B ? 85 ? 74 ? 8B ? ? 53 57 51 E8 ? ? ? ? 8B ? ? 52 E8 ? ? ? ? 8B ? ? 83 ? ? C7 ? ? ? ? ? ? 85 ? 75 ? BB ? ? ? ? 53 */ 58 | /* Search: "victimname" - below is call */ 59 | } 60 | } 61 | } 62 | } -------------------------------------------------------------------------------- /l4d2_meleeunlock/scripting/l4d2_meleeunlock.sp: -------------------------------------------------------------------------------- 1 | #pragma semicolon 1 2 | #pragma newdecls required 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | ConVar hMeleeList; 9 | Handle SDK_KV_SetString; 10 | 11 | public Plugin myinfo = 12 | { 13 | name = "[L4D2] Melee Unlock", 14 | author = "V10, Accelerator", 15 | description = "Unlocks melee weapons on every campaign.", 16 | version = "1.0", 17 | url = "https://github.com/accelerator74/sp-plugins" 18 | } 19 | 20 | public void OnPluginStart() 21 | { 22 | hMeleeList = CreateConVar("l4d2_melee_weapons", "fireaxe;frying_pan;machete;baseball_bat;crowbar;cricket_bat;tonfa;katana;electric_guitar;knife;golfclub;shovel;pitchfork", "Overrides map melee weapons list with this value, use ';' for delimiter."); 23 | 24 | Handle hGameData = LoadGameConfigFile("l4d2_meleeunlock"); 25 | if(hGameData == null) 26 | SetFailState("Failed to load \"l4d2_meleeunlock.txt\" gamedata."); 27 | 28 | StartPrepSDKCall(SDKCall_Raw); 29 | if( PrepSDKCall_SetFromConf(hGameData, SDKConf_Signature, "KeyValues::SetString") == false ) 30 | SetFailState("Could not load the \"KeyValues::SetString\" gamedata signature."); 31 | PrepSDKCall_AddParameter(SDKType_String, SDKPass_Pointer); 32 | PrepSDKCall_AddParameter(SDKType_String, SDKPass_Pointer); 33 | SDK_KV_SetString = EndPrepSDKCall(); 34 | if( SDK_KV_SetString == null ) 35 | SetFailState("Could not prep the \"KeyValues::SetString\" function."); 36 | 37 | Handle hDetour; 38 | 39 | // Mission Info 40 | hDetour = DHookCreateFromConf(hGameData, "CTerrorGameRules::GetMissionInfo"); 41 | if( !hDetour ) 42 | SetFailState("Failed to find \"CTerrorGameRules::GetMissionInfo\" signature."); 43 | if( !DHookEnableDetour(hDetour, true, GetMissionInfo) ) 44 | SetFailState("Failed to detour \"CTerrorGameRules::GetMissionInfo\"."); 45 | delete hDetour; 46 | 47 | // Allow all Melee weapon types 48 | hDetour = DHookCreateFromConf(hGameData, "CDirectorItemManager::IsMeleeWeaponAllowedToExist"); 49 | if( !hDetour ) 50 | SetFailState("Failed to find \"CDirectorItemManager::IsMeleeWeaponAllowedToExist\" signature."); 51 | if( !DHookEnableDetour(hDetour, true, MeleeWeaponAllowedToExist) ) 52 | SetFailState("Failed to detour \"CDirectorItemManager::IsMeleeWeaponAllowedToExist\"."); 53 | delete hDetour; 54 | 55 | delete hGameData; 56 | } 57 | 58 | MRESReturn GetMissionInfo(Handle hReturn, Handle hParams) 59 | { 60 | // Pointer 61 | int pThis = DHookGetReturn(hReturn); 62 | if( pThis == 0 ) return MRES_Ignored; // Some maps the mission file does not load (most likely due to gamemode not being supported). 63 | 64 | char value[512]; 65 | hMeleeList.GetString(value, sizeof(value)); 66 | SDKCall(SDK_KV_SetString, pThis, "meleeweapons", value); 67 | 68 | return MRES_Ignored; 69 | } 70 | 71 | MRESReturn MeleeWeaponAllowedToExist(Handle hReturn, Handle hParams) 72 | { 73 | DHookSetReturn(hReturn, true); 74 | return MRES_Override; 75 | } -------------------------------------------------------------------------------- /l4d2_model_select/l4d2_model_select.sp: -------------------------------------------------------------------------------- 1 | #pragma semicolon 1 2 | #include 3 | #include 4 | 5 | public Plugin myinfo = 6 | { 7 | name = "[L4D2] Model Select", 8 | author = "Accelerator", 9 | description = "Select model Player", 10 | version = "1.5", 11 | url = "https://github.com/accelerator74/sp-plugins" 12 | }; 13 | 14 | public void OnPluginStart() 15 | { 16 | RegConsoleCmd("sm_rochelle", Command_model); 17 | RegConsoleCmd("sm_coach", Command_model); 18 | RegConsoleCmd("sm_nick", Command_model); 19 | RegConsoleCmd("sm_ellis", Command_model); 20 | RegConsoleCmd("sm_zoey", Command_model); 21 | RegConsoleCmd("sm_francis", Command_model); 22 | RegConsoleCmd("sm_louis", Command_model); 23 | RegConsoleCmd("sm_bill", Command_model); 24 | } 25 | 26 | public void OnMapStart() 27 | { 28 | CheckPrecacheModel("models/survivors/survivor_gambler.mdl"); 29 | CheckPrecacheModel("models/survivors/survivor_manager.mdl"); 30 | CheckPrecacheModel("models/survivors/survivor_coach.mdl"); 31 | CheckPrecacheModel("models/survivors/survivor_producer.mdl"); 32 | CheckPrecacheModel("models/survivors/survivor_teenangst.mdl"); 33 | CheckPrecacheModel("models/survivors/survivor_biker.mdl"); 34 | CheckPrecacheModel("models/survivors/survivor_namvet.mdl"); 35 | CheckPrecacheModel("models/survivors/survivor_mechanic.mdl"); 36 | } 37 | 38 | public Action Command_model(int client, int args) 39 | { 40 | if (!client || !IsClientInGame(client)) 41 | return Plugin_Continue; 42 | 43 | char model[16]; 44 | GetCmdArg(0, model, sizeof(model)); 45 | 46 | ReplaceString(model, sizeof(model), "sm_", "", false); 47 | 48 | if (GetClientTeam(client) == 2) 49 | { 50 | if (L4D_Survivors(client) == 2) 51 | { 52 | if (StrEqual(model, "nick")) 53 | { 54 | SetEntProp(client, Prop_Send, "m_survivorCharacter", 0); 55 | SetEntityModel(client, "models/survivors/survivor_gambler.mdl"); 56 | } 57 | else if (StrEqual(model, "rochelle")) 58 | { 59 | SetEntProp(client, Prop_Send, "m_survivorCharacter", 1); 60 | SetEntityModel(client, "models/survivors/survivor_producer.mdl"); 61 | } 62 | else if (StrEqual(model, "coach")) 63 | { 64 | SetEntProp(client, Prop_Send, "m_survivorCharacter", 2); 65 | SetEntityModel(client, "models/survivors/survivor_coach.mdl"); 66 | } 67 | else if (StrEqual(model, "ellis")) 68 | { 69 | SetEntProp(client, Prop_Send, "m_survivorCharacter", 3); 70 | SetEntityModel(client, "models/survivors/survivor_mechanic.mdl"); 71 | } 72 | else 73 | { 74 | PrintToChat(client, "\x05Changing the skin \x04%s\x05 on this map disabled", model); 75 | return Plugin_Continue; 76 | } 77 | } 78 | else if (L4D_Survivors(client) == 1) 79 | { 80 | if (StrEqual(model, "bill")) 81 | { 82 | SetEntProp(client, Prop_Send, "m_survivorCharacter", 0); 83 | SetEntityModel(client, "models/survivors/survivor_namvet.mdl"); 84 | } 85 | else if (StrEqual(model, "zoey")) 86 | { 87 | SetEntProp(client, Prop_Send, "m_survivorCharacter", 1); 88 | SetEntityModel(client, "models/survivors/survivor_teenangst.mdl"); 89 | } 90 | else if (StrEqual(model, "louis")) 91 | { 92 | SetEntProp(client, Prop_Send, "m_survivorCharacter", 2); 93 | SetEntityModel(client, "models/survivors/survivor_manager.mdl"); 94 | } 95 | else if (StrEqual(model, "francis")) 96 | { 97 | SetEntProp(client, Prop_Send, "m_survivorCharacter", 3); 98 | SetEntityModel(client, "models/survivors/survivor_biker.mdl"); 99 | } 100 | else 101 | { 102 | PrintToChat(client, "\x05Changing the skin \x04%s\x05 on this map disabled", model); 103 | return Plugin_Continue; 104 | } 105 | } 106 | else 107 | { 108 | PrintToChat(client, "\x05Changing the skin \x04%s\x05 on this map disabled", model); 109 | return Plugin_Continue; 110 | } 111 | 112 | PrintToChat(client, "\x05Current skin is replaced by the skin \x04%s", model); 113 | } 114 | return Plugin_Continue; 115 | } 116 | 117 | int L4D_Survivors(int client) 118 | { 119 | char model[128]; 120 | GetClientModel(client, model, sizeof(model)); 121 | 122 | if ((StrContains(model, "survivor_namvet.mdl") != -1) || (StrContains(model, "survivor_teenangst.mdl") != -1) || (StrContains(model, "survivor_manager.mdl") != -1) || (StrContains(model, "survivor_biker.mdl") != -1)) 123 | return 1; 124 | 125 | if ((StrContains(model, "survivor_gambler.mdl") != -1) || (StrContains(model, "survivor_producer.mdl") != -1) || (StrContains(model, "survivor_coach.mdl") != -1) || (StrContains(model, "survivor_mechanic.mdl") != -1)) 126 | return 2; 127 | 128 | return 0; 129 | } 130 | 131 | public void CheckPrecacheModel(char[] Model) 132 | { 133 | if (!IsModelPrecached(Model)) 134 | { 135 | PrecacheModel(Model); 136 | } 137 | } -------------------------------------------------------------------------------- /l4d2_multitanks/gamedata/multitanks.txt: -------------------------------------------------------------------------------- 1 | "Games" 2 | { 3 | "left4dead2" 4 | { 5 | "Offsets" 6 | { 7 | "CTerrorPlayer::m_iTankTickets" 8 | { 9 | "windows" "12476" 10 | "linux" "12456" 11 | } 12 | } 13 | "Signatures" 14 | { 15 | "State_Transition" 16 | { 17 | "library" "server" 18 | "linux" "@_ZN9CCSPlayer16State_TransitionE13CSPlayerState" 19 | "windows" "\x55\x8B\xEC\x56\x8B\xF1\x8B\x86\x2A\x2A\x2A\x2A\x57\x8B\x7D\x2A\x85\xC0\x74\x2A\x83" 20 | /* 55 8B EC 56 8B F1 8B 86 ? ? ? ? 57 8B 7D ? 85 C0 74 ? 83 */ 21 | } 22 | "ReplaceWithBot" 23 | { 24 | "library" "server" 25 | "linux" "@_ZN13CTerrorPlayer14ReplaceWithBotEb" 26 | "windows" "\x55\x8B\xEC\x81\xEC\x2A\x2A\x2A\x2A\xA1\x2A\x2A\x2A\x2A\x33\xC5\x89\x45\x2A\x56\x8B\xF1\x8B\x06\x8B\x90\x2A\x2A\x2A\x2A\xFF\xD2\x84\xC0\x74" 27 | /* 55 8B EC 81 EC ? ? ? ? A1 ? ? ? ? 33 C5 89 45 ? 56 8B F1 8B 06 8B 90 ? ? ? ? FF D2 84 C0 74 */ 28 | } 29 | } 30 | } 31 | } -------------------------------------------------------------------------------- /l4d2_multitanks/scripting/multitanks.sp: -------------------------------------------------------------------------------- 1 | #pragma semicolon 1 2 | 3 | #include 4 | #include 5 | 6 | Handle sdkReplaceBot; 7 | Handle hStateTransition; 8 | 9 | ConVar mt_enable; 10 | 11 | ConVar mt_count_firstmap; 12 | ConVar mt_count_regular; 13 | ConVar mt_count_finale; 14 | ConVar mt_count_1stwave; 15 | ConVar mt_count_2ndwave; 16 | ConVar mt_count_escape; 17 | 18 | ConVar mt_health_firstmap; 19 | ConVar mt_health_regular; 20 | ConVar mt_health_finale; 21 | ConVar mt_health_1stwave; 22 | ConVar mt_health_2ndwave; 23 | ConVar mt_health_escape; 24 | 25 | ConVar z_tank_health; 26 | 27 | int iTankCount; 28 | int iTanksCount; 29 | int iFinaleWave; 30 | 31 | int iFrustration[MAXPLAYERS+1]; 32 | int iTankTicketsOffset = -1; 33 | 34 | float TankSpawnPosition[3]; 35 | 36 | public Plugin myinfo = 37 | { 38 | name = "[L4D] Multitanks", 39 | author = "Accelerator", 40 | description = "Additional tanks on tank spawn event", 41 | version = "1.0", 42 | url = "https://github.com/accelerator74/sp-plugins" 43 | }; 44 | 45 | public void OnPluginStart() 46 | { 47 | mt_enable = CreateConVar("mt_enable", "1", "Enabled MultiTanks?"); 48 | 49 | mt_count_firstmap = CreateConVar("mt_count_firstmap", "2", "Count of total tanks on first maps"); 50 | mt_count_regular = CreateConVar("mt_count_regular", "2", "Count of total tanks on regular maps"); 51 | mt_count_finale = CreateConVar("mt_count_finale", "1", "Count of total tanks on final maps"); 52 | mt_count_1stwave = CreateConVar("mt_count_1stwave", "1", "Count of total tanks when final start"); 53 | mt_count_2ndwave = CreateConVar("mt_count_2ndwave", "1", "Count of total tanks in second wave after final start"); 54 | mt_count_escape = CreateConVar("mt_count_escape", "1", "Count of total tanks when escape start"); 55 | 56 | mt_health_firstmap = CreateConVar("mt_health_firstmap", "16000", "Tanks health on first maps"); 57 | mt_health_regular = CreateConVar("mt_health_regular", "9000", "Tanks health on regular maps"); 58 | mt_health_finale = CreateConVar("mt_health_finale", "16000", "Tanks health on final maps"); 59 | mt_health_1stwave = CreateConVar("mt_health_1stwave", "16000", "Tanks health when final start"); 60 | mt_health_2ndwave = CreateConVar("mt_health_2ndwave", "16000", "Tanks health in second wave after final start"); 61 | mt_health_escape = CreateConVar("mt_health_escape", "16000", "Tanks health when escape start"); 62 | 63 | AutoExecConfig(true, "multitanks"); 64 | 65 | z_tank_health = FindConVar("z_tank_health"); 66 | 67 | HookEvent("player_left_start_area", Event_RoundStart, EventHookMode_PostNoCopy); 68 | HookEvent("tank_spawn", Event_TankSpawn); 69 | HookEvent("finale_start", OnFinaleStart, EventHookMode_PostNoCopy); 70 | HookEvent("finale_escape_start", OnFinaleEscapeStart, EventHookMode_PostNoCopy); 71 | 72 | GameData g_hGameConf = new GameData("multitanks"); 73 | if(g_hGameConf == null) 74 | { 75 | SetFailState("Couldn't find the offsets and signatures file. Please, check that it is installed correctly."); 76 | } 77 | StartPrepSDKCall(SDKCall_Player); 78 | PrepSDKCall_SetFromConf(g_hGameConf, SDKConf_Signature, "ReplaceWithBot"); 79 | PrepSDKCall_AddParameter(SDKType_Bool, SDKPass_Plain); 80 | sdkReplaceBot = EndPrepSDKCall(); 81 | if(sdkReplaceBot == null) 82 | { 83 | SetFailState("Unable to find the 'ReplaceWithBot' signature, check the file version!"); 84 | } 85 | StartPrepSDKCall(SDKCall_Player); 86 | PrepSDKCall_SetFromConf(g_hGameConf, SDKConf_Signature, "State_Transition"); 87 | PrepSDKCall_AddParameter(SDKType_PlainOldData , SDKPass_Plain); 88 | hStateTransition = EndPrepSDKCall(); 89 | if(hStateTransition == null) 90 | { 91 | SetFailState("Unable to find the 'State_Transition' signature, check the file version!"); 92 | } 93 | iTankTicketsOffset = g_hGameConf.GetOffset("CTerrorPlayer::m_iTankTickets"); 94 | if(iTankTicketsOffset == -1) 95 | { 96 | LogError("Failed to get CTerrorPlayer::m_iTankTickets"); 97 | } 98 | delete g_hGameConf; 99 | } 100 | 101 | public void Event_RoundStart(Event hEvent, const char[] strName, bool DontBroadcast) 102 | { 103 | if (!mt_enable.BoolValue) 104 | return; 105 | 106 | if (IsFirstMap()) 107 | { 108 | iTanksCount = mt_count_firstmap.IntValue; 109 | z_tank_health.SetFloat(mt_health_firstmap.FloatValue, false, false); 110 | } 111 | else if (IsFinale()) 112 | { 113 | iTanksCount = mt_count_finale.IntValue; 114 | z_tank_health.SetFloat(mt_health_finale.FloatValue, false, false); 115 | } 116 | else 117 | { 118 | iTanksCount = mt_count_regular.IntValue; 119 | z_tank_health.SetFloat(mt_health_regular.FloatValue, false, false); 120 | } 121 | 122 | iTankCount = 0; 123 | iFinaleWave = 0; 124 | 125 | ClearTankSpawnPosition(); 126 | } 127 | 128 | public void OnFinaleStart(Event event, const char[] name, bool dontBroadcast) 129 | { 130 | if (!mt_enable.BoolValue) 131 | return; 132 | 133 | iTanksCount = mt_count_1stwave.IntValue; 134 | z_tank_health.SetFloat(mt_health_1stwave.FloatValue, false, false); 135 | iFinaleWave = 1; 136 | iTankCount = 0; 137 | 138 | ClearTankSpawnPosition(); 139 | } 140 | 141 | void ClearTankSpawnPosition() 142 | { 143 | TankSpawnPosition[0] = 0.0; 144 | TankSpawnPosition[1] = 0.0; 145 | TankSpawnPosition[2] = 0.0; 146 | } 147 | 148 | public void Event_TankSpawn(Event event, const char[] name, bool dontBroadcast) 149 | { 150 | if (!mt_enable.BoolValue) 151 | return; 152 | 153 | int client = GetClientOfUserId(event.GetInt("userid")); 154 | int tankHealth = IsFakeClient(client) ? 0 : RoundToNearest(z_tank_health.FloatValue * 1.5); 155 | 156 | for (int i = 1; i <= MaxClients; i++) 157 | { 158 | if (IsClientInGame(i)) 159 | { 160 | if (tankHealth != 0) 161 | { 162 | if (GetClientTeam(i) == 3) 163 | { 164 | PrintToChat(i, "\x04%N\x05 took control of the Tank [\x03%i HP\x05]", client, tankHealth); 165 | } 166 | else 167 | { 168 | PrintToChat(i, "\x05New Tank Spawning [\x03%i HP\x05]", tankHealth); 169 | } 170 | } 171 | } 172 | } 173 | 174 | iTankCount++; 175 | iFrustration[client] = 0; 176 | 177 | if (iTankCount < iTanksCount) 178 | { 179 | CreateTimer(5.0, SpawnMoreTank); 180 | } 181 | else if (iTankCount > iTanksCount) 182 | { 183 | if (iFinaleWave == 1) 184 | { 185 | iTanksCount = mt_count_2ndwave.IntValue; 186 | z_tank_health.SetFloat(mt_health_2ndwave.FloatValue, false, false); 187 | iFinaleWave = 2; 188 | iTankCount = 0; 189 | 190 | ClearTankSpawnPosition(); 191 | } 192 | } 193 | 194 | if (!IsFakeClient(client)) 195 | { 196 | CreateTimer(0.1, CheckTankSpawnPosition, client, TIMER_FLAG_NO_MAPCHANGE); 197 | CreateTimer(10.0, CheckFrustration, client, TIMER_FLAG_NO_MAPCHANGE); 198 | } 199 | } 200 | 201 | public void OnFinaleEscapeStart(Event event, const char[] name, bool dontBroadcast) 202 | { 203 | if (!mt_enable.BoolValue) 204 | return; 205 | 206 | iTanksCount = mt_count_escape.IntValue; 207 | z_tank_health.SetFloat(mt_health_escape.FloatValue, false, false); 208 | iTankCount = 0; 209 | 210 | ClearTankSpawnPosition(); 211 | } 212 | 213 | public Action CheckFrustration(Handle timer, any client) 214 | { 215 | if (!IsClientInGame(client) || IsFakeClient(client) || !IsPlayerAlive(client) || (GetClientTeam(client) != 3) || (GetEntProp(client, Prop_Send, "m_zombieClass") != 8) || GetEntProp(client, Prop_Send, "m_isIncapacitated")) 216 | return Plugin_Stop; 217 | 218 | int iFrustrationProgress = GetEntProp(client, Prop_Send, "m_frustration"); 219 | if (iFrustrationProgress >= 95) 220 | { 221 | if (!(GetEntityFlags(client) & FL_ONFIRE)) 222 | { 223 | iFrustration[client]++; 224 | if (iFrustration[client] < 2) 225 | { 226 | PrintToChatTeam(3, "\x04%N\x05 lost first Tank control", client); 227 | SetEntProp(client, Prop_Send, "m_frustration", 0); 228 | CreateTimer(0.1, CheckFrustration, client); 229 | } 230 | else 231 | { 232 | PrintToChatTeam(3, "\x04%N\x05 lost control of the Tank", client); 233 | SDKCall(sdkReplaceBot, client, true); 234 | ForcePlayerSuicide(client); 235 | int ragdoll = GetEntPropEnt(client, Prop_Send, "m_hRagdoll"); 236 | if (ragdoll > 0) 237 | { 238 | AcceptEntityInput(ragdoll, "Kill"); 239 | } 240 | SetEntProp(client, Prop_Send, "m_zombieClass", 3); 241 | SDKCall(hStateTransition, client, 8); 242 | } 243 | } 244 | else 245 | { 246 | CreateTimer(0.1, CheckFrustration, client); 247 | } 248 | } 249 | else 250 | { 251 | CreateTimer(0.1 + (95 - iFrustrationProgress) * 0.1, CheckFrustration, client); 252 | } 253 | return Plugin_Stop; 254 | } 255 | 256 | public Action SpawnMoreTank(Handle timer) 257 | { 258 | int newtank = GetTankTicketsLeader(); 259 | if (newtank) 260 | { 261 | if (SpawnNewTank(newtank)) 262 | return Plugin_Stop; 263 | } 264 | 265 | int client = GetAnyClient(); 266 | 267 | if (client) 268 | { 269 | CheatCommand(client, "z_spawn_old", "tank auto"); 270 | } 271 | 272 | return Plugin_Stop; 273 | } 274 | 275 | public Action CheckTankSpawnPosition(Handle timer, any client) 276 | { 277 | if (IsClientInGame(client) && IsPlayerAlive(client) && GetClientTeam(client) == 3 && GetEntProp(client, Prop_Send, "m_zombieClass") == 8) 278 | { 279 | if (TankSpawnPosition[0] == 0.0 && TankSpawnPosition[1] == 0.0 && TankSpawnPosition[2] == 0.0) 280 | { 281 | GetClientAbsOrigin(client, TankSpawnPosition); 282 | } 283 | else 284 | { 285 | TeleportEntity(client, TankSpawnPosition, NULL_VECTOR, NULL_VECTOR); 286 | } 287 | } 288 | return Plugin_Stop; 289 | } 290 | 291 | stock bool SpawnNewTank(int client) 292 | { 293 | bool resetGhostState[MAXPLAYERS+1]; 294 | bool resetIsAlive[MAXPLAYERS+1]; 295 | bool resetLifeState[MAXPLAYERS+1]; 296 | 297 | for (int i = 1; i <= MaxClients; i++) 298 | { 299 | if (i == client) continue; 300 | if (!IsClientInGame(i)) continue; 301 | if (GetClientTeam(i) != 3) continue; 302 | if (IsFakeClient(i)) continue; 303 | 304 | if (IsGhost(i)) 305 | { 306 | resetGhostState[i] = true; 307 | SetPlayerGhostStatus(i, false); 308 | resetIsAlive[i] = true; 309 | SetPlayerIsAlive(i, true); 310 | } 311 | else if (!IsPlayerAlive(i)) 312 | { 313 | resetLifeState[i] = true; 314 | SetPlayerLifeState(i, false); 315 | } 316 | } 317 | 318 | CheatCommand(client, "z_spawn", "tank"); 319 | 320 | for (int i = 1; i <= MaxClients; i++) 321 | { 322 | if (resetGhostState[i]) SetPlayerGhostStatus(i, true); 323 | if (resetIsAlive[i]) SetPlayerIsAlive(i, false); 324 | if (resetLifeState[i]) SetPlayerLifeState(i, true); 325 | } 326 | 327 | return IsPlayerAlive(client); 328 | } 329 | 330 | stock int GetTankTicketsLeader() 331 | { 332 | if (iTankTicketsOffset == -1) 333 | return 0; 334 | 335 | Address aEntity = Address_Null; 336 | int score, maxscore, client; 337 | for (int i = 1; i <= MaxClients; i++) 338 | { 339 | if (IsClientInGame(i) && !IsFakeClient(i)) 340 | { 341 | if ((GetClientTeam(i) == 3) && (GetEntProp(i, Prop_Send, "m_zombieClass") != 8)) 342 | { 343 | aEntity = GetEntityAddress(i); 344 | if (aEntity == Address_Null) continue; 345 | 346 | score = LoadFromAddress(aEntity + view_as
(iTankTicketsOffset), NumberType_Int32); 347 | 348 | if ((score > 0) && (maxscore < score)) 349 | { 350 | maxscore = score; 351 | client = i; 352 | } 353 | } 354 | } 355 | } 356 | return client; 357 | } 358 | 359 | stock int GetAnyClient() 360 | { 361 | for (int i = 1; i <= MaxClients; i++) 362 | { 363 | if (IsClientInGame(i)) 364 | { 365 | return i; 366 | } 367 | } 368 | return 0; 369 | } 370 | 371 | stock void SetPlayerGhostStatus(int client, bool ghost) 372 | { 373 | int offset = FindSendPropInfo("CTerrorPlayer", "m_isGhost"); 374 | if (ghost) SetEntData(client, offset, 1, 1); 375 | else SetEntData(client, offset, 0, 1); 376 | } 377 | 378 | stock void SetPlayerLifeState(int client, bool ready) 379 | { 380 | int offset = FindSendPropInfo("CTerrorPlayer", "m_lifeState"); 381 | if (ready) SetEntData(client, offset, 1, 1); 382 | else SetEntData(client, offset, 0, 1); 383 | } 384 | 385 | stock void SetPlayerIsAlive(int client, bool alive) 386 | { 387 | int offset = FindSendPropInfo("CTransitioningPlayer", "m_isAlive"); 388 | if (alive) SetEntData(client, offset, 1, 1, true); 389 | else SetEntData(client, offset, 0, 1, true); 390 | } 391 | 392 | stock void CheatCommand(int client, char[] command, char[] arguments = "") 393 | { 394 | int flags = GetCommandFlags(command); 395 | SetCommandFlags(command, flags & ~FCVAR_CHEAT); 396 | FakeClientCommand(client, "%s %s", command, arguments); 397 | SetCommandFlags(command, flags); 398 | } 399 | 400 | stock void PrintToChatTeam(const int team, const char[] format, any ...) 401 | { 402 | char buffer[192]; 403 | 404 | for (int i = 1; i <= MaxClients; i++) 405 | { 406 | if (IsClientInGame(i) && GetClientTeam(i) == team) 407 | { 408 | SetGlobalTransTarget(i); 409 | VFormat(buffer, sizeof(buffer), format, 3); 410 | PrintToChat(i, "%s", buffer); 411 | } 412 | } 413 | } 414 | 415 | bool IsFirstMap() 416 | { 417 | char current_map[55]; 418 | GetCurrentMap(current_map, sizeof(current_map)); 419 | 420 | if (CharToLower(current_map[0]) == 'c' && StrContains(current_map, "m1_") != -1) 421 | return true; 422 | return false; 423 | } 424 | 425 | bool IsFinale() 426 | { 427 | return (FindEntityByClassname(-1, "info_changelevel") == -1 428 | && FindEntityByClassname(-1, "trigger_changelevel") == -1); 429 | } 430 | 431 | bool IsGhost(int client) 432 | { 433 | int m_isGhost = GetEntProp(client, Prop_Send, "m_isGhost"); 434 | 435 | if (m_isGhost > 0) 436 | return true; 437 | 438 | return false; 439 | } -------------------------------------------------------------------------------- /l4d2_srcds_crash_fix/srcds_crash_fix.sp: -------------------------------------------------------------------------------- 1 | #pragma semicolon 1 2 | #pragma newdecls required 3 | 4 | #include 5 | #include 6 | 7 | public void OnPluginStart() 8 | { 9 | Handle hGameConf = LoadGameConfigFile("srcds_crash_fix"); 10 | if( hGameConf == null ) SetFailState("Failed to load gamedata/srcds_crash_fix."); 11 | /* 12 | Handle hDetour = DHookCreateFromConf(hGameConf, "CSoundPatch::ChangePitch"); 13 | if( !hDetour ) 14 | SetFailState("Failed to find \"CSoundPatch::ChangePitch\" signature."); 15 | if( !DHookEnableDetour(hDetour, false, ChangePitch) ) 16 | SetFailState("Failed to detour \"CSoundPatch::ChangePitch\"."); 17 | delete hDetour; 18 | */ 19 | Handle hDetour = DHookCreateFromConf(hGameConf, "CSoundControllerImp::SoundChangePitch"); 20 | if( !hDetour ) 21 | SetFailState("Failed to find \"CSoundControllerImp::SoundChangePitch\" signature."); 22 | if( !DHookEnableDetour(hDetour, false, SoundChangePitch) ) 23 | SetFailState("Failed to detour \"CSoundControllerImp::SoundChangePitch\"."); 24 | delete hDetour; 25 | 26 | int offset = GameConfGetOffset(hGameConf, "LagCompensationOffset"); 27 | Address patch = GameConfGetAddress(hGameConf, "StartLagCompensation"); 28 | if( !patch ) SetFailState("Error finding the 'StartLagCompensation' signature."); 29 | int byte = LoadFromAddress(patch + view_as
(offset), NumberType_Int8); 30 | if( byte == 0x0F ) 31 | { 32 | StoreToAddress(patch + view_as
(offset), 0x74, NumberType_Int8); 33 | StoreToAddress(patch + view_as
(offset + 1), 0xA4, NumberType_Int8); 34 | StoreToAddress(patch + view_as
(offset + 2), 0x90, NumberType_Int8); 35 | StoreToAddress(patch + view_as
(offset + 3), 0x90, NumberType_Int8); 36 | StoreToAddress(patch + view_as
(offset + 4), 0x90, NumberType_Int8); 37 | StoreToAddress(patch + view_as
(offset + 5), 0x90, NumberType_Int8); 38 | } 39 | else 40 | { 41 | LogError("Failed to patch \"CLagCompensationManager::StartLagCompensation\" function."); 42 | } 43 | 44 | // Ladder crash fix (by Silvers) 45 | offset = GameConfGetOffset(hGameConf, "Patch_ChaseVictim"); 46 | patch = GameConfGetAddress(hGameConf, "ChaseVictim::Update"); 47 | if( !patch ) SetFailState("Error finding the 'ChaseVictim::Update' signature."); 48 | byte = LoadFromAddress(patch + view_as
(offset), NumberType_Int8); 49 | if( byte == 0xE8 ) 50 | { 51 | for( int i = 0; i < 5; i++ ) 52 | StoreToAddress(patch + view_as
(offset + i), 0x90, NumberType_Int8); 53 | } 54 | else if( byte != 0x90 ) 55 | { 56 | SetFailState("Error: the \"Patch_ChaseVictim\" offset %d is incorrect.", offset); 57 | } 58 | offset = GameConfGetOffset(hGameConf, "Patch_InfectedFlee"); 59 | patch = GameConfGetAddress(hGameConf, "InfectedFlee::Update"); 60 | if( !patch ) SetFailState("Error finding the 'InfectedFlee::Update' signature."); 61 | byte = LoadFromAddress(patch + view_as
(offset), NumberType_Int8); 62 | if( byte == 0xE8 ) 63 | { 64 | for( int i = 0; i < 5; i++ ) 65 | StoreToAddress(patch + view_as
(offset + i), 0x90, NumberType_Int8); 66 | } 67 | else if( byte != 0x90 ) 68 | { 69 | SetFailState("Error: the \"Patch_InfectedFlee\" offset %d is incorrect.", offset); 70 | } 71 | 72 | delete hGameConf; 73 | 74 | HookEvent("round_start_pre_entity", Event_round_start_pre_entity, EventHookMode_PostNoCopy); 75 | HookEvent("player_hurt", Event_PlayerHurt, EventHookMode_Pre); 76 | } 77 | 78 | // CChainsaw::ItemPostFrame() crash fix 79 | /* 80 | public MRESReturn ChangePitch(int pThis, Handle hReturn, Handle hParams) 81 | { 82 | if(!pThis) 83 | { 84 | DHookSetReturn(hReturn, 0); 85 | return MRES_Supercede; 86 | } 87 | 88 | return MRES_Ignored; 89 | } 90 | */ 91 | MRESReturn SoundChangePitch(Handle hReturn, Handle hParams) 92 | { 93 | int SoundPatch = DHookGetParam(hParams, 1); 94 | if(!SoundPatch) 95 | { 96 | DHookSetReturn(hReturn, 0); 97 | return MRES_Supercede; 98 | } 99 | 100 | return MRES_Ignored; 101 | } 102 | 103 | // CMoveableCamera::FollowTarget crash fix (by shqke) 104 | public void OnClientDisconnect(int client) 105 | { 106 | if (!IsClientInGame(client)) { 107 | return; 108 | } 109 | 110 | int viewEntity = GetEntPropEnt(client, Prop_Send, "m_hViewEntity"); 111 | if (!IsValidEdict(viewEntity)) { 112 | return; 113 | } 114 | 115 | char cls[64]; 116 | GetEdictClassname(viewEntity, cls, sizeof(cls)); 117 | if (strncmp(cls, "point_viewcontrol", 17) == 0) { 118 | // Matches CSurvivorCamera, CTriggerCamera 119 | if (strcmp(cls[17], "_survivor") == 0 || cls[17] == '\0') { 120 | // Disable entity to prevent CMoveableCamera::FollowTarget to cause a crash 121 | // m_hTargetEnt EHANDLE is not checked for existence and can be NULL 122 | // CBaseEntity::GetAbsAngles being called on causing a crash 123 | AcceptEntityInput(viewEntity, "Disable"); 124 | } 125 | 126 | // Matches CTriggerCameraMultiplayer 127 | if (strcmp(cls[17], "_multiplayer") == 0) { 128 | AcceptEntityInput(viewEntity, "RemovePlayer", client); 129 | } 130 | } 131 | } 132 | 133 | void Event_round_start_pre_entity(Event event, const char[] name, bool dontBroadcast) 134 | { 135 | int entity = INVALID_ENT_REFERENCE; 136 | while ((entity = FindEntityByClassname(entity, "point_viewcontrol*")) != INVALID_ENT_REFERENCE) { 137 | // Invoke a "Disable" input on camera entities to free all players 138 | // Doing so on round_start_pre_entity should help to not let map logic kick in too early 139 | AcceptEntityInput(entity, "Disable"); 140 | } 141 | } 142 | 143 | // AwardTemplate crash fix 144 | Action Event_PlayerHurt(Event event, const char[] name, bool dontBroadcast) 145 | { 146 | int target = GetClientOfUserId(event.GetInt("userid")); 147 | 148 | if (target >= 32 && GetEntProp(target, Prop_Send, "m_iTeamNum") == 2) 149 | return Plugin_Handled; 150 | 151 | return Plugin_Continue; 152 | } 153 | 154 | public bool OnClientConnect(int client, char[] rejectmsg, int maxlen) 155 | { 156 | if (client >= 32 && !IsFakeClient(client)) 157 | { 158 | strcopy(rejectmsg, maxlen, "Server is full"); 159 | return false; 160 | } 161 | return true; 162 | } -------------------------------------------------------------------------------- /l4d2_srcds_crash_fix/srcds_crash_fix.txt: -------------------------------------------------------------------------------- 1 | "Games" 2 | { 3 | "left4dead2" 4 | { 5 | "Functions" 6 | { 7 | "CSoundPatch::ChangePitch" 8 | { 9 | "signature" "CSoundPatch::ChangePitch" 10 | "callconv" "thiscall" 11 | "return" "int" 12 | "this" "address" 13 | } 14 | "CSoundControllerImp::SoundChangePitch" 15 | { 16 | "signature" "CSoundControllerImp::SoundChangePitch" 17 | "callconv" "thiscall" 18 | "return" "int" 19 | "this" "ignore" 20 | "arguments" 21 | { 22 | "soundpatch" 23 | { 24 | "type" "int" 25 | } 26 | } 27 | } 28 | } 29 | "Addresses" 30 | { 31 | "StartLagCompensation" 32 | { 33 | "linux" 34 | { 35 | "signature" "LagCompensation" 36 | } 37 | } 38 | "ChaseVictim::Update" 39 | { 40 | "linux" 41 | { 42 | "signature" "ChaseVictim::Update" 43 | } 44 | } 45 | "InfectedFlee::Update" 46 | { 47 | "linux" 48 | { 49 | "signature" "InfectedFlee::Update" 50 | } 51 | } 52 | } 53 | "Offsets" 54 | { 55 | "LagCompensationOffset" 56 | { 57 | "linux" "865" 58 | } 59 | "Patch_ChaseVictim" 60 | { 61 | "linux" "1502" 62 | } 63 | "Patch_InfectedFlee" 64 | { 65 | "linux" "301" 66 | } 67 | } 68 | "Signatures" 69 | { 70 | /* CSoundPatch::ChangePitch(float, float) */ 71 | "CSoundPatch::ChangePitch" 72 | { 73 | "library" "server" 74 | "linux" "@_ZN11CSoundPatch11ChangePitchEff" 75 | } 76 | /* CSoundControllerImp::SoundChangePitch(CSoundPatch *, float, float) */ 77 | "CSoundControllerImp::SoundChangePitch" 78 | { 79 | "library" "server" 80 | "linux" "@_ZN19CSoundControllerImp16SoundChangePitchEP11CSoundPatchff" 81 | } 82 | /* CLagCompensationManager::StartLagCompensation(CBasePlayer*, LagCompensationType, Vector const&, QAngle const&, float) */ 83 | "LagCompensation" 84 | { 85 | "library" "server" 86 | "linux" "@_ZN23CLagCompensationManager20StartLagCompensationEP11CBasePlayer19LagCompensationTypeRK6VectorRK6QAnglef" 87 | } 88 | /* ChaseVictim::Update(ChaseVictim *this, Infected *, float) */ 89 | "ChaseVictim::Update" 90 | { 91 | "library" "server" 92 | "linux" "@_ZN11ChaseVictim6UpdateEP8Infectedf" 93 | } 94 | /* InfectedFlee::Update(InfectedFlee *this, Infected *, float) */ 95 | "InfectedFlee::Update" 96 | { 97 | "library" "server" 98 | "linux" "@_ZN12InfectedFlee6UpdateEP8Infectedf" 99 | } 100 | } 101 | } 102 | } 103 | -------------------------------------------------------------------------------- /l4d2_tank_hud/tank_hud.sp: -------------------------------------------------------------------------------- 1 | #pragma semicolon 1 2 | 3 | #include 4 | 5 | forward void L4D_OnReplaceTank(int tank, int newtank); 6 | 7 | #pragma newdecls required 8 | 9 | Handle isTankActive; 10 | bool hiddenTankPanel[MAXPLAYERS + 1]; 11 | int iTankPassedCount[MAXPLAYERS + 1]; 12 | 13 | public Plugin myinfo = 14 | { 15 | name = "[L4D] Tank Hud", 16 | author = "ConfoglTeam & Accelerator", 17 | description = "", 18 | version = "3.1", 19 | url = "https://github.com/accelerator74/sp-plugins" 20 | }; 21 | 22 | public void OnPluginStart() 23 | { 24 | HookEvent("round_start", Round_Event, EventHookMode_PostNoCopy); 25 | HookEvent("round_end", Round_Event, EventHookMode_PostNoCopy); 26 | HookEvent("tank_spawn", TankSpawn_Event); 27 | 28 | RegConsoleCmd("sm_tankhud", ToggleTankPanel_Cmd, "Toggles the tank panel visibility so other menus can be seen"); 29 | } 30 | 31 | public void Round_Event(Event event, const char[] name, bool dontBroadcast) 32 | { 33 | delete isTankActive; 34 | } 35 | 36 | public void TankSpawn_Event(Event event, const char[] name, bool dontBroadcast) 37 | { 38 | iTankPassedCount[GetClientOfUserId(event.GetInt("userid"))] = 1; 39 | if (isTankActive == null) 40 | { 41 | for (int i = 1; i <= MaxClients; i++) 42 | hiddenTankPanel[i] = false; 43 | 44 | isTankActive = CreateTimer(0.5, MenuRefresh_Timer, _, TIMER_REPEAT); 45 | } 46 | } 47 | 48 | public void L4D_OnReplaceTank(int tank, int newtank) 49 | { 50 | if (tank != newtank) 51 | { 52 | iTankPassedCount[newtank] = iTankPassedCount[tank] + 1; 53 | iTankPassedCount[tank] = 0; 54 | } 55 | } 56 | 57 | public Action MenuRefresh_Timer(Handle timer) 58 | { 59 | int iTankCount; 60 | int iTankClients[33]; 61 | 62 | for (int i = 1; i <= MaxClients; i++) 63 | { 64 | if (IsClientInGame(i) && GetClientTeam(i) == 3 && GetZombieClass(i) == 8 && GetTankAlive(i)) 65 | { 66 | iTankClients[iTankCount] = i; 67 | iTankCount++; 68 | } 69 | } 70 | 71 | if (iTankCount < 1) 72 | { 73 | isTankActive = null; 74 | return Plugin_Stop; 75 | } 76 | 77 | char buffer[64]; 78 | Panel menuPanel = new Panel(); 79 | 80 | // Header 81 | menuPanel.SetTitle("Tank HUD"); 82 | menuPanel.DrawText("\n \n"); 83 | 84 | for (int j = 0; j < iTankCount; j++) 85 | { 86 | // Name 87 | if (!IsFakeClient(iTankClients[j])) 88 | { 89 | GetClientName(iTankClients[j], buffer, sizeof(buffer)); 90 | 91 | if (strlen(buffer) > 25) 92 | { 93 | buffer[23] = '.'; 94 | buffer[24] = '.'; 95 | buffer[25] = '.'; 96 | buffer[26] = 0; 97 | } 98 | 99 | Format(buffer, sizeof(buffer), "Control: %s", buffer); 100 | menuPanel.DrawText(buffer); 101 | } 102 | else 103 | { 104 | menuPanel.DrawText("Control: AI"); 105 | } 106 | 107 | // Health 108 | int health = (GetEntProp(iTankClients[j], Prop_Send, "m_isIncapacitated") ? 0 : GetClientHealth(iTankClients[j])); 109 | Format(buffer, sizeof(buffer), "Health : %i / %.1f%%", health, 100.0*health/GetEntProp(iTankClients[j], Prop_Send, "m_iMaxHealth")); 110 | menuPanel.DrawText(buffer); 111 | 112 | // Rage 113 | if (!IsFakeClient(iTankClients[j])) { 114 | FormatEx(buffer, sizeof(buffer), "Rage : %d%% (Pass #%i)", GetTankFrustration(iTankClients[j]), iTankPassedCount[iTankClients[j]]); 115 | menuPanel.DrawText(buffer); 116 | PrintHintText(iTankClients[j], buffer); 117 | } 118 | 119 | // Fire 120 | if (GetEntityFlags(iTankClients[j]) & FL_ONFIRE) 121 | menuPanel.DrawText("Burning..."); 122 | 123 | menuPanel.DrawText("\n \n"); 124 | } 125 | 126 | menuPanel.DrawItem("Close"); 127 | 128 | for (int i = 1; i <= MaxClients; i++) 129 | { 130 | if (IsClientInGame(i) && !IsFakeClient(i) && GetClientTeam(i) == 3 && GetZombieClass(i) != 8 && !hiddenTankPanel[i]) 131 | { 132 | menuPanel.Send(i, DummyHandler, 1); 133 | } 134 | } 135 | 136 | delete menuPanel; 137 | return Plugin_Continue; 138 | } 139 | 140 | public int DummyHandler(Menu menu, MenuAction action, int param1, int param2) 141 | { 142 | if (action == MenuAction_Select) 143 | { 144 | hiddenTankPanel[param1] = true; 145 | PrintToChat(param1, "\x05Tank HUD disabled.\nTo enable \x04!tankhud"); 146 | } 147 | 148 | return 0; 149 | } 150 | 151 | public Action ToggleTankPanel_Cmd(int client, int args) 152 | { 153 | if(!hiddenTankPanel[client]) 154 | { 155 | hiddenTankPanel[client] = true; 156 | PrintToChat(client, "\x05Tank HUD enabled."); 157 | } 158 | return Plugin_Handled; 159 | } 160 | 161 | public void OnClientDisconnect(int client) 162 | { 163 | hiddenTankPanel[client] = false; 164 | } 165 | 166 | stock bool GetTankAlive(int client) { return IsPlayerAlive(client) && !GetEntProp(client, Prop_Send, "m_isGhost"); } 167 | stock int GetZombieClass(int client) { return GetEntProp(client, Prop_Send, "m_zombieClass"); } 168 | stock int GetTankFrustration(int iTankClient) { return (100 - GetEntProp(iTankClient, Prop_Send, "m_frustration")); } -------------------------------------------------------------------------------- /l4d2_wsc/l4d2_wsc.sp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | enum WeaponId 4 | { 5 | WEPID_NONE = -1, WEPID_PISTOL, WEPID_SMG, WEPID_PUMPSHOTGUN, WEPID_AUTOSHOTGUN, WEPID_RIFLE, 6 | WEPID_HUNTING_RIFLE, WEPID_SMG_SILENCED, WEPID_SHOTGUN_CHROME, WEPID_RIFLE_DESERT, WEPID_SNIPER_MILITARY, 7 | WEPID_SHOTGUN_SPAS, WEPID_FIRST_AID_KIT, WEPID_MOLOTOV, WEPID_PIPE_BOMB, WEPID_PAIN_PILLS, 8 | WEPID_MELEE, WEPID_CHAINSAW, WEPID_GRENADE_LAUNCHER, WEPID_ADRENALINE, WEPID_DEFIBRILLATOR, 9 | WEPID_VOMITJAR, WEPID_RIFLE_AK47, WEPID_INCENDIARY_AMMO, WEPID_FRAG_AMMO, WEPID_PISTOL_MAGNUM, 10 | WEPID_SMG_MP5, WEPID_RIFLE_SG552, WEPID_SNIPER_AWP, WEPID_SNIPER_SCOUT, WEPID_RIFLE_M60 11 | }; 12 | 13 | enum Cvars 14 | { 15 | ConVar:PISTOL, ConVar:SMG, ConVar:PUMPSHOTGUN, ConVar:AUTOSHOTGUN, ConVar:RIFLE, 16 | ConVar:HUNTING_RIFLE, ConVar:SMG_SILENCED, ConVar:SHOTGUN_CHROME, ConVar:RIFLE_DESERT, ConVar:SNIPER_MILITARY, 17 | ConVar:SHOTGUN_SPAS, ConVar:FIRST_AID_KIT, ConVar:MOLOTOV, ConVar:PIPE_BOMB, ConVar:PAIN_PILLS, 18 | ConVar:MELEE, ConVar:CHAINSAW, ConVar:GRENADE_LAUNCHER, ConVar:ADRENALINE, ConVar:DEFIBRILLATOR, 19 | ConVar:VOMITJAR, ConVar:RIFLE_AK47, ConVar:INCENDIARY_AMMO, ConVar:FRAG_AMMO, ConVar:PISTOL_MAGNUM, 20 | ConVar:SMG_MP5, ConVar:RIFLE_SG552, ConVar:SNIPER_AWP, ConVar:SNIPER_SCOUT, ConVar:RIFLE_M60 21 | }; 22 | 23 | char WeaponNames[WeaponId][] = 24 | { 25 | "weapon_pistol", "weapon_smg", "weapon_pumpshotgun", "weapon_autoshotgun", "weapon_rifle", 26 | "weapon_hunting_rifle", "weapon_smg_silenced", "weapon_shotgun_chrome", "weapon_rifle_desert", "weapon_sniper_military", 27 | "weapon_shotgun_spas", "weapon_first_aid_kit", "weapon_molotov", "weapon_pipe_bomb", "weapon_pain_pills", 28 | "weapon_melee", "weapon_chainsaw", "weapon_grenade_launcher", "weapon_adrenaline", "weapon_defibrillator", 29 | "weapon_vomitjar", "weapon_rifle_ak47", "weapon_upgradepack_incendiary", "weapon_upgradepack_explosive", "weapon_pistol_magnum", 30 | "weapon_smg_mp5", "weapon_rifle_sg552", "weapon_sniper_awp", "weapon_sniper_scout", "weapon_rifle_m60" 31 | }; 32 | 33 | ConVar l4d2_wsc[Cvars]; 34 | StringMap hWeaponNamesTrie = null; 35 | int ent_table[128]; 36 | int ent_counter; 37 | 38 | public Plugin myinfo = 39 | { 40 | name = "[L4D2] Weapon Spawns Control", 41 | author = "Accelerator", 42 | description = "Count items from weapons spawns", 43 | version = "1.0", 44 | url = "https://github.com/accelerator74/sp-plugins" 45 | } 46 | 47 | stock WeaponId WeaponNameToId(const char[] weaponName) 48 | { 49 | WeaponId id; 50 | if(hWeaponNamesTrie.GetValue(weaponName, id)) 51 | { 52 | return view_as(id); 53 | } 54 | return WEPID_NONE; 55 | } 56 | 57 | public void OnPluginStart() 58 | { 59 | HookEvent("spawner_give_item", Event_SpawnerGiveItem); 60 | HookEvent("round_start", Event_RoundStart, EventHookMode_PostNoCopy); 61 | 62 | l4d2_wsc[FIRST_AID_KIT] = CreateConVar("l4d2_wsc_first_aid_kit", "0"); 63 | l4d2_wsc[DEFIBRILLATOR] = CreateConVar("l4d2_wsc_defibrillator", "0"); 64 | l4d2_wsc[PAIN_PILLS] = CreateConVar("l4d2_wsc_pain_pills", "0"); 65 | l4d2_wsc[ADRENALINE] = CreateConVar("l4d2_wsc_adrenaline", "0"); 66 | l4d2_wsc[MELEE] = CreateConVar("l4d2_wsc_melee", "0"); 67 | l4d2_wsc[CHAINSAW] = CreateConVar("l4d2_wsc_chainsaw", "0"); 68 | l4d2_wsc[PISTOL] = CreateConVar("l4d2_wsc_pistol", "0"); 69 | l4d2_wsc[PISTOL_MAGNUM] = CreateConVar("l4d2_wsc_pistol_magnum", "0"); 70 | l4d2_wsc[SMG] = CreateConVar("l4d2_wsc_smg", "0"); 71 | l4d2_wsc[SMG_SILENCED] = CreateConVar("l4d2_wsc_smg_silenced", "0"); 72 | l4d2_wsc[PUMPSHOTGUN] = CreateConVar("l4d2_wsc_pumpshotgun", "0"); 73 | l4d2_wsc[SHOTGUN_CHROME] = CreateConVar("l4d2_wsc_shotgun_chrome", "0"); 74 | l4d2_wsc[SHOTGUN_SPAS] = CreateConVar("l4d2_wsc_shotgun_spas", "0"); 75 | l4d2_wsc[AUTOSHOTGUN] = CreateConVar("l4d2_wsc_autoshotgun", "0"); 76 | l4d2_wsc[SNIPER_MILITARY] = CreateConVar("l4d2_wsc_sniper_military", "0"); 77 | l4d2_wsc[HUNTING_RIFLE] = CreateConVar("l4d2_wsc_hunting_rifle", "0"); 78 | l4d2_wsc[RIFLE] = CreateConVar("l4d2_wsc_rifle", "0"); 79 | l4d2_wsc[RIFLE_DESERT] = CreateConVar("l4d2_wsc_rifle_desert", "0"); 80 | l4d2_wsc[RIFLE_AK47] = CreateConVar("l4d2_wsc_rifle_ak47", "0"); 81 | l4d2_wsc[RIFLE_M60] = CreateConVar("l4d2_wsc_rifle_m60", "0"); 82 | l4d2_wsc[SMG_MP5] = CreateConVar("l4d2_wsc_smg_mp5", "0"); 83 | l4d2_wsc[SNIPER_SCOUT] = CreateConVar("l4d2_wsc_sniper_scout", "0"); 84 | l4d2_wsc[SNIPER_AWP] = CreateConVar("l4d2_wsc_sniper_awp", "0"); 85 | l4d2_wsc[RIFLE_SG552] = CreateConVar("l4d2_wsc_rifle_sg552", "0"); 86 | l4d2_wsc[GRENADE_LAUNCHER] = CreateConVar("l4d2_wsc_grenade_launcher", "0"); 87 | l4d2_wsc[PIPE_BOMB] = CreateConVar("l4d2_wsc_pipe_bomb", "0"); 88 | l4d2_wsc[MOLOTOV] = CreateConVar("l4d2_wsc_molotov", "0"); 89 | l4d2_wsc[VOMITJAR] = CreateConVar("l4d2_wsc_vomitjar", "0"); 90 | l4d2_wsc[INCENDIARY_AMMO] = CreateConVar("l4d2_wsc_upgradepack_exp", "0"); 91 | l4d2_wsc[FRAG_AMMO] = CreateConVar("l4d2_wsc_upgradepack_inc", "0"); 92 | 93 | hWeaponNamesTrie = new StringMap(); 94 | for(int i = 0; i < view_as(WeaponId); i++) 95 | { 96 | hWeaponNamesTrie.SetValue(WeaponNames[view_as(i)], i); 97 | } 98 | 99 | AutoExecConfig(true, "l4d2_wsc"); 100 | } 101 | 102 | public Action Event_SpawnerGiveItem(Event event, const char[] name, bool dontBroadcast) 103 | { 104 | char item_name[32]; 105 | event.GetString("item", item_name, sizeof(item_name)); 106 | 107 | WeaponId wepid = WeaponNameToId(item_name); 108 | if (wepid != WEPID_NONE) 109 | { 110 | int value = l4d2_wsc[wepid].IntValue; 111 | if (value > 0) 112 | { 113 | int spawner = GetEventInt(event, "spawner"); 114 | 115 | if (value == 1) 116 | { 117 | if (IsValidEdict(spawner)) 118 | RemoveEdict(spawner); 119 | } 120 | else 121 | { 122 | if (IsUseFirst(spawner)) 123 | { 124 | SetEntProp(spawner, Prop_Data, "m_itemCount", value); 125 | ent_table[ent_counter] = spawner; 126 | ent_counter++; 127 | } 128 | } 129 | } 130 | } 131 | 132 | return Plugin_Continue; 133 | } 134 | 135 | public Action Event_RoundStart(Event hEvent, const char[] strName, bool DontBroadcast) 136 | { 137 | for (int i = 0; i < sizeof(ent_table); i++) 138 | ent_table[i] = 0; 139 | 140 | ent_counter = 0; 141 | 142 | return Plugin_Continue; 143 | } 144 | 145 | bool IsUseFirst(spawner) 146 | { 147 | for (int i = 0; i < sizeof(ent_table); i++) 148 | { 149 | if(ent_table[i] == spawner) 150 | return false; 151 | } 152 | return true; 153 | } -------------------------------------------------------------------------------- /l4d2mapfinalenext/l4d2mapfinalenext.sp: -------------------------------------------------------------------------------- 1 | #pragma semicolon 1 2 | #include 3 | 4 | char current_map[53]; 5 | int round_end_repeats; 6 | bool IsRoundStarted = false; 7 | char NextCampaignVote[32]; 8 | int seconds; 9 | char NextCampaign[53]; 10 | float RoundStartTime; 11 | 12 | public Plugin myinfo = 13 | { 14 | name = "L4D2 Map Finale Next", 15 | author = "Accelerator", 16 | description = "Map rotating and vote manager", 17 | version = "4.10", 18 | url = "https://github.com/accelerator74/sp-plugins" 19 | }; 20 | 21 | public void OnPluginStart() 22 | { 23 | RegConsoleCmd("sm_next", Command_Next); 24 | 25 | AddCommandListener(Callvote_Handler, "callvote"); 26 | 27 | HookEvent("finale_win", Event_FinalWin, EventHookMode_PostNoCopy); 28 | HookEvent("round_start", Event_RoundStart, EventHookMode_PostNoCopy); 29 | HookEvent("round_end", Event_RoundEnd, EventHookMode_PostNoCopy); 30 | } 31 | 32 | void NextMission() 33 | { 34 | if (StrContains(current_map, "c1m", false) != -1) 35 | { 36 | NextCampaign = "The Passing"; 37 | NextCampaignVote = "L4D2C6"; 38 | } 39 | else if (StrContains(current_map, "c2m", false) != -1) 40 | { 41 | NextCampaign = "Swamp Fever"; 42 | NextCampaignVote = "L4D2C3"; 43 | } 44 | else if (StrContains(current_map, "c3m", false) != -1) 45 | { 46 | NextCampaign = "Hard Rain"; 47 | NextCampaignVote = "L4D2C4"; 48 | } 49 | else if (StrContains(current_map, "c4m", false) != -1) 50 | { 51 | NextCampaign = "The Parish"; 52 | NextCampaignVote = "L4D2C5"; 53 | } 54 | else if (StrContains(current_map, "c5m", false) != -1) 55 | { 56 | NextCampaign = "The Sacrifice"; 57 | NextCampaignVote = "L4D2C7"; 58 | } 59 | else if (StrContains(current_map, "c6m", false) != -1) 60 | { 61 | NextCampaign = "Dark Carnival"; 62 | NextCampaignVote = "L4D2C2"; 63 | } 64 | else if (StrContains(current_map, "c7m", false) != -1) 65 | { 66 | NextCampaign = "No Mercy"; 67 | NextCampaignVote = "L4D2C8"; 68 | } 69 | else if (StrContains(current_map, "c8m", false) != -1) 70 | { 71 | NextCampaign = "Crash Course"; 72 | NextCampaignVote = "L4D2C9"; 73 | } 74 | else if (StrContains(current_map, "c9m", false) != -1) 75 | { 76 | NextCampaign = "Death Toll"; 77 | NextCampaignVote = "L4D2C10"; 78 | } 79 | else if (StrContains(current_map, "c10m", false) != -1) 80 | { 81 | NextCampaign = "The Last Stand"; 82 | NextCampaignVote = "L4D2C14"; 83 | } 84 | else if (StrContains(current_map, "c11m", false) != -1) 85 | { 86 | NextCampaign = "Blood Harvest"; 87 | NextCampaignVote = "L4D2C12"; 88 | } 89 | else if (StrContains(current_map, "c12m", false) != -1) 90 | { 91 | NextCampaign = "Cold Stream"; 92 | NextCampaignVote = "L4D2C13"; 93 | } 94 | else if (StrContains(current_map, "c13m", false) != -1) 95 | { 96 | NextCampaign = "Dead Center"; 97 | NextCampaignVote = "L4D2C1"; 98 | } 99 | else if (StrContains(current_map, "c14m", false) != -1) 100 | { 101 | NextCampaign = "Dead Air"; 102 | NextCampaignVote = "L4D2C11"; 103 | } 104 | else 105 | { 106 | NextCampaign = "Dead Center"; 107 | NextCampaignVote = "L4D2C1"; 108 | } 109 | } 110 | 111 | public Action Callvote_Handler(int client, const char[] command, int arg) 112 | { 113 | char voteName[32]; 114 | char voteValue[128]; 115 | GetCmdArg(1, voteName, sizeof(voteName)); 116 | GetCmdArg(2, voteValue, sizeof(voteValue)); 117 | 118 | if (StrEqual(voteName, "ChangeMission", false) || StrEqual(voteName, "ChangeChapter", false)) 119 | { 120 | int flags = GetUserFlagBits(client); 121 | if (flags & ADMFLAG_VOTE || flags & ADMFLAG_CHANGEMAP || flags & ADMFLAG_ROOT || flags & ADMFLAG_GENERIC) 122 | return Plugin_Continue; 123 | else if (round_end_repeats > 5) 124 | return Plugin_Handled; 125 | else if (round_end_repeats > 3) 126 | { 127 | if (GetEngineTime() - RoundStartTime > 180.0) 128 | { 129 | PrintToChat(client, "\x05The game has already started. Vote cancelled.", NextCampaign); 130 | return Plugin_Handled; 131 | } 132 | 133 | NextMission(); 134 | 135 | if (StrEqual(voteValue, NextCampaignVote, false)) 136 | { 137 | RoundStartTime -= 180.0; 138 | return Plugin_Continue; 139 | } 140 | else 141 | { 142 | PrintToChat(client, "\x05Next campaign to vote: \x04%s", NextCampaign); 143 | return Plugin_Handled; 144 | } 145 | } 146 | else 147 | { 148 | PrintToChat(client, "\x05Mission failed \x01%d\x05 of \x01%d\x05 times. Vote cancelled.", round_end_repeats, 4); 149 | return Plugin_Handled; 150 | } 151 | } 152 | if (StrEqual(voteName, "RestartGame", false)) 153 | { 154 | int flags = GetUserFlagBits(client); 155 | if (flags & ADMFLAG_VOTE || flags & ADMFLAG_CHANGEMAP || flags & ADMFLAG_ROOT || flags & ADMFLAG_GENERIC) 156 | return Plugin_Continue; 157 | else 158 | return Plugin_Handled; 159 | } 160 | 161 | return Plugin_Continue; 162 | } 163 | 164 | public void OnMapStart() 165 | { 166 | GetCurrentMap(current_map, sizeof(current_map)); 167 | round_end_repeats = 0; 168 | seconds = 15; 169 | } 170 | 171 | public void Event_FinalWin(Event event, const char[] name, bool dontBroadcast) 172 | { 173 | PrintNextCampaign(); 174 | CreateTimer(10.0, ChangeCampaign, TIMER_FLAG_NO_MAPCHANGE); 175 | } 176 | 177 | public void Event_RoundStart(Event event, const char[] name, bool dontBroadcast) 178 | { 179 | IsRoundStarted = true; 180 | RoundStartTime = GetEngineTime(); 181 | 182 | if (round_end_repeats > 5) 183 | { 184 | Veto(); 185 | CreateTimer(1.0, TimerInfo, _, TIMER_REPEAT|TIMER_FLAG_NO_MAPCHANGE); 186 | PrintNextCampaign(); 187 | } 188 | else if (round_end_repeats > 0) 189 | PrintToChatAll("\x05Mission failed \x01%d\x05 of \x01%d\x05 times", round_end_repeats, 6); 190 | } 191 | 192 | public Action TimerInfo(Handle timer) 193 | { 194 | PrintHintTextToAll("Change campaign through %i seconds!", seconds); 195 | 196 | if (seconds <= 0) 197 | { 198 | PrintHintTextToAll("Change campaign on %s", NextCampaign); 199 | CreateTimer(5.0, ChangeCampaign, TIMER_FLAG_NO_MAPCHANGE); 200 | return Plugin_Stop; 201 | } 202 | 203 | seconds--; 204 | 205 | return Plugin_Continue; 206 | } 207 | 208 | public Action ChangeCampaign(Handle timer, int client) 209 | { 210 | ChangeCampaignEx(); 211 | round_end_repeats = 0; 212 | return Plugin_Stop; 213 | } 214 | 215 | public void Event_RoundEnd(Event event, const char[] name, bool dontBroadcast) 216 | { 217 | if (!IsRoundStarted) 218 | return; 219 | 220 | round_end_repeats++; 221 | 222 | if (round_end_repeats > 5) 223 | Veto(); 224 | } 225 | 226 | public void ChangeCampaignEx() 227 | { 228 | NextMission(); 229 | 230 | if (StrEqual(NextCampaignVote, "L4D2C1")) 231 | ServerCommand("changelevel c1m1_hotel"); 232 | else if (StrEqual(NextCampaignVote, "L4D2C2")) 233 | ServerCommand("changelevel c2m1_highway"); 234 | else if (StrEqual(NextCampaignVote, "L4D2C3")) 235 | ServerCommand("changelevel c3m1_plankcountry"); 236 | else if (StrEqual(NextCampaignVote, "L4D2C4")) 237 | ServerCommand("changelevel c4m1_milltown_a"); 238 | else if (StrEqual(NextCampaignVote, "L4D2C5")) 239 | ServerCommand("changelevel c5m1_waterfront"); 240 | else if (StrEqual(NextCampaignVote, "L4D2C6")) 241 | ServerCommand("changelevel c6m1_riverbank"); 242 | else if (StrEqual(NextCampaignVote, "L4D2C7")) 243 | ServerCommand("changelevel c7m1_docks"); 244 | else if (StrEqual(NextCampaignVote, "L4D2C8")) 245 | ServerCommand("changelevel c8m1_apartment"); 246 | else if (StrEqual(NextCampaignVote, "L4D2C9")) 247 | ServerCommand("changelevel c9m1_alleys"); 248 | else if (StrEqual(NextCampaignVote, "L4D2C10")) 249 | ServerCommand("changelevel c10m1_caves"); 250 | else if (StrEqual(NextCampaignVote, "L4D2C11")) 251 | ServerCommand("changelevel c11m1_greenhouse"); 252 | else if (StrEqual(NextCampaignVote, "L4D2C12")) 253 | ServerCommand("changelevel c12m1_hilltop"); 254 | else if (StrEqual(NextCampaignVote, "L4D2C13")) 255 | ServerCommand("changelevel c13m1_alpinecreek"); 256 | else if (StrEqual(NextCampaignVote, "L4D2C14")) 257 | ServerCommand("changelevel c14m1_junkyard"); 258 | else 259 | ServerCommand("changelevel c1m1_hotel"); 260 | } 261 | 262 | void PrintNextCampaign(int client = 0) 263 | { 264 | NextMission(); 265 | 266 | if (client) 267 | { 268 | PrintToChat(client, "\x05Next campaign: \x04%s", NextCampaign); 269 | PrintToChat(client, "\x05Mission failed \x01%d\x05 of \x01%d\x05 times", round_end_repeats, 6); 270 | } 271 | else 272 | { 273 | PrintToChatAll("\x05Next campaign: \x04%s", NextCampaign); 274 | } 275 | } 276 | 277 | void Veto() 278 | { 279 | for (int i = 1; i <= MaxClients; i++) 280 | { 281 | if (IsValidEntity(i)) 282 | { 283 | FakeClientCommand(i, "Vote No"); 284 | } 285 | } 286 | } 287 | 288 | public Action Command_Next(int client, int args) 289 | { 290 | if (client) 291 | { 292 | PrintNextCampaign(client); 293 | } 294 | return Plugin_Handled; 295 | } -------------------------------------------------------------------------------- /l4d2mapfinalenext/l4d2vsmapfinalenext.sp: -------------------------------------------------------------------------------- 1 | #pragma semicolon 1 2 | #include 3 | 4 | char current_map[53]; 5 | char NextCampaignVote[32]; 6 | char NextCampaign[53]; 7 | 8 | public Plugin myinfo = 9 | { 10 | name = "L4D2 Map Finale Next Versus", 11 | author = "Accelerator", 12 | description = "Map rotating", 13 | version = "4.8", 14 | url = "https://github.com/accelerator74/sp-plugins" 15 | }; 16 | 17 | public void OnPluginStart() 18 | { 19 | RegConsoleCmd("sm_next", Command_Next); 20 | HookEvent("versus_match_finished", Event_FinalWin, EventHookMode_PostNoCopy); 21 | } 22 | 23 | void NextMission() 24 | { 25 | if (StrContains(current_map, "c1m", false) != -1) 26 | { 27 | NextCampaign = "The Passing"; 28 | NextCampaignVote = "L4D2C6"; 29 | } 30 | else if (StrContains(current_map, "c2m", false) != -1) 31 | { 32 | NextCampaign = "Swamp Fever"; 33 | NextCampaignVote = "L4D2C3"; 34 | } 35 | else if (StrContains(current_map, "c3m", false) != -1) 36 | { 37 | NextCampaign = "Hard Rain"; 38 | NextCampaignVote = "L4D2C4"; 39 | } 40 | else if (StrContains(current_map, "c4m", false) != -1) 41 | { 42 | NextCampaign = "The Parish"; 43 | NextCampaignVote = "L4D2C5"; 44 | } 45 | else if (StrContains(current_map, "c5m", false) != -1) 46 | { 47 | NextCampaign = "The Sacrifice"; 48 | NextCampaignVote = "L4D2C7"; 49 | } 50 | else if (StrContains(current_map, "c6m", false) != -1) 51 | { 52 | NextCampaign = "Dark Carnival"; 53 | NextCampaignVote = "L4D2C2"; 54 | } 55 | else if (StrContains(current_map, "c7m", false) != -1) 56 | { 57 | NextCampaign = "No Mercy"; 58 | NextCampaignVote = "L4D2C8"; 59 | } 60 | else if (StrContains(current_map, "c8m", false) != -1) 61 | { 62 | NextCampaign = "Crash Course"; 63 | NextCampaignVote = "L4D2C9"; 64 | } 65 | else if (StrContains(current_map, "c9m", false) != -1) 66 | { 67 | NextCampaign = "Death Toll"; 68 | NextCampaignVote = "L4D2C10"; 69 | } 70 | else if (StrContains(current_map, "c10m", false) != -1) 71 | { 72 | NextCampaign = "The Last Stand"; 73 | NextCampaignVote = "L4D2C14"; 74 | } 75 | else if (StrContains(current_map, "c11m", false) != -1) 76 | { 77 | NextCampaign = "Blood Harvest"; 78 | NextCampaignVote = "L4D2C12"; 79 | } 80 | else if (StrContains(current_map, "c12m", false) != -1) 81 | { 82 | NextCampaign = "Cold Stream"; 83 | NextCampaignVote = "L4D2C13"; 84 | } 85 | else if (StrContains(current_map, "c13m", false) != -1) 86 | { 87 | NextCampaign = "Dead Center"; 88 | NextCampaignVote = "L4D2C1"; 89 | } 90 | else if (StrContains(current_map, "c14m", false) != -1) 91 | { 92 | NextCampaign = "Dead Air"; 93 | NextCampaignVote = "L4D2C11"; 94 | } 95 | else 96 | { 97 | NextCampaign = "Dead Center"; 98 | NextCampaignVote = "L4D2C1"; 99 | } 100 | } 101 | 102 | public void OnMapStart() 103 | { 104 | GetCurrentMap(current_map, sizeof(current_map)); 105 | } 106 | 107 | public void Event_FinalWin(Event event, const char[] name, bool dontBroadcast) 108 | { 109 | PrintNextCampaign(); 110 | CreateTimer(10.0, ChangeCampaign, TIMER_FLAG_NO_MAPCHANGE); 111 | } 112 | 113 | public Action ChangeCampaign(Handle timer, int client) 114 | { 115 | ChangeCampaignEx(); 116 | return Plugin_Stop; 117 | } 118 | 119 | public void ChangeCampaignEx() 120 | { 121 | NextMission(); 122 | 123 | if (StrEqual(NextCampaignVote, "L4D2C1")) 124 | ServerCommand("changelevel c1m1_hotel"); 125 | else if (StrEqual(NextCampaignVote, "L4D2C2")) 126 | ServerCommand("changelevel c2m1_highway"); 127 | else if (StrEqual(NextCampaignVote, "L4D2C3")) 128 | ServerCommand("changelevel c3m1_plankcountry"); 129 | else if (StrEqual(NextCampaignVote, "L4D2C4")) 130 | ServerCommand("changelevel c4m1_milltown_a"); 131 | else if (StrEqual(NextCampaignVote, "L4D2C5")) 132 | ServerCommand("changelevel c5m1_waterfront"); 133 | else if (StrEqual(NextCampaignVote, "L4D2C6")) 134 | ServerCommand("changelevel c6m1_riverbank"); 135 | else if (StrEqual(NextCampaignVote, "L4D2C7")) 136 | ServerCommand("changelevel c7m1_docks"); 137 | else if (StrEqual(NextCampaignVote, "L4D2C8")) 138 | ServerCommand("changelevel c8m1_apartment"); 139 | else if (StrEqual(NextCampaignVote, "L4D2C9")) 140 | ServerCommand("changelevel c9m1_alleys"); 141 | else if (StrEqual(NextCampaignVote, "L4D2C10")) 142 | ServerCommand("changelevel c10m1_caves"); 143 | else if (StrEqual(NextCampaignVote, "L4D2C11")) 144 | ServerCommand("changelevel c11m1_greenhouse"); 145 | else if (StrEqual(NextCampaignVote, "L4D2C12")) 146 | ServerCommand("changelevel c12m1_hilltop"); 147 | else if (StrEqual(NextCampaignVote, "L4D2C13")) 148 | ServerCommand("changelevel c13m1_alpinecreek"); 149 | else if (StrEqual(NextCampaignVote, "L4D2C14")) 150 | ServerCommand("changelevel c14m1_junkyard"); 151 | else 152 | ServerCommand("changelevel c1m1_hotel"); 153 | } 154 | 155 | void PrintNextCampaign(int client = 0) 156 | { 157 | NextMission(); 158 | 159 | if (client) 160 | { 161 | PrintToChat(client, "\x05Next campaign: \x04%s", NextCampaign); 162 | } 163 | else 164 | { 165 | PrintToChatAll("\x05Next campaign: \x04%s", NextCampaign); 166 | } 167 | } 168 | 169 | public Action Command_Next(int client, int args) 170 | { 171 | if (client) 172 | { 173 | PrintNextCampaign(client); 174 | } 175 | return Plugin_Handled; 176 | } -------------------------------------------------------------------------------- /l4d2spitterautokill/l4d2spitterautokill.sp: -------------------------------------------------------------------------------- 1 | #pragma semicolon 1 2 | 3 | #include 4 | #include 5 | 6 | new Handle:Spitter_Timer[MAXPLAYERS+1]; 7 | 8 | public Plugin:myinfo = 9 | { 10 | name = "[L4D2] Spitter Autokill", 11 | author = "Accelerator", 12 | description = "", 13 | version = "1.0", 14 | url = "https://github.com/accelerator74/sp-plugins" 15 | }; 16 | 17 | public OnPluginStart() 18 | { 19 | HookEvent("player_spawn", EventPlayerSpawn); 20 | HookEvent("ability_use", Event_AbilityUse); 21 | HookEvent("player_death", EventPlayerDeath); 22 | HookEvent("round_end", Event_RoundEnd); 23 | } 24 | 25 | public Action:EventPlayerSpawn(Handle:event, const String:name[], bool:dontBroadcast) 26 | { 27 | new client = GetClientOfUserId(GetEventInt(event, "userid")); 28 | 29 | if (IsSpitter(client)) 30 | { 31 | if (Spitter_Timer[client] != INVALID_HANDLE) 32 | { 33 | KillTimer(Spitter_Timer[client]); 34 | Spitter_Timer[client] = INVALID_HANDLE; 35 | } 36 | Spitter_Timer[client] = CreateTimer(22.0, Timer_Autokill, client); 37 | } 38 | 39 | return Plugin_Continue; 40 | } 41 | 42 | public Action:Event_AbilityUse(Handle:event, const String:name[], bool:dontBroadcast) 43 | { 44 | new client = GetClientOfUserId(GetEventInt(event, "userid")); 45 | 46 | if (IsSpitter(client)) 47 | { 48 | if (Spitter_Timer[client] != INVALID_HANDLE) 49 | { 50 | KillTimer(Spitter_Timer[client]); 51 | Spitter_Timer[client] = INVALID_HANDLE; 52 | } 53 | Spitter_Timer[client] = CreateTimer(10.0, Timer_Autokill, client); 54 | } 55 | 56 | return Plugin_Continue; 57 | } 58 | 59 | public Action:EventPlayerDeath(Handle:event, const String:name[], bool:dontBroadcast) 60 | { 61 | new client = GetClientOfUserId(GetEventInt(event, "userid")); 62 | 63 | if (Spitter_Timer[client] != INVALID_HANDLE) 64 | { 65 | KillTimer(Spitter_Timer[client]); 66 | Spitter_Timer[client] = INVALID_HANDLE; 67 | } 68 | 69 | return Plugin_Continue; 70 | } 71 | 72 | public Action:Timer_Autokill(Handle:timer, any:client) 73 | { 74 | if (!IsClientInGame(client)) 75 | { 76 | Spitter_Timer[client] = INVALID_HANDLE; 77 | return Plugin_Stop; 78 | } 79 | 80 | if (!IsPlayerAlive(client)) 81 | { 82 | Spitter_Timer[client] = INVALID_HANDLE; 83 | return Plugin_Stop; 84 | } 85 | 86 | if (IsSpitter(client)) 87 | { 88 | ForcePlayerSuicide(client); 89 | PrintHintText(client, "Autokill\nDo not hold Spitter!"); 90 | } 91 | 92 | Spitter_Timer[client] = INVALID_HANDLE; 93 | return Plugin_Stop; 94 | } 95 | 96 | public Action:Event_RoundEnd(Handle:event, const String:name[], bool:dontBroadcast) 97 | { 98 | for (new i = 1; i <= MaxClients; i++) 99 | { 100 | if (Spitter_Timer[i] != INVALID_HANDLE) 101 | { 102 | KillTimer(Spitter_Timer[i]); 103 | Spitter_Timer[i] = INVALID_HANDLE; 104 | } 105 | } 106 | } 107 | 108 | bool:IsSpitter(client) 109 | { 110 | return bool:(client > 0 && client <= MaxClients && !IsFakeClient(client) && GetClientTeam(client) == 3 && GetEntProp(client, Prop_Send, "m_zombieClass") == 4 && !(GetEntProp(client, Prop_Send, "m_isGhost") > 0)); 111 | } -------------------------------------------------------------------------------- /l4d_announce_spam/l4d_announce.txt: -------------------------------------------------------------------------------- 1 | "Games" 2 | { 3 | "left4dead2" 4 | { 5 | "Addresses" 6 | { 7 | "HitAnnouncement" 8 | { 9 | "windows" 10 | { 11 | "signature" "GasCanDestroy" 12 | "offset" "0x23" 13 | } 14 | } 15 | } 16 | "Functions" 17 | { 18 | "HitAnnouncement" 19 | { 20 | "signature" "HitAnnouncement" 21 | "callconv" "cdecl" 22 | "return" "bool" 23 | "this" "ignore" 24 | "arguments" 25 | { 26 | "a1" 27 | { 28 | "type" "objectptr" 29 | } 30 | } 31 | } 32 | } 33 | "Offsets" 34 | { 35 | "os" 36 | { 37 | "linux" "0" 38 | "windows" "1" 39 | } 40 | } 41 | "Signatures" 42 | { 43 | "HitAnnouncement" 44 | { 45 | "library" "server" 46 | "linux" "@_Z19ForEachTerrorPlayerI15HitAnnouncementEbRT_" 47 | } 48 | "GasCanDestroy" 49 | { 50 | "library" "server" 51 | "windows" "\x55\x8B\xEC\x83\xEC\x18\x33\xC0\x89\x45\xF4" 52 | } 53 | } 54 | } 55 | } -------------------------------------------------------------------------------- /l4d_announce_spam/l4d_announce_spam.sp: -------------------------------------------------------------------------------- 1 | #pragma semicolon 1 2 | #pragma newdecls required 3 | 4 | #include 5 | #include 6 | 7 | public Plugin myinfo = 8 | { 9 | name = "[L4D] Announce Spam", 10 | author = "Accelerator", 11 | description = "Reduce the spam of informational gaming messages", 12 | version = "1.0", 13 | url = "https://github.com/accelerator74/sp-plugins" 14 | }; 15 | 16 | public void OnPluginStart() 17 | { 18 | HookEvent("player_incapacitated", Event_DontBroadcast, EventHookMode_Pre); 19 | HookEvent("player_death", Event_DontBroadcast, EventHookMode_Pre); 20 | 21 | GameData hGameData = new GameData("l4d_announce"); 22 | if (hGameData == null) { 23 | SetFailState("Failed to load \"l4d_announce.txt\" gamedata."); 24 | } 25 | 26 | DynamicDetour detour; 27 | 28 | if (hGameData.GetOffset("os") == 1) // windows 29 | { 30 | Address addr = hGameData.GetAddress("HitAnnouncement"); 31 | if (addr == Address_Null) { 32 | SetFailState("Could not load the HitAnnouncement address"); 33 | } 34 | 35 | Address pRelativeOffset = LoadFromAddress(addr + view_as
(1), NumberType_Int32); 36 | Address pFunc = addr + view_as
(5) + pRelativeOffset; 37 | 38 | detour = new DynamicDetour(pFunc, CallConv_CDECL, ReturnType_Bool, ThisPointer_Ignore); 39 | detour.AddParam(HookParamType_ObjectPtr); 40 | } 41 | else 42 | { 43 | detour = DynamicDetour.FromConf(hGameData, "HitAnnouncement"); 44 | } 45 | 46 | if (!detour.Enable(Hook_Pre, HitAnnouncement)) { 47 | SetFailState("Failed to detour: HitAnnouncement"); 48 | } 49 | 50 | delete detour; 51 | delete hGameData; 52 | } 53 | 54 | MRESReturn HitAnnouncement(DHookReturn hReturn, DHookParam hParams) 55 | { 56 | int iMsgType = hParams.GetObjectVar(1, 0, ObjectValueType_Int); 57 | 58 | switch (iMsgType) 59 | { 60 | case 7, 9: { // AssistedAgainst, Hit 61 | int victim = hParams.GetObjectVar(1, 4, ObjectValueType_CBaseEntityPtr); 62 | int attacker = hParams.GetObjectVar(1, 8, ObjectValueType_CBaseEntityPtr); 63 | 64 | if (victim < 1 || attacker < 1) 65 | { 66 | return MRES_Ignored; 67 | } 68 | 69 | if (GetClientTeam(attacker) == 3) 70 | { 71 | float gmtime = GetEngineTime(); 72 | static float fMsgTime[33][33]; 73 | 74 | if (gmtime - fMsgTime[attacker][victim] >= 1.0) 75 | { 76 | fMsgTime[attacker][victim] = gmtime; 77 | return MRES_Ignored; 78 | } 79 | } 80 | else 81 | { 82 | if (iMsgType != 7) 83 | { 84 | return MRES_Ignored; 85 | } 86 | } 87 | } 88 | case 15, 18, 19: {} // Saved, Protected, Rescued 89 | default: return MRES_Ignored; 90 | } 91 | 92 | hReturn.Value = 0; 93 | return MRES_Supercede; 94 | } 95 | 96 | void Event_DontBroadcast(Event event, const char[] name, bool dontBroadcast) 97 | { 98 | int enemy = GetClientOfUserId(event.GetInt("attacker")); 99 | int target = GetClientOfUserId(event.GetInt("userid")); 100 | 101 | if (!target || !enemy) 102 | return; 103 | 104 | if (!IsFakeClient(target)) 105 | return; 106 | 107 | event.BroadcastDisabled = true; 108 | } 109 | -------------------------------------------------------------------------------- /l4d_counters/l4d_counters.sp: -------------------------------------------------------------------------------- 1 | #pragma semicolon 1 2 | 3 | #include 4 | #include 5 | 6 | #define PLUGIN_VERSION "1.2.0" 7 | 8 | #define MAX_LINE_WIDTH 64 9 | #define L4D_MAXPLAYERS 32 10 | #define TEAM_SPECTATORS 1 11 | #define TEAM_SURVIVORS 2 12 | #define TEAM_INFECTED 3 13 | #define MAX_TOP_PLAYERS 6 14 | 15 | new ZC_TANK = 5; 16 | 17 | new Handle:counters_show_frags = INVALID_HANDLE; 18 | new Handle:counters_show_tank_damage = INVALID_HANDLE; 19 | new Handle:counters_show_witch_damage = INVALID_HANDLE; 20 | new Handle:counters_show_tank_hp = INVALID_HANDLE; 21 | 22 | new Kills[L4D_MAXPLAYERS + 1]; 23 | new TankDamage[L4D_MAXPLAYERS + 1]; 24 | new WitchDamage[L4D_MAXPLAYERS + 1]; 25 | new bool:AllowPrints; 26 | new Time_TankSpawn; 27 | 28 | public Plugin:myinfo = 29 | { 30 | name = "Left 4 Dead 1,2 Counters", 31 | author = "Jonny, Accelerator", 32 | description = "Some counters here.", 33 | version = PLUGIN_VERSION, 34 | url = "" 35 | } 36 | 37 | public OnPluginStart() 38 | { 39 | counters_show_frags = CreateConVar("counters_show_frags", "1", "0 = disabled, 1 = normal (once per map), 2 = after each kill"); 40 | counters_show_witch_damage = CreateConVar("counters_show_witch_damage", "0", ""); 41 | counters_show_tank_damage = CreateConVar("counters_show_tank_damage", "1", ""); 42 | counters_show_tank_hp = CreateConVar("counters_show_tank_hp", "1", ""); 43 | HookEvent("round_start", Event_RoundStart); 44 | HookEvent("round_end", Event_RoundEnd); 45 | HookEvent("player_death", Event_PlayerDeath); 46 | HookEvent("player_incapacitated", Event_PlayerIncapacitated); 47 | HookEvent("player_hurt", Event_PlayerHurt); 48 | HookEvent("player_bot_replace", Event_Replace); 49 | HookEvent("bot_player_replace", Event_Replace); 50 | HookEvent("infected_hurt", Event_InfectedHurt, EventHookMode_Post); 51 | HookEvent("witch_killed", Event_WitchKilled, EventHookMode_Post); 52 | HookEvent("tank_frustrated", Event_TankFrustrated, EventHookMode_PostNoCopy); 53 | RegConsoleCmd("sm_frags", Command_Frags); 54 | 55 | decl String:moddir[24]; 56 | GetGameFolderName(moddir, sizeof(moddir)); 57 | if (StrEqual(moddir, "left4dead2", false)) 58 | { 59 | ZC_TANK = 8; 60 | } 61 | } 62 | 63 | public OnMapStart() 64 | { 65 | ClearKillsCounter(); 66 | ClearWitchDamageCounter(); 67 | ClearTankDamageCounter(); 68 | } 69 | 70 | public Action:Command_Frags(client, args) 71 | { 72 | PrintTotalFrags(client); 73 | } 74 | 75 | ClearKillsCounter() 76 | { 77 | for (new i = 0; i <= MaxClients; i++) 78 | { 79 | Kills[i] = 0; 80 | } 81 | } 82 | 83 | ClearWitchDamageCounter() 84 | { 85 | for (new i = 0; i <= MaxClients; i++) 86 | { 87 | WitchDamage[i] = 0; 88 | } 89 | } 90 | 91 | ClearTankDamageCounter() 92 | { 93 | for (new i = 0; i <= MaxClients; i++) 94 | { 95 | TankDamage[i] = 0; 96 | } 97 | } 98 | 99 | stock PrintTotalFrags(client = 0) 100 | { 101 | if (!AllowPrints) 102 | return; 103 | 104 | new String:Message[256]; 105 | new String:TempMessage[64]; 106 | Message = "Frags: "; 107 | new bool:more_than_one = false; 108 | 109 | new Fraggers = 0; 110 | new Kills2D[L4D_MAXPLAYERS + 1][2]; 111 | for (new i = 1; i <= MaxClients; i++) 112 | { 113 | Kills2D[i][0] = i; 114 | Kills2D[i][1] = 0; 115 | if (Kills[i] > 0) 116 | { 117 | if (IsClientInGame(i) && !IsFakeClient(i) && GetClientTeam(i) == TEAM_SURVIVORS) 118 | { 119 | Kills2D[i][1] = Kills[i]; 120 | Fraggers++; 121 | } 122 | } 123 | } 124 | SortCustom2D(Kills2D, MaxClients, Sort_Function); 125 | if (Fraggers > MAX_TOP_PLAYERS) Fraggers = MAX_TOP_PLAYERS; 126 | for (new i = 0; i < Fraggers; i++) 127 | { 128 | if (more_than_one) 129 | { 130 | FormatEx(TempMessage, sizeof(TempMessage), ", {blue}%N{default}: %d", Kills2D[i][0], Kills[Kills2D[i][0]]); 131 | } 132 | else 133 | { 134 | FormatEx(TempMessage, sizeof(TempMessage), "{blue}%N{default}: %d", Kills2D[i][0], Kills[Kills2D[i][0]]); 135 | } 136 | more_than_one = true; 137 | StrCat(Message, sizeof(Message), TempMessage); 138 | } 139 | if (Fraggers == 0) return; 140 | 141 | if (client > 0) 142 | CPrintToChat(client, Message); 143 | else 144 | { 145 | CPrintToChatAll(Message); 146 | ClearKillsCounter(); 147 | } 148 | } 149 | 150 | PrintTotalWitchDamage() 151 | { 152 | if (!AllowPrints) 153 | return; 154 | 155 | new String:Message[256]; 156 | new String:TempMessage[64]; 157 | Message = "{green}Witch{default} was killed by: "; 158 | new bool:more_than_one = false; 159 | 160 | new Fraggers = 0; 161 | new WitchDamage2D[L4D_MAXPLAYERS + 1][2]; 162 | for (new i = 1; i <= MaxClients; i++) 163 | { 164 | WitchDamage2D[i][0] = i; 165 | WitchDamage2D[i][1] = 0; 166 | if (WitchDamage[i] > 0) 167 | { 168 | if (IsClientInGame(i) && !IsFakeClient(i) && GetClientTeam(i) == TEAM_SURVIVORS) 169 | { 170 | WitchDamage2D[i][1] = WitchDamage[i]; 171 | Fraggers++; 172 | } 173 | } 174 | } 175 | SortCustom2D(WitchDamage2D, MaxClients, Sort_Function); 176 | if (Fraggers > MAX_TOP_PLAYERS) Fraggers = MAX_TOP_PLAYERS; 177 | for (new i = 0; i < Fraggers; i++) 178 | { 179 | if (more_than_one) 180 | { 181 | FormatEx(TempMessage, sizeof(TempMessage), ", {blue}%N{default}: %d", WitchDamage2D[i][0], WitchDamage[WitchDamage2D[i][0]]); 182 | } 183 | else 184 | { 185 | FormatEx(TempMessage, sizeof(TempMessage), "{blue}%N{default}: %d", WitchDamage2D[i][0], WitchDamage[WitchDamage2D[i][0]]); 186 | } 187 | more_than_one = true; 188 | StrCat(Message, sizeof(Message), TempMessage); 189 | } 190 | if (Fraggers == 0) return; 191 | CPrintToChatAll(Message); 192 | } 193 | 194 | PrintTotalTankDamage(mode) 195 | { 196 | if (!AllowPrints) 197 | return; 198 | 199 | new String:Message[256]; 200 | new String:TempMessage[64]; 201 | if (mode > 0) 202 | { 203 | Message = "{green}Tank(s){default} was killed by: "; 204 | } 205 | else 206 | { 207 | Message = "{green}Tank(s){default} was damaged by: "; 208 | 209 | } 210 | new bool:more_than_one = false; 211 | 212 | new Fraggers = 0; 213 | new TankDamage2D[L4D_MAXPLAYERS + 1][2]; 214 | for (new i = 1; i <= MaxClients; i++) 215 | { 216 | TankDamage2D[i][0] = i; 217 | TankDamage2D[i][1] = 0; 218 | if (TankDamage[i] > 0) 219 | { 220 | if (IsClientInGame(i) && !IsFakeClient(i) && GetClientTeam(i) == TEAM_SURVIVORS) 221 | { 222 | TankDamage2D[i][1] = TankDamage[i]; 223 | Fraggers++; 224 | } 225 | } 226 | } 227 | SortCustom2D(TankDamage2D, MaxClients, Sort_Function); 228 | if (Fraggers > MAX_TOP_PLAYERS) Fraggers = MAX_TOP_PLAYERS; 229 | for (new i = 0; i < Fraggers; i++) 230 | { 231 | if (more_than_one) 232 | { 233 | FormatEx(TempMessage, sizeof(TempMessage), ", {blue}%N{default}: %d", TankDamage2D[i][0], TankDamage[TankDamage2D[i][0]]); 234 | } 235 | else 236 | { 237 | FormatEx(TempMessage, sizeof(TempMessage), "{blue}%N{default}: %d", TankDamage2D[i][0], TankDamage[TankDamage2D[i][0]]); 238 | } 239 | more_than_one = true; 240 | StrCat(Message, sizeof(Message), TempMessage); 241 | } 242 | if (Fraggers == 0) return; 243 | CPrintToChatAll(Message); 244 | } 245 | 246 | public Event_RoundStart(Handle:hEvent, const String:strName[], bool:DontBroadcast) 247 | { 248 | ClearKillsCounter(); 249 | ClearWitchDamageCounter(); 250 | ClearTankDamageCounter(); 251 | AllowPrints = true; 252 | } 253 | 254 | public Event_RoundEnd(Handle:hEvent, const String:strName[], bool:DontBroadcast) 255 | { 256 | if (GetConVarInt(counters_show_frags) > 0) PrintTotalFrags(); 257 | AllowPrints = false; 258 | } 259 | 260 | public Event_TankFrustrated(Handle:event, const String:name[], bool:dontBroadcast) 261 | { 262 | Time_TankSpawn = GetTime(); 263 | } 264 | 265 | public Event_PlayerDeath(Handle:event, const String:name[], bool:dontBroadcast) 266 | { 267 | new client = GetClientOfUserId(GetEventInt(event, "userid")); 268 | new attacker = GetClientOfUserId(GetEventInt(event, "attacker")); 269 | if (!IsValidClient(client)) return; 270 | if (client) 271 | { 272 | if (IsTank(client)) 273 | { 274 | TankKilled(client, attacker); 275 | return; 276 | } 277 | } 278 | if (IsValidClient(attacker) && GetClientTeam(attacker) == TEAM_SURVIVORS) 279 | { 280 | Kills[attacker]++; 281 | if (GetConVarInt(counters_show_frags) > 1 && attacker != client) 282 | { 283 | PrintCenterText(attacker, "%d", Kills[attacker]); 284 | } 285 | } 286 | if (!IsPlayersAlive()) 287 | { 288 | if (!AllowPrints) 289 | return; 290 | 291 | decl String:sHealth[64]; 292 | if (GetTankHP(sHealth, sizeof(sHealth)) > 0) 293 | { 294 | CPrintToChatAll("{red}Tank(s){default} had {olive}%s{default} health remaining!", sHealth); 295 | PrintTotalTankDamage(0); 296 | ClearTankDamageCounter(); 297 | } 298 | if (GetConVarInt(counters_show_frags) > 0) PrintTotalFrags(); 299 | AllowPrints = false; 300 | } 301 | } 302 | 303 | public Event_PlayerIncapacitated(Handle:event, const String:name[], bool:dontBroadcast) 304 | { 305 | if (!IsPlayersAlive()) 306 | { 307 | if (!AllowPrints) 308 | return; 309 | 310 | if (GetConVarInt(counters_show_tank_hp) > 0) 311 | { 312 | decl String:sHealth[64]; 313 | if (GetTankHP(sHealth, sizeof(sHealth)) > 0) 314 | { 315 | CPrintToChatAll("{red}Tank(s){default} had {olive}%s{default} health remaining!", sHealth); 316 | PrintTotalTankDamage(0); 317 | ClearTankDamageCounter(); 318 | } 319 | } 320 | if (GetConVarInt(counters_show_frags) > 0) PrintTotalFrags(); 321 | AllowPrints = false; 322 | } 323 | } 324 | 325 | public Event_PlayerHurt(Handle:event, const String:name[], bool:dontBroadcast) 326 | { 327 | new enemy = GetClientOfUserId(GetEventInt(event, "attacker")); 328 | new target = GetClientOfUserId(GetEventInt(event, "userid")); 329 | if (!IsValidClient(target)) return; 330 | if (GetConVarInt(counters_show_tank_damage) > 0 && IsTank(target)) 331 | { 332 | if (IsValidClient(enemy) && !IsIncapacitated(target)) 333 | { 334 | TankDamage[enemy] += GetEventInt(event, "dmg_health"); 335 | TankDamage[0] = GetClientHealth(target); 336 | } 337 | } 338 | } 339 | 340 | public Event_Replace(Handle:event, const String:name[], bool:dontBroadcast) 341 | { 342 | new player = GetClientOfUserId(GetEventInt(event, "player")); 343 | new bot = GetClientOfUserId(GetEventInt(event, "bot")); 344 | Kills[player] = 0; 345 | Kills[bot] = 0; 346 | TankDamage[player] = 0; 347 | TankDamage[bot] = 0; 348 | WitchDamage[player] = 0; 349 | WitchDamage[bot] = 0; 350 | } 351 | 352 | public Event_InfectedHurt(Handle:event, const String:name[], bool:dontBroadcast) 353 | { 354 | new entityid = GetEventInt(event, "entityid"); 355 | decl String:class_name[128]; 356 | GetEdictClassname(entityid, class_name, sizeof(class_name)); 357 | if (!StrEqual(class_name, "witch", false)) return; 358 | new attacker = GetClientOfUserId(GetEventInt(event, "attacker")); 359 | if (!IsValidClient(attacker)) return; 360 | WitchDamage[attacker] += GetEventInt(event, "amount"); 361 | WitchDamage[0] = GetEntityHealth(entityid); 362 | } 363 | 364 | public Event_WitchKilled(Handle:event, const String:name[], bool:dontBroadcast) 365 | { 366 | if (GetConVarInt(counters_show_witch_damage) < 1) return; 367 | new userid = GetClientOfUserId(GetEventInt(event, "userid")); 368 | WitchDamage[userid] += WitchDamage[0]; 369 | PrintTotalWitchDamage(); 370 | ClearWitchDamageCounter(); 371 | } 372 | 373 | public TankKilled(client, attacker) 374 | { 375 | if (GetConVarInt(counters_show_tank_damage) < 1) return; 376 | if (GetTankHP() > 0) return; 377 | if (Time_TankSpawn + 5 > GetTime()) return; 378 | TankDamage[attacker] += TankDamage[0]; 379 | PrintTotalTankDamage(1); 380 | ClearTankDamageCounter(); 381 | } 382 | 383 | bool:IsValidClient(client) 384 | { 385 | if (client < 1 || client > MaxClients) return false; 386 | if (!IsValidEntity(client)) return false; 387 | return true; 388 | } 389 | 390 | bool:IsTank(client) 391 | { 392 | if (GetClientTeam(client) == TEAM_INFECTED && GetEntProp(client, Prop_Send, "m_zombieClass") == ZC_TANK) 393 | return true; 394 | 395 | return false; 396 | } 397 | 398 | bool:IsIncapacitated(client) 399 | { 400 | new isIncap = GetEntProp(client, Prop_Send, "m_isIncapacitated", 1); 401 | if (isIncap) return true; 402 | return false; 403 | } 404 | 405 | bool:IsPlayersAlive() 406 | { 407 | for (new i = 1; i <= MaxClients; i++) 408 | { 409 | if (IsClientInGame(i) && GetClientTeam(i) == TEAM_SURVIVORS && IsPlayerAlive(i) && !IsIncapacitated(i)) return true; 410 | } 411 | return false; 412 | } 413 | 414 | stock GetTankHP(String:sHealth[] = "", maxlen = 0) 415 | { 416 | new iReturn = 0; 417 | new bool:more_than_one = false; 418 | 419 | for (new i = 1; i <= MaxClients; i++) 420 | { 421 | if (IsClientConnected(i) && IsClientInGame(i)) 422 | { 423 | if (IsTank(i) && IsPlayerAlive(i)) 424 | { 425 | if (IsIncapacitated(i)) continue; 426 | if (maxlen > 0) 427 | { 428 | if (more_than_one) 429 | { 430 | Format(sHealth, maxlen, "%s, {olive}%i{default}", sHealth, GetClientHealth(i)); 431 | } 432 | else 433 | { 434 | FormatEx(sHealth, maxlen, "{olive}%i{default}", GetClientHealth(i)); 435 | } 436 | } 437 | more_than_one = true; 438 | iReturn = 1; 439 | } 440 | } 441 | } 442 | return iReturn; 443 | } 444 | 445 | public Sort_Function(array1[], array2[], const completearray[][], Handle:hndl) 446 | { 447 | //sort function for our crown array 448 | if (array1[1] > array2[1]) return -1; 449 | if (array1[1] == array2[1]) return 0; 450 | return 1; 451 | } 452 | 453 | public GetEntityHealth(client) 454 | { 455 | return GetEntProp(client, Prop_Data, "m_iHealth"); 456 | } -------------------------------------------------------------------------------- /l4d_drop/l4d_drop.sp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | public Plugin myinfo = 6 | { 7 | name = "[L4D2] Weapon Drop !drop", 8 | author = "Accelerator", 9 | description = "", 10 | version = "1.0", 11 | url = "https://github.com/accelerator74/sp-plugins" 12 | }; 13 | 14 | public void OnPluginStart() 15 | { 16 | RegConsoleCmd("sm_drop", Command_Drop); 17 | } 18 | 19 | public Action Command_Drop(int client, int args) 20 | { 21 | if (!client || !IsClientInGame(client) || GetClientTeam(client) != 2 || !IsPlayerAlive(client)) 22 | return Plugin_Handled; 23 | 24 | int PlayerWeaponSlot1 = GetPlayerWeaponSlot(client, 0); 25 | 26 | if (PlayerWeaponSlot1 > 0) 27 | { 28 | char weapon[32]; 29 | GetEdictClassname(PlayerWeaponSlot1, weapon, sizeof(weapon)); 30 | 31 | int ammo; 32 | int ammoOffset = FindSendPropInfo("CTerrorPlayer", "m_iAmmo"); 33 | if (StrEqual(weapon, "weapon_rifle") || StrEqual(weapon, "weapon_rifle_sg552") || StrEqual(weapon, "weapon_rifle_desert") || StrEqual(weapon, "weapon_rifle_ak47")) 34 | { 35 | ammo = GetEntData(client, ammoOffset+(12)); 36 | SetEntData(client, ammoOffset+(12), 0); 37 | } 38 | else if (StrEqual(weapon, "weapon_smg") || StrEqual(weapon, "weapon_smg_silenced") || StrEqual(weapon, "weapon_smg_mp5")) 39 | { 40 | ammo = GetEntData(client, ammoOffset+(20)); 41 | SetEntData(client, ammoOffset+(20), 0); 42 | } 43 | else if (StrEqual(weapon, "weapon_pumpshotgun") || StrEqual(weapon, "weapon_shotgun_chrome")) 44 | { 45 | ammo = GetEntData(client, ammoOffset+(28)); 46 | SetEntData(client, ammoOffset+(28), 0); 47 | } 48 | else if (StrEqual(weapon, "weapon_autoshotgun") || StrEqual(weapon, "weapon_shotgun_spas")) 49 | { 50 | ammo = GetEntData(client, ammoOffset+(32)); 51 | SetEntData(client, ammoOffset+(32), 0); 52 | } 53 | else if (StrEqual(weapon, "weapon_hunting_rifle")) 54 | { 55 | ammo = GetEntData(client, ammoOffset+(36)); 56 | SetEntData(client, ammoOffset+(36), 0); 57 | } 58 | else if (StrEqual(weapon, "weapon_sniper_scout") || StrEqual(weapon, "weapon_sniper_military") || StrEqual(weapon, "weapon_sniper_awp")) 59 | { 60 | ammo = GetEntData(client, ammoOffset+(40)); 61 | SetEntData(client, ammoOffset+(40), 0); 62 | } 63 | else if (StrEqual(weapon, "weapon_grenade_launcher")) 64 | { 65 | ammo = GetEntData(client, ammoOffset+(68)); 66 | SetEntData(client, ammoOffset+(68), 0); 67 | } 68 | 69 | SDKHooks_DropWeapon(client, PlayerWeaponSlot1); 70 | SetEntProp(PlayerWeaponSlot1, Prop_Send, "m_iExtraPrimaryAmmo", ammo); 71 | } 72 | 73 | return Plugin_Continue; 74 | } -------------------------------------------------------------------------------- /l4d_remove_weapons/l4d_remove_weapons.sp: -------------------------------------------------------------------------------- 1 | #pragma semicolon 1 2 | #pragma newdecls required 3 | 4 | #include 5 | #include 6 | 7 | #define MAX_LINE_WIDTH 32 8 | 9 | #define CLEAR_SPAWNS 0 10 | 11 | #if CLEAR_SPAWNS 12 | #include 13 | 14 | static const char sWeaponSpawns[][] = { 15 | "weapon_smg_silenced_spawn", 16 | "weapon_rifle_m60_spawn", 17 | "weapon_rifle_ak47_spawn", 18 | "weapon_rifle_spawn", 19 | "weapon_rifle_desert_spawn", 20 | "weapon_autoshotgun_spawn", 21 | "weapon_shotgun_spas_spawn", 22 | "weapon_hunting_rifle_spawn", 23 | "weapon_sniper_military_spawn", 24 | "weapon_shotgun_chrome_spawn", 25 | "weapon_smg_spawn", 26 | "weapon_grenade_launcher_spawn", 27 | "weapon_pumpshotgun_spawn", 28 | "weapon_chainsaw_spawn", 29 | "weapon_upgradepack_explosive_spawn", 30 | "weapon_upgradepack_incendiary_spawn", 31 | "weapon_pain_pills_spawn", 32 | "weapon_adrenaline_spawn", 33 | "weapon_defibrillator_spawn", 34 | "weapon_vomitjar_spawn", 35 | "weapon_pipe_bomb_spawn", 36 | "weapon_molotov_spawn", 37 | "weapon_spawn", 38 | "weapon_melee_spawn", 39 | "weapon_first_aid_kit_spawn" 40 | }; 41 | #endif 42 | static const char sWeaponTmp[][] = { 43 | "weapon_pain_pills", 44 | "weapon_adrenaline", 45 | "weapon_pistol", 46 | "weapon_pistol_magnum", 47 | "weapon_smg", 48 | "weapon_smg_mp5", 49 | "weapon_smg_silenced", 50 | "weapon_pumpshotgun", 51 | "weapon_shotgun_chrome", 52 | "weapon_sniper_military", 53 | "weapon_hunting_rifle", 54 | "weapon_rifle", 55 | "weapon_rifle_desert", 56 | "weapon_rifle_sg552", 57 | "weapon_pipe_bomb", 58 | "weapon_molotov", 59 | "weapon_vomitjar", 60 | "weapon_upgradepack_explosive", 61 | "weapon_upgradepack_incendiary", 62 | "weapon_autoshotgun" 63 | }; 64 | 65 | static const int iWeaponTmpTime[] = { 66 | 300, // pain_pills 67 | 300, // adrenaline 68 | 120, // pistol 69 | 300, // pistol_magnum 70 | 120, // smg 71 | 120, // smg_mp5 72 | 120, // smg_silenced 73 | 120, // pumpshotgun 74 | 120, // shotgun_chrome 75 | 180, // sniper_military 76 | 150, // hunting_rifle 77 | 120, // rifle 78 | 180, // rifle_desert 79 | 300, // rifle_sg552 80 | 240, // pipe_bomb 81 | 240, // molotov 82 | 240, // vomitjar 83 | 180, // upgradepack_explosive 84 | 180, // upgradepack_incendiary 85 | 180 // autoshotgun 86 | }; 87 | 88 | ArrayList hWeaponClassList; 89 | 90 | public Plugin myinfo = 91 | { 92 | name = "[L4D] Remove Weapons", 93 | author = "Accelerator", 94 | description = "Remove weapon spawn and clean unused weapons", 95 | version = "1.3", 96 | url = "https://github.com/accelerator74/sp-plugins" 97 | }; 98 | 99 | public void OnPluginStart() 100 | { 101 | #if CLEAR_SPAWNS 102 | HookEvent("round_start", Event_RoundStart, EventHookMode_PostNoCopy); 103 | #endif 104 | HookEvent("weapon_drop", Event_WeaponDrop); 105 | 106 | for (int i = 1; i <= MaxClients; i++) 107 | { 108 | if (IsClientInGame(i)) 109 | OnClientPutInServer(i); 110 | } 111 | 112 | hWeaponClassList = new ArrayList(ByteCountToCells(64)); 113 | 114 | for (int i = 0; i < sizeof(sWeaponTmp); i++) 115 | { 116 | hWeaponClassList.PushString(sWeaponTmp[i]); 117 | } 118 | } 119 | 120 | public void OnMapStart() 121 | { 122 | CreateTimer(20.0, Cleaner, _, TIMER_REPEAT|TIMER_FLAG_NO_MAPCHANGE); 123 | } 124 | 125 | public void OnClientPutInServer(int client) 126 | { 127 | SDKHook(client, SDKHook_WeaponEquipPost, OnClientWeaponEquip); 128 | } 129 | 130 | public void OnEntityCreated(int entity, const char[] classname) 131 | { 132 | if (classname[0] == 'w' && !strncmp(classname, "weapon_", 7)) 133 | { 134 | if (!IsServerProcessing()) return; 135 | if (hWeaponClassList.FindString(classname) != -1) 136 | { 137 | SetEntPropFloat(entity, Prop_Send, "m_flCreateTime", (GetGameTime()+10.0)); 138 | } 139 | } 140 | } 141 | 142 | void OnClientWeaponEquip(int client, int weapon) 143 | { 144 | if (weapon > 0) 145 | { 146 | if (GetClientTeam(client) == 2) 147 | { 148 | char classname[MAX_LINE_WIDTH+1]; 149 | GetEdictClassname(weapon, classname, MAX_LINE_WIDTH); 150 | 151 | if (hWeaponClassList.FindString(classname) != -1) 152 | { 153 | SetEntPropFloat(weapon, Prop_Send, "m_flCreateTime", 0.0); 154 | } 155 | } 156 | } 157 | } 158 | 159 | Action Cleaner(Handle timer) 160 | { 161 | if (!IsServerProcessing()) 162 | return Plugin_Continue; 163 | 164 | float GameTime = GetGameTime(); 165 | char classname[MAX_LINE_WIDTH+1]; 166 | int index; 167 | float CreateTime; 168 | 169 | for (int i = MaxClients + 1; i <= 2048; i++) 170 | { 171 | if (IsValidEdict(i)) 172 | { 173 | GetEdictClassname(i, classname, MAX_LINE_WIDTH); 174 | 175 | if (!strncmp(classname, "weapon_", 7)) 176 | { 177 | index = hWeaponClassList.FindString(classname); 178 | 179 | if (index != -1) 180 | { 181 | CreateTime = GetEntPropFloat(i, Prop_Send, "m_flCreateTime"); 182 | 183 | if (CreateTime > 0.0) 184 | { 185 | if ((GameTime - CreateTime) >= (iWeaponTmpTime[index] - 1.0)) 186 | RemoveEntity(i); 187 | } 188 | } 189 | } 190 | } 191 | } 192 | 193 | return Plugin_Continue; 194 | } 195 | 196 | void Event_WeaponDrop(Event hEvent, const char[] strName, bool DontBroadcast) 197 | { 198 | int weapon = hEvent.GetInt("propid"); 199 | 200 | if (weapon > 0) 201 | { 202 | char classname[MAX_LINE_WIDTH+1]; 203 | GetEdictClassname(weapon, classname, MAX_LINE_WIDTH); 204 | 205 | if (hWeaponClassList.FindString(classname) != -1) 206 | { 207 | SetEntPropFloat(weapon, Prop_Send, "m_flCreateTime", GetGameTime()); 208 | } 209 | } 210 | } 211 | #if CLEAR_SPAWNS 212 | void Event_RoundStart(Event hEvent, const char[] strName, bool DontBroadcast) 213 | { 214 | CreateTimer(0.2, ClearSpawns, _, TIMER_FLAG_NO_MAPCHANGE); 215 | CreateTimer(10.0, ClearSpawns, _, TIMER_FLAG_NO_MAPCHANGE); 216 | } 217 | 218 | Action ClearSpawns(Handle timer) 219 | { 220 | int Entity = -1; 221 | int iCount = 0; 222 | for (int i = 0; i < sizeof(sWeaponSpawns); i++) 223 | { 224 | Entity = -1; 225 | while((Entity = FindEntityByClassname(Entity, sWeaponSpawns[i])) != -1) 226 | { 227 | RemoveEntity(Entity); 228 | iCount++; 229 | } 230 | } 231 | if (iCount) PrintToServer("Clear %i weapon spawns", iCount); 232 | return Plugin_Stop; 233 | } 234 | #endif 235 | -------------------------------------------------------------------------------- /l4d_tanknoblock/l4d_tanknoblock.sp: -------------------------------------------------------------------------------- 1 | #pragma semicolon 1 2 | #pragma newdecls required 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | #define CHECK_RADIUS 50.0 9 | 10 | float fg_xyz[33][5]; 11 | bool fg_active[33]; 12 | int g_VelModifierOffset = -1; 13 | 14 | public Plugin myinfo = 15 | { 16 | name = "[L4D] Tank No Block", 17 | author = "Accelerator & TY", 18 | description = "Fix stupid AI Tank", 19 | version = "4.2", 20 | url = "https://github.com/accelerator74/sp-plugins" 21 | }; 22 | 23 | public void OnPluginStart() 24 | { 25 | g_VelModifierOffset = FindSendPropInfo("CCSPlayer", "m_flVelocityModifier"); 26 | if (g_VelModifierOffset == -1) 27 | { 28 | LogError("\"CCSPlayer::m_flVelocityModifier\" could not be found."); 29 | SetFailState("\"CCSPlayer::m_flVelocityModifier\" could not be found."); 30 | } 31 | 32 | HookEvent("tank_spawn", Event_TankSpawn); 33 | HookEvent("ability_use", Ability_Use); 34 | } 35 | 36 | Action TyTimerConnected(Handle timer, int client) 37 | { 38 | if (IsTank(client)) 39 | { 40 | if (fg_active[client] && fg_xyz[client][4] < GetGameTime()) 41 | { 42 | float fCxyz[3]; 43 | GetClientAbsOrigin(client, fCxyz); 44 | float fx3 = fg_xyz[client][0] - fCxyz[0]; 45 | float fy3 = fg_xyz[client][1] - fCxyz[1]; 46 | float fz3 = fg_xyz[client][2] - fCxyz[2]; 47 | 48 | int iStuck = 0; 49 | float fRd1 = fg_xyz[client][3] + CHECK_RADIUS - 1.0; 50 | float fRd2 = - fRd1; 51 | 52 | fg_xyz[client][0] = fCxyz[0]; 53 | fg_xyz[client][1] = fCxyz[1]; 54 | fg_xyz[client][2] = fCxyz[2]; 55 | 56 | if (fx3 > fRd2 && fx3 < fRd1) 57 | { 58 | if (fy3 > fRd2 && fy3 < fRd1) 59 | { 60 | if (fz3 > - CHECK_RADIUS && fz3 < CHECK_RADIUS) 61 | { 62 | iStuck = 1; 63 | fg_xyz[client][3] += 1.0; 64 | 65 | if (GetEntityMoveType(client) == MOVETYPE_LADDER) 66 | { 67 | fCxyz[2] += 80.0; 68 | TeleportEntity(client, fCxyz, NULL_VECTOR, NULL_VECTOR); 69 | } 70 | else 71 | { 72 | if (fg_xyz[client][3] > 8) 73 | { 74 | float pos[3]; 75 | GetNearestClientPosition(client, pos); 76 | 77 | if (pos[0] != 0.0 && pos[1] != 0.0 && pos[2] != 0.0) 78 | { 79 | TeleportEntity(client, pos, NULL_VECTOR, NULL_VECTOR); 80 | iStuck = 0; 81 | } 82 | } 83 | else if (fg_xyz[client][3] > 1) 84 | { 85 | float vel[3]; 86 | GetEntPropVector(client, Prop_Data, "m_vecVelocity", vel); 87 | vel[2] = 600.0; 88 | TeleportEntity(client, NULL_VECTOR, NULL_VECTOR, vel); 89 | } 90 | } 91 | } 92 | } 93 | } 94 | if (!iStuck) 95 | { 96 | fg_xyz[client][3] = 0.0; 97 | } 98 | } 99 | return Plugin_Continue; 100 | } 101 | return Plugin_Stop; 102 | } 103 | 104 | void OnTakeDamagePost(int client, int attacker, int inflictor, float damage, int damagetype) 105 | { 106 | if (damage > 0.0) 107 | { 108 | if (IsTank(client)) 109 | { 110 | if (!fg_active[client] && attacker > 0 && attacker <= MaxClients) 111 | { 112 | if (GetClientTeam(attacker) == 2) 113 | fg_active[client] = true; 114 | } 115 | 116 | SetEntDataFloat(client, g_VelModifierOffset, 1.0, true); 117 | } 118 | } 119 | } 120 | 121 | void Event_TankSpawn(Event event, const char [] name, bool dontBroadcast) 122 | { 123 | int iUserid = GetClientOfUserId(GetEventInt(event, "userid")); 124 | if (iUserid && IsFakeClient(iUserid)) 125 | { 126 | fg_xyz[iUserid][3] = 0.0; 127 | fg_active[iUserid] = false; 128 | SDKHook(iUserid, SDKHook_OnTakeDamagePost, OnTakeDamagePost); 129 | CreateTimer(2.0, TyTimerConnected, iUserid, TIMER_REPEAT|TIMER_FLAG_NO_MAPCHANGE); 130 | } 131 | } 132 | 133 | void Ability_Use(Event event, const char[] event_name, bool dontBroadcast) 134 | { 135 | int client = GetClientOfUserId(event.GetInt("userid")); 136 | 137 | if (IsTank(client)) 138 | { 139 | fg_xyz[client][4] = GetGameTime() + 3.0; 140 | } 141 | } 142 | 143 | void GetNearestClientPosition(int tank, float position[3]) 144 | { 145 | float dist, min_dist = 999.0, pos[2][3]; 146 | 147 | GetClientAbsOrigin(tank, pos[0]); 148 | 149 | for (int i = 1; i <= MaxClients; i++) 150 | { 151 | if (IsClientInGame(i) && IsPlayerAlive(i)) 152 | { 153 | if(GetClientTeam(i) == 2) 154 | { 155 | GetClientAbsOrigin(i, pos[1]); 156 | 157 | dist = GetVectorDistance(pos[0], pos[1]); 158 | if (dist < min_dist) 159 | { 160 | min_dist = dist; 161 | position = pos[1]; 162 | } 163 | } 164 | } 165 | } 166 | } 167 | 168 | bool IsTank(int client) 169 | { 170 | static int iZC_offs = -1; 171 | if (iZC_offs == -1) 172 | { 173 | iZC_offs = FindSendPropInfo("CTerrorPlayer", "m_zombieClass"); 174 | } 175 | if (client > 0 && client <= MaxClients && IsClientInGame(client) && IsFakeClient(client) && GetClientTeam(client) == 3 && IsPlayerAlive(client)) 176 | { 177 | if (GetEntData(client, iZC_offs) == 8) 178 | return true; 179 | } 180 | return false; 181 | } -------------------------------------------------------------------------------- /l4fix/l4fix.txt: -------------------------------------------------------------------------------- 1 | "Games" 2 | { 3 | "left4dead2" 4 | { 5 | "Addresses" 6 | { 7 | "CCharge::HandleCustomCollision" 8 | { 9 | "signature" "CCharge::HandleCustomCollision" 10 | } 11 | "WitchAttack::OnMoveToFailure" 12 | { 13 | "signature" "WitchAttack::OnMoveToFailure" 14 | } 15 | "WitchAttack::GetVictim" 16 | { 17 | "signature" "WitchAttack::GetVictim" 18 | } 19 | "WitchAttack::OnStart" 20 | { 21 | "signature" "WitchAttack::OnStart" 22 | } 23 | "WitchAttack::OnAnimationEvent" 24 | { 25 | "signature" "WitchAttack::OnAnimationEvent" 26 | } 27 | "WitchAttack::Update" 28 | { 29 | "signature" "WitchAttack::Update" 30 | } 31 | } 32 | "Offsets" 33 | { 34 | "CCharge::HandleCustomCollision" 35 | { 36 | "linux" "333" //0x01 37 | "windows" "305" //0x01 38 | } 39 | "WitchAttack::OnMoveToFailure_1" 40 | { 41 | "linux" "19" //0x74 42 | "windows" "9" //0x74 43 | } 44 | "WitchAttack::OnMoveToFailure_2" 45 | { 46 | "linux" "24" //0x75 47 | "windows" "14" //0x75 48 | } 49 | "WitchAttack::GetVictim" 50 | { 51 | "linux" "12" //0x74 --> 0xEB 52 | "windows" "6" //0x75 --> 0x90 53 | } 54 | "WitchAttack::OnStart" 55 | { 56 | "windows" "76" //0x75 --> 0x90 57 | } 58 | "WitchAttack::OnAnimationEvent" 59 | { 60 | "windows" "17" //0x75 --> 0x90 61 | } 62 | "WitchAttack::Update" 63 | { 64 | "windows" "60" //0x75 --> 0x90 65 | } 66 | "CInferno::m_maxFlames" 67 | { 68 | "windows" "2960" 69 | "linux" "2980" 70 | } 71 | } 72 | "Signatures" 73 | { 74 | "CCharge::HandleCustomCollision" 75 | { 76 | /*Credit silvers sig*/ 77 | "library" "server" 78 | "linux" "@_ZN7CCharge21HandleCustomCollisionEP11CBaseEntityRK6VectorS4_P10CGameTraceP9CMoveData" 79 | "windows" "\x2A\x2A\x2A\x2A\x2A\x2A\x2A\x2A\x2A\x2A\x2A\x2A\x2A\x2A\x33\x2A\x89\x2A\x2A\x8B\x2A\x2A\x53\x8B\x2A\x89\x2A\x2A\x8B\x2A\x2A\x2A\x2A\x2A\x56\x8B" 80 | /* ? ? ? ? ? ? ? ? ? ? ? ? ? ? 33 ? 89 ? ? 8B ? ? 53 8B ? 89 ? ? 8B ? ? ? ? ? 56 8B */ 81 | } 82 | "WitchAttack::OnMoveToFailure" 83 | { 84 | "library" "server" 85 | "linux" "@_ZN11WitchAttack15OnMoveToFailureEP8InfectedPK4Path17MoveToFailureType" 86 | "windows" "\x55\x8B\xEC\x8B\x45\x14\x83\xE8\x00" 87 | /* 55 8B EC 8B 45 14 83 E8 00 */ 88 | } 89 | "WitchAttack::GetVictim" 90 | { 91 | /* WitchAttack::OnContact Location in win&nix*/ 92 | "library" "server" 93 | "linux" "@_ZNK11WitchAttack9GetVictimEv" 94 | "windows" "\x2A\x2A\x2A\x2A\x2A\x2A\x75\x2A\x8B\x2A\x2A\x83\x2A\x2A\x74\x2A\x8B\x15\x2A\x2A\x2A\x2A\x8B\x2A\x81\xE1\x2A\x2A\x2A\x2A\x03\x2A\x8D\x2A\x2A\x2A\x85\x2A\x74\x2A\xC1\x2A\x2A\x39\x2A\x2A\x75\x2A\x8B\x2A\xC3" 95 | /* ? ? ? ? ? ? 75 ? 8B ? ? 83 ? ? 74 ? 8B 15 ? ? ? ? 8B ? 81 E1 ? ? ? ? 03 ? 8D ? ? ? 85 ? 74 ? C1 ? ? 39 ? ? 75 ? 8B ? C3 */ 96 | } 97 | "WitchAttack::OnStart" 98 | { 99 | "library" "server" 100 | "windows" "\x2A\x2A\x2A\x2A\x2A\x2A\x8B\x15\x2A\x2A\x2A\x2A\x53\x56\x57\x8B\x2A\x2A\x8B\x87" 101 | /* ? ? ? ? ? ? 8B 15 ? ? ? ? 53 56 57 8B ? ? 8B 87 */ 102 | } 103 | "WitchAttack::OnAnimationEvent" 104 | { 105 | "library" "server" 106 | "windows" "\x2A\x2A\x2A\x2A\x2A\x2A\x83\x2A\x2A\x75\x2A\x8B\x2A\x2A\x83\x2A\x2A\x75\x2A\x8B\x2A\x2A\x83" 107 | /* ? ? ? ? ? ? 83 ? ? 75 ? 8B ? ? 83 ? ? 75 ? 8B ? ? 83 */ 108 | } 109 | "WitchAttack::Update" 110 | { 111 | "library" "server" 112 | "windows" "\x2A\x2A\x2A\x2A\x2A\x2A\x53\x56\x57\x8B\x2A\x2A\x8B\x87\x2A\x2A\x2A\x2A\x8B\x90\x2A\x2A\x2A\x2A\x81\xC7" 113 | /* ? ? ? ? ? ? 53 56 57 8B ? ? 8B 87 ? ? ? ? 8B 90 ? ? ? ? 81 C7 */ 114 | } 115 | } 116 | } 117 | } 118 | -------------------------------------------------------------------------------- /selfMute/selfMute.sp: -------------------------------------------------------------------------------- 1 | #pragma semicolon 1 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | #define PLUGIN_VERSION "3.0" 8 | 9 | int g_MuteList[MAXPLAYERS+1][MAXPLAYERS+1]; 10 | 11 | public Plugin myinfo = 12 | { 13 | name = "Self-Mute", 14 | author = "Accelerator, Otokiru ,edit 93x", 15 | description = "Self Mute Player Voice", 16 | version = PLUGIN_VERSION, 17 | url = "www.xose.net" 18 | } 19 | 20 | //==================================================================================================== 21 | //==== CREDITS: Otokiru (Idea+Source) // TF2MOTDBackpack (PlayerList Menu) 22 | //==================================================================================================== 23 | 24 | public void OnPluginStart() 25 | { 26 | LoadTranslations("common.phrases"); 27 | CreateConVar("sm_selfmute_version", PLUGIN_VERSION, "Version of Self-Mute", FCVAR_SPONLY|FCVAR_REPLICATED|FCVAR_NOTIFY); 28 | RegConsoleCmd("sm_sm", selfMute, "Mute player by typing !selfmute [playername]"); 29 | RegConsoleCmd("sm_selfmute", selfMute, "Mute player by typing !sm [playername]"); 30 | RegConsoleCmd("sm_su", selfUnmute, "Unmute player by typing !su [playername]"); 31 | RegConsoleCmd("sm_selfunmute", selfUnmute, "Unmute player by typing !selfunmute [playername]"); 32 | RegConsoleCmd("sm_cm", checkmute, "Check who you have self-muted"); 33 | RegConsoleCmd("sm_checkmute", checkmute, "Check who you have self-muted"); 34 | } 35 | 36 | //==================================================================================================== 37 | 38 | public void OnClientAuthorized(int client, const char[] auth) 39 | { 40 | if (!StrEqual(auth, "BOT")) 41 | { 42 | if (GetClientTime(client) > 10.0) 43 | return; 44 | } 45 | 46 | for (int i = 1; i <= MaxClients; i++) 47 | g_MuteList[client][i] = 0; 48 | } 49 | 50 | public void OnClientPutInServer(int client) 51 | { 52 | if (!IsFakeClient(client)) 53 | { 54 | for (int id = 1; id <= MaxClients; id++) 55 | { 56 | if (id == client) continue; 57 | 58 | if (g_MuteList[client][id] && IsClientConnected(id)) 59 | { 60 | if (g_MuteList[client][id] == GetClientUserId(id)) 61 | SetListenOverride(client, id, Listen_No); 62 | else 63 | g_MuteList[client][id] = 0; 64 | } 65 | } 66 | } 67 | } 68 | 69 | //==================================================================================================== 70 | 71 | Action selfMute(int client, int args) 72 | { 73 | if(client == 0) 74 | { 75 | PrintToChat(client, "[SM] Cannot use command from RCON"); 76 | return Plugin_Handled; 77 | } 78 | 79 | if(args < 1) 80 | { 81 | ReplyToCommand(client, "[SM] Use: !sm [playername]"); 82 | DisplayMuteMenu(client); 83 | return Plugin_Handled; 84 | } 85 | 86 | char strTarget[32]; 87 | GetCmdArg(1, strTarget, sizeof(strTarget)); 88 | 89 | char strTargetName[MAX_TARGET_LENGTH]; 90 | int TargetList[MAXPLAYERS], TargetCount; 91 | bool TargetTranslate; 92 | 93 | if ((TargetCount = ProcessTargetString(strTarget, 0, TargetList, MAXPLAYERS, COMMAND_FILTER_CONNECTED|COMMAND_FILTER_NO_MULTI|COMMAND_FILTER_NO_BOTS, 94 | strTargetName, sizeof(strTargetName), TargetTranslate)) <= 0) 95 | { 96 | ReplyToTargetError(client, TargetCount); 97 | return Plugin_Handled; 98 | } 99 | 100 | for (int i = 0; i < TargetCount; i++) 101 | { 102 | if (TargetList[i] > 0 && TargetList[i] != client && IsClientInGame(TargetList[i])) 103 | { 104 | muteTargetedPlayer(client, TargetList[i]); 105 | } 106 | } 107 | return Plugin_Handled; 108 | } 109 | 110 | void DisplayMuteMenu(int client) 111 | { 112 | Menu menu = CreateMenu(MenuHandler_MuteMenu); 113 | SetMenuTitle(menu, "Choose a player to mute"); 114 | SetMenuExitBackButton(menu, true); 115 | 116 | AddTargetsToMenu2(menu, 0, COMMAND_FILTER_NO_BOTS); 117 | 118 | DisplayMenu(menu, client, MENU_TIME_FOREVER); 119 | } 120 | 121 | int MenuHandler_MuteMenu(Menu menu, MenuAction action, int param1, int param2) 122 | { 123 | switch (action) 124 | { 125 | case MenuAction_End: 126 | { 127 | delete menu; 128 | } 129 | case MenuAction_Select: 130 | { 131 | char info[32]; 132 | int target; 133 | 134 | GetMenuItem(menu, param2, info, sizeof(info)); 135 | int userid = StringToInt(info); 136 | 137 | if ((target = GetClientOfUserId(userid)) == 0) 138 | { 139 | PrintToChat(param1, "[SM] Player no longer available"); 140 | } 141 | else 142 | { 143 | muteTargetedPlayer(param1, target); 144 | } 145 | } 146 | } 147 | 148 | return 0; 149 | } 150 | 151 | void muteTargetedPlayer(int client, int target) 152 | { 153 | SetListenOverride(client, target, Listen_No); 154 | PrintToChat(client, "\x04[Self-Mute]\x01 You have self-muted:\x03 %N", target); 155 | int userid = GetClientUserId(target); 156 | g_MuteList[client][target] = userid; 157 | 158 | int muteCount, numPlayers; 159 | for (int id = 1; id <= MaxClients; id++) 160 | { 161 | if (id == target) continue; 162 | if (IsClientConnected(id)) 163 | { 164 | if (g_MuteList[id][target] && g_MuteList[id][target] == userid) 165 | muteCount++; 166 | 167 | numPlayers++; 168 | } 169 | } 170 | 171 | if (FloatCompare(float(muteCount) / float(numPlayers), 0.3) >= 0) 172 | { 173 | SetClientListeningFlags(target, VOICE_MUTED); 174 | } 175 | } 176 | 177 | //==================================================================================================== 178 | 179 | Action selfUnmute(int client, int args) 180 | { 181 | if(client == 0) 182 | { 183 | PrintToChat(client, "[SM] Cannot use command from RCON"); 184 | return Plugin_Handled; 185 | } 186 | 187 | if(args < 1) 188 | { 189 | ReplyToCommand(client, "[SM] Use: !su [playername]"); 190 | DisplayUnMuteMenu(client); 191 | return Plugin_Handled; 192 | } 193 | 194 | char strTarget[32]; 195 | GetCmdArg(1, strTarget, sizeof(strTarget)); 196 | 197 | char strTargetName[MAX_TARGET_LENGTH]; 198 | int TargetList[MAXPLAYERS], TargetCount; 199 | bool TargetTranslate; 200 | 201 | if ((TargetCount = ProcessTargetString(strTarget, 0, TargetList, MAXPLAYERS, COMMAND_FILTER_CONNECTED|COMMAND_FILTER_NO_BOTS, 202 | strTargetName, sizeof(strTargetName), TargetTranslate)) <= 0) 203 | { 204 | ReplyToTargetError(client, TargetCount); 205 | return Plugin_Handled; 206 | } 207 | 208 | for (int i = 0; i < TargetCount; i++) 209 | { 210 | if (TargetList[i] > 0 && TargetList[i] != client && IsClientInGame(TargetList[i])) 211 | { 212 | unMuteTargetedPlayer(client, TargetList[i]); 213 | } 214 | } 215 | return Plugin_Handled; 216 | } 217 | 218 | void DisplayUnMuteMenu(int client) 219 | { 220 | Menu menu = CreateMenu(MenuHandler_UnMuteMenu); 221 | SetMenuTitle(menu, "Choose a player to unmute"); 222 | SetMenuExitBackButton(menu, true); 223 | 224 | AddTargetsToMenu2(menu, 0, COMMAND_FILTER_NO_BOTS); 225 | 226 | DisplayMenu(menu, client, MENU_TIME_FOREVER); 227 | } 228 | 229 | int MenuHandler_UnMuteMenu(Menu menu, MenuAction action, int param1, int param2) 230 | { 231 | switch (action) 232 | { 233 | case MenuAction_End: 234 | { 235 | delete menu; 236 | } 237 | case MenuAction_Select: 238 | { 239 | char info[32]; 240 | int target; 241 | 242 | GetMenuItem(menu, param2, info, sizeof(info)); 243 | int userid = StringToInt(info); 244 | 245 | if ((target = GetClientOfUserId(userid)) == 0) 246 | { 247 | PrintToChat(param1, "[SM] Player no longer available"); 248 | } 249 | else 250 | { 251 | unMuteTargetedPlayer(param1, target); 252 | } 253 | } 254 | } 255 | 256 | return 0; 257 | } 258 | 259 | void unMuteTargetedPlayer(int client, int target) 260 | { 261 | if(GetListenOverride(client, target) != Listen_No) return; 262 | SetListenOverride(client, target, Listen_Default); 263 | PrintToChat(client, "\x04[Self-Mute]\x01 You have self-unmuted:\x03 %N", target); 264 | g_MuteList[client][target] = 0; 265 | } 266 | 267 | //==================================================================================================== 268 | 269 | Action checkmute(int client, int args) 270 | { 271 | if (client == 0) 272 | { 273 | PrintToChat(client, "[SM] Cannot use command from RCON"); 274 | return Plugin_Handled; 275 | } 276 | 277 | char nickNames[256]; 278 | strcopy(nickNames, sizeof(nickNames), "No players found."); 279 | bool firstNick = true; 280 | 281 | for (int id = 1; id <= MaxClients; id++) 282 | { 283 | if (IsClientInGame(id)) 284 | { 285 | if(GetListenOverride(client, id) == Listen_No) 286 | { 287 | if(firstNick) 288 | { 289 | firstNick = false; 290 | FormatEx(nickNames, sizeof(nickNames), "%N", id); 291 | } 292 | else 293 | Format(nickNames, sizeof(nickNames), "%s, %N", nickNames, id); 294 | } 295 | } 296 | } 297 | 298 | PrintToChat(client, "\x04[Self-Mute]\x01 List of self-muted:\x03 %s", nickNames); 299 | 300 | return Plugin_Handled; 301 | } 302 | -------------------------------------------------------------------------------- /snow/snow.sp: -------------------------------------------------------------------------------- 1 | #pragma semicolon 1 2 | 3 | #include 4 | #include 5 | 6 | ConVar cvar_preciptype; 7 | ConVar cvar_density; 8 | ConVar cvar_color; 9 | ConVar cvar_render; 10 | 11 | char sMap[96]; 12 | 13 | public Plugin myinfo = 14 | { 15 | name = "Snow precipitation", 16 | author = "Accelerator", 17 | description = "Add precipitations to the maps", 18 | version = "1.0", 19 | url = "https://github.com/accelerator74/sp-plugins" 20 | }; 21 | 22 | public void OnPluginStart() 23 | { 24 | HookEvent("round_start", Event_RoundStart, EventHookMode_PostNoCopy); 25 | 26 | cvar_preciptype = CreateConVar("snow_type", "3", "Type of the precipitation (https://developer.valvesoftware.com/wiki/Func_precipitation)"); 27 | cvar_density = CreateConVar("snow_density", "75", "Density of the precipitation"); 28 | cvar_color = CreateConVar("snow_color", "255 255 255", "Color of the precipitation"); 29 | cvar_render = CreateConVar("snow_renderamt", "5", "Render of the precipitation"); 30 | } 31 | 32 | public void OnMapStart() 33 | { 34 | GetCurrentMap(sMap, 64); 35 | Format(sMap, sizeof(sMap), "maps/%s.bsp", sMap); 36 | PrecacheModel(sMap, true); 37 | } 38 | 39 | public void Event_RoundStart(Event event, const char[] name, bool dontBroadcast) 40 | { 41 | CreateTimer(0.3, CreateSnowFall); 42 | } 43 | 44 | public Action CreateSnowFall(Handle timer) 45 | { 46 | int iEnt = -1; 47 | while ((iEnt = FindEntityByClassname(iEnt, "func_precipitation")) != -1) 48 | AcceptEntityInput(iEnt, "Kill"); 49 | 50 | iEnt = CreateEntityByName("func_precipitation"); 51 | 52 | if (iEnt != -1) 53 | { 54 | char preciptype[5], density[5], color[16], render[5]; 55 | float vMins[3], vMax[3], vBuff[3]; 56 | 57 | cvar_preciptype.GetString(preciptype, sizeof(preciptype)); 58 | cvar_density.GetString(density, sizeof(density)); 59 | cvar_color.GetString(color, sizeof(color)); 60 | cvar_render.GetString(render, sizeof(render)); 61 | 62 | DispatchKeyValue(iEnt, "model", sMap); 63 | DispatchKeyValue(iEnt, "preciptype", preciptype); 64 | DispatchKeyValue(iEnt, "renderamt", render); 65 | DispatchKeyValue(iEnt, "density", density); 66 | DispatchKeyValue(iEnt, "rendercolor", color); 67 | 68 | GetEntPropVector(0, Prop_Data, "m_WorldMaxs", vMax); 69 | GetEntPropVector(0, Prop_Data, "m_WorldMins", vMins); 70 | 71 | SetEntPropVector(iEnt, Prop_Send, "m_vecMins", vMins); 72 | SetEntPropVector(iEnt, Prop_Send, "m_vecMaxs", vMax); 73 | 74 | vBuff[0] = vMins[0] + vMax[0]; 75 | vBuff[1] = vMins[1] + vMax[1]; 76 | vBuff[2] = vMins[2] + vMax[2]; 77 | 78 | TeleportEntity(iEnt, vBuff, NULL_VECTOR, NULL_VECTOR); 79 | DispatchSpawn(iEnt); 80 | ActivateEntity(iEnt); 81 | } 82 | } -------------------------------------------------------------------------------- /tz_api/data/sqlite/time_zone.sq3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/accelerator74/sp-plugins/08b3580d350d48b1936da83a36e1903dd7899429/tz_api/data/sqlite/time_zone.sq3 -------------------------------------------------------------------------------- /tz_api/scripting/include/tz.inc: -------------------------------------------------------------------------------- 1 | #if defined _tz_included 2 | #endinput 3 | #endif 4 | #define _tz_included 5 | 6 | /** 7 | * Gets the timezone time as a unix timestamp. 8 | * 9 | * @param timezone Timezone to determine the timestamp. 10 | * @param dst Daylight Saving 1 or 0. 11 | * @param offset Timezone offset. 12 | * @return Timezone time as a unix timestamp, or -1 on failure. 13 | */ 14 | native int TZ_GetTime(const char[] timezone, int &dst, &offset); -------------------------------------------------------------------------------- /tz_api/scripting/tz_api.sp: -------------------------------------------------------------------------------- 1 | #pragma semicolon 1 2 | #include 3 | 4 | #pragma newdecls required 5 | 6 | Database db; 7 | 8 | public Plugin myinfo = 9 | { 10 | name = "Timezone DB API", 11 | author = "Accelerator", 12 | description = "Time DB API in specific timezone", 13 | version = "2.0", 14 | url = "https://forums.alliedmods.net/showthread.php?p=2620743" 15 | }; 16 | 17 | public APLRes AskPluginLoad2(Handle myself, bool late, char[] error, int err_max) 18 | { 19 | CreateNative("TZ_GetTime", Native_TZGetTime); 20 | RegPluginLibrary("TZ_API"); 21 | 22 | return APLRes_Success; 23 | } 24 | 25 | public void OnPluginStart() 26 | { 27 | char Error[256]; 28 | db = SQLite_UseDatabase("time_zone", Error, sizeof(Error)); 29 | 30 | if (Error[0] != '\0') 31 | LogError("Failed to read database: %s", Error); 32 | } 33 | 34 | int Native_TZGetTime(Handle hPlugin, int numParams) 35 | { 36 | char sTimezone[64]; 37 | GetNativeString(1, sTimezone, sizeof(sTimezone)); 38 | 39 | char query[320]; 40 | db.Format(query, sizeof(query), "SELECT (strftime('%%s',DATETIME('now', 'utc')) + `gmt_offset`), `dst`, `gmt_offset` \ 41 | FROM `time_zone` \ 42 | WHERE `time_start` <= strftime('%%s',DATETIME('now', 'utc')) AND `zone_name` = '%s' \ 43 | ORDER BY `time_start` DESC LIMIT 1;", sTimezone); 44 | 45 | SQL_LockDatabase(db); 46 | DBResultSet rs = SQL_Query(db, query); 47 | SQL_UnlockDatabase(db); 48 | 49 | if (rs == null) 50 | return -1; 51 | 52 | int ret = -1; 53 | while (rs.FetchRow()) 54 | { 55 | ret = rs.FetchInt(0); 56 | SetNativeCellRef(2, rs.FetchInt(1)); 57 | SetNativeCellRef(3, rs.FetchInt(2)); 58 | } 59 | 60 | delete rs; 61 | return ret; 62 | } -------------------------------------------------------------------------------- /tz_api/scripting/tz_example.sp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | public void OnPluginStart() 6 | { 7 | RegConsoleCmd("sm_tztime", cmd_tztime); 8 | } 9 | 10 | Action cmd_tztime(int client, int args) 11 | { 12 | char sTemp[128], timezone[64]; 13 | GetCmdArg(1, sTemp, sizeof(sTemp)); 14 | 15 | if (GeoipTimezone(sTemp, timezone, sizeof(timezone))) // Get timezone and rewrite sTemp variable 16 | { 17 | int dst, offset; 18 | int iTime = TZ_GetTime(timezone, dst, offset); 19 | if (iTime != -1) 20 | { 21 | FormatTime(sTemp, sizeof(sTemp), "%m/%d/%Y - %H:%M:%S", dst ? iTime - 3600 : iTime); 22 | PrintToServer("%s: %s", timezone, sTemp); 23 | PrintToServer("DST: %d", dst); 24 | PrintToServer("Offset: %d", offset); 25 | } 26 | else 27 | PrintToServer("Failed to determine the time."); 28 | } 29 | else 30 | PrintToServer("Failed to determine time zone."); 31 | 32 | return Plugin_Handled; 33 | } --------------------------------------------------------------------------------