AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Get user health (https://forums.alliedmods.net/showthread.php?t=220949)

Zerko 07-16-2013 09:26

Get user health
 
Hello, i have this code:

Code:

public fw_TakeDamage(victim, inflictor, attacker, Float:damage, damage_type)

{

for(new i=1; i<gMaxplayers; i++)

if (victim == g_Zxc[i])

new victim_hp = get_user_health(victim);



if (victim_hp < 0)



victim_hp = 0;



new name[33];

get_user_name(victim, name, 32);

client_print(attacker, print_center, "%s^nHP: %d", name, victim_hp);

}

And i want if player got bool g_Zxc then in center screen will be hes hp.

Zerko 07-16-2013 10:36

Re: Get user health
 
I have now code:
Code:

public fw_TakeDamage(victim, inflictor, attacker, Float:damage, damage_type)
{
if (victim == attacker || !is_user_alive(attacker) || !is_user_connected(victim) || !is_user_zombie(victim))
return

new victim_hp = get_user_health(victim)
if (victim_hp < 0)
victim_hp = 0
client_print(attacker, print_center, "Health: %d", victim_hp)

}

I want to ALL PLAYERS SEE HP ZOMBIE
On map is one zombie.

K1d0x 07-16-2013 11:11

Re: Get user health
 
PHP Code:

public fw_TakeDamage(victiminflictorattackerFloat:damagedamage_type) {
    if (
victim == attacker || !is_user_alive(attacker) || !is_user_connected(victim) || !is_user_zombie(victim))
        return
    
    new 
zmName[32];
    
get_user_name(victimzmName31);
    
    if(!
is_user_zombie(attacker)) {
        
client_print(attackerprint_center"ZM: %s & Health: %d"zmNameget_user_health(victim))
    }



baneado 07-17-2013 13:02

Re: Get user health
 
I think it isn't necessary to check if victim is connected


All times are GMT -4. The time now is 06:32.

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