instead of unloading the plugin are we only using the features on the specific map

This commit is contained in:
jenz 2024-08-01 18:32:31 +02:00
parent 427e5e014b
commit 983652c974

View File

@ -9,6 +9,8 @@
#include <cstrike> #include <cstrike>
#include <sdkhooks> #include <sdkhooks>
bool g_b_is_icecap_act2 = false;
public Plugin myinfo = public Plugin myinfo =
{ {
name = "icecap_crash_fix_from_roundend", name = "icecap_crash_fix_from_roundend",
@ -20,8 +22,17 @@ public Plugin myinfo =
//---------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------
// Purpose: // Purpose:
//---------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------
public void OnMapStart()
{
char map[PLATFORM_MAX_PATH];
GetCurrentMap(map, PLATFORM_MAX_PATH);
g_b_is_icecap_act2 = StrEqual(map, "ze_icecap_escape_act2_b3s_fix", false);
}
public void OnPluginStart() public void OnPluginStart()
{ {
OnMapStart();
//this makes absolutely no sense, there is no point whatso ever in fucking doing this. //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). //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 //is really makes absolutely zero sense why this would be needed
@ -40,11 +51,17 @@ public void OnPluginStart()
public Action Command_ztele(int client, const char[] Command, int Args) public Action Command_ztele(int client, const char[] Command, int Args)
{ {
if (!g_b_is_icecap_act2)
{
return Plugin_Handled;
}
if (IsValidClient(client)) if (IsValidClient(client))
{ {
int userid = GetClientUserId(client); int userid = GetClientUserId(client);
ServerCommand("sm_forceinputplayer #%i Clearparent", userid); ServerCommand("sm_forceinputplayer #%i Clearparent", userid);
} }
return Plugin_Handled;
} }
public void OnClientPostAdminCheck(int client) public void OnClientPostAdminCheck(int client)
@ -61,6 +78,10 @@ stock bool IsValidClient(int client)
//right before round end deactivate gameUI and unparent players from moving vehicles. //right before round end deactivate gameUI and unparent players from moving vehicles.
public void OnRoundEnd(Handle event, const char[] name, bool dontBroadcast) public void OnRoundEnd(Handle event, const char[] name, bool dontBroadcast)
{ {
if (!g_b_is_icecap_act2)
{
return;
}
//its the correct map if it contains icecap_escape_act2 //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 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 player Clearparent;");
@ -69,6 +90,10 @@ public void OnRoundEnd(Handle event, const char[] name, bool dontBroadcast)
public void trigger_teleport(const char[] output, int entity_index, int client, float delay) public void trigger_teleport(const char[] output, int entity_index, int client, float delay)
{ {
if (!g_b_is_icecap_act2)
{
return;
}
if (IsValidClient(client)) if (IsValidClient(client))
{ {
int userid = GetClientUserId(client); int userid = GetClientUserId(client);