AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Help generating hud messages (https://forums.alliedmods.net/showthread.php?t=51675)

vbSteve 02-22-2007 06:50

Help generating hud messages
 
Hi,


I generated a hud message, well a few, to be all shown the same time on screen. My problem is, it's only showing 2 of 5 messages.

Here's my code:

Code:

#include <amxmodx>
#include <amxmisc>
#include <engine>   
#include <fakemeta>
#include <ns>
#include <fun>
#include <cstrike>

#define AppVersion                "1.2"
#define AppName                        "CTF Classic Mod"
#define AppAuthor                "mCoDev Systems"

#define chatPref                "[CTF Classic]"
#define T_TEAM                        1
#define CT_TEAM                        2


new TFlag, TBase, CFlag, CBase;
new THolder, CHolder;

new TScore, CScore, TLoc[51]="Base", CLoc[51]="Base";
new gmsgTeamScore;
new Float:orgTBase[3], Float:orgCBase[3];


(...)


public generateHud(){
        // This proc is updated every 1 sec.
        new j;

        // Update the scoreboard:
        message_begin(MSG_ALL, sTeamScore);
        write_string("TERRORIST");
        write_short(TScore);
        message_end();
       
        message_begin(MSG_ALL, sTeamScore);
        write_string("CT");
        write_short(CScore);
        message_end();
       
       
        // For all clients, show hud messages:
        for(j=1; j < get_maxplayers(); j++){
                if(is_user_connected(j)){
                        set_hudmessage(255, 255, 255, -1.0, 0.0, 0, 6.0, 1.0, 0.1,0.1,82);
                        show_hudmessage(j, "CTF Classic Mod");
               
                        set_hudmessage(255, 0, 0, 0.35, 0.06, 0, 6.0, 1.0, 0.1,0.1,23);
                        show_hudmessage(j, "T [%i]", TScore);
                       
                        set_hudmessage(255, 255, 255, -1.0, 0.06, 0, 6.0, 1.0, 0.1,0.1,24);
                        show_hudmessage(j, "-");
                       
                        set_hudmessage(0, 0, 255, 0.55, 0.06, 0, 6.0, 1.0, 0.1,0.1,35);
                        show_hudmessage(j, "CT [%i]", CScore);
                       
                        if(get_user_team(j)==T_TEAM){
                                set_hudmessage(255, 0, 0, 0.01, 0.9, 0, 6.0, 1.0, 0.1,0.1,26);
                                show_hudmessage(j, "T Flag: %s", TLoc);
                        } else{
                                if(get_user_team(j)==CT_TEAM){
                                        set_hudmessage(0,0,255, 0.01, 0.9, 0, 6.0, 1.0, 0.1,0.1,26);
                                        show_hudmessage(j, "CT Flag: %s", CLoc);
                                } else{
                                        set_hudmessage(255,255,255, 0.01, 0.9, 0, 6.0, 1.0, 0.1,0.1,26);
                                        show_hudmessage(j, "T Flag: %s  --  CT Flag: %s", TLoc, CLoc);
                                }
                        }               
                }
        }
       

        // Set next timeframe:
        set_task(1.0, "generateHud");
}

I already tried putting each message on a different channel; but then I got the opposit: the ones that weren't visible,are visible and the other not.

Any ideas?


Thanks,
Steve

Davidos 02-22-2007 07:22

Re: Help generating hud messages
 
Quote:

Originally Posted by vbSteve (Post 443733)
Hi,


I generated a hud message, well a few, to be all shown the same time on screen. My problem is, it's only showing 2 of 5 messages.

Here's my code:

Code:

#include <amxmodx>
#include <amxmisc>
#include <engine>   
#include <fakemeta>
#include <ns>
#include <fun>
#include <cstrike>

#define AppVersion                "1.2"
#define AppName                        "CTF Classic Mod"
#define AppAuthor                "mCoDev Systems"

#define chatPref                "[CTF Classic]"
#define T_TEAM                        1
#define CT_TEAM                        2


new TFlag, TBase, CFlag, CBase;
new THolder, CHolder;

new TScore, CScore, TLoc[51]="Base", CLoc[51]="Base";
new gmsgTeamScore;
new Float:orgTBase[3], Float:orgCBase[3];


(...)


public generateHud(){
        // This proc is updated every 1 sec.
        new j;

        // Update the scoreboard:
        message_begin(MSG_ALL, sTeamScore);
        write_string("TERRORIST");
        write_short(TScore);
        message_end();
       
        message_begin(MSG_ALL, sTeamScore);
        write_string("CT");
        write_short(CScore);
        message_end();
       
       
        // For all clients, show hud messages:
        for(j=1; j < get_maxplayers(); j++){
                if(is_user_connected(j)){
                        set_hudmessage(255, 255, 255, -1.0, 0.0, 0, 6.0, 1.0, 0.1,0.1,82);
                        show_hudmessage(j, "CTF Classic Mod");
               
                        set_hudmessage(255, 0, 0, 0.35, 0.06, 0, 6.0, 1.0, 0.1,0.1,23);
                        show_hudmessage(j, "T [%i]", TScore);
                       
                        set_hudmessage(255, 255, 255, -1.0, 0.06, 0, 6.0, 1.0, 0.1,0.1,24);
                        show_hudmessage(j, "-");
                       
                        set_hudmessage(0, 0, 255, 0.55, 0.06, 0, 6.0, 1.0, 0.1,0.1,35);
                        show_hudmessage(j, "CT [%i]", CScore);
                       
                        if(get_user_team(j)==T_TEAM){
                                set_hudmessage(255, 0, 0, 0.01, 0.9, 0, 6.0, 1.0, 0.1,0.1,26);
                                show_hudmessage(j, "T Flag: %s", TLoc);
                        } else{
                                if(get_user_team(j)==CT_TEAM){
                                        set_hudmessage(0,0,255, 0.01, 0.9, 0, 6.0, 1.0, 0.1,0.1,26);
                                        show_hudmessage(j, "CT Flag: %s", CLoc);
                                } else{
                                        set_hudmessage(255,255,255, 0.01, 0.9, 0, 6.0, 1.0, 0.1,0.1,26);
                                        show_hudmessage(j, "T Flag: %s  --  CT Flag: %s", TLoc, CLoc);
                                }
                        }               
                }
        }
       

        // Set next timeframe:
        set_task(1.0, "generateHud");
}

I already tried putting each message on a different channel; but then I got the opposit: the ones that weren't visible,are visible and the other not.

Any ideas?


Thanks,
Steve


woah woah... Aren't the last numbers the channels in set hud?

Half-life 1 <unlike hl 2> only has 4 channels.

Each channel can have 2 messages, so only 8 hud messages. Now normal plugins <like i_hud welcome to %server ...>

The scroll message takes another place too, I think channel 2 is occupied by these.

So you only have 1 / 3 and 4

else try naming them all -1, so they choose their own channel.

QUICK NOTE

Not all mods can support hud messages that are constantly on <The Specialists for example>

Vanilla <normal> mods, like Cstrike, half-life and sven-coop <The mods that remind you the most of half-life> seem to have no problems...


All times are GMT -4. The time now is 00:44.

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