Raised This Month: $319 Target: $400
 79%   Almost there!

Request ix Spr direction


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Molecula
Junior Member
Join Date: Feb 2013
Old 08-20-2019 , 19:36   Request ix Spr direction
Reply With Quote #1

Hi guys, could someone please help me fix this 2 guns spr direction?
both of them have a wrong direction when function 2 of the weapon is used, both go to the right and not where the crosshair is pointing, the longer the distance the more the spr goes to the right(or the irst plugin)
Thank you in advance.

Code:
#include <amxmodx>
#include <engine>
#include <fakemeta>
#include <fakemeta_util>
#include <hamsandwich>
#include <cstrike>
#include <xs>
#include <fun>

#define PLUGIN "[CSO] Laser Minigun"
#define VERSION "1.0"
#define AUTHOR "Dias Pendragon"

#define DAMAGE_A 33 // 66 for Zombie
#define DAMAGE_B 90 // 180 for Zombie - This is base damage (level 1)
#define CLIP 120
#define BPAMMO 240
#define SPEED 0.06
#define RECOIL 0.5

#define PLAYER_SPEED 230.0
#define TIME_RELOAD 5.0
#define TIME_DRAW 2.0

#define CSW_LM CSW_M249
#define weapon_lm "weapon_m249"

#define MODEL_V "models/v_laserminigun.mdl"
#define MODEL_PA "models/p_laserminiguna.mdl"
#define MODEL_PB "models/p_laserminigunb.mdl"
#define MODEL_W "models/w_laserminigun.mdl"
#define MODEL_W_OLD "models/w_m249.mdl"

#define ANIM_EXT "m249"
#define HIKARI_CLASSNAME "hikari"
#define HIKARI_SPEED 2560.0
#define HIKARI_RADIUS 160.0

new const WeaponSounds[15][] =
{
	"weapons/laserminigun-1.wav",
	"weapons/laserminigun_exp1.wav",
	"weapons/laserminigun_exp2.wav",
	"weapons/laserminigun_exp3.wav",
	"weapons/laserminigun-charge_loop.wav", // Auto
	"weapons/laserminigun-charge_origin.wav",
	"weapons/laserminigun-charge_shoot.wav",
	"weapons/laserminigun-charge_start.wav",
	"weapons/laserminigun_change_end.wav", // Auto
	"weapons/laserminigun_idle.wav", // Auto
	"weapons/laserminigun_draw.wav", // Auto
	"weapons/laserminigun_clipin1.wav", // Auto
	"weapons/laserminigun_clipin2.wav", // Auto
	"weapons/laserminigun_clipout1.wav", // Auto
	"weapons/laserminigun_clipout2.wav" // Auto
}

new const WeaponResources[7][] = 
{
	"sprites/weapon_laserminigun.txt",
	"sprites/640hud14_2.spr",
	"sprites/640hud133_2.spr",
	"sprites/laserminigun_hit.spr",
	"sprites/laserminigun_hit1.spr",
	"sprites/laserminigun_hit2.spr",
	"sprites/laserminigun_hit3.spr"
}

new const WeaponResources2[4][] =
{
	"sprites/muzzleflash38.spr",
	"sprites/laserminigun1.spr",
	"sprites/laserminigun2.spr",
	"sprites/laserminigun3.spr"
}

enum
{
	STATE_NONE = 0,
	STATE_STARTING,
	STATE_CHARGING1,
	STATE_CHARGING2,
	STATE_CHARGING3,
	STATE_CHARGED,
	STATE_CHARGED2,
}

enum
{
	ANIME_IDLE = 0,
	ANIME_CHARGE_ORIGIN,
	ANIME_CHARGE_START,
	ANIME_CHARGE_LOOP,
	ANIME_CHARGE_SHOOT,
	ANIME_RELOAD,
	ANIME_DRAW,
	ANIME_SHOOT1,
	ANIME_SHOOT2,
	ANIME_SHOOT3,
	ANIME_CHARGE_END
}

// MACROS
#define Get_BitVar(%1,%2) (%1 & (1 << (%2 & 31)))
#define Set_BitVar(%1,%2) %1 |= (1 << (%2 & 31))
#define UnSet_BitVar(%1,%2) %1 &= ~(1 << (%2 & 31))

// Vars
new g_Had_LM, g_Clip[33], Float:g_Recoil[33][3], g_WeaponState[33], g_MyHikari[33]
new g_Event_LM, g_SmokePuff_SprId, g_Exp1, g_Exp2, g_Exp3
new g_MsgWeaponList, g_MsgCurWeapon, g_MaxPlayers

new g_Muzzleflash_Ent, g_Muzzleflash

// Safety
new g_IsConnected, g_IsAlive, g_PlayerWeapon[33], g_HamBot

public plugin_init() 
{
	register_plugin(PLUGIN, VERSION, AUTHOR)
	
	// Safety
	Register_SafetyFunc()
	register_event("HLTV", "Event_NewRound", "a", "1=0", "2=0")
	register_event("CurWeapon", "Event_CurWeapon", "be", "1=1")
	
	// Forward
	register_forward(FM_UpdateClientData, "fw_UpdateClientData_Post", 1)
	register_forward(FM_PlaybackEvent, "fw_PlaybackEvent")
	register_forward(FM_CmdStart, "fw_CmdStart")
	register_forward(FM_SetModel, "fw_SetModel")	
	register_forward(FM_AddToFullPack, "fw_AddToFullPack_post", 1)
	register_forward(FM_CheckVisibility, "fw_CheckVisibility")
	
	register_touch(HIKARI_CLASSNAME, "*", "fw_TouchHikari")
	
	// Ham
	RegisterHam(Ham_Item_Deploy, weapon_lm, "fw_Item_Deploy_Post", 1)	
	RegisterHam(Ham_Item_AddToPlayer, weapon_lm, "fw_Item_AddToPlayer_Post", 1)
	RegisterHam(Ham_Weapon_WeaponIdle, weapon_lm, "fw_Weapon_WeaponIdle_Post", 1)
	RegisterHam(Ham_Item_PostFrame, weapon_lm, "fw_Item_PostFrame")	
	RegisterHam(Ham_Weapon_Reload, weapon_lm, "fw_Weapon_Reload")
	RegisterHam(Ham_Weapon_Reload, weapon_lm, "fw_Weapon_Reload_Post", 1)	
	RegisterHam(Ham_Weapon_PrimaryAttack, weapon_lm, "fw_Weapon_PrimaryAttack")
	RegisterHam(Ham_Weapon_PrimaryAttack, weapon_lm, "fw_Weapon_PrimaryAttack_Post", 1)
	
	RegisterHam(Ham_TraceAttack, "worldspawn", "fw_TraceAttack_World")
	RegisterHam(Ham_TraceAttack, "player", "fw_TraceAttack_Player")	

	g_MsgCurWeapon = get_user_msgid("CurWeapon")
	g_MsgWeaponList = get_user_msgid("WeaponList")
	g_MaxPlayers = get_maxplayers()
	
	//register_clcmd("say /get", "Get_LM")
	register_clcmd("weapon_laserminigun", "Hook_Weapon")
}

public plugin_precache()
{
	precache_model(MODEL_V)
	precache_model(MODEL_PA)
	precache_model(MODEL_PB)
	precache_model(MODEL_W)

	for(new i = 0; i < sizeof(WeaponSounds); i++)
		precache_sound(WeaponSounds[i])
	
	precache_generic(WeaponResources[0])
	precache_model(WeaponResources[1])
	precache_model(WeaponResources[2])
	precache_model(WeaponResources[3])
	g_Exp1 = precache_model(WeaponResources[4])
	g_Exp2 = precache_model(WeaponResources[5])
	g_Exp3 = precache_model(WeaponResources[6])
	
	for(new i = 0; i < sizeof(WeaponResources2); i++)
		precache_model(WeaponResources2[i])

	g_SmokePuff_SprId = engfunc(EngFunc_PrecacheModel, WeaponResources[3])
	register_forward(FM_PrecacheEvent, "fw_PrecacheEvent_Post", 1)
	
	// Muzzleflash
	g_Muzzleflash_Ent = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "info_target"))
	
	engfunc(EngFunc_SetModel, g_Muzzleflash_Ent, WeaponResources2[0])
	set_pev(g_Muzzleflash_Ent, pev_scale, 0.1)
	
	set_pev(g_Muzzleflash_Ent, pev_rendermode, kRenderTransTexture)
	set_pev(g_Muzzleflash_Ent, pev_renderamt, 0.0)
}

public fw_PrecacheEvent_Post(type, const name[])
{
	if(equal("events/m249.sc", name)) g_Event_LM = get_orig_retval()		
}

public client_putinserver(id)
{
	Safety_Connected(id)
	
	if(!g_HamBot && is_user_bot(id))
	{
		g_HamBot = 1
		set_task(0.1, "Do_Register_HamBot", id)
	}
}

public Do_Register_HamBot(id) 
{
	Register_SafetyFuncBot(id)
	RegisterHamFromEntity(Ham_TraceAttack, id, "fw_TraceAttack_Player")	
}

public client_disconnect(id)
{
	Safety_Disconnected(id)
	
	if(pev_valid(g_MyHikari[id]))
	{
		set_pev(g_MyHikari[id], pev_nextthink, get_gametime() + 0.1)
		set_pev(g_MyHikari[id], pev_flags, FL_KILLME)
	}
}

public plugin_natives() {
	register_native("give_lasermine", "Get_LM", 1);
}

public Get_LM(id)
{
	g_WeaponState[id] = STATE_NONE
	
	Set_BitVar(g_Had_LM, id)
	give_item(id, weapon_lm)
	
	// Check Light
	if(pev_valid(g_MyHikari[id]) == 2) 
	{
		set_pev(g_MyHikari[id], pev_nextthink, get_gametime() + 0.1)
		set_pev(g_MyHikari[id], pev_flags, FL_KILLME)
	}
	
	// Clip & Ammo
	static Ent; Ent = fm_get_user_weapon_entity(id, CSW_LM)
	if(!pev_valid(Ent)) return
	
	cs_set_weapon_ammo(Ent, CLIP)
	cs_set_user_bpammo(id, CSW_LM, BPAMMO)
	
	message_begin(MSG_ONE_UNRELIABLE, g_MsgCurWeapon, _, id)
	write_byte(1)
	write_byte(CSW_LM)
	write_byte(CLIP)
	message_end()
}

public Remove_LM(id)
{
	UnSet_BitVar(g_Had_LM, id)
}

public Hook_Weapon(id)
{
	engclient_cmd(id, weapon_lm)
	return PLUGIN_HANDLED
}

public Event_NewRound()
{
	remove_entity_name(HIKARI_CLASSNAME)
} 

public Event_CurWeapon(id)
{
	static CSW; CSW = read_data(2)
	if(CSW != CSW_LM)
		return
	if(!Get_BitVar(g_Had_LM, id))	
		return 
		
	static Ent; Ent = fm_get_user_weapon_entity(id, CSW_LM)
	if(!pev_valid(Ent)) return
	
	set_pdata_float(Ent, 46, SPEED, 4)
	set_pdata_float(Ent, 47, SPEED, 4)
}

public fw_UpdateClientData_Post(id, sendweapons, cd_handle)
{
	if(!is_alive(id))
		return FMRES_IGNORED	
	if(get_player_weapon(id) == CSW_LM && Get_BitVar(g_Had_LM, id))
		set_cd(cd_handle, CD_flNextAttack, get_gametime() + 0.001) 
	
	return FMRES_HANDLED
}

public fw_PlaybackEvent(flags, invoker, eventid, Float:delay, Float:origin[3], Float:angles[3], Float:fparam1, Float:fparam2, iParam1, iParam2, bParam1, bParam2)
{
	if (!is_connected(invoker))
		return FMRES_IGNORED	
	if(get_player_weapon(invoker) != CSW_LM || !Get_BitVar(g_Had_LM, invoker))
		return FMRES_IGNORED
		
	if(eventid == g_Event_LM)
	{
		engfunc(EngFunc_PlaybackEvent, flags | FEV_HOSTONLY, invoker, eventid, delay, origin, angles, fparam1, fparam2, iParam1, iParam2, bParam1, bParam2)
		Set_WeaponAnim(invoker, ANIME_SHOOT1)
		emit_sound(invoker, CHAN_WEAPON, WeaponSounds[0], 1.0, 0.4, 0, 94 + random_num(0, 15))

		//Play_AttackAnimation(invoker, 0)

		return FMRES_SUPERCEDE
	}
	
	return FMRES_IGNORED
}

