AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Ham_Weapon_PrimaryAttack Hook Problem/Glitch? (https://forums.alliedmods.net/showthread.php?t=106065)

uxMal 10-11-2009 08:30

Ham_Weapon_PrimaryAttack Hook Problem/Glitch?
 
Hey,

i recently stumbled upon a strange issue with
Code:

RegisterHam(Ham_Weapon_PrimaryAttack,"weapon_deagle","func")
So it's getting executed everytime you shoot with the deagle but if you keep the mouse button pressed (as deagle does not shoot automatically) it gets executed every frame. I don't think its supposed to do so but whatever.

I made a workaround for it checking the bullet count and returning if the count hasn't changed but now are several new problems...

If you keep the button pressed a long time it executes the hook twice(even with the bullet check) because when you shoot you get the old bullet count before the shoot in the hooked function even if you set post hook to true but as it gets executed every frame after some time it gets the new bullet count after the first shot and shoots again....

Also im using this for superhero and because theres automatic reload so clip != 0 but sometimes it displays this in my func and this is glitching it too..

Any ideas on this?

Arkshine 10-11-2009 08:53

Re: Ham_Weapon_PrimaryAttack Hook Problem/Glitch?
 
It supposed to work like that.

Depending your need, you should hook the deagle shoot event. There is a tuto for that. It will be called only when you fire really.

uxMal 10-11-2009 09:03

Re: Ham_Weapon_PrimaryAttack Hook Problem/Glitch?
 
I searched for it but i just found CurWeapon with Clip check which is not accurate (i was using this mehthod before)

So could you provide a link or just tell me your way please?

Arkshine 10-11-2009 09:38

Re: Ham_Weapon_PrimaryAttack Hook Problem/Glitch?
 
http://forums.alliedmods.net/showthread.php?t=54887

ConnorMcLeod 10-11-2009 09:50

Re: Ham_Weapon_PrimaryAttack Hook Problem/Glitch?
 
What do you exactly want to do ?

uxMal 10-11-2009 10:02

Re: Ham_Weapon_PrimaryAttack Hook Problem/Glitch?
 
I want to catch the shot event with the deagle..

The first 3 shots get a tracer and some effects, basically you can take the Hero Noob http://forums.alliedmods.net/showthr...ight=hero+Noob as an example
on every spawn you should have these first 3 shots but for example the method noob is using is glitching all the way


With Ham_Weapon_PrimaryAttack i got everything working except double shot when holding mouse button pressed


So the event i want is just when the deagle shoots a bullet

Arkshine 10-11-2009 10:03

Re: Ham_Weapon_PrimaryAttack Hook Problem/Glitch?
 
Use FM_PlaybackEvent from the link. It's fine for that.

uxMal 10-11-2009 14:06

Re: Ham_Weapon_PrimaryAttack Hook Problem/Glitch?
 
Thanks Problem solved!


All times are GMT -4. The time now is 22:43.

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