[Hammer_Knife][NEW]

Unpaid Requests, Public Plugins
User avatar
Mohamed Alaa
Mod Developer
Mod Developer
Egypt
Posts: 626
Joined: 3 Years Ago
Location: Egypt
Has thanked: 34 times
Been thanked: 49 times
Age: 20
Contact:

Re: [Hammer_Knife][NEW]

#11

Post by Mohamed Alaa » 2 Years Ago

I didn't try to compile..It's my bad.
Try this:

Code: Select all

#include <zombie_escape>

#define VIP_ACCESS ADMIN_LEVEL_H

new const Hammer_Models[][] = { "models/zombie_escape/v_hammer_storm.mdl", "models/zombie_escape/p_hammer_storm.mdl" }
new const g_sound_knife[] = "items/gunpickup2.wav"
new const hammer_sounds[][] =
{
	"weapons/hammer_deploy.wav",
	"weapons/hammer_hit.wav",
	"weapons/hammer_hitwall.wav",
	"weapons/hammer_slash.wav",
	"weapons/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 g_Hammer[33]

public plugin_precache()
{
	for(new g = 0; g < charsmax(Hammer_Models); g++)
		precache_model(Hammer_Models[g])
		
	for(new h = 0; h < charsmax(hammer_sounds); h++)
		precache_sound(hammer_sounds[h])
		
	precache_sound(g_sound_knife)
}

public plugin_init()
{
	register_plugin("[ZE] Addons: VIP Storm Hammer", "1.0", "Jack")
	
	register_forward(FM_EmitSound, "Fw_EmitSound")
	
	register_message(get_user_msgid("DeathMsg"), "DeathMsg")
	
	register_event("CurWeapon", "CurrentWeapon", "be", "1=1")
	register_event("HLTV", "New_Round", "a", "1=0", "2=0")
}

public New_Round()
{
	for (new i = 1; i <= get_member_game(m_nMaxPlayers); i++)
	{
		if (!is_user_alive(i) || get_user_flags(i) & VIP_ACCESS || ze_is_user_zombie(i))
			continue
			
		g_Hammer[i] = false
	}
}

public client_putinserver(id)
{
	g_Hammer[id] = false
}

public client_disconnect(id)
{
	g_Hammer[id] = false
}

public ze_user_infected(iVictim)
{
	cs_reset_player_view_model(iVictim, CSW_KNIFE)
	cs_reset_player_weap_model(iVictim, CSW_KNIFE)
}

public ze_user_humanized(id)
{
	if(ze_is_user_zombie(id) || !is_user_alive(id))
		return
	
	if (get_user_flags(id) & VIP_ACCESS)
	{
		g_Hammer[id] = true
		emit_sound(id, CHAN_BODY, g_sound_knife, 1.0, ATTN_NORM, 0, PITCH_NORM)
	}
}

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(hammer_sounds); i++)
	for(i = 0; i < charsmax(oldknife_sounds); i++)
	{
		if(equal(sound, oldknife_sounds[i]))
		{
			if (g_Hammer[id])
			{
				emit_sound(id, channel, hammer_sounds[i], 1.0, ATTN_NORM, 0, PITCH_NORM)
			}
			else
			{
				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(g_Hammer[id])
	{
		cs_set_player_view_model(id, CSW_KNIFE, Hammer_Models[0])
		cs_set_player_weap_model(id, CSW_KNIFE, Hammer_Models[1])
	}
}

public DeathMsg(msg_id, msg_dest, id)
{
	static szTruncatedWeapon[33], iAttacker, iVictim
	get_msg_arg_string(4, szTruncatedWeapon, charsmax(szTruncatedWeapon))
	iAttacker = get_msg_arg_int(1)
	iVictim = get_msg_arg_int(2)
	
	if(!is_user_alive(iAttacker) || iAttacker == iVictim || !is_user_connected(iVictim)) // get_msg_arg_int(2) = iVictim
		return
	
	if(equal(szTruncatedWeapon, "knife") && get_user_weapon(iAttacker) & CSW_KNIFE)
	{
		if(g_Hammer[id])
		{
			set_msg_arg_string(4, "storm hammer")
		}
	}
}
Want your own mod edition? PM me.
Accepting web projects.
CS 1.6 hosting: powergamingtech.com

User avatar
Raheem
Mod Developer
Mod Developer
Egypt
Posts: 1988
Joined: 3 Years Ago
Location: Egypt
Has thanked: 32 times
Been thanked: 108 times
Age: 22
Contact:

#12

Post by Raheem » 2 Years Ago

This is 2d array with only one brackets? :twisted:
    1. new const hammer_sounds[] =
    2. {
    3.     "weapons/hammer_deploy.wav",
    4.     "weapons/hammer_hit.wav",
    5.     "weapons/hammer_hitwall.wav",
    6.     "weapons/hammer_slash.wav",
    7.     "weapons/hammer_stab.wav"
    8. }
Compiler will never understand what you need to tell him :lol: :lol:
You don't know? Learn and you will know.

johnnysins2000
Veteran Member
Veteran Member
Pakistan
Posts: 672
Joined: 2 Years Ago
Location: Lahore
Has thanked: 11 times
Been thanked: 10 times
Age: 23
Contact:

#13

Post by johnnysins2000 » 2 Years Ago

Spir0x wrote:
2 Years Ago
Jhonny u dont know how to read ?
Here you are knife menu by jack but i said i want it only for vip not on knife menu i won"t make knife menu. ONLY VOP VIP
U said Only Hammer Knife -_- .... Read what u post

That Is why for u Converting Hammer knife For VIP extra Item Is Suitable ....

Removing The code from Knife Menu and Just taking hammer?

Na It is waste of time

So what do u want ?

U want Hammer To be with vips automatically without buying it?

Then best choice Is Knife Menu

Try Jack's code
Nobody Is That Busy If They Make Time :roll:

User avatar
Mohamed Alaa
Mod Developer
Mod Developer
Egypt
Posts: 626
Joined: 3 Years Ago
Location: Egypt
Has thanked: 34 times
Been thanked: 49 times
Age: 20
Contact:

#14

Post by Mohamed Alaa » 2 Years Ago

Updated the code.
Want your own mod edition? PM me.
Accepting web projects.
CS 1.6 hosting: powergamingtech.com

User avatar
Spir0x
Veteran Member
Veteran Member
Tunisia
Posts: 634
Joined: 2 Years Ago
Location: Tunisia
Has thanked: 14 times
Been thanked: 7 times
Age: 20
Contact:

#15

Post by Spir0x » 2 Years Ago

Yes jhonny automatically :)
I trynna make money, not friends.

User avatar
Spir0x
Veteran Member
Veteran Member
Tunisia
Posts: 634
Joined: 2 Years Ago
Location: Tunisia
Has thanked: 14 times
Been thanked: 7 times
Age: 20
Contact:

#16

Post by Spir0x » 2 Years Ago

Jack i have a probleme in my server :/ i cant see weapons menu :( i said guns /guns enable /enable i cant this menu and my friends see it :/
and look at this code u gave me for hammer

06/24/2017 - 12:00:14: Invalid index 10 (count: 10)

L 06/24/2017 - 12:00:14: [AMXX] Run time error 10 (plugin "ze_weapon_menu.amxx") (native "ArrayGetString") - debug not enabled!

L 06/24/2017 - 12:00:14: [AMXX] To enable debug mode, add "debug" after the plugin name in plugins.ini (without quotes).

FATAL ERROR (shutting down): SV_ModelIndex: SV_ModelIndex: model models/zombie_escape/p_hammer_storm.mdl not precached
I trynna make money, not friends.

User avatar
Mohamed Alaa
Mod Developer
Mod Developer
Egypt
Posts: 626
Joined: 3 Years Ago
Location: Egypt
Has thanked: 34 times
Been thanked: 49 times
Age: 20
Contact:

#17

Post by Mohamed Alaa » 2 Years Ago

Because of being idiot i won't help.
Closed.
Want your own mod edition? PM me.
Accepting web projects.
CS 1.6 hosting: powergamingtech.com

Locked

Who is online

Users browsing this forum: Raheem and 1 guest