Raised This Month: $ Target: $400
 0% 

Solved Thank you supre ;3


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
Magicher0ex
Member
Join Date: Dec 2019
Old 09-25-2020 , 20:59   Thank you supre ;3
Reply With Quote #1

Hey guys, can anyone edit this to use SteamID time counting not by name
Code:
#include <amxmodx>
#include <colorchat>
#include <nvault>
#include <time>

#define MAX_PLAYERS 32

new g_iVault

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

public plugin_init()
{
	register_plugin("Time", "0.1", "ConnorMcLeod")
	register_dictionary("time.txt")

	g_iVault = nvault_open("played_time")

	register_clcmd("say /time", "ClientCommand_PlayedTime")
}

public plugin_end() nvault_close( g_iVault )
 

public client_authorized( id )
{
	new szTime[32]
	get_user_name(id, g_szName[id], charsmax(g_szName[]))
	nvault_get(g_iVault, g_szName[id], szTime, charsmax(szTime))
	g_iLastPlayedTime[id] = str_to_num(szTime)
}

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

public ClientCommand_PlayedTime( id )
{
    new szTime[128]
    new szName[32]
    get_time_length(id, get_user_total_playtime( id ), timeunit_seconds, szTime, charsmax(szTime))
    get_user_name(id, szName, charsmax(szName)) 
    ColorChat( id, GREEN, "^x04%s^x01's Time:^x04 %s", szName, szTime)
} 

public client_disconnect( id )
{
	new szTime[32]
	formatex(szTime, charsmax(szTime), "%d", get_user_total_playtime( id ))
	nvault_set(g_iVault, g_szName[id], szTime)
}

Last edited by Magicher0ex; 09-26-2020 at 10:01.
Magicher0ex 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 16:08.


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