AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Zombie Plague Mod (https://forums.alliedmods.net/forumdisplay.php?f=126)
-   -   knife menu (https://forums.alliedmods.net/showthread.php?t=308953)

kooomax 07-08-2018 21:46

knife menu
 
hello guys i need to edit knife menu
i want to add hammer to zm vip to svip.ini
PHP Code:

#include < amxmodx >
#include < amxmisc >
#include < fakemeta >
#include < hamsandwich >
#include < zombieplague >
#include < zmvip >
#include < Licence >

#define PLUGIN "[ZP] Knife Mod"
#define VERSION "1.0"

const m_pPlayer 41;
const 
XO_WEAPON 4;

new const 
MeleeLocationModels[ ] = "ZmLand"
new const MeleeLocationSounds[ ] = "ZmLand"

new const Melee_Names[][] = 
{
    
"Nata Knife",
    
"Katana",
    
"Dragon Claws",
    
"Hammer \r(Vip Only)"
}

new const 
Melee_Models[][] = 
{
    
"strong",
    
"katana",
    
"dragontail",
    
"hammer"
}

new const 
Float:Melee_KnockBack[] = 
{
    
150.0,
    
200.0,
    
300.0,
    
500.0
}

new const 
Float:Melee_Damage[] = 
{
    
1.0,
    
1.0,
    
2.0,
    
3.0
}

new const 
Melee_OnlyVip[] = 
{
    
0,
    
0,
    
0,
    
1
}

new 
g_iKnife33 ];

new Array:
a_Melee_ModelV, Array:a_Melee_ModelP, Array:a_Melee_SoundMiss, Array:a_Melee_SoundHWall, Array:a_Melee_SoundHit,
Array:
a_Melee_SoundStab, Array:a_Melee_SoundDraw;

public 
plugin_precache( )
{
    
a_Melee_ModelV ArrayCreate64);
    
a_Melee_ModelP ArrayCreate64);
    
a_Melee_SoundMiss ArrayCreate64);
    
a_Melee_SoundHWall ArrayCreate64);
    
a_Melee_SoundHit ArrayCreate64);
    
a_Melee_SoundStab ArrayCreate64);
    
a_Melee_SoundDraw ArrayCreate64);

    new 
buffer[64], i;
    for( 
0sizeof Melee_Models ); ++ )
    {
        
formatexbuffercharsmaxbuffer ), "models/%s/v_%s.mdl"MeleeLocationModelsMelee_Models] );
        
precache_modelbuffer );
        
ArrayPushStringa_Melee_ModelVbuffer )
        
        
formatexbuffercharsmaxbuffer ), "models/%s/p_%s.mdl"MeleeLocationModelsMelee_Models] );
        
precache_modelbuffer );
        
ArrayPushStringa_Melee_ModelPbuffer )
    
        
formatexbuffercharsmaxbuffer ), "%s/%s_miss.wav"MeleeLocationSoundsMelee_Models] )
        
precache_soundbuffer )
        
ArrayPushStringa_Melee_SoundMissbuffer )
        
        
formatexbuffercharsmaxbuffer ), "%s/%s_hitwall.wav"MeleeLocationSoundsMelee_Models] )
        
precache_soundbuffer )
        
ArrayPushStringa_Melee_SoundHWallbuffer )
    
        
formatexbuffercharsmaxbuffer ), "%s/%s_hit1.wav"MeleeLocationSoundsMelee_Models] )
        
precache_soundbuffer )
        
ArrayPushStringa_Melee_SoundHitbuffer )
        
        
formatexbuffercharsmaxbuffer ), "%s/%s_stab.wav"MeleeLocationSoundsMelee_Models] )
        
precache_soundbuffer )
        
ArrayPushStringa_Melee_SoundStabbuffer )
        
        
formatexbuffercharsmaxbuffer ), "%s/%s_deploy.wav"MeleeLocationSoundsMelee_Models] )
        
