Solved ZC Deimos Only VIP

Unpaid Requests, Public Plugins
Post Reply
User avatar
alexnovac18
Member
Member
Romania
Posts: 28
Joined: 5 years ago
Location: Romania
Contact:

ZC Deimos Only VIP

#1

Post by alexnovac18 » 4 years ago

Hello Team Escapers-Zone, Can make This class ZM Only for VIP Please

Code: Select all

#include <zombie_escape>
#include <ze_zombie_class>
#include <fakemeta>
#include <engine>

#define TASK_WAIT 11111
#define TASK_ATTACK 22222
#define TASK_COOLDOWN 33333

/*================= START CONFIGS =====================*/
new const DEIMOS_NAME[] = "Deimos Zombie" // name
new const DEIMOS_INFO[] = "Drop Human Weapon" // description
const DEIMOS_HEALTH = 20000 // health
const DEIMOS_SPEED = 280 // speed
const DEIMOS_GRAVITY = 800 // gravity
/*================= END CONFIGS =====================*/

new g_iClassID, bool:g_bCanUseSkill[33]

new g_iTrail_Spr, g_iEXP_Spr

new const g_szLight_ClassName[] = "deimos_skill"
new const g_szSkill_Start[] = "zombie_escape/deimos_skill_start.wav"
new const g_szSkill_Hit[] = "zombie_escape/deimos_skill_hit.wav"

const WPN_NOT_DROP = ((1<<2)|(1<<CSW_HEGRENADE)|(1<<CSW_SMOKEGRENADE)|(1<<CSW_FLASHBANG)|(1<<CSW_KNIFE)|(1<<CSW_C4))

new g_pCvarCoolDown

public plugin_init()
{
	register_plugin("[Ze] Zombie Class: Deimos", "1.0", "Dias/Jack GamePlay")
	
	g_pCvarCoolDown = register_cvar("ze_deimos_cooldown", "30")
	
	register_forward(FM_Touch, "Fw_Touch")
	register_clcmd("drop", "Use_Skill")
}

public plugin_precache()
{
	g_iTrail_Spr = precache_model("sprites/zombie_escape/trail.spr")
	g_iEXP_Spr = precache_model("sprites/zombie_escape/deimosexp.spr")
	
	precache_sound(g_szSkill_Start)
	precache_sound(g_szSkill_Hit)
	
	g_iClassID = ze_register_zombie_class(DEIMOS_NAME, DEIMOS_INFO, DEIMOS_HEALTH, DEIMOS_SPEED, DEIMOS_GRAVITY)	
}

public ze_user_infected(id)
{
	if (ze_is_user_zombie(id) && ze_get_current_zombie_class(id) == g_iClassID)
	{
		g_bCanUseSkill[id] = true
		ze_colored_print(id, "!gAim !y& !gPress !y[!tg!y] !gto Drop Human Weapon!y.")
	}
}

public ze_user_humanized(id)
{
	if (!is_user_connected(id))
		return

	g_bCanUseSkill[id] = true
}

public Use_Skill(id)
{
	if (is_user_alive(id) && ze_is_user_zombie(id) && ze_get_current_zombie_class(id) == g_iClassID)
	{
		if (g_bCanUseSkill[id])
		{
			Do_Skill(id)
			g_bCanUseSkill[id] = false
		}
		else
		{
			ze_colored_print(id, "!gYou can't use your skill now!y...")
		}
	}
}

public Do_Skill(id)
{
	emit_sound(id, CHAN_WEAPON, g_szSkill_Start, 1.0, ATTN_NORM, 0, PITCH_NORM)
	entity_set_int(id, EV_INT_sequence, 10)

	set_task(0.5, "Launch_Light", id+TASK_ATTACK)
}