/*public Play_AttackAnimation(id, Right)
{
	static iAnimDesired, szAnimation[64]
	static iFlags; iFlags = pev(id, pev_flags)

	if(!Right)
	{	
		formatex(szAnimation, charsmax(szAnimation), iFlags & FL_DUCKING ? "crouch_shoot_%s" : "ref_shoot_%s", ANIM_EXT);
	} else {
		formatex(szAnimation, charsmax(szAnimation), iFlags & FL_DUCKING ? "crouch_shoot2_%s" : "ref_shoot2_%s", ANIM_EXT);
	}
	
	if((iAnimDesired = lookup_sequence(id, szAnimation)) == -1)
		iAnimDesired = 0;
	
	set_pev(id, pev_sequence, iAnimDesired)
}*/

public fw_CmdStart(id, uc_handle, seed)
{
	if(!is_alive(id))
		return
	if(get_player_weapon(id) != CSW_LM || !Get_BitVar(g_Had_LM, id))
		return
	
	static Button; Button = get_uc(uc_handle, UC_Buttons)
	static OldButton; OldButton = pev(id, pev_oldbuttons)
	static Ent; Ent = fm_get_user_weapon_entity(id, CSW_LM)
	
	if(!pev_valid(Ent))
		return
		
	if(Button & IN_ATTACK2)
	{
		if(get_pdata_float(id, 83, 5) > 0.0) 
			return
		if(cs_get_weapon_ammo(Ent) < 5)
			return
			
		switch(g_WeaponState[id])
		{
			case STATE_STARTING: 
			{
				Set_PlayerNextAttack(id, 0.5)
				Set_WeaponAnim(id, ANIME_CHARGE_ORIGIN)
				
				Light_Handle(id, 0)
				emit_sound(id, CHAN_WEAPON, WeaponSounds[5], 1.0, 0.4, 0, 94 + random_num(0, 15))
				
				g_WeaponState[id] = STATE_CHARGING1
			}
			case STATE_CHARGING1:
			{
				Set_PlayerNextAttack(id, 1.0)
				Set_WeaponAnim(id, ANIME_CHARGE_START)
				
				Light_Handle(id, 1)
				emit_sound(id, CHAN_WEAPON, WeaponSounds[7], 1.0, 0.4, 0, 94 + random_num(0, 15))
				
				g_WeaponState[id] = STATE_CHARGING2
			}
			case STATE_CHARGING2:
			{
				Set_PlayerNextAttack(id, 1.0)
				g_WeaponState[id] = STATE_CHARGING3
				
				Light_Handle(id, 2)
			}
			case STATE_CHARGING3:
			{
				Set_PlayerNextAttack(id, 0.75)
				g_WeaponState[id] = STATE_CHARGED
				
				Light_Handle(id, 3)
			}
			case STATE_CHARGED:
			{
				Set_PlayerNextAttack(id, 0.1)
				g_WeaponState[id] = STATE_CHARGED2
				
				Light_Handle(id, 4)
			}
			case STATE_CHARGED2:
			{
				Set_WeaponAnim(id, ANIME_CHARGE_LOOP)
				Set_PlayerNextAttack(id, 1.0)
				
				Light_Handle(id, 4)
			}
			default:
			{
				Set_PlayerNextAttack(id, 0.25)
				g_WeaponState[id] = STATE_STARTING
			}
		}
	} else {
		if(OldButton & IN_ATTACK2)
		{
			switch(g_WeaponState[id])
			{
				case STATE_STARTING: 
				{
					Set_PlayerNextAttack(id, 0.25)
					Set_WeaponAnim(id, ANIME_CHARGE_END)
				}
				case STATE_CHARGING1:
				{
					Set_PlayerNextAttack(id, 0.25)
					Set_WeaponAnim(id, ANIME_CHARGE_END)
					
					Light_Handle(id, -1)
				}
				case STATE_CHARGING2:
				{
					Set_PlayerNextAttack(id, 1.0)
					Set_WeaponAnim(id, ANIME_CHARGE_SHOOT)
					
					ChargedShot(id, 1)
				}
				case STATE_CHARGING3:
				{
					Set_PlayerNextAttack(id, 1.0)
					Set_WeaponAnim(id, ANIME_CHARGE_SHOOT)
					
					ChargedShot(id, 1)
				}
				case STATE_CHARGED:
				{
					Set_WeaponAnim(id, ANIME_CHARGE_SHOOT)
					Set_PlayerNextAttack(id, 1.0)
					
					ChargedShot(id, 2)
				}
				case STATE_CHARGED2:
				{
					Set_WeaponAnim(id, ANIME_CHARGE_SHOOT)
					Set_PlayerNextAttack(id, 1.0)
					
					ChargedShot(id, 3)
				}
			}
			
			g_WeaponState[id] = STATE_NONE
		}
	}
}

public Light_Handle(id, Code)
{
	static Ent, Ammo; Ent = fm_get_user_weapon_entity(id, CSW_LM)
	if(!pev_valid(Ent)) return
	Ammo = cs_get_weapon_ammo(Ent)
	
	switch(Code)
	{
		case 0:
		{
			g_MyHikari[id] = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "env_sprite"))
			
			engfunc(EngFunc_SetModel, g_MyHikari[id], WeaponResources2[1])
			set_pev(g_MyHikari[id], pev_scale, 0.0)
			set_pev(g_MyHikari[id], pev_impulse, 1125)
			
			set_pev(g_MyHikari[id], pev_rendermode, kRenderTransTexture)
			set_pev(g_MyHikari[id], pev_renderamt, 0.0)
		}
		case 1:
		{
			if(pev_valid(g_MyHikari[id]) == 2)
			{
				engfunc(EngFunc_SetModel, g_MyHikari[id], WeaponResources2[1])
				set_pev(g_MyHikari[id], pev_scale, 0.1)
				
				set_pev(id, pev_weaponmodel2, MODEL_PB)
			}
		}
		case 2:
		{
			if(pev_valid(g_MyHikari[id]) == 2)
			{
				set_pev(g_MyHikari[id], pev_frame, float(random_num(0, 8)))
				engfunc(EngFunc_SetModel, g_MyHikari[id], WeaponResources2[1])
				set_pev(g_MyHikari[id], pev_scale, 0.15)
			}
		}
		case 3:
		{
			if(pev_valid(g_MyHikari[id]) == 2)
			{
				if(Ammo >= 20) engfunc(EngFunc_SetModel, g_MyHikari[id], WeaponResources2[2])
				set_pev(g_MyHikari[id], pev_frame, float(random_num(0, 8)))
				set_pev(g_MyHikari[id], pev_scale, 0.225)
			}
		}
		case 4:
		{
			if(pev_valid(g_MyHikari[id]) == 2)
			{
				if(Ammo >= 30) engfunc(EngFunc_SetModel, g_MyHikari[id], WeaponResources2[3])
				set_pev(g_MyHikari[id], pev_frame, float(random_num(0, 8)))
				set_pev(g_MyHikari[id], pev_scale, 0.3)
			}
		}
		default:
		{
			if(pev_valid(g_MyHikari[id]) == 2)
			{
				set_pev(g_MyHikari[id], pev_nextthink, get_gametime() + 0.1)
				set_pev(g_MyHikari[id], pev_flags, FL_KILLME)
				
				set_pev(id, pev_weaponmodel2, MODEL_PA)
			}
		}
	}
}

public ChargedShot(id, Level)
{
	set_pev(id, pev_weaponmodel2, MODEL_PA)
	
	static LM, Ammo; LM = fm_get_user_weapon_entity(id, CSW_LM)
	if(!pev_valid(LM)) return
	Ammo = cs_get_weapon_ammo(LM)
	
	emit_sound(id, CHAN_WEAPON, WeaponSounds[6], 1.0, 0.4, 0, 94 + random_num(0, 15))
	
	// Create Ammo
	static Float:StartOrigin[3], Float:TargetOrigin[3], Float:MyVelocity[3], Float:VecLength
	
	get_position(id, 48.0, 10.0, -5.0, StartOrigin)
	get_position(id, 1024.0, 0.0, 0.0, TargetOrigin)
	
	pev(id, pev_velocity, MyVelocity)
	VecLength = vector_length(MyVelocity)
	
	if(VecLength) 
	{
		TargetOrigin[0] += random_float(-16.0, 16.0); TargetOrigin[1] += random_float(-16.0, 16.0); TargetOrigin[2] += random_float(-16.0, 16.0)
	} else {
		TargetOrigin[0] += random_float(-8.0, 8.0); TargetOrigin[1] += random_float(-8.0, 8.0); TargetOrigin[2] += random_float(-8.0, 8.0)
	}
	
	static Ent; Ent = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "env_sprite"))
	if(!pev_valid(Ent)) return
	
	// Set info for ent
	set_pev(Ent, pev_movetype, MOVETYPE_FLY)
	set_pev(Ent, pev_rendermode, kRenderTransAdd)
	set_pev(Ent, pev_renderamt, 255.0)
	set_pev(Ent, pev_iuser1, id) // Better than pev_owner
	set_pev(Ent, pev_iuser2, get_user_team(id))

	entity_set_string(Ent, EV_SZ_classname, HIKARI_CLASSNAME)
	
	switch(Level)
	{
		case 1:
		{
			cs_set_weapon_ammo(LM, max(Ammo - 10, 1))
			set_pev(Ent, pev_scale, 0.25)
			set_pev(Ent, pev_iuser3, 1)
			engfunc(EngFunc_SetModel, Ent, WeaponResources2[1])
		}
		case 2:
		{
			if(Ammo >= 20) 
			{
				cs_set_weapon_ammo(LM, max(Ammo - 20, 1))
				set_pev(Ent, pev_scale, 0.5)
				set_pev(Ent, pev_iuser3, 2)
				engfunc(EngFunc_SetModel, Ent, WeaponResources2[2])
			} else {
				cs_set_weapon_ammo(LM, max(Ammo - 10, 1))
				set_pev(Ent, pev_scale, 0.25)
				set_pev(Ent, pev_iuser3, 1)
				engfunc(EngFunc_SetModel, Ent, WeaponResources2[1])
			}
		}
		case 3:
		{
			if(Ammo >= 30)
			{
				cs_set_weapon_ammo(LM, max(Ammo - 30, 1))
				set_pev(Ent, pev_scale, 0.75)
				set_pev(Ent, pev_iuser3, 3)
				engfunc(EngFunc_SetModel, Ent, WeaponResources2[3])
			} else if(Ammo >= 20) {
				cs_set_weapon_ammo(LM, max(Ammo - 20, 1))
				set_pev(Ent, pev_scale, 0.5)
				set_pev(Ent, pev_iuser3, 2)
				engfunc(EngFunc_SetModel, Ent, WeaponResources2[2])
			} else {
				cs_set_weapon_ammo(LM, max(Ammo - 10, 1))
				set_pev(Ent, pev_scale, 0.25)
				set_pev(Ent, pev_iuser3, 1)
				engfunc(EngFunc_SetModel, Ent, WeaponResources2[1])
			}
		}
	}
	
	set_pev(Ent, pev_mins, Float:{-1.0, -1.0, -1.0})
	set_pev(Ent, pev_maxs, Float:{1.0, 1.0, 1.0})
	set_pev(Ent, pev_origin, StartOrigin)
	set_pev(Ent, pev_gravity, 0.01)
	set_pev(Ent, pev_solid, SOLID_TRIGGER)
	set_pev(Ent, pev_frame, 0.0)
	
	set_pev(Ent, pev_nextthink, halflife_time() + 0.1)
	
	static Float:Velocity[3]
	get_speed_vector(StartOrigin, TargetOrigin, HIKARI_SPEED, Velocity)
	set_pev(Ent, pev_velocity, Velocity)
}