precache_soundbuffer )
        
ArrayPushStringa_Melee_SoundDrawbuffer )
    }
}

public 
plugin_init( ) 
{
    
Licence( );

    
register_pluginPLUGINVERSION"Cristi. C" );
    
    
RegisterHamHam_Item_Deploy"weapon_knife""fw_Knife_Deploy");
    
RegisterHamHam_TakeDamage"player""fw_TakeDamage" );
    
RegisterHamHam_TraceAttack"player""fw_TraceAttack");
    
    
register_forwardFM_EmitSound"fw_EmitSound" );
    
    
register_clcmd"say /knife""clcmd_knife" );
    
register_clcmd"knife_menu""clcmd_knife" );
}

public 
client_putinserverid )
{
    
g_iKnifeid ] = 0;
}

public 
fw_Knife_Deploy( const knife )
{
    if( 
pev_validknife ) != )
    {
        return;
    }

    new 
id get_pdata_cbaseknifem_pPlayerXO_WEAPON );
    
    if( !
is_user_aliveid ) || zp_get_user_zombieid ) )
    {
        return;
    }
    
    new 
__knife;
    if( ( 
__knife g_iKnifeid ] ) != -)
    {
        new 
szModel33 ];
        
ArrayGetStringa_Melee_ModelV__knifeszModelcharsmax(szModel))
        
set_pevidpev_viewmodel2szModel );
        
        
ArrayGetStringa_Melee_ModelP__knifeszModelcharsmax(szModel))
        
set_pevidpev_weaponmodel2szModel );
    }
}

public 
fw_TakeDamagevictiminflictorattackerFloat:damagedamage_type )
{
    if( !
is_user_aliveattacker ) || zp_get_user_zombieattacker ) )
    {
        return;
    }
    
    static 
__knife;
    if( 
get_user_weaponattacker ) == CSW_KNIFE && ( __knife g_iKnifeattacker ] ) != -)
    {
        
SetHamParamFloat4damage Melee_Damage__knife ] );
    }
}

// Ham Trace Attack Forward
public fw_TraceAttackvictimattackerFloat:damageFloat:direction], tracehandledamage_type )
{
    
// Non-player damage or self damage
    
if (victim == attacker || !is_user_alive(attacker) || zp_get_user_zombieattacker ) )
        return;
    
    if( !
zp_get_user_zombievictim ) )
        return;

    static 
__knife;
    if( 
get_user_weaponattacker ) == CSW_KNIFE && ( __knife g_iKnifeattacker ] ) != -)
    {
        if( 
Melee_KnockBack[__knife] <= 0.0 )
            return;
    
        
// Get victim's velocity
        
static Float:velocity]
        
pev(victimpev_velocityvelocity )
        
        
direction] *= Melee_KnockBack__knife ];
        
direction] *= Melee_KnockBack__knife ];
        
direction] *= Melee_KnockBack__knife ];
        
        
velocity] += direction]
        
velocity] += direction]
        
velocity] += direction]
        
        
// Set the knockback'd victim's velocity
        
set_pevvictimpev_velocitydirection )
    }
}

public 
fw_EmitSoundidchannel, const sample[ ], Float:volumeFloat:attnflagspitch )
{
    if( !
is_user_aliveid ) || zp_get_user_zombieid ) )
    {
        return 
FMRES_IGNORED;
    }
    
    if ( 
sample] == 'k' && sample] == 'n' && sample10 ] == 'i' )
    {
        new 
__knifesound64 ];
        if( ( 
__knife g_iKnifeid ] ) != -)
        {
            if (
sample14 ] == 's' && sample[15] == 'l' && sample[16] == 'a'// slash
            
{
                
ArrayGetStringa_Melee_SoundMiss__knifesoundcharsmaxsound ) )
                
emit_soundidchannelsoundvolumeattnflagspitch )
                return 
