AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   how to make a Hud text (https://forums.alliedmods.net/showthread.php?t=75890)

dEvilKinG 08-14-2008 10:29

how to make a Hud text
 
Hello i want you to help me to make a hud text like amx_tsay but i want to make it have infinite time
some one please?

Iwon 08-14-2008 11:59

Re: how to make a Hud text
 
PHP Code:

set_hudmessage(00255, -1.0, -1.006.00)
show_hudmessage(id"Your Message here"

There it is infinute time change your message here to your message.

dEvilKinG 08-14-2008 15:06

Re: how to make a Hud text
 
Quote:

Originally Posted by Iwon (Post 669505)
PHP Code:

set_hudmessage(00255, -1.0, -1.006.00)
show_hudmessage(id"Your Message here"

There it is infinute time change your message here to your message.

look i want to make it to show this message continues.. this is for 0 sec just a moment

Zero [UM-wFs] 08-14-2008 16:02

Re: how to make a Hud text
 
this will do it

Code:

#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
public plugin_init()
{
    register_plugin("plugin_name", "version", "author");
    register_forward(FM_PlayerPostThink, "PlayerPostThink");

}

public PlayerPostThink(id)
{
    set_hudmessage(0, 0, 255, -1.0, -1.0, 0, 6.0, 0);
    show_hudmessage(id, "Your Message here");
}


danielkza 08-14-2008 16:39

Re: how to make a Hud text
 
It's absolutely not necessary to call the hudmessage on player think. You should create a HudSyncObj and update the message in 0.5,or 1.0 seconds, nothing very heavy. Like this:
Code:

#include <amxmodx>
#include <amxmisc>

public plugin_init()
{
    register_task(1.0,"ShowHUDMessage")
}

public ShowHudMessage()
{
    static HudSyncObj
    if(!HudSyncObj)
        HudSyncObj = CreateHudSyncObj()

    static iMaxPlayers
    if(!iMaxPlayers)
        iMaxPlayers = get_maxplayers()

    for(new i=1;i <= iMaxPlayer;i++)
    {
        if(is_user_connected(i))
        {
            set_hudmessage(_,_,_,_,_,_,0.5,1.0)
            ShowSyncHudMsg(i,HudSyncObj,"This is a test message")
        }
    }
}


Iwon 08-14-2008 19:40

Re: how to make a Hud text
 
Quote:

Originally Posted by dEvilKinG (Post 669577)
look i want to make it to show this message continues.. this is for 0 sec just a moment

Ahh i know what u mean here you go
PHP Code:

    set_hudmessage(00255, -1.0, -1.006.00.1);
    
show_hudmessage(id"Your Message here"); 


Lee 08-14-2008 20:45

Re: how to make a Hud text
 
Iwon, stop posting code you don't understand.

danielkza, register_task() is undefined. You don't need to iterate over each player when using HUD messages because passing 0 as the player ID does so automatically. I'm glad you raised the issue of the FM_PlayerPostThink, but the same can be said of set_task() (assuming that's what you intended to use).

If this were my server, I'd be displaying the HUD message for (mp_roundtime * 60) seconds once per round, but you'd need to make sure other plugins play nicely to do that. I'm pretty sure ESEA uses this method. Come to think of it, try this:

Code:
#include <amxmodx> #pragma semicolon 1 new mp_roundtime; public plugin_init() {     register_event("HLTV", "onNewRound", "a", "1=0", "2=0");         mp_roundtime = get_cvar_pointer("mp_roundtime"); }     public client_putinserver(id) {     //I'm not too sure how HUD messages interact with the MOTD     showMessage(id); } public onNewRound() {     showMessage(); } showMessage(id = 0) {     //what a hideous native     set_hudmessage (/*R*/ _, /*G*/ _, /*B*/ _, /*X*/ _, /*Y*/ _, /*effects*/ _, /*fxtime*/ _, /*holdtime*/     float(get_pcvar_num(mp_roundtime) * 60 + 15), /*fadeintime*/ _, /*fadeouttime*/ _, /*channel*/ 3);           show_hudmessage(id, "Hello World."); }


All times are GMT -4. The time now is 03:15.

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