I use exactly the same code from first post and plugin work fine. But getting error in console every time I switch on knife. Error is
PHP Code:
uncnown command: "weapon_ArkFlare"
What is the problem?
PHP Code:
#include <amxmodx>
#include <hamsandwich>
#include <fakemeta>
new MsgIndexWeaponList;
public plugin_precache()
{
precache_generic( "sprites/weapon_ArkFlare.txt" );
precache_generic( "sprites/640hud19.spr" );
precache_generic( "sprites/640hud20.spr" );
}
public plugin_init()
{
RegisterHam( Ham_Item_AddToPlayer, "weapon_knife", "OnAddToPlayerKnife", .Post = true );
RegisterHam( Ham_Item_ItemSlot, "weapon_knife", "OnItemSlotKnife" );
register_clcmd( "weapon_ArkFlare", "ClientCommand_SelectFlare" );
MsgIndexWeaponList = get_user_msgid( "WeaponList" );
}
public ClientCommand_SelectFlare( const client )
{
engclient_cmd( client, "weapon_knife" );
}
public OnAddToPlayerKnife( const item, const player )
{
if( pev_valid( item ) && is_user_alive( player ) ) // just for safety.
{
message_begin( MSG_ONE, MsgIndexWeaponList, .player = player );
{
write_string( "weapon_ArkFlare" ); // WeaponName
write_byte( -1 ); // PrimaryAmmoID
write_byte( -1 ); // PrimaryAmmoMaxAmount
write_byte( -1 ); // SecondaryAmmoID
write_byte( -1 ); // SecondaryAmmoMaxAmount
write_byte( 4 ); // SlotID (0...N)
write_byte( 1 ); // NumberInSlot (1...N)
write_byte( CSW_KNIFE ); // WeaponID
write_byte( 0 ); // Flags
}
message_end();
}
}
public OnItemSlotKnife( const item )
{
SetHamReturnInteger( 5 );
return HAM_SUPERCEDE;
}
__________________