AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Snippets and Tutorials (https://forums.alliedmods.net/forumdisplay.php?f=112)
-   -   [CS:GO] Toggle new auto bhop cvar for client (https://forums.alliedmods.net/showthread.php?t=289075)

ofir753 10-14-2016 07:53

[CS:GO] Toggle new auto bhop cvar for client
 
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

nikooo777 10-14-2016 16:06

Re: [CS:GO] Toggle new auto bhop cvar for client
 
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

ofir753 10-14-2016 16:32

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

Originally Posted by nikooo777 (Post 2462118)
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.

nikooo777 10-14-2016 19:57

Re: [CS:GO] Toggle new auto bhop cvar for client
 
sweet, thanks again :)

OSWO 10-16-2016 12:46

Re: [CS:GO] Toggle new auto bhop cvar for client
 
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.

ofir753 10-16-2016 15:00

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

Originally Posted by OSWO (Post 2462647)
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.

CowGod 10-18-2016 02:26

Re: [CS:GO] Toggle new auto bhop cvar for client
 
good job as always ofir :)


All times are GMT -4. The time now is 12:59.

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