Raised This Month: $ Target: $400
 0% 

[Need help] Nvault -> MySql saving


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
andrzN
Senior Member
Join Date: Jan 2010
Location: Bodø / Norway
Old 12-28-2012 , 16:54   [Need help] Nvault -> MySql saving
Reply With Quote #1

I need help changing a plugin that uses nvault save to make it use mysql save.

I have no knowledge what so ever of how to code with mysql saving, so I need you you to make the code for me. If you need any more information from the plugin to be able to do this, please tell me.

Here is the code for saving/loading.

PHP Code:
public client_disconnect(id

    
TotalPlayedTime[id] = TotalPlayedTime[id] + (get_user_time(id)); 
    
SaveTime(idTotalPlayedTime[id]); 


public 
client_putinserver(id

    
TotalPlayedTime[id] = LoadTime(id);


public 
LoadTimeid )  

    new 
valut nvault_open("Time_played_0.4"
     
    new 
authid[33]; 
    new 
vaultkey[64], vaultdata[64]; 
     
    
get_user_authid(idauthid[id],31); 
     
    
format(vaultkey63"TIMEPLAYED%s"authid[id]); 
     
    
nvault_get(valutvaultkeyvaultdata63); 
    
nvault_close(valut); 
     
    return 
str_to_num(vaultdata); 


public 
SaveTime(id,PlayedTime

    new 
valut nvault_open("Time_played_0.4"
     
    if(
valut == INVALID_HANDLE
        
set_fail_state("nValut returned invalid handle"
     
    new 
authid[33]; 
    new 
vaultkey[64], vaultdata[64]; 
     
    
get_user_authid(idauthid[id],31); 
     
    
format(vaultkey63"TIMEPLAYED%s"authid[id]);  
    
format(vaultdata63"%d"PlayedTime);  
     
    
nvault_set(valutvaultkeyvaultdata); 
    
nvault_close(valut); 


public 
prune() 

    new 
valut nvault_open("Time_played_0.4"); 
     
    if(
valut == INVALID_HANDLE
        
set_fail_state("nValut returned invalid handle"); 
     
    
nvault_prune(valut0get_systime() - PRUNE_TIME); 
    
nvault_close(valut); 


public 
plugin_end() 

    
prune() 

Thank you so much in advance if anyone would help me!

Last edited by andrzN; 12-28-2012 at 16:55.
andrzN is offline
Send a message via MSN to andrzN
 



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 13:36.


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