Bug

Unpaid Requests, Public Plugins
Post Reply
User avatar
DarkZombie
Member
Member
Hungary
Posts: 68
Joined: 4 Months Ago
Donation: 1x donated in total €6.00
Has thanked: 16 times
Been thanked: 0
Contact:

Bug

#1

Post by DarkZombie » 2 Weeks Ago

With these two weapons Fire AK47 and Frost M4A1, humans can also be fired, somebody please fix it? viewtopic.php?f=14&t=278 and viewtopic.php?f=14&t=294

User avatar
DarkZombie
Member
Member
Hungary
Posts: 68
Joined: 4 Months Ago
Donation: 1x donated in total €6.00
Has thanked: 16 times
Been thanked: 0
Contact:

#2

Post by DarkZombie » 2 Weeks Ago

I uploaded some pictures to make it more understandable to the problem.
Attachments
freeze3.jpg
fREEZE.jpg
AKfire.jpg
AKfire1.jpg

User avatar
Jack GamePlay
Mod Developer
Mod Developer
Egypt
Posts: 512
Joined: 1 Year Ago
Location: Egypt
Has thanked: 31 times
Been thanked: 42 times
Age: 18
Contact:

#3

Post by Jack GamePlay » 2 Weeks Ago

Your codes?

[ Post made via Android ]
Image

User avatar
DarkZombie
Member
Member
Hungary
Posts: 68
Joined: 4 Months Ago
Donation: 1x donated in total €6.00
Has thanked: 16 times
Been thanked: 0
Contact:

#4

Post by DarkZombie » 2 Weeks Ago

Jack GamePlay wrote:
2 Weeks Ago
Your codes?
Fire AK

Code: Select all

#include <zombie_escape>
#include <fakemeta_util>
#include <cstrike>

#define CSW_WEAPON_BASE CSW_AK47
#define CSW_NEW_WEAPON	"weapon_fak47"
#define CSW_OLD_WEAPON	"weapon_ak47"
#define WEAPON_KEY	564943
#define OLD_WEAPON	"models/w_ak47.mdl"
#define is_user_valid(%1) (is_user_alive(%1) && !is_user_bot(%1) && !is_user_hltv(%1))

enum
{
	IDLE = 0,
	RELOAD,
	DRAW,
	SHOOT1,
	SHOOT2,
	SHOOT3
}

new const Weapon_Models[][] = { "models/zombie_plague/v_fire_ak47.mdl", "models/zombie_plague/p_fire_ak47.mdl", "models/zombie_plague/w_fire_ak47.mdl" }
new const Weapon_Sounds[][] = { "weapons/ak47beast1.wav", "weapons/ak47beast2.wav", "weapons/ak47beast_clipout.wav", "weapons/ak47beast_draw.wav", "weapons/ak47beast_stab.wav" }
new const Weapon_Sprites[][] = { "sprites/weapon_fak47.txt", "sprites/zombie_plague/640hud31.spr" }
new const GUNSHOT_DECALS[] = { 41, 42, 43, 44, 45 }

new FAK, bool:g_HasFAK[33]
new Cvar_FAK_Recoil, Cvar_FAK_DMG, Cvar_FAK_Clip, Cvar_FAK_Ammo, Cvar_FAK_Speed, Cvar_FAK_ReqDMG, Cvar_FAK_FTime
new Float:cl_pushangle[33][3], g_EventFAK, g_FAK_TmpClip[33], g_IsInPrimaryAttack, g_iDmgCounter[33]
new hud

public plugin_precache()
{
	for(new g = 0; g < sizeof(Weapon_Models); g++)
		precache_model(Weapon_Models[g])
	for(new h = 0; h < sizeof(Weapon_Sounds); h++)
		precache_sound(Weapon_Sounds[h])
	for(new t = 0; t < sizeof(Weapon_Sprites); t++)
		precache_generic(Weapon_Sprites[t])
		
	register_clcmd(CSW_NEW_WEAPON, "hook")
	register_forward(FM_PrecacheEvent, "Fw_Precache_Event", 1)
}

public hook(id)
{
	engclient_cmd(id, CSW_OLD_WEAPON)
	return PLUGIN_HANDLED
}

public plugin_init()
{
	register_plugin("[ZE] Extra Item: Fire Ak-47", "1.0", "JaCk GamePlay")
	FAK = ze_register_item("Fire Ak-47", 60, 0)
	
	// Events & Messages
	register_message(get_user_msgid("DeathMsg"), "DeathMsg")
	register_event("CurWeapon", "CurrentWeapon", "be", "1=1")
	register_event("HLTV", "New_Round", "a", "1=0", "2=0")
	
	// Forwards
	register_forward(FM_PlaybackEvent, "Fw_Playback_Event")
	register_forward(FM_SetModel, "Fw_Set_Model", 1)
	register_forward(FM_UpdateClientData, "Fw_Update_Clientdata", 1)
	
	RegisterHookChain(RG_CBasePlayer_TakeDamage, "Fw_Take_DMG")
	RegisterHookChain(RG_CBasePlayer_Spawn, "Fw_Spawn", 1)
	
	// Hams
	RegisterHam(Ham_Weapon_PrimaryAttack, CSW_OLD_WEAPON, "Fw_PrimaryAttack")
	RegisterHam(Ham_Weapon_PrimaryAttack, CSW_OLD_WEAPON, "Fw_PrimaryAttack_Post", 1)
	RegisterHam(Ham_Item_AddToPlayer, CSW_OLD_WEAPON, "Fw_AddToPlayer")
	RegisterHam(Ham_Weapon_Reload, CSW_OLD_WEAPON, "Fw_Reload")
	RegisterHam(Ham_Weapon_Reload, CSW_OLD_WEAPON, "Fw_Reload_Post", 1)
	RegisterHam(Ham_TraceAttack, "worldspawn", "Fw_TraceAttack", 1)
	RegisterHam(Ham_TraceAttack, "func_breakable", "Fw_TraceAttack", 1)
	RegisterHam(Ham_TraceAttack, "func_wall", "Fw_TraceAttack", 1)
	RegisterHam(Ham_TraceAttack, "func_door", "Fw_TraceAttack", 1)
	RegisterHam(Ham_TraceAttack, "func_door_rotating", "Fw_TraceAttack", 1)
	RegisterHam(Ham_TraceAttack, "func_plat", "Fw_TraceAttack", 1)
	RegisterHam(Ham_TraceAttack, "func_rotating", "Fw_TraceAttack", 1)
	RegisterHam(Ham_Use, "func_tank", "Fw_UseStationary_Post", 1)
	RegisterHam(Ham_Use, "func_tankmortar", "Fw_UseStationary_Post", 1)
	RegisterHam(Ham_Use, "func_tankrocket", "Fw_UseStationary_Post", 1)
	RegisterHam(Ham_Use, "func_tanklaser", "Fw_UseStationary_Post", 1)
	RegisterHam(Ham_Item_Deploy, CSW_OLD_WEAPON, "Fw_Item_Deploy_Post", 1)
	
	// Cvars
	Cvar_FAK_Recoil = register_cvar("ze_fireak_recoil", "1.0")
	Cvar_FAK_DMG = register_cvar("ze_firak_damage", "6")
	Cvar_FAK_Clip = register_cvar("ze_fireak_clip", "40")
	Cvar_FAK_Ammo = register_cvar("ze_fireak_ammo", "150")
	Cvar_FAK_Speed = register_cvar("ze_fireak_speed", "1.5")
	Cvar_FAK_ReqDMG = register_cvar("ze_fireak_requireddmg", "150")
	Cvar_FAK_FTime = register_cvar("ze_fireak_firetime", "3.0")
	
	hud = CreateHudSyncObj()
}

public Fw_Item_Deploy_Post(weapon_ent)
{
	new id = get_pdata_cbase(weapon_ent, 41, 4)
	UTIL_weapon_anim(id, weapon_ent, DRAW)
	CurrentWeapon(id)
}

public Fw_UseStationary_Post(entity, caller, activator, use_type)
{
	if (use_type == 0 && is_user_valid(caller))
	{
		CurrentWeapon(caller)
	}
}

public Fw_TraceAttack(iEnt, iAttacker, Float:flDamage, Float:fDir[3], ptr, iDamageType)
{
	if(!is_user_valid(iAttacker))
		return
	
	static Float:flEnd[3]
	get_tr2(ptr, TR_vecEndPos, flEnd)
	
	if(get_user_weapon(iAttacker) == CSW_WEAPON_BASE && g_HasFAK[iAttacker])
	{
		if(iEnt)
		{
			message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
			write_byte(TE_DECAL)
			engfunc(EngFunc_WriteCoord, flEnd[0])
			engfunc(EngFunc_WriteCoord, flEnd[1])
			engfunc(EngFunc_WriteCoord, flEnd[2])
			write_byte(GUNSHOT_DECALS[random_num(0, charsmax(GUNSHOT_DECALS))])
			write_short(iEnt)
			message_end()
		}
		else
		{
			message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
			write_byte(TE_WORLDDECAL)
			engfunc(EngFunc_WriteCoord, flEnd[0])
			engfunc(EngFunc_WriteCoord, flEnd[1])
			engfunc(EngFunc_WriteCoord, flEnd[2])
			write_byte(GUNSHOT_DECALS[random_num(0, charsmax(GUNSHOT_DECALS))])
			message_end()
		}
		message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
		write_byte(TE_GUNSHOTDECAL)
		engfunc(EngFunc_WriteCoord, flEnd[0])
		engfunc(EngFunc_WriteCoord, flEnd[1])
		engfunc(EngFunc_WriteCoord, flEnd[2])
		write_short(iAttacker)
		write_byte(GUNSHOT_DECALS[random_num(0, charsmax(GUNSHOT_DECALS))])
		message_end()
		
		set_hudmessage(150, 150, 150, -1.0, 0.30, 0, 2.0, 5.0, 2.0, 2.0)
		ShowSyncHudMsg(iAttacker, hud, "%i / %i", g_iDmgCounter[iAttacker], get_pcvar_num(Cvar_FAK_ReqDMG))
	}
}

public Fw_Spawn(id)
{
	if(!is_user_valid(id))
		return
		
	Remove_FAK(id)
}

public New_Round()
{
	for(new i = 0; i < get_maxplayers(); i++)
	{
		if(!is_user_valid(i) || !g_HasFAK[i])
			continue
			
		Remove_FAK(i)
	}
}

public Fw_Reload_Post(weapon_entity) 
{
	new id = pev(weapon_entity, pev_owner)
	if (!is_user_valid(id) || ze_is_user_zombie(id) || g_FAK_TmpClip[id] == -1)
		return HAM_IGNORED
		
	if(get_user_weapon(id) == CSW_WEAPON_BASE && g_HasFAK[id])
	{
		set_pdata_int(weapon_entity, 51, g_FAK_TmpClip[id], 4)
		set_pdata_float(weapon_entity, 48, 3.0, 4)
		set_pdata_float(id, 83, 3.0, 5)
		set_pdata_int(weapon_entity, 54, 1, 4)
		UTIL_weapon_anim(id, weapon_entity, RELOAD)
		set_task(get_pdata_float(id, 83, 5), "ApplyAmmo", id)
	}
	return HAM_IGNORED
}

public ApplyAmmo(id)
{
	if (!is_user_valid(id) || ze_is_user_zombie(id) || g_FAK_TmpClip[id] == -1)
		return HAM_IGNORED
		
	set_member(rg_find_weapon_bpack_by_name(id, CSW_OLD_WEAPON), m_Weapon_iClip, get_pcvar_num(Cvar_FAK_Clip))
	return HAM_IGNORED
}

public Fw_Reload(weapon_entity) 
{
	new id = pev(weapon_entity, pev_owner)
	if (!is_user_valid(id) || ze_is_user_zombie(id))
		return HAM_IGNORED

	static iClipExtra
	if(g_HasFAK[id])
	{
		iClipExtra = get_pcvar_num(Cvar_FAK_Clip)
	}

	g_FAK_TmpClip[id] = -1
	
	new iBpAmmo = cs_get_user_bpammo(id, CSW_WEAPON_BASE)
	new iClip = get_pdata_int(weapon_entity, 51, 4)

	if (iBpAmmo <= 0 || iClip >= iClipExtra)
		return HAM_SUPERCEDE

	g_FAK_TmpClip[id] = iClip

	return HAM_IGNORED
}

