Raised This Month: $51 Target: $400
 12% 

Show a HUD message indefinitely


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
TheiOne
Member
Join Date: Mar 2017
Old 05-02-2018 , 18:41   Show a HUD message indefinitely
Reply With Quote #1

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.
TheiOne is offline
iceeedr
Veteran Member
Join Date: Apr 2017
Location: Brazil
Old 05-02-2018 , 19:05   Re: Show a HUD message indefinitely
Reply With Quote #2

How about giving us some code?
iceeedr is offline
Send a message via Skype™ to iceeedr
CrAzY MaN
Senior Member
Join Date: Mar 2017
Location: India
Old 05-02-2018 , 23:43   Re: Show a HUD message indefinitely
Reply With Quote #3

I have already created that for my server.
Will give tomorrow.
__________________
CrAzY MaN is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 05-03-2018 , 10:10   Re: Show a HUD message indefinitely
Reply With Quote #4

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.
__________________
fysiks is offline
CrAzY MaN
Senior Member
Join Date: Mar 2017
Location: India
Old 05-03-2018 , 23:30   Re: Show a HUD message indefinitely
Reply With Quote #5

Quote:
Originally Posted by fysiks View Post
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
__________________
CrAzY MaN is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 05-04-2018 , 01:09   Re: Show a HUD message indefinitely
Reply With Quote #6

Quote:
Originally Posted by CrAzY MaN View Post
Permenant HUD Message plugin just lags the server
Then you're using the wrong method.
__________________
fysiks is offline
CrAzY MaN
Senior Member
Join Date: Mar 2017
Location: India
Old 05-04-2018 , 01:50   Re: Show a HUD message indefinitely
Reply With Quote #7

Quote:
Originally Posted by TheiOne View Post
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!
__________________
CrAzY MaN is offline
TheiOne
Member
Join Date: Mar 2017
Old 05-11-2018 , 00:51   Re: Show a HUD message indefinitely
Reply With Quote #8

@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 is offline
TheiOne
Member
Join Date: Mar 2017
Old 05-11-2018 , 06:03   Re: Show a HUD message indefinitely
Reply With Quote #9

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.
TheiOne is offline
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 05-11-2018 , 07:58   Re: Show a HUD message indefinitely
Reply With Quote #10

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") }



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") }
__________________








CrazY. 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 11:57.


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