AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   get player armor & hp (https://forums.alliedmods.net/showthread.php?t=129170)

Mandiii 06-09-2010 18:58

get player armor & hp
 
For use like:

Code:

playerhp++
playerarmor++


Kreation 06-09-2010 19:03

Re: get player armor & hp
 
What?

Mandiii 06-09-2010 19:19

Re: get player armor & hp
 
Im sorry, what should you write to return a players hp and armor?

Kreation 06-09-2010 19:22

Re: get player armor & hp
 
HP:
http://www.amxmodx.org/funcwiki.php?...alth&go=search

Armor:
http://www.amxmodx.org/funcwiki.php?...rmor&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

Re: get player armor & hp
 
Quote:

Originally Posted by Kreation (Post 1204532)

get_user_health
cs_get_user_armor

for cs_get_user_armor use #include <cstrike>

Mandiii 06-10-2010 10:27

Re: get player armor & hp
 
I get a warning from this code.

(213) "Tag mismatch" warning

PHP Code:

#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(killerArmorType)
    
Armor += 20



GXLZPGX 06-10-2010 11:40

Re: get player armor & hp
 
Quote:

Originally Posted by Mandiii (Post 1204949)
I get a warning from this code.

(213) "Tag mismatch" warning

PHP Code:

#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(killerArmorType)
    
Armor += 20



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

Mandiii 06-10-2010 11:51

Re: get player armor & hp
 
Oh shit, forgot that. :p

Edit: still doesnt solve my problem though.

RedRobster 06-10-2010 14:25

Re: get player armor & hp
 
Try this:
PHP Code:

#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(killerArmorType)
    
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".


All times are GMT -4. The time now is 05:20.

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