Raised This Month: $344 Target: $400
 86%   Almost there!

Help / Support Need help [zp jetpack]


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Ali0mer
Member
Join Date: Jan 2016
Location: Iraq
Old 10-10-2017 , 16:36   Need help [zp jetpack]
Reply With Quote #1

Hi guys.


I need help i download a plugin (jetpack+bazooka) but it has problem
The problem is when i try to Press "G" It dropped right?
In this plugin is not working this command....
I want it to be dropped when i press "G"


Code
Code:
#include amxmodx

#include engine

#include fakemeta

#include hamsandwich

#include zombie_plague_advance

#include zp50_colorchat



#define PLUGINNAME		"Extra Item Jetpack+Bazooka"

#define VERSION			"3.2"

#define AUTHOR			"B!gBud "



#define TE_EXPLOSION	3

#define TE_BEAMFOLLOW	22

#define TE_BEAMCYLINDER	21



#define JETPACK_COST 30



new ROCKET_MDL[64] = "models/rpgrocket.mdl"

new ROCKET_SOUND[64] = "JetpackBazooka/rocket_fire.wav"

new getrocket[64] = "JetpackBazooka/gun_pickup.wav"

new jetpack_blow[64] = "JetpackBazooka/jetpack_blow.wav"

new jetpack_fly[64] = "JetpackBazooka/jetpack_fly.wav"



new bool:fly[33] = false

new bool:rocket[33] = false

new bool:rksound[33] = false

new bool:shot[33] = false



new Float:gltime = 0.0

new Float:last_Rocket[33] = 0.0

new Float:jp_cal[33] = 0.0

new Float:jp_soun[33] = 0.0

new fire, trail, explode, shockwave

new g_flyEnergy[33], hasjet[33]

new g_iPlayerPos[33]

new cvar_jetpack, cvar_jetpackSpeed, cvar_jetpackUpSpeed, cvar_jetpackAcrate ,cvar_RocketDelay, cvar_RocketSpeed, cvar_RocketDmg, cvar_Dmg_range, cvar_fly_max_engery, cvar_fly_engery, cvar_regain_energy, g_item_jetpack, cvar_cal_time, cvar_oneround



new bool:g_bAlive[33]



new const Float:g_flCoords[][] = { {0.50, 0.40}, {0.56, 0.44}, {0.60, 0.50}, {0.56, 0.56},

			{0.50, 0.60}, {0.44, 0.56}, {0.40, 0.50}, {0.44, 0.44} }



#define EFFECT_LENGTH 3 // timpu cat sa tina efectul



public plugin_init() 

{

	register_plugin(PLUGINNAME, VERSION, AUTHOR)

	

	g_item_jetpack = zp_register_extra_item("Jetpack+Bazooka", 32, ZP_TEAM_HUMAN)

	

	register_clcmd("drop","cmdDrop")

	

	cvar_jetpack = register_cvar("zp_jetpack", "2")

	

	cvar_jetpackSpeed=register_cvar("zp_jp_forward_speed","300.0")

	cvar_jetpackUpSpeed=register_cvar("zp_jp_up_speed","35.0")

	cvar_jetpackAcrate=register_cvar("zp_jp_accelerate","100.0")

	

	cvar_RocketDelay=register_cvar("zp_jp_rocket_delay","15.0")

	cvar_RocketSpeed=register_cvar("zp_jp_rocket_speed","1500")

	cvar_RocketDmg=register_cvar("zp_jp_rocket_damage","1500")

	cvar_Dmg_range=register_cvar("zp_jp_damage_radius","650")

	

	cvar_fly_max_engery = register_cvar("zp_jp_max_engery", "100")

	cvar_fly_engery = register_cvar("zp_jp_engery", "10")

	cvar_regain_energy = register_cvar("zp_jp_regain_energy", "3")

	cvar_cal_time = register_cvar("zp_jp_energy_cal", "1.0")

	cvar_oneround = register_cvar("zp_jp_oneround", "0")

	

	register_event("CurWeapon", "check_models", "be")

	register_event("DeathMsg", "player_die", "a")

	register_event("HLTV", "event_round_start", "a", "1=0", "2=0")

	

	RegisterHam( Ham_Spawn, "player", "OnSpawn", 1 )

	RegisterHam( Ham_Killed, "player", "OnKilled", 1 )

	

	register_forward(FM_StartFrame, "fm_startFrame")

	register_forward(FM_EmitSound, "emitsound")

}



public plugin_precache() 

{

	precache_model("models/p_egon.mdl")

	precache_model("models/v_egon.mdl")

	precache_model("models/w_egon.mdl")

	

	precache_model(ROCKET_MDL)

	precache_sound(ROCKET_SOUND)

	precache_sound(getrocket)

	precache_sound(jetpack_fly)

	precache_sound(jetpack_blow)

	

	fire = precache_model( "sprites/xfireball3.spr" )

	trail = precache_model( "sprites/laserbeam.spr" )

	

	explode = precache_model("sprites/zerogxplode.spr") // zeroxplode.spr

	shockwave = precache_model("sprites/shockwave.spr")

}



public client_putinserver(id) 

{

	fly[id] = false

	rocket[id] = false

	hasjet[id] = 0

	g_flyEnergy[id] = 0

}



public client_disconnect(id) 

{

	g_bAlive[ id ] = false



	fly[id] = false

	rocket[id] = false

	hasjet[id] = 0

	g_flyEnergy[id] = 0

}



public OnSpawn( id )

{

	if( is_user_alive( id ) )

		g_bAlive[ id ] = true

}



public OnKilled( id ) 

	g_bAlive[ id ] = false;



public event_round_start()

{

	remove_jetpacks();

	if (get_pcvar_num(cvar_oneround) == 1) 

	{

		for (new id; id <= 32; id++) 

		hasjet[id] = 0, g_flyEnergy[id] = 0, fly[id] = false;

	}

}



public fm_startFrame()

{

	static id;

	gltime = get_gametime()

	for (id = 1; id <= 32; id++)

	{

		jp_forward(id)

	}

}



public jp_forward(Player) 

{	

	if (!hasjet[Player]||!g_bAlive[ Player ] || (zp_get_user_zombie(Player) || zp_get_user_nemesis(Player) || zp_get_user_assassin(Player) || zp_get_user_survivor(Player) || zp_get_user_sniper(Player)))

		return FMRES_IGNORED 	

		

	if(jp_cal[Player] < gltime)

	{

		jp_energy(Player); jp_cal[Player] = gltime + get_pcvar_float(cvar_cal_time)

	}

	

	check_rocket(Player)



	if(pev(Player,pev_button)&IN_ATTACK2)

	{

		attack2(Player)	

	}

	

	if(get_user_weapon(Player) == CSW_KNIFE)

	{

		if(get_pcvar_num(cvar_jetpack) == 1)

		{

			if(!(pev(Player, pev_flags)&FL_ONGROUND) && pev(Player,pev_button)&IN_ATTACK)

			{

				if((g_flyEnergy[Player] > get_pcvar_num(cvar_fly_max_engery)*0.3) && (g_flyEnergy[Player] <= get_pcvar_num(cvar_fly_max_engery)))

				{

					if(jp_soun[Player] < gltime)

					{

						emit_sound( Player, CHAN_ITEM, jetpack_fly, 1.0, ATTN_NORM, 1, PITCH_HIGH )

						jp_soun[Player] = gltime + 1.0

					}

				}			

				else if((g_flyEnergy[Player] > 0) && (g_flyEnergy[Player] < get_pcvar_num(cvar_fly_max_engery)*0.3))

				{

					if(jp_soun[Player] < gltime)

					{

						emit_sound( Player, CHAN_ITEM, jetpack_blow, 1.0, ATTN_NORM, 1, PITCH_HIGH )

						jp_soun[Player] = gltime + 1.0

					}

				}

			}

			human_fly(Player)

			attack(Player)	

		}	

	}

	if((get_pcvar_num(cvar_jetpack) == 2 && !(pev(Player, pev_flags)&FL_ONGROUND)) && (pev(Player,pev_button)&IN_JUMP && pev(Player,pev_button)&IN_DUCK))

	{			

		if((g_flyEnergy[Player] > get_pcvar_num(cvar_fly_max_engery)*0.3) && (g_flyEnergy[Player] <= get_pcvar_num(cvar_fly_max_engery)))

		{

			if(jp_soun[Player] < gltime){

				emit_sound( Player, CHAN_ITEM, jetpack_fly, 1.0, ATTN_NORM, 1, PITCH_HIGH )

				jp_soun[Player] = gltime + 1.0

			}

		}					

		else if((g_flyEnergy[Player] > 0) && (g_flyEnergy[Player] < get_pcvar_num(cvar_fly_max_engery)*0.3))

		{

			if(jp_soun[Player] < gltime)

			{

				emit_sound( Player, CHAN_ITEM, jetpack_blow, 1.0, ATTN_NORM, 1, PITCH_HIGH )

				jp_soun[Player] = gltime + 1.0

			}

		}

		human_fly(Player)

		attack(Player)

	}

	if((g_flyEnergy[Player] >= get_pcvar_num(cvar_fly_max_engery)*0.8) && (g_flyEnergy[Player] <= get_pcvar_num(cvar_fly_max_engery)))

	{

		Icon_Energy({0, 255, 0}, 1, Player); // Green

	}

	else if((g_flyEnergy[Player] >= get_pcvar_num(cvar_fly_max_engery)*0.5) && (g_flyEnergy[Player] < get_pcvar_num(cvar_fly_max_engery)*0.8))

	{

		Icon_Energy({255, 255, 0}, 1, Player); // yellow

	}

	else if((g_flyEnergy[Player] >= get_pcvar_num(cvar_fly_max_engery)*0.3) && (g_flyEnergy[Player] < get_pcvar_num(cvar_fly_max_engery)*0.5))

	{

		Icon_Energy({255, 215, 0}, 2, Player);

	}

	else if((g_flyEnergy[Player] > 0) && (g_flyEnergy[Player] < get_pcvar_num(cvar_fly_max_engery)*0.3))

	{

		Icon_Energy({255, 0, 0}, 1, Player);

	}

	

	return FMRES_IGNORED

}



public jp_energy(Player) 

{

	if (!(pev(Player, pev_flags)&FL_ONGROUND) && pev(Player,pev_button)&IN_ATTACK)	

	{	

		if(get_user_weapon(Player) == CSW_KNIFE)

		{

			if(g_flyEnergy[Player] > get_pcvar_num(cvar_fly_max_engery)*0.09)

				g_flyEnergy[Player] = g_flyEnergy[Player] - get_pcvar_num(cvar_fly_engery);		

		}

	}

	else if ((get_pcvar_num(cvar_jetpack) == 2 && !(pev(Player, pev_flags)&FL_ONGROUND)) && (pev(Player,pev_button)&IN_JUMP && pev(Player,pev_button)&IN_DUCK))

	{

		if(g_flyEnergy[Player] > get_pcvar_num(cvar_fly_max_engery)*0.09)

			g_flyEnergy[Player] = g_flyEnergy[Player] - get_pcvar_num(cvar_fly_engery);	

	}

		

	if (pev(Player, pev_flags) & FL_ONGROUND)	

		g_flyEnergy[Player] = g_flyEnergy[Player] + get_pcvar_num(cvar_regain_energy);

}



public attack(Player) 