public fw_TouchHikari(Ent, Id)
{
	if(!pev_valid(Ent))
		return
		
	// Exp Sprite
	static Float:Origin[3]/*, Team*/, id, Level, Float:Damage; 
	pev(Ent, pev_origin, Origin)
	
	id = pev(Ent, pev_iuser1)
	//Team = pev(Ent, pev_iuser2)
	Level = pev(Ent, pev_iuser3)
	Damage = float(DAMAGE_B)
	
	switch(Level)
	{
		case 2: {
			message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
			write_byte(TE_EXPLOSION)
			engfunc(EngFunc_WriteCoord, Origin[0])
			engfunc(EngFunc_WriteCoord, Origin[1])
			engfunc(EngFunc_WriteCoord, Origin[2])
			write_short(g_Exp2)
			write_byte(20)
			write_byte(15)
			write_byte(4)
			message_end()	
			
			Damage *= 2.0
			
			emit_sound(Ent, CHAN_WEAPON, WeaponSounds[2], 1.0, 0.4, 0, 94 + random_num(0, 15))
		}
		case 3: {
			message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
			write_byte(TE_EXPLOSION)
			engfunc(EngFunc_WriteCoord, Origin[0])
			engfunc(EngFunc_WriteCoord, Origin[1])
			engfunc(EngFunc_WriteCoord, Origin[2])
			write_short(g_Exp3)
			write_byte(30)
			write_byte(15)
			write_byte(4)
			message_end()	
			
			Damage *= 3.0
			
			emit_sound(Ent, CHAN_WEAPON, WeaponSounds[3], 1.0, 0.4, 0, 94 + random_num(0, 15))
		}
		default: {
			message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
			write_byte(TE_EXPLOSION)
			engfunc(EngFunc_WriteCoord, Origin[0])
			engfunc(EngFunc_WriteCoord, Origin[1])
			engfunc(EngFunc_WriteCoord, Origin[2])
			write_short(g_Exp1)
			write_byte(10)
			write_byte(15)
			write_byte(4)
			message_end()	
			
			Damage *= 1.0
			
			emit_sound(Ent, CHAN_WEAPON, WeaponSounds[1], 1.0, 0.4, 0, 94 + random_num(0, 15))
		}
		
	}
	static Float:MyOrigin[3]
	if(is_connected(id))
	{
		// Damage
		for(new i = 0; i < g_MaxPlayers; i++)
		{
			if(!is_alive(i))
				continue
			//if(Team == get_user_team(i))
			//	continue
			if(id == i)
				continue
			if(entity_range(Ent, i) > HIKARI_RADIUS)
				continue
				
			pev(i, pev_origin, MyOrigin)
				
			engfunc(EngFunc_MessageBegin, MSG_PAS, SVC_TEMPENTITY, MyOrigin, 0)
			write_byte(TE_EXPLOSION)
			engfunc(EngFunc_WriteCoord, MyOrigin[0])
			engfunc(EngFunc_WriteCoord, MyOrigin[1])
			engfunc(EngFunc_WriteCoord, MyOrigin[2])
			write_short(g_SmokePuff_SprId)
			write_byte(3)
			write_byte(20)
			write_byte(4)
			message_end()
				
			ExecuteHamB(Ham_TakeDamage, i, 0, id, i != Id ? Damage : Damage * 2.0, DMG_SHOCK)
		}
	}
	
	// Remove Ent
	set_pev(Ent, pev_flags, FL_KILLME)
}

public fw_SetModel(entity, model[])
{
	if(!pev_valid(entity))
		return FMRES_IGNORED
	
	static Classname[32]
	pev(entity, pev_classname, Classname, sizeof(Classname))
	
	if(!equal(Classname, "weaponbox"))
		return FMRES_IGNORED
	
	static iOwner
	iOwner = pev(entity, pev_owner)
	
	if(equal(model, MODEL_W_OLD))
	{
		static weapon; weapon = fm_find_ent_by_owner(-1, weapon_lm, entity)
		
		if(!pev_valid(weapon))
			return FMRES_IGNORED;
		
		if(Get_BitVar(g_Had_LM, iOwner))
		{
			Remove_LM(iOwner)
			
			set_pev(weapon, pev_impulse, 1992015)
			engfunc(EngFunc_SetModel, entity, MODEL_W)
			
			return FMRES_SUPERCEDE
		}
	}

	return FMRES_IGNORED;
}

public fw_AddToFullPack_post(esState, iE, iEnt, iHost, iHostFlags, iPlayer, pSet)
{
	if(iEnt == g_Muzzleflash_Ent)
	{
		if(Get_BitVar(g_Muzzleflash, iHost))
		{
			set_es(esState, ES_Frame, float(random_num(0, 2)))
				
			set_es(esState, ES_RenderMode, kRenderTransAdd)
			set_es(esState, ES_RenderAmt, 255.0)
			
			UnSet_BitVar(g_Muzzleflash, iHost)
		}
			
		set_es(esState, ES_Skin, iHost)
		set_es(esState, ES_Body, 1)
		set_es(esState, ES_AimEnt, iHost)
		set_es(esState, ES_MoveType, MOVETYPE_FOLLOW)
	} else {
		if(is_alive(iHost) && get_player_weapon(iHost) == CSW_LM && Get_BitVar(g_Had_LM, iHost))
		{
			if(g_WeaponState[iHost] < STATE_CHARGING2)
				return
			if(g_MyHikari[iHost] == iEnt)
			{
				set_es(esState, ES_Frame, float(random_num(0, 8)))
					
				set_es(esState, ES_RenderMode, kRenderTransAdd)
				set_es(esState, ES_RenderAmt, 255.0)
				
				set_es(esState, ES_Skin, iHost)
				set_es(esState, ES_Body, 1)
				set_es(esState, ES_AimEnt, iHost)
				set_es(esState, ES_MoveType, MOVETYPE_FOLLOW)
			}
		} 
	}
}

public fw_CheckVisibility(iEntity, pSet)
{
	if(iEntity == g_Muzzleflash_Ent)
	{
		forward_return(FMV_CELL, 1)
		return FMRES_SUPERCEDE
	} else if(pev(iEntity, pev_impulse) == 1125) {
		forward_return(FMV_CELL, 1)
		return FMRES_SUPERCEDE
	}
	
	return FMRES_IGNORED
}

public fw_Item_Deploy_Post(Ent)
{
	if(pev_valid(Ent) != 2)
		return
	static Id; Id = get_pdata_cbase(Ent, 41, 4)
	if(get_pdata_cbase(Id, 373) != Ent)
		return
	if(!Get_BitVar(g_Had_LM, Id))
		return
		
	g_WeaponState[Id] = STATE_NONE

	set_pev(Id, pev_viewmodel2, MODEL_V)
	set_pev(Id, pev_weaponmodel2, MODEL_PA)

	set_pdata_string(Id, (492) * 4, ANIM_EXT, -1 , 20)
	set_pev(Id, pev_maxspeed, PLAYER_SPEED)
	
	Set_PlayerNextAttack(Id, TIME_DRAW)
	Set_WeaponIdleTime(Id, CSW_LM, TIME_DRAW + 0.25)
	
	// Check Light
	if(pev_valid(g_MyHikari[Id]) == 2)
	{
		set_pev(g_MyHikari[Id], pev_nextthink, get_gametime() + 0.1)
		set_pev(g_MyHikari[Id], pev_flags, FL_KILLME)
	}
	
	Set_WeaponAnim(Id, ANIME_DRAW)
}

public fw_Item_AddToPlayer_Post(Ent, id)
{
	if(!pev_valid(Ent))
		return HAM_IGNORED
		
	if(pev(Ent, pev_impulse) == 1992015)
	{
		Set_BitVar(g_Had_LM, id)
		set_pev(Ent, pev_impulse, 0)
	}
	
	if(Get_BitVar(g_Had_LM, id))
	{
		message_begin(MSG_ONE_UNRELIABLE, g_MsgWeaponList, _, id)
		write_string("weapon_laserminigun")
		write_byte(3)
		write_byte(240)
		write_byte(-1)
		write_byte(-1)
		write_byte(0)
		write_byte(4)
		write_byte(CSW_LM)
		write_byte(0)
		message_end()
	}
	
	return HAM_HANDLED	
}

public fw_Item_PostFrame(ent)
{
	static id; id = pev(ent, pev_owner)
	if(!is_user_alive(id))
		return HAM_IGNORED
	if(!Get_BitVar(g_Had_LM, id))
		return HAM_IGNORED	
	
	static Float:flNextAttack; flNextAttack = get_pdata_float(id, 83, 5)
	static bpammo; bpammo = cs_get_user_bpammo(id, CSW_LM)
	
	static iClip; iClip = get_pdata_int(ent, 51, 4)
	static fInReload; fInReload = get_pdata_int(ent, 54, 4)
	
	if(fInReload && flNextAttack <= 0.0)
	{
		static temp1
		temp1 = min(CLIP - iClip, bpammo)

		set_pdata_int(ent, 51, iClip + temp1, 4)
		cs_set_user_bpammo(id, CSW_LM, bpammo - temp1)		
		
		set_pdata_int(ent, 54, 0, 4)
		fInReload = 0
	}		
	
	return HAM_IGNORED
}

public fw_Weapon_Reload(ent)
{
	static id; id = pev(ent, pev_owner)
	if(!is_user_alive(id))
		return HAM_IGNORED
	if(!Get_BitVar(g_Had_LM, id))
		return HAM_IGNORED	

	g_Clip[id] = -1
		
	static BPAmmo; BPAmmo = cs_get_user_bpammo(id, CSW_LM)
	static iClip; iClip = get_pdata_int(ent, 51, 4)
		
	if(BPAmmo <= 0)
		return HAM_SUPERCEDE
	if(iClip >= CLIP)
		return HAM_SUPERCEDE		
			
	g_Clip[id] = iClip	
	
	return HAM_HANDLED
}

public fw_Weapon_Reload_Post(ent)
{
	static id; id = pev(ent, pev_owner)
	if(!is_user_alive(id))
		return HAM_IGNORED
	if(!Get_BitVar(g_Had_LM, id))
		return HAM_IGNORED	
	
	if((get_pdata_int(ent, 54, 4) == 1))
	{ // Reload
		if(g_Clip[id] == -1)
			return HAM_IGNORED
		
		set_pdata_int(ent, 51, g_Clip[id], 4)
		Set_WeaponAnim(id, ANIME_RELOAD)
		
		Set_PlayerNextAttack(id, TIME_RELOAD)
	}
	
	return HAM_HANDLED
}

public fw_Weapon_WeaponIdle_Post( iEnt )
{
	if(pev_valid(iEnt) != 2)
		return
	static Id; Id = get_pdata_cbase(iEnt, 41, 4)
	if(get_pdata_cbase(Id, 373) != iEnt)
		return
	if(!Get_BitVar(g_Had_LM, Id))
		return
		
	if(get_pdata_float(iEnt, 48, 4) <= 0.25)
	{
		Set_WeaponAnim(Id, ANIME_IDLE)
		set_pdata_float(iEnt, 48, 20.0, 4)
	}	
}

public fw_Weapon_PrimaryAttack(Ent)
{
	static id; id = pev(Ent, pev_owner)
	pev(id, pev_punchangle, g_Recoil[id])
	
	return HAM_IGNORED
}

public fw_Weapon_PrimaryAttack_Post(Ent)
{
	static id; id = pev(Ent, pev_owner)
	
	if(Get_BitVar(g_Had_LM, id) && cs_get_weapon_ammo(Ent) > 0)
	{
		static Float:Push[3]
		pev(id, pev_punchangle, Push)
		xs_vec_sub(Push, g_Recoil[id], Push)
		
		xs_vec_mul_scalar(Push, RECOIL, Push)
		xs_vec_add(Push, g_Recoil[id], Push)
		set_pev(id, pev_punchangle, Push)
		
		set_pdata_float(Ent, 62 , 0.1, 4)
		Set_BitVar(g_Muzzleflash, id)
	}
}

public fw_TraceAttack_World(Victim, Attacker, Float:Damage, Float:Direction[3], Ptr, DamageBits)
{
	if(!is_connected(Attacker))
		return HAM_IGNORED	
	if(get_player_weapon(Attacker) != CSW_LM || !Get_BitVar(g_Had_LM, Attacker))
		return HAM_IGNORED
		
	static Float:flEnd[3], Float:vecPlane[3]
		
	get_tr2(Ptr, TR_vecEndPos, flEnd)
	get_tr2(Ptr, TR_vecPlaneNormal, vecPlane)		
			
	Make_BulletHole(Attacker, flEnd, Damage)
	Make_BulletSmoke(Attacker, Ptr)

	SetHamParamFloat(3, float(DAMAGE_A))
	
	return HAM_HANDLED
}

public fw_TraceAttack_Player(Victim, Attacker, Float:Damage, Float:Direction[3], Ptr, DamageBits)
{
	if(!is_connected(Attacker))
		return HAM_IGNORED	
	if(get_player_weapon(Attacker) != CSW_LM || !Get_BitVar(g_Had_LM, Attacker))
		return HAM_IGNORED

	static Float:flEnd[3]
	get_tr2(Ptr, TR_vecEndPos, flEnd)
		
	engfunc(EngFunc_MessageBegin, MSG_PAS, SVC_TEMPENTITY, flEnd, 0)
	write_byte(TE_EXPLOSION)
	engfunc(EngFunc_WriteCoord, flEnd[0])
	engfunc(EngFunc_WriteCoord, flEnd[1])
	engfunc(EngFunc_WriteCoord, flEnd[2])
	write_short(g_SmokePuff_SprId)
	write_byte(5)
	write_byte(30)
	write_byte(TE_EXPLFLAG_NODLIGHTS | TE_EXPLFLAG_NOSOUND | TE_EXPLFLAG_NOPARTICLES)
	message_end()
		
	SetHamParamFloat(3, float(DAMAGE_A))
	
	return HAM_HANDLED
}

