#include <amxmodx>
#include <amxmisc>
#include <fun>
#include <cstrike>
#include <jailbreak>
#include <hamsandwich>
#include <fakemeta>
#include <engine>
#include <xs>
#include <fakemeta_util>
#define PLUGIN "[Jail] pb"
#define VERSION "1.0.6"
#define AUTHOR "Cypis"
#define is_valid_player(%1) (1 <= %1 <= 32)
#define DAMAGE 17
#define BURST_NUM 5
#define BURST_DELAY 0.025
#define RECOIL 0.25
#define DEFAULT_CLIP 40

#define WP_BASEON CSW_FAMAS
#define wp_baseon_classname "weapon_famas"
#define WP_KEY 221132

#define TASK_BURST 123123
#define OFFSET_CLIPAMMO        51
#define OFFSET_LINUX_WEAPONS    
// weapons offsets
#define OFFSET_CLIPAMMO        51
#define OFFSET_LINUX_WEAPONS    4
#define fm_cs_set_weapon_ammo(%1,%2)    set_pdata_int(%1, OFFSET_CLIPAMMO, %2, OFFSET_LINUX_WEAPONS)

// players offsets
#define m_pActiveItem 373

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

new const g_MaxClipAmmo[] = 
{
    0,
    13, //CSW_P228
    0,
    10, //CSW_SCOUT
    0,  //CSW_HEGRENADE
    7,  //CSW_XM1014
    0,  //CSW_C4
    30,//CSW_MAC10
    30, //CSW_AUG
    0,  //CSW_SMOKEGRENADE
    15,//CSW_ELITE
    20,//CSW_FIVESEVEN
    25,//CSW_UMP45
    30, //CSW_SG550
    35, //CSW_GALIL
    25, //CSW_FAMAS
    12,//CSW_USP
    20,//CSW_GLOCK18
    10, //CSW_AWP
    30,//CSW_MP5NAVY
    100,//CSW_M249
    8,  //CSW_M3
    30, //CSW_M4A1
    30,//CSW_TMP
    20, //CSW_G3SG1
    0,  //CSW_FLASHBANG
    7,  //CSW_DEAGLE
    30, //CSW_SG552
    30, //CSW_AK47
    0,  //CSW_KNIFE
    50//CSW_P90
}
new bullets[ 33 ]
new m_spriteTexture
new zmienna;
new const sIP[] = "ip serwera";
new Float:g_last_fire[33], m_iBlood[2],
g_iBurstNum[33], g_iBurst[33], Float:g_last_shoot[33], Float:g_recoil[33], g_clip[33]
new g_smokepuff_id

const Wep_FAMAS = ((1<<CSW_FAMAS))

new id_pb;

new const wp_model[3][] = {
"models/lany_poniedzialek/v_waterpistol1.mdl",
"models/lany_poniedzialek/p_waterpistol.mdl",
"models/lany_poniedzialek/w_waterpistol.mdl"
}

new const wp_sound[6][] = {
"weapons/waterpistol_clipin1.wav",
"weapons/waterpistol_clipin2.wav",
"weapons/waterpistol_clipout1.wav",
"weapons/waterpistol_draw.wav",
"weapons/waterpistol_idle.wav",
"weapons/waterpistol_shoot1.wav"
}

new const wp_file[3][] = {
"sprites/weapon_waterpistol.txt",
"sprites/640hud52_2.spr",
"sprites/640hud7_2.spr"
}

