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

Solved Saving all of this in nVault?


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
redivcram
Veteran Member
Join Date: Jul 2014
Location: Serbia
Old 06-09-2018 , 18:41   Saving all of this in nVault?
Reply With Quote #1

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

// The Data
enum {coinskeyschipsrocksgemsgoldsuccessinpawn};

// 1st Dimension: Player's ID
// 2nd Dimension: Max Data
new g_iDataHolder[33][8];

new 
g_iVault;

public 
plugin_init()
{
    
register_plugin("qwe""rty""uiop");

    
register_clcmd("change_data""CmdYourOwnData");
    
register_clcmd("save_data""SaveVault");

    
g_iVault nvault_open("hgrp");
}

public 
client_putinserver(id)
{
    new 
i;

    
// First set every data to 0
    
for(08i++)
        
g_iDataHolder[id][i] = 0

    
// successinpawn aka g_iDataHolder[id][7] should be set to 100 by default (For newcomers aka people who didn't save anything in vault)
    
g_iDataHolder[id][successinpawn] = 100;

    
LoadVault();
}

public 
ChangeYourOwnData(id)
{
    new 
szArgv_Select[2], szArgv_Set[4];

    
read_argv(1szArgv_Selectcharsmax(szArgv_Select));
    
read_argv(2szArgv_Setcharsmax(szArgv_Set));

    
// No checks for empty strings/boundaries necessary since its known what to type in this small temporary example

    
g_iDataHolder[id][str_to_num(szArgv_Select)] = str_to_num(szArgv_Set);

    return 
PLUGIN_CONTINUE;
}

public 
SaveVault() {return PLUGIN_CONTINUE;}
public 
LoadVault() {return PLUGIN_CONTINUE;} 
I know how to use nVault for storing simple data. This right here is not simple at all. I tried a couple of dumb ways, but none seem to do the thing. I can see the data in the vault file, but it never loads. How should it be done properly?

Last edited by redivcram; 06-10-2018 at 15:04.
redivcram 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 07:33.


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