Raised This Month: $ Target: $400
 0% 

Detect Shoot


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
ironskillz1
AlliedModders Donor
Join Date: Jul 2012
Location: Sweden
Old 06-04-2013 , 10:52   Detect Shoot
Reply With Quote #1

Why doesnt it print in the chat when i shoot with a USP?
it doesnt print anything

Code:
RegisterHam( Ham_Weapon_PrimaryAttack, "weapon_usp", "Ham_Attack" )
Code:
public Ham_Attack( entity )
{
 new id = get_pdata_cbase( entity, 41, 4 )
 
 ColorChat(0, GREY, "Start 1")
 
 if( is_user_alive( id ) )
 {
  ColorChat(0, GREY, "Start 2")
  if( !cs_get_weapon_ammo( entity) )
  
  ColorChat(0, GREY, "Start 3")
  if( GAME_LASER <= CurrentGame)
  {
   ColorChat(0, GREY, "Start 4")
   Player_ShootLaser(id)
   set_pdata_float(entity, 47, 9999.0, 4 )
  }
 }
 return HAM_IGNORED
}
__________________
I have many private and unique plugins for Jailbreak and Hide'N'Seek. PM me for more info.

Pm me.

Check out my roulette site.
ironskillz1 is offline
Send a message via Skype™ to ironskillz1
hornet
AMX Mod X Plugin Approver
Join Date: Mar 2010
Location: Australia
Old 06-04-2013 , 10:54   Re: Detect Shoot
Reply With Quote #2

Retrieve pev_owner with pev().
__________________
Quote:
vBulletin Tip #42: Not much would be accomplished by merging this item with itself.

Last edited by hornet; 06-04-2013 at 10:56.
hornet is offline
TheDS1337
Veteran Member
Join Date: Jun 2012
Old 06-04-2013 , 10:58   Re: Detect Shoot
Reply With Quote #3

I think this is not the write forwards to use it to detect when you shoot, try use TraceAttack
TheDS1337 is offline
hornet
AMX Mod X Plugin Approver
Join Date: Mar 2010
Location: Australia
Old 06-04-2013 , 11:07   Re: Detect Shoot
Reply With Quote #4

Quote:
Originally Posted by DeagLe.Studio View Post
I think this is not the write forwards to use it to detect when you shoot, try use TraceAttack
It can definately be hooked more efficiently for this case. There's a tutorial on "properly catching shot event".
__________________
Quote:
vBulletin Tip #42: Not much would be accomplished by merging this item with itself.
hornet is offline
EpicMonkey
buttmonkey
Join Date: Feb 2012
Old 06-04-2013 , 11:13   Re: Detect Shoot
Reply With Quote #5

RegisterHam( Ham_Weapon_PrimaryAttack, "weapon_usp", "Ham_Attack" )

will be called when +attack is used even if the weapon has 0 ammo

Last edited by EpicMonkey; 06-04-2013 at 13:58.
EpicMonkey is offline
hornet
AMX Mod X Plugin Approver
Join Date: Mar 2010
Location: Australia
Old 06-04-2013 , 19:50   Re: Detect Shoot
Reply With Quote #6

Quote:
Originally Posted by EpicMonkey View Post
RegisterHam( Ham_Weapon_PrimaryAttack, "weapon_usp", "Ham_Attack" )

will be called when +attack is used even if the weapon has 0 ammo
Hence why I said it can be hooked more efficiently ;)
__________________
Quote:
vBulletin Tip #42: Not much would be accomplished by merging this item with itself.
hornet is offline
fl0werD
Senior Member
Join Date: May 2011
Old 06-04-2013 , 20:16   Re: Detect Shoot
Reply With Quote #7

Test my code!
PHP Code:
RegisterHamHam_Weapon_PrimaryAttack"weapon_usp""CUSP__PrimaryAttack_Pre", .Post ); 
PHP Code:
public CUSP__PrimaryAttack_PreiEntity )
{
    if( 
pev_validiEntity ) != )
        return;

    new 
iPlayer get_pdata_cbaseiEntity41 );

    
client_printiPlayerprint_chat"Paukan vzorvis'!!" );

fl0werD is offline
Send a message via ICQ to fl0werD
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 16:22.


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