Raised This Month: $51 Target: $400
 12% 

[CSGO] Automatic edge jump


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Mandarine
New Member
Join Date: Nov 2018
Old 11-19-2018 , 16:42   [CSGO] Automatic edge jump
Reply With Quote #1

I'm trying to force clients to jump right before they fall off an edge. I'm able to detect falls but by the time I do, it's already too late.

I tried teleporting clients to their latest safe position but that didn't seem to work either, plus it probably messes up client prediction.

PHP Code:
#include <sourcemod>
#include <sdktools>
#pragma semicolon 1

// Ignore lack of arrays, just testing
int buttons_old;
int flags_old;
float origin_old[3];

public 
Action OnPlayerRunCmd(int client,int &buttons,int &impulsefloat vel[3], float angles[3],int &weapon)
{
    if (!
IsClientInGame(client) || !IsPlayerAlive(client))
        return 
Plugin_Continue;

    
int flags GetEntityFlags(client);

    
//       Player is falling           wasn't previously                 didn't jump
    
if( !(flags FL_ONGROUND) && (flags_old FL_ONGROUND) && !(buttons_old IN_JUMP) )
    {
        
TeleportEntity(clientorigin_oldNULL_VECTORNULL_VECTOR);
        
buttons &= ~IN_JUMP;
        
PrintToChatAll("[Debug] Edge drop");
    }

    
buttons_old buttons;
    
flags_old flags;
    
GetClientAbsOrigin(clientorigin_old);

    return 
Plugin_Continue;

Does anyone know how I'd go about doing this sort of thing? Thanks

Last edited by Mandarine; 11-19-2018 at 16:58.
Mandarine is offline
poachedegg
Junior Member
Join Date: Nov 2018
Location: China
Old 11-19-2018 , 21:43   Re: [CSGO] Automatic edge jump
Reply With Quote #2

change a modifiable formal parameter you should return Plugin_Changed. I don't remember if OnPlayerRunCmd supports Plugin_Changed. You can have a try.

And if it doesn't support Plugin_Changed, maybe you can try this way instead of changing client pressed buttons.
PHP Code:
float Vel[3];
GetEntPropVector(clientProp_Data"m_vecVelocity"Vel);                    
Vel[2] = 300.0//Decide how high to jump.
TeleportEntity(clientNULL_VECTORNULL_VECTORVel); 

Last edited by poachedegg; 11-19-2018 at 21:59.
poachedegg is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 02:55.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode