Raised This Month: $ Target: $400
 0% 

[CS:GO] Altering weapon run speed values


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Tylerius
Junior Member
Join Date: Feb 2013
Old 02-20-2013 , 05:01   [CS:GO] Altering weapon run speed values
Reply With Quote #1

Hey all, I've been lurking here for a while but finally decided to make an account! I'm fairly new to scripting so I thought this might be a good place to ask for advice.

In this case, I was wondering about the weapon run speed values in GO (listed here: http://forums.steampowered.com/forum....php?t=2591368)

If I wanted to modify a value or two on that list, would I be required to script something for it? I'm asking because I haven't been able to find any good knife run speed plugins, but I almost feel like I'm overcomplicating this whole thing.

I have some more questions, but I figure I should start out with the most noobish ones first. Thanks all.
Tylerius is offline
apocalyptic
Senior Member
Join Date: Feb 2013
Location: China
Old 02-20-2013 , 11:10   Re: [CS:GO] Altering weapon run speed values
Reply With Quote #2

In CS, different weapons have different maximum movement speed, so you can do this:
PHP Code:
set_user_maxspeed(client,speed
But in CS:GO, you just need one float number to set everything:
PHP Code:
SetClientSpeed(client,speed
When speed is set to 1.0, that means you have a normal speed, if 0.0, you will be completely frozen (even you are in the air). If you switch weapons, your maximum speed will be set automaticly.
So if you just need a faster speed when you are hoding a knife, you can try this:
PHP Code:
public OnClientPutInServer(client)
{
    
SDKHook(clientSDKHook_WeaponSwitchPostOnWeaponSwitchPost)
}

public 
OnWeaponSwitchPost(clientweapon)
{
//once a player switchs a weapon
    
new String:weapon[24]
    
GetClientWeapon(client,weapon,24)//find out what weapon is in his hand
    
if (StrEqual(weapon,"weapon_knife"))//if he is hoding a knife
        
SetClientSpeed(client,speed)//set the speed, "speed" is the value you need to set
    
else//if he is hoding something other
        
SetClientSpeed(client,1.0)//set to default
}

public 
OnClientDisconnect(client)
{
    
SDKUnhook(clientSDKHook_WeaponSwitchPostOnWeaponSwitchPost)

Forgive my poor English.
apocalyptic is offline
Tylerius
Junior Member
Join Date: Feb 2013
Old 02-20-2013 , 21:04   Re: [CS:GO] Altering weapon run speed values
Reply With Quote #3

First off: Thanks a ton apocalyptic. I have my code written out but I have a couple errors (honestly, I'm sure they're probably huge noob errors too).

The main thing, I think, is the SetClientSpeed. spcomp.exe says that it's an undefined symbol.

The error is as written: error 017: undefined symbol "SetClientSpeed"

Thanks again.
Tylerius is offline
apocalyptic
Senior Member
Join Date: Feb 2013
Location: China
Old 02-20-2013 , 22:35   Re: [CS:GO] Altering weapon run speed values
Reply With Quote #4

Sorry, I forgot somthing. :-(
You need to add this below:
PHP Code:
public SetClientSpeed(client,speed)
{
      
SetEntPropFloat(clientProp_Send"m_flLaggedMovementValue"speed)

And don't forget to do this before:
PHP Code:
#include <entity> 
apocalyptic is offline
Tylerius
Junior Member
Join Date: Feb 2013
Old 02-21-2013 , 00:33   Re: [CS:GO] Altering weapon run speed values
Reply With Quote #5

Awesome, thank you! No errors anymore, either (just a couple warnings). A quick question though, if I wanted to also add in SetEntityGravity, how would I go about this? When I put in both conditions (speed and gravity) I get an error 029 on the if/else. I'm guessing it's another noob formatting thing.

Thanks again, and your English is pretty good ;)
Tylerius is offline
apocalyptic
Senior Member
Join Date: Feb 2013
Location: China
Old 02-21-2013 , 00:57   Re: [CS:GO] Altering weapon run speed values
Reply With Quote #6

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
    
}

apocalyptic is offline
Tylerius
Junior Member
Join Date: Feb 2013
Old 02-23-2013 , 04:42   Re: [CS:GO] Altering weapon run speed values
Reply With Quote #7

After spending some time tinkering with things it works perfectly now. Thanks a bunch apocalyptic. Couldn't have done it without you.
Tylerius is offline
ehsan.blade
Junior Member
Join Date: Mar 2013
Old 03-13-2013 , 03:57   Re: [CS:GO] Altering weapon run speed values
Reply With Quote #8

hiiii,
would you please please please make this as a plugin for me? I really want this and I don't know how to write a script or make a plugin.
thanks very much in advance.
ehsan.blade is offline
Tylerius
Junior Member
Join Date: Feb 2013
Old 03-18-2013 , 02:13   Re: [CS:GO] Altering weapon run speed values
Reply With Quote #9

Quote:
Originally Posted by ehsan.blade View Post
hiiii,
would you please please please make this as a plugin for me? I really want this and I don't know how to write a script or make a plugin.
thanks very much in advance.
For sure! I'm away from my computer with the script on it right now but when I get back in a couple days I'll PM it to you.
Tylerius is offline
ZASTRELIS
Veteran Member
Join Date: Nov 2010
Location: Siberia, Irkutsk
Old 08-21-2015 , 01:03   Re: [CS:GO] Altering weapon run speed values
Reply With Quote #10

So in CSGO I can't modigy users speed in Hook_WeaponSwitchPost?!
Spoiler

And what difference with m_flLaggedMovementValue and m_flMaxspeed?

Last edited by ZASTRELIS; 08-21-2015 at 02:26.
ZASTRELIS 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 04:02.


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