Raised This Month: $ Target: $400
 0% 

Health Display


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
mattiiias93
Member
Join Date: Mar 2012
Old 04-23-2012 , 12:47   Health Display
Reply With Quote #1

Hi i need a plugin that display name and health with hudmessage! Like this. Can someone help me ?

formatex(sMessage, 63, "Friend: %s^nHealth: %i", sName, get_user_health(target));
} else {
formatex(sMessage, 63, "Enemy: %s", sName);
}
mattiiias93 is offline
Napoleon_be
Veteran Member
Join Date: Jul 2011
Location: Belgium
Old 04-23-2012 , 13:13   Re: Health Display
Reply With Quote #2

set_hudmessage() // 20.1 Secs
show_hudmessage(id, sMessage)

set_task(20.0, "FUNCTION-WHERE-DISPLAY-HUD", id)
__________________
Napoleon_be is offline
Send a message via Skype™ to Napoleon_be
Bilal Pro
Senior Member
Join Date: Mar 2012
Location: Holland
Old 04-23-2012 , 13:17   Re: Health Display
Reply With Quote #3

Napoleon, he means that if you aim at the person not random hud message
__________________
  • Point System with rank titles for sale [X] [100% private]
  • VIP Menu for sale [X] [100% private]
  • HnS shop more features for sale [X] [100% private]
Contact: Bilalzaandam1234, on steam if you are interested.
Bilal Pro is offline
Liverwiz
Veteran Member
Join Date: Feb 2010
Location: Maryland
Old 04-23-2012 , 13:36   Re: Health Display
Reply With Quote #4

Code:
new p_target, p_bodyPart       // p_target == target
get_user_aiming(id, p_target, p_bodyPart)

if(get_user_team(p_target) == get_user_team(id))
     // your code here

Last edited by Liverwiz; 04-23-2012 at 13:44.
Liverwiz is offline
mattiiias93
Member
Join Date: Mar 2012
Old 04-24-2012 , 10:30   Re: Health Display
Reply With Quote #5

Liverwiz yes you understand me if someone aim on a person it will display. I had a code but not the start code can someone fix it? Thanks

new target, body;
get_user_aiming(id, target, body, 9999);

if( 0 < target <= gMaxPlayers && is_user_alive(target))
{
new sName[32], sMessage[64];
get_user_name(target, sName, 31);

if( cs_get_user_team(target) == cs_get_user_team(id) )
{
formatex(sMessage, 63, "Friend: %s^nHealth: %i", sName, get_user_health(target));
} else {
formatex(sMessage, 63, "Enemy: %s", sName);
}

if(cs_get_user_team(target) == CS_TEAM_CT)
set_hudmessage()// HUDMESSAGE_COLOR
} else if(cs_get_user_team(target) == CS_TEAM_T){
set_hudmessage()// HUDMESSAGE_COLOR
}
show_hudmessage(id, "%s", sMessage);
}
mattiiias93 is offline
Liverwiz
Veteran Member
Join Date: Feb 2010
Location: Maryland
Old 04-24-2012 , 11:52   Re: Health Display
Reply With Quote #6

Quote:
Originally Posted by mattiiias93 View Post
Liverwiz yes you understand me if someone aim on a person it will display. I had a code but not the start code can someone fix it? Thanks

new target, body;
get_user_aiming(id, target, body, 9999);

if( 0 < target <= gMaxPlayers && is_user_alive(target))
{
new sName[32], sMessage[64];
get_user_name(target, sName, 31);

if( cs_get_user_team(target) == cs_get_user_team(id) )
{
formatex(sMessage, 63, "Friend: %s^nHealth: %i", sName, get_user_health(target));
} else {
formatex(sMessage, 63, "Enemy: %s", sName);
}

if(cs_get_user_team(target) == CS_TEAM_CT)
set_hudmessage()// HUDMESSAGE_COLOR
} else if(cs_get_user_team(target) == CS_TEAM_T){
set_hudmessage()// HUDMESSAGE_COLOR
}
show_hudmessage(id, "%s", sMessage);
}
Do you have the rest of the code? What is gMaxPlayers defined as? and does the code even compile? That first if statement, i'm not sure is a valid expression. What "start code" do you need? You mean headers and init function?

Also....when you're posting code into a thread make sure to wrap "[CODE" "[/CODE" or "[PHP" "[/PHP" tags around it to preserve whitespace. NOTE: PHP tags preserve syntax highlighting, if you want it to look fancy.
Liverwiz is offline
mattiiias93
Member
Join Date: Mar 2012
Old 04-25-2012 , 14:10   Re: Health Display
Reply With Quote #7

The rest of the code is lost and i don't remeber how i did to fix it..
mattiiias93 is offline
Liverwiz
Veteran Member
Join Date: Feb 2010
Location: Maryland
Old 04-25-2012 , 15:59   Re: Health Display
Reply With Quote #8

PHP Code:
acquireTarget(){
new 
targetbody;
get_user_aiming(idtargetbody9999);

if(
is_user_alive(target))
{
    new 
sName[32], sMessage[64];
    
get_user_name(targetsName31);

    if( 
cs_get_user_team(target) == cs_get_user_team(id) )
        
formatex(sMessage63"Friend: %s^nHealth: %i"sNameget_user_health(target))
    else 
        
formatex(sMessage63"Enemy: %s"sName)

    
set_hudmessage()// HUDMESSAGE_COLOR
    
show_hudmessage(id"%s"sMessage)
}

Now....i'm not exactly sure what event you would use in replace of "acquireTarget" But i fixed up your code a bit. If you or someone else can find an event that would be good to call this function.

And what mod do you need this for? Everything i've played already prints those messages to your hud.
Liverwiz is offline
<VeCo>
Veteran Member
Join Date: Jul 2009
Location: Bulgaria
Old 04-25-2012 , 16:03   Re: Health Display
Reply With Quote #9

You can use StatusText event - it is the default HUD text showing name and health when you aim at somebody.
__________________
<VeCo> is offline
mattiiias93
Member
Join Date: Mar 2012
Old 04-26-2012 , 10:09   Re: Health Display
Reply With Quote #10

Thanks really nice. But Im no good with scripting plugins so can someone maybe complete the plugin? Please
mattiiias93 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 07:47.


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