/* ===============================
------------- SAFETY -------------
=================================*/
public Register_SafetyFunc()
{
	register_event("CurWeapon", "Safety_CurWeapon", "be", "1=1")
	
	RegisterHam(Ham_Spawn, "player", "fw_Safety_Spawn_Post", 1)
	RegisterHam(Ham_Killed, "player", "fw_Safety_Killed_Post", 1)
}

public Register_SafetyFuncBot(id)
{
	RegisterHamFromEntity(Ham_Spawn, id, "fw_Safety_Spawn_Post", 1)
	RegisterHamFromEntity(Ham_Killed, id, "fw_Safety_Killed_Post", 1)
}

public Safety_Connected(id)
{
	Set_BitVar(g_IsConnected, id)
	UnSet_BitVar(g_IsAlive, id)
	
	g_PlayerWeapon[id] = 0
}

public Safety_Disconnected(id)
{
	UnSet_BitVar(g_IsConnected, id)
	UnSet_BitVar(g_IsAlive, id)
	
	g_PlayerWeapon[id] = 0
}

public Safety_CurWeapon(id)
{
	if(!is_alive(id))
		return
		
	static CSW; CSW = read_data(2)
	if(g_PlayerWeapon[id] != CSW) g_PlayerWeapon[id] = CSW
}

public fw_Safety_Spawn_Post(id)
{
	if(!is_user_alive(id))
		return
		
	Set_BitVar(g_IsAlive, id)
}

public fw_Safety_Killed_Post(id)
{
	UnSet_BitVar(g_IsAlive, id)
}

public is_alive(id)
{
	if(!(1 <= id <= 32))
		return 0
	if(!Get_BitVar(g_IsConnected, id))
		return 0
	if(!Get_BitVar(g_IsAlive, id)) 
		return 0
	
	return 1
}

public is_connected(id)
{
	if(!(1 <= id <= 32))
		return 0
	if(!Get_BitVar(g_IsConnected, id))
		return 0
	
	return 1
}

public get_player_weapon(id)
{
	if(!is_alive(id))
		return 0
	
	return g_PlayerWeapon[id]
}

/* ===============================
--------- End of SAFETY ----------
=================================*/

stock Set_WeaponAnim(id, anim)
{
	set_pev(id, pev_weaponanim, anim)
	
	message_begin(MSG_ONE_UNRELIABLE, SVC_WEAPONANIM, {0, 0, 0}, id)
	write_byte(anim)
	write_byte(pev(id, pev_body))
	message_end()
}

stock Make_BulletHole(id, Float:Origin[3], Float:Damage)
{
	// Find target
	static Decal; Decal = random_num(41, 45)
	static LoopTime; 
	
	if(Damage > 100.0) LoopTime = 2
	else LoopTime = 1
	
	for(new i = 0; i < LoopTime; i++)
	{
		// Put decal on "world" (a wall)
		message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
		write_byte(TE_WORLDDECAL)
		engfunc(EngFunc_WriteCoord, Origin[0])
		engfunc(EngFunc_WriteCoord, Origin[1])
		engfunc(EngFunc_WriteCoord, Origin[2])
		write_byte(Decal)
		message_end()
		
		// Show sparcles
		message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
		write_byte(TE_GUNSHOTDECAL)
		engfunc(EngFunc_WriteCoord, Origin[0])
		engfunc(EngFunc_WriteCoord, Origin[1])
		engfunc(EngFunc_WriteCoord, Origin[2])
		write_short(id)
		write_byte(Decal)
		message_end()
	}
}

stock Make_BulletSmoke(id, TrResult)
{
	static Float:vecSrc[3], Float:vecEnd[3], TE_FLAG
	
	get_weapon_attachment(id, vecSrc)
	global_get(glb_v_forward, vecEnd)
    
	xs_vec_mul_scalar(vecEnd, 8192.0, vecEnd)
	xs_vec_add(vecSrc, vecEnd, vecEnd)

	get_tr2(TrResult, TR_vecEndPos, vecSrc)
	get_tr2(TrResult, TR_vecPlaneNormal, vecEnd)
    
	xs_vec_mul_scalar(vecEnd, 2.5, vecEnd)
	xs_vec_add(vecSrc, vecEnd, vecEnd)
    
	TE_FLAG |= TE_EXPLFLAG_NODLIGHTS
	TE_FLAG |= TE_EXPLFLAG_NOSOUND
	TE_FLAG |= TE_EXPLFLAG_NOPARTICLES
	
	engfunc(EngFunc_MessageBegin, MSG_PAS, SVC_TEMPENTITY, vecEnd, 0)
	write_byte(TE_EXPLOSION)
	engfunc(EngFunc_WriteCoord, vecEnd[0])
	engfunc(EngFunc_WriteCoord, vecEnd[1])
	engfunc(EngFunc_WriteCoord, vecEnd[2] - 10.0)
	write_short(g_SmokePuff_SprId)
	write_byte(2)
	write_byte(50)
	write_byte(TE_FLAG)
	message_end()
}

stock get_weapon_attachment(id, Float:output[3], Float:fDis = 40.0)
{ 
	static Float:vfEnd[3], viEnd[3] 
	get_user_origin(id, viEnd, 3)  
	IVecFVec(viEnd, vfEnd) 
	
	static Float:fOrigin[3], Float:fAngle[3]
	
	pev(id, pev_origin, fOrigin) 
	pev(id, pev_view_ofs, fAngle)
	
	xs_vec_add(fOrigin, fAngle, fOrigin) 
	
	static Float:fAttack[3]
	
	xs_vec_sub(vfEnd, fOrigin, fAttack)
	xs_vec_sub(vfEnd, fOrigin, fAttack) 
	
	static Float:fRate
	
	fRate = fDis / vector_length(fAttack)
	xs_vec_mul_scalar(fAttack, fRate, fAttack)
	
	xs_vec_add(fOrigin, fAttack, output)
}

stock get_position(id,Float:forw, Float:right, Float:up, Float:vStart[])
{
	new Float:vOrigin[3], Float:vAngle[3], Float:vForward[3], Float:vRight[3], Float:vUp[3]
	
	pev(id, pev_origin, vOrigin)
	pev(id, pev_view_ofs,vUp) //for player
	xs_vec_add(vOrigin,vUp,vOrigin)
	pev(id, pev_v_angle, vAngle) // if normal entity ,use pev_angles
	
	angle_vector(vAngle,ANGLEVECTOR_FORWARD,vForward) //or use EngFunc_AngleVectors
	angle_vector(vAngle,ANGLEVECTOR_RIGHT,vRight)
	angle_vector(vAngle,ANGLEVECTOR_UP,vUp)
	
	vStart[0] = vOrigin[0] + vForward[0] * forw + vRight[0] * right + vUp[0] * up
	vStart[1] = vOrigin[1] + vForward[1] * forw + vRight[1] * right + vUp[1] * up
	vStart[2] = vOrigin[2] + vForward[2] * forw + vRight[2] * right + vUp[2] * up
}

stock get_speed_vector(const Float:origin1[3],const Float:origin2[3],Float:speed, Float:new_velocity[3])
{
	new_velocity[0] = origin2[0] - origin1[0]
	new_velocity[1] = origin2[1] - origin1[1]
	new_velocity[2] = origin2[2] - origin1[2]
	new Float:num = floatsqroot(speed*speed / (new_velocity[0]*new_velocity[0] + new_velocity[1]*new_velocity[1] + new_velocity[2]*new_velocity[2]))
	new_velocity[0] *= num
	new_velocity[1] *= num
	new_velocity[2] *= num
	
	return 1;
}

stock Set_WeaponIdleTime(id, WeaponId ,Float:TimeIdle)
{
	static entwpn; entwpn = fm_get_user_weapon_entity(id, WeaponId)
	if(!pev_valid(entwpn)) 
		return
		
	set_pdata_float(entwpn, 46, TimeIdle, 4)
	set_pdata_float(entwpn, 47, TimeIdle, 4)
	set_pdata_float(entwpn, 48, TimeIdle + 0.5, 4)
}

stock Set_PlayerNextAttack(id, Float:nexttime)
{
	set_pdata_float(id, 83, nexttime, 5)
}


stock Get_Position(id,Float:forw, Float:right, Float:up, Float:vStart[])
{
	static Float:vOrigin[3], Float:vAngle[3], Float:vForward[3], Float:vRight[3], Float:vUp[3]
	
	pev(id, pev_origin, vOrigin)
	pev(id, pev_view_ofs,vUp) //for player
	xs_vec_add(vOrigin,vUp,vOrigin)
	pev(id, pev_v_angle, vAngle) // if normal entity ,use pev_angles
	
	angle_vector(vAngle,ANGLEVECTOR_FORWARD,vForward) //or use EngFunc_AngleVectors
	angle_vector(vAngle,ANGLEVECTOR_RIGHT,vRight)
	angle_vector(vAngle,ANGLEVECTOR_UP,vUp)
	
	vStart[0] = vOrigin[0] + vForward[0] * forw + vRight[0] * right + vUp[0] * up
	vStart[1] = vOrigin[1] + vForward[1] * forw + vRight[1] * right + vUp[1] * up
	vStart[2] = vOrigin[2] + vForward[2] * forw + vRight[2] * right + vUp[2] * up
}

stock Eject_Shell(id, Shell_ModelIndex, Float:Time) // By Dias
{
	static Ent; Ent = get_pdata_cbase(id, 373, 5)
	if(!pev_valid(Ent))
		return

        set_pdata_int(Ent, 57, Shell_ModelIndex, 4)
        set_pdata_float(id, 111, get_gametime() + Time)
}


public Eject_Shell2(id, ShellID, Right)
{
	static Float:player_origin[3], Float:origin[3], Float:origin2[3], Float:gunorigin[3], Float:oldangles[3], Float:v_forward[3], Float:v_forward2[3], Float:v_up[3], Float:v_up2[3], Float:v_right[3], Float:v_right2[3], Float:viewoffsets[3];
	
	pev(id,pev_v_angle, oldangles); pev(id,pev_origin,player_origin); pev(id, pev_view_ofs, viewoffsets);

	engfunc(EngFunc_MakeVectors, oldangles)
	
	global_get(glb_v_forward, v_forward); global_get(glb_v_up, v_up); global_get(glb_v_right, v_right);
	global_get(glb_v_forward, v_forward2); global_get(glb_v_up, v_up2); global_get(glb_v_right, v_right2);
	
	xs_vec_add(player_origin, viewoffsets, gunorigin);
	
	if(!Right)
	{
		xs_vec_mul_scalar(v_forward, 9.0, v_forward); xs_vec_mul_scalar(v_right, -5.0, v_right);
		xs_vec_mul_scalar(v_up, -3.7, v_up);
		xs_vec_mul_scalar(v_forward2, 8.9, v_forward2); xs_vec_mul_scalar(v_right2, -4.9, v_right2);
		xs_vec_mul_scalar(v_up2, -4.0, v_up2);
	} else {
		xs_vec_mul_scalar(v_forward, 9.0, v_forward); xs_vec_mul_scalar(v_right, 5.0, v_right);
		xs_vec_mul_scalar(v_up, -3.7, v_up);
		xs_vec_mul_scalar(v_forward2, 8.9, v_forward2); xs_vec_mul_scalar(v_right2, 4.9, v_right2);
		xs_vec_mul_scalar(v_up2, -4.0, v_up2);
	}
	
	xs_vec_add(gunorigin, v_forward, origin);
	xs_vec_add(gunorigin, v_forward2, origin2);
	xs_vec_add(origin, v_right, origin);
	xs_vec_add(origin2, v_right2, origin2);
	xs_vec_add(origin, v_up, origin);
	xs_vec_add(origin2, v_up2, origin2);

	static Float:velocity[3]
	get_speed_vector(origin2, origin, random_float(140.0, 160.0), velocity)

	static angle; angle = random_num(0, 360)

	message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
	write_byte(TE_MODEL)
	engfunc(EngFunc_WriteCoord, origin[0])
	engfunc(EngFunc_WriteCoord,origin[1])
	engfunc(EngFunc_WriteCoord,origin[2])
	engfunc(EngFunc_WriteCoord,velocity[0])
	engfunc(EngFunc_WriteCoord,velocity[1])
	engfunc(EngFunc_WriteCoord,velocity[2])
	write_angle(angle)
	write_short(ShellID)
	write_byte(1)
	write_byte(20)
	message_end()
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1042\\ f0\\ fs16 \n\\ par }
*/