{

	if(fly[Player])

	{	

		static Float:JetpackData[3], Origin[3], Float: Speed, Float:JetpackData2[3];



		pev(Player,pev_velocity,JetpackData);



		if(pev(Player,pev_button)&IN_FORWARD && !(pev(Player, pev_flags) & FL_ONGROUND))

		{

			if(!random_num(0,2)){ //asta va reduce si din lag si scade Reliable Channel Overflow

				get_user_origin(Player,Origin);



				message_begin( MSG_BROADCAST, SVC_TEMPENTITY );			

				write_byte( TE_SPRITE );

				write_coord( Origin[ 0 ] );

				write_coord( Origin[ 1 ] );

				write_coord( Origin[ 2 ] );

				write_short( fire );

				write_byte( 8 );

				write_byte( 200 );

				message_end( );

			}



			Speed=floatsqroot(JetpackData[0]*JetpackData[0]+JetpackData[1]*JetpackData[1])

					

			if(Speed!=0.0)

			{

				set_pev(Player,pev_gaitsequence,0)

				set_pev(Player,pev_sequence,111)

			}

			

			if(Speed<get_pcvar_float(cvar_jetpackSpeed))

				Speed+=get_pcvar_float(cvar_jetpackAcrate)



			pev(Player,pev_angles,JetpackData2)

			JetpackData2[2]=0.0

			

			angle_vector(JetpackData2,ANGLEVECTOR_FORWARD,JetpackData2)

			JetpackData2[0]*=Speed

			JetpackData2[1]*=Speed

			

			JetpackData[0]=JetpackData2[0]

			JetpackData[1]=JetpackData2[1]

		}

		

		if(JetpackData[2]<get_pcvar_float(cvar_jetpackSpeed)&&JetpackData[2]>0.0)

			JetpackData[2]+=get_pcvar_float(cvar_jetpackUpSpeed)

		else if(JetpackData[2]<0.0)

			JetpackData[2]+=(get_pcvar_float(cvar_jetpackUpSpeed)*1.15)

		

		set_pev(Player,pev_velocity,JetpackData)

	}

}



public attack2(player) {

		

	if (rocket[player])

	{

		new rocket = create_entity("info_target")

		if(rocket == 0) return PLUGIN_CONTINUE

		

		entity_set_string(rocket, EV_SZ_classname, "zp_jp_rocket")

		entity_set_model(rocket, ROCKET_MDL)

		

		entity_set_size(rocket, Float:{0.0, 0.0, 0.0}, Float:{0.0, 0.0, 0.0})

		entity_set_int(rocket, EV_INT_movetype, MOVETYPE_FLY)

		entity_set_int(rocket, EV_INT_solid, SOLID_BBOX)

		

		new Float:vSrc[3]

		entity_get_vector(player, EV_VEC_origin, vSrc)

		

		new Float:Aim[3],Float:origin[3]

		VelocityByAim(player, 64, Aim)

		entity_get_vector(player,EV_VEC_origin,origin)

		

		vSrc[0] += Aim[0]

		vSrc[1] += Aim[1]

		entity_set_origin(rocket, vSrc)

		

		new Float:velocity[3], Float:angles[3]

		VelocityByAim(player, get_pcvar_num(cvar_RocketSpeed), velocity)

		

		entity_set_vector(rocket, EV_VEC_velocity, velocity)

		vector_to_angle(velocity, angles)

		entity_set_vector(rocket, EV_VEC_angles, angles)

		entity_set_edict(rocket,EV_ENT_owner,player)

		entity_set_float(rocket, EV_FL_takedamage, 1.0)



		set_pev(rocket, pev_effects, EF_LIGHT)

		

		message_begin( MSG_BROADCAST, SVC_TEMPENTITY );

		write_byte( TE_BEAMFOLLOW );

		write_short( rocket );

		write_short( trail );

		write_byte( 25 );

		write_byte( 5 );

		write_byte( 161 );

		write_byte( 161 );

		write_byte( 161 );

		write_byte( random_num( 150, 170 ) );

		message_end( );



		emit_sound(rocket, CHAN_WEAPON, ROCKET_SOUND, 1.0, ATTN_NORM, 0, PITCH_NORM)

		

		shot[player] = true

		last_Rocket[player] = gltime + get_pcvar_num(cvar_RocketDelay)

	}

	return PLUGIN_CONTINUE

}



public check_models(id) 

{

	if (zp_get_user_zombie(id) || zp_get_user_nemesis(id) || zp_get_user_assassin(id) || zp_get_user_survivor(id) || zp_get_user_sniper(id))

		return FMRES_IGNORED

	

	if(hasjet[id]) 

	{

		if(get_user_weapon(id) == CSW_KNIFE) 

		{

			set_pev(id, pev_viewmodel2, "models/v_egon.mdl")

			set_pev(id, pev_weaponmodel2, "models/p_egon.mdl")

		}

		else

		{

			return PLUGIN_CONTINUE

		}

		return PLUGIN_CONTINUE

	}

	return PLUGIN_CONTINUE

}



public remove_jetpacks() 

{

	new nextitem  = find_ent_by_class(-1,"zp_jp_jetpack")

	while(nextitem) 

	{

		remove_entity(nextitem)

		nextitem = find_ent_by_class(-1,"zp_jp_jetpack")

	}

	return PLUGIN_CONTINUE

}



public emitsound(entity, channel, const sample[]) 

{

	if( !( 1 <= entity <= 32 ) )

		return FMRES_IGNORED;

	

	if( !g_bAlive[ entity ] )

		return FMRES_IGNORED;

	

	if(hasjet[entity] && get_user_weapon(entity) == CSW_KNIFE) {

		if(equal(sample,"weapons/knife_slash1.wav")) return FMRES_SUPERCEDE

		if(equal(sample,"weapons/knife_slash2.wav")) return FMRES_SUPERCEDE

		

		if(equal(sample,"weapons/knife_deploy1.wav")) return FMRES_SUPERCEDE

		if(equal(sample,"weapons/knife_hitwall1.wav")) return FMRES_SUPERCEDE

		

		if(equal(sample,"weapons/knife_hit1.wav")) return FMRES_SUPERCEDE

		if(equal(sample,"weapons/knife_hit2.wav")) return FMRES_SUPERCEDE

		if(equal(sample,"weapons/knife_hit3.wav")) return FMRES_SUPERCEDE

		if(equal(sample,"weapons/knife_hit4.wav")) return FMRES_SUPERCEDE

		

		if(equal(sample,"weapons/knife_stab.wav")) return FMRES_SUPERCEDE

	}

	

	return FMRES_IGNORED

}



public Icon_Show(icon[], color[3], mode, Player) 

{

	message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("StatusIcon"), {0,0,0}, Player);

	write_byte(mode); 	// status (0=hide, 1=show, 2=flash)

	write_string(icon); 	// sprite name

	write_byte(color[0]); 	// red

	write_byte(color[1]); 	// green

	write_byte(color[2]); 	// blue

	message_end();



}



public Icon_Energy(color[3], mode, Player) 

{

	

	Icon_Show("item_longjump", color, mode, Player)

}



public human_fly(Player) 

{

	

	if (g_flyEnergy[Player] <= get_pcvar_num(cvar_fly_max_engery)*0.1)

	{

		jp_off(Player);	

	}

	if (g_flyEnergy[Player] > get_pcvar_num(cvar_fly_max_engery)*0.1)

	{

		jp_on(Player);

	}

}



public jp_on(Player) 

	fly[Player] = true



public jp_off(Player) 

	fly[Player] = false



public check_rocket(Player) 

{	

	if (last_Rocket[Player] > gltime)

	{	

		rk_forbidden(Player)

		rksound[Player] = true

	}

	else

	{	

		if (shot[Player])

		{

			rksound[Player] = false

			shot[Player] = false

		}

		rk_sound(Player)

		rk_allow(Player)

	}

}



public rk_allow(Player) 

	rocket[Player] = true



public rk_forbidden(Player) 

	rocket[Player] = false



public rk_sound(Player) {



	if (!rksound[Player])

	{

		engfunc(EngFunc_EmitSound, Player, CHAN_WEAPON, getrocket, 1.0, ATTN_NORM, 0, PITCH_NORM)

		client_print(Player, print_center, "You can shot with Bazooka NOW!")

		rksound[Player] = true

	}

	else if (rksound[Player])

	{

		

	}

}



public player_die() 

{

	new id = read_data(2)

	if(hasjet[id]) 

	{

		drop_jetpack(id)

		hasjet[id] = 0

		rocket[id] = false

		g_flyEnergy[id] = 0

	}

	

	return PLUGIN_CONTINUE

}



public cmdDrop(id) 

{

	if(hasjet[id]) 

	{

		if(get_user_weapon(id) == CSW_KNIFE) 

		{

			drop_jetpack(id)

			if(!zp_get_user_zombie(id))

			{

				entity_set_string(id,EV_SZ_viewmodel,"models/v_knife.mdl")

				entity_set_string(id,EV_SZ_weaponmodel,"models/p_knife.mdl")

			}

			return PLUGIN_HANDLED

		}

	}

	return PLUGIN_CONTINUE

}



public drop_jetpack(Player) 

{

	if(hasjet[Player]) 

	{

		new Float:Aim[3],Float:origin[3]

		VelocityByAim(Player, 64, Aim)

		entity_get_vector(Player,EV_VEC_origin,origin)

		

		origin[0] += Aim[0]

		origin[1] += Aim[1]

		

		new jetpack = create_entity("info_target")

		entity_set_string(jetpack,EV_SZ_classname,"zp_jp_jetpack")

		entity_set_model(jetpack,"models/w_egon.mdl")	

		

		entity_set_size(jetpack,Float:{-16.0,-16.0,-16.0},Float:{16.0,16.0,16.0})

		entity_set_int(jetpack,EV_INT_solid,1)

		

		entity_set_int(jetpack,EV_INT_movetype,6)

		

		entity_set_vector(jetpack,EV_VEC_origin,origin)

		

		Icon_Energy({255, 255, 0}, 0, Player)

		Icon_Energy({128, 128, 0}, 0, Player )

		Icon_Energy({0, 255, 0}, 0, Player)

		

		hasjet[Player] = 0

		rocket[Player] = false

	}	

}



public pfn_touch(ptr, ptd) 

{

	if(is_valid_ent(ptr)) {

		new classname[32]

		entity_get_string(ptr,EV_SZ_classname,classname,31)

		

		if(equal(classname, "zp_jp_jetpack")) 

		{

			if(is_valid_ent(ptd)) 

			{

				new id = ptd

				if(id > 0 && id < 34) 

				{

					if(!hasjet[id] && !zp_get_user_zombie(id) && g_bAlive[id]) 

					{

						hasjet[id] = 1

						g_flyEnergy[id] = get_pcvar_num(cvar_fly_max_engery)

						rocket[id] = true

						client_cmd(id,"spk items/gunpickup2.wav")

						engclient_cmd(id,"weapon_knife")

						remove_entity(ptr)

					}

				}

			}

		}

		else if(equal(classname, "zp_jp_rocket")) 

		{	

			new Float: Origin[ 3 ];

			pev( ptr, pev_origin, Origin );

			jp_radius_damage(ptr)

			

			message_begin( MSG_BROADCAST, SVC_TEMPENTITY );

			write_byte( TE_EXPLOSION );

			write_coord( floatround( Origin[ 0 ] ) );

			write_coord( floatround( Origin[ 1 ] ) );

			write_coord( floatround( Origin[ 2 ] ) );

			write_short( explode );

			write_byte( random_num( 15, 25 ) );

			write_byte( 15 );

			write_byte( 0 );

			message_end( );

				

			message_begin( MSG_BROADCAST, SVC_TEMPENTITY );

			write_byte( TE_BEAMCYLINDER );

			write_coord( floatround( Origin[ 0 ] ) );

			write_coord( floatround( Origin[ 1 ] ) );

			write_coord( floatround( Origin[ 2 ] ) );

			write_coord( floatround( Origin[ 0 ] ) );

			write_coord( floatround( Origin[ 1 ] ) );

			write_coord( floatround( Origin[ 2 ] ) + ( 450 + ( random_num( 0, 3 ) * 100 ) ) );

			write_short( shockwave );

			write_byte( 0 );

			write_byte( 0 );

			write_byte( 4 );

			write_byte( random_num( 0, 3  ) * 40 );

			write_byte( 0 );

			write_byte( 121 );

			write_byte( 121 );

			write_byte( 121 );

			write_byte( random_num( 150, 240 ) );

			write_byte( 0 );

			message_end( );

			

			if(is_valid_ent(ptd)) 

			{

				new classname2[32]

				entity_get_string(ptd,EV_SZ_classname,classname2,31)

				

				if(equal(classname2,"func_breakable"))

					force_use(ptr,ptd)

			}

			

			remove_entity(ptr)

		}

	}

	return PLUGIN_CONTINUE

}