public plugin_init() {
new ip[40];
get_user_ip(0, ip, 39);
if(!equal(ip, sIP)) 
	set_fail_state("Plugin zostanie wylaczony, zle ip serwera!");
	register_plugin(PLUGIN, VERSION, AUTHOR)
	id_pb = jail_register_game("Lany Poniedzialek");	
	register_event("CurWeapon","CurWeapon","be", "1=1")	
	register_clcmd("weapon_waterpistol", "hook_change")
	register_forward(FM_CmdStart, "fw_CmdStart")
	register_event("CurWeapon", "make_tracer", "be", "1=1", "3>0")
	register_event("CurWeapon" , "Event_CurWeapon" , "be" , "1=1" );
	
}
public plugin_precache(){
	for(new i = 0; i < sizeof(wp_model); i++)
		engfunc(EngFunc_PrecacheModel, wp_model[i])
	for(new i = 0; i < sizeof(wp_sound); i++)
		engfunc(EngFunc_PrecacheSound, wp_sound[i])	
	
	engfunc(EngFunc_PrecacheGeneric, wp_file[0])
	engfunc(EngFunc_PrecacheModel, wp_file[1])
	engfunc(EngFunc_PrecacheModel, wp_file[2])
	m_spriteTexture = precache_model("sprites/dot.spr")
	m_iBlood[0] = precache_model("sprites/blood.spr")
	m_iBlood[1] = precache_model("sprites/bloodspray.spr")	
	g_smokepuff_id = engfunc(EngFunc_PrecacheModel, "sprites/wall_puff1.spr")
}

public OnLastPrisonerShowWish(id){
	jail_set_ct_hit_tt(false);
	jail_set_god_ct(false);
	zmienna = 0;
	
}
public hook_change(id)
{
	if(zmienna !=1)
		return PLUGIN_HANDLED;
	engclient_cmd(id, wp_baseon_classname)
}

public OnRemoveData(day){
	if(day == id_pb){
		asd(false)
	}
}
public OnDayStartPre(day, szInfo[256], szInfo2[512], setting[10], gTimeRound){	
	static szTime[12];
	if(day == id_pb){
		static szTimes[12];
		format_time(szTime, 11, "%M:%S", gTimeRound-30);
		format_time(szTimes, 11, "%M:%S", gTimeRound-60);
		formatex(szInfo2, 511, "Zasady:^n%s - wiezniowie dostaja wodne pistolety^n%s - Strzelaja sie z pistoletow wodnych.", szTime, szTimes);
		szInfo = "Lany Poniedzialek";
		
		jail_set_prisoners_micro(true, true);
		jail_set_ct_hit_tt(true);
		jail_set_god_ct(true);
		
		asd(true);
		
		setting[0] = 1;
		setting[1] = 1;
		setting[2] = 1;
		setting[4] = 1;
		setting[6] = 1;
		setting[7] = 1;
	}
}

public CurWeapon(id)
{
	if(zmienna != 1)
		return PLUGIN_HANDLED;
	if(!is_user_alive(id) || !is_user_connected(id))
		return PLUGIN_HANDLED
	if(get_user_weapon(id) != WP_BASEON)
		return PLUGIN_HANDLED
	
	set_pev(id, pev_viewmodel2, wp_model[0])
	set_pev(id, pev_weaponmodel2, wp_model[1])
	
	return PLUGIN_HANDLED
}


public OnDayStartPost(day){
	if(day == id_pb){
		jail_open_cele();
		jail_set_game_hud(5, "Zabawe zaczynamy za", 0, 255, 0, 0.01, 0.13);
		
	}
}


new HamHook:hSpawn, HamHook: hPostFrame, HamHook: hTrace1, HamHook: hcos, HamHook: hTrace2, HamHook: hReload, HamHook: hReloadPost ,HamHook: hPrimaryAttack, HamHook: hPrimaryAttackPost, HamHook: hPostFrame2 ;
new fmUpdateClient, fmStart, fmSetModel;

