AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting (https://forums.alliedmods.net/forumdisplay.php?f=107)
-   -   [CS:GO] Same speed with every weapon (https://forums.alliedmods.net/showthread.php?t=327094)

Eagle08 09-01-2020 05:01

[CS:GO] Same speed with every weapon
 
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 09-02-2020 16:58

Re: [CS:GO] Same speed with every weapon
 
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.:bacon!:

AuricYoutube 09-03-2020 02:29

Re: [CS:GO] Same speed with every weapon
 
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


All times are GMT -4. The time now is 11:07.

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