public Fw_AddToPlayer(ent, id)
{
	if(!is_valid_ent(ent) || !is_user_valid(id) || ze_is_user_zombie(id))
		return HAM_IGNORED
	
	if(entity_get_int(ent, EV_INT_impulse) == WEAPON_KEY)
	{
		g_HasFAK[id] = true
		g_iDmgCounter[id] = 0
		entity_set_int(ent, EV_INT_impulse, 0)
		
		message_begin(MSG_ONE, get_user_msgid("WeaponList"), {0, 0, 0}, id)
		write_string(CSW_NEW_WEAPON)
		write_byte(2)
		write_byte(90)
		write_byte(-1)
		write_byte(-1)
		write_byte(0)
		write_byte(1)
		write_byte(CSW_WEAPON_BASE)
		write_byte(0)
		message_end()
		return HAM_HANDLED
	}
	else
	{
		message_begin(MSG_ONE, get_user_msgid("WeaponList"), {0, 0, 0}, id)
		write_string(CSW_OLD_WEAPON)
		write_byte(2)
		write_byte(90)
		write_byte(-1)
		write_byte(-1)
		write_byte(0)
		write_byte(1)
		write_byte(CSW_WEAPON_BASE)
		write_byte(0)
		message_end()
	}
	return HAM_IGNORED
}

public Fw_Precache_Event(type, const name[])
{
	if(equal("events/ak47.sc", name))
	{
		g_EventFAK = get_orig_retval()
	}
}

public Fw_Update_Clientdata(id, sendweapons, cd_handle)
{
	if(!is_user_valid(id))
		return

	if(get_user_weapon(id) == CSW_WEAPON_BASE && g_HasFAK[id])
	{
		set_cd(cd_handle, CD_flNextAttack, halflife_time() + 0.001)
	}
}

public Fw_Playback_Event(flags, invoker, eventid, Float:delay, Float:origin[3], Float:angles[3], Float:fparam1, Float:fparam2, iParam1, iParam2, bParam1, bParam2)
{
	if(!is_user_valid(invoker) || !g_IsInPrimaryAttack)
		return
    
	if(eventid == g_EventFAK && get_user_weapon(invoker) == CSW_WEAPON_BASE && g_HasFAK[invoker])
	{
		engfunc(EngFunc_PlaybackEvent, flags | FEV_HOSTONLY, invoker, eventid, delay, origin, angles, fparam1, fparam2, iParam1, iParam2, bParam1, bParam2)
		emit_sound(invoker, CHAN_WEAPON, Weapon_Sounds[random(2)], VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
	}
}

public ze_user_humanized(id)
{
	if(!is_user_valid(id))
		return
		
	Remove_FAK(id)
}

public ze_user_infected(id, infector)
{
	if(!is_user_valid(id) || !is_user_valid(infector))
		return
		
	Remove_FAK(id)
}

public Fw_PrimaryAttack(Weapon)
{
	g_IsInPrimaryAttack = 0
	
	new szClip, szAmmo, id
	id = get_pdata_cbase(Weapon, 41, 4)
	get_user_weapon(id, szClip, szAmmo)
	if(!is_user_valid(id) || ze_is_user_zombie(id))
		return

	g_IsInPrimaryAttack = 1
	if(g_HasFAK[id])
	{
		if (!cs_get_weapon_ammo(Weapon))
			return

		new Float:push[3]
		pev(id, pev_punchangle, push)
		xs_vec_sub(push, cl_pushangle[id], push)
		xs_vec_mul_scalar(push, get_pcvar_float(Cvar_FAK_Recoil), push)
		xs_vec_add(push, cl_pushangle[id], push)
		set_pev(id, pev_punchangle, push)
		UTIL_weapon_anim(id, Weapon, random_num(SHOOT1, SHOOT3))
		emit_sound(id, CHAN_WEAPON, Weapon_Sounds[random(2)], VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
	}
}

public Fw_Take_DMG(Victim, Inflictor, Attacker, Float:Damage, DamageType)
{
	if(!is_user_valid(Attacker) || ze_is_user_zombie(Attacker) || !is_user_connected(Victim))
				return HC_CONTINUE
				
	if(get_user_weapon(Attacker) == CSW_WEAPON_BASE && g_HasFAK[Attacker])
	{			
		SetHookChainArg(4, ATYPE_FLOAT, Damage * get_pcvar_num(Cvar_FAK_DMG))
		
		if(ze_zombie_in_fire(Victim))
			return HC_CONTINUE
				
		g_iDmgCounter[Attacker] += floatround(Damage)
		
		if(g_iDmgCounter[Attacker] >= get_pcvar_num(Cvar_FAK_ReqDMG))
		{	
			g_iDmgCounter[Attacker] = 0
			ze_set_fire_grenade(Victim, 1)
			set_task(get_pcvar_float(Cvar_FAK_FTime), "Remove_Fire", Victim)
		}
	}
	
	return HC_CONTINUE
}

public Remove_Fire(Victim)
{
	if(!is_user_valid(Victim) || !ze_zombie_in_fire(Victim))
		return PLUGIN_CONTINUE
		
	ze_set_fire_grenade(Victim, 0)
	return PLUGIN_HANDLED
}

public Fw_PrimaryAttack_Post(Weapon)
{
	g_IsInPrimaryAttack = 0
	new szClip, szAmmo, id
	id = get_pdata_cbase(Weapon, 41, 4)
	get_user_weapon(id, szClip, szAmmo)
	
	if(!is_user_valid(id) || ze_is_user_zombie(id))
		return

	if(g_HasFAK[id])
	{
		if (!cs_get_weapon_ammo(Weapon))
			return

		new Float:push[3]
		pev(id, pev_punchangle, push)
		xs_vec_sub(push, cl_pushangle[id], push)
		xs_vec_mul_scalar(push, get_pcvar_float(Cvar_FAK_Recoil), push)
		xs_vec_add(push, cl_pushangle[id], push)
		set_pev(id, pev_punchangle, push)
		UTIL_weapon_anim(id, Weapon, random_num(SHOOT1, SHOOT3))
		emit_sound(id, CHAN_WEAPON, Weapon_Sounds[random(2)], VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
	}
}

public Fw_Set_Model(entity, model[])
{
	if(!pev_valid(entity) || !equal(model, OLD_WEAPON))
		return FMRES_IGNORED
	
	static szClassName[33], id
	id = pev(entity, pev_owner)
	pev(entity, pev_classname, szClassName, charsmax(szClassName))
	if(!equal(szClassName, "weaponbox"))
		return FMRES_IGNORED
	
	if(g_HasFAK[id] && pev_valid(fm_find_ent_by_owner(-1, CSW_OLD_WEAPON, entity)))
	{
		g_HasFAK[id] = false
		g_iDmgCounter[id] = 0
		set_pev(fm_find_ent_by_owner(-1, CSW_OLD_WEAPON, entity), pev_impulse, WEAPON_KEY)
		engfunc(EngFunc_SetModel, entity, Weapon_Models[2])
		return FMRES_SUPERCEDE
	}
	return FMRES_IGNORED
}

public CurrentWeapon(id)
{
	if(!is_user_valid(id))
		return
		
	if(get_user_weapon(id) == CSW_WEAPON_BASE && g_HasFAK[id])
	{
		cs_set_player_view_model(id, CSW_WEAPON_BASE, Weapon_Models[0])
		cs_set_player_weap_model(id, CSW_WEAPON_BASE, Weapon_Models[1])
		
		message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("CurWeapon"), _, id)
		write_byte(1)
		write_byte(CSW_WEAPON_BASE)
		write_byte(get_member(rg_find_weapon_bpack_by_name(id, CSW_OLD_WEAPON), m_Weapon_iClip))
		message_end()
		
		message_begin(MSG_ONE, get_user_msgid("WeaponList"), {0, 0, 0}, id)
		write_string(CSW_NEW_WEAPON)
		write_byte(2)
		write_byte(90)
		write_byte(-1)
		write_byte(-1)
		write_byte(0)
		write_byte(1)
		write_byte(CSW_WEAPON_BASE)
		write_byte(0)
		message_end()
		
		static Float:iSpeed; iSpeed = get_pcvar_float(Cvar_FAK_Speed)
		static Ent; Ent = find_ent_by_owner(-1, CSW_OLD_WEAPON, id)
		if(Ent)
		{
			static Float:Delay; Delay = get_pdata_float( Ent, 46, 4) * iSpeed
			if (Delay > 0.0)
			{
				set_pdata_float(Ent, 46, Delay, 4)
			}
		}
	}
}

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))
		return
	
	if(equal(szTruncatedWeapon, "ak47") && get_user_weapon(iAttacker) == CSW_WEAPON_BASE && g_HasFAK[iAttacker])
	{
		set_msg_arg_string(4, "fire ak-47")
	}
}

public ze_select_item_pre(id, itemid)
{
	if(itemid != FAK)	return ZE_ITEM_AVAILABLE
	if(ze_is_user_zombie(id))	return ZE_ITEM_DONT_SHOW
		
	return ZE_ITEM_AVAILABLE
}

public ze_select_item_post(id, itemid)
{
	if(itemid != FAK)
		return
		
	GiveFAK(id)
}

public GiveFAK(id)
{
	drop_weapons(id, 1)
	rg_give_item(id, CSW_OLD_WEAPON)
	rg_set_user_bpammo(id, WeaponIdType:get_weaponid(CSW_OLD_WEAPON), get_pcvar_num(Cvar_FAK_Ammo))
	set_member(rg_find_weapon_bpack_by_name(id, CSW_OLD_WEAPON), m_Weapon_iClip, get_pcvar_num(Cvar_FAK_Clip))
	g_HasFAK[id] = true
	g_iDmgCounter[id] = 0
	UTIL_weapon_anim(id, CSW_WEAPON_BASE, DRAW)
	ze_colored_print(id, "You bought Fire Ak-47.")
}

public Remove_FAK(id)
{
	if(!is_user_valid(id))
		return
		
	g_HasFAK[id] = false
	g_iDmgCounter[id] = 0
	message_begin(MSG_ONE, get_user_msgid("WeaponList"), {0, 0, 0}, id)
	write_string(CSW_OLD_WEAPON)
	write_byte(2)
	write_byte(90)
	write_byte(-1)
	write_byte(-1)
	write_byte(0)
	write_byte(1)
	write_byte(CSW_WEAPON_BASE)
	write_byte(0)
	message_end()
	cs_reset_player_view_model(id, CSW_WEAPON_BASE)
	cs_reset_player_weap_model(id, CSW_WEAPON_BASE)
}

UTIL_weapon_anim(index, entity, sequence = 0)
{
	set_pev(index, pev_weaponanim, sequence)

	message_begin(MSG_ONE_UNRELIABLE, SVC_WEAPONANIM, {0, 0, 0}, index)
	write_byte(sequence)
	write_byte(pev(entity, pev_body))
	message_end()
}

stock drop_weapons(id, dropwhat)
{
	static weapons[32], num, i, weaponid
	num = 0
	get_user_weapons(id, weapons, num)
	
	const PRIMARY_WEAPONS_BIT_SUM = (1<<CSW_SCOUT)|(1<<CSW_XM1014)|(1<<CSW_MAC10)|(1<<CSW_MAC10)|(1<<CSW_UMP45)|(1<<CSW_SG550)|(1<<CSW_MAC10)|(1<<CSW_FAMAS)|(1<<CSW_AWP)|(1<<CSW_MP5NAVY)|(1<<CSW_M249)|(1<<CSW_M3)|(1<<CSW_M4A1)|(1<<CSW_TMP)|(1<<CSW_G3SG1)|(1<<CSW_SG552)|(1<<CSW_AK47)|(1<<CSW_P90)
	
	for (i = 0; i < num; i++)
	{
		weaponid = weapons[i]
		
		if (dropwhat == 1 && ((1<<weaponid) & PRIMARY_WEAPONS_BIT_SUM))
		{
			static wname[32]
			get_weaponname(weaponid, wname, charsmax(wname))
			engclient_cmd(id, "drop", wname)
		}
	}
}
Frost M4A1

Code: Select all

#include <zombie_escape>

new const V_M4A1_MODEL[] = "models/zombie_escape/v_frost_m4a1.mdl"
new const P_M4A1_MODEL[] = "models/zombie_escape/p_frost_m4a1.mdl"
new const W_M4A1_MODEL[] = "models/zombie_escape/w_frost_m4a1.mdl"
new const W_OLD_M4A1_MODEL[] = "models/w_m4a1.mdl"