public asd(bool:wartosc)
{
	if(wartosc)
	{
		
		zmienna = 1;
		if(!hSpawn)
			hSpawn = RegisterHam(Ham_TakeDamage, "player", "fw_TakeDamage")
		else
			EnableHamForward(hSpawn);
		if(!hTrace1)
			RegisterHam(Ham_TraceAttack, "worldspawn", "ham_traceattack", 1)
		else
			EnableHamForward(hTrace1);
		if(!hTrace2)
			RegisterHam(Ham_TraceAttack, "player", "ham_traceattack", 1)
		else
			EnableHamForward(hTrace2);
		if(!hPostFrame)
			RegisterHam(Ham_Item_PostFrame, wp_baseon_classname, "ham_item_postframe")
		else
			EnableHamForward(hPostFrame);
		if(!fmUpdateClient)
			register_forward(FM_UpdateClientData, "fw_UpdateClientData_Post", 1);
		
		if(!fmSetModel)
			register_forward(FM_SetModel, "fw_SetModel")
		if(!hPostFrame2)
			RegisterHam(Ham_Item_PostFrame, wp_baseon_classname, "fw_PostFrame")
		else
			EnableHamForward(hPostFrame2);
		if(!hReload)
			RegisterHam(Ham_Weapon_Reload, wp_baseon_classname, "fw_Reload")
		else
			EnableHamForward(hReload);
		if(!hReloadPost)
			RegisterHam(Ham_Weapon_Reload, wp_baseon_classname, "fw_Reload_Post", 1)	
		else
			EnableHamForward(hReloadPost);
		if(!hPrimaryAttack)
			RegisterHam(Ham_Weapon_PrimaryAttack, wp_baseon_classname, "fw_PrimaryAttack")
		else
			EnableHamForward(hPrimaryAttack);
		if(!hPrimaryAttackPost)
			RegisterHam(Ham_Weapon_PrimaryAttack, wp_baseon_classname, "fw_PrimaryAttack_Post", 1)
		else
			EnableHamForward(hPrimaryAttackPost);
		if(!hcos)
			RegisterHam(Ham_Item_AddToPlayer, wp_baseon_classname, "ham_add_wp", 1)
		else
			EnableHamForward(hcos);
		
	}
	else
	{
		zmienna = 0;
		if(hSpawn)
			DisableHamForward(hSpawn);
		if(hPostFrame)
			DisableHamForward(hPostFrame);
		if(hTrace1)
			DisableHamForward(hTrace1);
		if(hTrace2)
			DisableHamForward(hTrace2);
		if(hPostFrame2)
			DisableHamForward(hPostFrame2);
		if(hReload)
			DisableHamForward(hReload);
		if(hReloadPost)
			DisableHamForward(hReloadPost);
		if(hPrimaryAttack)
			DisableHamForward(hPrimaryAttack);
		if(hPrimaryAttackPost)
			DisableHamForward(hPrimaryAttackPost);
		if(hcos)
			DisableHamForward(hcos);
		if(fmUpdateClient)
		{
			unregister_forward(FM_UpdateClientData, fmUpdateClient);
			fmUpdateClient = 0;
		}
		if(fmStart)
		{
			unregister_forward(fmStart, fmStart);
			fmStart = 0;
		}
		if(fmSetModel)
		{
			unregister_forward(FM_SetModel, fmSetModel)
			fmSetModel = 0;
		}
	}
}
public ham_item_postframe(iEnt)
{
	if (!pev_valid(iEnt)) return HAM_IGNORED
	
	new id = pev(iEnt, pev_owner)
	
	if(!is_user_alive(id) || !is_user_connected(id))
		return HAM_IGNORED
	if(get_user_weapon(id) != WP_BASEON)
		return HAM_IGNORED		
	
	return HAM_IGNORED
}

public fw_TakeDamage(victim, inflictor, attacker, Float:damage)
{
	if ( is_valid_player( attacker ) && get_user_weapon(attacker) == CSW_FAMAS )
	{
		SetHamParamFloat(4, damage * 0.5 )
	}
}

public OnGameHudEnd(day)
{
	if(day == id_pb)
	{
		set_hudmessage(255, 0, 0, -1.0, -1.0, 0, 6.0, 5.0);
		show_hudmessage(0, "== Rozpierducha ! ==");
		jail_set_prisoners_fight(true, false, false);
		
		for(new i=1; i<=32; i++){
			if(is_user_alive(i) && get_user_team(i) == 1){
				strip_user_weapons(i);
				give_item(i, "weapon_famas")
			}
		}
	}
}


