Raised This Month: $ Target: $400
 0% 

precaching arrays


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
brN17
Junior Member
Join Date: Mar 2022
Old 05-26-2022 , 16:40   precaching arrays
Reply With Quote #1

Hello, got an error on server console, how am I supposed to precache correctly this way?

Code:
FATAL ERROR (shutting down): SV_ModelIndex: SV_ModelIndex: model Chucky not precached
Segmentation fault (core dumped)
the arrays on my code are like that:

Code:
new const g_ModelData[Knifes][KnifeModels] =  
{ 
	{ "Chucky",		"models/shmod/chuckyy_VIP_knife.mdl"},
	{ "DarthMaul",		"models/shmod/darthmaul_VIP_knife.mdl"},
	{ "Riddick",		"models/shmod/riddick_VIP_knife.mdl"},
	{ "Wolv",		"models/shmod/wolv_VIP_knife.mdl"},
	{ "Grim",		"models/shmod/grimreaper_VIP_knife.mdl"}
}

new const g_ModelPData[Knifes][PModels] =  
{ 
	{ "Chucky",		"models/p_knife.mdl"},
	{ "DarthMaul",		"models/shmod/darthmaul_p_knife.mdl"},
	{ "Riddick",		"models/p_knife.mdl"},
	{ "Wolv",		"models/p_knife.mdl"},
	{ "Grim",		"models/shmod/grimreaperV_p_knife.mdl"}
}
brN17 is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 05-26-2022 , 18:01   Re: precaching arrays
Reply With Quote #2

Show the definition of "Knifes" and "KnifeModels".

Also, are you sure this doesn't already exist?
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
brN17
Junior Member
Join Date: Mar 2022
Old 05-26-2022 , 20:06   Re: precaching arrays
Reply With Quote #3

not exactly, It's different since It's exclusive for SH Mod and not as complete as yours are
please tell me If "entity_set_string(id, EV_SZ_weaponmodel, g_ModelPData[iModelIndex][PModels]);" is correct too, I want it to save on nvault as well

complete code not fully tested since it's crashing:
Code:
#include <superheromod> 
#include <nvault>

#define MAX_PLAYERS 32

new bool:gHasChucky[SH_MAXSLOTS+1]
new bool:gHasDarthMaulPowers[SH_MAXSLOTS+1]
new bool:ghasRiddickPowers[SH_MAXSLOTS+1]
new bool:ghasWolvPowers[SH_MAXSLOTS+1]
new bool:ghasGrimPower[SH_MAXSLOTS+1]


new chuckyID, darthmaulID, riddickID, wolvID, grimreaperID

enum Knifes
{ 
	NoKnifeSet = -1,
	Chucky,
	DarthMaul,
	Riddick,
	Wolv,
	Grim
} 

enum KnifeModels
{ 
	ModelName[ 64 ],
	ViewModel[ 64 ],

}

enum PreviewModels
{
	PModels[ 64 ]
}

new const g_ModelData[Knifes][KnifeModels] =  
{ 
	{ "Chucky",		"models/shmod/chuckyy_VIP_knife.mdl"},
	{ "DarthMaul",		"models/shmod/darthmaul_VIP_knife.mdl"},
	{ "Riddick",		"models/shmod/riddick_VIP_knife.mdl"},
	{ "Wolv",		"models/shmod/wolv_VIP_knife.mdl"},
	{ "Grim",		"models/shmod/grimreaper_VIP_knife.mdl"}
}

new const g_ModelPData[Knifes][PModels] =  
{ 
	{ "Chucky",		"models/p_knife.mdl"},
	{ "DarthMaul",		"models/shmod/darthmaul_p_knife.mdl"},
	{ "Riddick",		"models/p_knife.mdl"},
	{ "Wolv",		"models/p_knife.mdl"},
	{ "Grim",		"models/shmod/grimreaperV_p_knife.mdl"}
}

new Knifes:knife_model[SH_MAXSLOTS+ 1];
new g_MenuCallback;			//Create a global variable to hold our callback

