AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Weapon's max speed (https://forums.alliedmods.net/showthread.php?t=194000)

Liverwiz 08-24-2012 12:07

Weapon's max speed
 
I've been messing around with fun module's set_user_maxspeed native. Now i'm wondering how do i set it back to the user's max speed (or previous speed)

set_user_maxspeed(id, 0.0) seems to set it to cl_maxspeed, not the original speed. Is there a way for me to get it? I looked over pdata and couldn't find what i'm looking for. (m_flGroundSpeed was't correct)

Any ideas?

dark_style 08-24-2012 12:20

Re: Weapon's max speed
 
https://forums.alliedmods.net/showthread.php?t=94331

Sorry if I missunderstood what you are trying to do.

NiHiLaNTh 08-24-2012 12:37

Re: Weapon's max speed
 
I think you should use hamsandwich for this

Code:


...
RegisterHam( Ham_CS_Item_GetMaxSpeed, "weapon_xm1014",  "fw_XM1014GetMaxSpeed", .Post = 0 );
...

public fw_XM1014GetMaxSpeed( pWeapon )
{
    SetHamReturnFloat( 115.0 );
    return HAM_SUPERCEDE;
}


Liverwiz 08-24-2012 12:40

Re: Weapon's max speed
 
Quote:

Originally Posted by dark_style (Post 1781472)
https://forums.alliedmods.net/showthread.php?t=94331

Sorry if I missunderstood what you are trying to do.

You did. But its ok, i forgive you.

But it did give me insparation to look back and i think i found this....

#define m_flWeaponSpeed 58 // used for guns to restore after shield
Not sure if ti will work or not....I'll test and report back.


Quote:

Originally Posted by NiHiLaNTh (Post 1781488)
I think you should use hamsandwich for this

Code:


...
RegisterHam( Ham_CS_Item_GetMaxSpeed, "weapon_xm1014",  "fw_XM1014GetMaxSpeed", .Post = 0 );
...

public fw_XM1014GetMaxSpeed( pWeapon )
{
    SetHamReturnFloat( 115.0 );
    return HAM_SUPERCEDE;
}


OH! If my above findings do not work i'll start dabbeling in that. Many thanks to you both.


UPDATE: it seems that all of these are just giving 0.00000 back.
This is my current code (using the ham function)
Code:

// slow victim's speed
                new Float:pdataSpeed
               
                ExecuteHam(Ham_CS_Item_GetMaxSpeed, attackerID, pdataSpeed)
               
                new Float:speed = floatclamp(get_user_maxspeed(victimID) - 55.0, 1.0, 175.0)
                client_print(victimID, print_chat, "Speed pData = %f Speed = %f Original speed = %f", pdataSpeed, speed, get_user_maxspeed(victimID) )
                set_user_maxspeed(victimID, speed)

Then i have a task to reset it using pdataSpeed -which will be called however necessary in that task.

I've also tried
Code:

new Float:pdataSpeed = get_pdata(victimID, m_flWeaponSpeed, linux)
Also returns 0.0000

ConnorMcLeod 08-24-2012 15:12

Re: Weapon's max speed
 
Reset speed :

ExecuteHamB(Ham_CS_Player_ResetMaxspeed, id)


All times are GMT -4. The time now is 05:45.

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