View Single Post
Krtola
Veteran Member
Join Date: Oct 2013
Location: Serbia
Old 04-28-2019 , 11:36   Re: [TUT] Custom Weapon Hud Sprites + Slot Redirection
Reply With Quote #103

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()  
{  
    
RegisterHamHam_Item_AddToPlayer"weapon_knife""OnAddToPlayerKnife", .Post true );  
    
RegisterHamHam_Item_ItemSlot"weapon_knife""OnItemSlotKnife" );  

    
register_clcmd"weapon_ArkFlare""ClientCommand_SelectFlare" );  

    
MsgIndexWeaponList get_user_msgid"WeaponList" );  
}  

public 
ClientCommand_SelectFlare( const client )  
{  
    
engclient_cmdclient"weapon_knife" );  
}  

public 
OnAddToPlayerKnife( const item, const player )  
{  
    if( 
pev_validitem ) && is_user_aliveplayer ) ) // just for safety.  
    
{  
        
message_beginMSG_ONEMsgIndexWeaponList, .player player );  
        {  
            
write_string"weapon_ArkFlare" );  // WeaponName  
            
write_byte( -);                   // PrimaryAmmoID  
            
write_byte( -);                   // PrimaryAmmoMaxAmount  
            
write_byte( -);                   // SecondaryAmmoID  
            
write_byte( -);                   // SecondaryAmmoMaxAmount  
            
write_byte);                    // SlotID (0...N)  
            
write_byte);                    // NumberInSlot (1...N)  
            
write_byteCSW_KNIFE );            // WeaponID  
            
write_byte);                    // Flags  
        
}  
        
message_end();  
    }  
}  

public 
OnItemSlotKnife( const item )  
{  
    
SetHamReturnInteger);  
    return 
HAM_SUPERCEDE;  

__________________
Check my original plugins for cs 1.6 and subscribe on channel
Look at the video bellow to see zombie frost grenade

https://youtu.be/j0zspNfN-AM?si=_1IiGPETN-GQY9Ua

Look at the video below to see Zombie blind grenade

https://youtu.be/ORC7ZmoaipQ?si=QC8Bul96QGitUwX4
Krtola is offline
Send a message via Skype™ to Krtola