Raised This Month: $27 Target: $400
 6% 

hud with countdown when player spawn


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
666
Senior Member
Join Date: Mar 2015
Old 03-21-2020 , 11:02   hud with countdown when player spawn
Reply With Quote #1

I'm trying to do it and every time a player spawn the countdown it starts again

PHP Code:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>
#include <hamsandwich>

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

new countdown

public plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
RegisterHam(Ham_Spawn"player""Spawn"1);
}

public 
Spawn()
{
    
countdown 20.0;
    
set_task_ex(1.0,"showhud",id,"",0,SetTask_RepeatTimes,countdown);
}

public 
showhud(id)
{
    if(--
countdown 0)
    {
        
set_hudmessage(255255255, -1.00.906.01.1,0.0,0.0,4);
        
show_hudmessage(id"TIME: %d"countdown);
    }
    else
    {
        
remove_task(id);
    }

__________________
666 is offline
iceeedr
Veteran Member
Join Date: Apr 2017
Location: Brazil
Old 03-21-2020 , 17:27   Re: hud with countdown when player spawn
Reply With Quote #2

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

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

#define HUDCOUNTDOWN 100

new Float:countdown
new cvar

public plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
RegisterHamPlayer(Ham_Spawn"PlayerSpawn"true)
    
cvar register_cvar("amx_time_task""20")
}

public 
PlayerSpawn(id)
{
    
remove_task(HUDCOUNTDOWN)
    
countdown 20.0;
    
set_task_ex(1.0"showhud"HUDCOUNTDOWN, .flags SetTask_RepeatTimes, .repeat get_pcvar_num(cvar))
}

public 
showhud()
{
    if(--
countdown 0)
    {
        
set_dhudmessage(255255255, -1.00.906.01.1,0.0,0.0);
        
show_dhudmessage(0"TIME: %.0f"countdown);
    }
    else
    {
        
remove_task(HUDCOUNTDOWN);
    }

__________________
iceeedr is offline
Send a message via Skype™ to iceeedr
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 22:01.


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