FMRES_SUPERCEDE;
            }
            if ( 
sample14 ] == 'h' && sample15 ] == 'i' && sample16 ] == 't' // hit
            
{
                if ( 
sample17 ] == 'w' // wall
                
{
                    
ArrayGetStringa_Melee_SoundHWall__knifesoundcharsmaxsound ) )
                    
emit_soundidchannelsoundvolumeattnflagspitch )
                    return 
FMRES_SUPERCEDE;
                }
                else
                {
                    
ArrayGetStringa_Melee_SoundHit__knifesoundcharsmaxsound ) )
                    
emit_sound(idchannelsoundvolumeattnflagspitch )
                    return 
FMRES_SUPERCEDE;
                }
            }
            if ( 
sample14 ] == 's' && sample15 ] == 't' && sample16 ] == 'a' // stab
            
{
                
ArrayGetStringa_Melee_SoundStab__knifesoundcharsmaxsound ) )
                
emit_soundidchannelsoundvolumeattnflagspitch )
                return 
FMRES_SUPERCEDE;
            }
            
            if ( 
sample14 ] == 'd' && sample15 ] == 'e' && sample16 ] == 'p' // deploy
            
{
                
ArrayGetStringa_Melee_SoundDraw__knifesoundcharsmaxsound ) )
                
emit_soundidchannelsoundvolumeattnflagspitch )
                return 
FMRES_SUPERCEDE;                
            }
        }
    }
    return 
FMRES_IGNORED;
}

// Items Menu
show_items_menuid )
{
    static 
menu128 ];
    new 
menuidiitemdata]
    
    
menuid menu_create"Knife Menu""menu_knifes" )
    
    for( 
0sizeof Melee_Models ); ++ )
    {
        
formatexmenucharsmaxmenu ), "%s"Melee_Names] )
        
        
itemdata] = i
        itemdata
] = 0
        menu_additem
menuidmenuitemdata )
    }
    
    
// No items to display?
    
if (  menu_itemsmenuid  ) <= )
    {
        
client_printidprint_chat"No knifes available." )
        
menu_destroymenuid )
        return;
    }
    
    
// Back - Next - Exit
    
menu_setpropmenuidMPROP_BACKNAME"Back" )
    
menu_setpropmenuidMPROP_NEXTNAME"Next" )
    
menu_setpropmenuidMPROP_EXITNAME"Exit" )
    
    
// Fix for AMXX custom menus
    
set_pdata_intid205)
    
menu_displayidmenuid )
}

public 
menu_knifesidmenuidknife )
{
    if ( 
knife == MENU_EXIT )
    {
        
menu_destroymenuid )
        return 
PLUGIN_HANDLED;
    }
    
    new 
itemdata], dummyknifeid;
    
menu_item_getinfo(menuidknifedummyitemdatacharsmaxitemdata ), __dummy )
    
knifeid itemdata];
    
    if( 
Melee_OnlyVipknifeid ] != )
    {
        
//if( !( zv_get_user_flags( id ) & ZV_UNLIMITED ) )
        
if( !( get_user_flagsid ) & ADMIN_LEVEL_H ) )
        {
            
menu_destroymenuid  );
            
show_items_menuid )
            return 
PLUGIN_HANDLED;
        }
    }
    
    
g_iKnifeid ] = knifeid
    menu_destroy
menuid )
    
    if( 
get_user_weaponid ) == CSW_KNIFE )
    {
        
fw_Knife_Deployfm_cs_get_current_weapon_entid ) )
    }

    return 
PLUGIN_HANDLED;
}

public 
clcmd_knifeid )
{
    
show_items_menuid )
}

fm_cs_get_current_weapon_entid )
{
    if ( 
pev_validid ) != )
        return -
1;
    
    return 
get_pdata_cbaseid373 );



kooomax 07-12-2018 11:26

Re: knife menu
 
I solved the problem myself


All times are GMT -4. The time now is 21:38.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.