AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   bug in hamsandwich ? (https://forums.alliedmods.net/showthread.php?t=126343)

Voi 05-08-2010 12:01

bug in hamsandwich ?
 
When I hook Ham_Weapon_PrimaryAttack, it is called constantly when im firing pistols until i pull of the attack key. Every other weapon works fine, just the pistols.

If someone didn't understand - When I'm holding attack button when using a pistol, the hook is called every frame. It should be called only once, cause i activated weapon only once.

Could someone fix this ?:P

I did a workaround by sending client cmd "-attack;-attack" each time they fire a pistol. But its still firing that function every frame when someone is holding attack button when using a pistol.

hleV 05-08-2010 12:22

Re: bug in hamsandwich ?
 
Ham_Weapon_PrimaryAttack is called whenever you hold down your primary attack button (+attack).

Bugsy 05-08-2010 12:49

Re: bug in hamsandwich ?
 
This method works great or you can use CurWeapon

http://forums.alliedmods.net/showthread.php?t=54887

ConnorMcLeod 05-08-2010 14:08

Re: bug in hamsandwich ?
 
This is not a bug.

It is sent as soon as m_flPrimaryAttack is <= 0.0

Then, if you look a deagle code decompiled bu arkshine : http://cs-sdk.googlecode.com/svn/trunk/wpn_deagle.cpp

DEAGLEFire is sent.

Then if m_iShotsFired is > 1, not shot is fired.

Basically you have to filter Ham_Weapon_PromaryAttack with offset m_iShotsFired >=1 (>= because i haven't been incremented yet) (m_iShotsFired is 64 + extra linux 4), but this only for deagle and some other pistols, with glock, pay attention on firemode, for other weapons, look at CSSDK first.


All times are GMT -4. The time now is 03:37.

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