Raised This Month: $32 Target: $400
 8% 

[CS:GO] Toggle new auto bhop cvar for client


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
ofir753
Senior Member
Join Date: Aug 2012
Old 10-14-2016 , 07:53   [CS:GO] Toggle new auto bhop cvar for client
Reply With Quote #1

Hey,

If you are intersted how to make use of the new cvar "sv_autobunnyhopping" different for each client (not all clients will have autobhop) you might wanna take a pick of this snippet.
Btw sorry for old syntax

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

public Plugin myinfo 
{
    
name "",
    
author "Ofir",
    
description "",
    
version "1.0",
    
url "steamcommunity.com/id/OfirGal1337"
};

new 
Handle:gh_AutoBhop INVALID_HANDLE;
new 
Handle:gh_EnableBhop INVALID_HANDLE;
new 
bool:gb_ClientAutoBhop[MAXPLAYERS+1];

public 
void OnPluginStart()
{
    
gh_AutoBhop FindConVar("sv_autobunnyhopping");
    
gh_EnableBhop FindConVar("sv_enablebunnyhopping");

    
SetConVarBool(gh_AutoBhopfalse);
    
SetConVarBool(gh_EnableBhoptrue);

    
RegConsoleCmd("sm_auto"Command_Auto);
}

public 
void OnClientConnected(client)
{
    
gb_ClientAutoBhop[client] = false;
}

public 
Action Command_Auto(int clientint args)
{
    
gb_ClientAutoBhop[client] = !gb_ClientAutoBhop[client];

    if(
gb_ClientAutoBhop[client])
    {
        
PrintToChat(client"enabled");
        
SendConVarValue(clientgh_AutoBhop"1");
    }
    else
    {
        
PrintToChat(client"disabled");
        
SendConVarValue(clientgh_AutoBhop"0");
    }
    return 
Plugin_Handled;
}

public 
Action:OnPlayerRunCmd(client, &buttons, &impulseFloat:vel[3], Float:angles[3], &weapon, &subtype, &cmdnum, &tickcount, &seedmouse[2])
{
    if (
gb_ClientAutoBhop[client] && IsPlayerAlive(client))
    {
        if (
buttons IN_JUMP)
        {
            if (!(
GetEntityFlags(client) & FL_ONGROUND))
            {
                if (!(
GetEntityMoveType(client) & MOVETYPE_LADDER))
                {
                    if (
GetEntProp(clientProp_Data"m_nWaterLevel") <= 1)
                    {
                        
buttons &= ~IN_JUMP;
                    }
                }
            }
        }
    }

Other Method by Shavit: https://github.com/shavitush/bhoptim...ed3f6f1f9be76f

Last edited by ofir753; 10-14-2016 at 15:07.
ofir753 is offline
nikooo777
AlliedModders Donor
Join Date: Apr 2010
Location: Lugano, Switzerland
Old 10-14-2016 , 16:06   Re: [CS:GO] Toggle new auto bhop cvar for client
Reply With Quote #2

thank you, so basically compared to the old way of doing it, the only thing one has to do is send the value to the client, right?
https://github.com/nikooo777/ckSurf/...3279c4d8d32670
__________________
nikooo777 is offline
ofir753
Senior Member
Join Date: Aug 2012
Old 10-14-2016 , 16:32   Re: [CS:GO] Toggle new auto bhop cvar for client
Reply With Quote #3

Quote:
Originally Posted by nikooo777 View Post
thank you, so basically compared to the old way of doing it, the only thing one has to do is send the value to the client, right?
https://github.com/nikooo777/ckSurf/...3279c4d8d32670
Yep, the whole idea is to make the cvar disabled by the server (won't confirm autobhop in the server side) and make the cvar enabled to clients while it use the old server sided autobhop, like that you can control if the server side will confirm it or not.
ofir753 is offline
nikooo777
AlliedModders Donor
Join Date: Apr 2010
Location: Lugano, Switzerland
Old 10-14-2016 , 19:57   Re: [CS:GO] Toggle new auto bhop cvar for client
Reply With Quote #4

sweet, thanks again
__________________
nikooo777 is offline
OSWO
Senior Member
Join Date: Jul 2015
Location: United Kingdom, London
Old 10-16-2016 , 12:46   Re: [CS:GO] Toggle new auto bhop cvar for client
Reply With Quote #5

If you're giving clients AutoBhop why is

PHP Code:
                    {
                        
buttons &= ~IN_JUMP;
                    } 
needed if they're already receiving the valve auto bhop?

Never mind I see it just doesn't work like that.
__________________
SourceTimer | WeaponSkins++ | BasePlugins++ https://github.com/OSCAR-WOS

Last edited by OSWO; 10-16-2016 at 13:00.
OSWO is offline
ofir753
Senior Member
Join Date: Aug 2012
Old 10-16-2016 , 15:00   Re: [CS:GO] Toggle new auto bhop cvar for client
Reply With Quote #6

Quote:
Originally Posted by OSWO View Post
If you're giving clients AutoBhop why is

PHP Code:
                    {
                        
buttons &= ~IN_JUMP;
                    } 
needed if they're already receiving the valve auto bhop?

Never mind I see it just doesn't work like that.
You are not receiving the valve autobhop (by server), if you will have in the server autobhop 0, and in the client autobhop 1, the player will get stuck in the air (by client side) as long as he hold jump, by recieving sourcemod autobhop, the server confirm the autobhop with the client side and the lag is gone.
ofir753 is offline
CowGod
Senior Member
Join Date: Feb 2015
Old 10-18-2016 , 02:26   Re: [CS:GO] Toggle new auto bhop cvar for client
Reply With Quote #7

good job as always ofir
CowGod is offline
Send a message via Skype™ to CowGod
Reply


Thread Tools
Display Modes

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 12:19.


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