new g_iVaultID
new g_szSteamID[ MAX_PLAYERS + 1 ][ 34 ];	 // steam ID
// new gMemoryTableNames[64][32]				// Stores players name for a key
//----------------------------------------------------------------------------------------------
public plugin_init()
{
	register_plugin("plugin KnifeMenuSH", "1.0", "Lucas Cab Arje + brn17")

	register_clcmd("say /facas_vip", "vip")		// 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
	set_task(0.2, "cache_id");				   //we need to let superhero cache all the heros to avoid issues
}


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_putinserver(Player)
public client_authorized(Player)  
{
	//get_user_name(Player, gMemoryTableNames[Player], charsmax(gMemoryTableNames[]) )
	get_user_authid( Player, g_szSteamID[Player], charsmax(g_szSteamID[ ]) )
	Load_Stuff( Player )
}
//----------------------------------------------------------------------------------------------
public cache_id() 
{
	// Primera Pagin Menu
	chuckyID				= sh_get_hero_id("Chucky");
	darthmaulID				= sh_get_hero_id("Darth Maul");
	riddickID				= sh_get_hero_id("Riddick");
	wolvID					= sh_get_hero_id("Wolverine");
	grimreaperID				= sh_get_hero_id("Grim Reaper");
}
//----------------------------------------------------------------------------------------------
public sh_hero_init(id, heroID, mode)
{
	// Chucky
	if ( chuckyID == heroID )
		gHasChucky[id] = mode ? true : false
	// Darth Maul	
	else if ( darthmaulID == heroID )
		gHasDarthMaulPowers[id] = mode ? true : false
	// Riddick	
	else if ( riddickID == heroID )
		ghasRiddickPowers[id] = mode ? true : false
	// Wolverine	
	else if ( wolvID == heroID )
		ghasWolvPowers[id] = mode ? true : false
	// Grim Reaper
	else if ( grimreaperID == heroID )
		ghasGrimPower[id] = mode ? true : false
}
//----------------------------------------------------------------------------------------------
public vip(id)
{
	if (get_user_flags(id) & ADMIN_LEVEL_E)
		{
			KnifeMenu(id)
		}
	else
		{
			ChatColor(id, "!g[SERVER] !nEste recurso é exclusivo para !gVIPs!n adquira j o seu!")
		}
}
//----------------------------------------------------------------------------------------------
public KnifeMenu(id)
{
	new menu = menu_create( "\rRevive Player Menu!:", "menu_handler" );

	// Esto son de la Primera pagina del menu								//	Item	Key
	menu_additem( menu, "\wChucky.", "", 0, g_MenuCallback );				//	0		1
	menu_additem( menu, "\wDarth Maul.", "", 0, g_MenuCallback );			//	1		2
	menu_additem( menu, "\wRiddick.", "", 0, g_MenuCallback );				//	2		3
	menu_additem( menu, "\wWolverine.", "", 0, g_MenuCallback );			//	3		4
	menu_additem( menu, "\wGrim Reaper.", "", 0, g_MenuCallback );
	
	// El Key 8 reservado para Back Menu -- Y el Key 9 Para el More Menu -- esto es automatico no lo controlo
	menu_display(id, menu, 0);
}

public menu_handler(id, menu, item)
{
	if ( item == MENU_EXIT ) {
		menu_destroy( menu );
		return PLUGIN_HANDLED;
	}
	
	new szData[6], szName[64];
	new item_access, item_callback;
	menu_item_getinfo( menu, item, item_access, szData, charsmax(szData), szName,charsmax(szName), item_callback );
	
	switch(item) {
		// Estas Fakas van a partir de la Primera Pagina del Menu
		//-----------	Chucky
		case 0: {
			SetKnife( id, Knifes:Chucky);
			ChatColor(id, "!g[SERVER] !nVocê selecionou o model !gVIP!n de !gChucky!")
		}
		//-----------	Darth Maul
		case 1: {
			SetKnife( id, Knifes:DarthMaul);
			ChatColor(id, "!g[SERVER] !nVocê selecionou o model !gVIP!n de !gDarth Maul!")
		}
		//-----------	Riddick
		case 2: {
			SetKnife( id, Knifes:Riddick);
			ChatColor(id, "!g[SERVER] !nVocê selecionou o model !gVIP!n de !gRiddick!")
		}
		//-----------	Wolverine
		case 3: {
			SetKnife( id, Knifes:Wolv);
			ChatColor(id, "!g[SERVER] !nVocê selecionou o model !gVIP!n de !gWolverine!")
		}
		//-----------	Grim Reaper
		case 4: {
			SetKnife( id, Knifes:Grim);
			ChatColor(id, "!g[SERVER] !nVocê selecionou o model !gVIP!n de !gGrim Reaper!")
		}
		case MENU_EXIT: {
			ChatColor(id, "!g[SERVER] !nVocê !gnão !nselecionou nenhum !gmodel.")
		}
	}
	
	SaveData(id);
	//lets finish up this function by destroying the menu with menu_destroy, and a return
	menu_destroy(menu);
	return PLUGIN_HANDLED;
}