and this
Code:
#include <amxmodx>
#include <engine>
#include <fakemeta_util>
#include <hamsandwich>
#include <cstrike>

#define PLUGIN "AMXX Gungnir"
#define VERSION "2.0"
#define AUTHOR "Asdian"

// Data Config
#define P_GUNGNIR "models/p_gungnira.mdl"
#define P_GUNGNIR2 "models/p_gungnirb.mdl"
#define V_GUNGNIR "models/v_gungnir.mdl"
#define W_GUNGNIR "models/w_gungnir.mdl"

#define MF_W "sprites/muzzleflash81.spr"
#define MODEL_W_OLD "models/w_mac10.mdl"
#define WEAPON_CODE 02062019

#define CSW_GUNGNIR CSW_MAC10
#define weapon_gungnir "weapon_mac10"

enum _:NewAnim
{
	ANIM_IDLE = 0,
	ANIM_RELOAD,
	ANIM_DRAW,
	ANIM_SHOOT_START,
	ANIM_SHOOT_LOOP,
	ANIM_SHOOT_END,
	ANIM_SHOOT2,
	ANIM_SHOOT2_CHARGE,
	ANIM_SHOOT2_SHOTCHARGE,
	ANIM_CHARGE_LOOP
}

new const SOUND_FIRE[][] = 
{
	"weapons/gungnir_shoot_loop.wav",
	"weapons/gungnir_shoot_end.wav",
	"weapons/gungnir_shoot_b.wav",
	"weapons/gungnir_charge_shoot1.wav",
	
	// exps
	"weapons/gungnir_shoot_b_exp.wav",
	"weapons/gungnir_charge_shoot_exp.wav",
	"weapons/gungnir_charge_shoot_exp2.wav"
}

new const EXP_MODELS[][] = 
{
	"sprites/ef_gungnir_aexplo.spr",
	"sprites/ef_gungnir_bexplo.spr",
	"sprites/ef_gungnir_chargeexplo.spr",
	"sprites/ef_gungnir_lightline1.spr",
	"sprites/ef_gungnir_lightline2.spr",
	"sprites/ef_gungnir_missile.spr",
	"sprites/ef_gungnir_xbeam.spr",
	
	"models/gungnir_missile.mdl"
}

// Weapon Config
#define ACCURACY 23 // 0 - 100 ; -1 Default
#define CLIP 50
#define BPAMMO 999
#define SPEED 0.113
#define RECOIL 0.5
#define RELOAD_TIME 2.03

#define ELECTRO_DAMAGE 50.0
#define ELECTRO_RANGE 256.0
#define ELECTRO_KNOCKBACK 150.0 // the velocity of victim when got damage

// base damage
#define WDAMG_PLASMA 500.0
#define WDAMG_CHARGE 700.0
#define WDAMG_BEAM 175.0
	
// range
#define WRANGE_PLASMA 210.0
#define WRANGE_CHARGE 250.0
#define WRANGE_BEAM 75.0
	
// knockback
#define WKNOCK_CHARGE 25.0 // only charge

// MACROS
#define Get_BitVar(%1,%2) (%1 & (1 << (%2 & 31)))
#define Set_BitVar(%1,%2) %1 |= (1 << (%2 & 31))
#define UnSet_BitVar(%1,%2) %1 &= ~(1 << (%2 & 31))

new g_cachde_mf, Float:g_cache_frame_mf, g_cache_light, g_cache_hit, g_cache_exp[2], g_cache_beam[2], g_SpraySpr, g_DropSpr
new g_Had_Base, g_Clip[33], g_OldWeapon[33], g_Dprd, g_iVic[3]
	
// Safety
new g_HamBot
new g_IsConnected, g_IsAlive, g_PlayerWeapon[33]

public plugin_init()
{
	register_plugin(PLUGIN, VERSION, AUTHOR)
	
	// Safety
	Register_SafetyFunc()
	
	// Event
	register_event("CurWeapon", "Event_CurWeapon", "be", "1=1")
	register_message(get_user_msgid("DeathMsg"), "message_DeathMsg")
	
	// Forward
	register_forward(FM_UpdateClientData, "fw_UpdateClientData_Post", 1)
	register_forward(FM_SetModel, "fw_SetModel")
	
	// Ham
	RegisterHam(Ham_Item_Deploy, weapon_gungnir, "fw_Item_Deploy_Post", 1)	
	RegisterHam(Ham_Item_AddToPlayer, weapon_gungnir, "fw_Item_AddToPlayer_Post", 1)
	RegisterHam(Ham_Item_PostFrame, weapon_gungnir, "fw_Item_PostFrame")	
	RegisterHam(Ham_Weapon_Reload, weapon_gungnir, "fw_Weapon_Reload")
	RegisterHam(Ham_Weapon_Reload, weapon_gungnir, "fw_Weapon_Reload_Post", 1)	
	RegisterHam(Ham_Think, "env_sprite", "fw_MF_Think")
	RegisterHam(Ham_Think, "info_target", "HamF_InfoTarget_Think")
	RegisterHam(Ham_Touch, "info_target", "HamF_InfoTarget_Touch")
	
	// Cache
	register_clcmd("gimme_gungnir", "Get_Base")
	register_clcmd("weapon_gungnir", "hook_weapon")
	//g_Dprd = zp_register_extra_item("Gungnir", 10, ZP_TEAM_HUMAN | ZP_TEAM_SURVIVOR)
}

public hook_weapon(id) engclient_cmd(id, weapon_gungnir)

public plugin_precache()
{
	precache_model(P_GUNGNIR)
	precache_model(P_GUNGNIR2)
	precache_model(V_GUNGNIR)
	precache_model(W_GUNGNIR)
	
	new i
	for(i = 0; i < sizeof SOUND_FIRE; i++) precache_sound(SOUND_FIRE[i])
	for(i = 0; i < sizeof EXP_MODELS; i++)
	{
		if(!i) g_cache_hit = precache_model(EXP_MODELS[i])
		else if(i == 1) g_cache_exp[0] = precache_model(EXP_MODELS[i])
		else if(i == 2) g_cache_exp[1] = precache_model(EXP_MODELS[i])
		else if(i == 3) g_cache_beam[0] = precache_model(EXP_MODELS[i])
		else if(i == 4) g_cache_beam[1] = precache_model(EXP_MODELS[i])
		else if(i == 6) g_cache_light = precache_model(EXP_MODELS[i])
		else precache_model(EXP_MODELS[i])
	}
	precache_generic("sprites/weapon_gungnir.txt")
	
	g_SpraySpr = precache_model("sprites/bloodspray.spr")
	g_DropSpr = precache_model("sprites/blood.spr")
	g_cachde_mf = precache_model(MF_W)
	g_cache_frame_mf = float(engfunc(EngFunc_ModelFrames, g_cachde_mf))
}

public message_DeathMsg(msg_id, msg_dest, msg_ent)
{
	new szWeapon[64]
	get_msg_arg_string(4, szWeapon, charsmax(szWeapon))
	
	if (strcmp(szWeapon, "mac10"))
		return PLUGIN_CONTINUE
	
	new id = get_msg_arg_int(1)
	new iEntity = get_pdata_cbase(id, 373)
	
	if (!pev_valid(iEntity) || get_pdata_int(iEntity, 43, 4) != CSW_GUNGNIR || !Get_BitVar(g_Had_Base, id))
		return PLUGIN_CONTINUE

	set_msg_arg_string(4, "gungnir")
	return PLUGIN_CONTINUE
}

public client_putinserver(id)
{
        Safety_Connected(id)
	
	if(!g_HamBot && is_user_bot(id))
	{
		g_HamBot = 1
		set_task(0.1, "Register_HamBot", id)
	}
}
 
public Register_HamBot(id)
{
	Register_SafetyFuncBot(id)
}
public client_disconnect(id)
{
        Safety_Disconnected(id)
}

public zp_extra_item_selected(i, d) if(d == g_Dprd) Get_Base(i)
//public zp_user_infected_post(i) if(zp_get_user_zombie(i)) Remove_Base(i)
//public zp_user_humanized_post(i) if(zp_get_user_survivor(i)) Remove_Base(i)

public Get_Base(id)
{
	Set_BitVar(g_Had_Base, id)
	
	Stock_Drop_Slot(id, 1)
	fm_give_item(id, weapon_gungnir)
	
	// Clip & Ammo
	static Ent; Ent = fm_get_user_weapon_entity(id, CSW_GUNGNIR)
	if(pev_valid(Ent)) cs_set_weapon_ammo(Ent, CLIP)
	cs_set_user_bpammo(id, CSW_GUNGNIR, BPAMMO)
	
	engfunc(EngFunc_MessageBegin, MSG_ONE_UNRELIABLE, get_user_msgid("CurWeapon"), {0, 0, 0}, id)
	write_byte(1)
	write_byte(CSW_GUNGNIR)
	write_byte(CLIP)
	message_end()
	
	ExecuteHamB(Ham_Item_Deploy, Ent)
}

public Remove_Base(id)
{
	UnSet_BitVar(g_Had_Base, id)
}

public Event_CurWeapon(id)
{
	static CSWID; CSWID = read_data(2)
	
	if((CSWID == CSW_GUNGNIR && g_OldWeapon[id] != CSW_GUNGNIR) && Get_BitVar(g_Had_Base, id))
	{
		 Draw_NewWeapon(id, CSWID)
	} else if((CSWID == CSW_GUNGNIR && g_OldWeapon[id] == CSW_GUNGNIR) && Get_BitVar(g_Had_Base, id)) {
		static Ent; Ent = fm_get_user_weapon_entity(id, CSW_GUNGNIR)
		if(!pev_valid(Ent))
		{
			g_OldWeapon[id] = get_user_weapon(id)
			return
		}
	} else if(CSWID != CSW_GUNGNIR && g_OldWeapon[id] == CSW_GUNGNIR) {
		Draw_NewWeapon(id, CSWID)
	}
	
	g_OldWeapon[id] = get_user_weapon(id)
}

public Draw_NewWeapon(id, CSW_ID)
{
	if(CSW_ID == CSW_GUNGNIR)
	{
		static ent
		ent = fm_get_user_weapon_entity(id, CSW_GUNGNIR)
		
		if(pev_valid(ent) && Get_BitVar(g_Had_Base, id))
			set_pev(ent, pev_effects, pev(ent, pev_effects) &~ EF_NODRAW) 
	} else {
		static ent
		ent = fm_get_user_weapon_entity(id, CSW_GUNGNIR)
		
		if(pev_valid(ent)) set_pev(ent, pev_effects, pev(ent, pev_effects) | EF_NODRAW) 			
	}
	
}
public fw_UpdateClientData_Post(id, sendweapons, cd_handle)
{
	if(!is_alive(id))
		return FMRES_IGNORED	
	if(get_user_weapon(id) == CSW_GUNGNIR && Get_BitVar(g_Had_Base, id))
		set_cd(cd_handle, CD_flNextAttack, get_gametime() + 0.001) 
	
	return FMRES_HANDLED
}

public fw_SetModel(entity, model[])
{
	if(!pev_valid(entity))
		return FMRES_IGNORED
	
	static Classname[32]
	pev(entity, pev_classname, Classname, sizeof(Classname))
	
	if(!equal(Classname, "weaponbox"))
		return FMRES_IGNORED
	
	static iOwner
	iOwner = pev(entity, pev_owner)
	
	if(equal(model, MODEL_W_OLD))
	{
		static weapon; weapon = find_ent_by_owner(-1, weapon_gungnir, entity)
		
		if(!pev_valid(weapon))
			return FMRES_IGNORED;
		
		if(Get_BitVar(g_Had_Base, iOwner))
		{
			set_pev(weapon, pev_impulse, WEAPON_CODE)
			engfunc(EngFunc_SetModel, entity, W_GUNGNIR)

			Remove_Base(iOwner)
			return FMRES_SUPERCEDE
		}
	}

	return FMRES_IGNORED;
}

