AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Player is using weapon (https://forums.alliedmods.net/showthread.php?t=120639)

benamo6 03-06-2010 20:26

Player is using weapon
 
Is there a way to detect if player is using a weapon?
I know about user_has_weapon but it checks if player have the weapon not if he is using it at the moment.
I need this to reset user maxspeed after a speed boost given by set_user_maxspeed(id, 500.0).
If I just set it to 230 (m4a1 and most of primary weapons maxspeed) you will have to switch weapons to get the default weapon maxspeed.
So im wondering if its possible to check if user is using a certain weapon and set the weapon maxspeed to him.

ConnorMcLeod 03-06-2010 20:31

Re: Player is using weapon
 
Put this at the to of plugin :

const Ham:Ham_Player_ResetMaxSpeed = Ham_Item_PreFrame


And when you want to restore player maxspeed do :

ExecuteHamB(Ham_Player_ResetMaxSpeed, id)

The game will check what is the player active weapon and set speed back.

dFF 03-07-2010 03:15

Re: Player is using weapon
 
@ConnorMcLeod what diference:
PHP Code:

RegisterHamHam_Item_PreFrame"player""fw_PlayerReset_MaxSpeed_Post"

and
PHP Code:

const Ham:Ham_Player_ResetMaxSpeed Ham_Item_PreFrame
RegisterHam
Ham_Player_ResetMaxSpeed"player",  "fw_PlayerReset_MaxSpeed_Post"

?

ConnorMcLeod 03-07-2010 04:30

Re: Player is using weapon
 
Readability.
Explaination on the tip is there : http://forums.alliedmods.net/showthr...469#post846469


All times are GMT -4. The time now is 08:40.

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