Approved Knife Menu

Plug-ins compatibility with Zombie Escape 1.x only!


User avatar
Raheem
Mod Developer
Mod Developer
Posts: 2213
Joined: 7 years ago
Contact:

#21

Post by Raheem » 7 years ago

Updated to work with our ZE v1.1
He who fails to plan is planning to fail

User avatar
Spir0x
Veteran Member
Veteran Member
Tunisia
Posts: 641
Joined: 7 years ago
Location: Tunisia
Contact:

#22

Post by Spir0x » 6 years ago

Raheem wrote: 7 years ago I'll update the main plugin with this but later here is the working one:
  • ze_knife_menu.rar
[mention]Raheem[/mention] bro why u're wasting my time ? :evil: :evil: u said you'll update it and now same problem knife menu kills my v_ and p_ knife bro always make sure you updated your plugins :)

User avatar
Night Fury
Mod Developer
Mod Developer
Posts: 677
Joined: 7 years ago
Contact:

#23

Post by Night Fury » 6 years ago

Spir0x wrote: 6 years ago @Raheem bro why u're wasting my time ? :evil: :evil: u said you'll update it and now same problem knife menu kills my v_ and p_ knife bro always make sure you updated your plugins :)
Go do it by yourself if you can't wait.
Want your own mod edition? PM me.
Accepting private projects.
Discord: Fury#7469
Image

User avatar
Spir0x
Veteran Member
Veteran Member
Tunisia
Posts: 641
Joined: 7 years ago
Location: Tunisia
Contact:

#24

Post by Spir0x » 6 years ago

lol, already did but i said to him should update every main plugin dont make updates and main plugin still in old versions :)

User avatar
Spir0x
Veteran Member
Veteran Member
Tunisia
Posts: 641
Joined: 7 years ago
Location: Tunisia
Contact:

#25

Post by Spir0x » 6 years ago

anyone can make my knife menu only for vips ? with Flag A

Code: Select all

#include <zombie_escape>
 
#define is_user_valid(%1) (is_user_alive(%1) && !is_user_bot(%1) && !is_user_hltv(%1))

// Setting File
new const ZE_SETTING_RESOURCES[] = "zombie_escape.ini"
 
// Models
new const Compat_Models[][] =
{
	"models/BraZZers_ZE/knife_menu/v_shadow_knife.mdl",
	"models/BraZZers_ZE/knife_menu/p_shadow_knife.mdl"
}

new const Strong_Models[][] =
{
	"models/BraZZers_ZE/knife_menu/v_light_knife.mdl",
	"models/BraZZers_ZE/knife_menu/p_light_knife.mdl"
}

new const Katana_Models[][] =
{
	"models/BraZZers_ZE/knife_menu/v_katana_knife.mdl",
	"models/BraZZers_ZE/knife_menu/p_katana_knife.mdl"
}

new const Hammer_Models[][] =
{ 
    "models/BraZZers_ZE/knife_menu/v_hammer_knife.mdl",
    "models/BraZZers_ZE/knife_menu/p_hammer_knife.mdl" 
}

// Sounds
new const g_sound_knife[] = "items/gunpickup2.wav"

new const combat_sounds[][] =
{
	"BraZZers_ZE/knife_menu/shadow_deploy.wav",
	"BraZZers_ZE/knife_menu/shadow_hit.wav",
	"BraZZers_ZE/knife_menu/shadow_hit.wav",
	"BraZZers_ZE/knife_menu/shadow_hit.wav",
	"BraZZers_ZE/knife_menu/shadow_hit.wav",
	"BraZZers_ZE/knife_menu/shadow_hitwall.wav",
	"BraZZers_ZE/knife_menu/shadow_slash.wav",
	"BraZZers_ZE/knife_menu/shadow_slash.wav",
	"BraZZers_ZE/knife_menu/shadow_stab.wav"
}

new const strong_sounds[][] =
{
	"BraZZers_ZE/knife_menu/light_deploy.wav",
	"BraZZers_ZE/knife_menu/light_hit.wav",
	"BraZZers_ZE/knife_menu/light_hit.wav",
	"BraZZers_ZE/knife_menu/light_hit.wav",
	"BraZZers_ZE/knife_menu/light_hit.wav",
	"BraZZers_ZE/knife_menu/light_hitwall.wav",
	"BraZZers_ZE/knife_menu/light_slash.wav",
	"BraZZers_ZE/knife_menu/light_slash.wav",
	"BraZZers_ZE/knife_menu/light_stab.wav"
}

