Raised This Month: $ Target: $400
 0% 

Here we go again, health messages?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
pRED*
Join Date: Dec 2006
Old 02-16-2007 , 19:48   Re: Here we go again, health messages?
Reply With Quote #1

Oh right. Was thinking CS for some reason.

Um in set_hudmessage the 4,5 and 8th parameters all need to be floats and you've got them as integers.

You also have to create a for loop and loop through all the players (think theres info in the help doc on how to do this) and then change the 'players' in your show_hudmessage to be players[counter]

Oh wait and the first error is because get_players needs 2 variables. player index array and num of players integer

PHP Code:
public display_hud(id) {
    new 
players[32],num;
    
get_players(players,num)

    
set_hudmessage(255,0,0,0.0,0.0,0,99.9,255.0,0.0,0.0,-1
    for (new 
counter=0counter<numcounter++)
    {
        
        switch ( 
read_data(1) ) {
            case 
.. 25 :
            
show_hudmessage(players[counter],"Caution!")
            default :
            
show_hudmessage(players[counter], "Overcharged")
        }
    }

Or maybe this. U already have the id, so you don't need to get_players at all? Not sure, don't know the messages for Sven
PHP Code:
public display_hud(id) {
   
        
set_hudmessage(255,0,0,0.0,0.0,0,99.9,255.0,0.0,0.0,-1
        
        switch ( 
read_data(1) ) {
            case 
.. 25 :
            
show_hudmessage(id,"Caution!")
            default :
            
show_hudmessage(id"Overcharged")
        }
    


Last edited by pRED*; 02-16-2007 at 19:52. Reason: dumb mistakes
pRED* is offline
Davidos
Senior Member
Join Date: Feb 2005
Old 02-16-2007 , 19:55   Re: Here we go again, health messages?
Reply With Quote #2

Quote:
Originally Posted by pRED* | NZ View Post
Oh right. Was thinking CS for some reason.

Um in set_hudmessage the 4,5 and 8th parameters all need to be floats and you've got them as integers.

You also have to create a for loop and loop through all the players (think theres info in the help doc on how to do this) and then change the 'players' in your show_hudmessage to be players[counter]

Oh wait and the first error is because get_players needs 2 variables. player index array and num of players integer

PHP Code:
public display_hud(id) {
    new 
players[32],num;
    
get_players(players,num)

    
set_hudmessage(255,0,0,0.0,0.0,0,99.9,255.0,0.0,0.0,-1
    for (new 
counter=0counter<numcounter++)
    {
        
        switch ( 
read_data(1) ) {
            case 
.. 25 :
            
show_hudmessage(players[counter],"Caution!")
            default :
            
show_hudmessage(players[counter], "Overcharged")
        }
    }

Or maybe this. U already have the id, so you don't need to get_players at all? Not sure, don't know the messages for Sven
PHP Code:
public display_hud(id) {
   
        
set_hudmessage(255,0,0,0.0,0.0,0,99.9,255.0,0.0,0.0,-1
        
        switch ( 
read_data(1) ) {
            case 
.. 25 :
            
show_hudmessage(id,"Caution!")
            default :
            
show_hudmessage(id"Overcharged")
        }
    


as for the messages, same as hl dm so...

As for the plugin, it keeps messing up when I try to use it... no hud messages at all... what else in there is not like it's supposed to be...
Where is avalanche when you need him...


Code:
#include <amxmodx> #include <amxmisc> #include <fun> #include <string> public plugin_init() {     register_plugin("Text Health", "0.1337", "Davidos")     register_event("Damage","display_hud","be"); } public display_hud(id) {       set_hudmessage(255,0,0,0.0,0.0,0,99,255.0,0,0,2)     switch ( read_data(1) ) {         case 0 .. 25 :         show_hudmessage(id,"Caution!")         default :         show_hudmessage(id, "Overcharged")     }     }

you mean like this?


only error log now

Code:
Welcome to the AMX Mod X 1.00-251 Compiler.
Copyright (c) 1997-2004 ITB CompuPhase, AMX Mod X Team

fun.inc(14) : warning 207: unknown #pragma
fun.inc(14) : error 038: extra characters on line
fun.inc(16) : warning 207: unknown #pragma
fun.inc(16) : error 038: extra characters on line
Warning: Tag mismatch on line 12
Warning: Tag mismatch on line 12
Warning: Tag mismatch on line 12

2 Errors.
Ignore the last line...


as for In game the message doesnt show...


Anyway, I dunno bout you but I'm going to bed, been coding since 10 it's now 00:09

Last edited by Davidos; 02-16-2007 at 20:07.
Davidos is offline
Cheap_Suit
Veteran Member
Join Date: May 2004
Old 02-16-2007 , 19:57   Re: Here we go again, health messages?
Reply With Quote #3

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 #4

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 #5

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 #7

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-16-2007 , 20:00   Re: Here we go again, health messages?
Reply With Quote #8

What errors are you getting?

I don't know anything about the 'health' message but I'm assuming that it does pass and id and that read_data(1) gives you the hp of that player.

So the only other error could be in displaying the hud message. I have no idea what all the numbers do, i just compared them with this http://www.amxmodx.org/funcwiki.php?...sage&go=search
to see if all the data types matched. Maybe you need to set different numbers..
pRED* 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 00:44.


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