public SetKnife(id , Knifes:Knife)  
{ 
	if (!sh_is_active() || !is_user_alive(id) ) return PLUGIN_HANDLED;
	
	new Knifes:iModelIndex = NoKnifeSet;

	iModelIndex = Knife;
	knife_model[id] = iModelIndex;
	
	if ( get_user_weapon(id) == CSW_KNIFE ) { 
	entity_set_string(id, EV_SZ_viewmodel, g_ModelData[iModelIndex][ViewModel]);
	entity_set_string(id, EV_SZ_weaponmodel, g_ModelPData[iModelIndex][PModels]);
	}
	
	return PLUGIN_HANDLED;	
}

public CurWeapon(id) 
{ 
	if ( (is_user_alive(id)) && (get_user_flags(id) & ADMIN_LEVEL_E)) 
		SetKnife(id, knife_model[id])
		
	return PLUGIN_HANDLED	
} 

public SaveData(id) 
{  
	new szKey[ 40 ] , szData[ 4 ]; 
	 
	//formatex( szKey , charsmax( szKey ) , "%s_knife" ,  gMemoryTableNames[id] );
	formatex( szKey , charsmax( szKey ) , "%s_knife" ,  g_szSteamID[id] );

	num_to_str( _:knife_model[ id ] , szData , charsmax( szData ) ); 
	 
	nvault_set( g_iVaultID , szKey , szData ); 
} 

public Load_Stuff(id)  
{  
	new szKey[40] , szData[4] , iTS;  
	
	// formatex( szKey , charsmax( szKey ) , "%s_knife" , gMemoryTableNames[id] ); 
	formatex( szKey , charsmax( szKey ) , "%s_knife" , g_szSteamID[id] ); 
	 
	if ( nvault_lookup( g_iVaultID , szKey , szData , charsmax( szData ) , iTS ) ) { 
		knife_model[ id ] = Knifes:str_to_num( szData ); 
	}
}
// This is our callback function. Return ITEM_ENABLED, ITEM_DISABLED, or ITEM_IGNORE.
public menuitem_callback(id, menu, item)
{
	// Chucky
	if ( item == 0 && !gHasChucky[id] ) {
		menu_item_setname(menu, item, "\dChucky.");
		return ITEM_DISABLED;
	}
	// Darth Maul
	if ( item == 1 && !gHasDarthMaulPowers[id] ) {
		menu_item_setname(menu, item, "\dDarth Maul.");
		return ITEM_DISABLED;
	}
	// Riddick
	if ( item == 2 && !ghasRiddickPowers[id] )
	{
		menu_item_setname(menu, item, "\dRiddick.");
		return ITEM_DISABLED;
	}
	// Wolverine
	if ( item == 3 && !ghasWolvPowers[id] ) {
		menu_item_setname(menu, item, "\dWolverine.");
		return ITEM_DISABLED;
	}
	// Grim Reaper
	if ( item == 4 && !ghasGrimPower[id] ) {
		menu_item_setname(menu, item, "\dGrim Reaper.");
		return ITEM_DISABLED;
	}
	
	//Otherwise we can just ignore the return value
	return ITEM_IGNORE;	 //Note that returning ITEM_ENABLED will override the admin flag check from menu_additem	
} 

stock ChatColor(const id, const input[], any:...) {
	new count = 1, players[32];
	static msg[191];
	vformat(msg, 190, input, 3);
	
	replace_all(msg, 190, "!g", "^4"); // verde
	replace_all(msg, 190, "!n", "^1"); // galben/alb/negru
	replace_all(msg, 190, "!t", "^3"); // rosu/albastru/gri
	replace_all(msg, 190, "!t2", "^0"); // rosu2/albastru2/gri2
	
	if (id) players[0] = id; else get_players(players, count, "ch");
	{
		for (new i = 0; i < count; i++)
			{
			if (is_user_connected(players[i]))
				{
				message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, players[i]);
				write_byte(players[i]);
				write_string(msg);
				message_end();
			}
		}
	}
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1030\\ f0\\ fs16 \n\\ par }
*/
amateur work, appreciate your help OciXCrom-sama
brN17 is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 05-26-2022 , 23:57   Re: precaching arrays
Reply With Quote #4