new const katana_sounds[][] =
{
	"BraZZers_ZE/knife_menu/katana_deploy.wav",
	"BraZZers_ZE/knife_menu/katana_hit.wav",
	"BraZZers_ZE/knife_menu/katana_hit.wav",
	"BraZZers_ZE/knife_menu/katana_hit.wav",
	"BraZZers_ZE/knife_menu/katana_hit.wav",
	"BraZZers_ZE/knife_menu/katana_hitwall.wav",
	"BraZZers_ZE/knife_menu/katana_slash.wav",
	"BraZZers_ZE/knife_menu/katana_slash.wav",
	"BraZZers_ZE/knife_menu/katana_stab.wav"
}

new const hammer_sounds[][] =
{
	"BraZZers_ZE/knife_menu/hammer_deploy.wav",
	"BraZZers_ZE/knife_menu/hammer_hit.wav",
	"BraZZers_ZE/knife_menu/hammer_hit.wav",
	"BraZZers_ZE/knife_menu/hammer_hit.wav",
	"BraZZers_ZE/knife_menu/hammer_hit.wav",
	"BraZZers_ZE/knife_menu/hammer_hitwall.wav",
	"BraZZers_ZE/knife_menu/hammer_slash.wav",
	"BraZZers_ZE/knife_menu/hammer_slash.wav",
	"BraZZers_ZE/knife_menu/hammer_stab.wav"
}

new const oldknife_sounds[][] =
{
	"weapons/knife_deploy1.wav",
	"weapons/knife_hit1.wav",
	"weapons/knife_hit2.wav",
	"weapons/knife_hit3.wav",
	"weapons/knife_hit4.wav",
	"weapons/knife_hitwall1.wav",
	"weapons/knife_slash1.wav",
	"weapons/knife_slash2.wav",
	"weapons/knife_stab.wav"
}
 
new bool:g_bCompat[33], bool:g_bStrong[33], bool:g_bKatana[33], bool:g_bHammer[33],
g_iUsedTimes[33], cvar_use_times

// Dynamic Arrays
new Array:g_szNormalModel

public plugin_precache()
{
    new i
	
    for(i = 0; i < sizeof(Hammer_Models); i++)
        precache_model(Hammer_Models[i])
	
    for(i = 0; i < sizeof(Katana_Models); i++)
        precache_model(Katana_Models[i])
	
    for(i = 0; i < sizeof(Compat_Models); i++)
        precache_model(Compat_Models[i])
	
    for(i = 0; i < sizeof(Strong_Models); i++)
        precache_model(Strong_Models[i])
       
    precache_sound(g_sound_knife)
 
    for(i = 0; i < sizeof(combat_sounds); i++)
        precache_sound(combat_sounds[i])
 
    for(i = 0; i < sizeof(strong_sounds); i++)
        precache_sound(strong_sounds[i])
 
    for(i = 0; i < sizeof(katana_sounds); i++)
        precache_sound(katana_sounds[i])
 
    for(i = 0; i < sizeof(hammer_sounds); i++)
        precache_sound(hammer_sounds[i])
	
	// Initialize arrays
	g_szNormalModel = ArrayCreate(64, 1)
	
	// Load from external file
	amx_load_setting_string_arr(ZE_SETTING_RESOURCES, "Weapon Models", "V_KNIFE HUMAN", g_szNormalModel)
}
 
public plugin_natives()
{
    register_native("ze_open_knife_menu", "native_ze_open_knife_menu", 1)
}
 
public plugin_init()
{
    register_plugin("[ZE] Addon: Knife Menu", "1.1", "Jack GamePlay")
	
	// Forwards
    register_forward(FM_EmitSound, "fw_EmitSound")
	
	// Events
    register_event("CurWeapon", "CurrentWeapon", "be", "1=1")

    // Cvars
    cvar_use_times = register_cvar("ze_knife_menu_use_times", "1")
	
	// Messages
    register_message(get_user_msgid("DeathMsg"), "DeathMsg")
}
 
