initial commit of fix for map. encap also made a stripper that does clearparenting when people are aware from vehciles

This commit is contained in:
jenz 2023-08-07 00:43:26 +02:00
parent eb0ee8dfde
commit d1de5f6015

View File

@ -0,0 +1,77 @@
#pragma semicolon 1
#define PLUGIN_AUTHOR "jenz"
#define g_dLength 400
#define PLUGIN_VERSION "1.0"
#pragma newdecls required
#include <sourcemod>
#include <sdktools>
#include <cstrike>
#include <sdkhooks>
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);
}
}