AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Depleting armor bot issue (https://forums.alliedmods.net/showthread.php?t=159394)

Jelle 06-16-2011 16:01

Depleting armor bot issue
 
So, I want to make a plugin where the armor is depleted before health in cs 1.6. I have made this:

PHP Code:

#include <amxmodx>
#include <csx>
#include <fun>

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

public 
client_damage(attackervictimdamage)
{
    
client_print(victimprint_chat"client_damage forward has run")
    
//if damage is bigger than armor
    
new armor get_user_armor(victim)
    if ( 
damage armor )
    {
        
client_print(victimprint_chat"Damage is now bigger than 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 )
    {
        
client_print(victimprint_chat"Damage is now lower than armor")
        
//deplete armor with the damage taken
        
set_user_armor(victimarmor damage)
        
        
//remember to give the health back
        
set_user_health(victimget_user_health(victim) + damage)
    }
    
    
//any other case
    
else
    {
        
//do nothing
        
return
    }


The reason why I am asking here is because it works very well for me (not on fall damage since client_damage doesn't run on fall damage apparently), but the bots I am playing with on my server, they just die instantly once I shoot them. Is this just a problem with the bots or my code?
As you can see I have added a few client_print for debugging (I forgot get_user_health() in set_user_health so it would set the damage as health).
Anyone?


All times are GMT -4. The time now is 23:29.

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