public fw_UpdateClientData_Post(id, sendweapons, cd_handle)
{
	if(!is_user_alive(id) || !is_user_connected(id))
		return FMRES_IGNORED
	if(get_user_weapon(id) != WP_BASEON)
		return FMRES_IGNORED
	
	set_cd(cd_handle, CD_flNextAttack, halflife_time() + 0.001) 
	
	return FMRES_HANDLED
}

public fw_CmdStart(id, uc_handle, seed)
{
	if(zmienna != 1)
		return FMRES_HANDLED
	if(!is_user_alive(id) || !is_user_connected(id))
		return FMRES_HANDLED
	if(get_user_weapon(id) != WP_BASEON)
		return FMRES_HANDLED
	
	static CurButton
	CurButton = get_uc(uc_handle, UC_Buttons)
	
	if(CurButton & IN_ATTACK)
	{
		CurButton &= ~IN_ATTACK
		set_uc(uc_handle, UC_Buttons, CurButton)
		
		static Float:CurTime
		CurTime = get_gametime()
		
		new Float:flNextAttack ; flNextAttack = get_pdata_float(id, 83, 5)
		
		if (flNextAttack > 0.0)
			return FMRES_IGNORED		
		
		if(CurTime - 0.5 > g_last_fire[id])
		{
			static ent
			ent = find_ent_by_owner(-1, wp_baseon_classname, id)
			
			if(cs_get_weapon_ammo(ent) <= 0)
				return FMRES_IGNORED
			
			g_iBurst[id] = 1
			g_iBurstNum[id] = BURST_NUM
			
			g_last_fire[id] = CurTime
		}
	}
	
	return FMRES_HANDLED
}

public fw_SetModel(ent, const model[])
{
	if(!is_valid_ent(ent))
		return FMRES_IGNORED
	
	static szClassName[33]
	entity_get_string(ent, EV_SZ_classname, szClassName, charsmax(szClassName))
	
	if(!equal(szClassName, "weaponbox"))
		return FMRES_IGNORED
	
	static iOwner
	iOwner = entity_get_edict(ent, EV_ENT_owner)
	
	if(equal(model, "models/w_famas.mdl"))
	{
		static at4cs
		at4cs = find_ent_by_owner(-1, "weapon_famas", ent)
		
		if(!is_valid_ent(at4cs))
			return FMRES_IGNORED;
		
		entity_set_int(at4cs, EV_INT_impulse, WP_KEY)
		entity_set_model(ent, wp_model[2])
		
		return FMRES_SUPERCEDE
	}
	
	return FMRES_IGNORED
}

public ham_traceattack(ent, attacker, Float:Damage, Float:fDir[3], ptr, iDamageType)
{
	if(!is_user_alive(attacker) || !is_user_connected(attacker))
		return HAM_IGNORED
	
	if(get_user_weapon(attacker) != WP_BASEON)
		return HAM_IGNORED
	
	static Float:flEnd[3], Float:vecPlane[3]
	
	get_tr2(ptr, TR_vecEndPos, flEnd)
	get_tr2(ptr, TR_vecPlaneNormal, vecPlane)		
	
	if(!is_user_alive(ent))
	{
		make_bullet(attacker, flEnd)
		fake_smoke(attacker, ptr)
		} else {
		static Float:flEnd[3]
		get_tr2(ptr, TR_vecEndPos, flEnd)
		
		create_blood(flEnd)
	}
	
	SetHamParamFloat(3, float(DAMAGE))		
	
	return HAM_HANDLED
}

public fw_PrimaryAttack(ent)
{
	static id; id = pev(ent, pev_owner)
	
	pev(id, pev_punchangle, g_recoil[id])
	
	return HAM_IGNORED	
}