new g_iItemID, g_iHudSync, g_iSpriteLaser, g_iFreezeDmg, g_iDmgMultiplier
new bool:g_bHasFrostM4A1[33]
new g_iDmg[33]

public plugin_init()
{
	register_plugin("[ZE] Extra Item: Frost M4A1", "1.0", "Raheem")
	
	// Cvars
	g_iFreezeDmg = register_cvar("ze_freezing_m4a1_damage", "2000") // Damage Requried So Zombie got Frozen
	g_iDmgMultiplier = register_cvar("ze_multiplier_m4a1_damage", "2") // Multiplie Weapon Damage

	// Message IDS
	g_iHudSync = CreateHudSyncObj()
	
	// ITEM NAME & COST
	g_iItemID = ze_register_item("Frost M4A1", 30, 0) // It's cost 30 Ammo Pack
	
	// Events
	register_event("WeapPickup", "CheckModel", "b", "1=19")
	register_event("CurWeapon", "CurrentWeapon", "be", "1=1")
	
	// Forwards
	register_forward(FM_SetModel, "Fw_SetModel")
	
	// HookChains
	RegisterHookChain(RG_CBasePlayer_TakeDamage, "Fw_TakeDamage_Post", 1)
	
	// Hams
	RegisterHam(Ham_TraceAttack, "player", "Fw_TraceAttack_Post", 1)
	RegisterHam(Ham_TraceAttack, "worldspawn", "Fw_TraceAttack_Post", 1)
	RegisterHam(Ham_Item_AddToPlayer, "weapon_m4a1", "Fw_AddFrostM4A1ToPlayer")
}

public plugin_precache() 
{
	// Models
	precache_model(V_M4A1_MODEL)
	precache_model(P_M4A1_MODEL)
	precache_model(W_M4A1_MODEL)
	
	// Sprites
	g_iSpriteLaser = precache_model( "sprites/Newlightning.spr")
}

public client_disconnected(id)
{
	g_bHasFrostM4A1[id] = false
}

public ze_select_item_pre(id, itemid)
{
    // Return Available and we will block it in Post, So it dosen't affect other plugins
    if (itemid != g_iItemID)
        return ZE_ITEM_AVAILABLE
   
    // Available for Humans only, So don't show it for zombies
    if (ze_is_user_zombie(id))
        return ZE_ITEM_DONT_SHOW
   
    return ZE_ITEM_AVAILABLE
}

public ze_select_item_post(player, itemid)
{
    if (itemid != g_iItemID)
        return

    g_bHasFrostM4A1[player] = true

    rg_remove_item(player, "weapon_m4a1")
    rg_give_item(player, "weapon_m4a1", GT_APPEND)
    rg_set_user_bpammo(player, WeaponIdType:get_weaponid("weapon_m4a1"), 90)
	
    new szName[32]
    get_user_name(player, szName, charsmax(szName))
    
    set_hudmessage(random(255), random(255), random(255), -1.0, 0.17, 1, 0.0, 5.0, 1.0, 1.0, -1)
    show_hudmessage(0, "%s Has bought Frost M4A1!", szName)
    
    ze_colored_print(player, "!tYou Have bought Frost M4A1!y!")
}

public Fw_TraceAttack_Post(iEnt, iAttacker, Float:flDamage, Float:fDir[3], ptr, iDamageType)
{
	if(!is_user_alive(iAttacker))
		return 
	
	if(get_user_weapon(iAttacker) != CSW_M4A1 || !g_bHasFrostM4A1[iAttacker])
		return
	
	set_hudmessage(34, 138, 255, -1.0, 0.17, 1, 0.0, 2.0, 1.0, 1.0, -1)
	ShowSyncHudMsg(iAttacker, g_iHudSync, "Freeze Damage^n%d/%d", g_iDmg[iAttacker], get_pcvar_num(g_iFreezeDmg))
	
	new vec1[3], vec2[3]
	get_user_origin(iAttacker, vec1, 1) 
	get_user_origin(iAttacker, vec2, 4)

	make_beam(vec1, vec2, g_iSpriteLaser, 0, 50, 200, 200)
}

public ze_user_infected(infected)
{
	if (g_bHasFrostM4A1[infected])
	{
		g_bHasFrostM4A1[infected] = false
	}
}

public ze_user_humanized(id)
{
	g_bHasFrostM4A1[id] = false
	g_iDmg[id] = 0
}

public Fw_TakeDamage_Post(iVictim, iInflictor, iAttacker, Float:fDamage, bitsDamageType)
{
	// Not Vaild Victim or Attacker
	if (!is_user_connected(iVictim) || !is_user_connected(iAttacker))
		return HC_CONTINUE
	
	if (g_bHasFrostM4A1[iAttacker] && (get_user_weapon(iAttacker) == CSW_M4A1))
	{
		SetHookChainArg(4 , ATYPE_FLOAT, fDamage * get_pcvar_num(g_iDmgMultiplier))
	}
	
	if((get_user_weapon(iAttacker) == CSW_M4A1) && g_bHasFrostM4A1[iAttacker])
	{
		g_iDmg[iAttacker] += (floatround(fDamage) * get_pcvar_num(g_iDmgMultiplier))
	}
	
	if((g_iDmg[iAttacker] >= get_pcvar_num(g_iFreezeDmg)) && (get_user_weapon(iAttacker) == CSW_M4A1) && g_bHasFrostM4A1[iAttacker])
	{
		new szName[32]
		get_user_name(iVictim, szName, charsmax(szName))
		
		ze_set_frost_grenade(iVictim, true)
		
		g_iDmg[iAttacker] = 0
		
		set_dhudmessage(34, 138, 255, -1.0, 0.25, 2, 6.0, 3.0, 0.1, 1.5)
		show_dhudmessage(iAttacker, "%s Has been Freezed!", szName)
	}
	return HC_CONTINUE
}

public CheckModel(id)
{
	if (is_user_alive(id))
	{
		set_pev(id, pev_viewmodel2, V_M4A1_MODEL)
		set_pev(id, pev_weaponmodel2, P_M4A1_MODEL)
	}
	return PLUGIN_CONTINUE
}

public CurrentWeapon(id)
{
	if ((get_user_weapon(id) == CSW_M4A1) && g_bHasFrostM4A1[id] == true)
	{
		CheckModel(id)
	}
	else
	{
		ClearSyncHud(id, g_iHudSync)
	}
	return PLUGIN_CONTINUE
}

make_beam(const origin2[3], const origin[3], sprite, red, green, blue, alpha)
{
	//BEAMENTPOINTS
	message_begin( MSG_BROADCAST,SVC_TEMPENTITY)
	write_byte (0) //TE_BEAMENTPOINTS 0
	write_coord(origin2[0])
	write_coord(origin2[1])
	write_coord(origin2[2])
	write_coord(origin[0])
	write_coord(origin[1])
	write_coord(origin[2])
	write_short(sprite) // sprite
	write_byte(1) // framestart
	write_byte(5) // framerate
	write_byte(2) // life
	write_byte(20) // width
	write_byte(0) // noise 
	write_byte(red) // r, g, b
	write_byte(green) // r, g, b 
	write_byte(blue) // r, g, b 
	write_byte(alpha) // brightness
	write_byte(150) // speed
	message_end()
}

public Fw_SetModel(entity, model[])
{
	
	if(!is_valid_ent(entity)) 
		return FMRES_IGNORED

	if(!equali(model, W_OLD_M4A1_MODEL)) 
		return FMRES_IGNORED

	new className[33]
	entity_get_string(entity, EV_SZ_classname, className, 32)

	static iOwner, iStoredM4A1ID

	// Frost M4A1 Owner
	iOwner = entity_get_edict(entity, EV_ENT_owner)

	// Get drop weapon index (Frost M4A1) to use in fw_FrostM4A1AddToPlayer forward
	iStoredM4A1ID = find_ent_by_owner(-1, "weapon_m4a1", entity)

	// If Player Has Frost M4A1 and It's weapon_m4a1
	if(g_bHasFrostM4A1[iOwner] && is_valid_ent(iStoredM4A1ID))
	{
		// Setting weapon options
		entity_set_int(iStoredM4A1ID, EV_INT_impulse, 1997)

		// Rest Var
		g_bHasFrostM4A1[iOwner] = false
		
		// Set weaponbox new model
		entity_set_model(entity, W_M4A1_MODEL)
		return FMRES_SUPERCEDE
	}
	return FMRES_IGNORED
}

public Fw_AddFrostM4A1ToPlayer(FrostM4A1, id)
{
	// Make sure that this is M4A1
	if(is_valid_ent(FrostM4A1) && is_user_connected(id) && entity_get_int(FrostM4A1, EV_INT_impulse) == 1997)
	{
		// Update Var
		g_bHasFrostM4A1[id] = true

		// Reset weapon options
		entity_set_int(FrostM4A1, EV_INT_impulse, 0)
		return HAM_HANDLED
	}
	return HAM_IGNORED
}

User avatar
Jack GamePlay
Mod Developer
Mod Developer
Egypt
Posts: 512
Joined: 1 Year Ago
Location: Egypt
Has thanked: 31 times
Been thanked: 42 times
Age: 18
Contact:

#5

Post by Jack GamePlay » 2 Weeks Ago

Code: Select all

#include <zombie_escape>
#include <fakemeta_util>
#include <cstrike>

#define CSW_WEAPON_BASE CSW_AK47
#define CSW_NEW_WEAPON	"weapon_fak47"
#define CSW_OLD_WEAPON	"weapon_ak47"
#define WEAPON_KEY	564943
#define OLD_WEAPON	"models/w_ak47.mdl"
#define is_user_valid(%1) (is_user_alive(%1) && !is_user_bot(%1) && !is_user_hltv(%1))

enum
{
	IDLE = 0,
	RELOAD,
	DRAW,
	SHOOT1,
	SHOOT2,
	SHOOT3
}

new const Weapon_Models[][] = { "models/zombie_plague/v_fire_ak47.mdl", "models/zombie_plague/p_fire_ak47.mdl", "models/zombie_plague/w_fire_ak47.mdl" }
new const Weapon_Sounds[][] = { "weapons/ak47beast1.wav", "weapons/ak47beast2.wav", "weapons/ak47beast_clipout.wav", "weapons/ak47beast_draw.wav", "weapons/ak47beast_stab.wav" }
new const Weapon_Sprites[][] = { "sprites/weapon_fak47.txt", "sprites/zombie_plague/640hud31.spr" }
new const GUNSHOT_DECALS[] = { 41, 42, 43, 44, 45 }

new FAK, bool:g_HasFAK[33]
new Cvar_FAK_Recoil, Cvar_FAK_DMG, Cvar_FAK_Clip, Cvar_FAK_Ammo, Cvar_FAK_Speed, Cvar_FAK_ReqDMG, Cvar_FAK_FTime
new Float:cl_pushangle[33][3], g_EventFAK, g_FAK_TmpClip[33], g_IsInPrimaryAttack, g_iDmgCounter[33]
new hud

public plugin_precache()
{
	for(new g = 0; g < sizeof(Weapon_Models); g++)
		precache_model(Weapon_Models[g])
	for(new h = 0; h < sizeof(Weapon_Sounds); h++)
		precache_sound(Weapon_Sounds[h])
	for(new t = 0; t < sizeof(Weapon_Sprites); t++)
		precache_generic(Weapon_Sprites[t])
		
	register_clcmd(CSW_NEW_WEAPON, "hook")
	register_forward(FM_PrecacheEvent, "Fw_Precache_Event", 1)
}

public hook(id)
{
	engclient_cmd(id, CSW_OLD_WEAPON)
	return PLUGIN_HANDLED
}