public fw_Item_Deploy_Post(Ent)
{
	if(pev_valid(Ent) != 2)
		return
	static Id; Id = get_pdata_cbase(Ent, 41, 4)
	
	if(get_pdata_cbase(Id, 373) != Ent)
		return
	if(!Get_BitVar(g_Had_Base, Id))
		return
	
	set_pev(Id, pev_viewmodel2, V_GUNGNIR)
	set_pev(Id, pev_weaponmodel2, P_GUNGNIR)
	
	Set_WeaponAnim(Id, ANIM_DRAW)
	set_pdata_string(Id, (492 * 4), "m249", -1, 20)
	Set_WpnList(Id)
	
	set_pdata_float(Ent, 46, 1.03, 4)
	set_pdata_float(Ent, 47, 1.03, 4)
	set_pdata_float(Ent, 48, 1.03, 4)
	
	set_pev(Ent, pev_iuser1, 0);
	set_pev(Ent, pev_iuser2, 0);
	
	static iClip
	iClip = get_pdata_int(Ent, 51, 4)
	
	engfunc(EngFunc_MessageBegin, MSG_ONE_UNRELIABLE, get_user_msgid("CurWeapon"), {0, 0, 0}, Id)
	write_byte(1)
	write_byte(CSW_GUNGNIR)
	write_byte(iClip)
	message_end()
}

public fw_Item_AddToPlayer_Post(Ent, id)
{
	if(!pev_valid(Ent))
		return HAM_IGNORED
		
	if(pev(Ent, pev_impulse) == WEAPON_CODE)
	{
		Set_BitVar(g_Had_Base, id)
		set_pev(Ent, pev_impulse, 0)
	}
	
	return HAM_IGNORED	
}

public fw_Item_PostFrame(ent)
{
	static id; id = pev(ent, pev_owner)
	if(!is_user_alive(id))
		return HAM_IGNORED
	if(!Get_BitVar(g_Had_Base, id))
		return HAM_IGNORED	
	
	static Float:flNextAttack; flNextAttack = get_pdata_float(id, 83, 5)
	static bpammo; bpammo = cs_get_user_bpammo(id, CSW_GUNGNIR)
	
	static iClip; iClip = get_pdata_int(ent, 51, 4)
	static fInReload; fInReload = get_pdata_int(ent, 54, 4)
	
	if(fInReload && flNextAttack <= 0.0)
	{
		static temp1
		temp1 = min(CLIP - iClip, bpammo)

		set_pdata_int(ent, 51, iClip + temp1, 4)
		cs_set_user_bpammo(id, CSW_GUNGNIR, bpammo - temp1)		
		
		fInReload = 0
		set_pdata_int(ent, 54, fInReload, 4)
		set_pdata_float(ent, 46, 0.01, 4)
	}		
	
	WE_GUNGNIR(id, ent, iClip,bpammo,pev(id, pev_button))
	return HAM_IGNORED
}

public WE_GUNGNIR(id,iEnt,iClip, bpammo,iButton)
{
	new Float:flNextPrimaryAttack, Float:fCurTime, iState, Float:fSound, iCharge
	global_get(glb_time, fCurTime)
	pev(iEnt, pev_fuser1, fSound)
	pev(iEnt, pev_fuser2, flNextPrimaryAttack)
	iCharge = pev(iEnt, pev_iuser1)
	iState = pev(iEnt, pev_iuser2)
	new pEntity = -1
				
	if(get_pdata_float(iEnt, 46, 4) > 0.0)
		return
	
	if((!(iButton & IN_ATTACK) || !iClip) && iState == 1)
	{
		Set_WeaponAnim(id, ANIM_SHOOT_END)
		
		set_pdata_float(iEnt, 46, 0.33, 4)
		set_pdata_float(iEnt, 48, 0.33, 4)
		set_pev(iEnt, pev_iuser2, 0)
		
		emit_sound(id, CHAN_WEAPON, SOUND_FIRE[1], VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
	}
	
	if(!(iButton & IN_ATTACK2) && 0 < iCharge < 3)
	{
		new bool:iMax = (iCharge == 2) ? true : false
		
		static Float:vOrigin[3], Float:vVAngles[3], Float:vVec[3],Float:vAngle[3],Float:vecEnd2[3]
		engfunc(EngFunc_GetAttachment, id, 1, vOrigin, vAngle)
		pev(id, pev_v_angle, vVAngles);
	
		Stock_Get_Aiming(id, vecEnd2)
		Stock_GetSpeedVector(vOrigin, vecEnd2, iMax?3500.0:3200.0, vVec)
		
		vector_to_angle(vVec, vVAngles)
		if(vVAngles[0] > 90.0) vVAngles[0] = -(360.0 - vVAngles[0])
		
		new pEntity = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "info_target"));
		engfunc(EngFunc_SetModel, pEntity, EXP_MODELS[iMax?7:5]);
		engfunc(EngFunc_SetSize, pEntity, Float:{-0.5, -0.5, 0.5}, Float:{0.5, 0.5, 0.5})
		
		set_pev(pEntity, pev_classname, "gungnir_plasma");
		set_pev(pEntity, pev_movetype, MOVETYPE_FLY);
		set_pev(pEntity, pev_angles, vVAngles);
		set_pev(pEntity, pev_origin, vOrigin);
		set_pev(pEntity, pev_gravity, 0.01);
		set_pev(pEntity, pev_owner, id);
		set_pev(pEntity, pev_solid, SOLID_BBOX);
		set_pev(pEntity, pev_velocity, vVec);
		
		set_pev(pEntity, pev_frame, 0.0)
		set_pev(pEntity, pev_framerate, 1.0)
		set_pev(pEntity, pev_iuser1, iMax?1:0)
		
		if(!iMax) 
		{
			set_pev(pEntity, pev_renderamt, 255.0)
			set_pev(pEntity, pev_rendermode, kRenderTransAdd)
			set_pev(pEntity, pev_scale, 0.1)
		}
		
		if(iMax) 
		{
			set_pev(pEntity, pev_vuser1, vOrigin)
			set_pev(pEntity, pev_vuser2, vecEnd2)
		}
		set_pev(pEntity, pev_nextthink, get_gametime()+0.01)
		
		Set_WeaponAnim(id, iMax?ANIM_SHOOT2_SHOTCHARGE:ANIM_SHOOT2)
		emit_sound(id, CHAN_WEAPON, SOUND_FIRE[iMax?3:2], VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
		
		if(iClip >= 5) iClip -= 5
		else iClip = 0
		set_pdata_int(iEnt, 51, iClip, 4)
		
		set_pdata_float(iEnt, 46, iMax?3.13:0.5, 4)
		set_pdata_float(iEnt, 48, iMax?3.5:0.75, 4)
		
		Stock_SetPlayerAnim(id, iMax?"shoot_grenade":"shoot_m249")
		set_pev(id, pev_weaponmodel2, "")
		set_pev(iEnt, pev_iuser1, iMax?3:0)
		
		if(iMax) set_pev(iEnt, pev_fuser3, fCurTime + 0.33)
	}
	
	if(iCharge == 3 && fSound < fCurTime)
	{
		Stock_SetPlayerAnim(id, "aim_m249")
		set_pev(id, pev_weaponmodel2, P_GUNGNIR)
		set_pev(iEnt, pev_iuser1, 0)
	}
	
	if(iButton & IN_ATTACK && iClip)
	{
		if(fSound < fCurTime)
		{
			emit_sound(id, CHAN_WEAPON, SOUND_FIRE[0], VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
			set_pev(iEnt, pev_fuser1, fCurTime + 1.0)
		}
		
		if(!iState)
		{
			Set_WeaponAnim(id, ANIM_SHOOT_START)
			
			set_pdata_float(iEnt, 46, 0.23, 4)
			set_pdata_float(iEnt, 48, 0.23, 4)
			set_pev(iEnt, pev_iuser2, 1)
		}
		
		if(iState == 1)
		{
			iClip--
			set_pdata_int(iEnt, 51, iClip, 4)
			
			set_pdata_float(iEnt, 46, SPEED, 4)
			set_pdata_float(iEnt, 48, SPEED + 0.5, 4)
			
			MakeMuzzleFlash(id, iEnt)
			Set_WeaponAnim(id, ANIM_SHOOT_LOOP)
			Stock_SetPlayerAnim(id, "shoot_m249")
			
			if(flNextPrimaryAttack > fCurTime)
				return
	
			set_pev(iEnt, pev_fuser2, fCurTime + 0.01)
			
			new Float:fOrigin[3], Float:fEnd[3], Float:LOL[3][3]
			pev(id, pev_origin, fOrigin)
			Stock_Get_Postion(id, 64.0, 0.0, 0.0, fEnd)
			
			message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
			write_byte(TE_BEAMENTPOINT)
			write_short(id | 0x1000)
			engfunc(EngFunc_WriteCoord, fEnd[0])
			engfunc(EngFunc_WriteCoord, fEnd[1])
			engfunc(EngFunc_WriteCoord, fEnd[2])
			write_short(g_cache_light)
			write_byte(0) // framerate
			write_byte(0) // framerate
			write_byte(1) // life
			write_byte(40)  // width
			write_byte(10)// noise
			write_byte(26)// r, g, b
			write_byte(164)// r, g, b
			write_byte(255)// r, g, b
			write_byte(255)	// brightness
			write_byte(255)	// speed
			message_end()
			
			new k
			for(k = 0; k < 3; k++)
			{
				while((pEntity = engfunc(EngFunc_FindEntityInSphere, pEntity, fOrigin, ELECTRO_RANGE)) != 0)
				{
					if(pev(pEntity, pev_takedamage) == DAMAGE_NO) continue
					if(is_user_connected(pEntity) && pEntity != id)
						if(!can_damage(pEntity, id)) continue
					if(pEntity == id) continue
					if(k == 1 && pEntity == g_iVic[0])  continue
					if(k == 2 && (pEntity == g_iVic[0] || pEntity == g_iVic[1]))  continue
					
					if(pev_valid(pEntity))
					{
						new Float:tempOrigin[3]
						pev(pEntity, pev_origin, tempOrigin)
						
						if(get_distance_f(fOrigin, tempOrigin) < ELECTRO_RANGE)
							g_iVic[k] = pEntity
					}
				}
				
				pev(g_iVic[k], pev_origin, LOL[k])
				
				if(is_user_alive(g_iVic[k]) && can_damage(id, g_iVic[k]) && entity_range(id, g_iVic[k]) < ELECTRO_RANGE && !Stock_Blah(fOrigin, LOL[k], id))
				{
					engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, fOrigin, 0)
					write_byte(TE_EXPLOSION)
					engfunc(EngFunc_WriteCoord, LOL[k][0])
					engfunc(EngFunc_WriteCoord, LOL[k][1])
					engfunc(EngFunc_WriteCoord, LOL[k][2] - 15.0)
					write_short(g_cache_hit)
					write_byte(2)
					write_byte(30)
					write_byte(TE_EXPLFLAG_NODLIGHTS|TE_EXPLFLAG_NOSOUND|TE_EXPLFLAG_NOPARTICLES)
					message_end()
					
					engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, fOrigin, 0)
					write_byte(TE_BEAMPOINTS)
					engfunc(EngFunc_WriteCoord, LOL[k][0])
					engfunc(EngFunc_WriteCoord, LOL[k][1])
					engfunc(EngFunc_WriteCoord, LOL[k][2])
					engfunc(EngFunc_WriteCoord, fEnd[0])
					engfunc(EngFunc_WriteCoord, fEnd[1])
					engfunc(EngFunc_WriteCoord, fEnd[2])
					write_short(g_cache_light)
					write_byte(0)		// byte (starting frame) 
					write_byte(10)		// byte (frame rate in 0.1's) 
					write_byte(1)		// byte (life in 0.1's) 
					write_byte(55)		// byte (line width in 0.1's) 
					write_byte(17)		// byte (noise amplitude in 0.01's) 
					write_byte(26)		// byte,byte,byte (color) (R)
					write_byte(164)		// (G)
					write_byte(255)		// (B)
					write_byte(255)		// byte (brightness)
					write_byte(10)		// byte (scroll speed in 0.1's)
					message_end()
					
					ExecuteHamB(Ham_TakeDamage, g_iVic[k], id, id, ELECTRO_DAMAGE, DMG_SHOCK)
					
					if(1 <= g_iVic[k] <= 32)
					{
						new Float:vAttacker[3], Float:vVictim[3]
						pev(id, pev_origin, vAttacker)
						pev(g_iVic[k], pev_origin, vVictim)
						xs_vec_sub(vVictim, vAttacker, vVictim)
						
						new Float:fDistance
						fDistance = xs_vec_len(vVictim)
						xs_vec_mul_scalar(vVictim, 1 / fDistance, vVictim)
						xs_vec_mul_scalar(vVictim, ELECTRO_KNOCKBACK, vVictim)
						set_pev(g_iVic[k], pev_velocity, vVictim)
						
						SpawnBlood(LOL[k], get_pdata_int(g_iVic[k],89), floatround(ELECTRO_DAMAGE))
					}
				}
			}
		}
	}
	
	if(iButton & IN_ATTACK2 && iClip)
	{
		if(flNextPrimaryAttack > fCurTime)
			return
		
		switch(iCharge)
		{
			case 0:
			{
				set_pdata_float(iEnt, 46, 0.5, 4)
				
				set_pev(iEnt, pev_fuser2, fCurTime + 0.5)
				set_pev(iEnt, pev_iuser1, 1)
			}
			case 1:
			{
				Set_WeaponAnim(id, ANIM_SHOOT2_CHARGE)
				set_pdata_float(iEnt, 46, 2.03, 4)
				
				set_pev(iEnt, pev_fuser2, fCurTime + 2.03)
				set_pev(iEnt, pev_iuser1, 2)
			}
			case 2:
			{
				Set_WeaponAnim(id, ANIM_CHARGE_LOOP)
				set_pdata_float(iEnt, 48, 2.03, 4)
				set_pev(iEnt, pev_fuser2, fCurTime + 2.03)
				set_pev(iEnt, pev_iuser1, 2)
				
				set_pev(id, pev_weaponmodel2, P_GUNGNIR2)
				Stock_SetPlayerAnim(id, "aim_grenade")
			}
		}
	}
}

