AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Show a HUD message indefinitely (https://forums.alliedmods.net/showthread.php?t=307269)

TheiOne 05-02-2018 18:41

Show a HUD message indefinitely
 
Hello

Is it possible to show a HUD message indefinitely ? I mean like when a player goes to SPEC or dies during the game. I want to show a HUD message till the player joins T or CT or gets respawned in the next round.

I tried hooking DeathMsg and Spectator messages like this:

Code:
    register_message(120, "join_spec");     register_event("DeathMsg", "deathmsg", "a");

but the HUD is displayed only for a short time.

iceeedr 05-02-2018 19:05

Re: Show a HUD message indefinitely
 
How about giving us some code?

CrAzY MaN 05-02-2018 23:43

Re: Show a HUD message indefinitely
 
I have already created that for my server.
Will give tomorrow.

fysiks 05-03-2018 10:10

Re: Show a HUD message indefinitely
 
You have to use a repeating task of some sort to constantly re-show the message. There are several threads on there that ask about this and it's typically termed "permanent HUD message" or something similar.

CrAzY MaN 05-03-2018 23:30

Re: Show a HUD message indefinitely
 
Quote:

Originally Posted by fysiks (Post 2590533)
You have to use a repeating task of some sort to constantly re-show the message. There are several threads on there that ask about this and it's typically termed "permanent HUD message" or something similar.

Permenant HUD Message plugin just lags the server

fysiks 05-04-2018 01:09

Re: Show a HUD message indefinitely
 
Quote:

Originally Posted by CrAzY MaN (Post 2590611)
Permenant HUD Message plugin just lags the server

Then you're using the wrong method.

CrAzY MaN 05-04-2018 01:50

Re: Show a HUD message indefinitely
 
Quote:

Originally Posted by TheiOne (Post 2590447)
Hello

Is it possible to show a HUD message indefinitely ? I mean like when a player goes to SPEC or dies during the game. I want to show a HUD message till the player joins T or CT or gets respawned in the next round.

I tried hooking DeathMsg and Spectator messages like this:

Code:
    register_message(120, "join_spec");     register_event("DeathMsg", "deathmsg", "a");

but the HUD is displayed only for a short time.

PHP Code:

#include <amxmodx>
//#include <dhudmessage>

#define PLUGIN "Permenant HUD Message"
#define VERSION "1.0"
#define AUTHOR "CrAzY MaN"

public plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
}

public 
client_putinserver(id)
{
    
set_task(1.0"showMessage"id__"b")
}

public 
showMessage(id)
{
    if(!
is_user_connected(id))
        return;
        
    if(
is_user_connected(id) && is_user_alive(id))
    {
        
set_dhudmessage(2309630, -1.00.001.01.00.10.2)
        
show_dhudmessage(id"ADD TO FAVOURITES : mini.rectergaming.com:27015")
    }
    
    if(
is_user_connected(id) && !is_user_alive(id))
    {
        
set_dhudmessage(17821236, -1.00.2001.01.00.10.2)
        
show_dhudmessage(id"Buy VIP/Admin?^n Visit rectergaming.com/shop or contact (+91)8530088698")
    }
        
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang16393\\ f0\\ fs16 \n\\ par }
*/ 

Try out this, edit message as you want!

TheiOne 05-11-2018 00:51

Re: Show a HUD message indefinitely
 
@iceeedr

I don't know what you mean.

@fysiks

Thanks for the keyword. I've already tried something similar (using set_task), but the message is shown only for one time, dunno maybe did something wrong. I'll look into those threads.

@CrAzY MaN

Gonna try it out, thanks.

TheiOne 05-11-2018 06:03

Re: Show a HUD message indefinitely
 
I did it like this:

Code:
public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR)     register_message(120, "join_spec");     register_event("DeathMsg", "deathmsg", "a"); } public client_putinserver(id) {     set_task(1.0, "showMessage", id, _, _, "b") } public join_spec(id) {     set_task(1.0, "showMessage", id, _, _, "b") } public deathmsg(id) {     set_task(1.0, "showMessage", id, _, _, "b") } public showMessage(id) {     if(!is_user_connected(id))     {         return;     }     else if(!is_user_alive(id))     {         set_dhudmessage(255, 255, 255, -1.0, 0.70, 0, 1.0, 1.0, 0.1, 0.2)         show_dhudmessage(id, "blah blah blah")     } }

It works, I just wanna know if I could make it better. Would there be any difference if I used a "get user team" in order to show the message when the player joins the SPEC or the current "register_message(120, "join_spec");" is OK ?

And I would appreciate it if someone could briefly explain the difference between hudmessage and dhudmessage. The obvious difference from the API is that dhudmessage has no channel parameter.

Thanks.

CrazY. 05-11-2018 07:58

Re: Show a HUD message indefinitely
 
Code:
if(!is_user_connected(id)) {     return; } else if(!is_user_alive(id)) {     set_dhudmessage(255, 255, 255, -1.0, 0.70, 0, 1.0, 1.0, 0.1, 0.2)     show_dhudmessage(id, "blah blah blah") }

:arrow:

Code:
if(is_user_connected(id) && !is_user_alive(id)) {     set_dhudmessage(255, 255, 255, -1.0, 0.70, 0, 1.0, 1.0, 0.1, 0.2)     show_dhudmessage(id, "blah blah blah") }


All times are GMT -4. The time now is 04:33.

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