Raised This Month: $ Target: $400
 0% 

How can use armor as health?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Kation
Junior Member
Join Date: Jul 2009
Location: China,中
Old 07-31-2009 , 09:15   How can use armor as health?
Reply With Quote #1

I only can do this:
Code:
register_event("Damage", "event_damagechaneg", "be")
 
 
public event_damagechaneg(id) {
 new iDamage = read_data(2)
 new playerap = get_user_armor(id)
 new playerhp = get_user_health(id)
 if (playerap - iDamage >= 0 ) {
  cs_set_user_armor(id, playerap - iDamage ,CS_ARMOR_VESTHELM)
  set_user_health(id ,playerhp + iDamage)
 }
 else if ((playerap - iDamage < 0 ) && (playerap + playerhp - iDamage > 0)) {
  cs_set_user_armor(id,0,CS_ARMOR_VESTHELM)
  set_user_health(id ,playerhp + playerap - iDamage)
 }
But, if iDamage > playerhp , then whatever playerap he will dead...
Kation is offline
One
Veteran Member
Join Date: Oct 2008
Location: Hardstyle-eSports.de
Old 07-31-2009 , 10:01   Re: How can use armor as health?
Reply With Quote #2

why u dont get user armor & set_user_health(id, user_armor)? or u mean anything else?

public event_damagechaneg(id)
{
new user_armor = get_user_armor(id)
new g_damage = read_data(2)
new user_health = get_user_health(id)
new new_arm = user_armor + g_damage
if(user_armor - g_damage >= 0)
{
cs_set_user_armor(id,new_arm,CS_ARMOR_VESTHEL M)
}
else if ((user_armor - g_damage <= 0 )&& (user_armor + user_health - g_damage >= 0))
{
cs_set_user_armor(id,0,CS_ARMOR_VESTHELM)
set_user_health(id,new_arm - g_damage)
}
}

test this one. idk if this is realy that what u want. hope could help
__________________
One is offline
Send a message via ICQ to One Send a message via AIM to One Send a message via MSN to One Send a message via Yahoo to One Send a message via Skype™ to One
Kation
Junior Member
Join Date: Jul 2009
Location: China,中
Old 07-31-2009 , 10:30   Re: How can use armor as health?
Reply With Quote #3

Thanks.
But I mean that when you attack me, my armor will reduce as health if armor more than damage.

Example:
My HP100, AP50.
You attack me 30 of damage.
Then I have HP100, AP20.

If My HP20, AP50.
You attack me 60 of damage.
Then I have HP10, AP0.

AP is armor.
HP is health.


My English doesn't very well.
Do you know what I was say?
Kation is offline
Kation
Junior Member
Join Date: Jul 2009
Location: China,中
Old 07-31-2009 , 22:34   Re: How can use armor as health?
Reply With Quote #4

Anybody can help me?
Kation is offline
Owyn
Veteran Member
Join Date: Nov 2007
Old 08-01-2009 , 07:05   Re: How can use armor as health?
Reply With Quote #5

use hamdamage prehook get armor there, the use post hook and see armor taken, replenish it, reduce armor by damage number and supercode damage
__________________
☜ Free Mozy ☂backup\҉sync user
Quote:
Американский форум - Задаёшь вопрос, потом тебе отвечают.
Израильский форум - Задаёшь вопрос, потом тебе задают вопрос.
Русский форум - Задаёшь вопрос, потом тебе долго рассказывают, какой ты мудак.
Owyn is offline
Send a message via ICQ to Owyn
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 18:20.


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