Raised This Month: $ Target: $400
 0% 

Nvault how to save models?


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

well I made a menu for knifes according to certain conditions, and it works but I would like to be able to save the chosen models in nvault so I don't have to be choosing them every new map.

and I was testing how to use nvault, at the moment I understood something reading examples of some variables, but I don't understand how to save models

i try this But it does not work:

PHP Code:

//Include the nvault file
#include <nvault>

new knife_model[33], vModel[56]
new 
g_MenuCallback;            //Create a global variable to hold our callback

new g_iVaultID
new gMemoryTableNames[64][32]                // Stores players name for a key
new g_iData[33]
//----------------------------------------------------------------------------------------------
public plugin_init()
{
     
register_plugin("plugin KnifeMenuSH""1.0""Lucas Cab Arje")

    
register_clcmd("say /knife""KnifeMenu")        // Para llamar al menu de fakas

    //Create our callback and save it to our variable
    
g_MenuCallback menu_makecallback("menuitem_callback");    //The first parameter is the public function to be called when a menu item is being shown.
    
    // Eventos
    
register_event("CurWeapon","CurWeapon","be","1=1")     // Para cambiar las fakas models
}

public 
plugin_end( )
{
    
nvault_closeg_iVaultID )
}

public 
plugin_cfg( )
{
    
g_iVaultID nvault_open"knife_vault" )
    
    if( 
g_iVaultID == INVALID_HANDLE )
    {
        
set_fail_state"Error opening Knife Nvault" )
    }
}

public 
client_putinserverPlayer )
{
    
get_user_name(PlayergMemoryTableNames[Player], charsmax(gMemoryTableNames[]) )
    
Load_StuffPlayer )
}

public 
SetKnife(idKnife
{
    if (!
sh_is_active() || !is_user_alive(id) ) return; // PLUGIN_HANDLED
    
    
knife_model[id] = Knife 
    
    
new szSelection[4]
    
    switch(
Knife) {
        
// Estas Fakas van a partir de la primera Pagina
        //-----------    Ace Of Katanas
        
case 0: {
            if ( 
gHasAceOfKatanas[id] ) {
                
gHasPower[id] = true 
                format
(vModel,55,"models/shmod/ace_v_knife.mdl")
                
switch_model(id)
                
g_iDataid ] = str_to_num(szSelection)
            }
            else {
                
gHasPower[id] = false
            
}
        }
        
//-----------    Batman
        
case 1: {
            if ( 
gHasBatman[id] ) {
                
gHasPower[id] = true 
                format
(vModel,55,"models/shmod/batmanknife_v.mdl")
                
switch_model(id)
                
g_iDataid ] = str_to_num(szSelection)
            }
            else {
                
gHasPower[id] = false
            
}
        }
        
//-----------    Chucky
        
case 2: {
            if ( 
HasChucky[id] ) {
                
gHasPower[id] = true 
                format
(vModel,55,"models/shmod/chucky_knife.mdl")
                
switch_model(id)
                
g_iDataid ] = str_to_num(szSelection)
            }
            else {
                
gHasPower[id] = false
            
}
        }
        
//-----------    Darth Maul
        
case 3: {
            if ( 
gHasDarthMaulPowers[id] ) {
                
gHasPower[id] = true 
                format
(vModel,55,"models/shmod/darthmaul_knife.mdl"
                
switch_model(id)
                
g_iDataid ] = str_to_num(szSelection)
            }
            else     {
                
gHasPower[id] = false
            
}    
        }
    }
    
    new 
gMemoryTableNames234 ]
    
formatexgMemoryTableNames2charsmaxgMemoryTableNames2 ), "%sTEST"gMemoryTableNamesid ] )
    
    
formatexszSelectioncharsmaxszSelection ), "%sTEST"g_iDataid ] ) 
    
    
nvault_setg_iVaultIDgMemoryTableNames2szSelection )    
}

Load_StuffPlayer )
{
    new 
gMemoryTableNames234 ]
    
formatexgMemoryTableNames2charsmaxgMemoryTableNames2 ), "%sTEST"gMemoryTableNamesPlayer ] )
    
    
nvault_getg_iVaultIDgMemoryTableNames2 )
}
    
public 
CurWeapon(id
{
    if ( !
gHasPower[id] ) return
    
// Set Knife Model
    
SetKnife(idknife_model[id])  
    
    
switch_model(id
}

switch_model(id)
{
    if (!
sh_is_active() || !is_user_alive(id) ) return
    
    if (
get_user_weapon(id) == CSW_KNIFE) {
        
set_pev(idpev_viewmodel2vModel)
    }

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