Raised This Month: $ Target: $400
 0% 

health


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Sylwester
Veteran Member
Join Date: Oct 2006
Location: Poland
Old 06-04-2010 , 09:19   Re: health
Reply With Quote #1

Simple, but not efficient method:
PHP Code:
#include <amxmodx>
#include <cstrike>

new g_max_players
public plugin_init(){
    
set_task(1.0"show_health"325236__"b")
    
g_max_players get_maxplayers()
}

public 
show_health(){
    new 
total_health
    
for(new i=1i<=g_max_playersi++){
        if(
is_user_alive(i) && cs_get_user_team(i)==CS_TEAM_CT)
            
total_health += get_user_health(i)
    }
    
set_hudmessage(00255, -1.00.106.01.00.10.1, -1)
    
show_hudmessage(0"CT Total Health: %d"total_health)

To make it more efficient you should cache alive cts, health and update it when player is damaged.
__________________
Impossible is Nothing
Sylwester is offline
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 05:16.


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