// #define LADDER_SPEED 70.0
#define ONLY_LADDER_VIEW
#define NADE_SUPPORT
#define PISTOL_SUPPORT
#include <amxmodx>
#include <reapi>
#if defined ONLY_LADDER_VIEW
#include <fakemeta>
#endif
stock const GRENADES_BIT_SUM = ((1<<any:WEAPON_HEGRENADE)|(1<<any:WEAPON_SMOKEGRENADE)|(1<<any:WEAPON_FLASHBANG)|(1<<any:WEAPON_C4)); // WEAPON_GLOCK - NADE 4 SLOT
stock const SECONDARY_WEAPONS_BIT_SUM = ((1<<any:WEAPON_P228)|(1<<any:WEAPON_ELITE)|(1<<any:WEAPON_FIVESEVEN)|(1<<any:WEAPON_USP)|(1<<any:WEAPON_GLOCK18)|(1<<any:WEAPON_DEAGLE));
public plugin_init()
{
register_plugin("Ladder Psyhics", "0.1", "Emma Jule");
if ((any:IsLadderMap() & ((-1) / 2)) == 0)
pause("a");
RegisterHookChain(RG_CBasePlayerWeapon_DefaultDeploy, "CBasePlayerWeapon_DefaultDeploy_Post", .post = true);
#if defined LADDER_SPEED || defined ONLY_LADDER_VIEW
RegisterHookChain(RG_PM_Move, "PM_Move", .post = false);
#endif
}
public CBasePlayerWeapon_DefaultDeploy_Post(id, viewModel[], weaponModel[], anim, animExt[], skiplocal)
{
#pragma unused viewModel, weaponModel, anim, animExt, skiplocal
new pPlayer = get_member(id, m_pPlayer);
new bitsActiveItem = (1<<any:WEAPON_KNIFE);
#if defined NADE_SUPPORT
bitsActiveItem |= GRENADES_BIT_SUM;
#endif
#if defined PISTOL_SUPPORT
bitsActiveItem |= SECONDARY_WEAPONS_BIT_SUM;
#endif
if (bitsActiveItem & (1<<any:get_member(id, m_iId))) set_entvar(pPlayer, var_iuser3, get_entvar(pPlayer, var_iuser3) & ~PLAYER_PREVENT_CLIMB);
else set_entvar(pPlayer, var_iuser3, get_entvar(pPlayer, var_iuser3) | PLAYER_PREVENT_CLIMB);
}
#if defined LADDER_SPEED || defined ONLY_LADDER_VIEW
public PM_Move(const playerIndex)
{
if (get_pmove(pm_dead))
return;
if (get_pmove(pm_movetype) != MOVETYPE_FLY)
return;
#if defined LADDER_SPEED
set_pmove(pm_maxspeed, LADDER_SPEED);
#endif
#if defined ONLY_LADDER_VIEW
if (engfunc(EngFunc_PointContents, GetAimingVector(playerIndex)) != CONTENTS_LADDER)
{
set_pmove(pm_maxspeed, -0.0);
}
#endif
}
#endif
stock Float:GetAimingVector(const pPlayer)
{
new Float:vecOrigin[3], Float:vecViewOfs[3], Float:vecAngles[3];
get_entvar(pPlayer, var_origin, vecOrigin);
get_entvar(pPlayer, var_view_ofs, vecViewOfs);
get_entvar(pPlayer, var_v_angle, vecAngles);
vecOrigin[0] += vecViewOfs[0];
vecOrigin[1] += vecViewOfs[1];
vecOrigin[2] += vecViewOfs[2];
engfunc(EngFunc_MakeVectors, vecAngles);
global_get(glb_v_forward, vecAngles);
vecAngles[0] = vecOrigin[0] + (vecAngles[0] * 8192.0);
vecAngles[1] = vecOrigin[1] + (vecAngles[1] * 8192.0);
vecAngles[2] = vecOrigin[2] + (vecAngles[2] * 8192.0);
engfunc(EngFunc_TraceLine, vecOrigin, vecAngles, 0, pPlayer, 0);
get_tr2(0, TR_vecEndPos, vecOrigin);
return vecOrigin;
}
bool:IsLadderMap()
{
return bool:(rg_find_ent_by_class(MaxClients, "func_ladder", .useHashTable = true));
}