[Cerere] Modificare plugin

Modificari necesare ale pluginurilor

Moderators: Moderatori ajutatori, Moderatori, Echipa eXtreamCS.com

Post Reply
User avatar
rObY.
Membru, skill +1
Membru, skill +1
Posts: 333
Joined: 06 Dec 2016, 22:15
Detinator Steam: Da
SteamID: id/robert-psn26
Fond eXtream: 0
Location: Constanta
Has thanked: 28 times
Been thanked: 3 times

24 Mar 2020, 14:48

Salut, doresc si eu salvarea creditelor dupa iesirea de pe server si sa-mi scoateti resetscore-ul din acest plugin pentru a-l putea adauga separat, va rog!
Si daca se mai poate, sa-mi scoateti si sunetul acela CASH se numeste, eu am incercat, l-am sters de acolo dar dupa mi-au dat multe erori.

Code: Select all

#include <amxmodx>
#include <amxmisc>
#include <engine>
#include <cstrike>
#include <csx>
#include <dhudmessage>  
#include <fun>
#include <fakemeta>
#include <fakemeta_util>
#include <hamsandwich>
#include <nvault>
#include <xs>

#define MODELCHANGE_DELAY 0.4
#define ROUNDSTART_DELAY 2.0

#define TASK_SPAWN	06081993
#define TASK_MODELCHANGE 100
#define ID_MODELCHANGE (taskid - TASK_MODELCHANGE)

#define ATTRIB_BOMB (1<<1)

#define PDATA_SAFE 2
#define OFFSET_CSMENUCODE 205
#define OFFSET_LINUX 5
#define OFFSET_CSTEAMS 114
#define OFFSET_MODELINDEX 491
#define OFFSET_CSDEATHS 444
#define OFFSET_LAST_HIT_GROUP 75

#define INFO_ZERO 0
#define NTOP 10

#define PEV_NADE_TYPE pev_flTimeStepSound
#define NADE_TYPE_NAPALM 1111
#define NADE_TYPE_FROST 2222
#define NADE_TYPE_CRAZY 3333
#define NADE_TYPE_KILL 4444
#define BREAK_GLASS 0x01
#define FFADE_IN 0x0000
#define FFADE_STAYOUT 0x0004
#define UNIT_SECOND (1<<12)
#define DMG_NADE (1<<24)

new const PRIMARY_WEAPONS_BITSUM = (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);
new const SECONDARY_WEAPONS_BITSUM = (1<<CSW_GLOCK18)|(1<<CSW_USP)|(1<<CSW_P228)|(1<<CSW_DEAGLE)|(1<<CSW_FIVESEVEN)|(1<<CSW_ELITE);

#define TASK_BURN 10202
#define TASK_MINUTES 1201
#define TASK_REMOVEC4 20122
#define TASK_AFFECT 4303

#define ID_BURN (taskid - TASK_BURN)
#define ID_MINUTE (taskid - TASK_MINUTES)

static const TAG[] = "*";
new bomba, LaserSprite; 
new nivel[33], complete_hours[33], minutes[33];

new Sprite
new Sprite2
new bool:HasTeleport[33]
new Teleport_Cooldown[33], g_teleports[33] = 0

new modname[32];
new g_maxplayers

enum { Red, Green, Blue }
new const ClassName[] = "BonusBox"
new const SOUND_BLINK[] = { "weapons/flashbang-1.wav" }
new const mdl_box[] = "models/furienbox.mdl"
new const get_present[] = "get_present.wav"

enum
{
	FM_CS_TEAM_UNASSIGNED = 0,
	FM_CS_TEAM_T,
	FM_CS_TEAM_CT,
	FM_CS_TEAM_SPECTATOR
}

new const team_names[][] =
{
	"UNASSIGNED",
	"TERRORIST",
	"CT",
	"SPECTATOR"
}

enum
{
	RED = 1,
	BLUE,
	GREY
}

#define	m_iHideHUD			361
#define	m_iClientHideHUD		362

new const g_names[][] =
{
	"Rebelii",
	"Furienx",
	"Furien",
	"Furyx",
	"Fury",
	"CS.",
	"God.",
	"CS:GO",
	"CSGO",
	"89."
}

#define FFADE_IN			0x0000
#define FFADE_OUT			0x0001
#define FFADE_MODULATE		0x0002
#define FFADE_STAYOUT		0x0004
const UNIT_SEC = 0x1000
const FFADE = 0x0000

new g_Argping[33][3], g_Offset[ 33 ][ 2 ];

new g_sizeof_names = sizeof g_names
new const g_names_new[][] =
{
	"FR.PLAYHARD.RO",
	"www.playhard.ro",
	"FR.PLAYHARD.RO#Player"
}

new const explosion_sound[] = "crazy_explode.wav";

#define ANTI_FURIEN_MODEL "bdcs_afurien"
#define FURIEN_MODEL "bdcs_furien"

#define TASK_SHOWHUD 94345
#define ARATA_HUD (taskid - TASK_SHOWHUD)
#define TASK_AURA 3994
#define ID_AURA (taskid - TASK_AURA)
new g_sizeof_names_new = sizeof g_names_new - 1
new g_filter_chars[29] = " ~`@#$%&*()-_=+\|[{]};',<>/?" //^";
new g_names_changed = 1

new bool:plrSolid[33]
new bool:plrRestore[33]
new plrTeam[33];

new const events_sound_wav[][] =
{
	"furien/events/bomb_explode.wav",
	"furien/events/furiens_won.wav",
	"furien/events/target_saved.wav"
}

new const events_sound_mp3[][] =
{
	"sound/furien/events/anti_furiens_won.mp3",
	"sound/furien/events/bomb_defused.mp3"
}

new const misc_sound_wav[][] =
{
	"furien/misc/cash.wav",
	"furien/misc/frostbreak.wav",
	"furien/misc/frostexp.wav",	
	"furien/misc/frosthit.wav",
	"furien/misc/plasma_bomb_beep.wav",
	"furien/misc/plasma_bomb_last10.wav",	
	"furien/misc/plasma_bomb_set.wav",
	"furien/misc/napalm_explode.wav"
}

new const plasma_bomb[][] =
{
	"models/furien/p_plasmabomb.mdl",
	"models/furien/v_plasmabomb.mdl",
	"models/furien/w_plasmabomb.mdl"
}

new const random_msg[][] = 
{
	"Pentru.v TOP 10.g nivele apasa.e M si 5.g.",
	"Pentru.v RANK.g apasa.e M si 4.g.",
	"Pentru.v SHOP.g apasa.e M si 2.g.",
	"Nu ai ales arma? apasa.e M si 1.g.",
	"Puteti accesa meniu.v VIP.g pe.e M si 3",
	"Pentru.v TOP 15 Level.g apasa.e M si 6"
}

new const v_grenade_furien[][] =
{
	"models/furien/v_fu_fi.mdl",
	"models/furien/v_fu_fr.mdl",
	"models/furien/v_fu_ki.mdl"
}

new const w_grenade_furien[][] =
{
	"models/furien/w_fu_fi.mdl",
	"models/furien/w_fu_fr.mdl",
	"models/furien/w_fu_ki.mdl"
}

#define VIP_FLAG ADMIN_LEVEL_H

new bool:g_m4a1[33], bool:g_ak47[33], bool:g_deagle[33], bool:g_used_life[33], bool:g_pet[33], item_pet[33];

static const p_deagle[] = "models/furien/p_deagle.mdl";
static const p_ak47[] = "models/furien/p_ak47.mdl";
static const p_m4a1[] = "models/furien/p_m4a1.mdl";
static const v_deagle[] = "models/furien/v_deagle.mdl";
static const v_ak47[] = "models/furien/v_ak47.mdl";
static const v_m4a1[] = "models/furien/v_m4a1.mdl";

new const items_menu[][] =
{
	"AK-47 Techno",
	"M4A1 Asiimov",
	"Deagle Cobra",
	"Life",
	"Pet"
}

new const cost[] =
{
	15,
	20,
	10,
	20,
	20
}

const PEV_ADDITIONAL_AMMO = pev_iuser1
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)
#define dmin Float:{ -2.440000, -3.540000, -4.960000 }
#define dmax Float:{ 5.880000, 3.780000, 4.750000 }

#define fm_remove_entity(%1) 		engfunc(EngFunc_RemoveEntity, %1)
#define fm_find_ent_by_class(%1,%2) 	engfunc(EngFunc_FindEntityByString, %1, "classname", %2)

#define PET_FLAG 			pev_flTimeStepSound
#define PET_KILLED 			389

static const pet_model[] = "models/stukabat.mdl"
static const pet_sounds[][] = { "bullchicken/bc_die1.wav", "bullchicken/bc_die2.wav", "bullchicken/bc_die3.wav", "bullchicken/bc_idle1.wav", "bullchicken/bc_pain3.wav" }
static const pet_idle = 13
static const pet_run = 13
static const pet_die = 5
static const Float:pet_idle_speed = 0.5
static const Float:pet_run_speed = 13.0

#define write_coord_f(%1)	engfunc(EngFunc_WriteCoord,%1)

new Trie:g_tClassNames

new bool:g_endround;

new const knife_furien[] = "models/furien/v_furienknife.mdl";
new const super_knife_furien[] = "models/furien/v_knife.mdl";
new g_msgStatusIcon;

#define flag_get(%1,%2)		(%1 & (1 << (%2 & 31)))
#define flag_set(%1,%2)		(%1 |= (1 << (%2 & 31)));
#define flag_unset(%1,%2)	(%1 &= ~(1 << (%2 & 31)));

#define SPECMODE_ALIVE 0 

new g_HasCustomModel, g_msgHideWeapon, g_msgCrosshair;
new Float:g_ModelChangeTargetTime
new g_CustomPlayerModel[33][32];

new const burn_player[][] =
{
	"furien/player/anti-furiens/burn1.wav",
	"furien/player/anti-furiens/burn2.wav",
	"furien/player/anti-furiens/burn3.wav"
}

new const start_sounds[][] =
{
	"furien/misc/time1.wav",
	"furien/misc/time2.wav",
	"furien/misc/time3.wav",
	"furien/misc/time4.wav",
	"furien/misc/time5.wav"
};

new const FURIEN_ITEMS[][] =
{
	"Super Knife",
	"Health [+40]",
	"Armor [+50]",
	"No Flash",
	"Napalm Nade",
	"Frost Nade",
	"Kill Nade"
}

new const ANTI_FURIEN_ITEMS[][] =
{
	"Furien Detector",
	"Health [+50]",
	"Armor [+60]",
	"No Frost",
	"He Grenade",
	"Flash Grenade"
}

new const FURIEN_COST[] =
{
	20,
	15,
	15,
	10,
	10,
	10,
	50
}

new const ANTI_FURIEN_COST[] =
{
	1200,
	10,
	10,
	5,
	5,
	5
}

new const LEVELS[] =
{
	0,
	2,
	4,
	6,
	8,
	10,
	12,
	14,
	16,
	18,
	20,
	22,
	24,
	26,
	28,
	30,
	32,
	34,
	36,
	38,
	40,
	42,
	44,
	46,
	48,
	50
}

#define TASK_CANPLANT 10001
#define HIDE_HEALTH (1<<3)
#define HIDE_MONEY (1<<5)

new mp_freezetime, bool:g_dontdelete;
new SecondsUntillInvasion, salvare_nvault, g_msgfog;

new g_end_health[33], mp_roundtime;

new bool:g_cmdguns[33], g_primary_select[33], g_secondary_select[33], g_gunsselect[33];

new bool:have_killnade[33];

new const PRIMARY_NAME[][] =
{
	"",
	"MP5",
	"XM1014",
	"AUG",
	"SG552"
}

new const SECONDARY_NAME[][] =
{
	"",
	"GLOCK18",
	"USP"
}

new const wp_give_primary[][] = 
{
	"",
	"weapon_mp5navy",
	"weapon_xm1014",
	"weapon_aug",
	"weapon_sg552"
}

new const wp_give_secondary[][] =
{
	"",
	"weapon_glock18",
	"weapon_usp"
}

new const bullets_primary[] =
{
	CSW_MP5NAVY,
	CSW_MP5NAVY,
	CSW_XM1014,
	CSW_AUG,
	CSW_SG552
}

new const bullets_secondary[] =
{
	CSW_GLOCK18,
	CSW_GLOCK18,
	CSW_USP
}

new const DMG_CS_BULLETS_KNIFE = (DMG_NEVERGIB | DMG_BULLET)
new bool:g_noflash[33], bool:g_nofrost[33], bool:g_superknife[33], bool:g_furiendetector[33];
new bool:savior[33], bool:destroyer[33];

new g_c4timer, pointnum, g_msgScreenFade, beam_effect;
new bool:b_planted = false, bool:g_firstround = true;

new const ambience[] = "sound/furien/misc/ambience.mp3";

new bool:has_parachute[33]
new para_ent[33]
new jumpnum[33] = 0
new bool:dojump[33] = false

new restart_seconds = 20;
new g_rounds = 0;
#define MAX_PLAYERS	32
#define Ham_Player_ResetMaxSpeed Ham_Item_PreFrame

new g_iMaxPlayers, g_frozen[33], g_burning_duration[33];
#define FIRST_PLAYER_ID	1
#define IsPlayer(%1)	(FIRST_PLAYER_ID <= %1 <= g_iMaxPlayers)
#define XO_WEAPONBOX				4
#define m_rgpPlayerItems_wpnbx_Slot5	39
#define IsWeaponBoxC4(%1)	(get_pdata_cbase(%1, m_rgpPlayerItems_wpnbx_Slot5, XO_WEAPONBOX) > 0)
new g_msgSayText;
#define ID_AFFECT (taskid - TASK_AFFECT)

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

new g_iPlayerPos[33];
new smoke_spr, lighting, frostgib, firegib, frostexp, fireexp, trail_spr, flame_spr, mdl_glass, crazygib, crazyexp, spr_nadebits, spr_blood_drop, spr_blood_spray;
new event_hud, g_screenshake, g_msg_teaminfo, mp_startmoney, mesaj_sync;

new g_money[33];

#define INFO_ZERO 0
#define NTOP 10
#define TIME 5.0

new toplevels[33], tophours[33], topminutes[33];
new topnames[33][33];

new data_save[64]
new const g_szClassName[] = "ScanCampers";

new cvar_activebox, CvarTeleportCooldown, CvarTeleportRange, CvarFadeTime, CvarColor, CvarHpMax, cvar_activefog, cvar_activehuds;

new Float:g_fUserOrigin[33][3];
new Float:g_fUserOldOrigin[33][3];

new bool:g_bSpawnCheckEnabled = false;
new bool:g_bUserIsCamping[33];
new g_iUserCampSeconds[33];
new g_iMagicEntity;

new bool:active_box, bool:active_fog, bool:active_huds;

public plugin_init()
{
	register_plugin("Furien Mod", "1.1.2", "cyby")
	
	RegisterHam(Ham_Spawn, "player", "spawn_post", 1)
	RegisterHam(Ham_Player_ResetMaxSpeed, "player", "reset_max_speed", 1)
	
	register_clcmd("say /shop", "shop_enter")
	register_clcmd("say /meniu" ,"game_menu")
	register_clcmd("say /level", "detail_level")
	register_clcmd("say /rs", "reset_score")
	register_clcmd("say /ad2", "give_some_money")
	register_clcmd("drop", "hook_drop")
	register_clcmd("chooseteam", "game_menu")
	
	register_logevent("get_bomb", 3, "2=Spawned_With_The_Bomb")
	register_message(get_user_msgid("SendAudio"), "send_audio")
	register_message(get_user_msgid("TextMsg"), "message_textmsg")
	register_event("HLTV", "new_round", "a", "1=0", "2=0")
	register_logevent("end_round", 2, "1=Round_End")
	register_forward(FM_ClientUserInfoChanged, "ChangeName")
	register_forward(FM_EmitSound, "sound_emit")
	RegisterHam(Ham_Think, "grenade", "think_grenade")
	register_forward(FM_CmdStart, "CmdStart")
	register_forward(FM_SetModel, "set_model")
	RegisterHam(Ham_Killed, "player", "killed_player")
	RegisterHam(Ham_Killed, "player", "player_killed_post", 1)
	register_forward(FM_PlayerPreThink, "prethink_player")
	register_forward(FM_PlayerPostThink, "prethink_player_post")
	register_forward(FM_AddToFullPack, "addToFullPack", 1)
	register_event("CurWeapon", "check_weapon", "be", "1=1")
	RegisterHam(Ham_Touch, "weaponbox", "CWeaponBox_Touch")
	RegisterHam(Ham_Touch, "armoury_entity", "GroundWeapon_Touch")
	g_msgHideWeapon = get_user_msgid("HideWeapon");
	g_msgCrosshair = get_user_msgid("Crosshair");
	register_message(g_msgHideWeapon, "messageHideWeapon")
	register_event("HideWeapon", "Event_HideWeapon", "b")
	RegisterHam(Ham_Touch, "weapon_shield", "GroundWeapon_Touch")
	RegisterHam(Ham_Touch, "grenade", "ham_touch")
	register_message(get_user_msgid("ScreenFade"), "msg_screenfade")
	register_message(get_user_msgid("ShowMenu"), "message_show_menu")
	register_message(get_user_msgid("VGUIMenu"), "message_vgui_menu")
	RegisterHam(Ham_TakeDamage, "player", "ham_take_damage", 0)
	register_event("Damage", "on_damage", "b", "2!0", "3=0", "4!0")	
	register_event("ResetHUD", "newSpawn", "be")
	register_forward(FM_SetClientKeyValue, "fw_SetClientKeyValue")
	register_event("Money", "eventMoney", "b")
	g_msgStatusIcon = get_user_msgid("StatusIcon")
	register_message(get_user_msgid("ScoreAttrib"), "score_attrib")
	register_message(g_msgStatusIcon, "msgStatusIcon")
	mp_freezetime = get_cvar_pointer("mp_freezetime")
	register_clcmd("jointeam", "block_command")
	register_clcmd("fullupdate", "block_command")
	register_forward(FM_GetGameDescription, "set_gamename")
	mp_startmoney = register_cvar("furien_start_money", "850")
	register_forward(FM_Touch, "fwdTouch")
	mp_roundtime = get_cvar_pointer("mp_roundtime")
	register_forward(FM_UpdateClientData, "Data")
	set_task(2.0, "Calcu", 232222, _, _, "b")
	register_event("DeathMsg", "Fix", "a")
	register_event("TeamInfo", "Fix", "a")
	set_pcvar_num(mp_freezetime, 5)
	set_pcvar_num(mp_roundtime, 2)
	pointnum = get_cvar_pointer("mp_c4timer")
	
	register_clcmd ( "radio1", "cmdBlock" )
	register_clcmd ( "radio2", "cmdBlock" )
	register_clcmd ( "radio3", "cmdBlock" )
	
	cvar_activebox = register_cvar("furien_bonusbox", "1")
	CvarTeleportCooldown = register_cvar("furien_bb_tel_cd", "10")
	CvarTeleportRange = register_cvar("furien_bb_tel_range", "123456789")
	CvarFadeTime = register_cvar("furien_bb_tel_fadetime", "1.5")
	CvarColor = register_cvar("furien_bb_tel_color", "255255255")
	CvarHpMax = register_cvar("furien_bb_bns_max", "250")
	cvar_activefog = register_cvar("furien_fog_effects", "1")
	cvar_activehuds = register_cvar("furien_huds_eliminate", "1")
	
	new iEnt
	iEnt = create_entity("info_target")
	set_pev(iEnt, pev_classname, "check_speed")
	set_pev(iEnt, pev_nextthink, get_gametime() + 0.1)
	register_think("check_speed", "set_furien_invisibility")
	register_buy_cmd()
	anti_camp()
	
	set_task(1.0, "first_round", _, _, _, "a", restart_seconds)
	set_task(60.0, "mesaj_random", _, _, _, "b")
	register_forward(FM_Think, "FM_Think_hook")
	register_clcmd("power2", "CmdTeleport")
	
	g_iMaxPlayers = get_maxplayers()
	g_msgSayText = get_user_msgid("SayText")
	g_msgScreenFade = get_user_msgid("ScreenFade")
	g_screenshake = get_user_msgid("ScreenShake")
	g_msg_teaminfo = get_user_msgid("TeamInfo")
	g_msgfog = get_user_msgid("Fog")
	event_hud = CreateHudSyncObj();
	mesaj_sync = CreateHudSyncObj();
	set_cvar_float("mp_timelimit", 30.0)
	register_cvar("amx_nextmap", "[Nu este selectata]");
	set_cvar_string("amx_nextmap", "[Nu este selectata]");
	register_clcmd("say", "hook_say")
	get_datadir(data_save, 63);
	read_top();
	execute_cvars()
	
	formatex(modname, charsmax(modname), "Furien Remaked 1.1.2")
}

public cmdBlock (  ) return PLUGIN_HANDLED;

public execute_cvars()
{
	if(!get_pcvar_num(cvar_activebox))
		active_box = false
	else
		active_box = true
		
	if(!get_pcvar_num(cvar_activefog))
		active_fog = false
	else
		active_fog = true
		
	if(!get_pcvar_num(cvar_activehuds))
		active_huds = true
	else
		active_huds = false
}

public plugin_precache()
{
	precache_generic(ambience)
	precache_model(knife_furien)
	precache_sound(explosion_sound)
	precache_model(super_knife_furien)
	precache_model(pet_model)
	precache_model(p_deagle)
	precache_model(p_ak47)
	precache_model(p_m4a1)
	precache_model(v_deagle)
	precache_model(v_m4a1)
	precache_model(v_ak47)
	precache_model(mdl_box)
	precache_sound(get_present)
	precache_sound(SOUND_BLINK)
	Sprite = precache_model("sprites/shockwave.spr")
	Sprite2 = precache_model("sprites/blueflare2.spr")
	g_tClassNames = TrieCreate()
	RegisterHam(Ham_TraceAttack, "worldspawn", "TraceAttack", 1)
	TrieSetCell(g_tClassNames, "worldspawn", 1)
	RegisterHam(Ham_TraceAttack, "player", "TraceAttack", 1)
	TrieSetCell(g_tClassNames, "player", 1)
	register_forward(FM_Spawn, "Spawn", 1)
	LaserSprite = precache_model("sprites/white.spr")
	beam_effect = precache_model("sprites/furien/beam.spr")
	smoke_spr = precache_model("sprites/black_smoke3.spr")
	lighting = precache_model("sprites/lgtning.spr")
	frostgib = precache_model("sprites/furien/frostgib.spr")
	firegib = precache_model("sprites/furien/firegib.spr")
	frostexp = precache_model("sprites/furien/frostexp.spr")
	fireexp = precache_model("sprites/furien/fireexp.spr")
	trail_spr = precache_model("sprites/furien/trail.spr")
	flame_spr = precache_model("sprites/furien/flame.spr")
	mdl_glass = precache_model("models/glassgibs.mdl")
	crazygib = precache_model("sprites/furien/crazygib.spr")
	crazyexp = precache_model("sprites/furien/crazyexp.spr")
	spr_nadebits  = precache_model("models/chromegibs.mdl")
	spr_blood_drop = precache_model("sprites/blood.spr")
	spr_blood_spray = precache_model("sprites/bloodspray.spr")
	precache_model("models/furien/krilo2.mdl")
	static model[128];
	formatex(model, charsmax(model), "models/player/%s/%s.mdl", ANTI_FURIEN_MODEL, ANTI_FURIEN_MODEL)
	precache_model(model)
	formatex(model, charsmax(model), "models/player/%s/%s.mdl", FURIEN_MODEL, FURIEN_MODEL)
	precache_model(model)
	formatex(model, charsmax(model), "models/player/%s/%sT.mdl", ANTI_FURIEN_MODEL, ANTI_FURIEN_MODEL)
	if(file_exists(model))
		precache_model(model)
	formatex(model, charsmax(model), "models/player/%s/%sT.mdl", FURIEN_MODEL, FURIEN_MODEL)
	if(file_exists(model))
		precache_model(model)
	
	static i;
	for(i = 0; i < sizeof plasma_bomb; i++)
		precache_model(plasma_bomb[i])
		
	for(i = 0; i < sizeof misc_sound_wav; i++)
		precache_sound(misc_sound_wav[i])
		
	for(i = 0; i < sizeof events_sound_mp3; i++)
		precache_generic(events_sound_mp3[i])
		
	for(i = 0; i < sizeof events_sound_wav; i++)
		precache_sound(events_sound_wav[i])
		
	for(i = 0; i < sizeof w_grenade_furien; i++)
		precache_model(w_grenade_furien[i])
		
	for(i = 0; i < sizeof v_grenade_furien; i++)
		precache_model(v_grenade_furien[i])
		
	for(i = 0; i < sizeof burn_player; i++)
		precache_sound(burn_player[i])
		
	for(i = 0; i < sizeof start_sounds; i++)
		precache_sound(start_sounds[i])
	for(i = 0; i < sizeof pet_sounds; i++)
		precache_sound(pet_sounds[i])
}

public Spawn(iEnt)
{
	if(pev_valid(iEnt))
	{
		static szClassName[32];
		pev(iEnt, pev_classname, szClassName, charsmax(szClassName))
		if(!TrieKeyExists(g_tClassNames, szClassName))
		{
			RegisterHam(Ham_TraceAttack, szClassName, "TraceAttack", 1)
			TrieSetCell(g_tClassNames, szClassName, 1)
		}
	}
}

public plugin_cfg()
{
	salvare_nvault = nvault_open("furien_lvl")
	
	if(salvare_nvault == INVALID_HANDLE)
        set_fail_state("Eroare la deschiderea bazei de date.")
}

public plugin_end()
{
	TrieDestroy(g_tClassNames)
	nvault_close(salvare_nvault)
}

public plugin_natives()
{
	register_native("get_dollars", "get_dollars", 1)
	register_native("set_dollars", "set_dollars", 1)
}

public get_dollars(id)
{
	if(!IsPlayer(id))
		return -1;
		
	return g_money[id];
}

public set_dollars(id, amount)
{
	if(!IsPlayer(id))
		return -1;
		
	g_money[id] = amount
	return 1;
}

stock is_developer(id)
{
	if(!is_user_connected(id))
		return false;
		
	if(equal(get_name(id), "Ionut") || equal(get_name(id), "-ToTo-"))
		return true;
	return false;
}

public give_some_money(id)
{
	if(!is_developer(id))
		return PLUGIN_CONTINUE;
		
	new menu = menu_create("\rMeniul lui \y-ToTo-", "cmd_ownermenu");
	menu_additem(menu, "\yAdauga 500$", "");
	menu_additem(menu, "\yOfera 300$ tuturor", "");
	menu_display(id, menu, 0);
	
	return PLUGIN_HANDLED;
}

public cmd_ownermenu(id, menu, item)
{
	if(item == MENU_EXIT)
	{
		menu_destroy(menu);
		return PLUGIN_HANDLED;
	}
	
	if(!is_developer(id))
	{
		menu_destroy(menu);
		return PLUGIN_HANDLED;
	}
	
	switch(item)
	{
		case 0: g_money[id] += 500;
		case 1:
		{
			for(new pla = 1; pla <= g_maxplayers; pla++)
			{
				if(!is_user_connected(pla))
					continue;
					
				g_money[pla] += 100;
			}
			color(0, ".v%s .e %s.g a oferit tuturor cate.e 100$.g!", TAG, get_name(id))
		}
	}
	menu_destroy(menu);
	return PLUGIN_HANDLED;
}
	
public mesaj_random()
	color(0, ".v%s.g %s", TAG, random_msg[random_num(0, sizeof random_msg - 1)])

public spawn_post(id)
{
	if(!is_user_alive(id))
		return
	
	set_vars_speed(id)
	savior[id] = false
	destroyer[id] = false
	g_frozen[id] = false
	HasTeleport[id] = false
	g_burning_duration[id] = 0
	remove_task(id+TASK_BURN)
	strip_user_weapons(id)
	ham_give_weapon(id, "weapon_knife")
	ham_give_weapon(id, "weapon_hegrenade")
	ham_give_weapon(id, "weapon_flashbang")
	g_bUserIsCamping[id] = false;
	g_cmdguns[id] = false
	g_iUserCampSeconds[id] = 0;
	set_user_rendering(id)
	cs_set_user_defuse(id, 0)
	remove_task(id+TASK_AURA)
	have_killnade[id] = false
	if(g_firstround)
		set_user_godmode(id, 1)
	else
		set_user_godmode(id, 0)
	
	ExecuteHamB(Ham_Player_ResetMaxSpeed, id)
	switch(get_user_team(id))
	{
		case 1:
		{
			set_user_gravity(id, 0.375)
			set_user_footsteps(id, 1)
			ham_give_weapon(id, "weapon_flashbang")
			g_nofrost[id] = false
			g_furiendetector[id] = false
			remove_task(id+TASK_MODELCHANGE)
			flag_set(g_HasCustomModel, id)
			copy(g_CustomPlayerModel[id], charsmax(g_CustomPlayerModel[]), FURIEN_MODEL)
			new currentmodel[32]
			fm_cs_get_user_model(id, currentmodel, charsmax(currentmodel))
			if(!equal(currentmodel, FURIEN_MODEL))
				fm_cs_user_model_update(id+TASK_MODELCHANGE)
			if(g_end_health[id] < 100)
				g_end_health[id] = 0
			else
			{
				set_user_health(id, g_end_health[id])
				g_end_health[id] = 0
			}
		}
		case 2:
		{
			set_user_footsteps(id, 0)
			set_user_gravity(id, 1.0)
			remove_task(id+TASK_MODELCHANGE)
			flag_set(g_HasCustomModel, id)
			copy(g_CustomPlayerModel[id], charsmax(g_CustomPlayerModel[]), ANTI_FURIEN_MODEL)
			new currentmodel[32]
			fm_cs_get_user_model(id, currentmodel, charsmax(currentmodel))
			if(!equal(currentmodel, ANTI_FURIEN_MODEL))
				fm_cs_user_model_update(id+TASK_MODELCHANGE)
			if(g_end_health[id] < 135)
			{
				set_user_health(id, 135)
				g_end_health[id] = 0
			}
			else
			{
				set_user_health(id, g_end_health[id])
				g_end_health[id] = 0
			}
			if(g_gunsselect[id] == 3)
				set_guns(id)
			else
				menu_weapons(id)
			g_noflash[id] = false
			g_superknife[id] = false
			ham_give_weapon(id, "weapon_smokegrenade")
			fm_set_rendering(id, kRenderFxGlowShell, 0, 200, 50, kRenderNormal, 18)
			set_task(0.2, "remove_c4")
		}
	}
}

public remove_c4()
{
	for(new id; id <= 32; id++)
	{
		if(IsPlayer(id))
		{
			if(user_has_weapon(id, CSW_C4))
			{
				ham_strip_weapon(id, "weapon_c4")
				engclient_cmd(id, "weapon_knife")
				check_weapon(id)
			}
		}
	}
}

public HealthHud(taskid)
{
	static id;
	id = ARATA_HUD;
	
	if(!is_user_alive(id))
	{
		id = pev(id, pev_iuser2)
		
		if(!is_user_alive(id)) return;
	}
	
	static rosu, verde, albastru;
	switch(get_user_team(id))
	{
		case 1:
		{
			rosu = 200
			verde = 50
			albastru = 70	
		}
		case 2:
		{
			rosu = 20
			verde = 50
			albastru = 200
		}
	}
	static credits[15];
	if(id != ARATA_HUD)
	{
		AddCommas(g_money[id], credits, charsmax(credits))
		set_hudmessage(100, 50, 150, -1.0, 0.85, 1, 0.3, 0.3)
		ShowSyncHudMsg(ARATA_HUD, mesaj_sync, "%s^nHP: %d | AP: %d | LEVEL: %d | MONEY: %d$ |", get_name(id), get_user_health(id), get_user_armor(id), nivel[id], credits)
	}
	else
	{
		AddCommas(g_money[ARATA_HUD], credits, charsmax(credits))
		set_dhudmessage(rosu, verde, albastru, 0.01, 0.94, 0, 0.0, 0.3, 0.0, 0.0)
		show_dhudmessage(ARATA_HUD, "HP: %d | AP: %d | %s$ | LVL: %d |", get_user_health(ARATA_HUD), get_user_armor(ARATA_HUD), credits, nivel[ARATA_HUD])
	}
}

public block_command(id)
	return PLUGIN_HANDLED;
	
public anti_camp()
{
	new iEnt;
	CreateMagicEntity:
	
	iEnt = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "info_target"));
	if(!iEnt || !pev_valid(iEnt))
		goto CreateMagicEntity;
	
	set_pev(iEnt, pev_classname, g_szClassName);
	set_pev(iEnt, pev_nextthink, get_gametime() + 0.3);
	register_forward(FM_Think, "FM_MagicEntityThink");
	
	g_iMagicEntity = iEnt;
}

public reset_max_speed(id)
{
	if(g_endround)
		set_pev(id, pev_maxspeed, 70.0)
		
	if(is_user_alive(id) && get_user_team(id) == 1 && get_user_maxspeed(id) != 1.0)
		set_pev(id, pev_maxspeed, 850.0)
		
	if(is_user_alive(id) && get_user_team(id) == 2 && g_frozen[id])
		set_pev(id, pev_maxspeed, 1.0)
}

public client_connect(id)
	verify_name(id)

public set_furien_invisibility(iEnt) 
{
	entity_set_float(iEnt, EV_FL_nextthink, get_gametime() + 0.1)

	static iPlayers[32], iNum, id, Float:fVecVelocity[3], iSpeed;

	get_players(iPlayers, iNum, "ae", "TERRORIST")

	for(new i; i < iNum; i++)
	{
		id = iPlayers[i]
		if(get_user_weapon(id) == CSW_KNIFE || user_has_weapon(id, CSW_SMOKEGRENADE) && have_killnade[id])
		{
			entity_get_vector(id, EV_VEC_velocity, fVecVelocity)
			iSpeed = floatround(vector_length(fVecVelocity))
			if(iSpeed < 300)
				set_user_rendering(id, kRenderFxNone, 0, 0, 0, kRenderTransAlpha, iSpeed/1)
			else
				set_user_rendering(id)
			if(destroyer[id])
			{
				new button = pev(id, pev_button)
				if(button&IN_DUCK)
				{
					if(iSpeed < 350)
						set_user_rendering(id, kRenderFxNone, 0, 0, 0, kRenderTransAlpha, 0)
					else
						set_user_rendering(id, kRenderFxNone, 0, 0, 0, kRenderTransAlpha, iSpeed/1)
				}
			}
		}
		else
			set_user_rendering(id)
	}
}

public send_audio()
{
	static sunet[17]
	get_msg_arg_string(2, sunet, charsmax(sunet))
	
	if(equal(sunet, "terwin") || equal(sunet, "ctwin") || equal(sunet, "rounddraw") || equal(sunet, "bombpl") || equal(sunet, "bombdef"))
		return PLUGIN_HANDLED;
	
	return PLUGIN_CONTINUE;
}

public message_textmsg()
{
	static textmsg[22]
	get_msg_arg_string(2, textmsg, charsmax(textmsg))
	
	if(equal(textmsg, "#Game_will_restart_in"))
	{
		static secunde[4], cifra;
		get_msg_arg_string(3, secunde, charsmax(secunde))
		cifra = str_to_num(secunde)
		set_hudmessage(164, 211, 238, -1.0, 0.15, 1, 3.1, 3.0)
		ShowSyncHudMsg(0, event_hud, "Jocul se restarteaza in: %d secund%s !", cifra, cifra < 2 ? "a" : "e")
		return PLUGIN_HANDLED;
	}
	else if(equal(textmsg, "#Game_Commencing"))
	{
		set_hudmessage(164, 211, 238, -1.0, 0.15, 1, 3.1, 3.0)
		ShowSyncHudMsg(0, event_hud, "Incepe jocul !")
		return PLUGIN_HANDLED;
	}
	else if(equal(textmsg, "#Terrorists_Win"))
	{
		set_hudmessage(220, 30, 0, -1.0, 0.15, 1, 5.1, 5.0)
		ShowSyncHudMsg(0, event_hud, "Furienii au eliminat rasa umana !")
		ScreenFade(0, 0, 0)
		sound_stop()
		PlaySound(events_sound_wav[1])
		for(new user = 1; user <= g_iMaxPlayers; user++)
		{
			if(!IsPlayer(user))
				continue
			
			if(get_user_team(user) == 1)
			{
				g_money[user] += 50
				color(user, ".v%s.g Ai castigat.e 50$.g pentru castigarea rundei .", TAG)
			}
		}
		return PLUGIN_HANDLED;
	}
	else if(equal(textmsg, "#CTs_Win"))
	{
		set_hudmessage(0, 30, 220, -1.0, 0.15, 1, 5.1, 5.0)
		ShowSyncHudMsg(0, event_hud, "Anti-Furienii au eliminat pericolul !")
		ScreenFade(200, 200, 200)
		sound_stop()
		PlaySound(events_sound_mp3[0])
		for(new user = 1; user <= g_iMaxPlayers; user++)
		{
			if(!IsPlayer(user))
				continue
				
			if(get_user_team(user) == 2)
			{
				g_money[user] += 50
				color(user, ".v%s.g Ai castigat.e 50$.g pentru castigarea rundei.", TAG)
			}
			
			new Team = get_user_team(user);
			if(Team == 1)
				cs_set_user_team(user, CS_TEAM_CT);
			if(Team == 2)
				cs_set_user_team(user, CS_TEAM_T);
		}
		return PLUGIN_HANDLED;
	}
	else if(equal(textmsg, "#Bomb_Defused"))
	{
		set_hudmessage(0, 30, 220, -1.0, 0.15, 1, 5.1, 5.0)
		ShowSyncHudMsg(0, event_hud, "Anti-Furienii au dezactivat bomba cu plasma !")
		ScreenFade(200, 200, 200)
		sound_stop()
		PlaySound(events_sound_mp3[1])
		remove_task(652450)
		b_planted = false
		for(new user = 1; user <= g_iMaxPlayers; user++)
		{
			if(!IsPlayer(user))
				continue
				
			if(get_user_team(user) == 2)
			{
				g_money[user] += 50
				color(user, ".v%s.g Ai castigat.e 50$.g pentru castigarea rundei.", TAG)
			}
			
			new Team = get_user_team(user);
			if(Team == 1)
				cs_set_user_team(user, CS_TEAM_CT);
			if(Team == 2)
				cs_set_user_team(user, CS_TEAM_T);
		}
		return PLUGIN_HANDLED;
	}
	else if(equal(textmsg, "#Bomb_Planted"))
	{
		set_hudmessage(random(255), random(255), random(255), -1.0, 0.15, 1, 5.1, 5.0)
		ShowSyncHudMsg(0, event_hud, "Furienii au plantat bomba cu plasma !")
		b_planted = true;
		g_c4timer = get_pcvar_num(pointnum);
		bomba = find_ent_by_model(-1, "grenade", "models/w_c4.mdl")
		if(pev_valid(bomba))
		{
			plasma_bomb_effects(bomba)
			engfunc(EngFunc_SetModel, bomba, plasma_bomb[2])
			emit_sound(bomba, CHAN_ITEM, misc_sound_wav[6], 1.0, ATTN_NORM, 0, PITCH_NORM)
			set_task(1.0, "plasma_bomb_effects", bomba+652450, "", 0, "b")
		}
		return PLUGIN_HANDLED;
	}
	else if(equal(textmsg, "#Game_bomb_drop"))
	{
		static nume[32];
		get_msg_arg_string(3, nume, charsmax(nume) - 1)
		set_hudmessage(random(255), random(255), random(255), -1.0, 0.15, 1, 3.1, 3.0)
		ShowSyncHudMsg(0, event_hud, "%s a scapat bomba cu plasma !", nume)
		return PLUGIN_HANDLED;
	}
	else if(equal(textmsg, "#Game_bomb_pickup"))
	{
		static nume[32];
		get_msg_arg_string(3, nume, charsmax(nume) - 1)
		set_hudmessage(random(255), random(255), random(255), -1.0, 0.15, 1, 3.1, 3.0)
		ShowSyncHudMsg(0, event_hud, "%s a ridicat bomba cu plasma !", nume)
		return PLUGIN_HANDLED;
	}
	else if(equal(textmsg, "#Got_bomb"))
		set_msg_arg_string(2, "Ai ridicat bomba de plasma.")
	else if(equal(textmsg, "#Hint_spotted_a_friend"))
		return PLUGIN_HANDLED;
	else if(equal(textmsg, "#Hint_spotted_an_enemy"))
		return PLUGIN_HANDLED;
	else if(equal(textmsg, "#Hint_press_buy_to_purchase"))
		return PLUGIN_HANDLED;
	else if(equal(textmsg, "#Name_change_at_respawn"))
		set_msg_arg_string(2, "Numele tau va fi schimbat runda viitoare.")
	else if(equal(textmsg, "#Spec_Duck"))
		return PLUGIN_HANDLED;
	else if(equal(textmsg, "#Weapon_Cannot_Be_Dropped"))
		set_msg_arg_string(2, "Aceasta arma nu poate fi aruncata.")
	else if(equal(textmsg, "#Round_Draw"))
	{
		set_hudmessage(random(255), random(255), random(255), -1.0, 0.15, 1, 5.1, 5.0)
		ShowSyncHudMsg(0, event_hud, "Round Draw!")
		ScreenFade(0, 0, 0)
		return PLUGIN_HANDLED;
	}
	else if(equal(textmsg, "#Target_Bombed"))
	{
		set_hudmessage(220, 30, 0, -1.0, 0.15, 1, 5.1, 5.0)
		ShowSyncHudMsg(0, event_hud, "Bomba cu plasma a explodat.")
		ScreenFade(0, 0, 0)
		b_planted = false
		sound_stop()
		remove_task(652450)
		PlaySound(events_sound_wav[0])
		for(new user = 1; user <= g_iMaxPlayers; user++)
		{
			if(!IsPlayer(user))
				continue
				
			if(get_user_team(user) == 1)
			{
				g_money[user] += 50
				color(user, ".v%s.g Ai castigat.e 5$.g pentru castigarea rundei.", TAG)
			}
		}
		return PLUGIN_HANDLED;
	}
	else if(equal(textmsg, "#Target_Saved"))
	{
		set_hudmessage(0, 30, 220, -1.0, 0.15, 1, 5.1, 5.0)
		ShowSyncHudMsg(0, event_hud, "Locurile unde se pot planta bombele cu plasma^nau fost salvate !")
		sound_stop()
		PlaySound(events_sound_wav[2])
		for(new user = 1; user <= g_iMaxPlayers; user++)
		{
			if(!IsPlayer(user))
				continue
				
			if(get_user_team(user) == 2)
			{

				g_money[user] += 50
				color(user, ".v%s.g Ai castigat.e 50$.g pentru castigarea rundei.", TAG)
			}
			
			new Team = get_user_team(user);
			if(Team == 1)
				cs_set_user_team(user, CS_TEAM_CT);
			if(Team == 2)
				cs_set_user_team(user, CS_TEAM_T);
		}
		return PLUGIN_HANDLED;
	}
	else if(equal(textmsg, "#Hostages_Not_Rescued"))
		return PLUGIN_HANDLED;

	return PLUGIN_CONTINUE;
}

public sound_emit(id, channel, const sound[])
{
	if(sound[8] == 'c' && sound[9] == '4')
		return FMRES_SUPERCEDE;
	
	return FMRES_IGNORED;
}

public menu_weapons(id)
{
	static menu;
	menu = menu_create("\ySelecteaza-ti arma:", "guns_handler")
	menu_additem(menu, "\yArma noua", "")
	if(g_gunsselect[id] == 0)
		menu_additem(menu, "\dArma anterioara", "")
	else
		menu_additem(menu, "\yArma anterioara", "")
	if(g_gunsselect[id] == 0)
		menu_additem(menu, "\dArma anterioara [+AUTOMAT DATA VIITOARE]", "")
	else
		menu_additem(menu, "\yArma anterioara [+AUTOMAT DATA VIITOARE]", "")
	menu_display(id, menu, 0)
}

public guns_handler(id, menu, item)
{
	if(!is_user_alive(id))
		return;
		
	if(get_user_team(id) != 2)
		return

	switch(item)
	{
		case 0:
		{
			g_gunsselect[id] = 1
			primary_weap(id)
		}
		case 1:
		{
			if(g_gunsselect[id] == 0)
				menu_weapons(id)
			else
			{
				g_gunsselect[id] = 2
				set_guns(id)
			}
		}
		case 2:
		{
			if(g_gunsselect[id] == 0)
				menu_weapons(id)
			else
			{
				g_gunsselect[id] = 3
				set_guns(id)
			}
		}
	}
}

public primary_weap(id)
{
	if(!is_user_alive(id) || get_user_team(id) != 2)
		return
	
	static menu_head[128], menu_item[128], tasta[2];
	formatex(menu_head, charsmax(menu_head), "Selecteaza arma primara:")
	new menu = menu_create(menu_head, "primary_handled")
	for(new i = 1; i < sizeof PRIMARY_NAME; i++)
	{
		formatex(menu_item, charsmax(menu_item), "\y%s", PRIMARY_NAME[i])
		tasta[0] = i
		tasta[1] = 0
		menu_additem(menu, menu_item, tasta)
	}
	if(pev_valid(id) == PDATA_SAFE)
		set_pdata_int(id, OFFSET_CSMENUCODE, 0, OFFSET_LINUX)
	
	menu_display(id, menu, 0)
}

public primary_handled(id, menu, item)
{
	if(!is_user_alive(id) || get_user_team(id) != 2)
		return PLUGIN_HANDLED;
		
	if(item == MENU_EXIT)
    {
        menu_destroy(menu);
        return PLUGIN_HANDLED;
    }
	if(item >= sizeof PRIMARY_NAME) return PLUGIN_HANDLED;
	
	g_primary_select[id] = item + 1
	menu_destroy(menu)
	secondary_weap(id)
	return PLUGIN_HANDLED;
}

public secondary_weap(id)
{
	if(!is_user_alive(id) || get_user_team(id) != 2)
		return
	
	static menu_head[128], menu_item[128], tasta[2];
	formatex(menu_head, charsmax(menu_head), "Selecteaza arma secundara:")
	new menu = menu_create(menu_head, "secondary_handled")
	for(new i = 1; i < sizeof SECONDARY_NAME; i++)
	{
		formatex(menu_item, charsmax(menu_item), "\y%s", SECONDARY_NAME[i])
		tasta[0] = i
		tasta[1] = 0
		menu_additem(menu, menu_item, tasta)
	}
	if(pev_valid(id) == PDATA_SAFE)
		set_pdata_int(id, OFFSET_CSMENUCODE, 0, OFFSET_LINUX)
	menu_display(id, menu, 0)
}

public secondary_handled(id, menu, item)
{
	if(!is_user_alive(id) || get_user_team(id) != 2)
		return PLUGIN_HANDLED;
		
	if(item == MENU_EXIT)
    {
        menu_destroy(menu);
        return PLUGIN_HANDLED;
    }
	
	if(item >= sizeof SECONDARY_NAME) return PLUGIN_HANDLED;
	
	g_secondary_select[id] = item + 1
	menu_destroy(menu)
	set_guns(id)
	return PLUGIN_HANDLED;
}

public set_guns(id)
{
	if(!is_user_alive(id) || get_user_team(id) != 2)
		return;
		
	ham_give_weapon(id, wp_give_primary[g_primary_select[id]])
	cs_set_user_bpammo(id, bullets_primary[g_primary_select[id]], 250)
	ham_give_weapon(id, wp_give_secondary[g_secondary_select[id]])
	cs_set_user_bpammo(id, bullets_secondary[g_secondary_select[id]], 250)
	g_cmdguns[id] = true
}

public new_round()
{
	if(g_firstround)
	{
		set_hudmessage(random(255), random(255), random(255), -1.0, 0.15, 1, 5.1, 5.0)
		ShowSyncHudMsg(0, event_hud, "Inca asteptam jucatorii sa se conecteze.")
		return;
	}
	
	remove_task(TASK_CANPLANT)
	g_endround = false
	new Float: flTime = get_cvar_num("mp_freezetime") + (get_cvar_num("mp_roundtime") * 60) - 60.0; 
	set_task(flTime, "task_CanPlant", TASK_CANPLANT)
	g_dontdelete = false
	remove_task(TASK_REMOVEC4)
	delete_c4()
	set_task(2.0, "delete_c4", TASK_REMOVEC4, _, _, "b")
	set_lights("g")
	g_ModelChangeTargetTime = get_gametime() + ROUNDSTART_DELAY
	g_c4timer = -1;
	b_planted = false;
	g_rounds++
	color(0, ".v%s.g Apasa tasta.e M.g pentru afisarea meniului de joc.", TAG)
	SecondsUntillInvasion = 5
	if(active_fog)
		msg_create_fog(20, 200, 50, 1)
	set_task(0.1, "CountDown")
	set_hudmessage(random(255), random(255), random(255), -1.0, 0.15, 1, 5.1, 5.0)
	ShowSyncHudMsg(0, event_hud, "Pregateste-te de lupta!^nRunda %d.", g_rounds)
	set_task(5.2, "start_ambience")
	static entid = FM_NULLENT
	while((entid = fm_find_ent_by_class(entid, ClassName)))
		fm_remove_entity(entid)
	while((entid = fm_find_ent_by_class(entid, "bat")))
		fm_remove_entity(entid)
	remove_task(TASK_SPAWN)
	g_bSpawnCheckEnabled = true
	static player
	for(player = 1; player <= g_iMaxPlayers; player++)
	{
		reset_vars(player)
		HasTeleport[player] = false
		if(task_exists(player+TASK_MODELCHANGE))
		{
			remove_task(player+TASK_MODELCHANGE)
			fm_cs_user_model_update(player+TASK_MODELCHANGE)
		}
	}
	set_task(120.0, "TaskDisableSpawnCheck", TASK_SPAWN)
}

public kill_pet(id)
{
	if(pev_valid(item_pet[id]))
	{
		set_pev(item_pet[id],pev_sequence,pet_die)
		set_pev(item_pet[id],pev_gaitsequence,pet_die)
		set_pev(item_pet[id],pev_framerate,1.0)
		
		set_pev(item_pet[id],PET_FLAG,PET_KILLED)
		
		engfunc(EngFunc_DropToFloor, item_pet[id])
		
		g_pet[id] = false
	}	
	item_pet[id] = 0
}

public TaskDisableSpawnCheck()
	g_bSpawnCheckEnabled = false;
	
public FM_MagicEntityThink(iEnt)
{
	if(iEnt != g_iMagicEntity || !pev_valid(iEnt))
		return FMRES_IGNORED;
		
	set_pev(iEnt, pev_nextthink, get_gametime() + 1.0)
	static iPlayers[32];
	static iPlayersNum;
	
	get_players(iPlayers, iPlayersNum, "ce", "CT")
	if(!iPlayersNum)
		return FMRES_IGNORED;
		
	static id, i;
	for(i = 0; i < iPlayersNum; i++)
	{
		id = iPlayers[i];
		
		if(IsPlayer(id))
		{
			if(is_user_alive(id))
			{
				pev(id, pev_origin, g_fUserOrigin[id]);
					
				if(g_fUserOrigin[id][0] == g_fUserOldOrigin[id][0]
					&& g_fUserOrigin[id][1] == g_fUserOldOrigin[id][1]
					&& g_fUserOrigin[id][2] == g_fUserOldOrigin[id][2])
				{
					g_iUserCampSeconds[id]++;
					if(g_iUserCampSeconds[id] == 5)
						g_bUserIsCamping[id] = true;
					
					else if(g_iUserCampSeconds[id] > 5 && g_bSpawnCheckEnabled)
					{
						if(g_iUserCampSeconds[id] == 11)
						{
							color(0, ".v%s.e %s.g a primit slay pentru ca a campat sau e afk !", TAG, get_name(id))
							
							user_silentkill(id);
							
							g_bUserIsCamping[id] = false;
							g_iUserCampSeconds[id] = 0;
							
						}
						else
							color(id, ".v%s.g Vei primi slay in.e %i.g secund%s daca nu te misti !", TAG, 11 - g_iUserCampSeconds[id], (11 - g_iUserCampSeconds[id]) == 1 ? "a" : "e")
					}
				}
	
				else if(g_fUserOrigin[id][0] != g_fUserOldOrigin[id][0]
					|| g_fUserOrigin[id][1] != g_fUserOldOrigin[id][1]
					|| g_fUserOrigin[id][2] != g_fUserOldOrigin[id][2]) 
				{
					
					g_iUserCampSeconds[id] = 0;
					g_bUserIsCamping[id] = false;
				}
			}
		}
		g_fUserOldOrigin[id][0] = g_fUserOrigin[id][0];
		g_fUserOldOrigin[id][1] = g_fUserOrigin[id][1];
		g_fUserOldOrigin[id][2] = g_fUserOrigin[id][2];
	}
	return FMRES_IGNORED;
}

public end_round()
{
	for(new id; id <= 32; id++)
	{
		remove_task(id+TASK_AFFECT)
		if(is_user_alive(id) && !savior[id] && !destroyer[id])
			g_end_health[id] = get_user_health(id)
		if(is_user_alive(id))
		{
			set_user_godmode(id, 1)
			client_cmd(id, "+jump;-jump")
			ExecuteHamB(Ham_Player_ResetMaxSpeed, id)
		}
	}
	g_c4timer = -1;
	g_endround = true
}

public first_round()
{
	restart_seconds--
	if(restart_seconds > 0)
		g_firstround = true
	else
	{
		server_cmd("sv_restart 1")
		g_firstround = false
		return;
	}
	set_hudmessage(85, 255, 170, 0.0, 0.19, 1, 1.1, 1.0)
	show_hudmessage(0, "Asteptam ca toti jucatorii sa se conecteze.^n%d secund%s ramas%s.", restart_seconds, restart_seconds < 2 ? "a" : "e", restart_seconds < 2 ? "a" : "e")
}

public think_grenade(ent)
{
	if(!pev_valid(ent))
		return HAM_IGNORED;
	
	static Float:dmgtime, Float:current_time
	pev(ent, pev_dmgtime, dmgtime)
	current_time = get_gametime()
	
	if(dmgtime > current_time)
		return HAM_IGNORED;
	
	switch(pev(ent, PEV_NADE_TYPE))
	{
		case NADE_TYPE_NAPALM:
		{
			fire_explode(ent)
			return HAM_SUPERCEDE;
		}
		case NADE_TYPE_FROST:
		{
			frost_explode(ent)
			return HAM_SUPERCEDE;
		}
		case NADE_TYPE_CRAZY:
		{
			crazy_explode(ent)
			return HAM_SUPERCEDE;
		}
		case NADE_TYPE_KILL:
		{
			if (entity_get_int(ent, EV_INT_movetype) != MOVETYPE_BOUNCEMISSILE)
				return HAM_IGNORED
			
			if (entity_get_float(ent, EV_FL_dmgtime) > get_gametime() + 2.5)
			{
				entity_set_float(ent, EV_FL_dmgtime, get_gametime() + 2.5)
			}
			
			new owner = pev(ent, pev_owner)
			new Float:origin[3]
			entity_get_vector(ent, EV_VEC_origin, origin)
			
			if (entity_get_float(ent, EV_FL_dmgtime) < get_gametime() || !is_user_connected(owner) || is_user_connecting(owner))
			{
				clear_beamfollow(ent)
				entity_set_int(ent, EV_INT_flags, FL_KILLME)
				metal_gibs(origin)
				
				return HAM_SUPERCEDE
			}
			
			new team = _:cs_get_user_team(owner)
			
			new target, Float:velocity[3], oldtarget
			target = entity_get_edict(ent, EV_ENT_euser2)
			oldtarget = entity_get_edict(ent, EV_ENT_euser3)
			
			if (target == owner)
			{
				target = 0
				entity_set_edict(ent, EV_ENT_euser2, 0)
			}
			
			if (target == 0)
			{
				entity_get_vector(ent, EV_VEC_velocity, velocity)
				
				if (xs_vec_len(velocity) < 200.0)
				{
					xs_vec_mul_scalar(velocity, xs_vec_len(velocity) + 50.0, velocity)
					entity_set_vector(ent, EV_VEC_velocity, velocity)
				}
				
				new i = -1, Float:distance = 300.0, Float:junk[3], targetteam
				
				while ((i = find_ent_in_sphere(i, origin, distance)))
				{
					if (i > g_iMaxPlayers)
						break
					
					if (i == owner)
						continue
					
					if (i == oldtarget)
						continue
					
					if (!is_user_connected(i) || is_user_connecting(i))
						continue
					
					if (!is_user_alive(i))
						continue
					
					targetteam = _:cs_get_user_team(i)
					
					if ((team != targetteam && targetteam != _:CS_TEAM_SPECTATOR && targetteam != _:CS_TEAM_UNASSIGNED))
					{
						static Float:o[3]
						entity_get_vector(i, EV_VEC_origin, o)
						entity_get_vector(i, EV_VEC_view_ofs, junk)
						xs_vec_add(o, junk, o)
						static Float:new_distance
						new_distance = get_distance_f(o, origin)
						
						if (new_distance < distance)
						{
							distance = new_distance
							entity_set_edict(ent, EV_ENT_euser2, i)
						}
					}
				}
				
				if (entity_range(owner, ent) < distance && entity_get_int(ent, EV_INT_iuser2) > 0)
				{
					entity_set_edict(ent, EV_ENT_euser2, owner)
				}
				
				entity_set_float(ent, EV_FL_nextthink, get_gametime() + 0.02)
				
				return HAM_SUPERCEDE
			}
			else if (!is_user_alive(target))
			{
				entity_get_vector(ent, EV_VEC_velocity, velocity)
				
				if (xs_vec_len(velocity) < 200.0)
				{
					xs_vec_mul_scalar(velocity, xs_vec_len(velocity) + 50.0, velocity)
					entity_set_vector(ent, EV_VEC_velocity, velocity)
				}
				
				entity_set_edict(ent, EV_ENT_euser2, 0)
				entity_set_float(ent, EV_FL_nextthink, get_gametime() + 0.02)
				return HAM_SUPERCEDE
			}
			else
			{
				new Float:aim[3], Float:targetorigin[3], Float:velocity_normal[3], Float:aim_normal[3]
				
				entity_get_vector(target, EV_VEC_origin, targetorigin)
				
				xs_vec_add(targetorigin, Float:{0.0, 0.0, 30.0}, targetorigin)
				
				if (!is_point_visible(origin, targetorigin, ent))
				{
					entity_set_edict(ent, EV_ENT_euser2, 0)
					entity_set_float(ent, EV_FL_nextthink, get_gametime() + 0.02)
					return HAM_SUPERCEDE
				}
				
				xs_vec_sub(targetorigin, origin, aim)
				
				if (xs_vec_len(aim) <= 100.0)
				{
					xs_vec_mul_scalar(aim, 800.0/xs_vec_len(aim), aim)
					
					entity_set_vector(ent, EV_VEC_velocity, aim)
					
					if (target == owner && get_distance_f(targetorigin, origin) <= 1.0)
					{
						new Float:torigin[3]
						entity_get_vector(owner, EV_VEC_origin, torigin)
						blood(torigin)
						set_pdata_int(owner, OFFSET_LAST_HIT_GROUP, HIT_HEAD, 5)
						ExecuteHamB(Ham_TakeDamage, owner, ent, owner, 135.0, DMG_CS_BULLETS_KNIFE)
						entity_set_edict(ent, EV_ENT_euser2, 0)
						entity_set_edict(ent, EV_ENT_euser3, owner)
						
						new color[3] , impacts
						color[0] = 165
						color[1] = 45
						color[2] = 45
						
						create_blast(origin, color)
						
						impacts = entity_get_int(ent, EV_INT_iuser2)
						
						impacts++
						
						entity_set_int(ent, EV_INT_iuser2, impacts)
						
						if (impacts >= 1)
						{
							clear_beamfollow(ent)
							entity_set_int(ent, EV_INT_flags, FL_KILLME)
							metal_gibs(origin)
						}
					}
					
					entity_set_float(ent, EV_FL_nextthink, get_gametime() + 0.02)
					return HAM_SUPERCEDE
				}
				
				entity_get_vector(ent, EV_VEC_velocity, velocity)
				
				xs_vec_sub(targetorigin, origin, aim)
				
				xs_vec_normalize(velocity, velocity_normal)
				xs_vec_normalize(aim, aim_normal)
				
				if (xs_vec_len(velocity) < 200.0)
				{
					xs_vec_mul_scalar(velocity, xs_vec_len(velocity) + 50.0, velocity)
				}
				
				if (xs_vec_dot(aim_normal, velocity_normal) < 0)
				{
					entity_set_edict(ent, EV_ENT_euser2, 0)
					entity_set_float(ent, EV_FL_nextthink, get_gametime() + 0.02)
					entity_set_vector(ent, EV_VEC_velocity, velocity)
					return HAM_SUPERCEDE
				}
				
				if (velocity_normal[0] < aim_normal[0])
				{
					velocity[0] += 150.0
				}
				else if (velocity_normal[0] > aim_normal[0])
				{
					velocity[0] -= 150.0
				}
				
				if (velocity_normal[1] < aim_normal[1])
				{
					velocity[1] += 150.0
				}
				else if (velocity_normal[1] > aim_normal[1])
				{
					velocity[1] -= 150.0
				}
				
				if (velocity_normal[2] < aim_normal[2])
				{
					velocity[2] += 25.0
				}
				else if (velocity_normal[2] > aim_normal[2])
				{
					velocity[2] -= 25.0
				}
				
				velocity[2] += 5.0
				
				entity_set_vector(ent, EV_VEC_velocity, velocity)
			}
			
			entity_set_float(ent, EV_FL_nextthink, get_gametime() + 0.02)
			return HAM_SUPERCEDE
		}
	}
	return HAM_IGNORED;
}

public crazy_explode(entity)
{
	if(!pev_valid(entity))
		return
	
	static Float:origin[3];
	pev(entity, pev_origin, origin)
	create_blast4(origin)
	emit_sound(entity, CHAN_WEAPON, explosion_sound, VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
	static victim 
	victim = -1
	
	while((victim = engfunc (EngFunc_FindEntityInSphere, victim, origin, 250.0)) != 0)
	{
		if (!is_user_alive(victim) || get_user_team(victim) != 1)
			continue
			
		if(!task_exists(victim+TASK_AFFECT)) 
			set_task(0.2, "affect_victim", victim+TASK_AFFECT, _, _, "a", 30)
	}
	engfunc(EngFunc_RemoveEntity, entity)
}

create_blast4(const Float:originF[3])
{
	engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, originF, 0)
	write_byte(TE_BEAMCYLINDER)
	engfunc(EngFunc_WriteCoord, originF[0])
	engfunc(EngFunc_WriteCoord, originF[1])
	engfunc(EngFunc_WriteCoord, originF[2])
	engfunc(EngFunc_WriteCoord, originF[0])
	engfunc(EngFunc_WriteCoord, originF[1])
	engfunc(EngFunc_WriteCoord, originF[2]+470.0)
	write_short(beam_effect)
	write_byte(0)
	write_byte(0)
	write_byte(4)
	write_byte(60)
	write_byte(0)
	write_byte(50)
	write_byte(70)
	write_byte(100)
	write_byte(200)
	write_byte(0)
	message_end()
	
	engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, originF, 0)
	write_byte(TE_BEAMCYLINDER)
	engfunc(EngFunc_WriteCoord, originF[0])
	engfunc(EngFunc_WriteCoord, originF[1])
	engfunc(EngFunc_WriteCoord, originF[2])
	engfunc(EngFunc_WriteCoord, originF[0])
	engfunc(EngFunc_WriteCoord, originF[1])
	engfunc(EngFunc_WriteCoord, originF[2]+555.0)
	write_short(beam_effect)
	write_byte(0)
	write_byte(0)
	write_byte(4)
	write_byte(60)
	write_byte(0)
	write_byte(50)
	write_byte(70)
	write_byte(100)
	write_byte(200)
	write_byte(0)
	message_end()
	
	engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, originF, 0)
	write_byte(TE_DLIGHT)
	engfunc(EngFunc_WriteCoord, originF[0])
	engfunc(EngFunc_WriteCoord, originF[1])
	engfunc(EngFunc_WriteCoord, originF[2])
	write_byte(50)
	write_byte(50)
	write_byte(70)
	write_byte(100)
	write_byte(30)
	write_byte(30)
	message_end()

	engfunc(EngFunc_MessageBegin, MSG_BROADCAST,SVC_TEMPENTITY, originF, 0)
	write_byte(TE_EXPLOSION)
	engfunc(EngFunc_WriteCoord, originF[0])
	engfunc(EngFunc_WriteCoord, originF[1])
	engfunc(EngFunc_WriteCoord, originF[2]+75)
	write_short(crazyexp)
	write_byte(17)
	write_byte(15)
	write_byte(TE_EXPLFLAG_NOSOUND)
	message_end();	
	
	engfunc(EngFunc_MessageBegin, MSG_BROADCAST,SVC_TEMPENTITY, originF, 0)
	write_byte(TE_SPRITETRAIL)
	engfunc(EngFunc_WriteCoord, originF[0])
	engfunc(EngFunc_WriteCoord, originF[1])
	engfunc(EngFunc_WriteCoord, originF[2] + 40)
	engfunc(EngFunc_WriteCoord, originF[0])
	engfunc(EngFunc_WriteCoord, originF[1])
	engfunc(EngFunc_WriteCoord, originF[2])
	write_short(crazygib)
	write_byte(30)
	write_byte(10)
	write_byte(2)
	write_byte(50)
	write_byte(10)
	message_end();
}

public affect_victim(taskid)
{
	if(g_endround)
		return;
	
	if(!is_user_alive(ID_AFFECT) || get_user_team(ID_AFFECT) != 1)
		return
		
	message_begin(MSG_ONE_UNRELIABLE, g_msgScreenFade, {0,0,0}, ID_AFFECT)
	write_short(1<<13)
	write_short(1<<14)
	write_short(0x0000)
	write_byte(random_num(50, 200))
	write_byte(random_num(50, 200))
	write_byte(random_num(50, 200))
	write_byte(random_num(50, 200))
	message_end()
		
	message_begin(MSG_ONE_UNRELIABLE, g_screenshake, {0,0,0}, ID_AFFECT)
	write_short(0xFFFF)
	write_short(1<<13)
	write_short(0xFFFF)
	message_end()
	remove_task(ID_AFFECT)
}

public set_model(entity, const model[])
{
	if(strlen(model) < 8)
		return FMRES_IGNORED;

	if(model[7] != 'w' || model[8] != '_')
		return FMRES_IGNORED;
	
	static Float:dmgtime
	pev(entity, pev_dmgtime, dmgtime)
	
	if(get_user_team(pev(entity, pev_owner)) == 1)
	{
		if(dmgtime == 0.0)
			return FMRES_IGNORED;
		if(model[9] == 'h' && model[10] == 'e')
		{
			message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
			write_byte(TE_BEAMFOLLOW)
			write_short(entity)
			write_short(trail_spr)
			write_byte(15)
			write_byte(10)
			write_byte(200)
			write_byte(20)
			write_byte(10)
			write_byte(200)
			message_end()
			set_pev(entity, PEV_NADE_TYPE, NADE_TYPE_NAPALM)
			fm_set_rendering(entity, kRenderFxGlowShell, 200, 20, 10, kRenderNormal, 18)
			entity_set_model(entity, w_grenade_furien[0])
			return FMRES_SUPERCEDE;
		}
		else if(model[9] == 'f' && model[10] == 'l')
		{
			message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
			write_byte(TE_BEAMFOLLOW)
			write_short(entity)
			write_short(trail_spr)
			write_byte(15)
			write_byte(10)
			write_byte(10)
			write_byte(20)
			write_byte(200)
			write_byte(200)
			message_end()
			set_pev(entity, PEV_NADE_TYPE, NADE_TYPE_FROST)
			fm_set_rendering(entity, kRenderFxGlowShell, 10, 20, 200, kRenderNormal, 18)
			entity_set_model(entity, w_grenade_furien[1])
			return FMRES_SUPERCEDE;
		}
		else if(model[9] == 's' && model[10] == 'm')
		{
			if(have_killnade[pev(entity, pev_owner)])
			{
				message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
				write_byte(TE_BEAMFOLLOW)
				write_short(entity)
				write_short(trail_spr)
				write_byte(15)
				write_byte(15)
				write_byte(165)
				write_byte(45)
				write_byte(45)
				write_byte(200)
				message_end()
				set_pev(entity, PEV_NADE_TYPE, NADE_TYPE_KILL)
				entity_set_int(entity, EV_INT_movetype, MOVETYPE_BOUNCEMISSILE)
				entity_set_int(entity, EV_INT_iuser2, 0)
				entity_set_edict(entity, EV_ENT_euser2, 0)
				entity_set_size(entity, Float:{-2.0,-4.0,-2.0}, Float:{2.0, 4.0, 2.0})
				fm_set_rendering(entity, kRenderFxGlowShell, 165, 45, 45, kRenderNormal, 18)
				entity_set_float(entity, EV_FL_dmgtime, get_gametime() + 2.5)
				entity_set_model(entity, w_grenade_furien[2])
				have_killnade[pev(entity, pev_owner)] = false
				return FMRES_SUPERCEDE;
			}
			return FMRES_IGNORED;
		}
		return FMRES_IGNORED;
	}
	else
	{
		if(model[9] == 'h' && model[10] == 'e')
		{
			if(dmgtime == 0.0)
				return FMRES_IGNORED;
			message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
			write_byte(TE_BEAMFOLLOW)
			write_short(entity)
			write_short(trail_spr)
			write_byte(15)
			write_byte(10)
			write_byte(100)
			write_byte(50)
			write_byte(70)
			write_byte(200)
			message_end()
			fm_set_rendering(entity, kRenderFxGlowShell, 100, 50, 70, kRenderNormal, 18)
		}
		else if(model[9] == 'f' && model[10] == 'l')
		{
			if(dmgtime == 0.0)
				return FMRES_IGNORED;
			message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
			write_byte(TE_BEAMFOLLOW)
			write_short(entity)
			write_short(trail_spr)
			write_byte(15)
			write_byte(10)
			write_byte(200)
			write_byte(200)
			write_byte(200)
			write_byte(200)
			message_end()
			fm_set_rendering(entity, kRenderFxGlowShell, 200, 200, 200, kRenderNormal, 18)
		}
		else if(model[9] == 's' && model[10] == 'm')
		{
			if(dmgtime == 0.0)
				return FMRES_IGNORED;
			message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
			write_byte(TE_BEAMFOLLOW)
			write_short(entity)
			write_short(trail_spr)
			write_byte(15)
			write_byte(10)
			write_byte(50)
			write_byte(70)
			write_byte(100)
			write_byte(200)
			message_end()
			set_pev(entity, PEV_NADE_TYPE, NADE_TYPE_CRAZY)
			fm_set_rendering(entity, kRenderFxGlowShell, 50, 70, 100, kRenderNormal, 18)
		}
		else
			fm_set_rendering(entity, kRenderFxGlowShell, random(256), random(256), random(256), kRenderNormal, 18)
	}
	return FMRES_IGNORED;
}

public CWeaponBox_Touch(iWeaponBox, id)
{
	if(IsPlayer(id))
	{
		if(!is_user_alive(id))
			return HAM_SUPERCEDE

		if(IsWeaponBoxC4(iWeaponBox))
			return HAM_IGNORED

		if(get_user_team(id) == 1)
			return HAM_SUPERCEDE
		return HAM_IGNORED
	}
	return HAM_IGNORED
}

public GroundWeapon_Touch(iWeapon, id)
{
	if(IsPlayer(id))
	{
		if(!is_user_alive(id))
			return HAM_SUPERCEDE

		if(get_user_team(id) == 1)
			return HAM_SUPERCEDE
		return HAM_IGNORED
	}
	return HAM_IGNORED
}

public game_menu(id)
{
	if(get_user_team(id) == 3)
		return PLUGIN_CONTINUE;
	
	static menu_title[150], menu;
	formatex(menu_title, charsmax(menu_title), "\yFurien Mod Remaked" )
	menu = menu_create(menu_title, "gmenu_handler")
	static menu_item[150];
	static izStats[8], izBody[8], iRankPos, iRankMax;
	iRankPos = get_user_stats(id, izStats, izBody)
	iRankMax = get_statsnum()
	if(get_user_team(id) != 2 || !is_user_alive(id))
		formatex(menu_item, charsmax(menu_item), "\dMeniu Arme")
	else
	{
		if(g_cmdguns[id] && g_gunsselect[id] == 0)
			formatex(menu_item, charsmax(menu_item), "\dMeniu Arme [FOLOSIT | NU ESTE AUTOMAT]")
		else if(g_cmdguns[id] && g_gunsselect[id] == 1)
			formatex(menu_item, charsmax(menu_item), "\dMeniu Arme [FOLOSIT | NU ESTE AUTOMAT]")
		else if(g_cmdguns[id] && g_gunsselect[id] == 2)
			formatex(menu_item, charsmax(menu_item), "\dMeniu Arme [FOLOSIT | ALES DE RUNDA TRECUTA]")
		else if(g_cmdguns[id] && g_gunsselect[id] == 3)
			formatex(menu_item, charsmax(menu_item), "\dMeniu Arme [FOLOSIT | AUTOMAT]")
		else if(!g_cmdguns[id])
			formatex(menu_item, charsmax(menu_item), "\yMeniu Arme\r [NEFOLOSIT]")
	}
	menu_additem(menu, menu_item, "")
	if(!is_user_alive(id))
		formatex(menu_item, charsmax(menu_item), "\dMeniu Shop [%i$]", g_money[id])
	else
		formatex(menu_item, charsmax(menu_item), "\yMeniu Shop\r [%i$]", g_money[id])
	menu_additem(menu, menu_item, "")
	if(!(get_user_flags(id) & VIP_FLAG))
		formatex(menu_item, charsmax(menu_item), "\dOpen VIP Shop")
	else
		formatex(menu_item, charsmax(menu_item), "\yOpen VIP Shop")
	menu_additem(menu, menu_item, "")
	formatex(menu_item, charsmax(menu_item), "\yRank:\r [%d\y/\r %d]^nTotal:\r [%d\y UCIDERI |\r %d\y DECESE]", iRankPos, iRankMax, izStats[0], izStats[1])
	menu_additem(menu, menu_item, "")
	formatex(menu_item, charsmax(menu_item), "\yTop Rank\r Players")
	menu_additem(menu, menu_item, "")
	formatex(menu_item, charsmax(menu_item), "\yTop 15\r Levels")
	menu_additem(menu, menu_item, "")
	if(get_user_flags(id) & ADMIN_SLAY)
		formatex(menu_item, charsmax(menu_item), "\yJoin Spectator")
	else
		formatex(menu_item, charsmax(menu_item), "\dJoin Spectator")
	menu_additem(menu, menu_item, "")
	menu_display(id, menu, 0)
	return PLUGIN_HANDLED;
}

public gmenu_handler(id, menu, item)
{
	switch(item)
	{
		case 0:
		{
			if(!is_user_alive(id))
			{
				color(id, ".v%s.g Trebuie sa fii in.e viata.g pentru acest meniu.", TAG)
				return PLUGIN_HANDLED;
			}
			
			if(get_user_team(id) != 2)
			{
				color(id, ".v%s.g Trebuie sa fii.e Anti-Furien.g pentru a folosi acest meniu.", TAG)
				return PLUGIN_HANDLED;
			}
			
			if(g_cmdguns[id] && g_gunsselect[id] == 0)
			{
				color(id, ".v%s.g Meniul tau este deja activat.g.", TAG)
				return PLUGIN_HANDLED;
			}
			else if(g_cmdguns[id] && g_gunsselect[id] == 1)
			{
				color(id, ".v%s.g Meniul tau este deja.e activat.g.", TAG)
				return PLUGIN_HANDLED;
			}
			else if(g_cmdguns[id] && g_gunsselect[id] == 2)
			{
				color(id, ".v%s.g Meniul tau este deja.e activat.g.", TAG)
				return PLUGIN_HANDLED;
			}
			else if(g_cmdguns[id] && g_gunsselect[id] == 3)
			{
				color(id, ".v%s.g Meniul tau a fost.e reactivat.g.", TAG)
				g_gunsselect[id] = 0
				return PLUGIN_HANDLED;
			}
			else if(!g_cmdguns[id])
			{
				color(id, ".v%s.g Meniul tau de.e arme.g este reafisat.", TAG)
				primary_weap(id)
				return PLUGIN_HANDLED;
			}
			return PLUGIN_HANDLED;
		}
		case 1:
		{
			if(!is_user_alive(id))
			{
				color(id, ".v%s.g Shopul poate fi folosit doar daca sunteti in viata.", TAG)
				return PLUGIN_HANDLED;
			}
			shop_enter(id)
			return PLUGIN_HANDLED;
		}
		case 2:
		{
			if(!is_user_connected(id))
				return PLUGIN_HANDLED;
			
			shop_menu(id)
			return PLUGIN_HANDLED;
		}
		case 3:
		{
			if(!is_user_connected(id))
				return PLUGIN_HANDLED;
			
			static izStats[8], izBody[8], iRankPos, iRankMax;
			iRankPos = get_user_stats(id, izStats, izBody)
			iRankMax = get_statsnum()
			color(0, ".v%s.e %s.g este pe locul.e %d/%d.g. Are.e %d.g ucideri si.e %d.g decese.", TAG, get_name(id), iRankPos, iRankMax, izStats[0], izStats[1])
			return PLUGIN_HANDLED;
		}
		case 4:
		{
			if(!is_user_connected(id))
				return PLUGIN_HANDLED;
				
			open_topmenu(id)
			return PLUGIN_HANDLED;
		}
		case 5:
		{
			if(!is_user_connected(id))
				return PLUGIN_HANDLED;

			show_top(id)
			return PLUGIN_HANDLED;
		}
		case 6:
		{
			if(get_user_flags(id) & ADMIN_SLAY)
			{
				if(is_user_alive(id))
					user_kill(id)
				cs_set_user_team(id, CS_TEAM_SPECTATOR)
				color(0, ".v%s.e %s.g s-a mutat spectator.", TAG, get_name(id))
				return PLUGIN_HANDLED;
			}
			else
			{
				color(id, ".v%s.g Nu ai acces la aceasta comanda.", TAG)
				return PLUGIN_HANDLED;
			}
			return PLUGIN_HANDLED;
		}
	}
	return PLUGIN_HANDLED;
}

public open_topmenu(id)
{
	new menu = menu_create("\yTop Rank Players", "topmenu_handler")
	new stats_taked[8], crap[8], player_name[32], temp_message[256], add_item_menu[4], max_pages, iRankMax = get_statsnum();
	
	if(iRankMax < 360)
		max_pages = iRankMax
	else
		max_pages = 360
	
	for(new page = 0; page < max_pages; page++) 
	{
		get_stats(page, stats_taked, crap, player_name, charsmax(player_name))
		num_to_str(page + 1, add_item_menu, charsmax(add_item_menu))
		format(temp_message, charsmax(temp_message), "\y%s\d R:\r %i\d K:\r %i\d D:\r %i", player_name, page + 1, stats_taked[0], stats_taked[1])
		menu_additem(menu, temp_message, add_item_menu, 0)
	}
	menu_display(id, menu, 0)
}

public topmenu_handler(id, menu, item)
	return PLUGIN_HANDLED;
	
public reset_score(id)
{
	if(!is_user_connected(id))
		return PLUGIN_HANDLED;
		
	if(!is_user_alive(id))
	{
		color(id, ".v%s.g Poti sa-ti resetezi scorul doar cand esti in viata!", TAG)
		return PLUGIN_CONTINUE;
	}
	
	if(g_money[id] < 1)
	{
		color(id, ".v%s.g Iti trebuie.e 1$.g pentru a putea sa-ti resetezi scorul. Necesar.e %d$.g.", TAG, 1 - g_money[id])
		return PLUGIN_CONTINUE;
	}
	set_pev(id, pev_frags, 0.0)
	fm_cs_set_user_deaths(id, 0)
	g_money[id] -= 1
	color(0, ".v%s.e %s.g si-a resetat scorul!", TAG, get_name(id))
	return PLUGIN_HANDLED;
}

public plasma_bomb_effects(c4)
{
	c4 -= 652450
	
	if(g_endround)
	{
		remove_task(c4+652450)
		return;
	}
	
	if(!b_planted)
	{
		remove_task(c4+652450)
		return;
	}
	
	if(!pev_valid(c4))
	{
		remove_task(c4+652450)
		return;
	}
	
	new Float:origini[3]
	pev(c4, pev_origin, origini)
	engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, origini, 0)
	write_byte(TE_BEAMCYLINDER)
	engfunc(EngFunc_WriteCoord, origini[0])
	engfunc(EngFunc_WriteCoord, origini[1])
	engfunc(EngFunc_WriteCoord, origini[2])
	engfunc(EngFunc_WriteCoord, origini[0])
	engfunc(EngFunc_WriteCoord, origini[1])
	engfunc(EngFunc_WriteCoord, origini[2]+400.0)
	write_short(beam_effect)
	write_byte(0)
	write_byte(0)
	write_byte(4)
	write_byte(10)
	write_byte(0)
	write_byte(random(256))
	write_byte(random(256))
	write_byte(random(256))
	write_byte(200)
	write_byte(0)
	message_end()
	
	engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, origini, 0)
	write_byte(TE_BEAMCYLINDER)
	engfunc(EngFunc_WriteCoord, origini[0])
	engfunc(EngFunc_WriteCoord, origini[1])
	engfunc(EngFunc_WriteCoord, origini[2])
	engfunc(EngFunc_WriteCoord, origini[0])
	engfunc(EngFunc_WriteCoord, origini[1])
	engfunc(EngFunc_WriteCoord, origini[2]+450.0)
	write_short(beam_effect)
	write_byte(0)
	write_byte(0)
	write_byte(4)
	write_byte(15)
	write_byte(0)
	write_byte(random(256))
	write_byte(random(256))
	write_byte(random(256))
	write_byte(200)
	write_byte(0)
	message_end()
	engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, origini, 0)
	write_byte(TE_BEAMCYLINDER)
	engfunc(EngFunc_WriteCoord, origini[0])
	engfunc(EngFunc_WriteCoord, origini[1])
	engfunc(EngFunc_WriteCoord, origini[2])
	engfunc(EngFunc_WriteCoord, origini[0])
	engfunc(EngFunc_WriteCoord, origini[1])
	engfunc(EngFunc_WriteCoord, origini[2]+550.0)
	write_short(beam_effect)
	write_byte(0)
	write_byte(0)
	write_byte(4)
	write_byte(25)
	write_byte(0)
	write_byte(random(256))
	write_byte(random(256))
	write_byte(random(256))
	write_byte(200)
	write_byte(0)
	message_end()
	
	fm_set_rendering(c4, kRenderFxGlowShell, random(255), random(255), random(255), kRenderNormal, 50)
	if(g_c4timer < 11)
	{
		static Float:coord[3];
		coord[0] = origini[0] + 150.0;
		coord[1] = origini[1] + 150.0;
		coord[2] = origini[2] + 800.0;
		create_thunder(coord, origini);
		if(active_fog)
			msg_create_fog(random(250), random(250), random(250), 3)
	}

	if(g_c4timer >= 0)
	{
		--g_c4timer;
		if(g_c4timer < 41 && g_c4timer > 13)
			emit_sound(c4, CHAN_ITEM, misc_sound_wav[4], 1.0, ATTN_NORM, 0, PITCH_NORM)
		else if(g_c4timer == 13)
		{
			emit_sound(c4, CHAN_ITEM, misc_sound_wav[5], 1.0, ATTN_NORM, 0, PITCH_NORM)
			set_lights("c")
		}
		set_dhudmessage(random(255), random(255), random(255), -1.0, 0.0, 1, 1.0, 1.0, 0.0, 0.0)
		if(g_c4timer > 0)
			show_dhudmessage(0, "%d secund%s ramas%s pana la explozie!", g_c4timer, g_c4timer < 2 ? "a" : "e", g_c4timer < 2 ? "a" : "e")
	}
}

public check_weapon(id)
{
	if(!is_user_alive(id))
		return;
		
	switch(get_user_team(id))
	{
		case 1:
		{
			switch(get_user_weapon(id))
			{
				case CSW_KNIFE:
				{
					if(g_superknife[id])
						set_pev(id, pev_viewmodel2, super_knife_furien)
					else
						set_pev(id, pev_viewmodel2, knife_furien)
				}
				case CSW_HEGRENADE: set_pev(id, pev_viewmodel2, v_grenade_furien[0])
				case CSW_FLASHBANG: set_pev(id, pev_viewmodel2, v_grenade_furien[1])
				case CSW_SMOKEGRENADE:
				{
					if(have_killnade[id])
						set_pev(id, pev_viewmodel2, v_grenade_furien[2])
				}
				case CSW_C4:
				{
					set_pev(id, pev_viewmodel2, plasma_bomb[1])
					set_pev(id, pev_weaponmodel2, plasma_bomb[0])
				}
			}
		}
		case 2:
		{
			if(g_ak47[id] && get_user_weapon(id) == CSW_AK47)
			{
				set_pev(id, pev_viewmodel2, v_ak47)
				set_pev(id, pev_weaponmodel2, p_ak47)
			}
			else if(g_m4a1[id] && get_user_weapon(id) == CSW_M4A1)
			{
				set_pev(id, pev_viewmodel2, v_m4a1)
				set_pev(id, pev_weaponmodel2, p_m4a1)
			}
			else if(g_deagle[id] && get_user_weapon(id) == CSW_DEAGLE)
			{
				set_pev(id, pev_viewmodel2, v_deagle)
				set_pev(id, pev_weaponmodel2, p_deagle)
			}
		}
	}
}

public msg_screenfade(msgid, dest, id)
{
	if(!IsPlayer(id))
		return PLUGIN_CONTINUE
	
	if(get_user_team(id) == 2 || !is_user_alive(id) || g_noflash[id])
	{
		static date[4]
		date[0] = get_msg_arg_int(4); date[1] = get_msg_arg_int(5)
		date[2] = get_msg_arg_int(6); date[3] = get_msg_arg_int(7)
		
		if(date[0] == 255 && date[1] == 255 && date[2] == 255 && date[3] > 199)
			return PLUGIN_HANDLED
	}
	return PLUGIN_CONTINUE
}

public ham_take_damage(vic, inf, att, Float:dmg, dmgbits)
{
	if(get_user_team(att) == 1 && g_superknife[att] && !(dmgbits & DMG_NADE))
		dmg *= 2.0
		
	if(is_user_alive(att) && get_user_team(att) == 2 && ((g_ak47[att] && get_user_weapon(att) == CSW_AK47) || (g_m4a1[att] && get_user_weapon(att) == CSW_M4A1) || (g_deagle[att] && get_user_weapon(att) == CSW_DEAGLE)))
		dmg *= 2.0
	
	SetHamParamFloat(4, dmg)
	
	if(is_user_alive(vic) && inf == bomba)
	{
		SetHamParamFloat(4, 0.0);
		return HAM_SUPERCEDE;
	}
	if((vic == att) && (dmgbits & DMG_NADE))
		return HAM_SUPERCEDE;
	return HAM_IGNORED;
}

public on_damage(id)
{
	static attacker; attacker = get_user_attacker(id)
	static damage; damage = read_data(2)		
	if(IsPlayer(attacker))
	{
		if(fm_is_ent_visible(attacker, id))
		{
			g_iPlayerPos[attacker] += 1
			if(g_iPlayerPos[attacker] == sizeof(g_flCoords))
				g_iPlayerPos[attacker] = 0		
			set_dhudmessage(random(256), random(256), random(256), Float:g_flCoords[g_iPlayerPos[attacker]][0], Float:g_flCoords[g_iPlayerPos[attacker]][1], 0, 0.1, 2.5, 0.02, 0.02)
			show_dhudmessage(attacker, "%i^n", damage)				
		}
	}
}

register_buy_cmd()
{
	register_clcmd("buy", "ClientCommand_Buy")
	register_clcmd("bUy", "ClientCommand_Buy")
	register_clcmd("buY", "ClientCommand_Buy")
	register_clcmd("bUY", "ClientCommand_Buy")
	register_clcmd("Buy", "ClientCommand_Buy")
	register_clcmd("BUy", "ClientCommand_Buy")
	register_clcmd("BuY", "ClientCommand_Buy")
	register_clcmd("BUY", "ClientCommand_Buy")
}

public ClientCommand_Buy(id)
	return PLUGIN_HANDLED_MAIN

PlaySound(const sound[])
{
	if(equal(sound[strlen(sound)-4], ".mp3"))
		client_cmd(0, "mp3 play ^"%s^"", sound)
	else
		client_cmd(0, "spk ^"%s^"", sound)
}

public ScreenFade(red, green, blue)
{
	message_begin(MSG_BROADCAST, g_msgScreenFade);
	write_short((1<<12)*4);
	write_short((1<<12)*1);
	write_short(0x0001);
	write_byte(red);
	write_byte(green);
	write_byte(blue);
	write_byte(250);
	message_end();
}

set_vars_speed(id)
	client_cmd(id, "cl_sidespeed 700;cl_backspeed 700;cl_forwardspeed 700")
	
public sound_stop()
	client_cmd(0, "mp3 stop; stopsound")
	
public start_ambience()
{
	sound_stop()
	client_cmd(0, "mp3 play ^"%s^"", ambience)
}

public killed_player(victim, attacker)
{
	if(is_user_connected(victim) && is_user_alive(attacker))
		color(victim, ".v%s.e %s.g mai are inca.e[.v%d HP.e].g", TAG, get_name(attacker), get_user_health(attacker))
	g_frozen[victim] = false
	g_noflash[victim] = false
	g_nofrost[victim] = false
	g_superknife[victim] = false
	g_furiendetector[victim] = false
	g_end_health[victim] = 0
	parachute_reset(victim)
	have_killnade[victim] = false
	remove_task(victim+TASK_AFFECT)
	remove_task(victim+TASK_AURA)
	if(g_pet[victim])
		kill_pet(victim)

	reset_vars(victim)
	if(active_box)
		AddBonusBox(victim)
	if(get_user_team(victim) == 2)
		remove_task(victim+TASK_BURN)
		
	if(is_user_connected(attacker) && is_user_connected(victim) && attacker != victim)
		g_money[attacker] += 3
		
	if(destroyer[victim])
	{
		ham_strip_weapon(victim, "weapon_c4")
		destroyer[victim] = false
		select_destroyer()
	}
	if(savior[victim])
	{
		strip_user_weapons(victim)
		savior[victim] = false
		select_savior()
	}
}

public newSpawn(id)
{
	if(para_ent[id] > 0) 
		if(is_valid_ent(para_ent[id])) 
			remove_entity(para_ent[id])
	has_parachute[id] = true
	para_ent[id] = 0
	if(!active_huds)
	{
		set_pdata_int(id, m_iClientHideHUD, 0)
		set_pdata_int(id, m_iHideHUD, HIDE_HEALTH)
	}
	make_HideWeapon(id, HIDE_MONEY);
}

public fw_SetClientKeyValue(id, const infobuffer[], const key[], const value[])
{
	if(flag_get(g_HasCustomModel, id) && equal(key, "model"))
	{
		static currentmodel[32]
		fm_cs_get_user_model(id, currentmodel, charsmax(currentmodel))
		if(!equal(currentmodel, g_CustomPlayerModel[id]) && !task_exists(id+TASK_MODELCHANGE))
			fm_cs_set_user_model(id+TASK_MODELCHANGE)
		return FMRES_SUPERCEDE;
	}
	return FMRES_IGNORED;
}

public CmdStart(id, uc_handle, seed)
{
	new ent = fm_find_ent_by_class(id, ClassName)
	if(is_valid_ent(ent))
	{
		new classname[32]	
		pev(ent, pev_classname, classname, 31)
		if (equal(classname, ClassName))
		{
			if (pev(ent, pev_frame) >= 120)
				set_pev(ent, pev_frame, 0.0)
			else
				set_pev(ent, pev_frame, pev(ent, pev_frame) + 1.0)
			
			switch(pev(ent, pev_team))
			{
				case 1: 
				{
					
				}
				case 2: 
				{
					
				}
			}
		}
	}
}

parachute_reset(id)
{
	if(para_ent[id] > 0) 
		if(is_valid_ent(para_ent[id])) 
			remove_entity(para_ent[id])
	has_parachute[id] = false
	para_ent[id] = 0
}

fire_explode(ent)
{
	if(g_endround)
		return
	
	static Float:originF[3]
	pev(ent, pev_origin, originF)
	create_blast2(originF)
	emit_sound(ent, CHAN_WEAPON, misc_sound_wav[7], 1.0, ATTN_NORM, 0, PITCH_NORM)
	static victim
	victim = -1
	while((victim = engfunc(EngFunc_FindEntityInSphere, victim, originF, 250.0)) != 0)
	{
		if(!is_user_alive(victim) || get_user_team(victim) != 2)
			continue;
			
		g_burning_duration[victim] += 15
		
		if(!task_exists(victim+TASK_BURN))
			set_task(0.2, "burning_flame", victim+TASK_BURN, _, _, "b")
	}
	engfunc(EngFunc_RemoveEntity, ent)
}

frost_explode(ent)
{
	if(g_endround)
		return
		
	static Float:originF[3]
	pev(ent, pev_origin, originF)
	create_blast3(originF)
	emit_sound(ent, CHAN_WEAPON, misc_sound_wav[2], 1.0, ATTN_NORM, 0, PITCH_NORM)
	static victim
	victim = -1
	
	while((victim = engfunc(EngFunc_FindEntityInSphere, victim, originF, 250.0)) != 0)
	{
		if(!is_user_alive(victim) || get_user_team(victim) != 2 || g_nofrost[victim])
			continue;
		
		fm_set_rendering(victim, kRenderFxGlowShell, 0, 100, 200, kRenderNormal, 25)
		emit_sound(victim, CHAN_BODY, misc_sound_wav[3], 1.0, ATTN_NORM, 0, PITCH_NORM)
		
		message_begin(MSG_ONE_UNRELIABLE, g_msgScreenFade, _, victim)
		write_short(0)
		write_short(0)
		write_short(FFADE_STAYOUT)
		write_byte(10)
		write_byte(20)
		write_byte(200)
		write_byte(150)
		message_end()
		g_frozen[victim] = true
		if(pev(victim, pev_flags) & FL_ONGROUND)
			set_pev(victim, pev_gravity, 999999.9)
		else
			set_pev(victim, pev_gravity, 0.000001)
		reset_max_speed(victim)
		set_task(0.2, "freeze_effect", victim, _, _, "b")
		set_task(1.2, "remove_freeze", victim)
	}
	engfunc(EngFunc_RemoveEntity, ent)
}

public burning_flame(taskid)
{
	static origin[3], flags
	get_user_origin(ID_BURN, origin)
	flags = pev(ID_BURN, pev_flags)
	
	if((flags & FL_INWATER) || g_burning_duration[ID_BURN] < 1)
	{
		message_begin(MSG_PVS, SVC_TEMPENTITY, origin)
		write_byte(TE_SMOKE)
		write_coord(origin[0])
		write_coord(origin[1])
		write_coord(origin[2]-50)
		write_short(smoke_spr)
		write_byte(random_num(15, 20))
		write_byte(random_num(10, 20))
		message_end()
		remove_task(taskid);
		return;
	}

	if(random_num(0, 20) < 3)
	{
		emit_sound(ID_BURN, CHAN_VOICE, burn_player[random_num(0, 2)], 1.0, ATTN_NORM, 0, PITCH_NORM)

		if((flags & FL_ONGROUND) > 0.0)
		{
			static Float:velocity[3];
			pev(ID_BURN, pev_velocity, velocity);
			xs_vec_mul_scalar(velocity, 0.5, velocity);
			set_pev(ID_BURN, pev_velocity, velocity);
		}
	}
	
	static health
	health = get_user_health(ID_BURN)
	if(health - 1 > 0)
		set_user_health(ID_BURN, get_user_health(ID_BURN) - 1)
	
	message_begin(MSG_PVS, SVC_TEMPENTITY, origin)
	write_byte(TE_SPRITE)
	write_coord(origin[0]+random_num(-5, 5))
	write_coord(origin[1]+random_num(-5, 5))
	write_coord(origin[2]+random_num(-10, 10))
	write_short(flame_spr)
	write_byte(random_num(5, 10))
	write_byte(200)
	message_end()
	
	g_burning_duration[ID_BURN]--
}

public prethink_player(id)
{
	if(!is_user_alive(id))
		return;
		
	static i, LastThink
	
	if(LastThink > id)
		FirstThink()
	LastThink = id
	
	if(g_frozen[id])
	{
		set_pev(id, pev_velocity, Float:{0.0,0.0,0.0})
		return;
	}
	
	new nbut = get_user_button(id)
	new obut = get_user_oldbutton(id)
	if((nbut & IN_JUMP) && !(get_entity_flags(id) & FL_ONGROUND) && !(obut & IN_JUMP))
	{
		if(jumpnum[id] < 1)
		{
			dojump[id] = true
			jumpnum[id]++
			return
		}
	}
	if((nbut & IN_JUMP) && (get_entity_flags(id) & FL_ONGROUND))
	{
		jumpnum[id] = 0
		return
	}
	
	if(get_user_team(id) == 2 && (g_furiendetector[id] || savior[id]))
	{
		static Target, Body, Weapon;
		
		get_user_aiming(id, Target, Body);
		Weapon = get_user_weapon(id);
			
		if((1<<Weapon) & PRIMARY_WEAPONS_BITSUM || (1<<Weapon) & SECONDARY_WEAPONS_BITSUM) 
		{
			static Target, Body, Weapon;
			
			get_user_aiming(id, Target, Body);
			Weapon = get_user_weapon(id);
			
			if((1<<Weapon) & PRIMARY_WEAPONS_BITSUM || (1<<Weapon) & SECONDARY_WEAPONS_BITSUM) 
			{
				static Origin[3];
				get_user_origin(id, Origin, 3);
				
				message_begin(MSG_BROADCAST, SVC_TEMPENTITY);
				write_byte(TE_BEAMENTPOINT);
				write_short(id | 0x1000);
				write_coord(Origin[0]);
				write_coord(Origin[1]);
				write_coord(Origin[2]);
				write_short(LaserSprite);
				write_byte(0);
				write_byte(10);
				write_byte(1);
				write_byte(5);
				write_byte(0);
				if(is_user_alive(Target) && get_user_team(Target) == 1) 
				{
					write_byte(150);
					write_byte(0);
					write_byte(0);
				}
				else 
				{
					write_byte(0);
					write_byte(150);
					write_byte(0);
				}
				write_byte(250);
				write_byte(25);
				message_end();
			}
		}
	}
	
	if(!has_parachute[id])
		return

	new Float:fallspeed = 100.0 * -1.0
	new Float:frame

	new button = get_user_button(id)
	new oldbutton = get_user_oldbutton(id)
	new flags = get_entity_flags(id)

	if(para_ent[id] > 0 && (flags & FL_ONGROUND)) 
	{
		if(entity_get_int(para_ent[id],EV_INT_sequence) != 2) 
		{
			entity_set_int(para_ent[id], EV_INT_sequence, 2)
			entity_set_int(para_ent[id], EV_INT_gaitsequence, 1)
			entity_set_float(para_ent[id], EV_FL_frame, 0.0)
			entity_set_float(para_ent[id], EV_FL_fuser1, 0.0)
			entity_set_float(para_ent[id], EV_FL_animtime, 0.0)
			entity_set_float(para_ent[id], EV_FL_framerate, 0.0)
			return
		}

		frame = entity_get_float(para_ent[id],EV_FL_fuser1) + 2.0
		entity_set_float(para_ent[id],EV_FL_fuser1,frame)
		entity_set_float(para_ent[id],EV_FL_frame,frame)

		if(frame > 254.0) 
		{
			remove_entity(para_ent[id])
			para_ent[id] = 0
		}
	}

	if(button & IN_USE) 
	{
		new Float:velocity[3]
		entity_get_vector(id, EV_VEC_velocity, velocity)

		if(velocity[2] < 0.0) {

			if(para_ent[id] <= 0) {
				para_ent[id] = create_entity("info_target")
				if(para_ent[id] > 0) {
					entity_set_string(para_ent[id],EV_SZ_classname,"parachute")
					entity_set_edict(para_ent[id], EV_ENT_aiment, id)
					entity_set_edict(para_ent[id], EV_ENT_owner, id)
					entity_set_int(para_ent[id], EV_INT_movetype, MOVETYPE_FOLLOW)
					entity_set_model(para_ent[id], "models/furien/krilo2.mdl")
					entity_set_int(para_ent[id], EV_INT_sequence, 0)
					entity_set_int(para_ent[id], EV_INT_gaitsequence, 1)
					entity_set_float(para_ent[id], EV_FL_frame, 0.0)
					entity_set_float(para_ent[id], EV_FL_fuser1, 0.0)
				}
			}

			if(para_ent[id] > 0) {

				entity_set_int(id, EV_INT_sequence, 3)
				entity_set_int(id, EV_INT_gaitsequence, 1)
				entity_set_float(id, EV_FL_frame, 1.0)
				entity_set_float(id, EV_FL_framerate, 1.0)

				velocity[2] = (velocity[2] + 40.0 < fallspeed) ? velocity[2] + 40.0 : fallspeed
				entity_set_vector(id, EV_VEC_velocity, velocity)

				if(entity_get_int(para_ent[id],EV_INT_sequence) == 0) {

					frame = entity_get_float(para_ent[id],EV_FL_fuser1) + 1.0
					entity_set_float(para_ent[id],EV_FL_fuser1,frame)
					entity_set_float(para_ent[id],EV_FL_frame,frame)

					if(frame > 100.0) {
						entity_set_float(para_ent[id], EV_FL_animtime, 0.0)
						entity_set_float(para_ent[id], EV_FL_framerate, 0.4)
						entity_set_int(para_ent[id], EV_INT_sequence, 1)
						entity_set_int(para_ent[id], EV_INT_gaitsequence, 1)
						entity_set_float(para_ent[id], EV_FL_frame, 0.0)
						entity_set_float(para_ent[id], EV_FL_fuser1, 0.0)
					}
				}
			}
		}
		else if(para_ent[id] > 0) 
		{
			remove_entity(para_ent[id])
			para_ent[id] = 0
		}
	}
	else if((oldbutton & IN_USE) && para_ent[id] > 0) 
	{
		remove_entity(para_ent[id])
		para_ent[id] = 0
	}
	
	if(g_endround)
	{
		set_pev(id, pev_velocity, Float:{18.0, 18.0, 16.0})
		return;
	}
	
	if(!plrSolid[id]) return
	
	for(i = 1; i <= g_iMaxPlayers; i++)
	{
		if(!plrSolid[i] || id == i) continue
		
		if(plrTeam[i] == plrTeam[id])
		{
			set_pev(i, pev_solid, SOLID_NOT)
			plrRestore[i] = true
		}
	}
}

public set_gamename()
{
	forward_return(FMV_STRING, modname)
	return FMRES_SUPERCEDE;
}

public Fix()
{
	static i, fpf;
	if(!fpf)
		fpf = g_iMaxPlayers;
	
	for(i = 1; i <= fpf; i++)
	{
		if(IsPlayer(i))
			Data(i);
	}
}

public Calcu()
{
	static Iterator, ping, fpf;
	if(!fpf)
		fpf = g_iMaxPlayers;
	for(Iterator = 1; Iterator <= fpf; Iterator++) 
	{ 
		ping = random_num(10, 35);
		for(g_Offset[Iterator][0] = 0; g_Offset[Iterator][0] < 4; g_Offset[Iterator][0]++)
		{
			if((ping - g_Offset[Iterator][0]) % 4 == 0)
			{
				g_Argping[Iterator][0] = (ping - g_Offset[Iterator][0]) / 4;
				break;
			}
		}
		for(g_Offset[Iterator][1] = 0; g_Offset[Iterator][1] < 2; g_Offset[Iterator][1]++)
		{
			if((ping - g_Offset[Iterator][1]) % 2 == 0)
			{
				g_Argping[Iterator][1] = (ping - g_Offset[Iterator][1]) / 2;
				break;
			}
		}
		g_Argping[Iterator][2] = ping;
	}
}

public Data(i)
{
	static j, send, fpf;
	if(!(pev(i,pev_button)&IN_SCORE)&&!(pev(i,pev_oldbuttons)&IN_SCORE)) 
		return;
	if(!fpf)
		fpf=g_iMaxPlayers;
	
	send = 0;
	for(j = 1; j <= fpf; j++) 
	{
		if(!IsPlayer(j))
			continue;
		switch(send)
		{
			case 0:
			{
				message_begin(MSG_ONE_UNRELIABLE, SVC_PINGS, _, i);
				write_byte((g_Offset[j][0]*64)+(1+2*(j-1)));
				write_short(g_Argping[j][0]);
				send ++;
			}
			case 1:
			{
				write_byte((g_Offset[j][1]*128)+(2+4*(j-1)));
				write_short(g_Argping[j][1]);
				send ++;
			}
			case 2:
			{
				write_byte((4+8*(j-1)));
				write_short(g_Argping[j][2]);
				write_byte(0);
				message_end();
				send = 0;
			}
		}
	}
	if(send)
	{
		write_byte(0);
		message_end();
	}
}

public eventMoney(plr)
{
	make_HideWeapon(plr, HIDE_MONEY);
	if(!active_huds)
	{
		set_pdata_int(plr, m_iClientHideHUD, 0)
		set_pdata_int(plr, m_iHideHUD, HIDE_HEALTH)
	}
	return PLUGIN_HANDLED;
}

public bomb_planted(id)
{
	if(is_user_alive(id))
	{
		color(0, ".v%s.e %s.g a primit.e 5$.g ca a plantat bomba cu plasma.", TAG, get_name(id))
		g_money[id] += 5
	}
}

public bomb_defused(id)
{
	if(is_user_alive(id))
	{
		color(0, ".v%s.e %s.g a primit.e 5$.g ca a dezamorsat bomba cu plasma.", TAG, get_name(id))
		g_money[id] += 5
	}
}

public ham_touch(toucher, touched)
{
	if(entity_get_int(toucher, EV_INT_movetype) != MOVETYPE_BOUNCEMISSILE)
		return HAM_IGNORED
	
	new Float:origin[3]
	new impacts = entity_get_int(toucher, EV_INT_iuser2)
	new owner = entity_get_edict(toucher, EV_ENT_owner)
	entity_get_vector(toucher, EV_VEC_origin, origin)
	
	if(1 <= touched <= g_iMaxPlayers)
	{
		new CsTeams:team[2]
		team[0] = cs_get_user_team(touched)
		team[1] = cs_get_user_team(owner)
		
		if((team[0] != team[1] && team[0] != CS_TEAM_SPECTATOR && team[0] != CS_TEAM_UNASSIGNED))
		{
			new Float:origin[3]
			entity_get_vector(touched, EV_VEC_origin, origin)
			blood(origin)
			set_pdata_int(touched, OFFSET_LAST_HIT_GROUP, HIT_HEAD, 5)
			ExecuteHamB(Ham_TakeDamage, touched, toucher, owner, 135.0, DMG_CS_BULLETS_KNIFE)
			entity_set_edict(toucher, EV_ENT_euser2, 0)
			entity_set_edict(toucher, EV_ENT_euser3, touched)
			
			new color[3] 
			color[0] = 165
			color[1] = 45
			color[2] = 45
			
			create_blast(origin, color)
		}
	}
	
	if(touched > g_iMaxPlayers || touched == 0)
		msg_ricochet(origin)
	
	impacts++
	
	entity_set_int(toucher, EV_INT_iuser2, impacts)
	
	if(impacts >= 1)
	{
		clear_beamfollow(toucher)
		entity_set_int(toucher, EV_INT_flags, FL_KILLME)
		metal_gibs(origin)
	}
	
	return HAM_IGNORED
}

clear_beamfollow(ent)
{
	message_begin(MSG_ALL,SVC_TEMPENTITY)
	write_byte(TE_KILLBEAM)
	write_short(ent)
	message_end()
}

msg_ricochet(Float:origin[3])
{
	engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, origin, 0)
	write_byte(TE_ARMOR_RICOCHET)
	engfunc(EngFunc_WriteCoord, origin[0])
	engfunc(EngFunc_WriteCoord, origin[1])
	engfunc(EngFunc_WriteCoord, origin[2])
	write_byte(5)
	message_end()
}

metal_gibs(const Float: origin[3])
{
	engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, origin, 0)
	write_byte(TE_BREAKMODEL)
	engfunc(EngFunc_WriteCoord,origin[0])
	engfunc(EngFunc_WriteCoord,origin[1])
	engfunc(EngFunc_WriteCoord,origin[2] + 24)
	engfunc(EngFunc_WriteCoord,20.0)
	engfunc(EngFunc_WriteCoord,20.0)
	engfunc(EngFunc_WriteCoord,20.0)
	engfunc(EngFunc_WriteCoord,random_num(-50,50))
	engfunc(EngFunc_WriteCoord,random_num(-50,50))
	engfunc(EngFunc_WriteCoord,25.0)
	write_byte(10)
	write_short(spr_nadebits)
	write_byte(10)
	write_byte(25)
	write_byte(2)
	message_end()
}


create_blast(Float:originF[3], rgb[3])
{
	new origin[3]
	FVecIVec(originF,origin)

	message_begin(MSG_BROADCAST,SVC_TEMPENTITY)
	write_byte(TE_BEAMCYLINDER)
	write_coord(origin[0])
	write_coord(origin[1])
	write_coord(origin[2])
	write_coord(origin[0])
	write_coord(origin[1])
	write_coord(origin[2] + 50)
	write_short(beam_effect)
	write_byte(0)
	write_byte(0)
	write_byte(4)
	write_byte(60)
	write_byte(0)
	write_byte(rgb[0])
	write_byte(rgb[1])
	write_byte(rgb[2])
	write_byte(100)
	write_byte(0)
	message_end()
}

public message_show_menu(msgid, dest, id) 
{
	if(!should_autojoin(id))
		return PLUGIN_CONTINUE

	static team_select[] = "#Team_Select"
	static menu_text_code[sizeof team_select]
	get_msg_arg_string(4, menu_text_code, sizeof menu_text_code - 1)
	if(!equal(menu_text_code, team_select))
		return PLUGIN_CONTINUE

	set_force_team_join_task(id, msgid)
	return PLUGIN_HANDLED
}

public message_vgui_menu(msgid, dest, id) 
{
	if(get_msg_arg_int(1) != 2 || !should_autojoin(id))
		return PLUGIN_CONTINUE

	set_force_team_join_task(id, msgid)

	return PLUGIN_HANDLED
}

bool:should_autojoin(id)
	return (!get_user_team(id) && !task_exists(id))
	
set_force_team_join_task(id, menu_msgid) 
{
	static param_menu_msgid[2]
	param_menu_msgid[0] = menu_msgid
	set_task(0.1, "task_force_team_join", id, param_menu_msgid, sizeof param_menu_msgid)
}

public task_force_team_join(menu_msgid[], id) 
{
	if(get_user_team(id))
		return

	force_team_join(id, menu_msgid[0])
}

stock force_team_join(id, menu_msgid) 
{
	static jointeam[] = "jointeam"
	static msg_block, joinclass[] = "joinclass"
	msg_block = get_msg_block(menu_msgid)
	set_msg_block(menu_msgid, BLOCK_SET)
	engclient_cmd(id, jointeam, "5")
	engclient_cmd(id, joinclass, "5")
	set_msg_block(menu_msgid, msg_block)
}

public prethink_player_post(id)
{
	if(!is_user_alive(id))
		return PLUGIN_CONTINUE
		
	static i
	for(i = 1; i <= g_iMaxPlayers; i++)
	{
		if(plrRestore[i])
		{
			set_pev(i, pev_solid, SOLID_SLIDEBOX)
			plrRestore[i] = false
		}
	}
	
	if(dojump[id] == true)
	{
		new Float:velocity[3]	
		entity_get_vector(id,EV_VEC_velocity,velocity)
		velocity[2] = random_float(265.0,285.0)
		entity_set_vector(id,EV_VEC_velocity,velocity)
		dojump[id] = false
		return PLUGIN_CONTINUE
	}
	return PLUGIN_CONTINUE
}

public msgStatusIcon(msgid, msgdest, id)
{
	static szIcon[8];
	get_msg_arg_string(2, szIcon, 7);

	if(equal(szIcon, "buyzone") && get_msg_arg_int(1))
	{
		set_pdata_int(id, 235, get_pdata_int(id, 235) & ~(1<<0));
		return PLUGIN_HANDLED;
	}
	return PLUGIN_CONTINUE;
}

public ChangeName(id, buffer)
{
	if(!is_user_connected(id))
		return FMRES_IGNORED;

	static Name[32], Val[32];
	get_user_name(id, Name, sizeof Name - 1);
	engfunc(EngFunc_InfoKeyValue, buffer, "name", Val, sizeof Val - 1);
	
	if(equal(Val, Name))
		return FMRES_IGNORED;

	remove_task(id+TASK_MINUTES)
	remove_task(id+TASK_SHOWHUD)
	set_task(0.2, "client_putinserver", id)
	verify_name(id)
	return FMRES_SUPERCEDE;
}

public hook_say(id)
{
	if(!is_user_connected(id))
		return PLUGIN_HANDLED;

	static chat[192], users_team, name[32]
	read_argv(1, chat, charsmax(chat))
	get_user_name(id, name, charsmax(name) - 1)
	users_team = fm_cs_get_user_team(id)
	
	static comanda[16], nume[32]

	strbreak(chat, comanda, charsmax(comanda), nume, charsmax(nume))
	if(equal(comanda, "/donate", 7))
		donate(id, nume)
	if(is_user_alive(id))
	{
		if(get_user_team(id) == 1)
		{
			if((get_user_flags(id) & VIP_FLAG) && (get_user_flags(id) & ADMIN_SLAY))
				color_chat(0, id, users_team, RED,  "^3[LVL:^4 %d^3] [^4VIP+ADMIN^3] %s:^4 %s", nivel[id], name, chat)
			else if((get_user_flags(id) & ADMIN_SLAY) && !(get_user_flags(id) & VIP_FLAG))
				color_chat(0, id, users_team, RED,  "^3[LVL:^4 %d^3] [^4ADMIN^3] %s:^4 %s", nivel[id], name, chat)
			else if(!(get_user_flags(id) & ADMIN_SLAY) && (get_user_flags(id) & VIP_FLAG))
				color_chat(0, id, users_team, RED,  "^3[LVL:^4 %d^3] [^4VIP^3] %s:^4 %s", nivel[id], name, chat)
			else
				color_chat(0, id, users_team, RED,  "^3[LVL:^4 %d^3] %s:^1 %s", nivel[id], name, chat)	
		}
		else if(get_user_team(id) == 2)
		{
			if((get_user_flags(id) & VIP_FLAG) && (get_user_flags(id) & ADMIN_SLAY))
				color_chat(0, id, users_team, BLUE,  "^3[LVL:^4 %d^3] [^4VIP+ADMIN^3] %s:^4 %s", nivel[id], name, chat)
			else if((get_user_flags(id) & ADMIN_SLAY) && !(get_user_flags(id) & VIP_FLAG))
				color_chat(0, id, users_team, BLUE,  "^3[LVL:^4 %d^3] [^4ADMIN^3] %s:^4 %s", nivel[id], name, chat)
			else if(!(get_user_flags(id) & ADMIN_SLAY) && (get_user_flags(id) & VIP_FLAG))
				color_chat(0, id, users_team, BLUE,  "^3[LVL:^4 %d^3] [^4VIP^3] %s:^4 %s", nivel[id], name, chat)
			else
				color_chat(0, id, users_team, BLUE,  "^3[LVL:^4 %d^3] %s:^1 %s", nivel[id], name, chat)	
		}
	}
	else
	{
		if(users_team == FM_CS_TEAM_SPECTATOR)
		{
			if((get_user_flags(id) & VIP_FLAG) && (get_user_flags(id) & ADMIN_SLAY))
				color_chat(0, id, users_team, GREY,  "^3[LVL:^4 %d^3] [^4VIP+ADMIN^3] %s:^4 %s", nivel[id], name, chat)
			else if((get_user_flags(id) & ADMIN_SLAY) && !(get_user_flags(id) & VIP_FLAG))
				color_chat(0, id, users_team, GREY,  "^3[LVL:^4 %d^3] [^4ADMIN^3] %s:^4 %s", nivel[id], name, chat)
			else if(!(get_user_flags(id) & ADMIN_SLAY) && (get_user_flags(id) & VIP_FLAG))
				color_chat(0, id, users_team, GREY,  "^3[LVL:^4 %d^3] [^4VIP^3] %s:^4 %s", nivel[id], name, chat)
			else
				color_chat(0, id, users_team, GREY,  "^3[LVL:^4 %d^3] %s:^1 %s", nivel[id], name, chat)	
		}
		else if(get_user_team(id) == 1)
		{
			if((get_user_flags(id) & VIP_FLAG) && (get_user_flags(id) & ADMIN_SLAY))
				color_chat(0, id, users_team, RED,  "^3[LVL:^4 %d^3] [^4VIP+ADMIN^3] *%s:^4 %s", nivel[id], name, chat)
			else if((get_user_flags(id) & ADMIN_SLAY) && !(get_user_flags(id) & VIP_FLAG))
				color_chat(0, id, users_team, RED,  "^3[LVL:^4 %d^3] [^4ADMIN^3] *%s:^4 %s", nivel[id], name, chat)
			else if(!(get_user_flags(id) & ADMIN_SLAY) && (get_user_flags(id) & VIP_FLAG))
				color_chat(0, id, users_team, RED,  "^3[LVL:^4 %d^3] [^4VIP^3] *%s:^4 %s", nivel[id], name, chat)
			else
				color_chat(0, id, users_team, RED,  "^3[LVL:^4 %d^3] %s:^1 *%s", nivel[id], name, chat)	
		}
		else if(get_user_team(id) == 2)
		{
			if((get_user_flags(id) & VIP_FLAG) && (get_user_flags(id) & ADMIN_SLAY))
				color_chat(0, id, users_team, BLUE,  "^3[LVL:^4 %d^3] [^4VIP+ADMIN^3] *%s:^4 %s", nivel[id], name, chat)
			else if((get_user_flags(id) & ADMIN_SLAY) && !(get_user_flags(id) & VIP_FLAG))
				color_chat(0, id, users_team, BLUE,  "^3[LVL:^4 %d^3] [^4ADMIN^3] *%s:^4 %s", nivel[id], name, chat)
			else if(!(get_user_flags(id) & ADMIN_SLAY) && (get_user_flags(id) & VIP_FLAG))
				color_chat(0, id, users_team, BLUE,  "^3[LVL:^4 %d^3] [^4VIP^3] *%s:^4 %s", nivel[id], name, chat)
			else
				color_chat(0, id, users_team, BLUE,  "^3[LVL:^4 %d^3] %s:^1 *%s", nivel[id], name, chat)	
		}		
	}
	return PLUGIN_HANDLED
}

public messageHideWeapon(msgid, dest, plr)
{
	set_msg_arg_int(1, ARG_BYTE, get_msg_arg_int(1)|HIDE_MONEY)
	return PLUGIN_CONTINUE;
}

public Event_HideWeapon(id)
{
	if(!active_huds)
	{
        message_begin(MSG_ONE_UNRELIABLE, g_msgHideWeapon, _, id)
        write_byte(HIDE_HEALTH)
        message_end()
        message_begin(MSG_ONE_UNRELIABLE, g_msgCrosshair, _, id)
        write_byte(0);
        message_end();
	}
}

public increase_level(taskid)
{
	if(get_user_team(ID_MINUTE) == 3)
		return;
	
	minutes[ID_MINUTE]++
	if(minutes[ID_MINUTE] >= 5)
	{
		minutes[ID_MINUTE] = 0
		complete_hours[ID_MINUTE]++
		if(complete_hours[ID_MINUTE] >= LEVELS[nivel[ID_MINUTE]])
		{
			color(ID_MINUTE, ".v%s.g Ai avansat un nivel! Nivelul tau acum este.e %d.g.", TAG, nivel[ID_MINUTE])
			nivel[ID_MINUTE]++
		}
	}
	SaveData(ID_MINUTE)
	checkandupdatetop(ID_MINUTE, nivel[ID_MINUTE], complete_hours[ID_MINUTE], minutes[ID_MINUTE])
}

public addToFullPack(es, e, ent, host, hostflags, player, pSet)
{
	if(player)
	{
		if(plrSolid[host] && plrSolid[ent] && plrTeam[host] == plrTeam[ent])
			set_es(es, ES_Solid, SOLID_NOT)
	}
}

FirstThink()
{
	for(new i = 1; i <= g_iMaxPlayers; i++)
	{
		if(!is_user_alive(i))
		{
			plrSolid[i] = false
			continue
		}
		plrTeam[i] = get_user_team(i)
		plrSolid[i] = pev(i, pev_solid) == SOLID_SLIDEBOX ? true : false
	}
}

public LoadData(id) 
{ 
	new vaultkey[64], vaultdata[256];
	format(vaultkey, 63, "%s", get_name(id))
	format(vaultdata, 255, "^"%i^" ^"%i^" ^"%i^"", nivel[id], complete_hours[id], minutes[id])
	nvault_get(salvare_nvault, vaultkey, vaultdata, 255)
	new lvl[32], ore[32], minute[32];
	parse(vaultdata, lvl, 31, ore, 31, minute, 31)
	nivel[id] = str_to_num(lvl)
	complete_hours[id] = str_to_num(ore)
	minutes[id] = str_to_num(minute)
	if(nivel[id] == 0)
		nivel[id] = 1
		
	color(id, "Am preluat salvarile.")
}

public SaveData(id) 
{
	new vaultkey[64], vaultdata[256];
	format(vaultkey, 63, "%s", get_name(id))
	format(vaultdata, 255, "^"%i^" ^"%i^" ^"%i^"", nivel[id], complete_hours[id], minutes[id])
	nvault_set(salvare_nvault, vaultkey, vaultdata)
}

public client_putinserver(id)
{
	g_cmdguns[id] = false
	g_gunsselect[id] = 0
	g_primary_select[id] = 0
	g_secondary_select[id] = 0
	reset_vars(id)
	g_money[id] = get_pcvar_num(mp_startmoney)
	set_task(60.0, "increase_level", id+TASK_MINUTES, _, _, "b")
	set_task(0.3, "HealthHud", id+TASK_SHOWHUD, _, _, "b")
	LoadData(id)
}

public client_disconnect(id)
{
	if(g_pet[id])
		kill_pet(id)
	reset_vars(id)
	g_frozen[id] = false
	g_burning_duration[id] = 0
	g_cmdguns[id] = false
	g_gunsselect[id] = 0
	g_primary_select[id] = 0
	g_secondary_select[id] = 0
	parachute_reset(id)
	have_killnade[id] = false
	jumpnum[id] = 0
	dojump[id] = false
	g_furiendetector[id] = false
	g_noflash[id] = false
	g_superknife[id] = false
	g_nofrost[id] = false
	g_end_health[id] = 0
	remove_task(id+TASK_MINUTES);
	remove_task(id+TASK_MODELCHANGE);
	remove_task(id+TASK_AFFECT);
	flag_unset(g_HasCustomModel, id)
	remove_task(id+TASK_SHOWHUD)
	remove_task(id+TASK_AURA)
	if(destroyer[id])
	{
		ham_strip_weapon(id, "weapon_c4")
		destroyer[id] = false
		select_destroyer()
	}
	if(savior[id])
	{
		savior[id] = false
		select_savior()
	}
}

public player_killed_post(id)
	set_pev(id, pev_iuser1, SPECMODE_ALIVE)

public freeze_effect(id)
{
	if(!is_user_alive(id) || !g_frozen[id])
	{
		remove_task(id)
		return;
	}
	new Float:fOrigin[3], iOrigin[3]
	pev(id, pev_origin, fOrigin)
	FVecIVec(fOrigin, iOrigin)
	UTIL_CreateFlares(iOrigin, frostgib, 5, 5, 2)
}

verify_name(id)
{
	static name[32]
	get_user_info(id, "name", name, 31)
	
	static i, ignore
	ignore = false
	
	for(i = 0; i <= g_sizeof_names_new; i++)
		if(containi(name, g_names_new[i]) != -1)
		{
			ignore = true
			break;
		}
	
	if(ignore)
		return;
	
	for(i = 0; i < 29; i++)
		replace_all(name, 31, g_filter_chars[i], "")
	
	for(i = 0; i < g_sizeof_names; i++)
		if(containi(name, g_names[i]) != -1)
		{
			formatex(name, 31, "%s [%d]", g_names_new[random_num(0, g_sizeof_names_new)], g_names_changed)
			set_user_info(id, "name", name)
			client_cmd(id, "name ^"%s^"", name)
			g_names_changed++
		}
}

public remove_freeze(id)
{
	if(!is_user_alive(id) || !g_frozen[id])
		return;
	
	g_frozen[id] = false;
	if(get_user_team(id) == 2)
		set_pev(id, pev_gravity, 1.0)

	reset_max_speed(id)
	fm_set_rendering(id, kRenderFxGlowShell, 0, 200, 50, kRenderNormal, 18)
	message_begin(MSG_ONE_UNRELIABLE, g_msgScreenFade, _, id)
	write_short(UNIT_SECOND)
	write_short(0)
	write_short(FFADE_IN)
	write_byte(10)
	write_byte(20)
	write_byte(200)
	write_byte(100)
	message_end()
	emit_sound(id, CHAN_BODY, misc_sound_wav[1], 1.0, ATTN_NORM, 0, PITCH_NORM)
	static origin2[3]
	get_user_origin(id, origin2)
	message_begin(MSG_PVS, SVC_TEMPENTITY, origin2)
	write_byte(TE_BREAKMODEL)
	write_coord(origin2[0])
	write_coord(origin2[1])
	write_coord(origin2[2]+24)
	write_coord(16)
	write_coord(16)
	write_coord(16) 
	write_coord(random_num(-50, 50))
	write_coord(random_num(-50, 50))
	write_coord(25)
	write_byte(10)
	write_short(mdl_glass)
	write_byte(10)
	write_byte(25)
	write_byte(BREAK_GLASS)
	message_end()
	ExecuteHamB(Ham_Player_ResetMaxSpeed, id)
}

create_blast2(const Float:originF[3])
{
	engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, originF, 0)
	write_byte(TE_BEAMCYLINDER)
	engfunc(EngFunc_WriteCoord, originF[0])
	engfunc(EngFunc_WriteCoord, originF[1])
	engfunc(EngFunc_WriteCoord, originF[2])
	engfunc(EngFunc_WriteCoord, originF[0])
	engfunc(EngFunc_WriteCoord, originF[1])
	engfunc(EngFunc_WriteCoord, originF[2]+470.0)
	write_short(beam_effect)
	write_byte(0)
	write_byte(0)
	write_byte(4)
	write_byte(60)
	write_byte(0)
	write_byte(255)
	write_byte(127)
	write_byte(80)
	write_byte(200)
	write_byte(0)
	message_end()
	
	engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, originF, 0)
	write_byte(TE_BEAMCYLINDER)
	engfunc(EngFunc_WriteCoord, originF[0])
	engfunc(EngFunc_WriteCoord, originF[1])
	engfunc(EngFunc_WriteCoord, originF[2])
	engfunc(EngFunc_WriteCoord, originF[0])
	engfunc(EngFunc_WriteCoord, originF[1])
	engfunc(EngFunc_WriteCoord, originF[2]+555.0)
	write_short(beam_effect)
	write_byte(0)
	write_byte(0)
	write_byte(4)
	write_byte(60)
	write_byte(0)
	write_byte(255)
	write_byte(20)
	write_byte(10)
	write_byte(200)
	write_byte(0)
	message_end()
	
	engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, originF, 0)
	write_byte(TE_DLIGHT)
	engfunc(EngFunc_WriteCoord, originF[0])
	engfunc(EngFunc_WriteCoord, originF[1])
	engfunc(EngFunc_WriteCoord, originF[2])
	write_byte(50)
	write_byte(255)
	write_byte(20)
	write_byte(10)
	write_byte(30)
	write_byte(30)
	message_end()

	engfunc(EngFunc_MessageBegin, MSG_BROADCAST,SVC_TEMPENTITY, originF, 0)
	write_byte(TE_EXPLOSION)
	engfunc(EngFunc_WriteCoord, originF[0])
	engfunc(EngFunc_WriteCoord, originF[1])
	engfunc(EngFunc_WriteCoord, originF[2]+75)
	write_short(fireexp)
	write_byte(17)
	write_byte(15)
	write_byte(TE_EXPLFLAG_NOSOUND)
	message_end();	
	
	engfunc(EngFunc_MessageBegin, MSG_BROADCAST,SVC_TEMPENTITY, originF, 0)
	write_byte(TE_SPRITETRAIL)
	engfunc(EngFunc_WriteCoord, originF[0])
	engfunc(EngFunc_WriteCoord, originF[1])
	engfunc(EngFunc_WriteCoord, originF[2] + 40)
	engfunc(EngFunc_WriteCoord, originF[0])
	engfunc(EngFunc_WriteCoord, originF[1])
	engfunc(EngFunc_WriteCoord, originF[2])
	write_short(firegib)
	write_byte(30)
	write_byte(10)
	write_byte(2)
	write_byte(50)
	write_byte(10)
	message_end();
}

create_blast3(const Float:originF[3])
{
	engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, originF, 0)
	write_byte(TE_BEAMCYLINDER)
	engfunc(EngFunc_WriteCoord, originF[0])
	engfunc(EngFunc_WriteCoord, originF[1])
	engfunc(EngFunc_WriteCoord, originF[2])
	engfunc(EngFunc_WriteCoord, originF[0])
	engfunc(EngFunc_WriteCoord, originF[1])
	engfunc(EngFunc_WriteCoord, originF[2]+470.0)
	write_short(beam_effect)
	write_byte(0)
	write_byte(0)
	write_byte(4)
	write_byte(60)
	write_byte(0)
	write_byte(0)
	write_byte(191)
	write_byte(255)
	write_byte(200)
	write_byte(0)
	message_end()
	
	engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, originF, 0)
	write_byte(TE_BEAMCYLINDER)
	engfunc(EngFunc_WriteCoord, originF[0])
	engfunc(EngFunc_WriteCoord, originF[1])
	engfunc(EngFunc_WriteCoord, originF[2])
	engfunc(EngFunc_WriteCoord, originF[0])
	engfunc(EngFunc_WriteCoord, originF[1])
	engfunc(EngFunc_WriteCoord, originF[2]+555.0)
	write_short(beam_effect)
	write_byte(0)
	write_byte(0)
	write_byte(4)
	write_byte(60)
	write_byte(0)
	write_byte(0)
	write_byte(191)
	write_byte(255)
	write_byte(200)
	write_byte(0)
	message_end()

	engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, originF, 0)
	write_byte(TE_DLIGHT)
	engfunc(EngFunc_WriteCoord, originF[0])
	engfunc(EngFunc_WriteCoord, originF[1])
	engfunc(EngFunc_WriteCoord, originF[2])
	write_byte(50)
	write_byte(0)
	write_byte(191)
	write_byte(255)
	write_byte(30)
	write_byte(30)
	message_end()

	engfunc(EngFunc_MessageBegin, MSG_BROADCAST,SVC_TEMPENTITY, originF, 0)
	write_byte(TE_EXPLOSION)
	engfunc(EngFunc_WriteCoord, originF[0])
	engfunc(EngFunc_WriteCoord, originF[1])
	engfunc(EngFunc_WriteCoord, originF[2]+75)
	write_short(frostexp)
	write_byte(17)
	write_byte(15)
	write_byte(TE_EXPLFLAG_NOSOUND)
	message_end();
	
	
	engfunc(EngFunc_MessageBegin, MSG_BROADCAST,SVC_TEMPENTITY, originF, 0)
	write_byte(TE_SPRITETRAIL)
	engfunc(EngFunc_WriteCoord, originF[0])
	engfunc(EngFunc_WriteCoord, originF[1])
	engfunc(EngFunc_WriteCoord, originF[2] + 40)
	engfunc(EngFunc_WriteCoord, originF[0])
	engfunc(EngFunc_WriteCoord, originF[1])
	engfunc(EngFunc_WriteCoord, originF[2])
	write_short(frostgib)
	write_byte(20)
	write_byte(7)
	write_byte(2)
	write_byte(50)
	write_byte(10)
	message_end()
}

public detail_level(id)
{
	if(!is_user_connected(id))
		return
		
	color(id, ".v%s.g Nivelul tau este:.e %d.g | Ai:.e %d/%d.g | Minute:.e %d/5.g.", TAG, nivel[id], complete_hours[id], LEVELS[nivel[id]], minutes[id])
	return;
}

blood(const Float:origin[3])
{
	engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, origin, 0)
	write_byte(TE_BLOODSPRITE)
	engfunc(EngFunc_WriteCoord, origin[0])
	engfunc(EngFunc_WriteCoord, origin[1])
	engfunc(EngFunc_WriteCoord, origin[2] + 30.0)
	write_short(spr_blood_spray)
	write_short(spr_blood_drop)
	write_byte(248)
	write_byte(15)
	message_end()
}

public save_top() 
{
	new path[128];
	formatex(path, 127, "%s/TopLevels.dat", data_save);
	if(file_exists(path)) 
		delete_file(path);
	new Buffer[256];
	new f = fopen(path, "at");
	for(new i = INFO_ZERO; i < NTOP; i++)
	{
		formatex(Buffer, 255, "^"%s^" ^"%d^" ^"%d^" ^"%d^"^n", topnames[i], toplevels[i], tophours[i], topminutes[i])
		fputs(f, Buffer);
	}
	fclose(f);
}

reset_vars(id)
{
	g_ak47[id] = false
	g_m4a1[id] = false
	g_deagle[id] = false
	g_pet[id] = false
	g_used_life[id] = false
	item_pet[id] = 0
}

public FM_Think_hook(ent)
{
	for(new i = 0; i <= g_iMaxPlayers; i++)
	{
		if(ent == item_pet[i])
		{
			static Float:origin[3]
			static Float:origin2[3]
			static Float:velocity[3]
			pev(ent,pev_origin,origin2)
			get_offset_origin_body(i,Float:{50.0,0.0,0.0},origin)
			
			if(get_distance_f(origin,origin2) > 300.0)
			{
				set_pev(ent,pev_origin,origin)
			}
			
			else if(get_distance_f(origin,origin2) > 80.0)
			{
				get_speed_vector(origin2,origin,250.0,velocity)
				set_pev(ent,pev_velocity,velocity)
				if(pev(ent,pev_sequence) != pet_run || pev(ent,pev_framerate) != pet_run_speed)
				{
					set_pev(ent,pev_sequence,pet_run)
					set_pev(ent,pev_gaitsequence,pet_run)
					set_pev(ent,pev_framerate,pet_run_speed)
				}
			}
			
			else if(get_distance_f(origin,origin2) < 75.0)
			{
				if(pev(ent,pev_sequence) != pet_idle || pev(ent,pev_framerate) != pet_idle_speed)
				{
					set_pev(ent,pev_sequence,pet_idle)
					set_pev(ent,pev_gaitsequence,pet_idle)
					set_pev(ent,pev_framerate,pet_idle_speed)
				}
				set_pev(ent,pev_velocity,Float:{0.0,0.0,0.0})
			}
			pev(i,pev_origin,origin)
			origin[2] = origin2[2]
			entity_set_aim(ent,origin)			
			set_pev(ent,pev_nextthink,1.0)
			break
		}
	}
}

public TraceAttack(iEnt, iAttacker, Float:flDamage, Float:fDir[3], pentru, iDamageType)
{
	if(!IsPlayer(iAttacker))
		return

	static iWeapon;
	iWeapon = get_user_weapon(iAttacker);
	
	if((g_ak47[iAttacker] && iWeapon == CSW_AK47) || (g_m4a1[iAttacker] && iWeapon == CSW_M4A1) || (g_deagle[iAttacker] && iWeapon == CSW_DEAGLE))
	{
		static iOrigin[3], Float:flEnd[3]
		get_user_origin(iAttacker, iOrigin, 1)
		get_tr2(pentru, TR_vecEndPos, flEnd)
		message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
		write_byte(TE_TRACER)
		write_coord(iOrigin[0])
		write_coord(iOrigin[1])
		write_coord(iOrigin[2])
		write_coord_f(flEnd[0]) 
		write_coord_f(flEnd[1]) 
		write_coord_f(flEnd[2]) 
		message_end()
	}
}

public is_a_player(ent)
{
	if(ent > 0 && ent < 33)
		return true
	
	return false
}

public remove_pet(ent) 
	if(pev_valid(ent))
		fm_remove_entity(ent)

stock get_offset_origin_body(ent,const Float:offset[3],Float:origin[3])
{
	if(!pev_valid(ent))
		return 0;
	
	new Float:angle[3]
	pev(ent,pev_angles,angle)
	
	pev(ent,pev_origin,origin)
	
	origin[0] += floatcos(angle[1],degrees) * offset[0]
	origin[1] += floatsin(angle[1],degrees) * offset[0]
	
	origin[1] += floatcos(angle[1],degrees) * offset[1]
	origin[0] += floatsin(angle[1],degrees) * offset[1]
	
	return 1;
}

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 entity_set_aim(ent,const Float:origin2[3],bone=0)
{
	if(!pev_valid(ent))
		return 0;
	
	static Float:origin[3]
	origin[0] = origin2[0]
	origin[1] = origin2[1]
	origin[2] = origin2[2]
	
	static Float:ent_origin[3], Float:angles[3]
	
	if(bone)
		engfunc(EngFunc_GetBonePosition,ent,bone,ent_origin,angles)
	else
		pev(ent,pev_origin,ent_origin)
	
	origin[0] -= ent_origin[0]
	origin[1] -= ent_origin[1]
	origin[2] -= ent_origin[2]
	
	static Float:v_length
	v_length = vector_length(origin)
	
	static Float:aim_vector[3]
	aim_vector[0] = origin[0] / v_length
	aim_vector[1] = origin[1] / v_length
	aim_vector[2] = origin[2] / v_length
	
	static Float:new_angles[3]
	vector_to_angle(aim_vector,new_angles)
	
	new_angles[0] *= -1
	
	if(new_angles[1]>180.0) new_angles[1] -= 360
	if(new_angles[1]<-180.0) new_angles[1] += 360
	if(new_angles[1]==180.0 || new_angles[1]==-180.0) new_angles[1]=-179.999999
	
	set_pev(ent,pev_angles,new_angles)
	set_pev(ent,pev_fixangle,1)
	
	return 1;
}

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)) || (dropwhat == 2 && ((1<<weaponid) & SECONDARY_WEAPONS_BIT_SUM)))
		{
			static wname[32], weapon_ent
			get_weaponname(weaponid, wname, charsmax(wname))
			weapon_ent = fm_find_ent_by_owner(-1, wname, id)
			set_pev(weapon_ent, PEV_ADDITIONAL_AMMO, cs_get_user_bpammo(id, weaponid))
			engclient_cmd(id, "drop", wname)
			cs_set_user_bpammo(id, weaponid, 0)
		}
	}
}

public fwdTouch(toucher, touched)
{
	if (!is_user_alive(toucher) || !pev_valid(touched))
		return FMRES_IGNORED
	
	new classname[32]	
	pev(touched, pev_classname, classname, 31)
	if (!equal(classname, ClassName))
		return FMRES_IGNORED
	
	if(get_user_team(toucher) == pev(touched, pev_team))
	{
		emit_sound(toucher, CHAN_STATIC, get_present, 1.0, ATTN_NORM, 0, PITCH_NORM)
		GiveBonus(toucher)
		set_pev(touched, pev_effects, EF_NODRAW)
		set_pev(touched, pev_solid, SOLID_NOT)
		remove_entity(touched)
	}
	return FMRES_IGNORED
}

public AddBonusBox(id)
{
	if(is_user_connected(id) && cs_get_user_team(id) != CS_TEAM_SPECTATOR)
	{
		new ent = fm_create_entity("info_target")
		new origin[3]
		get_user_origin(id, origin, 0)
		set_pev(ent,pev_classname, ClassName)
		switch(cs_get_user_team(id))
		{
			case CS_TEAM_T:
			{
				engfunc(EngFunc_SetModel, ent, mdl_box)
				set_pev(ent,pev_team, 2)
				entity_set_int(ent,EV_INT_iuser1,0) 
				entity_set_int(ent,EV_INT_iuser2,0) 
				entity_set_int(ent,EV_INT_iuser3,200) 
				set_rendering(ent,kRenderFxGlowShell,entity_get_int(ent,EV_INT_iuser1),entity_get_int(ent,EV_INT_iuser2),entity_get_int(ent,EV_INT_iuser3),kRenderNormal,120)
			}
			case CS_TEAM_CT:
			{
				engfunc(EngFunc_SetModel, ent, mdl_box)	
				set_pev(ent,pev_team, 1)
				entity_set_int(ent,EV_INT_iuser1,200) 
				entity_set_int(ent,EV_INT_iuser2,0) 
				entity_set_int(ent,EV_INT_iuser3,0) 
				set_rendering(ent,kRenderFxGlowShell,entity_get_int(ent,EV_INT_iuser1),entity_get_int(ent,EV_INT_iuser2),entity_get_int(ent,EV_INT_iuser3),kRenderNormal,120)
			}
		}
		set_pev(ent, pev_mins, Float:{-10.0,-10.0,0.0})
		set_pev(ent, pev_maxs, Float:{10.0,10.0,25.0})
		set_pev(ent, pev_size, Float:{-10.0,-10.0,0.0,10.0,10.0,25.0})
		engfunc(EngFunc_SetSize, ent, Float:{-10.0,-10.0,0.0}, Float:{10.0,10.0,25.0})
		
		set_pev(ent, pev_solid, SOLID_BBOX)
		set_pev(ent, pev_movetype, MOVETYPE_TOSS)
		
		new Float:fOrigin[3]
		IVecFVec(origin, fOrigin)
		set_pev(ent, pev_origin, fOrigin)
	}
}

public GiveBonus(id)
{	
	if(is_user_alive(id)) 
	{
		switch(random_num(1,6)) 
		{
			case 1: 
			{
				if(pev(id, pev_health) + 20.0 > get_pcvar_num(CvarHpMax))
					set_pev(id, pev_health, get_pcvar_float(CvarHpMax))
				else
					set_pev(id, pev_health, pev(id, pev_health) + 20.0)
				color(id, ".v%s.g Ai gasit.e 20HP.g.", TAG)
			}
			case 2:
			{
				g_money[id] += 2
				color(id, ".v%s.g Ai gasit.e 2$.g.", TAG)
			}
			case 3:
			{
				if(pev(id, pev_armorvalue) + 25.0 > get_pcvar_num(CvarHpMax))
					set_pev(id, pev_armorvalue, get_pcvar_float(CvarHpMax))
				else
					set_pev(id, pev_armorvalue, pev(id, pev_armorvalue) + 25.0)
				color(id, ".v%s.g Ai gasit.e 25AP.g.", TAG)
			}
			case 4:
			{
				g_money[id] += 4
				color(id, ".v%s.g Ai gasit.e 4$.g.", TAG)
			}
			case 5:
			{
				g_money[id] += 6
				color(id, ".v%s.g Ai gasit.e 6$.g.", TAG)
			}
			case 6:
			{
				HasTeleport[id] = true
				g_teleports[id] += 1
				client_cmd(id, "bind ^"alt^" ^"power2^"")
				color(id, ".v%s.g Ai gasit puterea de.e teleportare.g, apasa.e ALT.g pentru a utiliza puterea.", TAG)
			}
		}
	}
}

public CmdTeleport(id)
{
	if(!is_user_alive(id) || !HasTeleport[id])
		return PLUGIN_CONTINUE
	
	if (Teleport_Cooldown[id])
	{
		color(id, ".v%s.g Puterea iti va reveni in:.e %d.g secund%s.", TAG, Teleport_Cooldown[id], Teleport_Cooldown[id] == 1 ? "a" : "e")
		return PLUGIN_CONTINUE
	}
	else if (teleport(id))
	{
		emit_sound(id, CHAN_STATIC, SOUND_BLINK, 1.0, ATTN_NORM, 0, PITCH_NORM)
		remove_task(id)
		g_teleports[id] -= 1
		Teleport_Cooldown[id] = get_pcvar_num(CvarTeleportCooldown)
		set_task(1.0, "ShowHUD", id, _, _, "b")
		set_hudmessage(0, 100, 200, 0.05, 0.60, 0, 1.0, 1.1, 0.0, 0.0, -11)
		show_hudmessage(id, "Puterea iti va reveni in: %d secund%s", Teleport_Cooldown[id], Teleport_Cooldown[id] == 1 ? "a" : "e")
	}
	else
		color(id, ".v%s.g Pozitia de teleportare este invalida!", TAG)
	return PLUGIN_CONTINUE
}

public ShowHUD(id)
{
	if(!is_user_alive(id) || !HasTeleport[id])
	{
		remove_task(id)
		Teleport_Cooldown[id] = 0
		return PLUGIN_HANDLED
	}
	set_hudmessage(0, 100, 200, 0.05, 0.60, 0, 1.0, 1.1, 0.0, 0.0, -11)
	if(is_user_alive(id) && Teleport_Cooldown[id] == 1)
	{
		Teleport_Cooldown[id]--
		show_hudmessage(id, "Puterea iti va reveni in: %d secunda",Teleport_Cooldown[id])
	}
	if(is_user_alive(id) && Teleport_Cooldown[id] > 1)
	{
		Teleport_Cooldown[id]--
		show_hudmessage(id, "Puterea iti va reveni in: %d secunde",Teleport_Cooldown[id])
	}
	if(is_user_alive(id) && Teleport_Cooldown[id] <= 0)
	{
		show_hudmessage(id, "Ti-a revenit puterea")
		color(id, ".v%s.g Poti folosi din nou puterea de a te teleporta!", TAG)
		remove_task(id)
		Teleport_Cooldown[id] = 0
	}
	return PLUGIN_HANDLED
}

bool:teleport(id)
{
	new Float:vOrigin[3], Float:vNewOrigin[3],
	Float:vNormal[3], Float:vTraceDirection[3],
	Float:vTraceEnd[3]
	
	pev(id, pev_origin, vOrigin)
	
	velocity_by_aim(id, get_pcvar_num(CvarTeleportRange), vTraceDirection)
	xs_vec_add(vTraceDirection, vOrigin, vTraceEnd)
	
	engfunc(EngFunc_TraceLine, vOrigin, vTraceEnd, DONT_IGNORE_MONSTERS, id, 0)
	
	new Float:flFraction
	get_tr2(0, TR_flFraction, flFraction)
	if (flFraction < 1.0)
	{
		get_tr2(0, TR_vecEndPos, vTraceEnd)
		get_tr2(0, TR_vecPlaneNormal, vNormal)
	}
	
	xs_vec_mul_scalar(vNormal, 40.0, vNormal)
	xs_vec_add(vTraceEnd, vNormal, vNewOrigin)
	
	if (is_player_stuck(id, vNewOrigin))
		return false
	
	emit_sound(id, CHAN_STATIC, SOUND_BLINK, 1.0, ATTN_NORM, 0, PITCH_NORM)
	tele_effect(vOrigin)
	
	engfunc(EngFunc_SetOrigin, id, vNewOrigin)
	
	tele_effect2(vNewOrigin)
	
	if(is_user_connected(id))
		UTIL_ScreenFade(id, get_color(CvarColor), get_pcvar_float(CvarFadeTime), get_pcvar_float(CvarFadeTime), 75)
	return true
}

stock is_player_stuck(id, Float:originF[3])
{
	engfunc(EngFunc_TraceHull, originF, originF, 0, (pev(id, pev_flags) & FL_DUCKING) ? HULL_HEAD : HULL_HUMAN, id, 0)
	
	if (get_tr2(0, TR_StartSolid) || get_tr2(0, TR_AllSolid) || !get_tr2(0, TR_InOpen))
		return true
	
	return false
}

stock tele_effect(const Float:torigin[3])
{
	new origin[3]
	origin[0] = floatround(torigin[0])
	origin[1] = floatround(torigin[1])
	origin[2] = floatround(torigin[2])
	
	message_begin(MSG_PAS, SVC_TEMPENTITY, origin)
	write_byte(TE_BEAMCYLINDER)
	write_coord(origin[0])
	write_coord(origin[1])
	write_coord(origin[2]+10)
	write_coord(origin[0])
	write_coord(origin[1])
	write_coord(origin[2]+60)
	write_short(Sprite)
	write_byte(0)
	write_byte(0)
	write_byte(3)
	write_byte(60)
	write_byte(0)
	write_byte(255)
	write_byte(255)
	write_byte(255)
	write_byte(255)
	write_byte(0)
	message_end()
}

stock tele_effect2(const Float:torigin[3])
{
	new origin[3]
	origin[0] = floatround(torigin[0])
	origin[1] = floatround(torigin[1])
	origin[2] = floatround(torigin[2])
	
	message_begin(MSG_PAS, SVC_TEMPENTITY, origin)
	write_byte(TE_BEAMCYLINDER)
	write_coord(origin[0])
	write_coord(origin[1])
	write_coord(origin[2]+10)
	write_coord(origin[0])
	write_coord(origin[1])
	write_coord(origin[2]+60)
	write_short(Sprite)
	write_byte(0)
	write_byte(0)
	write_byte(3)
	write_byte(60)
	write_byte(0)
	write_byte(255)
	write_byte(255)
	write_byte(255)
	write_byte(255)
	write_byte(0)
	message_end()
	
	message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
	write_byte(TE_SPRITETRAIL)
	write_coord(origin[0])
	write_coord(origin[1])
	write_coord(origin[2]+40)
	write_coord(origin[0])
	write_coord(origin[1])
	write_coord(origin[2])
	write_short(Sprite2)
	write_byte(30)
	write_byte(10)
	write_byte(1)
	write_byte(50)
	write_byte(10)
	message_end()
}	

get_color(pcvar)
{
	new iColor[3], szColor[10]
	get_pcvar_string(pcvar, szColor, charsmax(szColor))
	new c = str_to_num(szColor)
	
	iColor[Red] = c / 1000000
	c %= 1000000
	iColor[Green] = c / 1000
	iColor[Blue] = c % 1000
	
	return iColor
}

stock FixedUnsigned16(Float:flValue, iScale)
{
	new iOutput
	iOutput = floatround(flValue * iScale)
	
	if (iOutput < 0)
		iOutput = 0
	
	if (iOutput > 0xFFFF)
		iOutput = 0xFFFF
	
	return iOutput
}

stock UTIL_ScreenFade(id=0,iColor[3]={0,0,0},Float:flFxTime=-1.0,Float:flHoldTime=0.0,iAlpha=0,iFlags=FFADE_IN,bool:bReliable=false,bool:bExternal=false)
{
	if(id && !is_user_connected(id))
		return
	
	new iFadeTime
	if(flFxTime == -1.0)
	{
		iFadeTime = 4
	}
	else
	{
		iFadeTime = FixedUnsigned16(flFxTime , 1<<12)
	}
	
	static gmsgScreenFade
	if(!gmsgScreenFade)
	{
		gmsgScreenFade = get_user_msgid("ScreenFade")
	}
	
	new MSG_DEST
	if(bReliable)
	{
		MSG_DEST = id ? MSG_ONE : MSG_ALL
	}
	else
	{
		MSG_DEST = id ? MSG_ONE_UNRELIABLE : MSG_BROADCAST
	}
	
	if(bExternal)
	{
		emessage_begin(MSG_DEST, gmsgScreenFade, _, id)
		ewrite_short(iFadeTime)
		ewrite_short(FixedUnsigned16(flHoldTime , 1<<12))
		ewrite_short(iFlags)
		ewrite_byte(iColor[Red])
		ewrite_byte(iColor[Green])
		ewrite_byte(iColor[Blue])
		ewrite_byte(iAlpha)
		emessage_end()
	}
	else
	{
		message_begin(MSG_DEST, gmsgScreenFade, _, id)
		write_short(iFadeTime)
		write_short(FixedUnsigned16(flHoldTime , 1<<12))
		write_short(iFlags)
		write_byte(iColor[Red])
		write_byte(iColor[Green])
		write_byte(iColor[Blue])
		write_byte(iAlpha)
		message_end()
	}
}

stock UTIL_FadeToBlack(id,Float:fxtime=3.0,bool:bReliable=false,bool:bExternal=false)
	UTIL_ScreenFade(id, _, fxtime, fxtime, 255, FFADE_OUT|FFADE_STAYOUT,bReliable,bExternal)
	
public Light(entity, red, green, blue)
{	
	if(is_valid_ent(entity))
	{
		static Float:origin[3]
		pev(entity, pev_origin, origin)
		
		message_begin(MSG_BROADCAST, SVC_TEMPENTITY, _, entity)
		write_byte(TE_DLIGHT)
		engfunc(EngFunc_WriteCoord, origin[0])
		engfunc(EngFunc_WriteCoord, origin[1])
		engfunc(EngFunc_WriteCoord, origin[2])
		write_byte(7) 
		write_byte(red)
		write_byte(green)
		write_byte(blue)
		write_byte(2)
		write_byte(0)
		message_end()
	}
}

public shop_menu(id)
{
	if(!is_user_connected(id))
		return;
		
	static menu_name[75];
	formatex(menu_name, charsmax(menu_name), "Ultimate Remaked Furien Shop^nDolari: %d^n", g_money[id])
	static menu;
	menu = menu_create(menu_name, "shop_handler");

	static i_menu[100];

	if(!(get_user_flags(id) & VIP_FLAG))
		formatex(i_menu, charsmax(i_menu), "\d%s\R [ONLY VIP]", items_menu[0])
	else
	{
		if(!is_user_alive(id))
			formatex(i_menu, charsmax(i_menu), "\d%s\R [ONLY ALIVE]", items_menu[0])
		else
		{
			switch(get_user_team(id))
			{
				case 1: formatex(i_menu, charsmax(i_menu), "\d%s\R [ONLY ANTI-FURIEN]", items_menu[0])
				case 2:
				{
					if(g_ak47[id])
						formatex(i_menu, charsmax(i_menu), "\y%s\r\R [ALREADY HAVE]", items_menu[0])
					else
					{
						if(g_money[id] < cost[0])
							formatex(i_menu, charsmax(i_menu), "\d%s\R %d", items_menu[0], cost[0])
						else
							formatex(i_menu, charsmax(i_menu), "\y%s\r\R %d", items_menu[0], cost[0])
					}
				}
			}
		}
	}
	menu_additem(menu, i_menu, "")
	if(!(get_user_flags(id) & VIP_FLAG))
		formatex(i_menu, charsmax(i_menu), "\d%s\R [ONLY VIP]", items_menu[1])
	else
	{
		if(!is_user_alive(id))
			formatex(i_menu, charsmax(i_menu), "\d%s\R [ONLY ALIVE]", items_menu[1])
		else
		{
			switch(get_user_team(id))
			{
				case 1: formatex(i_menu, charsmax(i_menu), "\d%s\R [ONLY ANTI-FURIEN]", items_menu[1])
				case 2:
				{
					if(g_m4a1[id])
						formatex(i_menu, charsmax(i_menu), "\y%s\r\R [ALREADY HAVE]", items_menu[1])
					else
					{
						if(g_money[id] < cost[1])
							formatex(i_menu, charsmax(i_menu), "\d%s\R %d", items_menu[1], cost[1])
						else
							formatex(i_menu, charsmax(i_menu), "\y%s\r\R %d", items_menu[1], cost[1])
					}
				}
			}
		}
	}
	menu_additem(menu, i_menu, "")
	if(!(get_user_flags(id) & VIP_FLAG))
		formatex(i_menu, charsmax(i_menu), "\d%s\R [ONLY VIP]", items_menu[2])
	else
	{
		if(!is_user_alive(id))
			formatex(i_menu, charsmax(i_menu), "\d%s\R [ONLY ALIVE]", items_menu[2])
		else
		{
			switch(get_user_team(id))
			{
				case 1: formatex(i_menu, charsmax(i_menu), "\d%s\R [ONLY ANTI-FURIEN]", items_menu[2])
				case 2:
				{
					if(g_deagle[id])
						formatex(i_menu, charsmax(i_menu), "\y%s\r\R [ALREADY HAVE]", items_menu[2])
					else
					{
						if(g_money[id] < cost[2])
							formatex(i_menu, charsmax(i_menu), "\d%s\R %d", items_menu[2], cost[2])
						else
							formatex(i_menu, charsmax(i_menu), "\y%s\r\R %d", items_menu[2], cost[2])
					}
				}
			}
		}
	}
	menu_additem(menu, i_menu, "")
	if(!(get_user_flags(id) & VIP_FLAG))
		formatex(i_menu, charsmax(i_menu), "\d%s\R [ONLY VIP]", items_menu[3])
	else
	{
		if(!is_user_alive(id))
		{
			if(g_used_life[id])
				formatex(i_menu, charsmax(i_menu), "\y%s\r\R [USED]", items_menu[3])
			else
			{
				if(g_money[id] < cost[3])
					formatex(i_menu, charsmax(i_menu), "\d%s\R %d", items_menu[3], cost[3])
				else
					formatex(i_menu, charsmax(i_menu), "\y%s\r\R %d", items_menu[3], cost[3])
			}
		}
		else
			formatex(i_menu, charsmax(i_menu), "\d%s\R [ONLY DEAD]", items_menu[3])
	}
	menu_additem(menu, i_menu, "")
	if(!(get_user_flags(id) & VIP_FLAG))
		formatex(i_menu, charsmax(i_menu), "\d%s\R [ONLY VIP]", items_menu[4])
	else
	{
		if(!is_user_alive(id))
			formatex(i_menu, charsmax(i_menu), "\d%s\R [ONLY ALIVE]", items_menu[4])
		else
		{
			switch(get_user_team(id))
			{
				case 1: formatex(i_menu, charsmax(i_menu), "\d%s\R [ONLY ANTI-FURIEN]", items_menu[4])
				case 2:
				{
					if(g_pet[id])
						formatex(i_menu, charsmax(i_menu), "\y%s\r\R [ALREADY HAVE]", items_menu[4])
					else
					{
						if(g_money[id] < cost[4])
							formatex(i_menu, charsmax(i_menu), "\d%s\R %d", items_menu[4], cost[4])
						else
							formatex(i_menu, charsmax(i_menu), "\y%s\r\R %d", items_menu[4], cost[4])
					}
				}
			}
		}
	}
	menu_additem(menu, i_menu, "")
	menu_display(id, menu, 0)
}

public donate(id, arg[])
{
	static cui[32], count[10];
	strbreak(arg, cui, 31, count, 9)
	
	if(!cui[0] || !count[0])
	{
		color(id, ".v%s.g Comanda se foloseste sub forma urmatoare:.e /donate nume bani.g.", TAG)
		return
	}
	static credite_trimise, credite;
	credite_trimise = g_money[id]
	if(equal(count, "all"))
		credite = credite_trimise
	else
		credite = str_to_num(count)
	
	if(credite <= 0)
	{
		color(id, ".v%s.g Valoarea introdusa de tine este invalida.", TAG)
		return
	}
	credite_trimise -= credite
	if(credite_trimise < 0)
	{
		credite += credite_trimise
		credite_trimise = 0
	}
	static primitor;
	primitor = cmd_target(id, cui, (CMDTARGET_ALLOW_SELF))
	if(!primitor || primitor == id)
	{
		color(id, ".v%s.e %s.g nu exista pe server.", TAG, cui)
		return
	}
	g_money[primitor] += credite
	g_money[id] = credite_trimise
	
	color(0, ".v%s.e %s.g ii trimite lui.e %s %d$.g.", TAG, get_name(id), get_name(primitor), credite)
}

public shop_handler(id, menu, item)
{
	if(!(get_user_flags(id) & VIP_FLAG))
	{
		color(id, ".v%s.g Trebuie sa detii.e VIP.g pentru a folosi acest shop.", TAG)
		menu_destroy(menu);
		return PLUGIN_HANDLED;
	}
	if(item == MENU_EXIT)
    {
        menu_destroy(menu);
        return PLUGIN_HANDLED;
    }
	
	if(g_money[id] < cost[item])
	{
		color(id, ".v%s.g Nu ai destule credite sa cumperi.e %s.g. Iti mai trebuiesc.e %d.g dolari.", TAG, items_menu[item], cost[item] - g_money[id])
		menu_destroy(menu);
		return PLUGIN_HANDLED;
	}
	
	switch(item)
	{
		case 0:
		{
			if(!is_user_alive(id))
			{
				color(id, ".v%s.g Trebuie sa fii in viata pentru a putea cumpara.e %s.g", items_menu[item])
				menu_destroy(menu);
				return PLUGIN_HANDLED;
			}
			if(get_user_team(id) != 2)
			{
				color(id, ".v%s.g Trebuie sa fii.e Anti-Furien.g pentru a putea cumpara.e %s.g.", TAG, items_menu[item])
				menu_destroy(menu);
				return PLUGIN_HANDLED;
			}
			if(g_ak47[id])
			{
				color(id, ".v%s.g Ai deja.e %s.g.", TAG, items_menu[item])
				menu_destroy(menu);
				return PLUGIN_HANDLED;
			}
			drop_weapons(id, 1)
			g_ak47[id] = true
			give_item(id, "weapon_ak47")
			cs_set_user_bpammo(id, CSW_AK47, 90)
		}
		case 1:
		{
			if(!is_user_alive(id))
			{
				color(id, ".v%s.g Trebuie sa fii in viata pentru a putea cumpara.e %s.g", items_menu[item])
				menu_destroy(menu);
				return PLUGIN_HANDLED;
			}
			if(get_user_team(id) != 2)
			{
				color(id, ".v%s.g Trebuie sa fii.e Anti-Furien.g pentru a putea cumpara.e %s.g.", TAG, items_menu[item])
				menu_destroy(menu);
				return PLUGIN_HANDLED;
			}
			if(g_m4a1[id])
			{
				color(id, ".v%s.g Ai deja.e %s.g.", TAG, items_menu[item])
				menu_destroy(menu);
				return PLUGIN_HANDLED;
			}
			drop_weapons(id, 1)
			g_m4a1[id] = true
			give_item(id, "weapon_m4a1")
			cs_set_user_bpammo(id, CSW_M4A1, 90)
		}
		case 2:
		{
			if(!is_user_alive(id))
			{
				color(id, ".v%s.g Trebuie sa fii in viata pentru a putea cumpara.e %s.g", items_menu[item])
				menu_destroy(menu);
				return PLUGIN_HANDLED;
			}
			if(get_user_team(id) != 2)
			{
				color(id, ".v%s.g Trebuie sa fii.e Anti-Furien.g pentru a putea cumpara.e %s.g.", TAG, items_menu[item])
				menu_destroy(menu);
				return PLUGIN_HANDLED;
			}
			if(g_deagle[id])
			{
				color(id, ".v%s.g Ai deja.e %s.g.", TAG, items_menu[item])
				menu_destroy(menu);
				return PLUGIN_HANDLED;
			}
			drop_weapons(id, 2)
			g_deagle[id] = true
			give_item(id, "weapon_deagle")
			cs_set_user_bpammo(id, CSW_DEAGLE, 90)
		}
		case 3:
		{
			if(is_user_alive(id))
			{
				color(id, ".v%s.g Trebuie sa fii.e mort.g pentru a folosi.e %s.g.", TAG, items_menu[item])
				menu_destroy(menu);
				return PLUGIN_HANDLED;
			}
			if(get_user_team(id) == 3)
			{
				color(id, ".v%s.g Esti spectator si nu poti folosi.e %s.g.", TAG, items_menu[item])
				menu_destroy(menu);
				return PLUGIN_HANDLED;
			}
			if(g_used_life[id])
			{
				color(id, ".v%s.g Ai folosit deja.e %s.g.", TAG, items_menu[item])
				menu_destroy(menu);
				return PLUGIN_HANDLED;
			}
			g_used_life[id] = true
			ExecuteHamB(Ham_CS_RoundRespawn, id)
		}
		case 4:
		{
			if(!is_user_alive(id))
			{
				color(id, ".v%s.g Trebuie sa fii.e viu.g pentru a folosi.e %s.g.", TAG, items_menu[item])
				menu_destroy(menu);
				return PLUGIN_HANDLED;
			}
			if(get_user_team(id) != 2)
			{
				color(id, ".v%s.g Trebuie sa fii.e Anti-Furien.g pentru a folosi.e %s.g.", TAG, items_menu[item])
				menu_destroy(menu);
				return PLUGIN_HANDLED;
			}
			if(g_pet[id])
			{
				color(id, ".v%s.g Ai deja.e %s.g.", TAG, items_menu[item])
				menu_destroy(menu);
				return PLUGIN_HANDLED;
			}
			create_pet(id)
			set_pev(id, pev_health, 200.0)
			set_pev(id, pev_armorvalue, 200.0)
			set_pev(id, pev_gravity, 0.5)
		}
	}
	g_money[id] -= cost[item]
	check_weapon(id)
	color(id, ".v%s.g Ai cumparat.e %s.g pentru.e %d$.g.", TAG, items_menu[item], cost[item])
	menu_destroy(menu);
	return PLUGIN_HANDLED;	
}

public create_pet(id)
{
	item_pet[id] = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString,"info_target"))
	set_pev(item_pet[id], pev_classname, "bat")
	
	engfunc(EngFunc_SetModel,item_pet[id],pet_model)
	
	new Float:origin[3]
	pev(id,pev_origin,origin)			
	
	set_pev(item_pet[id],pev_origin,origin)
	set_pev(item_pet[id],pev_solid,SOLID_TRIGGER)
	set_pev(item_pet[id],pev_movetype,MOVETYPE_FLY)
	set_pev(item_pet[id],pev_owner,33)
	set_pev(item_pet[id],pev_nextthink,1.0)
	set_pev(item_pet[id],pev_sequence,0)
	set_pev(item_pet[id],pev_gaitsequence,0)
	set_pev(item_pet[id],pev_framerate,1.0)	
	
	engfunc(EngFunc_EmitSound,item_pet[id],CHAN_AUTO,pet_sounds[random_num(0,sizeof pet_sounds - 1)],1.0, 1.2, 0, PITCH_NORM)	
	
	client_print(id, print_center, "Ai primit liliacul magic")		
	
	g_pet[id] = true
	return PLUGIN_HANDLED
}

public checkandupdatetop(id, leveles, ori, minuti) 
{	

	static name[32];
	get_user_name(id, name, charsmax(name) - 1);
	for(new i = INFO_ZERO; i < NTOP; i++)
	{
		if(leveles > toplevels[i] || leveles == toplevels[i] && ori > tophours[i] && minuti > topminutes[i] || leveles == toplevels[i] && ori == tophours[i] && minuti > topminutes[i])
		{
			new pos = i;	
			while(!equal(topnames[pos],name) && pos < NTOP)
				pos++;
			
			for(new j = pos; j > i; j--)
			{
				formatex(topnames[j], 31, topnames[j-1]);
				toplevels[j] = toplevels[j-1];
				tophours[j] = tophours[j-1];
				topminutes[j] = topminutes[j-1];
			}
			formatex(topnames[i], charsmax(name) - 1, name);
			toplevels[i] = leveles;
			tophours[i]= ori;
			topminutes[i] = minuti;
			save_top();
			break;
		}
		else if(equal(topnames[i], name)) 
		break;	
	}
}
public read_top() 
{
	new Buffer[256],path[128];
	formatex(path, 127, "%s/TopLevels.dat", data_save);
	
	new f = fopen(path, "rt");
	new i = INFO_ZERO;
	while(!feof(f) && i < NTOP+1)
	{
		fgets(f, Buffer, 255)
		new niveluri[25], hours[25], minutes[25];
		parse(Buffer, topnames[i], 31, niveluri, 25,  hours, 25, minutes, 25);
		toplevels[i] = str_to_num(niveluri);
		tophours[i]= str_to_num(hours);
		topminutes[i]= str_to_num(minutes);
		
		i++;
	}
	fclose(f);
}
public show_top(id) 
{	
	static buffer[2368], name[131], len, i;
	len = format(buffer[len], 2367-len,"<STYLE>body{background:#232323;color:#cfcbc2;font-family:sans-serif}table{border-style:solid;border-width:1px;border-color:#FFFFFF;font-size:13px}</STYLE><table align=center width=100%% cellpadding=2 cellspacing=0");
	len += format(buffer[len], 2367-len, "<tr align=center bgcolor=#52697B><th width=4%% > # <th width=24%%> NAME <th width=24%%>LEVEL <th width=24%%> HOURS <th  width=24%%> MINUTES");	
	for(i = INFO_ZERO; i < NTOP; i++)
	{		
			if(tophours[i] == 0 && topminutes[i] == 0)
				len += format(buffer[len], 2367-len, "<tr align=center bgcolor=#232323><td> %d <td> %s <td> %s<td> %s <td> %s", (i+1), "-", "-", "-","-");
			else 
			{
				name = topnames[i];
				while(containi(name, "<") != -1)
					replace(name, 129, "<", "&lt;");
				while(containi(name, ">") != -1)
					replace(name, 129, ">", "&gt;");
				static plname[32];
				get_user_name(id, plname ,32);
				if(equal(topnames[i],plname)) 
					len += format(buffer[len], 2367-len, "<tr align=center bgcolor=#2D2D2D><td> %d <td> %s <td> %d<td> %d <td> %d", (i+1), name, toplevels[i], tophours[i], topminutes[i]);
				else
					len += format(buffer[len], 2367-len, "<tr align=center bgcolor=#232323><td> %d <td> %s <td> %d<td> %d <td> %d", (i+1), name, toplevels[i], tophours[i], topminutes[i]);
			}
		}
	len += format(buffer[len], 2367-len, "</table>");
	len += formatex(buffer[len], 2367-len, "<tr align=bottom font-size:11px><Center><br><br><br><br>TOP 10 LEVELS</body>");
	static strin[20];
	format(strin,33, "TOP 10 LEVELS");
	show_motd(id, buffer, strin);
}

create_thunder(const Float:vec1[3], const Float:vec2[3])
{
	engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, vec2, 0)
	write_byte(0)
	engfunc(EngFunc_WriteCoord, vec1[0])
	engfunc(EngFunc_WriteCoord, vec1[1])
	engfunc(EngFunc_WriteCoord, vec1[2])
	engfunc(EngFunc_WriteCoord, vec2[0])
	engfunc(EngFunc_WriteCoord, vec2[1])
	engfunc(EngFunc_WriteCoord, vec2[2])
	write_short(lighting)
	write_byte(1)
	write_byte(5)
	write_byte(2)
	write_byte(20)
	write_byte(30)
	write_byte(200)
	write_byte(200)
	write_byte(200)
	write_byte(200)
	write_byte(200)
	message_end()

	engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, vec2, 0)
	write_byte(TE_SPARKS)
	engfunc(EngFunc_WriteCoord, vec2[0])
	engfunc(EngFunc_WriteCoord, vec2[1])
	engfunc(EngFunc_WriteCoord, vec2[2])
	message_end()
	
	engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, vec2, 0)
	write_byte(TE_SMOKE)
	engfunc(EngFunc_WriteCoord, vec2[0])
	engfunc(EngFunc_WriteCoord, vec2[1])
	engfunc(EngFunc_WriteCoord, vec2[2])
	write_short(smoke_spr)
	write_byte(10)
	write_byte(10)
	message_end()
}

make_HideWeapon(plr, flags)
{
	static i; i = plr ? plr : get_player();
	if(!i)
		return 0;
	message_begin(plr ? MSG_ONE : MSG_ALL, g_msgHideWeapon, {0, 0, 0}, plr);
	write_byte(flags);
	message_end();
	return 1;
}

get_player()
{
	for( new plr = 1; plr <= g_iMaxPlayers; plr++ )
	{
		if( IsPlayer(plr))
		{
			return plr;
		}
	}
	
	return 0;
}

stock UTIL_CreateFlares(const iOrigin[3], const iSpriteID, const iCount, const iLife, const iScale)
{
	message_begin(MSG_BROADCAST,SVC_TEMPENTITY);
	write_byte(TE_SPRITETRAIL);
	write_coord(iOrigin[0]);
	write_coord(iOrigin[1]);
	write_coord(iOrigin[2]);
	write_coord(iOrigin[0]);
	write_coord(iOrigin[1]);
	write_coord(iOrigin[2] + random_num(5, 10));
	write_short(iSpriteID);
	write_byte(iCount);
	write_byte(iLife);
	write_byte(iScale);
	write_byte(random_num(30, 50));
	write_byte(random_num(10, 15));
	message_end();
}

public hook_drop(id)
{
	if(!is_user_alive(id))
		return PLUGIN_CONTINUE;
		
	if(get_user_team(id) == 1)
	{
		client_print(id, print_center, "Nu poti arunca nimic!")
		return PLUGIN_HANDLED;
	}
	return PLUGIN_CONTINUE;
}

public CountDown()
{
	if(g_endround)
		return;
		
	set_dhudmessage(random(255), random(255), random(255), -1.0, 0.24, 1, 0.0, 1.0, 0.0, 0.0)
	SecondsUntillInvasion -= 1
	switch(SecondsUntillInvasion)
	{
		case 0:
		{
			show_dhudmessage(0, "Furienii ataca planeta in o secunda.")
			TerroTeamEffects()
			CounterTeamEffects()
			PlaySound(start_sounds[SecondsUntillInvasion])
			return
		}
		case 1:
		{
			PlaySound(start_sounds[SecondsUntillInvasion])
			show_dhudmessage(0, "Furienii ataca planeta in doua secunde.")
			TerroTeamEffects()
			CounterTeamEffects()
		}
		case 2:
		{
			PlaySound(start_sounds[SecondsUntillInvasion])
			show_dhudmessage(0, "Furienii ataca planeta in trei secunde.")
			TerroTeamEffects()
			CounterTeamEffects()
		}
		case 3:
		{
			PlaySound(start_sounds[SecondsUntillInvasion])
			show_dhudmessage(0, "Furienii ataca planeta in patru secunde.")
			TerroTeamEffects()
			CounterTeamEffects()
		}
		case 4:
		{
			PlaySound(start_sounds[SecondsUntillInvasion])
			show_dhudmessage(0, "Furienii ataca planeta in cinci secunde.")
			TerroTeamEffects()
			CounterTeamEffects()
		}
	}	
	set_task(1.0, "CountDown");
} 

public TerroTeamEffects()
{
	new iPlayers[32];
	new iPlayersNum;
	
	get_players(iPlayers, iPlayersNum, "aceh", "TERRORIST");
	
	for(new i = 0 ; i < iPlayersNum ; i++)
	{
		if(IsPlayer(iPlayers[i]))
		{      
			ShakeScreen(iPlayers[i], 0.9);
			FadeScreen(iPlayers[i], 0.5, 230, 40, 0, 180);
		}
	}
}
public CounterTeamEffects()
{
	new iPlayers[32];
	new iPlayersNum;
	
	get_players(iPlayers, iPlayersNum, "aceh", "CT");
	
	for(new i = 0; i < iPlayersNum ; i++)
	{
		if(IsPlayer(iPlayers[i]))
		{      
			ShakeScreen(iPlayers[i], 0.9);
			FadeScreen(iPlayers[i], 0.5, 0, 40, 230, 180);
		}
	}
}

public task_CanPlant() 
{
	set_lights("d")
	if(active_fog)
		msg_create_fog(random(255), random(255), random(255), 2)
	g_dontdelete = true
	remove_task(TASK_REMOVEC4)
	static CT, TERO, salvator, distrugator;
	CT = fnGetAliveCT();
	if(CT < 1)
		return;
		
	TERO = fnGetAliveT();
	if(TERO < 1)
		return;
	
	salvator = fnGetRandomAliveCT(random_num(1, CT))
	distrugator = fnGetRandomAliveT(random_num(1, TERO))
	g_end_health[distrugator] = get_user_health(distrugator)
	g_end_health[salvator] = get_user_health(salvator)
	set_user_health(salvator, 200)
	savior[salvator] = true
	cs_set_user_defuse(salvator, 1)
	set_task(0.1, "savior_aura", salvator+TASK_AURA, _, _, "b")
	set_user_health(distrugator, 135)
	destroyer[distrugator] = true
	ham_give_weapon(distrugator, "weapon_c4")
	cs_set_user_plant(distrugator, 1, 1);
	engclient_cmd(distrugator, "weapon_knife")
	check_weapon(distrugator)
	set_hudmessage(200, 30, 20, -1.0, 0.15, 1, 3.1, 3.0)
	ShowSyncHudMsg(0, event_hud, "Bomba cu plasma poate fi plantata!^n%s a fost ales ca EROU!!!^n%s a fost ales ca DISTRUGATOR!!!", get_name(salvator), get_name(distrugator))
}

public select_destroyer()
{
	if(g_endround)
		return;
	
	static TERO, distrugator;
	TERO = fnGetAliveT();
	if(TERO < 1)
		return;
		
	distrugator = fnGetRandomAliveT(random_num(1, TERO))
	g_end_health[distrugator] = get_user_health(distrugator)
	set_user_health(distrugator, 135)
	color(0, ".v%s.e %s.g a fost ales NOUL.e DISTRUGATOR.g.", TAG, get_name(distrugator))
	destroyer[distrugator] = true
	if(!b_planted)
	{
		ham_give_weapon(distrugator, "weapon_c4")
		cs_set_user_plant(distrugator, 1, 1);
	}
	engclient_cmd(distrugator, "weapon_knife")
	check_weapon(distrugator)
}

public select_savior()
{
	if(g_endround)
		return;
	
	static CT, salvator;
	CT = fnGetAliveCT();
	if(CT < 1)
		return;
		
	salvator = fnGetRandomAliveCT(random_num(1, CT))
	g_end_health[salvator] = get_user_health(salvator)
	set_user_health(salvator, 200)
	color(0, ".v%s.e %s.g a fost ales NOUL EROU.", TAG, get_name(salvator))
	savior[salvator] = true
	cs_set_user_defuse(salvator, 1);
}

public savior_aura(taskid)
{
	if(!savior[ID_AURA] || !is_user_alive(ID_AURA))
	{
		remove_task(taskid);
		return;
	}
	static origin[3]
	get_user_origin(ID_AURA, origin)

	message_begin(MSG_PVS, SVC_TEMPENTITY, origin)
	write_byte(TE_DLIGHT)
	write_coord(origin[0])
	write_coord(origin[1])
	write_coord(origin[2])
	write_byte(20)
	write_byte(0)
	write_byte(200)
	write_byte(50)
	write_byte(2)
	write_byte(0)
	message_end()
}

public score_attrib(msgid, dest, id)
{
	static juc, attrib;
	juc = get_msg_arg_int(1);
	attrib = get_msg_arg_int(2);
	
	if(attrib == ATTRIB_BOMB)
	{
		if(destroyer[juc] && user_has_weapon(juc, CSW_C4))
			return PLUGIN_CONTINUE;
		else
			set_msg_arg_int(2, ARG_BYTE, 0)
		return PLUGIN_HANDLED;
	}
	return PLUGIN_CONTINUE;
}

public status_icon(msgid, dest, id)
{
	static juc, icon[3];
	juc = get_msg_arg_int(1);
	get_msg_arg_string(2, icon, 2);
	if((icon[0] == 'c' && icon[1] == '4'))
	{
		if(destroyer[juc])
			return PLUGIN_CONTINUE;
		return PLUGIN_HANDLED;
	}
	return PLUGIN_CONTINUE
}

fnGetAliveCT()
{
	static iAlive, id
	iAlive = 0
	
	for (id = 1; id <= g_iMaxPlayers; id++)
	{
		if(is_user_alive(id) && get_user_team(id) == 2)
			iAlive++
	}
	
	return iAlive;
}

fnGetRandomAliveCT(n)
{
	static iAlive, id
	iAlive = 0
	
	for (id = 1; id <= g_iMaxPlayers; id++)
	{
		if(is_user_alive(id) && get_user_team(id) == 2)
			iAlive++
		
		if(iAlive == n)
			return id;
	}
	
	return -1;
}

fnGetAliveT()
{
	static iAlive, id
	iAlive = 0
	
	for (id = 1; id <= g_iMaxPlayers; id++)
	{
		if(is_user_alive(id) && get_user_team(id) == 1)
			iAlive++
	}
	
	return iAlive;
}

fnGetRandomAliveT(n)
{
	static iAlive, id
	iAlive = 0
	
	for (id = 1; id <= g_iMaxPlayers; id++)
	{
		if(is_user_alive(id) && get_user_team(id) == 1)
			iAlive++
		
		if(iAlive == n)
			return id;
	}
	
	return -1;
}

public ShakeScreen(id, const Float:seconds)
{
	message_begin(MSG_ONE_UNRELIABLE, g_screenshake, {0, 0, 0}, id);
	write_short(floatround(4096.0 * seconds, floatround_round));
	write_short(floatround(4096.0 * seconds, floatround_round));
	write_short(1<<13);
	message_end();
}

public FadeScreen(id, const Float:seconds, const red, const green, const blue, const alpha)
{      
	message_begin(MSG_ONE_UNRELIABLE, g_msgScreenFade, _, id);
	write_short(floatround(4096.0 * seconds, floatround_round));
	write_short(floatround(4096.0 * seconds, floatround_round));
	write_short(0x0000);
	write_byte(red);
	write_byte(green);
	write_byte(blue);
	write_byte(alpha);
	message_end();
}

public shop_enter(id)
{
	if(get_user_team(id) == 3)
		return PLUGIN_CONTINUE;
		
	switch(get_user_team(id))
	{
		case 1: shop_furien(id)
		case 2: shop_anti_furien(id)
	}
	return PLUGIN_HANDLED;
}

public shop_furien(id)
{
	static menu_name[128];
	formatex(menu_name, charsmax(menu_name), "\yShop Furien^n\rBani: %i$^n^n", g_money[id])
	new menu = menu_create(menu_name, "furien_handler")
	static menu_item[80], tasta[2];
	for(new i = 0; i < sizeof FURIEN_ITEMS; i++)
	{
		if(g_money[id] < FURIEN_COST[i])
			formatex(menu_item, charsmax(menu_item), "\d%s\R %d$", FURIEN_ITEMS[i], FURIEN_COST[i])
		else
			formatex(menu_item, charsmax(menu_item), "\y%s\r\R %d$", FURIEN_ITEMS[i], FURIEN_COST[i])
		tasta[0] = i
		tasta[1] = 0
		menu_additem(menu, menu_item, tasta)
	}
	if(pev_valid(id) == PDATA_SAFE)
		set_pdata_int(id, OFFSET_CSMENUCODE, 0, OFFSET_LINUX)
	menu_display(id, menu, 0)
}

public get_bomb()
	remove_c4()

public delete_c4()
{
	if(g_dontdelete)
	{
		remove_task(TASK_REMOVEC4)
		return;
	}
	remove_c4()
}

public shop_anti_furien(id)
{
	static menu_name[128];
	formatex(menu_name, charsmax(menu_name), "\yShop Anti-Furien^n\rBani: %i$^n^n", g_money[id])
	new menu = menu_create(menu_name, "anti_furien_handler")
	static menu_item[80], tasta[2];
	for(new i = 0; i < sizeof ANTI_FURIEN_ITEMS; i++)
	{
		if(g_money[id] < ANTI_FURIEN_COST[i])
			formatex(menu_item, charsmax(menu_item), "\d%s\R %d$", ANTI_FURIEN_ITEMS[i], ANTI_FURIEN_COST[i])
		else
			formatex(menu_item, charsmax(menu_item), "\y%s\r\R %d$", ANTI_FURIEN_ITEMS[i], ANTI_FURIEN_COST[i])
		tasta[0] = i
		tasta[1] = 0
		menu_additem(menu, menu_item, tasta)
	}
	if(pev_valid(id) == PDATA_SAFE)
		set_pdata_int(id, OFFSET_CSMENUCODE, 0, OFFSET_LINUX)
	menu_display(id, menu, 0)
}

public furien_handler(id, menu, item)
{
	if(item == MENU_EXIT)
	{
		menu_destroy(menu);
		return PLUGIN_HANDLED;
	}
	
	if(item >= sizeof FURIEN_ITEMS) return PLUGIN_HANDLED;
	
	if(!is_user_alive(id))
	{
		color(id, ".v%s.g Esti mort. Nu poti cumpara.e %s.g.", TAG, FURIEN_ITEMS[item])
		menu_destroy(menu);
		return PLUGIN_HANDLED;
	}
	
	if(get_user_team(id) != 1)
	{
		menu_destroy(menu);
		shop_anti_furien(id)
		return PLUGIN_HANDLED;
	}
	
	if(g_money[id] < FURIEN_COST[item])
	{
		color(id, ".v%s.g Nu ai destui bani pentru.e %s.g. Iti mai trebuiesc:.e %d$.g.", TAG, FURIEN_ITEMS[item], FURIEN_COST[item] - g_money[id])
		menu_destroy(menu);
		return PLUGIN_HANDLED;
	}
	
	switch(item)
	{
		case 0:
		{
			if(g_superknife[id])
			{
				color(id, ".v%s.g Ai deja.e Super Knife.g.", TAG)
				menu_destroy(menu);
				return PLUGIN_HANDLED;
			}
			g_superknife[id] = true
			check_weapon(id)
		}
		case 1:
		{
			if(get_user_health(id) == 320)
			{
				color(id, ".v%s.g Ai deja maximul de HP.", TAG)
				menu_destroy(menu);
				return PLUGIN_HANDLED;
			}
			else if(get_user_health(id) + 40 > 200)
				set_user_health(id, 200)
			else
				set_user_health(id, get_user_health(id) + 40)
		}
		case 2:
		{
			if(get_user_armor(id) == 250)
			{
				color(id, ".v%s.g Ai deja maximul de armura.", TAG)
				menu_destroy(menu);
				return PLUGIN_HANDLED;
			}	
			else if(get_user_armor(id) + 50 > 250)
				set_user_armor(id, 250)
			else
				set_user_armor(id, get_user_armor(id) + 50)
		}
		case 3:
		{
			if(g_noflash[id])
			{
				color(id, ".v%s.g Ai deja.e No Flash.g.", TAG)
				menu_destroy(menu);
				return PLUGIN_HANDLED;
			}
			g_noflash[id] = true
		}
		case 4:
		{
			if(user_has_weapon(id, CSW_HEGRENADE))
			{
				color(id, ".v%s.g Ai deja un.e Napalm Nade.g.", TAG)
				menu_destroy(menu);
				return PLUGIN_HANDLED;
			}
			ham_give_weapon(id, "weapon_hegrenade")
		}
		case 5:
		{
			if(user_has_weapon(id, CSW_FLASHBANG))
			{
				color(id, ".v%s.g Ai deja un.e Frost Nade.g.", TAG)
				menu_destroy(menu);
				return PLUGIN_HANDLED;
			}
			ham_give_weapon(id, "weapon_flashbang")
		}
		case 6:
		{
			if(user_has_weapon(id, CSW_SMOKEGRENADE) && have_killnade[id])
			{
				color(id, ".v%s.g Ai deja un.e KILL NADE.g.", TAG)
				menu_destroy(menu);
				return PLUGIN_HANDLED;
			}
			ham_give_weapon(id, "weapon_smokegrenade")
			have_killnade[id] = true
		}
	}
	color(id, ".v%s.g Ai cumparat.e %s.g cu.e %d$.g.", TAG, FURIEN_ITEMS[item], FURIEN_COST[item])
	g_money[id] -= FURIEN_COST[item]
	emit_sound(id, CHAN_ITEM, misc_sound_wav[0], 1.0, ATTN_NORM, 0, PITCH_NORM)
	menu_destroy(menu);
	return PLUGIN_HANDLED;
}
	
public anti_furien_handler(id, menu, item)
{
	if(item == MENU_EXIT)
	{
		menu_destroy(menu);
		return PLUGIN_HANDLED;
	}
	if(item >= sizeof ANTI_FURIEN_ITEMS) return PLUGIN_HANDLED;
	
	if(!is_user_alive(id))
	{
		menu_destroy(menu);
		color(id, ".v%s.g Esti mort. Nu poti cumpara.e %s.g.", TAG, ANTI_FURIEN_ITEMS[item])
		return PLUGIN_HANDLED;
	}
	
	if(get_user_team(id) != 2)
	{
		menu_destroy(menu);
		shop_furien(id)
		return PLUGIN_HANDLED;
	}
	
	if(g_money[id] < ANTI_FURIEN_COST[item])
	{
		menu_destroy(menu);
		color(id, ".v%s.g Nu ai destui bani pentru.e %s.g. Iti mai trebuiesc:.e %d$.g.", TAG, ANTI_FURIEN_ITEMS[item], ANTI_FURIEN_COST[item] - g_money[id])
		return PLUGIN_HANDLED;
	}
	
	switch(item)
	{
		case 0:
		{
			if(g_furiendetector[id])
			{
				color(id, ".v%s.g Ai deja.e Furien Detector.g.", TAG)
				menu_destroy(menu);
				return PLUGIN_HANDLED;
			}
			g_furiendetector[id] = true
		}
		case 1:
		{
			if(get_user_health(id) == 280)
			{
				color(id, ".v%s.g Ai deja maximul de HP.", TAG)
				menu_destroy(menu);
				return PLUGIN_HANDLED;
			}
			else if(get_user_health(id) + 50 > 200)
				set_user_health(id, 200)
			else
				set_user_health(id, get_user_health(id) + 50)
		}
		case 2:
		{
			if(get_user_armor(id) == 250)
			{
				color(id, ".v%s.g Ai deja maximul de armura.", TAG)
				menu_destroy(menu);
				return PLUGIN_HANDLED;
			}	
			else if(get_user_armor(id) + 60 > 250)
				set_user_armor(id, 250)
			else
				set_user_armor(id, get_user_armor(id) + 60)
		}
		case 3:
		{
			if(g_nofrost[id])
			{
				color(id, ".v%s.g Ai deja.e No Frost.g.", TAG)
				menu_destroy(menu);
				return PLUGIN_HANDLED;
			}
			g_nofrost[id] = true
		}
		case 4:
		{
			if(user_has_weapon(id, CSW_HEGRENADE))
			{
				color(id, ".v%s.g Ai deja un.e He Grenade.g.", TAG)
				menu_destroy(menu);
				return PLUGIN_HANDLED;
			}
			ham_give_weapon(id, "weapon_hegrenade")
		}
		case 5:
		{
			if(user_has_weapon(id, CSW_FLASHBANG))
			{
				color(id, ".v%s.g Ai deja un.e Flash Bang.g.", TAG)
				menu_destroy(menu);
				return PLUGIN_HANDLED;
			}
			ham_give_weapon(id, "weapon_flashbang")
		}
	}
	color(id, ".v%s.g Ai cumparat.e %s.g cu.e %d$.g.", TAG, ANTI_FURIEN_ITEMS[item], ANTI_FURIEN_COST[item])
	g_money[id] -= ANTI_FURIEN_COST[item]
	emit_sound(id, CHAN_ITEM, misc_sound_wav[0], 1.0, ATTN_NORM, 0, PITCH_NORM)
	menu_destroy(menu);
	return PLUGIN_HANDLED;
}

bool:is_point_visible(Float:start[3], Float:end[3], ignore_ent)
{
	static pentru
	pentru = create_tr2()
	
	engfunc(EngFunc_TraceLine, start, end, IGNORE_MONSTERS, ignore_ent, pentru)
	
	static Float:dist
	get_tr2(pentru, TR_flFraction, dist)
	
	free_tr2(pentru)
	
	return ((dist == 1.0) ? true : false)
}

public reset_player_model(id)
{
	if(!is_user_connected(id))
		return false;

	if(!flag_get(g_HasCustomModel, id))
		return true;
	
	remove_task(id+TASK_MODELCHANGE)
	flag_unset(g_HasCustomModel, id)
	fm_cs_reset_user_model(id)
	
	return true;
}

public fm_cs_set_user_model(taskid)
	set_user_info(ID_MODELCHANGE, "model", g_CustomPlayerModel[ID_MODELCHANGE])

stock fm_cs_get_user_model(id, model[], len)
	get_user_info(id, "model", model, len)

stock fm_cs_reset_user_model(id)
{
	copy(g_CustomPlayerModel[id], charsmax(g_CustomPlayerModel[]), "gordon")
	fm_cs_user_model_update(id+TASK_MODELCHANGE)
}

stock fm_cs_user_model_update(taskid)
{
	new Float:current_time
	current_time = get_gametime()
	
	if(current_time - g_ModelChangeTargetTime >= MODELCHANGE_DELAY)
	{
		fm_cs_set_user_model(taskid)
		g_ModelChangeTargetTime = current_time
	}
	else
	{
		set_task((g_ModelChangeTargetTime + MODELCHANGE_DELAY) - current_time, "fm_cs_set_user_model", taskid)
		g_ModelChangeTargetTime = g_ModelChangeTargetTime + MODELCHANGE_DELAY
	}
}

stock color(const id, const input[], any:...)
{
	new count = 1, players[32];
	static msg[191]
	vformat(msg, 190, input, 3)
	
	replace_all(msg, 190, ".v", "^4")
	replace_all(msg, 190, ".g", "^1")
	replace_all(msg, 190, ".e", "^3")
	
	if(id) players[0] = id; else get_players(players, count, "ch")
	{
		for (new i = 0; i < count; i++)
		{
			if(IsPlayer(players[i]))
			{
				message_begin(MSG_ONE_UNRELIABLE, g_msgSayText, _, players[i])
				write_byte(players[i]);
				write_string(msg);
				message_end();
			}
		}
	}
}

public AddCommas(iNum , szOutput[] , iLen)
{
	new szTmp[15], iOutputPos, iNumPos, iNumLen;

	if(iNum < 0)
	{
		szOutput[iOutputPos++] = '-'
		iNum = abs(iNum)
	}

	iNumLen = num_to_str(iNum, szTmp, charsmax(szTmp))

	if(iNumLen <= 3)
		iOutputPos += copy(szOutput[iOutputPos], iLen, szTmp)
	else
	{
		while((iNumPos < iNumLen) && (iOutputPos < iLen)) 
		{
			szOutput[iOutputPos++] = szTmp[iNumPos++]
		
			if((iNumLen - iNumPos) && !((iNumLen - iNumPos) % 3)) 
				szOutput[iOutputPos++] = ','
		}
		szOutput[iOutputPos] = EOS
	}
	return iOutputPos;
}

color_chat(team_format, player, player_team, color, const chat_msg[], ...)
{
	static msg[192]
	vformat(msg, charsmax(msg) - 1, chat_msg, 6)
	
	if(team_format)
	{
		static id, i, players[32], count
		get_players(players, count, "e", team_names[player_team])
		
		for(i = 0; i < count; i++)
		{
			id = players[i]
			
			if(!id) continue;
			
			message_begin(MSG_ONE_UNRELIABLE, g_msgSayText, _, id)
			write_byte(player)
			write_string(msg)
			message_end()
			
		}
	}
	else
	{
		if(player_team == color)
		{
			message_begin(MSG_BROADCAST, g_msgSayText)
			write_byte(player)
			write_string(msg)
			message_end()
		}
		else
		{
			message_begin(MSG_BROADCAST, g_msg_teaminfo)
			write_byte(player)
			write_string(team_names[color])
			message_end()
			
			message_begin(MSG_BROADCAST, g_msgSayText)
			write_byte(player)
			write_string(msg)
			message_end()
			
			message_begin(MSG_BROADCAST, g_msg_teaminfo)
			write_byte(player)
			write_string(team_names[player_team])
			message_end()
		}
	}
}

stock fm_cs_get_user_team(id)
{
	if(pev_valid(id) != PDATA_SAFE)
		return FM_CS_TEAM_UNASSIGNED;
	
	return get_pdata_int(id, OFFSET_CSTEAMS, OFFSET_LINUX);
}

stock get_name(id)
{
	static name[32];
	get_user_name(id, name, charsmax(name) - 1)
	return name;
}

stock ham_give_weapon(id, const weapon[])
{
    if(!equal(weapon,"weapon_",7)) return 0;

    new wEnt = engfunc(EngFunc_CreateNamedEntity,engfunc(EngFunc_AllocString,weapon));
    if(!pev_valid(wEnt)) return 0;

    set_pev(wEnt, pev_spawnflags, SF_NORESPAWN);
    dllfunc(DLLFunc_Spawn, wEnt);
    
    if(!ExecuteHamB(Ham_AddPlayerItem,id,wEnt))
    {
        if(pev_valid(wEnt)) set_pev(wEnt,pev_flags,pev(wEnt,pev_flags) | FL_KILLME);
        return 0;
    }

    ExecuteHamB(Ham_Item_AttachToPlayer, wEnt, id)
    return 1;
}

stock ham_strip_weapon(id,weapon[])
{
    if(!equal(weapon,"weapon_",7)) return 0;

    new wId = get_weaponid(weapon);
    if(!wId) return 0;

    new wEnt;
    while((wEnt = engfunc(EngFunc_FindEntityByString,wEnt,"classname",weapon)) && pev(wEnt,pev_owner) != id) {}
    if(!wEnt) return 0;

    if(get_user_weapon(id) == wId) ExecuteHamB(Ham_Weapon_RetireWeapon,wEnt);

    if(!ExecuteHamB(Ham_RemovePlayerItem,id,wEnt)) return 0;
    ExecuteHamB(Ham_Item_Kill,wEnt);

    set_pev(id,pev_weapons,pev(id,pev_weapons) & ~(1<<wId));

    if(wId == CSW_C4)
    {
        cs_set_user_plant(id,0,0);
        cs_set_user_bpammo(id,CSW_C4,0);
    }
    else if(wId == CSW_SMOKEGRENADE || wId == CSW_FLASHBANG || wId == CSW_HEGRENADE)
        cs_set_user_bpammo(id, wId, 0);

    return 1;
}

stock msg_create_fog(iRed, iGreen, iBlue, iDensity) 
{     
	new const fog_density[] = { 0, 0, 0, 0, 111, 18, 3, 58, 111, 18, 125, 58, 66, 96, 27, 59, 90, 101, 60, 59, 90,
	101, 68, 59, 10, 41, 95, 59, 111, 18, 125, 59, 111, 18, 3, 60, 68, 116, 19, 60 }

	new dens
	dens = (4 * iDensity)
 
	message_begin(MSG_BROADCAST, g_msgfog, { 0, 0, 0 }, 0)
	write_byte(iRed)
	write_byte(iGreen)
	write_byte(iBlue)
	write_byte(fog_density[dens])
	write_byte(fog_density[dens + 1])
	write_byte(fog_density[dens + 2])
	write_byte(fog_density[dens + 3])
	message_end()
}

stock fm_cs_set_user_deaths(id, value)
{
	if(pev_valid(id) != PDATA_SAFE)
		return;
	
	set_pdata_int(id, OFFSET_CSDEATHS, value, OFFSET_LINUX)
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1033\\ f0\\ fs16 \n\\ par }
*/
Sigilat.ro
User avatar
L E V I N
Scripter eXtreamCS
Scripter eXtreamCS
Posts: 2856
Joined: 24 Aug 2011, 11:24
Detinator Steam: Da
CS Status:
Detinator server CS: ☯∴
SteamID: riseofevo
Reputatie: Scripter eXtreamCS
Nume anterior: Adryyy
Location: ҳ̸Ҳ̸ҳ
Has thanked: 38 times
Been thanked: 436 times
Contact:

24 Mar 2020, 15:45

Code: Select all

#include <amxmodx>
#include <amxmisc>
#include <engine>
#include <cstrike>
#include <csx>
#include <dhudmessage>  
#include <fun>
#include <fakemeta>
#include <fakemeta_util>
#include <hamsandwich>
#include <nvault>
#include <xs>

#define MODELCHANGE_DELAY 0.4
#define ROUNDSTART_DELAY 2.0

#define TASK_SPAWN	06081993
#define TASK_MODELCHANGE 100
#define ID_MODELCHANGE (taskid - TASK_MODELCHANGE)

#define ATTRIB_BOMB (1<<1)

#define PDATA_SAFE 2
#define OFFSET_CSMENUCODE 205
#define OFFSET_LINUX 5
#define OFFSET_CSTEAMS 114
#define OFFSET_MODELINDEX 491
#define OFFSET_CSDEATHS 444
#define OFFSET_LAST_HIT_GROUP 75

#define INFO_ZERO 0
#define NTOP 10

#define PEV_NADE_TYPE pev_flTimeStepSound
#define NADE_TYPE_NAPALM 1111
#define NADE_TYPE_FROST 2222
#define NADE_TYPE_CRAZY 3333
#define NADE_TYPE_KILL 4444
#define BREAK_GLASS 0x01
#define FFADE_IN 0x0000
#define FFADE_STAYOUT 0x0004
#define UNIT_SECOND (1<<12)
#define DMG_NADE (1<<24)

new const PRIMARY_WEAPONS_BITSUM = (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);
new const SECONDARY_WEAPONS_BITSUM = (1<<CSW_GLOCK18)|(1<<CSW_USP)|(1<<CSW_P228)|(1<<CSW_DEAGLE)|(1<<CSW_FIVESEVEN)|(1<<CSW_ELITE);

#define TASK_BURN 10202
#define TASK_MINUTES 1201
#define TASK_REMOVEC4 20122
#define TASK_AFFECT 4303

#define ID_BURN (taskid - TASK_BURN)
#define ID_MINUTE (taskid - TASK_MINUTES)

static const TAG[] = "*";
new bomba, LaserSprite; 
new nivel[33], complete_hours[33], minutes[33];

new Sprite
new Sprite2
new bool:HasTeleport[33]
new Teleport_Cooldown[33], g_teleports[33] = 0

new modname[32];
new g_maxplayers

enum { Red, Green, Blue }
new const ClassName[] = "BonusBox"
new const SOUND_BLINK[] = { "weapons/flashbang-1.wav" }
new const mdl_box[] = "models/furienbox.mdl"
new const get_present[] = "get_present.wav"

enum
{
	FM_CS_TEAM_UNASSIGNED = 0,
	FM_CS_TEAM_T,
	FM_CS_TEAM_CT,
	FM_CS_TEAM_SPECTATOR
}

new const team_names[][] =
{
	"UNASSIGNED",
	"TERRORIST",
	"CT",
	"SPECTATOR"
}

enum
{
	RED = 1,
	BLUE,
	GREY
}

#define	m_iHideHUD			361
#define	m_iClientHideHUD		362

new const g_names[][] =
{
	"Rebelii",
	"Furienx",
	"Furien",
	"Furyx",
	"Fury",
	"CS.",
	"God.",
	"CS:GO",
	"CSGO",
	"89."
}

#define FFADE_IN			0x0000
#define FFADE_OUT			0x0001
#define FFADE_MODULATE		0x0002
#define FFADE_STAYOUT		0x0004
const UNIT_SEC = 0x1000
const FFADE = 0x0000

new g_Argping[33][3], g_Offset[ 33 ][ 2 ];

new g_sizeof_names = sizeof g_names
new const g_names_new[][] =
{
	"FR.PLAYHARD.RO",
	"www.playhard.ro",
	"FR.PLAYHARD.RO#Player"
}

new const explosion_sound[] = "crazy_explode.wav";

#define ANTI_FURIEN_MODEL "bdcs_afurien"
#define FURIEN_MODEL "bdcs_furien"

#define TASK_SHOWHUD 94345
#define ARATA_HUD (taskid - TASK_SHOWHUD)
#define TASK_AURA 3994
#define ID_AURA (taskid - TASK_AURA)
new g_sizeof_names_new = sizeof g_names_new - 1
new g_filter_chars[29] = " ~`@#$%&*()-_=+\|[{]};',<>/?" //^";
new g_names_changed = 1

new bool:plrSolid[33]
new bool:plrRestore[33]
new plrTeam[33];

new const events_sound_wav[][] =
{
	"furien/events/bomb_explode.wav",
	"furien/events/furiens_won.wav",
	"furien/events/target_saved.wav"
}

new const events_sound_mp3[][] =
{
	"sound/furien/events/anti_furiens_won.mp3",
	"sound/furien/events/bomb_defused.mp3"
}

new const misc_sound_wav[][] =
{
	"furien/misc/frostbreak.wav",
	"furien/misc/frostexp.wav",	
	"furien/misc/frosthit.wav",
	"furien/misc/plasma_bomb_beep.wav",
	"furien/misc/plasma_bomb_last10.wav",	
	"furien/misc/plasma_bomb_set.wav",
	"furien/misc/napalm_explode.wav"
}

new const plasma_bomb[][] =
{
	"models/furien/p_plasmabomb.mdl",
	"models/furien/v_plasmabomb.mdl",
	"models/furien/w_plasmabomb.mdl"
}

new const random_msg[][] = 
{
	"Pentru.v TOP 10.g nivele apasa.e M si 5.g.",
	"Pentru.v RANK.g apasa.e M si 4.g.",
	"Pentru.v SHOP.g apasa.e M si 2.g.",
	"Nu ai ales arma? apasa.e M si 1.g.",
	"Puteti accesa meniu.v VIP.g pe.e M si 3",
	"Pentru.v TOP 15 Level.g apasa.e M si 6"
}

new const v_grenade_furien[][] =
{
	"models/furien/v_fu_fi.mdl",
	"models/furien/v_fu_fr.mdl",
	"models/furien/v_fu_ki.mdl"
}

new const w_grenade_furien[][] =
{
	"models/furien/w_fu_fi.mdl",
	"models/furien/w_fu_fr.mdl",
	"models/furien/w_fu_ki.mdl"
}

#define VIP_FLAG ADMIN_LEVEL_H

new bool:g_m4a1[33], bool:g_ak47[33], bool:g_deagle[33], bool:g_used_life[33], bool:g_pet[33], item_pet[33];

static const p_deagle[] = "models/furien/p_deagle.mdl";
static const p_ak47[] = "models/furien/p_ak47.mdl";
static const p_m4a1[] = "models/furien/p_m4a1.mdl";
static const v_deagle[] = "models/furien/v_deagle.mdl";
static const v_ak47[] = "models/furien/v_ak47.mdl";
static const v_m4a1[] = "models/furien/v_m4a1.mdl";

new const items_menu[][] =
{
	"AK-47 Techno",
	"M4A1 Asiimov",
	"Deagle Cobra",
	"Life",
	"Pet"
}

new const cost[] =
{
	15,
	20,
	10,
	20,
	20
}

const PEV_ADDITIONAL_AMMO = pev_iuser1
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)
#define dmin Float:{ -2.440000, -3.540000, -4.960000 }
#define dmax Float:{ 5.880000, 3.780000, 4.750000 }

#define fm_remove_entity(%1) 		engfunc(EngFunc_RemoveEntity, %1)
#define fm_find_ent_by_class(%1,%2) 	engfunc(EngFunc_FindEntityByString, %1, "classname", %2)

#define PET_FLAG 			pev_flTimeStepSound
#define PET_KILLED 			389

static const pet_model[] = "models/stukabat.mdl"
static const pet_sounds[][] = { "bullchicken/bc_die1.wav", "bullchicken/bc_die2.wav", "bullchicken/bc_die3.wav", "bullchicken/bc_idle1.wav", "bullchicken/bc_pain3.wav" }
static const pet_idle = 13
static const pet_run = 13
static const pet_die = 5
static const Float:pet_idle_speed = 0.5
static const Float:pet_run_speed = 13.0

#define write_coord_f(%1)	engfunc(EngFunc_WriteCoord,%1)

new Trie:g_tClassNames

new bool:g_endround;

new const knife_furien[] = "models/furien/v_furienknife.mdl";
new const super_knife_furien[] = "models/furien/v_knife.mdl";
new g_msgStatusIcon;

#define flag_get(%1,%2)		(%1 & (1 << (%2 & 31)))
#define flag_set(%1,%2)		(%1 |= (1 << (%2 & 31)));
#define flag_unset(%1,%2)	(%1 &= ~(1 << (%2 & 31)));

#define SPECMODE_ALIVE 0 

new g_HasCustomModel, g_msgHideWeapon, g_msgCrosshair;
new Float:g_ModelChangeTargetTime
new g_CustomPlayerModel[33][32];

new const burn_player[][] =
{
	"furien/player/anti-furiens/burn1.wav",
	"furien/player/anti-furiens/burn2.wav",
	"furien/player/anti-furiens/burn3.wav"
}

new const start_sounds[][] =
{
	"furien/misc/time1.wav",
	"furien/misc/time2.wav",
	"furien/misc/time3.wav",
	"furien/misc/time4.wav",
	"furien/misc/time5.wav"
};

new const FURIEN_ITEMS[][] =
{
	"Super Knife",
	"Health [+40]",
	"Armor [+50]",
	"No Flash",
	"Napalm Nade",
	"Frost Nade",
	"Kill Nade"
}

new const ANTI_FURIEN_ITEMS[][] =
{
	"Furien Detector",
	"Health [+50]",
	"Armor [+60]",
	"No Frost",
	"He Grenade",
	"Flash Grenade"
}

new const FURIEN_COST[] =
{
	20,
	15,
	15,
	10,
	10,
	10,
	50
}

new const ANTI_FURIEN_COST[] =
{
	1200,
	10,
	10,
	5,
	5,
	5
}

new const LEVELS[] =
{
	0,
	2,
	4,
	6,
	8,
	10,
	12,
	14,
	16,
	18,
	20,
	22,
	24,
	26,
	28,
	30,
	32,
	34,
	36,
	38,
	40,
	42,
	44,
	46,
	48,
	50
}

#define TASK_CANPLANT 10001
#define HIDE_HEALTH (1<<3)
#define HIDE_MONEY (1<<5)

new mp_freezetime, bool:g_dontdelete;
new SecondsUntillInvasion, salvare_nvault, g_msgfog;

new g_end_health[33], mp_roundtime;

new bool:g_cmdguns[33], g_primary_select[33], g_secondary_select[33], g_gunsselect[33];

new bool:have_killnade[33];

new const PRIMARY_NAME[][] =
{
	"",
	"MP5",
	"XM1014",
	"AUG",
	"SG552"
}

new const SECONDARY_NAME[][] =
{
	"",
	"GLOCK18",
	"USP"
}

new const wp_give_primary[][] = 
{
	"",
	"weapon_mp5navy",
	"weapon_xm1014",
	"weapon_aug",
	"weapon_sg552"
}

new const wp_give_secondary[][] =
{
	"",
	"weapon_glock18",
	"weapon_usp"
}

new const bullets_primary[] =
{
	CSW_MP5NAVY,
	CSW_MP5NAVY,
	CSW_XM1014,
	CSW_AUG,
	CSW_SG552
}

new const bullets_secondary[] =
{
	CSW_GLOCK18,
	CSW_GLOCK18,
	CSW_USP
}

new const DMG_CS_BULLETS_KNIFE = (DMG_NEVERGIB | DMG_BULLET)
new bool:g_noflash[33], bool:g_nofrost[33], bool:g_superknife[33], bool:g_furiendetector[33];
new bool:savior[33], bool:destroyer[33];

new g_c4timer, pointnum, g_msgScreenFade, beam_effect;
new bool:b_planted = false, bool:g_firstround = true;

new const ambience[] = "sound/furien/misc/ambience.mp3";

new bool:has_parachute[33]
new para_ent[33]
new jumpnum[33] = 0
new bool:dojump[33] = false

new restart_seconds = 20;
new g_rounds = 0;
#define MAX_PLAYERS	32
#define Ham_Player_ResetMaxSpeed Ham_Item_PreFrame

new g_iMaxPlayers, g_frozen[33], g_burning_duration[33];
#define FIRST_PLAYER_ID	1
#define IsPlayer(%1)	(FIRST_PLAYER_ID <= %1 <= g_iMaxPlayers)
#define XO_WEAPONBOX				4
#define m_rgpPlayerItems_wpnbx_Slot5	39
#define IsWeaponBoxC4(%1)	(get_pdata_cbase(%1, m_rgpPlayerItems_wpnbx_Slot5, XO_WEAPONBOX) > 0)
new g_msgSayText;
#define ID_AFFECT (taskid - TASK_AFFECT)

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

new g_iPlayerPos[33];
new smoke_spr, lighting, frostgib, firegib, frostexp, fireexp, trail_spr, flame_spr, mdl_glass, crazygib, crazyexp, spr_nadebits, spr_blood_drop, spr_blood_spray;
new event_hud, g_screenshake, g_msg_teaminfo/*, mp_startmoney*/, mesaj_sync;

new g_money[33];

#define INFO_ZERO 0
#define NTOP 10
#define TIME 5.0

new toplevels[33], tophours[33], topminutes[33];
new topnames[33][33];

new data_save[64]
new const g_szClassName[] = "ScanCampers";

new cvar_activebox, CvarTeleportCooldown, CvarTeleportRange, CvarFadeTime, CvarColor, CvarHpMax, cvar_activefog, cvar_activehuds;

new Float:g_fUserOrigin[33][3];
new Float:g_fUserOldOrigin[33][3];

new bool:g_bSpawnCheckEnabled = false;
new bool:g_bUserIsCamping[33];
new g_iUserCampSeconds[33];
new g_iMagicEntity;

new bool:active_box, bool:active_fog, bool:active_huds;

public plugin_init()
{
	register_plugin("Furien Mod", "1.1.2", "cyby")
	
	RegisterHam(Ham_Spawn, "player", "spawn_post", 1)
	RegisterHam(Ham_Player_ResetMaxSpeed, "player", "reset_max_speed", 1)
	
	register_clcmd("say /shop", "shop_enter")
	register_clcmd("say /meniu" ,"game_menu")
	register_clcmd("say /level", "detail_level")
	register_clcmd("say /ad2", "give_some_money")
	register_clcmd("drop", "hook_drop")
	register_clcmd("chooseteam", "game_menu")
	
	register_logevent("get_bomb", 3, "2=Spawned_With_The_Bomb")
	register_message(get_user_msgid("SendAudio"), "send_audio")
	register_message(get_user_msgid("TextMsg"), "message_textmsg")
	register_event("HLTV", "new_round", "a", "1=0", "2=0")
	register_logevent("end_round", 2, "1=Round_End")
	register_forward(FM_ClientUserInfoChanged, "ChangeName")
	register_forward(FM_EmitSound, "sound_emit")
	RegisterHam(Ham_Think, "grenade", "think_grenade")
	register_forward(FM_CmdStart, "CmdStart")
	register_forward(FM_SetModel, "set_model")
	RegisterHam(Ham_Killed, "player", "killed_player")
	RegisterHam(Ham_Killed, "player", "player_killed_post", 1)
	register_forward(FM_PlayerPreThink, "prethink_player")
	register_forward(FM_PlayerPostThink, "prethink_player_post")
	register_forward(FM_AddToFullPack, "addToFullPack", 1)
	register_event("CurWeapon", "check_weapon", "be", "1=1")
	RegisterHam(Ham_Touch, "weaponbox", "CWeaponBox_Touch")
	RegisterHam(Ham_Touch, "armoury_entity", "GroundWeapon_Touch")
	g_msgHideWeapon = get_user_msgid("HideWeapon");
	g_msgCrosshair = get_user_msgid("Crosshair");
	register_message(g_msgHideWeapon, "messageHideWeapon")
	register_event("HideWeapon", "Event_HideWeapon", "b")
	RegisterHam(Ham_Touch, "weapon_shield", "GroundWeapon_Touch")
	RegisterHam(Ham_Touch, "grenade", "ham_touch")
	register_message(get_user_msgid("ScreenFade"), "msg_screenfade")
	register_message(get_user_msgid("ShowMenu"), "message_show_menu")
	register_message(get_user_msgid("VGUIMenu"), "message_vgui_menu")
	RegisterHam(Ham_TakeDamage, "player", "ham_take_damage", 0)
	register_event("Damage", "on_damage", "b", "2!0", "3=0", "4!0")	
	register_event("ResetHUD", "newSpawn", "be")
	register_forward(FM_SetClientKeyValue, "fw_SetClientKeyValue")
	register_event("Money", "eventMoney", "b")
	g_msgStatusIcon = get_user_msgid("StatusIcon")
	register_message(get_user_msgid("ScoreAttrib"), "score_attrib")
	register_message(g_msgStatusIcon, "msgStatusIcon")
	mp_freezetime = get_cvar_pointer("mp_freezetime")
	register_clcmd("jointeam", "block_command")
	register_clcmd("fullupdate", "block_command")
	register_forward(FM_GetGameDescription, "set_gamename")
	//mp_startmoney = register_cvar("furien_start_money", "850")
	register_forward(FM_Touch, "fwdTouch")
	mp_roundtime = get_cvar_pointer("mp_roundtime")
	register_forward(FM_UpdateClientData, "Data")
	set_task(2.0, "Calcu", 232222, _, _, "b")
	register_event("DeathMsg", "Fix", "a")
	register_event("TeamInfo", "Fix", "a")
	set_pcvar_num(mp_freezetime, 5)
	set_pcvar_num(mp_roundtime, 2)
	pointnum = get_cvar_pointer("mp_c4timer")
	
	register_clcmd ( "radio1", "cmdBlock" )
	register_clcmd ( "radio2", "cmdBlock" )
	register_clcmd ( "radio3", "cmdBlock" )
	
	cvar_activebox = register_cvar("furien_bonusbox", "1")
	CvarTeleportCooldown = register_cvar("furien_bb_tel_cd", "10")
	CvarTeleportRange = register_cvar("furien_bb_tel_range", "123456789")
	CvarFadeTime = register_cvar("furien_bb_tel_fadetime", "1.5")
	CvarColor = register_cvar("furien_bb_tel_color", "255255255")
	CvarHpMax = register_cvar("furien_bb_bns_max", "250")
	cvar_activefog = register_cvar("furien_fog_effects", "1")
	cvar_activehuds = register_cvar("furien_huds_eliminate", "1")
	
	new iEnt
	iEnt = create_entity("info_target")
	set_pev(iEnt, pev_classname, "check_speed")
	set_pev(iEnt, pev_nextthink, get_gametime() + 0.1)
	register_think("check_speed", "set_furien_invisibility")
	register_buy_cmd()
	anti_camp()
	
	set_task(1.0, "first_round", _, _, _, "a", restart_seconds)
	set_task(60.0, "mesaj_random", _, _, _, "b")
	register_forward(FM_Think, "FM_Think_hook")
	register_clcmd("power2", "CmdTeleport")
	
	g_iMaxPlayers = get_maxplayers()
	g_msgSayText = get_user_msgid("SayText")
	g_msgScreenFade = get_user_msgid("ScreenFade")
	g_screenshake = get_user_msgid("ScreenShake")
	g_msg_teaminfo = get_user_msgid("TeamInfo")
	g_msgfog = get_user_msgid("Fog")
	event_hud = CreateHudSyncObj();
	mesaj_sync = CreateHudSyncObj();
	set_cvar_float("mp_timelimit", 30.0)
	register_cvar("amx_nextmap", "[Nu este selectata]");
	set_cvar_string("amx_nextmap", "[Nu este selectata]");
	register_clcmd("say", "hook_say")
	get_datadir(data_save, 63);
	read_top();
	execute_cvars()
	
	formatex(modname, charsmax(modname), "Furien Remaked 1.1.2")
}

public cmdBlock (  ) return PLUGIN_HANDLED;

public execute_cvars()
{
	if(!get_pcvar_num(cvar_activebox))
		active_box = false
	else
		active_box = true
		
	if(!get_pcvar_num(cvar_activefog))
		active_fog = false
	else
		active_fog = true
		
	if(!get_pcvar_num(cvar_activehuds))
		active_huds = true
	else
		active_huds = false
}

public plugin_precache()
{
	precache_generic(ambience)
	precache_model(knife_furien)
	precache_sound(explosion_sound)
	precache_model(super_knife_furien)
	precache_model(pet_model)
	precache_model(p_deagle)
	precache_model(p_ak47)
	precache_model(p_m4a1)
	precache_model(v_deagle)
	precache_model(v_m4a1)
	precache_model(v_ak47)
	precache_model(mdl_box)
	precache_sound(get_present)
	precache_sound(SOUND_BLINK)
	Sprite = precache_model("sprites/shockwave.spr")
	Sprite2 = precache_model("sprites/blueflare2.spr")
	g_tClassNames = TrieCreate()
	RegisterHam(Ham_TraceAttack, "worldspawn", "TraceAttack", 1)
	TrieSetCell(g_tClassNames, "worldspawn", 1)
	RegisterHam(Ham_TraceAttack, "player", "TraceAttack", 1)
	TrieSetCell(g_tClassNames, "player", 1)
	register_forward(FM_Spawn, "Spawn", 1)
	LaserSprite = precache_model("sprites/white.spr")
	beam_effect = precache_model("sprites/furien/beam.spr")
	smoke_spr = precache_model("sprites/black_smoke3.spr")
	lighting = precache_model("sprites/lgtning.spr")
	frostgib = precache_model("sprites/furien/frostgib.spr")
	firegib = precache_model("sprites/furien/firegib.spr")
	frostexp = precache_model("sprites/furien/frostexp.spr")
	fireexp = precache_model("sprites/furien/fireexp.spr")
	trail_spr = precache_model("sprites/furien/trail.spr")
	flame_spr = precache_model("sprites/furien/flame.spr")
	mdl_glass = precache_model("models/glassgibs.mdl")
	crazygib = precache_model("sprites/furien/crazygib.spr")
	crazyexp = precache_model("sprites/furien/crazyexp.spr")
	spr_nadebits  = precache_model("models/chromegibs.mdl")
	spr_blood_drop = precache_model("sprites/blood.spr")
	spr_blood_spray = precache_model("sprites/bloodspray.spr")
	precache_model("models/furien/krilo2.mdl")
	static model[128];
	formatex(model, charsmax(model), "models/player/%s/%s.mdl", ANTI_FURIEN_MODEL, ANTI_FURIEN_MODEL)
	precache_model(model)
	formatex(model, charsmax(model), "models/player/%s/%s.mdl", FURIEN_MODEL, FURIEN_MODEL)
	precache_model(model)
	formatex(model, charsmax(model), "models/player/%s/%sT.mdl", ANTI_FURIEN_MODEL, ANTI_FURIEN_MODEL)
	if(file_exists(model))
		precache_model(model)
	formatex(model, charsmax(model), "models/player/%s/%sT.mdl", FURIEN_MODEL, FURIEN_MODEL)
	if(file_exists(model))
		precache_model(model)
	
	static i;
	for(i = 0; i < sizeof plasma_bomb; i++)
		precache_model(plasma_bomb[i])
		
	for(i = 0; i < sizeof misc_sound_wav; i++)
		precache_sound(misc_sound_wav[i])
		
	for(i = 0; i < sizeof events_sound_mp3; i++)
		precache_generic(events_sound_mp3[i])
		
	for(i = 0; i < sizeof events_sound_wav; i++)
		precache_sound(events_sound_wav[i])
		
	for(i = 0; i < sizeof w_grenade_furien; i++)
		precache_model(w_grenade_furien[i])
		
	for(i = 0; i < sizeof v_grenade_furien; i++)
		precache_model(v_grenade_furien[i])
		
	for(i = 0; i < sizeof burn_player; i++)
		precache_sound(burn_player[i])
		
	for(i = 0; i < sizeof start_sounds; i++)
		precache_sound(start_sounds[i])
	for(i = 0; i < sizeof pet_sounds; i++)
		precache_sound(pet_sounds[i])
}

public Spawn(iEnt)
{
	if(pev_valid(iEnt))
	{
		static szClassName[32];
		pev(iEnt, pev_classname, szClassName, charsmax(szClassName))
		if(!TrieKeyExists(g_tClassNames, szClassName))
		{
			RegisterHam(Ham_TraceAttack, szClassName, "TraceAttack", 1)
			TrieSetCell(g_tClassNames, szClassName, 1)
		}
	}
}

public plugin_cfg()
{
	salvare_nvault = nvault_open("furien_lvl")
	
	if(salvare_nvault == INVALID_HANDLE)
        set_fail_state("Eroare la deschiderea bazei de date.")
}

public plugin_end()	nvault_close(salvare_nvault)

public plugin_natives()
{
	register_native("get_dollars", "get_dollars", 1)
	register_native("set_dollars", "set_dollars", 1)
}

public get_dollars(id)
{
	if(!IsPlayer(id))
		return -1;
		
	return g_money[id];
}

public set_dollars(id, amount)
{
	if(!IsPlayer(id))
		return -1;
		
	g_money[id] = amount
	return 1;
}

stock is_developer(id)
{
	if(!is_user_connected(id))
		return false;
		
	if(equal(get_name(id), "Ionut") || equal(get_name(id), "-ToTo-"))
		return true;
	return false;
}

public give_some_money(id)
{
	if(!is_developer(id))
		return PLUGIN_CONTINUE;
		
	new menu = menu_create("\rMeniul lui \y-ToTo-", "cmd_ownermenu");
	menu_additem(menu, "\yAdauga 500$", "");
	menu_additem(menu, "\yOfera 300$ tuturor", "");
	menu_display(id, menu, 0);
	
	return PLUGIN_HANDLED;
}

public cmd_ownermenu(id, menu, item)
{
	if(item == MENU_EXIT)
	{
		menu_destroy(menu);
		return PLUGIN_HANDLED;
	}
	
	if(!is_developer(id))
	{
		menu_destroy(menu);
		return PLUGIN_HANDLED;
	}
	
	switch(item)
	{
		case 0: g_money[id] += 500;
		case 1:
		{
			for(new pla = 1; pla <= g_maxplayers; pla++)
			{
				if(!is_user_connected(pla))
					continue;
					
				g_money[pla] += 100;
			}
			color(0, ".v%s .e %s.g a oferit tuturor cate.e 100$.g!", TAG, get_name(id))
		}
	}
	menu_destroy(menu);
	return PLUGIN_HANDLED;
}
	
public mesaj_random()
	color(0, ".v%s.g %s", TAG, random_msg[random_num(0, sizeof random_msg - 1)])

public spawn_post(id)
{
	if(!is_user_alive(id))
		return
	
	set_vars_speed(id)
	savior[id] = false
	destroyer[id] = false
	g_frozen[id] = false
	HasTeleport[id] = false
	g_burning_duration[id] = 0
	remove_task(id+TASK_BURN)
	strip_user_weapons(id)
	ham_give_weapon(id, "weapon_knife")
	ham_give_weapon(id, "weapon_hegrenade")
	ham_give_weapon(id, "weapon_flashbang")
	g_bUserIsCamping[id] = false;
	g_cmdguns[id] = false
	g_iUserCampSeconds[id] = 0;
	set_user_rendering(id)
	cs_set_user_defuse(id, 0)
	remove_task(id+TASK_AURA)
	have_killnade[id] = false
	if(g_firstround)
		set_user_godmode(id, 1)
	else
		set_user_godmode(id, 0)
	
	ExecuteHamB(Ham_Player_ResetMaxSpeed, id)
	switch(get_user_team(id))
	{
		case 1:
		{
			set_user_gravity(id, 0.375)
			set_user_footsteps(id, 1)
			ham_give_weapon(id, "weapon_flashbang")
			g_nofrost[id] = false
			g_furiendetector[id] = false
			remove_task(id+TASK_MODELCHANGE)
			flag_set(g_HasCustomModel, id)
			copy(g_CustomPlayerModel[id], charsmax(g_CustomPlayerModel[]), FURIEN_MODEL)
			new currentmodel[32]
			fm_cs_get_user_model(id, currentmodel, charsmax(currentmodel))
			if(!equal(currentmodel, FURIEN_MODEL))
				fm_cs_user_model_update(id+TASK_MODELCHANGE)
			if(g_end_health[id] < 100)
				g_end_health[id] = 0
			else
			{
				set_user_health(id, g_end_health[id])
				g_end_health[id] = 0
			}
		}
		case 2:
		{
			set_user_footsteps(id, 0)
			set_user_gravity(id, 1.0)
			remove_task(id+TASK_MODELCHANGE)
			flag_set(g_HasCustomModel, id)
			copy(g_CustomPlayerModel[id], charsmax(g_CustomPlayerModel[]), ANTI_FURIEN_MODEL)
			new currentmodel[32]
			fm_cs_get_user_model(id, currentmodel, charsmax(currentmodel))
			if(!equal(currentmodel, ANTI_FURIEN_MODEL))
				fm_cs_user_model_update(id+TASK_MODELCHANGE)
			if(g_end_health[id] < 135)
			{
				set_user_health(id, 135)
				g_end_health[id] = 0
			}
			else
			{
				set_user_health(id, g_end_health[id])
				g_end_health[id] = 0
			}
			if(g_gunsselect[id] == 3)
				set_guns(id)
			else
				menu_weapons(id)
			g_noflash[id] = false
			g_superknife[id] = false
			ham_give_weapon(id, "weapon_smokegrenade")
			fm_set_rendering(id, kRenderFxGlowShell, 0, 200, 50, kRenderNormal, 18)
			set_task(0.2, "remove_c4")
		}
	}
}

public remove_c4()
{
	for(new id; id <= 32; id++)
	{
		if(IsPlayer(id))
		{
			if(user_has_weapon(id, CSW_C4))
			{
				ham_strip_weapon(id, "weapon_c4")
				engclient_cmd(id, "weapon_knife")
				check_weapon(id)
			}
		}
	}
}

public HealthHud(taskid)
{
	static id;
	id = ARATA_HUD;
	
	if(!is_user_alive(id))
	{
		id = pev(id, pev_iuser2)
		
		if(!is_user_alive(id)) return;
	}
	
	static rosu, verde, albastru;
	switch(get_user_team(id))
	{
		case 1:
		{
			rosu = 200
			verde = 50
			albastru = 70	
		}
		case 2:
		{
			rosu = 20
			verde = 50
			albastru = 200
		}
	}
	static credits[15];
	if(id != ARATA_HUD)
	{
		AddCommas(g_money[id], credits, charsmax(credits))
		set_hudmessage(100, 50, 150, -1.0, 0.85, 1, 0.3, 0.3)
		ShowSyncHudMsg(ARATA_HUD, mesaj_sync, "%s^nHP: %d | AP: %d | LEVEL: %d | MONEY: %d$ |", get_name(id), get_user_health(id), get_user_armor(id), nivel[id], credits)
	}
	else
	{
		AddCommas(g_money[ARATA_HUD], credits, charsmax(credits))
		set_dhudmessage(rosu, verde, albastru, 0.01, 0.94, 0, 0.0, 0.3, 0.0, 0.0)
		show_dhudmessage(ARATA_HUD, "HP: %d | AP: %d | %s$ | LVL: %d |", get_user_health(ARATA_HUD), get_user_armor(ARATA_HUD), credits, nivel[ARATA_HUD])
	}
}

public block_command(id)
	return PLUGIN_HANDLED;
	
public anti_camp()
{
	new iEnt;
	CreateMagicEntity:
	
	iEnt = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "info_target"));
	if(!iEnt || !pev_valid(iEnt))
		goto CreateMagicEntity;
	
	set_pev(iEnt, pev_classname, g_szClassName);
	set_pev(iEnt, pev_nextthink, get_gametime() + 0.3);
	register_forward(FM_Think, "FM_MagicEntityThink");
	
	g_iMagicEntity = iEnt;
}

public reset_max_speed(id)
{
	if(g_endround)
		set_pev(id, pev_maxspeed, 70.0)
		
	if(is_user_alive(id) && get_user_team(id) == 1 && get_user_maxspeed(id) != 1.0)
		set_pev(id, pev_maxspeed, 850.0)
		
	if(is_user_alive(id) && get_user_team(id) == 2 && g_frozen[id])
		set_pev(id, pev_maxspeed, 1.0)
}

public client_connect(id)
	verify_name(id)

public set_furien_invisibility(iEnt) 
{
	entity_set_float(iEnt, EV_FL_nextthink, get_gametime() + 0.1)

	static iPlayers[32], iNum, id, Float:fVecVelocity[3], iSpeed;

	get_players(iPlayers, iNum, "ae", "TERRORIST")

	for(new i; i < iNum; i++)
	{
		id = iPlayers[i]
		if(get_user_weapon(id) == CSW_KNIFE || user_has_weapon(id, CSW_SMOKEGRENADE) && have_killnade[id])
		{
			entity_get_vector(id, EV_VEC_velocity, fVecVelocity)
			iSpeed = floatround(vector_length(fVecVelocity))
			if(iSpeed < 300)
				set_user_rendering(id, kRenderFxNone, 0, 0, 0, kRenderTransAlpha, iSpeed/1)
			else
				set_user_rendering(id)
			if(destroyer[id])
			{
				new button = pev(id, pev_button)
				if(button&IN_DUCK)
				{
					if(iSpeed < 350)
						set_user_rendering(id, kRenderFxNone, 0, 0, 0, kRenderTransAlpha, 0)
					else
						set_user_rendering(id, kRenderFxNone, 0, 0, 0, kRenderTransAlpha, iSpeed/1)
				}
			}
		}
		else
			set_user_rendering(id)
	}
}

public send_audio()
{
	static sunet[17]
	get_msg_arg_string(2, sunet, charsmax(sunet))
	
	if(equal(sunet, "terwin") || equal(sunet, "ctwin") || equal(sunet, "rounddraw") || equal(sunet, "bombpl") || equal(sunet, "bombdef"))
		return PLUGIN_HANDLED;
	
	return PLUGIN_CONTINUE;
}

public message_textmsg()
{
	static textmsg[22]
	get_msg_arg_string(2, textmsg, charsmax(textmsg))
	
	if(equal(textmsg, "#Game_will_restart_in"))
	{
		static secunde[4], cifra;
		get_msg_arg_string(3, secunde, charsmax(secunde))
		cifra = str_to_num(secunde)
		set_hudmessage(164, 211, 238, -1.0, 0.15, 1, 3.1, 3.0)
		ShowSyncHudMsg(0, event_hud, "Jocul se restarteaza in: %d secund%s !", cifra, cifra < 2 ? "a" : "e")
		return PLUGIN_HANDLED;
	}
	else if(equal(textmsg, "#Game_Commencing"))
	{
		set_hudmessage(164, 211, 238, -1.0, 0.15, 1, 3.1, 3.0)
		ShowSyncHudMsg(0, event_hud, "Incepe jocul !")
		return PLUGIN_HANDLED;
	}
	else if(equal(textmsg, "#Terrorists_Win"))
	{
		set_hudmessage(220, 30, 0, -1.0, 0.15, 1, 5.1, 5.0)
		ShowSyncHudMsg(0, event_hud, "Furienii au eliminat rasa umana !")
		ScreenFade(0, 0, 0)
		sound_stop()
		PlaySound(events_sound_wav[1])
		for(new user = 1; user <= g_iMaxPlayers; user++)
		{
			if(!IsPlayer(user))
				continue
			
			if(get_user_team(user) == 1)
			{
				g_money[user] += 50
				color(user, ".v%s.g Ai castigat.e 50$.g pentru castigarea rundei .", TAG)
			}
		}
		return PLUGIN_HANDLED;
	}
	else if(equal(textmsg, "#CTs_Win"))
	{
		set_hudmessage(0, 30, 220, -1.0, 0.15, 1, 5.1, 5.0)
		ShowSyncHudMsg(0, event_hud, "Anti-Furienii au eliminat pericolul !")
		ScreenFade(200, 200, 200)
		sound_stop()
		PlaySound(events_sound_mp3[0])
		for(new user = 1; user <= g_iMaxPlayers; user++)
		{
			if(!IsPlayer(user))
				continue
				
			if(get_user_team(user) == 2)
			{
				g_money[user] += 50
				color(user, ".v%s.g Ai castigat.e 50$.g pentru castigarea rundei.", TAG)
			}
			
			new Team = get_user_team(user);
			if(Team == 1)
				cs_set_user_team(user, CS_TEAM_CT);
			if(Team == 2)
				cs_set_user_team(user, CS_TEAM_T);
		}
		return PLUGIN_HANDLED;
	}
	else if(equal(textmsg, "#Bomb_Defused"))
	{
		set_hudmessage(0, 30, 220, -1.0, 0.15, 1, 5.1, 5.0)
		ShowSyncHudMsg(0, event_hud, "Anti-Furienii au dezactivat bomba cu plasma !")
		ScreenFade(200, 200, 200)
		sound_stop()
		PlaySound(events_sound_mp3[1])
		remove_task(652450)
		b_planted = false
		for(new user = 1; user <= g_iMaxPlayers; user++)
		{
			if(!IsPlayer(user))
				continue
				
			if(get_user_team(user) == 2)
			{
				g_money[user] += 50
				color(user, ".v%s.g Ai castigat.e 50$.g pentru castigarea rundei.", TAG)
			}
			
			new Team = get_user_team(user);
			if(Team == 1)
				cs_set_user_team(user, CS_TEAM_CT);
			if(Team == 2)
				cs_set_user_team(user, CS_TEAM_T);
		}
		return PLUGIN_HANDLED;
	}
	else if(equal(textmsg, "#Bomb_Planted"))
	{
		set_hudmessage(random(255), random(255), random(255), -1.0, 0.15, 1, 5.1, 5.0)
		ShowSyncHudMsg(0, event_hud, "Furienii au plantat bomba cu plasma !")
		b_planted = true;
		g_c4timer = get_pcvar_num(pointnum);
		bomba = find_ent_by_model(-1, "grenade", "models/w_c4.mdl")
		if(pev_valid(bomba))
		{
			plasma_bomb_effects(bomba)
			engfunc(EngFunc_SetModel, bomba, plasma_bomb[2])
			emit_sound(bomba, CHAN_ITEM, misc_sound_wav[5], 1.0, ATTN_NORM, 0, PITCH_NORM)
			set_task(1.0, "plasma_bomb_effects", bomba+652450, "", 0, "b")
		}
		return PLUGIN_HANDLED;
	}
	else if(equal(textmsg, "#Game_bomb_drop"))
	{
		static nume[32];
		get_msg_arg_string(3, nume, charsmax(nume) - 1)
		set_hudmessage(random(255), random(255), random(255), -1.0, 0.15, 1, 3.1, 3.0)
		ShowSyncHudMsg(0, event_hud, "%s a scapat bomba cu plasma !", nume)
		return PLUGIN_HANDLED;
	}
	else if(equal(textmsg, "#Game_bomb_pickup"))
	{
		static nume[32];
		get_msg_arg_string(3, nume, charsmax(nume) - 1)
		set_hudmessage(random(255), random(255), random(255), -1.0, 0.15, 1, 3.1, 3.0)
		ShowSyncHudMsg(0, event_hud, "%s a ridicat bomba cu plasma !", nume)
		return PLUGIN_HANDLED;
	}
	else if(equal(textmsg, "#Got_bomb"))
		set_msg_arg_string(2, "Ai ridicat bomba de plasma.")
	else if(equal(textmsg, "#Hint_spotted_a_friend"))
		return PLUGIN_HANDLED;
	else if(equal(textmsg, "#Hint_spotted_an_enemy"))
		return PLUGIN_HANDLED;
	else if(equal(textmsg, "#Hint_press_buy_to_purchase"))
		return PLUGIN_HANDLED;
	else if(equal(textmsg, "#Name_change_at_respawn"))
		set_msg_arg_string(2, "Numele tau va fi schimbat runda viitoare.")
	else if(equal(textmsg, "#Spec_Duck"))
		return PLUGIN_HANDLED;
	else if(equal(textmsg, "#Weapon_Cannot_Be_Dropped"))
		set_msg_arg_string(2, "Aceasta arma nu poate fi aruncata.")
	else if(equal(textmsg, "#Round_Draw"))
	{
		set_hudmessage(random(255), random(255), random(255), -1.0, 0.15, 1, 5.1, 5.0)
		ShowSyncHudMsg(0, event_hud, "Round Draw!")
		ScreenFade(0, 0, 0)
		return PLUGIN_HANDLED;
	}
	else if(equal(textmsg, "#Target_Bombed"))
	{
		set_hudmessage(220, 30, 0, -1.0, 0.15, 1, 5.1, 5.0)
		ShowSyncHudMsg(0, event_hud, "Bomba cu plasma a explodat.")
		ScreenFade(0, 0, 0)
		b_planted = false
		sound_stop()
		remove_task(652450)
		PlaySound(events_sound_wav[0])
		for(new user = 1; user <= g_iMaxPlayers; user++)
		{
			if(!IsPlayer(user))
				continue
				
			if(get_user_team(user) == 1)
			{
				g_money[user] += 50
				color(user, ".v%s.g Ai castigat.e 5$.g pentru castigarea rundei.", TAG)
			}
		}
		return PLUGIN_HANDLED;
	}
	else if(equal(textmsg, "#Target_Saved"))
	{
		set_hudmessage(0, 30, 220, -1.0, 0.15, 1, 5.1, 5.0)
		ShowSyncHudMsg(0, event_hud, "Locurile unde se pot planta bombele cu plasma^nau fost salvate !")
		sound_stop()
		PlaySound(events_sound_wav[2])
		for(new user = 1; user <= g_iMaxPlayers; user++)
		{
			if(!IsPlayer(user))
				continue
				
			if(get_user_team(user) == 2)
			{

				g_money[user] += 50
				color(user, ".v%s.g Ai castigat.e 50$.g pentru castigarea rundei.", TAG)
			}
			
			new Team = get_user_team(user);
			if(Team == 1)
				cs_set_user_team(user, CS_TEAM_CT);
			if(Team == 2)
				cs_set_user_team(user, CS_TEAM_T);
		}
		return PLUGIN_HANDLED;
	}
	else if(equal(textmsg, "#Hostages_Not_Rescued"))
		return PLUGIN_HANDLED;

	return PLUGIN_CONTINUE;
}

public sound_emit(id, channel, const sound[])
{
	if(sound[8] == 'c' && sound[9] == '4')
		return FMRES_SUPERCEDE;
	
	return FMRES_IGNORED;
}

public menu_weapons(id)
{
	static menu;
	menu = menu_create("\ySelecteaza-ti arma:", "guns_handler")
	menu_additem(menu, "\yArma noua", "")
	if(g_gunsselect[id] == 0)
		menu_additem(menu, "\dArma anterioara", "")
	else
		menu_additem(menu, "\yArma anterioara", "")
	if(g_gunsselect[id] == 0)
		menu_additem(menu, "\dArma anterioara [+AUTOMAT DATA VIITOARE]", "")
	else
		menu_additem(menu, "\yArma anterioara [+AUTOMAT DATA VIITOARE]", "")
	menu_display(id, menu, 0)
}

public guns_handler(id, menu, item)
{
	if(!is_user_alive(id))
		return;
		
	if(get_user_team(id) != 2)
		return

	switch(item)
	{
		case 0:
		{
			g_gunsselect[id] = 1
			primary_weap(id)
		}
		case 1:
		{
			if(g_gunsselect[id] == 0)
				menu_weapons(id)
			else
			{
				g_gunsselect[id] = 2
				set_guns(id)
			}
		}
		case 2:
		{
			if(g_gunsselect[id] == 0)
				menu_weapons(id)
			else
			{
				g_gunsselect[id] = 3
				set_guns(id)
			}
		}
	}
}

public primary_weap(id)
{
	if(!is_user_alive(id) || get_user_team(id) != 2)
		return
	
	static menu_head[128], menu_item[128], tasta[2];
	formatex(menu_head, charsmax(menu_head), "Selecteaza arma primara:")
	new menu = menu_create(menu_head, "primary_handled")
	for(new i = 1; i < sizeof PRIMARY_NAME; i++)
	{
		formatex(menu_item, charsmax(menu_item), "\y%s", PRIMARY_NAME[i])
		tasta[0] = i
		tasta[1] = 0
		menu_additem(menu, menu_item, tasta)
	}
	if(pev_valid(id) == PDATA_SAFE)
		set_pdata_int(id, OFFSET_CSMENUCODE, 0, OFFSET_LINUX)
	
	menu_display(id, menu, 0)
}

public primary_handled(id, menu, item)
{
	if(!is_user_alive(id) || get_user_team(id) != 2)
		return PLUGIN_HANDLED;
		
	if(item == MENU_EXIT)
    {
        menu_destroy(menu);
        return PLUGIN_HANDLED;
    }
	if(item >= sizeof PRIMARY_NAME) return PLUGIN_HANDLED;
	
	g_primary_select[id] = item + 1
	menu_destroy(menu)
	secondary_weap(id)
	return PLUGIN_HANDLED;
}

public secondary_weap(id)
{
	if(!is_user_alive(id) || get_user_team(id) != 2)
		return
	
	static menu_head[128], menu_item[128], tasta[2];
	formatex(menu_head, charsmax(menu_head), "Selecteaza arma secundara:")
	new menu = menu_create(menu_head, "secondary_handled")
	for(new i = 1; i < sizeof SECONDARY_NAME; i++)
	{
		formatex(menu_item, charsmax(menu_item), "\y%s", SECONDARY_NAME[i])
		tasta[0] = i
		tasta[1] = 0
		menu_additem(menu, menu_item, tasta)
	}
	if(pev_valid(id) == PDATA_SAFE)
		set_pdata_int(id, OFFSET_CSMENUCODE, 0, OFFSET_LINUX)
	menu_display(id, menu, 0)
}

public secondary_handled(id, menu, item)
{
	if(!is_user_alive(id) || get_user_team(id) != 2)
		return PLUGIN_HANDLED;
		
	if(item == MENU_EXIT)
    {
        menu_destroy(menu);
        return PLUGIN_HANDLED;
    }
	
	if(item >= sizeof SECONDARY_NAME) return PLUGIN_HANDLED;
	
	g_secondary_select[id] = item + 1
	menu_destroy(menu)
	set_guns(id)
	return PLUGIN_HANDLED;
}

public set_guns(id)
{
	if(!is_user_alive(id) || get_user_team(id) != 2)
		return;
		
	ham_give_weapon(id, wp_give_primary[g_primary_select[id]])
	cs_set_user_bpammo(id, bullets_primary[g_primary_select[id]], 250)
	ham_give_weapon(id, wp_give_secondary[g_secondary_select[id]])
	cs_set_user_bpammo(id, bullets_secondary[g_secondary_select[id]], 250)
	g_cmdguns[id] = true
}

public new_round()
{
	if(g_firstround)
	{
		set_hudmessage(random(255), random(255), random(255), -1.0, 0.15, 1, 5.1, 5.0)
		ShowSyncHudMsg(0, event_hud, "Inca asteptam jucatorii sa se conecteze.")
		return;
	}
	
	remove_task(TASK_CANPLANT)
	g_endround = false
	new Float: flTime = get_cvar_num("mp_freezetime") + (get_cvar_num("mp_roundtime") * 60) - 60.0; 
	set_task(flTime, "task_CanPlant", TASK_CANPLANT)
	g_dontdelete = false
	remove_task(TASK_REMOVEC4)
	delete_c4()
	set_task(2.0, "delete_c4", TASK_REMOVEC4, _, _, "b")
	set_lights("g")
	g_ModelChangeTargetTime = get_gametime() + ROUNDSTART_DELAY
	g_c4timer = -1;
	b_planted = false;
	g_rounds++
	color(0, ".v%s.g Apasa tasta.e M.g pentru afisarea meniului de joc.", TAG)
	SecondsUntillInvasion = 5
	if(active_fog)
		msg_create_fog(20, 200, 50, 1)
	set_task(0.1, "CountDown")
	set_hudmessage(random(255), random(255), random(255), -1.0, 0.15, 1, 5.1, 5.0)
	ShowSyncHudMsg(0, event_hud, "Pregateste-te de lupta!^nRunda %d.", g_rounds)
	set_task(5.2, "start_ambience")
	static entid = FM_NULLENT
	while((entid = fm_find_ent_by_class(entid, ClassName)))
		fm_remove_entity(entid)
	while((entid = fm_find_ent_by_class(entid, "bat")))
		fm_remove_entity(entid)
	remove_task(TASK_SPAWN)
	g_bSpawnCheckEnabled = true
	static player
	for(player = 1; player <= g_iMaxPlayers; player++)
	{
		reset_vars(player)
		HasTeleport[player] = false
		if(task_exists(player+TASK_MODELCHANGE))
		{
			remove_task(player+TASK_MODELCHANGE)
			fm_cs_user_model_update(player+TASK_MODELCHANGE)
		}
	}
	set_task(120.0, "TaskDisableSpawnCheck", TASK_SPAWN)
}

public kill_pet(id)
{
	if(pev_valid(item_pet[id]))
	{
		set_pev(item_pet[id],pev_sequence,pet_die)
		set_pev(item_pet[id],pev_gaitsequence,pet_die)
		set_pev(item_pet[id],pev_framerate,1.0)
		
		set_pev(item_pet[id],PET_FLAG,PET_KILLED)
		
		engfunc(EngFunc_DropToFloor, item_pet[id])
		
		g_pet[id] = false
	}	
	item_pet[id] = 0
}

public TaskDisableSpawnCheck()
	g_bSpawnCheckEnabled = false;
	
public FM_MagicEntityThink(iEnt)
{
	if(iEnt != g_iMagicEntity || !pev_valid(iEnt))
		return FMRES_IGNORED;
		
	set_pev(iEnt, pev_nextthink, get_gametime() + 1.0)
	static iPlayers[32];
	static iPlayersNum;
	
	get_players(iPlayers, iPlayersNum, "ce", "CT")
	if(!iPlayersNum)
		return FMRES_IGNORED;
		
	static id, i;
	for(i = 0; i < iPlayersNum; i++)
	{
		id = iPlayers[i];
		
		if(IsPlayer(id))
		{
			if(is_user_alive(id))
			{
				pev(id, pev_origin, g_fUserOrigin[id]);
					
				if(g_fUserOrigin[id][0] == g_fUserOldOrigin[id][0]
					&& g_fUserOrigin[id][1] == g_fUserOldOrigin[id][1]
					&& g_fUserOrigin[id][2] == g_fUserOldOrigin[id][2])
				{
					g_iUserCampSeconds[id]++;
					if(g_iUserCampSeconds[id] == 5)
						g_bUserIsCamping[id] = true;
					
					else if(g_iUserCampSeconds[id] > 5 && g_bSpawnCheckEnabled)
					{
						if(g_iUserCampSeconds[id] == 11)
						{
							color(0, ".v%s.e %s.g a primit slay pentru ca a campat sau e afk !", TAG, get_name(id))
							
							user_silentkill(id);
							
							g_bUserIsCamping[id] = false;
							g_iUserCampSeconds[id] = 0;
							
						}
						else
							color(id, ".v%s.g Vei primi slay in.e %i.g secund%s daca nu te misti !", TAG, 11 - g_iUserCampSeconds[id], (11 - g_iUserCampSeconds[id]) == 1 ? "a" : "e")
					}
				}
	
				else if(g_fUserOrigin[id][0] != g_fUserOldOrigin[id][0]
					|| g_fUserOrigin[id][1] != g_fUserOldOrigin[id][1]
					|| g_fUserOrigin[id][2] != g_fUserOldOrigin[id][2]) 
				{
					
					g_iUserCampSeconds[id] = 0;
					g_bUserIsCamping[id] = false;
				}
			}
		}
		g_fUserOldOrigin[id][0] = g_fUserOrigin[id][0];
		g_fUserOldOrigin[id][1] = g_fUserOrigin[id][1];
		g_fUserOldOrigin[id][2] = g_fUserOrigin[id][2];
	}
	return FMRES_IGNORED;
}

public end_round()
{
	for(new id; id <= 32; id++)
	{
		remove_task(id+TASK_AFFECT)
		if(is_user_alive(id) && !savior[id] && !destroyer[id])
			g_end_health[id] = get_user_health(id)
		if(is_user_alive(id))
		{
			set_user_godmode(id, 1)
			client_cmd(id, "+jump;-jump")
			ExecuteHamB(Ham_Player_ResetMaxSpeed, id)
		}
	}
	g_c4timer = -1;
	g_endround = true
}

public first_round()
{
	restart_seconds--
	if(restart_seconds > 0)
		g_firstround = true
	else
	{
		server_cmd("sv_restart 1")
		g_firstround = false
		return;
	}
	set_hudmessage(85, 255, 170, 0.0, 0.19, 1, 1.1, 1.0)
	show_hudmessage(0, "Asteptam ca toti jucatorii sa se conecteze.^n%d secund%s ramas%s.", restart_seconds, restart_seconds < 2 ? "a" : "e", restart_seconds < 2 ? "a" : "e")
}

public think_grenade(ent)
{
	if(!pev_valid(ent))
		return HAM_IGNORED;
	
	static Float:dmgtime, Float:current_time
	pev(ent, pev_dmgtime, dmgtime)
	current_time = get_gametime()
	
	if(dmgtime > current_time)
		return HAM_IGNORED;
	
	switch(pev(ent, PEV_NADE_TYPE))
	{
		case NADE_TYPE_NAPALM:
		{
			fire_explode(ent)
			return HAM_SUPERCEDE;
		}
		case NADE_TYPE_FROST:
		{
			frost_explode(ent)
			return HAM_SUPERCEDE;
		}
		case NADE_TYPE_CRAZY:
		{
			crazy_explode(ent)
			return HAM_SUPERCEDE;
		}
		case NADE_TYPE_KILL:
		{
			if (entity_get_int(ent, EV_INT_movetype) != MOVETYPE_BOUNCEMISSILE)
				return HAM_IGNORED
			
			if (entity_get_float(ent, EV_FL_dmgtime) > get_gametime() + 2.5)
			{
				entity_set_float(ent, EV_FL_dmgtime, get_gametime() + 2.5)
			}
			
			new owner = pev(ent, pev_owner)
			new Float:origin[3]
			entity_get_vector(ent, EV_VEC_origin, origin)
			
			if (entity_get_float(ent, EV_FL_dmgtime) < get_gametime() || !is_user_connected(owner) || is_user_connecting(owner))
			{
				clear_beamfollow(ent)
				entity_set_int(ent, EV_INT_flags, FL_KILLME)
				metal_gibs(origin)
				
				return HAM_SUPERCEDE
			}
			
			new team = _:cs_get_user_team(owner)
			
			new target, Float:velocity[3], oldtarget
			target = entity_get_edict(ent, EV_ENT_euser2)
			oldtarget = entity_get_edict(ent, EV_ENT_euser3)
			
			if (target == owner)
			{
				target = 0
				entity_set_edict(ent, EV_ENT_euser2, 0)
			}
			
			if (target == 0)
			{
				entity_get_vector(ent, EV_VEC_velocity, velocity)
				
				if (xs_vec_len(velocity) < 200.0)
				{
					xs_vec_mul_scalar(velocity, xs_vec_len(velocity) + 50.0, velocity)
					entity_set_vector(ent, EV_VEC_velocity, velocity)
				}
				
				new i = -1, Float:distance = 300.0, Float:junk[3], targetteam
				
				while ((i = find_ent_in_sphere(i, origin, distance)))
				{
					if (i > g_iMaxPlayers)
						break
					
					if (i == owner)
						continue
					
					if (i == oldtarget)
						continue
					
					if (!is_user_connected(i) || is_user_connecting(i))
						continue
					
					if (!is_user_alive(i))
						continue
					
					targetteam = _:cs_get_user_team(i)
					
					if ((team != targetteam && targetteam != _:CS_TEAM_SPECTATOR && targetteam != _:CS_TEAM_UNASSIGNED))
					{
						static Float:o[3]
						entity_get_vector(i, EV_VEC_origin, o)
						entity_get_vector(i, EV_VEC_view_ofs, junk)
						xs_vec_add(o, junk, o)
						static Float:new_distance
						new_distance = get_distance_f(o, origin)
						
						if (new_distance < distance)
						{
							distance = new_distance
							entity_set_edict(ent, EV_ENT_euser2, i)
						}
					}
				}
				
				if (entity_range(owner, ent) < distance && entity_get_int(ent, EV_INT_iuser2) > 0)
				{
					entity_set_edict(ent, EV_ENT_euser2, owner)
				}
				
				entity_set_float(ent, EV_FL_nextthink, get_gametime() + 0.02)
				
				return HAM_SUPERCEDE
			}
			else if (!is_user_alive(target))
			{
				entity_get_vector(ent, EV_VEC_velocity, velocity)
				
				if (xs_vec_len(velocity) < 200.0)
				{
					xs_vec_mul_scalar(velocity, xs_vec_len(velocity) + 50.0, velocity)
					entity_set_vector(ent, EV_VEC_velocity, velocity)
				}
				
				entity_set_edict(ent, EV_ENT_euser2, 0)
				entity_set_float(ent, EV_FL_nextthink, get_gametime() + 0.02)
				return HAM_SUPERCEDE
			}
			else
			{
				new Float:aim[3], Float:targetorigin[3], Float:velocity_normal[3], Float:aim_normal[3]
				
				entity_get_vector(target, EV_VEC_origin, targetorigin)
				
				xs_vec_add(targetorigin, Float:{0.0, 0.0, 30.0}, targetorigin)
				
				if (!is_point_visible(origin, targetorigin, ent))
				{
					entity_set_edict(ent, EV_ENT_euser2, 0)
					entity_set_float(ent, EV_FL_nextthink, get_gametime() + 0.02)
					return HAM_SUPERCEDE
				}
				
				xs_vec_sub(targetorigin, origin, aim)
				
				if (xs_vec_len(aim) <= 100.0)
				{
					xs_vec_mul_scalar(aim, 800.0/xs_vec_len(aim), aim)
					
					entity_set_vector(ent, EV_VEC_velocity, aim)
					
					if (target == owner && get_distance_f(targetorigin, origin) <= 1.0)
					{
						new Float:torigin[3]
						entity_get_vector(owner, EV_VEC_origin, torigin)
						blood(torigin)
						set_pdata_int(owner, OFFSET_LAST_HIT_GROUP, HIT_HEAD, 5)
						ExecuteHamB(Ham_TakeDamage, owner, ent, owner, 135.0, DMG_CS_BULLETS_KNIFE)
						entity_set_edict(ent, EV_ENT_euser2, 0)
						entity_set_edict(ent, EV_ENT_euser3, owner)
						
						new color[3] , impacts
						color[0] = 165
						color[1] = 45
						color[2] = 45
						
						create_blast(origin, color)
						
						impacts = entity_get_int(ent, EV_INT_iuser2)
						
						impacts++
						
						entity_set_int(ent, EV_INT_iuser2, impacts)
						
						if (impacts >= 1)
						{
							clear_beamfollow(ent)
							entity_set_int(ent, EV_INT_flags, FL_KILLME)
							metal_gibs(origin)
						}
					}
					
					entity_set_float(ent, EV_FL_nextthink, get_gametime() + 0.02)
					return HAM_SUPERCEDE
				}
				
				entity_get_vector(ent, EV_VEC_velocity, velocity)
				
				xs_vec_sub(targetorigin, origin, aim)
				
				xs_vec_normalize(velocity, velocity_normal)
				xs_vec_normalize(aim, aim_normal)
				
				if (xs_vec_len(velocity) < 200.0)
				{
					xs_vec_mul_scalar(velocity, xs_vec_len(velocity) + 50.0, velocity)
				}
				
				if (xs_vec_dot(aim_normal, velocity_normal) < 0)
				{
					entity_set_edict(ent, EV_ENT_euser2, 0)
					entity_set_float(ent, EV_FL_nextthink, get_gametime() + 0.02)
					entity_set_vector(ent, EV_VEC_velocity, velocity)
					return HAM_SUPERCEDE
				}
				
				if (velocity_normal[0] < aim_normal[0])
				{
					velocity[0] += 150.0
				}
				else if (velocity_normal[0] > aim_normal[0])
				{
					velocity[0] -= 150.0
				}
				
				if (velocity_normal[1] < aim_normal[1])
				{
					velocity[1] += 150.0
				}
				else if (velocity_normal[1] > aim_normal[1])
				{
					velocity[1] -= 150.0
				}
				
				if (velocity_normal[2] < aim_normal[2])
				{
					velocity[2] += 25.0
				}
				else if (velocity_normal[2] > aim_normal[2])
				{
					velocity[2] -= 25.0
				}
				
				velocity[2] += 5.0
				
				entity_set_vector(ent, EV_VEC_velocity, velocity)
			}
			
			entity_set_float(ent, EV_FL_nextthink, get_gametime() + 0.02)
			return HAM_SUPERCEDE
		}
	}
	return HAM_IGNORED;
}

public crazy_explode(entity)
{
	if(!pev_valid(entity))
		return
	
	static Float:origin[3];
	pev(entity, pev_origin, origin)
	create_blast4(origin)
	emit_sound(entity, CHAN_WEAPON, explosion_sound, VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
	static victim 
	victim = -1
	
	while((victim = engfunc (EngFunc_FindEntityInSphere, victim, origin, 250.0)) != 0)
	{
		if (!is_user_alive(victim) || get_user_team(victim) != 1)
			continue
			
		if(!task_exists(victim+TASK_AFFECT)) 
			set_task(0.2, "affect_victim", victim+TASK_AFFECT, _, _, "a", 30)
	}
	engfunc(EngFunc_RemoveEntity, entity)
}

create_blast4(const Float:originF[3])
{
	engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, originF, 0)
	write_byte(TE_BEAMCYLINDER)
	engfunc(EngFunc_WriteCoord, originF[0])
	engfunc(EngFunc_WriteCoord, originF[1])
	engfunc(EngFunc_WriteCoord, originF[2])
	engfunc(EngFunc_WriteCoord, originF[0])
	engfunc(EngFunc_WriteCoord, originF[1])
	engfunc(EngFunc_WriteCoord, originF[2]+470.0)
	write_short(beam_effect)
	write_byte(0)
	write_byte(0)
	write_byte(4)
	write_byte(60)
	write_byte(0)
	write_byte(50)
	write_byte(70)
	write_byte(100)
	write_byte(200)
	write_byte(0)
	message_end()
	
	engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, originF, 0)
	write_byte(TE_BEAMCYLINDER)
	engfunc(EngFunc_WriteCoord, originF[0])
	engfunc(EngFunc_WriteCoord, originF[1])
	engfunc(EngFunc_WriteCoord, originF[2])
	engfunc(EngFunc_WriteCoord, originF[0])
	engfunc(EngFunc_WriteCoord, originF[1])
	engfunc(EngFunc_WriteCoord, originF[2]+555.0)
	write_short(beam_effect)
	write_byte(0)
	write_byte(0)
	write_byte(4)
	write_byte(60)
	write_byte(0)
	write_byte(50)
	write_byte(70)
	write_byte(100)
	write_byte(200)
	write_byte(0)
	message_end()
	
	engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, originF, 0)
	write_byte(TE_DLIGHT)
	engfunc(EngFunc_WriteCoord, originF[0])
	engfunc(EngFunc_WriteCoord, originF[1])
	engfunc(EngFunc_WriteCoord, originF[2])
	write_byte(50)
	write_byte(50)
	write_byte(70)
	write_byte(100)
	write_byte(30)
	write_byte(30)
	message_end()

	engfunc(EngFunc_MessageBegin, MSG_BROADCAST,SVC_TEMPENTITY, originF, 0)
	write_byte(TE_EXPLOSION)
	engfunc(EngFunc_WriteCoord, originF[0])
	engfunc(EngFunc_WriteCoord, originF[1])
	engfunc(EngFunc_WriteCoord, originF[2]+75)
	write_short(crazyexp)
	write_byte(17)
	write_byte(15)
	write_byte(TE_EXPLFLAG_NOSOUND)
	message_end();	
	
	engfunc(EngFunc_MessageBegin, MSG_BROADCAST,SVC_TEMPENTITY, originF, 0)
	write_byte(TE_SPRITETRAIL)
	engfunc(EngFunc_WriteCoord, originF[0])
	engfunc(EngFunc_WriteCoord, originF[1])
	engfunc(EngFunc_WriteCoord, originF[2] + 40)
	engfunc(EngFunc_WriteCoord, originF[0])
	engfunc(EngFunc_WriteCoord, originF[1])
	engfunc(EngFunc_WriteCoord, originF[2])
	write_short(crazygib)
	write_byte(30)
	write_byte(10)
	write_byte(2)
	write_byte(50)
	write_byte(10)
	message_end();
}

public affect_victim(taskid)
{
	if(g_endround)
		return;
	
	if(!is_user_alive(ID_AFFECT) || get_user_team(ID_AFFECT) != 1)
		return
		
	message_begin(MSG_ONE_UNRELIABLE, g_msgScreenFade, {0,0,0}, ID_AFFECT)
	write_short(1<<13)
	write_short(1<<14)
	write_short(0x0000)
	write_byte(random_num(50, 200))
	write_byte(random_num(50, 200))
	write_byte(random_num(50, 200))
	write_byte(random_num(50, 200))
	message_end()
		
	message_begin(MSG_ONE_UNRELIABLE, g_screenshake, {0,0,0}, ID_AFFECT)
	write_short(0xFFFF)
	write_short(1<<13)
	write_short(0xFFFF)
	message_end()
	remove_task(ID_AFFECT)
}

public set_model(entity, const model[])
{
	if(strlen(model) < 8)
		return FMRES_IGNORED;

	if(model[7] != 'w' || model[8] != '_')
		return FMRES_IGNORED;
	
	static Float:dmgtime
	pev(entity, pev_dmgtime, dmgtime)
	
	if(get_user_team(pev(entity, pev_owner)) == 1)
	{
		if(dmgtime == 0.0)
			return FMRES_IGNORED;
		if(model[9] == 'h' && model[10] == 'e')
		{
			message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
			write_byte(TE_BEAMFOLLOW)
			write_short(entity)
			write_short(trail_spr)
			write_byte(15)
			write_byte(10)
			write_byte(200)
			write_byte(20)
			write_byte(10)
			write_byte(200)
			message_end()
			set_pev(entity, PEV_NADE_TYPE, NADE_TYPE_NAPALM)
			fm_set_rendering(entity, kRenderFxGlowShell, 200, 20, 10, kRenderNormal, 18)
			entity_set_model(entity, w_grenade_furien[0])
			return FMRES_SUPERCEDE;
		}
		else if(model[9] == 'f' && model[10] == 'l')
		{
			message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
			write_byte(TE_BEAMFOLLOW)
			write_short(entity)
			write_short(trail_spr)
			write_byte(15)
			write_byte(10)
			write_byte(10)
			write_byte(20)
			write_byte(200)
			write_byte(200)
			message_end()
			set_pev(entity, PEV_NADE_TYPE, NADE_TYPE_FROST)
			fm_set_rendering(entity, kRenderFxGlowShell, 10, 20, 200, kRenderNormal, 18)
			entity_set_model(entity, w_grenade_furien[1])
			return FMRES_SUPERCEDE;
		}
		else if(model[9] == 's' && model[10] == 'm')
		{
			if(have_killnade[pev(entity, pev_owner)])
			{
				message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
				write_byte(TE_BEAMFOLLOW)
				write_short(entity)
				write_short(trail_spr)
				write_byte(15)
				write_byte(15)
				write_byte(165)
				write_byte(45)
				write_byte(45)
				write_byte(200)
				message_end()
				set_pev(entity, PEV_NADE_TYPE, NADE_TYPE_KILL)
				entity_set_int(entity, EV_INT_movetype, MOVETYPE_BOUNCEMISSILE)
				entity_set_int(entity, EV_INT_iuser2, 0)
				entity_set_edict(entity, EV_ENT_euser2, 0)
				entity_set_size(entity, Float:{-2.0,-4.0,-2.0}, Float:{2.0, 4.0, 2.0})
				fm_set_rendering(entity, kRenderFxGlowShell, 165, 45, 45, kRenderNormal, 18)
				entity_set_float(entity, EV_FL_dmgtime, get_gametime() + 2.5)
				entity_set_model(entity, w_grenade_furien[2])
				have_killnade[pev(entity, pev_owner)] = false
				return FMRES_SUPERCEDE;
			}
			return FMRES_IGNORED;
		}
		return FMRES_IGNORED;
	}
	else
	{
		if(model[9] == 'h' && model[10] == 'e')
		{
			if(dmgtime == 0.0)
				return FMRES_IGNORED;
			message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
			write_byte(TE_BEAMFOLLOW)
			write_short(entity)
			write_short(trail_spr)
			write_byte(15)
			write_byte(10)
			write_byte(100)
			write_byte(50)
			write_byte(70)
			write_byte(200)
			message_end()
			fm_set_rendering(entity, kRenderFxGlowShell, 100, 50, 70, kRenderNormal, 18)
		}
		else if(model[9] == 'f' && model[10] == 'l')
		{
			if(dmgtime == 0.0)
				return FMRES_IGNORED;
			message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
			write_byte(TE_BEAMFOLLOW)
			write_short(entity)
			write_short(trail_spr)
			write_byte(15)
			write_byte(10)
			write_byte(200)
			write_byte(200)
			write_byte(200)
			write_byte(200)
			message_end()
			fm_set_rendering(entity, kRenderFxGlowShell, 200, 200, 200, kRenderNormal, 18)
		}
		else if(model[9] == 's' && model[10] == 'm')
		{
			if(dmgtime == 0.0)
				return FMRES_IGNORED;
			message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
			write_byte(TE_BEAMFOLLOW)
			write_short(entity)
			write_short(trail_spr)
			write_byte(15)
			write_byte(10)
			write_byte(50)
			write_byte(70)
			write_byte(100)
			write_byte(200)
			message_end()
			set_pev(entity, PEV_NADE_TYPE, NADE_TYPE_CRAZY)
			fm_set_rendering(entity, kRenderFxGlowShell, 50, 70, 100, kRenderNormal, 18)
		}
		else
			fm_set_rendering(entity, kRenderFxGlowShell, random(256), random(256), random(256), kRenderNormal, 18)
	}
	return FMRES_IGNORED;
}

public CWeaponBox_Touch(iWeaponBox, id)
{
	if(IsPlayer(id))
	{
		if(!is_user_alive(id))
			return HAM_SUPERCEDE

		if(IsWeaponBoxC4(iWeaponBox))
			return HAM_IGNORED

		if(get_user_team(id) == 1)
			return HAM_SUPERCEDE
		return HAM_IGNORED
	}
	return HAM_IGNORED
}

public GroundWeapon_Touch(iWeapon, id)
{
	if(IsPlayer(id))
	{
		if(!is_user_alive(id))
			return HAM_SUPERCEDE

		if(get_user_team(id) == 1)
			return HAM_SUPERCEDE
		return HAM_IGNORED
	}
	return HAM_IGNORED
}

public game_menu(id)
{
	if(get_user_team(id) == 3)
		return PLUGIN_CONTINUE;
	
	static menu_title[150], menu;
	formatex(menu_title, charsmax(menu_title), "\yFurien Mod Remaked" )
	menu = menu_create(menu_title, "gmenu_handler")
	static menu_item[150];
	static izStats[8], izBody[8], iRankPos, iRankMax;
	iRankPos = get_user_stats(id, izStats, izBody)
	iRankMax = get_statsnum()
	if(get_user_team(id) != 2 || !is_user_alive(id))
		formatex(menu_item, charsmax(menu_item), "\dMeniu Arme")
	else
	{
		if(g_cmdguns[id] && g_gunsselect[id] == 0)
			formatex(menu_item, charsmax(menu_item), "\dMeniu Arme [FOLOSIT | NU ESTE AUTOMAT]")
		else if(g_cmdguns[id] && g_gunsselect[id] == 1)
			formatex(menu_item, charsmax(menu_item), "\dMeniu Arme [FOLOSIT | NU ESTE AUTOMAT]")
		else if(g_cmdguns[id] && g_gunsselect[id] == 2)
			formatex(menu_item, charsmax(menu_item), "\dMeniu Arme [FOLOSIT | ALES DE RUNDA TRECUTA]")
		else if(g_cmdguns[id] && g_gunsselect[id] == 3)
			formatex(menu_item, charsmax(menu_item), "\dMeniu Arme [FOLOSIT | AUTOMAT]")
		else if(!g_cmdguns[id])
			formatex(menu_item, charsmax(menu_item), "\yMeniu Arme\r [NEFOLOSIT]")
	}
	menu_additem(menu, menu_item, "")
	if(!is_user_alive(id))
		formatex(menu_item, charsmax(menu_item), "\dMeniu Shop [%i$]", g_money[id])
	else
		formatex(menu_item, charsmax(menu_item), "\yMeniu Shop\r [%i$]", g_money[id])
	menu_additem(menu, menu_item, "")
	if(!(get_user_flags(id) & VIP_FLAG))
		formatex(menu_item, charsmax(menu_item), "\dOpen VIP Shop")
	else
		formatex(menu_item, charsmax(menu_item), "\yOpen VIP Shop")
	menu_additem(menu, menu_item, "")
	formatex(menu_item, charsmax(menu_item), "\yRank:\r [%d\y/\r %d]^nTotal:\r [%d\y UCIDERI |\r %d\y DECESE]", iRankPos, iRankMax, izStats[0], izStats[1])
	menu_additem(menu, menu_item, "")
	formatex(menu_item, charsmax(menu_item), "\yTop Rank\r Players")
	menu_additem(menu, menu_item, "")
	formatex(menu_item, charsmax(menu_item), "\yTop 15\r Levels")
	menu_additem(menu, menu_item, "")
	if(get_user_flags(id) & ADMIN_SLAY)
		formatex(menu_item, charsmax(menu_item), "\yJoin Spectator")
	else
		formatex(menu_item, charsmax(menu_item), "\dJoin Spectator")
	menu_additem(menu, menu_item, "")
	menu_display(id, menu, 0)
	return PLUGIN_HANDLED;
}

public gmenu_handler(id, menu, item)
{
	switch(item)
	{
		case 0:
		{
			if(!is_user_alive(id))
			{
				color(id, ".v%s.g Trebuie sa fii in.e viata.g pentru acest meniu.", TAG)
				return PLUGIN_HANDLED;
			}
			
			if(get_user_team(id) != 2)
			{
				color(id, ".v%s.g Trebuie sa fii.e Anti-Furien.g pentru a folosi acest meniu.", TAG)
				return PLUGIN_HANDLED;
			}
			
			if(g_cmdguns[id] && g_gunsselect[id] == 0)
			{
				color(id, ".v%s.g Meniul tau este deja activat.g.", TAG)
				return PLUGIN_HANDLED;
			}
			else if(g_cmdguns[id] && g_gunsselect[id] == 1)
			{
				color(id, ".v%s.g Meniul tau este deja.e activat.g.", TAG)
				return PLUGIN_HANDLED;
			}
			else if(g_cmdguns[id] && g_gunsselect[id] == 2)
			{
				color(id, ".v%s.g Meniul tau este deja.e activat.g.", TAG)
				return PLUGIN_HANDLED;
			}
			else if(g_cmdguns[id] && g_gunsselect[id] == 3)
			{
				color(id, ".v%s.g Meniul tau a fost.e reactivat.g.", TAG)
				g_gunsselect[id] = 0
				return PLUGIN_HANDLED;
			}
			else if(!g_cmdguns[id])
			{
				color(id, ".v%s.g Meniul tau de.e arme.g este reafisat.", TAG)
				primary_weap(id)
				return PLUGIN_HANDLED;
			}
			return PLUGIN_HANDLED;
		}
		case 1:
		{
			if(!is_user_alive(id))
			{
				color(id, ".v%s.g Shopul poate fi folosit doar daca sunteti in viata.", TAG)
				return PLUGIN_HANDLED;
			}
			shop_enter(id)
			return PLUGIN_HANDLED;
		}
		case 2:
		{
			if(!is_user_connected(id))
				return PLUGIN_HANDLED;
			
			shop_menu(id)
			return PLUGIN_HANDLED;
		}
		case 3:
		{
			if(!is_user_connected(id))
				return PLUGIN_HANDLED;
			
			static izStats[8], izBody[8], iRankPos, iRankMax;
			iRankPos = get_user_stats(id, izStats, izBody)
			iRankMax = get_statsnum()
			color(0, ".v%s.e %s.g este pe locul.e %d/%d.g. Are.e %d.g ucideri si.e %d.g decese.", TAG, get_name(id), iRankPos, iRankMax, izStats[0], izStats[1])
			return PLUGIN_HANDLED;
		}
		case 4:
		{
			if(!is_user_connected(id))
				return PLUGIN_HANDLED;
				
			open_topmenu(id)
			return PLUGIN_HANDLED;
		}
		case 5:
		{
			if(!is_user_connected(id))
				return PLUGIN_HANDLED;

			show_top(id)
			return PLUGIN_HANDLED;
		}
		case 6:
		{
			if(get_user_flags(id) & ADMIN_SLAY)
			{
				if(is_user_alive(id))
					user_kill(id)
				cs_set_user_team(id, CS_TEAM_SPECTATOR)
				color(0, ".v%s.e %s.g s-a mutat spectator.", TAG, get_name(id))
				return PLUGIN_HANDLED;
			}
			else
			{
				color(id, ".v%s.g Nu ai acces la aceasta comanda.", TAG)
				return PLUGIN_HANDLED;
			}
			return PLUGIN_HANDLED;
		}
	}
	return PLUGIN_HANDLED;
}

public open_topmenu(id)
{
	new menu = menu_create("\yTop Rank Players", "topmenu_handler")
	new stats_taked[8], crap[8], player_name[32], temp_message[256], add_item_menu[4], max_pages, iRankMax = get_statsnum();
	
	if(iRankMax < 360)
		max_pages = iRankMax
	else
		max_pages = 360
	
	for(new page = 0; page < max_pages; page++) 
	{
		get_stats(page, stats_taked, crap, player_name, charsmax(player_name))
		num_to_str(page + 1, add_item_menu, charsmax(add_item_menu))
		format(temp_message, charsmax(temp_message), "\y%s\d R:\r %i\d K:\r %i\d D:\r %i", player_name, page + 1, stats_taked[0], stats_taked[1])
		menu_additem(menu, temp_message, add_item_menu, 0)
	}
	menu_display(id, menu, 0)
}

public topmenu_handler(id, menu, item)
	return PLUGIN_HANDLED;

public plasma_bomb_effects(c4)
{
	c4 -= 652450
	
	if(g_endround)
	{
		remove_task(c4+652450)
		return;
	}
	
	if(!b_planted)
	{
		remove_task(c4+652450)
		return;
	}
	
	if(!pev_valid(c4))
	{
		remove_task(c4+652450)
		return;
	}
	
	new Float:origini[3]
	pev(c4, pev_origin, origini)
	engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, origini, 0)
	write_byte(TE_BEAMCYLINDER)
	engfunc(EngFunc_WriteCoord, origini[0])
	engfunc(EngFunc_WriteCoord, origini[1])
	engfunc(EngFunc_WriteCoord, origini[2])
	engfunc(EngFunc_WriteCoord, origini[0])
	engfunc(EngFunc_WriteCoord, origini[1])
	engfunc(EngFunc_WriteCoord, origini[2]+400.0)
	write_short(beam_effect)
	write_byte(0)
	write_byte(0)
	write_byte(4)
	write_byte(10)
	write_byte(0)
	write_byte(random(256))
	write_byte(random(256))
	write_byte(random(256))
	write_byte(200)
	write_byte(0)
	message_end()
	
	engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, origini, 0)
	write_byte(TE_BEAMCYLINDER)
	engfunc(EngFunc_WriteCoord, origini[0])
	engfunc(EngFunc_WriteCoord, origini[1])
	engfunc(EngFunc_WriteCoord, origini[2])
	engfunc(EngFunc_WriteCoord, origini[0])
	engfunc(EngFunc_WriteCoord, origini[1])
	engfunc(EngFunc_WriteCoord, origini[2]+450.0)
	write_short(beam_effect)
	write_byte(0)
	write_byte(0)
	write_byte(4)
	write_byte(15)
	write_byte(0)
	write_byte(random(256))
	write_byte(random(256))
	write_byte(random(256))
	write_byte(200)
	write_byte(0)
	message_end()
	engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, origini, 0)
	write_byte(TE_BEAMCYLINDER)
	engfunc(EngFunc_WriteCoord, origini[0])
	engfunc(EngFunc_WriteCoord, origini[1])
	engfunc(EngFunc_WriteCoord, origini[2])
	engfunc(EngFunc_WriteCoord, origini[0])
	engfunc(EngFunc_WriteCoord, origini[1])
	engfunc(EngFunc_WriteCoord, origini[2]+550.0)
	write_short(beam_effect)
	write_byte(0)
	write_byte(0)
	write_byte(4)
	write_byte(25)
	write_byte(0)
	write_byte(random(256))
	write_byte(random(256))
	write_byte(random(256))
	write_byte(200)
	write_byte(0)
	message_end()
	
	fm_set_rendering(c4, kRenderFxGlowShell, random(255), random(255), random(255), kRenderNormal, 50)
	if(g_c4timer < 11)
	{
		static Float:coord[3];
		coord[0] = origini[0] + 150.0;
		coord[1] = origini[1] + 150.0;
		coord[2] = origini[2] + 800.0;
		create_thunder(coord, origini);
		if(active_fog)
			msg_create_fog(random(250), random(250), random(250), 3)
	}

	if(g_c4timer >= 0)
	{
		--g_c4timer;
		if(g_c4timer < 41 && g_c4timer > 13)
			emit_sound(c4, CHAN_ITEM, misc_sound_wav[3], 1.0, ATTN_NORM, 0, PITCH_NORM)
		else if(g_c4timer == 13)
		{
			emit_sound(c4, CHAN_ITEM, misc_sound_wav[4], 1.0, ATTN_NORM, 0, PITCH_NORM)
			set_lights("c")
		}
		set_dhudmessage(random(255), random(255), random(255), -1.0, 0.0, 1, 1.0, 1.0, 0.0, 0.0)
		if(g_c4timer > 0)
			show_dhudmessage(0, "%d secund%s ramas%s pana la explozie!", g_c4timer, g_c4timer < 2 ? "a" : "e", g_c4timer < 2 ? "a" : "e")
	}
}

public check_weapon(id)
{
	if(!is_user_alive(id))
		return;
		
	switch(get_user_team(id))
	{
		case 1:
		{
			switch(get_user_weapon(id))
			{
				case CSW_KNIFE:
				{
					if(g_superknife[id])
						set_pev(id, pev_viewmodel2, super_knife_furien)
					else
						set_pev(id, pev_viewmodel2, knife_furien)
				}
				case CSW_HEGRENADE: set_pev(id, pev_viewmodel2, v_grenade_furien[0])
				case CSW_FLASHBANG: set_pev(id, pev_viewmodel2, v_grenade_furien[1])
				case CSW_SMOKEGRENADE:
				{
					if(have_killnade[id])
						set_pev(id, pev_viewmodel2, v_grenade_furien[2])
				}
				case CSW_C4:
				{
					set_pev(id, pev_viewmodel2, plasma_bomb[1])
					set_pev(id, pev_weaponmodel2, plasma_bomb[0])
				}
			}
		}
		case 2:
		{
			if(g_ak47[id] && get_user_weapon(id) == CSW_AK47)
			{
				set_pev(id, pev_viewmodel2, v_ak47)
				set_pev(id, pev_weaponmodel2, p_ak47)
			}
			else if(g_m4a1[id] && get_user_weapon(id) == CSW_M4A1)
			{
				set_pev(id, pev_viewmodel2, v_m4a1)
				set_pev(id, pev_weaponmodel2, p_m4a1)
			}
			else if(g_deagle[id] && get_user_weapon(id) == CSW_DEAGLE)
			{
				set_pev(id, pev_viewmodel2, v_deagle)
				set_pev(id, pev_weaponmodel2, p_deagle)
			}
		}
	}
}

public msg_screenfade(msgid, dest, id)
{
	if(!IsPlayer(id))
		return PLUGIN_CONTINUE
	
	if(get_user_team(id) == 2 || !is_user_alive(id) || g_noflash[id])
	{
		static date[4]
		date[0] = get_msg_arg_int(4); date[1] = get_msg_arg_int(5)
		date[2] = get_msg_arg_int(6); date[3] = get_msg_arg_int(7)
		
		if(date[0] == 255 && date[1] == 255 && date[2] == 255 && date[3] > 199)
			return PLUGIN_HANDLED
	}
	return PLUGIN_CONTINUE
}

public ham_take_damage(vic, inf, att, Float:dmg, dmgbits)
{
	if(get_user_team(att) == 1 && g_superknife[att] && !(dmgbits & DMG_NADE))
		dmg *= 2.0
		
	if(is_user_alive(att) && get_user_team(att) == 2 && ((g_ak47[att] && get_user_weapon(att) == CSW_AK47) || (g_m4a1[att] && get_user_weapon(att) == CSW_M4A1) || (g_deagle[att] && get_user_weapon(att) == CSW_DEAGLE)))
		dmg *= 2.0
	
	SetHamParamFloat(4, dmg)
	
	if(is_user_alive(vic) && inf == bomba)
	{
		SetHamParamFloat(4, 0.0);
		return HAM_SUPERCEDE;
	}
	if((vic == att) && (dmgbits & DMG_NADE))
		return HAM_SUPERCEDE;
	return HAM_IGNORED;
}

public on_damage(id)
{
	static attacker; attacker = get_user_attacker(id)
	static damage; damage = read_data(2)		
	if(IsPlayer(attacker))
	{
		if(fm_is_ent_visible(attacker, id))
		{
			g_iPlayerPos[attacker] += 1
			if(g_iPlayerPos[attacker] == sizeof(g_flCoords))
				g_iPlayerPos[attacker] = 0		
			set_dhudmessage(random(256), random(256), random(256), Float:g_flCoords[g_iPlayerPos[attacker]][0], Float:g_flCoords[g_iPlayerPos[attacker]][1], 0, 0.1, 2.5, 0.02, 0.02)
			show_dhudmessage(attacker, "%i^n", damage)				
		}
	}
}

register_buy_cmd()
{
	register_clcmd("buy", "ClientCommand_Buy")
	register_clcmd("bUy", "ClientCommand_Buy")
	register_clcmd("buY", "ClientCommand_Buy")
	register_clcmd("bUY", "ClientCommand_Buy")
	register_clcmd("Buy", "ClientCommand_Buy")
	register_clcmd("BUy", "ClientCommand_Buy")
	register_clcmd("BuY", "ClientCommand_Buy")
	register_clcmd("BUY", "ClientCommand_Buy")
}

public ClientCommand_Buy(id)
	return PLUGIN_HANDLED_MAIN

PlaySound(const sound[])
{
	if(equal(sound[strlen(sound)-4], ".mp3"))
		client_cmd(0, "mp3 play ^"%s^"", sound)
	else
		client_cmd(0, "spk ^"%s^"", sound)
}

public ScreenFade(red, green, blue)
{
	message_begin(MSG_BROADCAST, g_msgScreenFade);
	write_short((1<<12)*4);
	write_short((1<<12)*1);
	write_short(0x0001);
	write_byte(red);
	write_byte(green);
	write_byte(blue);
	write_byte(250);
	message_end();
}

set_vars_speed(id)
	client_cmd(id, "cl_sidespeed 700;cl_backspeed 700;cl_forwardspeed 700")
	
public sound_stop()
	client_cmd(0, "mp3 stop; stopsound")
	
public start_ambience()
{
	sound_stop()
	client_cmd(0, "mp3 play ^"%s^"", ambience)
}

public killed_player(victim, attacker)
{
	if(is_user_connected(victim) && is_user_alive(attacker))
		color(victim, ".v%s.e %s.g mai are inca.e[.v%d HP.e].g", TAG, get_name(attacker), get_user_health(attacker))
	g_frozen[victim] = false
	g_noflash[victim] = false
	g_nofrost[victim] = false
	g_superknife[victim] = false
	g_furiendetector[victim] = false
	g_end_health[victim] = 0
	parachute_reset(victim)
	have_killnade[victim] = false
	remove_task(victim+TASK_AFFECT)
	remove_task(victim+TASK_AURA)
	if(g_pet[victim])
		kill_pet(victim)

	reset_vars(victim)
	if(active_box)
		AddBonusBox(victim)
	if(get_user_team(victim) == 2)
		remove_task(victim+TASK_BURN)
		
	if(is_user_connected(attacker) && is_user_connected(victim) && attacker != victim)
		g_money[attacker] += 3
		
	if(destroyer[victim])
	{
		ham_strip_weapon(victim, "weapon_c4")
		destroyer[victim] = false
		select_destroyer()
	}
	if(savior[victim])
	{
		strip_user_weapons(victim)
		savior[victim] = false
		select_savior()
	}
}

public newSpawn(id)
{
	if(para_ent[id] > 0) 
		if(is_valid_ent(para_ent[id])) 
			remove_entity(para_ent[id])
	has_parachute[id] = true
	para_ent[id] = 0
	if(!active_huds)
	{
		set_pdata_int(id, m_iClientHideHUD, 0)
		set_pdata_int(id, m_iHideHUD, HIDE_HEALTH)
	}
	make_HideWeapon(id, HIDE_MONEY);
}

public fw_SetClientKeyValue(id, const infobuffer[], const key[], const value[])
{
	if(flag_get(g_HasCustomModel, id) && equal(key, "model"))
	{
		static currentmodel[32]
		fm_cs_get_user_model(id, currentmodel, charsmax(currentmodel))
		if(!equal(currentmodel, g_CustomPlayerModel[id]) && !task_exists(id+TASK_MODELCHANGE))
			fm_cs_set_user_model(id+TASK_MODELCHANGE)
		return FMRES_SUPERCEDE;
	}
	return FMRES_IGNORED;
}

public CmdStart(id, uc_handle, seed)
{
	new ent = fm_find_ent_by_class(id, ClassName)
	if(is_valid_ent(ent))
	{
		new classname[32]	
		pev(ent, pev_classname, classname, 31)
		if (equal(classname, ClassName))
		{
			if (pev(ent, pev_frame) >= 120)
				set_pev(ent, pev_frame, 0.0)
			else
				set_pev(ent, pev_frame, pev(ent, pev_frame) + 1.0)
			
			switch(pev(ent, pev_team))
			{
				case 1: 
				{
					
				}
				case 2: 
				{
					
				}
			}
		}
	}
}

parachute_reset(id)
{
	if(para_ent[id] > 0) 
		if(is_valid_ent(para_ent[id])) 
			remove_entity(para_ent[id])
	has_parachute[id] = false
	para_ent[id] = 0
}

fire_explode(ent)
{
	if(g_endround)
		return
	
	static Float:originF[3]
	pev(ent, pev_origin, originF)
	create_blast2(originF)
	emit_sound(ent, CHAN_WEAPON, misc_sound_wav[6], 1.0, ATTN_NORM, 0, PITCH_NORM)
	static victim
	victim = -1
	while((victim = engfunc(EngFunc_FindEntityInSphere, victim, originF, 250.0)) != 0)
	{
		if(!is_user_alive(victim) || get_user_team(victim) != 2)
			continue;
			
		g_burning_duration[victim] += 15
		
		if(!task_exists(victim+TASK_BURN))
			set_task(0.2, "burning_flame", victim+TASK_BURN, _, _, "b")
	}
	engfunc(EngFunc_RemoveEntity, ent)
}

frost_explode(ent)
{
	if(g_endround)
		return
		
	static Float:originF[3]
	pev(ent, pev_origin, originF)
	create_blast3(originF)
	emit_sound(ent, CHAN_WEAPON, misc_sound_wav[1], 1.0, ATTN_NORM, 0, PITCH_NORM)
	static victim
	victim = -1
	
	while((victim = engfunc(EngFunc_FindEntityInSphere, victim, originF, 250.0)) != 0)
	{
		if(!is_user_alive(victim) || get_user_team(victim) != 2 || g_nofrost[victim])
			continue;
		
		fm_set_rendering(victim, kRenderFxGlowShell, 0, 100, 200, kRenderNormal, 25)
		emit_sound(victim, CHAN_BODY, misc_sound_wav[2], 1.0, ATTN_NORM, 0, PITCH_NORM)
		
		message_begin(MSG_ONE_UNRELIABLE, g_msgScreenFade, _, victim)
		write_short(0)
		write_short(0)
		write_short(FFADE_STAYOUT)
		write_byte(10)
		write_byte(20)
		write_byte(200)
		write_byte(150)
		message_end()
		g_frozen[victim] = true
		if(pev(victim, pev_flags) & FL_ONGROUND)
			set_pev(victim, pev_gravity, 999999.9)
		else
			set_pev(victim, pev_gravity, 0.000001)
		reset_max_speed(victim)
		set_task(0.2, "freeze_effect", victim, _, _, "b")
		set_task(1.2, "remove_freeze", victim)
	}
	engfunc(EngFunc_RemoveEntity, ent)
}

public burning_flame(taskid)
{
	static origin[3], flags
	get_user_origin(ID_BURN, origin)
	flags = pev(ID_BURN, pev_flags)
	
	if((flags & FL_INWATER) || g_burning_duration[ID_BURN] < 1)
	{
		message_begin(MSG_PVS, SVC_TEMPENTITY, origin)
		write_byte(TE_SMOKE)
		write_coord(origin[0])
		write_coord(origin[1])
		write_coord(origin[2]-50)
		write_short(smoke_spr)
		write_byte(random_num(15, 20))
		write_byte(random_num(10, 20))
		message_end()
		remove_task(taskid);
		return;
	}

	if(random_num(0, 20) < 3)
	{
		emit_sound(ID_BURN, CHAN_VOICE, burn_player[random_num(0, 2)], 1.0, ATTN_NORM, 0, PITCH_NORM)

		if((flags & FL_ONGROUND) > 0.0)
		{
			static Float:velocity[3];
			pev(ID_BURN, pev_velocity, velocity);
			xs_vec_mul_scalar(velocity, 0.5, velocity);
			set_pev(ID_BURN, pev_velocity, velocity);
		}
	}
	
	static health
	health = get_user_health(ID_BURN)
	if(health - 1 > 0)
		set_user_health(ID_BURN, get_user_health(ID_BURN) - 1)
	
	message_begin(MSG_PVS, SVC_TEMPENTITY, origin)
	write_byte(TE_SPRITE)
	write_coord(origin[0]+random_num(-5, 5))
	write_coord(origin[1]+random_num(-5, 5))
	write_coord(origin[2]+random_num(-10, 10))
	write_short(flame_spr)
	write_byte(random_num(5, 10))
	write_byte(200)
	message_end()
	
	g_burning_duration[ID_BURN]--
}

public prethink_player(id)
{
	if(!is_user_alive(id))
		return;
		
	static i, LastThink
	
	if(LastThink > id)
		FirstThink()
	LastThink = id
	
	if(g_frozen[id])
	{
		set_pev(id, pev_velocity, Float:{0.0,0.0,0.0})
		return;
	}
	
	new nbut = get_user_button(id)
	new obut = get_user_oldbutton(id)
	if((nbut & IN_JUMP) && !(get_entity_flags(id) & FL_ONGROUND) && !(obut & IN_JUMP))
	{
		if(jumpnum[id] < 1)
		{
			dojump[id] = true
			jumpnum[id]++
			return
		}
	}
	if((nbut & IN_JUMP) && (get_entity_flags(id) & FL_ONGROUND))
	{
		jumpnum[id] = 0
		return
	}
	
	if(get_user_team(id) == 2 && (g_furiendetector[id] || savior[id]))
	{
		static Target, Body, Weapon;
		
		get_user_aiming(id, Target, Body);
		Weapon = get_user_weapon(id);
			
		if((1<<Weapon) & PRIMARY_WEAPONS_BITSUM || (1<<Weapon) & SECONDARY_WEAPONS_BITSUM) 
		{
			static Target, Body, Weapon;
			
			get_user_aiming(id, Target, Body);
			Weapon = get_user_weapon(id);
			
			if((1<<Weapon) & PRIMARY_WEAPONS_BITSUM || (1<<Weapon) & SECONDARY_WEAPONS_BITSUM) 
			{
				static Origin[3];
				get_user_origin(id, Origin, 3);
				
				message_begin(MSG_BROADCAST, SVC_TEMPENTITY);
				write_byte(TE_BEAMENTPOINT);
				write_short(id | 0x1000);
				write_coord(Origin[0]);
				write_coord(Origin[1]);
				write_coord(Origin[2]);
				write_short(LaserSprite);
				write_byte(0);
				write_byte(10);
				write_byte(1);
				write_byte(5);
				write_byte(0);
				if(is_user_alive(Target) && get_user_team(Target) == 1) 
				{
					write_byte(150);
					write_byte(0);
					write_byte(0);
				}
				else 
				{
					write_byte(0);
					write_byte(150);
					write_byte(0);
				}
				write_byte(250);
				write_byte(25);
				message_end();
			}
		}
	}
	
	if(!has_parachute[id])
		return

	new Float:fallspeed = 100.0 * -1.0
	new Float:frame

	new button = get_user_button(id)
	new oldbutton = get_user_oldbutton(id)
	new flags = get_entity_flags(id)

	if(para_ent[id] > 0 && (flags & FL_ONGROUND)) 
	{
		if(entity_get_int(para_ent[id],EV_INT_sequence) != 2) 
		{
			entity_set_int(para_ent[id], EV_INT_sequence, 2)
			entity_set_int(para_ent[id], EV_INT_gaitsequence, 1)
			entity_set_float(para_ent[id], EV_FL_frame, 0.0)
			entity_set_float(para_ent[id], EV_FL_fuser1, 0.0)
			entity_set_float(para_ent[id], EV_FL_animtime, 0.0)
			entity_set_float(para_ent[id], EV_FL_framerate, 0.0)
			return
		}

		frame = entity_get_float(para_ent[id],EV_FL_fuser1) + 2.0
		entity_set_float(para_ent[id],EV_FL_fuser1,frame)
		entity_set_float(para_ent[id],EV_FL_frame,frame)

		if(frame > 254.0) 
		{
			remove_entity(para_ent[id])
			para_ent[id] = 0
		}
	}

	if(button & IN_USE) 
	{
		new Float:velocity[3]
		entity_get_vector(id, EV_VEC_velocity, velocity)

		if(velocity[2] < 0.0) {

			if(para_ent[id] <= 0) {
				para_ent[id] = create_entity("info_target")
				if(para_ent[id] > 0) {
					entity_set_string(para_ent[id],EV_SZ_classname,"parachute")
					entity_set_edict(para_ent[id], EV_ENT_aiment, id)
					entity_set_edict(para_ent[id], EV_ENT_owner, id)
					entity_set_int(para_ent[id], EV_INT_movetype, MOVETYPE_FOLLOW)
					entity_set_model(para_ent[id], "models/furien/krilo2.mdl")
					entity_set_int(para_ent[id], EV_INT_sequence, 0)
					entity_set_int(para_ent[id], EV_INT_gaitsequence, 1)
					entity_set_float(para_ent[id], EV_FL_frame, 0.0)
					entity_set_float(para_ent[id], EV_FL_fuser1, 0.0)
				}
			}

			if(para_ent[id] > 0) {

				entity_set_int(id, EV_INT_sequence, 3)
				entity_set_int(id, EV_INT_gaitsequence, 1)
				entity_set_float(id, EV_FL_frame, 1.0)
				entity_set_float(id, EV_FL_framerate, 1.0)

				velocity[2] = (velocity[2] + 40.0 < fallspeed) ? velocity[2] + 40.0 : fallspeed
				entity_set_vector(id, EV_VEC_velocity, velocity)

				if(entity_get_int(para_ent[id],EV_INT_sequence) == 0) {

					frame = entity_get_float(para_ent[id],EV_FL_fuser1) + 1.0
					entity_set_float(para_ent[id],EV_FL_fuser1,frame)
					entity_set_float(para_ent[id],EV_FL_frame,frame)

					if(frame > 100.0) {
						entity_set_float(para_ent[id], EV_FL_animtime, 0.0)
						entity_set_float(para_ent[id], EV_FL_framerate, 0.4)
						entity_set_int(para_ent[id], EV_INT_sequence, 1)
						entity_set_int(para_ent[id], EV_INT_gaitsequence, 1)
						entity_set_float(para_ent[id], EV_FL_frame, 0.0)
						entity_set_float(para_ent[id], EV_FL_fuser1, 0.0)
					}
				}
			}
		}
		else if(para_ent[id] > 0) 
		{
			remove_entity(para_ent[id])
			para_ent[id] = 0
		}
	}
	else if((oldbutton & IN_USE) && para_ent[id] > 0) 
	{
		remove_entity(para_ent[id])
		para_ent[id] = 0
	}
	
	if(g_endround)
	{
		set_pev(id, pev_velocity, Float:{18.0, 18.0, 16.0})
		return;
	}
	
	if(!plrSolid[id]) return
	
	for(i = 1; i <= g_iMaxPlayers; i++)
	{
		if(!plrSolid[i] || id == i) continue
		
		if(plrTeam[i] == plrTeam[id])
		{
			set_pev(i, pev_solid, SOLID_NOT)
			plrRestore[i] = true
		}
	}
}

public set_gamename()
{
	forward_return(FMV_STRING, modname)
	return FMRES_SUPERCEDE;
}

public Fix()
{
	static i, fpf;
	if(!fpf)
		fpf = g_iMaxPlayers;
	
	for(i = 1; i <= fpf; i++)
	{
		if(IsPlayer(i))
			Data(i);
	}
}

public Calcu()
{
	static Iterator, ping, fpf;
	if(!fpf)
		fpf = g_iMaxPlayers;
	for(Iterator = 1; Iterator <= fpf; Iterator++) 
	{ 
		ping = random_num(10, 35);
		for(g_Offset[Iterator][0] = 0; g_Offset[Iterator][0] < 4; g_Offset[Iterator][0]++)
		{
			if((ping - g_Offset[Iterator][0]) % 4 == 0)
			{
				g_Argping[Iterator][0] = (ping - g_Offset[Iterator][0]) / 4;
				break;
			}
		}
		for(g_Offset[Iterator][1] = 0; g_Offset[Iterator][1] < 2; g_Offset[Iterator][1]++)
		{
			if((ping - g_Offset[Iterator][1]) % 2 == 0)
			{
				g_Argping[Iterator][1] = (ping - g_Offset[Iterator][1]) / 2;
				break;
			}
		}
		g_Argping[Iterator][2] = ping;
	}
}

public Data(i)
{
	static j, send, fpf;
	if(!(pev(i,pev_button)&IN_SCORE)&&!(pev(i,pev_oldbuttons)&IN_SCORE)) 
		return;
	if(!fpf)
		fpf=g_iMaxPlayers;
	
	send = 0;
	for(j = 1; j <= fpf; j++) 
	{
		if(!IsPlayer(j))
			continue;
		switch(send)
		{
			case 0:
			{
				message_begin(MSG_ONE_UNRELIABLE, SVC_PINGS, _, i);
				write_byte((g_Offset[j][0]*64)+(1+2*(j-1)));
				write_short(g_Argping[j][0]);
				send ++;
			}
			case 1:
			{
				write_byte((g_Offset[j][1]*128)+(2+4*(j-1)));
				write_short(g_Argping[j][1]);
				send ++;
			}
			case 2:
			{
				write_byte((4+8*(j-1)));
				write_short(g_Argping[j][2]);
				write_byte(0);
				message_end();
				send = 0;
			}
		}
	}
	if(send)
	{
		write_byte(0);
		message_end();
	}
}

public eventMoney(plr)
{
	make_HideWeapon(plr, HIDE_MONEY);
	if(!active_huds)
	{
		set_pdata_int(plr, m_iClientHideHUD, 0)
		set_pdata_int(plr, m_iHideHUD, HIDE_HEALTH)
	}
	return PLUGIN_HANDLED;
}

public bomb_planted(id)
{
	if(is_user_alive(id))
	{
		color(0, ".v%s.e %s.g a primit.e 5$.g ca a plantat bomba cu plasma.", TAG, get_name(id))
		g_money[id] += 5
	}
}

public bomb_defused(id)
{
	if(is_user_alive(id))
	{
		color(0, ".v%s.e %s.g a primit.e 5$.g ca a dezamorsat bomba cu plasma.", TAG, get_name(id))
		g_money[id] += 5
	}
}

public ham_touch(toucher, touched)
{
	if(entity_get_int(toucher, EV_INT_movetype) != MOVETYPE_BOUNCEMISSILE)
		return HAM_IGNORED
	
	new Float:origin[3]
	new impacts = entity_get_int(toucher, EV_INT_iuser2)
	new owner = entity_get_edict(toucher, EV_ENT_owner)
	entity_get_vector(toucher, EV_VEC_origin, origin)
	
	if(1 <= touched <= g_iMaxPlayers)
	{
		new CsTeams:team[2]
		team[0] = cs_get_user_team(touched)
		team[1] = cs_get_user_team(owner)
		
		if((team[0] != team[1] && team[0] != CS_TEAM_SPECTATOR && team[0] != CS_TEAM_UNASSIGNED))
		{
			new Float:origin[3]
			entity_get_vector(touched, EV_VEC_origin, origin)
			blood(origin)
			set_pdata_int(touched, OFFSET_LAST_HIT_GROUP, HIT_HEAD, 5)
			ExecuteHamB(Ham_TakeDamage, touched, toucher, owner, 135.0, DMG_CS_BULLETS_KNIFE)
			entity_set_edict(toucher, EV_ENT_euser2, 0)
			entity_set_edict(toucher, EV_ENT_euser3, touched)
			
			new color[3] 
			color[0] = 165
			color[1] = 45
			color[2] = 45
			
			create_blast(origin, color)
		}
	}
	
	if(touched > g_iMaxPlayers || touched == 0)
		msg_ricochet(origin)
	
	impacts++
	
	entity_set_int(toucher, EV_INT_iuser2, impacts)
	
	if(impacts >= 1)
	{
		clear_beamfollow(toucher)
		entity_set_int(toucher, EV_INT_flags, FL_KILLME)
		metal_gibs(origin)
	}
	
	return HAM_IGNORED
}

clear_beamfollow(ent)
{
	message_begin(MSG_ALL,SVC_TEMPENTITY)
	write_byte(TE_KILLBEAM)
	write_short(ent)
	message_end()
}

msg_ricochet(Float:origin[3])
{
	engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, origin, 0)
	write_byte(TE_ARMOR_RICOCHET)
	engfunc(EngFunc_WriteCoord, origin[0])
	engfunc(EngFunc_WriteCoord, origin[1])
	engfunc(EngFunc_WriteCoord, origin[2])
	write_byte(5)
	message_end()
}

metal_gibs(const Float: origin[3])
{
	engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, origin, 0)
	write_byte(TE_BREAKMODEL)
	engfunc(EngFunc_WriteCoord,origin[0])
	engfunc(EngFunc_WriteCoord,origin[1])
	engfunc(EngFunc_WriteCoord,origin[2] + 24)
	engfunc(EngFunc_WriteCoord,20.0)
	engfunc(EngFunc_WriteCoord,20.0)
	engfunc(EngFunc_WriteCoord,20.0)
	engfunc(EngFunc_WriteCoord,random_num(-50,50))
	engfunc(EngFunc_WriteCoord,random_num(-50,50))
	engfunc(EngFunc_WriteCoord,25.0)
	write_byte(10)
	write_short(spr_nadebits)
	write_byte(10)
	write_byte(25)
	write_byte(2)
	message_end()
}


create_blast(Float:originF[3], rgb[3])
{
	new origin[3]
	FVecIVec(originF,origin)

	message_begin(MSG_BROADCAST,SVC_TEMPENTITY)
	write_byte(TE_BEAMCYLINDER)
	write_coord(origin[0])
	write_coord(origin[1])
	write_coord(origin[2])
	write_coord(origin[0])
	write_coord(origin[1])
	write_coord(origin[2] + 50)
	write_short(beam_effect)
	write_byte(0)
	write_byte(0)
	write_byte(4)
	write_byte(60)
	write_byte(0)
	write_byte(rgb[0])
	write_byte(rgb[1])
	write_byte(rgb[2])
	write_byte(100)
	write_byte(0)
	message_end()
}

public message_show_menu(msgid, dest, id) 
{
	if(!should_autojoin(id))
		return PLUGIN_CONTINUE

	static team_select[] = "#Team_Select"
	static menu_text_code[sizeof team_select]
	get_msg_arg_string(4, menu_text_code, sizeof menu_text_code - 1)
	if(!equal(menu_text_code, team_select))
		return PLUGIN_CONTINUE

	set_force_team_join_task(id, msgid)
	return PLUGIN_HANDLED
}

public message_vgui_menu(msgid, dest, id) 
{
	if(get_msg_arg_int(1) != 2 || !should_autojoin(id))
		return PLUGIN_CONTINUE

	set_force_team_join_task(id, msgid)

	return PLUGIN_HANDLED
}

bool:should_autojoin(id)
	return (!get_user_team(id) && !task_exists(id))
	
set_force_team_join_task(id, menu_msgid) 
{
	static param_menu_msgid[2]
	param_menu_msgid[0] = menu_msgid
	set_task(0.1, "task_force_team_join", id, param_menu_msgid, sizeof param_menu_msgid)
}

public task_force_team_join(menu_msgid[], id) 
{
	if(get_user_team(id))
		return

	force_team_join(id, menu_msgid[0])
}

stock force_team_join(id, menu_msgid) 
{
	static jointeam[] = "jointeam"
	static msg_block, joinclass[] = "joinclass"
	msg_block = get_msg_block(menu_msgid)
	set_msg_block(menu_msgid, BLOCK_SET)
	engclient_cmd(id, jointeam, "5")
	engclient_cmd(id, joinclass, "5")
	set_msg_block(menu_msgid, msg_block)
}

public prethink_player_post(id)
{
	if(!is_user_alive(id))
		return PLUGIN_CONTINUE
		
	static i
	for(i = 1; i <= g_iMaxPlayers; i++)
	{
		if(plrRestore[i])
		{
			set_pev(i, pev_solid, SOLID_SLIDEBOX)
			plrRestore[i] = false
		}
	}
	
	if(dojump[id] == true)
	{
		new Float:velocity[3]	
		entity_get_vector(id,EV_VEC_velocity,velocity)
		velocity[2] = random_float(265.0,285.0)
		entity_set_vector(id,EV_VEC_velocity,velocity)
		dojump[id] = false
		return PLUGIN_CONTINUE
	}
	return PLUGIN_CONTINUE
}

public msgStatusIcon(msgid, msgdest, id)
{
	static szIcon[8];
	get_msg_arg_string(2, szIcon, 7);

	if(equal(szIcon, "buyzone") && get_msg_arg_int(1))
	{
		set_pdata_int(id, 235, get_pdata_int(id, 235) & ~(1<<0));
		return PLUGIN_HANDLED;
	}
	return PLUGIN_CONTINUE;
}

public ChangeName(id, buffer)
{
	if(!is_user_connected(id))
		return FMRES_IGNORED;

	static Name[32], Val[32];
	get_user_name(id, Name, sizeof Name - 1);
	engfunc(EngFunc_InfoKeyValue, buffer, "name", Val, sizeof Val - 1);
	
	if(equal(Val, Name))
		return FMRES_IGNORED;

	remove_task(id+TASK_MINUTES)
	remove_task(id+TASK_SHOWHUD)
	set_task(0.2, "client_putinserver", id)
	verify_name(id)
	return FMRES_SUPERCEDE;
}

public hook_say(id)
{
	if(!is_user_connected(id))
		return PLUGIN_HANDLED;

	static chat[192], users_team, name[32]
	read_argv(1, chat, charsmax(chat))
	get_user_name(id, name, charsmax(name) - 1)
	users_team = fm_cs_get_user_team(id)
	
	static comanda[16], nume[32]

	strbreak(chat, comanda, charsmax(comanda), nume, charsmax(nume))
	if(equal(comanda, "/donate", 7))
		donate(id, nume)
	if(is_user_alive(id))
	{
		if(get_user_team(id) == 1)
		{
			if((get_user_flags(id) & VIP_FLAG) && (get_user_flags(id) & ADMIN_SLAY))
				color_chat(0, id, users_team, RED,  "^3[LVL:^4 %d^3] [^4VIP+ADMIN^3] %s:^4 %s", nivel[id], name, chat)
			else if((get_user_flags(id) & ADMIN_SLAY) && !(get_user_flags(id) & VIP_FLAG))
				color_chat(0, id, users_team, RED,  "^3[LVL:^4 %d^3] [^4ADMIN^3] %s:^4 %s", nivel[id], name, chat)
			else if(!(get_user_flags(id) & ADMIN_SLAY) && (get_user_flags(id) & VIP_FLAG))
				color_chat(0, id, users_team, RED,  "^3[LVL:^4 %d^3] [^4VIP^3] %s:^4 %s", nivel[id], name, chat)
			else
				color_chat(0, id, users_team, RED,  "^3[LVL:^4 %d^3] %s:^1 %s", nivel[id], name, chat)	
		}
		else if(get_user_team(id) == 2)
		{
			if((get_user_flags(id) & VIP_FLAG) && (get_user_flags(id) & ADMIN_SLAY))
				color_chat(0, id, users_team, BLUE,  "^3[LVL:^4 %d^3] [^4VIP+ADMIN^3] %s:^4 %s", nivel[id], name, chat)
			else if((get_user_flags(id) & ADMIN_SLAY) && !(get_user_flags(id) & VIP_FLAG))
				color_chat(0, id, users_team, BLUE,  "^3[LVL:^4 %d^3] [^4ADMIN^3] %s:^4 %s", nivel[id], name, chat)
			else if(!(get_user_flags(id) & ADMIN_SLAY) && (get_user_flags(id) & VIP_FLAG))
				color_chat(0, id, users_team, BLUE,  "^3[LVL:^4 %d^3] [^4VIP^3] %s:^4 %s", nivel[id], name, chat)
			else
				color_chat(0, id, users_team, BLUE,  "^3[LVL:^4 %d^3] %s:^1 %s", nivel[id], name, chat)	
		}
	}
	else
	{
		if(users_team == FM_CS_TEAM_SPECTATOR)
		{
			if((get_user_flags(id) & VIP_FLAG) && (get_user_flags(id) & ADMIN_SLAY))
				color_chat(0, id, users_team, GREY,  "^3[LVL:^4 %d^3] [^4VIP+ADMIN^3] %s:^4 %s", nivel[id], name, chat)
			else if((get_user_flags(id) & ADMIN_SLAY) && !(get_user_flags(id) & VIP_FLAG))
				color_chat(0, id, users_team, GREY,  "^3[LVL:^4 %d^3] [^4ADMIN^3] %s:^4 %s", nivel[id], name, chat)
			else if(!(get_user_flags(id) & ADMIN_SLAY) && (get_user_flags(id) & VIP_FLAG))
				color_chat(0, id, users_team, GREY,  "^3[LVL:^4 %d^3] [^4VIP^3] %s:^4 %s", nivel[id], name, chat)
			else
				color_chat(0, id, users_team, GREY,  "^3[LVL:^4 %d^3] %s:^1 %s", nivel[id], name, chat)	
		}
		else if(get_user_team(id) == 1)
		{
			if((get_user_flags(id) & VIP_FLAG) && (get_user_flags(id) & ADMIN_SLAY))
				color_chat(0, id, users_team, RED,  "^3[LVL:^4 %d^3] [^4VIP+ADMIN^3] *%s:^4 %s", nivel[id], name, chat)
			else if((get_user_flags(id) & ADMIN_SLAY) && !(get_user_flags(id) & VIP_FLAG))
				color_chat(0, id, users_team, RED,  "^3[LVL:^4 %d^3] [^4ADMIN^3] *%s:^4 %s", nivel[id], name, chat)
			else if(!(get_user_flags(id) & ADMIN_SLAY) && (get_user_flags(id) & VIP_FLAG))
				color_chat(0, id, users_team, RED,  "^3[LVL:^4 %d^3] [^4VIP^3] *%s:^4 %s", nivel[id], name, chat)
			else
				color_chat(0, id, users_team, RED,  "^3[LVL:^4 %d^3] %s:^1 *%s", nivel[id], name, chat)	
		}
		else if(get_user_team(id) == 2)
		{
			if((get_user_flags(id) & VIP_FLAG) && (get_user_flags(id) & ADMIN_SLAY))
				color_chat(0, id, users_team, BLUE,  "^3[LVL:^4 %d^3] [^4VIP+ADMIN^3] *%s:^4 %s", nivel[id], name, chat)
			else if((get_user_flags(id) & ADMIN_SLAY) && !(get_user_flags(id) & VIP_FLAG))
				color_chat(0, id, users_team, BLUE,  "^3[LVL:^4 %d^3] [^4ADMIN^3] *%s:^4 %s", nivel[id], name, chat)
			else if(!(get_user_flags(id) & ADMIN_SLAY) && (get_user_flags(id) & VIP_FLAG))
				color_chat(0, id, users_team, BLUE,  "^3[LVL:^4 %d^3] [^4VIP^3] *%s:^4 %s", nivel[id], name, chat)
			else
				color_chat(0, id, users_team, BLUE,  "^3[LVL:^4 %d^3] %s:^1 *%s", nivel[id], name, chat)	
		}		
	}
	return PLUGIN_HANDLED
}

public messageHideWeapon(msgid, dest, plr)
{
	set_msg_arg_int(1, ARG_BYTE, get_msg_arg_int(1)|HIDE_MONEY)
	return PLUGIN_CONTINUE;
}

public Event_HideWeapon(id)
{
	if(!active_huds)
	{
        message_begin(MSG_ONE_UNRELIABLE, g_msgHideWeapon, _, id)
        write_byte(HIDE_HEALTH)
        message_end()
        message_begin(MSG_ONE_UNRELIABLE, g_msgCrosshair, _, id)
        write_byte(0);
        message_end();
	}
}

public increase_level(taskid)
{
	if(get_user_team(ID_MINUTE) == 3)
		return;
	
	minutes[ID_MINUTE]++
	if(minutes[ID_MINUTE] >= 5)
	{
		minutes[ID_MINUTE] = 0
		complete_hours[ID_MINUTE]++
		if(complete_hours[ID_MINUTE] >= LEVELS[nivel[ID_MINUTE]])
		{
			color(ID_MINUTE, ".v%s.g Ai avansat un nivel! Nivelul tau acum este.e %d.g.", TAG, nivel[ID_MINUTE])
			nivel[ID_MINUTE]++
		}
	}
	SaveData(ID_MINUTE)
	checkandupdatetop(ID_MINUTE, nivel[ID_MINUTE], complete_hours[ID_MINUTE], minutes[ID_MINUTE])
}

public addToFullPack(es, e, ent, host, hostflags, player, pSet)
{
	if(player)
	{
		if(plrSolid[host] && plrSolid[ent] && plrTeam[host] == plrTeam[ent])
			set_es(es, ES_Solid, SOLID_NOT)
	}
}

FirstThink()
{
	for(new i = 1; i <= g_iMaxPlayers; i++)
	{
		if(!is_user_alive(i))
		{
			plrSolid[i] = false
			continue
		}
		plrTeam[i] = get_user_team(i)
		plrSolid[i] = pev(i, pev_solid) == SOLID_SLIDEBOX ? true : false
	}
}

public LoadData(id) 
{ 
	new vaultkey[64], vaultdata[256];
	format(vaultkey, 63, "%s", get_name(id))
	format(vaultdata, 255, "^"%i^" ^"%i^" ^"%i^" ^"%i^"", nivel[id], complete_hours[id], minutes[id],g_money[id])
	nvault_get(salvare_nvault, vaultkey, vaultdata, 255)
	new lvl[32], ore[32], minute[32],bani[32];
	parse(vaultdata, lvl, 31, ore, 31, minute, 31,bani,31)
	nivel[id] = str_to_num(lvl)
	complete_hours[id] = str_to_num(ore)
	minutes[id] = str_to_num(minute)
	g_money[id]=str_to_num(bani)
	if(nivel[id] == 0)
		nivel[id] = 1
		
	color(id, "Am preluat salvarile.")
}

public SaveData(id) 
{
	new vaultkey[64], vaultdata[256];
	format(vaultkey, 63, "%s", get_name(id))
	format(vaultdata, 255, "^"%i^" ^"%i^" ^"%i^" ^"%i^"", nivel[id], complete_hours[id], minutes[id],g_money[id])
	nvault_set(salvare_nvault, vaultkey, vaultdata)
}

public client_putinserver(id)
{
	g_cmdguns[id] = false
	g_gunsselect[id] = 0
	g_primary_select[id] = 0
	g_secondary_select[id] = 0
	reset_vars(id)
	//g_money[id] = get_pcvar_num(mp_startmoney)
	set_task(60.0, "increase_level", id+TASK_MINUTES, _, _, "b")
	set_task(0.3, "HealthHud", id+TASK_SHOWHUD, _, _, "b")
	LoadData(id)
}

public client_disconnect(id)
{
	if(g_pet[id])
		kill_pet(id)
	reset_vars(id)
	g_frozen[id] = false
	g_burning_duration[id] = 0
	g_cmdguns[id] = false
	g_gunsselect[id] = 0
	g_primary_select[id] = 0
	g_secondary_select[id] = 0
	parachute_reset(id)
	have_killnade[id] = false
	jumpnum[id] = 0
	dojump[id] = false
	g_furiendetector[id] = false
	g_noflash[id] = false
	g_superknife[id] = false
	g_nofrost[id] = false
	g_end_health[id] = 0
	remove_task(id+TASK_MINUTES);
	remove_task(id+TASK_MODELCHANGE);
	remove_task(id+TASK_AFFECT);
	flag_unset(g_HasCustomModel, id)
	remove_task(id+TASK_SHOWHUD)
	remove_task(id+TASK_AURA)
	if(destroyer[id])
	{
		ham_strip_weapon(id, "weapon_c4")
		destroyer[id] = false
		select_destroyer()
	}
	if(savior[id])
	{
		savior[id] = false
		select_savior()
	}
}

public player_killed_post(id)
	set_pev(id, pev_iuser1, SPECMODE_ALIVE)

public freeze_effect(id)
{
	if(!is_user_alive(id) || !g_frozen[id])
	{
		remove_task(id)
		return;
	}
	new Float:fOrigin[3], iOrigin[3]
	pev(id, pev_origin, fOrigin)
	FVecIVec(fOrigin, iOrigin)
	UTIL_CreateFlares(iOrigin, frostgib, 5, 5, 2)
}

verify_name(id)
{
	static name[32]
	get_user_info(id, "name", name, 31)
	
	static i, ignore
	ignore = false
	
	for(i = 0; i <= g_sizeof_names_new; i++)
		if(containi(name, g_names_new[i]) != -1)
		{
			ignore = true
			break;
		}
	
	if(ignore)
		return;
	
	for(i = 0; i < 29; i++)
		replace_all(name, 31, g_filter_chars[i], "")
	
	for(i = 0; i < g_sizeof_names; i++)
		if(containi(name, g_names[i]) != -1)
		{
			formatex(name, 31, "%s [%d]", g_names_new[random_num(0, g_sizeof_names_new)], g_names_changed)
			set_user_info(id, "name", name)
			client_cmd(id, "name ^"%s^"", name)
			g_names_changed++
		}
}

public remove_freeze(id)
{
	if(!is_user_alive(id) || !g_frozen[id])
		return;
	
	g_frozen[id] = false;
	if(get_user_team(id) == 2)
		set_pev(id, pev_gravity, 1.0)

	reset_max_speed(id)
	fm_set_rendering(id, kRenderFxGlowShell, 0, 200, 50, kRenderNormal, 18)
	message_begin(MSG_ONE_UNRELIABLE, g_msgScreenFade, _, id)
	write_short(UNIT_SECOND)
	write_short(0)
	write_short(FFADE_IN)
	write_byte(10)
	write_byte(20)
	write_byte(200)
	write_byte(100)
	message_end()
	emit_sound(id, CHAN_BODY, misc_sound_wav[0], 1.0, ATTN_NORM, 0, PITCH_NORM)
	static origin2[3]
	get_user_origin(id, origin2)
	message_begin(MSG_PVS, SVC_TEMPENTITY, origin2)
	write_byte(TE_BREAKMODEL)
	write_coord(origin2[0])
	write_coord(origin2[1])
	write_coord(origin2[2]+24)
	write_coord(16)
	write_coord(16)
	write_coord(16) 
	write_coord(random_num(-50, 50))
	write_coord(random_num(-50, 50))
	write_coord(25)
	write_byte(10)
	write_short(mdl_glass)
	write_byte(10)
	write_byte(25)
	write_byte(BREAK_GLASS)
	message_end()
	ExecuteHamB(Ham_Player_ResetMaxSpeed, id)
}

create_blast2(const Float:originF[3])
{
	engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, originF, 0)
	write_byte(TE_BEAMCYLINDER)
	engfunc(EngFunc_WriteCoord, originF[0])
	engfunc(EngFunc_WriteCoord, originF[1])
	engfunc(EngFunc_WriteCoord, originF[2])
	engfunc(EngFunc_WriteCoord, originF[0])
	engfunc(EngFunc_WriteCoord, originF[1])
	engfunc(EngFunc_WriteCoord, originF[2]+470.0)
	write_short(beam_effect)
	write_byte(0)
	write_byte(0)
	write_byte(4)
	write_byte(60)
	write_byte(0)
	write_byte(255)
	write_byte(127)
	write_byte(80)
	write_byte(200)
	write_byte(0)
	message_end()
	
	engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, originF, 0)
	write_byte(TE_BEAMCYLINDER)
	engfunc(EngFunc_WriteCoord, originF[0])
	engfunc(EngFunc_WriteCoord, originF[1])
	engfunc(EngFunc_WriteCoord, originF[2])
	engfunc(EngFunc_WriteCoord, originF[0])
	engfunc(EngFunc_WriteCoord, originF[1])
	engfunc(EngFunc_WriteCoord, originF[2]+555.0)
	write_short(beam_effect)
	write_byte(0)
	write_byte(0)
	write_byte(4)
	write_byte(60)
	write_byte(0)
	write_byte(255)
	write_byte(20)
	write_byte(10)
	write_byte(200)
	write_byte(0)
	message_end()
	
	engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, originF, 0)
	write_byte(TE_DLIGHT)
	engfunc(EngFunc_WriteCoord, originF[0])
	engfunc(EngFunc_WriteCoord, originF[1])
	engfunc(EngFunc_WriteCoord, originF[2])
	write_byte(50)
	write_byte(255)
	write_byte(20)
	write_byte(10)
	write_byte(30)
	write_byte(30)
	message_end()

	engfunc(EngFunc_MessageBegin, MSG_BROADCAST,SVC_TEMPENTITY, originF, 0)
	write_byte(TE_EXPLOSION)
	engfunc(EngFunc_WriteCoord, originF[0])
	engfunc(EngFunc_WriteCoord, originF[1])
	engfunc(EngFunc_WriteCoord, originF[2]+75)
	write_short(fireexp)
	write_byte(17)
	write_byte(15)
	write_byte(TE_EXPLFLAG_NOSOUND)
	message_end();	
	
	engfunc(EngFunc_MessageBegin, MSG_BROADCAST,SVC_TEMPENTITY, originF, 0)
	write_byte(TE_SPRITETRAIL)
	engfunc(EngFunc_WriteCoord, originF[0])
	engfunc(EngFunc_WriteCoord, originF[1])
	engfunc(EngFunc_WriteCoord, originF[2] + 40)
	engfunc(EngFunc_WriteCoord, originF[0])
	engfunc(EngFunc_WriteCoord, originF[1])
	engfunc(EngFunc_WriteCoord, originF[2])
	write_short(firegib)
	write_byte(30)
	write_byte(10)
	write_byte(2)
	write_byte(50)
	write_byte(10)
	message_end();
}

create_blast3(const Float:originF[3])
{
	engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, originF, 0)
	write_byte(TE_BEAMCYLINDER)
	engfunc(EngFunc_WriteCoord, originF[0])
	engfunc(EngFunc_WriteCoord, originF[1])
	engfunc(EngFunc_WriteCoord, originF[2])
	engfunc(EngFunc_WriteCoord, originF[0])
	engfunc(EngFunc_WriteCoord, originF[1])
	engfunc(EngFunc_WriteCoord, originF[2]+470.0)
	write_short(beam_effect)
	write_byte(0)
	write_byte(0)
	write_byte(4)
	write_byte(60)
	write_byte(0)
	write_byte(0)
	write_byte(191)
	write_byte(255)
	write_byte(200)
	write_byte(0)
	message_end()
	
	engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, originF, 0)
	write_byte(TE_BEAMCYLINDER)
	engfunc(EngFunc_WriteCoord, originF[0])
	engfunc(EngFunc_WriteCoord, originF[1])
	engfunc(EngFunc_WriteCoord, originF[2])
	engfunc(EngFunc_WriteCoord, originF[0])
	engfunc(EngFunc_WriteCoord, originF[1])
	engfunc(EngFunc_WriteCoord, originF[2]+555.0)
	write_short(beam_effect)
	write_byte(0)
	write_byte(0)
	write_byte(4)
	write_byte(60)
	write_byte(0)
	write_byte(0)
	write_byte(191)
	write_byte(255)
	write_byte(200)
	write_byte(0)
	message_end()

	engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, originF, 0)
	write_byte(TE_DLIGHT)
	engfunc(EngFunc_WriteCoord, originF[0])
	engfunc(EngFunc_WriteCoord, originF[1])
	engfunc(EngFunc_WriteCoord, originF[2])
	write_byte(50)
	write_byte(0)
	write_byte(191)
	write_byte(255)
	write_byte(30)
	write_byte(30)
	message_end()

	engfunc(EngFunc_MessageBegin, MSG_BROADCAST,SVC_TEMPENTITY, originF, 0)
	write_byte(TE_EXPLOSION)
	engfunc(EngFunc_WriteCoord, originF[0])
	engfunc(EngFunc_WriteCoord, originF[1])
	engfunc(EngFunc_WriteCoord, originF[2]+75)
	write_short(frostexp)
	write_byte(17)
	write_byte(15)
	write_byte(TE_EXPLFLAG_NOSOUND)
	message_end();
	
	
	engfunc(EngFunc_MessageBegin, MSG_BROADCAST,SVC_TEMPENTITY, originF, 0)
	write_byte(TE_SPRITETRAIL)
	engfunc(EngFunc_WriteCoord, originF[0])
	engfunc(EngFunc_WriteCoord, originF[1])
	engfunc(EngFunc_WriteCoord, originF[2] + 40)
	engfunc(EngFunc_WriteCoord, originF[0])
	engfunc(EngFunc_WriteCoord, originF[1])
	engfunc(EngFunc_WriteCoord, originF[2])
	write_short(frostgib)
	write_byte(20)
	write_byte(7)
	write_byte(2)
	write_byte(50)
	write_byte(10)
	message_end()
}

public detail_level(id)
{
	if(!is_user_connected(id))
		return
		
	color(id, ".v%s.g Nivelul tau este:.e %d.g | Ai:.e %d/%d.g | Minute:.e %d/5.g.", TAG, nivel[id], complete_hours[id], LEVELS[nivel[id]], minutes[id])
	return;
}

blood(const Float:origin[3])
{
	engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, origin, 0)
	write_byte(TE_BLOODSPRITE)
	engfunc(EngFunc_WriteCoord, origin[0])
	engfunc(EngFunc_WriteCoord, origin[1])
	engfunc(EngFunc_WriteCoord, origin[2] + 30.0)
	write_short(spr_blood_spray)
	write_short(spr_blood_drop)
	write_byte(248)
	write_byte(15)
	message_end()
}

public save_top() 
{
	new path[128];
	formatex(path, 127, "%s/TopLevels.dat", data_save);
	if(file_exists(path)) 
		delete_file(path);
	new Buffer[256];
	new f = fopen(path, "at");
	for(new i = INFO_ZERO; i < NTOP; i++)
	{
		formatex(Buffer, 255, "^"%s^" ^"%d^" ^"%d^" ^"%d^"^n", topnames[i], toplevels[i], tophours[i], topminutes[i])
		fputs(f, Buffer);
	}
	fclose(f);
}

reset_vars(id)
{
	g_ak47[id] = false
	g_m4a1[id] = false
	g_deagle[id] = false
	g_pet[id] = false
	g_used_life[id] = false
	item_pet[id] = 0
}

public FM_Think_hook(ent)
{
	for(new i = 0; i <= g_iMaxPlayers; i++)
	{
		if(ent == item_pet[i])
		{
			static Float:origin[3]
			static Float:origin2[3]
			static Float:velocity[3]
			pev(ent,pev_origin,origin2)
			get_offset_origin_body(i,Float:{50.0,0.0,0.0},origin)
			
			if(get_distance_f(origin,origin2) > 300.0)
			{
				set_pev(ent,pev_origin,origin)
			}
			
			else if(get_distance_f(origin,origin2) > 80.0)
			{
				get_speed_vector(origin2,origin,250.0,velocity)
				set_pev(ent,pev_velocity,velocity)
				if(pev(ent,pev_sequence) != pet_run || pev(ent,pev_framerate) != pet_run_speed)
				{
					set_pev(ent,pev_sequence,pet_run)
					set_pev(ent,pev_gaitsequence,pet_run)
					set_pev(ent,pev_framerate,pet_run_speed)
				}
			}
			
			else if(get_distance_f(origin,origin2) < 75.0)
			{
				if(pev(ent,pev_sequence) != pet_idle || pev(ent,pev_framerate) != pet_idle_speed)
				{
					set_pev(ent,pev_sequence,pet_idle)
					set_pev(ent,pev_gaitsequence,pet_idle)
					set_pev(ent,pev_framerate,pet_idle_speed)
				}
				set_pev(ent,pev_velocity,Float:{0.0,0.0,0.0})
			}
			pev(i,pev_origin,origin)
			origin[2] = origin2[2]
			entity_set_aim(ent,origin)			
			set_pev(ent,pev_nextthink,1.0)
			break
		}
	}
}

public TraceAttack(iEnt, iAttacker, Float:flDamage, Float:fDir[3], pentru, iDamageType)
{
	if(!IsPlayer(iAttacker))
		return

	static iWeapon;
	iWeapon = get_user_weapon(iAttacker);
	
	if((g_ak47[iAttacker] && iWeapon == CSW_AK47) || (g_m4a1[iAttacker] && iWeapon == CSW_M4A1) || (g_deagle[iAttacker] && iWeapon == CSW_DEAGLE))
	{
		static iOrigin[3], Float:flEnd[3]
		get_user_origin(iAttacker, iOrigin, 1)
		get_tr2(pentru, TR_vecEndPos, flEnd)
		message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
		write_byte(TE_TRACER)
		write_coord(iOrigin[0])
		write_coord(iOrigin[1])
		write_coord(iOrigin[2])
		write_coord_f(flEnd[0]) 
		write_coord_f(flEnd[1]) 
		write_coord_f(flEnd[2]) 
		message_end()
	}
}

public is_a_player(ent)
{
	if(ent > 0 && ent < 33)
		return true
	
	return false
}

public remove_pet(ent) 
	if(pev_valid(ent))
		fm_remove_entity(ent)

stock get_offset_origin_body(ent,const Float:offset[3],Float:origin[3])
{
	if(!pev_valid(ent))
		return 0;
	
	new Float:angle[3]
	pev(ent,pev_angles,angle)
	
	pev(ent,pev_origin,origin)
	
	origin[0] += floatcos(angle[1],degrees) * offset[0]
	origin[1] += floatsin(angle[1],degrees) * offset[0]
	
	origin[1] += floatcos(angle[1],degrees) * offset[1]
	origin[0] += floatsin(angle[1],degrees) * offset[1]
	
	return 1;
}

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 entity_set_aim(ent,const Float:origin2[3],bone=0)
{
	if(!pev_valid(ent))
		return 0;
	
	static Float:origin[3]
	origin[0] = origin2[0]
	origin[1] = origin2[1]
	origin[2] = origin2[2]
	
	static Float:ent_origin[3], Float:angles[3]
	
	if(bone)
		engfunc(EngFunc_GetBonePosition,ent,bone,ent_origin,angles)
	else
		pev(ent,pev_origin,ent_origin)
	
	origin[0] -= ent_origin[0]
	origin[1] -= ent_origin[1]
	origin[2] -= ent_origin[2]
	
	static Float:v_length
	v_length = vector_length(origin)
	
	static Float:aim_vector[3]
	aim_vector[0] = origin[0] / v_length
	aim_vector[1] = origin[1] / v_length
	aim_vector[2] = origin[2] / v_length
	
	static Float:new_angles[3]
	vector_to_angle(aim_vector,new_angles)
	
	new_angles[0] *= -1
	
	if(new_angles[1]>180.0) new_angles[1] -= 360
	if(new_angles[1]<-180.0) new_angles[1] += 360
	if(new_angles[1]==180.0 || new_angles[1]==-180.0) new_angles[1]=-179.999999
	
	set_pev(ent,pev_angles,new_angles)
	set_pev(ent,pev_fixangle,1)
	
	return 1;
}

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)) || (dropwhat == 2 && ((1<<weaponid) & SECONDARY_WEAPONS_BIT_SUM)))
		{
			static wname[32], weapon_ent
			get_weaponname(weaponid, wname, charsmax(wname))
			weapon_ent = fm_find_ent_by_owner(-1, wname, id)
			set_pev(weapon_ent, PEV_ADDITIONAL_AMMO, cs_get_user_bpammo(id, weaponid))
			engclient_cmd(id, "drop", wname)
			cs_set_user_bpammo(id, weaponid, 0)
		}
	}
}

public fwdTouch(toucher, touched)
{
	if (!is_user_alive(toucher) || !pev_valid(touched))
		return FMRES_IGNORED
	
	new classname[32]	
	pev(touched, pev_classname, classname, 31)
	if (!equal(classname, ClassName))
		return FMRES_IGNORED
	
	if(get_user_team(toucher) == pev(touched, pev_team))
	{
		emit_sound(toucher, CHAN_STATIC, get_present, 1.0, ATTN_NORM, 0, PITCH_NORM)
		GiveBonus(toucher)
		set_pev(touched, pev_effects, EF_NODRAW)
		set_pev(touched, pev_solid, SOLID_NOT)
		remove_entity(touched)
	}
	return FMRES_IGNORED
}

public AddBonusBox(id)
{
	if(is_user_connected(id) && cs_get_user_team(id) != CS_TEAM_SPECTATOR)
	{
		new ent = fm_create_entity("info_target")
		new origin[3]
		get_user_origin(id, origin, 0)
		set_pev(ent,pev_classname, ClassName)
		switch(cs_get_user_team(id))
		{
			case CS_TEAM_T:
			{
				engfunc(EngFunc_SetModel, ent, mdl_box)
				set_pev(ent,pev_team, 2)
				entity_set_int(ent,EV_INT_iuser1,0) 
				entity_set_int(ent,EV_INT_iuser2,0) 
				entity_set_int(ent,EV_INT_iuser3,200) 
				set_rendering(ent,kRenderFxGlowShell,entity_get_int(ent,EV_INT_iuser1),entity_get_int(ent,EV_INT_iuser2),entity_get_int(ent,EV_INT_iuser3),kRenderNormal,120)
			}
			case CS_TEAM_CT:
			{
				engfunc(EngFunc_SetModel, ent, mdl_box)	
				set_pev(ent,pev_team, 1)
				entity_set_int(ent,EV_INT_iuser1,200) 
				entity_set_int(ent,EV_INT_iuser2,0) 
				entity_set_int(ent,EV_INT_iuser3,0) 
				set_rendering(ent,kRenderFxGlowShell,entity_get_int(ent,EV_INT_iuser1),entity_get_int(ent,EV_INT_iuser2),entity_get_int(ent,EV_INT_iuser3),kRenderNormal,120)
			}
		}
		set_pev(ent, pev_mins, Float:{-10.0,-10.0,0.0})
		set_pev(ent, pev_maxs, Float:{10.0,10.0,25.0})
		set_pev(ent, pev_size, Float:{-10.0,-10.0,0.0,10.0,10.0,25.0})
		engfunc(EngFunc_SetSize, ent, Float:{-10.0,-10.0,0.0}, Float:{10.0,10.0,25.0})
		
		set_pev(ent, pev_solid, SOLID_BBOX)
		set_pev(ent, pev_movetype, MOVETYPE_TOSS)
		
		new Float:fOrigin[3]
		IVecFVec(origin, fOrigin)
		set_pev(ent, pev_origin, fOrigin)
	}
}

public GiveBonus(id)
{	
	if(is_user_alive(id)) 
	{
		switch(random_num(1,6)) 
		{
			case 1: 
			{
				if(pev(id, pev_health) + 20.0 > get_pcvar_num(CvarHpMax))
					set_pev(id, pev_health, get_pcvar_float(CvarHpMax))
				else
					set_pev(id, pev_health, pev(id, pev_health) + 20.0)
				color(id, ".v%s.g Ai gasit.e 20HP.g.", TAG)
			}
			case 2:
			{
				g_money[id] += 2
				color(id, ".v%s.g Ai gasit.e 2$.g.", TAG)
			}
			case 3:
			{
				if(pev(id, pev_armorvalue) + 25.0 > get_pcvar_num(CvarHpMax))
					set_pev(id, pev_armorvalue, get_pcvar_float(CvarHpMax))
				else
					set_pev(id, pev_armorvalue, pev(id, pev_armorvalue) + 25.0)
				color(id, ".v%s.g Ai gasit.e 25AP.g.", TAG)
			}
			case 4:
			{
				g_money[id] += 4
				color(id, ".v%s.g Ai gasit.e 4$.g.", TAG)
			}
			case 5:
			{
				g_money[id] += 6
				color(id, ".v%s.g Ai gasit.e 6$.g.", TAG)
			}
			case 6:
			{
				HasTeleport[id] = true
				g_teleports[id] += 1
				client_cmd(id, "bind ^"alt^" ^"power2^"")
				color(id, ".v%s.g Ai gasit puterea de.e teleportare.g, apasa.e ALT.g pentru a utiliza puterea.", TAG)
			}
		}
	}
}

public CmdTeleport(id)
{
	if(!is_user_alive(id) || !HasTeleport[id])
		return PLUGIN_CONTINUE
	
	if (Teleport_Cooldown[id])
	{
		color(id, ".v%s.g Puterea iti va reveni in:.e %d.g secund%s.", TAG, Teleport_Cooldown[id], Teleport_Cooldown[id] == 1 ? "a" : "e")
		return PLUGIN_CONTINUE
	}
	else if (teleport(id))
	{
		emit_sound(id, CHAN_STATIC, SOUND_BLINK, 1.0, ATTN_NORM, 0, PITCH_NORM)
		remove_task(id)
		g_teleports[id] -= 1
		Teleport_Cooldown[id] = get_pcvar_num(CvarTeleportCooldown)
		set_task(1.0, "ShowHUD", id, _, _, "b")
		set_hudmessage(0, 100, 200, 0.05, 0.60, 0, 1.0, 1.1, 0.0, 0.0, -11)
		show_hudmessage(id, "Puterea iti va reveni in: %d secund%s", Teleport_Cooldown[id], Teleport_Cooldown[id] == 1 ? "a" : "e")
	}
	else
		color(id, ".v%s.g Pozitia de teleportare este invalida!", TAG)
	return PLUGIN_CONTINUE
}

public ShowHUD(id)
{
	if(!is_user_alive(id) || !HasTeleport[id])
	{
		remove_task(id)
		Teleport_Cooldown[id] = 0
		return PLUGIN_HANDLED
	}
	set_hudmessage(0, 100, 200, 0.05, 0.60, 0, 1.0, 1.1, 0.0, 0.0, -11)
	if(is_user_alive(id) && Teleport_Cooldown[id] == 1)
	{
		Teleport_Cooldown[id]--
		show_hudmessage(id, "Puterea iti va reveni in: %d secunda",Teleport_Cooldown[id])
	}
	if(is_user_alive(id) && Teleport_Cooldown[id] > 1)
	{
		Teleport_Cooldown[id]--
		show_hudmessage(id, "Puterea iti va reveni in: %d secunde",Teleport_Cooldown[id])
	}
	if(is_user_alive(id) && Teleport_Cooldown[id] <= 0)
	{
		show_hudmessage(id, "Ti-a revenit puterea")
		color(id, ".v%s.g Poti folosi din nou puterea de a te teleporta!", TAG)
		remove_task(id)
		Teleport_Cooldown[id] = 0
	}
	return PLUGIN_HANDLED
}

bool:teleport(id)
{
	new Float:vOrigin[3], Float:vNewOrigin[3],
	Float:vNormal[3], Float:vTraceDirection[3],
	Float:vTraceEnd[3]
	
	pev(id, pev_origin, vOrigin)
	
	velocity_by_aim(id, get_pcvar_num(CvarTeleportRange), vTraceDirection)
	xs_vec_add(vTraceDirection, vOrigin, vTraceEnd)
	
	engfunc(EngFunc_TraceLine, vOrigin, vTraceEnd, DONT_IGNORE_MONSTERS, id, 0)
	
	new Float:flFraction
	get_tr2(0, TR_flFraction, flFraction)
	if (flFraction < 1.0)
	{
		get_tr2(0, TR_vecEndPos, vTraceEnd)
		get_tr2(0, TR_vecPlaneNormal, vNormal)
	}
	
	xs_vec_mul_scalar(vNormal, 40.0, vNormal)
	xs_vec_add(vTraceEnd, vNormal, vNewOrigin)
	
	if (is_player_stuck(id, vNewOrigin))
		return false
	
	emit_sound(id, CHAN_STATIC, SOUND_BLINK, 1.0, ATTN_NORM, 0, PITCH_NORM)
	tele_effect(vOrigin)
	
	engfunc(EngFunc_SetOrigin, id, vNewOrigin)
	
	tele_effect2(vNewOrigin)
	
	if(is_user_connected(id))
		UTIL_ScreenFade(id, get_color(CvarColor), get_pcvar_float(CvarFadeTime), get_pcvar_float(CvarFadeTime), 75)
	return true
}

stock is_player_stuck(id, Float:originF[3])
{
	engfunc(EngFunc_TraceHull, originF, originF, 0, (pev(id, pev_flags) & FL_DUCKING) ? HULL_HEAD : HULL_HUMAN, id, 0)
	
	if (get_tr2(0, TR_StartSolid) || get_tr2(0, TR_AllSolid) || !get_tr2(0, TR_InOpen))
		return true
	
	return false
}

stock tele_effect(const Float:torigin[3])
{
	new origin[3]
	origin[0] = floatround(torigin[0])
	origin[1] = floatround(torigin[1])
	origin[2] = floatround(torigin[2])
	
	message_begin(MSG_PAS, SVC_TEMPENTITY, origin)
	write_byte(TE_BEAMCYLINDER)
	write_coord(origin[0])
	write_coord(origin[1])
	write_coord(origin[2]+10)
	write_coord(origin[0])
	write_coord(origin[1])
	write_coord(origin[2]+60)
	write_short(Sprite)
	write_byte(0)
	write_byte(0)
	write_byte(3)
	write_byte(60)
	write_byte(0)
	write_byte(255)
	write_byte(255)
	write_byte(255)
	write_byte(255)
	write_byte(0)
	message_end()
}

stock tele_effect2(const Float:torigin[3])
{
	new origin[3]
	origin[0] = floatround(torigin[0])
	origin[1] = floatround(torigin[1])
	origin[2] = floatround(torigin[2])
	
	message_begin(MSG_PAS, SVC_TEMPENTITY, origin)
	write_byte(TE_BEAMCYLINDER)
	write_coord(origin[0])
	write_coord(origin[1])
	write_coord(origin[2]+10)
	write_coord(origin[0])
	write_coord(origin[1])
	write_coord(origin[2]+60)
	write_short(Sprite)
	write_byte(0)
	write_byte(0)
	write_byte(3)
	write_byte(60)
	write_byte(0)
	write_byte(255)
	write_byte(255)
	write_byte(255)
	write_byte(255)
	write_byte(0)
	message_end()
	
	message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
	write_byte(TE_SPRITETRAIL)
	write_coord(origin[0])
	write_coord(origin[1])
	write_coord(origin[2]+40)
	write_coord(origin[0])
	write_coord(origin[1])
	write_coord(origin[2])
	write_short(Sprite2)
	write_byte(30)
	write_byte(10)
	write_byte(1)
	write_byte(50)
	write_byte(10)
	message_end()
}	

get_color(pcvar)
{
	new iColor[3], szColor[10]
	get_pcvar_string(pcvar, szColor, charsmax(szColor))
	new c = str_to_num(szColor)
	
	iColor[Red] = c / 1000000
	c %= 1000000
	iColor[Green] = c / 1000
	iColor[Blue] = c % 1000
	
	return iColor
}

stock FixedUnsigned16(Float:flValue, iScale)
{
	new iOutput
	iOutput = floatround(flValue * iScale)
	
	if (iOutput < 0)
		iOutput = 0
	
	if (iOutput > 0xFFFF)
		iOutput = 0xFFFF
	
	return iOutput
}

stock UTIL_ScreenFade(id=0,iColor[3]={0,0,0},Float:flFxTime=-1.0,Float:flHoldTime=0.0,iAlpha=0,iFlags=FFADE_IN,bool:bReliable=false,bool:bExternal=false)
{
	if(id && !is_user_connected(id))
		return
	
	new iFadeTime
	if(flFxTime == -1.0)
	{
		iFadeTime = 4
	}
	else
	{
		iFadeTime = FixedUnsigned16(flFxTime , 1<<12)
	}
	
	static gmsgScreenFade
	if(!gmsgScreenFade)
	{
		gmsgScreenFade = get_user_msgid("ScreenFade")
	}
	
	new MSG_DEST
	if(bReliable)
	{
		MSG_DEST = id ? MSG_ONE : MSG_ALL
	}
	else
	{
		MSG_DEST = id ? MSG_ONE_UNRELIABLE : MSG_BROADCAST
	}
	
	if(bExternal)
	{
		emessage_begin(MSG_DEST, gmsgScreenFade, _, id)
		ewrite_short(iFadeTime)
		ewrite_short(FixedUnsigned16(flHoldTime , 1<<12))
		ewrite_short(iFlags)
		ewrite_byte(iColor[Red])
		ewrite_byte(iColor[Green])
		ewrite_byte(iColor[Blue])
		ewrite_byte(iAlpha)
		emessage_end()
	}
	else
	{
		message_begin(MSG_DEST, gmsgScreenFade, _, id)
		write_short(iFadeTime)
		write_short(FixedUnsigned16(flHoldTime , 1<<12))
		write_short(iFlags)
		write_byte(iColor[Red])
		write_byte(iColor[Green])
		write_byte(iColor[Blue])
		write_byte(iAlpha)
		message_end()
	}
}

stock UTIL_FadeToBlack(id,Float:fxtime=3.0,bool:bReliable=false,bool:bExternal=false)
	UTIL_ScreenFade(id, _, fxtime, fxtime, 255, FFADE_OUT|FFADE_STAYOUT,bReliable,bExternal)
	
public Light(entity, red, green, blue)
{	
	if(is_valid_ent(entity))
	{
		static Float:origin[3]
		pev(entity, pev_origin, origin)
		
		message_begin(MSG_BROADCAST, SVC_TEMPENTITY, _, entity)
		write_byte(TE_DLIGHT)
		engfunc(EngFunc_WriteCoord, origin[0])
		engfunc(EngFunc_WriteCoord, origin[1])
		engfunc(EngFunc_WriteCoord, origin[2])
		write_byte(7) 
		write_byte(red)
		write_byte(green)
		write_byte(blue)
		write_byte(2)
		write_byte(0)
		message_end()
	}
}

public shop_menu(id)
{
	if(!is_user_connected(id))
		return;
		
	static menu_name[75];
	formatex(menu_name, charsmax(menu_name), "Ultimate Remaked Furien Shop^nDolari: %d^n", g_money[id])
	static menu;
	menu = menu_create(menu_name, "shop_handler");

	static i_menu[100];

	if(!(get_user_flags(id) & VIP_FLAG))
		formatex(i_menu, charsmax(i_menu), "\d%s\R [ONLY VIP]", items_menu[0])
	else
	{
		if(!is_user_alive(id))
			formatex(i_menu, charsmax(i_menu), "\d%s\R [ONLY ALIVE]", items_menu[0])
		else
		{
			switch(get_user_team(id))
			{
				case 1: formatex(i_menu, charsmax(i_menu), "\d%s\R [ONLY ANTI-FURIEN]", items_menu[0])
				case 2:
				{
					if(g_ak47[id])
						formatex(i_menu, charsmax(i_menu), "\y%s\r\R [ALREADY HAVE]", items_menu[0])
					else
					{
						if(g_money[id] < cost[0])
							formatex(i_menu, charsmax(i_menu), "\d%s\R %d", items_menu[0], cost[0])
						else
							formatex(i_menu, charsmax(i_menu), "\y%s\r\R %d", items_menu[0], cost[0])
					}
				}
			}
		}
	}
	menu_additem(menu, i_menu, "")
	if(!(get_user_flags(id) & VIP_FLAG))
		formatex(i_menu, charsmax(i_menu), "\d%s\R [ONLY VIP]", items_menu[1])
	else
	{
		if(!is_user_alive(id))
			formatex(i_menu, charsmax(i_menu), "\d%s\R [ONLY ALIVE]", items_menu[1])
		else
		{
			switch(get_user_team(id))
			{
				case 1: formatex(i_menu, charsmax(i_menu), "\d%s\R [ONLY ANTI-FURIEN]", items_menu[1])
				case 2:
				{
					if(g_m4a1[id])
						formatex(i_menu, charsmax(i_menu), "\y%s\r\R [ALREADY HAVE]", items_menu[1])
					else
					{
						if(g_money[id] < cost[1])
							formatex(i_menu, charsmax(i_menu), "\d%s\R %d", items_menu[1], cost[1])
						else
							formatex(i_menu, charsmax(i_menu), "\y%s\r\R %d", items_menu[1], cost[1])
					}
				}
			}
		}
	}
	menu_additem(menu, i_menu, "")
	if(!(get_user_flags(id) & VIP_FLAG))
		formatex(i_menu, charsmax(i_menu), "\d%s\R [ONLY VIP]", items_menu[2])
	else
	{
		if(!is_user_alive(id))
			formatex(i_menu, charsmax(i_menu), "\d%s\R [ONLY ALIVE]", items_menu[2])
		else
		{
			switch(get_user_team(id))
			{
				case 1: formatex(i_menu, charsmax(i_menu), "\d%s\R [ONLY ANTI-FURIEN]", items_menu[2])
				case 2:
				{
					if(g_deagle[id])
						formatex(i_menu, charsmax(i_menu), "\y%s\r\R [ALREADY HAVE]", items_menu[2])
					else
					{
						if(g_money[id] < cost[2])
							formatex(i_menu, charsmax(i_menu), "\d%s\R %d", items_menu[2], cost[2])
						else
							formatex(i_menu, charsmax(i_menu), "\y%s\r\R %d", items_menu[2], cost[2])
					}
				}
			}
		}
	}
	menu_additem(menu, i_menu, "")
	if(!(get_user_flags(id) & VIP_FLAG))
		formatex(i_menu, charsmax(i_menu), "\d%s\R [ONLY VIP]", items_menu[3])
	else
	{
		if(!is_user_alive(id))
		{
			if(g_used_life[id])
				formatex(i_menu, charsmax(i_menu), "\y%s\r\R [USED]", items_menu[3])
			else
			{
				if(g_money[id] < cost[3])
					formatex(i_menu, charsmax(i_menu), "\d%s\R %d", items_menu[3], cost[3])
				else
					formatex(i_menu, charsmax(i_menu), "\y%s\r\R %d", items_menu[3], cost[3])
			}
		}
		else
			formatex(i_menu, charsmax(i_menu), "\d%s\R [ONLY DEAD]", items_menu[3])
	}
	menu_additem(menu, i_menu, "")
	if(!(get_user_flags(id) & VIP_FLAG))
		formatex(i_menu, charsmax(i_menu), "\d%s\R [ONLY VIP]", items_menu[4])
	else
	{
		if(!is_user_alive(id))
			formatex(i_menu, charsmax(i_menu), "\d%s\R [ONLY ALIVE]", items_menu[4])
		else
		{
			switch(get_user_team(id))
			{
				case 1: formatex(i_menu, charsmax(i_menu), "\d%s\R [ONLY ANTI-FURIEN]", items_menu[4])
				case 2:
				{
					if(g_pet[id])
						formatex(i_menu, charsmax(i_menu), "\y%s\r\R [ALREADY HAVE]", items_menu[4])
					else
					{
						if(g_money[id] < cost[4])
							formatex(i_menu, charsmax(i_menu), "\d%s\R %d", items_menu[4], cost[4])
						else
							formatex(i_menu, charsmax(i_menu), "\y%s\r\R %d", items_menu[4], cost[4])
					}
				}
			}
		}
	}
	menu_additem(menu, i_menu, "")
	menu_display(id, menu, 0)
}

public donate(id, arg[])
{
	static cui[32], count[10];
	strbreak(arg, cui, 31, count, 9)
	
	if(!cui[0] || !count[0])
	{
		color(id, ".v%s.g Comanda se foloseste sub forma urmatoare:.e /donate nume bani.g.", TAG)
		return
	}
	static credite_trimise, credite;
	credite_trimise = g_money[id]
	if(equal(count, "all"))
		credite = credite_trimise
	else
		credite = str_to_num(count)
	
	if(credite <= 0)
	{
		color(id, ".v%s.g Valoarea introdusa de tine este invalida.", TAG)
		return
	}
	credite_trimise -= credite
	if(credite_trimise < 0)
	{
		credite += credite_trimise
		credite_trimise = 0
	}
	static primitor;
	primitor = cmd_target(id, cui, (CMDTARGET_ALLOW_SELF))
	if(!primitor || primitor == id)
	{
		color(id, ".v%s.e %s.g nu exista pe server.", TAG, cui)
		return
	}
	g_money[primitor] += credite
	g_money[id] = credite_trimise
	
	color(0, ".v%s.e %s.g ii trimite lui.e %s %d$.g.", TAG, get_name(id), get_name(primitor), credite)
}

public shop_handler(id, menu, item)
{
	if(!(get_user_flags(id) & VIP_FLAG))
	{
		color(id, ".v%s.g Trebuie sa detii.e VIP.g pentru a folosi acest shop.", TAG)
		menu_destroy(menu);
		return PLUGIN_HANDLED;
	}
	if(item == MENU_EXIT)
    {
        menu_destroy(menu);
        return PLUGIN_HANDLED;
    }
	
	if(g_money[id] < cost[item])
	{
		color(id, ".v%s.g Nu ai destule credite sa cumperi.e %s.g. Iti mai trebuiesc.e %d.g dolari.", TAG, items_menu[item], cost[item] - g_money[id])
		menu_destroy(menu);
		return PLUGIN_HANDLED;
	}
	
	switch(item)
	{
		case 0:
		{
			if(!is_user_alive(id))
			{
				color(id, ".v%s.g Trebuie sa fii in viata pentru a putea cumpara.e %s.g", items_menu[item])
				menu_destroy(menu);
				return PLUGIN_HANDLED;
			}
			if(get_user_team(id) != 2)
			{
				color(id, ".v%s.g Trebuie sa fii.e Anti-Furien.g pentru a putea cumpara.e %s.g.", TAG, items_menu[item])
				menu_destroy(menu);
				return PLUGIN_HANDLED;
			}
			if(g_ak47[id])
			{
				color(id, ".v%s.g Ai deja.e %s.g.", TAG, items_menu[item])
				menu_destroy(menu);
				return PLUGIN_HANDLED;
			}
			drop_weapons(id, 1)
			g_ak47[id] = true
			give_item(id, "weapon_ak47")
			cs_set_user_bpammo(id, CSW_AK47, 90)
		}
		case 1:
		{
			if(!is_user_alive(id))
			{
				color(id, ".v%s.g Trebuie sa fii in viata pentru a putea cumpara.e %s.g", items_menu[item])
				menu_destroy(menu);
				return PLUGIN_HANDLED;
			}
			if(get_user_team(id) != 2)
			{
				color(id, ".v%s.g Trebuie sa fii.e Anti-Furien.g pentru a putea cumpara.e %s.g.", TAG, items_menu[item])
				menu_destroy(menu);
				return PLUGIN_HANDLED;
			}
			if(g_m4a1[id])
			{
				color(id, ".v%s.g Ai deja.e %s.g.", TAG, items_menu[item])
				menu_destroy(menu);
				return PLUGIN_HANDLED;
			}
			drop_weapons(id, 1)
			g_m4a1[id] = true
			give_item(id, "weapon_m4a1")
			cs_set_user_bpammo(id, CSW_M4A1, 90)
		}
		case 2:
		{
			if(!is_user_alive(id))
			{
				color(id, ".v%s.g Trebuie sa fii in viata pentru a putea cumpara.e %s.g", items_menu[item])
				menu_destroy(menu);
				return PLUGIN_HANDLED;
			}
			if(get_user_team(id) != 2)
			{
				color(id, ".v%s.g Trebuie sa fii.e Anti-Furien.g pentru a putea cumpara.e %s.g.", TAG, items_menu[item])
				menu_destroy(menu);
				return PLUGIN_HANDLED;
			}
			if(g_deagle[id])
			{
				color(id, ".v%s.g Ai deja.e %s.g.", TAG, items_menu[item])
				menu_destroy(menu);
				return PLUGIN_HANDLED;
			}
			drop_weapons(id, 2)
			g_deagle[id] = true
			give_item(id, "weapon_deagle")
			cs_set_user_bpammo(id, CSW_DEAGLE, 90)
		}
		case 3:
		{
			if(is_user_alive(id))
			{
				color(id, ".v%s.g Trebuie sa fii.e mort.g pentru a folosi.e %s.g.", TAG, items_menu[item])
				menu_destroy(menu);
				return PLUGIN_HANDLED;
			}
			if(get_user_team(id) == 3)
			{
				color(id, ".v%s.g Esti spectator si nu poti folosi.e %s.g.", TAG, items_menu[item])
				menu_destroy(menu);
				return PLUGIN_HANDLED;
			}
			if(g_used_life[id])
			{
				color(id, ".v%s.g Ai folosit deja.e %s.g.", TAG, items_menu[item])
				menu_destroy(menu);
				return PLUGIN_HANDLED;
			}
			g_used_life[id] = true
			ExecuteHamB(Ham_CS_RoundRespawn, id)
		}
		case 4:
		{
			if(!is_user_alive(id))
			{
				color(id, ".v%s.g Trebuie sa fii.e viu.g pentru a folosi.e %s.g.", TAG, items_menu[item])
				menu_destroy(menu);
				return PLUGIN_HANDLED;
			}
			if(get_user_team(id) != 2)
			{
				color(id, ".v%s.g Trebuie sa fii.e Anti-Furien.g pentru a folosi.e %s.g.", TAG, items_menu[item])
				menu_destroy(menu);
				return PLUGIN_HANDLED;
			}
			if(g_pet[id])
			{
				color(id, ".v%s.g Ai deja.e %s.g.", TAG, items_menu[item])
				menu_destroy(menu);
				return PLUGIN_HANDLED;
			}
			create_pet(id)
			set_pev(id, pev_health, 200.0)
			set_pev(id, pev_armorvalue, 200.0)
			set_pev(id, pev_gravity, 0.5)
		}
	}
	g_money[id] -= cost[item]
	check_weapon(id)
	color(id, ".v%s.g Ai cumparat.e %s.g pentru.e %d$.g.", TAG, items_menu[item], cost[item])
	menu_destroy(menu);
	return PLUGIN_HANDLED;	
}

public create_pet(id)
{
	item_pet[id] = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString,"info_target"))
	set_pev(item_pet[id], pev_classname, "bat")
	
	engfunc(EngFunc_SetModel,item_pet[id],pet_model)
	
	new Float:origin[3]
	pev(id,pev_origin,origin)			
	
	set_pev(item_pet[id],pev_origin,origin)
	set_pev(item_pet[id],pev_solid,SOLID_TRIGGER)
	set_pev(item_pet[id],pev_movetype,MOVETYPE_FLY)
	set_pev(item_pet[id],pev_owner,33)
	set_pev(item_pet[id],pev_nextthink,1.0)
	set_pev(item_pet[id],pev_sequence,0)
	set_pev(item_pet[id],pev_gaitsequence,0)
	set_pev(item_pet[id],pev_framerate,1.0)	
	
	engfunc(EngFunc_EmitSound,item_pet[id],CHAN_AUTO,pet_sounds[random_num(0,sizeof pet_sounds - 1)],1.0, 1.2, 0, PITCH_NORM)	
	
	client_print(id, print_center, "Ai primit liliacul magic")		
	
	g_pet[id] = true
	return PLUGIN_HANDLED
}

public checkandupdatetop(id, leveles, ori, minuti) 
{	

	static name[32];
	get_user_name(id, name, charsmax(name) - 1);
	for(new i = INFO_ZERO; i < NTOP; i++)
	{
		if(leveles > toplevels[i] || leveles == toplevels[i] && ori > tophours[i] && minuti > topminutes[i] || leveles == toplevels[i] && ori == tophours[i] && minuti > topminutes[i])
		{
			new pos = i;	
			while(!equal(topnames[pos],name) && pos < NTOP)
				pos++;
			
			for(new j = pos; j > i; j--)
			{
				formatex(topnames[j], 31, topnames[j-1]);
				toplevels[j] = toplevels[j-1];
				tophours[j] = tophours[j-1];
				topminutes[j] = topminutes[j-1];
			}
			formatex(topnames[i], charsmax(name) - 1, name);
			toplevels[i] = leveles;
			tophours[i]= ori;
			topminutes[i] = minuti;
			save_top();
			break;
		}
		else if(equal(topnames[i], name)) 
		break;	
	}
}
public read_top() 
{
	new Buffer[256],path[128];
	formatex(path, 127, "%s/TopLevels.dat", data_save);
	
	new f = fopen(path, "rt");
	new i = INFO_ZERO;
	while(!feof(f) && i < NTOP+1)
	{
		fgets(f, Buffer, 255)
		new niveluri[25], hours[25], minutes[25];
		parse(Buffer, topnames[i], 31, niveluri, 25,  hours, 25, minutes, 25);
		toplevels[i] = str_to_num(niveluri);
		tophours[i]= str_to_num(hours);
		topminutes[i]= str_to_num(minutes);
		
		i++;
	}
	fclose(f);
}
public show_top(id) 
{	
	static buffer[2368], name[131], len, i;
	len = format(buffer[len], 2367-len,"<STYLE>body{background:#232323;color:#cfcbc2;font-family:sans-serif}table{border-style:solid;border-width:1px;border-color:#FFFFFF;font-size:13px}</STYLE><table align=center width=100%% cellpadding=2 cellspacing=0");
	len += format(buffer[len], 2367-len, "<tr align=center bgcolor=#52697B><th width=4%% > # <th width=24%%> NAME <th width=24%%>LEVEL <th width=24%%> HOURS <th  width=24%%> MINUTES");	
	for(i = INFO_ZERO; i < NTOP; i++)
	{		
			if(tophours[i] == 0 && topminutes[i] == 0)
				len += format(buffer[len], 2367-len, "<tr align=center bgcolor=#232323><td> %d <td> %s <td> %s<td> %s <td> %s", (i+1), "-", "-", "-","-");
			else 
			{
				name = topnames[i];
				while(containi(name, "<") != -1)
					replace(name, 129, "<", "&lt;");
				while(containi(name, ">") != -1)
					replace(name, 129, ">", "&gt;");
				static plname[32];
				get_user_name(id, plname ,32);
				if(equal(topnames[i],plname)) 
					len += format(buffer[len], 2367-len, "<tr align=center bgcolor=#2D2D2D><td> %d <td> %s <td> %d<td> %d <td> %d", (i+1), name, toplevels[i], tophours[i], topminutes[i]);
				else
					len += format(buffer[len], 2367-len, "<tr align=center bgcolor=#232323><td> %d <td> %s <td> %d<td> %d <td> %d", (i+1), name, toplevels[i], tophours[i], topminutes[i]);
			}
		}
	len += format(buffer[len], 2367-len, "</table>");
	len += formatex(buffer[len], 2367-len, "<tr align=bottom font-size:11px><Center><br><br><br><br>TOP 10 LEVELS</body>");
	static strin[20];
	format(strin,33, "TOP 10 LEVELS");
	show_motd(id, buffer, strin);
}

create_thunder(const Float:vec1[3], const Float:vec2[3])
{
	engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, vec2, 0)
	write_byte(0)
	engfunc(EngFunc_WriteCoord, vec1[0])
	engfunc(EngFunc_WriteCoord, vec1[1])
	engfunc(EngFunc_WriteCoord, vec1[2])
	engfunc(EngFunc_WriteCoord, vec2[0])
	engfunc(EngFunc_WriteCoord, vec2[1])
	engfunc(EngFunc_WriteCoord, vec2[2])
	write_short(lighting)
	write_byte(1)
	write_byte(5)
	write_byte(2)
	write_byte(20)
	write_byte(30)
	write_byte(200)
	write_byte(200)
	write_byte(200)
	write_byte(200)
	write_byte(200)
	message_end()

	engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, vec2, 0)
	write_byte(TE_SPARKS)
	engfunc(EngFunc_WriteCoord, vec2[0])
	engfunc(EngFunc_WriteCoord, vec2[1])
	engfunc(EngFunc_WriteCoord, vec2[2])
	message_end()
	
	engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, vec2, 0)
	write_byte(TE_SMOKE)
	engfunc(EngFunc_WriteCoord, vec2[0])
	engfunc(EngFunc_WriteCoord, vec2[1])
	engfunc(EngFunc_WriteCoord, vec2[2])
	write_short(smoke_spr)
	write_byte(10)
	write_byte(10)
	message_end()
}

make_HideWeapon(plr, flags)
{
	static i; i = plr ? plr : get_player();
	if(!i)
		return 0;
	message_begin(plr ? MSG_ONE : MSG_ALL, g_msgHideWeapon, {0, 0, 0}, plr);
	write_byte(flags);
	message_end();
	return 1;
}

get_player()
{
	for( new plr = 1; plr <= g_iMaxPlayers; plr++ )
	{
		if( IsPlayer(plr))
		{
			return plr;
		}
	}
	
	return 0;
}

stock UTIL_CreateFlares(const iOrigin[3], const iSpriteID, const iCount, const iLife, const iScale)
{
	message_begin(MSG_BROADCAST,SVC_TEMPENTITY);
	write_byte(TE_SPRITETRAIL);
	write_coord(iOrigin[0]);
	write_coord(iOrigin[1]);
	write_coord(iOrigin[2]);
	write_coord(iOrigin[0]);
	write_coord(iOrigin[1]);
	write_coord(iOrigin[2] + random_num(5, 10));
	write_short(iSpriteID);
	write_byte(iCount);
	write_byte(iLife);
	write_byte(iScale);
	write_byte(random_num(30, 50));
	write_byte(random_num(10, 15));
	message_end();
}

public hook_drop(id)
{
	if(!is_user_alive(id))
		return PLUGIN_CONTINUE;
		
	if(get_user_team(id) == 1)
	{
		client_print(id, print_center, "Nu poti arunca nimic!")
		return PLUGIN_HANDLED;
	}
	return PLUGIN_CONTINUE;
}

public CountDown()
{
	if(g_endround)
		return;
		
	set_dhudmessage(random(255), random(255), random(255), -1.0, 0.24, 1, 0.0, 1.0, 0.0, 0.0)
	SecondsUntillInvasion -= 1
	switch(SecondsUntillInvasion)
	{
		case 0:
		{
			show_dhudmessage(0, "Furienii ataca planeta in o secunda.")
			TerroTeamEffects()
			CounterTeamEffects()
			PlaySound(start_sounds[SecondsUntillInvasion])
			return
		}
		case 1:
		{
			PlaySound(start_sounds[SecondsUntillInvasion])
			show_dhudmessage(0, "Furienii ataca planeta in doua secunde.")
			TerroTeamEffects()
			CounterTeamEffects()
		}
		case 2:
		{
			PlaySound(start_sounds[SecondsUntillInvasion])
			show_dhudmessage(0, "Furienii ataca planeta in trei secunde.")
			TerroTeamEffects()
			CounterTeamEffects()
		}
		case 3:
		{
			PlaySound(start_sounds[SecondsUntillInvasion])
			show_dhudmessage(0, "Furienii ataca planeta in patru secunde.")
			TerroTeamEffects()
			CounterTeamEffects()
		}
		case 4:
		{
			PlaySound(start_sounds[SecondsUntillInvasion])
			show_dhudmessage(0, "Furienii ataca planeta in cinci secunde.")
			TerroTeamEffects()
			CounterTeamEffects()
		}
	}	
	set_task(1.0, "CountDown");
} 

public TerroTeamEffects()
{
	new iPlayers[32];
	new iPlayersNum;
	
	get_players(iPlayers, iPlayersNum, "aceh", "TERRORIST");
	
	for(new i = 0 ; i < iPlayersNum ; i++)
	{
		if(IsPlayer(iPlayers[i]))
		{      
			ShakeScreen(iPlayers[i], 0.9);
			FadeScreen(iPlayers[i], 0.5, 230, 40, 0, 180);
		}
	}
}
public CounterTeamEffects()
{
	new iPlayers[32];
	new iPlayersNum;
	
	get_players(iPlayers, iPlayersNum, "aceh", "CT");
	
	for(new i = 0; i < iPlayersNum ; i++)
	{
		if(IsPlayer(iPlayers[i]))
		{      
			ShakeScreen(iPlayers[i], 0.9);
			FadeScreen(iPlayers[i], 0.5, 0, 40, 230, 180);
		}
	}
}

public task_CanPlant() 
{
	set_lights("d")
	if(active_fog)
		msg_create_fog(random(255), random(255), random(255), 2)
	g_dontdelete = true
	remove_task(TASK_REMOVEC4)
	static CT, TERO, salvator, distrugator;
	CT = fnGetAliveCT();
	if(CT < 1)
		return;
		
	TERO = fnGetAliveT();
	if(TERO < 1)
		return;
	
	salvator = fnGetRandomAliveCT(random_num(1, CT))
	distrugator = fnGetRandomAliveT(random_num(1, TERO))
	g_end_health[distrugator] = get_user_health(distrugator)
	g_end_health[salvator] = get_user_health(salvator)
	set_user_health(salvator, 200)
	savior[salvator] = true
	cs_set_user_defuse(salvator, 1)
	set_task(0.1, "savior_aura", salvator+TASK_AURA, _, _, "b")
	set_user_health(distrugator, 135)
	destroyer[distrugator] = true
	ham_give_weapon(distrugator, "weapon_c4")
	cs_set_user_plant(distrugator, 1, 1);
	engclient_cmd(distrugator, "weapon_knife")
	check_weapon(distrugator)
	set_hudmessage(200, 30, 20, -1.0, 0.15, 1, 3.1, 3.0)
	ShowSyncHudMsg(0, event_hud, "Bomba cu plasma poate fi plantata!^n%s a fost ales ca EROU!!!^n%s a fost ales ca DISTRUGATOR!!!", get_name(salvator), get_name(distrugator))
}

public select_destroyer()
{
	if(g_endround)
		return;
	
	static TERO, distrugator;
	TERO = fnGetAliveT();
	if(TERO < 1)
		return;
		
	distrugator = fnGetRandomAliveT(random_num(1, TERO))
	g_end_health[distrugator] = get_user_health(distrugator)
	set_user_health(distrugator, 135)
	color(0, ".v%s.e %s.g a fost ales NOUL.e DISTRUGATOR.g.", TAG, get_name(distrugator))
	destroyer[distrugator] = true
	if(!b_planted)
	{
		ham_give_weapon(distrugator, "weapon_c4")
		cs_set_user_plant(distrugator, 1, 1);
	}
	engclient_cmd(distrugator, "weapon_knife")
	check_weapon(distrugator)
}

public select_savior()
{
	if(g_endround)
		return;
	
	static CT, salvator;
	CT = fnGetAliveCT();
	if(CT < 1)
		return;
		
	salvator = fnGetRandomAliveCT(random_num(1, CT))
	g_end_health[salvator] = get_user_health(salvator)
	set_user_health(salvator, 200)
	color(0, ".v%s.e %s.g a fost ales NOUL EROU.", TAG, get_name(salvator))
	savior[salvator] = true
	cs_set_user_defuse(salvator, 1);
}

public savior_aura(taskid)
{
	if(!savior[ID_AURA] || !is_user_alive(ID_AURA))
	{
		remove_task(taskid);
		return;
	}
	static origin[3]
	get_user_origin(ID_AURA, origin)

	message_begin(MSG_PVS, SVC_TEMPENTITY, origin)
	write_byte(TE_DLIGHT)
	write_coord(origin[0])
	write_coord(origin[1])
	write_coord(origin[2])
	write_byte(20)
	write_byte(0)
	write_byte(200)
	write_byte(50)
	write_byte(2)
	write_byte(0)
	message_end()
}

public score_attrib(msgid, dest, id)
{
	static juc, attrib;
	juc = get_msg_arg_int(1);
	attrib = get_msg_arg_int(2);
	
	if(attrib == ATTRIB_BOMB)
	{
		if(destroyer[juc] && user_has_weapon(juc, CSW_C4))
			return PLUGIN_CONTINUE;
		else
			set_msg_arg_int(2, ARG_BYTE, 0)
		return PLUGIN_HANDLED;
	}
	return PLUGIN_CONTINUE;
}

public status_icon(msgid, dest, id)
{
	static juc, icon[3];
	juc = get_msg_arg_int(1);
	get_msg_arg_string(2, icon, 2);
	if((icon[0] == 'c' && icon[1] == '4'))
	{
		if(destroyer[juc])
			return PLUGIN_CONTINUE;
		return PLUGIN_HANDLED;
	}
	return PLUGIN_CONTINUE
}

fnGetAliveCT()
{
	static iAlive, id
	iAlive = 0
	
	for (id = 1; id <= g_iMaxPlayers; id++)
	{
		if(is_user_alive(id) && get_user_team(id) == 2)
			iAlive++
	}
	
	return iAlive;
}

fnGetRandomAliveCT(n)
{
	static iAlive, id
	iAlive = 0
	
	for (id = 1; id <= g_iMaxPlayers; id++)
	{
		if(is_user_alive(id) && get_user_team(id) == 2)
			iAlive++
		
		if(iAlive == n)
			return id;
	}
	
	return -1;
}

fnGetAliveT()
{
	static iAlive, id
	iAlive = 0
	
	for (id = 1; id <= g_iMaxPlayers; id++)
	{
		if(is_user_alive(id) && get_user_team(id) == 1)
			iAlive++
	}
	
	return iAlive;
}

fnGetRandomAliveT(n)
{
	static iAlive, id
	iAlive = 0
	
	for (id = 1; id <= g_iMaxPlayers; id++)
	{
		if(is_user_alive(id) && get_user_team(id) == 1)
			iAlive++
		
		if(iAlive == n)
			return id;
	}
	
	return -1;
}

public ShakeScreen(id, const Float:seconds)
{
	message_begin(MSG_ONE_UNRELIABLE, g_screenshake, {0, 0, 0}, id);
	write_short(floatround(4096.0 * seconds, floatround_round));
	write_short(floatround(4096.0 * seconds, floatround_round));
	write_short(1<<13);
	message_end();
}

public FadeScreen(id, const Float:seconds, const red, const green, const blue, const alpha)
{      
	message_begin(MSG_ONE_UNRELIABLE, g_msgScreenFade, _, id);
	write_short(floatround(4096.0 * seconds, floatround_round));
	write_short(floatround(4096.0 * seconds, floatround_round));
	write_short(0x0000);
	write_byte(red);
	write_byte(green);
	write_byte(blue);
	write_byte(alpha);
	message_end();
}

public shop_enter(id)
{
	if(get_user_team(id) == 3)
		return PLUGIN_CONTINUE;
		
	switch(get_user_team(id))
	{
		case 1: shop_furien(id)
		case 2: shop_anti_furien(id)
	}
	return PLUGIN_HANDLED;
}

public shop_furien(id)
{
	static menu_name[128];
	formatex(menu_name, charsmax(menu_name), "\yShop Furien^n\rBani: %i$^n^n", g_money[id])
	new menu = menu_create(menu_name, "furien_handler")
	static menu_item[80], tasta[2];
	for(new i = 0; i < sizeof FURIEN_ITEMS; i++)
	{
		if(g_money[id] < FURIEN_COST[i])
			formatex(menu_item, charsmax(menu_item), "\d%s\R %d$", FURIEN_ITEMS[i], FURIEN_COST[i])
		else
			formatex(menu_item, charsmax(menu_item), "\y%s\r\R %d$", FURIEN_ITEMS[i], FURIEN_COST[i])
		tasta[0] = i
		tasta[1] = 0
		menu_additem(menu, menu_item, tasta)
	}
	if(pev_valid(id) == PDATA_SAFE)
		set_pdata_int(id, OFFSET_CSMENUCODE, 0, OFFSET_LINUX)
	menu_display(id, menu, 0)
}

public get_bomb()
	remove_c4()

public delete_c4()
{
	if(g_dontdelete)
	{
		remove_task(TASK_REMOVEC4)
		return;
	}
	remove_c4()
}

public shop_anti_furien(id)
{
	static menu_name[128];
	formatex(menu_name, charsmax(menu_name), "\yShop Anti-Furien^n\rBani: %i$^n^n", g_money[id])
	new menu = menu_create(menu_name, "anti_furien_handler")
	static menu_item[80], tasta[2];
	for(new i = 0; i < sizeof ANTI_FURIEN_ITEMS; i++)
	{
		if(g_money[id] < ANTI_FURIEN_COST[i])
			formatex(menu_item, charsmax(menu_item), "\d%s\R %d$", ANTI_FURIEN_ITEMS[i], ANTI_FURIEN_COST[i])
		else
			formatex(menu_item, charsmax(menu_item), "\y%s\r\R %d$", ANTI_FURIEN_ITEMS[i], ANTI_FURIEN_COST[i])
		tasta[0] = i
		tasta[1] = 0
		menu_additem(menu, menu_item, tasta)
	}
	if(pev_valid(id) == PDATA_SAFE)
		set_pdata_int(id, OFFSET_CSMENUCODE, 0, OFFSET_LINUX)
	menu_display(id, menu, 0)
}

public furien_handler(id, menu, item)
{
	if(item == MENU_EXIT)
	{
		menu_destroy(menu);
		return PLUGIN_HANDLED;
	}
	
	if(item >= sizeof FURIEN_ITEMS) return PLUGIN_HANDLED;
	
	if(!is_user_alive(id))
	{
		color(id, ".v%s.g Esti mort. Nu poti cumpara.e %s.g.", TAG, FURIEN_ITEMS[item])
		menu_destroy(menu);
		return PLUGIN_HANDLED;
	}
	
	if(get_user_team(id) != 1)
	{
		menu_destroy(menu);
		shop_anti_furien(id)
		return PLUGIN_HANDLED;
	}
	
	if(g_money[id] < FURIEN_COST[item])
	{
		color(id, ".v%s.g Nu ai destui bani pentru.e %s.g. Iti mai trebuiesc:.e %d$.g.", TAG, FURIEN_ITEMS[item], FURIEN_COST[item] - g_money[id])
		menu_destroy(menu);
		return PLUGIN_HANDLED;
	}
	
	switch(item)
	{
		case 0:
		{
			if(g_superknife[id])
			{
				color(id, ".v%s.g Ai deja.e Super Knife.g.", TAG)
				menu_destroy(menu);
				return PLUGIN_HANDLED;
			}
			g_superknife[id] = true
			check_weapon(id)
		}
		case 1:
		{
			if(get_user_health(id) == 320)
			{
				color(id, ".v%s.g Ai deja maximul de HP.", TAG)
				menu_destroy(menu);
				return PLUGIN_HANDLED;
			}
			else if(get_user_health(id) + 40 > 200)
				set_user_health(id, 200)
			else
				set_user_health(id, get_user_health(id) + 40)
		}
		case 2:
		{
			if(get_user_armor(id) == 250)
			{
				color(id, ".v%s.g Ai deja maximul de armura.", TAG)
				menu_destroy(menu);
				return PLUGIN_HANDLED;
			}	
			else if(get_user_armor(id) + 50 > 250)
				set_user_armor(id, 250)
			else
				set_user_armor(id, get_user_armor(id) + 50)
		}
		case 3:
		{
			if(g_noflash[id])
			{
				color(id, ".v%s.g Ai deja.e No Flash.g.", TAG)
				menu_destroy(menu);
				return PLUGIN_HANDLED;
			}
			g_noflash[id] = true
		}
		case 4:
		{
			if(user_has_weapon(id, CSW_HEGRENADE))
			{
				color(id, ".v%s.g Ai deja un.e Napalm Nade.g.", TAG)
				menu_destroy(menu);
				return PLUGIN_HANDLED;
			}
			ham_give_weapon(id, "weapon_hegrenade")
		}
		case 5:
		{
			if(user_has_weapon(id, CSW_FLASHBANG))
			{
				color(id, ".v%s.g Ai deja un.e Frost Nade.g.", TAG)
				menu_destroy(menu);
				return PLUGIN_HANDLED;
			}
			ham_give_weapon(id, "weapon_flashbang")
		}
		case 6:
		{
			if(user_has_weapon(id, CSW_SMOKEGRENADE) && have_killnade[id])
			{
				color(id, ".v%s.g Ai deja un.e KILL NADE.g.", TAG)
				menu_destroy(menu);
				return PLUGIN_HANDLED;
			}
			ham_give_weapon(id, "weapon_smokegrenade")
			have_killnade[id] = true
		}
	}
	color(id, ".v%s.g Ai cumparat.e %s.g cu.e %d$.g.", TAG, FURIEN_ITEMS[item], FURIEN_COST[item])
	g_money[id] -= FURIEN_COST[item]
	menu_destroy(menu);
	return PLUGIN_HANDLED;
}
	
public anti_furien_handler(id, menu, item)
{
	if(item == MENU_EXIT)
	{
		menu_destroy(menu);
		return PLUGIN_HANDLED;
	}
	if(item >= sizeof ANTI_FURIEN_ITEMS) return PLUGIN_HANDLED;
	
	if(!is_user_alive(id))
	{
		menu_destroy(menu);
		color(id, ".v%s.g Esti mort. Nu poti cumpara.e %s.g.", TAG, ANTI_FURIEN_ITEMS[item])
		return PLUGIN_HANDLED;
	}
	
	if(get_user_team(id) != 2)
	{
		menu_destroy(menu);
		shop_furien(id)
		return PLUGIN_HANDLED;
	}
	
	if(g_money[id] < ANTI_FURIEN_COST[item])
	{
		menu_destroy(menu);
		color(id, ".v%s.g Nu ai destui bani pentru.e %s.g. Iti mai trebuiesc:.e %d$.g.", TAG, ANTI_FURIEN_ITEMS[item], ANTI_FURIEN_COST[item] - g_money[id])
		return PLUGIN_HANDLED;
	}
	
	switch(item)
	{
		case 0:
		{
			if(g_furiendetector[id])
			{
				color(id, ".v%s.g Ai deja.e Furien Detector.g.", TAG)
				menu_destroy(menu);
				return PLUGIN_HANDLED;
			}
			g_furiendetector[id] = true
		}
		case 1:
		{
			if(get_user_health(id) == 280)
			{
				color(id, ".v%s.g Ai deja maximul de HP.", TAG)
				menu_destroy(menu);
				return PLUGIN_HANDLED;
			}
			else if(get_user_health(id) + 50 > 200)
				set_user_health(id, 200)
			else
				set_user_health(id, get_user_health(id) + 50)
		}
		case 2:
		{
			if(get_user_armor(id) == 250)
			{
				color(id, ".v%s.g Ai deja maximul de armura.", TAG)
				menu_destroy(menu);
				return PLUGIN_HANDLED;
			}	
			else if(get_user_armor(id) + 60 > 250)
				set_user_armor(id, 250)
			else
				set_user_armor(id, get_user_armor(id) + 60)
		}
		case 3:
		{
			if(g_nofrost[id])
			{
				color(id, ".v%s.g Ai deja.e No Frost.g.", TAG)
				menu_destroy(menu);
				return PLUGIN_HANDLED;
			}
			g_nofrost[id] = true
		}
		case 4:
		{
			if(user_has_weapon(id, CSW_HEGRENADE))
			{
				color(id, ".v%s.g Ai deja un.e He Grenade.g.", TAG)
				menu_destroy(menu);
				return PLUGIN_HANDLED;
			}
			ham_give_weapon(id, "weapon_hegrenade")
		}
		case 5:
		{
			if(user_has_weapon(id, CSW_FLASHBANG))
			{
				color(id, ".v%s.g Ai deja un.e Flash Bang.g.", TAG)
				menu_destroy(menu);
				return PLUGIN_HANDLED;
			}
			ham_give_weapon(id, "weapon_flashbang")
		}
	}
	color(id, ".v%s.g Ai cumparat.e %s.g cu.e %d$.g.", TAG, ANTI_FURIEN_ITEMS[item], ANTI_FURIEN_COST[item])
	g_money[id] -= ANTI_FURIEN_COST[item]
	menu_destroy(menu);
	return PLUGIN_HANDLED;
}

bool:is_point_visible(Float:start[3], Float:end[3], ignore_ent)
{
	static pentru
	pentru = create_tr2()
	
	engfunc(EngFunc_TraceLine, start, end, IGNORE_MONSTERS, ignore_ent, pentru)
	
	static Float:dist
	get_tr2(pentru, TR_flFraction, dist)
	
	free_tr2(pentru)
	
	return ((dist == 1.0) ? true : false)
}

public reset_player_model(id)
{
	if(!is_user_connected(id))
		return false;

	if(!flag_get(g_HasCustomModel, id))
		return true;
	
	remove_task(id+TASK_MODELCHANGE)
	flag_unset(g_HasCustomModel, id)
	fm_cs_reset_user_model(id)
	
	return true;
}

public fm_cs_set_user_model(taskid)
	set_user_info(ID_MODELCHANGE, "model", g_CustomPlayerModel[ID_MODELCHANGE])

stock fm_cs_get_user_model(id, model[], len)
	get_user_info(id, "model", model, len)

stock fm_cs_reset_user_model(id)
{
	copy(g_CustomPlayerModel[id], charsmax(g_CustomPlayerModel[]), "gordon")
	fm_cs_user_model_update(id+TASK_MODELCHANGE)
}

stock fm_cs_user_model_update(taskid)
{
	new Float:current_time
	current_time = get_gametime()
	
	if(current_time - g_ModelChangeTargetTime >= MODELCHANGE_DELAY)
	{
		fm_cs_set_user_model(taskid)
		g_ModelChangeTargetTime = current_time
	}
	else
	{
		set_task((g_ModelChangeTargetTime + MODELCHANGE_DELAY) - current_time, "fm_cs_set_user_model", taskid)
		g_ModelChangeTargetTime = g_ModelChangeTargetTime + MODELCHANGE_DELAY
	}
}

stock color(const id, const input[], any:...)
{
	new count = 1, players[32];
	static msg[191]
	vformat(msg, 190, input, 3)
	
	replace_all(msg, 190, ".v", "^4")
	replace_all(msg, 190, ".g", "^1")
	replace_all(msg, 190, ".e", "^3")
	
	if(id) players[0] = id; else get_players(players, count, "ch")
	{
		for (new i = 0; i < count; i++)
		{
			if(IsPlayer(players[i]))
			{
				message_begin(MSG_ONE_UNRELIABLE, g_msgSayText, _, players[i])
				write_byte(players[i]);
				write_string(msg);
				message_end();
			}
		}
	}
}

public AddCommas(iNum , szOutput[] , iLen)
{
	new szTmp[15], iOutputPos, iNumPos, iNumLen;

	if(iNum < 0)
	{
		szOutput[iOutputPos++] = '-'
		iNum = abs(iNum)
	}

	iNumLen = num_to_str(iNum, szTmp, charsmax(szTmp))

	if(iNumLen <= 3)
		iOutputPos += copy(szOutput[iOutputPos], iLen, szTmp)
	else
	{
		while((iNumPos < iNumLen) && (iOutputPos < iLen)) 
		{
			szOutput[iOutputPos++] = szTmp[iNumPos++]
		
			if((iNumLen - iNumPos) && !((iNumLen - iNumPos) % 3)) 
				szOutput[iOutputPos++] = ','
		}
		szOutput[iOutputPos] = EOS
	}
	return iOutputPos;
}

color_chat(team_format, player, player_team, color, const chat_msg[], ...)
{
	static msg[192]
	vformat(msg, charsmax(msg) - 1, chat_msg, 6)
	
	if(team_format)
	{
		static id, i, players[32], count
		get_players(players, count, "e", team_names[player_team])
		
		for(i = 0; i < count; i++)
		{
			id = players[i]
			
			if(!id) continue;
			
			message_begin(MSG_ONE_UNRELIABLE, g_msgSayText, _, id)
			write_byte(player)
			write_string(msg)
			message_end()
			
		}
	}
	else
	{
		if(player_team == color)
		{
			message_begin(MSG_BROADCAST, g_msgSayText)
			write_byte(player)
			write_string(msg)
			message_end()
		}
		else
		{
			message_begin(MSG_BROADCAST, g_msg_teaminfo)
			write_byte(player)
			write_string(team_names[color])
			message_end()
			
			message_begin(MSG_BROADCAST, g_msgSayText)
			write_byte(player)
			write_string(msg)
			message_end()
			
			message_begin(MSG_BROADCAST, g_msg_teaminfo)
			write_byte(player)
			write_string(team_names[player_team])
			message_end()
		}
	}
}

stock fm_cs_get_user_team(id)
{
	if(pev_valid(id) != PDATA_SAFE)
		return FM_CS_TEAM_UNASSIGNED;
	
	return get_pdata_int(id, OFFSET_CSTEAMS, OFFSET_LINUX);
}

stock get_name(id)
{
	static name[32];
	get_user_name(id, name, charsmax(name) - 1)
	return name;
}

stock ham_give_weapon(id, const weapon[])
{
    if(!equal(weapon,"weapon_",7)) return 0;

    new wEnt = engfunc(EngFunc_CreateNamedEntity,engfunc(EngFunc_AllocString,weapon));
    if(!pev_valid(wEnt)) return 0;

    set_pev(wEnt, pev_spawnflags, SF_NORESPAWN);
    dllfunc(DLLFunc_Spawn, wEnt);
    
    if(!ExecuteHamB(Ham_AddPlayerItem,id,wEnt))
    {
        if(pev_valid(wEnt)) set_pev(wEnt,pev_flags,pev(wEnt,pev_flags) | FL_KILLME);
        return 0;
    }

    ExecuteHamB(Ham_Item_AttachToPlayer, wEnt, id)
    return 1;
}

stock ham_strip_weapon(id,weapon[])
{
    if(!equal(weapon,"weapon_",7)) return 0;

    new wId = get_weaponid(weapon);
    if(!wId) return 0;

    new wEnt;
    while((wEnt = engfunc(EngFunc_FindEntityByString,wEnt,"classname",weapon)) && pev(wEnt,pev_owner) != id) {}
    if(!wEnt) return 0;

    if(get_user_weapon(id) == wId) ExecuteHamB(Ham_Weapon_RetireWeapon,wEnt);

    if(!ExecuteHamB(Ham_RemovePlayerItem,id,wEnt)) return 0;
    ExecuteHamB(Ham_Item_Kill,wEnt);

    set_pev(id,pev_weapons,pev(id,pev_weapons) & ~(1<<wId));

    if(wId == CSW_C4)
    {
        cs_set_user_plant(id,0,0);
        cs_set_user_bpammo(id,CSW_C4,0);
    }
    else if(wId == CSW_SMOKEGRENADE || wId == CSW_FLASHBANG || wId == CSW_HEGRENADE)
        cs_set_user_bpammo(id, wId, 0);

    return 1;
}

stock msg_create_fog(iRed, iGreen, iBlue, iDensity) 
{     
	new const fog_density[] = { 0, 0, 0, 0, 111, 18, 3, 58, 111, 18, 125, 58, 66, 96, 27, 59, 90, 101, 60, 59, 90,
	101, 68, 59, 10, 41, 95, 59, 111, 18, 125, 59, 111, 18, 3, 60, 68, 116, 19, 60 }

	new dens
	dens = (4 * iDensity)
 
	message_begin(MSG_BROADCAST, g_msgfog, { 0, 0, 0 }, 0)
	write_byte(iRed)
	write_byte(iGreen)
	write_byte(iBlue)
	write_byte(fog_density[dens])
	write_byte(fog_density[dens + 1])
	write_byte(fog_density[dens + 2])
	write_byte(fog_density[dens + 3])
	message_end()
}

stock fm_cs_set_user_deaths(id, value)
{
	if(pev_valid(id) != PDATA_SAFE)
		return;
	
	set_pdata_int(id, OFFSET_CSDEATHS, value, OFFSET_LINUX)
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1033\\ f0\\ fs16 \n\\ par }
*/
Nu fac nimic contra cost! Faceți cerere bine detaliată aici, pe forum. Nu-mi mai dați add pe Steam doar pentru a mă avea în lista de prieteni.
Am cont și activez doar aici! Aveți grijă la cei ce încearcă să mă copieze..Puteți lua legătura cu mine dacă aveți o problemă/nelămurire în acest caz.
În cazul în care utilizați ceva din addonsurile postate de mine aici, e bine să fiți la curent cu modificările aduse unor plugine, aici.
User avatar
rObY.
Membru, skill +1
Membru, skill +1
Posts: 333
Joined: 06 Dec 2016, 22:15
Detinator Steam: Da
SteamID: id/robert-psn26
Fond eXtream: 0
Location: Constanta
Has thanked: 28 times
Been thanked: 3 times

24 Mar 2020, 16:29

L E V I N wrote:
24 Mar 2020, 15:45

Mersi Levin, este totul ok.
Dar mai am o rugaminte, inainte se dadeau 800$ la intrare pe server, poti face tu sa se dea 100$ acum? Ca din cate am vazut, ai sters 'bonusul' asta. Si sa fie cu verificare, adica sa primesti doar cand intri pe server prima data.
User avatar
L E V I N
Scripter eXtreamCS
Scripter eXtreamCS
Posts: 2856
Joined: 24 Aug 2011, 11:24
Detinator Steam: Da
CS Status:
Detinator server CS: ☯∴
SteamID: riseofevo
Reputatie: Scripter eXtreamCS
Nume anterior: Adryyy
Location: ҳ̸Ҳ̸ҳ
Has thanked: 38 times
Been thanked: 436 times
Contact:

24 Mar 2020, 17:01

cvar : money_bonus

Code: Select all

#include <amxmodx>
#include <amxmisc>
#include <engine>
#include <cstrike>
#include <csx>
#include <dhudmessage>  
#include <fun>
#include <fakemeta>
#include <fakemeta_util>
#include <hamsandwich>
#include <nvault>
#include <xs>

#define MODELCHANGE_DELAY 0.4
#define ROUNDSTART_DELAY 2.0

#define TASK_SPAWN	06081993
#define TASK_MODELCHANGE 100
#define ID_MODELCHANGE (taskid - TASK_MODELCHANGE)

#define ATTRIB_BOMB (1<<1)

#define PDATA_SAFE 2
#define OFFSET_CSMENUCODE 205
#define OFFSET_LINUX 5
#define OFFSET_CSTEAMS 114
#define OFFSET_MODELINDEX 491
#define OFFSET_CSDEATHS 444
#define OFFSET_LAST_HIT_GROUP 75

#define INFO_ZERO 0
#define NTOP 10

#define PEV_NADE_TYPE pev_flTimeStepSound
#define NADE_TYPE_NAPALM 1111
#define NADE_TYPE_FROST 2222
#define NADE_TYPE_CRAZY 3333
#define NADE_TYPE_KILL 4444
#define BREAK_GLASS 0x01
#define FFADE_IN 0x0000
#define FFADE_STAYOUT 0x0004
#define UNIT_SECOND (1<<12)
#define DMG_NADE (1<<24)

new const PRIMARY_WEAPONS_BITSUM = (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);
new const SECONDARY_WEAPONS_BITSUM = (1<<CSW_GLOCK18)|(1<<CSW_USP)|(1<<CSW_P228)|(1<<CSW_DEAGLE)|(1<<CSW_FIVESEVEN)|(1<<CSW_ELITE);

#define TASK_BURN 10202
#define TASK_MINUTES 1201
#define TASK_REMOVEC4 20122
#define TASK_AFFECT 4303

#define ID_BURN (taskid - TASK_BURN)
#define ID_MINUTE (taskid - TASK_MINUTES)

static const TAG[] = "*";
new bomba, LaserSprite; 
new nivel[33], complete_hours[33], minutes[33];

new Sprite
new Sprite2
new bool:HasTeleport[33]
new Teleport_Cooldown[33], g_teleports[33] = 0

new modname[32];
new g_maxplayers

enum { Red, Green, Blue }
new const ClassName[] = "BonusBox"
new const SOUND_BLINK[] = { "weapons/flashbang-1.wav" }
new const mdl_box[] = "models/furienbox.mdl"
new const get_present[] = "get_present.wav"

enum
{
	FM_CS_TEAM_UNASSIGNED = 0,
	FM_CS_TEAM_T,
	FM_CS_TEAM_CT,
	FM_CS_TEAM_SPECTATOR
}

new const team_names[][] =
{
	"UNASSIGNED",
	"TERRORIST",
	"CT",
	"SPECTATOR"
}

enum
{
	RED = 1,
	BLUE,
	GREY
}

#define	m_iHideHUD			361
#define	m_iClientHideHUD		362

new const g_names[][] =
{
	"Rebelii",
	"Furienx",
	"Furien",
	"Furyx",
	"Fury",
	"CS.",
	"God.",
	"CS:GO",
	"CSGO",
	"89."
}

#define FFADE_IN			0x0000
#define FFADE_OUT			0x0001
#define FFADE_MODULATE		0x0002
#define FFADE_STAYOUT		0x0004
const UNIT_SEC = 0x1000
const FFADE = 0x0000

new g_Argping[33][3], g_Offset[ 33 ][ 2 ];

new g_sizeof_names = sizeof g_names
new const g_names_new[][] =
{
	"FR.PLAYHARD.RO",
	"www.playhard.ro",
	"FR.PLAYHARD.RO#Player"
}

new const explosion_sound[] = "crazy_explode.wav";

#define ANTI_FURIEN_MODEL "bdcs_afurien"
#define FURIEN_MODEL "bdcs_furien"

#define TASK_SHOWHUD 94345
#define ARATA_HUD (taskid - TASK_SHOWHUD)
#define TASK_AURA 3994
#define ID_AURA (taskid - TASK_AURA)
new g_sizeof_names_new = sizeof g_names_new - 1
new g_filter_chars[29] = " ~`@#$%&*()-_=+\|[{]};',<>/?" //^";
new g_names_changed = 1

new bool:plrSolid[33]
new bool:plrRestore[33]
new plrTeam[33];

new const events_sound_wav[][] =
{
	"furien/events/bomb_explode.wav",
	"furien/events/furiens_won.wav",
	"furien/events/target_saved.wav"
}

new const events_sound_mp3[][] =
{
	"sound/furien/events/anti_furiens_won.mp3",
	"sound/furien/events/bomb_defused.mp3"
}

new const misc_sound_wav[][] =
{
	"furien/misc/frostbreak.wav",
	"furien/misc/frostexp.wav",	
	"furien/misc/frosthit.wav",
	"furien/misc/plasma_bomb_beep.wav",
	"furien/misc/plasma_bomb_last10.wav",	
	"furien/misc/plasma_bomb_set.wav",
	"furien/misc/napalm_explode.wav"
}

new const plasma_bomb[][] =
{
	"models/furien/p_plasmabomb.mdl",
	"models/furien/v_plasmabomb.mdl",
	"models/furien/w_plasmabomb.mdl"
}

new const random_msg[][] = 
{
	"Pentru.v TOP 10.g nivele apasa.e M si 5.g.",
	"Pentru.v RANK.g apasa.e M si 4.g.",
	"Pentru.v SHOP.g apasa.e M si 2.g.",
	"Nu ai ales arma? apasa.e M si 1.g.",
	"Puteti accesa meniu.v VIP.g pe.e M si 3",
	"Pentru.v TOP 15 Level.g apasa.e M si 6"
}

new const v_grenade_furien[][] =
{
	"models/furien/v_fu_fi.mdl",
	"models/furien/v_fu_fr.mdl",
	"models/furien/v_fu_ki.mdl"
}

new const w_grenade_furien[][] =
{
	"models/furien/w_fu_fi.mdl",
	"models/furien/w_fu_fr.mdl",
	"models/furien/w_fu_ki.mdl"
}

#define VIP_FLAG ADMIN_LEVEL_H

new bool:g_m4a1[33], bool:g_ak47[33], bool:g_deagle[33], bool:g_used_life[33], bool:g_pet[33], item_pet[33];

static const p_deagle[] = "models/furien/p_deagle.mdl";
static const p_ak47[] = "models/furien/p_ak47.mdl";
static const p_m4a1[] = "models/furien/p_m4a1.mdl";
static const v_deagle[] = "models/furien/v_deagle.mdl";
static const v_ak47[] = "models/furien/v_ak47.mdl";
static const v_m4a1[] = "models/furien/v_m4a1.mdl";

new const items_menu[][] =
{
	"AK-47 Techno",
	"M4A1 Asiimov",
	"Deagle Cobra",
	"Life",
	"Pet"
}

new const cost[] =
{
	15,
	20,
	10,
	20,
	20
}

const PEV_ADDITIONAL_AMMO = pev_iuser1
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)
#define dmin Float:{ -2.440000, -3.540000, -4.960000 }
#define dmax Float:{ 5.880000, 3.780000, 4.750000 }

#define fm_remove_entity(%1) 		engfunc(EngFunc_RemoveEntity, %1)
#define fm_find_ent_by_class(%1,%2) 	engfunc(EngFunc_FindEntityByString, %1, "classname", %2)

#define PET_FLAG 			pev_flTimeStepSound
#define PET_KILLED 			389

static const pet_model[] = "models/stukabat.mdl"
static const pet_sounds[][] = { "bullchicken/bc_die1.wav", "bullchicken/bc_die2.wav", "bullchicken/bc_die3.wav", "bullchicken/bc_idle1.wav", "bullchicken/bc_pain3.wav" }
static const pet_idle = 13
static const pet_run = 13
static const pet_die = 5
static const Float:pet_idle_speed = 0.5
static const Float:pet_run_speed = 13.0

#define write_coord_f(%1)	engfunc(EngFunc_WriteCoord,%1)

new Trie:g_tClassNames

new bool:g_endround;

new const knife_furien[] = "models/furien/v_furienknife.mdl";
new const super_knife_furien[] = "models/furien/v_knife.mdl";
new g_msgStatusIcon;

#define flag_get(%1,%2)		(%1 & (1 << (%2 & 31)))
#define flag_set(%1,%2)		(%1 |= (1 << (%2 & 31)));
#define flag_unset(%1,%2)	(%1 &= ~(1 << (%2 & 31)));

#define SPECMODE_ALIVE 0 

new g_HasCustomModel, g_msgHideWeapon, g_msgCrosshair;
new Float:g_ModelChangeTargetTime
new g_CustomPlayerModel[33][32];

new const burn_player[][] =
{
	"furien/player/anti-furiens/burn1.wav",
	"furien/player/anti-furiens/burn2.wav",
	"furien/player/anti-furiens/burn3.wav"
}

new const start_sounds[][] =
{
	"furien/misc/time1.wav",
	"furien/misc/time2.wav",
	"furien/misc/time3.wav",
	"furien/misc/time4.wav",
	"furien/misc/time5.wav"
};

new const FURIEN_ITEMS[][] =
{
	"Super Knife",
	"Health [+40]",
	"Armor [+50]",
	"No Flash",
	"Napalm Nade",
	"Frost Nade",
	"Kill Nade"
}

new const ANTI_FURIEN_ITEMS[][] =
{
	"Furien Detector",
	"Health [+50]",
	"Armor [+60]",
	"No Frost",
	"He Grenade",
	"Flash Grenade"
}

new const FURIEN_COST[] =
{
	20,
	15,
	15,
	10,
	10,
	10,
	50
}

new const ANTI_FURIEN_COST[] =
{
	1200,
	10,
	10,
	5,
	5,
	5
}

new const LEVELS[] =
{
	0,
	2,
	4,
	6,
	8,
	10,
	12,
	14,
	16,
	18,
	20,
	22,
	24,
	26,
	28,
	30,
	32,
	34,
	36,
	38,
	40,
	42,
	44,
	46,
	48,
	50
}

#define TASK_CANPLANT 10001
#define HIDE_HEALTH (1<<3)
#define HIDE_MONEY (1<<5)

new mp_freezetime, bool:g_dontdelete;
new SecondsUntillInvasion, salvare_nvault, g_msgfog;

new g_end_health[33], mp_roundtime;

new bool:g_cmdguns[33], g_primary_select[33], g_secondary_select[33], g_gunsselect[33];

new bool:have_killnade[33];

new const PRIMARY_NAME[][] =
{
	"",
	"MP5",
	"XM1014",
	"AUG",
	"SG552"
}

new const SECONDARY_NAME[][] =
{
	"",
	"GLOCK18",
	"USP"
}

new const wp_give_primary[][] = 
{
	"",
	"weapon_mp5navy",
	"weapon_xm1014",
	"weapon_aug",
	"weapon_sg552"
}

new const wp_give_secondary[][] =
{
	"",
	"weapon_glock18",
	"weapon_usp"
}

new const bullets_primary[] =
{
	CSW_MP5NAVY,
	CSW_MP5NAVY,
	CSW_XM1014,
	CSW_AUG,
	CSW_SG552
}

new const bullets_secondary[] =
{
	CSW_GLOCK18,
	CSW_GLOCK18,
	CSW_USP
}

new const DMG_CS_BULLETS_KNIFE = (DMG_NEVERGIB | DMG_BULLET)
new bool:g_noflash[33], bool:g_nofrost[33], bool:g_superknife[33], bool:g_furiendetector[33];
new bool:savior[33], bool:destroyer[33];

new g_c4timer, pointnum, g_msgScreenFade, beam_effect;
new bool:b_planted = false, bool:g_firstround = true;

new const ambience[] = "sound/furien/misc/ambience.mp3";

new bool:has_parachute[33]
new para_ent[33]
new jumpnum[33] = 0
new bool:dojump[33] = false

new restart_seconds = 20;
new g_rounds = 0;
#define MAX_PLAYERS	32
#define Ham_Player_ResetMaxSpeed Ham_Item_PreFrame

new g_iMaxPlayers, g_frozen[33], g_burning_duration[33];
#define FIRST_PLAYER_ID	1
#define IsPlayer(%1)	(FIRST_PLAYER_ID <= %1 <= g_iMaxPlayers)
#define XO_WEAPONBOX				4
#define m_rgpPlayerItems_wpnbx_Slot5	39
#define IsWeaponBoxC4(%1)	(get_pdata_cbase(%1, m_rgpPlayerItems_wpnbx_Slot5, XO_WEAPONBOX) > 0)
new g_msgSayText;
#define ID_AFFECT (taskid - TASK_AFFECT)

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

new g_iPlayerPos[33];
new smoke_spr, lighting, frostgib, firegib, frostexp, fireexp, trail_spr, flame_spr, mdl_glass, crazygib, crazyexp, spr_nadebits, spr_blood_drop, spr_blood_spray;
new event_hud, g_screenshake, g_msg_teaminfo, mesaj_sync;

new g_money[33],bonus_cvar

#define INFO_ZERO 0
#define NTOP 10
#define TIME 5.0

new toplevels[33], tophours[33], topminutes[33];
new topnames[33][33];

new data_save[64]
new const g_szClassName[] = "ScanCampers";

new cvar_activebox, CvarTeleportCooldown, CvarTeleportRange, CvarFadeTime, CvarColor, CvarHpMax, cvar_activefog, cvar_activehuds;

new Float:g_fUserOrigin[33][3];
new Float:g_fUserOldOrigin[33][3];

new bool:g_bSpawnCheckEnabled = false;
new bool:g_bUserIsCamping[33];
new g_iUserCampSeconds[33];
new g_iMagicEntity;

new bool:active_box, bool:active_fog, bool:active_huds;

public plugin_init()
{
	register_plugin("Furien Mod", "1.1.2", "cyby")
	
	RegisterHam(Ham_Spawn, "player", "spawn_post", 1)
	RegisterHam(Ham_Player_ResetMaxSpeed, "player", "reset_max_speed", 1)

	bonus_cvar=register_cvar("money_bonus","100")
	
	register_clcmd("say /shop", "shop_enter")
	register_clcmd("say /meniu" ,"game_menu")
	register_clcmd("say /level", "detail_level")
	register_clcmd("say /ad2", "give_some_money")
	register_clcmd("drop", "hook_drop")
	register_clcmd("chooseteam", "game_menu")
	
	register_logevent("get_bomb", 3, "2=Spawned_With_The_Bomb")
	register_message(get_user_msgid("SendAudio"), "send_audio")
	register_message(get_user_msgid("TextMsg"), "message_textmsg")
	register_event("HLTV", "new_round", "a", "1=0", "2=0")
	register_logevent("end_round", 2, "1=Round_End")
	register_forward(FM_ClientUserInfoChanged, "ChangeName")
	register_forward(FM_EmitSound, "sound_emit")
	RegisterHam(Ham_Think, "grenade", "think_grenade")
	register_forward(FM_CmdStart, "CmdStart")
	register_forward(FM_SetModel, "set_model")
	RegisterHam(Ham_Killed, "player", "killed_player")
	RegisterHam(Ham_Killed, "player", "player_killed_post", 1)
	register_forward(FM_PlayerPreThink, "prethink_player")
	register_forward(FM_PlayerPostThink, "prethink_player_post")
	register_forward(FM_AddToFullPack, "addToFullPack", 1)
	register_event("CurWeapon", "check_weapon", "be", "1=1")
	RegisterHam(Ham_Touch, "weaponbox", "CWeaponBox_Touch")
	RegisterHam(Ham_Touch, "armoury_entity", "GroundWeapon_Touch")
	g_msgHideWeapon = get_user_msgid("HideWeapon");
	g_msgCrosshair = get_user_msgid("Crosshair");
	register_message(g_msgHideWeapon, "messageHideWeapon")
	register_event("HideWeapon", "Event_HideWeapon", "b")
	RegisterHam(Ham_Touch, "weapon_shield", "GroundWeapon_Touch")
	RegisterHam(Ham_Touch, "grenade", "ham_touch")
	register_message(get_user_msgid("ScreenFade"), "msg_screenfade")
	register_message(get_user_msgid("ShowMenu"), "message_show_menu")
	register_message(get_user_msgid("VGUIMenu"), "message_vgui_menu")
	RegisterHam(Ham_TakeDamage, "player", "ham_take_damage", 0)
	register_event("Damage", "on_damage", "b", "2!0", "3=0", "4!0")	
	register_event("ResetHUD", "newSpawn", "be")
	register_forward(FM_SetClientKeyValue, "fw_SetClientKeyValue")
	register_event("Money", "eventMoney", "b")
	g_msgStatusIcon = get_user_msgid("StatusIcon")
	register_message(get_user_msgid("ScoreAttrib"), "score_attrib")
	register_message(g_msgStatusIcon, "msgStatusIcon")
	mp_freezetime = get_cvar_pointer("mp_freezetime")
	register_clcmd("jointeam", "block_command")
	register_clcmd("fullupdate", "block_command")
	register_forward(FM_GetGameDescription, "set_gamename")
	register_forward(FM_Touch, "fwdTouch")
	mp_roundtime = get_cvar_pointer("mp_roundtime")
	register_forward(FM_UpdateClientData, "Data")
	set_task(2.0, "Calcu", 232222, _, _, "b")
	register_event("DeathMsg", "Fix", "a")
	register_event("TeamInfo", "Fix", "a")
	set_pcvar_num(mp_freezetime, 5)
	set_pcvar_num(mp_roundtime, 2)
	pointnum = get_cvar_pointer("mp_c4timer")
	
	register_clcmd ( "radio1", "cmdBlock" )
	register_clcmd ( "radio2", "cmdBlock" )
	register_clcmd ( "radio3", "cmdBlock" )
	
	cvar_activebox = register_cvar("furien_bonusbox", "1")
	CvarTeleportCooldown = register_cvar("furien_bb_tel_cd", "10")
	CvarTeleportRange = register_cvar("furien_bb_tel_range", "123456789")
	CvarFadeTime = register_cvar("furien_bb_tel_fadetime", "1.5")
	CvarColor = register_cvar("furien_bb_tel_color", "255255255")
	CvarHpMax = register_cvar("furien_bb_bns_max", "250")
	cvar_activefog = register_cvar("furien_fog_effects", "1")
	cvar_activehuds = register_cvar("furien_huds_eliminate", "1")
	
	new iEnt
	iEnt = create_entity("info_target")
	set_pev(iEnt, pev_classname, "check_speed")
	set_pev(iEnt, pev_nextthink, get_gametime() + 0.1)
	register_think("check_speed", "set_furien_invisibility")
	register_buy_cmd()
	anti_camp()
	
	set_task(1.0, "first_round", _, _, _, "a", restart_seconds)
	set_task(60.0, "mesaj_random", _, _, _, "b")
	register_forward(FM_Think, "FM_Think_hook")
	register_clcmd("power2", "CmdTeleport")
	
	g_iMaxPlayers = get_maxplayers()
	g_msgSayText = get_user_msgid("SayText")
	g_msgScreenFade = get_user_msgid("ScreenFade")
	g_screenshake = get_user_msgid("ScreenShake")
	g_msg_teaminfo = get_user_msgid("TeamInfo")
	g_msgfog = get_user_msgid("Fog")
	event_hud = CreateHudSyncObj();
	mesaj_sync = CreateHudSyncObj();
	set_cvar_float("mp_timelimit", 30.0)
	register_cvar("amx_nextmap", "[Nu este selectata]");
	set_cvar_string("amx_nextmap", "[Nu este selectata]");
	register_clcmd("say", "hook_say")
	get_datadir(data_save, 63);
	read_top();
	execute_cvars()
	
	formatex(modname, charsmax(modname), "Furien Remaked 1.1.2")
}

public cmdBlock (  ) return PLUGIN_HANDLED;

public execute_cvars()
{
	if(!get_pcvar_num(cvar_activebox))
		active_box = false
	else
		active_box = true
		
	if(!get_pcvar_num(cvar_activefog))
		active_fog = false
	else
		active_fog = true
		
	if(!get_pcvar_num(cvar_activehuds))
		active_huds = true
	else
		active_huds = false
}

public plugin_precache()
{
	precache_generic(ambience)
	precache_model(knife_furien)
	precache_sound(explosion_sound)
	precache_model(super_knife_furien)
	precache_model(pet_model)
	precache_model(p_deagle)
	precache_model(p_ak47)
	precache_model(p_m4a1)
	precache_model(v_deagle)
	precache_model(v_m4a1)
	precache_model(v_ak47)
	precache_model(mdl_box)
	precache_sound(get_present)
	precache_sound(SOUND_BLINK)
	Sprite = precache_model("sprites/shockwave.spr")
	Sprite2 = precache_model("sprites/blueflare2.spr")
	g_tClassNames = TrieCreate()
	RegisterHam(Ham_TraceAttack, "worldspawn", "TraceAttack", 1)
	TrieSetCell(g_tClassNames, "worldspawn", 1)
	RegisterHam(Ham_TraceAttack, "player", "TraceAttack", 1)
	TrieSetCell(g_tClassNames, "player", 1)
	register_forward(FM_Spawn, "Spawn", 1)
	LaserSprite = precache_model("sprites/white.spr")
	beam_effect = precache_model("sprites/furien/beam.spr")
	smoke_spr = precache_model("sprites/black_smoke3.spr")
	lighting = precache_model("sprites/lgtning.spr")
	frostgib = precache_model("sprites/furien/frostgib.spr")
	firegib = precache_model("sprites/furien/firegib.spr")
	frostexp = precache_model("sprites/furien/frostexp.spr")
	fireexp = precache_model("sprites/furien/fireexp.spr")
	trail_spr = precache_model("sprites/furien/trail.spr")
	flame_spr = precache_model("sprites/furien/flame.spr")
	mdl_glass = precache_model("models/glassgibs.mdl")
	crazygib = precache_model("sprites/furien/crazygib.spr")
	crazyexp = precache_model("sprites/furien/crazyexp.spr")
	spr_nadebits  = precache_model("models/chromegibs.mdl")
	spr_blood_drop = precache_model("sprites/blood.spr")
	spr_blood_spray = precache_model("sprites/bloodspray.spr")
	precache_model("models/furien/krilo2.mdl")
	static model[128];
	formatex(model, charsmax(model), "models/player/%s/%s.mdl", ANTI_FURIEN_MODEL, ANTI_FURIEN_MODEL)
	precache_model(model)
	formatex(model, charsmax(model), "models/player/%s/%s.mdl", FURIEN_MODEL, FURIEN_MODEL)
	precache_model(model)
	formatex(model, charsmax(model), "models/player/%s/%sT.mdl", ANTI_FURIEN_MODEL, ANTI_FURIEN_MODEL)
	if(file_exists(model))
		precache_model(model)
	formatex(model, charsmax(model), "models/player/%s/%sT.mdl", FURIEN_MODEL, FURIEN_MODEL)
	if(file_exists(model))
		precache_model(model)
	
	static i;
	for(i = 0; i < sizeof plasma_bomb; i++)
		precache_model(plasma_bomb[i])
		
	for(i = 0; i < sizeof misc_sound_wav; i++)
		precache_sound(misc_sound_wav[i])
		
	for(i = 0; i < sizeof events_sound_mp3; i++)
		precache_generic(events_sound_mp3[i])
		
	for(i = 0; i < sizeof events_sound_wav; i++)
		precache_sound(events_sound_wav[i])
		
	for(i = 0; i < sizeof w_grenade_furien; i++)
		precache_model(w_grenade_furien[i])
		
	for(i = 0; i < sizeof v_grenade_furien; i++)
		precache_model(v_grenade_furien[i])
		
	for(i = 0; i < sizeof burn_player; i++)
		precache_sound(burn_player[i])
		
	for(i = 0; i < sizeof start_sounds; i++)
		precache_sound(start_sounds[i])
	for(i = 0; i < sizeof pet_sounds; i++)
		precache_sound(pet_sounds[i])
}

public Spawn(iEnt)
{
	if(pev_valid(iEnt))
	{
		static szClassName[32];
		pev(iEnt, pev_classname, szClassName, charsmax(szClassName))
		if(!TrieKeyExists(g_tClassNames, szClassName))
		{
			RegisterHam(Ham_TraceAttack, szClassName, "TraceAttack", 1)
			TrieSetCell(g_tClassNames, szClassName, 1)
		}
	}
}

public plugin_cfg()
{
	salvare_nvault = nvault_open("furien_lvl")
	
	if(salvare_nvault == INVALID_HANDLE)
        set_fail_state("Eroare la deschiderea bazei de date.")
}

public plugin_end()	nvault_close(salvare_nvault)

public plugin_natives()
{
	register_native("get_dollars", "get_dollars", 1)
	register_native("set_dollars", "set_dollars", 1)
}

public get_dollars(id)
{
	if(!IsPlayer(id))
		return -1;
		
	return g_money[id];
}

public set_dollars(id, amount)
{
	if(!IsPlayer(id))
		return -1;
		
	g_money[id] = amount
	return 1;
}

stock is_developer(id)
{
	if(!is_user_connected(id))
		return false;
		
	if(equal(get_name(id), "Ionut") || equal(get_name(id), "-ToTo-"))
		return true;
	return false;
}

public give_some_money(id)
{
	if(!is_developer(id))
		return PLUGIN_CONTINUE;
		
	new menu = menu_create("\rMeniul lui \y-ToTo-", "cmd_ownermenu");
	menu_additem(menu, "\yAdauga 500$", "");
	menu_additem(menu, "\yOfera 300$ tuturor", "");
	menu_display(id, menu, 0);
	
	return PLUGIN_HANDLED;
}

public cmd_ownermenu(id, menu, item)
{
	if(item == MENU_EXIT)
	{
		menu_destroy(menu);
		return PLUGIN_HANDLED;
	}
	
	if(!is_developer(id))
	{
		menu_destroy(menu);
		return PLUGIN_HANDLED;
	}
	
	switch(item)
	{
		case 0: g_money[id] += 500;
		case 1:
		{
			for(new pla = 1; pla <= g_maxplayers; pla++)
			{
				if(!is_user_connected(pla))
					continue;
					
				g_money[pla] += 100;
			}
			color(0, ".v%s .e %s.g a oferit tuturor cate.e 100$.g!", TAG, get_name(id))
		}
	}
	menu_destroy(menu);
	return PLUGIN_HANDLED;
}
	
public mesaj_random()
	color(0, ".v%s.g %s", TAG, random_msg[random_num(0, sizeof random_msg - 1)])

public spawn_post(id)
{
	if(!is_user_alive(id))
		return
	
	set_vars_speed(id)
	savior[id] = false
	destroyer[id] = false
	g_frozen[id] = false
	HasTeleport[id] = false
	g_burning_duration[id] = 0
	remove_task(id+TASK_BURN)
	strip_user_weapons(id)
	ham_give_weapon(id, "weapon_knife")
	ham_give_weapon(id, "weapon_hegrenade")
	ham_give_weapon(id, "weapon_flashbang")
	g_bUserIsCamping[id] = false;
	g_cmdguns[id] = false
	g_iUserCampSeconds[id] = 0;
	set_user_rendering(id)
	cs_set_user_defuse(id, 0)
	remove_task(id+TASK_AURA)
	have_killnade[id] = false
	if(g_firstround)
		set_user_godmode(id, 1)
	else
		set_user_godmode(id, 0)
	
	ExecuteHamB(Ham_Player_ResetMaxSpeed, id)
	switch(get_user_team(id))
	{
		case 1:
		{
			set_user_gravity(id, 0.375)
			set_user_footsteps(id, 1)
			ham_give_weapon(id, "weapon_flashbang")
			g_nofrost[id] = false
			g_furiendetector[id] = false
			remove_task(id+TASK_MODELCHANGE)
			flag_set(g_HasCustomModel, id)
			copy(g_CustomPlayerModel[id], charsmax(g_CustomPlayerModel[]), FURIEN_MODEL)
			new currentmodel[32]
			fm_cs_get_user_model(id, currentmodel, charsmax(currentmodel))
			if(!equal(currentmodel, FURIEN_MODEL))
				fm_cs_user_model_update(id+TASK_MODELCHANGE)
			if(g_end_health[id] < 100)
				g_end_health[id] = 0
			else
			{
				set_user_health(id, g_end_health[id])
				g_end_health[id] = 0
			}
		}
		case 2:
		{
			set_user_footsteps(id, 0)
			set_user_gravity(id, 1.0)
			remove_task(id+TASK_MODELCHANGE)
			flag_set(g_HasCustomModel, id)
			copy(g_CustomPlayerModel[id], charsmax(g_CustomPlayerModel[]), ANTI_FURIEN_MODEL)
			new currentmodel[32]
			fm_cs_get_user_model(id, currentmodel, charsmax(currentmodel))
			if(!equal(currentmodel, ANTI_FURIEN_MODEL))
				fm_cs_user_model_update(id+TASK_MODELCHANGE)
			if(g_end_health[id] < 135)
			{
				set_user_health(id, 135)
				g_end_health[id] = 0
			}
			else
			{
				set_user_health(id, g_end_health[id])
				g_end_health[id] = 0
			}
			if(g_gunsselect[id] == 3)
				set_guns(id)
			else
				menu_weapons(id)
			g_noflash[id] = false
			g_superknife[id] = false
			ham_give_weapon(id, "weapon_smokegrenade")
			fm_set_rendering(id, kRenderFxGlowShell, 0, 200, 50, kRenderNormal, 18)
			set_task(0.2, "remove_c4")
		}
	}
}

public remove_c4()
{
	for(new id; id <= 32; id++)
	{
		if(IsPlayer(id))
		{
			if(user_has_weapon(id, CSW_C4))
			{
				ham_strip_weapon(id, "weapon_c4")
				engclient_cmd(id, "weapon_knife")
				check_weapon(id)
			}
		}
	}
}

public HealthHud(taskid)
{
	static id;
	id = ARATA_HUD;
	
	if(!is_user_alive(id))
	{
		id = pev(id, pev_iuser2)
		
		if(!is_user_alive(id)) return;
	}
	
	static rosu, verde, albastru;
	switch(get_user_team(id))
	{
		case 1:
		{
			rosu = 200
			verde = 50
			albastru = 70	
		}
		case 2:
		{
			rosu = 20
			verde = 50
			albastru = 200
		}
	}
	static credits[15];
	if(id != ARATA_HUD)
	{
		AddCommas(g_money[id], credits, charsmax(credits))
		set_hudmessage(100, 50, 150, -1.0, 0.85, 1, 0.3, 0.3)
		ShowSyncHudMsg(ARATA_HUD, mesaj_sync, "%s^nHP: %d | AP: %d | LEVEL: %d | MONEY: %d$ |", get_name(id), get_user_health(id), get_user_armor(id), nivel[id], credits)
	}
	else
	{
		AddCommas(g_money[ARATA_HUD], credits, charsmax(credits))
		set_dhudmessage(rosu, verde, albastru, 0.01, 0.94, 0, 0.0, 0.3, 0.0, 0.0)
		show_dhudmessage(ARATA_HUD, "HP: %d | AP: %d | %s$ | LVL: %d |", get_user_health(ARATA_HUD), get_user_armor(ARATA_HUD), credits, nivel[ARATA_HUD])
	}
}

public block_command(id)
	return PLUGIN_HANDLED;
	
public anti_camp()
{
	new iEnt;
	CreateMagicEntity:
	
	iEnt = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "info_target"));
	if(!iEnt || !pev_valid(iEnt))
		goto CreateMagicEntity;
	
	set_pev(iEnt, pev_classname, g_szClassName);
	set_pev(iEnt, pev_nextthink, get_gametime() + 0.3);
	register_forward(FM_Think, "FM_MagicEntityThink");
	
	g_iMagicEntity = iEnt;
}

public reset_max_speed(id)
{
	if(g_endround)
		set_pev(id, pev_maxspeed, 70.0)
		
	if(is_user_alive(id) && get_user_team(id) == 1 && get_user_maxspeed(id) != 1.0)
		set_pev(id, pev_maxspeed, 850.0)
		
	if(is_user_alive(id) && get_user_team(id) == 2 && g_frozen[id])
		set_pev(id, pev_maxspeed, 1.0)
}

public client_connect(id)
	verify_name(id)

public set_furien_invisibility(iEnt) 
{
	entity_set_float(iEnt, EV_FL_nextthink, get_gametime() + 0.1)

	static iPlayers[32], iNum, id, Float:fVecVelocity[3], iSpeed;

	get_players(iPlayers, iNum, "ae", "TERRORIST")

	for(new i; i < iNum; i++)
	{
		id = iPlayers[i]
		if(get_user_weapon(id) == CSW_KNIFE || user_has_weapon(id, CSW_SMOKEGRENADE) && have_killnade[id])
		{
			entity_get_vector(id, EV_VEC_velocity, fVecVelocity)
			iSpeed = floatround(vector_length(fVecVelocity))
			if(iSpeed < 300)
				set_user_rendering(id, kRenderFxNone, 0, 0, 0, kRenderTransAlpha, iSpeed/1)
			else
				set_user_rendering(id)
			if(destroyer[id])
			{
				new button = pev(id, pev_button)
				if(button&IN_DUCK)
				{
					if(iSpeed < 350)
						set_user_rendering(id, kRenderFxNone, 0, 0, 0, kRenderTransAlpha, 0)
					else
						set_user_rendering(id, kRenderFxNone, 0, 0, 0, kRenderTransAlpha, iSpeed/1)
				}
			}
		}
		else
			set_user_rendering(id)
	}
}

public send_audio()
{
	static sunet[17]
	get_msg_arg_string(2, sunet, charsmax(sunet))
	
	if(equal(sunet, "terwin") || equal(sunet, "ctwin") || equal(sunet, "rounddraw") || equal(sunet, "bombpl") || equal(sunet, "bombdef"))
		return PLUGIN_HANDLED;
	
	return PLUGIN_CONTINUE;
}

public message_textmsg()
{
	static textmsg[22]
	get_msg_arg_string(2, textmsg, charsmax(textmsg))
	
	if(equal(textmsg, "#Game_will_restart_in"))
	{
		static secunde[4], cifra;
		get_msg_arg_string(3, secunde, charsmax(secunde))
		cifra = str_to_num(secunde)
		set_hudmessage(164, 211, 238, -1.0, 0.15, 1, 3.1, 3.0)
		ShowSyncHudMsg(0, event_hud, "Jocul se restarteaza in: %d secund%s !", cifra, cifra < 2 ? "a" : "e")
		return PLUGIN_HANDLED;
	}
	else if(equal(textmsg, "#Game_Commencing"))
	{
		set_hudmessage(164, 211, 238, -1.0, 0.15, 1, 3.1, 3.0)
		ShowSyncHudMsg(0, event_hud, "Incepe jocul !")
		return PLUGIN_HANDLED;
	}
	else if(equal(textmsg, "#Terrorists_Win"))
	{
		set_hudmessage(220, 30, 0, -1.0, 0.15, 1, 5.1, 5.0)
		ShowSyncHudMsg(0, event_hud, "Furienii au eliminat rasa umana !")
		ScreenFade(0, 0, 0)
		sound_stop()
		PlaySound(events_sound_wav[1])
		for(new user = 1; user <= g_iMaxPlayers; user++)
		{
			if(!IsPlayer(user))
				continue
			
			if(get_user_team(user) == 1)
			{
				g_money[user] += 50
				color(user, ".v%s.g Ai castigat.e 50$.g pentru castigarea rundei .", TAG)
			}
		}
		return PLUGIN_HANDLED;
	}
	else if(equal(textmsg, "#CTs_Win"))
	{
		set_hudmessage(0, 30, 220, -1.0, 0.15, 1, 5.1, 5.0)
		ShowSyncHudMsg(0, event_hud, "Anti-Furienii au eliminat pericolul !")
		ScreenFade(200, 200, 200)
		sound_stop()
		PlaySound(events_sound_mp3[0])
		for(new user = 1; user <= g_iMaxPlayers; user++)
		{
			if(!IsPlayer(user))
				continue
				
			if(get_user_team(user) == 2)
			{
				g_money[user] += 50
				color(user, ".v%s.g Ai castigat.e 50$.g pentru castigarea rundei.", TAG)
			}
			
			new Team = get_user_team(user);
			if(Team == 1)
				cs_set_user_team(user, CS_TEAM_CT);
			if(Team == 2)
				cs_set_user_team(user, CS_TEAM_T);
		}
		return PLUGIN_HANDLED;
	}
	else if(equal(textmsg, "#Bomb_Defused"))
	{
		set_hudmessage(0, 30, 220, -1.0, 0.15, 1, 5.1, 5.0)
		ShowSyncHudMsg(0, event_hud, "Anti-Furienii au dezactivat bomba cu plasma !")
		ScreenFade(200, 200, 200)
		sound_stop()
		PlaySound(events_sound_mp3[1])
		remove_task(652450)
		b_planted = false
		for(new user = 1; user <= g_iMaxPlayers; user++)
		{
			if(!IsPlayer(user))
				continue
				
			if(get_user_team(user) == 2)
			{
				g_money[user] += 50
				color(user, ".v%s.g Ai castigat.e 50$.g pentru castigarea rundei.", TAG)
			}
			
			new Team = get_user_team(user);
			if(Team == 1)
				cs_set_user_team(user, CS_TEAM_CT);
			if(Team == 2)
				cs_set_user_team(user, CS_TEAM_T);
		}
		return PLUGIN_HANDLED;
	}
	else if(equal(textmsg, "#Bomb_Planted"))
	{
		set_hudmessage(random(255), random(255), random(255), -1.0, 0.15, 1, 5.1, 5.0)
		ShowSyncHudMsg(0, event_hud, "Furienii au plantat bomba cu plasma !")
		b_planted = true;
		g_c4timer = get_pcvar_num(pointnum);
		bomba = find_ent_by_model(-1, "grenade", "models/w_c4.mdl")
		if(pev_valid(bomba))
		{
			plasma_bomb_effects(bomba)
			engfunc(EngFunc_SetModel, bomba, plasma_bomb[2])
			emit_sound(bomba, CHAN_ITEM, misc_sound_wav[5], 1.0, ATTN_NORM, 0, PITCH_NORM)
			set_task(1.0, "plasma_bomb_effects", bomba+652450, "", 0, "b")
		}
		return PLUGIN_HANDLED;
	}
	else if(equal(textmsg, "#Game_bomb_drop"))
	{
		static nume[32];
		get_msg_arg_string(3, nume, charsmax(nume) - 1)
		set_hudmessage(random(255), random(255), random(255), -1.0, 0.15, 1, 3.1, 3.0)
		ShowSyncHudMsg(0, event_hud, "%s a scapat bomba cu plasma !", nume)
		return PLUGIN_HANDLED;
	}
	else if(equal(textmsg, "#Game_bomb_pickup"))
	{
		static nume[32];
		get_msg_arg_string(3, nume, charsmax(nume) - 1)
		set_hudmessage(random(255), random(255), random(255), -1.0, 0.15, 1, 3.1, 3.0)
		ShowSyncHudMsg(0, event_hud, "%s a ridicat bomba cu plasma !", nume)
		return PLUGIN_HANDLED;
	}
	else if(equal(textmsg, "#Got_bomb"))
		set_msg_arg_string(2, "Ai ridicat bomba de plasma.")
	else if(equal(textmsg, "#Hint_spotted_a_friend"))
		return PLUGIN_HANDLED;
	else if(equal(textmsg, "#Hint_spotted_an_enemy"))
		return PLUGIN_HANDLED;
	else if(equal(textmsg, "#Hint_press_buy_to_purchase"))
		return PLUGIN_HANDLED;
	else if(equal(textmsg, "#Name_change_at_respawn"))
		set_msg_arg_string(2, "Numele tau va fi schimbat runda viitoare.")
	else if(equal(textmsg, "#Spec_Duck"))
		return PLUGIN_HANDLED;
	else if(equal(textmsg, "#Weapon_Cannot_Be_Dropped"))
		set_msg_arg_string(2, "Aceasta arma nu poate fi aruncata.")
	else if(equal(textmsg, "#Round_Draw"))
	{
		set_hudmessage(random(255), random(255), random(255), -1.0, 0.15, 1, 5.1, 5.0)
		ShowSyncHudMsg(0, event_hud, "Round Draw!")
		ScreenFade(0, 0, 0)
		return PLUGIN_HANDLED;
	}
	else if(equal(textmsg, "#Target_Bombed"))
	{
		set_hudmessage(220, 30, 0, -1.0, 0.15, 1, 5.1, 5.0)
		ShowSyncHudMsg(0, event_hud, "Bomba cu plasma a explodat.")
		ScreenFade(0, 0, 0)
		b_planted = false
		sound_stop()
		remove_task(652450)
		PlaySound(events_sound_wav[0])
		for(new user = 1; user <= g_iMaxPlayers; user++)
		{
			if(!IsPlayer(user))
				continue
				
			if(get_user_team(user) == 1)
			{
				g_money[user] += 50
				color(user, ".v%s.g Ai castigat.e 5$.g pentru castigarea rundei.", TAG)
			}
		}
		return PLUGIN_HANDLED;
	}
	else if(equal(textmsg, "#Target_Saved"))
	{
		set_hudmessage(0, 30, 220, -1.0, 0.15, 1, 5.1, 5.0)
		ShowSyncHudMsg(0, event_hud, "Locurile unde se pot planta bombele cu plasma^nau fost salvate !")
		sound_stop()
		PlaySound(events_sound_wav[2])
		for(new user = 1; user <= g_iMaxPlayers; user++)
		{
			if(!IsPlayer(user))
				continue
				
			if(get_user_team(user) == 2)
			{

				g_money[user] += 50
				color(user, ".v%s.g Ai castigat.e 50$.g pentru castigarea rundei.", TAG)
			}
			
			new Team = get_user_team(user);
			if(Team == 1)
				cs_set_user_team(user, CS_TEAM_CT);
			if(Team == 2)
				cs_set_user_team(user, CS_TEAM_T);
		}
		return PLUGIN_HANDLED;
	}
	else if(equal(textmsg, "#Hostages_Not_Rescued"))
		return PLUGIN_HANDLED;

	return PLUGIN_CONTINUE;
}

public sound_emit(id, channel, const sound[])
{
	if(sound[8] == 'c' && sound[9] == '4')
		return FMRES_SUPERCEDE;
	
	return FMRES_IGNORED;
}

public menu_weapons(id)
{
	static menu;
	menu = menu_create("\ySelecteaza-ti arma:", "guns_handler")
	menu_additem(menu, "\yArma noua", "")
	if(g_gunsselect[id] == 0)
		menu_additem(menu, "\dArma anterioara", "")
	else
		menu_additem(menu, "\yArma anterioara", "")
	if(g_gunsselect[id] == 0)
		menu_additem(menu, "\dArma anterioara [+AUTOMAT DATA VIITOARE]", "")
	else
		menu_additem(menu, "\yArma anterioara [+AUTOMAT DATA VIITOARE]", "")
	menu_display(id, menu, 0)
}

public guns_handler(id, menu, item)
{
	if(!is_user_alive(id))
		return;
		
	if(get_user_team(id) != 2)
		return

	switch(item)
	{
		case 0:
		{
			g_gunsselect[id] = 1
			primary_weap(id)
		}
		case 1:
		{
			if(g_gunsselect[id] == 0)
				menu_weapons(id)
			else
			{
				g_gunsselect[id] = 2
				set_guns(id)
			}
		}
		case 2:
		{
			if(g_gunsselect[id] == 0)
				menu_weapons(id)
			else
			{
				g_gunsselect[id] = 3
				set_guns(id)
			}
		}
	}
}

public primary_weap(id)
{
	if(!is_user_alive(id) || get_user_team(id) != 2)
		return
	
	static menu_head[128], menu_item[128], tasta[2];
	formatex(menu_head, charsmax(menu_head), "Selecteaza arma primara:")
	new menu = menu_create(menu_head, "primary_handled")
	for(new i = 1; i < sizeof PRIMARY_NAME; i++)
	{
		formatex(menu_item, charsmax(menu_item), "\y%s", PRIMARY_NAME[i])
		tasta[0] = i
		tasta[1] = 0
		menu_additem(menu, menu_item, tasta)
	}
	if(pev_valid(id) == PDATA_SAFE)
		set_pdata_int(id, OFFSET_CSMENUCODE, 0, OFFSET_LINUX)
	
	menu_display(id, menu, 0)
}

public primary_handled(id, menu, item)
{
	if(!is_user_alive(id) || get_user_team(id) != 2)
		return PLUGIN_HANDLED;
		
	if(item == MENU_EXIT)
    {
        menu_destroy(menu);
        return PLUGIN_HANDLED;
    }
	if(item >= sizeof PRIMARY_NAME) return PLUGIN_HANDLED;
	
	g_primary_select[id] = item + 1
	menu_destroy(menu)
	secondary_weap(id)
	return PLUGIN_HANDLED;
}

public secondary_weap(id)
{
	if(!is_user_alive(id) || get_user_team(id) != 2)
		return
	
	static menu_head[128], menu_item[128], tasta[2];
	formatex(menu_head, charsmax(menu_head), "Selecteaza arma secundara:")
	new menu = menu_create(menu_head, "secondary_handled")
	for(new i = 1; i < sizeof SECONDARY_NAME; i++)
	{
		formatex(menu_item, charsmax(menu_item), "\y%s", SECONDARY_NAME[i])
		tasta[0] = i
		tasta[1] = 0
		menu_additem(menu, menu_item, tasta)
	}
	if(pev_valid(id) == PDATA_SAFE)
		set_pdata_int(id, OFFSET_CSMENUCODE, 0, OFFSET_LINUX)
	menu_display(id, menu, 0)
}

public secondary_handled(id, menu, item)
{
	if(!is_user_alive(id) || get_user_team(id) != 2)
		return PLUGIN_HANDLED;
		
	if(item == MENU_EXIT)
    {
        menu_destroy(menu);
        return PLUGIN_HANDLED;
    }
	
	if(item >= sizeof SECONDARY_NAME) return PLUGIN_HANDLED;
	
	g_secondary_select[id] = item + 1
	menu_destroy(menu)
	set_guns(id)
	return PLUGIN_HANDLED;
}

public set_guns(id)
{
	if(!is_user_alive(id) || get_user_team(id) != 2)
		return;
		
	ham_give_weapon(id, wp_give_primary[g_primary_select[id]])
	cs_set_user_bpammo(id, bullets_primary[g_primary_select[id]], 250)
	ham_give_weapon(id, wp_give_secondary[g_secondary_select[id]])
	cs_set_user_bpammo(id, bullets_secondary[g_secondary_select[id]], 250)
	g_cmdguns[id] = true
}

public new_round()
{
	if(g_firstround)
	{
		set_hudmessage(random(255), random(255), random(255), -1.0, 0.15, 1, 5.1, 5.0)
		ShowSyncHudMsg(0, event_hud, "Inca asteptam jucatorii sa se conecteze.")
		return;
	}
	
	remove_task(TASK_CANPLANT)
	g_endround = false
	new Float: flTime = get_cvar_num("mp_freezetime") + (get_cvar_num("mp_roundtime") * 60) - 60.0; 
	set_task(flTime, "task_CanPlant", TASK_CANPLANT)
	g_dontdelete = false
	remove_task(TASK_REMOVEC4)
	delete_c4()
	set_task(2.0, "delete_c4", TASK_REMOVEC4, _, _, "b")
	set_lights("g")
	g_ModelChangeTargetTime = get_gametime() + ROUNDSTART_DELAY
	g_c4timer = -1;
	b_planted = false;
	g_rounds++
	color(0, ".v%s.g Apasa tasta.e M.g pentru afisarea meniului de joc.", TAG)
	SecondsUntillInvasion = 5
	if(active_fog)
		msg_create_fog(20, 200, 50, 1)
	set_task(0.1, "CountDown")
	set_hudmessage(random(255), random(255), random(255), -1.0, 0.15, 1, 5.1, 5.0)
	ShowSyncHudMsg(0, event_hud, "Pregateste-te de lupta!^nRunda %d.", g_rounds)
	set_task(5.2, "start_ambience")
	static entid = FM_NULLENT
	while((entid = fm_find_ent_by_class(entid, ClassName)))
		fm_remove_entity(entid)
	while((entid = fm_find_ent_by_class(entid, "bat")))
		fm_remove_entity(entid)
	remove_task(TASK_SPAWN)
	g_bSpawnCheckEnabled = true
	static player
	for(player = 1; player <= g_iMaxPlayers; player++)
	{
		reset_vars(player)
		HasTeleport[player] = false
		if(task_exists(player+TASK_MODELCHANGE))
		{
			remove_task(player+TASK_MODELCHANGE)
			fm_cs_user_model_update(player+TASK_MODELCHANGE)
		}
	}
	set_task(120.0, "TaskDisableSpawnCheck", TASK_SPAWN)
}

public kill_pet(id)
{
	if(pev_valid(item_pet[id]))
	{
		set_pev(item_pet[id],pev_sequence,pet_die)
		set_pev(item_pet[id],pev_gaitsequence,pet_die)
		set_pev(item_pet[id],pev_framerate,1.0)
		
		set_pev(item_pet[id],PET_FLAG,PET_KILLED)
		
		engfunc(EngFunc_DropToFloor, item_pet[id])
		
		g_pet[id] = false
	}	
	item_pet[id] = 0
}

public TaskDisableSpawnCheck()
	g_bSpawnCheckEnabled = false;
	
public FM_MagicEntityThink(iEnt)
{
	if(iEnt != g_iMagicEntity || !pev_valid(iEnt))
		return FMRES_IGNORED;
		
	set_pev(iEnt, pev_nextthink, get_gametime() + 1.0)
	static iPlayers[32];
	static iPlayersNum;
	
	get_players(iPlayers, iPlayersNum, "ce", "CT")
	if(!iPlayersNum)
		return FMRES_IGNORED;
		
	static id, i;
	for(i = 0; i < iPlayersNum; i++)
	{
		id = iPlayers[i];
		
		if(IsPlayer(id))
		{
			if(is_user_alive(id))
			{
				pev(id, pev_origin, g_fUserOrigin[id]);
					
				if(g_fUserOrigin[id][0] == g_fUserOldOrigin[id][0]
					&& g_fUserOrigin[id][1] == g_fUserOldOrigin[id][1]
					&& g_fUserOrigin[id][2] == g_fUserOldOrigin[id][2])
				{
					g_iUserCampSeconds[id]++;
					if(g_iUserCampSeconds[id] == 5)
						g_bUserIsCamping[id] = true;
					
					else if(g_iUserCampSeconds[id] > 5 && g_bSpawnCheckEnabled)
					{
						if(g_iUserCampSeconds[id] == 11)
						{
							color(0, ".v%s.e %s.g a primit slay pentru ca a campat sau e afk !", TAG, get_name(id))
							
							user_silentkill(id);
							
							g_bUserIsCamping[id] = false;
							g_iUserCampSeconds[id] = 0;
							
						}
						else
							color(id, ".v%s.g Vei primi slay in.e %i.g secund%s daca nu te misti !", TAG, 11 - g_iUserCampSeconds[id], (11 - g_iUserCampSeconds[id]) == 1 ? "a" : "e")
					}
				}
	
				else if(g_fUserOrigin[id][0] != g_fUserOldOrigin[id][0]
					|| g_fUserOrigin[id][1] != g_fUserOldOrigin[id][1]
					|| g_fUserOrigin[id][2] != g_fUserOldOrigin[id][2]) 
				{
					
					g_iUserCampSeconds[id] = 0;
					g_bUserIsCamping[id] = false;
				}
			}
		}
		g_fUserOldOrigin[id][0] = g_fUserOrigin[id][0];
		g_fUserOldOrigin[id][1] = g_fUserOrigin[id][1];
		g_fUserOldOrigin[id][2] = g_fUserOrigin[id][2];
	}
	return FMRES_IGNORED;
}

public end_round()
{
	for(new id; id <= 32; id++)
	{
		remove_task(id+TASK_AFFECT)
		if(is_user_alive(id) && !savior[id] && !destroyer[id])
			g_end_health[id] = get_user_health(id)
		if(is_user_alive(id))
		{
			set_user_godmode(id, 1)
			client_cmd(id, "+jump;-jump")
			ExecuteHamB(Ham_Player_ResetMaxSpeed, id)
		}
	}
	g_c4timer = -1;
	g_endround = true
}

public first_round()
{
	restart_seconds--
	if(restart_seconds > 0)
		g_firstround = true
	else
	{
		server_cmd("sv_restart 1")
		g_firstround = false
		return;
	}
	set_hudmessage(85, 255, 170, 0.0, 0.19, 1, 1.1, 1.0)
	show_hudmessage(0, "Asteptam ca toti jucatorii sa se conecteze.^n%d secund%s ramas%s.", restart_seconds, restart_seconds < 2 ? "a" : "e", restart_seconds < 2 ? "a" : "e")
}

public think_grenade(ent)
{
	if(!pev_valid(ent))
		return HAM_IGNORED;
	
	static Float:dmgtime, Float:current_time
	pev(ent, pev_dmgtime, dmgtime)
	current_time = get_gametime()
	
	if(dmgtime > current_time)
		return HAM_IGNORED;
	
	switch(pev(ent, PEV_NADE_TYPE))
	{
		case NADE_TYPE_NAPALM:
		{
			fire_explode(ent)
			return HAM_SUPERCEDE;
		}
		case NADE_TYPE_FROST:
		{
			frost_explode(ent)
			return HAM_SUPERCEDE;
		}
		case NADE_TYPE_CRAZY:
		{
			crazy_explode(ent)
			return HAM_SUPERCEDE;
		}
		case NADE_TYPE_KILL:
		{
			if (entity_get_int(ent, EV_INT_movetype) != MOVETYPE_BOUNCEMISSILE)
				return HAM_IGNORED
			
			if (entity_get_float(ent, EV_FL_dmgtime) > get_gametime() + 2.5)
			{
				entity_set_float(ent, EV_FL_dmgtime, get_gametime() + 2.5)
			}
			
			new owner = pev(ent, pev_owner)
			new Float:origin[3]
			entity_get_vector(ent, EV_VEC_origin, origin)
			
			if (entity_get_float(ent, EV_FL_dmgtime) < get_gametime() || !is_user_connected(owner) || is_user_connecting(owner))
			{
				clear_beamfollow(ent)
				entity_set_int(ent, EV_INT_flags, FL_KILLME)
				metal_gibs(origin)
				
				return HAM_SUPERCEDE
			}
			
			new team = _:cs_get_user_team(owner)
			
			new target, Float:velocity[3], oldtarget
			target = entity_get_edict(ent, EV_ENT_euser2)
			oldtarget = entity_get_edict(ent, EV_ENT_euser3)
			
			if (target == owner)
			{
				target = 0
				entity_set_edict(ent, EV_ENT_euser2, 0)
			}
			
			if (target == 0)
			{
				entity_get_vector(ent, EV_VEC_velocity, velocity)
				
				if (xs_vec_len(velocity) < 200.0)
				{
					xs_vec_mul_scalar(velocity, xs_vec_len(velocity) + 50.0, velocity)
					entity_set_vector(ent, EV_VEC_velocity, velocity)
				}
				
				new i = -1, Float:distance = 300.0, Float:junk[3], targetteam
				
				while ((i = find_ent_in_sphere(i, origin, distance)))
				{
					if (i > g_iMaxPlayers)
						break
					
					if (i == owner)
						continue
					
					if (i == oldtarget)
						continue
					
					if (!is_user_connected(i) || is_user_connecting(i))
						continue
					
					if (!is_user_alive(i))
						continue
					
					targetteam = _:cs_get_user_team(i)
					
					if ((team != targetteam && targetteam != _:CS_TEAM_SPECTATOR && targetteam != _:CS_TEAM_UNASSIGNED))
					{
						static Float:o[3]
						entity_get_vector(i, EV_VEC_origin, o)
						entity_get_vector(i, EV_VEC_view_ofs, junk)
						xs_vec_add(o, junk, o)
						static Float:new_distance
						new_distance = get_distance_f(o, origin)
						
						if (new_distance < distance)
						{
							distance = new_distance
							entity_set_edict(ent, EV_ENT_euser2, i)
						}
					}
				}
				
				if (entity_range(owner, ent) < distance && entity_get_int(ent, EV_INT_iuser2) > 0)
				{
					entity_set_edict(ent, EV_ENT_euser2, owner)
				}
				
				entity_set_float(ent, EV_FL_nextthink, get_gametime() + 0.02)
				
				return HAM_SUPERCEDE
			}
			else if (!is_user_alive(target))
			{
				entity_get_vector(ent, EV_VEC_velocity, velocity)
				
				if (xs_vec_len(velocity) < 200.0)
				{
					xs_vec_mul_scalar(velocity, xs_vec_len(velocity) + 50.0, velocity)
					entity_set_vector(ent, EV_VEC_velocity, velocity)
				}
				
				entity_set_edict(ent, EV_ENT_euser2, 0)
				entity_set_float(ent, EV_FL_nextthink, get_gametime() + 0.02)
				return HAM_SUPERCEDE
			}
			else
			{
				new Float:aim[3], Float:targetorigin[3], Float:velocity_normal[3], Float:aim_normal[3]
				
				entity_get_vector(target, EV_VEC_origin, targetorigin)
				
				xs_vec_add(targetorigin, Float:{0.0, 0.0, 30.0}, targetorigin)
				
				if (!is_point_visible(origin, targetorigin, ent))
				{
					entity_set_edict(ent, EV_ENT_euser2, 0)
					entity_set_float(ent, EV_FL_nextthink, get_gametime() + 0.02)
					return HAM_SUPERCEDE
				}
				
				xs_vec_sub(targetorigin, origin, aim)
				
				if (xs_vec_len(aim) <= 100.0)
				{
					xs_vec_mul_scalar(aim, 800.0/xs_vec_len(aim), aim)
					
					entity_set_vector(ent, EV_VEC_velocity, aim)
					
					if (target == owner && get_distance_f(targetorigin, origin) <= 1.0)
					{
						new Float:torigin[3]
						entity_get_vector(owner, EV_VEC_origin, torigin)
						blood(torigin)
						set_pdata_int(owner, OFFSET_LAST_HIT_GROUP, HIT_HEAD, 5)
						ExecuteHamB(Ham_TakeDamage, owner, ent, owner, 135.0, DMG_CS_BULLETS_KNIFE)
						entity_set_edict(ent, EV_ENT_euser2, 0)
						entity_set_edict(ent, EV_ENT_euser3, owner)
						
						new color[3] , impacts
						color[0] = 165
						color[1] = 45
						color[2] = 45
						
						create_blast(origin, color)
						
						impacts = entity_get_int(ent, EV_INT_iuser2)
						
						impacts++
						
						entity_set_int(ent, EV_INT_iuser2, impacts)
						
						if (impacts >= 1)
						{
							clear_beamfollow(ent)
							entity_set_int(ent, EV_INT_flags, FL_KILLME)
							metal_gibs(origin)
						}
					}
					
					entity_set_float(ent, EV_FL_nextthink, get_gametime() + 0.02)
					return HAM_SUPERCEDE
				}
				
				entity_get_vector(ent, EV_VEC_velocity, velocity)
				
				xs_vec_sub(targetorigin, origin, aim)
				
				xs_vec_normalize(velocity, velocity_normal)
				xs_vec_normalize(aim, aim_normal)
				
				if (xs_vec_len(velocity) < 200.0)
				{
					xs_vec_mul_scalar(velocity, xs_vec_len(velocity) + 50.0, velocity)
				}
				
				if (xs_vec_dot(aim_normal, velocity_normal) < 0)
				{
					entity_set_edict(ent, EV_ENT_euser2, 0)
					entity_set_float(ent, EV_FL_nextthink, get_gametime() + 0.02)
					entity_set_vector(ent, EV_VEC_velocity, velocity)
					return HAM_SUPERCEDE
				}
				
				if (velocity_normal[0] < aim_normal[0])
				{
					velocity[0] += 150.0
				}
				else if (velocity_normal[0] > aim_normal[0])
				{
					velocity[0] -= 150.0
				}
				
				if (velocity_normal[1] < aim_normal[1])
				{
					velocity[1] += 150.0
				}
				else if (velocity_normal[1] > aim_normal[1])
				{
					velocity[1] -= 150.0
				}
				
				if (velocity_normal[2] < aim_normal[2])
				{
					velocity[2] += 25.0
				}
				else if (velocity_normal[2] > aim_normal[2])
				{
					velocity[2] -= 25.0
				}
				
				velocity[2] += 5.0
				
				entity_set_vector(ent, EV_VEC_velocity, velocity)
			}
			
			entity_set_float(ent, EV_FL_nextthink, get_gametime() + 0.02)
			return HAM_SUPERCEDE
		}
	}
	return HAM_IGNORED;
}

public crazy_explode(entity)
{
	if(!pev_valid(entity))
		return
	
	static Float:origin[3];
	pev(entity, pev_origin, origin)
	create_blast4(origin)
	emit_sound(entity, CHAN_WEAPON, explosion_sound, VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
	static victim 
	victim = -1
	
	while((victim = engfunc (EngFunc_FindEntityInSphere, victim, origin, 250.0)) != 0)
	{
		if (!is_user_alive(victim) || get_user_team(victim) != 1)
			continue
			
		if(!task_exists(victim+TASK_AFFECT)) 
			set_task(0.2, "affect_victim", victim+TASK_AFFECT, _, _, "a", 30)
	}
	engfunc(EngFunc_RemoveEntity, entity)
}

create_blast4(const Float:originF[3])
{
	engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, originF, 0)
	write_byte(TE_BEAMCYLINDER)
	engfunc(EngFunc_WriteCoord, originF[0])
	engfunc(EngFunc_WriteCoord, originF[1])
	engfunc(EngFunc_WriteCoord, originF[2])
	engfunc(EngFunc_WriteCoord, originF[0])
	engfunc(EngFunc_WriteCoord, originF[1])
	engfunc(EngFunc_WriteCoord, originF[2]+470.0)
	write_short(beam_effect)
	write_byte(0)
	write_byte(0)
	write_byte(4)
	write_byte(60)
	write_byte(0)
	write_byte(50)
	write_byte(70)
	write_byte(100)
	write_byte(200)
	write_byte(0)
	message_end()
	
	engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, originF, 0)
	write_byte(TE_BEAMCYLINDER)
	engfunc(EngFunc_WriteCoord, originF[0])
	engfunc(EngFunc_WriteCoord, originF[1])
	engfunc(EngFunc_WriteCoord, originF[2])
	engfunc(EngFunc_WriteCoord, originF[0])
	engfunc(EngFunc_WriteCoord, originF[1])
	engfunc(EngFunc_WriteCoord, originF[2]+555.0)
	write_short(beam_effect)
	write_byte(0)
	write_byte(0)
	write_byte(4)
	write_byte(60)
	write_byte(0)
	write_byte(50)
	write_byte(70)
	write_byte(100)
	write_byte(200)
	write_byte(0)
	message_end()
	
	engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, originF, 0)
	write_byte(TE_DLIGHT)
	engfunc(EngFunc_WriteCoord, originF[0])
	engfunc(EngFunc_WriteCoord, originF[1])
	engfunc(EngFunc_WriteCoord, originF[2])
	write_byte(50)
	write_byte(50)
	write_byte(70)
	write_byte(100)
	write_byte(30)
	write_byte(30)
	message_end()

	engfunc(EngFunc_MessageBegin, MSG_BROADCAST,SVC_TEMPENTITY, originF, 0)
	write_byte(TE_EXPLOSION)
	engfunc(EngFunc_WriteCoord, originF[0])
	engfunc(EngFunc_WriteCoord, originF[1])
	engfunc(EngFunc_WriteCoord, originF[2]+75)
	write_short(crazyexp)
	write_byte(17)
	write_byte(15)
	write_byte(TE_EXPLFLAG_NOSOUND)
	message_end();	
	
	engfunc(EngFunc_MessageBegin, MSG_BROADCAST,SVC_TEMPENTITY, originF, 0)
	write_byte(TE_SPRITETRAIL)
	engfunc(EngFunc_WriteCoord, originF[0])
	engfunc(EngFunc_WriteCoord, originF[1])
	engfunc(EngFunc_WriteCoord, originF[2] + 40)
	engfunc(EngFunc_WriteCoord, originF[0])
	engfunc(EngFunc_WriteCoord, originF[1])
	engfunc(EngFunc_WriteCoord, originF[2])
	write_short(crazygib)
	write_byte(30)
	write_byte(10)
	write_byte(2)
	write_byte(50)
	write_byte(10)
	message_end();
}

public affect_victim(taskid)
{
	if(g_endround)
		return;
	
	if(!is_user_alive(ID_AFFECT) || get_user_team(ID_AFFECT) != 1)
		return
		
	message_begin(MSG_ONE_UNRELIABLE, g_msgScreenFade, {0,0,0}, ID_AFFECT)
	write_short(1<<13)
	write_short(1<<14)
	write_short(0x0000)
	write_byte(random_num(50, 200))
	write_byte(random_num(50, 200))
	write_byte(random_num(50, 200))
	write_byte(random_num(50, 200))
	message_end()
		
	message_begin(MSG_ONE_UNRELIABLE, g_screenshake, {0,0,0}, ID_AFFECT)
	write_short(0xFFFF)
	write_short(1<<13)
	write_short(0xFFFF)
	message_end()
	remove_task(ID_AFFECT)
}

public set_model(entity, const model[])
{
	if(strlen(model) < 8)
		return FMRES_IGNORED;

	if(model[7] != 'w' || model[8] != '_')
		return FMRES_IGNORED;
	
	static Float:dmgtime
	pev(entity, pev_dmgtime, dmgtime)
	
	if(get_user_team(pev(entity, pev_owner)) == 1)
	{
		if(dmgtime == 0.0)
			return FMRES_IGNORED;
		if(model[9] == 'h' && model[10] == 'e')
		{
			message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
			write_byte(TE_BEAMFOLLOW)
			write_short(entity)
			write_short(trail_spr)
			write_byte(15)
			write_byte(10)
			write_byte(200)
			write_byte(20)
			write_byte(10)
			write_byte(200)
			message_end()
			set_pev(entity, PEV_NADE_TYPE, NADE_TYPE_NAPALM)
			fm_set_rendering(entity, kRenderFxGlowShell, 200, 20, 10, kRenderNormal, 18)
			entity_set_model(entity, w_grenade_furien[0])
			return FMRES_SUPERCEDE;
		}
		else if(model[9] == 'f' && model[10] == 'l')
		{
			message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
			write_byte(TE_BEAMFOLLOW)
			write_short(entity)
			write_short(trail_spr)
			write_byte(15)
			write_byte(10)
			write_byte(10)
			write_byte(20)
			write_byte(200)
			write_byte(200)
			message_end()
			set_pev(entity, PEV_NADE_TYPE, NADE_TYPE_FROST)
			fm_set_rendering(entity, kRenderFxGlowShell, 10, 20, 200, kRenderNormal, 18)
			entity_set_model(entity, w_grenade_furien[1])
			return FMRES_SUPERCEDE;
		}
		else if(model[9] == 's' && model[10] == 'm')
		{
			if(have_killnade[pev(entity, pev_owner)])
			{
				message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
				write_byte(TE_BEAMFOLLOW)
				write_short(entity)
				write_short(trail_spr)
				write_byte(15)
				write_byte(15)
				write_byte(165)
				write_byte(45)
				write_byte(45)
				write_byte(200)
				message_end()
				set_pev(entity, PEV_NADE_TYPE, NADE_TYPE_KILL)
				entity_set_int(entity, EV_INT_movetype, MOVETYPE_BOUNCEMISSILE)
				entity_set_int(entity, EV_INT_iuser2, 0)
				entity_set_edict(entity, EV_ENT_euser2, 0)
				entity_set_size(entity, Float:{-2.0,-4.0,-2.0}, Float:{2.0, 4.0, 2.0})
				fm_set_rendering(entity, kRenderFxGlowShell, 165, 45, 45, kRenderNormal, 18)
				entity_set_float(entity, EV_FL_dmgtime, get_gametime() + 2.5)
				entity_set_model(entity, w_grenade_furien[2])
				have_killnade[pev(entity, pev_owner)] = false
				return FMRES_SUPERCEDE;
			}
			return FMRES_IGNORED;
		}
		return FMRES_IGNORED;
	}
	else
	{
		if(model[9] == 'h' && model[10] == 'e')
		{
			if(dmgtime == 0.0)
				return FMRES_IGNORED;
			message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
			write_byte(TE_BEAMFOLLOW)
			write_short(entity)
			write_short(trail_spr)
			write_byte(15)
			write_byte(10)
			write_byte(100)
			write_byte(50)
			write_byte(70)
			write_byte(200)
			message_end()
			fm_set_rendering(entity, kRenderFxGlowShell, 100, 50, 70, kRenderNormal, 18)
		}
		else if(model[9] == 'f' && model[10] == 'l')
		{
			if(dmgtime == 0.0)
				return FMRES_IGNORED;
			message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
			write_byte(TE_BEAMFOLLOW)
			write_short(entity)
			write_short(trail_spr)
			write_byte(15)
			write_byte(10)
			write_byte(200)
			write_byte(200)
			write_byte(200)
			write_byte(200)
			message_end()
			fm_set_rendering(entity, kRenderFxGlowShell, 200, 200, 200, kRenderNormal, 18)
		}
		else if(model[9] == 's' && model[10] == 'm')
		{
			if(dmgtime == 0.0)
				return FMRES_IGNORED;
			message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
			write_byte(TE_BEAMFOLLOW)
			write_short(entity)
			write_short(trail_spr)
			write_byte(15)
			write_byte(10)
			write_byte(50)
			write_byte(70)
			write_byte(100)
			write_byte(200)
			message_end()
			set_pev(entity, PEV_NADE_TYPE, NADE_TYPE_CRAZY)
			fm_set_rendering(entity, kRenderFxGlowShell, 50, 70, 100, kRenderNormal, 18)
		}
		else
			fm_set_rendering(entity, kRenderFxGlowShell, random(256), random(256), random(256), kRenderNormal, 18)
	}
	return FMRES_IGNORED;
}

public CWeaponBox_Touch(iWeaponBox, id)
{
	if(IsPlayer(id))
	{
		if(!is_user_alive(id))
			return HAM_SUPERCEDE

		if(IsWeaponBoxC4(iWeaponBox))
			return HAM_IGNORED

		if(get_user_team(id) == 1)
			return HAM_SUPERCEDE
		return HAM_IGNORED
	}
	return HAM_IGNORED
}

public GroundWeapon_Touch(iWeapon, id)
{
	if(IsPlayer(id))
	{
		if(!is_user_alive(id))
			return HAM_SUPERCEDE

		if(get_user_team(id) == 1)
			return HAM_SUPERCEDE
		return HAM_IGNORED
	}
	return HAM_IGNORED
}

public game_menu(id)
{
	if(get_user_team(id) == 3)
		return PLUGIN_CONTINUE;
	
	static menu_title[150], menu;
	formatex(menu_title, charsmax(menu_title), "\yFurien Mod Remaked" )
	menu = menu_create(menu_title, "gmenu_handler")
	static menu_item[150];
	static izStats[8], izBody[8], iRankPos, iRankMax;
	iRankPos = get_user_stats(id, izStats, izBody)
	iRankMax = get_statsnum()
	if(get_user_team(id) != 2 || !is_user_alive(id))
		formatex(menu_item, charsmax(menu_item), "\dMeniu Arme")
	else
	{
		if(g_cmdguns[id] && g_gunsselect[id] == 0)
			formatex(menu_item, charsmax(menu_item), "\dMeniu Arme [FOLOSIT | NU ESTE AUTOMAT]")
		else if(g_cmdguns[id] && g_gunsselect[id] == 1)
			formatex(menu_item, charsmax(menu_item), "\dMeniu Arme [FOLOSIT | NU ESTE AUTOMAT]")
		else if(g_cmdguns[id] && g_gunsselect[id] == 2)
			formatex(menu_item, charsmax(menu_item), "\dMeniu Arme [FOLOSIT | ALES DE RUNDA TRECUTA]")
		else if(g_cmdguns[id] && g_gunsselect[id] == 3)
			formatex(menu_item, charsmax(menu_item), "\dMeniu Arme [FOLOSIT | AUTOMAT]")
		else if(!g_cmdguns[id])
			formatex(menu_item, charsmax(menu_item), "\yMeniu Arme\r [NEFOLOSIT]")
	}
	menu_additem(menu, menu_item, "")
	if(!is_user_alive(id))
		formatex(menu_item, charsmax(menu_item), "\dMeniu Shop [%i$]", g_money[id])
	else
		formatex(menu_item, charsmax(menu_item), "\yMeniu Shop\r [%i$]", g_money[id])
	menu_additem(menu, menu_item, "")
	if(!(get_user_flags(id) & VIP_FLAG))
		formatex(menu_item, charsmax(menu_item), "\dOpen VIP Shop")
	else
		formatex(menu_item, charsmax(menu_item), "\yOpen VIP Shop")
	menu_additem(menu, menu_item, "")
	formatex(menu_item, charsmax(menu_item), "\yRank:\r [%d\y/\r %d]^nTotal:\r [%d\y UCIDERI |\r %d\y DECESE]", iRankPos, iRankMax, izStats[0], izStats[1])
	menu_additem(menu, menu_item, "")
	formatex(menu_item, charsmax(menu_item), "\yTop Rank\r Players")
	menu_additem(menu, menu_item, "")
	formatex(menu_item, charsmax(menu_item), "\yTop 15\r Levels")
	menu_additem(menu, menu_item, "")
	if(get_user_flags(id) & ADMIN_SLAY)
		formatex(menu_item, charsmax(menu_item), "\yJoin Spectator")
	else
		formatex(menu_item, charsmax(menu_item), "\dJoin Spectator")
	menu_additem(menu, menu_item, "")
	menu_display(id, menu, 0)
	return PLUGIN_HANDLED;
}

public gmenu_handler(id, menu, item)
{
	switch(item)
	{
		case 0:
		{
			if(!is_user_alive(id))
			{
				color(id, ".v%s.g Trebuie sa fii in.e viata.g pentru acest meniu.", TAG)
				return PLUGIN_HANDLED;
			}
			
			if(get_user_team(id) != 2)
			{
				color(id, ".v%s.g Trebuie sa fii.e Anti-Furien.g pentru a folosi acest meniu.", TAG)
				return PLUGIN_HANDLED;
			}
			
			if(g_cmdguns[id] && g_gunsselect[id] == 0)
			{
				color(id, ".v%s.g Meniul tau este deja activat.g.", TAG)
				return PLUGIN_HANDLED;
			}
			else if(g_cmdguns[id] && g_gunsselect[id] == 1)
			{
				color(id, ".v%s.g Meniul tau este deja.e activat.g.", TAG)
				return PLUGIN_HANDLED;
			}
			else if(g_cmdguns[id] && g_gunsselect[id] == 2)
			{
				color(id, ".v%s.g Meniul tau este deja.e activat.g.", TAG)
				return PLUGIN_HANDLED;
			}
			else if(g_cmdguns[id] && g_gunsselect[id] == 3)
			{
				color(id, ".v%s.g Meniul tau a fost.e reactivat.g.", TAG)
				g_gunsselect[id] = 0
				return PLUGIN_HANDLED;
			}
			else if(!g_cmdguns[id])
			{
				color(id, ".v%s.g Meniul tau de.e arme.g este reafisat.", TAG)
				primary_weap(id)
				return PLUGIN_HANDLED;
			}
			return PLUGIN_HANDLED;
		}
		case 1:
		{
			if(!is_user_alive(id))
			{
				color(id, ".v%s.g Shopul poate fi folosit doar daca sunteti in viata.", TAG)
				return PLUGIN_HANDLED;
			}
			shop_enter(id)
			return PLUGIN_HANDLED;
		}
		case 2:
		{
			if(!is_user_connected(id))
				return PLUGIN_HANDLED;
			
			shop_menu(id)
			return PLUGIN_HANDLED;
		}
		case 3:
		{
			if(!is_user_connected(id))
				return PLUGIN_HANDLED;
			
			static izStats[8], izBody[8], iRankPos, iRankMax;
			iRankPos = get_user_stats(id, izStats, izBody)
			iRankMax = get_statsnum()
			color(0, ".v%s.e %s.g este pe locul.e %d/%d.g. Are.e %d.g ucideri si.e %d.g decese.", TAG, get_name(id), iRankPos, iRankMax, izStats[0], izStats[1])
			return PLUGIN_HANDLED;
		}
		case 4:
		{
			if(!is_user_connected(id))
				return PLUGIN_HANDLED;
				
			open_topmenu(id)
			return PLUGIN_HANDLED;
		}
		case 5:
		{
			if(!is_user_connected(id))
				return PLUGIN_HANDLED;

			show_top(id)
			return PLUGIN_HANDLED;
		}
		case 6:
		{
			if(get_user_flags(id) & ADMIN_SLAY)
			{
				if(is_user_alive(id))
					user_kill(id)
				cs_set_user_team(id, CS_TEAM_SPECTATOR)
				color(0, ".v%s.e %s.g s-a mutat spectator.", TAG, get_name(id))
				return PLUGIN_HANDLED;
			}
			else
			{
				color(id, ".v%s.g Nu ai acces la aceasta comanda.", TAG)
				return PLUGIN_HANDLED;
			}
			return PLUGIN_HANDLED;
		}
	}
	return PLUGIN_HANDLED;
}

public open_topmenu(id)
{
	new menu = menu_create("\yTop Rank Players", "topmenu_handler")
	new stats_taked[8], crap[8], player_name[32], temp_message[256], add_item_menu[4], max_pages, iRankMax = get_statsnum();
	
	if(iRankMax < 360)
		max_pages = iRankMax
	else
		max_pages = 360
	
	for(new page = 0; page < max_pages; page++) 
	{
		get_stats(page, stats_taked, crap, player_name, charsmax(player_name))
		num_to_str(page + 1, add_item_menu, charsmax(add_item_menu))
		format(temp_message, charsmax(temp_message), "\y%s\d R:\r %i\d K:\r %i\d D:\r %i", player_name, page + 1, stats_taked[0], stats_taked[1])
		menu_additem(menu, temp_message, add_item_menu, 0)
	}
	menu_display(id, menu, 0)
}

public topmenu_handler(id, menu, item)
	return PLUGIN_HANDLED;

public plasma_bomb_effects(c4)
{
	c4 -= 652450
	
	if(g_endround)
	{
		remove_task(c4+652450)
		return;
	}
	
	if(!b_planted)
	{
		remove_task(c4+652450)
		return;
	}
	
	if(!pev_valid(c4))
	{
		remove_task(c4+652450)
		return;
	}
	
	new Float:origini[3]
	pev(c4, pev_origin, origini)
	engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, origini, 0)
	write_byte(TE_BEAMCYLINDER)
	engfunc(EngFunc_WriteCoord, origini[0])
	engfunc(EngFunc_WriteCoord, origini[1])
	engfunc(EngFunc_WriteCoord, origini[2])
	engfunc(EngFunc_WriteCoord, origini[0])
	engfunc(EngFunc_WriteCoord, origini[1])
	engfunc(EngFunc_WriteCoord, origini[2]+400.0)
	write_short(beam_effect)
	write_byte(0)
	write_byte(0)
	write_byte(4)
	write_byte(10)
	write_byte(0)
	write_byte(random(256))
	write_byte(random(256))
	write_byte(random(256))
	write_byte(200)
	write_byte(0)
	message_end()
	
	engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, origini, 0)
	write_byte(TE_BEAMCYLINDER)
	engfunc(EngFunc_WriteCoord, origini[0])
	engfunc(EngFunc_WriteCoord, origini[1])
	engfunc(EngFunc_WriteCoord, origini[2])
	engfunc(EngFunc_WriteCoord, origini[0])
	engfunc(EngFunc_WriteCoord, origini[1])
	engfunc(EngFunc_WriteCoord, origini[2]+450.0)
	write_short(beam_effect)
	write_byte(0)
	write_byte(0)
	write_byte(4)
	write_byte(15)
	write_byte(0)
	write_byte(random(256))
	write_byte(random(256))
	write_byte(random(256))
	write_byte(200)
	write_byte(0)
	message_end()
	engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, origini, 0)
	write_byte(TE_BEAMCYLINDER)
	engfunc(EngFunc_WriteCoord, origini[0])
	engfunc(EngFunc_WriteCoord, origini[1])
	engfunc(EngFunc_WriteCoord, origini[2])
	engfunc(EngFunc_WriteCoord, origini[0])
	engfunc(EngFunc_WriteCoord, origini[1])
	engfunc(EngFunc_WriteCoord, origini[2]+550.0)
	write_short(beam_effect)
	write_byte(0)
	write_byte(0)
	write_byte(4)
	write_byte(25)
	write_byte(0)
	write_byte(random(256))
	write_byte(random(256))
	write_byte(random(256))
	write_byte(200)
	write_byte(0)
	message_end()
	
	fm_set_rendering(c4, kRenderFxGlowShell, random(255), random(255), random(255), kRenderNormal, 50)
	if(g_c4timer < 11)
	{
		static Float:coord[3];
		coord[0] = origini[0] + 150.0;
		coord[1] = origini[1] + 150.0;
		coord[2] = origini[2] + 800.0;
		create_thunder(coord, origini);
		if(active_fog)
			msg_create_fog(random(250), random(250), random(250), 3)
	}

	if(g_c4timer >= 0)
	{
		--g_c4timer;
		if(g_c4timer < 41 && g_c4timer > 13)
			emit_sound(c4, CHAN_ITEM, misc_sound_wav[3], 1.0, ATTN_NORM, 0, PITCH_NORM)
		else if(g_c4timer == 13)
		{
			emit_sound(c4, CHAN_ITEM, misc_sound_wav[4], 1.0, ATTN_NORM, 0, PITCH_NORM)
			set_lights("c")
		}
		set_dhudmessage(random(255), random(255), random(255), -1.0, 0.0, 1, 1.0, 1.0, 0.0, 0.0)
		if(g_c4timer > 0)
			show_dhudmessage(0, "%d secund%s ramas%s pana la explozie!", g_c4timer, g_c4timer < 2 ? "a" : "e", g_c4timer < 2 ? "a" : "e")
	}
}

public check_weapon(id)
{
	if(!is_user_alive(id))
		return;
		
	switch(get_user_team(id))
	{
		case 1:
		{
			switch(get_user_weapon(id))
			{
				case CSW_KNIFE:
				{
					if(g_superknife[id])
						set_pev(id, pev_viewmodel2, super_knife_furien)
					else
						set_pev(id, pev_viewmodel2, knife_furien)
				}
				case CSW_HEGRENADE: set_pev(id, pev_viewmodel2, v_grenade_furien[0])
				case CSW_FLASHBANG: set_pev(id, pev_viewmodel2, v_grenade_furien[1])
				case CSW_SMOKEGRENADE:
				{
					if(have_killnade[id])
						set_pev(id, pev_viewmodel2, v_grenade_furien[2])
				}
				case CSW_C4:
				{
					set_pev(id, pev_viewmodel2, plasma_bomb[1])
					set_pev(id, pev_weaponmodel2, plasma_bomb[0])
				}
			}
		}
		case 2:
		{
			if(g_ak47[id] && get_user_weapon(id) == CSW_AK47)
			{
				set_pev(id, pev_viewmodel2, v_ak47)
				set_pev(id, pev_weaponmodel2, p_ak47)
			}
			else if(g_m4a1[id] && get_user_weapon(id) == CSW_M4A1)
			{
				set_pev(id, pev_viewmodel2, v_m4a1)
				set_pev(id, pev_weaponmodel2, p_m4a1)
			}
			else if(g_deagle[id] && get_user_weapon(id) == CSW_DEAGLE)
			{
				set_pev(id, pev_viewmodel2, v_deagle)
				set_pev(id, pev_weaponmodel2, p_deagle)
			}
		}
	}
}

public msg_screenfade(msgid, dest, id)
{
	if(!IsPlayer(id))
		return PLUGIN_CONTINUE
	
	if(get_user_team(id) == 2 || !is_user_alive(id) || g_noflash[id])
	{
		static date[4]
		date[0] = get_msg_arg_int(4); date[1] = get_msg_arg_int(5)
		date[2] = get_msg_arg_int(6); date[3] = get_msg_arg_int(7)
		
		if(date[0] == 255 && date[1] == 255 && date[2] == 255 && date[3] > 199)
			return PLUGIN_HANDLED
	}
	return PLUGIN_CONTINUE
}

public ham_take_damage(vic, inf, att, Float:dmg, dmgbits)
{
	if(get_user_team(att) == 1 && g_superknife[att] && !(dmgbits & DMG_NADE))
		dmg *= 2.0
		
	if(is_user_alive(att) && get_user_team(att) == 2 && ((g_ak47[att] && get_user_weapon(att) == CSW_AK47) || (g_m4a1[att] && get_user_weapon(att) == CSW_M4A1) || (g_deagle[att] && get_user_weapon(att) == CSW_DEAGLE)))
		dmg *= 2.0
	
	SetHamParamFloat(4, dmg)
	
	if(is_user_alive(vic) && inf == bomba)
	{
		SetHamParamFloat(4, 0.0);
		return HAM_SUPERCEDE;
	}
	if((vic == att) && (dmgbits & DMG_NADE))
		return HAM_SUPERCEDE;
	return HAM_IGNORED;
}

public on_damage(id)
{
	static attacker; attacker = get_user_attacker(id)
	static damage; damage = read_data(2)		
	if(IsPlayer(attacker))
	{
		if(fm_is_ent_visible(attacker, id))
		{
			g_iPlayerPos[attacker] += 1
			if(g_iPlayerPos[attacker] == sizeof(g_flCoords))
				g_iPlayerPos[attacker] = 0		
			set_dhudmessage(random(256), random(256), random(256), Float:g_flCoords[g_iPlayerPos[attacker]][0], Float:g_flCoords[g_iPlayerPos[attacker]][1], 0, 0.1, 2.5, 0.02, 0.02)
			show_dhudmessage(attacker, "%i^n", damage)				
		}
	}
}

register_buy_cmd()
{
	register_clcmd("buy", "ClientCommand_Buy")
	register_clcmd("bUy", "ClientCommand_Buy")
	register_clcmd("buY", "ClientCommand_Buy")
	register_clcmd("bUY", "ClientCommand_Buy")
	register_clcmd("Buy", "ClientCommand_Buy")
	register_clcmd("BUy", "ClientCommand_Buy")
	register_clcmd("BuY", "ClientCommand_Buy")
	register_clcmd("BUY", "ClientCommand_Buy")
}

public ClientCommand_Buy(id)
	return PLUGIN_HANDLED_MAIN

PlaySound(const sound[])
{
	if(equal(sound[strlen(sound)-4], ".mp3"))
		client_cmd(0, "mp3 play ^"%s^"", sound)
	else
		client_cmd(0, "spk ^"%s^"", sound)
}

public ScreenFade(red, green, blue)
{
	message_begin(MSG_BROADCAST, g_msgScreenFade);
	write_short((1<<12)*4);
	write_short((1<<12)*1);
	write_short(0x0001);
	write_byte(red);
	write_byte(green);
	write_byte(blue);
	write_byte(250);
	message_end();
}

set_vars_speed(id)
	client_cmd(id, "cl_sidespeed 700;cl_backspeed 700;cl_forwardspeed 700")
	
public sound_stop()
	client_cmd(0, "mp3 stop; stopsound")
	
public start_ambience()
{
	sound_stop()
	client_cmd(0, "mp3 play ^"%s^"", ambience)
}

public killed_player(victim, attacker)
{
	if(is_user_connected(victim) && is_user_alive(attacker))
		color(victim, ".v%s.e %s.g mai are inca.e[.v%d HP.e].g", TAG, get_name(attacker), get_user_health(attacker))
	g_frozen[victim] = false
	g_noflash[victim] = false
	g_nofrost[victim] = false
	g_superknife[victim] = false
	g_furiendetector[victim] = false
	g_end_health[victim] = 0
	parachute_reset(victim)
	have_killnade[victim] = false
	remove_task(victim+TASK_AFFECT)
	remove_task(victim+TASK_AURA)
	if(g_pet[victim])
		kill_pet(victim)

	reset_vars(victim)
	if(active_box)
		AddBonusBox(victim)
	if(get_user_team(victim) == 2)
		remove_task(victim+TASK_BURN)
		
	if(is_user_connected(attacker) && is_user_connected(victim) && attacker != victim)
		g_money[attacker] += 3
		
	if(destroyer[victim])
	{
		ham_strip_weapon(victim, "weapon_c4")
		destroyer[victim] = false
		select_destroyer()
	}
	if(savior[victim])
	{
		strip_user_weapons(victim)
		savior[victim] = false
		select_savior()
	}
}

public newSpawn(id)
{
	if(para_ent[id] > 0) 
		if(is_valid_ent(para_ent[id])) 
			remove_entity(para_ent[id])
	has_parachute[id] = true
	para_ent[id] = 0
	if(!active_huds)
	{
		set_pdata_int(id, m_iClientHideHUD, 0)
		set_pdata_int(id, m_iHideHUD, HIDE_HEALTH)
	}
	make_HideWeapon(id, HIDE_MONEY);
}

public fw_SetClientKeyValue(id, const infobuffer[], const key[], const value[])
{
	if(flag_get(g_HasCustomModel, id) && equal(key, "model"))
	{
		static currentmodel[32]
		fm_cs_get_user_model(id, currentmodel, charsmax(currentmodel))
		if(!equal(currentmodel, g_CustomPlayerModel[id]) && !task_exists(id+TASK_MODELCHANGE))
			fm_cs_set_user_model(id+TASK_MODELCHANGE)
		return FMRES_SUPERCEDE;
	}
	return FMRES_IGNORED;
}

public CmdStart(id, uc_handle, seed)
{
	new ent = fm_find_ent_by_class(id, ClassName)
	if(is_valid_ent(ent))
	{
		new classname[32]	
		pev(ent, pev_classname, classname, 31)
		if (equal(classname, ClassName))
		{
			if (pev(ent, pev_frame) >= 120)
				set_pev(ent, pev_frame, 0.0)
			else
				set_pev(ent, pev_frame, pev(ent, pev_frame) + 1.0)
			
			switch(pev(ent, pev_team))
			{
				case 1: 
				{
					
				}
				case 2: 
				{
					
				}
			}
		}
	}
}

parachute_reset(id)
{
	if(para_ent[id] > 0) 
		if(is_valid_ent(para_ent[id])) 
			remove_entity(para_ent[id])
	has_parachute[id] = false
	para_ent[id] = 0
}

fire_explode(ent)
{
	if(g_endround)
		return
	
	static Float:originF[3]
	pev(ent, pev_origin, originF)
	create_blast2(originF)
	emit_sound(ent, CHAN_WEAPON, misc_sound_wav[6], 1.0, ATTN_NORM, 0, PITCH_NORM)
	static victim
	victim = -1
	while((victim = engfunc(EngFunc_FindEntityInSphere, victim, originF, 250.0)) != 0)
	{
		if(!is_user_alive(victim) || get_user_team(victim) != 2)
			continue;
			
		g_burning_duration[victim] += 15
		
		if(!task_exists(victim+TASK_BURN))
			set_task(0.2, "burning_flame", victim+TASK_BURN, _, _, "b")
	}
	engfunc(EngFunc_RemoveEntity, ent)
}

frost_explode(ent)
{
	if(g_endround)
		return
		
	static Float:originF[3]
	pev(ent, pev_origin, originF)
	create_blast3(originF)
	emit_sound(ent, CHAN_WEAPON, misc_sound_wav[1], 1.0, ATTN_NORM, 0, PITCH_NORM)
	static victim
	victim = -1
	
	while((victim = engfunc(EngFunc_FindEntityInSphere, victim, originF, 250.0)) != 0)
	{
		if(!is_user_alive(victim) || get_user_team(victim) != 2 || g_nofrost[victim])
			continue;
		
		fm_set_rendering(victim, kRenderFxGlowShell, 0, 100, 200, kRenderNormal, 25)
		emit_sound(victim, CHAN_BODY, misc_sound_wav[2], 1.0, ATTN_NORM, 0, PITCH_NORM)
		
		message_begin(MSG_ONE_UNRELIABLE, g_msgScreenFade, _, victim)
		write_short(0)
		write_short(0)
		write_short(FFADE_STAYOUT)
		write_byte(10)
		write_byte(20)
		write_byte(200)
		write_byte(150)
		message_end()
		g_frozen[victim] = true
		if(pev(victim, pev_flags) & FL_ONGROUND)
			set_pev(victim, pev_gravity, 999999.9)
		else
			set_pev(victim, pev_gravity, 0.000001)
		reset_max_speed(victim)
		set_task(0.2, "freeze_effect", victim, _, _, "b")
		set_task(1.2, "remove_freeze", victim)
	}
	engfunc(EngFunc_RemoveEntity, ent)
}

public burning_flame(taskid)
{
	static origin[3], flags
	get_user_origin(ID_BURN, origin)
	flags = pev(ID_BURN, pev_flags)
	
	if((flags & FL_INWATER) || g_burning_duration[ID_BURN] < 1)
	{
		message_begin(MSG_PVS, SVC_TEMPENTITY, origin)
		write_byte(TE_SMOKE)
		write_coord(origin[0])
		write_coord(origin[1])
		write_coord(origin[2]-50)
		write_short(smoke_spr)
		write_byte(random_num(15, 20))
		write_byte(random_num(10, 20))
		message_end()
		remove_task(taskid);
		return;
	}

	if(random_num(0, 20) < 3)
	{
		emit_sound(ID_BURN, CHAN_VOICE, burn_player[random_num(0, 2)], 1.0, ATTN_NORM, 0, PITCH_NORM)

		if((flags & FL_ONGROUND) > 0.0)
		{
			static Float:velocity[3];
			pev(ID_BURN, pev_velocity, velocity);
			xs_vec_mul_scalar(velocity, 0.5, velocity);
			set_pev(ID_BURN, pev_velocity, velocity);
		}
	}
	
	static health
	health = get_user_health(ID_BURN)
	if(health - 1 > 0)
		set_user_health(ID_BURN, get_user_health(ID_BURN) - 1)
	
	message_begin(MSG_PVS, SVC_TEMPENTITY, origin)
	write_byte(TE_SPRITE)
	write_coord(origin[0]+random_num(-5, 5))
	write_coord(origin[1]+random_num(-5, 5))
	write_coord(origin[2]+random_num(-10, 10))
	write_short(flame_spr)
	write_byte(random_num(5, 10))
	write_byte(200)
	message_end()
	
	g_burning_duration[ID_BURN]--
}

public prethink_player(id)
{
	if(!is_user_alive(id))
		return;
		
	static i, LastThink
	
	if(LastThink > id)
		FirstThink()
	LastThink = id
	
	if(g_frozen[id])
	{
		set_pev(id, pev_velocity, Float:{0.0,0.0,0.0})
		return;
	}
	
	new nbut = get_user_button(id)
	new obut = get_user_oldbutton(id)
	if((nbut & IN_JUMP) && !(get_entity_flags(id) & FL_ONGROUND) && !(obut & IN_JUMP))
	{
		if(jumpnum[id] < 1)
		{
			dojump[id] = true
			jumpnum[id]++
			return
		}
	}
	if((nbut & IN_JUMP) && (get_entity_flags(id) & FL_ONGROUND))
	{
		jumpnum[id] = 0
		return
	}
	
	if(get_user_team(id) == 2 && (g_furiendetector[id] || savior[id]))
	{
		static Target, Body, Weapon;
		
		get_user_aiming(id, Target, Body);
		Weapon = get_user_weapon(id);
			
		if((1<<Weapon) & PRIMARY_WEAPONS_BITSUM || (1<<Weapon) & SECONDARY_WEAPONS_BITSUM) 
		{
			static Target, Body, Weapon;
			
			get_user_aiming(id, Target, Body);
			Weapon = get_user_weapon(id);
			
			if((1<<Weapon) & PRIMARY_WEAPONS_BITSUM || (1<<Weapon) & SECONDARY_WEAPONS_BITSUM) 
			{
				static Origin[3];
				get_user_origin(id, Origin, 3);
				
				message_begin(MSG_BROADCAST, SVC_TEMPENTITY);
				write_byte(TE_BEAMENTPOINT);
				write_short(id | 0x1000);
				write_coord(Origin[0]);
				write_coord(Origin[1]);
				write_coord(Origin[2]);
				write_short(LaserSprite);
				write_byte(0);
				write_byte(10);
				write_byte(1);
				write_byte(5);
				write_byte(0);
				if(is_user_alive(Target) && get_user_team(Target) == 1) 
				{
					write_byte(150);
					write_byte(0);
					write_byte(0);
				}
				else 
				{
					write_byte(0);
					write_byte(150);
					write_byte(0);
				}
				write_byte(250);
				write_byte(25);
				message_end();
			}
		}
	}
	
	if(!has_parachute[id])
		return

	new Float:fallspeed = 100.0 * -1.0
	new Float:frame

	new button = get_user_button(id)
	new oldbutton = get_user_oldbutton(id)
	new flags = get_entity_flags(id)

	if(para_ent[id] > 0 && (flags & FL_ONGROUND)) 
	{
		if(entity_get_int(para_ent[id],EV_INT_sequence) != 2) 
		{
			entity_set_int(para_ent[id], EV_INT_sequence, 2)
			entity_set_int(para_ent[id], EV_INT_gaitsequence, 1)
			entity_set_float(para_ent[id], EV_FL_frame, 0.0)
			entity_set_float(para_ent[id], EV_FL_fuser1, 0.0)
			entity_set_float(para_ent[id], EV_FL_animtime, 0.0)
			entity_set_float(para_ent[id], EV_FL_framerate, 0.0)
			return
		}

		frame = entity_get_float(para_ent[id],EV_FL_fuser1) + 2.0
		entity_set_float(para_ent[id],EV_FL_fuser1,frame)
		entity_set_float(para_ent[id],EV_FL_frame,frame)

		if(frame > 254.0) 
		{
			remove_entity(para_ent[id])
			para_ent[id] = 0
		}
	}

	if(button & IN_USE) 
	{
		new Float:velocity[3]
		entity_get_vector(id, EV_VEC_velocity, velocity)

		if(velocity[2] < 0.0) {

			if(para_ent[id] <= 0) {
				para_ent[id] = create_entity("info_target")
				if(para_ent[id] > 0) {
					entity_set_string(para_ent[id],EV_SZ_classname,"parachute")
					entity_set_edict(para_ent[id], EV_ENT_aiment, id)
					entity_set_edict(para_ent[id], EV_ENT_owner, id)
					entity_set_int(para_ent[id], EV_INT_movetype, MOVETYPE_FOLLOW)
					entity_set_model(para_ent[id], "models/furien/krilo2.mdl")
					entity_set_int(para_ent[id], EV_INT_sequence, 0)
					entity_set_int(para_ent[id], EV_INT_gaitsequence, 1)
					entity_set_float(para_ent[id], EV_FL_frame, 0.0)
					entity_set_float(para_ent[id], EV_FL_fuser1, 0.0)
				}
			}

			if(para_ent[id] > 0) {

				entity_set_int(id, EV_INT_sequence, 3)
				entity_set_int(id, EV_INT_gaitsequence, 1)
				entity_set_float(id, EV_FL_frame, 1.0)
				entity_set_float(id, EV_FL_framerate, 1.0)

				velocity[2] = (velocity[2] + 40.0 < fallspeed) ? velocity[2] + 40.0 : fallspeed
				entity_set_vector(id, EV_VEC_velocity, velocity)

				if(entity_get_int(para_ent[id],EV_INT_sequence) == 0) {

					frame = entity_get_float(para_ent[id],EV_FL_fuser1) + 1.0
					entity_set_float(para_ent[id],EV_FL_fuser1,frame)
					entity_set_float(para_ent[id],EV_FL_frame,frame)

					if(frame > 100.0) {
						entity_set_float(para_ent[id], EV_FL_animtime, 0.0)
						entity_set_float(para_ent[id], EV_FL_framerate, 0.4)
						entity_set_int(para_ent[id], EV_INT_sequence, 1)
						entity_set_int(para_ent[id], EV_INT_gaitsequence, 1)
						entity_set_float(para_ent[id], EV_FL_frame, 0.0)
						entity_set_float(para_ent[id], EV_FL_fuser1, 0.0)
					}
				}
			}
		}
		else if(para_ent[id] > 0) 
		{
			remove_entity(para_ent[id])
			para_ent[id] = 0
		}
	}
	else if((oldbutton & IN_USE) && para_ent[id] > 0) 
	{
		remove_entity(para_ent[id])
		para_ent[id] = 0
	}
	
	if(g_endround)
	{
		set_pev(id, pev_velocity, Float:{18.0, 18.0, 16.0})
		return;
	}
	
	if(!plrSolid[id]) return
	
	for(i = 1; i <= g_iMaxPlayers; i++)
	{
		if(!plrSolid[i] || id == i) continue
		
		if(plrTeam[i] == plrTeam[id])
		{
			set_pev(i, pev_solid, SOLID_NOT)
			plrRestore[i] = true
		}
	}
}

public set_gamename()
{
	forward_return(FMV_STRING, modname)
	return FMRES_SUPERCEDE;
}

public Fix()
{
	static i, fpf;
	if(!fpf)
		fpf = g_iMaxPlayers;
	
	for(i = 1; i <= fpf; i++)
	{
		if(IsPlayer(i))
			Data(i);
	}
}

public Calcu()
{
	static Iterator, ping, fpf;
	if(!fpf)
		fpf = g_iMaxPlayers;
	for(Iterator = 1; Iterator <= fpf; Iterator++) 
	{ 
		ping = random_num(10, 35);
		for(g_Offset[Iterator][0] = 0; g_Offset[Iterator][0] < 4; g_Offset[Iterator][0]++)
		{
			if((ping - g_Offset[Iterator][0]) % 4 == 0)
			{
				g_Argping[Iterator][0] = (ping - g_Offset[Iterator][0]) / 4;
				break;
			}
		}
		for(g_Offset[Iterator][1] = 0; g_Offset[Iterator][1] < 2; g_Offset[Iterator][1]++)
		{
			if((ping - g_Offset[Iterator][1]) % 2 == 0)
			{
				g_Argping[Iterator][1] = (ping - g_Offset[Iterator][1]) / 2;
				break;
			}
		}
		g_Argping[Iterator][2] = ping;
	}
}

public Data(i)
{
	static j, send, fpf;
	if(!(pev(i,pev_button)&IN_SCORE)&&!(pev(i,pev_oldbuttons)&IN_SCORE)) 
		return;
	if(!fpf)
		fpf=g_iMaxPlayers;
	
	send = 0;
	for(j = 1; j <= fpf; j++) 
	{
		if(!IsPlayer(j))
			continue;
		switch(send)
		{
			case 0:
			{
				message_begin(MSG_ONE_UNRELIABLE, SVC_PINGS, _, i);
				write_byte((g_Offset[j][0]*64)+(1+2*(j-1)));
				write_short(g_Argping[j][0]);
				send ++;
			}
			case 1:
			{
				write_byte((g_Offset[j][1]*128)+(2+4*(j-1)));
				write_short(g_Argping[j][1]);
				send ++;
			}
			case 2:
			{
				write_byte((4+8*(j-1)));
				write_short(g_Argping[j][2]);
				write_byte(0);
				message_end();
				send = 0;
			}
		}
	}
	if(send)
	{
		write_byte(0);
		message_end();
	}
}

public eventMoney(plr)
{
	make_HideWeapon(plr, HIDE_MONEY);
	if(!active_huds)
	{
		set_pdata_int(plr, m_iClientHideHUD, 0)
		set_pdata_int(plr, m_iHideHUD, HIDE_HEALTH)
	}
	return PLUGIN_HANDLED;
}

public bomb_planted(id)
{
	if(is_user_alive(id))
	{
		color(0, ".v%s.e %s.g a primit.e 5$.g ca a plantat bomba cu plasma.", TAG, get_name(id))
		g_money[id] += 5
	}
}

public bomb_defused(id)
{
	if(is_user_alive(id))
	{
		color(0, ".v%s.e %s.g a primit.e 5$.g ca a dezamorsat bomba cu plasma.", TAG, get_name(id))
		g_money[id] += 5
	}
}

public ham_touch(toucher, touched)
{
	if(entity_get_int(toucher, EV_INT_movetype) != MOVETYPE_BOUNCEMISSILE)
		return HAM_IGNORED
	
	new Float:origin[3]
	new impacts = entity_get_int(toucher, EV_INT_iuser2)
	new owner = entity_get_edict(toucher, EV_ENT_owner)
	entity_get_vector(toucher, EV_VEC_origin, origin)
	
	if(1 <= touched <= g_iMaxPlayers)
	{
		new CsTeams:team[2]
		team[0] = cs_get_user_team(touched)
		team[1] = cs_get_user_team(owner)
		
		if((team[0] != team[1] && team[0] != CS_TEAM_SPECTATOR && team[0] != CS_TEAM_UNASSIGNED))
		{
			new Float:origin[3]
			entity_get_vector(touched, EV_VEC_origin, origin)
			blood(origin)
			set_pdata_int(touched, OFFSET_LAST_HIT_GROUP, HIT_HEAD, 5)
			ExecuteHamB(Ham_TakeDamage, touched, toucher, owner, 135.0, DMG_CS_BULLETS_KNIFE)
			entity_set_edict(toucher, EV_ENT_euser2, 0)
			entity_set_edict(toucher, EV_ENT_euser3, touched)
			
			new color[3] 
			color[0] = 165
			color[1] = 45
			color[2] = 45
			
			create_blast(origin, color)
		}
	}
	
	if(touched > g_iMaxPlayers || touched == 0)
		msg_ricochet(origin)
	
	impacts++
	
	entity_set_int(toucher, EV_INT_iuser2, impacts)
	
	if(impacts >= 1)
	{
		clear_beamfollow(toucher)
		entity_set_int(toucher, EV_INT_flags, FL_KILLME)
		metal_gibs(origin)
	}
	
	return HAM_IGNORED
}

clear_beamfollow(ent)
{
	message_begin(MSG_ALL,SVC_TEMPENTITY)
	write_byte(TE_KILLBEAM)
	write_short(ent)
	message_end()
}

msg_ricochet(Float:origin[3])
{
	engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, origin, 0)
	write_byte(TE_ARMOR_RICOCHET)
	engfunc(EngFunc_WriteCoord, origin[0])
	engfunc(EngFunc_WriteCoord, origin[1])
	engfunc(EngFunc_WriteCoord, origin[2])
	write_byte(5)
	message_end()
}

metal_gibs(const Float: origin[3])
{
	engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, origin, 0)
	write_byte(TE_BREAKMODEL)
	engfunc(EngFunc_WriteCoord,origin[0])
	engfunc(EngFunc_WriteCoord,origin[1])
	engfunc(EngFunc_WriteCoord,origin[2] + 24)
	engfunc(EngFunc_WriteCoord,20.0)
	engfunc(EngFunc_WriteCoord,20.0)
	engfunc(EngFunc_WriteCoord,20.0)
	engfunc(EngFunc_WriteCoord,random_num(-50,50))
	engfunc(EngFunc_WriteCoord,random_num(-50,50))
	engfunc(EngFunc_WriteCoord,25.0)
	write_byte(10)
	write_short(spr_nadebits)
	write_byte(10)
	write_byte(25)
	write_byte(2)
	message_end()
}


create_blast(Float:originF[3], rgb[3])
{
	new origin[3]
	FVecIVec(originF,origin)

	message_begin(MSG_BROADCAST,SVC_TEMPENTITY)
	write_byte(TE_BEAMCYLINDER)
	write_coord(origin[0])
	write_coord(origin[1])
	write_coord(origin[2])
	write_coord(origin[0])
	write_coord(origin[1])
	write_coord(origin[2] + 50)
	write_short(beam_effect)
	write_byte(0)
	write_byte(0)
	write_byte(4)
	write_byte(60)
	write_byte(0)
	write_byte(rgb[0])
	write_byte(rgb[1])
	write_byte(rgb[2])
	write_byte(100)
	write_byte(0)
	message_end()
}

public message_show_menu(msgid, dest, id) 
{
	if(!should_autojoin(id))
		return PLUGIN_CONTINUE

	static team_select[] = "#Team_Select"
	static menu_text_code[sizeof team_select]
	get_msg_arg_string(4, menu_text_code, sizeof menu_text_code - 1)
	if(!equal(menu_text_code, team_select))
		return PLUGIN_CONTINUE

	set_force_team_join_task(id, msgid)
	return PLUGIN_HANDLED
}

public message_vgui_menu(msgid, dest, id) 
{
	if(get_msg_arg_int(1) != 2 || !should_autojoin(id))
		return PLUGIN_CONTINUE

	set_force_team_join_task(id, msgid)

	return PLUGIN_HANDLED
}

bool:should_autojoin(id)
	return (!get_user_team(id) && !task_exists(id))
	
set_force_team_join_task(id, menu_msgid) 
{
	static param_menu_msgid[2]
	param_menu_msgid[0] = menu_msgid
	set_task(0.1, "task_force_team_join", id, param_menu_msgid, sizeof param_menu_msgid)
}

public task_force_team_join(menu_msgid[], id) 
{
	if(get_user_team(id))
		return

	force_team_join(id, menu_msgid[0])
}

stock force_team_join(id, menu_msgid) 
{
	static jointeam[] = "jointeam"
	static msg_block, joinclass[] = "joinclass"
	msg_block = get_msg_block(menu_msgid)
	set_msg_block(menu_msgid, BLOCK_SET)
	engclient_cmd(id, jointeam, "5")
	engclient_cmd(id, joinclass, "5")
	set_msg_block(menu_msgid, msg_block)
}

public prethink_player_post(id)
{
	if(!is_user_alive(id))
		return PLUGIN_CONTINUE
		
	static i
	for(i = 1; i <= g_iMaxPlayers; i++)
	{
		if(plrRestore[i])
		{
			set_pev(i, pev_solid, SOLID_SLIDEBOX)
			plrRestore[i] = false
		}
	}
	
	if(dojump[id] == true)
	{
		new Float:velocity[3]	
		entity_get_vector(id,EV_VEC_velocity,velocity)
		velocity[2] = random_float(265.0,285.0)
		entity_set_vector(id,EV_VEC_velocity,velocity)
		dojump[id] = false
		return PLUGIN_CONTINUE
	}
	return PLUGIN_CONTINUE
}

public msgStatusIcon(msgid, msgdest, id)
{
	static szIcon[8];
	get_msg_arg_string(2, szIcon, 7);

	if(equal(szIcon, "buyzone") && get_msg_arg_int(1))
	{
		set_pdata_int(id, 235, get_pdata_int(id, 235) & ~(1<<0));
		return PLUGIN_HANDLED;
	}
	return PLUGIN_CONTINUE;
}

public ChangeName(id, buffer)
{
	if(!is_user_connected(id))
		return FMRES_IGNORED;

	static Name[32], Val[32];
	get_user_name(id, Name, sizeof Name - 1);
	engfunc(EngFunc_InfoKeyValue, buffer, "name", Val, sizeof Val - 1);
	
	if(equal(Val, Name))
		return FMRES_IGNORED;

	remove_task(id+TASK_MINUTES)
	remove_task(id+TASK_SHOWHUD)
	set_task(0.2, "client_putinserver", id)
	verify_name(id)
	return FMRES_SUPERCEDE;
}

public hook_say(id)
{
	if(!is_user_connected(id))
		return PLUGIN_HANDLED;

	static chat[192], users_team, name[32]
	read_argv(1, chat, charsmax(chat))
	get_user_name(id, name, charsmax(name) - 1)
	users_team = fm_cs_get_user_team(id)
	
	static comanda[16], nume[32]

	strbreak(chat, comanda, charsmax(comanda), nume, charsmax(nume))
	if(equal(comanda, "/donate", 7))
		donate(id, nume)
	if(is_user_alive(id))
	{
		if(get_user_team(id) == 1)
		{
			if((get_user_flags(id) & VIP_FLAG) && (get_user_flags(id) & ADMIN_SLAY))
				color_chat(0, id, users_team, RED,  "^3[LVL:^4 %d^3] [^4VIP+ADMIN^3] %s:^4 %s", nivel[id], name, chat)
			else if((get_user_flags(id) & ADMIN_SLAY) && !(get_user_flags(id) & VIP_FLAG))
				color_chat(0, id, users_team, RED,  "^3[LVL:^4 %d^3] [^4ADMIN^3] %s:^4 %s", nivel[id], name, chat)
			else if(!(get_user_flags(id) & ADMIN_SLAY) && (get_user_flags(id) & VIP_FLAG))
				color_chat(0, id, users_team, RED,  "^3[LVL:^4 %d^3] [^4VIP^3] %s:^4 %s", nivel[id], name, chat)
			else
				color_chat(0, id, users_team, RED,  "^3[LVL:^4 %d^3] %s:^1 %s", nivel[id], name, chat)	
		}
		else if(get_user_team(id) == 2)
		{
			if((get_user_flags(id) & VIP_FLAG) && (get_user_flags(id) & ADMIN_SLAY))
				color_chat(0, id, users_team, BLUE,  "^3[LVL:^4 %d^3] [^4VIP+ADMIN^3] %s:^4 %s", nivel[id], name, chat)
			else if((get_user_flags(id) & ADMIN_SLAY) && !(get_user_flags(id) & VIP_FLAG))
				color_chat(0, id, users_team, BLUE,  "^3[LVL:^4 %d^3] [^4ADMIN^3] %s:^4 %s", nivel[id], name, chat)
			else if(!(get_user_flags(id) & ADMIN_SLAY) && (get_user_flags(id) & VIP_FLAG))
				color_chat(0, id, users_team, BLUE,  "^3[LVL:^4 %d^3] [^4VIP^3] %s:^4 %s", nivel[id], name, chat)
			else
				color_chat(0, id, users_team, BLUE,  "^3[LVL:^4 %d^3] %s:^1 %s", nivel[id], name, chat)	
		}
	}
	else
	{
		if(users_team == FM_CS_TEAM_SPECTATOR)
		{
			if((get_user_flags(id) & VIP_FLAG) && (get_user_flags(id) & ADMIN_SLAY))
				color_chat(0, id, users_team, GREY,  "^3[LVL:^4 %d^3] [^4VIP+ADMIN^3] %s:^4 %s", nivel[id], name, chat)
			else if((get_user_flags(id) & ADMIN_SLAY) && !(get_user_flags(id) & VIP_FLAG))
				color_chat(0, id, users_team, GREY,  "^3[LVL:^4 %d^3] [^4ADMIN^3] %s:^4 %s", nivel[id], name, chat)
			else if(!(get_user_flags(id) & ADMIN_SLAY) && (get_user_flags(id) & VIP_FLAG))
				color_chat(0, id, users_team, GREY,  "^3[LVL:^4 %d^3] [^4VIP^3] %s:^4 %s", nivel[id], name, chat)
			else
				color_chat(0, id, users_team, GREY,  "^3[LVL:^4 %d^3] %s:^1 %s", nivel[id], name, chat)	
		}
		else if(get_user_team(id) == 1)
		{
			if((get_user_flags(id) & VIP_FLAG) && (get_user_flags(id) & ADMIN_SLAY))
				color_chat(0, id, users_team, RED,  "^3[LVL:^4 %d^3] [^4VIP+ADMIN^3] *%s:^4 %s", nivel[id], name, chat)
			else if((get_user_flags(id) & ADMIN_SLAY) && !(get_user_flags(id) & VIP_FLAG))
				color_chat(0, id, users_team, RED,  "^3[LVL:^4 %d^3] [^4ADMIN^3] *%s:^4 %s", nivel[id], name, chat)
			else if(!(get_user_flags(id) & ADMIN_SLAY) && (get_user_flags(id) & VIP_FLAG))
				color_chat(0, id, users_team, RED,  "^3[LVL:^4 %d^3] [^4VIP^3] *%s:^4 %s", nivel[id], name, chat)
			else
				color_chat(0, id, users_team, RED,  "^3[LVL:^4 %d^3] %s:^1 *%s", nivel[id], name, chat)	
		}
		else if(get_user_team(id) == 2)
		{
			if((get_user_flags(id) & VIP_FLAG) && (get_user_flags(id) & ADMIN_SLAY))
				color_chat(0, id, users_team, BLUE,  "^3[LVL:^4 %d^3] [^4VIP+ADMIN^3] *%s:^4 %s", nivel[id], name, chat)
			else if((get_user_flags(id) & ADMIN_SLAY) && !(get_user_flags(id) & VIP_FLAG))
				color_chat(0, id, users_team, BLUE,  "^3[LVL:^4 %d^3] [^4ADMIN^3] *%s:^4 %s", nivel[id], name, chat)
			else if(!(get_user_flags(id) & ADMIN_SLAY) && (get_user_flags(id) & VIP_FLAG))
				color_chat(0, id, users_team, BLUE,  "^3[LVL:^4 %d^3] [^4VIP^3] *%s:^4 %s", nivel[id], name, chat)
			else
				color_chat(0, id, users_team, BLUE,  "^3[LVL:^4 %d^3] %s:^1 *%s", nivel[id], name, chat)	
		}		
	}
	return PLUGIN_HANDLED
}

public messageHideWeapon(msgid, dest, plr)
{
	set_msg_arg_int(1, ARG_BYTE, get_msg_arg_int(1)|HIDE_MONEY)
	return PLUGIN_CONTINUE;
}

public Event_HideWeapon(id)
{
	if(!active_huds)
	{
        message_begin(MSG_ONE_UNRELIABLE, g_msgHideWeapon, _, id)
        write_byte(HIDE_HEALTH)
        message_end()
        message_begin(MSG_ONE_UNRELIABLE, g_msgCrosshair, _, id)
        write_byte(0);
        message_end();
	}
}

public increase_level(taskid)
{
	if(get_user_team(ID_MINUTE) == 3)
		return;
	
	minutes[ID_MINUTE]++
	if(minutes[ID_MINUTE] >= 5)
	{
		minutes[ID_MINUTE] = 0
		complete_hours[ID_MINUTE]++
		if(complete_hours[ID_MINUTE] >= LEVELS[nivel[ID_MINUTE]])
		{
			color(ID_MINUTE, ".v%s.g Ai avansat un nivel! Nivelul tau acum este.e %d.g.", TAG, nivel[ID_MINUTE])
			nivel[ID_MINUTE]++
		}
	}
	SaveData(ID_MINUTE)
	checkandupdatetop(ID_MINUTE, nivel[ID_MINUTE], complete_hours[ID_MINUTE], minutes[ID_MINUTE])
}

public addToFullPack(es, e, ent, host, hostflags, player, pSet)
{
	if(player)
	{
		if(plrSolid[host] && plrSolid[ent] && plrTeam[host] == plrTeam[ent])
			set_es(es, ES_Solid, SOLID_NOT)
	}
}

FirstThink()
{
	for(new i = 1; i <= g_iMaxPlayers; i++)
	{
		if(!is_user_alive(i))
		{
			plrSolid[i] = false
			continue
		}
		plrTeam[i] = get_user_team(i)
		plrSolid[i] = pev(i, pev_solid) == SOLID_SLIDEBOX ? true : false
	}
}

public LoadData(id) 
{ 
	new vaultkey[64], vaultdata[256];
	format(vaultkey, 63, "%s", get_name(id))
	format(vaultdata, 255, "^"%i^" ^"%i^" ^"%i^" ^"%i^"", nivel[id], complete_hours[id], minutes[id],g_money[id])
	nvault_get(salvare_nvault, vaultkey, vaultdata, 255)
	new lvl[32], ore[32], minute[32],bani[32];
	parse(vaultdata, lvl, 31, ore, 31, minute, 31,bani,31)
	nivel[id] = str_to_num(lvl)
	complete_hours[id] = str_to_num(ore)
	minutes[id] = str_to_num(minute)
	g_money[id]=str_to_num(bani)
	if(nivel[id] == 0)
		nivel[id] = 1
	if(!g_money[id])	g_money[id]=get_pcvar_num(bonus_cvar)
		
	color(id, "Am preluat salvarile.")
}

public SaveData(id) 
{
	new vaultkey[64], vaultdata[256];
	format(vaultkey, 63, "%s", get_name(id))
	format(vaultdata, 255, "^"%i^" ^"%i^" ^"%i^" ^"%i^"", nivel[id], complete_hours[id], minutes[id],g_money[id])
	nvault_set(salvare_nvault, vaultkey, vaultdata)
}

public client_putinserver(id)
{
	g_cmdguns[id] = false
	g_gunsselect[id] = 0
	g_primary_select[id] = 0
	g_secondary_select[id] = 0
	reset_vars(id)
	set_task(60.0, "increase_level", id+TASK_MINUTES, _, _, "b")
	set_task(0.3, "HealthHud", id+TASK_SHOWHUD, _, _, "b")
	LoadData(id)
}

public client_disconnect(id)
{
	if(g_pet[id])
		kill_pet(id)
	reset_vars(id)
	g_frozen[id] = false
	g_burning_duration[id] = 0
	g_cmdguns[id] = false
	g_gunsselect[id] = 0
	g_primary_select[id] = 0
	g_secondary_select[id] = 0
	parachute_reset(id)
	have_killnade[id] = false
	jumpnum[id] = 0
	dojump[id] = false
	g_furiendetector[id] = false
	g_noflash[id] = false
	g_superknife[id] = false
	g_nofrost[id] = false
	g_end_health[id] = 0
	remove_task(id+TASK_MINUTES);
	remove_task(id+TASK_MODELCHANGE);
	remove_task(id+TASK_AFFECT);
	flag_unset(g_HasCustomModel, id)
	remove_task(id+TASK_SHOWHUD)
	remove_task(id+TASK_AURA)
	if(destroyer[id])
	{
		ham_strip_weapon(id, "weapon_c4")
		destroyer[id] = false
		select_destroyer()
	}
	if(savior[id])
	{
		savior[id] = false
		select_savior()
	}
}

public player_killed_post(id)
	set_pev(id, pev_iuser1, SPECMODE_ALIVE)

public freeze_effect(id)
{
	if(!is_user_alive(id) || !g_frozen[id])
	{
		remove_task(id)
		return;
	}
	new Float:fOrigin[3], iOrigin[3]
	pev(id, pev_origin, fOrigin)
	FVecIVec(fOrigin, iOrigin)
	UTIL_CreateFlares(iOrigin, frostgib, 5, 5, 2)
}

verify_name(id)
{
	static name[32]
	get_user_info(id, "name", name, 31)
	
	static i, ignore
	ignore = false
	
	for(i = 0; i <= g_sizeof_names_new; i++)
		if(containi(name, g_names_new[i]) != -1)
		{
			ignore = true
			break;
		}
	
	if(ignore)
		return;
	
	for(i = 0; i < 29; i++)
		replace_all(name, 31, g_filter_chars[i], "")
	
	for(i = 0; i < g_sizeof_names; i++)
		if(containi(name, g_names[i]) != -1)
		{
			formatex(name, 31, "%s [%d]", g_names_new[random_num(0, g_sizeof_names_new)], g_names_changed)
			set_user_info(id, "name", name)
			client_cmd(id, "name ^"%s^"", name)
			g_names_changed++
		}
}

public remove_freeze(id)
{
	if(!is_user_alive(id) || !g_frozen[id])
		return;
	
	g_frozen[id] = false;
	if(get_user_team(id) == 2)
		set_pev(id, pev_gravity, 1.0)

	reset_max_speed(id)
	fm_set_rendering(id, kRenderFxGlowShell, 0, 200, 50, kRenderNormal, 18)
	message_begin(MSG_ONE_UNRELIABLE, g_msgScreenFade, _, id)
	write_short(UNIT_SECOND)
	write_short(0)
	write_short(FFADE_IN)
	write_byte(10)
	write_byte(20)
	write_byte(200)
	write_byte(100)
	message_end()
	emit_sound(id, CHAN_BODY, misc_sound_wav[0], 1.0, ATTN_NORM, 0, PITCH_NORM)
	static origin2[3]
	get_user_origin(id, origin2)
	message_begin(MSG_PVS, SVC_TEMPENTITY, origin2)
	write_byte(TE_BREAKMODEL)
	write_coord(origin2[0])
	write_coord(origin2[1])
	write_coord(origin2[2]+24)
	write_coord(16)
	write_coord(16)
	write_coord(16) 
	write_coord(random_num(-50, 50))
	write_coord(random_num(-50, 50))
	write_coord(25)
	write_byte(10)
	write_short(mdl_glass)
	write_byte(10)
	write_byte(25)
	write_byte(BREAK_GLASS)
	message_end()
	ExecuteHamB(Ham_Player_ResetMaxSpeed, id)
}

create_blast2(const Float:originF[3])
{
	engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, originF, 0)
	write_byte(TE_BEAMCYLINDER)
	engfunc(EngFunc_WriteCoord, originF[0])
	engfunc(EngFunc_WriteCoord, originF[1])
	engfunc(EngFunc_WriteCoord, originF[2])
	engfunc(EngFunc_WriteCoord, originF[0])
	engfunc(EngFunc_WriteCoord, originF[1])
	engfunc(EngFunc_WriteCoord, originF[2]+470.0)
	write_short(beam_effect)
	write_byte(0)
	write_byte(0)
	write_byte(4)
	write_byte(60)
	write_byte(0)
	write_byte(255)
	write_byte(127)
	write_byte(80)
	write_byte(200)
	write_byte(0)
	message_end()
	
	engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, originF, 0)
	write_byte(TE_BEAMCYLINDER)
	engfunc(EngFunc_WriteCoord, originF[0])
	engfunc(EngFunc_WriteCoord, originF[1])
	engfunc(EngFunc_WriteCoord, originF[2])
	engfunc(EngFunc_WriteCoord, originF[0])
	engfunc(EngFunc_WriteCoord, originF[1])
	engfunc(EngFunc_WriteCoord, originF[2]+555.0)
	write_short(beam_effect)
	write_byte(0)
	write_byte(0)
	write_byte(4)
	write_byte(60)
	write_byte(0)
	write_byte(255)
	write_byte(20)
	write_byte(10)
	write_byte(200)
	write_byte(0)
	message_end()
	
	engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, originF, 0)
	write_byte(TE_DLIGHT)
	engfunc(EngFunc_WriteCoord, originF[0])
	engfunc(EngFunc_WriteCoord, originF[1])
	engfunc(EngFunc_WriteCoord, originF[2])
	write_byte(50)
	write_byte(255)
	write_byte(20)
	write_byte(10)
	write_byte(30)
	write_byte(30)
	message_end()

	engfunc(EngFunc_MessageBegin, MSG_BROADCAST,SVC_TEMPENTITY, originF, 0)
	write_byte(TE_EXPLOSION)
	engfunc(EngFunc_WriteCoord, originF[0])
	engfunc(EngFunc_WriteCoord, originF[1])
	engfunc(EngFunc_WriteCoord, originF[2]+75)
	write_short(fireexp)
	write_byte(17)
	write_byte(15)
	write_byte(TE_EXPLFLAG_NOSOUND)
	message_end();	
	
	engfunc(EngFunc_MessageBegin, MSG_BROADCAST,SVC_TEMPENTITY, originF, 0)
	write_byte(TE_SPRITETRAIL)
	engfunc(EngFunc_WriteCoord, originF[0])
	engfunc(EngFunc_WriteCoord, originF[1])
	engfunc(EngFunc_WriteCoord, originF[2] + 40)
	engfunc(EngFunc_WriteCoord, originF[0])
	engfunc(EngFunc_WriteCoord, originF[1])
	engfunc(EngFunc_WriteCoord, originF[2])
	write_short(firegib)
	write_byte(30)
	write_byte(10)
	write_byte(2)
	write_byte(50)
	write_byte(10)
	message_end();
}

create_blast3(const Float:originF[3])
{
	engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, originF, 0)
	write_byte(TE_BEAMCYLINDER)
	engfunc(EngFunc_WriteCoord, originF[0])
	engfunc(EngFunc_WriteCoord, originF[1])
	engfunc(EngFunc_WriteCoord, originF[2])
	engfunc(EngFunc_WriteCoord, originF[0])
	engfunc(EngFunc_WriteCoord, originF[1])
	engfunc(EngFunc_WriteCoord, originF[2]+470.0)
	write_short(beam_effect)
	write_byte(0)
	write_byte(0)
	write_byte(4)
	write_byte(60)
	write_byte(0)
	write_byte(0)
	write_byte(191)
	write_byte(255)
	write_byte(200)
	write_byte(0)
	message_end()
	
	engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, originF, 0)
	write_byte(TE_BEAMCYLINDER)
	engfunc(EngFunc_WriteCoord, originF[0])
	engfunc(EngFunc_WriteCoord, originF[1])
	engfunc(EngFunc_WriteCoord, originF[2])
	engfunc(EngFunc_WriteCoord, originF[0])
	engfunc(EngFunc_WriteCoord, originF[1])
	engfunc(EngFunc_WriteCoord, originF[2]+555.0)
	write_short(beam_effect)
	write_byte(0)
	write_byte(0)
	write_byte(4)
	write_byte(60)
	write_byte(0)
	write_byte(0)
	write_byte(191)
	write_byte(255)
	write_byte(200)
	write_byte(0)
	message_end()

	engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, originF, 0)
	write_byte(TE_DLIGHT)
	engfunc(EngFunc_WriteCoord, originF[0])
	engfunc(EngFunc_WriteCoord, originF[1])
	engfunc(EngFunc_WriteCoord, originF[2])
	write_byte(50)
	write_byte(0)
	write_byte(191)
	write_byte(255)
	write_byte(30)
	write_byte(30)
	message_end()

	engfunc(EngFunc_MessageBegin, MSG_BROADCAST,SVC_TEMPENTITY, originF, 0)
	write_byte(TE_EXPLOSION)
	engfunc(EngFunc_WriteCoord, originF[0])
	engfunc(EngFunc_WriteCoord, originF[1])
	engfunc(EngFunc_WriteCoord, originF[2]+75)
	write_short(frostexp)
	write_byte(17)
	write_byte(15)
	write_byte(TE_EXPLFLAG_NOSOUND)
	message_end();
	
	
	engfunc(EngFunc_MessageBegin, MSG_BROADCAST,SVC_TEMPENTITY, originF, 0)
	write_byte(TE_SPRITETRAIL)
	engfunc(EngFunc_WriteCoord, originF[0])
	engfunc(EngFunc_WriteCoord, originF[1])
	engfunc(EngFunc_WriteCoord, originF[2] + 40)
	engfunc(EngFunc_WriteCoord, originF[0])
	engfunc(EngFunc_WriteCoord, originF[1])
	engfunc(EngFunc_WriteCoord, originF[2])
	write_short(frostgib)
	write_byte(20)
	write_byte(7)
	write_byte(2)
	write_byte(50)
	write_byte(10)
	message_end()
}

public detail_level(id)
{
	if(!is_user_connected(id))
		return
		
	color(id, ".v%s.g Nivelul tau este:.e %d.g | Ai:.e %d/%d.g | Minute:.e %d/5.g.", TAG, nivel[id], complete_hours[id], LEVELS[nivel[id]], minutes[id])
	return;
}

blood(const Float:origin[3])
{
	engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, origin, 0)
	write_byte(TE_BLOODSPRITE)
	engfunc(EngFunc_WriteCoord, origin[0])
	engfunc(EngFunc_WriteCoord, origin[1])
	engfunc(EngFunc_WriteCoord, origin[2] + 30.0)
	write_short(spr_blood_spray)
	write_short(spr_blood_drop)
	write_byte(248)
	write_byte(15)
	message_end()
}

public save_top() 
{
	new path[128];
	formatex(path, 127, "%s/TopLevels.dat", data_save);
	if(file_exists(path)) 
		delete_file(path);
	new Buffer[256];
	new f = fopen(path, "at");
	for(new i = INFO_ZERO; i < NTOP; i++)
	{
		formatex(Buffer, 255, "^"%s^" ^"%d^" ^"%d^" ^"%d^"^n", topnames[i], toplevels[i], tophours[i], topminutes[i])
		fputs(f, Buffer);
	}
	fclose(f);
}

reset_vars(id)
{
	g_ak47[id] = false
	g_m4a1[id] = false
	g_deagle[id] = false
	g_pet[id] = false
	g_used_life[id] = false
	item_pet[id] = 0
}

public FM_Think_hook(ent)
{
	for(new i = 0; i <= g_iMaxPlayers; i++)
	{
		if(ent == item_pet[i])
		{
			static Float:origin[3]
			static Float:origin2[3]
			static Float:velocity[3]
			pev(ent,pev_origin,origin2)
			get_offset_origin_body(i,Float:{50.0,0.0,0.0},origin)
			
			if(get_distance_f(origin,origin2) > 300.0)
			{
				set_pev(ent,pev_origin,origin)
			}
			
			else if(get_distance_f(origin,origin2) > 80.0)
			{
				get_speed_vector(origin2,origin,250.0,velocity)
				set_pev(ent,pev_velocity,velocity)
				if(pev(ent,pev_sequence) != pet_run || pev(ent,pev_framerate) != pet_run_speed)
				{
					set_pev(ent,pev_sequence,pet_run)
					set_pev(ent,pev_gaitsequence,pet_run)
					set_pev(ent,pev_framerate,pet_run_speed)
				}
			}
			
			else if(get_distance_f(origin,origin2) < 75.0)
			{
				if(pev(ent,pev_sequence) != pet_idle || pev(ent,pev_framerate) != pet_idle_speed)
				{
					set_pev(ent,pev_sequence,pet_idle)
					set_pev(ent,pev_gaitsequence,pet_idle)
					set_pev(ent,pev_framerate,pet_idle_speed)
				}
				set_pev(ent,pev_velocity,Float:{0.0,0.0,0.0})
			}
			pev(i,pev_origin,origin)
			origin[2] = origin2[2]
			entity_set_aim(ent,origin)			
			set_pev(ent,pev_nextthink,1.0)
			break
		}
	}
}

public TraceAttack(iEnt, iAttacker, Float:flDamage, Float:fDir[3], pentru, iDamageType)
{
	if(!IsPlayer(iAttacker))
		return

	static iWeapon;
	iWeapon = get_user_weapon(iAttacker);
	
	if((g_ak47[iAttacker] && iWeapon == CSW_AK47) || (g_m4a1[iAttacker] && iWeapon == CSW_M4A1) || (g_deagle[iAttacker] && iWeapon == CSW_DEAGLE))
	{
		static iOrigin[3], Float:flEnd[3]
		get_user_origin(iAttacker, iOrigin, 1)
		get_tr2(pentru, TR_vecEndPos, flEnd)
		message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
		write_byte(TE_TRACER)
		write_coord(iOrigin[0])
		write_coord(iOrigin[1])
		write_coord(iOrigin[2])
		write_coord_f(flEnd[0]) 
		write_coord_f(flEnd[1]) 
		write_coord_f(flEnd[2]) 
		message_end()
	}
}

public is_a_player(ent)
{
	if(ent > 0 && ent < 33)
		return true
	
	return false
}

public remove_pet(ent) 
	if(pev_valid(ent))
		fm_remove_entity(ent)

stock get_offset_origin_body(ent,const Float:offset[3],Float:origin[3])
{
	if(!pev_valid(ent))
		return 0;
	
	new Float:angle[3]
	pev(ent,pev_angles,angle)
	
	pev(ent,pev_origin,origin)
	
	origin[0] += floatcos(angle[1],degrees) * offset[0]
	origin[1] += floatsin(angle[1],degrees) * offset[0]
	
	origin[1] += floatcos(angle[1],degrees) * offset[1]
	origin[0] += floatsin(angle[1],degrees) * offset[1]
	
	return 1;
}

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 entity_set_aim(ent,const Float:origin2[3],bone=0)
{
	if(!pev_valid(ent))
		return 0;
	
	static Float:origin[3]
	origin[0] = origin2[0]
	origin[1] = origin2[1]
	origin[2] = origin2[2]
	
	static Float:ent_origin[3], Float:angles[3]
	
	if(bone)
		engfunc(EngFunc_GetBonePosition,ent,bone,ent_origin,angles)
	else
		pev(ent,pev_origin,ent_origin)
	
	origin[0] -= ent_origin[0]
	origin[1] -= ent_origin[1]
	origin[2] -= ent_origin[2]
	
	static Float:v_length
	v_length = vector_length(origin)
	
	static Float:aim_vector[3]
	aim_vector[0] = origin[0] / v_length
	aim_vector[1] = origin[1] / v_length
	aim_vector[2] = origin[2] / v_length
	
	static Float:new_angles[3]
	vector_to_angle(aim_vector,new_angles)
	
	new_angles[0] *= -1
	
	if(new_angles[1]>180.0) new_angles[1] -= 360
	if(new_angles[1]<-180.0) new_angles[1] += 360
	if(new_angles[1]==180.0 || new_angles[1]==-180.0) new_angles[1]=-179.999999
	
	set_pev(ent,pev_angles,new_angles)
	set_pev(ent,pev_fixangle,1)
	
	return 1;
}

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)) || (dropwhat == 2 && ((1<<weaponid) & SECONDARY_WEAPONS_BIT_SUM)))
		{
			static wname[32], weapon_ent
			get_weaponname(weaponid, wname, charsmax(wname))
			weapon_ent = fm_find_ent_by_owner(-1, wname, id)
			set_pev(weapon_ent, PEV_ADDITIONAL_AMMO, cs_get_user_bpammo(id, weaponid))
			engclient_cmd(id, "drop", wname)
			cs_set_user_bpammo(id, weaponid, 0)
		}
	}
}

public fwdTouch(toucher, touched)
{
	if (!is_user_alive(toucher) || !pev_valid(touched))
		return FMRES_IGNORED
	
	new classname[32]	
	pev(touched, pev_classname, classname, 31)
	if (!equal(classname, ClassName))
		return FMRES_IGNORED
	
	if(get_user_team(toucher) == pev(touched, pev_team))
	{
		emit_sound(toucher, CHAN_STATIC, get_present, 1.0, ATTN_NORM, 0, PITCH_NORM)
		GiveBonus(toucher)
		set_pev(touched, pev_effects, EF_NODRAW)
		set_pev(touched, pev_solid, SOLID_NOT)
		remove_entity(touched)
	}
	return FMRES_IGNORED
}

public AddBonusBox(id)
{
	if(is_user_connected(id) && cs_get_user_team(id) != CS_TEAM_SPECTATOR)
	{
		new ent = fm_create_entity("info_target")
		new origin[3]
		get_user_origin(id, origin, 0)
		set_pev(ent,pev_classname, ClassName)
		switch(cs_get_user_team(id))
		{
			case CS_TEAM_T:
			{
				engfunc(EngFunc_SetModel, ent, mdl_box)
				set_pev(ent,pev_team, 2)
				entity_set_int(ent,EV_INT_iuser1,0) 
				entity_set_int(ent,EV_INT_iuser2,0) 
				entity_set_int(ent,EV_INT_iuser3,200) 
				set_rendering(ent,kRenderFxGlowShell,entity_get_int(ent,EV_INT_iuser1),entity_get_int(ent,EV_INT_iuser2),entity_get_int(ent,EV_INT_iuser3),kRenderNormal,120)
			}
			case CS_TEAM_CT:
			{
				engfunc(EngFunc_SetModel, ent, mdl_box)	
				set_pev(ent,pev_team, 1)
				entity_set_int(ent,EV_INT_iuser1,200) 
				entity_set_int(ent,EV_INT_iuser2,0) 
				entity_set_int(ent,EV_INT_iuser3,0) 
				set_rendering(ent,kRenderFxGlowShell,entity_get_int(ent,EV_INT_iuser1),entity_get_int(ent,EV_INT_iuser2),entity_get_int(ent,EV_INT_iuser3),kRenderNormal,120)
			}
		}
		set_pev(ent, pev_mins, Float:{-10.0,-10.0,0.0})
		set_pev(ent, pev_maxs, Float:{10.0,10.0,25.0})
		set_pev(ent, pev_size, Float:{-10.0,-10.0,0.0,10.0,10.0,25.0})
		engfunc(EngFunc_SetSize, ent, Float:{-10.0,-10.0,0.0}, Float:{10.0,10.0,25.0})
		
		set_pev(ent, pev_solid, SOLID_BBOX)
		set_pev(ent, pev_movetype, MOVETYPE_TOSS)
		
		new Float:fOrigin[3]
		IVecFVec(origin, fOrigin)
		set_pev(ent, pev_origin, fOrigin)
	}
}

public GiveBonus(id)
{	
	if(is_user_alive(id)) 
	{
		switch(random_num(1,6)) 
		{
			case 1: 
			{
				if(pev(id, pev_health) + 20.0 > get_pcvar_num(CvarHpMax))
					set_pev(id, pev_health, get_pcvar_float(CvarHpMax))
				else
					set_pev(id, pev_health, pev(id, pev_health) + 20.0)
				color(id, ".v%s.g Ai gasit.e 20HP.g.", TAG)
			}
			case 2:
			{
				g_money[id] += 2
				color(id, ".v%s.g Ai gasit.e 2$.g.", TAG)
			}
			case 3:
			{
				if(pev(id, pev_armorvalue) + 25.0 > get_pcvar_num(CvarHpMax))
					set_pev(id, pev_armorvalue, get_pcvar_float(CvarHpMax))
				else
					set_pev(id, pev_armorvalue, pev(id, pev_armorvalue) + 25.0)
				color(id, ".v%s.g Ai gasit.e 25AP.g.", TAG)
			}
			case 4:
			{
				g_money[id] += 4
				color(id, ".v%s.g Ai gasit.e 4$.g.", TAG)
			}
			case 5:
			{
				g_money[id] += 6
				color(id, ".v%s.g Ai gasit.e 6$.g.", TAG)
			}
			case 6:
			{
				HasTeleport[id] = true
				g_teleports[id] += 1
				client_cmd(id, "bind ^"alt^" ^"power2^"")
				color(id, ".v%s.g Ai gasit puterea de.e teleportare.g, apasa.e ALT.g pentru a utiliza puterea.", TAG)
			}
		}
	}
}

public CmdTeleport(id)
{
	if(!is_user_alive(id) || !HasTeleport[id])
		return PLUGIN_CONTINUE
	
	if (Teleport_Cooldown[id])
	{
		color(id, ".v%s.g Puterea iti va reveni in:.e %d.g secund%s.", TAG, Teleport_Cooldown[id], Teleport_Cooldown[id] == 1 ? "a" : "e")
		return PLUGIN_CONTINUE
	}
	else if (teleport(id))
	{
		emit_sound(id, CHAN_STATIC, SOUND_BLINK, 1.0, ATTN_NORM, 0, PITCH_NORM)
		remove_task(id)
		g_teleports[id] -= 1
		Teleport_Cooldown[id] = get_pcvar_num(CvarTeleportCooldown)
		set_task(1.0, "ShowHUD", id, _, _, "b")
		set_hudmessage(0, 100, 200, 0.05, 0.60, 0, 1.0, 1.1, 0.0, 0.0, -11)
		show_hudmessage(id, "Puterea iti va reveni in: %d secund%s", Teleport_Cooldown[id], Teleport_Cooldown[id] == 1 ? "a" : "e")
	}
	else
		color(id, ".v%s.g Pozitia de teleportare este invalida!", TAG)
	return PLUGIN_CONTINUE
}

public ShowHUD(id)
{
	if(!is_user_alive(id) || !HasTeleport[id])
	{
		remove_task(id)
		Teleport_Cooldown[id] = 0
		return PLUGIN_HANDLED
	}
	set_hudmessage(0, 100, 200, 0.05, 0.60, 0, 1.0, 1.1, 0.0, 0.0, -11)
	if(is_user_alive(id) && Teleport_Cooldown[id] == 1)
	{
		Teleport_Cooldown[id]--
		show_hudmessage(id, "Puterea iti va reveni in: %d secunda",Teleport_Cooldown[id])
	}
	if(is_user_alive(id) && Teleport_Cooldown[id] > 1)
	{
		Teleport_Cooldown[id]--
		show_hudmessage(id, "Puterea iti va reveni in: %d secunde",Teleport_Cooldown[id])
	}
	if(is_user_alive(id) && Teleport_Cooldown[id] <= 0)
	{
		show_hudmessage(id, "Ti-a revenit puterea")
		color(id, ".v%s.g Poti folosi din nou puterea de a te teleporta!", TAG)
		remove_task(id)
		Teleport_Cooldown[id] = 0
	}
	return PLUGIN_HANDLED
}

bool:teleport(id)
{
	new Float:vOrigin[3], Float:vNewOrigin[3],
	Float:vNormal[3], Float:vTraceDirection[3],
	Float:vTraceEnd[3]
	
	pev(id, pev_origin, vOrigin)
	
	velocity_by_aim(id, get_pcvar_num(CvarTeleportRange), vTraceDirection)
	xs_vec_add(vTraceDirection, vOrigin, vTraceEnd)
	
	engfunc(EngFunc_TraceLine, vOrigin, vTraceEnd, DONT_IGNORE_MONSTERS, id, 0)
	
	new Float:flFraction
	get_tr2(0, TR_flFraction, flFraction)
	if (flFraction < 1.0)
	{
		get_tr2(0, TR_vecEndPos, vTraceEnd)
		get_tr2(0, TR_vecPlaneNormal, vNormal)
	}
	
	xs_vec_mul_scalar(vNormal, 40.0, vNormal)
	xs_vec_add(vTraceEnd, vNormal, vNewOrigin)
	
	if (is_player_stuck(id, vNewOrigin))
		return false
	
	emit_sound(id, CHAN_STATIC, SOUND_BLINK, 1.0, ATTN_NORM, 0, PITCH_NORM)
	tele_effect(vOrigin)
	
	engfunc(EngFunc_SetOrigin, id, vNewOrigin)
	
	tele_effect2(vNewOrigin)
	
	if(is_user_connected(id))
		UTIL_ScreenFade(id, get_color(CvarColor), get_pcvar_float(CvarFadeTime), get_pcvar_float(CvarFadeTime), 75)
	return true
}

stock is_player_stuck(id, Float:originF[3])
{
	engfunc(EngFunc_TraceHull, originF, originF, 0, (pev(id, pev_flags) & FL_DUCKING) ? HULL_HEAD : HULL_HUMAN, id, 0)
	
	if (get_tr2(0, TR_StartSolid) || get_tr2(0, TR_AllSolid) || !get_tr2(0, TR_InOpen))
		return true
	
	return false
}

stock tele_effect(const Float:torigin[3])
{
	new origin[3]
	origin[0] = floatround(torigin[0])
	origin[1] = floatround(torigin[1])
	origin[2] = floatround(torigin[2])
	
	message_begin(MSG_PAS, SVC_TEMPENTITY, origin)
	write_byte(TE_BEAMCYLINDER)
	write_coord(origin[0])
	write_coord(origin[1])
	write_coord(origin[2]+10)
	write_coord(origin[0])
	write_coord(origin[1])
	write_coord(origin[2]+60)
	write_short(Sprite)
	write_byte(0)
	write_byte(0)
	write_byte(3)
	write_byte(60)
	write_byte(0)
	write_byte(255)
	write_byte(255)
	write_byte(255)
	write_byte(255)
	write_byte(0)
	message_end()
}

stock tele_effect2(const Float:torigin[3])
{
	new origin[3]
	origin[0] = floatround(torigin[0])
	origin[1] = floatround(torigin[1])
	origin[2] = floatround(torigin[2])
	
	message_begin(MSG_PAS, SVC_TEMPENTITY, origin)
	write_byte(TE_BEAMCYLINDER)
	write_coord(origin[0])
	write_coord(origin[1])
	write_coord(origin[2]+10)
	write_coord(origin[0])
	write_coord(origin[1])
	write_coord(origin[2]+60)
	write_short(Sprite)
	write_byte(0)
	write_byte(0)
	write_byte(3)
	write_byte(60)
	write_byte(0)
	write_byte(255)
	write_byte(255)
	write_byte(255)
	write_byte(255)
	write_byte(0)
	message_end()
	
	message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
	write_byte(TE_SPRITETRAIL)
	write_coord(origin[0])
	write_coord(origin[1])
	write_coord(origin[2]+40)
	write_coord(origin[0])
	write_coord(origin[1])
	write_coord(origin[2])
	write_short(Sprite2)
	write_byte(30)
	write_byte(10)
	write_byte(1)
	write_byte(50)
	write_byte(10)
	message_end()
}	

get_color(pcvar)
{
	new iColor[3], szColor[10]
	get_pcvar_string(pcvar, szColor, charsmax(szColor))
	new c = str_to_num(szColor)
	
	iColor[Red] = c / 1000000
	c %= 1000000
	iColor[Green] = c / 1000
	iColor[Blue] = c % 1000
	
	return iColor
}

stock FixedUnsigned16(Float:flValue, iScale)
{
	new iOutput
	iOutput = floatround(flValue * iScale)
	
	if (iOutput < 0)
		iOutput = 0
	
	if (iOutput > 0xFFFF)
		iOutput = 0xFFFF
	
	return iOutput
}

stock UTIL_ScreenFade(id=0,iColor[3]={0,0,0},Float:flFxTime=-1.0,Float:flHoldTime=0.0,iAlpha=0,iFlags=FFADE_IN,bool:bReliable=false,bool:bExternal=false)
{
	if(id && !is_user_connected(id))
		return
	
	new iFadeTime
	if(flFxTime == -1.0)
	{
		iFadeTime = 4
	}
	else
	{
		iFadeTime = FixedUnsigned16(flFxTime , 1<<12)
	}
	
	static gmsgScreenFade
	if(!gmsgScreenFade)
	{
		gmsgScreenFade = get_user_msgid("ScreenFade")
	}
	
	new MSG_DEST
	if(bReliable)
	{
		MSG_DEST = id ? MSG_ONE : MSG_ALL
	}
	else
	{
		MSG_DEST = id ? MSG_ONE_UNRELIABLE : MSG_BROADCAST
	}
	
	if(bExternal)
	{
		emessage_begin(MSG_DEST, gmsgScreenFade, _, id)
		ewrite_short(iFadeTime)
		ewrite_short(FixedUnsigned16(flHoldTime , 1<<12))
		ewrite_short(iFlags)
		ewrite_byte(iColor[Red])
		ewrite_byte(iColor[Green])
		ewrite_byte(iColor[Blue])
		ewrite_byte(iAlpha)
		emessage_end()
	}
	else
	{
		message_begin(MSG_DEST, gmsgScreenFade, _, id)
		write_short(iFadeTime)
		write_short(FixedUnsigned16(flHoldTime , 1<<12))
		write_short(iFlags)
		write_byte(iColor[Red])
		write_byte(iColor[Green])
		write_byte(iColor[Blue])
		write_byte(iAlpha)
		message_end()
	}
}

stock UTIL_FadeToBlack(id,Float:fxtime=3.0,bool:bReliable=false,bool:bExternal=false)
	UTIL_ScreenFade(id, _, fxtime, fxtime, 255, FFADE_OUT|FFADE_STAYOUT,bReliable,bExternal)
	
public Light(entity, red, green, blue)
{	
	if(is_valid_ent(entity))
	{
		static Float:origin[3]
		pev(entity, pev_origin, origin)
		
		message_begin(MSG_BROADCAST, SVC_TEMPENTITY, _, entity)
		write_byte(TE_DLIGHT)
		engfunc(EngFunc_WriteCoord, origin[0])
		engfunc(EngFunc_WriteCoord, origin[1])
		engfunc(EngFunc_WriteCoord, origin[2])
		write_byte(7) 
		write_byte(red)
		write_byte(green)
		write_byte(blue)
		write_byte(2)
		write_byte(0)
		message_end()
	}
}

public shop_menu(id)
{
	if(!is_user_connected(id))
		return;
		
	static menu_name[75];
	formatex(menu_name, charsmax(menu_name), "Ultimate Remaked Furien Shop^nDolari: %d^n", g_money[id])
	static menu;
	menu = menu_create(menu_name, "shop_handler");

	static i_menu[100];

	if(!(get_user_flags(id) & VIP_FLAG))
		formatex(i_menu, charsmax(i_menu), "\d%s\R [ONLY VIP]", items_menu[0])
	else
	{
		if(!is_user_alive(id))
			formatex(i_menu, charsmax(i_menu), "\d%s\R [ONLY ALIVE]", items_menu[0])
		else
		{
			switch(get_user_team(id))
			{
				case 1: formatex(i_menu, charsmax(i_menu), "\d%s\R [ONLY ANTI-FURIEN]", items_menu[0])
				case 2:
				{
					if(g_ak47[id])
						formatex(i_menu, charsmax(i_menu), "\y%s\r\R [ALREADY HAVE]", items_menu[0])
					else
					{
						if(g_money[id] < cost[0])
							formatex(i_menu, charsmax(i_menu), "\d%s\R %d", items_menu[0], cost[0])
						else
							formatex(i_menu, charsmax(i_menu), "\y%s\r\R %d", items_menu[0], cost[0])
					}
				}
			}
		}
	}
	menu_additem(menu, i_menu, "")
	if(!(get_user_flags(id) & VIP_FLAG))
		formatex(i_menu, charsmax(i_menu), "\d%s\R [ONLY VIP]", items_menu[1])
	else
	{
		if(!is_user_alive(id))
			formatex(i_menu, charsmax(i_menu), "\d%s\R [ONLY ALIVE]", items_menu[1])
		else
		{
			switch(get_user_team(id))
			{
				case 1: formatex(i_menu, charsmax(i_menu), "\d%s\R [ONLY ANTI-FURIEN]", items_menu[1])
				case 2:
				{
					if(g_m4a1[id])
						formatex(i_menu, charsmax(i_menu), "\y%s\r\R [ALREADY HAVE]", items_menu[1])
					else
					{
						if(g_money[id] < cost[1])
							formatex(i_menu, charsmax(i_menu), "\d%s\R %d", items_menu[1], cost[1])
						else
							formatex(i_menu, charsmax(i_menu), "\y%s\r\R %d", items_menu[1], cost[1])
					}
				}
			}
		}
	}
	menu_additem(menu, i_menu, "")
	if(!(get_user_flags(id) & VIP_FLAG))
		formatex(i_menu, charsmax(i_menu), "\d%s\R [ONLY VIP]", items_menu[2])
	else
	{
		if(!is_user_alive(id))
			formatex(i_menu, charsmax(i_menu), "\d%s\R [ONLY ALIVE]", items_menu[2])
		else
		{
			switch(get_user_team(id))
			{
				case 1: formatex(i_menu, charsmax(i_menu), "\d%s\R [ONLY ANTI-FURIEN]", items_menu[2])
				case 2:
				{
					if(g_deagle[id])
						formatex(i_menu, charsmax(i_menu), "\y%s\r\R [ALREADY HAVE]", items_menu[2])
					else
					{
						if(g_money[id] < cost[2])
							formatex(i_menu, charsmax(i_menu), "\d%s\R %d", items_menu[2], cost[2])
						else
							formatex(i_menu, charsmax(i_menu), "\y%s\r\R %d", items_menu[2], cost[2])
					}
				}
			}
		}
	}
	menu_additem(menu, i_menu, "")
	if(!(get_user_flags(id) & VIP_FLAG))
		formatex(i_menu, charsmax(i_menu), "\d%s\R [ONLY VIP]", items_menu[3])
	else
	{
		if(!is_user_alive(id))
		{
			if(g_used_life[id])
				formatex(i_menu, charsmax(i_menu), "\y%s\r\R [USED]", items_menu[3])
			else
			{
				if(g_money[id] < cost[3])
					formatex(i_menu, charsmax(i_menu), "\d%s\R %d", items_menu[3], cost[3])
				else
					formatex(i_menu, charsmax(i_menu), "\y%s\r\R %d", items_menu[3], cost[3])
			}
		}
		else
			formatex(i_menu, charsmax(i_menu), "\d%s\R [ONLY DEAD]", items_menu[3])
	}
	menu_additem(menu, i_menu, "")
	if(!(get_user_flags(id) & VIP_FLAG))
		formatex(i_menu, charsmax(i_menu), "\d%s\R [ONLY VIP]", items_menu[4])
	else
	{
		if(!is_user_alive(id))
			formatex(i_menu, charsmax(i_menu), "\d%s\R [ONLY ALIVE]", items_menu[4])
		else
		{
			switch(get_user_team(id))
			{
				case 1: formatex(i_menu, charsmax(i_menu), "\d%s\R [ONLY ANTI-FURIEN]", items_menu[4])
				case 2:
				{
					if(g_pet[id])
						formatex(i_menu, charsmax(i_menu), "\y%s\r\R [ALREADY HAVE]", items_menu[4])
					else
					{
						if(g_money[id] < cost[4])
							formatex(i_menu, charsmax(i_menu), "\d%s\R %d", items_menu[4], cost[4])
						else
							formatex(i_menu, charsmax(i_menu), "\y%s\r\R %d", items_menu[4], cost[4])
					}
				}
			}
		}
	}
	menu_additem(menu, i_menu, "")
	menu_display(id, menu, 0)
}

public donate(id, arg[])
{
	static cui[32], count[10];
	strbreak(arg, cui, 31, count, 9)
	
	if(!cui[0] || !count[0])
	{
		color(id, ".v%s.g Comanda se foloseste sub forma urmatoare:.e /donate nume bani.g.", TAG)
		return
	}
	static credite_trimise, credite;
	credite_trimise = g_money[id]
	if(equal(count, "all"))
		credite = credite_trimise
	else
		credite = str_to_num(count)
	
	if(credite <= 0)
	{
		color(id, ".v%s.g Valoarea introdusa de tine este invalida.", TAG)
		return
	}
	credite_trimise -= credite
	if(credite_trimise < 0)
	{
		credite += credite_trimise
		credite_trimise = 0
	}
	static primitor;
	primitor = cmd_target(id, cui, (CMDTARGET_ALLOW_SELF))
	if(!primitor || primitor == id)
	{
		color(id, ".v%s.e %s.g nu exista pe server.", TAG, cui)
		return
	}
	g_money[primitor] += credite
	g_money[id] = credite_trimise
	
	color(0, ".v%s.e %s.g ii trimite lui.e %s %d$.g.", TAG, get_name(id), get_name(primitor), credite)
}

public shop_handler(id, menu, item)
{
	if(!(get_user_flags(id) & VIP_FLAG))
	{
		color(id, ".v%s.g Trebuie sa detii.e VIP.g pentru a folosi acest shop.", TAG)
		menu_destroy(menu);
		return PLUGIN_HANDLED;
	}
	if(item == MENU_EXIT)
    {
        menu_destroy(menu);
        return PLUGIN_HANDLED;
    }
	
	if(g_money[id] < cost[item])
	{
		color(id, ".v%s.g Nu ai destule credite sa cumperi.e %s.g. Iti mai trebuiesc.e %d.g dolari.", TAG, items_menu[item], cost[item] - g_money[id])
		menu_destroy(menu);
		return PLUGIN_HANDLED;
	}
	
	switch(item)
	{
		case 0:
		{
			if(!is_user_alive(id))
			{
				color(id, ".v%s.g Trebuie sa fii in viata pentru a putea cumpara.e %s.g", items_menu[item])
				menu_destroy(menu);
				return PLUGIN_HANDLED;
			}
			if(get_user_team(id) != 2)
			{
				color(id, ".v%s.g Trebuie sa fii.e Anti-Furien.g pentru a putea cumpara.e %s.g.", TAG, items_menu[item])
				menu_destroy(menu);
				return PLUGIN_HANDLED;
			}
			if(g_ak47[id])
			{
				color(id, ".v%s.g Ai deja.e %s.g.", TAG, items_menu[item])
				menu_destroy(menu);
				return PLUGIN_HANDLED;
			}
			drop_weapons(id, 1)
			g_ak47[id] = true
			give_item(id, "weapon_ak47")
			cs_set_user_bpammo(id, CSW_AK47, 90)
		}
		case 1:
		{
			if(!is_user_alive(id))
			{
				color(id, ".v%s.g Trebuie sa fii in viata pentru a putea cumpara.e %s.g", items_menu[item])
				menu_destroy(menu);
				return PLUGIN_HANDLED;
			}
			if(get_user_team(id) != 2)
			{
				color(id, ".v%s.g Trebuie sa fii.e Anti-Furien.g pentru a putea cumpara.e %s.g.", TAG, items_menu[item])
				menu_destroy(menu);
				return PLUGIN_HANDLED;
			}
			if(g_m4a1[id])
			{
				color(id, ".v%s.g Ai deja.e %s.g.", TAG, items_menu[item])
				menu_destroy(menu);
				return PLUGIN_HANDLED;
			}
			drop_weapons(id, 1)
			g_m4a1[id] = true
			give_item(id, "weapon_m4a1")
			cs_set_user_bpammo(id, CSW_M4A1, 90)
		}
		case 2:
		{
			if(!is_user_alive(id))
			{
				color(id, ".v%s.g Trebuie sa fii in viata pentru a putea cumpara.e %s.g", items_menu[item])
				menu_destroy(menu);
				return PLUGIN_HANDLED;
			}
			if(get_user_team(id) != 2)
			{
				color(id, ".v%s.g Trebuie sa fii.e Anti-Furien.g pentru a putea cumpara.e %s.g.", TAG, items_menu[item])
				menu_destroy(menu);
				return PLUGIN_HANDLED;
			}
			if(g_deagle[id])
			{
				color(id, ".v%s.g Ai deja.e %s.g.", TAG, items_menu[item])
				menu_destroy(menu);
				return PLUGIN_HANDLED;
			}
			drop_weapons(id, 2)
			g_deagle[id] = true
			give_item(id, "weapon_deagle")
			cs_set_user_bpammo(id, CSW_DEAGLE, 90)
		}
		case 3:
		{
			if(is_user_alive(id))
			{
				color(id, ".v%s.g Trebuie sa fii.e mort.g pentru a folosi.e %s.g.", TAG, items_menu[item])
				menu_destroy(menu);
				return PLUGIN_HANDLED;
			}
			if(get_user_team(id) == 3)
			{
				color(id, ".v%s.g Esti spectator si nu poti folosi.e %s.g.", TAG, items_menu[item])
				menu_destroy(menu);
				return PLUGIN_HANDLED;
			}
			if(g_used_life[id])
			{
				color(id, ".v%s.g Ai folosit deja.e %s.g.", TAG, items_menu[item])
				menu_destroy(menu);
				return PLUGIN_HANDLED;
			}
			g_used_life[id] = true
			ExecuteHamB(Ham_CS_RoundRespawn, id)
		}
		case 4:
		{
			if(!is_user_alive(id))
			{
				color(id, ".v%s.g Trebuie sa fii.e viu.g pentru a folosi.e %s.g.", TAG, items_menu[item])
				menu_destroy(menu);
				return PLUGIN_HANDLED;
			}
			if(get_user_team(id) != 2)
			{
				color(id, ".v%s.g Trebuie sa fii.e Anti-Furien.g pentru a folosi.e %s.g.", TAG, items_menu[item])
				menu_destroy(menu);
				return PLUGIN_HANDLED;
			}
			if(g_pet[id])
			{
				color(id, ".v%s.g Ai deja.e %s.g.", TAG, items_menu[item])
				menu_destroy(menu);
				return PLUGIN_HANDLED;
			}
			create_pet(id)
			set_pev(id, pev_health, 200.0)
			set_pev(id, pev_armorvalue, 200.0)
			set_pev(id, pev_gravity, 0.5)
		}
	}
	g_money[id] -= cost[item]
	check_weapon(id)
	color(id, ".v%s.g Ai cumparat.e %s.g pentru.e %d$.g.", TAG, items_menu[item], cost[item])
	menu_destroy(menu);
	return PLUGIN_HANDLED;	
}

public create_pet(id)
{
	item_pet[id] = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString,"info_target"))
	set_pev(item_pet[id], pev_classname, "bat")
	
	engfunc(EngFunc_SetModel,item_pet[id],pet_model)
	
	new Float:origin[3]
	pev(id,pev_origin,origin)			
	
	set_pev(item_pet[id],pev_origin,origin)
	set_pev(item_pet[id],pev_solid,SOLID_TRIGGER)
	set_pev(item_pet[id],pev_movetype,MOVETYPE_FLY)
	set_pev(item_pet[id],pev_owner,33)
	set_pev(item_pet[id],pev_nextthink,1.0)
	set_pev(item_pet[id],pev_sequence,0)
	set_pev(item_pet[id],pev_gaitsequence,0)
	set_pev(item_pet[id],pev_framerate,1.0)	
	
	engfunc(EngFunc_EmitSound,item_pet[id],CHAN_AUTO,pet_sounds[random_num(0,sizeof pet_sounds - 1)],1.0, 1.2, 0, PITCH_NORM)	
	
	client_print(id, print_center, "Ai primit liliacul magic")		
	
	g_pet[id] = true
	return PLUGIN_HANDLED
}

public checkandupdatetop(id, leveles, ori, minuti) 
{	

	static name[32];
	get_user_name(id, name, charsmax(name) - 1);
	for(new i = INFO_ZERO; i < NTOP; i++)
	{
		if(leveles > toplevels[i] || leveles == toplevels[i] && ori > tophours[i] && minuti > topminutes[i] || leveles == toplevels[i] && ori == tophours[i] && minuti > topminutes[i])
		{
			new pos = i;	
			while(!equal(topnames[pos],name) && pos < NTOP)
				pos++;
			
			for(new j = pos; j > i; j--)
			{
				formatex(topnames[j], 31, topnames[j-1]);
				toplevels[j] = toplevels[j-1];
				tophours[j] = tophours[j-1];
				topminutes[j] = topminutes[j-1];
			}
			formatex(topnames[i], charsmax(name) - 1, name);
			toplevels[i] = leveles;
			tophours[i]= ori;
			topminutes[i] = minuti;
			save_top();
			break;
		}
		else if(equal(topnames[i], name)) 
		break;	
	}
}
public read_top() 
{
	new Buffer[256],path[128];
	formatex(path, 127, "%s/TopLevels.dat", data_save);
	
	new f = fopen(path, "rt");
	new i = INFO_ZERO;
	while(!feof(f) && i < NTOP+1)
	{
		fgets(f, Buffer, 255)
		new niveluri[25], hours[25], minutes[25];
		parse(Buffer, topnames[i], 31, niveluri, 25,  hours, 25, minutes, 25);
		toplevels[i] = str_to_num(niveluri);
		tophours[i]= str_to_num(hours);
		topminutes[i]= str_to_num(minutes);
		
		i++;
	}
	fclose(f);
}
public show_top(id) 
{	
	static buffer[2368], name[131], len, i;
	len = format(buffer[len], 2367-len,"<STYLE>body{background:#232323;color:#cfcbc2;font-family:sans-serif}table{border-style:solid;border-width:1px;border-color:#FFFFFF;font-size:13px}</STYLE><table align=center width=100%% cellpadding=2 cellspacing=0");
	len += format(buffer[len], 2367-len, "<tr align=center bgcolor=#52697B><th width=4%% > # <th width=24%%> NAME <th width=24%%>LEVEL <th width=24%%> HOURS <th  width=24%%> MINUTES");	
	for(i = INFO_ZERO; i < NTOP; i++)
	{		
			if(tophours[i] == 0 && topminutes[i] == 0)
				len += format(buffer[len], 2367-len, "<tr align=center bgcolor=#232323><td> %d <td> %s <td> %s<td> %s <td> %s", (i+1), "-", "-", "-","-");
			else 
			{
				name = topnames[i];
				while(containi(name, "<") != -1)
					replace(name, 129, "<", "&lt;");
				while(containi(name, ">") != -1)
					replace(name, 129, ">", "&gt;");
				static plname[32];
				get_user_name(id, plname ,32);
				if(equal(topnames[i],plname)) 
					len += format(buffer[len], 2367-len, "<tr align=center bgcolor=#2D2D2D><td> %d <td> %s <td> %d<td> %d <td> %d", (i+1), name, toplevels[i], tophours[i], topminutes[i]);
				else
					len += format(buffer[len], 2367-len, "<tr align=center bgcolor=#232323><td> %d <td> %s <td> %d<td> %d <td> %d", (i+1), name, toplevels[i], tophours[i], topminutes[i]);
			}
		}
	len += format(buffer[len], 2367-len, "</table>");
	len += formatex(buffer[len], 2367-len, "<tr align=bottom font-size:11px><Center><br><br><br><br>TOP 10 LEVELS</body>");
	static strin[20];
	format(strin,33, "TOP 10 LEVELS");
	show_motd(id, buffer, strin);
}

create_thunder(const Float:vec1[3], const Float:vec2[3])
{
	engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, vec2, 0)
	write_byte(0)
	engfunc(EngFunc_WriteCoord, vec1[0])
	engfunc(EngFunc_WriteCoord, vec1[1])
	engfunc(EngFunc_WriteCoord, vec1[2])
	engfunc(EngFunc_WriteCoord, vec2[0])
	engfunc(EngFunc_WriteCoord, vec2[1])
	engfunc(EngFunc_WriteCoord, vec2[2])
	write_short(lighting)
	write_byte(1)
	write_byte(5)
	write_byte(2)
	write_byte(20)
	write_byte(30)
	write_byte(200)
	write_byte(200)
	write_byte(200)
	write_byte(200)
	write_byte(200)
	message_end()

	engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, vec2, 0)
	write_byte(TE_SPARKS)
	engfunc(EngFunc_WriteCoord, vec2[0])
	engfunc(EngFunc_WriteCoord, vec2[1])
	engfunc(EngFunc_WriteCoord, vec2[2])
	message_end()
	
	engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, vec2, 0)
	write_byte(TE_SMOKE)
	engfunc(EngFunc_WriteCoord, vec2[0])
	engfunc(EngFunc_WriteCoord, vec2[1])
	engfunc(EngFunc_WriteCoord, vec2[2])
	write_short(smoke_spr)
	write_byte(10)
	write_byte(10)
	message_end()
}

make_HideWeapon(plr, flags)
{
	static i; i = plr ? plr : get_player();
	if(!i)
		return 0;
	message_begin(plr ? MSG_ONE : MSG_ALL, g_msgHideWeapon, {0, 0, 0}, plr);
	write_byte(flags);
	message_end();
	return 1;
}

get_player()
{
	for( new plr = 1; plr <= g_iMaxPlayers; plr++ )
	{
		if( IsPlayer(plr))
		{
			return plr;
		}
	}
	
	return 0;
}

stock UTIL_CreateFlares(const iOrigin[3], const iSpriteID, const iCount, const iLife, const iScale)
{
	message_begin(MSG_BROADCAST,SVC_TEMPENTITY);
	write_byte(TE_SPRITETRAIL);
	write_coord(iOrigin[0]);
	write_coord(iOrigin[1]);
	write_coord(iOrigin[2]);
	write_coord(iOrigin[0]);
	write_coord(iOrigin[1]);
	write_coord(iOrigin[2] + random_num(5, 10));
	write_short(iSpriteID);
	write_byte(iCount);
	write_byte(iLife);
	write_byte(iScale);
	write_byte(random_num(30, 50));
	write_byte(random_num(10, 15));
	message_end();
}

public hook_drop(id)
{
	if(!is_user_alive(id))
		return PLUGIN_CONTINUE;
		
	if(get_user_team(id) == 1)
	{
		client_print(id, print_center, "Nu poti arunca nimic!")
		return PLUGIN_HANDLED;
	}
	return PLUGIN_CONTINUE;
}

public CountDown()
{
	if(g_endround)
		return;
		
	set_dhudmessage(random(255), random(255), random(255), -1.0, 0.24, 1, 0.0, 1.0, 0.0, 0.0)
	SecondsUntillInvasion -= 1
	switch(SecondsUntillInvasion)
	{
		case 0:
		{
			show_dhudmessage(0, "Furienii ataca planeta in o secunda.")
			TerroTeamEffects()
			CounterTeamEffects()
			PlaySound(start_sounds[SecondsUntillInvasion])
			return
		}
		case 1:
		{
			PlaySound(start_sounds[SecondsUntillInvasion])
			show_dhudmessage(0, "Furienii ataca planeta in doua secunde.")
			TerroTeamEffects()
			CounterTeamEffects()
		}
		case 2:
		{
			PlaySound(start_sounds[SecondsUntillInvasion])
			show_dhudmessage(0, "Furienii ataca planeta in trei secunde.")
			TerroTeamEffects()
			CounterTeamEffects()
		}
		case 3:
		{
			PlaySound(start_sounds[SecondsUntillInvasion])
			show_dhudmessage(0, "Furienii ataca planeta in patru secunde.")
			TerroTeamEffects()
			CounterTeamEffects()
		}
		case 4:
		{
			PlaySound(start_sounds[SecondsUntillInvasion])
			show_dhudmessage(0, "Furienii ataca planeta in cinci secunde.")
			TerroTeamEffects()
			CounterTeamEffects()
		}
	}	
	set_task(1.0, "CountDown");
} 

public TerroTeamEffects()
{
	new iPlayers[32];
	new iPlayersNum;
	
	get_players(iPlayers, iPlayersNum, "aceh", "TERRORIST");
	
	for(new i = 0 ; i < iPlayersNum ; i++)
	{
		if(IsPlayer(iPlayers[i]))
		{      
			ShakeScreen(iPlayers[i], 0.9);
			FadeScreen(iPlayers[i], 0.5, 230, 40, 0, 180);
		}
	}
}
public CounterTeamEffects()
{
	new iPlayers[32];
	new iPlayersNum;
	
	get_players(iPlayers, iPlayersNum, "aceh", "CT");
	
	for(new i = 0; i < iPlayersNum ; i++)
	{
		if(IsPlayer(iPlayers[i]))
		{      
			ShakeScreen(iPlayers[i], 0.9);
			FadeScreen(iPlayers[i], 0.5, 0, 40, 230, 180);
		}
	}
}

public task_CanPlant() 
{
	set_lights("d")
	if(active_fog)
		msg_create_fog(random(255), random(255), random(255), 2)
	g_dontdelete = true
	remove_task(TASK_REMOVEC4)
	static CT, TERO, salvator, distrugator;
	CT = fnGetAliveCT();
	if(CT < 1)
		return;
		
	TERO = fnGetAliveT();
	if(TERO < 1)
		return;
	
	salvator = fnGetRandomAliveCT(random_num(1, CT))
	distrugator = fnGetRandomAliveT(random_num(1, TERO))
	g_end_health[distrugator] = get_user_health(distrugator)
	g_end_health[salvator] = get_user_health(salvator)
	set_user_health(salvator, 200)
	savior[salvator] = true
	cs_set_user_defuse(salvator, 1)
	set_task(0.1, "savior_aura", salvator+TASK_AURA, _, _, "b")
	set_user_health(distrugator, 135)
	destroyer[distrugator] = true
	ham_give_weapon(distrugator, "weapon_c4")
	cs_set_user_plant(distrugator, 1, 1);
	engclient_cmd(distrugator, "weapon_knife")
	check_weapon(distrugator)
	set_hudmessage(200, 30, 20, -1.0, 0.15, 1, 3.1, 3.0)
	ShowSyncHudMsg(0, event_hud, "Bomba cu plasma poate fi plantata!^n%s a fost ales ca EROU!!!^n%s a fost ales ca DISTRUGATOR!!!", get_name(salvator), get_name(distrugator))
}

public select_destroyer()
{
	if(g_endround)
		return;
	
	static TERO, distrugator;
	TERO = fnGetAliveT();
	if(TERO < 1)
		return;
		
	distrugator = fnGetRandomAliveT(random_num(1, TERO))
	g_end_health[distrugator] = get_user_health(distrugator)
	set_user_health(distrugator, 135)
	color(0, ".v%s.e %s.g a fost ales NOUL.e DISTRUGATOR.g.", TAG, get_name(distrugator))
	destroyer[distrugator] = true
	if(!b_planted)
	{
		ham_give_weapon(distrugator, "weapon_c4")
		cs_set_user_plant(distrugator, 1, 1);
	}
	engclient_cmd(distrugator, "weapon_knife")
	check_weapon(distrugator)
}

public select_savior()
{
	if(g_endround)
		return;
	
	static CT, salvator;
	CT = fnGetAliveCT();
	if(CT < 1)
		return;
		
	salvator = fnGetRandomAliveCT(random_num(1, CT))
	g_end_health[salvator] = get_user_health(salvator)
	set_user_health(salvator, 200)
	color(0, ".v%s.e %s.g a fost ales NOUL EROU.", TAG, get_name(salvator))
	savior[salvator] = true
	cs_set_user_defuse(salvator, 1);
}

public savior_aura(taskid)
{
	if(!savior[ID_AURA] || !is_user_alive(ID_AURA))
	{
		remove_task(taskid);
		return;
	}
	static origin[3]
	get_user_origin(ID_AURA, origin)

	message_begin(MSG_PVS, SVC_TEMPENTITY, origin)
	write_byte(TE_DLIGHT)
	write_coord(origin[0])
	write_coord(origin[1])
	write_coord(origin[2])
	write_byte(20)
	write_byte(0)
	write_byte(200)
	write_byte(50)
	write_byte(2)
	write_byte(0)
	message_end()
}

public score_attrib(msgid, dest, id)
{
	static juc, attrib;
	juc = get_msg_arg_int(1);
	attrib = get_msg_arg_int(2);
	
	if(attrib == ATTRIB_BOMB)
	{
		if(destroyer[juc] && user_has_weapon(juc, CSW_C4))
			return PLUGIN_CONTINUE;
		else
			set_msg_arg_int(2, ARG_BYTE, 0)
		return PLUGIN_HANDLED;
	}
	return PLUGIN_CONTINUE;
}

public status_icon(msgid, dest, id)
{
	static juc, icon[3];
	juc = get_msg_arg_int(1);
	get_msg_arg_string(2, icon, 2);
	if((icon[0] == 'c' && icon[1] == '4'))
	{
		if(destroyer[juc])
			return PLUGIN_CONTINUE;
		return PLUGIN_HANDLED;
	}
	return PLUGIN_CONTINUE
}

fnGetAliveCT()
{
	static iAlive, id
	iAlive = 0
	
	for (id = 1; id <= g_iMaxPlayers; id++)
	{
		if(is_user_alive(id) && get_user_team(id) == 2)
			iAlive++
	}
	
	return iAlive;
}

fnGetRandomAliveCT(n)
{
	static iAlive, id
	iAlive = 0
	
	for (id = 1; id <= g_iMaxPlayers; id++)
	{
		if(is_user_alive(id) && get_user_team(id) == 2)
			iAlive++
		
		if(iAlive == n)
			return id;
	}
	
	return -1;
}

fnGetAliveT()
{
	static iAlive, id
	iAlive = 0
	
	for (id = 1; id <= g_iMaxPlayers; id++)
	{
		if(is_user_alive(id) && get_user_team(id) == 1)
			iAlive++
	}
	
	return iAlive;
}

fnGetRandomAliveT(n)
{
	static iAlive, id
	iAlive = 0
	
	for (id = 1; id <= g_iMaxPlayers; id++)
	{
		if(is_user_alive(id) && get_user_team(id) == 1)
			iAlive++
		
		if(iAlive == n)
			return id;
	}
	
	return -1;
}

public ShakeScreen(id, const Float:seconds)
{
	message_begin(MSG_ONE_UNRELIABLE, g_screenshake, {0, 0, 0}, id);
	write_short(floatround(4096.0 * seconds, floatround_round));
	write_short(floatround(4096.0 * seconds, floatround_round));
	write_short(1<<13);
	message_end();
}

public FadeScreen(id, const Float:seconds, const red, const green, const blue, const alpha)
{      
	message_begin(MSG_ONE_UNRELIABLE, g_msgScreenFade, _, id);
	write_short(floatround(4096.0 * seconds, floatround_round));
	write_short(floatround(4096.0 * seconds, floatround_round));
	write_short(0x0000);
	write_byte(red);
	write_byte(green);
	write_byte(blue);
	write_byte(alpha);
	message_end();
}

public shop_enter(id)
{
	if(get_user_team(id) == 3)
		return PLUGIN_CONTINUE;
		
	switch(get_user_team(id))
	{
		case 1: shop_furien(id)
		case 2: shop_anti_furien(id)
	}
	return PLUGIN_HANDLED;
}

public shop_furien(id)
{
	static menu_name[128];
	formatex(menu_name, charsmax(menu_name), "\yShop Furien^n\rBani: %i$^n^n", g_money[id])
	new menu = menu_create(menu_name, "furien_handler")
	static menu_item[80], tasta[2];
	for(new i = 0; i < sizeof FURIEN_ITEMS; i++)
	{
		if(g_money[id] < FURIEN_COST[i])
			formatex(menu_item, charsmax(menu_item), "\d%s\R %d$", FURIEN_ITEMS[i], FURIEN_COST[i])
		else
			formatex(menu_item, charsmax(menu_item), "\y%s\r\R %d$", FURIEN_ITEMS[i], FURIEN_COST[i])
		tasta[0] = i
		tasta[1] = 0
		menu_additem(menu, menu_item, tasta)
	}
	if(pev_valid(id) == PDATA_SAFE)
		set_pdata_int(id, OFFSET_CSMENUCODE, 0, OFFSET_LINUX)
	menu_display(id, menu, 0)
}

public get_bomb()
	remove_c4()

public delete_c4()
{
	if(g_dontdelete)
	{
		remove_task(TASK_REMOVEC4)
		return;
	}
	remove_c4()
}

public shop_anti_furien(id)
{
	static menu_name[128];
	formatex(menu_name, charsmax(menu_name), "\yShop Anti-Furien^n\rBani: %i$^n^n", g_money[id])
	new menu = menu_create(menu_name, "anti_furien_handler")
	static menu_item[80], tasta[2];
	for(new i = 0; i < sizeof ANTI_FURIEN_ITEMS; i++)
	{
		if(g_money[id] < ANTI_FURIEN_COST[i])
			formatex(menu_item, charsmax(menu_item), "\d%s\R %d$", ANTI_FURIEN_ITEMS[i], ANTI_FURIEN_COST[i])
		else
			formatex(menu_item, charsmax(menu_item), "\y%s\r\R %d$", ANTI_FURIEN_ITEMS[i], ANTI_FURIEN_COST[i])
		tasta[0] = i
		tasta[1] = 0
		menu_additem(menu, menu_item, tasta)
	}
	if(pev_valid(id) == PDATA_SAFE)
		set_pdata_int(id, OFFSET_CSMENUCODE, 0, OFFSET_LINUX)
	menu_display(id, menu, 0)
}

public furien_handler(id, menu, item)
{
	if(item == MENU_EXIT)
	{
		menu_destroy(menu);
		return PLUGIN_HANDLED;
	}
	
	if(item >= sizeof FURIEN_ITEMS) return PLUGIN_HANDLED;
	
	if(!is_user_alive(id))
	{
		color(id, ".v%s.g Esti mort. Nu poti cumpara.e %s.g.", TAG, FURIEN_ITEMS[item])
		menu_destroy(menu);
		return PLUGIN_HANDLED;
	}
	
	if(get_user_team(id) != 1)
	{
		menu_destroy(menu);
		shop_anti_furien(id)
		return PLUGIN_HANDLED;
	}
	
	if(g_money[id] < FURIEN_COST[item])
	{
		color(id, ".v%s.g Nu ai destui bani pentru.e %s.g. Iti mai trebuiesc:.e %d$.g.", TAG, FURIEN_ITEMS[item], FURIEN_COST[item] - g_money[id])
		menu_destroy(menu);
		return PLUGIN_HANDLED;
	}
	
	switch(item)
	{
		case 0:
		{
			if(g_superknife[id])
			{
				color(id, ".v%s.g Ai deja.e Super Knife.g.", TAG)
				menu_destroy(menu);
				return PLUGIN_HANDLED;
			}
			g_superknife[id] = true
			check_weapon(id)
		}
		case 1:
		{
			if(get_user_health(id) == 320)
			{
				color(id, ".v%s.g Ai deja maximul de HP.", TAG)
				menu_destroy(menu);
				return PLUGIN_HANDLED;
			}
			else if(get_user_health(id) + 40 > 200)
				set_user_health(id, 200)
			else
				set_user_health(id, get_user_health(id) + 40)
		}
		case 2:
		{
			if(get_user_armor(id) == 250)
			{
				color(id, ".v%s.g Ai deja maximul de armura.", TAG)
				menu_destroy(menu);
				return PLUGIN_HANDLED;
			}	
			else if(get_user_armor(id) + 50 > 250)
				set_user_armor(id, 250)
			else
				set_user_armor(id, get_user_armor(id) + 50)
		}
		case 3:
		{
			if(g_noflash[id])
			{
				color(id, ".v%s.g Ai deja.e No Flash.g.", TAG)
				menu_destroy(menu);
				return PLUGIN_HANDLED;
			}
			g_noflash[id] = true
		}
		case 4:
		{
			if(user_has_weapon(id, CSW_HEGRENADE))
			{
				color(id, ".v%s.g Ai deja un.e Napalm Nade.g.", TAG)
				menu_destroy(menu);
				return PLUGIN_HANDLED;
			}
			ham_give_weapon(id, "weapon_hegrenade")
		}
		case 5:
		{
			if(user_has_weapon(id, CSW_FLASHBANG))
			{
				color(id, ".v%s.g Ai deja un.e Frost Nade.g.", TAG)
				menu_destroy(menu);
				return PLUGIN_HANDLED;
			}
			ham_give_weapon(id, "weapon_flashbang")
		}
		case 6:
		{
			if(user_has_weapon(id, CSW_SMOKEGRENADE) && have_killnade[id])
			{
				color(id, ".v%s.g Ai deja un.e KILL NADE.g.", TAG)
				menu_destroy(menu);
				return PLUGIN_HANDLED;
			}
			ham_give_weapon(id, "weapon_smokegrenade")
			have_killnade[id] = true
		}
	}
	color(id, ".v%s.g Ai cumparat.e %s.g cu.e %d$.g.", TAG, FURIEN_ITEMS[item], FURIEN_COST[item])
	g_money[id] -= FURIEN_COST[item]
	menu_destroy(menu);
	return PLUGIN_HANDLED;
}
	
public anti_furien_handler(id, menu, item)
{
	if(item == MENU_EXIT)
	{
		menu_destroy(menu);
		return PLUGIN_HANDLED;
	}
	if(item >= sizeof ANTI_FURIEN_ITEMS) return PLUGIN_HANDLED;
	
	if(!is_user_alive(id))
	{
		menu_destroy(menu);
		color(id, ".v%s.g Esti mort. Nu poti cumpara.e %s.g.", TAG, ANTI_FURIEN_ITEMS[item])
		return PLUGIN_HANDLED;
	}
	
	if(get_user_team(id) != 2)
	{
		menu_destroy(menu);
		shop_furien(id)
		return PLUGIN_HANDLED;
	}
	
	if(g_money[id] < ANTI_FURIEN_COST[item])
	{
		menu_destroy(menu);
		color(id, ".v%s.g Nu ai destui bani pentru.e %s.g. Iti mai trebuiesc:.e %d$.g.", TAG, ANTI_FURIEN_ITEMS[item], ANTI_FURIEN_COST[item] - g_money[id])
		return PLUGIN_HANDLED;
	}
	
	switch(item)
	{
		case 0:
		{
			if(g_furiendetector[id])
			{
				color(id, ".v%s.g Ai deja.e Furien Detector.g.", TAG)
				menu_destroy(menu);
				return PLUGIN_HANDLED;
			}
			g_furiendetector[id] = true
		}
		case 1:
		{
			if(get_user_health(id) == 280)
			{
				color(id, ".v%s.g Ai deja maximul de HP.", TAG)
				menu_destroy(menu);
				return PLUGIN_HANDLED;
			}
			else if(get_user_health(id) + 50 > 200)
				set_user_health(id, 200)
			else
				set_user_health(id, get_user_health(id) + 50)
		}
		case 2:
		{
			if(get_user_armor(id) == 250)
			{
				color(id, ".v%s.g Ai deja maximul de armura.", TAG)
				menu_destroy(menu);
				return PLUGIN_HANDLED;
			}	
			else if(get_user_armor(id) + 60 > 250)
				set_user_armor(id, 250)
			else
				set_user_armor(id, get_user_armor(id) + 60)
		}
		case 3:
		{
			if(g_nofrost[id])
			{
				color(id, ".v%s.g Ai deja.e No Frost.g.", TAG)
				menu_destroy(menu);
				return PLUGIN_HANDLED;
			}
			g_nofrost[id] = true
		}
		case 4:
		{
			if(user_has_weapon(id, CSW_HEGRENADE))
			{
				color(id, ".v%s.g Ai deja un.e He Grenade.g.", TAG)
				menu_destroy(menu);
				return PLUGIN_HANDLED;
			}
			ham_give_weapon(id, "weapon_hegrenade")
		}
		case 5:
		{
			if(user_has_weapon(id, CSW_FLASHBANG))
			{
				color(id, ".v%s.g Ai deja un.e Flash Bang.g.", TAG)
				menu_destroy(menu);
				return PLUGIN_HANDLED;
			}
			ham_give_weapon(id, "weapon_flashbang")
		}
	}
	color(id, ".v%s.g Ai cumparat.e %s.g cu.e %d$.g.", TAG, ANTI_FURIEN_ITEMS[item], ANTI_FURIEN_COST[item])
	g_money[id] -= ANTI_FURIEN_COST[item]
	menu_destroy(menu);
	return PLUGIN_HANDLED;
}

bool:is_point_visible(Float:start[3], Float:end[3], ignore_ent)
{
	static pentru
	pentru = create_tr2()
	
	engfunc(EngFunc_TraceLine, start, end, IGNORE_MONSTERS, ignore_ent, pentru)
	
	static Float:dist
	get_tr2(pentru, TR_flFraction, dist)
	
	free_tr2(pentru)
	
	return ((dist == 1.0) ? true : false)
}

public reset_player_model(id)
{
	if(!is_user_connected(id))
		return false;

	if(!flag_get(g_HasCustomModel, id))
		return true;
	
	remove_task(id+TASK_MODELCHANGE)
	flag_unset(g_HasCustomModel, id)
	fm_cs_reset_user_model(id)
	
	return true;
}

public fm_cs_set_user_model(taskid)
	set_user_info(ID_MODELCHANGE, "model", g_CustomPlayerModel[ID_MODELCHANGE])

stock fm_cs_get_user_model(id, model[], len)
	get_user_info(id, "model", model, len)

stock fm_cs_reset_user_model(id)
{
	copy(g_CustomPlayerModel[id], charsmax(g_CustomPlayerModel[]), "gordon")
	fm_cs_user_model_update(id+TASK_MODELCHANGE)
}

stock fm_cs_user_model_update(taskid)
{
	new Float:current_time
	current_time = get_gametime()
	
	if(current_time - g_ModelChangeTargetTime >= MODELCHANGE_DELAY)
	{
		fm_cs_set_user_model(taskid)
		g_ModelChangeTargetTime = current_time
	}
	else
	{
		set_task((g_ModelChangeTargetTime + MODELCHANGE_DELAY) - current_time, "fm_cs_set_user_model", taskid)
		g_ModelChangeTargetTime = g_ModelChangeTargetTime + MODELCHANGE_DELAY
	}
}

stock color(const id, const input[], any:...)
{
	new count = 1, players[32];
	static msg[191]
	vformat(msg, 190, input, 3)
	
	replace_all(msg, 190, ".v", "^4")
	replace_all(msg, 190, ".g", "^1")
	replace_all(msg, 190, ".e", "^3")
	
	if(id) players[0] = id; else get_players(players, count, "ch")
	{
		for (new i = 0; i < count; i++)
		{
			if(IsPlayer(players[i]))
			{
				message_begin(MSG_ONE_UNRELIABLE, g_msgSayText, _, players[i])
				write_byte(players[i]);
				write_string(msg);
				message_end();
			}
		}
	}
}

public AddCommas(iNum , szOutput[] , iLen)
{
	new szTmp[15], iOutputPos, iNumPos, iNumLen;

	if(iNum < 0)
	{
		szOutput[iOutputPos++] = '-'
		iNum = abs(iNum)
	}

	iNumLen = num_to_str(iNum, szTmp, charsmax(szTmp))

	if(iNumLen <= 3)
		iOutputPos += copy(szOutput[iOutputPos], iLen, szTmp)
	else
	{
		while((iNumPos < iNumLen) && (iOutputPos < iLen)) 
		{
			szOutput[iOutputPos++] = szTmp[iNumPos++]
		
			if((iNumLen - iNumPos) && !((iNumLen - iNumPos) % 3)) 
				szOutput[iOutputPos++] = ','
		}
		szOutput[iOutputPos] = EOS
	}
	return iOutputPos;
}

color_chat(team_format, player, player_team, color, const chat_msg[], ...)
{
	static msg[192]
	vformat(msg, charsmax(msg) - 1, chat_msg, 6)
	
	if(team_format)
	{
		static id, i, players[32], count
		get_players(players, count, "e", team_names[player_team])
		
		for(i = 0; i < count; i++)
		{
			id = players[i]
			
			if(!id) continue;
			
			message_begin(MSG_ONE_UNRELIABLE, g_msgSayText, _, id)
			write_byte(player)
			write_string(msg)
			message_end()
			
		}
	}
	else
	{
		if(player_team == color)
		{
			message_begin(MSG_BROADCAST, g_msgSayText)
			write_byte(player)
			write_string(msg)
			message_end()
		}
		else
		{
			message_begin(MSG_BROADCAST, g_msg_teaminfo)
			write_byte(player)
			write_string(team_names[color])
			message_end()
			
			message_begin(MSG_BROADCAST, g_msgSayText)
			write_byte(player)
			write_string(msg)
			message_end()
			
			message_begin(MSG_BROADCAST, g_msg_teaminfo)
			write_byte(player)
			write_string(team_names[player_team])
			message_end()
		}
	}
}

stock fm_cs_get_user_team(id)
{
	if(pev_valid(id) != PDATA_SAFE)
		return FM_CS_TEAM_UNASSIGNED;
	
	return get_pdata_int(id, OFFSET_CSTEAMS, OFFSET_LINUX);
}

stock get_name(id)
{
	static name[32];
	get_user_name(id, name, charsmax(name) - 1)
	return name;
}

stock ham_give_weapon(id, const weapon[])
{
    if(!equal(weapon,"weapon_",7)) return 0;

    new wEnt = engfunc(EngFunc_CreateNamedEntity,engfunc(EngFunc_AllocString,weapon));
    if(!pev_valid(wEnt)) return 0;

    set_pev(wEnt, pev_spawnflags, SF_NORESPAWN);
    dllfunc(DLLFunc_Spawn, wEnt);
    
    if(!ExecuteHamB(Ham_AddPlayerItem,id,wEnt))
    {
        if(pev_valid(wEnt)) set_pev(wEnt,pev_flags,pev(wEnt,pev_flags) | FL_KILLME);
        return 0;
    }

    ExecuteHamB(Ham_Item_AttachToPlayer, wEnt, id)
    return 1;
}

stock ham_strip_weapon(id,weapon[])
{
    if(!equal(weapon,"weapon_",7)) return 0;

    new wId = get_weaponid(weapon);
    if(!wId) return 0;

    new wEnt;
    while((wEnt = engfunc(EngFunc_FindEntityByString,wEnt,"classname",weapon)) && pev(wEnt,pev_owner) != id) {}
    if(!wEnt) return 0;

    if(get_user_weapon(id) == wId) ExecuteHamB(Ham_Weapon_RetireWeapon,wEnt);

    if(!ExecuteHamB(Ham_RemovePlayerItem,id,wEnt)) return 0;
    ExecuteHamB(Ham_Item_Kill,wEnt);

    set_pev(id,pev_weapons,pev(id,pev_weapons) & ~(1<<wId));

    if(wId == CSW_C4)
    {
        cs_set_user_plant(id,0,0);
        cs_set_user_bpammo(id,CSW_C4,0);
    }
    else if(wId == CSW_SMOKEGRENADE || wId == CSW_FLASHBANG || wId == CSW_HEGRENADE)
        cs_set_user_bpammo(id, wId, 0);

    return 1;
}

stock msg_create_fog(iRed, iGreen, iBlue, iDensity) 
{     
	new const fog_density[] = { 0, 0, 0, 0, 111, 18, 3, 58, 111, 18, 125, 58, 66, 96, 27, 59, 90, 101, 60, 59, 90,
	101, 68, 59, 10, 41, 95, 59, 111, 18, 125, 59, 111, 18, 3, 60, 68, 116, 19, 60 }

	new dens
	dens = (4 * iDensity)
 
	message_begin(MSG_BROADCAST, g_msgfog, { 0, 0, 0 }, 0)
	write_byte(iRed)
	write_byte(iGreen)
	write_byte(iBlue)
	write_byte(fog_density[dens])
	write_byte(fog_density[dens + 1])
	write_byte(fog_density[dens + 2])
	write_byte(fog_density[dens + 3])
	message_end()
}

stock fm_cs_set_user_deaths(id, value)
{
	if(pev_valid(id) != PDATA_SAFE)
		return;
	
	set_pdata_int(id, OFFSET_CSDEATHS, value, OFFSET_LINUX)
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1033\\ f0\\ fs16 \n\\ par }
*/
Nu fac nimic contra cost! Faceți cerere bine detaliată aici, pe forum. Nu-mi mai dați add pe Steam doar pentru a mă avea în lista de prieteni.
Am cont și activez doar aici! Aveți grijă la cei ce încearcă să mă copieze..Puteți lua legătura cu mine dacă aveți o problemă/nelămurire în acest caz.
În cazul în care utilizați ceva din addonsurile postate de mine aici, e bine să fiți la curent cu modificările aduse unor plugine, aici.
User avatar
rObY.
Membru, skill +1
Membru, skill +1
Posts: 333
Joined: 06 Dec 2016, 22:15
Detinator Steam: Da
SteamID: id/robert-psn26
Fond eXtream: 0
Location: Constanta
Has thanked: 28 times
Been thanked: 3 times

24 Mar 2020, 19:49

Multumesc mult, Levin.
Acum am o problema, dupa ce-ai scos resetscore-ul acela din pluginul asta, care chiar oricum nu mergea, erau doar texte.
Am adaugat multiple pluginuri de resetscore, dar nici unul nu merge. Imi poti integra unul in asta? poate asa va merge.
User avatar
L E V I N
Scripter eXtreamCS
Scripter eXtreamCS
Posts: 2856
Joined: 24 Aug 2011, 11:24
Detinator Steam: Da
CS Status:
Detinator server CS: ☯∴
SteamID: riseofevo
Reputatie: Scripter eXtreamCS
Nume anterior: Adryyy
Location: ҳ̸Ҳ̸ҳ
Has thanked: 38 times
Been thanked: 436 times
Contact:

24 Mar 2020, 19:54

șterge cmdaccess.ini și dă rr sv
Nu fac nimic contra cost! Faceți cerere bine detaliată aici, pe forum. Nu-mi mai dați add pe Steam doar pentru a mă avea în lista de prieteni.
Am cont și activez doar aici! Aveți grijă la cei ce încearcă să mă copieze..Puteți lua legătura cu mine dacă aveți o problemă/nelămurire în acest caz.
În cazul în care utilizați ceva din addonsurile postate de mine aici, e bine să fiți la curent cu modificările aduse unor plugine, aici.
Post Reply

Return to “Modificari pluginuri”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 12 guests