public zp_user_infected_pre(Player, infector)

{

	Icon_Energy({0, 255, 0}, 0, Player);

	cmdDrop(Player);

	hasjet[Player] = 0;

	g_flyEnergy[Player] = 0;

	rocket[Player] = false;

}



public zp_extra_item_selected(Player, itemid)

{

	new szName[ 32 ];

	get_user_name( Player, szName, sizeof ( szName ) -1 );

		

	if (itemid == g_item_jetpack)

	{

		zp_colored_print(0, "^3%s^1 bought^4 JetPack Bazooka^1 !", szName)



		zp_colored_print(Player, "Press ^3CTRL+SPACE^1 to fly!")

		zp_colored_print(Player, "Press ^3RIGHT CLICK^1 to shoot!")



		set_hudmessage( 255, 119, 5, -1.0, 0.80, 1, 0.0, 5.0, 1.0, 1.0, -1 );

		show_hudmessage( 0, "%s bought JetPack Bazooka!", szName );



		hasjet[Player] = 1

		g_flyEnergy[Player] = get_pcvar_num(cvar_fly_max_engery)

		rocket[Player] = true

		client_cmd(Player,"spk items/gunpickup2.wav")

		engclient_cmd(Player,"weapon_knife")

	}

}



stock jp_radius_damage(entity) 

{

	new id = entity_get_edict(entity,EV_ENT_owner)

	new packs,name[32];

	for(new i = 1; i < 33; i++) 

	{

		if(g_bAlive[i]) 

		{

			new dist = floatround(entity_range(entity,i))

			

			if(dist <= get_pcvar_num(cvar_Dmg_range)) 

			{

				new hp = get_user_health(i)

				new Float:damage = get_pcvar_float(cvar_RocketDmg)-(get_pcvar_float(cvar_RocketDmg)/get_pcvar_float(cvar_Dmg_range))*float(dist)

				

				new Origin[3]

				get_user_origin(i,Origin)

				

				if(zp_get_user_zombie(id) != zp_get_user_zombie(i)) 

				{

					get_user_name(i,name,31);

					if(damage>=800)

						packs = 2;

					else

						packs = 1;

							

					if(hp > damage)

					{

						zp_set_user_ammo_packs ( id, zp_get_user_ammo_packs ( id ) + packs );

						jp_take_damage(i,floatround(damage),Origin,DMG_BLAST)

						

						new iPos = ++g_iPlayerPos[id]

						if (iPos == sizeof(g_flCoords))

						{

							iPos = g_iPlayerPos[id] = 0

						}

						set_hudmessage(0, 150, 150, Float:g_flCoords[iPos][0], Float:g_flCoords[iPos][1], 0, 2.0, 1.0, 0.1, 0.1, -1)

						show_hudmessage(id, "%d", floatround(damage))

						zp_colored_print(id, "You make^3 %i^1 damage on^3 %s^1 with Bazooka.", floatround(damage), name);

					}

					else

					{

						log_kill(id,i,"Jetpack Rocket",0)

						zp_colored_print(id, "You killed^3 %s^1 with Bazooka.", name);

					}

				}

			}

		}

	}

}



stock log_kill(killer, victim, weapon[], headshot)

{

	set_msg_block(get_user_msgid("DeathMsg"), BLOCK_SET)

	ExecuteHamB(Ham_Killed, victim, killer, 2) 

	set_msg_block(get_user_msgid("DeathMsg"), BLOCK_NOT)



	

	message_begin(MSG_BROADCAST, get_user_msgid("DeathMsg"))

	write_byte(killer)

	write_byte(victim)

	write_byte(headshot)

	write_string(weapon)

	message_end()

	

	if(get_user_team(killer)!=get_user_team(victim))

		fm_set_user_frags(killer,fm_get_user_frags(killer) +1)

	if(get_user_team(killer)==get_user_team(victim))

		fm_set_user_frags(killer,fm_get_user_frags(killer) -1)

		

	new kname[32], vname[32], kauthid[32], vauthid[32], kteam[10], vteam[10]



	get_user_name(killer, kname, 31)

	get_user_team(killer, kteam, 9)

	get_user_authid(killer, kauthid, 31)

 

	get_user_name(victim, vname, 31)

	get_user_team(victim, vteam, 9)

	get_user_authid(victim, vauthid, 31)

		

	log_message("^"%s<%d><%s><%s>^" killed ^"%s<%d><%s><%s>^" with ^"%s^"", 

	kname, get_user_userid(killer), kauthid, kteam, 

 	vname, get_user_userid(victim), vauthid, vteam, weapon)



 	return PLUGIN_CONTINUE;

}



stock jp_take_damage(victim,damage,origin[3],bit) {

	message_begin(MSG_ONE,get_user_msgid("Damage"),{0,0,0},victim)

	write_byte(21)

	write_byte(20)

	write_long(bit)

	write_coord(origin[0])

	write_coord(origin[1])

	write_coord(origin[2])

	message_end()

	

	fm_set_user_health(victim,fm_get_user_health(victim)-damage)



	client_cmd(victim,"spk fvox/flatline.wav")



	msg_screen_fade(victim, EFFECT_LENGTH, 255, 0, 0, 115);

}



stock msg_screen_fade( id, holdtime, r, g, b, a )

{

        message_begin( MSG_ONE_UNRELIABLE, get_user_msgid( "ScreenFade" ), { 0, 0, 0 }, id );

        write_short( seconds_to_units( holdtime ) );

        write_short( seconds_to_units( holdtime ) );

        write_short( 0 );

        write_byte( r );

        write_byte( g );

        write_byte( b );

        write_byte( a );

        message_end( );

}



stock seconds_to_units( time )

{

        return ( ( 1 << 12 ) * ( time ) )

}  



stock fm_set_user_health(id, health)

{

	health > 0 ? set_pev(id, pev_health, float(health)) : dllfunc(DLLFunc_ClientKill, id)

	

	return 1

}



stock fm_get_user_health(id)

{

	return pev(id, pev_health)

}



stock fm_set_user_frags(id, frags) 

{

	set_pev( id, pev_frags, float(frags))



	return 1

}  



stock fm_get_user_frags(id)

{

	return pev(id, pev_frags)

}
Ali0mer is offline
Send a message via Skype™ to Ali0mer
ghost95v
Senior Member
Join Date: Apr 2014
Location: somewhere in universe
Old 10-10-2017 , 17:21   Re: Need help [zp jetpack]
Reply With Quote #2

Try this

PHP Code:
#include amxmodx

#include engine

#include fakemeta

#include hamsandwich

#include zombie_plague_advance

#include zp50_colorchat



#define PLUGINNAME        "Extra Item Jetpack+Bazooka"

#define VERSION            "3.2"

#define AUTHOR            "B!gBud "



#define TE_EXPLOSION    3

#define TE_BEAMFOLLOW    22

#define TE_BEAMCYLINDER    21



#define JETPACK_COST 30



new ROCKET_MDL[64] = "models/rpgrocket.mdl"

new ROCKET_SOUND[64] = "JetpackBazooka/rocket_fire.wav"

new getrocket[64] = "JetpackBazooka/gun_pickup.wav"

new jetpack_blow[64] = "JetpackBazooka/jetpack_blow.wav"

new jetpack_fly[64] = "JetpackBazooka/jetpack_fly.wav"



new bool:fly[33] = false

new bool:rocket[33] = false

new bool:rksound[33] = false

new bool:shot[33] = false



new Float:gltime 0.0

new Float:last_Rocket[33] = 0.0

new Float:jp_cal[33] = 0.0

new Float:jp_soun[33] = 0.0

new firetrailexplodeshockwave

new g_flyEnergy[33], hasjet[33]

new 
g_iPlayerPos[33]

new 
cvar_jetpackcvar_jetpackSpeedcvar_jetpackUpSpeedcvar_jetpackAcrate ,cvar_RocketDelaycvar_RocketSpeedcvar_RocketDmgcvar_Dmg_rangecvar_fly_max_engerycvar_fly_engerycvar_regain_energyg_item_jetpackcvar_cal_timecvar_oneround



new bool:g_bAlive[33]



new const 
Float:g_flCoords[][] = { {0.500.40}, {0.560.44}, {0.600.50}, {0.560.56},

            {
0.500.60}, {0.440.56}, {0.400.50}, {0.440.44} }



#define EFFECT_LENGTH 3 // timpu cat sa tina efectul



public plugin_init() 

{

    
register_plugin(PLUGINNAMEVERSIONAUTHOR)

    

    
g_item_jetpack zp_register_extra_item("Jetpack+Bazooka"32ZP_TEAM_HUMAN)

    

    
register_clcmd("drop","cmdDrop")

    

    
cvar_jetpack register_cvar("zp_jetpack""2")

    

    
cvar_jetpackSpeed=register_cvar("zp_jp_forward_speed","300.0")

    
cvar_jetpackUpSpeed=register_cvar("zp_jp_up_speed","35.0")

    
cvar_jetpackAcrate=register_cvar("zp_jp_accelerate","100.0")

    

    
cvar_RocketDelay=register_cvar("zp_jp_rocket_delay","15.0")

    
cvar_RocketSpeed=register_cvar("zp_jp_rocket_speed","1500")

    
cvar_RocketDmg=register_cvar("zp_jp_rocket_damage","1500")

    
cvar_Dmg_range=register_cvar("zp_jp_damage_radius","650")

    

    
cvar_fly_max_engery register_cvar("zp_jp_max_engery""100")

    
cvar_fly_engery register_cvar("zp_jp_engery""10")

    
cvar_regain_energy register_cvar("zp_jp_regain_energy""3")

    
cvar_cal_time register_cvar("zp_jp_energy_cal""1.0")

    
cvar_oneround register_cvar("zp_jp_oneround""0")

    

    
register_event("CurWeapon""check_models""be")

    
register_event("DeathMsg""player_die""a")

    
register_event("HLTV""event_round_start""a""1=0""2=0")

    

    
RegisterHamHam_Spawn"player""OnSpawn")

    
RegisterHamHam_Killed"player""OnKilled")

    

    
register_forward(FM_StartFrame"fm_startFrame")

    
register_forward(FM_EmitSound"emitsound")

}



public 
plugin_precache() 

