Raised This Month: $51 Target: $400
 12% 

Run time error


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
RAW_192
Senior Member
Join Date: Feb 2017
Old 07-30-2017 , 12:49   Run time error
Reply With Quote #1

Quote:
L 07/30/2017 - 12:40:55: Invalid player id 0
L 07/30/2017 - 12:40:55: [AMXX] Displaying debug trace (plugin "hamEvents.amxx")
L 07/30/2017 - 12:40:55: [AMXX] Run time error 10: native error (native "get_user_weapon")
L 07/30/2017 - 12:40:55: [AMXX] [0] hamEvents.sma::fw_HamKilledPost (line 46)
PHP Code:
    public fw_HamKilledPostiVictimiAttackeriShouldGib 
    {
        new 
point get_user_point(iAttacker)    
        if( ! ( 
is_user_connectediVictim ) || is_user_connectediAttacker ) ) )
        return 
HAM_IGNORED ;
        
        if( 
get_user_weaponiAttacker ) == CSW_KNIFE )
        {
        
client_print_coloriAttackerprint_chat"^4 --------------Knife Kill Detected---------");
        
set_user_point(iAttackerpoint+20)
        }
        
        return 
HAM_IGNORED
    

RAW_192 is offline
TBagT
Member
Join Date: Aug 2016
Location: Lithuania
Old 07-30-2017 , 13:03   Re: Run time error
Reply With Quote #2

Try this
PHP Code:
#define is_a_valid_player(%1) (1<=%1<=g_max_players)

new g_max_players;

public 
plugin_init( ) {
        
// ... //
        
g_max_players get_maxplayers( );
}

public 
fw_HamKilledPostiVictimiAttackeriShouldGib ) { 
        if( !
is_a_valid_playeriAttacker ) || iVictim == iAttacker )
                return 
HAM_IGNORED;

        new 
point get_user_pointiAttacker );
        if( 
get_user_weaponiAttacker ) == CSW_KNIFE ) { 
                
client_print_coloriAttackerprint_chat"^4 --------------Knife Kill Detected---------" ); 
                
set_user_pointiAttackerpoint 20 );
        } 

        return 
HAM_IGNORED;


Last edited by TBagT; 07-30-2017 at 13:19. Reason: v2
TBagT is offline
siriusmd99
Veteran Member
Join Date: Oct 2013
Location: Republic of Moldova
Old 07-30-2017 , 14:48   Re: Run time error
Reply With Quote #3

You can check if attacker is alive and then get weapon.Dead players don't have weapons in hands...
siriusmd99 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 04:42.


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