Raised This Month: $ Target: $400
 0% 

how to hook if player just shooted?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Voi
Veteran Member
Join Date: Sep 2006
Location: Gdansk, Poland
Old 04-30-2007 , 12:47   how to hook if player just shooted?
Reply With Quote #1

i was using prethink and then in_attack, but its inefficient since i want to hook each bullet not just pressing attack button

so anybody got an idea? i was thinking if i could mb hook weapon sounds thru
FM_EmitSound but i can hook only knife sounds :/
__________________
Voi is offline
VEN
Veteran Member
Join Date: Jan 2005
Old 04-30-2007 , 17:54   Re: how to hook if player just shooted?
Reply With Quote #2

PlaybackEvent hook. This method is more accurate than CurWeapon and TraceLine methods.

Make sure that you don't take in account non-gun events like createsmoke, etc.

In plugin_precache() hook PrecacheEvent and cache necessary event indeces. In plugin_init() unhook PrecacheEvent and hook PlaybackEvent.

EDIT:

You can review [HowTo] Properly catch shot event in CS

Last edited by VEN; 05-06-2007 at 15:26. Reason: added [HowTo] Properly catch shot event in CS
VEN is offline
Voi
Veteran Member
Join Date: Sep 2006
Location: Gdansk, Poland
Old 06-11-2010 , 07:24   Re: how to hook if player just shooted?
Reply With Quote #3

Which method is better ?
PlaybackEvent hook or Ham_Weapon_PrimaryAttack? Which one is called before other and which one would be better to control recoil ?
__________________
Voi is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 06-11-2010 , 07:32   Re: how to hook if player just shooted?
Reply With Quote #4

The first.
__________________
Arkshine is offline
Voi
Veteran Member
Join Date: Sep 2006
Location: Gdansk, Poland
Old 06-11-2010 , 08:28   Re: how to hook if player just shooted?
Reply With Quote #5

Could you explain why ?
__________________
Voi is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 06-11-2010 , 08:36   Re: how to hook if player just shooted?
Reply With Quote #6

PrimaryAttack is called a lot of times when you hold +attack/2 when the event is called only one time by bullet ; for your need it would be better to use the event.
__________________
Arkshine 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 03:12.


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