Raised This Month: $ Target: $400
 0% 

Check if it is a player (aiming)


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 11-14-2010 , 09:44   Re: Check if it is a player (aiming)
Reply With Quote #1

The weapon entity is passed to the ham forward, not player id. Use pev( iEntity , pev_owner ) to get the player id. You will still get the knife attack animation though no attack is actually occurring.

Untested
PHP Code:
#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>

new g_iMaxPlayers;

#define IsPlayer(%1)    (1<=%1<=g_iMaxPlayers)

public plugin_init() 
{
    
RegisterHamHam_Weapon_PrimaryAttack "weapon_knife" "BlockKnife" );
    
RegisterHamHam_Weapon_SecondaryAttack "weapon_knife" "BlockKnife" );
    
    
g_iMaxPlayers get_maxplayers();
}
public 
BlockKnifeiEntity )
{
    new 
iEnemy iBody iPlayer peviEntity pev_owner );
    
    if ( !
IsPlayeriPlayer ) )
        return 
HAM_IGNORED;
        
    
get_user_aimingiPlayer iEnemy iBody );
     
    return 
IsPlayeriEnemy ) ? HAM_IGNORED HAM_SUPERCEDE;

__________________

Last edited by Bugsy; 11-14-2010 at 09:50.
Bugsy is offline
Hunter-Digital
Veteran Member
Join Date: Aug 2006
Location: In the Game [ro]
Old 11-14-2010 , 13:42   Re: Check if it is a player (aiming)
Reply With Quote #2

Quote:
Originally Posted by Bugsy View Post
You will still get the knife attack animation though no attack is actually occurring.
You could just hook attack in pre and set next attack to 0.1s or so and then it shouldn't play the animation and shouldn't attack either.
__________________
Hunter-Digital is offline
Old 11-14-2010, 14:02
Bugsy
This message has been deleted by Bugsy.
bibu
Veteran Member
Join Date: Sep 2010
Old 11-14-2010 , 17:03   Re: Check if it is a player (aiming)
Reply With Quote #4

Quote:
Originally Posted by Hunter-Digital View Post
You could just hook attack in pre and set next attack to 0.1s or so and then it shouldn't play the animation and shouldn't attack either.
I don't get a knife animation at all. Works perfectly, thanks bugsy.
bibu 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 11:28.


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