public Launch_Light(taskid)
{
	new id = taskid - TASK_ATTACK

	if (task_exists(id+TASK_ATTACK))
		remove_task(id+TASK_ATTACK)
	
	if (!is_user_alive(id))
			return
	
	// check
	new Float:flOrigin[3], Float:flAngle[3], Float:flVelocity[3]
	pev(id, pev_origin, flOrigin)
	pev(id, pev_view_ofs, flAngle)
	fm_velocity_by_aim(id, 2.0, flVelocity, flAngle)
	flAngle[0] *= -1.0
	
	// create ent
	new iEnt = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "info_target"))
	set_pev(iEnt, pev_classname, g_szLight_ClassName)
	engfunc(EngFunc_SetModel, iEnt, "models/w_hegrenade.mdl")
	set_pev(iEnt, pev_mins, Float:{-1.0, -1.0, -1.0})
	set_pev(iEnt, pev_maxs, Float:{1.0, 1.0, 1.0})
	set_pev(iEnt, pev_origin, flOrigin)
	flOrigin[0] += flVelocity[0]
	flOrigin[1] += flVelocity[1]
	flOrigin[2] += flVelocity[2]
	set_pev(iEnt, pev_movetype, MOVETYPE_BOUNCE)
	set_pev(iEnt, pev_gravity, 0.01)
	flVelocity[0] *= 1000
	flVelocity[1] *= 1000
	flVelocity[2] *= 1000
	set_pev(iEnt, pev_velocity, flVelocity)
	set_pev(iEnt, pev_owner, id)
	set_pev(iEnt, pev_angles, flAngle)
	set_pev(iEnt, pev_solid, SOLID_BBOX)						//store the enitty id
	
	// invisible ent
	Set_Rendering(iEnt, kRenderFxGlowShell, 0, 0, 0, kRenderTransAlpha, 0)
		
	message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
	write_byte(TE_BEAMFOLLOW)
	write_short(iEnt)		//entity
	write_short(g_iTrail_Spr)	//model
	write_byte(5)		//10)//life
	write_byte(3)		//5)//width
	write_byte(209)		// Red
	write_byte(120)		// Green
	write_byte(9)		// Blue
	write_byte(200)		//brightness
	message_end()
	
	ze_colored_print(id, "!gYou have to wait !y[!t%i!y] !gsec to re!y-!guse skill!y.", get_pcvar_num(g_pCvarCoolDown))
	set_task(get_pcvar_float(g_pCvarCoolDown), "Reset_CoolDown", id+TASK_COOLDOWN)
}

public Reset_CoolDown(taskid)
{
	new id = taskid - TASK_COOLDOWN
	
	if (ze_is_user_zombie(id) && ze_get_current_zombie_class(id) == g_iClassID)
	{
		g_bCanUseSkill[id] = true
		ze_colored_print(id, "!gYou can re!y-!guse your skill!y. !gAim and Press !y[!tG!y].")
	}
}

public Fw_Touch(ent, victim)
{
	if (!pev_valid(ent))
		return FMRES_IGNORED
	
	new szEntClassName[32]
	entity_get_string(ent, EV_SZ_classname, szEntClassName, charsmax(szEntClassName))
	
	if (equal(szEntClassName, g_szLight_ClassName)) 
	{
		Light_Exp(ent, victim)
		remove_entity(ent)
		return FMRES_IGNORED
	}
	
	return FMRES_IGNORED
}

Light_Exp(ent, victim)
{
	if (!pev_valid(ent))
		return
	
	if (is_user_alive(victim) && !ze_is_user_zombie(victim))
	{
		new wpn, wpnname[32]
		wpn = get_user_weapon(victim)
		if (!(WPN_NOT_DROP & (1<<wpn)) && get_weaponname(wpn, wpnname, charsmax(wpnname)) )
		{
			engclient_cmd(victim, "drop", wpnname)
		}
	}
	
	// create effect
	static Float:flOrigin[3]
	pev(ent, pev_origin, flOrigin)
	message_begin(MSG_BROADCAST,SVC_TEMPENTITY)
	write_byte(TE_EXPLOSION)	// TE_EXPLOSION
	write_coord(floatround(flOrigin[0]))	// origin x
	write_coord(floatround(flOrigin[1]))	// origin y
	write_coord(floatround(flOrigin[2]))	// origin z
	write_short(g_iEXP_Spr)	// sprites
	write_byte(40)	// scale in 0.1's
	write_byte(30)	// framerate
	write_byte(14)	// flags 
	message_end()
	
	// play sound exp
	emit_sound(ent, CHAN_WEAPON, g_szSkill_Hit, 1.0, ATTN_NORM, 0, PITCH_NORM)
}

fm_velocity_by_aim(iIndex, Float:flDistance, Float:flVelocity[3], Float:flViewAngles[3])
{
	pev(iIndex, pev_v_angle, flViewAngles)
	flVelocity[0] = floatcos(flViewAngles[1], degrees) * flDistance
	flVelocity[1] = floatsin(flViewAngles[1], degrees) * flDistance
	flVelocity[2] = floatcos(flViewAngles[0]+90.0, degrees) * flDistance
	return 1
}


User avatar
sPe3doN
Senior Member
Senior Member
Algeria
Posts: 258
Joined: 7 years ago
Contact:

#3

Post by sPe3doN » 4 years ago

Code: Select all

