My code with bool:
PHP Code:
#include <amxmodx>
#include <amxmisc>
#define PLUGIN "hud"
#define VERSION "1.0"
#define AUTHOR "good."
new bool:hud
public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR)
set_task(1.0, "ShowHud",_,_,_,"b")
register_clcmd("say /hide_hud", "HideHud")
register_clcmd("say /show_hud", "Show_Hud")
}
public HideHud()
{
hud = false
return PLUGIN_HANDLED
}
public Show_Hud()
{
hud = true
return PLUGIN_HANDLED
}
public ShowHud(id)
{
if(hud == true) {
new currmap[31], NextMap[32];
get_mapname(currmap, 30)
get_cvar_string( "amx_nextmap" , NextMap , 31 );
set_hudmessage(0, 255, 0, 0.01, 0.25, 0, 6.0, 1.0)
new iTimeLeft = get_timeleft();
if(get_cvar_num("mp_timelimit") == 0)
{
show_hudmessage(0, "Server: %s^nTrenutna mapa: %s^nSledeca mapa: %s^nMapa se menja nakon ove runde!",get_cvar_pointer("hostname"), currmap, NextMap)
}
else
{
show_hudmessage(0, "Server: %s^nTrenutna mapa: %s^nSledeca mapa: %s^nVreme do sledece mape: %d:%d",get_cvar_pointer("hostname"), currmap, NextMap, iTimeLeft / 60, iTimeLeft % 60)
}
}
else
return PLUGIN_HANDLED
return PLUGIN_HANDLED
}
And without bool and without enable/disable plugin..
PHP Code:
#include <amxmodx>
#include <amxmisc>
#define PLUGIN "hud"
#define VERSION "1.0"
#define AUTHOR "good."
public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR)
set_task(1.0, "ShowHud",_,_,_,"b")
}
public ShowHud(id)
{
new currmap[31], NextMap[32];
get_mapname(currmap, 30)
get_cvar_string( "amx_nextmap" , NextMap , 31 );
set_hudmessage(0, 255, 0, 0.01, 0.25, 0, 6.0, 1.0)
new iTimeLeft = get_timeleft();
if(get_cvar_num("mp_timelimit") == 0)
{
show_hudmessage(0, "Server: %s^nTrenutna mapa: %s^nSledeca mapa: %s^nMapa se menja nakon ove runde!",get_cvar_pointer("hostname"), currmap, NextMap)
}
else
{
show_hudmessage(0, "Server: %s^nTrenutna mapa: %s^nSledeca mapa: %s^nVreme do sledece mape: %d:%d",get_cvar_pointer("hostname"), currmap, NextMap, iTimeLeft / 60, iTimeLeft % 60)
}
}
Here is error with bool
__________________