public plugin_init()
{
	register_plugin("[ZE] Extra Item: Fire Ak-47", "1.0", "JaCk GamePlay")
	FAK = ze_register_item("Fire Ak-47", 60, 0)
	
	// Events & Messages
	register_message(get_user_msgid("DeathMsg"), "DeathMsg")
	register_event("CurWeapon", "CurrentWeapon", "be", "1=1")
	register_event("HLTV", "New_Round", "a", "1=0", "2=0")
	
	// Forwards
	register_forward(FM_PlaybackEvent, "Fw_Playback_Event")
	register_forward(FM_SetModel, "Fw_Set_Model", 1)
	register_forward(FM_UpdateClientData, "Fw_Update_Clientdata", 1)
	
	RegisterHookChain(RG_CBasePlayer_TakeDamage, "Fw_Take_DMG")
	RegisterHookChain(RG_CBasePlayer_Spawn, "Fw_Spawn", 1)
	
	// Hams
	RegisterHam(Ham_Weapon_PrimaryAttack, CSW_OLD_WEAPON, "Fw_PrimaryAttack")
	RegisterHam(Ham_Weapon_PrimaryAttack, CSW_OLD_WEAPON, "Fw_PrimaryAttack_Post", 1)
	RegisterHam(Ham_Item_AddToPlayer, CSW_OLD_WEAPON, "Fw_AddToPlayer")
	RegisterHam(Ham_Weapon_Reload, CSW_OLD_WEAPON, "Fw_Reload")
	RegisterHam(Ham_Weapon_Reload, CSW_OLD_WEAPON, "Fw_Reload_Post", 1)
	RegisterHam(Ham_TraceAttack, "worldspawn", "Fw_TraceAttack", 1)
	RegisterHam(Ham_TraceAttack, "func_breakable", "Fw_TraceAttack", 1)
	RegisterHam(Ham_TraceAttack, "func_wall", "Fw_TraceAttack", 1)
	RegisterHam(Ham_TraceAttack, "func_door", "Fw_TraceAttack", 1)
	RegisterHam(Ham_TraceAttack, "func_door_rotating", "Fw_TraceAttack", 1)
	RegisterHam(Ham_TraceAttack, "func_plat", "Fw_TraceAttack", 1)
	RegisterHam(Ham_TraceAttack, "func_rotating", "Fw_TraceAttack", 1)
	RegisterHam(Ham_Use, "func_tank", "Fw_UseStationary_Post", 1)
	RegisterHam(Ham_Use, "func_tankmortar", "Fw_UseStationary_Post", 1)
	RegisterHam(Ham_Use, "func_tankrocket", "Fw_UseStationary_Post", 1)
	RegisterHam(Ham_Use, "func_tanklaser", "Fw_UseStationary_Post", 1)
	RegisterHam(Ham_Item_Deploy, CSW_OLD_WEAPON, "Fw_Item_Deploy_Post", 1)
	
	// Cvars
	Cvar_FAK_Recoil = register_cvar("ze_fireak_recoil", "1.0")
	Cvar_FAK_DMG = register_cvar("ze_firak_damage", "6")
	Cvar_FAK_Clip = register_cvar("ze_fireak_clip", "40")
	Cvar_FAK_Ammo = register_cvar("ze_fireak_ammo", "150")
	Cvar_FAK_Speed = register_cvar("ze_fireak_speed", "1.5")
	Cvar_FAK_ReqDMG = register_cvar("ze_fireak_requireddmg", "150")
	Cvar_FAK_FTime = register_cvar("ze_fireak_firetime", "3.0")
	
	hud = CreateHudSyncObj()
}

public Fw_Item_Deploy_Post(weapon_ent)
{
	new id = get_pdata_cbase(weapon_ent, 41, 4)
	UTIL_weapon_anim(id, weapon_ent, DRAW)
	CurrentWeapon(id)
}

public Fw_UseStationary_Post(entity, caller, activator, use_type)
{
	if (use_type == 0 && is_user_valid(caller))
	{
		CurrentWeapon(caller)
	}
}

public Fw_TraceAttack(iEnt, iAttacker, Float:flDamage, Float:fDir[3], ptr, iDamageType)
{
	if(!is_user_valid(iAttacker))
		return
	
	static Float:flEnd[3]
	get_tr2(ptr, TR_vecEndPos, flEnd)
	
	if(get_user_weapon(iAttacker) == CSW_WEAPON_BASE && g_HasFAK[iAttacker])
	{
		if(iEnt)
		{
			message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
			write_byte(TE_DECAL)
			engfunc(EngFunc_WriteCoord, flEnd[0])
			engfunc(EngFunc_WriteCoord, flEnd[1])
			engfunc(EngFunc_WriteCoord, flEnd[2])
			write_byte(GUNSHOT_DECALS[random_num(0, charsmax(GUNSHOT_DECALS))])
			write_short(iEnt)
			message_end()
		}
		else
		{
			message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
			write_byte(TE_WORLDDECAL)
			engfunc(EngFunc_WriteCoord, flEnd[0])
			engfunc(EngFunc_WriteCoord, flEnd[1])
			engfunc(EngFunc_WriteCoord, flEnd[2])
			write_byte(GUNSHOT_DECALS[random_num(0, charsmax(GUNSHOT_DECALS))])
			message_end()
		}
		message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
		write_byte(TE_GUNSHOTDECAL)
		engfunc(EngFunc_WriteCoord, flEnd[0])
		engfunc(EngFunc_WriteCoord, flEnd[1])
		engfunc(EngFunc_WriteCoord, flEnd[2])
		write_short(iAttacker)
		write_byte(GUNSHOT_DECALS[random_num(0, charsmax(GUNSHOT_DECALS))])
		message_end()
		
		set_hudmessage(150, 150, 150, -1.0, 0.30, 0, 2.0, 5.0, 2.0, 2.0)
		ShowSyncHudMsg(iAttacker, hud, "%i / %i", g_iDmgCounter[iAttacker], get_pcvar_num(Cvar_FAK_ReqDMG))
	}
}

public Fw_Spawn(id)
{
	if(!is_user_valid(id))
		return
		
	Remove_FAK(id)
}

public New_Round()
{
	for(new i = 0; i < get_maxplayers(); i++)
	{
		if(!is_user_valid(i) || !g_HasFAK[i])
			continue
			
		Remove_FAK(i)
	}
}

public Fw_Reload_Post(weapon_entity) 
{
	new id = pev(weapon_entity, pev_owner)
	if (!is_user_valid(id) || ze_is_user_zombie(id) || g_FAK_TmpClip[id] == -1)
		return HAM_IGNORED
		
	if(get_user_weapon(id) == CSW_WEAPON_BASE && g_HasFAK[id])
	{
		set_pdata_int(weapon_entity, 51, g_FAK_TmpClip[id], 4)
		set_pdata_float(weapon_entity, 48, 3.0, 4)
		set_pdata_float(id, 83, 3.0, 5)
		set_pdata_int(weapon_entity, 54, 1, 4)
		UTIL_weapon_anim(id, weapon_entity, RELOAD)
		set_task(get_pdata_float(id, 83, 5), "ApplyAmmo", id)
	}
	return HAM_IGNORED
}

public ApplyAmmo(id)
{
	if (!is_user_valid(id) || ze_is_user_zombie(id) || g_FAK_TmpClip[id] == -1)
		return HAM_IGNORED
		
	set_member(rg_find_weapon_bpack_by_name(id, CSW_OLD_WEAPON), m_Weapon_iClip, get_pcvar_num(Cvar_FAK_Clip))
	return HAM_IGNORED
}

public Fw_Reload(weapon_entity) 
{
	new id = pev(weapon_entity, pev_owner)
	if (!is_user_valid(id) || ze_is_user_zombie(id))
		return HAM_IGNORED

	static iClipExtra
	if(g_HasFAK[id])
	{
		iClipExtra = get_pcvar_num(Cvar_FAK_Clip)
	}

	g_FAK_TmpClip[id] = -1
	
	new iBpAmmo = cs_get_user_bpammo(id, CSW_WEAPON_BASE)
	new iClip = get_pdata_int(weapon_entity, 51, 4)

	if (iBpAmmo <= 0 || iClip >= iClipExtra)
		return HAM_SUPERCEDE

	g_FAK_TmpClip[id] = iClip

	return HAM_IGNORED
}

public Fw_AddToPlayer(ent, id)
{
	if(!is_valid_ent(ent) || !is_user_valid(id) || ze_is_user_zombie(id))
		return HAM_IGNORED
	
	if(entity_get_int(ent, EV_INT_impulse) == WEAPON_KEY)
	{
		g_HasFAK[id] = true
		g_iDmgCounter[id] = 0
		entity_set_int(ent, EV_INT_impulse, 0)
		
		message_begin(MSG_ONE, get_user_msgid("WeaponList"), {0, 0, 0}, id)
		write_string(CSW_NEW_WEAPON)
		write_byte(2)
		write_byte(90)
		write_byte(-1)
		write_byte(-1)
		write_byte(0)
		write_byte(1)
		write_byte(CSW_WEAPON_BASE)
		write_byte(0)
		message_end()
		return HAM_HANDLED
	}
	else
	{
		message_begin(MSG_ONE, get_user_msgid("WeaponList"), {0, 0, 0}, id)
		write_string(CSW_OLD_WEAPON)
		write_byte(2)
		write_byte(90)
		write_byte(-1)
		write_byte(-1)
		write_byte(0)
		write_byte(1)
		write_byte(CSW_WEAPON_BASE)
		write_byte(0)
		message_end()
	}
	return HAM_IGNORED
}

public Fw_Precache_Event(type, const name[])
{
	if(equal("events/ak47.sc", name))
	{
		g_EventFAK = get_orig_retval()
	}
}

public Fw_Update_Clientdata(id, sendweapons, cd_handle)
{
	if(!is_user_valid(id))
		return

	if(get_user_weapon(id) == CSW_WEAPON_BASE && g_HasFAK[id])
	{
		set_cd(cd_handle, CD_flNextAttack, halflife_time() + 0.001)
	}
}