public ze_user_humanized(id)
{
	g_iUsedTimes[id] = 0
}

public client_connect(id)
{
    g_bCompat[id] = false
    g_bStrong[id] = false
    g_bKatana[id] = false
    g_bHammer[id] = false
    g_iUsedTimes[id] = 0
}
 
public Show_Knife_Menu(id)
{
    new menu = menu_create("\rChoose Your Knife\w:", "Knife_Menu_Functions")
    menu_additem(menu, "\yShadow", "", 0)
    menu_additem(menu, "\yLight", "", 0)
    menu_additem(menu, "\yKatana", "", 0)
    menu_additem(menu, "\yHammer", "", 0)
    menu_setprop(menu, MPROP_EXIT, MEXIT_ALL)
	
    if((g_iUsedTimes[id] < get_pcvar_num(cvar_use_times)) && !ze_is_user_zombie(id) && is_user_valid(id))
    {
        menu_display(id, menu, 0)
    }
    else if(ze_is_user_zombie(id))
    {
        ze_colored_print(id, "!tYou can't open !gKnife menu !tdue to being !gZombie!y.")
        return PLUGIN_HANDLED
    }
    else if(g_iUsedTimes[id] >= get_pcvar_num(cvar_use_times))
    {
        ze_colored_print(id, "!tYou have already chosen your !gKnife!y, !twait for the next round!y.", get_pcvar_num(cvar_use_times))
        return PLUGIN_HANDLED
    }
    return PLUGIN_CONTINUE
}
 
public Knife_Menu_Functions(id, menu, key)
{
    if(!is_user_valid(id) || ze_is_user_zombie(id))
        return
       
    switch(key)
    {
        case 0: // Compat
        {
            g_bCompat[id] = true
            g_bStrong[id] = false
            g_bKatana[id] = false
            g_bHammer[id] = false
            g_iUsedTimes[id]++
            rg_remove_item(id, "weapon_knife")
            rg_give_item(id, "weapon_knife", GT_APPEND)
            engclient_cmd(id, "weapon_knife")
            emit_sound(id, CHAN_BODY, g_sound_knife, 1.0, ATTN_NORM, 0, PITCH_NORM)
        }
        case 1: // Strong
        {
            g_bCompat[id] = false
            g_bStrong[id] = true
            g_bKatana[id] = false
            g_bHammer[id] = false
            g_iUsedTimes[id]++
            rg_remove_item(id, "weapon_knife")
            rg_give_item(id, "weapon_knife", GT_APPEND)
            engclient_cmd(id, "weapon_knife")
            emit_sound(id, CHAN_BODY, g_sound_knife, 1.0, ATTN_NORM, 0, PITCH_NORM)
        }
        case 2: // Katana
        {
            g_bCompat[id] = false
            g_bStrong[id] = false
            g_bKatana[id] = true
            g_bHammer[id] = false
            g_iUsedTimes[id]++
            rg_remove_item(id, "weapon_knife")
            rg_give_item(id, "weapon_knife", GT_APPEND)
            engclient_cmd(id, "weapon_knife")
            emit_sound(id, CHAN_BODY, g_sound_knife, 1.0, ATTN_NORM, 0, PITCH_NORM)
        }
        case 3: // Hammer
        {
            g_bCompat[id] = false
            g_bStrong[id] = false
            g_bKatana[id] = false
            g_bHammer[id] = true
            g_iUsedTimes[id]++
            rg_remove_item(id, "weapon_knife")
            rg_give_item(id, "weapon_knife", GT_APPEND)
            engclient_cmd(id, "weapon_knife")
            emit_sound(id, CHAN_BODY, g_sound_knife, 1.0, ATTN_NORM, 0, PITCH_NORM)
        }
    }
    menu_destroy(menu)
}
 
