Thread: [Solved] Thank you supre ;3
View Single Post
Supremache
Veteran Member
Join Date: Sep 2019
Location: Egypt
Old 09-25-2020 , 22:30   Re: STEAMID played time
Reply With Quote #4

Quote:
Originally Posted by Magicher0ex View Post
i mean szName stay but the time counting to be on steamid, not the name
Saving time to NVault = 0
Save time by Name = 2
Save time by steamid = 1
Save time by IP = 0

Code:
#include <amxmodx> #include <colorchat> #include <nvault> #include <time> #define MAX_PLAYERS 32 new g_iVault new g_SaveTime, g_SaveType; new g_szAuth[MAX_PLAYERS+1][32] new g_iLastPlayedTime[MAX_PLAYERS+1] public plugin_init() {     register_plugin("Time", "0.1", "ConnorMcLeod")     register_dictionary("time.txt")         g_SaveType = register_cvar("time_savetype","0") // Save time to : 0 = NVault.     g_SaveTime = register_cvar("time_save","1") // Save time by : 2 = Name, 1 = SteamID, 0 = IP.     g_iVault = nvault_open("played_time")     register_clcmd("say /time", "ClientCommand_PlayedTime") } public plugin_end() nvault_close( g_iVault )   public client_authorized( id ) {     LoadData(id) } 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 ) {     SaveData(id) } SaveData(id) {     new szKey[64];         if (get_pcvar_num(g_SaveTime) == 0)     {         get_user_ip(id, g_szAuth[id] , charsmax(g_szAuth[]), 1)         formatex(szKey , charsmax(szKey) , "%s-IP" , g_szAuth[id])     }     else if (get_pcvar_num(g_SaveTime) == 1)     {         get_user_authid(id , g_szAuth[id] , charsmax(g_szAuth[]))         formatex(szKey , charsmax(szKey) , "%s-ID" , g_szAuth[id])     }     else if (get_pcvar_num(g_SaveTime) == 2)     {         get_user_name(id, g_szAuth[id] , charsmax(g_szAuth[]))         formatex(szKey , charsmax(szKey) , "%s-NAME" , g_szAuth[id])     }         if (!get_pcvar_num(g_SaveType))     {         new szData[256]                 formatex(szData , charsmax(szData) , "%i#" , get_user_total_playtime( id ))                 nvault_pset(g_iVault , szKey , szData)     } } LoadData(id) {     new szKey[64];         if (get_pcvar_num(g_SaveTime) == 0)     {         get_user_ip(id, g_szAuth[id] , charsmax(g_szAuth[]), 1)         formatex(szKey , charsmax(szKey) , "%s-IP" , g_szAuth[id])     }     else if (get_pcvar_num(g_SaveTime) == 1)     {         get_user_authid(id , g_szAuth[id] , charsmax(g_szAuth[]))         formatex(szKey , charsmax(szKey) , "%s-ID" , g_szAuth[id])     }     else if (get_pcvar_num(g_SaveTime) == 2)     {         get_user_name(id, g_szAuth[id] , charsmax(g_szAuth[]))         formatex(szKey , charsmax(szKey) , "%s-NAME" , g_szAuth[id])     }         if (!get_pcvar_num(g_SaveType))     {         new szData[256], szTime[32];                 formatex(szData , charsmax(szData), "%i#", g_iLastPlayedTime[id])         nvault_get(g_iVault, szKey, szData, charsmax(szData))         replace_all(szData , charsmax(szData), "#", " ")         parse(szData, szTime, charsmax(szTime))         g_iLastPlayedTime[id] = str_to_num(szTime)     } }
__________________
Youtube.com/Supremache

Bank System [Nvault - SQL Support]
VIP System
  • If you think it's that simple, then do it yourself.

Last edited by Supremache; 09-25-2020 at 22:32.
Supremache is offline