public Fw_Playback_Event(flags, invoker, eventid, Float:delay, Float:origin[3], Float:angles[3], Float:fparam1, Float:fparam2, iParam1, iParam2, bParam1, bParam2)
{
	if(!is_user_valid(invoker) || !g_IsInPrimaryAttack)
		return
    
	if(eventid == g_EventFAK && get_user_weapon(invoker) == CSW_WEAPON_BASE && g_HasFAK[invoker])
	{
		engfunc(EngFunc_PlaybackEvent, flags | FEV_HOSTONLY, invoker, eventid, delay, origin, angles, fparam1, fparam2, iParam1, iParam2, bParam1, bParam2)
		emit_sound(invoker, CHAN_WEAPON, Weapon_Sounds[random(2)], VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
	}
}

public ze_user_humanized(id)
{
	if(!is_user_valid(id))
		return
		
	Remove_FAK(id)
}

public ze_user_infected(id, infector)
{
	if(!is_user_valid(id) || !is_user_valid(infector))
		return
		
	Remove_FAK(id)
}

public Fw_PrimaryAttack(Weapon)
{
	g_IsInPrimaryAttack = 0
	
	new szClip, szAmmo, id
	id = get_pdata_cbase(Weapon, 41, 4)
	get_user_weapon(id, szClip, szAmmo)
	if(!is_user_valid(id) || ze_is_user_zombie(id))
		return

	g_IsInPrimaryAttack = 1
	if(g_HasFAK[id])
	{
		if (!cs_get_weapon_ammo(Weapon))
			return

		new Float:push[3]
		pev(id, pev_punchangle, push)
		xs_vec_sub(push, cl_pushangle[id], push)
		xs_vec_mul_scalar(push, get_pcvar_float(Cvar_FAK_Recoil), push)
		xs_vec_add(push, cl_pushangle[id], push)
		set_pev(id, pev_punchangle, push)
		UTIL_weapon_anim(id, Weapon, random_num(SHOOT1, SHOOT3))
		emit_sound(id, CHAN_WEAPON, Weapon_Sounds[random(2)], VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
	}
}

public Fw_Take_DMG(Victim, Inflictor, Attacker, Float:Damage, DamageType)
{
	if(!is_user_valid(Attacker) || ze_is_user_zombie(Attacker) || !ze_is_user_zombie(Victim) || !is_user_connected(Victim))
				return HC_CONTINUE
				
	if(get_user_weapon(Attacker) == CSW_WEAPON_BASE && g_HasFAK[Attacker])
	{			
		SetHookChainArg(4, ATYPE_FLOAT, Damage * get_pcvar_num(Cvar_FAK_DMG))
		
		if(ze_zombie_in_fire(Victim))
			return HC_CONTINUE
				
		g_iDmgCounter[Attacker] += floatround(Damage)
		
		if(g_iDmgCounter[Attacker] >= get_pcvar_num(Cvar_FAK_ReqDMG))
		{	
			g_iDmgCounter[Attacker] = 0
			ze_set_fire_grenade(Victim, 1)
			set_task(get_pcvar_float(Cvar_FAK_FTime), "Remove_Fire", Victim)
		}
	}
	
	return HC_CONTINUE
}

public Remove_Fire(Victim)
{
	if(!is_user_valid(Victim) || !ze_zombie_in_fire(Victim))
		return PLUGIN_CONTINUE
		
	ze_set_fire_grenade(Victim, 0)
	return PLUGIN_HANDLED
}

public Fw_PrimaryAttack_Post(Weapon)
{
	g_IsInPrimaryAttack = 0
	new szClip, szAmmo, id
	id = get_pdata_cbase(Weapon, 41, 4)
	get_user_weapon(id, szClip, szAmmo)
	
	if(!is_user_valid(id) || ze_is_user_zombie(id))
		return

	if(g_HasFAK[id])
	{
		if (!cs_get_weapon_ammo(Weapon))
			return

		new Float:push[3]
		pev(id, pev_punchangle, push)
		xs_vec_sub(push, cl_pushangle[id], push)
		xs_vec_mul_scalar(push, get_pcvar_float(Cvar_FAK_Recoil), push)
		xs_vec_add(push, cl_pushangle[id], push)
		set_pev(id, pev_punchangle, push)
		UTIL_weapon_anim(id, Weapon, random_num(SHOOT1, SHOOT3))
		emit_sound(id, CHAN_WEAPON, Weapon_Sounds[random(2)], VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
	}
}

public Fw_Set_Model(entity, model[])
{
	if(!pev_valid(entity) || !equal(model, OLD_WEAPON))
		return FMRES_IGNORED
	
	static szClassName[33], id
	id = pev(entity, pev_owner)
	pev(entity, pev_classname, szClassName, charsmax(szClassName))
	if(!equal(szClassName, "weaponbox"))
		return FMRES_IGNORED
	
	if(g_HasFAK[id] && pev_valid(fm_find_ent_by_owner(-1, CSW_OLD_WEAPON, entity)))
	{
		g_HasFAK[id] = false
		g_iDmgCounter[id] = 0
		set_pev(fm_find_ent_by_owner(-1, CSW_OLD_WEAPON, entity), pev_impulse, WEAPON_KEY)
		engfunc(EngFunc_SetModel, entity, Weapon_Models[2])
		return FMRES_SUPERCEDE
	}
	return FMRES_IGNORED
}

public CurrentWeapon(id)
{
	if(!is_user_valid(id))
		return
		
	if(get_user_weapon(id) == CSW_WEAPON_BASE && g_HasFAK[id])
	{
		cs_set_player_view_model(id, CSW_WEAPON_BASE, Weapon_Models[0])
		cs_set_player_weap_model(id, CSW_WEAPON_BASE, Weapon_Models[1])
		
		message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("CurWeapon"), _, id)
		write_byte(1)
		write_byte(CSW_WEAPON_BASE)
		write_byte(get_member(rg_find_weapon_bpack_by_name(id, CSW_OLD_WEAPON), m_Weapon_iClip))
		message_end()
		
		message_begin(MSG_ONE, get_user_msgid("WeaponList"), {0, 0, 0}, id)
		write_string(CSW_NEW_WEAPON)
		write_byte(2)
		write_byte(90)
		write_byte(-1)
		write_byte(-1)
		write_byte(0)
		write_byte(1)
		write_byte(CSW_WEAPON_BASE)
		write_byte(0)
		message_end()
		
		static Float:iSpeed; iSpeed = get_pcvar_float(Cvar_FAK_Speed)
		static Ent; Ent = find_ent_by_owner(-1, CSW_OLD_WEAPON, id)
		if(Ent)
		{
			static Float:Delay; Delay = get_pdata_float( Ent, 46, 4) * iSpeed
			if (Delay > 0.0)
			{
				set_pdata_float(Ent, 46, Delay, 4)
			}
		}
	}
}

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))
		return
	
	if(equal(szTruncatedWeapon, "ak47") && get_user_weapon(iAttacker) == CSW_WEAPON_BASE && g_HasFAK[iAttacker])
	{
		set_msg_arg_string(4, "fire ak-47")
	}
}

public ze_select_item_pre(id, itemid)
{
	if(itemid != FAK)
		return ZE_ITEM_AVAILABLE

	if(ze_is_user_zombie(id))
		return ZE_ITEM_DONT_SHOW
		
	return ZE_ITEM_AVAILABLE
}

public ze_select_item_post(id, itemid)
{
	if(itemid != FAK)
		return
		
	GiveFAK(id)
}

public GiveFAK(id)
{
	drop_weapons(id, 1)
	rg_give_item(id, CSW_OLD_WEAPON)
	rg_set_user_bpammo(id, WeaponIdType:get_weaponid(CSW_OLD_WEAPON), get_pcvar_num(Cvar_FAK_Ammo))
	set_member(rg_find_weapon_bpack_by_name(id, CSW_OLD_WEAPON), m_Weapon_iClip, get_pcvar_num(Cvar_FAK_Clip))
	g_HasFAK[id] = true
	g_iDmgCounter[id] = 0
	UTIL_weapon_anim(id, CSW_WEAPON_BASE, DRAW)
	ze_colored_print(id, "You bought Fire Ak-47.")
}

public Remove_FAK(id)
{
	if(!is_user_valid(id))
		return
		
	g_HasFAK[id] = false
	g_iDmgCounter[id] = 0
	message_begin(MSG_ONE, get_user_msgid("WeaponList"), {0, 0, 0}, id)
	write_string(CSW_OLD_WEAPON)
	write_byte(2)
	write_byte(90)
	write_byte(-1)
	write_byte(-1)
	write_byte(0)
	write_byte(1)
	write_byte(CSW_WEAPON_BASE)
	write_byte(0)
	message_end()
	cs_reset_player_view_model(id, CSW_WEAPON_BASE)
	cs_reset_player_weap_model(id, CSW_WEAPON_BASE)
}

UTIL_weapon_anim(index, entity, sequence = 0)
{
	set_pev(index, pev_weaponanim, sequence)

	message_begin(MSG_ONE_UNRELIABLE, SVC_WEAPONANIM, {0, 0, 0}, index)
	write_byte(sequence)
	write_byte(pev(entity, pev_body))
	message_end()
}

stock drop_weapons(id, dropwhat)
{
	static weapons[32], num, i, weaponid
	num = 0
	get_user_weapons(id, weapons, num)
	
	const PRIMARY_WEAPONS_BIT_SUM = (1<<CSW_SCOUT)|(1<<CSW_XM1014)|(1<<CSW_MAC10)|(1<<CSW_MAC10)|(1<<CSW_UMP45)|(1<<CSW_SG550)|(1<<CSW_MAC10)|(1<<CSW_FAMAS)|(1<<CSW_AWP)|(1<<CSW_MP5NAVY)|(1<<CSW_M249)|(1<<CSW_M3)|(1<<CSW_M4A1)|(1<<CSW_TMP)|(1<<CSW_G3SG1)|(1<<CSW_SG552)|(1<<CSW_AK47)|(1<<CSW_P90)
	
	for (i = 0; i < num; i++)
	{
		weaponid = weapons[i]
		
		if (dropwhat == 1 && ((1<<weaponid) & PRIMARY_WEAPONS_BIT_SUM))
		{
			static wname[32]
			get_weaponname(weaponid, wname, charsmax(wname))
			engclient_cmd(id, "drop", wname)
		}
	}
}

Code: Select all

#include <zombie_escape>

new const V_M4A1_MODEL[] = "models/zombie_escape/v_frost_m4a1.mdl"
new const P_M4A1_MODEL[] = "models/zombie_escape/p_frost_m4a1.mdl"
new const W_M4A1_MODEL[] = "models/zombie_escape/w_frost_m4a1.mdl"
new const W_OLD_M4A1_MODEL[] = "models/w_m4a1.mdl"

new g_iItemID, g_iHudSync, g_iSpriteLaser, g_iFreezeDmg, g_iDmgMultiplier
new bool:g_bHasFrostM4A1[33]
new g_iDmg[33]

public plugin_init()
{
	register_plugin("[ZE] Extra Item: Frost M4A1", "1.0", "Raheem")
	
	// Cvars
	g_iFreezeDmg = register_cvar("ze_freezing_m4a1_damage", "2000") // Damage Requried So Zombie got Frozen
	g_iDmgMultiplier = register_cvar("ze_multiplier_m4a1_damage", "2") // Multiplie Weapon Damage

	// Message IDS
	g_iHudSync = CreateHudSyncObj()
	
	// ITEM NAME & COST
	g_iItemID = ze_register_item("Frost M4A1", 30, 0) // It's cost 30 Ammo Pack
	
	// Events
	register_event("WeapPickup", "CheckModel", "b", "1=19")
	register_event("CurWeapon", "CurrentWeapon", "be", "1=1")
	
	// Forwards
	register_forward(FM_SetModel, "Fw_SetModel")
	
	// HookChains
	RegisterHookChain(RG_CBasePlayer_TakeDamage, "Fw_TakeDamage_Post", 1)
	
	// Hams
	RegisterHam(Ham_TraceAttack, "player", "Fw_TraceAttack_Post", 1)
	RegisterHam(Ham_TraceAttack, "worldspawn", "Fw_TraceAttack_Post", 1)
	RegisterHam(Ham_Item_AddToPlayer, "weapon_m4a1", "Fw_AddFrostM4A1ToPlayer")
}

public plugin_precache() 
{
	// Models
	precache_model(V_M4A1_MODEL)
	precache_model(P_M4A1_MODEL)
	precache_model(W_M4A1_MODEL)
	
	// Sprites
	g_iSpriteLaser = precache_model( "sprites/Newlightning.spr")
}

public client_disconnected(id)
{
	g_bHasFrostM4A1[id] = false
}

public ze_select_item_pre(id, itemid)
{
    // Return Available and we will block it in Post, So it dosen't affect other plugins
    if (itemid != g_iItemID)
        return ZE_ITEM_AVAILABLE
   
    // Available for Humans only, So don't show it for zombies
    if (ze_is_user_zombie(id))
        return ZE_ITEM_DONT_SHOW
   
    return ZE_ITEM_AVAILABLE
}

public ze_select_item_post(player, itemid)
{
    if (itemid != g_iItemID)
        return

    g_bHasFrostM4A1[player] = true

    rg_remove_item(player, "weapon_m4a1")
    rg_give_item(player, "weapon_m4a1", GT_APPEND)
    rg_set_user_bpammo(player, WeaponIdType:get_weaponid("weapon_m4a1"), 90)
	
    new szName[32]
    get_user_name(player, szName, charsmax(szName))
    
    set_hudmessage(random(255), random(255), random(255), -1.0, 0.17, 1, 0.0, 5.0, 1.0, 1.0, -1)
    show_hudmessage(0, "%s Has bought Frost M4A1!", szName)
    
    ze_colored_print(player, "!tYou Have bought Frost M4A1!y!")
}

public Fw_TraceAttack_Post(iEnt, iAttacker, Float:flDamage, Float:fDir[3], ptr, iDamageType)
{
	if(!is_user_alive(iAttacker))
		return 
	
	if(get_user_weapon(iAttacker) != CSW_M4A1 || !g_bHasFrostM4A1[iAttacker])
		return
	
	set_hudmessage(34, 138, 255, -1.0, 0.17, 1, 0.0, 2.0, 1.0, 1.0, -1)
	ShowSyncHudMsg(iAttacker, g_iHudSync, "Freeze Damage^n%d/%d", g_iDmg[iAttacker], get_pcvar_num(g_iFreezeDmg))
	
	new vec1[3], vec2[3]
	get_user_origin(iAttacker, vec1, 1) 
	get_user_origin(iAttacker, vec2, 4)

	make_beam(vec1, vec2, g_iSpriteLaser, 0, 50, 200, 200)
}

public ze_user_infected(infected)
{
	if (g_bHasFrostM4A1[infected])
	{
		g_bHasFrostM4A1[infected] = false
	}
}

public ze_user_humanized(id)
{
	g_bHasFrostM4A1[id] = false
	g_iDmg[id] = 0
}