public fw_EmitSound(id, channel, const sound[])
{
    if(!is_user_valid(id) || ze_is_user_zombie(id))
        return FMRES_IGNORED
       
    new i
    for(i = 0; i < sizeof(combat_sounds); i++)
    for(i = 0; i < sizeof(strong_sounds); i++)
    for(i = 0; i < sizeof(katana_sounds); i++)
    for(i = 0; i < sizeof(hammer_sounds); i++)
    {
        if(equal(sound, oldknife_sounds[i]))
        {
            if (g_bCompat[id])
            {
                emit_sound(id, channel, combat_sounds[i], 1.0, ATTN_NORM, 0, PITCH_NORM)
                return FMRES_SUPERCEDE
            }
            else if (g_bStrong[id])
            {
                emit_sound(id, channel, strong_sounds[i], 1.0, ATTN_NORM, 0, PITCH_NORM)
                return FMRES_SUPERCEDE
            }
            else if (g_bKatana[id])
            {
                emit_sound(id, channel, katana_sounds[i], 1.0, ATTN_NORM, 0, PITCH_NORM)
                return FMRES_SUPERCEDE
            }
            else if (g_bHammer[id])
            {
                emit_sound(id, channel, hammer_sounds[i], 1.0, ATTN_NORM, 0, PITCH_NORM)
                return FMRES_SUPERCEDE
            }
            else if (!g_bCompat[id] || !g_bStrong[id] || !g_bKatana[id] || !g_bHammer[id])
            {
                emit_sound(id, channel, oldknife_sounds[i], 1.0, ATTN_NORM, 0, PITCH_NORM)
                return FMRES_SUPERCEDE
            }
        }
    }
    return FMRES_IGNORED
}

public CurrentWeapon(id)
{
    if(!is_user_valid(id) || ze_is_user_zombie(id))
        return
       
    if(get_user_weapon(id) & CSW_KNIFE)
    {
        if(g_bCompat[id])
        {
            cs_set_player_view_model(id, CSW_KNIFE, Compat_Models[0])
            cs_set_player_weap_model(id, CSW_KNIFE, Compat_Models[1])
        }
        else if(g_bStrong[id])
        {
            cs_set_player_view_model(id, CSW_KNIFE, Strong_Models[0])
            cs_set_player_weap_model(id, CSW_KNIFE, Strong_Models[1])
        }
        else if(g_bKatana[id])
        {
            cs_set_player_view_model(id, CSW_KNIFE, Katana_Models[0])
            cs_set_player_weap_model(id, CSW_KNIFE, Katana_Models[1])
        }
        else if(g_bHammer[id])
        {
            cs_set_player_view_model(id, CSW_KNIFE, Hammer_Models[0])
            cs_set_player_weap_model(id, CSW_KNIFE, Hammer_Models[1])
        }
		else
		{
			new szModel[64]
			ArrayGetString(g_szNormalModel, random_num(0, ArraySize(g_szNormalModel) - 1), szModel, charsmax(szModel))
			
			cs_set_player_view_model(id, CSW_KNIFE, szModel)
			cs_reset_player_weap_model(id, CSW_KNIFE)
		}
    }
}

public DeathMsg(msg_id, msg_dest, id)
{
    static szTruncatedWeapon[33], iAttacker
    get_msg_arg_string(4, szTruncatedWeapon, charsmax(szTruncatedWeapon))
    iAttacker = get_msg_arg_int(1)
   
    if(!is_user_valid(iAttacker) || iAttacker == get_msg_arg_int(2) || !is_user_valid(get_msg_arg_int(2))) // get_msg_arg_int(2) = iVictim
        return
   
    if(equal(szTruncatedWeapon, "knife") && get_user_weapon(iAttacker) & CSW_KNIFE)
    {
        if(g_bCompat[id])
        {
            set_msg_arg_string(4, "Combat knife")
        }
        else if(g_bStrong[id])
        {
            set_msg_arg_string(4, "Strong knife")
        }
        else if(g_bKatana[id])
        {
            set_msg_arg_string(4, "Katana knife")
        }
        else if(g_bHammer[id])
        {
            set_msg_arg_string(4, "Ice knife")
        }
    }
}

public native_ze_open_knife_menu(id)
{
	Show_Knife_Menu(id)
}

User avatar
Spir0x
Veteran Member
Veteran Member
Tunisia
Posts: 641
Joined: 7 years ago
Location: Tunisia
Contact:

#26

Post by Spir0x » 6 years ago

Solved i've coded to vips only.

User avatar
Luxurious
Mod Tester
Mod Tester
Egypt
Posts: 177
Joined: 6 years ago
Location: Egypt
Contact:

