How do I determine when a bullet is fired?
All I want to know is when someone presses the trigger. Now I could catch CurWeapon, except that is called while changing weapons.
I could also catch IN_ATTACK but that could register when someone is pressing attack but bullets aren't fired (i.e. while reloading). Is there any for-sure way of determining this? |
Maybe try catching IN_ATTACK in client_PreThink(), saveing the client's clip ammount to a variable, and then in client_PostThink() check if the client's clip is 1 less than the variable from earlier.
That's just speculation, hopefully it'll give you some more ideas for solving the problem. |
brilliant :) That'll work perfect, now I need to determine how to get the user's clip from an amxmodx module :P
|
its easier to just use CurWeapon and save the clip ammount in a global variable, if the clip ammount is less than the last time it got checked they just fired a bullet.
Code:
new lastclip[33] |
Yea it's just not so easy to get that data in an amxx module. At least I'm not very good at it :/
|
hmmm.. maybe this isnt the best way but...
Code:
new oldclip[33]or even make it return if ammo changed or not. Perhaps this is what you mean?? |
Also if you make either of these ways to run as a task....
Put if ( read_data(2) ) { first thing after the function then it will only execute if someone gets hurt. And even link it from Damage event. Or both ... o.O |
thanks but you don't have read_data in an amxx module... I think I'm good now, but I don't think I"ll be able to do this how I want to. B/c I'll have to compare gpGlobals->time and I don't know how great of an option that is.
(I need to execute code in FN_Traceline based on if the user is firing) |
Quote:
|
Quote:
Quote:
Quote:
Quote:
|
| All times are GMT -4. The time now is 19:23. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.