PDA

View Full Version : get player armor & hp


Mandiii
06-09-2010, 18:58
For use like:

playerhp++
playerarmor++

Kreation
06-09-2010, 19:03
What?

Mandiii
06-09-2010, 19:19
Im sorry, what should you write to return a players hp and armor?

Kreation
06-09-2010, 19:22
HP:
http://www.amxmodx.org/funcwiki.php?search=get_user_health&go=search

Armor:
http://www.amxmodx.org/funcwiki.php?search=cs_get_user_armor&go=search

Or

http://www.amxmodx.org/funcwiki.php?go=func&id=149

Not sure which one is better to use for the armor.

GXLZPGX
06-09-2010, 22:21
HP:
http://www.amxmodx.org/funcwiki.php?search=get_user_health&go=search

Armor:
http://www.amxmodx.org/funcwiki.php?search=cs_get_user_armor&go=search

Or

http://www.amxmodx.org/funcwiki.php?go=func&id=149

Not sure which one is better to use for the armor.

get_user_health
cs_get_user_armor

for cs_get_user_armor use #include <cstrike>

Mandiii
06-10-2010, 10:27
I get a warning from this code.

(213) "Tag mismatch" warning

#include <amxmodx>
#include <cstrike>

#define VERSION "0.1"

public plugin_init()
{
register_plugin("armor", VERSION, "Mandiii")
}

public client_death(killer)
{
new CsArmorType:ArmorType = 2
new Armor = cs_get_user_armor(killer, ArmorType)
Armor += 20
}

GXLZPGX
06-10-2010, 11:40
I get a warning from this code.

(213) "Tag mismatch" warning

#include <amxmodx>
#include <cstrike>

#define VERSION "0.1"

public plugin_init()
{
register_plugin("armor", VERSION, "Mandiii")
}

public client_death(killer)
{
new CsArmorType:ArmorType = 2
new Armor = cs_get_user_armor(killer, ArmorType)
Armor += 20
}

Why are you trying to set a players armor when they are dead?

Mandiii
06-10-2010, 11:51
Oh shit, forgot that. :p

Edit: still doesnt solve my problem though.

RedRobster
06-10-2010, 14:25
Try this:

#include <amxmodx>
#include <cstrike>

#define VERSION "0.1"

public plugin_init()
{
register_plugin("armor", VERSION, "Mandiii")
}

public client_death(victim)
{
new killer = get_user_attacker(victim)

new CsArmorType:ArmorType
new Armor = cs_get_user_armor(killer, ArmorType)
cs_set_user_armor(killer,(Armor + 20),ArmorType)
}

I changed 3 things. 1: I defined a killer by getting the attacker of the victim. 2: I removed the "= 2" after you created the ArmorType. 3: I made it so that it added the armor to the killer instead of just adding 20 to "Armor".