#27

Post by Luxurious » 6 years ago

Spir0x wrote: 6 years ago Solved i've coded to vips only.
Sorry , Can You give me this code ??
DRK Zombie-Escape V1.6
IP : 81.169.153.129:27015

User avatar
Night Fury
Mod Developer
Mod Developer
Posts: 677
Joined: 7 years ago
Contact:

#28

Post by Night Fury » 6 years ago

*BUMB*
Want your own mod edition? PM me.
Accepting private projects.
Discord: Fury#7469
Image

czirimbolo
Veteran Member
Veteran Member
Poland
Posts: 599
Joined: 7 years ago
Contact:

#29

Post by czirimbolo » 6 years ago

This menu doesnt show on my server, plugin compiled without errors but I dont have this knife menu..
Image

User avatar
Night Fury
Mod Developer
Mod Developer
Posts: 677
Joined: 7 years ago
Contact:

#30

Post by Night Fury » 6 years ago

czirimbolo wrote: 6 years ago This menu doesnt show on my server, plugin compiled without errors but I dont have this knife menu..
Fixed now.
Want your own mod edition? PM me.
Accepting private projects.
Discord: Fury#7469
Image

czirimbolo
Veteran Member
Veteran Member
Poland
Posts: 599
Joined: 7 years ago
Contact:

#31

Post by czirimbolo » 6 years ago

Thanks to this plugin, I cannot change my knife model for human and zombie admin (using special_models by Jack). Can you fix this?
Image

User avatar
Mark
VIP
VIP
United States of America
Posts: 283
Joined: 6 years ago
Location: Des Moines/USA
Contact:

#32

Post by Mark » 6 years ago

czirimbolo wrote: 6 years ago Thanks to this plugin, I cannot change my knife model for human and zombie admin (using special_models by Jack). Can you fix this?
You could add code in this plugin to set the models of Human and Zombie admin.

Post your code and maybe someone can help you with this.

czirimbolo
Veteran Member
Veteran Member
Poland
Posts: 599
Joined: 7 years ago
Contact:

#33

Post by czirimbolo » 6 years ago

here is my knife menu code

Code: Select all

#include <zombie_escape>
 
// Models
new const Compat_Models[][] =
{
	"models/zombie_escape/v_combat_knife.mdl",
	"models/zombie_escape/p_combat_knife.mdl"
}

new const Strong_Models[][] =
{
	"models/zombie_escape/v_strong_knife.mdl",
	"models/zombie_escape/p_strong_knife.mdl"
}

new const Katana_Models[][] =
{
	"models/zombie_escape/v_katana_knife.mdl",
	"models/zombie_escape/p_katana_knife.mdl"
}

new const Hammer_Models[][] =
{
	"models/zombie_escape/v_hammer_knife.mdl",
	"models/zombie_escape/p_hammer_knife.mdl" 
}

// Sounds
new const g_sound_knife[] = "items/gunpickup2.wav"

new const combat_sounds[][] =
{
	"zombie_escape/knife_menu/combat_deploy.wav",
	"zombie_escape/knife_menu/combat_hit.wav",
	"zombie_escape/knife_menu/combat_hit.wav",
	"zombie_escape/knife_menu/combat_hit.wav",
	"zombie_escape/knife_menu/combat_hit.wav",
	"zombie_escape/knife_menu/combat_hitwall.wav",
	"zombie_escape/knife_menu/combat_slash.wav",
	"zombie_escape/knife_menu/combat_slash.wav",
	"zombie_escape/knife_menu/combat_stab.wav"
}

new const strong_sounds[][] =
{
	"zombie_escape/knife_menu/strong_deploy.wav",
	"zombie_escape/knife_menu/strong_hit.wav",
	"zombie_escape/knife_menu/strong_hit.wav",
	"zombie_escape/knife_menu/strong_hit.wav",
	"zombie_escape/knife_menu/strong_hit.wav",
	"zombie_escape/knife_menu/strong_hitwall.wav",
	"zombie_escape/knife_menu/strong_slash.wav",
	"zombie_escape/knife_menu/strong_slash.wav",
	"zombie_escape/knife_menu/strong_stab.wav"
}

