Resolved Deimos Zombie for VIP

Coding Help/Re-API Supported
Post Reply
User avatar
Spir0x
Veteran Member
Veteran Member
Tunisia
Posts: 609
Joined: 2 Years Ago
Location: Tunisia
Has thanked: 14 times
Been thanked: 6 times
Age: 19
Contact:

Deimos Zombie for VIP

#1

Post by Spir0x » 5 Months Ago

Hey every one, can anyone help me on this code please ? i just want to turn this deimos class only for VIP.
there's the code problems on the screenshot:
Image

Code: Select all

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

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

/*================= START CONFIGS =====================*/
new const DEIMOS_NAME[] = "Deimos Zombie" // name
new const DEIMOS_INFO[] = "Drop Human Weapon" // description
const DEIMOS_HEALTH = 50000 // health
const DEIMOS_SPEED = 350 // speed
const DEIMOS_GRAVITY = 650 // 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[] = "Premuim_ZE/deimos_skill_start.wav"
new const g_szSkill_Hit[] = "Premuim_ZE/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.1", "Spi")
	
	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/Premuim_ZE/trail.spr")
	g_iEXP_Spr = precache_model("sprites/Premuim_ZE/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, "!gPress !y[!tg!y] !gand aim at the survivor to drop his weapon!y.")
	}
}

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

	g_bCanUseSkill[id] = true
		{
	if (ze_get_vip_flags(id) & VIP_FLAGS))
		else
		ze_colored_print(id, "!tYou are not !gVIP!y!")
		}
}

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 your 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 now!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
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1036\\ f0\\ fs16 \n\\ par }
*/
I trynna make money, not friends.

User avatar
Spir0x
Veteran Member
Veteran Member
Tunisia
Posts: 609
Joined: 2 Years Ago
Location: Tunisia
Has thanked: 14 times
Been thanked: 6 times
Age: 19
Contact:

#2

Post by Spir0x » 5 Months Ago

Up
I trynna make money, not friends.

User avatar
Jack GamePlay
Mod Developer
Mod Developer
Egypt
Posts: 566
Joined: 2 Years Ago
Location: Egypt
Has thanked: 33 times
Been thanked: 47 times
Age: 19
Contact:

#3

Post by Jack GamePlay » 5 Months Ago

Try:

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_FLAGS VIP_B

/*================= START CONFIGS =====================*/
new const DEIMOS_NAME[] = "Deimos Zombie" // name
new const DEIMOS_INFO[] = "Drop Human Weapon" // description
const DEIMOS_HEALTH = 50000 // health
const DEIMOS_SPEED = 350 // speed
const DEIMOS_GRAVITY = 650 // 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[] = "Premuim_ZE/deimos_skill_start.wav"
new const g_szSkill_Hit[] = "Premuim_ZE/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.1", "Spi")
	
	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/Premuim_ZE/trail.spr")
	g_iEXP_Spr = precache_model("sprites/Premuim_ZE/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, "!gPress !y[!tg!y] !gand aim at the survivor to drop his weapon!y.")
	}
}

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

	if (ze_get_vip_flags(id) & VIP_FLAGS)
	{
		g_bCanUseSkill[id] = true
	}
	else
	{
		ze_colored_print(id, "!tYou are not !gVIP!y!")
	}
}

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 your 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 now!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
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1036\\ f0\\ fs16 \n\\ par }
*/
Not interested in CS/Pawn anymore.
Accepting web projects.

User avatar
Spir0x
Veteran Member
Veteran Member
Tunisia
Posts: 609
Joined: 2 Years Ago
Location: Tunisia
Has thanked: 14 times
Been thanked: 6 times
Age: 19
Contact:

#4

Post by Spir0x » 4 Months Ago

Solved.
I trynna make money, not friends.

Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests