View Single Post
Author Message
Godofwar
AlliedModders Donor
Join Date: Dec 2015
Location: Germany
Old 02-27-2018 , 05:33   Add VIP Only to SMA Smoker Zombie plague
Reply With Quote #1

Can anyone edit it that only VIPS can use it? For ADMIN LEVEL H Flag F Please?

Code:
/*
*	---------------------------------------------------------------------------------------------------------
*	------------------------------------[ZP] Zombie Class: Smoker--------------------------------------------
*	---------------------------------------------------------------------------------------------------------
*	------------------------------------Author: SNAKER_BEATTER-----------------------------------------------
*	---------------------------------------------------------------------------------------------------------
*				About:
*		When Left4Dead2 i watched in youtube and i found smoker. I dont get hes command but when i played 
*		it, He drags players using hes long tongue, like a real monster that attacks pregnant mothers...
*		like from L4D2 when have to many damage long tongue ends
*	---------------------------------------------------------------------------------------------------------
*				Description:
*		Smoker is a zombie class for zombie plague 4.3 or later version. Like from L4D2 smoker can drag 
*		players by he's long tongue, After a long tongue use a cooldown starts, when take 500 damage 
*		long tongue is off and if falls with 50 damage long tongue is off too... you can use it on zombies
		too(bug)
*			You can use tha command with 'E' key (such as USE key) and when fall with 50 damage
*			smoke release and if damaged 100 release smokes 
*			you and you're long tongue's target will be 3rdperson view and a hudmessage will show
*			if you're zombie and not smoker you cant do anything
*			if the cooldown starts the thirdpeson view sets to firstperson
*
*			Well green smokes from 1.4 version is not good and not like smokes so i change it
*	---------------------------------------------------------------------------------------------------------
*				Credits:
*		L4D2 (game) - the very original zombie smoker
*	---------------------------------------------------------------------------------------------------------
*				Cvars:
*		Their are no new cvar than the old version
*		zp_smoker_tongue_max // how many times Smoker can use long tongue? default=999
*		zp_smoker_tongue_speed // speed of long tongue default=250
*		zp_smoker_tongue_cooldown // time in seconds before you can use long tongue again. default=15
*		zp_smoker_tongue_stop_damage // damage to stop using long tongue set 0 to disable it. default=300
*		zp_smoker_tongue_stop_damage_fall // damage to stop usng long tongue(only if falls) set 0 to disable it. default=50
*		zp_smoker_tongue_infecthook // additional hooks after Smoker infects smb. def=5
*		zp_smoker_tongue_unable_move // 0=human & Smoker can move / 1=unable human to move when dragging / 2=unable Smoker to move / 3=unable both
*		zp_smoker_tongue_reward .// How many reward gives to smoker when used long tongue to any. default=2
*		zp_smoker_tongue_target_zombie // Allow/disallow using long tongue to zombies / 1=enable for all zombies / 2=Only to smokers
*		zp_smoker_smoke_damage_by_player // how many damage by player should smoke release smokes. default=5
*		zp_smoker_smoke_damage_by_fall // how many damage by fall should smoke release. default=5
*		zp_smoker_smoke_death_distance // Smoke death distance
*		zp_smoker_smoke_death_blind // Smoke death set smoked all users around you're death body
*		zp_smoker_smoke_death_glow // Glow all you're death smoke victims
*
*	----------------------------------------------------------------------------------------------------------
*				Modules:
*		hamsandwich
*		fakemeta
*		engine
*	-----------------------------------------------------------------------------------------------------------
*				Change log:
*		1.0 (Sept 12, 2011)
*		{
*			First release
*		}
*		1.1 (Sept 12, 2011)
*		{
*			smoke death function rewritten 
*			Fix if a human is using smoker class, when dies smoke releases
*			(not sure) Fix if a survivor is using smoker class, when dies smoke releases
*		}
*		1.2 (Sept 16, 2011)
*		{
*			change autbind into e key
*			Fix if a nemesis is using smoker class, when dies smoke releases
*			Change print_chat on long tongue cooldown to Hudmessage
*		}
*		1.3 (Sept 17, 2011)
*		{
*			(new) thirdperson view when tongue start and firstperson when end
*			(new) rewritten tongue_start function
*			Fix new round human and survvor can use tongue abillity 
*			Fix damage smoke not working :: Now the damage tongue end and smoke damage have their own
*			Fix cooldown hudmessage bug
*		}
*		1.4 (Sept 18, 2011)
*		{
*			(best) added smoke damage : hes own cvars and with custom smokes
*			Smoker damage function rewritten
*			Fix smoker is human he can smoke damage and if survivor and nemesis too
*			Fix if player is zombie and he is not smoker he can smoke damage
*		}
*		1.5 (Sept 24, 2011)
*		{
*			Fix cooldown not working after smoker backs to human/survivor and get infected again
*			Fix when cooldown is working still 3rdperson view
*			Fix Floortarget's beam not working
*			Fix nemesis and survivor may not be tongued
*			Fix nemesis can use long tongue
*			Fix survivor can release smoke death
*			(best) Added bot support on smoke damage
*			(bestornot) replace damage and death smokes
*			(best) created my own smoker's tongue
*		}
*		1.6 (Sept 24, 2011 (Uploaded))
*		{
*			Added cfg dir
*			(best) Added sounds when using long tongue
*			(best) Added smoker models and v-models	
*			tongue_Start function rewritten
*		}
*		1.7 (Sept 24, 2011 (Uploaded))
*		{
*			(best) Added rewards when used long tongue to somebody
*			(best) Added death smoke damage and block sreen every players at his radius
*			Fix if zombie can smoked via death smoke command
*		}
*		1.8 (Sept 24, 2011 (Uploaded))
*		{
*			Fix nemesis can be smoked via death smoke
*			Added rewards when victim somebody victimed by death smoke
*			(bestornot) Removed/Fix if zombie or a nemesis is long tongued smoker rewarded
*			Fix smoke death victim's smoke not working
*			Wrewwritten tongue_Start function 
*		}
*		1.9 (Sept 24, 2011 (Uploaded))
*		{ 
*			(best) Fix smoke death not working
*			(best) renew sounds + smoke death sound
*			Increases smoker's knockback so no need to stop damage
*			Changed some humesssage mistypes
*		}
* 		2.0 (Forgotten) 
*		{
*			 Removed some useless codes
*			 (best) Fix smoke death victim = after smoking hes screens turns to darky
* 			 Changed all hudmessage to colorchat
* 		}
*		2.1 (Oct 12, 2011 (Created))
*		{
*			Added cvar to allow/disallow using tongue to zombie (as requested by survival)
*		}
*		2.2 (Oct 13, 2011 (Uploaded))
*		{
*			Optomized codes
*		}
*/