{

    
precache_model("models/p_egon.mdl")

    
precache_model("models/v_egon.mdl")

    
precache_model("models/w_egon.mdl")

    

    
precache_model(ROCKET_MDL)

    
precache_sound(ROCKET_SOUND)

    
precache_sound(getrocket)

    
precache_sound(jetpack_fly)

    
precache_sound(jetpack_blow)

    

    
fire precache_model"sprites/xfireball3.spr" )

    
trail precache_model"sprites/laserbeam.spr" )

    

    
explode precache_model("sprites/zerogxplode.spr"// zeroxplode.spr

    
shockwave precache_model("sprites/shockwave.spr")

}



public 
client_putinserver(id

{
        
client_cmd(id"bind g drop")
    
fly[id] = false

    rocket
[id] = false

    hasjet
[id] = 0

    g_flyEnergy
[id] = 0

}



public 
client_disconnect(id

{

    
g_bAliveid ] = false



    fly
[id] = false

    rocket
[id] = false

    hasjet
[id] = 0

    g_flyEnergy
[id] = 0

}



public 
OnSpawnid )

{

    if( 
is_user_aliveid ) )

        
g_bAliveid ] = true

}



public 
OnKilledid 

    
g_bAliveid ] = false;



public 
event_round_start()

{

    
remove_jetpacks();

    if (
get_pcvar_num(cvar_oneround) == 1

    {

        for (new 
idid <= 32id++) 

        
hasjet[id] = 0g_flyEnergy[id] = 0fly[id] = false;

    }

}



public 
fm_startFrame()

{

    static 
id;

    
gltime get_gametime()

    for (
id 1id <= 32id++)

    {

        
jp_forward(id)

    }

}



public 
jp_forward(Player

{    

    if (!
hasjet[Player]||!g_bAlivePlayer ] || (zp_get_user_zombie(Player) || zp_get_user_nemesis(Player) || zp_get_user_assassin(Player) || zp_get_user_survivor(Player) || zp_get_user_sniper(Player)))

        return 
FMRES_IGNORED     

        

    
if(jp_cal[Player] < gltime)

    {

        
jp_energy(Player); jp_cal[Player] = gltime get_pcvar_float(cvar_cal_time)

    }

    

    
check_rocket(Player)



    if(
pev(Player,pev_button)&IN_ATTACK2)

    {

        
attack2(Player)    

    }

    

    if(
get_user_weapon(Player) == CSW_KNIFE)

    {

        if(
get_pcvar_num(cvar_jetpack) == 1)

        {

            if(!(
pev(Playerpev_flags)&FL_ONGROUND) && pev(Player,pev_button)&IN_ATTACK)

            {

                if((
g_flyEnergy[Player] > get_pcvar_num(cvar_fly_max_engery)*0.3) && (g_flyEnergy[Player] <= get_pcvar_num(cvar_fly_max_engery)))

                {

                    if(
jp_soun[Player] < gltime)

                    {

                        
emit_soundPlayerCHAN_ITEMjetpack_fly1.0ATTN_NORM1PITCH_HIGH )

                        
jp_soun[Player] = gltime 1.0

                    
}

                }            

                else if((
g_flyEnergy[Player] > 0) && (g_flyEnergy[Player] < get_pcvar_num(cvar_fly_max_engery)*0.3))

                {

                    if(
jp_soun[Player] < gltime)

                    {

                        
emit_soundPlayerCHAN_ITEMjetpack_blow1.0ATTN_NORM1PITCH_HIGH )

                        
jp_soun[Player] = gltime 1.0

                    
}

                }

            }

            
human_fly(Player)

            
attack(Player)    

        }    

    }

    if((
get_pcvar_num(cvar_jetpack) == && !(pev(Playerpev_flags)&FL_ONGROUND)) && (pev(Player,pev_button)&IN_JUMP && pev(Player,pev_button)&IN_DUCK))

    {            

        if((
g_flyEnergy[Player] > get_pcvar_num(cvar_fly_max_engery)*0.3) && (g_flyEnergy[Player] <= get_pcvar_num(cvar_fly_max_engery)))

        {

            if(
jp_soun[Player] < gltime){

                
emit_soundPlayerCHAN_ITEMjetpack_fly1.0ATTN_NORM1PITCH_HIGH )

                
jp_soun[Player] = gltime 1.0

            
}

        }                    

        else if((
g_flyEnergy[Player] > 0) && (g_flyEnergy[Player] < get_pcvar_num(cvar_fly_max_engery)*0.3))

        {

            if(
jp_soun[Player] < gltime)

            {

                
emit_soundPlayerCHAN_ITEMjetpack_blow1.0ATTN_NORM1PITCH_HIGH )

                
jp_soun[Player] = gltime 1.0

            
}

        }

        
human_fly(Player)

        
attack(Player)

    }

    if((
g_flyEnergy[Player] >= get_pcvar_num(cvar_fly_max_engery)*0.8) && (g_flyEnergy[Player] <= get_pcvar_num(cvar_fly_max_engery)))

    {

        
Icon_Energy({02550}, 1Player); // Green

    
}

    else if((
g_flyEnergy[Player] >= get_pcvar_num(cvar_fly_max_engery)*0.5) && (g_flyEnergy[Player] < get_pcvar_num(cvar_fly_max_engery)*0.8))

    {

        
Icon_Energy({2552550}, 1Player); // yellow

    
}

    else if((
g_flyEnergy[Player] >= get_pcvar_num(cvar_fly_max_engery)*0.3) && (g_flyEnergy[Player] < get_pcvar_num(cvar_fly_max_engery)*0.5))

    {

        
Icon_Energy({2552150}, 2Player);

    }

    else if((
g_flyEnergy[Player] > 0) && (g_flyEnergy[Player] < get_pcvar_num(cvar_fly_max_engery)*0.3))

    {

        
Icon_Energy({25500}, 1Player);

    }

    

    return 
FMRES_IGNORED

}



public 
jp_energy(Player

{

    if (!(
pev(Playerpev_flags)&FL_ONGROUND) && pev(Player,pev_button)&IN_ATTACK)    

    {    

        if(
get_user_weapon(Player) == CSW_KNIFE)

        {

            if(
g_flyEnergy[Player] > get_pcvar_num(cvar_fly_max_engery)*0.09)

                
g_flyEnergy[Player] = g_flyEnergy[Player] - get_pcvar_num(cvar_fly_engery);        

        }

    }

    else if ((
get_pcvar_num(cvar_jetpack) == && !(pev(Playerpev_flags)&FL_ONGROUND)) && (pev(Player,pev_button)&IN_JUMP && pev(Player,pev_button)&IN_DUCK))

    {

        if(
g_flyEnergy[Player] > get_pcvar_num(cvar_fly_max_engery)*0.09)

            
g_flyEnergy[Player] = g_flyEnergy[Player] - get_pcvar_num(cvar_fly_engery);    

    }

        

    if (
pev(Playerpev_flags) & FL_ONGROUND)    

        
g_flyEnergy[Player] = g_flyEnergy[Player] + get_pcvar_num(cvar_regain_energy);

}



public 
attack(Player

{

    if(
fly[Player])

    {    

        static 
Float:JetpackData[3], Origin[3], FloatSpeedFloat:JetpackData2[3];



        
pev(Player,pev_velocity,JetpackData);



        if(
pev(Player,pev_button)&IN_FORWARD && !(pev(Playerpev_flags) & FL_ONGROUND))

        {

            if(!
random_num(0,2)){ //asta va reduce si din lag si scade Reliable Channel Overflow

                
get_user_origin(Player,Origin);



                
message_beginMSG_BROADCASTSVC_TEMPENTITY );            

                
write_byteTE_SPRITE );

                
write_coordOrigin] );

                
write_coordOrigin] );

                
write_coordOrigin] );

                
write_shortfire );

                
write_byte);

                
write_byte200 );

                
message_end( );

            }



            
Speed=floatsqroot(JetpackData[0]*JetpackData[0]+JetpackData[1]*JetpackData[1])

                    

            if(
Speed!=0.0)

            {

                
set_pev(Player,pev_gaitsequence,0)

                
set_pev(Player,pev_sequence,111)

            }

            

            if(
Speed<get_pcvar_float(cvar_jetpackSpeed))

                
Speed+=get_pcvar_float(cvar_jetpackAcrate)



            
pev(Player,pev_angles,JetpackData2)

            
JetpackData2[2]=0.0

            

            angle_vector
(JetpackData2,ANGLEVECTOR_FORWARD,JetpackData2)

            
JetpackData2[0]*=Speed

            JetpackData2
[1]*=Speed

            

            JetpackData
[0]=JetpackData2[0]

            
JetpackData[1]=JetpackData2[1]

        }

        

        if(
JetpackData[2]<get_pcvar_float(cvar_jetpackSpeed)&&JetpackData[2]>0.0)

            
JetpackData[2]+=get_pcvar_float(cvar_jetpackUpSpeed)

        else if(
JetpackData[2]<0.0)

            
JetpackData[2]+=(get_pcvar_float(cvar_jetpackUpSpeed)*1.15)

        

        
set_pev(Player,pev_velocity,JetpackData)

    }

}



public 
attack2(player) {

        

    if (
rocket[player])

    {

        new 
rocket create_entity("info_target")

        if(
rocket == 0) return PLUGIN_CONTINUE

        

        entity_set_string
(rocketEV_SZ_classname"zp_jp_rocket")

        
entity_set_model(rocketROCKET_MDL)

        

        
entity_set_size(rocketFloat:{0.00.00.0}, Float:{0.00.00.0})

        
entity_set_int(rocketEV_INT_movetypeMOVETYPE_FLY)

        
entity_set_int(rocketEV_INT_solidSOLID_BBOX)

        

        new 
Float:vSrc[3]

        
entity_get_vector(playerEV_VEC_originvSrc)

        

        new 
Float:Aim[3],Float:origin[3]

        
VelocityByAim(player64Aim)

        
entity_get_vector(player,EV_VEC_origin,origin)

        

        
vSrc[0] += Aim[0]

        
vSrc[1] += Aim[1]

        
entity_set_origin(rocketvSrc)

        

        new 
Float:velocity[3], Float:angles[3]

        
VelocityByAim(playerget_pcvar_num(cvar_RocketSpeed), velocity)

        

        
entity_set_vector(rocketEV_VEC_velocityvelocity)

        
vector_to_angle(velocityangles)

        
entity_set_vector(rocketEV_VEC_anglesangles)

        
entity_set_edict(rocket,EV_ENT_owner,player)

        
entity_set_float(rocketEV_FL_takedamage1.0)



        
set_pev(rocketpev_effectsEF_LIGHT)

        

        
message_beginMSG_BROADCASTSVC_TEMPENTITY );

        
write_byteTE_BEAMFOLLOW );

        
write_shortrocket );

        
write_shorttrail );

        
write_byte25 );

        
write_byte);

        
write_byte161 );

        
write_byte161 );

        
write_byte161 );

        
write_byterandom_num150170 ) );

        
message_end( );



        
emit_sound(rocketCHAN_WEAPONROCKET_SOUND1.0ATTN_NORM0PITCH_NORM)

        

        
shot[player] = true

        last_Rocket
[player] = gltime get_pcvar_num(cvar_RocketDelay)

    }

    return 
PLUGIN_CONTINUE

}