public Fw_TakeDamage_Post(iVictim, iInflictor, iAttacker, Float:fDamage, bitsDamageType)
{
	// Not Vaild Victim or Attacker
	if (!is_user_connected(iVictim) || !is_user_connected(iAttacker) || !ze_is_user_zombie(iVictim) || ze_is_user_zombie(iAttacker))
		return HC_CONTINUE
	
	if (g_bHasFrostM4A1[iAttacker] && (get_user_weapon(iAttacker) == CSW_M4A1))
	{
		SetHookChainArg(4 , ATYPE_FLOAT, fDamage * get_pcvar_num(g_iDmgMultiplier))
	}
	
	if((get_user_weapon(iAttacker) == CSW_M4A1) && g_bHasFrostM4A1[iAttacker])
	{
		g_iDmg[iAttacker] += (floatround(fDamage) * get_pcvar_num(g_iDmgMultiplier))
	}
	
	if((g_iDmg[iAttacker] >= get_pcvar_num(g_iFreezeDmg)) && (get_user_weapon(iAttacker) == CSW_M4A1) && g_bHasFrostM4A1[iAttacker])
	{
		new szName[32]
		get_user_name(iVictim, szName, charsmax(szName))
		
		ze_set_frost_grenade(iVictim, true)
		
		g_iDmg[iAttacker] = 0
		
		set_dhudmessage(34, 138, 255, -1.0, 0.25, 2, 6.0, 3.0, 0.1, 1.5)
		show_dhudmessage(iAttacker, "%s Has been Freezed!", szName)
	}
	return HC_CONTINUE
}

public CheckModel(id)
{
	if (is_user_alive(id))
	{
		set_pev(id, pev_viewmodel2, V_M4A1_MODEL)
		set_pev(id, pev_weaponmodel2, P_M4A1_MODEL)
	}
	return PLUGIN_CONTINUE
}

public CurrentWeapon(id)
{
	if ((get_user_weapon(id) == CSW_M4A1) && g_bHasFrostM4A1[id] == true)
	{
		CheckModel(id)
	}
	else
	{
		ClearSyncHud(id, g_iHudSync)
	}
	return PLUGIN_CONTINUE
}

make_beam(const origin2[3], const origin[3], sprite, red, green, blue, alpha)
{
	//BEAMENTPOINTS
	message_begin( MSG_BROADCAST,SVC_TEMPENTITY)
	write_byte (0) //TE_BEAMENTPOINTS 0
	write_coord(origin2[0])
	write_coord(origin2[1])
	write_coord(origin2[2])
	write_coord(origin[0])
	write_coord(origin[1])
	write_coord(origin[2])
	write_short(sprite) // sprite
	write_byte(1) // framestart
	write_byte(5) // framerate
	write_byte(2) // life
	write_byte(20) // width
	write_byte(0) // noise 
	write_byte(red) // r, g, b
	write_byte(green) // r, g, b 
	write_byte(blue) // r, g, b 
	write_byte(alpha) // brightness
	write_byte(150) // speed
	message_end()
}

public Fw_SetModel(entity, model[])
{
	
	if(!is_valid_ent(entity)) 
		return FMRES_IGNORED

	if(!equali(model, W_OLD_M4A1_MODEL)) 
		return FMRES_IGNORED

	new className[33]
	entity_get_string(entity, EV_SZ_classname, className, 32)

	static iOwner, iStoredM4A1ID

	// Frost M4A1 Owner
	iOwner = entity_get_edict(entity, EV_ENT_owner)

	// Get drop weapon index (Frost M4A1) to use in fw_FrostM4A1AddToPlayer forward
	iStoredM4A1ID = find_ent_by_owner(-1, "weapon_m4a1", entity)

	// If Player Has Frost M4A1 and It's weapon_m4a1
	if(g_bHasFrostM4A1[iOwner] && is_valid_ent(iStoredM4A1ID))
	{
		// Setting weapon options
		entity_set_int(iStoredM4A1ID, EV_INT_impulse, 1997)

		// Rest Var
		g_bHasFrostM4A1[iOwner] = false
		
		// Set weaponbox new model
		entity_set_model(entity, W_M4A1_MODEL)
		return FMRES_SUPERCEDE
	}
	return FMRES_IGNORED
}

public Fw_AddFrostM4A1ToPlayer(FrostM4A1, id)
{
	// Make sure that this is M4A1
	if(is_valid_ent(FrostM4A1) && is_user_connected(id) && entity_get_int(FrostM4A1, EV_INT_impulse) == 1997)
	{
		// Update Var
		g_bHasFrostM4A1[id] = true

		// Reset weapon options
		entity_set_int(FrostM4A1, EV_INT_impulse, 0)
		return HAM_HANDLED
	}
	return HAM_IGNORED
}
Image

User avatar
DarkZombie
Member
Member
Hungary
Posts: 68
Joined: 4 Months Ago
Donation: 1x donated in total €6.00
Has thanked: 16 times
Been thanked: 0
Contact:

#6

Post by DarkZombie » 1 Week Ago

Jack GamePlay wrote:
2 Weeks Ago

Code: Select all

#include <zombie_escape>
#include <fakemeta_util>
#include <cstrike>

#define CSW_WEAPON_BASE CSW_AK47
#define CSW_NEW_WEAPON	"weapon_fak47"
#define CSW_OLD_WEAPON	"weapon_ak47"
#define WEAPON_KEY	564943
#define OLD_WEAPON	"models/w_ak47.mdl"
#define is_user_valid(%1) (is_user_alive(%1) && !is_user_bot(%1) && !is_user_hltv(%1))

enum
{
	IDLE = 0,
	RELOAD,
	DRAW,
	SHOOT1,
	SHOOT2,
	SHOOT3
}

new const Weapon_Models[][] = { "models/zombie_plague/v_fire_ak47.mdl", "models/zombie_plague/p_fire_ak47.mdl", "models/zombie_plague/w_fire_ak47.mdl" }
new const Weapon_Sounds[][] = { "weapons/ak47beast1.wav", "weapons/ak47beast2.wav", "weapons/ak47beast_clipout.wav", "weapons/ak47beast_draw.wav", "weapons/ak47beast_stab.wav" }
new const Weapon_Sprites[][] = { "sprites/weapon_fak47.txt", "sprites/zombie_plague/640hud31.spr" }
new const GUNSHOT_DECALS[] = { 41, 42, 43, 44, 45 }

new FAK, bool:g_HasFAK[33]
new Cvar_FAK_Recoil, Cvar_FAK_DMG, Cvar_FAK_Clip, Cvar_FAK_Ammo, Cvar_FAK_Speed, Cvar_FAK_ReqDMG, Cvar_FAK_FTime
new Float:cl_pushangle[33][3], g_EventFAK, g_FAK_TmpClip[33], g_IsInPrimaryAttack, g_iDmgCounter[33]
new hud

public plugin_precache()
{
	for(new g = 0; g < sizeof(Weapon_Models); g++)
		precache_model(Weapon_Models[g])
	for(new h = 0; h < sizeof(Weapon_Sounds); h++)
		precache_sound(Weapon_Sounds[h])
	for(new t = 0; t < sizeof(Weapon_Sprites); t++)
		precache_generic(Weapon_Sprites[t])
		
	register_clcmd(CSW_NEW_WEAPON, "hook")
	register_forward(FM_PrecacheEvent, "Fw_Precache_Event", 1)
}

public hook(id)
{
	engclient_cmd(id, CSW_OLD_WEAPON)
	return PLUGIN_HANDLED
}

public plugin_init()
{
	register_plugin("[ZE] Extra Item: Fire Ak-47", "1.0", "JaCk GamePlay")
	FAK = ze_register_item("Fire Ak-47", 60, 0)
	
	// Events & Messages
	register_message(get_user_msgid("DeathMsg"), "DeathMsg")
	register_event("CurWeapon", "CurrentWeapon", "be", "1=1")
	register_event("HLTV", "New_Round", "a", "1=0", "2=0")
	
	// Forwards
	register_forward(FM_PlaybackEvent, "Fw_Playback_Event")
	register_forward(FM_SetModel, "Fw_Set_Model", 1)
	register_forward(FM_UpdateClientData, "Fw_Update_Clientdata", 1)
	
	RegisterHookChain(RG_CBasePlayer_TakeDamage, "Fw_Take_DMG")
	RegisterHookChain(RG_CBasePlayer_Spawn, "Fw_Spawn", 1)
	
	// Hams
	RegisterHam(Ham_Weapon_PrimaryAttack, CSW_OLD_WEAPON, "Fw_PrimaryAttack")
	RegisterHam(Ham_Weapon_PrimaryAttack, CSW_OLD_WEAPON, "Fw_PrimaryAttack_Post", 1)
	RegisterHam(Ham_Item_AddToPlayer, CSW_OLD_WEAPON, "Fw_AddToPlayer")
	RegisterHam(Ham_Weapon_Reload, CSW_OLD_WEAPON, "Fw_Reload")
	RegisterHam(Ham_Weapon_Reload, CSW_OLD_WEAPON, "Fw_Reload_Post", 1)
	RegisterHam(Ham_TraceAttack, "worldspawn", "Fw_TraceAttack", 1)
	RegisterHam(Ham_TraceAttack, "func_breakable", "Fw_TraceAttack", 1)
	RegisterHam(Ham_TraceAttack, "func_wall", "Fw_TraceAttack", 1)
	RegisterHam(Ham_TraceAttack, "func_door", "Fw_TraceAttack", 1)
	RegisterHam(Ham_TraceAttack, "func_door_rotating", "Fw_TraceAttack", 1)
	RegisterHam(Ham_TraceAttack, "func_plat", "Fw_TraceAttack", 1)
	RegisterHam(Ham_TraceAttack, "func_rotating", "Fw_TraceAttack", 1)
	RegisterHam(Ham_Use, "func_tank", "Fw_UseStationary_Post", 1)
	RegisterHam(Ham_Use, "func_tankmortar", "Fw_UseStationary_Post", 1)
	RegisterHam(Ham_Use, "func_tankrocket", "Fw_UseStationary_Post", 1)
	RegisterHam(Ham_Use, "func_tanklaser", "Fw_UseStationary_Post", 1)
	RegisterHam(Ham_Item_Deploy, CSW_OLD_WEAPON, "Fw_Item_Deploy_Post", 1)
	
	// Cvars
	Cvar_FAK_Recoil = register_cvar("ze_fireak_recoil", "1.0")
	Cvar_FAK_DMG = register_cvar("ze_firak_damage", "6")
	Cvar_FAK_Clip = register_cvar("ze_fireak_clip", "40")
	Cvar_FAK_Ammo = register_cvar("ze_fireak_ammo", "150")
	Cvar_FAK_Speed = register_cvar("ze_fireak_speed", "1.5")
	Cvar_FAK_ReqDMG = register_cvar("ze_fireak_requireddmg", "150")
	Cvar_FAK_FTime = register_cvar("ze_fireak_firetime", "3.0")
	
	hud = CreateHudSyncObj()
}

public Fw_Item_Deploy_Post(weapon_ent)
{
	new id = get_pdata_cbase(weapon_ent, 41, 4)
	UTIL_weapon_anim(id, weapon_ent, DRAW)
	CurrentWeapon(id)
}

public Fw_UseStationary_Post(entity, caller, activator, use_type)
{
	if (use_type == 0 && is_user_valid(caller))
	{
		CurrentWeapon(caller)
	}
}

public Fw_TraceAttack(iEnt, iAttacker, Float:flDamage, Float:fDir[3], ptr, iDamageType)
{
	if(!is_user_valid(iAttacker))
		return
	
	static Float:flEnd[3]
	get_tr2(ptr, TR_vecEndPos, flEnd)
	
	if(get_user_weapon(iAttacker) == CSW_WEAPON_BASE && g_HasFAK[iAttacker])
	{
		if(iEnt)
		{
			message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
			write_byte(TE_DECAL)
			engfunc(EngFunc_WriteCoord, flEnd[0])
			engfunc(EngFunc_WriteCoord, flEnd[1])
			engfunc(EngFunc_WriteCoord, flEnd[2])
			write_byte(GUNSHOT_DECALS[random_num(0, charsmax(GUNSHOT_DECALS))])
			write_short(iEnt)
			message_end()
		}
		else
		{
			message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
			write_byte(TE_WORLDDECAL)
			engfunc(EngFunc_WriteCoord, flEnd[0])
			engfunc(EngFunc_WriteCoord, flEnd[1])
			engfunc(EngFunc_WriteCoord, flEnd[2])
			write_byte(GUNSHOT_DECALS[random_num(0, charsmax(GUNSHOT_DECALS))])
			message_end()
		}
		message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
		write_byte(TE_GUNSHOTDECAL)
		engfunc(EngFunc_WriteCoord, flEnd[0])
		engfunc(EngFunc_WriteCoord, flEnd[1])
		engfunc(EngFunc_WriteCoord, flEnd[2])
		write_short(iAttacker)
		write_byte(GUNSHOT_DECALS[random_num(0, charsmax(GUNSHOT_DECALS))])
		message_end()
		
		set_hudmessage(150, 150, 150, -1.0, 0.30, 0, 2.0, 5.0, 2.0, 2.0)
		ShowSyncHudMsg(iAttacker, hud, "%i / %i", g_iDmgCounter[iAttacker], get_pcvar_num(Cvar_FAK_ReqDMG))
	}
}