public fw_Weapon_Reload(ent)
{
	static id; id = pev(ent, pev_owner)
	if(!is_user_alive(id))
		return HAM_IGNORED
	if(!Get_BitVar(g_Had_Base, id))
		return HAM_IGNORED	

	g_Clip[id] = -1
		
	static BPAmmo; BPAmmo = cs_get_user_bpammo(id, CSW_GUNGNIR)
	static iClip; iClip = get_pdata_int(ent, 51, 4)
		
	if(BPAmmo <= 0 || iClip >= CLIP)
		return HAM_SUPERCEDE
			
	g_Clip[id] = iClip
	return HAM_IGNORED
}

public fw_Weapon_Reload_Post(ent)
{
	static id; id = pev(ent, pev_owner)
	if(!is_user_alive(id))
		return HAM_IGNORED
	if(!Get_BitVar(g_Had_Base, id))
		return HAM_IGNORED	
	if(g_Clip[id] == -1)
		return HAM_IGNORED
		
	set_pdata_int(ent, 51, g_Clip[id], 4)
	set_pdata_int(ent, 54, 1, 4)
	
	Set_WeaponAnim(id, ANIM_RELOAD)
	Set_PlayerNextAttack(id, RELOAD_TIME)
	Set_WeaponIdleTime(id, CSW_GUNGNIR,RELOAD_TIME)
	Stock_SetPlayerAnim(id, "reload_m249")
	return HAM_IGNORED
}

/* ===============================
------------- ENTITIES --------
=================================*/
public fw_MF_Think(ent)
{
	if(!pev_valid(ent))
		return
	
	static Classname[32]
	pev(ent, pev_classname, Classname, sizeof(Classname))
	
	if(equal(Classname, "despe_mf"))
	{
		static Float:fFrame, Float:fFrameMax
		pev(ent, pev_frame, fFrame)
		
		fFrameMax = g_cache_frame_mf
		
		fFrame += 1.0
		set_pev(ent, pev_frame, fFrame)
		
		if(fFrame >= fFrameMax) 
		{
			set_pev(ent, pev_flags, pev(ent, pev_flags) | FL_KILLME)
			return
		}
		set_pev(ent, pev_nextthink, get_gametime() + 0.01)
		return
	}
}

public HamF_InfoTarget_Think(iEnt)
{
	if(!pev_valid(iEnt))
		return
	
	static Classname[32]
	pev(iEnt, pev_classname, Classname, sizeof(Classname))
	
	if(!equal(Classname, "gungnir_plasma"))
		return
		
	new iOwner, iState
	iOwner = pev(iEnt, pev_owner)
	iState = pev(iEnt, pev_iuser1)
	
	if(!iState)
	{
		static Float:fFrame
		pev(iEnt, pev_frame, fFrame)
		
		fFrame += 1.0
		if(fFrame >= 10.0) fFrame = 0.0
		
		set_pev(iEnt, pev_frame, fFrame)
		set_pev(iEnt, pev_nextthink, get_gametime() + 0.01)
	}
	
	if(iState)
	{
		new Float:vecOri[3], Float:vEnd[3]
		pev(iEnt, pev_vuser1, vecOri)
		pev(iEnt, (iState==2)?pev_vuser2:pev_origin, vEnd)
		if(iState == 2) set_pev(iEnt, pev_origin, vEnd)
		
		engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, vecOri, 0)
		write_byte(TE_BEAMPOINTS)
		engfunc(EngFunc_WriteCoord, vEnd[0]) // end
		engfunc(EngFunc_WriteCoord, vEnd[1])
		engfunc(EngFunc_WriteCoord, vEnd[2])
		engfunc(EngFunc_WriteCoord, vecOri[0]) // start
		engfunc(EngFunc_WriteCoord, vecOri[1])
		engfunc(EngFunc_WriteCoord, vecOri[2])
		write_short(g_cache_beam[iState-1])
		write_byte(0)		// byte (starting frame) 
		write_byte(500)		// byte (frame rate in 0.1's) 
		write_byte(1)		// byte (life in 0.1's) 
		write_byte((iState==2)?150:50)		// byte (line width in 0.1's) 
		write_byte(0)		// byte (noise amplitude in 0.01's) 
		write_byte(200)		// byte,byte,byte (color) (R)
		write_byte(200)		// (G)
		write_byte(200)		// (B)
		write_byte(75)		// byte (brightness)
		write_byte((iState==2)?30:10)		// byte (scroll speed in 0.1's)
		message_end()
		
		static Float:vAngle[3]
		Stock_Get_Velocity_Angle(iEnt, vAngle)
		set_pev(iEnt, pev_angles, vAngle)
		
		static Float:fTimeRemove, Float:fDelay; 
		pev(iEnt, pev_ltime, fTimeRemove)
		pev(iEnt, pev_fuser4, fDelay)
		
		if(get_gametime() >= fDelay && pev(iEnt, pev_iuser4)) 
		{
			static Float:vVec[3], Float:vecEnd2[3]
			pev(iEnt, pev_vuser2, vecEnd2)
			Stock_GetSpeedVector(vecOri, vecEnd2, 5000.0, vVec)
			
			static iBall
			iBall = Stock_CreateEntityBase(iOwner, "info_target", MOVETYPE_FLY, "models/w_usp.mdl", "gungnir_plasma", SOLID_TRIGGER, 0.01)
			engfunc(EngFunc_SetSize, iBall, Float:{-50.0, -50.0, 0.0}, Float:{50.0, 50.0, 50.0})
			fm_set_rendering(iBall, kRenderFxGlowShell, 0, 0, 0, kRenderTransAlpha, 0)
			
			static Float:vAngle[3]
			Stock_Get_Velocity_Angle(iBall,vAngle)
			set_pev(iBall, pev_angles,vAngle)
			set_pev(iBall, pev_origin, vecOri)
			set_pev(iBall, pev_gravity, 0.01)
			set_pev(iBall, pev_velocity, vVec)
			set_pev(iBall, pev_iuser1, 2)
			set_pev(iBall, pev_vuser1, vecOri)
			set_pev(iBall, pev_vuser2, vecEnd2)
			
			emit_sound(iOwner, CHAN_VOICE, SOUND_FIRE[6], VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
			set_pev(iEnt, pev_iuser4, 0)
		}
		
		set_pev(iEnt, pev_nextthink, get_gametime() + 0.01)
		
		if(get_gametime() >= fTimeRemove && pev(iEnt, pev_iuser3)) 
		{
			set_pev(iEnt, pev_flags, pev(iEnt, pev_flags) | FL_KILLME);
			return
		}
	}
}

public HamF_InfoTarget_Touch(iEnt, iPtd)
{
	if(!pev_valid(iEnt))
		return HAM_IGNORED
	
	static Classname[32]
	pev(iEnt, pev_classname, Classname, sizeof(Classname))
	
	if(!equal(Classname, "gungnir_plasma"))
		return HAM_IGNORED
		
	new iOwner, Float:vecOri[3], iState
	iOwner = pev(iEnt, pev_owner)
	iState = pev(iEnt, pev_iuser1)
	pev(iEnt, pev_origin, vecOri)
	
	if(iPtd == iOwner)
		return HAM_IGNORED
		
	static Float:fDmg, Float:fRng, Float:fKnc
	if(!iState)
	{
		fDmg = WDAMG_PLASMA
		fRng = WRANGE_PLASMA
		fKnc = 1.0
	} else if(iState == 1) {
		fDmg = WDAMG_CHARGE
		fRng = WRANGE_CHARGE
		fKnc = WKNOCK_CHARGE
	} else if(iState == 2) {
		fDmg = WDAMG_BEAM
		fRng = WRANGE_BEAM
		fKnc = 1.0
	}
	
	new pEntity = -1
	while((pEntity = engfunc(EngFunc_FindEntityInSphere, pEntity, vecOri, fRng)) != 0)
	{
		if(pev(pEntity, pev_takedamage) == DAMAGE_NO) continue
		if(is_user_connected(pEntity) && pEntity != iOwner)
			if(!can_damage(pEntity, iOwner)) continue
		if(pEntity == iOwner) continue
		
		if(pev_valid(pEntity))
		{
			ExecuteHam(Ham_TakeDamage, pEntity, iOwner, iOwner, fDmg, DMG_BULLET)
			
			Stock_Fake_KnockBack(iOwner, pEntity, fKnc)
			if(is_user_alive(pEntity)) SpawnBlood(vecOri, get_pdata_int(pEntity,89), floatround(fDmg/5.0))
		}
	}
	
	if(iState < 2) 
	{
		engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, vecOri, 0)
		write_byte(TE_EXPLOSION)
		engfunc(EngFunc_WriteCoord, vecOri[0])
		engfunc(EngFunc_WriteCoord, vecOri[1])
		engfunc(EngFunc_WriteCoord, vecOri[2])
		write_short(g_cache_exp[iState])
		write_byte(10)
		write_byte(30)
		write_byte(TE_EXPLFLAG_NODLIGHTS|TE_EXPLFLAG_NOSOUND|TE_EXPLFLAG_NOPARTICLES)
		message_end()
		
		emit_sound(iOwner, CHAN_VOICE, SOUND_FIRE[4+iState], VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
	}
	
	if(!iState) engfunc(EngFunc_RemoveEntity, iEnt)
	if(iState)
	{
		set_pev(iEnt, pev_ltime, get_gametime() + 2.5)
		set_pev(iEnt, pev_iuser3, 1)
		set_pev(iEnt, pev_movetype, MOVETYPE_NONE);
		set_pev(iEnt, pev_solid, SOLID_NOT);
		
		if(iState == 1)
		{
			fm_set_rendering(iEnt, kRenderFxGlowShell, 0, 0, 0, kRenderTransAlpha, 0)
			set_pev(iEnt, pev_fuser4, get_gametime() + 1.5)
			set_pev(iEnt, pev_iuser4, 1)
		}
	}
	
	return HAM_IGNORED
}

public MakeMuzzleFlash(id, iEnt)
{
	static iMuz
	iMuz = Stock_CreateEntityBase(id, "env_sprite", MOVETYPE_FOLLOW, MF_W, "despe_mf", SOLID_NOT,0.01)
	set_pev(iMuz, pev_body, 1)
	set_pev(iMuz, pev_rendermode, kRenderTransAdd)
	set_pev(iMuz, pev_renderamt, 255.0)
	set_pev(iMuz, pev_aiment, id)
	set_pev(iMuz, pev_scale, 0.04)
	set_pev(iMuz, pev_frame, 0.0)
	set_pev(iMuz, pev_animtime, get_gametime())
	dllfunc(DLLFunc_Spawn, iMuz)
}

stock Stock_CreateEntityBase(id, classtype[], mvtyp, mdl[], class[], solid, Float:fNext)
{
	new pEntity = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, classtype))
	set_pev(pEntity, pev_movetype, mvtyp);
	set_pev(pEntity, pev_owner, id);
	engfunc(EngFunc_SetModel, pEntity, mdl);
	set_pev(pEntity, pev_classname, class);
	set_pev(pEntity, pev_solid, solid);
	set_pev(pEntity, pev_nextthink, get_gametime() + fNext)
	return pEntity
}

