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

[CS:GO] Set movement speed


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
eyal282
Veteran Member
Join Date: Aug 2011
Old 08-16-2018 , 06:01   [CS:GO] Set movement speed
Reply With Quote #1

I searched a lot and couldn't find any way to effectively change the speed.

If you are thinking about m_flLaggedMovement value, please include a proper method that will set the gravity and anything else affected that isn't speed to be negated, m_flLaggedMovement is a terrible method and should only be my last resort.
__________________
I am available to make plugins for pay.

Discord: Eyal282#1334
eyal282 is offline
SHUFEN
Senior Member
Join Date: Jun 2014
Location: Japan, Tokyo
Old 08-16-2018 , 06:25   Re: [CS:GO] Set movement speed
Reply With Quote #2

Code:
"Games"
{
	"csgo"
	{
		"Offsets"
		{
			"GetPlayerMaxSpeed"
			{
				"windows"	"498"
				"linux"		"499"
			}
		}
	}
}
Code:
#pragma semicolon 1
#pragma newdecls required

#include <dhooks>

Handle h_GetPlayerMaxSpeed = INVALID_HANDLE;

public void OnPluginStart() {
	if (LibraryExists("dhooks")) {
		Handle hGameData = LoadGameConfigFile("test_plugin.games");

		if (hGameData != null) {
			int iOffset = GameConfGetOffset(hGameData, "GetPlayerMaxSpeed");
			if (iOffset != -1)
				h_GetPlayerMaxSpeed = DHookCreate(iOffset, HookType_Entity, ReturnType_Float, ThisPointer_CBaseEntity, DHook_GetPlayerMaxSpeed);
			delete hGameData;
		}
	}

	for (int i = 1; i <= MaxClients; i++)
		if (IsClientInGame(i)) {
			HookClient(i);
		}
}

public void OnClientPutInServer(int client) {
	HookClient(client);
}

void HookClient(int client) {
	DHookEntity(h_GetPlayerMaxSpeed, true, client);
}


public MRESReturn DHook_GetPlayerMaxSpeed(int client, Handle hReturn) {
	if (client < 1 || client > MaxClients || !IsClientInGame(client) || !IsPlayerAlive(client))
		return MRES_Ignored;

	if (/* You want */) {
		float fSpeed = 123.4;
		DHookSetReturn(hReturn, fSpeed);
		return MRES_Override;
	}

	return MRES_Ignored;
}
SHUFEN is offline
Send a message via Skype™ to SHUFEN
eyal282
Veteran Member
Join Date: Aug 2011
Old 08-16-2018 , 06:28   Re: [CS:GO] Set movement speed
Reply With Quote #3

Quote:
Originally Posted by SHUFEN.jp View Post
Code:
"Games"
{
	"csgo"
	{
		"Offsets"
		{
			"GetPlayerMaxSpeed"
			{
				"windows"	"498"
				"linux"		"499"
			}
		}
	}
}
Code:
#pragma semicolon 1
#pragma newdecls required

#include <dhooks>

Handle h_GetPlayerMaxSpeed = INVALID_HANDLE;

public void OnPluginStart() {
	if (LibraryExists("dhooks")) {
		Handle hGameData = LoadGameConfigFile("test_plugin.games");

		if (hGameData != null) {
			int iOffset = GameConfGetOffset(hGameData, "GetPlayerMaxSpeed");
			if (iOffset != -1)
				h_GetPlayerMaxSpeed = DHookCreate(iOffset, HookType_Entity, ReturnType_Float, ThisPointer_CBaseEntity, DHook_GetPlayerMaxSpeed);
			delete hGameData;
		}
	}

	for (int i = 1; i <= MaxClients; i++)
		if (IsClientInGame(i)) {
			HookClient(i);
		}
}

public void OnClientPutInServer(int client) {
	HookClient(client);
}

void HookClient(int client) {
	DHookEntity(h_GetPlayerMaxSpeed, true, client);
}


