Raised This Month: $ Target: $400
 0% 

Here we go again, health messages?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Cheap_Suit
Veteran Member
Join Date: May 2004
Old 02-16-2007 , 19:57   Re: Here we go again, health messages?
Reply With Quote #1

I think this is alot easier than switch statements

PHP Code:
public display_hud(id
{
    new 
health read_data(1)
    if(
health 25)
    {
        
//do stuff
    
}
    else if(
health 100)
    {
        
//do another stuff
    
}

__________________
HDD fried, failed to backup files. Sorry folks, just don't have free time anymore. This is goodbye.
Cheap_Suit is offline
Davidos
Senior Member
Join Date: Feb 2005
Old 02-16-2007 , 20:09   Re: Here we go again, health messages?
Reply With Quote #2

Quote:
Originally Posted by Cheap_Suit View Post
I think this is alot easier than switch statements

PHP Code:
public display_hud(id
{
    new 
health read_data(1)
    if(
health 25)
    {
        
//do stuff
    
}
    else if(
health 100)
    {
        
//do another stuff
    
}

D'oh <slaps himself in the face> I've been so focussed on black Rose I forgot you could do that as well >_<
Davidos is offline
pRED*
Join Date: Dec 2006
Old 02-16-2007 , 20:17   Re: Here we go again, health messages?
Reply With Quote #3

Remove the #include <fun>, you don't use anything from it anyway.
Maybe something wrong with your fun module because without that defined it compiles fine, but still with all the tag mismatches.

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

Read that carefully. It tells you what type each of the parameters for set_hudmessage have to be. Some must be integers (0, 1 etc) other must be floats (0.0, 24.3 etc). This is what's causing the tag mismatch errors. Fix those and it should compile no errors and work hopefully.
pRED* is offline
Old 02-16-2007, 20:18
Davidos
This message has been deleted by Davidos. Reason: well, it doesn't work either...
Davidos
Senior Member
Join Date: Feb 2005
Old 02-17-2007 , 04:38   Re: Here we go again, health messages?
Reply With Quote #5

Double post for bump >so people read it<

Code:
#include <amxmodx> #include <amxmisc> #include <string> //might need this public plugin_init() {     register_plugin("Text Health", "0.1337", "Davidos")     register_event("Damage","display_hud","be"); } public display_hud(id) {     new health = read_data(1)     if(health>=200)     {         set_hudmessage(255,255,255,0.65,0.0,0,1.0,255.0,0.0,0.0,-1)         show_hudmessage(id,"Overcharged!")     }     else if(health>=100)     {         set_hudmessage(0,255,0,0.65,0.0,0,1.0,255.0,0.0,0.0,-1)         show_hudmessage(id,"Fine")     }     else if(health>=75)     {         set_hudmessage(100,255,0,0.65,0.0,0,1.0,255.0,0.0,0.0,-1)         show_hudmessage(id,"Scratched")     }     else if(health>=50)     {         set_hudmessage(255,255,0,0.65,0.0,0,1.0,255.0,0.0,0.0,-1)         show_hudmessage(id,"Hurt")     }     else if(health>=25)     {         set_hudmessage(255,100,0,0.65,0.0,0,1.0,255.0,0.0,0.0,-1)         show_hudmessage(id, "CAUTION!")     }     else if(health>=1)     {         set_hudmessage(255,0,0,0.65,0.0,0,1.0,255.0,0.0,0.0,-1)         show_hudmessage(id, "CRITICAL!")     } }

can anyone point out why nothing shows in the hud?
Davidos is offline
pRED*
Join Date: Dec 2006
Old 02-17-2007 , 04:58   Re: Here we go again, health messages?
Reply With Quote #6

Unless the messages are different in Sven Coop, read_data(1) from a damage message won't give you their hp.

Use get_user_health(id) instead
pRED* is offline
Davidos
Senior Member
Join Date: Feb 2005
Old 02-17-2007 , 05:03   Re: Here we go again, health messages?
Reply With Quote #7

Quote:
Originally Posted by pRED* | NZ View Post
Unless the messages are different in Sven Coop, read_data(1) from a damage message won't give you their hp.

Use get_user_health(id) instead
That only works when damaged, does it reset on death? Does it even WORK with slap commands etc, or when healed <medkit pickups> ?

Then again

Quote:
Originally Posted by Black Rose
Code:
#include <amxmodx> #include <fun> #include <string> public plugin_init() {     register_plugin("Glow by Health", "2.5", "Davidos")     register_event("Health", "event_Health", "be")     register_event("Healthleft", "event_healthleft", "be") } public event_Health(id) {     switch ( read_data(1) ) {         case 0 .. 9 :         set_user_rendering(id, kRenderFxGlowShell, 10, 10, 10, kRenderTransAlpha, 255) // You can't do black, You'll have to change that.         case 10 .. 24 :         set_user_rendering(id, kRenderFxGlowShell, 255, 0, 0, kRenderNormal, 10)         case 25 .. 49 :         set_user_rendering(id, kRenderFxGlowShell, 255, 100, 0, kRenderNormal, 10)         case 50 .. 74 :         set_user_rendering(id, kRenderFxGlowShell, 255, 255, 0, kRenderNormal, 10)         case 75 .. 99 :         set_user_rendering(id, kRenderFxGlowShell, 0, 255, 0, kRenderNormal, 10)         case 100 .. 199 :         set_user_rendering(id, kRenderFxGlowShell, 0, 0, 255, kRenderNormal, 10)         default :         set_user_rendering(id, kRenderFxGlowShell, 255, 255, 255, kRenderNormal, 10)     } }
this plugin works <again, thanks rose!>



edit 2:

I've been trying to make it to work on health

Code:
#include <amxmodx> #include <amxmisc> #include <string> public plugin_init() {     register_plugin("Text Health", "0.1337", "Davidos")     register_event("Damage","display_hud","be"); } public display_hud(id) {       switch ( read_data(1) ) {         case 0 .. 24 :             set_hudmessage(255,0,0,-1.0,0.35,0,1.0,255.0,0.0,0.0,-1)         case 25 .. 49 :             set_hudmessage(255,100,0,-1.0,0.35,0,1.0,255.0,0.0,0.0,-1)         case 50 .. 74 :             set_hudmessage(255,255,0,-1.0,0.35,0,1.0,255.0,0.0,0.0,-1)              case 75 .. 99 :             set_hudmessage(100,255,0,-1.0,0.35,0,1.0,255.0,0.0,0.0,-1)          case 100 .. 199 :             set_hudmessage(0,255,0,-1.0,0.35,0,1.0,255.0,0.0,0.0,-1)         default :         set_hudmessage(255,255,255,-1.0,0.35,0,1.0,255.0,0.0,0.0,-1)     }     switch (read_data(1) ) {         case 0 .. 24 :             show_hudmessage(id, "CRITICAL!")            case 25 .. 49 :             show_hudmessage(id, "CAUTION!")         case 50 .. 74 :             show_hudmessage(id,"Hurt")         case 75 .. 99:             show_hudmessage(id,"Scratched")         case 100 .. 199 :             show_hudmessage(id,"Fine")         default:         show_hudmessage(id,"Overcharged!")     } }

That only shows CRITICAL!

Last edited by Davidos; 02-17-2007 at 06:47.
Davidos is offline
Shin Lee
Junior Member
Join Date: Aug 2006
Location: Germany
Old 06-11-2007 , 07:26   Re: Here we go again, health messages?
Reply With Quote #8

Shin Lee is offline
Send a message via ICQ to Shin Lee Send a message via MSN to Shin Lee
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 00:44.


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