Raised This Month: $ Target: $400
 0% 

Weapon's max speed


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Liverwiz
Veteran Member
Join Date: Feb 2010
Location: Maryland
Old 08-24-2012 , 12:07   Weapon's max speed
Reply With Quote #1

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?
__________________
What an elegant solution to a problem that doesn't need solving....
Liverwiz is offline
dark_style
Senior Member
Join Date: Jul 2009
Location: Bulgaria
Old 08-24-2012 , 12:20   Re: Weapon's max speed
Reply With Quote #2

https://forums.alliedmods.net/showthread.php?t=94331

Sorry if I missunderstood what you are trying to do.

Last edited by dark_style; 08-24-2012 at 12:24.
dark_style is offline
NiHiLaNTh
Way Past Expiration
Join Date: May 2009
Location: Latvia
Old 08-24-2012 , 12:37   Re: Weapon's max speed
Reply With Quote #3

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;
}
__________________


Last edited by NiHiLaNTh; 08-24-2012 at 12:37.
NiHiLaNTh is offline
Send a message via Skype™ to NiHiLaNTh
Liverwiz
Veteran Member
Join Date: Feb 2010
Location: Maryland
Old 08-24-2012 , 12:40   Re: Weapon's max speed
Reply With Quote #4

Quote:
Originally Posted by dark_style View Post
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 View Post
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
__________________
What an elegant solution to a problem that doesn't need solving....

Last edited by Liverwiz; 08-24-2012 at 13:16.
Liverwiz is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 08-24-2012 , 15:12   Re: Weapon's max speed
Reply With Quote #5

Reset speed :

ExecuteHamB(Ham_CS_Player_ResetMaxspeed, id)
__________________
- tired and retired -

- my plugins -
ConnorMcLeod 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 05:45.


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