#include <zombie_escape>
#include <ze_zombie_class>
#include <ze_vip>
#include <fakemeta>
#include <engine>

#define TASK_WAIT 11111
#define TASK_ATTACK 22222
#define TASK_COOLDOWN 33333
#define VIP_ZMCLASS VIP_A

/*================= START CONFIGS =====================*/
new const DEIMOS_NAME[] = "Deimos Zombie" // name
new const DEIMOS_INFO[] = "Drop Human Weapon" // description
const DEIMOS_HEALTH = 20000 // health
const DEIMOS_SPEED = 280 // speed
const DEIMOS_GRAVITY = 800 // gravity
/*================= END CONFIGS =====================*/

new g_iClassID, bool:g_bCanUseSkill[33]

new g_iTrail_Spr, g_iEXP_Spr

new const g_szLight_ClassName[] = "deimos_skill"
new const g_szSkill_Start[] = "zombie_escape/deimos_skill_start.wav"
new const g_szSkill_Hit[] = "zombie_escape/deimos_skill_hit.wav"

const WPN_NOT_DROP = ((1<<2)|(1<<CSW_HEGRENADE)|(1<<CSW_SMOKEGRENADE)|(1<<CSW_FLASHBANG)|(1<<CSW_KNIFE)|(1<<CSW_C4))

new g_pCvarCoolDown

public plugin_init()
{
	register_plugin("[Ze] Zombie Class: Deimos", "1.0", "Dias/Jack GamePlay")
	
	g_pCvarCoolDown = register_cvar("ze_deimos_cooldown", "30")
	
	register_forward(FM_Touch, "Fw_Touch")
	register_clcmd("drop", "Use_Skill")
}

public plugin_precache()
{
	g_iTrail_Spr = precache_model("sprites/zombie_escape/trail.spr")
	g_iEXP_Spr = precache_model("sprites/zombie_escape/deimosexp.spr")
	
	precache_sound(g_szSkill_Start)
	precache_sound(g_szSkill_Hit)
	
	g_iClassID = ze_register_zombie_class(DEIMOS_NAME, DEIMOS_INFO, DEIMOS_HEALTH, DEIMOS_SPEED, DEIMOS_GRAVITY)	
}

public ze_select_zombie_class_pre(id, classid)
{
    if (classid != g_iClassID)
        return ZE_CLASS_AVAILABLE
 
    if (~(ze_get_vip_flags(id) & VIP_ZMCLASS))
        return ZE_CLASS_UNAVAILABLE
 
    ze_add_zombie_class_menu_text("\rVIP")
 
    return ZE_CLASS_AVAILABLE
}

public ze_user_infected(id)
{
if (ze_is_user_zombie(id) && ze_get_current_zombie_class(id) == g_iClassID)
	{
		g_bCanUseSkill[id] = true
		ze_colored_print(id, "!gAim !y& !gPress !y[!tg!y] !gto Drop Human Weapon!y.")
	}
}

public ze_user_humanized(id)
{
	if (!is_user_connected(id))
		return

	g_bCanUseSkill[id] = true
}

public Use_Skill(id)
{
	if (is_user_alive(id) && ze_is_user_zombie(id) && ze_get_current_zombie_class(id) == g_iClassID)
	{
		if (g_bCanUseSkill[id])
		{
			Do_Skill(id)
			g_bCanUseSkill[id] = false
		}
		else
		{
			ze_colored_print(id, "!gYou can't use your skill now!y...")
		}
	}
}

public Do_Skill(id)
{
	emit_sound(id, CHAN_WEAPON, g_szSkill_Start, 1.0, ATTN_NORM, 0, PITCH_NORM)
	entity_set_int(id, EV_INT_sequence, 10)

	set_task(0.5, "Launch_Light", id+TASK_ATTACK)
}