/******************************************************
		[Include files]
******************************************************/

#include <amxmodx>
#include <zombieplague>
#include <fakemeta>
#include <hamsandwich>
#include <engine>

//IMPORTANT (install cs_ham_bots.amxx to your server)
	#include <cs_ham_bots_api>

/******************************************************
		[Plugin infos]
******************************************************/

#define PLUGIN "[ZP] Zombie Class Smoker"
#define VERSION "2.2"
#define AUTHOR "Snaker_beatter"

/******************************************************
		[Id(s)]
******************************************************/
//Sounds
new const sound_drag[] = "barnacle/bcl_chew1.wav"
new const sound_smo_die[] = "weapons/explode5.wav"
//Main Class, modelT & Sprite
new g_zclass_smoker, g_Tongue , g_xsmoke1 , g_xsmoke2
//Some vars
new g_tongued[33], g_tonguesLeft[33], g_unable2move[33]
new Float:g_lastTongue[33]
new bool: g_Ltongue_i[33] = false , bool: g_bind_isuse[33] = false
//Cvars
new cvar_tongue_speed, cvar_tongue_cooldown, cvar_tongue_stop_damage, cvar_tongue_stop_damage_fall, cvar_tongue_unb2move , cvar_tongue_start_autobind , cvar_smoke_damage_byplayer, cvar_smoke_damage_byfall , cvar_smoke_death_distance, cvar_smoke_death_blind, cvar_smoke_death_victimglow, cvar_tongue_reward,
cvar_tongue_zombietarget
//Smoker Atributes
new const zclass_name[] = { "Smoker" }
new const zclass_info[] = { "Long tongue & smokes" }
new const zclass_model[] = { "zombie_smoker" }
new const zclass_clawmodel[] = { "v_knife_smoker.mdl" }
const zclass_health = 2602
const zclass_speed = 249
const Float:zclass_gravity = 1.0
const Float:zclass_knockback = 1.5
/******************************************************
		[Main event] + [PLugin cfg]
******************************************************/

