Raised This Month: $ Target: $400
 0% 

Need help with show/set hudmessage.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Unkolix
Veteran Member
Join Date: Sep 2012
Old 09-29-2012 , 03:39   Need help with show/set hudmessage.
Reply With Quote #1

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?

Last edited by Unkolix; 09-29-2012 at 04:07.
Unkolix is offline
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 09-29-2012 , 03:41   Re: Need help with show/set hudmessage.
Reply With Quote #2

Where do you define seconds?
__________________
ProjectYami Laboratories

I do not browse the forums regularly anymore. If you need me for anything (asking questions or anything else), then PM me (be descriptive in your PM, message containing only a link to a thread will be ignored).
YamiKaitou is offline
Unkolix
Veteran Member
Join Date: Sep 2012
Old 09-29-2012 , 03:41   Re: Need help with show/set hudmessage.
Reply With Quote #3

That's the problem. How should I do that?
Unkolix is offline
Artifact
Veteran Member
Join Date: Jul 2010
Old 09-29-2012 , 04:43   Re: Need help with show/set hudmessage.
Reply With Quote #4

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?
__________________

Last edited by Artifact; 09-29-2012 at 04:44.
Artifact is offline
Unkolix
Veteran Member
Join Date: Sep 2012
Old 09-29-2012 , 04:49   Re: Need help with show/set hudmessage.
Reply With Quote #5

Wouldn't it only show number 5? I need it to change... 5 then 4, 3, 2, 1.
Unkolix is offline
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 09-29-2012 , 05:09   Re: Need help with show/set hudmessage.
Reply With Quote #6

Then use a task and a decreasing counter
__________________
ProjectYami Laboratories

I do not browse the forums regularly anymore. If you need me for anything (asking questions or anything else), then PM me (be descriptive in your PM, message containing only a link to a thread will be ignored).
YamiKaitou is offline
Unkolix
Veteran Member
Join Date: Sep 2012
Old 09-29-2012 , 05:16   Re: Need help with show/set hudmessage.
Reply With Quote #7

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!");


Last edited by Unkolix; 09-29-2012 at 05:22.
Unkolix is offline
dias
BANNED
Join Date: Jul 2009
Location: South Vietnam
Old 09-29-2012 , 05:34   Re: Need help with show/set hudmessage.
Reply With Quote #8

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--


Last edited by dias; 09-29-2012 at 05:35.
dias is offline
Send a message via Yahoo to dias Send a message via Skype™ to dias
Unkolix
Veteran Member
Join Date: Sep 2012
Old 09-29-2012 , 05:38   Re: Need help with show/set hudmessage.
Reply With Quote #9

Thanks!!! Little problem: undefined TASK_RESPAWN_COUNT and g_endground.

Last edited by Unkolix; 09-29-2012 at 05:40.
Unkolix is offline
dias
BANNED
Join Date: Jul 2009
Location: South Vietnam
Old 09-29-2012 , 05:50   Re: Need help with show/set hudmessage.
Reply With Quote #10

PHP Code:
#define TASK_RESPAWN_COUNT 34534534 
and delete the
PHP Code:
    if (g_endround)
    {
        
remove_task(taskid)
        return;
    } 

Last edited by dias; 09-29-2012 at 05:50.
dias is offline
Send a message via Yahoo to dias Send a message via Skype™ to dias
Reply


Thread Tools
Display Modes

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 08:11.


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