public fw_PrimaryAttack_Post(ent)
{
	static id; id = pev(ent,pev_owner)
	static Float:push[3]
	pev(id,pev_punchangle,push)
	xs_vec_sub(push, g_recoil[id],push)
	
	push[1] += random_float(-1.5, 1.5)
	xs_vec_mul_scalar(push, RECOIL,push)
	xs_vec_add(push, g_recoil[id], push)
	set_pev(id, pev_punchangle, push)
	
	
	return HAM_IGNORED
}


public fw_PostFrame(ent)
{
	if(!pev_valid(ent))
		return HAM_IGNORED
	
	static id
	id = pev(ent, pev_owner)
	
	if(is_user_alive(id) && is_user_connected(id))
	{	
		static Float:flNextAttack; flNextAttack = get_pdata_float(id, 83, 5)
		
		static bpammo
		bpammo = cs_get_user_bpammo(id, CSW_FAMAS)
		
		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(DEFAULT_CLIP - iClip, bpammo)
			
			set_pdata_int(ent, 51, iClip + temp1, 4)
			cs_set_user_bpammo(id, CSW_FAMAS, bpammo - temp1)		
			
			set_pdata_int(ent, 54, 0, 4)
			
			fInReload = 0
		}		
	}
	
	return HAM_IGNORED	
}

public fw_Reload(ent)
{
	if(!pev_valid(ent))
		return HAM_IGNORED
	
	static id
	id = pev(ent, pev_owner)
	
	if(is_user_alive(id) && is_user_connected(id))
	{		
		g_clip[id] = -1
		
		static bpammo
		bpammo = cs_get_user_bpammo(id, CSW_FAMAS)
		
		static iClip; iClip = get_pdata_int(ent, 51, 4)
		
		if (bpammo <= 0)
			return HAM_SUPERCEDE
		
		if(iClip >= DEFAULT_CLIP)
			return HAM_SUPERCEDE		
		
		
		g_clip[id] = iClip
	}
	
	return HAM_IGNORED
}

public fw_Reload_Post(ent)
{
	if(!pev_valid(ent))
		return HAM_IGNORED
	
	static id
	id = pev(ent, pev_owner)
	
	if(is_user_alive(id) && is_user_connected(id))
	{	
		if (g_clip[id] == -1)
			return HAM_IGNORED
		
		static Float:reload_time
		reload_time = 2.2
		
		set_pdata_int(ent, 51, g_clip[id], 4)
		set_pdata_float(ent, 48, reload_time, 4)
		set_pdata_float(id, 83, reload_time, 5)
		set_pdata_int(ent, 54, 1, 4)
		
		set_weapon_anim(id, 4)
	}
	
	return HAM_IGNORED
}

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

stock drop_weapons(id, dropwhat)
{
	static weapons[32], num, i, weaponid
	num = 0
	get_user_weapons(id, weapons, num)
	
	for (i = 0; i < num; i++)
	{
		weaponid = weapons[i]
		
		if (dropwhat == 1 && ((1<<weaponid) & PRIMARY_WEAPONS_BIT_SUM))
		{
			static wname[32]
			get_weaponname(weaponid, wname, sizeof wname - 1)
			engclient_cmd(id, "drop", wname)
		}
	}
}

stock make_bullet(id, Float:Origin[3])
{
	
	new decal = random_num(41, 45)
	const loop_time = 2
	
	static Body, Target
	get_user_aiming(id, Target, Body, 999999)
	
	if(is_user_connected(Target))
		return
	
	for(new i = 0; i < loop_time; i++)
	{
		
		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()
		
		
		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()
	}
}

public fake_smoke(id, trace_result)
{
	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(trace_result, TR_vecEndPos, vecSrc)
	get_tr2(trace_result, 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_id)
	write_byte(2)
	write_byte(50)
	write_byte(TE_FLAG)
	message_end()
}


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


