Raised This Month: $ Target: $400
 0% 

Nvault how to save models?


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 03-26-2022 , 00:50   Re: Nvault how to save models?
Reply With Quote #6

If you want help, you need to post your full code that can be compiled. I was not even going to spend time on this but I figured I'd do what I can with what was provided. Take from it what you can.

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

enum Knives
{
    
NoKnife,
    
AceOfKatanas,
    
Batman,
    
Chucky,
    
DarthMaul
}
new const 
KnifeModelsKnives ][] = 
{
    
"",
    
"models/shmod/ace_v_knife.mdl",
    
"models/shmod/batmanknife_v.mdl",
    
"models/shmod/chucky_knife.mdl",
    
"models/shmod/darthmaul_knife.mdl"
};

enum PlayerData
{
    
AuthID34 ],
    
Knives:KnifeID
}
new 
g_pdDataMAX_PLAYERS ][ PlayerData ];

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_authorizedPlayer )
{
    
get_user_authidPlayerg_pdDataPlayer ][ AuthID ] , charsmaxg_pdData[][ AuthID ] ) );
    
Load_StuffPlayer );
}

public 
SetKnifeid Knives:Knife 
{
    if (!
sh_is_active() || !is_user_alive(id) ) return; // PLUGIN_HANDLED
    
    
new szKnifeID];
    if ( 
AceOfKatanas <= Knife <= DarthMaul )
    {
        
switch_modelid  )
        
g_pdDataid ][ KnifeID ] = Knife;
    }
    else 
    {
        
g_pdDataid ][ KnifeID ] = NoKnife;
    }
    
    
num_to_str_:Knife szKnifeID charsmaxszKnifeID ) );
    
nvault_setg_iVaultIDg_pdDataid ][ AuthID ] , szKnifeID )    
}

Load_StuffPlayer )
{
    new 
szKnifeID] , iTS;
    if ( 
nvault_lookupg_iVaultID g_pdDataPlayer ][ AuthID ] , szKnifeID charsmaxszKnifeID ) , iTS ) )
    {
        
g_pdDataPlayer ][ KnifeID ] = str_to_numszKnifeID );
    }
    else
    {
        
g_pdDataPlayer ][ KnifeID ] = NoKnife;
    }
    
}
    
public 
CurWeaponid 
{
    if ( 
g_pdDataid ][ KnifeID ] != NoKnife  
    {
        
switch_modelid 
    }
}

switch_modelid )
{
    if (!
sh_is_active() || !is_user_alive(id) ) return
    
    if (
get_user_weaponid ) == CSW_KNIFE
    {
        
set_pevid pev_viewmodel2 KnifeModelsg_pdDataid ][ KnifeID ] ] )
    }

__________________
Bugsy 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