Raised This Month: $ Target: $400
 0% 

Damage and Money


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
alan_el_more
Veteran Member
Join Date: Jul 2008
Location: amxmodx-es.com
Old 10-19-2009 , 17:55   Re: Damage and Money
Reply With Quote #1

Try this
PHP Code:
#include <amxmodx>
#include <cstrike>
#include <hamsandwich>

#define PLUGIN "Money DMG"
#define VERSION "1.0"
#define AUTHOR "alan_el_more"

#define DAMAGE 2
#define MONEY 300

new g_maxplayers
new g_damage_done[33]

public 
plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
g_maxplayers get_maxplayers()
    
    
RegisterHam(Ham_TakeDamage"player""fw_TakeDamage")
}

public 
fw_TakeDamage(victiminflictorattackerFloat:damagedamage_type)
{
    if((
<= attacker <= g_maxplayers) && attacker != victim)
    {
        
g_damage_done[attacker] += floatround(damage)
        
        while(
g_damage_done[attacker] >= DAMAGE)
        {
            
cs_set_user_money(attackercs_get_user_money(attacker) + MONEY)
            
g_damage_done[attacker] -= DAMAGE
        
}
    }

__________________
alan_el_more is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 10-19-2009 , 18:04   Re: Damage and Money
Reply With Quote #2

Code:
#include < amxmodx > #include < amxmisc > #include < cstrike > #include < engine > #include < hamsandwich > const Float:MONEY_PER_HP = 2.0; // $2 / 1HP new g_iMaxPlayers; public plugin_init( ) {     register_plugin( "Damage for Money", "0.0.1", "Exolent" );         RegisterHam( Ham_TakeDamage, "player", "FwdPlayerDamage", 1 );         g_iMaxPlayers = get_maxplayers( ); } public FwdPlayerDamage( iVictim, iInflictor, iAttacker, Float:fDamage, iDamageBits ) {     if( !( 1 <= iAttacker <= g_iMaxPlayers ) ) {         return;     }         new Float:fRealDamage = entity_get_float( iVictim, EV_FL_dmg_take );     if( cs_get_user_team( iVictim ) == cs_get_user_team( iAttacker ) ) {         fRealDamage *= -1.0;     }         cs_set_user_money( iAttacker, cs_get_user_money( iAttacker ) + floatround( MONEY_PER_HP * fRealDamage ) ); }
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] 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:43.


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