public Fw_Spawn(id)
{
	if(!is_user_valid(id))
		return
		
	Remove_FAK(id)
}

public New_Round()
{
	for(new i = 0; i < get_maxplayers(); i++)
	{
		if(!is_user_valid(i) || !g_HasFAK[i])
			continue
			
		Remove_FAK(i)
	}
}

public Fw_Reload_Post(weapon_entity) 
{
	new id = pev(weapon_entity, pev_owner)
	if (!is_user_valid(id) || ze_is_user_zombie(id) || g_FAK_TmpClip[id] == -1)
		return HAM_IGNORED
		
	if(get_user_weapon(id) == CSW_WEAPON_BASE && g_HasFAK[id])
	{
		set_pdata_int(weapon_entity, 51, g_FAK_TmpClip[id], 4)
		set_pdata_float(weapon_entity, 48, 3.0, 4)
		set_pdata_float(id, 83, 3.0, 5)
		set_pdata_int(weapon_entity, 54, 1, 4)
		UTIL_weapon_anim(id, weapon_entity, RELOAD)
		set_task(get_pdata_float(id, 83, 5), "ApplyAmmo", id)
	}
	return HAM_IGNORED
}

public ApplyAmmo(id)
{
	if (!is_user_valid(id) || ze_is_user_zombie(id) || g_FAK_TmpClip[id] == -1)
		return HAM_IGNORED
		
	set_member(rg_find_weapon_bpack_by_name(id, CSW_OLD_WEAPON), m_Weapon_iClip, get_pcvar_num(Cvar_FAK_Clip))
	return HAM_IGNORED
}

public Fw_Reload(weapon_entity) 
{
	new id = pev(weapon_entity, pev_owner)
	if (!is_user_valid(id) || ze_is_user_zombie(id))
		return HAM_IGNORED

	static iClipExtra
	if(g_HasFAK[id])
	{
		iClipExtra = get_pcvar_num(Cvar_FAK_Clip)
	}

	g_FAK_TmpClip[id] = -1
	
	new iBpAmmo = cs_get_user_bpammo(id, CSW_WEAPON_BASE)
	new iClip = get_pdata_int(weapon_entity, 51, 4)

	if (iBpAmmo <= 0 || iClip >= iClipExtra)
		return HAM_SUPERCEDE

	g_FAK_TmpClip[id] = iClip

	return HAM_IGNORED
}

public Fw_AddToPlayer(ent, id)
{
	if(!is_valid_ent(ent) || !is_user_valid(id) || ze_is_user_zombie(id))
		return HAM_IGNORED
	
	if(entity_get_int(ent, EV_INT_impulse) == WEAPON_KEY)
	{
		g_HasFAK[id] = true
		g_iDmgCounter[id] = 0
		entity_set_int(ent, EV_INT_impulse, 0)
		
		message_begin(MSG_ONE, get_user_msgid("WeaponList"), {0, 0, 0}, id)
		write_string(CSW_NEW_WEAPON)
		write_byte(2)
		write_byte(90)
		write_byte(-1)
		write_byte(-1)
		write_byte(0)
		write_byte(1)
		write_byte(CSW_WEAPON_BASE)
		write_byte(0)
		message_end()
		return HAM_HANDLED
	}
	else
	{
		message_begin(MSG_ONE, get_user_msgid("WeaponList"), {0, 0, 0}, id)
		write_string(CSW_OLD_WEAPON)
		write_byte(2)
		write_byte(90)
		write_byte(-1)
		write_byte(-1)
		write_byte(0)
		write_byte(1)
		write_byte(CSW_WEAPON_BASE)
		write_byte(0)
		message_end()
	}
	return HAM_IGNORED
}

public Fw_Precache_Event(type, const name[])
{
	if(equal("events/ak47.sc", name))
	{
		g_EventFAK = get_orig_retval()
	}
}

public Fw_Update_Clientdata(id, sendweapons, cd_handle)
{
	if(!is_user_valid(id))
		return

	if(get_user_weapon(id) == CSW_WEAPON_BASE && g_HasFAK[id])
	{
		set_cd(cd_handle, CD_flNextAttack, halflife_time() + 0.001)
	}
}

public Fw_Playback_Event(flags, invoker, eventid, Float:delay, Float:origin[3], Float:angles[3], Float:fparam1, Float:fparam2, iParam1, iParam2, bParam1, bParam2)
{
	if(!is_user_valid(invoker) || !g_IsInPrimaryAttack)
		return
    
	if(eventid == g_EventFAK && get_user_weapon(invoker) == CSW_WEAPON_BASE && g_HasFAK[invoker])
	{
		engfunc(EngFunc_PlaybackEvent, flags | FEV_HOSTONLY, invoker, eventid, delay, origin, angles, fparam1, fparam2, iParam1, iParam2, bParam1, bParam2)
		emit_sound(invoker, CHAN_WEAPON, Weapon_Sounds[random(2)], VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
	}
}

public ze_user_humanized(id)
{
	if(!is_user_valid(id))
		return
		
	Remove_FAK(id)
}

public ze_user_infected(id, infector)
{
	if(!is_user_valid(id) || !is_user_valid(infector))
		return
		
	Remove_FAK(id)
}

public Fw_PrimaryAttack(Weapon)
{
	g_IsInPrimaryAttack = 0
	
	new szClip, szAmmo, id
	id = get_pdata_cbase(Weapon, 41, 4)
	get_user_weapon(id, szClip, szAmmo)
	if(!is_user_valid(id) || ze_is_user_zombie(id))
		return

	g_IsInPrimaryAttack = 1
	if(g_HasFAK[id])
	{
		if (!cs_get_weapon_ammo(Weapon))
			return

		new Float:push[3]
		pev(id, pev_punchangle, push)
		xs_vec_sub(push, cl_pushangle[id], push)
		xs_vec_mul_scalar(push, get_pcvar_float(Cvar_FAK_Recoil), push)
		xs_vec_add(push, cl_pushangle[id], push)
		set_pev(id, pev_punchangle, push)
		UTIL_weapon_anim(id, Weapon, random_num(SHOOT1, SHOOT3))
		emit_sound(id, CHAN_WEAPON, Weapon_Sounds[random(2)], VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
	}
}

public Fw_Take_DMG(Victim, Inflictor, Attacker, Float:Damage, DamageType)
{
	if(!is_user_valid(Attacker) || ze_is_user_zombie(Attacker) || !ze_is_user_zombie(Victim) || !is_user_connected(Victim))
				return HC_CONTINUE
				
	if(get_user_weapon(Attacker) == CSW_WEAPON_BASE && g_HasFAK[Attacker])
	{			
		SetHookChainArg(4, ATYPE_FLOAT, Damage * get_pcvar_num(Cvar_FAK_DMG))
		
		if(ze_zombie_in_fire(Victim))
			return HC_CONTINUE
				
		g_iDmgCounter[Attacker] += floatround(Damage)
		
		if(g_iDmgCounter[Attacker] >= get_pcvar_num(Cvar_FAK_ReqDMG))
		{	
			g_iDmgCounter[Attacker] = 0
			ze_set_fire_grenade(Victim, 1)
			set_task(get_pcvar_float(Cvar_FAK_FTime), "Remove_Fire", Victim)
		}
	}
	
	return HC_CONTINUE
}

public Remove_Fire(Victim)
{
	if(!is_user_valid(Victim) || !ze_zombie_in_fire(Victim))
		return PLUGIN_CONTINUE
		
	ze_set_fire_grenade(Victim, 0)
	return PLUGIN_HANDLED
}

public Fw_PrimaryAttack_Post(Weapon)
{
	g_IsInPrimaryAttack = 0
	new szClip, szAmmo, id
	id = get_pdata_cbase(Weapon, 41, 4)
	get_user_weapon(id, szClip, szAmmo)
	
	if(!is_user_valid(id) || ze_is_user_zombie(id))
		return

	if(g_HasFAK[id])
	{
		if (!cs_get_weapon_ammo(Weapon))
			return

		new Float:push[3]
		pev(id, pev_punchangle, push)
		xs_vec_sub(push, cl_pushangle[id], push)
		xs_vec_mul_scalar(push, get_pcvar_float(Cvar_FAK_Recoil), push)
		xs_vec_add(push, cl_pushangle[id], push)
		set_pev(id, pev_punchangle, push)
		UTIL_weapon_anim(id, Weapon, random_num(SHOOT1, SHOOT3))
		emit_sound(id, CHAN_WEAPON, Weapon_Sounds[random(2)], VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
	}
}

public Fw_Set_Model(entity, model[])
{
	if(!pev_valid(entity) || !equal(model, OLD_WEAPON))
		return FMRES_IGNORED
	
	static szClassName[33], id
	id = pev(entity, pev_owner)
	pev(entity, pev_classname, szClassName, charsmax(szClassName))
	if(!equal(szClassName, "weaponbox"))
		return FMRES_IGNORED
	
	if(g_HasFAK[id] && pev_valid(fm_find_ent_by_owner(-1, CSW_OLD_WEAPON, entity)))
	{
		g_HasFAK[id] = false
		g_iDmgCounter[id] = 0
		set_pev(fm_find_ent_by_owner(-1, CSW_OLD_WEAPON, entity), pev_impulse, WEAPON_KEY)
		engfunc(EngFunc_SetModel, entity, Weapon_Models[2])
		return FMRES_SUPERCEDE
	}
	return FMRES_IGNORED
}

public CurrentWeapon(id)
{
	if(!is_user_valid(id))
		return
		
	if(get_user_weapon(id) == CSW_WEAPON_BASE && g_HasFAK[id])
	{
		cs_set_player_view_model(id, CSW_WEAPON_BASE, Weapon_Models[0])
		cs_set_player_weap_model(id, CSW_WEAPON_BASE, Weapon_Models[1])
		
		message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("CurWeapon"), _, id)
		write_byte(1)
		write_byte(CSW_WEAPON_BASE)
		write_byte(get_member(rg_find_weapon_bpack_by_name(id, CSW_OLD_WEAPON), m_Weapon_iClip))
		message_end()
		
		message_begin(MSG_ONE, get_user_msgid("WeaponList"), {0, 0, 0}, id)
		write_string(CSW_NEW_WEAPON)
		write_byte(2)
		write_byte(90)
		write_byte(-1)
		write_byte(-1)
		write_byte(0)
		write_byte(1)
		write_byte(CSW_WEAPON_BASE)
		write_byte(0)
		message_end()
		
		static Float:iSpeed; iSpeed = get_pcvar_float(Cvar_FAK_Speed)
		static Ent; Ent = find_ent_by_owner(-1, CSW_OLD_WEAPON, id)
		if(Ent)
		{
			static Float:Delay; Delay = get_pdata_float( Ent, 46, 4) * iSpeed
			if (Delay > 0.0)
			{
				set_pdata_float(Ent, 46, Delay, 4)
			}
		}
	}
}

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))
		return
	
	if(equal(szTruncatedWeapon, "ak47") && get_user_weapon(iAttacker) == CSW_WEAPON_BASE && g_HasFAK[iAttacker])
	{
		set_msg_arg_string(4, "fire ak-47")
	}
}

public ze_select_item_pre(id, itemid)
{
	if(itemid != FAK)
		return ZE_ITEM_AVAILABLE

	if(ze_is_user_zombie(id))
		return ZE_ITEM_DONT_SHOW
		
	return ZE_ITEM_AVAILABLE
}

public ze_select_item_post(id, itemid)
{
	if(itemid != FAK)
		return
		
	GiveFAK(id)
}