public Launch_Light(taskid)
{
	new id = taskid - TASK_ATTACK

	if (task_exists(id+TASK_ATTACK))
		remove_task(id+TASK_ATTACK)
	
	if (!is_user_alive(id))
			return
	
	// check
	new Float:flOrigin[3], Float:flAngle[3], Float:flVelocity[3]
	pev(id, pev_origin, flOrigin)
	pev(id, pev_view_ofs, flAngle)
	fm_velocity_by_aim(id, 2.0, flVelocity, flAngle)
	flAngle[0] *= -1.0
	
	// create ent
	new iEnt = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "info_target"))
	set_pev(iEnt, pev_classname, g_szLight_ClassName)
	engfunc(EngFunc_SetModel, iEnt, "models/w_hegrenade.mdl")
	set_pev(iEnt, pev_mins, Float:{-1.0, -1.0, -1.0})
	set_pev(iEnt, pev_maxs, Float:{1.0, 1.0, 1.0})
	set_pev(iEnt, pev_origin, flOrigin)
	flOrigin[0] += flVelocity[0]
	flOrigin[1] += flVelocity[1]
	flOrigin[2] += flVelocity[2]
	set_pev(iEnt, pev_movetype, MOVETYPE_BOUNCE)
	set_pev(iEnt, pev_gravity, 0.01)
	flVelocity[0] *= 1000
	flVelocity[1] *= 1000
	flVelocity[2] *= 1000
	set_pev(iEnt, pev_velocity, flVelocity)
	set_pev(iEnt, pev_owner, id)
	set_pev(iEnt, pev_angles, flAngle)
	set_pev(iEnt, pev_solid, SOLID_BBOX)						//store the enitty id
	
	// invisible ent
	Set_Rendering(iEnt, kRenderFxGlowShell, 0, 0, 0, kRenderTransAlpha, 0)
		
	message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
	write_byte(TE_BEAMFOLLOW)
	write_short(iEnt)		//entity
	write_short(g_iTrail_Spr)	//model
	write_byte(5)		//10)//life
	write_byte(3)		//5)//width
	write_byte(209)		// Red
	write_byte(120)		// Green
	write_byte(9)		// Blue
	write_byte(200)		//brightness
	message_end()
	
	ze_colored_print(id, "!gYou have to wait !y[!t%i!y] !gsec to re!y-!guse skill!y.", get_pcvar_num(g_pCvarCoolDown))
	set_task(get_pcvar_float(g_pCvarCoolDown), "Reset_CoolDown", id+TASK_COOLDOWN)
}

public Reset_CoolDown(taskid)
{
	new id = taskid - TASK_COOLDOWN
	
	if (ze_is_user_zombie(id) && ze_get_current_zombie_class(id) == g_iClassID)
	{
		g_bCanUseSkill[id] = true
		ze_colored_print(id, "!gYou can re!y-!guse your skill!y. !gAim and Press !y[!tG!y].")
	}
}

public Fw_Touch(ent, victim)
{
	if (!pev_valid(ent))
		return FMRES_IGNORED
	
	new szEntClassName[32]
	entity_get_string(ent, EV_SZ_classname, szEntClassName, charsmax(szEntClassName))
	
	if (equal(szEntClassName, g_szLight_ClassName)) 
	{
		Light_Exp(ent, victim)
		remove_entity(ent)
		return FMRES_IGNORED
	}
	
	return FMRES_IGNORED
}

Light_Exp(ent, victim)
{
	if (!pev_valid(ent))
		return
	
	if (is_user_alive(victim) && !ze_is_user_zombie(victim))
	{
		new wpn, wpnname[32]
		wpn = get_user_weapon(victim)
		if (!(WPN_NOT_DROP & (1<<wpn)) && get_weaponname(wpn, wpnname, charsmax(wpnname)) )
		{
			engclient_cmd(victim, "drop", wpnname)
		}
	}
	
	// create effect
	static Float:flOrigin[3]
	pev(ent, pev_origin, flOrigin)
	message_begin(MSG_BROADCAST,SVC_TEMPENTITY)
	write_byte(TE_EXPLOSION)	// TE_EXPLOSION
	write_coord(floatround(flOrigin[0]))	// origin x
	write_coord(floatround(flOrigin[1]))	// origin y
	write_coord(floatround(flOrigin[2]))	// origin z
	write_short(g_iEXP_Spr)	// sprites
	write_byte(40)	// scale in 0.1's
	write_byte(30)	// framerate
	write_byte(14)	// flags 
	message_end()
	
	// play sound exp
	emit_sound(ent, CHAN_WEAPON, g_szSkill_Hit, 1.0, ATTN_NORM, 0, PITCH_NORM)
}

fm_velocity_by_aim(iIndex, Float:flDistance, Float:flVelocity[3], Float:flViewAngles[3])
{
	pev(iIndex, pev_v_angle, flViewAngles)
	flVelocity[0] = floatcos(flViewAngles[1], degrees) * flDistance
	flVelocity[1] = floatsin(flViewAngles[1], degrees) * flDistance
	flVelocity[2] = floatcos(flViewAngles[0]+90.0, degrees) * flDistance
	return 1
}
Image

User avatar
alexnovac18
Member
Member
Romania
Posts: 28
Joined: 5 years ago
Location: Romania
Contact:

#4

Post by alexnovac18 » 4 years ago

Thank you bro, Working !

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 6 guests