AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Need help with show/set hudmessage. (https://forums.alliedmods.net/showthread.php?t=197120)

Unkolix 09-29-2012 03:39

Need help with show/set hudmessage.
 
So I want to make a hud showing that i have left 5(seconds should change 5/4/3/2/1) seconds to rspawn.
It should be something like this:
PHP Code:

set_hudmessage02550, -1.00.2906.012.0 );
show_hudmessage0"You will respawn in %s seconds!"seconds); 

So... How to make that %s show seconds?

YamiKaitou 09-29-2012 03:41

Re: Need help with show/set hudmessage.
 
Where do you define seconds?

Unkolix 09-29-2012 03:41

Re: Need help with show/set hudmessage.
 
That's the problem. How should I do that?

Artifact 09-29-2012 04:43

Re: Need help with show/set hudmessage.
 
PHP Code:

new seconds
public_init
() {
seconds register_cvar("respawn_seconds""5")
}
{
respawn()
{
show_hudmessage0"You will respawn in %s seconds!"get_cvar_num(seconds))


Something like that?

Unkolix 09-29-2012 04:49

Re: Need help with show/set hudmessage.
 
Wouldn't it only show number 5? I need it to change... 5 then 4, 3, 2, 1.

YamiKaitou 09-29-2012 05:09

Re: Need help with show/set hudmessage.
 
Then use a task and a decreasing counter

Unkolix 09-29-2012 05:16

Re: Need help with show/set hudmessage.
 
Should it be like this?

PHP Code:

{
    
set_task(5.0"drspawn")
    
set_task(0.2"five")
    
set_task(1.0"four")
    
set_task(2.0"three")
    
set_task(3.0"two")
    
set_task(4.0"one")
}
public 
five(id)
{
    
set_hudmessage02550, -1.00.2906.012.0 ); 
    
show_hudmessageid"You will respawn in 5 seconds!");
}

public 
four(id)
{
    
set_hudmessage02550, -1.00.2906.012.0 ); 
    
show_hudmessageid"You will respawn in 4 seconds!");
}

public 
three(id)
{
    
set_hudmessage02550, -1.00.2906.012.0 ); 
    
show_hudmessageid"You will respawn in 3 seconds!");
}

public 
two(id)
{
    
set_hudmessage02550, -1.00.2906.012.0 ); 
    
show_hudmessageid"You will respawn in 2 seconds!");
}

public 
one(id)
{
    
set_hudmessage02550, -1.00.2906.012.0 ); 
    
show_hudmessageid"You will respawn in 1 second!");



dias 09-29-2012 05:34

Re: Need help with show/set hudmessage.
 
PHP Code:

new g_count 5

// Usage
set_task(1.0"task_respawn_count"id+TASK_RESPAWN_COUNT__"b")

public 
task_respawn_count(taskid)
{
    if (
g_endround)
    {
        
remove_task(taskid)
        return;
    }
    
    if (!
g_count)
    {
        
set_task(1.0"do_respawn")
        
remove_task(taskid)
        return;
    }
    
    new 
message[64]
    
format(messagecharsmax(message), "You Will Respawn After: %i Second(s) !!!"g_count)
    
client_print(taskid-TASK_RESPAWN_COUNTprint_centermessage)
    
    
g_count--



Unkolix 09-29-2012 05:38

Re: Need help with show/set hudmessage.
 
Thanks!!! Little problem: undefined TASK_RESPAWN_COUNT and g_endground.

dias 09-29-2012 05:50

Re: Need help with show/set hudmessage.
 
PHP Code:

#define TASK_RESPAWN_COUNT 34534534 

and delete the
PHP Code:

    if (g_endround)
    {
        
remove_task(taskid)
        return;
    } 



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

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