AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting (https://forums.alliedmods.net/forumdisplay.php?f=107)
-   -   [CS:GO] Altering weapon run speed values (https://forums.alliedmods.net/showthread.php?t=209022)

Tylerius 02-20-2013 05:01

[CS:GO] Altering weapon run speed values
 
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.

apocalyptic 02-20-2013 11:10

Re: [CS:GO] Altering weapon run speed values
 
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.:wink:

Tylerius 02-20-2013 21:04

Re: [CS:GO] Altering weapon run speed values
 
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.

apocalyptic 02-20-2013 22:35

Re: [CS:GO] Altering weapon run speed values
 
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> 


Tylerius 02-21-2013 00:33

Re: [CS:GO] Altering weapon run speed values
 
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 ;)

apocalyptic 02-21-2013 00:57

Re: [CS:GO] Altering weapon run speed values
 
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
    
}



Tylerius 02-23-2013 04:42

Re: [CS:GO] Altering weapon run speed values
 
After spending some time tinkering with things it works perfectly now. Thanks a bunch apocalyptic. Couldn't have done it without you.

ehsan.blade 03-13-2013 03:57

Re: [CS:GO] Altering weapon run speed values
 
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.

Tylerius 03-18-2013 02:13

Re: [CS:GO] Altering weapon run speed values
 
Quote:

Originally Posted by ehsan.blade (Post 1911779)
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.

ZASTRELIS 08-21-2015 01:03

Re: [CS:GO] Altering weapon run speed values
 
So in CSGO I can't modigy users speed in Hook_WeaponSwitchPost?!
Spoiler

And what difference with m_flLaggedMovementValue and m_flMaxspeed?


All times are GMT -4. The time now is 01:47.

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