View Single Post
lazarev
Veteran Member
Join Date: Sep 2008
Old 06-12-2018 , 12:40   Re: Make csgo ladder as in cs 1.6
Reply With Quote #7

There's simpler solution:
PHP Code:
#include <sourcemod>
#include <sdktools>

#pragma semicolon 1
#pragma newdecls required

#define PLUGIN_VERSION "2.0"

public Plugin myinfo 
{
    
name "Sticky ladders"
    
author "juice"
    
description "Stick to ladders without holding strafe keys"
    
version PLUGIN_VERSION
    
url "https://github.com/juicejuicejuice"
};

ConVar sm_sticky_ladders;

public 
void OnPluginStart()
{
    
sm_sticky_ladders CreateConVar("sm_sticky_ladders""1""Enable sticky ladders");
}

public 
Action OnPlayerRunCmd(int clientint &buttonsint &impulsefloat move[3], float angles[3], int &weaponint &subtypeint &cmdnumint &tickcountint &seedint mouse[2])
{
    if (!
sm_sticky_ladders.BoolValue || !IsPlayerAlive(client) || GetEntityMoveType(client) != MOVETYPE_WALK)
    {
        return 
Plugin_Continue;
    }
    
    if (!
move[0] && !move[1])
    {
        
float wishdir[3];
        
GetEntPropVector(clientProp_Data"m_vecAbsVelocity"wishdir);
        
        if (
wishdir[0] || wishdir[1] || wishdir[2])
        {
            
NormalizeVector(wishdirwishdir);
            
NegateVector(wishdir);
            
SetEntPropVector(clientProp_Data"m_vecLadderNormal"wishdir);
            
SetEntityMoveType(clientMOVETYPE_LADDER);
        }
    }
    
    return 
Plugin_Continue;

lazarev is offline