public plugin_init()
{
	cvar_tongue_speed = register_cvar("zp_smoker_tongue_speed", "250")
	cvar_tongue_cooldown = register_cvar("zp_smoker_tongue_cooldown", "0")
	cvar_tongue_stop_damage = register_cvar("zp_smoker_tongue_stop_damage", "250")
	cvar_tongue_stop_damage_fall = register_cvar("zp_smoker_tongue_stop_damage_fall", "25")
	cvar_tongue_unb2move = register_cvar("zp_smoker_tongue_unable_move", "3")
	cvar_tongue_start_autobind = register_cvar("zp_smoker_autobind", "1")
	cvar_tongue_reward = register_cvar("zp_smoker_tongue_reward", "2")
	cvar_tongue_zombietarget = register_cvar("zp_smoker_tongue_target_zombie", "1")
	cvar_smoke_damage_byfall = register_cvar("zp_smoker_smoke_damage_byfall", "1")
	cvar_smoke_damage_byplayer = register_cvar("zp_smoker_smoke_damage_byplayer", "1")
	cvar_smoke_death_distance = register_cvar("zp_smoker_smoke_death_distance", "180")
	cvar_smoke_death_blind = register_cvar("zp_smoker_smoke_death_blind", "5")
	cvar_smoke_death_victimglow = register_cvar("zp_smoker_smoke_death_glow", "1")
	register_event("ResetHUD", "newSpawn", "b")
	register_event("DeathMsg", "smoker_death", "a")
	register_forward(FM_PlayerPreThink, "fw_PlayerPreThink")
	RegisterHam(Ham_TakeDamage, "player", "fw_TakeDamage")
	/* Bot support start */
	//RegisterHamBots(Ham_Killed, "smoker_botdeath") 
	RegisterHamBots(Ham_TakeDamage, "fw_TakeDamage")
	/* Bot support end */
	register_clcmd("+smoker_tongue","tongue_start")
	register_clcmd("-smoker_tongue","tongue_end")
	plugin_cfg()
}

public plugin_cfg()
{
	new const derectory[] = "addons/amxmodx/configs/zp_zclass_smoker.cfg"
	server_cmd("exec %s", derectory)
}

/******************************************************
		[Precache event]
******************************************************/

public plugin_precache()
{
	register_plugin(PLUGIN, VERSION, AUTHOR)
	g_zclass_smoker = zp_register_zombie_class(zclass_name, zclass_info, zclass_model, zclass_clawmodel, zclass_health, zclass_speed, zclass_gravity, zclass_knockback)
	g_Tongue = precache_model("sprites/zbeam4.spr")
	g_xsmoke1 = precache_model("sprites/l4d_smoke_damage.spr")
	g_xsmoke2 = precache_model("sprites/l4d_smoke_death.spr")
	precache_sound(sound_drag)
	precache_sound(sound_smo_die)
}

/****************************************************
		[Events]
****************************************************/

public zp_user_infected_post(id, infector)
{
	if (zp_get_user_zombie_class(id) == g_zclass_smoker)
	{	
		g_tonguesLeft[id] = 999
		new bind_mode = get_pcvar_num(cvar_tongue_start_autobind)
		if (bind_mode == 1)
		{
			g_bind_isuse[id] = true
			client_print(id, print_chat, "[ZP] You can use long tongue with 'E' key")
		}
		else if (bind_mode == 0)
		{
			g_bind_isuse[id] = false
			client_print(id, print_chat, "[ZP] You can use long tongue, just bind 'KEY' +tongue_start")
		}
	}
}