stock create_blood(const Float:origin[3])
{
	// Show some blood :)
	message_begin(MSG_BROADCAST, SVC_TEMPENTITY) 
	write_byte(TE_BLOODSPRITE)
	engfunc(EngFunc_WriteCoord, origin[0])
	engfunc(EngFunc_WriteCoord, origin[1])
	engfunc(EngFunc_WriteCoord, origin[2])
	write_short(m_iBlood[1])
	write_short(m_iBlood[0])
	write_byte(75)
	write_byte(5)
	message_end()
}

public ham_add_wp(ent, id)
{
	new bool: cos
	if(entity_get_int(ent, EV_INT_impulse) == WP_KEY)
	{
		cos = true;
	}			
	
	if(cos)
	{
		message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("WeaponList"), _, id)
		write_string("weapon_famas")
		write_byte(7)
		write_byte(100)
		write_byte(-1)
		write_byte(-1)
		write_byte(1)
		write_byte(6)
		write_byte(WP_BASEON)
		write_byte(0)
		message_end()			
		} else {
		message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("WeaponList"), _, id)
		write_string("weapon_famas")
		write_byte(7)
		write_byte(100)
		write_byte(-1)
		write_byte(-1)
		write_byte(1)
		write_byte(6)
		write_byte(WP_BASEON)
		write_byte(0)
		message_end()			
	}
}


public do_burst(id)
{
	static ent
	ent = find_ent_by_owner(-1, wp_baseon_classname, id)
	
	if(!pev_valid(ent))
		return
	
	if(g_iBurstNum[id] > 0 && g_iBurst[id] && cs_get_weapon_ammo(ent) > 0)
	{
		ExecuteHamB(Ham_Weapon_PrimaryAttack, ent)
		
		set_weapon_anim(id, 1)
		emit_sound(id, CHAN_WEAPON, wp_sound[5], 1.0, ATTN_NORM, 0, PITCH_NORM)
		
		g_iBurstNum[id]--
		} else {
		g_iBurst[id] = 0
		remove_task(id+TASK_BURST)
	}
}

public client_PostThink(id)
{
	if(zmienna != 1)
		return;
	if(!is_user_alive(id) || !is_user_connected(id))
		return
	if(get_user_weapon(id) != WP_BASEON)
		return
	if(!g_iBurst[id] || !g_iBurstNum[id])
		return
	
	static Float:CurTime
	CurTime = get_gametime()
	
	if(CurTime - BURST_DELAY > g_last_shoot[id])
	{
		do_burst(id)
		g_last_shoot[id] = CurTime
	}
}

public make_tracer(id)
{
	if(zmienna != 1)
		return;
	
	new vec1[3], vec2[3]
	get_user_origin(id, vec1, 1) // origin; your camera point.
	get_user_origin(id, vec2, 4) // termina; where your bullet goes (4 is cs-only)
	
	
	//BEAMENTPOINTS
	message_begin( MSG_BROADCAST,SVC_TEMPENTITY)
	write_byte (0)     //TE_BEAMENTPOINTS 0
	write_coord(vec1[0])
	write_coord(vec1[1])
	write_coord(vec1[2])
	write_coord(vec2[0])
	write_coord(vec2[1])
	write_coord(vec2[2])
	write_short( m_spriteTexture )
	write_byte(1) // framestart
	write_byte(5) // framerate
	write_byte(2) // life
	write_byte(10) // width
	write_byte(0) // noise
	write_byte( 30 )     // r, g, b
	write_byte( 144 )       // r, g, b
	write_byte( 255 )       // r, g, b
	write_byte(200) // brightness
	write_byte(150) // speed
	message_end()
	
}

public Event_CurWeapon( id )
{
	if(zmienna != 1)
		return;
	new iWeapon = read_data(2)
	if( !( NOCLIP_WPN_BS & (1<<iWeapon) ) )
		fm_cs_set_weapon_ammo( get_pdata_cbase(id, m_pActiveItem) , g_MaxClipAmmo[ iWeapon ] )
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1045\\ f0\\ fs16 \n\\ par }
*/
