I've been trying to bring back some of movement from 1.6 (sticky ladders, doubleducking, stand-up bhop, etc.) Here is the sticky ladder part from my plugin. There must be another, concrete way to have sticky ladders, but hey, it works!
PHP Code:
#include <sourcemod>
#include <sdktools>
#include <sdkhooks>
#define PLUGIN_VERSION "1.01"
#pragma semicolon 1
#pragma newdecls required
float frametime;
public Plugin myinfo =
{
name = "Sticky ladders",
author = "juice",
description = "Make players stick to ladders without holding any movement key",
version = PLUGIN_VERSION,
url = "https://github.com/juicejuicejuice"
};
public void OnPluginStart()
{
frametime = GetTickInterval();
}
public void OnClientPutInServer(int client)
{
SDKHook(client, SDKHook_PreThink, OnPlayerPreThink_Pre);
}
public void OnClientDisconnect(int client)
{
SDKUnhook(client, SDKHook_PreThink, OnPlayerPreThink_Pre);
}
public Action OnPlayerPreThink_Pre(int client)
{
if (!IsPlayerAlive(client))
{
return;
}
if (GetEntityMoveType(client) == MOVETYPE_WALK)
{
float velocity[3];
GetEntPropVector(client, Prop_Data, "m_vecAbsVelocity", velocity);
if (!velocity[0] && !velocity[1] && !velocity[2])
{
return;
}
float origin[3];
GetClientAbsOrigin(client, origin);
float mins[3], maxs[3];
GetEntPropVector(client, Prop_Send, "m_vecMins", mins);
GetEntPropVector(client, Prop_Send, "m_vecMaxs", maxs);
float wishpos[3];
wishpos[0] = origin[0] + velocity[0] * frametime;
wishpos[1] = origin[1] + velocity[1] * frametime;
wishpos[2] = origin[2] + velocity[2] * frametime;
Handle tr = TR_TraceHullFilterEx(origin, wishpos, mins, maxs, MASK_PLAYERSOLID, TraceFilter_IgnoreSelf, client);
if (TR_DidHit(tr))
{
float planeNormal[3];
TR_GetPlaneNormal(tr, planeNormal);
SetEntityMoveType(client, MOVETYPE_LADDER);
SetEntPropVector(client, Prop_Send, "m_vecLadderNormal", planeNormal);
}
CloseHandle(tr);
}
}
public bool TraceFilter_IgnoreSelf(int ent, int mask, any data)
{
return (ent != data);
}