[MOD] Furien Mod Ultimate by Askhanar

Aici vom publica si discuta despre diverse moduri necesare serverelor dedicate.

Moderators: Moderatori, Moderatori ajutători

Post Reply
User avatar
Rainq
Fost administrator
Fost administrator
Posts: 381
Joined: Mon Jan 18, 2021 7:25 am
Status: Citesc forumul TheXForce.RO...!
Detinator Steam: Da
SteamID: mrainq
Gaming experience: Nu spun..
Reputatie: Fost administrator
Nume anterior: Light
Fost detinator zm.thexforce.ro
Fost detinator dr.thexforce.ro
Location: Bucureşti
Has thanked: 2 times
Been thanked: 1 time
Contact:

[MOD] Furien Mod Ultimate by Askhanar

Post by Rainq »

Descriere: Furien Mod Ultimate
Autor: Askhanar
Versiune: 0.8.3
Descarcare:
FMU_Events.inc

Code: Select all

/* Furien Mod Ultimate
*
* (c) Copyright 2012, Askhanar
*
* This file is provided as is (no warranties).
*/

#if defined _FMU_Events_included
	#endinput
#endif

#define _FMU_Events_included


native bool:fmu_is_happy_hour();
native bool:fmu_is_freegifts_hour();
native bool:fmu_is_lucky_hour();
native bool:fmu_is_shopping_hour();
FMU_Experience.inc

Code: Select all

/* Furien Mod Ultimate
*
* (c) Copyright 2012, Askhanar
*
* This file is provided as is (no warranties).
*/

#if defined _FMU_Experience_included
	#endinput
#endif

#define _FMU_Experience_included


/*
 * Returns a players XP points
 * 
 * @param		client - The player index to get points of
 * 
 * @return		The XP points of client
 * 
 */

native fmu_get_user_xp(client);

/*
 * Sets <xp> points to client
 * 
 * @param		client - The player index to set points to
 * @param		xp - The amount of XP points to set to client
 * 
 * @return		The XP points of client
 * 
 */

native fmu_set_user_xp(client, xp);

/*
 * Adds <xp> points to client
 * 
 * @param		client - The player index to add points to
 * @param		xp - The amount of XP points to add to client
 * 
 * @return		The XP points of client
 * 
 */

stock fmu_add_user_xp(client, xp)
{
	return fmu_set_user_xp(client, fmu_get_user_xp(client) + xp);
}

/*
 * Subtracts <xp> points from client
 * 
 * @param		client - The player index to subtract points from
 * @param		xp - The amount of XP points to subtract from client
 * 
 * @return		The XP points of client
 * 
 */

stock fmu_sub_user_xp(client, xp)
{
	return fmu_set_user_xp(client, fmu_get_user_xp(client) - xp);
}
FurienModeUltimate.sma

Code: Select all

/*
///===========================================================================================================
//¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
//				    ___________________________________
//				   |=                                 =|
//			           |=       Furien Mod lutimate       =|
//			           |=       ¯¯¯¯¯¯ ¯by ¯¯¯¯¯¯¯¯       =|
//			           |=		    ¯¯  Askhanar      =|
//			           |=                   ¯¯¯¯¯¯¯¯      =|
//                                    ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
// __________________________________________________________________________________________________________
//|==========================================================================================================|
//|											  		     |
//|			      Copyright © 2011 - 2012, Askhanar @disconnect.ro				     |
//|			  Acest fisier este prevazut asa cum este ( fara garantii )			     |
//|													     |
//|==========================================================================================================|
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
//	- ¦ 				         « Prieteni »			      		¦ -
//	** * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * **
//	* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
//	* * *										      * * *
//	* *  	Rap^		Frosten			TheBeast		AZAEL!   	* *
//	* *	fuzy		razvan W-strafer	RZV			SNKT   	 	* *	
//	* *	ahonen		Arion			pHum			gLobe   	* *
//	* *     Shax+		syBlow			kvL^			krom3       	* *
//	* *	Henk		DANYEL			SimpLe			XENON^		* *
//	* * *								                      *	* *
//	* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
//	** * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * **
//	
//			     _ _                                     _
//			    |¯(_)                                   |¯|  
//			  __| |_|___  ___ ___  _ __  _ __   ___  ___| |_ 
//			 / _` | / __|/ __/ _ \| '_ \| '_ \ / _ \/ __| __|
//			| (_| | \__ \ (_| (_) | |¯| | |¯| |  __/ (__| |_ 
//			 \__,_|_|___/\___\___/|_| |_|_| |_|\___|\___|\__|
//						 _
//						|¯|  
//						| |_  ___   __ _ _ __  ___ 
//						| __|/ _ \ / _` | `_ \/_  |
//						| |_(  __/( (_| | |¯| |¯| |
//						 \__|\___| \__,_|_| |_| |_|			
//												
//
//
//			Plugin				Versiune		Autor
//		  Furien Mod Ultimate			 0.8.3		       Askhanar
//		  
//		  
//		        Credite
//			
//		ConnorMcLeod, Exolent, xPaw, V3X! si restul utilizatorilor de pe alliedmodders..
//		
//		              -  Pentru ca am folosit ceva cod si tutoriale care le apartin.
//		      
//		  
//			  
// Cvar-uri:

// --| Daca sa fie sau nu salvat XP-ul si Upgrade-urile cumparate de jucatori.
// --| Default: 1

fmu_save_xp		1

// --| Cat XP vor primi cei ce intra pentru prima data pe server.
// --| Default: 15845

fmu_entry_xp		15845

// --| Cat XP vor primi jucatorii pentru un kill obisnuit ( omorarea unui jucator ).
// --| Default: 45

fmu_kill_xp		45

// --| Cat XP bonus vor primi jucatorii pentru un kill cu HS ( headshot ).
// --| Default: 15

fmu_hskill_xp		15

// --| Cat XP bonus vor primi jucatorii pentru un kill cu HE ( grenada ).
// --| Default: 20

fmu_grenadekill_xp	20

// --| Cat XP bonus vor primi jucatorii pentru un kill cu cutitul ( doar pentru AntiFurieni ).
// --| Default: 25

fmu_knifekill_xp	25

// --| Cat XP va primi fiecare jucator daca supravietuieste ( se termina runda si el este in viata ).
// --| Default: 10

fmu_survive_xp		10

// --| Cat XP va primi fiecare jucator atunci cand castiga runda ( nu conteaza cum.. ).
// --| Default: 15

fmu_win_xp		15

// --| Daca sa fie sau nu blocata comanda 'buy' si totodata zonele 'buyzone' sterse.
// --| Default: 1

fmu_block_buy		1

// --| Daca sa fie sau nu blocata comanda 'drop' ( cea cu care arunci arma ).
// --| Default: 0

fmu_block_drop		0

// --| Daca sa fie sau nu blocate comenzile de radio ( nu ai nevoie de radio in acest mod.. ).
// --| Default: 1

bmu_block_radio 	1

// --| Care echipa poate lua arme de pe jos ( 0 = Ambele, 1 = Furienii < Tero >, 2 = AntiFurienii < CT > ).
// --| Default: 2

fmu_allow_pickup	2

// --| Daca bomba poate fi plantata doar dupa un interval de timp de la inceputul rundei.
// --| Default: 1

fmu_nobomb_plant	1

// --| Dupa cat timp de la inceputul rundei poate fi plantata bomba.
// --| Default: 90

fmu_bombplant_wait	90

// --| Lumina care este setata pe harta( a = cel mai intunecat - z = cel mai luminat ).
// --| Pe o harda obisnuita lumina este setata pe litera 'm'.
// --| Default: e

fmu_lights		e

// --| Lumina care este setata pe harta cant bomba poate fi plantata( a = cel mai intunecat - z = cel mai luminat ).
// --| Functioneaza doar daca bomba poate fi plantata dupa un interval de timp( pentru dezactivare setati-l ca si cel de sus )..
// --| Default: d

fmu_bomblights		d

// --| Daca sa fie ceata sau nu.
// --| Default: 1

fmu_enable_fog		1

// --| Daca cvar-ul de ceata este activ aici setati culoarea cetii ( in RRR GGG BBB ).
// --| Default: 200 200 200

fmu_fog_color		"200 200 200"

// --| Daca cvar-ul de ceata este activ aici setati densitatea cetii( 1 = ceata risipita, 9 = ceata densa ).
// --| Default: 1

fmu_fog_density		1

// --| Daca cvar-ul de ceata este activ si este activ si cel de plantare a bombei dupa un anumit timp.
// --| Aici setati culoarea cetii care va apare atunci cand bomba poate fi plantata.
// --| Pentru dezactivare setati-l ca 'fmu_fog_color'.
// --| Default: 200 200 200

fmu_bombfog_color	"200 200 200"

// --| Daca cvar-ul de ceata este activ si este activ si cel de plantare a bombei dupa un anumit timp.
// --| Aici setati densitatea cetii care va apare atunci cand bomba poate fi plantata.
// --| Pentru dezactivare setati-l ca 'fmu_fog_density'.
// --| Default: 2

fmu_bombfog_density	2

// --| Cati bani ( $ ) bonus sa primeasca cei ce sunt VIP pentru fiecare kill / supravietuire / runda castigata.
// --| Default: 15

fmu_vip_moneybonus	15

// --| Id-ul de mess care apare la contact in /buyvip.
// --| Default: red_bull2oo6

fmu_vip_contact		red_bull2oo6

// --| Daca jucatorii pot sau nu sa-si transfere XP intre ei.
// --| Default: 0

fmu_allow_transferxp	0

// --| Gametype care va fi afisat..
// --| Default: este setat de plugin..

//fmu_gametype ""

// --| Cat costa 25HP din /shop.
// --| Default: 3500$

fmu_hp_cost	3500

// --| Cat costa 25AP din /shop.
// --| Default: 2500$

fmu_ap_cost	2500

// --| Cat costa HE-ul din /shop.
// --| Default: 2500$

fmu_he_cost	2500

// --| Cat costa Silent Walk din /shop ( doar pentru AntiFurieni ).
// --| Default: 1500$

fmu_sw_cost	1500

// --| Cat costa Defuse Kit din /shop ( doar pentru AntiFurieni ).
// --| Default: 3500$

fmu_dk_cost	800

// --| Cat XP primesc cei ce cumpara din /shop.
// --| Default: 1050

fmu_xp_amount	1050


// --| Cat costa XP-ul din /shop
.
// --| Default: 13000$

fmu_xp_cost	13000


// --| Cat costa Instant Respawn din /shop.
// --| Default: 11000$

fmu_ir_cost	11000


// --| Cat XP costa Super Knife din /xpshop ( doar pentru Furieni ).
// --| Default: 3500

fmu_superknife_cost 	3500

// --| Cat XP costa X-Ray Scanner din /xpshop ( doar pentru AntiFurieni ).
// --| Default: 2500

fmu_scanner_cost 	2500

// --| Cat XP costa Chameleon din /xpshop.
// --| Default: 3500

fmu_chameleon_cost 	1500



// Comenzi Publice ( in say sau say_team ):

// --| /help, help 	-->  Deschide meniul pentru Ajutor ( multe informatii despre absolut orice ).
// --| /shop, shop 	-->  Deschide meniul cu 'cumparaturi' pe bani ( HP, AP, HE s.a.m.d )..
// --| /xpshop, xpshop 	-->  Deschide meniul cu 'cumparaturi' pe XP ( Super Knife, Chameleon s.a.m.d )..
// --| /vip, /vips 	-->  Deschide motd cu VIP online..
// --| /buyvip	 	-->  Deschide motd cu detalii despte cumparare VIP.
// --| /transfer, /givexp 	-->  < nume > < xp > transferi cuiva XP din XP-ul tau.

// --| /xp, /exp, xp, exp 	-->  Deschide meniul de unde poti cumpara Upgrade-uri..



// Comenzi Admini ( in consola ):

// --| amx_givexp		-->  < nume > < xp > ii dai XP unui jucator.
// --| amx_takexp		-->  < nume > < xp > ii scoti XP unui jucator.

// --| amx_resetall	-->  < nume > ii resetezi tot XP-ul si toate Upgrade-urile unui jucator.
// --| amx_deletexp	-->  Resetezi tot XP-ul si toate Upgrade-urile jucatorilor salvate pana atunci.
			 ->  De asemenea server-ul se va restarta in 10 secunde !
			 
			 
*/

#include <  amxmodx  >
#include <  amxmisc  >

#include <  cstrike  >
#include <  hamsandwich  >

#include <  fakemeta  >
#include <  engine  >

#include <  fun  >
#include <  nvault  >

#include <  FMU_Events  >
#include <  CC_ColorChat  >



#pragma semicolon 1

#define PLUGIN "Furien Mod Ultimate"
#define VERSION "0.8.3"


// by ConnorMcLeod
// -------------------------------

#define XO_WEAPON 4
#define m_pPlayer 41

#define XO_WEAPONBOX					4
#define m_rgpPlayerItems_wpnbx_Slot5		39
#define IsWeaponBoxC4(%1)		( get_pdata_cbase(%1, m_rgpPlayerItems_wpnbx_Slot5, XO_WEAPONBOX) > 0 )


#define fm_cs_set_user_nobuy(%1) set_pdata_int(%1, 235, get_pdata_int(%1, 235) & ~(1<<0) )
// -------------------------------



// Don't touch it !
#define IsPlayer(%1) ( gFirstPlayer <= %1 <= gMaxPlayers ) 
#define DMG_GRENADE (1<<24)


#define PISTOL_WEAPONS_BIT    (1<<CSW_GLOCK18|1<<CSW_USP|1<<CSW_DEAGLE|1<<CSW_P228|1<<CSW_FIVESEVEN|1<<CSW_ELITE)
#define SHOTGUN_WEAPONS_BIT    (1<<CSW_M3|1<<CSW_XM1014)
#define SUBMACHINE_WEAPONS_BIT    (1<<CSW_TMP|1<<CSW_MAC10|1<<CSW_MP5NAVY|1<<CSW_UMP45|1<<CSW_P90)
#define RIFLE_WEAPONS_BIT    (1<<CSW_FAMAS|1<<CSW_GALIL|1<<CSW_AK47|1<<CSW_SCOUT|1<<CSW_M4A1|1<<CSW_SG550|1<<CSW_SG552|1<<CSW_AUG|1<<CSW_AWP|1<<CSW_G3SG1)
#define MACHINE_WEAPONS_BIT    (1<<CSW_M249)

#define PRIMARY_WEAPONS_BIT    (SHOTGUN_WEAPONS_BIT|SUBMACHINE_WEAPONS_BIT|RIFLE_WEAPONS_BIT|MACHINE_WEAPONS_BIT)
#define SECONDARY_WEAPONS_BIT    (PISTOL_WEAPONS_BIT)

#define IsPrimaryWeapon(%1) ( (1<<%1) & PRIMARY_WEAPONS_BIT )
#define IsSecondaryWeapon(%1) ( (1<<%1) & PISTOL_WEAPONS_BIT )

//127.0.0.2
//89.44.246.131

// The Plugin is licensed to only one server ip..  10.91.120.46   89.44.246.131


// The prefix in all of the plugin's messages

new const MESSAGE_TAG[] =		"[Furien Ultimate]";


#define		CS_TEAM_FURIEN		CS_TEAM_T
#define		CS_TEAM_ANTIFURIEN	CS_TEAM_CT

// Access to amx_givexp amx_takexp..
#define 	FURIEN_ACCESS		ADMIN_CVAR




// Just a task used for team switch and model change..
#define		SWITCH_TASK		112233



// One day in seconds used for nvault_prune..
#define 	ONE_DAY_IN_SECONDS	86400



// If user's healts is below this value his heart will beat + some effects.
#define 	LOW_HP_TO_HEAR_HEART	40





// This is null do not modify

#define NULL			0
//#define NULL_FLOAT		0.0


// Furien Invisibility Factor, from 1 to 4 (  only when they have knife  ).
// 1 = almost visible.
// 4 = less visible.
// Default: 2

#define FURIEN_VISIBILITY_FACTOR			2


// The value of server's sv_maxspeed cvar which is set to.
// This value is set to connecting players on cl_ cvars.
// cl_forwardspeed
// cl_backspeed
// cl_sidespeed

#define SV_MAXSPEED_VALUE				1000.0


// Do Not Modify This Line !

#define ANY_UPGRADE_ENABLED (gAnyHealthEnabled || gAnyArmorEnabled || gAnySpeedEnabled || gAnyGravityEnabled || gAnyDamageMultiplierEnabled || gAnyRespawnEnabled)



// These determine if these abilities should be enabled or disabled
// 1 = enabled
// 0 = disabled

#define ENABLE_FURIEN_HEALTH					1
#define ENABLE_ANTIFURIEN_HEALTH				1
#define ENABLE_FURIEN_ARMOR					1
#define ENABLE_ANTIFURIEN_ARMOR					1
#define ENABLE_FURIEN_SPEED					1
#define ENABLE_ANTIFURIEN_SPEED					1
#define ENABLE_FURIEN_GRAVITY					1
#define ENABLE_ANTIFURIEN_GRAVITY				1
#define ENABLE_FURIEN_DAMAGE_MULTIPLIER				1
#define ENABLE_ANTIFURIEN_DAMAGE_MULTIPLIER			1
#define ENABLE_FURIEN_RESPAWN					1
#define ENABLE_ANTIFURIEN_RESPAWN				1
#define ENABLE_FURIEN_HEALTH_REG				1
#define ENABLE_ANTIFURIEN_HEALTH_REG				1
#define ENABLE_FURIEN_ARMOR_CHARGER				1
#define ENABLE_ANTIFURIEN_ARMOR_CHARGER				1


// The maximum level for each ability

#define MAXLEVEL_FURIEN_HEALTH					10
#define MAXLEVEL_ANTIFURIEN_HEALTH				10
#define MAXLEVEL_FURIEN_ARMOR					10
#define MAXLEVEL_ANTIFURIEN_ARMOR				10
#define MAXLEVEL_FURIEN_SPEED					7		
#define MAXLEVEL_ANTIFURIEN_SPEED				7
#define MAXLEVEL_FURIEN_GRAVITY					7
#define MAXLEVEL_ANTIFURIEN_GRAVITY				7
#define MAXLEVEL_FURIEN_DAMAGE_MULTIPLIER			10
#define MAXLEVEL_ANTIFURIEN_DAMAGE_MULTIPLIER			10
#define MAXLEVEL_FURIEN_RESPAWN					10
#define MAXLEVEL_ANTIFURIEN_RESPAWN				10
#define MAXLEVEL_FURIEN_HEALTH_REG				10
#define MAXLEVEL_ANTIFURIEN_HEALTH_REG				7
#define MAXLEVEL_FURIEN_ARMOR_CHARGER				10
#define MAXLEVEL_ANTIFURIEN_ARMOR_CHARGER			7


// The xp amount required to buy the first level

#define FIRST_XP_FURIEN_HEALTH					550
#define FIRST_XP_ANTIFURIEN_HEALTH				600
#define FIRST_XP_FURIEN_ARMOR					600
#define FIRST_XP_ANTIFURIEN_ARMOR				550
#define FIRST_XP_FURIEN_SPEED					1500		
#define FIRST_XP_ANTIFURIEN_SPEED				2000
#define FIRST_XP_FURIEN_GRAVITY					1500
#define FIRST_XP_ANTIFURIEN_GRAVITY				2000
#define FIRST_XP_FURIEN_DAMAGE_MULTIPLIER			1000
#define FIRST_XP_ANTIFURIEN_DAMAGE_MULTIPLIER			1200
#define FIRST_XP_FURIEN_RESPAWN					1200
#define FIRST_XP_ANTIFURIEN_RESPAWN				1350
#define FIRST_XP_FURIEN_HEALTH_REG				1050
#define FIRST_XP_ANTIFURIEN_HEALTH_REG				1150
#define FIRST_XP_FURIEN_ARMOR_CHARGER				1150
#define FIRST_XP_ANTIFURIEN_ARMOR_CHARGER			1050



// The max amount of health , armor, and other.
// For Speed , Gravity and Damage Multiplier you can edit them at bottom of this part.

#define MAXAMOUNT_OF_FURIEN_HEALTH				100
#define MAXAMOUNT_OF_ANTIFURIEN_HEALTH				110
#define MAXAMOUNT_OF_FURIEN_ARMOR				110
#define MAXAMOUNT_OF_ANTIFURIEN_ARMOR				100
#define MAXAMOUNT_OF_FURIEN_RESPAWN				100
#define MAXAMOUNT_OF_ANTIFURIEN_RESPAWN				100
#define MAXAMOUNT_OF_FURIEN_HEALTH_REG				10
#define MAXAMOUNT_OF_ANTIFURIEN_HEALTH_REG			7
#define MAXAMOUNT_OF_FURIEN_ARMOR_CHARGER			10
#define MAXAMOUNT_OF_ANTIFURIEN_ARMOR_CHARGER			7


// =================================================
// STOP EDITING HERE
// =================================================

#pragma semicolon 1

new const gAnyHealthEnabled = ENABLE_FURIEN_HEALTH + ENABLE_ANTIFURIEN_HEALTH;

new const gHealthEnabled[  CsTeams  ] =
{
	
	NULL,
	ENABLE_FURIEN_HEALTH,
	ENABLE_ANTIFURIEN_HEALTH,
	NULL
	
};


new const gHealthMaxLevels[  CsTeams  ] =
{
	
	NULL,
	MAXLEVEL_FURIEN_HEALTH,
	MAXLEVEL_ANTIFURIEN_HEALTH,
	NULL
	
};

new const gHealthFirstXp[  CsTeams  ] =
{
	
	NULL,
	FIRST_XP_FURIEN_HEALTH,
	FIRST_XP_ANTIFURIEN_HEALTH,
	NULL
	
};


new const gHealthMaxAmount[  CsTeams  ] =
{
	
	NULL,
	MAXAMOUNT_OF_FURIEN_HEALTH,
	MAXAMOUNT_OF_ANTIFURIEN_HEALTH,
	NULL
	
};

new const gHealthNames[  CsTeams  ][    ] =
{
	
	"",
	"Viata Furien",
	"Viata AntiFurien",
	""
	
};

new const gAnyArmorEnabled = ENABLE_FURIEN_ARMOR + ENABLE_ANTIFURIEN_ARMOR;

new const gArmorEnabled[  CsTeams  ] =
{
	
	NULL,
	ENABLE_FURIEN_ARMOR,
	ENABLE_ANTIFURIEN_ARMOR,
	NULL
	
};


new const gArmorMaxLevels[  CsTeams  ] =
{
	
	NULL,
	MAXLEVEL_FURIEN_ARMOR,
	MAXLEVEL_ANTIFURIEN_ARMOR,
	NULL
	
};

new const gArmorFirstXp[  CsTeams  ] =
{
	
	NULL,
	FIRST_XP_FURIEN_ARMOR,
	FIRST_XP_ANTIFURIEN_ARMOR,
	NULL
	
};


new const gArmorMaxAmount[  CsTeams  ] =
{
	
	NULL,
	MAXAMOUNT_OF_FURIEN_ARMOR,
	MAXAMOUNT_OF_ANTIFURIEN_ARMOR,
	NULL
	
};

new const gArmorNames[  CsTeams  ][    ] =
{
	
	"",
	"Armura Furien",
	"Armura AntiFurien",
	""
	
};

new const gAnySpeedEnabled = ENABLE_FURIEN_SPEED + ENABLE_ANTIFURIEN_SPEED;

new const gSpeedEnabled[  CsTeams  ] =
{
	
	NULL,
	ENABLE_FURIEN_SPEED,
	ENABLE_ANTIFURIEN_SPEED,
	NULL
	
};


new const gSpeedMaxLevels[  CsTeams  ] =
{
	
	NULL,
	MAXLEVEL_FURIEN_SPEED,
	MAXLEVEL_ANTIFURIEN_SPEED,
	NULL
	
};

new const gSpeedFirstXp[  CsTeams  ] =
{
	
	NULL,
	FIRST_XP_FURIEN_SPEED,
	FIRST_XP_ANTIFURIEN_SPEED,
	NULL
	
};

new const gSpeedNames[  CsTeams  ][    ] =
{
	
	"",
	"Viteza Furien",
	"Viteza AntiFurien",
	""
	
};

new const gAnyGravityEnabled = ENABLE_FURIEN_GRAVITY + ENABLE_ANTIFURIEN_GRAVITY;

new const gGravityEnabled[  CsTeams  ] =
{
	
	NULL,
	ENABLE_FURIEN_GRAVITY,
	ENABLE_ANTIFURIEN_GRAVITY,
	NULL
	
};


new const gGravityMaxLevels[  CsTeams  ] =
{
	
	NULL,
	MAXLEVEL_FURIEN_GRAVITY,
	MAXLEVEL_ANTIFURIEN_GRAVITY,
	NULL
	
};

new const gGravityFirstXp[  CsTeams  ] =
{
	
	NULL,
	FIRST_XP_FURIEN_GRAVITY,
	FIRST_XP_ANTIFURIEN_GRAVITY,
	NULL
	
};

new const gGravityNames[  CsTeams  ][    ] =
{
	
	"",
	"Gravitate Furien",
	"Gravitate AntiFurien",
	""
	
};


new const gAnyDamageMultiplierEnabled = ENABLE_FURIEN_DAMAGE_MULTIPLIER + ENABLE_ANTIFURIEN_DAMAGE_MULTIPLIER;

new const gDamageMultiplierEnabled[  CsTeams  ] =
{
	
	NULL,
	ENABLE_FURIEN_DAMAGE_MULTIPLIER,
	ENABLE_ANTIFURIEN_DAMAGE_MULTIPLIER,
	NULL
	
};


new const gDamageMultiplierMaxLevels[  CsTeams  ] =
{
	
	NULL,
	MAXLEVEL_FURIEN_DAMAGE_MULTIPLIER,
	MAXLEVEL_ANTIFURIEN_DAMAGE_MULTIPLIER,
	NULL
	
};

new const gDamageMultiplierFirstXp[  CsTeams  ] =
{
	
	NULL,
	FIRST_XP_FURIEN_DAMAGE_MULTIPLIER,
	FIRST_XP_ANTIFURIEN_DAMAGE_MULTIPLIER,
	NULL
	
};

new const gDamageMultiplierNames[  CsTeams  ][    ] =
{
	
	"",
	"Multiplicare Damage Furien",
	"Multiplicare Damage AntiFurien",
	""
	
};


new const gAnyRespawnEnabled = ENABLE_FURIEN_RESPAWN + ENABLE_ANTIFURIEN_RESPAWN;

new const gRespawnEnabled[  CsTeams  ] =
{
	
	NULL,
	ENABLE_FURIEN_RESPAWN,
	ENABLE_ANTIFURIEN_RESPAWN,
	NULL
	
};


new const gRespawnMaxLevels[  CsTeams  ] =
{
	
	NULL,
	MAXLEVEL_FURIEN_RESPAWN,
	MAXLEVEL_ANTIFURIEN_RESPAWN,
	NULL
	
};

new const gRespawnFirstXp[  CsTeams  ] =
{
	
	NULL,
	FIRST_XP_FURIEN_RESPAWN,
	FIRST_XP_ANTIFURIEN_RESPAWN,
	NULL
	
};


new const gRespawnMaxAmount[  CsTeams  ] =
{
	
	NULL,
	MAXAMOUNT_OF_FURIEN_RESPAWN,
	MAXAMOUNT_OF_ANTIFURIEN_RESPAWN,
	NULL
	
};

new const gRespawnNames[  CsTeams  ][    ] =
{
	
	"",
	"Furien Respawn",
	"AntiFurien Respawn",
	""
	
};

new const gAnyHealthRegenerationEnabled = ENABLE_FURIEN_HEALTH_REG + ENABLE_ANTIFURIEN_HEALTH_REG;

new const gHealthRegenerationEnabled[  CsTeams  ] =
{
	
	NULL,
	ENABLE_FURIEN_HEALTH_REG,
	ENABLE_ANTIFURIEN_HEALTH_REG,
	NULL
	
};


new const gHealthRegenerationMaxLevels[  CsTeams  ] =
{
	
	NULL,
	MAXLEVEL_FURIEN_HEALTH_REG,
	MAXLEVEL_ANTIFURIEN_HEALTH_REG,
	NULL
	
};

new const gHealthRegenerationFirstXp[  CsTeams  ] =
{
	
	NULL,
	FIRST_XP_FURIEN_HEALTH_REG,
	FIRST_XP_ANTIFURIEN_HEALTH_REG,
	NULL
	
};


new const gHealthRegenerationMaxAmount[  CsTeams  ] =
{
	
	NULL,
	MAXAMOUNT_OF_FURIEN_HEALTH_REG,
	MAXAMOUNT_OF_ANTIFURIEN_HEALTH_REG,
	NULL
	
};

new const gHealthRegenerationNames[  CsTeams  ][    ] =
{
	
	"",
	"Regenerare Viata Furien",
	"Regenerare Viata AntiFurien",
	""
	
};
new const gAnyArmorChargerEnabled = ENABLE_FURIEN_ARMOR_CHARGER + ENABLE_ANTIFURIEN_ARMOR_CHARGER;

new const gArmorChargerEnabled[  CsTeams  ] =
{
	
	NULL,
	ENABLE_FURIEN_ARMOR_CHARGER,
	ENABLE_ANTIFURIEN_ARMOR_CHARGER,
	NULL
	
};


new const gArmorChargerMaxLevels[  CsTeams  ] =
{
	
	NULL,
	MAXLEVEL_FURIEN_ARMOR_CHARGER,
	MAXLEVEL_ANTIFURIEN_ARMOR_CHARGER,
	NULL
	
};

new const gArmorChargerFirstXp[  CsTeams  ] =
{
	
	NULL,
	FIRST_XP_FURIEN_ARMOR_CHARGER,
	FIRST_XP_ANTIFURIEN_ARMOR_CHARGER,
	NULL
	
};


new const gArmorChargerMaxAmount[  CsTeams  ] =
{
	
	NULL,
	MAXAMOUNT_OF_FURIEN_ARMOR_CHARGER,
	MAXAMOUNT_OF_ANTIFURIEN_ARMOR_CHARGER,
	NULL
	
};

new const gArmorChargerNames[  CsTeams  ][    ] =
{
	
	"",
	"Reincarcare Armura Furien",
	"Reincarcare Armura AntiFurien",
	""
	
};

// Furien Speed Levels.
// Level 0 = 350 SPEED.
new const Float:gFurienSpeedLevels[  MAXLEVEL_FURIEN_SPEED + 1 ]  =
{
	350.0,		//Level 0.
	400.0,		//Level 1.
	500.0,		//Level 2.
	600.0,		//Level 3.
	700.0,		//Level 4.
	800.0,		//Level 5.
	825.0,		//Level 6.
	850.0		//Level 7.
};


// AntiFurien Speed Levels.
// Level 0 = 255 SPEED.
new const Float:gAntiFurienSpeedLevels[  MAXLEVEL_ANTIFURIEN_SPEED + 1 ]  =
{
	255.0,		//Level 0.
	275.0,		//Level 1.
	300.0,		//Level 2.
	325.0,		//Level 3.
	350.0,		//Level 4.
	375.0,		//Level 5.
	400.0,		//Level 6.
	425.0		//Level 7.
};


// Furien Gravity Levels.
// Level 0 = 720 Gravity.
// 1.0 = 800 Gravity
// 0.00125 = 1 Gravity
// 0.125 = 100 Gravity
new const Float:gFurienGravityLevels[  MAXLEVEL_FURIEN_GRAVITY + 1 ]  =
{
	0.9,		//Level 0. (  720 Gravity  )
	0.8,		//Level 1. (  640 Gravity  )
	0.750,		//Level 2. (  600 Gravity  )
	0.7,		//Level 3. (  560 Gravity  )
	0.6,		//Level 4. (  480 Gravity  )
	0.5,		//Level 5. (  400 Gravity  )
	0.4,		//Level 6. (  320 Gravity  )
	0.350		//Level 7. (  280 Gravity  )
};


// AntiFurien Gravity Levels.
// Level 0 = 800 Gravity.
// 1.0 = 800 Gravity
// 0.00125 = 1 Gravity
// 0.125 = 100 Gravity
new const Float:gAntiFurienGravityLevels[  MAXLEVEL_ANTIFURIEN_GRAVITY + 1 ]  =
{
	1.0,		//Level 0. (  800 Gravity  )
	0.950,		//Level 1. (  760 Gravity  )
	0.9,		//Level 2. (  720 Gravity  )
	0.850,		//Level 3. (  680 Gravity  )
	0.8,		//Level 4. (  640 Gravity  )
	0.750,		//Level 5. (  600 Gravity  )
	0.7,		//Level 6. (  560 Gravity  )
	0.650		//Level 7. (  520 Gravity  )
};

// Max Amount of Furien Damage Multiplier.
// This amount is divided with Damage Multiplier Max Levels ( 5 ).
// 1.4  /  7  =  0.2  This 0.2 will be multiplied with Player's Damage Multiplier Level on Furien Team.
// The result is added at HamTakeDamage ( 1.0 is normal damage, it will be 1.0 + result ).
// At Max Level it will be 1.4 so.. ( 1.0 default damage + 1.4  = 2.4.. this means more than double damage.. 50 damage will become like 120 ).
new Float:gFurienMaxDamageMultiplier  =  2.10;


// Max Amount of Furien Damage Multiplier.
// This amount is divided with Damage Multiplier Max Levels ( 5 ).
// 0.5  /  5  =  0.1  This 0.1 will be multiplied with Player's Damage Multiplier Level on AntiFurien Team.
// The result is added at HamTakeDamage ( 1.0 is normal damage, it will be 1.0 + result ).
// At Max Level it will be 0.5 so.. ( 1.0 default damage + 0.5  = 1.5.. this means..50 damage will become 75 ).
new Float:gAntiFurienMaxDamageMultiplier  =  0.5;


// Do not modify this.
new Ham:Ham_Player_ResetMaxSpeed = Ham_Item_PreFrame;



/*================================================================================================*/

new const gWeaponsBuyCommands[    ][    ] =
{
	"usp", "glock", "deagle", "p228", "elites",
	"fn57", "m3", "xm1014", "mp5", "tmp", "p90",
	"mac10", "ump45", "ak47", "galil", "famas",
	"sg552", "m4a1", "aug", "scout", "awp", "g3sg1",
	"sg550", "m249", "vest", "vesthelm", "flash",
	"hegren", "sgren", "defuser", "nvgs", "shield",
	"primammo", "secammo", "km45", "9x19mm", "nighthawk",
	"228compact", "fiveseven", "12gauge", "autoshotgun",
	"mp", "c90", "cv47", "defender", "clarion", "krieg552",
	"bullpup", "magnum", "d3au1", "krieg550", "buyammo1",
	"buyammo2", "buyequip"
};

/*================================================================================================*/

new const gImportantBlocks[    ][    ] =
{
	/*"chooseteam", "jointeam 1",*/ "cl_autobuy",
	"cl_rebuy", "cl_setautobuy", "cl_setrebuy",
	"buy", "bUy", "buY", "bUY", "Buy", "BUy", "BuY", "BUY"
};

/*================================================================================================*/

new const gRadioCommands[    ][    ] =
{
	"radio1", "radio2", "radio3", "coverme", "takepoint",
	"holdpos", "regroup", "followme", "takingfire", "go",
	"fallback", "sticktog", "getinpos", "stormfront",
	"report", "roger", "enemyspot", "needbackup",
	"sectorclear", "inposition", "reportingin", "getout",
	"negative", "enemydown"
};

// DO NOT MODIFY THIS ONE!
new ConstFogDensity[    ]  =
{
	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,0,0,0,0
};

// Strings..
new const FurienWinSound[    ]  =  "FurienWinSound.mp3";
new const AntiFurienWinSound[    ]  =  "AntiFurienWinSound.mp3";
new const LowHealthSound[    ]  =  "misc/FMU_HeartBeat.wav";
new const FurienKnifeModel[    ]  =  "models/v_superknife.mdl";
new const AntiFurienKnifeModel[    ]  =  "models/v_knife_r.mdl";
new const SuperKnifeModel[    ]  =  "models/v_knife_bloody.mdl";
new const LaserSprite[    ] = "sprites/zbeam4.spr";
new const SndPickUpItem[    ]  =  "fmu_sounds/fmu_pickupitem.wav";
new const SndRespawn[    ]  =  "fmu_sounds/fmu_respawn.wav";
new const SndTome[    ]  =  "fmu_sounds/fmu_tome.wav";
new const SndLevelUp[    ]  =  "fmu_sounds/fmu_levelup.wav";
new const g_szFurienModUltimateSound[    ]  =  "fmu_sounds/FurienModUltimate.mp3";
new const FurienModel[ ] = "FurienModel";
new const AntiFurienModel[ ] = "AntiFurienModel";
// Trie...
new Trie:gMessagesReplacements;


// Variables..
new gHealthLevel[  33  ][  CsTeams  ];
new gArmorLevel[  33  ][  CsTeams  ];
new gSpeedLevel[  33  ][  CsTeams  ];
new gGravityLevel[  33  ][  CsTeams  ];
new gDamageMultiplierLevel[  33  ][  CsTeams  ];
new gRespawnLevel[  33  ][  CsTeams  ];
new gHealthRegenerationLevel[  33  ][  CsTeams  ];
new gArmorChargerLevel[  33  ][  CsTeams  ];
new gPlayerUsedRespawn[  33  ];
new gUserXp[  33  ];


// Cvars.
new gCvarSaveXP;
new gCvarEntryXP;
new gCvarKillXP;
new gCvarHeadShotKillXP;
new gCvarGrenadeKillXP;
new gCvarKnifeKillXP;
new gCvarSurviveXP;
new gCvarWinXP;	
new gCvarBlockBuy;
new gCvarBlockRadio;
new gCvarBlockDropCommand;
new gCvarBlockWeaponPickUp;
new gCvarNoBombPlantTime;
new gCvarLights;
new gCvarBombLights;
new gCvarEnableFog;
new gCvarFogColor;
new gCvarFogDensity;
new gCvarBombFogColor;
new gCvarBombFogDensity;
new gCvarVipMoneyBonus;
//new gCvarVipContact;
new gCvarAllowTransferXP;
new gCvarEnableShop;
new gCvarEnableXPShop;
new gCvarHPCost;
new gCvarAPCost;
new gCvarHECost;
new gCvarSWCost;
new gCvarDKCost;
new gCvarXPAmount;
new gCvarXPCost;
new gCvarIRCost;
new gCvarSKCost;
new gCvarLRCost;
new gCvarCMCost;
new gCvarGameType;


// Bools
new bool:gUserHasSuperKnife[  33  ];
new bool:gUserHasLaser[  33  ];
new bool:gUserHasChameleon[  33  ];
new bool:gFogCreated  =  false;
new bool:gFirstTimePlayed[  33  ];
new bool:gRoundEnded  =  false;
new bool:gBombCanBePlanted  =  false;

// Floats
new Float:gfBombGameTime  =  0.0;

// Others
new gLaserSprite;
new SyncHudMessage;
new gFirstPlayer;
new gMaxPlayers;

// Our Vault..
new gVault;

// Pcvars..
new sv_airaccelerate, sv_maxspeed;

public plugin_cfg(    )	set_cvar_float(  "sv_maxspeed",  SV_MAXSPEED_VALUE  );

public plugin_precache(    )
{
	
		
	new ModelOrSoundPath[  128  ];
	
	formatex(  ModelOrSoundPath, sizeof ( ModelOrSoundPath ) -1, "sound/%s", g_szFurienModUltimateSound );
	precache_generic(  ModelOrSoundPath  );
	
	if(  contain(  FurienWinSound,  ".wav"  )  >  0 )
	{
		
		formatex(  ModelOrSoundPath,  sizeof  (  ModelOrSoundPath  )  -1, "fmu_sounds/%s",  FurienWinSound  );
		precache_sound(  ModelOrSoundPath  );
	}
	else if(  contain(  FurienWinSound,  ".mp3"  )  >  0 )
	{
		
		formatex(  ModelOrSoundPath,  sizeof  (  ModelOrSoundPath  )  -1, "sound/fmu_sounds/%s",  FurienWinSound  );
		precache_generic(  ModelOrSoundPath  );
	}
	
	if(  contain(  AntiFurienWinSound,  ".wav"  )  >  0 )
	{
		
		formatex(  ModelOrSoundPath,  sizeof  (  ModelOrSoundPath  )  -1, "fmu_sounds/%s",  AntiFurienWinSound  );
		precache_sound(  ModelOrSoundPath  );
	}
	else if(  contain(  AntiFurienWinSound,  ".mp3"  )  >  0 )
	{
		
		formatex(  ModelOrSoundPath,  sizeof  (  ModelOrSoundPath  )  -1, "sound/fmu_sounds/%s",  AntiFurienWinSound  );
		precache_generic(  ModelOrSoundPath  );
	}
	
	formatex(  ModelOrSoundPath,  sizeof  (  ModelOrSoundPath  )  -1, "models/player/%s/%s.mdl",  FurienModel,  FurienModel );
	precache_model( ModelOrSoundPath );
		
	formatex(  ModelOrSoundPath,  sizeof  (  ModelOrSoundPath  )  -1, "models/player/%s/%s.mdl",  AntiFurienModel,  AntiFurienModel );
	precache_model( ModelOrSoundPath );
	
	precache_sound(  LowHealthSound  );
	precache_sound(  SndPickUpItem  );
	precache_sound(  SndRespawn  );
	precache_sound(  SndTome  );
	precache_sound(  SndLevelUp  );
	
	precache_model(  FurienKnifeModel  );
	precache_model(  AntiFurienKnifeModel  );
	precache_model(  SuperKnifeModel  );
	
	gLaserSprite = precache_model( LaserSprite );
	
	
}

public plugin_init(    )
{
	
	
	register_plugin(  PLUGIN,  VERSION,  "Askhanar"  );

	gCvarSaveXP  =  register_cvar(  "fmu_save_xp",  "1"  );
	gCvarEntryXP  =  register_cvar(  "fmu_entry_xp",  "15845"  );
	gCvarKillXP  =  register_cvar(  "fmu_kill_xp",  "45"  );
	gCvarHeadShotKillXP  =  register_cvar(  "fmu_hskill_xp",  "15"  );
	gCvarGrenadeKillXP  =  register_cvar(  "fmu_grenadekill_xp",  "20"  );
	gCvarKnifeKillXP  =  register_cvar(  "fmu_knifekill_xp",  "25"  );
	gCvarSurviveXP  =  register_cvar(  "fmu_survive_xp",  "10"  );
	gCvarWinXP  =  register_cvar(  "fmu_win_xp",  "15"  );
	gCvarBlockBuy  =  register_cvar(  "fmu_block_buy",  "1"  );
	gCvarBlockRadio  =  register_cvar(  "fmu_block_radio",  "1"  );
	gCvarBlockDropCommand  =  register_cvar(  "fmu_block_drop",  "2"  );
	gCvarBlockWeaponPickUp  =  register_cvar(  "fmu_allow_pickup",  "2"  );
	
	gCvarNoBombPlantTime  =  register_cvar(  "fmu_bombplant_wait",  "100"  );
	
	gCvarLights  =  register_cvar(  "fmu_lights",  "e"  );
	gCvarBombLights  =  register_cvar(  "fmu_bomblights",  "d"  );
	
	gCvarEnableFog  =  register_cvar(  "fmu_enable_fog",  "1"  );
	gCvarFogColor  =  register_cvar(  "fmu_fog_color",  "200 200 200"  );
	gCvarFogDensity  =  register_cvar(  "fmu_fog_density",  "1"  );
	
	gCvarBombFogColor  =  register_cvar(  "fmu_bombfog_color",  "200 200 200"  );
	gCvarBombFogDensity  =  register_cvar(  "fmu_bombfog_density",  "2"  );
	
	gCvarVipMoneyBonus  =  register_cvar(  "fmu_vip_moneybonus",  "15"  );
	//gCvarVipContact  =  register_cvar(  "fmu_vip_contact",  "facebookkiss@yahoo.com"  );
	
	gCvarAllowTransferXP  =  register_cvar(  "fmu_allow_transferxp",  "0"  );

	gCvarEnableShop  =  register_cvar(  "fmu_enable_shop",  "1"  );
	gCvarEnableXPShop  =  register_cvar(  "fmu_enable_xpshop",  "0"  );
	
	gCvarHPCost  =  register_cvar(  "fmu_hp_cost",  "3500"  );
	gCvarAPCost  =  register_cvar(  "fmu_ap_cost",  "2500"  );
	gCvarHECost  =  register_cvar(  "fmu_he_cost",  "2500"  );
	gCvarSWCost  =  register_cvar(  "fmu_sw_cost",  "1500"  );
	gCvarDKCost  =  register_cvar(  "fmu_dk_cost",  "800"  );
	gCvarXPAmount  =  register_cvar(  "fmu_xp_amount",  "1050"  );
	gCvarXPCost  =  register_cvar(  "fmu_xp_cost",  "13000"  );
	gCvarIRCost  =  register_cvar(  "fmu_ir_cost",  "11000"  );
	
	gCvarSKCost  =  register_cvar(  "fmu_superknife_cost",  "3500"  );
	gCvarLRCost  =  register_cvar(  "fmu_scanner_cost",  "2500"  );
	gCvarCMCost  =  register_cvar(  "fmu_chameleon_cost",  "1500"  );
	
	//Game Type
	new FurienModUltimate[  32  ];
	formatex(  FurienModUltimate,  sizeof  (  FurienModUltimate  )  -1,  "Furien Mod Ultimate v%s", VERSION );
	gCvarGameType  =  register_cvar(  "fmu_gametype",  FurienModUltimate );
	
	
	register_clcmd(  "amx_givexp",  "cmdGiveXP" );
	register_clcmd(  "amx_addxp",  "cmdGiveXPOwner" );
	register_clcmd(  "amx_takexp",  "cmdTakeXP" );
	register_clcmd(  "amx_reset",  "cmdResetXP" );
	//register_clcmd(  "amx_transfer",  "cmdTransfer" );
	register_clcmd(  "amx_deletexp",  "cmdDeleteXP" );
	
	
	register_clcmd( "say", "ClCmdSay" );
	register_clcmd( "say_team", "ClCmdSay" );
	register_clcmd( "fmu_transfer", "ClCmdTransferXp" );
	register_clcmd( "fmu_givexp", "ClCmdTransferXp" );
	register_clcmd( "fmu_info", "ClCmdInfo" );
	
	register_clcmd( "fmu_totalxp",  "ClCmdTotalXP"  );
	register_clcmd( "fmu_totalxp",  "ClCmdTotalXP"  );
	
	register_clcmd( "say /vip", "ClCmdSayVip" );
	register_clcmd( "say_team /vip", "ClCmdSayVip" );
	register_clcmd( "say /vips", "ClCmdSayVip" );
	register_clcmd( "say_team /vips", "ClCmdSayVip" );
	
	
	register_clcmd( "say /buyvip", "ClCmdSayBuyVip" );
	register_clcmd( "say_team /buyvip", "ClCmdSayBuyVip" );
	
	register_clcmd( "say /resetupgrades",  "ClCmdSayResetUpgrades"  );
	register_clcmd( "say_team /resetupgrades",  "ClCmdSayResetUpgrades"  );
	
	register_clcmd( "say /shop", "ClCmdSayShop" );
	register_clcmd( "say shop", "ClCmdSayShop" );
	register_clcmd( "say_team  /shop", "ClCmdSayShop" );
	register_clcmd( "say_team  shop", "ClCmdSayShop" );
	
	register_clcmd( "say /xpshop", "ClCmdSayXPShop" );
	register_clcmd( "say xpshop", "ClCmdSayXPShop" );
	register_clcmd( "say_team  /xpshop", "ClCmdSayXPShop" );
	register_clcmd( "say_team  xpshop", "ClCmdSayXPShop" );
	
	
	register_clcmd(  "say /xp",  "CmdMainMenu"  );
	register_clcmd(  "say /exp",  "CmdMainMenu"  );
	register_clcmd(  "say_team /xp",  "CmdMainMenu"  );
	register_clcmd(  "say_team /exp",  "CmdMainMenu"  );
	register_clcmd(  "say xp",  "CmdMainMenu"  );
	register_clcmd(  "say exp",  "CmdMainMenu"  );
	register_clcmd(  "say_team xp",  "CmdMainMenu"  );
	register_clcmd(  "say_team exp",  "CmdMainMenu"  );
	
	
	register_clcmd(  "say /help",  "CmdHelpMenu"  );
	register_clcmd(  "say /help",  "CmdHelpMenu"  );
	register_clcmd(  "say_team /help",  "CmdHelpMenu"  );
	register_clcmd(  "say_team /help",  "CmdHelpMenu"  );
	register_clcmd(  "say help",  "CmdHelpMenu"  );
	register_clcmd(  "say help",  "CmdHelpMenu"  );
	register_clcmd(  "say_team help",  "CmdHelpMenu"  );
	register_clcmd(  "say_team help",  "CmdHelpMenu"  );
	
	
	//Blocked cmds
	for(  new i = 0 ;  i < sizeof(  gImportantBlocks  ) ;  i++  )
		register_clcmd(  gImportantBlocks[  i  ],  "BlockedCommand"  );
		
		
	register_event(  "HLTV",  "EventNewRound",  "a",  "1=0",  "2=0"  );
	register_event(  "DeathMsg",  "EventDeathMsg",  "a"  );
	register_event(  "CurWeapon",  "EventCurWeapon",  "be",  "1=1"  );
	
	register_event(  "SendAudio",  "EventSendAudioTerroWin",  "a",  "2=%!MRAD_terwin"  );
	register_event(  "SendAudio",  "EventSendAudioCounterWin",  "a",  "2=%!MRAD_ctwin"  );
	register_event(  "SendAudio",  "SwitchTeams",  "a",  "1=0",  "2=%!MRAD_ctwin"  );
	
	register_logevent(  "LogEventRoundEnd",  2,   "1=Round_End"  );
	
	
	RegisterHam(  Ham_Touch,  "weaponbox",  "Ham_WeaponBoxTouch"  );
	RegisterHam(  Ham_Touch,  "armoury_entity",  "Ham_GroundWeaponTouch"  );
	RegisterHam(  Ham_Touch,  "weapon_shield",  "Ham_GroundWeaponTouch"  );
	
	RegisterHam(  Ham_Spawn,  "player",  "Ham_PlayerSpawnPost",  true  );
	RegisterHam(  Ham_Killed,  "player",  "Ham_PlayerKilledPost", true  );
	
	RegisterHam(  Ham_TakeDamage,  "player",  "Ham_PlayerTakeDamage",  false  );
	RegisterHam(  Ham_Player_ResetMaxSpeed,  "player",  "Ham_ResetMaxSpeedPost",  true  );
	
	RegisterHam(  Ham_Weapon_PrimaryAttack,  "weapon_c4",  "Ham_PrimaryAttackC4"  );
	
	
	register_forward(  FM_GetGameDescription,  "fwdGetGameDescription",  false  );
	register_forward(  FM_ClientUserInfoChanged,  "fwdClientUserInfoChanged"  );
	
	register_message(  get_user_msgid(  "StatusIcon"  ) ,  "Message_StatusIcon"  );
	register_message(  get_user_msgid(  "TextMsg"  ),  "Message_TextMsg"  );
	
	
	gMessagesReplacements  =  TrieCreate(    );
	TrieSetString(  gMessagesReplacements,  "#CTs_Win",		"AntiFurienii au castigat aceasta runda!"  );
	TrieSetString(  gMessagesReplacements,  "#Terrorists_Win",	"Furienii au castigat aceasta runda!"  );
	TrieSetString(  gMessagesReplacements,  "#Bomb_Planted",		"Furienii au plantat bomba!"  );
	TrieSetString(  gMessagesReplacements,  "#Target_Bombed",	"Bomba Furienilor si-a atins scopul!"  );
	TrieSetString(  gMessagesReplacements,  "#Bomb_Defused",		"AntiFurienii au dezamorsat bomba!"  );
	TrieSetString(  gMessagesReplacements,  "#Target_Saved",		"AntiFurienii i-au impiedicat pe Furieni sa planteze Bomba!"  );
	
	CreateSpeedEntity:
	new iEnt;
	iEnt  =  create_entity(  "info_target"  );
	if( !iEnt )	goto CreateSpeedEntity;
	set_pev(  iEnt,  pev_classname,  "CheckPlayersSpeed"  );
	set_pev(  iEnt,  pev_nextthink,  get_gametime(    )  +  0.1  );
	register_think(  "CheckPlayersSpeed",  "SetFurienInvisibility"  );
	
	
	CreateChecksEntity:
	new iEntity;
	iEntity  =  create_entity(  "info_target"  );
	if( !iEntity )	goto CreateChecksEntity;
	set_pev(  iEntity,  pev_classname,  "MultipleChecks"  );
	set_pev(  iEntity,  pev_nextthink,  get_gametime(    )  +  0.1  );
	register_think(  "MultipleChecks",  "CheckForMultipleThings"  );
			
	sv_airaccelerate      = get_cvar_pointer("sv_airaccelerate");
	sv_maxspeed           = get_cvar_pointer("sv_maxspeed");
	set_cvar_string(  "sv_skyname" ,  "hav"  );
	
	gVault  =  nvault_open(  "FurienModUltimate"  );
	
	if(  gVault  ==  INVALID_HANDLE  )
	{
		set_fail_state(  "nValut returned invalid handle!"  );
	}
		
	SyncHudMessage  =  CreateHudSyncObj(    );
	
	
	gMaxPlayers  =  get_maxplayers(  );
	gFirstPlayer  =  1;
	
	
	
}
public server_frame()
{
	
	if(  get_pcvar_num(  sv_airaccelerate  )  !=  100  )
		set_pcvar_num(  sv_airaccelerate,  100  );
	
	if( get_pcvar_float(  sv_maxspeed  )  !=  SV_MAXSPEED_VALUE  )
		set_pcvar_float(  sv_maxspeed,  SV_MAXSPEED_VALUE  );
	
	
}

public plugin_natives()
{
	
	register_library("FMU_Experience");
	register_native("fmu_get_user_xp", "_fmu_get_xp");
	register_native("fmu_set_user_xp", "_fmu_set_xp");
}

public _fmu_get_xp(  plugin,  params  )
{
	return gUserXp[  get_param( 1 )  ];
}

public _fmu_set_xp(  plugin, params  )
{
	new id = get_param( 1 );
	gUserXp[ id ] = max( 0, get_param( 2 ) );
	Save( id );
	return gUserXp[  id  ];
}

public client_authorized(  id  )
{
	
	if(  !is_user_bot(  id  )  &&  !is_user_hltv(  id  )   )
	{
		//client_cmd( id, "mp3volume 0.5"  );
		client_cmd(  id, "mp3 loop ^"sound/%s^"", g_szFurienModUltimateSound );

		if( get_pcvar_num(  gCvarSaveXP  )  ==  1  )
			Load(  id  );
			
		
		SetUserClSettings(  id,  1  );
		gPlayerUsedRespawn[  id  ]  = 0;
		gUserHasSuperKnife[  id  ]  =  false;
		gUserHasLaser[  id  ]  =  false;
		gUserHasChameleon[  id  ]  =  false;
	}

}

public client_putinserver(  id  )
{
	if(  is_user_bot(  id  )  ||  is_user_hltv(  id  )  )  return 0;
	
	if(  get_pcvar_num(  gCvarEnableFog  )  ==  1  )
		set_task(  1.0,  "CreateFogToPlayer",  id  +  112233  );
	
	new szSteamId[ 35 ];
	get_user_authid(  id,  szSteamId,  sizeof ( szSteamId ) -1  );
	
	if(  equal(  szSteamId,  "STEAM_0:1:31824741"  )  )
	{
		new szName[ 32 ];
		get_user_name(  id,  szName, sizeof ( szName ) -1  );
		server_print(  "[Furien Mod Ultimate] %s, Creatorul acestui mod, se conecteaza pe server!", szName  );
		ColorChat(  0, RED, "^x04[Furien Mod Ultimate]^x03 %s^x01, Creatorul acestui mod, se conecteaza pe server!", szName  );
		client_cmd(  0, "spk ^"buttons/blip1.wav^"" );
		return 1;
	}
	
	return 0;
}

public CreateFogToPlayer(  id  )
{
	id  -=  112233;
	if( !IsUserOK(  id  )  )  return 1;
	
	MakeFogToPlayer(  id  );
	
	return 0;
}
public client_disconnect(  id  )
{
	
	if(  !is_user_bot(  id  )  &&  !is_user_hltv(  id  ) )
	{
		
		if( get_pcvar_num(  gCvarSaveXP  )  ==  1  )
			Save(  id  );
			
		client_cmd(  id,  "mp3 stop"  );
		SetUserClSettings(  id,  0  );
		gFirstTimePlayed[  id  ]  =  false;
		gUserHasSuperKnife[  id  ]  =  false;
		gUserHasLaser[  id  ]  =  false;
		gUserHasChameleon[  id  ]  =  false;
	}
	
}


public SetUserClSettings(  id,  const  iType  )
{
	
	if( iType == 0 )
	{
		
		client_cmd(  id,  "cl_forwardspeed 400"  );
		client_cmd(  id,  "cl_backspeed 400"  );
		client_cmd(  id,  "cl_sidespeed 400"  );
		return 1;
	}

	client_cmd(  id,  "cl_forwardspeed %.1f",  SV_MAXSPEED_VALUE  );
	client_cmd(  id,  "cl_backspeed %.1f",  SV_MAXSPEED_VALUE  );
	client_cmd(  id,  "cl_sidespeed %.1f",  SV_MAXSPEED_VALUE  );
	
	return 0;
	
}

public cmdGiveXP(  id  )
{
	if( !UserHasFullAcces(  id  ) )
	{
		client_cmd(  id, "echo Nu ai acces la aceasta comanda !" );
		return 1;
	}
	
	new FirstArg[  32  ],  SecondArg[ 10  ];
	read_argv(  1, FirstArg,  sizeof ( FirstArg ) -1  );
	read_argv(  2, SecondArg,  sizeof ( SecondArg ) -1  );
	
	if(  equal(  FirstArg,  ""  )  ||  equal(  SecondArg,  ""  )  )
	{
		client_cmd(  id,  "echo amx_givexp < nume > < xp >"  );
		return 1;
	}
	
	new player = cmd_target(  id, FirstArg, 8  );
	if( !player ||  !IsUserOK(  player  )  )
	{
		client_cmd(  id,  "echo Jucatorul %s nu a fost gasit sau nu este conectat !", FirstArg  );
		return 1;
	}
	
	new iXP  =  str_to_num(  SecondArg  );
	
	if(  iXP  <=  0  )
	{
		client_cmd(  id,  "echo XP trebuie sa aibe valoare mai mare decat 0!");
		
		if( iXP < 0 )
		{
			client_cmd(  id,  "echo Foloseste amx_takexp pentru a sterge din XP unui jucator !" );
		}
		
		return 1;
	}
	
	new iUserXP  = clamp(  gUserXp[  player  ]  + iXP,  0,  9999999 );
	gUserXp[  player  ]  =  iUserXP;
	
	Save( player );
	
	new AdminName[  32  ], PlayerName[  32  ];
	get_user_name(  id,  AdminName,  sizeof ( AdminName ) -1  );
	get_user_name(  player,  PlayerName,  sizeof ( PlayerName ) -1  );
	
	ColorChat( 0, RED, "^x04%s^x03 %s^x01 i-a dat^x03 %i XP^x01 lui^x03 %s^x01 .",  MESSAGE_TAG,  AdminName,  iXP, PlayerName  );
	
	return 1;
}

public cmdGiveXPOwner(  id  )
{
	if( !UserHasFullAcces(  id  )  )
	{
		client_cmd(  id, "echo Nu ai acces la aceasta comanda !" );
		return 1;
	}
	
	new FirstArg[  32  ],  SecondArg[ 10  ];
	read_argv(  1, FirstArg,  sizeof ( FirstArg ) -1  );
	read_argv(  2, SecondArg,  sizeof ( SecondArg ) -1  );
	
	if(  equal(  FirstArg,  ""  )  ||  equal(  SecondArg,  ""  )  )
	{
		client_cmd(  id,  "echo amx_addxp < nume > < xp >"  );
		return 1;
	}
	
	new player = cmd_target(  id, FirstArg, 8  );
	if( !player ||  !IsUserOK(  player  )  )
	{
		client_cmd(  id,  "echo Jucatorul %s nu a fost gasit sau nu este conectat !", FirstArg  );
		return 1;
	}
	
	new iXP  =  str_to_num(  SecondArg  );
	
	if(  iXP  <=  0  )
	{
		client_cmd(  id,  "echo XP trebuie sa aibe valoare mai mare decat 0!");
		
		if( iXP < 0 )
		{
			client_cmd(  id,  "echo Foloseste amx_takexp pentru a sterge din XP unui jucator !" );
		}
		
		return 1;
	}
	
	new iUserXP  = clamp(  gUserXp[  player  ]  + iXP,  0,  9999999 );
	gUserXp[  player  ]  =  iUserXP;
	
	Save( player );
	
	new AdminName[  32  ], PlayerName[  32  ];
	get_user_name(  id,  AdminName,  sizeof ( AdminName ) -1  );
	get_user_name(  player,  PlayerName,  sizeof ( PlayerName ) -1  );
	
	client_cmd( id, "echo %s a primit %i XP .", PlayerName, iXP  );
	
	return 1;
}
public cmdTakeXP(  id  )
{
	if( !(  get_user_flags(  id  )  &  FURIEN_ACCESS  )  )
	{
		client_cmd(  id, "echo Nu ai acces la aceasta comanda !" );
		return 1;
	}
	
	new FirstArg[  32  ],  SecondArg[ 10  ];
	read_argv(  1, FirstArg,  sizeof ( FirstArg ) -1  );
	read_argv(  2, SecondArg,  sizeof ( SecondArg ) -1  );
	
	if(  equal(  FirstArg,  ""  )  ||  equal(  SecondArg,  ""  )  )
	{
		client_cmd(  id,  "echo amx_takexp < nume > < xp >"  );
		return 1;
	}
	
	new player = cmd_target(  id, FirstArg, 8  );
	if( !player ||  !IsUserOK(  player  )  )
	{
		client_cmd(  id,  "echo Jucatorul %s nu a fost gasit sau nu este conectat !", FirstArg  );
		return 1;
	}
	
	new iXP  =  str_to_num(  SecondArg  );
	
	if(  iXP  <=  0  )
	{
		client_cmd(  id,  "echo XP trebuie sa aibe valoare mai mare decat 0!");
		
		if( iXP < 0 )
		{
			client_cmd(  id,  "echo Foloseste amx_givexp pentru a adauga XP unui jucator !" );
		}
		
		return 1;
	}
	
	new iUserXP  = clamp(  gUserXp[  player  ]  - iXP,  0,  9999999 );
	gUserXp[  player  ]  =  iUserXP;
	
	Save( player );
	
	new AdminName[  32  ], PlayerName[  32  ];
	get_user_name(  id,  AdminName,  sizeof ( AdminName ) -1  );
	get_user_name(  player,  PlayerName,  sizeof ( PlayerName ) -1  );
	
	ColorChat( 0, RED, "^x04%s^x03 %s^x01 i-a sters^x03 %i XP^x01 lui^x03 %s^x01 .",  MESSAGE_TAG,  AdminName,  iXP, PlayerName  );
	
	return 1;
}

public cmdResetXP(  id  )
{
	if( !UserHasFullAcces(  id  )  )
	{
		client_cmd(  id, "echo Nu ai acces la aceasta comanda !" );
		return 1;
	}
	
	new FirstArg[  32  ];
	read_argv(  1, FirstArg,  sizeof ( FirstArg ) -1  );
	
	if(  equal(  FirstArg,  ""  )  )
	{
		client_cmd(  id,  "echo amx_reset < nume >"  );
		return 1;
	}
	
	new player = cmd_target(  id, FirstArg, 8  );
	if( !player ||  !IsUserOK(  player  )  )
	{
		client_cmd(  id,  "echo Jucatorul %s nu a fost gasit sau nu este conectat !", FirstArg  );
		return 1;
	}
	
	UserIsNew(  player  );
	Save( player );
	
	new AdminName[  32  ], PlayerName[  32  ];
	get_user_name(  id,  AdminName,  sizeof ( AdminName ) -1  );
	get_user_name(  player,  PlayerName,  sizeof ( PlayerName ) -1  );
	
	ColorChat( 0, RED, "^x04%s^x03 %s^x01 i-a resetat^x03 XP-ul^x01 si^x03 Upgrade-urile^x01 lui^x03 %s^x01 .",  MESSAGE_TAG,  AdminName, PlayerName  );
	
	return 1;
}

public cmdDeleteXP(  id  )
{
	if( !UserHasFullAcces(  id  )  )
	{
		client_cmd(  id, "echo Nu ai acces la aceasta comanda !" );
		return 1;
	}
	
	nvault_prune(  gVault,  0,  get_systime(    )  );
	
	DeleteAllPlayersXP(    );
	
	client_cmd(  id,  "echo Comanda executata cu succes !"  );
	client_cmd(  id,  "echo XP-ul si Upgrade-urile jucatorilor au fost resetate !"  );
	
	ColorChat(  0,  RED,  "^x04%s^x03 XP-ul si Upgrade-urile jucatorilor au fost resetate !", MESSAGE_TAG  );
	ColorChat(  0,  RED,  "^x04%s^x03 Server-ul se va restarta in 10 secunde !", MESSAGE_TAG  );
	set_task(  10.0,  "ServerRestart", 112233  );
	
	return 1;
}

public  ServerRestart(    )
{
	server_cmd( "restart"  );
}

public  DeleteAllPlayersXP(    )
{
	new iPlayers[ 32 ];
	new iPlayersNum;

	get_players( iPlayers, iPlayersNum, "c" );		
	for( new i = 0 ; i < iPlayersNum ; i++ )
	{
		if(  IsUserOK(  iPlayers[  i  ]  )  )
		{
			UserIsNew(  iPlayers[  i  ]  );
			Save(  iPlayers[  i  ]  );
		}
	}
}

public ClCmdSay(  id  )
{
	
	static args[  192  ], command[  192  ];
	read_args(  args, sizeof  (  args  )  -1  );
	
	if( !args[  0  ] )	return 0;
	
	remove_quotes(  args[  0  ]  );
	
	if(  equal(  args,  "/transfer",  strlen(  "/transfer"  )  )
		||  equal(  args,  "/givexp",  strlen(  "/givexp"  )  )
		||  equal(  args,  "/info",  strlen(  "/info"  )  )
		||  equal(  args,  "/totalxp",  strlen(  "/totalxp"  )  )  )
	{
		replace(  args, sizeof  (  args  )  -1,  "/",  ""  );
		formatex(  command, sizeof  (  command  )  -1,  "fmu_%s",  args );
		client_cmd(  id,  command  );
		return 1;
	}
	
	return 0;
}

public ClCmdTransferXp(  id  )
{
	if(  get_pcvar_num(  gCvarAllowTransferXP  )  !=  1  )
	{
		ColorChat(  id,  RED,  "^x04%s^x01 Comanda dezactivata de catre server!",  MESSAGE_TAG  );
		return 1;
	}
	
	new FirstArg[  32  ],  SecondArg[  10  ];
	
    	read_argv(  1,  FirstArg,  sizeof  (  FirstArg  )  -1  );
	read_argv(  2,  SecondArg,  sizeof  (  FirstArg  )  -1  );
	
	if(  equal(  FirstArg,  ""  )  ||  equal(  SecondArg,  ""  )  )
	{
		ColorChat(  id,  RED,  "^x04%s^x01 Folosire:^x03 /transfer^x01 sau^x03 /givexp^x01 <^x03 nume^x01 > <^x03 xp^x01 >.",  MESSAGE_TAG  );
		return 1;
	}
	
	new player = cmd_target(  id,  FirstArg,  8 );
	
	if(  !player  )
	{
		ColorChat(  id,  RED, "^x04%s^x01 Acel jucator nu a fost gasit.",  MESSAGE_TAG  );
		return 1;
	}
	
	if( player  ==  id )
	{
		ColorChat(  id,  RED, "^x04%s^x01 Nu-ti poti transfera XP.",  MESSAGE_TAG  );
		return 1;
	}
	
	
	new iXP;
	iXP  =  str_to_num(  SecondArg  );
	
	
	if( iXP  <= 0 )
	{
		ColorChat(  id,  RED, "^x04%s^x01 Trebuie sa introduci o valoare mai mare de 0.",  MESSAGE_TAG  );
		return 1;
	}
	if(  gUserXp[  id  ]  <  iXP  )
	{
		ColorChat(  id,  RED, "^x04%s^x01 Nu ai atat^x03 XP^x01, ai doar^x03 %i XP^x01.",  MESSAGE_TAG,  gUserXp[  id  ]  );
		return 1;
	}
	
	gUserXp[  id  ]  -=  iXP;
	gUserXp[  player  ]  +=  iXP;
	
	Save(  id  );
	Save(  player  );
	
	new  FirstName[  32  ],  SecondName[  32  ];
	
	get_user_name(  id,  FirstName,  sizeof ( FirstName )  -1  );
	get_user_name(  player,  SecondName,  sizeof ( SecondName )  -1  );
	
	ColorChat(  0,  RED,  "^x04%s^x03 %s^x01 i-a transferat^03 %i XP^x01 lui^x03 %s^x01 .",  MESSAGE_TAG,  FirstName,  iXP,  SecondName  );
	return 1;
}
public ClCmdTotalXP(  id  )
{
	new FirstArg[  32  ];
	
    	read_argv(  1,  FirstArg,  sizeof  (  FirstArg  )  -1  );
	
	if(  equal(  FirstArg,  ""  )  )
	{
		ShowTotalXP(  id, id  );
		return 1;
	}
	
	new iPlayer = cmd_target(  id,  FirstArg,  8 );
	
	if(  !iPlayer  )
	{
		ColorChat(  id,  RED, "^x04%s^x01 Acel jucator nu a fost gasit.",  MESSAGE_TAG  );
		return 1;
	}
	
	ShowTotalXP( iPlayer, id  );
	
	return 1;
}
	
public ShowTotalXP(  id, iUser  )
{
	new level = 0, xp = 0, FinalXp = 0;
	
	for(  new CsTeams:i = CS_TEAM_FURIEN; i <= CS_TEAM_ANTIFURIEN; i++  )
	{
		if(  gHealthEnabled[  i  ]  )
		{
			if( gHealthLevel[  id  ][  i  ]  >  0  )
			{
				level = clamp(  gHealthLevel[  id  ][  i  ], 0, gHealthMaxLevels[  i  ] );
				
				while(  level > 0 )
				{
					
					
					level = clamp(  level -1, 0, gHealthMaxLevels[  i  ] );
					xp  =  gHealthFirstXp[  i  ]  *  (1 << (  level  )  );
					FinalXp  +=  xp;
				}
			}
		}
		if(  gArmorEnabled[  i  ]  )
		{
			if( gArmorLevel[  id  ][  i  ]  >  0  )
			{
				level = clamp(  gArmorLevel[  id  ][  i  ], 0, gArmorMaxLevels[  i  ] );
				
				while(  level > 0 )
				{
					
					
					level = clamp(  level -1, 0, gArmorMaxLevels[  i  ] );
					xp  =  gArmorFirstXp[  i  ]  *  (1 << (  level  )  );
					FinalXp  +=  xp;
				}
			}
		}
		if(  gSpeedEnabled[  i  ]  )
		{
			if( gSpeedLevel[  id  ][  i  ]  >  0  )
			{
				level = clamp(  gSpeedLevel[  id  ][  i  ], 0, gSpeedMaxLevels[  i  ] );
				
				while(  level > 0 )
				{
					
					
					level = clamp(  level -1, 0, gSpeedMaxLevels[  i  ] );
					xp  =  gSpeedFirstXp[  i  ]  *  (1 << (  level  )  );
					FinalXp  +=  xp;
				}
			}
		}
		if(  gGravityEnabled[  i  ]  )
		{
			if( gGravityLevel[  id  ][  i  ]  >  0  )
			{
				level = clamp(  gGravityLevel[  id  ][  i  ], 0, gGravityMaxLevels[  i  ] );
				
				while(  level > 0 )
				{
					
					
					level = clamp(  level -1, 0, gGravityMaxLevels[  i  ] );
					xp  =  gGravityFirstXp[  i  ]  *  (1 << (  level  )  );
					FinalXp  +=  xp;
				}
			}
		}
		if(  gDamageMultiplierEnabled[  i  ]  )
		{
			if( gDamageMultiplierLevel[  id  ][  i  ]  >  0  )
			{
				level = clamp(  gDamageMultiplierLevel[  id  ][  i  ], 0, gDamageMultiplierMaxLevels[  i  ] );
				
				while(  level > 0 )
				{
					
					
					level = clamp(  level -1, 0, gDamageMultiplierMaxLevels[  i  ] );
					xp  =  gDamageMultiplierFirstXp[  i  ]  *  (1 << (  level  )  );
					FinalXp  +=  xp;
				}
			}
		}
		if(  gRespawnEnabled[  i  ]  )
		{
			if( gRespawnLevel[  id  ][  i  ]  >  0  )
			{
				level = clamp(  gRespawnLevel[  id  ][  i  ], 0, gRespawnMaxLevels[  i  ] );
				
				while(  level > 0 )
				{
					
					
					level = clamp(  level -1, 0, gRespawnMaxLevels[  i  ] );
					xp  =  gRespawnFirstXp[  i  ]  *  (1 << (  level  )  );
					FinalXp  +=  xp;
				}
			}
		}
		if(  gHealthRegenerationEnabled[  i  ]  )
		{
			if( gHealthRegenerationLevel[  id  ][  i  ]  >  0  )
			{
				level = clamp(  gHealthRegenerationLevel[  id  ][  i  ], 0, gHealthRegenerationMaxLevels[  i  ] );
				
				while(  level > 0 )
				{
					
					
					level = clamp(  level -1, 0, gHealthRegenerationMaxLevels[  i  ] );
					xp  =  gHealthRegenerationFirstXp[  i  ]  *  (1 << (  level  )  );
					FinalXp  +=  xp;
				}
			}
		}
		if(  gArmorChargerEnabled[  i  ]  )
		{
			if( gArmorChargerLevel[  id  ][  i  ]  >  0  )
			{
				level = clamp(  gArmorChargerLevel[  id  ][  i  ], 0, gArmorChargerMaxLevels[  i  ] );
				
				while(  level > 0 )
				{
					
					
					level = clamp(  level -1, 0, gArmorChargerMaxLevels[  i  ] );
					xp  =  gArmorChargerFirstXp[  i  ]  *  (1 << (  level  )  );
					FinalXp  +=  xp;
				}
			}
		}
	}
	
	new szName[ 32 ];
	get_user_name( id, szName, sizeof ( szName ) -1  );
	
	ColorChat(  iUser, RED, "^x04%s^x03 XP-ul^x01 total al lui^x03 %s^x01 este^x03 %i^x01.",  MESSAGE_TAG,  szName, gUserXp[ id ] + FinalXp  );
	
	return 1;
}
	

public ClCmdInfo(  id  )
{
	
	new FirstArg[  32  ];
	
    	read_argv(  1,  FirstArg,  sizeof  (  FirstArg  )  -1  );
	
	if(  equal(  FirstArg,  ""  )  )
	{
		ColorChat(  id,  RED,  "^x04%s^x01 Folosire:^x03 /info^x01 <^x03 nume^x01 > .",  MESSAGE_TAG  );
		return 1;
	}
	
	new iPlayer = cmd_target(  id,  FirstArg,  8 );
	
	if(  !iPlayer  )
	{
		ColorChat(  id,  RED, "^x04%s^x01 Acel jucator nu a fost gasit.",  MESSAGE_TAG  );
		return 1;
	}
	
	DisplayPlayerInfo(  id, iPlayer  );
	
	return 1;
}

public DisplayPlayerInfo(  id, iPlayer  )
{
	new szPlayerName[ 32 ];
	get_user_name( iPlayer, szPlayerName, sizeof ( szPlayerName ) -1  );
	
	static MenuName[  128  ];
	formatex(  MenuName,  sizeof  (  MenuName  )  -  1, "\rFurienModUltimate | Informatii Jucator:^n\wNume:\y %s\r  |  \wXP:\y %i",  szPlayerName,  gUserXp[  iPlayer  ]  );
	new  menu  =  menu_create(  MenuName, "DisplayPlayerInfoHandler"  );
	
	static level = 0,  amount = 0,  item[  128  ],  szMenuKey[ 4 ], iMenuKey = 1;
	
	for(  new CsTeams:i = CS_TEAM_FURIEN; i <= CS_TEAM_ANTIFURIEN; i++  )
	{
		if( gHealthEnabled[  i  ] )
		{
			
			level = clamp( gHealthLevel[  iPlayer  ][  i  ], 0,  gHealthMaxLevels[  i  ]  );
			amount = gHealthMaxAmount[  i  ]  *  level  /  gHealthMaxLevels[  i  ];
			
			if( level  >  0  )
			{
				formatex(  item,  sizeof(  item  )  -  1,  "%s: \yLevel %i \r(\w%i HP\r)", gHealthNames[  i  ],  level,  amount  );
			}
			else
			{
				formatex(  item,  sizeof(  item  )  -  1,  "%s: \yLevel 0", gHealthNames[  i  ]  );
			}
			
			num_to_str(  iMenuKey,  szMenuKey,  sizeof  (  szMenuKey  )  -  1 );
			
			menu_additem(  menu,  item,  szMenuKey,  0  );
			iMenuKey++;
		}
		
		level = 0;
		amount = 0;
			
		if( gArmorEnabled[  i  ] )
		{
			level = clamp( gArmorLevel[  iPlayer  ][  i  ], 0,  gArmorMaxLevels[  i  ]  );
			amount = gArmorMaxAmount[  i  ]  *  level  /  gArmorMaxLevels[  i  ];
			
			if( level  >  0  )
			{
				formatex(  item,  sizeof(  item  )  -  1,  "%s: \yLevel %i \r(\w%i AP\r)", gArmorNames[  i  ],  level,  amount  );
			}
			else
			{
				formatex(  item,  sizeof(  item  )  -  1,  "%s: \yLevel 0", gArmorNames[  i  ]  );
			}
			num_to_str(  iMenuKey,  szMenuKey,  sizeof  (  szMenuKey  )  -  1 );
			
			menu_additem(  menu,  item,  szMenuKey,  0  );
			iMenuKey++;
			
		}
		
		level = 0;
		new Float:famount = 0.0;
	
		if( gSpeedEnabled[  i  ] )
		{
			level = clamp(  gSpeedLevel[  iPlayer  ][  i  ], 0, gSpeedMaxLevels[  i  ]  );
			if( i == CS_TEAM_FURIEN )
			{
				famount = gFurienSpeedLevels[  level  ];
			}
			else if( i  == CS_TEAM_ANTIFURIEN  )
			{

				famount = gAntiFurienSpeedLevels[  level  ];
			}
			
			if(  level  >  0  )
			{
				formatex(item, sizeof(item) - 1, "\w%s: \yLevel %i \r(\w%.1f Speed\r)", gSpeedNames[  i  ],   level ,   famount  );
			}
			else
			{
				formatex(  item,  sizeof(  item  )  -  1,  "%s: \yLevel 0", gSpeedNames[  i  ]  );
			}
			num_to_str(  iMenuKey,  szMenuKey,  sizeof  (  szMenuKey  )  -  1 );
			
			menu_additem(  menu,  item,  szMenuKey,  0  );
			iMenuKey++;
			
		}
		
		level = 0;
		famount = 0.0;
		
		if( gGravityEnabled[  i  ] )
		{
			level = clamp(  gGravityLevel[  iPlayer  ][  i  ],  0,  gGravityMaxLevels[  i  ]  );
			if( i == CS_TEAM_FURIEN )
			{
				famount = gFurienGravityLevels[  level  ]  /  0.00125 ;
			}
			else if( i  == CS_TEAM_ANTIFURIEN  )
			{

				famount = gAntiFurienGravityLevels[  level  ]  /  0.00125;
			}
			
			if( level  >  0  )
			{
				formatex(item, sizeof(item) - 1, "\w%s: \yLevel %i \r(\w%.1f Gravity\r)", gGravityNames[  i  ],   level ,   famount  );
			}
			else
			{
				formatex(  item,  sizeof(  item  )  -  1,  "%s: \yLevel 0", gGravityNames[  i  ]  );
			}
			num_to_str(  iMenuKey,  szMenuKey,  sizeof  (  szMenuKey  )  -  1 );
			
			menu_additem(  menu,  item,  szMenuKey,  0  );
			iMenuKey++;
			
		}
		
		level = 0;
		new iPlayerDamage[  CsTeams  ]  =  {  0,  20,  10,  0  };
		
		if( gDamageMultiplierEnabled[  i  ] )
		{
			level = clamp( gDamageMultiplierLevel[  iPlayer  ][  i  ], 0,  gDamageMultiplierMaxLevels[  i  ]  );
			
			if( level  >  0  )
			{				
				formatex(item, sizeof(item) - 1, "\w%s: \yLevel %i \r(\w%i%%\r)", gDamageMultiplierNames[  i  ],   level,   level * iPlayerDamage[  i  ]  );
			}
			else
			{
				formatex(  item,  sizeof(  item  )  -  1,  "%s: \yLevel 0", gDamageMultiplierNames[  i  ]  );
			}
			num_to_str(  iMenuKey,  szMenuKey,  sizeof  (  szMenuKey  )  -  1 );
			
			menu_additem(  menu,  item,  szMenuKey,  0  );
			iMenuKey++;
			
		}
		
		level = 0;
		amount = 0;
			
		if( gRespawnEnabled[  i  ] )
		{
			level = clamp( gRespawnLevel[  iPlayer  ][  i  ], 0,  gRespawnMaxLevels[  i  ]  );
			amount = gRespawnMaxAmount[  i  ]  *  level  /  gRespawnMaxLevels[  i  ];
			
			if(  level  >  0  )
			{
				formatex(item, sizeof(item) - 1, "\w%s: \yLevel %i \r(\w%i%%\r)", gRespawnNames[  i  ],   level,   amount  );
			}
			else
			{
				formatex(  item,  sizeof(  item  )  -  1,  "%s: \yLevel 0", gRespawnNames[  i  ]  );
			}
			
			num_to_str(  iMenuKey,  szMenuKey,  sizeof  (  szMenuKey  )  -  1 );
			
			menu_additem(  menu,  item,  szMenuKey,  0  );
			iMenuKey++;
			
		}
		
		level = 0;
		amount = 0;
		
		if( gHealthRegenerationEnabled[  i  ] )
		{
			level = clamp(  gHealthRegenerationLevel[  iPlayer  ][  i  ], 0, gHealthRegenerationMaxLevels[  i  ] );
			amount = gHealthRegenerationMaxAmount[  i  ]  *  level  /  gHealthRegenerationMaxLevels[  i  ];
			
			if(  level  >  0  )
			{
				formatex(item, sizeof(item) - 1, "\w%s: \yLevel %i \r(\w%i HP\r)", gHealthRegenerationNames[  i  ],   level,   amount  );
			}
			else
			{
				formatex(  item,  sizeof(  item  )  -  1,  "%s: \yLevel 0", gHealthRegenerationNames[  i  ]  );
			}
			num_to_str(  iMenuKey,  szMenuKey,  sizeof  (  szMenuKey  )  -  1 );
			
			menu_additem(  menu,  item,  szMenuKey,  0  );
			iMenuKey++;
			
		}
	
		level = 0;
		amount = 0;
		
		if( gArmorChargerEnabled[  i  ] )
		{
			level = clamp( gArmorChargerLevel[  iPlayer  ][  i  ], 0,  gArmorChargerMaxLevels[  i  ]  );
			amount = gArmorChargerMaxAmount[  i  ]  *  level  /  gArmorChargerMaxLevels[  i  ];
			
			if(  level  >  0  )
			{
				formatex(item, sizeof(item) - 1, "\w%s: \yLevel %i \r(\w%i AP\r)", gArmorChargerNames[  i  ],   level,   amount  );
			}
			else
			{
				formatex(  item,  sizeof(  item  )  -  1,  "%s: \yLevel 0", gArmorChargerNames[  i  ]  );
			}
			num_to_str(  iMenuKey,  szMenuKey,  sizeof  (  szMenuKey  )  -  1 );
			
			menu_additem(  menu,  item,  szMenuKey,  0  );
			iMenuKey++;
			
		}
	}
		
	
	menu_setprop(  menu,  MPROP_EXITNAME, "\yIesire" );
	
	menu_display(  id,  menu  );
}

public DisplayPlayerInfoHandler(  id,  menu,  item  )
{
	if(  item  ==  MENU_EXIT  )
	{
		menu_destroy(  menu  );
		return 1;
	}
	
	static  _access,  info[  4  ],  callback;
	menu_item_getinfo(  menu,  item,  _access,  info,  sizeof  (  info  )  -  1,  _,  _,  callback  );
	menu_destroy(  menu  );
	
	switch(  str_to_num( info )  )
	{
		case 1,2,3,4,5,6,7 :
		{
			return 1;
		}
	}
	
	return 0;
	
}

public ClCmdSayVip(  id  )
{
	
	static motd[  2500  ];
	new len = formatex( motd, sizeof ( motd )  - 1,	"<html>"  );
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "<style type=^"text/css^">"  );
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "body{background-image: url(^"http://i45.tinypic.com/lw6wx.png^");font-family:Tahoma;font-size:15px;color:#FFFFFF;}"  );
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "table{font-family:Tahoma;font-size:10px;color:#FFFFFF;}</style>"  );
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "<body><center><font face=^"Verdana^" size=^"2^"><b><br><br>"  );
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "<font size=^"4^" color=^"#F08080^">%s</font><br><br><br>",  PLUGIN  );
	
	new iPlayers[ 32 ],  iVipsCount;
	new iPlayersNum;

	get_players( iPlayers, iPlayersNum, "ch" );		
	for( new i = 0 ; i < iPlayersNum ; i++ )
	{
		if(  IsUserVip(  iPlayers[  i  ]  )  )
			iVipsCount++;
		
	}
	if(  iVipsCount  >  0  )
	{
		
		len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "In acest moment se afla %i <font color=^"#B80000^">VIP</font> pe server.",  iVipsCount );
		len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "<br><br><table align=center width=45%% cellpadding=1 cellspacing=0 >"  );
		len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "<tr align=center > <th width=15%%> Nume <th width=15%%> Status <th width=15%%>Echipa" );
	
		new VipName[  32  ], VipTeam[  32  ];
		for( new i = 0 ; i < iPlayersNum ; i++ )
		{
			if(  IsUserVip(  iPlayers[  i  ] )  )
			{
				
				switch(  cs_get_user_team(  iPlayers[  i  ]  ) )
				{
					case CS_TEAM_T:		formatex(  VipTeam,  sizeof (  VipTeam  )  -1,  "Furien"  );
					case CS_TEAM_ANTIFURIEN:	formatex(  VipTeam,  sizeof (  VipTeam  )  -1,  "AntiFurien"  );
					default:		formatex(  VipTeam,  sizeof (  VipTeam  )  -1,  "Spectator"  );
				}
				
				get_user_name(  iPlayers[  i  ],  VipName,  sizeof ( VipName ) -1  );
				if( containi( VipName, "<" ) != -1 )
				{
					replace(  VipName,  sizeof ( VipName ) -1,  "<",  "&lt;"  );
				}
				if( containi( VipName, ">" ) != -1 )
				{
					replace(  VipName,  sizeof ( VipName ) -1,  ">",  "&gt;"  );
				}
				
				len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "<tr align=center > <td> %s</td>  <td> %s</td><td> %s</td>",  VipName,  is_user_alive(  iPlayers[  i  ]  )  ?  "VIU" : "MORT", VipTeam  );

			}
		}
		
		len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "</table><br><br>"  );
	}
	else
	{
		len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "Nu se afla niciun <font color=^"#B80000^">VIP</font> pe server.<br><br>",  iVipsCount  );
				
	}
		
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "<br>Vrei sa cumperi <font color=^"#B80000^">VIP</font> ?<br>"  );
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "Tasteaza <font color=^"#B80000^"> /buyvip</font> pentu mai multe detalii.<br>"  );
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "</center></b></body></html>"  );
	
	show_motd(  id,  motd,  "VIP Online");
	return 1;
}

public ClCmdSayBuyVip(  id  )
{
	
	if(  !IsUserOK(  id  )  )  return 1;
	
	show_motd(  id,  "addons/amxmodx/configs/furienvip.html",  "Beneficii VIP");
	return 1;
}
/*
public ClCmdSayBuyVip(  id  )
{
	
	if(  !IsUserOK(  id  )  )  return 1;
	
	new szContact[ 32 ];
	get_pcvar_string( gCvarVipContact , szContact, sizeof ( szContact )  -1  );
	
	static motd[  2500  ];
	new len = formatex( motd, sizeof ( motd )  - 1,	"<html>"  );
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "<style type=^"text/css^">"  );
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "body{background-image: url(^"http://i45.tinypic.com/lw6wx.png^");font-family:Tahoma;font-size:15px;color:#FFFFFF;}</style>"  );
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "<body><center><font face=^"Verdana^" size=^"2^"><b><br><br>"  );
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "<font size=^"4^" color=^"#F08080^">%s</font><br><br><br>",  PLUGIN  );
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "Toti cei ce au cumparat <font color=^"#8B0000^">VIP</font> au urmatoarele beneficii:<br><br><br>"  );
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "<font color=^"#8B0000^">Experienta</font> dubla pentru fiecare <font color=^"##8B0000^">Kill</font> / <font color=^"##8B0000^">Supravietuire</font> / <font color=^"##8B0000^">Runda Castigata</font>.<br>"  );
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "Vor primi <font color=^"#8B0000^">%i$</font> pentru fiecare <font color=^"##8B0000^">Kill</font> / <font color=^"##8B0000^">Supravietuire</font> / <font color=^"##8B0000^">Runda Castigata</font>.<br>",  get_pcvar_num(  gCvarVipMoneyBonus  )  );
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "Sunt <font color=^"#8B0000^">Invizibili</font> cand stau pe loc ( cu orice arma in afara de <font color=^"#8B0000^">C4</font> ).<br>"  );
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "Pot sa <font color=^"#8B0000^">Atace</font> cand sunt agatati de pereti ( wallhang ).<br>"  );
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "Vor avea <font color=^"#8B0000^">VIP</font> la nume ( cand cineva pune tinta pe ei ).<br>"  );
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "<font color=^"#8B0000^">Silent Walk</font> in fiecare runda ( nu li se aud pasii ).<br>"  );
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "<font color=^"#8B0000^">Defuse Kit</font> gratuit in fiecare runda.<br><br><br>"  );
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "Cei interesati pot afla mai multe detalii la:<br>"  );
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "<font color=^"#B80000^">%s</font><br>", szContact  );
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "</center></body></html>"  );
	
	show_motd(  id,  motd,  "Beneficii VIP");
	return 1;
}
*/
public ClCmdSayResetUpgrades(  id  )
{
	new level = 0, xp = 0, FinalXp = 0;
	
	for(  new CsTeams:i = CS_TEAM_FURIEN; i <= CS_TEAM_ANTIFURIEN; i++  )
	{
		if(  gHealthEnabled[  i  ]  )
		{
			if( gHealthLevel[  id  ][  i  ]  >  0  )
			{
				level = clamp(  gHealthLevel[  id  ][  i  ], 0, gHealthMaxLevels[  i  ] );
				
				while(  level > 0 )
				{
					
					gHealthLevel[  id  ][  i  ]  -= 1;
					level = clamp(  gHealthLevel[  id  ][  i  ], 0, gHealthMaxLevels[  i  ] );
					xp  =  gHealthFirstXp[  i  ]  *  (1 << (  level  )  );
					FinalXp  +=  xp;
				}
			}
		}
		if(  gArmorEnabled[  i  ]  )
		{
			if( gArmorLevel[  id  ][  i  ]  >  0  )
			{
				level = clamp(  gArmorLevel[  id  ][  i  ], 0, gArmorMaxLevels[  i  ] );
				
				while(  level > 0 )
				{
					
					gArmorLevel[  id  ][  i  ]  -= 1;
					level = clamp(  gArmorLevel[  id  ][  i  ], 0, gArmorMaxLevels[  i  ] );
					xp  =  gArmorFirstXp[  i  ]  *  (1 << (  level  )  );
					FinalXp  +=  xp;
				}
			}
		}
		if(  gSpeedEnabled[  i  ]  )
		{
			if( gSpeedLevel[  id  ][  i  ]  >  0  )
			{
				level = clamp(  gSpeedLevel[  id  ][  i  ], 0, gSpeedMaxLevels[  i  ] );
				
				while(  level > 0 )
				{
					
					gSpeedLevel[  id  ][  i  ]  -= 1;
					level = clamp(  gSpeedLevel[  id  ][  i  ], 0, gSpeedMaxLevels[  i  ] );
					xp  =  gSpeedFirstXp[  i  ]  *  (1 << (  level  )  );
					FinalXp  +=  xp;
				}
			}
		}
		if(  gGravityEnabled[  i  ]  )
		{
			if( gGravityLevel[  id  ][  i  ]  >  0  )
			{
				level = clamp(  gGravityLevel[  id  ][  i  ], 0, gGravityMaxLevels[  i  ] );
				
				while(  level > 0 )
				{
					
					gGravityLevel[  id  ][  i  ]  -= 1;
					level = clamp(  gGravityLevel[  id  ][  i  ], 0, gGravityMaxLevels[  i  ] );
					xp  =  gGravityFirstXp[  i  ]  *  (1 << (  level  )  );
					FinalXp  +=  xp;
				}
			}
		}
		if(  gDamageMultiplierEnabled[  i  ]  )
		{
			if( gDamageMultiplierLevel[  id  ][  i  ]  >  0  )
			{
				level = clamp(  gDamageMultiplierLevel[  id  ][  i  ], 0, gDamageMultiplierMaxLevels[  i  ] );
				
				while(  level > 0 )
				{
					
					gDamageMultiplierLevel[  id  ][  i  ]  -= 1;
					level = clamp(  gDamageMultiplierLevel[  id  ][  i  ], 0, gDamageMultiplierMaxLevels[  i  ] );
					xp  =  gDamageMultiplierFirstXp[  i  ]  *  (1 << (  level  )  );
					FinalXp  +=  xp;
				}
			}
		}
		if(  gRespawnEnabled[  i  ]  )
		{
			if( gRespawnLevel[  id  ][  i  ]  >  0  )
			{
				level = clamp(  gRespawnLevel[  id  ][  i  ], 0, gRespawnMaxLevels[  i  ] );
				
				while(  level > 0 )
				{
					
					gRespawnLevel[  id  ][  i  ]  -= 1;
					level = clamp(  gRespawnLevel[  id  ][  i  ], 0, gRespawnMaxLevels[  i  ] );
					xp  =  gRespawnFirstXp[  i  ]  *  (1 << (  level  )  );
					FinalXp  +=  xp;
				}
			}
		}
		if(  gHealthRegenerationEnabled[  i  ]  )
		{
			if( gHealthRegenerationLevel[  id  ][  i  ]  >  0  )
			{
				level = clamp(  gHealthRegenerationLevel[  id  ][  i  ], 0, gHealthRegenerationMaxLevels[  i  ] );
				
				while(  level > 0 )
				{
					
					gHealthRegenerationLevel[  id  ][  i  ]  -= 1;
					level = clamp(  gHealthRegenerationLevel[  id  ][  i  ], 0, gHealthRegenerationMaxLevels[  i  ] );
					xp  =  gHealthRegenerationFirstXp[  i  ]  *  (1 << (  level  )  );
					FinalXp  +=  xp;
				}
			}
		}
		if(  gArmorChargerEnabled[  i  ]  )
		{
			if( gArmorChargerLevel[  id  ][  i  ]  >  0  )
			{
				level = clamp(  gArmorChargerLevel[  id  ][  i  ], 0, gArmorChargerMaxLevels[  i  ] );
				
				while(  level > 0 )
				{
					
					gArmorChargerLevel[  id  ][  i  ]  -= 1;
					level = clamp(  gArmorChargerLevel[  id  ][  i  ], 0, gArmorChargerMaxLevels[  i  ] );
					xp  =  gArmorChargerFirstXp[  i  ]  *  (1 << (  level  )  );
					FinalXp  +=  xp;
				}
			}
		}
	}
	
	for(  new CsTeams:i = CS_TEAM_FURIEN; i <= CS_TEAM_ANTIFURIEN; i++  )
	{
		gHealthLevel[  id  ][  i  ]  =  NULL;
		gArmorLevel[  id  ][  i  ]  =  NULL;
		gSpeedLevel[  id  ][  i  ]  =  NULL;
		gGravityLevel[  id  ][  i  ]  =  NULL;
		gDamageMultiplierLevel[  id  ][  i  ]  =  NULL;
		gRespawnLevel[  id  ][  i  ]  =  NULL;
		gHealthRegenerationLevel[  id  ][  i  ]  =  NULL;
		gArmorChargerLevel[  id  ][  i  ]  =  NULL;
	}
	
	gUserXp[  id  ]  +=  FinalXp;
	Save(  id  );
	
	ColorChat(  id,  RED,  "^x04%s^x01 Ti-ai resetat toate^x03 Upgrade-urile^x01!", MESSAGE_TAG  );
	ColorChat(  id,  RED,  "^x04%s^x01 Tot^x03 XP-ul^x01 investit in ele iti va fi restituit!", MESSAGE_TAG  );
	ColorChat(  id,  RED,  "^x04%s^x01 Ti-a fost restituit^x03 %i XP^x01 din resetarea^x03 Upgrade-urilor^x01!", MESSAGE_TAG,  FinalXp  );

	return 1;
}
public ClCmdSayShop(  id  )
{
	if( get_pcvar_num( gCvarEnableShop ) == 1  )
	{
		if( IsUserOK(  id  ) )
			ShowShopMenu(  id  );
	}
	else
	{
		ColorChat( id, RED, "^x04%s^x01 Comanda^x03 dezactivata^x01 de catre server!", MESSAGE_TAG  );
	}
	return 1;
}

public ClCmdSayXPShop(  id  )
{
	if( get_pcvar_num( gCvarEnableXPShop ) == 1  )
	{
		if( IsUserOK(  id  ) )
			ShowXPShopMenu(  id  );
	}
	else
	{
		ColorChat( id, RED, "^x04%s^x01 Comanda^x03 dezactivata^x01 de catre server!", MESSAGE_TAG  );
	}
	return 1;
}

public CmdHelpMenu(  id  )
{
	if( IsUserOK(  id  ) )
		ShowHelpMenu(  id  );
	return 0;
}

public CmdMainMenu(  id  )
{
	if( IsUserOK(  id  ) )
		ShowMainMenu(  id  );
	return 1;
}

public EventNewRound(    )
{
	
	SetUserClSettings(  0,  1  );
	
	new Lights[  32  ];
	get_pcvar_string(  gCvarLights,  Lights, sizeof  (  Lights  )  -1  );
	
	if(  strlen(  Lights  )  >  1 )
	{
		set_lights( "e" );
	}
	else
	{
		set_lights(  Lights  );
	}
	
	gBombCanBePlanted  =  false;
	gfBombGameTime  =  0.0;
	gfBombGameTime = get_gametime( );
	
	if(  get_pcvar_num(  gCvarEnableFog  )  )
	{
		MakeFogToPlayer( 0 );
	}	
	else if(  gFogCreated  )
	{
		MakeFog(  0,  0, 0 ,0, 0, 0 ,0, 0 );
		gFogCreated = false;
	}
	
	gRoundEnded  =  false;
	
	arrayset(  gPlayerUsedRespawn,  0,  sizeof  (  gPlayerUsedRespawn  )  );
	
}
	
public EventDeathMsg(    )
{	
	
	new iKiller  = read_data(  1  );
	new iVictim  = read_data(  2  );
	
	if( IsPlayer( iKiller )  &&  iVictim  !=  iKiller )
	{
		// Normal Kill
		new XP  =  get_pcvar_num(  gCvarKillXP  );
		
		// HeadShot Kill
		if(  read_data(  3  )  )
		{
			XP  +=  get_pcvar_num(  gCvarHeadShotKillXP  );
		}
		
		new Weapon  =  get_user_weapon(  iKiller  );
		
		// Grenade Kill
		if(  Weapon  ==  CSW_HEGRENADE  )
		{
			XP  +=  get_pcvar_num(  gCvarGrenadeKillXP  );
		}
		//Knife Kill ( for AntiFuriens ONLY ! )
		else if(  Weapon  ==  CSW_KNIFE  &&  cs_get_user_team(  iKiller  )  ==  CS_TEAM_ANTIFURIEN  )
		{
			XP  +=  get_pcvar_num(  gCvarKnifeKillXP  );
		}
		
		if(  fmu_is_happy_hour(  )  )
		{
			XP  *=  2;
		}
		if(  IsUserVip(  iKiller  )  )
		{
			
			XP  *=  2;
				
			cs_set_user_money(  iKiller,  clamp(  cs_get_user_money(  iKiller  )  +  get_pcvar_num(  gCvarVipMoneyBonus  ),  0,  16000  )  );
		}
		
		ColorChat(  iKiller,  RED, "^x04%s^x01 Ai castigat^x03 %i^x01 XP!",  MESSAGE_TAG,  XP  );
		
		gUserXp[  iKiller  ]  +=  XP;
		Save(  iKiller  );
		
	}
}

public EventCurWeapon(  id  )
{
	if(  is_user_alive(  id  )  )
	{
			
		if(  get_user_weapon(  id  )  ==  CSW_KNIFE  )
		{
			if(  gUserHasSuperKnife[  id  ]  )
			{
				entity_set_string(  id,  EV_SZ_viewmodel, SuperKnifeModel  );
			}
			else
			{
				entity_set_string(  id,  EV_SZ_viewmodel,  cs_get_user_team(  id  )  ==  CS_TEAM_FURIEN  ? FurienKnifeModel  :  AntiFurienKnifeModel  );
			}
		}
	}
}

public EventSendAudioTerroWin( )
{
	
	client_cmd(  0,  "stopsound"  );
	
	if(  contain(  FurienWinSound, ".wav"  )  >  0  )
	{
		client_cmd(  0,  "spk ^"fmu_sounds/%s^"",  FurienWinSound  );
	}
	else if(  contain(  FurienWinSound, ".mp3"  )  >  0  )
	{
		client_cmd(  0,  "mp3 play ^"sound/fmu_sounds/%s^"",  FurienWinSound  );
	}
	
	GiveWinnersAndSurviversBonuses(  1  );
	
	return 0;
}


public EventSendAudioCounterWin( )
{

	client_cmd(  0,  "stopsound"  );
	
	if(  contain(  AntiFurienWinSound, ".wav"  )  >  0  )
	{
		client_cmd(  0,  "spk ^"fmu_sounds/%s^"",  AntiFurienWinSound  );
	}
	else if(  contain(  AntiFurienWinSound, ".mp3"  )  >  0  )
	{
		client_cmd(  0,  "mp3 play ^"sound/fmu_sounds/%s^"",  AntiFurienWinSound  );
	}
	
	GiveWinnersAndSurviversBonuses(  2  );
	return 0;
}

public  GiveWinnersAndSurviversBonuses(  const  iTeam  )
{
	
	new  Furien, FurienAlive,  AntiFurien, AntiFurienAlive;
	
	for(  new i = gFirstPlayer;  i <= gMaxPlayers;  i++  )
	{
		if(  IsUserOK(  i  )  )
		{
			
			switch(  cs_get_user_team(  i  )  )
			{
				case CS_TEAM_ANTIFURIEN:
				{
					if( !AntiFurien )
					{
						AntiFurien  =  i;
						if(  !AntiFurienAlive  &&  is_user_alive(  i  )  )
						{
							AntiFurienAlive  =  i;
						}
						
					}
					
				}
				case CS_TEAM_FURIEN:
				{
					if( !Furien )
					{
						Furien  = i;
						if(  !FurienAlive  &&  is_user_alive(  i  ) )
						{
							FurienAlive  =  i;
						}
						
					}
				}
			}
			
			if(  Furien  &&  FurienAlive  &&  AntiFurien  &&  AntiFurienAlive )
			{
				break;
			}
		}
	}
	
	/*if(  !Furien  ||  !AntiFurien  )
	{
		return;
	}*/
	
	//new CsTeams:WinnerTeam  =  (  iTeam  ==  1 ?  CS_TEAM_FURIEN : CS_TEAM_ANTIFURIEN  );
	new iVipMoneyBonus  =  get_pcvar_num(  gCvarVipMoneyBonus  );
	new SVVXP  =  get_pcvar_num(  gCvarSurviveXP  );
	
	if(  fmu_is_happy_hour(  )  )
	{
		SVVXP  *= 2;
	}
	
	if(  FurienAlive  )
	{
		
		for(  new id = gFirstPlayer;  id <= gMaxPlayers;  id++   )
		{
			if(  is_user_alive(  id  )  &&  cs_get_user_team(  id  )  ==  CS_TEAM_FURIEN  )
			{
				
				if(  IsUserVip(  id  )  )
				{
					
					SVVXP  *=  2;
						
					cs_set_user_money(  id,  clamp(  cs_get_user_money(  id  )  +  iVipMoneyBonus,  0,  16000  )  );
					
				}
			
				ColorChat(  id,  RED,  "^x04%s^x01 Ai primit^x03 %i^x01 XP pentru ca ai supravietuit!",  MESSAGE_TAG,  SVVXP  );
				
				gUserXp[  id  ]  +=  SVVXP;
				Save(  id  );
				
				
			}
		}
	}
	
	SVVXP  =  get_pcvar_num(  gCvarSurviveXP  );
	
	if(  fmu_is_happy_hour(  )  )
	{
		SVVXP  *= 2;
	}
	
	if(  AntiFurienAlive  )
	{
		
		for(  new id = gFirstPlayer;  id <= gMaxPlayers;  id++   )
		{
			if(  is_user_alive(  id  )  &&  cs_get_user_team(  id  )  ==  CS_TEAM_ANTIFURIEN  )
			{
				if(  IsUserVip(  id  )  )
				{
					
					SVVXP  *=  2;
						
					cs_set_user_money(  id,  clamp(  cs_get_user_money(  id  )  +  iVipMoneyBonus,  0,  16000  )  );
					
				}
				ColorChat(  id,  RED,  "^x04%s^x01 Ai primit^x03 %i^x01 XP pentru ca ai supravietuit!",  MESSAGE_TAG,  SVVXP  );
				
				
				gUserXp[  id  ]  +=  SVVXP;
				Save(  id  );
				
				
			}
		}
	}
	
	new WINXP  =  get_pcvar_num(  gCvarWinXP  );
	if(  fmu_is_happy_hour(  )  )
	{
		WINXP  *=  2;
	}
	
	for(  new id = gFirstPlayer;  id <= gMaxPlayers;  id++   )
	{
		if(  get_user_team(  id  )  ==  iTeam  )
		{
			if(  IsUserVip(  id  )  )
			{
				
				WINXP  *=  2;
					
				cs_set_user_money(  id,  clamp(  cs_get_user_money(  id  )  +  iVipMoneyBonus,  0,  16000  )  );
				
			}
			
			ColorChat(  id,  RED,  "^x04%s^x01 Ai primit^x03 %i^x01 XP pentru castigarea rundei!",  MESSAGE_TAG,  WINXP  );
			
			gUserXp[  id  ]  +=  WINXP;
			Save(  id  );
			
		}
	}
}

public SwitchTeams(    )
{
	set_task( 2.5, "TeamSwitch"  );
}


public TeamSwitch(    )
{
	
	new iPlayers[  32  ],  iNum;
	get_players(  iPlayers,  iNum,  "ch" );
	
	if(  iNum  ) 
	{
		new  id;
		
		for(  --iNum;  iNum  >=  0;  iNum--  ) 
		{
			id  =  iPlayers[  iNum  ];
			BeginDelayedTeamChange(  id  );
			
		}
	}
}

/*======================================= - ¦ Askhanar ¦ - =======================================*/

public BeginDelayedTeamChange(  id  )
{
	
	switch(  id  ) 
	{ 
		
		case  1..6:
		{
			
			set_task(  0.1, "ChangeUserTeamWithDelay",  id  +  SWITCH_TASK  );
			
		}
		case  7..13:
		{
			
			set_task(  0.2, "ChangeUserTeamWithDelay",  id  +  SWITCH_TASK  );
			
		}
		case  14..20:
		{
			
			set_task(  0.3, "ChangeUserTeamWithDelay",  id  +  SWITCH_TASK  );
			
		}
		case  21..26:
		{
			
			set_task(  0.4, "ChangeUserTeamWithDelay",  id  +  SWITCH_TASK  );
			
		}
		case  27..32:
		{
			
			set_task(  0.5, "ChangeUserTeamWithDelay",  id  +  SWITCH_TASK  );
			
		}
	} 
}

/*======================================= - ¦ Askhanar ¦ - =======================================*/

public ChangeUserTeamWithDelay(  id  )
{
	
	id  -=  SWITCH_TASK;
	if(  !IsUserOK(  id  )  )  return 1;
	
	switch(  cs_get_user_team(  id  )   ) 
	{
		
		case  CS_TEAM_FURIEN:
		{
			//BeginDelayedModelChange(  id  );
			cs_set_user_team(  id,  CS_TEAM_ANTIFURIEN  );
		}
		
		case  CS_TEAM_ANTIFURIEN:
		{
			//BeginDelayedModelChange(  id  );
			cs_set_user_team(  id,  CS_TEAM_FURIEN  );
		}
			
	}
	
	return 0;
}

public LogEventRoundEnd(    )		gRoundEnded  =  true;

public Ham_WeaponBoxTouch(  iWeaponBox,  id  )
{
	if(   gFirstPlayer  <=  id  <=  gMaxPlayers )
	{
		new CvarPickUp  =  get_pcvar_num(  gCvarBlockWeaponPickUp  );
		
		if(  CvarPickUp  ==  0  ||  !is_user_alive(  id  )  )
		{
			return HAM_SUPERCEDE;
		}
		
		if(  IsWeaponBoxC4(  iWeaponBox  )  )
		{
			return HAM_IGNORED;
		}
		
		
		if(  (  cs_get_user_team(  id  )  ==  CS_TEAM_FURIEN  &&  CvarPickUp  != 1  )  ||
			(  cs_get_user_team(  id  )  ==  CS_TEAM_ANTIFURIEN  &&  CvarPickUp  != 2  ) )
		{
			return HAM_SUPERCEDE;
		}

	}
	
	return HAM_IGNORED;
}

public Ham_GroundWeaponTouch(  iWeapon,  id  )
{
	if(   gFirstPlayer  <=  id  <=  gMaxPlayers )
	{
		new CvarPickUp  =  get_pcvar_num(  gCvarBlockWeaponPickUp  );
		
		if(  CvarPickUp  ==  0  ||  !is_user_alive(  id  )  )
		{
			return HAM_SUPERCEDE;
		}

		
		if(  (  cs_get_user_team(  id  )  ==  CS_TEAM_FURIEN  &&  CvarPickUp  != 1  ) ||
			(  cs_get_user_team(  id  )  ==  CS_TEAM_ANTIFURIEN  &&  CvarPickUp  != 2  ) )
		{
			return HAM_SUPERCEDE;
		}
	}
	
	return HAM_IGNORED;
}

public Ham_PlayerSpawnPost(  id  )
{
	
	if(  is_user_alive(  id  )  )
	{
		
		strip_user_weapons(  id  );
		give_item(  id,  "weapon_knife"  );
		
		new CsTeams:Team  =  cs_get_user_team(  id  );
		
		if(  Team  == CS_TEAM_ANTIFURIEN  )
		{
			if(  IsUserVip(  id  )  )
			{
				set_user_footsteps(  id,  1  );
				cs_set_user_defuse(  id,  1,  155,  0,  155  );
			}
			else
			{
				set_user_footsteps(  id,  0  );
			}
			
			gUserHasSuperKnife[  id  ]  =  false;
			gUserHasChameleon[  id  ]  =  false;
		}
		else
		{
			set_user_footsteps(  id,  1  );
			gUserHasLaser[  id  ]  =  false;
			gUserHasChameleon[  id  ]  =  false;
		}
		
		if(  Team  ==  CS_TEAM_ANTIFURIEN  ||  Team  ==  CS_TEAM_FURIEN  )
		{
			if(  gFirstTimePlayed[  id  ]  )
			{
				new iBonusXP = get_pcvar_num(  gCvarEntryXP  );
				if( iBonusXP > 0 )
				{
					ColorChat(  id,  RED,  "^x04%s^x01 Este pentru prima data cand joci acest^x03 Furien Mod Ultimate^x01, iti vom da un bonus de^x03 %i^x01 XP!",  MESSAGE_TAG, iBonusXP  );
				}
				else
				{
					ColorChat(  id,  RED,  "^x04%s^x01 Este pentru prima data cand joci acest^x03 Furien Mod Ultimate^x01, tasteaza^x03 /help^x01 pentru detalii!",  MESSAGE_TAG  );
				}
				ColorChat(  id,  RED,  "^x04%s^x01 Vei primi^x03 XP^x01 bazat pe gameplay-ul tau, cu care poti cumpara mai multe upgrade-uri.",  MESSAGE_TAG  );
				ColorChat(  id,  RED,  "^x04%s^x01 Tasteaza in chat^x03 /xp^x01 ca sa vezi ce poti cumpara !",  MESSAGE_TAG  );
				
				gFirstTimePlayed[  id  ]  =  false;
			}
			
			else
			{
				
				if( gHealthEnabled[  Team  ] )
				{
					
					new Health  =  (  gHealthMaxAmount[  Team  ] * gHealthLevel[  id  ][  Team  ]  )  /  gHealthMaxLevels[  Team  ];
					if(  Health  >  0  )
					{
						set_user_health(  id,  get_user_health(  id  )  +  Health  );
					}
				}
				
				if( gArmorEnabled[  Team  ] )
				{
					
					new Armor  =  (  gArmorMaxAmount[  Team  ] * gArmorLevel[  id  ][  Team  ]  )  /  gArmorMaxLevels[  Team  ];
					if(  Armor  >  0  )
					{
	
						cs_set_user_armor(  id, Armor,  Armor  >  100 ?  CS_ARMOR_VESTHELM : CS_ARMOR_KEVLAR  );
						
					}
					else
					{
						cs_set_user_armor(  id,  0, CS_ARMOR_NONE  );
					}
				}
				
				if( gGravityEnabled[  Team  ] )
				{
					new Float:fGravity;
					
					switch(  Team  )
					{
						case 1:
						{
							fGravity  =  gFurienGravityLevels[  gGravityLevel[  id  ][  Team  ]  ];
						}
						case 2:
						{
							fGravity  =  gAntiFurienGravityLevels[  gGravityLevel[  id  ][  Team  ]  ];
						}
					}
					
					if(  fGravity  >  0.0  )
					{
						set_user_gravity(  id,  fGravity  );
					}
				}	
			}
		}
		
		set_user_rendering(  id,  kRenderFxNone,  0,  0,  0,  kRenderNormal,  0  );
		
	}
}


/*======================================= - ¦ Askhanar ¦ - =======================================*/

public Ham_PlayerKilledPost(  id  )
{
	
	if(  cs_get_user_defuse(  id  )  )
		cs_set_user_defuse(  id,  0  );
		
	gUserHasSuperKnife[  id  ]  =  false;
	gUserHasLaser[  id  ]  =  false;
	
	if(  gPlayerUsedRespawn[  id  ]  >  0  )  return HAM_IGNORED;
	
	
	set_task( 0.5, "TaskHamPlayerKilledPost",  id );
	
	return HAM_IGNORED;
	
}

public TaskHamPlayerKilledPost(  id  )
{
	
	if(  !IsUserOK(  id  )  )  return 1;
	
	new CsTeams:Team  =  cs_get_user_team(  id  );
	if(  Team  ==  CS_TEAM_FURIEN  ||  Team  ==  CS_TEAM_ANTIFURIEN  )
	{
		if(  gRespawnEnabled[  Team  ]  )
		{
			
			if(  gRespawnLevel[  id  ][  Team  ]  >  0  )
			{
				new Chance  =  random_num(  1,  100  );
				new Percent  = gRespawnMaxAmount[  Team  ]  *  gRespawnLevel[  id  ][  Team  ]  /  gRespawnMaxLevels[  Team  ];
				
				if(  Chance  <=  Percent  )
				{
					if( gRoundEnded )
					{
						ColorChat(  id,  RED,  "^x04%s^x01 Runda s-a terminat, nu vei primi respawn!",  MESSAGE_TAG );
						return 1;
					}
					
					if(  !UserHasTeamMatesAlive(  id,  Team  )  )
					{
						ColorChat(  id,  RED,  "^x04%s  Nu poti primi respawn fara 1 coechipier in viata!",  MESSAGE_TAG  );
						return 1;
					}
					
					gPlayerUsedRespawn[  id  ]  =  1;
					set_task(  0.5,  "TaskRespawn",  id  );
					ColorChat(  id,  RED,  "^x04%s^x01 Ai primit respawn! (^x03%i^x01%% sansa)",  MESSAGE_TAG,  Percent  );
				}
				
				else
				{
					ColorChat(  id,  RED,  "^x04%s^x01 Nu ai avut destul noroc sa primesti respawn!",  MESSAGE_TAG,  Percent  );
				}
			}
		}
	}
	
	return 0;
	
}


public TaskRespawn(  id  )
{
	if(  !IsUserOK(  id  )  )  return 1;
	
	ExecuteHamB(  Ham_CS_RoundRespawn,  id  );
	
	PlaySound(  id,  SndRespawn  );
	
	return 0;
}


public Ham_PlayerTakeDamage(  id,  iInflictor,  iAttacker,  Float:flDamage,  bitsDamageType  )
{
	
	if( !iAttacker || id == iAttacker  ||  bitsDamageType & DMG_GRENADE ) return HAM_IGNORED;
	
	if(  is_user_alive(  id  )  )
	{
		if(  IsPlayer( iAttacker ) )
		{
			
			new  Float:Multiply  =  1.0;
			
			new CsTeams:Team  =  cs_get_user_team(  iAttacker  );
			if( Team  ==  CS_TEAM_FURIEN  ||  Team  ==  CS_TEAM_ANTIFURIEN  )
			{
				
				if(  gDamageMultiplierEnabled[  Team  ]  )
				{
					if(  gDamageMultiplierLevel[  iAttacker  ][  Team  ]  >  0  )
					{
						
						switch(  Team  )
						{
							case CS_TEAM_FURIEN:
							{
								Multiply  +=  gFurienMaxDamageMultiplier  * gDamageMultiplierLevel[  iAttacker  ][  Team  ] /  gDamageMultiplierMaxLevels[  Team  ];
							}
							case CS_TEAM_ANTIFURIEN:
							{
								Multiply  +=  gAntiFurienMaxDamageMultiplier  *  gDamageMultiplierLevel[  iAttacker  ][  Team  ] /  gDamageMultiplierMaxLevels[  Team  ];
							}
						}
						//ColorChat(  iAttacker,  RED, " DAMAGE %.1f  Multiply %f ", flDamage,  (  1.0  +  Multiply *  gDamageMultiplierLevel[  id  ][  Team  ]  )  );
					}
				}
				
				
			}
			
			new Float:SKDamage  =  0.0;
			
			if(  get_user_weapon(  iAttacker )  ==  CSW_KNIFE  &&  gUserHasSuperKnife[  iAttacker  ])
				SKDamage  =  1.0;
			
			SetHamParamFloat( 4, flDamage  *  ( Multiply  + SKDamage  )  );
		}
	}
	
	return HAM_IGNORED;
}

public Ham_ResetMaxSpeedPost(  id  )
{

	if(  is_user_alive(  id  )  /*&&  get_user_maxspeed(  id  )  !=  1.0*/  )
	{
		
		new CsTeams:Team  =  cs_get_user_team(  id  );
		if( Team  ==  CS_TEAM_FURIEN  ||  Team  ==  CS_TEAM_ANTIFURIEN  )
		{
			
			if(  gSpeedEnabled[  Team  ]  )
			{
	
				new Float:flMaxSpeed;
				
				if(  Team  ==  CS_TEAM_FURIEN  )
				{
					flMaxSpeed  =  gFurienSpeedLevels[  gSpeedLevel[  id  ][  Team  ]  ];
				}
				
				else if(  Team  ==  CS_TEAM_ANTIFURIEN  )
				{
					flMaxSpeed  =  gAntiFurienSpeedLevels[  gSpeedLevel[  id  ][  Team  ]  ];
				}
				
				engfunc(  EngFunc_SetClientMaxspeed,  id,  flMaxSpeed  );
				set_pev(  id,  pev_maxspeed,  flMaxSpeed  );
				
			}
		}
		
		/*	SlowHack o_O
			client_cmd(  id,  "cl_forwardspeed %0.1f;cl_sidespeed %0.1f;cl_backspeed %0.1f", flMaxSpeed, flMaxSpeed, flMaxSpeed );
		*/
	}
}

public Ham_PrimaryAttackC4(  iEnt  )
{ 
	
	if( gBombCanBePlanted  ==  false  )
	{
		if(  get_pcvar_num( gCvarNoBombPlantTime )  -  (  get_gametime(  ) - gfBombGameTime  )  >  0.0  )
		{
			
			new id  =  pev(  iEnt,  pev_owner );
			set_hudmessage(  0,  255,  0,  -1.0,  0.45,  0,  0.0 ,8.0,  0.0,  0.1,  4  );
			ShowSyncHudMsg(  id,  SyncHudMessage,  "Furienii au de asteptat %.1f secunde pana cand pot planta bomba!",   get_pcvar_num( gCvarNoBombPlantTime )  -  (  get_gametime(  ) - gfBombGameTime  )  );
			return HAM_SUPERCEDE;
		}
	}
	
	return HAM_IGNORED; 
}


public fwdGetGameDescription(    )
{
	
	new szFurienModUltimate[  32  ];
	get_pcvar_string(  gCvarGameType,  szFurienModUltimate,  sizeof  (  szFurienModUltimate  )  -1  );
	
	if(  !strlen(  szFurienModUltimate  )  )
	{
		formatex(  szFurienModUltimate,  sizeof  (  szFurienModUltimate  )  -1,  "FurienModUltimate v%s",  VERSION  );
		
		set_pcvar_string(  gCvarGameType,  szFurienModUltimate  );
	}
	
	forward_return(  FMV_STRING,  szFurienModUltimate  );
	return FMRES_SUPERCEDE;
}

public fwdClientUserInfoChanged(  id,  InfoKey  )
{
	
	if (  !IsUserOK(  id  )  ) 
		return FMRES_IGNORED;
	
	
	static szValue[  32  ];
	static szName[  32  ];
	
	get_user_name(  id,  szName,  sizeof  (  szName  )  -1  );
	engfunc(  EngFunc_InfoKeyValue, InfoKey,  "name",  szValue,  sizeof  (  szValue  )  - 1  );
	
	if(  equal(  szValue,  szName  )  )
		return FMRES_IGNORED;
	
	engfunc(  EngFunc_SetClientKeyValue,  id,  InfoKey,  "name",  szName  );
	ColorChat(  id,  RED,  "^x04%s^x03 NU iti poti schimba numele pe server !",  MESSAGE_TAG  );
	client_print(  id,  print_console, "%s NU iti poti schimba numele pe server !",  MESSAGE_TAG  );
	
	return FMRES_SUPERCEDE;
}
public Message_StatusIcon(  iMsgId,  MSG_DEST,  id  )
{
	if(  get_pcvar_num( gCvarBlockBuy )  !=  1  )
		return 0;
		
	static szIcon[  5  ];
	get_msg_arg_string(  2,  szIcon,  4  );
	
	if(  szIcon[  0  ]  ==  'b'  &&  szIcon[  2  ]  ==  'y'  &&  szIcon[  3  ]  ==  'z'  )
	{
		if(  get_msg_arg_int(  1  )  )
		{
			
			fm_cs_set_user_nobuy(  id  );
			return 1;
			
		}
	}
	
	return 0;
}

public Message_TextMsg(  iMsgId,  iMsgDest,  id  )
{
	
	if(  get_msg_arg_int(  1  )  ==  print_center  )
	{
		new szMessage[  128  ];
		get_msg_arg_string( 2,  szMessage,  charsmax(  szMessage  )  );
		
		if( equal(szMessage, "#Game_will_restart_in") )
		{
			new szArg1[ 4 ];
			get_msg_arg_string( 3, szArg1, charsmax( szArg1 ) );
			formatex( szMessage, charsmax(szMessage), "The game will restart in %s seconds !",  szArg1 );
			set_hudmessage(  0,  255,  0,  -1.0,  0.29,  0,  0.0,  3.0,  0.0,  1.0,  3  );
			ShowSyncHudMsg(  0,  SyncHudMessage,  szMessage  );
			return 1;
		}
		else
		{
			if( TrieGetString(  gMessagesReplacements,  szMessage,  szMessage,  sizeof  (   szMessage  )  -1 ) )
			{
				set_hudmessage(  0,  255,  0,  -1.0,  0.29,  0,  0.0,  3.0,  0.0,  1.0,  3  );
				ShowSyncHudMsg(  0,  SyncHudMessage,  szMessage  );
				return 1;
			}
		}
	}
	
	return 0;
} 

public SetFurienInvisibility(  iEnt  )
{
	
	entity_set_float(  iEnt,  EV_FL_nextthink,  get_gametime(    )  +  0.1  );

	new id, Float:fVecVelocity[  3  ],  iSpeed;
	new iPlayers[ 32 ];
	new iPlayersNum;
	
	get_players(  iPlayers,  iPlayersNum,  "aceh",  "TERRORIST"  );		
	for(  new i = 0 ; i < iPlayersNum ; i++  )
	{
		if(  is_user_alive(  iPlayers[  i  ]  )  )
		{ 

			id  =  iPlayers[  i  ];
			if( IsUserVip(  id  )  )
			{
				if(  get_user_weapon(  id  )  !=  CSW_C4 )
				{
					entity_get_vector(  id,  EV_VEC_velocity,  fVecVelocity  );
					iSpeed  =  floatround(  vector_length(  fVecVelocity  )  );
					
					if(  iSpeed  <  (  FURIEN_VISIBILITY_FACTOR  *  255  )  )
					{
						set_user_rendering(  id,  kRenderFxNone,  0,  0,  0,  kRenderTransAlpha,  iSpeed  /  FURIEN_VISIBILITY_FACTOR  );
					}
					else
					{
						set_user_rendering(  id,  kRenderFxNone,  0,  0,  0,  kRenderNormal,  0 );
					}
				}
				else
				{
					set_user_rendering(  id,  kRenderFxNone,  0,  0,  0,  kRenderNormal,  0  );
				}
			}
			else
			{
				if(  get_user_weapon(  id  )  ==  CSW_KNIFE )
				{
					entity_get_vector(  id,  EV_VEC_velocity,  fVecVelocity  );
					iSpeed  =  floatround(  vector_length(  fVecVelocity  )  );
					
					if(  iSpeed  <  (  FURIEN_VISIBILITY_FACTOR  *  255  )  )
					{
						set_user_rendering(  id,  kRenderFxNone,  0,  0,  0,  kRenderTransAlpha,  iSpeed  /  FURIEN_VISIBILITY_FACTOR  );
					}
					else
					{
						set_user_rendering(  id,  kRenderFxNone,  0,  0,  0,  kRenderNormal,  0 );
					}
				}
				else
				{
					set_user_rendering(  id,  kRenderFxNone,  0,  0,  0,  kRenderNormal,  0  );
				}
			}
		}
	}
}

public CheckForMultipleThings(  iEnt  )
{
	
	entity_set_float(  iEnt,  EV_FL_nextthink,  get_gametime(    )  +  1.0  );

	new id, iUserHealth, iUserArmor, iUserMaxHealth, iUserMaxArmor;
	new iPlayers[ 32 ];
	new iPlayersNum;
	
	get_players(  iPlayers,  iPlayersNum,  "ach"  );		
	for(  new i = 0 ; i < iPlayersNum ; i++  )
	{
		id  =  iPlayers[  i  ];
		if(  is_user_alive(  id  )  )
		{ 
			new CsTeams:Team  =  cs_get_user_team(  id  );
			if( Team  ==  CS_TEAM_FURIEN  ||  Team  ==  CS_TEAM_ANTIFURIEN  )
			{
				
				iUserHealth  =  get_user_health(  id  );
				if( iUserHealth  <=  LOW_HP_TO_HEAR_HEART  )
				{
					ShakeScreen( id, 0.8 );
					FadeScreen( id , 0.6, 230, 0, 0, 50 );
					emit_sound( id, CHAN_STATIC, LowHealthSound, 0.2, ATTN_IDLE, 0, PITCH_NORM  );
				}
				
				if(  gHealthRegenerationEnabled[  Team  ]  )
				{
					if(  gHealthRegenerationLevel[  id  ][  Team  ]  >  0 )
					{
						
						
						iUserMaxHealth  =  100 + (  ( gHealthMaxAmount[  Team  ] *   gHealthLevel[  id  ][  Team  ]  )  /  gHealthMaxLevels[  Team  ]  ) ; 
					
						if(  iUserHealth  <  iUserMaxHealth )
						{
							new iHealth  =  clamp(  iUserHealth + gHealthRegenerationLevel[  id  ][  Team  ],  iUserHealth,  iUserMaxHealth  );
							set_user_health(  id,  iHealth  );
						}
					}
				}
				
				if(  gArmorChargerEnabled[  Team  ]  )
				{
					if(  gArmorChargerLevel[  id  ][  Team  ]  >  0 )
					{
						
						iUserArmor  =  get_user_armor(  id  );
						iUserMaxArmor  = (  ( gArmorMaxAmount[  Team  ] *  gArmorLevel[  id  ][  Team  ]  )  /  gArmorMaxLevels[  Team  ]  ) ; 
					
						if(  iUserArmor  <  iUserMaxArmor )
						{
							new iArmor  =  clamp(  iUserArmor + gArmorChargerLevel[  id  ][  Team  ],  iUserArmor,  iUserMaxArmor  );
							set_user_armor(  id,  iArmor  );
						}
					}
				}
				
			}
		}
	}
	

	if( gBombCanBePlanted  ==  false  )
	{
		if(  (  get_gametime(  )  -  gfBombGameTime  )  >  float( get_pcvar_num( gCvarNoBombPlantTime  )  )  )
		{
			set_hudmessage( 255, 0, 0, -1.0, 0.45, 0, 0.0, 8.5, 0.0, 5.0, 4 );
			ShowSyncHudMsg( 0, SyncHudMessage, "Furienii pot planta bomba !" );
			
			new Lights[  32  ];
			get_pcvar_string(  gCvarBombLights,  Lights, sizeof  (  Lights  )  -1  );
			
			if(  strlen(  Lights  )  >  1 )
			{
				set_lights( "d" );
			}
			else
			{
				set_lights(  Lights  );
			}
			
			gBombCanBePlanted  =  true;
			
			if(  get_pcvar_num(  gCvarEnableFog  )  )
				MakeFogToPlayer(  0  );
				
		}
	}
	
}

public MakeFogToPlayer(  id  )
{
	
	if(  get_pcvar_num(  gCvarEnableFog  )  != 1 )  return 1;
	
	new Colors[ 32 ],  iDensity;
	new szColor[ 3 ][ 32 ];
	
	if(  gBombCanBePlanted  )
	{
		
		get_pcvar_string(  gCvarBombFogColor,  Colors,  sizeof ( Colors ) -1  );
		
		parse(  Colors,  szColor[ 0 ], sizeof ( szColor[ ] ) -1,  szColor[ 1 ], sizeof ( szColor[ ] ) -1,
			szColor[ 2 ], sizeof ( szColor[ ] ) -1 );
		
		new iRed  =  clamp(  str_to_num(  szColor[ 0 ] ), 0, 255 );
		new iGreen  =  clamp(  str_to_num(  szColor[ 1 ] ), 0, 255 );
		new iBlue =  clamp(  str_to_num(  szColor[ 2 ] ), 0, 255 );
		
		iDensity  =  clamp(  get_pcvar_num(  gCvarBombFogDensity  ), 1, 9 );
		
		new iSD = 4 * iDensity;
		new iED = iSD + 1;
		new iD1 = iSD + 2;
		new iD2 = iSD + 3;
		
		MakeFog(  id,  iRed, iGreen, iBlue, ConstFogDensity[ iSD ],
			ConstFogDensity[ iED ], ConstFogDensity[ iD1 ], ConstFogDensity[ iD2 ] );
	}
	else
	{
		
		get_pcvar_string(  gCvarFogColor,  Colors,  sizeof ( Colors ) -1  );
		
		parse(  Colors,  szColor[ 0 ], sizeof ( szColor[ ] ) -1,  szColor[ 1 ], sizeof ( szColor[ ] ) -1,
			szColor[ 2 ], sizeof ( szColor[ ] ) -1 );
		
		new iRed  =  clamp(  str_to_num(  szColor[ 0 ] ), 0, 255 );
		new iGreen  =  clamp(  str_to_num(  szColor[ 1 ] ), 0, 255 );
		new iBlue =  clamp(  str_to_num(  szColor[ 2 ] ), 0, 255 );
		
		iDensity  =  clamp(  get_pcvar_num(  gCvarFogDensity  ), 1, 9 );
		
		new iSD = 4 * iDensity;
		new iED = iSD + 1;
		new iD1 = iSD + 2;
		new iD2 = iSD + 3;
		
		MakeFog(  id,  iRed, iGreen, iBlue, ConstFogDensity[ iSD ],
			ConstFogDensity[ iED ], ConstFogDensity[ iD1 ], ConstFogDensity[ iD2 ] );
	}
	
	gFogCreated  =  true;
	
	return 0;
}

public client_PreThink( id )
{
	if( !is_user_alive( id ) )
		return;
	
	static CsTeams:Team;
	Team = cs_get_user_team( id );
	
	if( Team == CS_TEAM_ANTIFURIEN )
	{
		if( gUserHasLaser[ id ] )
		{
			static iTarget, iBody, iRed, iGreen, iBlue, iWeapon;
			
			get_user_aiming( id, iTarget, iBody );
		
			iWeapon = get_user_weapon( id );
		
			if( IsPrimaryWeapon( iWeapon ) || IsSecondaryWeapon( iWeapon ) )
			{
				if( is_user_alive( iTarget ) && cs_get_user_team( iTarget ) == CS_TEAM_FURIEN )
				{
					iRed = 255;
					iGreen = 0;
					iBlue = 0;
				}
				
				else
				{
					iRed = 0;
					iGreen = 0;
					iBlue = 255;
				}
				
				static iOrigin[ 3 ];
				get_user_origin( id, iOrigin, 3 );
				
				message_begin( MSG_BROADCAST, SVC_TEMPENTITY );
				write_byte( TE_BEAMENTPOINT );
				write_short( id | 0x1000 );
				write_coord( iOrigin[ 0 ] );
				write_coord( iOrigin[ 1 ] );
				write_coord( iOrigin[ 2 ] );
				write_short( gLaserSprite );
				write_byte( 1 );
				write_byte( 10 );
				write_byte( 1 );
				write_byte( 5 );
				write_byte( 0 );
				write_byte( iRed );
				write_byte( iGreen );
				write_byte( iBlue );
				write_byte( 150 );
				write_byte( 25 );
				message_end( );
			}
		}
	}
}

public client_command(  id  )
{
		
	new sArg[  13  ];
	if( read_argv(  0,  sArg,  12  )  >  11  )
	{
		return 0;
	}
	
	if(  get_pcvar_num( gCvarBlockDropCommand ) == 1 && get_user_team( id ) == 1 
		|| get_pcvar_num( gCvarBlockDropCommand ) == 2 && get_user_team( id ) == 2
		|| get_pcvar_num( gCvarBlockDropCommand ) == 3 )
	{
		if(  equali(  "drop",  sArg,  0  )  )
		{
			return 1;
		}
	}
	
	if(  get_pcvar_num(  gCvarBlockBuy  )  ==  1  )
	{
		for(  new i = 0 ;  i < sizeof  (  gWeaponsBuyCommands  ) ;  i++  )
		{
			if(  equali(  gWeaponsBuyCommands[  i  ],  sArg,  0  )  )
			{
				return 1;
			}
		}
	}
	
	if(  get_pcvar_num(  gCvarBlockRadio  )  ==  1  )
	{
		for(  new i = 0 ;  i < sizeof (  gRadioCommands  ) ;  i++  )
		{
			if(  equali(  gRadioCommands[  i  ],  sArg,  0  )  )
			{
				return 1;
			}
		}
	}
	
	return 0;
}

public ShowShopMenu(  id  )
{
	
	new MenuName[  128  ];

	formatex(  MenuName,  sizeof  (  MenuName  )  -  1, "\rFMU Shop^n\yBani: \w%i$",  cs_get_user_money(  id  )  );
		
	new  menu  =  menu_create(  MenuName, "ShopMenuHandler");
	new callback  =  menu_makecallback( "CallbackShop" );
	
	new HP[ 64 ], AP[ 64 ], HE[ 64 ], SW[ 64 ], DK[ 64 ], XP[ 64 ], IR[ 64 ];
	
	formatex(  HP,  sizeof ( HP ) -1, "\y25\w HP\r          [ \y%i$\r ]", get_pcvar_num(  gCvarHPCost )  );
	formatex(  AP,  sizeof ( AP ) -1, "\y25\w AP\r          [ \y%i$\r ]", get_pcvar_num(  gCvarAPCost )  );
	formatex(  HE,  sizeof ( HE ) -1, "\yHE\w grenade\r     [ \y%i$\r ]^n", get_pcvar_num(  gCvarHECost )  );
	formatex(  SW,  sizeof ( SW ) -1, "\wSilent Walk\r      [ \y%i$\r ]", get_pcvar_num(  gCvarSWCost )  );
	formatex(  DK,  sizeof ( DK ) -1, "\wDefuse Kit\r       [ \y%i$\r ]^n", get_pcvar_num(  gCvarDKCost )  );
	formatex(  XP,  sizeof ( XP ) -1, "\y%i\w Experience\r     [ \y%i$\r ]", get_pcvar_num( gCvarXPAmount ), get_pcvar_num(  gCvarXPCost )  );
	formatex(  IR,  sizeof ( IR ) -1, "\wInstant Respawn\r     [ \y%i$\r ]", get_pcvar_num(  gCvarIRCost )  );
	
	menu_additem(  menu,  HP,  "1",  _,  callback  );
	menu_additem(  menu,  AP,  "2",  _,  callback  );
	menu_additem(  menu,  HE,  "3",  _,  callback  );
	menu_additem(  menu,  SW,  "4",  _,  callback  );
	menu_additem(  menu,  DK,  "5",  _,  callback  );
	menu_additem(  menu,  XP,  "6",  _,  callback  );
	menu_additem(  menu,  IR,  "7",  _,  callback  );
	
	menu_setprop(  menu,  MPROP_EXITNAME, "\wIesire" );
	
	menu_display(  id, menu  );
	
	
}

public ShopMenuHandler(  id,  menu,  item)
{
	if(  item  ==  MENU_EXIT  )
	{
		menu_destroy(  menu  );
		return 1;
	}
	
	new iMoney  =  cs_get_user_money(  id  );
	new iHealth  =  get_user_health(  id  );
	new iArmor  =  get_user_armor(  id  );
	
	static _access, info[4], callback;
	menu_item_getinfo(  menu,  item,  _access,  info,  sizeof  (  info  )  -  1,  _,  _,  callback  );
	menu_destroy(  menu  );
	
	new iKey  =  str_to_num(  info  );
	switch(  iKey  )
	{
		case 1:
		{
			if(  !is_user_alive(  id  )  )
			{
				client_print(  id,  print_center,  "#Cstrike_TitlesTXT_Cannot_Buy_This"  );
				ColorChat(  id,  RED,  "^x04%s^x01 Trebuie sa fii in viata.",  MESSAGE_TAG  );
				ShowShopMenu(  id  );
				return 1;
			}
			
			new HPCost  =  get_pcvar_num(  gCvarHPCost  );
			
			if(  iMoney  <  HPCost  )
			{
				client_print(  id,  print_center,  "#Cstrike_TitlesTXT_Not_Enough_Money"  );
				ShowShopMenu(  id  );
				return 1;
			}
			
			else if( iHealth  >=  250  )
			{
				client_print(  id,  print_center,  "#Cstrike_TitlesTXT_Cannot_Carry_Anymore"  );
				ShowShopMenu(  id  );
				return 1;
			}
			
			cs_set_user_money(  id,  iMoney  -  HPCost  );
			set_user_health(  id,  clamp(  iHealth  +  25,  0,  250  )  );
			ColorChat(  id,  RED,  "^x04%s^x01 Ai cumparat^x03 25 HP^x01 pentru^x03 %i$^x01.",  MESSAGE_TAG,  HPCost  );
			PlaySound(  id,  SndPickUpItem  );
			
		}
		
		case 2:
		{
			if(  !is_user_alive(  id  )  )
			{
				client_print(  id,  print_center,  "#Cstrike_TitlesTXT_Cannot_Buy_This"  );
				ColorChat(  id,  RED,  "^x04%s^x01 Trebuie sa fii in viata.",  MESSAGE_TAG  );
				ShowShopMenu(  id  );
				return 1;
			}
			
			new APCost  =  get_pcvar_num(  gCvarAPCost  );
			
			if(  iMoney  <  APCost  )
			{
				client_print(  id,  print_center,  "#Cstrike_TitlesTXT_Not_Enough_Money"  );
				ShowShopMenu(  id  );
				return 1;
			}
			
			else if( iArmor  >=  170  )
			{
				client_print(  id,  print_center,  "#Cstrike_TitlesTXT_Cannot_Carry_Anymore"  );
				ShowShopMenu(  id  );
				return 1;
			}
			
			cs_set_user_money(  id,  iMoney  -  APCost  );
			set_user_armor(  id,  clamp(  iArmor  +  25,  0,  170  )  );
			ColorChat(  id,  RED,  "^x04%s^x01 Ai cumparat^x03 25 AP^x01 pentru^x03 %i$^x01.",  MESSAGE_TAG,  APCost  );
			PlaySound(  id,  SndPickUpItem  );
		}

		
		case 3:
		{
			if(  !is_user_alive(  id  )  )
			{
				client_print(  id,  print_center,  "#Cstrike_TitlesTXT_Cannot_Buy_This"  );
				ColorChat(  id,  RED,  "^x04%s^x01 Trebuie sa fii in viata.",  MESSAGE_TAG  );
				ShowShopMenu(  id  );
				return 1;
			}
			
			new HECost  =  get_pcvar_num(  gCvarHECost  );
			
			if(  iMoney  <  HECost  )
			{
				client_print(  id,  print_center,  "#Cstrike_TitlesTXT_Not_Enough_Money"  );
				ShowShopMenu(  id  );
				return 1;
			}
			
			else if( user_has_weapon(  id,  CSW_HEGRENADE  )  )
			{
				client_print(  id,  print_center,  "#Cstrike_TitlesTXT_Already_Have_One"  );
				ShowShopMenu(  id  );
				return 1;
			}
			
			cs_set_user_money(  id,  iMoney  -  HECost  );
			give_item(  id,  "weapon_hegrenade"  );
			ColorChat(  id,  RED,  "^x04%s^x01 Ai cumparat o^x03 grenada^x01 pentru^x03 2500$^x01.",  MESSAGE_TAG,  HECost  );
			PlaySound(  id,  SndPickUpItem  );
		}
		case 4:
		{
			if(  !is_user_alive(  id  )  )
			{
				client_print(  id,  print_center,  "#Cstrike_TitlesTXT_Cannot_Buy_This"  );
				ColorChat(  id,  RED,  "^x04%s^x01 Trebuie sa fii in viata.",  MESSAGE_TAG  );
				ShowShopMenu(  id  );
				return 1;
			}
			
			new SWCost  =  get_pcvar_num(  gCvarSWCost  );
			
			if(  iMoney  <  SWCost  )
			{
				client_print(  id,  print_center,  "#Cstrike_TitlesTXT_Not_Enough_Money"  );
				ShowShopMenu(  id  );
				return 1;
			}
			
			else if( get_user_footsteps(  id  )  >  0  )
			{
				client_print(  id,  print_center,  "#Cstrike_TitlesTXT_Already_Have_One"  );
				ShowShopMenu(  id  );
				return 1;
			}
			
			cs_set_user_money(  id,  iMoney  -  SWCost  );
			set_user_footsteps(  id,  1  );
			ColorChat(  id,  RED,  "^x04%s^x01 Ai cumparat^x03 Silent Walk^x01 pentru^x03 %i$^x01.",  MESSAGE_TAG,  SWCost  );
			PlaySound(  id,  SndPickUpItem  );
		}
		case 5:
		{
			if(  !is_user_alive(  id  )  )
			{
				client_print(  id,  print_center,  "#Cstrike_TitlesTXT_Cannot_Buy_This"  );
				ColorChat(  id,  RED,  "^x04%s^x01 Trebuie sa fii in viata.",  MESSAGE_TAG  );
				ShowShopMenu(  id  );
				return 1;
			}
			
			new DKCost  =  get_pcvar_num(  gCvarDKCost  );
			
			if(  iMoney  <  DKCost  )
			{
				client_print(  id,  print_center,  "#Cstrike_TitlesTXT_Not_Enough_Money"  );
				ShowShopMenu(  id  );
				return 1;
			}
			
			else if( cs_get_user_defuse(  id  )  )
			{
				client_print(  id,  print_center,  "#Cstrike_TitlesTXT_Already_Have_One"  );
				ShowShopMenu(  id  );
				return 1;
			}
			
			cs_set_user_money(  id,  iMoney  -  DKCost  );
			cs_set_user_defuse(  id,  1,  0,  145,  255  );
			ColorChat(  id,  RED,  "^x04%s^x01 Ai cumparat^x03 Defuse Kit^x01 pentru^x03 800$^x01.",  MESSAGE_TAG,  DKCost  );
			PlaySound(  id,  SndPickUpItem  );
		}
		case 6:
		{
			new XPAmount  =  get_pcvar_num(  gCvarXPAmount  );
			new XPCost  =  get_pcvar_num(  gCvarXPCost  );
			
			if(  iMoney  <  XPCost  )
			{
				client_print(  id,  print_center,  "#Cstrike_TitlesTXT_Not_Enough_Money"  );
				ShowShopMenu(  id  );
				return 1;
			}
			
			cs_set_user_money(  id,  iMoney  -  XPCost  );
			gUserXp[  id  ]  +=  XPAmount;
			ColorChat(  id,  RED,  "^x04%s^x01 Ai cumparat^x03 %i XP^x01 pentru^x03 %i$^x01.",  MESSAGE_TAG,  XPAmount,  XPCost  );
			PlaySound(  id,  SndTome  );
			
		}
		case 7:
		{
			new CsTeams:Team  =  cs_get_user_team(  id  );
			
			if(  Team  ==  CS_TEAM_ANTIFURIEN  ||  Team  ==  CS_TEAM_FURIEN  )
				//||  Team  ==  CS_TEAM_SPECTATOR  && ( get_user_flags( id  )  &&  read_flags( "cdefijm" )  )  )
			{
				if(  is_user_alive(  id  )  )
				{
					client_print(  id,  print_center,  "#Cstrike_TitlesTXT_Cannot_Buy_This"  );
					ColorChat(  id,  RED,  "^x04%s^x03 NU^x01 trebuie sa fii in viata.",  MESSAGE_TAG  );
					ShowShopMenu(  id  );
					return 1;
				}
				
				new IRCost  =  get_pcvar_num(  gCvarIRCost  );
				
				if(  iMoney  <  IRCost  )
				{
					client_print(  id,  print_center,  "#Cstrike_TitlesTXT_Not_Enough_Money"  );
					ShowShopMenu(  id  );
					return 1;
				}
				
				else if(  !UserHasTeamMatesAlive(  id,  cs_get_user_team(  id  )  )  )
				{
					client_print(  id,  print_center,  "#Cstrike_TitlesTXT_Cannot_Buy_This"  );
					ColorChat(  id,  RED,  "^x04%s^x01 Trebuie sa ai minim un coechipier in viata!",  MESSAGE_TAG  );
					ShowShopMenu(  id  );
					return 1;
				}
				
				cs_set_user_money(  id,  iMoney  -  IRCost  );
				set_task(  0.5,  "TaskRespawn",  id  );
				ColorChat(  id,  RED,  "^x04%s^x01 Ai cumparat^x03 Instant Respawn^x01 pentru^x03 %i$^x01.",  MESSAGE_TAG,  IRCost  );
				PlaySound(  id,  SndPickUpItem  );
			}
			else
			{
				client_print(  id,  print_center, "Nu poti cumpara Respawn cand esti SPECTATOR!"  );
			}
		}
	}
	
	return 0;
	
}

public CallbackShop(  id,  menu,  item  )
{
	static  _access,  info[  4  ],  callback;
	menu_item_getinfo(  menu,  item,  _access,  info,  sizeof  (  info  )  -  1,  _,  _,  callback  );
	
	if(  info[  0  ]  ==  '4'  &&  cs_get_user_team(  id  )  !=  CS_TEAM_ANTIFURIEN  )  return ITEM_DISABLED;
	else if(  info[  0  ]  ==  '5'  &&  cs_get_user_team(  id  )  !=  CS_TEAM_ANTIFURIEN  )  return ITEM_DISABLED;
	else if(  info[  0  ]  ==  '7'  &&  cs_get_user_team(  id  )  ==  CS_TEAM_SPECTATOR  )  return ITEM_DISABLED;
	
	return ITEM_ENABLED;
}

public ShowXPShopMenu(  id  )
{
	
	new MenuName[  128  ];

	formatex(  MenuName,  sizeof  (  MenuName  )  -  1, "\rFMU XPShop^n\yXP: \w%i",  gUserXp[  id  ]  );
		
	new  menu  =  menu_create(  MenuName, "XPShopMenuHandler");
	new callback  =  menu_makecallback( "CallbackXPShop" );
	
	new SK[ 64 ], LR[ 64 ], CM[ 64 ];/*, SW[ 64 ], DK[ 64 ], XP[ 64 ], IR[ 64 ];*/
	
	formatex(  SK,  sizeof ( SK ) -1, "\w Super Knife\r          [ \y%i XP\r ]", get_pcvar_num(  gCvarSKCost )  );
	formatex(  LR,  sizeof ( LR ) -1, "\w X-Ray Scanner\r          [ \y%i XP\r ]", get_pcvar_num(  gCvarLRCost )  );
	formatex(  CM,  sizeof ( CM ) -1, "\w Chameleon\r     [ \y%i XP\r ]^n", get_pcvar_num(  gCvarCMCost )  );
	/*formatex(  SW,  sizeof ( SW ) -1, "\wSilent Walk\r      [ \y%i$\r ]", get_pcvar_num(  gCvarSWCost )  );
	formatex(  DK,  sizeof ( DK ) -1, "\wDefuse Kit\r       [ \y%i$\r ]^n", get_pcvar_num(  gCvarDKCost )  );
	formatex(  XP,  sizeof ( XP ) -1, "\y%i\w Experience\r     [ \y%i$\r ]", get_pcvar_num( gCvarXPAmount ), get_pcvar_num(  gCvarXPCost )  );
	formatex(  IR,  sizeof ( IR ) -1, "\wInstant Respawn\r     [ \y%i$\r ]", get_pcvar_num(  gCvarIRCost )  );
	*/
	menu_additem(  menu,  SK,  "1",  _,  callback  );
	menu_additem(  menu,  LR,  "2",  _,  callback  );
	menu_additem(  menu,  CM,  "3",  _,  callback  );
	/*menu_additem(  menu,  SW,  "4",  _,  callback  );
	menu_additem(  menu,  DK,  "5",  _,  callback  );
	menu_additem(  menu,  XP,  "6",  _,  callback  );
	menu_additem(  menu,  IR,  "7",  _,  callback  );*/
	
	menu_setprop(  menu,  MPROP_EXITNAME, "\wIesire" );
	
	menu_display(  id, menu  );
	
	
}

public XPShopMenuHandler(  id,  menu,  item)
{
	if(  item  ==  MENU_EXIT  )
	{
		menu_destroy(  menu  );
		return 1;
	}
	
	static _access, info[4], callback;
	menu_item_getinfo(  menu,  item,  _access,  info,  sizeof  (  info  )  -  1,  _,  _,  callback  );
	menu_destroy(  menu  );
	
	new iKey  =  str_to_num(  info  );
	switch(  iKey  )
	{
		case 1:
		{
			if(  !is_user_alive(  id  )  )
			{
				client_print(  id,  print_center,  "#Cstrike_TitlesTXT_Cannot_Buy_This"  );
				ColorChat(  id,  RED,  "^x04%s^x01 Trebuie sa fii in viata.",  MESSAGE_TAG  );
				ShowXPShopMenu(  id  );
				return 1;
			}
			
			new SKCost  =  get_pcvar_num(  gCvarSKCost  );
			
			if(  gUserXp[  id  ]  <  SKCost  )
			{
				client_print(  id,  print_center,  "You do not have enough XP!"  );
				ShowXPShopMenu(  id  );
				return 1;
			}
			
			else if( gUserHasSuperKnife[  id  ]  )
			{
				client_print(  id,  print_center,  "#Cstrike_TitlesTXT_Already_Have_One"  );
				ShowXPShopMenu(  id  );
				return 1;
			}
			
			gUserHasSuperKnife[  id  ]  =  true;
			gUserXp[  id  ]  -=  SKCost;
			Save(  id  );
			
			ColorChat(  id,  RED,  "^x04%s^x01 Ai cumparat^x03 Super Knife^x01 pentru^x03 %i XP^x01.",  MESSAGE_TAG,  SKCost  );
			PlaySound(  id,  SndPickUpItem  );
		}
		
		case 2:
		{
			if(  !is_user_alive(  id  )  )
			{
				client_print(  id,  print_center,  "#Cstrike_TitlesTXT_Cannot_Buy_This"  );
				ColorChat(  id,  RED,  "^x04%s^x01 Trebuie sa fii in viata.",  MESSAGE_TAG  );
				ShowXPShopMenu(  id  );
				return 1;
			}
			
			new LRCost  =  get_pcvar_num(  gCvarLRCost  );
			
			if(  gUserXp[  id  ]  <  LRCost  )
			{
				client_print(  id,  print_center,  "You do not have enough XP!"  );
				ShowXPShopMenu(  id  );
				return 1;
			}
			
			else if( gUserHasLaser[  id  ]  )
			{
				client_print(  id,  print_center,  "#Cstrike_TitlesTXT_Already_Have_One"  );
				ShowXPShopMenu(  id  );
				return 1;
			}
			
			gUserHasLaser[  id  ]  =  true;
			gUserXp[  id  ]  -=  LRCost;
			Save(  id  );
			
			ColorChat(  id,  RED,  "^x04%s^x01 Ai cumparat^x03 Laser^x01 pentru^x03 %i XP^x01.",  MESSAGE_TAG,  LRCost  );
			PlaySound(  id,  SndPickUpItem  );
		}
		
		
		case 3:
		{
			if(  !is_user_alive(  id  )  )
			{
				client_print(  id,  print_center,  "#Cstrike_TitlesTXT_Cannot_Buy_This"  );
				ColorChat(  id,  RED,  "^x04%s^x01 Trebuie sa fii in viata.",  MESSAGE_TAG  );
				ShowXPShopMenu(  id  );
				return 1;
			}
			
			new CMCost  =  get_pcvar_num(  gCvarCMCost  );
			
			if(  gUserXp[  id  ]  <  CMCost  )
			{
				client_print(  id,  print_center,  "You do not have enough XP!"  );
				ShowXPShopMenu(  id  );
				return 1;
			}
			
			else if( gUserHasChameleon[  id  ]  )
			{
				client_print(  id,  print_center,  "#Cstrike_TitlesTXT_Already_Have_One"  );
				ShowXPShopMenu(  id  );
				return 1;
			}
			
			gUserHasChameleon[  id  ]  =  true;
			cs_set_user_model( id,  cs_get_user_team(  id  )  ==  CS_TEAM_FURIEN ?  AntiFurienModel  :  FurienModel  );
			
			gUserXp[  id  ]  -=  CMCost;
			Save(  id  );
			
			ColorChat(  id,  RED,  "^x04%s^x01 Ai cumparat^x03 Chameleon^x01 pentru^x03 %i XP^x01.",  MESSAGE_TAG,  CMCost  );
			PlaySound(  id,  SndPickUpItem  );
		}
		/*case 4:
		{
			if(  !is_user_alive(  id  )  )
			{
				client_print(  id,  print_center,  "#Cstrike_TitlesTXT_Cannot_Buy_This"  );
				ColorChat(  id,  RED,  "^x04%s^x01 Trebuie sa fii in viata.",  MESSAGE_TAG  );
				ShowShopMenu(  id  );
				return 1;
			}
			
			new SWCost  =  get_pcvar_num(  gCvarSWCost  );
			
			if(  iMoney  <  SWCost  )
			{
				client_print(  id,  print_center,  "#Cstrike_TitlesTXT_Not_Enough_Money"  );
				ShowShopMenu(  id  );
				return 1;
			}
			
			else if( get_user_footsteps(  id  )  >  0  )
			{
				client_print(  id,  print_center,  "#Cstrike_TitlesTXT_Already_Have_One"  );
				ShowShopMenu(  id  );
				return 1;
			}
			
			cs_set_user_money(  id,  iMoney  -  SWCost  );
			set_user_footsteps(  id,  1  );
			ColorChat(  id,  RED,  "^x04%s^x01 Ai cumparat^x03 Silent Walk^x01 pentru^x03 %i$^x01.",  MESSAGE_TAG,  SWCost  );
			
		}
		case 5:
		{
			if(  !is_user_alive(  id  )  )
			{
				client_print(  id,  print_center,  "#Cstrike_TitlesTXT_Cannot_Buy_This"  );
				ColorChat(  id,  RED,  "^x04%s^x01 Trebuie sa fii in viata.",  MESSAGE_TAG  );
				ShowShopMenu(  id  );
				return 1;
			}
			
			new DKCost  =  get_pcvar_num(  gCvarDKCost  );
			
			if(  iMoney  <  DKCost  )
			{
				client_print(  id,  print_center,  "#Cstrike_TitlesTXT_Not_Enough_Money"  );
				ShowShopMenu(  id  );
				return 1;
			}
			
			else if( cs_get_user_defuse(  id  )  )
			{
				client_print(  id,  print_center,  "#Cstrike_TitlesTXT_Already_Have_One"  );
				ShowShopMenu(  id  );
				return 1;
			}
			
			cs_set_user_money(  id,  iMoney  -  DKCost  );
			cs_set_user_defuse(  id,  1,  0,  145,  255  );
			ColorChat(  id,  RED,  "^x04%s^x01 Ai cumparat^x03 Defuse Kit^x01 pentru^x03 800$^x01.",  MESSAGE_TAG,  DKCost  );
			
		}
		case 6:
		{
			new XPAmount  =  get_pcvar_num(  gCvarXPAmount  );
			new XPCost  =  get_pcvar_num(  gCvarXPCost  );
			
			if(  iMoney  <  XPCost  )
			{
				client_print(  id,  print_center,  "#Cstrike_TitlesTXT_Not_Enough_Money"  );
				ShowShopMenu(  id  );
				return 1;
			}
			
			cs_set_user_money(  id,  iMoney  -  XPCost  );
			gUserXp[  id  ]  +=  XPAmount;
			ColorChat(  id,  RED,  "^x04%s^x01 Ai cumparat^x03 %i XP^x01 pentru^x03 %i$^x01.",  MESSAGE_TAG,  XPAmount,  XPCost  );
			
		}
		case 7:
		{
			new CsTeams:Team  =  cs_get_user_team(  id  );
			
			if(  Team  ==  CS_TEAM_ANTIFURIEN  ||  Team  ==  CS_TEAM_FURIEN  )
			{
				if(  is_user_alive(  id  )  )
				{
					client_print(  id,  print_center,  "#Cstrike_TitlesTXT_Cannot_Buy_This"  );
					ColorChat(  id,  RED,  "^x04%s^x01 NU trebuie sa fii in viata.",  MESSAGE_TAG  );
					ShowShopMenu(  id  );
					return 1;
				}
				
				new IRCost  =  get_pcvar_num(  gCvarIRCost  );
				
				if(  iMoney  <  IRCost  )
				{
					client_print(  id,  print_center,  "#Cstrike_TitlesTXT_Not_Enough_Money"  );
					ShowShopMenu(  id  );
					return 1;
				}
				
				else if(  !UserHasTeamMatesAlive(  id,  cs_get_user_team(  id  )  )  )
				{
					client_print(  id,  print_center,  "#Cstrike_TitlesTXT_Cannot_Buy_This"  );
					ColorChat(  id,  RED,  "^x04%s^x01 Trebuie sa ai minim un coechipier in viata!",  MESSAGE_TAG  );
					ShowShopMenu(  id  );
					return 1;
				}
				
				cs_set_user_money(  id,  iMoney  -  IRCost  );
				set_task(  0.5,  "TaskRespawn",  id  );
				ColorChat(  id,  RED,  "^x04%s^x01 Ai cumparat^x03 Instant Respawn^x01 pentru^x03 %i$^x01.",  MESSAGE_TAG,  IRCost  );
				
			}
		}
		*/
	}
	
	return 0;
	
}

public CallbackXPShop(  id,  menu,  item  )
{
	static  _access,  info[  4  ],  callback;
	menu_item_getinfo(  menu,  item,  _access,  info,  sizeof  (  info  )  -  1,  _,  _,  callback  );
	
	if(  info[  0  ]  ==  '1'  &&  cs_get_user_team(  id  )  !=  CS_TEAM_FURIEN  )  return ITEM_DISABLED;
	else if(  info[  0  ]  ==  '2'  &&  cs_get_user_team(  id  )  !=  CS_TEAM_ANTIFURIEN  )  return ITEM_DISABLED;
	
	return ITEM_ENABLED;
}

public ShowHelpMenu(  id  )
{
	static MenuName[  128  ];
	formatex(  MenuName,  sizeof  (  MenuName  )  -  1, "\r%s^n\y  Meniu Ajutor",  PLUGIN  );
	new  menu  =  menu_create(  MenuName, "HelpMenuHandler");
	
	menu_additem(  menu,  "\yGeneral^n", "*"  );
	if(  gAnyHealthEnabled  )
	{
		menu_additem(  menu, "Viata",  "1"  );
	}
	if(  gAnyArmorEnabled  )
	{
		menu_additem(  menu, "Armura",  "2"  );
	}
	if(  gAnySpeedEnabled  )
	{
		menu_additem(  menu, "Viteza",  "3"  );
	}
	if(  gAnyGravityEnabled  )
	{
		menu_additem(  menu, "Gravitate",  "4"  );
	}
	if(  gAnyDamageMultiplierEnabled  )
	{
		menu_additem(  menu, "Multiplicare Damage",  "5"  );
	}
	if(  gAnyRespawnEnabled  )
	{
		menu_additem(  menu, "Respawn",  "6"  );
	}
	if(  gAnyHealthRegenerationEnabled  )
	{
		menu_additem(  menu, "Regenerare Viata",  "7"  );
	}
	if(  gAnyArmorChargerEnabled  )
	{
		menu_additem(  menu, "Reincarcare Armura",  "8"  );
	}
	
	menu_setprop(  menu,  MPROP_EXITNAME, "\wIesire" );
	
	menu_display(  id, menu  );
	
}

public HelpMenuHandler(  id,  menu,  item)
{
	if(  item  ==  MENU_EXIT  )
	{
		menu_destroy(  menu  );
		return;
	}
	
	static _access, info[4], callback;
	menu_item_getinfo(  menu,  item,  _access,  info,  sizeof  (  info  )  -  1,  _,  _,  callback  );
	menu_destroy(  menu  );
	
	switch(  info[  0  ]  )
	{
		case '*':
		{
			PrintGeneralHelp(  id  );
		}
		case '1':
		{
			PrintHealthHelp(  id  );
		}
		case '2':
		{
			PrintArmorHelp(  id  );
		}
		case '3':
		{
			PrintSpeedHelp(  id  );
		}
		case '4':
		{
			PrintGravityHelp(  id  );
		}
		case '5':
		{
			PrintDamageMultiplierHelp(  id  );
		}
		case '6':
		{
			PrintRespawnHelp(  id  );
		}
		case '7':
		{
			PrintHealthRegenerationHelp(  id  );
		}
		case '8':
		{
			PrintArmorChargerHelp(  id  );
		}
	}
	
	ShowHelpMenu(  id  );
}

public ShowMainMenu(  id  )
{
	static MenuName[  128  ];
	formatex(  MenuName,  sizeof  (  MenuName  )  -  1, "\rMeniu Upgrade-uri^n\yXP: \w%i",  gUserXp[  id  ]  );
	new  menu  =  menu_create(  MenuName, "MainMenuHandler");
	
	menu_additem(  menu,  "\yAjutor General^n", "*"  );
	if(  gAnyHealthEnabled  )
	{
		menu_additem(  menu, "Viata",  "1"  );
	}
	if(  gAnyArmorEnabled  )
	{
		menu_additem(  menu, "Armura",  "2"  );
	}
	if(  gAnySpeedEnabled  )
	{
		menu_additem(  menu, "Viteza",  "3"  );
	}
	if(  gAnyGravityEnabled  )
	{
		menu_additem(  menu, "Gravitate",  "4"  );
	}
	if(  gAnyDamageMultiplierEnabled  )
	{
		menu_additem(  menu, "Multiplicare Damage",  "5"  );
	}
	if(  gAnyRespawnEnabled  )
	{
		menu_additem(  menu, "Respawn",  "6"  );
	}
	if(  gAnyHealthRegenerationEnabled  )
	{
		menu_additem(  menu, "Regenerare Viata",  "7"  );
	}
	if(  gAnyArmorChargerEnabled  )
	{
		menu_additem(  menu, "Reincarcare Armura",  "8"  );
	}
	
	menu_setprop(  menu,  MPROP_EXITNAME, "\wIesire" );
	
	menu_display(  id, menu  );
	
}

public MainMenuHandler(  id,  menu,  item)
{
	if(  item  ==  MENU_EXIT  )
	{
		menu_destroy(  menu  );
		return;
	}
	
	static _access, info[4], callback;
	menu_item_getinfo(  menu,  item,  _access,  info,  sizeof  (  info  )  -  1,  _,  _,  callback  );
	menu_destroy(  menu  );
	
	switch(  info[  0  ]  )
	{
		case '*':
		{
			PrintGeneralHelp(  id  );
		}
		case '1':
		{
			ShowHealthMenu(  id  );
		}
		case '2':
		{
			ShowArmorMenu(  id  );
		}
		case '3':
		{
			ShowSpeedMenu(  id  );
		}
		case '4':
		{
			ShowGravityMenu(  id  );
		}
		case '5':
		{
			ShowDamageMultiplierMenu(  id  );
		}
		case '6':
		{
			ShowRespawnMenu(  id  );
		}
		case '7':
		{
			ShowHealthRegenerationMenu(  id  );
		}
		case '8':
		{
			ShowArmorChargerMenu(  id  );
		}
	}
	
}

public ShowHealthMenu(  id  )
{
	static MenuName[  128  ];
	formatex(  MenuName,  sizeof  (  MenuName  )  -  1, "\rMeniu Viata^n\yXP: \w%i",  gUserXp[  id  ]  );
	new  menu  =  menu_create(  MenuName, "HealthMenuHandler"  );
	
	new callback  =  menu_makecallback( "CallbackHealth" );
	
	menu_additem(  menu,  "\yAjutor Viata^n", "*",  _, callback  );
	
	static level,  xp,  amount,  item[  128  ],  info[4];
	
	for(  new CsTeams:i = CS_TEAM_FURIEN; i <= CS_TEAM_ANTIFURIEN; i++  )
	{
		if( gHealthEnabled[  i  ] )
		{
			level = clamp(  gHealthLevel[  id  ][  i  ] + 1, 0, gHealthMaxLevels[  i  ] );
			amount = gHealthMaxAmount[  i  ]  *  level  /  gHealthMaxLevels[  i  ];
			
			if( gHealthLevel[  id  ][  i  ]  <  gHealthMaxLevels[  i  ]  )
			{
				xp  =  gHealthFirstXp[  i  ]  *  (1 << (  level  -  1  )  );
				formatex(  item,  sizeof(  item  )  -  1,  "%s: \yLevel %i \r(\w%i HP\r) [\w%i XP\r]", gHealthNames[  i  ],  level,  amount,  xp  );
			}
			else
			{
				formatex(item, sizeof(item) - 1, "\w%s: \yLevel %i \r(\w%i HP\r) \r[\wLevel Maxim!\r]", gHealthNames[  i  ],   level,   amount  );
			}
			
			num_to_str(  _:i,  info,  sizeof  (  info  )  -  1 );
			
			menu_additem(  menu,  item,  info,  _,  callback  );
		}
	}
	
	menu_setprop(  menu,  MPROP_EXITNAME, "\yMeniu Principal" );
	
	menu_display(  id,  menu  );
}

public HealthMenuHandler(  id,  menu,  item  )
{
	if(  item  ==  MENU_EXIT  )
	{
		menu_destroy(  menu  );
		ShowMainMenu(  id  );
		return;
	}
	
	static  _access,  info[  4  ],  callback;
	menu_item_getinfo(  menu,  item,  _access,  info,  sizeof  (  info  )  -  1,  _,  _,  callback  );
	menu_destroy(  menu  );
	
	
	if(  info[ 0 ]  ==  '*'  )
	{
		PrintHealthHelp(  id  );
	}
	else
	{
	
	
		new CsTeams:upgrade  =  CsTeams:str_to_num(  info  );
		
		new  level  =  gHealthLevel[  id  ][  upgrade  ] + 1;
		new  xp  =  gHealthFirstXp[  upgrade  ] * (  1 << (  level  -  1  )  );
		new  amount  =  gHealthMaxAmount[  upgrade  ]  *  level  /  gHealthMaxLevels[  upgrade  ];
		
		gUserXp[  id  ]  -=  xp;
		gHealthLevel[  id  ][  upgrade  ]  =  level;
		
		Save(  id  );
		
		ColorChat(  id,  RED,  "^x04%s^x01 Upgrade gata:^x03 %s^x01 Level^x03 %i^x01 (^x03%i^x01 HP) pentru^x03 %i^x01 XP!", MESSAGE_TAG, gHealthNames[  upgrade  ],  level,  amount,  xp  );
		PlaySound(  id,  SndLevelUp  );
	}
	
	ShowHealthMenu(  id  );
}

public CallbackHealth(  id,  menu,  item  )
{
	static  _access,  info[  4  ],  callback;
	menu_item_getinfo(  menu,  item,  _access,  info,  sizeof  (  info  )  -  1,  _,  _,  callback  );
	
	if(  info[  0  ]  ==  '*'  )  return ITEM_ENABLED;
	
	new CsTeams:upgrade = CsTeams:str_to_num(  info  );
	if( gHealthLevel[  id  ][  upgrade  ]  ==  gHealthMaxLevels[  upgrade  ]  )
	{
		return ITEM_DISABLED;
	}
	
	new  xp  =  gHealthFirstXp[  upgrade  ]  *  ( 1 << gHealthLevel[  id  ][  upgrade  ]  );
	if( gUserXp[  id  ]  <  xp  )
	{
		return ITEM_DISABLED;
	}
	
	return ITEM_ENABLED;
}

public ShowArmorMenu(  id  )
{
	static MenuName[  128  ];
	formatex(  MenuName,  sizeof  (  MenuName  )  -  1, "\rMeniu Armura^n\yXP: \w%i",  gUserXp[  id  ]  );
	new  menu  =  menu_create(  MenuName, "ArmorMenuHandler"  );
	
	new callback  =  menu_makecallback( "CallbackArmor" );
	
	
	menu_additem(  menu,  "\yArmor Help^n", "*",  _, callback  );
	
	
	static level,  xp,  amount,  item[  128  ],  info[4];
	
	for(  new CsTeams:i = CS_TEAM_FURIEN; i <= CS_TEAM_ANTIFURIEN; i++  )
	{
		if( gArmorEnabled[  i  ] )
		{
			level = clamp( gArmorLevel[  id  ][  i  ] + 1, 0,  gArmorMaxLevels[  i  ]  );
			amount = gArmorMaxAmount[  i  ]  *  level  /  gArmorMaxLevels[  i  ];
			
			if( gArmorLevel[  id  ][  i  ]  <  gArmorMaxLevels[  i  ]  )
			{
				xp  =  gArmorFirstXp[  i  ]  *  (1 << (  level  -  1  )  );
				formatex(  item,  sizeof(  item  )  -  1,  "%s: \yLevel %i \r(\w%i AP\r) [\w%i XP\r]", gArmorNames[  i  ],  level,  amount,  xp  );
			}
			else
			{
				formatex(item, sizeof(item) - 1, "\w%s: \yLevel %i \r(\w%i AP\r) \r[\wLevel Maxim!\r]", gArmorNames[  i  ],   level,   amount  );
			}
			
			num_to_str(  _:i,  info,  sizeof  (  info  )  -  1 );
			
			menu_additem(  menu,  item,  info,  _,  callback  );
		}
	}
	
	menu_setprop(  menu,  MPROP_EXITNAME, "\yMeniu Principal" );
	
	menu_display(  id,  menu  );
}

public ArmorMenuHandler(  id,  menu,  item  )
{
	if(  item  ==  MENU_EXIT  )
	{
		menu_destroy(  menu  );
		ShowMainMenu(  id  );
		return;
	}
	
	static  _access,  info[  4  ],  callback;
	menu_item_getinfo(  menu,  item,  _access,  info,  sizeof  (  info  )  -  1,  _,  _,  callback  );
	menu_destroy(  menu  );
	
	
	if(  info[ 0 ]  ==  '*'  )
	{
		PrintArmorHelp( id );
	}
	else
	{
		new CsTeams:upgrade  =  CsTeams:str_to_num(  info  );
		
		new  level  =  gArmorLevel[  id  ][  upgrade  ] + 1;
		new  xp  =  gArmorFirstXp[  upgrade  ] * (  1 << (  level  -  1  )  );
		new  amount  =  gArmorMaxAmount[  upgrade  ]  *  level  /  gArmorMaxLevels[  upgrade  ];
		
		gUserXp[  id  ]  -=  xp;
		gArmorLevel[  id  ][  upgrade  ]  =  level;
		
		Save(  id  );
		
		ColorChat(  id,  RED,  "^x04%s^x01 Upgrade gata:^x03 %s^x01 Level^x03 %i^x01 (^x03%i^x01 AP) pentru^x03 %i^x01 XP!", MESSAGE_TAG, gArmorNames[  upgrade  ],  level,  amount,  xp  );
		PlaySound(  id,  SndLevelUp  );
	}
	
	ShowArmorMenu(  id  );
}

public CallbackArmor(  id,  menu,  item  )
{
	static  _access,  info[  4  ],  callback;
	menu_item_getinfo(  menu,  item,  _access,  info,  sizeof  (  info  )  -  1,  _,  _,  callback  );
	
	if(  info[  0  ]  ==  '*'  )  return ITEM_ENABLED;
	
	new CsTeams:upgrade = CsTeams:str_to_num(  info  );
	if( gArmorLevel[  id  ][  upgrade  ]  ==  gArmorMaxLevels[  upgrade  ]  )
	{
		return ITEM_DISABLED;
	}
	
	new  xp  =  gArmorFirstXp[  upgrade  ]  *  ( 1 << gArmorLevel[  id  ][  upgrade  ]  );
	if( gUserXp[  id  ]  <  xp  )
	{
		return ITEM_DISABLED;
	}
	
	return ITEM_ENABLED;
}

public ShowSpeedMenu(  id  )
{
	static MenuName[  128  ];
	formatex(  MenuName,  sizeof  (  MenuName  )  -  1, "\rMeniu Viteza^n\yXP: \w%i",  gUserXp[  id  ]  );
	new  menu  =  menu_create(  MenuName, "SpeedMenuHandler"  );
	
	new callback  =  menu_makecallback( "CallbackSpeed" );
	
	menu_additem(  menu,  "\ySpeed Help^n", "*",  _, callback  );
	
	static level,  xp,  Float:amount,  item[  128  ],  info[4];
	
	for(  new CsTeams:i = CS_TEAM_FURIEN; i <= CS_TEAM_ANTIFURIEN; i++  )
	{
		if( gSpeedEnabled[  i  ] )
		{
			level = clamp(  gSpeedLevel[  id  ][  i  ] + 1, 0, gSpeedMaxLevels[  i  ]  );
			if( i == CS_TEAM_FURIEN )
			{
				amount = gFurienSpeedLevels[  level  ];
			}
			else if( i  == CS_TEAM_ANTIFURIEN  )
			{

				amount = gAntiFurienSpeedLevels[  level  ];
			}
			
			if( gSpeedLevel[  id  ][  i  ]  <  gSpeedMaxLevels[  i  ]  )
			{
				xp  =  gSpeedFirstXp[  i  ]  *  (1 << (  level  -  1  )  );
					
				formatex(  item,  sizeof(  item  )  -  1,  "%s: \yLevel %i \r(\w%.1f Speed\r) [\w%i XP\r]", gSpeedNames[  i  ],  level,  amount,  xp  );
			}
			else
			{
				formatex(item, sizeof(item) - 1, "\w%s: \yLevel %i \r(\w%.1f Speed\r) [\wLevel Maxim!\r]", gSpeedNames[  i  ],   level ,   amount  );
			}
			
			num_to_str(  _:i,  info,  sizeof  (  info  )  -  1 );
			
			menu_additem(  menu,  item,  info,  _,  callback  );
		}
	}
	
	menu_setprop(  menu,  MPROP_EXITNAME, "\yMeniu Principal" );
	
	menu_display(  id,  menu  );
}

public SpeedMenuHandler(  id,  menu,  item  )
{
	if(  item  ==  MENU_EXIT  )
	{
		menu_destroy(  menu  );
		ShowMainMenu(  id  );
		return;
	}
	
	static  _access,  info[  4  ],  callback;
	menu_item_getinfo(  menu,  item,  _access,  info,  sizeof  (  info  )  -  1,  _,  _,  callback  );
	menu_destroy(  menu  );
	

	if(  info[ 0 ]  ==  '*'  )
	{
		PrintSpeedHelp( id );
	}
	else
	{
		new CsTeams:upgrade  =  CsTeams:str_to_num(  info  );
		
		new  level  =  gSpeedLevel[  id  ][  upgrade  ] + 1;
		new  xp  =  gSpeedFirstXp[  upgrade  ] * (  1 << (  level  -  1  )  );
		new Float:amount;
		if( upgrade == CS_TEAM_FURIEN )
		{
			amount = gFurienSpeedLevels[  level  ];
		}
		else if( upgrade  == CS_TEAM_ANTIFURIEN  )
		{
	
			amount = gAntiFurienSpeedLevels[  level  ];
		}
		
		gUserXp[  id  ]  -=  xp;
		gSpeedLevel[  id  ][  upgrade  ]  =  level;
		
		Save(  id  );
		
		ColorChat(  id,  RED,  "^x04%s^x01 Upgrade gata:^x03 %s^x01 Level^x03 %i^x01 (^x03%.1f^x01 Speed) pentru^x03 %i^x01 XP!", MESSAGE_TAG, gSpeedNames[  upgrade  ],  level,  amount,  xp  );
		PlaySound(  id,  SndLevelUp  );
	}
	
	ShowSpeedMenu(  id  );
}

public CallbackSpeed(  id,  menu,  item  )
{
	static  _access,  info[  4  ],  callback;
	menu_item_getinfo(  menu,  item,  _access,  info,  sizeof  (  info  )  -  1,  _,  _,  callback  );
	
	if(  info[  0  ]  ==  '*'  )  return ITEM_ENABLED;
	
	new CsTeams:upgrade = CsTeams:str_to_num(  info  );
	if( gSpeedLevel[  id  ][  upgrade  ]  ==  gSpeedMaxLevels[  upgrade  ]  )
	{
		return ITEM_DISABLED;
	}
	
	new  xp  =  gSpeedFirstXp[  upgrade  ]  *  ( 1 << gSpeedLevel[  id  ][  upgrade  ]  );
	if( gUserXp[  id  ]  <  xp  )
	{
		return ITEM_DISABLED;
	}
	
	return ITEM_ENABLED;
}

public ShowGravityMenu(  id  )
{
	static MenuName[  128  ];
	formatex(  MenuName,  sizeof  (  MenuName  )  -  1, "\rMeniu Gravitate^n\yXP: \w%i",  gUserXp[  id  ]  );
	new  menu  =  menu_create(  MenuName, "GravityMenuHandler"  );
	
	new callback  =  menu_makecallback( "CallbackGravity" );
	
	menu_additem(  menu,  "\yGravity Help^n",  "*",  _,  callback  );
	
	static level,  xp,  Float:amount,  item[  128  ],  info[4];
	
	for(  new CsTeams:i = CS_TEAM_FURIEN; i <= CS_TEAM_ANTIFURIEN; i++  )
	{
		if( gGravityEnabled[  i  ] )
		{
			level = clamp(  gGravityLevel[  id  ][  i  ] + 1,  0,  gGravityMaxLevels[  i  ]  );
			if( i == CS_TEAM_FURIEN )
			{
				amount = gFurienGravityLevels[  level  ]  /  0.00125 ;
			}
			else if( i  == CS_TEAM_ANTIFURIEN  )
			{

				amount = gAntiFurienGravityLevels[  level  ]  /  0.00125;
			}
			
			if( gGravityLevel[  id  ][  i  ]  <  gGravityMaxLevels[  i  ]  )
			{
				xp  =  gGravityFirstXp[  i  ]  *  (1 << (  level  -  1  )  );
					
				formatex(  item,  sizeof(  item  )  -  1,  "%s: \yLevel %i \r(\w%.1f Gravity\r) [\w%i XP\r]", gGravityNames[  i  ],  level,  amount,  xp  );
			}
			else
			{
				formatex(item, sizeof(item) - 1, "\w%s: \yLevel %i \r(\w%.1f Gravity\r) [\wLevel Maxim!\r]", gGravityNames[  i  ],   level ,   amount  );
			}
			
			num_to_str(  _:i,  info,  sizeof  (  info  )  -  1 );
			
			menu_additem(  menu,  item,  info,  _,  callback  );
		}
	}
	
	menu_setprop(  menu,  MPROP_EXITNAME, "\yMeniu Principal" );
	menu_display(  id,  menu  );
}

public GravityMenuHandler(  id,  menu,  item  )
{
	if(  item  ==  MENU_EXIT  )
	{
		menu_destroy(  menu  );
		ShowMainMenu(  id  );
		return;
	}
	
	
	static  _access,  info[  4  ],  callback;
	menu_item_getinfo(  menu,  item,  _access,  info,  sizeof  (  info  )  -  1,  _,  _,  callback  );
	menu_destroy(  menu  );
	
	if(  info[ 0 ]  ==  '*'  )
	{
		PrintGravityHelp( id );
	}
	else
	{	
	
		new CsTeams:upgrade  =  CsTeams:str_to_num(  info  );
		
		new  level  =  gGravityLevel[  id  ][  upgrade  ] + 1; 
		new  xp  =  gGravityFirstXp[  upgrade  ] * (  1 << (  level  -  1  )  );
		new Float:amount;
		if( upgrade == CS_TEAM_FURIEN )
		{
			amount = gFurienGravityLevels[  level  ]  /  0.00125;
		}
		else if( upgrade  == CS_TEAM_ANTIFURIEN  )
		{
	
			amount = gAntiFurienGravityLevels[  level  ]  /  0.00125;
		}
		
		gUserXp[  id  ]  -=  xp;
		gGravityLevel[  id  ][  upgrade  ]  =  level;
		
		Save(  id  );
		
		ColorChat(  id,  RED,  "^x04%s^x01 Upgrade gata:^x03 %s^x01 Level^x03 %i^x01 (^x03%.1f^x01 GRAVITY) pentru^x03 %i^x01 XP!", MESSAGE_TAG, gGravityNames[  upgrade  ],  level,  amount,  xp  );
		PlaySound(  id,  SndLevelUp  );
	}

	ShowGravityMenu(  id  );
}

public CallbackGravity(  id,  menu,  item  )
{
	static  _access,  info[  4  ],  callback;
	menu_item_getinfo(  menu,  item,  _access,  info,  sizeof  (  info  )  -  1,  _,  _,  callback  );
	
	if(  info[  0  ]  ==  '*'  )  return ITEM_ENABLED;
	
	new CsTeams:upgrade = CsTeams:str_to_num(  info  );
	if( gGravityLevel[  id  ][  upgrade  ]  ==  gGravityMaxLevels[  upgrade  ]  )
	{
		return ITEM_DISABLED;
	}
	
	new  xp  =  gGravityFirstXp[  upgrade  ]  *  ( 1 << gGravityLevel[  id  ][  upgrade  ]  );
	if( gUserXp[  id  ]  <  xp  )
	{
		return ITEM_DISABLED;
	}
	
	return ITEM_ENABLED;
}

public ShowDamageMultiplierMenu(  id  )
{
	static MenuName[  128  ];
	formatex(  MenuName,  sizeof  (  MenuName  )  -  1, "\rMeniu Multiplicare Damage^n\yXP: \w%i",  gUserXp[  id  ]  );
	new  menu  =  menu_create(  MenuName, "DamageMultiplierMenuHandler"  );
	
	new callback  =  menu_makecallback( "CallbackDamageMultiplier" );
	
	menu_additem(  menu,  "\yDamage Multiplier Help^n", "*",  _, callback  );
	
	static level,  xp,  item[  128  ],  info[4];//,  amount;
	
	for(  new CsTeams:i = CS_TEAM_FURIEN; i <= CS_TEAM_ANTIFURIEN; i++  )
	{
		new iDamage[  CsTeams  ]  =  {  0,  20,  10,  0  };
		
		if( gDamageMultiplierEnabled[  i  ] )
		{
			level = clamp( gDamageMultiplierLevel[  id  ][  i  ] + 1, 0,  gDamageMultiplierMaxLevels[  i  ]  );
			
			if( gDamageMultiplierLevel[  id  ][  i  ]  <  gDamageMultiplierMaxLevels[  i  ]  )
			{
				xp  =  gDamageMultiplierFirstXp[  i  ]  *  (1 << (  level  -  1  )  );
				formatex(  item,  sizeof(  item  )  -  1,  "%s: \yLevel %i \r(\w%i%%\r) [\w%i XP\r]", gDamageMultiplierNames[  i  ],  level,  level * iDamage[  i  ],  xp  );
			}
			else
			{
				formatex(item, sizeof(item) - 1, "\w%s: \yLevel %i \r(\w%i%%\r) [\wLevel Maxim!\r]", gDamageMultiplierNames[  i  ],   level,   level * iDamage[  i  ]  );
			}
			
			num_to_str(  _:i,  info,  sizeof  (  info  )  -  1 );
			
			menu_additem(  menu,  item,  info,  _,  callback  );
		}
	}
	
	menu_setprop(  menu,  MPROP_EXITNAME, "\yMeniu Principal" );
	menu_display(  id,  menu  );
}

public DamageMultiplierMenuHandler(  id,  menu,  item  )
{
	if(  item  ==  MENU_EXIT  )
	{
		menu_destroy(  menu  );
		ShowMainMenu(  id  );
		return;
	}
	
	static  _access,  info[  4  ],  callback;
	menu_item_getinfo(  menu,  item,  _access,  info,  sizeof  (  info  )  -  1,  _,  _,  callback  );
	menu_destroy(  menu  );
	
	if(  info[ 0 ]  ==  '*'  )
	{
		PrintDamageMultiplierHelp( id );
	}
	else
	{
		
		new CsTeams:upgrade  =  CsTeams:str_to_num(  info  );
		
		new  level  =  gDamageMultiplierLevel[  id  ][  upgrade  ] + 1;
		new  xp  =  gDamageMultiplierFirstXp[  upgrade  ] * (  1 << (  level  -  1  )  );
		
		
		gUserXp[  id  ]  -=  xp;
		gDamageMultiplierLevel[  id  ][  upgrade  ]  =  level;
		
		Save(  id  );
		
		ColorChat(  id,  RED,  "^x04%s^x01 Upgrade gata:^x03 %s^x01 Level^x03 %i^x01 (^x03%i^x01 %%) pentru^x03 %i^x01 XP!", MESSAGE_TAG, gDamageMultiplierNames[  upgrade  ],  level,  level * 20 ,  xp  );
		PlaySound(  id,  SndLevelUp  );
	}
	
	ShowDamageMultiplierMenu(  id  );
}

public CallbackDamageMultiplier(  id,  menu,  item  )
{
	static  _access,  info[  4  ],  callback;
	menu_item_getinfo(  menu,  item,  _access,  info,  sizeof  (  info  )  -  1,  _,  _,  callback  );
	
	
	if(  info[  0  ]  ==  '*'  )  return ITEM_ENABLED;
	
	
	new CsTeams:upgrade = CsTeams:str_to_num(  info  );
	if( gDamageMultiplierLevel[  id  ][  upgrade  ]  ==  gDamageMultiplierMaxLevels[  upgrade  ]  )
	{
		return ITEM_DISABLED;
	}
	
	new  xp  =  gDamageMultiplierFirstXp[  upgrade  ]  *  ( 1 << gDamageMultiplierLevel[  id  ][  upgrade  ]  );
	if( gUserXp[  id  ]  <  xp  )
	{
		return ITEM_DISABLED;
	}
	
	return ITEM_ENABLED;
}

public ShowRespawnMenu(  id  )
{
	static MenuName[  128  ];
	formatex(  MenuName,  sizeof  (  MenuName  )  -  1, "\rMeniu Respawn^n\yXP: \w%i",  gUserXp[  id  ]  );
	new  menu  =  menu_create(  MenuName, "RespawnMenuHandler"  );
	
	new callback  =  menu_makecallback( "CallbackRespawn" );
	
	menu_additem(  menu,  "\yRespawn Help^n", "*",  _, callback  );
	
	static level,  xp,  amount,  item[  128  ],  info[4];
	
	for(  new CsTeams:i = CS_TEAM_FURIEN; i <= CS_TEAM_ANTIFURIEN; i++  )
	{
		if( gRespawnEnabled[  i  ] )
		{
			level = clamp( gRespawnLevel[  id  ][  i  ] + 1, 0,  gRespawnMaxLevels[  i  ]  );
			amount = gRespawnMaxAmount[  i  ]  *  level  /  gRespawnMaxLevels[  i  ];
			
			if( gRespawnLevel[  id  ][  i  ]  <  gRespawnMaxLevels[  i  ]  )
			{
				xp  =  gRespawnFirstXp[  i  ]  *  (1 << (  level  -  1  )  );
				formatex(  item,  sizeof(  item  )  -  1,  "%s: \yLevel %i \r(\w%i%%\r) [\w%i XP\r]", gRespawnNames[  i  ],  level,  amount,  xp  );
			}
			else
			{
				formatex(item, sizeof(item) - 1, "\w%s: \yLevel %i \r(\w%i%%\r) [\wLevel Maxim!\r]", gRespawnNames[  i  ],   level,   amount  );
			}
			
			num_to_str(  _:i,  info,  sizeof  (  info  )  -  1 );
			
			menu_additem(  menu,  item,  info,  _,  callback  );
		}
	}
	
	menu_setprop(  menu,  MPROP_EXITNAME, "\yMeniu Principal" );
	menu_display(  id,  menu  );
}

public RespawnMenuHandler(  id,  menu,  item  )
{
	if(  item  ==  MENU_EXIT  )
	{
		menu_destroy(  menu  );
		ShowMainMenu(  id  );
		return;
	}
	
	static  _access,  info[  4  ],  callback;
	menu_item_getinfo(  menu,  item,  _access,  info,  sizeof  (  info  )  -  1,  _,  _,  callback  );
	menu_destroy(  menu  );
	
	if(  info[ 0 ]  ==  '*'  )
	{
		PrintRespawnHelp( id );
	}
	else
	{
		
		new CsTeams:upgrade  =  CsTeams:str_to_num(  info  );
		
		new  level  =  gRespawnLevel[  id  ][  upgrade  ] + 1;
		new  xp  =  gRespawnFirstXp[  upgrade  ] * (  1 << (  level  -  1  )  );
		new  amount  =  gRespawnMaxAmount[  upgrade  ]  *  level  /  gRespawnMaxLevels[  upgrade  ];
		
		gUserXp[  id  ]  -=  xp;
		gRespawnLevel[  id  ][  upgrade  ]  =  level;
		
		Save(  id  );
		
		ColorChat(  id,  RED,  "^x04%s^x01 Upgrade gata:^x03 %s^x01 Level^x03 %i^x01 (^x03%i^x01 %%) pentru^x03 %i^x01 XP!", MESSAGE_TAG, gRespawnNames[  upgrade  ],  level,  amount,  xp  );
		PlaySound(  id,  SndLevelUp  );
	}

	ShowRespawnMenu(  id  );
}

public CallbackRespawn(  id,  menu,  item  )
{
	static  _access,  info[  4  ],  callback;
	menu_item_getinfo(  menu,  item,  _access,  info,  sizeof  (  info  )  -  1,  _,  _,  callback  );
	
	
	if(  info[  0  ]  ==  '*'  )  return ITEM_ENABLED;
	
	
	new CsTeams:upgrade = CsTeams:str_to_num(  info  );
	if( gRespawnLevel[  id  ][  upgrade  ]  ==  gRespawnMaxLevels[  upgrade  ]  )
	{
		return ITEM_DISABLED;
	}
	
	new  xp  =  gRespawnFirstXp[  upgrade  ]  *  ( 1 << gRespawnLevel[  id  ][  upgrade  ]  );
	if( gUserXp[  id  ]  <  xp  )
	{
		return ITEM_DISABLED;
	}
	
	return ITEM_ENABLED;
}

public ShowHealthRegenerationMenu(  id  )
{
	static MenuName[  128  ];
	formatex(  MenuName,  sizeof  (  MenuName  )  -  1, "\rMeniu Regenerare Viata^n\yXP: \w%i",  gUserXp[  id  ]  );
	new  menu  =  menu_create(  MenuName, "HealthRegenerationMenuHandler"  );
	
	new callback  =  menu_makecallback( "CallbackHealthRegeneration" );
	
	menu_additem(  menu,  "\yHealth Regeneration Help^n", "*",  _, callback  );
	
	static level,  xp,  amount,  item[  128  ],  info[4];
	
	for(  new CsTeams:i = CS_TEAM_FURIEN; i <= CS_TEAM_ANTIFURIEN; i++  )
	{
		if( gHealthRegenerationEnabled[  i  ] )
		{
			level = clamp(  gHealthRegenerationLevel[  id  ][  i  ] + 1, 0, gHealthRegenerationMaxLevels[  i  ] );
			amount = gHealthRegenerationMaxAmount[  i  ]  *  level  /  gHealthRegenerationMaxLevels[  i  ];
			
			if( gHealthRegenerationLevel[  id  ][  i  ]  <  gHealthRegenerationMaxLevels[  i  ]  )
			{
				xp  =  gHealthRegenerationFirstXp[  i  ]  *  (1 << (  level  -  1  )  );
				formatex(  item,  sizeof(  item  )  -  1,  "%s: \yLevel %i \r(\w%i HP\r) [\w%i XP\r]", gHealthRegenerationNames[  i  ],  level,  amount,  xp  );
			}
			else
			{
				formatex(item, sizeof(item) - 1, "\w%s: \yLevel %i \r(\w%i HP\r) \r[\wLevel Maxim!\r]", gHealthRegenerationNames[  i  ],   level,   amount  );
			}
			
			num_to_str(  _:i,  info,  sizeof  (  info  )  -  1 );
			
			menu_additem(  menu,  item,  info,  _,  callback  );
		}
	}
	
	menu_setprop(  menu,  MPROP_EXITNAME, "\yMeniu Principal" );
	
	menu_display(  id,  menu  );
}

public HealthRegenerationMenuHandler(  id,  menu,  item  )
{
	if(  item  ==  MENU_EXIT  )
	{
		menu_destroy(  menu  );
		ShowMainMenu(  id  );
		return;
	}
	
	static  _access,  info[  4  ],  callback;
	menu_item_getinfo(  menu,  item,  _access,  info,  sizeof  (  info  )  -  1,  _,  _,  callback  );
	menu_destroy(  menu  );
	
	if(  info[ 0 ]  ==  '*'  )
	{
		PrintHealthRegenerationHelp( id );
	}
	else
	{
	
	
		new CsTeams:upgrade  =  CsTeams:str_to_num(  info  );
		
		new  level  =  gHealthRegenerationLevel[  id  ][  upgrade  ] + 1;
		new  xp  =  gHealthRegenerationFirstXp[  upgrade  ] * (  1 << (  level  -  1  )  );
		new  amount  =  gHealthRegenerationMaxAmount[  upgrade  ]  *  level  /  gHealthRegenerationMaxLevels[  upgrade  ];
		
		gUserXp[  id  ]  -=  xp;
		gHealthRegenerationLevel[  id  ][  upgrade  ]  =  level;
		
		Save(  id  );
		
		ColorChat(  id,  RED,  "^x04%s^x01 Upgrade gata:^x03 %s^x01 Level^x03 %i^x01 (^x03%i^x01 HP) pentru^x03 %i^x01 XP!", MESSAGE_TAG, gHealthRegenerationNames[  upgrade  ],  level,  amount,  xp  );
		PlaySound(  id,  SndLevelUp  );
	}
	
	ShowHealthRegenerationMenu(  id  );
}

public CallbackHealthRegeneration(  id,  menu,  item  )
{
	static  _access,  info[  4  ],  callback;
	menu_item_getinfo(  menu,  item,  _access,  info,  sizeof  (  info  )  -  1,  _,  _,  callback  );
	
	if(  info[  0  ]  ==  '*'  )  return ITEM_ENABLED;
	
	new CsTeams:upgrade = CsTeams:str_to_num(  info  );
	if( gHealthRegenerationLevel[  id  ][  upgrade  ]  ==  gHealthRegenerationMaxLevels[  upgrade  ]  )
	{
		return ITEM_DISABLED;
	}
	
	new  xp  =  gHealthRegenerationFirstXp[  upgrade  ]  *  ( 1 << gHealthRegenerationLevel[  id  ][  upgrade  ]  );
	if( gUserXp[  id  ]  <  xp  )
	{
		return ITEM_DISABLED;
	}
	
	return ITEM_ENABLED;
}

public ShowArmorChargerMenu(  id  )
{
	static MenuName[  128  ];
	formatex(  MenuName,  sizeof  (  MenuName  )  -  1, "\rMeniu Reincarcare Armura^n\yXP: \w%i",  gUserXp[  id  ]  );
	new  menu  =  menu_create(  MenuName, "ArmorChargerMenuHandler"  );
	
	new callback  =  menu_makecallback( "CallbackArmorCharger" );
	
	
	menu_additem(  menu,  "\yArmor Charger Help^n", "*",  _, callback  );
	
	
	static level,  xp,  amount,  item[  128  ],  info[4];
	
	for(  new CsTeams:i = CS_TEAM_FURIEN; i <= CS_TEAM_ANTIFURIEN; i++  )
	{
		if( gArmorChargerEnabled[  i  ] )
		{
			level = clamp( gArmorChargerLevel[  id  ][  i  ] + 1, 0,  gArmorChargerMaxLevels[  i  ]  );
			amount = gArmorChargerMaxAmount[  i  ]  *  level  /  gArmorChargerMaxLevels[  i  ];
			
			if( gArmorChargerLevel[  id  ][  i  ]  <  gArmorChargerMaxLevels[  i  ]  )
			{
				xp  =  gArmorChargerFirstXp[  i  ]  *  (1 << (  level  -  1  )  );
				formatex(  item,  sizeof(  item  )  -  1,  "%s: \yLevel %i \r(\w%i AP\r) [\w%i XP\r]", gArmorChargerNames[  i  ],  level,  amount,  xp  );
			}
			else
			{
				formatex(item, sizeof(item) - 1, "\w%s: \yLevel %i \r(\w%i AP\r) \r[\wLevel Maxim!\r]", gArmorChargerNames[  i  ],   level,   amount  );
			}
			
			num_to_str(  _:i,  info,  sizeof  (  info  )  -  1 );
			
			menu_additem(  menu,  item,  info,  _,  callback  );
		}
	}
	
	menu_setprop(  menu,  MPROP_EXITNAME, "\yMeniu Principal" );
	
	menu_display(  id,  menu  );
}

public ArmorChargerMenuHandler(  id,  menu,  item  )
{
	if(  item  ==  MENU_EXIT  )
	{
		menu_destroy(  menu  );
		ShowMainMenu(  id  );
		return;
	}
	
	static  _access,  info[  4  ],  callback;
	menu_item_getinfo(  menu,  item,  _access,  info,  sizeof  (  info  )  -  1,  _,  _,  callback  );
	menu_destroy(  menu  );
	
	
	if(  info[ 0 ]  ==  '*'  )
	{
		PrintArmorChargerHelp( id );
	}
	else
	{
		new CsTeams:upgrade  =  CsTeams:str_to_num(  info  );
		
		new  level  =  gArmorChargerLevel[  id  ][  upgrade  ] + 1;
		new  xp  =  gArmorChargerFirstXp[  upgrade  ] * (  1 << (  level  -  1  )  );
		new  amount  =  gArmorChargerMaxAmount[  upgrade  ]  *  level  /  gArmorChargerMaxLevels[  upgrade  ];
		
		gUserXp[  id  ]  -=  xp;
		gArmorChargerLevel[  id  ][  upgrade  ]  =  level;
		
		Save(  id  );
		
		ColorChat(  id,  RED,  "^x04%s^x01 Upgrade gata:^x03 %s^x01 Level^x03 %i^x01 (^x03%i^x01 AP) pentru^x03 %i^x01 XP!", MESSAGE_TAG, gArmorChargerNames[  upgrade  ],  level,  amount,  xp  );
		PlaySound(  id,  SndLevelUp  );
	}
	
	ShowArmorChargerMenu(  id  );
}

public CallbackArmorCharger(  id,  menu,  item  )
{
	static  _access,  info[  4  ],  callback;
	menu_item_getinfo(  menu,  item,  _access,  info,  sizeof  (  info  )  -  1,  _,  _,  callback  );
	
	if(  info[  0  ]  ==  '*'  )  return ITEM_ENABLED;
	
	new CsTeams:upgrade = CsTeams:str_to_num(  info  );
	if( gArmorChargerLevel[  id  ][  upgrade  ]  ==  gArmorChargerMaxLevels[  upgrade  ]  )
	{
		return ITEM_DISABLED;
	}
	
	new  xp  =  gArmorChargerFirstXp[  upgrade  ]  *  ( 1 << gArmorChargerLevel[  id  ][  upgrade  ]  );
	if( gUserXp[  id  ]  <  xp  )
	{
		return ITEM_DISABLED;
	}
	
	return ITEM_ENABLED;
}

public Load(  id  )
{
	
	static data[  256  ],  timestamp;
	new  szName[  32  ];
	get_user_name(  id,  szName,  sizeof  (  szName  )  -1  );
	
	if(  nvault_lookup(  gVault,  szName,  data,  sizeof  (  data  )  -  1,  timestamp  ) )
	{
		ParseLoadedData(  id,  data  );
		return;
	}
	else
	{
		UserIsNew(  id  );
	}
	
}

public ParseLoadedData(  id,  data[  256  ]  )
{
	
	static iXp[  15  ], iLevel[ 6 ];
	strbreak(  data,  iXp,  sizeof  (  iXp  )  -  1,  data,  sizeof  (  data  )  -  1  );
	
	gUserXp[  id  ]  =  str_to_num(  iXp  );
	
	for(  new CsTeams:i = CS_TEAM_FURIEN; i <= CS_TEAM_ANTIFURIEN; i++  )
	{
		strbreak(  data,  iLevel,  sizeof  (  iLevel  )  -  1,  data,  sizeof  (  data  )  -  1  );
		gHealthLevel[  id  ][  i  ]  =  clamp(  str_to_num(  iLevel  ),  NULL,  gHealthMaxLevels[  i  ]  );
	}
	
	for(  new CsTeams:i = CS_TEAM_FURIEN; i <= CS_TEAM_ANTIFURIEN; i++  )
	{
		strbreak(  data,  iLevel,  sizeof  (  iLevel  )  -  1,  data,  sizeof  (  data  )  -  1  );
		gArmorLevel[  id  ][  i  ]  =  clamp(  str_to_num(  iLevel  ),  NULL,  gArmorMaxLevels[  i  ]  );
	}
	
	for(  new CsTeams:i = CS_TEAM_FURIEN; i <= CS_TEAM_ANTIFURIEN; i++  )
	{
		strbreak(  data,  iLevel,  sizeof  (  iLevel  )  -  1,  data,  sizeof  (  data  )  -  1  );
		gSpeedLevel[  id  ][  i  ]  =  clamp(  str_to_num(  iLevel  ),  NULL,  gSpeedMaxLevels[  i  ]  );
	}
	
	for(  new CsTeams:i = CS_TEAM_FURIEN; i <= CS_TEAM_ANTIFURIEN; i++  )
	{
		strbreak(  data,  iLevel,  sizeof  (  iLevel  )  -  1,  data,  sizeof  (  data  )  -  1  );
		gGravityLevel[  id  ][  i  ]  =  clamp(  str_to_num(  iLevel  ),  NULL,  gGravityMaxLevels[  i  ]  );
	}
	
	for(  new CsTeams:i = CS_TEAM_FURIEN; i <= CS_TEAM_ANTIFURIEN; i++  )
	{
		strbreak(  data,  iLevel,  sizeof  (  iLevel  )  -  1,  data,  sizeof  (  data  )  -  1  );
		gDamageMultiplierLevel[  id  ][  i  ]  =  clamp(  str_to_num(  iLevel  ),  NULL,  gDamageMultiplierMaxLevels[  i  ]  );
	}
	
	for(  new CsTeams:i = CS_TEAM_FURIEN; i <= CS_TEAM_ANTIFURIEN; i++  )
	{
		strbreak(  data,  iLevel,  sizeof  (  iLevel  )  -  1,  data,  sizeof  (  data  )  -  1  );
		gRespawnLevel[  id  ][  i  ]  =  clamp(  str_to_num(  iLevel  ),  NULL,  gRespawnMaxLevels[  i  ]  );
	}
	for(  new CsTeams:i = CS_TEAM_FURIEN; i <= CS_TEAM_ANTIFURIEN; i++  )
	{
		strbreak(  data,  iLevel,  sizeof  (  iLevel  )  -  1,  data,  sizeof  (  data  )  -  1  );
		gHealthRegenerationLevel[  id  ][  i  ]  =  clamp(  str_to_num(  iLevel  ),  NULL,  gHealthRegenerationMaxLevels[  i  ]  );
	}
	for(  new CsTeams:i = CS_TEAM_FURIEN; i <= CS_TEAM_ANTIFURIEN; i++  )
	{
		strbreak(  data,  iLevel,  sizeof  (  iLevel  )  -  1,  data,  sizeof  (  data  )  -  1  );
		gArmorChargerLevel[  id  ][  i  ]  =  clamp(  str_to_num(  iLevel  ),  NULL,  gArmorChargerMaxLevels[  i  ]  );
	}
	
}

public UserIsNew(  id  )
{
	
	gFirstTimePlayed[  id  ]  =  true;
	gUserXp[  id  ]  =  get_pcvar_num(  gCvarEntryXP  );
	
	for(  new CsTeams:i = CS_TEAM_FURIEN; i <= CS_TEAM_ANTIFURIEN; i++  )
	{
		gHealthLevel[  id  ][  i  ]  =  NULL;
		gArmorLevel[  id  ][  i  ]  =  NULL;
		gSpeedLevel[  id  ][  i  ]  =  NULL;
		gGravityLevel[  id  ][  i  ]  =  NULL;
		gDamageMultiplierLevel[  id  ][  i  ]  =  NULL;
		gRespawnLevel[  id  ][  i  ]  =  NULL;
		gHealthRegenerationLevel[  id  ][  i  ]  =  NULL;
		gArmorChargerLevel[  id  ][  i  ]  =  NULL;
	}
	
}

public Save(  id  )
{
	
	static data[  256  ];
	new  len  =  formatex(  data,  sizeof  (  data  )  - 1,  "%i", gUserXp[  id  ]);
	
	for(  new CsTeams:i = CS_TEAM_FURIEN; i <= CS_TEAM_ANTIFURIEN; i++   )
	{
		len  +=  formatex(  data[  len  ],  sizeof(  data  )  -  len  -  1 ,  " %i", gHealthLevel[  id  ][  i  ]  );
	}
	
	for(  new CsTeams:i = CS_TEAM_FURIEN; i <= CS_TEAM_ANTIFURIEN; i++   )
	{
		len  +=  formatex(  data[  len  ],  sizeof(  data  )  -  len  -  1 ,  " %i", gArmorLevel[  id  ][  i  ]  );
	}
	for(  new CsTeams:i = CS_TEAM_FURIEN; i <= CS_TEAM_ANTIFURIEN; i++   )
	{
		len  +=  formatex(  data[  len  ],  sizeof(  data  )  -  len  -  1 ,  " %i", gSpeedLevel[  id  ][  i  ]  );
	}
	for(  new CsTeams:i = CS_TEAM_FURIEN; i <= CS_TEAM_ANTIFURIEN; i++   )
	{
		len  +=  formatex(  data[  len  ],  sizeof(  data  )  -  len  -  1 ,  " %i", gGravityLevel[  id  ][  i  ]  );
	}
	for(  new CsTeams:i = CS_TEAM_FURIEN; i <= CS_TEAM_ANTIFURIEN; i++   )
	{
		len  +=  formatex(  data[  len  ],  sizeof(  data  )  -  len  -  1 ,  " %i", gDamageMultiplierLevel[  id  ][  i  ]  );
	}
	for(  new CsTeams:i = CS_TEAM_FURIEN; i <= CS_TEAM_ANTIFURIEN; i++   )
	{
		len  +=  formatex(  data[  len  ],  sizeof(  data  )  -  len  -  1 ,  " %i", gRespawnLevel[  id  ][  i  ]  );
	}
	for(  new CsTeams:i = CS_TEAM_FURIEN; i <= CS_TEAM_ANTIFURIEN; i++   )
	{
		len  +=  formatex(  data[  len  ],  sizeof(  data  )  -  len  -  1 ,  " %i", gHealthRegenerationLevel[  id  ][  i  ]  );
	}
	for(  new CsTeams:i = CS_TEAM_FURIEN; i <= CS_TEAM_ANTIFURIEN; i++   )
	{
		len  +=  formatex(  data[  len  ],  sizeof(  data  )  -  len  -  1 ,  " %i", gArmorChargerLevel[  id  ][  i  ]  );
	}
	new  szName[  32  ];
	get_user_name(  id,  szName,  sizeof  (  szName  )  -1  );
	
	nvault_set(  gVault,  szName,  data  );
	
}

public BlockedCommand(  id  ) 
{
	console_print(  id,"%s You can not use a restricted command !",  MESSAGE_TAG  );
	return 1;
}

public PrintGeneralHelp(  id  )
{
	
	if(  !IsUserOK(  id  )  )  return 1;
	
	static motd[  2500  ];
	new len = formatex( motd, sizeof ( motd )  - 1,	"<html>"  );
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "<style type=^"text/css^">"  );
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "body{background-image: url(^"http://i52.tinypic.com/qoukhx.png^");font-family:Tahoma;font-size:15px;color:#FFFFFF;}"  );
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "table{font-family:Tahoma;font-size:10px;color:#FFFFFF;}</style>"  );
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "<body><center><font face=^"Verdana^" size=^"2^"><b><br>"  );
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "<font size=^"4^" color=^"#B80000^">%s<br>",  PLUGIN  );
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "v%s by Askhanar</font><br><br>", VERSION  );
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "%s este un addon modificat al modului Furien.<br>",  PLUGIN  );
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "Jucatorii castiga puncte de experienta pe cat de bine joaca.<br><br><br>"  );
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "</center><table align=center width=65%% cellpadding=1 cellspacing=0 >"  );
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "<tr align=center > <th width=13%%> Actiune <th width=13%%> Arma <th width=13%%>Headshot<th width=13%%>Experienta Jucatori<th width=13%%>Experienta VIP"  );
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "<tr align=center > <td> Omori un jucator</td>  <td> Toate</td> <td> -</td><td> %d</td><td> x2</td>",  get_pcvar_num(  gCvarKillXP  )  );
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "<tr align=center > <td> Omori un jucator( Bonus )</td>  <td> Toate</td> <td> Da</td><td> %d</td><td> x2</td>",  get_pcvar_num(  gCvarHeadShotKillXP  )  );
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "<tr align=center > <td> Omori un jucator( Bonus )</td>  <td> Grenada</td> <td> -<td> %d</td><td> x2</td>",  get_pcvar_num(  gCvarGrenadeKillXP  )  );
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "<tr align=center > <td> Omori un jucator( Bonus )</td>  <td> Cutit</td> <td> -<td> %d</td><td> x2</td>",  get_pcvar_num(  gCvarKnifeKillXP  )  );
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "<tr align=center > <td> Supravietuiesti( AntiFurien )</td>  <td> -</td> <td> -<td> %d</td><td> x2</td>",  get_pcvar_num(  gCvarSurviveXP  )  );
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "<tr align=center > <td> Castigi Runda</td>  <td> -</td> <td> -<td> %d</td><td> x2</td>",  get_pcvar_num(  gCvarWinXP  )  );
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "</table><center><br><br>"  );
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "Cu aceste puncte de Experienta, poti cumpara upgrade-uri.<br>"  );
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "Pentru o lista a acestor upgrade-uri, scrie /XP din nou si vizualizeaza alte meniuri."  );
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "</center></body></html>"  );
	
	show_motd(  id,  motd,  "Ajutor General");
	return 1;
}
public PrintHealthHelp(  id  )
{
	static motd[  2500  ];
	new len = formatex( motd, sizeof ( motd )  - 1,	"<html>"  );
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "<style type=^"text/css^">"  );
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "body{background-image: url(^"http://i52.tinypic.com/qoukhx.png^");font-family:Tahoma;font-size:15px;color:#FFFFFF;}"  );
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "table{font-family:Tahoma;font-size:10px;color:#FFFFFF;}</style>"  );
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "<body><center><font face=^"Verdana^" size=^"2^"><b><br>"  );
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "<font size=^"4^" color=^"#B80000^">%s<br>",  PLUGIN  );
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "</font><br><br>"  );
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "Upgrade-ul Viata reprezinta cat HP primesti in plus la inceputul rundei.<br><br><br>"  );
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "</center><table align=center width=35%% cellpadding=1 cellspacing=0 >"  );
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "<tr align=center > <th width=15%%> Informatii"  );
	
	for(  new CsTeams:i = CS_TEAM_FURIEN;  i <= CS_TEAM_ANTIFURIEN;  i++  )
	{
		if(  gHealthEnabled[  i  ]  )
		{
			len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "<th width=10%%> %s",  gHealthNames[  i  ]  );
		}
	}
	
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "<tr align=center > <td> Intervale Viata</td>"  );
	
	for(  new CsTeams:i = CS_TEAM_FURIEN;  i <= CS_TEAM_ANTIFURIEN;  i++  )
	{
		if(  gHealthEnabled[  i  ]  )
		{
			len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "<th width=10%%> %i",  gHealthMaxAmount[  i  ]  /  gHealthMaxLevels[  i  ]  );
		}
	}
	
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "<tr align=center > <td> Level Maxim</td>"  );
	
	for(  new CsTeams:i = CS_TEAM_FURIEN;  i <= CS_TEAM_ANTIFURIEN;  i++  )
	{
		if(  gHealthEnabled[  i  ]  )
		{
			len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "<th width=10%%> %i", gHealthMaxLevels[  i  ]  );
		}
	}
	
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "<tr align=center > <td> Viata maxima</td>"  );
	
	for(  new CsTeams:i = CS_TEAM_FURIEN;  i <= CS_TEAM_ANTIFURIEN;  i++  )
	{
		if(  gHealthEnabled[  i  ]  )
		{
			len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "<th width=10%%> %i", gHealthMaxAmount[  i  ]  );
		}
	}
	
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "</table><center>"  );
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "</center></body></html>"  );
	
	show_motd(  id,  motd,  "Ajutor Viata");
}

public PrintArmorHelp( id )
{
	static motd[  2500  ];
	new len = formatex( motd, sizeof ( motd )  - 1,	"<html>"  );
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "<style type=^"text/css^">"  );
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "body{background-image: url(^"http://i52.tinypic.com/qoukhx.png^");font-family:Tahoma;font-size:15px;color:#FFFFFF;}"  );
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "table{font-family:Tahoma;font-size:10px;color:#FFFFFF;}</style>"  );
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "<body><center><font face=^"Verdana^" size=^"2^"><b><br>"  );
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "<font size=^"4^" color=^"#B80000^">%s<br>",  PLUGIN  );
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "</font><br><br>"  );
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "Upgrade-ul Armura reprezinta cat AP primesti in plus la inceputul rundei.<br><br><br>"  );
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "</center><table align=center width=35%% cellpadding=1 cellspacing=0 >"  );
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "<tr align=center > <th width=15%%> Informatii"  );
	
	for(  new CsTeams:i = CS_TEAM_FURIEN;  i <= CS_TEAM_ANTIFURIEN;  i++  )
	{
		if(  gArmorEnabled[  i  ]  )
		{
			len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "<th width=10%%> %s",  gArmorNames[  i  ]  );
		}
	}
	
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "<tr align=center > <td> Intervale Armura</td>"  );
	
	for(  new CsTeams:i = CS_TEAM_FURIEN;  i <= CS_TEAM_ANTIFURIEN;  i++  )
	{
		if(  gArmorEnabled[  i  ]  )
		{
			len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "<th width=10%%> %i",  gArmorMaxAmount[  i  ]  /  gArmorMaxLevels[  i  ]  );
		}
	}
	
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "<tr align=center > <td> Level Maxim</td>"  );
	
	for(  new CsTeams:i = CS_TEAM_FURIEN;  i <= CS_TEAM_ANTIFURIEN;  i++  )
	{
		if(  gArmorEnabled[  i  ]  )
		{
			len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "<th width=10%%> %i", gArmorMaxLevels[  i  ]  );
		}
	}
	
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "<tr align=center > <td> Armura Maxima</td>"  );
	
	for(  new CsTeams:i = CS_TEAM_FURIEN;  i <= CS_TEAM_ANTIFURIEN;  i++  )
	{
		if(  gArmorEnabled[  i  ]  )
		{
			len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "<th width=10%%> %i", gArmorMaxAmount[  i  ]  );
		}
	}
	
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "</table><center>"  );
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "</center></body></html>"  );
	
	show_motd(  id,  motd,  "Ajutor Armura");
}

public PrintSpeedHelp( id )
{
	static motd[  2500  ];
	new len = formatex( motd, sizeof ( motd )  - 1,	"<html>"  );
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "<style type=^"text/css^">"  );
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "body{background-image: url(^"http://i52.tinypic.com/qoukhx.png^");font-family:Tahoma;font-size:15px;color:#FFFFFF;}"  );
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "table{font-family:Tahoma;font-size:10px;color:#FFFFFF;}</style>"  );
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "<body><center><font face=^"Verdana^" size=^"2^"><b><br>"  );
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "<font size=^"4^" color=^"#B80000^">%s<br>",  PLUGIN  );
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "</font><br><br>"  );
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "Upgrade-ul Viteza reprezinta viteza cu care esti capabil sa te misti.<br><br><br>"  );
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "</center><table align=center width=35%% cellpadding=1 cellspacing=0 >"  );
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "<tr align=center > <th width=15%%> Informatii"  );
	
	for(  new CsTeams:i = CS_TEAM_FURIEN;  i <= CS_TEAM_ANTIFURIEN;  i++  )
	{
		if(  gSpeedEnabled[  i  ]  )
		{
			len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "<th width=10%%> %s",  gSpeedNames[  i  ]  );
		}
	}
	
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "<tr align=center > <td> Viteza Default</td>"  );
	
	for(  new CsTeams:i = CS_TEAM_FURIEN;  i <= CS_TEAM_ANTIFURIEN;  i++  )
	{
		if(  gSpeedEnabled[  i  ]  )
		{
			if(  i  ==  CS_TEAM_FURIEN  )
			{
				len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "<th width=10%%> %.1f",  gFurienSpeedLevels[  0  ] );
			}
			else if(  i  ==  CS_TEAM_ANTIFURIEN  )
			{
				len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "<th width=10%%> %.1f",  gAntiFurienSpeedLevels[  0  ]  );
			}
		}
	}
	
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "<tr align=center > <td> Level Maxim</td>"  );
	
	for(  new CsTeams:i = CS_TEAM_FURIEN;  i <= CS_TEAM_ANTIFURIEN;  i++  )
	{
		if(  gSpeedEnabled[  i  ]  )
		{
			len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "<th width=10%%> %i", gSpeedMaxLevels[  i  ]  );
		}
	}
	
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "<tr align=center > <td> Viteza Maxima</td>"  );
	
	for(  new CsTeams:i = CS_TEAM_FURIEN;  i <= CS_TEAM_ANTIFURIEN;  i++  )
	{
		if(  gSpeedEnabled[  i  ]  )
		{
			if(  i  ==  CS_TEAM_FURIEN  )
			{
				len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "<th width=10%%> %.1f",  gFurienSpeedLevels[  gSpeedMaxLevels[  i  ]  ] );
			}
			else if(  i  ==  CS_TEAM_ANTIFURIEN  )
			{
				len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "<th width=10%%> %.1f",  gAntiFurienSpeedLevels[  gSpeedMaxLevels[  i  ]  ]  );
			}
		}
	}
	
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "</table><center>"  );
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "</center></body></html>"  );
	
	show_motd(  id,  motd,  "Ajutor Viteza");
}

public PrintGravityHelp( id )
{
	static motd[  2500  ];
	new len = formatex( motd, sizeof ( motd )  - 1,	"<html>"  );
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "<style type=^"text/css^">"  );
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "body{background-image: url(^"http://i52.tinypic.com/qoukhx.png^");font-family:Tahoma;font-size:15px;color:#FFFFFF;}"  );
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "table{font-family:Tahoma;font-size:10px;color:#FFFFFF;}</style>"  );
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "<body><center><font face=^"Verdana^" size=^"2^"><b><br>"  );
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "<font size=^"4^" color=^"#B80000^">%s<br>",  PLUGIN  );
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "</font><br><br>"  );
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "Upgrade-ul Gravitate reprezinta gravitatea care o are jucatorul ( gravitate mica = sarituri inalte ).<br><br><br>" );
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "</center><table align=center width=45%% cellpadding=1 cellspacing=0 >"  );
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "<tr align=center > <th width=15%%> Informatii"  );
	
	for(  new CsTeams:i = CS_TEAM_FURIEN;  i <= CS_TEAM_ANTIFURIEN;  i++  )
	{
		if(  gGravityEnabled[  i  ]  )
		{
			len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "<th width=15%%> %s",  gGravityNames[  i  ]  );
		}
	}
	
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "<tr align=center > <td> Gravitate Default</td>"  );
	
	for(  new CsTeams:i = CS_TEAM_FURIEN;  i <= CS_TEAM_ANTIFURIEN;  i++  )
	{
		if(  gGravityEnabled[  i  ]  )
		{
			if(  i  ==  CS_TEAM_FURIEN  )
			{
				len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "<th width=10%%> %.1f",  gFurienGravityLevels[  0  ]  /  0.00125 );
			}
			else if(  i  ==  CS_TEAM_ANTIFURIEN  )
			{
				len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "<th width=10%%> %.1f",  gAntiFurienGravityLevels[  0  ]  /  0.00125 );
			}
		}
	}
	
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "<tr align=center > <td> Level Maxim</td>"  );
	
	for(  new CsTeams:i = CS_TEAM_FURIEN;  i <= CS_TEAM_ANTIFURIEN;  i++  )
	{
		if(  gGravityEnabled[  i  ]  )
		{
			len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "<th width=10%%> %i", gGravityMaxLevels[  i  ]  );
		}
	}
	
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "<tr align=center > <td> Gravitate Maxima</td>"  );
	
	for(  new CsTeams:i = CS_TEAM_FURIEN;  i <= CS_TEAM_ANTIFURIEN;  i++  )
	{
		if(  gGravityEnabled[  i  ]  )
		{
			if(  i  ==  CS_TEAM_FURIEN  )
			{
				len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "<th width=10%%> %.1f",  gFurienGravityLevels[  gGravityMaxLevels[  i  ]  ]  /  0.00125  );
			}
			else if(  i  ==  CS_TEAM_ANTIFURIEN  )
			{
				len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "<th width=10%%> %.1f",  gAntiFurienGravityLevels[  gGravityMaxLevels[  i  ]  ]  /  0.00125  );
			}
		}
	}
	
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "</table><center>"  );
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "</center></body></html>"  );
	
	show_motd(  id,  motd,  "Ajutor Gravitate");
}

public PrintDamageMultiplierHelp( id )
{
	static motd[  2500  ];
	new len = formatex( motd, sizeof ( motd )  - 1,	"<html>"  );
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "<style type=^"text/css^">"  );
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "body{background-image: url(^"http://i52.tinypic.com/qoukhx.png^");font-family:Tahoma;font-size:15px;color:#FFFFFF;}"  );
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "table{font-family:Tahoma;font-size:10px;color:#FFFFFF;}</style>"  );
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "<body><center><font face=^"Verdana^" size=^"2^"><b><br>"  );
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "<font size=^"4^" color=^"#B80000^">%s<br>",  PLUGIN  );
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "</font><br><br>"  );
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "Upgrade-ul Multiplicare Damage iti mareste damage-ul ( ex: marit cu 50%%, 100 damage va fi 150 ).<br><br><br>"  );
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "</center><table align=center width=51%% cellpadding=1 cellspacing=0 >"  );
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "<tr align=center > <th width=15%%> Informatii"  );
	
	for(  new CsTeams:i = CS_TEAM_FURIEN;  i <= CS_TEAM_ANTIFURIEN;  i++  )
	{
		if(  gDamageMultiplierEnabled[  i  ]  )
		{
			len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "<th width=18%%> %s",  gDamageMultiplierNames[  i  ]  );
		}
	}
	
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "<tr align=center > <td> Intervale Damage</td>"  );
	
	for(  new CsTeams:i = CS_TEAM_FURIEN;  i <= CS_TEAM_ANTIFURIEN;  i++  )
	{
		if(  gDamageMultiplierEnabled[  i  ]  )
		{
			if(  i  ==  CS_TEAM_FURIEN  )
			{
				len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "<th width=10%%> %.1f%%",  gFurienMaxDamageMultiplier  /  gDamageMultiplierMaxLevels[  i  ] * 100 + 0.1);
			}
			else if(  i  ==  CS_TEAM_ANTIFURIEN  )
			{
				len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "<th width=10%%> %.1f%%",  gAntiFurienMaxDamageMultiplier  /  gDamageMultiplierMaxLevels[  i  ] * 100 );
			}
		}
	}
	
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "<tr align=center > <td> Level Maxim</td>"  );
	
	for(  new CsTeams:i = CS_TEAM_FURIEN;  i <= CS_TEAM_ANTIFURIEN;  i++  )
	{
		if(  gDamageMultiplierEnabled[  i  ]  )
		{
			len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "<th width=10%%> %i", gDamageMultiplierMaxLevels[  i  ]  );
		}
	}
	
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "<tr align=center > <td> Multiplicare Maxima</td>"  );
	
	for(  new CsTeams:i = CS_TEAM_FURIEN;  i <= CS_TEAM_ANTIFURIEN;  i++  )
	{
		if(  gDamageMultiplierEnabled[  i  ]  )
		{
			if(  i  ==  CS_TEAM_FURIEN  )
			{
				len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "<th width=10%%> %.1f%%",  gFurienMaxDamageMultiplier  *  100 + 0.1  );
			}
			else if(  i  ==  CS_TEAM_ANTIFURIEN  )
			{
				len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "<th width=10%%> %.1f%%",  gAntiFurienMaxDamageMultiplier  *  100  );
			}
		}
	}
	
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "</table><center>"  );
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "</center></body></html>"  );
	
	show_motd(  id,  motd,  "Ajutor Multiplicare Damage");
}
public PrintRespawnHelp( id )
{
	static motd[  2500  ];
	new len = formatex( motd, sizeof ( motd )  - 1,	"<html>"  );
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "<style type=^"text/css^">"  );
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "body{background-image: url(^"http://i52.tinypic.com/qoukhx.png^");font-family:Tahoma;font-size:15px;color:#FFFFFF;}"  );
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "table{font-family:Tahoma;font-size:10px;color:#FFFFFF;}</style>"  );
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "<body><center><font face=^"Verdana^" size=^"2^"><b><br>"  );
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "<font size=^"4^" color=^"#B80000^">%s<br>",  PLUGIN  );
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "</font><br><br>"  );
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "Upgrade-ul Respawn reprezinta sansa care o ai sa primesti respawn atunci cand mori.<br><br><br>" );
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "</center><table align=center width=45%% cellpadding=1 cellspacing=0 >"  );
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "<tr align=center > <th width=15%%> Informatii"  );
	
	for(  new CsTeams:i = CS_TEAM_FURIEN;  i <= CS_TEAM_ANTIFURIEN;  i++  )
	{
		if(  gRespawnEnabled[  i  ]  )
		{
			len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "<th width=15%%> %s",  gRespawnNames[  i  ]  );
		}
	}
	
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "<tr align=center > <td> Intervale Sansa</td>"  );
	
	for(  new CsTeams:i = CS_TEAM_FURIEN;  i <= CS_TEAM_ANTIFURIEN;  i++  )
	{
		if(  gRespawnEnabled[  i  ]  )
		{
			len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "<th width=10%%> %i%%",  gRespawnMaxAmount[  i  ]  /  gRespawnMaxLevels[  i  ]  );
		}
	}
	
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "<tr align=center > <td> Level Maxim</td>"  );
	
	for(  new CsTeams:i = CS_TEAM_FURIEN;  i <= CS_TEAM_ANTIFURIEN;  i++  )
	{
		if(  gRespawnEnabled[  i  ]  )
		{
			len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "<th width=10%%> %i", gRespawnMaxLevels[  i  ]  );
		}
	}
	
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "<tr align=center > <td> Sansa Maxima</td>"  );
	
	for(  new CsTeams:i = CS_TEAM_FURIEN;  i <= CS_TEAM_ANTIFURIEN;  i++  )
	{
		if(  gRespawnEnabled[  i  ]  )
		{
			len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "<th width=10%%> %i%%", gRespawnMaxAmount[  i  ]  );
		}
	}
	
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "</table><center>"  );
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "</center></body></html>"  );
	
	show_motd(  id,  motd,  "Ajutor Respawn");
}

public PrintHealthRegenerationHelp( id )
{
	static motd[  2500  ];
	new len = formatex( motd, sizeof ( motd )  - 1,	"<html>"  );
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "<style type=^"text/css^">"  );
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "body{background-image: url(^"http://i52.tinypic.com/qoukhx.png^");font-family:Tahoma;font-size:15px;color:#FFFFFF;}"  );
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "table{font-family:Tahoma;font-size:10px;color:#FFFFFF;}</style>"  );
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "<body><center><font face=^"Verdana^" size=^"2^"><b><br>"  );
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "<font size=^"4^" color=^"#B80000^">%s<br>",  PLUGIN  );
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "</font><br><br>"  );
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "Upgrade-ul Regenerare Viata reprezinca cantitatea de HP care o primesti / secunda ( daca nu ai viata full ).<br><br><br>"  );
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "</center><table align=center width=51%% cellpadding=1 cellspacing=0 >"  );
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "<tr align=center > <th width=15%%> Informatii"  );
	
	for(  new CsTeams:i = CS_TEAM_FURIEN;  i <= CS_TEAM_ANTIFURIEN;  i++  )
	{
		if(  gHealthEnabled[  i  ]  )
		{
			len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "<th width=18%%> %s",  gHealthRegenerationNames[  i  ]  );
		}
	}
	
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "<tr align=center > <td> Intervale Regenerare</td>"  );
	
	for(  new CsTeams:i = CS_TEAM_FURIEN;  i <= CS_TEAM_ANTIFURIEN;  i++  )
	{
		if(  gHealthEnabled[  i  ]  )
		{
			len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "<th width=10%%> %i",  gHealthRegenerationMaxAmount[  i  ]  /  gHealthRegenerationMaxLevels[  i  ]  );
		}
	}
	
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "<tr align=center > <td> Level Maxim</td>"  );
	
	for(  new CsTeams:i = CS_TEAM_FURIEN;  i <= CS_TEAM_ANTIFURIEN;  i++  )
	{
		if(  gHealthEnabled[  i  ]  )
		{
			len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "<th width=10%%> %i", gHealthRegenerationMaxLevels[  i  ]  );
		}
	}
	
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "<tr align=center > <td> Viata Maxima / Secunda</td>"  );
	
	for(  new CsTeams:i = CS_TEAM_FURIEN;  i <= CS_TEAM_ANTIFURIEN;  i++  )
	{
		if(  gHealthEnabled[  i  ]  )
		{
			len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "<th width=10%%> %i", gHealthRegenerationMaxAmount[  i  ]  );
		}
	}
	
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "</table><center>"  );
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "</center></body></html>"  );
	
	show_motd(  id,  motd,  "Ajutor Regenerare Viata");
}

public PrintArmorChargerHelp( id )
{
	static motd[  2500  ];
	new len = formatex( motd, sizeof ( motd )  - 1,	"<html>"  );
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "<style type=^"text/css^">"  );
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "body{background-image: url(^"http://i52.tinypic.com/qoukhx.png^");font-family:Tahoma;font-size:15px;color:#FFFFFF;}"  );
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "table{font-family:Tahoma;font-size:10px;color:#FFFFFF;}</style>"  );
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "<body><center><font face=^"Verdana^" size=^"2^"><b><br>"  );
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "<font size=^"4^" color=^"#B80000^">%s<br>",  PLUGIN  );
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "</font><br><br>"  );
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "Upgrade-ul Reincarcare Armura reprezinca cantitatea de AP care o primesti / secunda ( daca nu ai armura full ).<br><br><br>"  );
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "</center><table align=center width=51%% cellpadding=1 cellspacing=0 >"  );
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "<tr align=center > <th width=15%%> Informatii"  );
	
	for(  new CsTeams:i = CS_TEAM_FURIEN;  i <= CS_TEAM_ANTIFURIEN;  i++  )
	{
		if(  gArmorEnabled[  i  ]  )
		{
			len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "<th width=18%%> %s",  gArmorNames[  i  ]  );
		}
	}
	
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "<tr align=center > <td> Intervale Reincarcare</td>"  );
	
	for(  new CsTeams:i = CS_TEAM_FURIEN;  i <= CS_TEAM_ANTIFURIEN;  i++  )
	{
		if(  gArmorEnabled[  i  ]  )
		{
			len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "<th width=10%%> %i",  gArmorChargerMaxAmount[  i  ]  /  gArmorChargerMaxLevels[  i  ]  );
		}
	}
	
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "<tr align=center > <td> Level Maxim</td>"  );
	
	for(  new CsTeams:i = CS_TEAM_FURIEN;  i <= CS_TEAM_ANTIFURIEN;  i++  )
	{
		if(  gArmorEnabled[  i  ]  )
		{
			len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "<th width=10%%> %i", gArmorChargerMaxLevels[  i  ]  );
		}
	}
	
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "<tr align=center > <td> Armura Maxima / Secunda</td>"  );
	
	for(  new CsTeams:i = CS_TEAM_FURIEN;  i <= CS_TEAM_ANTIFURIEN;  i++  )
	{
		if(  gArmorEnabled[  i  ]  )
		{
			len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "<th width=10%%> %i", gArmorChargerMaxAmount[  i  ]  );
		}
	}
	
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "</table><center>"  );
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "</center></body></html>"  );
	
	show_motd(  id,  motd,  "Ajutor Reincarcare Armura");
}

public plugin_end(    )
{
	
	nvault_prune( gVault,  0,  get_systime(    )  -  (  ONE_DAY_IN_SECONDS  *  15  )  );
	nvault_close( gVault );
	remove_task(  112233  );
}

PlaySound(  id,  const szSound[    ]  )
{
	emit_sound(  id, CHAN_AUTO, szSound, 1.0, ATTN_NORM, 0, PITCH_NORM  );
}

MakeFog(  id,  const iRed,  const iGreen,  const iBlue,  const iSD,  const iED,  const iD1,  const iD2  )
{
	
	message_begin(  id  ==  0 ? MSG_ALL  : MSG_ONE,  get_user_msgid( "Fog" ),  {0, 0, 0},  id  );
	write_byte( iRed );  // R
	write_byte( iGreen );  // G
	write_byte( iBlue );  // B
	write_byte( iSD ); // SD
	write_byte( iED );  // ED
	write_byte( iD1 );   // D1
	write_byte( iD2 );  // D2
	message_end(  );
}

ShakeScreen( id, const Float:seconds  )
{
	message_begin(  MSG_ONE,  get_user_msgid( "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(  );
	
}

FadeScreen(  id, const Float:seconds,  const red,  const green,  const blue,  const alpha  )
{      
	message_begin(  MSG_ONE, get_user_msgid( "ScreenFade" ), _, 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(  );

}

stock UserHasTeamMatesAlive(  id,  CsTeams:Team  )
{
	
	for(  new i = gFirstPlayer;  i <= gMaxPlayers;  i++  )
	{
		if(  i  ==  id  ) continue;
		
		if(  is_user_alive(  i  )  &&  cs_get_user_team(  i  )  ==  Team  )
		{
			return 1;
		}
	}
	
	return 0;
	
}

stock bool:IsUserVip(  id  )
{
	
	if( get_user_flags(  id  )  &  read_flags(  "vxy"  )  )
		return true;
	
	return false;
	
}

stock bool:UserHasFullAcces(  id  )
{
	if( get_user_flags(  id  )  ==  read_flags( "abcdefghijklmnopqrstu"  )
		|| get_user_flags(  id  )  ==  read_flags( "abcdefghijklmnopqrstuvxy"  )  )
		return true;
	
	return false;
	
}

stock bool:IsUserOK(  id  )
{
	
	if( is_user_connected(  id  )  &&  !is_user_bot(  id  )   )
		return true;
	
	return false;
	
}
Pluginuri:

Code: Select all

;pana aici sunt plugin`urile default ale addons`ului.


; Admin free look
admin_freelook.amxx

; Team semiclip
team_semiclip.amxx

; Furien Mod Ultimate..
; Am pus debug ca in caz ca apare vreo eroare spune direct care e..

FurienModUltimate.amxx debug
fmu_events.amxx debug
fmu_weapons.amxx debug
fmu_wallhang.amxx debug
fmu_aim_messages.amxx debug
fmu_bombevents.amxx debug
FMU_BackUP.amxx debug

fmu_christmass.amxx
fmu_snow.amxx

; Plugin`uri care infrumuseteaza gameplay-ul
nademodes.amxx
multijump.amxx

; Te pune automat la echipa si nu poti folosi jointeam.
team_join.amxx
anti_jointeam.amxx

; Ii pune modelul fiecarui jucator.
players_models.amxx

; Nu primesti dmg cand explodeaza bomba langa tine, si o poti planta pe pereti..
no_c4_damage.amxx
sillyc4.amxx

; Ajutorul adminilor..
Show-IP.amxx
Last-IP.amxx
No-Retry.amxx

; Reset Score..
resetscore.amxx

; Adminii cu grad mai mare scriu colorat.
All-Chat.amxx
Altele:

fmu_aim_messages.sma

Code: Select all

#include <  amxmodx  >
#include <  cstrike  >
#include <  fakemeta  >

#pragma semicolon 1


#define PLUGIN "Furien Aiming Messages"
#define VERSION "1.0"

#define IsPlayer(%1) ( 1 <= %1 <= g_MaxPlayers ) 

new g_MaxPlayers;

public plugin_init(    )
{
	register_plugin(  PLUGIN,  VERSION,  "Askhanar"  );
	
	register_forward(  FM_PlayerPreThink,  "fwdPlayerPreThink"  );
	
	g_MaxPlayers  =  global_get(  glb_maxClients  );
}

public fwdPlayerPreThink(  id  )
{
	
	if(  is_user_alive(  id  )  )
	{
		
		new target, body; 
		get_user_aiming(  id,  target,  body,  9999  );
		
		new CsTeams:team  =  cs_get_user_team(  id  );
		
		if(   is_user_alive(  target  )  )
		{
			if(  IsPlayer(  target  )  )
			{
			
				new CsTeams:targetTeam  =  cs_get_user_team(  target  );
				
				new sName[  32  ];
				get_user_name(  target,   sName,  sizeof  (  sName  )  -1  );
							
				new sMessage[  64  ];
				if(  targetTeam  ==  team  )
				{
					formatex(  sMessage, sizeof  (  sMessage  )  -1, "%s: %s Health: %i", IsUserVip(  target  ) ?  "VIP" : "Friend",  sName,  get_user_health(  target  )  );
				}
				else if(  targetTeam  !=  team  &&  team  !=  CS_TEAM_CT  )
				{
					formatex(  sMessage, sizeof  (  sMessage  )  -1, "%s: %s Health: %i", IsUserVip(  target  ) ?  "VIP" : "Enemy",  sName,  get_user_health(  target  )  );
				}
					
				if(  targetTeam  ==  CS_TEAM_CT  )
				{
					set_hudmessage( 0, 63, 127, -1.0, -1.0, 0, 0.0, 0.1, 0.0, 0.0, -1 );
				}
				else if( targetTeam == CS_TEAM_T )
				{
					set_hudmessage( 127, 0, 0, -1.0, -1.0, 0, 0.0, 0.1, 0.0, 0.0, -1 );
				}	
				
				
				show_hudmessage(  id,  "%s",  sMessage  );
			}
		}
	}
	
	return FMRES_IGNORED;
}

stock bool:IsUserVip(  id  )
{
	
	if( get_user_flags(  id  )  &  read_flags(  "vxy"  )  )
		return true;
	
	return false;
	
}
FMU_BackUP.sma

Code: Select all

#include < amxmodx >
#include < nvault_util >
#include < CC_ColorChat >

#pragma semicolon 1


#define PLUGIN "FMU Back-UP"
#define VERSION "1.0"

#define	BACKUP_TASK	332211

new const g_szFurienModUltimateFile[ ] = "FurienModUltimate";
new const g_szTag[ ] = "[Furien Mod Ultimate]";

public plugin_init( )
{
	register_plugin( PLUGIN, VERSION, "Askhanar" );
	register_clcmd( "say /generatebackup", "ClCmdGenerateBackUP" );
	
	set_task( 90.0, "GenerateBackUP", BACKUP_TASK );
	
}

public ClCmdGenerateBackUP( id )
{
	if( !UserHasFullAcces(  id  ) )
	{
		ColorChat( id, RED, "^x04%s^x03 NU^x01 ai acces la aceasta comanda.", g_szTag );
		return 1;
	}
	
	remove_task( BACKUP_TASK );
	GenerateBackUP( );
	
	return 0;
}

public GenerateBackUP( )
{
	ColorChat( 0, RED, "^x04%s^x01 In^x03 10^x01 secunde, serverul va genera un fisier de tip^x03 BACK-UP^x01.", g_szTag );
	ColorChat( 0, RED, "^x04%s^x01 Fiti ingaduitori, se poate crea putin lag.", g_szTag );
	ColorChat( 0, RED, "^x04%s^x01 Cei ce nu inteleg termenul^x03 BACK-UP^x01 ignorati acest mesaj.", g_szTag );
	client_cmd( 0, "spk ^"fvox/warning.wav^"" );
	set_task( 10.0, "CreateBackUP" );
}

public CreateBackUP( )
{
	
	new iKeyPos, szKey[ 32 ], szKeyValue[ 64 ], iKeyTimeStamp;

	new iVaultToRead = nvault_util_open( g_szFurienModUltimateFile );
	new iVaultEntryes = nvault_util_count( iVaultToRead );
	
	new szCurentDateAndTime[ 32 ], szVaultToWrite[ 64 ];
	get_time("%d-%m-%Y_%H-%M-%S", szCurentDateAndTime ,sizeof ( szCurentDateAndTime ) -1 );
	
	formatex( szVaultToWrite, sizeof ( szVaultToWrite ) -1, "%s_BAK_%s", g_szFurienModUltimateFile, szCurentDateAndTime );
	new iVaultToWrite = nvault_open( szVaultToWrite );
	
	for ( new iCurrent = 1 ; iCurrent <= iVaultEntryes ; iCurrent++ )
	{
		
		iKeyPos = nvault_util_read( iVaultToRead , iKeyPos , szKey , sizeof ( szKey ) -1, szKeyValue , sizeof ( szKeyValue ) , iKeyTimeStamp );
		nvault_set( iVaultToWrite, szKey, szKeyValue );
		nvault_touch( iVaultToWrite, szKey, iKeyTimeStamp );
		
		//server_print( "[%d din %d] Key=%s Value=%s Timestamp=%d" , iCurrent , iVaultEntryes , szKey , szKeyValue ,  iKeyTimeStamp );
	}
	
	nvault_close( iVaultToWrite );
	nvault_util_close( iVaultToRead );
	
	ColorChat( 0, RED, "^x04%s^x01 Fisierul^x03 %s^x01 a fost generat cu succes.", g_szTag, szVaultToWrite );
	ColorChat( 0, RED, "^x04%s^x01 Va puteti relua jocul.", g_szTag );
}


stock bool:UserHasFullAcces(  id  )
{
	if( get_user_flags(  id  )  ==  read_flags( "abcdefghijklmnopqrstu"  )
		|| get_user_flags(  id  )  ==  read_flags( "abcdefghijklmnopqrstuvxy"  )  )
		return true;
	
	return false;
	
}
fmu_bombevents.sma

Code: Select all

#include <amxmodx>
#include <csx>

#pragma semicolon 1


#define PLUGIN "FMU Bomb Events"
#define VERSION "1.0"

#define C4_TASK		112233

new const g_szBombPlantedSounds[ ][ ] =
{
	"fmu_bombplanted.mp3",
	"fmu_bombplanted2.mp3"
};

new const g_iRed[ ] =
{
	0,
	125,
	255
};

new const g_iGreen[ ] =
{
	255,
	125,
	10
};

new const g_iBlue[ ] =
{
	255,
	0,
	0
};

new gCvarOn;
new gCvarSound;
new gCvarDropped;
new gCvarPicked;

new g_C4Timer, g_iColor = 0, g_iSound = 0;
new g_pMpC4Timer;
new g_TextMsg;

new gSyncHudMessage;

public plugin_init( )
{
	register_plugin( PLUGIN, VERSION, "Askhanar" );
	
	gCvarOn = register_cvar( "fmu_be_on", "1" );
	gCvarSound = register_cvar( "fmu_be_sound", "1" );
	gCvarDropped = register_cvar( "fmu_be_dropped", "1" );
	gCvarPicked = register_cvar( "fmu_be_picked", "1" );
	
	
	register_event( "ResetHUD", "ev_ResetHUD", "be" );
	register_event( "SendAudio", "TeamWonOrRoundDraw", "a", "2&%!MRAD_terwin", "2&%!MRAD_ctwin", "2&%!MRAD_rounddraw" );
	
	register_logevent( "le_RoundStart", 2, "1=Round_Start");
	register_logevent( "le_RoundEnd", 2, "1=Round_End");
	register_logevent( "le_RoundEnd", 2, "1&Restart_Round_");
	
	
	g_pMpC4Timer = get_cvar_pointer( "mp_c4timer" );
	
	g_TextMsg = get_user_msgid( "TextMsg" );
	register_message( g_TextMsg, "Hook_TextMessages" );

	gSyncHudMessage = CreateHudSyncObj(  );
}

public bomb_planted( ) 
{
	if( get_pcvar_num( gCvarOn ) == 0 )
		return;
		
	if( get_pcvar_num( gCvarSound ) > 0 )
	{
		client_cmd( 0, "stopsound" );
		client_cmd( 0, "mp3 play ^"sound/fmu_sounds/%s^"", g_szBombPlantedSounds[ g_iSound ] );
		
		g_iSound++;
		if( g_iSound >= 2 )	g_iSound = 0;
	}
	
	g_C4Timer = get_pcvar_num( g_pMpC4Timer ) - 1;
	
	set_task(1.0, "ShowTimeUntilExplosion", C4_TASK, "", 0, "b" );
}

public ShowTimeUntilExplosion(  )
{
	if( g_C4Timer > 0 )
	{
		if ( g_C4Timer > 20 )
			g_iColor = 0;
		else if ( g_C4Timer > 10 )
			g_iColor = 1;
		else if ( g_C4Timer <= 10 )
			g_iColor = 2;
			
		set_hudmessage( g_iRed[ g_iColor ], g_iGreen[ g_iColor ], g_iBlue[ g_iColor ], -1.0, 0.83, 0, 1.0, 1.0, 0.01, 0.01, -1 );
		ShowSyncHudMsg( 0, gSyncHudMessage, "Bomba explodeaza in: %i secund%s!", g_C4Timer, g_C4Timer == 1 ? "a" : "e" );
		g_C4Timer--;
	}

	else 
		remove_task( C4_TASK );
		
}

public Hook_TextMessages( iMsgId, iMsgDest, id )
{
	if( get_pcvar_num( gCvarOn ) == 0 )
		return PLUGIN_CONTINUE;
    
	static szMsg[ 64 ];
	get_msg_arg_string( 2, szMsg, sizeof ( szMsg ) - 1 );
	
	new iDropped = get_pcvar_num( gCvarDropped );
	if( iDropped && equal( szMsg, "#Game_bomb_drop" ) )
	{
		set_hudmessage( 255, 0, 0, -1.0, 0.16, 0, 0.0, 3.5, 0.1, 0.1, -1 );
		ShowSyncHudMsg( 0, gSyncHudMessage, "Furienii au pierdut bomba !" );
		return PLUGIN_HANDLED;
	}
	
	new iPicked = get_pcvar_num( gCvarPicked );
	if( iPicked  && equal( szMsg, "#Game_bomb_pickup" ) || iPicked  && equal( szMsg, "#Got_bomb" ) )
	{
		set_hudmessage( 255, 0, 0, -1.0, 0.16, 0, 0.0, 3.5, 0.1, 0.1, -1 );
		ShowSyncHudMsg( 0, gSyncHudMessage, "Furienii au recuperat bomba!" );
		return PLUGIN_HANDLED;
	}
		
	return PLUGIN_CONTINUE;
}

public ev_ResetHUD( )
{
	g_C4Timer = 0;
}

public TeamWonOrRoundDraw( )
{
	RemoveTimerTask( );
}

public le_RoundStart( )
{
	RemoveTimerTask( );
}

public le_RoundEnd()
{
	RemoveTimerTask( );
}

public plugin_end()
{
	RemoveTimerTask( );
}

public RemoveTimerTask( )
{
	if( get_pcvar_num( gCvarOn ) == 0 )
		return;
		
	g_C4Timer = -1;
	remove_task( C4_TASK );
}

public plugin_precache() 
{
	new szSound[ 64 ];
	for( new i = 0; i < 2; i++ )
	{
		formatex( szSound, sizeof ( szSound ) -1, "sound/fmu_sounds/%s", g_szBombPlantedSounds[ i ] );
		precache_generic( szSound );
	}
	
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang3081\\ f0\\ fs16 \n\\ par }
*/
fmu_christmass.sma

Code: Select all

#include < amxmodx >
#include < cstrike >
#include < fakemeta >
#include < engine >
#include < fun >

#include < FMU_Experience >
#include < CC_ColorChat >

#pragma semicolon 1

#define PLUGIN "Furien Christmas Gifts"
#define VERSION "1.0"

enum
{
	
	GIFT_HP, 
	GIFT_AP,
	GIFT_HP_AP,
	GIFT_MONEY,
	GIFT_HE,
	GIFT_XP,
	BADGIFT_MONEY,
	BADGIFT_XP,
	BADGIFT_WEAPONS,
	BADGIFT_SLAP
	
}

new const g_szFmuGiftsModels[  7  ][   ]  =
{
	
	"models/fmu_gift_cyan.mdl",
	"models/fmu_gift_green.mdl",
	"models/fmu_gift_orange.mdl",
	"models/fmu_gift_pink.mdl",
	"models/fmu_gift_red.mdl",
	"models/fmu_gift_yellow.mdl",
	"models/fmu_gift_random.mdl"
	
};

new const g_iFmuGiftsColors[  7  ][  3  ]  =
{
	{ 0, 255, 255 },
	{ 0, 255, 125 },
	{ 255, 125, 65 },
	{ 255, 0, 125 },
	{ 255, 25, 25 },
	{ 255, 255, 0 },
	{ 255, 255, 255 }
};

new const FMU_TAG[    ]  =  "[Furien Gifts]";
new const g_szGiftClassName[    ]  =  "FurienGift_byAskhanar";

// Nu modifica !!
new Float:fMaxs[ 3 ]  =  {  14.0, 14.0, 35.0  };
new Float:fMins[ 3 ]  =  {  -14.0, -14.0, 0.0  };
// Nu modifica !!

new gCvarGiftHP;
new gCvarGiftAP;
new gCvarGiftMoney;
new gCvarGiftXP;
new gCvarBadGiftXP;
new gCvarGiftChance;


public plugin_precache(    )
{
	for( new i = 0; i < 7; i++ )
	{
		precache_model( g_szFmuGiftsModels[ i ] );
	}
	
}

public plugin_init( )
{
	
	register_plugin( PLUGIN, VERSION, "Askhanar" );
	
	gCvarGiftHP = register_cvar( "fmu_gifts_hp", "5" );
	gCvarGiftAP = register_cvar( "fmu_gifts_ap", "5" );
	gCvarGiftMoney = register_cvar( "fmu_gifts_money", "5500" );
	gCvarGiftXP = register_cvar( "fmu_gifts_xp", "350" );
	gCvarBadGiftXP = register_cvar( "fmu_badgifts_xp", "155" );
	gCvarGiftChance = register_cvar( "fmu_gifts_chance", "75" );
	
	register_event(  "DeathMsg",  "EventDeathMsg",  "a"  );
	
	register_event( "HLTV", "DeleteAllGifts", "a", "1=0", "2=0" );
	register_event( "TextMsg", "DeleteAllGifts", "a", "2=#Game_will_restart_in" ); 

	// Oprita.. ( cand omori ultimu jucator, pica cadoul dar e sters de chemarea eventului.. ).
	//register_logevent( "DeleteAllGifts", 2, "0=World triggered", "1=Round_Draw", "1=Round_End" );
	
	register_touch( g_szGiftClassName, "player", "FwdPlayerTouchGift" );
	
	
}
					

public EventDeathMsg(  )
{	
	
	new iKiller  = read_data(  1  );
	new iVictim  = read_data(  2  );
	
	if( iVictim  !=  iKiller )
	{
		
		static iRandomChance;
		iRandomChance = random_num( 1, 100 );
		
		static iChance;
		iChance = get_pcvar_num( gCvarGiftChance );
		
		if( iRandomChance <= iChance )
		{
			new iParm[ 3 ];
			
			new Float:fUserOrigin[ 3 ], iUserOrigin[ 3 ];
			pev(iVictim, pev_origin, fUserOrigin );
			FVecIVec( fUserOrigin, iUserOrigin );
			
			iParm[ 0 ] = iUserOrigin[ 0 ];
			iParm[ 1 ] = iUserOrigin[ 1 ];
			iParm[ 2 ] = iUserOrigin[ 2 ];
			
			set_task( 0.7, "CreateGift", _, iParm, 3 );
		}
		
	}
	
	
	
	
	return 0;
}

public CreateGift( iParm[ ] )
{
	new iOrigin[ 3 ], Float:fOrigin[ 3 ];
	
	
	iOrigin[ 0 ] = iParm[ 0 ];
	iOrigin[ 1 ] = iParm[ 1 ];
	iOrigin[ 2 ] = iParm[ 2 ];
	IVecFVec( iOrigin, fOrigin );
	
	new iEnt = create_entity( "info_target" );
	if ( !is_valid_ent(iEnt) ) return 0;
	
	new iRandom = random_num( 0, 6 );
	
	entity_set_string(  iEnt, EV_SZ_classname, g_szGiftClassName  );
	entity_set_origin(  iEnt, fOrigin  );
	entity_set_model(  iEnt, g_szFmuGiftsModels[  iRandom  ]  );
	entity_set_int(  iEnt, EV_INT_movetype, MOVETYPE_NONE  );
	entity_set_int(  iEnt, EV_INT_solid, SOLID_BBOX );
	entity_set_size(  iEnt, fMins, fMaxs  );
	
	set_rendering( iEnt,
			kRenderFxGlowShell,
			g_iFmuGiftsColors[ iRandom ][ 0 ],
			g_iFmuGiftsColors[ iRandom ][ 1 ],
			g_iFmuGiftsColors[ iRandom ][ 2 ],
			kRenderNormal,
			255 );
	
	drop_to_floor(  iEnt  );
	
	new Float:fVelocity[ 3 ];
	fVelocity[ 0 ] = ( random_float( 0.0, 256.0 ) - 128.0 );
	fVelocity[ 1 ] = ( random_float( 0.0, 256.0 ) - 128.0 );
	fVelocity[ 2 ] = ( random_float( 0.0, 300.0 ) + 75.0 );
	
	entity_set_vector( iEnt, EV_VEC_velocity, fVelocity );
 
	return 0;
}

public DeleteAllGifts( )
{
	new iFoundEntity;

	while ( ( iFoundEntity = find_ent_by_class(  iFoundEntity, g_szGiftClassName  ) )  !=  0  )
	{
		engfunc( EngFunc_RemoveEntity, iFoundEntity );
	}
	
}

public FwdPlayerTouchGift(  const iEnt, const id  )
{
	
	if( is_valid_ent(  iEnt  )  && is_valid_ent(  id  )  &&  is_user_alive(  id  )  )
	{
		
		static iRandomChance;
		iRandomChance = random_num( 1, 100 );
		if( iRandomChance <= 90 )
		{
			new iRandomGift = random_num( GIFT_HP, GIFT_XP );
			while(  iRandomGift  ==  GIFT_HE   &&  user_has_weapon(  id,  CSW_HEGRENADE  )  )
				iRandomGift = random_num( GIFT_HP, GIFT_XP );
			
			GivePlayerGift( id, iRandomGift );
		}
		else
		{
			new iRandomGift = random_num( BADGIFT_MONEY, BADGIFT_SLAP );
			while( iRandomGift == BADGIFT_WEAPONS && get_user_team( id ) == 1 
				|| iRandomGift == BADGIFT_MONEY && cs_get_user_money( id ) == 0 )
				iRandomGift = random_num( BADGIFT_MONEY, BADGIFT_SLAP );
				
			GivePlayerGift( id, iRandomGift );
		}
		
		remove_entity( iEnt  );
			
	}
	
	return 0;
}

public GivePlayerGift(  id, const  iGiftType  )
{
	
	switch(  iGiftType  )
	{
		
		case GIFT_HP:
		{
			set_user_health(  id,  get_user_health(  id  )  +  get_pcvar_num( gCvarGiftHP )  );
			ColorChat(  id, RED,  "^x04%s^x01 Mosul ti-a oferit cadou^x03 %i HP^x01!",  FMU_TAG, get_pcvar_num( gCvarGiftHP )  );
			
		}
		case GIFT_AP:
		{
			set_user_armor(  id,  get_user_armor(  id  )  +  get_pcvar_num( gCvarGiftAP ) );
			ColorChat(  id, RED,  "^x04%s^x01 Mosul ti-a oferit cadou^x03 %i AP^x01!",  FMU_TAG, get_pcvar_num( gCvarGiftAP )  );
			
		}
		case GIFT_HP_AP:
		{
			static iHP;
			iHP = get_pcvar_num( gCvarGiftHP );
			static iAP;
			iAP = get_pcvar_num( gCvarGiftAP );
			set_user_health(  id,  get_user_health(  id  )  +  iHP  );
			set_user_armor(  id,  get_user_armor(  id  )  +  iAP  );
			
			ColorChat(  id, RED,  "^x04%s^x01 Mosul ti-a oferit cadou^x03 %i HP^x01 si^x03 %i AP^x01!",  FMU_TAG, iHP, iAP );
		}
		case GIFT_MONEY:
		{
			cs_set_user_money(  id,  clamp(  cs_get_user_money(  id  )  +  get_pcvar_num( gCvarGiftMoney ), 0, 16000  )  );
			ColorChat(  id, RED,  "^x04%s^x01 Mosul ti-a oferit cadou^x03 %i$^x01!",  FMU_TAG, get_pcvar_num( gCvarGiftMoney ) );
		}
		case GIFT_HE:
		{
			
			give_item(  id,  "weapon_hegrenade"  );
			ColorChat(  id, RED,  "^x04%s^x01 Mosul ti-a oferit cadou un^x03 HE^x01!",  FMU_TAG  );
			
		}
		case GIFT_XP:
		{
			fmu_add_user_xp(  id, get_pcvar_num( gCvarGiftXP )  );
			ColorChat(  id, RED,  "^x04%s^x01 Mosul ti-a oferit cadou^x03 %i XP^x01!",  FMU_TAG, get_pcvar_num( gCvarGiftXP ) );
		}
		
		case BADGIFT_MONEY:
		{
			cs_set_user_money( id, 0 );
			ColorChat(  id, RED,  "^x04%s^x03 NU^x01 ai fost destul de^x03 cuminte^x01!",  FMU_TAG  );
			ColorChat(  id, RED,  "^x04%s^x01 Mosul ti-a confiscat toti banii!",  FMU_TAG  );
		}
		case BADGIFT_XP:
		{
			fmu_sub_user_xp( id, get_pcvar_num( gCvarBadGiftXP ) );
			ColorChat(  id, RED,  "^x04%s^x03 NU^x01 ai fost destul de^x03 cuminte^x01!",  FMU_TAG  );
			ColorChat(  id, RED,  "^x04%s^x01 Mosul ti-a confiscat^x03 %i XP^x01!",  FMU_TAG, get_pcvar_num( gCvarBadGiftXP )  );
		}
		case BADGIFT_WEAPONS:
		{
			strip_user_weapons( id );
			give_item( id, "weapon_knife" );
			ColorChat(  id, RED,  "^x04%s^x03 NU^x01 ai fost destul de^x03 cuminte^x01!",  FMU_TAG  );
			ColorChat(  id, RED,  "^x04%s^x01 Mosul ti-a confiscat toate armele!",  FMU_TAG );
		}
		case BADGIFT_SLAP:
		{
			set_task( 0.1, "PunchUser", id );
			set_task( 0.2, "PunchUser", id );
			set_task( 0.3, "PunchUser", id );
			
			ColorChat(  id, RED,  "^x04%s^x03 NU^x01 ai fost destul de^x03 cuminte^x01!",  FMU_TAG  );
			ColorChat(  id, RED,  "^x04%s^x01 Mosul ti-a dat^x03 3^x01 palme!",  FMU_TAG );
		}
	}
}

public PunchUser( id )
{
	if( !is_user_connected( id ) )
		return 1;
		
	new Float:fRandomAngles[ 3 ];
	for(new i = 0; i < 3; i++)
		fRandomAngles[ i ] = random_float( 100.0, 150.0 );
		
	entity_set_vector(id, EV_VEC_punchangle, fRandomAngles );
	user_slap( id, random_num( 1, 5 ) );
	
	return 0;
}

fmu_events.sma

Code: Select all

#include <  amxmodx  >

#include <  cstrike  >
#include <  engine  >

#include <  FMU_Experience  >
#include <  CC_ColorChat  >

#pragma semicolon 1


#define PLUGIN "FMU Events"
#define VERSION "0.3.9"

#define		MagicWordTask		112233
#define		MagicWordSecondTask	332211

#define		UniqueWordTask		221133
#define		UniqueWordSecondTask	113322

enum
{
	
	EVENT_HAPPY_HOUR,
	EVENT_FREEGIFTS_HOUR,
	EVENT_LUCKY_HOUR,
	EVENT_SHOPPING_HOUR
	
}

// Strings
new const g_szSmallLetters[    ] =
{
	'a','b','c','d',
	'e','f','g','h',
	'i','j','k','l',
	'm','n','o','p',
	'q','r','s','t',
	'u','v','w','x',
	'y','z'
};


new const g_szLargeLetters[    ] =
{
	'A','B','C','D',
	'E','F','G','H',
	'I','J','K','L',
	'M','N','O','P',
	'Q','R','S','T',
	'U','V','W','X',
	'Y','Z'
};


new const g_szNumbers[    ]  =  
{
	'0','1',
	'2','3',
	'4','5',
	'6','7',
	'8','9'
};

new const g_szSymbols[    ]  =  
{
	'!','@','#','$',
	'%','&','*','(',
	')','_','-','+',
	'=','\','|','[',
	'{',']','}',':',
	',','<','.','>',
	'/','?'
};

new const g_szFmuEventBegin[    ]  =  "fmu_sounds/fmu_eventbegin.wav";
new const FMU_TAG[    ]  =  "[Furien Events]";


// Cvars
new gCvarEnableHappyHour;
new gCvarHappyHours;


new gCvarEnableFreeGiftsHour;
new gCvarFreeGiftsHours;

new gCvarEnableLuckyHour;
new gCvarLuckyHours;

new gCvarEnableShoppingHour;
new gCvarShoppingHours;

new gCvarMagicWordIterval;
new gCvarMagicWordAnswerTime;
new gCvarMagicWordMoney;
new gCvarMagicWordXP;

new gCvarUniqueWordDelay;
new gCvarUniqueWordAnswerTime;
new gCvarUniqueWordXP;

// Variables
new g_iMWAnswerTime = 0;
new g_szMagicWord[ 32 ];

new g_iUQAnswerTime = 0;
new g_szUniqueWord[ 35 ];

// Bools
new bool:g_bHappyHourEvent;
new bool:g_bFreeGiftsHourEvent;
new bool:g_bLuckyHourEvent;
new bool:g_bShoppingHourEvent;
new bool:g_bPlayersCanAnswerForMW  =  false;
new bool:g_bPlayersCanAnswerForUQW  =  false;

//Others
new SyncHudMessage;
new SyncHudMessage1;
new SyncHudMessage2;
new SyncHudMessage3;
new SyncHudMessage4;
new SyncHudMessage5;

public plugin_precache(    )
{
	
	
	precache_sound(  g_szFmuEventBegin  );
	
	
}	
		
public plugin_init( )
{
	register_plugin( PLUGIN, VERSION, "Askhanar" );
		
	gCvarEnableHappyHour  =  register_cvar(  "fmu_enable_happyhour",  "1"  );
	gCvarHappyHours  =  register_cvar(  "fmu_happy_hours", "10 14 16 18 22" );
	
	gCvarEnableFreeGiftsHour  =  register_cvar(  "fmu_enable_freegiftshour",  "1"  );
	gCvarFreeGiftsHours  =  register_cvar(  "fmu_freegifts_hours", "11 13 16 19 23"  );
	
	gCvarEnableLuckyHour  =  register_cvar(  "fmu_enable_luckyhour",  "1"  );
	gCvarLuckyHours  =  register_cvar(  "fmu_lucky_hours", "10 12 17 20 22" );
	
	gCvarEnableShoppingHour  =  register_cvar(  "fmu_enable_Shoppinghour",  "1"  );
	gCvarShoppingHours  =  register_cvar(  "fmu_shopping_hours",  "11 15 17 21 00"  );
	
	gCvarMagicWordIterval  =  register_cvar( "fmu_mw_interval",  "180"  );
	gCvarMagicWordAnswerTime  =  register_cvar( "fmu_mw_answertime",  "15"  );
	gCvarMagicWordMoney  =  register_cvar( "fmu_mw_money",  "3500"  );
	gCvarMagicWordXP  =  register_cvar( "fmu_mw_xp",  "350"  );
	
	gCvarUniqueWordDelay  =  register_cvar( "fmu_uqw_delay",  "560"  );
	gCvarUniqueWordAnswerTime  =  register_cvar( "fmu_uqw_answertime",  "75"  );
	gCvarUniqueWordXP  =  register_cvar( "fmu_uqw_xp",  "2750"  );
	
	register_clcmd( "amx_magicword", "ClCmdMagicWord"  );
	register_clcmd( "amx_uniqueword", "ClCmdUniqueWord"  );
	
	register_clcmd( "say /events", "ClCmdSayEvents" );
	
	register_clcmd(  "say", "CheckForWord"  );
	register_clcmd(  "say_team", "CheckForWord"  );	
	
	new iEnt;
	iEnt  =  create_entity(  "info_target"  );
	entity_set_string(  iEnt,  EV_SZ_classname,  "EventsEntity"  );
	entity_set_float(  iEnt, EV_FL_nextthink,  get_gametime(    )  +  0.1  );
	register_think(  "EventsEntity",  "CheckForEvents"  );
	
	SyncHudMessage = CreateHudSyncObj( );
	SyncHudMessage1 = CreateHudSyncObj( );
	SyncHudMessage2  =  CreateHudSyncObj(  );
	SyncHudMessage3  =  CreateHudSyncObj(  );
	SyncHudMessage4  =  CreateHudSyncObj(  );
	SyncHudMessage5  =  CreateHudSyncObj(  );
	
	set_task(  10.0,  "ChooseRandomMagicWord",  MagicWordTask  );
	set_task(  float( get_pcvar_num( gCvarUniqueWordDelay )  ),  "ChooseRandomUniqueWord",  UniqueWordTask  );
	
}

public plugin_natives()
{
	
	register_library("FMU_Events");
	register_native("fmu_is_happy_hour", "_is_happy_hour");
	register_native("fmu_is_freegifts_hour", "_is_freegifts_hour");
	register_native("fmu_is_lucky_hour", "_is_lucky_hour");
	register_native("fmu_is_shopping_hour", "_is_shopping_hour");
}

public bool:_is_happy_hour(  plugin,  params  )
{
	return g_bHappyHourEvent;
}

public bool:_is_freegifts_hour(  plugin,  params  )
{
	return g_bFreeGiftsHourEvent;
}

public bool:_is_lucky_hour(  plugin,  params  )
{
	return g_bLuckyHourEvent;
}

public bool:_is_shopping_hour(  plugin,  params  )
{
	return g_bShoppingHourEvent;
}

public CheckForEvents(  iEnt  )
{
	
	entity_set_float(  iEnt,  EV_FL_nextthink,  get_gametime(    )  +  1.0  );

	if(  get_pcvar_num(  gCvarEnableHappyHour  )  ==  1  )
		CheckForEvent( EVENT_HAPPY_HOUR  );
		
	if(  get_pcvar_num(  gCvarEnableFreeGiftsHour  )  ==  1  )
		CheckForEvent( EVENT_FREEGIFTS_HOUR  );
		
	if(  get_pcvar_num(  gCvarEnableLuckyHour  )  ==  1  )
		CheckForEvent( EVENT_LUCKY_HOUR  );
		
	if(  get_pcvar_num(  gCvarEnableShoppingHour  )  ==  1  )
		CheckForEvent( EVENT_SHOPPING_HOUR );
		
}

public CheckForEvent( const iCheckedEvent )
{
	
	static _EventHours[ 64 ], iHours[ 5 ], szHours[ 5 ][  10  ], _hour[ 5 ], minute[ 32 ];
	GetCvarString(  iCheckedEvent,  _EventHours,  sizeof ( _EventHours ) -1  );
	
	parse(  _EventHours,  szHours[ 0 ],  sizeof (  szHours[]  )  -1,
			szHours[ 1 ],  sizeof (  szHours[]  )  -1,
			szHours[ 2 ],  sizeof (  szHours[]  )  -1,
			szHours[ 3 ],  sizeof (  szHours[]  )  -1,
			szHours[ 4 ],  sizeof (  szHours[]  )  -1);
			
	format_time( _hour, sizeof( _hour ) - 1, "%H" );
	format_time( minute, sizeof( minute ) - 1, "%M" );
	
	new c_hour = str_to_num( _hour );
	
	for(  new i = 0; i < 5; i++  )
	{
		iHours[ i ] = str_to_num(  szHours[ i ] );
	}
	
	if( !IsEventActive(  iCheckedEvent  ) )
	{
				
		if(  c_hour  ==  iHours[  0  ]  ||  c_hour  ==  iHours[  1  ]  ||  c_hour  ==  iHours[  2  ] 
			||  c_hour  ==  iHours[  3  ] ||  c_hour  ==  iHours[  4  ] )
		{
			ActivateEvent(  iCheckedEvent,  c_hour, minute  );
		}
		
	}
	
	else if( IsEventActive(  iCheckedEvent )  )
	{
		if(  c_hour  ==  iHours[  0  ]  ||  c_hour  ==  iHours[  1  ]  ||  c_hour  ==  iHours[  2  ] 
			||  c_hour  ==  iHours[  3  ] ||  c_hour  ==  iHours[  4  ] )
		{
			return 1;
		}
			
		DeActivateEvent(  iCheckedEvent  );
		
	}
	
	return 0;
	
}

GetCvarString(  const iCheckedEvent, _EventHours[   ],  iLen  )
{
	new szCvarString[ 32 ];
	switch(  iCheckedEvent  )
	{
		case EVENT_HAPPY_HOUR:
		{
			get_pcvar_string(  gCvarHappyHours, szCvarString,  sizeof ( szCvarString ) -1  );
		}
		case EVENT_FREEGIFTS_HOUR:
		{
			get_pcvar_string(  gCvarFreeGiftsHours, szCvarString,  sizeof ( szCvarString ) -1  );
		}
		case EVENT_LUCKY_HOUR:
		{
			get_pcvar_string(  gCvarLuckyHours, szCvarString,  sizeof ( szCvarString ) -1  );
		}
		case EVENT_SHOPPING_HOUR:
		{
			get_pcvar_string(  gCvarShoppingHours, szCvarString,  sizeof ( szCvarString ) -1  );
		}
	}
	
	formatex(  _EventHours,  iLen, "%s", szCvarString  );
	
}

bool:IsEventActive(  const iCheckedEvent  )
{
	new bool:ValueToReturn = false;
	switch(  iCheckedEvent  )
	{
		case EVENT_HAPPY_HOUR:	ValueToReturn = g_bHappyHourEvent;
		case EVENT_FREEGIFTS_HOUR:	ValueToReturn = g_bFreeGiftsHourEvent;
		case EVENT_LUCKY_HOUR:	ValueToReturn = g_bLuckyHourEvent;
		case EVENT_SHOPPING_HOUR:	ValueToReturn = g_bShoppingHourEvent;
		
	}
	
	return ValueToReturn;
	
}

ActivateEvent(  const iEvent,  const c_hour,  const minute[    ]  )
{
	switch(  iEvent  )
	{
		case EVENT_HAPPY_HOUR:
		{
			g_bHappyHourEvent  =  true;
			
			set_hudmessage(  0,  255,  0,  -1.0, 0.05,  0,  0.0 ,10.0,  0.0,  0.1,  3  );
			ShowSyncHudMsg(  0,  SyncHudMessage,  "Este ora %i:%s !^nEventul Happy Hour a inceput !^nIn aceasta ora veti primi XP dublu !",  c_hour, minute );
			
			ColorChat(  0,  RED,  "^x04%s^x01 Este ora^x03 %i:%s^x01 !",  FMU_TAG,  c_hour, minute  );
			ColorChat(  0,  RED,  "^x04%s^x01 Eventul^x03 Happy Hour^x01 a inceput !",  FMU_TAG );
			ColorChat(  0,  RED,  "^x04%s^x01 In aceasta ora veti primi^x03 XP^x01 dublu !",  FMU_TAG  );
			client_cmd(  0, "spk ^"%s^"",  g_szFmuEventBegin  );
			
		}
		case EVENT_FREEGIFTS_HOUR:
		{
			g_bFreeGiftsHourEvent  =  true;
			
			set_hudmessage(  0,  255,  0,  -1.0, 0.25,  0,  0.0 ,10.0,  0.0,  0.1,  1  );
			ShowSyncHudMsg(  0,  SyncHudMessage1,  "Este ora %i:%s !^nEventul Free Gifts Hour a inceput !^nIn aceasta ora veti primi 250XP si 1500$ la fiecare spawn !",  c_hour, minute );
			
			ColorChat(  0,  RED,  "^x04%s^x01 Este ora^x03 %i:%s^x01 !",  FMU_TAG,  c_hour, minute  );
			ColorChat(  0,  RED,  "^x04%s^x01 Eventul^x03 Free Gifts Hour^x01 a inceput !",  FMU_TAG );
			ColorChat(  0,  RED,  "^x04%s^x01 In aceasta ora veti primi^x03 250XP^x01 si^x03 1500$^x01 la fiecare spawn !",  FMU_TAG  );
			client_cmd(  0, "spk ^"%s^"",  g_szFmuEventBegin  );
			
		}
		
		case EVENT_LUCKY_HOUR:
		{
			g_bLuckyHourEvent  =  true;
			
			set_hudmessage(  0,  255,  0,  -1.0, 0.45,  0,  0.0 ,10.0,  0.0,  0.1,  4  );
			ShowSyncHudMsg(  0,  SyncHudMessage2,  "Este ora %i:%s !^nEventul Lucky Hour a inceput !^nIn aceasta ora aveti 75%% sanse sa primiti un cadou la spawn !",  c_hour, minute );
			
			ColorChat(  0,  RED,  "^x04%s^x01 Este ora^x03 %i:%s^x01 !",  FMU_TAG,  c_hour, minute  );
			ColorChat(  0,  RED,  "^x04%s^x01 Eventul^x03 Lucky Hour^x01 a inceput !",  FMU_TAG );
			ColorChat(  0,  RED,  "^x04%s^x01 In aceasta ora aveti^x03 75%%^x01 sanse sa primiti un cadou la spawn !",  FMU_TAG  );
			client_cmd(  0, "spk ^"%s^"",  g_szFmuEventBegin  );
			
		}
		
		case EVENT_SHOPPING_HOUR:
		{
			g_bShoppingHourEvent  =  true;
			
			set_hudmessage(  0,  255,  0,  -1.0, 0.65,  0,  0.0 ,10.0,  0.0,  0.1,  2  );
			ShowSyncHudMsg(  0,  SyncHudMessage5,  "Este ora %i:%s !^nEventul Shopping Hour a inceput !^nIn aceasta ora cumparati orice item din shop la jumatate de pret!",  c_hour, minute );
			
			ColorChat(  0,  RED,  "^x04%s^x01 Este ora^x03 %i:%s^x01 !",  FMU_TAG,  c_hour, minute  );
			ColorChat(  0,  RED,  "^x04%s^x01 Eventul^x03 Lucky Hour^x01 a inceput !",  FMU_TAG );
			ColorChat(  0,  RED,  "^x04%s^x01 In aceasta ora cumparati orice item din shop la jumatate de pret !",  FMU_TAG  );
			client_cmd(  0, "spk ^"%s^"",  g_szFmuEventBegin  );
			
		}
	}
	
}

DeActivateEvent(  const iEvent )
{
	
	switch(  iEvent  )
	{
		case EVENT_HAPPY_HOUR:
		{
			g_bHappyHourEvent  =  false;
		
			set_hudmessage(  0,  255,  0,  -1.0,  0.05,  0,  0.0 ,10.0,  0.0,  0.1,  3  );
			ShowSyncHudMsg(  0,  SyncHudMessage,  "Eventul Happy Hour s-a incheiat !" );
			
			ColorChat(  0,  RED,  "^x04%s^x01 Eventul^x03 Happy Hour^x01 s-a incheat !",  FMU_TAG );
		}
		case EVENT_FREEGIFTS_HOUR:
		{
			g_bFreeGiftsHourEvent  =  false;
		
			set_hudmessage(  0,  255,  0,  -1.0, 0.25,  0,  0.0 ,10.0,  0.0,  0.1,  1  );
			ShowSyncHudMsg(  0,  SyncHudMessage1,  "Eventul Free Gifts Hour s-a incheiat !" );
			
			ColorChat(  0,  RED,  "^x04%s^x01 Eventul^x03 Free Gifts Hour^x01 s-a incheat !",  FMU_TAG );
		}
		case EVENT_LUCKY_HOUR:
		{
			g_bLuckyHourEvent  =  false;
			set_hudmessage(  0,  255,  0,  -1.0,  0.45,  0,  0.0 ,10.0,  0.0,  0.1,  4  );
			ShowSyncHudMsg(  0,  SyncHudMessage2,  "Eventul Lucky Hour s-a incheiat !" );
			
			ColorChat(  0,  RED,  "^x04%s^x01 Eventul^x03 Lucky Hour^x01 s-a incheat !",  FMU_TAG );
		}
		
		case EVENT_SHOPPING_HOUR:
		{
			g_bShoppingHourEvent  =  false;
			set_hudmessage(  0,  255,  0,  -1.0,  0.65,  0,  0.0 ,10.0,  0.0,  0.1,  2  );
			ShowSyncHudMsg(  0,  SyncHudMessage5,  "Eventul Shopping Hour s-a incheiat !" );
			
			ColorChat(  0,  RED,  "^x04%s^x01 Eventul^x03 Shopping Hour^x01 s-a incheat !",  FMU_TAG );
		}
	}
}

public ClCmdSayEvents( id )
{
		
	new  menu  =  menu_create(  "\rFurien Events", "FmuEventsMenuHandler");
	
	new szHappyHour[ 64 ], szFreeGiftsHour[ 64 ], szLuckyHour[ 64 ], szShoppingHour[ 64 ];
	
	formatex(  szHappyHour,  sizeof ( szHappyHour ) -1, "\wHappy Hour \r- %s", g_bHappyHourEvent ? "\yInceput" : "\dTerminat"  );
	formatex(  szFreeGiftsHour,  sizeof ( szFreeGiftsHour ) -1, "\wFree Gifts Hour \r- %s", g_bFreeGiftsHourEvent ? "\yInceput" : "\dTerminat"  );
	formatex(  szLuckyHour,  sizeof ( szLuckyHour ) -1, "\wLucky Hour \r- %s", g_bLuckyHourEvent ? "\yInceput" : "\dTerminat"  );
	formatex(  szShoppingHour,  sizeof ( szShoppingHour ) -1, "\wShopping Hour \r- %s", g_bShoppingHourEvent ? "\yInceput" : "\dTerminat"  );
	
	menu_additem(  menu,  "\wMagic Word \r- \yActiv" ,  "1",  0  );
	menu_additem(  menu,  "\wUnique Word \r- \yActiv",  "2",  0  );
	menu_additem(  menu,  szHappyHour,  "3",  0  );
	menu_additem(  menu,  szFreeGiftsHour,  "4",  0  );
	menu_additem(  menu,  szLuckyHour,  "5",  0  );
	menu_additem(  menu,  szShoppingHour,  "6",  0  );
	
	menu_setprop(  menu,  MPROP_EXITNAME, "\wIesire" );
	
	menu_display(  id, menu  );
	
	return 1;
	
}

public FmuEventsMenuHandler(  id,  menu,  item)
{
	if(  item  ==  MENU_EXIT  )
	{
		menu_destroy(  menu  );
		return 1;
	}
	
	static _access, info[4], callback;
	menu_item_getinfo(  menu,  item,  _access,  info,  sizeof  (  info  )  -  1,  _,  _,  callback  );
	menu_destroy(  menu  );
	
	new iKey  =  str_to_num(  info  );
	switch(  iKey  )
	{
		case 1:	ShowMWInfo( id );
		case 2:	ShowUQWInfo( id );
		case 3:	ShowHappyHourInfo( id );
		case 4:	ShowFreeGiftsHourInfo( id );
		case 5: ShowLuckyHourInfo( id );
		case 6: ShowShoppingHourInfo( id );
	}
	
	return 0;
	
}

public ShowMWInfo(  id  )
{
	
	static motd[  2500  ];
	new len = formatex( motd, sizeof ( motd )  - 1,	"<html>"  );
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "<style type=^"text/css^">"  );
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "body{background-image: url(^"http://i52.tinypic.com/qoukhx.png^");font-family:Tahoma;font-size:15px;color:#FFFFFF;}</style>"  );
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "<body><center><font face=^"Verdana^" size=^"2^"><b><br>"  );
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "<font size=^"4^" color=^"#F08080^">Magic Word</font><br><br><br><br><br>" );
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "Acest event consta intr-un cuvant generat la intamplare care,<br>" );
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,   "are o dimensiune cuprinsa intre 10 si 15 caractere si, apare la fiecare %i de secunde.<br><br>" , get_pcvar_num( gCvarMagicWordIterval )  );
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "Primul jucator care il scrie exact asa cum a fost generat, va primi un premiu in valoare de %i XP sau %i$.<br>", get_pcvar_num( gCvarMagicWordXP ), get_pcvar_num( gCvarMagicWordMoney )  );
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "XP-ul va fi dublat in cazul in care eventul Happy Hour este Activ sau jucatorul respectiv este VIP iar,<br>"  );
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "cand ambele cazuri sunt intalnite, acesta v-a primi de 3x XP-ul respectiv.<br><br>"  );
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "Deasemenea jucatorii au la dispozitie %i secunde sa scrie Cuvantul Magic.<br>", get_pcvar_num( gCvarMagicWordAnswerTime )  );
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "Eventul mai poate fi activat instant de un manager prin comanda 'amx_magicword'.<br>"  );
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "</center></body></html>"  );
	
	show_motd(  id,  motd,  "Magic Word Info");
	return 1;
}

public ShowUQWInfo(  id  )
{
	
	static motd[  2500  ];
	new len = formatex( motd, sizeof ( motd )  - 1,	"<html>"  );
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "<style type=^"text/css^">"  );
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "body{background-image: url(^"http://i52.tinypic.com/qoukhx.png^");font-family:Tahoma;font-size:15px;color:#FFFFFF;}</style>"  );
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "<body><center><font face=^"Verdana^" size=^"2^"><b><br>"  );
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "<font size=^"4^" color=^"#F08080^">Unique Word</font><br><br><br><br><br>" );
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "Acest event consta intr-un cuvant generat la intamplare care are o dimensiune cuprinsa intre 30 si 35 caractere si,<br>" );
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "care apare o singura data pe harta atunci cand au trecut %i de secunde de la inceputul hartii.<br><br>" , get_pcvar_num( gCvarUniqueWordDelay )  );
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "Primul jucator care il scrie exact asa cum a fost generat, va primi un premiu in valoare de %i XP.<br>", get_pcvar_num( gCvarUniqueWordXP )  );
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "XP-ul va fi dublat in cazul in care eventul Happy Hour este Activ sau jucatorul respectiv este VIP iar,<br>"  );
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "cand ambele cazuri sunt intalnite, acesta v-a primi de 3x XP-ul respectiv.<br><br>"  );
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "Deasemenea jucatorii au la dispozitie %i secunde sa scrie acest Cuvant Unic.<br>", get_pcvar_num( gCvarUniqueWordAnswerTime )  );
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "Eventul mai poate fi activat instant de un manager prin comanda 'amx_uniqueword'.<br>"  );
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "</center></body></html>"  );
	
	show_motd(  id,  motd,  "Unique Word Info");
	return 1;
}

public ShowHappyHourInfo(  id  )
{
	
	
	static motd[  2500  ];
	new len = formatex( motd, sizeof ( motd )  - 1,	"<html>"  );
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "<style type=^"text/css^">"  );
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "body{background-image: url(^"http://i52.tinypic.com/qoukhx.png^");font-family:Tahoma;font-size:15px;color:#FFFFFF;}"  );
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "table{font-family:Tahoma;font-size:10px;color:#FFFFFF;}</style>"  );
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "<body><center><font face=^"Verdana^" size=^"2^"><b><br>"  );
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "<font size=^"4^" color=^"#F08080^">Happy Hour</font><br><br><br><br>" );
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "Acest event face ca orice xp primesti( mai putin cel prin transfer sau givexp ) sa fie dublat.<br>"  );
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "In tabelul ce urmeaza veti gasi orele la care eventul incepe si orele la care se termina.<br><br><br>"  );
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "</center><table align=center width=40%% cellpadding=1 cellspacing=0 >"  );
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "<tr align=center > <th width=20%%> Incepe la <th width=20%%> Se termina la"  );
	
	static _EventHours[ 64 ], iHours[ 5 ], szHours[ 5 ][  10  ];
	GetCvarString(  EVENT_HAPPY_HOUR,  _EventHours,  sizeof ( _EventHours ) -1  );
	
	parse(  _EventHours,  szHours[ 0 ],  sizeof (  szHours[]  )  -1,
			szHours[ 1 ],  sizeof (  szHours[]  )  -1,
			szHours[ 2 ],  sizeof (  szHours[]  )  -1,
			szHours[ 3 ],  sizeof (  szHours[]  )  -1,
			szHours[ 4 ],  sizeof (  szHours[]  )  -1);
	
	for(  new i = 0; i < 5; i++  )
	{
		iHours[ i ] = str_to_num(  szHours[ i ] );
		len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "<tr align=center > <td> %i:00</td><td> %i:00</td>",  iHours[ i ], iHours[ i ] + 1  );
	}
	
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "</table><center><br><br>"  );
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "Daca esti VIP si Happy Hour este activ, orice XP vei primi se va multiplica de 3x.<br>"  );
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "</center></body></html>"  );
	
	show_motd(  id,  motd,  "Happy Hour Info");
	return 1;
}

public ShowFreeGiftsHourInfo(  id  )
{
	
	
	static motd[  2500  ];
	new len = formatex( motd, sizeof ( motd )  - 1,	"<html>"  );
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "<style type=^"text/css^">"  );
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "body{background-image: url(^"http://i52.tinypic.com/qoukhx.png^");font-family:Tahoma;font-size:15px;color:#FFFFFF;}"  );
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "table{font-family:Tahoma;font-size:10px;color:#FFFFFF;}</style>"  );
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "<body><center><font face=^"Verdana^" size=^"2^"><b><br>"  );
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "<font size=^"4^" color=^"#F08080^">Free Gifts Hour</font><br><br><br><br>" );
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "Acest event face ca orice la fiecare spawn sa primesti 250XP si 1500$..<br>"  );
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "In tabelul ce urmeaza veti gasi orele la care eventul incepe si orele la care se termina.<br><br><br>"  );
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "</center><table align=center width=40%% cellpadding=1 cellspacing=0 >"  );
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "<tr align=center > <th width=20%%> Incepe la <th width=20%%> Se incheie la"  );
	
	static _EventHours[ 64 ], iHours[ 5 ], szHours[ 5 ][  10  ];
	GetCvarString(  EVENT_FREEGIFTS_HOUR,  _EventHours,  sizeof ( _EventHours ) -1  );
	
	parse(  _EventHours,  szHours[ 0 ],  sizeof (  szHours[]  )  -1,
			szHours[ 1 ],  sizeof (  szHours[]  )  -1,
			szHours[ 2 ],  sizeof (  szHours[]  )  -1,
			szHours[ 3 ],  sizeof (  szHours[]  )  -1,
			szHours[ 4 ],  sizeof (  szHours[]  )  -1);
	
	for(  new i = 0; i < 5; i++  )
	{
		iHours[ i ] = str_to_num(  szHours[ i ] );
		len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "<tr align=center > <td> %i:00</td><td> %i:00</td>",  iHours[ i ], iHours[ i ] + 1  );
	}
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "</table><center><br><br>"  );
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "Daca esti VIP sau Happy Hour este activ, valoarea XP-ului va fi aceeasi.<br>"  );
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "</center></body></html>"  );
	
	show_motd(  id,  motd,  "Free Gifts Hour Info");
	return 1;
}

public ShowLuckyHourInfo(  id  )
{
	
	
	static motd[  2500  ];
	new len = formatex( motd, sizeof ( motd )  - 1,	"<html>"  );
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "<style type=^"text/css^">"  );
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "body{background-image: url(^"http://i52.tinypic.com/qoukhx.png^");font-family:Tahoma;font-size:15px;color:#FFFFFF;}"  );
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "table{font-family:Tahoma;font-size:10px;color:#FFFFFF;}</style>"  );
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "<body><center><font face=^"Verdana^" size=^"2^"><b><br>"  );
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "<font size=^"4^" color=^"#F08080^">Lucky Hour</font><br><br><br><br>" );
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "Cand acest event este inceput, la fiecare spawn ai 50%% sanse sa primesti un cadou.<br>"  );
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "Acest cadou poate fi: 150XP, 8000$, 25HP, 25AP, 25HP si 25AP.<br>"  );
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "In tabelul ce urmeaza veti gasi orele la care eventul incepe si orele la care se termina.<br><br><br>"  );
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "</center><table align=center width=40%% cellpadding=1 cellspacing=0 >"  );
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "<tr align=center > <th width=20%%> Incepe la <th width=20%%> Se termina la"  );
	
	static _EventHours[ 64 ], iHours[ 5 ], szHours[ 5 ][  10  ];
	GetCvarString(  EVENT_LUCKY_HOUR,  _EventHours,  sizeof ( _EventHours ) -1  );
	
	parse(  _EventHours,  szHours[ 0 ],  sizeof (  szHours[]  )  -1,
			szHours[ 1 ],  sizeof (  szHours[]  )  -1,
			szHours[ 2 ],  sizeof (  szHours[]  )  -1,
			szHours[ 3 ],  sizeof (  szHours[]  )  -1,
			szHours[ 4 ],  sizeof (  szHours[]  )  -1);
	
	for(  new i = 0; i < 5; i++  )
	{
		iHours[ i ] = str_to_num(  szHours[ i ] );
		len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "<tr align=center > <td> %i:00</td><td> %i:00</td>",  iHours[ i ], iHours[ i ] + 1  );
	}
	
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "</table><center><br><br>"  );
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "Daca esti VIP sau Happy Hour este activ, valorile XP-ului sau a Banilor vor fi aceleasi.<br>"  );
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "</center></body></html>"  );
	
	show_motd(  id,  motd,  "Lucky Hour Info");
	return 1;
}

public ShowShoppingHourInfo(  id  )
{
	
	
	static motd[  2500  ];
	new len = formatex( motd, sizeof ( motd )  - 1,	"<html>"  );
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "<style type=^"text/css^">"  );
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "body{background-image: url(^"http://i52.tinypic.com/qoukhx.png^");font-family:Tahoma;font-size:15px;color:#FFFFFF;}"  );
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "table{font-family:Tahoma;font-size:10px;color:#FFFFFF;}</style>"  );
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "<body><center><font face=^"Verdana^" size=^"2^"><b><br>"  );
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "<font size=^"4^" color=^"#F08080^">Shopping Hour</font><br><br><br><br>" );
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "Cand acest event este inceput, cumperi orice item din shop la jumatate de pret.<br>"  );
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "Deasemenea in cazul in care castigi un premiu in bani la Magic Word, vei primi de 2x suma.<br>"  );
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "In tabelul ce urmeaza veti gasi orele la care eventul incepe si orele la care se termina.<br><br><br>"  );
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "</center><table align=center width=40%% cellpadding=1 cellspacing=0 >"  );
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "<tr align=center > <th width=20%%> Incepe la <th width=20%%> Se termina la"  );
	
	static _EventHours[ 64 ], iHours[ 5 ], szHours[ 5 ][  10  ];
	GetCvarString(  EVENT_SHOPPING_HOUR,  _EventHours,  sizeof ( _EventHours ) -1  );
	
	parse(  _EventHours,  szHours[ 0 ],  sizeof (  szHours[]  )  -1,
			szHours[ 1 ],  sizeof (  szHours[]  )  -1,
			szHours[ 2 ],  sizeof (  szHours[]  )  -1,
			szHours[ 3 ],  sizeof (  szHours[]  )  -1,
			szHours[ 4 ],  sizeof (  szHours[]  )  -1);
	
	for(  new i = 0; i < 5; i++  )
	{
		iHours[ i ] = str_to_num(  szHours[ i ] );
		len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "<tr align=center > <td> %i:00</td><td> %i:00</td>",  iHours[ i ], iHours[ i ] + 1  );
	}
	
	len += format(  motd[ len ],  sizeof ( motd ) - len - 1,	 "</table></body></html>"  );	
	show_motd(  id,  motd,  "Shopping Hour Info");
	return 1;
}
public ClCmdMagicWord(  id  )
{
	if( !UserHasFullAcces(  id  )  )
	{
		client_cmd(  id, "echo Nu ai acces la aceasta comanda !" );
		return 1;
	}
	
	read_argv(  1, g_szMagicWord, 14  );
	if( equal(  g_szMagicWord,  ""  )  )
	{
	
		remove_task( MagicWordTask );
		remove_task( MagicWordSecondTask );
		g_bPlayersCanAnswerForMW = false;
	
		ChooseRandomMagicWord(    );
	}
	else
	{
		remove_task( MagicWordTask );
		remove_task( MagicWordSecondTask );
		g_bPlayersCanAnswerForMW = false;
	
		DisplayMagicWord(    );
	}
	
	
	return 1;
}
public ClCmdUniqueWord(  id  )
{
	if( !UserHasFullAcces(  id  )  )
	{
		client_cmd(  id, "echo Nu ai acces la aceasta comanda !" );
		return 1;
	}
	
	remove_task( UniqueWordTask );
	remove_task( UniqueWordSecondTask );
	g_bPlayersCanAnswerForUQW = false;
	
	ChooseRandomUniqueWord(    );
	
	
	
	return 1;
}
	
public CheckForWord(  id  )
{
	
	static szSaid[ 192 ];
	read_args(  szSaid, sizeof ( szSaid ) -1  );
	
	remove_quotes(  szSaid  );
	if(  equali(  szSaid, ""  )  )	return 0;
	
	if(  g_bPlayersCanAnswerForMW || g_bPlayersCanAnswerForUQW  )
	{
	
		
		if(  equal(  szSaid,  g_szMagicWord  )  )
		{
			g_bPlayersCanAnswerForMW  =  false;
			client_cmd(  0,  "spk woop"  );
			GiveUserGift(  id , 1 );
		}
		else if(  equal(  szSaid,  g_szUniqueWord  )  )
		{
			g_bPlayersCanAnswerForUQW  =  false;
			client_cmd(  0,  "spk doop"  );
			GiveUserGift(  id, 2  );
		}
	}
	
	return 0;
}


public ChooseRandomMagicWord(    )
{
	if( !get_playersnum( ) ) return;
	
	new iLen  =  random_num(  10,  15  );
	format(  g_szMagicWord, sizeof ( g_szMagicWord ) -1, ""  );
	
	for(  new i = 0; i < iLen; i++ )
		g_szMagicWord[ i ] = GetRandomCharacter(  );
	
	StartMagicWord(    );
	client_cmd(  0,  "spk doop"  );
	
	set_task ( float(  get_pcvar_num(  gCvarMagicWordIterval  )  ), "ChooseRandomMagicWord", MagicWordTask  );
}

public DisplayMagicWord(    )
{
	if( !get_playersnum( ) ) return;
	
	StartMagicWord(    );
	client_cmd(  0,  "spk doop"  );
	
	set_task ( float(  get_pcvar_num(  gCvarMagicWordIterval  )  ), "ChooseRandomMagicWord", MagicWordTask  );
}

public ChooseRandomUniqueWord(    )
{
	if( !get_playersnum( ) ) return;
	
	remove_task( UniqueWordTask );
	remove_task( UniqueWordSecondTask );
	
	new iLen  =  random_num(  30,  35  );
	format(  g_szUniqueWord, sizeof ( g_szUniqueWord ) -1, ""  );
	
	for(  new i = 0; i < iLen; i++ )
		g_szUniqueWord[ i ] = GetRandomCharacter(  );
	
	StartUniqueWord(    );
	client_cmd(  0, "spk ^"%s^"",  g_szFmuEventBegin  );
	
	
}

GetRandomCharacter(    )
{
	new Float:fRandom  =  random_float(  1.0,  100.0  );
	
	if(  fRandom  <=  25.0  )
	{
		return g_szSmallLetters[  random(  sizeof ( g_szSmallLetters )  )  ];
	}
	
	else if(  fRandom  >  25.0  &&  fRandom  <=  50.0  )
	{
		return g_szLargeLetters[  random(  sizeof ( g_szLargeLetters )  )  ];
	}
	
	else if(  fRandom  >  50.0  && fRandom  <  75.0  )
	{
		return g_szNumbers[  random(  sizeof ( g_szNumbers )  )  ];
	}
	else if(  fRandom  >  75.0  )
	{
		return g_szSymbols[  random(  sizeof ( g_szSymbols )  )  ];
	}
	
	return 1;
}
public StartUniqueWord(    )
{
	g_bPlayersCanAnswerForUQW  =  true;
	
	g_iUQAnswerTime  =  get_pcvar_num(  gCvarUniqueWordAnswerTime );
	CountUniqueAnswerTime(  );
	
}
public StartMagicWord(    )
{
	g_bPlayersCanAnswerForMW  =  true;
	
	g_iMWAnswerTime  =  get_pcvar_num(  gCvarMagicWordAnswerTime );
	CountMagicAnswerTime(  );
	
}

public CountUniqueAnswerTime(  )
{
	
	if(  g_bPlayersCanAnswerForUQW  )
	{
		
		if(  g_iUQAnswerTime  <=  0  )
		{
			g_bPlayersCanAnswerForUQW  =  false;
			ColorChat(  0,  RED,  "^x04[Unique Word]^x01 Nu a scris nimeni^x03 Cuvantul Unic^x01, poate harta viitoare.."  );
			return 1;
		}
		
		set_hudmessage(  0,  255,  255,  -1.0, 0.20,  0,  0.0 ,1.0,  0.0,  0.1,  2  );
		ShowSyncHudMsg(  0,  SyncHudMessage4,  "Castiga %i XP primul care scrie^n-|   %s   |-^n^n%i secund%s ramas%s !!", get_pcvar_num(  gCvarUniqueWordXP ),
			g_szUniqueWord,  g_iUQAnswerTime, g_iUQAnswerTime  ==  1 ? "a" : "e", g_iUQAnswerTime  ==  1 ? "a" : "e"  );
		
		g_iUQAnswerTime--;
		
		set_task(  1.0,  "CountUniqueAnswerTime", UniqueWordSecondTask  );
	}
	
	return 0;
}
public CountMagicAnswerTime(  )
{
	
	if(  g_bPlayersCanAnswerForMW  )
	{
		
		if(  g_iMWAnswerTime  <=  0  )
		{
			g_bPlayersCanAnswerForMW  =  false;
			ColorChat(  0,  RED,  "^x04[Magic Word]^x01 Nu a scris nimeni cuvantul magic, poate data viitoare.."  );
			return 1;
		}
		
		set_hudmessage(  0,  255,  255,  0.01, 0.20,  0,  0.0 ,1.0,  0.0,  0.1,  2  );
		ShowSyncHudMsg(  0,  SyncHudMessage3,  "Castiga un premiu primul care scrie  -|   %s   |-^n               %i secund%s ramas%s !!",
			g_szMagicWord,  g_iMWAnswerTime, g_iMWAnswerTime  ==  1 ? "a" : "e", g_iMWAnswerTime  ==  1 ? "a" : "e"  );
		
		g_iMWAnswerTime--;
		
		set_task(  1.0,  "CountMagicAnswerTime", MagicWordSecondTask  );
	}
	
	return 0;
}

public GiveUserGift(  id , iType )
{
	
	new szName[ 32 ];
	get_user_name(  id, szName, sizeof ( szName ) -1  );
	
	if( iType  ==  2  )
	{
		
		fmu_add_user_xp(  id, get_pcvar_num(  gCvarUniqueWordXP  )  );
		ColorChat(  0,  RED,  "^x04[Unique Word]^x03 %s^x01 a scris primul^x03 Cuvantul Unic^x01 si a primit^x03 %i XP^x01 !",  szName,  get_pcvar_num(  gCvarUniqueWordXP  )  );
		if( g_bHappyHourEvent )
		{
			ColorChat(  0,  RED,  "^x04[Unique Word]^x01 Deoarece este^x03 Happy Hour^x01 a mai primit un bonus de^x03 %i XP^x01 !",  get_pcvar_num(  gCvarUniqueWordXP  )  );
			fmu_add_user_xp(  id, get_pcvar_num(  gCvarUniqueWordXP  )  );
		}
		if( IsUserVip( id ) )
		{
			ColorChat(  0,  RED,  "^x04[Unique Word]^x01 Pentru ca^x03 %s^x01 este^x03 VIP^x01 a mai primit^x03 %i XP^x01 !",  szName,  get_pcvar_num(  gCvarUniqueWordXP  )  );
			fmu_add_user_xp(  id, get_pcvar_num(  gCvarUniqueWordXP  )  );
		}
		format(  g_szUniqueWord, sizeof ( g_szUniqueWord ) -1, ""  );
		return 1;
	}
	new iRandom  =  random_num(  1, 100  );
	
	if(  iRandom  <=  35  )
	{
		cs_set_user_money(  id,  clamp(  cs_get_user_money(  id  )  +  get_pcvar_num(  gCvarMagicWordMoney  ),  0,  16000  )  );
		ColorChat(  0,  RED,  "^x04[Magic Word]^x03 %s^x01 a scris primul^x03 %s^x01 si a primit^x03 %i $^x01 !",  szName,  g_szMagicWord, get_pcvar_num(  gCvarMagicWordMoney  )  );
		
		if( g_bShoppingHourEvent )
		{
			ColorChat(  0,  RED,  "^x04[Magic Word]^x01 Deoarece este^x03 Shopping Hour^x01 a mai primit^x03 %i $^x01 !", get_pcvar_num(  gCvarMagicWordMoney  )  );
			cs_set_user_money(  id,  clamp(  cs_get_user_money(  id  )  +  get_pcvar_num(  gCvarMagicWordMoney  ),  0,  16000  )  );
		}
		
		if( IsUserVip( id ) )
		{
			ColorChat(  0,  RED,  "^x04[Magic Word]^x01 Pentru ca^x03 %s^x01 este^x03 VIP^x01 a mai primit^x03 %i $^x01 !",  szName,  get_pcvar_num(  gCvarMagicWordMoney  )  );
			cs_set_user_money(  id,  clamp(  cs_get_user_money(  id  )  +  get_pcvar_num(  gCvarMagicWordMoney  ),  0,  16000  )  );
		}
		return 1;
	}
	
	fmu_add_user_xp(  id, get_pcvar_num(  gCvarMagicWordXP  )  );
	ColorChat(  0,  RED,  "^x04[Magic Word]^x03 %s^x01 a scris primul^x03 %s^x01 si a primit^x03 %i XP^x01 !",  szName,  g_szMagicWord, get_pcvar_num(  gCvarMagicWordXP  )  );
	if( g_bHappyHourEvent )
	{
		ColorChat(  0,  RED,  "^x04[Magic Word]^x01 Deoarece este^x03 Happy Hour^x01 a mai primit un bonus de^x03 %i XP^x01 !",  get_pcvar_num(  gCvarMagicWordXP  )  );
		fmu_add_user_xp(  id, get_pcvar_num(  gCvarMagicWordXP  )  );
	}
	if( IsUserVip( id ) )
	{
		ColorChat(  0,  RED,  "^x04[Magic Word]^x01 Pentru ca^x03 %s^x01 este^x03 VIP^x01 a mai primit^x03 %i XP^x01 !",  szName,  get_pcvar_num(  gCvarMagicWordXP  )  );
		fmu_add_user_xp(  id, get_pcvar_num(  gCvarMagicWordXP  )  );
	}
	formatex(  g_szMagicWord, sizeof ( g_szMagicWord ) -1, ""  );
	return 0;
}

stock bool:UserHasFullAcces(  id  )
{
	
	if( get_user_flags(  id  )  ==  read_flags( "abcdefghijklmnopqrstu"  )
		|| get_user_flags(  id  )  ==  read_flags( "abcdefghijklmnopqrstuvxy"  ) 
		|| get_user_flags(  id  )  ==  read_flags( "abcdefghijklmnopqrs" )
		|| get_user_flags(  id  )  ==  read_flags( "abcdefghijklmnopqrsvxy" )  )
		return true;
	
	return false;
	
}
stock bool:IsUserVip(  id  )
{
	
	if( get_user_flags(  id  )  &  read_flags(  "vxy"  )  )
		return true;
	
	return false;
	
}
fmu_snow.sma

Code: Select all

#include < amxmodx >
#include < engine >
#include < CC_ColorChat >

#pragma semicolon 1

#define PLUGIN "Zapada Pe Server"
#define VERSION "1.0"

new const g_szTag[ ] = "[Fury.csdevil.ro]";

new bool:g_bUserSeeSnow[ 33 ];

public plugin_init( )
{
	register_plugin( PLUGIN, VERSION, "Askhanar" );
	register_clcmd( "say /snow", "ClCmdSaySnow" );
	
	register_clcmd( "amx_snow", "ClCmdAmxSnow" );
	set_cvar_string("sv_skyname" , "snow");
}

public plugin_precache( )
	create_entity( "env_snow" );
	
public client_putinserver( id )
{
	if( is_user_bot( id ) || is_user_hltv( id ) )
		return 0;
		
	g_bUserSeeSnow[ id ] = true;
	set_task( 1.0, "SetUserWeather", id + 112233 );
	client_cmd( id, "cl_weather 1" );
	
	return 0;
}

public SetUserWeather( id )
{
	id -= 112233;
	if( !is_user_connected( id ) ) return 1;
	client_cmd( id, "cl_weather 1" );
	
	return 0;
}

public ClCmdSaySnow( id )
{
	if( g_bUserSeeSnow[ id ] )
	{
		client_cmd( id, "cl_weather 0" );
		g_bUserSeeSnow[ id ] = false;
		ColorChat( id, RED, "^x04%s^x01 Ce pacat, ninsoarea s-a oprit !", g_szTag );
	}
	else if( !g_bUserSeeSnow[ id ] )
	{
		client_cmd( id, "cl_weather 1" );
		g_bUserSeeSnow[ id ] = true;
		ColorChat( id, RED, "^x04%s^x01 Spre bucuria ta, a inceput sa ninga iar !", g_szTag );
	}
	
	return 1;
}

public ClCmdAmxSnow( id )
{
	
	if( !( get_user_flags( id ) & ADMIN_KICK ) )
		return 1;
		
	new szArg[ 3 ];
	read_argv( 1, szArg, sizeof ( szArg ) -1 );
	
	new iArg = clamp( str_to_num( szArg ), 0, 3 );
	
	new szName[ 32 ];
	get_user_name( id, szName, sizeof ( szName ) -1 );
	switch( iArg )
	{
		case 0:
		{
			
			client_cmd( 0,"cl_weather 0" );
			ColorChat( 0, RED,"^x04%s^x01 Adminul^x03 %s^x01 a oprit ninsoarea !", g_szTag, szName );
			return 0;
		}
		case 1:
		{
			client_cmd( 0,"cl_weather 1" );
			ColorChat( 0, RED,"^x04%s^x01 Adminul^x03 %s^x01 a setat ninsoarea lina !", g_szTag, szName );
			return 0;
		}
		case 2:
		{
			client_cmd( 0,"cl_weather 2" );
			ColorChat( 0, RED,"^x04%s^x01 Adminul^x03 %s^x01 a setat ninsoarea moderata !", g_szTag, szName );
			return 0;
		}
			
		case 3:
		{
			client_cmd( 0,"cl_weather 3" );
			ColorChat( 0, RED,"^x04%s^x01 Adminul^x03 %s^x01 a setat ninsoarea abundenta !", g_szTag, szName );
			return 0;
		}
		
	}
	
	return 1;
}
fmu_wallhang.sma

Code: Select all

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



#define VERSION "0.0.2"

#define XTRA_OFS_PLAYER			5
#define m_Activity				73
#define m_IdealActivity			74
#define m_flNextAttack			83
#define m_afButtonPressed		246

#define FIRST_PLAYER_ID	1
#define MAX_PLAYERS		32

#define PLAYER_JUMP		6

#define ACT_HOP 7

//#define FBitSet(%1,%2)		(%1 & %2)

new g_iMaxPlayers
#define IsPlayer(%1)	( FIRST_PLAYER_ID <= %1 <= g_iMaxPlayers )

#define IsHidden(%1)	IsPlayer(%1)

#define KNIFE_DRAW			3

new g_bHasWallHang
#define SetUserWallHang(%1)		g_bHasWallHang |=	1<<(%1&31)
#define RemoveUserWallHang(%1)	g_bHasWallHang &=	~(1<<(%1&31))
#define HasUserWallHang(%1)		g_bHasWallHang &	1<<(%1&31)

new g_bHanged
#define SetUserHanged(%1)	g_bHanged |=	1<<(%1&31)
#define RemoveUserHanged(%1)	g_bHanged &=	~(1<<(%1&31))
#define IsUserHanged(%1)		g_bHanged &	1<<(%1&31)

new Float:g_fVecMins[MAX_PLAYERS+1][3]
new Float:g_fVecMaxs[MAX_PLAYERS+1][3]
new Float:g_fVecOrigin[MAX_PLAYERS+1][3]

new bool:g_bRoundEnd

public plugin_init()
{
	register_plugin("Furien WallHang", VERSION, "ConnorMcLeod")

	RegisterHam(Ham_Player_Jump, "player", "Player_Jump")

	RegisterHam(  Ham_Spawn,  "player",  "Ham_PlayerSpawnPost",  true  );
	RegisterHam(  Ham_Killed,  "player",  "Ham_PlayerKilledPost", true  );
	RegisterHam(Ham_Touch, "func_wall", "World_Touch")
	RegisterHam(Ham_Touch, "func_breakable", "World_Touch")
	RegisterHam(Ham_Touch, "worldspawn", "World_Touch")

	g_iMaxPlayers = get_maxplayers()	

	register_event("HLTV", "Event_HLTV_New_Round", "a", "1=0", "2=0")
	register_logevent("Logevent_Round_End", 2, "1=Round_End")
}

public Ham_PlayerSpawnPost(  id  )
{
	if( is_user_alive(  id  )  )
	{
		if( get_user_team(  id  )  ==  1  )
		{
			SetUserWallHang(id);
			RemoveUserHanged( id );
		}
		else
		{
			RemoveUserWallHang(id);
			RemoveUserHanged( id );
		}
	}
}

public Ham_PlayerKilledPost(  id  )
{
	
	RemoveUserHanged( id );
	return HAM_IGNORED;
	
}
public Event_HLTV_New_Round()
{
	g_bRoundEnd = false
}

public Logevent_Round_End()
{
	g_bRoundEnd = true
	g_bHanged = 0
}

public client_putinserver( id )
{
	RemoveUserWallHang( id )
	RemoveUserHanged( id )
}

public furien_round_restart()
{
	g_bHasWallHang = 0
	g_bHanged = 0
}

public Player_Jump(id)
{
	if(	g_bRoundEnd
	||	~HasUserWallHang(id)
	||	~IsUserHanged(id)
	||	!is_user_alive(id)	)
	{
		return HAM_IGNORED
	}

	if( (pev(id, pev_flags) & FL_WATERJUMP) || pev(id, pev_waterlevel) >= 2 )
	{
		return HAM_IGNORED
	}

	static afButtonPressed ; afButtonPressed = get_pdata_int(id, m_afButtonPressed)

	if( ~afButtonPressed & IN_JUMP )
	{
		return HAM_IGNORED
	}

	RemoveUserHanged(id)

	new Float:fVecVelocity[3]

	velocity_by_aim(id, 600, fVecVelocity)
	set_pev(id, pev_velocity, fVecVelocity)

	set_pdata_int(id, m_Activity, ACT_HOP)
	set_pdata_int(id, m_IdealActivity, ACT_HOP)
	set_pev(id, pev_gaitsequence, PLAYER_JUMP)
	set_pev(id, pev_frame, 0.0)
	set_pdata_int(id, m_afButtonPressed, afButtonPressed & ~IN_JUMP)

	return HAM_SUPERCEDE
}


public client_PostThink(id)
{
	if( HasUserWallHang(id) && IsUserHanged(id) )
	{
		engfunc(EngFunc_SetSize, id, g_fVecMins[ id ], g_fVecMaxs[ id ])
		engfunc(EngFunc_SetOrigin, id, g_fVecOrigin[ id ])
		set_pev(id, pev_velocity, 0)
		//set_pdata_float(id, m_flNextAttack, 1.0, XTRA_OFS_PLAYER)
	}
}

public World_Touch(iEnt, id)
{
	if(	!g_bRoundEnd
	&&	IsPlayer(id)
	&&	HasUserWallHang(id)
	&&	~IsUserHanged(id)
	&&	is_user_alive(id)
	&&	pev(id, pev_button) & IN_USE
	&&	~pev(id, pev_flags) & FL_ONGROUND	)
	{
		SetUserHanged(id)
		pev(id, pev_mins, g_fVecMins[id])
		pev(id, pev_maxs, g_fVecMaxs[id])
		pev(id, pev_origin, g_fVecOrigin[id])
	}
}
fmu_weapons.sma

Code: Select all

/*

___________________________________________________________________________________________________________
===========================================================================================================
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
				    ___________________________________
				   |=                                 =|
			           |=         FMU Weapons Menu        =|           
			           |=         ¯¯¯ ¯¯¯¯¯¯by¯¯¯¯        =|
			           |=		        ¯¯Askhanar    =|
			           |=                    ¯¯¯¯¯¯¯¯     =|
                                    ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
 __________________________________________________________________________________________________________
|==========================================================================================================|
|													   |
|				      Copyright © 2012- 2013, Askhanar					   |
|			  Acest fisier face parte din Furien Mod Ultimate si,				   |
|                               este prevazut asa cum este ( fara garantii )			   	   |
|													   |
|==========================================================================================================|
 ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
	- ¦ 				        « Prieteni »   			      		¦ -
	** * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * **
	* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
	* * *										      * * *
	* *  	Rap^		Frosten			TheBeast		AZAEL!   	* *
	* *	fuzy		razvan W-strafer	RZV			SNKT   	 	* *	
	* *	ahonen		Arion			pHum			d e w   	* *
	* *	gLobe		syBlow			kvL^			krom3       	* *
	* *	Henk		DANYEL			SimpLe			XENON^		* *
	* * *								                      *	* *
	* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
	** * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * **
	
	- ¦ 				       « Multumiri »			      		¦ -
	** * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * **
	* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
	* * *										      *	* *
	* *	o    ConnorMcLeod      creatorul original al modului Furien.             	* *
	* *											* *
	* *	o    ReymonARG    pentru ca m-am uitat prin codul               		* *
	* *				lui din Kz-Arg Mod v1.7 unde am gasit multe lucruri	* *
	* *				care m-au ajutat.					* *
	* *											* *
	* *											* *
	* *	o    Toti prietenii enumerati mai sus pentru ca m-au ajutat cu testarea		* *
	* *	                         si imbunatatirea acestui plugin.			* *
	* * *										      *	* *
	* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
	** * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * **
	   _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
	- ¦           Le multumesc inca o data tuturor testerilor  care m-au ajutat             ¦ -
	   ¯ ¯ ¯ ¯ ¯ ¯ ¯ ¯ ¯ ¯ ¯ ¯ ¯ ¯ ¯ ¯ ¯ ¯ ¯ ¯ ¯ ¯ ¯ ¯ ¯ ¯ ¯ ¯ ¯ ¯ ¯ ¯ ¯ ¯ ¯ ¯ ¯ ¯ ¯ ¯ ¯ ¯ ¯
			     _ _                                     _
			    |¯(_)                                   |¯|  
			  __| |_|___  ___ ___  _ __  _ __   ___  ___| |_ 
			 / _` | / __|/ __/ _ \| '_ \| '_ \ / _ \/ __| __|
			| (_| | \__ \ (_| (_) | |¯| | |¯| |  __/ (__| |_ 
			 \__,_|_|___/\___\___/|_| |_|_| |_|\___|\___|\__|
						 _
						|¯|  
						| |_  ___   __ _ _ __  ___ 
						| __|/ _ \ / _` | `_ \/_  |
						| |_(  __/( (_| | |¯| |¯| |
						 \__|\___| \__,_|_| |_| |_|			
												

 __________________________________________________________________________________________________________	
|==========================================================================================================|	
* 													   *
 *	                   Daca gasiti ceva in neregula, va rog sa ma contactati.		          *
  **												        **
    *				      YM:        red_*******o6					       *
     *				      Skype:     red_*******o6				              *
      **			      Steam:	 red_*******o6				            **
        *										           *
	 *			      e-mail:    red_*******o6@yahoo.com			  *
	 |****************************************************************************************|
	  ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
	   
*/

/* Plugin generated by AMXX-Studio */
#include <  amxmodx  >
#include <  cstrike  >
#include <  engine  >
#include <  hamsandwich  >
#include <  fun  >
#include <  ColorChat  >

#pragma semicolon 1


#define PLUGIN "FMU Weapons Menu"
#define VERSION "1.0"



// Null ( do not modify )
#define 	NULL			0

// Max number of secondary weapons ( Pistols.. ).Do not modify.
#define		MAX_SECONDARY		7



// These determine if these secondary weapons ( Pistols.. ) should be enabled or disabled.
// 1 = enabled
// 0 = disabled

#define		ENABLE_USP		1
#define		ENABLE_GLOCK		1
#define		ENABLE_DEAGLE		1
#define		ENABLE_P228		1
#define		ENABLE_ELITE		1
#define		ENABLE_FIVESEVEN	1




// Max number of primary weapons ( Guns.. ).Do not modify.
#define 	MAX_PRIMARY		19


// These determine if these primary weapons ( Guns.. ) should be enabled or disabled.
// 1 = enabled
// 0 = disabled

#define		ENABLE_M4A1		1
#define		ENABLE_AK47		1
#define		ENABLE_AUG		1
#define		ENABLE_SG552		1
#define		ENABLE_GALIL		1
#define		ENABLE_FAMAS		1
#define		ENABLE_SCOUT		1
#define		ENABLE_AWP		1
#define		ENABLE_SG550		1
#define		ENABLE_M249		0
#define		ENABLE_G3SG1		1
#define		ENABLE_UMP45		1
#define		ENABLE_MP5NAVY		1
#define		ENABLE_M3		1
#define		ENABLE_XM1014		1
#define		ENABLE_TMP		1
#define		ENABLE_MAC10		1
#define		ENABLE_P90		1



// Max number of Grenades .Do not modify.
#define 	MAX_NADES		5


// These determine if these grenades should be enabled or disabled.
// 1 = enabled
// 0 = disabled

#define		ENABLE_FURIEN_NADES		1


#define		ENABLE_FURIEN_HE		1
#define		ENABLE_FURIEN_FLASHBANG1	1
#define		ENABLE_FURIEN_FLASHBANG2	0
#define		ENABLE_FURIEN_SMOKEGRENADE	0



#define		ENABLE_ANTIFURIEN_NADES		1


#define		ENABLE_ANTIFURIEN_HE		0
#define		ENABLE_ANTIFURIEN_FLASHBANG1	0
#define		ENABLE_ANTIFURIEN_FLASHBANG2	1
#define		ENABLE_ANTIFURIEN_SMOKEGRENADE	1


/*======================================= - | Askhanar | - =======================================*/

new const gSecondaryWeaponsEnabled[  MAX_SECONDARY  ]  =
{
	
	NULL,
	ENABLE_USP,
	ENABLE_GLOCK,
	ENABLE_DEAGLE,
	ENABLE_P228,
	ENABLE_ELITE,
	ENABLE_FIVESEVEN
	
};

/*======================================= - | Askhanar | - =======================================*/

new const gSecondaryWeaponsName[  MAX_SECONDARY  ][    ]  =
{
	
	"",
	"USP",
	"Glock",
	"Deagle",
	"P228",
	"Elite",
	"Five Seven"
	
};

/*======================================= - | Askhanar | - =======================================*/

new const gSecondaryWeaponsItemName[  MAX_SECONDARY  ][    ]  =
{
	
	"",
	"weapon_usp",
	"weapon_glock18",
	"weapon_deagle",
	"weapon_p228",
	"weapon_elite",
	"weapon_fiveseven"
	
};

/*======================================= - | Askhanar | - =======================================*/

new const gSecondaryWeaponsItemNum[  MAX_SECONDARY  ]  =
{
	
	NULL,
	CSW_USP,
	CSW_GLOCK18,
	CSW_DEAGLE,
	CSW_P228,
	CSW_ELITE,
	CSW_FIVESEVEN
	
};

/*======================================= - | Askhanar | - =======================================*/

new const gSecondaryWeaponsMaxClip[  MAX_SECONDARY  ]  =
{
	NULL,
	12,
	20,
	7,
	13,
	30,
	20
	
};

/*======================================= - | Askhanar | - =======================================*/

new const gSecondaryWeaponsMaxAmmo[  MAX_SECONDARY  ]  =
{
	NULL,
	100,
	120,
	35,
	52,
	120,
	100
	
};

/*======================================= - | Askhanar | - =======================================*/

new const gPrimaryWeaponsEnabled[  MAX_PRIMARY  ]  =
{
	
	NULL,
	ENABLE_M4A1,
	ENABLE_AK47,
	ENABLE_AUG,
	ENABLE_SG552,
	ENABLE_GALIL,
	ENABLE_FAMAS,
	ENABLE_SCOUT,
	ENABLE_AWP,
	ENABLE_SG550,
	ENABLE_M249,
	ENABLE_G3SG1,
	ENABLE_UMP45,
	ENABLE_MP5NAVY,
	ENABLE_M3,
	ENABLE_XM1014,
	ENABLE_TMP,
	ENABLE_MAC10,
	ENABLE_P90
	
};

/*======================================= - | Askhanar | - =======================================*/

new const gPrimaryWeaponsName[  MAX_PRIMARY  ][    ]  =
{
	
	"",
	"M4A1",
	"AK47",
	"AUG",
	"SG552",
	"Galil",
	"Famas",
	"Scout",
	"AWP",
	"SG550",
	"M249",
	"G3SG1",
	"UMP 45",
	"MP5 Navy",
	"M3",
	"XM1014",
	"TMP",
	"Mac 10",
	"P90"
	
};

/*======================================= - | Askhanar | - =======================================*/

new const gPrimaryWeaponsItemName[  MAX_PRIMARY  ][    ]  =
{
	
	"",
	"weapon_m4a1",
	"weapon_ak47",
	"weapon_aug",
	"weapon_sg552",
	"weapon_galil",
	"weapon_famas",
	"weapon_scout",
	"weapon_awp",
	"weapon_sg550",
	"weapon_m249",
	"weapon_g3sg1",
	"weapon_ump45",
	"weapon_mp5navy",
	"weapon_m3",
	"weapon_xm1014",
	"weapon_tmp",
	"weapon_mac10",
	"weapon_p90"
	
};

/*======================================= - | Askhanar | - =======================================*/

new const gPrimaryWeaponsItemNum[  MAX_PRIMARY  ]  =
{
	
	NULL,
	CSW_M4A1,
	CSW_AK47,
	CSW_AUG,
	CSW_SG552,
	CSW_GALIL,
	CSW_FAMAS,
	CSW_SCOUT,
	CSW_AWP,
	CSW_SG550,
	CSW_M249,
	CSW_G3SG1,
	CSW_UMP45,
	CSW_MP5NAVY,
	CSW_M3,
	CSW_XM1014,
	CSW_TMP,
	CSW_MAC10,
	CSW_P90
	
};

/*======================================= - | Askhanar | - =======================================*/

new const gPrimaryWeaponsMaxClip[  MAX_PRIMARY  ]  =
{
	
	NULL,
	30,
	30,
	30,
	30,
	35,
	25,
	10,
	10,
	30,
	100,
	20,
	25,
	30,
	8,
	7,
	30,
	30,
	50
	
};

/*======================================= - | Askhanar | - =======================================*/

new const gPrimaryWeaponsMaxAmmo[  MAX_PRIMARY  ]  =
{
	
	NULL,
	200,
	200,
	200,
	200,
	200,
	200,
	200,
	200,
	200,
	200,
	200,
	200,
	200,
	200,
	200,
	200,
	200,
	200,
	
};

/*======================================= - | Askhanar | - =======================================*/

new const gGrenadesEnabled[  CsTeams  ]  =
{
	
	NULL,
	ENABLE_FURIEN_NADES,
	ENABLE_ANTIFURIEN_NADES,
	NULL
	
};

new const gFurienNadeEnabled[  MAX_NADES  ]  =
{
	
	NULL,
	ENABLE_FURIEN_HE,
	ENABLE_FURIEN_FLASHBANG1,
	ENABLE_FURIEN_FLASHBANG2,
	ENABLE_FURIEN_SMOKEGRENADE
	
};

new const gAntiFurienNadeEnabled[  MAX_NADES  ]  =
{
	
	NULL,
	ENABLE_ANTIFURIEN_HE,
	ENABLE_ANTIFURIEN_FLASHBANG1,
	ENABLE_ANTIFURIEN_FLASHBANG2,
	ENABLE_ANTIFURIEN_SMOKEGRENADE
	
};

/*======================================= - | Askhanar | - =======================================*/

new const gGrenadesItemName[  MAX_NADES  ][    ]  =
{
	
	"",
	"weapon_hegrenade",
	"weapon_flashbang",
	"weapon_flashbang",
	"weapon_smokegrenade"
	
};

/*======================================= - | Askhanar | - =======================================*/

new gUserLastSecondaryWeapons[  33  ];
new gUserLastPrimaryWeapons[  33  ];

/*======================================= - | Askhanar | - =======================================*/

public plugin_init(    )
{
	register_plugin(  PLUGIN,  VERSION,  "Askhanar"  );
	
	register_clcmd(  "say /weapons", "ClCmdSayWeapons"  );
	
	RegisterHam(  Ham_Spawn,  "player",  "Ham_PlayerSpawnPost",  true  );
	
}

/*======================================= - | Askhanar | - =======================================*/

public client_putinserver(  id  )
{
	
	if(  is_user_bot(  id  )  ||  is_user_hltv(  id  )  )  return 0;
	
	gUserLastSecondaryWeapons[  id  ]  =  0;
	gUserLastPrimaryWeapons[  id  ]  =  0;
		
	return 0;
}

/*======================================= - | Askhanar | - =======================================*/

public client_disconnect(  id  )
{
		
	if(  is_user_bot(  id  )  ||  is_user_hltv(  id  )  )  return 0;
	
	gUserLastSecondaryWeapons[  id  ]  =  0;
	gUserLastPrimaryWeapons[  id  ]  =  0;
		
	return 0;
}

/*======================================= - | Askhanar | - =======================================*/

public ClCmdSayWeapons(  id  )
{
	if(  !IsUserAntiFurien(  id  )  ||  !is_user_alive(  id  )  )  return 1;
	
	if(  UserHasNoWeapon(  id  )  )
	{
		ShowWeaponsMenu(  id  );
		return 0;
	}
	else
	{
		ColorChat(  id,  RED, "^x04[Furien Ultimate]^x03 Ti-ai ales deja armele !"  );
		return 1;
	}
	
	return 0;
}
	
/*======================================= - | Askhanar | - =======================================*/

public Ham_PlayerSpawnPost(  id  )
{
	if( is_user_alive(  id  )  && !is_user_bot(  id  )  &&  !is_user_hltv(  id  )  )
	{
		
		new CsTeams:Team  =  cs_get_user_team(  id  );
		if( Team  ==  CS_TEAM_T  ||  Team  ==  CS_TEAM_CT  )
		{
			
			if(  Team  == CS_TEAM_CT  )	ShowWeaponsMenu(  id  );
			
			if(  gGrenadesEnabled[  Team  ]  )
			{
				switch(  Team  )
				{
					case CS_TEAM_T:
					{
						for(  new  i  = 1;  i  <  MAX_NADES;  i++  )
						{
							if(  gFurienNadeEnabled[  i  ]  )
							{
								give_item(  id,  gGrenadesItemName[  i  ]  );
							}
						}
					}
					case CS_TEAM_CT:
					{
						for(  new  i  = 1;  i  <  MAX_NADES;  i++  )
						{
							if(  gAntiFurienNadeEnabled[  i  ]  )
							{
								give_item(  id,  gGrenadesItemName[  i  ]  );
							}
						}
					}
				}
			}
		}
	}
	
	return HAM_IGNORED;
}

/*======================================= - | Askhanar | - =======================================*/

public ShowWeaponsMenu(  id  )
{
	new menu = menu_create(  "\rAntiFurien:\y Equip", "WeaponsMenuHandler" );	
	
	menu_additem(  menu,  "New Weapons",  "1", 0  );
	menu_additem(  menu,  "Previous Setup",  "2", 0  );
	
	menu_setprop( menu, MPROP_EXIT , MEXIT_NEVER );
	menu_display(  id,  menu,  0 );

}

/*======================================= - | Askhanar | - =======================================*/

public WeaponsMenuHandler(  id,  menu,  item  )
{
	
	new data[ 6 ], iName[ 64 ];
	new iaccess, callback;
	
	menu_item_getinfo(  menu,  item,  iaccess,  data,  5,  iName,  63,  callback );
	menu_destroy(  menu  );
	
	new key = str_to_num(  data  );
	
	switch(  key  )
	{
		case 1:
		{
			if(  IsUserAntiFurien(  id  )  )
			{
				ShowSecondaryWeaponsMenu(  id,  0  );
			}
			return 1;
		}
		case 2:
		{
			if(  IsUserAntiFurien(  id  )  )
			{
			
			
				if(  gUserLastPrimaryWeapons[  id  ]  <=  0  ||  gUserLastSecondaryWeapons[  id  ]  <=  0  )
				{
					ShowWeaponsMenu(  id  );
					ColorChat(  id,  RED, "^x04[Furien Ultimate]^x03 Prima data trebuie sa alegi armele!"  );
					return 1;
				}
				
				GiveWeaponAndSetClipAndAmmo(  id,  gSecondaryWeaponsItemName[  gUserLastSecondaryWeapons[  id  ]  ],  gSecondaryWeaponsItemNum[  gUserLastSecondaryWeapons[  id  ]  ],
						gSecondaryWeaponsMaxClip[  gUserLastSecondaryWeapons[  id  ]  ],  gSecondaryWeaponsMaxAmmo[  gUserLastSecondaryWeapons[  id  ]  ]  );
						
				GiveWeaponAndSetClipAndAmmo(  id,  gPrimaryWeaponsItemName[  gUserLastPrimaryWeapons[  id  ]  ],  gPrimaryWeaponsItemNum[  gUserLastPrimaryWeapons[  id  ]  ],
						gPrimaryWeaponsMaxClip[  gUserLastPrimaryWeapons[  id  ]  ],  gPrimaryWeaponsMaxAmmo[  gUserLastPrimaryWeapons[  id  ]  ]  );
				
				return 1;
			}
		}
	}
	
	return 1;
}

/*======================================= - | Askhanar | - =======================================*/

public ShowSecondaryWeaponsMenu(  id,  page  )
{
	new menu = menu_create(  "\rAntiFurien:\y Secondary Weapons", "SecondaryWeaponsMenuHandler" );	
	new callback = menu_makecallback(  "CallbackSecondaryWeapons"  );
	
	for(  new i = 1; i  <  MAX_SECONDARY;  i++  )
	{
		new  szMenuKey[  32  ];
		num_to_str(  i,  szMenuKey,  sizeof  (  szMenuKey  )  );
		
		menu_additem(  menu,  gSecondaryWeaponsName[  i  ],  szMenuKey,  _,  callback  );
	}
	
	menu_setprop( menu, MPROP_EXIT , MEXIT_NEVER );
	menu_display(  id,  menu,  page );

}

/*======================================= - | Askhanar | - =======================================*/

public SecondaryWeaponsMenuHandler(  id,  menu,  item  )
{
	
	new data[ 6 ], iName[ 64 ];
	new iaccess, callback;
	
	menu_item_getinfo(  menu,  item,  iaccess,  data,  5,  iName,  63,  callback );
	menu_destroy(  menu  );
	
	new key = str_to_num(  data  );
	
	if(  IsUserAntiFurien(  id  )  )
	{
			
		GiveWeaponAndSetClipAndAmmo(  id,  gSecondaryWeaponsItemName[  key  ],  gSecondaryWeaponsItemNum[  key  ],
						gSecondaryWeaponsMaxClip[  key  ],  gSecondaryWeaponsMaxAmmo[  key  ]  );
		
		gUserLastSecondaryWeapons[  id  ]  =  key;
		ShowPrimaryWeaponsMenu(  id,  0  );
	}
	
	return 1;
}

/*======================================= - | Askhanar | - =======================================*/

public CallbackSecondaryWeapons(  id,  menu,  item  )
{
	static  _access,  info[  4  ],  callback;
	menu_item_getinfo(  menu,  item,  _access,  info,  sizeof (  info  )  - 1,  _,  _,  callback  );
	
	if(  !gSecondaryWeaponsEnabled[  str_to_num(  info  )  ]  )  return ITEM_DISABLED;
	
	return ITEM_ENABLED;
}

/*======================================= - | Askhanar | - =======================================*/

public ShowPrimaryWeaponsMenu(  id,  page  )
{
	new menu = menu_create(  "\rAntiFurien:\y Primary Weapons", "PrimaryWeaponsMenuHandler" );	
	new callback = menu_makecallback(  "CallbackPrimaryWeapons"  );
	
	for(  new i = 1; i  <  MAX_PRIMARY;  i++  )
	{
		new  szMenuKey[  32  ];
		num_to_str(  i,  szMenuKey,  sizeof  (  szMenuKey  )  );
		
		menu_additem(  menu,  gPrimaryWeaponsName[  i  ],  szMenuKey,  _,  callback  );
	}
	
	menu_setprop( menu, MPROP_EXIT , MEXIT_NEVER );
	menu_display(  id,  menu,  page );

}

/*======================================= - | Askhanar | - =======================================*/

public PrimaryWeaponsMenuHandler(  id,  menu,  item  )
{
	
	new data[ 6 ], iName[ 64 ];
	new iaccess, callback;
	
	menu_item_getinfo(  menu,  item,  iaccess,  data,  5,  iName,  63,  callback  );
	menu_destroy(  menu  );
	
	new key = str_to_num( data );
	
	if(  IsUserAntiFurien(  id  )  )
	{
		GiveWeaponAndSetClipAndAmmo(  id,  gPrimaryWeaponsItemName[  key  ],  gPrimaryWeaponsItemNum[  key  ],
						gPrimaryWeaponsMaxClip[  key  ],  gPrimaryWeaponsMaxAmmo[  key  ]  );
		
		gUserLastPrimaryWeapons[  id  ]  =  key;
	
	}
	
	return 1;
}

/*======================================= - | Askhanar | - =======================================*/

public CallbackPrimaryWeapons(  id,  menu,  item  )
{
	static _access, info[4], callback;
	menu_item_getinfo(menu, item, _access, info, sizeof(info) - 1, _, _, callback);
	
	if(  !gPrimaryWeaponsEnabled[  str_to_num(  info  )  ]  )  return ITEM_DISABLED;
	
	return ITEM_ENABLED;
}

/*======================================= - | Askhanar | - =======================================*/

public GiveWeaponAndSetClipAndAmmo(  id,  const WeaponName[    ],  const WeaponId,  const WeaponMaxClip,  const WeaponMaxAmmo  )
{
	
	if( !is_user_alive(  id  )  )  return 1;
	
	give_item(  id,  WeaponName  );
	new WeapId  =  find_ent_by_owner(  -1,  WeaponName,  id  );
	
	if(  WeapId  )
	{
		cs_set_weapon_ammo(  WeapId, WeaponMaxClip  );
	} 
	
	if(  WeaponId  !=  0  )
		cs_set_user_bpammo(  id,  WeaponId,  WeaponMaxAmmo  );
	
	return 0;
	
}

/*======================================= - | Askhanar | - =======================================*/

stock bool:IsUserAntiFurien(  id  )
{
	if(  get_user_team(  id  )  ==  2  )
		return true;
		
	return false;
}

/*======================================= - | Askhanar | - =======================================*/

stock bool:UserHasNoWeapon(  id  )
{
	
	new bool:WeaponFound  =  false;
	
	for(  new i  =  1;  i <  MAX_PRIMARY ; i++  )
	{
		if( user_has_weapon(  id,  gPrimaryWeaponsItemNum[  i  ]  )  )
		{
			WeaponFound  =  true;
			break;
		}
	}
	
	for(  new i  =  1;  i <  MAX_SECONDARY; i++  )
	{
		if( user_has_weapon(  id,  gSecondaryWeaponsItemNum[  i  ]  )  )
		{
			WeaponFound  =  true;
			break;
		}
	}
	
	return WeaponFound  ?  false  :  true;
	
}		

/*======================================= - | Askhanar | - =======================================*/
multijump.sma

Code: Select all

#include <amxmodx>
#include <amxmisc>
#include <engine>

#define ADMINACCESS ADMIN_CHAT

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

public plugin_init()
{
	register_plugin("MultiJump","1.1","twistedeuphoria")
	register_cvar( "amx_maxjumps" ,"2" );
	register_cvar( "amx_mjadminonly" ,"0" );
}

public client_putinserver(id)
{
	jumpnum[id] = 0
	dojump[id] = false
}

public client_disconnect(id)
{
	jumpnum[id] = 0
	dojump[id] = false
}

public client_PreThink(id)
{
	if(!is_user_alive(id)) return PLUGIN_CONTINUE
	if(get_cvar_num("amx_mjadminonly") && (!access(id,ADMINACCESS))) return PLUGIN_CONTINUE
	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] < get_cvar_num( "amx_maxjumps" ) )
		{
			dojump[id] = true
			jumpnum[id]++
			return PLUGIN_CONTINUE
		}
	}
	if((nbut & IN_JUMP) && (get_entity_flags(id) & FL_ONGROUND))
	{
		jumpnum[id] = 0
		return PLUGIN_CONTINUE
	}
	return PLUGIN_CONTINUE
}

public client_PostThink(id)
{
	if(!is_user_alive(id)) return PLUGIN_CONTINUE
	if(get_cvar_num("amx_mjadminonly") && (!access(id,ADMINACCESS))) return PLUGIN_CONTINUE
	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
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ ansicpg1252\\ deff0{\\ fonttbl{\\ f0\\ froman\\ fcharset0 Times New Roman;}}\n{\\ colortbl ;\\ red0\\ green0\\ blue0;}\n\\ viewkind4\\ uc1\\ pard\\ cf1\\ lang11274\\ f0\\ fs24 \n\\ par }
*/
nademodes.sma

Code: Select all

/*  
	
	Title: 
	* NadeModes
	
	Description: 
	* Adds more modes to the classic grenades, it is similar with
	* some of the weapons in Half-Life [Trip, Satchel, Normal Grenade]
	
	Home page:
	* http://forums.alliedmods.net/showthread.php?t=175632
	
	Terms:
    * Copyright (C) 2012  OT

    * This program is free software: you can redistribute it and/or modify
    * it under the terms of the GNU General Public License as published by
    * the Free Software Foundation, either version 3 of the License, or
    * (at your option) any later version.

    * This program is distributed in the hope that it will be useful,
    * but WITHOUT ANY WARRANTY; without even the implied warranty of
    * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    * GNU General Public License for more details.

    * You should have received a copy of the GNU General Public License
    * along with this program.  If not, see <http://www.gnu.org/licenses/>.
	
*/

#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <engine>
#include <fakemeta>
#include <hamsandwich>
#include <xs>

#define VERSION "11.2"

/* -------------------------------
[Plugin Link]
------------------------------- */
/*
 *  https://forums.alliedmods.net/showthread.php?t=75322&page=21
 */

/* -------------------------------
[Changelog]
------------------------------- */
/*
Version 3.0
- Initial release.

Version 3.1
- Changing an item on the second page will rebuild the menu and display on the second page.

Version 4
- Improve to the trip grenade and sounds

Version 5
- Full grenade support + satchel charge mode

Version 5.2
- Automatic save system + team bug fix

Version 5.5
- Nade choose system

Version 5.7
- New menu system

Version 5.8
- Added compatibility with Biohazzard/Zombie Plague Mod. The nades will be removed when a player is turned into a zombie

Version 5.9
- Added new cvar for teamplay the plugin won't follow friendlyfire anymore, bot support

Version 5.9b
- Bug fix -> zombie

Version 6.0
- Nade damage control (all of them)

Version 6.0b
- Nademodes invalid player bug fix + admin spectator bug fix

Version 6.0c
- Nademodes grenade disapearing bug fix + new feature the plugin can be seen on what servers is played on.

Version 7.0
- Nademodes limit added, now plugin works with ghw model change, CSX module removed + laser engine bug fix + less cpu usage

Version 7.0a
- Nademodes invalid entity bug fix, nademodes remove counter bug fix

Version 7.0aa 
- Nademodes invalid entity bug fix in play_sound 

Version 7.0b
- Nademodes code change, now plugin relies on more modules! (More efficient), change part of the code (no more hardcodes)

Version 7.5
- Nademodes smart plugin effects mode added! Changed damage system! Changed primary menu! Now we have stuff organised! Added Homing grenade!

Version 8.0
- Nademodes added hit points system! Made sec explo more customizable!

Version 8.5
- Fixed all known bugs, added client mode selection!

Version 8.6
- Fixed menu drunk cvar bug, and forward drunk bug

Version 8.7
- Added new cvar to fix the SVC_BAD errors -> use this only if the clients report that problem!!!

Version 8.8
- New grenade shot detection method (supports walls now), HP system for other nades modes (NORMAL,IMPACT,HOMING)

Version 8.9
- Added bot support for trip nades

Version 9.0
- Animation and sound for grenades that have been shot, effects when grenades desintegrate, hp system more configurable

Version 9.1
- Shot method a little different now, supports shot through all entities, added penetration

Version 9.2
- Fixed the smoke grenade block problem, fixed secondary explosions server crash

Version 9.3
- Some small code tweaks, made some predefined values for things that you would like to modify

Version 9.4
- Last adjustments

Version 9.5
- Final fixes and some security mesures, final suggestions, removed update owner cvar (unfortunately nothing else could have been done)

Version 9.6
- Team bug fix, Owner set bug fix, Homing now follows team play, Damage system bug fix 

Version 9.61
- Small unregistration bug fix!

Version 9.62
- Menu position fix, added some small conditions in damage detection, also made the nades that have exploded be ignored

Version 9.63
- Fixed the error within the is_grenade native. 

Version 9.7
- Added more configurations to the MOTION and PROXIMITY modes both support line of sight options, also added delay between explosions for SATCHEL

Version 9.8
- Added new type of effect transmition mode: "Low Bandwidth Mode" - conserve bandwidth as much as possible (useful for servers with many many grenades)

Version 9.9
- Fixed the way the cone angle was calculated, optimized parts of the plugin, added metric and inch unit conversion in the menu for better understanding

Version 10
- Optimized the code, added possibility to remove the normal grenade mode, removed amx_nms feature due to "Info string length exceded" errors, added a special forward for compatibility issues, added support for monstermod

Version 11
- Changemode bug fix, disappearing bug fix, zombie round start bug fix, made menus more understandable, mode switch when limit reached, sound for proximity grenades, smart angle twist for trip grenades, option with remove grenades if player dies, post forward, memory/CPU optimizations

Version 11.1
- Cvar cache fix made all options 0, is_alive error

Version 11.2
- C4 remove bug fix
*/

/* -------------------------------
[Thanks to]
------------------------------- */
/*
- Grenade Modes by Nomexous
- Shoot Grenades by joaquimandrade
- Testers
- Translators
- Everyone who enjoys having fun with grenades.
*/

/* -------------------------------
[To do]
* Recheck cvar system reload
* Add is player statement
------------------------------- */

new const ACTIVATE[] = 	"weapons/mine_activate.wav"
new const DEPLOY[] =  	"weapons/mine_deploy.wav"
new const CHARGE[] =  	"weapons/mine_charge.wav"
new const GEIGER[] =  	"player/geiger1.wav"
new const PING[] = 		"turret/tu_ping.wav"
new const BUTTON[] = 	"buttons/button9.wav"

new const SOUND_HIT[5][] = { "debris/bustmetal1.wav", "debris/bustmetal2.wav", "debris/metal1.wav", "debris/metal2.wav", "debris/metal3.wav" }

// Defines that can be modified
#define MAX_PLAYERS								32

#define ADMIN_ACCESS							ADMIN_RCON

#define NOTEAM_RGB_R_COLOR 						0
#define NOTEAM_RGB_G_COLOR 						214
#define NOTEAM_RGB_B_COLOR 						198

#define TEAMCT_RGB_R_COLOR						0
#define TEAMCT_RGB_G_COLOR						0
#define TEAMCT_RGB_B_COLOR						255

#define TEAMTE_RGB_R_COLOR						255
#define TEAMTE_RGB_G_COLOR						0
#define TEAMTE_RGB_B_COLOR						0

#define DELAY_ADDED_TO_USE						0.2

// Some defines, I suggest not modifying these! Only if you understand the code completely!
#define RING_SIZE_CONSTANT_PROXIMITY 			2.1
#define RING_SIZE_CONSTANT_MOTION	 			9.27

#define SETTINGS_REFRESH_TIME					2.0

#define OFFSET_WEAPONID							43
#define EXTRAOFFSET_WEAPONS						4

#define SMART_DISTANCE_LINE_PVS					800.0
#define SMART_RADIUS_RING_SHOW					1500.0
#define CONE_DROP_ANGLE_COSINUS					-0.30
#define EXTRALENGTH_VECTOR						200.0

#define SHOT_PENETRATION_DISTANCE 				4.0
#define SHOT_PENETRATION_READD_TIMES			20
#define SHOT_SECOND_TEST_RADIUS					10.0
#define SHOT_KNIFE_REAL_RADIUS					6.0
#define SHOT_ENTITY_QUEUE_LENGTH				5

#define BOT_MIN_DISTANCE_ATTACH					400.0
#define BOT_WALL_MIN_COSINUS					0.866026
#define BOT_MIN_HEIGHT_ALLOW 					18.0
#define BOT_MIN_CROUCH_HEIGHT_ALLOW 			10.0
#define BOT_MAX_HEIGHT_ALLOW 					55.0
#define BOT_FORCE_CROUCH_HEIGHT_CONST			76.0

#define CVAR_STRING_ALLOC						100
#define CVAR_MAX_ASSIGNED_VALUES				30
#define CVAR_MAX_STRING_LENGTH					10

#define DMG_CS_KNIFE_BULLETS 					(1 << 12 | 1 << 0)

#define CONE_CALC_ANGLE_MAX						75.0
#define CONE_CALC_ANGLE_MIN						2.0
#define CONE_CALC_DISTANCE_MAX					400.0
#define CONE_CALC_DISTANCE_MIN					10000.0
#define CONE_BASE_RADIUS						200.0

// Macros, made specially to make the code easier to read
#define CONVERT_TO_METERS(%0)					(%0 * 0.0254)

#define get_option(%1) 							ccvars[%1]
#define toggle_option(%1)						set_pcvar_num(pcvars[%1], !get_pcvar_num(pcvars[%1]))
#define get_option_float(%1)					Float:ccvars[%1]
#define set_option_float(%1,%2)					set_pcvar_float(pcvars[%1], %2)

#define is_player_alive(%1)						((cl_is_alive & (1<<%1)) && (0 < %1 <= g_maxplayers))

#define is_grenade_c4(%1)						(get_pdata_int(%1, 96) & (1<<8))			// 96 is the C4 offset

#define make_explode(%1) 						entity_set_float(%1, EV_FL_dmgtime, 0.0)
#define grenade_can_be_used(%1)					(get_option(OPTION_NADES_IN_EFFECT) & NADE_BIT[%1]) ? 1 : 0
#define allow_grenade_explode(%1)				(get_gametime() < entity_get_float(%1, EV_FL_fuser2)) ? 0 : 1
#define get_grenade_type(%1)					NadeType:entity_get_int(%1, EV_INT_iuser1)
#define set_grenade_allow_explode(%1,%2)		entity_set_float(%1, EV_FL_fuser2, get_gametime() + %2)
#define delay_explosion(%1)						entity_set_float(%1, EV_FL_dmgtime, get_gametime() + get_option_float(OPTION_EXPLOSION_DELAY_TIME))
#define get_trip_grenade_end_origin(%1,%2)		entity_get_vector(%1, EV_VEC_vuser1, %2)
#define set_trip_grenade_end_origin(%1,%2)		entity_set_vector(%1, EV_VEC_vuser1, %2)
#define set_trip_grenade_fly_velocity(%1,%2)	entity_set_vector(%1, EV_VEC_vuser2, %2)
#define get_trip_grenade_fly_velocity(%1,%2)	entity_get_vector(%1, EV_VEC_vuser2, %2)
#define get_trip_grenade_middle_origin(%1,%2)	entity_get_vector(%1, EV_VEC_vuser3, %2)
#define set_trip_grenade_middle_origin(%1,%2)	entity_set_vector(%1, EV_VEC_vuser3, %2)
#define get_trip_grenade_arm_time(%1)			entity_get_float(%1, EV_FL_fuser1)
#define set_trip_grenade_arm_time(%1,%2)		entity_set_float(%1, EV_FL_fuser1, get_gametime() + %2)
#define set_trip_grenade_attached_to(%1,%2) 	entity_set_int(%1, EV_INT_iuser4, %2)
#define get_trip_grenade_attached_to(%1) 		entity_get_int(%1, EV_INT_iuser4)
#define get_trip_grenade_mode(%1) 				TripNadeMode:entity_get_int(%1, EV_INT_iuser3)
#define set_trip_grenade_mode(%1,%2) 			entity_set_int(%1, EV_INT_iuser3, _:%2)
#define play_sound(%1,%2) 						(get_option(OPTION_PLAY_SOUNDS)) ? emit_sound(%1, CHAN_WEAPON, %2, 1.0, ATTN_STATIC, 0, PITCH_NORM) : 0
#define play_sound2(%1,%2) 						(get_option(OPTION_PLAY_SOUNDS)) ? emit_sound(%1, CHAN_ITEM, %2, 1.0, ATTN_STATIC, 0, PITCH_NORM) : 0
#define refresh_can_use_nade(%1,%2)				get_enabled_modes(%1,%2) ? (cl_can_use_nade[%2] |= (1<<%1)) : (cl_can_use_nade[%2] &= ~(1<<%1))

// Enums! First time I've ever used them. These should make the code infinitely easier to read.
enum NadeRace
{
	GRENADE_EXPLOSIVE = 0,
	GRENADE_FLASHBANG,
	GRENADE_SMOKEGREN,
}

new const NADE_MODEL[][] = 
{
	"w_hegrenade.mdl", 
	"w_flashbang.mdl", 
	"w_smokegrenade.mdl"
}

new const NADE_WPID[NadeRace] = 
{
	CSW_HEGRENADE, 
	CSW_FLASHBANG, 
	CSW_SMOKEGRENADE
}

new const NADE_BIT[NadeRace] =
{
	(1<<0), 
	(1<<1), 
	(1<<2)
}

enum NadeType
{
	NADE_DUD = -1,  
	NADE_NORMAL, 
	NADE_PROXIMITY, 
	NADE_IMPACT, 
	NADE_TRIP, 
	NADE_MOTION, 
	NADE_SATCHEL, 
	NADE_HOMING
}

new UNCOUNTABLE_NADE_MODES 		=	((1 << (_:NADE_DUD + 1)) | (1 << (_:NADE_NORMAL + 1)) | (1 << (_:NADE_IMPACT + 1)) | (1 << (_:NADE_HOMING + 1)))
new const NADE_DONT_COUNT 		= (1<<31)

enum Fward
{
	FWD_NONE_ACTIVE 	= 0, 
	FWD_CMDSTART  		= (1<<0), 
	FWD_THINK   		= (1<<1), 
	FWD_SETMODEL  	 	= (1<<2), 
	FWD_TOUCH    		= (1<<3),
	FWD_SEC_EXPLODE 	= (1<<4), 
	FWD_TAKEDAMAGE		= (1<<5), 
	FWD_THINK_POST 		= (1<<6), 
	FWD_MESSAGE 		= (1<<7),
	FWD_HPSYSTEM 		= (1<<8)
}

enum ZmFunc
{
	ZM_NO_ZM_ACTIVE 	= 0, 
	ZM_ZM_ACTIVE  		= 1, 
	ZM_CAN_THINK	   	= 2,
	ZM_DO_ALL			= 3
}
 
enum TripNadeMode
{
	TRIP_NOT_ATTACHED = 0, 
	TRIP_ATTACHED, 
	TRIP_WAITING, 
	TRIP_SCANNING, 
	TRIP_SHOULD_DETONATE, 
	TRIP_DETONATED
}

enum Option
{
	// Primary Off/On cvar
	OPTION_ENABLE_NADE_MODES, 
	
	// General settings
	OPTION_FRIENDLY_FIRE,
	OPTION_BOT_ALLOW, 
	OPTION_NADES_IN_EFFECT, 
	OPTION_REMOVE_IF_DIES,
	OPTION_SUPPRESS_FITH, 
	OPTION_DISPLAY_MODE_ON_DRAW, 
	OPTION_PLAY_SOUNDS, 
	OPTION_RESET_MODE_ON_THROW, 
	OPTION_RESOURCE_USE, 
	OPTION_MSG_SVC_BAD,
	OPTION_TEAM_PLAY, 
	OPTION_AFFECT_OWNER,
	OPTION_UNITS_SYSTEM,
	OPTION_MONSTERMOD_SUPPORT,
	
	// Grenade modes control menu
	OPTION_NORMAL_ENABLED,
	OPTION_PROXIMITY_ENABLED, 
	OPTION_IMPACT_ENABLED, 
	OPTION_TRIP_ENABLED, 
	OPTION_MOTION_ENABLED, 
	OPTION_SATCHEL_ENABLED, 
	OPTION_HOMING_ENABLED, 
	
	OPTION_REACT_TRIP_G, 
	OPTION_REACT_TRIP_F, 
	OPTION_REACT_TRIP_S, 
	
	OPTION_PROXIMITY_LOS,
	OPTION_MOTION_LOS,
	OPTION_SATCHEL_DELAY,
	
	// Limit settings
	OPTION_LIMIT_SYSTEM,
	
	OPTION_LIMIT_PROXIMITY, 
	OPTION_LIMIT_TRIP, 
	OPTION_LIMIT_MOTION, 
	OPTION_LIMIT_SATCHEL, 
	
	OPTION_INFINITE_GRENADES, 
	OPTION_INFINITE_FLASHES, 
	OPTION_INFINITE_SMOKES, 
	
	// Hitpoints system settings
	OPTION_MATERIAL_SYSTEM,
	
	OPTION_SEC_EXPLO_AFFECT, 
	
	OPTION_HITPOINT_NORMAL,
	OPTION_HITPOINT_PROXIMITY, 
	OPTION_HITPOINT_IMPACT,
	OPTION_HITPOINT_TRIP, 
	OPTION_HITPOINT_MOTION, 
	OPTION_HITPOINT_SATCHEL, 
	OPTION_HITPOINT_HOMING,
	
	OPTION_HITPOINT_DEATH, 
	OPTION_HITPOINT_FF,
	OPTION_HITPOINT_INTER_DMG,
	
	// Damage settings
	OPTION_DAMAGE_SYSTEM,
	
	OPTION_DMG_THROUGH_WALL,
	OPTION_DMG_SELF,
	OPTION_DMG_TEAMMATES,
	
	OPTION_DMG_NORMAL,
	OPTION_DMG_PROXIMITY,
	OPTION_DMG_IMPACT, 
	OPTION_DMG_TRIP, 
	OPTION_DMG_MOTION, 
	OPTION_DMG_SATCHEL, 
	OPTION_DMG_HOMING, 
	
	// Internal functional settings
	OPTION_EXPLOSION_DELAY_TIME,
	OPTION_RADIUS_SEC_EXPLOSION,
	
	OPTION_ARM_TIME_TRIP, 
	OPTION_ARM_TIME_MOTION, 
	OPTION_ARM_TIME_SATCHEL, 
	OPTION_ARM_TIME_PROXIMITY, 
	
	OPTION_TRIP_DETECT_DISTANCE, 
	OPTION_TRIP_FLY_SPEED, 
	
	OPTION_RADIUS_PROXIMITY,
	OPTION_RADIUS_MOTION,
	
	OPTION_HOMING_SCAN_RANGE,
	OPTION_HOMING_SUPER_RANGE,
	OPTION_HOMING_EXTRATIME,
	OPTION_HOMING_SPEED_ADD
}

enum OptionType
{
	TOPTION_TOGGLE = 1, 
	TOPTION_CELL, 
	TOPTION_FLOAT,
}

enum TraceHandles
{
	TH_LOS,
	TH_DMG,
	TH_TRIP,
	TH_BOT
}

// Mod texts that appear when right clicking for mode change
new modetext[][] = { "Normal", "Proximity", "Impact", "Trip laser", "Motion sensor", "Satchel chage", "Homing" }

// CFG data [name and file path]
new const CFG_FILE_NAME[] = "nade_modes.cfg"
new CFG_FILE[200]

// Current nade mode
new NadeType:mode[MAX_PLAYERS + 1][NadeRace]

// Global server variables
new g_maxplayers

// Cached client data [bot,alive,weapon,team]
new cl_is_bot = 0
new cl_is_alive = 0
new cl_weapon[MAX_PLAYERS + 1]
new CsTeams:cl_team[MAX_PLAYERS + 1]

// Limit system counter/blocker
new cl_counter[MAX_PLAYERS + 1][NadeRace][NadeType]
new cl_can_use_nade[NadeRace]

// Next +use time, used in satchel charge nade types when the delay explosion is set
new Float:cl_nextusetime[MAX_PLAYERS + 1]

// Special queue used in penetration detection of grenades
new cl_entity_queue[MAX_PLAYERS + 1][SHOT_ENTITY_QUEUE_LENGTH]

// Trace handles used in different situations
new g_ptrace[TraceHandles]

// Hp system global variables [enable/disable, global trace attack class registration]
new g_check_hpsystem = -1
new Trie:trace_attack_reg_class

// First enabled modes, so that the plugin knows where to start
new NadeType:g_firstenabledmode[NadeRace]

// Plugin functionality enable/disable mechanism
new Fward:bs_forward_collection = FWD_NONE_ACTIVE

// Menu variables
new settingsmenu[MAX_PLAYERS + 1]   // Settings menu handler
new cvar_menu_pos[MAX_PLAYERS + 1]  // Cvar menu handler
new callbacks[2]					// Settings menu callbacks

// Cvars [Options]
new OptionType:option_type[Option]
new Array:option_value[Option]
new pcvars[Option] // Cvar pointers
new ccvars[Option] // Cached cvars

// Mod dependent variables [CZ/ZM]
new ZmFunc:g_zombie_mod
new g_botquota

// Forwards
new g_FW_property, g_PFW_property

// Messages
new beampoint
new shockwave
new nadebits



/* -------------------------------
[Plugin Start]
------------------------------- */
public plugin_precache()
{
	// Registered before all the nade plugins
	RegisterHam(Ham_Think, "grenade", "fw_think")
	RegisterHam(Ham_Think, "grenade", "fw_track_explosion")
	RegisterHam(Ham_Think, "grenade", "fw_think_post", 1)
	
	// Trace attack register trie
	trace_attack_reg_class = TrieCreate()
	
	// We register this here to track shots, it is also important
	register_forward(FM_Spawn, "fw_spawn", 1)
	
	beampoint = precache_model("sprites/laserbeam.spr")
	shockwave = precache_model("sprites/shockwave.spr")
	nadebits  = precache_model("models/chromegibs.mdl")
	
	precache_sound(ACTIVATE)
	precache_sound(CHARGE)
	precache_sound(DEPLOY)
	precache_sound(GEIGER)
	precache_sound(PING)
	precache_sound(BUTTON)
	
	for (new i=0;i<5;i++)
	{
		precache_sound(SOUND_HIT[i])
	}
}

public plugin_init()
{
	// Plugin registration (normal and net)
	register_plugin("NadeModes", VERSION, "Nomexous & OT")
	register_cvar("nademodes_version", VERSION, FCVAR_SERVER|FCVAR_SPONLY)
	
	// Commands
	register_clcmd("amx_nade_mode_menu", "conjure_menu", ADMIN_ACCESS, "Shows settings menu for grenade modes.")
	register_clcmd("amx_nmm", "conjure_menu", ADMIN_ACCESS, "Shows settings menu for grenade modes.")
	
	register_clcmd("say /nadehelp", "conjure_help", -1, "Shows help for grenade modes.")
	register_clcmd("say_team /nadehelp", "conjure_help", -1, "Shows help for grenade modes.")
	
	// General Settings Options
	pcvars[OPTION_FRIENDLY_FIRE] = get_cvar_pointer("mp_friendlyfire")
	
	register_option(OPTION_ENABLE_NADE_MODES, "nademodes_enable", "1")
	register_option(OPTION_NADES_IN_EFFECT, "nademodes_nades_in_effect", "7", TOPTION_CELL)
	register_option(OPTION_MSG_SVC_BAD, "nademodes_svc_bad_error_fix", "0")
	
	register_option(OPTION_PLAY_SOUNDS, "nademodes_play_grenade_sounds", "1")
	register_option(OPTION_RESOURCE_USE, "nademodes_effects", "2", TOPTION_CELL)
	
	register_option(OPTION_DISPLAY_MODE_ON_DRAW, "nademodes_display_mode_on_draw", "1")
	register_option(OPTION_RESET_MODE_ON_THROW, "nademodes_reset_mode_on_throw", "0")
	register_option(OPTION_SUPPRESS_FITH, "nademodes_suppress_fire_in_the_hole", "0")
	
	register_option(OPTION_BOT_ALLOW, "nademodes_bot_support", "1")
	
	register_option(OPTION_REMOVE_IF_DIES, "nademodes_remove_if_player_dies", "0")
	register_option(OPTION_AFFECT_OWNER, "nademodes_affect_owner", "1")
	register_option(OPTION_TEAM_PLAY, "nademodes_team_play", "1")
	register_option(OPTION_UNITS_SYSTEM, "nademodes_unit_system", "1")
	
	register_option(OPTION_MONSTERMOD_SUPPORT, "nademodes_monstermod_support", "0")
	
	// General Settings Option Values
	register_option_value(OPTION_RESOURCE_USE, "0;1;2;3")
	register_option_value(OPTION_NADES_IN_EFFECT, "0;1;2;3;4;5;6;7")
	
	// Mode Settings Options
	register_option(OPTION_NORMAL_ENABLED, "nademodes_normal_enabled", "1")
	register_option(OPTION_PROXIMITY_ENABLED, "nademodes_proximity_enabled", "1")
	register_option(OPTION_IMPACT_ENABLED, "nademodes_impact_enabled", "1")
	register_option(OPTION_TRIP_ENABLED, "nademodes_trip_enabled", "1")
	register_option(OPTION_MOTION_ENABLED, "nademodes_motion_enabled", "1")
	register_option(OPTION_SATCHEL_ENABLED, "nademodes_satchel_enabled", "1")
	register_option(OPTION_HOMING_ENABLED, "nademodes_homing_enabled", "1")
	
	register_option(OPTION_REACT_TRIP_G, "nademodes_grenade_react", "1")
	register_option(OPTION_REACT_TRIP_F, "nademodes_flash_react", "1")
	register_option(OPTION_REACT_TRIP_S, "nademodes_smoke_react", "1")
	
	register_option(OPTION_PROXIMITY_LOS, "nademodes_proximity_fov", "0")
	register_option(OPTION_MOTION_LOS, "nademodes_motion_fov", "1")
	register_option(OPTION_SATCHEL_DELAY, "nademodes_satchel_delay", "0")
	
	// Limit Settings Options
	register_option(OPTION_LIMIT_SYSTEM, "nademodes_limit_system", "2", TOPTION_CELL)
	register_option(OPTION_LIMIT_PROXIMITY, "nademodes_proximity_limit", "5", TOPTION_CELL)
	register_option(OPTION_LIMIT_TRIP, "nademodes_trip_limit", "5", TOPTION_CELL)
	register_option(OPTION_LIMIT_MOTION, "nademodes_motion_limit", "5", TOPTION_CELL)
	register_option(OPTION_LIMIT_SATCHEL, "nademodes_satchel_limit", "5", TOPTION_CELL)
	
	register_option(OPTION_INFINITE_GRENADES, "nademodes_infinite_grenades", "0")
	register_option(OPTION_INFINITE_FLASHES, "nademodes_infinite_flashes", "0")
	register_option(OPTION_INFINITE_SMOKES, "nademodes_infinite_smokes", "0")
	
	// Limit Settings Option Values
	register_option_value(OPTION_LIMIT_SYSTEM, "0;1;2")
	
	register_option_value(OPTION_LIMIT_PROXIMITY, "0;1;2;3;4;5;6;7;8;9;10;11;12;13;14;15")
	register_option_value(OPTION_LIMIT_TRIP, "0;1;2;3;4;5;6;7;8;9;10;11;12;13;14;15")
	register_option_value(OPTION_LIMIT_MOTION, "0;1;2;3;4;5;6;7;8;9;10;11;12;13;14;15")
	register_option_value(OPTION_LIMIT_SATCHEL, "0;1;2;3;4;5;6;7;8;9;10;11;12;13;14;15")
	
	// Hitpoint Options
	register_option(OPTION_MATERIAL_SYSTEM, "nademodes_material_system", "0", TOPTION_CELL)
	register_option(OPTION_HITPOINT_DEATH, "nademodes_grenade_death","1")
	
	register_option(OPTION_SEC_EXPLO_AFFECT, "nademodes_secondary_explosions_mode", "0")
	
	register_option(OPTION_HITPOINT_NORMAL, "nademodes_hitpoints_normal", "10", TOPTION_CELL)
	register_option(OPTION_HITPOINT_PROXIMITY, "nademodes_hitpoints_proximity", "100", TOPTION_CELL)
	register_option(OPTION_HITPOINT_IMPACT, "nademodes_hitpoints_impact", "10", TOPTION_CELL)
	register_option(OPTION_HITPOINT_TRIP, "nademodes_hitpoints_trip", "100", TOPTION_CELL)
	register_option(OPTION_HITPOINT_MOTION, "nademodes_hitpoints_motion", "100", TOPTION_CELL)
	register_option(OPTION_HITPOINT_SATCHEL, "nademodes_hitpoints_satchel", "100", TOPTION_CELL)
	register_option(OPTION_HITPOINT_HOMING, "nademodes_hitpoints_homing", "10", TOPTION_CELL)
	
	register_option(OPTION_HITPOINT_INTER_DMG, "nademodes_hitpoints_intergrenade_damage", "100", TOPTION_FLOAT)
	register_option(OPTION_HITPOINT_FF, "nademodes_hitpoints_friendlyfire_ammount", "50", TOPTION_FLOAT)
	
	// Hitpoint Options Values
	register_option_value(OPTION_MATERIAL_SYSTEM, "0;1;2")
	
	register_option_value(OPTION_HITPOINT_NORMAL, "0;1;10;20;30;40;50;60;70;80;90;100;110;120;130;140;150;175;200;250;300;400;500;750;1000")
	register_option_value(OPTION_HITPOINT_PROXIMITY, "0;1;10;20;30;40;50;60;70;80;90;100;110;120;130;140;150;175;200;250;300;400;500;750;1000")
	register_option_value(OPTION_HITPOINT_IMPACT, "0;1;10;20;30;40;50;60;70;80;90;100;110;120;130;140;150;175;200;250;300;400;500;750;1000")
	register_option_value(OPTION_HITPOINT_TRIP, "0;1;10;20;30;40;50;60;70;80;90;100;110;120;130;140;150;175;200;250;300;400;500;750;1000")
	register_option_value(OPTION_HITPOINT_MOTION, "0;1;10;20;30;40;50;60;70;80;90;100;110;120;130;140;150;175;200;250;300;400;500;750;1000")
	register_option_value(OPTION_HITPOINT_SATCHEL, "0;1;10;20;30;40;50;60;70;80;90;100;110;120;130;140;150;175;200;250;300;400;500;750;1000")
	register_option_value(OPTION_HITPOINT_HOMING, "0;1;10;20;30;40;50;60;70;80;90;100;110;120;130;140;150;175;200;250;300;400;500;750;1000")
	
	register_option_value(OPTION_HITPOINT_INTER_DMG, "0;5;10;15;20;25;30;35;45;50;55;60;65;70;75;80;85;90;95;100")
	register_option_value(OPTION_HITPOINT_FF, "0;5;10;15;20;25;30;35;45;50;55;60;65;70;75;80;85;90;95;100")
	
	// Damage System Option Registration
	register_option(OPTION_DAMAGE_SYSTEM, "nademodes_damage_system", "2", TOPTION_CELL)
	
	register_option(OPTION_DMG_THROUGH_WALL, "nademodes_damage_through_wall", "50", TOPTION_CELL)
	register_option(OPTION_DMG_SELF, "nademodes_damage_self", "50", TOPTION_CELL)
	register_option(OPTION_DMG_TEAMMATES, "nademodes_damage_teammate", "50", TOPTION_CELL)
	
	register_option(OPTION_DMG_NORMAL, "nademodes_damage_normal", "1.0", TOPTION_FLOAT)
	register_option(OPTION_DMG_IMPACT, "nademodes_damage_impact", "1.0", TOPTION_FLOAT)
	register_option(OPTION_DMG_PROXIMITY, "nademodes_damage_proximity", "1.0", TOPTION_FLOAT)
	register_option(OPTION_DMG_MOTION, "nademodes_damage_motion", "1.0", TOPTION_FLOAT)
	register_option(OPTION_DMG_SATCHEL, "nademodes_damage_satchel", "1.0", TOPTION_FLOAT)
	register_option(OPTION_DMG_TRIP, "nademodes_damage_trip", "1.0", TOPTION_FLOAT)
	register_option(OPTION_DMG_HOMING, "nademodes_damage_homing", "1.0", TOPTION_FLOAT)
	
	// Damage System Option Values
	register_option_value(OPTION_DAMAGE_SYSTEM, "0;1;2")
	
	register_option_value(OPTION_DMG_THROUGH_WALL, "0;5;10;15;20;25;30;35;45;50;55;60;65;70;75;80;85;90;95;100")
	register_option_value(OPTION_DMG_SELF, "0;5;10;15;20;25;30;35;45;50;55;60;65;70;75;80;85;90;95;100")
	register_option_value(OPTION_DMG_TEAMMATES, "0;5;10;15;20;25;30;35;45;50;55;60;65;70;75;80;85;90;95;100")
	
	register_option_value(OPTION_DMG_NORMAL, "0.2;0.4;0.6;0.8;1;1.2;1.4;1.6;1.8;2;2.2;2.4;2.6;2.8;3;3.2;3.4;3.6;3.8;4;5;6;7")
	register_option_value(OPTION_DMG_IMPACT, "0.2;0.4;0.6;0.8;1;1.2;1.4;1.6;1.8;2;2.2;2.4;2.6;2.8;3;3.2;3.4;3.6;3.8;4;5;6;7")
	register_option_value(OPTION_DMG_MOTION, "0.2;0.4;0.6;0.8;1;1.2;1.4;1.6;1.8;2;2.2;2.4;2.6;2.8;3;3.2;3.4;3.6;3.8;4;5;6;7")
	register_option_value(OPTION_DMG_PROXIMITY, "0.2;0.4;0.6;0.8;1;1.2;1.4;1.6;1.8;2;2.2;2.4;2.6;2.8;3;3.2;3.4;3.6;3.8;4;5;6;7")
	register_option_value(OPTION_DMG_SATCHEL, "0.2;0.4;0.6;0.8;1;1.2;1.4;1.6;1.8;2;2.2;2.4;2.6;2.8;3;3.2;3.4;3.6;3.8;4;5;6;7")
	register_option_value(OPTION_DMG_TRIP, "0.2;0.4;0.6;0.8;1;1.2;1.4;1.6;1.8;2;2.2;2.4;2.6;2.8;3;3.2;3.4;3.6;3.8;4;5;6;7")
	register_option_value(OPTION_DMG_HOMING, "0.2;0.4;0.6;0.8;1;1.2;1.4;1.6;1.8;2;2.2;2.4;2.6;2.8;3;3.2;3.4;3.6;3.8;4;5;6;7")
	
	// Internal Settings Float Options
	register_option(OPTION_EXPLOSION_DELAY_TIME, "nademodes_explosion_delay_time", "60000.0", TOPTION_FLOAT)
	
	register_option(OPTION_RADIUS_SEC_EXPLOSION, "nademodes_secondary_explosion_radius", "275.0", TOPTION_FLOAT)
	
	register_option(OPTION_ARM_TIME_TRIP, "nademodes_trip_grenade_arm_time", "3.0", TOPTION_FLOAT)
	register_option(OPTION_ARM_TIME_PROXIMITY, "nademodes_proximity_arm_time", "2.0", TOPTION_FLOAT)
	register_option(OPTION_ARM_TIME_MOTION, "nademodes_motion_arm_time", "2.0",  TOPTION_FLOAT)
	register_option(OPTION_ARM_TIME_SATCHEL, "nademodes_satchel_arm_time", "2.0", TOPTION_FLOAT)
	
	register_option(OPTION_TRIP_FLY_SPEED, "nademodes_trip_grenade_fly_speed", "400.0", TOPTION_FLOAT)
	register_option(OPTION_TRIP_DETECT_DISTANCE, "nademodes_trip_grenade_detection_limit", "16000.0", TOPTION_FLOAT)
	
	register_option(OPTION_RADIUS_PROXIMITY, "nademodes_proximity_radius", "150.0", TOPTION_FLOAT)
	register_option(OPTION_RADIUS_MOTION, "nademodes_motion_radius", "200.0", TOPTION_FLOAT)
	
	register_option(OPTION_HOMING_SCAN_RANGE, "nademodes_homing_detection_range", "500.0", TOPTION_FLOAT)
	register_option(OPTION_HOMING_SUPER_RANGE, "nademodes_homing_superhoming_range", "100.0", TOPTION_FLOAT)
	register_option(OPTION_HOMING_EXTRATIME, "nademodes_homing_extratime", "0.5", TOPTION_FLOAT)
	register_option(OPTION_HOMING_SPEED_ADD, "nademodes_homing_velocity_deviation", "60.0", TOPTION_FLOAT)
	
	// Internal Settings Option Values
	register_option_value(OPTION_EXPLOSION_DELAY_TIME, "600;700;800;900;1000;1400;1800;2200;2600;3000;4000;5000;6000;10000;60000")
	
	register_option_value(OPTION_RADIUS_SEC_EXPLOSION, "25;50;75;100;125;150;175;200;225;250;275;300;325;350")
	
	register_option_value(OPTION_ARM_TIME_TRIP, "1;1.5;2;2.5;3;3.5;4;4.5;5")
	register_option_value(OPTION_ARM_TIME_PROXIMITY, "1;1.5;2;2.5;3;3.5;4;4.5;5")
	register_option_value(OPTION_ARM_TIME_MOTION, "1;1.5;2;2.5;3;3.5;4;4.5;5")
	register_option_value(OPTION_ARM_TIME_SATCHEL, "1;1.5;2;2.5;3;3.5;4;4.5;5")
	
	register_option_value(OPTION_TRIP_FLY_SPEED, "200;250;300;350;400;450;500;550;600;650;700;750;800;850;900;1000")
	register_option_value(OPTION_TRIP_DETECT_DISTANCE, "400;800;1000;2000;4000;8000;16000")
	
	register_option_value(OPTION_RADIUS_PROXIMITY, "100;110;120;130;140;150;160;170;180;190;200")
	register_option_value(OPTION_RADIUS_MOTION, "150;160;170;180;190;200;210;220;230;240;250")
	
	register_option_value(OPTION_HOMING_SCAN_RANGE,"200;250;300;350;400;450;500;550;600;650;700;750;800;850;900;950;1000")
	register_option_value(OPTION_HOMING_SUPER_RANGE, "40;60;80;100;120;140;160;180;200;220;240;260;280;300")
	register_option_value(OPTION_HOMING_EXTRATIME, "0;0.1;0.2;0.3;0.4;0.5;0.6;0.7;0.8;0.9;1")
	register_option_value(OPTION_HOMING_SPEED_ADD, "10;15;20;25;30;35;40;45;50;55;60;65;70;75;80;85;90;95;100;125;150")
	
	cacheCvars()
	
	register_event("CurWeapon", "event_armnade", "b", "1=1", "2=4", "2=9", "2=25")
	register_event("CurWeapon", "event_curweapon", "b", "1=1")
	register_event("HLTV", "event_new_round", "a", "1=0", "2=0") 
	
	register_dictionary("nademodes.txt")
	
	g_firstenabledmode[GRENADE_EXPLOSIVE] = NADE_NORMAL
	g_firstenabledmode[GRENADE_FLASHBANG] = NADE_NORMAL
	g_firstenabledmode[GRENADE_SMOKEGREN] = NADE_NORMAL
	
	g_ptrace[TH_LOS] = create_tr2()
	g_ptrace[TH_DMG] = create_tr2()
	g_ptrace[TH_TRIP] = create_tr2()
	g_ptrace[TH_BOT] = create_tr2()
	
	callbacks[0] = menu_makecallback("callback_disabled")
	callbacks[1] = menu_makecallback("callback_enabled")
	
	// Register all the forwards
	RegisterHam(Ham_TakeDamage, 	 "player", "fw_takedamage")
	RegisterHam(Ham_Killed, 		 "player", "fw_killed_post", 1)
	RegisterHam(Ham_Spawn,			 "player", "fw_spawn_post", 1)
	RegisterHam(Ham_TakeDamage, 	 "func_wall", "fw_monster_takedamage")
	RegisterHam(Ham_Player_PreThink, "player", "fw_playerprethink")
	
	RegisterHam(Ham_Touch, 		"grenade", "fw_touch")
	RegisterHam(Ham_TakeDamage, "grenade", "fw_grenade_takedamage")
	
	RegisterHam(Ham_TraceAttack, "worldspawn", "fw_global_traceattack", 1)
	RegisterHam(Ham_TraceAttack, "player", "fw_global_traceattack", 1)
	
	g_FW_property = CreateMultiForward("fw_NM_nade_property_set", ET_STOP, FP_CELL, FP_CELL)
	g_PFW_property = CreateMultiForward("fw_NM_nade_property_set_post", ET_IGNORE, FP_CELL, FP_CELL, FP_CELL)
	
	register_forward(FM_CmdStart, 	"fw_cmdstart")
	register_forward(FM_SetModel, 	"fw_setmodel", 1)
	register_forward(FM_TraceLine, 	"fw_traceline")
	
	register_message(get_user_msgid("SendAudio"), "fith_audio")
	register_message(get_user_msgid("TextMsg"),  "fith_text")
	
	set_task(SETTINGS_REFRESH_TIME, "update_forward_registration", 0, "", 0, "b", 0)
	
	g_botquota = cvar_exists("bot_quota") ? get_cvar_pointer("bot_quota") : 0;
	g_zombie_mod = ZM_NO_ZM_ACTIVE  // Initially we are not sure if a zombie mod is on or not
}

public plugin_cfg()
{
	// Get the config dir
	new config[sizeof(CFG_FILE)]
	get_configsdir(config, charsmax(CFG_FILE))
	format(CFG_FILE, charsmax(CFG_FILE), "%s/%s", config, CFG_FILE_NAME)
	
	// Execute the CFG file
	if(file_exists(CFG_FILE))
	{
		server_cmd("exec %s", CFG_FILE)
		cacheCvars()
	}
	
	AddMenuItem("Nade Mode Menu", "amx_nmm", ADMIN_ACCESS, "NadeModes")
}

public plugin_end()
{
	TrieDestroy(trace_attack_reg_class)
	DestroyForward(g_FW_property)
	DestroyForward(g_PFW_property)
	
	free_tr2(g_ptrace[TH_LOS])
	free_tr2(g_ptrace[TH_DMG])
	free_tr2(g_ptrace[TH_TRIP])
	free_tr2(g_ptrace[TH_BOT])
	
	save_cfg()
}

register_option(Option:option, const name[300], const string[], OptionType:type = TOPTION_TOGGLE, flags = 0, Float:value = 0.0)
{
	pcvars[option] = register_cvar(name, string, flags, value)
	option_type[option] = type
	return
}

register_option_value(Option:option, values[CVAR_STRING_ALLOC])
{
	if (option_type[option] == TOPTION_TOGGLE)
		return
	
	option_value[option] = ArrayCreate(CVAR_STRING_ALLOC + 1)
	ArrayPushString(option_value[option], values)
}

stock unregister_all_option_value()
{
	for (new Option:option=OPTION_ENABLE_NADE_MODES; option <= OPTION_HOMING_SPEED_ADD; option += OPTION_FRIENDLY_FIRE)
	{
		if (option_type[option] == TOPTION_TOGGLE)
			return
		
		ArrayDestroy(option_value[option])
	}
}

cacheCvars()
{
	for (new Option:option=OPTION_ENABLE_NADE_MODES; option <= OPTION_HOMING_SPEED_ADD; option += OPTION_FRIENDLY_FIRE)
	{
		if (option_type[option] == TOPTION_FLOAT)
		{
			ccvars[option] = _:get_pcvar_float(pcvars[option])
		}
		else
		{
			ccvars[option] = get_pcvar_num(pcvars[option])
		}
	}
}

public save_cfg()
{
	static file[3000]
	format(file, charsmax(file), "echo [NadeModes] Executing config file ...^n")
	
	format(file, charsmax(file), "%s^n// General CVARS^n^n", file)
	
	format(file, charsmax(file), "%snademodes_enable %d^n", file, get_option(OPTION_ENABLE_NADE_MODES))
	format(file, charsmax(file), "%snademodes_nades_in_effect %d^n", file, get_option(OPTION_NADES_IN_EFFECT))
	
	format(file, charsmax(file), "%snademodes_effects %d^n", file, get_option(OPTION_RESOURCE_USE))
	format(file, charsmax(file), "%snademodes_play_grenade_sounds %d^n", file, get_option(OPTION_PLAY_SOUNDS))
	format(file, charsmax(file), "%snademodes_svc_bad_error_fix %d^n", file, get_option(OPTION_MSG_SVC_BAD))
	
	format(file, charsmax(file), "%snademodes_display_mode_on_draw %d^n", file, get_option(OPTION_DISPLAY_MODE_ON_DRAW))
	format(file, charsmax(file), "%snademodes_reset_mode_on_throw %d^n", file, get_option(OPTION_RESET_MODE_ON_THROW))
	format(file, charsmax(file), "%snademodes_suppress_fire_in_the_hole %d^n", file, get_option(OPTION_SUPPRESS_FITH))
	
	format(file, charsmax(file), "%snademodes_bot_support %d^n", file, get_option(OPTION_BOT_ALLOW))
	
	format(file, charsmax(file), "%snademodes_remove_if_player_dies %d^n", file, get_option(OPTION_REMOVE_IF_DIES))
	format(file, charsmax(file), "%snademodes_affect_owner %d^n", file, get_option(OPTION_AFFECT_OWNER))
	format(file, charsmax(file), "%snademodes_team_play %d^n", file, get_option(OPTION_TEAM_PLAY))
	format(file, charsmax(file), "%snademodes_unit_system %d^n", file, get_option(OPTION_UNITS_SYSTEM))
	
	format(file, charsmax(file), "%snademodes_monstermod_support %d^n", file, get_option(OPTION_MONSTERMOD_SUPPORT))
	
	format(file, charsmax(file), "%s^n// Mode CVARS^n^n", file)
	
	format(file, charsmax(file), "%snademodes_normal_enabled %d^n", file, get_option(OPTION_NORMAL_ENABLED))
	format(file, charsmax(file), "%snademodes_proximity_enabled %d^n", file, get_option(OPTION_PROXIMITY_ENABLED))
	format(file, charsmax(file), "%snademodes_impact_enabled %d^n", file, get_option(OPTION_IMPACT_ENABLED))
	format(file, charsmax(file), "%snademodes_trip_enabled %d^n", file, get_option(OPTION_TRIP_ENABLED))
	format(file, charsmax(file), "%snademodes_motion_enabled %d^n", file, get_option(OPTION_MOTION_ENABLED))
	format(file, charsmax(file), "%snademodes_satchel_enabled %d^n", file, get_option(OPTION_SATCHEL_ENABLED))
	format(file, charsmax(file), "%snademodes_homing_enabled %d^n", file, get_option(OPTION_HOMING_ENABLED))
	
	format(file, charsmax(file), "%snademodes_grenade_react %d^n", file, get_option(OPTION_REACT_TRIP_G))
	format(file, charsmax(file), "%snademodes_flash_react %d^n", file, get_option(OPTION_REACT_TRIP_F))
	format(file, charsmax(file), "%snademodes_smoke_react %d^n", file, get_option(OPTION_REACT_TRIP_S))
	
	format(file, charsmax(file), "%snademodes_proximity_fov %d^n", file, get_option(OPTION_PROXIMITY_LOS))
	format(file, charsmax(file), "%snademodes_motion_fov %d^n", file, get_option(OPTION_MOTION_LOS))
	format(file, charsmax(file), "%snademodes_satchel_delay %d^n", file, get_option(OPTION_SATCHEL_DELAY))
	
	format(file, charsmax(file), "%s^n// Limit & Test CVARS^n^n", file)
	
	format(file, charsmax(file), "%snademodes_limit_system %d^n", file, get_option(OPTION_LIMIT_SYSTEM))
	
	format(file, charsmax(file), "%snademodes_proximity_limit %d^n", file, get_option(OPTION_LIMIT_PROXIMITY))
	format(file, charsmax(file), "%snademodes_trip_limit %d^n", file, get_option(OPTION_LIMIT_TRIP))
	format(file, charsmax(file), "%snademodes_motion_limit %d^n", file, get_option(OPTION_LIMIT_MOTION))
	format(file, charsmax(file), "%snademodes_satchel_limit %d^n", file, get_option(OPTION_LIMIT_SATCHEL))
	
	format(file, charsmax(file), "%snademodes_infinite_grenades %d^n", file, get_option(OPTION_INFINITE_GRENADES))
	format(file, charsmax(file), "%snademodes_infinite_flashes %d^n", file, get_option(OPTION_INFINITE_FLASHES))
	format(file, charsmax(file), "%snademodes_infinite_smokes %d^n", file, get_option(OPTION_INFINITE_SMOKES))
	
	format(file, charsmax(file), "%s^n// Intergrenade CVARS CVARS^n^n", file)
	
	
	format(file, charsmax(file), "%snademodes_material_system %d^n", file, get_option(OPTION_MATERIAL_SYSTEM))
	format(file, charsmax(file), "%snademodes_grenade_death %d^n", file, get_option(OPTION_HITPOINT_DEATH))
	
	format(file, charsmax(file), "%snademodes_secondary_explosions_mode %d^n", file, get_option(OPTION_SEC_EXPLO_AFFECT))
	format(file, charsmax(file), "%snademodes_secondary_explosion_radius %f^n", file, get_option_float(OPTION_RADIUS_SEC_EXPLOSION))
	
	format(file, charsmax(file), "%snademodes_hitpoints_normal %d^n", file, get_option(OPTION_HITPOINT_NORMAL))
	format(file, charsmax(file), "%snademodes_hitpoints_proximity %d^n", file, get_option(OPTION_HITPOINT_PROXIMITY))
	format(file, charsmax(file), "%snademodes_hitpoints_impact %d^n", file, get_option(OPTION_HITPOINT_IMPACT))
	format(file, charsmax(file), "%snademodes_hitpoints_trip %d^n", file, get_option(OPTION_HITPOINT_TRIP))
	format(file, charsmax(file), "%snademodes_hitpoints_motion %d^n", file, get_option(OPTION_HITPOINT_MOTION))
	format(file, charsmax(file), "%snademodes_hitpoints_satchel %d^n", file, get_option(OPTION_HITPOINT_SATCHEL))
	format(file, charsmax(file), "%snademodes_hitpoints_homing %d^n", file, get_option(OPTION_HITPOINT_HOMING))
	
	format(file, charsmax(file), "%snademodes_hitpoints_intergrenade_damage %f^n", file, get_option_float(OPTION_HITPOINT_INTER_DMG))
	format(file, charsmax(file), "%snademodes_hitpoints_friendlyfire_ammount %f^n", file, get_option_float(OPTION_HITPOINT_FF))
	
	format(file, charsmax(file), "%s^n// Damage CVARS^n^n", file)
	
	format(file, charsmax(file), "%snademodes_damage_system %d^n", file, get_option(OPTION_DAMAGE_SYSTEM))
	
	format(file, charsmax(file), "%snademodes_damage_self %d^n", file, get_option(OPTION_DMG_SELF))
	format(file, charsmax(file), "%snademodes_damage_through_wall %d^n", file, get_option(OPTION_DMG_THROUGH_WALL))
	format(file, charsmax(file), "%snademodes_damage_teammate %d^n", file, get_option(OPTION_DMG_TEAMMATES))
	
	format(file, charsmax(file), "%snademodes_damage_normal %f^n", file, get_option_float(OPTION_DMG_NORMAL))
	format(file, charsmax(file), "%snademodes_damage_proximity %f^n", file, get_option_float(OPTION_DMG_PROXIMITY))
	format(file, charsmax(file), "%snademodes_damage_impact %f^n", file, get_option_float(OPTION_DMG_IMPACT))
	format(file, charsmax(file), "%snademodes_damage_trip %f^n", file, get_option_float(OPTION_DMG_TRIP))
	format(file, charsmax(file), "%snademodes_damage_motion %f^n", file, get_option_float(OPTION_DMG_MOTION))
	format(file, charsmax(file), "%snademodes_damage_satchel %f^n", file, get_option_float(OPTION_DMG_SATCHEL))
	format(file, charsmax(file), "%snademodes_damage_homing %f^n", file, get_option_float(OPTION_DMG_HOMING))
	
	format(file, charsmax(file), "%s^n// Internal Funcitonal CVARS^n^n", file)
	
	format(file, charsmax(file), "%snademodes_explosion_delay_time %f^n", file, get_option_float(OPTION_EXPLOSION_DELAY_TIME))
	
	format(file, charsmax(file), "%snademodes_proximity_arm_time %f^n", file, get_option_float(OPTION_ARM_TIME_PROXIMITY))
	format(file, charsmax(file), "%snademodes_proximity_radius %f^n", file, get_option_float(OPTION_RADIUS_PROXIMITY))
	
	format(file, charsmax(file), "%snademodes_trip_grenade_arm_time %f^n", file, get_option_float(OPTION_ARM_TIME_TRIP))
	format(file, charsmax(file), "%snademodes_trip_grenade_fly_speed %f^n", file, get_option_float(OPTION_TRIP_FLY_SPEED))
	format(file, charsmax(file), "%snademodes_trip_grenade_detection_limit %f^n", file, get_option_float(OPTION_TRIP_DETECT_DISTANCE))
	
	format(file, charsmax(file), "%snademodes_motion_arm_time %f^n", file, get_option_float(OPTION_ARM_TIME_MOTION))
	format(file, charsmax(file), "%snademodes_motion_radius %f^n", file, get_option_float(OPTION_RADIUS_MOTION))
	
	format(file, charsmax(file), "%snademodes_satchel_arm_time %f^n", file, get_option_float(OPTION_ARM_TIME_SATCHEL))
	
	format(file, charsmax(file), "%snademodes_homing_detection_range %f^n", file, get_option_float(OPTION_HOMING_SCAN_RANGE))
	format(file, charsmax(file), "%snademodes_homing_superhoming_range %f^n", file, get_option_float(OPTION_HOMING_SUPER_RANGE))
	format(file, charsmax(file), "%snademodes_homing_extratime %f^n", file, get_option_float(OPTION_HOMING_EXTRATIME))
	format(file, charsmax(file), "%snademodes_homing_velocity_deviation %f^n", file, get_option_float(OPTION_HOMING_SPEED_ADD))
	
	format(file, charsmax(file), "%s^necho [NadeModes] Settings loaded from config file", file)
	
	delete_file(CFG_FILE)
	write_file(CFG_FILE, file)
}

/* -------------------------------
[Plugin Commands & Menus]
------------------------------- */
public conjure_help(id)
{
	static help_file[3000]
	
	format(help_file, charsmax(help_file), "%L", id, "NADE_HTML")
	
	delete_file("nmm.htm")
	write_file("nmm.htm", help_file)
	show_motd(id, "nmm.htm", "Mega-Nade Mod")
	
	return PLUGIN_CONTINUE
}

public conjure_menu(id, level, cid)
{
	if (cmd_access(id, level, cid, 1))
	{
		main_menu(id)
	}
	
	return PLUGIN_HANDLED
}

stock main_menu(id)
{
	static menu
	settingsmenu[id] = menu_create("NadeModes - Main Menu", "menu_handler")
	menu = settingsmenu[id]
	
	add_option_toggle(menu, OPTION_ENABLE_NADE_MODES, "Enable nade modes", "Yes", "No")
	
	menu_additem(menu, "Execute config file")
	menu_additem(menu, "General settings", _, _, get_option(OPTION_ENABLE_NADE_MODES) ? callbacks[1] : callbacks[0])
	menu_additem(menu, "Mode control menu", _, _, get_option(OPTION_ENABLE_NADE_MODES) ? callbacks[1] : callbacks[0])
	menu_additem(menu, "Mode limit & test menu", _, _, is_nademodes_enabled() ? callbacks[1] : callbacks[0])
	menu_additem(menu, "Hitpoints menu", _, _, is_nademodes_enabled() ? callbacks[1] : callbacks[0])
	menu_additem(menu, "Mode damage settings", _, _, is_nademodes_enabled() ? callbacks[1] : callbacks[0])
	menu_additem(menu, "Internal functional settings", _, _, is_nademodes_enabled() ? callbacks[1] : callbacks[0])
	
	menu_display(id, settingsmenu[id])
	return PLUGIN_CONTINUE
}

public menu_handler(id, menu, item)
{
	if (item < 0)
	{
		return PLUGIN_HANDLED
	}
	
	switch (item)
	{
		case 0:
		{
			toggle_option(OPTION_ENABLE_NADE_MODES)
			update_forward_registration()
		}
		case 1:
		{
			if(file_exists(CFG_FILE))
			{
				server_cmd("exec %s", CFG_FILE)
				update_forward_registration()
			}
			else
			{
				client_print(id, print_chat, "[NDM] Config file not found!")
			}
		}
		
		default:
		{
			menu_destroy(menu)
			cvar_menu(id, 0, item - 1)
			return PLUGIN_HANDLED
		}
	}
	
	
	menu_destroy(menu)
	main_menu(id)
	return PLUGIN_HANDLED
}

stock cvar_menu(id, page = 0, menu_set = 0)
{
	if (menu_set <= 0)
		return PLUGIN_CONTINUE
	
	static menu
	
	switch (menu_set)
	{
		case 1:
		{
			settingsmenu[id] = menu_create("NadeModes - General Settings", "cvar_menu_handler")
			menu = settingsmenu[id]
			
			add_nade_option(menu, OPTION_NADES_IN_EFFECT, "Grenades that can use the nademodes")
			
			add_option_quatrotoggle(menu, OPTION_RESOURCE_USE, "Plugin effects", "\rOff", "\yNormal", "\ySmart Mode", "\yLow Bandwidth Mode")
			add_option_toggle(menu, OPTION_PLAY_SOUNDS, "Grenade sounds", "On", "Off")
			add_option_toggle(menu, OPTION_MONSTERMOD_SUPPORT, "Monstermod support", "On", "Off")
			add_option_toggle(menu, OPTION_MSG_SVC_BAD, "SVC_BAD fix", "On^n   \yNote: \wTurn on when the server has this problem!^n", "Off^n   \yNote: \wTurn on when the server has this problem!^n")
			add_option_toggle(menu, OPTION_BOT_ALLOW, "Allow bots to use the moded nades", "Yes^n", "No^n") 
			
			add_option_toggle(menu, OPTION_DISPLAY_MODE_ON_DRAW, "Display mode on draw", "Yes", "No")
			add_option_toggle(menu, OPTION_RESET_MODE_ON_THROW, "Reset mode on throw", "Yes^n", "No^n")
			
			add_option_toggle(menu, OPTION_REMOVE_IF_DIES, "Remove the nades if player dies", "Yes", "No")
			add_option_toggle(menu, OPTION_AFFECT_OWNER, "Traps can be activated by owner", "Yes", "No")
			add_option_toggle(menu, OPTION_TEAM_PLAY, "Team play (teammates will not be affected by nades)", "Yes^n", "No^n")
			
			add_option_toggle(menu, OPTION_SUPPRESS_FITH, "Suppress ^"Fire in the hole!^"", "Yes^n", "No^n")
			
			add_option_toggle(menu, OPTION_UNITS_SYSTEM, "Unit system:", "Metric", "Inch")
			
		}
		case 2:
		{
			settingsmenu[id] = menu_create("NadeModes - Mode Control", "cvar_menu_handler")
			menu = settingsmenu[id]
			
			add_option_toggle(menu, OPTION_NORMAL_ENABLED, "Enable normal grenades", "Yes", "No")
			add_option_toggle(menu, OPTION_PROXIMITY_ENABLED, "Enable proximity grenades", "Yes", "No")
			add_option_toggle(menu, OPTION_IMPACT_ENABLED, "Enable impact grenades", "Yes", "No")
			add_option_toggle(menu, OPTION_TRIP_ENABLED, "Enable trip grenades", "Yes", "No")
			add_option_toggle(menu, OPTION_MOTION_ENABLED, "Enable motion sensor grenades", "Yes", "No")
			add_option_toggle(menu, OPTION_SATCHEL_ENABLED, "Enable satchel charge grenades", "Yes", "No")
			add_option_toggle(menu, OPTION_HOMING_ENABLED, "Enable homing grenades", "Yes^n", "No^n")
			
			add_option_toggle(menu, OPTION_REACT_TRIP_G, "Trip grenade react method", "Boom", "Fly", OPTION_TRIP_ENABLED)
			add_option_toggle(menu, OPTION_REACT_TRIP_F, "Trip flash react method", "Boom", "Fly", OPTION_TRIP_ENABLED)
			add_option_toggle(menu, OPTION_REACT_TRIP_S, "Trip smoke react method", "Boom^n", "Fly^n", OPTION_TRIP_ENABLED)
			
			add_option_toggle(menu, OPTION_PROXIMITY_LOS, "Proximity detonate only if player is in line of sight", "Yes", "No", OPTION_PROXIMITY_ENABLED)
			add_option_toggle(menu, OPTION_MOTION_LOS, "Motion detonate only if player is in line of sight", "Yes", "No", OPTION_MOTION_ENABLED)
			add_option_toggle(menu, OPTION_SATCHEL_DELAY, "Add delay between satchel explotions", "Yes", "No", OPTION_SATCHEL_ENABLED)
		}
		case 3:
		{
			settingsmenu[id] = menu_create("NadeModes - Limit & Test Menu", "cvar_menu_handler")
			menu = settingsmenu[id]
			
			add_option_tritoggle(menu, OPTION_LIMIT_SYSTEM, "Limit system", "\rOff^n", "\yAvailable for each nade^n", "\yAvailable for all nades summed up^n")
			
			add_cell_option(menu, OPTION_LIMIT_PROXIMITY, "Proximity throw limit", "grenades", OPTION_LIMIT_SYSTEM)
			add_cell_option(menu, OPTION_LIMIT_TRIP, "Trip grenade throw limit", "grenades", OPTION_LIMIT_SYSTEM)
			add_cell_option(menu, OPTION_LIMIT_MOTION, "Motion throw limit", "grenades", OPTION_LIMIT_SYSTEM)
			add_cell_with_space_option(menu, OPTION_LIMIT_SATCHEL, "Stachel throw limit", "grenades", OPTION_LIMIT_SYSTEM)
			
			add_option_toggle(menu, OPTION_INFINITE_GRENADES, "Infinite grenades", "Yes", "No")
			add_option_toggle(menu, OPTION_INFINITE_FLASHES, "Infinite flashes", "Yes", "No")
			add_option_toggle(menu, OPTION_INFINITE_SMOKES, "Infinite smokes", "Yes", "No")
		}
		case 4:
		{
			settingsmenu[id] = menu_create("NadeModes - Hitpoint Menu", "cvar_menu_handler")
			menu = settingsmenu[id]
			
			add_option_tritoggle(menu, OPTION_MATERIAL_SYSTEM, "Interaction system", "\rOff", "\ySecondary Explosions", "\yHit Point System")
			
			
			
			switch (get_option(OPTION_MATERIAL_SYSTEM))
			{
				case 0:
				{
					add_option_toggle(menu, OPTION_HITPOINT_DEATH, "Nade death", "Explode^n", "Desintegrate^n",OPTION_MATERIAL_SYSTEM)
					
					add_cell_option(menu, OPTION_HITPOINT_NORMAL, "Normal grenade hitpoints", "hitpoints", OPTION_MATERIAL_SYSTEM)
					add_cell_option(menu, OPTION_HITPOINT_PROXIMITY, "Proximity grenade hitpoints", "hitpoints", OPTION_MATERIAL_SYSTEM)
					add_cell_option(menu, OPTION_HITPOINT_IMPACT, "Impact grenade hitpoints", "hitpoints", OPTION_MATERIAL_SYSTEM)
					add_cell_option(menu, OPTION_HITPOINT_TRIP, "Trip grenade hitpoints", "hitpoints", OPTION_MATERIAL_SYSTEM)
					add_cell_option(menu, OPTION_HITPOINT_MOTION, "Motion grenade hitpoints", "hitpoints", OPTION_MATERIAL_SYSTEM)
					add_cell_option(menu, OPTION_HITPOINT_SATCHEL, "Satchel grenade hitpoints", "hitpoints", OPTION_MATERIAL_SYSTEM)
					add_cell_option(menu, OPTION_HITPOINT_HOMING, "Homing grenade hitpoints", "hitpoints", OPTION_MATERIAL_SYSTEM)
				}
				
				case 1:
				{
					add_option_toggle(menu, OPTION_SEC_EXPLO_AFFECT, "Secondary explosions", "\yEach nade affects each!^n", "\yHe grenade affects all^n")
					add_float_unit_option(menu, OPTION_RADIUS_SEC_EXPLOSION, "Secondary explosion radius affection", "")
				}
				
				case 2:
				{
					add_option_toggle(menu, OPTION_HITPOINT_DEATH, "Nade death", "Explode^n", "Desintegrate^n",OPTION_MATERIAL_SYSTEM)
					
					add_cell_option(menu, OPTION_HITPOINT_NORMAL, "Normal grenade hitpoints", "hitpoints", OPTION_NORMAL_ENABLED)
					add_cell_option(menu, OPTION_HITPOINT_PROXIMITY, "Proximity grenade hitpoints", "hitpoints", OPTION_PROXIMITY_ENABLED)
					add_cell_option(menu, OPTION_HITPOINT_IMPACT, "Impact grenade hitpoints", "hitpoints", OPTION_IMPACT_ENABLED)
					add_cell_option(menu, OPTION_HITPOINT_TRIP, "Trip grenade hitpoints", "hitpoints", OPTION_TRIP_ENABLED)
					add_cell_option(menu, OPTION_HITPOINT_MOTION, "Motion grenade hitpoints", "hitpoints", OPTION_MOTION_ENABLED)
					add_cell_option(menu, OPTION_HITPOINT_SATCHEL, "Satchel grenade hitpoints", "hitpoints", OPTION_SATCHEL_ENABLED)
					add_cell_option(menu, OPTION_HITPOINT_HOMING, "Homing grenade hitpoints", "hitpoints^n", OPTION_HOMING_ENABLED)
					
					add_float_option(menu, OPTION_HITPOINT_FF, "Friendlyfire", "%", OPTION_MATERIAL_SYSTEM)
					add_float_option(menu, OPTION_HITPOINT_INTER_DMG, "Damage between the grenades", "%", OPTION_MATERIAL_SYSTEM)
					
				}
			}
		}
		case 5:
		{
			settingsmenu[id] = menu_create("NadeModes - Damage Settings", "cvar_menu_handler")
			menu = settingsmenu[id]
			
			add_option_tritoggle(menu, OPTION_DAMAGE_SYSTEM, "Damage system", "\rOff^n", "\yActive for every mode^n", "\yEach mode configurable^n")
			
			add_float_option(menu, OPTION_DMG_SELF, "Nade self damage percent", "%", OPTION_DAMAGE_SYSTEM)
			add_float_option(menu, OPTION_DMG_THROUGH_WALL, "Nade through wall damage percent", "%", OPTION_DAMAGE_SYSTEM)
			
			switch (get_option(OPTION_DAMAGE_SYSTEM))
			{
				case 0:
				{
					add_float_option(menu, OPTION_DMG_TEAMMATES, "Team mates damage percent", "%^n", OPTION_DAMAGE_SYSTEM)
				}
				
				case 1:
				{
					add_float_option(menu, OPTION_DMG_TEAMMATES, "Team mates damage percent", "%^n", OPTION_FRIENDLY_FIRE)
					
					add_float_option(menu, OPTION_DMG_NORMAL, "Grenade general damage multiply","times")
				}
				
				case 2:
				{
					add_float_option(menu, OPTION_DMG_TEAMMATES, "Team mates damage percent", "%^n", OPTION_FRIENDLY_FIRE)
					
					add_float_option(menu, OPTION_DMG_NORMAL, "Normal Grenade - damage multiply","times",OPTION_NORMAL_ENABLED)
					add_float_option(menu, OPTION_DMG_PROXIMITY, "Proximity Grenade - damage multiply","times", OPTION_PROXIMITY_ENABLED)
					add_float_option(menu, OPTION_DMG_IMPACT, "Impact Grenade - damage multiply","times", OPTION_IMPACT_ENABLED)
					add_float_option(menu, OPTION_DMG_TRIP, "Trip Grenade - damage multiply","times", OPTION_TRIP_ENABLED)
					add_float_option(menu, OPTION_DMG_MOTION, "Motion Grenade - damage multiply","times", OPTION_MOTION_ENABLED)
					add_float_option(menu, OPTION_DMG_SATCHEL, "Satchel Grenade - damage multiply","times", OPTION_SATCHEL_ENABLED)
					add_float_option(menu, OPTION_DMG_HOMING, "Homing Grenade - damage multiply","times", OPTION_HOMING_ENABLED)
				}
			}
		}
		case 6:
		{
			settingsmenu[id] = menu_create("NadeModes - Internal Functional Settings", "cvar_menu_handler")
			menu = settingsmenu[id]
			
			add_float_option(menu, OPTION_EXPLOSION_DELAY_TIME, "Grenade general delay explode time", "seconds^n")
			
			add_float_option(menu, OPTION_ARM_TIME_PROXIMITY, "Proximity arm time", "seconds", OPTION_PROXIMITY_ENABLED)
			add_float_unit_option(menu, OPTION_RADIUS_PROXIMITY, "Proximity detection radius", "^n", OPTION_PROXIMITY_ENABLED)
			
			add_float_option(menu, OPTION_ARM_TIME_TRIP, "Trip grenade arm time", "seconds", OPTION_TRIP_ENABLED)
			add_float_unit_option(menu, OPTION_TRIP_DETECT_DISTANCE, "Trip grenade detection distance", "", OPTION_TRIP_ENABLED)
			add_float_unit_option(menu, OPTION_TRIP_FLY_SPEED, "Trip grenade fly speed", "^n", OPTION_TRIP_ENABLED)
			
			add_float_option(menu, OPTION_ARM_TIME_SATCHEL, "Satchel charge arm time", "seconds^n", OPTION_SATCHEL_ENABLED)
			
			add_float_option(menu, OPTION_ARM_TIME_MOTION, "Motion sensor arm time", "seconds", OPTION_MOTION_ENABLED)
			add_float_unit_option(menu, OPTION_RADIUS_MOTION, "Motion sensor detection radius", "^n", OPTION_MOTION_ENABLED)
			
			add_float_option(menu, OPTION_HOMING_EXTRATIME, "Homing extra arm explosion time", "seconds", OPTION_HOMING_ENABLED)
			add_float_unit_option(menu, OPTION_HOMING_SCAN_RANGE, "Homing grenade detection range", "", OPTION_HOMING_ENABLED)
			add_float_unit_option(menu, OPTION_HOMING_SUPER_RANGE, "Homing grenade superhoming range", "", OPTION_HOMING_ENABLED)
			add_float_unit_option(menu, OPTION_HOMING_SPEED_ADD, "Homing grenade air acceleration", "", OPTION_HOMING_ENABLED)
		}
	}
	
	cvar_menu_pos[id] = menu_set
	menu_display(id, settingsmenu[id], page)
	return PLUGIN_CONTINUE
}

stock add_option_toggle(menu, Option:control_option, const basetext[], const yestext[], const notext[], Option:displayif = Option:-1)
{
	static cmd[4], itemtext[100]
	num_to_str(_:control_option, cmd, charsmax(cmd))
	
	format(itemtext, charsmax(itemtext), "%s: %s%s", basetext, (get_option(control_option) ? "\y" : "\r" ), (get_option(control_option) ? yestext : notext))
	menu_additem(menu, itemtext, cmd, _, (displayif != Option:-1 && !get_option(displayif)) ? callbacks[0] : callbacks[1])
}

stock add_option_tritoggle(menu, Option:control_option, const basetext[], const text[], const text2[], const text3[], Option:displayif = Option:-1)
{
	static cmd[4], itemtext[100]
	num_to_str(_:control_option, cmd, charsmax(cmd))
	
	format(itemtext, charsmax(itemtext), "%s:\y %s%s%s", basetext, (get_option(control_option) == 0 ? text : "" ), (get_option(control_option) == 1 ? text2 : "" ), (get_option(control_option) == 2 ? text3 : "" ))
	menu_additem(menu, itemtext, cmd, _, (displayif != Option:-1 && !get_option(displayif)) ? callbacks[0] : callbacks[1])
}

stock add_option_quatrotoggle(menu, Option:control_option, const basetext[], const text[], const text2[], const text3[], const text4[], Option:displayif = Option:-1)
{
	static cmd[4], itemtext[100]
	num_to_str(_:control_option, cmd, charsmax(cmd))
	
	format(itemtext, charsmax(itemtext), "%s:\y %s%s%s%s", basetext, (get_option(control_option) == 0 ? text : "" ), (get_option(control_option) == 1 ? text2 : "" ), (get_option(control_option) == 2 ? text3 : "" ), (get_option(control_option) == 3 ? text4 : "" ))
	menu_additem(menu, itemtext, cmd, _, (displayif != Option:-1 && !get_option(displayif)) ? callbacks[0] : callbacks[1])
}

stock add_nade_option(menu, Option:control_option, const basetext[])
{
	static cmd[4], itemtext[100]
	num_to_str(_:control_option, cmd, charsmax(cmd))
	
	format(itemtext, charsmax(itemtext), "%s:%s%s%s%s^n", basetext, (get_option(control_option) ? "\y" : " \rNone" ), ((get_option(control_option) & NADE_BIT[GRENADE_EXPLOSIVE]) ? " He" : ""), ((get_option(control_option) & NADE_BIT[GRENADE_FLASHBANG]) ? " Flash" : ""), ((get_option(control_option) & NADE_BIT[GRENADE_SMOKEGREN]) ? " Smoke" : ""))
	menu_additem(menu, itemtext, cmd, _, _)
}

stock add_float_option(menu, Option:control_option, const basetext[], const unit[], Option:displayif = Option:-1)
{
	static cmd[4], itemtext[100], value[20]
	float_to_str(get_option_float(control_option), value, charsmax(value))
	format(value, charsmax(value), "%0.2f", get_option_float(control_option))
	
	num_to_str(_:control_option, cmd, charsmax(cmd))
	
	format(itemtext, charsmax(itemtext), "%s: \y%s \r%s", basetext, value, unit)
	menu_additem(menu, itemtext, cmd, _, (displayif != Option:-1 && !get_option(displayif)) ? callbacks[0] : callbacks[1])
}

stock add_cell_option(menu, Option:control_option, const basetext[], const unit[], Option:displayif = Option:-1)
{
	static cmd[4], itemtext[100], value[20]
	num_to_str(get_option(control_option), value, charsmax(value))
	format(value, charsmax(value), "%d", get_option(control_option))
	if (!get_option(control_option))
	{
		value = "Off"
	}
	
	num_to_str(_:control_option, cmd, charsmax(cmd))
	
	format(itemtext, charsmax(itemtext), "%s: \y%s \r%s", basetext, value, get_option(control_option) ? unit : "")
	menu_additem(menu, itemtext, cmd, _, (displayif != Option:-1 && !get_option(displayif)) ? callbacks[0] : callbacks[1])
}

stock add_cell_with_space_option(menu, Option:control_option, const basetext[], const unit[], Option:displayif = Option:-1)
{
	static cmd[4], itemtext[100], value[20]
	num_to_str(get_option(control_option), value, charsmax(value))
	format(value, charsmax(value), "%d", get_option(control_option))
	if (!get_option(control_option))
	{
		value = "Off"
	}
	
	num_to_str(_:control_option, cmd, charsmax(cmd))
	
	format(itemtext, charsmax(itemtext), "%s: \y%s \r%s^n", basetext, value, get_option(control_option) ? unit : "")
	menu_additem(menu, itemtext, cmd, _, (displayif != Option:-1 && !get_option(displayif)) ? callbacks[0] : callbacks[1])
}

stock add_float_unit_option(menu, Option:control_option, const basetext[], const extratext[], Option:displayif = Option:-1)
{
	static cmd[4], itemtext[100], value[20]
	format(value, charsmax(value), "%0.2f", get_option(OPTION_UNITS_SYSTEM) ? CONVERT_TO_METERS(get_option_float(control_option)) : get_option_float(control_option))
	
	num_to_str(_:control_option, cmd, charsmax(cmd))
	
	format(itemtext, charsmax(itemtext), "%s: \y%s \r%s%s", basetext, value, get_option(OPTION_UNITS_SYSTEM) ? "meters" : "inches", extratext)
	menu_additem(menu, itemtext, cmd, _, (displayif != Option:-1 && !get_option(displayif)) ? callbacks[0] : callbacks[1])
}


public cvar_menu_handler(id, menu, item)
{
	new access, info[4], callback
	menu_item_getinfo(menu, item, access, info, charsmax(info), _, _, callback)
	
	if (item < 0)
	{
		save_cfg()
		update_forward_registration()
		main_menu(id)
		return PLUGIN_HANDLED
	}
	
	new cvar = str_to_num(info)
	
	switch (option_type[Option:cvar])
	{
		case TOPTION_TOGGLE:
		{
			toggle_option(Option:cvar)
		}
		case TOPTION_CELL:
		{
			new value_string[CVAR_STRING_ALLOC];
			ArrayGetString(option_value[Option:cvar], 0, value_string, charsmax(value_string))
			format(value_string, charsmax(value_string), "%s;", value_string)
			
			new values[CVAR_MAX_ASSIGNED_VALUES][CVAR_MAX_STRING_LENGTH]
			new true_value[CVAR_MAX_ASSIGNED_VALUES]
			
			new last = 0, newpos = 0, k = 0;
			
			for (new i=0;i<CVAR_STRING_ALLOC;i++)
			{
				if(equal(value_string[i], ";", 1))
				{
					newpos = i
				}
				
				if (newpos > last)
				{					
					for (new j=last;j<newpos;j++)
					{
						format(values[k], CVAR_MAX_STRING_LENGTH - 1, "%s%s", values[k], value_string[j])
					}
					
					last = newpos + 1
					k++
				}
				
				if (k == CVAR_MAX_ASSIGNED_VALUES)
				{
					break
				}
			}
			
			new bool:ok = false
			new counter = 0
			
			for (new i=0;i<k;i++)
			{
				counter++
				
				true_value[i] = str_to_num(values[i])
				
				if (ok == true)
				{
					set_pcvar_num(pcvars[Option:cvar], true_value[i])
					counter = 0
					break
				}
				
				if (true_value[i] == get_option(Option:cvar))
					ok = true
			}
			
			if (counter == k)
			{
				set_pcvar_num(pcvars[Option:cvar], true_value[0])
			}
		}
		case TOPTION_FLOAT:
		{
			new value_string_float[CVAR_STRING_ALLOC];
			ArrayGetString(option_value[Option:cvar], 0, value_string_float, charsmax(value_string_float))
			format(value_string_float, charsmax(value_string_float), "%s;", value_string_float)
			
			new values_float[CVAR_MAX_ASSIGNED_VALUES][CVAR_MAX_STRING_LENGTH]
			new Float:true_value_float[CVAR_MAX_ASSIGNED_VALUES]
			
			new last = 0, newpos = 0, k = 0;
			
			for (new i=0;i<CVAR_STRING_ALLOC;i++)
			{
				if(equal(value_string_float[i], ";", 1))
				{
					newpos = i
				}
				
				if (newpos > last)
				{					
					for (new j=last;j<newpos;j++)
					{
						format(values_float[k], CVAR_MAX_STRING_LENGTH - 1, "%s%s", values_float[k], value_string_float[j])
					}
					
					last = newpos + 1
					k++
				}
				
				if (k == CVAR_MAX_ASSIGNED_VALUES)
				{
					break
				}
			}
			
			new bool:ok=false
			new counter = 0
			
			for (new i=0;i<k;i++)
			{
				counter++
				
				true_value_float[i] = str_to_float(values_float[i])
				
				if (ok == true)
				{
					set_pcvar_float(pcvars[Option:cvar], true_value_float[i])
					counter = 0
					break
				}
				
				if (true_value_float[i] == get_option_float(Option:cvar))
					ok = true
			}
			
			if (counter == k)
			{
				set_pcvar_float(pcvars[Option:cvar], true_value_float[0])
			}
			
		}
	}
	
	menu_destroy(menu)
	update_forward_registration()
	cvar_menu(id, item / 7, cvar_menu_pos[id])
	save_cfg()
	return PLUGIN_HANDLED
}

public callback_disabled(id, menu, item)
{
	return ITEM_DISABLED
}

public callback_enabled(id, menu, item)
{
	return ITEM_ENABLED
}

/* -------------------------------
[Client Internet Forwards]
------------------------------- */
public client_connect(id)
{
	mode[id][GRENADE_EXPLOSIVE] = FirstEnabledMode(GRENADE_EXPLOSIVE)
	mode[id][GRENADE_FLASHBANG] = FirstEnabledMode(GRENADE_FLASHBANG)
	mode[id][GRENADE_SMOKEGREN] = FirstEnabledMode(GRENADE_SMOKEGREN)
	
	resetCounter(id)
}

public client_putinserver(id)
{
	// Add the bot property if user is bot
	if (is_user_bot(id))
	{
		cl_is_bot |= (1<<id)
		
		if (g_botquota != 0) 
		{
			// Delay for private data to initialize
			if (get_pcvar_num(g_botquota))
				set_task(0.1, "task_botHamHooks", id)
		}
	}
}

public task_botHamHooks(id)
{
	if (g_botquota == 0 || !is_user_connected(id)) 
		return
	
	// Check again for safety
	if (is_user_bot(id) && get_pcvar_num(g_botquota) > 0) 
	{
		// Post spawn fix for cz bots, since RegisterHam does not work for them
		RegisterHamFromEntity(Ham_Killed, 			id, "fw_killed_post", 1)
		RegisterHamFromEntity(Ham_Spawn,			id, "fw_spawn_post", 1)
		RegisterHamFromEntity(Ham_TakeDamage, 	 	id, "fw_takedamage")
		RegisterHamFromEntity(Ham_Player_PreThink, 	id, "fw_playerprethink")
		
		// Only needs to run once after ham is registed.
		g_botquota = 0
	}
	
	// Added this if other bots that come here and don't know what to do.
	fw_spawn_post(id)

}

public client_disconnect(id)
{
	// Remove the bot property (doesn't matter wether it was true or false)
	cl_is_bot &= ~(1<<id)
	
	mode[id][GRENADE_EXPLOSIVE] = FirstEnabledMode(GRENADE_EXPLOSIVE)
	mode[id][GRENADE_FLASHBANG] = FirstEnabledMode(GRENADE_FLASHBANG)
	mode[id][GRENADE_SMOKEGREN] = FirstEnabledMode(GRENADE_SMOKEGREN)
	
	resetCounter(id)
	
	cl_nextusetime[id] = 0.0
	
	cl_team[id] = CS_TEAM_UNASSIGNED
}

/* -------------------------------
[Forwards Registration Toggle]
------------------------------- */
public update_forward_registration()
{
	// Here we also update some global constants
	cacheCvars()
	g_maxplayers = get_maxplayers()
	
	if (g_check_hpsystem == -1)
	{
		g_check_hpsystem = get_option(OPTION_MATERIAL_SYSTEM)
	}
	else
	{
		if (!is_nademodes_enabled() && get_option(OPTION_MATERIAL_SYSTEM) == 2)
		{
			new i=-1
			while ((i = find_ent_by_class(i, "grenade")))
			{
				if (!is_grenade(i))
					continue
				
				if (entity_get_float(i, EV_FL_health))
				{
					entity_set_float(i, EV_FL_takedamage, DAMAGE_NO)
				}
			}
		}
		
		if (g_check_hpsystem != get_option(OPTION_MATERIAL_SYSTEM))
		{
			if ((get_option(OPTION_MATERIAL_SYSTEM) == 0 || get_option(OPTION_MATERIAL_SYSTEM) == 1) && g_check_hpsystem == 2)
			{
				new i=-1
				while ((i = find_ent_by_class(i, "grenade")))
				{
					if (!is_grenade(i))
						continue
					
					if (entity_get_float(i, EV_FL_health))
					{
						entity_set_float(i, EV_FL_takedamage, DAMAGE_NO)
					}
				}
			}
			
			if (get_option(OPTION_MATERIAL_SYSTEM) == 2 && (g_check_hpsystem == 1 || g_check_hpsystem == 0))
			{
				
				new i=-1
				while ((i = find_ent_by_class(i, "grenade")))
				{
					if (!is_grenade(i))
						continue
					
					if (entity_get_float(i, EV_FL_health))
					{
						entity_set_float(i, EV_FL_takedamage, DAMAGE_YES)
					}
				}
			}
		}
		
		g_check_hpsystem = get_option(OPTION_MATERIAL_SYSTEM)
	}
	
	if (is_nademodes_enabled())
	{
		bs_forward_collection |= FWD_CMDSTART | FWD_SETMODEL | FWD_THINK | FWD_TOUCH 
		
		if (get_option(OPTION_DAMAGE_SYSTEM))
		{
			bs_forward_collection |= FWD_TAKEDAMAGE
		}
		else
		{
			bs_forward_collection &= ~FWD_TAKEDAMAGE
		}
		
		if (get_option(OPTION_RESOURCE_USE))
		{
			bs_forward_collection |= FWD_THINK_POST
		}
		else
		{
			bs_forward_collection &= ~FWD_THINK_POST
		}
		
		if (!get_option(OPTION_MATERIAL_SYSTEM) || get_option(OPTION_MATERIAL_SYSTEM) > 2 || get_option(OPTION_MATERIAL_SYSTEM) < 0)
		{
			bs_forward_collection &= ~(FWD_SEC_EXPLODE | FWD_HPSYSTEM)
		}
		
		if (get_option(OPTION_MATERIAL_SYSTEM) == 1)
		{
			bs_forward_collection |= FWD_SEC_EXPLODE
		}
		else
		{
			bs_forward_collection &= ~FWD_SEC_EXPLODE
		}
		
		if (get_option(OPTION_MATERIAL_SYSTEM) == 2)
		{
			bs_forward_collection |= FWD_HPSYSTEM
		}
		else
		{
			bs_forward_collection &= ~FWD_HPSYSTEM
		}
		
		if (get_option(OPTION_SUPPRESS_FITH))
		{
			bs_forward_collection |= FWD_MESSAGE
		}
		else
		{
			bs_forward_collection &= ~FWD_MESSAGE
		}
		
	}
	else
	{
		bs_forward_collection = FWD_NONE_ACTIVE
	}
}
/* -------------------------------
[Events]
------------------------------- */
public event_armnade(id)
{
	static nade
	
	switch (read_data(2))
	{
		case CSW_HEGRENADE: 	nade = _:GRENADE_EXPLOSIVE
		case CSW_FLASHBANG: 	nade = _:GRENADE_FLASHBANG
		case CSW_SMOKEGRENADE: 	nade = _:GRENADE_SMOKEGREN
		default: return PLUGIN_CONTINUE
	}
	
	if (!is_nademodes_enabled())
		return PLUGIN_CONTINUE
	
	if (get_option(OPTION_INFINITE_GRENADES + Option:nade))
	{
		cs_set_user_bpammo(id, NADE_WPID[NadeRace:nade], 2000)
	}
	
	if (!(cl_can_use_nade[NadeRace:nade] & (1<<id)))
	{
		client_print(id, print_center, "Mode: Not allowed to throw anymore!")
		return PLUGIN_CONTINUE
	}
	
	if (get_option(OPTION_DISPLAY_MODE_ON_DRAW) && grenade_can_be_used(NadeRace:nade))
	{
		client_print(id, print_center, "Mode: %s", modetext[_:mode[id][NadeRace:nade]])
	}
	
	if (!is_mode_enabled(id, mode[id][NadeRace:nade], NadeRace:nade))
	{
		changemode(id, NadeRace:nade)
	}
	
	return PLUGIN_CONTINUE
}

public event_curweapon(id)
{
	cl_weapon[id] = read_data(2)
}

public event_new_round()
{
	static players[32], count, id
	get_players(players, count)
	
	for (new i=0;i<count;i++)
	{
		id = players[i]
		resetCounter(id)
	}
	
	static ent
	
	ent = -1
	while ((ent = find_ent_by_class(ent, "grenade")))
	{
		if(is_grenade(ent) && get_grenade_type(ent) != NADE_NORMAL)
			entity_set_int(ent, EV_INT_flags, entity_get_int(ent, EV_INT_flags) | FL_KILLME)
	}
	
	cacheCvars()
	
	g_zombie_mod &= ~ZM_CAN_THINK  // Disable thinking of ents before the first infection (this will prevent false explosions)
	
	return PLUGIN_CONTINUE
}

/* -------------------------------
[Message Engine Forwads]
------------------------------- */
public fith_audio(msg_id, msg_dest, entity)
{
	if (!(bs_forward_collection & FWD_MESSAGE))
		return PLUGIN_CONTINUE
	
	// Get the string that holds the message and test it to see wether to block it or not
	static string[18]
	get_msg_arg_string(2, string, charsmax(string))
	
	if (equal(string, "%!MRAD_FIREINHOLE")) return PLUGIN_HANDLED
	
	return PLUGIN_CONTINUE
}

public fith_text(msg_id, msg_dest, entity)
{
	if (!(bs_forward_collection & FWD_MESSAGE))
		return PLUGIN_CONTINUE
	
	static string[18]
	
	// Get the string that holds the message and test it to see wether to block it or not
	if (get_msg_args() == 5) // CS
	{
		get_msg_arg_string(5, string, charsmax(string))
	}
	else
	{
		if (get_msg_args() == 6) // CZ
		{
			get_msg_arg_string(6, string, charsmax(string))
		}
		else
		{
			return PLUGIN_CONTINUE
		}
	}
	
	return (equal(string, "#Fire_in_the_hole")) ? PLUGIN_HANDLED : PLUGIN_CONTINUE
}

/* -------------------------------
[Ham & Fakemeta Forwards]
------------------------------- */
public fw_playerprethink(id)
{
	if (!is_user_connected(id) || is_user_connecting(id) || is_user_hltv(id))
		return HAM_IGNORED
	
	switch (cs_get_user_team(id))
	{
		case CS_TEAM_T: cl_team[id] = CS_TEAM_T
		case CS_TEAM_CT: cl_team[id] = CS_TEAM_CT
		default: return HAM_IGNORED
	}
	
	return HAM_IGNORED
}

public fw_cmdstart(id, uc_handle, seed)
{
	if (!(bs_forward_collection & FWD_CMDSTART))
		return FMRES_IGNORED
	
	if (!(cl_is_alive & (1<<id)))
		return FMRES_IGNORED
	
	static bool:key[MAX_PLAYERS + 1] = {false, ...}
	
	static buttons
	buttons = get_uc(uc_handle, UC_Buttons)
	
	if (!(buttons & IN_USE))
	{
		cl_nextusetime[id] = 0.0
	}
	
	if (buttons & IN_ATTACK)
	{
		switch (cl_weapon[id])
		{
			case CSW_HEGRENADE: 	if (!(cl_can_use_nade[GRENADE_EXPLOSIVE] & (1<<id))) set_uc(uc_handle, UC_Buttons, buttons & ~IN_ATTACK)
			case CSW_FLASHBANG: 	if (!(cl_can_use_nade[GRENADE_FLASHBANG] & (1<<id))) set_uc(uc_handle, UC_Buttons, buttons & ~IN_ATTACK)
			case CSW_SMOKEGRENADE: 	if (!(cl_can_use_nade[GRENADE_SMOKEGREN] & (1<<id))) set_uc(uc_handle, UC_Buttons, buttons & ~IN_ATTACK)
		}
	}

	if (buttons & IN_ATTACK2)
	{
		if (!key[id])
		{
			switch (cl_weapon[id])
			{
				case CSW_HEGRENADE: 	if (cl_can_use_nade[GRENADE_EXPLOSIVE] & (1<<id)) changemode(id, GRENADE_EXPLOSIVE)
				case CSW_FLASHBANG: 	if (cl_can_use_nade[GRENADE_FLASHBANG] & (1<<id)) changemode(id, GRENADE_FLASHBANG)
				case CSW_SMOKEGRENADE: 	if (cl_can_use_nade[GRENADE_SMOKEGREN] & (1<<id)) changemode(id, GRENADE_SMOKEGREN)
			}
		}
		
		key[id] = true
	}
	else
	{
		key[id] = false
	}
	
	return FMRES_IGNORED
}

public fw_setmodel(ent, model[])
{
	if (!pev_valid(ent))
	{
		return FMRES_IGNORED
	}
	
	// Not yet thrown
	if (entity_get_float(ent, EV_FL_gravity) == 0.0)
	{
		return FMRES_IGNORED
	}
	
	for (new i=0;i<3;i++)
	{
		if (containi(model, NADE_MODEL[i]) != -1)
		{
			set_pdata_int(ent, OFFSET_WEAPONID, NADE_WPID[NadeRace:i], EXTRAOFFSET_WEAPONS)
			
			if (bs_forward_collection & FWD_SETMODEL)
				grenade_process(pev(ent, pev_owner), ent, NadeRace:i)
			
			break
		}
	}
	
	return FMRES_IGNORED
}

grenade_process(id, grenade, NadeRace:nade)
{
	if ((cl_is_bot & (1<<id)) && get_option(OPTION_BOT_ALLOW) && grenade_can_be_used(nade))
	{
		// We place the NADE_TRIP last so we can easily make another choice if it doesn't work ;)
		static const NadeType:random_vec[] = {NADE_NORMAL, NADE_IMPACT, NADE_MOTION, NADE_PROXIMITY, NADE_HOMING, NADE_TRIP}
		static NadeType:decision
		
		decision = random_vec[random_num(0, charsmax(random_vec))]
		mode[id][nade] = decision
		
		if (is_mode_enabled(id, mode[id][nade], nade))
		{
			if (decision == NADE_TRIP)
			{
				static loop[4][2] = { {0, 1}, {0, -1}, {1, 1}, {1, -1} }
				// Search in order: axis +X axis -X axis +Y axis -Y axis
				
				new Float:origin[3], Float:end[3], Float:fdest[3], Float:calc_vector[3], Float:height, Float: minimum, Float:distance = 9999999.999, Float:fraction
				
				entity_get_vector(id, EV_VEC_origin, origin)
				
				xs_vec_copy(origin, end)
				end[2] += 16000.0
				
				engfunc(EngFunc_TraceLine, origin, end, IGNORE_MONSTERS, id, g_ptrace[TH_BOT])
				
				get_tr2(g_ptrace[TH_BOT], TR_vecEndPos, end)
				
				xs_vec_sub(end, origin, end)
				
				height = xs_vec_len(end)
				
				
				xs_vec_copy(origin, end)
				end[2] -= 16000.0
				
				engfunc(EngFunc_TraceLine, origin, end, IGNORE_MONSTERS, id, g_ptrace[TH_BOT])
				
				get_tr2(g_ptrace[TH_BOT], TR_vecEndPos, end)
				
				xs_vec_sub(end, origin, end)
				
				height += xs_vec_len(end)
				
				if ( height > BOT_FORCE_CROUCH_HEIGHT_CONST)
				{
					minimum = BOT_MIN_HEIGHT_ALLOW
				}
				else
				{
					minimum = BOT_MIN_CROUCH_HEIGHT_ALLOW
					height -= BOT_MIN_CROUCH_HEIGHT_ALLOW
					
				}
				
				if ( height > BOT_MAX_HEIGHT_ALLOW )
				{
					height = BOT_MAX_HEIGHT_ALLOW
				}
				
				if (xs_vec_len(end) < height)
				{
					xs_vec_mul_scalar(end, - random_float(minimum - xs_vec_len(end),height  - xs_vec_len(end)) / xs_vec_len(end), end)
					xs_vec_add(end, origin, origin)
				}
				else
				{
					if (xs_vec_len(end) < height)
					{
						xs_vec_mul_scalar(end,  (xs_vec_len(end) - random_float(minimum, height)) / xs_vec_len(end), end)
						xs_vec_add(end, origin, origin)
					}
					else
					{
						xs_vec_mul_scalar(end, (xs_vec_len(end) - random_float(minimum, height)) / xs_vec_len(end), end)
						xs_vec_add(end, origin, origin)
					}
				}
				
				for(new i=0;i<4;i++)
				{
					// Add search direction
					xs_vec_copy(origin, end)
					end[loop[i][0]] = origin[loop[i][0]] + (16000.0 * float(loop[i][1]))
					
					// Trace to get the entity where we can attach our nade
					engfunc(EngFunc_TraceLine, origin, end, IGNORE_MONSTERS, id, g_ptrace[TH_BOT])
					
					// Get fraction to see if it has hited something
					get_tr2(g_ptrace[TH_BOT], TR_flFraction, fraction)
					
					if (fraction < 1.0)
					{
						if ( (!is_attachable_surface(get_tr2(g_ptrace[TH_BOT], TR_pHit))) || get_tr2(g_ptrace[TH_BOT], TR_AllSolid) )
						{
							continue
						}
						
						// Get plane normal for the wall
						get_tr2(g_ptrace[TH_BOT], TR_vecPlaneNormal, calc_vector)
						
						// Check if we have a wall
						if ( xs_vec_dot(calc_vector, Float:{0.0,0.0,1.0}) > BOT_WALL_MIN_COSINUS || xs_vec_dot(calc_vector, Float:{0.0,0.0,1.0}) < (-BOT_WALL_MIN_COSINUS) )
						{
							continue
						}
						
						// We use the end point for extra calculations
						get_tr2(g_ptrace[TH_BOT], TR_vecEndPos, end)
						
						xs_vec_sub(origin, end, calc_vector)
						
						if (xs_vec_len(calc_vector) < distance)
						{
							distance = xs_vec_len(calc_vector)
							xs_vec_normalize(calc_vector, calc_vector)
							xs_vec_mul_scalar(calc_vector, 1.5, calc_vector)
							xs_vec_add(end, calc_vector, end)
							xs_vec_copy(end, fdest)
						}
					}
					
				}
				
				for(new i=0;i<2;i++)
				{
					for(new j=2;j<4;j++)
					{
						// Add search direction
						xs_vec_copy(origin, end)
						
						end[loop[i][0]] = origin[loop[i][0]] + (16000.0 * float(loop[i][1]))
						end[loop[j][0]] = origin[loop[j][0]] + (16000.0 * float(loop[j][1]))
						
						engfunc(EngFunc_TraceLine, origin, end, IGNORE_MONSTERS, id, g_ptrace[TH_BOT])
						
						get_tr2(g_ptrace[TH_BOT], TR_flFraction, fraction)
						
						if (fraction < 1.0)
						{
							if ( (!is_attachable_surface(get_tr2(g_ptrace[TH_BOT], TR_pHit))) || get_tr2(g_ptrace[TH_BOT], TR_AllSolid) )
							{
								continue
							}
							
							get_tr2(g_ptrace[TH_BOT], TR_vecPlaneNormal, calc_vector)
							
							if ( xs_vec_dot(calc_vector, Float:{0.0,0.0,1.0}) > BOT_WALL_MIN_COSINUS || xs_vec_dot(calc_vector, Float:{0.0,0.0,1.0}) < (-BOT_WALL_MIN_COSINUS) )
							{
								continue
							}
							
							get_tr2(g_ptrace[TH_BOT], TR_vecEndPos, end)
							
							xs_vec_sub(origin, end, calc_vector)
							
							if (xs_vec_len(calc_vector) < distance)
							{
								distance = xs_vec_len(calc_vector)
								xs_vec_normalize(calc_vector, calc_vector)
								xs_vec_mul_scalar(calc_vector, 3.0, calc_vector)
								xs_vec_add(end, calc_vector, end)
								xs_vec_copy(end, fdest)
							}
							
						}
						
					}
				}
				
				xs_vec_sub(fdest, origin, calc_vector)
				
				if (xs_vec_len(calc_vector) <= BOT_MIN_DISTANCE_ATTACH)
				{
					xs_vec_normalize(calc_vector, calc_vector)
					xs_vec_mul_scalar(calc_vector, 20.0, calc_vector)
					entity_set_vector(grenade, EV_VEC_velocity, calc_vector)
					entity_set_int(grenade, EV_INT_movetype, MOVETYPE_FLY)
					entity_set_origin(grenade, fdest)
					set_grenade_type(grenade, mode[id][nade])
					
				}
				else
				{
					decision = random_vec[random_num(0, charsmax(random_vec) - 1)]
					mode[id][nade] = decision
					set_grenade_type(grenade, mode[id][nade])
				}
				
			}
			else
			{
				set_grenade_type(grenade, mode[id][nade])
			}
		}
		else
		{
			mode[id][nade] = NADE_NORMAL
			set_grenade_type(grenade, mode[id][nade])
		}
		
		return
	}
	
	if (is_nademodes_enabled() && is_mode_enabled(id, mode[id][nade], nade) && grenade_can_be_used(nade))
	{
		set_grenade_type(grenade, mode[id][nade])
	}
	else
	{
		changemode(id,nade);
		set_grenade_type(grenade, mode[id][nade])
	}
	
	if (get_option(OPTION_RESET_MODE_ON_THROW))
	{
		mode[id][nade] = NADE_NORMAL
	}
	
	return
}

public fw_spawn(ent)
{
	if (!pev_valid(ent))
		return FMRES_IGNORED
	
	static classname[32]
	pev(ent, pev_classname, classname, charsmax(classname))
	
	if(!TrieKeyExists(trace_attack_reg_class, classname))
	{
		RegisterHam(Ham_TraceAttack, classname, "fw_global_traceattack", 1)
		TrieSetCell(trace_attack_reg_class, classname, true)
	}
	
	return FMRES_IGNORED
}

public fw_track_explosion(grenade)
{
	if (entity_get_float(grenade, EV_FL_dmgtime) >= get_gametime())
		return HAM_IGNORED
	
	if (is_grenade_c4(grenade))
		return HAM_IGNORED
	
	new NadeType:type, owner
	owner = entity_get_edict(grenade, EV_ENT_owner)
	type = get_grenade_type(grenade)
	
	if (!is_user_connected(owner) || is_user_connecting(owner) || cl_team[owner] == CS_TEAM_UNASSIGNED)
	{
		entity_set_int(grenade, EV_INT_flags, entity_get_int(grenade, EV_INT_flags) | FL_KILLME)
		return HAM_IGNORED
	}
	
	if (_:type & NADE_DONT_COUNT)
	{
		return HAM_IGNORED
	}
	else
	{
		type &= ~NadeType:NADE_DONT_COUNT
		
		if (get_grenade_race(grenade) == _:GRENADE_SMOKEGREN)
		{
			if (entity_get_float(grenade, EV_FL_animtime) == 0.0)
			{
				return HAM_IGNORED
			}
			else
			{
				entity_set_float(grenade, EV_FL_animtime, 0.0)
			}
			
			clear_line(grenade)
		}
		else
		{
			clear_line(grenade)
		}
		
		if (!(_:UNCOUNTABLE_NADE_MODES & (1 << (_:type + 1))))
		{
			cl_counter[owner][NadeRace:get_grenade_race(grenade)][type] -= 1
			refresh_can_use_nade(owner, GRENADE_EXPLOSIVE)
			refresh_can_use_nade(owner, GRENADE_FLASHBANG)
			refresh_can_use_nade(owner, GRENADE_SMOKEGREN)
		}
		
		entity_set_int(grenade, EV_INT_iuser1, entity_get_int(grenade, EV_INT_iuser1) | NADE_DONT_COUNT)
	}
	
	if (!(bs_forward_collection & FWD_SEC_EXPLODE))
		return HAM_IGNORED
	
	new Float:origin[3]
	new Float:range
	entity_get_vector(grenade, EV_VEC_origin, origin)
	range = get_option_float(OPTION_RADIUS_SEC_EXPLOSION)
	
	new i
	i = g_maxplayers
	
	if (!get_option(OPTION_SEC_EXPLO_AFFECT) && get_grenade_race(grenade) == _:GRENADE_EXPLOSIVE)
	{
		while ((i = find_ent_in_sphere(i, origin, range)))
		{
			if (i == grenade)
				continue
			
			if (is_grenade(i, true))
			{
				if (entity_get_float(i, EV_FL_animtime) == 0.0 && get_grenade_race(i) == _:GRENADE_SMOKEGREN)
				{
					continue
				}
				
				make_explode(i)
				
				if (get_grenade_race(i) == _:GRENADE_SMOKEGREN)
				{
					entity_set_int(i, EV_INT_flags, entity_get_int(i, EV_INT_flags) | FL_ONGROUND)
					dllfunc(DLLFunc_Think, i)
				}
			}
		}
	}
	else
	{
		static race
		race = get_grenade_race(grenade)
		
		while ((i = find_ent_in_sphere(i, origin, range)))
		{
			if (i == grenade)
				continue
			
			if (is_grenade(i, true))
			{
				if (get_grenade_race(i) == race)
				{
					if (entity_get_float(i, EV_FL_animtime) == 0.0 && race == _:GRENADE_SMOKEGREN)
					{
						continue
					}
					
					make_explode(i)
					
					if (race == _:GRENADE_SMOKEGREN)
					{
						entity_set_int(i, EV_INT_flags, entity_get_int(i, EV_INT_flags) | FL_ONGROUND)
						dllfunc(DLLFunc_Think, i)
					}
				}
			}
		}
	}

	return HAM_IGNORED
}

public fw_think(ent)
{
	if (!(bs_forward_collection & FWD_THINK) || !is_valid_ent(ent))
		return HAM_IGNORED
	
	if (is_grenade_c4(ent))
		return HAM_IGNORED
	
	if ((g_zombie_mod & ZM_ZM_ACTIVE) && !(g_zombie_mod & ZM_CAN_THINK) && !(get_grenade_type(ent) == NADE_TRIP && (TRIP_ATTACHED <= get_trip_grenade_mode(ent) <= TRIP_WAITING)))
		return HAM_IGNORED
	
	static i, Float:origin[3], Float:porigin[3], Float:fraction, owner, bs_holds
	static Float:radius, affect_owner, team_play, los
	
	affect_owner = get_option(OPTION_AFFECT_OWNER)
	team_play = get_option(OPTION_TEAM_PLAY)
	
	entity_get_vector(ent, EV_VEC_origin, origin)
	
	owner = entity_get_edict(ent, EV_ENT_owner)
	
	if (!is_user_connected(owner) || is_user_connecting(owner) || cl_team[owner] == CS_TEAM_UNASSIGNED)
	{
		entity_set_int(ent, EV_INT_flags, entity_get_int(ent, EV_INT_flags) | FL_KILLME)
		return HAM_IGNORED
	}
	
	switch (get_grenade_type(ent))
	{
		case NADE_DUD:
		{
			return HAM_SUPERCEDE
		}
		
		case NADE_NORMAL:
		{
			return HAM_IGNORED
		}
		
		case NADE_PROXIMITY:
		{
			if (!allow_grenade_explode(ent))
				return HAM_IGNORED
			
			if (entity_get_float(ent, EV_FL_fuser4) <= get_gametime())
				play_sound(ent, BUTTON);
			
			i = -1
			radius = get_option_float(OPTION_RADIUS_PROXIMITY)
			los = get_option(OPTION_PROXIMITY_LOS)
			
			while ((i = find_ent_in_sphere(i, origin, radius)))
			{
				if (i > g_maxplayers)
				{
					if (get_option(OPTION_MONSTERMOD_SUPPORT))
					{
						if (is_ent_monster(i))
						{
							entity_get_vector(i, EV_VEC_origin, porigin)
							
							engfunc(EngFunc_TraceLine, origin, porigin, IGNORE_MONSTERS, 0, g_ptrace[TH_LOS])
							get_tr2(g_ptrace[TH_LOS], TR_flFraction, fraction)
							
							if (fraction < 1.0)
								continue
							
							make_explode(ent)
							return HAM_IGNORED
						}
						else
							continue
					}
					
					return HAM_IGNORED
				}
				
				if (!is_player_alive(i))
					continue
				
				if (los)
				{
					entity_get_vector(i, EV_VEC_origin, porigin)
					
					engfunc(EngFunc_TraceLine, origin, porigin, IGNORE_MONSTERS, 0, g_ptrace[TH_LOS])
					get_tr2(g_ptrace[TH_LOS], TR_flFraction, fraction)
					
					if (fraction < 1.0)
						continue
				}
				
				if (i == owner)
				{
					if (affect_owner)
					{
						make_explode(ent)
						return HAM_IGNORED
					}
					else
					{
						continue
					}
				}
				
				if (!team_play)
				{
					make_explode(ent)
					return HAM_IGNORED
				}
				else
				{
					if (cl_team[i] != cl_team[owner])
					{
						make_explode(ent)
						return HAM_IGNORED
					}
				}
			}
			return HAM_IGNORED
		}
		
		case NADE_TRIP:
		{
			static hit, Float:point[3], Float:normal[3], Float:temp[3], Float:end[3], Float:fly[3]
			static Float:fly_speed, Float:detect_distance, Float:arm_time
			
			fly_speed = get_option_float(OPTION_TRIP_FLY_SPEED)
			detect_distance = get_option_float(OPTION_TRIP_DETECT_DISTANCE)
			arm_time = get_option_float(OPTION_ARM_TIME_TRIP)
			
			switch (get_trip_grenade_mode(ent))
			{
				case TRIP_NOT_ATTACHED, TRIP_DETONATED:
				{
					return HAM_IGNORED
				}
				
				case TRIP_ATTACHED:
				{
					static loop[6][2] = { {2, 1}, {2, -1}, {0, 1}, {0, -1}, {1, 1}, {1, -1} }
					// Search in order: +Z axis -Z axis +X axis -X axis +Y axis -Y axis
					
					for (new i; i < 6; i++)
					{
						xs_vec_copy(origin, point)
						
						point[loop[i][0]] = origin[loop[i][0]] + (2.0 * float(loop[i][1]))
						
						engfunc(EngFunc_TraceLine, origin, point, IGNORE_MONSTERS, ent, g_ptrace[TH_TRIP])
						
						get_tr2(g_ptrace[TH_TRIP], TR_flFraction, fraction)
						
						if (fraction < 1.0)
						{
							hit = get_tr2(g_ptrace[TH_TRIP], TR_pHit)
							
							if (!is_attachable_surface(hit))
							{
								set_grenade_type(ent, NADE_DUD)
								return HAM_IGNORED
							}
							
							get_tr2(g_ptrace[TH_TRIP], TR_vecPlaneNormal, normal)
							
							set_trip_grenade_attached_to(ent, hit)
							
							// Calculate and store fly velocity.
							xs_vec_mul_scalar(normal, fly_speed, temp)
							set_trip_grenade_fly_velocity(ent, temp)
							
							// Calculate and store endpoint.
							xs_vec_mul_scalar(normal, detect_distance, temp)
							xs_vec_add(temp, origin, end)
							
							// Trace to it
							engfunc(EngFunc_TraceLine, origin, end, IGNORE_MONSTERS, ent, g_ptrace[TH_TRIP])
							get_tr2(g_ptrace[TH_TRIP], TR_flFraction, fraction)
							
							// Final endpoint with no possible wall collision
							xs_vec_mul_scalar(normal, (detect_distance * fraction), temp)
							xs_vec_add(temp, origin, end)
							set_trip_grenade_end_origin(ent, end)
							
							xs_vec_mul_scalar(temp, 0.5, temp)
							xs_vec_add(temp, origin, temp)
							set_trip_grenade_middle_origin(ent, temp)
							
							set_trip_grenade_arm_time(ent, arm_time)
							
							play_sound(ent, DEPLOY)
							
							entity_set_vector(ent, EV_VEC_velocity, Float:{0.0, 0.0, 0.0}) // Stop if from moving
							
							entity_set_int(ent, EV_INT_sequence, 0) // Otherwise, grenade might make wierd motions.
							
							vector_to_angle(normal, normal)
							
							entity_set_vector(ent, EV_VEC_angles, normal)
							
							set_trip_grenade_mode(ent, TRIP_WAITING)
							
							set_task(0.1, "trip_activation", ent)
							
							return HAM_IGNORED
						}
					}
					
					// If we reach here, we have serious problems. This means that the grenade hit something like a func_breakable
					// that disappeared before the scan was able to take place. Now, the grenade is floating in mid air. So we just
					// kaboom it!!!
					
					make_explode(ent)
					
					if (NadeRace:get_grenade_race(ent) == GRENADE_SMOKEGREN)
					{
						entity_set_int(ent, EV_INT_flags, entity_get_int(ent, EV_INT_flags) | FL_ONGROUND)
					}
					
					return HAM_IGNORED
				}
				
				case TRIP_WAITING:
				{
					
					if (!is_attachable_surface(get_trip_grenade_attached_to(ent)))
					{
						make_explode(ent)
					
						if (NadeRace:get_grenade_race(ent) == GRENADE_SMOKEGREN)
						{
							entity_set_int(ent, EV_INT_flags, entity_get_int(ent, EV_INT_flags) | FL_ONGROUND)
							clear_line(ent)
						}
						
						return HAM_IGNORED
					}
					
					if (get_gametime() > get_trip_grenade_arm_time(ent))
					{
						set_trip_grenade_mode(ent, TRIP_SCANNING)
						play_sound(ent, ACTIVATE)
					}
					
					return HAM_IGNORED
				}
				
				case TRIP_SCANNING:
				{
					if (!is_attachable_surface(get_trip_grenade_attached_to(ent)))
					{
						make_explode(ent)
						
						if (NadeRace:get_grenade_race(ent) == GRENADE_SMOKEGREN)
						{
							entity_set_int(ent, EV_INT_flags, entity_get_int(ent, EV_INT_flags) | FL_ONGROUND)
							clear_line(ent)
						}
						
						return HAM_IGNORED
					}
					
					get_trip_grenade_end_origin(ent, end)
					engfunc(EngFunc_TraceLine, end, origin, DONT_IGNORE_MONSTERS, 0, g_ptrace[TH_TRIP])
					
					static target
					target = get_tr2(g_ptrace[TH_TRIP], TR_pHit)
					
					if (is_player_alive(target))
					{
						if (owner == target)
						{
							if (affect_owner)
							{
								set_trip_grenade_mode(ent, TRIP_SHOULD_DETONATE)
								entity_set_float(ent, EV_FL_nextthink, get_gametime() + 0.001)
								return HAM_IGNORED
							}
							else
							{
								entity_set_float(ent, EV_FL_nextthink, get_gametime() + 0.001)
								return HAM_IGNORED
							}
						}
						
						if (!team_play)
						{
							set_trip_grenade_mode(ent, TRIP_SHOULD_DETONATE)
						}
						else
						{
							if (cl_team[owner] != cl_team[target])
								set_trip_grenade_mode(ent, TRIP_SHOULD_DETONATE)
						}
					}
					else if (get_option(OPTION_MONSTERMOD_SUPPORT) && is_ent_monster(target))
					{
						set_trip_grenade_mode(ent, TRIP_SHOULD_DETONATE)
					}
					
					entity_set_float(ent, EV_FL_nextthink, get_gametime() + 0.001)
					return HAM_IGNORED
				}
				
				case TRIP_SHOULD_DETONATE:
				{
					static mode
					mode = get_trip_grenade_react_method(ent)
					set_trip_grenade_mode(ent, TRIP_DETONATED)
					
					clear_line(ent)
					play_sound(ent, ACTIVATE)
					
					if (mode == 0)
					{
						cl_counter[owner][NadeRace:get_grenade_race(ent)][NADE_TRIP] -= 1
						
						refresh_can_use_nade(owner, GRENADE_EXPLOSIVE)
						refresh_can_use_nade(owner, GRENADE_FLASHBANG)
						refresh_can_use_nade(owner, GRENADE_SMOKEGREN)
						
						get_trip_grenade_fly_velocity(ent, fly)
						get_trip_grenade_end_origin(ent, end)
						entity_set_vector(ent, EV_VEC_velocity, fly) 			// Send the grenade on its way.
						set_grenade_type(ent, NADE_IMPACT)		 				// Kaboom!
					}
					else
					{
						make_explode(ent)
						
						if (NadeRace:get_grenade_race(ent) == GRENADE_SMOKEGREN)
						{
							entity_set_int(ent, EV_INT_flags, entity_get_int(ent, EV_INT_flags) | FL_ONGROUND)
							clear_line(ent)
						}
					}
					
					return HAM_IGNORED
				}
			}
		}
		
		case NADE_MOTION:
		{
			if (!allow_grenade_explode(ent))
				return HAM_IGNORED
			
			static Float:v[3], Float:velocity
			
			i = -1
			bs_holds = 0
			radius = get_option_float(OPTION_RADIUS_MOTION)
			los = get_option(OPTION_MOTION_LOS)
			
			while ((i = find_ent_in_sphere(i, origin, radius)))
			{
				if (i > g_maxplayers)
				{
					entity_set_int(ent, EV_INT_iuser2, bs_holds)
					
					if (get_option(OPTION_MONSTERMOD_SUPPORT))
					{
						if (is_ent_monster(i))
						{
							entity_get_vector(i, EV_VEC_origin, porigin)
							
							engfunc(EngFunc_TraceLine, origin, porigin, IGNORE_MONSTERS, 0, g_ptrace[TH_LOS])
							get_tr2(g_ptrace[TH_LOS], TR_flFraction, fraction)
							
							if (fraction < 1.0)
								continue
							
							entity_get_vector(i, EV_VEC_velocity, v)
							velocity = xs_vec_len(v)
							
							if (velocity > 100.0)
							{
								make_explode(ent)
								return HAM_IGNORED
							}
						}
						else
							continue
					}
					
					return HAM_IGNORED
				}
				
				if (!is_player_alive(i))
					continue
				
				if (los)
				{
					entity_get_vector(i, EV_VEC_origin, porigin)
					
					engfunc(EngFunc_TraceLine, origin, porigin, IGNORE_MONSTERS, 0, g_ptrace[TH_LOS])
					get_tr2(g_ptrace[TH_LOS], TR_flFraction, fraction)
					
					if (fraction < 1.0)
						continue
				}
				
				entity_get_vector(i, EV_VEC_velocity, v)
				velocity = xs_vec_len(v)
				
				if (velocity > 200.0)
				{
					if (i == owner)
					{
						if (affect_owner)
						{
							make_explode(ent)
							return HAM_IGNORED
						}
						else
						{
							bs_holds |= (1<<i)
							continue
						}
					}
					if (!team_play)
					{
						make_explode(ent)
						return HAM_IGNORED
					}
					else
					{
						if (cl_team[i] != cl_team[owner])
						{
							make_explode(ent)
							return HAM_IGNORED
						}
					}
					
					bs_holds |= (1<<i)
					entity_set_int(ent, EV_INT_iuser2, bs_holds)
					play_sound(ent, GEIGER)
				}
				else if (velocity == 0.0)
				{
					continue
				}
				else
				{
					play_sound(ent, GEIGER)
					
					// Add the player to the bitsum if he is moving
					bs_holds |= (1<<i)
				}
				
			}
			
			entity_set_int(ent, EV_INT_iuser2, bs_holds)
			return HAM_IGNORED
		}
		
		case NADE_SATCHEL:
		{
			if (!allow_grenade_explode(ent))
				return HAM_IGNORED
			
			if (entity_get_int(owner, EV_INT_button) & IN_USE)
			{
				if (get_option(OPTION_SATCHEL_DELAY))
				{
					if (cl_nextusetime[owner] > get_gametime())
					{
						return HAM_IGNORED 
					}
					else
					{
						cl_nextusetime[owner] = get_gametime() + DELAY_ADDED_TO_USE
					}
				}
				
				make_explode(ent)
				
				if (NadeRace:get_grenade_race(ent) == GRENADE_SMOKEGREN)
				{
					entity_set_int(ent, EV_INT_flags, entity_get_int(ent, EV_INT_flags) | FL_ONGROUND)
				}
			}
			
			
			return HAM_IGNORED
		}
		
		case NADE_HOMING:
		{
			static target, Float:extravel
			target = entity_get_int(ent, EV_INT_iuser2)
			extravel = get_option_float(OPTION_HOMING_SPEED_ADD)
			
			if (target == 0)
			{
				static i, Float:distance
				i = -1
				distance = get_option_float(OPTION_HOMING_SCAN_RANGE)
				
				while ((i = find_ent_in_sphere(i, origin, distance)))
				{
					if (i > g_maxplayers)
					{
						if (get_option(OPTION_MONSTERMOD_SUPPORT))
						{
							if (is_ent_monster(i))
							{
								static Float:o[3]
								entity_get_vector(i, EV_VEC_origin, o)
								static Float:new_distance
								new_distance = get_distance_f(o, origin)
								
								if (new_distance < distance)
								{
									distance = new_distance
									entity_set_int(ent, EV_INT_iuser2, i)
								}
							}
							else
							{
								continue
							}
						}
						else
							break
					}
					
					if (!is_player_alive(i))
						continue
					
					if (i == owner)
						continue
					
					if ((cl_team[i] != cl_team[owner] && team_play) || !team_play)
					{
						static Float:o[3]
						entity_get_vector(i, EV_VEC_origin, o)
						static Float:new_distance
						new_distance = get_distance_f(o, origin)
						
						if (new_distance < distance)
						{
							distance = new_distance
							entity_set_int(ent, EV_INT_iuser2, i)
						}
					}
				}
				
				return HAM_IGNORED
			}
			else if (!(cl_is_alive & (1<<target)) && target <= g_maxplayers)
			{
				return HAM_IGNORED
			}
			else if (is_in_los(ent, target))
			{
				//set_user_rendering(target)
				static Float:velocity[3], Float:aim[3], Float:targetorigin[3], Float:velocity_normal[3], Float:aim_normal[3]
				
				entity_get_vector(target, EV_VEC_origin, targetorigin)
				
				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)
				
				play_sound(ent, PING)
				
				if (velocity_normal[0] < aim_normal[0])
				{
					velocity[0] += extravel
				}
				else if (velocity_normal[0] > aim_normal[0])
				{
					velocity[0] -= extravel
				}
				
				if (velocity_normal[1] < aim_normal[1])
				{
					velocity[1] += extravel
				}
				else if (velocity_normal[1] > aim_normal[1])
				{
					velocity[1] -= extravel
				}
				
				if (velocity_normal[2] < aim_normal[2])
				{
					velocity[2] += extravel
				}
				else if (velocity_normal[2] > aim_normal[2])
				{
					velocity[2] -= extravel
				}
				
				velocity[2] += 5.0
				
				entity_set_vector(ent, EV_VEC_velocity, velocity)
				
				// When within blasting range, make our homing grenade think much much faster; results in better homing.
				if (get_distance_f(origin, targetorigin) < get_option_float(OPTION_HOMING_SUPER_RANGE))
				{
					entity_set_float(ent, EV_FL_nextthink, (get_gametime() + 0.05))
				}
				else
				{
					entity_set_float(ent, EV_FL_nextthink, (get_gametime() + 0.15))
				}
			}
			
			return HAM_IGNORED
		}
	}
	
	return HAM_IGNORED
}

public trip_activation(ent)
{
	if (is_valid_ent(ent))
		play_sound(ent, CHARGE)
}

public fw_think_post(ent)
{
	if (!is_valid_ent(ent))
		return HAM_IGNORED
	
	if (is_grenade_c4(ent))
		return HAM_IGNORED
	
	static owner, Float:origin[3], Float:gametime, bs_affected
	
	gametime = get_gametime()
	
	if (entity_get_float(ent, EV_FL_dmgtime) <= gametime)
		return HAM_IGNORED
	
	entity_get_vector(ent, EV_VEC_origin, origin)
	owner = entity_get_edict(ent, EV_ENT_owner)
	
	if (!is_user_connected(owner) || is_user_connecting(owner) || cl_team[owner] == CS_TEAM_UNASSIGNED)
	{
		entity_set_int(ent, EV_INT_flags, entity_get_int(ent, EV_INT_flags) | FL_KILLME)
		return HAM_IGNORED
	}
	
	if (!(bs_forward_collection & FWD_THINK_POST))
	{
		switch (get_grenade_type(ent))
		{
			case NADE_PROXIMITY:
			{
				// We do this for the sound of the entity
				if (entity_get_float(ent, EV_FL_fuser4) <= gametime)
					entity_set_float(ent, EV_FL_fuser4, gametime + 2.0)
			}
			case NADE_TRIP:
			{
				// We do this in order to make the trip nades be 10000% more accurate!
				entity_set_float(ent, EV_FL_nextthink, get_gametime() + 0.001)
			}
		}
		
		return HAM_IGNORED
	}
	
	bs_affected = 0
	
	if (get_option(OPTION_RESOURCE_USE) != 3)
	{
		bs_affected = ~0
	}
	else
	{
		static team_play, affect_owner
		team_play = get_option(OPTION_TEAM_PLAY)
		affect_owner = get_option(OPTION_AFFECT_OWNER)
		
		if (!team_play)
		{
			bs_affected = affect_owner ? ~0 : ~(1<<owner)
		}
		else
		{
			for (new i=1;i<=g_maxplayers;i++)
			{
				if (!is_user_connected(i))
					continue
				
				if (affect_owner & i == owner)
					bs_affected |= (1<<i)
				
				if (team_play && cs_get_user_team(i) != cs_get_user_team(owner))
					bs_affected |= (1<<i)
			}
		}
	}
	
	switch (get_grenade_type(ent))
	{
		case NADE_PROXIMITY:
		{
			if (!allow_grenade_explode(ent))
				return HAM_IGNORED
			
			if (entity_get_float(ent, EV_FL_fuser4) <= gametime)
			{						
				entity_set_float(ent, EV_FL_fuser4, gametime + 2.0)
				
				if (entity_get_int(ent, EV_INT_flags) & FL_ONGROUND)
				{
					if (!get_option(OPTION_TEAM_PLAY) || ((g_zombie_mod & ZM_ZM_ACTIVE) && !(g_zombie_mod & ZM_CAN_THINK)))
					{
						if (get_option(OPTION_RESOURCE_USE) == 1)
						{
							show_ring(origin, get_option_float(OPTION_RADIUS_PROXIMITY) * RING_SIZE_CONSTANT_PROXIMITY, 5)
						}
						else
						{
							static i
							i = -1
							
							while ( (i = find_ent_in_sphere(i, origin, SMART_RADIUS_RING_SHOW)) )
							{
								if (i > g_maxplayers)
									break
								
								if (!(cl_is_alive & (1<<i)) || (cl_is_bot & (1<<i)))
									continue
								
								if (bs_affected & (1<<i))
									show_ring(origin, get_option_float(OPTION_RADIUS_PROXIMITY) * RING_SIZE_CONSTANT_PROXIMITY, 5, _, _, _, i)
							}
						}
					}
					else
					{
						switch (cl_team[owner])
						{
							case CS_TEAM_T: 
							{
								if (get_option(OPTION_RESOURCE_USE) == 1)
								{
									show_ring(origin, get_option_float(OPTION_RADIUS_PROXIMITY) * RING_SIZE_CONSTANT_PROXIMITY, 5, TEAMTE_RGB_R_COLOR, TEAMTE_RGB_G_COLOR, TEAMTE_RGB_B_COLOR)
								}
								else
								{
									static i
									i = -1
									
									while ( (i = find_ent_in_sphere(i, origin, SMART_RADIUS_RING_SHOW)) )
									{
										if (i > g_maxplayers)
											break
										
										if (!(cl_is_alive & (1<<i)) || (cl_is_bot & (1<<i)))
											continue
										
										if (bs_affected & (1<<i))
											show_ring(origin, get_option_float(OPTION_RADIUS_PROXIMITY) * RING_SIZE_CONSTANT_PROXIMITY, 5, TEAMTE_RGB_R_COLOR, TEAMTE_RGB_G_COLOR, TEAMTE_RGB_B_COLOR, i)
									}
								}
								
							}
							case CS_TEAM_CT:
							{
								if (get_option(OPTION_RESOURCE_USE) == 1)
								{
									show_ring(origin, get_option_float(OPTION_RADIUS_PROXIMITY) * RING_SIZE_CONSTANT_PROXIMITY, 5, TEAMCT_RGB_R_COLOR, TEAMCT_RGB_G_COLOR, TEAMCT_RGB_B_COLOR)
								}
								else
								{
									static i
									i = -1
									
									while ( (i = find_ent_in_sphere(i, origin, SMART_RADIUS_RING_SHOW)) )
									{
										if (i > g_maxplayers)
											break
										
										if (!(cl_is_alive & (1<<i)) || (cl_is_bot & (1<<i)))
											continue
										
										if (bs_affected & (1<<i))
											show_ring(origin, get_option_float(OPTION_RADIUS_PROXIMITY) * RING_SIZE_CONSTANT_PROXIMITY, 5, TEAMCT_RGB_R_COLOR, TEAMCT_RGB_G_COLOR, TEAMCT_RGB_B_COLOR, i)
									}
								}
							}
						}
					}
				}
			}
		}
		
		case NADE_MOTION:
		{
			static bs_holds
			bs_holds = entity_get_int(ent, EV_INT_iuser2)
			
			if (bs_holds && entity_get_float(ent, EV_FL_fuser4) <= gametime)
			{
				entity_set_float(ent, EV_FL_fuser4, get_gametime() + 0.1)
				
				if (!get_option(OPTION_TEAM_PLAY) || ((g_zombie_mod & ZM_ZM_ACTIVE) && !(g_zombie_mod & ZM_CAN_THINK)))
				{
					if ( get_option(OPTION_RESOURCE_USE) == 1)
					{
						show_ring(origin, get_option_float(OPTION_RADIUS_MOTION) * RING_SIZE_CONSTANT_MOTION, 1)
					}
					else
					{
						for (new i=1;i<=g_maxplayers;i++)
						{
							if ((bs_holds & (1<<i)) && (bs_affected & (1<<i)))
								show_ring(origin, get_option_float(OPTION_RADIUS_MOTION) * RING_SIZE_CONSTANT_MOTION, 1, _, _, _, i)
						}
					}
				}
				else
				{
					switch (cl_team[owner])
					{
						case CS_TEAM_T:
						{
							if ( get_option(OPTION_RESOURCE_USE) == 1 )
							{
								show_ring(origin, get_option_float(OPTION_RADIUS_MOTION) * RING_SIZE_CONSTANT_MOTION, 1, TEAMTE_RGB_R_COLOR, TEAMTE_RGB_G_COLOR, TEAMTE_RGB_B_COLOR)
							}
							else
							{
								for (new i=1;i<=g_maxplayers;i++)
								{
									if ((bs_holds & (1<<i)) && (bs_affected & (1<<i)))
										show_ring(origin, get_option_float(OPTION_RADIUS_MOTION) * RING_SIZE_CONSTANT_MOTION, 1, TEAMTE_RGB_R_COLOR, TEAMTE_RGB_G_COLOR, TEAMTE_RGB_B_COLOR, i)
								}
							}
						}
						case CS_TEAM_CT:
						{
							if ( get_option(OPTION_RESOURCE_USE) == 1 )
							{
								show_ring(origin, get_option_float(OPTION_RADIUS_MOTION) * RING_SIZE_CONSTANT_MOTION, 1, TEAMCT_RGB_R_COLOR, TEAMCT_RGB_G_COLOR, TEAMCT_RGB_B_COLOR)
							}
							else
							{
								for (new i=1;i<=g_maxplayers;i++)
								{
									if ((bs_holds & (1<<i)) && (bs_affected & (1<<i)))
										show_ring(origin, get_option_float(OPTION_RADIUS_MOTION) * RING_SIZE_CONSTANT_MOTION, 1, TEAMCT_RGB_R_COLOR, TEAMCT_RGB_G_COLOR, TEAMCT_RGB_B_COLOR, i)
								}
							}
						}
						default:
						{
							if ( get_option(OPTION_RESOURCE_USE) == 1 )
							{
								show_ring(origin, get_option_float(OPTION_RADIUS_MOTION) * RING_SIZE_CONSTANT_MOTION, 1, _, _, _)
							}
							else
							{
								for (new i=1;i<=g_maxplayers;i++)
								{
									if ((bs_holds & (1<<i)) && (bs_affected & (1<<i)))
										show_ring(origin, get_option_float(OPTION_RADIUS_MOTION) * RING_SIZE_CONSTANT_MOTION, 1, _, _, _, i)
								}
							}
						}
					}
				}
			}
		}
		
		case NADE_TRIP:
		{
			if (get_trip_grenade_mode(ent) != TRIP_SCANNING)
				return HAM_IGNORED
			
			// We do this in order to make the trip nades be 10000% more accurate!
			entity_set_float(ent, EV_FL_nextthink, get_gametime() + 0.001)
			
			if (entity_get_float(ent, EV_FL_fuser4) <= gametime)
			{
				new Float:end[3]
				get_trip_grenade_end_origin(ent, end)
				
				if (get_option(OPTION_RESOURCE_USE) == 1)
				{
					if (!get_option(OPTION_TEAM_PLAY) || ((g_zombie_mod & ZM_ZM_ACTIVE) && !(g_zombie_mod & ZM_CAN_THINK)))
					{
						draw_line_from_entity_broadcast(ent, end, 5, _, _, _)
					}
					else
					{
						switch (cl_team[owner])
						{
							case CS_TEAM_T:
							{
								draw_line_from_entity_broadcast(ent, end, 5, TEAMTE_RGB_R_COLOR, TEAMTE_RGB_G_COLOR, TEAMTE_RGB_B_COLOR)
							}
							case CS_TEAM_CT:
							{
								draw_line_from_entity_broadcast(ent, end, 5, TEAMCT_RGB_R_COLOR, TEAMCT_RGB_G_COLOR, TEAMCT_RGB_B_COLOR)
							}
							default:
							{
								draw_line_from_entity_broadcast(ent, end, 5, _, _, _)
							}
						}
					}
					
					entity_set_float(ent, EV_FL_fuser4, gametime + 0.5)
					return HAM_IGNORED
				}
				
				static  Float:first[3], Float:second[3], Float:porigin[3], Float:anglefraction, Float:third[3], Float:fourth[3]
				
				xs_vec_sub(origin,end,first)
				
				anglefraction = 1.0 - calc_cone_angle_from_distance(xs_vec_len(first))
				
				if (xs_vec_len(first) <= SMART_DISTANCE_LINE_PVS)
				{
					get_trip_grenade_middle_origin(ent, first) 
					
					if (!get_option(OPTION_TEAM_PLAY) || ((g_zombie_mod & ZM_ZM_ACTIVE) && !(g_zombie_mod & ZM_CAN_THINK)))
					{
						draw_line_from_entity(ent, end, 5, _, _, _, 0, first)
					}
					else
					{
						switch (cl_team[owner])
						{
							case CS_TEAM_T:
							{
								draw_line_from_entity(ent, end, 5, TEAMTE_RGB_R_COLOR, TEAMTE_RGB_G_COLOR, TEAMTE_RGB_B_COLOR, 0, first)
							}
							case CS_TEAM_CT:
							{
								draw_line_from_entity(ent, end, 5, TEAMCT_RGB_R_COLOR, TEAMCT_RGB_G_COLOR, TEAMCT_RGB_B_COLOR, 0, first)
							}
							default:
							{
								draw_line_from_entity(ent, end, 5, _, _, _, 0, first)
							}
						}
					}
					
					entity_set_float(ent, EV_FL_fuser4, gametime + 0.5)
					return HAM_IGNORED
				}
				
				xs_vec_mul_scalar(first,EXTRALENGTH_VECTOR / xs_vec_len(first),first)
				xs_vec_sub(end,first,fourth)
				xs_vec_add(origin,first,first)
				
				static players[32],num,id
				get_players(players,num,"ac")
				
				for (new i=0;i<num;i++)
				{
					id = players[i]
					entity_get_vector(id, EV_VEC_origin, porigin)
					
					xs_vec_sub(porigin, fourth, second)
					xs_vec_normalize(second, second)
					
					xs_vec_sub(porigin, first, third)
					xs_vec_normalize(third, third)
					
					xs_vec_sub(first,fourth,first)
					xs_vec_normalize(first,first)
					
					if ( xs_vec_dot(first,second) <= CONE_DROP_ANGLE_COSINUS || (0 - xs_vec_dot(first,third)) <= CONE_DROP_ANGLE_COSINUS )
						continue
					
					if (bs_affected & (1<<id))
					{
						if ( xs_vec_dot(first, second) >= anglefraction )
						{
							if (!get_option(OPTION_TEAM_PLAY) || ((g_zombie_mod & ZM_ZM_ACTIVE) && !(g_zombie_mod & ZM_CAN_THINK)))
							{
								draw_line_from_entity(ent, end, 5, _, _, _, id)
							}
							else
							{
								switch (cl_team[owner])
								{
									case CS_TEAM_T:
									{
										draw_line_from_entity(ent, end, 5, TEAMTE_RGB_R_COLOR, TEAMTE_RGB_G_COLOR, TEAMTE_RGB_B_COLOR, id)
									}
									case CS_TEAM_CT:
									{
										draw_line_from_entity(ent, end, 5, TEAMCT_RGB_R_COLOR, TEAMCT_RGB_G_COLOR, TEAMCT_RGB_B_COLOR, id)
									}
									default:
									{
										draw_line_from_entity(ent, end, 5, _, _, _, id)
									}
								}
							}
						}
						else
						{
							if ( (0 - xs_vec_dot(first, third)) >= anglefraction )
							{
								if (!get_option(OPTION_TEAM_PLAY) || ((g_zombie_mod & ZM_ZM_ACTIVE) && !(g_zombie_mod & ZM_CAN_THINK)))
								{
									draw_line_from_entity(ent, end, 5, _, _, _, id)
								}
								else if (bs_affected & (1<<id))
								{
									switch (cl_team[owner])
									{
										case CS_TEAM_T:
										{
											draw_line_from_entity(ent, end, 5, TEAMTE_RGB_R_COLOR, TEAMTE_RGB_G_COLOR, TEAMTE_RGB_B_COLOR, id)
										}
										case CS_TEAM_CT:
										{
											draw_line_from_entity(ent, end, 5, TEAMCT_RGB_R_COLOR, TEAMCT_RGB_G_COLOR, TEAMCT_RGB_B_COLOR, id)
										}
										default:
										{
											draw_line_from_entity(ent, end, 5, _, _, _, id)
										}
									}
								}
							}
						}
					}
				}
				
				entity_set_float(ent, EV_FL_fuser4, gametime + 0.5)
				
			}
		}
		
		default : return HAM_IGNORED
	}
	
	return HAM_IGNORED
}

public fw_touch(toucher, touched)
{
	if (!(bs_forward_collection & FWD_TOUCH))
		return HAM_IGNORED
	
	switch (get_grenade_type(toucher))
	{
		case NADE_IMPACT:
		{
			if (is_solid(touched))
			{
				make_explode(toucher)
				
				entity_set_float(toucher, EV_FL_nextthink, get_gametime() + 0.001)
				
				if (NadeRace:get_grenade_race(toucher) == GRENADE_SMOKEGREN)
				{
					entity_set_int(toucher, EV_INT_flags, entity_get_int(toucher, EV_INT_flags) | FL_ONGROUND)
				}
			}
		}
		
		case NADE_TRIP:
		{
			static classname[10]
			entity_get_string(touched, EV_SZ_classname, classname, charsmax(classname))
			
			if (get_trip_grenade_mode(toucher) > TRIP_NOT_ATTACHED || is_user_connected(touched))
			{
				return HAM_IGNORED
			}
			else
			{
				if (is_solid(touched))
				{
					entity_set_int(toucher, EV_INT_movetype, MOVETYPE_NONE)
					set_trip_grenade_mode(toucher, TRIP_ATTACHED)
					return (containi(classname, "door") != -1) ? HAM_SUPERCEDE : HAM_IGNORED
				}
			}
		}
	}
	
	return HAM_IGNORED
}

public fw_spawn_post(id)
{	
	if (is_user_alive(id))
	{
		cl_is_alive |= (1<<id)
	}
	else
	{
		cl_is_alive &= ~(1<<id)
	}
	
	return HAM_IGNORED
}

public fw_killed_post(id, attacker, gib)
{
	if (is_user_alive(id))
	{
		cl_is_alive |= (1<<id)
	}
	else
	{
		cl_is_alive &= ~(1<<id)
	}
	
	if (!get_option(OPTION_REMOVE_IF_DIES))
		return HAM_IGNORED
	
	mode[id][GRENADE_EXPLOSIVE] = FirstEnabledMode(GRENADE_EXPLOSIVE)
	mode[id][GRENADE_FLASHBANG] = FirstEnabledMode(GRENADE_FLASHBANG)
	mode[id][GRENADE_SMOKEGREN] = FirstEnabledMode(GRENADE_SMOKEGREN)
	
	resetCounter(id)
	removeNades(id)
	
	
	return HAM_IGNORED
}

public fw_takedamage(victim, inflictor, attacker, Float:damage, damagebits)
{
	if (!(bs_forward_collection & FWD_TAKEDAMAGE))
		return HAM_IGNORED
	
	static aclassname[7], iclassname[8]
	
	entity_get_string(attacker,  EV_SZ_classname, aclassname, charsmax(aclassname))
	entity_get_string(inflictor,  EV_SZ_classname, iclassname, charsmax(iclassname))
	
	if ((damagebits & DMG_BLAST))
		return HAM_IGNORED
	
	if (!equal(aclassname, "player") || !equal(iclassname, "grenade"))
		return HAM_IGNORED
	
	if (attacker == victim)
	{
		damage *= (get_option_float(OPTION_DMG_SELF) / 100.0)
	}
	else
	{
		if (cl_team[attacker] == cl_team[victim] && get_option(OPTION_FRIENDLY_FIRE))
		{
			damage *= 0.02 * get_option_float(OPTION_DMG_TEAMMATES)
		}
	}
	
	static Float:origin[3], Float:user_origin[3], Float:fraction
	
	entity_get_vector(victim, EV_VEC_origin, user_origin)
	entity_get_vector(inflictor, EV_VEC_origin, origin)
	origin[2] += 2.0
	engfunc(EngFunc_TraceLine, user_origin, origin, IGNORE_MONSTERS, victim, g_ptrace[TH_DMG])

	get_tr2(g_ptrace[TH_DMG], TR_flFraction, fraction)
	
	if (fraction < 1.0)
	{
		damage *= (get_option_float(OPTION_DMG_THROUGH_WALL) / 100.0)
	}
	
	if ( get_option(OPTION_DAMAGE_SYSTEM) == 1)
	{
		damage *= get_option_float(OPTION_DMG_NORMAL)
	}
	else
	{
		new type = _:get_grenade_type(inflictor)
		type &= ~NADE_DONT_COUNT
		
		switch ( type )
		{
			case NADE_NORMAL:
			{
				damage *= get_option_float(OPTION_DMG_NORMAL)
			}
			
			case NADE_PROXIMITY:
			{
				damage *= get_option_float(OPTION_DMG_PROXIMITY)
			}
			
			case NADE_IMPACT:
			{
				damage *= get_option_float(OPTION_DMG_IMPACT)
			}
			
			case NADE_TRIP:
			{
				damage *= get_option_float(OPTION_DMG_TRIP)
			}
			
			case NADE_MOTION:
			{
				damage *= get_option_float(OPTION_DMG_MOTION)
			}
			
			case NADE_SATCHEL:
			{
				damage *= get_option_float(OPTION_DMG_SATCHEL)
			}
			
			case NADE_HOMING:
			{
				damage *= get_option_float(OPTION_DMG_HOMING)
			}
			
			default:
			{
				damage *= get_option_float(OPTION_DMG_NORMAL)
			}
		}
	}
	
	SetHamParamFloat(4, damage)
	
	return HAM_HANDLED
}

public fw_monster_takedamage(victim, inflictor, attacker, Float:damage, damagebits)
{
	if (!(bs_forward_collection & FWD_TAKEDAMAGE) || !get_option(OPTION_MONSTERMOD_SUPPORT))
		return HAM_IGNORED
	
	static aclassname[7], iclassname[8]
	
	entity_get_string(attacker,  EV_SZ_classname, aclassname, charsmax(aclassname))
	entity_get_string(inflictor,  EV_SZ_classname, iclassname, charsmax(iclassname))
	
	if ((damagebits & DMG_BLAST))
		return HAM_IGNORED
	
	if (!equal(aclassname, "player") || !equal(iclassname, "grenade"))
		return HAM_IGNORED
	
	static Float:origin[3], Float:user_origin[3], Float:fraction
	
	entity_get_vector(victim, EV_VEC_origin, user_origin)
	entity_get_vector(inflictor, EV_VEC_origin, origin)
	origin[2] += 2.0
	engfunc(EngFunc_TraceLine, user_origin, origin, IGNORE_MONSTERS, victim, g_ptrace[TH_DMG])

	get_tr2(g_ptrace[TH_DMG], TR_flFraction, fraction)
	
	if (fraction < 1.0)
	{
		damage *= (get_option_float(OPTION_DMG_THROUGH_WALL) / 100.0)
	}
	
	if ( get_option(OPTION_DAMAGE_SYSTEM) == 1)
	{
		damage *= get_option_float(OPTION_DMG_NORMAL)
	}
	else
	{
		new type = _:get_grenade_type(inflictor)
		type &= ~NADE_DONT_COUNT
		
		switch ( type )
		{
			case NADE_NORMAL:
			{
				damage *= get_option_float(OPTION_DMG_NORMAL)
			}
			
			case NADE_PROXIMITY:
			{
				damage *= get_option_float(OPTION_DMG_PROXIMITY)
			}
			
			case NADE_IMPACT:
			{
				damage *= get_option_float(OPTION_DMG_IMPACT)
			}
			
			case NADE_TRIP:
			{
				damage *= get_option_float(OPTION_DMG_TRIP)
			}
			
			case NADE_MOTION:
			{
				damage *= get_option_float(OPTION_DMG_MOTION)
			}
			
			case NADE_SATCHEL:
			{
				damage *= get_option_float(OPTION_DMG_SATCHEL)
			}
			
			case NADE_HOMING:
			{
				damage *= get_option_float(OPTION_DMG_HOMING)
			}
			
			default:
			{
				damage *= get_option_float(OPTION_DMG_NORMAL)
			}
		}
	}
	
	SetHamParamFloat(4, damage)
	
	return HAM_HANDLED
}

public fw_grenade_takedamage(grenade, inflictor, attacker, Float:damage, bits)
{
	if (!(bs_forward_collection & FWD_HPSYSTEM))
		return HAM_IGNORED
	
	if (inflictor == grenade)
	{
		SetHamReturnInteger(0)
		return HAM_SUPERCEDE
	}
	
	new Float:health, Float:origin[3], ok = false
	health = entity_get_float(grenade, EV_FL_health)
	
	if (!(1 <= attacker <= g_maxplayers))
		return HAM_SUPERCEDE
	
	if ((entity_get_int(grenade, EV_INT_flags) & FL_GODMODE) || (entity_get_float(grenade, EV_FL_takedamage) == DAMAGE_NO))
		return HAM_SUPERCEDE
	
	entity_get_vector(grenade, EV_VEC_origin, origin)
	
	if (entity_get_edict(grenade, EV_ENT_owner) != attacker && cl_team[entity_get_edict(grenade, EV_ENT_owner)] == cl_team[attacker])
	{
		damage *= get_option_float(OPTION_HITPOINT_FF) / 100.0
		ok = true
	}
	
	new string[8]
	entity_get_string(inflictor, EV_SZ_classname, string, charsmax(string))
	
	if (equal(string,"grenade"))
	{
		damage *= get_option_float(OPTION_HITPOINT_INTER_DMG) / 100.0
		ok = true
	}
	
	play_sound2(grenade, SOUND_HIT[random_num(0,4)])
	
	if (floatcmp(damage,health) != -1)
	{
		static NadeType:type, owner
		owner = entity_get_edict(grenade, EV_ENT_owner)
		type = get_grenade_type(grenade)
		type &= ~NadeType:NADE_DONT_COUNT
		
		if (get_option(OPTION_HITPOINT_DEATH))
		{
			make_explode(grenade)
			
			if (NadeRace:get_grenade_race(grenade) == GRENADE_SMOKEGREN)
			{
				entity_set_int(grenade, EV_INT_flags, entity_get_int(grenade, EV_INT_flags) | FL_ONGROUND)
				dllfunc(DLLFunc_Think, grenade)
				clear_line(grenade)
			}
			
			return HAM_SUPERCEDE
		}
		
		entity_set_int(grenade, EV_INT_flags, entity_get_int(grenade, EV_INT_flags) | FL_KILLME)
		
		if (!(_:UNCOUNTABLE_NADE_MODES & (1 << (_:type + 1))))
		{	
			cl_counter[owner][NadeRace:get_grenade_race(grenade)][type] -= 1
			refresh_can_use_nade(owner, GRENADE_EXPLOSIVE)
			refresh_can_use_nade(owner, GRENADE_FLASHBANG)
			refresh_can_use_nade(owner, GRENADE_SMOKEGREN)
		}
		
		if (get_option(OPTION_RESOURCE_USE))
			metal_gibs(origin)
		
		clear_line(grenade)
		
		return HAM_SUPERCEDE
	}
	
	if (ok)
	{
		SetHamParamFloat(4, damage)
		return HAM_HANDLED
	}
	
	return HAM_IGNORED
}

public fw_traceline(Float:start[3], Float:end[3], conditions, id, trace)
{
	if (!(bs_forward_collection & FWD_HPSYSTEM))
		return FMRES_IGNORED
	
	if (!is_player_alive(id))
		return FMRES_IGNORED
	
	if (cl_weapon[id] != CSW_KNIFE)
		return FMRES_IGNORED
	
	if (pev_valid(get_tr2(trace,TR_pHit)))
		return FMRES_IGNORED
	
	static Float:vec_end[3], i
	i = g_maxplayers
	
	get_tr2(trace, TR_vecEndPos, vec_end)
	
	while ((i = find_ent_in_sphere(i, vec_end, SHOT_SECOND_TEST_RADIUS)))
	{
		if (is_grenade(i, true))
		{
			static Float:origin[3]
			pev(i,pev_origin,origin)
			xs_vec_sub(origin,vec_end,origin)
			if (xs_vec_len(origin) > SHOT_KNIFE_REAL_RADIUS)
				continue
			
			set_tr2(trace, TR_pHit, i)
			break
		}
	}
	
	return FMRES_HANDLED
}

public fw_global_traceattack(ent, attacker, Float:damage, Float:direction[3], tracehdl, damagebits)
{
	if (!(bs_forward_collection & FWD_HPSYSTEM))
		return FMRES_IGNORED
	
	if (attacker > g_maxplayers || attacker < 1)
		return HAM_IGNORED
	
	if (cl_weapon[attacker] == CSW_KNIFE)
		return HAM_IGNORED
	
	static Float:origin[3],Float:offs[3]
	pev(attacker,pev_origin,origin)
	pev(attacker,pev_view_ofs,offs)
	xs_vec_add(origin,offs,origin)
	
	static Float:end[3], Float:point[3], Float:origin_nade[3], Float:track[3]
	get_tr2(tracehdl,TR_vecEndPos,end)
	
	xs_vec_sub(end,origin,point)
	xs_vec_mul_scalar(point, SHOT_PENETRATION_DISTANCE / xs_vec_len(point), point)
	xs_vec_add(end, point, end)
	
	static grenade
	static bool:ok
	static bool:reset_queue
	
	grenade = -1
	reset_queue = false
	
	while ((grenade = find_ent_by_class(grenade,"grenade")))
	{
		if (entity_get_float(grenade, EV_FL_dmgtime) < get_gametime())
			continue
		
		ok = false
		entity_get_vector(grenade, EV_VEC_origin, origin_nade)
		
		for (new i=0;i<SHOT_ENTITY_QUEUE_LENGTH;i++)
		{
			if (grenade == cl_entity_queue[attacker][i])
			{
				cl_entity_queue[attacker][i] = 0;
				ok = true;
				reset_queue = true;
				break;
			}
		}
		
		if (ok)
		{
			continue;
		}
		
		engfunc(EngFunc_TraceModel,origin,end,HULL_POINT,grenade,g_ptrace[TH_DMG])
		
		if(get_tr2(g_ptrace[TH_DMG],TR_pHit) == grenade)
		{
			ExecuteHamB(Ham_TraceAttack, grenade, attacker, damage, direction, g_ptrace[TH_DMG], damagebits)
			
			insert_in_queue(attacker, grenade)
		}
		else
		{
			new times = 1
			
			xs_vec_sub(origin_nade, end, track)
			
			while (times != SHOT_PENETRATION_READD_TIMES + 1 && xs_vec_len(track) > SHOT_SECOND_TEST_RADIUS)
			{
				xs_vec_add(end, point, track)
				
				for (new i=1;i<=times;++i)
				{
					xs_vec_add(track, point, track)
				}
				
				xs_vec_sub(origin_nade, track, track)
				
				times++;
			}
			
			if ( xs_vec_len(track) <= SHOT_SECOND_TEST_RADIUS )
			{
				set_tr2(g_ptrace[TH_DMG], TR_pHit, grenade)
				
				xs_vec_add(origin_nade, track, track)
				set_tr2(g_ptrace[TH_DMG], TR_vecEndPos, track)
				
				ExecuteHamB(Ham_TraceAttack, grenade, attacker, (damage / 2), direction, g_ptrace[TH_DMG], damagebits)
				
				insert_in_queue(attacker, grenade)
			}
		}
	}
	
	if (reset_queue)
	{
		for (new i=0;i<SHOT_ENTITY_QUEUE_LENGTH;i++)
		{
			cl_entity_queue[attacker][i] = 0
		}
	}
	
	return HAM_IGNORED
}

/* -------------------------------
[Plugin Zombie Mod Compatibility Forwards]
------------------------------- */
public zp_user_infected_post(id, infector)
{
	g_zombie_mod |= ZM_DO_ALL
	
	// Reset the mode on infection
	mode[id][GRENADE_EXPLOSIVE] = FirstEnabledMode(GRENADE_EXPLOSIVE)
	mode[id][GRENADE_FLASHBANG] = FirstEnabledMode(GRENADE_FLASHBANG)
	mode[id][GRENADE_SMOKEGREN] = FirstEnabledMode(GRENADE_SMOKEGREN)
	
	resetCounter(id)
	removeNades(id)
	
	return PLUGIN_CONTINUE
}

public event_infect(id, attacker)
{
	g_zombie_mod |= ZM_DO_ALL
	
	// Reset the mode on infection
	mode[id][GRENADE_EXPLOSIVE] = FirstEnabledMode(GRENADE_EXPLOSIVE)
	mode[id][GRENADE_FLASHBANG] = FirstEnabledMode(GRENADE_FLASHBANG)
	mode[id][GRENADE_SMOKEGREN] = FirstEnabledMode(GRENADE_SMOKEGREN)
	
	resetCounter(id)
	removeNades(id)
	
	return PLUGIN_CONTINUE
}

/* -------------------------------
[Usefull Functions -> NadeMode Tolls]
------------------------------- */
stock is_nademodes_enabled()
{
	if (get_option(OPTION_ENABLE_NADE_MODES))
	{
		return ((get_option(OPTION_NORMAL_ENABLED)<<0) | (get_option(OPTION_PROXIMITY_ENABLED)<<1) | (get_option(OPTION_IMPACT_ENABLED)<<2) | (get_option(OPTION_TRIP_ENABLED)<<3) | (get_option(OPTION_MOTION_ENABLED)<<4) | (get_option(OPTION_SATCHEL_ENABLED)<<5) | (get_option(OPTION_HOMING_ENABLED)<<6))
	}
	
	return 0
}

stock NadeType:FirstEnabledMode(NadeRace:race)
{
	if (is_mode_cvarenabled(g_firstenabledmode[race], race))
		return g_firstenabledmode[race]
	
	for (new NadeType:i=NADE_NORMAL;i<=NADE_HOMING;i++)
	{
		if (is_mode_cvarenabled(i, race))
		{
			g_firstenabledmode[race] = i
			return i
		}
	}
	
	return NADE_NORMAL
}

public is_mode_cvarenabled(NadeType:type, NadeRace:nade)
{
	switch (type)
	{
		case NADE_NORMAL:
		{
			return get_option(OPTION_NORMAL_ENABLED)
		}
		
		case NADE_PROXIMITY:
		{
			return get_option(OPTION_PROXIMITY_ENABLED)
		}
		
		case NADE_IMPACT:
		{
			return get_option(OPTION_IMPACT_ENABLED)
		}
		
		case NADE_TRIP:
		{
			return get_option(OPTION_TRIP_ENABLED)
		}
		
		case NADE_MOTION:
		{
			return get_option(OPTION_MOTION_ENABLED)
		}
		
		case NADE_SATCHEL:
		{
			return get_option(OPTION_SATCHEL_ENABLED)
		}
		
		case NADE_HOMING:
		{
			return get_option(OPTION_HOMING_ENABLED)
		}
	}
	
	return 0
}

public is_mode_enabled(id, NadeType:type, NadeRace:nade)
{
	switch (type)
	{
		case NADE_NORMAL:
		{
			return get_option(OPTION_NORMAL_ENABLED)
		}
		
		case NADE_PROXIMITY:
		{
			if (!get_option(OPTION_PROXIMITY_ENABLED))
				return 0
			
			if (!get_option(OPTION_LIMIT_SYSTEM))
				return 1
			
			if (!get_option(OPTION_LIMIT_PROXIMITY))
				return 1
			
			if (get_option(OPTION_LIMIT_SYSTEM) == 1 && cl_counter[id][nade][type] < get_option(OPTION_LIMIT_PROXIMITY))
				return 1
			
			if (get_option(OPTION_LIMIT_SYSTEM) == 2 && (cl_counter[id][GRENADE_EXPLOSIVE][type] + cl_counter[id][GRENADE_SMOKEGREN][type] + cl_counter[id][GRENADE_FLASHBANG][type]) < get_option(OPTION_LIMIT_PROXIMITY))
				return 1
			
			return 0
		}
		
		case NADE_IMPACT:
		{
			return get_option(OPTION_IMPACT_ENABLED)
		}
		
		case NADE_TRIP:
		{
			if (!get_option(OPTION_TRIP_ENABLED))
				return 0
			
			if (!get_option(OPTION_LIMIT_SYSTEM))
				return 1
			
			if (!get_option(OPTION_LIMIT_TRIP))
				return 1
			
			if (get_option(OPTION_LIMIT_SYSTEM) == 1 && cl_counter[id][nade][type] < get_option(OPTION_LIMIT_TRIP))
				return 1
			
			if (get_option(OPTION_LIMIT_SYSTEM) == 2 && (cl_counter[id][GRENADE_EXPLOSIVE][type] + cl_counter[id][GRENADE_SMOKEGREN][type] + cl_counter[id][GRENADE_FLASHBANG][type]) < get_option(OPTION_LIMIT_TRIP))
				return 1
			
			return 0
		}
		
		case NADE_MOTION:
		{
			if (!get_option(OPTION_MOTION_ENABLED))
				return 0
			
			if (!get_option(OPTION_LIMIT_SYSTEM))
				return 1
			
			if (!get_option(OPTION_LIMIT_MOTION))
				return 1
			
			if (get_option(OPTION_LIMIT_SYSTEM) == 1 && cl_counter[id][nade][type] < get_option(OPTION_LIMIT_MOTION))
				return 1
			
			if (get_option(OPTION_LIMIT_SYSTEM) == 2 && (cl_counter[id][GRENADE_EXPLOSIVE][type] + cl_counter[id][GRENADE_SMOKEGREN][type] + cl_counter[id][GRENADE_FLASHBANG][type]) < get_option(OPTION_LIMIT_MOTION))
				return 1
			
			return 0
		}
		
		case NADE_SATCHEL:
		{
			if (!get_option(OPTION_SATCHEL_ENABLED))
				return 0
			
			if (!get_option(OPTION_LIMIT_SYSTEM))
				return 1
			
			if (!get_option(OPTION_LIMIT_SATCHEL))
				return 1
			
			if (get_option(OPTION_LIMIT_SYSTEM) == 1 && cl_counter[id][nade][type] < get_option(OPTION_LIMIT_SATCHEL))
				return 1
			
			if (get_option(OPTION_LIMIT_SYSTEM) == 2 && (cl_counter[id][GRENADE_EXPLOSIVE][type] + cl_counter[id][GRENADE_SMOKEGREN][type] + cl_counter[id][GRENADE_FLASHBANG][type]) < get_option(OPTION_LIMIT_SATCHEL))
				return 1
			
			return 0
		}
		
		case NADE_HOMING:
		{
			return get_option(OPTION_HOMING_ENABLED)
		}
	}
	
	return 1
}

public get_enabled_modes(id, NadeRace:nade)
{
	for (new NadeType:type = NADE_NORMAL; type <= NADE_HOMING; type = type + NADE_PROXIMITY)
	{
		if 	(is_mode_enabled(id, type, nade))
			return 1
	}
	
	return 0;
}


public changemode(id, NadeRace:NADE_TYPE)
{
	if (!(grenade_can_be_used(NADE_TYPE)))
	{
		return
	}
	
	if (!is_mode_enabled(id, ++mode[id][NADE_TYPE], NADE_TYPE))
	{
		changemode(id, NADE_TYPE)
		return
	}
	
	switch (mode[id][NADE_TYPE])
	{
		case NADE_NORMAL:
		{
			client_print(id, print_center, "Mode - Normal")
		}
		
		case NADE_PROXIMITY:
		{
			client_print(id, print_center, "Mode - Proximity")
		}
		
		case NADE_IMPACT:
		{
			client_print(id, print_center, "Mode - Impact")
		}
		
		case NADE_TRIP:
		{
			client_print(id, print_center, "Mode - Trip laser")
		}
		
		case NADE_MOTION:
		{
			client_print(id, print_center, "Mode - Motion sensor")
		}
		
		case NADE_SATCHEL:
		{
			client_print(id, print_center, "Mode - Satchel charge")
		}
		
		case NADE_HOMING:
		{
			client_print(id, print_center, "Mode - Homing")
		}
		
		default:
		{
			mode[id][NADE_TYPE] = NADE_DUD
			changemode(id, NADE_TYPE)
		}
	}
}

resetCounter(id)
{
	cl_counter[id][GRENADE_EXPLOSIVE][NADE_MOTION] = 0
	cl_counter[id][GRENADE_EXPLOSIVE][NADE_PROXIMITY] = 0
	cl_counter[id][GRENADE_EXPLOSIVE][NADE_TRIP] = 0
	cl_counter[id][GRENADE_EXPLOSIVE][NADE_SATCHEL] = 0
	cl_counter[id][GRENADE_FLASHBANG][NADE_MOTION] = 0
	cl_counter[id][GRENADE_FLASHBANG][NADE_PROXIMITY] = 0
	cl_counter[id][GRENADE_FLASHBANG][NADE_TRIP] = 0
	cl_counter[id][GRENADE_FLASHBANG][NADE_SATCHEL] = 0
	cl_counter[id][GRENADE_SMOKEGREN][NADE_MOTION] = 0
	cl_counter[id][GRENADE_SMOKEGREN][NADE_PROXIMITY] = 0
	cl_counter[id][GRENADE_SMOKEGREN][NADE_TRIP] = 0
	cl_counter[id][GRENADE_SMOKEGREN][NADE_SATCHEL] = 0
	
	cl_can_use_nade[GRENADE_EXPLOSIVE] |= (1<<id)
	cl_can_use_nade[GRENADE_FLASHBANG] |= (1<<id)
	cl_can_use_nade[GRENADE_SMOKEGREN] |= (1<<id)
	
	return
}

removeNades(id)
{
	static ent
	ent = -1
	
	// Get all the grenade entities
	while ((ent = find_ent_by_class(ent, "grenade")))
	{
		if (entity_get_edict(ent, EV_ENT_owner) != id)
			continue
		
		// Set the remove property if they aren't normal nades
		if(is_grenade(ent) && get_grenade_type(ent) != NADE_NORMAL)
			entity_set_int(ent, EV_INT_flags , entity_get_int(ent, EV_INT_flags) | FL_KILLME)
	}	
	
	return
}

/* -------------------------------
[Usefull Functions -> Grenade Property Set/Get]
------------------------------- */
is_grenade(ent, bool:enforce = false)
{
	if (!is_valid_ent(ent))
	{
		return 0
	}
	
	if (enforce)
	{
		if (!is_classname(ent, "grenade"))
			return 0
	}
	
	if (is_grenade_c4(ent))
		return 0
	
	static weapon_id
	weapon_id = cs_get_weapon_id(ent)
	
	for (new i=0;i<3;i++)
	{
		if (weapon_id == NADE_WPID[NadeRace:i])
			return 1
	}
	
	return 0
}

is_classname(ent, const string[])
{
	new classname[20]
	
	entity_get_string(ent, EV_SZ_classname, classname, charsmax(classname))
	
	return equali(string, classname, strlen(string))
}

public get_grenade_race(grenade)
{
	switch (cs_get_weapon_id(grenade))
	{
		case CSW_HEGRENADE: 	return _:GRENADE_EXPLOSIVE
		case CSW_FLASHBANG: 	return _:GRENADE_FLASHBANG
		case CSW_SMOKEGRENADE: 	return _:GRENADE_SMOKEGREN
	}
	
	return -1
}

set_grenade_type(grenade, NadeType:g_type, bool:property = true)
{
	if (!is_valid_ent(grenade)) return
	
	static NadeRace:nade
	static owner
	
	owner = entity_get_edict(grenade, EV_ENT_owner)
	
	nade = NadeRace:get_grenade_race(grenade)
	
	if (g_FW_property > 0 && g_type != NADE_DUD)
	{
		new ret
		ExecuteForward(g_FW_property, ret, grenade, g_type)
		
		if (ret > PLUGIN_CONTINUE)
		{
			if (g_PFW_property > 0)
				ExecuteForward(g_PFW_property, ret, grenade, g_type, 1)
			
			return
		}
		
		if (g_PFW_property > 0)
			ExecuteForward(g_PFW_property, ret, grenade, g_type, 0)
	}
	
	// Set grenade properties and empty the slots so we can put some info
	entity_set_int(grenade, EV_INT_iuser1, _:g_type)
	entity_set_int(grenade, EV_INT_iuser2, 0)
	entity_set_int(grenade, EV_INT_iuser3, 0)
	entity_set_int(grenade, EV_INT_iuser4, 0)
	
	entity_set_vector(grenade, EV_VEC_vuser1, Float:{0.0, 0.0, 0.0})
	entity_set_vector(grenade, EV_VEC_vuser2, Float:{0.0, 0.0, 0.0})
	entity_set_vector(grenade, EV_VEC_vuser3, Float:{0.0, 0.0, 0.0})
	entity_set_vector(grenade, EV_VEC_vuser4, Float:{0.0, 0.0, 0.0})
	
	if (property == true)
	{
		switch (g_type)
		{
			case NADE_DUD:
			{
				entity_set_int(grenade, EV_INT_movetype, MOVETYPE_BOUNCE)
				entity_set_vector(grenade, EV_VEC_velocity, Float:{0.0, 0.0, 0.0})
			}
			
			case NADE_NORMAL:
			{
				entity_set_float(grenade, EV_FL_health, floatabs(get_option_float(OPTION_HITPOINT_NORMAL)))
				
				if (get_option(OPTION_MATERIAL_SYSTEM) == 2 && get_option(OPTION_HITPOINT_NORMAL))
				{
					entity_set_float(grenade, EV_FL_takedamage, DAMAGE_YES)
				}
			}
			
			case NADE_PROXIMITY:
			{
				delay_explosion(grenade)
				set_grenade_allow_explode(grenade, get_option_float(OPTION_ARM_TIME_PROXIMITY))
				
				entity_set_float(grenade, EV_FL_health, floatabs(get_option_float(OPTION_HITPOINT_PROXIMITY)))
				
				if (get_option(OPTION_MATERIAL_SYSTEM) == 2 && get_option(OPTION_HITPOINT_PROXIMITY))
				{
					entity_set_float(grenade, EV_FL_takedamage, DAMAGE_YES)
				}
				
				cl_counter[owner][nade][NADE_PROXIMITY] += 1
				
				refresh_can_use_nade(owner, GRENADE_EXPLOSIVE)
				refresh_can_use_nade(owner, GRENADE_FLASHBANG)
				refresh_can_use_nade(owner, GRENADE_SMOKEGREN)
			}
			
			case NADE_IMPACT:
			{
				delay_explosion(grenade)
				entity_set_int(grenade, EV_INT_movetype, MOVETYPE_BOUNCE)
				
				entity_set_float(grenade, EV_FL_health, floatabs(get_option_float(OPTION_HITPOINT_IMPACT)))
				
				if (get_option(OPTION_MATERIAL_SYSTEM) == 2 && get_option(OPTION_HITPOINT_IMPACT))
				{
					entity_set_float(grenade, EV_FL_takedamage, DAMAGE_YES)
				}
			}
			
			// I don't recommend setting a grenade to trip if it was another type in the first place.
			case NADE_TRIP:
			{
				delay_explosion(grenade)
				
				entity_set_float(grenade, EV_FL_health, floatabs(get_option_float(OPTION_HITPOINT_TRIP)))
				
				if (get_option(OPTION_MATERIAL_SYSTEM) == 2 && get_option(OPTION_HITPOINT_TRIP))
				{
					entity_set_float(grenade, EV_FL_takedamage, DAMAGE_YES)
				}
				
				cl_counter[owner][nade][NADE_TRIP] += 1
				
				refresh_can_use_nade(owner, GRENADE_EXPLOSIVE)
				refresh_can_use_nade(owner, GRENADE_FLASHBANG)
				refresh_can_use_nade(owner, GRENADE_SMOKEGREN)
			}
			
			case NADE_MOTION:
			{
				delay_explosion(grenade)
				set_grenade_allow_explode(grenade, get_option_float(OPTION_ARM_TIME_MOTION))
				
				entity_set_float(grenade, EV_FL_health, floatabs(get_option_float(OPTION_HITPOINT_MOTION)))
				
				if (get_option(OPTION_MATERIAL_SYSTEM) == 2 && get_option(OPTION_HITPOINT_MOTION))
				{
					entity_set_float(grenade, EV_FL_takedamage, DAMAGE_YES)
				}
				
				cl_counter[owner][nade][NADE_MOTION] += 1
				
				refresh_can_use_nade(owner, GRENADE_EXPLOSIVE)
				refresh_can_use_nade(owner, GRENADE_FLASHBANG)
				refresh_can_use_nade(owner, GRENADE_SMOKEGREN)
			}
			
			case NADE_SATCHEL:
			{
				delay_explosion(grenade)
				set_grenade_allow_explode(grenade,  get_option_float(OPTION_ARM_TIME_SATCHEL))
				
				entity_set_float(grenade, EV_FL_health, floatabs(get_option_float(OPTION_HITPOINT_SATCHEL)))
				
				if (get_option(OPTION_MATERIAL_SYSTEM) == 2 && get_option(OPTION_HITPOINT_SATCHEL))
				{
					entity_set_float(grenade, EV_FL_takedamage, DAMAGE_YES)
				}
				
				cl_counter[owner][nade][NADE_SATCHEL] += 1
				
				refresh_can_use_nade(owner, GRENADE_EXPLOSIVE)
				refresh_can_use_nade(owner, GRENADE_FLASHBANG)
				refresh_can_use_nade(owner, GRENADE_SMOKEGREN)
			}
			
			case NADE_HOMING:
			{
				entity_set_float(grenade, EV_FL_dmgtime, entity_get_float(grenade, EV_FL_dmgtime) + get_option_float(OPTION_HOMING_EXTRATIME))
				
				entity_set_float(grenade, EV_FL_health, floatabs(get_option_float(OPTION_HITPOINT_HOMING)))
				
				if (get_option(OPTION_MATERIAL_SYSTEM) == 2 && get_option(OPTION_HITPOINT_HOMING))
				{
					entity_set_float(grenade, EV_FL_takedamage, DAMAGE_YES)
				}
			}
		}
	}
}



public get_trip_grenade_react_method(grenade)
{
	new NadeRace:grenade_race = NadeRace:get_grenade_race(grenade)
	
	switch (grenade_race)
	{
		case GRENADE_EXPLOSIVE: return get_option(OPTION_REACT_TRIP_G)
		case GRENADE_FLASHBANG: return get_option(OPTION_REACT_TRIP_F)
		case GRENADE_SMOKEGREN: return get_option(OPTION_REACT_TRIP_S)
	}
	
	return -1
}

/* -------------------------------
[Usefull Functions -> Surface and solid tests + line of sight]
------------------------------- */
public bool:is_ent_monster(ent)
{
	if (!pev_valid(ent))
		return false
	
	if (!is_classname(ent, "func_wall"))
		return false
	
	return !!(pev(ent, pev_flags) & FL_MONSTER)
}

public bool:is_solid(ent)
{
	// Here we account for ent = 0, where 0 means it's part of the map (and therefore is solid)
	return ( ent ? ( (entity_get_int(ent, EV_INT_solid) > SOLID_TRIGGER) ? true : false ) : true )
}

public bool:is_attachable_surface(entity)
{
	static Float:velocity[3]
	
	if (is_valid_ent(entity))
	{
		if (!is_solid(entity)) return false 									// This is for func_breakables. The entity technically exists, but isn't solid.
		entity_get_vector(entity, EV_VEC_velocity, velocity) 					// This is for func_doors. The grenade touches the door, causing it to move.
		return (xs_vec_equal(velocity, Float:{0.0, 0.0, 0.0}) ? true : false)
	}
	
	return true
}

public bool:is_in_los(grenade_ent, player)
{
	static Float:start[3], Float:end[3]
	entity_get_vector(grenade_ent, EV_VEC_origin, start)
	entity_get_vector(player, EV_VEC_origin, end)
	
	start[2] += 2.0
	
	engfunc(EngFunc_TraceLine, start, end, IGNORE_MONSTERS, grenade_ent, g_ptrace[TH_LOS])
	
	static Float:dist
	get_tr2(g_ptrace[TH_LOS], TR_flFraction, dist)
	
	return ((dist == 1.0) ? true : false)
}


// This function is limited, it returns the same values unter CONE_CALC_DISTANCE_MAX 
stock Float:calc_cone_angle_from_distance(Float:distance)
{
	// The angle is calculated from a formula that looks like this
	// angle = atan(A*(CONE_BASE_RADIUS/(distance-B)))
	static Float:A,Float:B;

	// The constants A and B need to be calculated first, this if will only happen once
	if (A == 0.0 && B == 0.0)
	{
		if (CONE_BASE_RADIUS == 0.0)
		{
			A = ((CONE_CALC_DISTANCE_MIN-CONE_CALC_DISTANCE_MAX)*floattan(CONE_CALC_ANGLE_MAX, degrees)*floattan(CONE_CALC_ANGLE_MIN, degrees))/(floattan(CONE_CALC_ANGLE_MAX, degrees)-floattan(CONE_CALC_ANGLE_MIN, degrees))
			B = (CONE_CALC_DISTANCE_MAX*floattan(CONE_CALC_ANGLE_MAX, degrees) - CONE_CALC_DISTANCE_MIN*floattan(CONE_CALC_ANGLE_MIN, degrees))/(floattan(CONE_CALC_ANGLE_MAX, degrees)-floattan(CONE_CALC_ANGLE_MIN, degrees))
		}
		else
		{
			A = CONE_BASE_RADIUS;
			B = CONE_CALC_DISTANCE_MAX - CONE_BASE_RADIUS/floattan(CONE_CALC_ANGLE_MAX, degrees)
		}
	}
	
	// Return the angle in radians that is checked
	return (distance < CONE_CALC_DISTANCE_MAX) ? floatatan(A/((CONE_CALC_DISTANCE_MIN)-B), radian) : floatatan(A/((distance)-B), radian)
}

public insert_in_queue(id, ent_id)
{
	for (new i=0;i<SHOT_ENTITY_QUEUE_LENGTH;i++)
	{
		if (cl_entity_queue[id][i] == 0)
		{
			cl_entity_queue[id][i] = ent_id
			break;
		}
		
		if (i == SHOT_ENTITY_QUEUE_LENGTH - 1)
		{
			server_print("[NDM] Error! Unable to save so much entities!")
			server_print("[NDM] Increase the value of the ^"SHOT_ENTITY_QUEUE_LENGTH^" define and recompile!")
			log_amx("[NDM] Error! Unable to save so much entities")
			log_amx("[NDM] Increase the value of the ^"SHOT_ENTITY_QUEUE_LENGTH^" define and recompile!")
		}
	}
}
/* -------------------------------
[Message Functions]
------------------------------- */
draw_line_from_entity(entid, Float:end[3], staytime, R = NOTEAM_RGB_R_COLOR, G = NOTEAM_RGB_G_COLOR, B = NOTEAM_RGB_B_COLOR, id = 0, Float:pvs[3] = {0.0, 0.0, 0.0})
{
	( id == 0 ) ? engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, pvs, 0) : engfunc(EngFunc_MessageBegin, get_option(OPTION_MSG_SVC_BAD) ? MSG_ONE : MSG_ONE_UNRELIABLE, SVC_TEMPENTITY, pvs, id)
	write_byte(TE_BEAMENTPOINT)
	write_short(entid)	// start entity
	engfunc(EngFunc_WriteCoord, end[0])
	engfunc(EngFunc_WriteCoord, end[1])
	engfunc(EngFunc_WriteCoord, end[2])
	write_short(beampoint)
	write_byte(0)
	write_byte(0)
	write_byte(staytime)
	write_byte(10)
	write_byte(0)
	write_byte(R)
	write_byte(G)
	write_byte(B)
	write_byte(127)
	write_byte(1)
	message_end()	
}

stock draw_line(Float:start[3], Float:end[3], staytime, R = NOTEAM_RGB_R_COLOR, G = NOTEAM_RGB_G_COLOR, B = NOTEAM_RGB_B_COLOR)
{
	engfunc(EngFunc_MessageBegin, MSG_ALL, SVC_TEMPENTITY, Float:{0.0,0.0,0.0}, 0)
	write_byte(TE_BEAMPOINTS)
	engfunc(EngFunc_WriteCoord, start[0])
	engfunc(EngFunc_WriteCoord, start[1])
	engfunc(EngFunc_WriteCoord, start[2])
	engfunc(EngFunc_WriteCoord, end[0])
	engfunc(EngFunc_WriteCoord, end[1])
	engfunc(EngFunc_WriteCoord, end[2])
	write_short(beampoint)
	write_byte(0)
	write_byte(0)
	write_byte(staytime)
	write_byte(10)
	write_byte(0)
	write_byte(R)
	write_byte(G)
	write_byte(B)
	write_byte(127)
	write_byte(1)
	message_end()	
}

draw_line_from_entity_broadcast(entid, Float:end[3], staytime, R = NOTEAM_RGB_R_COLOR, G = NOTEAM_RGB_G_COLOR, B = NOTEAM_RGB_B_COLOR)
{
	engfunc(EngFunc_MessageBegin, get_option(OPTION_MSG_SVC_BAD) ? MSG_ALL : MSG_BROADCAST, SVC_TEMPENTITY, {0.0, 0.0, 0.0}, 0)
	write_byte(TE_BEAMENTPOINT)
	write_short(entid)	// start entity
	engfunc(EngFunc_WriteCoord, end[0])
	engfunc(EngFunc_WriteCoord, end[1])
	engfunc(EngFunc_WriteCoord, end[2])
	write_short(beampoint)
	write_byte(0)
	write_byte(0)
	write_byte(staytime)
	write_byte(10)
	write_byte(0)
	write_byte(R)
	write_byte(G)
	write_byte(B)
	write_byte(127)
	write_byte(1)
	message_end()	
}

clear_line(entid)
{
	message_begin(MSG_ALL, SVC_TEMPENTITY)
	write_byte(TE_KILLBEAM)
	write_short(entid)
	message_end()
}

show_ring(Float:origin[3], Float:addict, staytime, R = NOTEAM_RGB_R_COLOR, G = NOTEAM_RGB_G_COLOR, B = NOTEAM_RGB_B_COLOR , id = 0)
{
	( id == 0 ) ? engfunc(EngFunc_MessageBegin, get_option(OPTION_MSG_SVC_BAD) ? MSG_ALL : MSG_BROADCAST, SVC_TEMPENTITY, {0.0, 0.0, 0.0}, 0) : engfunc(EngFunc_MessageBegin, get_option(OPTION_MSG_SVC_BAD) ? MSG_ONE : MSG_ONE_UNRELIABLE , SVC_TEMPENTITY, {0.0, 0.0, 0.0}, id)
	write_byte(TE_BEAMCYLINDER)										 			 // TE_BEAMCYLINDER
	engfunc(EngFunc_WriteCoord, origin[0])										 // start X
	engfunc(EngFunc_WriteCoord, origin[1])										 // start Y
	engfunc(EngFunc_WriteCoord, origin[2])										 // start Z
	engfunc(EngFunc_WriteCoord, origin[0])										 // something X
	engfunc(EngFunc_WriteCoord, origin[1])										 // something Y
	engfunc(EngFunc_WriteCoord, origin[2] + addict)								 // something Z
	write_short(shockwave) 														 // sprite
	write_byte(0) 																 // startframe
	write_byte(0) 																 // framerate
	write_byte(staytime) 														 // life
	write_byte(60) 																 // width
	write_byte(0) 																 // noise
	write_byte(R) 																 // red
	write_byte(G) 																 // green
	write_byte(B) 																 // blue
	write_byte(100) 															 // brightness
	write_byte(0)																 // speed
	message_end()
}

metal_gibs(const Float: origin[3])
{
	message_begin(get_option(OPTION_MSG_SVC_BAD) ? MSG_ALL : MSG_BROADCAST, SVC_TEMPENTITY, {0, 0, 0}, 0)
	write_byte(TE_BREAKMODEL)									 				 // TE_BREAKMODEL
	engfunc(EngFunc_WriteCoord,origin[0])						 				 // x
	engfunc(EngFunc_WriteCoord,origin[1])						 				 // y
	engfunc(EngFunc_WriteCoord,origin[2] + 24)					 				 // z
	engfunc(EngFunc_WriteCoord,20.0)											 // size x
	engfunc(EngFunc_WriteCoord,20.0)							 				 // size y
	engfunc(EngFunc_WriteCoord,20.0)											 // size z
	engfunc(EngFunc_WriteCoord,random_num(-50,50))				 				 // velocity x
	engfunc(EngFunc_WriteCoord,random_num(-50,50))								 // velocity y
	engfunc(EngFunc_WriteCoord,25.0)							 				 // velocity z
	write_byte(10)																 // random velocity
	write_short(nadebits) 										 				 // model
	write_byte(10) 												 				 // count
	write_byte(25) 																 // life
	write_byte(2)												 				 // flags: BREAK_METAL
	message_end()
}
players_models.sma

Code: Select all

/*	Formatright © 2009, ConnorMcLeod

	Players Models is free software;
	you can redistribute it and/or modify it under the terms of the
	GNU General Public License as published by the Free Software Foundation.

	This program is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
	GNU General Public License for more details.

	You should have received a copy of the GNU General Public License
	along with Players Models; if not, write to the
	Free Software Foundation, Inc., 59 Temple Place - Suite 330,
	Boston, MA 02111-1307, USA.
*/

// #define SET_MODELINDEX

#include <amxmodx>
#include <fakemeta>

#define VERSION "1.3.1"

#define SetUserModeled(%1)		g_bModeled |= 1<<(%1 & 31)
#define SetUserNotModeled(%1)		g_bModeled &= ~( 1<<(%1 & 31) )
#define IsUserModeled(%1)		( g_bModeled &  1<<(%1 & 31) )

#define SetUserConnected(%1)		g_bConnected |= 1<<(%1 & 31)
#define SetUserNotConnected(%1)		g_bConnected &= ~( 1<<(%1 & 31) )
#define IsUserConnected(%1)		( g_bConnected &  1<<(%1 & 31) )

#define MAX_MODEL_LENGTH	16
#define MAX_AUTHID_LENGTH 25

#define MAX_PLAYERS	32

#define ClCorpse_ModelName 1
#define ClCorpse_PlayerID 12

#define m_iTeam 114
#define g_ulModelIndexPlayer 491
#define fm_cs_get_user_team_index(%1)	get_pdata_int(%1, m_iTeam)

new const MODEL[] = "model";
new g_bModeled;
new g_szCurrentModel[MAX_PLAYERS+1][MAX_MODEL_LENGTH];

new Trie:g_tTeamModels[2];
new Trie:g_tModelIndexes;
new Trie:g_tDefaultModels;

new g_szAuthid[MAX_PLAYERS+1][MAX_AUTHID_LENGTH];
new g_bPersonalModel[MAX_PLAYERS+1];

new g_bConnected;

public plugin_init()
{
	register_plugin("Players Models", VERSION, "ConnorMcLeod");

	register_forward(FM_SetClientKeyValue, "SetClientKeyValue");
	register_message(get_user_msgid("ClCorpse"), "Message_ClCorpse");
}

public plugin_precache()
{
	new szConfigFile[128];
	get_localinfo("amxx_configsdir", szConfigFile, charsmax(szConfigFile));
	format(szConfigFile, charsmax(szConfigFile), "%s/players_models.ini", szConfigFile);

	new iFile = fopen(szConfigFile, "rt");
	if( iFile )
	{
		new const szDefaultModels[][] = {"", "urban", "terror", "leet", "arctic", "gsg9", 
					"gign", "sas", "guerilla", "vip", "militia", "spetsnaz" };
		g_tDefaultModels = TrieCreate();
		for(new i=1; i<sizeof(szDefaultModels); i++)
		{
			TrieSetCell(g_tDefaultModels, szDefaultModels[i], i);
		}

		g_tModelIndexes = TrieCreate();

		g_tTeamModels[0] = TrieCreate();
		g_tTeamModels[1] = TrieCreate();

		new szDatas[70], szRest[40], szKey[MAX_AUTHID_LENGTH], szModel1[MAX_MODEL_LENGTH], szModel2[MAX_MODEL_LENGTH];
		while( !feof(iFile) )
		{
			fgets(iFile, szDatas, charsmax(szDatas));
			trim(szDatas);
			if(!szDatas[0] || szDatas[0] == ';' || szDatas[0] == '#' || (szDatas[0] == '/' && szDatas[1] == '/'))
			{
				continue;
			}

			parse(szDatas, szKey, charsmax(szKey), szModel1, charsmax(szModel1), szModel2, charsmax(szModel2));

			if( TrieKeyExists(g_tDefaultModels, szKey) )
			{
				if( szModel1[0] && !equal(szModel1, szKey) && PrecachePlayerModel(szModel1) )
				{
					TrieSetString(g_tDefaultModels, szKey, szModel1);
				}
			}
			else if( equal(szKey, "STEAM_", 6) || equal(szKey, "BOT") )
			{
				parse(szRest, szModel1, charsmax(szModel1), szModel2, charsmax(szModel2));
				if( szModel1[0] && PrecachePlayerModel(szModel1) )
				{
					TrieSetString(g_tTeamModels[1], szKey, szModel1);
				}
				if( szModel2[0] && PrecachePlayerModel(szModel2) )
				{
					TrieSetString(g_tTeamModels[0], szKey, szModel2);
				}
			}
		}
		fclose( iFile );
	}
}

PrecachePlayerModel( const szModel[] )
{
	if( TrieKeyExists(g_tModelIndexes, szModel) )
	{
		return 1;
	}

	new szFileToPrecache[64];
	formatex(szFileToPrecache, charsmax(szFileToPrecache), "models/player/%s/%s.mdl", szModel, szModel);
	if( !file_exists( szFileToPrecache ) && !TrieKeyExists(g_tDefaultModels, szModel) )
	{
		return 0;
	}

	TrieSetCell(g_tModelIndexes, szModel, precache_model(szFileToPrecache));

	formatex(szFileToPrecache, charsmax(szFileToPrecache), "models/player/%s/%st.mdl", szModel, szModel);
	if( file_exists( szFileToPrecache ) )
	{
		precache_model(szFileToPrecache);
		return 1;
	}
	formatex(szFileToPrecache, charsmax(szFileToPrecache), "models/player/%s/%sT.mdl", szModel, szModel);
	if( file_exists( szFileToPrecache ) )
	{
		precache_model(szFileToPrecache);
		return 1;
	}

	return 1;
}

public plugin_end()
{
	TrieDestroy(g_tTeamModels[0]);
	TrieDestroy(g_tTeamModels[1]);
	TrieDestroy(g_tModelIndexes);
	TrieDestroy(g_tDefaultModels);
}

public client_authorized( id )
{
	get_user_authid(id, g_szAuthid[id], MAX_AUTHID_LENGTH-1);

	for(new i=1; i<=2; i++)
	{
		if( TrieKeyExists(g_tTeamModels[2-i], g_szAuthid[id]) )
		{
			g_bPersonalModel[id] |= i;
		}
		else
		{
			g_bPersonalModel[id] &= ~i;
		}
	}
}

public client_putinserver(id)
{
	if( !is_user_hltv(id) )
	{
		SetUserConnected(id);
	}
}

public client_disconnect(id)
{
	g_bPersonalModel[id] = 0;
	SetUserNotModeled(id);
	SetUserNotConnected(id);
}

public SetClientKeyValue(id, const szInfoBuffer[], const szKey[], const szValue[])
{
	if( equal(szKey, MODEL) && IsUserConnected(id) )
	{
		new iTeam = fm_cs_get_user_team_index(id);
		if( 1 <= iTeam <= 3 )
		{
			new szSupposedModel[MAX_MODEL_LENGTH];

			if( g_bPersonalModel[id] & iTeam )
			{
				TrieGetString(g_tTeamModels[2-iTeam], g_szAuthid[id], szSupposedModel, charsmax(szSupposedModel));
			}
			else
			{
				TrieGetString(g_tDefaultModels, szValue, szSupposedModel, charsmax(szSupposedModel));
			}

			if( szSupposedModel[0] )
			{
				if(	!IsUserModeled(id)
				||	!equal(g_szCurrentModel[id], szSupposedModel)
				||	!equal(szValue, szSupposedModel)	)
				{
					copy(g_szCurrentModel[id], MAX_MODEL_LENGTH-1, szSupposedModel);
					SetUserModeled(id);
					set_user_info(id, MODEL, szSupposedModel);
				#if defined SET_MODELINDEX
					new iModelIndex;
					TrieGetCell(g_tModelIndexes, szSupposedModel, iModelIndex);
				//	set_pev(id, pev_modelindex, iModelIndex); // is this needed ?
					set_pdata_int(id, g_ulModelIndexPlayer, iModelIndex);
				#endif
					return FMRES_SUPERCEDE;
				}
			}

			if( IsUserModeled(id) )
			{
				SetUserNotModeled(id);
				g_szCurrentModel[id][0] = 0;
			}
		}
	}
	return FMRES_IGNORED;
}

public Message_ClCorpse()
{
	new id = get_msg_arg_int(ClCorpse_PlayerID);
	if( IsUserModeled(id) )
	{
		set_msg_arg_string(ClCorpse_ModelName, g_szCurrentModel[id]);
	}
}
team_join.sma

Code: Select all

#include <amxmodx>

enum
{
	TEAM_NONE = 0,
	TEAM_T,
	TEAM_CT,
	TEAM_SPEC,
	
	MAX_TEAMS
};
new const g_cTeamChars[MAX_TEAMS] =
{
	'U',
	'T',
	'C',
	'S'
};
new const g_sTeamNums[MAX_TEAMS][] =
{
	"0",
	"1",
	"2",
	"3"
};
new const g_sClassNums[MAX_TEAMS][] =
{
	"1",
	"2",
	"3",
	"4"
};

// Old Style Menus
stock const FIRST_JOIN_MSG[] =		"#Team_Select";
stock const FIRST_JOIN_MSG_SPEC[] =	"#Team_Select_Spect";
stock const INGAME_JOIN_MSG[] =		"#IG_Team_Select";
stock const INGAME_JOIN_MSG_SPEC[] =	"#IG_Team_Select_Spect";
const iMaxLen = sizeof(INGAME_JOIN_MSG_SPEC);

// New VGUI Menus
stock const VGUI_JOIN_TEAM_NUM =		2;

new g_iTeam[33];
new g_iPlayers[MAX_TEAMS];

new tjm_join_team;
new tjm_switch_team;
new tjm_class[MAX_TEAMS];
new tjm_block_change;

public plugin_init()
{
	register_plugin("Team Join Management", "0.3", "Exolent");
	register_event("TeamInfo", "event_TeamInfo", "a");
	register_message(get_user_msgid("ShowMenu"), "message_ShowMenu");
	register_message(get_user_msgid("VGUIMenu"), "message_VGUIMenu");
	tjm_join_team = register_cvar("tjm_join_team", "1");
	tjm_switch_team = register_cvar("tjm_switch_team", "1");
	tjm_class[TEAM_T] = register_cvar("tjm_class_t", "2");
	tjm_class[TEAM_CT] = register_cvar("tjm_class_ct", "4");
	tjm_block_change = register_cvar("tjm_block_change", "1");
}

public plugin_cfg()
{
	set_cvar_num("mp_limitteams", 32);
	set_cvar_num("sv_restart", 1);
}

public client_disconnect(id)
{
	remove_task(id);
}

public event_TeamInfo()
{
	new id = read_data(1);
	new sTeam[32], iTeam;
	read_data(2, sTeam, sizeof(sTeam) - 1);
	for(new i = 0; i < MAX_TEAMS; i++)
	{
		if(g_cTeamChars[i] == sTeam[0])
		{
			iTeam = i;
			break;
		}
	}
	
	if(g_iTeam[id] != iTeam)
	{
		g_iPlayers[g_iTeam[id]]--;
		g_iTeam[id] = iTeam;
		g_iPlayers[iTeam]++;
	}
}

public message_ShowMenu(iMsgid, iDest, id)
{
	static sMenuCode[iMaxLen];
	get_msg_arg_string(4, sMenuCode, sizeof(sMenuCode) - 1);
	if(equal(sMenuCode, FIRST_JOIN_MSG) || equal(sMenuCode, FIRST_JOIN_MSG_SPEC))
	{
		if(should_autojoin(id))
		{
			set_autojoin_task(id, iMsgid);
			return PLUGIN_HANDLED;
		}
	}
	else if(equal(sMenuCode, INGAME_JOIN_MSG) || equal(sMenuCode, INGAME_JOIN_MSG_SPEC))
	{
		if(should_autoswitch(id))
		{
			set_autoswitch_task(id, iMsgid);
			return PLUGIN_HANDLED;
		}
		else if(get_pcvar_num(tjm_block_change))
		{
			return PLUGIN_HANDLED;
		}
	}
	return PLUGIN_CONTINUE;
}

public message_VGUIMenu(iMsgid, iDest, id)
{
	if(get_msg_arg_int(1) != VGUI_JOIN_TEAM_NUM)
	{
		return PLUGIN_CONTINUE;
	}
	
	if(should_autojoin(id))
	{
		set_autojoin_task(id, iMsgid);
		return PLUGIN_HANDLED;
	}
	else if(should_autoswitch(id))
	{
		set_autoswitch_task(id, iMsgid);
		return PLUGIN_HANDLED;
	}
	else if((TEAM_NONE < g_iTeam[id] < TEAM_SPEC) && get_pcvar_num(tjm_block_change))
	{
		return PLUGIN_HANDLED;
	}
	return PLUGIN_CONTINUE;
}

public task_Autojoin(iParam[], id)
{
	new iTeam = get_new_team(get_pcvar_num(tjm_join_team));
	if(iTeam != -1)
	{
		handle_join(id, iParam[0], iTeam);
	}
}

public task_Autoswitch(iParam[], id)
{
	new iTeam = get_switch_team(id);
	if(iTeam != -1)
	{
		handle_join(id, iParam[0], iTeam);
	}
}

stock handle_join(id, iMsgid, iTeam)
{
	new iMsgBlock = get_msg_block(iMsgid);
	set_msg_block(iMsgid, BLOCK_SET);
	
	engclient_cmd(id, "jointeam", g_sTeamNums[iTeam]);
	
	new iClass = get_team_class(iTeam);
	if(1 <= iClass <= 4)
	{
		engclient_cmd(id, "joinclass", g_sClassNums[iClass - 1]);
	}
	set_msg_block(iMsgid, iMsgBlock);
}

stock get_new_team(iCvar)
{
	switch(iCvar)
	{
		case 1:
		{
			return TEAM_T;
		}
		case 2:
		{
			return TEAM_CT;
		}
		case 3:
		{
			return TEAM_SPEC;
		}
		case 4:
		{
			new iTCount = g_iPlayers[TEAM_T];
			new iCTCount = g_iPlayers[TEAM_CT];
			if(iTCount < iCTCount)
			{
				return TEAM_T;
			}
			else if(iTCount > iCTCount)
			{
				return TEAM_CT;
			}
			else
			{
				return random_num(TEAM_T, TEAM_CT);
			}
		}
	}
	return -1;
}

stock get_switch_team(id)
{
	new iTeam;
	
	new iTCount = g_iPlayers[TEAM_T];
	new iCTCount = g_iPlayers[TEAM_CT];
	switch(g_iTeam[id])
	{
		case TEAM_T: iTCount--;
		case TEAM_CT: iCTCount--;
	}
	if(iTCount < iCTCount)
	{
		iTeam = TEAM_T;
	}
	else if(iTCount > iCTCount)
	{
		iTeam = TEAM_CT;
	}
	else
	{
		iTeam = random_num(TEAM_T, TEAM_CT);
	}
	
	if(iTeam != g_iTeam[id])
	{
		return iTeam;
	}
	
	return -1;
}

stock get_team_class(iTeam)
{
	new iClass;
	if(TEAM_NONE < iTeam < TEAM_SPEC)
	{
		iClass = get_pcvar_num(tjm_class[iTeam]);
		if(iClass < 1 || iClass > 4)
		{
			iClass = random_num(1, 4);
		}
	}
	return iClass;
}

stock set_autojoin_task(id, iMsgid)
{
	new iParam[2];
	iParam[0] = iMsgid;
	set_task(0.1, "task_Autojoin", id, iParam, sizeof(iParam));
}

stock set_autoswitch_task(id, iMsgid)
{
	new iParam[2];
	iParam[0] = iMsgid;
	set_task(0.1, "task_Autoswitch", id, iParam, sizeof(iParam));
}

stock bool:should_autojoin(id)
{
	return ((5 > get_pcvar_num(tjm_join_team) > 0) && is_user_connected(id) && !(TEAM_NONE < g_iTeam[id] < TEAM_SPEC) && !task_exists(id));
}

stock bool:should_autoswitch(id)
{
	return (get_pcvar_num(tjm_switch_team) && is_user_connected(id) && (TEAM_NONE < g_iTeam[id] < TEAM_SPEC) && !task_exists(id));
}
team_semiclip.sma

Code: Select all

#include <amxmodx>
#include <fakemeta>

#pragma semicolon 1

#define DISTANCE 120.0
#define UPDATE_FREQ 0.2

new bool:g_bSemiclip[33][33];
new bool:g_bHasSemiclip[33];
new bool:g_bSemiclipEnabled;

new g_iTaskId;
new g_iForwardId[3];
new g_iMaxPlayers;
new g_iCvar[3];

public plugin_init( )
{
	register_plugin( "(Team-)Semiclip", "1.0", "SchlumPF*" );
	
	g_iCvar[0] = register_cvar( "semiclip_enabled", "1" );
	g_iCvar[1] = register_cvar( "semiclip_teamclip", "1" );
	g_iCvar[2] = register_cvar( "semiclip_transparancy", "0" );
	
	register_forward( FM_Think, "fwdThink" );
	register_forward( FM_ClientCommand, "fwdClientCommand" );
	
	if( get_pcvar_num( g_iCvar[0] ) )
	{
		g_iForwardId[0] = register_forward( FM_PlayerPreThink, "fwdPlayerPreThink" );
		g_iForwardId[1] = register_forward( FM_PlayerPostThink, "fwdPlayerPostThink" );
		g_iForwardId[2] = register_forward( FM_AddToFullPack, "fwdAddToFullPack_Post", 1 );
		
		g_bSemiclipEnabled = true;
	}
	else
		g_bSemiclipEnabled = false;
	
	g_iMaxPlayers = get_maxplayers( );
	
	new ent = engfunc( EngFunc_CreateNamedEntity, engfunc( EngFunc_AllocString, "info_target" ) );
	set_pev( ent, pev_classname, "task_semiclip" );
	set_pev( ent, pev_nextthink, get_gametime( ) + 1.01 );
	g_iTaskId = ent;
}

public fwdPlayerPreThink( plr )
{
	static id;
	
	if( is_user_alive( plr ) )
	{
		for( id = 1 ; id <= g_iMaxPlayers ; id++ )
		{
			if( pev( id, pev_solid ) == SOLID_SLIDEBOX && g_bSemiclip[plr][id] && id != plr )
			{
				set_pev( id, pev_solid, SOLID_NOT );
				g_bHasSemiclip[id] = true;
			}
		}
	}
}

public fwdPlayerPostThink( plr )
{
	static id;

	if( is_user_alive( plr ) )
	{
		for( id = 1 ; id <= g_iMaxPlayers ; id++ )
		{
			if( g_bHasSemiclip[id] )
			{
				set_pev( id, pev_solid, SOLID_SLIDEBOX );
				g_bHasSemiclip[id] = false;
			}
		}
	}
}

public fwdThink( ent )
{
	static i, j;
	static team[33];
	static Float:origin[33][3];
	
	if( ent == g_iTaskId )
	{
		if( get_pcvar_num( g_iCvar[0] ) )
		{
			for( i = 1 ; i <= g_iMaxPlayers ; i++ )
			{
				if( is_user_alive( i ) )
				{
					pev( i, pev_origin, origin[i] );
						
					if( get_pcvar_num( g_iCvar[1] ) )
						team[i] = get_user_team( i );
					
					for( j = 1 ; j <= g_iMaxPlayers ; j++ )
					{
						if( is_user_alive( j ) )
						{
							if( get_pcvar_num( g_iCvar[1] ) && team[i] != team[j] )
							{
								g_bSemiclip[i][j] = false;
								g_bSemiclip[j][i] = false;
								
							}	
							else if( floatabs( origin[i][0] - origin[j][0] ) < DISTANCE && floatabs( origin[i][1] - origin[j][1] ) < DISTANCE && floatabs( origin[i][2] - origin[j][2] ) < ( DISTANCE * 2 ) )
							{
								g_bSemiclip[i][j] = true;
								g_bSemiclip[j][i] = true;
							}
							else
							{
								g_bSemiclip[i][j] = false;
								g_bSemiclip[j][i] = false;
							}
						}
					}
				}
			}
		}
		
		set_pev( ent, pev_nextthink, get_gametime( ) + UPDATE_FREQ );
	}
}

public fwdAddToFullPack_Post( es_handle, e, ent, host, hostflags, player, pset )
{
	if( player )
	{
		if( g_bSemiclip[host][ent] )
		{
			set_es( es_handle, ES_Solid, SOLID_NOT ); // makes semiclip flawless
			
			if( get_pcvar_num( g_iCvar[2] ) == 1 )
			{
				set_es( es_handle, ES_RenderMode, kRenderTransAlpha );
				set_es( es_handle, ES_RenderAmt, 85 );
			}
			else if( get_pcvar_num( g_iCvar[2] ) == 2 )
			{
				set_es( es_handle, ES_Effects, EF_NODRAW );
				set_es( es_handle, ES_Solid, SOLID_NOT );
			}
		}
	}
}

// is there a better way to detect changings of g_iCvar[0]?
public fwdClientCommand( plr )
{
	// use the forwards just when needed, for good performance
	if( !get_pcvar_num( g_iCvar[0] ) && g_bSemiclipEnabled )
	{
		unregister_forward( FM_PlayerPreThink, g_iForwardId[0] );
		unregister_forward( FM_PlayerPostThink, g_iForwardId[1] );
		unregister_forward( FM_AddToFullPack, g_iForwardId[2], 1 );
		
		g_bSemiclipEnabled = false;
	}
	else if( get_pcvar_num( g_iCvar[0] ) && !g_bSemiclipEnabled )
	{
		g_iForwardId[0] = register_forward( FM_PlayerPreThink, "fwdPlayerPreThink" );
		g_iForwardId[1] = register_forward( FM_PlayerPostThink, "fwdPlayerPostThink" );
		g_iForwardId[2] = register_forward( FM_AddToFullPack, "fwdAddToFullPack_Post", 1 );
		
		g_bSemiclipEnabled = true;
	}
}
Image
User avatar
Rainq
Fost administrator
Fost administrator
Posts: 381
Joined: Mon Jan 18, 2021 7:25 am
Status: Citesc forumul TheXForce.RO...!
Detinator Steam: Da
SteamID: mrainq
Gaming experience: Nu spun..
Reputatie: Fost administrator
Nume anterior: Light
Fost detinator zm.thexforce.ro
Fost detinator dr.thexforce.ro
Location: Bucureşti
Has thanked: 2 times
Been thanked: 1 time
Contact:

Re: [MOD] Furien Mod Ultimate by Askhanar

Post by Rainq »

  • Pack-ul contine urmatoarele plugin-uri:
    • Activitate Admini
      Advanced Eliminate
      Advanced Hud Info
      Advanced Protocol Manager
      Advanced Slap & Slay Team
      Advanced SS
      Amx Exec
      AntiDeveloper
      BB Builders Races
      BB Levels
      Block Chat
      ChangeTeams
      Fast Spectate
      FCS Christmass Gifts
      Flares
      FMU Aim Messages
      FMU BombEvents
      FMU HeartBeat
      FMU Weapons
      FPS Shower
      Freezetime Controller
      Furien AntiCamp
      Furien Invasion
      Furien Score&Round
      Furien TeamSwap
      Furien Time Rewards
      Furien Credits System
      • Furien Credits System_main
        FCS Bomb Events
        FCS Played Time Rewards
        FCS Shop
        FCS Transfer System
        FCS WinTeam Rewards
        Furien Credits System_AIO

      GameTracker Played Time
      Hns Jail Jump
      HNST/KZ Jetpack
      Kage vs Psycho
      KZ Teleport
      Last Played Maps
      Magic Word
      Nades Controller
      Name Status
      New Messages Shower
      New Scroll Messages
      Nick Registration
      Player Teleport
      Public Rules
      Rang Admin Chat
      Simple Hns Train
      Slot Reservation
      Timelimit Vote
      Universal Anti_KzHack-xHack
      WallBug Stats
      AMX Who MENU
download: https://www.mediafire.com/file/ytpsrqie ... k.rar/file
cateva modele poate interesante

ImageImageImageImage
ImageImageImageImage
ImageImageImageImage
ImageImageImageImageImage
ImageImage
ImageImageImageImageImageImage
Image

download: https://www.mediafire.com/file/g2p845up ... e.rar/file
Image
Post Reply

Return to “Moduri”