new const katana_sounds[][] =
{
	"zombie_escape/knife_menu/katana_deploy.wav",
	"zombie_escape/knife_menu/katana_hit.wav",
	"zombie_escape/knife_menu/katana_hit.wav",
	"zombie_escape/knife_menu/katana_hit.wav",
	"zombie_escape/knife_menu/katana_hit.wav",
	"zombie_escape/knife_menu/katana_hitwall.wav",
	"zombie_escape/knife_menu/katana_slash.wav",
	"zombie_escape/knife_menu/katana_slash.wav",
	"zombie_escape/knife_menu/katana_stab.wav"
}

new const hammer_sounds[][] =
{
	"zombie_escape/knife_menu/hammer_deploy.wav",
	"zombie_escape/knife_menu/hammer_hit.wav",
	"zombie_escape/knife_menu/hammer_hit.wav",
	"zombie_escape/knife_menu/hammer_hit.wav",
	"zombie_escape/knife_menu/hammer_hit.wav",
	"zombie_escape/knife_menu/hammer_hitwall.wav",
	"zombie_escape/knife_menu/hammer_slash.wav",
	"zombie_escape/knife_menu/hammer_slash.wav",
	"zombie_escape/knife_menu/hammer_stab.wav"
}

new const oldknife_sounds[][] =
{
	"weapons/knife_deploy1.wav",
	"weapons/knife_hit1.wav",
	"weapons/knife_hit2.wav",
	"weapons/knife_hit3.wav",
	"weapons/knife_hit4.wav",
	"weapons/knife_hitwall1.wav",
	"weapons/knife_slash1.wav",
	"weapons/knife_slash2.wav",
	"weapons/knife_stab.wav"
}
 
new bool:g_bCompat[33], bool:g_bStrong[33], bool:g_bKatana[33], bool:g_bHammer[33],
g_iUsedTimes[33], g_pCvarUseTimes

public plugin_precache()
{
	new i

	for (i = 0; i <= charsmax(Compat_Models); i++)
		precache_model(Compat_Models[i])

	for (i = 0; i <= charsmax(Hammer_Models); i++)
		precache_model(Hammer_Models[i])

	for (i = 0; i <= charsmax(Katana_Models); i++)
		precache_model(Katana_Models[i])

	for (i = 0; i <= charsmax(Strong_Models); i++)
		precache_model(Strong_Models[i])

	for (i = 0; i <= charsmax(combat_sounds); i++)
		precache_sound(combat_sounds[i])

	for (i = 0; i <= charsmax(strong_sounds); i++)
		precache_sound(strong_sounds[i])

	for (i = 0; i <= charsmax(katana_sounds); i++)
		precache_sound(katana_sounds[i])

	for (i = 0; i <= charsmax(hammer_sounds); i++)
		precache_sound(hammer_sounds[i])

	precache_sound(g_sound_knife)
}
 
public plugin_natives()
{
	register_native("ze_open_knife_menu", "native_ze_open_knife_menu", 1)
}
 
public plugin_init()
{
	register_plugin("[ZE] Addon: Knife Menu", "1.2", "Jack GamePlay")

	register_forward(FM_EmitSound, "fw_EmitSound")

	register_event("CurWeapon", "CurrentWeapon", "be", "1=1")

	g_pCvarUseTimes = register_cvar("ze_knife_menu_use_times", "1")

	register_message(get_user_msgid("DeathMsg"), "DeathMsg")

	register_clcmd("say /k", "Show_Knife_Menu")
}
 
public ze_user_humanized(id)
{
	g_iUsedTimes[id] = 0
}

public ze_user_infected(Victim)
{
	g_bCompat[Victim] = false
	g_bStrong[Victim] = false
	g_bKatana[Victim] = false
	g_bHammer[Victim] = false
	g_iUsedTimes[Victim] = 0
}

public client_putinserver(id)
{
	g_bCompat[id] = false
	g_bStrong[id] = false
	g_bKatana[id] = false
	g_bHammer[id] = false
	g_iUsedTimes[id] = 0
}

public client_disconnected(id)
{
	g_bCompat[id] = false
	g_bStrong[id] = false
	g_bKatana[id] = false
	g_bHammer[id] = false
	g_iUsedTimes[id] = 0
}

