Raised This Month: $ Target: $400
 0% 

Enable/Disable


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Artifact
Veteran Member
Join Date: Jul 2010
Old 04-29-2012 , 10:48   Re: Enable/Disable
Reply With Quote #4

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(PLUGINVERSIONAUTHOR)
    
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(currmap30)
        
get_cvar_string"amx_nextmap" NextMap 31 );
        
set_hudmessage(025500.010.2506.01.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"), currmapNextMap)
        }
        else
        {
            
show_hudmessage(0"Server: %s^nTrenutna mapa: %s^nSledeca mapa: %s^nVreme do sledece mape: %d:%d",get_cvar_pointer("hostname"), currmapNextMapiTimeLeft 60iTimeLeft 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(PLUGINVERSIONAUTHOR)
    
set_task(1.0"ShowHud",_,_,_,"b")
}

public 
ShowHud(id)
{
    new 
currmap[31], NextMap[32];
    
get_mapname(currmap30)
    
get_cvar_string"amx_nextmap" NextMap 31 );
    
set_hudmessage(025500.010.2506.01.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"), currmapNextMap)
    }
    else
    {
        
show_hudmessage(0"Server: %s^nTrenutna mapa: %s^nSledeca mapa: %s^nVreme do sledece mape: %d:%d",get_cvar_pointer("hostname"), currmapNextMapiTimeLeft 60iTimeLeft 60)
    }

Here is error with bool
__________________
Artifact is offline
 



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:46.


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