AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   HUD Conflicting (https://forums.alliedmods.net/showthread.php?t=131196)

shuttle_wave 07-02-2010 03:34

HUD Conflicting
 
Hi.
How would i stop HUD conflicting?. When round start i use set_task to run my hud function and i have more than one task to run differnt hud. Do i need to use TASK_ID for my set_task. Also i dont understand task_id so can someone explain to my about task_id thanks

Cheers
Shuttle_Wave

GXLZPGX 07-02-2010 03:55

Re: HUD Conflicting
 
I believe this should work..

PHP Code:

register_event("ResetHUD""eventResetHUD""b");

public 
eventResetHUD(id)
{
    
//what to reset


I'm sure you know what to do with these.

One 07-02-2010 04:01

Re: HUD Conflicting
 
Quote:

Originally Posted by GXLZPGX (Post 1226256)
I believe this should work..

PHP Code:

register_event("ResetHUD""eventResetHUD""b");

public 
eventResetHUD(id)
{
    
//what to reset


I'm sure you know what to do with these.

just add an ID to your task like :


set_task(1.0,"Show_Message",1337)

and use the code which GXLZPGX posted.




Code:

register_event("ResetHUD", "eventResetHUD", "b") //Reset Headup Display event

public eventResetHUD(id)
{
    if(task_exists(1337))    //If task 1337 exists...
    {
          remove_task(1337)  // Remove it to display a new Message
    }
}


shuttle_wave 07-02-2010 04:05

Re: HUD Conflicting
 
for the task_id those numbers i can put any right.

like

#define TASK_ID_HUD 1234

shuttle_wave 07-02-2010 04:07

Re: HUD Conflicting
 
wat if i want a hud message to stay on the screen forever while another hud is showed how would i do that without anything happening to the hud that is displayed forever?

JaGareN 07-02-2010 08:58

Re: HUD Conflicting
 
Just make a task that calls every 1.0 seconds with flag "b" so the message will still up, like this
PHP Code:

set_task(1.0"display_hud"3000__"b");
 
public 
display_hud(id)
{
        
// your hudmessage



GXLZPGX 07-02-2010 11:52

Re: HUD Conflicting
 
Quote:

Originally Posted by shuttle_wave (Post 1226264)
wat if i want a hud message to stay on the screen forever while another hud is showed how would i do that without anything happening to the hud that is displayed forever?

And JaGareN's method above is the best way to go about it, it refreshes every second, so if any data changes it will do it smoothly.

shuttle_wave 07-02-2010 16:54

Re: HUD Conflicting
 
Quote:

Originally Posted by JaGareN (Post 1226377)
Just make a task that calls every 1.0 seconds with flag "b" so the message will still up, like this
PHP Code:

set_task(1.0"display_hud"3000__"b");
 
public 
display_hud(id)
{
        
// your hudmessage



OK. so the 3000 is the task id?

wrecked_ 07-02-2010 17:19

Re: HUD Conflicting
 
Quote:

Originally Posted by shuttle_wave (Post 1226793)
OK. so the 3000 is the task id?

Yup. So is id, the parameter passed in your function.


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

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