AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   How to make hudmessage not go away? (https://forums.alliedmods.net/showthread.php?t=123800)

NiQu 04-09-2010 04:57

How to make hudmessage not go away?
 
Hi, im tryign to display a users kills with a hud message and i wonder how do i make it not go away?

Code:
PHP Code:

    set_hudmessage(02550, -1.00.8806.030.0)
    
show_hudmessage(iPlayer"Kills: %i"userKills[iPlayer]) 

The code above makes the hudmessage go away after 30 seconds.

VMAN 04-09-2010 05:59

Re: How to make hudmessage not go away?
 
http://www.amxmodx.org/funcwiki.php?go=func&id=28

Set the duration

NiQu 04-09-2010 06:07

Re: How to make hudmessage not go away?
 
yeh but i dont want the message to go away until the map end or possibly round end.

Sylwester 04-09-2010 07:48

Re: How to make hudmessage not go away?
 
The solution is simple. When it's about to "go away" display it again.

The simplest way to code that is to use set_task.
PHP Code:

public start_displaying(){
    
set_task(1.0"display_msg"2356__"b"
    
//function display_msg will be called every second
}

public 
display_msg(){
    
//this function will display hud message that lasts 1 second every time it's called
    
set_hudmessage(02550, -1.00.8806.01.0)
    
show_hudmessage(iPlayer"Kills: %i"userKills[iPlayer])


There is something better than set_task described here, but it's harder to use.

NiQu 04-10-2010 22:57

Re: How to make hudmessage not go away?
 
I will try that, but what shud i do with "start_displaying"?

Bugsy 04-10-2010 23:51

Re: How to make hudmessage not go away?
 
Quote:

Originally Posted by NiQu (Post 1146500)
I will try that, but what shud i do with "start_displaying"?

Call that when you want to begin displaying the "permanent" HUD.

Here's some extra info that may help you...

If you want to stop displaying the HUD at any time, call remove_task( 2356 ).
To check if this HUD is being displayed, use task_exists( 2356 ).

If you want to display the HUD for only X seconds while allowing it to be updated w\ new data each second, pass the "a" flag instead of "b" and specify the number of seconds.

For example, to show the above HUD for only 30 seconds:
set_task( 1.0 , "display_msg" , 2356 , _ , _ , "a" , 30 );

NiQu 04-11-2010 00:46

Re: How to make hudmessage not go away?
 
alright, thanks ill test as soon as ive rewritten my code.

Edit: i think i want to thank you.

wrecked_ 04-13-2010 07:47

Re: How to make hudmessage not go away?
 
Yes, but then you have 10+ HUD messages per second overlapping each other.

Bugsy 04-13-2010 08:21

Re: How to make hudmessage not go away?
 
Quote:

Originally Posted by JaGareN (Post 1148925)
You can write it in the Client_prethink and it will never go off again.

Please do not try to help people if you don't know what you're talking about. PreThink is probably the worst way to do this. If you feel it is better, please explain why.

NiQu 04-13-2010 08:27

Re: How to make hudmessage not go away?
 
..

shud i use set_task or client_PreThink !?
I tested both and prethink so far works best.


All times are GMT -4. The time now is 01:42.

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