Raised This Month: $ Target: $400
 0% 

Solved Stopwatch for Server


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
+ARUKARI-
AlliedModders Donor
Join Date: Jul 2004
Location: Japan
Old 03-31-2020 , 20:41   Re: Stopwatch for Server
Reply With Quote #3

I was late

PHP Code:
#pragma semicolon 1
#include <amxmodx>
#define PLUGIN    "StopWatch"
#define VERSION    "0.1"
#define AUTHOR    "Aoi.Kagase"
#define TASK_ID    1122

new g_stopwatch false;
new 
Float:g_starttime;

public 
plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR);
    
register_clcmd("say""stopwatch");
}

public 
stopwatch(id)
{
    new 
said[32];
    
read_argv(1saidcharsmax(said));

    if (
equali(said,"/start"))
    {
        
g_stopwatch true;
        
g_starttime get_gametime();

        
set_task(0.1"show_sw"TASK_ID id);
        
        return 
PLUGIN_HANDLED;
    } else
    if (
equali(said"/stop"))
    {
        
g_stopwatch false;
        return 
PLUGIN_HANDLED;
    }
    return 
PLUGIN_CONTINUE;
}

public 
show_sw(task)
{
    if (
g_stopwatch)
    {
        new 
timeformat[8];
        
get_time_format((get_gametime() - g_starttime), timeformatcharsmax(timeformat));
        
set_hudmessage(00255, -1.00.3500.51.00.00.1, -1);
        
show_hudmessage(0"%s"timeformat);
        
set_task(1.0"show_sw"task);
    }
}

get_time_format(Float:timesresult[], len)
{
    new 
hour floatround(times) / 60 /60;
    new 
min  =(floatround(times) / 60) % 60;
    new 
sec  floatround(times) % 60;
    
formatex(result[0], len"%i:%i:%i"hourminsec);

__________________
GitHub
SteamWishlist

六四天安門事件
+ARUKARI- 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 00:51.


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