public 
check_models(id

{

    if (
zp_get_user_zombie(id) || zp_get_user_nemesis(id) || zp_get_user_assassin(id) || zp_get_user_survivor(id) || zp_get_user_sniper(id))

        return 
FMRES_IGNORED

    

    
if(hasjet[id]) 

    {

        if(
get_user_weapon(id) == CSW_KNIFE

        {

            
set_pev(idpev_viewmodel2"models/v_egon.mdl")

            
set_pev(idpev_weaponmodel2"models/p_egon.mdl")

        }

        else

        {

            return 
PLUGIN_CONTINUE

        
}

        return 
PLUGIN_CONTINUE

    
}

    return 
PLUGIN_CONTINUE

}



public 
remove_jetpacks() 

{

    new 
nextitem  find_ent_by_class(-1,"zp_jp_jetpack")

    while(
nextitem

    {

        
remove_entity(nextitem)

        
nextitem find_ent_by_class(-1,"zp_jp_jetpack")

    }

    return 
PLUGIN_CONTINUE

}



public 
emitsound(entitychannel, const sample[]) 

{

    if( !( 
<= entity <= 32 ) )

        return 
FMRES_IGNORED;

    

    if( !
g_bAliveentity ] )

        return 
FMRES_IGNORED;

    

    if(
hasjet[entity] && get_user_weapon(entity) == CSW_KNIFE) {

        if(
equal(sample,"weapons/knife_slash1.wav")) return FMRES_SUPERCEDE

        
if(equal(sample,"weapons/knife_slash2.wav")) return FMRES_SUPERCEDE

        

        
if(equal(sample,"weapons/knife_deploy1.wav")) return FMRES_SUPERCEDE

        
if(equal(sample,"weapons/knife_hitwall1.wav")) return FMRES_SUPERCEDE

        

        
if(equal(sample,"weapons/knife_hit1.wav")) return FMRES_SUPERCEDE

        
if(equal(sample,"weapons/knife_hit2.wav")) return FMRES_SUPERCEDE

        
if(equal(sample,"weapons/knife_hit3.wav")) return FMRES_SUPERCEDE

        
if(equal(sample,"weapons/knife_hit4.wav")) return FMRES_SUPERCEDE

        

        
if(equal(sample,"weapons/knife_stab.wav")) return FMRES_SUPERCEDE

    
}

    

    return 
FMRES_IGNORED

}



public 
Icon_Show(icon[], color[3], modePlayer

{

    
message_begin(MSG_ONE_UNRELIABLEget_user_msgid("StatusIcon"), {0,0,0}, Player);

    
write_byte(mode);     // status (0=hide, 1=show, 2=flash)

    
write_string(icon);     // sprite name

    
write_byte(color[0]);     // red

    
write_byte(color[1]);     // green

    
write_byte(color[2]);     // blue

    
message_end();



}



public 
Icon_Energy(color[3], modePlayer

{

    

    
Icon_Show("item_longjump"colormodePlayer)

}



public 
human_fly(Player

{

    

    if (
g_flyEnergy[Player] <= get_pcvar_num(cvar_fly_max_engery)*0.1)

    {

        
jp_off(Player);    

    }

    if (
g_flyEnergy[Player] > get_pcvar_num(cvar_fly_max_engery)*0.1)

    {

        
jp_on(Player);

    }

}



public 
jp_on(Player

    
fly[Player] = true



public jp_off(Player

    
fly[Player] = false



public check_rocket(Player

{    

    if (
last_Rocket[Player] > gltime)

    {    

        
rk_forbidden(Player)

        
rksound[Player] = true

    
}

    else

    {    

        if (
shot[Player])

        {

            
rksound[Player] = false

            shot
[Player] = false

        
}

        
rk_sound(Player)

        
rk_allow(Player)

    }

}



public 
rk_allow(Player

    
rocket[Player] = true



public rk_forbidden(Player

    
rocket[Player] = false



public rk_sound(Player) {



    if (!
rksound[Player])

    {

        
engfunc(EngFunc_EmitSoundPlayerCHAN_WEAPONgetrocket1.0ATTN_NORM0PITCH_NORM)

        
client_print(Playerprint_center"You can shot with Bazooka NOW!")

        
rksound[Player] = true

    
}

    else if (
rksound[Player])

    {

        

    }

}



public 
player_die() 

{

    new 
id read_data(2)

    if(
hasjet[id]) 

    {

        
drop_jetpack(id)

        
hasjet[id] = 0

        rocket
[id] = false

        g_flyEnergy
[id] = 0

    
}

    

    return 
PLUGIN_CONTINUE

}



public 
cmdDrop(id

{

    if(
hasjet[id]) 

    {

        if(
get_user_weapon(id) == CSW_KNIFE

        {

            
drop_jetpack(id)

            if(!
zp_get_user_zombie(id))

            {

                
entity_set_string(id,EV_SZ_viewmodel,"models/v_knife.mdl")

                
entity_set_string(id,EV_SZ_weaponmodel,"models/p_knife.mdl")

            }

            return 
PLUGIN_HANDLED

        
}

    }

    return 
PLUGIN_CONTINUE

}



public 
drop_jetpack(Player

{

    if(
hasjet[Player]) 

    {

        new 
Float:Aim[3],Float:origin[3]

        
VelocityByAim(Player64Aim)

        
entity_get_vector(Player,EV_VEC_origin,origin)

        

        
origin[0] += Aim[0]

        
origin[1] += Aim[1]

        

        new 
jetpack create_entity("info_target")

        
entity_set_string(jetpack,EV_SZ_classname,"zp_jp_jetpack")

        
entity_set_model(jetpack,"models/w_egon.mdl")    

        

        
entity_set_size(jetpack,Float:{-16.0,-16.0,-16.0},Float:{16.0,16.0,16.0})

        
entity_set_int(jetpack,EV_INT_solid,1)

        

        
entity_set_int(jetpack,EV_INT_movetype,6)

        

        
entity_set_vector(jetpack,EV_VEC_origin,origin)

        

        
Icon_Energy({2552550}, 0Player)

        
Icon_Energy({1281280}, 0Player )

        
Icon_Energy({02550}, 0Player)

        

        
hasjet[Player] = 0

        rocket
[Player] = false

    
}    

}



public 
pfn_touch(ptrptd

{

    if(
is_valid_ent(ptr)) {

        new 
classname[32]

        
entity_get_string(ptr,EV_SZ_classname,classname,31)

        

        if(
equal(classname"zp_jp_jetpack")) 

        {

            if(
is_valid_ent(ptd)) 

            {

                new 
id ptd

                
if(id && id 34

                {

                    if(!
hasjet[id] && !zp_get_user_zombie(id) && g_bAlive[id]) 

                    {

                        
hasjet[id] = 1

                        g_flyEnergy
[id] = get_pcvar_num(cvar_fly_max_engery)

                        
rocket[id] = true

                        client_cmd
(id,"spk items/gunpickup2.wav")

                        
engclient_cmd(id,"weapon_knife")

                        
remove_entity(ptr)

                    }

                }

            }

        }

        else if(
equal(classname"zp_jp_rocket")) 

        {    

            new 
FloatOrigin];

            
pevptrpev_originOrigin );

            
jp_radius_damage(ptr)

            

            
message_beginMSG_BROADCASTSVC_TEMPENTITY );

            
write_byteTE_EXPLOSION );

            
write_coordfloatroundOrigin] ) );

            
write_coordfloatroundOrigin] ) );

            
write_coordfloatroundOrigin] ) );

            
write_shortexplode );

            
write_byterandom_num1525 ) );

            
write_byte15 );

            
write_byte);

            
message_end( );

                

            
message_beginMSG_BROADCASTSVC_TEMPENTITY );

            
write_byteTE_BEAMCYLINDER );

            
write_coordfloatroundOrigin] ) );

            
write_coordfloatroundOrigin] ) );

            
write_coordfloatroundOrigin] ) );

            
write_coordfloatroundOrigin] ) );

            
write_coordfloatroundOrigin] ) );

            
write_coordfloatroundOrigin] ) + ( 450 + ( random_num0) * 100 ) ) );

            
write_shortshockwave );

            
write_byte);

            
write_byte);

            
write_byte);

            
write_byterandom_num03  ) * 40 );

            
write_byte);

            
write_byte121 );

            
write_byte121 );

            
write_byte121 );

            
write_byterandom_num150240 ) );

            
write_byte);

            
message_end( );

            

            if(
is_valid_ent(ptd)) 

            {

                new 
classname2[32]

                
entity_get_string(ptd,EV_SZ_classname,classname2,31)

                

                if(
equal(classname2,"func_breakable"))

                    
force_use(ptr,ptd)

            }

            

            
remove_entity(ptr)

        }

    }

    return 
PLUGIN_CONTINUE

}



public 
zp_user_infected_pre(Playerinfector)

{

    
Icon_Energy({02550}, 0Player);

    
cmdDrop(Player);

    
hasjet[Player] = 0;

    
g_flyEnergy[Player] = 0;

    
rocket[Player] = false;

}



public 
zp_extra_item_selected(Playeritemid)

{

    new 
szName32 ];

    
get_user_namePlayerszNamesizeof szName ) -);

        

    if (
itemid == g_item_jetpack)

    {

        
zp_colored_print(0"^3%s^1 bought^4 JetPack Bazooka^1 !"szName)



        
zp_colored_print(Player"Press ^3CTRL+SPACE^1 to fly!")

        
zp_colored_print(Player"Press ^3RIGHT CLICK^1 to shoot!")



        
set_hudmessage2551195, -1.00.8010.05.01.01.0, -);

        
show_hudmessage0"%s bought JetPack Bazooka!"szName );



        
hasjet[Player] = 1

        g_flyEnergy
[Player] = get_pcvar_num(cvar_fly_max_engery)

        
rocket[Player] = true

        client_cmd
(Player,"spk items/gunpickup2.wav")

        
engclient_cmd(Player,"weapon_knife")

    }

}



stock jp_radius_damage(entity

{

    new 
id entity_get_edict(entity,EV_ENT_owner)

    new 
packs,name[32];

    for(new 
133i++) 

    {

        if(
g_bAlive[i]) 

        {

            new 
dist floatround(entity_range(entity,i))

            

            if(
dist <= get_pcvar_num(cvar_Dmg_range)) 

            {

                new 
hp get_user_health(i)

                new 
Float:damage get_pcvar_float(cvar_RocketDmg)-(get_pcvar_float(cvar_RocketDmg)/get_pcvar_float(cvar_Dmg_range))*float(dist)

                

                new 
Origin[3]

                
get_user_origin(i,Origin)

                

                if(
zp_get_user_zombie(id) != zp_get_user_zombie(i)) 

                {

                    
get_user_name(i,name,31);

                    if(
damage>=800)

                        
packs 2;

                    else

                        
packs 1;

                            

                    if(
hp damage)

                    {

                        
zp_set_user_ammo_packs idzp_get_user_ammo_packs id ) + packs );

                        
jp_take_damage(i,floatround(damage),Origin,DMG_BLAST)

                        

                        new 
iPos = ++g_iPlayerPos[id]

                        if (
iPos == sizeof(g_flCoords))

                        {

                            
iPos g_iPlayerPos[id] = 0

                        
}

                        
set_hudmessage(0150150Float:g_flCoords[iPos][0], Float:g_flCoords[iPos][1], 02.01.00.10.1, -1)

                        
show_hudmessage(id"%d"floatround(damage))

                        
zp_colored_print(id"You make^3 %i^1 damage on^3 %s^1 with Bazooka."floatround(damage), name);

                    }

                    else

                    {

                        
log_kill(id,i,"Jetpack Rocket",0)

                        
zp_colored_print(id"You killed^3 %s^1 with Bazooka."name);

                    }

                }

            }

        }

    }

}



stock log_kill(killervictimweapon[], headshot)

{

    
set_msg_block(get_user_msgid("DeathMsg"), BLOCK_SET)

    
ExecuteHamB(Ham_Killedvictimkiller2

    
set_msg_block(get_user_msgid("DeathMsg"), BLOCK_NOT)



    

    
message_begin(MSG_BROADCASTget_user_msgid("DeathMsg"))

    
write_byte(killer)

    
write_byte(victim)

    
write_byte(headshot)

    
write_string(weapon)

    
message_end()

    

    if(
get_user_team(killer)!=get_user_team(victim))

        
fm_set_user_frags(killer,fm_get_user_frags(killer) +1)

    if(
get_user_team(killer)==get_user_team(victim))

        
fm_set_user_frags(killer,fm_get_user_frags(killer) -1)

        

    new 
kname[32], vname[32], kauthid[32], vauthid[32], kteam[10], vteam[10]



    
get_user_name(killerkname31)

    
get_user_team(killerkteam9)

    
get_user_authid(killerkauthid31)

 

    
get_user_name(victimvname31)

    
get_user_team(victimvteam9)

    
get_user_authid(victimvauthid31)

        

    
log_message("^"%s<%d><%s><%s>^" killed ^"%s<%d><%s><%s>^" with ^"%s^""

    
knameget_user_userid(killer), kauthidkteam

     
vnameget_user_userid(victim), vauthidvteamweapon)



     return 
PLUGIN_CONTINUE;

}



stock jp_take_damage(victim,damage,origin[3],bit) {

    
message_begin(MSG_ONE,get_user_msgid("Damage"),{0,0,0},victim)

    
write_byte(21)

    
write_byte(20)

    
write_long(bit)

    
write_coord(origin[0])

    
write_coord(origin[1])

    
write_coord(origin[2])

    
message_end()

    

    
fm_set_user_health(victim,fm_get_user_health(victim)-damage)



    
client_cmd(victim,"spk fvox/flatline.wav")



    
msg_screen_fade(victimEFFECT_LENGTH25500115);

}



stock msg_screen_fadeidholdtimergb)

{

        
message_beginMSG_ONE_UNRELIABLEget_user_msgid"ScreenFade" ), { 00}, id );

        
write_shortseconds_to_unitsholdtime ) );

        
write_shortseconds_to_unitsholdtime ) );

        
write_short);

        
write_byte);

        
write_byte);

        
write_byte);

        
write_byte);

        
message_end( );

}



stock seconds_to_unitstime )

{

        return ( ( 
<< 12 ) * ( time ) )

}  



stock fm_set_user_health(idhealth)

{

    
health set_pev(idpev_healthfloat(health)) : dllfunc(DLLFunc_ClientKillid)

    

    return 
1

}



stock fm_get_user_health(id)

{

    return 
pev(idpev_health)

}



stock fm_set_user_frags(idfrags

{

    
set_pevidpev_fragsfloat(frags))



    return 
1

}  



stock fm_get_user_frags(id)