PHP Code:
enum Knifes

    
NoKnifeSet = -1,
    
Chucky,
    
DarthMaul,
    
Riddick,
    
Wolv,
    
Grim


enum ModelInfo
{
    
ModelName64 ],
    
ModelData64 ],
    
ModelPData64 ]
}

new const 
g_ModelData[Knifes][ ModelInfo ] = 
{
    { 
"Chucky" "models/shmod/chuckyy_VIP_knife.mdl" "models/p_knife.mdl" },
    { 
"DarthMaul" "models/shmod/darthmaul_VIP_knife.mdl" "models/shmod/darthmaul_p_knife.mdl" },
    { 
"Riddick" "models/shmod/riddick_VIP_knife.mdl" "models/p_knife.mdl" },
    { 
"Wolv" "models/shmod/wolv_VIP_knife.mdl" "models/p_knife.mdl" },
    { 
"Grim" "models/shmod/grimreaper_VIP_knife.mdl" "models/shmod/grimreaperV_p_knife.mdl" }
};

public 
plugin_precache()
{
    for ( new 
Knifes:kModelIndex Chucky kModelIndex Knifes kModelIndex++ )
    {
        
precache_modelg_ModelDatakModelIndex ][ ModelData ] );
        
precache_modelg_ModelDatakModelIndex ][ ModelPData ] );
    }

__________________
Bugsy is offline
brN17
Junior Member
Join Date: Mar 2022
Old 05-27-2022 , 15:40   Re: precaching arrays
Reply With Quote #5

yay that worked perfectly, thanks so much you both

code ended up like this if someone needs this some day and wants to use:
PHP Code:
#include <superheromod> 
#include <nvault>

#define MAX_PLAYERS 32

new bool:gHasChucky[SH_MAXSLOTS+1]
new 
bool:gHasDarthMaulPowers[SH_MAXSLOTS+1]
new 
bool:ghasRiddickPowers[SH_MAXSLOTS+1]
new 
bool:ghasWolvPowers[SH_MAXSLOTS+1]
new 
bool:ghasGrimPower[SH_MAXSLOTS+1]


new 
chuckyIDdarthmaulIDriddickIDwolvIDgrimreaperID

enum Knifes

    
NoKnifeSet = -1,
    
Chucky,
    
DarthMaul,
    
Riddick,
    
Wolv,
    
Grim


enum ModelInfo
{
    
ModelName64 ],
    
ModelData64 ],
    
ModelPData64 ]
}

new const 
g_ModelData[Knifes][ ModelInfo ] = 
{
    { 
"Chucky" "models/shmod/chuckyy_VIP_knife.mdl" "models/p_knife.mdl" },
    { 
"DarthMaul" "models/shmod/darthmaul_VIP_knife.mdl" "models/shmod/darthmaul_p_knife.mdl" },
    { 
"Riddick" "models/shmod/riddick_VIP_knife.mdl" "models/p_knife.mdl" },
    { 
"Wolv" "models/shmod/wolv_VIP_knife.mdl" "models/p_knife.mdl" },
    { 
"Grim" "models/shmod/grimreaper_VIP_knife.mdl" "models/shmod/grimreaperV_p_knife.mdl" }
};

new 
Knifes:knife_model[SH_MAXSLOTS1];
new 
g_MenuCallback;            //Create a global variable to hold our callback

new g_iVaultID
new g_szSteamIDMAX_PLAYERS ][ 34 ];     // steam ID
// new gMemoryTableNames[64][32]                // Stores players name for a key
//----------------------------------------------------------------------------------------------
public plugin_init()
{
    
register_plugin("plugin KnifeMenuSH""1.0""Arje + brn17 + Bugsy")

    
register_clcmd("say /facas_vip""vip")        // 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
    
set_task(0.2"cache_id");                   //we need to let superhero cache all the heros to avoid issues
}

public 
plugin_precache()
{
    for ( new 
Knifes:kModelIndex Chucky kModelIndex Knifes kModelIndex++ )
    {
        
precache_modelg_ModelDatakModelIndex ][ ModelData ] );
        
precache_modelg_ModelDatakModelIndex ][ ModelPData ] );
    }


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_putinserver(Player)
public client_authorized(Player)  
{
    
//get_user_name(Player, gMemoryTableNames[Player], charsmax(gMemoryTableNames[]) )
    
get_user_authidPlayerg_szSteamID[Player], charsmax(g_szSteamID[ ]) )
    
