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

Damage and Money


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
OneMoreLevel
Senior Member
Join Date: Aug 2009
Location: Look behind you... Very
Old 10-19-2009 , 17:40   Damage and Money
Reply With Quote #1

Is there a way I can make people get money each time they DMG someone? I want to be able to make it so that people get 2 dollars each HP they kill. Like if they hit 30 DMG against someone, they would get 60 dollars

EDIT: Is there a way to hook round start with hamsandwich too?
__________________
60/100 60%
[||||||||||||||||||||]
Project: Warfighter mod
Blog:
http://sites.google.com/site/dailymultitasker/
PHP Code:
   if ( i_help_you "Yes" ) == )
    
set_user_karma(onemorelevel,add,+1

Last edited by OneMoreLevel; 10-19-2009 at 17:55.
OneMoreLevel is offline
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 #2

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
OneMoreLevel
Senior Member
Join Date: Aug 2009
Location: Look behind you... Very
Old 10-19-2009 , 17:59   Re: Damage and Money
Reply With Quote #3

Thanks Ill test it out, so far it compiles, Ill try to test it on my server real quick.
__________________
60/100 60%
[||||||||||||||||||||]
Project: Warfighter mod
Blog:
http://sites.google.com/site/dailymultitasker/
PHP Code:
   if ( i_help_you "Yes" ) == )
    
set_user_karma(onemorelevel,add,+1
OneMoreLevel 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 #4

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
OneMoreLevel
Senior Member
Join Date: Aug 2009
Location: Look behind you... Very
Old 10-19-2009 , 19:07   Re: Damage and Money
Reply With Quote #5

Thanks guys

I hope you dont mind me asking another quick thing.

How can I play a sound so that everyone in the server can hear it, not just the surrounding area or the client.
__________________
60/100 60%
[||||||||||||||||||||]
Project: Warfighter mod
Blog:
http://sites.google.com/site/dailymultitasker/
PHP Code:
   if ( i_help_you "Yes" ) == )
    
set_user_karma(onemorelevel,add,+1
OneMoreLevel 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 03:02.


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