Raised This Month: $ Target: $400
 0% 

Nvault how to save models?


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Arje
Senior Member
Join Date: Apr 2020
Location: Córdoba, Argentina
Old 03-31-2022 , 16:24   Re: Nvault how to save models?
Reply With Quote #13

after reading and trying to understand some codes, I can get this that works for me at the moment,

but I realized that I would have to create a variable "g_PlayerBuyItem" for each item, do I have to continue like this or is there another way to do it?

and I know you told me to use nVault Array, but I really don't understand it and I didn't find any example of it more explained or similar to understand how to apply it in this case

At the moment this is the code that works for me:
PHP Code:
new g_PlayerBuyThanosMAX_PLAYERS ];

public 
menu_handlerid menu item )
{
    if ( 
item == MENU_EXIT ) {
        
menu_destroy(menu);
        return 
PLUGIN_HANDLED;
    }
    
    new 
szData[6], szName[64];
    new 
item_accessitem_callback;
    
menu_item_getinfomenuitemitem_accessszDatacharsmax(szData), szName,charsmax(szName), item_callback );
    
    
g_Model[id] = item;
    
    switch(
item) {
        
// This Skins is from First Page of the Menu
        //-----------    Blackwidow
        
case 0: {
            
resetModelid );
            
sh_chat_message(id, -1"Seleccionaste la Skin de Blackwidow .");
        }
        
//-----------    Broly
        
case 1: {
            
resetModelid );
            
sh_chat_message(id, -1"Seleccionaste la Skin de Broly.");
        }
        
//-----------    Neo
        
case 2: {
            
resetModelid );
            
sh_chat_message(id, -1"Seleccionaste la Skin de Neo.");
        }
        
//-----------    Obi wan
        
case 3: {
            
resetModelid );
            
sh_chat_message(id, -1"Seleccionaste la Skin de Obi Wan Kenobi.");
        }
        
//-----------    Termo
        
case 4: {
            
resetModelid );
            
sh_chat_message(id, -1"Valor of this? %d"g_PlayerBuyThanosid ]);    //That's only print for proofs
            
sh_chat_message(id, -1"Seleccionaste la Skin de Termo solo por nivel.");
        }
        
//-----------    Thanos
        
case 5: {
            
resetModelid );
            
sh_chat_message(id, -1"Valor of this? %d"g_PlayerBuyThanosid ]);    //That's only print for proofs
            
sh_chat_message(id, -1"Seleccionaste la Skin de Thanos Solo de Admin.");
        }
        
//-----------    Thanos End Game
        
case 6: {
            
resetModelid );
            
            
sh_chat_message(id, -1"Valor of this? %d"g_PlayerBuyThanosid ]);    //That's only print for proofs
            
            
if ( g_PlayerBuyThanos[id] != ) {
                new 
iXPToAdd = ( -5000 );
                
sh_set_user_xp(idiXPToAddtrue);
                
g_PlayerBuyThanos[id] = 1;
            }
            
            
sh_chat_message(id, -1"Compraste la Skin de Thanos End Game.");
        }
        case 
MENU_EXIT: {
            
sh_chat_message(id, -1"No Seleccionaste Ninguna Skin.");
        }
        
//-----------    Show Motd Info
        
default: {
            
show_motdid "Info Skins.txt" "Info Skins." );
        }
    }
    
    
SaveData(id);
    
//lets finish up this function by destroying the menu with menu_destroy, and a return
    
menu_destroy(menu);
    return 
PLUGIN_CONTINUE;
}
//------------------------------------------------------------------------------------------------
//                Save and Load Data from Nvault.                    //
//------------------------------------------------------------------------------------------------
public SaveData(id)

    new 
szKey40 ] , szData[4];
     
    
format(szDatacharsmaxszData ),"%i %d",g_Model[id], g_PlayerBuyThanos[id] );
    
    
nvault_setg_iVaultID g_szAuthID[id], szData );


public 
LoadData(id

    
    new 
DataModel[4], BuyThanos[4], szData[4] , iTS;   
    
nvault_getg_iVaultIDg_szAuthIDid ], szDatacharsmaxszData ) );
    
    
parseszDataDataModelcharsmaxDataModel ), BuyThanoscharsmaxBuyThanos ) );
    
    
g_Model[id] = str_to_numDataModel );
    
g_PlayerBuyThanos[id] = str_to_numBuyThanos );
    
    if ( 
nvault_lookupg_iVaultID g_szAuthIDid ] , szData charsmaxszData ) , iTS ) ) {
    
        
g_Modelid ] = str_to_numDataModel );
        
g_PlayerBuyThanos[id] = str_to_numBuyThanos );
        }
    else     {
        
g_Model[id] = NoModelSet;
    }

Arje 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:37.


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