Load_StuffPlayer )
}
//----------------------------------------------------------------------------------------------
public cache_id() 
{
    
// Primera Pagin Menu
    
chuckyID                sh_get_hero_id("Chucky");
    
darthmaulID                sh_get_hero_id("Darth Maul");
    
riddickID                sh_get_hero_id("Riddick");
    
wolvID                    sh_get_hero_id("Wolverine");
    
grimreaperID                sh_get_hero_id("Grim Reaper");
}
//----------------------------------------------------------------------------------------------
public sh_hero_init(idheroIDmode)
{
    
// Chucky
    
if ( chuckyID == heroID )
        
gHasChucky[id] = mode true false
    
// Darth Maul    
    
else if ( darthmaulID == heroID )
        
gHasDarthMaulPowers[id] = mode true false
    
// Riddick    
    
else if ( riddickID == heroID )
        
ghasRiddickPowers[id] = mode true false
    
// Wolverine    
    
else if ( wolvID == heroID )
        
ghasWolvPowers[id] = mode true false
    
// Grim Reaper
    
else if ( grimreaperID == heroID )
        
ghasGrimPower[id] = mode true false
}
//----------------------------------------------------------------------------------------------
public vip(id)
{
    if (
get_user_flags(id) & ADMIN_LEVEL_E)
        {
            
KnifeMenu(id)
        }
    else
        {
            
ChatColor(id"!g[SERVER] !nEste recurso é exclusivo para !gVIPs!n adquira j o seu!")
        }
}
//----------------------------------------------------------------------------------------------
public KnifeMenu(id)
{
    new 
menu menu_create"\r[SH] Menu de Facas VIP:""menu_handler" );

    
// Esto son de la Primera pagina del menu                                //    Item    Key
    
menu_additemmenu"\wChucky."""0g_MenuCallback );                //    0        1
    
menu_additemmenu"\wDarth Maul."""0g_MenuCallback );            //    1        2
    
menu_additemmenu"\wRiddick."""0g_MenuCallback );                //    2        3
    
menu_additemmenu"\wWolverine."""0g_MenuCallback );            //    3        4
    
menu_additemmenu"\wGrim Reaper."""0g_MenuCallback );
    
menu_setprop(menuMPROP_BACKNAME"Página anterior");
    
menu_setprop(menuMPROP_NEXTNAME"Próxima página");
    
menu_setprop(menuMPROP_EXITNAME"Sair");
    
    
// El Key 8 reservado para Back Menu -- Y el Key 9 Para el More Menu -- esto es automatico no lo controlo
    
menu_display(idmenu0);
}

public 
menu_handler(idmenuitem)
{
    if ( 
item == MENU_EXIT ) {
        
menu_destroymenu );
        return 
PLUGIN_HANDLED;
    }
    
    new 
szData[6], szName[64];
    new 
item_accessitem_callback;
    
menu_item_getinfomenuitemitem_accessszDatacharsmax(szData), szName,charsmax(szName), item_callback );
    
    switch(
item) {
        
// Estas Fakas van a partir de la Primera Pagina del Menu
        //-----------    Chucky
        
case 0: {
            
SetKnifeidKnifes:Chucky);
            
ChatColor(id"!g[SERVER] !nVocê selecionou o model !gVIP!n de !gChucky!")
        }
        
//-----------    Darth Maul
        
case 1: {
            
SetKnifeidKnifes:DarthMaul);
            
ChatColor(id"!g[SERVER] !nVocê selecionou o model !gVIP!n de !gDarth Maul!")
        }
        
//-----------    Riddick
        
case 2: {
            
SetKnifeidKnifes:Riddick);
            
ChatColor(id"!g[SERVER] !nVocê selecionou o model !gVIP!n de !gRiddick!")
        }
        
//-----------    Wolverine
        
case 3: {
            
SetKnifeidKnifes:Wolv);
            
ChatColor(id"!g[SERVER] !nVocê selecionou o model !gVIP!n de !gWolverine!")
        }
        
//-----------    Grim Reaper
        
case 4: {
            
SetKnifeidKnifes:Grim);
            
ChatColor(id"!g[SERVER] !nVocê selecionou o model !gVIP!n de !gGrim Reaper!")
        }
        case 
MENU_EXIT: {
            
ChatColor(id"!g[SERVER] !nVocê !gnão !nselecionou nenhum !gmodel.")
        }
    }
    
    