public GiveFAK(id)
{
	drop_weapons(id, 1)
	rg_give_item(id, CSW_OLD_WEAPON)
	rg_set_user_bpammo(id, WeaponIdType:get_weaponid(CSW_OLD_WEAPON), get_pcvar_num(Cvar_FAK_Ammo))
	set_member(rg_find_weapon_bpack_by_name(id, CSW_OLD_WEAPON), m_Weapon_iClip, get_pcvar_num(Cvar_FAK_Clip))
	g_HasFAK[id] = true
	g_iDmgCounter[id] = 0
	UTIL_weapon_anim(id, CSW_WEAPON_BASE, DRAW)
	ze_colored_print(id, "You bought Fire Ak-47.")
}

public Remove_FAK(id)
{
	if(!is_user_valid(id))
		return
		
	g_HasFAK[id] = false
	g_iDmgCounter[id] = 0
	message_begin(MSG_ONE, get_user_msgid("WeaponList"), {0, 0, 0}, id)
	write_string(CSW_OLD_WEAPON)
	write_byte(2)
	write_byte(90)
	write_byte(-1)
	write_byte(-1)
	write_byte(0)
	write_byte(1)
	write_byte(CSW_WEAPON_BASE)
	write_byte(0)
	message_end()
	cs_reset_player_view_model(id, CSW_WEAPON_BASE)
	cs_reset_player_weap_model(id, CSW_WEAPON_BASE)
}

UTIL_weapon_anim(index, entity, sequence = 0)
{
	set_pev(index, pev_weaponanim, sequence)

	message_begin(MSG_ONE_UNRELIABLE, SVC_WEAPONANIM, {0, 0, 0}, index)
	write_byte(sequence)
	write_byte(pev(entity, pev_body))
	message_end()
}

stock drop_weapons(id, dropwhat)
{
	static weapons[32], num, i, weaponid
	num = 0
	get_user_weapons(id, weapons, num)
	
	const PRIMARY_WEAPONS_BIT_SUM = (1<<CSW_SCOUT)|(1<<CSW_XM1014)|(1<<CSW_MAC10)|(1<<CSW_MAC10)|(1<<CSW_UMP45)|(1<<CSW_SG550)|(1<<CSW_MAC10)|(1<<CSW_FAMAS)|(1<<CSW_AWP)|(1<<CSW_MP5NAVY)|(1<<CSW_M249)|(1<<CSW_M3)|(1<<CSW_M4A1)|(1<<CSW_TMP)|(1<<CSW_G3SG1)|(1<<CSW_SG552)|(1<<CSW_AK47)|(1<<CSW_P90)
	
	for (i = 0; i < num; i++)
	{
		weaponid = weapons[i]
		
		if (dropwhat == 1 && ((1<<weaponid) & PRIMARY_WEAPONS_BIT_SUM))
		{
			static wname[32]
			get_weaponname(weaponid, wname, charsmax(wname))
			engclient_cmd(id, "drop", wname)
		}
	}
}

Code: Select all

#include <zombie_escape>

new const V_M4A1_MODEL[] = "models/zombie_escape/v_frost_m4a1.mdl"
new const P_M4A1_MODEL[] = "models/zombie_escape/p_frost_m4a1.mdl"
new const W_M4A1_MODEL[] = "models/zombie_escape/w_frost_m4a1.mdl"
new const W_OLD_M4A1_MODEL[] = "models/w_m4a1.mdl"

new g_iItemID, g_iHudSync, g_iSpriteLaser, g_iFreezeDmg, g_iDmgMultiplier
new bool:g_bHasFrostM4A1[33]
new g_iDmg[33]

public plugin_init()
{
	register_plugin("[ZE] Extra Item: Frost M4A1", "1.0", "Raheem")
	
	// Cvars
	g_iFreezeDmg = register_cvar("ze_freezing_m4a1_damage", "2000") // Damage Requried So Zombie got Frozen
	g_iDmgMultiplier = register_cvar("ze_multiplier_m4a1_damage", "2") // Multiplie Weapon Damage

	// Message IDS
	g_iHudSync = CreateHudSyncObj()
	
	// ITEM NAME & COST
	g_iItemID = ze_register_item("Frost M4A1", 30, 0) // It's cost 30 Ammo Pack
	
	// Events
	register_event("WeapPickup", "CheckModel", "b", "1=19")
	register_event("CurWeapon", "CurrentWeapon", "be", "1=1")
	
	// Forwards
	register_forward(FM_SetModel, "Fw_SetModel")
	
	// HookChains
	RegisterHookChain(RG_CBasePlayer_TakeDamage, "Fw_TakeDamage_Post", 1)
	
	// Hams
	RegisterHam(Ham_TraceAttack, "player", "Fw_TraceAttack_Post", 1)
	RegisterHam(Ham_TraceAttack, "worldspawn", "Fw_TraceAttack_Post", 1)
	RegisterHam(Ham_Item_AddToPlayer, "weapon_m4a1", "Fw_AddFrostM4A1ToPlayer")
}

public plugin_precache() 
{
	// Models
	precache_model(V_M4A1_MODEL)
	precache_model(P_M4A1_MODEL)
	precache_model(W_M4A1_MODEL)
	
	// Sprites
	g_iSpriteLaser = precache_model( "sprites/Newlightning.spr")
}

public client_disconnected(id)
{
	g_bHasFrostM4A1[id] = false
}

public ze_select_item_pre(id, itemid)
{
    // Return Available and we will block it in Post, So it dosen't affect other plugins
    if (itemid != g_iItemID)
        return ZE_ITEM_AVAILABLE
   
    // Available for Humans only, So don't show it for zombies
    if (ze_is_user_zombie(id))
        return ZE_ITEM_DONT_SHOW
   
    return ZE_ITEM_AVAILABLE
}

public ze_select_item_post(player, itemid)
{
    if (itemid != g_iItemID)
        return

    g_bHasFrostM4A1[player] = true

    rg_remove_item(player, "weapon_m4a1")
    rg_give_item(player, "weapon_m4a1", GT_APPEND)
    rg_set_user_bpammo(player, WeaponIdType:get_weaponid("weapon_m4a1"), 90)
	
    new szName[32]
    get_user_name(player, szName, charsmax(szName))
    
    set_hudmessage(random(255), random(255), random(255), -1.0, 0.17, 1, 0.0, 5.0, 1.0, 1.0, -1)
    show_hudmessage(0, "%s Has bought Frost M4A1!", szName)
    
    ze_colored_print(player, "!tYou Have bought Frost M4A1!y!")
}

public Fw_TraceAttack_Post(iEnt, iAttacker, Float:flDamage, Float:fDir[3], ptr, iDamageType)
{
	if(!is_user_alive(iAttacker))
		return 
	
	if(get_user_weapon(iAttacker) != CSW_M4A1 || !g_bHasFrostM4A1[iAttacker])
		return
	
	set_hudmessage(34, 138, 255, -1.0, 0.17, 1, 0.0, 2.0, 1.0, 1.0, -1)
	ShowSyncHudMsg(iAttacker, g_iHudSync, "Freeze Damage^n%d/%d", g_iDmg[iAttacker], get_pcvar_num(g_iFreezeDmg))
	
	new vec1[3], vec2[3]
	get_user_origin(iAttacker, vec1, 1) 
	get_user_origin(iAttacker, vec2, 4)

	make_beam(vec1, vec2, g_iSpriteLaser, 0, 50, 200, 200)
}

public ze_user_infected(infected)
{
	if (g_bHasFrostM4A1[infected])
	{
		g_bHasFrostM4A1[infected] = false
	}
}

public ze_user_humanized(id)
{
	g_bHasFrostM4A1[id] = false
	g_iDmg[id] = 0
}

public Fw_TakeDamage_Post(iVictim, iInflictor, iAttacker, Float:fDamage, bitsDamageType)
{
	// Not Vaild Victim or Attacker
	if (!is_user_connected(iVictim) || !is_user_connected(iAttacker) || !ze_is_user_zombie(iVictim) || ze_is_user_zombie(iAttacker))
		return HC_CONTINUE
	
	if (g_bHasFrostM4A1[iAttacker] && (get_user_weapon(iAttacker) == CSW_M4A1))
	{
		SetHookChainArg(4 , ATYPE_FLOAT, fDamage * get_pcvar_num(g_iDmgMultiplier))
	}
	
	if((get_user_weapon(iAttacker) == CSW_M4A1) && g_bHasFrostM4A1[iAttacker])
	{
		g_iDmg[iAttacker] += (floatround(fDamage) * get_pcvar_num(g_iDmgMultiplier))
	}
	
	if((g_iDmg[iAttacker] >= get_pcvar_num(g_iFreezeDmg)) && (get_user_weapon(iAttacker) == CSW_M4A1) && g_bHasFrostM4A1[iAttacker])
	{
		new szName[32]
		get_user_name(iVictim, szName, charsmax(szName))
		
		ze_set_frost_grenade(iVictim, true)
		
		g_iDmg[iAttacker] = 0
		
		set_dhudmessage(34, 138, 255, -1.0, 0.25, 2, 6.0, 3.0, 0.1, 1.5)
		show_dhudmessage(iAttacker, "%s Has been Freezed!", szName)
	}
	return HC_CONTINUE
}

public CheckModel(id)
{
	if (is_user_alive(id))
	{
		set_pev(id, pev_viewmodel2, V_M4A1_MODEL)
		set_pev(id, pev_weaponmodel2, P_M4A1_MODEL)
	}
	return PLUGIN_CONTINUE
}

public CurrentWeapon(id)
{
	if ((get_user_weapon(id) == CSW_M4A1) && g_bHasFrostM4A1[id] == true)
	{
		CheckModel(id)
	}
	else
	{
		ClearSyncHud(id, g_iHudSync)
	}
	return PLUGIN_CONTINUE
}

make_beam(const origin2[3], const origin[3], sprite, red, green, blue, alpha)
{
	//BEAMENTPOINTS
	message_begin( MSG_BROADCAST,SVC_TEMPENTITY)
	write_byte (0) //TE_BEAMENTPOINTS 0
	write_coord(origin2[0])
	write_coord(origin2[1])
	write_coord(origin2[2])
	write_coord(origin[0])
	write_coord(origin[1])
	write_coord(origin[2])
	write_short(sprite) // sprite
	write_byte(1) // framestart
	write_byte(5) // framerate
	write_byte(2) // life
	write_byte(20) // width
	write_byte(0) // noise 
	write_byte(red) // r, g, b
	write_byte(green) // r, g, b 
	write_byte(blue) // r, g, b 
	write_byte(alpha) // brightness
	write_byte(150) // speed
	message_end()
}

public Fw_SetModel(entity, model[])
{
	
	if(!is_valid_ent(entity)) 
		return FMRES_IGNORED

	if(!equali(model, W_OLD_M4A1_MODEL)) 
		return FMRES_IGNORED

	new className[33]
	entity_get_string(entity, EV_SZ_classname, className, 32)

	static iOwner, iStoredM4A1ID

	// Frost M4A1 Owner
	iOwner = entity_get_edict(entity, EV_ENT_owner)

	// Get drop weapon index (Frost M4A1) to use in fw_FrostM4A1AddToPlayer forward
	iStoredM4A1ID = find_ent_by_owner(-1, "weapon_m4a1", entity)

	// If Player Has Frost M4A1 and It's weapon_m4a1
	if(g_bHasFrostM4A1[iOwner] && is_valid_ent(iStoredM4A1ID))
	{
		// Setting weapon options
		entity_set_int(iStoredM4A1ID, EV_INT_impulse, 1997)

		// Rest Var
		g_bHasFrostM4A1[iOwner] = false
		
		// Set weaponbox new model
		entity_set_model(entity, W_M4A1_MODEL)
		return FMRES_SUPERCEDE
	}
	return FMRES_IGNORED
}

public Fw_AddFrostM4A1ToPlayer(FrostM4A1, id)
{
	// Make sure that this is M4A1
	if(is_valid_ent(FrostM4A1) && is_user_connected(id) && entity_get_int(FrostM4A1, EV_INT_impulse) == 1997)
	{
		// Update Var
		g_bHasFrostM4A1[id] = true

		// Reset weapon options
		entity_set_int(FrostM4A1, EV_INT_impulse, 0)
		return HAM_HANDLED
	}
	return HAM_IGNORED
}
Thank you Jack.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest