#pragma semicolon 1

#include <sourcemod>
#include <sdktools>
#include <steamtools>
#include <cstrike>
#include <sdkhooks>
#include <smlib>
#include <cssthrowingknives>
#include <morecolors>
#include <frp_alex.inc>
#include <cssclantags>

// DEFINES

#define PLUGIN_VERSION		"1.0"
#define AUTHOR 				"@lex-92"
#define DESCRIPTION 		"Mod Roleplay pour CS:S"
#define NAME 				"VG-RP"
#define SOUND_TAZER 		"ambient/office/zap1.wav"
#define TAZER_COLORBLUE 	{255, 75, 75, 255}
#define FORCE_COULEUR	 	{128, 128, 128, 255}
#define MAX_PLAYERS 		64
#define LOGO				"{white}(VG-RP) {default}"
#define LOGO_FREEKILL		"\x03[Anti-Freekill] \x01"
#define	MAX_ENTITIES					2048
#define	MAX_CARS						2048
#define EF_NODRAW 						32
#define	MAX_LIGHTS						12
#define VEHICLE_TYPE_AIRBOAT_RAYCAST	8
#define SOLID_VPHYSICS 2
#define COLLISION_GROUP_PLAYER 5

// DEFINE SKINS

#define	MODELS_FLIC1		    "models/player/elis/fsv2/fischer.mdl"
#define	MODELS_FLIC2 			"models/player/slow/umbrella_ct/umbrella_ct.mdl"
#define	MODELS_FLIC_BOSS 	"models/player/slow/me2/illusive_man/slow.mdl"

#define	MODELS_TERRO1			"models/player/slow/niko_bellic/slow.mdl"
#define	MODELS_TERRO2			"A remplir"
#define	MODELS_TERRO3			"models/player/kirby/regular/umbrella_leet.mdl"
#define	MODELS_TERRO4			"models/player/slow/vin_diesel/slow.mdl"
#define	MODELS_TERRO5			"A remplir"

#define	MODELS_DETENU1 		"models/player/techknow/prison/leet_p.mdl"

#define	MODELS_BOSS_METIER	"A remplir"

#define	MODELS_VIP  			""

new String:IP_LICENCE[32] = "IP DU SERVEUR";

#define EXPLODE_SOUND			"physics/glass/glass_bottle_impact_hard3.wav"
#define EXPLODE_SOUND2  		"ambient/fire/mtov_flame2.wav"

// MODELS CARS

#define SCRIPT_MINI		"scripts/vehicles/mini.txt"
#define SCRIPT_LAND		"scripts/vehicles/landrover.txt"
#define SCRIPT_LAMBO	"scripts/vehicles/lambo.txt"

#define SCRIPT_TT		"scripts/vehicles/auditt.txt" 
#define SCRIPT_S5		"scripts/vehicles/s5.txt"
#define SCRIPT_DBS		"scripts/vehicles/dbs.txt"
#define SCRIPT_C4		"scripts/vehicles/c4.txt"

#define MODELS_LAND		"models/tdmcars/landrover.mdl"
#define MODELS_LAMBO	"models/tdmcars/gallardo.mdl"
#define MODELS_S5		"models/tdmcars/s5.mdl"
#define MODELS_TT		"models/tdmcars/auditt.mdl"
#define MODELS_DBS		"models/tdmcars/dbs.mdl"
#define MODELS_C4		"models/tdmcars/cit_c4.mdl"

#define MODELS_CAMERA	"models/props/cs_assault/camera.mdl"

#define SOUND_SALUT		"f-rp/salut.wav"

// SPAWN PNJ

new Handle:g_deadtimer[MAXPLAYERS+1] = { INVALID_HANDLE, ... };
new Handle:TimerHud[MAXPLAYERS+1] = INVALID_HANDLE;
new Handle:g_TazerTimer[MAXPLAYERS+1] = INVALID_HANDLE;
new Handle:g_croche[MAXPLAYERS+1] = { INVALID_HANDLE, ... };
new Handle:Timers;
new Handle:GiveKit;
new Handle:g_VirerMenu;
new Handle:gTimer;

new bool:CarView[MAXPLAYERS+1] = false;
new bool:g_booldead[MAXPLAYERS+1] = false;
new bool:g_InUse[MAXPLAYERS+1];
new bool:g_InDuck[MAXPLAYERS+1];
new bool:g_IsTazed[MAXPLAYERS+1] = false;
new bool:Policier_TEMP[MAXPLAYERS+1] = false;
new bool:Averti[MAXPLAYERS+1] = false;
new bool:Chargement[MAXPLAYERS+1] = false;
new bool:OnKit[MAXPLAYERS+1] = false;
new bool:g_crochetageon[MAXPLAYERS+1] = false;
new bool:grab[MAXPLAYERS+1] = false;
new bool:UnlimitedAmmo[MAXPLAYERS+1] = false;
new bool:BoostDeagle[MAXPLAYERS+1] = false;
new bool:BoostLife[MAXPLAYERS+1] = false;
new bool:BoostCut[MAXPLAYERS+1] = false;
new bool:BoostInvisi[MAXPLAYERS+1] = false;
new bool:BoostVitesse[MAXPLAYERS+1] = false;
new bool:HasKillCible[MAXPLAYERS+1] = false;
new bool:flashb[MAXPLAYERS+1] = false;
new bool:regenn[MAXPLAYERS+1] = false;
new bool:oeill[MAXPLAYERS+1] = false;
new bool:paintball[MAXPLAYERS+1] = false;
new bool:nojail[MAXPLAYERS+1] = false;
new bool:fiche[MAXPLAYERS+1] = false;
new bool:encontrat[MAXPLAYERS+1] = false;
new bool:stopgps[MAXPLAYERS+1] = true;
new bool:IsDisconnect[MAXPLAYERS+1];
new bool:Loaded[MAXPLAYERS+1];
new bool:IsCivil[MAXPLAYERS+1] = false;
new bool:isSpawned[MAXPLAYERS+1];
new bool:InQuery;
new bool:IsExitVehicle[MAXPLAYERS+1] = false;
new bool:licence = 	 false;

public bool:CarHorn[MAXPLAYERS+1];

new Float:g_Count[MAXPLAYERS+1] = 0.0;
new Float:CurrentEyeAngle[MAXPLAYERS+1][3];

new couleur[MAXPLAYERS+1] 	= 0;
new Lambo[MAXPLAYERS+1] 	= 0;
new Audi_TT[MAXPLAYERS+1]	= 0;
new Audi_S5[MAXPLAYERS+1]	= 0;
new Citroen[MAXPLAYERS+1] 	= 0;
new LandRover[MAXPLAYERS+1] = 0;
new AST_Dbs[MAXPLAYERS+1]  	= 0;		
new MDP[MAXPLAYERS+1]  		= 0;

new ForceSwitch[MAXPLAYERS+1];
new Entiter[MAXPLAYERS+1] = 0;
new g_crochetage[MAXPLAYERS+1] = 0;
new gObj[MAXPLAYERS+1] = 0;
new g_vol[MAXPLAYERS+1] = 0;
new g_ticket[MAXPLAYERS+1] = 0;
new CommanditeurID[MAXPLAYERS+1] = 0;
new TempCibleID[MAXPLAYERS+1] = 0;
new Cibled[MAXPLAYERS+1] = 0;
new PriceContrat[MAXPLAYERS+1] = 0;
new cibleID[MAXPLAYERS+1] = 0;
new BoostDispo[MAXPLAYERS+1] = 0;
new g_piratage[MAXPLAYERS+1] = 0;
new printer[MAXPLAYERS+1] = 0;
new activate[MAXPLAYERS+1] = 0;
new g_godmod[MAXPLAYERS+1] = 0;
new g_CountDead[MAXPLAYERS+1] = 0;
new g_jailtime[MAXPLAYERS+1] = 0;
new g_IsInJail[MAXPLAYERS+1] = 0;
new money[MAXPLAYERS+1] = 0;
new capital[MAXPLAYERS+1] = 0;
new jobid[MAXPLAYERS+1] = 0;
new rankid[MAXPLAYERS+1] = 0;
new bank[MAXPLAYERS+1] = 0;
new rib[MAXPLAYERS+1] = 0;
new cb[MAXPLAYERS+1] = 0;
new permislourd[MAXPLAYERS+1] = 0;
new permisleger[MAXPLAYERS+1] = 0;
new g_invisible[MAXPLAYERS+1] = 0;
new jobs[MAXPLAYERS+1] = 0;
new argent[MAXPLAYERS+1] = 0;
new givemoney[MAXPLAYERS+1] = 0;
new kitcrochetage[MAXPLAYERS+1] = 0;
new kit[MAXPLAYERS+1] = 0;
new ak47[MAXPLAYERS+1] = 0;
new awp[MAXPLAYERS+1] = 0;
new m249[MAXPLAYERS+1] = 0;
new scout[MAXPLAYERS+1] = 0;
new sg550[MAXPLAYERS+1] = 0;
new sg552[MAXPLAYERS+1] = 0;
new ump45[MAXPLAYERS+1] = 0;
new tmp[MAXPLAYERS+1] = 0;
new mp5[MAXPLAYERS+1] = 0;
new deagle[MAXPLAYERS+1] = 0;
new usp[MAXPLAYERS+1] = 0;
new fiveseven[MAXPLAYERS+1] = 0;
new glock[MAXPLAYERS+1] = 0;
new xm1014[MAXPLAYERS+1] = 0;
new p228[MAXPLAYERS+1] = 0;
new m3[MAXPLAYERS+1] = 0;
new m4a1[MAXPLAYERS+1] = 0;
new aug[MAXPLAYERS+1] = 0;
new galil[MAXPLAYERS+1] = 0;
new g3sg1[MAXPLAYERS+1] = 0;
new mac10[MAXPLAYERS+1] = 0;
new famas[MAXPLAYERS+1] = 0;
new p90[MAXPLAYERS+1] = 0;
new elites[MAXPLAYERS+1] = 0;
new ticket10[MAXPLAYERS+1] = 0;
new ticket50[MAXPLAYERS+1] = 0;
new ticket100[MAXPLAYERS+1] = 0;
new ticket500[MAXPLAYERS+1] = 0;
new levelcut[MAXPLAYERS+1] = 0;
new cartouche[MAXPLAYERS+1] = 0;
new heroine[MAXPLAYERS+1] = 0;
new exta[MAXPLAYERS+1] = 0;
new lsd[MAXPLAYERS+1] = 0;
new cocaine[MAXPLAYERS+1] = 0;
new weed[MAXPLAYERS+1] = 0;
new grenade[MAXPLAYERS+1] = 0;
new fumigene[MAXPLAYERS+1] = 0;
new flashbang[MAXPLAYERS+1] = 0;
new entrainement[MAXPLAYERS+1] = 0;
new kevlar[MAXPLAYERS+1] = 0;
new lastontime[MAXPLAYERS+1] = 0;
new salaire[MAXPLAYERS+1] = 0;
new salarychoose[MAXPLAYERS+1] = 0;
new flashball[MAXPLAYERS+1] = 0;
new oeil[MAXPLAYERS+1] = 0;
new imprimerie[MAXPLAYERS+1] = 0;
new regenerateur[MAXPLAYERS+1] = 0;
new Group[MAXPLAYERS+1] = 0;
new hamburger[MAXPLAYERS+1] = 0;
new frites[MAXPLAYERS+1] = 0;
new sunday[MAXPLAYERS+1] = 0;
new bigmac[MAXPLAYERS+1] = 0;
new macflurry[MAXPLAYERS+1] = 0;
new lancercut[MAXPLAYERS+1] = 0;
new distributeur[MAXPLAYERS+1] = 0;
new sofa[MAXPLAYERS+1] = 0;
new bibliotheque[MAXPLAYERS+1] = 0;
new dryer[MAXPLAYERS+1] = 0;
new points[MAXPLAYERS+1] = 0;
new flameAmount[MAXPLAYERS+1] = 0;
new g_flameEnabled[MAXPLAYERS+1];
new headshot[MAXPLAYERS+1] = 0;
new countheadshot[MAXPLAYERS+1] = 0;
new successdoor[MAXPLAYERS+1] = 0;
new countdoor[MAXPLAYERS+1] = 0;
new successjail[MAXPLAYERS+1] = 0;
new countjail[MAXPLAYERS+1] = 0;
new successpyro[MAXPLAYERS+1] = 0;
new countpyro[MAXPLAYERS+1] = 0;
new successrct[MAXPLAYERS+1] = 0;
new countrct[MAXPLAYERS+1] = 0;
new successdonator[MAXPLAYERS+1] = 0;
new countdonator[MAXPLAYERS+1] = 0;
new Location[MAXPLAYERS+1] = 0;
new permis[MAXPLAYERS+1] = 0;
new g_countfire[MAXPLAYERS+1] = 0;
new OldWeapon[MAXPLAYERS + 1];
new ClientVM[MAXPLAYERS+1][2];
new Mini[MAXPLAYERS+1] = 0;
new Car[MAXPLAYERS+1] = 0;
new kitexplosif[MAXPLAYERS+1] = 0;

new redColor[4]	= {255, 75, 75, 255 };
new greenColor[4]	= {75, 255, 75, 255 };
new g_modelLaser, g_modelHalo, g_LightingSprite, g_BeamSpriteFollow;
new activeOffset = -1;
new clip1Offset = -1;
new clip2Offset = -1;
new secAmmoTypeOffset = -1;
new priAmmoTypeOffset = -1;
new g_WeaponParent;
new g_SpriteIndex[128];
new g_SpriteIndexCount = 0;
new printer_owner[2048];
new g_countheure1 = 0;
new g_countheure2 = 0;
new g_countminute1 = 0;
new g_countminute2 = 0;
new g_days = 1;
new g_years = 2000;
new g_month = 1;
new ACTIVE_ANTIFK;
new HandsModel;
new Cars_Driver_Prop[MAX_ENTITIES];
new ViewEnt[2048];
new buttons2;

new String:NameChirurgie[64];
new String:sLastkiller[66];
new String:Zone[150];
new String:MonthName[50];
new String:Logfile[PLATFORM_MAX_PATH];
new String:g_sSteamID[MAXPLAYERS+1][21];
new String:g_Appart[MAXPLAYERS+1][100];

new LIMITATION = 80;

new POLE_EMPLOI;
new CASINO;
new Temps;
new lampe_1;
new lampe_2;

new g_iiClip1;

new Handle:Voitures;

public Plugin:myinfo =
{
    name = NAME,
    description = DESCRIPTION,
    author = AUTHOR,
    version = PLUGIN_VERSION,
};

public OnPluginStart()
{
	Verification();
	if (licence)
	{
		Voitures  = CreateConVar("sm_ff_cars", "1", "Active (1) / Desactive (0) les voitures");
		BuildPath(Path_SM, Logfile, sizeof(Logfile), "logs/roleplay.log");
		
		HookEvent("round_start", OnRoundStart);
		HookEvent("player_team", OnPlayerTeam, EventHookMode_Pre);
		HookEvent("weapon_fire", EventWeaponFire, EventHookMode_Pre);
		HookEvent("player_death", OnPlayerDeath);
		HookEvent("player_spawn", Event_PlayerSpawn);
		HookEvent("bullet_impact", Event_BulletImpact);
		
		HookEvent("player_connect", event_PlayerConnect, EventHookMode_Pre);
		HookEvent("player_disconnect", event_PlayerDisconnect_Suppress, EventHookMode_Pre);
		HookEvent("player_changename", OnNameChange, EventHookMode_Pre);
		
		RegConsoleCmd("sm_spawn", Cmd_PROPS);
		RegConsoleCmd("sm_mdp", Cmd_TEST);
		RegConsoleCmd("sm_lock", Cmd_Lock);
		RegConsoleCmd("sm_unlock", Cmd_Unlock);
		RegConsoleCmd("sm_civil", Command_Civil);
		RegConsoleCmd("sm_give", Command_Give);
		RegConsoleCmd("sm_ammende", Command_Ammende);
		RegConsoleCmd("sm_jaillist", Command_Jaillist);
		RegConsoleCmd("sm_vis", Command_Vis);
		RegConsoleCmd("sm_invisible", Command_Vis);
		RegConsoleCmd("sm_jobmenu", Command_Jobmenu);
		RegConsoleCmd("sm_demission", Command_Demission);
		RegConsoleCmd("sm_argent", Command_Money);
		RegConsoleCmd("sm_rw", Command_Rw);
		RegConsoleCmd("sm_changename", Command_Changename);
		RegConsoleCmd("sm_jail", Command_Jail);
		RegConsoleCmd("sm_tazer", Command_tazer);
		RegConsoleCmd("sm_vendre", Command_Vente); 
		RegConsoleCmd("sm_item", Command_Item);
		RegConsoleCmd("sm_lnoclip", Command_Noclip);
		RegConsoleCmd("sm_perquisition", Command_Perqui);
		RegConsoleCmd("sm_perqui", Command_Perqui);
		RegConsoleCmd("sm_engager", Command_Engager);
		RegConsoleCmd("sm_recruter", Command_Engager);
		RegConsoleCmd("sm_recrute", Command_Engager);
		RegConsoleCmd("sm_promote", Command_Promote);
		RegConsoleCmd("sm_gradeup", Command_Promote);
		RegConsoleCmd("sm_promouvoire", Command_Promote);
		RegConsoleCmd("sm_demote", Command_Demote);
		RegConsoleCmd("sm_gradedown", Command_Demote);
		RegConsoleCmd("sm_retrograder", Command_Demote);
		RegConsoleCmd("sm_virer", Command_Virer);
		RegConsoleCmd("sm_renvoyer", Command_Virer);
		RegConsoleCmd("sm_out", Command_Out);
		RegConsoleCmd("sm_+force", Command_Grab);
		RegConsoleCmd("sm_vol", Command_Vol);
		RegConsoleCmd("sm_salaire", Command_Salaire);
		RegConsoleCmd("sm_enquete", Command_Enquete);
		RegConsoleCmd("sm_aia", Command_Ammo);
		RegConsoleCmd("sm_joblist", Command_JobList);
		RegConsoleCmd("sm_jobs", Command_JobList);
		RegConsoleCmd("sm_job", Command_JobList);
		RegConsoleCmd("sm_jugement", Command_Jugement);
		RegConsoleCmd("sm_contrat", Command_Contrat);
		RegConsoleCmd("sm_piratage", Command_Piratage);
		RegConsoleCmd("sm_inbag", Command_Transform);
		RegConsoleCmd("sm_soins", Command_Soins);
		RegConsoleCmd("sm_soin", Command_Soins);
		RegConsoleCmd("sm_soigner", Command_Soins);
		RegConsoleCmd("sm_flashball", Command_Flashball);
		RegConsoleCmd("sm_chirurgie", Command_Chirurgie);
		RegConsoleCmd("sm_cash", Command_Cash);
		RegConsoleCmd("sm_pick", Command_Pick);
			
		RegConsoleCmd("sm_groupe", Command_Group);
		RegConsoleCmd("sm_groupcreate", Command_GroupCreate);
		RegConsoleCmd("sm_groupinvite", Command_GroupInvite);
			
		RegConsoleCmd("sm_sucer", Command_Sucer);
		RegConsoleCmd("sm_adminmenu", Command_AdminMenu);
		RegConsoleCmd("sm_respawn", Command_RespawnAdmin);
		RegConsoleCmd("sm_detective", Command_Detective);
		RegConsoleCmd("sm_god", Command_Godmod);
		RegConsoleCmd("sm_teleport", Command_Teleport);
		RegConsoleCmd("sm_flame", Command_Flame);
		RegConsoleCmd("sm_trade", Command_Trade);
		RegConsoleCmd("sm_tp", Command_3rd);
		
		RegConsoleCmd("sm_gps", Command_Gps);
		RegConsoleCmd("sm_heure", Command_Size);
		RegConsoleCmd("sm_limit", Command_Limitation);
		RegConsoleCmd("sm_limite", Command_Limitation);
									
		RegConsoleCmd("sm_shownote", Command_Shownote);
		RegConsoleCmd("sm_immobilier", Command_Immobilier);
		RegConsoleCmd("sm_garage", Command_Garage);
		RegConsoleCmd("sm_dj", Command_Dj);
		
		RegConsoleCmd("jointeam", Block_CMD);
		RegConsoleCmd("explode", Block_CMD);
		RegConsoleCmd("kill", Block_CMD);
		RegConsoleCmd("coverme", Block_CMD);
		RegConsoleCmd("takepoint", Block_CMD);
		RegConsoleCmd("holdpos", Block_CMD);
		RegConsoleCmd("regroup", Block_CMD);
		RegConsoleCmd("followme", Block_CMD);
		RegConsoleCmd("takingfire", Block_CMD);
		RegConsoleCmd("go", Block_CMD);
		RegConsoleCmd("fallback", Block_CMD);
		RegConsoleCmd("sticktog", Block_CMD);
		RegConsoleCmd("getinpos", Block_CMD);
		RegConsoleCmd("stormfront", Block_CMD);
		RegConsoleCmd("report", Block_CMD);
		RegConsoleCmd("roger", Block_CMD);
		RegConsoleCmd("enemyspot", Block_CMD);
		RegConsoleCmd("needbackup", Block_CMD);
		RegConsoleCmd("sectorclear", Block_CMD);
		RegConsoleCmd("inposition", Block_CMD);
		RegConsoleCmd("reportingin", Block_CMD);
		RegConsoleCmd("getout", Block_CMD);
		RegConsoleCmd("negative", Block_CMD);
		RegConsoleCmd("enemydown", Block_CMD);
			
		RegConsoleCmd("drop", Lancer);
			
		RegServerCmd("quit", OnDown);
		RegServerCmd("_restart", OnDown);
			
		AddCommandListener(Say_Team, "say_team");
		AddCommandListener(Say, "say");

		CreateTimer(0.1, InitCapital);
			
		activeOffset = FindSendPropOffs("CAI_BaseNPC", "m_hActiveWeapon");
		g_iiClip1   = FindSendPropOffs("CBaseCombatWeapon", "m_iClip1");
		clip1Offset = FindSendPropOffs("CBaseCombatWeapon", "m_iClip1");
		clip2Offset = FindSendPropOffs("CBaseCombatWeapon", "m_iClip2");
		priAmmoTypeOffset = FindSendPropOffs("CBaseCombatWeapon", "m_iPrimaryAmmoCount");
		secAmmoTypeOffset = FindSendPropOffs("CBaseCombatWeapon", "m_iSecondaryAmmoCount");
		g_WeaponParent = FindSendPropOffs("CBaseCombatWeapon", "m_hOwnerEntity");
		HookUserMessage(GetUserMessageId("TextMsg"), TextMsg, true);
		
		AutoExecConfig(true, "FF_RP");
	}
}

public Action:Event_BulletImpact(Handle:event, const String:weaponName[], bool:dontBroadcast)
{
	new client = GetClientOfUserId(GetEventInt(event, "userid"));
	
	static Float:pos[3];
	pos[0] = GetEventFloat(event,"x");
	pos[1] = GetEventFloat(event,"y");
	pos[2] = GetEventFloat(event,"z");
	
	if (IsInPaint(client) && paintball[client])
	{
		TE_SetupWorldDecal(pos, g_SpriteIndex[GetRandomInt(0, g_SpriteIndexCount - 1)]);
		TE_SendToAll();
	}
}

public Action:OnNameChange(Handle:event, String:name[], bool:dontBroadcast)
{
	return Plugin_Handled;
}


public Action:event_PlayerConnect(Handle:event, const String:name[], bool:dontBroadcast)
{
	if (!dontBroadcast)
	{
		decl String:clientName[33], String:networkID[22], String:address[32];
		GetEventString(event, "name", clientName, sizeof(clientName));
		GetEventString(event, "networkid", networkID, sizeof(networkID));
		GetEventString(event, "address", address, sizeof(address));

		new Handle:newEvent = CreateEvent("player_connect", true);
		SetEventString(newEvent, "name", clientName);
		SetEventInt(newEvent, "index", GetEventInt(event, "index"));
		SetEventInt(newEvent, "userid", GetEventInt(event, "userid"));
		SetEventString(newEvent, "networkid", networkID);
		SetEventString(newEvent, "address", address);

		FireEvent(newEvent, true);

		return Plugin_Handled;
	}

	return Plugin_Continue;
}


public Action:event_PlayerDisconnect_Suppress(Handle:event, const String:name[], bool:dontBroadcast)
{
	if (!dontBroadcast)
	{
		decl String:clientName[33], String:networkID[22], String:reason[65];
		GetEventString(event, "name", clientName, sizeof(clientName));
		GetEventString(event, "networkid", networkID, sizeof(networkID));
		GetEventString(event, "reason", reason, sizeof(reason));

		new Handle:newEvent = CreateEvent("player_disconnect", true);
		SetEventInt(newEvent, "userid", GetEventInt(event, "userid"));
		SetEventString(newEvent, "reason", reason);
		SetEventString(newEvent, "name", clientName);        
		SetEventString(newEvent, "networkid", networkID);

		FireEvent(newEvent, true);

		return Plugin_Handled;
	}

	return Plugin_Continue;
}

public OnMapStart()
{
	new Handle:mp_startmoney = INVALID_HANDLE;
	mp_startmoney = FindConVar("mp_startmoney");

	if (mp_startmoney != INVALID_HANDLE)
	{
		SetConVarBounds(mp_startmoney, ConVarBound_Lower, false);
	}
	
	SetConVarInt(FindConVar("mp_ignore_round_win_conditions"), 1, true, false);
	SetConVarInt(FindConVar("sv_ignoregrenaderadio"), 1, true, false);
	SetConVarInt(FindConVar("mp_friendlyfire"), 1, true, false);
	SetConVarInt(FindConVar("mp_autokick"), 0, true, false);
	SetConVarInt(FindConVar("mp_autoteambalance"), 0, true, false);
	SetConVarInt(FindConVar("mp_roundtime"), 1, true, false);
	SetConVarInt(FindConVar("sv_alltalk"), 1, true, false);
	
	// DL 
	
	PrecacheSound("doors/latchunlocked1.wav", true);
	PrecacheSound("doors/default_locked.wav", true);
	PrecacheSound("vehicles/mustang_horn.mp3", false);
	
	// SONS
	
	AddFileToDownloadsTable("sound/f-rp/bienvenue.wav");
	AddFileToDownloadsTable("sound/f-rp/salut.wav");
	
	PrecacheSound("f-rp/bienvenue.wav", true);
	
	// EFFETS

	g_modelLaser = PrecacheModel("sprites/laser.vmt");
	g_modelHalo = PrecacheModel("materials/sprites/halo01.vmt");
	g_LightingSprite = PrecacheModel("sprites/lgtning.vmt");
	g_BeamSpriteFollow = PrecacheModel("materials/sprites/laserbeam.vmt");
	
	// PROPS
	
	AddFileToDownloadsTable("models/natalya/props/consolebox01_expl.mdl");
	AddFileToDownloadsTable("models/natalya/props/consolebox01_expl.dx80.vtx");
	AddFileToDownloadsTable("models/natalya/props/consolebox01_expl.dx90.vtx");
	AddFileToDownloadsTable("models/natalya/props/consolebox01_expl.phy");
	AddFileToDownloadsTable("models/natalya/props/consolebox01_expl.sw.vtx");
	AddFileToDownloadsTable("models/natalya/props/consolebox01_expl.vvd");
	
	AddFileToDownloadsTable("materials/models/props_unique/atm.vmt");
	AddFileToDownloadsTable("materials/models/props_unique/atm.vtf");
	AddFileToDownloadsTable("models/props_unique/atm01.mdl");
	AddFileToDownloadsTable("models/props_unique/atm01.dx80.vtx");
	AddFileToDownloadsTable("models/props_unique/atm01.dx90.vtx");
	AddFileToDownloadsTable("models/props_unique/atm01.phy");
	AddFileToDownloadsTable("models/props_unique/atm01.sw.vtx");
	AddFileToDownloadsTable("models/props_unique/atm01.vvd");
				
	// VOITURES DWN
	
	AddFileToDownloadsTable("materials/models/tdmcars/shared/black.vmt");
	AddFileToDownloadsTable("materials/models/tdmcars/shared/black.vtf");
	AddFileToDownloadsTable("materials/models/tdmcars/shared/carbonfiber.vmt");
	AddFileToDownloadsTable("materials/models/tdmcars/shared/carbonfiber.vtf");
	AddFileToDownloadsTable("materials/models/tdmcars/shared/carbonfibernormal.vtf");
	AddFileToDownloadsTable("materials/models/tdmcars/shared/chrome.vmt");
	AddFileToDownloadsTable("materials/models/tdmcars/shared/glass.vmt");
	AddFileToDownloadsTable("materials/models/tdmcars/shared/glass.vtf");
	AddFileToDownloadsTable("materials/models/tdmcars/shared/glass_nm.vtf");
	AddFileToDownloadsTable("materials/models/tdmcars/shared/grille.vmt");
	AddFileToDownloadsTable("materials/models/tdmcars/shared/grille.vtf");
	AddFileToDownloadsTable("materials/models/tdmcars/shared/interior_leather2_dark.vmt");
	AddFileToDownloadsTable("materials/models/tdmcars/shared/interior_leather2_dark_nrm.vtf");
	AddFileToDownloadsTable("materials/models/tdmcars/shared/interior_leather_dark.vmt");
	AddFileToDownloadsTable("materials/models/tdmcars/shared/interior_leather_dark.vtf");
	AddFileToDownloadsTable("materials/models/tdmcars/shared/interior_leather_dark_nrm.vtf");
	AddFileToDownloadsTable("materials/models/tdmcars/shared/interior_leather2_dark.vtf");
	AddFileToDownloadsTable("materials/models/tdmcars/shared/noise.vtf");
	AddFileToDownloadsTable("materials/models/tdmcars/shared/skin.vmt");
	AddFileToDownloadsTable("materials/models/tdmcars/shared/skin.vtf");
	AddFileToDownloadsTable("materials/models/tdmcars/shared/skin_nm.vtf");
	AddFileToDownloadsTable("materials/models/tdmcars/shared/tirea0.vmt");
	AddFileToDownloadsTable("materials/models/tdmcars/shared/tirea0.vtf");
	AddFileToDownloadsTable("materials/models/tdmcars/shared/tirea0_bump.vtf");
	AddFileToDownloadsTable("materials/models/tdmcars/shared/undercarriage.vmt");
	AddFileToDownloadsTable("materials/models/tdmcars/shared/undercarriage.vtf");
	AddFileToDownloadsTable("materials/models/tdmcars/shared/wood.vmt");
	AddFileToDownloadsTable("materials/models/tdmcars/shared/wood.vtf");
	AddFileToDownloadsTable("materials/models/tdmcars/shared/wood_nm.vtf");
	
	AddFileToDownloadsTable("materials/models/tdmcars/c4/interior_lod0.vmt");
	AddFileToDownloadsTable("materials/models/tdmcars/c4/interior_lod0.vtf");
	AddFileToDownloadsTable("materials/models/tdmcars/c4/lights.vmt");
	AddFileToDownloadsTable("materials/models/tdmcars/c4/lights.vtf");
	AddFileToDownloadsTable("materials/models/tdmcars/c4/lights_nrm.vtf");
	AddFileToDownloadsTable("materials/models/tdmcars/c4/nodamage.vmt");
	AddFileToDownloadsTable("materials/models/tdmcars/c4/nodamage.vtf");
	AddFileToDownloadsTable("materials/models/tdmcars/c4/wheel.vmt");
	AddFileToDownloadsTable("materials/models/tdmcars/c4/wheel.vtf");
	AddFileToDownloadsTable("materials/models/tdmcars/c4/wheel_nrm.vtf");
	
	AddFileToDownloadsTable("materials/models/tdmcars/kia_ceed/interior_lod0.vmt");
	AddFileToDownloadsTable("materials/models/tdmcars/kia_ceed/interior_lod0.vtf");
	AddFileToDownloadsTable("materials/models/tdmcars/kia_ceed/lights.vmt");
	AddFileToDownloadsTable("materials/models/tdmcars/kia_ceed/lights.vtf");
	AddFileToDownloadsTable("materials/models/tdmcars/kia_ceed/lights_nrm.vtf");
	AddFileToDownloadsTable("materials/models/tdmcars/kia_ceed/nodamage.vmt");
	AddFileToDownloadsTable("materials/models/tdmcars/kia_ceed/nodamage.vtf");
	AddFileToDownloadsTable("materials/models/tdmcars/kia_ceed/wheel.vmt");
	AddFileToDownloadsTable("materials/models/tdmcars/kia_ceed/wheel.vtf");
	AddFileToDownloadsTable("materials/models/tdmcars/kia_ceed/wheel_nrm.vtf");
	
	AddFileToDownloadsTable("materials/models/tdmcars/s5/interior_lod0.vmt");
	AddFileToDownloadsTable("materials/models/tdmcars/s5/interior_lod0.vtf");
	AddFileToDownloadsTable("materials/models/tdmcars/s5/lights.vmt");
	AddFileToDownloadsTable("materials/models/tdmcars/s5/lights.vtf");
	AddFileToDownloadsTable("materials/models/tdmcars/s5/lights_nrm.vtf");
	AddFileToDownloadsTable("materials/models/tdmcars/s5/nodamage.vmt");
	AddFileToDownloadsTable("materials/models/tdmcars/s5/nodamage.vtf");
	AddFileToDownloadsTable("materials/models/tdmcars/s5/wheel.vmt");
	AddFileToDownloadsTable("materials/models/tdmcars/s5/wheel.vtf");
	AddFileToDownloadsTable("materials/models/tdmcars/s5/wheel_nrm.vtf");
	
	AddFileToDownloadsTable("materials/models/tdmcars/auditt/interior_lod0.vmt");
	AddFileToDownloadsTable("materials/models/tdmcars/auditt/interior_lod0.vtf");
	AddFileToDownloadsTable("materials/models/tdmcars/auditt/lights.vmt");
	AddFileToDownloadsTable("materials/models/tdmcars/auditt/lights.vtf");
	AddFileToDownloadsTable("materials/models/tdmcars/auditt/lights_nrm.vtf");
	AddFileToDownloadsTable("materials/models/tdmcars/auditt/nodamage.vmt");
	AddFileToDownloadsTable("materials/models/tdmcars/auditt/nodamage.vtf");
	AddFileToDownloadsTable("materials/models/tdmcars/auditt/wheel.vmt");
	AddFileToDownloadsTable("materials/models/tdmcars/auditt/wheel.vtf");
	AddFileToDownloadsTable("materials/models/tdmcars/auditt/wheel_nrm.vtf");
	
	AddFileToDownloadsTable("materials/models/tdmcars/dbs/interior_lod0.vmt");
	AddFileToDownloadsTable("materials/models/tdmcars/dbs/interior_lod0.vtf");
	AddFileToDownloadsTable("materials/models/tdmcars/dbs/lights.vmt");
	AddFileToDownloadsTable("materials/models/tdmcars/dbs/lights.vtf");
	AddFileToDownloadsTable("materials/models/tdmcars/dbs/lights_nrm.vtf");
	AddFileToDownloadsTable("materials/models/tdmcars/dbs/nodamage.vmt");
	AddFileToDownloadsTable("materials/models/tdmcars/dbs/nodamage.vtf");
	AddFileToDownloadsTable("materials/models/tdmcars/dbs/wheel.vmt");
	AddFileToDownloadsTable("materials/models/tdmcars/dbs/wheel.vtf");
	AddFileToDownloadsTable("materials/models/tdmcars/dbs/wheel_nrm.vtf");
	
	AddFileToDownloadsTable("materials/models/tdmcars/gallardo/interior_lod0.vmt");
	AddFileToDownloadsTable("materials/models/tdmcars/gallardo/interior_lod0.vtf");
	AddFileToDownloadsTable("materials/models/tdmcars/gallardo/lights.vmt");
	AddFileToDownloadsTable("materials/models/tdmcars/gallardo/lights.vtf");
	AddFileToDownloadsTable("materials/models/tdmcars/gallardo/lights_nrm.vtf");
	AddFileToDownloadsTable("materials/models/tdmcars/gallardo/nodamage.vmt");
	AddFileToDownloadsTable("materials/models/tdmcars/gallardo/nodamage.vtf");
	AddFileToDownloadsTable("materials/models/tdmcars/gallardo/wheel.vmt");
	AddFileToDownloadsTable("materials/models/tdmcars/gallardo/wheel.vtf");
	AddFileToDownloadsTable("materials/models/tdmcars/gallardo/wheel_nrm.vtf");
	
	AddFileToDownloadsTable("materials/models/tdmcars/landrover/interior_lod0.vmt");
	AddFileToDownloadsTable("materials/models/tdmcars/landrover/interior_lod0.vtf");
	AddFileToDownloadsTable("materials/models/tdmcars/landrover/lights.vmt");
	AddFileToDownloadsTable("materials/models/tdmcars/landrover/lights.vtf");
	AddFileToDownloadsTable("materials/models/tdmcars/landrover/lights_nrm.vtf");
	AddFileToDownloadsTable("materials/models/tdmcars/landrover/nodamage.vmt");
	AddFileToDownloadsTable("materials/models/tdmcars/landrover/nodamage.vtf");
	AddFileToDownloadsTable("materials/models/tdmcars/landrover/wheel.vmt");
	AddFileToDownloadsTable("materials/models/tdmcars/landrover/wheel.vtf");
	AddFileToDownloadsTable("materials/models/tdmcars/landrover/wheel_nrm.vtf");
		
	AddFileToDownloadsTable("models/tdmcars/gallardo.dx80.vtx");
	AddFileToDownloadsTable("models/tdmcars/gallardo.dx90.vtx");
	AddFileToDownloadsTable("models/tdmcars/gallardo.mdl");
	AddFileToDownloadsTable("models/tdmcars/gallardo.phy");
	AddFileToDownloadsTable("models/tdmcars/gallardo.sw.vtx");
	AddFileToDownloadsTable("models/tdmcars/gallardo.vvd");
	
	AddFileToDownloadsTable("models/tdmcars/landrover.dx80.vtx");
	AddFileToDownloadsTable("models/tdmcars/landrover.dx90.vtx");
	AddFileToDownloadsTable("models/tdmcars/landrover.mdl");
	AddFileToDownloadsTable("models/tdmcars/landrover.phy");
	AddFileToDownloadsTable("models/tdmcars/landrover.sw.vtx");
	AddFileToDownloadsTable("models/tdmcars/landrover.vvd");
	
	AddFileToDownloadsTable("models/tdmcars/auditt.dx80.vtx");
	AddFileToDownloadsTable("models/tdmcars/auditt.dx90.vtx");
	AddFileToDownloadsTable("models/tdmcars/auditt.mdl");
	AddFileToDownloadsTable("models/tdmcars/auditt.phy");
	AddFileToDownloadsTable("models/tdmcars/auditt.sw.vtx");
	AddFileToDownloadsTable("models/tdmcars/auditt.vvd");
	
	AddFileToDownloadsTable("models/tdmcars/cit_c4.dx80.vtx");
	AddFileToDownloadsTable("models/tdmcars/cit_c4.dx90.vtx");
	AddFileToDownloadsTable("models/tdmcars/cit_c4.mdl");
	AddFileToDownloadsTable("models/tdmcars/cit_c4.phy");
	AddFileToDownloadsTable("models/tdmcars/cit_c4.sw.vtx");
	AddFileToDownloadsTable("models/tdmcars/cit_c4.vvd");
	
	AddFileToDownloadsTable("models/tdmcars/dbs.dx80.vtx");
	AddFileToDownloadsTable("models/tdmcars/dbs.dx90.vtx");
	AddFileToDownloadsTable("models/tdmcars/dbs.mdl");
	AddFileToDownloadsTable("models/tdmcars/dbs.phy");
	AddFileToDownloadsTable("models/tdmcars/dbs.sw.vtx");
	AddFileToDownloadsTable("models/tdmcars/dbs.vvd");
	
	AddFileToDownloadsTable("models/tdmcars/s5.dx80.vtx");
	AddFileToDownloadsTable("models/tdmcars/s5.dx90.vtx");
	AddFileToDownloadsTable("models/tdmcars/s5.mdl");
	AddFileToDownloadsTable("models/tdmcars/s5.phy");
	AddFileToDownloadsTable("models/tdmcars/s5.sw.vtx");
	AddFileToDownloadsTable("models/tdmcars/s5.vvd");
	
	AddFileToDownloadsTable("models/tdmcars/kia_ceed.dx80.vtx");
	AddFileToDownloadsTable("models/tdmcars/kia_ceed.dx90.vtx");
	AddFileToDownloadsTable("models/tdmcars/kia_ceed.mdl");
	AddFileToDownloadsTable("models/tdmcars/kia_ceed.phy");
	AddFileToDownloadsTable("models/tdmcars/kia_ceed.sw.vtx");
	AddFileToDownloadsTable("models/tdmcars/kia_ceed.vvd");
	
	PrecacheModel("models/breen.mdl", true);
	PrecacheModel("models/alyx.mdl", true);
		
	PrecacheSound("roleplay/dj/1.mp3", true);
	PrecacheSound("roleplay/dj/2.mp3", true);
	PrecacheSound("roleplay/dj/3.mp3", true);
	PrecacheSound("roleplay/dj/4.mp3", true);
	PrecacheSound("roleplay/dj/5.mp3", true);
	PrecacheSound("roleplay/dj/6.mp3", true);
	
	PrecacheSound(SOUND_SALUT, true);
	PrecacheSound(EXPLODE_SOUND, true);
	PrecacheSound(EXPLODE_SOUND2, true);
	
	PrecacheModel("models/tdmcars/gallardo.mdl", true);
	PrecacheModel("models/tdmcars/kia_ceed.mdl", true);
	PrecacheModel("models/natalya/props/consolebox01_expl.mdl", true);
	PrecacheModel("models/props_unique/atm01.mdl", true);
	PrecacheModel("models/props_junk/garbage_glassbottle003a.mdl");
	PrecacheModel("sprites/light_glow02.spr");
	
	PrecacheModel(MODELS_FLIC_BOSS, true);
	PrecacheModel(MODELS_FLIC1, true);
	PrecacheModel(MODELS_FLIC2, true);
	PrecacheModel(MODELS_BOSS_METIER, true);

	PrecacheModel(MODELS_TERRO1, true);
	PrecacheModel(MODELS_TERRO2, true);
	PrecacheModel(MODELS_TERRO3, true);
	PrecacheModel(MODELS_TERRO4, true);
	PrecacheModel(MODELS_TERRO5, true);
	PrecacheModel(MODELS_DETENU1, true);
	PrecacheModel(MODELS_CAMERA, true);	

	// PrecacheModel(MODELS_VIP, true);
		
	GetHeure();
	startheure();
	
	gTimer = CreateTimer(0.1, UpdateObjects, INVALID_HANDLE, TIMER_REPEAT);
	
	new i;
	for (i=0; i<MAX_PLAYERS; i++)
	{
		gObj[i]=-1;
	}
	
	new Handle:KvColors = CreateKeyValues("colors");
	new String:ConfigFile[PLATFORM_MAX_PATH];
	BuildPath(Path_SM, ConfigFile, sizeof(ConfigFile), "configs/paintball.cfg");
	if (!FileToKeyValues(KvColors, ConfigFile))
	{
		CloseHandle(KvColors);
		LogError("[ERROR] paintball can not convert file to keyvalues: %s", ConfigFile);
		return;
	}

	KvRewind(KvColors);
	new bool:sectionExists;
	sectionExists = KvGotoFirstSubKey(KvColors);
	if ( !sectionExists )
	{
		CloseHandle(KvColors);
		LogError("[ERROR] paintball can not find first keyvalues subkey in file: %s", ConfigFile);
		return;
	}

	new String:filename[PLATFORM_MAX_PATH];

	while ( sectionExists )
	{
		if ( KvGetNum(KvColors, "enabled") )
		{
			KvGetString(KvColors, "primary", filename, sizeof(filename));
			g_SpriteIndex[g_SpriteIndexCount++] = precachePaintballDecal(filename);
			KvGetString(KvColors, "secondary", filename, sizeof(filename));
			precachePaintballDecal(filename);
		}

		sectionExists = KvGotoNextKey(KvColors);
	}
	
	CloseHandle(KvColors);
	
	new ent = FindEntityByClassname(-1, "env_fog_controller");
	
	if (ent != -1)
	{
		AcceptEntityInput(ent, "TurnOff");
	}
	
	for (new e = 1; e <= MaxClients; e++) 
	{ 
		if (IsClientInGame(e) && IsClientAuthorized(e) && !IsFakeClient(e)) 
		{ 
			GetClientAuthString(e, g_sSteamID[e], sizeof(g_sSteamID[])); 
		} 
	} 
	
	HandsModel = PrecacheModel("models/weapons/v_hands.mdl");
	
	LoadRoleplayConfig();
	
	LIMITATION 	= 35;
}

public LoadRoleplayConfig()
{
	new Handle:hKv = CreateKeyValues("roleplay");
	
	decl String:sConfig[PLATFORM_MAX_PATH];
	BuildPath(Path_SM, sConfig, sizeof(sConfig), "configs/roleplay/roleplay.cfg");
	
	if (!FileToKeyValues(hKv, sConfig)) 
	{
		CloseHandle(hKv);
		SetFailState("Impossible de lire le fichier roleplay.cfg");
	}
	
	CloseHandle(hKv);
	
	ACTIVE_ANTIFK = 0;
}

precachePaintballDecal(const String:filename[])
{
	new String:tmpPath[PLATFORM_MAX_PATH];
	new result = 0;
	result = PrecacheDecal(filename, true);
	Format(tmpPath,sizeof(tmpPath),"materials/%s",filename);
	AddFileToDownloadsTable(tmpPath);
	return result;
}

public OnMapEnd()
{
	SaveTime();
	CloseHandle(Timers);
	CloseHandle(gTimer);
}

public APLRes:AskPluginLoad2(Handle:myself, bool:late, String:error[],  err_max)
{
	CreateNative("GetClientMoney", NativeGetClientMoney);
	CreateNative("GetClientBank", NativeGetClientBank);
	CreateNative("SetClientBank", NativeSetClientBank);
	CreateNative("SetClientMoney", NativeSetClientMoney);
	CreateNative("IsInJail", NativeIsInJail);
	CreateNative("SetPlayerJobid", NativeSetPlayerJobid);
	CreateNative("SetPlayerRankid", NativeSetPlayerRankid);
	CreateNative("GetPlayerJobid", NativeGetPlayerJobid);
	CreateNative("GetPlayerRankid", NativeGetPlayerRankid);
	CreateNative("GetPlayerJailtime", NativeGetPlayerJailtime);
	CreateNative("SetPlayerJailtime", NativeSetPlayerJailtime);
	return APLRes_Success;
}

public NativeGetClientMoney(Handle:plugin, numParams)
{
	new client = GetNativeCell(1);
	return money[client];
}

public NativeGetClientBank(Handle:plugin, numParams)
{
	new client = GetNativeCell(1);
	return bank[client];
}

public NativeSetClientBank(Handle:plugin, numParams)
{
	new client = GetNativeCell(1);
	new amount = GetNativeCell(2);
	bank[client] = amount;
	return;
}

public NativeSetClientMoney(Handle:plugin, numParams)
{
	new client = GetNativeCell(1);
	new amount = GetNativeCell(2);
	money[client] = amount;
	return;
}

public NativeIsInJail(Handle:plugin, numParams)
{
	new client = GetNativeCell(1);
	
	if (g_IsInJail[client] > 0)
		return true;
	else
		return false;
}

public NativeSetPlayerJobid(Handle:plugin, numParams)
{
	new client = GetNativeCell(1);
	new idjob = GetNativeCell(2);
	jobid[client] = idjob;
	return;
}

public NativeSetPlayerRankid(Handle:plugin, numParams)
{
	new client = GetNativeCell(1);
	new idrank = GetNativeCell(2);
	rankid[client] = idrank;
	return;
}

public NativeGetPlayerJobid(Handle:plugin, numParams)
{
	new client = GetNativeCell(1);
	return jobid[client];
}

public NativeGetPlayerRankid(Handle:plugin, numParams)
{
	new client = GetNativeCell(1);
	return rankid[client];
}

public NativeSetPlayerJailtime(Handle:plugin, numParams)
{
	new client = GetNativeCell(1);
	new jailtime = GetNativeCell(2);
	g_jailtime[client] = jailtime;
	return;
}

public NativeGetPlayerJailtime(Handle:plugin, numParams)
{
	new client = GetNativeCell(1);
	return g_jailtime[client];
}

public Action:OnDown(args)
{
	for(new i = 1; i <= MaxClients; i++)
	{
		if (IsClientInGame(i) && !IsFakeClient(i))
		{
            ClientCommand(i, "retry");
		}
	}
	
	LogToFile(Logfile,"Serveur redémarré, joueurs connectés.");
}

public OnEntityCreated(entity, const String:classname[])
{
	if (!strcmp(classname, "flashbang_projectile"))
	{
		SDKHook(entity, SDKHook_SpawnPost, ProjectileSpawned);
	}
	
	if (StrEqual(classname, "predicted_viewmodel", false))
	{
		SDKHook(entity, SDKHook_Spawn, OnEntitySpawned);
	}
}

public OnClientPutInServer(client)
{
	SDKHook(client, SDKHook_PreThink, OnPreThink);
	SDKHook(client, SDKHook_PostThink, OnPostThink);
	
	CarHorn[client] = false;
}

public OnPostThink(client)
{
	new GroundEnt = GetEntPropEnt(client, Prop_Send, "m_hGroundEntity");
	
	if (GroundEnt > 0)
	{
		SetEntPropEnt(client, Prop_Send, "m_hGroundEntity", 0);
	}
}

public OnPreThink(client)
{
	GetClientEyeAngles(client, CurrentEyeAngle[client]);
}

public OnEntitySpawned(entity)
{
	new Owner = GetEntPropEnt(entity, Prop_Send, "m_hOwner");
	if ((Owner > 0) && (Owner <= MaxClients))
	{
		if (GetEntProp(entity, Prop_Send, "m_nViewModelIndex") == 0)
		{
			ClientVM[Owner][0] = entity;
		}
		else if (GetEntProp(entity, Prop_Send, "m_nViewModelIndex") == 1)
		{
			ClientVM[Owner][1] = entity;
		}
	}
}

public OnPostThinkPost(client)
{    
    if (!IsPlayerAlive(client))
    {
        return;
    }
    
    new WeaponIndex = GetEntPropEnt(client, Prop_Send, "m_hActiveWeapon");
    
    if (WeaponIndex == -1)
    {
        OldWeapon[client] = WeaponIndex;
        return;
    }
    
    if (WeaponIndex != OldWeapon[client])
    {
        decl String:ClassName[30];
        GetEdictClassname(WeaponIndex, ClassName, sizeof(ClassName));
        if (StrEqual("weapon_knife", ClassName, false))
        {
            AcceptEntityInput(WeaponIndex, "hideweapon");

            new EntEffects = GetEntProp(ClientVM[client][1], Prop_Send, "m_fEffects");
            EntEffects &= ~EF_NODRAW;
            SetEntProp(ClientVM[client][1], Prop_Send, "m_fEffects", EntEffects);

            SetEntProp(ClientVM[client][1], Prop_Send, "m_nModelIndex", HandsModel);
            SetEntPropEnt(ClientVM[client][1], Prop_Send, "m_hWeapon", GetEntPropEnt(ClientVM[client][0], Prop_Send, "m_hWeapon"));
            
            SetEntProp(ClientVM[client][1], Prop_Send, "m_nSequence", GetEntProp(ClientVM[client][0], Prop_Send, "m_nSequence"));
            SetEntPropFloat(ClientVM[client][1], Prop_Send, "m_flPlaybackRate", GetEntPropFloat(ClientVM[client][0], Prop_Send, "m_flPlaybackRate"));
        }
        else
        {
            new EntEffects = GetEntProp(ClientVM[client][1], Prop_Send, "m_fEffects");
            EntEffects |= EF_NODRAW;
            SetEntProp(ClientVM[client][1], Prop_Send, "m_fEffects", EntEffects);
        }
    }
    else
    {
        decl String:ClassName[30];
        GetEdictClassname(WeaponIndex, ClassName, sizeof(ClassName));
        if (StrEqual("weapon_knife", ClassName, false))
        {
            SetEntProp(ClientVM[client][1], Prop_Send, "m_nSequence", GetEntProp(ClientVM[client][0], Prop_Send, "m_nSequence"));
            SetEntPropFloat(ClientVM[client][1], Prop_Send, "m_flPlaybackRate", GetEntPropFloat(ClientVM[client][0], Prop_Send, "m_flPlaybackRate"));
        }
    }

    if (isSpawned[client])
    {
        isSpawned[client] = false;
        decl String:ClassName[30];
        GetEdictClassname(WeaponIndex, ClassName, sizeof(ClassName));
        if (StrEqual("weapon_knife", ClassName, false))
        {
            AcceptEntityInput(WeaponIndex, "hideweapon");
        }
    }
    
    OldWeapon[client] = WeaponIndex;
}

public ProjectileSpawned(entity)
{
	new client = GetEntPropEnt(entity, Prop_Send, "m_hOwnerEntity");
	
	if (client > 0)
	{
		if (GetClientTeam(client) == 2)
		{
			decl Float:origin2[3];
			GetEntPropVector(entity, Prop_Send, "m_vecOrigin", origin2);
			SetEntityModel(entity, "models/props_junk/garbage_glassbottle003a.mdl");
			EmitAmbientSound(EXPLODE_SOUND2, origin2, entity, SNDLEVEL_NORMAL );
			IgniteEntity(entity, 1.2);
			CreateTimer(1.3, Creando, entity, TIMER_FLAG_NO_MAPCHANGE);
		}
	}
}

public Action:Creando(Handle:timer, any:entity)
{
	if (!IsValidEdict(entity))
	{
		return Plugin_Stop;
	}
		
	decl String:g_szClassname[64];
	GetEdictClassname(entity, g_szClassname, sizeof(g_szClassname));
	
	if (strcmp(g_szClassname, "flashbang_projectile") == 0)
	{
		decl Float:origin[3];
		GetEntPropVector(entity, Prop_Send, "m_vecOrigin", origin);
		new client = GetEntPropEnt(entity, Prop_Send, "m_hOwnerEntity");
		
		Fuego(origin, client);
		AcceptEntityInput(entity, "kill");
	}
	
	return Plugin_Stop;
}

Fuego(Float:pos[3], client)   
{
	new fire = CreateEntityByName("env_fire");

	SetEntPropEnt(fire, Prop_Send, "m_hOwnerEntity", client);
	DispatchKeyValue(fire, "firesize", "220");
	DispatchKeyValue(fire, "health", "3");
	DispatchKeyValue(fire, "firetype", "Normal");

	new Float:damage_molotov = 5.0;
	DispatchKeyValueFloat(fire, "damagescale", damage_molotov);
	DispatchKeyValue(fire, "spawnflags", "256");
	SetVariantString("WaterSurfaceExplosion");
	AcceptEntityInput(fire, "DispatchEffect"); 
	DispatchSpawn(fire);
	TeleportEntity(fire, pos, NULL_VECTOR, NULL_VECTOR);
	AcceptEntityInput(fire, "StartFire");
	EmitAmbientSound(EXPLODE_SOUND, pos, fire, SNDLEVEL_NORMAL );

	CreateTimer(15.0, End_FIRE);
}

public Action:End_FIRE(Handle:timer)
{
	new eclair = -1;
	
	while ((eclair = FindEntityByClassname(eclair, "env_fire")) != -1)
	{
		AcceptEntityInput(eclair, "Kill");
	}	
}


public Action:OnRoundStart(Handle:event, const String:name[], bool:dontBroadcast)
{
	decl String:GameName[64];
	Format(GameName, sizeof(GameName), "★ [VG-RP (%s)] ★", PLUGIN_VERSION);
	Steam_SetGameDescription(GameName);
	
	decl String:mapname[128];
	GetCurrentMap(mapname, sizeof(mapname));
	
	if (StrEqual(mapname, "rp_riverside_b4"))
	{
		SetDistrib();
	}
	
	LockingDoor();
	UnlockDoor();
	
	SetNight();
	
	KillWeapon();
	
	Spawn_PNJ();
	
	CreateTimer(300.0, SaveCapital, _, TIMER_REPEAT);
	CreateTimer(15.0, DelWeapon, _, TIMER_REPEAT);
}

public Event_PlayerSpawn(Handle:event, const String:name[], bool:dontBroadcast)
{
	new UserId = GetEventInt(event, "userid");
	new client = GetClientOfUserId(UserId);
	
	isSpawned[client] = true;
}
	
stock Spawn_PNJ()
{		

	// GARAGE

	new monster = CreateEntityByName("prop_physics_override");
	
	DispatchKeyValue(monster, "targetname", "hostage_npc");
	DispatchKeyValue(monster, "Solid", "6");
	DispatchKeyValue(monster, "model", "models/breen.mdl");
	SetEntProp(monster, Prop_Send, "m_CollisionGroup", 5);
	SetEntProp(monster, Prop_Send, "m_usSolidFlags", 16);
	SetEntProp(monster, Prop_Send, "m_nSolidType", 6);
	
	DispatchSpawn(monster);
	AcceptEntityInput(monster, "DisableMotion", -1, -1, 0);
	SetEntProp(monster, Prop_Data, "m_takedamage", 0, 1);
	SetEntityMoveType(monster, MOVETYPE_NONE);
	TeleportEntity(monster, Float:{-2532.55, -3124.21, 30.03}, Float:{0.0, 90.0, 0.0}, NULL_VECTOR);
	SetEntPropFloat(monster, Prop_Send, "m_flModelScale", 1.5);
	
	// POLE EMPLOI
	
	new pole_1 = CreateEntityByName("prop_physics_override");
	
	DispatchKeyValue(pole_1, "targetname", "npc_gman");
	DispatchKeyValue(pole_1, "Solid", "6");
	DispatchKeyValue(pole_1, "model", "models/alyx.mdl");
	SetEntProp(pole_1, Prop_Send, "m_CollisionGroup", 5);
	SetEntProp(pole_1, Prop_Send, "m_usSolidFlags", 16);
	SetEntProp(pole_1, Prop_Send, "m_nSolidType", 6);
	
	DispatchSpawn(pole_1);
	AcceptEntityInput(pole_1, "DisableMotion", -1, -1, 0);
	SetEntProp(pole_1, Prop_Data, "m_takedamage", 0, 1);
	SetEntityMoveType(pole_1, MOVETYPE_NONE);
	TeleportEntity(pole_1, Float:{-4154.031250, 260.154174, 8.031250}, Float:{0.0, 0.0, 0.0}, NULL_VECTOR);
	SetEntPropFloat(pole_1, Prop_Send, "m_flModelScale", 1.2);
	
	new pole_2 = CreateEntityByName("prop_physics_override");
	
	DispatchKeyValue(pole_2, "targetname", "hostage_npc");
	DispatchKeyValue(pole_2, "Solid", "6");
	DispatchKeyValue(pole_2, "model", "models/alyx.mdl");
	SetEntProp(pole_2, Prop_Send, "m_CollisionGroup", 5);
	SetEntProp(pole_2, Prop_Send, "m_usSolidFlags", 16);
	SetEntProp(pole_2, Prop_Send, "m_nSolidType", 6);
	
	DispatchSpawn(pole_2);
	AcceptEntityInput(pole_2, "DisableMotion", -1, -1, 0);
	SetEntProp(pole_2, Prop_Data, "m_takedamage", 0, 1);
	SetEntityMoveType(pole_2, MOVETYPE_NONE);
	TeleportEntity(pole_2, Float:{-4154.031250, 102.000000, 8.031250}, Float:{0.0, 0.0, 0.0}, NULL_VECTOR);
	SetEntPropFloat(pole_2, Prop_Send, "m_flModelScale", 1.2);
	
	
	new ikea = CreateEntityByName("prop_physics_override");
	
	DispatchKeyValue(ikea, "targetname", "hostage_npc");
	DispatchKeyValue(ikea, "Solid", "6");
	DispatchKeyValue(ikea, "model", "models/barney.mdl");
	SetEntProp(ikea, Prop_Send, "m_CollisionGroup", 5);
	SetEntProp(ikea, Prop_Send, "m_usSolidFlags", 16);
	SetEntProp(ikea, Prop_Send, "m_nSolidType", 6);
	
	DispatchSpawn(ikea);
	AcceptEntityInput(ikea, "DisableMotion", -1, -1, 0);
	SetEntProp(ikea, Prop_Data, "m_takedamage", 0, 1);
	SetEntityMoveType(ikea, MOVETYPE_NONE);
	TeleportEntity(ikea, Float:{-2423.621826, -237.626113, 8.031250}, Float:{0.0, 90.0, 0.0}, NULL_VECTOR);
	SetEntPropFloat(ikea, Prop_Send, "m_flModelScale", 1.2);
	
	if (POLE_EMPLOI == 0)
	{
		lampe_1 = CreateEntityByName("light_dynamic");
		DispatchKeyValueFloat(lampe_1, "spotlight_radius", 80.0);
		DispatchKeyValueFloat(lampe_1, "distance", 200.0);
		DispatchKeyValue(lampe_1, "brightness", "8");
		DispatchKeyValue(lampe_1, "_light", "100 0 0 100");
		DispatchKeyValue(lampe_1, "style", "0");					
		DispatchKeyValue(lampe_1, "renderamt", "200");
		DispatchSpawn(lampe_1);
		TeleportEntity(lampe_1, Float:{-4022.41, 325.78, 72.03}, NULL_VECTOR, NULL_VECTOR);
		AcceptEntityInput(lampe_1, "LightOn");
	
		lampe_2 = CreateEntityByName("light_dynamic");
		DispatchKeyValueFloat(lampe_2, "spotlight_radius", 80.0);
		DispatchKeyValueFloat(lampe_2, "distance", 200.0);
		DispatchKeyValue(lampe_2, "brightness", "8");
		DispatchKeyValue(lampe_2, "_light", "100 0 0 100");
		DispatchKeyValue(lampe_2, "style", "0");					
		DispatchKeyValue(lampe_2, "renderamt", "200");
		DispatchSpawn(lampe_2);
		TeleportEntity(lampe_2, Float:{-4022.41, 13.65, 72.03}, NULL_VECTOR, NULL_VECTOR);
		AcceptEntityInput(lampe_2, "LightOn");
	}
}
	
stock LockingDoor()
{
	LockingEntity("func_door_rotating");
	LockingEntity("prop_door_rotating");
	LockingEntity("func_door");
}

stock LockingEntity(const String:ClassName[])
{
    new entity = -1;
    while ((entity = FindEntityByClassname(entity, ClassName)) != INVALID_ENT_REFERENCE)
    {
        if(IsValidEdict(entity) && IsValidEntity(entity))
        {
            SetEntProp(entity, Prop_Data, "m_bLocked", 1, 1);
        }
    }
}

public Menu_T(Handle:Menu, MenuAction:HandleAction, client, Parameter)
{
	if(HandleAction == MenuAction_Select)
	{	
		if(Parameter == 0)
		{
		    BuildItemMenu(client);
		}
	}
}

public Action:Lancer(client, args)
{
	new String:sWeapon[32];
	GetClientWeapon(client, sWeapon, sizeof(sWeapon));
	
	if (IsPlayerAlive(client))
	{
		if (StrEqual(sWeapon, "weapon_knife"))
		{
			BuildItemMenu(client);	
		}
	}
} 

stock Menu(client) 
{
	new Handle:menu = INVALID_HANDLE;
	
	menu = CreateMenu(Menu_T);
			
	SetMenuTitle(menu, "Vous pouvez ouvrir votre inventaire\n ");
	AddMenuItem(menu, "", "- Inventaire");	
		
	SetMenuExitButton(menu, true);
	DisplayMenu(menu, client, MENU_TIME_FOREVER);                   
}

public UnlockDoor()
{
	new maxent = GetMaxEntities(), String:szClass[65];
	new String:Name[200];
	
	for (new i = MaxClients; i <= maxent; i++)
	{
        if(IsValidEdict(i) && IsValidEntity(i))
        {
			Entity_GetName(i, Name, sizeof(Name));
			GetEdictClassname(i, szClass, sizeof(szClass));
			
			if (StrEqual(szClass, "func_door_rotating") || StrEqual(szClass, "func_door") || StrEqual(szClass, "prop_door_rotating"))
			{
				new HAMMERID = Entity_GetHammerId(i);
				if (StrEqual(Name, "police_conduit") || StrEqual(Name, "aparte_hall") || StrEqual(Name, "mcdo_door") || StrEqual(Name, "hotel_tower_elevator_door") || StrEqual(Name, "dealer_lift") || StrEqual(Name, "hotel_tower_elevator_up") || StrEqual(Name, "hotel_tower_elevator_itself") || StrEqual(Name, "armurie_door") || StrEqual(Name, "hotel_tower_elevator_down") || StrEqual(Name, "centre_commercial_01") || StrEqual(Name, "police_d01") || StrEqual(Name, "police_d02") || StrEqual(Name, "hopital_hall") || StrEqual(Name, "bank_door_right") || StrEqual(Name, "bank_door_left") || StrEqual(Name, "hotel_tower_elevator_itself") || StrEqual(Name, "hotel_door"))
				{
					SetEntProp(i, Prop_Data, "m_bLocked", 0, 1);
				}			
				else if (HAMMERID == 3107186 || HAMMERID == 3107189)
				{
					SetEntProp(i, Prop_Data, "m_bLocked", 0, 1);
				}
			}
			else if (StrEqual(szClass, "prop_physics"))
			{
				if (IsInIkea(i))
				{
					AcceptEntityInput(i, "Kill");
				}
			}
		}
	}
}

public KillWeapon()
{
	new maxent = GetMaxEntities(), String:szClass[65];
	
	for (new i = MaxClients; i <= maxent; i++)
	{
        if(IsValidEdict(i) && IsValidEntity(i))
        {
			GetEdictClassname(i, szClass, sizeof(szClass));
			
			if(StrContains(szClass, "weapon_", false) != -1)
			{
				RemoveEdict(i);
			}
		}
	}
}

public startheure()
{
	Timers = CreateTimer(1.0, Timer_Horloge, _, TIMER_REPEAT);
}

public Action:Timer_Horloge(Handle:timer)
{
	g_countminute2 += 1;
	
	if (g_countminute2 >= 10)
	{
		g_countminute2 = 0;
		g_countminute1 = g_countminute1 + 1;
		
		if ((g_countminute1 >= 6) && (g_countminute2 >= 0))
		{
			g_countminute1 = 0;
			g_countheure2 = g_countheure2 + 1;
			
			if (g_countheure2 >= 10)
			{
				g_countheure2 = 0;
				g_countheure1 = g_countheure1 + 1;
			}
		}
	}
	
	if (g_countheure1 == 0 && g_countheure2 == 5 && g_countminute1 == 0 && g_countminute2 == 0)
	{
		Temps = 0;
		Orage();
	}
	
	if (g_countheure1 == 0 && g_countheure2 == 6 && g_countminute1 == 0 && g_countminute2 == 0)
	{
		SetLight1();
	}
	
	if (g_countheure1 == 0 && g_countheure2 == 7 && g_countminute1 == 0 && g_countminute2 == 0)
	{
		SetLight2();
	}
	
	if (g_countheure1 == 0 && g_countheure2 == 8 && g_countminute1 == 0 && g_countminute2 == 0)
	{
		SetLight();
	}
	
	if (g_countheure1 == 1 && g_countheure2 == 4 && g_countminute1 == 0 && g_countminute2 == 0)
	{
		for (new i = 1; i <= MaxClients; i++)
		{
			if (IsClientInGame(i) && IsPlayerAlive(i) && GetClientTeam(i) == 2 && g_jailtime[i] > 0)
			{
				CreateSortie(i);
			}
		}
	}
	
	if (g_countheure1 == 1 && g_countheure2 == 8 && g_countminute1 == 0 && g_countminute2 == 0)
	{
		for (new i = 1; i <= MaxClients; i++)
		{
			if (IsClientInGame(i) && IsPlayerAlive(i) && GetClientTeam(i) == 2 && g_jailtime[i] > 0 && IsInCour(i))
			{
				GoJail(i);
				
				disarm(i);
				GivePlayerItem(i, "weapon_knife");
			}
		}
	}
	
	if (g_countheure1 == 0 && g_countheure2 == 9 && g_countminute1 == 0 && g_countminute2 == 0)
	{
		Ouverture_POLE();
	}
	if (g_countheure1 == 1 && g_countheure2 == 9 && g_countminute1 == 0 && g_countminute2 == 0)
	{
		Fermeture_POLE();
	}
	
	if (g_countheure1 == 2 && g_countheure2 == 0 && g_countminute1 == 3 && g_countminute2 == 0)
	{
		Ouverture_CASINO();
	}
	if (g_countheure1 == 0 && g_countheure2 == 8 && g_countminute1 == 0 && g_countminute2 == 0)
	{
		Fermeture_CASINO();
	}
	
	if (g_countheure1 == 2 && g_countheure2 == 0 && g_countminute1 == 3 && g_countminute2 == 0)
	{
		SetNight();		
	}
	
	if (g_countheure1 == 2 && g_countheure2 == 2 && g_countminute1 == 2 && g_countminute2 == 8)
	{
		SetNight();	
		new random = GetRandomInt(0, 5);
				
		if (random == 3)
		{
			Temps = 1;
			Orage();
		}
	}
	
	if ((g_countheure1 >= 2) && (g_countheure2 >= 4))
	{
		g_countheure1 = 0;
		g_countheure2 = 0;
		
		g_days += 1;
		
		SalaryTime();
	}
	
	if (g_days >= 30)
	{
		g_month += 1;
		
		g_days = 1;
	}
	
	if (g_month >= 12)
	{
		g_month = 1;
		g_years += 1;
	}
}

stock Orage()
{
	if (Temps == 1)
	{			
		decl String:MapName[128];
		decl String:buffer[128];
		GetCurrentMap(MapName, sizeof(MapName));
		Format(buffer, sizeof(buffer), "maps/%s.bsp", MapName);
		new ent = CreateEntityByName("func_precipitation");
		DispatchKeyValue(ent, "model", buffer);
		DispatchKeyValue(ent, "preciptype", "1");
		DispatchSpawn(ent);
		ActivateEntity(ent);
		new Float:minbounds[3];
		GetEntPropVector(0, Prop_Data, "m_WorldMins", minbounds); 
		new Float:maxbounds[3];
		GetEntPropVector(0, Prop_Data, "m_WorldMaxs", maxbounds); 	
				
		SetEntPropVector(ent, Prop_Send, "m_vecMins", minbounds);
		SetEntPropVector(ent, Prop_Send, "m_vecMaxs", maxbounds);    
		new Float:m_vecOrigin[3];
		m_vecOrigin[0] = (minbounds[0] + maxbounds[0])/2;
		m_vecOrigin[1] = (minbounds[1] + maxbounds[1])/2;
		m_vecOrigin[2] = (minbounds[2] + maxbounds[2])/2;
		TeleportEntity(ent, m_vecOrigin, NULL_VECTOR, NULL_VECTOR);
	}
	else
	{
		new pluie = -1;
		while ((pluie = FindEntityByClassname(pluie, "func_precipitation")) != -1)
		{
			AcceptEntityInput(pluie, "Kill");
		}	
	}
}

public Action:OnPlayerTeam(Handle:event, const String:name[], bool:dontBroadcast)
{
    return Plugin_Handled;
}

public Action:OnPlayerDeath(Handle:event, const String:name[], bool:dontBroadcast)
{
	new MoneyOffset = FindSendPropOffs("CCSPlayer", "m_iAccount");
	new client = GetClientOfUserId(GetEventInt(event, "userid"));
	new killer = GetClientOfUserId(GetEventInt(event, "attacker"));
		
	new bool:head = GetEventBool(event, "headshot");
	
	new InVehicle = GetEntPropEnt(client, Prop_Send, "m_hVehicle");
		
	if (InVehicle != -1)
	{		
		ExitVehicle(client, InVehicle, 1);
	}
	
	decl String:killername[32];
	
	argent[killer] = GetEntData(killer, MoneyOffset, 4);
	
	if (client)
	{
		if (IsClientInGame(client))
		{
			if (!IsPlayerAlive(client))
			{
				ClientCommand(client, "r_screenoverlay debug/yuv.vmt");
				g_CountDead[client] = 25;
				g_deadtimer[client] = CreateTimer(1.0, Timer_Dead, client, TIMER_REPEAT);
				g_IsTazed[client] = false;
				CarHorn[client] = false;
			}
			
			if (killer > 0)
			{
				if (IsClientInGame(killer))
				{
					if (killer != client)
					{
						GetClientName(killer, killername, sizeof(killername));
						Format(sLastkiller, sizeof(sLastkiller), "%N", killer);
						
						if ((GetClientTeam(killer) == 2) && (GetClientTeam(client) == 3))
						{
							argent[killer] -= 300;
							SetEntData(killer, MoneyOffset, argent[killer], 4, true);
						}
						else if ((GetClientTeam(killer) == 3) && (GetClientTeam(client) == 2))
						{
							argent[killer] -= 300;
							SetEntData(killer, MoneyOffset, argent[killer], 4, true);
						}
						else if ((GetClientTeam(killer) == 2) && (GetClientTeam(client) == 2))
						{
							argent[killer] += 3300;
							SetEntData(killer, MoneyOffset, argent[killer], 4, true);
						}
						else if ((GetClientTeam(killer) == 3) && (GetClientTeam(client) == 3))
						{
							argent[killer] += 3300;
							SetEntData(killer, MoneyOffset, argent[killer], 4, true);
						}
						
						LogToFile(Logfile,"Le Joueur %N à tué %N.", killer, client);
						
						DestroyLevel(killer);
						
						if (head)
						{
							countheadshot[killer] += 1;		
						}
						
						if (cibleID[killer] == 0)
						{
							SupMoney(killer, 100);
						}
						
						if (rankid[killer] == 11)
						{
							if (encontrat[killer])
							{
								HasKillCible[killer] = true;
							}
						}
						
						if (rankid[client] == 1 && jobid[client] == 1)
						{
							decl String:weapon[32];
							GetEventString(event, "weapon", weapon, sizeof(weapon));
							
							new healthLeft = GetClientHealth(killer);
							new Float:distance = Entity_GetDistance(client, killer);
							distance = Math_UnitsToMeters(distance);
							new armour = GetEntProp(killer, Prop_Send, "m_ArmorValue");
							
							new Handle:panel = CreatePanel();
							decl String:buffer[128];
							Format(buffer, sizeof(buffer), "Votre tueur est : %N", killer);
							SetPanelTitle(panel, buffer, false);
							Format(buffer, sizeof(buffer), "Arme: %s", weapon);
							DrawPanelItem(panel, buffer, ITEMDRAW_DISABLED);
							Format(buffer, sizeof(buffer), "Vie restante: %i", healthLeft);
							DrawPanelItem(panel, buffer, ITEMDRAW_DISABLED);
							Format(buffer, sizeof(buffer), "Armure restante: %i", armour);
							DrawPanelItem(panel, buffer, ITEMDRAW_DISABLED);
							Format(buffer, sizeof(buffer), "Distance: %f mètres", distance);
							DrawPanelItem(panel, buffer, ITEMDRAW_DISABLED);
							
							DrawPanelItem(panel, "Fermer le menu");
							
							SetPanelCurrentKey(panel, 10);
							SendPanelToClient(panel, client, Handler_DoNothing, 0);
						}
					}
				}
			}
		}
	}
	
	gObj[client] = -1;
	
	if (g_IsTazed[client] == true)
	{
		g_IsTazed[client] = false;
	}
	
	new EntEffects = GetEntProp(ClientVM[client][1], Prop_Send, "m_fEffects");
	EntEffects |= EF_NODRAW;
	SetEntProp(ClientVM[client][1], Prop_Send, "m_fEffects", EntEffects);
}

public Action:Timer_Dead(Handle:timer, any:client)
{
	if (IsClientInGame(client))
	{
		if (!IsPlayerAlive(client))
		{
			g_CountDead[client] -= 1;
			g_booldead[client] = true;
			
			if (g_CountDead[client] == 0)
			{
				if (Chargement[client])
				{
					Chargement[client] = false;
				}
				CreateTimer(1.0, Effet_SPAWN, client);
				CPrintToChat(client, "%s {blue}Vous avez été respawn.", LOGO);
				
				ClientCommand(client, "r_screenoverlay 0");
								
				g_IsTazed[client] = false;
								
				decl String:ClanTagRankName[20];
				GetClanTagName(jobid[client], rankid[client], ClanTagRankName, sizeof(ClanTagRankName));
				
				CS_SetClientClanTag(client, ClanTagRankName);
				
				if (rankid[client] == 1 || jobid[client] == 3 && rankid[client] == 10 || jobid[client] == 1 && rankid[client] == 10 || jobid[client] == 6 && rankid[client] == 10)
				{
					CS_SwitchTeam(client, 3);
					CS_RespawnPlayer(client);
					disarm(client);
					GivePlayerItem(client, "weapon_knife");
					SetEntityHealth(client, 375);
						
					if (rankid[client] == 1 && jobid[client] == 6)
					{
						ModifySpeed(client, 1.4);
					}
				}
				else
				{
					CS_SwitchTeam(client, 2);
					CS_RespawnPlayer(client);
					disarm(client);
					GivePlayerItem(client, "weapon_knife");
					SetEntityHealth(client, 75);
					Taille(client);
				}
				
				choose_skin(client);
				
				if (jobid[client] == 33)
				{
					SetEntityHealth(client, 500);
				}
				
				if (g_jailtime[client] > 0)
				{
					GoJail(client);
					
					g_IsInJail[client] = 1;
					
					SetClientListeningFlags(client, VOICE_MUTED);
				}
				else
				{
					if (Location[client] > 0)
					{
						switch (Location[client])
						{
							case 1:
							{
								CPrintToChat(client, "%s {blue}Vous avez spawn dans votre appartement !", LOGO);
								TeleportEntity(client, Float:{ -1748.659179, -420.880126, 392.031250 }, NULL_VECTOR, NULL_VECTOR);
							}		
							case 2:
							{
								CPrintToChat(client, "%s {blue}Vous avez spawn dans votre appartement !", LOGO);
								TeleportEntity(client, Float:{ -2387.070556, -307.691223, 392.031250 }, NULL_VECTOR, NULL_VECTOR);
							}			
							case 3:
							{
								CPrintToChat(client, "%s {blue}Vous avez spawn dans votre appartement !", LOGO);
								TeleportEntity(client, Float:{ -2475.048828, -213.551818, 392.031250 }, NULL_VECTOR, NULL_VECTOR);
							}
							case 4:
							{
								CPrintToChat(client, "%s {blue}Vous avez spawn dans votre appartement !", LOGO);
								TeleportEntity(client, Float:{ -3363.696289, -5103.669921, 168.031250 }, NULL_VECTOR, NULL_VECTOR);
							}		
							case 5:
							{
								CPrintToChat(client, "%s {blue}Vous avez spawn dans votre appartement !", LOGO);
								TeleportEntity(client, Float:{ -3732.224121, -5124.871582, 168.031250 }, NULL_VECTOR, NULL_VECTOR);
							}			
							case 6:
							{
								CPrintToChat(client, "%s {blue}Vous avez spawn dans votre appartement !", LOGO);
								TeleportEntity(client, Float:{ -3732.224121, -5124.871582, 168.031250 }, NULL_VECTOR, NULL_VECTOR);
							}
							case 7:
							{
								CPrintToChat(client, "%s {blue}Vous avez spawn dans votre appartement !", LOGO);
								TeleportEntity(client, Float:{ -3244.599609, -4768.060058, 168.031250 }, NULL_VECTOR, NULL_VECTOR);
							}		
							case 8:
							{
								CPrintToChat(client, "%s {blue}Vous avez spawn dans votre appartement !", LOGO);
								TeleportEntity(client, Float:{ -3364.032958, -5112.079101, 304.031250 }, NULL_VECTOR, NULL_VECTOR);
							}			
							case 9:
							{
								CPrintToChat(client, "%s {blue}Vous avez spawn dans votre appartement !", LOGO);
								TeleportEntity(client, Float:{ -3710.192382, -5107.865234, 304.031250 }, NULL_VECTOR, NULL_VECTOR);
							}
							case 10:
							{
								CPrintToChat(client, "%s {blue}Vous avez spawn dans votre appartement !", LOGO);
								TeleportEntity(client, Float:{ -3598.606445, -4768.201660, 304.031250 }, NULL_VECTOR, NULL_VECTOR);
							}		
							case 11:
							{
								CPrintToChat(client, "%s {blue}Vous avez spawn dans votre appartement !", LOGO);
								TeleportEntity(client, Float:{ -3240.430664, -4773.467285, 304.031250 }, NULL_VECTOR, NULL_VECTOR);
							}	
							case 12:
							{
								CPrintToChat(client, "%s {blue}Vous avez spawn dans votre appartement !", LOGO);
								TeleportEntity(client, Float:{ -3370.760498, -5108.037597, 440.031250 }, NULL_VECTOR, NULL_VECTOR);
							}		
							case 13:
							{
								CPrintToChat(client, "%s {blue}Vous avez spawn dans votre appartement !", LOGO);
								TeleportEntity(client, Float:{ -3721.737548, -5114.001464, 440.031250 }, NULL_VECTOR, NULL_VECTOR);
							}			
							case 14:
							{
								CPrintToChat(client, "%s {blue}Vous avez spawn dans votre appartement !", LOGO);
								TeleportEntity(client, Float:{ -3602.884765, -4765.151367, 440.031250 }, NULL_VECTOR, NULL_VECTOR);
							}
							case 15:
							{
								CPrintToChat(client, "%s {blue}Vous avez spawn dans votre appartement !", LOGO);
								TeleportEntity(client, Float:{ -3252.285888, -4783.048339, 440.031250 }, NULL_VECTOR, NULL_VECTOR);
							}		
							case 16:
							{
								CPrintToChat(client, "%s {blue}Vous avez spawn dans votre appartement !", LOGO);
								TeleportEntity(client, Float:{ 912.488220, -1476.127563, 392.031250 }, NULL_VECTOR, NULL_VECTOR);
							}	
							case 17:
							{
								CPrintToChat(client, "%s {blue}Vous avez spawn dans votre appartement !", LOGO);
								TeleportEntity(client, Float:{ 1036.918701, -621.259033, 392.031250 }, NULL_VECTOR, NULL_VECTOR);
							}	
							case 18:
							{
								CPrintToChat(client, "%s {blue}Vous avez spawn dans votre Villa !", LOGO);
								TeleportEntity(client, Float:{ -5530.333984, 947.559631, 17.031250 }, NULL_VECTOR, NULL_VECTOR);
							}
							case 19:
							{
								CPrintToChat(client, "%s {blue}Vous avez spawn dans votre Laboratoire Diabolique !", LOGO);
								TeleportEntity(client, Float:{ 6682.413574, -422.239196, 12.031250 }, NULL_VECTOR, NULL_VECTOR);
							}			
						}
					}
					else
					{
						switch (GetRandomInt(1, 8))
						{
							case 1:
							{
								TeleportEntity(client, Float:{ 602.174133, -2601.141845, 8.149879 }, NULL_VECTOR, NULL_VECTOR);
							}
							
							case 2:
							{
								TeleportEntity(client, Float:{ -2174.149414, -4654.056640, 168.031250 }, NULL_VECTOR, NULL_VECTOR);
							}
							
							case 3:
							{
								TeleportEntity(client, Float:{ -3497.720214, 529.279968, 8.031250 }, NULL_VECTOR, NULL_VECTOR);
							}
							
							case 4:
							{
								TeleportEntity(client, Float:{ -346.727020, -463.894897, 8.031250 }, NULL_VECTOR, NULL_VECTOR);
							}
							
							case 5:
							{
								TeleportEntity(client, Float:{ 538.034912, -5209.307617, 8.031250 }, NULL_VECTOR, NULL_VECTOR);
							}
							
							case 6:
							{
								TeleportEntity(client, Float:{ -4400.340332, -3971.621826, 160.031250 }, NULL_VECTOR, NULL_VECTOR);
							}
							
							case 7:
							{
								TeleportEntity(client, Float:{ -4295.556152, -1062.593627, 8.031250 }, NULL_VECTOR, NULL_VECTOR);
							}
							
							case 8:
							{
								TeleportEntity(client, Float:{ -893.704223, -2126.462158, 8.031250 }, NULL_VECTOR, NULL_VECTOR);
							}				
						}
					}
				}
				
				KillTimer(g_deadtimer[client]);
				g_booldead[client] = false;
			}
		}
	}
}

stock Taille(x)
{
	switch (GetRandomInt(1, 3))
	{
		case 1:
		{
			SetEntPropFloat(x, Prop_Send, "m_flModelScale", 0.9);	
		}
		
		case 2:
		{
			SetEntPropFloat(x, Prop_Send, "m_flModelScale", 1.0);	
		}
		
		case 3:
		{
			SetEntPropFloat(x, Prop_Send, "m_flModelScale", 1.1);	
		}
	}
}

public Action:OnClientPreAdminCheck(client)
{
	Policier_TEMP[client] = false;
	OnKit[client] = false;
	flashb[client] = false;
	paintball[client] = false;
	fiche[client] = false;
	gObj[client] = -1;
	printer[client] = 0;
	activate[client] = 0;
	g_invisible[client] = 0;
	g_countfire[client] = 0;
	g_godmod[client] = 0;
	nojail[client] = false;
	IsCivil[client] = false;
	CarHorn[client] = false;
	IsExitVehicle[client] = false;
	
	SDKHook(client, SDKHook_OnTakeDamage, OnTakeDamage);
	
	CreateTimer(2.0, CreateSQLAccount, client);

	g_CountDead[client] = 20;
	Chargement[client] = true;
	TimerHud[client] = CreateTimer(1.0, HudTimer, client, TIMER_REPEAT);
	g_deadtimer[client] = CreateTimer(1.0, Timer_Dead, client, TIMER_REPEAT);
}

public Action:CreateSQLAccount(Handle:Timer, any:client)
{
	if (IsClientInGame(client))
	{
		new String:SteamId[64];
		GetClientAuthString(client, SteamId, 64);
	
		if(StrEqual(SteamId, ""))
		{
			CreateTimer(2.0, CreateSQLAccount, client);
		}
		else
		{	
			InQuery = true;
			InitializeClientonDB(client);
		}
	}
}

InitializeClientonDB(client)
{
	decl String:SteamId[256];
	decl String:buffer[999];
	decl String:Name[120];
	
	GetClientAuthString(client, SteamId, sizeof(SteamId));
	GetClientName(client, Name, sizeof(Name));
	
	decl String:error[256];
	new Handle:db_rp = SQL_Connect("roleplay", true, error, sizeof(error));
	
	Format(buffer, sizeof(buffer), "SELECT cash, bank, jobid, jailtime, isinjail, permislourd, permisleger, cb, rib, rankid, lastontime, groupe, house, mdp FROM Roleplay_Players WHERE steam_id = '%s';", SteamId);
	new Handle:query = SQL_Query(db_rp, buffer);
	
	if (query)
	{
		SQL_Rewind(query);
		
		new bool:fetch = SQL_FetchRow(query);
		
		if (!fetch)
		{
			InsertPlayer(client);
		}
		else
		{
			money[client] = SQL_FetchInt(query, 0);
			bank[client] = SQL_FetchInt(query, 1);
			jobid[client] = SQL_FetchInt(query, 2);
			g_jailtime[client] = SQL_FetchInt(query, 3);
			g_IsInJail[client] = SQL_FetchInt(query, 4);
			permislourd[client] = SQL_FetchInt(query, 5);
			permisleger[client] = SQL_FetchInt(query, 6);
			cb[client] = SQL_FetchInt(query, 7);
			rib[client] = SQL_FetchInt(query, 8);
			rankid[client] = SQL_FetchInt(query, 9);
			lastontime[client] = SQL_FetchInt(query, 10);
			Group[client] = SQL_FetchInt(query, 11);
			Location[client] = SQL_FetchInt(query, 12);
			MDP[client] = SQL_FetchInt(query, 13);
			
			if (money[client] < 0)
			{
				money[client] = 0;
			}
			
			if (bank[client] < 0)
			{
				bank[client] = 0;
			}
			
			if (g_jailtime[client] < 0)
			{
				g_jailtime[client] = 0;
			}
		}
		
		CloseHandle(query);
	}
	
	Format(buffer, sizeof(buffer), "SELECT Lambo, Audi_TT, Audi_S5, Citroen, LandRover, AST_Dbs FROM Roleplay_Voitures WHERE steam_id = '%s';", SteamId);
	new Handle:voituresq = SQL_Query(db_rp, buffer);
	
	if (voituresq)
	{
		SQL_Rewind(voituresq);
		
		new bool:fetch = SQL_FetchRow(voituresq);
		
		if (!fetch)
		{
			InsertPlayer(client);
		}
		else
		{			
			Lambo[client] 		 = SQL_FetchInt(voituresq, 0);
			Audi_TT[client] 	 = SQL_FetchInt(voituresq, 1);
			Audi_S5[client] 	 = SQL_FetchInt(voituresq, 2);
			Citroen[client]		 = SQL_FetchInt(voituresq, 3);
			LandRover[client] 	 = SQL_FetchInt(voituresq, 4);
			AST_Dbs[client]		 = SQL_FetchInt(voituresq, 5);
			
			// VOITURES JOUEURS LOAD
		}
		CloseHandle(voituresq);
	}
	
	
	Format(buffer, sizeof(buffer), "SELECT lsd, hero, exta, cocaine, weed, entrainement, glock, usp, p228, deagle, elites, fiveseven, m3, xm1014, galil, ak47, scout, sg552, awp, g3sg1, famas, m4a1, aug, sg550, mac10, tmp, mp5, ump45, p90, m249, t10, t50, t100, t500, kits, he, fumi, flash, kevlar, cartouche, kitcrochetage, levelcut, flashball, imprimerie, oeil, regen, hamburger, frites, sunday, bigmac, macflurry, lancer, distrib, sofa, biblio, dryer, kite, permis FROM `Roleplay_Item` WHERE steam_id = '%s';", SteamId);
	new Handle:queryyy = SQL_Query(db_rp, buffer);
	
	if (queryyy)
	{
		if (SQL_FetchRow(queryyy))
		{
			lsd[client] = SQL_FetchInt(queryyy, 0);
			heroine[client] = SQL_FetchInt(queryyy, 1);
			exta[client] = SQL_FetchInt(queryyy, 2);
			cocaine[client] = SQL_FetchInt(queryyy, 3);
			weed[client] = SQL_FetchInt(queryyy, 4);
			entrainement[client] = SQL_FetchInt(queryyy, 5);
			glock[client] = SQL_FetchInt(queryyy, 6);
			usp[client] = SQL_FetchInt(queryyy, 7);
			p228[client] = SQL_FetchInt(queryyy, 8);
			deagle[client] = SQL_FetchInt(queryyy, 9);
			elites[client] = SQL_FetchInt(queryyy, 10);
			fiveseven[client] = SQL_FetchInt(queryyy, 11);
			m3[client] = SQL_FetchInt(queryyy, 12);
			xm1014[client] = SQL_FetchInt(queryyy, 13);
			galil[client] = SQL_FetchInt(queryyy, 14);
			ak47[client] = SQL_FetchInt(queryyy, 15);
			scout[client] = SQL_FetchInt(queryyy, 16);
			sg552[client] = SQL_FetchInt(queryyy, 17);
			awp[client] = SQL_FetchInt(queryyy, 18);
			g3sg1[client] = SQL_FetchInt(queryyy, 19);
			famas[client] = SQL_FetchInt(queryyy, 20);
			m4a1[client] = SQL_FetchInt(queryyy, 21);
			aug[client] = SQL_FetchInt(queryyy, 22);
			sg550[client] = SQL_FetchInt(queryyy, 23);
			mac10[client] = SQL_FetchInt(queryyy, 24);
			tmp[client] = SQL_FetchInt(queryyy, 25);
			mp5[client] = SQL_FetchInt(queryyy, 26);
			ump45[client] = SQL_FetchInt(queryyy, 27);
			p90[client] = SQL_FetchInt(queryyy, 28);
			m249[client] = SQL_FetchInt(queryyy, 29);
			ticket10[client] = SQL_FetchInt(queryyy, 30);
			ticket50[client] = SQL_FetchInt(queryyy, 31);
			ticket100[client] = SQL_FetchInt(queryyy, 32);
			ticket500[client] = SQL_FetchInt(queryyy, 33);
			kit[client] = SQL_FetchInt(queryyy, 34);
			grenade[client] = SQL_FetchInt(queryyy, 35);
			fumigene[client] = SQL_FetchInt(queryyy, 36);
			flashbang[client] = SQL_FetchInt(queryyy, 37);
			kevlar[client] = SQL_FetchInt(queryyy, 38);
			cartouche[client] = SQL_FetchInt(queryyy, 39);
			kitcrochetage[client] = SQL_FetchInt(queryyy, 40);
			levelcut[client] = SQL_FetchInt(queryyy, 41);
			flashball[client] = SQL_FetchInt(queryyy, 42);
			imprimerie[client] = SQL_FetchInt(queryyy, 43);
			oeil[client] = SQL_FetchInt(queryyy, 44);
			regenerateur[client] = SQL_FetchInt(queryyy, 45);
			hamburger[client] = SQL_FetchInt(queryyy, 46);
			frites[client] = SQL_FetchInt(queryyy, 47);
			sunday[client] = SQL_FetchInt(queryyy, 48);
			bigmac[client] = SQL_FetchInt(queryyy, 49);
			macflurry[client] = SQL_FetchInt(queryyy, 50);
			lancercut[client] = SQL_FetchInt(queryyy, 51);
			distributeur[client] = SQL_FetchInt(queryyy, 52);
			sofa[client] = SQL_FetchInt(queryyy, 53);
			bibliotheque[client] = SQL_FetchInt(queryyy, 54);
			dryer[client] = SQL_FetchInt(queryyy, 55);
			kitexplosif[client] = SQL_FetchInt(queryyy, 56);
			permis[client] = SQL_FetchInt(queryyy, 57);
			SetClientThrowingKnives(client, lancercut[client]);
		}
		else
		{
			ERREURITEM(client);
		}
		
		CloseHandle(queryyy);
	}
	else
	{

	}
	
	Format(buffer, sizeof(buffer), "SELECT points, flame, mini FROM `Roleplay_Boutique` WHERE steam_id = '%s';", SteamId);
	new Handle:queryyyy = SQL_Query(db_rp, buffer);
	
	if (queryyyy)
	{
		SQL_Rewind(queryyyy);
		
		new bool:fetchh = SQL_FetchRow(queryyyy);
		
		if (!fetchh)
		{
			InsertBoutique(client);
		}
		else
		{
			points[client] = SQL_FetchInt(queryyyy, 0);
			flameAmount[client] = SQL_FetchInt(queryyyy, 1);
			Mini[client] = SQL_FetchInt(queryyyy, 2);
		}
		
		CloseHandle(queryyyy);
	}
	
	Format(buffer, sizeof(buffer), "SELECT headshot, countheadshot, successdoor, countdoor, successjail, countjail, successpyro, countpyro, successrct, countrct, successdonator, countdonator FROM `Roleplay_Succes` WHERE steam_id = '%s';", SteamId);
	new Handle:queryyyyy = SQL_Query(db_rp, buffer);
	
	if (queryyyyy)
	{
		SQL_Rewind(queryyyyy);
		
		new bool:fetchh = SQL_FetchRow(queryyyyy);
		
		if (!fetchh)
		{
			InsertSucces(client);
		}
		else
		{
			headshot[client] = SQL_FetchInt(queryyyyy, 0);
			countheadshot[client] = SQL_FetchInt(queryyyyy, 1);
			successdoor[client] = SQL_FetchInt(queryyyyy, 2);
			countdoor[client] = SQL_FetchInt(queryyyyy, 3);
			successjail[client] = SQL_FetchInt(queryyyyy, 4);
			countjail[client] = SQL_FetchInt(queryyyyy, 5);
			successpyro[client] = SQL_FetchInt(queryyyyy, 6);
			countpyro[client] = SQL_FetchInt(queryyyyy, 7);
			successrct[client] = SQL_FetchInt(queryyyyy, 8);
			countrct[client] = SQL_FetchInt(queryyyyy, 9);
			successdonator[client] = SQL_FetchInt(queryyyyy, 10);
			countdonator[client] = SQL_FetchInt(queryyyyy, 11);
		}
		
		CloseHandle(queryyyyy);
	}
	
	if (Location[client] > 0)
	{
		Format(buffer, sizeof(buffer), "SELECT timestamp FROM Roleplay_House WHERE id = '%i';", Location[client]);
		
		new Handle:queryyyyyy = SQL_Query(db_rp, buffer);
	
		if (queryyyyyy)
		{
			SQL_Rewind(queryyyyyy);
			
			new bool:fetchh = SQL_FetchRow(queryyyyyy);
			
			new timelocation;
			new time = GetTime();
			
			if (fetchh)
			{
				timelocation = SQL_FetchInt(queryyyyyy, 0);
				
				if (time >= timelocation)
				{
					CPrintToChat(client, "%s {red}Votre maison ne vous appartient plus !", LOGO);
					
					Format(buffer, sizeof(buffer), "UPDATE Roleplay_House SET timestamp = 0, occuped = 0 WHERE id = '%i';", Location[client]);
		
					SQL_FastQuery(db_rp, buffer);
					
					Location[client] = 0;
				}
			}
			
			CloseHandle(queryyyyyy);
		}
	}
		
	decl String:lastconnexion[64];
	FormatTime(lastconnexion, sizeof(lastconnexion), "%x à %X", lastontime[client]);
	
	decl String:IP[150];
	
	GetClientIP(client, IP, sizeof(IP));
	
	new Handle:hP2 = CreatePanel();
	new String:sMessage[9999];
	Format(sMessage, sizeof(sMessage), "- BIENVENUE SUR LE VG-RP -   \n \nNous vous souhaitons un bon jeu sur notre serveur \nVotre dernière connexion : %s\nVotre STEAM_ID : %s\nArgent En poche : %d\nArgent En Banque : %d", lastconnexion, SteamId, money[client], bank[client]);
	DrawPanelText(hP2, sMessage);
	SetPanelCurrentKey(hP2, 10);
	SendPanelToClient(hP2, client, Handler_DoNothing, 30);
		
	LogToFile(Logfile,"Le joueur %N (%s | %s) viens de se connecter.", client, IP, SteamId);
			
	IsDisconnect[client] = false;
	InQuery = false;
	Loaded[client] = true;
	
	InitSalary(client);
	
	CloseHandle(db_rp);
	
	EmitSoundToClient(client, "f-rp/bienvenue.wav", _, _, _, _, 0.8);
}

InsertPlayer(client)
{
	decl String:SteamId[64];
	decl String:buffer[2000];
	decl String:idunique[1024];
	decl String:Name[200];
	decl String:PseudoESC[64];
	
	GetClientAuthString(client, SteamId, sizeof(SteamId));
	GetClientName(client, Name, sizeof(Name));
	
	new e = GetRandomInt(0, 50); 
	new f = GetRandomInt(0, 50);
	new g = GetRandomInt(0, 50);
	new h = GetRandomInt(0, 50);
	
	Format(idunique, sizeof(idunique),"%i%i%i%i", e, f, g, h);
	
	decl String:error[256];
	new Handle:db_rp = SQL_Connect("roleplay", true, error, sizeof(error));
	
	SQL_EscapeString(db_rp, Name, PseudoESC, sizeof(PseudoESC));
	
	Format(buffer, sizeof(buffer),"INSERT INTO Roleplay_Players VALUES ('%s', '%s', 0, 5000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '%s')", SteamId, PseudoESC, idunique);
	new Handle:queryy = SQL_Query(db_rp, buffer);

	money[client] = 0;
	bank[client] = 5000;
	jobid[client] = 0;
	rankid[client] = 0;
	cb[client] = 0;
	rib[client] = 0;
	permislourd[client] = 0;
	permisleger[client] = 0;
	g_jailtime[client] = 0;
	g_IsInJail[client] = 0;
	lastontime[client] = 0;
	Group[client] = 0;
	Location[client] = 0;
	MDP[client] = 1;
	
	Format(buffer, sizeof(buffer),"INSERT INTO Roleplay_Item VALUES ('%s', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)", SteamId);
	queryy = SQL_Query(db_rp, buffer);
	
	Format(buffer, sizeof(buffer),"INSERT INTO Roleplay_Voitures VALUES ('%s', '%s', 0, 0, 0, 0, 0, 0, 0)", PseudoESC, SteamId);
	queryy = SQL_Query(db_rp, buffer);
	
	Lambo[client] = 0;
	Audi_TT[client] = 0;
	Audi_S5[client] = 0;
	Citroen[client] = 0;
	LandRover[client] = 0;
	AST_Dbs[client] = 0;
	
	lsd[client] = 0;
	heroine[client] = 0;
	exta[client] = 0;
	cocaine[client] = 0;
	weed[client] = 0;
	entrainement[client] = 0;
	glock[client] = 0;
	usp[client] = 0;
	p228[client] = 0;
	deagle[client] = 0;
	elites[client] = 0;
	fiveseven[client] = 0;
	m3[client] = 0;
	xm1014[client] = 0;
	galil[client] = 0;
	ak47[client] = 0;
	scout[client] = 0;
	sg552[client] = 0;
	awp[client] = 0;
	g3sg1[client] = 0;
	famas[client] = 0;
	m4a1[client] = 0;
	aug[client] = 0;
	sg550[client] = 0;
	mac10[client] = 0;
	tmp[client] = 0;
	mp5[client] = 0;
	ump45[client] = 0;
	p90[client] = 0;
	m249[client] = 0;
	ticket10[client] = 0;
	ticket50[client] = 0;
	ticket100[client] = 0;
	ticket500[client] = 0;
	kit[client] = 0;
	grenade[client] = 0;
	fumigene[client] = 0;
	flashbang[client] = 0;
	kevlar[client] = 0;
	cartouche[client] = 0;
	levelcut[client] = 0;
	kitcrochetage[client] = 0;
	flashball[client] = 0;
	imprimerie[client] = 0;
	oeil[client] = 0;
	regenerateur[client] = 0;
	hamburger[client] = 0;
	frites[client] = 0;
	sunday[client] = 0;
	bigmac[client] = 0;
	macflurry[client] = 0;
	lancercut[client] = 0;
	distributeur[client] = 0;
	sofa[client] = 0;
	bibliotheque[client] = 0;
	dryer[client] = 0;
	kitexplosif[client] = 0;
	
	CloseHandle(queryy);
	CloseHandle(db_rp);
	
	CPrintToChat(client, "%s Vous êtes nouveau sur notre Roleplay !", LOGO);
	CPrintToChatAll("%s Bienvenue à {red}%N {default}sur le serveur Roleplay", LOGO, client);
}

InsertBoutique(client)
{
	decl String:SteamId[64];
	decl String:buffer[300];
	
	GetClientAuthString(client, SteamId, sizeof(SteamId));
	
	decl String:error[256];
	new Handle:db_rp = SQL_Connect("roleplay", true, error, sizeof(error));
	
	Format(buffer, sizeof(buffer),"INSERT INTO Roleplay_Boutique VALUES ('%s', 0, 0, 0)", SteamId);
	new Handle:queryy = SQL_Query(db_rp, buffer);
	
	points[client] = 0;
	flameAmount[client] = 0;
	Mini[client] = 0;
	
	CloseHandle(queryy);
	CloseHandle(db_rp);
}

ERREURITEM(client)
{
	decl String:SteamId[64];
	decl String:buffer[300];
	
	GetClientAuthString(client, SteamId, sizeof(SteamId));
	
	decl String:error[256];
	new Handle:db_rp = SQL_Connect("roleplay", true, error, sizeof(error));
		
	Format(buffer, sizeof(buffer),"INSERT INTO Roleplay_Item VALUES ('%s', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)", SteamId);
	new Handle:queryy = SQL_Query(db_rp, buffer);
	
	if (queryy)
	{
		permis[client] = 0;
		lsd[client] = 0;
		heroine[client] = 0;
		exta[client] = 0;
		cocaine[client] = 0;
		weed[client] = 0;
		entrainement[client] = 0;
		glock[client] = 0;
		usp[client] = 0;
		p228[client] = 0;
		deagle[client] = 0;
		elites[client] = 0;
		fiveseven[client] = 0;
		m3[client] = 0;
		xm1014[client] = 0;
		galil[client] = 0;
		ak47[client] = 0;
		scout[client] = 0;
		sg552[client] = 0;
		awp[client] = 0;
		g3sg1[client] = 0;
		famas[client] = 0;
		m4a1[client] = 0;
		aug[client] = 0;
		sg550[client] = 0;
		mac10[client] = 0;
		tmp[client] = 0;
		mp5[client] = 0;
		ump45[client] = 0;
		p90[client] = 0;
		m249[client] = 0;
		ticket10[client] = 0;
		ticket50[client] = 0;
		ticket100[client] = 0;
		ticket500[client] = 0;
		kit[client] = 0;
		grenade[client] = 0;
		fumigene[client] = 0;
		flashbang[client] = 0;
		kevlar[client] = 0;
		cartouche[client] = 0;
		levelcut[client] = 0;
		kitcrochetage[client] = 0;
		flashball[client] = 0;
		imprimerie[client] = 0;
		oeil[client] = 0;
		regenerateur[client] = 0;
		hamburger[client] = 0;
		frites[client] = 0;
		sunday[client] = 0;
		bigmac[client] = 0;
		macflurry[client] = 0;
		lancercut[client] = 0;
		distributeur[client] = 0;
		sofa[client] = 0;
		bibliotheque[client] = 0;
		dryer[client] = 0;
		kitexplosif[client] = 0;
	}
}


InsertSucces(client)
{
	decl String:SteamId[64];
	decl String:buffer[300];
	
	GetClientAuthString(client, SteamId, sizeof(SteamId));
	
	decl String:error[256];
	new Handle:db_rp = SQL_Connect("roleplay", true, error, sizeof(error));
	
	Format(buffer, sizeof(buffer),"INSERT INTO Roleplay_Succes VALUES ('%s', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)", SteamId);
	new Handle:queryy = SQL_Query(db_rp, buffer);
	
	headshot[client] = 0;
	countheadshot[client] = 0;
	successdoor[client] = 0;
	countdoor[client] = 0;
	successjail[client] = 0;
	countjail[client] = 0;
	successpyro[client] = 0;
	countpyro[client] = 0;
	successrct[client] = 0;
	countrct[client] = 0;
	
	CloseHandle(queryy);
	CloseHandle(db_rp);
}

GetClanTagName(jid, rid, String:RankName[], maxlen)
{
	if (rid == 0)
	{
		if (jid == 0)
		{
			strcopy(RankName, maxlen, "Chômeur -");
		}
	}
	else if (rid == 1)
	{
		if (jid == 1)
		{
			strcopy(RankName, maxlen, "Maire -");
		}
		else if (jid == 2)
		{
			strcopy(RankName, maxlen, "DGSE -");
		}
		else if (jid == 3)
		{
			strcopy(RankName, maxlen, "Agent F.B.I -");
		}
		else if (jid == 4)
		{
			strcopy(RankName, maxlen, "Policier -");
		}
		else if (jid == 5)
		{
			strcopy(RankName, maxlen, "Gardien -");
		}
		else if (jid == 6)
		{
			strcopy(RankName, maxlen, "Agent G.T.I -");
		}
	}
	else if (rid == 2)
	{
		if (jid == 1)
		{
			strcopy(RankName, maxlen, "C. Mafia -");
		}
		else if (jid == 2)
		{
			strcopy(RankName, maxlen, "C.C Mafia -");
		}
		else if (jid == 3)
		{
			strcopy(RankName, maxlen, "Parrain -");
		}
		else if (jid == 4)
		{
			strcopy(RankName, maxlen, "Mafieux -");
		}
		else if (jid == 5)
		{
			strcopy(RankName, maxlen, "A. Mafieux -");
		}
	}
	else if (rid == 3)
	{
		if (jid == 1)
		{
			strcopy(RankName, maxlen, "C. Dealer -");
		}
		else if (jid == 2)
		{
			strcopy(RankName, maxlen, "C.C Dealer -");
		}
		else if (jid == 3)
		{
			strcopy(RankName, maxlen, "Recelleur -");
		}
		else if (jid == 4)
		{
			strcopy(RankName, maxlen, "Dealer -");
		}
		else if (jid == 5)
		{
			strcopy(RankName, maxlen, "A. Dealer -");
		}
	}
	else if (rid == 4)
	{
		if (jid == 1)
		{
			strcopy(RankName, maxlen, "C. Coach -");
		}
		else if (jid == 2)
		{
			strcopy(RankName, maxlen, "C.C Coach -");
		}
		else if (jid == 3)
		{
			strcopy(RankName, maxlen, "Entraîneur -");
		}
		else if (jid == 4)
		{
			strcopy(RankName, maxlen, "Coach -");
		}
		else if (jid == 5)
		{
			strcopy(RankName, maxlen, "A. Coach -");
		}
	}
	else if (rid == 5)
	{
		if (jid == 1)
		{
			strcopy(RankName, maxlen, "C. Armurerie -");
		}
		else if (jid == 2)
		{
			strcopy(RankName, maxlen, "C.C Armurerie -");
		}
		else if (jid == 3)
		{
			strcopy(RankName, maxlen, "Grenadier -");
		}
		else if (jid == 4)
		{
			strcopy(RankName, maxlen, "Armurier -");
		}
		else if (jid == 5)
		{
			strcopy(RankName, maxlen, "A. Armurier -");
		}
	}
	else if (rid == 6)
	{
		if (jid == 1)
		{
			strcopy(RankName, maxlen, "C. Loto -");
		}
		else if (jid == 2)
		{
			strcopy(RankName, maxlen, "C.Chef Loto -");
		}
		else if (jid == 3)
		{
			strcopy(RankName, maxlen, "Buraliste -");
		}
		else if (jid == 4)
		{
			strcopy(RankName, maxlen, "V. Tickets -");
		}
		else if (jid == 5)
		{
			strcopy(RankName, maxlen, "A.V. Tickets -");
		}
	}
	else if (rid == 7)
	{
		if (jid == 1)
		{
			strcopy(RankName, maxlen, "C. Banquier -");
		}
		else if (jid == 2)
		{
			strcopy(RankName, maxlen, "C.C Banquier -");
		}
		else if (jid == 3)
		{
			strcopy(RankName, maxlen, "Conseiller Financier -");
		}
		else if (jid == 4)
		{
			strcopy(RankName, maxlen, "Banquier -");
		}
		else if (jid == 5)
		{
			strcopy(RankName, maxlen, "A. Banquier -");
		}
	}
	else if (rid == 8)
	{
		if (jid == 1)
		{
			strcopy(RankName, maxlen, "C. Hôpital -");
		}
		else if (jid == 2)
		{
			strcopy(RankName, maxlen, "C.C Hôpital -");
		}
		else if (jid == 3)
		{
			strcopy(RankName, maxlen, "Chirurgien -");
		}
		else if (jid == 4)
		{
			strcopy(RankName, maxlen, "Infirmier -");
		}
		else if (jid == 5)
		{
			strcopy(RankName, maxlen, "A. Infirmier -");
		}
	}
	else if (rid == 9)
	{
		if (jid == 1)
		{
			strcopy(RankName, maxlen, "C. Artificier -");
		}
		else if (jid == 2)
		{
			strcopy(RankName, maxlen, "C.C Artificier -");
		}
		else if (jid == 3)
		{
			strcopy(RankName, maxlen, "V. Grenades -");
		}
		else if (jid == 4)
		{
			strcopy(RankName, maxlen, "Artificier -");
		}
		else if (jid == 5)
		{
			strcopy(RankName, maxlen, "A. Artificier -");
		}
	}
	else if (rid == 10)
	{
		if (jid == 1)
		{
			strcopy(RankName, maxlen, "C. Justice -");
		}
		else if (jid == 2)
		{
			strcopy(RankName, maxlen, "C.C Justice -");
		}
		else if (jid == 3)
		{
			strcopy(RankName, maxlen, "Garde ONU -");
		}
		else if (jid == 4)
		{
			strcopy(RankName, maxlen, "Juge -");
		}
		else if (jid == 5)
		{
			strcopy(RankName, maxlen, "Avocat -");
		}
		else if (jid == 6)
		{
			strcopy(RankName, maxlen, "Marshall -");
		}
	}
	else if (rid == 11)
	{
		if (jid == 1)
		{
			strcopy(RankName, maxlen, "C. Tueur -");
		}
		else if (jid == 2)
		{
			strcopy(RankName, maxlen, "C.Chef Tueur -");
		}
		else if (jid == 3)
		{
			strcopy(RankName, maxlen, "Tueur d'élite -");
		}
		else if (jid == 4)
		{
			strcopy(RankName, maxlen, "Tueur Pro -");
		}
		else if (jid == 5)
		{
			strcopy(RankName, maxlen, "Tueur Novice -");
		}
	}
	else if (rid == 12)
	{
		if (jid == 1)
		{
			strcopy(RankName, maxlen, "C. Technicien");
		}
		else if (jid == 2)
		{
			strcopy(RankName, maxlen, "C.C Technicien");
		}
		else if (jid == 3)
		{
			strcopy(RankName, maxlen, "Technicien Pro -");
		}
		else if (jid == 4)
		{
			strcopy(RankName, maxlen, "Technicien -");
		}
		else if (jid == 5)
		{
			strcopy(RankName, maxlen, "A. Technicien -");
		}
	}
	else if (rid == 13)
	{
		if (jid == 1)
		{
			strcopy(RankName, maxlen, "Mac -");
		}
		else if (jid == 2)
		{
			strcopy(RankName, maxlen, "C.C Mac -");
		}
		else if (jid == 3)
		{
			strcopy(RankName, maxlen, "Prostituée de luxe -");
		}
		else if (jid == 4)
		{
			strcopy(RankName, maxlen, "Prostituée -");
		}
		else if (jid == 5)
		{
			strcopy(RankName, maxlen, "A. Prostituée -");
		}
	}
	else if (rid == 14)
	{
		if (jid == 1)
		{
			strcopy(RankName, maxlen, "C. Détective -");
		}
		else if (jid == 2)
		{
			strcopy(RankName, maxlen, "C.C Détective -");
		}
		else if (jid == 3)
		{
			strcopy(RankName, maxlen, "Détective Privé -");
		}
		else if (jid == 4)
		{
			strcopy(RankName, maxlen, "Détective -");
		}
		else if (jid == 5)
		{
			strcopy(RankName, maxlen, "A. Détective -");
		}
	}
	else if (rid == 15)
	{
		if (jid == 1)
		{
			strcopy(RankName, maxlen, "C. MacDo -");
		}
		else if (jid == 2)
		{
			strcopy(RankName, maxlen, "C.C MacDo -");
		}
		else if (jid == 3)
		{
			strcopy(RankName, maxlen, "Restaurateur -");
		}
		else if (jid == 4)
		{
			strcopy(RankName, maxlen, "V. MacDo -");
		}
		else if (jid == 5)
		{
			strcopy(RankName, maxlen, "A.V. MacDo -");
		}
	}
	else if (rid == 16)
	{
		if (jid == 1)
		{
			strcopy(RankName, maxlen, "C. Moniteur -");
		}
		else if (jid == 2)
		{
			strcopy(RankName, maxlen, "C.C Moniteur -");
		}
		else if (jid == 3)
		{
			strcopy(RankName, maxlen, "Moniteur Pro -");
		}
		else if (jid == 4)
		{
			strcopy(RankName, maxlen, "Moniteur -");
		}
		else if (jid == 5)
		{
			strcopy(RankName, maxlen, "A. Moniteur -");
		}
	}
	else if (rid == 17)
	{
		if (jid == 1)
		{
			strcopy(RankName, maxlen, "C. 18th -");
		}
		else if (jid == 2)
		{
			strcopy(RankName, maxlen, "C.C 18th -");
		}
		else if (jid == 3)
		{
			strcopy(RankName, maxlen, "18th H-G -");
		}
		else if (jid == 4)
		{
			strcopy(RankName, maxlen, "18th -");
		}
		else if (jid == 5)
		{
			strcopy(RankName, maxlen, "A. 18th -");
		}
	}
	else if (rid == 18)
	{
		if (jid == 1)
		{
			strcopy(RankName, maxlen, "C. Ikea -");
		}
		else if (jid == 2)
		{
			strcopy(RankName, maxlen, "C.C Ikea -");
		}
		else if (jid == 3)
		{
			strcopy(RankName, maxlen, "Meublier -");
		}
		else if (jid == 4)
		{
			strcopy(RankName, maxlen, "V. Ikea -");
		}
		else if (jid == 5)
		{
			strcopy(RankName, maxlen, "A.V. Ikea -");
		}
	}
	else if (rid == 19)
	{
		if (jid == 1)
		{
			strcopy(RankName, maxlen, "C. Appartements -");
		}
		else if (jid == 2)
		{
			strcopy(RankName, maxlen, "C.C Appartements -");
		}
		else if (jid == 3)
		{
			strcopy(RankName, maxlen, "Hôtelier -");
		}
		else if (jid == 4)
		{
			strcopy(RankName, maxlen, "V. Appartements -");
		}
		else if (jid == 5)
		{
			strcopy(RankName, maxlen, "A.V. Appartements -");
		}
	}
	else if (rid == 20)
	{
		if (jid == 1)
		{
			strcopy(RankName, maxlen, "C. DJ -");
		}
		else if (jid == 2)
		{
			strcopy(RankName, maxlen, "C.C DJ -");
		}
		else if (jid == 3)
		{
			strcopy(RankName, maxlen, "DJ Pro -");
		}
		else if (jid == 4)
		{
			strcopy(RankName, maxlen, "DJ -");
		}
		else if (jid == 5)
		{
			strcopy(RankName, maxlen, "A. DJ -");
		}
	}
}

public disarm(player)
{
	new wepIdx;
	for (new f = 0; f < 6; f++)
		if (f < 6 && (wepIdx = GetPlayerWeaponSlot(player, f)) != -1)  
			RemovePlayerItem(player, wepIdx);
}

public Action:HudTimer(Handle:timer, any:client)
{
	new Handle:hBuffer = StartMessageOne("KeyHintText", client);
	
	decl String:jobss[20]; 
	decl String:rank[40];
	
	GetJobName(jobid[client], rankid[client], jobss, sizeof(jobss));
	GetRankName(rankid[client], rank, sizeof(rank));
	GetZoneName(client);
	
	decl String:GroupName[128];
	GetGroupName(Group[client], GroupName, sizeof(GroupName));
	
	GetMonth();
	
	Client_SetDeaths(client, 0);
	Client_SetScore(client, 0);
	
	if(!IsClientInGame(client))
    {
        CloseHandle(TimerHud[client]);
        return Plugin_Stop;
    }
	
	if (hBuffer == INVALID_HANDLE)
	{
		CPrintToChat(client, "INVALID_HANDLE");
	}
	else
	{
		new String:tmptext[9999];
		{
			if (g_IsInJail[client] == 0)
			{
				if (Group[client] > 0)
				{
					if (jobid[client] > 0)
					{
						Format(tmptext, sizeof(tmptext), "En Poche : %i€\nBanque : %i€\nMétier : %s\nGroupe : %s\nEntreprise : %s\nCapital de l'entreprise : %i€\nSalaire : %i€\nDate : %i%i:%i%i - %i %s %i\nZone : %s\nLimite de Vitesse : %i km/h", money[client], bank[client], jobss, GroupName, rank, capital[rankid[client]], salaire[client], g_countheure1, g_countheure2, g_countminute1, g_countminute2, g_days, MonthName, g_years, Zone, LIMITATION);
					}
					else
					{
						Format(tmptext, sizeof(tmptext), "En Poche : %i€\nBanque : %i€\nMétier : %s\nGroupe : %s\nAllocation : %i€\nDate : %i%i:%i%i - %i %s %i\nZone : %s\nLimite de Vitesse : %i km/h", money[client], bank[client], jobss, GroupName, salaire[client], g_countheure1, g_countheure2, g_countminute1, g_countminute2, g_days, MonthName, g_years, Zone, LIMITATION);
					}
				}
				else
				{
					if (jobid[client] > 0)
					{
						Format(tmptext, sizeof(tmptext), "En Poche : %i€\nBanque : %i€\nMétier : %s\nEntreprise : %s\nCapital de l'entreprise : %i€\nSalaire : %i€\nDate : %i%i:%i%i - %i %s %i\nZone : %s\nLimite de Vitesse : %i km/h", money[client], bank[client], jobss, rank, capital[rankid[client]], salaire[client], g_countheure1, g_countheure2, g_countminute1, g_countminute2, g_days, MonthName, g_years, Zone, LIMITATION);
					}
					else
					{
						Format(tmptext, sizeof(tmptext), "En Poche : %i€\nBanque : %i€\nMétier : %s\nAllocation : %i€\nDate : %i%i:%i%i - %i %s %i\nZone : %s\nLimite de Vitesse : %i km/h", money[client], bank[client], jobss, salaire[client], g_countheure1, g_countheure2, g_countminute1, g_countminute2, g_days, MonthName, g_years, Zone, LIMITATION);
					}
				}
			}
			else
			{
				Format(tmptext, sizeof(tmptext), "Argent : %i€\nBanque : %i€\nMétier : %s\nEntreprise : %s\nDate : %i%i:%i%i - %i %s %i\nZone : %s\nTemps en prison : %is\nLimite de Vitesse : %i km/h", money[client], bank[client], jobss, rank, g_countheure1, g_countheure2, g_countminute1, g_countminute2, g_days, MonthName, g_years, Zone, g_jailtime[client], LIMITATION);
			}
		}
		BfWriteByte(hBuffer, 1); 
		BfWriteString(hBuffer, tmptext); 
		EndMessage();
	}
	
	if (!IsPlayerAlive(client))
	{
		if (Chargement[client])
		{
			PrintCenterText(client, "Chargement en Cours ... (Temps restant : %i%)", g_CountDead[client]);
			PrintHintText(client, "Chargement en Cours ... (Temps restant : %i%)", g_CountDead[client]);
		}
		else
		{
			PrintCenterText(client, "Vous allez revivre dans %i secondes.", g_CountDead[client]);
			PrintHintText(client, "Vous allez revivre dans %i secondes.", g_CountDead[client]);
		}
	}

	if (g_jailtime[client] == 1)
	{
		FreePlayer(client);
		
		g_jailtime[client] = 0;
		g_IsInJail[client] = 0;
	}
	
	if (IsPlayerAlive(client))
	{
		if (g_jailtime[client] > 0)
		{
			g_jailtime[client] -= 1;
		}
		
		if (regenn[client])
		{
			new kevlarr = GetEntProp(client, Prop_Send, "m_ArmorValue", 4);
			
			if (kevlarr < 100)
			{
				SetEntProp(client, Prop_Send, "m_ArmorValue", kevlarr + 1, 1);
			}
		}
		
		if (activate[client] > 0)
		{
			new h = GetRandomInt(0, 70);
			if (h > 60)
			{
				money[client] = money[client] + activate[client];
			}
		}
		
		if (printer[client] > 0)
		{
			new h = GetRandomInt(0, 70);
			if (h > 60)
			{
				money[client] = money[client] + printer[client];
			}
		}
	}
	
	new aim = GetClientAimTarget(client, true);
	
	if (aim != -1)
	{		
		decl String:jobb[20];
		GetJobName(jobid[aim], rankid[aim], jobb, sizeof(jobb));
		
		if (oeill[client])
		{
			PrintHintText(client, "%N \nMétier: %s", aim, jobb);
			StopSound(client, SNDCHAN_STATIC, "UI/hint.wav");
		}
		else
		{
			PrintHintText(client, "%N \nMétier: %s", aim, jobb);
			StopSound(client, SNDCHAN_STATIC, "UI/hint.wav");
		}
	}
	
	return Plugin_Continue;
}

GetJobName(jid, rid, String:RankName[], maxlen)
{
	if (rid == 0)
	{
		if (jid == 0)
		{
			strcopy(RankName, maxlen, "Chômeur");
		}
	}
	else if (rid == 1)
	{
		if (jid == 1)
		{
			strcopy(RankName, maxlen, "Maire");
		}
		else if (jid == 2)
		{
			strcopy(RankName, maxlen, "Agent C.I.A");
		}
		else if (jid == 3)
		{
			strcopy(RankName, maxlen, "Agent F.B.I");
		}
		else if (jid == 4)
		{
			strcopy(RankName, maxlen, "Policier");
		}
		else if (jid == 5)
		{
			strcopy(RankName, maxlen, "Gardien");
		}
		else if (jid == 6)
		{
			strcopy(RankName, maxlen, "Agent G.T.I");
		}
	}
	else if (rid == 2)
	{
		if (jid == 1)
		{
			strcopy(RankName, maxlen, "Chef Mafia");
		}
		else if (jid == 2)
		{
			strcopy(RankName, maxlen, "Co-Chef Mafia");
		}
		else if (jid == 3)
		{
			strcopy(RankName, maxlen, "Parrain");
		}
		else if (jid == 4)
		{
			strcopy(RankName, maxlen, "Mafieux");
		}
		else if (jid == 5)
		{
			strcopy(RankName, maxlen, "Apprenti Mafieux");
		}
	}
	else if (rid == 3)
	{
		if (jid == 1)
		{
			strcopy(RankName, maxlen, "Chef Dealer");
		}
		else if (jid == 2)
		{
			strcopy(RankName, maxlen, "Co-Chef Dealer");
		}
		else if (jid == 3)
		{
			strcopy(RankName, maxlen, "Recelleur");
		}
		else if (jid == 4)
		{
			strcopy(RankName, maxlen, "Dealer");
		}
		else if (jid == 5)
		{
			strcopy(RankName, maxlen, "Apprenti Dealer");
		}
	}
	else if (rid == 4)
	{
		if (jid == 1)
		{
			strcopy(RankName, maxlen, "Chef Coach");
		}
		else if (jid == 2)
		{
			strcopy(RankName, maxlen, "Co-Chef Coach");
		}
		else if (jid == 3)
		{
			strcopy(RankName, maxlen, "Entraîneur");
		}
		else if (jid == 4)
		{
			strcopy(RankName, maxlen, "Coach");
		}
		else if (jid == 5)
		{
			strcopy(RankName, maxlen, "Apprenti Coach");
		}
	}
	else if (rid == 5)
	{
		if (jid == 1)
		{
			strcopy(RankName, maxlen, "Chef Armurerie");
		}
		else if (jid == 2)
		{
			strcopy(RankName, maxlen, "Co-Chef Armurerie");
		}
		else if (jid == 3)
		{
			strcopy(RankName, maxlen, "Grenadier");
		}
		else if (jid == 4)
		{
			strcopy(RankName, maxlen, "Armurier");
		}
		else if (jid == 5)
		{
			strcopy(RankName, maxlen, "Apprenti Armurier");
		}
	}
	else if (rid == 6)
	{
		if (jid == 1)
		{
			strcopy(RankName, maxlen, "Chef Loto");
		}
		else if (jid == 2)
		{
			strcopy(RankName, maxlen, "Co-Chef Loto");
		}
		else if (jid == 3)
		{
			strcopy(RankName, maxlen, "Buraliste");
		}
		else if (jid == 4)
		{
			strcopy(RankName, maxlen, "Vendeur de Tickets");
		}
		else if (jid == 5)
		{
			strcopy(RankName, maxlen, "Apprenti Vendeur Tickets");
		}
	}
	else if (rid == 7)
	{
		if (jid == 1)
		{
			strcopy(RankName, maxlen, "Chef Banquier");
		}
		else if (jid == 2)
		{
			strcopy(RankName, maxlen, "Co-Chef Banquier");
		}
		else if (jid == 3)
		{
			strcopy(RankName, maxlen, "Conseiller Financier");
		}
		else if (jid == 4)
		{
			strcopy(RankName, maxlen, "Banquier");
		}
		else if (jid == 5)
		{
			strcopy(RankName, maxlen, "Apprenti Banquier");
		}
	}
	else if (rid == 8)
	{
		if (jid == 1)
		{
			strcopy(RankName, maxlen, "Chef Hôpital");
		}
		else if (jid == 2)
		{
			strcopy(RankName, maxlen, "Co-Chef Hôpital");
		}
		else if (jid == 3)
		{
			strcopy(RankName, maxlen, "Chirurgien");
		}
		else if (jid == 4)
		{
			strcopy(RankName, maxlen, "Infirmier");
		}
		else if (jid == 5)
		{
			strcopy(RankName, maxlen, "Apprenti Infirmier");
		}
	}
	else if (rid == 9)
	{
		if (jid == 1)
		{
			strcopy(RankName, maxlen, "Chef Artificier");
		}
		else if (jid == 2)
		{
			strcopy(RankName, maxlen, "Co-Chef Artificier");
		}
		else if (jid == 3)
		{
			strcopy(RankName, maxlen, "Vendeur de Grenade");
		}
		else if (jid == 4)
		{
			strcopy(RankName, maxlen, "Artificier");
		}
		else if (jid == 5)
		{
			strcopy(RankName, maxlen, "Apprenti Artificier");
		}
	}
	else if (rid == 10)
	{
		if (jid == 1)
		{
			strcopy(RankName, maxlen, "Chef de la Justice");
		}
		else if (jid == 2)
		{
			strcopy(RankName, maxlen, "Co-Chef Justice");
		}
		else if (jid == 3)
		{
			strcopy(RankName, maxlen, "Garde ONU");
		}
		else if (jid == 4)
		{
			strcopy(RankName, maxlen, "Juge");
		}
		else if (jid == 5)
		{
			strcopy(RankName, maxlen, "Avocat");
		}
		else if (jid == 6)
		{
			strcopy(RankName, maxlen, "Marshall");
		}
	}
	else if (rid == 11)
	{
		if (jid == 1)
		{
			strcopy(RankName, maxlen, "Chef Tueur");
		}
		else if (jid == 2)
		{
			strcopy(RankName, maxlen, "Co-Chef Tueur");
		}
		else if (jid == 3)
		{
			strcopy(RankName, maxlen, "Tueur d'élite");
		}
		else if (jid == 4)
		{
			strcopy(RankName, maxlen, "Tueur Professionnel");
		}
		else if (jid == 5)
		{
			strcopy(RankName, maxlen, "Tueur Novice");
		}
	}
	else if (rid == 12)
	{
		if (jid == 1)
		{
			strcopy(RankName, maxlen, "Chef Technicien");
		}
		else if (jid == 2)
		{
			strcopy(RankName, maxlen, "Co-Chef Technicien");
		}
		else if (jid == 3)
		{
			strcopy(RankName, maxlen, "Technicien Professionnel");
		}
		else if (jid == 4)
		{
			strcopy(RankName, maxlen, "Technicien");
		}
		else if (jid == 5)
		{
			strcopy(RankName, maxlen, "Apprenti Technicien");
		}
	}
	else if (rid == 13)
	{
		if (jid == 1)
		{
			strcopy(RankName, maxlen, "Mac");
		}
		else if (jid == 2)
		{
			strcopy(RankName, maxlen, "Co-Chef Mac");
		}
		else if (jid == 3)
		{
			strcopy(RankName, maxlen, "Prostituée de luxe");
		}
		else if (jid == 4)
		{
			strcopy(RankName, maxlen, "Prostituée");
		}
		else if (jid == 5)
		{
			strcopy(RankName, maxlen, "Apprenti Prostituée");
		}
	}
	else if (rid == 14)
	{
		if (jid == 1)
		{
			strcopy(RankName, maxlen, "Chef Détective");
		}
		else if (jid == 2)
		{
			strcopy(RankName, maxlen, "Co-Chef Détective");
		}
		else if (jid == 3)
		{
			strcopy(RankName, maxlen, "Détective Privé");
		}
		else if (jid == 4)
		{
			strcopy(RankName, maxlen, "Détective");
		}
		else if (jid == 5)
		{
			strcopy(RankName, maxlen, "Apprenti Détective");
		}
	}
	else if (rid == 15)
	{
		if (jid == 1)
		{
			strcopy(RankName, maxlen, "Chef MacDo");
		}
		else if (jid == 2)
		{
			strcopy(RankName, maxlen, "Co-Chef MacDo");
		}
		else if (jid == 3)
		{
			strcopy(RankName, maxlen, "Restaurateur MacDo");
		}
		else if (jid == 4)
		{
			strcopy(RankName, maxlen, "Vendeur MacDo");
		}
		else if (jid == 5)
		{
			strcopy(RankName, maxlen, "Apprenti Vendeur MacDo");
		}
	}
	else if (rid == 16)
	{
		if (jid == 1)
		{
			strcopy(RankName, maxlen, "Chef Moniteur");
		}
		else if (jid == 2)
		{
			strcopy(RankName, maxlen, "Co-Chef Moniteur");
		}
		else if (jid == 3)
		{
			strcopy(RankName, maxlen, "Moniteur Professionnel");
		}
		else if (jid == 4)
		{
			strcopy(RankName, maxlen, "Moniteur de tir");
		}
		else if (jid == 5)
		{
			strcopy(RankName, maxlen, "Apprenti Moniteur");
		}
	}
	else if (rid == 17)
	{
		if (jid == 1)
		{
			strcopy(RankName, maxlen, "Chef 18th");
		}
		else if (jid == 2)
		{
			strcopy(RankName, maxlen, "Co-Chef 18th");
		}
		else if (jid == 3)
		{
			strcopy(RankName, maxlen, "18th Haut-Gradé");
		}
		else if (jid == 4)
		{
			strcopy(RankName, maxlen, "18th");
		}
		else if (jid == 5)
		{
			strcopy(RankName, maxlen, "Apprenti 18th");
		}
	}
	else if (rid == 18)
	{
		if (jid == 1)
		{
			strcopy(RankName, maxlen, "Chef Ikea");
		}
		else if (jid == 2)
		{
			strcopy(RankName, maxlen, "Co-Chef Ikea");
		}
		else if (jid == 3)
		{
			strcopy(RankName, maxlen, "Meublier");
		}
		else if (jid == 4)
		{
			strcopy(RankName, maxlen, "Vendeur Ikea");
		}
		else if (jid == 5)
		{
			strcopy(RankName, maxlen, "Apprenti Vendeur Ikea");
		}
	}
	else if (rid == 19)
	{
		if (jid == 1)
		{
			strcopy(RankName, maxlen, "Chef Appartements");
		}
		else if (jid == 2)
		{
			strcopy(RankName, maxlen, "Co-Chef Appartements");
		}
		else if (jid == 3)
		{
			strcopy(RankName, maxlen, "Hôtelier");
		}
		else if (jid == 4)
		{
			strcopy(RankName, maxlen, "Vendeur Appartements");
		}
		else if (jid == 5)
		{
			strcopy(RankName, maxlen, "Apprenti Vendeur Appartements");
		}
	}
	else if (rid == 20)
	{
		if (jid == 1)
		{
			strcopy(RankName, maxlen, "Chef DJ");
		}
		else if (jid == 2)
		{
			strcopy(RankName, maxlen, "Co-Chef DJ");
		}
		else if (jid == 3)
		{
			strcopy(RankName, maxlen, "DJ Pro");
		}
		else if (jid == 4)
		{
			strcopy(RankName, maxlen, "DJ");
		}
		else if (jid == 5)
		{
			strcopy(RankName, maxlen, "Apprenti DJ");
		}
	}
}

GetRankName(rid, String:RankName[], maxlen)
{
	if (rid == 0)
	{
		strcopy(RankName, maxlen, "Aucune");
	}
	else if (rid == 1)
	{
		strcopy(RankName, maxlen, "Gouvernement");
	}
	else if (rid == 2)
	{
		strcopy(RankName, maxlen, "Les Mafieux");
	}
	else if (rid == 3)
	{
		strcopy(RankName, maxlen, "Les Dealers");
	}
	else if (rid == 4)
	{
		strcopy(RankName, maxlen, "Les Coachs");
	}
	else if (rid == 5)
	{
		strcopy(RankName, maxlen, "L'Armurerie");
	}
	else if (rid == 6)
	{
		strcopy(RankName, maxlen, "Le Loto");
	}
	else if (rid == 7)
	{
		strcopy(RankName, maxlen, "Les Banquier");
	}
	else if (rid == 8)
	{
		strcopy(RankName, maxlen, "L'Hôpital");
	}
	else if (rid == 9)
	{
		strcopy(RankName, maxlen, "Les Artificier");
	}
	else if (rid == 10)
	{
		strcopy(RankName, maxlen, "La Cour Pénale");
	}
	else if (rid == 11)
	{
		strcopy(RankName, maxlen, "Les Tueurs");
	}
	else if (rid == 12)
	{
		strcopy(RankName, maxlen, "Les Techniciens");
	}
	else if (rid == 13)
	{
		strcopy(RankName, maxlen, "La Prostitution");
	}
	else if (rid == 14)
	{
		strcopy(RankName, maxlen, "Les Détectives");
	}
	else if (rid == 15)
	{
		strcopy(RankName, maxlen, "Le MacDonald");
	}
	else if (rid == 16)
	{
		strcopy(RankName, maxlen, "Les Moniteurs");
	}
	else if (rid == 17)
	{
		strcopy(RankName, maxlen, "Mafia 18th");
	}
	else if (rid == 18)
	{
		strcopy(RankName, maxlen, "Ikea");
	}
	else if (rid == 19)
	{
		strcopy(RankName, maxlen, "Agence Immobilière");
	}
	else if (rid == 20)
	{
		strcopy(RankName, maxlen, "DJ de riverside");
	}
}

public GetMonth()
{
	if (g_month == 1)
	{
		Format(MonthName, sizeof(MonthName), "Janvier");
	}
	else if (g_month == 2)
	{
		Format(MonthName, sizeof(MonthName), "Février");
	}
	else if (g_month == 3)
	{
		Format(MonthName, sizeof(MonthName), "Mars");
	}
	else if (g_month == 4)
	{
		Format(MonthName, sizeof(MonthName), "Avril");
	}
	else if (g_month == 5)
	{
		Format(MonthName, sizeof(MonthName), "Mai");
	}
	else if (g_month == 6)
	{
		Format(MonthName, sizeof(MonthName), "Juin");
	}
	else if (g_month == 7)
	{
		Format(MonthName, sizeof(MonthName), "Juillet");
	}
	else if (g_month == 8)
	{
		Format(MonthName, sizeof(MonthName), "Août");
	}
	else if (g_month == 9)
	{
		Format(MonthName, sizeof(MonthName), "Septembre");
	}
	else if (g_month == 10)
	{
		Format(MonthName, sizeof(MonthName), "Octobre");
	}
	else if (g_month == 11)
	{
		Format(MonthName, sizeof(MonthName), "Novembre");
	}
	else if (g_month == 12)
	{
		Format(MonthName, sizeof(MonthName), "Décembre");
	}
}

public Action:Block_CMD(client, Args) 
{
    return Plugin_Handled;
}

public Action:OnPlayerRunCmd(client, &buttons, &impulse, Float:vel[3], Float:angles[3], &weapon)
{
	if (IsPlayerAlive(client))
	{
		if (IsInPole(client))
		{	
			if (POLE_EMPLOI == 0)
			{
				CPrintToChat(client, "%s {red}Le pôle emploi est fermé !", LOGO);
				TeleportEntity(client, Float:{ -3695.018066, 215.382019, 0.031250 }, NULL_VECTOR, NULL_VECTOR);
			}
		}
		else if (IsInLoto(client))
		{
			if (CASINO == 0)
			{
				CPrintToChat(client, "%s {red}Le casino est fermé !", LOGO);
				TeleportEntity(client, Float:{  -495.090332, -1990.568603, 8.031250 }, NULL_VECTOR, NULL_VECTOR);
			}
		}
		if (ForceSwitch[client])
		{
			ForceSwitch[client]--;
			weapon = GetEntPropEnt(client, Prop_Send, "m_hLastWeapon");
			if (weapon == -1)
			{
				weapon = 0;
			}
		}
		if (!g_InUse[client] && buttons & IN_USE)
		{
			g_InUse[client] = true;
			
			new car = GetEntPropEnt(client, Prop_Send, "m_hVehicle");
		
			if (car != -1)
			{
				new speed = GetEntProp(car, Prop_Data, "m_nSpeed");
				if (speed == 0)
				{
					CPrintToChat(client, "%s {red}Vous sortez de la voiture", LOGO);
					AcceptEntityInput(car, "TurnOff", -1, -1, 0);
					ExitVehicle(client, car, 0);
				}
				else
				{
					CPrintToChat(client, "%s {red}Veuillez stopper votre véhicule", LOGO);
				}
			}
			
			if (Garage(client))
			{
				Menu_Voitures(client);
			}
			else if (IsInPole(client))
			{
				Menu_Pole(client);
			}
			
			new Ent;
			new String:Name[200];
			new String:Door[255];
			
			Ent = GetClientAimTarget(client, false);
			
			if (Ent != -1)
			{
				Entity_GetName(Ent, Name, sizeof(Name));
				GetEntityClassname(Ent, Door, sizeof(Door));
				
				new Float:origin[3], Float:clientent[3];
				GetEntPropVector(Ent, Prop_Send, "m_vecOrigin", origin);
				GetEntPropVector(client, Prop_Send, "m_vecOrigin", clientent);
				new Float:distance = GetVectorDistance(origin, clientent);
				new Float:vec[3];
				GetClientAbsOrigin(client, vec);
				vec[2] += 10;
				
				if (StrEqual(Name, "distribrp") || StrEqual(Name, "distribarmu"))
				{
					if (distance <= 90)
					{
						new Handle:menu = CreateMenu(Menu_Bank);
						SetMenuTitle(menu, "Banque :");
						AddMenuItem(menu, "Deposit", "Déposer de l'argent");
						AddMenuItem(menu, "Retired", "Retirer de l'argent");
						if (jobid[client] == 1)
						{
							AddMenuItem(menu, "Capital", "Déposer dans l'entreprise");
						}
						AddMenuItem(menu, "Inventaire", "Ouvrir mon Inventaire !");
						DisplayMenu(menu, client, MENU_TIME_FOREVER);
					}
					else
					{
						CPrintToChat(client, "%s {red}Rapprochez vous du distributeur !", LOGO);
					}
				}
				else if (StrEqual(Name, "hostage_npc"))
				{
					if (distance <= 150)
					{
						Menu_Voitures(client);
					}
					else
					{
						PrintToChat(client, "%s Rapprochez vous du gérant des voiture !", LOGO);
					}
				}
				else if (StrEqual(Door, "func_door") || StrEqual(Door, "func_door_rotating") || StrEqual(Door, "prop_door_rotating"))
				{				
					if (Entity_IsLocked(Ent))
					{
						PrintHintText(client, "La porte est fermée à clée !");
					}
				}
			}
			
			if (IsInSalle(client))
			{
				if (rankid[client] == 2)
				{
					if (!OnKit[client])
					{
						if (kitcrochetage[client] < 10)
						{
							GiveKit = CreateTimer(6.0, Timer_Kit, client);
							
							SetEntPropFloat(client, Prop_Send, "m_flProgressBarStartTime", GetGameTime()); 
							SetEntProp(client, Prop_Send, "m_iProgressBarDuration", 6);
							
							OnKit[client] = true;
							
							SetEntityRenderColor(client, 255, 0, 0, 0);
							SetEntityMoveType(client, MOVETYPE_NONE);
						}
						else
						{
							CPrintToChat(client, "%s Vous avez le maximum de kit de crochetage(%i)", LOGO, kitcrochetage[client]);
						}
					}
					else
					{
						CPrintToChat(client, "%s Vous êtes déjà en cours de fabrication.", LOGO);
					}
				}
				else
				{
					CPrintToChat(client, "%s Vous devez être mafieux.", LOGO);
				}
			}
			
			if (IsInOpera(client))
			{
				if (rankid[client] == 17)
				{
					if (!OnKit[client])
					{
						if (kitcrochetage[client] < 10)
						{
							GiveKit = CreateTimer(6.0, Timer_Kit, client);
							
							SetEntPropFloat(client, Prop_Send, "m_flProgressBarStartTime", GetGameTime()); 
							SetEntProp(client, Prop_Send, "m_iProgressBarDuration", 6);
							
							OnKit[client] = true;
							
							SetEntityRenderColor(client, 255, 0, 0, 0);
							SetEntityMoveType(client, MOVETYPE_NONE);
						}
						else
						{
							CPrintToChat(client, "%s Vous avez le maximum de kit de crochetage(%i)", LOGO, kitcrochetage[client]);
						}
					}
					else
					{
						CPrintToChat(client, "%s Vous êtes déjà en cours de fabrication.", LOGO);
					}
				}
				else
				{
					CPrintToChat(client, "%s Vous devez être mafieux.", LOGO);
				}
			}
			
			if (IsInArmup(client))
			{
				if (IsPlayerAlive(client))
				{
					if (GetClientTeam(client) == 3)
					{
						new Handle:menu = CreateMenu(armu);
						SetMenuTitle(menu, "Armurerie :");
						
						AddMenuItem(menu, "m4", "M4A1");
						AddMenuItem(menu, "tmp", "PiouPiou");
						AddMenuItem(menu, "usp", "USP");
						AddMenuItem(menu, "p90", "P90");
						AddMenuItem(menu, "m3", "M3");
						AddMenuItem(menu, "grenade", "Grenade");
						AddMenuItem(menu, "flash", "Flash");
						AddMenuItem(menu, "smoke", "Smoke");

						DisplayMenu(menu, client, MENU_TIME_FOREVER);
					}
				}
				else
				{
					CPrintToChat(client, "%s {red} Vous devez être vivant ! pour utilisé cette commande.", LOGO);
				}
			}
			
			if (IsInArmup(client))
			{
				if (rankid[client] != 1)
				{
					if (rankid[client] == 2 || rankid[client] == 17)
					{
						if (!OnKit[client])
						{
							if (kitexplosif[client] < 5)
							{
								if (kitcrochetage[client] > 0)
								{
									kitcrochetage[client] = kitcrochetage[client] - 1;
									
									CPrintToChat(client, "%s {blue}Vous perdez un kit de crochetage {green}[%d Restant]", LOGO, kitcrochetage[client]);
									
									GiveKit = CreateTimer(6.0, Timer_KitExplosif, client);
									
									SetEntPropFloat(client, Prop_Send, "m_flProgressBarStartTime", GetGameTime()); 
									SetEntProp(client, Prop_Send, "m_iProgressBarDuration", 6);
									
									OnKit[client] = true;
									
									SetEntityRenderColor(client, 255, 0, 0, 0);
									SetEntityMoveType(client, MOVETYPE_NONE);
								}
								else
								{
									CPrintToChat(client, "%s {red}Vous n'avez plus de kits de crochetage !", LOGO);
								}
							}
							else
							{
								CPrintToChat(client, "%s Vous avez le maximum de kit de explosif(%i)", LOGO, kitexplosif[client]);
							}
						}
						else
						{
							CPrintToChat(client, "%s Vous êtes déjà en cours de fabrication.", LOGO);
						}
					}
					else
					{
						CPrintToChat(client, "%s Vous devez être mafieux.", LOGO);
					}
				}
			}
			
			if (IsInArmu(client))
			{
				if (Ent == -1)
				{
					BuildAmmuMenu(client);
				}
				else
				{
					Entity_GetName(Ent, Name, sizeof(Name));
					
					new Float:origin[3], Float:clientent[3];
					GetEntPropVector(Ent, Prop_Send, "m_vecOrigin", origin);
					GetEntPropVector(client, Prop_Send, "m_vecOrigin", clientent);
					new Float:distance = GetVectorDistance(origin, clientent);
					new Float:vec[3];
					GetClientAbsOrigin(client, vec);
					vec[2] += 10;
				
					if (StrEqual(Name, "distribarmu"))
					{
						if (distance <= 60)
						{
							new Handle:menu = CreateMenu(Menu_Bank);
							SetMenuTitle(menu, "Banque :");
							AddMenuItem(menu, "Deposit", "Déposer de l'argent");
							AddMenuItem(menu, "Retired", "Retirer de l'argent");
							if (jobid[client] == 1)
							{
								AddMenuItem(menu, "Capital", "Déposer dans l'entreprise");
							}
							DisplayMenu(menu, client, MENU_TIME_FOREVER);
						}
					}
					else
					{
						BuildAmmuMenu(client);
					}
				}
			}
			
			if (IsInBank(client))
			{
				BuildBankMenu(client);
			}
		}
		else if(g_InUse[client] && !(buttons & IN_USE))
		{
			g_InUse[client] = false;
		}
		if (!g_InDuck[client] && buttons & IN_DUCK)
		{	
			new voiture = GetEntPropEnt(client, Prop_Send, "m_hVehicle");
			if (voiture != -1)
			{
				g_InDuck[client] = true;
				AcceptEntityInput(voiture, "TurnOn", -1, -1, 0);
				ViewToggle(voiture, client);
			}		
		}
		else if (g_InDuck[client] && !(buttons & IN_DUCK))
		{
			g_InDuck[client] = false;
		}		
	}
	return Plugin_Continue;
}

		
public ViewToggle(car, client)
{
	if(CarView[car] == true)
	{
		CarView[car] = false;
		SetVariantString("vehicle_3rd");
		AcceptEntityInput(client, "SetParentAttachment");	
		return;
	}
	if(CarView[car] == false)
	{
		CarView[car] = true;
		SetVariantString("vehicle_3rd");
		AcceptEntityInput(client, "SetParentAttachment");	
		return;
	}
}

stock Menu_Voitures(client)
{
	if (GetConVarInt(Voitures) == 1) 
	{
		EmitSoundToClient(client, SOUND_SALUT);
		new Handle:menu = CreateMenu(Menu_Caisses);
		SetMenuTitle(menu, "Bienvenue chez Marcel\nJe suis celui qui gère le système de voiture sur la Map\n ");
		AddMenuItem(menu, "achat", "Acheter une voiture");
		AddMenuItem(menu, "garage","Mon Garage");
		AddMenuItem(menu, "couleur","Changer de couleur mes voitures");
		DisplayMenu(menu, client, MENU_TIME_FOREVER);
	}
	else
	{
		new Handle:hP2 = CreatePanel();
		new String:sMessage[9999];
		Format(sMessage, sizeof(sMessage), "- Informations RP -   \nLes voitures sont temporairements désactivées\nMerci d'être patient\n \n0-Fermer");
		DrawPanelText(hP2, sMessage);
		SetPanelCurrentKey(hP2, 10);
		SendPanelToClient(hP2, client, Handler_DoNothing, 20);						
		CPrintToChat(client, "%s {red}Les voitures sont temporairements désactivées", LOGO);		
	}
}

stock Menu_Pole(client)
{
	EmitSoundToClient(client, SOUND_SALUT);
	new Handle:menu = CreateMenu(Menu_Pole_Choix);
	SetMenuTitle(menu, "Bienvenue au Pôle Emploi\nNous sommes ici afin de vous aider à trouver votre bonheur\n ");
	AddMenuItem(menu, "", "EN BETA", ITEMDRAW_DISABLED);
	AddMenuItem(menu, "voir", "Voir les Jobs Disponibles [EN CFG]", ITEMDRAW_DISABLED);
	AddMenuItem(menu, "demi", "Démissioner de mon Job Actuel");
	AddMenuItem(menu, "maisons", "Voir les maisons achetés");
	DisplayMenu(menu, client, MENU_TIME_FOREVER);
}

public Menu_Pole_Choix(Handle:menu, MenuAction:action, client, param2)
{
	if(action == MenuAction_Select)
	{	
		new String:info[32];
		GetMenuItem(menu, param2, info, sizeof(info));
		
		if (StrEqual(info, "demi"))
		{
			if (jobid[client] > 0)
			{
				new Handle:menu_d = CreateMenu(Menu_Demission);
				SetMenuTitle(menu_d, "Voulez vous démissoner ?\nAttention Action Définitive !\n ");
				AddMenuItem(menu_d, "oui", "Oui");
				AddMenuItem(menu_d, "non", "Non");
				DisplayMenu(menu_d, client, MENU_TIME_FOREVER);
			}
			else
			{
				CPrintToChat(client, "%s {red}Démissoner du Chômage ? xD", LOGO);
			}
		}
		else if (StrEqual(info, "maisons"))
		{
			decl String:query[256];
	
			decl String:error[256];
			new Handle:db_rp = SQL_Connect("roleplay", true, error, sizeof(error));
			
			Format(query, sizeof(query), "SELECT id, name FROM `Roleplay_House` WHERE `occuped` = '1';");
			
			new Handle:immob = SQL_Query(db_rp, query);
			
			new Handle:immo = CreateMenu(Menu_Immobilier);
			SetMenuTitle(immo, "Liste des maisons louées :\n ");
			
			if (immob)
			{
				while (SQL_FetchRow(immob))
				{
					new String:szName[150];
					new String:szNameAfter[200];
					
					new ID;
					
					ID = SQL_FetchInt(immob, 0);
					
					SQL_FetchString(immob, 1, szName, sizeof(szName));
					
					Format(query, sizeof(query), "SELECT pseudo FROM `Roleplay_Players` WHERE `house` = '%i';", ID);
					
					new Handle:recup = SQL_Query(db_rp, query);
					
					if (recup)
					{
						if (SQL_FetchRow(recup))
						{
							new String:pseudo[100];
							
							SQL_FetchString(recup, 0, pseudo, sizeof(pseudo));
							
							Format(szNameAfter, sizeof(szNameAfter), "%s Propriétaire : %s", szName, pseudo);
					
							AddMenuItem(immo, "", szNameAfter, ITEMDRAW_DISABLED);
						}
						else
						{
							AddMenuItem(immo, "", "Aucune menu trouvée !", ITEMDRAW_DISABLED);
						}
					}
				}
			}
			
			DisplayMenu(immo, client, MENU_TIME_FOREVER);
			
			CloseHandle(immob);
			CloseHandle(db_rp);
		}
	}
}
public Menu_Caisses(Handle:menu, MenuAction:action, client, param2)
{
	if(action == MenuAction_Select)
	{	
		if(param2 == 0)
		{	
			new String:Buffer[128];
			new Handle:menua = CreateMenu(Menu_Voitures_By);
			SetMenuTitle(menua, "Bienvenue dans votre Garage\nLe (*) veut dire que vous possédez le véhicule.\n ");
			if (AST_Dbs[client] > 0)
			{
				AddMenuItem(menua, "", "Aston Martin DBS (*)", ITEMDRAW_DISABLED);
			}
			else
			{
				Format(Buffer, sizeof(Buffer), "Aston Martin DBS (125.000 €)");
				AddMenuItem(menua, "dbs", Buffer);
			}
			if (Lambo[client] > 0)
			{
				AddMenuItem(menua, "", "Lamborghini Gallardo (*)", ITEMDRAW_DISABLED);
			}
			else
			{
				Format(Buffer, sizeof(Buffer), "Lamborghini Gallardo (100.000 €)");
				AddMenuItem(menua, "lambo", Buffer);
			}
			if (LandRover[client] > 0)
			{
				AddMenuItem(menua, "", "LandRover (*)", ITEMDRAW_DISABLED);
			}
			else
			{
				Format(Buffer, sizeof(Buffer), "LandRover (80.000 €)");
				AddMenuItem(menua, "land", Buffer);
			}
			if (Audi_S5[client] > 0)
			{
				AddMenuItem(menua, "", "Audi S5 (*)", ITEMDRAW_DISABLED);
			}
			else
			{
				Format(Buffer, sizeof(Buffer), "Audi S5 (50.000 €)");
				AddMenuItem(menua, "audi_s5", Buffer);
			}
			if (Audi_TT[client] > 0)
			{
				AddMenuItem(menua, "", "Audi TT (*)", ITEMDRAW_DISABLED);
			}
			else
			{	
				Format(Buffer, sizeof(Buffer), "Audi TT (35.000 €)");
				AddMenuItem(menua, "audi_tt", Buffer);
			}
			if (Citroen[client] > 0)
			{
				AddMenuItem(menua, "", "Citroen C4 (*)", ITEMDRAW_DISABLED);
			}
			else 
			{
				Format(Buffer, sizeof(Buffer), "Citroen C4 (10.000 €)");
				AddMenuItem(menua, "c4", Buffer);
			}
			DisplayMenu(menua, client, MENU_TIME_FOREVER);
		}
		if(param2 == 1)
		{		
			new String:Buffer[128];
			new Handle:menua = CreateMenu(Menu_VOITURES_SPAWN);
			SetMenuTitle(menua, "Mon Garage\n ");
			if ((Lambo[client] == 0) && (Audi_TT[client] == 0) && (Audi_S5[client] == 0) && (Citroen[client] == 0) && (LandRover[client] == 0) && (AST_Dbs[client] == 0))
			{
				AddMenuItem(menua, "", "Aucune voiture dans votre Garage !", ITEMDRAW_DISABLED);
			}
			else
			{
				if (AST_Dbs[client] > 0)
				{
					Format(Buffer, sizeof(Buffer), "Aston Martin DBS");
					AddMenuItem(menua, "dbs", Buffer);
				}
				if (Lambo[client] > 0)
				{
					Format(Buffer, sizeof(Buffer), "Lamborghini Gallardo");
					AddMenuItem(menua, "lambo", Buffer);
				}
				if (LandRover[client] > 0)
				{
					Format(Buffer, sizeof(Buffer), "LandRover");
					AddMenuItem(menua, "land", Buffer);
				}
				if (Audi_S5[client] > 0)
				{
					Format(Buffer, sizeof(Buffer), "Audi S5");
					AddMenuItem(menua, "audi_s5", Buffer);
				}
				if (Audi_TT[client] > 0)
				{
					Format(Buffer, sizeof(Buffer), "Audi TT");
					AddMenuItem(menua, "audi_tt", Buffer);
				}
				if (Citroen[client] > 0)
				{
					Format(Buffer, sizeof(Buffer), "Citroen C4");
					AddMenuItem(menua, "c4", Buffer);
				}
				if (VIP(client))
				{
					Format(Buffer, sizeof(Buffer), "Kia [VIP]");
					AddMenuItem(menua, "vip", Buffer);
				}
				else 
				{
					AddMenuItem(menua, "", "Kia [VIP]", ITEMDRAW_DISABLED);
				}				
			}
			DisplayMenu(menua, client, MENU_TIME_FOREVER);
		}
		if(param2 == 2)
		{	
			new String:steamid[32];				
			decl String:query[256];
			decl String:error[256];
			GetClientAuthString(client, steamid, sizeof(steamid));
			new Handle:db_rp = SQL_Connect("roleplay", true, error, sizeof(error));
			Format(query, sizeof(query), "SELECT couleur FROM `Roleplay_Voitures` WHERE `steam_id` = '%s';", steamid);
			new Handle:rkette = SQL_Query(db_rp, query);
			if (rkette)
			{
				if (SQL_FetchRow(rkette))
				{
					couleur[client]	= SQL_FetchInt(rkette, 0);
					
					new Handle:menu_kouleure = CreateMenu(Menu_kouleure);
					SetMenuTitle(menu_kouleure, "Acheter une couleur de véhicule\n ");
					if (couleur[client] == 0)
					{
						AddMenuItem(menu_kouleure, "", "Couleur Blanche [ACTUEL]", ITEMDRAW_DISABLED);
					}
					else
					{
						AddMenuItem(menu_kouleure, "blanc", "Couleur Blanche (1000€)");
					}
					if (couleur[client] == 1)
					{
						AddMenuItem(menu_kouleure, "", "Couleur Noire [ACTUEL]", ITEMDRAW_DISABLED);
					}
					else
					{
						AddMenuItem(menu_kouleure, "noir", "Couleur Noire (1200€)");
					}
					if (couleur[client] == 2)
					{
						AddMenuItem(menu_kouleure, "", "Couleur Rouge [ACTUEL]", ITEMDRAW_DISABLED);
					}
					else
					{
						AddMenuItem(menu_kouleure, "rouge", "Couleur Rouge (1200€)");
					}
					if (couleur[client] == 3)
					{
						AddMenuItem(menu_kouleure, "", "Couleur Bleue [ACTUEL]", ITEMDRAW_DISABLED);
					}
					else
					{
						AddMenuItem(menu_kouleure, "blue", "Couleur Bleue (1200€)");
					}
					if (couleur[client] == 4)
					{
						AddMenuItem(menu_kouleure, "", "Couleur Verte [ACTUEL]", ITEMDRAW_DISABLED);
					}
					else
					{
						AddMenuItem(menu_kouleure, "verte", "Couleur Verte (1200€)");
					}
					if (couleur[client] == 5)
					{
						AddMenuItem(menu_kouleure, "", "Couleur Violette [ACTUEL]", ITEMDRAW_DISABLED);
					}
					else
					{
						AddMenuItem(menu_kouleure, "violet", "Couleur Violette (1200€)");
					}
					DisplayMenu(menu_kouleure, client, MENU_TIME_FOREVER);					
				}
			}
		
		}
		CloseHandle(menu);
	}
	if (action == MenuAction_End)
	{
		CloseHandle(menu);
	}
}


public Menu_VOITURES_SPAWN(Handle:menu, MenuAction:action, client, param2)
{
	if (action == MenuAction_Select)
	{
		if (IsExitVehicle[client] == false)
		{
			new String:info[32];
			GetMenuItem(menu, param2, info, sizeof(info));
			
			new Float:SpawnAngles[3];
			new Float:SpawnOrigin[3];
								
			decl String:steamid[64];						
			GetClientAuthString(client, steamid, sizeof(steamid));
			
			switch (GetRandomInt(1, 4))
			{
				case 1:
				{
					SpawnOrigin[0] = -2815.506;
					SpawnOrigin[1] = -1423.124;
					SpawnOrigin[2] = 8.03125;
					SpawnAngles[0] = 0.000000;
					SpawnAngles[1] = 90.000000;
					SpawnAngles[2] = 0.000000;
				}
				case 2:
				{
					SpawnOrigin[0] = -2830.628;
					SpawnOrigin[1] = -1817.259;
					SpawnOrigin[2] = 8.03125;
					SpawnAngles[0] = 0.000000;
					SpawnAngles[1] = 90.000000;
					SpawnAngles[2] = 0.000000;
				}
				case 3:
				{
					SpawnOrigin[0] = -2809.339;
					SpawnOrigin[1] = -1687.605;
					SpawnOrigin[2] = 8.03125;
					SpawnAngles[0] = 0.000000;
					SpawnAngles[1] = 90.000000;
					SpawnAngles[2] = 0.000000;
				}
				case 4:
				{
					SpawnOrigin[0] = -2830.628;
					SpawnOrigin[1] = -1817.259;
					SpawnOrigin[2] = 8.03125;
					SpawnAngles[0] = 0.000000;
					SpawnAngles[1] = 90.000000;
					SpawnAngles[2] = 0.000000;
				}
			}		
			decl String:error[256];			
			new Handle:db_rp = SQL_Connect("roleplay", true, error, sizeof(error));
			decl String:sBuffer[1024];
			Format(sBuffer, sizeof(sBuffer),"SELECT couleur FROM `Roleplay_Voitures` WHERE `steam_id` = '%s';", steamid);
			new Handle:hQuery = SQL_Query(db_rp, sBuffer);
			if(hQuery)
			{
				SQL_Rewind(hQuery);
				new bool:fetch = SQL_FetchRow(hQuery);
				if(fetch)
				{
					couleur[client]	= SQL_FetchInt(hQuery, 0);
				
					if (StrEqual(info, "audi_tt", true))
					{
						CPrintToChat(client, "{green}[Marcel]{blue} Votre {green}Audi TT{blue} est au garage");
						SpawnGarage(client, SpawnOrigin, SpawnAngles, "models/tdmcars/auditt.mdl", "scripts/vehicles/auditt.txt", 0, couleur[client]);
					}
					if (StrEqual(info, "dbs", true))
					{
						CPrintToChat(client, "{green}[Marcel]{blue} Votre {green}Aston Martin DBS{blue} est au garage");
						SpawnGarage(client, SpawnOrigin, SpawnAngles, "models/tdmcars/dbs.mdl", "scripts/vehicles/dbs.txt", 0, couleur[client]);
					}
					if (StrEqual(info, "c4", true))
					{
						CPrintToChat(client, "{green}[Marcel]{blue} Votre {green}Citroen C4{blue} est au garage");
						CPrintToChat(client, "{green}[Marcel]{blue} LA VOITURE DU PEUPLE ! ");
						SpawnGarage(client, SpawnOrigin, SpawnAngles, "models/tdmcars/cit_c4.mdl", "scripts/vehicles/c4.txt", 0, couleur[client]);
					}
					if (StrEqual(info, "lambo", true))
					{
						CPrintToChat(client, "{green}[Marcel]{blue} Votre {green}Lamborghini Gallardo{blue} est au garage");
						SpawnGarage(client, SpawnOrigin, SpawnAngles, "models/tdmcars/gallardo.mdl", "scripts/vehicles/lambo.txt", 0, couleur[client]);
					}
					if (StrEqual(info, "land", true))
					{
						CPrintToChat(client, "{green}[Marcel]{blue} Votre {green}LandRover{blue} est au garage");
						SpawnGarage(client, SpawnOrigin, SpawnAngles, "models/tdmcars/landrover.mdl", "scripts/vehicles/mini.txt", 0, couleur[client]);
					}
					if (StrEqual(info, "audi_s5", true))
					{
						CPrintToChat(client, "{green}[Marcel]{blue} Votre {green}Audi S5{blue} est au garage");
						SpawnGarage(client, SpawnOrigin, SpawnAngles, "models/tdmcars/s5.mdl", "scripts/vehicles/s5.txt", 0, couleur[client]);
					}
					if (StrEqual(info, "vip", true))
					{
						CPrintToChat(client, "{green}[Marcel]{blue} Votre {green}Kia{blue} est au garage");
						SpawnGarage(client, SpawnOrigin, SpawnAngles, "models/tdmcars/kia_ceed.mdl", "scripts/vehicles/mini.txt", 0, couleur[client]);
					}
				}
				else
				{
					CPrintToChat(client, "{green}[Marcel]{red} Erreur SQL ! Vehicules Indisponibles !");
				}
			}
		}
		else
		{
			CPrintToChat(client, "{green}[Marcel]{red} Votre véhicule est déja utilisé !");
		}
	}
	return 0;
}

public Menu_kouleure(Handle:menu, MenuAction:action, client, param2)
{
	if(action == MenuAction_Select)
	{	
		new String:info[32];
		GetMenuItem(menu, param2, info, sizeof(info));
		decl String:query[256];
		decl String:error[256];
		new Handle:db_rp = SQL_Connect("roleplay", true, error, sizeof(error));
		new String:steamid[32];				
		GetClientAuthString(client, steamid, sizeof(steamid));
		
		if(StrEqual(info, "blanc"))
		{
			if(money[client] >= 1000) 
			{
				money[client] = money[client] - 1000;
				CPrintToChat(client,"{green}[Marcel]{blue} Vous avez acheté la couleur {white}Blanche");
				Format(query, sizeof(query), "UPDATE Roleplay_Voitures SET couleur = 0 WHERE `steam_id` = '%s';", steamid);
			}
			else
			{
				CPrintToChat(client,"{green}[Marcel]{red} Vous n'avez pas l'argent nessecaire !");
			}
		}
		else if(StrEqual(info, "noir"))
		{
			if(money[client] >= 1200) 
			{
				money[client] = money[client] - 1200;
				CPrintToChat(client,"{green}[Marcel]{blue} Vous avez acheté la couleur {black}Noir");
				Format(query, sizeof(query), "UPDATE Roleplay_Voitures SET couleur = 1 WHERE `steam_id` = '%s';", steamid);
			}
			else
			{
				CPrintToChat(client,"{green}[Marcel]{red} Vous n'avez pas l'argent nessecaire !");
			}
		}
		else if(StrEqual(info, "rouge"))
		{
			if(money[client] >= 1200) 
			{
				money[client] = money[client] - 1200;
				CPrintToChat(client,"{green}[Marcel]{blue} Vous avez acheté la couleur {red}Rouge");
				Format(query, sizeof(query), "UPDATE Roleplay_Voitures SET couleur = 2 WHERE `steam_id` = '%s';", steamid);
			}
			else
			{
				CPrintToChat(client,"{green}[Marcel]{red} Vous n'avez pas l'argent nessecaire !");
			}
		}
		else if(StrEqual(info, "blue"))
		{
			if(money[client] >= 1200) 
			{
				money[client] = money[client] - 1200;
				CPrintToChat(client,"{green}[Marcel]{blue} Vous avez acheté la couleur BLEUE");
				Format(query, sizeof(query), "UPDATE Roleplay_Voitures SET couleur = 3 WHERE `steam_id` = '%s';", steamid);
			}
			else
			{
				CPrintToChat(client,"{green}[Marcel]{red} Vous n'avez pas l'argent nessecaire !");
			}
		}
		else if(StrEqual(info, "verte"))
		{
			if(money[client] >= 1200) 
			{
				money[client] = money[client] - 1200;
				CPrintToChat(client,"{green}[Marcel]{blue} Vous avez acheté la couleur {green}Verte");
				Format(query, sizeof(query), "UPDATE Roleplay_Voitures SET couleur = 4 WHERE `steam_id` = '%s';", steamid);
			}
			else
			{
				CPrintToChat(client,"{green}[Marcel]{red} Vous n'avez pas l'argent nessecaire !");
			}
		}
		else if(StrEqual(info, "violet"))
		{
			if(money[client] >= 1200) 
			{
				money[client] = money[client] - 1200;
				CPrintToChat(client,"{green}[Marcel]{blue} Vous avez acheté la couleur {purple}Violet");
				Format(query, sizeof(query), "UPDATE Roleplay_Voitures SET couleur = 5 WHERE `steam_id` = '%s';", steamid);
			}
			else
			{
				CPrintToChat(client,"{green}[Marcel]{red} Vous n'avez pas l'argent nessecaire !");
			}
		}
		SQL_FastQuery(db_rp, query);
	}
}

public Menu_Voitures_By(Handle:menua, MenuAction:action, client, param2)
{
	if(action == MenuAction_Select)
	{	
		new String:info[32];
		GetMenuItem(menua, param2, info, sizeof(info));
		
		decl String:SteamId[256];
		GetClientAuthString(client, SteamId, sizeof(SteamId));
		
		if (StrEqual(info, "dbs"))
		{
			if(money[client] >= 125000) 
			{
				money[client] = money[client] - 125000;
				
				AST_Dbs[client] = 1;
				
				CPrintToChat(client,"{green}[Marcel]{blue} Bravo vous venez d'acheter une {green}Aston Matin DBS");
				
				decl String:query[256];
				decl String:error[256];
				new Handle:db_rp = SQL_Connect("roleplay", true, error, sizeof(error));
				Format(query, sizeof(query), "UPDATE Roleplay_Voitures SET AST_Dbs = 1 WHERE `steam_id` = '%s';", SteamId);
				SQL_FastQuery(db_rp, query);
			}
			else
			{
				CPrintToChat(client,"{green}[Marcel]{red} Vous n'avez pas l'argent sur vous !");
			}
		}
		else if (StrEqual(info, "lambo"))
		{
			if(money[client] >= 100000) 
			{
				money[client] = money[client] - 100000;
				
				CPrintToChat(client,"{green}[Marcel]{blue} Bravo vous venez d'acheter une {green}");
				
				Lambo[client] = 1;

				decl String:query[256];
				decl String:error[256];
				new Handle:db_rp = SQL_Connect("roleplay", true, error, sizeof(error));
				Format(query, sizeof(query), "UPDATE Roleplay_Voitures SET Lambo = 1 WHERE `steam_id` = '%s';", SteamId);
				SQL_FastQuery(db_rp, query);
			}
			else
			{
				CPrintToChat(client,"{green}[Marcel]{red} Vous n'avez pas l'argent sur vous !");
			}
		}
		else if (StrEqual(info, "land"))
		{
			if(money[client] >= 80000) 
			{
				money[client] = money[client] - 80000;
				
				CPrintToChat(client,"{green}[Marcel]{blue} Bravo vous venez d'acheter une {green}Land Rover");
				
				LandRover[client] = 1;
		
				decl String:query[256];
				decl String:error[256];
				new Handle:db_rp = SQL_Connect("roleplay", true, error, sizeof(error));
				Format(query, sizeof(query), "UPDATE Roleplay_Voitures SET LandRover = 1 WHERE `steam_id` = '%s';", SteamId);
				SQL_FastQuery(db_rp, query);
			}
			else
			{
				CPrintToChat(client,"{green}[Marcel]{red} Vous n'avez pas l'argent sur vous !");
			}
		}
		else if (StrEqual(info, "audi_s5"))
		{
			if(money[client] >= 50000) 
			{
				money[client] = money[client] - 50000;	
				
				Audi_S5[client] = 1;
				
				CPrintToChat(client,"{green}[Marcel]{blue} Bravo vous venez d'acheter une {green}Audi S5");
				
				decl String:query[256];
				decl String:error[256];
				new Handle:db_rp = SQL_Connect("roleplay", true, error, sizeof(error));
				Format(query, sizeof(query), "UPDATE Roleplay_Voitures SET Audi_S5 = 1 WHERE `steam_id` = '%s';", SteamId);
				SQL_FastQuery(db_rp, query);
			}
			else
			{
				CPrintToChat(client,"{green}[Marcel]{red} Vous n'avez pas l'argent sur vous !");
			}
		}
		else if (StrEqual(info, "audi_tt"))
		{
			if(money[client] >= 35000) 
			{
				money[client] = money[client] - 35000;
				
				CPrintToChat(client,"{green}[Marcel]{blue} Bravo vous venez d'acheter une {green}Audi TT");
				
				Audi_TT[client] = 1;
				
				decl String:query[256];
				decl String:error[256];
				new Handle:db_rp = SQL_Connect("roleplay", true, error, sizeof(error));
				Format(query, sizeof(query), "UPDATE Roleplay_Voitures SET Audi_TT = 1 WHERE `steam_id` = '%s';", SteamId);
				SQL_FastQuery(db_rp, query);
			}
			else
			{
				CPrintToChat(client,"{green}[Marcel]{red} Vous n'avez pas l'argent sur vous !");
			}
		}
		else if (StrEqual(info, "c4"))
		{
			if(money[client] >= 10000) 
			{
				money[client] = money[client] - 10000;
				
				CPrintToChat(client,"{green}[Marcel]{blue} Bravo vous venez d'acheter une {green}Citroen C4");
				
				Citroen[client] = 1;
				
				decl String:query[256];
				decl String:error[256];
				new Handle:db_rp = SQL_Connect("roleplay", true, error, sizeof(error));
				Format(query, sizeof(query), "UPDATE Roleplay_Voitures SET Citroen = 1 WHERE `steam_id` = '%s';", SteamId);
				SQL_FastQuery(db_rp, query);	
			}
			else
			{
				CPrintToChat(client,"{green}[Marcel]{red} Vous n'avez pas l'argent sur vous !");
			}
		}
		CloseHandle(menua);
	}
	else if (action == MenuAction_End)
	{
		CloseHandle(menua);
	}
}

public Action:Timer_Kit(Handle:timer, any:client)
{
	if (IsClientInGame(client))
	{
		new kitt = kitcrochetage[client] + 1;

		kitcrochetage[client] = kitt;

		CPrintToChat(client, "%s {blue}Vous avez pris un kit de crochetage {green}[%i/10].", LOGO, kitcrochetage[client]);
		
		LogToFile(Logfile,"Le joueur %N a créer un kit de crochetage(%i/10)", client, kitcrochetage[client]);
		
		OnKit[client] = false;
		
		SetEntPropFloat(client, Prop_Send, "m_flProgressBarStartTime", GetGameTime()); 
		SetEntProp(client, Prop_Send, "m_iProgressBarDuration", 0); 
		
		SetEntityRenderColor(client, 255, 255, 255, 255);
		SetEntityMoveType(client, MOVETYPE_WALK);
	}
}

public Action:Timer_KitExplosif(Handle:timer, any:client)
{
	if (IsClientInGame(client))
	{
		new random = GetRandomInt(1, 5);
		
		if (random == 3)
		{
			new kitt = kitexplosif[client] + 1;

			kitexplosif[client] = kitt;

			CPrintToChat(client, "%s {blue}Vous avez crée un kit explosif {green}[%i/5].", LOGO, kitexplosif[client]);
			
			LogToFile(Logfile,"Le joueur %N a créer un kit explosif(%i/5)", client, kitexplosif[client]);
		}
		else
		{
			CPrintToChat(client, "%s {red}Tentative ratée !", LOGO);
		}
		
		
		OnKit[client] = false;
			
		SetEntPropFloat(client, Prop_Send, "m_flProgressBarStartTime", GetGameTime()); 
		SetEntProp(client, Prop_Send, "m_iProgressBarDuration", 0); 
		
		SetEntityRenderColor(client, 255, 255, 255, 255);
		SetEntityMoveType(client, MOVETYPE_WALK);
	}
}

public OnClientSettingsChanged(client)
{
	if (IsClientInGame(client))
	{
		decl String:ClanTagRankName[20];
		GetClanTagName(jobid[client], rankid[client], ClanTagRankName, sizeof(ClanTagRankName));

		CS_SetClientClanTag(client, ClanTagRankName);
	}
}

public OnClientDisconnect(client)
{
	if (IsClientInGame(client))
	{
		if (money[client] < 0)
		{
			money[client] = 0;
		}
		
		if (bank[client] < 0)
		{
			bank[client] = 0;
		}
		
		if (g_IsTazed[client])
		{
			g_IsTazed[client] = false;
		}
				
		SDKUnhook(client, SDKHook_OnTakeDamage, OnTakeDamage);
		SDKUnhook(client, SDKHook_PostThink, OnPostThink);
		SDKUnhook(client, SDKHook_PreThink, OnPreThink);
		
		gObj[client] = -1;
		printer[client] = 0;
		g_invisible[client] = 0;
		g_godmod[client] = 0;
		
		g_sSteamID[client][0] = '\0';
		
		lastontime[client] = GetTime();
		
		DBSave(client);
		
		Chargement[client] = false;
		Policier_TEMP[client] = false;
		IsDisconnect[client] = true;
		Loaded[client] = false;
		fiche[client] = false;
		nojail[client] = false;
		IsCivil[client] = false;
		CarHorn[client] = false;
		IsExitVehicle[client] = false;
		
		if(TimerHud[client] != INVALID_HANDLE)
		{
			KillTimer(TimerHud[client]);
			TimerHud[client] = INVALID_HANDLE;
		}
		
		if (OnKit[client])
		{
			OnKit[client] = false;
			CloseHandle(GiveKit);
		}
		
		if (g_crochetageon[client])
		{
			KillTimer(g_croche[client]);
			g_crochetageon[client] = false;
		}
		
		if (g_booldead[client])
		{
			KillTimer(g_deadtimer[client]);
			g_booldead[client] =  false;
		}
	}
}

public Menu_Bank(Handle:menu, MenuAction:action, client, param2)
{
	if (action == MenuAction_Select)
	{
		new String:info[32];
		GetMenuItem(menu, param2, info, sizeof(info));
		
		if (StrEqual(info, "Deposit"))
		{
			if (money[client] <= 0)
			{
				CPrintToChat(client, "%s {red}Il faut avoir de l'argent pour le déposer !", LOGO);		
			}
			
			new Handle:menub = CreateMenu(deposit_menu);
			SetMenuTitle(menub, "Choisisez la somme :");
			
			if (money[client] >= 10)
			{
				AddMenuItem(menub, "10", "10€");
			}
			if (money[client] >= 50)
			{
				AddMenuItem(menub, "50", "50€");
			}
			if (money[client] >= 100)
			{
				AddMenuItem(menub, "100", "100€");
			}
			if (money[client] >= 200)
			{
				AddMenuItem(menub, "200", "200€");
			}
			if (money[client] >= 500)
			{
				AddMenuItem(menub, "500", "500€");
			}
			if (money[client] >= 1000)
			{
				AddMenuItem(menub, "1000", "1000€");
			}
			if (money[client] >= 2000)
			{
				AddMenuItem(menub, "2000", "2000€");
			}
			if (money[client] >= 5000)
			{
				AddMenuItem(menub, "5000", "5000€");
			}
			if (money[client] >= 10000)
			{
				AddMenuItem(menub, "10000", "10000");
			}
			if (money[client] >= 30000)
			{
				AddMenuItem(menub, "30000", "30000");
			}
			if (money[client] >= 1)
			{
				AddMenuItem(menub, "all", "Tout mon argent");
			}
			
			DisplayMenu(menub, client, MENU_TIME_FOREVER);
		}
		else if (StrEqual(info, "Retired"))
		{
			if (bank[client] <= 0)
			{
				CPrintToChat(client, "%s {red}Votre compte est malheuresement vide !", LOGO);			
			}
			
			
			if (money[client] >= 150000)
			{
				CPrintToChat(client, "%s {red}Vous avez trop d'argent sur vous !", LOGO);	
			}
			else
			{
				new Handle:menuba = CreateMenu(retired_menu);
				SetMenuTitle(menuba, "Choisisez la somme :");
				
				if (bank[client] >= 5)
				{
					AddMenuItem(menuba, "5", "5€");
				}
				if (bank[client] >= 10)
				{
					AddMenuItem(menuba, "10", "10€");
				}
				if (bank[client] >= 50)
				{
					AddMenuItem(menuba, "50", "50€");
				}
				if (bank[client] >= 100)
				{
					AddMenuItem(menuba, "100", "100€");
				}
				if (bank[client] >= 200)
				{
					AddMenuItem(menuba, "200", "200€");
				}
				if (bank[client] >= 500)
				{
					AddMenuItem(menuba, "500", "500€");
				}
				if (bank[client] >= 1000)
				{
					AddMenuItem(menuba, "1000", "1000€");
				}
				if (bank[client] >= 2000)
				{
					AddMenuItem(menuba, "2000", "2000€");
				}
				if (bank[client] >= 5000)
				{
					AddMenuItem(menuba, "5000", "5000€");
				}
				if (bank[client] >= 10000)
				{
					AddMenuItem(menuba, "10000", "10000€");
				}
				if (bank[client] >= 30000)
				{
					AddMenuItem(menuba, "30000", "30000€");
				}
				
				DisplayMenu(menuba, client, MENU_TIME_FOREVER);
			}
		}
		else if (StrEqual(info, "Capital"))
		{
			
			if (money[client] <= 0)
			{
				CPrintToChat(client, "%s {red}Votre compte est malheuresement vide !", LOGO);		
			}
			
			new Handle:menuc = CreateMenu(capital_menu);
			SetMenuTitle(menuc, "Choisis la somme :");
			
			if (money[client] >= 10)
			{
				AddMenuItem(menuc, "10", "10€");
			}
			if (money[client] >= 50)
			{
				AddMenuItem(menuc, "50", "50€");
			}
			if (money[client] >= 100)
			{
				AddMenuItem(menuc, "100", "100€");
			}
			if (money[client] >= 200)
			{
				AddMenuItem(menuc, "200", "200€");
			}
			if (money[client] >= 500)
			{
				AddMenuItem(menuc, "500", "500€");
			}
			if (money[client] >= 1000)
			{
				AddMenuItem(menuc, "1000", "1000€");
			}
			if (money[client] >= 2000)
			{
				AddMenuItem(menuc, "2000", "2000€");
			}
			if (money[client] >= 5000)
			{
				AddMenuItem(menuc, "5000", "5000€");
			}
			if (money[client] >= 10000)
			{
				AddMenuItem(menuc, "10000", "10000€");
			}
			if (money[client] >= 30000)
			{
				AddMenuItem(menuc, "30000", "30000€");
			}
			if (money[client] >= 50000)
			{
				AddMenuItem(menuc, "50000", "30000€");
			}
			if (money[client] >= 1)
			{
				AddMenuItem(menuc, "all", "all");
			}
			DisplayMenu(menuc, client, MENU_TIME_FOREVER);
		}
		else if (StrEqual(info, "Inventaire"))
		{
			BuildItemMenu(client);
		}
	}
	else if (action == MenuAction_End)
	{
		CloseHandle(menu);
	}
}

public deposit_menu(Handle:menub, MenuAction:action, client, param2)
{
	if (action == MenuAction_Select)
	{
		new String:info[32];
		GetMenuItem(menub, param2, info, sizeof(info));
		
		new deposit_somme = StringToInt(info, 10);
		
		if (deposit_somme < 0)
		{
			CPrintToChat(client, "%s {red}Seulement du positif ^^", LOGO);
		}
		
		if (StrEqual(info, "all"))
		{
			CPrintToChat(client, "%s {blue}Vos pépites sont saines et sauves !", LOGO);
			
			bank[client] = money[client] + bank[client];
			money[client] = 0;
		}
		
		else if (money[client] >= deposit_somme)
		{
			bank[client] += deposit_somme;
			money[client] -= deposit_somme;
			
			CPrintToChat(client, "%s {blue}Vous avez déposé {green}%i€.", LOGO, deposit_somme);
		}
	}
	else if (action == MenuAction_End)
	{
		CloseHandle(menub);
	}
}

public retired_menu(Handle:menuba, MenuAction:action, client, param2)
{
	if (action == MenuAction_Select)
	{
		new String:info[32];
		GetMenuItem(menuba, param2, info, sizeof(info));
			
		new retired_somme = StringToInt(info, 10);
		
		if (retired_somme > bank[client])
		{
			CPrintToChat(client, "%s {red}Vous n'avez pas l'argent", LOGO);	
		}
		
		new final_cash = (money[client] + retired_somme);
		
		bank[client] -= retired_somme;
		money[client] = final_cash;
			
		CPrintToChat(client, "%s {blue}Vous avez retiré{green} %i€.", LOGO, retired_somme);
	}
	else if (action == MenuAction_End)
	{
		CloseHandle(menuba);
	}
}

public capital_menu(Handle:menub, MenuAction:action, client, param2)
{
	if (action == MenuAction_Select)
	{
		new String:info[32];
		GetMenuItem(menub, param2, info, sizeof(info));
		
		new deposit_somme = StringToInt(info, 10);
		
		if (deposit_somme < 0)
		{
			CPrintToChat(client, "%s ", LOGO);
		}
		
		if (StrEqual(info, "all"))
		{
			CPrintToChat(client, "%s {blue}Vous avez déposez tout votre argent", LOGO);
			
			capital[rankid[client]] = capital[rankid[client]] + money[client];
			money[client] = 0;
			
			LogToFile(Logfile,"Le joueur %N a déposé tout son argent en banque.", client);
		}
		else if (money[client] >= deposit_somme)
		{
			capital[rankid[client]] += deposit_somme;
			money[client] -= deposit_somme;
			
			CPrintToChat(client, "%s {blue}Vous avez déposé {green}%i€.", LOGO, deposit_somme);
			
			LogToFile(Logfile,"Le joueur %N a déposé %i en banque.", client, deposit_somme);
		}
	}
	else if (action == MenuAction_End)
	{
		CloseHandle(menub);
	}
}
public Action:Cmd_Lock(client, args)
{
	decl Ent;
	decl String:Door[255];

	Ent = GetClientAimTarget(client, false);
	
	if (IsPlayerAlive(client))
	{
		if (Ent != -1)
		{
			GetEdictClassname(Ent, Door, sizeof(Door));
			
			if (StrEqual(Door, "prop_vehicle_driveable"))
			{
				if (Car[client] == Ent)
				{
					Entity_Lock(Ent);
					CPrintToChat(client, "%s {blue} Vérouillage de votre véhicule", LOGO);
				}
				else
				{
					CPrintToChat(client, "%s {red} Ce n'est pas votre véhicule", LOGO);
				}
			}
			else if (StrEqual(Door, "func_door_rotating") || StrEqual(Door, "prop_door_rotating") || StrEqual(Door, "func_door"))
			{
				if (Entity_IsLocked(Ent))
				{
					CPrintToChat(client, "%s La porte est déjà fermée a clef.", LOGO);
					return Plugin_Handled;
				}
				else
				{
					if (Chambre_1(Ent) || Chambre_2(Ent) || Chambre_3(Ent) || Chambre_11(Ent) || Chambre_12(Ent) || Chambre_13(Ent) 
					|| Chambre_14(Ent) || Chambre_21(Ent) || Chambre_22(Ent) || Chambre_23(Ent) || Chambre_24(Ent) || Chambre_31(Ent) || 
					Chambre_32(Ent) || Chambre_33(Ent) || Chambre_34(Ent) || Chambre_41(Ent) || Chambre_42(Ent) || IsInVilla(Ent) || IsInAperture(Ent) || IsInDealer(Ent))
					{
						if (Location[client] > 0)
						{
							if (Location[client] == 1)
							{
								if (Chambre_1(Ent))
								{
									lockdoor(Ent);
									CPrintToChat(client, "%s {blue}Vous avez verrouillé la porte de votre maison", LOGO);
									return Plugin_Handled;
								}
								else
								{
									CPrintToChat(client, "%s {red}Cette propriété n'est pas à vous !", LOGO);
								}
							}
							if (Location[client] == 2)
							{
								if (Chambre_2(Ent))
								{
									lockdoor(Ent);
									CPrintToChat(client, "%s {blue}Vous avez verrouillé la porte de votre maison", LOGO);
									return Plugin_Handled;
								}
								else
								{
									CPrintToChat(client, "%s {red}Cette propriété n'est pas à vous !", LOGO);
								}
							}
							if (Location[client] == 3)
							{
								if (Chambre_3(Ent))
								{
									lockdoor(Ent);
									CPrintToChat(client, "%s {blue}Vous avez verrouillé la porte de votre maison", LOGO);
									return Plugin_Handled;
								}
								else
								{
									CPrintToChat(client, "%s {red}Cette propriété n'est pas à vous !", LOGO);
								}
							}
							if (Location[client] == 4)
							{
								if (Chambre_11(Ent))
								{
									lockdoor(Ent);
									CPrintToChat(client, "%s {blue}Vous avez verrouillé la porte de votre maison", LOGO);
									return Plugin_Handled;
								}
								else
								{
									CPrintToChat(client, "%s {red}Cette propriété n'est pas à vous !", LOGO);
								}
							}
							if (Location[client] == 5)
							{
								if (Chambre_12(Ent))
								{
									lockdoor(Ent);
									CPrintToChat(client, "%s {blue}Vous avez verrouillé la porte de votre maison", LOGO);
									return Plugin_Handled;
								}
								else
								{
									CPrintToChat(client, "%s {red}Cette propriété n'est pas à vous !", LOGO);
								}
							}
							if (Location[client] == 6)
							{
								if (Chambre_13(Ent))
								{
									lockdoor(Ent);
									CPrintToChat(client, "%s {blue}Vous avez verrouillé la porte de votre maison", LOGO);
									return Plugin_Handled;
								}
								else
								{
									CPrintToChat(client, "%s {red}Cette propriété n'est pas à vous !", LOGO);
								}
							}
							if (Location[client] == 7)
							{
								if (Chambre_14(Ent))
								{
									lockdoor(Ent);
									CPrintToChat(client, "%s {blue}Vous avez verrouillé la porte de votre maison", LOGO);
									return Plugin_Handled;
								}
								else
								{
									CPrintToChat(client, "%s {red}Cette propriété n'est pas à vous !", LOGO);
								}
							}
							if (Location[client] == 8)
							{
								if (Chambre_21(Ent))
								{
									lockdoor(Ent);
									CPrintToChat(client, "%s {blue}Vous avez verrouillé la porte de votre maison", LOGO);
									return Plugin_Handled;
								}
								else
								{
									CPrintToChat(client, "%s {red}Cette propriété n'est pas à vous !", LOGO);
								}
							}
							if (Location[client] == 9)
							{
								if (Chambre_22(Ent))
								{
									lockdoor(Ent);
									CPrintToChat(client, "%s {blue}Vous avez verrouillé la porte de votre maison", LOGO);
									return Plugin_Handled;
								}
								else
								{
									CPrintToChat(client, "%s {red}Cette propriété n'est pas à vous !", LOGO);
								}
							}
							if (Location[client] == 10)
							{
								if (Chambre_23(Ent))
								{
									lockdoor(Ent);
									CPrintToChat(client, "%s {blue}Vous avez verrouillé la porte de votre maison", LOGO);
									return Plugin_Handled;
								}
								else
								{
									CPrintToChat(client, "%s {red}Cette propriété n'est pas à vous !", LOGO);
								}
							}
							if (Location[client] == 11)
							{
								if (Chambre_24(Ent))
								{
									lockdoor(Ent);
									CPrintToChat(client, "%s {blue}Vous avez verrouillé la porte de votre maison", LOGO);
									return Plugin_Handled;
								}
								else
								{
									CPrintToChat(client, "%s {red}Cette propriété n'est pas à vous !", LOGO);
								}
							}
							if (Location[client] == 12)
							{
								if (Chambre_31(Ent))
								{
									lockdoor(Ent);
									CPrintToChat(client, "%s {blue}Vous avez verrouillé la porte de votre maison", LOGO);
									return Plugin_Handled;
								}
								else
								{
									CPrintToChat(client, "%s {red}Cette propriété n'est pas à vous !", LOGO);
								}
							}
							if (Location[client] == 13)
							{
								if (Chambre_32(Ent))
								{
									lockdoor(Ent);
									CPrintToChat(client, "%s {blue}Vous avez verrouillé la porte de votre maison", LOGO);
									return Plugin_Handled;
								}
								else
								{
									CPrintToChat(client, "%s {red}Cette propriété n'est pas à vous !", LOGO);
								}
							}
							if (Location[client] == 14)
							{
								if (Chambre_33(Ent))
								{
									lockdoor(Ent);
									CPrintToChat(client, "%s {blue}Vous avez verrouillé la porte de votre maison", LOGO);
									return Plugin_Handled;
								}
								else
								{
									CPrintToChat(client, "%s {red}Cette propriété n'est pas à vous !", LOGO);
								}
							}
							if (Location[client] == 15)
							{
								if (Chambre_34(Ent))
								{
									lockdoor(Ent);
									CPrintToChat(client, "%s {blue}Vous avez verrouillé la porte de votre maison", LOGO);
									return Plugin_Handled;
								}
								else
								{
									CPrintToChat(client, "%s {red}Cette propriété n'est pas à vous !", LOGO);
								}
							}
							if (Location[client] == 16)
							{
								if (Chambre_41(Ent) || IsInDealer(Ent))
								{
									lockdoor(Ent);
									CPrintToChat(client, "%s {blue}Vous avez verrouillé la porte de votre maison", LOGO);
									return Plugin_Handled;
								}
								else
								{
									CPrintToChat(client, "%s {red}Cette propriété n'est pas à vous !", LOGO);
								}
							}
							if (Location[client] == 17)
							{
								if (Chambre_42(Ent) || IsInDealer(Ent))
								{
									lockdoor(Ent);
									CPrintToChat(client, "%s {blue}Vous avez verrouillé la porte de votre maison", LOGO);
									return Plugin_Handled;
								}
								else
								{
									CPrintToChat(client, "%s {red}Cette propriété n'est pas à vous !", LOGO);
								}
							}
							if (Location[client] == 18)
							{
								if (IsInVilla(Ent))
								{
									lockdoor(Ent);
									CPrintToChat(client, "%s {blue}Vous avez verrouillé la porte de votre Villa VIP", LOGO);
									return Plugin_Handled;
								}
								else
								{
									CPrintToChat(client, "%s {red}Cette propriété n'est pas à vous !", LOGO);
								}
							}
							if (Location[client] == 19)
							{
								if (IsInAperture(Ent))
								{
									lockdoor(Ent);
									CPrintToChat(client, "%s {blue}Vous avez verrouillé la porte de votre Laboratoire Diabolique", LOGO);
									return Plugin_Handled;
								}
								else
								{
									CPrintToChat(client, "%s {red}Cette propriété n'est pas à vous !", LOGO);
								}
							}						
						}
						else
						{
							new String:SteamID[64];
							GetClientAuthString(client, SteamID, sizeof(SteamID));
							if (Chef_SERVEUR(client))
							{
								lockdoor(Ent);
								CPrintToChat(client, "%s {black} [ADMIN]{white} Porte dévérouillée ({purple}Flag Z)", LOGO);
								return Plugin_Handled;
							}
							else
							{
								CPrintToChat(client, "%s {red} Cette maison n'est pas à vous !", LOGO);
							}
						}
					}
					else
					{
						if (rankid[client] == 1)
						{
							if (jobid[client] == 1 || jobid[client] == 2)
							{
								lockdoor(Ent);
								CPrintToChat(client, "%s {red} Vous avez verrouillé la porte.", LOGO);
								return Plugin_Handled;
							}
							else
							{
								if (IsInComico(Ent))
								{
									lockdoor(Ent);
									CPrintToChat(client, "%s {red} Vous avez verrouillé la porte.", LOGO);
									return Plugin_Handled;
								}
								else
								{
									CPrintToChat(client, "%s {red} Vous n'avez pas les clefs de cette porte", LOGO);
								}
							}
						}						
						else if (rankid[client] == 2)
						{
							if (IsInMafia(Ent))
							{
								lockdoor(Ent);
								CPrintToChat(client, "%s {red} Vous avez verrouillé la porte.", LOGO);
								return Plugin_Handled;
							}
							else
							{
								CPrintToChat(client, "%s {red} Vous n'avez pas les clefs de cette porte", LOGO);
							}
						}
						else if (rankid[client] == 3)
						{
							if (IsInDealer(Ent))
							{
								lockdoor(Ent);
								CPrintToChat(client, "%s {red} Vous avez verrouillé la porte.", LOGO);
								return Plugin_Handled;
							}
							else
							{
								CPrintToChat(client, "%s {red} Vous n'avez pas les clefs de cette porte", LOGO);
							}
						}
						else if (rankid[client] == 4)
						{
							if (IsInCoach(Ent))
							{
								lockdoor(Ent);
								CPrintToChat(client, "%s {red} Vous avez verrouillé la porte.", LOGO);
								return Plugin_Handled;
							}
							else
							{
								CPrintToChat(client, "%s {red} Vous n'avez pas les clefs de cette porte", LOGO);
							}
						}
						else if (rankid[client] == 5)
						{
							if (IsInArmu(Ent))
							{
								lockdoor(Ent);
								CPrintToChat(client, "%s {red} Vous avez verrouillé la porte.", LOGO);
								return Plugin_Handled;
							}
							else
							{
								CPrintToChat(client, "%s {red} Vous n'avez pas les clefs de cette porte", LOGO);
							}
						}
						else if (rankid[client] == 6)
						{
							if (IsInLoto(Ent))
							{
								lockdoor(Ent);
								CPrintToChat(client, "%s {red} Vous avez verrouillé la porte.", LOGO);
								return Plugin_Handled;
							}
							else
							{
								CPrintToChat(client, "%s {red} Vous n'avez pas les clefs de cette porte", LOGO);
							}
						}
						else if (rankid[client] == 7)
						{
							if (IsInBank(Ent))
							{
								lockdoor(Ent);
								CPrintToChat(client, "%s {red} Vous avez verrouillé la porte.", LOGO);
								return Plugin_Handled;
							}
							else
							{
								CPrintToChat(client, "%s {red} Vous n'avez pas les clefs de cette porte", LOGO);
							}
						}
						else if (rankid[client] == 8)
						{
							if (IsInHosto(Ent))
							{
								lockdoor(Ent);
								CPrintToChat(client, "%s {red} Vous avez verrouillé la porte.", LOGO);
								return Plugin_Handled;
							}
							else
							{
								CPrintToChat(client, "%s {red} Vous n'avez pas les clefs de cette porte", LOGO);
							}
						}
						else if (rankid[client] == 9)
						{
							if (IsInArti(Ent))
							{
								lockdoor(Ent);
								CPrintToChat(client, "%s {red} Vous avez verrouillé la porte.", LOGO);
								return Plugin_Handled;
							}
							else
							{
								CPrintToChat(client, "%s {red} Vous n'avez pas les clefs de cette porte", LOGO);
							}
						}
						else if (rankid[client] == 10)
						{
							if (IsInTribunal(Ent))
							{
								lockdoor(Ent);
								CPrintToChat(client, "%s {red} Vous avez verrouillé la porte.", LOGO);
								return Plugin_Handled;
							}
							else
							{
								CPrintToChat(client, "%s {red} Vous n'avez pas les clefs de cette porte", LOGO);
							}
						}
						else if (rankid[client] == 11)
						{
							if (IsInTueur(Ent))
							{
								lockdoor(Ent);
								CPrintToChat(client, "%s {red} Vous avez verrouillé la porte.", LOGO);
								return Plugin_Handled;
							}
							else
							{
								CPrintToChat(client, "%s {red} Vous n'avez pas les clefs de cette porte", LOGO);
							}
						}
						else if (rankid[client] == 12)
						{
							if (IsInTech(Ent))
							{
								lockdoor(Ent);
								CPrintToChat(client, "%s {red} Vous avez verrouillé la porte.", LOGO);
								return Plugin_Handled;
							}
							else
							{
								CPrintToChat(client, "%s {red} Vous n'avez pas les clefs de cette porte", LOGO);
							}
						}
						else if (rankid[client] == 14)
						{
							if (IsInDetective(Ent))
							{
								lockdoor(Ent);
								CPrintToChat(client, "%s {red} Vous avez verrouillé la porte.", LOGO);
								return Plugin_Handled;
							}
							else
							{
								CPrintToChat(client, "%s {red} Vous n'avez pas les clefs de cette porte", LOGO);
							}
						}
						else if (rankid[client] == 15)
						{
							if (IsInMcdo(Ent))
							{
								lockdoor(Ent);
								CPrintToChat(client, "%s {red} Vous avez verrouillé la porte.", LOGO);
								return Plugin_Handled;
							}
							else
							{
								CPrintToChat(client, "%s {red} Vous n'avez pas les clefs de cette porte", LOGO);
							}
						}
						else if (rankid[client] == 16)
						{
							if (IsInPaint(Ent))
							{
								lockdoor(Ent);
								CPrintToChat(client, "%s {red} Vous avez verrouillé la porte.", LOGO);
								return Plugin_Handled;
							}
							else
							{
								CPrintToChat(client, "%s {red} Vous n'avez pas les clefs de cette porte", LOGO);
							}
						}
						else if (rankid[client] == 17)
						{
							if (IsIn18th(Ent))
							{
								lockdoor(Ent);
								CPrintToChat(client, "%s {red} Vous avez verrouillé la porte.", LOGO);
								return Plugin_Handled;
							}
							else
							{
								CPrintToChat(client, "%s {red} Vous n'avez pas les clefs de cette porte", LOGO);
							}
						}
						else if (rankid[client] == 18)
						{
							if (IsInIkea(Ent))
							{
								lockdoor(Ent);
								CPrintToChat(client, "%s {red} Vous avez verrouillé la porte.", LOGO);
								return Plugin_Handled;
							}
							else
							{
								CPrintToChat(client, "%s {red} Vous n'avez pas les clefs de cette porte", LOGO);
							}
						}
						else
						{
							CPrintToChat(client, "%s {red} Vous n'avez pas les clefs de cette porte", LOGO);
							return Plugin_Handled;
						}
					}
				}
			}
			else
			{
				CPrintToChat(client, "%s {red} Merci de viser une porte !", LOGO);
				return Plugin_Handled;
			}
		}
		else
		{
			CPrintToChat(client, "%s {red} Merci de viser une porte !", LOGO);
			return Plugin_Handled;
		}
	}
	else
	{
		CPrintToChat(client, "%s {red} Vous devez être vivant !", LOGO);
		return Plugin_Handled;
	}
	
	return Plugin_Continue;
}

public Action:Cmd_Unlock(client, args)
{
	decl Ent;
	decl String:Door[255];
	decl String:entity_name[128];

	Ent = GetClientAimTarget(client, false);
	
	if (IsPlayerAlive(client))
	{
		if (Ent != -1)
		{
			GetEdictClassname(Ent, Door, sizeof(Door));
			Entity_GetName(Ent, entity_name, sizeof(entity_name));
			
			if (StrEqual(Door, "prop_vehicle_driveable"))
			{
				if (Car[client] == Ent)
				{
					Entity_UnLock(Ent);
					CPrintToChat(client, "%s {blue} Dévérouillage de votre véhicule", LOGO);
				}
				else
				{
					CPrintToChat(client, "%s {red} Ce n'est pas votre véhicule", LOGO);
				}
			}
			else if (StrEqual(Door, "func_door_rotating") || StrEqual(Door, "prop_door_rotating") || StrEqual(Door, "func_door"))
			{
				if (!Entity_IsLocked(Ent))
				{
					CPrintToChat(client, "%s {red}La porte est déjà ouverte !", LOGO);
					return Plugin_Handled;
				}
				else
				{
					if (Chambre_1(Ent) || Chambre_2(Ent) || Chambre_3(Ent) || Chambre_11(Ent) || Chambre_12(Ent) || Chambre_13(Ent) 
					|| Chambre_14(Ent) || Chambre_21(Ent) || Chambre_22(Ent) || Chambre_23(Ent) || Chambre_24(Ent) || Chambre_31(Ent) || 
					Chambre_32(Ent) || Chambre_33(Ent) || Chambre_34(Ent) || Chambre_41(Ent) || Chambre_42(Ent) || IsInVilla(Ent) || IsInAperture(Ent))
					{
						if (Location[client] > 0)
						{
							if (Location[client] == 1)
							{
								if (Chambre_1(Ent))
								{
									unlockdoor(Ent);
									CPrintToChat(client, "%s {blue}Vous avez ouvert votre maison", LOGO);
									return Plugin_Handled;
								}
								else
								{
									CPrintToChat(client, "%s {red} Cette maison n'est pas à vous !", LOGO);
								}
							}
							else if (Location[client] == 2)
							{
								if (Chambre_2(Ent))
								{
									unlockdoor(Ent);
									CPrintToChat(client, "%s {blue}{blue}Vous avez ouvert votre maison", LOGO);
									return Plugin_Handled;
								}
								else
								{
									CPrintToChat(client, "%s {red}{red} Cette maison n'est pas à vous !", LOGO);
								}
							}
							else if (Location[client] == 3)
							{
								if (Chambre_3(Ent))
								{
									unlockdoor(Ent);
									CPrintToChat(client, "%s {blue}Vous avez ouvert votre maison", LOGO);
									return Plugin_Handled;
								}
								else
								{
									CPrintToChat(client, "%s {red} Cette maison n'est pas à vous !", LOGO);
								}
							}
							else if (Location[client] == 4)
							{
								if (Chambre_11(Ent))
								{
									unlockdoor(Ent);
									CPrintToChat(client, "%s {blue}Vous avez ouvert votre maison", LOGO);
									return Plugin_Handled;
								}
								else
								{
									CPrintToChat(client, "%s {red} Cette maison n'est pas à vous !", LOGO);
								}
							}
							else if (Location[client] == 5)
							{
								if (Chambre_12(Ent))
								{
									unlockdoor(Ent);
									CPrintToChat(client, "%s {blue}Vous avez ouvert votre maison", LOGO);
									return Plugin_Handled;
								}
								else
								{
									CPrintToChat(client, "%s {red} Cette maison n'est pas à vous !", LOGO);
								}
							}
							else if (Location[client] == 6)
							{
								if (Chambre_13(Ent))
								{
									unlockdoor(Ent);
									CPrintToChat(client, "%s {blue}Vous avez ouvert votre maison", LOGO);
									return Plugin_Handled;
								}
								else
								{
									CPrintToChat(client, "%s {red} Cette maison n'est pas à vous !", LOGO);
								}
							}
							else if (Location[client] == 7)
							{
								if (Chambre_14(Ent))
								{
									unlockdoor(Ent);
									CPrintToChat(client, "%s {blue}Vous avez ouvert votre maison", LOGO);
									return Plugin_Handled;
								}
								else
								{
									CPrintToChat(client, "%s {red} Cette maison n'est pas à vous !", LOGO);
								}
							}
							else if (Location[client] == 8)
							{
								if (Chambre_21(Ent))
								{
									unlockdoor(Ent);
									CPrintToChat(client, "%s {blue}Vous avez ouvert votre maison", LOGO);
									return Plugin_Handled;
								}
								else
								{
									CPrintToChat(client, "%s {red} Cette maison n'est pas à vous !", LOGO);
								}
							}
							else if (Location[client] == 9)
							{
								if (Chambre_22(Ent))
								{
									unlockdoor(Ent);
									CPrintToChat(client, "%s {blue}Vous avez ouvert votre maison", LOGO);
									return Plugin_Handled;
								}
								else
								{
									CPrintToChat(client, "%s {red} Cette maison n'est pas à vous !", LOGO);
								}
							}
							else if (Location[client] == 10)
							{
								if (Chambre_23(Ent))
								{
									unlockdoor(Ent);
									CPrintToChat(client, "%s {blue}Vous avez ouvert votre maison", LOGO);
									return Plugin_Handled;
								}
								else
								{
									CPrintToChat(client, "%s {red} Cette maison n'est pas à vous !", LOGO);
								}
							}
							else if (Location[client] == 11)
							{
								if (Chambre_24(Ent))
								{
									unlockdoor(Ent);
									CPrintToChat(client, "%s {blue}Vous avez ouvert votre maison", LOGO);
									return Plugin_Handled;
								}
								else
								{
									CPrintToChat(client, "%s {red} Cette maison n'est pas à vous !", LOGO);
								}
							}
							else if (Location[client] == 12)
							{
								if (Chambre_31(Ent))
								{
									unlockdoor(Ent);
									CPrintToChat(client, "%s {blue}Vous avez ouvert votre maison", LOGO);
									return Plugin_Handled;
								}
								else
								{
									CPrintToChat(client, "%s {red} Cette maison n'est pas à vous !", LOGO);
								}
							}
							else if (Location[client] == 13)
							{
								if (Chambre_32(Ent))
								{
									unlockdoor(Ent);
									CPrintToChat(client, "%s {blue}Vous avez ouvert votre maison", LOGO);
									return Plugin_Handled;
								}
								else
								{
									CPrintToChat(client, "%s {red} Cette maison n'est pas à vous !", LOGO);
								}
							}
							else if (Location[client] == 14)
							{
								if (Chambre_33(Ent))
								{
									unlockdoor(Ent);
									CPrintToChat(client, "%s {blue}Vous avez ouvert votre maison", LOGO);
									return Plugin_Handled;
								}
								else
								{
									CPrintToChat(client, "%s {red} Cette maison n'est pas à vous !", LOGO);
								}
							}
							else if (Location[client] == 15)
							{
								if (Chambre_34(Ent))
								{
									unlockdoor(Ent);
									CPrintToChat(client, "%s {blue}Vous avez ouvert votre maison", LOGO);
									return Plugin_Handled;
								}
								else
								{
									CPrintToChat(client, "%s {red} Cette maison n'est pas à vous !", LOGO);
								}
							}
							else if (Location[client] == 16)
							{
								if (Chambre_41(Ent))
								{
									unlockdoor(Ent);
									CPrintToChat(client, "%s {blue}Vous avez ouvert votre maison", LOGO);
									return Plugin_Handled;
								}
								else
								{
									CPrintToChat(client, "%s {red} Cette maison n'est pas à vous !", LOGO);
								}
							}
							else if (Location[client] == 17)
							{
								if (Chambre_42(Ent))
								{
									unlockdoor(Ent);
									CPrintToChat(client, "%s {blue}Vous avez ouvert votre maison", LOGO);
									return Plugin_Handled;
								}
								else
								{
									CPrintToChat(client, "%s {red} Cette maison n'est pas à vous !", LOGO);
								}
							}
							else if (Location[client] == 18)
							{
								if (IsInVilla(Ent))
								{
									unlockdoor(Ent);
									CPrintToChat(client, "%s {blue}Vous avez ouvert votre Villa", LOGO);
									return Plugin_Handled;
								}
								else
								{
									CPrintToChat(client, "%s {red} Cette villa n'est pas à vous !", LOGO);
								}
							}
							else if (Location[client] == 19)
							{
								if (IsInAperture(Ent))
								{
									unlockdoor(Ent);
									CPrintToChat(client, "%s {blue}Vous avez ouvert votre laboratoire", LOGO);
									return Plugin_Handled;
								}
								else
								{
									CPrintToChat(client, "%s {red} Ce labo n'est pas à vous !", LOGO);
								}
							}		
						}
						else
						{
							new String:SteamID[64];
							GetClientAuthString(client, SteamID, sizeof(SteamID));
							if (Chef_SERVEUR(client))
							{
								unlockdoor(Ent);
								CPrintToChat(client, "%s {black} [ADMIN]{white} Porte dévérouillée ({purple}Flag Z)", LOGO);
								return Plugin_Handled;
							}
							else
							{
								CPrintToChat(client, "%s {red} Cette maison n'est pas à vous !", LOGO);
							}
						}
					}
					else
					{
						new String:SteamID[64];
						GetClientAuthString(client, SteamID, sizeof(SteamID));
						if (Chef_SERVEUR(client))
						{
							unlockdoor(Ent);
							CPrintToChat(client, "%s {black} [ADMIN]{white} Vous avez ouverte la porte visée", LOGO);
							return Plugin_Handled;
						}
						if (rankid[client] == 1)
						{
							if (jobid[client] == 1 || jobid[client] == 2)
							{
								unlockdoor(Ent);
								CPrintToChat(client, "%s {red} Vous avez verrouillé la porte.", LOGO);
								return Plugin_Handled;
							}
							else
							{
								if (IsInComico(Ent))
								{
									unlockdoor(Ent);
									CPrintToChat(client, "%s {red} Vous avez verrouillé la porte.", LOGO);
									return Plugin_Handled;
								}
								else
								{
									CPrintToChat(client, "%s {red} Vous n'avez pas les clefs de cette porte", LOGO);
								}
							}
						}	
						else if (rankid[client] == 2)
						{
							if (IsInMafia(Ent))
							{
								unlockdoor(Ent);
								CPrintToChat(client, "%s {green} Vous avez ouvert cette porte !", LOGO);
								return Plugin_Handled;
							}
							else
							{
								CPrintToChat(client, "%s {red} Vous n'avez pas les clefs de cette porte", LOGO);
							}
						}
						else if (rankid[client] == 3)
						{
							if (IsInDealer(Ent))
							{
								unlockdoor(Ent);
								CPrintToChat(client, "%s {green} Vous avez ouvert cette porte !", LOGO);
								return Plugin_Handled;
							}
							else
							{
								CPrintToChat(client, "%s {red} Vous n'avez pas les clefs de cette porte", LOGO);
							}
						}
						else if (rankid[client] == 4)
						{
							if (IsInCoach(Ent))
							{
								unlockdoor(Ent);
								CPrintToChat(client, "%s {green} Vous avez ouvert cette porte !", LOGO);
								return Plugin_Handled;
							}
							else
							{
								CPrintToChat(client, "%s {red} Vous n'avez pas les clefs de cette porte", LOGO);
							}
						}
						else if (rankid[client] == 5)
						{
							if (IsInArmu(Ent))
							{
								unlockdoor(Ent);
								CPrintToChat(client, "%s {green} Vous avez ouvert cette porte !", LOGO);
								return Plugin_Handled;
							}
							else
							{
								CPrintToChat(client, "%s {red} Vous n'avez pas les clefs de cette porte", LOGO);
							}
						}
						else if (rankid[client] == 6)
						{
							if (IsInLoto(Ent))
							{
								unlockdoor(Ent);
								CPrintToChat(client, "%s {green} Vous avez ouvert cette porte !", LOGO);
								return Plugin_Handled;
							}
							else
							{
								CPrintToChat(client, "%s {red} Vous n'avez pas les clefs de cette porte", LOGO);
							}
						}
						else if (rankid[client] == 7)
						{
							if (IsInBank(Ent))
							{
								unlockdoor(Ent);
								CPrintToChat(client, "%s {green} Vous avez ouvert cette porte !", LOGO);
								return Plugin_Handled;
							}
							else
							{
								CPrintToChat(client, "%s {red} Vous n'avez pas les clefs de cette porte", LOGO);
							}
						}
						else if (rankid[client] == 8)
						{
							if (IsInHosto(Ent))
							{
								unlockdoor(Ent);
								CPrintToChat(client, "%s {green} Vous avez ouvert cette porte !", LOGO);
								return Plugin_Handled;
							}
							else
							{
								CPrintToChat(client, "%s {red} Vous n'avez pas les clefs de cette porte", LOGO);
							}
						}
						else if (rankid[client] == 9)
						{
							if (IsInArti(Ent))
							{
								unlockdoor(Ent);
								CPrintToChat(client, "%s {green} Vous avez ouvert cette porte !", LOGO);
								return Plugin_Handled;
							}
							else
							{
								CPrintToChat(client, "%s {red} Vous n'avez pas les clefs de cette porte", LOGO);
							}
						}
						else if (rankid[client] == 10)
						{
							if (IsInTribunal(Ent))
							{
								unlockdoor(Ent);
								CPrintToChat(client, "%s {green} Vous avez ouvert cette porte !", LOGO);
								return Plugin_Handled;
							}
							else
							{
								CPrintToChat(client, "%s {red} Vous n'avez pas les clefs de cette porte", LOGO);
							}
						}
						else if (rankid[client] == 11)
						{
							if (IsInTueur(Ent))
							{
								unlockdoor(Ent);
								CPrintToChat(client, "%s {green} Vous avez ouvert cette porte !", LOGO);
								return Plugin_Handled;
							}
							else
							{
								CPrintToChat(client, "%s {red} Vous n'avez pas les clefs de cette porte", LOGO);
							}
						}
						else if (rankid[client] == 12)
						{
							if (IsInTech(Ent))
							{
								unlockdoor(Ent);
								CPrintToChat(client, "%s {green} Vous avez ouvert cette porte !", LOGO);
								return Plugin_Handled;
							}
							else
							{
								CPrintToChat(client, "%s {red} Vous n'avez pas les clefs de cette porte", LOGO);
							}
						}
						else if (rankid[client] == 14)
						{
							if (IsInDetective(Ent))
							{
								unlockdoor(Ent);
								CPrintToChat(client, "%s {green} Vous avez ouvert cette porte !", LOGO);
								return Plugin_Handled;
							}
							else
							{
								CPrintToChat(client, "%s {red} Vous n'avez pas les clefs de cette porte", LOGO);
							}
						}
						else if (rankid[client] == 15)
						{
							if (IsInMcdo(Ent))
							{
								unlockdoor(Ent);
								CPrintToChat(client, "%s {green} Vous avez ouvert cette porte !", LOGO);
								return Plugin_Handled;
							}
							else
							{
								CPrintToChat(client, "%s {red} Vous n'avez pas les clefs de cette porte", LOGO);
							}
						}
						else if (rankid[client] == 16)
						{
							if (IsInPaint(Ent))
							{
								unlockdoor(Ent);
								CPrintToChat(client, "%s {green} Vous avez ouvert cette porte !", LOGO);
								return Plugin_Handled;
							}
							else
							{
								CPrintToChat(client, "%s {red} Vous n'avez pas les clefs de cette porte", LOGO);
							}
						}
						else if (rankid[client] == 17)
						{
							if (IsIn18th(Ent))
							{
								unlockdoor(Ent);
								CPrintToChat(client, "%s {green} Vous avez ouvert cette porte !", LOGO);
								return Plugin_Handled;
							}
							else
							{
								CPrintToChat(client, "%s {red} Vous n'avez pas les clefs de cette porte", LOGO);
							}
						}
						else if (rankid[client] == 18)
						{
							if (IsInIkea(Ent))
							{
								unlockdoor(Ent);
								CPrintToChat(client, "%s {green} Vous avez ouvert cette porte !", LOGO);
								return Plugin_Handled;
							}
							else
							{
								CPrintToChat(client, "%s {red} Vous n'avez pas les clefs de cette porte", LOGO);
							}
						}
						else
						{
							CPrintToChat(client, "%s {red} Vous n'avez pas les clefs de cette porte", LOGO);
							return Plugin_Handled;
						}
					}
				}
			}
			else
			{
				CPrintToChat(client, "%s {red} Merci de viser une porte !", LOGO);
				return Plugin_Handled;
			}
		}
		else
		{
			CPrintToChat(client, "%s {red} Merci de viser une porte !", LOGO);
			return Plugin_Handled;
		}
	}
	else
	{
		CPrintToChat(client, "%s {red} Vous devez être vivant !", LOGO);
		return Plugin_Handled;
	}
	
	return Plugin_Continue;
}

public Action:Command_Limitation(client, args)
{
	if (rankid[client] == 1)
	{
		new Handle:menu = CreateMenu(Menu_Limit);
		SetMenuTitle(menu, "Gestion de Limitation\n Ce menu vous permet de gérer le trafic du serveur\n ");
		AddMenuItem(menu, "0", "Limiter à 30 Km/H");
		AddMenuItem(menu, "1", "Limiter à 50 Km/h");
		AddMenuItem(menu, "2", "Limiter à 100 Km/h");
		AddMenuItem(menu, "3", "Limiter à 130 Km/h");
		DisplayMenu(menu, client, MENU_TIME_FOREVER);
	}
}

public Action:Command_Civil(client, args)
{
	if (jobid[client] == 1 && rankid[client] == 1)
	{
		if (!IsCivil[client])
		{
			CS_SwitchTeam(client, 2);
			CS_SetClientClanTag(client, "Chômeur -");
			CPrintToChat(client, "%s Vous êtes désormais en civil.", LOGO);
			IsCivil[client] = true;
		}
		else
		{
			CS_SwitchTeam(client, 3);
			CS_SetClientClanTag(client, "Maire -");
			CPrintToChat(client, "%s Vous êtes désormais en flic.", LOGO);
			IsCivil[client] = false;
		}
	}
	else if (jobid[client] == 2 && rankid[client] == 1)
	{
		if (!IsCivil[client])
		{
			CS_SwitchTeam(client, 2);
			CS_SetClientClanTag(client, "Chômeur -");
			CPrintToChat(client, "%s Vous êtes désormais en civil.", LOGO);
			IsCivil[client] = true;
		}
		else
		{
			CS_SwitchTeam(client, 3);
			CS_SetClientClanTag(client, "DGSE -");
			CPrintToChat(client, "%s Vous êtes désormais en flic.", LOGO);
			IsCivil[client] = false;
		}
	}
	else if (jobid[client] == 3 && rankid[client] == 1)
	{
		if (!IsCivil[client])
		{
			CS_SwitchTeam(client, 2);
			CS_SetClientClanTag(client, "Chômeur -");
			CPrintToChat(client, "%s Vous êtes désormais en civil.", LOGO);
			IsCivil[client] = true;
		}
		else
		{
			CS_SwitchTeam(client, 3);
			CS_SetClientClanTag(client, "Agent F.B.I -");
			CPrintToChat(client, "%s Vous êtes désormais en flic.", LOGO);
			IsCivil[client] = false;
		}
	}
	else if (jobid[client] == 6 && rankid[client] == 1)
	{
		if (!IsCivil[client])
		{
			CS_SwitchTeam(client, 2);
			CS_SetClientClanTag(client, "Chômeur -");
			CPrintToChat(client, "%s Vous êtes désormais en civil.", LOGO);
			IsCivil[client] = true;
		}
		else
		{
			CS_SwitchTeam(client, 3);
			CS_SetClientClanTag(client, "Agent G.T.I -");
			CPrintToChat(client, "%s Vous êtes désormais en flic.", LOGO);
			IsCivil[client] = false;
		}
	}
	else
	{
		CPrintToChat(client, "%s {red}Vous n'avez pas accès a cette commande.", LOGO);
	}
	
	choose_skin(client);
	
	return Plugin_Continue;
}


public Action:Command_Give(client, args)
{
 	if (!IsPlayerAlive(client))
 	{
		PrintToChat(client, "%s {red}Vous ne pouvez pas utiliser cette commande quand vous êtes mort.", LOGO);
		return Plugin_Handled;
	}			
	
	new String:arg1[32];
	GetCmdArg(1, arg1, sizeof(arg1));
	
	if (args <= 0)
	{
		PrintToChat(client, "%s : Usage: sm_give 'montant'", LOGO);
		return Plugin_Handled;
	}
	
	if (IsPlayerAlive(client))
	{
		if (g_IsInJail[client] == 0)
		{
			new debit_amt = StringToInt(arg1, 10);
			
			if (debit_amt < 0)
			{
				PrintToChat(client, "%s {red}Vous ne pouvez pas donné une somme négative.", LOGO);
				return Plugin_Handled;
			}
			
			if (debit_amt > money[client])
			{
				PrintToChat(client, "%s {red}Vous n'avez pas assez d'argent.", LOGO);
				return Plugin_Handled;
			}

			decl Ent;
			decl String:ClassName[255];
			
			Ent = GetClientAimTarget(client, true);
		
			if(Ent != -1)
			{
				GetEdictClassname(Ent, ClassName, 255);
		
				money[Ent] += debit_amt;
		
				money[client] -= debit_amt;
		
				PrintToChat(client, "%s {blue}Tu as donné {green}%i$ {red}à %N.", LOGO, debit_amt, Ent);
				PrintToChat(Ent, "%s {blue}Tu as reçu {green}%i$ {red}par %N.", LOGO, debit_amt, client);
				
				LogToFile(Logfile,"Le joueur %N à donné %i$ à %N.", client, debit_amt, Ent);
			}
			else 
			{
				PrintToChat(client, "%s {red}Vous devez regarder un joueur.", LOGO);
			}
		}
		else 
		{
			PrintToChat(client, "%s {red}Vous ne pouvez pas donné de l'argent en jail", LOGO);
		}
	}
	else
	{
		PrintToChat(client, "%s {red}Vous devez être en vie.", LOGO);
		
		return Plugin_Handled;
	}
	
	return Plugin_Continue;
}

public Action:Command_Jaillist(client, args)
{
	if (IsClientInGame(client))
	{
		if (IsPlayerAlive(client))
		{
			if (GetClientTeam(client) == 3)
			{
				ShowPrisonner(client);
				return Plugin_Handled;
			}
			else
			{
				CPrintToChat(client, "%s {black}{red}Vous n'avez pas accès a cette commande.", LOGO);
				return Plugin_Handled;
			}
		}
	}
	return Plugin_Continue;
}

ShowPrisonner(client)
{
	if(client > 0 && client <= MaxClients && !IsFakeClient(client))
	{
		decl String:sMenuText[64];
		sMenuText[0] = '\0';
        
		new Handle:menu = CreateMenu(Menu_Prisonnier);
		SetMenuTitle(menu, "Liste des prisonniers\n ");
		SetMenuExitButton(menu, true);
        
		AddPrisonniers(menu);
        
		DisplayMenu(menu, client, MENU_TIME_FOREVER);
	}
}

public AddPrisonniers(Handle:menu)
{
	decl String:user_id[12];
	decl String:name[MAX_NAME_LENGTH];
	decl String:display[MAX_NAME_LENGTH+15];
    
	for (new i = 1; i <= MaxClients; i++)
	{
        if (IsClientInGame(i) && g_jailtime[i] > 0)
		{
			IntToString(GetClientUserId(i), user_id, sizeof(user_id));
			
			GetClientName(i, name, sizeof(name));
		
			Format(display, sizeof(display), "%s pour %i secondes", name, g_jailtime[i]);
	
			AddMenuItem(menu, user_id, display, ITEMDRAW_DISABLED);
		}
	}
}

public Menu_Prisonnier(Handle:menu, MenuAction:action, client, param2)
{
	if (action == MenuAction_End)
	{
		CloseHandle(menu);
	}
}

public Action:Command_Vis(client, args)
{
	if (rankid[client] == 1)
	{
		if (jobid[client] == 1 || jobid[client] == 2 || jobid[client] == 6)
		{
			if (IsPlayerAlive(client))
			{
				if (!IsInComico(client))
				{
					if (g_invisible[client] == 1)
					{
						SDKUnhook(client, SDKHook_SetTransmit, Hook_SetTransmit);
						CPrintToChat(client, "%s Vous êtes désormais visible.", LOGO);
						
						LogToFile(Logfile,"Le joueur %N est visible.", client);
						
						g_invisible[client] = 0;
						
						return Plugin_Handled;
					}
					else
					{
						SDKHook(client, SDKHook_SetTransmit, Hook_SetTransmit);
						CPrintToChat(client, "%s Vous êtes désormais invisible.", LOGO);
						
						LogToFile(Logfile,"Le joueur %N est invisible.", client);
						
						g_invisible[client] = 1;
						
						return Plugin_Handled;
					}
				}
				else
				{
					CPrintToChat(client, "%s {red} Cette commande est non utilisable dans le commisariat !", LOGO);
				}
			}
			else
			{
				CPrintToChat(client, "%s {red} Vous devez être vivant ! pour utilisé cette commande.", LOGO);
			}
		}
		else
		{
			CPrintToChat(client, "%s {red}Vous n'avez pas accès a cette commande.", LOGO);
		}
	}
	else
	{
		CPrintToChat(client, "%s {red}Vous n'avez pas accès a cette commande.", LOGO);
	}
	
	return Plugin_Continue;
} 

public Action:Hook_SetTransmit(entity, client) 
{ 
	if (entity != client)
	{
		return Plugin_Handled;
	}
	return Plugin_Continue; 
}

public Action:Command_Jobmenu(client, args)
{
	new String:SteamID[64];
	GetClientAuthString(client, SteamID, sizeof(SteamID));
		
	if (Chef_SERVEUR(client))
	{
		LoopPlayers(client);
	}
	else
	{
		CPrintToChat(client, "%s {black}Erreur de vos permissions {red}Veuillez contacter {aqua}@lex-92", LOGO);
	}
	
	return Plugin_Continue;
}

LoopPlayers(client)
{
	if(client > 0 && client <= MaxClients && !IsFakeClient(client))
	{
		decl String:sMenuText[64];
		sMenuText[0] = '\0';
        
		new Handle:menu = CreateMenu(MenuHandler_LoopPlayers);
		SetMenuTitle(menu, "Choix du Joueur ! :\n");
		SetMenuExitButton(menu, true);
        
		Addplayers(menu);
        
		DisplayMenu(menu, client, MENU_TIME_FOREVER);
	}
}

public Addplayers(Handle:menu)
{
	decl String:user_id[12];
	decl String:name[MAX_NAME_LENGTH];
	decl String:display[MAX_NAME_LENGTH+15];
    
	for (new i = 1; i <= MaxClients; i++)
	{
        if(IsClientInGame(i))
		{
			IntToString(GetClientUserId(i), user_id, sizeof(user_id));
            
			GetClientName(i, name, sizeof(name));
            
			Format(display, sizeof(display), "%s", name);
            
			AddMenuItem(menu, user_id, display);
		}
	}
}

public MenuHandler_LoopPlayers(Handle:menu, MenuAction:action, client, param2)
{
	if (action == MenuAction_Select)
	{
		new String:info[64];
        
		GetMenuItem(menu, param2, info, sizeof(info));
        
		new UserID = StringToInt(info);
		jobs[client] = GetClientOfUserId(UserID);
		
		new Handle:menuc = CreateMenu(jobmenu);
		SetMenuTitle(menuc, "Choisis le secteur pour : %N", jobs[client]);
		AddMenuItem(menuc, "0", "Chômeur");
		AddMenuItem(menuc, "1", "Police");
		AddMenuItem(menuc, "2", "Mafia");
		AddMenuItem(menuc, "3", "Dealer");
		AddMenuItem(menuc, "4", "Coach");
		AddMenuItem(menuc, "5", "Armurerie");
		AddMenuItem(menuc, "6", "Loto");
		AddMenuItem(menuc, "7", "Banque");
		AddMenuItem(menuc, "8", "Hôpital");
		AddMenuItem(menuc, "9", "Artificier");
		AddMenuItem(menuc, "10", "Justice");
		AddMenuItem(menuc, "11", "Tueurs");
		AddMenuItem(menuc, "12", "Techniciens");
		AddMenuItem(menuc, "13", "Prostitution");
		AddMenuItem(menuc, "14", "Détective");
		AddMenuItem(menuc, "15", "Mcdo");
		AddMenuItem(menuc, "16", "Moniteurs de tir");
		AddMenuItem(menuc, "17", "18Th");
		AddMenuItem(menuc, "18", "Ikea");
		AddMenuItem(menuc, "19", "Vendeurs Appartements");
		AddMenuItem(menuc, "20", "DJ");
		
		DisplayMenu(menuc, client, MENU_TIME_FOREVER);
	}
	else if (action == MenuAction_End)
	{
		CloseHandle(menu);
	}
}

public jobmenu(Handle:menu, MenuAction:action, client, param2)
{
	if (action == MenuAction_Select)
	{
		new String:info[32];
		GetMenuItem(menu, param2, info, sizeof(info));
		
		rankid[jobs[client]] = StringToInt(info);
		
		LogToFile(Logfile,"Le joueur %N à mit le rankid %i à %N.", client, rankid[jobs[client]], jobs[client]);
		
		if (!StrEqual(info, "0"))
		{
			new Handle:menub = CreateMenu(jobmenu_final);
			SetMenuTitle(menub, "Choisis le rang pour : %N", jobs[client]);
			
			if (StrEqual(info, "1"))
			{
				AddMenuItem(menub, "1", "Maire");
				AddMenuItem(menub, "2", "DGSE");
				AddMenuItem(menub, "4", "Policier");
			}
			else if (StrEqual(info, "2"))
			{
				AddMenuItem(menub, "1", "Chef Mafia");
				AddMenuItem(menub, "2", "Co Chef Mafia");
				AddMenuItem(menub, "3", "Parrain");
				AddMenuItem(menub, "4", "Mafieux");
				AddMenuItem(menub, "5", "Apprenti Mafieux");
			}
			else if (StrEqual(info, "3"))
			{
				AddMenuItem(menub, "1", "Chef Dealer");
				AddMenuItem(menub, "2", "Co Chef Dealer");
				AddMenuItem(menub, "3", "Recelleur");
				AddMenuItem(menub, "4", "Dealer");
				AddMenuItem(menub, "5", "Apprenti Dealer");
			}
			else if (StrEqual(info, "4"))
			{
				AddMenuItem(menub, "1", "Chef Coach");
				AddMenuItem(menub, "2", "Co Chef Coach");
				AddMenuItem(menub, "3", "Entraineur");
				AddMenuItem(menub, "4", "Coach");
				AddMenuItem(menub, "5", "Apprenti Coach");
			}
			else if (StrEqual(info, "5"))
			{
				AddMenuItem(menub, "1", "Chef Armurerie");
				AddMenuItem(menub, "2", "Co Chef Armurerie");
				AddMenuItem(menub, "3", "Grenadier");
				AddMenuItem(menub, "4", "Armurier");
				AddMenuItem(menub, "5", "Apprenti Armurier");
			}
			else if (StrEqual(info, "6"))
			{
				AddMenuItem(menub, "1", "Chef Loto");
				AddMenuItem(menub, "2", "Co Chef Loto");
				AddMenuItem(menub, "3", "Buraliste");
				AddMenuItem(menub, "4", "Vendeur de Tickets");
				AddMenuItem(menub, "5", "Apprenti Vendeur de Tickets");
			}
			else if (StrEqual(info, "7"))
			{
				AddMenuItem(menub, "1", "Chef Banquier");
				AddMenuItem(menub, "2", "Co Chef Banquier");
				AddMenuItem(menub, "3", "Conseiller Financier");
				AddMenuItem(menub, "4", "Banquier");
				AddMenuItem(menub, "5", "Apprenti Banquier");
			}
			else if (StrEqual(info, "8"))
			{
				AddMenuItem(menub, "1", "Chef Hôpital");
				AddMenuItem(menub, "2", "Co Chef Hôpital");
				AddMenuItem(menub, "3", "Chirurgien");
				AddMenuItem(menub, "4", "Infirmier");
				AddMenuItem(menub, "5", "Apprenti Infirmier");
			}
			else if (StrEqual(info, "9"))
			{
				AddMenuItem(menub, "1", "Chef Artificier");
				AddMenuItem(menub, "2", "Co Chef Artificier");
				AddMenuItem(menub, "3", "Vendeur de Grenade");
				AddMenuItem(menub, "4", "Artificier");
				AddMenuItem(menub, "5", "Apprenti Artificier");
			}
			else if (StrEqual(info, "10"))
			{
				AddMenuItem(menub, "1", "Chef de la Justice");
				AddMenuItem(menub, "2", "Co Chef de la Justice");
				AddMenuItem(menub, "6", "Marshall");
				AddMenuItem(menub, "3", "Garde ONU");
				AddMenuItem(menub, "4", "Juge");
				AddMenuItem(menub, "5", "Avocat");
			}
			else if (StrEqual(info, "11"))
			{
				AddMenuItem(menub, "1", "Chef Tueur");
				AddMenuItem(menub, "2", "Co Chef Tueur");
				AddMenuItem(menub, "3", "Tueur d'élite");
				AddMenuItem(menub, "4", "Tueur Professionnel");
				AddMenuItem(menub, "5", "Tueur Novice");
			}
			else if (StrEqual(info, "12"))
			{
				AddMenuItem(menub, "1", "Chef Technicien");
				AddMenuItem(menub, "2", "Co Chef Technicien");
				AddMenuItem(menub, "3", "Technicien Professionnel");
				AddMenuItem(menub, "4", "Technicien");
				AddMenuItem(menub, "5", "Apprenti Technicien");
			}
			else if (StrEqual(info, "13"))
			{
				AddMenuItem(menub, "1", "Mac");
				AddMenuItem(menub, "2", "Co Chef Mac");
				AddMenuItem(menub, "3", "Prostituée de Luxe");
				AddMenuItem(menub, "4", "Prostituée");
				AddMenuItem(menub, "5", "Apprenti Prostituée");
			}
			else if (StrEqual(info, "14"))
			{
				AddMenuItem(menub, "1", "Chef Détective");
				AddMenuItem(menub, "2", "Co Chef Détective");
				AddMenuItem(menub, "3", "Détective Privé");
				AddMenuItem(menub, "4", "Détective");
				AddMenuItem(menub, "5", "Apprenti Détective");
			}
			else if (StrEqual(info, "15"))
			{
				AddMenuItem(menub, "1", "Chef MacDonald");
				AddMenuItem(menub, "2", "Co Chef MacDonald");
				AddMenuItem(menub, "3", "Restaurateur MacDonald");
				AddMenuItem(menub, "4", "Vendeur MacDonald");
				AddMenuItem(menub, "5", "Apprenti Vendeur MacDonald");
			}
			else if (StrEqual(info, "16"))
			{
				AddMenuItem(menub, "1", "Chef Moniteur");
				AddMenuItem(menub, "2", "Co Chef Moniteur");
				AddMenuItem(menub, "3", "Moniteur Professionnel");
				AddMenuItem(menub, "4", "Moniteur de tir");
				AddMenuItem(menub, "5", "Apprenti Moniteur");
			}
			else if (StrEqual(info, "17"))
			{
				AddMenuItem(menub, "1", "Chef 18th");
				AddMenuItem(menub, "2", "Co Chef 18th");
				AddMenuItem(menub, "3", "18th Haut gradé");
				AddMenuItem(menub, "4", "18th");
				AddMenuItem(menub, "5", "Apprenti 18th");
			}
			else if (StrEqual(info, "18"))
			{
				AddMenuItem(menub, "1", "Chef Ikea");
				AddMenuItem(menub, "2", "Co Chef Ikea");
				AddMenuItem(menub, "3", "Meublier");
				AddMenuItem(menub, "4", "Vendeur Ikea");
				AddMenuItem(menub, "5", "Apprenti Vendeur Ikea");
			}
			else if (StrEqual(info, "19"))
			{
				AddMenuItem(menub, "1", "Chef Vendeur Appartements");
				AddMenuItem(menub, "2", "Co Chef Vendeur Appartements");
				AddMenuItem(menub, "3", "Hôtelier");
				AddMenuItem(menub, "4", "Vendeur Appartements");
				AddMenuItem(menub, "5", "Apprenti Vendeur Appartements");
			}
			else if (StrEqual(info, "20"))
			{
				AddMenuItem(menub, "1", "Chef DJ");
				AddMenuItem(menub, "2", "Co Chef DJ");
				AddMenuItem(menub, "3", "DJ Pro");
				AddMenuItem(menub, "4", "DJ");
				AddMenuItem(menub, "5", "Apprenti DJ");
			}
			DisplayMenu(menub, client, MENU_TIME_FOREVER);
		}
		else
		{
			jobid[jobs[client]] = 0;
			
			LogToFile(Logfile,"Le joueur %N à mit Chômeur le joueur %N.", client, jobs[client]);
			
			decl String:ClanTagRankName[20];
			GetClanTagName(jobid[jobs[client]], rankid[jobs[client]], ClanTagRankName, sizeof(ClanTagRankName));

			CS_SetClientClanTag(jobs[client], ClanTagRankName);
			
			CS_SwitchTeam(jobs[client], CS_TEAM_T);
			
			choose_skin(jobs[client]);
			
			InitSalary(jobs[client]);
		}
	}
	else if (action == MenuAction_End)
	{
		CloseHandle(menu);
	}
}

public jobmenu_final(Handle:menu, MenuAction:action, client, param2)
{
	if (action == MenuAction_Select)
	{
		new String:info[32];
		GetMenuItem(menu, param2, info, sizeof(info));
		
		jobid[jobs[client]] = StringToInt(info);
		
		LogToFile(Logfile,"Le joueur %N à mit le jobid %i à %N.", client, jobid[jobs[client]], jobs[client]);
		
		InitSalary(jobs[client]);
		
		if (rankid[jobs[client]] != 1)
		{
			CS_SwitchTeam(jobs[client], CS_TEAM_T);
			
			if (jobid[jobs[client]] == 3 && rankid[jobs[client]] == 10 || jobid[jobs[client]] == 6 && rankid[jobs[client]] == 10)
			{
				CS_SwitchTeam(jobs[client], CS_TEAM_CT);
			}
		}
		else
		{
			CS_SwitchTeam(jobs[client], CS_TEAM_CT);
		}
		
		choose_skin(jobs[client]);
		
		decl String:ClanTagRankName[20];
		GetClanTagName(jobid[jobs[client]], rankid[jobs[client]], ClanTagRankName, sizeof(ClanTagRankName));

		CS_SetClientClanTag(jobs[client], ClanTagRankName);
		
		CPrintToChat(client, "%s Vous avez promu %N en tant que %s.", LOGO, jobs[client], ClanTagRankName);
		CPrintToChat(jobs[client], "%s Vous avez été promu %s par %N.", LOGO, ClanTagRankName, client);
	}
	else if (action == MenuAction_End)
	{
		CloseHandle(menu);
	}
}

public Action:Command_Demission(client, args)
{
	if (IsClientInGame(client))
	{
		if (IsPlayerAlive(client))
		{
			if (jobid[client] > 0)
			{
				new Handle:menu = CreateMenu(Menu_Demission);
				SetMenuTitle(menu, "Voulez vous changer de job ?\n ");
				AddMenuItem(menu, "oui", "Oui");
				AddMenuItem(menu, "non", "Non");
				DisplayMenu(menu, client, MENU_TIME_FOREVER);
				
				return Plugin_Handled;
			}
			else
			{
				CPrintToChat(client, "%s {red}Démissoner du Chômage ? xD", LOGO);
			}
		}
	}
	
	return Plugin_Continue;
}

public Menu_Demission(Handle:menu, MenuAction:action, client, param2)
{
	if (action == MenuAction_Select)
	{
		new String:info[64];
        
		GetMenuItem(menu, param2, info, sizeof(info));
		
		if (StrEqual(info, "oui"))
		{
			jobid[client] = 0;
			rankid[client] = 0;
			
			InitSalary(client);
			
			CPrintToChat(client, "%s {red}Vous avez quitté votre job !", LOGO);
			
			if (GetClientTeam(client) == 3)
			{
				CS_SwitchTeam(client, 2);
			}
			
			choose_skin(client);
			
			CS_SetClientClanTag(client, "Chômeur -");
			
			LogToFile(Logfile,"Le joueur %N à démissionner de son emploi.", client);
		}
	}
	else if (action == MenuAction_End)
	{
		CloseHandle(menu);
	}
}

seekplayers(client)
{
	if(client > 0 && client <= MaxClients && !IsFakeClient(client))
	{
		decl String:sMenuText[64];
		sMenuText[0] = '\0';
        
		new Handle:menu = CreateMenu(menu_money);
		SetMenuTitle(menu, "Choisir un Joueur :");
		SetMenuExitButton(menu, true);
        
		ajoutplayers(menu);
        
		DisplayMenu(menu, client, MENU_TIME_FOREVER);
	}
}

public ajoutplayers(Handle:menu)
{
	decl String:user_id[12];
	decl String:name[MAX_NAME_LENGTH];
	decl String:display[MAX_NAME_LENGTH+15];
    
	for (new i = 1; i <= MaxClients; i++)
	{
        if(IsClientInGame(i) && IsPlayerAlive(i))
		{
			IntToString(GetClientUserId(i), user_id, sizeof(user_id));
            
			GetClientName(i, name, sizeof(name));
            
			Format(display, sizeof(display), "%s (%s)", name, user_id);
            
			AddMenuItem(menu, user_id, display);
		}
	}
}

public menu_money(Handle:menu, MenuAction:action, client, param2)
{
	if (action == MenuAction_Select)
	{
		new String:info[64];
        
		GetMenuItem(menu, param2, info, sizeof(info));
        
		new UserID = StringToInt(info);
		givemoney[client] = GetClientOfUserId(UserID);
		
		new Handle:menuc = CreateMenu(menu_givemoney);
		SetMenuTitle(menuc, "Choisis le montant : %N", givemoney[client]);
		AddMenuItem(menuc, "1", "1000");
		AddMenuItem(menuc, "2", "10000");
		AddMenuItem(menuc, "3", "100000");
		AddMenuItem(menuc, "4", "1000000");
		DisplayMenu(menuc, client, MENU_TIME_FOREVER);
	}
	else if (action == MenuAction_End)
	{
		CloseHandle(menu);
	}
}

public menu_givemoney(Handle:menu, MenuAction:action, client, param2)
{
	if (action == MenuAction_Select)
	{
		new String:info[32];
		GetMenuItem(menu, param2, info, sizeof(info));
		
		if (StrEqual(info, "1"))
		{
			bank[givemoney[client]] = bank[givemoney[client]] + 1000;
			CPrintToChat(givemoney[client], "%s {blue}Vous avez reçu 1000€ en banque par %N", LOGO, client);
			CPrintToChat(client, "%s Vous avez donné 1000€ à %N", LOGO, givemoney[client]);
			
			LogToFile(Logfile,"Le joueur %N à donner 1000€ à %N avec /money.", client, givemoney[client]);
		}
		else if (StrEqual(info, "2"))
		{
			bank[givemoney[client]] = bank[givemoney[client]] + 10000;
			CPrintToChat(givemoney[client], "%s {blue}Vous avez reçu 10000€ en banque par %N", LOGO, client);
			CPrintToChat(client, "%s Vous avez donné 10000€ à %N", LOGO, givemoney[client]);
			
			LogToFile(Logfile,"Le joueur %N à donner 100000€ à %N avec /money.", client, givemoney[client]);
		}
		else if (StrEqual(info, "3"))
		{
			bank[givemoney[client]] = bank[givemoney[client]] + 100000;
			CPrintToChat(givemoney[client], "%s {blue}Vous avez reçu 100000€ en banque par %N", LOGO, client);
			CPrintToChat(client, "%s Vous avez donné 100000€ à %N", LOGO, givemoney[client]);
			
			LogToFile(Logfile,"Le joueur %N à donner 100000€ à %N avec /money.", client, givemoney[client]);
		}
		else if (StrEqual(info, "4"))
		{
			bank[givemoney[client]] = bank[givemoney[client]] + 1000000;
			CPrintToChat(givemoney[client], "%s {blue}Vous avez reçu 1000000€ en banque par %N", LOGO, client);
			CPrintToChat(client, "%s Vous avez donné 1000000€ à %N", LOGO, givemoney[client]);
			
			LogToFile(Logfile,"Le joueur %N à donner 1000000€ à %N avec /money.", client, givemoney[client]);
		}
	}
	else if (action == MenuAction_End)
	{
		CloseHandle(menu);
	}
}



public Action:Command_Rw(client, args)
{
	if (IsPlayerAlive(client))
	{
		if (GetClientTeam(client) == 3)
		{	
			new Ent;
			Ent = GetClientAimTarget(client, false);

			if (Ent != -1)
			{
				new String:Classname[32];
				GetEdictClassname(Ent, Classname, sizeof(Classname));

				if (StrContains(Classname, "weapon_", false) != -1)
				{
					RemoveEdict(Ent);
					CPrintToChat(client, "%s {blue}Vous avez supprimé l'arme au sol.", LOGO);
					
					LogToFile(Logfile,"Le joueur %N a supprimé l'arme au sol.", client);
					
					return Plugin_Handled;
				}
			}
		}
		else
		{
			CPrintToChat(client, "%s {red}Vous n'avez pas accès a cette commande.", LOGO);
		}
	}
	
	return Plugin_Continue;
}

public Action:Command_Changename(client, args)
{
	if (IsClientInGame(client))
	{
		new String:SteamID[64];
		GetClientAuthString(client, SteamID, sizeof(SteamID));
		
		if (Chef_SERVEUR(client))
		{
			if (args < 1)
			{
				ReplyToCommand(client, "[CSS-RP] Usage: sm_changename <pseudo>");
				return Plugin_Handled;	
			}
			
			decl String:arg2[32];

			GetCmdArg(1, arg2, sizeof(arg2));
			
			CS_SetClientName(client, arg2, true);
			
			LogToFile(Logfile,"Le joueur %N a changé son pseudo.", client);
		}
		else
		{
			CPrintToChat(client, "%s {red}Vous n'avez pas accès a cette commande.", LOGO);
		}
	}
	return Plugin_Continue;
}

stock CS_SetClientName(client, const String:name[], bool:silent=false)
{
    decl String:oldname[MAX_NAME_LENGTH];
    GetClientName(client, oldname, sizeof(oldname));

    SetClientInfo(client, "name", name);
    SetEntPropString(client, Prop_Data, "m_szNetname", name);

    new Handle:event = CreateEvent("player_changename");

    if (event != INVALID_HANDLE)
    {
        SetEventInt(event, "userid", GetClientUserId(client));
        SetEventString(event, "oldname", oldname);
        SetEventString(event, "newname", name);
        FireEvent(event);
    }

    if (silent)
        return;
    
    new Handle:msg = StartMessageAll("SayText2");

    if (msg != INVALID_HANDLE)
    {
        BfWriteByte(msg, client);
        BfWriteByte(msg, true);
        BfWriteString(msg, "Cstrike_Name_Change");
        BfWriteString(msg, oldname);
        BfWriteString(msg, name);
        EndMessage();
    }
}

public Action:Command_tazer(client, args)
{
	if (IsClientInGame(client))
	{
		if (IsPlayerAlive(client))
		{
			if (rankid[client] == 1 || rankid[client] == 10 && jobid[client] == 3)
			{
				new i = GetClientAimTarget(client, true);
			
				if (i != -1)
				{
					if (!g_IsTazed[i])
					{
						if (GetClientTeam(i) == 2)
						{
							new Float:entorigin[3], Float:clientent[3];
							GetEntPropVector(i, Prop_Send, "m_vecOrigin", entorigin);
							GetEntPropVector(client, Prop_Send, "m_vecOrigin", clientent);
							
							new Float:distance = GetVectorDistance(entorigin, clientent);
						
							if (distance <= 2500)
							{
								g_IsTazed[i] = true;
								decl String:player_name[65], String:gardien_name[65];
								GetClientName(i, player_name, sizeof(player_name));
								GetClientName(client, gardien_name, sizeof(gardien_name));
								g_Count[i] = 10.0;
								
								EmitSoundToAll(SOUND_TAZER, client, _, _, _, 1.0);
								PrecacheSound("bot/aah.wav", true);
								EmitSoundToAll("bot/aah.wav", i, _, _, _, 1.0);
								clientent[2] += 45;
								entorigin[2] += 45;
							
								TE_SetupBeamPoints(clientent, entorigin, g_LightingSprite, 0, 1, 0, 1.0, 20.0, 0.0, 2, 5.0, TAZER_COLORBLUE, 3);
								TE_SendToAll();

								SetEntityMoveType(i, MOVETYPE_NONE);
								g_TazerTimer[i] = CreateTimer(1.0, DoTazer, i);
								
								if (g_crochetageon[i])
								{
									SetEntPropFloat(i, Prop_Send, "m_flProgressBarStartTime", GetGameTime()); 
									SetEntProp(i, Prop_Send, "m_iProgressBarDuration", 0); 
									
									SetEntityRenderColor(i, 255, 255, 255, 255);
									
									KillTimer(g_croche[i]);
									
									CPrintToChat(i, "%s {red}Vous êtiez en train de crocheter, crochetage annulé.", LOGO);
									
									g_crochetageon[i] = false;
								}
								
								LogToFile(Logfile,"Le joueur %N à tazer %N", client, i);
							}
							else
							{
								CPrintToChat(client, "%s {red}Vous êtes trop loin pour tazer.", LOGO);
							}
						}
						else
						{
							CPrintToChat(client, "%s Vous ne pouvez pas tazer un membre du gouvernement.", LOGO);
						}
					}
					else
					{
						CPrintToChat(client, "%s Ce joueur est déjà tazé.", LOGO);
					}
				}
				else
				{
					CPrintToChat(client, "%s Vous devez viser un joueur.", LOGO);
				}
			}
			else
			{
				CPrintToChat(client, "%s Vous n'avez pas accès à cette commande", LOGO);
			}
		}
		else
		{
			CPrintToChat(client, "%s {red} Vous devez être vivant !", LOGO);
		}
	}
	return Plugin_Continue;
}

public Action:DoTazer(Handle:timer, any:client)
{
	if (IsClientInGame(client))
	{
		if (g_Count[client] > 0.0)
		{
			g_Count[client] -= 1.0;
			
			CreateTimer(1.0, DoTazer, client);
			
			new Float:entorigin[3];
			GetEntPropVector(client, Prop_Send, "m_vecOrigin", entorigin);
		
			for(new ii=1; ii<8; ii++) 
			{
				entorigin[2]+= (ii*9);
			
				TE_SetupBeamRingPoint(entorigin, 45.0, 45.1, g_modelLaser, g_modelHalo, 0, 1, 0.1, 8.0, 1.0, TAZER_COLORBLUE, 1, 0);
			
				TE_SendToAll();

				entorigin[2]-= (ii*9);
			}
			
			if (IsPlayerAlive(client))
			{
				SetEntityMoveType(client, MOVETYPE_NONE);
			}
		}
		else
		{
			g_IsTazed[client] = false;
			g_Count[client] = 0.0;
		
			SetEntityMoveType(client, MOVETYPE_WALK);
		}
	}
	return Plugin_Continue;
}

public Action:DoTazerr(Handle:timer, any:client)
{
	if (IsClientInGame(client))
	{
		if (g_Count[client] > 0.0)
		{
			g_Count[client] -= 1.0;
			
			CreateTimer(1.0, DoTazerr, client);
			
			new Float:entorigin[3];
			GetEntPropVector(client, Prop_Send, "m_vecOrigin", entorigin);
		
			for(new ii=1; ii<8; ii++) 
			{
				entorigin[2]+= (ii*9);
			
				TE_SetupBeamRingPoint(entorigin, 45.0, 45.1, g_modelLaser, g_modelHalo, 0, 1, 0.1, 8.0, 1.0, greenColor, 1, 0);
			
				TE_SendToAll();

				entorigin[2]-= (ii*9);
			}
			
			if (IsPlayerAlive(client))
			{
				SetEntityMoveType(client, MOVETYPE_NONE);
			}
		}
		else
		{
			g_IsTazed[client] = false;
			g_Count[client] = 0.0;
		
			SetEntityMoveType(client, MOVETYPE_WALK);
		}
	}
	return Plugin_Continue;
}

public Action:Command_Vente(client, args) 
{ 
	if (IsClientInGame(client))
	{
		if (IsPlayerAlive(client)) 
		{ 
			if (g_IsInJail[client] == 0)
			{
				new BuyerIndex = GetClientAimTarget(client, true); 
				
				if (BuyerIndex != -1)
				{
					BuildSellMenu(client, BuyerIndex);
				}
				else
				{
					CPrintToChat(client, "%s {red} Veuillez viser un joueur !", LOGO);
				}
			}
			else 
			{
				CPrintToChat(client, "%s {red}Vous ne pouvez pas vendre en jail.", LOGO);
			}
		} 
		else 
		{
			CPrintToChat(client, "%s {red} Vous devez être vivant !", LOGO);
		}
	}
}

Handle:BuildSellMenu(client, Player)
{
	decl String:Buffer[128];
	new Handle:menu = CreateMenu(Menu_Sell);
	
	SetMenuTitle(menu, "Choisis le produit a vendre :");
	
	if (rankid[client] == 3)
	{
		Format(Buffer, sizeof(Buffer), "%i_500_1", Player);
		AddMenuItem(menu, Buffer, "LSD (Prix : 500€)");
		Format(Buffer, sizeof(Buffer), "%i_500_2", Player);
		AddMenuItem(menu, Buffer, "Héroïne (Prix : 500€)");
		Format(Buffer, sizeof(Buffer), "%i_500_3", Player);
		AddMenuItem(menu, Buffer, "Extasy (Prix : 500€)");
		Format(Buffer, sizeof(Buffer), "%i_500_4", Player);
		AddMenuItem(menu, Buffer, "Cocaïne (Prix : 500€)");
		Format(Buffer, sizeof(Buffer), "%i_650_5", Player);
		AddMenuItem(menu, Buffer, "Weed (Prix : 650€)");
	}
	else if (rankid[client] == 4)
	{
		Format(Buffer, sizeof(Buffer), "%i_1000_6", Player);
		AddMenuItem(menu, Buffer, "Entraînement au couteau (100 levels cut) (Prix : 1000€)");
		Format(Buffer, sizeof(Buffer), "%i_400_56", Player);
		AddMenuItem(menu, Buffer, "Lancés de cut (Prix : 400€)");
	}
	else if (rankid[client] == 5)
	{
		Format(Buffer, sizeof(Buffer), "%i_300_42", Player);
		AddMenuItem(menu, Buffer, "Cartouche (Prix : 300€) (Moins Cher)");
		Format(Buffer, sizeof(Buffer), "%i_250_7", Player);
		AddMenuItem(menu, Buffer, "Glock (Prix : 250€)");
		Format(Buffer, sizeof(Buffer), "%i_300_8", Player);
		AddMenuItem(menu, Buffer, "USP (Prix : 300€)");
		Format(Buffer, sizeof(Buffer), "%i_300_9", Player);
		AddMenuItem(menu, Buffer, "P228 (Prix : 300€)");
		Format(Buffer, sizeof(Buffer), "%i_400_10", Player);
		AddMenuItem(menu, Buffer, "Deagle (Prix : 400€)");
		Format(Buffer, sizeof(Buffer), "%i_300_11", Player);
		AddMenuItem(menu, Buffer, "Elites (Prix : 300€)");
		Format(Buffer, sizeof(Buffer), "%i_300_12", Player);
		AddMenuItem(menu, Buffer, "Five Seven (Prix : 300€)");	
		AddMenuItem(menu, Buffer, "Permis port d'arme (Prix : 2500€) (- 50%)");
		Format(Buffer, sizeof(Buffer), "%i_1500_45", Player);
	}
	else if (rankid[client] == 6)
	{
		Format(Buffer, sizeof(Buffer), "%i_10_31", Player);
		AddMenuItem(menu, Buffer, "Ticket de 10€ (Prix : 10€)");
		Format(Buffer, sizeof(Buffer), "%i_50_32", Player);
		AddMenuItem(menu, Buffer, "Ticket de 50€ (Prix : 50€)");
		Format(Buffer, sizeof(Buffer), "%i_100_33", Player);
		AddMenuItem(menu, Buffer, "Ticket de 100€ (Prix : 100€)");
		Format(Buffer, sizeof(Buffer), "%i_500_34", Player);
		AddMenuItem(menu, Buffer, "Ticket de 500€ (Prix : 500€)");
	}
	else if (rankid[client] == 7)
	{
		Format(Buffer, sizeof(Buffer), "%i_500_35", Player);
		AddMenuItem(menu, Buffer, "Relevé d'Identité Bancaire (Prix : 500€)");
		Format(Buffer, sizeof(Buffer), "%i_250_36", Player);
		AddMenuItem(menu, Buffer, "Carte Bleue (Prix : 250€)");
		Format(Buffer, sizeof(Buffer), "%i_2000_55", Player);
		AddMenuItem(menu, Buffer, "Fiche de paie (Prix : 2000€)");
	}
	else if (rankid[client] == 8)
	{
		Format(Buffer, sizeof(Buffer), "%i_350_37", Player);
		AddMenuItem(menu, Buffer, "Kit de soins (Prix : 350€)");
	}
	else if (rankid[client] == 9)
	{
		Format(Buffer, sizeof(Buffer), "%i_100_38", Player);
		AddMenuItem(menu, Buffer, "Grenade Explosive (Prix : 100€)");
		Format(Buffer, sizeof(Buffer), "%i_100_39", Player);
		AddMenuItem(menu, Buffer, "Fumigène (Prix : 100€)");
		Format(Buffer, sizeof(Buffer), "%i_100_40", Player);
		AddMenuItem(menu, Buffer, "Flashbang (Prix : 100€)");
		Format(Buffer, sizeof(Buffer), "%i_600_41", Player);
		AddMenuItem(menu, Buffer, "Gilet pare-balle (Prix : 600€)");
	}
	else if (rankid[client] == 12)
	{
		Format(Buffer, sizeof(Buffer), "%i_2000_46", Player);
		AddMenuItem(menu, Buffer, "Imprimante de faux billets (Prix : 2000€)");
	}
	else if (rankid[client] == 15)
	{
		Format(Buffer, sizeof(Buffer), "%i_800_50", Player);
		AddMenuItem(menu, Buffer, "Hamburger (Prix : 800€)");
		Format(Buffer, sizeof(Buffer), "%i_400_51", Player);
		AddMenuItem(menu, Buffer, "Frites (Prix : 400€)");
		Format(Buffer, sizeof(Buffer), "%i_300_52", Player);
		AddMenuItem(menu, Buffer, "Sunday (Prix : 300€)");
		Format(Buffer, sizeof(Buffer), "%i_200_53", Player);
		AddMenuItem(menu, Buffer, "Big Mac (Prix : 200€)");
		Format(Buffer, sizeof(Buffer), "%i_100_54", Player);
		AddMenuItem(menu, Buffer, "Mac Flurry (Prix : 100€)");
	}
	else if (rankid[client] == 16)
	{
		Format(Buffer, sizeof(Buffer), "%i_150_42", Player);
		AddMenuItem(menu, Buffer, "Cartouche (Prix : 150€)");
		Format(Buffer, sizeof(Buffer), "%i_2500_44", Player);
		AddMenuItem(menu, Buffer, "Permis port d'arme (Prix : 2500€)");
		Format(Buffer, sizeof(Buffer), "%i_1500_45", Player);
		AddMenuItem(menu, Buffer, "Flashball Anti-émeute (Prix : 1500€)");
		Format(Buffer, sizeof(Buffer), "%i_1000_49", Player);
		AddMenuItem(menu, Buffer, "Licence de Paintball (Prix : 1000€)");
	}
	else if (rankid[client] == 18)
	{
		Format(Buffer, sizeof(Buffer), "%i_1000_57", Player);
		AddMenuItem(menu, Buffer, "Distributeur (Prix : 1000€)");
		Format(Buffer, sizeof(Buffer), "%i_800_58", Player);
		AddMenuItem(menu, Buffer, "Sofa (Prix : 800€)");
		Format(Buffer, sizeof(Buffer), "%i_600_59", Player);
		AddMenuItem(menu, Buffer, "Bibliothèque (Prix : 600€)");
		Format(Buffer, sizeof(Buffer), "%i_300_60", Player);
		AddMenuItem(menu, Buffer, "Dryer (Prix : 300€)");
	}
	else if (rankid[client] == 19)
	{
		FakeClientCommandEx(client, "sm_immobilier");
	}
	else if (rankid[client] == 20)
	{
		FakeClientCommandEx(client, "sm_dj");
	}
	
	DisplayMenu(menu, client, MENU_TIME_FOREVER);
}

public Menu_Sell(Handle:menu, MenuAction:action, client, param2)
{
	if (action == MenuAction_Select)
	{
		decl String:info[64];
		
		new SellPlayerID = 0;
		new Price = 0;
		new ItemID = 0;
		
		GetMenuItem(menu, param2, info, sizeof(info));
		
		decl String:Buffer[12][64];
		
		ExplodeString(info, "_", Buffer, 3, 64);
		
		SellPlayerID = StringToInt(Buffer[0]);
		Price = StringToInt(Buffer[1]);
		ItemID = StringToInt(Buffer[2]);
		
		decl String:Quantite[32];
		new Handle:sell_menuQuantity = CreateMenu(Menu_Quantity);
		SetMenuTitle(sell_menuQuantity, "Choisissez la quantité :");
		
		if (ItemID == 43 || ItemID == 44 || ItemID == 35 || ItemID == 36 || ItemID == 6)
		{
			Format(Quantite, sizeof(Quantite), "%i_%i_%i_1", SellPlayerID, Price, ItemID);
			AddMenuItem(sell_menuQuantity, Quantite, "1");
		}
		else
		{
			Format(Quantite, sizeof(Quantite), "%i_%i_%i_1", SellPlayerID, Price, ItemID);
			AddMenuItem(sell_menuQuantity, Quantite, "1");
			Format(Quantite, sizeof(Quantite), "%i_%i_%i_5", SellPlayerID, Price, ItemID);
			AddMenuItem(sell_menuQuantity, Quantite, "5");
			Format(Quantite, sizeof(Quantite), "%i_%i_%i_10", SellPlayerID, Price, ItemID);
			AddMenuItem(sell_menuQuantity, Quantite, "10");
			Format(Quantite, sizeof(Quantite), "%i_%i_%i_25", SellPlayerID, Price, ItemID);
			AddMenuItem(sell_menuQuantity, Quantite, "25");
			Format(Quantite, sizeof(Quantite), "%i_%i_%i_50", SellPlayerID, Price, ItemID);
			AddMenuItem(sell_menuQuantity, Quantite, "50");
			Format(Quantite, sizeof(Quantite), "%i_%i_%i_100", SellPlayerID, Price, ItemID);
			AddMenuItem(sell_menuQuantity, Quantite, "100");
		}
		DisplayMenu(sell_menuQuantity, client, MENU_TIME_FOREVER);
	}
	else
	{
		if (action == MenuAction_End)
		{
			CloseHandle(menu);
		}
	}
}

public Menu_Quantity(Handle:menu_quantity, MenuAction:action, client, param2)
{
	if (action == MenuAction_Select)
	{
		decl String:info[64];
		
		new SellPlayerID = 0;
		new QuantityItem = 0;
		new Price = 0;
		new ItemID = 0;
		
		decl String:sSellItem[64];
		
		new PriceFinal = 0;
		
		GetMenuItem(menu_quantity, param2, info, sizeof(info));
		
		decl String:Buffer[16][64];
		ExplodeString(info, "_", Buffer, 4, 64);
		
		SellPlayerID = StringToInt(Buffer[0]);
		Price = StringToInt(Buffer[1]);
		ItemID = StringToInt(Buffer[2]);
		QuantityItem = StringToInt(Buffer[3]);
		
		switch (ItemID)
		{
			case 1:
			{
				strcopy(sSellItem, sizeof(sSellItem), "LSD");
			}
			case 2:
			{
				strcopy(sSellItem, sizeof(sSellItem), "héroïne");
			}
			case 3:
			{
				strcopy(sSellItem, sizeof(sSellItem), "Extasy");
			}
			case 4:
			{
				strcopy(sSellItem, sizeof(sSellItem), "Cocaïne");
			}
			case 5:
			{
				strcopy(sSellItem, sizeof(sSellItem), "Weed");
			}
			case 6:
			{
				strcopy(sSellItem, sizeof(sSellItem), "Entraînement au couteau");
			}
			case 7:
			{
				strcopy(sSellItem, sizeof(sSellItem), "Glock");
			}
			case 8:
			{
				strcopy(sSellItem, sizeof(sSellItem), "USP");
			}
			case 9:
			{
				strcopy(sSellItem, sizeof(sSellItem), "P228");
			}
			case 10:
			{
				strcopy(sSellItem, sizeof(sSellItem), "Deagle");
			}
			case 11:
			{
				strcopy(sSellItem, sizeof(sSellItem), "Elites");
			}
			case 12:
			{
				strcopy(sSellItem, sizeof(sSellItem), "Five Seven");
			}
			case 13:
			{
				strcopy(sSellItem, sizeof(sSellItem), "M3");
			}
			case 14:
			{
				strcopy(sSellItem, sizeof(sSellItem), "XM1014");
			}
			case 15:
			{
				strcopy(sSellItem, sizeof(sSellItem), "Galil");
			}
			case 16:
			{
				strcopy(sSellItem, sizeof(sSellItem), "AK47");
			}
			case 17:
			{
				strcopy(sSellItem, sizeof(sSellItem), "Scout");
			}
			case 18:
			{
				strcopy(sSellItem, sizeof(sSellItem), "Sg552");
			}
			case 19:
			{
				strcopy(sSellItem, sizeof(sSellItem), "Awp");
			}
			case 20:
			{
				strcopy(sSellItem, sizeof(sSellItem), "G3SG1");
			}
			case 21:
			{
				strcopy(sSellItem, sizeof(sSellItem), "Famas");
			}
			case 22:
			{
				strcopy(sSellItem, sizeof(sSellItem), "M4A1");
			}
			case 23:
			{
				strcopy(sSellItem, sizeof(sSellItem), "Aug");
			}
			case 24:
			{
				strcopy(sSellItem, sizeof(sSellItem), "Sg550");
			}
			case 25:
			{
				strcopy(sSellItem, sizeof(sSellItem), "Mac10");
			}
			case 26:
			{
				strcopy(sSellItem, sizeof(sSellItem), "Tmp");
			}
			case 27:
			{
				strcopy(sSellItem, sizeof(sSellItem), "MP5 Navy");
			}
			case 28:
			{
				strcopy(sSellItem, sizeof(sSellItem), "Ump45");
			}
			case 29:
			{
				strcopy(sSellItem, sizeof(sSellItem), "P90");
			}
			case 30:
			{
				strcopy(sSellItem, sizeof(sSellItem), "M249");
			}
			case 31:
			{
				strcopy(sSellItem, sizeof(sSellItem), "Ticket de 10€");
			}
			case 32:
			{
				strcopy(sSellItem, sizeof(sSellItem), "Ticket de 50€");
			}
			case 33:
			{
				strcopy(sSellItem, sizeof(sSellItem), "Ticket de 100€");
			}
			case 34:
			{
				strcopy(sSellItem, sizeof(sSellItem), "Ticket de 500€");
			}
			case 35:
			{
				strcopy(sSellItem, sizeof(sSellItem), "RIB");
			}
			case 36:
			{
				strcopy(sSellItem, sizeof(sSellItem), "Carte Bleue");
			}
			case 37:
			{
				strcopy(sSellItem, sizeof(sSellItem), "Kit de soins");
			}
			case 38:
			{
				strcopy(sSellItem, sizeof(sSellItem), "Grenade");
			}
			case 39:
			{
				strcopy(sSellItem, sizeof(sSellItem), "Fumigène");
			}
			case 40:
			{
				strcopy(sSellItem, sizeof(sSellItem), "Flashbang");
			}
			case 41:
			{
				strcopy(sSellItem, sizeof(sSellItem), "Gilet pare-balle");
			}
			case 42:
			{
				strcopy(sSellItem, sizeof(sSellItem), "Munitions");
			}
			case 43:
			{
				strcopy(sSellItem, sizeof(sSellItem), "Permis Lourd");
			}
			case 44:
			{
				strcopy(sSellItem, sizeof(sSellItem), "Permis Léger");
			}
			case 45:
			{
				strcopy(sSellItem, sizeof(sSellItem), "Flashball Anti-émeute");
			}
			case 46:
			{
				strcopy(sSellItem, sizeof(sSellItem), "Imprimante de faux billets");
			}
			case 47:
			{
				strcopy(sSellItem, sizeof(sSellItem), "Oeil Bionique");
			}
			case 48:
			{
				strcopy(sSellItem, sizeof(sSellItem), "Regénérateur Bionique");
			}
			case 49:
			{
				strcopy(sSellItem, sizeof(sSellItem), "Licence de Paintball");
			}
			case 50:
			{
				strcopy(sSellItem, sizeof(sSellItem), "Hamburger");
			}
			case 51:
			{
				strcopy(sSellItem, sizeof(sSellItem), "Frites");
			}
			case 52:
			{
				strcopy(sSellItem, sizeof(sSellItem), "Sunday");
			}
			case 53:
			{
				strcopy(sSellItem, sizeof(sSellItem), "Big Mac");
			}
			case 54:
			{
				strcopy(sSellItem, sizeof(sSellItem), "Mac Flurry");
			}
			case 55:
			{
				strcopy(sSellItem, sizeof(sSellItem), "Fiche de Paie");
			}
			case 56:
			{
				strcopy(sSellItem, sizeof(sSellItem), "Lancés de couteaux");
			}
			
			case 57:
			{
				strcopy(sSellItem, sizeof(sSellItem), "Distributeur");
			}
			
			case 58:
			{
				strcopy(sSellItem, sizeof(sSellItem), "Sofa");
			}
			
			case 59:
			{
				strcopy(sSellItem, sizeof(sSellItem), "Bibliothèque");
			}
			
			case 60:
			{
				strcopy(sSellItem, sizeof(sSellItem), "Dryer");
			}
		}
		
		PriceFinal = QuantityItem * Price;
		
		decl String:Choix[32];
		
		new Handle:sell_menuPlayer = CreateMenu(Menu_SellPlayer);
		
		if (SellPlayerID != client)
		{
			SetMenuTitle(sell_menuPlayer, "%N vous propose de vous vendre un %s (Quantité: %i) pour %i€", client, sSellItem, QuantityItem, PriceFinal);
		}
		
		Format(Choix, 32, "%i_%i_%i_%i_a", client, QuantityItem, ItemID, PriceFinal);
		
		AddMenuItem(sell_menuPlayer, Choix, "Accepter l'offre");
		
		if (cb[SellPlayerID] == 1)
		{
			Format(Choix, 32, "%i_%i_%i_%i_aCB", client, QuantityItem, ItemID, PriceFinal);
			Format(Choix, 32, "%i_%i_%i_%i_aCB", client, QuantityItem, ItemID, PriceFinal);
			AddMenuItem(sell_menuPlayer, Choix, "Utiliser ma carte bleue", 0);
		}
		
		Format(Choix, 32, "%i_%i_%i_%i_r", client, QuantityItem, ItemID, PriceFinal);
		
		AddMenuItem(sell_menuPlayer, Choix, "Décliner l'offre", 0);
		DisplayMenu(sell_menuPlayer, SellPlayerID, 30);
	}
	else
	{
		if (action == MenuAction_End)
		{
			CloseHandle(menu_quantity);
		}
	}
}

public Menu_SellPlayer(Handle:sell_menuPlayer, MenuAction:action, client, param2)
{
	if (action == MenuAction_Select)
	{
		decl String:info[64];
		
		new Vendeur;
		new QuantityItem;
		new ItemID;
		new PriceFinal;
		new result;
		
		GetMenuItem(sell_menuPlayer, param2, info, sizeof(info));
		
		decl String:Buffer[20][64];
		ExplodeString(info, "_", Buffer, 5, 64);
		
		Vendeur = StringToInt(Buffer[0]);
		QuantityItem = StringToInt(Buffer[1]);
		ItemID = StringToInt(Buffer[2]);
		PriceFinal = StringToInt(Buffer[3]);
		
		new after;
		if (StrEqual(Buffer[4], "a"))
		{
			if (ItemID == 1)
			{
				if (StrEqual(Buffer[4], "aCB"))
				{
					result = Sell(Vendeur, client, "LSD", QuantityItem, PriceFinal, false, true);
				}
				else
				{
					result = Sell(Vendeur, client, "LSD", QuantityItem, PriceFinal, false, false);
				}
				
				if (result)
				{
					after = lsd[client];
					lsd[client] = after + QuantityItem;
				}
			}
			else if (ItemID == 2)
			{
				if (StrEqual(Buffer[4], "aCB"))
				{
					result = Sell(Vendeur, client, "Héroïne", QuantityItem, PriceFinal, false, true);
				}
				else
				{
					result = Sell(Vendeur, client, "Héroïne", QuantityItem, PriceFinal, false, false);
				}
				
				if (result)
				{
					after = heroine[client];
					heroine[client] = after + QuantityItem;
				}
			}
			else if (ItemID == 3)
			{
				if (StrEqual(Buffer[4], "aCB"))
				{
					result = Sell(Vendeur, client, "Extasy", QuantityItem, PriceFinal, false, true);
				}
				else
				{
					result = Sell(Vendeur, client, "Extasy", QuantityItem, PriceFinal, false, false);
				}
				
				if (result)
				{
					after = exta[client];
					exta[client] = after + QuantityItem;
				}
			}
			else if (ItemID == 4)
			{
				if (StrEqual(Buffer[4], "aCB"))
				{
					result = Sell(Vendeur, client, "Cocaïne", QuantityItem, PriceFinal, false, true);
				}
				else
				{
					result = Sell(Vendeur, client, "Cocaïne", QuantityItem, PriceFinal, false, false);
				}
				
				if (result)
				{
					after = cocaine[client];
					cocaine[client] = after + QuantityItem;
				}
			}
			else if (ItemID == 5)
			{
				if (StrEqual(Buffer[4], "aCB"))
				{
					result = Sell(Vendeur, client, "Weed", QuantityItem, PriceFinal, false, true);
				}
				else
				{
					result = Sell(Vendeur, client, "Weed", QuantityItem, PriceFinal, false, false);
				}
				
				if (result)
				{
					after = weed[client];
					weed[client] = after + QuantityItem;
				}
			}
			else if (ItemID == 6)
			{
				if (StrEqual(Buffer[4], "aCB"))
				{
					result = Sell(Vendeur, client, "Entrainement au couteau", QuantityItem, PriceFinal, true, true);
				}
				else
				{
					result = Sell(Vendeur, client, "Entrainement au couteau", QuantityItem, PriceFinal, true, false);
				}
				
				if (result)
				{
					after = entrainement[client];
					entrainement[client] = after + QuantityItem;
				}
			}
			else if (ItemID == 7)
			{
				if (StrEqual(Buffer[4], "aCB"))
				{
					result = Sell(Vendeur, client, "Glock", QuantityItem, PriceFinal, true, true);
				}
				else
				{
					result = Sell(Vendeur, client, "Glock", QuantityItem, PriceFinal, true, false);
				}
				
				if (result)
				{
					after = glock[client];
					glock[client] = after + QuantityItem;
				}
			}
			else if (ItemID == 8)
			{
				if (StrEqual(Buffer[4], "aCB"))
				{
					result = Sell(Vendeur, client, "USP", QuantityItem, PriceFinal, true, true);
				}
				else
				{
					result = Sell(Vendeur, client, "USP", QuantityItem, PriceFinal, true, false);
				}
				
				if (result)
				{
					after = usp[client];
					usp[client] = after + QuantityItem;
				}
			}
			else if (ItemID == 9)
			{
				if (StrEqual(Buffer[4], "aCB"))
				{
					result = Sell(Vendeur, client, "P228", QuantityItem, PriceFinal, true, true);
				}
				else
				{
					result = Sell(Vendeur, client, "P228", QuantityItem, PriceFinal, true, false);
				}
				
				if (result)
				{
					after = p228[client];
					p228[client] = after + QuantityItem;
				}
			}
			else if (ItemID == 10)
			{
				if (StrEqual(Buffer[4], "aCB"))
				{
					result = Sell(Vendeur, client, "Deagle", QuantityItem, PriceFinal, true, true);
				}
				else
				{
					result = Sell(Vendeur, client, "Deagle", QuantityItem, PriceFinal, true, false);
				}
				
				if (result)
				{
					after = deagle[client];
					deagle[client] = after + QuantityItem;
				}
			}
			else if (ItemID == 11)
			{
				if (StrEqual(Buffer[4], "aCB"))
				{
					result = Sell(Vendeur, client, "Elites", QuantityItem, PriceFinal, false, true);
				}
				else
				{
					result = Sell(Vendeur, client, "Elites", QuantityItem, PriceFinal, false, false);
				}
				
				if (result)
				{
					after = elites[client];
					elites[client] = after + QuantityItem;
				}
			}
			else if (ItemID == 12)
			{
				if (StrEqual(Buffer[4], "aCB"))
				{
					result = Sell(Vendeur, client, "Five Seven", QuantityItem, PriceFinal, true, true);
				}
				else
				{
					result = Sell(Vendeur, client, "Five Seven", QuantityItem, PriceFinal, true, false);
				}
				
				if (result)
				{
					after = fiveseven[client];
					fiveseven[client] = after + QuantityItem;
				}
			}
			else if (ItemID == 13)
			{
				if (StrEqual(Buffer[4], "aCB"))
				{
					result = Sell(Vendeur, client, "M3", QuantityItem, PriceFinal, true, true);
				}
				else
				{
					result = Sell(Vendeur, client, "M3", QuantityItem, PriceFinal, true, false);
				}
				
				if (result)
				{
					after = m3[client];
					m3[client] = after + QuantityItem;
				}
			}
			else if (ItemID == 14)
			{
				if (StrEqual(Buffer[4], "aCB"))
				{
					result = Sell(Vendeur, client, "XM1014", QuantityItem, PriceFinal, true, true);
				}
				else
				{
					result = Sell(Vendeur, client, "XM1014", QuantityItem, PriceFinal, true, false);
				}
				
				if (result)
				{
					after = xm1014[client];
					xm1014[client] = after + QuantityItem;
				}
			}
			else if (ItemID == 15)
			{
				if (StrEqual(Buffer[4], "aCB"))
				{
					result = Sell(Vendeur, client, "Galil", QuantityItem, PriceFinal, true, true);
				}
				else
				{
					result = Sell(Vendeur, client, "Galil", QuantityItem, PriceFinal, true, false);
				}
				
				if (result)
				{
					after = galil[client];
					galil[client] = after + QuantityItem;
				}
			}
			else if (ItemID == 16)
			{
				if (StrEqual(Buffer[4], "aCB"))
				{
					result = Sell(Vendeur, client, "Ak47", QuantityItem, PriceFinal, false, true);
				}
				else
				{
					result = Sell(Vendeur, client, "Ak47", QuantityItem, PriceFinal, false, false);
				}
				
				if (result)
				{
					after = ak47[client];
					ak47[client] = after + QuantityItem;
				}
			}
			else if (ItemID == 17)
			{
				if (StrEqual(Buffer[4], "aCB"))
				{
					result = Sell(Vendeur, client, "Scout", QuantityItem, PriceFinal, true, true);
				}
				else
				{
					result = Sell(Vendeur, client, "Scout", QuantityItem, PriceFinal, true, false);
				}
				
				if (result)
				{
					after = scout[client];
					scout[client] = after + QuantityItem;
				}
			}
			else if (ItemID == 18)
			{
				if (StrEqual(Buffer[4], "aCB"))
				{
					result = Sell(Vendeur, client, "Sg552", QuantityItem, PriceFinal, true, true);
				}
				else
				{
					result = Sell(Vendeur, client, "Sg552", QuantityItem, PriceFinal, true, false);
				}
				
				if (result)
				{
					after = sg552[client];
					sg552[client] = after + QuantityItem;
				}
			}
			else if (ItemID == 19)
			{
				if (StrEqual(Buffer[4], "aCB"))
				{
					result = Sell(Vendeur, client, "Awp", QuantityItem, PriceFinal, false, true);
				}
				else
				{
					result = Sell(Vendeur, client, "Awp", QuantityItem, PriceFinal, false, false);
				}
				
				if (result)
				{
					after = awp[client];
					awp[client] = after + QuantityItem;
				}
			}
			else if (ItemID == 20)
			{
				if (StrEqual(Buffer[4], "aCB"))
				{
					result = Sell(Vendeur, client, "G3SG1", QuantityItem, PriceFinal, true, true);
				}
				else
				{
					result = Sell(Vendeur, client, "G3SG1", QuantityItem, PriceFinal, true, false);
				}
				
				if (result)
				{
					after = g3sg1[client];
					g3sg1[client] = after + QuantityItem;
				}
			}
			else if (ItemID == 21)
			{
				if (StrEqual(Buffer[4], "aCB"))
				{
					result = Sell(Vendeur, client, "Famas", QuantityItem, PriceFinal, true, true);
				}
				else
				{
					result = Sell(Vendeur, client, "Famas", QuantityItem, PriceFinal, true, false);
				}
				
				if (result)
				{
					after = famas[client];
					famas[client] = after + QuantityItem;
				}
			}
			else if (ItemID == 22)
			{
				if (StrEqual(Buffer[4], "aCB"))
				{
					result = Sell(Vendeur, client, "M4A1", QuantityItem, PriceFinal, false, true);
				}
				else
				{
					result = Sell(Vendeur, client, "M4A1", QuantityItem, PriceFinal, false, false);
				}
				
				if (result)
				{
					after = m4a1[client];
					m4a1[client] = after + QuantityItem;
				}
			}
			else if (ItemID == 23)
			{
				if (StrEqual(Buffer[4], "aCB"))
				{
					result = Sell(Vendeur, client, "Aug", QuantityItem, PriceFinal, false, true);
				}
				else
				{
					result = Sell(Vendeur, client, "Aug", QuantityItem, PriceFinal, false, false);
				}
				
				if (result)
				{
					after = aug[client];
					aug[client] = after + QuantityItem;
				}
			}
			else if (ItemID == 24)
			{
				if (StrEqual(Buffer[4], "aCB"))
				{
					result = Sell(Vendeur, client, "Sg550", QuantityItem, PriceFinal, true, true);
				}
				else
				{
					result = Sell(Vendeur, client, "Sg550", QuantityItem, PriceFinal, true, false);
				}
				
				if (result)
				{
					after = sg550[client];
					sg550[client] = after + QuantityItem;
				}
			}
			else if (ItemID == 25)
			{
				if (StrEqual(Buffer[4], "aCB"))
				{
					result = Sell(Vendeur, client, "Mac10", QuantityItem, PriceFinal, true, true);
				}
				else
				{
					result = Sell(Vendeur, client, "Mac10", QuantityItem, PriceFinal, true, false);
				}
				
				if (result)
				{
					after = mac10[client];
					mac10[client] = after + QuantityItem;
				}
			}
			else if (ItemID == 26)
			{
				if (StrEqual(Buffer[4], "aCB"))
				{
					result = Sell(Vendeur, client, "Tmp", QuantityItem, PriceFinal, true, true);
				}
				else
				{
					result = Sell(Vendeur, client, "Tmp", QuantityItem, PriceFinal, true, false);
				}
				
				if (result)
				{
					after = tmp[client];
					tmp[client] = after + QuantityItem;
				}
			}
			else if (ItemID == 27)
			{
				if (StrEqual(Buffer[4], "aCB"))
				{
					result = Sell(Vendeur, client, "MP5 Navy", QuantityItem, PriceFinal, false, true);
				}
				else
				{
					result = Sell(Vendeur, client, "MP5 Navy", QuantityItem, PriceFinal, false, false);
				}
				
				if (result)
				{
					after = mp5[client];
					mp5[client] = after + QuantityItem;
				}
			}
			else if (ItemID == 28)
			{
				if (StrEqual(Buffer[4], "aCB"))
				{
					result = Sell(Vendeur, client, "Ump45", QuantityItem, PriceFinal, true, true);
				}
				else
				{
					result = Sell(Vendeur, client, "Ump45", QuantityItem, PriceFinal, true, false);
				}
				
				if (result)
				{
					after = ump45[client];
					ump45[client] = after + QuantityItem;
				}
			}
			else if (ItemID == 29)
			{
				if (StrEqual(Buffer[4], "aCB"))
				{
					result = Sell(Vendeur, client, "P90", QuantityItem, PriceFinal, false, true);
				}
				else
				{
					result = Sell(Vendeur, client, "P90", QuantityItem, PriceFinal, false, false);
				}
				
				if (result)
				{
					after = p90[client];
					p90[client] = after + QuantityItem;
				}
			}
			else if (ItemID == 30)
			{
				if (StrEqual(Buffer[4], "aCB"))
				{
					result = Sell(Vendeur, client, "M249", QuantityItem, PriceFinal, false, true);
				}
				else
				{
					result = Sell(Vendeur, client, "M249", QuantityItem, PriceFinal, false, false);
				}
				
				if (result)
				{
					after = m249[client];
					m249[client] = after + QuantityItem;
				}
			}
			else if (ItemID == 31)
			{
				if (StrEqual(Buffer[4], "aCB"))
				{
					result = Sell(Vendeur, client, "Ticket de 10€", QuantityItem, PriceFinal, true, true);
				}
				else
				{
					result = Sell(Vendeur, client, "Ticket de 10€", QuantityItem, PriceFinal, true, false);
				}
				
				if (result)
				{
					after = ticket10[client];
					ticket10[client] = after + QuantityItem;
				}
			}
			else if (ItemID == 32)
			{
				if (StrEqual(Buffer[4], "aCB"))
				{
					result = Sell(Vendeur, client, "Ticket de 50€", QuantityItem, PriceFinal, true, true);
				}
				else
				{
					result = Sell(Vendeur, client, "Ticket de 50€", QuantityItem, PriceFinal, true, false);
				}
				
				if (result)
				{
					after = ticket50[client];
					ticket50[client] = after + QuantityItem;
				}
			}
			else if (ItemID == 33)
			{
				if (StrEqual(Buffer[4], "aCB"))
				{
					result = Sell(Vendeur, client, "Ticket de 100€", QuantityItem, PriceFinal, true, true);
				}
				else
				{
					result = Sell(Vendeur, client, "Ticket de 100€", QuantityItem, PriceFinal, true, false);
				}
				
				if (result)
				{
					after = ticket100[client];
					ticket100[client] = after + QuantityItem;
				}
			}
			else if (ItemID == 34)
			{
				if (StrEqual(Buffer[4], "aCB"))
				{
					result = Sell(Vendeur, client, "Ticket de 500€", QuantityItem, PriceFinal, true, true);
				}
				else
				{
					result = Sell(Vendeur, client, "Ticket de 500€", QuantityItem, PriceFinal, true, false);
				}
				
				if (result)
				{
					after = ticket500[client];
					ticket500[client] = after + QuantityItem;
				}
			}
			else if (ItemID == 35)
			{
				if (StrEqual(Buffer[4], "aCB"))
				{
					result = Sell(Vendeur, client, "RIB", QuantityItem, PriceFinal, true, true);
				}
				else
				{
					result = Sell(Vendeur, client, "RIB", QuantityItem, PriceFinal, true, false);
				}
				
				if (result)
				{
					rib[client] = 1;
				}
			}
			else if (ItemID == 36)
			{
				if (StrEqual(Buffer[4], "aCB"))
				{
					result = Sell(Vendeur, client, "Carte Bleue", QuantityItem, PriceFinal, false, true);
				}
				else
				{
					result = Sell(Vendeur, client, "Carte Bleue", QuantityItem, PriceFinal, false, false);
				}
				
				if (result)
				{
					cb[client] = 1;
				}
			}
			else if (ItemID == 37)
			{
				if (StrEqual(Buffer[4], "aCB"))
				{
					result = Sell(Vendeur, client, "Kit de soins", QuantityItem, PriceFinal, true, true);
				}
				else
				{
					result = Sell(Vendeur, client, "Kit de soins", QuantityItem, PriceFinal, true, false);
				}
				
				if (result)
				{
					after = kit[client];
					kit[client] = after + QuantityItem;
				}
			}
			else if (ItemID == 38)
			{
				if (StrEqual(Buffer[4], "aCB"))
				{
					result = Sell(Vendeur, client, "Grenade", QuantityItem, PriceFinal, false, true);
				}
				else
				{
					result = Sell(Vendeur, client, "Grenade", QuantityItem, PriceFinal, false, false);
				}
				
				if (result)
				{
					after = grenade[client];
					grenade[client] = after + QuantityItem;
				}
			}
			else if (ItemID == 39)
			{
				if (StrEqual(Buffer[4], "aCB"))
				{
					result = Sell(Vendeur, client, "Fumigène", QuantityItem, PriceFinal, false, true);
				}
				else
				{
					result = Sell(Vendeur, client, "Fumigène", QuantityItem, PriceFinal, false, false);
				}
				
				if (result)
				{
					after = fumigene[client];
					fumigene[client] = after + QuantityItem;
				}
			}
			else if (ItemID == 40)
			{
				if (StrEqual(Buffer[4], "aCB"))
				{
					result = Sell(Vendeur, client, "Flashbang", QuantityItem, PriceFinal, false, true);
				}
				else
				{
					result = Sell(Vendeur, client, "Flashbang", QuantityItem, PriceFinal, false, false);
				}
				
				if (result)
				{
					after = flashbang[client];
					flashbang[client] = after + QuantityItem;
				}
			}
			else if (ItemID == 41)
			{
				if (StrEqual(Buffer[4], "aCB"))
				{
					result = Sell(Vendeur, client, "Gilet pare-balle", QuantityItem, PriceFinal, true, true);
				}
				else
				{
					result = Sell(Vendeur, client, "Gilet pare-balle", QuantityItem, PriceFinal, true, false);
				}
				
				if (result)
				{
					after = kevlar[client];
					kevlar[client] = after + QuantityItem;
				}
			}
			else if (ItemID == 42)
			{
				if (StrEqual(Buffer[4], "aCB"))
				{
					result = Sell(Vendeur, client, "Cartouche", QuantityItem, PriceFinal, false, true);
				}
				else
				{
					result = Sell(Vendeur, client, "Cartouche", QuantityItem, PriceFinal, false, false);
				}
				
				if (result)
				{
					after = cartouche[client];
					cartouche[client] = after + QuantityItem;
				}
			}
			else if (ItemID == 43)
			{
				if (StrEqual(Buffer[4], "aCB"))
				{
					result = Sell(Vendeur, client, "Permis Lourd", QuantityItem, PriceFinal, true, true);
				}
				else
				{
					result = Sell(Vendeur, client, "Permis Lourd", QuantityItem, PriceFinal, true, false);
				}
				
				if (result)
				{
					permislourd[client] = 1;
				}
			}
			else if (ItemID == 44)
			{
				if (StrEqual(Buffer[4], "aCB"))
				{
					result = Sell(Vendeur, client, "Permis Léger", QuantityItem, PriceFinal, true, true);
				}
				else
				{
					result = Sell(Vendeur, client, "Permis Léger", QuantityItem, PriceFinal, true, false);
				}
				
				if (result)
				{
					permisleger[client] = 1;
				}
			}
			else if (ItemID == 45)
			{
				if (StrEqual(Buffer[4], "aCB"))
				{
					result = Sell(Vendeur, client, "Flashball Anti-émeute", QuantityItem, PriceFinal, true, true);
				}
				else
				{
					result = Sell(Vendeur, client, "Flashball Anti-émeute", QuantityItem, PriceFinal, true, false);
				}
				
				if (result)
				{
					flashball[client] = flashball[client] + QuantityItem;
				}
			}
			else if (ItemID == 46)
			{
				if (StrEqual(Buffer[4], "aCB"))
				{
					result = Sell(Vendeur, client, "Imprimante de faux billets", QuantityItem, PriceFinal, false, true);
				}
				else
				{
					result = Sell(Vendeur, client, "Imprimante de faux billets", QuantityItem, PriceFinal, false, false);
				}
				
				if (result)
				{
					imprimerie[client] = imprimerie[client] + QuantityItem;
				}
			}
			else if (ItemID == 47)
			{
				if (StrEqual(Buffer[4], "aCB"))
				{
					result = Sell(Vendeur, client, "Oeil Bionique", QuantityItem, PriceFinal, true, true);
				}
				else
				{
					result = Sell(Vendeur, client, "Oeil Bionique", QuantityItem, PriceFinal, true, false);
				}
				
				if (result)
				{
					oeil[client] = oeil[client] + QuantityItem;
				}
			}
			else if (ItemID == 48)
			{
				if (StrEqual(Buffer[4], "aCB"))
				{
					result = Sell(Vendeur, client, "Regénérateur Bionique", QuantityItem, PriceFinal, true, true);
				}
				else
				{
					result = Sell(Vendeur, client, "Regénérateur Bionique", QuantityItem, PriceFinal, true, false);
				}
				
				if (result)
				{
					regenerateur[client] = regenerateur[client] + QuantityItem;
				}
			}
			else if (ItemID == 49)
			{
				if (StrEqual(Buffer[4], "aCB"))
				{
					result = Sell(Vendeur, client, "Licence de Paintball", QuantityItem, PriceFinal, false, true);
				}
				else
				{
					result = Sell(Vendeur, client, "Licence de Paintball", QuantityItem, PriceFinal, false, false);
				}
				
				if (result)
				{
					paintball[client] = true;
					CPrintToChat(client, "%s Votre licence de paintball est valable jusqu'à votre déconnexion.", LOGO);
				}
			}
			else if (ItemID == 50)
			{
				if (StrEqual(Buffer[4], "aCB"))
				{
					result = Sell(Vendeur, client, "Hamburger", QuantityItem, PriceFinal, true, true);
				}
				else
				{
					result = Sell(Vendeur, client, "Hamburger", QuantityItem, PriceFinal, true, false);
				}
				
				if (result)
				{
					hamburger[client] = hamburger[client] + QuantityItem;
				}
			}
			else if (ItemID == 51)
			{
				if (StrEqual(Buffer[4], "aCB"))
				{
					result = Sell(Vendeur, client, "Frites", QuantityItem, PriceFinal, false, true);
				}
				else
				{
					result = Sell(Vendeur, client, "Frites", QuantityItem, PriceFinal, false, false);
				}
				
				if (result)
				{
					frites[client] = frites[client] + QuantityItem;
				}
			}
			else if (ItemID == 52)
			{
				if (StrEqual(Buffer[4], "aCB"))
				{
					result = Sell(Vendeur, client, "Sunday", QuantityItem, PriceFinal, true, true);
				}
				else
				{
					result = Sell(Vendeur, client, "Sunday", QuantityItem, PriceFinal, true, false);
				}
				
				if (result)
				{
					sunday[client] = sunday[client] + QuantityItem;
				}
			}
			else if (ItemID == 53)
			{
				if (StrEqual(Buffer[4], "aCB"))
				{
					result = Sell(Vendeur, client, "Big Mac", QuantityItem, PriceFinal, true, true);
				}
				else
				{
					result = Sell(Vendeur, client, "Big Mac", QuantityItem, PriceFinal, true, false);
				}
				
				if (result)
				{
					bigmac[client] = bigmac[client] + QuantityItem;
				}
			}
			else if (ItemID == 54)
			{
				if (StrEqual(Buffer[4], "aCB"))
				{
					result = Sell(Vendeur, client, "Mac Flurry", QuantityItem, PriceFinal, true, true);
				}
				else
				{
					result = Sell(Vendeur, client, "Mac Flurry", QuantityItem, PriceFinal, true, false);
				}
				
				if (result)
				{
					macflurry[client] = macflurry[client] + QuantityItem;
				}
			}
			else if (ItemID == 55)
			{
				if (StrEqual(Buffer[4], "aCB"))
				{
					result = Sell(Vendeur, client, "Fiche de Paie", QuantityItem, PriceFinal, false, true);
				}
				else
				{
					result = Sell(Vendeur, client, "Fiche de Paie", QuantityItem, PriceFinal, false, false);
				}
				
				if (result)
				{
					fiche[client] = true;
					CPrintToChat(client, "%s Vous avez acheté une fiche de paie modifiée.", LOGO);
					CPrintToChat(client, "%s Elle est valide jusqu'à votre déconnexion et double votre salaire !", LOGO);
				}
			}
			else if (ItemID == 56)
			{
				if (StrEqual(Buffer[4], "aCB"))
				{
					result = Sell(Vendeur, client, "Lancés de couteaux", QuantityItem, PriceFinal, false, true);
				}
				else
				{
					result = Sell(Vendeur, client, "Lancés de couteaux", QuantityItem, PriceFinal, false, false);
				}
				
				if (result)
				{
					SetClientThrowingKnives(client, QuantityItem);
					CPrintToChat(client, "%s Vous avez acheté des lancés de couteaux.", LOGO);
				}
			}
			else if (ItemID == 57)
			{
				if (StrEqual(Buffer[4], "aCB"))
				{
					result = Sell(Vendeur, client, "Distributeur", QuantityItem, PriceFinal, false, true);
				}
				else
				{
					result = Sell(Vendeur, client, "Distributeur", QuantityItem, PriceFinal, false, false);
				}
				
				if (result)
				{
					distributeur[client] = distributeur[client] + QuantityItem;
					CPrintToChat(client, "%s Vous avez acheté un Distributeur.", LOGO);
				}
			}
			else if (ItemID == 58)
			{
				if (StrEqual(Buffer[4], "aCB"))
				{
					result = Sell(Vendeur, client, "Sofa", QuantityItem, PriceFinal, false, true);
				}
				else
				{
					result = Sell(Vendeur, client, "Sofa", QuantityItem, PriceFinal, false, false);
				}
				
				if (result)
				{
					sofa[client] = sofa[client] + QuantityItem;
					CPrintToChat(client, "%s Vous avez acheté un Sofa.", LOGO);
				}
			}
			else if (ItemID == 59)
			{
				if (StrEqual(Buffer[4], "aCB"))
				{
					result = Sell(Vendeur, client, "Bibliothèque", QuantityItem, PriceFinal, false, true);
				}
				else
				{
					result = Sell(Vendeur, client, "Bibliothèque", QuantityItem, PriceFinal, false, false);
				}
				
				if (result)
				{
					bibliotheque[client] = bibliotheque[client] + QuantityItem;
					CPrintToChat(client, "%s Vous avez acheté une Bibliothèque.", LOGO);
				}
			}
			else if (ItemID == 60)
			{
				if (StrEqual(Buffer[4], "aCB"))
				{
					result = Sell(Vendeur, client, "Dryer", QuantityItem, PriceFinal, false, true);
				}
				else
				{
					result = Sell(Vendeur, client, "Dryer", QuantityItem, PriceFinal, false, false);
				}
				
				if (result)
				{
					dryer[client] = dryer[client] + QuantityItem;
					CPrintToChat(client, "%s Vous avez acheté un Dryer.", LOGO);
				}
			}
		}
		else if (StrEqual(Buffer[4], "aCB"))
		{
			if (ItemID == 1)
			{
				if (StrEqual(Buffer[4], "aCB"))
				{
					result = Sell(Vendeur, client, "LSD", QuantityItem, PriceFinal, false, true);
				}
				else
				{
					result = Sell(Vendeur, client, "LSD", QuantityItem, PriceFinal, false, false);
				}
				
				if (result)
				{
					after = lsd[client];
					lsd[client] = after + QuantityItem;
				}
			}
			else if (ItemID == 2)
			{
				if (StrEqual(Buffer[4], "aCB"))
				{
					result = Sell(Vendeur, client, "Héroïne", QuantityItem, PriceFinal, false, true);
				}
				else
				{
					result = Sell(Vendeur, client, "Héroïne", QuantityItem, PriceFinal, false, false);
				}
				
				if (result)
				{
					after = heroine[client];
					heroine[client] = after + QuantityItem;
				}
			}
			else if (ItemID == 3)
			{
				if (StrEqual(Buffer[4], "aCB"))
				{
					result = Sell(Vendeur, client, "Extasy", QuantityItem, PriceFinal, false, true);
				}
				else
				{
					result = Sell(Vendeur, client, "Extasy", QuantityItem, PriceFinal, false, false);
				}
				
				if (result)
				{
					after = exta[client];
					exta[client] = after + QuantityItem;
				}
			}
			else if (ItemID == 4)
			{
				if (StrEqual(Buffer[4], "aCB"))
				{
					result = Sell(Vendeur, client, "Cocaïne", QuantityItem, PriceFinal, false, true);
				}
				else
				{
					result = Sell(Vendeur, client, "Cocaïne", QuantityItem, PriceFinal, false, false);
				}
				
				if (result)
				{
					after = cocaine[client];
					cocaine[client] = after + QuantityItem;
				}
			}
			else if (ItemID == 5)
			{
				if (StrEqual(Buffer[4], "aCB"))
				{
					result = Sell(Vendeur, client, "Weed", QuantityItem, PriceFinal, false, true);
				}
				else
				{
					result = Sell(Vendeur, client, "Weed", QuantityItem, PriceFinal, false, false);
				}
				
				if (result)
				{
					after = weed[client];
					weed[client] = after + QuantityItem;
				}
			}
			else if (ItemID == 6)
			{
				if (StrEqual(Buffer[4], "aCB"))
				{
					result = Sell(Vendeur, client, "Entrainement au couteau", QuantityItem, PriceFinal, true, true);
				}
				else
				{
					result = Sell(Vendeur, client, "Entrainement au couteau", QuantityItem, PriceFinal, true, false);
				}
				
				if (result)
				{
					after = entrainement[client];
					entrainement[client] = after + QuantityItem;
				}
			}
			else if (ItemID == 7)
			{
				if (StrEqual(Buffer[4], "aCB"))
				{
					result = Sell(Vendeur, client, "Glock", QuantityItem, PriceFinal, true, true);
				}
				else
				{
					result = Sell(Vendeur, client, "Glock", QuantityItem, PriceFinal, true, false);
				}
				
				if (result)
				{
					after = glock[client];
					glock[client] = after + QuantityItem;
				}
			}
			else if (ItemID == 8)
			{
				if (StrEqual(Buffer[4], "aCB"))
				{
					result = Sell(Vendeur, client, "USP", QuantityItem, PriceFinal, true, true);
				}
				else
				{
					result = Sell(Vendeur, client, "USP", QuantityItem, PriceFinal, true, false);
				}
				
				if (result)
				{
					after = usp[client];
					usp[client] = after + QuantityItem;
				}
			}
			else if (ItemID == 9)
			{
				if (StrEqual(Buffer[4], "aCB"))
				{
					result = Sell(Vendeur, client, "P228", QuantityItem, PriceFinal, true, true);
				}
				else
				{
					result = Sell(Vendeur, client, "P228", QuantityItem, PriceFinal, true, false);
				}
				
				if (result)
				{
					after = p228[client];
					p228[client] = after + QuantityItem;
				}
			}
			else if (ItemID == 10)
			{
				if (StrEqual(Buffer[4], "aCB"))
				{
					result = Sell(Vendeur, client, "Deagle", QuantityItem, PriceFinal, true, true);
				}
				else
				{
					result = Sell(Vendeur, client, "Deagle", QuantityItem, PriceFinal, true, false);
				}
				
				if (result)
				{
					after = deagle[client];
					deagle[client] = after + QuantityItem;
				}
			}
			else if (ItemID == 11)
			{
				if (StrEqual(Buffer[4], "aCB"))
				{
					result = Sell(Vendeur, client, "Elites", QuantityItem, PriceFinal, false, true);
				}
				else
				{
					result = Sell(Vendeur, client, "Elites", QuantityItem, PriceFinal, false, false);
				}
				
				if (result)
				{
					after = elites[client];
					elites[client] = after + QuantityItem;
				}
			}
			else if (ItemID == 12)
			{
				if (StrEqual(Buffer[4], "aCB"))
				{
					result = Sell(Vendeur, client, "Five Seven", QuantityItem, PriceFinal, true, true);
				}
				else
				{
					result = Sell(Vendeur, client, "Five Seven", QuantityItem, PriceFinal, true, false);
				}
				
				if (result)
				{
					after = fiveseven[client];
					fiveseven[client] = after + QuantityItem;
				}
			}
			else if (ItemID == 13)
			{
				if (StrEqual(Buffer[4], "aCB"))
				{
					result = Sell(Vendeur, client, "M3", QuantityItem, PriceFinal, true, true);
				}
				else
				{
					result = Sell(Vendeur, client, "M3", QuantityItem, PriceFinal, true, false);
				}
				
				if (result)
				{
					after = m3[client];
					m3[client] = after + QuantityItem;
				}
			}
			else if (ItemID == 14)
			{
				if (StrEqual(Buffer[4], "aCB"))
				{
					result = Sell(Vendeur, client, "XM1014", QuantityItem, PriceFinal, true, true);
				}
				else
				{
					result = Sell(Vendeur, client, "XM1014", QuantityItem, PriceFinal, true, false);
				}
				
				if (result)
				{
					after = xm1014[client];
					xm1014[client] = after + QuantityItem;
				}
			}
			else if (ItemID == 15)
			{
				if (StrEqual(Buffer[4], "aCB"))
				{
					result = Sell(Vendeur, client, "Galil", QuantityItem, PriceFinal, true, true);
				}
				else
				{
					result = Sell(Vendeur, client, "Galil", QuantityItem, PriceFinal, true, false);
				}
				
				if (result)
				{
					after = galil[client];
					galil[client] = after + QuantityItem;
				}
			}
			else if (ItemID == 16)
			{
				if (StrEqual(Buffer[4], "aCB"))
				{
					result = Sell(Vendeur, client, "Ak47", QuantityItem, PriceFinal, false, true);
				}
				else
				{
					result = Sell(Vendeur, client, "Ak47", QuantityItem, PriceFinal, false, false);
				}
				
				if (result)
				{
					after = ak47[client];
					ak47[client] = after + QuantityItem;
				}
			}
			else if (ItemID == 17)
			{
				if (StrEqual(Buffer[4], "aCB"))
				{
					result = Sell(Vendeur, client, "Scout", QuantityItem, PriceFinal, true, true);
				}
				else
				{
					result = Sell(Vendeur, client, "Scout", QuantityItem, PriceFinal, true, false);
				}
				
				if (result)
				{
					after = scout[client];
					scout[client] = after + QuantityItem;
				}
			}
			else if (ItemID == 18)
			{
				if (StrEqual(Buffer[4], "aCB"))
				{
					result = Sell(Vendeur, client, "Sg552", QuantityItem, PriceFinal, true, true);
				}
				else
				{
					result = Sell(Vendeur, client, "Sg552", QuantityItem, PriceFinal, true, false);
				}
				
				if (result)
				{
					after = sg552[client];
					sg552[client] = after + QuantityItem;
				}
			}
			else if (ItemID == 19)
			{
				if (StrEqual(Buffer[4], "aCB"))
				{
					result = Sell(Vendeur, client, "Awp", QuantityItem, PriceFinal, false, true);
				}
				else
				{
					result = Sell(Vendeur, client, "Awp", QuantityItem, PriceFinal, false, false);
				}
				
				if (result)
				{
					after = awp[client];
					awp[client] = after + QuantityItem;
				}
			}
			else if (ItemID == 20)
			{
				if (StrEqual(Buffer[4], "aCB"))
				{
					result = Sell(Vendeur, client, "G3SG1", QuantityItem, PriceFinal, true, true);
				}
				else
				{
					result = Sell(Vendeur, client, "G3SG1", QuantityItem, PriceFinal, true, false);
				}
				
				if (result)
				{
					after = g3sg1[client];
					g3sg1[client] = after + QuantityItem;
				}
			}
			else if (ItemID == 21)
			{
				if (StrEqual(Buffer[4], "aCB"))
				{
					result = Sell(Vendeur, client, "Famas", QuantityItem, PriceFinal, true, true);
				}
				else
				{
					result = Sell(Vendeur, client, "Famas", QuantityItem, PriceFinal, true, false);
				}
				
				if (result)
				{
					after = famas[client];
					famas[client] = after + QuantityItem;
				}
			}
			else if (ItemID == 22)
			{
				if (StrEqual(Buffer[4], "aCB"))
				{
					result = Sell(Vendeur, client, "M4A1", QuantityItem, PriceFinal, false, true);
				}
				else
				{
					result = Sell(Vendeur, client, "M4A1", QuantityItem, PriceFinal, false, false);
				}
				
				if (result)
				{
					after = m4a1[client];
					m4a1[client] = after + QuantityItem;
				}
			}
			else if (ItemID == 23)
			{
				if (StrEqual(Buffer[4], "aCB"))
				{
					result = Sell(Vendeur, client, "Aug", QuantityItem, PriceFinal, false, true);
				}
				else
				{
					result = Sell(Vendeur, client, "Aug", QuantityItem, PriceFinal, false, false);
				}
				
				if (result)
				{
					after = aug[client];
					aug[client] = after + QuantityItem;
				}
			}
			else if (ItemID == 24)
			{
				if (StrEqual(Buffer[4], "aCB"))
				{
					result = Sell(Vendeur, client, "Sg550", QuantityItem, PriceFinal, true, true);
				}
				else
				{
					result = Sell(Vendeur, client, "Sg550", QuantityItem, PriceFinal, true, false);
				}
				
				if (result)
				{
					after = sg550[client];
					sg550[client] = after + QuantityItem;
				}
			}
			else if (ItemID == 25)
			{
				if (StrEqual(Buffer[4], "aCB"))
				{
					result = Sell(Vendeur, client, "Mac10", QuantityItem, PriceFinal, true, true);
				}
				else
				{
					result = Sell(Vendeur, client, "Mac10", QuantityItem, PriceFinal, true, false);
				}
				
				if (result)
				{
					after = mac10[client];
					mac10[client] = after + QuantityItem;
				}
			}
			else if (ItemID == 26)
			{
				if (StrEqual(Buffer[4], "aCB"))
				{
					result = Sell(Vendeur, client, "Tmp", QuantityItem, PriceFinal, true, true);
				}
				else
				{
					result = Sell(Vendeur, client, "Tmp", QuantityItem, PriceFinal, true, false);
				}
				
				if (result)
				{
					after = tmp[client];
					tmp[client] = after + QuantityItem;
				}
			}
			else if (ItemID == 27)
			{
				if (StrEqual(Buffer[4], "aCB"))
				{
					result = Sell(Vendeur, client, "MP5 Navy", QuantityItem, PriceFinal, false, true);
				}
				else
				{
					result = Sell(Vendeur, client, "MP5 Navy", QuantityItem, PriceFinal, false, false);
				}
				
				if (result)
				{
					after = mp5[client];
					mp5[client] = after + QuantityItem;
				}
			}
			else if (ItemID == 28)
			{
				if (StrEqual(Buffer[4], "aCB"))
				{
					result = Sell(Vendeur, client, "Ump45", QuantityItem, PriceFinal, true, true);
				}
				else
				{
					result = Sell(Vendeur, client, "Ump45", QuantityItem, PriceFinal, true, false);
				}
				
				if (result)
				{
					after = ump45[client];
					ump45[client] = after + QuantityItem;
				}
			}
			else if (ItemID == 29)
			{
				if (StrEqual(Buffer[4], "aCB"))
				{
					result = Sell(Vendeur, client, "P90", QuantityItem, PriceFinal, false, true);
				}
				else
				{
					result = Sell(Vendeur, client, "P90", QuantityItem, PriceFinal, false, false);
				}
				
				if (result)
				{
					after = p90[client];
					p90[client] = after + QuantityItem;
				}
			}
			else if (ItemID == 30)
			{
				if (StrEqual(Buffer[4], "aCB"))
				{
					result = Sell(Vendeur, client, "M249", QuantityItem, PriceFinal, false, true);
				}
				else
				{
					result = Sell(Vendeur, client, "M249", QuantityItem, PriceFinal, false, false);
				}
				
				if (result)
				{
					after = m249[client];
					m249[client] = after + QuantityItem;
				}
			}
			else if (ItemID == 31)
			{
				if (StrEqual(Buffer[4], "aCB"))
				{
					result = Sell(Vendeur, client, "Ticket de 10€", QuantityItem, PriceFinal, true, true);
				}
				else
				{
					result = Sell(Vendeur, client, "Ticket de 10€", QuantityItem, PriceFinal, true, false);
				}
				
				if (result)
				{
					after = ticket10[client];
					ticket10[client] = after + QuantityItem;
				}
			}
			else if (ItemID == 32)
			{
				if (StrEqual(Buffer[4], "aCB"))
				{
					result = Sell(Vendeur, client, "Ticket de 50€", QuantityItem, PriceFinal, true, true);
				}
				else
				{
					result = Sell(Vendeur, client, "Ticket de 50€", QuantityItem, PriceFinal, true, false);
				}
				
				if (result)
				{
					after = ticket50[client];
					ticket50[client] = after + QuantityItem;
				}
			}
			else if (ItemID == 33)
			{
				if (StrEqual(Buffer[4], "aCB"))
				{
					result = Sell(Vendeur, client, "Ticket de 100€", QuantityItem, PriceFinal, true, true);
				}
				else
				{
					result = Sell(Vendeur, client, "Ticket de 100€", QuantityItem, PriceFinal, true, false);
				}
				
				if (result)
				{
					after = ticket100[client];
					ticket100[client] = after + QuantityItem;
				}
			}
			else if (ItemID == 34)
			{
				if (StrEqual(Buffer[4], "aCB"))
				{
					result = Sell(Vendeur, client, "Ticket de 500€", QuantityItem, PriceFinal, true, true);
				}
				else
				{
					result = Sell(Vendeur, client, "Ticket de 500€", QuantityItem, PriceFinal, true, false);
				}
				
				if (result)
				{
					after = ticket500[client];
					ticket500[client] = after + QuantityItem;
				}
			}
			else if (ItemID == 35)
			{
				if (StrEqual(Buffer[4], "aCB"))
				{
					result = Sell(Vendeur, client, "RIB", QuantityItem, PriceFinal, true, true);
				}
				else
				{
					result = Sell(Vendeur, client, "RIB", QuantityItem, PriceFinal, true, false);
				}
				
				if (result)
				{
					rib[client] = 1;
				}
			}
			else if (ItemID == 36)
			{
				if (StrEqual(Buffer[4], "aCB"))
				{
					result = Sell(Vendeur, client, "Carte Bleue", QuantityItem, PriceFinal, false, true);
				}
				else
				{
					result = Sell(Vendeur, client, "Carte Bleue", QuantityItem, PriceFinal, false, false);
				}
				
				if (result)
				{
					cb[client] = 1;
				}
			}
			else if (ItemID == 37)
			{
				if (StrEqual(Buffer[4], "aCB"))
				{
					result = Sell(Vendeur, client, "Kit de soins", QuantityItem, PriceFinal, true, true);
				}
				else
				{
					result = Sell(Vendeur, client, "Kit de soins", QuantityItem, PriceFinal, true, false);
				}
				
				if (result)
				{
					after = kit[client];
					kit[client] = after + QuantityItem;
				}
			}
			else if (ItemID == 38)
			{
				if (StrEqual(Buffer[4], "aCB"))
				{
					result = Sell(Vendeur, client, "Grenade", QuantityItem, PriceFinal, false, true);
				}
				else
				{
					result = Sell(Vendeur, client, "Grenade", QuantityItem, PriceFinal, false, false);
				}
				
				if (result)
				{
					after = grenade[client];
					grenade[client] = after + QuantityItem;
				}
			}
			else if (ItemID == 39)
			{
				if (StrEqual(Buffer[4], "aCB"))
				{
					result = Sell(Vendeur, client, "Fumigène", QuantityItem, PriceFinal, false, true);
				}
				else
				{
					result = Sell(Vendeur, client, "Fumigène", QuantityItem, PriceFinal, false, false);
				}
				
				if (result)
				{
					after = fumigene[client];
					fumigene[client] = after + QuantityItem;
				}
			}
			else if (ItemID == 40)
			{
				if (StrEqual(Buffer[4], "aCB"))
				{
					result = Sell(Vendeur, client, "Flashbang", QuantityItem, PriceFinal, false, true);
				}
				else
				{
					result = Sell(Vendeur, client, "Flashbang", QuantityItem, PriceFinal, false, false);
				}
				
				if (result)
				{
					after = flashbang[client];
					flashbang[client] = after + QuantityItem;
				}
			}
			else if (ItemID == 41)
			{
				if (StrEqual(Buffer[4], "aCB"))
				{
					result = Sell(Vendeur, client, "Gilet pare-balle", QuantityItem, PriceFinal, true, true);
				}
				else
				{
					result = Sell(Vendeur, client, "Gilet pare-balle", QuantityItem, PriceFinal, true, false);
				}
				
				if (result)
				{
					after = kevlar[client];
					kevlar[client] = after + QuantityItem;
				}
			}
			else if (ItemID == 42)
			{
				if (StrEqual(Buffer[4], "aCB"))
				{
					result = Sell(Vendeur, client, "Cartouche", QuantityItem, PriceFinal, false, true);
				}
				else
				{
					result = Sell(Vendeur, client, "Cartouche", QuantityItem, PriceFinal, false, false);
				}
				
				if (result)
				{
					after = cartouche[client];
					cartouche[client] = after + QuantityItem;
				}
			}
			else if (ItemID == 43)
			{
				if (StrEqual(Buffer[4], "aCB"))
				{
					result = Sell(Vendeur, client, "Permis Lourd", QuantityItem, PriceFinal, true, true);
				}
				else
				{
					result = Sell(Vendeur, client, "Permis Lourd", QuantityItem, PriceFinal, true, false);
				}
				
				if (result)
				{
					permislourd[client] = 1;
				}
			}
			else if (ItemID == 44)
			{
				if (StrEqual(Buffer[4], "aCB"))
				{
					result = Sell(Vendeur, client, "Permis Léger", QuantityItem, PriceFinal, true, true);
				}
				else
				{
					result = Sell(Vendeur, client, "Permis Léger", QuantityItem, PriceFinal, true, false);
				}
				
				if (result)
				{
					permisleger[client] = 1;
				}
			}
			else if (ItemID == 45)
			{
				if (StrEqual(Buffer[4], "aCB"))
				{
					result = Sell(Vendeur, client, "Flashball Anti-émeute", QuantityItem, PriceFinal, true, true);
				}
				else
				{
					result = Sell(Vendeur, client, "Flashball Anti-émeute", QuantityItem, PriceFinal, true, false);
				}
				
				if (result)
				{
					flashball[client] = flashball[client] + QuantityItem;
				}
			}
			else if (ItemID == 46)
			{
				if (StrEqual(Buffer[4], "aCB"))
				{
					result = Sell(Vendeur, client, "Imprimante de faux billets", QuantityItem, PriceFinal, false, true);
				}
				else
				{
					result = Sell(Vendeur, client, "Imprimante de faux billets", QuantityItem, PriceFinal, false, false);
				}
				
				if (result)
				{
					imprimerie[client] = imprimerie[client] + QuantityItem;
				}
			}
			else if (ItemID == 47)
			{
				if (StrEqual(Buffer[4], "aCB"))
				{
					result = Sell(Vendeur, client, "Oeil Bionique", QuantityItem, PriceFinal, true, true);
				}
				else
				{
					result = Sell(Vendeur, client, "Oeil Bionique", QuantityItem, PriceFinal, true, false);
				}
				
				if (result)
				{
					oeil[client] = oeil[client] + QuantityItem;
				}
			}
			else if (ItemID == 48)
			{
				if (StrEqual(Buffer[4], "aCB"))
				{
					result = Sell(Vendeur, client, "Regénérateur Bionique", QuantityItem, PriceFinal, true, true);
				}
				else
				{
					result = Sell(Vendeur, client, "Regénérateur Bionique", QuantityItem, PriceFinal, true, false);
				}
				
				if (result)
				{
					regenerateur[client] = regenerateur[client] + QuantityItem;
				}
			}
			else if (ItemID == 49)
			{
				if (StrEqual(Buffer[4], "aCB"))
				{
					result = Sell(Vendeur, client, "Licence de Paintball", QuantityItem, PriceFinal, false, true);
				}
				else
				{
					result = Sell(Vendeur, client, "Licence de Paintball", QuantityItem, PriceFinal, false, false);
				}
				
				if (result)
				{
					paintball[client] = true;
					CPrintToChat(client, "%s Votre licence de paintball est valable jusqu'à votre déconnexion.", LOGO);
				}
			}
			else if (ItemID == 50)
			{
				if (StrEqual(Buffer[4], "aCB"))
				{
					result = Sell(Vendeur, client, "Hamburger", QuantityItem, PriceFinal, true, true);
				}
				else
				{
					result = Sell(Vendeur, client, "Hamburger", QuantityItem, PriceFinal, true, false);
				}
				
				if (result)
				{
					hamburger[client] = hamburger[client] + QuantityItem;
				}
			}
			else if (ItemID == 51)
			{
				if (StrEqual(Buffer[4], "aCB"))
				{
					result = Sell(Vendeur, client, "Frites", QuantityItem, PriceFinal, false, true);
				}
				else
				{
					result = Sell(Vendeur, client, "Frites", QuantityItem, PriceFinal, false, false);
				}
				
				if (result)
				{
					frites[client] = frites[client] + QuantityItem;
				}
			}
			else if (ItemID == 52)
			{
				if (StrEqual(Buffer[4], "aCB"))
				{
					result = Sell(Vendeur, client, "Sunday", QuantityItem, PriceFinal, true, true);
				}
				else
				{
					result = Sell(Vendeur, client, "Sunday", QuantityItem, PriceFinal, true, false);
				}
				
				if (result)
				{
					sunday[client] = sunday[client] + QuantityItem;
				}
			}
			else if (ItemID == 53)
			{
				if (StrEqual(Buffer[4], "aCB"))
				{
					result = Sell(Vendeur, client, "Big Mac", QuantityItem, PriceFinal, true, true);
				}
				else
				{
					result = Sell(Vendeur, client, "Big Mac", QuantityItem, PriceFinal, true, false);
				}
				
				if (result)
				{
					bigmac[client] = bigmac[client] + QuantityItem;
				}
			}
			else if (ItemID == 54)
			{
				if (StrEqual(Buffer[4], "aCB"))
				{
					result = Sell(Vendeur, client, "Mac Flurry", QuantityItem, PriceFinal, true, true);
				}
				else
				{
					result = Sell(Vendeur, client, "Mac Flurry", QuantityItem, PriceFinal, true, false);
				}
				
				if (result)
				{
					macflurry[client] = macflurry[client] + QuantityItem;
				}
			}
			else if (ItemID == 55)
			{
				if (StrEqual(Buffer[4], "aCB"))
				{
					result = Sell(Vendeur, client, "Fiche de Paie", QuantityItem, PriceFinal, false, true);
				}
				else
				{
					result = Sell(Vendeur, client, "Fiche de Paie", QuantityItem, PriceFinal, false, false);
				}
				
				if (result)
				{
					fiche[client] = true;
					CPrintToChat(client, "%s Vous avez acheté une fiche de paie modifiée.", LOGO);
					CPrintToChat(client, "%s Elle est valide jusqu'à votre déconnexion et double votre salaire !", LOGO);
				}
			}
			else if (ItemID == 56)
			{
				if (StrEqual(Buffer[4], "aCB"))
				{
					result = Sell(Vendeur, client, "Lancés de couteaux", QuantityItem, PriceFinal, false, true);
				}
				else
				{
					result = Sell(Vendeur, client, "Lancés de couteaux", QuantityItem, PriceFinal, false, false);
				}
				
				if (result)
				{
					SetClientThrowingKnives(client, QuantityItem);
					CPrintToChat(client, "%s Vous avez acheté des lancés de couteaux.", LOGO);
				}
			}
			else if (ItemID == 57)
			{
				if (StrEqual(Buffer[4], "aCB"))
				{
					result = Sell(Vendeur, client, "Distributeur", QuantityItem, PriceFinal, true, true);
				}
				else
				{
					result = Sell(Vendeur, client, "Distributeur", QuantityItem, PriceFinal, true, false);
				}
				
				if (result)
				{
					distributeur[client] += QuantityItem;
				}
			}
			else if (ItemID == 58)
			{
				if (StrEqual(Buffer[4], "aCB"))
				{
					result = Sell(Vendeur, client, "Sofa", QuantityItem, PriceFinal, true, true);
				}
				else
				{
					result = Sell(Vendeur, client, "Sofa", QuantityItem, PriceFinal, true, false);
				}
				
				if (result)
				{
					sofa[client] += QuantityItem;
				}
			}
			else if (ItemID == 59)
			{
				if (StrEqual(Buffer[4], "aCB"))
				{
					result = Sell(Vendeur, client, "Bibliothèque", QuantityItem, PriceFinal, false, true);
				}
				else
				{
					result = Sell(Vendeur, client, "Bibliothèque", QuantityItem, PriceFinal, false, false);
				}
				
				if (result)
				{
					bibliotheque[client] += QuantityItem;
				}
			}
			else if (ItemID == 60)
			{
				if (StrEqual(Buffer[4], "aCB"))
				{
					result = Sell(Vendeur, client, "Dryer", QuantityItem, PriceFinal, false, true);
				}
				else
				{
					result = Sell(Vendeur, client, "Dryer", QuantityItem, PriceFinal, false, false);
				}
				
				if (result)
				{
					dryer[client] += QuantityItem;
				}
			}
		}
		else if (StrEqual(Buffer[4], "r"))
		{
			CPrintToChat(Vendeur, "%s %N a refuser votre offre.", LOGO, client);
			CPrintToChat(client, "%s Vous avez refuser l'offre de %N.", LOGO, Vendeur);
		}
	}
	else if (action == MenuAction_End)
	{
		CloseHandle(sell_menuPlayer);
	}
}

Sell(client, Player, String:item[], Quantity, Cost, bool:masculin, bool:TempHasCB)
{
	decl result;
	
	if (TempHasCB)
	{
		result = bank[Player] - Cost;
	}
	else
	{
		result = money[Player] - Cost;
	}
	
	if (0 <= result)
	{
		if (TempHasCB)
		{
			new lol = bank[Player];
			bank[Player] = lol - Cost;
		}
		else
		{
			new mdr = money[Player];
			money[Player] = mdr - Cost;
		}
		
		if (Player != client)
		{
			new xd = money[client];
			money[client] = Cost / 2 + xd;
		}
		
		new checkcapital = capital[rankid[client]];
		capital[rankid[client]] = checkcapital + (Cost / 2);

		if (masculin)
		{
			CPrintToChat(Player, "%s {blue}Vous avez acheté un {green}%s ({lightgreen}Quantité: {red}%i) {blue}à {green}%N {blue}pour {red}%i€", LOGO, item, Quantity, client, Cost);
			CPrintToChat(client, "%s {blue}Vous avez vendu un {green}%s ({lightgreen}Quantité: {red}%i) {blue}à {green}%N {blue}pour {red}%i€", LOGO, item, Quantity, Player, Cost);
			
			LogToFile(Logfile,"Le joueur %N à acheter un %s (Quantité : %i) pour %i€ à %N.", Player, item, Quantity, Cost, client);
		}
		else
		{
			CPrintToChat(Player, "%s {blue}Vous avez acheté un {green}%s ({lightgreen}Quantité: {red}%i) {blue}à {green}%N {blue}pour {red}%i€", LOGO, item, Quantity, client, Cost);
			CPrintToChat(client, "%s {blue}Vous avez vendu un {green}%s ({lightgreen}Quantité: {red}%i) {blue}à {green}%N {blue}pour {red}%i€", LOGO, item, Quantity, Player, Cost);
			
			LogToFile(Logfile,"Le joueur %N à acheter une %s (Quantité : %i) pour %i€ à %N.", Player, item, Quantity, Cost, client);
		}
		return 1;
	}
	else
	{
		CPrintToChat(client, "%s {green}%N {red}n'as pas assez d'argent pour finaliser la transaction.", LOGO, Player);
		CPrintToChat(Player, "%s {red}{red} Vous n'avez pas l'argent !", LOGO);
	}
	
	return 0;
}

public Action:Command_Item(client, args)
{
	if (IsClientInGame(client))
	{
		BuildItemMenu(client);
	}
	
	return Plugin_Continue;
}

Handle:BuildItemMenu(client)
{
	new String:Buffer[128];
	
	new Handle:Item = CreateMenu(Menu_Item);
	SetMenuTitle(Item, "Choix de votre Item à utiliser\nNOTE : Les armes sont fournies sans munitions\n ");
	
	if (lsd[client] > 0)
	{
		Format(Buffer, sizeof(Buffer), "LSD (Quantité: %i)", lsd[client]);
		AddMenuItem(Item, "lsd", Buffer);
	}
	if (heroine[client] > 0)
	{
		Format(Buffer, sizeof(Buffer), "Héroïne (Quantité: %i)", heroine[client]);
		AddMenuItem(Item, "hero", Buffer);
	}
	if (exta[client] > 0)
	{
		Format(Buffer, sizeof(Buffer), "Extasy (Quantité: %i)", exta[client]);
		AddMenuItem(Item, "exta", Buffer);
	}
	if (cocaine[client] > 0)
	{
		Format(Buffer, sizeof(Buffer), "Cocaïne (Quantité: %i)", cocaine[client]);
		AddMenuItem(Item, "cocaine", Buffer);
	}
	if (weed[client] > 0)
	{
		Format(Buffer, sizeof(Buffer), "Weed (Quantité: %i)", weed[client]);
		AddMenuItem(Item, "weed", Buffer);
	}
	if (entrainement[client] > 0)
	{
		Format(Buffer, sizeof(Buffer), "Niveau CUT (Quantité: %i)", entrainement[client]);
		AddMenuItem(Item, "cut", Buffer);
	}
	if (glock[client] > 0)
	{
		Format(Buffer, sizeof(Buffer), "Glock (Quantité: %i)", glock[client]);
		AddMenuItem(Item, "glock", Buffer);
	}
	if (usp[client] > 0)
	{
		Format(Buffer, sizeof(Buffer), "USP (Quantité: %i)", usp[client]);
		AddMenuItem(Item, "usp", Buffer);
	}
	if (p228[client] > 0)
	{
		Format(Buffer, sizeof(Buffer), "P228 (Quantité: %i)", p228[client]);
		AddMenuItem(Item, "p228", Buffer);
	}
	if (deagle[client] > 0)
	{
		Format(Buffer, sizeof(Buffer), "Deagle (Quantité: %i)", deagle[client]);
		AddMenuItem(Item, "deagle", Buffer);
	}
	if (elites[client] > 0)
	{
		Format(Buffer, sizeof(Buffer), "Elites (Quantité: %i)", elites[client]);
		AddMenuItem(Item, "elites", Buffer);
	}
	if (fiveseven[client] > 0)
	{
		Format(Buffer, sizeof(Buffer), "Five Seven (Quantité: %i)", fiveseven[client]);
		AddMenuItem(Item, "fiveseven", Buffer);
	}
	if (m3[client] > 0)
	{
		Format(Buffer, sizeof(Buffer), "M3 (Quantité: %i)", m3[client]);
		AddMenuItem(Item, "m3", Buffer);
	}
	if (xm1014[client] > 0)
	{
		Format(Buffer, sizeof(Buffer), "Xm1014 (Quantité: %i)", xm1014[client]);
		AddMenuItem(Item, "xm1014", Buffer);
	}
	if (galil[client] > 0)
	{
		Format(Buffer, sizeof(Buffer), "Galil (Quantité: %i)", galil[client]);
		AddMenuItem(Item, "galil", Buffer);
	}
	if (ak47[client] > 0)
	{
		Format(Buffer, sizeof(Buffer), "Ak47 (Quantité: %i)", ak47[client]);
		AddMenuItem(Item, "ak47", Buffer);
	}
	if (scout[client] > 0)
	{
		Format(Buffer, sizeof(Buffer), "Scout (Quantité: %i)", scout[client]);
		AddMenuItem(Item, "scout", Buffer);
	}
	if (sg552[client] > 0)
	{
		Format(Buffer, sizeof(Buffer), "Sg552 (Quantité: %i)", sg552[client]);
		AddMenuItem(Item, "sg552", Buffer);
	}
	if (awp[client] > 0)
	{
		Format(Buffer, sizeof(Buffer), "Awp (Quantité: %i)", awp[client]);
		AddMenuItem(Item, "awp", Buffer);
	}
	if (g3sg1[client] > 0)
	{
		Format(Buffer, sizeof(Buffer), "G3SG1 (Quantité: %i)", g3sg1[client]);
		AddMenuItem(Item, "g3sg1", Buffer);
	}
	if (famas[client] > 0)
	{
		Format(Buffer, sizeof(Buffer), "Famas (Quantité: %i)", famas[client]);
		AddMenuItem(Item, "famas", Buffer);
	}
	if (m4a1[client] > 0)
	{
		Format(Buffer, sizeof(Buffer), "M4A1 (Quantité: %i)", m4a1[client]);
		AddMenuItem(Item, "m4a1", Buffer);
	}
	if (aug[client] > 0)
	{
		Format(Buffer, sizeof(Buffer), "Aug (Quantité: %i)", aug[client]);
		AddMenuItem(Item, "aug", Buffer);
	}
	if (sg550[client] > 0)
	{
		Format(Buffer, sizeof(Buffer), "Sg550 (Quantité: %i)", sg550[client]);
		AddMenuItem(Item, "sg550", Buffer);
	}
	if (mac10[client] > 0)
	{
		Format(Buffer, sizeof(Buffer), "Mac10 (Quantité: %i)", mac10[client]);
		AddMenuItem(Item, "mac10", Buffer);
	}
	if (tmp[client] > 0)
	{
		Format(Buffer, sizeof(Buffer), "Tmp (Quantité: %i)", tmp[client]);
		AddMenuItem(Item, "tmp", Buffer);
	}
	if (mp5[client] > 0)
	{
		Format(Buffer, sizeof(Buffer), "MP5 Navy (Quantité: %i)", mp5[client]);
		AddMenuItem(Item, "mp5", Buffer);
	}
	if (ump45[client] > 0)
	{
		Format(Buffer, sizeof(Buffer), "Ump45 (Quantité: %i)", ump45[client]);
		AddMenuItem(Item, "ump45", Buffer);
	}
	if (p90[client] > 0)
	{
		Format(Buffer, sizeof(Buffer), "P90 (Quantité: %i)", p90[client]);
		AddMenuItem(Item, "p90", Buffer);
	}
	if (m249[client] > 0)
	{
		Format(Buffer, sizeof(Buffer), "M249 (Quantité: %i)", m249[client]);
		AddMenuItem(Item, "m249", Buffer);
	}
	if (ticket10[client] > 0)
	{
		Format(Buffer, sizeof(Buffer), "Ticket de 10€ (Quantité: %i)", ticket10[client]);
		AddMenuItem(Item, "t10", Buffer);
	}
	if (ticket50[client] > 0)
	{
		Format(Buffer, sizeof(Buffer), "Ticket de 50€ (Quantité: %i)", ticket50[client]);
		AddMenuItem(Item, "t50", Buffer);
	}
	if (ticket100[client] > 0)
	{
		Format(Buffer, sizeof(Buffer), "Ticket de 100€ (Quantité: %i)", ticket100[client]);
		AddMenuItem(Item, "t100", Buffer);
	}
	if (ticket500[client] > 0)
	{
		Format(Buffer, sizeof(Buffer), "Ticket de 500€ (Quantité: %i)", ticket500[client]);
		AddMenuItem(Item, "t500", Buffer);
	}
	if (kit[client] > 0)
	{
		Format(Buffer, sizeof(Buffer), "Kit de soins (Quantité: %i)", kit[client]);
		AddMenuItem(Item, "kits", Buffer);
	}
	if (grenade[client] > 0)
	{
		Format(Buffer, sizeof(Buffer), "Grenade (Quantité: %i)", grenade[client]);
		AddMenuItem(Item, "he", Buffer);
	}
	if (fumigene[client] > 0)
	{
		Format(Buffer, sizeof(Buffer), "Fumigène (Quantité: %i)", fumigene[client]);
		AddMenuItem(Item, "fumi", Buffer);
	}
	if (flashbang[client] > 0)
	{
		Format(Buffer, sizeof(Buffer), "Molotov (Quantité: %i)", flashbang[client]);
		AddMenuItem(Item, "flash", Buffer);
	}
	if (kevlar[client] > 0)
	{
		Format(Buffer, sizeof(Buffer), "Gilet pare-balle (Quantité: %i)", kevlar[client]);
		AddMenuItem(Item, "kevlar", Buffer);
	}
	if (cartouche[client] > 0)
	{
		Format(Buffer, sizeof(Buffer), "Munitions (Quantité: %i)", cartouche[client]);
		AddMenuItem(Item, "cartouche", Buffer);
	}
	if (kitcrochetage[client] > 0)
	{
		Format(Buffer, sizeof(Buffer), "Kit de crochetage (Quantité: %i)", kitcrochetage[client]);
		AddMenuItem(Item, "kitc", Buffer);
	}
	if (kitexplosif[client] > 0)
	{
		Format(Buffer, sizeof(Buffer), "Kit Explosif (Quantité: %i)", kitexplosif[client]);
		AddMenuItem(Item, "kite", Buffer);
	}
	if (flashball[client] > 0)
	{
		Format(Buffer, sizeof(Buffer), "Flashball Anti-émeute (Quantité: %i)", flashball[client]);
		AddMenuItem(Item, "flashball", Buffer);
	}
	if (imprimerie[client] > 0)
	{
		Format(Buffer, sizeof(Buffer), "Imprimante de faux billets (Quantité: %i)", imprimerie[client]);
		AddMenuItem(Item, "imprimerie", Buffer);
	}
	if (oeil[client] > 0)
	{
		Format(Buffer, sizeof(Buffer), "Oeil bionique (Quantité: %i)", oeil[client]);
		AddMenuItem(Item, "oeil", Buffer);
	}
	if (regenerateur[client] > 0)
	{
		Format(Buffer, sizeof(Buffer), "Regénérateur bionique (Quantité: %i)", regenerateur[client]);
		AddMenuItem(Item, "regen", Buffer);
	}
	if (hamburger[client] > 0)
	{
		Format(Buffer, sizeof(Buffer), "Hamburger (Quantité: %i)", hamburger[client]);
		AddMenuItem(Item, "hamburger", Buffer);
	}
	if (frites[client] > 0)
	{
		Format(Buffer, sizeof(Buffer), "Frites (Quantité: %i)", frites[client]);
		AddMenuItem(Item, "frites", Buffer);
	}
	if (sunday[client] > 0)
	{
		Format(Buffer, sizeof(Buffer), "Sunday (Quantité: %i)", sunday[client]);
		AddMenuItem(Item, "sunday", Buffer);
	}
	if (bigmac[client] > 0)
	{
		Format(Buffer, sizeof(Buffer), "Big Mac (Quantité: %i)", bigmac[client]);
		AddMenuItem(Item, "bigmac", Buffer);
	}
	if (macflurry[client] > 0)
	{
		Format(Buffer, sizeof(Buffer), "Mac Flurry (Quantité: %i)", macflurry[client]);
		AddMenuItem(Item, "macflurry", Buffer);
	}
	if (distributeur[client] > 0)
	{
		Format(Buffer, sizeof(Buffer), "Distributeur (Quantité: %i)", distributeur[client]);
		AddMenuItem(Item, "distributeur", Buffer);
	}
	if (sofa[client] > 0)
	{
		Format(Buffer, sizeof(Buffer), "Sofa (Quantité: %i)", sofa[client]);
		AddMenuItem(Item, "sofa", Buffer);
	}
	if (bibliotheque[client] > 0)
	{
		Format(Buffer, sizeof(Buffer), "Bibliothèque (Quantité: %i)", bibliotheque[client]);
		AddMenuItem(Item, "bibliotheque", Buffer);
	}
	if (dryer[client] > 0)
	{
		Format(Buffer, sizeof(Buffer), "Dryer (Quantité: %i)", dryer[client]);
		AddMenuItem(Item, "dryer", Buffer);
	}
	DisplayMenu(Item, client, MENU_TIME_FOREVER);
}

public Menu_Item(Handle:Item, MenuAction:action, client, param2)
{
	if (action == MenuAction_Select)
	{
		if (!IsInJail1(client) && !IsInJail2(client) && !IsInJail3(client) && !IsInCour(client) && !IsInTribunal(client))
		{
			new String:info[32];
			GetMenuItem(Item, param2, info, sizeof(info));
			
			new String:Models[255];
			
			new timestampp;
			timestampp = GetTime();
			
			if (StrEqual(info, "lsd"))
			{
				CPrintToChat(client, "%s {blue}Vous utilisez{green} LSD.", LOGO);
				
				lsd[client] = lsd[client] - 1;
				
				ItemLsd(client);
			}
			else if (StrEqual(info, "hero"))
			{
				CPrintToChat(client, "%s {blue}Vous utilisez{green} Héroïne.", LOGO);
				
				heroine[client] = heroine[client] - 1;
				
				ItemHeroine(client);
			}
			else if (StrEqual(info, "exta"))
			{
				CPrintToChat(client, "%s {blue}Vous utilisez{green} Extasy.", LOGO);
				
				exta[client] = exta[client] - 1;
				
				ItemExta(client);
			}
			else if (StrEqual(info, "cocaine"))
			{
				CPrintToChat(client, "%s {blue}Vous utilisez{green} Cocaïne.", LOGO);
				
				cocaine[client] = cocaine[client] - 1;
				
				ItemCocaine(client);
			}
			else if (StrEqual(info, "weed"))
			{
				CPrintToChat(client, "%s {blue}Vous utilisez{green} Weed.", LOGO);
				
				weed[client] = weed[client] - 1;
				
				ItemWeed(client);
			}
			else if (StrEqual(info, "cut"))
			{
				CPrintToChat(client, "%s {blue}Vous utilisez{green}  Entrainement au couteau.", LOGO);
				
				entrainement[client] = entrainement[client] - 1;
				
				levelcut[client] = 100;
			}
			else if (StrEqual(info, "glock"))
			{
				CPrintToChat(client, "%s {blue}Vous utilisez un {green}  Glock.", LOGO);
				
				glock[client] = glock[client] - 1;
				
				new arme;
				arme = CreateEntityByName("weapon_glock");
				DispatchSpawn(arme);
				EquipPlayerWeapon(client, arme);
				SetEntData(arme, g_iiClip1, 0);	
			}
			else if (StrEqual(info, "usp"))
			{
				CPrintToChat(client, "%s {blue}Vous utilisez un {green} Usp.", LOGO);
				
				usp[client] = usp[client] - 1;
				
				new arme;
				arme = CreateEntityByName("weapon_usp");
				DispatchSpawn(arme);
				EquipPlayerWeapon(client, arme);
				SetEntData(arme, g_iiClip1, 0);	
			}
			else if (StrEqual(info, "p228"))
			{
				CPrintToChat(client, "%s {blue}Vous utilisez un {green} P228.", LOGO);
				
				p228[client] = p228[client] - 1;
				
				new arme;
				arme = CreateEntityByName("weapon_p228");
				DispatchSpawn(arme);
				EquipPlayerWeapon(client, arme);
				SetEntData(arme, g_iiClip1, 0);	
			}
			else if (StrEqual(info, "deagle"))
			{
				CPrintToChat(client, "%s {blue}Vous utilisez un {green} Deagle.", LOGO);
				
				deagle[client] = deagle[client] - 1;

				new arme;
				arme = CreateEntityByName("weapon_deagle");
				DispatchSpawn(arme);
				EquipPlayerWeapon(client, arme);
				SetEntData(arme, g_iiClip1, 0);	
			}
			else if (StrEqual(info, "elites"))
			{
				CPrintToChat(client, "%s {blue}Vous utilisez des{green} Elites.", LOGO);
				
				elites[client] = elites[client] - 1;
				
				new arme;
				arme = CreateEntityByName("weapon_elite");
				DispatchSpawn(arme);
				EquipPlayerWeapon(client, arme);
				SetEntData(arme, g_iiClip1, 0);	
			}
			else if (StrEqual(info, "fiveseven"))
			{
				CPrintToChat(client, "%s {blue}Vous utilisez un{green} Five Seven.", LOGO);
				
				fiveseven[client] = fiveseven[client] - 1;
				
				new arme;
				arme = CreateEntityByName("weapon_fiveseven");
				DispatchSpawn(arme);
				EquipPlayerWeapon(client, arme);
				SetEntData(arme, g_iiClip1, 0);	
			}
			else if (StrEqual(info, "m3"))
			{
				CPrintToChat(client, "%s {blue}Vous utilisez{green}  M3.", LOGO);
				
				m3[client] = m3[client] - 1;			
				
				new arme = GivePlayerItem(client, "weapon_m3");
				SetEntData(arme, FindSendPropInfo("CBaseCombatWeapon", "m_iClip1"), 0);
			}
			else if (StrEqual(info, "xm1014"))
			{
				CPrintToChat(client, "%s {blue}Vous utilisez{green}  Xm1014.", LOGO);
				
				xm1014[client] = xm1014[client] - 1;
				
				new arme = GivePlayerItem(client, "weapon_xm1014");
				SetEntData(arme, FindSendPropInfo("CBaseCombatWeapon", "m_iClip1"), 0);
			}
			else if (StrEqual(info, "galil"))
			{
				CPrintToChat(client, "%s {blue}Vous utilisez{green}  Galil.", LOGO);
				
				galil[client] = galil[client] - 1;
				
				new arme = GivePlayerItem(client, "weapon_galil");
				SetEntData(arme, FindSendPropInfo("CBaseCombatWeapon", "m_iClip1"), 0);
			}
			else if (StrEqual(info, "ak47"))
			{
				CPrintToChat(client, "%s {blue}Vous utilisez une{green} Ak47.", LOGO);
				
				ak47[client] = ak47[client] - 1;
				
				new arme;
				arme = CreateEntityByName("weapon_ak47");
				DispatchSpawn(arme);
				EquipPlayerWeapon(client, arme);
				SetEntData(arme, g_iiClip1, 0);	
			}
			else if (StrEqual(info, "scout"))
			{
				CPrintToChat(client, "%s {blue}Vous utilisez{green}  Scout.", LOGO);
				
				scout[client] = scout[client] - 1;
				
				new arme = GivePlayerItem(client, "weapon_scout");
				SetEntData(arme, FindSendPropInfo("CBaseCombatWeapon", "m_iClip1"), 0);
			}
			else if (StrEqual(info, "sg552"))
			{
				CPrintToChat(client, "%s {blue}Vous utilisez{green}  Sg552.", LOGO);
				
				sg552[client] = sg552[client] - 1;
				
				new arme = GivePlayerItem(client, "weapon_sg552");
				SetEntData(arme, FindSendPropInfo("CBaseCombatWeapon", "m_iClip1"), 0);
			}
			else if (StrEqual(info, "awp"))
			{
				CPrintToChat(client, "%s {blue}Vous utilisez un{green} AWP", LOGO);
				
				awp[client] = awp[client] - 1;
				
				new arme;
				arme = CreateEntityByName("weapon_awp");
				DispatchSpawn(arme);
				EquipPlayerWeapon(client, arme);
				SetEntData(arme, g_iiClip1, 0);				
			}
			else if (StrEqual(info, "g3sg1"))
			{
				CPrintToChat(client, "%s {blue}Vous utilisez{green}  G3sg1.", LOGO);
				
				g3sg1[client] = g3sg1[client] - 1;
				
				new arme = GivePlayerItem(client, "weapon_g3sg1");
				SetEntData(arme, FindSendPropInfo("CBaseCombatWeapon", "m_iClip1"), 0);
			}
			else if (StrEqual(info, "famas"))
			{
				CPrintToChat(client, "%s {blue}Vous utilisez{green}  Famas.", LOGO);
				
				famas[client] = famas[client] - 1;
				
				new arme = GivePlayerItem(client, "weapon_famas");
				SetEntData(arme, FindSendPropInfo("CBaseCombatWeapon", "m_iClip1"), 0);
			}
			else if (StrEqual(info, "m4a1"))
			{
				CPrintToChat(client, "%s {blue}Vous utilisez une{green} M4A1.", LOGO);
				
				m4a1[client] = m4a1[client] - 1;
				
				new arme;
				arme = CreateEntityByName("weapon_m4a1");
				DispatchSpawn(arme);
				EquipPlayerWeapon(client, arme);
				SetEntData(arme, g_iiClip1, 0);	
			}
			else if (StrEqual(info, "aug"))
			{
				CPrintToChat(client, "%s {blue}Vous utilisez{green}  Aug.", LOGO);
				
				aug[client] = aug[client] - 1;
				
				new arme = GivePlayerItem(client, "weapon_aug");
				SetEntData(arme, FindSendPropInfo("CBaseCombatWeapon", "m_iClip1"), 0);
			}
			else if (StrEqual(info, "sg550"))
			{
				CPrintToChat(client, "%s {blue}Vous utilisez{green}  Sg550.", LOGO);
				
				sg550[client] = sg550[client] - 1;
				
				new arme = GivePlayerItem(client, "weapon_sg550");
				SetEntData(arme, FindSendPropInfo("CBaseCombatWeapon", "m_iClip1"), 0);
			}
			else if (StrEqual(info, "mac10"))
			{
				CPrintToChat(client, "%s {blue}Vous utilisez{green}  Mac10.", LOGO);
				
				mac10[client] = mac10[client] - 1;
				
				new arme = GivePlayerItem(client, "weapon_mac10");
				SetEntData(arme, FindSendPropInfo("CBaseCombatWeapon", "m_iClip1"), 0);
			}
			else if (StrEqual(info, "tmp"))
			{
				CPrintToChat(client, "%s {blue}Vous utilisez{green}  Tmp.", LOGO);
				
				tmp[client] = tmp[client] - 1;
				
				new arme = GivePlayerItem(client, "weapon_tmp");
				SetEntData(arme, FindSendPropInfo("CBaseCombatWeapon", "m_iClip1"), 0);
			}
			else if (StrEqual(info, "mp5"))
			{
				CPrintToChat(client, "%s {blue}Vous utilisez{green}  Mp5.", LOGO);
				
				mp5[client] = mp5[client] - 1;
				
				new arme = GivePlayerItem(client, "weapon_mp5navy");
				SetEntData(arme, FindSendPropInfo("CBaseCombatWeapon", "m_iClip1"), 0);
			}
			else if (StrEqual(info, "ump45"))
			{
				CPrintToChat(client, "%s {blue}Vous utilisez{green}  Ump45.", LOGO);
				
				ump45[client] = ump45[client] - 1;
				
				new arme = GivePlayerItem(client, "weapon_ump45");
				SetEntData(arme, FindSendPropInfo("CBaseCombatWeapon", "m_iClip1"), 0);
			}
			else if (StrEqual(info, "p90"))
			{
				CPrintToChat(client, "%s {blue}Vous utilisez un{green} P90.", LOGO);
				
				p90[client] = p90[client] - 1;
				
				new arme;
				arme = CreateEntityByName("weapon_p90");
				DispatchSpawn(arme);
				EquipPlayerWeapon(client, arme);
				SetEntData(arme, g_iiClip1, 0);	
			}
			else if (StrEqual(info, "m249"))
			{
				CPrintToChat(client, "%s {blue}Vous utilisez{green}  M249.", LOGO);
				
				m249[client] = m249[client] - 1;
				
				new arme = GivePlayerItem(client, "weapon_m249");
				SetEntData(arme, FindSendPropInfo("CBaseCombatWeapon", "m_iClip1"), 0);
			}
			else if (StrEqual(info, "t10"))
			{
				if ((timestampp - g_ticket[client]) < 10)
				{
					CPrintToChat(client, "%s Vous devez attendre %i secondes avant de pouvoir gratter un ticket.", LOGO, (10 - (timestampp - g_ticket[client])));
				}
				else
				{
					CPrintToChat(client, "%s {blue}Vous utilisez{green}  Ticket de 10€.", LOGO);
					
					ticket10[client] = ticket10[client] - 1;
					
					new random = GetRandomInt(0, 100);
					
					if (random == 25)
					{
						new old = money[client];
						money[client] = old + 1000;
						
						CPrintToChat(client, "%s Félicitation ! Vous avez remporter le jackpot de 1000€", LOGO);
					}
					else
					{
						CPrintToChat(client, "%s Vous avez perdu, vous aurez surement plus de chance une autre fois !", LOGO);
					}
				}
			}
			else if (StrEqual(info, "t50"))
			{
				if ((timestampp - g_ticket[client]) < 10)
				{
					CPrintToChat(client, "%s Vous devez attendre %i secondes avant de pouvoir gratter un ticket.", LOGO, (10 - (timestampp - g_ticket[client])));
				}
				else
				{
					CPrintToChat(client, "%s {blue}Vous utilisez{green}  Ticket de 50€.", LOGO);
					
					ticket50[client] = ticket50[client] - 1;
					
					new random = GetRandomInt(0, 100);
					
					if (random == 25)
					{
						new old = money[client];
						money[client] = old + 5000;
						
						CPrintToChat(client, "%s Félicitation ! Vous avez remporter le jackpot de 5000€", LOGO);
					}
					else
					{
						CPrintToChat(client, "%s Vous avez perdu, vous aurez surement plus de chance une autre fois !", LOGO);
					}
				}
			}
			else if (StrEqual(info, "t100"))
			{
				if ((timestampp - g_ticket[client]) < 10)
				{
					CPrintToChat(client, "%s Vous devez attendre %i secondes avant de pouvoir gratter un ticket.", LOGO, (10 - (timestampp - g_ticket[client])));
				}
				else
				{
					CPrintToChat(client, "%s {blue}Vous utilisez{green}  Ticket de 100€.", LOGO);
					
					ticket100[client] = ticket100[client] - 1;
					
					new random = GetRandomInt(0, 100);
					
					if (random == 25)
					{
						new old = money[client];
						money[client] = old + 10000;
						
						CPrintToChat(client, "%s Félicitation ! Vous avez remporter le jackpot de 10000€", LOGO);
					}
					else
					{
						CPrintToChat(client, "%s Vous avez perdu, vous aurez surement plus de chance une autre fois !", LOGO);
					}
				}
			}
			else if (StrEqual(info, "t500"))
			{
				if ((timestampp - g_ticket[client]) < 10)
				{
					CPrintToChat(client, "%s Vous devez attendre %i secondes avant de pouvoir gratter un ticket.", LOGO, (10 - (timestampp - g_ticket[client])));
				}
				else
				{
					CPrintToChat(client, "%s {blue}Vous utilisez{green}  Ticket de 500€.", LOGO);
					
					ticket500[client] = ticket500[client] - 1;
					
					new random = GetRandomInt(0, 500);
					
					if (random == 25)
					{
						new old = money[client];
						money[client] = old + 50000;
						
						CPrintToChat(client, "%s Félicitation ! Vous avez remporter le jackpot de 50000€", LOGO);
					}
					else
					{
						CPrintToChat(client, "%s Vous avez perdu, vous aurez surement plus de chance une autre fois !", LOGO);
					}
				}
			}
			else if (StrEqual(info, "kits"))
			{
				CPrintToChat(client, "%s {blue}Vous utilisez{green}  Kit de soins.", LOGO);			
				ItemKitSoin(client);
			}
			else if (StrEqual(info, "he"))
			{
				CPrintToChat(client, "%s {blue}Vous utilisez{green} Grenade.", LOGO);
				
				grenade[client] = grenade[client] - 1;
				
				GivePlayerItem(client, "weapon_hegrenade");
			}
			else if (StrEqual(info, "fumi"))
			{
				CPrintToChat(client, "%s {blue}Vous utilisez{green} Fumigène.", LOGO);
				
				fumigene[client] = fumigene[client] - 1;
				
				GivePlayerItem(client, "weapon_smokegrenade");
			}
			else if (StrEqual(info, "flash"))
			{
				CPrintToChat(client, "%s {blue}Vous utilisez{green} Flashbang.", LOGO);
				
				flashbang[client] = flashbang[client] - 1;
				
				GivePlayerItem(client, "weapon_flashbang");
			}
			else if (StrEqual(info, "kevlar"))
			{
				CPrintToChat(client, "%s {blue}Vous utilisez{green}  Kevlar.", LOGO);
				
				kevlar[client] = kevlar[client] - 1;
				
				SetEntProp(client, Prop_Data, "m_ArmorValue", 100);
			}
			else if (StrEqual(info, "cartouche"))
			{				
				decl String:WeaponName[32];
				Client_GetActiveWeaponName(client, WeaponName, sizeof(WeaponName));
				
				new weapon = Client_GetActiveWeapon(client);
					
				if (weapon != -1)
				{
					if (!StrEqual(WeaponName, "weapon_knife"))
					{
						RemoveEdict(weapon);
						GivePlayerItem(client, WeaponName);
						CPrintToChat(client, "%s {blue}Vous utilisez des{green} Munitions", LOGO);
						cartouche[client] = cartouche[client] - 1;
					}
					else
					{
						CPrintToChat(client, "%s {red}Opération Impossible sur cette arme !", LOGO);
					}
				}
			}
			else if (StrEqual(info, "kitc"))
			{
				if (rankid[client] == 2 || rankid[client] == 17)
				{	
					if (!g_crochetageon[client])
					{
						new String:Door[255];
			
						Entiter[client] = GetClientAimTarget(client, false);
						
						if (Entiter[client] != -1)
						{
							GetEdictClassname(Entiter[client], Door, sizeof(Door));
							
							if (StrEqual(Door, "func_door_rotating") || StrEqual(Door, "prop_door_rotating") || StrEqual(Door, "func_door") || StrEqual(Door, "prop_vehicle_driveable"))
							{
								if (Entity_IsLocked(Entiter[client]))
								{
									new timestamp;
									timestamp = GetTime();
						
									if ((timestamp - g_crochetage[client]) < 20)
									{
										CPrintToChat(client, "%s {red}Vous devez attendre %i secondes avant de recommencer", LOGO, (20 - (timestamp - g_crochetage[client])) );
									}
									else
									{
										new Float:entorigin[3], Float:clientent[3];
										GetEntPropVector(Entiter[client], Prop_Send, "m_vecOrigin", entorigin);
										GetEntPropVector(client, Prop_Send, "m_vecOrigin", clientent);
										new Float:distance = GetVectorDistance(entorigin, clientent);
										new Float:vec[3];
										GetClientAbsOrigin(client, vec);
										vec[2] += 10;

										if (distance > 80)
										{
											CPrintToChat(client, "%s {red}Veuillez vous raprocher de la porte !", LOGO);
										}
										else
										{
											g_crochetage[client] = GetTime();
											
											// DIFFUSE BARRE
											SetEntPropFloat(client, Prop_Send, "m_flProgressBarStartTime", GetGameTime()); 
											SetEntProp(client, Prop_Send, "m_iProgressBarDuration", 8);
											
											// TIMER DIFFUSE
											g_croche[client] = CreateTimer(8.0, TimerCrochetage, client, TIMER_REPEAT);
											
											// FREEZE
											SetEntityRenderColor(client, 255, 0, 0, 0);
											SetEntityMoveType(client, MOVETYPE_NONE);
											
											// BALISE
											TE_SetupBeamRingPoint(vec, 5.0, 800.0, g_modelLaser, g_modelHalo, 0, 15, 0.6, 15.0, 0.0, redColor, 10, 0);
											TE_SendToAll();
											
											
											PrintHintText(client, "Crochetage en cours ... ");
											CPrintToChat(client, "%s {red}Crochetage en cours ...", LOGO);
											
											
											kitcrochetage[client] = kitcrochetage[client] - 1;
											
											g_crochetageon[client] = true;
											
											countdoor[client] += 1;
											
										}
									}
								}
								else
								{
									CPrintToChat(client, "%s La porte est déjà ouverte.", LOGO);
								}
							}
							else
							{
								CPrintToChat(client, "%s {red}Veuillez viser une porte.", LOGO);
							}
						}
						else
						{
							CPrintToChat(client, "%s {red}Veuillez viser une porte.", LOGO);
						}
					}
					else
					{
						CPrintToChat(client, "%s Vous êtes déjà en train de crocheté.", LOGO);
					}
				}
				else
				{
					CPrintToChat(client, "%s Vous devez être mafieux pour utilisé cet objet.", LOGO);
				}
			}
			else if (StrEqual(info, "kite"))
			{
				if (rankid[client] == 2 || rankid[client] == 17)
				{	
					if (!g_crochetageon[client])
					{
						new String:Door[255];
			
						Entiter[client] = GetClientAimTarget(client, false);
						
						if (Entiter[client] != -1)
						{
							GetEdictClassname(Entiter[client], Door, sizeof(Door));
							
							if (StrEqual(Door, "func_door_rotating") || StrEqual(Door, "prop_door_rotating") || StrEqual(Door, "func_door"))
							{
								if (Entity_IsLocked(Entiter[client]))
								{
									new timestamp;
									timestamp = GetTime();
						
									if ((timestamp - g_crochetage[client]) < 20)
									{
										CPrintToChat(client, "%s {red}Vous devez attendre %i secondes avant de recommencer", LOGO, (20 - (timestamp - g_crochetage[client])) );
									}
									else
									{
										new Float:entorigin[3], Float:clientent[3];
										GetEntPropVector(Entiter[client], Prop_Send, "m_vecOrigin", entorigin);
										GetEntPropVector(client, Prop_Send, "m_vecOrigin", clientent);
										new Float:distance = GetVectorDistance(entorigin, clientent);
										new Float:vec[3];
										GetClientAbsOrigin(client, vec);
										vec[2] += 10;

										if (distance > 80)
										{
											CPrintToChat(client, "%s {red}Veuillez vous raprocher de la porte !", LOGO);
										}
										else
										{
											g_crochetage[client] = GetTime();
											
											// DIFFUSE BARRE
											SetEntPropFloat(client, Prop_Send, "m_flProgressBarStartTime", GetGameTime()); 
											SetEntProp(client, Prop_Send, "m_iProgressBarDuration", 8);
											
											// TIMER DIFFUSE
											g_croche[client] = CreateTimer(8.0, TimerCrochetageExplosif, client, TIMER_REPEAT);
											
											// FREEZE
											SetEntityRenderColor(client, 255, 0, 0, 0);
											SetEntityMoveType(client, MOVETYPE_NONE);
											
											// BALISE
											TE_SetupBeamRingPoint(vec, 5.0, 800.0, g_modelLaser, g_modelHalo, 0, 15, 0.6, 15.0, 0.0, redColor, 10, 0);
											TE_SendToAll();
											
											
											PrintHintText(client, "Crochetage en cours ... ");
											CPrintToChat(client, "%s {red}Crochetage en cours ...", LOGO);
											
											
											kitexplosif[client] = kitexplosif[client] - 1;
											
											g_crochetageon[client] = true;
											
											countdoor[client] += 1;
										}
									}
								}
								else
								{
									CPrintToChat(client, "%s {red}La porte est déjà ouverte.", LOGO);
								}
							}
							else
							{
								CPrintToChat(client, "%s {red}Veuillez viser une porte.", LOGO);
							}
						}
						else
						{
							CPrintToChat(client, "%s {red}Veuillez viser une porte.", LOGO);
						}
					}
					else
					{
						CPrintToChat(client, "%s {red}Vous êtes déjà en train de crocheter", LOGO);
					}
				}
				else
				{
					CPrintToChat(client, "%s {red}Outil réservé aux mafieux", LOGO);
				}
			}
			else if (StrEqual(info, "flashball"))
			{
				CPrintToChat(client, "%s {blue}Vous utiliez un{green} Molotov", LOGO);
				
				flashball[client] = flashball[client] - 1;
				
				flashb[client] = true;
			}
			else if (StrEqual(info, "oeil"))
			{
				CPrintToChat(client, "%s {blue}Vous utilisez{green} Oeil bionique.", LOGO);
				
				oeil[client] = oeil[client] - 1;
				
				oeill[client] = true;
			}
			else if (StrEqual(info, "regen"))
			{
				CPrintToChat(client, "%s {blue}Vous utilisez{green} Regénérateur bionique.", LOGO);
				
				regenerateur[client] = regenerateur[client] - 1;
				
				regenn[client] = true;
			}
			else if (StrEqual(info, "imprimerie"))
			{
				if (activate[client] < 3)
				{
					CPrintToChat(client, "%s {blue}Vous utilisez{green} Imprimante de faux billets.", LOGO);
				
					imprimerie[client] = imprimerie[client] - 1;
				
					SpawnImprim(client);
				}
				else
				{
					CPrintToChat(client, "%s {red}Vous avez déjà spawn le maximum d'imprimantes (%i)", LOGO, activate[client]);
				}
			}
			else if (StrEqual(info, "hamburger"))
			{
				CPrintToChat(client, "%s {blue}Vous utilisez{green}  Hamburger.", LOGO);
				
				hamburger[client] = hamburger[client] - 1;
				
				SetEntityHealth(client, 250);
				ModifySpeed(client, 0.8);
			}
			else if (StrEqual(info, "frites"))
			{
				CPrintToChat(client, "%s Vous avez utiliser des Frites.", LOGO);
				
				frites[client] = frites[client] - 1;
				
				SetEntityHealth(client, 400);
				ModifySpeed(client, 1.5);
				
				TE_SetupBeamFollow(client, g_BeamSpriteFollow, 0, 10.0, 5.0, 50.0, 3, TAZER_COLORBLUE);
		
				TE_SendToAll();
		
				CreateTimer(60.0, DrugReset, client);
			}
			else if (StrEqual(info, "sunday"))
			{
				CPrintToChat(client, "%s {blue}Vous utilisez{green}  Sunday.", LOGO);
				
				sunday[client] = sunday[client] - 1;
				
				SetEntityHealth(client, 300);
				ModifySpeed(client, 1.4);
				
				TE_SetupBeamFollow(client, g_BeamSpriteFollow, 0, 10.0, 5.0, 50.0, 3, {255,25,212,255});
		
				TE_SendToAll();
			}
			else if (StrEqual(info, "bigmac"))
			{
				CPrintToChat(client, "%s {blue}Vous utilisez{green}  Big Mac.", LOGO);
				
				bigmac[client] = bigmac[client] - 1;
				
				SetEntityHealth(client, 200);
				ModifySpeed(client, 1.3);
				
				TE_SetupBeamFollow(client, g_BeamSpriteFollow, 0, 10.0, 5.0, 50.0, 3, {7,11,255,255});
		
				TE_SendToAll();
			}
			else if (StrEqual(info, "macflurry"))
			{
				CPrintToChat(client, "%s {blue}Vous utilisez{green}  Mac Flurry.", LOGO);
				
				macflurry[client] = macflurry[client] - 1;
				
				SetEntityHealth(client, 150);
				ModifySpeed(client, 1.2);
				
				TE_SetupBeamFollow(client, g_BeamSpriteFollow, 0, 10.0, 5.0, 50.0, 3, {135,255,253,255});
		
				TE_SendToAll();
			}
			else if (StrEqual(info, "distributeur"))
			{
				CPrintToChat(client, "%s Vous avez spawn un distributeur.", LOGO);
				
				distributeur[client] = distributeur[client] - 1;
				
				Format(Models, sizeof(Models), "models/props/cs_office/vending_machine.mdl");
				
				PropSpawn(client, Models);
			}
			else if (StrEqual(info, "sofa"))
			{
				CPrintToChat(client, "%s Vous avez spawn un sofa.", LOGO);
				
				sofa[client] = sofa[client] - 1;
				
				Format(Models, sizeof(Models), "models/props/cs_office/sofa.mdl");
				
				PropSpawn(client, Models);
			}
			else if (StrEqual(info, "bibliotheque"))
			{
				CPrintToChat(client, "%s Vous avez spawn une bibliothèque.", LOGO);
				
				bibliotheque[client] = bibliotheque[client] - 1;
				
				Format(Models, sizeof(Models), "models/props/cs_office/bookshelf1.mdl");
				
				PropSpawn(client, Models);
			}
			else if (StrEqual(info, "dryer"))
			{
				CPrintToChat(client, "%s Vous avez spawn une dryer.", LOGO);
				
				dryer[client] = dryer[client] - 1;
				
				Format(Models, sizeof(Models), "models/props/cs_assault/dryer_box.mdl");
				
				PropSpawn(client, Models);
			}
			BuildItemMenu(client);
		}
		else
		{
			CPrintToChat(client, "%s {red}Impossible dans cette Zone de la Map !", LOGO);
		}
	}
	else if (action == MenuAction_End)
	{
		CloseHandle(Item);
	}
}

public ItemKitSoin(client)
{
	if (IsClientInGame(client))
	{
		new Ent = GetClientAimTarget(client, true);
		
		if (Ent != -1)
		{
			if (rankid[Ent] == 1)
			{
				SetEntityHealth(Ent, 500);
			}
			else
			{
				SetEntityHealth(Ent, 100);
			}
			kit[client] = kit[client] - 1;
			
			CPrintToChat(client, "%s {blue}Vous avez soigner les blessures de {green}%N{blue} avec un Kit de Soins.", LOGO, Ent);
			
			CPrintToChat(Ent, "%s {green}%N {blue}vous soigne de vos blessures avec un Kit de Soins.", LOGO, client);
		}
		else
		{
			CPrintToChat(client, "%s {red}Vous devez viser un joueur.", LOGO);
		}
	}
}

public ItemLsd(client)
{
	if (IsClientInGame(client))
	{
		if (!oeill[client])
		{
			ClientCommand(client, "r_screenoverlay models/effects/portalfunnel_sheet.vmt");
		}
		
		SetEntityGravity(client, 0.8);
		
		ModifySpeed(client, 1.5);
		
		TE_SetupBeamFollow(client, g_BeamSpriteFollow, 0, 10.0, 5.0, 50.0, 3, {255,255,0,255});
		
		TE_SendToAll();
		
		CreateTimer(60.0, DrugReset, client);
	}
}

public ItemHeroine(client)
{
	if (IsClientInGame(client))
	{
		if (!oeill[client])
		{
			ClientCommand(client, "r_screenoverlay effects/com_shield002a.vmt");
		}
		
		SetEntityHealth(client, 150);
		
		SetEntityGravity(client, 0.4);
				
		CreateTimer(60.0, DrugReset, client);
	}
}

public ItemExta(client)
{
	if (IsClientInGame(client))
	{
		ModifySpeed(client, 1.3);
		
		if (!oeill[client])
		{
			ClientCommand(client, "r_screenoverlay effects/tp_eyefx/tp_eyefx.vmt");
		}		
		CreateTimer(60.0, DrugReset, client);
	}
}

public ItemCocaine(client)
{
	if (IsClientInGame(client))
	{
		ModifySpeed(client, 1.6);
		
		if (!oeill[client])
		{
			ClientCommand(client, "r_screenoverlay debug/yuv.vmt");
		}
		
		CreateTimer(90.0, DrugReset, client);
	}
}

public ItemWeed(client)
{
	if (IsClientInGame(client))
	{
		ModifySpeed(client, 1.4);
		
		SetEntityHealth(client, 150);
		
		SetEntityGravity(client, 0.8);
		
		if (!oeill[client])
		{
			ClientCommand(client, "r_screenoverlay models/props_combine/portalball001_sheet.vmt");
		}
		
		CreateTimer(90.0, DrugReset, client);
	}
}

ModifySpeed(client, Float:speed)
{
	if (IsClientInGame(client))
	{
		SetEntPropFloat(client, Prop_Data, "m_flLaggedMovementValue", speed);
	}
}

public Action:DrugReset(Handle:timer, any:client)
{
	if (IsClientInGame(client))
	{
		ModifySpeed(client, 1.0);
		
		SetEntityGravity(client, 1.0);
		
		ClientCommand(client, "r_screenoverlay 0");
	}
}

public Action:TimerCrochetage(Handle:timer, any:client)
{
	if (IsClientInGame(client))
	{
		if (IsPlayerAlive(client))
		{
			new String:Door[255];
	
			if (Entiter[client] != -1)
			{
				GetEdictClassname(Entiter[client], Door, sizeof(Door));
			
				switch (GetRandomInt(1, 4))
				{
					case 1:
					{
						if (StrEqual(Door, "func_door_rotating") || StrEqual(Door, "prop_door_rotating") || StrEqual(Door, "func_door") || StrEqual(Door, "prop_vehicle_driveable"))
						{
							CPrintToChat(client, "%s {red}Porte {green}crochetée", LOGO);
							
							Entity_UnLock(Entiter[client]);
							
							AcceptEntityInput(Entiter[client], "Toggle", client, client);
							
							SetEntityMoveType(client, MOVETYPE_WALK);
							SetEntityRenderColor(client, 255, 255, 255, 255);
					
							g_crochetageon[client] = false;
						}
						else
						{
							CPrintToChat(client, "%s {red}Veuillez viser une porte !", LOGO);
						}
					}
				
					case 2:
					{
						if (StrEqual(Door, "func_door_rotating") || StrEqual(Door, "prop_door_rotating") || StrEqual(Door, "func_door") || StrEqual(Door, "prop_vehicle_driveable"))
						{
							CPrintToChat(client, "%s {red}Tentative Ratée!", LOGO);
							
							SetEntityMoveType(client, MOVETYPE_WALK);
							SetEntityRenderColor(client, 255, 255, 255, 255);
						
							g_crochetageon[client] = false;
						}
					}
					
					case 3:
					{
						if (StrEqual(Door, "func_door_rotating") || StrEqual(Door, "prop_door_rotating") || StrEqual(Door, "func_door") || StrEqual(Door, "prop_vehicle_driveable"))
						{
							CPrintToChat(client, "%s {red}Tentative Ratée", LOGO);
							
							SetEntityMoveType(client, MOVETYPE_WALK);
							SetEntityRenderColor(client, 255, 255, 255, 255);
						
							g_crochetageon[client] = false;
						}
					}
					
					case 4:
					{
						if (StrEqual(Door, "func_door_rotating") || StrEqual(Door, "prop_door_rotating") || StrEqual(Door, "func_door") || StrEqual(Door, "prop_vehicle_driveable"))
						{
							CPrintToChat(client, "%s {red}Porte {green}crochetée", LOGO);
							
							Entity_UnLock(Entiter[client]);
							
							AcceptEntityInput(Entiter[client], "Toggle", client, client);
							
							SetEntityMoveType(client, MOVETYPE_WALK);
							SetEntityRenderColor(client, 255, 255, 255, 255);
					
							g_crochetageon[client] = false;
						}
						else
						{
							CPrintToChat(client, "%s {red}Veuillez viser une porte !", LOGO);
						}
					}
				}
				
				// STOP DIFFUSE BARRE
				SetEntPropFloat(client, Prop_Send, "m_flProgressBarStartTime", GetGameTime()); 
				SetEntProp(client, Prop_Send, "m_iProgressBarDuration", 0);
			
				if (g_croche[client] != INVALID_HANDLE)
				{
					KillTimer(g_croche[client]);
					g_croche[client] = INVALID_HANDLE;
				}
			}
		}
	}
}

public Action:TimerCrochetageExplosif(Handle:timer, any:client)
{
	if (IsClientInGame(client))
	{
		if (IsPlayerAlive(client))
		{
			new String:Door[255];
	
			if (Entiter[client] != -1)
			{
				GetEdictClassname(Entiter[client], Door, sizeof(Door));
			
				if (StrEqual(Door, "func_door_rotating") || StrEqual(Door, "prop_door_rotating") || StrEqual(Door, "func_door") || StrEqual(Door, "prop_vehicle_driveable"))
				{		
					CPrintToChat(client, "%s {green}La porte est désormais dévérouillée", LOGO);
							
					Entity_UnLock(Entiter[client]);
							
					AcceptEntityInput(Entiter[client], "Toggle", client, client);
							
					SetEntityMoveType(client, MOVETYPE_WALK);
					SetEntityRenderColor(client, 255, 255, 255, 255);
					
					g_crochetageon[client] = false;
				}
				else
				{
					CPrintToChat(client, "%s Vous devez viser la porte, réessayez !", LOGO);
				}
			}			
			// STOP DIFFUSE BARRE
			SetEntPropFloat(client, Prop_Send, "m_flProgressBarStartTime", GetGameTime()); 
			SetEntProp(client, Prop_Send, "m_iProgressBarDuration", 0);
			
			if (g_croche[client] != INVALID_HANDLE)
			{
				KillTimer(g_croche[client]);
				g_croche[client] = INVALID_HANDLE;
			}
		}
	}
}

public Action:Command_Noclip(client, args)
{
	if (IsClientInGame(client))
	{
		if (IsPlayerAlive(client))
		{
			new String:SteamID[64];
			GetClientAuthString(client, SteamID, sizeof(SteamID));
		
			if (Chef_SERVEUR(client))
			{
				new MoveType:movetype = GetEntityMoveType(client);
				
				if (movetype != MOVETYPE_NOCLIP)
				{
					SetEntityMoveType(client, MOVETYPE_NOCLIP);
					CPrintToChat(client, "{black}[Leader]{blue} Vous êtes en noclip");	
					
					
					LogToFile(Logfile,"Le joueur %N viens de se mettre le no-clip.", client);
				}
				else
				{
					CPrintToChat(client, "{black}[Leader]{red} Fin du noclip");	
					
					
					SetEntityMoveType(client, MOVETYPE_WALK);
				}
				
				return Plugin_Handled;
			}
		}
	}
	return Plugin_Continue;
}

public Action:Command_Perqui(client, args)
{
	if (IsClientInGame(client))
	{
		if (IsPlayerAlive(client))
		{
			if (rankid[client] == 1)
			{
				CPrintToChatAll("{red}({blue}POLICE{red}) Perquisition de la {blue}Police ! {lightgreen}Veuillez rester calme !");
				CPrintToChatAll("{red}({blue}POLICE{red}) Le chef {green}%N {red}dirige la perquisition !", client);
				PrintCenterTextAll("La police fait une Perquisition ! Veuillez garder votre calme !", client);
				
				LogToFile(Logfile,"Le joueur %N fait une perquisition.", client);

			}
			else
			{
				CPrintToChat(client, "%s {red}Vous n'avez pas accès a cette commande.", LOGO);
			}
			
			return Plugin_Handled;
		}
		else
		{
			CPrintToChat(client, "%s {red} Vous devez être vivant !", LOGO);
		}
	}
	
	return Plugin_Continue;
}

public Action:Command_Engager(client, args)
{
	if (IsClientInGame(client))
	{
		if (jobid[client] == 1 || jobid[client] == 2)
		{
			if (rankid[client] > 1)
			{
				if (IsPlayerAlive(client))
				{
					new Ent = GetClientAimTarget(client, true);
					
					if (Ent != -1)
					{
						if (jobid[Ent] == 0)
						{
							if (rankid[client] == 10)
							{
								jobid[Ent] = 6;
								rankid[Ent] = rankid[client];
							}
							else
							{
								jobid[Ent] = 5;
								rankid[Ent] = rankid[client];
							}
							
							decl String:SteamID[32];
							decl String:buffer[512];
							
							GetClientAuthString(Ent, SteamID, sizeof(SteamID));
							
							countrct[client] += 1;
														
							decl String:error[256];
							new Handle:db_rp = SQL_Connect("roleplay", true, error, sizeof(error));
							Format(buffer, sizeof(buffer), "UPDATE `Roleplay_Players` SET `jobid` = %i, `rankid` = %i WHERE steam_id = '%s'", jobid[Ent], rankid[client], SteamID);
							SQL_FastQuery(db_rp, buffer);
							
							CPrintToChat(client, "%s Vous avez engager %N dans votre entreprise.", LOGO, Ent);
							CPrintToChat(Ent, "%s Vous avez été engager par %N dans son entreprise.", LOGO, client);
							
							LogToFile(Logfile,"Le joueur %N a engager %N dans son entreprise.", client, Ent);
							
							decl String:ClanTagRankName[20];
							GetClanTagName(jobid[Ent], rankid[Ent], ClanTagRankName, sizeof(ClanTagRankName));

							CS_SetClientClanTag(Ent, ClanTagRankName);
							
							InitSalary(Ent);
							
							CloseHandle(db_rp);
						}
						else
						{
							CPrintToChat(client, "%s Ce joueur a déjà un job.", LOGO);
						}
					}
					else
					{
						CPrintToChat(client, "%s Vous devez viser un joueur.", LOGO);
					}
				}
				else
				{
					CPrintToChat(client, "%s {red} Vous devez être vivant !", LOGO);
				}
			}
		}
		else
		{
			CPrintToChat(client, "%s Vous ne pouvez pas utiliser cette commande.", LOGO);
		}
	}
}

public Action:Command_Promote(client, args)
{
	if (IsClientInGame(client))
	{
		if (jobid[client] == 1)
		{
			new Ent = GetClientAimTarget(client, true);
			
			if (Ent != -1)
			{
				if (jobid[Ent] > 2 && jobid[Ent] < 6)
				{
					if (rankid[Ent] == rankid[client])
					{
						jobid[Ent] -= 1;
						
						decl String:RankName2[36];
						GetJobName(jobid[Ent], rankid[Ent], RankName2, sizeof(RankName2));
						
						CPrintToChat(Ent, "%s {aqua}Vous avez été promu au poste de {green}%s {aqua}par{red} %N ", LOGO, RankName2, client);
						CPrintToChat(client, "%s Vous avez promu %N au poste de %s !", LOGO, Ent, RankName2);
						
						LogToFile(Logfile,"Le joueur %N a promu %N au poste de %s", client, Ent, RankName2);
						
						decl String:ClanTagRankName[20];
						GetClanTagName(jobid[Ent], rankid[Ent], ClanTagRankName, sizeof(ClanTagRankName));

						CS_SetClientClanTag(Ent, ClanTagRankName);
						
						InitSalary(Ent);
					}
					else
					{
						CPrintToChat(client, "%s Vous ne pouvez pas promouvoir ce joueur.", LOGO);
					}
				}
				else if (jobid[Ent] == 6 && rankid[Ent] == 10)
				{
					jobid[Ent] -= 1;
			
					decl String:RankName2[36];
					GetJobName(jobid[Ent], rankid[Ent], RankName2, sizeof(RankName2));
					
					CPrintToChat(Ent, "%s {aqua}Vous avez été promu au poste de {green}%s {aqua}par{red} %N", LOGO, RankName2, client);
					CPrintToChat(client, "%s Vous avez promu %N au poste de %s !", LOGO, Ent, RankName2);
					
					LogToFile(Logfile,"Le joueur %N a promu %N au poste de %s", client, Ent, RankName2);
					
					decl String:ClanTagRankName[20];
					GetClanTagName(jobid[Ent], rankid[Ent], ClanTagRankName, sizeof(ClanTagRankName));

					CS_SetClientClanTag(Ent, ClanTagRankName);
					
					InitSalary(Ent);
				}
				else
				{
					CPrintToChat(client, "%s {red}Vous ne pouvez pas promouvoir ce joueur.", LOGO);
				}
			}
			else
			{
				CPrintToChat(client, "%s {red} Veuillez viser un joueur !", LOGO);
			}
		}
		else
		{
			CPrintToChat(client, "%s {red}Vous ne pouvez pas utiliser cette commande.", LOGO);
		}
	}
	
	return Plugin_Continue;
}

public Action:Command_Demote(client, args)
{
	if (IsClientInGame(client))
	{
		if (jobid[client] == 1)
		{
			new Ent = GetClientAimTarget(client, true);
			
			if (Ent != -1)
			{
				if (jobid[Ent] > 1 && jobid[Ent] < 5)
				{
					if (rankid[Ent] == rankid[client])
					{
						jobid[Ent] += 1;
						
						decl String:RankName2[36];
						GetJobName(jobid[Ent], rankid[Ent], RankName2, sizeof(RankName2));
						
						CPrintToChat(Ent, "%s %s {red}Vous avez été retrogradé au poste de {green}%s {red}par{green} %N ", LOGO, RankName2, client);
						CPrintToChat(client, "%s Vous avez rétrograder %N au poste de %s !", LOGO, Ent, RankName2);
						
						LogToFile(Logfile,"Le joueur %N a depromote %N.", client, Ent);
						
						decl String:ClanTagRankName[20];
						GetClanTagName(jobid[Ent], rankid[Ent], ClanTagRankName, sizeof(ClanTagRankName));

						CS_SetClientClanTag(Ent, ClanTagRankName);
						
						InitSalary(Ent);
					}
					else
					{
						CPrintToChat(client, "%s {red}Vous ne pouvez pas rétrograder ce joueur.", LOGO);
					}
				}
				else if (jobid[Ent] == 6 && rankid[Ent] == 10)
				{
					CPrintToChat(client, "%s {red}Vous ne pouvez pas rétrograder ce joueur.", LOGO);
				}
				else
				{
					CPrintToChat(client, "%s {red}Vous ne pouvez pas rétrograder ce joueur.", LOGO);
				}
			}
			else
			{
				CPrintToChat(client, "%s {red} Veuillez viser un joueur !", LOGO);
			}
		}
		else
		{
			CPrintToChat(client, "%s {red}Vous n'avez pas accès à cette commande.", LOGO);
		}
	}
	
	return Plugin_Continue;
}

public Action:Command_Virer(client, Args)
{
	if (jobid[client] == 1 || jobid[client] == 2 && rankid[client] > 1)
	{
		g_VirerMenu = BuildVirerMenu(client);
		DisplayMenu(g_VirerMenu, client, MENU_TIME_FOREVER);
	}
	return Plugin_Continue;
}

Handle:BuildVirerMenu(client)
{
	decl String:query[256];
	
	decl String:error[256];
	new Handle:db_rp = SQL_Connect("roleplay", true, error, sizeof(error));
	Format(query, sizeof(query), "SELECT steam_id, pseudo, lastontime FROM `Roleplay_Players` WHERE `rankid` =  %i;", rankid[client]);
	new Handle:job_list = SQL_Query(db_rp, query);
	
	new Handle:virer = CreateMenu(Menu_Virer);
	SetMenuTitle(virer, "Sélectionnez un joueur :");
	
	if (job_list)
	{
		while (SQL_FetchRow(job_list))
		{
			decl String:SteamID[64];
			decl String:name[128];
			decl String:Namee[128];
			
			SQL_FetchString(job_list, 0, SteamID, sizeof(SteamID));
			SQL_FetchString(job_list, 1, Namee, sizeof(Namee));
			
			new fitch = SQL_FetchInt(job_list, 2);
			
			if ((GetTime() - 259200) >= fitch)
			{
				Format(name, sizeof(name), "%s(%s) - Inactif", Namee, SteamID);
			}
			else
			{
				Format(name, sizeof(name), "%s(%s) - Actif", Namee, SteamID);
			}
			
			decl String:steamid[64];
			GetClientAuthString(client, steamid, sizeof(steamid));
			
			if (!StrEqual(steamid, SteamID))
			{
				if (jobid[client] == 1)
				{
					AddMenuItem(virer, SteamID, name);
				}
			}
		}
	}
	
	CloseHandle(job_list);
	CloseHandle(db_rp);
	
	return virer;
}

public Menu_Virer(Handle:virer, MenuAction:action, client, param2)
{
	if (action == MenuAction_Select)
	{
		decl String:info[32];
		decl String:query[256];
		
		GetMenuItem(virer, param2, info, sizeof(info));
		
		if (IsClientInGame(client))
		{
			decl String:error[256];
			new Handle:db_rp = SQL_Connect("roleplay", true, error, sizeof(error));
			Format(query, sizeof(query), "UPDATE `Roleplay_Players` SET `jobid` = 0, `rankid` = 0 WHERE `steam_id` = '%s';", info);
			SQL_FastQuery(db_rp, query);
			
			new mdr = Client_FindBySteamId(info);
			
			if (mdr != -1)
			{
				if (GetClientTeam(mdr) == 3)
				{
					CS_SwitchTeam(mdr, 2);
				}
				
				jobid[mdr] = 0;
				rankid[mdr] = 0;
				
				decl String:ClanTagRankName[20];
				GetClanTagName(jobid[mdr], rankid[mdr], ClanTagRankName, sizeof(ClanTagRankName));

				CS_SetClientClanTag(mdr, ClanTagRankName);
				
				InitSalary(mdr);
				
				CPrintToChat(client, "%s Vous avez virer %N de votre entreprise.", LOGO, mdr);
				CPrintToChat(mdr, "%s Le joueur %N vous a virer de son entreprise.", LOGO, client);
				
				LogToFile(Logfile,"le joueur %N a virer %N de son entreprise", client, mdr);
			}
			else
			{
				CPrintToChat(client, "%s Vous avez virer un joueur de votre entreprise.", LOGO);
			}
			
			CloseHandle(db_rp);
		}
	}
	else
	{
		if (action == MenuAction_End)
		{
			CloseHandle(virer);
		}
	}
}

public Action:Command_Out(client, args)
{
	if (IsClientInGame(client))
	{
		if (IsPlayerAlive(client))
		{
			new expulser = GetClientAimTarget(client, true);
			
			if (expulser != -1)
			{
				if (rankid[client] == 1)
				{
					if (IsInComico(client))
					{
						if (IsInComico(expulser))
						{
							CPrintToChat(client, "%s {red}Vous avez expulsé {green}%N", LOGO, expulser);
							CPrintToChat(expulser, "%s {red}Vous avez été expulsé par {green}%N", LOGO, client);
							
							TeleportEntity(expulser, Float:{ 316.933044, -21.747749, 119.771423 }, NULL_VECTOR, NULL_VECTOR);
						}
						else
						{
							CPrintToChat(client, "%s {red}Le joueur %N n'est pas dans votre planque.", LOGO, expulser);
						}
					}
					else
					{
						CPrintToChat(client, "%s {red}Vous n'êtes pas dans votre planque.", LOGO);
					}
				}
				else if (rankid[client] == 2)
				{
					if (IsInMafia(client))
					{
						if (IsInMafia(expulser))
						{
							CPrintToChat(client, "%s {red}Vous avez expulsé {green}%N", LOGO, expulser);
							CPrintToChat(expulser, "%s {red}Vous avez été expulsé par {green}%N", LOGO, client);
							
							TeleportEntity(expulser, Float:{ -4158.617188, -2420.929688, 266.091949 }, NULL_VECTOR, NULL_VECTOR);
						}
						else
						{
							CPrintToChat(client, "%s {red}Le joueur %N n'est pas dans votre planque.", LOGO, expulser);
						}
					}
					else
					{
						CPrintToChat(client, "%s {red}Vous n'êtes pas dans votre planque.", LOGO);
					}
				}
				else if (rankid[client] == 3)
				{
					if (IsInDealer(client))
					{
						if (IsInDealer(expulser))
						{
							CPrintToChat(client, "%s {red}Vous avez expulsé {green}%N", LOGO, expulser);
							CPrintToChat(expulser, "%s {red}Vous avez été expulsé par {green}%N", LOGO, client);
							
							TeleportEntity(expulser, Float:{ 683.292969, -1090.936279, 174.460938 }, NULL_VECTOR, NULL_VECTOR);
						}
						else
						{
							CPrintToChat(client, "%s {red}Le joueur %N n'est pas dans votre planque.", LOGO, expulser);
						}
					}
					else
					{
						CPrintToChat(client, "%s {red}Vous n'êtes pas dans votre planque.", LOGO);
					}
				}
				else if (rankid[client] == 4)
				{
					if (IsInCoach(client))
					{
						if (IsInCoach(expulser))
						{
							CPrintToChat(client, "%s {red}Vous avez expulsé {green}%N", LOGO, expulser);
							CPrintToChat(expulser, "%s {red}Vous avez été expulsé par {green}%N", LOGO, client);
							
							TeleportEntity(expulser, Float:{ -3214.415771, -388.316620, 138.861893 }, NULL_VECTOR, NULL_VECTOR);
						}
						else
						{
							CPrintToChat(client, "%s {red}Le joueur %N n'est pas dans votre planque.", LOGO, expulser);
						}
					}
					else
					{
						CPrintToChat(client, "%s {red}Vous n'êtes pas dans votre planque.", LOGO);
					}
				}
				else if (rankid[client] == 5)
				{
					if (IsInArmu(client))
					{
						if (IsInArmu(expulser))
						{
							CPrintToChat(client, "%s {red}Vous avez expulsé {green}%N", LOGO, expulser);
							CPrintToChat(expulser, "%s {red}Vous avez été expulsé par {green}%N", LOGO, client);
						
							TeleportEntity(expulser, Float:{ -2027.177612, 720.366455, 111.069122 }, NULL_VECTOR, NULL_VECTOR);
						}
						else
						{
							CPrintToChat(client, "%s {red}Le joueur %N n'est pas dans votre planque.", LOGO, expulser);
						}
					}
					else
					{
						CPrintToChat(client, "%s {red}Vous n'êtes pas dans votre planque.", LOGO);
					}
				}
				else if (rankid[client] == 6)
				{
					if (IsInLoto(client))
					{
						if (IsInLoto(expulser))
						{
							CPrintToChat(client, "%s {red}Vous avez expulsé {green}%N", LOGO, expulser);
							CPrintToChat(expulser, "%s {red}Vous avez été expulsé par {green}%N", LOGO, client);
					
							TeleportEntity(expulser, Float:{ -1156.108276, -1105.763550, 133.824692 }, NULL_VECTOR, NULL_VECTOR);
						}
						else
						{
							CPrintToChat(client, "%s {red}Le joueur %N n'est pas dans votre planque.", LOGO, expulser);
						}
					}
					else
					{
						CPrintToChat(client, "%s {red}Vous n'êtes pas dans votre planque.", LOGO);
					}
				}
				else if (rankid[client] == 7)
				{
					if (IsInBank(client))
					{
						if (IsInBank(expulser))
						{
							CPrintToChat(client, "%s {red}Vous avez expulsé {green}%N", LOGO, expulser);
							CPrintToChat(expulser, "%s {red}Vous avez été expulsé par {green}%N", LOGO, client);
						
							TeleportEntity(expulser, Float:{ -2589.376709, -2053.396729, 118.433418 }, NULL_VECTOR, NULL_VECTOR);
						}
						else
						{
							CPrintToChat(client, "%s {red}Le joueur %N n'est pas dans votre planque.", LOGO, expulser);
						}
					}
					else
					{
						CPrintToChat(client, "%s {red}Vous n'êtes pas dans votre planque.", LOGO);
					}
				}
				else if (rankid[client] == 8)
				{
					if (IsInHosto(client))
					{
						if (IsInHosto(expulser))
						{
							CPrintToChat(client, "%s {red}Vous avez expulsé {green}%N", LOGO, expulser);
							CPrintToChat(expulser, "%s {red}Vous avez été expulsé par {green}%N", LOGO, client);
						
							TeleportEntity(expulser, Float:{ -1033.344604, -3054.103027, 149.499832 }, NULL_VECTOR, NULL_VECTOR);
						}
						else
						{
							CPrintToChat(client, "%s {red}Le joueur %N n'est pas dans votre planque.", LOGO, expulser);
						}
					}
					else
					{
						CPrintToChat(client, "%s {red}Vous n'êtes pas dans votre planque.", LOGO);
					}
				}
				else if (rankid[client] == 9)
				{
					if (IsInArti(client))
					{
						if (IsInArti(expulser))
						{
							CPrintToChat(client, "%s {red}Vous avez expulsé {green}%N", LOGO, expulser);
							CPrintToChat(expulser, "%s {red}Vous avez été expulsé par {green}%N", LOGO, client);
						
							TeleportEntity(expulser, Float:{ -547.795166, -168.591232, 128.305542 }, NULL_VECTOR, NULL_VECTOR);
						}
						else
						{
							CPrintToChat(client, "%s {red}Le joueur %N n'est pas dans votre planque.", LOGO, expulser);
						}
					}
					else
					{
						CPrintToChat(client, "%s {red}Vous n'êtes pas dans votre planque.", LOGO);
					}
				}
				else if (rankid[client] == 10)
				{
					if (IsInTribunal(client))
					{
						if (IsInTribunal(expulser))
						{
							CPrintToChat(client, "%s {red}Vous avez expulsé {green}%N", LOGO, expulser);
							CPrintToChat(expulser, "%s {red}Vous avez été expulsé par {green}%N", LOGO, client);
						
							TeleportEntity(expulser, Float:{ -2612.707520, -3935.857666, 286.388123 }, NULL_VECTOR, NULL_VECTOR);
						}
						else
						{
							CPrintToChat(client, "%s {red}Le joueur %N n'est pas dans votre planque.", LOGO, expulser);
						}
					}
					else
					{
						CPrintToChat(client, "%s {red}Vous n'êtes pas dans votre planque.", LOGO);
					}
				}
				else if (rankid[client] == 11)
				{
					if (IsInTueur(client))
					{
						if (IsInTueur(expulser))
						{
							CPrintToChat(client, "%s {red}Vous avez expulsé {green}%N", LOGO, expulser);
							CPrintToChat(expulser, "%s {red}Vous avez été expulsé par {green}%N", LOGO, client);
						
							TeleportEntity(expulser, Float:{ -3883.660400, -3195.896729, 267.826111 }, NULL_VECTOR, NULL_VECTOR);
						}
						else
						{
							CPrintToChat(client, "%s {red}Le joueur %N n'est pas dans votre planque.", LOGO, expulser);
						}
					}
					else
					{
						CPrintToChat(client, "%s {red}Vous n'êtes pas dans votre planque.", LOGO);
					}
				}
				else if (rankid[client] == 12)
				{
					if (IsInTech(client))
					{
						if (IsInTech(expulser))
						{
							CPrintToChat(client, "%s {red}Vous avez expulsé {green}%N", LOGO, expulser);
							CPrintToChat(expulser, "%s {red}Vous avez été expulsé par {green}%N", LOGO, client);
						
							TeleportEntity(expulser, Float:{ 1058.818604, -2311.845947, 147.207214 }, NULL_VECTOR, NULL_VECTOR);
						}
						else
						{
							CPrintToChat(client, "%s {red}Le joueur %N n'est pas dans votre planque.", LOGO, expulser);
						}
					}
					else
					{
						CPrintToChat(client, "%s {red}Vous n'êtes pas dans votre planque.", LOGO);
					}
				}
				else if (rankid[client] == 14)
				{
					if (IsInDetective(client))
					{
						if (IsInDetective(expulser))
						{
							CPrintToChat(client, "%s {red}Vous avez expulsé {green}%N", LOGO, expulser);
							CPrintToChat(expulser, "%s {red}Vous avez été expulsé par {green}%N", LOGO, client);
						
							TeleportEntity(expulser, Float:{ -1139.075439, -1065.009888, 259.608459 }, NULL_VECTOR, NULL_VECTOR);
						}
						else
						{
							CPrintToChat(client, "%s {red}Le joueur %N n'est pas dans votre planque.", LOGO, expulser);
						}
					}
					else
					{
						CPrintToChat(client, "%s {red}Vous n'êtes pas dans votre planque.", LOGO);
					}
				}
				else if (rankid[client] == 15)
				{
					if (IsInMcdo(client))
					{
						if (IsInMcdo(expulser))
						{
							CPrintToChat(client, "%s {red}Vous avez expulsé {green}%N", LOGO, expulser);
							CPrintToChat(expulser, "%s {red}Vous avez été expulsé par {green}%N", LOGO, client);
						
							TeleportEntity(expulser, Float:{ -2163.938965, -3779.912842, 398.913361 }, NULL_VECTOR, NULL_VECTOR);
						}
						else
						{
							CPrintToChat(client, "%s {red}Le joueur %N n'est pas dans votre planque.", LOGO, expulser);
						}
					}
					else
					{
						CPrintToChat(client, "%s {red}Vous n'êtes pas dans votre planque.", LOGO);
					}
				}
				else if (rankid[client] == 16)
				{
					if (IsInPaint(client))
					{
						if (IsInPaint(expulser))
						{
							CPrintToChat(client, "%s {red}Vous avez expulsé {green}%N", LOGO, expulser);
							CPrintToChat(expulser, "%s {red}Vous avez été expulsé par {green}%N", LOGO, client);
						
							TeleportEntity(expulser, Float:{ -2163.938965, -3779.912842, 398.913361 }, NULL_VECTOR, NULL_VECTOR);
						}
						else
						{
							CPrintToChat(client, "%s {red}Le joueur %N n'est pas dans votre planque.", LOGO, expulser);
						}
					}
					else
					{
						CPrintToChat(client, "%s {red}Vous n'êtes pas dans votre planque.", LOGO);
					}
				}
				else if (rankid[client] == 17)
				{
					if (IsIn18th(client))
					{
						if (IsIn18th(expulser))
						{
							CPrintToChat(client, "%s {red}Vous avez expulsé {green}%N", LOGO, expulser);
							CPrintToChat(expulser, "%s {red}Vous avez été expulsé par {green}%N", LOGO, client);
						
							TeleportEntity(expulser, Float:{ -2163.938965, -3779.912842, 398.913361 }, NULL_VECTOR, NULL_VECTOR);
						}
						else
						{
							CPrintToChat(client, "%s {red}Le joueur %N n'est pas dans votre planque.", LOGO, expulser);
						}
					}
					else
					{
						CPrintToChat(client, "%s {red}Vous n'êtes pas dans votre planque.", LOGO);
					}
				}
				else if (rankid[client] == 18)
				{
					if (IsInIkea(client))
					{
						if (IsInIkea(expulser))
						{
							CPrintToChat(client, "%s {red}Vous avez expulsé {green}%N", LOGO, expulser);
							CPrintToChat(expulser, "%s {red}Vous avez été expulsé par {green}%N", LOGO, client);
						
							TeleportEntity(expulser, Float:{ -2671.321045, -1.873677, 126.048813 }, NULL_VECTOR, NULL_VECTOR);
						}
						else
						{
							CPrintToChat(client, "%s {red}Le joueur %N n'est pas dans votre planque.", LOGO, expulser);
						}
					}
					else
					{
						CPrintToChat(client, "%s {red}Vous n'êtes pas dans votre planque.", LOGO);
					}
				}
				else if (jobid[client] == 0)
				{
					CPrintToChat(client, "%s {red}Vous n'avez pas accès a cette commande.", LOGO);
				}
			}
			else
			{
				CPrintToChat(client, "%s {red} Veuillez viser un joueur !", LOGO);
			}
		}
		else
		{
			CPrintToChat(client, "%s {red} Vous devez être vivant !", LOGO);
		}
	}
}

public Action:Command_Grab(client, args)
{ 
	if (!IsPlayerAlive(client) || !IsClientInGame(client) || (client < 0) || (client > MaxClients))
		return Plugin_Handled;
		
	if (g_IsInJail[client] == 0)
	{
		if (grab[client])
		{
			gObj[client] = -1;
			grab[client] = false;
			return Plugin_Handled;
		}
	  
		new ent = TraceToEntity(client);
	  
		new String:edictname[128];
		GetEdictClassname(ent, edictname, 128);
		
		if (gObj[client] == ent)
		{
			if (grab[client])
			{
				gObj[client] = -1;
				grab[client] = false;
			}
			else
			{
				CPrintToChat(client, "%s {red} Vous ne portez rien actuellement !", LOGO);
			}
			return Plugin_Handled;
		}
		else
		{
			if (!grab[client])
			{
				if (StrEqual(edictname, "prop_physics"))
				{
					new String:Name[200];
					Entity_GetName(ent, Name, sizeof(Name));
					if(StrContains(Name, "propolice_", true) != -1) 
					{	
						if (GetClientTeam(client) == 3)
						{
							gObj[client] = ent;
							grab[client] = true;
						}
						else
						{
							CPrintToChat(client, "%s {red} Ce prop appartient à la police - {black}Cordialement", LOGO);
						}
					}
					else
					{
						gObj[client] = ent;
						grab[client] = true;
					}
				}
				else if(StrEqual(edictname, "player"))
				{
					new String:SteamID[64];
					GetClientAuthString(ent, SteamID, sizeof(SteamID));
					if (Chef_SERVEUR(client))
					{
						CPrintToChat(client, "%s {red}Cette homme est trop puissant désolé !", LOGO);
						return Plugin_Handled;
					}
					else
					{
						if ((GetClientTeam(client) == 3) || jobid[client] > 0)
						{
							if (GetClientTeam(ent) == 3 && GetClientTeam(client) == 2)
							{
								new String:SteamID2[64];
								GetClientAuthString(client, SteamID2, sizeof(SteamID2));
								if (Chef_SERVEUR(client))
								{
									gObj[client] = ent;
									grab[client] = true;
								}
							}
							else
							{
								if (rankid[client] == 2)
								{
									if (IsInMafia(client))
									{
										if (IsInMafia(ent))
										{
											gObj[client] = ent;
											grab[client] = true;
										}
										else
										{
											CPrintToChat(client, "%s {red} La personne n'est plus chez vous !", LOGO);
										}
									}
									else
									{
										CPrintToChat(client, "%s {red} Vous n'êtes pas dans votre planque", LOGO);
									}
								}
								else if (rankid[client] == 3)
								{
									if (IsInDealer(client))
									{
										if (IsInDealer(ent))
										{
											gObj[client] = ent;
											grab[client] = true;
										}
										else
										{
											CPrintToChat(client, "%s {red} La personne n'est plus chez vous !", LOGO);
										}
									}
									else
									{
										CPrintToChat(client, "%s {red} Vous n'êtes pas dans votre planque", LOGO);
									}
								}
								else if (rankid[client] == 4)
								{
									if (IsInCoach(client))
									{
										if (IsInCoach(ent))
										{
											gObj[client] = ent;
											grab[client] = true;
										}
										else
										{
											CPrintToChat(client, "%s {red} La personne n'est plus chez vous !", LOGO);
										}
									}
									else
									{
										CPrintToChat(client, "%s {red} Vous n'êtes pas dans votre planque", LOGO);
									}
								}
								else if (rankid[client] == 5)
								{
									if (IsInArmu(client))
									{
										if (IsInArmu(ent))
										{
											gObj[client] = ent;
											grab[client] = true;
										}
										else
										{
											CPrintToChat(client, "%s {red} La personne n'est plus chez vous !", LOGO);
										}
									}
									else
									{
										CPrintToChat(client, "%s {red} Vous n'êtes pas dans votre planque", LOGO);
									}
								}
								else if (rankid[client] == 6)
								{
									if (IsInLoto(client))
									{
										if (IsInLoto(ent))
										{
											gObj[client] = ent;
											grab[client] = true;
										}
										else
										{
											CPrintToChat(client, "%s {red} La personne n'est plus chez vous !", LOGO);
										}
									}
									else
									{
										CPrintToChat(client, "%s {red} Vous n'êtes pas dans votre planque", LOGO);
									}
								}
								else if (rankid[client] == 7)
								{
									if (IsInBank(client))
									{
										if (IsInBank(ent))
										{
											gObj[client] = ent;
											grab[client] = true;
										}
										else
										{
											CPrintToChat(client, "%s {red} La personne n'est plus chez vous !", LOGO);
										}
									}
									else
									{
										CPrintToChat(client, "%s {red} Vous n'êtes pas dans votre planque", LOGO);
									}
								}
								else if (rankid[client] == 8)
								{
									if (IsInHosto(client))
									{
										if (IsInHosto(ent))
										{
											gObj[client] = ent;
											grab[client] = true;
										}
										else
										{
											CPrintToChat(client, "%s {red} La personne n'est plus chez vous !", LOGO);
										}
									}
									else
									{
										CPrintToChat(client, "%s {red} Vous n'êtes pas dans votre planque", LOGO);
									}
								}
								else if (rankid[client] == 9)
								{
									if (IsInArti(client))
									{
										if (IsInArti(ent))
										{
											gObj[client] = ent;
											grab[client] = true;
										}
										else
										{
											CPrintToChat(client, "%s {red} La personne n'est plus chez vous !", LOGO);
										}
									}
									else
									{
										CPrintToChat(client, "%s {red} Vous n'êtes pas dans votre planque", LOGO);
									}
								}
								else if (rankid[client] == 10)
								{
									if (jobid[client] == 1 || jobid[client] == 3 || jobid[client] == 6)
									{
										gObj[client] = ent;
										grab[client] = true;
									}
									else
									{
										if (IsInTribunal(client))
										{
											if (IsInTribunal(ent))
											{
												gObj[client] = ent;
												grab[client] = true;
											}
											else
											{
												CPrintToChat(client, "%s {red} La personne n'est plus chez vous !", LOGO);
											}
										}
										else
										{
											CPrintToChat(client, "%s {red} Vous n'êtes pas dans votre planque", LOGO);
										}
									}
								}
								else if (rankid[client] == 11)
								{
									if (IsInTueur(client))
									{
										if (IsInTueur(ent))
										{
											gObj[client] = ent;
											grab[client] = true;
										}
										else
										{
											CPrintToChat(client, "%s {red} La personne n'est plus chez vous !", LOGO);
										}
									}
									else
									{
										CPrintToChat(client, "%s {red} Vous n'êtes pas dans votre planque", LOGO);
									}
								}
								else if (rankid[client] == 12)
								{
									if (IsInTech(client))
									{
										if (IsInTech(ent))
										{
											gObj[client] = ent;
											grab[client] = true;
										}
										else
										{
											CPrintToChat(client, "%s {red} La personne n'est plus chez vous !", LOGO);
										}
									}
									else
									{
										CPrintToChat(client, "%s {red} Vous n'êtes pas dans votre planque", LOGO);
									}
								}
								else if (rankid[client] == 14)
								{
									if (IsInDetective(client))
									{
										if (IsInDetective(ent))
										{
											gObj[client] = ent;
											grab[client] = true;
										}
										else
										{
											CPrintToChat(client, "%s {red} La personne n'est plus chez vous !", LOGO);
										}
									}
									else
									{
										CPrintToChat(client, "%s {red} Vous n'êtes pas dans votre planque", LOGO);
									}
								}
								else if (rankid[client] == 15)
								{
									if (IsInMcdo(client))
									{
										if (IsInMcdo(ent))
										{
											gObj[client] = ent;
											grab[client] = true;
										}
										else
										{
											CPrintToChat(client, "%s {red} La personne n'est plus chez vous !", LOGO);
										}
									}
									else
									{
										CPrintToChat(client, "%s {red} Vous n'êtes pas dans votre planque", LOGO);
									}
								}
								else if (rankid[client] == 16)
								{
									if (IsInPaint(client))
									{
										if (IsInPaint(ent))
										{
											gObj[client] = ent;
											grab[client] = true;
										}
										else
										{
											CPrintToChat(client, "%s {red} La personne n'est plus chez vous !", LOGO);
										}
									}
									else
									{
										CPrintToChat(client, "%s {red} Vous n'êtes pas dans votre planque", LOGO);
									}
								}
								else if (rankid[client] == 17)
								{
									if (IsIn18th(client))
									{
										if (IsIn18th(ent))
										{
											gObj[client] = ent;
											grab[client] = true;
										}
										else
										{
											CPrintToChat(client, "%s {red} La personne n'est plus chez vous !", LOGO);
										}
									}
									else
									{
										CPrintToChat(client, "%s {red} {red} La personne n'est plus chez vous !", LOGO);
									}
								}
								else if (rankid[client] == 18)
								{
									if (IsInIkea(client))
									{
										if (IsInIkea(ent))
										{
											gObj[client] = ent;
											grab[client] = true;
										}
										else
										{
											CPrintToChat(client, "%s {red} La personne n'est plus chez vous !", LOGO);
										}
									}
									else
									{
										CPrintToChat(client, "%s {red} Vous n'êtes pas dans votre planque", LOGO);
									}
								}
								else if (GetClientTeam(client) == 3)
								{
									gObj[client] = ent;
									grab[client] = true;
								}
							}
						}
						else
						{
							CPrintToChat(client, "%s {red}Vous n'avez pas la possibilité de porter un joueur !", LOGO);
						}
					}
				}
				else if(StrEqual(edictname, "prop_vehicle_driveable"))
				{
					new String:SteamID[64];
					GetClientAuthString(client, SteamID, sizeof(SteamID));
					if (Chef_SERVEUR(client))
					{
						gObj[client] = ent;
						grab[client] = true;
					}
				}
			}
			else
			{
				CPrintToChat(client, "%s Vous portez déjà quelque chose.", LOGO);
			}
			
		}
	}
	else
	{
		CPrintToChat(client, "%s {red} Vous êtes en Jail !", LOGO);
	}
	return Plugin_Handled;
}

public Action:UpdateObjects(Handle:timer)
{
	new Float:vecDir[3], Float:vecPos[3], Float:vecVel[3];
	new Float:viewang[3];
	new i;
	for (i=0; i<MAX_PLAYERS; i++)
	{
		if (gObj[i]>0)
		{
			if (IsValidEdict(gObj[i]) && IsValidEntity(gObj[i]))
			{
				GetClientEyeAngles(i, viewang);
				GetAngleVectors(viewang, vecDir, NULL_VECTOR, NULL_VECTOR);
				GetClientEyePosition(i, vecPos);
				
				vecPos[0]+=vecDir[0]*175;
				vecPos[1]+=vecDir[1]*175;
				vecPos[2]+=vecDir[2]*175;
				
				GetEntPropVector(gObj[i], Prop_Send, "m_vecOrigin", vecDir);
				
				SubtractVectors(vecPos, vecDir, vecVel);
				ScaleVector(vecVel, 10.0);
				
				TeleportEntity(gObj[i], NULL_VECTOR, NULL_VECTOR, vecVel);
			}
			else
			{
				gObj[i]=-1;
			}
		}
	}
	return Plugin_Continue;
}

public TraceToEntity(client)
{
	new Float:vecClientEyePos[3], Float:vecClientEyeAng[3];
	GetClientEyePosition(client, vecClientEyePos);
	GetClientEyeAngles(client, vecClientEyeAng);
	
	TR_TraceRayFilter(vecClientEyePos, vecClientEyeAng, MASK_PLAYERSOLID, RayType_Infinite, TraceRayDontHitSelf, client);
	
	if (TR_DidHit(INVALID_HANDLE))
	{
		new TRIndex = TR_GetEntityIndex(INVALID_HANDLE);
		return TRIndex;
	}
	return -1;
}

public bool:TraceRayDontHitSelf(entity, mask, any:data)
{
	if(entity == data)
	{
		return false;
	}
	return true;
}

public Action:Command_Salaire(client, args)
{
	if (IsClientInGame(client))
	{
		if (IsPlayerAlive(client))
		{
			BuildSalaireMenu(client);
		}
	}
}

Handle:BuildSalaireMenu(client)
{
	new Handle:menub = CreateMenu(Menu_Salaire);
	SetMenuTitle(menub, "Modifier le salaire de :");
	
	if (jobid[client] == 1 || jobid[client] == 2)
	{
		if (rankid[client] == 1)
		{
			AddMenuItem(menub, "1", "Maire");
			AddMenuItem(menub, "6", "Agent GTI");
			AddMenuItem(menub, "2", "DGSE");
			AddMenuItem(menub, "3", "Agent FBI");
			AddMenuItem(menub, "4", "Policier");
			AddMenuItem(menub, "5", "Gardien");
		}
		else if (rankid[client] == 2)
		{
			AddMenuItem(menub, "1", "Chef Mafia");
			AddMenuItem(menub, "2", "Co Chef Mafia");
			AddMenuItem(menub, "3", "Parrain");
			AddMenuItem(menub, "4", "Mafieux");
			AddMenuItem(menub, "5", "Apprenti Mafieux");
		}
		else if (rankid[client] == 3)
		{
			AddMenuItem(menub, "1", "Chef Dealer");
			AddMenuItem(menub, "2", "Co Chef Dealer");
			AddMenuItem(menub, "3", "Recelleur");
			AddMenuItem(menub, "4", "Dealer");
			AddMenuItem(menub, "5", "Apprenti Dealer");
		}
		else if (rankid[client] == 4)
		{
			AddMenuItem(menub, "1", "Chef Coach");
			AddMenuItem(menub, "2", "Co Chef Coach");
			AddMenuItem(menub, "3", "Entraineur");
			AddMenuItem(menub, "4", "Coach");
			AddMenuItem(menub, "5", "Apprenti Coach");
		}
		else if (rankid[client] == 5)
		{
			AddMenuItem(menub, "1", "Chef Armurerie");
			AddMenuItem(menub, "2", "Co Chef Armurerie");
			AddMenuItem(menub, "3", "Grenadier");
			AddMenuItem(menub, "4", "Armurier");
			AddMenuItem(menub, "5", "Apprenti Armurier");
		}
		else if (rankid[client] == 6)
		{
			AddMenuItem(menub, "1", "Chef Loto");
			AddMenuItem(menub, "2", "Co Chef Loto");
			AddMenuItem(menub, "3", "Buraliste");
			AddMenuItem(menub, "4", "Vendeur de Tickets");
			AddMenuItem(menub, "5", "Apprenti Vendeur de Tickets");
		}
		else if (rankid[client] == 7)
		{
			AddMenuItem(menub, "1", "Chef Banquier");
			AddMenuItem(menub, "2", "Co Chef Banquier");
			AddMenuItem(menub, "3", "Conseiller Financier");
			AddMenuItem(menub, "4", "Banquier");
			AddMenuItem(menub, "5", "Apprenti Banquier");
		}
		else if (rankid[client] == 8)
		{
			AddMenuItem(menub, "1", "Chef Hôpital");
			AddMenuItem(menub, "2", "Co Chef Hôpital");
			AddMenuItem(menub, "3", "Chirurgien");
			AddMenuItem(menub, "4", "Infirmier");
			AddMenuItem(menub, "5", "Apprenti Infirmier");
		}
		else if (rankid[client] == 9)
		{
			AddMenuItem(menub, "1", "Chef Artificier");
			AddMenuItem(menub, "2", "Co Chef Artificier");
			AddMenuItem(menub, "3", "Vendeur de Grenade");
			AddMenuItem(menub, "4", "Artificier");
			AddMenuItem(menub, "5", "Apprenti Artificier");
		}
		else if (rankid[client] == 10)
		{
			AddMenuItem(menub, "1", "Chef de la Justice");
			AddMenuItem(menub, "2", "Co Chef de la Justice");
			AddMenuItem(menub, "3", "Garde ONU");
			AddMenuItem(menub, "6", "Marshall");
			AddMenuItem(menub, "4", "Juge");
			AddMenuItem(menub, "5", "Avocat");
		}
		else if (rankid[client] == 11)
		{
			AddMenuItem(menub, "1", "Chef Tueur");
			AddMenuItem(menub, "2", "Co Chef Tueur");
			AddMenuItem(menub, "3", "Tueur d'élite");
			AddMenuItem(menub, "4", "Tueur Professionnel");
			AddMenuItem(menub, "5", "Tueur Novice");
		}
		else if (rankid[client] == 12)
		{
			AddMenuItem(menub, "1", "Chef Technicien");
			AddMenuItem(menub, "2", "Co Chef Technicien");
			AddMenuItem(menub, "3", "Technicien Professionnel");
			AddMenuItem(menub, "4", "Technicien");
			AddMenuItem(menub, "5", "Apprenti Technicien");
		}
		else if (rankid[client] == 13)
		{
			AddMenuItem(menub, "1", "Mac");
			AddMenuItem(menub, "2", "Co Chef Mac");
			AddMenuItem(menub, "3", "Prostituée de Luxe");
			AddMenuItem(menub, "4", "Prostituée");
			AddMenuItem(menub, "5", "Apprenti Prostituée");
		}
		else if (rankid[client] == 14)
		{
			AddMenuItem(menub, "1", "Chef Détective");
			AddMenuItem(menub, "2", "Co Chef Détective");
			AddMenuItem(menub, "3", "Détective Privé");
			AddMenuItem(menub, "4", "Détective");
			AddMenuItem(menub, "5", "Apprenti Détective");
		}
		else if (rankid[client] == 15)
		{
			AddMenuItem(menub, "1", "Chef MacDonald");
			AddMenuItem(menub, "2", "Co Chef MacDonald");
			AddMenuItem(menub, "3", "Restaurateur MacDonald");
			AddMenuItem(menub, "4", "Vendeur MacDonald");
			AddMenuItem(menub, "5", "Apprenti Vendeur MacDonald");
		}
		else if (rankid[client] == 16)
		{
			AddMenuItem(menub, "1", "Chef Moniteur");
			AddMenuItem(menub, "2", "Co Chef Moniteur");
			AddMenuItem(menub, "3", "Moniteur Professionnel");
			AddMenuItem(menub, "4", "Moniteur de tir");
			AddMenuItem(menub, "5", "Apprenti Moniteur");
		}
		else if (rankid[client] == 17)
		{
			AddMenuItem(menub, "1", "Chef 18th");
			AddMenuItem(menub, "2", "Co Chef 18th");
			AddMenuItem(menub, "3", "18th haut gradé");
			AddMenuItem(menub, "4", "18th");
			AddMenuItem(menub, "5", "Apprenti 18th");
		}
		else if (rankid[client] == 18)
		{
			AddMenuItem(menub, "1", "Chef Ikea");
			AddMenuItem(menub, "2", "Co Chef Ikea");
			AddMenuItem(menub, "3", "Meublier");
			AddMenuItem(menub, "4", "Vendeur Ikea");
			AddMenuItem(menub, "5", "Apprenti Vendeur Ikea");
		}
		else if (rankid[client] == 19)
		{
			AddMenuItem(menub, "1", "Chef Vendeur Appartement");
			AddMenuItem(menub, "2", "Co Chef Vendeur Appartement");
			AddMenuItem(menub, "3", "Hôtelier");
			AddMenuItem(menub, "4", "Vendeur Appartement");
			AddMenuItem(menub, "5", "Apprenti Vendeur Appartement");
		}
		else if (rankid[client] == 20)
		{
			AddMenuItem(menub, "1", "Chef DJ");
			AddMenuItem(menub, "2", "Co Chef DJ");
			AddMenuItem(menub, "3", "DJ Pro");
			AddMenuItem(menub, "4", "DJ");
			AddMenuItem(menub, "5", "Apprenti DJ");
		}
	}
	
	DisplayMenu(menub, client, MENU_TIME_FOREVER);
}

public Menu_Salaire(Handle:menu, MenuAction:action, client, param2)
{
	if (action == MenuAction_Select)
	{
		new String:info[64];
		GetMenuItem(menu, param2, info, sizeof(info));
		salarychoose[client] = StringToInt(info);
		
		new Handle:menuc = CreateMenu(Menu_Choice);
		SetMenuTitle(menuc, "Nouveau salaire :");
		
		if (rankid[client] == 1)
		{
			AddMenuItem(menuc, "1000", "1000€");
			AddMenuItem(menuc, "900", "900€");
			AddMenuItem(menuc, "800", "800€");
			AddMenuItem(menuc, "700", "700€");
			AddMenuItem(menuc, "600", "600€");
			AddMenuItem(menuc, "500", "500€");
			AddMenuItem(menuc, "400", "400€");
			AddMenuItem(menuc, "300", "300€");
			AddMenuItem(menuc, "200", "200€");
			AddMenuItem(menuc, "100", "100€");
			AddMenuItem(menuc, "50", "50€");
			AddMenuItem(menuc, "0", "0€");
		}
		else
		{
			AddMenuItem(menuc, "500", "500€");
			AddMenuItem(menuc, "450", "450€");
			AddMenuItem(menuc, "400", "400€");
			AddMenuItem(menuc, "350", "350€");
			AddMenuItem(menuc, "300", "300€");
			AddMenuItem(menuc, "250", "250€");
			AddMenuItem(menuc, "200", "200€");
			AddMenuItem(menuc, "150", "150€");
			AddMenuItem(menuc, "100", "100€");
			AddMenuItem(menuc, "50", "50€");
			AddMenuItem(menuc, "0", "0€");
		}
		DisplayMenu(menuc, client, MENU_TIME_FOREVER);
	}
	else if (action == MenuAction_End)
	{
		CloseHandle(menu);
	}
}

public Menu_Choice(Handle:menu, MenuAction:action, client, param2)
{
	if (action == MenuAction_Select)
	{
		new String:info[64], String:query[254];
		GetMenuItem(menu, param2, info, sizeof(info));
		new salaryfinal = StringToInt(info);
		
		decl String:error[256];
		new Handle:db_rp = SQL_Connect("roleplay", true, error, sizeof(error));
		Format(query, sizeof(query), "UPDATE Roleplay_Salaire SET salaire = %i WHERE jobid = '%i' AND rankid  = '%i'", salaryfinal, salarychoose[client], rankid[client]);				
		SQL_FastQuery(db_rp, query);
		
		for (new i = 1; i <= MaxClients; i++)
		{
			if (IsClientInGame(i) && IsPlayerAlive(i) && (jobid[i] == salarychoose[client]) && (rankid[i] == rankid[client]))
			{
				salaire[i] = salaryfinal;
			}
		}
		
		CloseHandle(db_rp);
		salarychoose[client] = 0;
	}
	else if (action == MenuAction_End)
	{
		CloseHandle(menu);
	}
}

public InitSalary(client)
{
	decl String:query[500];
	
	decl String:error[500];
	new Handle:db_rp = SQL_Connect("roleplay", true, error, sizeof(error));
	Format(query, sizeof(query), "SELECT salaire FROM `Roleplay_Salaire` WHERE `jobid` = '%i' AND rankid = '%i'", jobid[client], rankid[client]);
	new Handle:GetSalary = SQL_Query(db_rp, query);
	
	if (GetSalary)
	{
		while (SQL_FetchRow(GetSalary))
		{
			salaire[client] = SQL_FetchInt(GetSalary, 0);
		}
	}
	
	CloseHandle(GetSalary);
	CloseHandle(db_rp);
}

public SalaryTime()
{
	for (new i = 1; i <= MaxClients; i++)
	{
		if (IsClientInGame(i) && IsPlayerAlive(i) && GetClientTeam(i) > 1)
		{
			if (g_IsInJail[i] == 0)
			{
				new checkcapital = capital[rankid[i]];
				
				if (rankid[i] == 0)
				{
					CPrintToChat(i, "%s {blue}Vous recevez votre allocation chômage ({green}%i€{blue})", LOGO, salaire[i]);
				}
				else if (rankid[i] > 0)
				{
					CPrintToChat(i, "%s {blue}Vous recevez votre salaire de ({green}%i€{blue})", LOGO, salaire[i]);
				}
				if (rankid[i] > 0)
				{
					if (checkcapital >= salaire[i])
					{
						capital[rankid[i]] = checkcapital - salaire[i];
						
						if (rib[i] == 1)
						{
							new avant = bank[i];
							bank[i] = salaire[i] + avant;
							
							if (fiche[i])
							{
								new xd = bank[i];
								bank[i] = xd + salaire[i];
							}
							
							if (Location[i] > 0)
							{
								new xdd = bank[i];
								bank[i] = xdd + salaire[i];
							}
						}
						else
						{
							new after = money[i];
							money[i] = salaire[i] + after;
							
							if (fiche[i])
							{
								new lol = money[i];
								money[i] = lol + salaire[i];
							}
							
							if (Location[i] > 0)
							{
								new lool = money[i];
								money[i] = lool + salaire[i];
							}
						}
					}
					else
					{
						CPrintToChat(i, "%s {red}Votre entreprise n'a pas les moyens de vous payer.", LOGO);
					}
				}
				else
				{
					if (rib[i] == 1)
					{
						new avant = bank[i];
						bank[i] = salaire[i] + avant;
						
						if (fiche[i])
						{
							new xd = bank[i];
							bank[i] = xd + salaire[i];
						}
						
						if (Location[i] > 0)
						{
							new xddd = bank[i];
							bank[i] = xddd + salaire[i];
						}
					}
					else
					{
						new after = money[i];
						money[i] = salaire[i] + after;
						
						if (fiche[i])
						{
							new lol = money[i];
							money[i] = lol + salaire[i];
						}
						
						if (Location[i] > 0)
						{
							new looool = money[i];
							money[i] = looool + salaire[i];
						}
					}
				}
			}
			else
			{
				CPrintToChat(i, "%s {red}Vous ne recevez pas votre argent vu que vous êtes en prison", LOGO);
			}
		}
	}
}

public Action:InitCapital(Handle:timer)
{
	decl String:query[200];
    
	new Handle:Get;
    
	for(new i=1; i<=21; i++)
	{
		decl String:error[256];
		new Handle:db_rp = SQL_Connect("roleplay", true, error, sizeof(error));
		Format(query, (sizeof(query) - 1), "SELECT capital FROM `Roleplay_Job` WHERE `id` = %i", i);
		Get = SQL_Query(db_rp, query);
        
		if (Get != INVALID_HANDLE)
		{
			while (SQL_FetchRow(Get))
			{
				capital[i] = SQL_FetchInt(Get, 0);
			}
		} 
		CloseHandle(db_rp);
	}
}  

public Action:SaveCapital(Handle:timer)
{
	decl String:query[200];
    
	new Handle:Save;
	
	for(new i=1; i<=21; i++)
	{
		decl String:error[256];
		new Handle:db_rp = SQL_Connect("roleplay", true, error, sizeof(error));
		Format(query, (sizeof(query) - 1), "UPDATE Roleplay_Job SET capital = %i WHERE `id` = %i", capital[i], i);
		Save = SQL_Query(db_rp, query);
		
		CloseHandle(Save);
		CloseHandle(db_rp);
	}
	
	for(new i = 1; i <= MaxClients; i++)
	{
		if (IsClientInGame(i) && !IsFakeClient(i))
		{
			DBSave(i);
		}
	}
}

public Action:OnTakeDamage(victim, &attacker, &inflictor, &Float:damage, &damagetype)
{
	decl String:sWeapon[32];
	decl String:sInflictor[32];
	
	new Player;
	
	if (attacker > 0 && attacker <= MaxClients)
	{
		GetClientWeapon(attacker, sWeapon, sizeof(sWeapon));
		Player = attacker;
	}
	else
	{
		return Plugin_Handled;
	}
	
	new InVehicule = GetEntPropEnt(victim, Prop_Send, "m_hVehicle");
	
	if (InVehicule != -1)
	{
		damage = 0.0;
	}
	
	if (IsInJail1(Player) || IsInJail2(Player) || IsInJail3(Player) || IsInHosto(Player) || IsInTribunal(Player) || IsInCour(Player) || IsInPaint(Player) || g_IsTazed[Player])
	{
		damage = 0.0;
		return Plugin_Changed;
	}
	
	GetEdictClassname(inflictor, sInflictor, sizeof(sInflictor));
	
	if (StrEqual(sInflictor, "prop_physics"))
	{
		damage = 0.0;
		return Plugin_Changed;
	}
	
	if (GetClientTeam(Player) == 3)
	{
		if (StrEqual(sWeapon, "weapon_usp") || StrEqual(sWeapon, "weapon_m4a1"))
		{
			if (GetEntProp(Client_GetActiveWeapon(Player), Prop_Send, "m_bSilencerOn") == 1)
			{
				if (GetClientTeam(victim) > 1)
				{
					decl Float:Pos[3];
					
					GetClientEyeAngles(victim, Pos);
				
					new Float:position = Pos[1];
				
					Pos[1] = 30 + position;
					
					new Float:positions = Pos[2];
					Pos[2] = 10 + positions;
					
					SetEntPropVector(victim, Prop_Send, "m_vecPunchAngle", Pos);
				
					Client_ScreenFade(victim, 500, FFADE_OUT|FFADE_PURGE, 1, 250, 250, 250, 200, true);
					
					Ralentissement(victim, 0.7, 5.0);
				
					damage = 0.0;
				
					return Plugin_Changed;
				}
			}
		}
		else if (StrEqual(sWeapon, "weapon_tmp"))
		{
			if (GetClientTeam(victim) > 1)
			{
				decl Float:Pos[3];
			
				GetClientEyeAngles(victim, Pos);
				
				new Float:position = Pos[1];
				
				Pos[1] = 30 + position;
				
				new Float:positions = Pos[2];
				Pos[2] = 10 + positions;
				
				SetEntPropVector(victim, Prop_Send, "m_vecPunchAngle", Pos);
				
				Client_ScreenFade(victim, 500, FFADE_OUT|FFADE_PURGE, 1, 250, 250, 250, 200, true);
				
				Ralentissement(victim, 0.7, 5.0);
				
				damage = 0.0;
				
				return Plugin_Changed;
			}
		}
		else if (StrEqual(sWeapon, "weapon_knife"))
		{
			if (GetClientTeam(victim) > 1)
			{
				if (rankid[victim] != 1 || rankid[victim] != 10)
				{
					if (victim != Player)
					{
						if (rankid[Player] == 1)
						{
							if (g_invisible[Player] == 0)
							{		
								decl String:ClassName[64];
								GetEdictClassname(victim, ClassName, sizeof(ClassName));
								if (StrEqual(ClassName, "player", true))
								{								
									GoJail(victim);
								
									BuildJailMenu(Player, victim);
									g_IsInJail[victim] = 1;
									g_jailtime[victim] = 720;
									disarm(victim);
									GivePlayerItem(victim, "weapon_knife");
									choose_skin(victim);
									countjail[victim] += 1;
													
									CPrintToChat(Player, "%s Vous avez emprisonner %N. Veuillez sélectionner une peine.", LOGO, victim);
									CPrintToChat(victim, "%s {red}Vous avez été emprisonner par %N.", LOGO, Player);
									CPrintToChat(victim, "%s {red}Votre peine n'est pas encore définie !", LOGO);
												
									if (g_jailtime[victim] == 0)
									{
										CPrintToChatAll("%s {red}({blue}POLICE{red}) {blue}Le joueur {red}%N{blue} est arrêté", LOGO, victim);
									}			
									SetEntityMoveType(victim, MOVETYPE_WALK);
									SetClientListeningFlags(victim, VOICE_MUTED);
													
									ModifySpeed(victim, 1.0);
									SetEntityGravity(victim, 1.0);
									SetEntityRenderColor(victim, 255, 255, 255, 255);
																						
									SetEntPropFloat(victim, Prop_Send, "m_flProgressBarStartTime", GetGameTime()); 
									SetEntProp(victim, Prop_Send, "m_iProgressBarDuration", 0);
													
									if (g_IsTazed[victim])
									{
										g_IsTazed[victim] = false;
									}
									if (g_crochetageon[victim])
									{
										g_crochetageon[victim] = false;
									}
									
									damage = 0.0;
									return Plugin_Changed;
								}
							}
							else
							{
								CPrintToChat(Player, "%s {red}Vous devez être visible !", LOGO);
							}
						}
					}
				}
				else
				{
					CPrintToChat(Player, "%s {red}Cette personne est immunisée !", LOGO);
				}
			}
		}
	}
	
	if (flashb[Player])
	{
		decl Float:Pos[3];
	
		GetClientEyeAngles(victim, Pos);
	
		new Float:position = Pos[1];

		Pos[1] = 30 + position;
	
		new Float:positions = Pos[2];
		Pos[2] = 10 + positions;
	
		SetEntPropVector(victim, Prop_Send, "m_vecPunchAngle", Pos);
	
		Client_ScreenFade(victim, 500, FFADE_OUT|FFADE_PURGE, 1, 250, 250, 250, 200, true);
	
		damage = 0.0;
	
		return Plugin_Changed;
	}
	
	if (Player == inflictor)
	{
		if (StrEqual(sWeapon, "weapon_knife"))
		{
			if (levelcut[Player] <= 0)
			{
				damage = 0.0;
				return Plugin_Changed;
			}
		}
		
		new InVehicle = GetEntPropEnt(Player, Prop_Send, "m_hVehicle");
	
		if (InVehicle != -1)
		{
			damage = 0.0;
		}
	}
	
	if (StrEqual(sInflictor, "worldspawn"))
	{
		damage = damage / 4.5;
		return Plugin_Changed;
	}
	
	if (damagetype == 2)
	{
		damage = damage / 4.5;
		return Plugin_Changed;
	}
	
	if (damagetype & DMG_VEHICLE)
	{
		if (StrEqual("prop_vehicle_driveable", sInflictor, false))
		{
			damage = 0.0;
			
			new Driver = GetEntPropEnt(inflictor, Prop_Send, "m_hPlayer");
			
			if (Driver != -1)
			{
				attacker = Driver;
				return Plugin_Changed;
			}
		}
	}
	
	if (GetClientTeam(Player) == 2)
	{
		if (!StrEqual(sWeapon, "weapon_knife"))
		{
			damage *= 0.5;
			return Plugin_Changed;
		}
	}
	
	return Plugin_Continue;
}

public Action:Command_Money(client, args)
{
	new String:SteamID[64];
	GetClientAuthString(client, SteamID, sizeof(SteamID));
		
	if (Chef_SERVEUR(client))
	{
		seekplayers(client);
	}
}

public bool:Chef_SERVEUR(client){
	if (Client_HasAdminFlags(client, ADMFLAG_ROOT))
		return true;
	else
		return false;
}


public Action:Command_Enquete(client, args)
{
	if (IsClientInGame(client))
	{
		if (IsPlayerAlive(client))
		{
			if (GetClientTeam(client) == 3 || rankid[client] == 10)
			{
				new aim = GetClientAimTarget(client, true);
				
				if (aim != -1)
				{
					new String:edictname[128];
					
					GetEdictClassname(aim, edictname, 128);
			
					if(StrEqual(edictname, "player"))
					{
						if (IsPlayerAlive(aim))
						{
							new Handle:hP2 = CreatePanel();
							new String:sMessage[9999];
							Format(sMessage, sizeof(sMessage), "- Informations sur %N -   \n \nLevel CUT : %i\nPermis de port d'arme %s\nAppartement %s\nArgent En poche : %d\nArgent En Banque : %d", aim, levelcut[aim],(permisleger[aim] > 0 ? "Oui" : "Non"), (Location[aim] > 0 ? "Possède une maison" : "Aucun"), money[aim], bank[aim]);
							DrawPanelText(hP2, sMessage);
							SetPanelCurrentKey(hP2, 10);
							SendPanelToClient(hP2, client, Handler_DoNothing, 20);						
							CPrintToChat(client, "%s {blue}Affichage des infos de {red}%N", LOGO, aim);					
						}
					}
					else
					{
						CPrintToChat(client, "%s {red} Veuillez viser un joueur ", LOGO);
					}
				}
				else
				{
					CPrintToChat(client, "%s {red} Veuillez viser un joueur ", LOGO);
				}
			}
			else
			{
				CPrintToChat(client, "%s {red}Vous n'avez pas accès a cette commande.", LOGO);
			}
		}
		else
		{
			CPrintToChat(client, "%s Vous devez être vivant.", LOGO);
		}
	}
}

public Action:Command_Ammende(client, args)
{
	if (IsClientInGame(client))
	{
		if (rankid[client] == 1 || jobid[client] == 1 && rankid[client] == 10 || jobid[client] == 2 && rankid[client] == 10)
		{
			new Ent = GetClientAimTarget(client, false);
				
			if (Ent != -1)
			{
				decl String:ClassName[64];
				GetEdictClassname(Ent, ClassName, sizeof(ClassName));
				
				if (StrEqual(ClassName, "player", true))
				{
					if (rankid[Ent] != 1 || rankid[Ent] != 10)
					{
						BuildAmmendeMenu(client, Ent);	
						CPrintToChat(client, "%s {blue}Choix de l'amende pour {green}%N", LOGO, Ent);
					}
				}
				else
				{
					CPrintToChat(client, "%s {red}Merci de viser un joueur", LOGO);
				}
			}
			else
			{
				CPrintToChat(client, "%s {red}Merci de viser un joueur", LOGO);
			}
		}
		else
		{
			CPrintToChat(client, "%s {red}Vous n'avez pas accès à cette commande !", LOGO);
		}
	}
}

public Action:Command_Jail(client, args)
{
	if (IsClientInGame(client))
	{
		if (rankid[client] == 1)
		{
			if (g_invisible[client] == 0)
			{
				new Ent = GetClientAimTarget(client, false);
				
				if (Ent != -1)
				{
					decl String:ClassName[64];
					GetEdictClassname(Ent, ClassName, sizeof(ClassName));
					
					decl Float:origin[3], Float:clientent[3];
					GetEntPropVector(Ent, Prop_Send, "m_vecOrigin", origin);
					GetEntPropVector(client, Prop_Send, "m_vecOrigin", clientent);
					new Float:distance = GetVectorDistance(origin, clientent, true);
					
					if (distance > 100000)
					{
						CPrintToChat(client, "%s {red}Vous êtes trop loin de cette personne !", LOGO);
					}
					else
					{
						if (StrEqual(ClassName, "player", true))
						{
							if (rankid[Ent] != 1 || rankid[Ent] != 10)
							{
								if (!nojail[Ent])
								{
									BuildJailMenu(client, Ent);
									g_IsInJail[Ent] = 1;
									g_jailtime[Ent] = 720;
									disarm(Ent);
									GivePlayerItem(Ent, "weapon_knife");
									choose_skin(Ent);
									countjail[Ent] += 1;
									
									CPrintToChat(client, "%s {blue}Vous avez emprisonner {green}%N. {red}Veuillez sélectionner une peine.", LOGO, Ent);
									CPrintToChat(Ent, "%s {red}Vous avez été emprisonner par %N.", LOGO, client);
									CPrintToChat(Ent, "%s {red}Votre peine n'est pas encore définie !", LOGO);
									
									if (g_jailtime[Ent] == 0)
									{
										CPrintToChatAll("%s {red}({blue}POLICE{red}) {blue}Le joueur {red}%N{blue} est arrêté", LOGO, Ent);
									}
									
									SetEntityMoveType(Ent, MOVETYPE_WALK);
									SetClientListeningFlags(Ent, VOICE_MUTED);
									
									ModifySpeed(Ent, 1.0);
									SetEntityGravity(Ent, 1.0);
									SetEntityRenderColor(Ent, 255, 255, 255, 255);
									
									g_crochetageon[Ent] = false;
									
									SetEntPropFloat(Ent, Prop_Send, "m_flProgressBarStartTime", GetGameTime()); 
									SetEntProp(Ent, Prop_Send, "m_iProgressBarDuration", 0);
									
									if (g_IsTazed[Ent])
									{
										g_IsTazed[Ent] = false;
									}
									
									GoJail(Ent);
								}
							}
							else
							{
								CPrintToChat(client, "%s Cette personne est immunisée !", LOGO);
							}
						}
						else if (StrEqual(ClassName, "prop_vehicle_driveable"))
						{
							new Driver = GetEntPropEnt(Ent, Prop_Send, "m_hPlayer");
							
							if (Driver != -1)
							{
								if (rankid[Driver] == 1)
								{
									CPrintToChat(client, "%s {red}Cette personne est immunisée !", LOGO);
								}
								else
								{
									CPrintToChat(client, "%s Vous avez sorti %N de la voiture.", LOGO, Driver);
									CPrintToChat(Driver, "%s %N vous a sorti de la voiture.", LOGO, client);
									ExitVehicle(Driver, Ent, 0);
								}
							}
							else
							{
								CPrintToChat(client, "%s {red}Voiture Vide !", LOGO);
							}
						}
					}
				}
				else
				{
					CPrintToChat(client, "%s {red}Merci de viser un joueur", LOGO);
				}
			}
			else
			{
				CPrintToChat(client, "%s {red}Vous devez être visible", LOGO);
			}
		}
		else if (jobid[client] == 3 && rankid[client] == 10 || jobid[client] == 6 && rankid[client] == 10 || jobid[client] == 1 && rankid[client] == 10)
		{
			if (g_invisible[client] == 0)
			{
				new Ent = GetClientAimTarget(client, false);
				
				if (Ent != -1)
				{
					decl String:ClassName[64];
					GetEdictClassname(Ent, ClassName, sizeof(ClassName));
					
					decl Float:origin[3], Float:clientent[3];
					GetEntPropVector(Ent, Prop_Send, "m_vecOrigin", origin);
					GetEntPropVector(client, Prop_Send, "m_vecOrigin", clientent);
					new Float:distance = GetVectorDistance(origin, clientent, true);
					
					if (distance > 100000)
					{
						CPrintToChat(client, "%s {red}Vous êtes trop loin de cette personne !", LOGO);
					}
					else
					{
						if (StrEqual(ClassName, "player", true))
						{
							if (rankid[Ent] != 1 || rankid[Ent] != 10)
							{
								if (!nojail[Ent])
								{
									BuildJailMenu(client, Ent);
									g_IsInJail[Ent] = 1;
									g_jailtime[Ent] = 500;
									disarm(Ent);
									GivePlayerItem(Ent, "weapon_knife");
									choose_skin(Ent);
									countjail[Ent] += 1;
									
									CPrintToChat(client, "%s {blue}Vous avez emprisonné {green}%N.", LOGO, Ent);
									CPrintToChat(Ent, "%s {red}Vous êtes detenu au Tribunal", LOGO);
									
									if (g_jailtime[Ent] == 0)
									{
										CPrintToChatAll("%s {red}({blue}JUSTICE{red}) {blue}Le joueur {red}%N{blue} est retenu au Tribunal", LOGO, Ent);
									}
									
									SetEntityMoveType(Ent, MOVETYPE_WALK);
									SetClientListeningFlags(Ent, VOICE_MUTED);
									
									ModifySpeed(Ent, 1.0);
									SetEntityGravity(Ent, 1.0);
									SetEntityRenderColor(Ent, 255, 255, 255, 255);
									
									g_crochetageon[Ent] = false;
									
									SetEntPropFloat(Ent, Prop_Send, "m_flProgressBarStartTime", GetGameTime()); 
									SetEntProp(Ent, Prop_Send, "m_iProgressBarDuration", 0);
									
									if (g_IsTazed[Ent])
									{
										g_IsTazed[Ent] = false;
									}
									
									TeleportEntity(Ent, Float:{ -3186.05, -2940.11, 232.03 }, NULL_VECTOR, NULL_VECTOR);
								}
							}
							else
							{
								CPrintToChat(client, "%s Cette personne est immunisée !", LOGO);
							}
						}
					}
				}
				else
				{
					CPrintToChat(client, "%s {red}Merci de viser un joueur", LOGO);
				}
			}
		}
		else
		{
			CPrintToChat(client, "%s {red}Vous n'avez pas accès à cette commande.", LOGO);
		}
	}
}


Handle:BuildAmmendeMenu(client, Player)
{
	decl String:Buffer[32];
	
	new Handle:jail_menu = CreateMenu(Menu_Ammende);
	SetMenuTitle(jail_menu, "Choix de l'ammende pour %N ?\n ", Player);
	
	Format(Buffer, sizeof(Buffer), "%i_100", Player);
	AddMenuItem(jail_menu, Buffer, "Amende de 100 euros");
	
	Format(Buffer, sizeof(Buffer), "%i_200", Player);
	AddMenuItem(jail_menu, Buffer, "Amende de 200 euros");
	
	Format(Buffer, sizeof(Buffer), "%i_300", Player);
	AddMenuItem(jail_menu, Buffer, "Amende de 300 euros");
	
	Format(Buffer, sizeof(Buffer), "%i_400", Player);
	AddMenuItem(jail_menu, Buffer, "Amende de 400 euros");
	
	Format(Buffer, sizeof(Buffer), "%i_500", Player);
	AddMenuItem(jail_menu, Buffer, "Amende de 500 euros");
	
	Format(Buffer, sizeof(Buffer), "%i_600", Player);
	AddMenuItem(jail_menu, Buffer, "Amende de 600 euros");
	
	Format(Buffer, sizeof(Buffer), "%i_700", Player);
	AddMenuItem(jail_menu, Buffer, "Amende de 700 euros");
	
	Format(Buffer, sizeof(Buffer), "%i_800", Player);
	AddMenuItem(jail_menu, Buffer, "Amende de 800 euros");
	
	Format(Buffer, sizeof(Buffer), "%i_900", Player);
	AddMenuItem(jail_menu, Buffer, "Amende de 900 euros");
	
	Format(Buffer, sizeof(Buffer), "%i_1000", Player);
	AddMenuItem(jail_menu, Buffer, "Amende de 1000 euros");
	
	DisplayMenu(jail_menu, client, MENU_TIME_FOREVER);
	
	return Handle:0;
}


public Menu_Ammende(Handle:jail_menu, MenuAction:action, param1, param2)
{
	if (action == MenuAction_Select)
	{
		decl String:info[32];
		
		new Player;
		new number;
		
		GetMenuItem(jail_menu, param2, info, sizeof(info));
		
		decl String:Buffer[8][32];
		
		ExplodeString(info, "_", Buffer, 2, 32);
		
		Player = StringToInt(Buffer[0]);
		number = StringToInt(Buffer[1]);
		
		if (IsValidEntity(Player))
		{		
			CPrintToChat(param1, "%s {red}Le policier {green}%N {red}vous met une ammende de{green} %s", LOGO, param1, number);
			
			if (money[Player] >= number)
			{
				money[Player] -= number;
				new afterrr = capital[1];
				capital[1] = number / 2 + afterrr;
			}
			else if (bank[Player] >= number)
			{
				bank[Player] -= number;
				new afterrr = capital[1];
				capital[1] = number / 2 + afterrr;
			}
			else
			{
				CPrintToChat(Player, "%s {red}Vous n'avez pas assez d'argent pour payer l'ammende, vous allez en Jail.", LOGO);
				CPrintToChat(param1, "%s {green}%N {red}n'as pas l'argent et va en Jail !", LOGO, Player);
				g_IsInJail[Player] = 1;
				g_jailtime[Player] = 400;
				choose_skin(Player);
				SetClientListeningFlags(Player, VOICE_MUTED);
				ModifySpeed(Player, 1.0);
				SetEntityGravity(Player, 1.0);
				SetEntityRenderColor(Player, 255, 255, 255, 255);
				GoJail(Player);
			}
		}
	}
}

Handle:BuildJailMenu(client, Player)
{
	decl String:Buffer[32];
	
	new Handle:jail_menu = CreateMenu(Menu_Jail);
	SetMenuTitle(jail_menu, "Combien de temps doit rester %N ?\n ", Player);
	
	Format(Buffer, sizeof(Buffer), "%i_1", Player);
	AddMenuItem(jail_menu, Buffer, "Annuler la peine (Libération)");
	
	if (rankid[client] == 1)
	{
		if (jobid[client] == 1 && rankid[client] == 1)
		{
			Format(Buffer, sizeof(Buffer), "%i_2", Player);
			AddMenuItem(jail_menu, Buffer, "Garde à vue");
		}
		
		Format(Buffer, sizeof(Buffer), "%i_3", Player);
		AddMenuItem(jail_menu, Buffer, "Piratage de distributeur");
				
		if (rankid[Player] == 2 || rankid[Player] == 17)
		{
			Format(Buffer, sizeof(Buffer), "%i_4", Player);
			AddMenuItem(jail_menu, Buffer, "Vol");
		}
		else
		{
			AddMenuItem(jail_menu, "", "Ce joueur ne peut voler", ITEMDRAW_DISABLED);
		}
		
		Format(Buffer, sizeof(Buffer), "%i_5", Player);
		AddMenuItem(jail_menu, Buffer, "Délit de fuite");
		
		Format(Buffer, sizeof(Buffer), "%i_6", Player);
		AddMenuItem(jail_menu, Buffer, "Refus d'obtempérer");
		
		Format(Buffer, sizeof(Buffer), "%i_7", Player);
		AddMenuItem(jail_menu, Buffer, "Tentative de meurtre");
		
		Format(Buffer, sizeof(Buffer), "%i_8", Player);
		AddMenuItem(jail_menu, Buffer, "Meurtre");
		
		Format(Buffer, sizeof(Buffer), "%i_9", Player);
		AddMenuItem(jail_menu, Buffer, "Nuisance sonore ");
		
		Format(Buffer, sizeof(Buffer), "%i_10", Player);
		AddMenuItem(jail_menu, Buffer, "Outrage à agent");
		
		if (permisleger[Player] == 0)
		{
			Format(Buffer, sizeof(Buffer), "%i_11", Player);
			AddMenuItem(jail_menu, Buffer, "Possession d'armes illégale");
		}
		
		if (0 < g_jailtime[Player])
		{
			Format(Buffer, sizeof(Buffer), "%i_12", Player);
			AddMenuItem(jail_menu, Buffer, "Évasion");
		}
		
		Format(Buffer, sizeof(Buffer), "%i_13", Player);
		AddMenuItem(jail_menu, Buffer, "Excès de vitesse");
		
		Format(Buffer, sizeof(Buffer), "%i_14", Player);
		AddMenuItem(jail_menu, Buffer, "Intrusion poste de police");
		
		Format(Buffer, sizeof(Buffer), "%i_15", Player);
		AddMenuItem(jail_menu, Buffer, "Vente de produits illicites");
		
		Format(Buffer, sizeof(Buffer), "%i_16", Player);
		AddMenuItem(jail_menu, Buffer, "Tirs dans la rue");
	}
	
	DisplayMenu(jail_menu, client, MENU_TIME_FOREVER);
	
	return Handle:0;
}

public Menu_Jail(Handle:jail_menu, MenuAction:action, param1, param2)
{
	if (action == MenuAction_Select)
	{
		decl String:info[32];
		
		new Player;
		new number;
		
		GetMenuItem(jail_menu, param2, info, sizeof(info));
		
		decl String:Buffer[8][32];
		
		ExplodeString(info, "_", Buffer, 2, 32);
		
		Player = StringToInt(Buffer[0]);
		number = StringToInt(Buffer[1]);
		
		if (IsValidEntity(Player))
		{
			decl String:SteamId[64];
			decl String:CopSteamID[64];
			
			GetClientAuthString(Player, SteamId, 64);
			GetClientAuthString(param1, CopSteamID, 64);
			
			if (number == 1)
			{
				FreePlayer(Player);
				CPrintToChat(param1, "%s {blue}Vous avez libérer {green}%N.", LOGO, Player);
			}
			if (number == 2)
			{
				SetEntityMoveType(Player, MOVETYPE_WALK);
				SetEntityRenderColor(Player, 255, 255, 255, 255);
				
				disarm(Player);
				
				GivePlayerItem(Player, "weapon_knife");
				
				g_jailtime[Player] = 360;
				
				CPrintToChat(param1, "%s {blue}Vous avez emprisonner {green}%N {blue}pendant 6H pour une {green}Garde à Vue.", LOGO, Player);
				CPrintToChat(Player, "%s {red}Vous avez été emprisonner {red}6H{blue} par {green}%N {blue}pour une {green}Garde à Vue.", LOGO, param1);
			}
			if (number == 3)
			{
				Jail(Player, param1, 480, 750);
				
				CPrintToChat(param1, "%s {blue}Vous avez emprisonner {green}%N {blue}pendant 8H pour {green}¨Piratage de Distributeur", LOGO, Player);
				CPrintToChat(Player, "%s {red}Vous avez été emprisonner {red}8H{blue} par {green}%N {blue}pour {green}Piratage de Distributeur", LOGO, param1);
			}
			if (number == 4)
			{
				Jail(Player, param1, 480, 750);
				
				CPrintToChat(param1, "%s {blue}Vous avez emprisonner {green}%N {blue}pendant 8H pour {green}¨Vol", LOGO, Player);
				CPrintToChat(Player, "%s {red}Vous avez été emprisonner {red}8H{blue} par {green}%N {blue}pour {green}Vol", LOGO, param1);
			}
			if (number == 5)
			{
				Jail(Player, param1, 360, 300);
				
				CPrintToChat(param1, "%s {blue}Vous avez emprisonner {green}%N {blue}pendant 6H pour {green}¨Délit de fuite", LOGO, Player);
				CPrintToChat(Player, "%s {red}Vous avez été emprisonner {red}6H{blue} par {green}%N {blue}pour {green}Délit de fuite", LOGO, param1);
			}
			if (number == 6)
			{
				Jail(Player, param1, 240, 100);
				
				CPrintToChat(param1, "%s {blue}Vous avez emprisonner {green}%N {blue}pendant 6H pour {green}¨Refus d'obtempérer", LOGO, Player);
				CPrintToChat(Player, "%s {red}Vous avez été emprisonner {red}6H{blue} par {green}%N {blue}pour {green}Refus d'obtempérer", LOGO, param1);
			}
			if (number == 7)
			{
				Jail(Player, param1, 480, 750);
				
				CPrintToChat(param1, "%s {blue}Vous avez emprisonner {green}%N {blue}pendant 8H pour {green}¨Tentative de meurtre", LOGO, Player);
				CPrintToChat(Player, "%s {red}Vous avez été emprisonner {red}8H{blue} par {green}%N {blue}pour {green}Tentative de meurtre", LOGO, param1);
			}
			if (number == 8)
			{
				Jail(Player, param1, 960, 750);
				
				CPrintToChat(param1, "%s {blue}Vous avez emprisonner {green}%N {blue}pendant 16H pour {green}Meurtre", LOGO, Player);
				CPrintToChat(Player, "%s {red}Vous avez été emprisonner {red}16H{blue} par {green}%N {blue}pour {green}Meurtre", LOGO, param1);
			}
			if (number == 9)
			{
				Jail(Player, param1, 240, 100);
				
				CPrintToChat(param1, "%s {blue}Vous avez emprisonner {green}%N {blue}pendant 4H pour {green}Nuisance sonore", LOGO, Player);
				CPrintToChat(Player, "%s {red}Vous avez été emprisonner {red}4H{blue} par {green}%N {blue}pour {green}Nuisance sonore", LOGO, param1);
			}
			if (number == 10)
			{
				Jail(Player, param1, 600, 250);
				
				CPrintToChat(param1, "%s {blue}Vous avez emprisonner {green}%N {blue}pendant 10H pour {green}Outrage à agent", LOGO, Player);
				CPrintToChat(Player, "%s {red}Vous avez été emprisonner {red}10H{blue} par {green}%N {blue}pour {green}Outrage à agent", LOGO, param1);
			}
			if (number == 11)
			{
				Jail(Player, param1, 360, 400);
				
				CPrintToChat(param1, "%s {blue}Vous avez emprisonner {green}%N {blue}pendant 6H pour {green}Possession d'armes illégale", LOGO, Player);
				CPrintToChat(Player, "%s {red}Vous avez été emprisonner {red}6H{blue} par {green}%N {blue}pour {green}Possession d'armes illégale", LOGO, param1);
			}
			if (number == 12)
			{
				Jail(Player, param1, 700, 450);
				
				CPrintToChat(param1, "%s {blue}Vous avez emprisonner {green}%N {blue}pendant 12H pour {green}Evasion", LOGO, Player);
				CPrintToChat(Player, "%s {red}Vous avez été emprisonner {red}12H{blue} par {green}%N {blue}pour {green}Evasion", LOGO, param1);
			}
			if (number == 13)
			{
				Jail(Player, param1, 300, 100);
				
				CPrintToChat(param1, "%s {blue}Vous avez emprisonner {green}%N {blue}pendant 5H pour {green}Excès de vitesse", LOGO, Player);
				CPrintToChat(Player, "%s {red}Vous avez été emprisonner {red}5H{blue} par {green}%N {blue}pour {green}Excès de vitesse", LOGO, param1);
			}
			if (number == 14)
			{
				Jail(Player, param1, 360, 200);
				
				CPrintToChat(param1, "%s {blue}Vous avez emprisonner {green}%N {blue}pendant 6H pour {green}Intrusion poste de police", LOGO, Player);
				CPrintToChat(Player, "%s {red}Vous avez été emprisonner {red}6H{blue} par {green}%N {blue}pour {green}Intrusion poste de police", LOGO, param1);
			}
			if (number == 15)
			{
				Jail(Player, param1, 240, 100);
				
				CPrintToChat(param1, "%s {blue}Vous avez emprisonner {green}%N {blue}pendant 4H pour {green}Vente de produits illicites", LOGO, Player);
				CPrintToChat(Player, "%s {red}Vous avez été emprisonner {red}4H{blue} par {green}%N {blue}pour {green}Vente de produits illicites", LOGO, param1);
			}
			if (number == 16)
			{
				Jail(Player, param1, 360, 100);
				
				CPrintToChat(param1, "%s {blue}Vous avez emprisonner {green}%N {blue}pendant 6H pour {green}Tir dans la rue.", LOGO, Player);
				CPrintToChat(Player, "%s {red}Vous avez été emprisonner {red}6H{blue} par {green}%N {blue}pour {green}Tir dans la rue.", LOGO, param1);
			}
		}
	}
	else
	{
		if (action == MenuAction_End)
		{
			CloseHandle(jail_menu);
		}
	}
	
	return 0;
}

FreePlayer(client)
{
	if (IsClientInGame(client))
	{
		switch (GetRandomInt(1, 8))
		{
			case 1:
			{
				TeleportEntity(client, Float:{ -2581.678467, -1791.184082, 137.912918 }, NULL_VECTOR, NULL_VECTOR);
			}
			
			case 2:
			{
				TeleportEntity(client, Float:{ -1599.428223, -4404.757324, 259.253052 }, NULL_VECTOR, NULL_VECTOR);
			}
			
			case 3:
			{
				TeleportEntity(client, Float:{ 172.541519, -46.760689, 131.462662 }, NULL_VECTOR, NULL_VECTOR);
			}
			
			case 4:
			{
				TeleportEntity(client, Float:{ -940.955505, 701.653381, 131.144333 }, NULL_VECTOR, NULL_VECTOR);
			}
			
			case 5:
			{
				TeleportEntity(client, Float:{ -3714.813232, 522.385925, 125.333511 }, NULL_VECTOR, NULL_VECTOR);
			}
			
			case 6:
			{
				TeleportEntity(client, Float:{ -2523.958984, -2796.985596, 137.953766 }, NULL_VECTOR, NULL_VECTOR);
			}
			
			case 7:
			{
				TeleportEntity(client, Float:{ -3072.021484, -5174.543945, 289.349670 }, NULL_VECTOR, NULL_VECTOR);
			}
			
			case 8:
			{
				TeleportEntity(client, Float:{ -236.834076, -3933.128174, 148.608978 }, NULL_VECTOR, NULL_VECTOR);
			}
		}
		
		SetClientListeningFlags(client, VOICE_NORMAL);
		
		g_jailtime[client] = 0;
		g_IsInJail[client] = 0;
		
		choose_skin(client);
		
		disarm(client);
		GivePlayerItem(client, "weapon_knife");
		
		CPrintToChat(client, "%s {blue}Vous êtes {green}Libre !", LOGO);
	}
}

GoJail(client)
{
	if (IsPlayerAlive(client))
	{
		switch (GetRandomInt(1, 3))
		{
			case 1:
			{
				TeleportEntity(client, Float:{ 1049.312012, 1431.228271, -161.906616 }, NULL_VECTOR, NULL_VECTOR);
			}
			
			case 2:
			{
				TeleportEntity(client, Float:{ 1040.158813, 1921.682251, -170.400467 }, NULL_VECTOR, NULL_VECTOR);
			}
			
			case 3:
			{
				TeleportEntity(client, Float:{ 1301.268066, 1436.459229, -152.211502 }, NULL_VECTOR, NULL_VECTOR);
			}
		}
	}
}

Jail(Player, Cop, Time, Amende)
{
	decl String:ItemAccepter[32];
	decl String:ItemRefuser[32];
	
	if (IsClientInGame(Player))
	{
		g_jailtime[Player] = Time;
		new Handle:caution_menu = CreateMenu(Menu_Caution);
		SetMenuTitle(caution_menu, "Votre caution s'élève à %i€. Voulez-vous la payer?", Amende);
		
		Format(ItemAccepter, sizeof(ItemAccepter), "%i_%i_%i_a", Cop, Time, Amende);
		AddMenuItem(caution_menu, ItemAccepter, "Accepter de payer la caution.");
		
		Format(ItemRefuser, sizeof(ItemRefuser), "%i_%i_%i_r", Cop, Time, Amende);
		AddMenuItem(caution_menu, ItemRefuser, "Refuser de payer la caution.");
		
		SetMenuExitButton(caution_menu, false);
		
		DisplayMenu(caution_menu, Player, MENU_TIME_FOREVER);
		
		disarm(Player);
		GivePlayerItem(Player, "weapon_knife");
		
		LogToFile(Logfile,"%N se fait jail par %N (Temps : %i || Ammende : %i)", Player, Cop, Time, Amende);
	}
}

public Menu_Caution(Handle:caution_menu, MenuAction:action, param1, param2)
{
	if (action == MenuAction_Select)
	{
		new Cop = 0;
		new Time = 0;
		new Amende = 0;
		
		decl String:info[32];
		GetMenuItem(caution_menu, param2, info, sizeof(info));
		
		decl String:Buffer[16][32];
		
		ExplodeString(info, "_", Buffer, 4, 32);
		
		Cop = StringToInt(Buffer[0]);
		Time = StringToInt(Buffer[1]);
		Amende = StringToInt(Buffer[2]);
		
		if (Cop > 0 && param1 > 0)
		{
			if (StrEqual(Buffer[3], "a"))
			{
				new total = money[param1] - Amende;
				
				new totalbank = bank[param1] - Amende;
				
				if (0 <= total)
				{
					new after = money[param1];
					money[param1] = after - Amende;
					
					new afterr = money[Cop];
					money[Cop] = Amende / 2 + afterr;
					
					new afterrr = capital[1];
					capital[1] = Amende / 2 + afterrr;
					
					g_jailtime[param1] = Time / 2;
					
					CPrintToChat(param1, "%s{blue}Vous avez payer une amende de {green}%i€{blue}. Vous ne purgerez que la moitié de votre peine.", LOGO, Amende);
					CPrintToChat(Cop, "%s {green}%N {blue}paye une amande de {green}%i", LOGO, param1, Amende);
				}
				else
				{
					if (0 <= totalbank)
					{
						new later = bank[param1];
						bank[param1] = later - Amende;
						
						new laterr = money[Cop];
						money[Cop] = Amende / 2 + laterr;
						
						new capi = capital[1];
						capital[1] = Amende / 2 + capi;
						
						g_jailtime[param1] = Time / 2;
						
						CPrintToChat(param1, "%s{blue}Vous avez payer une amende de {green}%i€{blue}. Vous ne purgerez que la moitié de votre peine.", LOGO, Amende);
						CPrintToChat(Cop, "%s {green}%N {blue}paye une amande de {green}%i", LOGO, param1, Amende);
					}
				}
			}
			else if (StrEqual(Buffer[3], "r"))
			{
				CPrintToChat(param1, "%s {red}Vous avez refusé de payer votre caution !", LOGO);
				CPrintToChat(Cop, "%s {green}%N{red} refuse de payer sa caution.", LOGO, param1);
			}
		}
	}
	else
	{
		if (action == MenuAction_End)
		{
			CloseHandle(caution_menu);
		}
	}
}

public Action:Say(client, String:command[], args)
{
	if (client > 0)
	{
		if (!IsFakeClient(client))
		{
			decl String:Arg[256];
			GetCmdArgString(Arg, sizeof(Arg));
			StripQuotes(Arg);
			TrimString(Arg);
			
			decl String:JobName[20]; 
			GetJobName(jobid[client], rankid[client], JobName, sizeof(JobName));
			
			if (!IsPlayerAlive(client))
			{
				CPrintToChat(client, "%s {red} Vous devez être vivant afin de parler", LOGO);
				return Plugin_Handled;
			}
			if (g_IsInJail[client] == 1)
			{
				CPrintToChat(client, "%s {red} Vous ne pouvez pas parler car vous êtes en prison", LOGO);
				return Plugin_Handled;
			}
						
			if(Arg[0] == '/')
			{
				return Plugin_Handled;
			}
			
			if (StrEqual(Arg, "!vendre") || StrEqual(Arg, "!item") || StrEqual(Arg, "!lock") || StrEqual(Arg, "!unlock") || StrEqual(Arg, "!give"))
			{
				return Plugin_Handled;
			}
					
			if (Policier_TEMP[client])
			{
				CPrintToChatAll("{red}({blue}Policier-Temporaire{red})-{green}%N :{default} %s", client, Arg);
				return Plugin_Handled;
			}
			else
			{
				CPrintToChatAll("{red}({blue}%s{red})-{green}%N :{default} %s", JobName, client, Arg);
				return Plugin_Handled;
			}
		}
	}
	
	return Plugin_Handled;
}

public DestroyLevel(client)
{
	if (IsClientInGame(client))
	{
		new String:sWeaponName[64];
		GetClientWeapon(client, sWeaponName, sizeof(sWeaponName));
		
		if (StrEqual(sWeaponName, "weapon_knife"))
		{
			if (levelcut[client] > 0)
			{
				levelcut[client] = levelcut[client] - 1;
			}
		}
	}
}



public Action:Command_Ammo(client, args)
{
	if (IsClientInGame(client))
	{
		new String:SteamID[64];
		GetClientAuthString(client, SteamID, sizeof(SteamID));
		
		if (Chef_SERVEUR(client))
		{
			if (UnlimitedAmmo[client])
			{
				UnlimitedAmmo[client] = false;
				CPrintToChat(client, "%s Vous avez désactiver les munitions illimitées.", LOGO);
			}
			else
			{
				UnlimitedAmmo[client] = true;
				CPrintToChat(client, "%s Vous avez activer les munitions illimitées.", LOGO);
			}
		}
		else
		{
			CPrintToChat(client, "%s {red}Vous n'avez pas accès à cette commande.", LOGO);
		}
	}
	return Plugin_Continue;
}

public EventWeaponFire(Handle:event, String:name[], bool:dontBroadcast)
{
	new client = GetClientOfUserId(GetEventInt(event, "userid"));
	
	new String:sWeapon[32];
	
	if (client > 0 && client <= MaxClients)
	{
		GetClientWeapon(client, sWeapon, sizeof(sWeapon));
		
		if (GetClientTeam(client) == 2)
		{
			if (ACTIVE_ANTIFK == 1)
			{
				if (rankid[client] != 1)
				{
					if (StrEqual(sWeapon, "weapon_knife"))
					{
						if (levelcut[client] > 0)
						{
							if (!g_IsTazed[client])
							{
								g_countfire[client] += 1;
								
								if (g_countfire[client] >= 5)
								{
									new Float:entorigin[3], Float:clientent[3];
									GetEntPropVector(client, Prop_Send, "m_vecOrigin", entorigin);
									
									new maxent = GetMaxEntities(), String:Name[200];
						
									for (new i = MaxClients; i <= maxent; i++)
									{
										if(IsValidEdict(i) && IsValidEntity(i))
										{
											Entity_GetName(i, Name, sizeof(Name));
										
											if (StrEqual(Name, "hostage_npc"))
											{
												GetEntPropVector(i, Prop_Send, "m_vecOrigin", clientent);
											}
										}
									}
									
									new Float:distance = GetVectorDistance(clientent, entorigin);
										
									if (distance <= 1700)
									{
										g_countfire[client] = 0;
										
										CPrintToChat(client, "%s Vous venez de vous faire arrêté suite à des coups de couteau.", LOGO_FREEKILL);
										CPrintToChat(client, "%s Une amende de 200€ viens de vous être prélevée.", LOGO_FREEKILL);
										
										g_IsTazed[client] = true;
										g_Count[client] = 10.0;
										
										EmitSoundToAll(SOUND_TAZER, client, _, _, _, 1.0);
										clientent[2] += 45;
										entorigin[2] += 45;
										
										TE_SetupBeamPoints(clientent, entorigin, g_LightingSprite, 0, 1, 0, 1.0, 20.0, 0.0, 2, 5.0, greenColor, 3);
										TE_SendToAll();

										SetEntityMoveType(client, MOVETYPE_NONE);
										g_TazerTimer[client] = CreateTimer(1.0, DoTazerr, client);
										
										LogToFile(Logfile,"le joueur %N viens d'être arrêter par l'anti-freekill.", client);
										
										if (money[client] >= 200)
										{
											money[client] -= 200;
										}
										else if (bank[client] >= 200)
										{
											bank[client] -= 200;
										}
										else
										{
											CPrintToChat(client, "%s Vous n'avez pas assez d'argent pour payer, vous allez en jail.", LOGO_FREEKILL);
											GoJail(client);
											g_IsInJail[client] = 1;
											g_jailtime[client] = 400;
											choose_skin(client);
											SetClientListeningFlags(client, VOICE_MUTED);
											ModifySpeed(client, 1.0);
											SetEntityGravity(client, 1.0);
											SetEntityRenderColor(client, 255, 255, 255, 255);
										}
									}
								}
							}
						}
					}
					else
					{
						if (!g_IsTazed[client])
						{
							g_countfire[client] += 1;
							
							if (g_countfire[client] >= 5)
							{
								new Float:entorigin[3], Float:clientent[3];
								GetEntPropVector(client, Prop_Send, "m_vecOrigin", entorigin);
								
								new maxent = GetMaxEntities(), String:Name[200];
						
								for (new i = MaxClients; i <= maxent; i++)
								{
									if(IsValidEdict(i) && IsValidEntity(i))
									{
										Entity_GetName(i, Name, sizeof(Name));
									
										if (StrEqual(Name, "hostage_npc"))
										{
											GetEntPropVector(i, Prop_Send, "m_vecOrigin", clientent);
										}
									}
								}
								
								new Float:distance = GetVectorDistance(clientent, entorigin);
									
								if (distance <= 1700)
								{
									g_countfire[client] = 0;
									disarm(client);
									GivePlayerItem(client, "weapon_knife");
									
									CPrintToChat(client, "%s {red}Merci de ne pas trop tirer en ville !", LOGO_FREEKILL);
									CPrintToChat(client, "%s {red}Le serveur vous prends {green}500€ d'ammende", LOGO_FREEKILL);
									
									LogToFile(Logfile,"le joueur %N viens d'être arrêter par l'anti-freekill.", client);
									
									g_IsTazed[client] = true;
									g_Count[client] = 10.0;
									
									EmitSoundToAll(SOUND_TAZER, client, _, _, _, 1.0);
									clientent[2] += 45;
									entorigin[2] += 45;
									
									TE_SetupBeamPoints(clientent, entorigin, g_LightingSprite, 0, 1, 0, 1.0, 20.0, 0.0, 2, 5.0, greenColor, 3);
									TE_SendToAll();

									SetEntityMoveType(client, MOVETYPE_NONE);
									g_TazerTimer[client] = CreateTimer(1.0, DoTazerr, client);
									
									if (money[client] >= 500)
									{
										money[client] -= 500;
									}
									else if (bank[client] >= 500)
									{
										bank[client] -= 500;
									}
									else
									{
										CPrintToChat(client, "%s Vous n'avez pas assez d'argent pour payer, vous allez en jail.", LOGO_FREEKILL);
										GoJail(client);
										g_IsInJail[client] = 1;
										g_jailtime[client] = 600;
										choose_skin(client);
										SetClientListeningFlags(client, VOICE_MUTED);
										ModifySpeed(client, 1.0);
										SetEntityGravity(client, 1.0);
										SetEntityRenderColor(client, 255, 255, 255, 255);
									}
								}
							}
						}
					}
				}
			}
		}
	}
	if (UnlimitedAmmo[client])
	{
		Client_ResetAmmo(client);
	}			
	if (permisleger[client] == 0)
	{
		if (!StrEqual(sWeapon, "weapon_knife"))
		{
			CreateTimer(0.01, TimerRecoil, client);
			PrintHintText(client, "Veuillez acheter des permis afin de mieux viser !");
		}
	}
}

public Client_ResetAmmo(client)
{
	new zomg = GetEntDataEnt2(client, activeOffset);

	if (clip1Offset != -1)
	{
		SetEntData(zomg, clip1Offset, 200, 4, true);
	}

	if (clip2Offset != -1)
	{
		SetEntData(zomg, clip2Offset, 200, 4, true);
	}

	if (priAmmoTypeOffset != -1)
	{
		SetEntData(zomg, priAmmoTypeOffset, 200, 4, true);
	}

	if (secAmmoTypeOffset != -1)
	{
		SetEntData(zomg, secAmmoTypeOffset, 200, 4, true);
	}
}

public Action:Command_JobList(client, Args)
{
	if (IsClientInGame(client))
	{
		decl String:JLName[64];
		decl String:iString[12];
		decl String:jobss[40];
		
		new Handle:Joblist = CreateMenu(Menu_JobList);
		SetMenuTitle(Joblist, "Liste des joueurs et leurs jobs :\n");
		
		for (new i = 1; i <= MaxClients; i++)
		{
			if (IsClientInGame(i))
			{
				IntToString(i, iString, sizeof(iString));
				GetJobName(jobid[i], rankid[i], jobss, sizeof(jobss));
				
				if (rankid[i] == 1 && GetClientTeam(i) == 2)
				{
					Format(JLName, sizeof(JLName), "%N : Chômeur", i);
				}
				else
				{
					if (g_IsInJail[i] == 1)
					{
						Format(JLName, sizeof(JLName), "%N: %s - En prison", i, jobss);
					}
					Format(JLName, sizeof(JLName), "%N: %s", i, jobss);
				}
				
				AddMenuItem(Joblist, iString, JLName, ITEMDRAW_DISABLED);
			}
		}
		DisplayMenu(Joblist, client, MENU_TIME_FOREVER);
	}
}

public Menu_JobList(Handle:Joblist, MenuAction:action, param1, param2)
{
	if (action == MenuAction_End)
	{
		CloseHandle(Joblist);
	}
}

public Action:Command_Jugement(client, Args)
{
	if (IsClientInGame(client))
	{
		if (rankid[client] == 10 && jobid[client] != 3)
		{
			new Ent = GetClientAimTarget(client, true);
			
			if (Ent != -1)
			{
				if (IsInTribunal(client) && IsInTribunal(Ent))
				{
					if (GetClientTeam(Ent) == 2)
					{
						decl String:Buffer[32];
						new Handle:Jugement = CreateMenu(Menu_Jugement);
						SetMenuTitle(Jugement, "Choissisez un jugement :");
						
						if (0 < g_jailtime[Ent])
						{
							Format(Buffer, sizeof(Buffer), "%i_1", Ent);
							AddMenuItem(Jugement, Buffer, "Relâcher le joueur");
							
							Format(Buffer, sizeof(Buffer), "%i_2", Ent);
							AddMenuItem(Jugement, Buffer, "Réduire le temps de prison de moitié");
							
							Format(Buffer, sizeof(Buffer), "%i_3", Ent);
							AddMenuItem(Jugement, Buffer, "Doubler le temps de prison");
						}
						
						Format(Buffer, sizeof(Buffer), "%i_4", Ent);
						AddMenuItem(Jugement, Buffer, "Emprisonner le joueur 4H");
						
						Format(Buffer, sizeof(Buffer), "%i_5", Ent);
						AddMenuItem(Jugement, Buffer, "Emprisonner le joueur 6H");
						
						Format(Buffer, sizeof(Buffer), "%i_9", Ent);
						AddMenuItem(Jugement, Buffer, "Emprisonner le joueur 8H");
						
						Format(Buffer, sizeof(Buffer), "%i_6", Ent);
						AddMenuItem(Jugement, Buffer, "Emprisonner le joueur 12H");
						
						Format(Buffer, sizeof(Buffer), "%i_10", Ent);
						AddMenuItem(Jugement, Buffer, "Emprisonner le joueur 16H");
						
						Format(Buffer, sizeof(Buffer), "%i_7", Ent);
						AddMenuItem(Jugement, Buffer, "Emprisonner le joueur 24H");
						
						Format(Buffer, sizeof(Buffer), "%i_8", Ent);
						AddMenuItem(Jugement, Buffer, "Emprisonner le joueur 48H");
						
						DisplayMenu(Jugement, client, MENU_TIME_FOREVER);
					}
					else
					{
						CPrintToChat(client, "%s Vous ne pouvez pas juger un membre du gouvernement.", LOGO);
					}
				}
				else
				{
					CPrintToChat(client, "%s Vous et la cible devez être dans le tribunal pour rendre un jugement.", LOGO);
				}
			}
			else
			{
				CPrintToChat(client, "%s Vous devez viser un joueur.", LOGO);
			}
		}
		else
		{
			CPrintToChat(client, "%s {red}Vous n'avez pas accès à cette commande.", LOGO);
		}
	}
	return Plugin_Continue;
}

public Menu_Jugement(Handle:Jugement, MenuAction:action, param1, param2)
{
	if (param1 > 0 && IsClientInGame(param1))
	{
		if (action == MenuAction_Select)
		{
			decl String:info[32];
			GetMenuItem(Jugement, param2, info, sizeof(info));
			
			decl String:Buffer[8][32];
			ExplodeString(info, "_", Buffer, 2, 32);
			
			new cible = StringToInt(Buffer[0]);
			
			if (cible)
			{
				if (StrEqual(Buffer[1], "1"))
				{
					g_jailtime[cible] = 0;
					FreePlayer(cible);
					g_IsInJail[cible] = 0;
					CPrintToChatAll("%s Le Juge %N a décidé de relâcher %N !", LOGO, param1, cible);
				}
				if (StrEqual(Buffer[1], "2"))
				{
					new later = g_jailtime[cible];
					g_jailtime[cible] = later / 2;
					
					GoJail(cible);
					
					CPrintToChatAll("%s Le Juge %N a décidé de réduire la peine de %N de moitié.", LOGO, param1, cible);
				}
				if (StrEqual(Buffer[1], "3"))
				{
					new after = g_jailtime[cible];
					g_jailtime[cible] = after * 2;
					
					GoJail(cible);
					
					CPrintToChatAll("%s Le Juge %N a décidé de doubler la peine de %N.", LOGO, param1, cible);
				}
				if (StrEqual(Buffer[1], "4"))
				{
					g_jailtime[cible] = 240;
					g_IsInJail[cible] = 1;
					
					GoJail(cible);
					
					CPrintToChatAll("%s Le Juge %N a décidé d'emprisonner %N durant 4H.", LOGO, param1, cible);
				}
				if (StrEqual(Buffer[1], "5"))
				{
					g_jailtime[cible] = 360;
					g_IsInJail[cible] = 1;
					
					GoJail(cible);
					
					CPrintToChatAll("%s Le Juge %N a décidé d'emprisonner %N durant 6H.", LOGO, param1, cible);
				}
				if (StrEqual(Buffer[1], "6"))
				{
					g_jailtime[cible] = 720;
					g_IsInJail[cible] = 1;
					
					GoJail(cible);
					
					CPrintToChatAll("%s Le Juge %N a décidé d'emprisonner %N durant 12H.", LOGO, param1, cible);
				}
				if (StrEqual(Buffer[1], "7"))
				{
					g_jailtime[cible] = 1440;
					g_IsInJail[cible] = 1;
					
					GoJail(cible);
					
					CPrintToChatAll("%s Le Juge %N a décidé d'emprisonner %N durant 24H.", LOGO, param1, cible);
				}
				if (StrEqual(Buffer[1], "8"))
				{
					g_jailtime[cible] = 2880;
					g_IsInJail[cible] = 1;
					
					GoJail(cible);
					
					CPrintToChatAll("%s Le Juge %N a décidé d'emprisonner %N durant 48H.", LOGO, param1, cible);
				}
				
				if (StrEqual(Buffer[1], "9"))
				{
					g_jailtime[cible] = 480;
					g_IsInJail[cible] = 1;
					
					GoJail(cible);
					
					CPrintToChatAll("%s Le Juge %N a décidé d'emprisonner %N durant 8H.", LOGO, param1, cible);
				}
				
				if (StrEqual(Buffer[1], "10"))
				{
					g_jailtime[cible] = 960;
					g_IsInJail[cible] = 1;
					
					GoJail(cible);
					
					CPrintToChatAll("%s Le Juge %N a décidé d'emprisonner %N durant 16H.", LOGO, param1, cible);
				}
				
				capital[rankid[param1]] = capital[rankid[param1]] + 300;
				money[param1] = money[param1] + 300;
				
				choose_skin(cible);
				
				SetEntityMoveType(cible, MOVETYPE_WALK);
				SetClientListeningFlags(cible, VOICE_MUTED);
				
				disarm(cible);
				
				GivePlayerItem(cible, "weapon_knife");
			}
		}
		else
		{
			if (action == MenuAction_End)
			{
				CloseHandle(Jugement);
			}
		}
	}
}

public Action:Command_Contrat(client, Args)
{
	if (IsClientInGame(client))
	{
		if (IsPlayerAlive(client))
		{
			if (rankid[client] == 11)
			{
				new Ent = GetClientAimTarget(client, true);
				
				if (Ent != -1)
				{
					if (!encontrat[client])
					{
						if (rankid[Ent] != 1)
						{
							decl String:name[32];
							decl String:info[32];
							
							CommanditeurID[client] = Ent;
							
							new Handle:sell_menu_contrat = CreateMenu(Menu_Sell_Contrat);
							SetMenuTitle(sell_menu_contrat, "Sur quel joueur placez vous le contrat ?\n ");
							
							for (new i = 1; i <= MaxClients; i++)
							{
								if (IsClientInGame(i) && IsPlayerAlive(i))
								{
									if (rankid[i] != 11)
									{
										GetClientName(i, name, sizeof(name));
										IntToString(i, info, sizeof(info));
										
										AddMenuItem(sell_menu_contrat, info, name);
									}
								}
							}
							
							DisplayMenu(sell_menu_contrat, client, MENU_TIME_FOREVER);
						}
						else
						{
							CPrintToChat(Ent, "%s {red}Pas de contrat avec le gouvernement !", LOGO);
							CPrintToChat(client, "%s {red}Pas de contrat avec le gouvernement !", LOGO);
						}
					}
					else
					{
						CPrintToChat(client, "%s {red}Veuillez finir votre contrat !", LOGO);
					}
				}
				else
				{
					CPrintToChat(client, "%s {red}Merci de viser un Joueur !", LOGO);
				}
			}
			else
			{
				CPrintToChat(client, "%s {red}Vous devez être tueur", LOGO);
			}
		}
		else
		{
			CPrintToChat(client, "%s {red} Vous devez être vivant !", LOGO);
		}
	}
}

public Menu_Sell_Contrat(Handle:sell_menu_contrat, MenuAction:action, client, param2)
{
	if (action == MenuAction_Select)
	{
		decl String:info[256];
		
		GetMenuItem(sell_menu_contrat, param2, info, sizeof(info));
		
		TempCibleID[client] = StringToInt(info);
		
		BuildContratMenu(client);
	}
	else
	{
		if (action == MenuAction_End)
		{
			CloseHandle(sell_menu_contrat);
		}
	}
}

Handle:BuildContratMenu(client)
{
	if (client && IsClientInGame(client))
	{
		if (IsPlayerAlive(client))
		{
			if (TempCibleID[client] != 1)
			{
				if (rankid[TempCibleID[client]] == 1)
				{
					PriceContrat[client] = 1000;
				}
				else if (rankid[TempCibleID[client]] == 10)
				{
					PriceContrat[client] = 800;
				}
				else
				{
					PriceContrat[client] = 600;
				}
				
				decl String:ItemAccepter[12];
				decl String:ItemRefuser[12];
				
				new Handle:menu_sellContrat = CreateMenu(Menu_SellContrat);
				SetMenuTitle(menu_sellContrat, "%N vous propose de tuer %N pour %i€", client, TempCibleID[client], PriceContrat[client]);
				
				Format(ItemAccepter, sizeof(ItemAccepter), "%i_a", client);
				AddMenuItem(menu_sellContrat, ItemAccepter, "Accepter l'offre");
				
				Format(ItemRefuser, sizeof(ItemRefuser), "%i_r", client);
				AddMenuItem(menu_sellContrat, ItemRefuser, "Décliner l'offre");
				
				SetMenuExitButton(menu_sellContrat, false);
				
				DisplayMenu(menu_sellContrat, CommanditeurID[client], MENU_TIME_FOREVER);
			}
			else
			{
				CPrintToChat(client, "%s {red}Vous ne pouvez l'autotuer ^^", LOGO);
			}
		}
	}
}

public Menu_SellContrat(Handle:menu_sellContrat, MenuAction:action, client, param2)
{
	if (action == MenuAction_Select)
	{
		if (client && IsClientInGame(client))
		{
			new Tueur;
			
			decl String:info[32];
			GetMenuItem(menu_sellContrat, param2, info, sizeof(info));
			
			decl String:Buffer[8][32];
			ExplodeString(info, "_", Buffer, 2, 32);
			
			Tueur = StringToInt(Buffer[0]);
			
			if (Tueur != -1)
			{
				CommanditeurID[Tueur] = client;
			
				cibleID[Tueur] = TempCibleID[Tueur];
			
				if (StrEqual(Buffer[1], "a"))
				{
					new moneyCommanditeur;
					
					if (cb[client] == 1)
					{
						moneyCommanditeur = bank[client];
					}
					else
					{
						moneyCommanditeur = money[client];
					}
					
					new prix = PriceContrat[Tueur];
					
					if (moneyCommanditeur >= prix)
					{
						if (cb[client] == 1)
						{
							new after = bank[client];
							bank[client] = after - PriceContrat[Tueur];
						}
						else
						{
							new later = money[client];
							money[client] = later - PriceContrat[Tueur];
						}
						
						new capi = capital[11];
						capital[11] = (PriceContrat[Tueur] / 2) + capi;
						
						money[Tueur] += PriceContrat[Tueur] / 2;
						
						if (rankid[Tueur] == 11)
						{
							if (jobid[Tueur] == 1)
							{
								BoostDispo[Tueur] = 5;
							}
							else if (jobid[Tueur] == 2)
							{
								BoostDispo[Tueur] = 4;
							}
							else if (jobid[Tueur] == 3)
							{
								BoostDispo[Tueur] = 3;
							}
							else if (jobid[Tueur] == 4)
							{
								BoostDispo[Tueur] = 2;
							}
							else if (jobid[Tueur] == 5)
							{
								BoostDispo[Tueur] = 1;
							}
						}
						
						new Handle:MenuAmelioration = BuildChooseMenu(Tueur);
						
						DisplayMenu(MenuAmelioration, Tueur, MENU_TIME_FOREVER);
						
						CreateTimer(1.0, UpdateContrat, Tueur);
						
						encontrat[Tueur] = true;
						
						CPrintToChat(Tueur, "%s {green}%N {blue}Accepte votre contrat", LOGO, client);
						CPrintToChat(client, "%s {blue}Le contrat est accepté", LOGO);
					}
					else
					{
						CPrintToChat(Tueur, "%s {green}%N{red} n'as pas assez d'argent !", LOGO, client);
						CPrintToChat(client, "%s {red} Vous n'avez pas l'argent !", LOGO);
						
						TempCibleID[Tueur] = 0;
						cibleID[Tueur] = 0;
					}
				}
				if (StrEqual(Buffer[1], "r"))
				{
					CPrintToChat(Tueur, "%s {green}%N {red}Refuse votre contrat", LOGO, client);
					CPrintToChat(client, "%s {red}Vous avez refusé l'offre de {green}%N.", LOGO, Tueur);
					
					TempCibleID[Tueur] = 0;
					cibleID[Tueur] = 0;
				}
			}
		}
	}
	else
	{
		if (action == MenuAction_End)
		{
			CloseHandle(menu_sellContrat);
		}
	}
}

public Menu_ChooseBoost(Handle:menu_sellContrat, MenuAction:action, param1, param2)
{
	if (action == MenuAction_Select)
	{
		decl String:info[32];
		GetMenuItem(menu_sellContrat, param2, info, sizeof(info));
		
		if (StrEqual(info, "Deagle"))
		{
			GivePlayerItem(param1, "weapon_deagle");
			
			BoostDeagle[param1] = true;
		}
		if (StrEqual(info, "Vitesse"))
		{
			ModifySpeed(param1, 1.3);
			
			BoostVitesse[param1] = true;
		}
		if (StrEqual(info, "Vie"))
		{
			SetEntityHealth(param1, 150);
			
			BoostLife[param1] = true;
		}
		if (StrEqual(info, "Invisible"))
		{
			SetEntityRenderMode(param1, RENDER_GLOW);
			SetEntityRenderColor(param1, 255, 255,255,50);	
			
			BoostInvisi[param1] = true;
		}
		if (StrEqual(info, "Cut"))
		{
			levelcut[param1] = 100;
			
			BoostCut[param1] = true;
		}
		
		new actuel = BoostDispo[param1];
		BoostDispo[param1] = actuel - 1;
		
		new Handle:MenuAmelioration = BuildChooseMenu(param1);
		
		DisplayMenu(MenuAmelioration, param1, MENU_TIME_FOREVER);
	}
	else
	{
		if (action == MenuAction_End)
		{
			CloseHandle(menu_sellContrat);
		}
	}
}

public Action:UpdateContrat(Handle:timer, any:param1)
{
	if (param1 > 0 && IsClientInGame(param1))
	{
		new Price = PriceContrat[param1] / 2;
		
		if (cibleID[param1] > 0 && IsClientInGame(cibleID[param1]) && CommanditeurID[param1] > 0 && IsClientInGame(CommanditeurID[param1]))
		{
			if (IsPlayerAlive(param1))
			{
				if (g_jailtime[param1] == 0)
				{
					if (IsPlayerAlive(cibleID[param1]))
					{
						decl Float:tueur_vec[3];
						decl Float:cible_vec[3];
						
						GetClientAbsOrigin(param1, tueur_vec);
						GetClientAbsOrigin(cibleID[param1], cible_vec);
						
						new Float:test = tueur_vec[2];
						tueur_vec[2] = 40.0 + test;
						
						new Float:testt = cible_vec[2];
						cible_vec[2] = 40.0 + testt;
						
						TE_SetupBeamPoints(tueur_vec, cible_vec, g_modelLaser, g_modelHalo, 0, 1, 1.0, 10.0, 10.0, 1, 1.0, TAZER_COLORBLUE, 1);
						TE_SendToClient(param1);
						
						CreateTimer(1.0, UpdateContrat, param1);
					}
					else
					{
						if (HasKillCible[param1])
						{
							CPrintToChat(CommanditeurID[param1], "%s L'assassin a tué votre cible, contrat réussi.", LOGO);
							CPrintToChat(param1, "%s Vous avez tuer votre cible, contrat réussi.", LOGO);
							FinContrat(param1);
						}
						else
						{
							CPrintToChat(CommanditeurID[param1], "%s La cible est morte entre temps, contrat échoué.", LOGO);
							CPrintToChat(param1, "%s Votre cible est morte entre temps, contrat échoué.", LOGO);
							new avg = money[CommanditeurID[param1]];
							money[CommanditeurID[param1]] = avg + Price;
							FinContrat(param1);
						}
					}
				}
				else
				{
					CPrintToChat(CommanditeurID[param1], "%s L'assassin est en jail, contrat échoué.", LOGO);
					CPrintToChat(param1, "%s Vous êtes en jail, contrat échoué.", LOGO);
					new avg = money[CommanditeurID[param1]];
					money[CommanditeurID[param1]] = avg + Price;
					FinContrat(param1);
				}
			}
			else
			{
				CPrintToChat(CommanditeurID[param1], "%s L'assassin est mort, contrat échoué.", LOGO);
				CPrintToChat(param1, "%s Vous êtes mort, contrat échoué.", LOGO);
				new avg = money[CommanditeurID[param1]];
				money[CommanditeurID[param1]] = avg + Price;
				FinContrat(param1);
			}
		}
		else
		{
			CPrintToChat(param1, "%s Votre cible s'est déconnectée, contrat arrêté.", LOGO);
			CPrintToChat(CommanditeurID[param1], "%s La cible s'est déconnectée, contrat échoué.", LOGO);
			new avg = money[CommanditeurID[param1]];
			money[CommanditeurID[param1]] = avg + Price;
			
			FinContrat(param1);
		}
	}
	else
	{
		if (CommanditeurID[param1] > 0 && IsClientInGame(CommanditeurID[param1]))
		{
			CPrintToChat(CommanditeurID[param1], "%s %N s'est déconnecté, vous êtes donc remboursé une partie de la somme.", LOGO, param1);
			
			new avg = money[CommanditeurID[param1]];
			money[CommanditeurID[param1]] = avg + 200;
		}
	}
}

public Action:Cmd_TEST(client, args)
{
	if (MDP[client] == 1)
	{
		CPrintToChat(client, "%s {red}Veuillez déco reco !", LOGO);
	}
	else
	{
		CPrintToChat(client, "%s {blue}Votre ID unique : {green}%d", LOGO, MDP[client]);
	}
}

public Action:Cmd_PROPS(client, args)
{
	if (IsClientInGame(client))
	{
		if (rankid[client] == 1)
		{
			new Handle:menua = CreateMenu(Action_PROPS);
			SetMenuTitle(menua, "Menu des Props \n ");
			AddMenuItem(menua, "", "Ajouter un prop");
			AddMenuItem(menua, "", "Supprimer un prop");
			AddMenuItem(menua, "", "Freezer le PROP");
			AddMenuItem(menua, "", "Defreezer le PROP");
			DisplayMenu(menua, client, MENU_TIME_FOREVER);
		}
		else
		{
			CPrintToChat(client, "%s {red}Vous devez être de la police !", LOGO);
		}
	}
	else
	{
		CPrintToChat(client, "%s {red}Vous devez en vie", LOGO);
	}
}


public Action_PROPS(Handle:menu, MenuAction:action, client, Parameter)
{
	if (action == MenuAction_Select)
	{
		if(Parameter == 0)
		{
			new Handle:menua = CreateMenu(Action_PROPS_1);
			SetMenuTitle(menua, "Menu des Props \n ");
			AddMenuItem(menua, "", "Poteau");
			AddMenuItem(menua, "", "Pylône");
			AddMenuItem(menua, "", "Panneau STOP");
			AddMenuItem(menua, "", "Grilles");
			DisplayMenu(menua, client, MENU_TIME_FOREVER);
		}
		if(Parameter == 1)
		{
			new Ent;
			new String:Name[200];
			new String:Door[255];
			
			Ent = GetClientAimTarget(client, false);
			
			if (Ent != -1)
			{
				Entity_GetName(Ent, Name, sizeof(Name));
				GetEntityClassname(Ent, Door, sizeof(Door));
			
				if(StrContains(Name, "propolice_", true) != -1) 
				{	
					CPrintToChat(client, "%s {red}Le prop est {green}supprimé", LOGO);
					AcceptEntityInput(Ent, "Kill");
				}
				else
				{
					CPrintToChat(client, "%s {red}Veuillez viser un props de la police !", LOGO);
				}
			}
		}
		if(Parameter == 2)
		{
			new Ent;
			
			Ent = GetClientAimTarget(client, false);
			
			if (Ent != -1)
			{
				CPrintToChat(client, "%s {red}Le prop est {green}freezé", LOGO);
				AcceptEntityInput(Ent, "DisableMotion");
			}
		}
		if(Parameter == 3)
		{	
			new Ent;
			
			Ent = GetClientAimTarget(client, false);
			
			if (Ent != -1)
			{
				CPrintToChat(client, "%s {red}Le prop est {green}defreezé", LOGO);
				AcceptEntityInput(Ent, "EnableMotion");
			}
		}		
	}
}

public Action_PROPS_1(Handle:menu, MenuAction:action, client, Parameter)
{
	if (action == MenuAction_Select)
	{
		decl Float:position[3];
	
		if (GetPlayerEye(client, position))
		{
			decl String:Nom[256];
			decl String:Skin[1024];
			if(Parameter == 0)
			{
				Format(Nom, sizeof(Nom), "propolice_poteau");
				Format(Skin, sizeof(Skin), "models/props/cs_assault/pylon.mdl");
			}
			if(Parameter == 1)
			{
				Format(Nom, sizeof(Nom), "propolice_pylon");
				Format(Skin, sizeof(Skin), "models/props/cs_assault/pylon.mdl");
			}
			if(Parameter == 2)
			{
				Format(Nom, sizeof(Nom), "propolice_stop");
				Format(Skin, sizeof(Skin), "models/props/cs_assault/nostopssign.mdl");
			}
			if(Parameter == 3)
			{ 
				Format(Nom, sizeof(Nom), "propolice_grille");
				Format(Skin, sizeof(Skin), "models/props/de_train/chainlinkgate.mdl");
			}
			Props(position, Nom, Skin);
		}
	}
}

stock Props(Float:pos[3], String:nom[], String:model[])
{
	new Ent;
	PrecacheModel(model);
	Ent = CreateEntityByName("prop_physics_override", -1);
	DispatchKeyValue(Ent, "Solid", "6");
	DispatchKeyValue(Ent, "model", model);
	DispatchKeyValue(Ent, "targetname", nom);
	SetEntProp(Ent, Prop_Send, "m_CollisionGroup", 5);
	SetEntProp(Ent, Prop_Send, "m_usSolidFlags", 16);
	SetEntProp(Ent, Prop_Send, "m_nSolidType", 6);
	DispatchSpawn(Ent);
	SetEntProp(Ent, Prop_Data, "m_takedamage", 0, 1);	
	TeleportEntity(Ent, pos, NULL_VECTOR, NULL_VECTOR);
}

stock bool:GetPlayerEye(client, Float:pos[3])
{
	new Float:vAngles[3], Float:vOrigin[3];

	GetClientEyePosition(client, vOrigin);
	GetClientEyeAngles(client, vAngles);

	new Handle:trace = TR_TraceRayFilterEx(vOrigin, vAngles, MASK_SHOT, RayType_Infinite, TraceEntityFilterPlayer);

	if(TR_DidHit(trace))
	{
	 	TR_GetEndPosition(pos, trace);
		CloseHandle(trace);
		return (true);
	}

	CloseHandle(trace);
	return (false);
}

public FinContrat(client)
{
	if (IsClientInGame(client))
	{
		TempCibleID[client] = 0;
		cibleID[client] = 0;
		CommanditeurID[client] = 0;
		HasKillCible[client] = false;
		encontrat[client] = false;
		
		if (BoostDeagle[client])
		{
			disarm(client);
			
			GivePlayerItem(client, "weapon_knife");
			
			BoostDeagle[client] = false;
		}
		if (BoostVitesse[client])
		{
			ModifySpeed(client, 1.0);
			
			BoostVitesse[client] = false;
		}
		if (BoostLife[client])
		{
			SetEntityHealth(client, 100);
			
			BoostLife[client] = false;
		}
		if (BoostCut[client])
		{
			BoostCut[client] = false;
			
			levelcut[client] = 0;
		}
		if (BoostInvisi[client])
		{
			BoostInvisi[client] = false;
			
			SetEntityRenderMode(client, RENDER_NORMAL);
		}
	}
}

Handle:BuildChooseMenu(Tueur)
{
	new Handle:menu_ChooseBoost = CreateMenu(Menu_ChooseBoost);
	
	if (0 < BoostDispo[Tueur])
	{
		SetMenuTitle(menu_ChooseBoost, "Vous pouvez encore choisir %i améliorations:", BoostDispo[Tueur]);
		
		if (!BoostDeagle[Tueur])
		{
			AddMenuItem(menu_ChooseBoost, "Deagle", "Deagle");
		}
		if (!BoostVitesse[Tueur])
		{
			AddMenuItem(menu_ChooseBoost, "Vitesse", "Vitesse");
		}
		if (!BoostLife[Tueur])
		{
			AddMenuItem(menu_ChooseBoost, "Vie", "Vie Augmentée");
		}
		if (!BoostInvisi[Tueur])
		{
			AddMenuItem(menu_ChooseBoost, "Invisible", "Invisibilité");
		}
		if (!BoostCut[Tueur])
		{
			AddMenuItem(menu_ChooseBoost, "Cut", "Level Cut");
		}
	}
	return menu_ChooseBoost;
}

public Action:Command_Piratage(client, Args)
{
	if (IsClientInGame(client))
	{
		if (rankid[client] == 2)
		{
			Entiter[client] = GetClientAimTarget(client, false);
			
			new String:name[200];
			
			if (Entiter[client] != -1)
			{
				Entity_GetName(Entiter[client], name, sizeof(name));
				
				new timestamp;
				timestamp = GetTime();
				
				if ((timestamp - g_piratage[client]) < 40)
				{
					CPrintToChat(client, "%s Vous devez attendre %i secondes avant de pouvoir pirater un distributeur.", LOGO, (40 - (timestamp - g_piratage[client])) );
				}
				else
				{
					if ((StrEqual(name, "distribrp")) || (StrEqual(name, "distribarmu")))
					{
						new Float:entorigin[3], Float:clientent[3];
						GetEntPropVector(Entiter[client], Prop_Send, "m_vecOrigin", entorigin);
						GetEntPropVector(client, Prop_Send, "m_vecOrigin", clientent);
						new Float:distance = GetVectorDistance(entorigin, clientent);
						new Float:vec[3];
						GetClientAbsOrigin(client, vec);
						vec[2] += 10;
						
						if (distance > 100)
						{
							CPrintToChat(client, "%s {red}Vous êtes trop loin pour pirater ce distributeur.", LOGO);
						}
						else
						{
							g_piratage[client] = GetTime();
							
							SetEntPropFloat(client, Prop_Send, "m_flProgressBarStartTime", GetGameTime()); 
							SetEntProp(client, Prop_Send, "m_iProgressBarDuration", 15);
							
							g_croche[client] = CreateTimer(15.0, Crochetage2, client, TIMER_REPEAT);
							
							SetEntityRenderColor(client, 255, 0, 0, 0);
							SetEntityMoveType(client, MOVETYPE_NONE);
							
							TE_SetupBeamRingPoint(vec, 5.0, 800.0, g_modelLaser, g_modelHalo, 0, 15, 0.6, 15.0, 0.0, redColor, 10, 0);
							TE_SendToAll();
							
							CPrintToChat(client, "%s {red}Piratage en cours ...", LOGO);
							
							g_crochetageon[client] = true;
							
							for (new i = 1; i <= MaxClients; i++)
							{
								if (IsClientInGame(i) && GetClientTeam(i) == 3)
								{
									CPrintToChat(i, "%s {red}Un distributeur est en cours de piratage !", LOGO);
								}
							}
						}
					}
					else
					{
						CPrintToChat(client, "%s {red}Veuillez viser un distrib !", LOGO);
					}
				}
			}
			else
			{
				CPrintToChat(client, "%s {red}Veuillez viser un distrib !", LOGO);
			}
		}
		else
		{
			CPrintToChat(client, "%s {red}Vous n'avez pas accès à cette commande !", LOGO);
		}
	}
}

public Action:Crochetage2(Handle:timer, any:client)
{
	if (IsClientInGame(client))
	{
		if (IsPlayerAlive(client))
		{
			new random = GetRandomInt(1, 200);
			
			switch (GetRandomInt(1, 3))
			{
				case 1:
				{
					CPrintToChat(client, "%s {blue}Vous avez piraté le distributeur ! Vous gagnez {green}%i€.", LOGO, random);
	
					money[client] = money[client] + random;
				
					SetEntityMoveType(client, MOVETYPE_WALK);
					SetEntityRenderColor(client, 255, 255, 255, 255);
				
					g_crochetageon[client] = false;
					
					capital[rankid[client]] = capital[rankid[client]] + 200;
				}
			
				case 2:
				{
					CPrintToChat(client, "%s {red}Vous avez échoué le piratage.", LOGO);
						
					SetEntityMoveType(client, MOVETYPE_WALK);
					SetEntityRenderColor(client, 255, 255, 255, 255);
					
					g_crochetageon[client] = false;
				}
				
				case 3:
				{
					CPrintToChat(client, "%s {red}Vous avez échoué le piratage.", LOGO);
			
					SetEntityMoveType(client, MOVETYPE_WALK);
					SetEntityRenderColor(client, 255, 255, 255, 255);
					
					g_crochetageon[client] = false;
				}
			}
			
			SetEntPropFloat(client, Prop_Send, "m_flProgressBarStartTime", GetGameTime()); 
			SetEntProp(client, Prop_Send, "m_iProgressBarDuration", 0);
			
			KillTimer(g_croche[client]);
		}
	}
}

public Action:Command_Transform(client, Args)
{
	if (IsClientInGame(client))
	{
		if (rankid[client] == 7)
		{
			new Ent = GetClientAimTarget(client, true);
			
			if (Ent != -1)
			{
				decl Float:client_vec[3];
				decl Float:plyr_vec[3];
				
				new Float:dist_vec;
				
				GetClientAbsOrigin(Ent, plyr_vec);
				GetClientAbsOrigin(client, client_vec);
				
				dist_vec = GetVectorDistance(plyr_vec, client_vec);
				
				if (dist_vec < 100)
				{
					decl String:WeaponName[32];
					Client_GetActiveWeaponName(Ent, WeaponName, sizeof(WeaponName));
					
					new weapon = Client_GetActiveWeapon(Ent);
					
					if (weapon != -1)
					{
						if (!StrEqual(WeaponName, "weapon_knife"))
						{
							new Prix = GetWeaponPrice(WeaponName);
							decl String:ItemAccepter[12];
							decl String:ItemRefuser[12];
							
							new Handle:menu_Sell_Transform = CreateMenu(Menu_SellTransform);
							SetMenuTitle(menu_Sell_Transform, "%N vous propose de transformer votre arme en objet pour %i€", client, Prix);
							
							Format(ItemAccepter, sizeof(ItemAccepter), "%i_a", client);
							AddMenuItem(menu_Sell_Transform, ItemAccepter, "Accepter l'offre");
							
							Format(ItemRefuser, sizeof(ItemRefuser), "%i_r", client);
							AddMenuItem(menu_Sell_Transform, ItemRefuser, "Décliner l'offre");
							
							DisplayMenu(menu_Sell_Transform, Ent, 30);
							
							CPrintToChat(client, "%s Vous avez proposer à %N de ranger son arme pour %i€", LOGO, Ent, Prix);
						}
						else
						{
							CPrintToChat(client, "%s Vous ne pouvez pas ranger votre cut.", LOGO);
						}
					}
				}
				else
				{
					CPrintToChat(client, "%s Vous êtes trop loin du joueur.", LOGO);
				}
			}
			else
			{
				CPrintToChat(client, "%s Vous devez viser un joueur.", LOGO);
			}
		}
		else
		{
			CPrintToChat(client, "%s {red}Vous n'avez pas accès à cette commande.", LOGO);
		}
	}
	
	return Plugin_Continue;
}

public Menu_SellTransform(Handle:menu_Sell_Transform, MenuAction:action, param1, param2)
{
	if (action == MenuAction_Select)
	{
		new Vendeur;
		
		decl String:info[64];
		GetMenuItem(menu_Sell_Transform, param2, info, sizeof(info));
		
		decl String:Buffer[8][64];
		ExplodeString(info, "_", Buffer, 2, 64);
		
		Vendeur = StringToInt(Buffer[0]);
		
		if (StrEqual(Buffer[1], "a"))
		{
			decl String:WeaponName[32];
			Client_GetActiveWeaponName(param1, WeaponName, sizeof(WeaponName));
			
			new weapon = Client_GetActiveWeapon(param1);

			if (weapon != -1)
			{
				new Prix = GetWeaponPrice(WeaponName);
				
				new amount;
				
				if (cb[param1] == 1)
				{
					amount = bank[param1] - Prix;
				}
				else
				{
					amount = money[param1] - Prix;
				}
				
				if (0 <= amount)
				{
					if (cb[param1] == 1)
					{
						new after = bank[param1];
						bank[param1] = after - Prix;
					}
					else
					{
						new later = money[param1];
						money[param1] = later - Prix;
					}
					
					new xdd = money[Vendeur];
					money[Vendeur] = Prix / 2 + xdd;
					
					new lool = capital[7];
					capital[7] = Prix / 2 + lool;
					
					RemoveEdict(weapon);
					
					Client_ChangeToLastWeapon(param1);
					
					GiveTransformItem(param1, WeaponName);
					
					CPrintToChat(param1, "%s Vous avez demander à %N de ranger votre arme pour %i€", LOGO, Vendeur, Prix);
					CPrintToChat(Vendeur, "%s Vous avez ranger l'arme de %N", LOGO, param1);
				}
				else
				{
					CPrintToChat(Vendeur, "%s %N n'as pas assez d'argent pour finaliser la transaction.", LOGO, param1);
					CPrintToChat(param1, "%s Vous n'avez pas l'argent nécessaire pour finaliser la transaction.", LOGO);
				}
			}
			else
			{
				CPrintToChat(param1, "%s Vous ne pouvez pas ranger un couteau.", LOGO);
				CPrintToChat(Vendeur, "%s Le client ne peut pas ranger un couteau.", LOGO);
			}
		}
		if (StrEqual(Buffer[1], "r"))
		{
			CPrintToChat(Vendeur, "%s %N a refuser votre offre.", LOGO, param1);
			CPrintToChat(param1, "%s Vous avez refuser l'offre de %N.", LOGO, Vendeur);
		}
	}
	else
	{
		if (action == MenuAction_End)
		{
			CloseHandle(menu_Sell_Transform);
		}
	}
}

public GetWeaponPrice(String:sWeaponName[])
{
	new iPrice;
	
	if (StrEqual(sWeaponName, "weapon_glock"))
	{
		iPrice = 50;
	}
	else if (StrEqual(sWeaponName, "weapon_usp"))
	{
		iPrice = 50;
	}
	else if (StrEqual(sWeaponName, "weapon_p228"))
	{
		iPrice = 63;
	}
	else if (StrEqual(sWeaponName, "weapon_deagle"))
	{
		iPrice = 100;
	}
	else if (StrEqual(sWeaponName, "weapon_elite"))
	{
		iPrice = 125;
	}
	else if (StrEqual(sWeaponName, "weapon_fiveseven"))
	{
		iPrice = 90;
	}
	else if (StrEqual(sWeaponName, "weapon_m3"))
	{
		iPrice = 200;
	}
	else if (StrEqual(sWeaponName, "weapon_xm1014"))
	{
		iPrice = 300;
	}
	else if (StrEqual(sWeaponName, "weapon_galil"))
	{
		iPrice = 200;
	}
	else if (StrEqual(sWeaponName, "weapon_ak47"))
	{
		iPrice = 300;
	}
	else if (StrEqual(sWeaponName, "weapon_scout"))
	{
		iPrice = 325;
	}
	else if (StrEqual(sWeaponName, "weapon_sg552"))
	{
		iPrice = 250;
	}
	else if (StrEqual(sWeaponName, "weapon_awp"))
	{
		iPrice = 500;
	}
	else if (StrEqual(sWeaponName, "weapon_g3sg1"))
	{
		iPrice = 500;
	}
	else if (StrEqual(sWeaponName, "weapon_famas"))
	{
		iPrice = 225;
	}
	else if (StrEqual(sWeaponName, "weapon_m4a1"))
	{
		iPrice = 300;
	}
	else if (StrEqual(sWeaponName, "weapon_aug"))
	{
		iPrice = 250;
	}
	else if (StrEqual(sWeaponName, "weapon_sg550"))
	{
		iPrice = 500;
	}
	else if (StrEqual(sWeaponName, "weapon_mac10"))
	{
		iPrice = 150;
	}
	else if (StrEqual(sWeaponName, "weapon_tmp"))
	{
		iPrice = 150;
	}
	else if (StrEqual(sWeaponName, "weapon_mp5"))
	{
		iPrice = 200;
	}
	else if (StrEqual(sWeaponName, "weapon_ump45"))
	{
		iPrice = 350;
	}
	else if (StrEqual(sWeaponName, "weapon_p90"))
	{
		iPrice = 225;
	}
	else if (StrEqual(sWeaponName, "weapon_m249"))
	{
		iPrice = 625;
	}
	else if (StrEqual(sWeaponName, "weapon_hegrenade"))
	{
		iPrice = 50;
	}
	else if (StrEqual(sWeaponName, "weapon_smokegrenade"))
	{
		iPrice = 50;
	}
	else if (StrEqual(sWeaponName, "weapon_flashbang"))
	{
		iPrice = 50;
	}
	
	return iPrice;
}

public GiveTransformItem(client, String:sWeaponName[])
{
	if (StrEqual(sWeaponName, "weapon_glock"))
	{
		glock[client] = glock[client] + 1;
	}
	
	if (StrEqual(sWeaponName, "weapon_usp"))
	{
		usp[client] = usp[client] + 1;
	}
	
	if (StrEqual(sWeaponName, "weapon_p228"))
	{
		p228[client] = p228[client] + 1;
	}
	
	if (StrEqual(sWeaponName, "weapon_deagle"))
	{
		deagle[client] = deagle[client] + 1;
	}
	
	if (StrEqual(sWeaponName, "weapon_elite"))
	{
		elites[client] = elites[client] + 1;
	}
	
	if (StrEqual(sWeaponName, "weapon_fiveseven"))
	{
		fiveseven[client] = fiveseven[client] + 1;
	}
	
	if (StrEqual(sWeaponName, "weapon_m3"))
	{
		m3[client] = m3[client] + 1;
	}
	
	if (StrEqual(sWeaponName, "weapon_xm1014"))
	{
		xm1014[client] = xm1014[client] + 1;
	}
	
	if (StrEqual(sWeaponName, "weapon_galil"))
	{
		galil[client] = galil[client] + 1;
	}
	
	if (StrEqual(sWeaponName, "weapon_ak47"))
	{
		ak47[client] = ak47[client] + 1;
	}
	
	if (StrEqual(sWeaponName, "weapon_scout"))
	{
		scout[client] = scout[client] + 1;
	}
	
	if (StrEqual(sWeaponName, "weapon_sg552"))
	{
		sg552[client] = sg552[client] + 1;
	}
	
	if (StrEqual(sWeaponName, "weapon_awp"))
	{
		awp[client] = awp[client] + 1;
	}
	
	if (StrEqual(sWeaponName, "weapon_g3sg1"))
	{
		g3sg1[client] = g3sg1[client] + 1;
	}
	
	if (StrEqual(sWeaponName, "weapon_famas"))
	{
		famas[client] = famas[client] + 1;
	}
	
	if (StrEqual(sWeaponName, "weapon_m4a1"))
	{
		m4a1[client] = m4a1[client] + 1;
	}
	
	if (StrEqual(sWeaponName, "weapon_aug"))
	{
		aug[client] = aug[client] + 1;
	}
	
	if (StrEqual(sWeaponName, "weapon_sg550"))
	{
		sg550[client] = sg550[client] + 1;
	}
	
	if (StrEqual(sWeaponName, "weapon_mac10"))
	{
		mac10[client] = mac10[client] + 1;
	}
	
	if (StrEqual(sWeaponName, "weapon_tmp"))
	{
		tmp[client] = tmp[client] + 1;
	}
	
	if (StrEqual(sWeaponName, "weapon_mp5"))
	{
		mp5[client] = mp5[client] + 1;
	}
	
	if (StrEqual(sWeaponName, "weapon_ump45"))
	{
		ump45[client] = ump45[client] + 1;
	}
	
	if (StrEqual(sWeaponName, "weapon_p90"))
	{
		p90[client] = p90[client] + 1;
	}
	
	if (StrEqual(sWeaponName, "weapon_m249"))
	{
		m249[client] = m249[client] + 1;
	}
	
	if (StrEqual(sWeaponName, "weapon_hegrenade"))
	{
		grenade[client] = grenade[client] + 1;
	}
	
	if (StrEqual(sWeaponName, "weapon_smokegrenade"))
	{
		fumigene[client] = fumigene[client] + 1;
	}
	
	if (StrEqual(sWeaponName, "weapon_flashbang"))
	{
		flashbang[client] = flashbang[client] + 1;
	}
}

public Action:Say_Team(client, String:command[], args)
{
	if (client > 0)
	{
		if (!IsFakeClient(client))
		{
			decl String:Arg[256];
			GetCmdArgString(Arg, sizeof(Arg));
			StripQuotes(Arg);
			TrimString(Arg);
			
			for (new i = 1; i <= MaxClients; i++)
			{
				if (IsClientInGame(i) && GetClientTeam(i) > 1)
				{
					if (entity_distance_stock(client, i) <= 1000)
					{
						CPrintToChatEx(i, client, "(LOCAL) {teamcolor}%N : {default}%s", client, Arg);
					}
				}
			}
			
			LogToFile(Logfile,"(LOCAL) %N : %s", client, Arg);
		}
	}
	
	return Plugin_Handled;
}

public Float:entity_distance_stock(ent1, ent2)
{
	decl Float:orig1[3];
	decl Float:orig2[3];
	
	GetEntPropVector(ent1, Prop_Send, "m_vecOrigin", orig1);
	GetEntPropVector(ent2, Prop_Send, "m_vecOrigin", orig2);
	
	return GetVectorDistance(orig1, orig2);
}

public Action:Command_Vol(client, Args)
{
	if (IsClientInGame(client))
	{
		if (IsPlayerAlive(client))
		{
			if (rankid[client] == 2 || rankid[client] == 17)
			{
				new Ent = GetClientAimTarget(client, true);
				
				new timestamp;
				timestamp = GetTime();

				if (Ent != -1)
				{
					if (rankid[Ent] != 2 || rankid[Ent] != 17)
					{
						if (g_jailtime[client] <= 0)
						{
							if (g_invisible[Ent] == 0)
							{
								decl Float:client_vec[3];
								decl Float:plyr_vec[3];
								new Float:dist_vec;
								
								GetClientAbsOrigin(Ent, plyr_vec);
								GetClientAbsOrigin(client, client_vec);
								
								dist_vec = GetVectorDistance(plyr_vec, client_vec);
								
								if (dist_vec < 80)
								{
									new CashVoler;
									
									if (rankid[Ent] == 1)
									{
										CashVoler = GetRandomInt(1, 300);
									}
									else
									{
										CashVoler = GetRandomInt(1, 150);
									}
									
									if (0 < money[Ent])
									{
										if ((timestamp - g_vol[client]) < 30)
										{
											CPrintToChat(client, "%s Vous devez attendre %i secondes avant de pouvoir volé.", LOGO, (30 - (timestamp - g_vol[client])) );
										}
										else
										{
											new moneyVol = money[Ent];
											
											decl result;
											
											new after = CashVoler;
											moneyVol -= after;
											
											result = moneyVol - after;
											
											if (0 < result)
											{
												CPrintToChat(Ent, "%s {red}On vient de vous voler{green} %i€", LOGO, CashVoler);
												CPrintToChat(client, "%s {blue}Vous avez volé {green}%i€{blue} à %N.", LOGO, CashVoler, Ent);
												
												new tg = money[Ent];
												money[Ent] = tg - CashVoler;
												
												new ok = money[client];
												money[client] = ok + CashVoler;
												
												new later = capital[2];
												capital[2] = later + CashVoler;
											}
											else
											{
												CPrintToChat(Ent, "%s {red}On vient de vous voler{green} %i€", LOGO, money[Ent]);
												CPrintToChat(client, "%s {blue}Vous avez volé {green}%i€{blue} à %N.", LOGO, money[Ent], Ent);
												
												new lol = money[client];
												money[client] = money[Ent] + lol;
												
												money[Ent] = 0;
												
												new ptdr = capital[2];
												capital[2] = ptdr + CashVoler;
												
												new test = capital[17];
												capital[17] = test + CashVoler;
											}
											
											g_vol[client] = GetTime();
											
											decl Float:vec[3];
											GetClientAbsOrigin(client, vec);
											
											vec[2] += 5;
											
											TE_SetupBeamRingPoint(vec, 5.0, 800.0, g_modelLaser, g_modelHalo, 0, 15, 0.6, 20.0, 0.5, greenColor, 10, 0);
											TE_SendToAll();
										}
									}
									else
									{
										CPrintToChat(client, "%s {red}Ce joueur n'a pas d'argent sur lui.", LOGO);
									}
								}
								else
								{
									CPrintToChat(client, "%s {red}Vous ne pouvez pas voler ce joueur.", LOGO);
								}
							}
							else
							{
								CPrintToChat(client, "%s {red}Vous ne pouvez pas voler un joueur invisible.", LOGO);
							}
						}
						else
						{
							CPrintToChat(client, "%s {red}Vous ne pouvez voler en jail !", LOGO);
						}
					}
					else
					{
						CPrintToChat(client, "%s {red}Vous ne pouvez pas voler ce joueur.", LOGO);
					}
				}
				else
				{
					CPrintToChat(client, "%s {red}Vous devez viser un joueur.", LOGO);
				}
			}
			else
			{
				CPrintToChat(client, "%s {red}Vous n'avez pas accès à cette commande.", LOGO);
			}
		}
		else
		{
			CPrintToChat(client, "%s {red} Vous devez être vivant !", LOGO);
		}
	}
	return Plugin_Handled;
}

public armu(Handle:menu, MenuAction:action, client, param2)
{
	if (action == MenuAction_Select)
	{
		new String:info[32];
		GetMenuItem(menu, param2, info, sizeof(info));
		
		if (StrEqual(info, "awp"))
		{
			GivePlayerItem(client, "weapon_awp");
		}
		else if (StrEqual(info, "batteuse"))
		{
			GivePlayerItem(client, "weapon_m249");
		}
		else if (StrEqual(info, "m4"))
		{
			GivePlayerItem(client, "weapon_m4a1");
		}
		else if (StrEqual(info, "ak"))
		{
			GivePlayerItem(client, "weapon_ak47");
		}
		else if (StrEqual(info, "aug"))
		{
			GivePlayerItem(client, "weapon_aug");
		}
		else if (StrEqual(info, "scout"))
		{
			GivePlayerItem(client, "weapon_scout");
		}
		else if (StrEqual(info, "mp5"))
		{
			GivePlayerItem(client, "weapon_mp5navy");
		}
		else if (StrEqual(info, "p90"))
		{
			GivePlayerItem(client, "weapon_p90");
		}
		else if (StrEqual(info, "ump45"))
		{
			GivePlayerItem(client, "weapon_ump45");
		}
		else if (StrEqual(info, "tmp"))
		{
			GivePlayerItem(client, "weapon_tmp");
		}
		else if (StrEqual(info, "mac10"))
		{
			GivePlayerItem(client, "weapon_mac10");
		}
		else if (StrEqual(info, "m3"))
		{
			GivePlayerItem(client, "weapon_m3");
		}
		else if (StrEqual(info, "xm1014"))
		{
			GivePlayerItem(client, "weapon_xm1014");
		}
		else if (StrEqual(info, "galil"))
		{
			GivePlayerItem(client, "weapon_galil");
		}
		else if (StrEqual(info, "famas"))
		{
			GivePlayerItem(client, "weapon_famas");
		}
		else if (StrEqual(info, "deagle"))
		{
			new arme;
			arme = CreateEntityByName("weapon_deagle");
			DispatchSpawn(arme);
			EquipPlayerWeapon(client, arme);
			SetEntData(arme, g_iiClip1, 0);	
		}
		else if (StrEqual(info, "glock"))
		{
			new arme;
			arme = CreateEntityByName("weapon_glock");
			DispatchSpawn(arme);
			EquipPlayerWeapon(client, arme);
			SetEntData(arme, g_iiClip1, 0);	
		}
		else if (StrEqual(info, "usp"))
		{
			new arme;
			arme = CreateEntityByName("weapon_usp");
			DispatchSpawn(arme);
			EquipPlayerWeapon(client, arme);
			SetEntData(arme, g_iiClip1, 0);	
		}
		else if (StrEqual(info, "flash"))
		{
			GivePlayerItem(client, "weapon_flashbang");
		}
		else if (StrEqual(info, "grenade"))
		{
			GivePlayerItem(client, "weapon_hegrenade");	
		}
		else if (StrEqual(info, "smoke"))
		{
			GivePlayerItem(client, "weapon_smokegrenade");
		}
		else if (StrEqual(info, "cartouche"))
		{
			decl String:WeaponName[32];
			Client_GetActiveWeaponName(client, WeaponName, sizeof(WeaponName));
				
			new weapon = Client_GetActiveWeapon(client);
					
			if (weapon != -1)
			{
				RemoveEdict(weapon);
				GivePlayerItem(client, WeaponName);
			}
		}
	}
	else if (action == MenuAction_End)
	{
		CloseHandle(menu);
	}
}

public Action:Command_Soins(client, Args)
{
	if (IsClientInGame(client))
	{
		if (rankid[client] == 8)
		{
			new Ent = GetClientAimTarget(client, true);
			
			if (Ent != -1)
			{
				decl String:ItemAccepter[12];
				decl String:ItemRefuser[12];
				
				new Handle:menu_Sell_Soins = CreateMenu(Menu_SellSoins);
				SetMenuTitle(menu_Sell_Soins, "%N vous propose de vous soigner pour 500€", client);
				
				Format(ItemAccepter, sizeof(ItemAccepter), "%i_a", client);
				AddMenuItem(menu_Sell_Soins, ItemAccepter, "Accepter l'offre");
				
				Format(ItemRefuser, sizeof(ItemRefuser), "%i_r", client);
				AddMenuItem(menu_Sell_Soins, ItemRefuser, "Décliner l'offre");
				
				DisplayMenu(menu_Sell_Soins, Ent, MENU_TIME_FOREVER);
			}
			else
			{
				CPrintToChat(client, "%s Vous devez viser un joueur.", LOGO);
			}
		}
		else
		{
			CPrintToChat(client, "%s {red}Vous n'avez pas accès à cette commande.", LOGO);
		}
	}
	
	return Plugin_Handled;
}

public Menu_SellSoins(Handle:menu_Sell_Soins, MenuAction:action, param1, param2)
{
	if (action == MenuAction_Select)
	{
		new Vendeur;
		
		decl String:info[32];
		GetMenuItem(menu_Sell_Soins, param2, info, sizeof(info));
		
		decl String:Buffer[8][32];
		
		ExplodeString(info, "_", Buffer, 2, 32);
		
		Vendeur = StringToInt(Buffer[0]);
		
		if (StrEqual(Buffer[1], "a"))
		{
			new amount;
			
			if (cb[param1] == 1)
			{
				amount = bank[param1] - 500;
			}
			else
			{
				amount = money[param1] - 500;
			}
			if (0 <= amount)
			{
				if (cb[param1] == 1)
				{
					new after = bank[param1];
					bank[param1] = after - 500;
				}
				else
				{
					new later = money[param1];
					money[param1] = later - 500;
				}
				
				new xd = money[Vendeur];
				money[Vendeur] = xd + 250;
				
				new mdr = capital[8];
				capital[8] = mdr + 250;
				
				if (rankid[param1] == 1)
				{
					SetEntityHealth(param1, 500);
				}
				else
				{
					SetEntityHealth(param1, 100);
				}
				
				CPrintToChat(param1, "%s En vous soignant, %N a restaurer l'intégralité de votre vie.", LOGO, Vendeur);
				CPrintToChat(Vendeur, "%s Vous avez restaurer l'intégralité de la vie de %N.", LOGO, param1);
			}
			else
			{
				CPrintToChat(Vendeur, "%s {green}%N{red} n'as pas assez d'argent !", LOGO, param1);
				CPrintToChat(param1, "%s {red} Vous n'avez pas l'argent !", LOGO);
			}
		}
		
		if (StrEqual(Buffer[1], "r"))
		{
			CPrintToChat(Vendeur, "%s %N a refuser votre offre.", LOGO, param1);
			CPrintToChat(param1, "%s Vous avez refuser l'offre de %N.", LOGO, Vendeur);
		}
	}
	else
	{
		if (action == MenuAction_End)
		{
			CloseHandle(menu_Sell_Soins);
		}
	}
}

public Action:Command_Flashball(client, Args)
{
	if (IsClientInGame(client))
	{
		new Handle:flash = CreateMenu(Menu_Flashball);
		SetMenuTitle(flash, "Voulez vous désactiver votre flashball ?", client);
		
		if (flashb[client])
		{
			AddMenuItem(flash, "oui", "Oui je veux.");
			AddMenuItem(flash, "non", "Non merci.");
		}
		else
		{
			AddMenuItem(flash, "lol", "Aucun flashball", ITEMDRAW_DISABLED);
		}
		
		DisplayMenu(flash, client, MENU_TIME_FOREVER);
		
		CPrintToChat(client, "%s ==> Une fois désactiver, vous devrez racheter un Flashball Anti-émeute.", LOGO);
		CPrintToChat(client, "%s ==> Êtes-vous sûr ?", LOGO);
	}
}

public Menu_Flashball(Handle:menu, MenuAction:action, client, param2)
{
	if (client)
	{
		if (client > 0 && IsClientInGame(client))
		{
			if (action == MenuAction_Select)
			{
				new String:info[32];
				GetMenuItem(menu, param2, info, sizeof(info));
				
				if (StrEqual(info, "oui"))
				{
					flashb[client] = false;
					CPrintToChat(client, "%s Vous avez désactivé votre flashball", LOGO);
				}
				else if (StrEqual(info, "non"))
				{
					CloseHandle(menu);
				}
			}
			else
			{
				if (action == MenuAction_End)
				{
					CloseHandle(menu);
				}
			}
		}
	}
}

public Action:DelWeapon(Handle:timer)
{
	new maxent = GetMaxEntities(), String:weapon[64];
	
	for (new i=GetMaxClients();i<maxent;i++)
	{
		if (IsValidEdict(i) && IsValidEntity(i))
		{
			GetEdictClassname(i, weapon, sizeof(weapon));
			
			if ((StrContains(weapon, "weapon_") != -1 || StrContains(weapon, "item_") != -1 ) && GetEntDataEnt2(i, g_WeaponParent) == -1)
			{
				RemoveEdict(i);
			}
		}
	}
	
	return Plugin_Continue;
}

public Action:Command_Chirurgie(client, Args)
{
	if (IsClientInGame(client))
	{
		if (rankid[client] == 8)
		{
			if (IsInHosto(client))
			{
				new Ent = GetClientAimTarget(client, true);
				
				if (Ent != -1)
				{
					decl String:Jambes[12];
					decl String:Coeur[12];
					decl String:Tete[12];
					
					new Handle:chirurgie = CreateMenu(Menu_Choose_Chirurgie);
					SetMenuTitle(chirurgie, "Choissisez une intervention Chirurgicale à proposer :");
					
					Format(Tete, sizeof(Tete), "%i_1", Ent);
					AddMenuItem(chirurgie, Tete, "Chirurgie de la tête (Prix: 1000€)");
					
					Format(Coeur, sizeof(Coeur), "%i_2", Ent);
					AddMenuItem(chirurgie, Coeur, "Chirurgie du coeur (Prix: 1500€)");
					
					Format(Jambes, sizeof(Jambes), "%i_3", Ent);
					AddMenuItem(chirurgie, Jambes, "Chirurgie des jambes (Prix: 2000€)");
				
					DisplayMenu(chirurgie, client, MENU_TIME_FOREVER);
				}
				else
				{
					CPrintToChat(client, "%s Vous devez viser un joueur.", LOGO);
				}
			}
			else
			{
				CPrintToChat(client, "%s Vous devez être dans l'hôpital", LOGO);
			}
		}
		else
		{
			CPrintToChat(client, "%s {red}Vous n'avez pas accès a cette commande.", LOGO);
		}
	}
}

public Menu_Choose_Chirurgie(Handle:chirurgie, MenuAction:action, param1, param2)
{
	if (action == MenuAction_Select)
	{
		new String:info[32];
		
		new number;
		new Acheteur;
		new PriceChirurgie;
		
		GetMenuItem(chirurgie, param2, info, sizeof(info));
		
		decl String:Buffer[8][32];
		
		ExplodeString(info, "_", Buffer, 2, 32);
		
		Acheteur = StringToInt(Buffer[0]);
		number = StringToInt(Buffer[1]);
		
		if (number == 1)
		{
			PriceChirurgie = 1000;
			Format(NameChirurgie, sizeof(NameChirurgie), "Chirurgie de la tête");
		}
		if (number == 2)
		{
			PriceChirurgie = 1500;
			Format(NameChirurgie, sizeof(NameChirurgie), "Chirurgie du coeur");
		}
		if (number == 3)
		{
			PriceChirurgie = 2000;
			Format(NameChirurgie, sizeof(NameChirurgie), "Chirurgie des jambes");
		}
		
		decl String:ItemAccepter[12];
		decl String:ItemRefuser[12];
		
		new Handle:Chirurgie_Ask_Menu = CreateMenu(Menu_Ask_Chirurgie);
		SetMenuTitle(Chirurgie_Ask_Menu, "%N vous propose de vous vendre un(e) %s pour %i€", param1, NameChirurgie, PriceChirurgie);
		
		Format(ItemAccepter, sizeof(ItemAccepter), "%i_a", param1);
		AddMenuItem(Chirurgie_Ask_Menu, ItemAccepter, "Accepter l'offre");
		
		Format(ItemRefuser, sizeof(ItemRefuser), "%i_r", param1);
		AddMenuItem(Chirurgie_Ask_Menu, ItemRefuser, "Décliner l'offre");
		
		DisplayMenu(Chirurgie_Ask_Menu, Acheteur, MENU_TIME_FOREVER);
	}
	else
	{
		if (action == MenuAction_End)
		{
			CloseHandle(chirurgie);
		}
	}
}

public Menu_Ask_Chirurgie(Handle:Chirurgie_Ask_Menu, MenuAction:action, param1, param2)
{
	if (action == MenuAction_Select)
	{
		decl String:info[32];
		
		new Vendeur;
		
		GetMenuItem(Chirurgie_Ask_Menu, param2, info, sizeof(info));
		
		decl String:Buffer[8][32];
		
		ExplodeString(info, "_", Buffer, 2, 32);
		
		Vendeur = StringToInt(Buffer[0]);
		
		if (StrEqual(Buffer[1], "a"))
		{
			if (StrEqual(NameChirurgie, "Chirurgie de la tête"))
			{
				decl moneyCommanditeur;
				
				if (cb[param1] == 1)
				{
					moneyCommanditeur = bank[param1];
				}
				else
				{
					moneyCommanditeur = money[param1];
				}
				
				decl result;
				moneyCommanditeur -= 1000;
				result = moneyCommanditeur - 1000;
				
				if (0 <= result)
				{
					if (cb[param1] == 1)
					{
						new later = bank[param1];
						bank[param1] = later - 1000;
					}
					else
					{
						new after = money[param1];
						money[param1] = after - 1000;
					}
					
					new mon = money[Vendeur];
					money[Vendeur] = mon + 500;
					
					new capi = capital[8];
					capital[8] = capi + 500;
					
					SetEntityGravity(param1, 0.5);
					
					CPrintToChat(Vendeur, "%s Vous avez effectuer une %s sur %N", LOGO, NameChirurgie, param1);
					
					CPrintToChat(param1, "%s Vous avez été opérer par %N et avez subi une %s. Votre gravité est augmentée jusqu'à votre mort.", LOGO, Vendeur, NameChirurgie);
				}
				else
				{
					CPrintToChat(Vendeur, "%s {green}%N{red} n'as pas assez d'argent !", LOGO, param1);
					CPrintToChat(param1, "%s {red} Vous n'avez pas l'argent !", LOGO);
				}
			}
			else if (StrEqual(NameChirurgie, "Chirurgie du coeur"))
			{
				decl moneyCommanditeur;
				
				if (cb[param1] == 1)
				{
					moneyCommanditeur = bank[param1];
				}
				else
				{
					moneyCommanditeur = money[param1];
				}
				
				decl result;
				
				moneyCommanditeur -= 1500;
				result = moneyCommanditeur - 1500;
				
				if (0 <= result)
				{
					if (cb[param1] == 1)
					{
						new xd = bank[param1];
						bank[param1] = xd - 1500;
					}
					else
					{
						new mdr = money[param1];
						money[param1] = mdr - 1500;
					}
					
					new omg = money[Vendeur];
					money[Vendeur] = omg + 750;
					
					new capit = capital[8];
					capital[8] = capit + 750;
					
					SetEntityHealth(param1, 500);
					
					CPrintToChat(Vendeur, "%s  Vous avez effectuer une %s sur %N", LOGO, NameChirurgie, param1);
					
					CPrintToChat(param1, "%s Vous avez été opérer par %N et avez subi une %s. Vous avez gagner de la vie jusqu'à votre mort.", LOGO, Vendeur, NameChirurgie);
				}
				else
				{
					CPrintToChat(Vendeur, "%s {green}%N{red} n'as pas assez d'argent !", LOGO, param1);
					CPrintToChat(param1, "%s {red} Vous n'avez pas l'argent !", LOGO);
				}
			}
			else if (StrEqual(NameChirurgie, "Chirurgie des jambes"))
			{
				decl moneyCommanditeur;
				
				if (cb[param1] == 1)
				{
					moneyCommanditeur = bank[param1];
				}
				else
				{
					moneyCommanditeur = money[param1];
				}
				
				decl result;
				moneyCommanditeur -= 2000;
				result = moneyCommanditeur -2000;
				
				if (0 <= result)
				{
					if (cb[param1] == 1)
					{
						new ptdr = bank[param1];
						bank[param1] = ptdr - 2000;
					}
					else
					{
						new xptdr = money[param1];
						money[param1] = xptdr - 2000;
					}
					
					new mone = money[Vendeur];
					money[Vendeur] = mone + 1000;
					
					new capita = capital[8];
					capital[8] = capita + 1000;
					
					ModifySpeed(param1, 1.7);
					
					CPrintToChat(Vendeur, "%s  Vous avez effectuer une %s sur %N", LOGO, NameChirurgie, param1);
					
					CPrintToChat(param1, "%s Vous avez été opérer par %N et vous avez subi une %s. Vous avez gagner de la vitesse jusqu'à votre mort.", LOGO, Vendeur, NameChirurgie);
				}
				else
				{
					CPrintToChat(Vendeur, "%s {green}%N{red} n'as pas assez d'argent !", LOGO, param1);
					CPrintToChat(param1, "%s {red} Vous n'avez pas l'argent !", LOGO);
				}
			}
		}
		else if (StrEqual(Buffer[1], "r"))
		{
			CPrintToChat(Vendeur, "%s %N a refuser votre offre.", LOGO, param1);
			CPrintToChat(param1, "%s Vous avez refuser l'offre de %N.", LOGO, Vendeur);
		}
	}
	else
	{
		if (action == MenuAction_End)
		{
			CloseHandle(Chirurgie_Ask_Menu);
		}
	}
}

public Action:Command_Cash(client, Args)
{
	if (IsClientInGame(client))
	{
		if (rankid[client] == 12)
		{
			if (g_jailtime[client] == 0)
			{
				if (printer[client] < 3)
				{
					decl Float:_origin[3], Float:_angles[3];
					GetClientEyePosition(client, _origin);
					GetClientEyeAngles(client, _angles);
					
					new Handle:trace = TR_TraceRayFilterEx( _origin, _angles, MASK_SOLID_BRUSHONLY, RayType_Infinite, TraceEntityFilterPlayers);
					if(!TR_DidHit(trace))
					{
						CPrintToChat(client, "%s Impossible de choisir l'emplacement.", LOGO);
						return;
					}
					
					decl Float:VecAngles[3], Float:position[3], VecOrigin[3], Float:VecDirection[3];
					TR_GetEndPosition(position, trace);
					
					new prop = CreateEntityByName("prop_physics_override");

					if (!IsModelPrecached("models/natalya/props/consolebox01_expl.mdl"))
					{
						PrecacheModel("models/natalya/props/consolebox01_expl.mdl");
					}
					
					DispatchKeyValue(prop, "skin", "0");
					DispatchKeyValue(prop, "targetname", "imprimante");
					SetEntityModel(prop, "models/natalya/props/consolebox01_expl.mdl");
					DispatchKeyValueFloat (prop, "MaxPitch", 360.00);
					DispatchKeyValueFloat (prop, "MinPitch", -360.00);
					DispatchKeyValueFloat (prop, "MaxYaw", 90.00);
					DispatchSpawn(prop);

					GetClientEyeAngles(client, VecAngles);
					GetAngleVectors(VecAngles, VecDirection, NULL_VECTOR, NULL_VECTOR);
					VecOrigin[0] += VecDirection[0] * 32;
					VecOrigin[1] += VecDirection[1] * 32;
					VecOrigin[2] += VecDirection[2] * 1;
					VecAngles[0] = 0.0;
					VecAngles[1] += 180.0;
					VecAngles[2] = 0.0;
					DispatchKeyValueVector(prop, "Angles", VecAngles);
					DispatchKeyValue (prop, "health", "100");
					DispatchKeyValue (prop, "ExplodeRadius", "16");
					DispatchKeyValue (prop, "ExplodeDamage", "10");
					DispatchKeyValue (prop, "Damagetype", "1");
					DispatchKeyValue (prop, "PerformanceMode", "0");
					DispatchSpawn(prop);
					TeleportEntity(prop, position, NULL_VECTOR, NULL_VECTOR);
					
					printer[client] = printer[client] + 1;
					
					PrintToServer("%s Une imprimante de billet a été faite ici : %f, %f, %f.", LOGO, position[0], position[1], position[2]);
					
					CPrintToChat(client, "%s Vous avez spawn une machine de faux billet.", LOGO);
					
					printer_owner[prop] = client;
					
					HookSingleEntityOutput(prop, "OnBreak", OnPropPhysBreak);
				}
				else
				{
					CPrintToChat(client, "%s Vous avez déjà le maximum d'imprimante a faux billets (%i)", LOGO, printer[client]);
				}
			}
			else
			{
				CPrintToChat(client, "%s Vous ne pouvez pas spawn une machine à faux billets en jail.", LOGO);
			}
		}
		else
		{
			CPrintToChat(client, "%s {red}Vous n'avez pas accès a cette commande.", LOGO);
		}
	}
}

public OnPropPhysBreak(const String:output[], caller, activator, Float:delay)
{
	new owner = printer_owner[caller];
	
	if (owner > 0 && owner <= MaxClients)
	{
		if (IsClientInGame(owner))
		{
			printer[owner] = printer[owner] - 1;
		
			CPrintToChat(owner, "%s Vous avez perdu une imprimante de faux billets", LOGO);
		}
	}
	
	if (0 < activator <= MaxClients)
	{
		if (IsPlayerAlive(activator))
		{
			CPrintToChat(activator, "%s Tu as cassé une imprimante de faux billets.", LOGO);
		}
	}
	
	printer_owner[caller] = 0;
}

public OnPropPhysBreakk(const String:output[], caller, activator, Float:delay)
{
	new owner = printer_owner[caller];
	
	if (owner > 0 && owner <= MaxClients)
	{
		if (IsClientInGame(owner))
		{
			activate[owner] =  activate[owner] - 1;
		
			CPrintToChat(owner, "%s {red}Vous imprimante a faux billets est cassée", LOGO);
		}
	}
	
	if (0 < activator <= MaxClients)
	{
		if (IsPlayerAlive(activator))
		{
			new random = GetRandomInt(1, 200);
			
			CPrintToChat(activator, "%s Tu as cassé une imprimante de faux billets et a trouvé %i€ à l'intérieur.", LOGO, random);
			
			money[activator] += random;
		}
	}
	
	printer_owner[caller] = 0;
}

public bool:TraceEntityFilterPlayers( entity, contentsMask, any:data )
{
    return entity > MaxClients && entity != data;
}

public SpawnImprim(client)
{
	if (IsClientInGame(client))
	{
		if (IsPlayerAlive(client))
		{
			decl Float:_origin[3], Float:_angles[3];
			GetClientEyePosition(client, _origin);
			GetClientEyeAngles(client, _angles);
			
			new Handle:trace = TR_TraceRayFilterEx( _origin, _angles, MASK_SOLID_BRUSHONLY, RayType_Infinite, TraceEntityFilterPlayers);
			if(!TR_DidHit(trace))
		    {
				CPrintToChat(client, "%s {red}Erreur lors du spawn !", LOGO);
				imprimerie[client] = imprimerie[client] + 1;
				return;
    		}
			
			decl Float:VecAngles[3], Float:position[3], VecOrigin[3], Float:VecDirection[3];
			TR_GetEndPosition(position, trace);
			
			new prop = CreateEntityByName("prop_physics_override");

			if (!IsModelPrecached("models/natalya/props/consolebox01_expl.mdl"))
			{
				PrecacheModel("models/natalya/props/consolebox01_expl.mdl");
			}
			
			DispatchKeyValue(prop, "skin", "0");
			DispatchKeyValue(prop, "targetname", "imprimante");
			SetEntityModel(prop, "models/natalya/props/consolebox01_expl.mdl");
			DispatchKeyValueFloat (prop, "MaxPitch", 360.00);
			DispatchKeyValueFloat (prop, "MinPitch", -360.00);
			DispatchKeyValueFloat (prop, "MaxYaw", 90.00);
			DispatchSpawn(prop);

			GetClientEyeAngles(client, VecAngles);
			GetAngleVectors(VecAngles, VecDirection, NULL_VECTOR, NULL_VECTOR);
			VecOrigin[0] += VecDirection[0] * 32;
			VecOrigin[1] += VecDirection[1] * 32;
			VecOrigin[2] += VecDirection[2] * 1;
			VecAngles[0] = 0.0;
			VecAngles[1] += 90.0;
			VecAngles[2] = 0.0;
			DispatchKeyValueVector(prop, "Angles", VecAngles);
			DispatchKeyValue (prop, "health", "250");
			DispatchKeyValue (prop, "ExplodeRadius", "16");
			DispatchKeyValue (prop, "ExplodeDamage", "10");
			DispatchKeyValue (prop, "Damagetype", "1");
			DispatchKeyValue (prop, "PerformanceMode", "0");
			DispatchSpawn(prop);
			TeleportEntity(prop, position, NULL_VECTOR, NULL_VECTOR);
			
			activate[client] = activate[client] + 1;
			
			PrintToServer("%s Une imprimante de billet a été faite ici : %f, %f, %f.", LOGO, position[0], position[1], position[2]);
			
			CPrintToChat(client, "%s Vous avez spawn une machine de faux billet, vous avez %i/3 machines a faux billets.", LOGO, activate[client]);
			
			printer_owner[prop] = client;
			
			HookSingleEntityOutput(prop, "OnBreak", OnPropPhysBreakk);
		}
	}
}


TE_SetupWorldDecal(const Float:vecOrigin[3], index)
{    
	TE_Start("World Decal");
	TE_WriteVector("m_vecOrigin",vecOrigin);
	TE_WriteNum("m_nIndex",index);
}


public Action:Command_Pick(client, Args)
{
	if (IsClientInGame(client))
	{
		if (rankid[client] == 17)
		{
			new Ent = GetClientAimTarget(client, true);
			
			new timestamp;
			timestamp = GetTime();
			
			if (Ent != -1)
			{
				if (rankid[Ent] != 2)
				{
					if (g_IsInJail[client] == 0)
					{
						decl Float:client_vec[3];
						decl Float:plyr_vec[3];
						new Float:dist_vec;
						GetClientAbsOrigin(Ent, plyr_vec);
						GetClientAbsOrigin(client, client_vec);
						dist_vec = GetVectorDistance(plyr_vec, client_vec);
						
						if (dist_vec < 100)
						{
							decl String:WeaponName[32];
							Client_GetActiveWeaponName(Ent, WeaponName, sizeof(WeaponName));
							
							new weapon = Client_GetActiveWeapon(Ent);
							
							if (weapon != -1)
							{
								if (!StrEqual(WeaponName, "weapon_knife"))
								{
									if ((timestamp - g_vol[client]) < 30)
									{
										CPrintToChat(client, "%s Vous devez attendre %i secondes avant de pouvoir volé.", LOGO, (30 - (timestamp - g_vol[client])));
									}
									else
									{
										g_vol[client] = GetTime();
										
										new Ammo = Client_GetWeaponPlayerAmmo(Ent, WeaponName);
										
										new Clip = Weapon_GetPrimaryClip(weapon);
										
										Client_RemoveWeapon(Ent, WeaponName, true, false);
										
										new givedweapon = GivePlayerItem(client, WeaponName);
										
										Weapon_SetPrimaryAmmoCount(givedweapon, Ammo);
										
										Weapon_SetPrimaryClip(givedweapon, Clip);
										
										CPrintToChat(client, "%s Vous avez voler l'arme de %N. (Arme: %s)", LOGO, Ent, WeaponName);
										CPrintToChat(Ent, "%s {red}Quelqu'un vous a voler une arme.", LOGO);
										
										decl Float:vec[3];
										GetClientAbsOrigin(client, vec);
										vec[2] += 5;
										
										TE_SetupBeamRingPoint(vec, 5.0, 800.0, g_modelLaser, g_modelHalo, 0, 15, 0.6, 20.0, 0.5, TAZER_COLORBLUE, 10, 0);
										TE_SendToAll();
										TE_SetupBeamRingPoint(vec, 5.0, 800.0, g_modelLaser, g_modelHalo, 0, 15, 0.6, 20.0, 0.5, TAZER_COLORBLUE, 10, 0);
										TE_SendToAll();
									}
								}
								else
								{
									CPrintToChat(client, "%s Vous ne pouvez pas volé un cut.", LOGO);
								}
							}
							else
							{
								CPrintToChat(client, "%s Ce joueur n'as aucune arme dans les mains.", LOGO);
							}
						}
						else
						{
							CPrintToChat(client, "%s Vous êtes trop loin du joueur.", LOGO);
						}
					}
					else
					{
						CPrintToChat(client, "%s Impossible en prison !", LOGO);
					}
				}
				else
				{
					CPrintToChat(client, "%s Vous ne pouvez pas voler un autre Mafieux.", LOGO);
				}
			}
			else
			{
				CPrintToChat(client, "%s Vous devez viser un joueur.", LOGO);
			}
		}
		else
		{
			CPrintToChat(client, "%s {red}Vous n'avez pas accès à cette commande.", LOGO);
		}
	}
	return Plugin_Handled;
}

public CreateSortie(client)
{
	new Handle:sortie = CreateMenu(Menu_Sortie);
	SetMenuTitle(sortie, "Voulez-vous sortir en quartier libre ?");
	
	AddMenuItem(sortie, "oui", "Oui je veux.");
	AddMenuItem(sortie, "non", "Non Merci.");
	
	DisplayMenu(sortie, client, 30);
}

public Menu_Sortie(Handle:menu, MenuAction:action, client, param2)
{
	if (action == MenuAction_Select)
	{
		new String:info[32];
		
		GetMenuItem(menu, param2, info, sizeof(info));
		
		if (StrEqual(info, "oui"))
		{
			if (IsPlayerAlive(client))
			{
				CPrintToChat(client, "%s Vous êtes en quartier libre, profitez-en !", LOGO);
				
				TeleportEntity(client, Float:{ 4110.747070, 1688.976196, -36.813309 }, NULL_VECTOR, NULL_VECTOR);
				
				disarm(client);
			}
		}
		else if (StrEqual(info, "non"))
		{
			CPrintToChat(client, "%s {red}Vous restez dans votre jail.", LOGO);
			
			CloseHandle(menu);
		}
	}
}

public Action:Command_GroupCreate(client, args)
{
	if (IsClientInGame(client))
	{
		if (Group[client] > 0)
		{
			CPrintToChat(client, "%s Vous devez quitter votre groupe avant de pouvoir en créer un autre.", LOGO);
		}
		else
		{
			if (args > 0)
			{
				decl String:arg1[64];
				decl String:SteamID[64];
				GetCmdArg(1, arg1, 64);
				
				decl String:query[256];
				
				decl String:error[256];
				new Handle:db_rp = SQL_Connect("roleplay", true, error, sizeof(error));
				
				SQL_EscapeString(db_rp, arg1, arg1, 64);
				
				GetClientAuthString(client, SteamID, 64);
				
				Format(query, sizeof(query), "INSERT INTO Roleplay_Groups (`Name`, `Owner`) VALUES ('%s', '%s');", arg1, SteamID);
				SQL_FastQuery(db_rp, query);

				Format(query, sizeof(query), "SELECT * FROM `Roleplay_Groups` WHERE `Owner` =  '%s';", SteamID);
				
				new Handle:group_id = SQL_Query(db_rp, query);
				
				if (group_id)
				{
					while (SQL_FetchRow(group_id))
					{
						Group[client] = SQL_FetchInt(group_id, 0);
					}
					
					CloseHandle(group_id);
				}
				
				Format(query, sizeof(query), "UPDATE `Roleplay_Players` SET `groupe` = %i WHERE `steam_id` = '%s';", Group[client], SteamID);
				SQL_FastQuery(db_rp, query);
				
				CloseHandle(db_rp);
				
				CPrintToChat(client, "%s Vous avez créer le groupe %s avec succès !", LOGO, arg1);
			}
			else
			{
				CPrintToChat(client, "%s usage : /groupcreate <name>", LOGO);
			}
		}
	}
	
	return Plugin_Handled;
}

public GetGroupName(ID, String:GroupName[], maxlen)
{
	decl String:TGroupName[128];
	decl String:query[256];
	
	decl String:error[256];
	new Handle:db_rp = SQL_Connect("roleplay", true, error, sizeof(error));
	Format(query, sizeof(query), "SELECT Name FROM `Roleplay_Groups` WHERE `id` =  '%i';", ID);
	
	new Handle:group_name = SQL_Query(db_rp, query);
	
	if (group_name)
	{
		while (SQL_FetchRow(group_name))
		{
			SQL_FetchString(group_name, 0, TGroupName, sizeof(TGroupName));
		}
		CloseHandle(group_name);
		CloseHandle(db_rp);
	}
	
	strcopy(GroupName, maxlen, TGroupName);
}

public Action:Command_Group(client, args)
{
	if (IsClientInGame(client))
	{
		new Handle:GroupMenu = CreateMenu(Menu_Group);
		
		if (Group[client] > 0)
		{
			decl String:GroupName[128];
			decl String:SteamID[64];
			decl String:OwnerID[64];
			
			GetGroupName(Group[client], GroupName, sizeof(GroupName));
			SetMenuTitle(GroupMenu, GroupName);
			
			AddMenuItem(GroupMenu, "list", "Liste des membres du groupe");
			
			GetClientAuthString(client, SteamID, sizeof(SteamID));
			
			GetGroupOwner(Group[client], OwnerID, sizeof(OwnerID));
			
			if (StrEqual(SteamID, OwnerID))
			{
				AddMenuItem(GroupMenu, "virer", "Virer des membres du groupe");
			}
			else
			{
				AddMenuItem(GroupMenu, "virer", "Virer des membres du groupe", ITEMDRAW_DISABLED);
			}
			
			AddMenuItem(GroupMenu, "quit", "Quitter le groupe");
		}
		else
		{
			SetMenuTitle(GroupMenu, "Vous n'appartenez à aucun groupe.");
		}
		
		DisplayMenu(GroupMenu, client, MENU_TIME_FOREVER);
	}
	return Plugin_Continue;
}

public Menu_Group(Handle:GroupMenu, MenuAction:action, param1, param2)
{
	if (action == MenuAction_Select)
	{
		decl String:info[32];
		GetMenuItem(GroupMenu, param2, info, sizeof(info));

		if (StrEqual(info, "list"))
		{
			new Handle:GroupList = CreatePanel();
			decl String:OwnerID[64];
			
			SetPanelTitle(GroupList, "Liste des membres du groupe :");
			
			for (new i = 1; i <= MaxClients; i++)
			{
				if (IsClientInGame(i) && IsPlayerAlive(i) && GetClientTeam(i) > 1)
				{
					if (Group[i] == Group[param1])
					{
						decl String:PlayerName[64];
						decl String:SteamID[64];
						
						new PlayerHP;
						
						GetClientAuthString(i, SteamID, sizeof(SteamID));
						GetGroupOwner(Group[i], OwnerID, sizeof(OwnerID));
						
						PlayerHP = GetClientHealth(i);
						
						if (StrEqual(SteamID, OwnerID))
						{
							Format(PlayerName, sizeof(PlayerName), "%N - Chef de Groupe - HP:%i", i, PlayerHP);
						}
						else
						{
							Format(PlayerName, sizeof(PlayerName), "%N - HP:%i", i, PlayerHP);
						}
						
						DrawPanelItem(GroupList, PlayerName, 30);
					}
				}
			}
			
			decl String:query[256];
			decl String:error[256];
			new Handle:db_rp = SQL_Connect("roleplay", true, error, sizeof(error));
			Format(query, sizeof(query), "SELECT steam_id, pseudo FROM `Roleplay_Players` WHERE `groupe` =  %i;", Group[param1]);
			
			new Handle:group_list = SQL_Query(db_rp, query);
			
			if (group_list)
			{
				while (SQL_FetchRow(group_list))
				{
					decl String:SteamID[64];
					decl String:SteamID2[64];
					decl String:Pseudo[64];
					decl String:Namee[64];
					
					new bool:found;
					
					SQL_FetchString(group_list, 0, SteamID, 64);
					SQL_FetchString(group_list, 1, Namee, 64);
					
					for (new i = 1; i <= MaxClients; i++)
					{
						if (IsClientInGame(i) && IsPlayerAlive(i) && GetClientTeam(i) > 1)
						{
							GetClientAuthString(i, SteamID2, sizeof(SteamID2));
							
							if (StrEqual(SteamID, SteamID2))
							{
								found = true;
							}
						}
					}
					
					if (!found)
					{
						if (StrEqual(SteamID, OwnerID))
						{
							Format(Pseudo, sizeof(Pseudo), "%s - Chef de Groupe - Hors Ligne", Namee);
						}
						else
						{
							Format(Pseudo, sizeof(Pseudo), "%s - Hors Ligne", Namee);
						}
						
						DrawPanelItem(GroupList, Pseudo, 1);
					}
				}
				CloseHandle(group_list);
				CloseHandle(db_rp);
			}
			
			DrawPanelItem(GroupList, "Fermer", 30);
			
			SetPanelCurrentKey(GroupList, 10);
			
			SendPanelToClient(GroupList, param1, Handler_DoNothing, 30);
		}
		
		if (StrEqual(info, "virer"))
		{
			new Handle:GroupVirer = CreateMenu(Menu_VirerGroup);
			SetMenuTitle(GroupVirer, "Choissisez la personne à virer :");
			
			decl String:OwnerID[64];
			
			GetGroupOwner(Group[param1], OwnerID, sizeof(OwnerID));
			
			decl String:query[256];
			decl String:error[256];
			new Handle:db_rp = SQL_Connect("roleplay", true, error, sizeof(error));
			Format(query, 255, "SELECT * FROM `Roleplay_Players` WHERE `groupe` =  %i;", Group[param1]);
			
			new Handle:group_virer = SQL_Query(db_rp, query);
			
			if (group_virer)
			{
				while (SQL_FetchRow(group_virer))
				{
					decl String:Pseudo[64];
					decl String:SteamID[64];
					
					SQL_FetchString(group_virer, 0, SteamID, 64);
					SQL_FetchString(group_virer, 2, Pseudo, 64);
					
					if (StrEqual(SteamID, OwnerID))
					{
						Format(Pseudo, sizeof(Pseudo), "%s - Chef de Groupe", SteamID);
						
						AddMenuItem(GroupVirer, SteamID, Pseudo, ITEMDRAW_DISABLED);
					}
					else
					{
						Format(Pseudo, sizeof(Pseudo), "%s", SteamID);
						
						AddMenuItem(GroupVirer, SteamID, Pseudo);
					}
				}
				
				CloseHandle(group_virer);
				CloseHandle(db_rp);
			}
			
			DisplayMenu(GroupVirer, param1, 30);
		}
		
		if (StrEqual(info, "quit"))
		{
			decl String:SteamID[64];
			decl String:OwnerID[64];
			decl String:query[256];
			
			GetClientAuthString(param1, SteamID, sizeof(SteamID));
			GetGroupOwner(Group[param1], OwnerID, sizeof(OwnerID));
			
			if (StrEqual(SteamID, OwnerID))
			{
				decl String:error[256];
				new Handle:db_rp = SQL_Connect("roleplay", true, error, sizeof(error));
				Format(query, 255, "DELETE FROM `Roleplay_Groups` WHERE `id` = %i;", Group[param1]);
				SQL_FastQuery(db_rp, query);
				
				Format(query, 255, "SELECT * FROM `Roleplay_Players` WHERE `groupe` =  %i;", Group[param1]);
				new Handle:group_remove = SQL_Query(db_rp, query);
				
				if (group_remove)
				{
					while (SQL_FetchRow(group_remove))
					{
						SQL_FetchString(group_remove, 0, SteamID, 64);
						
						Format(query, sizeof(query), "UPDATE `Roleplay_Players` SET `groupe` = '0' WHERE `steam_id` = '%s';", SteamID);
						SQL_FastQuery(db_rp, query);
					}
					
					CloseHandle(group_remove);
				}
				CloseHandle(db_rp);
				
				for (new i = 1; i <= MaxClients; i++)
				{
					if (IsClientInGame(i))
					{
						if (Group[i] == Group[param1])
						{
							Group[i] = 0;
						}
					}
				}
				
				CPrintToChat(param1, "%s Vous avez supprimer votre groupe.", LOGO);
			}
			else
			{
				decl String:GroupName[128];
				
				GetGroupName(Group[param1], GroupName, sizeof(GroupName));
				
				Group[param1] = 0;
				CPrintToChat(param1, "%s Vous avez quitter le groupe %s", LOGO, GroupName);
			}
		}
	}
	else
	{
		if (action == MenuAction_End)
		{
			CloseHandle(GroupMenu);
		}
	}
}

public GetGroupOwner(ID, String:GroupOwner[], maxlen)
{
	decl String:TGroupOwner[128];
	decl String:query[256];
	
	decl String:error[256];
	new Handle:db_rp = SQL_Connect("roleplay", true, error, sizeof(error));
	Format(query, sizeof(query), "SELECT * FROM `Roleplay_Groups` WHERE `id` =  '%i';", ID);
	
	new Handle:group_owner = SQL_Query(db_rp, query);
	
	if (group_owner)
	{
		while (SQL_FetchRow(group_owner))
		{
			SQL_FetchString(group_owner, 2, TGroupOwner, sizeof(TGroupOwner));
		}
		
		CloseHandle(group_owner);
	}
	CloseHandle(db_rp);
	strcopy(GroupOwner, maxlen, TGroupOwner);
}

public Handler_DoNothing(Handle:menu, MenuAction:action, param1, param2)
{
	return 0;
}

public Menu_VirerGroup(Handle:GroupVirer, MenuAction:action, param1, param2)
{
	if (action == MenuAction_Select)
	{
		decl String:info[64];
		decl String:query[256];
		
		new bool:found;
		
		GetMenuItem(GroupVirer, param2, info, sizeof(info));
		
		decl String:error[256];
		new Handle:db_rp = SQL_Connect("roleplay", true, error, sizeof(error));
		Format(query, sizeof(query), "UPDATE `Roleplay_Players` SET `groupe` = 0 WHERE `steam_id` = '%s';", info);
		SQL_FastQuery(db_rp, query);
		CloseHandle(db_rp);
		
		for (new i = 1; i <= MaxClients; i++)
		{
			if (IsClientInGame(i))
			{
				decl String:SteamID[64];
				GetClientAuthString(i, SteamID, sizeof(SteamID));
				
				if (StrEqual(SteamID, info))
				{
					found = true;
					Group[i] = 0;
					
					CPrintToChat(i, "%s %N vous a viré de son groupe.", LOGO, param1);
					CPrintToChat(param1, "%s Vous avez viré %N de votre groupe.", LOGO, i);
				}
			}
		}
		
		if (!found)
		{
			CPrintToChat(param1, "%s Vous avez virer un joueur de votre groupe.", LOGO);
		}
	}
	else
	{
		if (action == MenuAction_End)
		{
			CloseHandle(GroupVirer);
		}
	}
}

public Action:Command_GroupInvite(client, args)
{
	if (IsClientInGame(client))
	{
		decl String:SteamID[64];
		decl String:OwnerID[64];
		
		GetClientAuthString(client, SteamID, sizeof(SteamID));
		
		GetGroupOwner(Group[client], OwnerID, sizeof(OwnerID));
		
		if (StrEqual(SteamID, OwnerID))
		{
			new Ent = GetClientAimTarget(client, true);
			
			if (Ent != -1)
			{
				if (Group[Ent] > 0)
				{
					CPrintToChat(client, "%s Ce joueur appartient déjà à un groupe.", LOGO);
				}
				else
				{
					decl String:GroupName[128];
					decl String:Title[64];
					decl String:Choose[64];
					
					GetGroupName(Group[client], GroupName, sizeof(GroupName));
					
					new Handle:GroupInvit = CreateMenu(Menu_GroupInvit);
					
					Format(Title, sizeof(Title), "%N souhaite vous inviter dans son groupe (%s):", client, GroupName);
					SetMenuTitle(GroupInvit, Title);
					
					Format(Choose, sizeof(Choose), "A_%i", client);
					AddMenuItem(GroupInvit, Choose, "Accepter");
					
					Format(Choose, sizeof(Choose), "R_%i", client);
					AddMenuItem(GroupInvit, Choose, "Refuser");
					
					DisplayMenu(GroupInvit, Ent, MENU_TIME_FOREVER);
					
					CPrintToChat(client, "%s Vous avez inviter %N à rejoindre votre groupe.", LOGO, Ent);
				}
			}
			else
			{
				CPrintToChat(client, "%s Vous devez viser le joueur à inviter.", LOGO);
			}
		}
		else
		{
			CPrintToChat(client, "%s Vous n'êtes pas le chef du groupe.", LOGO);
		}
	}
	return Plugin_Handled;
}

public Menu_GroupInvit(Handle:GroupInvit, MenuAction:action, param1, param2)
{
	if (action == MenuAction_Select)
	{
		decl String:info[32];
		GetMenuItem(GroupInvit, param2, info, sizeof(info));
		decl String:Buffer[8][32];
		
		ExplodeString(info, "_", Buffer, 2, 32);
		
		new client = StringToInt(Buffer[1]);
		
		if (IsClientInGame(param1) && IsClientInGame(client))
		{
			if (StrEqual(Buffer[0], "A"))
			{
				decl String:query[256];
				decl String:SteamID[64];
				
				GetClientAuthString(param1, SteamID, sizeof(SteamID));
				
				decl String:error[256];
				new Handle:db_rp = SQL_Connect("roleplay", true, error, sizeof(error));
				Format(query, sizeof(query), "UPDATE `Roleplay_Players` SET `groupe` = %i WHERE `steam_id` = '%s';", Group[client], SteamID);
				SQL_FastQuery(db_rp, query);
				CloseHandle(db_rp);

				Group[param1] = Group[client];
				
				CPrintToChat(param1, "%s Vous avez intégrer le groupe de %N", LOGO, client);
				CPrintToChat(client, "%s %N a intégrer votre groupe.", LOGO, param1);
			}
			else
			{
				if (StrEqual(Buffer[0], "R"))
				{
					CPrintToChat(param1, "%s Vous avez refuser d'intégrer le groupe de %N.", LOGO, client);
					CPrintToChat(client, "%s %N a refusé d'intégrer votre groupe.", LOGO, param1);
				}
			}
		}
	}
	else
	{
		if (action == MenuAction_End)
		{
			CloseHandle(GroupInvit);
		}
	}
}

public Action:TextMsg(UserMsg:msg_id, Handle:bf, const players[], playersNum, bool:reliable, bool:init)
{
    decl String:msg[256];
    BfReadString(bf, msg, sizeof(msg), false);

    if(StrContains(msg, "damage", false) != -1 || StrContains(msg, "-------", false) != -1)
    {
        return Plugin_Handled;
    }

    return Plugin_Continue;
}

public Action:Command_Sucer(client, args)
{
	if (IsClientInGame(client))
	{
		if (rankid[client] == 13)
		{
			new Ent = GetClientAimTarget(client, true);
			
			if (Ent != -1)
			{
				decl String:ItemAccepter[12];
				decl String:ItemRefuser[12];
				
				new Handle:menu_Sell_Sucer = CreateMenu(Menu_SellSucer);
				SetMenuTitle(menu_Sell_Sucer, "%N vous propose une fellation pour 200€", client);
				
				Format(ItemAccepter, sizeof(ItemAccepter), "%i_a", client);
				AddMenuItem(menu_Sell_Sucer, ItemAccepter, "Accepter l'offre");
				
				Format(ItemRefuser, sizeof(ItemRefuser), "%i_r", client);
				AddMenuItem(menu_Sell_Sucer, ItemRefuser, "Décliner l'offre");
				
				DisplayMenu(menu_Sell_Sucer, Ent, MENU_TIME_FOREVER);
			}
			else
			{
				CPrintToChat(client, "%s Vous devez viser un joueur.", LOGO);
			}
		}
		else
		{
			CPrintToChat(client, "%s {red}Vous n'avez pas accès à cette commande.", LOGO);
		}
	}
	return Plugin_Handled;
}

public Menu_SellSucer(Handle:menu_Sell_Sucer, MenuAction:action, param1, param2)
{
	if (action == MenuAction_Select)
	{
		new Vendeur;
		decl String:info[32];
		
		GetMenuItem(menu_Sell_Sucer, param2, info, sizeof(info));
		
		decl String:Buffer[8][32];
		
		ExplodeString(info, "_", Buffer, 2, 32);
		
		Vendeur = StringToInt(Buffer[0]);
		
		if (StrEqual(Buffer[1], "a"))
		{
			decl Float:suck_vec[3];
			decl Float:plyr_vec[3];
			
			GetClientAbsOrigin(Vendeur, suck_vec);
			GetClientAbsOrigin(param1, plyr_vec);
			
			if (GetVectorDistance(suck_vec, plyr_vec) < 90)
			{
				new amount;
				
				if (cb[param1] == 1)
				{
					amount = bank[param1] - 200;
				}
				else
				{
					amount = money[param1] - 200;
				}
				if (0 <= amount)
				{
					if (cb[param1] == 1)
					{
						new later = bank[param1];
						bank[param1] = later - 200;
					}
					else
					{
						new after = money[param1];
						money[param1] = after - 200;
					}
					
					new mone = money[Vendeur];
					money[Vendeur] = mone + 100;
					
					new capi = capital[13];
					capital[13] = capi + 100;
					
					ClientCommand(Vendeur, "+duck");
					
					ClientCommand(param1, "r_screenoverlay effects/tp_eyefx/tp_eyefx.vmt");
					
					SetEntityMoveType(param1, MOVETYPE_NONE);
					SetEntityMoveType(Vendeur, MOVETYPE_NONE);
					
					SetEntPropFloat(Vendeur, Prop_Send, "m_flProgressBarStartTime", GetGameTime()); 
					SetEntProp(Vendeur, Prop_Send, "m_iProgressBarDuration", 15);
					
					SetEntPropFloat(param1, Prop_Send, "m_flProgressBarStartTime", GetGameTime()); 
					SetEntProp(param1, Prop_Send, "m_iProgressBarDuration", 15);
					
					CreateTimer(15.0, SuckTimer, param1);
					CreateTimer(15.0, SuckTimer, Vendeur);
				}
				else
				{
					CPrintToChat(Vendeur, "%s {green}%N{red} n'as pas assez d'argent !", LOGO, param1);
					CPrintToChat(param1, "%s {red} Vous n'avez pas l'argent !", LOGO);
				}
			}
			else
			{
				CPrintToChat(Vendeur, "%s Vous devez vous rapprocher de %N pour débuter une fellation.", LOGO, param1);
				CPrintToChat(param1, "%s %N n'est pas assez proche de vous pour débuter une fellation.", LOGO, Vendeur);
			}
		}
		else if (StrEqual(Buffer[1], "r"))
		{
			CPrintToChat(Vendeur, "%s %N a refuser votre offre.", LOGO, param1);
			CPrintToChat(param1, "%s Vous avez refuser l'offre de %N.", LOGO, Vendeur);
		}
	}
	else
	{
		if (action == MenuAction_End)
		{
			CloseHandle(menu_Sell_Sucer);
		}
	}
}

public Action:SuckTimer(Handle:timer, any:param1)
{
	if (IsClientInGame(param1))
	{
		SetEntPropFloat(param1, Prop_Send, "m_flProgressBarStartTime", GetGameTime()); 
		SetEntProp(param1, Prop_Send, "m_iProgressBarDuration", 0);
		
		SetEntityMoveType(param1, MOVETYPE_WALK);
		
		ClientCommand(param1, "-duck");
		ClientCommand(param1, "r_screenoverlay 0");
		
		if (rankid[param1] != 13)
		{
			if (rankid[param1] == 1)
			{
				SetEntityHealth(param1, 500);
			}
			else
			{
				SetEntityHealth(param1, 100);
			}
			
			CPrintToChat(param1, "%s Après cet instant de détente vous avez récupérer tous vos points de vie.", LOGO);
		}
	}
}

public Action:Command_AdminMenu(client, args)
{
	if (IsClientInGame(client))
	{
		if (GetUserFlagBits(client) & ADMFLAG_ROOT)
		{
			BuildAdminMenu(client);
		}
		else
		{
			CPrintToChat(client, "%s {red}Vous n'avez pas accès a cette commande.", LOGO);
		}
	}
	return Plugin_Continue;
}

BuildAdminMenu(client)
{
	new Handle:adminMenu = CreateMenu(Menu_Admin);
	
	SetMenuTitle(adminMenu, "Menu Admin MGS-Roleplay ");
	AddMenuItem(adminMenu, "jobmenu", "Donner un métier");
	AddMenuItem(adminMenu, "respawnmenu", "Réanimer un joueur");
	AddMenuItem(adminMenu, "heure", "Gérer l'heure");
	AddMenuItem(adminMenu, "raz", "Réinitialisé un joueur");
	DisplayMenu(adminMenu, client, MENU_TIME_FOREVER);
}

public Menu_Admin(Handle:adminMenu, MenuAction:action, param1, param2)
{
	if (action == MenuAction_Select)
	{
		decl String:info[32];
		GetMenuItem(adminMenu, param2, info, sizeof(info));
		
		if (StrEqual(info, "jobmenu"))
		{
			FakeClientCommandEx(param1, "sm_jobmenu");
		}
		else if (StrEqual(info, "respawnmenu"))
		{
			FakeClientCommandEx(param1, "sm_respawn");
		}
		else if (StrEqual(info, "heure"))
		{
			FakeClientCommandEx(param1, "sm_temps");
		}
		else if (StrEqual(info, "raz"))
		{
			BuildRazMenu(param1);
		}
	}
	else
	{
		if (action == MenuAction_End)
		{
			CloseHandle(adminMenu);
		}
	}
}

public Action:Command_RespawnAdmin(client, Args)
{
	if (IsClientInGame(client))
	{
		if (GetUserFlagBits(client) & ADMFLAG_ROOT)
		{
			BuildRespawnMenu(client);
		}
	}
	return Plugin_Continue;
}

Handle:BuildRespawnMenu(client)
{
	decl String:iString[12];
	decl String:name[32];
	
	new Handle:RespList = CreateMenu(Menu_RespawnList);
	SetMenuTitle(RespList, "Liste des joueurs à réanimer :");
	
	for (new i = 1; i <= MaxClients; i++)
	{
		if (IsClientInGame(i))
		{
			if (!IsPlayerAlive(i))
			{
				IntToString(i, iString, sizeof(iString));
				GetClientName(i, name, sizeof(name));
				
				AddMenuItem(RespList, iString, name);
			}
		}
	}
	
	DisplayMenu(RespList, client, MENU_TIME_FOREVER);
}

public Menu_RespawnList(Handle:RespList, MenuAction:action, param1, param2)
{
	if (action == MenuAction_Select)
	{
		decl String:info[256];
		GetMenuItem(RespList, param2, info, sizeof(info));
		
		new player = StringToInt(info);
		
		if (!IsPlayerAlive(player))
		{
			g_CountDead[player] = 1;
			g_deadtimer[player] = CreateTimer(1.0, Timer_Dead, player, TIMER_REPEAT);

			CPrintToChat(player, "%s {green}%N {blue}vous redonne la vie !", LOGO, param1);
			
			decl String:SteamID[64];
			decl String:SteamID2[64];
			
			GetClientAuthString(param1, SteamID, sizeof(SteamID));
			GetClientAuthString(player, SteamID2, sizeof(SteamID2));
			
			LogToFile(Logfile,"%N(%s) a réanimer %N(%s)", param1, SteamID, player, SteamID2);
		}
		BuildRespawnMenu(param1);
	}
	else
	{
		if (action == MenuAction_End)
		{
			CloseHandle(RespList);
		}
	}
}
public Action:Command_Detective(client, Args)
{
	if (IsClientInGame(client))
	{
		if (rankid[client] == 14)
		{
			new Ent = GetClientAimTarget(client, true);
			
			if (Ent != -1)
			{
				decl String:name[32];
				decl String:info[32];
				decl String:sEnquete[32];
				
				new Handle:sell_menu_enquete = CreateMenu(Menu_Sell_Enquete);
				SetMenuTitle(sell_menu_enquete, "Veuillez choisir une enquête à proposer :");
				
				for (new i = 1; i <= MaxClients; i++)
				{
					if (IsClientInGame(i))
					{
						GetClientName(i, name, sizeof(name));
						
						IntToString(i, info, sizeof(info));
						
						Format(sEnquete, sizeof(sEnquete), "%i_%i", i, Ent);
						AddMenuItem(sell_menu_enquete, sEnquete, name);
					}
				}
				DisplayMenu(sell_menu_enquete, client, MENU_TIME_FOREVER);
			}
			else
			{
				CPrintToChat(client, "%s Vous devez viser un joueur.", LOGO);
			}
		}
		else
		{
			CPrintToChat(client, "%s {red}Vous n'avez pas accès à cette commande.", LOGO);
		}
	}
	return Plugin_Continue;
}

public Menu_Sell_Enquete(Handle:sell_menu_enquete, MenuAction:action, param1, param2)
{
	if (action == MenuAction_Select)
	{
		decl String:info[256];
		
		new TempCible;
		new TempAcheteur;
		
		GetMenuItem(sell_menu_enquete, param2, info, sizeof(info));
		
		decl String:Buffer[8][32];
		
		ExplodeString(info, "_", Buffer, 2, 32);
		
		TempCible = StringToInt(Buffer[0]);
		TempAcheteur = StringToInt(Buffer[1]);
		
		decl String:ItemAccepter[12];
		decl String:ItemRefuser[12];
		
		new Handle:menu_sellEnquete = CreateMenu(Menu_SellEnquete);
		SetMenuTitle(menu_sellEnquete, "%N vous propose de vous vendre une enquête sur %N pour 300€", param1, TempCible);
		
		Format(ItemAccepter, sizeof(ItemAccepter), "%i_%i_a", param1, TempCible);
		AddMenuItem(menu_sellEnquete, ItemAccepter, "Accepter l'offre");
		
		Format(ItemRefuser, sizeof(ItemRefuser), "%i_r", param1);
		AddMenuItem(menu_sellEnquete, ItemRefuser, "Décliner l'offre");
		
		SetMenuExitButton(menu_sellEnquete, false);
		DisplayMenu(menu_sellEnquete, TempAcheteur, 30);
	}
	else
	{
		if (action == MenuAction_End)
		{
			CloseHandle(sell_menu_enquete);
		}
	}
}

public Menu_SellEnquete(Handle:menu_sellEnquete, MenuAction:action, param1, param2)
{
	if (action == MenuAction_Select)
	{
		decl String:info[32];
		
		new TempCible;
		new TempVendeur;
		
		GetMenuItem(menu_sellEnquete, param2, info, sizeof(info));
		
		decl String:Buffer[12][32];
		
		ExplodeString(info, "_", Buffer, 3, 32);
		
		TempVendeur = StringToInt(Buffer[0]);
		TempCible = StringToInt(Buffer[1]);
		
		if (StrEqual(Buffer[2], "a"))
		{
			decl moneyAcheteur;
			
			if (cb[param1] == 1)
			{
				moneyAcheteur = bank[param1];
			}
			else
			{
				moneyAcheteur = money[param1];
			}
			
			decl result;
			moneyAcheteur -= 150;
			result = moneyAcheteur - 150;
			
			if (0 <= result)
			{
				if (cb[param1] == 1)
				{
					new after = bank[param1];
					bank[param1] = after + 150;
				}
				else
				{
					new later = money[param1];
					money[param1] = later + 150;
				}
				
				new capi = capital[14];
				capital[14] = capi + 150;
				
				new xd = money[TempVendeur];
				money[TempVendeur] = xd;
				

				if (TempCible != -1)
				{
					new plyr_hp = GetClientHealth(TempCible);
					
					new armour = GetEntProp(TempCible, Prop_Send, "m_ArmorValue");
					
					CPrintToChat(param1, "%s Vous avez acheté des informations sur : %N:\nVie: %i - kevlar: %i\nTué par: %s - Salaire: %i\nArgent: %i -Argent en Banque: %i", LOGO, TempCible, plyr_hp, armour, sLastkiller, salaire[TempCible], money[TempCible], bank[TempCible]);
				}
			}
			else
			{
				CPrintToChat(TempVendeur, "%s  {green}%N{red} n'as pas assez d'argent !", LOGO, param1);
				CPrintToChat(param1, "%s {red} Vous n'avez pas l'argent !", LOGO);
			}
		}
		if (StrEqual(Buffer[2], "r"))
		{
			CPrintToChat(TempVendeur, "%s %N a refuser votre offre.", LOGO, param1);
			CPrintToChat(param1, "%s Vous avez refuser l'offre de %N.", LOGO, TempVendeur);
		}
	}
	else
	{
		if (action == MenuAction_End)
		{
			CloseHandle(menu_sellEnquete);
		}
	}
}

public Action:Command_Flame(client, args)
{
	if (client)
	{ 
		if (IsPlayerAlive(client))
		{
			if (flameAmount[client] > 0)
			{
				if (g_flameEnabled[client])
				{						
					new Float:vAngles[3];
					new Float:vOrigin[3];
					new Float:aOrigin[3];
					new Float:EndPoint[3];
					new Float:AnglesVec[3];
					new Float:targetOrigin[3];
					new Float:pos[3];
					
					flameAmount[client]--;
					CPrintToChat(client, "%s Il vous reste %i Lances-Flammes", LOGO, flameAmount[client]);
					
					countpyro[client] += 1;
										
					new String:tName[128];
					
					new Float:distance = 600.0;
					
					GetClientEyePosition(client, vOrigin);
					GetClientAbsOrigin(client, aOrigin);
					GetClientEyeAngles(client, vAngles);
					
					GetAngleVectors(vAngles, AnglesVec, NULL_VECTOR, NULL_VECTOR);
					
					EndPoint[0] = vOrigin[0] + (AnglesVec[0]*distance);
					EndPoint[1] = vOrigin[1] + (AnglesVec[1]*distance);
					EndPoint[2] = vOrigin[2] + (AnglesVec[2]*distance);
				
					new Handle:trace = TR_TraceRayFilterEx(vOrigin, EndPoint, MASK_SHOT, RayType_EndPoint, TraceEntityFilterPlayer, client);
					
					
					Format(tName, sizeof(tName), "target%i", client);
					DispatchKeyValue(client, "targetname", tName);
					
					EmitSoundToClient(client, "weapons/rpg/rocketfire1.wav", _, _, _, _, 0.7);
					
					
					new String:flame_name[128];
					Format(flame_name, sizeof(flame_name), "Flame%i", client);
					new flame = CreateEntityByName("env_steam");
					DispatchKeyValue(flame,"targetname", flame_name);
					DispatchKeyValue(flame, "parentname", tName);
					DispatchKeyValue(flame,"SpawnFlags", "1");
					DispatchKeyValue(flame,"Type", "0");
					DispatchKeyValue(flame,"InitialState", "1");
					DispatchKeyValue(flame,"Spreadspeed", "10");
					DispatchKeyValue(flame,"Speed", "800");
					DispatchKeyValue(flame,"Startsize", "10");
					DispatchKeyValue(flame,"EndSize", "250");
					DispatchKeyValue(flame,"Rate", "15");
					DispatchKeyValue(flame,"JetLength", "400");
					DispatchKeyValue(flame,"RenderColor", "180 71 8");
					DispatchKeyValue(flame,"RenderAmt", "180");
					DispatchSpawn(flame);
					TeleportEntity(flame, aOrigin, AnglesVec, NULL_VECTOR);
					SetVariantString(tName);
					AcceptEntityInput(flame, "SetParent", flame, flame, 0);
					
					
					SetVariantString("forward");
					
					AcceptEntityInput(flame, "SetParentAttachment", flame, flame, 0);
					AcceptEntityInput(flame, "TurnOn");
					
					
					new String:flame_name2[128];
					Format(flame_name2, sizeof(flame_name2), "Flame2%i", client);
					new flame2 = CreateEntityByName("env_steam");
					DispatchKeyValue(flame2,"targetname", flame_name2);
					DispatchKeyValue(flame2, "parentname", tName);
					DispatchKeyValue(flame2,"SpawnFlags", "1");
					DispatchKeyValue(flame2,"Type", "1");
					DispatchKeyValue(flame2,"InitialState", "1");
					DispatchKeyValue(flame2,"Spreadspeed", "10");
					DispatchKeyValue(flame2,"Speed", "600");
					DispatchKeyValue(flame2,"Startsize", "50");
					DispatchKeyValue(flame2,"EndSize", "400");
					DispatchKeyValue(flame2,"Rate", "10");
					DispatchKeyValue(flame2,"JetLength", "500");
					DispatchSpawn(flame2);
					TeleportEntity(flame2, aOrigin, AnglesVec, NULL_VECTOR);
					SetVariantString(tName);
					AcceptEntityInput(flame2, "SetParent", flame2, flame2, 0);
					

					SetVariantString("forward");
					
					AcceptEntityInput(flame2, "SetParentAttachment", flame2, flame2, 0);
					AcceptEntityInput(flame2, "TurnOn");
					
					new Handle:flamedata = CreateDataPack();
					
					CreateTimer(1.0, KillFlame, flamedata);
					
					WritePackCell(flamedata, flame);
					WritePackCell(flamedata, flame2);
				
					if(TR_DidHit(trace))
					{							
						TR_GetEndPosition(pos, trace);
					}
					
					CloseHandle(trace);
				
					for (new i = 1; i <= GetMaxClients(); i++)
					{
						if (i == client)
							continue;
						
						if (IsClientInGame(i) && IsPlayerAlive(i))
						{
							new ff_on = GetConVarInt(FindConVar("mp_friendlyfire"));
							
							if (ff_on)
							{
								GetClientAbsOrigin(i, targetOrigin);
								
								if ((GetVectorDistance(targetOrigin, pos) < 200)  && (GetVectorDistance(targetOrigin, vOrigin) < 600))
								{
									IgniteEntity(i, 5.0, false, 1.5, false);
								}
							}
							else
							{
								if (GetClientTeam(i) == GetClientTeam(client))
									continue;
									
								GetClientAbsOrigin(i, targetOrigin);
								
								if ((GetVectorDistance(targetOrigin, pos) < 200)  && (GetVectorDistance(targetOrigin, vOrigin) < 600))
								{
									IgniteEntity(i, 5.0, false, 1.5, false);
								}
							}
						}
					}
				}
				else
				{
					CPrintToChat(client, "%s Votre Lance-Flamme se recharge, patientez...", LOGO);
				}
			}
			else
			{
				CPrintToChat(client, "%s Vous n'avez plus de lance-flamme", LOGO);
				
				EmitSoundToClient(client, "weapons/ar2/ar2_empty.wav", _, _, _, _, 0.8);
			}
		}
	}
	
	g_flameEnabled[client] = 0;
	
	CreateTimer(3.0, SetFlame, client);
	
	return Plugin_Handled;
}

public Action:SetFlame(Handle:timer, any:client)
{
	g_flameEnabled[client] = 1;
}

public Action:KillFlame(Handle:timer, Handle:flamedata)
{
	ResetPack(flamedata);
	new ent1 = ReadPackCell(flamedata);
	new ent2 = ReadPackCell(flamedata);
	CloseHandle(flamedata);
	
	new String:classname[256];
	
	if (IsValidEntity(ent1))
    {
		AcceptEntityInput(ent1, "TurnOff");
		GetEdictClassname(ent1, classname, sizeof(classname));
		
		if (StrEqual(classname, "env_steam", false))
        {
            RemoveEdict(ent1);
        }
    }
	
	if (IsValidEntity(ent2))
    {
		AcceptEntityInput(ent2, "TurnOff");
		GetEdictClassname(ent2, classname, sizeof(classname));
		
		if (StrEqual(classname, "env_steam", false))
        {
            RemoveEdict(ent2);
        }
    }
}

public bool:TraceEntityFilterPlayer(entity, contentsMask, any:data)
{
	return data != entity;
} 

public Action:Command_Godmod(client, args)
{
	if (IsClientInGame(client))
	{
		new String:SteamID[64];
		GetClientAuthString(client, SteamID, sizeof(SteamID));
		
		if (Chef_SERVEUR(client))
		{
			if (IsPlayerAlive(client))
			{
				if (g_godmod[client] == 0)
				{
					SetEntProp(client, Prop_Data, "m_takedamage", 0, 1);
					CPrintToChat(client, "%s Vous avez activer le godmod.", LOGO);
					
					g_godmod[client] = 1;
				}
				else
				{
					SetEntProp(client, Prop_Data, "m_takedamage", 2, 1);
					CPrintToChat(client, "%s Vous avez désactiver le godmod.", LOGO);
					
					g_godmod[client] = 0;
				}
			}
		}
	}
}



BuildAmmuMenu(client)
{
	if (IsClientInGame(client))
	{
		new Handle:ammu_menu = CreateMenu(Menu_Ammu);
		SetMenuTitle(ammu_menu, "Veuillez choisir un produit à acheter :");
		AddMenuItem(ammu_menu, "Armes", "--- Autres ---", ITEMDRAW_DISABLED);
		AddMenuItem(ammu_menu, "2", "Cartouche (Prix: 300$)");
		AddMenuItem(ammu_menu, "3", "Grenade (Prix: 200$)");
		AddMenuItem(ammu_menu, "4", "Flashbang (Prix: 200$)");
		AddMenuItem(ammu_menu, "5", "Fumigène (Prix: 200$)");
		AddMenuItem(ammu_menu, "6", "Kevlar (Prix: 1200$)");
		AddMenuItem(ammu_menu, "Armes", "--- Armes ---", ITEMDRAW_DISABLED);
		AddMenuItem(ammu_menu, "7", "Glock (Prix: 200$)");
		AddMenuItem(ammu_menu, "8", "USP (Prix: 200$)");
		AddMenuItem(ammu_menu, "9", "P228 (Prix: 250$)");
		AddMenuItem(ammu_menu, "10", "Deagle (Prix: 400$)");
		AddMenuItem(ammu_menu, "11", "Elites (Prix: 500$)");
		AddMenuItem(ammu_menu, "12", "Five Seven (Prix: 360$)");
		AddMenuItem(ammu_menu, "13", "M3 (Prix: 800$)");
		AddMenuItem(ammu_menu, "14", "XM1014 (Prix: 1200$)");
		AddMenuItem(ammu_menu, "15", "Galil (Prix: 800$)");
		AddMenuItem(ammu_menu, "16", "Ak47 (Prix: 1200$)");
		AddMenuItem(ammu_menu, "17", "Scout (Prix: 1300$)");
		AddMenuItem(ammu_menu, "18", "Sg552 (Prix: 1000$)");
		AddMenuItem(ammu_menu, "19", "AWP (Prix: 2000$)");
		AddMenuItem(ammu_menu, "20", "G3SG1 (Prix: 2000$)");
		AddMenuItem(ammu_menu, "21", "Famas (Prix: 900$)");
		AddMenuItem(ammu_menu, "22", "M4A1 (Prix: 1200$)");
		AddMenuItem(ammu_menu, "23", "Aug (Prix: 1000$)");
		AddMenuItem(ammu_menu, "24", "Sg550 (Prix: 2000$)");
		AddMenuItem(ammu_menu, "25", "Mac10 (Prix: 600$)");
		AddMenuItem(ammu_menu, "26", "TMP (Prix: 600$)");
		AddMenuItem(ammu_menu, "27", "Mp5 Navy (Prix: 800$)");
		AddMenuItem(ammu_menu, "28", "Ump45 (Prix: 700$)");
		AddMenuItem(ammu_menu, "29", "P90 (Prix: 900$)");
		AddMenuItem(ammu_menu, "30", "M249 (Prix: 2500$)");
		DisplayMenu(ammu_menu, client, MENU_TIME_FOREVER);
	}
}

public Menu_Ammu(Handle:ammu_menu, MenuAction:action, param1, param2)
{
	if (action == MenuAction_Select)
	{
		decl String:info[32];
		GetMenuItem(ammu_menu, param2, info, sizeof(info));
		
		new itemID = StringToInt(info);
		
		if (IsInArmu(param1))
		{
			new Price;
			
			switch (itemID)
			{
				case 2:
				{
					Price = 300;
				}
				case 3:
				{
					Price = 200;
				}
				case 4:
				{
					Price = 200;
				}
				case 5:
				{
					Price = 200;
				}
				case 6:
				{
					Price = 1200;
				}
				case 7:
				{
					Price = 200;
				}
				case 8:
				{
					Price = 200;
				}
				case 9:
				{
					Price = 250;
				}
				case 10:
				{
					Price = 400;
				}
				case 11:
				{
					Price = 500;
				}
				case 12:
				{
					Price = 360;
				}
				case 13:
				{
					Price = 800;
				}
				case 14:
				{
					Price = 1200;
				}
				case 15:
				{
					Price = 800;
				}
				case 16:
				{
					Price = 1200;
				}
				case 17:
				{
					Price = 1300;
				}
				case 18:
				{
					Price = 1000;
				}
				case 19:
				{
					Price = 2000;
				}
				case 20:
				{
					Price = 2000;
				}
				case 21:
				{
					Price = 900;
				}
				case 22:
				{
					Price = 1200;
				}
				case 23:
				{
					Price = 1000;
				}
				case 24:
				{
					Price = 2000;
				}
				case 25:
				{
					Price = 600;
				}
				case 26:
				{
					Price = 600;
				}
				case 27:
				{
					Price = 800;
				}
				case 28:
				{
					Price = 700;
				}
				case 29:
				{
					Price = 900;
				}
				case 30:
				{
					Price = 2500;
				}
			}
			if (money[param1] >= Price)
			{
				new argentt = money[param1];
				money[param1] = argentt - Price;
				
				PrintToChat(param1, "%s : Achat réalisé avec succès.", LOGO);
				
				BuildAmmuMenu(param1);
				
				switch (itemID)
				{
					case 2:
					{
						cartouche[param1] = cartouche[param1] + 1;
					}
					case 3:
					{
						grenade[param1] = grenade[param1] + 1;
					}
					case 4:
					{
						flashbang[param1] = flashbang[param1] + 1;
					}
					case 5:
					{
						fumigene[param1] = fumigene[param1] + 1;
					}
					case 6:
					{
						kevlar[param1] = kevlar[param1] + 1;
					}
					case 7:
					{
						glock[param1] = glock[param1] + 1;
					}
					case 8:
					{
						usp[param1] = usp[param1] + 1;
					}
					case 9:
					{
						p228[param1] = p228[param1] + 1;
					}
					case 10:
					{
						deagle[param1] = deagle[param1] + 1;
					}
					case 11:
					{
						elites[param1] = elites[param1] + 1;
					}
					case 12:
					{
						fiveseven[param1] = fiveseven[param1] + 1;
					}
					case 13:
					{
						m3[param1] = m3[param1] + 1;
					}
					case 14:
					{
						xm1014[param1] = xm1014[param1] + 1;
					}
					case 15:
					{
						galil[param1] = galil[param1] + 1;
					}
					case 16:
					{
						ak47[param1] = ak47[param1] + 1;
					}
					case 17:
					{
						scout[param1] = scout[param1] + 1;
					}
					case 18:
					{
						sg552[param1] = sg552[param1] + 1;
					}
					case 19:
					{
						awp[param1] = awp[param1] + 1;
					}
					case 20:
					{
						g3sg1[param1] = g3sg1[param1] + 1;
					}
					case 21:
					{
						famas[param1] = famas[param1] + 1;
					}
					case 22:
					{
						m4a1[param1] = m4a1[param1] + 1;
					}
					case 23:
					{
						aug[param1] = aug[param1] + 1;
					}
					case 24:
					{
						sg550[param1] = sg550[param1] + 1;
					}
					case 25:
					{
						mac10[param1] = mac10[param1] + 1;
					}
					case 26:
					{
						tmp[param1] = tmp[param1] + 1;
					}
					case 27:
					{
						mp5[param1] = mp5[param1] + 1;
					}
					case 28:
					{
						ump45[param1] = ump45[param1] + 1;
					}
					case 29:
					{
						p90[param1] = p90[param1] + 1;
					}
					case 30:
					{
						m249[param1] = m249[param1] + 1;
					}
				}
				
				new thune = Price / 2;
				capital[5] += thune;
			}
			else
			{
				PrintToChat(param1, "%s {red}Vous n'avez pas les fonds nécessaires pour finaliser l'achat.", LOGO);
			}
		}
		else
		{
			PrintToChat(param1, "%s {red}Vous devez être dans l'armurerie pour finaliser votre achat.", LOGO);
		}
	}
	else
	{
		if (action == MenuAction_End)
		{
			CloseHandle(ammu_menu);
		}
	}
}

BuildBankMenu(client)
{
	if (IsClientInGame(client))
	{
		new Handle:bank_menu = CreateMenu(Menu_Bankk);
		SetMenuTitle(bank_menu, "Bienvenue dans la Banque \n ");
		AddMenuItem(bank_menu, "2", "Carte Bleue (Prix: 500€)");
		AddMenuItem(bank_menu, "3", "R.I.B (Prix: 1000€)");
		AddMenuItem(bank_menu, "4", "Fiche de Paie (Prix: 3000€)");
		DisplayMenu(bank_menu, client, MENU_TIME_FOREVER);
	}
}

public Menu_Bankk(Handle:bank_menu, MenuAction:action, param1, param2)
{
	if (action == MenuAction_Select)
	{
		decl String:info[32];
		GetMenuItem(bank_menu, param2, info, sizeof(info));
		
		new itemID = StringToInt(info);
		
		if (IsInBank(param1))
		{
			new Price;
			
			switch (itemID)
			{
				case 2:
				{
					Price = 500;
				}
				case 3:
				{
					Price = 1000;
				}
				case 4:
				{
					Price = 3000;
				}
			}
			
			if (money[param1] >= Price)
			{
				new argentt = money[param1];
				money[param1] = argentt - Price;
				
				CPrintToChat(param1, "%s Achat réalisé avec succès.", LOGO);
				
				BuildBankMenu(param1);
				
				switch (itemID)
				{
					case 2:
					{
						cb[param1] = 1;
					}
					case 3:
					{
						rib[param1] = 1;
					}
					case 4:
					{
						fiche[param1] = true;
					}
				}
				
				new thune = Price / 2;
				capital[7] += thune;
			}
			else
			{
				CPrintToChat(param1, "%s {red}Vous n'avez pas les fonds nécessaires pour finaliser l'achat.", LOGO);
			}
		}
		else
		{
			CPrintToChat(param1, "%s {red}Vous devez être dans la banque pour finaliser votre achat.", LOGO);
		}
	}
	else
	{
		if (action == MenuAction_End)
		{
			CloseHandle(bank_menu);
		}
	}
}

public Menu_Virerr(Handle:virer, MenuAction:action, client, param2)
{
	if (action == MenuAction_Select)
	{
		decl String:info[32];
		decl String:query[256];
		
		GetMenuItem(virer, param2, info, sizeof(info));
		
		if (IsClientInGame(client))
		{
			decl String:error[256];
			new Handle:db_rp = SQL_Connect("roleplay", true, error, sizeof(error));
			Format(query, sizeof(query), "UPDATE `Roleplay_Players` SET `jobid` = 0, `rankid` = 0 WHERE `steam_id` = '%s';", info);
			SQL_FastQuery(db_rp, query);
			
			new mdr = Client_FindBySteamId(info);
			
			if (mdr != -1)
			{
				if (GetClientTeam(mdr) == 3)
				{
					CS_SwitchTeam(mdr, 2);
				}
				
				jobid[mdr] = 0;
				rankid[mdr] = 0;
				
				decl String:ClanTagRankName[20];
				GetClanTagName(jobid[mdr], rankid[mdr], ClanTagRankName, sizeof(ClanTagRankName));

				CS_SetClientClanTag(mdr, ClanTagRankName);
				
				InitSalary(mdr);
				
				CPrintToChat(client, "%s Vous avez virer %N de votre entreprise.", LOGO, mdr);
				CPrintToChat(mdr, "%s Le joueur %N vous a virer de son entreprise.", LOGO, client);
				
				LogToFile(Logfile,"le joueur %N a virer %N de son entreprise", client, mdr);
			}
			else
			{
				CPrintToChat(client, "%s Vous avez virer un joueur de votre entreprise.", LOGO);
			}
			
			CloseHandle(db_rp);
		}
	}
	else
	{
		if (action == MenuAction_End)
		{
			CloseHandle(virer);
		}
	}
}

public Action:Command_Trade(client, Args)
{
	if (IsClientInGame(client))
	{
		BuildTradeMenu(client);
	}
	return Plugin_Continue;
}

Handle:BuildTradeMenu(client)
{
	decl String:Buffer[128];
	new Handle:Item = CreateMenu(Menu_Trade);
	SetMenuTitle(Item, "Bienvenue dans le menu d'echance, Ce système vous\npermet d'échanger des objets avec d'autres joueurs\n ");
	
	if (cartouche[client] > 0)
	{
		Format(Buffer, sizeof(Buffer), "Munitions (Quantité: %i)", cartouche[client]);
		AddMenuItem(Item, "cartouche", Buffer);
	}
	if (lsd[client] > 0)
	{
		Format(Buffer, sizeof(Buffer), "LSD (Quantité: %i)", lsd[client]);
		AddMenuItem(Item, "lsd", Buffer);
	}
	if (heroine[client] > 0)
	{
		Format(Buffer, sizeof(Buffer), "Héroïne (Quantité: %i)", heroine[client]);
		AddMenuItem(Item, "hero", Buffer);
	}
	if (exta[client] > 0)
	{
		Format(Buffer, sizeof(Buffer), "Extasy (Quantité: %i)", exta[client]);
		AddMenuItem(Item, "exta", Buffer);
	}
	if (cocaine[client] > 0)
	{
		Format(Buffer, sizeof(Buffer), "Cocaïne (Quantité: %i)", cocaine[client]);
		AddMenuItem(Item, "cocaine", Buffer);
	}
	if (weed[client] > 0)
	{
		Format(Buffer, sizeof(Buffer), "Weed (Quantité: %i)", weed[client]);
		AddMenuItem(Item, "weed", Buffer);
	}
	if (entrainement[client] > 0)
	{
		Format(Buffer, sizeof(Buffer), "Entrainement au couteau (Quantité: %i)", entrainement[client]);
		AddMenuItem(Item, "cut", Buffer);
	}
	if (glock[client] > 0)
	{
		Format(Buffer, sizeof(Buffer), "Glock (Quantité: %i)", glock[client]);
		AddMenuItem(Item, "glock", Buffer);
	}
	if (usp[client] > 0)
	{
		Format(Buffer, sizeof(Buffer), "USP (Quantité: %i)", usp[client]);
		AddMenuItem(Item, "usp", Buffer);
	}
	if (p228[client] > 0)
	{
		Format(Buffer, sizeof(Buffer), "P228 (Quantité: %i)", p228[client]);
		AddMenuItem(Item, "p228", Buffer);
	}
	if (deagle[client] > 0)
	{
		Format(Buffer, sizeof(Buffer), "Deagle (Quantité: %i)", deagle[client]);
		AddMenuItem(Item, "deagle", Buffer);
	}
	if (elites[client] > 0)
	{
		Format(Buffer, sizeof(Buffer), "Elites (Quantité: %i)", elites[client]);
		AddMenuItem(Item, "elites", Buffer);
	}
	if (fiveseven[client] > 0)
	{
		Format(Buffer, sizeof(Buffer), "Five Seven (Quantité: %i)", fiveseven[client]);
		AddMenuItem(Item, "fiveseven", Buffer);
	}
	if (m3[client] > 0)
	{
		Format(Buffer, sizeof(Buffer), "M3 (Quantité: %i)", m3[client]);
		AddMenuItem(Item, "m3", Buffer);
	}
	if (xm1014[client] > 0)
	{
		Format(Buffer, sizeof(Buffer), "Xm1014 (Quantité: %i)", xm1014[client]);
		AddMenuItem(Item, "xm1014", Buffer);
	}
	if (galil[client] > 0)
	{
		Format(Buffer, sizeof(Buffer), "Galil (Quantité: %i)", galil[client]);
		AddMenuItem(Item, "galil", Buffer);
	}
	if (ak47[client] > 0)
	{
		Format(Buffer, sizeof(Buffer), "Ak47 (Quantité: %i)", ak47[client]);
		AddMenuItem(Item, "ak47", Buffer);
	}
	if (scout[client] > 0)
	{
		Format(Buffer, sizeof(Buffer), "Scout (Quantité: %i)", scout[client]);
		AddMenuItem(Item, "scout", Buffer);
	}
	if (sg552[client] > 0)
	{
		Format(Buffer, sizeof(Buffer), "Sg552 (Quantité: %i)", sg552[client]);
		AddMenuItem(Item, "sg552", Buffer);
	}
	if (awp[client] > 0)
	{
		Format(Buffer, sizeof(Buffer), "Awp (Quantité: %i)", awp[client]);
		AddMenuItem(Item, "awp", Buffer);
	}
	if (g3sg1[client] > 0)
	{
		Format(Buffer, sizeof(Buffer), "G3SG1 (Quantité: %i)", g3sg1[client]);
		AddMenuItem(Item, "g3sg1", Buffer);
	}
	if (famas[client] > 0)
	{
		Format(Buffer, sizeof(Buffer), "Famas (Quantité: %i)", famas[client]);
		AddMenuItem(Item, "famas", Buffer);
	}
	if (m4a1[client] > 0)
	{
		Format(Buffer, sizeof(Buffer), "M4A1 (Quantité: %i)", m4a1[client]);
		AddMenuItem(Item, "m4a1", Buffer);
	}
	if (aug[client] > 0)
	{
		Format(Buffer, sizeof(Buffer), "Aug (Quantité: %i)", aug[client]);
		AddMenuItem(Item, "aug", Buffer);
	}
	if (sg550[client] > 0)
	{
		Format(Buffer, sizeof(Buffer), "Sg550 (Quantité: %i)", sg550[client]);
		AddMenuItem(Item, "sg550", Buffer);
	}
	if (mac10[client] > 0)
	{
		Format(Buffer, sizeof(Buffer), "Mac10 (Quantité: %i)", mac10[client]);
		AddMenuItem(Item, "mac10", Buffer);
	}
	if (tmp[client] > 0)
	{
		Format(Buffer, sizeof(Buffer), "Tmp (Quantité: %i)", tmp[client]);
		AddMenuItem(Item, "tmp", Buffer);
	}
	if (mp5[client] > 0)
	{
		Format(Buffer, sizeof(Buffer), "MP5 Navy (Quantité: %i)", mp5[client]);
		AddMenuItem(Item, "mp5", Buffer);
	}
	if (ump45[client] > 0)
	{
		Format(Buffer, sizeof(Buffer), "Ump45 (Quantité: %i)", ump45[client]);
		AddMenuItem(Item, "ump45", Buffer);
	}
	if (p90[client] > 0)
	{
		Format(Buffer, sizeof(Buffer), "P90 (Quantité: %i)", p90[client]);
		AddMenuItem(Item, "p90", Buffer);
	}
	if (m249[client] > 0)
	{
		Format(Buffer, sizeof(Buffer), "M249 (Quantité: %i)", m249[client]);
		AddMenuItem(Item, "m249", Buffer);
	}
	if (ticket10[client] > 0)
	{
		Format(Buffer, sizeof(Buffer), "Ticket de 10€ (Quantité: %i)", ticket10[client]);
		AddMenuItem(Item, "t10", Buffer);
	}
	if (ticket50[client] > 0)
	{
		Format(Buffer, sizeof(Buffer), "Ticket de 50€ (Quantité: %i)", ticket50[client]);
		AddMenuItem(Item, "t50", Buffer);
	}
	if (ticket100[client] > 0)
	{
		Format(Buffer, sizeof(Buffer), "Ticket de 100€ (Quantité: %i)", ticket100[client]);
		AddMenuItem(Item, "t100", Buffer);
	}
	if (ticket500[client] > 0)
	{
		Format(Buffer, sizeof(Buffer), "Ticket de 500€ (Quantité: %i)", ticket500[client]);
		AddMenuItem(Item, "t500", Buffer);
	}
	if (kit[client] > 0)
	{
		Format(Buffer, sizeof(Buffer), "Kit de soins (Quantité: %i)", kit[client]);
		AddMenuItem(Item, "kits", Buffer);
	}
	if (grenade[client] > 0)
	{
		Format(Buffer, sizeof(Buffer), "Grenade (Quantité: %i)", grenade[client]);
		AddMenuItem(Item, "he", Buffer);
	}
	if (fumigene[client] > 0)
	{
		Format(Buffer, sizeof(Buffer), "Fumigène (Quantité: %i)", fumigene[client]);
		AddMenuItem(Item, "fumi", Buffer);
	}
	if (flashbang[client] > 0)
	{
		Format(Buffer, sizeof(Buffer), "Flashbang (Quantité: %i)", flashbang[client]);
		AddMenuItem(Item, "flash", Buffer);
	}
	if (kevlar[client] > 0)
	{
		Format(Buffer, sizeof(Buffer), "Gilet pare-balle (Quantité: %i)", kevlar[client]);
		AddMenuItem(Item, "kevlar", Buffer);
	}
	if (kitcrochetage[client] > 0)
	{
		Format(Buffer, sizeof(Buffer), "Kit de crochetage (Quantité: %i)", kitcrochetage[client]);
		AddMenuItem(Item, "kitc", Buffer);
	}
	if (flashball[client] > 0)
	{
		Format(Buffer, sizeof(Buffer), "Flashball Anti-émeute (Quantité: %i)", flashball[client]);
		AddMenuItem(Item, "flashball", Buffer);
	}
	if (imprimerie[client] > 0)
	{
		Format(Buffer, sizeof(Buffer), "Imprimante de faux billets (Quantité: %i)", imprimerie[client]);
		AddMenuItem(Item, "imprimerie", Buffer);
	}
	if (oeil[client] > 0)
	{
		Format(Buffer, sizeof(Buffer), "Oeil bionique (Quantité: %i)", oeil[client]);
		AddMenuItem(Item, "oeil", Buffer);
	}
	if (regenerateur[client] > 0)
	{
		Format(Buffer, sizeof(Buffer), "Regénérateur bionique (Quantité: %i)", regenerateur[client]);
		AddMenuItem(Item, "regen", Buffer);
	}
	if (hamburger[client] > 0)
	{
		Format(Buffer, sizeof(Buffer), "Hamburger (Quantité: %i)", hamburger[client]);
		AddMenuItem(Item, "hamburger", Buffer);
	}
	if (frites[client] > 0)
	{
		Format(Buffer, sizeof(Buffer), "Frites (Quantité: %i)", frites[client]);
		AddMenuItem(Item, "frites", Buffer);
	}
	if (sunday[client] > 0)
	{
		Format(Buffer, sizeof(Buffer), "Sunday (Quantité: %i)", sunday[client]);
		AddMenuItem(Item, "sunday", Buffer);
	}
	if (bigmac[client] > 0)
	{
		Format(Buffer, sizeof(Buffer), "Big Mac (Quantité: %i)", bigmac[client]);
		AddMenuItem(Item, "bigmac", Buffer);
	}
	if (macflurry[client] > 0)
	{
		Format(Buffer, sizeof(Buffer), "Mac Flurry (Quantité: %i)", macflurry[client]);
		AddMenuItem(Item, "macflurry", Buffer);
	}
	if (distributeur[client] > 0)
	{
		Format(Buffer, sizeof(Buffer), "Distributeur (Quantité: %i)", distributeur[client]);
		AddMenuItem(Item, "distributeur", Buffer);
	}
	if (sofa[client] > 0)
	{
		Format(Buffer, sizeof(Buffer), "Sofa (Quantité: %i)", sofa[client]);
		AddMenuItem(Item, "sofa", Buffer);
	}
	if (bibliotheque[client] > 0)
	{
		Format(Buffer, sizeof(Buffer), "Bibliothèque (Quantité: %i)", bibliotheque[client]);
		AddMenuItem(Item, "bibliotheque", Buffer);
	}
	if (dryer[client] > 0)
	{
		Format(Buffer, sizeof(Buffer), "Dryer (Quantité: %i)", dryer[client]);
		AddMenuItem(Item, "dryer", Buffer);
	}
	
	DisplayMenu(Item, client, MENU_TIME_FOREVER);
}

public Menu_Trade(Handle:Trade, MenuAction:action, client, param2)
{
	if (action == MenuAction_Select)
	{
		decl String:info[32];
		GetMenuItem(Trade, param2, info, sizeof(info));
		
		new Ent = GetClientAimTarget(client, true);
		
		if (Ent != -1)
		{
			if (StrEqual(info, "lsd"))
			{
				lsd[client] = lsd[client] - 1;
				lsd[Ent] = lsd[Ent] + 1;
				
				CPrintToChat(client, "%s {blue}Vous avez donné une LSD à %N", LOGO, Ent);
				CPrintToChat(Ent, "%s {blue}Vous avez reçu une LSD de %N", LOGO, client);
			}
			else if (StrEqual(info, "hero"))
			{
				heroine[client] = heroine[client] - 1;
				heroine[Ent] = heroine[Ent] + 1;
				
				CPrintToChat(client, "%s {blue}Vous avez donné une héroïne à %N", LOGO, Ent);
				CPrintToChat(Ent, "%s {blue}Vous avez reçu une héroïne de %N", LOGO, client);
			}
			else if (StrEqual(info, "exta"))
			{
				exta[client] = exta[client] - 1;
				exta[Ent] = exta[Ent] + 1;
				
				CPrintToChat(client, "%s {blue}Vous avez donné une extasie à %N", LOGO, Ent);
				CPrintToChat(Ent, "%s {blue}Vous avez reçu une extasie de %N", LOGO, client);
			}
			else if (StrEqual(info, "cocaine"))
			{
				cocaine[client] = cocaine[client] - 1;
				cocaine[Ent] = cocaine[Ent] + 1;
				
				CPrintToChat(client, "%s {blue}Vous avez donné une cocaïne à %N", LOGO, Ent);
				CPrintToChat(Ent, "%s {blue}Vous avez reçu une cocaïne de %N", LOGO, client);
			}
			else if (StrEqual(info, "weed"))
			{
				weed[client] = weed[client] - 1;
				weed[Ent] = weed[Ent] + 1;
				
				CPrintToChat(client, "%s {blue}Vous avez donné une weed à %N", LOGO, Ent);
				CPrintToChat(Ent, "%s {blue}Vous avez reçu une weed de %N", LOGO, client);
			}
			else if (StrEqual(info, "cut"))
			{
				entrainement[client] = entrainement[client] - 1;
				entrainement[Ent] = entrainement[Ent] + 1;
				
				CPrintToChat(client, "%s {blue}Vous avez donné un entraînement au couteau à %N", LOGO, Ent);
				CPrintToChat(Ent, "%s {blue}Vous avez reçu un entraînement au couteau de %N", LOGO, client);
			}
			else if (StrEqual(info, "glock"))
			{
				glock[client] = glock[client] - 1;
				glock[Ent] = glock[Ent] + 1;
				
				CPrintToChat(client, "%s {blue}Vous avez donné un glock à %N", LOGO, Ent);
				CPrintToChat(Ent, "%s {blue}Vous avez reçu un glock de %N", LOGO, client);
			}
			else if (StrEqual(info, "usp"))
			{
				usp[client] = usp[client] - 1;
				usp[Ent] = usp[Ent] + 1;
				
				CPrintToChat(client, "%s {blue}Vous avez donné un usp à %N", LOGO, Ent);
				CPrintToChat(Ent, "%s {blue}Vous avez reçu un usp de %N", LOGO, client);
			}
			else if (StrEqual(info, "p228"))
			{
				p228[client] = p228[client] - 1;
				p228[Ent] = p228[Ent] + 1;
				
				CPrintToChat(client, "%s {blue}Vous avez donné un p228 à %N", LOGO, Ent);
				CPrintToChat(Ent, "%s {blue}Vous avez reçu un p228 de %N", LOGO, client);
			}
			else if (StrEqual(info, "deagle"))
			{
				deagle[client] = deagle[client] - 1;
				deagle[Ent] = deagle[Ent] + 1;
				
				CPrintToChat(client, "%s {blue}Vous avez donné un deagle à %N", LOGO, Ent);
				CPrintToChat(Ent, "%s {blue}Vous avez reçu un deagle de %N", LOGO, client);
			}
			else if (StrEqual(info, "elites"))
			{
				elites[client] = elites[client] - 1;
				elites[Ent] = elites[Ent] + 1;
				
				CPrintToChat(client, "%s {blue}Vous avez donné des elites à %N", LOGO, Ent);
				CPrintToChat(Ent, "%s {blue}Vous avez reçu des elites de %N", LOGO, client);
			}
			else if (StrEqual(info, "fiveseven"))
			{
				fiveseven[client] = fiveseven[client] - 1;
				fiveseven[Ent] = fiveseven[Ent] + 1;
				
				CPrintToChat(client, "%s {blue}Vous avez donné un fiveseven à %N", LOGO, Ent);
				CPrintToChat(Ent, "%s {blue}Vous avez reçu un fiveseven de %N", LOGO, client);
			}
			else if (StrEqual(info, "m3"))
			{
				m3[client] = m3[client] - 1;
				m3[Ent] = m3[Ent] + 1;
				
				CPrintToChat(client, "%s {blue}Vous avez donné un m3 à %N", LOGO, Ent);
				CPrintToChat(Ent, "%s {blue}Vous avez reçu un m3 de %N", LOGO, client);
			}
			else if (StrEqual(info, "xm1014"))
			{
				xm1014[client] = xm1014[client] - 1;
				xm1014[Ent] = xm1014[Ent] + 1;
				
				CPrintToChat(client, "%s {blue}Vous avez donné un xm1014 à %N", LOGO, Ent);
				CPrintToChat(Ent, "%s {blue}Vous avez reçu un xm1014 de %N", LOGO, client);
			}
			else if (StrEqual(info, "galil"))
			{
				galil[client] = galil[client] - 1;
				galil[Ent] = galil[Ent] + 1;
				
				CPrintToChat(client, "%s {blue}Vous avez donné un galil à %N", LOGO, Ent);
				CPrintToChat(Ent, "%s {blue}Vous avez reçu un galil de %N", LOGO, client);
			}
			else if (StrEqual(info, "ak47"))
			{
				ak47[client] = ak47[client] - 1;
				ak47[Ent] = ak47[Ent] + 1;
				
				CPrintToChat(client, "%s {blue}Vous avez donné une ak47 à %N", LOGO, Ent);
				CPrintToChat(Ent, "%s {blue}Vous avez reçu une ak47 de %N", LOGO, client);
			}
			else if (StrEqual(info, "scout"))
			{
				scout[client] = scout[client] - 1;
				scout[Ent] = scout[Ent] + 1;
				
				CPrintToChat(client, "%s {blue}Vous avez donné un scout à %N", LOGO, Ent);
				CPrintToChat(Ent, "%s {blue}Vous avez reçu un scout de %N", LOGO, client);
			}
			else if (StrEqual(info, "sg552"))
			{
				sg552[client] = sg552[client] - 1;
				sg552[Ent] = sg552[Ent] + 1;
				
				CPrintToChat(client, "%s {blue}Vous avez donné un sg552 à %N", LOGO, Ent);
				CPrintToChat(Ent, "%s {blue}Vous avez reçu un sg552 de %N", LOGO, client);
			}
			else if (StrEqual(info, "awp"))
			{
				awp[client] = awp[client] - 1;
				awp[Ent] = awp[Ent] + 1;
				
				CPrintToChat(client, "%s {blue}Vous avez donné une awp à %N", LOGO, Ent);
				CPrintToChat(Ent, "%s {blue}Vous avez reçu une awp de %N", LOGO, client);
			}
			else if (StrEqual(info, "g3sg1"))
			{
				g3sg1[client] = g3sg1[client] - 1;
				g3sg1[Ent] = g3sg1[Ent] + 1;
				
				CPrintToChat(client, "%s {blue}Vous avez donné un g3sg1 à %N", LOGO, Ent);
				CPrintToChat(Ent, "%s {blue}Vous avez reçu un g3sg1 de %N", LOGO, client);
			}
			else if (StrEqual(info, "famas"))
			{
				famas[client] = famas[client] - 1;
				famas[Ent] = famas[Ent] + 1;
				
				CPrintToChat(client, "%s {blue}Vous avez donné un famas à %N", LOGO, Ent);
				CPrintToChat(Ent, "%s {blue}Vous avez reçu un famas de %N", LOGO, client);
			}
			else if (StrEqual(info, "m4a1"))
			{
				m4a1[client] = m4a1[client] - 1;
				m4a1[Ent] = m4a1[Ent] + 1;
				
				CPrintToChat(client, "%s {blue}Vous avez donné une m4a1 à %N", LOGO, Ent);
				CPrintToChat(Ent, "%s {blue}Vous avez reçu une m4a1 de %N", LOGO, client);
			}
			else if (StrEqual(info, "aug"))
			{
				aug[client] = aug[client] - 1;
				aug[Ent] = aug[Ent] + 1;
				
				CPrintToChat(client, "%s {blue}Vous avez donné un aug à %N", LOGO, Ent);
				CPrintToChat(Ent, "%s {blue}Vous avez reçu un aug de %N", LOGO, client);
			}
			else if (StrEqual(info, "sg550"))
			{
				sg550[client] = sg550[client] - 1;
				sg550[Ent] = sg550[Ent] + 1;
				
				CPrintToChat(client, "%s {blue}Vous avez donné un sg550 à %N", LOGO, Ent);
				CPrintToChat(Ent, "%s {blue}Vous avez reçu un sg550 de %N", LOGO, client);
			}
			else if (StrEqual(info, "mac10"))
			{
				mac10[client] = mac10[client] - 1;
				mac10[Ent] = mac10[Ent] + 1;
				
				CPrintToChat(client, "%s {blue}Vous avez donné un mac10 à %N", LOGO, Ent);
				CPrintToChat(Ent, "%s {blue}Vous avez reçu un mac10 de %N", LOGO, client);
			}
			else if (StrEqual(info, "tmp"))
			{
				tmp[client] = tmp[client] - 1;
				tmp[Ent] = tmp[Ent] + 1;
				
				CPrintToChat(client, "%s {blue}Vous avez donné un tmp à %N", LOGO, Ent);
				CPrintToChat(Ent, "%s {blue}Vous avez reçu un tmp de %N", LOGO, client);
			}
			else if (StrEqual(info, "mp5"))
			{
				mp5[client] = mp5[client] - 1;
				mp5[Ent] = mp5[Ent] + 1;
				
				CPrintToChat(client, "%s {blue}Vous avez donné une mp5 à %N", LOGO, Ent);
				CPrintToChat(Ent, "%s {blue}Vous avez reçu une mp5 de %N", LOGO, client);
			}
			else if (StrEqual(info, "ump45"))
			{
				ump45[client] = ump45[client] - 1;
				ump45[Ent] = ump45[Ent] + 1;
				
				CPrintToChat(client, "%s {blue}Vous avez donné un ump45 à %N", LOGO, Ent);
				CPrintToChat(Ent, "%s {blue}Vous avez reçu un ump45 de %N", LOGO, client);
			}
			else if (StrEqual(info, "p90"))
			{
				p90[client] = p90[client] - 1;
				p90[Ent] = p90[Ent] + 1;
				
				CPrintToChat(client, "%s {blue}Vous avez donné une p90 à %N", LOGO, Ent);
				CPrintToChat(Ent, "%s {blue}Vous avez reçu une p90 de %N", LOGO, client);
			}
			else if (StrEqual(info, "m249"))
			{
				m249[client] = m249[client] - 1;
				m249[Ent] = m249[Ent] + 1;
				
				CPrintToChat(client, "%s {blue}Vous avez donné une m249 à %N", LOGO, Ent);
				CPrintToChat(Ent, "%s {blue}Vous avez reçu une m249 de %N", LOGO, client);
			}
			else if (StrEqual(info, "t10"))
			{
				ticket10[client] = ticket10[client] - 1;
				ticket10[Ent] = ticket10[Ent] + 1;
				
				CPrintToChat(client, "%s {blue}Vous avez donné un ticket de 10€ à %N", LOGO, Ent);
				CPrintToChat(Ent, "%s {blue}Vous avez reçu un ticket de 10€ de %N", LOGO, client);
			}
			else if (StrEqual(info, "t50"))
			{
				ticket50[client] = ticket50[client] - 1;
				ticket50[Ent] = ticket50[Ent] + 1;
				
				CPrintToChat(client, "%s {blue}Vous avez donné un ticket de 50€ à %N", LOGO, Ent);
				CPrintToChat(Ent, "%s {blue}Vous avez reçu un ticket de 50€ de %N", LOGO, client);
			}
			else if (StrEqual(info, "t100"))
			{
				ticket100[client] = ticket100[client] - 1;
				ticket100[Ent] = ticket100[Ent] + 1;
				
				CPrintToChat(client, "%s {blue}Vous avez donné un ticket de 100€ à %N", LOGO, Ent);
				CPrintToChat(Ent, "%s {blue}Vous avez reçu un ticket de 100€ de %N", LOGO, client);
			}
			else if (StrEqual(info, "t500"))
			{
				ticket500[client] = ticket500[client] - 1;
				ticket500[Ent] = ticket500[Ent] + 1;
				
				CPrintToChat(client, "%s {blue}Vous avez donné un ticket de 500€ à %N", LOGO, Ent);
				CPrintToChat(Ent, "%s {blue}Vous avez reçu un ticket de 500€ de %N", LOGO, client);
			}
			else if (StrEqual(info, "kits"))
			{
				kit[client] = kit[client] - 1;
				kit[Ent] = kit[Ent] + 1;
				
				CPrintToChat(client, "%s {blue}Vous avez donné un kit de soin à %N", LOGO, Ent);
				CPrintToChat(Ent, "%s {blue}Vous avez reçu un kit de soin de %N", LOGO, client);
			}
			else if (StrEqual(info, "he"))
			{
				grenade[client] = grenade[client] - 1;
				grenade[Ent] = grenade[Ent] + 1;
				
				CPrintToChat(client, "%s {blue}Vous avez donné une grenade à %N", LOGO, Ent);
				CPrintToChat(Ent, "%s {blue}Vous avez reçu une grenade de %N", LOGO, client);
			}
			else if (StrEqual(info, "fumi"))
			{
				fumigene[client] = fumigene[client] - 1;
				fumigene[Ent] = fumigene[Ent] + 1;
				
				CPrintToChat(client, "%s {blue}Vous avez donné une fumigène à %N", LOGO, Ent);
				CPrintToChat(Ent, "%s {blue}Vous avez reçu une fumigène de %N", LOGO, client);
			}
			else if (StrEqual(info, "flash"))
			{
				flashbang[client] = flashbang[client] - 1;
				flashbang[Ent] = flashbang[Ent] + 1;
				
				CPrintToChat(client, "%s {blue}Vous avez donné une flash à %N", LOGO, Ent);
				CPrintToChat(Ent, "%s {blue}Vous avez reçu une flash de %N", LOGO, client);
			}
			else if (StrEqual(info, "kevlar"))
			{
				kevlar[client] = kevlar[client] - 1;
				kevlar[Ent] = kevlar[Ent] + 1;
				
				CPrintToChat(client, "%s {blue}Vous avez donné un kevlar à %N", LOGO, Ent);
				CPrintToChat(Ent, "%s {blue}Vous avez reçu un kevlar de %N", LOGO, client);
			}
			else if (StrEqual(info, "cartouche"))
			{
				cartouche[client] = cartouche[client] - 1;
				cartouche[Ent] = cartouche[Ent] + 1;
				
				CPrintToChat(client, "%s {blue}Vous avez donné une cartouche à %N", LOGO, Ent);
				CPrintToChat(Ent, "%s {blue}Vous avez reçu une cartouche de %N", LOGO, client);
			}
			else if (StrEqual(info, "kitc"))
			{
				if (rankid[Ent] == 2 || rankid[Ent] == 17)
				{	
					if (kitcrochetage[Ent] < 10)
					{
						kitcrochetage[client] = kitcrochetage[client] - 1;
						kitcrochetage[Ent] = kitcrochetage[Ent] + 1;
						
						CPrintToChat(client, "%s {blue}Vous avez donné un kit de crochetage à %N", LOGO, Ent);
						CPrintToChat(Ent, "%s {blue}Vous avez reçu un kit de crochetage de %N", LOGO, client);
					}
					else
					{
						CPrintToChat(client, "%s Le joueur à déjà 10 kits de crochetage.", LOGO);
					}
				}
				else
				{
					CPrintToChat(client, "%s Le joueur ne fait pas partit de la mafia.", LOGO);
				}
			}
			else if (StrEqual(info, "flashball"))
			{
				flashball[client] = flashball[client] - 1;
				flashball[Ent] = flashball[Ent] + 1;
				
				CPrintToChat(client, "%s {blue}Vous avez donné un flashball à %N", LOGO, Ent);
				CPrintToChat(Ent, "%s {blue}Vous avez reçu un flashball de %N", LOGO, client);
			}
			else if (StrEqual(info, "oeil"))
			{
				oeil[client] = oeil[client] - 1;
				oeil[Ent] = oeil[Ent] + 1;
				
				CPrintToChat(client, "%s {blue}Vous avez donné un oeil bionique à %N", LOGO, Ent);
				CPrintToChat(Ent, "%s {blue}Vous avez reçu un oeil bionique de %N", LOGO, client);
			}
			else if (StrEqual(info, "regen"))
			{
				regenerateur[client] = regenerateur[client] - 1;
				regenerateur[Ent] = regenerateur[Ent] + 1;
				
				CPrintToChat(client, "%s {blue}Vous avez donné un regénerateur bionique à %N", LOGO, Ent);
				CPrintToChat(Ent, "%s {blue}Vous avez reçu un regénérateur bionique de %N", LOGO, client);
			}
			else if (StrEqual(info, "imprimerie"))
			{
				imprimerie[client] = imprimerie[client] - 1;
				imprimerie[Ent] = imprimerie[Ent] + 1;
				
				CPrintToChat(client, "%s {blue}Vous avez donné une imprimante à %N", LOGO, Ent);
				CPrintToChat(Ent, "%s {blue}Vous avez reçu une imprimante de %N", LOGO, client);
			}
			else if (StrEqual(info, "hamburger"))
			{
				hamburger[client] = hamburger[client] - 1;
				hamburger[Ent] = hamburger[Ent] + 1;
				
				CPrintToChat(client, "%s {blue}Vous avez donné un hamburger à %N", LOGO, Ent);
				CPrintToChat(Ent, "%s {blue}Vous avez reçu un hamburger de %N", LOGO, client);
			}
			else if (StrEqual(info, "frites"))
			{
				frites[client] = frites[client] - 1;
				frites[Ent] = frites[Ent] + 1;
				
				CPrintToChat(client, "%s {blue}Vous avez donné des frites à %N", LOGO, Ent);
				CPrintToChat(Ent, "%s {blue}Vous avez reçu des frites de %N", LOGO, client);
			}
			else if (StrEqual(info, "sunday"))
			{
				sunday[client] = sunday[client] - 1;
				sunday[Ent] = sunday[Ent] + 1;
				
				CPrintToChat(client, "%s {blue}Vous avez donné un sunday à %N", LOGO, Ent);
				CPrintToChat(Ent, "%s {blue}Vous avez reçu un sunday de %N", LOGO, client);
			}
			else if (StrEqual(info, "bigmac"))
			{
				bigmac[client] = bigmac[client] - 1;
				bigmac[Ent] = bigmac[Ent] + 1;
				
				CPrintToChat(client, "%s {blue}Vous avez donné un bigmac à %N", LOGO, Ent);
				CPrintToChat(Ent, "%s {blue}Vous avez reçu un bigmac de %N", LOGO, client);
			}
			else if (StrEqual(info, "macflurry"))
			{
				macflurry[client] = macflurry[client] - 1;
				macflurry[Ent] = macflurry[Ent] + 1;
				
				CPrintToChat(client, "%s {blue}Vous avez donné un macflurry à %N", LOGO, Ent);
				CPrintToChat(Ent, "%s {blue}Vous avez reçu un macflurry de %N", LOGO, client);
			}
			else if (StrEqual(info, "distributeur"))
			{
				distributeur[client] = distributeur[client] - 1;
				distributeur[Ent] = distributeur[Ent] + 1;
				
				CPrintToChat(client, "%s {blue}Vous avez donné un distributeur à %N", LOGO, Ent);
				CPrintToChat(Ent, "%s {blue}Vous avez reçu un distributeur de %N", LOGO, client);
			}
			else if (StrEqual(info, "sofa"))
			{
				sofa[client] = sofa[client] - 1;
				sofa[Ent] = sofa[Ent] + 1;
				
				CPrintToChat(client, "%s {blue}Vous avez donné un sofa à %N", LOGO, Ent);
				CPrintToChat(Ent, "%s {blue}Vous avez reçu un sofa de %N", LOGO, client);
			}
			else if (StrEqual(info, "bibliotheque"))
			{
				bibliotheque[client] = bibliotheque[client] - 1;
				bibliotheque[Ent] = bibliotheque[Ent] + 1;
				
				CPrintToChat(client, "%s {blue}Vous avez donné une biliothèque à %N", LOGO, Ent);
				CPrintToChat(Ent, "%s {blue}Vous avez reçu une bibliothèque de %N", LOGO, client);
			}
			else if (StrEqual(info, "dryer"))
			{
				dryer[client] = dryer[client] - 1;
				dryer[Ent] = dryer[Ent] + 1;
				
				CPrintToChat(client, "%s {blue}Vous avez donné une dryer à %N", LOGO, Ent);
				CPrintToChat(Ent, "%s {blue}Vous avez reçu une dryer de %N", LOGO, client);
			}
		}
		else
		{
			CPrintToChat(client, "%s {red}Merci de viser un joueur", LOGO);
		}
		
		BuildTradeMenu(client);
	}
	else
	{
		if (action == MenuAction_End)
		{
			CloseHandle(Trade);
		}
	}
}

public GetHeure()
{
	decl String:error[256];
	decl String:buffer[400];
	new Handle:db_rp = SQL_Connect("roleplay", true, error, sizeof(error));
	
	Format(buffer, sizeof(buffer), "SELECT day, month, years FROM `Roleplay_Time` WHERE id = '1'");
	new Handle:query = SQL_Query(db_rp, buffer);
	
	if (query)
	{
		new bool:fetch = SQL_FetchRow(query);
		
		if (fetch)
		{
			g_days = SQL_FetchInt(query, 0);
			g_month = SQL_FetchInt(query, 1);
			g_years = SQL_FetchInt(query, 2);
		}
	}
	
	CloseHandle(query);
}

public DBSave(client)
{
	if (InQuery)
	{
		CreateTimer(1.0, DBSave_ReDo, client);
	}
	
	if (Loaded[client])
	{
		lancercut[client] = GetClientThrowingKnives(client);
		
		new time = GetTime();
		
		decl String:error[256];
		new Handle:db_rp = SQL_Connect("roleplay", true, error, sizeof(error));
		
		decl String:Name[200];
		
		new String:SteamId[32], String:query[1900];
		GetClientAuthString(client, SteamId, sizeof(SteamId));
		
		GetClientName(client, Name, sizeof(Name));

		Format(query, sizeof(query), "UPDATE Roleplay_Players SET pseudo = '%s', cash = %i, bank = %i, jobid = %i, jailtime = %i, isinjail = %i, permislourd = %i, permisleger = %i, cb = %i, rib = %i, rankid = %i, lastontime = %i, groupe = %i, house = %i WHERE steam_id = '%s'", Name, money[client], bank[client], jobid[client], g_jailtime[client], g_IsInJail[client], permislourd[client], permisleger[client], cb[client], rib[client], rankid[client], lastontime[client], Group[client], Location[client], SteamId);				
		SQL_FastQuery(db_rp, query);
		
		Format(query, sizeof(query), "UPDATE Roleplay_Item SET lsd = %i, hero = %i, exta = %i, cocaine = %i, weed = %i, entrainement = %i, glock = %i, usp = %i, p228 = %i, deagle = %i, elites = %i, fiveseven = %i, m3 = %i, xm1014 = %i, galil = %i, ak47 = %i, scout = %i, sg552 = %i, awp = %i, g3sg1 = %i WHERE steam_id = '%s'", lsd[client], heroine[client], exta[client], cocaine[client], weed[client], entrainement[client], glock[client], usp[client], p228[client], deagle[client], elites[client], fiveseven[client], m3[client], xm1014[client], galil[client], ak47[client], scout[client], sg552[client], awp[client], g3sg1[client], SteamId);				
		SQL_FastQuery(db_rp, query);
		
		Format(query, sizeof(query), "UPDATE Roleplay_Item SET famas = %i, m4a1 = %i, aug = %i, sg550 = %i, mac10 = %i, tmp = %i, mp5 = %i, ump45 = %i, p90 = %i, m249 = %i, t10 = %i, t50 = %i, t100 = %i, t500 = %i, kits = %i, he = %i, fumi = %i, flash = %i, kevlar = %i, cartouche = %i, kitcrochetage = %i, levelcut = %i, flashball = %i WHERE steam_id = '%s'", famas[client], m4a1[client], aug[client], sg550[client], mac10[client], tmp[client], mp5[client], ump45[client], p90[client], m249[client], ticket10[client], ticket50[client], ticket100[client], ticket500[client], kit[client], grenade[client], fumigene[client], flashbang[client], kevlar[client], cartouche[client], kitcrochetage[client], levelcut[client], flashball[client], SteamId);				
		SQL_FastQuery(db_rp, query);
		
		Format(query, sizeof(query), "UPDATE Roleplay_Item SET imprimerie = %i, hamburger = %i, frites = %i, sunday = %i, bigmac = %i, macflurry = %i, lancer = %i, distrib = %i, sofa = %i, biblio = %i, dryer = %i, kite = %i WHERE steam_id = '%s'", imprimerie[client], hamburger[client], frites[client], sunday[client], bigmac[client], macflurry[client], lancercut[client], distributeur[client], sofa[client], bibliotheque[client], dryer[client], kitexplosif[client], SteamId);				
		SQL_FastQuery(db_rp, query);
		
		Format(query, sizeof(query), "UPDATE Roleplay_Boutique SET points = %i, flame = %i, mini = %i WHERE steam_id = '%s'", points[client], flameAmount[client], Mini[client], SteamId);				
		SQL_FastQuery(db_rp, query);
		
		Format(query, sizeof(query), "UPDATE Roleplay_Succes SET countheadshot = %i, headshot = %i, successdoor = %i, countdoor = %i, successjail = %i, countjail = %i, successpyro = %i, countpyro = %i, successrct = %i, countrct = %i, successdonator = %i, countdonator = %i WHERE steam_id = '%s'", countheadshot[client], headshot[client], successdoor[client], countdoor[client], successjail[client], countjail[client], successpyro[client], countpyro[client], successrct[client], countrct[client], successdonator[client], countdonator[client], SteamId);				
		SQL_FastQuery(db_rp, query);
				
		if (Location[client] > 0)
		{
			Format(query, sizeof(query), "UPDATE Roleplay_House SET timestamp = %i WHERE id = '%s'", time, Location[client]);			
			SQL_FastQuery(db_rp, query);
		}
		
		PrintToServer("Le joueur %N a été sauvegardé.", client);
		
		CloseHandle(db_rp);
	}
}

public Action:DBSave_ReDo(Handle:Timer, any:Client)
{
	DBSave(Client);
	return Plugin_Handled;
}

public SaveTime()
{
	new String:query[256];
	decl String:error[256];
	new Handle:db_dela = SQL_Connect("roleplay", true, error, sizeof(error));
	
	Format(query, sizeof(query), "UPDATE Roleplay_Time SET day = %i, month = %i, years = %i WHERE id = '1'", g_days, g_month, g_years);				
	SQL_FastQuery(db_dela, query);
	
	CloseHandle(db_dela);
	
	PrintToServer("Le temps a été sauvegardé.");
}

public GetZoneName(client)
{
	if (IsClientInGame(client))
	{
		if (IsPlayerAlive(client))
		{
			if (IsInComico(client) && !IsInJail1(client) && !IsInJail2(client) && !IsInJail3(client) && !IsInArmup(client))
			{
				Format(Zone, sizeof(Zone), "Commissariat");
			}
			else if (IsInComico(client) && IsInJail1(client) && !IsInJail2(client) && !IsInJail3(client) && !IsInArmup(client))
			{
				Format(Zone, sizeof(Zone), "Cellule #1");
			}
			else if (IsInComico(client) && !IsInJail1(client) && IsInJail2(client) && !IsInJail3(client) && !IsInArmup(client))
			{
				Format(Zone, sizeof(Zone), "Cellule #2");
			}
			else if (IsInComico(client) && !IsInJail1(client) && !IsInJail2(client) && IsInJail3(client) && !IsInArmup(client))
			{
				Format(Zone, sizeof(Zone), "Cellule #3");
			}
			else if (IsInComico(client) && !IsInJail1(client) && !IsInJail2(client) && !IsInJail3(client) && IsInArmup(client))
			{
				Format(Zone, sizeof(Zone), "Armurerie de la Police");
			}
			else if (IsInHosto(client))
			{
				Format(Zone, sizeof(Zone), "Hôpital");
			}
			else if (IsInArmu(client))
			{
				Format(Zone, sizeof(Zone), "Armurerie");
			}
			else if (IsInCoach(client))
			{
				Format(Zone, sizeof(Zone), "Coach");
			}
			else if ((IsInBank(client)) && (Coffre_Banque(client)))
			{
				Format(Zone, sizeof(Zone), "Salle des Coffres");
			}
			else if ((IsInBank(client)) && (!Coffre_Banque(client)))
			{
				Format(Zone, sizeof(Zone), "Banque VG-RP");
			}
			else if (IsInAperture(client))
			{
				Format(Zone, sizeof(Zone), "Laboratoire Caperture");
			}
			else if (IsInLoto(client))
			{
				Format(Zone, sizeof(Zone), "Casino");
			}
			else if (IsInArti(client))
			{
				Format(Zone, sizeof(Zone), "Artificier");
			}
			else if (IsInDealer(client))
			{
				Format(Zone, sizeof(Zone), "Hall Appartements");
			}
			else if (IsInTribunal(client) && !JailTribu(client))
			{
				Format(Zone, sizeof(Zone), "Tribunal");
			}
			else if (IsInTribunal(client) && JailTribu(client))
			{
				Format(Zone, sizeof(Zone), "Cellule du Tribunal");
			}
			else if (IsInTueur(client))
			{
				Format(Zone, sizeof(Zone), "Planque Tueur");
			}
			else if (IsInPaint(client))
			{
				Format(Zone, sizeof(Zone), "Stand de Paintball");
			}
			else if (IsInTech(client))
			{
				Format(Zone, sizeof(Zone), "Planque Technicien");
			}
			else if (IsInCour(client))
			{
				Format(Zone, sizeof(Zone), "Cour de la prison");
			}
			else if (IsInMcdo(client))
			{
				Format(Zone, sizeof(Zone), "Mac - Do");
			}
			else if (IsInIkea(client))
			{
				Format(Zone, sizeof(Zone), "Ikea");
			}
			else if (IsInVilla(client))
			{
				Format(Zone, sizeof(Zone), "Villa privée");
			}
			else if (IsInDetective(client))
			{
				Format(Zone, sizeof(Zone), "Planque des Détectives");
			}
			else if (IsInMafia(client) && !IsInSalle(client))
			{
				Format(Zone, sizeof(Zone), "Mafia");
			}
			else if (IsInMafia(client) && IsInSalle(client))
			{
				Format(Zone, sizeof(Zone), "Salle d'Opérations");
			}
			else if (IsIn18th(client) && !IsInOpera(client))
			{
				Format(Zone, sizeof(Zone), "Repaire des 18th");
			}
			else if (IsIn18th(client) && IsInOpera(client))
			{
				Format(Zone, sizeof(Zone), "Salle de préparation");
			}
			else if (IsInPole(client))
			{
				Format(Zone, sizeof(Zone), "Pôle Emploi");
			}
			else if (Parking(client))
			{
				Format(Zone, sizeof(Zone), "Parking");
			}
			else if (Garage(client))
			{
				Format(Zone, sizeof(Zone), "Garage");
			}
			else if (Total(client))
			{
				Format(Zone, sizeof(Zone), "Station Total");
			}
			else if (Boite_Nuit(client))
			{
				Format(Zone, sizeof(Zone), "Boîte de Nuit");
			}
			else if (Magasin_Voitures(client))
			{
				Format(Zone, sizeof(Zone), "Magasin de Voitures");
			}
			else if (Chambre_1(client))
			{
				Format(Zone, sizeof(Zone), "Chambre - 1");
			}
			else if (Chambre_2(client))
			{
				Format(Zone, sizeof(Zone), "Chambre - 2");
			}
			else if (Chambre_3(client))
			{
				Format(Zone, sizeof(Zone), "Chambre - 3");
			}
			else if (Chambre_11(client))
			{
				Format(Zone, sizeof(Zone), "Chambre - 11");
			}
			else if (Chambre_12(client))
			{
				Format(Zone, sizeof(Zone), "Chambre - 12");
			}
			else if (Chambre_13(client))
			{
				Format(Zone, sizeof(Zone), "Chambre - 13");
			}
			else if (Chambre_14(client))
			{
				Format(Zone, sizeof(Zone), "Chambre - 14");
			}
			else if (Chambre_21(client))
			{
				Format(Zone, sizeof(Zone), "Chambre - 21");
			}
			else if (Chambre_22(client))
			{
				Format(Zone, sizeof(Zone), "Chambre - 22");
			}
			else if (Chambre_23(client))
			{
				Format(Zone, sizeof(Zone), "Chambre - 23");
			}
			else if (Chambre_24(client))
			{
				Format(Zone, sizeof(Zone), "Chambre - 24");
			}
			else if (Chambre_31(client))
			{
				Format(Zone, sizeof(Zone), "Chambre - 31");
			}
			else if (Chambre_32(client))
			{
				Format(Zone, sizeof(Zone), "Chambre - 32");
			}
			else if (Chambre_33(client))
			{
				Format(Zone, sizeof(Zone), "Chambre - 33");
			}
			else if (Chambre_34(client))
			{
				Format(Zone, sizeof(Zone), "Chambre - 34");
			}
			else if (Chambre_41(client))
			{
				Format(Zone, sizeof(Zone), "Chambre - 41");
			}
			else if (Chambre_42(client))
			{
				Format(Zone, sizeof(Zone), "Chambre - 42");
			}
			else if (Couloir_RDC(client))
			{
				Format(Zone, sizeof(Zone), "Hall d'entrée");
			}
			else if (Couloir_1(client))
			{
				Format(Zone, sizeof(Zone), "Couloir - 1er étage");
			}
			else if (Couloir_2(client))
			{
				Format(Zone, sizeof(Zone), "Couloir - 2ème étage");
			}
			else if (Escalier(client))
			{
				Format(Zone, sizeof(Zone), "Escalier");
			}
			else
			{
				Format(Zone, sizeof(Zone), "Extérieur");
			}		
		}
		else
		{
			Format(Zone, sizeof(Zone), "Morgue");
		}
	}
}

IsInComico(client)
{
	new Float:v[3];
	GetEntPropVector(client, Prop_Send, "m_vecOrigin", v);
	
	if (v[0] >= -4.0 && v[0] <= 2186.7 && v[1] >= -11.2 && v[1] <= 1293.9 && v[2] >= -399.9 && v[2] <= 765.8)
		return true;

	else if (v[0] >= 353.9 && v[0] <= 1665.2 && v[1] >= 1268.4 && v[1] <= 2132.2 && v[2] >= -219.0 && v[2] <= -85.7)
		return true;

	else
		return false;
}

IsInHosto(client)
{
	new Float:v[3];
	GetEntPropVector(client, Prop_Send, "m_vecOrigin", v);
	
	if (v[0] >= -982.3 && v[0] <= 1.6 && v[1] >= -4115.8 && v[1] <= -2861.0 && v[2] >= -20.0 && v[2] <= 1156.3)
		return true;

	else
		return false;
}

IsInArmu(client)
{
	new Float:v[3];
	GetEntPropVector(client, Prop_Send, "m_vecOrigin", v);
	
	if (v[0] >= -2656.437988 && v[0] <= -2156.355225 && v[1] >= 588.975220 && v[1] <= 1728.880127 && v[2] >= 8.031250 && v[2] <= 138.031250)
		return true;

	else
		return false;
}

IsInCoach(client)
{
	new Float:v[3];
	GetEntPropVector(client, Prop_Send, "m_vecOrigin", v);
	
	if (v[0] >= -5626.5 && v[0] <= -3875.9 && v[1] >= -1043.3 && v[1] <= -459.0 && v[2] >= -116.0 && v[2] <= 276.4)
		return true;

	else
		return false;
}

IsInBank(client)
{
	new Float:v[3];
	GetEntPropVector(client, Prop_Send, "m_vecOrigin", v);
	
	if (v[0] >= -3484.0 && v[0] <= -2700.2 && v[1] >= -2847.9 && v[1] <= -2351.1 && v[2] >= -123.5 && v[2] <= 123.9)
		return true;
		
	else if (v[0] >= -3202.9 && v[0] <= -3117.0 && v[1] >= -2880.0 && v[1] <= -2839.9 && v[2] >= 30.2 && v[2] <= 156.0)
		return true;

	else
		return false;
}

IsInLoto(client)
{
	new Float:v[3];
	GetEntPropVector(client, Prop_Send, "m_vecOrigin", v);
	
	if (v[0] >= -419.2 && v[0] <= 0 && v[1] >= -2240.2 && v[1] <= -1275.3 && v[2] >= 5.7 && v[2] <= 132.1)
		return true;
	
	else if (v[0] >= -774.5 && v[0] <= -281.9 && v[1] >= -1648.5 && v[1] <= -1284.5 && v[2] >= 5.7 && v[2] <= 132.1)
		return true;

	else
		return false;
}

IsInArti(client)
{
	new Float:v[3];
	GetEntPropVector(client, Prop_Send, "m_vecOrigin", v);
	
	if (v[0] >= -1170.6 && v[0] <= -726.9 && v[1] >= -2244.1 && v[1] <= -1209.7 && v[2] >= 150.0 && v[2] <= 347.3)
		return true;

	else
		return false;
}

IsInDealer(client)
{
	new Float:v[3];
	GetEntPropVector(client, Prop_Send, "m_vecOrigin", v);
	
	if (v[0] >= 815.4 && v[0] <= 1273.1 && v[1] >= -1177.7 && v[1] <= -949.5 && v[2] >= 89.4 && v[2] <= 538.3)
		return true;

	else
		return false;
}

IsInMafia(client)
{
	new Float:v[3];
	GetEntPropVector(client, Prop_Send, "m_vecOrigin", v);
	
	if (v[0] >= -4637.4 && v[0] <= -3866.4 && v[1] >= -3105.5 && v[1] <= -2522.6 && v[2] >= 120.4 && v[2] <= 500.9)
		return true;
		
	else if (v[0] >= -4644.9 && v[0] <= -4338.2 && v[1] >= -2548.1 && v[1] <= -2243.7 && v[2] >= 132.0 && v[2] <= 319.1)
		return true;

	else
		return false;
}

IsInSalle(client)
{
	new Float:v[3];
	GetEntPropVector(client, Prop_Send, "m_vecOrigin", v);
	
	if (v[0] >= -4623.0 && v[0] <= -4288.0 && v[1] >= -3047.9 && v[1] <= -2648.0 && v[2] >= 120.6 && v[2] <= 275.9)
		return true;
	else
		return false;
}

IsInTribunal(client)
{
	new Float:v[3];
	GetEntPropVector(client, Prop_Send, "m_vecOrigin", v);
	
	if (v[0] >= -3274.2 && v[0] <= -2468.6 && v[1] >= -3804.1 && v[1] <= -2876.9 && v[2] >= 100.8 && v[2] <= 582.3)
		return true;

	else
		return false;
}

JailTribu(client)
{
	new Float:v[3];
	GetEntPropVector(client, Prop_Send, "m_vecOrigin", v);
	
	if (v[0] >= -3267.148926 && v[0] <= -3082.872559 && v[1] >= -3047.194824 && v[1] <= -2876.851074 && v[2] >= 168.031250 && v[2] <= 298.031250)
		return true;

	else
		return false;
}

IsInTueur(client)
{
	new Float:v[3];
	GetEntPropVector(client, Prop_Send, "m_vecOrigin", v);
	
	if (v[0] >= -4135.0 && v[0] <= -3912.0 && v[1] >= -3767.9 && v[1] <= -3260.0 && v[2] >= 158.7 && v[2] <= 365.4)
		return true;

	else
		return false;
}

IsInJail1(client)
{
	new Float:v[3];
	GetEntPropVector(client, Prop_Send, "m_vecOrigin", v);
	
	if (v[0] >= 915.0 && v[0] <= 1165.0 && v[1] >= 1283.2 && v[1] <= 1525.5 && v[2] >= -212.0 && v[2] <= -32.8)
		return true;

	else
		return false;
}

IsInJail2(client)
{
	new Float:v[3];
	GetEntPropVector(client, Prop_Send, "m_vecOrigin", v);
	
	if (v[0] >= 920.4 && v[0] <= 1185.6 && v[1] >= 1756.4 && v[1] <= 2003.8 && v[2] >= -212.0 && v[2] <= -32.8)
		return true;

	else
		return false;
}

IsInJail3(client)
{
	new Float:v[3];
	GetEntPropVector(client, Prop_Send, "m_vecOrigin", v);
	
	if (v[0] >= 1176.3 && v[0] <= 1434.8 && v[1] >= 1298.1 && v[1] <= 1528.6 && v[2] >= -212.0 && v[2] <= -32.8)
		return true;

	else
		return false;
}

IsInArmup(client)
{
	new Float:v[3];
	GetEntPropVector(client, Prop_Send, "m_vecOrigin", v);
	
	if (v[0] >= 792.0 && v[0] <= 999.9 && v[1] >= 96.5 && v[1] <= 303.9 && v[2] >= 36.0 && v[2] <= 180.8)
		return true;

	else
		return false;
}

IsInTech(client)
{
	new Float:v[3];
	GetEntPropVector(client, Prop_Send, "m_vecOrigin", v);
	
	if (v[0] >= -256.9 && v[0] <= -13.4 && v[1] >= -589.3 && v[1] <= 565.3 && v[2] >= -30.0 && v[2] <= 523.4)
		return true;

	else
		return false;
}

IsInPaint(client)
{
	new Float:v[3];
	GetEntPropVector(client, Prop_Send, "m_vecOrigin", v);
	
	if (v[0] >= -2145.1 && v[0] <= -1145.2 && v[1] >= 1069.0 && v[1] <= 3320.8 && v[2] >= 4.6 && v[2] <= 334.2)
		return true;

	else
		return false;
}

IsInCour(client)
{
	new Float:v[3];
	GetEntPropVector(client, Prop_Send, "m_vecOrigin", v);
	
	if (v[0] >= 3175.8 && v[0] <= 4535.7 && v[1] >= 1027.8 && v[1] <= 2225.7 && v[2] >= -270.8 && v[2] <= 448.1)
		return true;

	else
		return false;
}

IsInVilla(client)
{
	new Float:v[3];
	GetEntPropVector(client, Prop_Send, "m_vecOrigin", v);
	
	if (v[0] >= -7237.7 && v[0] <= -5660.6 && v[1] >= -1059.9 && v[1] <= 1635.3 && v[2] >= -883.3 && v[2] <= 467.9)
		return true;
		
	else if (v[0] >= -5846.5 && v[0] <= -4611.2 && v[1] >= -349.2 && v[1] <= 1644.8 && v[2] >= -883.3 && v[2] <= 467.9)
		return true;

	else
		return false;
}

IsInDetective(client)
{
	new Float:v[3];
	GetEntPropVector(client, Prop_Send, "m_vecOrigin", v);
	
	if (v[0] >= -253.4 && v[0] <= -10.0 && v[1] >= -2300.0 && v[1] <= -2223.9 && v[2] >= 140.0 && v[2] <= 297.5)
		return true;
		
	else if (v[0] >= -78.3 && v[0] <= 17.4 && v[1] >= -2254.6 && v[1] <= -948.2 && v[2] >= 140.0 && v[2] <= 297.5)
		return true;
		
	else if (v[0] >= -268.4 && v[0] <= 0.0 && v[1] >= -1207.4 && v[1] <= -934.2 && v[2] >= 140.0 && v[2] <= 310.5)
		return true;

	else
		return false;
}

IsInMcdo(client)
{
	new Float:v[3];
	GetEntPropVector(client, Prop_Send, "m_vecOrigin", v);
	
	if (v[0] >= -2059.9 && v[0] <= -1285.4 && v[1] >= -4280.3 && v[1] <= -3639.2 && v[2] >= 147.9 && v[2] <= 292.6)
		return true;

	else
		return false;
}

IsIn18th(client)
{
	new Float:v[3];
	GetEntPropVector(client, Prop_Send, "m_vecOrigin", v);
	
	if (v[0] >= -4320.2 && v[0] <= -3896.6 && v[1] >= -2175.5 && v[1] <= -1091.5 && v[2] >= 163.8 && v[2] <= 382.2)
		return true;

	else
		return false;
}

IsInOpera(client)
{
	new Float:v[3];
	GetEntPropVector(client, Prop_Send, "m_vecOrigin", v);
	
	if (v[0] >= -4180.0 && v[0] <= -3906.0 && v[1] >= -1718.2 && v[1] <= -1242.1 && v[2] >= 142.2 && v[2] <= 316.9)
		return true;

	else
		return false;
}

IsInIkea(client)
{
	new Float:v[3];
	GetEntPropVector(client, Prop_Send, "m_vecOrigin", v);
	
	if (v[0] >= -2999.9 && v[0] <= -1573.2 && v[1] >= -503.9 && v[1] <= -28.0 && v[2] >= -16.0 && v[2] <= 168.2)
		return true;

	else
		return false;
}

IsInAperture(client)
{
	new Float:v[3];
	GetEntPropVector(client, Prop_Send, "m_vecOrigin", v);
	
	if (v[0] >= 3844.2 && v[0] <= 8303.3 && v[1] >= -1266.6 && v[1] <= 740.1 && v[2] >= -30.9 && v[2] <= 463.9)
		return true;

	else
		return false;
}

IsInPole(client)
{
	new Float:v[3];
	GetEntPropVector(client, Prop_Send, "m_vecOrigin", v);
	
	if (v[0] >= -4310.968262 && v[0] <= -3901.031250 && v[1] >= -126.968758 && v[1] <= 449.060913 && v[2] >= 8.031250 && v[2] <= 138.031250)
		return true;

	else
		return false;
}

Garage(client)
{
	new Float:v[3];
	GetEntPropVector(client, Prop_Send, "m_vecOrigin", v);
		
	if (v[0] >= -2636.284912 && v[0] <= -2356.677979 && v[1] >= -3262.868896 && v[1] <= -2757.214355 && v[2] >= 32.031250 && v[2] <= 162.031250)
		return true;

	else
		return false;
}	


Coffre_Banque(client)
{
	new Float:v[3];
	GetEntPropVector(client, Prop_Send, "m_vecOrigin", v);
		
	if (v[0] >= -3478.431152 && v[0] <= -3230.568848 && v[1] >= -2809.568848 && v[1] <= -2554.568848 && v[2] >= -90.968750 && v[2] <= 29.031250)
		return true;

	else
		return false;
}	


// APPARTEMENTS 

Chambre_1(client)
{
	new Float:v[3];
	GetEntPropVector(client, Prop_Send, "m_vecOrigin", v);
		
	if (v[0] >= -1812.293457 && v[0] <= -1691.775513 && v[1] >= -693.816833 && v[1] <= -156.968750 && v[2] >= 392.031250 && v[2] <= 522.031250)
		return true;
		
	if (v[0] >= -2054.941406 && v[0] <= -1814.268921 && v[1] >= -543.433960 && v[1] <= -153.855881 && v[2] >= 392.031250 && v[2] <= 522.031250)
		return true;
		
	else
		return false;
}

Chambre_2(client)
{
	new Float:v[3];
	GetEntPropVector(client, Prop_Send, "m_vecOrigin", v);
		
	if (v[0] >= -2426.426270 && v[0] <= -2071.570801 && v[1] >= -571.767090 && v[1] <= -145.129303 && v[2] >= 392.031250 && v[2] <= 522.031250)
		return true;

	else
		return false;
}	

Chambre_3(client)
{
	new Float:v[3];
	GetEntPropVector(client, Prop_Send, "m_vecOrigin", v);
		
	if (v[0] >= -3012.039307 && v[0] <= -2428.220947 && v[1] >= -660.376343 && v[1] <= -43.165810 && v[2] >= 392.031250 && v[2] <= 522.031250)
		return true;

	else
		return false;
}

Chambre_11(client)
{
	new Float:v[3];
	GetEntPropVector(client, Prop_Send, "m_vecOrigin", v);
		
	if (v[0] >= -3477.093018 && v[0] <= -3134.557129 && v[1] >= -5318.551758 && v[1] <= -5058.571289 && v[2] >= 168.031250 && v[2] <= 303.031250)
		return true;

	else
		return false;
}	

Chambre_12(client)
{
	new Float:v[3];
	GetEntPropVector(client, Prop_Send, "m_vecOrigin", v);
		
	if (v[0] >= -3827.434570 && v[0] <= -3490.234375 && v[1] >= -5318.856445 && v[1] <= -5058.195801 && v[2] >= 168.031250 && v[2] <= 298.031250)
		return true;

	else
		return false;
}	

Chambre_13(client)
{
	new Float:v[3];
	GetEntPropVector(client, Prop_Send, "m_vecOrigin", v);
		
	if (v[0] >= -3694.775146 && v[0] <= -3428.900146 && v[1] >= -4900.279297 && v[1] <= -4618.196289 && v[2] >= 168.031250 && v[2] <= 298.031250)
		return true;

	else
		return false;
}			

Chambre_14(client)
{
	new Float:v[3];
	GetEntPropVector(client, Prop_Send, "m_vecOrigin", v);
		
	if (v[0] >= -3413.657227 && v[0] <= -3134.557129 && v[1] >= -4902.399414 && v[1] <= -4617.760742 && v[2] >= 168.031250 && v[2] <= 298.031250)
		return true;

	else
		return false;
}	

Chambre_21(client)
{
	new Float:v[3];
	GetEntPropVector(client, Prop_Send, "m_vecOrigin", v);
		
	if (v[0] >= -3477.138672 && v[0] <= -3134.557129 && v[1] >= -5318.731445 && v[1] <= -5059.143555 && v[2] >= 304.031250 && v[2] <= 434.031250)
		return true;

	else
		return false;
}	

Chambre_22(client)
{
	new Float:v[3];
	GetEntPropVector(client, Prop_Send, "m_vecOrigin", v);
		
	if (v[0] >= -3827.318848 && v[0] <= -3490.258301 && v[1] >= -5318.728516 && v[1] <= -5056.554688 && v[2] >= 304.031250 && v[2] <= 434.031250)
		return true;

	else
		return false;
}	

Chambre_23(client)
{
	new Float:v[3];
	GetEntPropVector(client, Prop_Send, "m_vecOrigin", v);
		
	if (v[0] >= -3692.147949 && v[0] <= -3426.943604 && v[1] >= -4898.684570 && v[1] <= -4620.725586 && v[2] >= 304.031250 && v[2] <= 434.031250)
		return true;

	else
		return false;
}	

Chambre_24(client)
{
	new Float:v[3];
	GetEntPropVector(client, Prop_Send, "m_vecOrigin", v);
		
	if (v[0] >= -3413.021240 && v[0] <= -3138.091553 && v[1] >= -4902.656250 && v[1] <= -4620.090820 && v[2] >= 304.031250 && v[2] <= 439.031250)
		return true;

	else
		return false;
}		

Chambre_31(client)
{
	new Float:v[3];
	GetEntPropVector(client, Prop_Send, "m_vecOrigin", v);
		
	if (v[0] >= -3476.935547 && v[0] <= -3137.139648 && v[1] >= -5319.309082 && v[1] <= -5060.791504 && v[2] >= 440.031250 && v[2] <= 570.031250)
		return true;

	else
		return false;
}	

Chambre_32(client)
{
	new Float:v[3];
	GetEntPropVector(client, Prop_Send, "m_vecOrigin", v);
		
	if (v[0] >= -3827.091553 && v[0] <= -3488.807861 && v[1] >= -5316.349609 && v[1] <= -5058.307617 && v[2] >= 440.031250 && v[2] <= 570.031250)
		return true;

	else
		return false;
}	

Chambre_33(client)
{
	new Float:v[3];
	GetEntPropVector(client, Prop_Send, "m_vecOrigin", v);
		
	if (v[0] >= -3827.091553 && v[0] <= -3427.571289 && v[1] >= -4900.110352 && v[1] <= -4619.125488 && v[2] >= 440.031250 && v[2] <= 570.031250)
		return true;

	else
		return false;
}	

Chambre_34(client)
{
	new Float:v[3];
	GetEntPropVector(client, Prop_Send, "m_vecOrigin", v);
		
	if (v[0] >= -3412.698242 && v[0] <= -3136.527344 && v[1] >= -4901.646484 && v[1] <= -4616.125488 && v[2] >= 440.031250 && v[2] <= 570.031250)
		return true;

	else
		return false;
}	

Chambre_41(client)
{
	new Float:v[3];
	GetEntPropVector(client, Prop_Send, "m_vecOrigin", v);
		
	if (v[0] >= 634.429565 && v[0] <= 1269.468140 && v[1] >= -1543.072266 && v[1] <= -1155.068726 && v[2] >= 392.031250 && v[2] <= 524.031250)
		return true;

	else
		return false;
}	

Chambre_42(client)
{
	new Float:v[3];
	GetEntPropVector(client, Prop_Send, "m_vecOrigin", v);
		
	if (v[0] >= 625.834229 && v[0] <= 1271.200317 && v[1] >= -951.391052 && v[1] <= -571.344971 && v[2] >= 392.031250 && v[2] <= 524.031250)
		return true;

	else
		return false;
}	


// COULOIRS & ETC
		
Couloir_RDC(client)
{
	new Float:v[3];
	GetEntPropVector(client, Prop_Send, "m_vecOrigin", v);
		
	if (v[0] >= -3829.168701 && v[0] <= -3127.671143 && v[1] >= -5048.168945 && v[1] <= -4911.831055 && v[2] >= 168.031250 && v[2] <= 298.031250)
		return true;

	else
		return false;
}	

Couloir_1(client)
{
	new Float:v[3];
	GetEntPropVector(client, Prop_Send, "m_vecOrigin", v);
		
	if (v[0] >= -3826.395508 && v[0] <= -3134.966309 && v[1] >= -5045.881836 && v[1] <= -4911.831055 && v[2] >= 304.031250 && v[2] <= 434.031250)
		return true;

	else
		return false;
}		

Couloir_2(client)
{
	new Float:v[3];
	GetEntPropVector(client, Prop_Send, "m_vecOrigin", v);
		
	if (v[0] >= -3830.061279 && v[0] <= -3137.560547 && v[1] >= -5049.869629 && v[1] <= -4911.686523 && v[2] >= 440.031250 && v[2] <= 570.031250)
		return true;

	else
		return false;
}				
			
Escalier(client)
{
	new Float:v[3];
	GetEntPropVector(client, Prop_Send, "m_vecOrigin", v);
		
	if (v[0] >= -3829.168701 && v[0] <= -3706.639404 && v[1] >= -4907.508789 && v[1] <= -4616.023438 && v[2] >= 168.031250 && v[2] <= 568.031250)
		return true;

	else
		return false;
}	

// APPARTEMENTS

RADAR_1(client)
{
	new Float:v[3];
	GetEntPropVector(client, Prop_Send, "m_vecOrigin", v);
		
	if (v[0] >= -3837.957764 && v[0] <= -3347.836914 && v[1] >= -1576.577881 && v[1] <= -1229.775146 && v[2] >= 3.332260 && v[2] <= 85.031250)
		return true;

	else
		return false;
}	

Boite_Nuit(client)
{
	new Float:v[3];
	GetEntPropVector(client, Prop_Send, "m_vecOrigin", v);
	
	if (v[0] >= -3182.968750 && v[0] <= -2685.031250 && v[1] >= 585.031250 && v[1] <= 1667.968750 && v[2] >= -23.968748 && v[2] <= 133.031250)
		return true;
		
	else if (v[0] >= -3071.275146 && v[0] <= -2825.031250 && v[1] >= 1668.031250 && v[1] <= 2047.570679 && v[2] >= -23.968748 && v[2] <= 106.031250)
		return true;
		
	else
		return false;
}

Magasin_Voitures(client)
{
	new Float:v[3];
	GetEntPropVector(client, Prop_Send, "m_vecOrigin", v);
	
	if (v[0] >= -2440.914307 && v[0] <= -2075.242432 && v[1] >= -3591.025146 && v[1] <= -2870.600586 && v[2] >= 32.031254 && v[2] <= 297.031250)
		return true;
		
	else if (v[0] >= -2094.077393 && v[0] <= -1956.886475 && v[1] >= -3589.084717 && v[1] <= -2916.253174 && v[2] >= 32.031254 && v[2] <= 297.031250)
		return true;
		
	else if (v[0] >= -1954.356323 && v[0] <= -1766.375244 && v[1] >= -3587.309814 && v[1] <= -3398.695068 && v[2] >= 32.031254 && v[2] <= 162.031250)
		return true;	
		
	else
		return false;
}

Parking(client)
{
	new Float:v[3];
	GetEntPropVector(client, Prop_Send, "m_vecOrigin", v);
		
	if (v[0] >= -3280.073242 && v[0] <= -2658.295410 && v[1] >= -2351.858643 && v[1] <= -1362.392578 && v[2] >= 0.0 && v[2] <= 437.376709)
		return true;

	else
		return false;
}	

Total(client)
{
	new Float:v[3];
	GetEntPropVector(client, Prop_Send, "m_vecOrigin", v);
	
	if (v[0] >= -754.130554 && v[0] <= -257.222839 && v[1] >= 591.199951 && v[1] <= 1097.551514 && v[2] >= -36.153671 && v[2] <= 133.247818)
		return true;
		
	else if (v[0] >= -252.176407 && v[0] <= -71.665390 && v[1] >= 871.967285 && v[1] <= 1307.083008 && v[2] >= -8.257431 && v[2] <= 134.121246)
		return true;
		
	else if (v[0] >= -254.671143 && v[0] <= 234.039597 && v[1] >= 1322.520630 && v[1] <= 1772.661987 && v[2] >= -40.056816 && v[2] <= 136.633179)
		return true;

	else
		return false;
}	

public SetDistrib()
{
	decl String:map[128];
	GetCurrentMap(map, sizeof(map));
	
	if (StrEqual(map, "rp_riverside_b4"))
	{
		new Ent;
		
		PrecacheModel("models/props/cs_office/tv_plasma.mdl", true);
		Ent = CreateEntityByName("prop_physics_override", -1);
		DispatchKeyValue(Ent, "Solid", "6");
		DispatchKeyValue(Ent, "model", "models/props/cs_office/tv_plasma.mdl");
		DispatchKeyValue(Ent, "targetname", "tvplas");
		SetEntProp(Ent, Prop_Send, "m_CollisionGroup", 5);
		SetEntProp(Ent, Prop_Send, "m_usSolidFlags", 16);
		SetEntProp(Ent, Prop_Send, "m_nSolidType", 6);
		DispatchSpawn(Ent);
		TeleportEntity(Ent, Float:{ -3895.944335, 25.489837, 60.283248 }, Float:{ 0.0, 0.0, 0.0 }, NULL_VECTOR);
		AcceptEntityInput(Ent, "DisableMotion", -1, -1, 0);
		SetEntityMoveType(Ent, MOVETYPE_NONE);
		SetEntProp(Ent, Prop_Data, "m_takedamage", 0, 1);

		//POLE
		
		PrecacheModel("models/props_unique/atm01.mdl", true);
		Ent = CreateEntityByName("prop_physics_override", -1);
		DispatchKeyValue(Ent, "Solid", "6");
		DispatchKeyValue(Ent, "model", "models/props_unique/atm01.mdl");
		DispatchKeyValue(Ent, "targetname", "distribrp");
		SetEntProp(Ent, Prop_Send, "m_CollisionGroup", 5);
		SetEntProp(Ent, Prop_Send, "m_usSolidFlags", 16);
		SetEntProp(Ent, Prop_Send, "m_nSolidType", 6);
		DispatchSpawn(Ent);
		TeleportEntity(Ent, Float:{ -4113.516601, 338.005798, 8.031250 }, Float:{  0.0, 0.0, 0.000000 }, NULL_VECTOR);
		AcceptEntityInput(Ent, "DisableMotion", -1, -1, 0);
		SetEntityMoveType(Ent, MOVETYPE_NONE);
		SetEntProp(Ent, Prop_Data, "m_takedamage", 0, 1);
		
		PrecacheModel("models/props_unique/atm01.mdl", true);
		Ent = CreateEntityByName("prop_physics_override", -1);
		DispatchKeyValue(Ent, "Solid", "6");
		DispatchKeyValue(Ent, "model", "models/props_unique/atm01.mdl");
		DispatchKeyValue(Ent, "targetname", "distribrp");
		SetEntProp(Ent, Prop_Send, "m_CollisionGroup", 5);
		SetEntProp(Ent, Prop_Send, "m_usSolidFlags", 16);
		SetEntProp(Ent, Prop_Send, "m_nSolidType", 6);
		DispatchSpawn(Ent);
		TeleportEntity(Ent, Float:{ -4113.516601, 13.99, 8.031250 }, Float:{  0.000000, 0.0, 0.000000 }, NULL_VECTOR);
		AcceptEntityInput(Ent, "DisableMotion", -1, -1, 0);
		SetEntityMoveType(Ent, MOVETYPE_NONE);
		SetEntProp(Ent, Prop_Data, "m_takedamage", 0, 1);
		
		//POLLE
		
		PrecacheModel("models/props/cs_office/tv_plasma.mdl", true);
		Ent = CreateEntityByName("prop_physics_override", -1);
		DispatchKeyValue(Ent, "Solid", "6");
		DispatchKeyValue(Ent, "model", "models/props/cs_office/tv_plasma.mdl");
		DispatchKeyValue(Ent, "targetname", "tvplas");
		SetEntProp(Ent, Prop_Send, "m_CollisionGroup", 5);
		SetEntProp(Ent, Prop_Send, "m_usSolidFlags", 16);
		SetEntProp(Ent, Prop_Send, "m_nSolidType", 6);
		DispatchSpawn(Ent);
		TeleportEntity(Ent, Float:{ -3895.944335, 330.300262, 60.528499 }, Float:{ 0.0, 0.0, 0.0 }, NULL_VECTOR);
		AcceptEntityInput(Ent, "DisableMotion", -1, -1, 0);
		SetEntityMoveType(Ent, MOVETYPE_NONE);
		SetEntProp(Ent, Prop_Data, "m_takedamage", 0, 1);
		
	
		Distributeur(Float:{ 1263.968750, -2002.790649, 30.0 }, Float:{ 0.0, 180.0, 0.0 });
		Distributeur(Float:{ -3040.006836, -216.611832, 7.0 }, Float:{ 0.0, 180.0, 0.0 });
		Distributeur(Float:{ -2127.822021, 1071.968750 , 7.0 }, Float:{ 0.000000, -45.000000, 0.000000 });
		Distributeur(Float:{ -1542.730346, -4320.334960, 150.738479 }, Float:{ 0.000000, -135.000000, 0.000000 });		
		Distributeur(Float:{ -1936.007324, -2171.260254, 9.0 }, Float:{ 0.0, 180.0, 0.0 });		
		Distributeur(Float:{ -3248.031250, -2847.992676, 170.0 }, Float:{ 0.000000, 135.000000, 0.000000 });
		Distributeur(Float:{ 630.7, 473.4, 50.0 }, Float:{ 0.0, 90.0, 0.0 });	
		Distributeur(Float:{ -2683.139160, -2829.498046, 38.687442 }, Float:{ 0.0, 90.0, 0.0 });	
		Distributeur(Float:{ -2683.139160, -2385.976318, 38.489322 }, Float:{ 0.0, -90.0, 0.0 });
				
		Camera(Float:{ -3890.077392, -1201.110839, 100.000000 }, Float:{ 0.000000, -90.000000, 0.000000 });		
	}
}

stock Distributeur(Float:pos[3], Float:ang[3])
{
	new Ent;
	Ent = CreateEntityByName("prop_physics_override", -1);
	DispatchKeyValue(Ent, "Solid", "6");
	DispatchKeyValue(Ent, "model", "models/props_unique/atm01.mdl");
	DispatchKeyValue(Ent, "targetname", "distribarmu");
	SetEntProp(Ent, Prop_Send, "m_CollisionGroup", 5);
	SetEntProp(Ent, Prop_Send, "m_usSolidFlags", 16);
	SetEntProp(Ent, Prop_Send, "m_nSolidType", 6);
	DispatchSpawn(Ent);
	AcceptEntityInput(Ent, "DisableMotion", -1, -1, 0);
	SetEntityMoveType(Ent, MOVETYPE_NONE);
	SetEntProp(Ent, Prop_Data, "m_takedamage", 0, 1);	
	TeleportEntity(Ent, pos, ang, NULL_VECTOR);
}


stock Camera(Float:pos[3], Float:ang[3])
{
	new Ent;
	Ent = CreateEntityByName("prop_physics_override", -1);
	DispatchKeyValue(Ent, "Solid", "6");
	DispatchKeyValue(Ent, "model", MODELS_CAMERA);
	DispatchKeyValue(Ent, "targetname", "radar");
	SetEntProp(Ent, Prop_Send, "m_CollisionGroup", 5);
	SetEntProp(Ent, Prop_Send, "m_usSolidFlags", 16);
	SetEntProp(Ent, Prop_Send, "m_nSolidType", 6);
	DispatchSpawn(Ent);
	TeleportEntity(Ent, pos, ang, NULL_VECTOR);
	AcceptEntityInput(Ent, "DisableMotion", -1, -1, 0);
	SetEntityMoveType(Ent, MOVETYPE_NONE);
	SetEntProp(Ent, Prop_Data, "m_takedamage", 0, 1);	
}

public lockdoor(porte)
{
	if (IsValidEntity(porte))
	{
		Entity_Lock(porte);
		EmitSoundToAll("doors/default_locked.wav", porte, SNDCHAN_AUTO, SNDLEVEL_NORMAL);
	}
}

public unlockdoor(porte)
{
	if (IsValidEntity(porte))
	{
		Entity_UnLock(porte);
		EmitSoundToAll("doors/latchunlocked1.wav", porte, SNDCHAN_AUTO, SNDLEVEL_NORMAL);
	}
}

public Action:Command_4rd(client, args)
{
    SetEntPropEnt(client, Prop_Send, "m_hObserverTarget", 0); 
    SetEntProp(client, Prop_Send, "m_iObserverMode", 1);
    SetEntProp(client, Prop_Send, "m_bDrawViewmodel", 1);
    SetEntProp(client, Prop_Send, "m_iFOV", 200);
}

public Action:Command_3rd(client, args)
{
	if (IsPlayerAlive(client))
	{
		if (Client_IsInThirdPersonMode(client))
		{
			Client_SetThirdPersonMode(client, false);
		}
		else
		{
			Client_SetThirdPersonMode(client, true);
		}
	}
	else
	{
		CPrintToChat(client,"%s {red} Vous devez être vivant !", LOGO);
	}
}

public Action:Command_Gps(client, Args)
{
	if (IsClientInGame(client))
	{
		if (rankid[client] == 14)
		{
			decl String:name[32];
			decl String:info[32];
			
			stopgps[client] = true;
			
			new Handle:menu = CreateMenu(Menu_Gps);
			SetMenuTitle(menu, "Veuillez choisir une cible :");
			
			for (new i = 1; i <= MaxClients; i++)
			{
				if (IsClientInGame(i) && IsPlayerAlive(i))
				{
					if (rankid[i] != 11)
					{
						GetClientName(i, name, sizeof(name));
						IntToString(i, info, sizeof(info));
						
						AddMenuItem(menu, info, name);
					}
				}
			}
			
			DisplayMenu(menu, client, MENU_TIME_FOREVER);
		}
	}
}

public Menu_Gps(Handle:menu, MenuAction:action, param1, param2)
{
	if (action == MenuAction_Select)
	{
		decl String:info[256];
		
		stopgps[param1] = false;
		
		GetMenuItem(menu, param2, info, sizeof(info));
		
		Cibled[param1] = StringToInt(info);
		
		if (!stopgps[param1])
		{
			CreateTimer(1.0, UpdateGps, param1);
		}
	}
	else
	{
		if (action == MenuAction_End)
		{
			CloseHandle(menu);
		}
	}
}

public Action:UpdateGps(Handle:timer, any:param1)
{
	if (IsClientInGame(param1))
	{
		if (IsClientInGame(Cibled[param1]) && Cibled[param1] > 0)
		{
			if (IsPlayerAlive(Cibled[param1]))
			{
				decl Float:tueur_vec[3];
				decl Float:cible_vec[3];
			
				GetClientAbsOrigin(param1, tueur_vec);
				GetClientAbsOrigin(Cibled[param1], cible_vec);
			
				new Float:test = tueur_vec[2];
				tueur_vec[2] = 40.0 + test;
			
				new Float:testt = cible_vec[2];
				cible_vec[2] = 40.0 + testt;
			
				TE_SetupBeamPoints(tueur_vec, cible_vec, g_modelLaser, g_modelHalo, 0, 1, 1.0, 10.0, 10.0, 1, 1.0, TAZER_COLORBLUE, 1);
				TE_SendToClient(param1);
			}
		}
		
		if (IsPlayerAlive(Cibled[param1]))
		{
			if (!stopgps[param1])
			{
				CreateTimer(1.0, UpdateGps, param1);
			}
		}
	}
}

public Action:Command_Size(client, args)
{
	if (IsClientInGame(client))
	{
		if (IsPlayerAlive(client))
		{
			new String:SteamID[64];
			GetClientAuthString(client, SteamID, sizeof(SteamID));
		
			if (GetUserFlagBits(client) & ADMFLAG_ROOT)
			{
				new Handle:menu = CreateMenu(Menu_Heure);
				SetMenuTitle(menu, "Choix de l'heure :\n");
				AddMenuItem(menu, "0", "Matin (8:00)");
				AddMenuItem(menu, "1", "Midi (12:00)");
				AddMenuItem(menu, "2", "Soir (18:00)");
				AddMenuItem(menu, "3", "Minuit (23:59)");
				DisplayMenu(menu, client, MENU_TIME_FOREVER);
			}
		}
	}
}

public Menu_Limit(Handle:menu, MenuAction:action, client, param2)
{
	if (action == MenuAction_Select)
	{
		decl String:info[256];
		
		GetMenuItem(menu, param2, info, sizeof(info));
		
		if (StrEqual(info, "0"))
		{
			LIMITATION = 30;
			CPrintToChatAll("({blue}POLICE{default}) Limitation de vitesse à {green}30 Km/H");
		}
		else if (StrEqual(info, "2"))
		{
			LIMITATION = 100;
			CPrintToChatAll("({blue}POLICE{default}) Limitation de vitesse à {green}100 Km/H");
		}		
		else if (StrEqual(info, "1"))
		{
			LIMITATION = 50;
			CPrintToChatAll("({blue}POLICE{default}) Limitation de vitesse à {green}50 Km/H");
		}
		else if (StrEqual(info, "3"))
		{
			LIMITATION = 130;
			CPrintToChatAll("({blue}POLICE{default}) Limitation de vitesse à {green}130 Km/H");
		}
	}
	else if (action == MenuAction_End)
	{
		CloseHandle(menu);
	}
}

public Menu_Heure(Handle:menu, MenuAction:action, client, param2)
{
	if (action == MenuAction_Select)
	{
		decl String:info[256];
		
		GetMenuItem(menu, param2, info, sizeof(info));
		
		if (StrEqual(info, "0"))
		{
			g_countheure1 = 0;
			g_countheure2 = 8;
			g_countminute1 = 0;
			g_countminute2 = 0;
			
			SetLight();
			
			CPrintToChatAll("({red}ADMIN{default}) L'heure a été mise à {green}8:00{default} par {blue}%N", client);
			CPrintToChat(client, "%s {black}[ADMIN]{white} Vous mettez l'heure à {green}8:00", LOGO);
		}
		else if (StrEqual(info, "2"))
		{
			g_countheure1 = 1;
			g_countheure2 = 8;
			g_countminute1 = 0;
			g_countminute2 = 0;
			
			CPrintToChatAll("({red}ADMIN{default}) L'heure a été mise à {green}18:00{default} par {blue}%N", client);
			CPrintToChat(client, "%s {black}[ADMIN]{white} Vous mettez l'heure à {green}18:00", LOGO);
		}		
		else if (StrEqual(info, "1"))
		{
			g_countheure1 = 1;
			g_countheure2 = 2;
			g_countminute1 = 0;
			g_countminute2 = 0;
			
			SetLight();
			
			CPrintToChatAll("({red}ADMIN{default}) L'heure a été mise à {green}12:00{default} par {blue}%N", client);
			CPrintToChat(client, "%s {black}[ADMIN]{white} Vous mettez l'heure à {green}Midi", LOGO);
		}
		else if (StrEqual(info, "3"))
		{
			g_countheure1 = 2;
			g_countheure2 = 3;
			g_countminute1 = 5;
			g_countminute2 = 8;
			
			SetNight();
			
			CPrintToChatAll("({red}ADMIN{default}) L'heure a été mise à {green}23:59{default} par {blue}%N", client);
			CPrintToChat(client, "%s {black}[ADMIN]{white} Vous mettez l'heure à {green}Minuit", LOGO);
		}
	}
	else if (action == MenuAction_End)
	{
		CloseHandle(menu);
	}
}

public Menu_Size(Handle:menu, MenuAction:action, client, param2)
{
	if (action == MenuAction_Select)
	{
		decl String:info[256];
		
		GetMenuItem(menu, param2, info, sizeof(info));
		
		if (StrEqual(info, "0"))
		{
			SetEntPropFloat(client, Prop_Send, "m_flModelScale", 5.0);
			
			CPrintToChat(client, "%s Vous êtes désormais gigantesque.", LOGO);
		}
		else if (StrEqual(info, "1"))
		{
			SetEntPropFloat(client, Prop_Send, "m_flModelScale", 3.0);
			
			CPrintToChat(client, "%s Vous êtes désormais très grand.", LOGO);
		}
		else if (StrEqual(info, "2"))
		{
			SetEntPropFloat(client, Prop_Send, "m_flModelScale", 2.0);
			
			CPrintToChat(client, "%s Vous êtes désormais grand.", LOGO);
		}
		else if (StrEqual(info, "3"))
		{
			SetEntPropFloat(client, Prop_Send, "m_flModelScale", 1.5);
			
			CPrintToChat(client, "%s Vous êtes désormais moyen.", LOGO);
		}
		else if (StrEqual(info, "4"))
		{
			SetEntPropFloat(client, Prop_Send, "m_flModelScale", 1.0);
			
			CPrintToChat(client, "%s Vous êtes désormais normal.", LOGO);
		}
	}
	else if (action == MenuAction_End)
	{
		CloseHandle(menu);
	}
}

public Action:Command_Givemoney(client, args) 
{ 
	if (args == 2) 
	{ 
		decl String:arg1[128]; 
		decl String:arg2[128]; 
    
		GetCmdArg(1, arg1, sizeof(arg1)); 
		GetCmdArg(2, arg2, sizeof(arg2)); 
    
		new iNum = StringToInt(arg2); 
      
		for (new i = 1; i <= MaxClients; i++) 
		{ 
			if (strcmp(g_sSteamID[i], arg1) == 0) 
			{ 
				if (IsClientInGame(i))
				{
					money[i] += iNum; 
					CPrintToChat(i, "%s Félicitation ! {blue}Vous avez reçu %d€ pour votre achat en ligne.", LOGO, iNum); 
					
					LogToFile(Logfile,"Le joueur %N a reçu %d€ suite a son achat en ligne.", i, iNum);
					
					return Plugin_Handled; 
				}
			}
		} 
	} 
	else
	{ 
		ReplyToCommand(client, "Usage: sm_givemoney [steamid] [amount]"); 
	} 
	return Plugin_Handled; 
}

public Action:Command_Givepoints(client, args) 
{ 
	if (args == 2) 
	{ 
		decl String:arg1[128]; 
		decl String:arg2[128]; 
    
		GetCmdArg(1, arg1, sizeof(arg1)); 
		GetCmdArg(2, arg2, sizeof(arg2)); 
    
		new iNum = StringToInt(arg2); 
      
		for (new i = 1; i <= MaxClients; i++) 
		{ 
			if (strcmp(g_sSteamID[i], arg1) == 0) 
			{ 
				points[i] += iNum; 
				CPrintToChat(i, "%s Félicitation ! {blue}Vous avez reçu %d points pour votre achat en ligne.", LOGO, iNum); 
				
				LogToFile(Logfile,"Le joueur %N a reçu %d points suite a son achat en ligne.", i, iNum);
			
				return Plugin_Handled; 
			} 
		} 
	} 
	else
	{ 
		ReplyToCommand(client, "Usage: sm_givepoints [steamid] [amount]"); 
	} 
	return Plugin_Handled; 
}

public OnClientAuthorized(client, const String:auth[]) 
{ 
	strcopy(g_sSteamID[client], sizeof(g_sSteamID[]), auth); 
} 

public SupMoney(client, montant)
{
	if (money[client] >= montant)
	{
		money[client] -= montant;
		
		CPrintToChat(client, "%s {red}Vous avez été pénalisé de {green}%i€ {red}pour meutre", LOGO, montant);
	}
	else if (bank[client] >= montant)
	{
		bank[client] -= montant;
		
		CPrintToChat(client, "%s {red}Vous avez été pénalisé de {green}%i€ {red}pour meutre", LOGO, montant);
	}
	else
	{
		KickClient(client, "Vous n'avez plus d'argent pour payer une caution !");
	}
}

public Action:Command_Teleport(client, args)
{
	if (IsClientInGame(client))
	{
		new String:SteamID[64];
		GetClientAuthString(client, SteamID, sizeof(SteamID));
		
		if (Chef_SERVEUR(client))
		{
			BuildTeleportMenu(client);
		}
	}
	return Plugin_Handled;
}

BuildTeleportMenu(client)
{
	new Handle:teleportMenu = CreateMenu(Menu_Teleport);
	
	SetMenuTitle(teleportMenu, "Menu de téléportation :");
	AddMenuItem(teleportMenu, "1", "Se téléporter à un joueur");
	AddMenuItem(teleportMenu, "2", "Téléporter un joueur à soi");
	AddMenuItem(teleportMenu, "3", "Téléporté un joueur à un autre joueur");
	
	DisplayMenu(teleportMenu, client, MENU_TIME_FOREVER);
}

public Menu_Teleport(Handle:teleportMenu, MenuAction:action, param1, param2)
{
	if (action == MenuAction_Select)
	{
		decl String:info[32];
		
		GetMenuItem(teleportMenu, param2, info, sizeof(info));
		
		new Handle:teleportMenu2 = CreateMenu(Menu_Teleport2);
		
		SetMenuTitle(teleportMenu2, "Veuillez choisir un joueur :");
		
		
		for (new i = 1; i <= MaxClients; i++)
		{
			if (IsClientInGame(i))
			{
				if (IsPlayerAlive(i))
				{
					decl String:Buffer[32];
					decl String:Name[64];
					
					Format(Buffer, 32, "%i_%s", i, info);
					
					GetClientName(i, Name, 64);
					
					AddMenuItem(teleportMenu2, Buffer, Name);
				}
			}
		}
		DisplayMenu(teleportMenu2, param1, MENU_TIME_FOREVER);
	}
	else
	{
		if (action == MenuAction_End)
		{
			CloseHandle(teleportMenu);
		}
	}
}

public Menu_Teleport2(Handle:teleportMenu2, MenuAction:action, param1, param2)
{
	if (action == MenuAction_Select)
	{
		decl String:info[32];
		GetMenuItem(teleportMenu2, param2, info, sizeof(info));
		
		decl String:Buffer[8][32];
		
		ExplodeString(info, "_", Buffer, 2, 32);
		
		new client = StringToInt(Buffer[0]);
		
		decl Float:TargetPos[3];
		
		if (StrEqual(Buffer[1], "1"))
		{
			GetClientAbsOrigin(client, TargetPos);
			
			TeleportEntity(param1, TargetPos, NULL_VECTOR, NULL_VECTOR);
			
			CPrintToChat(param1, "%s Vous vous êtes téléporté à la position de %N", LOGO, client);
		}
		else if (StrEqual(Buffer[1], "2"))
		{
			GetClientAbsOrigin(param1, TargetPos);
			
			TeleportEntity(client, TargetPos, NULL_VECTOR, NULL_VECTOR);
			
			CPrintToChat(param1, "%s Vous avez téléporté %N à votre position.", LOGO, client);
		}
		else if (StrEqual(Buffer[1], "3"))
		{
			new Handle:teleportMenu3 = CreateMenu(Menu_Teleport3);
			SetMenuTitle(teleportMenu3, "Veuillez choisir à qui téléporter ce joueur :");
			
			for (new i = 1; i <= MaxClients; i++)
			{
				if (IsClientInGame(i))
				{
					if (IsPlayerAlive(i))
					{
						decl String:Buffer2[32];
						decl String:Name[64];
						
						Format(Buffer2, 32, "%i_%i", i, client);
						
						GetClientName(i, Name, 64);
						
						AddMenuItem(teleportMenu3, Buffer2, Name);
					}
				}
			}
			
			DisplayMenu(teleportMenu3, param1, MENU_TIME_FOREVER);
		}
	}
	else
	{
		if (action == MenuAction_End)
		{
			CloseHandle(teleportMenu2);
		}
	}
}

public Menu_Teleport3(Handle:teleportMenu3, MenuAction:action, param1, param2)
{
	if (action == MenuAction_Select)
	{
		decl String:info[32];
		GetMenuItem(teleportMenu3, param2, info, sizeof(info));
		
		decl String:Buffer[8][32];
		
		ExplodeString(info, "_", Buffer, 2, 32);
		
		new target = StringToInt(Buffer[0]);
		new client = StringToInt(Buffer[1]);
		
		decl Float:TargetPos[3];
		
		GetClientAbsOrigin(target, TargetPos);
		
		TeleportEntity(client, TargetPos, NULL_VECTOR, NULL_VECTOR);
		
		CPrintToChat(param1, "%s {blue}Vous avez téléporté {green}%N à %N.", LOGO, client, target);
	}
	else
	{
		if (action == MenuAction_End)
		{
			CloseHandle(teleportMenu3);
		}
	}
}

public Effect(client)
{
	decl Float:TargetPos[3];
		
	GetClientAbsOrigin(client, TargetPos);
	
	new tesla = CreateEntityByName("point_tesla");
	DispatchKeyValue(tesla, "m_flRadius", "200.0");
	DispatchKeyValue(tesla, "beamcount_min", "5");
	DispatchKeyValue(tesla, "beamcount_max", "10");
	DispatchKeyValue(tesla, "texture", "sprites/physbeam.vmt");
		
	DispatchKeyValue(tesla, "m_Color", "255 0 255");
	DispatchKeyValue(tesla, "thick_min", "10.0");
	DispatchKeyValue(tesla, "thick_max", "11.0");
	DispatchKeyValue(tesla, "lifetime_min", "0.3");
	DispatchKeyValue(tesla, "lifetime_max", "1.0");
	DispatchKeyValue(tesla, "interval_min", "0.1");
	DispatchKeyValue(tesla, "interval_max", "0.5");
	DispatchSpawn(tesla);
        
	TeleportEntity(tesla, TargetPos, NULL_VECTOR, NULL_VECTOR);	

	AcceptEntityInput(tesla, "TurnOn");  
	AcceptEntityInput(tesla, "DoSpark");
}

public choose_skin(client)
{
	if (IsClientInGame(client))
	{
		if (IsPlayerAlive(client))
		{
			if ((!VIP(client)) || VIP(client))
			{
				if (GetClientTeam(client) == 3)
				{
					if (!IsCivil[client])
					{
						if (Policier_TEMP[client])
						{
							SetEntityModel(client, MODELS_FLIC2);
						}
						else
						{
							if (rankid[client] == 1 && jobid[client] == 1)
							{
								SetEntityModel(client, MODELS_FLIC_BOSS);
							}
							else if (rankid[client] == 1 && jobid[client] == 2)
							{
								SetEntityModel(client, MODELS_FLIC1);
							}
							else if (rankid[client] == 1 && jobid[client] == 3)
							{
								SetEntityModel(client, MODELS_FLIC1);
							}
							else if (rankid[client] == 1 && jobid[client] == 4)
							{
								SetEntityModel(client, MODELS_FLIC2);
							}
							else if (rankid[client] == 1 && jobid[client] == 5)
							{
								SetEntityModel(client, MODELS_FLIC2);
							}
							else if (rankid[client] == 1 && jobid[client] == 6)
							{
								SetEntityModel(client, MODELS_FLIC2);
							}
							else if (rankid[client] == 10)
							{
								switch (GetRandomInt(1, 5))
								{
									case 1:
									{
										SetEntityModel(client, MODELS_TERRO1);
									}
									
									case 2:
									{
										SetEntityModel(client, MODELS_TERRO2);
									}
									
									case 3:
									{
										SetEntityModel(client, MODELS_TERRO3);
									}
									
									case 4:
									{
										SetEntityModel(client, MODELS_TERRO4);
									}
									
									case 5:
									{
										SetEntityModel(client, MODELS_TERRO5);
									}
								}
							}
						}
					}
					else
					{
						switch (GetRandomInt(1, 5))
						{
							case 1:
							{
								SetEntityModel(client, MODELS_TERRO1);
							}
								
							case 2:
							{
								SetEntityModel(client, MODELS_TERRO2);
							}
								
							case 3:
							{
								SetEntityModel(client, MODELS_TERRO3);
							}
								
							case 4:
							{
								SetEntityModel(client, MODELS_TERRO4);
							}
							
							case 5:
							{
								SetEntityModel(client, MODELS_TERRO5);
							}
						}
					}
				}
				else
				{
					if (g_jailtime[client] > 0)
					{
						SetEntityModel(client, MODELS_DETENU1);
					}
					else
					{
						if (rankid[client] < 0)
						{
							// ERROR
						}
						else 
						{
					
							if (jobid[client] == 1)
							{
								SetEntityModel(client, MODELS_BOSS_METIER);
								CPrintToChat(client, "%s {blue}Vous êtes le patron de votre entrepise !", LOGO);
							}
							else 
							{
								switch (GetRandomInt(1, 5))
								{
									case 1:
									{
										SetEntityModel(client, MODELS_TERRO1);
									}
									
									case 2:
									{
										SetEntityModel(client, MODELS_TERRO2);
									}
									
									case 3:
									{
										SetEntityModel(client, MODELS_TERRO3);
									}
									
									case 4:
									{
										SetEntityModel(client, MODELS_TERRO4);
									}
									
									case 5:
									{
										SetEntityModel(client, MODELS_TERRO5);
									}
								}
							}
						}
					}
				}
			}
			else
			{
				SetEntityModel(client, MODELS_VIP);
			}
		}
	}
}

public Action:Command_Shownote(client, args)
{
	if (IsClientInGame(client))
	{
		if (IsPlayerAlive(client))
		{
			if (jobid[client] > 0)
			{
				BuildShownoteMenu(client);
			}
			else
			{
				CPrintToChat(client, "%s {red}Vous n'avez pas accès a cette commande.", LOGO);
			}
		}
		else
		{
			CPrintToChat(client, "%s {red} Vous devez être vivant !", LOGO);
		}
	}
}

BuildShownoteMenu(client)
{
	new Handle:shownote = CreateMenu(Menu_Shownote);
	
	SetMenuTitle(shownote, "ShowNote de votre entreprise :");
	
	decl String:error[256];
	decl String:buffer[400];
	new Handle:db_rp = SQL_Connect("roleplay", true, error, sizeof(error));
	
	new String:texte[500];
	
	Format(buffer, sizeof(buffer), "SELECT texte FROM `Roleplay_Shownote` WHERE rankid = '%i'", rankid[client]);
	new Handle:query = SQL_Query(db_rp, buffer);
	
	if (query)
	{
		while (SQL_FetchRow(query))
		{
			SQL_FetchString(query, 0, texte, sizeof(texte));
			
			AddMenuItem(shownote, "", texte, ITEMDRAW_DISABLED);
		}
	}
	
	CloseHandle(query);
	
	DisplayMenu(shownote, client, MENU_TIME_FOREVER);
}

public Menu_Shownote(Handle:shownotte, MenuAction:action, param1, param2)
{
	if (action == MenuAction_End)
	{
		CloseHandle(shownotte);
	}
}

Ralentissement(client, Float:speed, Float:duration)
{
	if (IsClientInGame(client))
	{
		if (IsPlayerAlive(client))
		{
			SetEntPropFloat(client, Prop_Data, "m_flLaggedMovementValue", speed);
		
			if (duration > 0)
			{
				CreateTimer(duration, ResetSpeed, client);
			}
		}
	}
}

public Action:ResetSpeed(Handle:timer, any:param1)
{
	if (IsClientInGame(param1))
	{
		SetEntPropFloat(param1, Prop_Data, "m_flLaggedMovementValue", 1.0);
	}
	return Plugin_Handled;
}

public Action:TimerRecoil(Handle:timer, any:client)
{
	if (client > 0 && IsClientInGame(client) && IsPlayerAlive(client))
	{
		new Float:f_dur = FloatDiv(8.0, 3.0);
		
		new Handle:hShake = StartMessageOne("Shake", client);
		
		if (hShake != INVALID_HANDLE)
		{
			BfWriteByte(hShake, 0);
			BfWriteFloat(hShake, 50.0);
			BfWriteFloat(hShake, 1.0);
			BfWriteFloat(hShake, f_dur);
			EndMessage();
		}
	}
	return Plugin_Continue;
}

public PropSpawn(client, const String:modelname[])
{
	decl Ent;   
	PrecacheModel(modelname,true);
	Ent = CreateEntityByName("prop_physics_override"); 
	
	new String:EntName[256];
	Format(EntName, sizeof(EntName), "PROPS%N", client);
	
	DispatchKeyValue(Ent, "physdamagescale", "0.0");
	DispatchKeyValue(Ent, "model", modelname);
	DispatchKeyValue(Ent, "targetname", EntName);
	DispatchSpawn(Ent);
	
	decl Float:FurnitureOrigin[3];
	decl Float:ClientOrigin[3];
	decl Float:EyeAngles[3];
	GetClientEyeAngles(client, EyeAngles);
	GetClientAbsOrigin(client, ClientOrigin);
	
	FurnitureOrigin[0] = (ClientOrigin[0] + (50 * Cosine(DegToRad(EyeAngles[1]))));
	FurnitureOrigin[1] = (ClientOrigin[1] + (50 * Sine(DegToRad(EyeAngles[1]))));
	FurnitureOrigin[2] = (ClientOrigin[2] + 100);
	
	TeleportEntity(Ent, FurnitureOrigin, NULL_VECTOR, NULL_VECTOR);
	SetEntityMoveType(Ent, MOVETYPE_VPHYSICS);
}


Ouverture_CASINO()
{
	CPrintToChatAll("{green}({blue}CASINO{green}) {blue}Le casino est ouvert ! Venez Jouer !");
	CASINO = 1;
	new porte = -1;
	
	while ((porte = FindEntityByClassname(porte, "func_door")) != -1)
	{
		decl String:strName[50];
		GetEntPropString(porte, Prop_Data, "m_iName", strName, sizeof(strName));
	
		if(strcmp(strName, "loto_door") == 0)
		{
			AcceptEntityInput(porte, "Unlock");
			AcceptEntityInput(porte, "Open");
		}
	}
}

Fermeture_CASINO()
{
	CPrintToChatAll("{green}({red}CASINO{green}) {red}Le casino est fermé ! A ce soir :D");
	CASINO = 0;
	new porte = -1;
	
	while ((porte = FindEntityByClassname(porte, "func_door")) != -1)
	{
		decl String:strName[50];
		GetEntPropString(porte, Prop_Data, "m_iName", strName, sizeof(strName));
	
		if(strcmp(strName, "loto_door") == 0)
		{
			AcceptEntityInput(porte, "Close");
			AcceptEntityInput(porte, "Lock");
		}
	}
}


Ouverture_POLE()
{
	CPrintToChatAll("{green}({red}POLE-EMPLOI{green}) {blue}Le pôle emploi est désormais ouvert !");
	POLE_EMPLOI = 1;
	Lumireres();
	
	new porte = -1;
	
	while ((porte = FindEntityByClassname(porte, "func_door")) != -1)
	{
		decl String:strName[50];
		GetEntPropString(porte, Prop_Data, "m_iName", strName, sizeof(strName));
	
		if(strcmp(strName, "aperture_door") == 0)
		{
			AcceptEntityInput(porte, "Unlock");
			AcceptEntityInput(porte, "Open");
		}
	}
}

Lumireres()
{
	new lampe = -1;
	
	while ((lampe = FindEntityByClassname(lampe, "light_dynamic")) != -1)
	{
		AcceptEntityInput(lampe, "Kill");
	}	
}

Fermeture_POLE()
{
	CPrintToChatAll("{green}({red}POLE-EMPLOI{green}) {red}Le pôle emploi est désormais fermé");
	POLE_EMPLOI = 0;
	Spawn_PNJ();
	
	new porte = -1;
		
	while ((porte = FindEntityByClassname(porte, "func_door")) != -1)
	{
		decl String:strName[50];
		GetEntPropString(porte, Prop_Data, "m_iName", strName, sizeof(strName));
	
		if(strcmp(strName, "aperture_door") == 0)
		{
			AcceptEntityInput(porte, "Close");
			AcceptEntityInput(porte, "Lock");
		}
	}
}

SetNight()
{
	new maxent = GetMaxEntities(), String:szClass[65], String:Name[200];
	
	for (new i = MaxClients; i <= maxent; i++)
    {
		if(IsValidEdict(i) && IsValidEntity(i))
		{
			GetEdictClassname(i, szClass, sizeof(szClass));
			
			if(StrEqual("point_spotlight", szClass))
			{
				AcceptEntityInput(i, "LightOn");
			}
			else if(StrEqual("light_spot", szClass))
			{
				AcceptEntityInput(i, "TurnOn");
			}	
			else if(StrEqual("env_sun", szClass))
			{
				AcceptEntityInput(i, "TurnOff");
			}
			else if(StrEqual("light_environment", szClass))
			{
				AcceptEntityInput(i, "TurnOff");
			}
			else if(StrEqual("func_brush", szClass))
			{
				Entity_GetName(i, Name, sizeof(Name));
				
				if (StrEqual(Name, "night_skybox"))
				{
					DispatchKeyValue(i, "renderamt", "255");
				}
			}
		}
	}
}

SetLight()
{
	new maxent = GetMaxEntities(), String:szClass[65], String:Name[200];
	
	for (new i = MaxClients; i <= maxent; i++)
    {
		if(IsValidEdict(i) && IsValidEntity(i))
		{
			GetEdictClassname(i, szClass, sizeof(szClass));
			
			if(StrEqual("point_spotlight", szClass))
			{
				AcceptEntityInput(i, "LightOff");
			}
			else if(StrEqual("light_spot", szClass))
			{
				AcceptEntityInput(i, "TurnOff");
			}	
			else if(StrEqual("env_sun", szClass))
			{
				AcceptEntityInput(i, "TurnOn");
			}
			else if(StrEqual("light_environment", szClass))
			{
				AcceptEntityInput(i, "TurnOn");
			}
			else if(StrEqual("func_brush", szClass))
			{
				Entity_GetName(i, Name, sizeof(Name));
				
				if (StrEqual(Name, "night_skybox"))
				{
					DispatchKeyValue(i, "renderamt", "0");
				}
			}
		}
	}
}

SetLight1()
{
	new maxent = GetMaxEntities(), String:szClass[65], String:Name[200];
	
	for (new i = MaxClients; i <= maxent; i++)
    {
		if(IsValidEdict(i) && IsValidEntity(i))
		{
			GetEdictClassname(i, szClass, sizeof(szClass));
			
			if(StrEqual("func_brush", szClass))
			{
				Entity_GetName(i, Name, sizeof(Name));
				
				if (StrEqual(Name, "night_skybox"))
				{
					DispatchKeyValue(i, "renderamt", "180");
				}
			}
		}
	}
}

SetLight2()
{
	new maxent = GetMaxEntities(), String:szClass[65], String:Name[200];
	
	for (new i = MaxClients; i <= maxent; i++)
    {
		if(IsValidEdict(i) && IsValidEntity(i))
		{
			GetEdictClassname(i, szClass, sizeof(szClass));
			
			if(StrEqual("func_brush", szClass))
			{
				Entity_GetName(i, Name, sizeof(Name));
				
				if (StrEqual(Name, "night_skybox"))
				{
					DispatchKeyValue(i, "renderamt", "120");
				}
			}
		}
	}
}

public Action:Command_Immobilier(client, args)
{
	if (client)
	{
		if (IsClientInGame(client))
		{
			if (IsPlayerAlive(client))
			{
				if (rankid[client] == 19)
				{
					new entity = GetClientAimTarget(client, true);
					
					if (entity != -1)
					{
						if (Location[entity] == 0)
						{
							BuildImmobilierMenu(client, entity);
						}
						else
						{
							CPrintToChat(client, "%s {red}Le joueur possède déjà une maison.", LOGO);
							CPrintToChat(entity, "%s {red}Vous possèdez déjà une maison.", LOGO);
						}
					}
					else
					{
						CPrintToChat(client, "%s Vous devez viser un joueur.", LOGO);
					}
				}
				else
				{
					CPrintToChat(client, "%s {red}Vous n'avez pas accès a cette commande.", LOGO);
				}
			}
			else
			{
				CPrintToChat(client, "%s {red} Vous devez être vivant !", LOGO);
			}
		}
	}
}

Handle:BuildImmobilierMenu(client, cible)
{
	decl String:query[256];
	
	decl String:error[256];
	new Handle:db_rp = SQL_Connect("roleplay", true, error, sizeof(error));
	
	Format(query, sizeof(query), "SELECT id, name, price FROM `Roleplay_House` WHERE `occuped` = '0' ORDER BY `price`;");
	
	new Handle:immob = SQL_Query(db_rp, query);
	
	new Handle:immo = CreateMenu(Menu_Immobilier);
	SetMenuTitle(immo, "Sélectionnez une maison :");
	
	if (immob)
	{
		while (SQL_FetchRow(immob))
		{
			new String:szName[150];
			new String:szNameAfter[200];
			new String:szLoopBack[200];
			
			new id;
			
			id = SQL_FetchInt(immob, 0);
			
			SQL_FetchString(immob, 1, szName, sizeof(szName));
			
			new price;

			price = SQL_FetchInt(immob, 2);
			
			Format(szLoopBack, sizeof(szLoopBack), "%i_%i_%i", id, price, cible);
			Format(szNameAfter, sizeof(szNameAfter), "%s (Prix : %i€ | 24 Heures)", szName, price);
			strcopy(g_Appart[cible], sizeof(g_Appart[]), szName);
			
			AddMenuItem(immo, szLoopBack, szNameAfter);
		}
	}
	
	DisplayMenu(immo, client, MENU_TIME_FOREVER);
	
	CloseHandle(immob);
	CloseHandle(db_rp);
}

public Menu_Immobilier(Handle:menuu, MenuAction:action, client, param2)
{
	if (action == MenuAction_Select)
	{
		decl String:info[64];
		
		GetMenuItem(menuu, param2, info, sizeof(info));
		
		decl String:Buffer[12][64];
		decl String:Produit[224];
		
		ExplodeString(info, "_", Buffer, 3, 64);
		
		new idd, prix, SellID;
		
		idd = StringToInt(Buffer[0]);
		prix = StringToInt(Buffer[1]);
		SellID = StringToInt(Buffer[2]);
		
		Format(Produit, sizeof(Produit), "%s", g_Appart[SellID]);
		
		new String:Title[80];
		Format(Title, sizeof(Title), "Achat de %s pour %i€ pendant 1 jour (24 H)", Produit, prix);
		
		new Handle:menu = CreateMenu(Menu_Selling);
		SetMenuTitle(menu, Title);
		
		new String:Item[20];
		
		Format(Item, sizeof(Item), "a_%i_%i_%i", client, prix, idd);
		AddMenuItem(menu, Item, "Accepter l'offre");
		
		if (cb[SellID] == 1)
		{
			Format(Item, sizeof(Item), "aCB_%i_%i_%i", client, prix, idd);
			AddMenuItem(menu, Item, "Accepter l'offre et payer avec la carte bleue");
		}
		
		Format(Item, sizeof(Item), "r_%i_%i_%i", client, prix, idd);
		AddMenuItem(menu, "r", "Refuser l'offre");
		
		DisplayMenu(menu, SellID, MENU_TIME_FOREVER);
	}
	else if (action == MenuAction_End)
	{
		CloseHandle(menuu);
	}
}

public Menu_Selling(Handle:Selling, MenuAction:action, client, param2)
{
	if (action == MenuAction_Select)
	{
		decl String:info[64];
		
		GetMenuItem(Selling, param2, info, sizeof(info));
		
		decl String:Buffers[12][64];
		
		ExplodeString(info, "_", Buffers, 4, 64);
		
		new vendeur = StringToInt(Buffers[1]);
		new pri = StringToInt(Buffers[2]);
		new ID = StringToInt(Buffers[3]);
		
		new time = GetTime();
		new timeafter = time + 86400;
		
		if (client > 0 && vendeur > 0 && IsClientInGame(client) && IsClientInGame(vendeur))
		{
			if (StrEqual(Buffers[0], "a"))
			{
				if (money[client] >= pri)
				{
					money[client] -= pri;
					Location[client] = ID;
					
					CPrintToChat(client, "%s {blue} Achat de maison effectué", LOGO);
					CPrintToChat(vendeur, "%s {blue} Vous avez reussi votre transaction", LOGO);
					
					money[vendeur] += (pri / 2);
					capital[rankid[vendeur]] += (pri / 2);
					
					decl String:query[256];
		
					decl String:error[256];
					new Handle:db_rp = SQL_Connect("roleplay", true, error, sizeof(error));
					
					Format(query, sizeof(query), "UPDATE Roleplay_House SET occuped = 1, timestamp = %i WHERE `id` = '%i';", timeafter, ID);
					
					SQL_FastQuery(db_rp, query);
				}
				else
				{
					CPrintToChat(client, "%s {red}Vous n'avez pas assez d'argent.", LOGO);
					CPrintToChat(vendeur, "%s {red}Votre acheteur n'a pas les fonds", LOGO);
				}
			}
			else if (StrEqual(Buffers[0], "aCB"))
			{
				if (bank[client] >= pri)
				{
					bank[client] -= pri;
					Location[client] = ID;
					
					CPrintToChat(client, "%s Transaction effectuée.", LOGO);
					CPrintToChat(vendeur, "%s Transaction effectuée.", LOGO);
					
					money[vendeur] += (pri / 2);
					capital[rankid[vendeur]] += (pri / 2);
					
					decl String:query[256];
		
					decl String:error[256];
					new Handle:db_rp = SQL_Connect("roleplay", true, error, sizeof(error));
					
					Format(query, sizeof(query), "UPDATE Roleplay_House SET occuped = 1, timestamp = %i WHERE `id` = '%i';", time, ID);
					
					SQL_FastQuery(db_rp, query);
				}
				else
				{
					CPrintToChat(client, "%s {red}Vous n'avez pas assez d'argent.", LOGO);
					CPrintToChat(vendeur, "%s {red}Votre acheteur n'a pas les fonds", LOGO);
				}
			}
			else if (StrEqual(Buffers[0], "r"))
			{
				CPrintToChat(client, "%s Transaction annulée.", LOGO);
				CPrintToChat(vendeur, "%s Transaction annulée.", LOGO);
			}
		}
	}
	else if (action == MenuAction_End)
	{
		CloseHandle(Selling);
	}
}

public bool:DontHitClientOrVehicle(entity, contentsMask, any:data)
{
	new InVehicle = GetEntPropEnt(data, Prop_Send, "m_hVehicle");
	return ((entity != data) && (entity != InVehicle));
}

public Action:Horn_Time(Handle:timer, any:Driver)
{
	CarHorn[Driver] = false;
}

SpawnGarage(client, Float:spawnori[3], Float:spawnang[3], String:model[], String:script[], VehicleType, rgb)
{
	new ent = CreateEntityByName("prop_vehicle_driveable");
	
	if(IsValidEntity(ent))
	{
		Cars_Driver_Prop[ent] = -1;
		
		new String:ent_name[16];
		Format(ent_name, 16, "%i", ent);
		
		new String:Car_Name[64];
		Format(Car_Name, sizeof(Car_Name), "Voiture_%N", client);
		
		PrecacheModel(model, true);
		
		DispatchKeyValue(ent, "vehiclescript", script);
		DispatchKeyValue(ent, "model", model);
		DispatchKeyValue(ent, "targetname", Car_Name);
		DispatchKeyValue(ent, "VehicleLocked","1");
		
		if (rgb == 0)
		{
			DispatchKeyValue(ent, "rendercolor", "255 255 255");
		}
		else if (rgb == 1)
		{
			DispatchKeyValue(ent, "rendercolor", "0 0 0");
		}
		else if (rgb == 2)
		{
			DispatchKeyValue(ent, "rendercolor", "255 0 0");
		}
		else if (rgb == 3)
		{
			DispatchKeyValue(ent, "rendercolor", "0 0 255");
		}
		else if (rgb == 4)
		{
			DispatchKeyValue(ent, "rendercolor", "0 255 0");
		}
		else if (rgb == 5)
		{
			DispatchKeyValue(ent, "rendercolor", "255 0 255");
		}
		
		DispatchKeyValueFloat (ent, "MaxPitch", 360.00);
		DispatchKeyValueFloat (ent, "MinPitch", -360.00);
		DispatchKeyValueFloat (ent, "MaxYaw", 90.00);
		
		SetEntProp(ent, Prop_Send, "m_nSolidType", SOLID_VPHYSICS);
		SetEntProp(ent, Prop_Send, "m_CollisionGroup", 5);
		SetEntProp(ent, Prop_Send, "m_usSolidFlags", 16);
		
		SetEntProp(ent, Prop_Data, "m_takedamage", 2);
		SetEntProp(ent, Prop_Data, "m_iHealth", 500);
		
		SetEntProp(ent, Prop_Data, "m_nNextThinkTick", -1);
		SetEntProp(ent, Prop_Data, "m_bHasGun", 0);
				
		if (VehicleType)
		{
			SetEntProp(ent, Prop_Data, "m_nVehicleType", VEHICLE_TYPE_AIRBOAT_RAYCAST);
		}
	
		DispatchSpawn(ent);
		ActivateEntity(ent);
		
		TeleportEntity(ent, spawnori, spawnang, NULL_VECTOR);
		IsExitVehicle[client] = true;		
		Car[client] = ent;
		
		SetEntProp(ent, Prop_Data, "m_nNextThinkTick", -1);
		SDKHook(ent, SDKHook_Think, OnThink);
		SDKHook(ent, SDKHook_OnTakeDamage, OnVehicleTakeDamage);
		ViewEnt[ent] = -1;
		CarView[ent] = false;
	}
	return ent;
}

public Action:OnVehicleTakeDamage(victim, &attacker, &inflictor, &Float:damage, &damagetype)
{
	if (damage > float(GetEntProp(victim, Prop_Data, "m_iHealth")))
	{
		new Float:Pos[3];
		GetEntPropVector(victim, Prop_Send, "m_vecOrigin", Pos);
		TE_SetupExplosion(Pos, -1, 1.0, 1, 0, 200, 200);
		TE_SendToAll();
		EmitSoundToAll("vehicles/v8/vehicle_impact_heavy1.wav", victim, 0, 90);
	}
	
	return Plugin_Continue;
}

SpawnVehicle(client, Float:spawnori[3], Float:spawnang[3], String:model[], String:script[], VehicleType)
{
	if (client)
	{
		new Float:EyeAng[3];
		GetClientEyeAngles(client, EyeAng);
		
		new Float:ForwardVec[3];
		GetAngleVectors(EyeAng, ForwardVec, NULL_VECTOR, NULL_VECTOR);
		ScaleVector(ForwardVec, 100.0);
		ForwardVec[2] = 0.0;
		
		new Float:EyePos[3];
		GetClientEyePosition(client, EyePos);
		
		new Float:AbsAngle[3];
		GetClientAbsAngles(client, AbsAngle);
		
		new Float:SpawnAngles[3];
		SpawnAngles[1] = EyeAng[1];
		
		new Float:SpawnOrigin[3];
		AddVectors(EyePos, ForwardVec, SpawnOrigin);
		
		spawnori[0] = SpawnOrigin[0];
		spawnori[1] = SpawnOrigin[1];
		spawnori[2] = SpawnOrigin[2];
		spawnang[0] = SpawnAngles[0];
		spawnang[1] = SpawnAngles[1];
		spawnang[2] = SpawnAngles[2];
	}
	
	new ent = CreateEntityByName("prop_vehicle_driveable");
	
	if(IsValidEntity(ent))
	{
		Cars_Driver_Prop[ent] = -1;
		
		new String:ent_name[16], String:light_index[16];
		Format(ent_name, 16, "%i", ent);
		Format(light_index, 16, "%iLgt", ent);
		
		new String:Car_Name[64];
		Format(Car_Name, sizeof(Car_Name), "Voiture_%N", client);
		
		PrecacheModel(model, true);
		
		DispatchKeyValue(ent, "vehiclescript", script);
		DispatchKeyValue(ent, "model", model);
		DispatchKeyValue(ent, "targetname", Car_Name);
		DispatchKeyValue(ent, "VehicleLocked","1");
		DispatchKeyValue(ent, "rendercolor", "0 0 0");
		
		DispatchKeyValueFloat (ent, "MaxPitch", 360.00);
		DispatchKeyValueFloat (ent, "MinPitch", -360.00);
		DispatchKeyValueFloat (ent, "MaxYaw", 90.00);
		
		SetEntProp(ent, Prop_Send, "m_nSolidType", SOLID_VPHYSICS);
		SetEntProp(ent, Prop_Send, "m_CollisionGroup", 5);
		SetEntProp(ent, Prop_Send, "m_usSolidFlags", 16);
		
		if (VehicleType)
		{
			SetEntProp(ent, Prop_Data, "m_nVehicleType", VEHICLE_TYPE_AIRBOAT_RAYCAST);
		}
	
		DispatchSpawn(ent);
		ActivateEntity(ent);
		
		CPrintToChat(client, "%s {blue}Votre voiture est disponible !", LOGO);
		
		CarView[ent] = false;	
		IsExitVehicle[client] = true;
		
		Car[client] = ent;
		
		SetEntProp(ent, Prop_Data, "m_nNextThinkTick", -1);
		SDKHook(ent, SDKHook_Think, OnThink);
		
		new Float:MinHull[3];
		new Float:MaxHull[3];
		GetEntPropVector(ent, Prop_Send, "m_vecMins", MinHull);
		GetEntPropVector(ent, Prop_Send, "m_vecMaxs", MaxHull);
		
		new Float:temp;
		
		temp = MinHull[0];
		MinHull[0] = MinHull[1];
		MinHull[1] = temp;
		
		temp = MaxHull[0];
		MaxHull[0] = MaxHull[1];
		MaxHull[1] = temp;
		
		if (client)
		{
			if (client == 0)
			{
				TR_TraceHull(spawnori, spawnori, MinHull, MaxHull, MASK_SOLID);
			}
			else
			{
				TR_TraceHullFilter(spawnori, spawnori, MinHull, MaxHull, MASK_SOLID, RayDontHitClient, client);
			}
			
			if (TR_DidHit())
			{
				AcceptEntityInput(ent, "KillHierarchy", -1, -1, 0);
				RemoveEdict(ent);
				
				Car[client] = 0;
				
				if (client)
				{
					CPrintToChat(client, "%s {red}Vous ne pouvez mettre votre véhicule ici !", LOGO);
				}
				
				IsExitVehicle[client] = false;
				
				return -1;
			}
		}
		
		TeleportEntity(ent, spawnori, spawnang, NULL_VECTOR);
		ViewEnt[ent] = -1;
		
		decl Float:brake_rgb[3], Float:brake_angles[3], Float:white_rgb[3], Float:blue_rgb[3];
		brake_rgb[0] = 255.0;
		brake_rgb[1] = 0.0;
		brake_rgb[2] = 0.0;

		blue_rgb[0] = 0.0;
		blue_rgb[1] = 0.0;
		blue_rgb[2] = 255.0;

		white_rgb[0] = 255.0;
		white_rgb[1] = 255.0;
		white_rgb[2] = 255.0;

		brake_angles[0] = 0.0;
		brake_angles[1] = 0.0;
		brake_angles[2] = 0.0;
	}
	
	return ent;
}

public bool:RayDontHitClient(entity, contentsMask, any:data)
{
	return (entity != data);
}

public OnThink(entity)
{
	new Driver = GetEntPropEnt(entity, Prop_Send, "m_hPlayer");
	
	if (0 < Driver)
	{
		new car = GetEntPropEnt(Driver, Prop_Send, "m_hVehicle");
		
		if (entity != car)
		{
			ExitVehicle(Driver, car, 0);
		}
	}
	
	decl Float:ang[3];
	
	if (IsValidEntity(ViewEnt[entity]))
	{
		if (0 < Driver)
		{
			if (IsClientInGame(Driver))
			{
				SetEntProp(entity, Prop_Data, "m_nNextThinkTick", 1);
				SetEntPropFloat(entity, Prop_Data, "m_flTurnOffKeepUpright", 1.0);
				SetClientViewEntity(Driver, ViewEnt[entity]);
				
				if (Cars_Driver_Prop[entity] == -1)
				{
					new prop = CreateEntityByName("prop_physics_override");
					
					if(IsValidEntity(prop))
					{
						new String:model[128];
						GetClientModel(Driver, model, sizeof(model));
						DispatchKeyValue(prop, "model", model);
						DispatchKeyValue(prop, "skin","0");
						ActivateEntity(prop);
						DispatchSpawn(prop);
                    
						new enteffects = GetEntProp(prop, Prop_Send, "m_fEffects");  
						enteffects |= 1;
						enteffects |= 128;
						enteffects |= 512;
						SetEntProp(prop, Prop_Send, "m_fEffects", enteffects);  
                    
						new String:car_ent_name[128];
						GetTargetName(entity,car_ent_name,sizeof(car_ent_name));
                    
						SetVariantString(car_ent_name);
						AcceptEntityInput(prop, "SetParent", prop, prop, 0);
						SetVariantString("vehicle_3rd");
						AcceptEntityInput(prop, "SetParentAttachment", prop, prop, 0);	

						TeleportEntity(prop, CurrentEyeAngle[Driver], NULL_VECTOR, NULL_VECTOR);
						
						Cars_Driver_Prop[entity] = prop;
						
						AcceptEntityInput(prop, "Kill");	
					}
				}
			}
		}
	}
	
	if (GetEntProp(entity, Prop_Send, "m_bEnterAnimOn") == 1)
	{
		for (new players = 1; players <= MaxClients; players++) 
		{ 
			if (IsClientInGame(players) && IsPlayerAlive(players))
			{
				if (players != Driver)
				{
					TeleportEntity(players, NULL_VECTOR, CurrentEyeAngle[players], NULL_VECTOR);
				}
			}
		}  		
		SetEntProp(entity, Prop_Send, "m_nSequence", 0);
		CarHorn[Driver] = false;
		SetEntProp(entity, Prop_Send, "m_bEnterAnimOn", 0);
		SetEntProp(entity, Prop_Send, "m_nSequence", 0);
		
		SetEntityMoveType(Driver, MOVETYPE_WALK);
		SetEntProp(Driver, Prop_Send, "m_CollisionGroup", 5, 4);
		
		decl String:targetName[100];

		decl Float:sprite_rgb[3];
		sprite_rgb[0] = 0.0;
		sprite_rgb[1] = 0.0;
		sprite_rgb[2] = 0.0;
		
		GetTargetName(entity, targetName, sizeof(targetName));
	
		new sprite = CreateEntityByName("env_sprite");
		
		PrecacheModel("materials/sprites/dot.vmt", true);
		
		DispatchKeyValue(sprite, "model", "materials/sprites/dot.vmt");
		DispatchKeyValue(sprite, "renderamt", "0");
		DispatchKeyValue(sprite, "renderamt", "0");
		DispatchKeyValueVector(sprite, "rendercolor", sprite_rgb);
		
		DispatchSpawn(sprite);
		
		new Float:vec[3];
		GetClientAbsOrigin(Driver, vec);
		GetClientAbsAngles(Driver, ang);
		
		TeleportEntity(sprite, vec, ang, NULL_VECTOR);
		
		SetClientViewEntity(Driver, sprite);
		
		SetVariantString("!activator");
		AcceptEntityInput(sprite, "SetParent", Driver);
		
		SetVariantString(targetName);
		AcceptEntityInput(Driver, "SetParent");
		
		SetVariantString("vehicle_driver_eyes");
		AcceptEntityInput(Driver, "SetParentAttachment");
		
		ViewEnt[entity] = sprite; 		
	}
	
	if (Driver > 0)
	{
		buttons2 = GetClientButtons(Driver);
		
		if (buttons2 & IN_ATTACK)
		{
			if (!CarHorn[Driver])
			{
				EmitSoundToAll("vehicles/mustang_horn.mp3", entity, SNDCHAN_AUTO, SNDLEVEL_AIRCRAFT);
				CarHorn[Driver] = true;
				CreateTimer(1.0, Horn_Time, Driver);
			}
		}	
				
		new speed = GetEntProp(entity, Prop_Send, "m_nSpeed", 4);
		
		PrintHintText(Driver, "Vitesse actuelle : %i km/h", speed);
		
		if (speed > LIMITATION)
		{
			if (RADAR_1(entity))
			{
				if (!Averti[Driver])
				{
					Averti[Driver] = true;
					CreateTimer(0.7, FLASH, Driver);
				}
			}
		}
	}
}

public Action:FLASH(Handle:timer, any:client)
{
	Averti[client] = false;
	CPrintToChatAll("{red}({purple}RADAR{red}){green} %N {red}vient de dépasser la limite de vitesse !", client);
	new Handle:hP2 = CreatePanel();
	new String:sMessage[9999];
	Format(sMessage, sizeof(sMessage), "- VG-RP RADAR -   \n \n \nVous avez été flashé par un RADAR");
	DrawPanelText(hP2, sMessage);
	SetPanelCurrentKey(hP2, 10);
	SendPanelToClient(hP2, client, Handler_DoNothing, 30);
	Averti[client] = false;
}

public DEM_VOITURE(Handle:Menu, MenuAction:HandleAction, client, Parameter)
{
	if(HandleAction == MenuAction_Select)
	{	
		if(Parameter == 0)
		{
			new car = GetEntPropEnt(client, Prop_Send, "m_hVehicle");
			
			if (car != -1)
			{
				CPrintToChat(client, "%s {blue}Moteur : {green}ON", LOGO);
				
				AcceptEntityInput(car, "TurnOn", -1, -1, 0);
			}
		}
	}
}

public STOP_VOITURE(Handle:Menu, MenuAction:HandleAction, client, Parameter)
{
	if(HandleAction == MenuAction_Select)
	{	
		if(Parameter == 0)
		{
			CPrintToChat(client, "%s {blue}Véhicule rangé au garage !", LOGO);
			CPrintToChat(client, "%s {blue}Moteur : {green}OFF", LOGO);
			
			
			new Driver = GetEntPropEnt(Car[client], Prop_Send, "m_hPlayer");
								
			if (Driver > 0)
			{								
				ExitVehicle(Driver, Car[client], 0);
			}
			
			AcceptEntityInput(Car[client], "KillHierarchy", -1, -1, 0);
			RemoveEdict(Car[client]);
			IsExitVehicle[client] = false;		
			Car[client] = 0;
		}
		if(Parameter == 1)
		{
		
			new Driver = GetEntPropEnt(Car[client], Prop_Send, "m_hPlayer");
								
			if (Driver > 0)
			{						
				ExitVehicle(Driver, Car[client], 0);
			}

			CPrintToChat(client, "%s {blue}Véhicule vérouillé", LOGO);
			Entity_Lock(Car[client]);
		}
	}
}

public Action:Effet_SPAWN(Handle:timer, any:client)
{		
	Effect(client);
}	


ExitVehicle(client, vehicle, force)
{
	new Float:ExitPoint[3];
	
	if (!force)
	{
		// check left.
		if (!IsExitClear(client, vehicle, 90.0, ExitPoint))
		{
			// check right.
			if (!IsExitClear(client, vehicle, -90.0, ExitPoint))
			{
				// check front.
				if (!IsExitClear(client, vehicle, 0.0, ExitPoint))
				{
					// check back.
					if (!IsExitClear(client, vehicle, 180.0, ExitPoint))
					{
						// check above the vehicle.
						new Float:ClientEye[3];
						GetClientEyePosition(client, ClientEye);
						
						new Float:ClientMinHull[3];
						new Float:ClientMaxHull[3];
						GetEntPropVector(client, Prop_Send, "m_vecMins", ClientMinHull);
						GetEntPropVector(client, Prop_Send, "m_vecMaxs", ClientMaxHull);
						
						new Float:TraceEnd[3];
						TraceEnd = ClientEye;
						TraceEnd[2] += 500.0;
						
						TR_TraceHullFilter(ClientEye, TraceEnd, ClientMinHull, ClientMaxHull, MASK_PLAYERSOLID, DontHitClientOrVehicle, client);
						
						new Float:CollisionPoint[3];
						
						if (TR_DidHit())
						{
							TR_GetEndPosition(CollisionPoint);
						}
						else
						{
							CollisionPoint = TraceEnd;
						}
						
						TR_TraceHull(CollisionPoint, ClientEye, ClientMinHull, ClientMaxHull, MASK_PLAYERSOLID);
						
						new Float:VehicleEdge[3];
						TR_GetEndPosition(VehicleEdge);
						
						new Float:ClearDistance = GetVectorDistance(VehicleEdge, CollisionPoint);
						
						if (ClearDistance >= 100.0)
						{
							ExitPoint = VehicleEdge;
							ExitPoint[2] += 100.0;
							
							if (TR_PointOutsideWorld(ExitPoint))
							{
								CPrintToChat(client, "%s {red}Vous ne pouvez pas sortir ici !", LOGO);
								return;
							}
						}
						else
						{
							CPrintToChat(client, "%s {red}Vous ne pouvez pas sortir ici !", LOGO);
							return;
						}
					}
				}
			}
		}
	}
	else
	{
		GetClientAbsOrigin(client, ExitPoint);
	}
	
	new car = GetEntPropEnt(client, Prop_Send, "m_hVehicle");
	
	if (IsValidEntity(car))
	{
		new String:car_ent_name[128];
		GetTargetName(car, car_ent_name, sizeof(car_ent_name));		
		SetVariantString(car_ent_name);
		AcceptEntityInput(client, "SetParent");
		SetVariantString("car_driver_exit");
		AcceptEntityInput(client, "SetParentAttachment");		

		new Float:ExitAng[3];
		GetEntPropVector(car, Prop_Data, "m_angRotation", ExitAng);
		ExitAng[0] = 0.0;
		ExitAng[1] += 90.0;
		ExitAng[2] = 0.0;
	
		AcceptEntityInput(client, "ClearParent");	
		
		SetEntPropEnt(client, Prop_Send, "m_hVehicle", -1);
	
		SetEntPropEnt(car, Prop_Send, "m_hPlayer", -1);
	
		SetEntityMoveType(client, MOVETYPE_WALK);
	
		SetEntProp(client, Prop_Send, "m_CollisionGroup", COLLISION_GROUP_PLAYER);		
		
		new hud = GetEntProp(client, Prop_Send, "m_iHideHUD");
		hud &= ~1;
		hud &= ~256;
		hud &= ~1024;
		SetEntProp(client, Prop_Send, "m_iHideHUD", hud);
		
		new EntEffects = GetEntProp(client, Prop_Send, "m_fEffects");
		EntEffects &= ~EF_NODRAW;
		SetEntProp(client, Prop_Send, "m_fEffects", EntEffects);
		
		SetEntProp(car, Prop_Send, "m_nSpeed", 0);
		SetEntPropFloat(car, Prop_Send, "m_flThrottle", 0.0);
		AcceptEntityInput(car, "TurnOff");

		SetEntPropFloat(car, Prop_Data, "m_flTurnOffKeepUpright", 0.0);
	
		SetEntProp(car, Prop_Send, "m_iTeamNum", 0);
		
		TeleportEntity(client, ExitPoint, ExitAng, NULL_VECTOR);
		SetClientViewEntity(client, client);
		
		ForceSwitch[client] = 2;
		
		new equipweapon = GetPlayerWeaponSlot(client, 0); 
		EquipPlayerWeapon(client, equipweapon);
	}
	
	if (car > 0)
	{
		if (IsValidEntity(Cars_Driver_Prop[car]))
		{
			AcceptEntityInput(Cars_Driver_Prop[car],"Kill");
			
			RemoveEdict(Cars_Driver_Prop[car]);
			
			Cars_Driver_Prop[car] = -1;
		}
	}
}

bool:IsExitClear(client, vehicle, Float:direction, Float:exitpoint[3])
{
	new Float:ClientEye[3];
	new Float:VehicleAngle[3];
	GetClientEyePosition(client, ClientEye);
	GetEntPropVector(vehicle, Prop_Data, "m_angRotation", VehicleAngle);
	
	new Float:ClientMinHull[3];
	new Float:ClientMaxHull[3];
	GetEntPropVector(client, Prop_Send, "m_vecMins", ClientMinHull);
	GetEntPropVector(client, Prop_Send, "m_vecMaxs", ClientMaxHull);
	
	VehicleAngle[0] = 0.0;
	VehicleAngle[2] = 0.0;
	VehicleAngle[1] += direction;
	
	new Float:DirectionVec[3];
	GetAngleVectors(VehicleAngle, NULL_VECTOR, DirectionVec, NULL_VECTOR);
	ScaleVector(DirectionVec, -500.0);
	
	new Float:TraceEnd[3];
	AddVectors(ClientEye, DirectionVec, TraceEnd);
	
	TR_TraceHullFilter(ClientEye, TraceEnd, ClientMinHull, ClientMaxHull, MASK_PLAYERSOLID, DontHitClientOrVehicle, client);
	
	new Float:CollisionPoint[3];
	
	if (TR_DidHit())
	{
		TR_GetEndPosition(CollisionPoint);
	}
	else
	{
		CollisionPoint = TraceEnd;
	}
	
	TR_TraceHull(CollisionPoint, ClientEye, ClientMinHull, ClientMaxHull, MASK_PLAYERSOLID);
	
	new Float:VehicleEdge[3];
	TR_GetEndPosition(VehicleEdge);
	
	new Float:ClearDistance = GetVectorDistance(VehicleEdge, CollisionPoint);
	
	if (ClearDistance >= 100.0)
	{
		MakeVectorFromPoints(VehicleEdge, CollisionPoint, DirectionVec);
		NormalizeVector(DirectionVec, DirectionVec);
		ScaleVector(DirectionVec, 100.0);
		
		AddVectors(VehicleEdge, DirectionVec, exitpoint);
		
		if (TR_PointOutsideWorld(exitpoint))
		{
			return false;
		}
		else
		{
			return true;
		}
	}
	else
	{
		return false;
	}
}

stock GetTargetName(entity, String:buf[], len)
{
	GetEntPropString(entity, Prop_Data, "m_iName", buf, len);
}

public Action:Command_Garage(client, args)
{
	if (client)
	{
		if (IsClientInGame(client))
		{
			if (IsPlayerAlive(client))
			{
				BuildGarageMenu(client);
			}
			else
			{
				CPrintToChat(client, "%s {red} Vous devez être vivant !", LOGO);
			}
		}
	}
}

Handle:BuildGarageMenu(client)
{
	new Handle:menu = CreateMenu(Menu_Garage);
	SetMenuTitle(menu, "Votre garage :\n ");
	
	if (!IsExitVehicle[client])
	{
		AddMenuItem(menu, "",   "Veuillez vous rendre au Garage", ITEMDRAW_DISABLED);
	}
	else
	{
		AddMenuItem(menu, "ranger", "Ranger la voiture");
		AddMenuItem(menu, "lock",   "Verrouiller la voiture");
		AddMenuItem(menu, "unlock", "Déverrouiller la voiture");
	}
	
	DisplayMenu(menu, client, MENU_TIME_FOREVER);
}

public Menu_Garage(Handle:menu, MenuAction:action, client, param2)
{
	if (action == MenuAction_Select)
	{
		decl String:info[64];
		
		GetMenuItem(menu, param2, info, sizeof(info));
		
		if (client > 0 && IsPlayerAlive(client))
		{
			new Float:EyeAng[3];
			GetClientEyeAngles(client, EyeAng);
			
			new Float:SpawnAngles[3];
			SpawnAngles[1] = EyeAng[1] - 90.0;
			new Float:SpawnOrigin[3];
			GetClientEyePosition(client, SpawnOrigin);
			
			if(StrEqual(info, "tt"))
			{
				SpawnVehicle(client, SpawnOrigin, SpawnAngles, MODELS_TT, SCRIPT_TT, 0);
			}
			else if(StrEqual(info, "dbs"))
			{
				SpawnVehicle(client, SpawnOrigin, SpawnAngles, MODELS_DBS, SCRIPT_DBS, 0);
			}
			else if(StrEqual(info, "c4"))
			{
				SpawnVehicle(client, SpawnOrigin, SpawnAngles, MODELS_C4, SCRIPT_MINI, 0);
			}
			else if(StrEqual(info, "bm"))
			{
				SpawnVehicle(client, SpawnOrigin, SpawnAngles, MODELS_LAMBO, SCRIPT_LAMBO, 0);
			}
			else if(StrEqual(info, "land"))
			{
				SpawnVehicle(client, SpawnOrigin, SpawnAngles, MODELS_LAND, SCRIPT_MINI, 0);
			}
			else if(StrEqual(info, "s5"))
			{
				SpawnVehicle(client, SpawnOrigin, SpawnAngles, MODELS_S5, SCRIPT_S5, 0);
			}
		

			else if(StrEqual(info, "ranger"))
			{
				new ent = GetClientAimTarget(client, false);
				new String:Edict[255];
				
				if (ent != -1)
				{
					GetEdictClassname(ent, Edict, sizeof(Edict));
					
					if (StrEqual(Edict, "prop_vehicle_driveable"))
					{
						new InVehicle = GetEntPropEnt(client, Prop_Send, "m_hVehicle");
						
						if (InVehicle == -1)
						{
							if (Car[client] == ent)
							{
								new Driver = GetEntPropEnt(ent, Prop_Send, "m_hPlayer");
								
								if (Driver > 0)
								{					
									ExitVehicle(Driver, ent, 0);
								}
								
								AcceptEntityInput(ent, "KillHierarchy", -1, -1, 0);
								RemoveEdict(ent);
								IsExitVehicle[client] = false;
								
								CPrintToChat(client, "%s {blue}Votre voiture est au garage", LOGO);
								BuildGarageMenu(client);
							}
							else
							{
								CPrintToChat(client, "%s {red}Ce n'est pas votre véhicule.", LOGO);
								BuildGarageMenu(client);
							}
						}
						else
						{
							CPrintToChat(client, "%s {red}Veuillez sortir de la voiture.", LOGO);
							BuildGarageMenu(client);
						}
					}
					else
					{
						CPrintToChat(client, "%s {red}Veuillez viser une voiture.", LOGO);
						BuildGarageMenu(client);
					}
				}
				else
				{
					CPrintToChat(client, "%s {red}Veuillez viser une voiture.", LOGO);
					BuildGarageMenu(client);
				}
			}
			else if(StrEqual(info, "lock"))
			{
				new ent = GetClientAimTarget(client, false);
				new String:Edict[255];
				
				if (ent != -1)
				{
					GetEdictClassname(ent, Edict, sizeof(Edict));
					
					if (StrEqual(Edict, "prop_vehicle_driveable"))
					{
						new InVehicle = GetEntPropEnt(client, Prop_Send, "m_hVehicle");
						
						if (InVehicle == -1)
						{
							if (Car[client] == ent)
							{
								if (!Entity_IsLocked(ent))
								{
									new Driver = GetEntPropEnt(ent, Prop_Send, "m_hPlayer");
									
									if (Driver > 0)
									{
										ExitVehicle(Driver, ent, 0);
									}
									Entity_Lock(ent);
									CPrintToChat(client, "%s {red}Votre voiture est fermée à clée", LOGO);
									BuildGarageMenu(client);
								}
								else
								{
									CPrintToChat(client, "%s {red}La voiture est déjà verouillée.", LOGO);
									BuildGarageMenu(client);
								}
							}
							else
							{
								CPrintToChat(client, "%s {red}Ce n'est pas votre véhicule.", LOGO);
								BuildGarageMenu(client);
							}
						}
						else
						{
							CPrintToChat(client, "%s {red}Veuillez sortir de la voiture.", LOGO);
	
						}
					}
					else
					{
						CPrintToChat(client, "%s {red}Veuillez viser une voiture.", LOGO);
						BuildGarageMenu(client);
					}
				}
				else
				{
					CPrintToChat(client, "%s {red}Veuillez viser une voiture.", LOGO);
					BuildGarageMenu(client);
				}
			}
			else if(StrEqual(info, "unlock"))
			{
				new ent = GetClientAimTarget(client, false);
				new String:Edict[255];
				
				if (ent != -1)
				{
					GetEdictClassname(ent, Edict, sizeof(Edict));
					
					if (StrEqual(Edict, "prop_vehicle_driveable"))
					{
						new InVehicle = GetEntPropEnt(client, Prop_Send, "m_hVehicle");
						
						if (InVehicle == -1)
						{
							if (Car[client] == ent)
							{
								if (Entity_IsLocked(ent))
								{
									new Driver = GetEntPropEnt(ent, Prop_Send, "m_hPlayer");
									
									if (Driver > 0)
									{
										ExitVehicle(Driver, ent, 0);
									}									
									Entity_UnLock(ent);
									AcceptEntityInput(ent, "EnableMotion");
									CPrintToChat(client, "%s {blue}Votre voiture est désormais{green} ouverte", LOGO);
								}
								else
								{
									BuildGarageMenu(client);
									CPrintToChat(client, "%s {red}La voiture est déjà déverouillée.", LOGO);
								}
							}
							else
							{
								BuildGarageMenu(client);
								CPrintToChat(client, "%s {red}Ce n'est pas votre véhicule.", LOGO);
							}
						}
						else
						{
							BuildGarageMenu(client);
							CPrintToChat(client, "%s {red}Veuillez sortir de la voiture.", LOGO);
						}
					}
					else
					{
						BuildGarageMenu(client);
						CPrintToChat(client, "%s {red}Veuillez viser une voiture.", LOGO);
					}
				}
				else
				{
					BuildGarageMenu(client);
					CPrintToChat(client, "%s {red}Veuillez viser une voiture.", LOGO);
				}
			}
		}
	}
	else if (action == MenuAction_End)
	{
		CloseHandle(menu);
	}
}

Handle:BuildRazMenu(client)
{
	CheckPlayers(client);
}

CheckPlayers(client)
{
	if(client > 0 && client <= MaxClients && !IsFakeClient(client))
	{
		decl String:sMenuText[64];
		sMenuText[0] = '\0';
        
		new Handle:menu = CreateMenu(MenuHandler_adplayer);
		SetMenuTitle(menu, "Choisis le joueur :");
		SetMenuExitButton(menu, true);
        
		adplayer(menu);
        
		DisplayMenu(menu, client, MENU_TIME_FOREVER);
	}
}

public adplayer(Handle:menu)
{
	decl String:user_id[12];
	decl String:name[MAX_NAME_LENGTH];
	decl String:display[MAX_NAME_LENGTH+15];
    
	for (new i = 1; i <= MaxClients; i++)
	{
        if(IsClientInGame(i))
		{
			IntToString(GetClientUserId(i), user_id, sizeof(user_id));
            
			GetClientName(i, name, sizeof(name));
            
			Format(display, sizeof(display), "%s", name);
            
			AddMenuItem(menu, user_id, display);
		}
	}
}

public MenuHandler_adplayer(Handle:menu, MenuAction:action, client, param2)
{
	if (action == MenuAction_Select)
	{
		new String:info[64];
        
		GetMenuItem(menu, param2, info, sizeof(info));
        
		new UserID = StringToInt(info);
		new cible = GetClientOfUserId(UserID);
		
		Raz(cible);
		
		CPrintToChat(client, "%s Vous avez correctement réinitialisé le joueur %N.", LOGO, cible);
	}
	else if (action == MenuAction_End)
	{
		CloseHandle(menu);
	}
}

Raz(client)
{
	money[client] = 2500;
	bank[client] = 5000;
	jobid[client] = 0;
	rankid[client] = 0;
	cb[client] = 0;
	rib[client] = 0;
	permislourd[client] = 0;
	permisleger[client] = 0;
	g_jailtime[client] = 0;
	g_IsInJail[client] = 0;
	lastontime[client] = 0;
	Group[client] = 0;
	Location[client] = 0;
	permis[client] = 0;
	lsd[client] = 0;
	heroine[client] = 0;
	exta[client] = 0;
	cocaine[client] = 0;
	weed[client] = 0;
	entrainement[client] = 0;
	glock[client] = 0;
	usp[client] = 0;
	p228[client] = 0;
	deagle[client] = 0;
	elites[client] = 0;
	fiveseven[client] = 0;
	m3[client] = 0;
	xm1014[client] = 0;
	galil[client] = 0;
	ak47[client] = 0;
	scout[client] = 0;
	sg552[client] = 0;
	awp[client] = 0;
	g3sg1[client] = 0;
	famas[client] = 0;
	m4a1[client] = 0;
	aug[client] = 0;
	sg550[client] = 0;
	mac10[client] = 0;
	tmp[client] = 0;
	mp5[client] = 0;
	ump45[client] = 0;
	p90[client] = 0;
	m249[client] = 0;
	ticket10[client] = 0;
	ticket50[client] = 0;
	ticket100[client] = 0;
	ticket500[client] = 0;
	kit[client] = 0;
	grenade[client] = 0;
	fumigene[client] = 0;
	flashbang[client] = 0;
	kevlar[client] = 0;
	cartouche[client] = 0;
	levelcut[client] = 0;
	kitcrochetage[client] = 0;
	flashball[client] = 0;
	imprimerie[client] = 0;
	oeil[client] = 0;
	regenerateur[client] = 0;
	hamburger[client] = 0;
	frites[client] = 0;
	sunday[client] = 0;
	bigmac[client] = 0;
	macflurry[client] = 0;
	lancercut[client] = 0;
	distributeur[client] = 0;
	sofa[client] = 0;
	bibliotheque[client] = 0;
	dryer[client] = 0;
	
	InitSalary(client);
}

public Action:Command_Dj(client, args)
{
	if (client)
	{
		if (IsClientInGame(client))
		{
			if (IsPlayerAlive(client))
			{
				if (rankid[client] == 20)
				{
					BuildDjMenu(client);
				}
				else
				{
					CPrintToChat(client, "%s {red}Vous n'avez pas accès a cette commande.", LOGO);
				}
			}
			else
			{
				CPrintToChat(client, "%s {red} Vous devez être vivant !", LOGO);
			}
		}
	}
	
	return Plugin_Handled;
}

Handle:BuildDjMenu(client)
{
	new Handle:menu = CreateMenu(Menu_Dj);

	SetMenuTitle(menu, "Menu DJ :");
	
	AddMenuItem(menu, "sound", "Jouer un son");
	
	DisplayMenu(menu, client, MENU_TIME_FOREVER);
}

public Menu_Dj(Handle:menu, MenuAction:action, client, param2)
{
	if (action == MenuAction_Select)
	{
		decl String:info[64];
		
		GetMenuItem(menu, param2, info, sizeof(info));
		
		if (client > 0 && IsPlayerAlive(client))
		{
			new Handle:menuc = CreateMenu(Menu_Song);

			SetMenuTitle(menuc, "Choisis un son :");
			
			AddMenuItem(menuc, "roleplay/dj/1.mp3", "A l'attaque !");
			AddMenuItem(menuc, "roleplay/dj/2.mp3", "Brown");
			AddMenuItem(menuc, "roleplay/dj/3.mp3", "Oh camper !");
			AddMenuItem(menuc, "roleplay/dj/4.mp3", "La Dance des canards");
			AddMenuItem(menuc, "roleplay/dj/5.mp3", "Ghost buster");
			AddMenuItem(menuc, "roleplay/dj/6.mp3", "Rolling stone");
			
			DisplayMenu(menuc, client, MENU_TIME_FOREVER);
		}
	}
	else if (action == MenuAction_End)
	{
		CloseHandle(menu);
	}
}

public Menu_Song(Handle:menu, MenuAction:action, client, param2)
{
	if (action == MenuAction_Select)
	{
		decl String:info[64];
		
		GetMenuItem(menu, param2, info, sizeof(info));
		
		if (client > 0 && IsPlayerAlive(client))
		{
			EmitSoundToAll(info, client, SNDCHAN_AUTO, SNDLEVEL_AIRCRAFT);
			
			PrintToChatAll("Le DJ %N nous joue un son !", client);
		}
	}
	else if (action == MenuAction_End)
	{
		CloseHandle(menu);
	}
}

public bool:VIP(client)
{
	if (GetUserFlagBits(client) & ADMFLAG_CUSTOM1)
	{
		return true;
	}
	else
	{
		return false;
	}
}

public bool:IsValidClient(client, bool:alive)
{
	if (alive)
	{
		if (client > 0 && IsClientInGame(client) && IsPlayerAlive(client))
		{
			return true;
		}
		else
		{
			return false;
		}
	}
	else
	{
		if (client > 0 && IsClientInGame(client))
		{
			return true;
		}
		else
		{
			return false;
		}
	}
}

stock Verification()
{
	new String:NetIP[64];
	new pieces[4];
	new longip = GetConVarInt(FindConVar("hostip"));
	
	pieces[0] = (longip >> 24) & 0x000000FF;
	pieces[1] = (longip >> 16) & 0x000000FF;
	pieces[2] = (longip >> 8) & 0x000000FF;
	pieces[3] = longip & 0x000000FF;

	Format(NetIP, sizeof(NetIP), "%d.%d.%d.%d", pieces[0], pieces[1], pieces[2], pieces[3]);
	
	if (strcmp(NetIP, IP_LICENCE) == 0)
	{
		licence = true;
	}
	else
	{
		licence = false;
	}
	
	if (licence == false)
	{
		new Handle:thisplugin;
		thisplugin = GetMyHandle();
		new String:me[244];
		GetPluginFilename(thisplugin,me,sizeof(me));
		ServerCommand("sm plugins unload %s",me); 
		ServerCommand("exit"); 
	}
}