SaveData(id);
    
//lets finish up this function by destroying the menu with menu_destroy, and a return
    
menu_destroy(menu);
    return 
PLUGIN_HANDLED;
}

public 
SetKnife(id Knifes:Knife)  

    if (!
sh_is_active() || !is_user_alive(id) ) return PLUGIN_HANDLED;
    
    new 
Knifes:iModelIndex NoKnifeSet;

    
iModelIndex Knife;
    
knife_model[id] = iModelIndex;
    
    if ( 
get_user_weapon(id) == CSW_KNIFE ) { 
    
entity_set_string(idEV_SZ_viewmodelg_ModelData[iModelIndex][ ModelData ]);
    
entity_set_string(idEV_SZ_weaponmodelg_ModelData[iModelIndex][ ModelPData ]);
    }
    
    return 
PLUGIN_HANDLED;    
}

public 
CurWeapon(id

    if ( (
is_user_alive(id)) && (get_user_flags(id) & ADMIN_LEVEL_E)) 
        
SetKnife(idknife_model[id])
        
    return 
PLUGIN_HANDLED    


public 
SaveData(id
{  
    new 
szKey40 ] , szData]; 
     
    
//formatex( szKey , charsmax( szKey ) , "%s_knife" ,  gMemoryTableNames[id] );
    
formatexszKey charsmaxszKey ) , "%s_knife" ,  g_szSteamID[id] );

    
num_to_str_:knife_modelid ] , szData charsmaxszData ) ); 
     
    
nvault_setg_iVaultID szKey szData ); 


public 
Load_Stuff(id)  
{  
    new 
szKey[40] , szData[4] , iTS;  
    
    
// formatex( szKey , charsmax( szKey ) , "%s_knife" , gMemoryTableNames[id] ); 
    
formatexszKey charsmaxszKey ) , "%s_knife" g_szSteamID[id] ); 
     
    if ( 
nvault_lookupg_iVaultID szKey szData charsmaxszData ) , iTS ) ) { 
        
knife_modelid ] = Knifes:str_to_numszData ); 
    }
}
// This is our callback function. Return ITEM_ENABLED, ITEM_DISABLED, or ITEM_IGNORE.
public menuitem_callback(idmenuitem)
{
    
// Chucky
    
if ( item == && !gHasChucky[id] ) {
        
menu_item_setname(menuitem"\dChucky.");
        return 
ITEM_DISABLED;
    }
    
// Darth Maul
    
if ( item == && !gHasDarthMaulPowers[id] ) {
        
menu_item_setname(menuitem"\dDarth Maul.");
        return 
ITEM_DISABLED;
    }
    
// Riddick
    
if ( item == && !ghasRiddickPowers[id] )
    {
        
menu_item_setname(menuitem"\dRiddick.");
        return 
ITEM_DISABLED;
    }
    
// Wolverine
    
if ( item == && !ghasWolvPowers[id] ) {
        
menu_item_setname(menuitem"\dWolverine.");
        return 
ITEM_DISABLED;
    }
    
// Grim Reaper
    
if ( item == && !ghasGrimPower[id] ) {
        
menu_item_setname(menuitem"\dGrim Reaper.");
        return 
ITEM_DISABLED;
    }
    
    
//Otherwise we can just ignore the return value
    
return ITEM_IGNORE;     //Note that returning ITEM_ENABLED will override the admin flag check from menu_additem    


stock ChatColor(const id, const input[], any:...) {
    new 
count 1players[32];
    static 
msg[191];
    
vformat(msg190input3);
    
    
replace_all(msg190"!g""^4"); // verde
    
replace_all(msg190"!n""^1"); // galben/alb/negru
    
replace_all(msg190"!t""^3"); // rosu/albastru/gri
    
replace_all(msg190"!t2""^0"); // rosu2/albastru2/gri2
    
    
if (idplayers[0] = id; else get_players(playerscount"ch");
    {
        for (new 
0counti++)
            {
            if (
is_user_connected(players[i]))
                {
                
message_begin(MSG_ONE_UNRELIABLEget_user_msgid("SayText"), _players[i]);
                
write_byte(players[i]);
                
write_string(msg);
                
message_end();
            }
        }
    }
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1030\\ f0\\ fs16 \n\\ par }
*/ 

Last edited by brN17; 05-27-2022 at 15:42.
brN17 is offline
Reply


Thread Tools
Display Modes

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 18:34.


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