haha author Silvers. Yeah that's pretty much exactly what I was thinking. Well done! Haven't tested so I hope it works but I don't see why not. Thanks
Edit: the only thing is why are you checking for tank? That would be team 3 (infected): GetEntProp(client, Prop_Send, "m_zombieClass") != 8.
Also not sure about the multiple hooks/unhooks, I don't know how SDKHooks handles that. Maybe a global bool MAXPLAYERS+1 to check when it's hooked / unhooked. I guess theres multiple ways to tackle this would need to test.
Just tested on the tank at that moment.
Just want use this only for the tank for now.
This should look better and there is still no more than 50 lines)
Spoiler
Code:
#pragma semicolon 1
#include <sourcemod>
#include <sdkhooks>
new bool:bMoveType[MAXPLAYERS+1]=false;
public Plugin:myinfo =
{
name = "[L4D2] No Tank Block On Ladder",
description = "Removes blocking on the ladder.",
author = "Silvers",
version = "1.0",
url = "https://forums.alliedmods.net"
}
public Action:OnPlayerRunCmd(client, &buttons, &impulse, Float:vel[3], Float:angles[3], &weapon)
{
if (!IsClientInGame(client) || GetClientTeam(client) != 3 || GetEntProp(client, Prop_Send, "m_zombieClass") != 8)
return Plugin_Continue;
if ((GetEntityMoveType(client) == MOVETYPE_LADDER) && (bMoveType[client] == false))
{
SDKHook(client, SDKHook_StartTouch, StartTouch);
bMoveType[client] = true;
}
else if ((GetEntityMoveType(client) == MOVETYPE_WALK) && (bMoveType[client] == true))
{
SDKHook(client, SDKHook_StartTouch, EndTouch);
bMoveType[client] = false;
}
return Plugin_Continue;
}
public StartTouch(client)
{
SDKUnhook(client, SDKHook_StartTouch, StartTouch);
if (client) SetEntProp(client, Prop_Data, "m_CollisionGroup", 2);
}
public EndTouch(client)
{
SDKUnhook(client, SDKHook_StartTouch, EndTouch);
if (client) SetEntProp(client, Prop_Data, "m_CollisionGroup", 6);
}