public MRESReturn DHook_GetPlayerMaxSpeed(int client, Handle hReturn) {
	if (client < 1 || client > MaxClients || !IsClientInGame(client) || !IsPlayerAlive(client))
		return MRES_Ignored;

	if (/* You want */) {
		float fSpeed = 123.4;
		DHookSetReturn(hReturn, fSpeed);
		return MRES_Override;
	}

	return MRES_Ignored;
}
How to increase speed instead of setting? Based on weapon speeds.
__________________
I am available to make plugins for pay.

Discord: Eyal282#1334

Last edited by eyal282; 08-16-2018 at 06:44.
eyal282 is offline
SHUFEN
Senior Member
Join Date: Jun 2014
Location: Japan, Tokyo
Old 08-16-2018 , 09:29   Re: [CS:GO] Set movement speed
Reply With Quote #4

It simply returns a high value with MRES_Override.
SHUFEN is offline
Send a message via Skype™ to SHUFEN
eyal282
Veteran Member
Join Date: Aug 2011
Old 08-16-2018 , 11:22   Re: [CS:GO] Set movement speed
Reply With Quote #5

Quote:
Originally Posted by SHUFEN.jp View Post
It simply returns a high value with MRES_Override.
I don't understand. How to increase speed instead of setting it?
__________________
I am available to make plugins for pay.

Discord: Eyal282#1334
eyal282 is offline
8guawong
AlliedModders Donor
Join Date: Dec 2013
Location: BlackMarke7
Old 08-16-2018 , 12:04   Re: [CS:GO] Set movement speed
Reply With Quote #6

Quote:
Originally Posted by eyal282 View Post
I don't understand. How to increase speed instead of setting it?
Code:
float fSpeed = 123.4;
		DHookSetReturn(hReturn, fSpeed);
		return MRES_Override;
you set the desired speed in the code above
__________________

Last edited by 8guawong; 08-16-2018 at 12:05.
8guawong is offline
xerox8521
Senior Member
Join Date: Sep 2011
Old 08-16-2018 , 13:44   Re: [CS:GO] Set movement speed
Reply With Quote #7

could use DHookGetReturn(hReturn) (vectors or strings have their own specific return function) to retrieve the current speed scale it with some value eg 1.2 and then set it with DHookSetReturn and MRES_Override like shown above.

Last edited by xerox8521; 08-16-2018 at 13:45.
xerox8521 is offline
eyal282
Veteran Member
Join Date: Aug 2011
Old 08-16-2018 , 18:40   Re: [CS:GO] Set movement speed
Reply With Quote #8

Quote:
Originally Posted by xerox8521 View Post
could use DHookGetReturn(hReturn) (vectors or strings have their own specific return function) to retrieve the current speed scale it with some value eg 1.2 and then set it with DHookSetReturn and MRES_Override like shown above.
DHookGetReturn gives 0.0
__________________
I am available to make plugins for pay.

Discord: Eyal282#1334
eyal282 is offline
Peace-Maker
SourceMod Plugin Approver
Join Date: Aug 2008
Location: Germany
Old 08-18-2018 , 07:16   Re: [CS:GO] Set movement speed
Reply With Quote #9

Make sure you're in a post-hook.
DHookEntity(h_GetPlayerMaxSpeed, true, client);

Paste your code!
__________________
Peace-Maker is offline
eyal282
Veteran Member
Join Date: Aug 2011
Old 08-18-2018 , 08:45   Re: [CS:GO] Set movement speed
Reply With Quote #10

Quote:
Originally Posted by Peace-Maker View Post
Make sure you're in a post-hook.
DHookEntity(h_GetPlayerMaxSpeed, true, client);

Paste your code!
I was on pre hook. If I go to a post hook am I even able to edit the speed?
__________________
I am available to make plugins for pay.

Discord: Eyal282#1334
eyal282 is offline
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 17:39.


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