Raised This Month: $ Target: $400
 0% 

Get shooting


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Backstabnoob
BANNED
Join Date: Feb 2009
Location: Iwotadai Dorm
Old 06-10-2010 , 15:08   Get shooting
Reply With Quote #1

Is there any event, which is called when player shoots from his weapon or an equal code?
I do not mean CurArray, I mean when someone shoots from weapon.
Backstabnoob is offline
fezh
Veteran Member
Join Date: Dec 2008
Location: BANNED
Old 06-10-2010 , 15:12   Re: Get shooting
Reply With Quote #2

Ham_Weapon_PrimaryAttack ?
__________________
"There is no knowledge, that is not power"
fezh is offline
Backstabnoob
BANNED
Join Date: Feb 2009
Location: Iwotadai Dorm
Old 06-10-2010 , 15:44   Re: Get shooting
Reply With Quote #3

Quote:
Originally Posted by fezh View Post
Ham_Weapon_PrimaryAttack ?
What should I return when I want to block the attack? Sorry, kinda noob in returns of hamsandwich.
Backstabnoob is offline
wrecked_
Veteran Member
Join Date: Jan 2010
Location: New York (GMT-5)
Old 06-10-2010 , 15:45   Re: Get shooting
Reply With Quote #4

Quote:
Originally Posted by Backstabnoob View Post
What should I return when I want to block the attack? Sorry, kinda noob in returns of hamsandwich.
When you hook it, make sure it's Pre (4th param of RegisterHam as default or 0) then return HAM_SUPERCEDE in the function.
__________________
[ Paid Requests ]
DO NOT PM ME ABOUT BLOCKMAKER
NO PRIVATE SUPPORT
wrecked_ is offline
wrecked_
Veteran Member
Join Date: Jan 2010
Location: New York (GMT-5)
Old 06-10-2010 , 15:18   Re: Get shooting
Reply With Quote #5

FM_CmdStart, IN_ATTACK
__________________
[ Paid Requests ]
DO NOT PM ME ABOUT BLOCKMAKER
NO PRIVATE SUPPORT
wrecked_ is offline
Backstabnoob
BANNED
Join Date: Feb 2009
Location: Iwotadai Dorm
Old 06-10-2010 , 16:06   Re: Get shooting
Reply With Quote #6

PHP Code:
    RegisterHam(Ham_Weapon_PrimaryAttack"player""Ham_PrimaryAttackHook"
PHP Code:
public Ham_PrimaryAttackHook(id)
{
    if(
g_Holster[id])
        return 
HAM_SUPERCEDE
    
    
return HAM_IGNORED

Does not work. (g_Holster[id] is 1)

Edit: Looks like it's not even called.

PHP Code:
public Ham_PrimaryAttackHook(id)
{
client_print(idprint_console"[Debug] Ham_PrimaryAttackHook: CALLED")
    if(
g_Holster[id])
        return 
HAM_SUPERCEDE
    
    
return HAM_IGNORED

nothing shows up in the console.

Last edited by Backstabnoob; 06-10-2010 at 16:36.
Backstabnoob is offline
Brreaker
Senior Member
Join Date: Oct 2009
Location: Constanta, Romania
Old 06-10-2010 , 16:41   Re: Get shooting
Reply With Quote #7

use console_print(id, "message");
__________________
There are 10 kinds of people.Those who understand binary, and those who don't.
Also, for those who understand binary, there is a donation tab too!
No steam || PM support!
Brreaker is offline
Send a message via MSN to Brreaker Send a message via Yahoo to Brreaker
Emp`
AMX Mod X Plugin Approver
Join Date: Aug 2005
Location: Decapod 10
Old 06-10-2010 , 16:41   Re: Get shooting
Reply With Quote #8

You have to register the ham with the weapon entity ("weapon_*"), not the player.
Emp` is offline
Send a message via AIM to Emp` Send a message via MSN to Emp` Send a message via Yahoo to Emp` Send a message via Skype™ to Emp`
Backstabnoob
BANNED
Join Date: Feb 2009
Location: Iwotadai Dorm
Old 06-10-2010 , 16:42   Re: Get shooting
Reply With Quote #9

And if I want all weapons?
Backstabnoob is offline
wrecked_
Veteran Member
Join Date: Jan 2010
Location: New York (GMT-5)
Old 06-10-2010 , 16:55   Re: Get shooting
Reply With Quote #10

Code:
public plugin_init() {     new wname[32]     for( new i = CSW_P228; i <= CSW_P90; i++ )     {         if( i != 2 )         {             get_weaponname( i, wname, 31 )             // format( wname, 31, "weapon_%s", wname )             RegisterHam( Ham_Weapon_PrimaryAttack, wname, "HamPrimaryAttackPre", 0 )         }     } }

Wasn't sure as to how get_weaponname() formats the return string. Let me know if it doesn't include weapon_, in which case you'd just have to uncomment that line with formatex().
__________________
[ Paid Requests ]
DO NOT PM ME ABOUT BLOCKMAKER
NO PRIVATE SUPPORT

Last edited by wrecked_; 06-11-2010 at 15:26.
wrecked_ 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 05:23.


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