public newSpawn(id)
{
	if (g_tongued[id])
	{
		tongue_end(id)
	}
}

public smoker_botdeath(victim, attacker, shouldgib)
{	
}
public smoker_death() // if smoker dies drag off
{
	new id = read_data(2)
	smoke_death(id)
	beam_remove(id)
	
	if (g_tongued[id])
		tongue_end(id)
}

public fw_TakeDamage(victim, inflictor, attacker, Float:damage) // if take damage drag off
{
	new g_cvar_falls = get_pcvar_num(cvar_tongue_stop_damage_fall) > 0 || get_pcvar_num(cvar_smoke_damage_byfall) > 0
	new g_cvar_players = get_pcvar_num(cvar_tongue_stop_damage) > 0 || get_pcvar_num(cvar_smoke_damage_byplayer) > 0
		
	if (zp_get_user_zombie_class(victim) == g_zclass_smoker)
	{
		new g_over_damage[33] 
		g_over_damage[victim] = g_over_damage[victim] + floatround(damage)

		if (victim == attacker || !is_user_connected(attacker) && (g_cvar_falls)) 
		{
			if (g_over_damage[victim] >= get_pcvar_num(cvar_tongue_stop_damage_fall))
			{
				g_over_damage[victim] = 0
				tongue_end(victim)
				return HAM_IGNORED;
			}
			if (damage > get_pcvar_num(cvar_smoke_damage_byfall))
			{
				g_over_damage[victim] = 0
				smoke_damage(victim)
				return HAM_IGNORED;
			}
		}
		
		if (is_user_alive(attacker) && (g_cvar_players))
		{
			if (g_over_damage[victim] >= get_pcvar_num(cvar_smoke_damage_byplayer))
			{
				g_over_damage[victim] = 0
				smoke_damage(victim)
			}
			
			if (g_over_damage[victim] >= get_pcvar_num(cvar_tongue_stop_damage))
			{
				g_over_damage[victim] = 0
				tongue_end(victim)
				return HAM_IGNORED;
			}
		}		
	}
	
	return HAM_IGNORED
}

public fw_PlayerPreThink(id)
{
	if (!is_user_alive(id))
	{
		return FMRES_IGNORED
	}
		
	new button = get_user_button(id)
	new oldbutton = get_user_oldbutton(id)
	
	if (g_bind_isuse[id] && zp_get_user_zombie(id) && (zp_get_user_zombie_class(id) == g_zclass_smoker))
	{
		if (!(oldbutton & IN_USE) && (button & IN_USE))
		{
			tongue_start(id)
		}
		if ((oldbutton & IN_USE) && !(button & IN_USE))
		{
			tongue_end(id)
		}
	}
	
	if (!g_Ltongue_i[id])
	{
		g_unable2move[id] = false
	}
		
	if (g_unable2move[id] && get_pcvar_num(cvar_tongue_unb2move) > 0)
	{
		set_pev(id, pev_maxspeed, 1.0)
	}
	
	return PLUGIN_CONTINUE
}

public client_disconnect(id) // if client disconnects drag off
{
	if (id <= 0 || id > 32)
		return
	
	if (g_tongued[id])
		tongue_end(id)
	
	if(g_unable2move[id])
		g_unable2move[id] = false
}

/*****************************************************
		[main commands]
*****************************************************/

public tongue_start(id) // starts drag, checks if player is Smoker, checks cvars
{	
	new g_unalive = is_user_alive(id)
	if (zp_get_user_survivor(id))
	{
		print_chatColor(id, "\g[ZP] \nYou can't use smoker's\tlong tongue if you're a survivor!")
		return PLUGIN_HANDLED
	}
	
	if (zp_get_user_nemesis(id))
	{
		print_chatColor(id, "\g[ZP] \nYou can't use \tlong tongue if you are nemesis!")
		return PLUGIN_HANDLED
	}
	
	if (!g_unalive)
	{
		print_chatColor(id, "\g[ZP] \nYou can't use \tlong tongue if you are death!")
		return PLUGIN_HANDLED
	}
			
	if (zp_get_user_zombie(id))
	{
		if (zp_get_user_zombie_class(id) == g_zclass_smoker)
		{	
			if (!g_Ltongue_i[id]) 
			{
				set_view(id, CAMERA_NONE)
				static Float:cdown
				cdown = get_pcvar_float(cvar_tongue_cooldown)

				if (!g_unalive) 
				{
					print_chatColor(id, "\g[ZP] \nYou can't use \tlong tongue if you are death!")
					return PLUGIN_HANDLED
				}
			
				if (g_tonguesLeft[id] <= 0) 
				{
					print_chatColor(id, "\g[ZP] \nYou use max \tlong tongue, you cant do anymore")
					return PLUGIN_HANDLED
				}

				if (get_gametime() - g_lastTongue[id] < cdown) 
				{
					print_chatColor(id, "\g[ZP] \nYou have to \twait %.f0  to use long tongue again!", get_pcvar_float(cvar_tongue_cooldown) - (get_gametime() - g_lastTongue[id]))
					set_view(id, CAMERA_NONE)
					return PLUGIN_HANDLED
				}

				new tonguetarget, targetbody
				get_user_aiming(id, tonguetarget, targetbody)
				
				if (is_user_alive(tonguetarget))
				{
					tonguetarget_classes(id, tonguetarget)
					
					if (get_pcvar_float(cvar_tongue_speed) <= 0.0)
						cvar_tongue_speed = 1
			
					new parm[2]
					parm[0] = id
					parm[1] = tonguetarget
					
					set_task(0.1, "smoker_reelin", id, parm, 2, "b")
					harpoon_target(parm)
						
					g_tonguesLeft[id]--
					g_Ltongue_i[id] = true
				
					if (get_pcvar_num(cvar_tongue_unb2move) == 1)
					{
						g_unable2move[tonguetarget] = true
					}	
				}
				else 
				{
					g_tongued[id] = 33
					FloorTarget(id)
					emit_sound(tonguetarget, CHAN_BODY, sound_drag, 1.0, ATTN_NORM, 0, PITCH_HIGH)
					g_Ltongue_i[id] = true
					g_tonguesLeft[id]--
				}		
			}
			else 
				return PLUGIN_HANDLED
		}	
	}
	else 
	{
		print_chatColor(id, "\g[ZP] \nYou can't use \tsmoker's long tongue if you're a  human!")	
		return PLUGIN_HANDLED
	}
	return PLUGIN_CONTINUE
}

public smoker_reelin(parm[]) // player to smoker
{
	new id = parm[0]
	new victim = parm[1]

	if (!g_tongued[id] || !is_user_alive(victim))
	{
		tongue_end(id)
		return
	}
	
	new Float:fl_Velocity[3]
	new idOrigin[3], vicOrigin[3]

	get_user_origin(victim, vicOrigin)
	get_user_origin(id, idOrigin)

	new distance = get_distance(idOrigin, vicOrigin)

	if (distance > 1)
	{
		new Float:fl_Time = distance / get_pcvar_float(cvar_tongue_speed)

		fl_Velocity[0] = (idOrigin[0] - vicOrigin[0]) / fl_Time
		fl_Velocity[1] = (idOrigin[1] - vicOrigin[1]) / fl_Time
		fl_Velocity[2] = (idOrigin[2] - vicOrigin[2]) / fl_Time
	} 
	else 
	{
		fl_Velocity[0] = 0.0
		fl_Velocity[1] = 0.0
		fl_Velocity[2] = 0.0
	}

	entity_set_vector(victim, EV_VEC_velocity, fl_Velocity)
}

