Raised This Month: $ Target: $400
 0% 

Solved Stopwatch for Server


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Napoleon_be
Veteran Member
Join Date: Jul 2011
Location: Belgium
Old 03-31-2020 , 20:33   Re: Stopwatch for Server
Reply With Quote #2

untested

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

#include <amxmodx>
#include <amxmisc>

#define PLUGIN "StopWatch"
#define VERSION "1.0"
#define AUTHOR "NapoleoN#"

#define SWID 132465

new iSeconds;
new 
iMinutes;
new 
iHours;

public 
plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR);
    
    
register_clcmd("say /start""StartStopWatch");
    
register_clcmd("say /stop""StopStartWatch");
}

#if AMXX_VERSION_NUM < 190
public client_disconnect(id)
#else
public client_disconnected(id)
#endif
{
    new 
iPlayers[32], iNum;
    
get_players(iPlayersiNum);
    
    if(
iNum == 0)
    {
        
StopStartWatch(id);
    }
}

public 
StartStopWatch(id)
{
    
set_task(1.0"ShowHud"SWID__"b");
}

public 
ShowHud(id)
{
    if(
iSeconds++ > 60)
    {
        if(
iMinutes++ > 60)
        {
            
iHours++;
        }
    }
    
    
set_hudmessage(42170255, -1.00.7606.01.0);
    
show_hudmessage(id"Stopwatch: %i:%i:%i"iHoursiMinutesiSeconds);
}

public 
StopStartWatch(id)
{
    if(
task_exists(SWID))
    {
        
iSeconds 0;
        
iMinutes 0;
        
iHours 0;
        
        
remove_task(SWID);
    }

__________________

Last edited by Napoleon_be; 03-31-2020 at 22:02.
Napoleon_be is offline
Send a message via Skype™ to Napoleon_be
 



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 00:51.


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