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

native "get_user_weapon"


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
HowToRuski
Senior Member
Join Date: Feb 2019
Location: Hungary
Old 04-02-2023 , 02:50   native "get_user_weapon"
Reply With Quote #1

Im having errors on my console with this script... Am i doing something wrong?
Script itself compiles without errors or warnings, but in-game it does.
PHP Code:
public TakeDamagethis idinflictor idattacker Float:damage damagebits )
{
    if ( 
get_user_weaponidattacker ) == CSW_AWP//the run time error starts here (line 13)
    
{
        
SetHamParamFloatdamage )
    }
    else if ( 
get_user_weaponidattacker ) == CSW_KNIFE)
    {
        
SetHamParamFloatdamage 1.5)
    }
    else if (
get_user_weapon(idattacker) == CSW_HEGRENADE)
    {
        if( 
idattacker == idinflictor ){
            return 
HAM_IGNORED;
        }

        
SetHamParamFloatdamage 6)

    }
    else
    {
        
SetHamParamFloatdamage )
        return 
HAM_HANDLED;
    }
    return 
HAM_IGNORED;

PHP Code:
Run time error 10native error (native "get_user_weapon")
[
0dmgmultiplier.sma::TakeDamage (line 13
HowToRuski is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 04-02-2023 , 05:21   Re: native "get_user_weapon"
Reply With Quote #2

Post the full error log. You may need to ensure that idattacker is a player before calling get_user_weapon.
__________________
HamletEagle is offline
HowToRuski
Senior Member
Join Date: Feb 2019
Location: Hungary
Old 04-02-2023 , 05:24   Re: native "get_user_weapon"
Reply With Quote #3

Quote:
Originally Posted by HamletEagle View Post
Post the full error log. You may need to ensure that idattacker is a player before calling get_user_weapon.
i think it shows an error when someone takes damage from falling, how do i define that?
HowToRuski is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 04-02-2023 , 17:08   Re: native "get_user_weapon"
Reply With Quote #4

PHP Code:
#define DMG_FALL    (1<<5)

public TakeDamagethis idinflictor idattacker Float:damage damagebits )
{
    new 
bool:bDmgUpdated;
    
    if ( !( 
damagebits DMG_FALL ) )
    {
        new 
iAttackerWeapon get_user_weaponidattacker );
        
bDmgUpdated true;
        
        switch ( 
iAttackerWeapon )
        {
            
//case CSW_AWP: //This is not needed as setting the damage to damage * 1 is the same as regular damage.
            //{
            //    SetHamParamFloat( 4 , damage * 1.0 )
            //}
            
case CSW_KNIFE:
            {
                
SetHamParamFloatdamage 1.5 )
            }
            case 
CSW_HEGRENADE:
            {
                if( 
idattacker != idinflictor )
                {
                    
SetHamParamFloatdamage 6.0 )
                }
            }
            default:
            {
                
SetHamParamFloatdamage 3.0 )
            }
        }
    }
    
    return 
bDmgUpdated HAM_HANDLED HAM_IGNORED;

__________________

Last edited by Bugsy; 04-02-2023 at 17:09.
Bugsy 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 17:05.


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