Jump to content
Sign in to follow this  
TRM

Plugin knife!

Recommended Posts

Nume Plugin:knife menu

 Descriere Plugin :Cand scriu in chat /knife sa imi apara un meniu cu 4 cutite(butterfly,bayonet,karambit,gutknife.

Share this post


Link to post
Share on other sites

Plugin : Knife Models [XP System & Skills Support]

Autor : OciXCrom

Descriere :
This plugin adds a menu from where you can choose different knife skins. It also has an API which allows to create sub-plugins, such as knife skills/abilities.

Comenzi :
/knife -- opens the knife menu
crxknives_select <knife id> -- attempts to select the given knife

Cvar-uri :
km_open_at_spawn -- if enabled, the knife menu will open at spawn if the player hasn't yet chosen a knife (the menu won't open for players that don't have access for any knife according to their admin flags)
km_save_choice -- if enabled, the selected knife will be remembered via SteamID after you leave the server
km_only_dead -- if enabled, players won't be able to change their knife while they're alive
km_select_message -- whether or not to display a chat message with the knife name when a knife is selected
km_knife_only_skills -- this cvar has no effect in the plugin itself, its purpose is to be used from sub-plugins in order to determine whether the knife skills will be active only when the player holds a knife (1) or with any weapon (0)

Adaugare Cutite :
The knives can be added in the file configs/KnifeModels.ini by putting the knife name on a new line in square brackets, for example [Cool Knife].
Below this line you can add the knife attributes. The following attributes are available in the main plugin:
V_MODEL -- path to the v_ model
P_MODEL -- path to the p_ model
FLAG -- admin access flag
DEPLOY_SOUND -- sound when you deployy the knife
HIT_SOUND -- sound when you hit a player with the knife
HITWALL_SOUND -- sound when you hit a wall with the knife
SLASH_SOUND -- sound when you swing the knife
STAB_SOUND -- sound when you stab a player with the knife
SELECT_SOUND -- sound when selecting the knife
SELECT_MESSAGE -- chat message when selecting the knife (you can add this attribute multiple times if you want to show more than one message)
LEVEL -- required level (requires OciXCrom's Rank System)
SHOW_RANK -- if set to 1, it will show the rank name instead of the level number (requires OciXCrom's Rank System)
XP -- required XP (requires OciXCrom's Rank System)
Bear in mind that all attributes are optional.

 

Link Official https://forums.alliedmods.net/showthread.php?t=293632

Link Download : https://codeload.github.com/OciXCrom/KnifeModels/zip/master

Share this post


Link to post
Share on other sites

Sau poti incerca varianta asta simpla :

#include < amxmodx >
#include < engine >
#include < fakemeta >
#include < hamsandwich >

new knife_mode[ 33 ];

new const gszKnifeModel_default[] = ""; 
new const gszKnifeModel_wooden[] = "";
new const gszKnifeModel_butcher[] = "";

public plugin_init() 
{
    register_plugin( "Knife Model Selection", "1.0", "Juice" );
    
    register_clcmd( "say /knife", "CmdKnife" );
    register_menucmd( register_menuid("KnifeMenu"), 1023, "handleKnifeMenu" );
    
    RegisterHam( Ham_Item_Deploy, "weapon_knife", "Ham_KnifeDeployPost", 1 );
}

public plugin_precache()
{
    precache_model( gszKnifeModel_default );
    precache_model( gszKnifeModel_wooden );
    precache_model( gszKnifeModel_butcher );
}

public client_putinserver(id) 
{
    knife_mode[id] = 1;
}

public CmdKnife( id )
{
    ShowKnifeMenu( id );
    return PLUGIN_HANDLED;
}

public ShowKnifeMenu(id) 
{
    new MenuBody[512], len, keys;
    
    len = format(MenuBody, 511, "\ySelect Your Knife\r:");
    len += format(MenuBody[len], 511-len, "^n\r1. \wDefault");
    len += format(MenuBody[len], 511-len, "^n\r2. \wWooden Knife");
    len += format(MenuBody[len], 511-len, "^n\r3. \wButcher Knife");
    len += format(MenuBody[len], 511-len, "^n\r0. \wExit");

    keys |= ( 1<<0 | 1<<1 | 1<<2 | 1<<9 );

    show_menu(id, keys, MenuBody, -1, "KnifeMenu");
}

public handleKnifeMenu( id, key )
{
    switch(key + 1)
    {
        case 1:    knife_mode[id] = 1;
        case 2:    knife_mode[id] = 2;
        case 3:    knife_mode[id] = 3;
    }
}

public Ham_KnifeDeployPost( iEnt ) 
{
    new id = get_pdata_cbase( iEnt, 41 ); // m_pPlayer = 41
    switch( knife_mode[id] )
    {
        case 1: entity_set_string( id, EV_SZ_viewmodel, gszKnifeModel_default); // default model here
        case 2: entity_set_string( id, EV_SZ_viewmodel, gszKnifeModel_wooden );
        case 3: entity_set_string( id, EV_SZ_viewmodel, gszKnifeModel_butcher );
    }
}  

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
Sign in to follow this  

×