Raised This Month: $ Target: $400
 0% 

Invalid player id 0


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 12-20-2014 , 13:05   Re: Invalid player id 0
Reply With Quote #1

@RateX, I just explained what Yami told him, not taking into account his code.
__________________

Last edited by HamletEagle; 12-20-2014 at 13:06.
HamletEagle is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 12-20-2014 , 13:28   Re: Invalid player id 0
Reply With Quote #2

Not thoroughly tested but it appears to work. Might need some minor tweaks.
PHP Code:
#include <amxmodx>
#include <hamsandwich>

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

#define DMG_FALL    (1<<5)

new g_MaxPlayers;

public 
plugin_init() 
{
    
RegisterHamHam_TakeDamage "player" "fw_PlayerTakeDamage" );
    
    
g_MaxPlayers get_maxplayers();
}


public 
fw_PlayerTakeDamagethis idinflictor idattackerFloat:damagedamagebits)
{
    if ( !
is_user_alivethis ) )
        return 
HAM_IGNORED;
    
    if( 
damagebits DMG_FALL )
    {
        
damage -= 20.0
        
client_printthis print_chat "fixed fall damage" );
    }
    else if( 
IsPlayeridattacker ) && ( this != idattacker ) ) 
    {
        
damage += ( get_user_weaponidattacker ) == CSW_KNIFE ) ? 50.0 30.0;
        
client_printthis print_chat "fixed weapon damage" );
    }
    else 
    {
        
damage 0.0;
        
client_printthis print_chat "fixed self inflicted grenade damage" );
    }
    
    
SetHamParamFloatdamage );
    
    return 
HAM_HANDLED;

__________________

Last edited by Bugsy; 12-20-2014 at 13:29.
Bugsy is offline
KiLLeR.
Senior Member
Join Date: Jul 2014
Location: Bulgaria
Old 12-24-2014 , 11:07   Re: Invalid player id 0
Reply With Quote #3

Quote:
Originally Posted by Bugsy View Post
Not thoroughly tested but it appears to work. Might need some minor tweaks.
PHP Code:
#include <amxmodx>
#include <hamsandwich>

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

#define DMG_FALL    (1<<5)

new g_MaxPlayers;

public 
plugin_init() 
{
    
RegisterHamHam_TakeDamage "player" "fw_PlayerTakeDamage" );
    
    
g_MaxPlayers get_maxplayers();
}


public 
fw_PlayerTakeDamagethis idinflictor idattackerFloat:damagedamagebits)
{
    if ( !
is_user_alivethis ) )
        return 
HAM_IGNORED;
    
    if( 
damagebits DMG_FALL )
    {
        
damage -= 20.0
        
client_printthis print_chat "fixed fall damage" );
    }
    else if( 
IsPlayeridattacker ) && ( this != idattacker ) ) 
    {
        
damage += ( get_user_weaponidattacker ) == CSW_KNIFE ) ? 50.0 30.0;
        
client_printthis print_chat "fixed weapon damage" );
    }
    else 
    {
        
damage 0.0;
        
client_printthis print_chat "fixed self inflicted grenade damage" );
    }
    
    
SetHamParamFloatdamage );
    
    return 
HAM_HANDLED;

The error from first post is removed, but here:
PHP Code:
damage 0.0;
client_printthis print_chat "fixed self inflicted grenade damage" ); 
I don't want to remove self inflicted grenade damage, i want to reduce taken damage by the other enemies!
KiLLeR. 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 15:18.


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