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

[CS:GO] Same speed with every weapon


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Eagle08
Junior Member
Join Date: Sep 2020
Old 09-01-2020 , 05:01   [CS:GO] Same speed with every weapon
Reply With Quote #1

Hi Everyone,

I've tired to create VIP for my server which will have ability to run with the same speed with every weapon.
This is what I've got so far and it doesn't work. I call this function on WeaponSwtich and SpawnPost.
PHP Code:
public Actionset_speed(client)
{
    new 
float:MyMax GetEntProp(clientProp_Data"m_flMaxSpeed");

    if (
g_Vip[client] && (MyMax<235.0))
        
g_iPlayerSpeed[client] = 235.0;

    else
    {
        
int ActWpn GetEntPropEnt(clientProp_Send"m_hActiveWeapon");
        new 
String:Weapon[32];
        
GetEntityClassname(ActWpnWeaponsizeof(Weapon));        
            
        if(
ActWpn == INVALID_ENT_REFERENCE)
        {
            
g_iPlayerSpeed[client] = gCSWeaponSpeed[view_as<int>(CSGOWeaponID_NONE)];
            return 
Plugin_Continue;
        }
                
        
g_iPlayerSpeed[client] = gCSWeaponSpeed[view_as<int>(WeaponClassNameToCSWeaponID(Weapon))];
    }
    if(
g_iPlayerSpeed[client] != MyMax)
        
SetEntProp(clientProp_Data"m_flMaxSpeed"g_iPlayerSpeed[client]);

Of course, I have stock with all weapon classnames converted to CSGOWeaponID and speeds, which I am using to adjust speed for non-Vip players.
The second problem I have is that I cannot give my Vip speed over 250.
Eagle08 is offline
Eagle08
Junior Member
Join Date: Sep 2020
Old 09-02-2020 , 16:58   Re: [CS:GO] Same speed with every weapon
Reply With Quote #2

I've managed to get this running, but I've got a problem with jumps now. My Vip has a double jump feature and if I jump too high and then change weapon to say: Negev, I got hurt by fall.

My code looks now like:
PHP Code:
public Action:set_speed(client)
{
    new 
Float:Speed 1.0;
    new 
Float:WpnSpeed;
    new 
String:Diff[16];
    
    if(
g_Vip[client])
    {        
        
int ActWpn GetEntPropEnt(clientProp_Send"m_hActiveWeapon");
        new 
String:Weapon[32];
        
GetEntityClassname(ActWpnWeaponsizeof(Weapon));    

        
WpnSpeed float(gCSWeaponSpeed[view_as<int>(WeaponClassNameToCSWeaponID(Weapon))]);
            

        if(
ActWpn == INVALID_ENT_REFERENCE)
        {
            
Speed 1.0;
            return 
Plugin_Continue;
        }
            
        if(
WpnSpeed<235.0)
        {
            
Format(Diffsizeof(Diff), "%.2f"1.0-(WpnSpeed/235.0));
            
Speed 1.0 StringToFloat(Diff);
        }
        else
            
Speed 1.0;
    }
    
SetEntPropFloat(clientProp_Send"m_flLaggedMovementValue"Speed);
    
    return 
Plugin_Continue;

I am still calling this function at OnWeaponChange and SpawnPost. I've tried to restore multiplier to 1.0 after player's jump, but it doesn't work.
PHP Code:
    if (g_Vip[client])
    {
        static 
bool:Old[MAXPLAYERS+1];
        
        if(!
Old[client] && (buttons IN_JUMP))
        {
            
SetEntPropFloat(clientProp_Send"m_flLaggedMovementValue"1.0);
            
Old[client] = true;
        }
        else if(
Old[client] && !(buttons IN_JUMP))
                
Old[client] = false;
        
        new 
flags GetEntityFlags(client);
        
        if(
flags FL_ONGROUND)
        {
            
set_speed(client);
        }
    } 
Any ideas on it? I will appreciate any help.

Last edited by Eagle08; 09-02-2020 at 16:59.
Eagle08 is offline
AuricYoutube
Senior Member
Join Date: Aug 2016
Location: Here
Old 09-03-2020 , 02:29   Re: [CS:GO] Same speed with every weapon
Reply With Quote #3

I don't know much but maybe if you didn't see this it would help you. https://forums.alliedmods.net/showthread.php?p=2651512
AuricYoutube 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 21:04.


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