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

[CS:GO] Altering weapon run speed values


Post New Thread Reply   
 
Thread Tools Display Modes
NatsUpX
Junior Member
Join Date: Jun 2022
Old 06-17-2022 , 07:35   Re: [CS:GO] Altering weapon run speed values
Reply With Quote #11

Hello,

Is this still up to date? Could someone help me to figure out how to increase movement speed with a knife?

We are setting up a soccer mod server currently and need to have this changed.

Appreciate the help

Kind Regards
Natsu
NatsUpX is offline
azalty
AlliedModders Donor
Join Date: Feb 2020
Location: France
Old 06-23-2022 , 12:57   Re: [CS:GO] Altering weapon run speed values
Reply With Quote #12

Quote:
Originally Posted by apocalyptic View Post
Like speed, you can set a custom gravity too. 1.0 is normal. If you set an entity's gravity to 0.0, it will never fall.
But you don't need to make a custom function for this, SourceMod already had one.
PHP Code:
public OnWeaponSwitchPost(clientweapon
{
    new 
String:weapon[24
    
GetClientWeapon(client,weapon,24)
    if (
StrEqual(weapon,"weapon_knife"))
    {
        
SetClientSpeed(client,speed)
        
SetClientGravity(client,gravity)//<----set gravity here
    
}
    else
    {
        
SetClientSpeed(client,1.0)
        
SetClientGravity(client,1.0)//<----set to default too
    
}

I think it's SetEntityGravity, not SetClientGravity

"m_flLaggedMovementValue" doesn't really change your speed, but just updates your character faster. It has a very annoying side effect: it makes you fall faster/slower but doesn't actually change your gravity (you'll still get the same amount of damage).

Shavit's timer uses DHooks to set a fixed speed.
Below is a code part that might work. Untested.

Code:
#include <dhooks>

DynamicHook gH_GetPlayerMaxSpeed = null;

public void OnPluginStart()
{
		if ((iOffset = GameConfGetOffset(hGameData, "CCSPlayer::GetPlayerMaxSpeed")) == -1)
		{
			SetFailState("Couldn't get the offset for \"CCSPlayer::GetPlayerMaxSpeed\" - make sure your gamedata is updated!");
		}

		gH_GetPlayerMaxSpeed = DHookCreate(iOffset, HookType_Entity, ReturnType_Float, ThisPointer_CBaseEntity, CCSPlayer__GetPlayerMaxSpeed);
}

public MRESReturn CCSPlayer__GetPlayerMaxSpeed(int pThis, DHookReturn hReturn)
{
	// Return MRES_Ignored if you don't want to override the speed.

	hReturn.Value = 250.0; // The speed you want to set

	return MRES_Override;
}

public void OnClientPutInServer(int client)
{
		if (gH_GetPlayerMaxSpeed)
		{
			DHookEntity(gH_GetPlayerMaxSpeed, true, client);
		}
}
Source: https://github.com/shavitush/bhoptim...shavit-misc.sp
__________________
GitHub | Discord: @azalty | Steam

Last edited by azalty; 06-23-2022 at 13:01.
azalty is offline
eyal282
Veteran Member
Join Date: Aug 2011
Old 06-23-2022 , 15:05   Re: [CS:GO] Altering weapon run speed values
Reply With Quote #13

While I don't have a usecase for it ( I used to, then scrapped it )

I figured out a method to slightly or immensely increase your speed, but not to a target value, nor to a target player.

You could try to decrease the players speed.

It works by setting the next expiration of healthshot ( gives speed boost ) to 0.04 every frame, to ensure you don't get a blue screen.

It might show a side effect of a blue screen, but I cannot see it.

Code:
#include <sourcemod>

#define PLUGIN_VERSION "1.0"
#pragma newdecls required

#pragma semicolon 1

public void OnGameFrame()
{
    for(int i=1;i <= MaxClients;i++)
    {
        if(!IsClientInGame(i))
            continue;

        else if(!IsPlayerAlive(i))
            continue;
        
        else if(IsFakeClient(i))
            continue;

        // Setting the expiration to higher will cause blue screen.
        SetEntPropFloat(i, Prop_Send, "m_flHealthShotBoostExpirationTime", GetGameTime() + 0.04);
    }
}
Using the cvar:

healthshot_healthboost_speed_multiplier 50

Will result in 357.29 units of speed according to cl_showpos 1 when running with a knife.
__________________
I am available to make plugins for pay.

Discord: Eyal282#1334

Last edited by eyal282; 06-24-2022 at 04:00.
eyal282 is offline
modderr
Junior Member
Join Date: Apr 2024
Old 04-01-2024 , 22:20   Re: [CS:GO] Altering weapon run speed values
Reply With Quote #14

hello. im trying to figure this out. where do I put this code? does anyone have a link to a tutorial about scripting in csgo?
modderr is offline
azalty
AlliedModders Donor
Join Date: Feb 2020
Location: France
Old 04-06-2024 , 07:52   Re: [CS:GO] Altering weapon run speed values
Reply With Quote #15

Quote:
Originally Posted by modderr View Post
hello. im trying to figure this out. where do I put this code? does anyone have a link to a tutorial about scripting in csgo?
Create a file ending with .sp, paste the code inside, then drag and drop it into compile.exe (which is located in sourcemod/scripting/). A .smx file should end up being generated in the sourcemod/scripting/compiled/ directory. Just put it in your plugins directory like any other plugin.
__________________
GitHub | Discord: @azalty | Steam
azalty is offline
modderr
Junior Member
Join Date: Apr 2024
Old 04-06-2024 , 12:20   Re: [CS:GO] Altering weapon run speed values
Reply With Quote #16

Quote:
Originally Posted by azalty View Post
Create a file ending with .sp, paste the code inside, then drag and drop it into compile.exe (which is located in sourcemod/scripting/). A .smx file should end up being generated in the sourcemod/scripting/compiled/ directory. Just put it in your plugins directory like any other plugin.
Thanks. it worked
modderr 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 08:11.


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