public tongue_end(id) // drags end function
{
	g_tongued[id] = 0
	beam_remove(id)
	remove_task(id)
	set_view(id, CAMERA_NONE)
	
	if (g_Ltongue_i[id])
	{
		g_lastTongue[id] = get_gametime()
	}
	g_Ltongue_i[id] = false
	g_unable2move[id] = false
}

public harpoon_target(parm[]) // set long tongue if target is player
{
	new id = parm[0]
	new tonguetarget = parm[1]

	message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
	write_byte(8)	// TE_BEAMENTS
	write_short(id)
	write_short(tonguetarget)
	write_short(g_Tongue)	// sprite index
	write_byte(0)	// start frame
	write_byte(0)	// framerate
	write_byte(200)	// life
	write_byte(12)	// width
	write_byte(1)	// noise
	write_byte(58)	// r, g, b
	write_byte(68)	// r, g, b
	write_byte(57)	// r, g, b
	write_byte(90)	// brightness
	write_byte(10)	// speed
	message_end()
}

public FloorTarget(id) // set long tongue target isn't player
{
	set_view(id, CAMERA_NONE)
	new endorigin[3]
	get_user_origin(id, endorigin, 3)

	message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
	write_byte (TE_BEAMENTPOINT); // TE_BEAMENTPOINT
	write_short(id)
	write_coord(endorigin[0])
	write_coord(endorigin[1])
	write_coord(endorigin[2])
	write_short(g_Tongue) // sprite index
	write_byte(0)	// start frame
	write_byte(0)	// framerate
	write_byte(200)	// life
	write_byte(15)	// width
	write_byte(1)	// noise
	write_byte(58)	// r, g, b
	write_byte(68)	// r, g, b
	write_byte(57)	// r, g, b
	write_byte(90)	// brightness
	write_byte(10)	// speed
	message_end()
}

public beam_remove(id) // remove beam
{
	message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
	write_byte(99)	//TE_KILLBEAM
	write_short(id)	//entity
	message_end()
}

public smoke_damage(id) // when smoker damaged create smoke
{
	if (zp_get_user_survivor(id))
	{
		return PLUGIN_HANDLED
	}
	if (zp_get_user_nemesis(id))
	{
		return PLUGIN_HANDLED
	}
	if (zp_get_user_zombie(id))
	{
		if (zp_get_user_zombie_class(id) == g_zclass_smoker)
		{
			new g_scale
			g_scale = random_num(60, 70)
			new Float:origin[3]
			pev(id, pev_origin, origin)
			create_sprite(origin, g_xsmoke1, 100, g_scale)
			screenshakeandflash(id)
		}
	}
	else
	{
		return PLUGIN_HANDLED
	}
	return PLUGIN_HANDLED
}

public smoke_death(id) // when smoker dies create smoke
{
	if (zp_get_user_survivor(id))
	{
		return PLUGIN_HANDLED
	}
	if (zp_get_user_nemesis(id))
	{
		return PLUGIN_HANDLED
	}
	if (zp_get_user_zombie(id))
	{
		if (zp_get_user_zombie_class(id) == g_zclass_smoker)
		{
			new Float:origin[3]
			pev(id, pev_origin, origin)
			create_sprite(origin, g_xsmoke2, 200, 180)
			deathh_smoke(id)
			emit_sound(id, CHAN_BODY, sound_smo_die, 1.0, ATTN_NORM, 0, PITCH_NORM)
		}
	}
	else
	{
		return PLUGIN_HANDLED
	}
	
	return PLUGIN_HANDLED
}

public screenshakeandflash(id)
{
	new g_msgScreenShake = get_user_msgid("ScreenShake")
	message_begin(MSG_ONE_UNRELIABLE, g_msgScreenShake, _, id)
	write_short(1<<12*4) // amplitude
	write_short(1<<12*2) // duration
	write_short(1<<12*10) // frequency
	message_end()
	new g_msgScreenFade = get_user_msgid("ScreenFade")
	message_begin(MSG_ONE, g_msgScreenFade, {0,0,0}, id)
	write_short( 1<<10) // fade lasts this long duration
	write_short( 1<<10) // fade lasts this long hold time
	write_short( 1<<12 ) // fade type (in / out)
	write_byte(255) // fade red
	write_byte(255) // fade green
	write_byte(255) // fade blue
	write_byte(100) // fade alpha
	message_end()
}