public Show_Knife_Menu(id)
{
	if (!is_user_connected(id))
		return PLUGIN_CONTINUE

	if (ze_is_user_zombie(id))
	{
		ze_colored_print(id, "!tZombies can't open knife menu!y.")
		return PLUGIN_HANDLED
	}

	if (g_iUsedTimes[id] >= get_pcvar_num(g_pCvarUseTimes))
	{
		ze_colored_print(id, "!tMaximum have been reached !y[!g%d!y]!", get_pcvar_num(g_pCvarUseTimes))
		return PLUGIN_HANDLED
	}

	if (!is_user_alive(id))
	{
		ze_colored_print(id, "!tDead can't open knife menu!y.")
		return PLUGIN_HANDLED
	}

	Knife_Menu(id)
	return PLUGIN_CONTINUE
}
 
public Knife_Menu(id)
{
	new iMenu = menu_create("\rChoose Your Knife\w:", "Menu_Handler")
	menu_additem(iMenu, "\yCombat", "", 0)
	menu_additem(iMenu, "\yStrong", "", 0)
	menu_additem(iMenu, "\yKatana", "", 0)
	menu_additem(iMenu, "\yHammer", "", 0)
	menu_setprop(iMenu, MPROP_EXIT, MEXIT_ALL)
	menu_display(id, iMenu, 0)
}
 
public Menu_Handler(id, iMenu, iKey)
{
	if(!is_user_alive(id) || ze_is_user_zombie(id))
		return PLUGIN_HANDLED
		
	switch(iKey)
	{
		case 0: // Compat
		{
			g_bCompat[id] = true
			g_bStrong[id] = false
			g_bKatana[id] = false
			g_bHammer[id] = false
			/*rg_remove_item(id, "weapon_knife")
			rg_give_item(id, "weapon_knife", GT_APPEND)
			engclient_cmd(id, "weapon_knife")
			g_iUsedTimes[id]++
			emit_sound(id, CHAN_BODY, g_sound_knife, 1.0, ATTN_NORM, 0, PITCH_NORM)*/
		}
		case 1: // Strong
		{
			g_bCompat[id] = false
			g_bStrong[id] = true
			g_bKatana[id] = false
			g_bHammer[id] = false
			/*rg_remove_item(id, "weapon_knife")
			rg_give_item(id, "weapon_knife", GT_APPEND)
			engclient_cmd(id, "weapon_knife")
			g_iUsedTimes[id]++
			emit_sound(id, CHAN_BODY, g_sound_knife, 1.0, ATTN_NORM, 0, PITCH_NORM)*/
		}
		case 2: // Katana
		{
			g_bCompat[id] = false
			g_bStrong[id] = false
			g_bKatana[id] = true
			g_bHammer[id] = false
			/*rg_remove_item(id, "weapon_knife")
			rg_give_item(id, "weapon_knife", GT_APPEND)
			engclient_cmd(id, "weapon_knife")
			g_iUsedTimes[id]++
			emit_sound(id, CHAN_BODY, g_sound_knife, 1.0, ATTN_NORM, 0, PITCH_NORM)*/
		}
		case 3: // Hammer
		{
			g_bCompat[id] = false
			g_bStrong[id] = false
			g_bKatana[id] = false
			g_bHammer[id] = true
			g_iUsedTimes[id]++
			/*rg_remove_item(id, "weapon_knife")
			rg_give_item(id, "weapon_knife", GT_APPEND)
			engclient_cmd(id, "weapon_knife")
			g_iUsedTimes[id]++
			emit_sound(id, CHAN_BODY, g_sound_knife, 1.0, ATTN_NORM, 0, PITCH_NORM)*/
		}
	}

	rg_remove_item(id, "weapon_knife")
	rg_give_item(id, "weapon_knife", GT_APPEND)
	engclient_cmd(id, "weapon_knife")
	g_iUsedTimes[id]++
	emit_sound(id, CHAN_BODY, g_sound_knife, 1.0, ATTN_NORM, 0, PITCH_NORM)
	menu_destroy(iMenu)
	return PLUGIN_HANDLED
}
 
