Raised This Month: $ Target: $400
 0% 

Countdown plugin


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
krysteksulek
Member
Join Date: Aug 2013
Location: Poland
Old 11-04-2013 , 20:21   Countdown plugin
Reply With Quote #1

Hi.
I want to do simple plugin, which will show hudmessage with timer.
I have this code:

Code:
#include <amxmodx>
#include <amxmisc>

#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "author"

#define TASKK 3481

new timer[33]

public plugin_init()
{
    register_plugin(PLUGIN, VERSION, AUTHOR)
    register_clcmd("say /test", "times"); 
}
public times(id)
{    
    client_print(id, print_chat, "Starting...");
    timer[id] = 30
    
    if(task_exists(id + TASKK))
    {
        remove_task( id + TASKK )
    }
    set_task( 10.0, "count", id + TASKK, _, _, "b" )
    
    return PLUGIN_CONTINUE
}
public count(task_id)
{
    new id = task_id - TASKK
  
    set_hudmessage(255, 255, 255, 0.03, 0.3, 0, 6.0, 60.0)
    show_hudmessage( id, "You have just: %d minutes", timer[id] )
    
    timer[id] -= 1
    
    if(timer[id] <= 0)
    {
        if( task_exists(task_id) )
        {
            remove_task( task_id )
        }
    }
}

}
I don't know how to show hudmessage at once by type cmd /test. Now it appear's after 60 sec.
A i want to ask if show_hudmessage( 0, not 'id', will be better. If yes - how to write it with task id?
And how to not dissapear HUD when for example: client will die or respawn.

I hope you will help.
krysteksulek 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 07:59.


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