Raised This Month: $32 Target: $400
 8% 

playing time (Show only hours)


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Mr.Waffle
Senior Member
Join Date: Dec 2011
Old 05-05-2012 , 11:39   playing time (Show only hours)
Reply With Quote #1

hello ,
PHP Code:
#include <amxmodx>
#include <nvault>
#include <time>

#define VERSION "0.0.1"
#define PLUGIN "Played Time"

#define MAX_PLAYERS        32

new g_iVault

new g_szSteamId[MAX_PLAYERS+1][32]
new 
g_iLastPlayedTime[MAX_PLAYERS+1]

public 
plugin_init()
{
    
register_plugin(PLUGINVERSION"ConnorMcLeod")
    
register_dictionary("time.txt")

    
g_iVault nvault_open("played_time")

    
register_clcmd("say /playtime""ClientCommand_PlayedTime")
}

public 
plugin_end()
{
    
nvault_closeg_iVault )
}

public 
client_authorizedid )
{
    
get_user_authid(idg_szSteamId[id], charsmax(g_szSteamId[]))

    new 
szTime[32]
    
nvault_get(g_iVaultg_szSteamId[id], szTimecharsmax(szTime))
    
g_iLastPlayedTime[id] = str_to_num(szTime)
}

get_user_total_playtimeid )
{
    return 
g_iLastPlayedTime[id] + get_user_time(id)
}

public 
ClientCommand_PlayedTimeid )
{
    new 
szTime[128]
    
get_time_length(idget_user_total_playtimeid ), timeunit_secondsszTimecharsmax(szTime))
    
client_printidprint_chat"Played time : %s"szTime )
}

public 
client_disconnectid )
{
    new 
szTime[32]
    
formatex(szTimecharsmax(szTime), "%d"get_user_total_playtimeid ))
    
nvault_set(g_iVaultg_szSteamId[id], szTime)

this plugin by ConnorMcLeod .

What I need to change here, that will show just hours? ( now its show hours, minutes, seconds)
thx.

Last edited by Mr.Waffle; 05-05-2012 at 11:40.
Mr.Waffle is offline
Old 05-05-2012, 12:58
Larcyn
This message has been deleted by Larcyn. Reason: nvm
Larcyn
Senior Member
Join Date: Oct 2010
Old 05-05-2012 , 13:01   Re: playing time (Show only hours)
Reply With Quote #2

Try this, sorry for doublepost.
PHP Code:
#include <amxmodx>
#include <nvault>
#include <time>

#define VERSION "0.0.1"
#define PLUGIN "Played Time"

#define MAX_PLAYERS        32

new g_iVault

new g_szSteamId[MAX_PLAYERS+1][32]
new 
g_iLastPlayedTime[MAX_PLAYERS+1]

public 
plugin_init()
{
    
register_plugin(PLUGINVERSION"ConnorMcLeod")
    
register_dictionary("time.txt")

    
g_iVault nvault_open("played_time")

    
register_clcmd("say /playtime""ClientCommand_PlayedTime")
}

public 
plugin_end()
{
    
nvault_closeg_iVault )
}

public 
client_authorizedid )
{
    
get_user_authid(idg_szSteamId[id], charsmax(g_szSteamId[]))

    new 
szTime[32]
    
nvault_get(g_iVaultg_szSteamId[id], szTimecharsmax(szTime))
    
g_iLastPlayedTime[id] = str_to_num(szTime)
}

get_user_total_playtimeid )
{
    return 
g_iLastPlayedTime[id] + get_user_time(id)
}

public 
ClientCommand_PlayedTimeid )
{
    new 
szTime[128]
    
get_time_length(idget_user_total_playtimeid ), timeunit_hoursszTimecharsmax(szTime))
    
client_printidprint_chat"Played time : %s"szTime )
}

public 
client_disconnectid )
{
    new 
szTime[32]
    
formatex(szTimecharsmax(szTime), "%d"get_user_total_playtimeid ))
    
nvault_set(g_iVaultg_szSteamId[id], szTime)

__________________

Taking private requests, PM me for information.
Selling HideNSeek & Jailbreak plugins.

Selling Achievement API System (PHP &
MySQL / nVault)
Larcyn is offline
Mr.Waffle
Senior Member
Join Date: Dec 2011
Old 05-05-2012 , 13:07   Re: playing time (Show only hours)
Reply With Quote #3

I've tried to change it to timeunit_hours and somting wrong here
when i change it to timeunit_hours its says :
Quote:
Played time : 5 weeks, 5 days and 10 hour
It can not be right .. 5 weeks ? the Server does not exist so long...

Last edited by Mr.Waffle; 05-05-2012 at 13:08.
Mr.Waffle is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 05-05-2012 , 21:36   Re: playing time (Show only hours)
Reply With Quote #4

PHP Code:
#include <amxmodx>
#include <nvault>

#define VERSION "0.0.1"
#define PLUGIN "Played Time"

#define MAX_PLAYERS        32

new g_iVault

new g_szSteamId[MAX_PLAYERS+1][32]
new 
g_iLastPlayedTime[MAX_PLAYERS+1]

public 
plugin_init()
{
    
register_plugin(PLUGINVERSION"ConnorMcLeod")
    
register_dictionary("time.txt")

    
g_iVault nvault_open("played_time")

    
register_clcmd("say /playtime""ClientCommand_PlayedTime")
}

public 
plugin_end()
{
    
nvault_closeg_iVault )
}

public 
client_authorizedid )
{
    
get_user_authid(idg_szSteamId[id], charsmax(g_szSteamId[]))

    new 
szTime[32]
    
nvault_get(g_iVaultg_szSteamId[id], szTimecharsmax(szTime))
    
g_iLastPlayedTime[id] = str_to_num(szTime)
}

get_user_total_playtimeid )
{
    return 
g_iLastPlayedTime[id] + get_user_time(id)
}

public 
ClientCommand_PlayedTimeid )
{
    new 
szTime[128]
    new 
iLength get_user_total_playtimeid ) / 3600
    client_print
idprint_chat"Played time : %d %L"iLengthid, (iLength == 1) ? "TIME_ELEMENT_HOUR" "TIME_ELEMENT_HOURS" )
}

public 
client_disconnectid )
{
    new 
szTime[32]
    
formatex(szTimecharsmax(szTime), "%d"get_user_total_playtimeid ))
    
nvault_set(g_iVaultg_szSteamId[id], szTime)

__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
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 05:16.


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