Raised This Month: $51 Target: $400
 12% 

Change nvault to sql


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
wicho
Veteran Member
Join Date: Feb 2012
Location: GuateAmala
Old 09-14-2020 , 00:34   Change nvault to sql
Reply With Quote #1

Hi everybody, can someone change this code to sql pls? .... thx in advance

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

//Uncomment 'IM_USING_ZP50' if your server is running ZP50 and above.
//#define IM_USING_ZP50
#if defined IM_USING_ZP50
native zp_ammopacks_get(id)
native zp_ammopacks_set(idamount)
#else
native zp_get_user_ammo_packs(id)
native zp_set_user_ammo_packs(idamount)
#endif

//Your vault name
#define VAULT_NAME "apstore"

//Max player's ammopack that can be save in vault.
#define MAX_AMMOPACK 9999

//Max day player's ammopack can be stay in vault, set 0 = permanent.
#define DAY_PRUNE 15
new hVaultHandlebool:bIsLoaded[33], szSteamid[33][35]

public 
plugin_init()
{
    
register_plugin("ZP AP Store""0.0.1""wbyokomo")
}

public 
plugin_cfg()
{
    
hVaultHandle nvault_open(VAULT_NAME)
    if(
hVaultHandle == INVALID_HANDLE)
    {
        new 
szText[128]
        
formatex(szText127"Error opening '%s' nVault."VAULT_NAME)
        
set_fail_state(szText)
    }
    
    new 
day DAY_PRUNE
    
if(day 0nvault_prune(hVaultHandle0get_systime() - (DAY_PRUNE 86400));
}

public 
plugin_end()
{
    
nvault_close(hVaultHandle)
}

public 
client_putinserver(id)
{
    if(
is_user_hltv(id)) return;
    if(
is_user_bot(id)) return;
    
    
get_user_authid(idszSteamid[id], 34)
    
LoadData(id)
}

public 
client_disconnect(id)
{
    
SaveData(id)
    
bIsLoaded[id] = false
}

LoadData(id)
{
    new 
szKey[40]
    
formatex(szKey39"%sZPAP"szSteamid[id])
    new 
iAmmo nvault_get(hVaultHandleszKey)
    
#if defined IM_USING_ZP50
    
zp_ammopacks_set(idiAmmo)
    
#else
    
zp_set_user_ammo_packs(idiAmmo)
    
#endif
    
bIsLoaded[id] = true
}

SaveData(id)
{
    if(!
bIsLoaded[id]) return;
    
    
#if defined IM_USING_ZP50
    
new ap zp_ammopacks_get(id)
    
#else
    
new ap zp_get_user_ammo_packs(id)
    
#endif
    
if(ap MAX_AMMOPACKap MAX_AMMOPACK;
    new 
szAmmo[12], szKey[40]
    
formatex(szKey39"%sZPAP"szSteamid[id])
    
formatex(szAmmo11"%d"ap)
    
nvault_set(hVaultHandleszKeyszAmmo)

wicho 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 23:12.


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