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

nvault


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
InteX01
Senior Member
Join Date: Jan 2017
Old 12-13-2018 , 14:02   nvault
Reply With Quote #1

ok, so i read nvault tutorial, tried to do something and still this is not working..

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

#define PLUGIN "Custom Intex Plugin"
#define VERSION "1.0"
#define AUTHOR "InteX"

new sati[33], minute[33]

new 
vault


public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
//register_clcmd("say /skin", "cmd_skin")
    
register_clcmd("say /vreme""cmd_vreme")
    
register_clcmd("say /minute""cmd_minute")
    
register_clcmd("say /reset""cmd_reset")
    
    
vault nvault_open("MILF-DD2-NVAULT2")
}
public 
cmd_vreme(id)
{
    
ColorChat(idRED,"^4[MILF] ^1Ukupno vreme provedeno na serveru:^3 %d ^1sati i^3 %d ^1minuta.",sati[id], minute[id])
}
public 
cmd_minute(id)
{
    
minute[id] = 59
}
public 
cmd_reset(id)
{
    
sati[id] = 0
    minute
[id] = 0
}
public 
dodaj_minut(id)
{
    if(
minute[id] >= 59)
    {    
        
minute[id] = 0
        sati
[id]++
    }
    else
    {
        
minute[id]++
    }
    
PokreniVreme(id)
}
public 
UsnimiPodatke(id)
{
    new 
AuthID[35]
    
get_user_authid(idAuthID34)
    
    new 
vaultkey[64], vaultdata[256]
    
    
format(vaultkey63"%s-DD2"AuthID)
    
format(vaultdata255"%i#%i#"sati[id], minute[id])
    
    
nvault_set(vaultvaultkeyvaultdata)
}  
public 
UcitajPodatke(id)
{

    new 
AuthID[35]
    
get_user_authid(idAuthID34)
    
    new 
vaultkey[64], vaultdata[256]
    
    
format(vaultkey,63"%s-Mod"AuthID)
    
format(vaultdata,255"%i#%i#"sati[id], minute[id])
    
nvault_get(vaultvaultkeyvaultdata255)
    
    
replace_all(vaultdata255"#"" ")
    
    new 
sz_sati[32], sz_minute[32]
    
    
parse(vaultdatasz_sati31sz_minute31)
    
    
sati[id] = str_to_num(sz_sati)
    
minute[id] = str_to_num(sz_minute)
}
public 
PokreniVreme(id)
{
    
set_task(60.0"dodaj_minut"id)
}
public 
client_connect(id)
{
    
UcitajPodatke(id)
    
PokreniVreme(id)
}
public 
client_disconnect(id)
{
    
UsnimiPodatke(id)

so i wanna save minute[id] and sati[id] which are minutes and hours... but for some reason it doesnt save..

commands say /minute and say /reset are just there for testing plugin...

hope for fast answer, thanks.
InteX01 is offline
JocAnis
Veteran Member
Join Date: Jun 2010
Old 12-13-2018 , 17:02   Re: nvault
Reply With Quote #2

i didnt have experience with nvault but maybe this could be the problem:
Code:
format(vaultkey, 63, "%s-DD2", AuthID) 
    format(vaultdata, 255, "%i#%i#", sati[id], minute[id]) 

format(vaultkey,63, "%s-Mod", AuthID) 
    format(vaultdata,255, "%i#%i#", sati[id], minute[id]) 
}
differnce between keys?
__________________
KZ Public Autocup - PrimeKZ

My blog: http://primekz.xyz (in progress...) - not active (dec 2022)
JocAnis is offline
InteX01
Senior Member
Join Date: Jan 2017
Old 12-13-2018 , 17:18   Re: nvault
Reply With Quote #3

lel, i changed one but forgot second one to change,, ill test and see results

ye thx

Last edited by InteX01; 12-13-2018 at 17:30.
InteX01 is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 12-13-2018 , 18:07   Re: nvault
Reply With Quote #4

There is a simpler way you can use instead of all that complex.
PHP Code:

static szAuthid[33][32], gszActivityTime[24], g_user_time[33], UserActivityTime[33];
#define get_user_time(%1) (UserActivityTime[%1] + (get_systime() - g_user_time[%1]))

public client_putinserver(id)
{
      
get_user_authid(idszAuthid[id], 31);
      
g_user_time[id] = get_systime();
      
UserActivityTime[id] = nvault_get(gvaultszAuthid[id]);
}

public 
client_disconnect(id)
{
      
num_to_str(UserActivityTime[id] + (get_systime() - g_user_time[id]), gszActivityTime23);
      
nvault_set(gvaultszAuthid[id], gszActivityTime);

__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !


Last edited by Bugsy; 12-13-2018 at 21:22. Reason: Fixed get_nvault -> nvault_get
Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 12-13-2018 , 21:24   Re: nvault
Reply With Quote #5

Just save overall seconds, as Natsheh posted, and then do the math to calculate minutes and seconds.
__________________
Bugsy is online now
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 10:39.


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