public tonguetarget_classes(id, target)
{
	/* Note: this targets are alive, if you want death go back to line "447" */
	new id_name[32], target_name[32]
	get_user_name(id, id_name, 31)
	get_user_name(target, target_name, 31)
				
	if (zp_get_user_survivor(target))
	{
		give_ammopacks(id)
		print_chatColor(id, "\g[ZP] \nYou are using you're \tlong tongue to enemy %s You are rewarded %d AP", target_name, get_pcvar_num(cvar_tongue_reward))
		print_chatColor(target, "\g[ZP] \tsmoker %s is using he's long tongue to you!", id_name)
		g_tongued[id] = target
		emit_sound(target, CHAN_BODY, sound_drag, 1.0, ATTN_NORM, 0, PITCH_NORM)
	}
	if (zp_get_user_nemesis(target))
	{
		print_chatColor(id, "\g[ZP] \nYou are using you're \tlong tongue to %s", target_name)
		print_chatColor(target, "\g[ZP] \nsmoker %s is using \the's long tongue to you!", id_name)
		g_tongued[id] = target
		emit_sound(target, CHAN_BODY, sound_drag, 1.0, ATTN_NORM, 0, PITCH_NORM)
	}
	
	if (zp_get_user_zombie(target))
	{
		if (get_pcvar_num(cvar_tongue_zombietarget) == 1)
		{
			print_chatColor(id, "\g[ZP] \nYou are using you're \tlong tongue to %s", target_name)
			print_chatColor(target, "\g[ZP] \nsmoker %s is using \the's long tongue to you!", id_name)
			g_tongued[id] = target
			emit_sound(target, CHAN_BODY, sound_drag, 1.0, ATTN_NORM, 0, PITCH_NORM)
		}
		else
		{
			g_tongued[id] = target = false
			print_chatColor(id, "\g[ZP] \nYou \tCant use long tongue to %s", target_name)
			emit_sound(target, CHAN_BODY, sound_drag, 1.0, ATTN_NORM, 0, PITCH_NORM) // still add some sound so it wont show as a bug
		}
		if (get_pcvar_num(cvar_tongue_zombietarget) == 2) // allow only for smoker zombies
		{
			if (zp_get_user_zombie_class(target) == g_zclass_smoker)
			{
				g_tongued[id] = target			
				print_chatColor(id, "\g[ZP] \nYou are using you're \tlong tongue to %s", target_name)
				print_chatColor(target, "\g[ZP] \nsmoker %s is using \the's long tongue to you!", id_name)				
				emit_sound(target, CHAN_BODY, sound_drag, 1.0, ATTN_NORM, 0, PITCH_NORM) // still add some sound so it wont show as a bug
			}
			//else { 
			if (zp_get_user_zombie_class(target) != g_zclass_smoker)
			{
				g_tongued[id] = target = false
				print_chatColor(id, "\g[ZP] \nYou \tCan only use long tongue to smokers")
				emit_sound(target, CHAN_BODY, sound_drag, 1.0, ATTN_NORM, 0, PITCH_NORM)
			}
			//} //else is end
		}
	}
	else
	{
		give_ammopacks(id)
		print_chatColor(id, "\g[ZP] \nYou are using you're \tlong tongue to enemy %s You rewarded %d AP", target_name, get_pcvar_num(cvar_tongue_reward))
		print_chatColor(target, "\g[ZP] \nsmoker %s is using \the's long tongue to you!", id_name)
		g_tongued[id] = target
		emit_sound(target, CHAN_BODY, sound_drag, 1.0, ATTN_NORM, 0, PITCH_NORM)
	}
}