public fw_EmitSound(id, channel, const sound[])
{
    if(!is_user_alive(id) || ze_is_user_zombie(id))
        return FMRES_IGNORED
       
    new i
    for (i = 0; i <= charsmax(combat_sounds); i++)
    for (i = 0; i <= charsmax(strong_sounds); i++)
    for (i = 0; i <= charsmax(katana_sounds); i++)
    for (i = 0; i <= charsmax(hammer_sounds); i++)
    {
        if(equal(sound, oldknife_sounds[i]))
        {
            if (g_bCompat[id])
            {
                emit_sound(id, channel, combat_sounds[i], 1.0, ATTN_NORM, 0, PITCH_NORM)
                return FMRES_SUPERCEDE
            }
            else if (g_bStrong[id])
            {
                emit_sound(id, channel, strong_sounds[i], 1.0, ATTN_NORM, 0, PITCH_NORM)
                return FMRES_SUPERCEDE
            }
            else if (g_bKatana[id])
            {
                emit_sound(id, channel, katana_sounds[i], 1.0, ATTN_NORM, 0, PITCH_NORM)
                return FMRES_SUPERCEDE
            }
            else if (g_bHammer[id])
            {
                emit_sound(id, channel, hammer_sounds[i], 1.0, ATTN_NORM, 0, PITCH_NORM)
                return FMRES_SUPERCEDE
            }
            else if (!g_bCompat[id] || !g_bStrong[id] || !g_bKatana[id] || !g_bHammer[id])
            {
                emit_sound(id, channel, oldknife_sounds[i], 1.0, ATTN_NORM, 0, PITCH_NORM)
                return FMRES_SUPERCEDE
            }
        }
    }
    return FMRES_IGNORED
}

public CurrentWeapon(id)
{
    if(!is_user_alive(id) || ze_is_user_zombie(id))
        return
       
    if(get_user_weapon(id) & CSW_KNIFE)
    {
        if(g_bCompat[id])
        {
            cs_set_player_view_model(id, CSW_KNIFE, Compat_Models[0])
            cs_set_player_weap_model(id, CSW_KNIFE, Compat_Models[1])
        }
        else if(g_bStrong[id])
        {
            cs_set_player_view_model(id, CSW_KNIFE, Strong_Models[0])
            cs_set_player_weap_model(id, CSW_KNIFE, Strong_Models[1])
        }
        else if(g_bKatana[id])
        {
            cs_set_player_view_model(id, CSW_KNIFE, Katana_Models[0])
            cs_set_player_weap_model(id, CSW_KNIFE, Katana_Models[1])
        }
        else if(g_bHammer[id])
        {
            cs_set_player_view_model(id, CSW_KNIFE, Hammer_Models[0])
            cs_set_player_weap_model(id, CSW_KNIFE, Hammer_Models[1])
        }
		else
		{
			cs_reset_player_view_model(id, CSW_KNIFE)
			cs_reset_player_weap_model(id, CSW_KNIFE)
		}
    }
}

public DeathMsg(msg_id, msg_dest, id)
{
    static szTruncatedWeapon[33], iAttacker
    get_msg_arg_string(4, szTruncatedWeapon, charsmax(szTruncatedWeapon))
    iAttacker = get_msg_arg_int(1)
   
    if(!is_user_alive(iAttacker) || iAttacker == get_msg_arg_int(2) || !is_user_alive(get_msg_arg_int(2))) // get_msg_arg_int(2) = iVictim
        return
   
    if(equal(szTruncatedWeapon, "knife") && get_user_weapon(iAttacker) & CSW_KNIFE)
    {
        if(g_bCompat[id])
        {
            set_msg_arg_string(4, "Combat knife")
        }
        else if(g_bStrong[id])
        {
            set_msg_arg_string(4, "Strong knife")
        }
        else if(g_bKatana[id])
        {
            set_msg_arg_string(4, "Katana knife")
        }
        else if(g_bHammer[id])
        {
            set_msg_arg_string(4, "Ice knife")
        }
    }
}

public native_ze_open_knife_menu(id)
{
	Show_Knife_Menu(id)
}
Image

Post Reply

Create an account or sign in to join the discussion

You need to be a member in order to post a reply

Create an account

Not a member? register to join our community
Members can start their own topics & subscribe to topics
It’s free and only takes a minute

Register

Sign in

Who is online

Users browsing this forum: No registered users and 0 guests