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 KnifeModels[ Knives ][] =
{
"",
"models/shmod/ace_v_knife.mdl",
"models/shmod/batmanknife_v.mdl",
"models/shmod/chucky_knife.mdl",
"models/shmod/darthmaul_knife.mdl"
};
enum PlayerData
{
AuthID[ 34 ],
Knives:KnifeID
}
new g_pdData[ MAX_PLAYERS + 1 ][ 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_close( g_iVaultID )
}
public plugin_cfg( )
{
g_iVaultID = nvault_open( "knife_vault" )
if( g_iVaultID == INVALID_HANDLE )
{
set_fail_state( "Error opening Knife Nvault" )
}
}
public client_authorized( Player )
{
get_user_authid( Player, g_pdData[ Player ][ AuthID ] , charsmax( g_pdData[][ AuthID ] ) );
Load_Stuff( Player );
}
public SetKnife( id , Knives:Knife )
{
if (!sh_is_active() || !is_user_alive(id) ) return; // PLUGIN_HANDLED
new szKnifeID[ 2 ];
if ( AceOfKatanas <= Knife <= DarthMaul )
{
switch_model( id )
g_pdData[ id ][ KnifeID ] = Knife;
}
else
{
g_pdData[ id ][ KnifeID ] = NoKnife;
}
num_to_str( _:Knife , szKnifeID , charsmax( szKnifeID ) );
nvault_set( g_iVaultID, g_pdData[ id ][ AuthID ] , szKnifeID )
}
Load_Stuff( Player )
{
new szKnifeID[ 2 ] , iTS;
if ( nvault_lookup( g_iVaultID , g_pdData[ Player ][ AuthID ] , szKnifeID , charsmax( szKnifeID ) , iTS ) )
{
g_pdData[ Player ][ KnifeID ] = str_to_num( szKnifeID );
}
else
{
g_pdData[ Player ][ KnifeID ] = NoKnife;
}
}
public CurWeapon( id )
{
if ( g_pdData[ id ][ KnifeID ] != NoKnife )
{
switch_model( id )
}
}
switch_model( id )
{
if (!sh_is_active() || !is_user_alive(id) ) return
if (get_user_weapon( id ) == CSW_KNIFE)
{
set_pev( id , pev_viewmodel2 , KnifeModels[ g_pdData[ id ][ KnifeID ] ] )
}
}
__________________