Raised This Month: $ Target: $400
 0% 

[REQ]armor first , hp second


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Jelle
[b]MOAR CANDY[/b]
Join Date: Aug 2009
Location: Denmark
Old 06-10-2011 , 08:14   Re: [REQ]armor first , hp second
Reply With Quote #4

PHP Code:
#include <amxmodx>
#include <csx>
#include <fun>

public plugin_init()
{
    
register_plugin("Deplete armor before health""1.0""Jelle")
}

public 
client_damage(attackervictimdamage)
{
    
//if damage is bigger than armor
    
new armor get_user_armor(victim)
    if ( 
damage armor )
    {
        
//first calculate how much life to deplete
        
new depleteHealth damage armor
        
        
//set armor to 0
        
set_user_armor(victim0)
        
        
//then deplete the life
        
set_user_health(victimget_user_health(victim) - depleteHealth)
    }
    
    
//if armor is bigger than damage
    
else if ( armor damage )
    {
        
//deplete armor with the damage taken
        
set_user_armor(victimarmor damage)
        
        
//remember to give the health back
        
set_user_health(victimdamage)
    }
    
    
//any other case
    
else
    {
        
//do nothing
        
return
    }

untested.
__________________
No idea what to write here...
Jelle is offline
Send a message via MSN to Jelle
 



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 22:07.


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