Raised This Month: $ Target: $400
 0% 

Put Ham_TookDamage in a function


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
TitANious
Veteran Member
Join Date: Feb 2009
Location: Denmark
Old 06-27-2009 , 13:33   Put Ham_TookDamage in a function
Reply With Quote #1

I need to get Ham_TookDamage activated ONLY if they bought from a menu.
PHP Code:
#include <amxmodx>
#include <cstrike>
#include <fun>
#include <hamsandwich>

public plugin_init( )
{
    
register_plugin"Damage","1.0","TitANious" )

    
RegisterHamHam_TakeDamage"player""Player_TookDamage" )
}

public 
Player_TookDamageiVictimiInflictoriAttackerFloat:DamageiDamage_type )
{
    if( !
is_user_aliveiAttacker ) || cs_get_user_teamiAttacker ) == cs_get_user_teamiVictim ) )
        return 
PLUGIN_HANDLED;
        
    if( ( 
iDamage_type & ( 1<<) ) )
    {
        
set_user_healthiAttackerfloatroundFloat:get_user_healthiAttacker ) + Damage ) )
        
client_printiAttackerprint_chat"You got %d extra hp for damaging"Damage )
    }
    return 
PLUGIN_CONTINUE

__________________
I dislike this.

"A sneeze never comes alone!" <-- Important to remember.
TitANious is offline
Send a message via MSN to TitANious
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 06-27-2009 , 13:35   Re: Put Ham_TookDamage in a function
Reply With Quote #2

Use a var since you can't (un)activate depending a player. (because registered by class)
__________________
Arkshine is offline
TitANious
Veteran Member
Join Date: Feb 2009
Location: Denmark
Old 06-27-2009 , 13:39   Re: Put Ham_TookDamage in a function
Reply With Quote #3

What you mean by using a var? (What is a var, like Cvar?)
I thought of using a bool. Like:
PHP Code:
if( GotSomething == true )

__________________
I dislike this.

"A sneeze never comes alone!" <-- Important to remember.
TitANious is offline
Send a message via MSN to TitANious
SnoW
Veteran Member
Join Date: Oct 2008
Location: Finland WisdomNuggets: 8
Old 06-27-2009 , 14:02   Re: Put Ham_TookDamage in a function
Reply With Quote #4

Ye, boolean is a one type of a var. Var means variable.
SnoW is offline
Send a message via MSN to SnoW
xPaw
Retired AMX Mod X Moderator
Join Date: Jul 2008
Old 06-27-2009 , 14:14   Re: Put Ham_TookDamage in a function
Reply With Quote #5

You cant return PLUGIN_* on Ham forwards check ham_const.inc
__________________
xPaw is offline
alan_el_more
Veteran Member
Join Date: Jul 2008
Location: amxmodx-es.com
Old 06-27-2009 , 14:42   Re: Put Ham_TookDamage in a function
Reply With Quote #6

try this

PHP Code:
#include <amxmodx>
#include <cstrike>
#include <fun>
#include <hamsandwich>

public plugin_init( )
{
    
register_plugin"Damage","1.0","TitANious" )

    
RegisterHamHam_TakeDamage"player""Player_TookDamage" )
}

public 
Player_TookDamageiVictimiInflictoriAttackerFloat:DamageiDamage_type )
{
    if( !
is_user_aliveiAttacker ) || cs_get_user_teamiAttacker ) == cs_get_user_teamiVictim ) )
        return 
HAM_IGNORED;
        
    if( ( 
iDamage_type & ( 1<<) ) )
    {
        
set_user_healthiAttackerfloatroundFloat:get_user_healthiAttacker ) + Damage ) )
        
client_printiAttackerprint_chat"You got %d extra hp for damaging"Damage )
    }
    return 
HAM_IGNORED

__________________
alan_el_more is offline
TitANious
Veteran Member
Join Date: Feb 2009
Location: Denmark
Old 06-27-2009 , 14:45   Re: Put Ham_TookDamage in a function
Reply With Quote #7

It was not because it wasen't working
__________________
I dislike this.

"A sneeze never comes alone!" <-- Important to remember.
TitANious is offline
Send a message via MSN to TitANious
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:36.


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