AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   armor drain (https://forums.alliedmods.net/showthread.php?t=40600)

Mini_Midget 06-30-2006 04:12

armor drain
 
it compiles with no errors but has no effect ingame
anyone know whats wrong cause i have no clue
Code:
    register_event("Damage", "armor_drain", "be") public armor_drain(id)     {     if(!is_user_alive(id) && !is_user_connected(id)) {         return PLUGIN_CONTINUE     }         new shield = get_user_armor(id)     new hp = get_user_health(id)     if(shield > 10)         {         new dmg = read_data(2)         new value = (shield - (dmg / 2))         if(value < 0) {             dmg += value         }         set_user_armor(id,clamp(value, 0, 255))         set_user_health(id,hp + dmg)     }     return PLUGIN_CONTINUE }

Hawk552 06-30-2006 12:25

Re: armor drain
 
This works perfectly for me:

Code:
#include <amxmodx> #include <amxmisc> #include <cstrike> #include <fun> public plugin_init()     register_event("Damage","armor_drain","be") public armor_drain(id) {     if(!is_user_alive(id) || !is_user_connected(id))         return PLUGIN_CONTINUE         new CsArmorType:catArmor,iArmor = cs_get_user_armor(id,catArmor),iHealth = get_user_health(id)     if(iArmor < 10)         return PLUGIN_CONTINUE             new iDamage = read_data(2)     new iValue = iArmor - (iDamage / 2)     if(iValue < 0)         iDamage += iValue             set_user_armor(id,clamp(iValue,0,255))     set_user_health(id,iHealth + iDamage)         return PLUGIN_CONTINUE }

Mini_Midget 07-05-2006 05:54

Re: armor drain
 
i've been testing it and found a bug
whenever i do a damage over 100
the victim dies instantly,
is there anyway to fix this besides lower the damage down?

Cheap_Suit 07-05-2006 06:29

Re: armor drain
 
AFAIK you cant modify the damage directly. One thing you can try is redirect the damage in the leg or arm.

Hawk552 07-05-2006 11:04

Re: armor drain
 
Quote:

Originally Posted by Cheap_Suit
AFAIK you cant modify the damage directly. One thing you can try is redirect the damage in the leg or arm.

You can also give them 1124 HP (or something like that) and then kill them when they take more than 100 or whatever value you want, but that's a really stupid method IMO (although I used to use it, a lot)


All times are GMT -4. The time now is 07:56.

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