From d1de5f601542bb6c3f8f52b528365317ce3b6367 Mon Sep 17 00:00:00 2001 From: jenz Date: Mon, 7 Aug 2023 00:43:26 +0200 Subject: [PATCH] initial commit of fix for map. encap also made a stripper that does clearparenting when people are aware from vehciles --- .../ze_icecap_escape_act2_b3s_fix.sp | 77 +++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 ze_icecap_escape_act2_b3s_fix/scripting/ze_icecap_escape_act2_b3s_fix.sp diff --git a/ze_icecap_escape_act2_b3s_fix/scripting/ze_icecap_escape_act2_b3s_fix.sp b/ze_icecap_escape_act2_b3s_fix/scripting/ze_icecap_escape_act2_b3s_fix.sp new file mode 100644 index 00000000..db1bddf1 --- /dev/null +++ b/ze_icecap_escape_act2_b3s_fix/scripting/ze_icecap_escape_act2_b3s_fix.sp @@ -0,0 +1,77 @@ +#pragma semicolon 1 +#define PLUGIN_AUTHOR "jenz" +#define g_dLength 400 +#define PLUGIN_VERSION "1.0" +#pragma newdecls required + +#include +#include +#include +#include + +public Plugin myinfo = +{ + name = "icecap_crash_fix_from_roundend", + author = PLUGIN_AUTHOR, + description = "solves parenting and game_Ui deactivating on roundend", + version = PLUGIN_VERSION, + url = "www.unloze.com" +}; +//---------------------------------------------------------------------------------------------------- +// Purpose: +//---------------------------------------------------------------------------------------------------- +public void OnPluginStart() +{ + //this makes absolutely no sense, there is no point whatso ever in fucking doing this. + //but without this i get the complaint [SM] Plugin maps/test_icecap.smx failed to load: Unable to load plugin (invalid method code end). + //is really makes absolutely zero sense why this would be needed + for (int i = 0; i < MaxClients; i++) + { + if (IsValidClient(i)) + { + OnClientPostAdminCheck(i); + } + } + AddCommandListener(Command_ztele, "ztele"); + HookEventEx("round_end", OnRoundEnd, EventHookMode_Pre); + HookEntityOutput("trigger_teleport", "OnTrigger", trigger_teleport); + HookEntityOutput("trigger_teleport", "OnStartTouch", trigger_teleport); +} + +public Action Command_ztele(int client, const char[] Command, int Args) +{ + if (IsValidClient(client)) + { + int userid = GetClientUserId(client); + ServerCommand("sm_forceinputplayer #%i Clearparent", userid); + } +} + +public void OnClientPostAdminCheck(int client) +{ +} + +stock bool IsValidClient(int client) +{ + if (client > 0 && client <= MaxClients && IsClientConnected(client) && IsClientInGame(client) && !IsFakeClient(client)) + return true; + return false; +} + +//right before round end deactivate gameUI and unparent players from moving vehicles. +public void OnRoundEnd(Handle event, const char[] name, bool dontBroadcast) +{ + //its the correct map if it contains icecap_escape_act2 + ServerCommand("sm_forceinput Game Deactivate; sm_forceinput Game2 Deactivate;sm_forceinput Game3 Deactivate;sm_forceinput Game4 Deactivate; sm_forceinput Gameleft Deactivate; sm_forceinput Gameright Deactivate; sm_forceinput Gameseat Deactivate; sm_forceinput Gameseat2 Deactivate; sm_forceinput Gameseat3 Deactivate; sm_forceinput Gameseat4 Deactivate; sm_forceinput Gameseat5 Deactivate; sm_forceinput Gameseat6 Deactivate;"); + ServerCommand("sm_forceinput player Clearparent;"); + ServerCommand("sm_forceinput heli kill; sm_forceinput moblie kill; sm_forceinput car kill; sm_forceinput battery kill;"); +} + +public void trigger_teleport(const char[] output, int entity_index, int client, float delay) +{ + if (IsValidClient(client)) + { + int userid = GetClientUserId(client); + ServerCommand("sm_forceinputplayer #%i Clearparent", userid); + } +}