public deathh_smoke(id)
{
	new bool:deathh_smoke_allowed[33]
	for(new i = 1; i <= get_maxplayers(); i ++)
	{
		if (zp_get_user_zombie(i) || get_entity_distance(id, i) > get_pcvar_num(cvar_smoke_death_distance))
		{
			return PLUGIN_HANDLED
		}
		
		if (is_user_bot(i))
		{
			deathh_smoke_allowed[id] = true
		}
		
		print_chatColor(id, "\g[ZP] \nYou rewarded \t2 ammopacks by using smoke death to a victim")
		give_ammopacks(id)

		new g_msgScreenFade = get_user_msgid("ScreenFade")
		message_begin(MSG_ONE_UNRELIABLE, g_msgScreenFade, _, i)
		write_short(get_pcvar_num(cvar_smoke_death_blind)) // Time
		write_short(get_pcvar_num(cvar_smoke_death_blind)) // time
		write_short(0x0004)
		write_byte(255) // red
		write_byte(255) // green
		write_byte(255) // blue
		write_byte(135) // Alpha
		message_end()
		
		new Float:orgin[3]
		pev(i, pev_origin, orgin)
		new g_scale = random_num(40, 30)
		create_sprite(orgin, g_xsmoke1, 150, g_scale)
		
		if(get_pcvar_num(cvar_smoke_death_victimglow) == 1)
		{
			set_rendering(i, kRenderFxGlowShell, 255, 255, 255, kRenderNormal, 25)
			print_chatColor(i, "\g[ZP] \n You'd been \tsmoked by smoker's death smoke")
		}
		
		set_task(get_pcvar_float(cvar_smoke_death_blind), "deathh_smoke_unblind", i)
	}
	return PLUGIN_HANDLED
}

public deathh_smoke_unblind(user)
{
	new g_msgScreenFade = get_user_msgid("ScreenFade")
	message_begin(MSG_ONE_UNRELIABLE, g_msgScreenFade, _, user)
	write_short(1<<12) // Time
	write_short(0) // time
	write_short(0x0004)
	write_byte(0) // red
	write_byte(0) // green
	write_byte(0) // blue
	write_byte(1) // Alpha (if use 100 or upper will cause dark screen to user (not bug))
	message_end()
	
	new Float:orgin[3]
	pev(user, pev_origin, orgin)
	new g_scale = random_num(40, 30)
	create_sprite(orgin, g_xsmoke1, 130, g_scale)
	
	// plus remove glow
	if (get_pcvar_num(cvar_smoke_death_victimglow) == 1)
	{
		set_rendering(user)
	}
}

stock give_ammopacks(id)
{
	new get_ammopacks = zp_get_user_ammo_packs(id)
	new gives_ammopacks = get_pcvar_num(cvar_tongue_reward)
	zp_set_user_ammo_packs(id, get_ammopacks + gives_ammopacks)
}

stock create_sprite(const Float:XYZ_position[3], sprite_index, brightness, scale)
{
	// Sprite
	message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
	write_byte(TE_SPRITE) // TE id (Additive sprite, plays 1 cycle)
	engfunc(EngFunc_WriteCoord, XYZ_position[0]) // x
	engfunc(EngFunc_WriteCoord, XYZ_position[1]) // y
	engfunc(EngFunc_WriteCoord, XYZ_position[2]) // z
	write_short(sprite_index) // sprite index
	write_byte(scale) // scale in 0.1's
	write_byte(brightness) // brightness
	message_end()
}

// Print chat color by x[L]eonn
stock print_chatColor(const id,const input[], any:...)
{
	new msg[191], players[32], count = 1;
	vformat(msg,190,input,3);
	replace_all(msg,190,"\g","^4");// green
	replace_all(msg,190,"\n","^1");// normal
	replace_all(msg,190,"\t","^3");// team
	
	if (id) players[0] = id; else get_players(players,count,"ch");
	for (new i=0;i<count;i++)
	if (is_user_connected(players[i]))
	{
		message_begin(MSG_ONE_UNRELIABLE,get_user_msgid("SayText"),_,players[i]);
		write_byte(players[i]);
		write_string(msg);
		message_end();
	}
}
Godofwar is offline