stock Stock_GetSpeedVector(const Float:origin1[3], const Float:origin2[3], Float:speed, Float:new_velocity[3])
{
	xs_vec_sub(origin2, origin1, new_velocity)
	new Float:num = floatsqroot(speed*speed / (new_velocity[0]*new_velocity[0] + new_velocity[1]*new_velocity[1] + new_velocity[2]*new_velocity[2]))
	xs_vec_mul_scalar(new_velocity, num, new_velocity)
}

stock Stock_Get_Aiming(id, Float:end[3])
{
	new Float:start[3], Float:view_ofs[3]
	pev(id, pev_origin, start)
	pev(id, pev_view_ofs, view_ofs)
	xs_vec_add(start, view_ofs, start)

	pev(id, pev_v_angle, end)
	engfunc(EngFunc_MakeVectors, end)
	global_get(glb_v_forward, end)
	xs_vec_mul_scalar(end, 8192.0, end)
	xs_vec_add(start, end, end)
	new ptr = create_tr2();
	engfunc(EngFunc_TraceLine, start, end, DONT_IGNORE_MONSTERS, id, ptr)
	get_tr2(ptr, TR_vecEndPos, end)
	free_tr2(ptr)
}

public Stock_Fake_KnockBack(id, iVic, Float:iKb)
{
	if(iVic > 32) return
	
	new Float:vAttacker[3], Float:vVictim[3], Float:vVelocity[3], flags
	pev(id, pev_origin, vAttacker)
	pev(iVic, pev_origin, vVictim)
	vAttacker[2] = vVictim[2] = 0.0
	flags = pev(id, pev_flags)
	
	xs_vec_sub(vVictim, vAttacker, vVictim)
	new Float:fDistance
	fDistance = xs_vec_len(vVictim)
	xs_vec_mul_scalar(vVictim, 1 / fDistance, vVictim)
	
	pev(iVic, pev_velocity, vVelocity)
	xs_vec_mul_scalar(vVictim, iKb, vVictim)
	xs_vec_mul_scalar(vVictim, 50.0, vVictim)
	vVictim[2] = xs_vec_len(vVictim) * 0.15
	
	if(flags &~ FL_ONGROUND)
	{
		xs_vec_mul_scalar(vVictim, 1.2, vVictim)
		vVictim[2] *= 0.4
	}
	if(xs_vec_len(vVictim) > xs_vec_len(vVelocity)) set_pev(iVic, pev_velocity, vVictim)
}	

stock Float:Stock_Blah(Float:start[3], Float:end[3], ignore_ent)
{
	static ptr
	ptr = create_tr2()
	engfunc(EngFunc_TraceLine, start, end, IGNORE_MONSTERS, ignore_ent, ptr)
	
	static Float:EndPos[3]
	get_tr2(ptr, TR_vecEndPos, EndPos)

	free_tr2(ptr)
	return get_distance_f(end, EndPos)
} 
stock can_damage(id1, id2)
{
	if(id1 <= 0 || id1 >= 33 || id2 <= 0 || id2 >= 33)
		return 1
		
	// Check team
	return(get_pdata_int(id1, 114) != get_pdata_int(id2, 114))
}
stock Stock_Get_Velocity_Angle(entity, Float:output[3])
{
	static Float:velocity[3]
	pev(entity, pev_velocity, velocity)
	vector_to_angle(velocity, output)
	if( output[0] > 90.0 ) output[0] = -(360.0 - output[0])
}
////////////////////////////
public Set_WpnList(id)
{
	message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("WeaponList"), _, id)
	write_string(Get_BitVar(g_Had_Base, id) ? "weapon_gungnir" : weapon_gungnir)
	write_byte(6)
	write_byte(100)
	write_byte(-1)
	write_byte(-1)
	write_byte(0)
	write_byte(13)
	write_byte(CSW_GUNGNIR)
	write_byte(0)
	message_end()
}
/* ===============================
------------- SAFETY -------------
=================================*/
public Register_SafetyFunc()
{
	register_event("CurWeapon", "Safety_CurWeapon", "be", "1=1")
	
	RegisterHam(Ham_Spawn, "player", "fw_Safety_Spawn_Post", 1)
	RegisterHam(Ham_Killed, "player", "fw_Safety_Killed_Post", 1)
}

public Register_SafetyFuncBot(id)
{
	RegisterHamFromEntity(Ham_Spawn, id, "fw_Safety_Spawn_Post", 1)
	RegisterHamFromEntity(Ham_Killed, id, "fw_Safety_Killed_Post", 1)
}

public Safety_Connected(id)
{
	Set_BitVar(g_IsConnected, id)
	UnSet_BitVar(g_IsAlive, id)
	
	g_PlayerWeapon[id] = 0
}

public Safety_Disconnected(id)
{
	UnSet_BitVar(g_IsConnected, id)
	UnSet_BitVar(g_IsAlive, id)
	
	g_PlayerWeapon[id] = 0
}

public Safety_CurWeapon(id)
{
	if(!is_alive(id))
		return
		
	static CSW; CSW = read_data(2)
	if(g_PlayerWeapon[id] != CSW) g_PlayerWeapon[id] = CSW
}

public fw_Safety_Spawn_Post(id)
{
	if(!is_user_alive(id))
		return
		
	Set_BitVar(g_IsAlive, id)
}

public fw_Safety_Killed_Post(id)
{
	UnSet_BitVar(g_IsAlive, id)
}

public is_connected(id)
{
	if(!(1 <= id <= 32))
		return 0
	if(!Get_BitVar(g_IsConnected, id))
		return 0

	return 1
}

public is_alive(id)
{
	if(!is_connected(id))
		return 0
	if(!Get_BitVar(g_IsAlive, id))
		return 0
		
	return 1
}

public get_player_weapon(id)
{
	if(!is_alive(id))
		return 0
	
	return g_PlayerWeapon[id]
}

/* ===============================
--------- END OF SAFETY  ---------
=================================*/
stock Stock_SetPlayerAnim(id, const AnimName[], Float:rate=1.0)
{
	static AnimNum, Float:FrameRate, Float:GroundSpeed, bool:Loops, Anim2[64]
	if(!(pev(id, pev_flags) & FL_DUCKING)) format(Anim2, 63, "ref_%s", AnimName)
	else format(Anim2, 63, "crouch_%s", AnimName)

	if ((AnimNum=lookup_sequence(id,Anim2,FrameRate,Loops,GroundSpeed))==-1) AnimNum=0
	
	if (!Loops || (Loops && pev(id,pev_sequence)!=AnimNum))
	{
		set_pev(id, pev_gaitsequence, AnimNum)
		set_pev(id, pev_sequence, AnimNum)
		set_pev(id, pev_frame, 0.0)
		set_pev(id, pev_animtime, get_gametime())
	}
	set_pev(id, pev_framerate, rate)

	set_pdata_int(id, 40, Loops, 4)
	set_pdata_int(id, 39, 0, 4)

	set_pdata_float(id, 36, FrameRate, 4)
	set_pdata_float(id, 37, GroundSpeed, 4)
	set_pdata_float(id, 38, get_gametime(), 4)

	set_pdata_int(id, 73, 28, 5)
	set_pdata_int(id, 74, 28, 5)
	set_pdata_float(id, 220, get_gametime(), 5)
}
stock SpawnBlood(const Float:vecOrigin[3], iColor, iAmount)
{
	if(!iAmount)
		return
	
	iAmount *= 2
	if(iAmount > 255) iAmount = 255
	
	engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, vecOrigin)
	write_byte(TE_BLOODSPRITE)
	engfunc(EngFunc_WriteCoord, vecOrigin[0])
	engfunc(EngFunc_WriteCoord, vecOrigin[1])
	engfunc(EngFunc_WriteCoord, vecOrigin[2])
	write_short(g_SpraySpr)
	write_short(g_DropSpr)
	write_byte(iColor)
	write_byte(min(max(3, iAmount / 10), 16))
	message_end()
}
stock Set_WeaponAnim(id, anim, iCheck=0)
{
	if(iCheck && pev(id, pev_weaponanim) == anim)
		return;

	set_pev(id, pev_weaponanim, anim)
	
	message_begin(MSG_ONE_UNRELIABLE, SVC_WEAPONANIM, {0, 0, 0}, id)
	write_byte(anim)
	write_byte(pev(id, pev_body))
	message_end()
}

stock Set_WeaponIdleTime(id, WeaponId ,Float:TimeIdle)
{
	static entwpn; entwpn = fm_get_user_weapon_entity(id, WeaponId)
	if(!pev_valid(entwpn)) 
		return
		
	set_pdata_float(entwpn, 46, TimeIdle, 4)
	set_pdata_float(entwpn, 47, TimeIdle, 4)
	set_pdata_float(entwpn, 48, TimeIdle, 4)
}

stock Set_PlayerNextAttack(id, Float:nexttime)
{
	set_pdata_float(id, 83, nexttime, 5)
}

stock Stock_Get_Postion(id,Float:forw, Float:right, Float:up, Float:vStart[])
{
	static Float:vOrigin[3], Float:vAngle[3], Float:vForward[3], Float:vRight[3], Float:vUp[3]
	
	pev(id, pev_origin, vOrigin)
	pev(id, pev_view_ofs,vUp) //for player
	xs_vec_add(vOrigin,vUp,vOrigin)
	pev(id, pev_v_angle, vAngle) // if normal entity ,use pev_angles
	
	angle_vector(vAngle,ANGLEVECTOR_FORWARD,vForward) //or use EngFunc_AngleVectors
	angle_vector(vAngle,ANGLEVECTOR_RIGHT,vRight)
	angle_vector(vAngle,ANGLEVECTOR_UP,vUp)
	
	vStart[0] = vOrigin[0] + vForward[0] * forw + vRight[0] * right + vUp[0] * up
	vStart[1] = vOrigin[1] + vForward[1] * forw + vRight[1] * right + vUp[1] * up
	vStart[2] = vOrigin[2] + vForward[2] * forw + vRight[2] * right + vUp[2] * up
}

stock Stock_Drop_Slot(id, iSlot) 
{
	new weapons[32], num = 0
	get_user_weapons(id, weapons, num)
	
	for(new i = 0; i < num; i++)
	{
		new slot = Stock_Get_Wpn_Slot(weapons[i])

		if(iSlot == slot)
		{
			static wname[32]
			get_weaponname(weapons[i], wname, charsmax(wname))
			engclient_cmd(id, "drop", wname)
		}
	}
}

stock Stock_Get_Wpn_Slot(iWpn)
{
	const PRIMARY_WEAPONS_BIT_SUM = (1<<CSW_SCOUT)|(1<<CSW_XM1014)|(1<<CSW_MAC10)|(1<<CSW_AUG)|(1<<CSW_UMP45)|(1<<CSW_SG550)|(1<<CSW_GALIL)|(1<<CSW_FAMAS)|(1<<CSW_AWP)|(1<<CSW_MP5NAVY)|(1<<CSW_M249)|(1<<CSW_M3)|(1<<CSW_M4A1)|(1<<CSW_TMP)|(1<<CSW_G3SG1)|(1<<CSW_SG552)|(1<<CSW_AK47)|(1<<CSW_P90)
	const SECONDARY_WEAPONS_BIT_SUM = (1<<CSW_P228)|(1<<CSW_ELITE)|(1<<CSW_FIVESEVEN)|(1<<CSW_USP)|(1<<CSW_GLOCK18)|(1<<CSW_DEAGLE)

	if(PRIMARY_WEAPONS_BIT_SUM & (1<<iWpn)) return 1
	else if(SECONDARY_WEAPONS_BIT_SUM & (1<<iWpn)) return 2
	else if(iWpn == CSW_KNIFE) return 3
	else if(iWpn == CSW_HEGRENADE) return 4
	else if(iWpn == CSW_C4) return 5
	return 6 //FLASHBANG SMOKEBANG
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1033\\ f0\\ fs16 \n\\ par }
*/

Last edited by Molecula; 08-20-2019 at 19:43.
Molecula is offline
Molecula
Junior Member
Join Date: Feb 2013
Old 08-22-2019 , 11:18   Re: Request ix Spr direction
Reply With Quote #2

pretty please
Molecula is offline
Mordekay
Squirrel of Fortune
Join Date: Apr 2006
Location: Germany
Old 08-22-2019 , 12:04   Re: Request ix Spr direction
Reply With Quote #3

Read the rules please.
https://forums.alliedmods.net/misc.php?do=showrules
__________________

Mordekay is offline
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 21:32.


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