Raised This Month: $ Target: $400
 0% 

armor drain


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Mini_Midget
Veteran Member
Join Date: Jan 2006
Location: It's a mystery.
Old 06-30-2006 , 04:12   armor drain
Reply With Quote #1

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 }
__________________
It's a mystery.
Mini_Midget is offline
Hawk552
AMX Mod X Moderator
Join Date: Aug 2005
Old 06-30-2006 , 12:25   Re: armor drain
Reply With Quote #2

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 }
__________________
Hawk552 is offline
Send a message via AIM to Hawk552
Mini_Midget
Veteran Member
Join Date: Jan 2006
Location: It's a mystery.
Old 07-05-2006 , 05:54   Re: armor drain
Reply With Quote #3

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?
__________________
It's a mystery.
Mini_Midget is offline
Cheap_Suit
Veteran Member
Join Date: May 2004
Old 07-05-2006 , 06:29   Re: armor drain
Reply With Quote #4

AFAIK you cant modify the damage directly. One thing you can try is redirect the damage in the leg or arm.
__________________
HDD fried, failed to backup files. Sorry folks, just don't have free time anymore. This is goodbye.
Cheap_Suit is offline
Hawk552
AMX Mod X Moderator
Join Date: Aug 2005
Old 07-05-2006 , 11:04   Re: armor drain
Reply With Quote #5

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)
__________________
Hawk552 is offline
Send a message via AIM to Hawk552
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 07:56.


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