{

    return 
pev(idpev_frags)


__________________
ghost95v is offline
Send a message via Skype™ to ghost95v
Ali0mer
Member
Join Date: Jan 2016
Location: Iraq
Old 10-10-2017 , 17:31   Re: Need help [zp jetpack]
Reply With Quote #3

Its Still cant be dropped when i press G
Not like other jetpacks...
Ali0mer is offline
Send a message via Skype™ to Ali0mer
ghost95v
Senior Member
Join Date: Apr 2014
Location: somewhere in universe
Old 10-11-2017 , 04:03   Re: Need help [zp jetpack]
Reply With Quote #4

Show you list of plugins running ?

Also try this

PHP Code:
#include amxmodx 

#include engine 

#include fakemeta 

#include hamsandwich 

#include zombie_plague_advance 

#include zp50_colorchat 



#define PLUGINNAME        "Extra Item Jetpack+Bazooka" 

#define VERSION            "3.2" 

#define AUTHOR            "B!gBud " 



#define TE_EXPLOSION    3 

#define TE_BEAMFOLLOW    22 

#define TE_BEAMCYLINDER    21 



#define JETPACK_COST 30 



new ROCKET_MDL[64] = "models/rpgrocket.mdl" 

new ROCKET_SOUND[64] = "JetpackBazooka/rocket_fire.wav" 

new getrocket[64] = "JetpackBazooka/gun_pickup.wav" 

new jetpack_blow[64] = "JetpackBazooka/jetpack_blow.wav" 

new jetpack_fly[64] = "JetpackBazooka/jetpack_fly.wav" 



new bool:fly[33] = false 

new bool:rocket[33] = false 

new bool:rksound[33] = false 

new bool:shot[33] = false 



new Float:gltime 0.0 

new Float:last_Rocket[33] = 0.0 

new Float:jp_cal[33] = 0.0 

new Float:jp_soun[33] = 0.0 

new firetrailexplodeshockwave 

new g_flyEnergy[33], hasjet[33

new 
g_iPlayerPos[33

new 
cvar_jetpackcvar_jetpackSpeedcvar_jetpackUpSpeedcvar_jetpackAcrate ,cvar_RocketDelaycvar_RocketSpeedcvar_RocketDmgcvar_Dmg_rangecvar_fly_max_engerycvar_fly_engerycvar_regain_energyg_item_jetpackcvar_cal_timecvar_oneround 



new bool:g_bAlive[33



new const 
Float:g_flCoords[][] = { {0.500.40}, {0.560.44}, {0.600.50}, {0.560.56}, 

            {
0.500.60}, {0.440.56}, {0.400.50}, {0.440.44} } 



#define EFFECT_LENGTH 3 // timpu cat sa tina efectul 



public plugin_init()  



    
register_plugin(PLUGINNAMEVERSIONAUTHOR

     

    
g_item_jetpack zp_register_extra_item("Jetpack+Bazooka"32ZP_TEAM_HUMAN

     

    
register_clcmd("drop","cmdDrop"

     

    
cvar_jetpack register_cvar("zp_jetpack""2"

     

    
cvar_jetpackSpeed=register_cvar("zp_jp_forward_speed","300.0"

    
cvar_jetpackUpSpeed=register_cvar("zp_jp_up_speed","35.0"

    
cvar_jetpackAcrate=register_cvar("zp_jp_accelerate","100.0"

     

    
cvar_RocketDelay=register_cvar("zp_jp_rocket_delay","15.0"

    
cvar_RocketSpeed=register_cvar("zp_jp_rocket_speed","1500"

    
cvar_RocketDmg=register_cvar("zp_jp_rocket_damage","1500"

    
cvar_Dmg_range=register_cvar("zp_jp_damage_radius","650"

     

    
cvar_fly_max_engery register_cvar("zp_jp_max_engery""100"

    
cvar_fly_engery register_cvar("zp_jp_engery""10"

    
cvar_regain_energy register_cvar("zp_jp_regain_energy""3"

    
cvar_cal_time register_cvar("zp_jp_energy_cal""1.0"

    
cvar_oneround register_cvar("zp_jp_oneround""0"

     

    
register_event("CurWeapon""check_models""be"

    
register_event("DeathMsg""player_die""a"

    
register_event("HLTV""event_round_start""a""1=0""2=0"

     

    
RegisterHamHam_Spawn"player""OnSpawn"

    
RegisterHamHam_Killed"player""OnKilled"

     

    
register_forward(FM_StartFrame"fm_startFrame"

    
register_forward(FM_EmitSound"emitsound"





public 
plugin_precache()  



    
precache_model("models/p_egon.mdl"

    
precache_model("models/v_egon.mdl"

    
precache_model("models/w_egon.mdl"

     

    
precache_model(ROCKET_MDL

    
precache_sound(ROCKET_SOUND

    
precache_sound(getrocket

    
precache_sound(jetpack_fly

    
precache_sound(jetpack_blow

     

    
fire precache_model"sprites/xfireball3.spr" 

    
trail precache_model"sprites/laserbeam.spr" 

     

    
explode precache_model("sprites/zerogxplode.spr"// zeroxplode.spr 

    
shockwave precache_model("sprites/shockwave.spr"





public 
client_putinserver(id)  


        
client_cmd(id"bind g drop"
    
fly[id] = false 

    rocket
[id] = false 

    hasjet
[id] = 

    g_flyEnergy
[id] = 





public 
client_disconnect(id)  



    
g_bAliveid ] = false 



    fly
[id] = false 

    rocket
[id] = false 

    hasjet
[id] = 

    g_flyEnergy
[id] = 





public 
OnSpawnid 



    if( 
is_user_aliveid ) ) 

        
g_bAliveid ] = true 





public 
OnKilledid )  

    
g_bAliveid ] = false



public 
event_round_start() 



    
remove_jetpacks(); 

    if (
get_pcvar_num(cvar_oneround) == 1)  

    { 

        for (new 
idid <= 32id++)  

        
hasjet[id] = 0g_flyEnergy[id] = 0fly[id] = false

    } 





public 
fm_startFrame() 



    static 
id

    
gltime get_gametime() 

    for (
id 1id <= 32id++) 

    { 

        
jp_forward(id

    } 





public 
jp_forward(Player)  

{     

    if (!
hasjet[Player]||!g_bAlivePlayer ] || (zp_get_user_zombie(Player) || zp_get_user_nemesis(Player) || zp_get_user_assassin(Player) || zp_get_user_survivor(Player) || zp_get_user_sniper(Player))) 

        return 
FMRES_IGNORED      

         

    
if(jp_cal[Player] < gltime

    { 

        
jp_energy(Player); jp_cal[Player] = gltime get_pcvar_float(cvar_cal_time

    } 

     

    
check_rocket(Player



    if(
pev(Player,pev_button)&IN_ATTACK2

    { 

        
attack2(Player)     

    } 

     

    if(
get_user_weapon(Player) == CSW_KNIFE

    { 

        if(
get_pcvar_num(cvar_jetpack) == 1

        { 

            if(!(
pev(Playerpev_flags)&FL_ONGROUND) && pev(Player,pev_button)&IN_ATTACK

            { 

                if((
g_flyEnergy[Player] > get_pcvar_num(cvar_fly_max_engery)*0.3) && (g_flyEnergy[Player] <= get_pcvar_num(cvar_fly_max_engery))) 

                { 

                    if(
jp_soun[Player] < gltime

                    { 

                        
emit_soundPlayerCHAN_ITEMjetpack_fly1.0ATTN_NORM1PITCH_HIGH 

                        
jp_soun[Player] = gltime 1.0 

                    


                }             

                else if((
g_flyEnergy[Player] > 0) && (g_flyEnergy[Player] < get_pcvar_num(cvar_fly_max_engery)*0.3)) 

                { 

                    if(
jp_soun[Player] < gltime

                    { 

                        
emit_soundPlayerCHAN_ITEMjetpack_blow1.0ATTN_NORM1PITCH_HIGH 

                        
jp_soun[Player] = gltime 1.0 

                    


                } 

            } 

            
human_fly(Player

            
attack(Player)     

        }     

    } 

    if((
get_pcvar_num(cvar_jetpack) == && !(pev(Playerpev_flags)&FL_ONGROUND)) && (pev(Player,pev_button)&IN_JUMP && pev(Player,pev_button)&IN_DUCK)) 

    {             

        if((
g_flyEnergy[Player] > get_pcvar_num(cvar_fly_max_engery)*0.3) && (g_flyEnergy[Player] <= get_pcvar_num(cvar_fly_max_engery))) 

        { 

            if(
jp_soun[Player] < gltime){ 

                
emit_soundPlayerCHAN_ITEMjetpack_fly1.0ATTN_NORM1PITCH_HIGH 

                
jp_soun[Player] = gltime 1.0 

            


        }                     

        else if((
g_flyEnergy[Player] > 0) && (g_flyEnergy[Player] < get_pcvar_num(cvar_fly_max_engery)*0.3)) 

        { 

            if(
jp_soun[Player] < gltime

            { 

                
emit_soundPlayerCHAN_ITEMjetpack_blow1.0ATTN_NORM1PITCH_HIGH 

                
jp_soun[Player] = gltime 1.0 

            


        } 

        
human_fly(Player

        
attack(Player

    } 

    if((
g_flyEnergy[Player] >= get_pcvar_num(cvar_fly_max_engery)*0.8) && (g_flyEnergy[Player] <= get_pcvar_num(cvar_fly_max_engery))) 

    { 

        
Icon_Energy({02550}, 1Player); // Green 

    


    else if((
g_flyEnergy[Player] >= get_pcvar_num(cvar_fly_max_engery)*0.5) && (g_flyEnergy[Player] < get_pcvar_num(cvar_fly_max_engery)*0.8)) 

    { 

        
Icon_Energy({2552550}, 1Player); // yellow 

    


    else if((
g_flyEnergy[Player] >= get_pcvar_num(cvar_fly_max_engery)*0.3) && (g_flyEnergy[Player] < get_pcvar_num(cvar_fly_max_engery)*0.5)) 

    { 

        
Icon_Energy({2552150}, 2Player); 

    } 

    else if((
g_flyEnergy[Player] > 0) && (g_flyEnergy[Player] < get_pcvar_num(cvar_fly_max_engery)*0.3)) 

    { 

        
Icon_Energy({25500}, 1Player); 

    } 

     

    return 
FMRES_IGNORED 





public 
jp_energy(Player)  



    if (!(
pev(Playerpev_flags)&FL_ONGROUND) && pev(Player,pev_button)&IN_ATTACK)     

    {     

        if(
get_user_weapon(Player) == CSW_KNIFE

        { 

            if(
g_flyEnergy[Player] > get_pcvar_num(cvar_fly_max_engery)*0.09

                
g_flyEnergy[Player] = g_flyEnergy[Player] - get_pcvar_num(cvar_fly_engery);         

        } 

    } 

    else if ((
get_pcvar_num(cvar_jetpack) == && !(pev(Playerpev_flags)&FL_ONGROUND)) && (pev(Player,pev_button)&IN_JUMP && pev(Player,pev_button)&IN_DUCK)) 

    { 

        if(
g_flyEnergy[Player] > get_pcvar_num(cvar_fly_max_engery)*0.09

            
g_flyEnergy[Player] = g_flyEnergy[Player] - get_pcvar_num(cvar_fly_engery);     

    } 

         

    if (
pev(Playerpev_flags) & FL_ONGROUND)     

        
g_flyEnergy[Player] = g_flyEnergy[Player] + get_pcvar_num(cvar_regain_energy); 





public 
attack(Player)  



    if(
fly[Player]) 

    {     

        static 
Float:JetpackData[3], Origin[3], FloatSpeedFloat:JetpackData2[3]; 



        
pev(Player,pev_velocity,JetpackData); 



        if(
pev(Player,pev_button)&IN_FORWARD && !(pev(Playerpev_flags) & FL_ONGROUND)) 

        { 

            if(!
random_num(0,2)){ //asta va reduce si din lag si scade Reliable Channel Overflow 

                
get_user_origin(Player,Origin); 



                
message_beginMSG_BROADCASTSVC_TEMPENTITY );             

                
write_byteTE_SPRITE ); 

                
write_coordOrigin] ); 

                
write_coordOrigin] ); 

                
write_coordOrigin] ); 

                
write_shortfire ); 

                
write_byte); 

                
write_byte200 ); 

                
message_end( ); 

            } 



            
Speed=floatsqroot(JetpackData[0]*JetpackData[0]+JetpackData[1]*JetpackData[1]) 

                     

            if(
Speed!=0.0

            { 

                
set_pev(Player,pev_gaitsequence,0

                
set_pev(Player,pev_sequence,111

            } 

             

            if(
Speed<get_pcvar_float(cvar_jetpackSpeed)) 

                
Speed+=get_pcvar_float(cvar_jetpackAcrate



            
pev(Player,pev_angles,JetpackData2

            
JetpackData2[2]=0.0 

             

            angle_vector
(JetpackData2,ANGLEVECTOR_FORWARD,JetpackData2

            
JetpackData2[0]*=Speed 

            JetpackData2
[1]*=Speed 

             

            JetpackData
[0]=JetpackData2[0

            
JetpackData[1]=JetpackData2[1

        } 

         

        if(
JetpackData[2]<get_pcvar_float(cvar_jetpackSpeed)&&JetpackData[2]>0.0

            
JetpackData[2]+=get_pcvar_float(cvar_jetpackUpSpeed

        else if(
JetpackData[2]<0.0

            
JetpackData[2]+=(get_pcvar_float(cvar_jetpackUpSpeed)*1.15

         

        
set_pev(Player,pev_velocity,JetpackData

    } 





public 
attack2(player) { 

         

    if (
rocket[player]) 

    { 

        new 
rocket create_entity("info_target"

        if(
rocket == 0) return PLUGIN_CONTINUE 

         

        entity_set_string
(rocketEV_SZ_classname"zp_jp_rocket"

        
entity_set_model(rocketROCKET_MDL

         

        
entity_set_size(rocketFloat:{0.00.00.0}, Float:{0.00.00.0}) 

        
entity_set_int(rocketEV_INT_movetypeMOVETYPE_FLY

        
entity_set_int(rocketEV_INT_solidSOLID_BBOX

         

        new 
Float:vSrc[3

        
entity_get_vector(playerEV_VEC_originvSrc

         

        new 
Float:Aim[3],Float:origin[3

        
VelocityByAim(player64Aim

        
entity_get_vector(player,EV_VEC_origin,origin

         

        
vSrc[0] += Aim[0

        
vSrc[1] += Aim[1

        
entity_set_origin(rocketvSrc

         

        new 
Float:velocity[3], Float:angles[3

        
VelocityByAim(playerget_pcvar_num(cvar_RocketSpeed), velocity

         

        
entity_set_vector(rocketEV_VEC_velocityvelocity

        
vector_to_angle(velocityangles

        
entity_set_vector(rocketEV_VEC_anglesangles

        
entity_set_edict(rocket,EV_ENT_owner,player

        
entity_set_float(rocketEV_FL_takedamage1.0



        
set_pev(rocketpev_effectsEF_LIGHT

         

        
message_beginMSG_BROADCASTSVC_TEMPENTITY ); 

        
write_byteTE_BEAMFOLLOW ); 

        
write_shortrocket ); 

        
write_shorttrail ); 

        
write_byte25 ); 

        
write_byte); 

        
write_byte161 ); 

        
write_byte161 ); 

        
write_byte161 ); 

        
write_byterandom_num150170 ) ); 

        
message_end( ); 



        
emit_sound(rocketCHAN_WEAPONROCKET_SOUND1.0ATTN_NORM0PITCH_NORM

         

        
shot[player] = true 

        last_Rocket
[player] = gltime get_pcvar_num(cvar_RocketDelay

    } 

    return 
PLUGIN_CONTINUE 





public 
check_models(id)  



    if (
zp_get_user_zombie(id) || zp_get_user_nemesis(id) || zp_get_user_assassin(id) || zp_get_user_survivor(id) || zp_get_user_sniper(id)) 

        return 
FMRES_IGNORED 

     

    
if(hasjet[id])  

    { 

        if(
get_user_weapon(id) == CSW_KNIFE)  

        { 

            
set_pev(idpev_viewmodel2"models/v_egon.mdl"

            
set_pev(idpev_weaponmodel2"models/p_egon.mdl"

        } 

        else 

        { 

            return 
PLUGIN_CONTINUE 

        


        return 
PLUGIN_CONTINUE 

    


    return 
PLUGIN_CONTINUE 





public 
remove_jetpacks()  



    new 
nextitem  find_ent_by_class(-1,"zp_jp_jetpack"

    while(
nextitem)  

    { 

        
remove_entity(nextitem

        
nextitem find_ent_by_class(-1,"zp_jp_jetpack"

    } 

    return 
PLUGIN_CONTINUE 





public 
emitsound(entitychannel, const sample[])  



    if( !( 
<= entity <= 32 ) ) 

        return 
FMRES_IGNORED

     

    if( !
g_bAliveentity ] ) 

        return 
FMRES_IGNORED

     

    if(
hasjet[entity] && get_user_weapon(entity) == CSW_KNIFE) { 

        if(
equal(sample,"weapons/knife_slash1.wav")) return FMRES_SUPERCEDE 

        
if(equal(sample,"weapons/knife_slash2.wav")) return FMRES_SUPERCEDE 

         

        
if(equal(sample,"weapons/knife_deploy1.wav")) return FMRES_SUPERCEDE 

        
if(equal(sample,"weapons/knife_hitwall1.wav")) return FMRES_SUPERCEDE 

         

        
if(equal(sample,"weapons/knife_hit1.wav")) return FMRES_SUPERCEDE 

        
if(equal(sample,"weapons/knife_hit2.wav")) return FMRES_SUPERCEDE 

        
if(equal(sample,"weapons/knife_hit3.wav")) return FMRES_SUPERCEDE 

        
if(equal(sample,"weapons/knife_hit4.wav")) return FMRES_SUPERCEDE 

         

        
if(equal(sample,"weapons/knife_stab.wav")) return FMRES_SUPERCEDE 

    


     

    return 
FMRES_IGNORED 





public 
Icon_Show(icon[], color[3], modePlayer)  



    
message_begin(MSG_ONE_UNRELIABLEget_user_msgid("StatusIcon"), {0,0,0}, Player); 

    
write_byte(mode);     // status (0=hide, 1=show, 2=flash) 

    
write_string(icon);     // sprite name 

    
write_byte(color[0]);     // red 

    
write_byte(color[1]);     // green 

    
write_byte(color[2]);     // blue 

    
message_end(); 







public 
Icon_Energy(color[3], modePlayer)  



     

    
Icon_Show("item_longjump"colormodePlayer





public 
human_fly(Player)  



     

    if (
g_flyEnergy[Player] <= get_pcvar_num(cvar_fly_max_engery)*0.1

    { 

        
jp_off(Player);     

    } 

    if (
g_flyEnergy[Player] > get_pcvar_num(cvar_fly_max_engery)*0.1

    { 

        
jp_on(Player); 

    } 





public 
jp_on(Player)  

    
fly[Player] = true 



public jp_off(Player)  

    
fly[Player] = false 



public check_rocket(Player)  

{     

    if (
last_Rocket[Player] > gltime

    {     

        
rk_forbidden(Player

        
rksound[Player] = true 

    


    else 

    {     

        if (
shot[Player]) 

        { 

            
rksound[Player] = false 

            shot
[Player] = false 

        


        
rk_sound(Player

        
rk_allow(Player

    } 





public 
rk_allow(Player)  

    
rocket[Player] = true 



public rk_forbidden(Player)  

    
rocket[Player] = false 



public rk_sound(Player) { 



    if (!
rksound[Player]) 

    { 

        
engfunc(EngFunc_EmitSoundPlayerCHAN_WEAPONgetrocket1.0ATTN_NORM0PITCH_NORM

        
client_print(Playerprint_center"You can shot with Bazooka NOW!"

        
rksound[Player] = true 

    


    else if (
rksound[Player]) 

    { 

         

    } 





public 
player_die()  



    new 
id read_data(2

    if(
hasjet[id])  

    { 

        
drop_jetpack(id

        
hasjet[id] = 

        rocket
[id] = false 

        g_flyEnergy
[id] = 

    


     

    return 
PLUGIN_CONTINUE 





public 
cmdDrop(id)  



    if(
hasjet[id])  

    { 

        if(
get_user_weapon(id) == CSW_KNIFE)  

        { 

            

            if(!
zp_get_user_zombie(id)) 

            { 

                
set_pev(idpev_viewmodel2"models/p_knife.mdl")
                
set_pev(idpev_weaponmodel2"models/p_knife.mdl")

            } 
            
            
drop_jetpack(id

            return 
PLUGIN_HANDLED 

        


    } 

    return 
PLUGIN_CONTINUE 





public 
drop_jetpack(Player)  



    if(
hasjet[Player])  

    { 

        new 
Float:Aim[3],Float:origin[3

        
VelocityByAim(Player64Aim

        
entity_get_vector(Player,EV_VEC_origin,origin

         

        
origin[0] += Aim[0

        
origin[1] += Aim[1

         

        new 
jetpack create_entity("info_target"

        
entity_set_string(jetpack,EV_SZ_classname,"zp_jp_jetpack"

        
entity_set_model(jetpack,"models/w_egon.mdl")     

         

        
entity_set_size(jetpack,Float:{-16.0,-16.0,-16.0},Float:{16.0,16.0,16.0}) 

        
entity_set_int(jetpack,EV_INT_solid,1

         

        
entity_set_int(jetpack,EV_INT_movetype,6

         

        
entity_set_vector(jetpack,EV_VEC_origin,origin

         

        
Icon_Energy({2552550}, 0Player

        
Icon_Energy({1281280}, 0Player 

        
Icon_Energy({02550}, 0Player

         

        
hasjet[Player] = 

        rocket
[Player] = false 

    
}     





public 
pfn_touch(ptrptd)  



    if(
is_valid_ent(ptr)) { 

        new 
classname[32

        
entity_get_string(ptr,EV_SZ_classname,classname,31

         

        if(
equal(classname"zp_jp_jetpack"))  

        { 

            if(
is_valid_ent(ptd))  

            { 

                new 
id ptd 

                
if(id && id 34)  

                { 

                    if(!
hasjet[id] && !zp_get_user_zombie(id) && g_bAlive[id])  

                    { 

                        
hasjet[id] = 

                        g_flyEnergy
[id] = get_pcvar_num(cvar_fly_max_engery

                        
rocket[id] = true 

                        client_cmd
(id,"spk items/gunpickup2.wav"

                        
engclient_cmd(id,"weapon_knife"

                        
remove_entity(ptr

                    } 

                } 

            } 

        } 

        else if(
equal(classname"zp_jp_rocket"))  

        {     

            new 
FloatOrigin]; 

            
pevptrpev_originOrigin ); 

            
jp_radius_damage(ptr

             

            
message_beginMSG_BROADCASTSVC_TEMPENTITY ); 

            
write_byteTE_EXPLOSION ); 

            
write_coordfloatroundOrigin] ) ); 

            
write_coordfloatroundOrigin] ) ); 

            
write_coordfloatroundOrigin] ) ); 

            
write_shortexplode ); 

            
write_byterandom_num1525 ) ); 

            
write_byte15 ); 

            
write_byte); 

            
message_end( ); 

                 

            
message_beginMSG_BROADCASTSVC_TEMPENTITY ); 

            
write_byteTE_BEAMCYLINDER ); 

            
write_coordfloatroundOrigin] ) ); 

            
write_coordfloatroundOrigin] ) ); 

            
write_coordfloatroundOrigin] ) ); 

            
write_coordfloatroundOrigin] ) ); 

            
write_coordfloatroundOrigin] ) ); 

            
write_coordfloatroundOrigin] ) + ( 450 + ( random_num0) * 100 ) ) ); 

            
write_shortshockwave ); 

            
write_byte); 

            
write_byte); 

            
write_byte); 

            
write_byterandom_num03  ) * 40 ); 

            
write_byte); 

            
write_byte121 ); 

            
write_byte121 ); 

            
write_byte121 ); 

            
write_byterandom_num150240 ) ); 

            
write_byte); 

            
message_end( ); 

             

            if(
is_valid_ent(ptd))  

            { 

                new 
classname2[32

                
entity_get_string(ptd,EV_SZ_classname,classname2,31

                 

                if(
equal(classname2,"func_breakable")) 

                    
force_use(ptr,ptd

            } 

             

            
remove_entity(ptr

        } 

    } 

    return 
PLUGIN_CONTINUE 





public 
zp_user_infected_pre(Playerinfector



    
Icon_Energy({02550}, 0Player); 

    
cmdDrop(Player); 

    
hasjet[Player] = 0

    
g_flyEnergy[Player] = 0

    
rocket[Player] = false





public 
zp_extra_item_selected(Playeritemid



    new 
szName32 ]; 

    
get_user_namePlayerszNamesizeof szName ) -); 

         

    if (
itemid == g_item_jetpack

    { 

        
zp_colored_print(0"^3%s^1 bought^4 JetPack Bazooka^1 !"szName



        
zp_colored_print(Player"Press ^3CTRL+SPACE^1 to fly!"

        
zp_colored_print(Player"Press ^3RIGHT CLICK^1 to shoot!"



        
set_hudmessage2551195, -1.00.8010.05.01.01.0, -); 

        
show_hudmessage0"%s bought JetPack Bazooka!"szName ); 



        
hasjet[Player] = 

        g_flyEnergy
[Player] = get_pcvar_num(cvar_fly_max_engery

        
rocket[Player] = true 

        client_cmd
(Player,"spk items/gunpickup2.wav"

        
engclient_cmd(Player,"weapon_knife"

    } 





stock jp_radius_damage(entity)  



    new 
id entity_get_edict(entity,EV_ENT_owner

    new 
packs,name[32]; 

    for(new 
133i++)  

    { 

        if(
g_bAlive[i])  

        { 

            new 
dist floatround(entity_range(entity,i)) 

             

            if(
dist <= get_pcvar_num(cvar_Dmg_range))  

            { 

                new 
hp get_user_health(i

                new 
Float:damage get_pcvar_float(cvar_RocketDmg)-(get_pcvar_float(cvar_RocketDmg)/get_pcvar_float(cvar_Dmg_range))*float(dist

                 

                new 
Origin[3

                
get_user_origin(i,Origin

                 

                if(
zp_get_user_zombie(id) != zp_get_user_zombie(i))  

                { 

                    
get_user_name(i,name,31); 

                    if(
damage>=800

                        
packs 2

                    else 

                        
packs 1

                             

                    if(
hp damage

                    { 

                        
zp_set_user_ammo_packs idzp_get_user_ammo_packs id ) + packs ); 

                        
jp_take_damage(i,floatround(damage),Origin,DMG_BLAST

                         

                        new 
iPos = ++g_iPlayerPos[id

                        if (
iPos == sizeof(g_flCoords)) 

                        { 

                            
iPos g_iPlayerPos[id] = 

                        


                        
set_hudmessage(0150150Float:g_flCoords[iPos][0], Float:g_flCoords[iPos][1], 02.01.00.10.1, -1

                        
show_hudmessage(id"%d"floatround(damage)) 

                        
zp_colored_print(id"You make^3 %i^1 damage on^3 %s^1 with Bazooka."floatround(damage), name); 

                    } 

                    else 

                    { 

                        
log_kill(id,i,"Jetpack Rocket",0

                        
zp_colored_print(id"You killed^3 %s^1 with Bazooka."name); 

                    } 

                } 

            } 

        } 

    } 





stock log_kill(killervictimweapon[], headshot



    
set_msg_block(get_user_msgid("DeathMsg"), BLOCK_SET

    
ExecuteHamB(Ham_Killedvictimkiller2)  

    
set_msg_block(get_user_msgid("DeathMsg"), BLOCK_NOT



     

    
message_begin(MSG_BROADCASTget_user_msgid("DeathMsg")) 

    
write_byte(killer

    
write_byte(victim

    
write_byte(headshot

    
write_string(weapon

    
message_end() 

     

    if(
get_user_team(killer)!=get_user_team(victim)) 

        
fm_set_user_frags(killer,fm_get_user_frags(killer) +1

    if(
get_user_team(killer)==get_user_team(victim)) 

        
fm_set_user_frags(killer,fm_get_user_frags(killer) -1

         

    new 
kname[32], vname[32], kauthid[32], vauthid[32], kteam[10], vteam[10



    
get_user_name(killerkname31

    
get_user_team(killerkteam9

    
get_user_authid(killerkauthid31

  

    
get_user_name(victimvname31

    
get_user_team(victimvteam9

    
get_user_authid(victimvauthid31

         

    
log_message("^"%s<%d><%s><%s>^" killed ^"%s<%d><%s><%s>^" with ^"%s^"",  

    
knameget_user_userid(killer), kauthidkteam,  

     
vnameget_user_userid(victim), vauthidvteamweapon



     return 
PLUGIN_CONTINUE





stock jp_take_damage(victim,damage,origin[3],bit) { 

    
message_begin(MSG_ONE,get_user_msgid("Damage"),{0,0,0},victim

    
write_byte(21

    
write_byte(20

    
write_long(bit

    
write_coord(origin[0]) 

    
write_coord(origin[1]) 

    
write_coord(origin[2]) 

    
message_end() 

     

    
fm_set_user_health(victim,fm_get_user_health(victim)-damage



    
client_cmd(victim,"spk fvox/flatline.wav"



    
msg_screen_fade(victimEFFECT_LENGTH25500115); 





stock msg_screen_fadeidholdtimergb



        
message_beginMSG_ONE_UNRELIABLEget_user_msgid"ScreenFade" ), { 00}, id ); 

        
write_shortseconds_to_unitsholdtime ) ); 

        
write_shortseconds_to_unitsholdtime ) ); 

        
write_short); 

        
write_byte); 

        
write_byte); 

        
write_byte); 

        
write_byte); 

        
message_end( ); 





stock seconds_to_unitstime 



        return ( ( 
<< 12 ) * ( time ) ) 

}   



stock fm_set_user_health(idhealth



    
health set_pev(idpev_healthfloat(health)) : dllfunc(DLLFunc_ClientKillid

     

    return 






stock fm_get_user_health(id



    return 
pev(idpev_health





stock fm_set_user_frags(idfrags)  



    
set_pevidpev_fragsfloat(frags)) 



    return 


}   



stock fm_get_user_frags(id



    return 
pev(idpev_frags


__________________

Last edited by ghost95v; 10-11-2017 at 04:09.
ghost95v is offline
Send a message via Skype™ to ghost95v
Ali0mer
Member
Join Date: Jan 2016
Location: Iraq
Old 10-11-2017 , 17:59   Re: Need help [zp jetpack]
Reply With Quote #5

I try another jetpack plugin and its works when i press G
But in this plugin its not..
i try this and still not working
Ali0mer is offline
Send a message via Skype™ to Ali0mer
Ali0mer
Member
Join Date: Jan 2016
Location: Iraq
Old 10-14-2017 , 14:43   Re: Need help [zp jetpack]
Reply With Quote #6

UP
Ali0mer is offline
Send a message via Skype™ to Ali0mer
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 17:28.


Powered by vBulletin®
Copyright ©2000 - 2022, vBulletin Solutions, Inc.
Theme made by Freecode