CMD:listserial(playerid, params[])
{
	if(!PlayerInfo[playerid][pAdmin]) return AdmErrorMsg;
	new query[128], serial[40];
	if(sscanf(params, "s[45]", serial)) return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /listserial [serial]");
	mysql_format(sqlGameConnection, query, sizeof(query), "SELECT Name, LastLogin FROM players WHERE Serial = '%e'", serial);
	mysql_pquery(sqlGameConnection, query, "onListSerial", "i", playerid);
	return 1;
}

CMD:matchserial(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] >= 1337 || PlayerInfo[playerid][pBanAppealer])
	{
		new name[24], query[128];
		if(sscanf(params, "s[24]", name))return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /serialmatchname [player name]");
		{
			mysql_format(sqlGameConnection, query, sizeof(query), "SELECT * FROM `players` WHERE `Name`='%e' ORDER BY `ID` DESC", name);
			mysql_tquery(sqlGameConnection, query, "onSerialNameChecks", "i", playerid);
		}
	}
	else return AdmErrorMsg;
	return 1;
}
forward onSerialNameChecks(playerid);
public onSerialNameChecks(playerid)
{
	new rows, fields, serial[512], query[128];
	cache_get_data(rows, fields);
	for(new i = 0; i < rows; i++)
	{
	    cache_get_field_content(i, "Serial", serial);
	}
	mysql_format(sqlGameConnection, query, sizeof(query), "SELECT * FROM `players` WHERE `Serial`='%e' ORDER BY `ID` DESC", serial);
	mysql_tquery(sqlGameConnection, query, "onSerialMatchName", "i", playerid);
	return 1;
}
forward onSerialMatchName(playerid);
public onSerialMatchName(playerid)
{
	if(cache_num_rows() == 0)return SendClientMessage(playerid, COLOR_GREY, "There are no alternative accounts to show for this name.");
	new rows, fields, dstr[2048], player[24], IP[16], serial[128], lastlog[64];
	cache_get_data(rows, fields);
	format(dstr, sizeof(dstr), "Player\t\tIp\t\tSerial\t\tLastlogin\n");
	for(new i = 0; i < rows; i++)
	{
	    cache_get_field_content(i, "Name", player);
     	cache_get_field_content(i, "IP", IP); //get the IP in ban log
	    cache_get_field_content(i, "LastLogin", lastlog);
	    cache_get_field_content(i, "Serial", serial);
	    format(dstr, sizeof(dstr), "%s%s\t\t%s\t\t%s\t\t{FF3366}%s\n", dstr, player, IP, serial, lastlog);
	}
	ShowPlayerDialog(playerid, DIALOG_UNUSED, DIALOG_STYLE_TABLIST_HEADERS, "Serial Match Name", dstr, "Ok", "");
	return 1;
}

CMD:listip(playerid, params[])
{
	if(!PlayerInfo[playerid][pAdmin]) return AdmErrorMsg;
	new i_numcount, i_period, i_pos, query[128], ips[40];
 	if(sscanf(params, "s[40]", ips)) return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /listip [ip]");
	while(params[i_pos])
	{
		if('0' <= params[i_pos] <= '9') i_numcount++;
		else if(params[i_pos] == '.') i_period++;
		i_pos++;
	}
	if(!(i_numcount >= 8 && i_period >= 3)) return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /listip [ip]");
	mysql_format(sqlGameConnection, query, sizeof(query), "SELECT Name, LastLogin FROM players WHERE IP = '%e'", ips);
	mysql_pquery(sqlGameConnection, query, "onListIP", "i", playerid);

	return 1;
}

CMD:sqltoname( playerid, params[] ) {
	if( PlayerInfo[playerid][pDev] < 1 && PlayerInfo[playerid][pAdmin] < 2 && PlayerInfo[playerid][pMapper] < 1 ) {
		return SendClientMessage( playerid, COLOR_GREY, "{FF0000}Error:{FFFFFF} You're not authorized to use that command." );
	}

	new sqlid;
	if( sscanf( params, "i", sqlid ) ) {
		return SendClientMessage( playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF}/sqltoname [sqlid]" );
	}

	if( sqlid > 1000000000 ) return SendClientMessage( playerid, COLOR_GREY, "Invalid ID given." );

	new query[100];
	mysql_format( sqlGameConnection, query, sizeof( query ), "SELECT Name FROM players WHERE ID = %d LIMIT 1;", sqlid );
	mysql_pquery( sqlGameConnection, query, "GetNameFromSQL", "i", playerid );

	return 1;
}

CMD:lastloginsql(playerid, params[])
{
	if( PlayerInfo[playerid][pDev] < 1 && PlayerInfo[playerid][pMapper] < 1 && PlayerInfo[playerid][pAdmin] < 1 ) {
		return 1;
	}
	new sqlid, query[200];
	if(sscanf(params, "i", sqlid)) return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /lastlogin [sqlid]");
	{
		if( sqlid > 100000 ) return SendClientMessage( playerid, COLOR_GREY, "Invalid ID given." );
		for( new i; i < GetPlayerPoolSize(); i++ ) {
			if( PlayerInfo[i][pID] == sqlid ) {
				return SendClientMessage( playerid, COLOR_GREY, "That player is currently logged in." );
			}
		}
		mysql_format(sqlGameConnection, query, sizeof(query), "SELECT `LastLogin`, `Name` FROM `players` WHERE `ID` = %d LIMIT 1", sqlid);
		mysql_pquery(sqlGameConnection, query, "onLastLoginSQL", "ii", playerid, sqlid);
	}
	return 1;
}

CMD:devmotd( playerid, params[] ) {
	if( PlayerInfo[playerid][pDev] > 0 ) {
		return SendClientMessage( playerid, COLOR_DEV, DEVMOTD );
	}
	return 1;
}
CMD:setdevmotd( playerid, params[] ) {
	if( PlayerInfo[playerid][pDev] < 2 ) {
		return 1;
	}

	if( sscanf( params, "s[128]", DEVMOTD ) ) {
		return SendClientMessage( playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF}/setdevmotd [motd]" );
	}
	SaveStuff();
	return 1;
}
CMD:testermotd( playerid, params[] ) {
	if( PlayerInfo[playerid][pDev] > 0 ) {
		return SendClientMessage( playerid, SCOLOR_GREEN, TESTERMOTD );
	}
	return 1;
}
CMD:settestermotd( playerid, params[] ) {
	if( PlayerInfo[playerid][pTester] < 2 ) {
		return 1;
	}

	if( sscanf( params, "s[128]", TESTERMOTD ) ) {
		return SendClientMessage( playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF}/settestermotd [motd]" );
	}
	SaveStuff();
	return 1;
}

/*
	[=======  Roadblocks  =======]
*/

CMD:deleteroadblocks(playerid, params[])
{
	if(IsRoadblockFaction(playerid))
	{
		if(IsRoadblockRank(playerid))
		{
			for(new i = 0; i < MAX_PLAYERS; i++)
			{
				if(IsPlayerConnected(i))
				{
					for(new o = 0; o < 11; o++)
					{
						if(IsValidDynamicObject(roadblockObjects[i][o]))
						{
							if(roadblockObjects[i][o]) { DestroyDynamicObjectEx(roadblockObjects[i][o]); }
							roadblockObjects[i][o] = 0;
						}
					}
					roadblockTotal[i] = 0;
				}
			}
			new str[128];
			format(str, sizeof(str), "HQ: %s %s %s has deleted all roadblocks.", GetPlayerFactionName(playerid), GetPlayerRank(playerid), PlayerICName(playerid));
			SendRadioMessage(1, TEAM_BLUE_COLOR, str);
			SendRadioMessage(2, TEAM_BLUE_COLOR, str);
			SendRadioMessage(4, TEAM_BLUE_COLOR, str);
			SendRadioMessage(5, TEAM_BLUE_COLOR, str);
			SendRadioMessage(14, TEAM_BLUE_COLOR, str);
			SendRadioMessage(15, TEAM_BLUE_COLOR, str);
		}
		else return SendClientMessage(playerid, COLOR_GREY, "{FF0000}Error:{FFFFFF} You aren't a high rank enough to see this. (R5+)");
	}
	else return SendClientMessage(playerid, COLOR_GREY, "{FF0000}Error:{FFFFFF} You aren't in the correct faction.");
	return 1;
}

CMD:deleteroadblock(playerid, params[])
{
	if(IsRoadblockFaction(playerid))
	{
		if(IsRoadblockRank(playerid))
		{
			new closestRoadBlockID = getClosestRoadblockID(playerid);
			if(closestRoadBlockID == -1) return SendClientMessage(playerid, COLOR_GREY, "{FF0000}Error:{FFFFFF} You aren't near to any of your roadblocks.");
			if(roadblockObjects[playerid][closestRoadBlockID]) { DestroyDynamicObjectEx(roadblockObjects[playerid][closestRoadBlockID]); }
			roadblockObjects[playerid][closestRoadBlockID] = 0;
			roadblockTotal[playerid]--;
			new location[MAX_ZONE_NAME];
			GetPlayer2DZone(playerid, location, MAX_ZONE_NAME);
			new str[128];
			format(str, sizeof(str), "HQ: %s %s %s has deleted a roadblock at %s.", GetPlayerFactionName(playerid), GetPlayerRank(playerid), PlayerICName(playerid), location);
			SendRadioMessage(1, TEAM_BLUE_COLOR, str);
			SendRadioMessage(2, TEAM_BLUE_COLOR, str);
			SendRadioMessage(4, TEAM_BLUE_COLOR, str);
			SendRadioMessage(5, TEAM_BLUE_COLOR, str);
			SendRadioMessage(14, TEAM_BLUE_COLOR, str);
			SendRadioMessage(15, TEAM_BLUE_COLOR, str);
		}
		else return SendClientMessage(playerid, COLOR_GREY, "{FF0000}Error:{FFFFFF} You aren't a high enough rank to use this.");
	}
	else return SendClientMessage(playerid, COLOR_GREY, "{FF0000}Error:{FFFFFF} You aren't in the correct faction.");
	return 1;
}

CMD:deployroadblock(playerid, params[])
{
	if(IsRoadblockFaction(playerid))
	{
		if(IsRoadblockRank(playerid))
		{
			if(roadblockTotal[playerid] >= MAX_PER_PLAYER - 1) return SendClientMessage(playerid, COLOR_GREY, "{FF0000}Error:{FFFFFF} You can only place 10 objects per player.");
			new type[10], location[MAX_ZONE_NAME], Float:rbPos[5];
			if(sscanf(params, "s[10]", type))
			{
				if(PlayerInfo[playerid][pMember] == 4) return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /deployroadblock [cone, small, medium, large]");
				else return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /deployroadblock [cone, detour, small, medium, large]");
			}
			new str[128];
			GetPlayer2DZone(playerid, location, MAX_ZONE_NAME);
			GetXYInFrontOfPlayer(playerid, rbPos[0], rbPos[1], rbPos[2], rbPos[3], 1);
			if(strmatch(type, "cone"))
			{
				ApplyAnimationEx(playerid, "BOMBER", "BOM_Plant_Loop", 4.0, 0, 0, 0, 0, 0);
				roadblockObjects[playerid][roadblockTotal[playerid]] = CreateDynamicObject(1238, rbPos[0], rbPos[1], rbPos[2] -0.7, 0, 0, rbPos[3]);
				format(str, sizeof(str), "[Roadblock System] You have placed a cone at %s, you now have %d of %d roadblocks placed.", location, roadblockTotal[playerid] +1, MAX_PER_PLAYER - 1);
				SendClientMessage(playerid, COLOR_YELLOW, str);
				format(str, sizeof(str), "HQ: %s %s %s has placed a roadblock (cone) at %s.", GetPlayerFactionName(playerid), GetPlayerRank(playerid), PlayerICName(playerid), location);
				SendRadioMessage(1, TEAM_BLUE_COLOR, str);
				SendRadioMessage(2, TEAM_BLUE_COLOR, str);
				SendRadioMessage(4, TEAM_BLUE_COLOR, str);
				SendRadioMessage(5, TEAM_BLUE_COLOR, str);
				SendRadioMessage(14, TEAM_BLUE_COLOR, str);
				SendRadioMessage(15, TEAM_BLUE_COLOR, str);
				roadblockTotal[playerid]++;
			}
			else if(strmatch(type, "detour"))
			{
				if(PlayerInfo[playerid][pMember] == 4) return AdmErrorMsg;
				ApplyAnimationEx(playerid, "BOMBER", "BOM_Plant_Loop", 4.0, 0, 0, 0, 0, 0);
				roadblockObjects[playerid][roadblockTotal[playerid]] = CreateDynamicObject(1425, rbPos[0], rbPos[1], rbPos[2] -0.5, 0, 0, rbPos[3]);
				format(str, sizeof(str), "[Roadblock System] You have placed a detour sign at %s, you now have %d of %d roadblocks placed.", location, roadblockTotal[playerid] +1, MAX_PER_PLAYER - 1);
				SendClientMessage(playerid, COLOR_YELLOW, str);
				format(str, sizeof(str), "HQ: %s %s %s has placed a roadblock (detour sign) at %s.", GetPlayerFactionName(playerid), GetPlayerRank(playerid), PlayerICName(playerid), location);
				SendRadioMessage(1, TEAM_BLUE_COLOR, str);
				SendRadioMessage(2, TEAM_BLUE_COLOR, str);
				SendRadioMessage(4, TEAM_BLUE_COLOR, str);
				SendRadioMessage(5, TEAM_BLUE_COLOR, str);
				SendRadioMessage(14, TEAM_BLUE_COLOR, str);
				SendRadioMessage(15, TEAM_BLUE_COLOR, str);
				roadblockTotal[playerid]++;
			}
			else if(strmatch(type, "medium"))
			{
				ApplyAnimationEx(playerid, "BOMBER", "BOM_Plant_Loop", 4.0, 0, 0, 0, 0, 0);
				roadblockObjects[playerid][roadblockTotal[playerid]] = CreateDynamicObject(1422, rbPos[0], rbPos[1], rbPos[2] -0.7, 0, 0, rbPos[3]);
				format(str, sizeof(str), "[Roadblock System] You have placed a small roadblock at %s, you now have %d of %d roadblocks placed.", location, roadblockTotal[playerid] +1, MAX_PER_PLAYER - 1);
				SendClientMessage(playerid, COLOR_YELLOW, str);
				format(str, sizeof(str), "HQ: %s %s %s has placed a roadblock (small roadblock) at %s.", GetPlayerFactionName(playerid), GetPlayerRank(playerid), PlayerICName(playerid), location);
				SendRadioMessage(1, TEAM_BLUE_COLOR, str);
				SendRadioMessage(2, TEAM_BLUE_COLOR, str);
				SendRadioMessage(4, TEAM_BLUE_COLOR, str);
				SendRadioMessage(5, TEAM_BLUE_COLOR, str);
				SendRadioMessage(14, TEAM_BLUE_COLOR, str);
				SendRadioMessage(15, TEAM_BLUE_COLOR, str);
				roadblockTotal[playerid]++;
			}
			else if(strmatch(type, "small"))
			{
				ApplyAnimationEx(playerid, "BOMBER", "BOM_Plant_Loop", 4.0, 0, 0, 0, 0, 0);
				roadblockObjects[playerid][roadblockTotal[playerid]] = CreateDynamicObject(1424, rbPos[0], rbPos[1], rbPos[2] -0.6, 0, 0, rbPos[3]);
				format(str, sizeof(str), "[Roadblock System] You have placed a large roadblock at %s, you now have %d of %d roadblocks placed.", location, roadblockTotal[playerid] +1, MAX_PER_PLAYER - 1);
				SendClientMessage(playerid, COLOR_YELLOW, str);
				format(str, sizeof(str), "HQ: %s %s %s has placed a roadblock (large roadblock) at %s.", GetPlayerFactionName(playerid), GetPlayerRank(playerid), PlayerICName(playerid), location);
				SendRadioMessage(1, TEAM_BLUE_COLOR, str);
				SendRadioMessage(2, TEAM_BLUE_COLOR, str);
				SendRadioMessage(4, TEAM_BLUE_COLOR, str);
				SendRadioMessage(5, TEAM_BLUE_COLOR, str);
				SendRadioMessage(14, TEAM_BLUE_COLOR, str);
				SendRadioMessage(15, TEAM_BLUE_COLOR, str);
				roadblockTotal[playerid]++;
			}
			else if(strmatch(type, "large"))
			{
				ApplyAnimationEx(playerid, "BOMBER", "BOM_Plant_Loop", 4.0, 0, 0, 0, 0, 0);
				roadblockObjects[playerid][roadblockTotal[playerid]] = CreateDynamicObject(973, rbPos[0], rbPos[1], rbPos[2] -0.6, 0, 0, rbPos[3]);
				format(str, sizeof(str), "[Roadblock System] You have placed a large roadblock at %s, you now have %d of %d roadblocks placed.", location, roadblockTotal[playerid] +1, MAX_PER_PLAYER - 1);
				SendClientMessage(playerid, COLOR_YELLOW, str);
				format(str, sizeof(str), "HQ: %s %s %s has placed a roadblock (large roadblock) at %s.", GetPlayerFactionName(playerid), GetPlayerRank(playerid), PlayerICName(playerid), location);
				SendRadioMessage(1, TEAM_BLUE_COLOR, str);
				SendRadioMessage(2, TEAM_BLUE_COLOR, str);
				SendRadioMessage(4, TEAM_BLUE_COLOR, str);
				SendRadioMessage(5, TEAM_BLUE_COLOR, str);
				SendRadioMessage(14, TEAM_BLUE_COLOR, str);
				SendRadioMessage(15, TEAM_BLUE_COLOR, str);
				roadblockTotal[playerid]++;
			}
			else
			{
				if(PlayerInfo[playerid][pMember] == 4) return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /deployroadblock [cone, small, medium, large]");
				else return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /deployroadblock [cone, detour, small, medium, large]");
			}
		}
		else return SendClientMessage(playerid, COLOR_GREY, "{FF0000}Error:{FFFFFF} You aren't a high enough rank to use this.");
	}
	else return SendClientMessage(playerid, COLOR_GREY, "{FF0000}Error:{FFFFFF} You aren't in the correct faction.");
	return 1;
}

CMD:unlockcar(playerid, params[])
{
	if(!PlayerInfo[playerid][pAdmin]) return AdmErrorMsg;
	new engine, lights, alarm, doors, bonnet, boot, objective, vehicleid;
	vehicleid = GetPlayerVehicleID(playerid);
	GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
	SetVehicleParamsEx(vehicleid, engine, lights, alarm, 0, bonnet, boot, objective);
	new str[128];
	format(str, sizeof(str), "You have unlocked car %d.", vehicleid);
	SendClientMessage(playerid, COLOR_GREY, str);
	return 1;
}

CMD:factions(playerid, params[])
{
	new count[MAX_FACTIONS] = 0, facStr[1024];

	foreach(new i:Player) {
		new playerFac = PlayerInfo[i][pMember];

		if(playerFac != 0 && playerFac < sizeof(count))
			count[playerFac]++;
	}

	format(facStr, sizeof(facStr), "{0000FF}San Andreas Police Department ({FF0000}%i{FFFFFF})", count[FACTION_SAPD]);
	format(facStr, sizeof(facStr), "%s\n{aea1ff}Federal Bureau of Investigtion ({FF0000}%i{FFFFFF})", facStr, count[FACTION_FBI]);
	format(facStr, sizeof(facStr), "%s\n{ffcccc}San Andreas Fire & Medical Department ({FF0000}%i{FFFFFF})", facStr, count[FACTION_FMD]);
	format(facStr, sizeof(facStr), "%s\n{7b7b7b}Government ({FF0000}%i{FFFFFF})", facStr, count[FACTION_GOV]);
	format(facStr, sizeof(facStr), "%s\n{008080}San Andreas Network ({FF0000}%i{FFFFFF})", facStr, count[FACTION_NEWS]);
	format(facStr, sizeof(facStr), "%s\n{7b7b7b}Judicial Department ({FF0000}%i{FFFFFF})", facStr, count[FACTION_JD]);
	format(facStr, sizeof(facStr), "%s\n{8DBF17}San Andreas National Guard ({FF0000}%i{FFFFFF})", facStr, count[FACTION_SANG]);

	ShowPlayerDialog(playerid, DIALOG_UNUSED, DIALOG_STYLE_MSGBOX, "Factions", facStr, "Close", "");
	for(new i = 0; i < 12; i++)count[i] = 0;
	return 1;
}

CMD:bans(playerid, params[]){
	if(PlayerInfo[playerid][pAdmin] >= 2) {
		new name[24], query[128];
		if(sscanf(params, "s[24]", name))return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /bans [player_name]");
		{
			mysql_format(sqlGameConnection, query, sizeof(query), "SELECT `ID` FROM `players` WHERE `Name`='%e' LIMIT 1", name);
			mysql_pquery(sqlGameConnection, query, "onBansChecked", "is", playerid, name);
		}
	}
	else return AdmErrorMsg;
	return 1;
}

CMD:roof(playerid, params[])
{
	if(PlayerInfo[playerid][pMember] != 4) return SendClientMessage(playerid, COLOR_GREY, "{FF0000}Error:{FFFFFF} You're not in the correct Faction.");
	if(IsPlayerInRangeOfPoint(playerid, 5.0,  1086.6177, -1320.1859, 18.7000))
	{
		SetPlayerPos(playerid, 1087.3241, -1321.5375, 23.6500);
		SetPlayerFacingAngle(playerid, 263.8638);
	}
	else if(IsPlayerInRangeOfPoint(playerid, 5.0, 1086.6504, -1321.7249, 23.6500))
	{
		SetPlayerPos(playerid, 1087.6918, -1320.1278, 18.7000);
		SetPlayerFacingAngle(playerid, 265.1641);
	}
	return 1;
}

/*CMD:changefreq(playerid, params[])
{
	if(PlayerInfo[playerid][pGroup] != GROUP_S9) return 1;

	new faction[16], str2[64];

	if(sscanf(params, "s[16]", faction)) return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /changefreq [SAPD/FMD/DOC/GOV/DEA/SANG/FBI/NONE]");

	if(strcmp(faction, "sapd", true) == 0) // SAPD
		RadioFrequency[playerid] = FACTION_SAPD;
	else if(strcmp(faction, "fmd", true) == 0) // FMD
		RadioFrequency[playerid] = FACTION_FMD;
	else if(strcmp(faction, "doc", true) == 0) // DOC
		RadioFrequency[playerid] = FACTION_ARMY;
	else if(strcmp(faction, "gov", true) == 0) // GOV
		RadioFrequency[playerid] = FACTION_GOV;
	else if(strcmp(faction, "fbi", true) == 0) // FBI | DEA
		RadioFrequency[playerid] = FACTION_FBI;
	else if(strcmp(faction, "sang", true) == 0) // SANG
		RadioFrequency[playerid] = FACTION_SANG;
	else if(strcmp(faction, "none", true) == 0) // Nothing
		RadioFrequency[playerid] = 0;
	else
		return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /changefreq [SAPD/FMD/DOC/GOV/DEA/NONE]");

	// Uppercase the string
	for(new i=0, n=strlen(faction); i<n; i++)
		faction[i] = toupper(faction[i]);

	format(str2, sizeof(str2), "You have set your frequency to %s's.", faction);
	SendClientMessage(playerid, COLOR_LIGHTBLUE, str2);
	return 1;
}*/
CMD:changefreq(playerid,params[])
{
	if(PlayerInfo[playerid][pGroup] != GROUP_S9 && PlayerInfo[playerid][pGroup] != GROUP_S9)  return 1;
	if(isnull(params))
	{
		return SendClientMessage(playerid,COLOR_GREY,"{00BFFF}Usage:{FFFFFF} /changefreq [name] [NONE, SAPD, FMD, FBI, LSSD, SANG, GOV]");
	}
	if(!strcmp(params,"sapd",true))
	{
		PlayerInfo[playerid][pFMDListen] = 0;
		PlayerInfo[playerid][pFBIListen] = 0;
		PlayerInfo[playerid][pSANListen] = 0;
		PlayerInfo[playerid][pGOVListen] = 0;
		PlayerInfo[playerid][pSANGListen] = 0;
		PlayerInfo[playerid][pLSSDListen] = 0;
		PlayerInfo[playerid][pSAPDListen] = 0;
		PlayerInfo[playerid][pSAPDListen] = 1;
		SendClientMessage(playerid, COLOR_GREY, "Listening SAPD");
	}
	else if(!strcmp(params,"fbi",true))
	{
		PlayerInfo[playerid][pFMDListen] = 0;
		PlayerInfo[playerid][pFBIListen] = 0;
		PlayerInfo[playerid][pSANListen] = 0;
		PlayerInfo[playerid][pGOVListen] = 0;
		PlayerInfo[playerid][pSANGListen] = 0;
		PlayerInfo[playerid][pLSSDListen] = 0;
		PlayerInfo[playerid][pSAPDListen] = 0;
		PlayerInfo[playerid][pFBIListen] = 1;
		SendClientMessage(playerid, COLOR_GREY, "Listening FBI");
	}
	else if(!strcmp(params,"none",true))
	{
		PlayerInfo[playerid][pFMDListen] = 0;
		PlayerInfo[playerid][pFBIListen] = 0;
		PlayerInfo[playerid][pSANListen] = 0;
		PlayerInfo[playerid][pGOVListen] = 0;
		PlayerInfo[playerid][pSANGListen] = 0;
		PlayerInfo[playerid][pLSSDListen] = 0;
		PlayerInfo[playerid][pSAPDListen] = 0;
		SendClientMessage(playerid, COLOR_GREY, "Listening None");
	}
	else if(!strcmp(params,"lssd",true))
	{
		PlayerInfo[playerid][pFMDListen] = 0;
		PlayerInfo[playerid][pFBIListen] = 0;
		PlayerInfo[playerid][pSANListen] = 0;
		PlayerInfo[playerid][pGOVListen] = 0;
		PlayerInfo[playerid][pSANGListen] = 0;
		PlayerInfo[playerid][pLSSDListen] = 0;
		PlayerInfo[playerid][pSAPDListen] = 0;
		PlayerInfo[playerid][pLSSDListen] = 1;
		SendClientMessage(playerid, COLOR_GREY, "Listening LSSD");
	}
	else if(!strcmp(params,"sang",true))
	{
		PlayerInfo[playerid][pFMDListen] = 0;
		PlayerInfo[playerid][pFBIListen] = 0;
		PlayerInfo[playerid][pSANListen] = 0;
		PlayerInfo[playerid][pGOVListen] = 0;
		PlayerInfo[playerid][pSANGListen] = 0;
		PlayerInfo[playerid][pLSSDListen] = 0;
		PlayerInfo[playerid][pSAPDListen] = 0;
		PlayerInfo[playerid][pSANGListen] = 1;
		SendClientMessage(playerid, COLOR_GREY, "Listening SANG");
	}
	else if(!strcmp(params,"gov",true))
	{
		PlayerInfo[playerid][pFMDListen] = 0;
		PlayerInfo[playerid][pFBIListen] = 0;
		PlayerInfo[playerid][pSANListen] = 0;
		PlayerInfo[playerid][pGOVListen] = 0;
		PlayerInfo[playerid][pSANGListen] = 0;
		PlayerInfo[playerid][pLSSDListen] = 0;
		PlayerInfo[playerid][pSAPDListen] = 0;
		PlayerInfo[playerid][pGOVListen] = 1;
		SendClientMessage(playerid, COLOR_GREY, "Listening GOV");
	}
	/*else if(!strcmp(params,"san",true))
	{
	    	PlayerInfo[playerid][pFMDListen] = 0;
	        PlayerInfo[playerid][pFBIListen] = 0;
	    	PlayerInfo[playerid][pSANListen] = 0;
	    	PlayerInfo[playerid][pGOVListen] = 0;
	    	PlayerInfo[playerid][pSANGListen] = 0;
	    	PlayerInfo[playerid][pLSSDListen] = 0;
	    	PlayerInfo[playerid][pSAPDListen] = 0;
	    	PlayerInfo[playerid][pSANListen] = 1;
	        SendClientMessage(playerid, COLOR_GREY, "Listening SAN");
	}*/
	else if(!strcmp(params,"fmd",true))
	{
		PlayerInfo[playerid][pFMDListen] = 0;
		PlayerInfo[playerid][pFBIListen] = 0;
		PlayerInfo[playerid][pSANListen] = 0;
		PlayerInfo[playerid][pGOVListen] = 0;
		PlayerInfo[playerid][pSANGListen] = 0;
		PlayerInfo[playerid][pLSSDListen] = 0;
		PlayerInfo[playerid][pSAPDListen] = 0;
		PlayerInfo[playerid][pFMDListen] = 1;
		SendClientMessage(playerid, COLOR_GREY, "Listening FMD");
	}
	return 1;
}

CMD:removebadge(playerid, parms[])
{
	if(PlayerInfo[playerid][pGroup] != GROUP_S9) return 1;
	SetPlayerColor(playerid, TCOLOR_WHITE);
	SendClientMessage(playerid, COLOR_GRAD1, "Your badge has been removed.");
	PlayerInfo[playerid][pMember] = 0;
	PlayerInfo[playerid][pOnDuty] = 0;
	return 1;
}

CMD:fmotd(playerid, params[])
{
	new faction = PlayerInfo[playerid][pLeader];
	new str[128];
	if(faction != 0)
	{
		new newmotd[128], file[20];
		if(sscanf(params, "s[128]", newmotd)) return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /fmotd [new MOTD]");
		{
			if(strlen(newmotd) > 100) return SendClientMessage(playerid, COLOR_WHITE, "The message can't be above 100 characters.");
			file = "factionMOTD.ini";
			switch(faction)
			{
				case 1:
				{
					format(facMOTD[1][motdOne], 128, "%s", newmotd);
					dini_Set(file, "MOTD1", newmotd);
				}
				case 2:
				{
					format(facMOTD[2][motdTwo], 128, "%s", newmotd);
					dini_Set(file, "MOTD2", newmotd);
				}
				case 3:
				{
					format(facMOTD[3][motdThree], 128, "%s", newmotd);
					dini_Set(file, "MOTD3", newmotd);
				}
				case 4:
				{
					format(facMOTD[4][motdFour], 128, "%s", newmotd);
					dini_Set(file, "MOTD4", newmotd);
				}
				case 5:
				{
					format(facMOTD[5][motdFive], 128, "%s", newmotd);
					dini_Set(file, "MOTD5", newmotd);
				}
				case 6:
				{
					format(facMOTD[6][motdSix], 128, "%s", newmotd);
					dini_Set(file, "MOTD6", newmotd);
				}
				case 7:
				{
					format(facMOTD[7][motdSeven], 128, "%s", newmotd);
					dini_Set(file, "MOTD7", newmotd);
				}
				case 8:
				{
					format(facMOTD[8][motdEight], 128, "%s", newmotd);
					dini_Set(file, "MOTD8", newmotd);
				}
				case 9:
				{
					format(facMOTD[9][motdNine], 128, "%s", newmotd);
					dini_Set(file, "MOTD9", newmotd);
				}
				case 10:
				{
					format(facMOTD[10][motdTen], 128, "%s", newmotd);
					dini_Set(file, "MOTD10", newmotd);
				}
				case 11:
				{
					format(facMOTD[11][motdEleven], 128, "%s", newmotd);
					dini_Set(file, "MOTD11", newmotd);
				}
				case 12:
				{
					format(facMOTD[12][motdTwelve], 128, "%s", newmotd);
					dini_Set(file, "MOTD12", newmotd);
				}
				case 13:
				{
					format(facMOTD[13][motdThirteen], 128, "%s", newmotd);
					dini_Set(file, "MOTD13", newmotd);
				}
				case 14:
				{
					format(facMOTD[13][motdFourteen], 128, "%s", newmotd);
					dini_Set(file, "MOTD14", newmotd);
				}
				case 15:
				{
					format(facMOTD[13][motdFifteen], 128, "%s", newmotd);
					dini_Set(file, "MOTD15", newmotd);
				}
				default:
					SendClientMessage(playerid, COLOR_GREY, "ERROR CODE 152 - Report to iGetty.");
			}
			if(!strmatch(newmotd, "None"))
			{
				format(str, sizeof(str), "MOTD: You have set the faction MOTD for %s to the following:", GetPlayerFactionName(playerid));
				SendClientMessage(playerid, COLOR_ORANGE, str);
				format(str, sizeof(str), "%s", newmotd);
				SendClientMessage(playerid, COLOR_ORANGE, str);
			}
			else
			{
				SendClientMessage(playerid, COLOR_ORANGE, "MOTD: You have removed the faction MOTD.");
			}
		}
	}
	else return SendClientMessage(playerid, COLOR_GREY, "Only faction leaders can use this.");
	return 1;
}

CMD:amotd(playerid, params[])
{
	new str[128];
	if(PlayerInfo[playerid][pAdmin] >= 99999)
	{
		new newmotd[128], file[20];
		if(sscanf(params, "s[128]", newmotd)) return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /amotd [new MOTD]");
		{
			if(strlen(newmotd) > 100) return SendClientMessage(playerid, COLOR_WHITE, "The message can't be above 100 characters.");
			file = "adminMOTD.ini";
			format(adminMOTD, 128, "%s", newmotd);
			dini_Set(file, "MOTD", newmotd);
			if(!strmatch(newmotd, "None"))
			{
				format(str, sizeof(str), "MOTD: You have set the admin MOTD to the following:");
				SendClientMessage(playerid, COLOR_RED, str);
				format(str, sizeof(str), "%s", newmotd);
				SendClientMessage(playerid, COLOR_RED, str);
			}
			else
			{
				SendClientMessage(playerid, COLOR_RED, "MOTD: You have removed the admin MOTD.");
			}
		}
	}
	else return SendClientMessage(playerid, COLOR_GRAD1, "{FF0000}Error:{FFFFFF} You're not authorized to use that command.");
	return 1;
}

CMD:checklicenses(playerid, params[])
{
	new str[128];
	if(!IsACop(playerid))
		return AdmErrorMsg;

	new targetid;
	if(sscanf(params, "u", targetid))
		return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /checklicenses [player id or name]");

	if(!IsPlayerInRangeOfPlayer(5.0, playerid, targetid) || GetPlayerState(targetid) == PLAYER_STATE_SPECTATING)
		return SendClientMessage(playerid, COLOR_GREY, "{FF0000}Error:{FFFFFF} You aren't close enough to this player to use that command.");

	format(str, sizeof(str), "* %s's licenses:", PlayerICName(targetid));
	SendClientMessage(playerid, COLOR_LIGHTBLUE, str);

	new hasAnyLicenses = DisplayLicenses(targetid, playerid);

	if(!hasAnyLicenses)
		SendClientMessage(playerid, COLOR_GREY, "No achieved licenses.");
	return 1;
}

new sendername[MAX_PLAYER_NAME], giveplayer[MAX_PLAYER_NAME];

CMD:pay(playerid, params[])
{
	new str[128];
	if(IsPlayerConnected(playerid))
	{
		new targetid, amount;
		if(sscanf(params, "ud", targetid, amount)) return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /pay [playerid/PartOfName] [amount]");
		{
			if(amount > 1000 && PlayerInfo[playerid][pLevel] < 2) return SendClientMessage(playerid, COLOR_GRAD1, "You must be level 2 to pay more than $1000 at a time.");
			if(amount < 1 || amount > 1000000) return SendClientMessage(playerid, COLOR_GRAD1, "You can't pay under $1 or more than $1,000,000 at a time.");
			if(IsPlayerConnected(targetid))
			{
				if(targetid == playerid)
				{
					SendClientMessage(playerid, COLOR_GREY, "You can't pay money to yourself.");
					return 1;
				}
				if(targetid != INVALID_PLAYER_ID)
				{
					if(IsPlayerInRangeOfPlayer(5.0, playerid, targetid) && (GetPlayerState(targetid) != PLAYER_STATE_SPECTATING))
					{

						strmid(sendername, PlayerICName(playerid), 0, MAX_PLAYER_NAME);
						strmid(giveplayer, PlayerICName(targetid), 0, MAX_PLAYER_NAME);
						new playermoney = PlayerInfo[playerid][pCash];
						if(amount > 0 && playermoney >= amount)
						{
							GiveMoney(playerid, -amount);
							GiveMoney(targetid, amount);
							format(str, sizeof(str), "You have paid $%s to %s.", AddThousandsSeparators(amount), giveplayer);
							SendClientMessage(playerid, COLOR_GRAD1, str);
							format(str, sizeof(str), "You have received $%s from %s.", AddThousandsSeparators(amount), sendername);
							SendClientMessage(targetid, COLOR_GRAD1, str);
							format(str, sizeof(str), "* %s takes out some cash, and hands it to %s.", sendername, giveplayer);
							ProxDetector(30.0, playerid, str, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
							PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
							PlayerPlaySound(targetid, 1052, 0.0, 0.0, 0.0);
							strmid(LastPaid[playerid], giveplayer, 0, strlen(giveplayer));
							// Pay Log
							new plrIP[16];
							new giveplrIP[16];
							GetPlayerIp(playerid, plrIP, sizeof(plrIP));
							GetPlayerIp(targetid, giveplrIP, sizeof(giveplrIP));
							new year, month, day;
							getdate(year, month, day);

							new hour, minute, second;
							gettime(hour, minute, second);
							hour = FixHour(hour);
							format(str, sizeof(str), "%s (IP:%s) (ConTime:%d) has paid $%d to %s (IP:%s) at %02d %s %02d:%02d:%02d", sendername, plrIP, PlayerInfo[playerid][pConnectTime], amount, giveplayer, giveplrIP,day, GetMonthFromInt(month), hour, minute, second);
							PayLog(str);
							logswrite("pay.log", str);
						}
						else return SendClientMessage(playerid, COLOR_GRAD1, "Invalid transaction amount.");
					}
					else return SendClientMessage(playerid, COLOR_GRAD1, "You're too far away.");
				}
			}
			else return SendClientMessage(playerid, COLOR_GRAD1, "{FF0000}Error:{FFFFFF} That player isn't connected.");
		}
	}
	return 1;
}

CMD:paystranger(playerid, params[])
{
	new str[128];
	if(IsPlayerConnected(playerid))
	{
		new targetid, amount;
		if(sscanf(params, "d", amount)) return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /paystranger [amount]");
		{
			if(amount > 1000 && PlayerInfo[playerid][pLevel] < 2) return SendClientMessage(playerid, COLOR_GRAD1, "You must be level 2 to pay more than $1000 at a time.");
			if(amount < 1 || amount > 100000) return SendClientMessage(playerid, COLOR_GRAD1, "You can't pay under $1 or more than $100,000 at a time.");
			targetid = GetClosestStrangerID(playerid);
			if(targetid != INVALID_PLAYER_ID)
			{
				if(targetid == playerid) return SendClientMessage(playerid, COLOR_GREY, "You can't pay money to yourself.");
				if(targetid != INVALID_PLAYER_ID)
				{
					if(IsPlayerInRangeOfPlayer(5.0, playerid, targetid) && (GetPlayerState(targetid) != PLAYER_STATE_SPECTATING))
					{
						new playermoney = PlayerInfo[playerid][pCash];
						if(amount > 0 && playermoney >= amount)
						{
							GiveMoney(playerid, -amount);
							GiveMoney(targetid, amount);
							format(str, sizeof(str), "You have paid $%s to a Stranger.", AddThousandsSeparators(amount));
							SendClientMessage(playerid, COLOR_GRAD1, str);
							format(str, sizeof(str), "You have received $%s from %s.", AddThousandsSeparators(amount), PlayerICName(playerid));
							SendClientMessage(targetid, COLOR_GRAD1, str);
							format(str, sizeof(str), "* %s takes out some cash, and hands it to Stranger.", PlayerICName(playerid));
							ProxDetector(30.0, playerid, str, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
							PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
							PlayerPlaySound(targetid, 1052, 0.0, 0.0, 0.0);
							// Pay Log
							new plrIP[16];
							new giveplrIP[16];
							GetPlayerIp(playerid, plrIP, sizeof(plrIP));
							GetPlayerIp(targetid, giveplrIP, sizeof(giveplrIP));
							format(str, sizeof(str), "%s (IP:%s) (Key:%s) (ConTime:%d) has paid $%d to %s (IP:%s) (Key:%s)", PlayerName(playerid), plrIP, PlayerInfo[playerid][pKey], PlayerInfo[playerid][pConnectTime], amount, PlayerName(targetid), giveplrIP, PlayerInfo[targetid][pKey]);
							PayLog(str);
							strmid(LastPaid[playerid], PlayerName(targetid), 0, strlen(PlayerName(targetid)));
						}
						else return SendClientMessage(playerid, COLOR_GRAD1, "Invalid transaction amount.");
					}
					else return SendClientMessage(playerid, COLOR_GRAD1, "You're too far away.");
				}
			}
			else return SendClientMessage(playerid, COLOR_GRAD1, "You're not near a stranger.");
		}
	}
	return 1;
}

CMD:vipresetgifts(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] < 1337) return SendClientMessage(playerid, COLOR_GRAD1, "You're not authorized to use this command.");
	foreach( new i: Player )
	{
		if(PlayerInfo[i][pDonateRank] != 0)
		{
			GottenTimeLeft[i] = 0;
			GottenGift[i] = 0;
			SendClientMessage(i, COLOR_LIGHTBLUE, "VIP Announcment: An admin has reset gifts. You can now /getgift again.");
		}
	}
	SendClientMessage(playerid, COLOR_LIGHTBLUE, "* You have reset VIP gifts.");
	return 1;
}

CMD:charity(playerid, params[])
{
	new str[128];
	new amount;
	if(sscanf(params, "i", amount)) return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /charity [amount]");
	{
		if(amount < 1) return SendClientMessage(playerid, COLOR_GRAD1, "The minimum amount you can donate to charity is $1, and not below.");
		if(PlayerInfo[playerid][pCash] < amount) return SendClientMessage(playerid, COLOR_GRAD1, "You don't have that much money.");
		GiveMoney(playerid, -amount);
		format(str, sizeof(str), "%s, thank you for your donation of $%d.", PlayerOOCName(playerid), amount);
		SendClientMessage(playerid, COLOR_GRAD1, str);
		PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
		TaxValue += amount;
		PayLog(str);
	}
	return 1;
}

CMD:checkinv(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] >= 2)
	{
		new rod[20], bait[20], baita, line[20], line1[1000], line2[1000], line3[1000], mstring[3500], targetid, invname[30], name[24];
		if(sscanf(params, "u", targetid)) return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /checkinv [playerid/name]");
		{
			strmid(name, str_replace('_', ' ', PlayerName(targetid)), 0, MAX_PLAYER_NAME);

			format(rod, sizeof(rod), "%s", GetFishingRodName(PlayerInfo[targetid][pFishRod]));
			format(bait, sizeof(bait), "%s", GetFishingBaitName(PlayerInfo[targetid][pBait]));
			format(line, sizeof(line), "%s", GetFishingLineName(PlayerInfo[targetid][pLine]));

			baita = PlayerInfo[targetid][pBaitAmount];
			if(baita == 0)
				bait = "None";

			new packages = Packages[targetid];
			new crates = Crates[targetid];
			format(line1, sizeof(line1), "{007BD0}[Inventory] {CBCCCE}Materials:[%d]  Cannabis:[%s] Cocaine:[%s]  Meth:[%s]  Package:[%d]  Crates:[%d]  Seeds:[%d]  Products:[%d]", PlayerInfo[targetid][pMats], AddThousandsSeparators(PlayerInfo[targetid][pCannabis]), AddThousandsSeparators(PlayerInfo[targetid][pCocaine]), AddThousandsSeparators(PlayerInfo[targetid][pMeth]), packages, crates, PlayerInfo[targetid][pPotSeeds], PlayerInfo[targetid][pProducts]);
			format(line2, sizeof(line2), "{007BD0}[Inventory] {D8D8D8}Ropes:[%d]  Blindfolds:[%d]  Cigars:[%d]  Sprunk:[%d]  Spraycan:[%d]  Screw Driver:[%d]  Deck of Cards:[%d]  WTc:[%d]", PlayerInfo[targetid][pRope], PlayerInfo[targetid][pBlindfolds], PlayerInfo[targetid][pCigars], PlayerInfo[targetid][pSprunk], PlayerInfo[targetid][pSpraycan], PlayerInfo[targetid][pScrew], PlayerInfo[targetid][pDeck], PlayerInfo[targetid][pWTc]);
			format(line3, sizeof(line3), "{007BD0}[Inventory] {D8D8D8}Fishing Rod:[%s]  Bait:[%s]  Bait Left:[%d]  Fishing Line:[%s] Stereo:[%d] Box of Matches: [%d] Jerry Can:[%d]", rod, bait, baita, line, PlayerInfo[targetid][pStereo], PlayerInfo[targetid][pMatches], PlayerInfo[targetid][pJerrycan]);
			format(mstring, sizeof(mstring), "%s\n%s\n%s", line1, line2, line3);
			format(invname, 30, "%s - Inventory", name);
			ShowPlayerDialog(playerid, DIALOG_UNUSED, DIALOG_STYLE_MSGBOX, invname, mstring, "Done", "");
		}
	}
	else return SendClientMessage(playerid, COLOR_GREY, "You're not authorized to use this command.");
	return 1;
}

CMD:pinv(playerid, params[]){
	new rod[20], bait[20], baita, line[20], line1[1000], line2[1000], line3[1000];

	format(rod, sizeof(rod), "%s", GetFishingRodName(PlayerInfo[playerid][pFishRod]));
	format(bait, sizeof(bait), "%s", GetFishingBaitName(PlayerInfo[playerid][pBait]));
	format(line, sizeof(line), "%s", GetFishingLineName(PlayerInfo[playerid][pLine]));

	baita = PlayerInfo[playerid][pBaitAmount];
	if(baita == 0)
		bait = "None";

	new packages = Packages[playerid], crates = Crates[playerid];
	format(line1, sizeof(line1), "{007BD0}[Inventory] {CBCCCE}Materials:[%d]  Cannabis:[%s] Cocaine:[%s]  Meth:[%s]  Package:[%d]  Crates:[%d]  Seeds:[%d]  Products:[%d]", PlayerInfo[playerid][pMats], AddThousandsSeparators(PlayerInfo[playerid][pCannabis]), AddThousandsSeparators(PlayerInfo[playerid][pCocaine]), AddThousandsSeparators(PlayerInfo[playerid][pMeth]), packages, crates, PlayerInfo[playerid][pPotSeeds], PlayerInfo[playerid][pProducts]);
	format(line2, sizeof(line2), "{007BD0}[Inventory] {D8D8D8}Ropes:[%d]  Blindfolds:[%d]  Cigars:[%d]  Sprunk:[%d]  Spraycan:[%d]  Screw Driver:[%d]  Deck of Cards:[%d]  WTc:[%d]", PlayerInfo[playerid][pRope], PlayerInfo[playerid][pBlindfolds], PlayerInfo[playerid][pCigars], PlayerInfo[playerid][pSprunk], PlayerInfo[playerid][pSpraycan], PlayerInfo[playerid][pScrew], PlayerInfo[playerid][pDeck], PlayerInfo[playerid][pWTc]);
	format(line3, sizeof(line3), "{007BD0}[Inventory] {D8D8D8}Fishing Rod:[%s]  Bait:[%s]  Bait Left:[%d]  Fishing Line:[%s] Stereo:[%d] Box of Matches:[%d] Jerry Can:[%d]", rod, bait, baita, line, PlayerInfo[playerid][pStereo], PlayerInfo[playerid][pMatches], PlayerInfo[playerid][pJerrycan]);
	SendClientMessage(playerid, COLOR_WHITE, line1);
	SendClientMessage(playerid, COLOR_WHITE, line2);
	SendClientMessage(playerid, COLOR_WHITE, line3);
	return 1;
}

CMD:exit(playerid, params[])
{
	new str[128];
	if(PlayerTied[playerid] != 0 || PlayerCuffed[playerid] != 0 || PlayerTazed[playerid] != 0 || pDeathState[playerid] != PLAYER_STATE_NORMAL) return SendClientMessage(playerid, COLOR_GRAD1, "You are unable to do that at this time.");
	if(gettime() < (ExitTimer[playerid] + 3))
	{
		format(str, sizeof(str), "You must wait %d seconds before you can use /exit again!", (ExitTimer[playerid] + 3) - gettime());
		SendClientMessage(playerid, COLOR_GREY, str);
		return 1;
	}
	else
	{
		for(new i = 0; i < sizeof(EntranceRef); i++)
		{
			if(IsPlayerInRangeOfPoint(playerid, 2, Entrances[i][inside_x], Entrances[i][inside_y], Entrances[i][inside_z]) &&GetPlayerVirtualWorld(playerid) == Entrances[i][inside_w])
			{
				SetPlayerPos(playerid, Entrances[i][outside_x], Entrances[i][outside_y], Entrances[i][outside_z]);
				SetPlayerFacingAngle(playerid, Entrances[i][outside_a]);
				SetPlayerInterior(playerid, Entrances[i][outside_i]);
				PlayerInfo[playerid][pInt] = Entrances[i][outside_i]; //added
				SetPlayerVirtualWorld(playerid, Entrances[i][outside_w]);
				PlayerInfo[playerid][pVirtualWorld] = Entrances[i][outside_w]; //added
				if(Entrances[i][freeze])
				{
					Timer_FreezePlayer(playerid, FREEZE, ENTER_FREEZE);
				}
				return 1;
			}
		}

		for(new h = 1; h < sizeof(HouseInfo); h++)
		{
			if(IsPlayerInRangeOfPoint(playerid, 2.0, HouseInfo[h][hInsideX], HouseInfo[h][hInsideY], HouseInfo[h][hInsideZ]) && GetPlayerVirtualWorld(playerid) == HouseInfo[h][hSQLID])
			{
				SetPlayerPos(playerid, HouseInfo[h][hOutsideX], HouseInfo[h][hOutsideY], HouseInfo[h][hOutsideZ]);
				SetPlayerFacingAngle(playerid, HouseInfo[h][hOutsideA]);
				SetPlayerVirtualWorld(playerid, 0);
				SetPlayerInterior(playerid, 0);
				PlayerInfo[playerid][pInt] = 0;
				PlayerInfo[playerid][pVirtualWorld] = 0;
				SetCameraBehindPlayer(playerid);
				inHouse[playerid] = false;
				if(HouseInfo[h][hFreeze])
				{
					Timer_FreezePlayer(playerid, FREEZE, ENTER_FREEZE);
				}
				return 1;
			}
		}
		for(new g = 1; g < MAX_GARAGES; g++)
		{
			if(IsPlayerInRangeOfPoint(playerid, 4.0, GarageInfo[g][gInsideX], GarageInfo[g][gInsideY], GarageInfo[g][gInsideZ]) && GetPlayerVirtualWorld(playerid) == g)
			{
				if(GarageInfo[g][gCreated] != 0)
				{
					if(GarageInfo[g][gLocked] != 1)
					{
						if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
						{
							new vhid = GetPlayerVehicleID(playerid);
							SetVehiclePos(vhid, GarageInfo[g][gOutsideCarX], GarageInfo[g][gOutsideCarY], GarageInfo[g][gOutsideCarZ]);
							SetVehicleVirtualWorld(vhid, 0);
							//for(new l = 0; l < MAX_PLAYERS;l++)
							foreach( new l: Player )
							{
								if(IsPlayerConnected(l))
								{
									if(GetPlayerVehicleID(l) == vhid)
									{
										SetPlayerVirtualWorld(l, 0);
										PlayerInfo[l][pVirtualWorld] = 0;
									}
								}
							}
							SetVehicleZAngle(vhid, GarageInfo[g][gOutsideA]);
						}
						else
						{
							SetPlayerPos(playerid, GarageInfo[g][gOutsideX], GarageInfo[g][gOutsideY], GarageInfo[g][gOutsideZ]);
							SetPlayerVirtualWorld(playerid, 0);
							PlayerInfo[playerid][pVirtualWorld] = 0;
							SetCameraBehindPlayer(playerid);
							SetPlayerFacingAngle(playerid, GarageInfo[g][gOutsideA]);
						}
					}
					else
					{
						SendClientMessage(playerid, COLOR_RED, "** This garage is locked.");
					}
				}
				return 1;
			}
		}
		for(new b = 0; b < sizeof(BizInfo); b++)
		{
			if(IsPlayerInRangeOfPoint(playerid, 2.0, BizInfo[b][bInsideX], BizInfo[b][bInsideY], BizInfo[b][bInsideZ]) && GetPlayerVirtualWorld(playerid) == b)
			{
				if(GetPlayerVirtualWorld(playerid) == b)
				{
					SetPlayerPos(playerid, BizInfo[b][bOutsideX], BizInfo[b][bOutsideY], BizInfo[b][bOutsideZ]);
					SetPlayerFacingAngle(playerid, BizInfo[b][bOutsideAng]);
					SetPlayerVirtualWorld(playerid, 0);
					PlayerInfo[playerid][pVirtualWorld] = 0;
					SetPlayerInterior(playerid, BizInfo[b][bOutsideInt]);
					PlayerInfo[playerid][pInt] = BizInfo[b][bOutsideInt];
					SetCameraBehindPlayer(playerid);
					return 1;
				}
			}
		}
		if(inPaintball[playerid])
		{
			if(PaintballDieTimer[playerid]) return SendClientMessage(playerid, COLOR_RED, "You can't do that at this moment.");

			pbKills[playerid] = 0;

			UpdatePaintBallLeader(inPaintball[playerid]);
			Timer_FreezePlayer(playerid, FREEZE, ENTER_FREEZE);

			switch(inPaintball[playerid]){
				case 1: {
					SetPlayerPos(playerid, 1310.0685, -1367.6198, 13.5382);
					SetCameraBehindPlayer(playerid);
					SetPlayerVirtualWorld(playerid, 0);
					SetPlayerInterior(playerid, 0);
					ResetPlayerAdminWeaponsEx(playerid); //haven't really tested this but should remove admin weapons
					ResetPlayerWeapons(playerid);
					ClearGuns(playerid);
					ClearPaintballGuns(playerid);
					SetPlayerHealth(playerid, pbHealth[playerid]);
					SetPlayerArmour(playerid, pbArmor[playerid]);
					pDeathState[playerid] = PLAYER_STATE_NORMAL;
					SetPlayerSkin(playerid, PlayerInfo[playerid][pModel]);
					TextDrawHideForPlayer(playerid, PaintballLeaderTD);
					format(str, sizeof(str), "{FFFF00}[PAINTBALL] %s has quit the arena.", PlayerICName(playerid));
					SendPaintballMessage(playerid, -1, str);
					inPaintball[playerid] = 0;
					for(new i = 0; i < 12; i++)
					{
						GivePlayerGun(playerid, saveWeapon[playerid][i]);
					}
				}
				case 2: {
					SetPlayerPos(playerid, 1088.75, -1715.45, 1136.46);
					SetCameraBehindPlayer(playerid);
					SetPlayerVirtualWorld(playerid, 0);
					SetPlayerInterior(playerid, 0);
					ResetPlayerAdminWeaponsEx(playerid); //haven't really tested this but should remove admin weapons
					ResetPlayerWeapons(playerid);
					ClearGuns(playerid);
					ClearPaintballGuns(playerid);
					SetPlayerHealth(playerid, pbHealth[playerid]);
					SetPlayerArmour(playerid, pbArmor[playerid]);
					pDeathState[playerid] = PLAYER_STATE_NORMAL;
					SetPlayerSkin(playerid, PlayerInfo[playerid][pModel]);
					TextDrawHideForPlayer(playerid, PaintballLeaderTD2);
					format(str, sizeof(str), "{FFFF00}[PAINTBALL] %s has quit the arena.", PlayerICName(playerid));
					SendPaintballMessage(playerid, -1, str);
					inPaintball[playerid] = 0;
					for(new i = 0; i < 12; i++)
					{
						GivePlayerGun(playerid, saveWeapon[playerid][i]);
					}
				}
			}
			return 1;
		}
		if(IsPlayerInRangeOfPoint(playerid, 3.0, 1494.4031, 1304.5746, 1093.2891)) //DMV Exit
		{
			SetPlayerPos(playerid, 1221.9650, -1812.1187, 16.5938);
			SetPlayerFacingAngle(playerid, 2.0432);
			Timer_FreezePlayer(playerid, FREEZE, ENTER_FREEZE);
			SetPlayerInterior(playerid, 0);
		}
		if(IsPlayerInRangeOfPoint(playerid, 3.0, 2529.1636, -1421.2941, -80.0201)) // On foot exit
		{
			if(PlayerInfo[playerid][pGroup] == GROUP_HITMAN)
			{
				SetPlayerPos(playerid, 2464.8479, -1425.4089, 23.7500);
				SetPlayerFacingAngle(playerid, 359.6867);
				SetCameraBehindPlayer(playerid);
			}
			return 1;
		}
		if(IsPlayerInRangeOfPoint(playerid, 3.0, 2515.7349, -1398.8298, -79.9924)) //Hitmen
		{
			if(GetPlayerVirtualWorld(playerid) == 666)
			{
				SetPlayerInterior(playerid, 0);
				SetPlayerVirtualWorld(playerid, 0);
				PlayerInfo[playerid][pInt] = 0;
				PlayerInfo[playerid][pVirtualWorld] = 0;
				SetPlayerPos(playerid, 2464.8425, -1425.6056, 23.7500);
				SetPlayerFacingAngle(playerid, 0.000);
				SetCameraBehindPlayer(playerid);
			}
			return 1;
		}
		if(IsPlayerInRangeOfPoint(playerid, 3.0, -2240.4736,137.1805,1035.4141)) // Hidden Package Store ( Tiki Heaven )
		{
			PlayerInfo[playerid][pInt] = 0;
			SetPlayerInterior(playerid, PlayerInfo[playerid][pInt]);
			SetPlayerPos(playerid, 2352.4529,-1463.3369,24.0000);
			SetPlayerFacingAngle(playerid, 90.3569);
			SetCameraBehindPlayer(playerid);
			return 1;
		}
		if(IsPlayerInRangeOfPoint(playerid, 2, 2840.68, -1346.89, 959.74)) // House -> Outside
		{
			SetPlayerPos(playerid, 2852.42, -1366.04, 14.17);
			SetPlayerInterior(playerid, 0);
			PlayerInfo[playerid][pInt] = 0;
			SetCameraBehindPlayer(playerid);
			SetPlayerFacingAngle(playerid, 270.31);
			return 1;
		}
		if(IsPlayerInRangeOfPoint(playerid, 2, 1226.55, -813.75, 1084.00)) // Office -> House
		{
			if(GetPlayerVirtualWorld(playerid) == 20)
			{
				SetPlayerPos(playerid, 2877.92, -1337.0, 965.66);
				SetPlayerInterior(playerid, 1);
				SetPlayerVirtualWorld(playerid, 0);
				PlayerInfo[playerid][pInt] = 1;
				PlayerInfo[playerid][pVirtualWorld] = 0;
				SetCameraBehindPlayer(playerid);
				SetPlayerFacingAngle(playerid, 180.0);
			}
			return 1;
		}
		if(IsPlayerInRangeOfPoint(playerid, 3.0, 1532.56, -1460.24, 1037.01) && GetPlayerVirtualWorld(playerid) == 0) // VIP Club
		{
			if(PlayerInfo[playerid][pDonateRank] >= 1)
			{
				SetPlayerInterior(playerid, 0);
				PlayerInfo[playerid][pInt] = 0;
				SetPlayerPos(playerid, 1518.83, -1453.27, 14.21);
				SetPlayerFacingAngle(playerid, 0.0);
				SetCameraBehindPlayer(playerid);
			}
			return 1;
		}
		if(IsPlayerInRangeOfPoint(playerid, 3.0, 315.75, -143.66, 999.60) && PlayerInfo[playerid][pVirtualWorld] == 426) // VIP BlackMarket
		{
			if(PlayerInfo[playerid][pDonateRank] >= 2)
			{
				SetPlayerInterior(playerid, 0);
				PlayerInfo[playerid][pInt] = 0;
				SetPlayerVirtualWorld(playerid, 0);
				PlayerInfo[playerid][pVirtualWorld] = 0;
				SetPlayerPos(playerid, 2276.50, -930.04, 28.04);
				SetPlayerFacingAngle(playerid, 268.05);
				SetCameraBehindPlayer(playerid);
			}
			else
			{
				SendClientMessage(playerid, COLOR_GREY, "You are not a Silver or Gold VIP.");
			}
			return 1;
		}
		else if(IsPlayerInRangeOfPoint(playerid, 6.0, -1404.5299, -259.0602, 1043.6563))
		{
			SetPlayerInterior(playerid, 0);
			PlayerInfo[playerid][pInt] = 0;
			SetPlayerPos(playerid, 2695.6235, -1704.6960, 11.8438);
			return 1;
		}
		else if(IsPlayerInRangeOfPoint(playerid, 8.0, -1443.0554, -581.1879, 1055.0472))
		{
			SetPlayerInterior(playerid, 0);
			PlayerInfo[playerid][pInt] = 0;
			SetPlayerPos(playerid, -2111.5686, -443.9720, 38.7344);
			return 1;
		}
		else if(IsPlayerInRangeOfPoint(playerid, 8.0, 2.57, 33.14, 1200)) // SHAMAL
		{
			new vwcheck = GetPlayerVirtualWorld(playerid), Float:px, Float:py, Float:pz, Float:za, 	Float:vx, Float:vy, Float:vz, vehicle;
			vehicle = vwcheck;
			for( new i = 0; i < MAX_VEHICLES; i++ )
			{
				if(GetVehicleModel(i) == 519 || GetVehicleModel(i) == 592 || GetVehicleModel(i) == 553) //shamal, andromeda, nevada
				{
					strmid(sendername, PlayerICName(playerid), 0, MAX_PLAYER_NAME);
					if(PlayerInfo[playerid][pMask] == 1) format(str, sizeof(str), "* Stanger has left the plane.");
					else format(str, sizeof(str), "* %s has left the plane.", sendername);
					GetVehiclePos(vehicle, px, py, pz);
					GetVehicleZAngle(vehicle, za);
					GetVehicleVelocity(vehicle, vx, vy, vz);
					px -= (10 * floatsin(-za, degrees));
					py -= (10 * floatcos(-za, degrees));
					SetPlayerVirtualWorld(playerid, 0);
					PlayerInfo[playerid][pVirtualWorld] = 0;
					SetPlayerInterior(playerid, 0);
					PlayerInfo[playerid][pInt] = 0;
					SetPlayerPos(playerid, px, py, pz);
					SetPlayerFacingAngle(playerid, za);
					SetPlayerVelocity(playerid, vx, vy, vz);
				}
			}
			return 1;
		}
		else if(inBarracksID[playerid] != INVALID_VEHICLE_ID){
			new barracksid = inBarracksID[playerid], Float:vx, Float:vy, Float:vz;

			GetVehiclePos(barracksid, vx, vy, vz);
			new
				Float:vinfox, Float:vinfoy, Float:vinfoz, Float:vinforz;
			GetVehicleModelInfo(433, VEHICLE_MODEL_INFO_SIZE, vinfox, vinfoy, vinfoz); //get barracks dimensions
			GetVehicleZAngle(barracksid, vinforz); //get barracks angle
			vx += (((vinfoy/2) + 0.8) * -floatsin(-vinforz, degrees));
			vy += (((vinfoy/2) + 0.8) * -floatcos(-vinforz, degrees));
			SetPlayerPos(playerid, vx, vy, vz);

			SetPlayerInterior(playerid, 0);
			SetPlayerVirtualWorld(playerid, 0);
			PlayerInfo[playerid][pVirtualWorld] = 0;
			PlayerInfo[playerid][pInt] = 0;
			Timer_FreezePlayer(playerid, FREEZE, ENTER_FREEZE);

			inBarracksID[playerid] = INVALID_VEHICLE_ID;
		}
		else if(IsValidVehicle(inAndromadaID[playerid])) {
			new andromadaid = inAndromadaID[playerid], Float:vx, Float:vy, Float:vz;

			GetVehiclePos(andromadaid, vx, vy, vz);
			new
				Float:vinfox, Float:vinfoy, Float:vinfoz, Float:vinforz;
			GetVehicleModelInfo(592, VEHICLE_MODEL_INFO_SIZE, vinfox, vinfoy, vinfoz); //get barracks dimensions
			GetVehicleZAngle(andromadaid, vinforz); //get barracks angle
			vx += (((vinfoy/2) - 4.8) * -floatsin(-vinforz, degrees));
			vy += (((vinfoy/2) - 4.8) * -floatcos(-vinforz, degrees));
			SetPlayerPos(playerid, vx, vy, vz);

			SetPlayerInterior(playerid, 0);
			SetPlayerVirtualWorld(playerid, 0);
			PlayerInfo[playerid][pVirtualWorld] = 0;
			PlayerInfo[playerid][pInt] = 0;
			Timer_FreezePlayer(playerid, FREEZE, ENTER_FREEZE);

			inAndromadaID[playerid] = INVALID_VEHICLE_ID;
		}
		else if(IsPlayerInRangeOfPoint(playerid, 1.5, 506.7636,1965.6157,999.4003)) //sang prison bus
		{
			new vehid = 0, dynveh = 0;
			for(new i = 0; i < sizeof(sVehicleInfo); i++)
			{
				if(sVehicleInfo[i][v_model] == 431 && sVehicleInfo[i][v_faction] == 5)
				{
						vehid = sVehicleInfo[i][v_id];
						if(GetPlayerVirtualWorld(playerid) == vehid) break;
				}
			}
			if(vehid == 0 && dynveh == 0) return 1;

			new
				Float:sangbuspos[4];
			GetVehiclePos(vehid, sangbuspos[0], sangbuspos[1], sangbuspos[2]);
			GetVehicleZAngle(vehid, sangbuspos[3]);

			new
				Float:sangbusvinfo[3];
			GetVehicleModelInfo(GetVehicleModel(vehid), VEHICLE_MODEL_INFO_SIZE, sangbusvinfo[0], sangbusvinfo[1], sangbusvinfo[2]);
			sangbuspos[0] += (((-sangbusvinfo[1]/2) + 0.5) * -floatsin(-(sangbuspos[3]), degrees));
			sangbuspos[1] += (((-sangbusvinfo[1]/2) + 0.5) * -floatcos(-(sangbuspos[3]), degrees));
			sangbuspos[0] += ((-sangbusvinfo[0] + 0.2) * -floatsin(-(sangbuspos[3] + 90), degrees));
			sangbuspos[1] += ((-sangbusvinfo[0] + 0.2) * -floatcos(-(sangbuspos[3] + 90), degrees));

			if(PlayerInfo[playerid][pMask] != 1) format(str, sizeof(str), "* %s has left the prison bus.", PlayerICName(playerid));
			else format(str, sizeof(str), "* Stranger has left the prison bus.");
			ProxDetector(30.0, playerid, str, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
			SetPlayerPos(playerid, sangbuspos[0], sangbuspos[1], sangbuspos[2]);
			SetPlayerInterior(playerid, 0);
			SetPlayerVirtualWorld(playerid, 0);
		}
		else if(IsPlayerInRangeOfPoint(playerid, 8.0, 302.6667, 2510.3975, 499.9158)) // CARGOBOB
		{
			new vwcheck = GetPlayerVirtualWorld(playerid), Float:px, Float:py, Float:pz, Float:za, 	Float:vx, Float:vy, Float:vz, vehicle;
			vehicle = vwcheck;
			if(GetVehicleModel(vehicle) == 548)
			{
				strmid(sendername, PlayerICName(playerid), 0, MAX_PLAYER_NAME);
				if(PlayerInfo[playerid][pMask] == 1) format(str, sizeof(str), "* Stanger has left the cargobob.");
				else format(str, sizeof(str), "* %s has left the cargobob.", sendername);
				GetVehiclePos(vehicle, px, py, pz);
				GetVehicleZAngle(vehicle, za);
				GetVehicleVelocity(vehicle, vx, vy, vz);
				px -= (5 * floatsin(-za, degrees));
				py -= (5 * floatcos(-za, degrees));
				SetPlayerVirtualWorld(playerid, 0);
				SetPlayerInterior(playerid, 0);
				PlayerInfo[playerid][pInt] = 0;
				PlayerInfo[playerid][pVirtualWorld] = 0;
				SetPlayerPos(playerid, px, py, pz);
				SetPlayerFacingAngle(playerid, za -90);
				SetPlayerVelocity(playerid, vx, vy, vz);
			}
			return 1;
		}
		else if(IsPlayerInRangeOfPoint(playerid, 3.0, 245.8718, 1406.4834, 1112.1130)) // AMBULANCE
		{
			new vwcheck = GetPlayerVirtualWorld(playerid), Float:px, Float:py, Float:pz, Float:za, 	Float:vx, Float:vy, Float:vz, vehicle;
			vehicle = vwcheck;
			if(GetVehicleModel(vehicle) == 416)
			{
				strmid(sendername, PlayerICName(playerid), 0, MAX_PLAYER_NAME);
				if(PlayerInfo[playerid][pMask] == 1) format(str, sizeof(str), "* Stanger has left the cargobob.");
				else format(str, sizeof(str), "* %s has left the cargobob.", sendername);
				GetVehiclePos(vehicle, px, py, pz);
				GetVehicleZAngle(vehicle, za);
				GetVehicleVelocity(vehicle, vx, vy, vz);
				px -= (5 * floatsin(-za, degrees));
				py -= (5 * floatcos(-za, degrees));
				SetPlayerVirtualWorld(playerid, 0);
				SetPlayerInterior(playerid, 0);
				PlayerInfo[playerid][pInt] = 0;
				PlayerInfo[playerid][pVirtualWorld] = 0;
				SetPlayerPos(playerid, px, py, pz);
				SetPlayerFacingAngle(playerid, za -90);
				SetPlayerVelocity(playerid, vx, vy, vz);
			}
			return 1;
		}
		else if(IsPlayerInRangeOfPoint(playerid, 5.0, 2205.2314, 1551.5662, 1008.4103)) //Drug Factory
		{
			SetPlayerInterior(playerid, 0);
			SetPlayerPos(playerid, 1318.8472, 392.6770, 19.5547);
			PlayerInfo[playerid][pInt] = 0;
			SetPlayerFacingAngle(playerid, 0);
			SetCameraBehindPlayer(playerid);
			return 1;
		}
		if(IsPlayerInRangeOfPoint(playerid, 3, -1269.07, 77.78, 991.94)) // Church
		{
			SetPlayerInterior(playerid, 0);
			PlayerInfo[playerid][pInt] = 0;
			SetPlayerPos(playerid, 2232.3, -1333.48, 23.98);
			SetPlayerFacingAngle(playerid, 90.0);
			SetCameraBehindPlayer(playerid);
			return 1;
		}
		else if(IsPlayerInRangeOfPoint(playerid, 6.0, -1404.5299, -259.0602, 1043.6563))
		{
			SetPlayerInterior(playerid, 0);
			PlayerInfo[playerid][pInt] = 0;
			SetPlayerPos(playerid, 2695.6235, -1704.6960, 11.8438);
			return 1;
		}
		else if(IsPlayerInRangeOfPoint(playerid, 8.0, -1443.0554, -581.1879, 1055.0472))
		{
			SetPlayerInterior(playerid, 0);
			PlayerInfo[playerid][pInt] = 0;
			SetPlayerPos(playerid, -2111.5686, -443.9720, 38.7344);
			return 1;
		}
		else if(IsPlayerInRangeOfPoint(playerid, 8.0, -1464.7732, 1557.5533, 1052.5313))
		{
			SetPlayerInterior(playerid, 0);
			PlayerInfo[playerid][pInt] = 0;
			SetPlayerPos(playerid, -2080.3079, -406.0309, 38.7344);
			return 1;
		}
		else if(IsPlayerInRangeOfPoint(playerid, 3.0, 980.7294, 1472.9312, 1004.4619))
		{
			SetPlayerPos(playerid, 2025.2659, -1401.6707, 17.2100);
			SetPlayerFacingAngle(playerid, 180);
			SetCameraBehindPlayer(playerid);
			SetPlayerInterior(playerid, 0);
			PlayerInfo[playerid][pInt] = 0;
			return 1;
		}
		else if(IsPlayerInRangeOfPoint(playerid, 3.0, 1004.3405, 1488.7122, 1016.0709))
		{
			SetPlayerPos(playerid, 2047.3463, -1396.1946, 48.3359);
			SetPlayerFacingAngle(playerid, 0);
			SetCameraBehindPlayer(playerid);
			SetPlayerInterior(playerid, 0);
			PlayerInfo[playerid][pInt] = 0;
			return 1;
		}
		else if(IsPlayerInRangeOfPoint(playerid, 3.0, 1013.2662, 1491.3506, 1016.0709))
		{
			SetPlayerPos(playerid, 2049.5835, -1404.1725, 48.3359);
			SetPlayerFacingAngle(playerid, 270);
			SetCameraBehindPlayer(playerid);
			SetPlayerInterior(playerid, 0);
			PlayerInfo[playerid][pInt] = 0;
			return 1;
		}
		else if(IsPlayerInRangeOfPoint(playerid, 3.0, 975.0416, 1494.5276, 1010.2537))
		{
			SetPlayerPos(playerid, 975.0505, 1495.7568, 1010.2537);
			SetPlayerFacingAngle(playerid, 0);
			SetCameraBehindPlayer(playerid);
			SetPlayerInterior(playerid, 8);
			PlayerInfo[playerid][pInt] = 8;
			return 1;
		}

		ExitTimer[playerid] = gettime();
	}
	return 1;
}

CMD:dmv(playerid, params[]){
	DisablePlayerCheckpoint(playerid);
	SendClientMessage(playerid, COLOR_WHITE, "The DMV has been marked on your mini map!");
	SetPlayerCheckpointEx(playerid, 1221.9650, -1812.1187, 16.5938, 5.0);
	CP[playerid] = CHECKPOINT_DMV;
	return 1;
}

CMD:enter(playerid, params[])
{
	new str[128];
	if(PlayerTied[playerid] != 0 || PlayerCuffed[playerid] != 0 || PlayerTazed[playerid] != 0 || pDeathState[playerid] != PLAYER_STATE_NORMAL) return SendClientMessage(playerid, COLOR_GRAD1, "You are unable to do that at this time.");
	if(gettime() < (EnterTimer[playerid] + 3))
	{
	//	format(str, sizeof(str), "You must wait %d seconds before you can use /enter again!", (EnterTimer[playerid] + 3) - gettime());
	//	SendClientMessage(playerid, COLOR_GREY, str);
		return 1;
	}
	else
	{
		new Float:sucX, Float:sucY, Float:sucZ;
		GetPlayerPos(playerid, sucX, sucY, sucZ);
		for(new i = 0; i < sizeof(EntranceRef); i++)
		{
			if(
				IsPlayerInRangeOfPoint(playerid, 2.0, Entrances[i][outside_x], Entrances[i][outside_y], Entrances[i][outside_z]) &&
				GetPlayerVirtualWorld(playerid) == Entrances[i][outside_w] &&
				GetPlayerInterior(playerid) == Entrances[i][outside_i])
			{
				if(strlen(Entrances[i][dpassword]) && !DisabledDoors[i] ) // has a pass
				{
					ShowPlayerDialog(playerid,
									 DIALOG_ID_PLAYER_PASS,
									 DIALOG_STYLE_INPUT,
									 "Door Password",
									 "Please enter the door's password to enter.",
									 "Okay",
									 "Cancel");
					return 1;
				}
				SetPlayerPos(playerid, Entrances[i][inside_x], Entrances[i][inside_y], Entrances[i][inside_z]);
				SetPlayerFacingAngle(playerid, Entrances[i][inside_a]);
				SetPlayerInterior(playerid, Entrances[i][inside_i]);
				PlayerInfo[playerid][pInt] = Entrances[i][inside_i]; //this was commented for some reason
				SetPlayerVirtualWorld(playerid, Entrances[i][inside_w]);
				PlayerInfo[playerid][pVirtualWorld] = Entrances[i][inside_w]; //this was commented for some reason
				SetCameraBehindPlayer(playerid);
				if(Entrances[i][freeze])
				{
					Timer_FreezePlayer(playerid, FREEZE, ENTER_FREEZE);
				}
				return 1;
			}
			//format(str, sizeof(str), "LookupID: %d", i);
			//SendClientMessage(playerid, COLOR_WHITE, str);
		}
		for(new h = 1; h < sizeof(HouseInfo); h++)
		{
			if(IsPlayerInRangeOfPoint(playerid, 1.0, HouseInfo[h][hOutsideX], HouseInfo[h][hOutsideY], HouseInfo[h][hOutsideZ]))
			{
				if(HouseInfo[h][hLocked] != 1)
				{
					SetPlayerPos(playerid, HouseInfo[h][hInsideX], HouseInfo[h][hInsideY], HouseInfo[h][hInsideZ]);
					SetPlayerFacingAngle(playerid, HouseInfo[h][hInsideA]);
					SetPlayerInterior(playerid, HouseInfo[h][hInterior]);
					SetPlayerVirtualWorld(playerid, HouseInfo[h][hSQLID]);
					PlayerInfo[playerid][pInt] = HouseInfo[h][hInterior];
					PlayerInfo[playerid][pVirtualWorld] = h;
					SetCameraBehindPlayer(playerid);
					new string34[75];
					format(string34, sizeof(string34), "~b~%s", HouseInfo[h][hTag]);
					displayCenterHUDInfo(playerid,  string34, 8); //display for 8 seconds
					inHouse[playerid] = true;
					if(HouseInfo[h][hFreeze])
					{
						Timer_FreezePlayer(playerid, FREEZE, ENTER_FREEZE);
					}
				}
				else
				{
					SendClientMessage(playerid, COLOR_RED, "** This house is locked.");
				}
				return 1;
			}
		}
		for(new g = 1; g < MAX_GARAGES; g++)
		{
			if(IsPlayerInRangeOfPoint(playerid, 4.0, GarageInfo[g][gOutsideX], GarageInfo[g][gOutsideY], GarageInfo[g][gOutsideZ]))
			{
				if(GarageInfo[g][gCreated] != 0)
				{
					if(GarageInfo[g][gLocked] != 1)
					{
						if(IsPlayerInAnyVehicle(playerid))
						{
							new vhid = GetPlayerVehicleID(playerid);
							SetVehiclePos(vhid, GarageInfo[g][gInsideX], GarageInfo[g][gInsideY], GarageInfo[g][gInsideZ]);
							SetVehicleVirtualWorld(vhid, g);
							for(new l = 0; l < MAX_PLAYERS; l++)
							{
								if(IsPlayerConnected(l))
								{
									if(GetPlayerVehicleID(l) == vhid)
									{
										SetPlayerVirtualWorld(l, g);
										PlayerInfo[l][pVirtualWorld] = g;
									}
								}
							}
							SetVehicleZAngle(vhid, GarageInfo[g][gInsideA]);
						}
						else
						{
							SetPlayerPos(playerid, GarageInfo[g][gInsideX], GarageInfo[g][gInsideY], GarageInfo[g][gInsideZ]);
							SetPlayerVirtualWorld(playerid, g);
							SetCameraBehindPlayer(playerid);
							SetPlayerFacingAngle(playerid, GarageInfo[g][gInsideA]);
							PlayerInfo[playerid][pVirtualWorld] = g;
						}
						Timer_FreezePlayer(playerid, FREEZE, ENTER_FREEZE);
					}
					else
					{
						SendClientMessage(playerid, COLOR_RED, "** This garage is locked.");
					}
				}
				return 1;
			}
		}
		for(new b = 0; b < sizeof(BizInfo); b++)
		{
			if(IsPlayerInRangeOfPoint(playerid, 2.0, BizInfo[b][bOutsideX], BizInfo[b][bOutsideY], BizInfo[b][bOutsideZ]))
			{
				if(BizInfo[b][bSeized]) return SendClientMessage(playerid, COLOR_GREY, "That business is currently seized.");
				if(BizInfo[b][bLocked]) return SendClientMessage(playerid, COLOR_GREY, "This business is closed, come back later.");
				if(PlayerInfo[playerid][pBizKey] != b && BizInfo[b][bProducts] <= 0) return SendClientMessage(playerid, COLOR_GREY, "This business has no products, come back later.");
				/*if(PlayerInfo[playerid][pBizKey] != b && BizInfo[b][bEntryFee] > 0)
				{
					if(GetMoney(playerid) >= BizInfo[b][bEntryFee])
					{
						GiveMoney(playerid, -BizInfo[b][bEntryFee]);
						BizInfo[b][bTill] += BizInfo[b][bEntryFee];
						format(str, sizeof(str), "~r~-$%d", BizInfo[b][bEntryFee]);
						GameTextForPlayer(playerid, str, 5000, 1);
					}
					else
					{
						return SendClientMessage(playerid, COLOR_GRAD2, "{FF0000}Error:{FFFFFF} You cannot afford the entry fee.");
					}
				}*/
				if(BizInfo[b][bType] == 1) SendClientMessage(playerid, COLOR_LIGHTBLUE, "Type /buygun to buy a weapon from this business.");
				else if(BizInfo[b][bType] == 2) SendClientMessage(playerid, COLOR_LIGHTBLUE, "Type /buy to buy food from this business.");
				else if(BizInfo[b][bType] == 3 || BizInfo[b][bType] == 5) SendClientMessage(playerid, COLOR_LIGHTBLUE, "Type /buy to buy Items from this business.");
				else if(BizInfo[b][bType] == 4) SendClientMessage(playerid, COLOR_LIGHTBLUE, "Type /getdrink to buy a drink from this business.");
				else if(BizInfo[b][bType] == 5) SendClientMessage(playerid, COLOR_LIGHTBLUE, "Type /buy to buy Items from this business.");
				else if(BizInfo[b][bType] == 6) SendClientMessage(playerid, COLOR_LIGHTBLUE, "Type /buyclothes to buy clothes or /buygear to buy gear from this business.");
				else if(BizInfo[b][bType] == 7) SendClientMessage(playerid, COLOR_LIGHTBLUE, "Type /buy to buy donuts from this business.");
				else if(BizInfo[b][bType] == 8) SendClientMessage(playerid, COLOR_LIGHTBLUE, "Type /buy to buy food from this business.");
				else if(BizInfo[b][bType] == 9) SendClientMessage(playerid, COLOR_LIGHTBLUE, "Type /buy to buy food from this business.");
				else if(BizInfo[b][bType] == 10) SendClientMessage(playerid, COLOR_LIGHTBLUE, "This business type hasn't been scripted yet.");
				else if(BizInfo[b][bType] == 11) SendClientMessage(playerid, COLOR_LIGHTBLUE, "This business type hasn't been scripted yet.");
				else if(BizInfo[b][bType] == 12) SendClientMessage(playerid, COLOR_LIGHTBLUE, "This business type hasn't been scripted yet.");
				else if(BizInfo[b][bType] == 13) SendClientMessage(playerid, COLOR_LIGHTBLUE, "Type /store to buy fishing equipment from this business.");
				SetPlayerVirtualWorld(playerid, b);
				PlayerInfo[playerid][pVirtualWorld] = b; //this didn't exist for some reason
				SetPlayerInterior(playerid, BizInfo[b][bInsideInt]);
				PlayerInfo[playerid][pInt] = BizInfo[b][bInsideInt]; //this didn't exist for some reason
				SetPlayerPos(playerid, BizInfo[b][bInsideX], BizInfo[b][bInsideY], BizInfo[b][bInsideZ]);
				SetPlayerFacingAngle(playerid, BizInfo[b][bInsideAng]);
				SetCameraBehindPlayer(playerid);
				return 1;
			}
		}
		if(IsPlayerInRangeOfPoint(playerid, 3.0, 1221.9650, -1812.1187, 16.5938)) //DMV Enter
		{
			SetPlayerPos(playerid, 1494.4031, 1304.5746, 1093.2891);
			SetPlayerFacingAngle(playerid, 0.1631);
			Timer_FreezePlayer(playerid, FREEZE, ENTER_FREEZE);
			SetPlayerInterior(playerid, 3);
			return 1;
		}
		if(IsPlayerInRangeOfPoint(playerid, 3.0, 2352.9841,-1463.4185,24.0000)) // Tiki Store
		{
			PlayerInfo[playerid][pInt] = 6;
			SetPlayerInterior(playerid, PlayerInfo[playerid][pInt]);
			SetPlayerPos(playerid, -2240.4736,137.1805,1035.4141);
			SetPlayerFacingAngle(playerid, 267.2031);
			displayCenterHUDInfo(playerid,  "~w~Tiki Store", 8); //display for 8 seconds
			SetCameraBehindPlayer(playerid);
			return 1;
		}
		// LBCC Shit
		if(IsPlayerInRangeOfPoint(playerid, 2, 2851.94, -1366.00, 14.17)) // Outside -> House
		{
			SetPlayerPos(playerid, 2841.45, -1346.88, 959.74);
			SetPlayerInterior(playerid, 1);
			PlayerInfo[playerid][pInt] = 1;
			SetPlayerFacingAngle(playerid, 270.0);
			SetCameraBehindPlayer(playerid);
			return 1;
		}
		if(IsPlayerInRangeOfPoint(playerid, 2, 2877.84, -1336.29, 965.66)) // House -> Office
		{
			SetPlayerPos(playerid, 1226.54, -813.24, 1084.00);
			SetPlayerInterior(playerid, 5);
			PlayerInfo[playerid][pInt] = 5;
			PlayerInfo[playerid][pVirtualWorld] = 20;
			SetPlayerVirtualWorld(playerid, 20);
			SetPlayerFacingAngle(playerid, 0.0);
			SetCameraBehindPlayer(playerid);
			return 1;
		}
		if(IsPlayerInRangeOfPoint(playerid, 3.0, 1519.02, -1453.92, 14.20)) // VIP Club
		{
			if(PlayerInfo[playerid][pDonateRank] >= 1)
			{
				SetPlayerInterior(playerid, 69);
				PlayerInfo[playerid][pInt] = 69;
				SetPlayerPos(playerid, 1532.51, -1461.23, 1037.01);
				displayCenterHUDInfo(playerid,  "~p~VIP Club", 8); //display for 8 seconds
				SetPlayerFacingAngle(playerid, 180.0);
				SetCameraBehindPlayer(playerid);
			}
			else
			{
				SendClientMessage(playerid, COLOR_GRAD1, "You must be a VIP to enter the VIP Club.");
			}
			return 1;
		}
		if(IsPlayerInRangeOfPoint(playerid, 3.0, 2275.39, -930.02, 28.04)) // VIP Black Market
		{
			if(PlayerInfo[playerid][pDonateRank] >= 2)
			{
				SetPlayerInterior(playerid, 7);
				PlayerInfo[playerid][pInt] = 7;
				SetPlayerVirtualWorld(playerid, 426);
				PlayerInfo[playerid][pVirtualWorld] = 426;
				SetPlayerPos(playerid, 315.70, -143.01, 999.60);
				displayCenterHUDInfo(playerid,  "~b~Blackmarket", 8); //display for 8 seconds
				SendClientMessage(playerid, COLOR_LIGHTBLUE, "Type /purchase to purchase weapons.");
				SetPlayerFacingAngle(playerid, 0.0);
				SetCameraBehindPlayer(playerid);
			}
			else
			{
				SendClientMessage(playerid, COLOR_GREY, "You are not a Silver or Gold VIP.");
			}
			return 1;
		}
		if(IsPlayerInRangeOfPoint(playerid, 3, 1310.0685, -1367.6198, 13.5382) || IsPlayerInRangeOfPoint(playerid, 3, 1088.75, -1715.45, 1136.46))
		{
			if(IsPlayerHoldingDuffleBag(playerid)) return SendClientMessage(playerid, COLOR_GRAD1, "Cannot enter paintball with Duffle Bag.");
			if(HasARapidResKit[playerid] == 1 || RapidResKitActive[playerid] == 1) return SendClientMessage(playerid, COLOR_GRAD1, "Cannot enter paintball with a response kit.");
			if(PlayerInfo[playerid][pLevel] == 0) return SendClientMessage(playerid, COLOR_GRAD1, "You must play be level 1 or above before you can join Paintball.");
			if(!IsACop(playerid) && IsPlayerInRangeOfPoint(playerid, 3, 1088.75, -1715.45, 1136.46)) return 1;
			ShowPlayerDialog(playerid, DIALOG_PAINTBALL_WEAPONS1, DIALOG_STYLE_LIST, "Handgun Selection", "Colt 45\nDesert Eagle", "Select", "Quit");
			return 1;
		}
		for(new i = 0; i < MAX_VEHICLES; i++) //optimize
		{// For now all 3 planes will use shamal interior.  I'll have a custom one mapped for later.
			if(GetVehicleModel(i) == 519 || GetVehicleModel(i) == 553) //shamal, andromeda, nevada
			{
				new Float:shax, Float:shay, Float:shaz;
				GetVehiclePos(i, shax, shay, shaz);
				if(IsPlayerInRangeOfPoint(playerid, 8.0, shax, shay, shaz))
				{
					strmid(sendername, PlayerICName(playerid), 0, MAX_PLAYER_NAME);
					if(PlayerInfo[playerid][pMask] == 1) format(str, sizeof(str), "* Stanger has entered the plane.");
					else format(str, sizeof(str), "* %s has entered the plane.", sendername);
					ProxDetector(30.0, playerid, str, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
					SetPlayerVirtualWorld(playerid, i);
					PlayerInfo[playerid][pVirtualWorld] = i;
					SetPlayerInterior(playerid, 1);
					PlayerInfo[playerid][pInt] = 1;
					SetPlayerPos(playerid, 2.57, 33.14, 1200);
					displayCenterHUDInfo(playerid,  "~b~Airplane Interior", 8); //display for 8 seconds
					GivePlayerGun(playerid, 46);
					return 1;
				}
			}
			if(GetVehicleModel(i) == 433)//barracks
			{
				new Float:bx, Float:by, Float:bz;
				GetVehiclePos(i, bx, by, bz);
				new
					Float:vinfox, Float:vinfoy, Float:vinfoz, Float:vinforz;
				GetVehicleModelInfo(433, VEHICLE_MODEL_INFO_SIZE, vinfox, vinfoy, vinfoz); //get barracks dimensions
				GetVehicleZAngle(i, vinforz); //get barracks angle
				bx += (((vinfoy/2) + 0.8) * -floatsin(-vinforz, degrees));
				by += (((vinfoy/2) + 0.8) * -floatcos(-vinforz, degrees));
				if(IsPlayerInRangeOfPoint(playerid, 1.5, bx, by, bz)){
					SetPlayerVirtualWorld(playerid, i);
					PlayerInfo[playerid][pVirtualWorld] = i;
					SetPlayerPos(playerid, 1236.5437,2477.0471,1001.1534);
					SetPlayerFacingAngle(playerid, 359.7815);
					inBarracksID[playerid] = i;
					displayCenterHUDInfo(playerid,  "~b~Barracks", 8);
					return 1;
				}
			}
			if(GetVehicleModel(i) == 592)//andromada
			{
				new Float:bx, Float:by, Float:bz;
				GetVehiclePos(i, bx, by, bz);
				new
					Float:vinfox, Float:vinfoy, Float:vinfoz, Float:vinforz;
				GetVehicleModelInfo(592, VEHICLE_MODEL_INFO_SIZE, vinfox, vinfoy, vinfoz); //get andro dimensions
				GetVehicleZAngle(i, vinforz); //get andro angle
				bx += (((vinfoy/2) - 4.8) * -floatsin(-vinforz, degrees));
				by += (((vinfoy/2) - 4.8) * -floatcos(-vinforz, degrees));
				if(IsPlayerInRangeOfPoint(playerid, 7.5, bx, by, bz)){
					SetPlayerVirtualWorld(playerid, i);
					PlayerInfo[playerid][pVirtualWorld] = i;
					SetPlayerPos(playerid, 363.4739,1027.3943,1952.3169);
					SetPlayerFacingAngle(playerid, 180.0);
					inAndromadaID[playerid] = i;
					displayCenterHUDInfo(playerid,  "~b~Andromada", 8);
					GivePlayerGun(playerid, 46);
					return 1;
				}
			}
			if(GetVehicleModel(i) == 431)
			{
				new
					Float:sangbuspos[4], dynveh = GetDynamicVehicleID(i);
				if(sVehicleInfo[dynveh][v_faction] == 5)
				{
					GetVehiclePos(i, sangbuspos[0], sangbuspos[1], sangbuspos[2]);
					GetVehicleZAngle(i, sangbuspos[3]);
					new
						Float:sangbusvinfo[3];
					GetVehicleModelInfo(GetVehicleModel(i), VEHICLE_MODEL_INFO_SIZE, sangbusvinfo[0], sangbusvinfo[1], sangbusvinfo[2]);
					sangbuspos[0] += (((-sangbusvinfo[1]/2) + 0.5) * -floatsin(-(sangbuspos[3]), degrees));
					sangbuspos[1] += (((-sangbusvinfo[1]/2) + 0.5) * -floatcos(-(sangbuspos[3]), degrees));
					sangbuspos[0] += ((-sangbusvinfo[0] + 0.2) * -floatsin(-(sangbuspos[3] + 90), degrees));
					sangbuspos[1] += ((-sangbusvinfo[0] + 0.2) * -floatcos(-(sangbuspos[3] + 90), degrees));
					if(IsPlayerInRangeOfPoint(playerid, 2.5, sangbuspos[0], sangbuspos[1], sangbuspos[2]))
					{
						if(PlayerInfo[playerid][pMask] != 1) format(str, sizeof(str), "* %s has entered the prison bus.", PlayerICName(playerid));
						else format(str, sizeof(str), "* Stranger has entered the prison bus.");
						ProxDetector(30.0, playerid, str, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
						SetPlayerPos(playerid, 506.7636,1965.6157,999.4003);
						Timer_FreezePlayer(playerid, FREEZE, ENTER_FREEZE);
						SetPlayerFacingAngle(playerid, 180);
						SetPlayerInterior(playerid, 50);
						SetPlayerVirtualWorld(playerid, i);
						displayCenterHUDInfo(playerid,  "~b~Prison Bus", 8);
					 }
				}
			}
			if(GetVehicleModel(i) == 548) //cargobob
			{
				new Float:cbobx, Float:cboby, Float:cbobz;
				GetVehiclePos(i, cbobx, cboby, cbobz);
				if(IsPlayerInRangeOfPoint(playerid, 8.0, cbobx, cboby, cbobz))
				{
					strmid(sendername, PlayerICName(playerid), 0, MAX_PLAYER_NAME);
					if(PlayerInfo[playerid][pMask] == 1) format(str, sizeof(str), "* Stanger has entered the cargobob.");
					else format(str, sizeof(str), "* %s has entered the cargobob.", sendername);
					ProxDetector(30.0, playerid, str, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
					SetPlayerVirtualWorld(playerid, i);
					PlayerInfo[playerid][pVirtualWorld] = i;
					SetPlayerInterior(playerid, 1);
					PlayerInfo[playerid][pInt] = 1;
					SetPlayerPos(playerid, 302.6667, 2510.3975, 499.9158);
					SetPlayerFacingAngle(playerid, 0);
					displayCenterHUDInfo(playerid,  "~b~Cargobob", 8);
					GivePlayerGun(playerid, 46);
					return 1;
				}
			}
			//AMBULANCE SCRIPT.
			if(GetVehicleModel(i) == 416) //Ambulance
			{
				new Float:ambx, Float:amby, Float:ambz;
				GetVehiclePos(i, ambx, amby, ambz);
				if(IsPlayerInRangeOfPoint(playerid, 4.5, ambx, amby, ambz))
				{
					strmid(sendername, PlayerICName(playerid), 0, MAX_PLAYER_NAME);
					if(PlayerInfo[playerid][pMask] == 1) format(str, sizeof(str), "* Stanger has entered the Ambulance.");
					else format(str, sizeof(str), "* %s has entered the Ambulance.", sendername);
					ProxDetector(30.0, playerid, str, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
					SetPlayerVirtualWorld(playerid, i);
					PlayerInfo[playerid][pVirtualWorld] = i;
					SetPlayerInterior(playerid, 1);
					PlayerInfo[playerid][pInt] = 1;
					Timer_FreezePlayer(playerid, FREEZE, ENTER_FREEZE);
					SetPlayerPos(playerid, 245.8718, 1406.4834, 1112.1130);
					SetPlayerFacingAngle(playerid, 0);
					displayCenterHUDInfo(playerid,  "~b~Ambulance", 8);
					return 1;
				}
			}
		}
		if(IsPlayerInRangeOfPoint(playerid, 3.0, 1318.8472, 392.6770, 19.5547)) //Drug Factory
		{
			SetPlayerInterior(playerid, 1);
			PlayerInfo[playerid][pInt] = 1;
			SetPlayerPos(playerid, 2205.2314, 1551.5662, 1008.4103);
			SetPlayerFacingAngle(playerid, 270.7354);
			displayCenterHUDInfo(playerid,  "~b~Drug Factory", 8); //display for 8 seconds
			SetCameraBehindPlayer(playerid);
			return 1;
		}
		else if(IsPlayerInRangeOfPoint(playerid, 3.0, 2232.89, -1333.48, 23.98)) //Church
		{
			SetPlayerInterior(playerid, 69);
			PlayerInfo[playerid][pInt] = 69;
			SetPlayerPos(playerid, -1269.07, 77.78, 992.04);
			displayCenterHUDInfo(playerid,  "~b~Los Santos Chapel", 8); //display for 8 seconds
			SetPlayerFacingAngle(playerid, 180.0000);
			SetCameraBehindPlayer(playerid);
			return 1;
		}
		else if(IsPlayerInRangeOfPoint(playerid, 8.0, -2111.5686, -443.9720, 38.7344))
		{
			SetPlayerInterior(playerid, 4);
			PlayerInfo[playerid][pInt] = 4;
			SetPlayerPos(playerid, -1443.0554, -581.1879, 1055.0472);
			displayCenterHUDInfo(playerid,  "~b~Welcome to the Dirt Track", 8); //display for 8 seconds
			return 1;
		}
		else if(IsPlayerInRangeOfPoint(playerid, 8.0, -2080.3079, -406.0309, 38.7344))
		{
			SetPlayerInterior(playerid, 14);
			PlayerInfo[playerid][pInt] = 14;
			SetPlayerPos(playerid, -1464.7732, 1557.5533, 1052.5313);
			displayCenterHUDInfo(playerid,  "~b~Welcome to the Stunting Track", 8); //display for 8 seconds
			return 1;
		}
		else if(IsPlayerInRangeOfPoint(playerid, 3.0, 2025.2659, -1401.6707, 17.2100))
		{
			SetPlayerPos(playerid, 980.7294, 1472.9312, 1004.4619);
			SetPlayerFacingAngle(playerid, 0);
			SetCameraBehindPlayer(playerid);
			SetPlayerInterior(playerid, 8);
			PlayerInfo[playerid][pInt] = 8;
			return 1;
		}
		else if(IsPlayerInRangeOfPoint(playerid, 3.0, 2047.3463, -1396.1946, 48.3359))
		{
			SetPlayerPos(playerid, 1004.3405, 1488.7122, 1016.0709);
			SetPlayerFacingAngle(playerid, 270);
			SetCameraBehindPlayer(playerid);
			SetPlayerInterior(playerid, 8);
			PlayerInfo[playerid][pInt] = 8;
			return 1;
		}
		else if(IsPlayerInRangeOfPoint(playerid, 3.0, 2049.5835, -1404.1725, 48.3359))
		{
			SetPlayerPos(playerid, 1013.2662, 1491.3506, 1016.0709);
			SetPlayerFacingAngle(playerid, 180);
			SetCameraBehindPlayer(playerid);
			SetPlayerInterior(playerid, 8);
			PlayerInfo[playerid][pInt] = 8;
			return 1;
		}
		else if(IsPlayerInRangeOfPoint(playerid, 3.0, 975.0505, 1495.7568, 1010.2537))
		{
			SetPlayerPos(playerid, 975.0416, 1494.5276, 1010.2537);
			SetPlayerFacingAngle(playerid, 180);
			SetCameraBehindPlayer(playerid);
			SetPlayerInterior(playerid, 8);
			PlayerInfo[playerid][pInt] = 8;
			return 1;
		}

		EnterTimer[playerid] = gettime();

		new Float:asucX, Float:asucY, Float:asucZ;
		GetPlayerPos(playerid, asucX, asucY, asucZ);
		if(sucX != asucX || sucY != asucY || sucZ != asucZ) return 1;
		/* basically what we're doing here is check if the position of the player has changed since he typed the /enter
			if it did, it will return 1, meaning when pressing the key 'N' it won't execute cmd_exit (so it doesnt enter and exit)
			for the rest of this code search (CTRL F) "cmd_enter"
		*/
		else return 0;
	}
}

CMD:inventory(playerid, params[])
{
	new rod[20], bait[20], baita, line[20], line1[1000], line2[1000], line3[1000], mstring[3500];

	format(rod, sizeof(rod), "%s", GetFishingRodName(PlayerInfo[playerid][pFishRod]));
	format(bait, sizeof(bait), "%s", GetFishingBaitName(PlayerInfo[playerid][pBait]));
	format(line, sizeof(line), "%s", GetFishingLineName(PlayerInfo[playerid][pLine]));

	baita = PlayerInfo[playerid][pBaitAmount];

	if(baita == 0)
		bait = "None";

	new packages = Packages[playerid];
	new crates = Crates[playerid];
	format(line1, sizeof(line1), "{007BD0}[Inventory] {CBCCCE}Materials:[%d]  Cannabis:[%d.0g]  Cocaine:[%d.0g] Meth:[%d.0g]  Xanax[%d.0 bars]  Package:[%d]  Crates:[%d]  Seeds:[%d]  Products:[%d]", PlayerInfo[playerid][pMats], PlayerInfo[playerid][pCannabis], PlayerInfo[playerid][pCocaine], PlayerInfo[playerid][pMeth], PlayerInfo[playerid][pXanax], packages, crates, PlayerInfo[playerid][pPotSeeds], PlayerInfo[playerid][pProducts]);
	format(line2, sizeof(line2), "{007BD0}[Inventory] {D8D8D8}Ropes:[%d]  Blindfolds:[%d] Gags:[%d] Cigars:[%d]  Beer:[%d]  Sprunk:[%d]  Spraycan:[%d]  Screw Driver:[%d]  Deck of Cards:[%d]  WTc:[%d]", PlayerInfo[playerid][pRope], PlayerInfo[playerid][pBlindfolds], PlayerInfo[playerid][pGag], PlayerInfo[playerid][pCigars], PlayerInfo[playerid][pBeer], PlayerInfo[playerid][pSprunk], PlayerInfo[playerid][pSpraycan], PlayerInfo[playerid][pScrew], PlayerInfo[playerid][pDeck], PlayerInfo[playerid][pWTc]);
	format(line3, sizeof(line3), "{007BD0}[Inventory] {D8D8D8}Fishing Rod:[%s]  Bait:[%s]  Bait Left:[%d]  Fishing Line:[%s] Stereo:[%d] Box of Matches:[%d] Jerry Can:[%d] Drill:[%d]", rod, bait, baita, line, PlayerInfo[playerid][pStereo], PlayerInfo[playerid][pMatches], PlayerInfo[playerid][pJerrycan], PlayerInfo[playerid][pDrill]);
	format(mstring, sizeof(mstring), "%s\n%s\n%s", line1, line2, line3);
	ShowPlayerDialog(playerid, DIALOG_STATS1, DIALOG_STYLE_MSGBOX, "Inventory", mstring, "Done", "Print");
	return 1;
}

CMD:inv(playerid, params[]) return cmd_inventory(playerid, params);

CMD:stats(playerid, params[])
{
	if(gPlayerLogged[playerid] != 0)
	{
		ShowStats(playerid, playerid);
		viewingStatsOf[playerid] = playerid;
	}
	else return SendClientMessage(playerid, COLOR_GREY, "{FF0000}Error:{FFFFFF} You are not logged in.");
	return 1;
}

CMD:appearance(playerid, params[])
{
	new aid;
	if(sscanf(params, "u", aid))
	{
		SendClientMessage(playerid, COLOR_GREY, "Use /appearance [ID/partOfName] to check their appearence.");
		ShowAppearanceMain(playerid);
		return 1;
	}

	if(IsPlayerConnected(aid))
	{
		new Float:pax, Float:pay, Float:paz;
		GetPlayerPos(aid, pax, pay, paz);
		if(IsPlayerInRangeOfPoint(playerid, 10.0, pax, pay, paz))
		{
			new astr[512];

			format(astr, sizeof(astr), "Gender:\t\t%s\nAge:\t\t\t%d\nEthnicity\t\t%s\nEye Colour:\t\t%s\nBody Build:\t\t%s\nHeight:\t\t\t%dcm\nUnique Features:\t%s",
			GetPlayerGender2(aid), PlayerInfo[aid][pAge], GetPlayerEthnicity(aid), GetPlayerEyeColour(aid), GetPlayerBuild(aid), PlayerInfo[aid][pHeight], PlayerInfo[aid][pAppearance]);

			ShowPlayerDialog(playerid, DIALOG_APPEARANCE_DISPLAY, DIALOG_STYLE_LIST, "Character Appearance", astr, "Close", "");
			return 1;
		}
		return SendClientMessage(playerid, COLOR_GREY, "You cannot see that player.");
	}
	return SendClientMessage(playerid, COLOR_GREY, "{FF0000}Error:{FFFFFF} that player isn't connected.");
}

CMD:facrankname(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] >= 3)
	{
		new tag[24];
		if(sscanf(params, "s[24]", tag)) return 1;
		{
			if(strlen(tag) > 23) return SendClientMessage(playerid, COLOR_GREY, "The maximum amount of characters is 24.");
			format(customRank[playerid], 24, "%s", tag);
			if(strmatch(tag, "None"))
			{
				customRankName[playerid] = false;
			}
			else
			{
				customRankName[playerid] = true;
			}
		}
	}
	return 1;
}

CMD:cnewbietag(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] >= 1999999999)
	{
		new tag[24];
		if(sscanf(params, "s[24]", tag)) return 1;
		{
			if(strlen(tag) > 23) return SendClientMessage(playerid, COLOR_GREY, "The maximum amount of characters is 24.");
			if(strmatch(tag, "none"))
			{
				PlayerInfo[playerid][pTag] = NTAG_NEWBIE;
			}
			else
			{
				PlayerInfo[playerid][pTag] = NTAG_CUSTOM;
			}
			format(CustomTag[playerid], 50, "%s", tag);
		}
	}
	return 1;
}

CMD:number(playerid, params[])
{
	new str[128];
	if(PlayerInfo[playerid][pPhoneBook] == 1)
	{
		new targetid;
		if(sscanf(params, "u", targetid)) return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /number [playerid/PartOfName]");
		{
			if(IsPlayerConnected(targetid))
			{
				new name[24];
				strmid(name, str_replace('_', ' ', PlayerName(targetid)), 0, MAX_PLAYER_NAME);
				if(targetid != INVALID_PLAYER_ID)
				{
					if(PlayerInfo[targetid][pPnumber] == 0) format(str, sizeof(str), "Name: %s, Ph: None", name);
					else format(str, sizeof(str), "Name: %s, Ph: %d", name, PlayerInfo[targetid][pPnumber]);
					SendClientMessage(playerid, COLOR_GRAD1, str);
				}
			}
			else return SendClientMessage(playerid, COLOR_GREY, "{FF0000}Error:{FFFFFF} That player isn't connected.");
		}
	}
	else return SendClientMessage(playerid, COLOR_GRAD1, "You don't have a Phonebook.");
	return 1;
}

CMD:phonebook(playerid, params[]) return cmd_number(playerid, params);

CMD:buylevel(playerid, params[])
{
	new str[128];
	if(gPlayerLogged[playerid] != 0)
	{
		if(PlayerInfo[playerid][pLevel] >= 0)
		{
			new nxtlevel = PlayerInfo[playerid][pLevel] +1, expamount = nxtlevel *levelexp;
			/*if(PlayerInfo[playerid][pCash] < costlevel)
			{
				format(str, sizeof(str), "You can't afford that ($%d).", costlevel);
				SendClientMessage(playerid, COLOR_GREY, str);
				return 1;
			}*/
			if(PlayerInfo[playerid][pExp] < expamount)
			{
				format(str, sizeof(str), "You need %d respect points, you curently have %d.", expamount, PlayerInfo[playerid][pExp]);
				SendClientMessage(playerid, COLOR_GREY, str);
				return 1;
			}
			else
			{
				if(nxtlevel == 2){
					SendClientMessage(playerid, COLOR_YELLOW, "Reminder: {FFFFFF}Global Chat is available for you now, use /toggc to enable it.");
					PlayerInfo[playerid][pTag] = NTAG_PLAYER;
				}
				format(str, sizeof(str), "~r~Level up~n~~w~level %d", nxtlevel);
				PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
				//GiveMoney(playerid, -costlevel);
				PlayerInfo[playerid][pLevel]++;
				PlayerInfo[playerid][pExp] -= expamount;
				new total = PlayerInfo[playerid][pExp];
				if(total > 0)
				{
					PlayerInfo[playerid][pExp] = total;
				}
				else
				{
					PlayerInfo[playerid][pExp] = 0;
				}
				PlayerInfo[playerid][gPupgrade] = PlayerInfo[playerid][gPupgrade] +2;
				displayCenterHUDInfo(playerid,  str, 8); //display for 8 seconds
				format(str, sizeof(str), "You bought level %d for FREE, type /upgrade.", nxtlevel);
				SendClientMessage(playerid, COLOR_YELLOW, str);
				format(str, sizeof(str), "You have %d upgrade points remaining.", PlayerInfo[playerid][gPupgrade]);
				SendClientMessage(playerid, COLOR_YELLOW, str);
			}
		}
	}
	else return SendClientMessage(playerid, COLOR_GREY, "{FF0000}Error:{FFFFFF} You are not logged in.");
	return 1;
}

CMD:resetgearpos(playerid, params[])
{
	new conf[8];
	if(sscanf(params, "s[8]", conf)) return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /resetgearpos [confirm]");

	if(strmatch(conf, "confirm")) {

		for(new i = 0; i < 7; i++) {
			AccessoriesB[playerid][i] = 0;

			AccessoriesX[playerid][i] = 0;
			AccessoriesY[playerid][i] = 0;
			AccessoriesZ[playerid][i] = 0;

			AccessoriesrX[playerid][i] = 0;
			AccessoriesrY[playerid][i] = 0;
			AccessoriesrZ[playerid][i] = 0;

			AccessoriessX[playerid][i] = 1;
			AccessoriessY[playerid][i] = 1;
			AccessoriessZ[playerid][i] = 1;
		}

		SendClientMessage(playerid, COLOR_GRAD2, "* You have reset your gear positions.");
	}
	else
	{
		SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /resetgearpos [confirm]");
		SendClientMessage(playerid, COLOR_WHITE, "NOTICE: This will reset the position of each gear.");
	}
	return 1;
}

CMD:resetupgrades(playerid, params[])
{
	new str[128];
	if(gPlayerLogged[playerid] == 0) return SendClientMessage(playerid, COLOR_GREY, "{FF0000}Error:{FFFFFF} You are not logged in.");
	if(PlayerInfo[playerid][pCash] < 100000) return SendClientMessage(playerid, COLOR_GREY, "You can't afford that ($100,000).");
	if(PlayerInfo[playerid][pLevel] < 2) return SendClientMessage(playerid, COLOR_GREY, "You need to be at least level 2.");
	new conf[8];
	if(sscanf(params, "s[8]", conf)) return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /resetupgrades [confirm]");
	{
		if(strmatch(conf, "Confirm"))
		{
			PlayerInfo[playerid][gPupgrade] = (PlayerInfo[playerid][pLevel]) *2;
			PlayerInfo[playerid][pSHealth] = 0;
			PlayerInfo[playerid][pSHP] = 0;
			GiveMoney(playerid, -100000);
			PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
			format(str, sizeof(str), "* You have reset your upgrades, you have %d upgrades points remaining.", PlayerInfo[playerid][gPupgrade]);
			SendClientMessage(playerid, COLOR_GRAD2, str);
		}
		else return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /resetupgrades [confirm]");
	}
	return 1;
}

CMD:up(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] >= 2 || PlayerInfo[playerid][pDev] >= 1 || PlayerInfo[playerid][pMapper] >= 1 || PlayerInfo[playerid][pTester] >= TESTERRANK_SENIOR)
	{
		if(pDeathState[playerid] != PLAYER_STATE_NORMAL) return SendClientMessage(playerid, COLOR_GREY, "You can't use this at the moment.");
		if(IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You can't use this command whilst inside of a vehicle.");
		new Float:slx, Float:sly, Float:slz;
		GetPlayerPos(playerid, slx, sly, slz);
		SetPlayerPos(playerid, slx, sly, slz +2);
	}
	else return AdmErrorMsg;
	return 1;
}

CMD:dn(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] >= 2 || PlayerInfo[playerid][pDev] >= 1 || PlayerInfo[playerid][pMapper] >= 1 || PlayerInfo[playerid][pTester] >= TESTERRANK_SENIOR)
	{
		if(pDeathState[playerid] != PLAYER_STATE_NORMAL) return SendClientMessage(playerid, COLOR_GREY, "You can't use this at the moment.");
		if(IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You can't use this command whilst inside of a vehicle.");
		new Float:slx, Float:sly, Float:slz;
		GetPlayerPos(playerid, slx, sly, slz);
		SetPlayerPos(playerid, slx, sly, slz -2);
	}
	else return AdmErrorMsg;
	return 1;
}

CMD:bigup(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] >= 2 || PlayerInfo[playerid][pDev] >= 1 || PlayerInfo[playerid][pMapper] >= 1 || PlayerInfo[playerid][pTester] >= TESTERRANK_SENIOR)
	{
		if(pDeathState[playerid] != PLAYER_STATE_NORMAL) return SendClientMessage(playerid, COLOR_GREY, "You can't use this at the moment.");
		if(IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You can't use this command whilst inside of a vehicle.");
		new Float:slx, Float:sly, Float:slz;
		GetPlayerPos(playerid, slx, sly, slz);
		SetPlayerPos(playerid, slx, sly, slz +8);
	}
	else return AdmErrorMsg;
	return 1;
}

CMD:bigdn(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] >= 2 || PlayerInfo[playerid][pDev] >= 1 || PlayerInfo[playerid][pMapper] >= 1 || PlayerInfo[playerid][pTester] >= TESTERRANK_SENIOR)
	{
		if(pDeathState[playerid] != PLAYER_STATE_NORMAL) return SendClientMessage(playerid, COLOR_GREY, "You can't use this at the moment.");
		if(IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You can't use this command whilst inside of a vehicle.");
		new Float:slx, Float:sly, Float:slz;
		GetPlayerPos(playerid, slx, sly, slz);
		SetPlayerPos(playerid, slx, sly, slz -8);
	}
	else return AdmErrorMsg;
	return 1;
}

CMD:getgift(playerid, params[])
{
	if(IsPlayerInRangeOfPoint(playerid, 1.5, 1548.55004883, -1477.00000000, 1037.90002441) && PlayerInfo[playerid][pDonateRank] != 0)
	{
		if(GottenGift[playerid] == 1) return SendClientMessage(playerid, COLOR_GRAD1, "You have to wait 5 hours in between getting gifts! Try again later.");
		format(string5, sizeof(string5), "* %s closes his eyes reaching into the safe pulling something out...", PlayerICName(playerid));
		ProxDetector(30.0, playerid, string5, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
		new randomgift = random(9);
		if(randomgift == 0)
		{
			PlayerInfo[playerid][pMats] += 5000;
			format(string5, sizeof(string5), "* 5,000 Materials. (( %s ))", PlayerICName(playerid));
			ProxDetector(30.0, playerid, string5, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
			GottenGift[playerid] = 1;
			GottenTimeLeft[playerid] = 18000000;
		}
		else if(randomgift == 1)
		{
			PlayerInfo[playerid][pCash] += 50000;
			format(string5, sizeof(string5), "* $50,000. (( %s ))", PlayerICName(playerid));
			ProxDetector(30.0, playerid, string5, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
			GottenGift[playerid] = 1;
			GottenTimeLeft[playerid] = 18000000;
		}
		else if(randomgift == 2)
		{
			PlayerInfo[playerid][pCash] += 10000;
			format(string5, sizeof(string5), "* $10,000. (( %s ))", PlayerICName(playerid));
			ProxDetector(30.0, playerid, string5, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
			GottenGift[playerid] = 1;
			GottenTimeLeft[playerid] = 18000000;
		}
		else if(randomgift == 3)
		{
			GivePlayerGun(playerid, 30);
			GivePlayerGun(playerid, 32);
			GivePlayerGun(playerid, 24);
			GivePlayerGun(playerid, 33);
			format(string5, sizeof(string5), "* A full weapon set. (( %s ))", PlayerICName(playerid));
			ProxDetector(30.0, playerid, string5, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
			GottenGift[playerid] = 1;
			GottenTimeLeft[playerid] = 18000000;
		}
		else if(randomgift == 4)
		{
			PlayerInfo[playerid][pPotSeeds] += 20;
			format(string5, sizeof(string5), "* 20 cannabis seeds. (( %s ))", PlayerICName(playerid));
			ProxDetector(30.0, playerid, string5, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
			GottenGift[playerid] = 1;
			GottenTimeLeft[playerid] = 18000000;
		}
		else if(randomgift == 5)
		{
			PlayerInfo[playerid][pPotSeeds] += 10;
			format(string5, sizeof(string5), "* 10 cannabis seeds. (( %s ))", PlayerICName(playerid));
			ProxDetector(30.0, playerid, string5, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
			GottenGift[playerid] = 1;
			GottenTimeLeft[playerid] = 18000000;
		}
		else if(randomgift == 6)
		{
			PlayerInfo[playerid][pMats] += 10000;
			format(string5, sizeof(string5), "* 10,000 Materials. (( %s ))", PlayerICName(playerid));
			ProxDetector(30.0, playerid, string5, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
			GottenGift[playerid] = 1;
			GottenTimeLeft[playerid] = 18000000;
		}
		else if(PlayerInfo[playerid][pDonateRank] == 4 && randomgift == 7)
		{
			PlayerInfo[playerid][pMats] += 50000;
			format(string5, sizeof(string5), "* 50,000 Materials. (( %s ))", PlayerICName(playerid));
			ProxDetector(30.0, playerid, string5, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
			GottenGift[playerid] = 1;
			GottenTimeLeft[playerid] = 18000000;
		}
		else if(PlayerInfo[playerid][pDonateRank] == 4 && randomgift == 8)
		{
			PlayerInfo[playerid][pCash] += 500000;
			format(string5, sizeof(string5), "* 500,000 Cash. (( %s ))", PlayerICName(playerid));
			ProxDetector(30.0, playerid, string5, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
			GottenGift[playerid] = 1;
			GottenTimeLeft[playerid] = 18000000;
		}
	}
	else return SendClientMessage(playerid, COLOR_GRAD1, "You are not in the VIP Club.");
	return 1;
}

CMD:getgifttime(playerid, params[])
{
	new str[128];
	if(PlayerInfo[playerid][pDonateRank] != 0)
	{
		if(GottenTimeLeft[playerid] > 1)
		{
			format(str, sizeof(str), "You have %d minutes before you can /getgift again.", GottenTimeLeft[playerid]/60000);
			SendClientMessage(playerid, COLOR_LIGHTBLUE, str);
		}
		else return SendClientMessage(playerid, COLOR_GREY, "You may /getgift as you have no cooldown for it.");
	}
	else SendClientMessage(playerid, COLOR_GREY, "You are not a VIP!");
	return 1;
}

CMD:breakin(playerid, params[])
{
	new str[128];
	if(PlayerInfo[playerid][pScrew] >= 1 || PlayerInfo[playerid][pAdmin] >= 1337)
	{
		new biz = IsPlayerNearBiz(playerid);
		new house = IsPlayerNearHouse(playerid);
		new car = -1;
		new Float:vX, Float:vY, Float:vZ;
		for(new i = 0; i < MAX_VEHICLES; i++)
		{
			GetVehiclePos(i, vX, vY, vZ);
			if(IsPlayerInRangeOfPoint(playerid, 5.0, vX, vY, vZ))
			{
				car = i;
				break;
			}
		}
		if(biz == -1 && house == -1 && car == -1) return SendClientMessage(playerid, COLOR_GREY, "You aren't at a house/business/vehicle.");
		if(LockPickingBiz[playerid] != 999) return SendClientMessage(playerid, COLOR_GREY, "You are already lockpicking a business.");
		if(LockPickingHouse[playerid] != 999) return SendClientMessage(playerid, COLOR_GREY, "You are already lockpicking a house.");
		if(LockPickingCar[playerid] != -1) return SendClientMessage(playerid, COLOR_GREY, "You are already lockpicking a car.");
		if(biz != -1) //they are picking a biz
		{
			if(BizInfo[biz][bOwned] == 0) return SendClientMessage(playerid, COLOR_GREY, "This business is not owned.");
			if(BizInfo[biz][bLocked] == 0) return SendClientMessage(playerid, COLOR_GREY, "This business is already unlocked.");
			if(BizInfo[biz][bSeized] == 1) return SendClientMessage(playerid, COLOR_GREY, "That business is currently property of the government.");
			foreach( new i: Player )
			{
				if(IsPlayerConnected(i))
				{
					if(PlayerInfo[i][pBizKey] == biz)
					{
						format(str, sizeof(str), "SMS: This is an automated message informing you that your business alarm has been activated.", giveplayer);
						SendClientMessage(i, COLOR_YELLOW, str);
						break;
					}
				}
			}
			format(str, sizeof(str), "* %s pulls out a screwdriver and begins picking at the lock on the business.", PlayerICName(playerid));
			ProxDetector(30.0, playerid, str, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
			LockPickingBiz[playerid] = biz;
			if(PlayerInfo[playerid][pAdmin] < 1337) PlayerInfo[playerid][pScrew] -= 1;
		}
		else if(house != -1) //they are picking a home
		{
			if(HouseInfo[house][hOwned] == 0) return SendClientMessage(playerid, COLOR_GREY, "This house is not owned.");
			if(HouseInfo[house][hLocked] == 0) return SendClientMessage(playerid, COLOR_GREY, "This house is already unlocked.");
			foreach( new i: Player )
			{
				if(IsPlayerConnected(i))
				{
					if(PlayerInfo[i][pHouseID] == house)
					{
						format(str, sizeof(str), "SMS: This is an automated message informing you that your house alarm has been activated.", giveplayer);
						SendClientMessage(i, COLOR_YELLOW, str);
						break;
					}
				}
			}
			if(HouseInfo[house][hAlarm] == 1)
			{
				new Float:PX, Float:PY, Float:PZ, location[MAX_ZONE_NAME];
				Get2DZone(location, MAX_ZONE_NAME, HouseInfo[house][hOutsideX], HouseInfo[house][hOutsideY], HouseInfo[house][hOutsideZ]);
				format(str, sizeof(str), "** Dispatch: There has been reports of a break-in over at %d %s, postal code: %d, go check it out! **", house, location, HouseInfo[house][hSQLID]);
				SendRadioMessage(1, TEAM_BLUE_COLOR, str);
				foreach( new i: Player )
				{
					if(IsPlayerInRangeOfPoint(i, 30.0, PX, PY, PZ))
						PlayerPlaySound(i, 3401, 0.0, 0.0, 0.0);
				}
			}
			format(str, sizeof(str), "* %s pulls out a screwdriver and begins picking at the lock on the house.", PlayerICName(playerid));
			ProxDetector(30.0, playerid, str, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
			LockPickingHouse[playerid] = house;
			if(PlayerInfo[playerid][pAdmin] < 1337) PlayerInfo[playerid][pScrew] -= 1;// the hell is this?
			return 1;
		}
		breakinPlayerVehicle( playerid );
	}
	else return SendClientMessage(playerid, COLOR_GREY, "You do not have a screwdriver! You may purchase one from any 24/7.");
	return 1;
}

CMD:flashlight(playerid, params[])
{
	if(PlayerInfo[playerid][pMember] == 1 || PlayerInfo[playerid][pMember] == 2 || PlayerInfo[playerid][pMember] == 3 || PlayerInfo[playerid][pMember] == 5 || PlayerInfo[playerid][pMember] == FACTION_SANG)
	{
		if(!IsPlayerInAnyVehicle(playerid))
		{
			new type[8];
			if(sscanf(params, "s[8]", type)) return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /flashlight [enable/disable]");
			{
				if(strmatch(type, "enable"))
				{
					if(!hasFlashlight[playerid])
					{
						SetPlayerAttachedObject(playerid, FLASHLIGHT_SLOT1, 18656, 5, 0.1, 0.038, -0.1, -90, 180, 0, 0.03, 0.03, 0.03);
						SetPlayerAttachedObject(playerid, FLASHLIGHT_SLOT2, 18641, 5, 0.1, 0.02, -0.05, 0, 0, 0, 1, 1, 1);
						hasFlashlight[playerid] = true;
						SendClientMessage(playerid, COLOR_YELLOW, "You have equipped your flashlight.");
					}
					else return SendClientMessage(playerid, COLOR_GREY, "You already have the flashlight enabled.");
				}
				else if(strmatch(type, "disable"))
				{
					if(hasFlashlight[playerid])
					{
						RemovePlayerAttachedObject(playerid, FLASHLIGHT_SLOT1);
						RemovePlayerAttachedObject(playerid, FLASHLIGHT_SLOT2);
						hasFlashlight[playerid] = false;
						SendClientMessage(playerid, COLOR_YELLOW, "You have un-equipped your flashlight.");
					}
					else return SendClientMessage(playerid, COLOR_GREY, "You already have the flashlight disabled.");
				}
				else return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /flashlight [enable/disable]");
			}
		}
		else return SendClientMessage(playerid, COLOR_GREY, "You can't use this whilst inside of a vehicle.");
	}
	else return SendClientMessage(playerid, COLOR_GREY, "You aren't in the authorized faction to use this.");
	return 1;
}

CMD:loadrubber(playerid, params[])
{
	if(inPaintball[playerid] > 0) return SendClientMessage(playerid, COLOR_RED, "[WARNING] You are not allowed to use /loadrubber in the paintball.");
	if(IsAtEvent[playerid] == 1) return SendClientMessage(playerid, COLOR_RED, "[WARNING] You are not allowed to use /loadrubber in an event.");
	if(hasRubberBullets[playerid])
	{
		if(loadedRubberBullets[playerid])
		{
			loadedRubberBullets[playerid] = false;
			SendClientMessage(playerid, COLOR_YELLOW, "You have unloaded your rubber bullets.");
		}
		else
		{
			if(!HasGunInSlot(playerid, GetWeaponSlot(33))) return SendClientMessage(playerid, COLOR_GREY, "You must have a Country Rifle on your body to use these.");
			loadedRubberBullets[playerid] = true;
			SendClientMessage(playerid, COLOR_YELLOW, "You have loaded your rubber bullets.");
		}
	}
	else return AdmErrorMsg;
	return 1;
}

CMD:lockserver(playerid, params[])
{
	new str[128];
	if(PlayerInfo[playerid][pAdmin] >= 99999 || PlayerInfo[playerid][pDev] >= DEVRANK_SENIOR)
	{
		new pass[24];
		if(sscanf(params, "s[24]", pass)) {
			SendClientMessage(playerid, COLOR_GREY, "Note: use /lockserver 0 to unlock the server.");
			return SendClientMessage(playerid, COLOR_GREY, "Usage: /lockserver [new pass]");
		}

		format(str, sizeof(str), "Server password set to %s", pass);
		SendClientMessage(playerid, COLOR_GREY, str);
		format(str, sizeof(str), "password %s", pass);
		SendRconCommand(str);
	}
	return 1;
}

CMD:lockpick(playerid, params[]) return cmd_breakin(playerid, params);

CMD:rules(playerid, params[])
{
	new vstr[5120];
	format(vstr, sizeof(vstr), "{FFFFFF}Please read the following rules, breaking them may result in a kick/prison/ban/fine.\n\n");
	strins(vstr, "- {FF0000}Hacking{FFFFFF} - Using third party software that gives you an unfair advantage.\n", strlen(vstr));
	strins(vstr, "- {FF0000}Money Farming{FFFFFF} - Transfering money from an alternative account onto a main.\n", strlen(vstr));
	strins(vstr, "- {FF0000}Account Sharing{FFFFFF} - The account is yours and only yours.\n", strlen(vstr));
	strins(vstr, "- {FF0000}Server Advertising{FFFFFF} - Messages with IP addresses / advertisements for a server is not acceptable.\n", strlen(vstr));
	strins(vstr, "- {FF0000}Scamming Donations{FFFFFF} - Decieving others into paying you for a donation you charge-back / don't fulfill.\n", strlen(vstr));
	strins(vstr, "- {FF0000}Creating Alts to Avoid{FFFFFF} - Using alternative accounts to avoid admin punishment.\n\n", strlen(vstr));
	strins(vstr, "- {FF9900}Metagaming{FFFFFF} - Using information obtained out of characterly in character.\n", strlen(vstr));
	strins(vstr, "- {FF9900}Deathmatching{FFFFFF} - Killing someone without an in character reason.\n", strlen(vstr));
	strins(vstr, "- {FF9900}Killing on Sight{FFFFFF} - Killing someone on sight.\n", strlen(vstr));
	strins(vstr, "- {FF9900}Powergaming{FFFFFF} - Roleplaying something unrealistic / impossible & forcing roleplay onto others.\n", strlen(vstr));
	strins(vstr, "- {FF9900}Avoiding Roleplay{FFFFFF} - Failure to comply with any roleplay that you are engaged in.\n", strlen(vstr));
	strins(vstr, "- {FF9900}Non-RP Behaviour{FFFFFF} - Decisions that do not seem reasonable in a roleplay server.\n", strlen(vstr));
	strins(vstr, "- {FF9900}Non-RP Driving{FFFFFF} - Driving in an unreasonable way.\n", strlen(vstr));
	strins(vstr, "- {FF9900}Car Ramming/Parking{FFFFFF} - Intentionally using a car as a weapon.\n", strlen(vstr));
	strins(vstr, "- {FF9900}Chicken Running{FFFFFF} - Running unreasonably during a gunfight to prevent being shot.\n", strlen(vstr));
	strins(vstr, "- {FF9900}Quickswapping/Crackshooting{FFFFFF} - Using any exploit to speed up the reload / shooting time of any weapon.\n", strlen(vstr));
	strins(vstr, "- {FF9900}Logging/Tabbing to Avoid{FFFFFF} - Exiting / minimizing your game to avoid roleplay you're engaged in.\n", strlen(vstr));
	strins(vstr, "- {FF9900}Forcing a Game Crash{FFFFFF} - Exploiting features to force your client to time-out.\n", strlen(vstr));
	strins(vstr, "- {FF9900}Healing/Vesting During A Gunfight{FFFFFF} - Using any feature to heal during a gunfight.\n", strlen(vstr));
	strins(vstr, "- {FF9900}Scamming Above Limit{FFFFFF} - Scamming over the set limit is not allowed.\n", strlen(vstr));
	strins(vstr, "- {FF9900}Robbing Above Limit{FFFFFF} - Robbing over the set limit is not allowed.\n", strlen(vstr));
	strins(vstr, "- {FF9900}Scamming/Robbing Newbies{FFFFFF} - Scamming / Robbing a level 1-3.\n", strlen(vstr));
	strins(vstr, "- {FF9900}Ninja Jacking{FFFFFF} - Exploiting the hijack-kill glitch in SA:MP.\n", strlen(vstr));
	strins(vstr, "- {FF9900}Heliblading/Carbombing/Planebombing{FFFFFF} - Using the blades / explosions to kill players.\n", strlen(vstr));
	strins(vstr, "- {FF9900}Releasing Secret Information{FFFFFF} - Releasing secret infomation (hitman, etc).\n", strlen(vstr));
	strins(vstr, "- {FF9900}Insulting/Disrespecting Admins{FFFFFF} - Harassing the admins.\n", strlen(vstr));
	strins(vstr, "- {FF9900}Lying to Admins / Interfering with admin work{FFFFFF} - Lying / deceiving admins.\n", strlen(vstr));
	strins(vstr, "- {FF9900}Out Of Character Contracting{FFFFFF} - Using /contract on a player for no in character reason.\n", strlen(vstr));
	strins(vstr, "- {FF9900}Running man (AFK Kicker){FFFFFF} - Circumventing the auto AFK kicker.\n", strlen(vstr));
	strins(vstr, "- {FF9900}Exploiting{FFFFFF} - Using a feature to gain an advantage over others.\n", strlen(vstr));
	strins(vstr, "- {FF9900}Trolling{FFFFFF} - If you cross the line you can get {FF0000}permanently banned{FFFFFF}.\n\n", strlen(vstr));
	strins(vstr, "{FFFFFF}Legend: {FF0000}High Offense{FFFFFF} | {FF9900}Medium Offense\n", strlen(vstr));
	strins(vstr, "{FFFFFF}Please read all the rules at Coming soon. Punishments can also vary on level.\n\n", strlen(vstr));
	ShowPlayerDialog(playerid, DIALOG_UNUSED, DIALOG_STYLE_MSGBOX, "Server Rules", vstr, "Okay", "");
	return 1;
}

CMD:prices(playerid, params[])
{
	new vstr[5120];
	strins(vstr, "- {007BD0}Custom Icon{FFFFFF} - $6,000,000[$6M]\n", strlen(vstr));
	strins(vstr, "- {007BD0}Custom Gate{FFFFFF} - $8,000,000[$6M]\n", strlen(vstr));
	strins(vstr, "- {007BD0}Custom House Interior{FFFFFF} - $4,500,000[$4.M]\n", strlen(vstr));
	strins(vstr, "- {007BD0}Custom Business Interior{FFFFFF} -$ 5,500,000[$5M]\n", strlen(vstr));
	strins(vstr, "- {007BD0}Custom Phone Number{FFFFFF} - $6,000,000$\n", strlen(vstr));
	strins(vstr, "- {007BD0}Custom Icon{FFFFFF} - $6,000,000[6M]\n", strlen(vstr));
	ShowPlayerDialog(playerid, DIALOG_UNUSED, DIALOG_STYLE_MSGBOX, "Server Prices", vstr, "Done", "");
	return 1;
}

CMD:asay(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] >= 1337 || PlayerInfo[playerid][pDev] >= DEVRANK_SENIOR)//announce GMX
	{
		new message[128];
		if(sscanf(params, "s[128]", message)) return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /asay [message]");
		{
			new name[24];
			strmid(name, str_replace('_', ' ', PlayerName(playerid)), 0, MAX_PLAYER_NAME);
			new text1[128], text2[128];
			format(text1, sizeof(text1), "* Admin(%s): %s", name, message);
			format(text2, sizeof(text2), "* Admin: %s", message);
			foreach( new i: Player )
			{
				if(IsPlayerConnected(i))
				{
					if(PlayerInfo[i][pAdmin] && i != playerid)
					{
						SendClientMessage(i, COLOR_BLUE, text1);
					}
					else
					{
						SendClientMessage(i, COLOR_BLUE, text2);
					}
				}
			}
		}
	}
	else return AdmErrorMsg;
	return 1;
}

CMD:osetname(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] >= 1337)
	{
		new oldname[MAX_PLAYER_NAME], newname[MAX_PLAYER_NAME];
		if(sscanf(params, "s[24]s[24]", oldname, newname)) return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /osetname [full name(case sensitive)] [firstname_lastname]");

		if(GetPlayerIDFromName(oldname) != INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_GREY, "That player is currently logged in.");
		if(strlen(newname) > MAX_PLAYER_NAME) return SendClientMessage(playerid, COLOR_GREY, "{FF0000}Error:{FFFFFF} The new name is too long."); //invalid length

		// Replace space with underscore (for stupid admins)
		if(strfind(newname, " ", true) != -1) {
			strmid(newname, str_replace(' ', '_', newname), 0, MAX_PLAYER_NAME);
			SendClientMessage(playerid, COLOR_GREY, "Hint: You should not use spaces in names, it has been replaced with an underscore.");
		}

		new query[128];
		mysql_format(sqlGameConnection, query, sizeof(query), "SELECT `Name` FROM `players` WHERE `Name` = '%e'", newname);
		mysql_pquery(sqlGameConnection, query, "OnOSetNameCheck", "iss", playerid, newname, oldname);
	}
	else {
		return AdmErrorMsg;
	}
	return 1;
}

CMD:ocheck(playerid, params[])
{
	new playersname[MAX_PLAYER_NAME];
	if(PlayerInfo[playerid][pAdmin] >= 2)
	{
		if(sscanf(params, "s[24]", playersname)) return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /ocheck [full name (case sensitive)]");

		new giveplayerid = ReturnUser(playersname);
		if(IsPlayerConnected(giveplayerid)) return SendClientMessage(playerid, COLOR_GREY, "{FF0000}Error:{FFFFFF} That player is currently online.");

		new query[128];
		mysql_format(sqlGameConnection, query, sizeof(query), "SELECT * FROM `players` WHERE `Name` = '%e' LIMIT 1", playersname);
		mysql_pquery(sqlGameConnection, query, "OnOCheck", "is", playerid, playersname);
		return 1;
	}
	else
	{
		return AdmErrorMsg;
	}
}

CMD:fixcheckpoint(playerid, params[])
{
	if(checkpointInfo[playerid][cpX] == 0.0 && checkpointInfo[playerid][cpY] == 0.0 && checkpointInfo[playerid][cpZ] == 0.0) return SendClientMessage(playerid, COLOR_GREY, "You do not have an active checkpoint.");
	Timer_updatePlayerCheckpoint(playerid);
	SendClientMessage(playerid, COLOR_LIGHTBLUE, "* Your checkpoint has been updated, if you don't see it on the radar use /fixcheckpoint.");
	return 1;
}

CMD:removecctv(playerid, params[])
{
	new str[128];
	if(PlayerInfo[playerid][pAdmin] < 4) return AdmErrorMsg;
	new cctvid, filename[40];
	if(sscanf(params, "i", cctvid)) return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /removecctv [CameraID]");
	{
		format(filename, sizeof(filename), "CCTV/CCTV%i.ini", cctvid);
		if(dini_Exists(filename))
		{
			DeleteCCTVCam(cctvid);
			format(str, sizeof(str), "You have successfully removed CCTV Camera ID %d.", cctvid);
			SendClientMessage(playerid, COLOR_LIGHTBLUE, str);
		}
		else return SendClientMessage(playerid, COLOR_GREY, "Invalid CCTV ID.");
	}
	return 1;
}

CMD:addcctv(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] < 4) return AdmErrorMsg;
	new Float:x, Float:y, Float:z, string[128], cctvID = CCTVCount, name[24];
	GetPlayerPos(playerid, x, y, z);
	if(sscanf(params, "s[24]", name)) return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /addcctv [Full_Name (case sensitive - with underscore)]");
	{
		SaveCCTV(name, x, y, z, GetPlayerVirtualWorld(playerid), GetPlayerInterior(playerid), cctvID);
		format(string, sizeof(string), "[CCTV System] You have created a new CCTV with the ID of %d for %s.", cctvID, name);
		SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
		format(CCTV[cctvID][CCTVName], 50, "Not Set");
		format(CCTV[cctvID][CCTVOwner], 24, "%s", name);
		CCTV[cctvID][CCTVX] = x;
		CCTV[cctvID][CCTVY] = y;
		CCTV[cctvID][CCTVZ] = z;
		CCTV[cctvID][CCTVRX] = 0.0;
		CCTV[cctvID][CCTVRY] = 0.0;
		CCTV[cctvID][CCTVRZ] = 0.0;
		CCTV[cctvID][CCTVVW] = GetPlayerVirtualWorld(playerid);
		CCTV[cctvID][CCTVINT] = GetPlayerInterior(playerid);
		CCTV[cctvID][CCTVLookAtX] = 0.0;
		CCTV[cctvID][CCTVLookAtY] = 0.0;
		CCTV[cctvID][CCTVLookAtZ] = 0.0;
		CCTV[cctvID][CCTVObject] = CreateDynamicObject(CCTV_OBJID, x, y, z, 0.0, 0.0, 0.0);
	}
	return 1;
}

CMD:cctv(playerid, params[])
{
	if(IsPlayerRestricted(playerid) || PlayerInfo[playerid][pHospital] != 0 || pDeathState[playerid] == PLAYER_STATE_REVIVE) return SendClientMessage(playerid, COLOR_GREY, "You can not use this right now.");
	if(OnCCTV[playerid] != -1) return SendClientMessage(playerid, COLOR_GREY, "You're already using a CCTV Camera.");
	new cctvid;
	if(sscanf(params, "i", cctvid)) return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /cctv [camera ID] (Type /mycctvs to see the ID's of yours)");
	{
		if(strmatch(CCTV[cctvid][CCTVOwner], PlayerName(playerid)))
		{
			new Float:x, Float:y, Float:z, string[128];
			GetPlayerPos(playerid, x, y, z);
			CameraX[playerid] = x;
			CameraY[playerid] = y;
			CameraZ[playerid] = z;
			CameraInt[playerid] = GetPlayerInterior(playerid);
			CameraWorld[playerid] = GetPlayerVirtualWorld(playerid);
			format(string, sizeof(string), "* %s has loaded up their CCTV system. *", PlayerICName(playerid));
			SendActionMessage(playerid, 0xC2A2DAAA, string);
			SendClientMessage(playerid, COLOR_GREY, "INFO: Use the arrows on the screen to switch between your CCTVs. /quitcctv to quit it.");
			OnCCTV[playerid] = cctvid;
			TogglePlayerControllable(playerid, false);
			SetPlayerPos(playerid, CCTV[cctvid][CCTVX], CCTV[cctvid][CCTVY], CCTV[cctvid][CCTVZ]);
			SetPlayerCameraPos(playerid, CCTV[cctvid][CCTVX], CCTV[cctvid][CCTVY], CCTV[cctvid][CCTVZ]);
			SetPlayerVirtualWorld(playerid, CCTV[cctvid][CCTVVW]);
			SetPlayerInterior(playerid, CCTV[cctvid][CCTVINT]);
			SetPlayerCameraLookAt(playerid, CCTV[cctvid][CCTVLookAtX], CCTV[cctvid][CCTVLookAtY], CCTV[cctvid][CCTVLookAtZ]);

			// Showing the arrows //
			TextDrawShowForPlayer(playerid, CCTV_Arrows[0]); TextDrawShowForPlayer(playerid, CCTV_Arrows[1]);
			SelectTextDraw(playerid, 0x00FF00FF);
		}
		else return SendClientMessage(playerid, COLOR_GREY, "That CCTV isn't owned by you.");
	}
	return 1;
}

CMD:nextcctv(playerid) {

	new str[128];
	if(OnCCTV[playerid] == -1)
		return SendClientMessage(playerid, COLOR_GREY, "You need to be using a CCTV Camera.");

	for(new i = OnCCTV[playerid] + 1; i != OnCCTV[playerid]; i++) {

		if(i >= MAX_CCTV_DYNAMIC)
			i = 0;

		if(strmatch(CCTV[i][CCTVOwner], PlayerName(playerid))){

			OnCCTV[playerid] = i;

			SetPlayerPos(playerid, CCTV[i][CCTVX], CCTV[i][CCTVY], CCTV[i][CCTVZ]);
			SetPlayerCameraPos(playerid, CCTV[i][CCTVX], CCTV[i][CCTVY], CCTV[i][CCTVZ]);
			SetPlayerVirtualWorld(playerid, CCTV[i][CCTVVW]);
			SetPlayerInterior(playerid, CCTV[i][CCTVINT]);
			SetPlayerCameraLookAt(playerid, CCTV[i][CCTVLookAtX], CCTV[i][CCTVLookAtY], CCTV[i][CCTVLookAtZ]);

			format(str, sizeof(str), "You are now viewing CCTV ID: %d", i);
			return SendClientMessage(playerid, COLOR_GREY, str);
		}
	}

	return SendClientMessage(playerid, COLOR_GREY, "You do not have any more CCTVs.");
}

CMD:previouscctv(playerid) {

	new str[128];
	if(OnCCTV[playerid] == -1)
		return SendClientMessage(playerid, COLOR_GREY, "You need to be using a CCTV Camera.");

	for(new i = OnCCTV[playerid] - 1; i != OnCCTV[playerid]; i--) {

		if(i < 0)
			i = MAX_CCTV_DYNAMIC - 1;

		if(strmatch(CCTV[i][CCTVOwner], PlayerName(playerid))){

			OnCCTV[playerid] = i;

			SetPlayerPos(playerid, CCTV[i][CCTVX], CCTV[i][CCTVY], CCTV[i][CCTVZ]);
			SetPlayerCameraPos(playerid, CCTV[i][CCTVX], CCTV[i][CCTVY], CCTV[i][CCTVZ]);
			SetPlayerVirtualWorld(playerid, CCTV[i][CCTVVW]);
			SetPlayerInterior(playerid, CCTV[i][CCTVINT]);
			SetPlayerCameraLookAt(playerid, CCTV[i][CCTVLookAtX], CCTV[i][CCTVLookAtY], CCTV[i][CCTVLookAtZ]);

			format(str, sizeof(str), "You are now viewing CCTV ID: %d", i);
			return SendClientMessage(playerid, COLOR_GREY, str);
		}
	}

	return SendClientMessage(playerid, COLOR_GREY, "You do not have any more CCTVs.");
}

CMD:quitfamily(playerid, params[])
{
	new str[128];
	if(PlayerInfo[playerid][pFMember] < 255)
	{
		new conf[10];
		if(sscanf(params, "s[10]", conf)) return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /quitfamily 'confirm'");
		{
			if(strmatch("confirm", conf))
			{
				new family = PlayerInfo[playerid][pFMember];
				if(FamilyInfo[family][FamilyMembers] > 0) FamilyInfo[family][FamilyMembers]--;

				PlayerInfo[playerid][pRank] = 0;
				PlayerInfo[playerid][pMember] = 0;
				PlayerInfo[playerid][pLeader] = 0;
				PlayerInfo[playerid][pModel] = 20;
				PlayerInfo[playerid][pOnDuty] = 0;
				PlayerInfo[playerid][pRadio] = 0;
				PlayerInfo[playerid][pHandtazer] = 0;
				PlayerInfo[playerid][ptazerGun] = 0;
				if(PlayerInfo[playerid][pJailed] != 3 && PlayerInfo[playerid][pAdminJailed] == 0)
				{
					SetPlayerToTeamColor(playerid);
					SetPlayerSkin(playerid, PlayerInfo[playerid][pModel]);
					PlayerInfo[playerid][pClothes] = 0;
				}
				format(str, sizeof(str), "* You have quit the %s, you are now a civilian again.", FamilyInfo[family][FamilyName]);
				SendClientMessage(playerid, COLOR_LIGHTBLUE, str);
				customRankName[playerid] = false;
				format(customRank[playerid], 24, "None");
				PlayerInfo[playerid][pFMember] = 255;

			}
			else return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /quitfamily 'confirm'");
		}
	}
	else return SendClientMessage(playerid, COLOR_GREY, "You're not in a family!");
	return 1;
}
CMD:quitgang(playerid, params[]) return cmd_quitfamily(playerid, params);

CMD:quitfaction(playerid, params[])
{
	new str[128];
	new conf[10];
	if(sscanf(params, "s[10]", conf)) return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /quitfaction 'confirm'");
	if(strcmp(conf, "confirm", true) == 0)
	{
		switch(PlayerInfo[playerid][pMember])
		{
			case 1 .. 14:
			{
				if(IsACop(playerid) || PlayerInfo[playerid][pMember] == 5)
				{
					ClearGuns(playerid);
				}
				if(PlayerInfo[playerid][pMember] == 4)
				{
					ClearGuns(playerid);
				}
				if(playerHoldingTazer[playerid] == 1)
				{
					TakePlayerWeapon(playerid, 23);
				}
				if(playerHoldingTazer[playerid] == 2)
				{
					RemovePlayerAttachedObject(playerid, INDEX_7);
				}
				playerHoldingTazer[playerid] = 0;
				format(str, sizeof(str), "* You have quit the %s, you are now a civilian again.", GetPlayerFactionName(playerid));
				SendClientMessage(playerid, COLOR_LIGHTBLUE, str);
				customRankName[playerid] = false;
				format(customRank[playerid], 24, "None");
				PlayerInfo[playerid][pRank] = 0;
				PlayerInfo[playerid][pMember] = 0;
				PlayerInfo[playerid][pRecruiter] = 0;
				FakeFaction[playerid] = 0;
				PlayerInfo[playerid][pLeader] = 0;
				PlayerInfo[playerid][pModel] = 20;
				PlayerInfo[playerid][pOnDuty] = 0;
				PlayerInfo[playerid][pRadio] = 0;
				PlayerInfo[playerid][pHandtazer] = 0;
				PlayerInfo[playerid][ptazerGun] = 0;
				loadedRubberBullets[playerid] = false;
				hasRubberBullets[playerid] = 0;
				FakeFaction[playerid] = 0;
				FakeRank[playerid] = 0;
				PlayerInfo[playerid][pPortMDC] = 0;
				if(PlayerInfo[playerid][pJailed] != 3 && PlayerInfo[playerid][pAdminJailed] == 0)
				{
					SetPlayerToTeamColor(playerid);
					SetPlayerSkin(playerid, PlayerInfo[playerid][pModel]);
					PlayerInfo[playerid][pClothes] = 0;
				}
			}
		}
	}

	return 1;
}

CMD:quitcctv(playerid, params[])
{
	if(OnCCTV[playerid] != -1)
	{
		CancelSelectTextDraw(playerid);
		TextDrawHideForPlayer(playerid, CCTV_Arrows[0]); TextDrawHideForPlayer(playerid, CCTV_Arrows[1]);
		new string[128];
		SetPlayerPos(playerid, CameraX[playerid], CameraY[playerid], CameraZ[playerid]);
		SetPlayerVirtualWorld(playerid, CameraWorld[playerid]);
		SetPlayerInterior(playerid, CameraInt[playerid]);
		SetCameraBehindPlayer(playerid);
		TogglePlayerControllable(playerid, true);
		OnCCTV[playerid] = -1;
		CamPosLol(playerid);
		format(string, sizeof(string), "* %s has logged off their CCTV system. *", PlayerICName(playerid));
		SendActionMessage(playerid, 0xC2A2DAAA, string);
	}
	else return SendClientMessage(playerid, COLOR_GREY, "You're not using a CCTV camera at the minute.");
	return 1;
}

CMD:getcctvid(playerid, params[])
{
	new string[128], f;
	for(new i = 0; i < MAX_CCTV_DYNAMIC; i++)
	{
		if(IsPlayerInRangeOfPoint(playerid, 5.0, CCTV[i][CCTVX], CCTV[i][CCTVY], CCTV[i][CCTVZ]))
		{
			if(f == 0)
			{
				format(string, sizeof(string), "CCTV ID: %d", i);
				SendClientMessage(playerid, -1, string);
				f = 1;
			}
		}
	}
	if(f == 0) return SendClientMessage(playerid, COLOR_GREY, "There are no CCTV's in range.");
	return 1;
}

CMD:mycctvs(playerid, params[])
{
	new cams =0, string[512];
	for(new i = 0; i < MAX_CCTV_DYNAMIC; i++)
	{
		if(strmatch(CCTV[i][CCTVOwner], PlayerName(playerid)))
		{
			format(string, sizeof(string), "%s\n%s (ID %d)", string, CCTV[i][CCTVName], i);
			cams++;
		}
	}
	if(cams == 0) return SendClientMessage(playerid, COLOR_GREY, "You don't have any CCTV's.");
	else
	{
		ShowPlayerDialog(playerid, 0, DIALOG_STYLE_LIST, "My CCTV Cameras", string, "Close", "");
	}
	return 1;
}

CMD:editcctv(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] < 4) return AdmErrorMsg;

	new name[24], value[128], cctvid, filename[50], string[128];
	if(sscanf(params, "is[24]S()[128]", cctvid, name, value)) return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /editcctv [camera id] [position | lookat | interior | world | name]");
	{
		format(filename, sizeof(filename), "CCTV/CCTV%i.ini", cctvid);
		if(!dini_Exists(filename)) return SendClientMessage(playerid, COLOR_GREY, "That CCTV doesn't exist.");
		if(!strcmp(name, "position", true))
		{
			EditDynamicObject(playerid, CCTV[cctvid][CCTVObject]);
			EditingCamera[playerid] = true;
			CameraID[playerid] = cctvid;
			format(string, sizeof(string), "You have edited ID %d's CCTV position.", cctvid);
			SendClientMessage(playerid, -1, string);
		}
		if(!strcmp(name, "lookat", true))
		{
			new Float:x, Float:y, Float:z;
			GetPlayerPos(playerid, x, y, z);
			CCTV[cctvid][CCTVLookAtX] = x;
			CCTV[cctvid][CCTVLookAtY] = y;
			CCTV[cctvid][CCTVLookAtZ] = z;
			UpdateCCTV(cctvid);
			format(string, sizeof(string), "You have edited ID %d's CCTV look-at position to here.", cctvid);
			SendClientMessage(playerid, -1, string);
		}
		if(!strcmp(name, "interior", true))
		{
			new int = GetPlayerInterior(playerid);
			CCTV[cctvid][CCTVINT] = int;
			UpdateCCTV(cctvid);
			format(string, sizeof(string), "You have edited ID %d's CCTV interior to %d.", cctvid, int);
			SendClientMessage(playerid, -1, string);
		}
		if(!strcmp(name, "world", true))
		{
			new vw = GetPlayerVirtualWorld(playerid);
			CCTV[cctvid][CCTVVW] = vw;
			UpdateCCTV(cctvid);
			format(string, sizeof(string), "You have edited ID %d's CCTV world to %d", cctvid, vw);
			SendClientMessage(playerid, -1, string);
		}
		if(!strcmp(name, "name", true))
		{
			new val[64];
			if(sscanf(value, "S()[64]", val)) return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /editcctv [name] [new name]");
			if(!strlen(val)) return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /editcctv [camera id] [name] [new name]"); //not tested
			format(CCTV[cctvid][CCTVName], 50, "%s", val);
			UpdateCCTV(cctvid);
			format(string, sizeof(string), "You have edited ID %d's CCTV name to '%s'", cctvid, val);
			SendClientMessage(playerid, -1, string);
		}
	}
	return 1;
}

CMD:setsecuritykey(playerid, params[]){
	new string[256], option, securityid, key, query[128], name[50];
	if(PlayerInfo[playerid][pAdmin] < 1337) return AdmErrorMsg;
	if(sscanf(params, "d", option)) return SendClientMessage(playerid, COLOR_WHITE, "{00BFFF}Usage:{FFFFFF} /setsecuritykey [option] [0 = {FF0000}Offline{FFFFFF}, 1 = {00FF00}Online{FFFFFF}]");
	switch(option)
	{
		case 1:
		{
			if(sscanf(params, "ddd", option, securityid, key)) return SendClientMessage(playerid, COLOR_WHITE, "Usage: /setsecuritykey 1 [playerid] [new key]");
			if(!IsPlayerConnected(securityid)) return SendClientMessage(playerid, COLOR_RED, "[Error] - That player is not connected to the server.");
			//if(key < 0 || key > 4) return SendClientMessage(playerid, COLOR_RED, "[Error] - Key should be 4 digit long.");
			PlayerInfo[securityid][pSecKey] = key;
			format(string, sizeof(string), "Your security key was changed to %d by an admin.", PlayerInfo[securityid][pSecKey]);
			SendClientMessage(securityid, COLOR_LIGHTBLUE, string);
			format(string, sizeof(string), "You've updated %s's security key to %d.", PlayerOOCName(securityid), key);
			SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
		}
		case 0:
		{
			if(sscanf(params, "dsd", option, name, key)) return SendClientMessage(playerid, COLOR_WHITE, "Usage: /setsecuritykey 0 [playername] [new key]");
			//if(key < 0 || key > 4) return SendClientMessage(playerid, COLOR_RED, "[Error] - Key should be 4 digit long.");
			mysql_format(sqlGameConnection, query, sizeof(query), "SELECT * FROM `players` WHERE `Name` = '%e'", name);
			mysql_query(sqlGameConnection, query);
			if(cache_num_rows() > 0){
				mysql_format(sqlGameConnection, query, sizeof(query), "UPDATE `players` SET `SecurityKey` = %d WHERE `Name` = '%e'", key, name);
				mysql_query(sqlGameConnection, query);
				format(string, sizeof(string), "You've updated %s's security key to %d.", name, key);
				SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
			}
			else{
				SendClientMessage(playerid, COLOR_RED, "[Error] - Account with that name doesn't exists.");
			}
		}	
	}
	return 1;
}
/*CMD:setsecuritykey(playerid, params[])
{
	new str[128];
	if(PlayerInfo[playerid][pAdmin] >= 99999)
	{
		new id, key;
		if(sscanf(params, "ui", id, key)) return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /setsecuritykey [playerid/name] [new key]");
		{
			if(IsPlayerConnected(id))
			{
				PlayerInfo[id][pSecKey] = key;
				format(str, sizeof(str), "Your security key has been changed to %d by an admin.", PlayerInfo[id][pSecKey]);
				SendClientMessage(id, COLOR_LIGHTBLUE, str);

				format(str, sizeof(str), "You've updated %s's security key to %d.", PlayerOOCName(id), key);
				SendClientMessage(playerid, COLOR_LIGHTBLUE, str);
			}
			else return SendClientMessage(playerid, COLOR_GREY, "{FF0000}Error:{FFFFFF} That player isn't connected.");
		}
	}
	else SendClientMessage(playerid, COLOR_GREY, "You're not authorized to use this command.");
	return 1;
}*/

CMD:rollwindow(playerid, params[])
	return cmd_rw(playerid, params);

CMD:rw(playerid, params[])
{
	if(!IsPlayerInAnyVehicle(playerid))
		return SendClientMessage(playerid, COLOR_GREY, "You must be inside of a vehicle to use this.");

	if(!VehicleHasWindows(GetPlayerVehicleID(playerid)))
		return SendClientMessage(playerid, COLOR_GREY, "This vehicle doesn't have windows.");

	if(PlayerCuffed[playerid] > 0)
		return SendClientMessage(playerid, COLOR_GREY, "You can't use this whilst cuffed.");

	new window, PlayerSeat = GetPlayerVehicleSeat(playerid), window_state[4], vehicleid = GetPlayerVehicleID(playerid);

	if(sscanf(params, "i", window))
	{
		SendClientMessage(playerid, COLOR_GREY, "USAGE: /(r)oll(w)indow [Window ID]");
		SendClientMessage(playerid, COLOR_GREY, "[ 0 - Driver | 1 - Front Passanger | 2 - Back Driver | 3 - Back Passanger ]");
		return 1;
	}

	if(window != PlayerSeat && PlayerSeat != 0)
		return SendClientMessage(playerid, COLOR_GREY, "You cannot adjust a window for a seat you're not at if you're not the driver.");

    GetVehicleParamsCarWindows(vehicleid, window_state[0], window_state[1], window_state[2], window_state[3]);
    window_state[window] = !window_state[window];
    SetVehicleParamsCarWindows(vehicleid, window_state[0], window_state[1], window_state[2], window_state[3]);

    new str[128];

	format(str, sizeof(str), "* %s adjust a vehicle window.", PlayerICName(playerid));
	SetPlayerChatBubble(playerid, str, COLOR_PURPLE, 5.0, 5 * 1000); // 5 seconds

	return 1;
}

CMD:windows(playerid, params[])
{
	new str[128];
	if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You must be inside of a vehicle to use this.");
	if(!VehicleHasWindows(GetPlayerVehicleID(playerid))) return SendClientMessage(playerid, COLOR_GREY, "This vehicle doesn't have windows.");
	if(PlayerCuffed[playerid] > 0) return SendClientMessage(playerid, COLOR_GREY, "You can't use this whilst cuffed.");
	if(windowsDown[GetPlayerVehicleID(playerid)] == false)
	{
		windowsDown[GetPlayerVehicleID(playerid)] = true;
		format(str, sizeof(str), "* %s winds down the vehicles windows.", PlayerICName(playerid));
		ProxDetector(30.0, playerid, str, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
		SetVehicleParamsCarWindows(GetPlayerVehicleID(playerid), 0, 0, 0, 0);
	}
	else
	{
		windowsDown[GetPlayerVehicleID(playerid)] = false;
		format(str, sizeof(str), "* %s winds up the vehicles windows.", PlayerICName(playerid));
		ProxDetector(30.0, playerid, str, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
		SetVehicleParamsCarWindows(GetPlayerVehicleID(playerid), 1, 1, 1, 1);
	}
	return 1;
}

//motd
CMD:setmotd(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] < 4 && PlayerInfo[playerid][pDev] <= DEVRANK_MANAGER) return AdmErrorMsg;
	new motdtext[128];
	if(!sscanf(params, "s[128]", motdtext))
	{
		format(motdtext, sizeof(motdtext), "~b~MOTD:~w~ %s.", motdtext);
		TextDrawSetString(motd, motdtext);
		displayMOTDText(playerid);
		SendClientMessage(playerid, COLOR_LIGHTBLUE, "* You have set the message of the day.");
	}
	else
	{
		SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /setmotd [text]");
		displayMOTDText(playerid);
	}
	return 1;
}

CMD:createeventfund(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] < 4 && PlayerInfo[playerid][pEventModd] == 0) return AdmErrorMsg;
	if(isNextEvent > 0) return SendClientMessage(playerid, COLOR_GRAD1, "There is already a pending event, use /endevent.");
	new amount;
	if(!sscanf(params, "d", amount))
	{
		isNextEvent = 1;
		eventTime = amount;
		SendClientMessageToAll(COLOR_BLUE, "Event: An event is being created. Type /fundevent to help fund it.");
		updateEventTimeTextdraw();
		showEventHudForAll();
	}
	else
	{
		SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /createeventfund [hours]");
	}
	return 1;
}

CMD:endeventfund(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] < 4 && PlayerInfo[playerid][pEventModd] == 0) return AdmErrorMsg;
	if(isNextEvent == 0) return SendClientMessage(playerid, COLOR_GREY, "There is no pending event set up yet.");
	eventTime = 0;
	eventCash = 0;
	isNextEvent = 0;
	updateEventTimeTextdraw();
	updateEventFundsTextdraw();
	hideEventHudForAll();
	SendClientMessage(playerid, COLOR_LIGHTBLUE, "* You have ended the event fund.");
	return 1;
}

CMD:seteventfundtime(playerid, params[])
{
	new str[128];
	if(isNextEvent == 0) return SendClientMessage(playerid, COLOR_GREY, "There is no pending event set up yet.");
	if(PlayerInfo[playerid][pAdmin] < 4 && PlayerInfo[playerid][pEventModd] == 0) return AdmErrorMsg;
	new amount;
	if(!sscanf(params, "d", amount))
	{
		eventTime = amount;
		format(str, sizeof(str), "* You have set the next event to start in %d hours.", eventTime);
		SendClientMessage(playerid, COLOR_LIGHTBLUE, str);
		updateEventTimeTextdraw();
	}
	else
	{
		format(str, sizeof(str), "The next event will start in %d hours from now.", eventTime);
		SendClientMessage(playerid, COLOR_GREY, str);
		SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /seteventfundtime [hours]");
	}
	return 1;
}

CMD:seteventfunds(playerid, params[])
{
	new str[128];
	if(isNextEvent == 0) return SendClientMessage(playerid, COLOR_GREY, "There is no pending event set up yet.");
	if(PlayerInfo[playerid][pAdmin] < 4 && PlayerInfo[playerid][pEventModd] == 0) return AdmErrorMsg;
	if(isNextEvent)
	{
		new amount;
		if(!sscanf(params, "d", amount))
		{
			eventCash = amount;
			format(str, sizeof(str), "* You have set the event funds to $%d.", eventCash);
			SendClientMessage(playerid, COLOR_LIGHTBLUE, str);
			updateEventFundsTextdraw();
		}
		else
		{
			format(str, sizeof(str), "The current event funds are $%d.", eventCash);
			SendClientMessage(playerid, COLOR_GREY, str);
			SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /seteventfunds [amount]");
		}
	}
	else
	{
		SendClientMessage(playerid, COLOR_GREY, "There is no pending event set up yet.");
	}
	return 1;
}

CMD:withdraweventfunds(playerid, params[])
{
	new str[128];
	if(isNextEvent == 0) return SendClientMessage(playerid, COLOR_GREY, "There is no pending event set up yet.");
	if(PlayerInfo[playerid][pAdmin] < 4 && PlayerInfo[playerid][pEventModd] == 0) return AdmErrorMsg;
	new amount;
	if(!sscanf(params, "d", amount))
	{
		if(amount < 0 || amount > eventCash) return SendClientMessage(playerid, COLOR_GREY, "There is not that much money in the event funds.");
		eventCash -=amount;
		format(str, sizeof(str), "* You have withdrawn %d from the event funds, the new balance is $%d.", amount, eventCash);
		SendClientMessage(playerid, COLOR_LIGHTBLUE, str);
		updateEventFundsTextdraw();
	}
	else
	{
		format(str, sizeof(str), "The current event funds are $%d.", eventCash);
		SendClientMessage(playerid, COLOR_GREY, str);
		SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /withdraweventfunds [amount]");
	}
	return 1;
}

CMD:togeventhud(playerid, params[])
{
	// note: the hide/show functions already change the displayingEventHUD variable accordingly.
	if(displayingEventHUD[playerid]) // if shown, hide
	{
		hideEventHudForPlayer(playerid);
		SendClientMessage(playerid, COLOR_GREY, "You have disabled the event HUD.");
	}
	else if(!displayingEventHUD[playerid]) // if hidden, show
	{
		showEventHudForPlayer(playerid);
		SendClientMessage(playerid, COLOR_GREY, "You have enabled the event HUD.");
	}
}

CMD:giverank(playerid, params[])
{
	new str[128];
	if(PlayerInfo[playerid][pLeader] > 0)
	{
		new giveplayerid, newrank;
		format(str, sizeof(str), "{00BFFF}Usage:{FFFFFF} /giverank [playerid/PartOfName] [0-%d]", GetFactionMaxRanks(PlayerInfo[playerid][pMember]));
		if(sscanf(params, "u d", giveplayerid, newrank)) return SendClientMessage(playerid, COLOR_GREY, str);
		if(giveplayerid == playerid) return SendClientMessage(playerid, COLOR_GREY, "{FF0000}Error:{FFFFFF} You can't change your own rank.");
		if(!IsPlayerConnected(giveplayerid)) return SendClientMessage(playerid, COLOR_GREY, "{FF0000}Error:{FFFFFF} That player isn't connected.");
		if(PlayerInfo[giveplayerid][pMember] != PlayerInfo[playerid][pMember]) return SendClientMessage(playerid, COLOR_GREY, "That player isn't in your faction.");

		format(str, sizeof(str), "{FF0000}Error:{FFFFFF} Your factions ranks go from 0 to %d.", GetFactionMaxRanks(PlayerInfo[playerid][pMember]));
		if(newrank < 0 || newrank > GetFactionMaxRanks(PlayerInfo[playerid][pMember])) return SendClientMessage(playerid, COLOR_GREY, str);

		if(PlayerInfo[giveplayerid][pRank] > newrank || (FakeFaction[giveplayerid] == PlayerInfo[playerid][pLeader] && FakeRank[giveplayerid] > newrank))
		{
			format(str, sizeof(str), "* You have demoted %s to Rank %d.", PlayerICName(giveplayerid), newrank);
			SendClientMessage(playerid, COLOR_LIGHTBLUE, str);
			format(str, sizeof(str), "* You have been demoted to Rank %d by Leader %s.", newrank, PlayerICName(playerid));
			SendClientMessage(giveplayerid, COLOR_LIGHTBLUE, str);
		}
		else
		{
			format(str, sizeof(str), "* You have promoted %s to Rank %d.", PlayerICName(giveplayerid), newrank);
			SendClientMessage(playerid, COLOR_LIGHTBLUE, str);
			format(str, sizeof(str), "* You have been promoted to Rank %d by Leader %s.", newrank, PlayerICName(playerid));
			SendClientMessage(giveplayerid, COLOR_LIGHTBLUE, str);
		}

		PlayerInfo[giveplayerid][pRank] = newrank;
	}
	else
	{
		return SendClientMessage(playerid, COLOR_GRAD1, "{FF0000}Error:{FFFFFF} You are not a faction leader.");
	}
	return 1;
}

CMD:giveeventfunds(playerid, params[])
{
	new str[128];
	if(isNextEvent == 0) return SendClientMessage(playerid, COLOR_GREY, "There is no pending event set up yet.");
	if(PlayerInfo[playerid][pAdmin] < 4 && PlayerInfo[playerid][pEventModd] == 0) return AdmErrorMsg;
	new giveplayerid;
	if(!sscanf(params, "u", giveplayerid))
	{
		if(IsPlayerConnected(giveplayerid))
		{
			if(IsPlayerNPC(giveplayerid)) return 1;
			if(giveplayerid != INVALID_PLAYER_ID)
			{
				GiveMoney(giveplayerid, eventCash /2);
				format(str, sizeof(str), "Event: %s has won a total of $%d from the event.", PlayerICName(giveplayerid), eventCash /2);
				SendClientMessageToAll(COLOR_BLUE, str);
				eventCash = 0;
				updateEventFundsTextdraw();
			}
		}
		else
		{
			SendClientMessage(playerid, COLOR_GRAD1, "That player isn't active.");
		}
	}
	else
	{
		format(str, sizeof(str), "The current event funds are $%d.", eventCash);
		SendClientMessage(playerid, COLOR_GREY, str);
		SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /giveeventfunds [playerid]");
	}
	return 1;
}

CMD:fundevent(playerid, params[])
{
	new str[128];
	if(isNextEvent == 0) return SendClientMessage(playerid, COLOR_GREY, "There is no pending event set up yet.");
	if(PlayerInfo[playerid][pLevel] < 2) return SendClientMessage(playerid, COLOR_GRAD1, "You must be atleast level 2 to fund events.");
	new amount;
	if(!sscanf(params, "d", amount))
	{
		if(amount < 0 || amount > PlayerInfo[playerid][pCash]) return SendClientMessage(playerid, COLOR_GREY, "You can't afford that.");
		eventCash += amount;
		GiveMoney(playerid, -amount);
		format(str, sizeof(str), "* You have donated $%d to the event fund, the winner of the next event will receive half the total event funds.", amount);
		SendClientMessage(playerid, COLOR_LIGHTBLUE, str);
		updateEventFundsTextdraw();
		PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
		//announce highest donor
		if(amount >= 1000000)
		{
			if(amount > largestFund)
			{
				largestFund = amount;
				new name[24];
				strmid(name, str_replace('_', ' ', PlayerName(playerid)), 0, MAX_PLAYER_NAME);
				format(largestFunder, sizeof(largestFunder), "%s", name);
				format(str, sizeof(str), "Event: %s has set the new record with the largest donation of $%d.", name, amount);
				SendClientMessageToAll(COLOR_BLUE, str);
			}
		}
	}
	else
	{
		format(str, sizeof(str), "The current event funds are $%d.", eventCash);
		SendClientMessage(playerid, COLOR_GREY, str);
		SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /fundevent [amount]");
	}
	return 1;
}

CMD:eventhelp(playerid, params[])
{
	if(PlayerInfo[playerid][pEventModd] == 1)
	{
		SendClientMessage(playerid, COLOR_YELLOW, "____________________________________________");
		SendClientMessage(playerid, COLOR_WHITE, "COMMANDS: /event, /createeventfund, /endeventfund, /seteventfundtime, /seteventfunds, /withdraweventfunds, /giveeventfunds");
		SendClientMessage(playerid, COLOR_WHITE, "COMMANDS: /sethpradius, /setarmorradius, /setskinradius, /setdrunkradius, /sethp, /setarmor, /setskin, /getskin, /givegun, /veh, /destroycars, /destroycar");
	}
	if(PlayerInfo[playerid][pEventModd] == 1 || PlayerEventMod[playerid] == 1)
	{
		SendClientMessage(playerid, COLOR_YELLOW, "____________________________________________");
		SendClientMessage(playerid, COLOR_WHITE, "HELPER COMMANDS: /eventkick, /ec, /eventchat");
	}
	else return AdmErrorMsg;
	return 1;
}

CMD:reviveradius(playerid, params[])
{
	new str[128];
	if(PlayerInfo[playerid][pAdmin] >= 2 || PlayerInfo[playerid][pEventModd] > 0)
	{
		new Float:dist;
		new Float: plX, Float: plY, Float: plZ;
		if(!sscanf(params, "f", dist))
		{
			foreach( new i: Player )
			{
				if(playerid != i)
				{
					GetPlayerPos(i, plX, plY, plZ);
					if(IsPlayerInRangeOfPoint(playerid, dist, plX, plY, plZ))
					{
						if(pDeathState[i] == PLAYER_STATE_REVIVE)
						{
							SendClientMessage(i, COLOR_LIGHTBLUE, "* An admin has revived you.");
							SetPlayerHealth(i, 100);
							pInHospital[i] = 0;
							ResetPlayerDamages(i);
							pDeathState[i] = PLAYER_STATE_NORMAL;
							PlayerCalledEMS[i] = 0;
							/*if(IsDead[i] == true)
							{
								Delete3DTextLabel(dmginfo[i]);
								IsDead[i]= false;
								return 1;
							}*/
							ApplyAnimationEx(i, "PED", "getup_front", 4.0, 0, 1, 1, 0, 0, 1);
							for(new d = 0; d <= 12; d++)
							{
								lastpguns[i][d][0] = 0;
								lastpguns[i][d][1] = 0;
							}
							OnPlayerSave(i);
						}
					}
				}
			}
			format(str, sizeof(str), "{FF0000}AdmWarning{FFFFFF}: %s has revived everyone within %i metres.", PlayerICName(playerid), dist);
			ABroadCast(COLOR_WHITE, str, 1);
		}
		else
		{
			SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /reviveradius [distance]");
		}
	}
	else return AdmErrorMsg;
	return 1;
}


CMD:sethpradius(playerid, params[])
{
	new str[128];
	if(PlayerInfo[playerid][pAdmin] >= 4 || PlayerInfo[playerid][pEventModd] > 0)
	{
		new Float:dist, Float:amount;
		new Float: plX, Float: plY, Float: plZ;
		if(!sscanf(params, "ff", dist, amount))
		{
			if(amount <= 0.1)
			{
				format(str, sizeof(str), "{FF0000}AdmWarning{FFFFFF}: %s was killed, reason: Attempting to set everyones health to 0.", PlayerICName(playerid));
				ABroadCast(COLOR_WHITE, str, 1);
				SetPlayerHealth(playerid, 0);
				return 1;
			}
			foreach( new i: Player )
			{
				if(playerid != i)
				{
					GetPlayerPos(i, plX, plY, plZ);
					if(IsPlayerInRangeOfPoint(playerid, dist, plX, plY, plZ))
					{
						SendClientMessage(i, COLOR_LIGHTBLUE, "* An admin has set your health.");
						SetPlayerHealth(i, amount);
					}
				}
			}
			format(str, sizeof(str), "* You have set everyones health within %f metres to %f.",  dist, amount);
			SendClientMessage(playerid, COLOR_LIGHTBLUE, str);
		}
		else
		{
			SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /sethpradius [distance] [health]");
		}
	}
	else return AdmErrorMsg;
	return 1;
}

CMD:setarmorradius(playerid, params[])
{
	new str[128];
	if(PlayerInfo[playerid][pAdmin] >= 4 || PlayerInfo[playerid][pEventModd] > 0)
	{
		new dist, amount;
		new Float: plX, Float: plY, Float: plZ;
		if(!sscanf(params, "dd", dist, amount))
		{
			foreach( new i: Player )
			{
				if(playerid != i)
				{
					GetPlayerPos(i, plX, plY, plZ);
					if(IsPlayerInRangeOfPoint(playerid, dist, plX, plY, plZ))
					{
						SendClientMessage(i, COLOR_LIGHTBLUE, "* An admin has set your armor.");
						SetPlayerArmour(i, amount);
					}
				}
			}
			format(str, sizeof(str), "* You have set everyones armor within %d metres to %d.",  dist, amount);
			SendClientMessage(playerid, COLOR_LIGHTBLUE, str);
		}
		else
		{
			SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /setarmorradius [distance] [armor]");
		}
	}
	else return AdmErrorMsg;
	return 1;
}

CMD:setskinradius(playerid, params[])
{
	new str[128];
	if(PlayerInfo[playerid][pAdmin] >= 4 || PlayerInfo[playerid][pEventModd] == 1)
	{
		new dist, skinid;
		new Float: plX, Float: plY, Float: plZ;
		if(!sscanf(params, "dd", dist, skinid))
		{
			if(skinid < 0 || skinid > 311) return SendClientMessage(playerid, COLOR_GREY, "Skin can't be below 0 or above 311.");
			foreach( new i: Player )
			{
				if(playerid != i)
				{
					GetPlayerPos(i, plX, plY, plZ);
					if(IsPlayerInRangeOfPoint(playerid, dist, plX, plY, plZ))
					{
						SendClientMessage(i, COLOR_LIGHTBLUE, "* An admin has set your skin.");
						SetPlayerSkin(i, skinid);
						PlayerInfo[i][pClothes] = 0;
					}
				}
			}
			format(str, sizeof(str), "* You have set everyones skin within %d metres to %d.",  dist, skinid);
			SendClientMessage(playerid, COLOR_LIGHTBLUE, str);
		}
		else
		{
			SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /setskinradius [distance] [skinid (0-311)]");
		}
	}
	else return AdmErrorMsg;
	return 1;
}

CMD:setdrunkradius(playerid, params[])
{
	new str[128];
	if(PlayerInfo[playerid][pAdmin] >= 4 || PlayerInfo[playerid][pEventModd] > 0)
	{
		new dist, drunklevel;
		new Float: plX, Float: plY, Float: plZ;
		if(!sscanf(params, "dd", dist, drunklevel))
		{
			if(drunklevel < 0 || drunklevel > 50000) return SendClientMessage(playerid, COLOR_GREY, "Drunk level can't be below 0 or above 50000.");
			foreach( new i: Player )
			{
				if(playerid != i)
				{
					GetPlayerPos(i, plX, plY, plZ);
					if(IsPlayerInRangeOfPoint(playerid, dist, plX, plY, plZ))
					{
						SendClientMessage(i, COLOR_LIGHTBLUE, "* An admin has set your drunk level.");
						SetPlayerDrunkLevel(i, drunklevel);
					}
				}
			}
			format(str, sizeof(str), "* You have set everyones drunk level within %d metres to %d.",  dist, drunklevel);
			SendClientMessage(playerid, COLOR_LIGHTBLUE, str);
		}
		else
		{
			SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /setarmorradius [distance] [drunklevel (0-50000)]");
		}
	}
	else return AdmErrorMsg;
	return 1;
}

CMD:mutephone(playerid, params[])
{
	if(cellMuted[playerid])
	{
		cellMuted[playerid] = false;
		SendClientMessage(playerid, COLOR_YELLOW, "You have unmuted your cell-phone.");
	}
	else
	{
		cellMuted[playerid] = true;
		SendClientMessage(playerid, COLOR_YELLOW, "You have muted your cell-phone.");
	}
	return 1;
}

CMD:togfamchat(playerid, params[])
{
	new str[128];
	if(PlayerInfo[playerid][pRank] >= 5 && PlayerInfo[playerid][pFMember] != 255)
	{
		if(famTog[PlayerInfo[playerid][pFMember]] == false)
		{
			famTog[PlayerInfo[playerid][pFMember]] = true;
			format(str, sizeof(str), "* %s has toggled the family chat OFF for your family.", PlayerICName(playerid));
			SendNewFamilyMessage(PlayerInfo[playerid][pFMember], TEAM_AZTECAS_COLOR, str);
		}
		else
		{
			famTog[PlayerInfo[playerid][pFMember]] = false;
			format(str, sizeof(str), "* %s has toggled the family chat ON for your family.", PlayerICName(playerid));
			SendNewFamilyMessage(PlayerInfo[playerid][pFMember], TEAM_AZTECAS_COLOR, str);
		}
	}
	else return SendClientMessage(playerid, COLOR_GREY, "You're not a high enough rank to use this.");
	return 1;
}

CMD:togvhealthhud(playerid, params[])
{
	if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER) return SendClientMessage(playerid, COLOR_GREY, "You must be the driver of a vehicle to use this.");
	if(ToggedVHealth[playerid])
	{
		SendClientMessage(playerid, COLOR_LIGHTBLUE, "* You have enabled the damage hud.");
		PlayerTextDrawShow(playerid, VHealthTextDraw[playerid]);
		ToggedVHealth[playerid] = false;
	}
	else
	{
		SendClientMessage(playerid, COLOR_LIGHTBLUE, "* You have disabled the damage hud.");
		PlayerTextDrawHide(playerid, VHealthTextDraw[playerid]);
		ToggedVHealth[playerid] = true;
	}
	return 1;
}

CMD:togfuelhud(playerid, params[])
{
	if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER) return SendClientMessage(playerid, COLOR_GREY, "You must be the driver of a vehicle to use this.");
	if(ToggedFuel[playerid])
	{
		SendClientMessage(playerid, COLOR_LIGHTBLUE, "* You have enabled the fuel hud.");
		PlayerTextDrawShow(playerid, FuelTextdraw[playerid]);
		ToggedFuel[playerid] = false;
	}
	else
	{
		SendClientMessage(playerid, COLOR_LIGHTBLUE, "* You have disabled the fuel hud.");
		PlayerTextDrawHide(playerid, FuelTextdraw[playerid]);
		ToggedFuel[playerid] = true;
	}
	return 1;
}

CMD:togspeedhud(playerid, params[])
{
	if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER) return SendClientMessage(playerid, COLOR_GREY, "You must be the driver of a vehicle to use this.");
	if(ToggedSpeedo[playerid])
	{
		SendClientMessage(playerid, COLOR_LIGHTBLUE, "* You have enabled the speedo hud.");
		PlayerTextDrawShow(playerid, SpeedoTextdraw[playerid]);
		ToggedSpeedo[playerid] = false;
	}
	else
	{
		SendClientMessage(playerid, COLOR_LIGHTBLUE, "* You have disabled the speedo hud.");
		PlayerTextDrawHide(playerid, SpeedoTextdraw[playerid]);
		ToggedSpeedo[playerid] = true;
	}
	return 1;
}

//MySQL commands
//process shop orders. the /ashophelp commands could probably be lowered to 1337 so they get processed more efficiently
CMD:processorder(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] >= 99999 || PlayerInfo[playerid][pShopMod] != 0)
	{
		new orderid;
		if(!sscanf(params, "d", orderid))
		{
			new query[310];
			format(query, sizeof(query), "UPDATE `order` SET `order`.order_status_id = 15, `order`.date_modified = NOW() WHERE `order`.order_id = '%d'", orderid);
			mysql_counted_query(sqlShopConnection, query, true, "onProcessOrder", "dd", playerid, CINC[playerid]);
			//escape string
			new admin_name[MAX_PLAYER_NAME];
			mysql_real_escape_string(PlayerName(playerid), admin_name);
			format(query, sizeof(query), "INSERT INTO `order_history` (order_id, order_status_id, comment, date_added) VALUES (%d, 15, 'Processed ingame by %s', NOW())", orderid, admin_name);
			mysql_counted_query(sqlShopConnection, query, true, "onEmptyQuery", "dd", playerid, CINC[playerid]);
		}
		else
		{
			SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /processorder [orderid]");
		}
	}
	else return AdmErrorMsg;
	return 1;
}

CMD:checkorderinfo(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] >= 99999 || PlayerInfo[playerid][pShopMod] != 0)
	{
		new orderid;
		if(!sscanf(params, "d", orderid))
		{
			new query[310];
			//format(query, sizeof(query), "SELECT `order`.firstname, `order`.lastname, `order`.order_id, `order`.email, `order`.comment, `order`.date_added, `order`.date_modified, `order`.order_status_id, `order_status`.name FROM `order`, `order_status` WHERE `order`.order_id = '%d' AND `order`.order_status_id = `order_status`.order_status_id", orderid);
			format(query, sizeof(query), "SELECT `order`.firstname, `order`.lastname, `order`.order_id, `order`.email, `order`.comment, `order`.date_added, `order`.date_modified, `order`.order_status_id FROM `order` WHERE `order`.order_id = '%d'", orderid);
			mysql_counted_query(sqlShopConnection, query, true, "onCheckOrderInfo", "dd", playerid, CINC[playerid]);
		}
		else
		{
			SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /checkorderinfo [orderid]");
		}
	}
	else return AdmErrorMsg;
	return 1;
}

CMD:checkpurchaseinfo(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] >= 99999 || PlayerInfo[playerid][pShopMod] != 0)
	{
		new orderid;
		if(!sscanf(params, "d", orderid))
		{
			new query[310];
			format(query, sizeof(query), "SELECT `order_product`.order_id, `order_product`.name, `order_product`.quantity FROM `order_product` WHERE `order_product`.order_id = '%d' ORDER BY `order_product`.order_product_id DESC LIMIT 10", orderid);
			mysql_counted_query(sqlShopConnection, query, true, "onCheckPurchaseInfo", "dd", playerid, CINC[playerid]);
		}
		else
		{
			SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /checkpurchaseinfo [orderid]");
		}
	}
	else return AdmErrorMsg;
	return 1;
}

//boombox
CMD:edit(playerid, params[])
{
	if(disabledRadios[playerid]) return SendClientMessage(playerid, COLOR_GREY, "Radio streaming is currently turned off, use /togradios.");
	if(IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You cannot edit a boombox while in a vehicle.");
	if(isBoomboxWithinRange(playerid, 3))
	{
		editingBoomboxID[playerid] = getOwnerOfClosestBoombox(playerid);
		if(BoomboxInfo[editingBoomboxID[playerid]][locked] && editingBoomboxID[playerid] != playerid)
		{
			SendClientMessage(playerid, COLOR_GREY, "You must be the owner to use a locked boombox.");
			editingBoomboxID[playerid] = -1;
			EDITING_TYPE[playerid] = EDIT_RADIO_NONE;
			return 1;
		}
		EDITING_TYPE[playerid] = EDIT_RADIO_BOOMBOX;
		displayBoomboxEditDialog(playerid);
	}
	else
	{
		return SendClientMessage(playerid, COLOR_GREY, "You are not near a Boombox.");
	}
	return 1;
}

CMD:placeboombox(playerid, params[])
{
	if(PlayerTied[playerid] != 0 || PlayerCuffed[playerid] != 0 || PlayerTazed[playerid] != 0 || pDeathState[playerid] != PLAYER_STATE_NORMAL) return SendClientMessage(playerid, COLOR_GRAD1, "You are unable to do that at this time.");
	if(disabledRadios[playerid]) return SendClientMessage(playerid, COLOR_GREY, "Radio streaming is currently turned off, use /togradios.");
	if(PlayerInfo[playerid][pStereo] == 0) return SendClientMessage(playerid, COLOR_GREY, "You do not have a boombox.");
	if(!BoomboxInfo[playerid][placedBoombox])
	{
		if(IsPlayerInAnyVehicle(playerid))
		{
			SendClientMessage(playerid, COLOR_GREY, "{FF0000}Error:{FFFFFF} You cannot use this while in a car.");
			return 1;
		}
		if(GetPlayerSurfingVehicleID(playerid) != INVALID_VEHICLE_ID)
		{
			SendClientMessage(playerid, COLOR_GREY, "You cannot use this while on a car.");
			return 1;
		}
		if(isBoomboxWithinRange(playerid, 60)) return SendClientMessage(playerid, COLOR_GREY, "You cannot place a boombox within 60 metres of another.");
		placeBoomboxOnGround(playerid, PlayerInfo[playerid][pStereo]);
		Streamer_Update(playerid);
	}
	else
	{
		SendClientMessage(playerid, COLOR_GREY, "You have aleady placed a boombox, to pick it up, go to it and type /edit.");
	}
	return 1;
}

CMD:radios(playerid, params[])
{
	new rstr[128];
	for(new i = 0; i < sizeof(radioInfo); i++)
	{
		format(rstr, sizeof(rstr), "Radio: %d, Taken %d, Genre: %s, Channel: %s, Owner: %s, URL: %s Online: %d", i +1, radioInfo[i][taken], radioInfo[i][genreName], radioInfo[i][channelName], radioInfo[i][ownerName], radioInfo[i][url], radioInfo[i][online]);
		SendClientMessage(playerid, COLOR_WHITE, rstr);
	}
}

CMD:carradio(playerid, params[])
{
	if(disabledRadios[playerid])
		return SendClientMessage(playerid, COLOR_GREY, "Radio streaming is currently turned off, use /togradios.");

	if(!IsPlayerInAnyVehicle(playerid))
		return SendClientMessage(playerid, COLOR_GREY, "You are not in a vehicle.");

	new seat = GetPlayerVehicleSeat(playerid);
	if(seat != 0 && seat != 1)
		return SendClientMessage(playerid, COLOR_GREY, "You are not the driver or front passenger.");

	new vehid = GetPlayerVehicleID(playerid);
	if(IsABicycle(vehid))
		return SendClientMessage(playerid, COLOR_GREY, "This vehicle doesn't have a radio.");

	if(VehicleInfo[vehid][radioStation])
		ShowPlayerDialog(playerid, DIALOG_CAR_MENU_MAIN, DIALOG_STYLE_LIST, "Radio station", "Turn Off\nChange Station", "Select", "Cancel");
	else
		ShowPlayerDialog(playerid, DIALOG_CAR_MENU_MAIN, DIALOG_STYLE_LIST, "Radio station", "Turn On\nChange Station", "Select", "Cancel");

	return 1;
}



CMD:listnewbies(playerid, params[])
{
	new str[128];
	if(!ADuty[playerid] && PlayerInfo[playerid][pAdmin] == 1) return SendClientMessage(playerid, COLOR_GREY, "You are not on duty.");
	if(PlayerInfo[playerid][pHelper] > 1 || PlayerInfo[playerid][pAdmin] > 0)
	{
		SendClientMessage(playerid, COLOR_WHITE, "Newbies:");
		foreach( new i: Player )
		{
			if(PlayerInfo[i][pLevel] < 2 && PlayerInfo[i][pLevel] > 0)
			{
				format(str, sizeof(str), "Name: %s (%d), Level: %d, Playing hours: %d", PlayerICName(i), i, PlayerInfo[i][pLevel], PlayerInfo[i][pConnectTime]);
				SendClientMessage(playerid, COLOR_GRAD1, str);
			}
		}
	}
	else return AdmErrorMsg;
	return 1;
}

CMD:families(playerid, params[])
{
	new famstr[2048];
	for(new i = 0; i < sizeof(FamilyInfo); i++)
	{
		format(famstr, sizeof(famstr), "%s\n%d\t%s", famstr, i +1, FamilyInfo[i][FamilyName]);
	}
	ShowPlayerDialog(playerid, FAMILY_DIALOG, DIALOG_STYLE_LIST, "Families", famstr, "Ok", "Cancel");
	return 1;
}

CMD:aannounce(playerid, params[])
{
	new str[128];
	if(PlayerInfo[playerid][pAdmin] >= 99999)
	{
		new msg[128], option;
		if(sscanf(params, "is[128]", option, msg)) return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /aannounce [id (1-5)] [new message]");
		{
			switch(option)
			{
				case 1:
				{
					dini_Set("automsg.ini", "motd1", msg);
					format(autoMessages[1], 128, "%s", msg);
					format(str, sizeof(str), "You have set the new message for slot %d to:", option);
					SendClientMessage(playerid, -1, str);
					format(str, sizeof(str), "%s", msg);
					SendClientMessage(playerid, -1, str);
				}
				case 2:
				{
					dini_Set("automsg.ini", "motd2", msg);
					format(autoMessages[2], 128, "%s", msg);
					format(str, sizeof(str), "You have set the new message for slot %d to:", option);
					SendClientMessage(playerid, -1, str);
					format(str, sizeof(str), "%s", msg);
					SendClientMessage(playerid, -1, str);
				}
				case 3:
				{
					dini_Set("automsg.ini", "motd3", msg);
					format(autoMessages[3], 128, "%s", msg);
					format(str, sizeof(str), "You have set the new message for slot %d to:", option);
					SendClientMessage(playerid, -1, str);
					format(str, sizeof(str), "%s", msg);
					SendClientMessage(playerid, -1, str);
				}
				case 4:
				{
					dini_Set("automsg.ini", "motd4", msg);
					format(autoMessages[4], 128, "%s", msg);
					format(str, sizeof(str), "You have set the new message for slot %d to:", option);
					SendClientMessage(playerid, -1, str);
					format(str, sizeof(str), "%s", msg);
					SendClientMessage(playerid, -1, str);
				}
				case 5:
				{
					dini_Set("automsg.ini", "motd5", msg);
					format(autoMessages[5], 128, "%s", msg);
					format(str, sizeof(str), "You have set the new message for slot %d to:", option);
					SendClientMessage(playerid, -1, str);
					format(str, sizeof(str), "%s", msg);
					SendClientMessage(playerid, -1, str);
				}
				default:
					SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /aannounce [id (1-5)] [new message]");
			}
		}
	}
	else return SendClientMessage(playerid, COLOR_WHITE, "You're not authorized to use this command.");
	return 1;
}

CMD:streamtoall(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] >= 2)
	{
		new song[128], songname[128], songartist[128], string[128];
		if(sscanf(params, "s[128]s[128]s[128]", song, songname, songartist)) return SendClientMessage(playerid, COLOR_GRAD1, "{00BFFF}Usage:{FFFFFF} /streamtoall linkmp3 [Song Name (Underscore for space)] [Song Artist (Underscore for space)]");
		{
			for(new i = 0; i < strlen(songname); i++)
			{
				if(songname[i] == '_')
				{
					songname[i] = ' ';
				}
			}
			for(new i = 0; i < strlen(songartist); i++)
			{
				if(songartist[i] == '_')
				{
					songartist[i] = ' ';
				}
			}
			for(new i = 0; i < MAX_PLAYERS; i++)
			{
				if(IsPlayerConnected(i))
				{
					if(GetPVarInt(i, "AudioDisabled") != 1)
					{
						format(string, sizeof(string), "Song playing: %s by %s.", songname, songartist);
						SendClientMessage(i, COLOR_ORANGE, string);
						SendClientMessage(i, COLOR_ORANGE, "Type /stopplay to stop the music, /toggleplay to toggle all streams.");
						if(disabledRadios[i] == 0){
							PlayAudioStreamForPlayer(i, song);
						}
					}
				}
			}
		}
	}
	return 1;
}

CMD:stopplay(playerid, params[])
{
	StopAudioStreamForPlayer(playerid);
	FixPlayerRadio(playerid);
	SendClientMessage(playerid, COLOR_ORANGE, "Audio stopped! /toggleplay to toggle it so you don't need to /stopplay again!");
	return 1;
}

CMD:toggleplay(playerid, params[])
{
	if(GetPVarInt(playerid, "AudioDisabled") == 0)
	{
		StopAudioStreamForPlayer(playerid);
		FixPlayerRadio(playerid);
		SetPVarInt(playerid, "AudioDisabled", 1);
		SendClientMessage(playerid, COLOR_ORANGE, "Audio disabled!");
	}
	else
	{
		SetPVarInt(playerid, "AudioDisabled", 0);
		SendClientMessage(playerid, COLOR_ORANGE, "Audio enabled!");
	}
	return 1;
}

CMD:checkstrikes(playerid, params[]) {
	if(PlayerInfo[playerid][pAdmin] < 1337 && !PlayerInfo[playerid][pGangDirector])
		return AdmErrorMsg;

	new targetFamily;
	if(sscanf(params, "i", targetFamily))
		return SendClientMessage(playerid, COLOR_WHITE, "{00BFFF}Usage:{FFFFFF} /checkstrikes [family]");

	if(targetFamily	< 1 || targetFamily > 20)
		return SendClientMessage(playerid, COLOR_GREY, "Families range from 1 to 20. (/families)");

	targetFamily -= 1;

	new str[128];

	if(FamilyInfo[targetFamily][FamilyTaken] != 1)
		return SendClientMessage(playerid, COLOR_GREY, "You have entered an unknown family ID. (/families)");

	format(str, sizeof(str), "* '%s' currently has [%i/%i] family strikes.", FamilyInfo[targetFamily][FamilyName], FamilyInfo[targetFamily][FStrikes], MAX_FAMILY_STRIKE);
	SendClientMessage(playerid, COLOR_LIGHTBLUE, str);

	format(str, sizeof(str), "* They are %i strike(s) away from being disbanded.", MAX_FAMILY_STRIKE - FamilyInfo[targetFamily][FStrikes]);
	SendClientMessage(playerid, COLOR_LIGHTBLUE, str);
	return 1;
}

CMD:givestrike(playerid, params[]) {
	if(PlayerInfo[playerid][pAdmin] < 1337 && !PlayerInfo[playerid][pGangDirector])
		return AdmErrorMsg;

	new targetFamily, strikeRsn[100];
	if(sscanf(params, "is[100]", targetFamily, strikeRsn))
		return SendClientMessage(playerid, COLOR_WHITE, "{00BFFF}Usage:{FFFFFF} /givestrike [family] [reason]");

	if(targetFamily	< 1 || targetFamily > 20)
		return SendClientMessage(playerid, COLOR_GREY, "Families range from 1 to 20. (/families)");

	targetFamily -= 1;

	if(FamilyInfo[targetFamily][FamilyTaken] != 1)
		return SendClientMessage(playerid, COLOR_GREY, "You have entered an unknown family ID. (/families)");

	if(!strlen(strikeRsn))
		return SendClientMessage(playerid, COLOR_GREY, "Enter a valid reason for this strike.");
	new str[128];
	format(str, sizeof(str), "* You have striked \"%s\" [%i].", FamilyInfo[targetFamily][FamilyName], targetFamily + 1);
	SendClientMessage(playerid, COLOR_LIGHTBLUE, str);

	FamilyInfo[targetFamily][FStrikes]++;

	format(str, sizeof(str), "SERVER: Family '%s' has received a strike, reason: %s", FamilyInfo[targetFamily][FamilyName], strikeRsn);
	SendClientMessageToAll(COLOR_WHITE, str);

	if(FamilyInfo[targetFamily][FStrikes] >= MAX_FAMILY_STRIKE) {
		StrikeDisband(targetFamily);
	}

	SaveFamilies();
	return 1;
}

CMD:setstrikes(playerid, params[]) {
	if(PlayerInfo[playerid][pAdmin] < 1337 && !PlayerInfo[playerid][pGangDirector])
		return AdmErrorMsg;

	new targetFamily, strikeAmount;
	if(sscanf(params, "ii", targetFamily, strikeAmount))
		return SendClientMessage(playerid, COLOR_WHITE, "{00BFFF}Usage:{FFFFFF} /setrikes [family] [amount]");

	if(targetFamily	< 1 || targetFamily > 20)
		return SendClientMessage(playerid, COLOR_GREY, "Families range from 1 to 20. (/families)");

	targetFamily -= 1;

	if(FamilyInfo[targetFamily][FamilyTaken] != 1)
		return SendClientMessage(playerid, COLOR_GREY, "You have entered an unknown family ID. (/families)");

	if(strikeAmount < 0 || strikeAmount > MAX_FAMILY_STRIKE)
		return SendClientMessage(playerid, COLOR_GREY, "You entered an invalid amount of strkes.");
	new str[128];
	format(str, sizeof(str), "* Family \"%s\" [%i] strikes set to %i.", FamilyInfo[targetFamily][FamilyName], targetFamily + 1, strikeAmount);
	SendClientMessage(playerid, COLOR_LIGHTBLUE, str);

	FamilyInfo[targetFamily][FStrikes] = strikeAmount;

	if(FamilyInfo[targetFamily][FStrikes] >= MAX_FAMILY_STRIKE) {
		StrikeDisband(targetFamily);
	}

	SaveFamilies();
	return 1;
}

CMD:changeclothes(playerid, params[]) {
	if(	!IsPlayerInRangeOfPoint(playerid, 5.0, 771.1835, 976.9742, 9022.7188) ||
		GetPlayerVirtualWorld(playerid) != DOC_WORLD ||
		GetPlayerInterior(playerid) != DOC_INT)
		return 1;

	if(	PlayerInfo[playerid][pModel] == 97 ||
		PlayerInfo[playerid][pModel] == 140)
		return SendClientMessage(playerid, COLOR_GREY, "You are already ready to shower.");

	if(GetPlayerSkin(playerid) == 97 || GetPlayerSkin(playerid) == 140) {
		SetPlayerSkin(playerid, PlayerInfo[playerid][pModel]);
		cmd_ame(playerid, "puts on their clothes.");
	}
	else {
		if(PlayerInfo[playerid][pSex] == 1) {
			SetPlayerSkin(playerid, 97);
		}
		else {
			SetPlayerSkin(playerid, 140);
		}

		cmd_ame(playerid, "takes off their clothes.");
	}

	OnePlayAnim(playerid, "BOMBER", "BOM_Plant", 4.0, 0, 0, 0, 0, 0);
	return 1;
}

CMD:gotodoc(playerid, params[]) {
	if(PlayerInfo[playerid][pAdmin] < 2)
		return AdmErrorMsg;

	new docLocation[50];
	if(sscanf(params, "s[50]", docLocation)) {
		SendClientMessage(playerid, COLOR_WHITE, "{00BFFF}Usage:{FFFFFF} /gotodoc [location]");
		SendClientMessage(playerid, COLOR_WHITE, "Locations: lobby, staff, cells, visitor1, visitor2, showers, hallway");
		return 1;
	}

	if(!strcmp(docLocation, "lobby", true)) SetPlayerPos(playerid, 690.6022, 1509.7754, 9001.9629);
	else if(!strcmp(docLocation, "staff", true)) SetPlayerPos(playerid, 402.9328, 2255.1248, 9002.6348);
	else if(!strcmp(docLocation, "cells", true)) SetPlayerPos(playerid, -1791.5765, 2242.0889, 8011.7285);
	else if(!strcmp(docLocation, "visitor1", true)) SetPlayerPos(playerid, 694.8245, 1524.1105, 9000.9902);
	else if(!strcmp(docLocation, "visitor2", true)) SetPlayerPos(playerid, 693.8306, 1536.5576, 9000.9902);
	else if(!strcmp(docLocation, "showers", true)) SetPlayerPos(playerid, 775.9997, 977.6572, 9022.7188);
	else if(!strcmp(docLocation, "hallway", true)) SetPlayerPos(playerid, -1764.0994, 2244.7695, 8011.7285);
	else return SendClientMessage(playerid, COLOR_GREY, "The location you entered is invalid.");

	SetPlayerVirtualWorld(playerid, DOC_WORLD);
	SetPlayerInterior(playerid, DOC_INT);
	Timer_FreezePlayer(playerid, FREEZE, ENTER_FREEZE);
	return 1;
}

CMD:ahelp(playerid, params[])
{
	new string[6012];
	new alevel = PlayerInfo[playerid][pAdmin];
	if(alevel > 0)
	{
		if(alevel >= 1)
		{
			strcat(string, "{FF00FF}Probationary Admin:{FFFFFF} /skick /sban /getbanreason /spec /goto /setworld (/a)dmin /listnewbies /inmates\n");
			strcat(string, "{FF00FF}Probationary Admin:{FFFFFF} /acceptunmute /d(amage)i(nfo) /detect /clearads /toga /sendtols /lastdriver\n");
			strcat(string, "{FF00FF}Probationary Admin:{FFFFFF} /c(heck)p(rison)(time) /getip /ch /revive /respawncars (only in /spec) /getserial\n");
			strcat(string, "{FF00FF}Probationary Admin:{FFFFFF} /watch /listguns /clearchat /approvename /denyname /namerequests /asw /atogpms\n");
		}
		if(alevel >= 2)
		{
			strcat(string, "\n");
			strcat(string, "{00FF00}Junior Admin:{FFFFFF} /setpborders /insertpointrule /deletepointrule /updatepointrule /clearpointrules\n");
			strcat(string, "{00FF00}Junior Admin:{FFFFFF} /oprison /ofine /gethere /check /listfrozen /aremovejammer /jammerowner\n");
			strcat(string, "{00FF00}Junior Admin:{FFFFFF} /goincar /setskin /getskin /pfine /opfine /fine /prison /o(oc) /aeject /checkinv\n");
			strcat(string, "{00FF00}Junior Admin:{FFFFFF} /gotocar /getcarhere /skiphosp /fly /aenter /near /gotodoc /sethp /setarmor\n");
			strcat(string, "{00FF00}Junior Admin:{FFFFFF} /checkcars /uncuff /removetag /tags /deaths /checkdeath\n");
			strcat(string, "{00FF00}Junior Admin:{FFFFFF} /removefakebadge /warns /owarn\n");
		}
		if(alevel >= 3)
		{
			strcat(string, "\n");
			strcat(string, "{04B404}General Admin:{FFFFFF} /noooc /nonewbie /jail /startlotto /(goto)mark /fine /gotoint /gotocoords /removetag\n");
			strcat(string, "{04B404}General Admin:{FFFFFF} /oldcar /mole /disarm /stealth /skydive /lockannouncement /setannouncement /tags\n");
			strcat(string, "{04B404}General Admin:{FFFFFF} /doorinfo /anticheat /disableaccount /allowrobbank\n");
		}
		if(alevel >= 4)
		{
			strcat(string, "\n");
			strcat(string, "{F4A460}Senior Admin:{FFFFFF} /setchamp /sethpall /setarmorall /setfightstyle /setname /amovegate /aouninvite\n");
			strcat(string, "{F4A460}Senior Admin:{FFFFFF} /setcolor /setplayercolor /givegun(all) /givemoney /(give/take)lic /editdoor /givenos(all)\n");
			strcat(string, "{F4A460}Senior Admin:{FFFFFF} /(make/delete)tiki /deletetikis /givetiki(all) /veh /fixveh(all) /destroycar(s) /killcar /listcars /setweather\n");
			strcat(string, "{F4A460}Senior Admin:{FFFFFF} /eventhelp /setmotd /banaccount /allowrobbank /acheckweed /removeweed /removegear\n");
			strcat(string, "{F4A460}Senior Admin:{FFFFFF} /addsurname /removesurname /surnamelist, /removecar, /givecar, /listmasked\n");
			strcat(string, "{F4A460}Senior Admin:{FFFFFF} /listip /listserial\n");
		}
		if(alevel >= 1337)
		{
			strcat(string, "\n");
			strcat(string, "{FF0000}Head Admin:{FFFFFF} /weatherall /makeleader /makegroupleader /makeircadmin /pban /unban /(un)banip /makemapper\n");
			strcat(string, "{FF0000}Head Admin:{FFFFFF} /rangeban /savechars /makehelper /load /editgate /gotogate /editgarage /editcctv /setfsafe /blowup\n");
			strcat(string, "{FF0000}Head Admin:{FFFFFF} /fcreate /fdelete /fedit /pointtime /osetname /makedev /vipresetgifts, /reloadvipcars\n");
			strcat(string, "{FF0000}Head Admin:{FFFFFF} /dcreate /dedit /carinfo /rcreate /rdelete /setstrikes /(o)makepropertymod /tod /setmyfamily\n");
			strcat(string, "{FF0000}Head Admin:{FFFFFF} /setaccent /addcctv /removecctv /getcctvid /addbar /movebar /getbarid /resetcrimes\n");
			strcat(string, "{FF0000}Head Admin:{FFFFFF} /createdynamicvehicle /destroydynamicvehicle /editdynamicvehicle /gotodynamicvehicle\n");
			strcat(string, "{FF0000}Head Admin:{FFFFFF} /setstat /setmoney /warn /togdoubleexp /refund /setstealth /checkstatus\n");
			strcat(string, ""COL_RED"Head Admin: "COL_WHITE"/setgtag /noglobal /gmute /gunmute /setnewbietag\n");
		}
		if(alevel >= 99999)
		{
			strcat(string, "\n");
			strcat(string, "{800000}Executive Admin:{FFFFFF} /agivedrugs /makeadmin /makebanappealer /makegangmod /makeeventmod\n");
			strcat(string, "{800000}Executive Admin:{FFFFFF} /makeshopmod /makecomplaintmod /ashophelp /makefactionmod /makegangdirector /ochangepass /amotd /setsecuritykey\n");
			strcat(string, "{800000}Executive Admin:{FFFFFF} /makefactiondirector\n");
		}
		if(PlayerInfo[playerid][pBanAppealer])
		{
			strcat(string, "\n");
			strcat(string, "{FF0000}Ban Appealer:{FFFFFF} /unban /unbanip /getip /getbanreason /banaccount\n");
		}
		/*if(PlayerInfo[playerid][pGangModd])
		{
			//SendClientMessage(playerid, COLOR_WHITE, "{387C44}Gang Moderator:{FFFFFF} /fedit /setmyfamily /savefamcar /deletefamcar");


		}*/
		if(PlayerInfo[playerid][pEventModd])
		{
			strcat(string, "\n");
			strcat(string, "{00CC99}Event Moderator:{FFFFFF} /eventhelp\n");
		}
		if(PlayerInfo[playerid][pComplaintModd])
		{
			strcat(string, "\n");
			strcat(string, "{FFA500}Complaint Moderator:{FFFFFF} /prison /oprison /ofine /fine /pfine\n");
		}
		if(PlayerInfo[playerid][pShopMod])
		{
			strcat(string, "\n");
			strcat(string, "{FFCC33}Shop Moderator:{FFFFFF} /ashophelp\n");
		}
		if(PlayerInfo[playerid][pFactionMod])
		{
			strcat(string, "\n");
			strcat(string, "{2641FE}Faction Moderator:{FFFFFF} /makeleader /(f)action(l)eaders /agiverank /editdynamicvehicle /gotodynamicvehicle\n");
		}
		if(PlayerInfo[playerid][pGangDirector])
		{
			strcat(string, "\n");
			strcat(string, "{387C44}Gang Director:{FFFFFF} /createdynamicvehicle /destroydynamicvehicle /editdynamicvehicle /gotodynamicvehicle\n");
			strcat(string, "{387C44}Gang Director:{FFFFFF} /fcreate /fdelete /fedit /afstats /setmyfamily /savefamcar /deletefamcar\n");
			strcat(string, "{387C44}Gang Director:{FFFFFF} /setstrikes /givestrike /checkstrikes /pointtime /togpoints\n");
		}
		if(PlayerInfo[playerid][pBizMod])
		{
			strcat(string, "\n");
			strcat(string, "{3399FF}Property Moderator:{FFFFFF} /apropertyhelp\n");
		}
		if(PlayerInfo[playerid][pFactionDirector])
		{
			strcat(string, "\n");
			strcat(string, "{2641FE}Faction Director:{FFFFFF} /makefactionmod\n");
		}
		ShowPlayerDialog(playerid, DIALOG_ADMINS, DIALOG_STYLE_MSGBOX, "Admin Commands", string, "Okay", "");
	}
	else return AdmErrorMsg;
	return 1;
}

CMD:ah(playerid, params[]) return cmd_ahelp(playerid, params);

CMD:tod(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] > 4)
	{
		new str[128];
		new hour;
		if(sscanf(params, "i", hour))
			return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /tod [hour (0-23)]");

		if(hour < 0 || hour > 23)
			return SendClientMessage(playerid, COLOR_GREY, "Hour can't be below 0 or above 23.");

		SetWorldTime(hour);
		format(str, sizeof(str), "Time set to %d Hours.", hour);
		SendClientMessageToAll(COLOR_GRAD1, str);
	}
	else return AdmErrorMsg;
	return 1;
}

CMD:blowup(playerid, params[])
{
	new playa;
	new str[128];
	if(PlayerInfo[playerid][pAdmin] >= 1337)
	{
		if(!sscanf(params, "u", playa))
		{
			if(IsPlayerConnected(playa))
			{
				if(playa != INVALID_PLAYER_ID)
				{
					new Float:slx, Float:sly, Float:slz;
					GetPlayerPos(playa, slx, sly, slz);
					CreateExplosion(slx, sly, slz, 6, 10.0);
					format(str, sizeof(str), "You have blown up %s!", PlayerOOCName(playa));
					SendClientMessage(playerid, COLOR_GREY, str);
				}
				else return SendClientMessage(playerid, COLOR_GREY, "That player isn't connected.");
			}
			else return SendClientMessage(playerid, COLOR_GREY, "That player isn't connected.");
		}
		else return SendClientMessage(playerid, COLOR_WHITE, "{00BFFF}Usage:{FFFFFF} /blowup [playerid/PartOfName]");
	}
	else return AdmErrorMsg;
	return 1;
}

CMD:ahousehelp(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] >= 4)
	{
		SendClientMessage(playerid, COLOR_YELLOW, "____________________________________________");
		SendClientMessage(playerid, COLOR_WHITE, "COMMANDS: /edithouse, /viewhouseint, /createhouse, /deletehouse, /resethouse, /removehouseowner, /gotohouse, /ahouse, /asethousetag, /houseinfo");
		SendClientMessage(playerid, COLOR_WHITE, "COMMANDS: /furnitureinfo, /deletefurniture, /resethousefurniture");
	}
	else
	{
		AdmErrorMsg;
	}
	return 1;
}



CMD:agatehelp(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] >= 4 || PlayerInfo[playerid][pMapper] == 3)
	{
		SendClientMessage(playerid, COLOR_YELLOW, "____________________________________________");
		SendClientMessage(playerid, COLOR_WHITE, "COMMANDS: /editgate, /amovegate, /gateinfo");
	}
	else
	{
		AdmErrorMsg;
	}
	return 1;
}

CMD:apropertyhelp(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] >= 1337 || PlayerInfo[playerid][pBizMod] == 1)
	{
		SendClientMessage(playerid, COLOR_YELLOW, "____________________________________________");
		SendClientMessage(playerid, COLOR_WHITE, "COMMANDS: /gotobiz /asellbiz /getbizid /setbiztill /bizinfo /setbizenter /setbizexit /setbizname");
		SendClientMessage(playerid, COLOR_WHITE, "COMMANDS: /setbiztype /setbizprod /aseizebiz /setbizprice /biztypes /checkbizstock");
		SendClientMessage(playerid, COLOR_WHITE, "COMMANDS: /createhouse /resethouse, /edithouse /deletehouse /asethousetag /viewhouseint /houseinfo, /gotohousesqlid");
		SendClientMessage(playerid, COLOR_WHITE, "COMMANDS: /ogethouseowner /furnitureinfo /deletefurniture /resethousefurniture /listdoors");
		SendClientMessage(playerid, COLOR_WHITE, "NEW COMMANDS: /checkactivity");
	}
	else
	{
		SendClientMessage(playerid, COLOR_GRAD2, "{FF0000}You're not authorized to use that command.");
	}
	return 1;
}

CMD:ashophelp(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] >= 99999 || PlayerInfo[playerid][pShopMod] != 0)
	{
		SendClientMessage(playerid, COLOR_YELLOW, "____________________________________________");
		SendClientMessage(playerid, COLOR_WHITE, "COMMANDS: /vips /makevip /omakevip");
		SendClientMessage(playerid, COLOR_WHITE, "COMMANDS: /checkorderinfo /checkpurchaseinfo /processorder");
	}
	else
	{
		SendClientMessage(playerid, COLOR_GRAD2, "{FF0000}You're not authorized to use that command.");
	}
	return 1;
}

CMD:id(playerid, params[])
{
	new name[128];
	new str[128];
	if(!sscanf(params, "i", name))
	{
		new giveplayerid = ReturnUser(params);
		if(IsPlayerConnected(giveplayerid))
		{
			new name2[24], status[10];

			strmid(name2, str_replace('_', ' ', PlayerName(giveplayerid)), 0, MAX_PLAYER_NAME);
			if(PlayerPaused[giveplayerid] == 1)
				status = "tabbed";
			else
				status = "untabbed";

			format(str, sizeof(str), "Name: %s, ID: %d, Level: %d, Ping: %d, Status: %s", name2, giveplayerid, PlayerInfo[giveplayerid][pLevel], GetPlayerPing(giveplayerid), status);
			SendClientMessage(playerid, COLOR_GRAD1, str);
		}
		return 1;
	}
	if(strlen(name) >= 3) return SendClientMessage(playerid, COLOR_GREY, "{FF0000}Error:{FFFFFF} You need to search for three (3) characters minimum");
	if(!sscanf(params, "s[128]", name))
	{

		format(str, sizeof(str), "Listing the following names for '%s'.", name);
		SendClientMessage(playerid, COLOR_WHITE, str);

		foreach( new i: Player )
		{
			if(strfind(PlayerName(i), name, true) != -1)
			{
				new name2[24], status[10];

				strmid(name2, str_replace('_', ' ', PlayerName(i)), 0, MAX_PLAYER_NAME);
				if(PlayerPaused[i] == 1)
					status = "tabbed";
				else
					status = "untabbed";

				format(str, sizeof(str), "Name: %s, ID: %d, Level: %d, Ping: %d, Status: %s", name2, i, PlayerInfo[i][pLevel], GetPlayerPing(i), status);
				SendClientMessage(playerid, COLOR_GRAD1, str);
			}
		}
		return 1;
	}
	else
	{
	   SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /id [playerid/PartOfName]");
	}
	return 1;
}

CMD:helpnewbie(playerid, params[])
{
	if(PlayerInfo[playerid][pHelper] == 0)return SendClientMessage(playerid, COLOR_GRAD2, "You are not a helper.");

	new targetid;
	new str[128];
	if(sscanf(params, "u", targetid))return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /helpnewbie [playerid/PartOfName]");
	{
		if(!IsPlayerConnected(targetid) || targetid == INVALID_PLAYER_ID)return SendClientMessage(playerid, COLOR_GRAD2, "That player is not logged in/invalid player id");
		if(targetid == playerid) return SendClientMessage(playerid, COLOR_WHITE, "You can't use that on yourself!");

		if(AdminHelp[targetid] == 1)
		{
			new Float:tx, Float:ty, Float:tz, Float:X, Float:Y, Float:Z, hrank[30];
			GetPlayerPos(playerid, X, Y, Z);
			PlayerInfo[playerid][helpmeX] = X;
			PlayerInfo[playerid][helpmeY] = Y;
			PlayerInfo[playerid][helpmeZ] = Z;
			PlayerInfo[playerid][helpmeInt] = GetPlayerInterior(playerid);
			PlayerInfo[playerid][helpmeVW] = GetPlayerVirtualWorld(playerid);
			HelpingNewbie[playerid] = true;
			if(usingNameTag[playerid])
			{
				DestroyDynamic3DTextLabel(nametagText[playerid]);
				nametagText[playerid] = Text3D:INVALID_3DTEXT_ID;
			}
			nametagText[playerid] = CreateDynamic3DTextLabel("\nHelper", NEWBIE_COLOR, 0.0, 0.0, 0.0 +0.32, 20.0, playerid, INVALID_VEHICLE_ID, 1, -1, -1, -1, 100);
			SendClientMessage(playerid, COLOR_LIGHTBLUE, "* Helper nametag enabled.");
			usingNameTag[playerid] = 1;
			GetPlayerPos(targetid, tx, ty, tz);
			SetPlayerPos(playerid, tx, ty, tz +2);
			SetPlayerInterior(playerid, GetPlayerInterior(targetid));
			SetPlayerVirtualWorld(playerid, GetPlayerVirtualWorld(targetid));

			switch(PlayerInfo[playerid][pHelper]){
				case 1:hrank = "Trial Helper";
				case 2:hrank = "Helper";
				case 3:hrank = "Senior Helper";
				case 4:hrank = "Head Helper";
				case 5:hrank = "Director of The Helpers Team";
			}

			format(str, 256, "** %s: %s[%d] has accepted %s's request for help.", hrank, PlayerICName(playerid), playerid, PlayerICName(targetid));
			SendHelperMessage(NEWBIE_COLOR, str, 0);
			format(str, 256, "** %s: %s[%d] has accepted your request for help", hrank, PlayerICName(playerid), playerid);
			SendClientMessage(targetid, NEWBIE_COLOR, str);
			AdminHelp[targetid] = 0;
			Timer_FreezePlayer(targetid, FREEZE, HELPNEWBIE_FREEZE);
		}
		else return SendClientMessage(playerid, COLOR_GRAD2, "That player did not request any help.");
	}
	return 1;
}

CMD:hn(playerid, params[])return cmd_helpnewbie(playerid, params);

CMD:hreturn(playerid, params[])
{
	if(PlayerInfo[playerid][pHelper] == 0) return SendClientMessage(playerid, COLOR_GRAD2, "You are not a helper.");
	if(HelpingNewbie[playerid] == false) return SendClientMessage(playerid, COLOR_GREY, "You're not helping a newbie.");
	SetPlayerPos(playerid, PlayerInfo[playerid][helpmeX], PlayerInfo[playerid][helpmeY], PlayerInfo[playerid][helpmeZ]);
	SetPlayerInterior(playerid, PlayerInfo[playerid][helpmeInt]);
	SetPlayerVirtualWorld(playerid, PlayerInfo[playerid][helpmeVW]);
	PlayerInfo[playerid][helpmeX] = 0.00;
	PlayerInfo[playerid][helpmeY] = 0.00;
	PlayerInfo[playerid][helpmeZ] = 0.00;
	PlayerInfo[playerid][helpmeInt] = 0;
	PlayerInfo[playerid][helpmeVW] = 0;
	HelpingNewbie[playerid] = false;
	HelperVeh2[playerid] = false;
	if(usingNameTag[playerid])
	{
		DestroyDynamic3DTextLabel(nametagText[playerid]);
		nametagText[playerid] = Text3D:INVALID_3DTEXT_ID;
		SendClientMessage(playerid, COLOR_LIGHTBLUE, "* Nametag has been disabled.");
		usingNameTag[playerid] = 0;
	}
	if(IsValidVehicle(helperVeh[playerid])){
		DestroyVehicle(helperVeh[playerid]);
	}
	return 1;
}

CMD:helpme(playerid, params[])
{
	if(PlayerInfo[playerid][pNewbieMuted] == 1) return SendClientMessage(playerid, COLOR_GREY, "You are banned from /helpme.");
	if(gettime() - HelpMeTimer[playerid] <= 10)return SendClientMessage(playerid, COLOR_GRAD2, "Please wait 10 seconds before requesting for help again.");
	if(PlayerInfo[playerid][pNewbieMuted] == 1) return SendClientMessage(playerid, COLOR_GRAD1, "You are banned from using this command.");
	if(IsPlayerRestricted(playerid) || PlayerFrozen[playerid] != 0) return SendClientMessage(playerid, COLOR_GREY, "You can't do that at this time.");
	if(IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You must get out of your vehicle to use this.");
	if(PlayerInfo[playerid][pHelper] > 0)return SendClientMessage(playerid, COLOR_GREY, "Helpers can't use this command.");
	new str[128];
	new result[128];
	if(sscanf(params, "s[128]", result))return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /helpme [text]");
	{
		format(str, sizeof(str), "** Newbie %s [%d] requires help (/helpnewbie): %s", PlayerICName(playerid), playerid, result);
		SendHelperMessage(SCOLOR_CYAN, str, 0);
		AdminHelp[playerid] = 1;
		HelpMeTimer[playerid] = gettime();
		SendClientMessage(playerid, COLOR_YELLOW, "** Your help request has been sent, please wait for a response.");
	}
	return 1;
}

CMD:oncheck(playerid, params[])
{
	if(PlayerInfo[playerid][pHelper] >= 1)
	{
		new playername[MAX_PLAYER_NAME];
		if(sscanf(params, "s[24]", playername)) return SendClientMessage(playerid, COLOR_GRAD1, "{00BFFF}Usage:{FFFFFF} /oncheck [PlayerID/PartOfName]");
		if(strlen(playername) < 4) return SendClientMessage(playerid, COLOR_WHITE, "{FF0000}Error: {FFFFFF}Invalid name.");

		new query[128];
		mysql_format(sqlGameConnection, query, sizeof query, "SELECT NewbieWarns, NewbieMuted, NewbieMutedTime FROM players WHERE Name='%e'", playername);
		mysql_pquery(sqlGameConnection, query, "OnNewbieCheck", "is", playerid, playername);
		return 1;
	}
	else return SendClientMessage(playerid, COLOR_WHITE, "{FF0000}Error: {FFFFFF}You are not a Helper.");
}

CMD:onwarn(playerid, params[])
{
	if(PlayerInfo[playerid][pHelper] >= 1)
	{
		new playername[MAX_PLAYER_NAME], reason[64];
		if(sscanf(params, "s[24]s[64]", playername, reason)) return SendClientMessage(playerid, COLOR_GRAD1, "{00BFFF}Usage:{FFFFFF} /onwarn [player_name] [reason]");
		if(strlen(playername) < 4) return SendClientMessage(playerid, COLOR_WHITE, "{FF0000}Error: {FFFFFF}Invalid name.");

		new query[128];
		mysql_format(sqlGameConnection, query, sizeof query, "SELECT NewbieWarns FROM players WHERE Name='%e'", playername);
		mysql_pquery(sqlGameConnection, query, "OnNewbieWarn", "iss", playerid, playername, reason);
	}
	else SendClientMessage(playerid, COLOR_WHITE, "{FF0000}Error: {FFFFFF}You are not a Helper.");
	return 1;
}

CMD:onmute(playerid, params[])
{
	if(PlayerInfo[playerid][pHelper] >= 1)
	{
		new playername[MAX_PLAYER_NAME], time[20];
		if(sscanf(params, "s[24]s[20]", playername, time)) return SendClientMessage(playerid, COLOR_GRAD1, "{00BFFF}Usage:{FFFFFF} /onmute [player_name] [time(perm, hours)]");
		if(strlen(playername) < 4) return SendClientMessage(playerid, COLOR_WHITE, "{FF0000}Error: {FFFFFF}Invalid name.");

		new iTime; // by default permanant, otherwise if it's numeric set it to that
		if(IsNumeric(time)) {
			if(strval(time) >= 0 && strval(time) <= 48) iTime = strval(time);
			else return SendClientMessage(playerid, COLOR_WHITE, "{FF0000}Error: {FFFFFF}Mute time must be within 1 and 24 hours.");
		}
		new query[128];
		mysql_format(sqlGameConnection, query, 128, "SELECT NewbieMuted FROM players WHERE Name='%e'", playername);
		mysql_pquery(sqlGameConnection, query, "OnNewbieMute", "iis", playerid, iTime, playername);
	}
	else SendClientMessage(playerid, COLOR_WHITE, "{FF0000}Error: {FFFFFF}You are not a Helper.");
	return 1;
}

CMD:onrw(playerid, params[])
{
	if(PlayerInfo[playerid][pHelper] >= 1)
	{
		new playername[MAX_PLAYER_NAME];
		if(sscanf(params, "s[24]", playername)) return SendClientMessage(playerid, COLOR_GRAD1, "{00BFFF}Usage:{FFFFFF} /onrw [player_name]");
		if(strlen(playername) < 4) return SendClientMessage(playerid, COLOR_WHITE, "{FF0000}Error: {FFFFFF}Invalid name.");

		new query[128];
		mysql_format(sqlGameConnection, query, 128, "UPDATE players SET NewbieWarns=NewbieWarns-1 WHERE Name='%e' AND NewbieWarns > 0", playername);
		mysql_pquery(sqlGameConnection, query, "OnNewbieWarnRemove", "is", playerid, playername);
	}
	else SendClientMessage(playerid, COLOR_WHITE, "{FF0000}Error: {FFFFFF}You are not a Helper.");
	return 1;
}

CMD:help(playerid, params[])
{
	ShowHelpDialog(playerid);
	return 1;
}

CMD:showlicense(playerid, params[])
	return cmd_showlicenses(playerid, params);

CMD:showlicenses(playerid, params[]) {
	new targetPlayer;
	if(sscanf(params, "u", targetPlayer))
		return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /showlicenses [playerid/PartOfName]");

	if(!IsPlayerConnected(targetPlayer))
		return SendClientMessage(playerid, COLOR_GREY, "Unknown player.");

	if(targetPlayer == playerid)
		return cmd_licenses(playerid, "");

	if(!IsPlayerInRangeOfPlayer(4.0, playerid, targetPlayer) ||
		GetPlayerState(targetPlayer) == PLAYER_STATE_SPECTATING
	) return SendClientMessage(playerid, COLOR_GREY, "You are not near this player.");
	new str[128];
	// Send message
	format(str, sizeof(str), "* %s has shown their licenses to you.", PlayerICName(playerid));
	SendClientMessage(targetPlayer, COLOR_LIGHTBLUE, str);

	format(str, sizeof(str), "* You have shown your licenses to %s.", PlayerICName(targetPlayer));
	SendClientMessage(playerid, COLOR_LIGHTBLUE, str);

	// Show the licenses
	new hasAnyLicenses = DisplayLicenses(playerid, targetPlayer);

	if(!hasAnyLicenses)
		SendClientMessage(targetPlayer, COLOR_GREY, "No achieved licenses.");

	// Action
	format(str, sizeof(str), "* %s shows their licenses to %s.", PlayerICName(playerid), PlayerICName(targetPlayer));
	SetPlayerChatBubble(playerid, str, COLOR_PURPLE, 20.0, 15000);
	format(str, sizeof(str), "> %s shows their licenses to %s.", PlayerICName(playerid), PlayerICName(targetPlayer));
	SendClientMessage(playerid, COLOR_PURPLE, str);
	return 1;
}

CMD:licenses(playerid, params[]) {
	new str[128];
	// Action
	format(str, sizeof(str), "* %s takes a look at their licenses.", PlayerICName(playerid));
	SetPlayerChatBubble(playerid, str, COLOR_PURPLE, 20.0, 15000);
	format(str, sizeof(str), "> %s takes a look at their licenses.", PlayerICName(playerid));
	SendClientMessage(playerid, COLOR_PURPLE, str);

	// Show the licenses
	new hasAnyLicenses = DisplayLicenses(playerid, playerid);

	if(!hasAnyLicenses)
		SendClientMessage(playerid, COLOR_GREY, "No achieved licenses.");
	return 1;
}

CMD:guide(playerid, params[])
{
	ShowPlayerDialog(playerid, DIALOGID_GUIDE_MAIN, DIALOG_STYLE_LIST, "Guide", "How to make money\nGetting guns\nJoining a gang or faction\nHow to roleplay\nHow to level up", "Ok", "Cancel");
	viewingGuide[playerid] = 1;
	return 1;
}
CMD:aduty(playerid, params[]) return cmd_adminduty(playerid, params);
CMD:adminduty(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] < 1) return AdmErrorMsg;
	new str[128];
	if(ADuty[playerid] == false)
	{
		ADuty[playerid] = true;
		SetPlayerHealth(playerid, 9999999);
		SetPlayerArmour(playerid, 9999999);
		SetTimerEx("Timer_ADutyTimer2", 60 *1000, 0, "i", playerid);
		ADutyTimer[playerid] = true;
		format(str, sizeof(str), "{FF0000}AdmWarning{FFFFFF}: %s is now on duty.", PlayerName(playerid));
		SendAdminMessage(COLOR_WHITE, str);
		SetPlayerMasked(playerid, true);
		//Aduty(playerid);
		DestroyDynamic3DTextLabel(nametagText[playerid]);
		nametagText[playerid] = Text3D:INVALID_3DTEXT_ID;
		usingNameTag[playerid] = 0;
		if( (PlayerInfo[ playerid ] [ pID ] == 7619 || PlayerInfo[ playerid ] [ pID ] == 7378 ) && ADuty[playerid] == true )
		{
			format(str, sizeof(str), "Founder\n{8b0000}%s", PlayerOOCName(playerid));
			nametagText[playerid] = CreateDynamic3DTextLabel(str, COLOR_BLUE, 0.0, 0.0, 0.0 +0.32, 20.0, playerid, INVALID_VEHICLE_ID, 1, -1, -1, -1, 100);
			usingNameTag[playerid] = 1;
		}
		else if(PlayerInfo[playerid][pAdmin] == 1 && ADuty[playerid] == true)
		{
			format(str, sizeof(str), "%s\n{0080FF}PRP Administrator\n{FF00FF}Probationary Administrator", PlayerOOCName(playerid));
			nametagText[playerid] = CreateDynamic3DTextLabel(str, 0xFEB918FF, 0.0, 0.0, 0.0 +0.32, 20.0, playerid, INVALID_VEHICLE_ID, 1, -1, -1, -1, 100);
			usingNameTag[playerid] = 1;
		}
		else if(PlayerInfo[playerid][pAdmin] == 2 && ADuty[playerid] == true)
		{
			format(str, sizeof(str), "%s\n{0080FF}PRP Administrator\n{00FF00}Junior Administrator", PlayerOOCName(playerid));
			nametagText[playerid] = CreateDynamic3DTextLabel(str, 0xFEB918FF, 0.0, 0.0, 0.0 +0.32, 20.0, playerid, INVALID_VEHICLE_ID, 1, -1, -1, -1, 100);
			usingNameTag[playerid] = 1;
		}
		else if(PlayerInfo[playerid][pAdmin] == 3 && ADuty[playerid] == true)
		{
			format(str, sizeof(str), "%s\n{0080FF}PRP Administrator\n{04B404}General Administrator", PlayerOOCName(playerid));
			nametagText[playerid] = CreateDynamic3DTextLabel(str, 0xFEB918FF, 0.0, 0.0, 0.0 +0.32, 20.0, playerid, INVALID_VEHICLE_ID, 1, -1, -1, -1, 100);
			usingNameTag[playerid] = 1;
		}
		else if((PlayerInfo[playerid][pAdmin] >= 4 && PlayerInfo[playerid][pAdmin] <= 1336) && ADuty[playerid] == true)
		{
			format(str, sizeof(str), "%s\n{0080FF}PRP Administrator\n{F4A460}Senior Administrator", PlayerOOCName(playerid));
			nametagText[playerid] = CreateDynamic3DTextLabel(str, 0xFEB918FF, 0.0, 0.0, 0.0 +0.32, 20.0, playerid, INVALID_VEHICLE_ID, 1, -1, -1, -1, 100);
			usingNameTag[playerid] = 1;
		}
		else if(PlayerInfo[playerid][pAdmin] >= 1337 && PlayerInfo[playerid][pAdmin] < 99999 && ADuty[playerid] == true)
		{
			format(str, sizeof(str), "%s\n{0080FF}PRP Administrator\n{FF0000}Head Administrator", PlayerOOCName(playerid));
			nametagText[playerid] = CreateDynamic3DTextLabel(str, 0xFEB918FF, 0.0, 0.0, 0.0 +0.32, 20.0, playerid, INVALID_VEHICLE_ID, 1, -1, -1, -1, 100);
			usingNameTag[playerid] = 1;
		}
		else if(PlayerInfo[playerid][pAdmin] >= 99999 && PlayerInfo[playerid][pAdmin] < 1999999999 &&  ADuty[playerid] == true)
		{
			format(str, sizeof(str), "%s\n{0080FF}PRP Administrator\n{800000}Executive Administrator", PlayerOOCName(playerid));
			nametagText[playerid] = CreateDynamic3DTextLabel(str, 0xFEB918FF, 0.0, 0.0, 0.0 +0.32, 20.0, playerid, INVALID_VEHICLE_ID, 1, -1, -1, -1, 100);
			usingNameTag[playerid] = 1;
		}
		else if(PlayerInfo[playerid][pAdmin] == 1999999998 && ADuty[playerid] == true)
		{
			format(str, sizeof(str), "%s\n{0080FF}PRP Administrator\n{800000}Co-Owner", PlayerOOCName(playerid));
			nametagText[playerid] = CreateDynamic3DTextLabel(str, 0xFEB918FF, 0.0, 0.0, 0.0 +0.32, 20.0, playerid, INVALID_VEHICLE_ID, 1, -1, -1, -1, 100);
			usingNameTag[playerid] = 1;
		}
		else if(PlayerInfo[playerid][pAdmin] == 1999999999 && ADuty[playerid] == true)
		{
			format(str, sizeof(str), "%s\n{0080FF}PRP Administrator\n{F09186}Community Director", PlayerOOCName(playerid));
			nametagText[playerid] = CreateDynamic3DTextLabel(str, 0xFEB918FF, 0.0, 0.0, 0.0 +0.32, 20.0, playerid, INVALID_VEHICLE_ID, 1, -1, -1, -1, 100);
			usingNameTag[playerid] = 1;
		}
	}
	else
	{
		DestroyDynamic3DTextLabel(nametagText[playerid]);
		SetPlayerHealth(playerid, 100);
		SetPlayerArmour(playerid, 100);
		nametagText[playerid] = Text3D:INVALID_3DTEXT_ID;
		usingNameTag[playerid] = 0;
		ADuty[playerid] = false;
		SetTimerEx("Timer_ADutyTimer2", 60 *1000, 0, "i", playerid);
		ADutyTimer[playerid] = true;
		format(str, sizeof(str), "{FF0000}AdmWarning{FFFFFF}: %s is now off duty.", PlayerName(playerid));
		SendAdminMessage(COLOR_WHITE, str);
		SetPlayerMasked(playerid, false);
		//Aduty(playerid);
	}
	return 1;
}

CMD:hduty(playerid, params[]) return cmd_helperduty(playerid, params);
CMD:helperduty(playerid, params[])
{
	if(PlayerInfo[playerid][pHelper] == 0) return AdmErrorMsg;
	if(ADutyTimer[playerid]) return SendClientMessage(playerid, COLOR_WHITE, "You must wait 60 seconds before switiching status.");
	new str[128];
	if(HDuty[playerid] == false)
	{
		HDuty[playerid] = true;
		SetTimerEx("Timer_ADutyTimer2", 60 *1000, 0, "i", playerid);
		ADutyTimer[playerid] = true;
		format(str, sizeof(str), "{FF0000}HelperCmd{FFFFFF}: %s is now on duty.", PlayerName(playerid));
		SendHelperMessage(COLOR_LIGHTRED, str, 0);
		gHelperCh[playerid] = 0;
		SendClientMessage(playerid, COLOR_GRAD2, "Helper chat channel Enabled.");

	}
	else
	{
		HDuty[playerid] = false;
		SetTimerEx("Timer_ADutyTimer2", 60 *1000, 0, "i", playerid);
		ADutyTimer[playerid] = true;
		format(str, sizeof(str), "{FF0000}HelperCmd{FFFFFF}: %s is now off duty.", PlayerName(playerid));
		SendHelperMessage(COLOR_LIGHTRED, str, 0);
		gHelperCh[playerid] = 1;
		SendClientMessage(playerid, COLOR_GRAD2, "Helper chat channel Disabled.");
	}
	return 1;
}

CMD:di(playerid, params[]) return cmd_damageinfo(playerid, params);

CMD:damageinfo(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] >= 1)
	{
		if(!ADuty[playerid] && PlayerInfo[playerid][pAdmin] == 1) return SendClientMessage(playerid, COLOR_GREY, "You are not on duty.");
		new targetid, string[128];
		if(sscanf(params, "u", targetid))
		{
			return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /(d)amage(i)nfo [playerid/PartOfName]");
		}
		else
		{
			format(string, sizeof(string), "DamageInfo for %s:", PlayerICName(targetid));
			SendClientMessage(playerid, COLOR_WHITE, string);
			format(string, sizeof(string), "Last damaged by %s (%s) at %d:%d (hour:minute)", damagedBy[targetid], damageGun[targetid], damageHour[targetid], damageMinute[targetid]);
			SendClientMessage(playerid, COLOR_GRAD1, string);
			format(string, sizeof(string), "Last killed by %s (%s) at %d:%d (hour:minute)", killedBy[targetid], killGun[targetid], killerHour[targetid], killerMinute[targetid]);
			SendClientMessage(playerid, COLOR_GRAD2, string);
		}
	}
	else
	{
		AdmErrorMsg;
	}
	return 1;
}

CMD:garagehelp(playerid, params[])
{
	SendClientMessage(playerid, COLOR_YELLOW, "____________________________________________");
	SendClientMessage(playerid, COLOR_WHITE, "COMMANDS: /lockgarage");
	return 1;
}

CMD:gatehelp(playerid, params[])
{
	SendClientMessage(playerid, COLOR_YELLOW, "____________________________________________");
	SendClientMessage(playerid, COLOR_WHITE, "COMMANDS: /movegate (password), /gatepass (newpassword)");
	return 1;
}

CMD:househelp(playerid, params[])
{
	SendClientMessage(playerid, COLOR_YELLOW, "____________________________________________");
	SendClientMessage(playerid, COLOR_WHITE, "COMMANDS: /lockhouse, /sethousetag, /house, /buyhouse, /hupgrade, /sellhouse, /sellhousetomarket, /breakin, /doorknock, /doorshout");
	SendClientMessage(playerid, COLOR_WHITE, "COMMANDS: /furniture");
	return 1;
}

CMD:cellphonehelp(playerid, params[])
{
	SendClientMessage(playerid, COLOR_YELLOW, "____________________________________________");
	SendClientMessage(playerid, COLOR_WHITE, "COMMANDS: /call, /sms(/t), (/p)ickup, (/h)angup, /number, /speakerphone");
	return 1;
}

CMD:radiohelp(playerid, params[])
{
	SendClientMessage(playerid, COLOR_YELLOW, "____________________________________________");
	SendClientMessage(playerid, COLOR_WHITE, "COMMANDS: /setradioname, /setradiourl, /setradiobroadcast");
	return 1;
}

CMD:irchelp(playerid, params[])
{
	SendClientMessage(playerid, COLOR_YELLOW, "____________________________________________");
	SendClientMessage(playerid, COLOR_WHITE, "COMMANDS: /irc join [channelnr] (password), /irc leave, /irc members");
	SendClientMessage(playerid, COLOR_WHITE, "COMMANDS: /irc Password [channelnr], /irc NeedPass [channelnr], /irc Lock [channelnr])");
	SendClientMessage(playerid, COLOR_WHITE, "COMMANDS: /irc Admins)  (/irc MOTD [motdtext])  (/irc status [channelnr])  (/i [text])");
	return 1;
}

CMD:helperhelp(playerid, params[])
{
	if(PlayerInfo[playerid][pHelper] > 0)
	{
		SendClientMessage(playerid, COLOR_YELLOW, "____________________________________________");
		if(PlayerInfo[playerid][pHelper] >= 1)
		{
			SendClientMessage(playerid, COLOR_WHITE, "*Trial: /hc /helpnewbie (/hn) /hreturn /hduty /ap /nwarn /nmute");
		}
		if(PlayerInfo[playerid][pHelper] >= 2)
		{
			SendClientMessage(playerid, COLOR_WHITE, "*HELPER: /n(r)emove(w)arning /gotonewbie /hpm /hveh /listnewbies /ncheck");
		}
		if(PlayerInfo[playerid][pHelper] >= 3)
		{
			SendClientMessage(playerid, COLOR_WHITE, "*SENIOR HELPER: /nonewbie /hgoto /clearchat");
		}
		if(PlayerInfo[playerid][pHelper] >= 4)
		{
			SendClientMessage(playerid, COLOR_WHITE, "*HEAD HELPER: /makehelper /omakehelper");
		}
	}
	else
	{
		AdmErrorMsg;
	}
	return 1;
}

CMD:map(playerid, params[])
{
	if(PlayerInfo[playerid][pMap] == 0) return SendClientMessage(playerid, COLOR_GREY, "You don't have a map! (Purchase one from a 24/7)");
	if(goingJob[playerid] == true)
	{
		DisablePlayerCheckpointEx(playerid);
		goingJob[playerid] = false;
	}
	ShowPlayerDialog(playerid, DIALOG_MAP, DIALOG_STYLE_LIST, "Map", "Detective Job\nLawyer Job\nDrug Dealer Job\nProduct Dealer Job\nMechanic Job\nBodyguard Job\nArms Dealer Job\nBoxer Job\nTaxi Driver Job\nDrug Smuggler Job\nSan Andreas Police Department\nLos Santos Bank\nLos Santos GYM\nFire & Medical Department\nSan Andreas News Network", "Select", "Cancel");
	return 1;
}

CMD:maphelp(playerid, params[])
{
	if(PlayerInfo[playerid][pMapper] < 1) return AdmErrorMsg;

	SendClientMessage(playerid, COLOR_YELLOW, "____________________________________________");
	SendClientMessage(playerid, COLOR_WHITE, "*1* Regular Mapper: /(m)apper(c)hat, /mappers, /up, /dn, /hidestatus");
	SendClientMessage( playerid, COLOR_WHITE, "*1* Regular Mapper: /nametosql, /sqltoname");

	if(PlayerInfo[playerid][pMapper] >= MAPPERRANK_SENIOR)
	{
		SendClientMessage(playerid, COLOR_WHITE, "*2* Senior Mapper: /(m)apper(c)hat, /mappers, /up, /dn");
	}
	if(PlayerInfo[playerid][pMapper] == MAPPERRANK_MANAGER)
	{
		SendClientMessage(playerid, COLOR_WHITE, "*3* Mapping Manager: /(m)apper(c)hat, /mappers, /up, /dn, /gotoobj, /makemapper, /gotocoords, /setworld");
		SendClientMessage(playerid, COLOR_WHITE, "*3* Mapping Manager: /agatehelp, /agaragehelp, /editdoor, /gotodoor");
	}
	return 1;
}

CMD:devhelp(playerid, params[])
{
	if(!PlayerInfo[playerid][pDev])
		return AdmErrorMsg;

	SendClientMessage(playerid, COLOR_YELLOW, "____________________________________________");
	SendClientMessage(playerid, COLOR_WHITE, "*1* Junior Developer: /(d)ev(c)hat, /devs, /hidestatus, /setworld");

	if(PlayerInfo[playerid][pDev] >= DEVRANK_SENIOR)
	{
		SendClientMessage(playerid, COLOR_WHITE, "*2* Senior Developer: /gotocoords, /editgate, /editdoor, /closestgate, /spawnedvehicles");
		SendClientMessage(playerid, COLOR_WHITE, "*2* Senior Developer: /kickall, /lockserver, /skindebug, /skinshop, /allskins, /asay");
	}
	if(PlayerInfo[playerid][pDev] >= DEVRANK_MANAGER)
	{
		SendClientMessage(playerid, COLOR_WHITE, "*3* Lead Developer: /makedev, /setannouncement, /lockannouncement, /o, /setmotd, /goto");
		SendClientMessage(playerid, COLOR_WHITE, "*3* Lead Developer: /togdoubleexp /veh /destroycar");
	}
	return 1;
}

CMD:prisoninfo(playerid, params[])
{
	if(	PlayerInfo[playerid][pJailed] != 2 ||
		PlayerInfo[playerid][pJailTime] < 1)
		return SendClientMessage(playerid, COLOR_GREY, "You are not in prison.");

	new prisonno[50], prisontime[50], timeremain[3], prisoninfo[128];

	format(prisonno, sizeof(prisonno), "\tUniform No: %i", PlayerInfo[playerid][pJailnumber]);

	timeremain[0]= PlayerInfo[playerid][pJailTime];
	timeremain[1] = timeremain[0]/60;
	timeremain[0] -= timeremain[1]*60;
	if(timeremain[1] < 1)
	{
		format(prisontime, sizeof(prisontime), "\tTime remaining: %i seconds.", timeremain[0]);
	}
	else
	{
		format(prisontime, sizeof(prisontime), "\tTime remaining: %i minutes, %i seconds.", timeremain[1], timeremain[0]);
	}
	format(prisoninfo, sizeof(prisoninfo), "%s\n%s", prisonno, prisontime);
	ShowPlayerDialog(playerid, DIALOG_UNUSED, DIALOG_STYLE_MSGBOX, "Prison information", prisoninfo, "Close", ""); //Bugs on first button, "Server: You are already logged in!"
	return 1;
}

CMD:inmates(playerid, params[])
{
	if(!IsACop(playerid) && PlayerInfo[playerid][pMember] != FACTION_SANG && PlayerInfo[playerid][pAdmin] == 0)
		return SendClientMessage(playerid, COLOR_GREY, "You are not authorised to use that command.");

	new pcounter, pstring[512];
	for(new i = 0; i < MAX_PLAYERS; i++)
	{
		if(!IsPlayerConnected(i)) continue;
		if(PlayerInfo[i][pJailed] != 2) continue;

		new string[128];
		format(string, sizeof(string), "#%i ~ %s | time: %i s\n", PlayerInfo[i][pJailnumber], PlayerICName(i), PlayerInfo[i][pJailTime]);
		strcat(pstring, string);
		pcounter++;
	}
	if(pcounter > 0) return ShowPlayerDialog(playerid, DIALOG_UNUSED, DIALOG_STYLE_MSGBOX, "Registered inmates", pstring, "Close", "");
	else return SendClientMessage(playerid, COLOR_GREY, "There are no registered inmates!");
}
// =========================== PRISON COMMANDS END =============================

CMD:testhelp(playerid, params[])
{
	if(PlayerInfo[playerid][pTester] > 0)
	{
		SendClientMessage(playerid, COLOR_YELLOW, "____________________________________________");
		if(PlayerInfo[playerid][pTester] == TESTERRANK_REGULAR)
		{
			SendClientMessage(playerid, COLOR_WHITE, "*1* Regular Tester: /(t)est(c)hat, /togtester, /testers, /ac(cept)bug, /treturn, /d(eny)bug /hidestatus");
		}
		else if(PlayerInfo[playerid][pTester] == TESTERRANK_SENIOR)
		{
			SendClientMessage(playerid, COLOR_WHITE, "*1* Senior Tester: /(t)est(c)hat, /togtester, /testers, /ac(cept)bug, /treturn, /bugmute, /d(eny)bug, /up, /dn, /bigup, /bigdn");
		}
		else if(PlayerInfo[playerid][pTester] == TESTERRANK_MANAGER)
		{
			SendClientMessage(playerid, COLOR_WHITE, "*2* Tester Manager: /(t)est(c)hat, /togtester, /testers, /ac(cept)bug, /treturn, /bugmute, /maketester, /d(eny)bug");
		}
	}
	else
	{
		AdmErrorMsg;
	}
	return 1;
}

CMD:viphelp(playerid, params[])
{
	if(PlayerInfo[playerid][pDonateRank] > 0)
	{
		SendClientMessage(playerid, COLOR_YELLOW, "____________________________________________");
		SendClientMessage(playerid, COLOR_WHITE, "VIP COMMANDS: /purchase, /getgift, /(v)ip(c)hat, /togvc, /vip,  /viptime");
	}
	if(PlayerInfo[playerid][pDonateRank] == 4)
	{
		SendClientMessage(playerid, COLOR_YELLOW, "____________________________________________");
		SendClientMessage(playerid, COLOR_WHITE, "VIP COMMANDS: /finddcars");
	}
	else
	{
		AdmErrorMsg;
	}
	return 1;
}
//=================================[CHATS]======================================
CMD:b(playerid, params[])
{
	if(PlayerInfo[playerid][pMuted] == 1 || WatchingTV[playerid] == true) return SendClientMessage(playerid, COLOR_GREY, "You can't use this whilst muted.");
	new msg[128];
	new str[128];
	if(!sscanf(params, "s[128]", msg))
	{
		if(gPlayerLogged[playerid] == 0)
		{
			SendClientMessage(playerid, COLOR_GREY, "You havent logged in yet.");
			return 1;
		}
		if(PlayerInfo[playerid][pMask]) format(str, sizeof(str), "(( %s:  %s ))", PlayerICName(playerid), msg);
		else format(str, sizeof(str), "(( %s (%i):  %s ))", PlayerICName(playerid), playerid, msg);
		if(usingNameTag[playerid] && PlayerInfo[playerid][pAdmin] >= 2)
		{
			ProxDetector(20, playerid, str, 0xFEB918FF, 0xFEB918FF, 0xFEB918FF, 0xFEB918FF, 0xFEB918FF);
		}
		else
		{
			ProxDetector(20.0, playerid, str, COLOR_FADE1, COLOR_FADE2, COLOR_FADE3, COLOR_FADE4, COLOR_FADE5);
		}
	}
	else
	{
		SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /b [local ooc chat]");
	}
	return 1;
}

CMD:showbadge(playerid, params[])
{
	if(IsABadgeFaction(playerid) || PlayerInfo[playerid][pHAFakeBadge] != 0)
	{
		if(PlayerInfo[playerid][pHidingBadge])
			return SendClientMessage(playerid, COLOR_GREY, "You are currently hiding your badge. (/badge)");

		new targetid;
		new namerankstr[100];
		new str[128];
		if(sscanf(params, "u", targetid)) return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /showbadge [playerid/name]");
		{
			if(!IsPlayerInRangeOfPlayer(5.0, playerid, targetid)) return SendClientMessage(playerid, COLOR_GREY, "{FF0000}Error:{FFFFFF} You must be close to the player to show them your badge.");
			if(PlayerInfo[playerid][pMember] == 9 && PlayerInfo[playerid][pHAFakeBadge] == 0) return cmd_showpresscard(playerid, params);
			if(PlayerInfo[playerid][pGroup] == GROUP_S9 && PlayerInfo[playerid][pMember] == 0) return SendClientMessage(playerid, COLOR_GRAD1, "You do not have a badge.");
			format(str, sizeof(str), "* %s reaches over towards %s showing them their badge. *", PlayerICName(playerid), PlayerICName(targetid));
			ProxDetector(30.0, playerid, str, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
			SendClientMessage(targetid, COLOR_YELLOW, "[Badge Information]");

			if(PlayerInfo[playerid][pHAFakeBadge] != 0)
			{
				new factionname = PlayerInfo[playerid][pHAFakeBadge];
				format(namerankstr, sizeof(namerankstr), "[%s (Badge Number: %d) - %s (%s)]", PlayerICName(playerid), PlayerInfo[playerid][pBadgeNumber], GetFactionName(factionname), GetFakeRank(playerid));
				SendClientMessage(targetid, COLOR_YELLOW, namerankstr);
			}
			else
			{
				format(str, sizeof(str), "[%s (Badge Number: %d) - %s (%s)]", PlayerICName(playerid), PlayerInfo[playerid][pBadgeNumber], GetPlayerFactionName(playerid), GetPlayerRank(playerid));
				SendClientMessage(targetid, COLOR_YELLOW, str);
			}
			return 1;
		}
	}
	return SendClientMessage(playerid, COLOR_GRAD1, "You're either not in a faction, or your faction doesn't have a badge.");
}

CMD:asw(playerid, params[])
{
	new giveplayerid, result[128];
	if(sscanf(params, "us[128]", giveplayerid, result)) return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} (/asw)admin stranger whipser [playerid/PartOfName] [whisper text]");
	if(!IsPlayerConnected(giveplayerid)) return SendClientMessage(playerid, COLOR_GREY, "{FF0000}Error:{FFFFFF} That player isn't connected.");
	if(giveplayerid == playerid) return SendClientMessage(playerid, COLOR_GREY, "You can't whisper to yourself.");
	new str[128];
	if(PlayerInfo[giveplayerid][pMask] != 0 )
	{
		if(PlayerInfo[playerid][pAdmin] >= 2 && PlayerInfo[playerid][pStealthed] == 1)
		{
			format(str, sizeof(str), "A silent admin whispers: %s", (result));
			SendClientMessage(giveplayerid, COLOR_YELLOW, str);
			return 1;
		}
		if(PlayerInfo[playerid][pAdmin] >= 2 && PlayerInfo[playerid][pStealthed] != 1)
		{
			format(str, sizeof(str), "%s whispers: %s", PlayerICName(playerid),(result));
			SendClientMessage(giveplayerid, COLOR_YELLOW, str);
			return 1;
		}
		if(PlayerInfo[playerid][pAdmin] == 1 && !ADuty[playerid])
		{
			format(str, sizeof(str), "A silent admin whispers: %s",(result));
			SendClientMessage(giveplayerid, COLOR_YELLOW, str);
			return 1;
		}

	}
	else
	{
		SendClientMessage(playerid, COLOR_GREY, "This command is only for whisper stranger, use /w for normal.");
	}
	return 1;

}

CMD:w(playerid, params[])
	return cmd_whisper(playerid, params);

CMD:whisper(playerid, params[])
{
	if(gPlayerLogged[playerid] == 0)
	{
		SendClientMessage(playerid, COLOR_GREY, "You havent logged in yet.");
		return 1;
	}
	if(HidePM[playerid] && GetPlayerState(playerid) != PLAYER_STATE_SPECTATING) return SendClientMessage(playerid, COLOR_GREY, "Whisper chat is currently turned off, use /togwhisper.");
	if(OnCCTV[playerid] != -1) return 1;
	new giveplayerid, result[128];
	if(sscanf(params, "us[128]", giveplayerid, result)) return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} (/w)hisper [playerid/PartOfName] [whisper text]");
	if(!IsPlayerConnected(giveplayerid)) return SendClientMessage(playerid, COLOR_GREY, "{FF0000}Error:{FFFFFF} That player isn't connected.");
	if(giveplayerid == playerid) return SendClientMessage(playerid, COLOR_GREY, "You can't whisper to yourself.");
	if(PlayerInfo[playerid][pAdmin] < 1 || (PlayerInfo[playerid][pAdmin] == 1 && !ADuty[playerid]))
	{
		if(GetDistanceBetweenPlayers(playerid, giveplayerid) > 6 || GetPlayerState(giveplayerid) == PLAYER_STATE_SPECTATING)
		{
			SendClientMessage(playerid, COLOR_GREY, "That player is not in range.");
			return 1;
		}
	}
	if(PlayerInfo[giveplayerid][pMask] != 0 ) return SendClientMessage(playerid, COLOR_GREY, "That player is not in range.");

	// Gagged
	if(IsPlayerGagged(playerid)) {
		SendClientMessage(playerid, COLOR_GREY, "The gag in your mouth makes you unable to speak...");

		new gagStr[128];
		format(gagStr, sizeof(gagStr), "* %s tries to mumble something quietly.", PlayerICName(playerid));
		SetPlayerChatBubble(playerid, gagStr, COLOR_PURPLE, 20.0, 15000);
		return 1;
	}
	new str[128];

	if(HidePM[giveplayerid] > 0 && PlayerInfo[playerid][pAdmin] <= 1)
	{
		SendClientMessage(playerid, COLOR_GREY, "That player is blocking whispers.");
		return 1;
	}
	if(ADuty[giveplayerid] == true) return SendClientMessage(playerid, COLOR_GREY, "Do not disturb an admin on duty! Use /report instead!");
	format(str, sizeof(str), "Whisper to %s(ID: %d): %s", PlayerICName(giveplayerid), giveplayerid, (result));
	SendClientMessage(playerid,  COLOR_YELLOW, str);
	format(str, sizeof(str), "[/W] %s whispered %s (ID %d): %s", PlayerICName(playerid), PlayerICName(giveplayerid), giveplayerid, (result));
	SendShadowMsg(COLOR_GEAR_DARKORANGE, str);
	new year, month, day;
	getdate(year, month, day);
	new hour, minute, second;
	gettime(hour, minute, second);
	hour = FixHour(hour);
	format(str, sizeof(str), "[/W] %s whispered %s (ID %d): %s at %02d %s %02d:%02d:%02d ", PlayerICName(playerid), PlayerICName(giveplayerid), giveplayerid, (result), day, GetMonthFromInt(month), hour, minute, second);
	logswrite("whisper.log", str);
	format(str, sizeof(str), "* %s mutters something to %s.", PlayerICName(playerid), PlayerICName(giveplayerid));
	SetPlayerChatBubble(playerid, str, COLOR_PURPLE, 20.0, 15000);
	if(beingSpectatedID[playerid] != INVALID_PLAYER_ID)
	{
		if(IsPlayerConnected(beingSpectatedID[playerid]) && SpectatingID[beingSpectatedID[playerid]] == playerid)
		{
			format(str, sizeof(str), "[AdmWrn] %s whispered to %s (ID %d): %s", PlayerICName(playerid), PlayerICName(giveplayerid), giveplayerid, (result));
			SendClientMessage(beingSpectatedID[playerid], COLOR_YELLOW, str);
		}
	}
	if((PlayerInfo[playerid][pAdmin] == 0 || (PlayerInfo[playerid][pAdmin] == 1 && !ADuty[playerid])) && GetDistanceBetweenPlayers(playerid, giveplayerid) <= 6)
	{
		format(str, sizeof(str), "%s(ID: %d) whispers: %s", PlayerICName(playerid), playerid, (result));
		SendClientMessage(giveplayerid, COLOR_YELLOW, str);
		return 1;
	}
	if(PlayerInfo[playerid][pAdmin] == 1 && ADuty[playerid])
	{
		format(str, sizeof(str), "A silent admin whispers: %s", (result));
		SendClientMessage(giveplayerid, COLOR_YELLOW, str);
		return 1;
	}
	if(PlayerInfo[playerid][pAdmin] == 1 && GetPlayerState(playerid) == PLAYER_STATE_SPECTATING)
	{
		format(str, sizeof(str), "A silent admin whispers: %s", (result));
		SendClientMessage(giveplayerid, COLOR_YELLOW, str);
		return 1;
	}
	if(PlayerInfo[playerid][pAdmin] >= 2 && PlayerInfo[playerid][pStealthed] != 1)
	{
		format(str, sizeof(str), "%s whispers: %s", PlayerICName(playerid),(result));
		SendClientMessage(giveplayerid, COLOR_YELLOW, str);
		return 1;
	}
	if(PlayerInfo[playerid][pAdmin] >= 2 && PlayerInfo[playerid][pStealthed] == 1)
	{
		format(str, sizeof(str), "A silent admin whispers: %s", (result));
		SendClientMessage(giveplayerid, COLOR_YELLOW, str);
		return 1;
	}
	return 1;
}

CMD:o(playerid, params[])
{
	if(gPlayerLogged[playerid] == 0)
	{
		SendClientMessage(playerid, COLOR_GREY, "You havent logged in yet.");
		return 1;
	}
	if((noooc) && (PlayerInfo[playerid][pAdmin] < 2 && PlayerInfo[playerid][pDev] < DEVRANK_MANAGER))
	{
		SendClientMessage(playerid, COLOR_GREY, "The OOC channel has been disabled by an Admin.");
		return 1;
	}
	if(gOoc[playerid]) return SendClientMessage(playerid, COLOR_GREY, "OOC channel is currently turned off, use /togooc.");
	new name[24];
	strmid(name, str_replace('_', ' ', PlayerName(playerid)), 0, MAX_PLAYER_NAME);
	new result[128];
	new str[128];
	if(sscanf(params, "s[128]", result)) return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} (/o)oc [ooc chat]");
	format(str, sizeof(str), "(( %s: %s ))", name, result);
	OOCOff(COLOR_OOC, str);
	return 1;
}



CMD:amsgs(playerid, params[])   //display the admin messages
{
	if(!PlayerInfo[playerid][pAdmin])
		return AdmErrorMsg;

	displayAdminMessages(playerid);
	return 1;
}

CMD:fly(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] < 2)
		return AdmErrorMsg;

	if(pDeathState[playerid] != PLAYER_STATE_NORMAL)
		return SendClientMessage(playerid, COLOR_GREY, "You cannot use this at the moment.");

	if(flyingUsed[playerid]) CancelFlyMode(playerid);
	else
	{
		GetPlayerPos(playerid, Fly_X[playerid], Fly_Y[playerid], Fly_Z[playerid]);
		FlyMode(playerid);
		SendClientMessage(playerid, COLOR_LIGHTBLUE, "You have entered Fly Spectate mode");
		SendClientMessage(playerid, COLOR_WHITE, "Use {FF0000}UP DOWN LEFT RIGHT{FFFFFF} to move the camera.");
		SendClientMessage(playerid, COLOR_WHITE, "Press {FF0000}LSHIFT{FFFFFF} to speed up and {FF0000}SPACE{FFFFFF} to slow down.");
	}
	return 1;
}

CMD:togwarns(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] >= 1)
	{
		if(ToggedWarns[playerid] == false)
		{
			ToggedWarns[playerid] = true;
			SendClientMessage(playerid, COLOR_YELLOW, "You have toggled the admin warnings off.");
		}
		else
		{
			ToggedWarns[playerid] = false;
			SendClientMessage(playerid, COLOR_YELLOW, "You will now see the warnings again.");
		}
	}
	else return SendClientMessage(playerid, COLOR_GREY, "{FF0000}You're not authorized to use that command.");
	return 1;
}

CMD:toga(playerid, params[])
{
	if(!PlayerInfo[playerid][pAdmin])
		return AdmErrorMsg;

	pMutedA[playerid] = !pMutedA[playerid];

	if(pMutedA[playerid])
		SendClientMessage(playerid, COLOR_GREY, "You have togged the admin chat (/a(dmin)) OFF.");
	else
		SendClientMessage(playerid, COLOR_GREY, "You have togged the admin chat (/a(dmin)) ON.");
	return 1;
}

CMD:aeject(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] < 2)
		return AdmErrorMsg;

	new targetid;
	if(sscanf(params, "u", targetid))
		return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /aeject [playerid/name]");

	if(!IsPlayerConnected(targetid))
		return SendClientMessage(playerid, COLOR_GREY, "{FF0000}Error:{FFFFFF} That player isn't connected.");

	if(!IsPlayerInAnyVehicle(targetid))
		return SendClientMessage(playerid, COLOR_GREY, "That player isn't in a vehicle.");

	new name[24], Float:x, Float:y, Float:z;
	strmid(name, str_replace('_', ' ', PlayerName(targetid)), 0, MAX_PLAYER_NAME);
	new str[128];
	format(str, sizeof(str), "{FF0000}AdmCmd:{FFFFFF} You have ejected %s from their vehicle.", name);
	SendClientMessage(playerid, COLOR_WHITE, str);
	SendClientMessage(targetid, COLOR_RED, "An admin has ejected you from your vehicle.");
	GetPlayerPos(targetid, x, y, z);
	SetPlayerPos(targetid, x, y, z +3);
	return 1;
}

CMD:a(playerid, params[]) return cmd_admin(playerid, params);

CMD:admin(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] >= 1)
	{
		if(pMutedA[playerid] == true) return SendClientMessage(playerid, COLOR_GREY, "You can't use this channel, you've togged it off.");
		new msg[128],
			Astr[128];
		if(!sscanf(params, "s[128]", msg))
		{
			new alevel[30];
			if(PlayerInfo[playerid][pAdmin] == 1)
			{
    alevel = "{FF00FF}Probationary Admin";
			}
			if(PlayerInfo[playerid][pAdmin] == 2)
			{
				alevel = "{00FF00}Junior Admin";
			}
			if(PlayerInfo[playerid][pAdmin] == 3)
			{
				alevel = "{04B404}General Admin";
			}
			if(PlayerInfo[playerid][pAdmin] >= 4 && PlayerInfo[playerid][pAdmin] <= 1336)
			{
				alevel = "{F4A460}Senior Admin";
			}
			if(PlayerInfo[playerid][pAdmin] >= 1337 && PlayerInfo[playerid][pAdmin] <= 99998)
			{
				alevel = "{FF0000}Head Admin";
			}
			if(PlayerInfo[playerid][pAdmin] >= 99999)
			{
				alevel = "{800000}Executive Admin";
			}
			if(PlayerInfo[playerid][pAdmin] == 1999999999)
			{
                alevel = "{0080FF}Community Director";
			}
			format(Astr, sizeof(Astr), " %s %s{FFFFFF}: %s **", alevel, PlayerOOCName(playerid), msg);
			/*#if UseDiscordBot 1
				Discord:sendPlayerRequest(DISCORD_ADMINCHAT_CHANNEL, playerid, "", msg, 0xFEB918);
			#endif*/
			SendAdminChatMessage(COLOR_WHITE, Astr);


			return 1;
		} else return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} (/a)dmin [admin chat]");
	} else return AdmErrorMsg;
}

CMD:hc(playerid, params[]) return cmd_helperchat(playerid, params);

CMD:helperchat(playerid, params[])
{
	if(PlayerInfo[playerid][pHelper] >= 1)
	{
		if(gHelperCh[playerid]) return SendClientMessage(playerid, COLOR_GREY, "Helper chat channel is currently turned off, use /toghelper.");
		new msg[128];
		if(!sscanf(params, "s[128]", msg))
		{
			new hrank[30];
			if(PlayerInfo[playerid][pHelper] == 1)
			{
				hrank = "Trial Helper";
			}
			if(PlayerInfo[playerid][pHelper] == 2)
			{
				hrank = "Helper";
			}
			if(PlayerInfo[playerid][pHelper] == 3)
			{
				hrank = "Senior Helper";
			}
			if(PlayerInfo[playerid][pHelper] == 4)
			{
				hrank = "Head Helper";
			}
			if(PlayerInfo[playerid][pHelper] >= 5)
			{
				hrank = "Director of The Helpers Team";
			}
			new name[24];
			strmid(name, str_replace('_', ' ', PlayerName(playerid)), 0, MAX_PLAYER_NAME);
			new str[128];
			format(str, sizeof(str), "** %s %s: %s **", hrank, name, msg);
			SendHelperMessage(HELPER_COLOR, str, 0);
		}
		else
		{
			SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /(h)elper(c)hat [message]");
		}
	}
	else
	{
		AdmErrorMsg;
	}
	return 1;
}

CMD:acceptunmute(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] > 1 || PlayerInfo[playerid][pHelper] > 2)
	{
		//senior helpers, admins
		//if(!ADuty[playerid]) return SendClientMessage(playerid, COLOR_GREY, "You are not on duty.");
		new targetid, sec[10];
		if(sscanf(params, "us[10]", targetid, sec)) return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /acceptunmute [playerid/name] [admute/newbmute/global]");
		{
			if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, COLOR_GREY, "{FF0000}Error:{FFFFFF} That player isn't connected.");
			new str[128];
			if(strmatch(sec, "admute"))
			{
				if( PlayerInfo[playerid][pAdmin] > 1 ) {
					if(adRequest[targetid] == true)
					{
						format(str, sizeof(str), "{FF0000}AdmWarning{FFFFFF}: %s (ID %d) has accepted %s's request to be unmuted from the advert system.", PlayerICName(playerid), playerid, PlayerICName(targetid));
						ABroadCast(COLOR_WHITE, str, 1);
						format(str, sizeof(str), "Your request has been accepted by an admin to be unmuted from the advert system.");
						SendClientMessage(targetid, COLOR_LIGHTBLUE, str);
						PlayerInfo[targetid][pAdMuted] = 0;
						adRequest[targetid] = false;
						PlayerInfo[targetid][pCash] -= adPrice[targetid];
					}
					else return SendClientMessage(playerid, COLOR_WHITE, "That player hasn't requested an unmute from the advert system.");
				} else return AdmErrorMsg;
			}
			else if(strmatch(sec, "newbmute"))
			{
				if(newbieRequest[targetid] == true)
				{
					format(str, sizeof(str), "{FF0000}AdmWarning{FFFFFF}: %s (ID %d) has accepted %s's request to be unmuted from the newbie chat channel.", PlayerICName(playerid), playerid, PlayerICName(targetid));
					ABroadCast(COLOR_WHITE, str, 1);
					format(str, sizeof(str), "{FF0000}HelperWarning{FFFFFF}: %s (ID %d) has accepted %s's request to be unmuted from the newbie chat channel.", PlayerICName(playerid), playerid, PlayerICName(targetid));
					SendHelperMessage( COLOR_WHITE, str, 0);
					format(str, sizeof(str), "Your request has been accepted by an admin to be unmuted from the newbie chat channel.");
					SendClientMessage(targetid, COLOR_LIGHTBLUE, str);
					PlayerInfo[targetid][pNewbieMuted] = 0;
					newbieRequest[targetid] = false;
					PlayerInfo[targetid][pCash] -= newbiePrice[targetid];
				}
				else return SendClientMessage(playerid, COLOR_WHITE, "That player hasn't requested an unmute from the newbie chat channel.");
			}
			else if(strmatch(sec, "global")){
				if(PlayerInfo[targetid][pGCRequestUnmute] == true){
					format(str, sizeof(str), "AdmWarning"COL_WHITE": %s (ID %d) has accepted %s's request to be unmuted from the global chat channel.", PlayerICName(playerid), playerid, PlayerICName(targetid));
					ABroadCast(COLOR_RED, str, 1);
					format(str, sizeof(str), "HelperWarning"COL_WHITE": %s (ID %d) has accepted %s's request to be unmuted from the global chat channel.", PlayerICName(playerid), playerid, PlayerICName(targetid));
					SendHelperMessage(COLOR_RED, str, 0);
					format(str, sizeof(str), "Your request has been accpted by an admin to be unmuted from the global chat channel.");
					SendClientMessage(targetid, COLOR_LIGHTBLUE, str);
					PlayerInfo[targetid][pGCMute] = 0;
					PlayerInfo[targetid][pGCRequestUnmute] = false;
					PlayerInfo[targetid][pCash] -= PlayerInfo[targetid][pGCUnmutePrice];
				}
				else return SendClientMessage(playerid, COLOR_WHITE, "That player hasn't requested an unmute from the global chat channel.");
			}
			else return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /acceptunmute [playerid/name] [admute/newbmute/global]");
		}
	}
	else return AdmErrorMsg;
	return 1;
}


//DENY UNMUTE OF NEWBIE, AD and GLOBAL.
CMD:denyunmute(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] > 1 || PlayerInfo[playerid][pHelper] > 2)
	{
		//senior helpers, admins
		//if(!ADuty[playerid]) return SendClientMessage(playerid, COLOR_GREY, "You are not on duty.");
		new targetid, sec[10];
		if(sscanf(params, "us[10]", targetid, sec)) return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /denyunmute [playerid/name] [admute/newbmute/global]");
		{
			if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, COLOR_GREY, "{FF0000}Error:{FFFFFF} That player isn't connected.");
			new str[128];
			if(strmatch(sec, "admute"))
			{
				if( PlayerInfo[playerid][pAdmin] > 1 ) {
					if(adRequest[targetid] == true)
					{
						format(str, sizeof(str), "{FF0000}AdmWarning{FFFFFF}: %s (ID %d) has denied %s's request to be unmuted from the advert system.", PlayerICName(playerid), playerid, PlayerICName(targetid));
						ABroadCast(COLOR_WHITE, str, 1);
						format(str, sizeof(str), "Your request has been denied by an admin to be unmuted from the advert system.");
						SendClientMessage(targetid, COLOR_LIGHTBLUE, str);
						adRequest[targetid] = false;
					}
					else return SendClientMessage(playerid, COLOR_WHITE, "That player hasn't requested an unmute from the advert system.");
				} else return AdmErrorMsg;
			}
			else if(strmatch(sec, "newbmute"))
			{
				if(newbieRequest[targetid] == true)
				{
					format(str, sizeof(str), "{FF0000}AdmWarning{FFFFFF}: %s (ID %d) has denied %s's request to be unmuted from the newbie chat channel.", PlayerICName(playerid), playerid, PlayerICName(targetid));
					ABroadCast(COLOR_WHITE, str, 1);
					format(str, sizeof(str), "{FF0000}HelperWarning{FFFFFF}: %s (ID %d) has denied %s's request to be unmuted from the newbie system.", PlayerICName(playerid), playerid, PlayerICName(targetid));
					SendHelperMessage( COLOR_WHITE, str, 0);
					format(str, sizeof(str), "Your request has been denied by an admin to be unmuted from the newbie chat channel.");
					SendClientMessage(targetid, COLOR_LIGHTBLUE, str);
					newbieRequest[targetid] = false;
				}
				else return SendClientMessage(playerid, COLOR_WHITE, "That player hasn't requested an unmute from the newbie system.");
			}
			else if(strmatch(sec, "global")){
				if(PlayerInfo[targetid][pGCRequestUnmute] == true){
					format(str, sizeof(str), ""COL_RED"AdmWarning"COL_WHITE": %s (ID %d) has denied %s's request to be unmuted from the global chat channel.", PlayerICName(playerid), playerid, PlayerICName(targetid));
					ABroadCast(COLOR_WHITE, str, 1);
					format(str, sizeof(str), ""COL_RED"HelperWarning"COL_WHITE": %s (ID %d) has denied %s's request to be unmuted from the global chat channel.", PlayerICName(playerid), playerid, PlayerICName(targetid));
					SendHelperMessage(COLOR_WHITE, str, 0);
					format(str, sizeof(str), "Your request has been denied by an admin to be unmuted from the global chat channel.");
					SendClientMessage(targetid, COLOR_LIGHTBLUE, str);
					PlayerInfo[targetid][pGCRequestUnmute] = false;
				}
			}
			else return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /denyunmute [playerid/name] [admute/newbmute/global]");
		}
	}
	else return AdmErrorMsg;
	return 1;
}


CMD:requestadunmute(playerid, params[])
{
	if(PlayerInfo[playerid][pAdMuted] != 0)
	{
		if(adRequest[playerid] == true) return SendClientMessage(playerid, COLOR_WHITE, "You're already requested an unmute.");
		new price;
		if(PlayerInfo[playerid][pLevel] <= 3) price = PlayerInfo[playerid][pLevel] * 15000;
		else price = PlayerInfo[playerid][pLevel] * 30000;
		new str[128];
		format(str, sizeof(str), "You don't have enough money ($%d) to do this.", price);
		if(PlayerInfo[playerid][pCash] >= price)
		{
			format(str, sizeof(str), "{FF0000}AdmWarning{FFFFFF}: %s (ID %d) has requested to be unmuted from the advert system (/acceptunmute)", PlayerICName(playerid), playerid);
			ABroadCast(COLOR_WHITE, str, 1);
			format(str, sizeof(str), "You have requested to be unmuted from the advert system for $%d.", price);
			SendClientMessage(playerid, COLOR_LIGHTBLUE, str);
			adRequest[playerid] = true;
			adPrice[playerid] = price;
		}
		else return SendClientMessage(playerid, COLOR_GRAD1, str);
	}
	else return SendClientMessage(playerid, COLOR_GRAD1, "You're not muted from the advertisement system.");
	return 1;
}
CMD:requestnewbieunmute(playerid, params[])
{
	if(PlayerInfo[playerid][pNewbieMuted] != 0)
	{
		if(PlayerInfo[playerid][pNMuteTime] == -1) return SendClientMessage(playerid, COLOR_GREY, "You may not request an unmute as you are permanently banned from the channel (post an unmute request on Coming soon)");
		new str[128];
		if(PlayerInfo[playerid][pReqUnmute] > 0)
		{
			if(PlayerInfo[playerid][pReqUnmute] > 3600) format(str, sizeof(str), "You have %d hours left before you can /requestnewbieunmute", PlayerInfo[playerid][pReqUnmute]/3600);
			else format(str, sizeof(str), "You have %d minutes left before you can /requestnewbieunmute", PlayerInfo[playerid][pReqUnmute]/60);

			return SendClientMessage(playerid, COLOR_GREY, str);
		}
		if(newbieRequest[playerid] == true) return SendClientMessage(playerid, COLOR_WHITE, "You're already requested an unmute.");
		new price;
		if(PlayerInfo[playerid][pLevel] <= 3) price = PlayerInfo[playerid][pLevel] * 15000;
		else price = PlayerInfo[playerid][pLevel] * 30000;
		format(str, sizeof(str), "You don't have enough money ($%d) to do this.", price);
		if(PlayerInfo[playerid][pCash] >= price)
		{
			format(str, sizeof(str), "{FF0000}AdmWarning{FFFFFF}: %s (ID %d) has requested to be unmuted from the newbie chat (/acceptunmute /OR/ /denyunmute)", PlayerICName(playerid), playerid);
			ABroadCast(COLOR_WHITE, str, 1);
			format(str, sizeof(str), "{FF0000}HelperWarning{FFFFFF}: %s (ID %d) has requested to be unmuted from the newbie chat (/acceptunmute /OR/ /denyunmute)", PlayerICName(playerid), playerid);
			SendHelperMessage( COLOR_WHITE, str, 0);
			format(str, sizeof(str), "You have requested to be unmuted from the newbie chat for $%d.", price);
			SendClientMessage(playerid, COLOR_LIGHTBLUE, str);
			newbieRequest[playerid] = true;
			newbiePrice[playerid] = price;
		}
		else return SendClientMessage(playerid, COLOR_GRAD1, str);
	}
	else return SendClientMessage(playerid, COLOR_GRAD1, "You're not muted from the newbie chat channel.");
	return 1;
}

CMD:blist(playerid, params[])
{
	if(!PlayerInfo[playerid][pAdmin] && PlayerInfo[playerid][pMember] != FACTION_NEWS)
		return AdmErrorMsg;

	new dialogstr[5000];
	foreach(new i : Player)
	{
		if(PlayerInfo[i][pAdMuted] == 1)
		{
			format(dialogstr, sizeof(dialogstr), "%s\n%s", dialogstr, PlayerOOCName(i));
		}
	}
	ShowPlayerDialog(playerid, DIALOG_UNUSED, DIALOG_STYLE_LIST, "Ad Muted Players", dialogstr, "Close", "");
	return 1;
}

CMD:fmembers(playerid, params[])
{
	if(PlayerInfo[playerid][pFamed] >= 1 || PlayerInfo[playerid][pAdmin] >= 2)
	{
		new count = 0;
		new str[128];
		SendClientMessage(playerid, COLOR_WHITE, "Famed Member(s)");
		foreach( new i: Player )
		{
			if(IsPlayerConnected(i) && PlayerInfo[i][pFamed] != 0 && usingFC[i] == 1)
			{
				new name[24];
				strmid(name, str_replace('_', ' ', PlayerName(i)), 0, MAX_PLAYER_NAME);
				if(PlayerInfo[i][pFamed] == 1)format(str, sizeof(str), "%s (ID %d)", name, i);
				else format(str, sizeof(str), "%s (ID %d - Famed Manager)", name, i);
				SendClientMessage(playerid, COLOR_GREY, str);
				count++;
			}
		}
		if(count == 0) return SendClientMessage(playerid, COLOR_GREY, "No Famed members online.");
	}
	else return AdmErrorMsg;
	return 1;
}

CMD:fc(playerid, params[]) return cmd_famedchat(playerid, params);

CMD:famedchat(playerid, params[])
{
	if(PlayerInfo[playerid][pFamed] >= 1)
	{
		if(FamedChatTog[playerid]) return SendClientMessage(playerid, COLOR_GREY, "Famed chat is currently turned off, use /togfamedchat.");
		new msg[128];
		if(!sscanf(params, "s[128]", msg))
		{
			if(IsPlayerConnected(playerid))
			{
				new famerank[32];
				if(PlayerInfo[playerid][pFamed] == 1) famerank = "Famed Member";
				if(PlayerInfo[playerid][pFamed] == 2) famerank = "Famed Manager";
				new name[24];
				new str[128];
				strmid(name, str_replace('_', ' ', PlayerName(playerid)), 0, MAX_PLAYER_NAME);
				format(str, sizeof(str), "** %s %s: %s **", famerank, name, msg);
				SendFamedMessage(COLOR_FAMED, str);
			}
		}
		else
		{
			SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /(f)amed(c)hat [message]");
		}
	}
	else
	{
		AdmErrorMsg;
	}
	return 1;
}
CMD:ec(playerid, params[]) return cmd_eventchat(playerid, params);
CMD:eventchat(playerid, params[])
{
	if(PlayerInfo[playerid][pEventModd] == 1 || PlayerEventMod[playerid] == 1)
	{
		new str[128];
		new msg[128];
		if(!sscanf(params, "s[128]", msg))
		{
			format(str, sizeof(str), "**[Event Chat] %s: %s **", PlayerOOCName(playerid), msg);
			SendEventHelperMessage(COLOR_EVENTHELP, str);
		}
		else
		{
			SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /(e)vent(c)hat [message]");
		}
	}
	return 1;
}
CMD:dc(playerid, params[]) return cmd_devchat(playerid, params);

CMD:devchat(playerid, params[])
{
	if(PlayerInfo[playerid][pDev] < 1) return AdmErrorMsg;
	if(isnull(params)) return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /(d)ev(c)hat [message]");
	new str[128];
	if(PlayerInfo[playerid][pDev] == DEVRANK_JUNIOR) str = "Junior Developer";
	else if(PlayerInfo[playerid][pDev] == DEVRANK_SENIOR) str = "Senior Developer";
	else if(PlayerInfo[playerid][pDev] == DEVRANK_MANAGER) str = "Development Manager";
	else if(PlayerInfo[playerid][pDev] >= DEVRANK_LEAD) str = "Lead Developer";
	format(str, sizeof(str), "** %s %s: %s **", str, PlayerOOCName(playerid), params);
	SendDeveloperMessage(COLOR_DEV, str);
	return 1;
}

CMD:togdevchat(playerid, params[])
{
	if(PlayerInfo[playerid][pDev] < 1) return AdmErrorMsg;
	if(toggedDevChat[playerid] == true)
	{
		SendClientMessage(playerid, COLOR_GRAD2, "Development Chat enabled.");
		toggedDevChat[playerid] = false;
	}
	else
	{
		SendClientMessage(playerid, COLOR_GRAD2, "Development Chat disabled.");
		toggedDevChat[playerid] = true;
	}
	return 1;
}
CMD:togdc(playerid, params[]) return cmd_togdevchat(playerid, params);

CMD:ohelpers(playerid, params[])
{
	if(PlayerInfo[playerid][pHelper] != 0)
	{
		new query[128];
		mysql_format(sqlGameConnection, query, sizeof(query), "SELECT `Name`, `LastLogin` FROM `players` WHERE `Adjustable`=1 AND `HelperLevel` > 0");
		mysql_pquery(sqlGameConnection, query, "onOHelpers", "i", playerid);
	}
	else return SendClientMessage(playerid, COLOR_WHITE, "You're not a helper.");
	return 1;
}

CMD:omembers(playerid, params[])
{
	if(PlayerInfo[playerid][pMember] > 0 || PlayerInfo[playerid][pLeader] > 0)
	{
		new query[128];
		mysql_format(sqlGameConnection, query, sizeof(query), "SELECT `Name`, `LastLogin`, `Leader`, `Recruiter`, `Rank` FROM `players` WHERE `Adjustable`=1 AND `Member`=%d", PlayerInfo[playerid][pMember]);
		mysql_pquery(sqlGameConnection, query, "onOMembers", "i", playerid);
	}
	else
	{
		SendClientMessage(playerid, COLOR_WHITE, "You're not in a faction.");
	}
	return 1;
}

CMD:ofmembers(playerid, params[]){
	if(PlayerInfo[playerid][pFMember] == 255) return SendClientMessage(playerid, COLOR_GREY, "You are not in a family.");
	new query[128];
	mysql_format(sqlGameConnection, query, sizeof(query), "SELECT `Name`, `LastLogin`, `Rank` FROM `players` WHERE `Adjustable`=1 AND `FMember`=%d", PlayerInfo[playerid][pFMember]);
	mysql_pquery(sqlGameConnection, query, "onOFMembers", "i", playerid);
	return 1;
}

CMD:otesters(playerid, params[])
{
	if(PlayerInfo[playerid][pTester] != 0){
		new query[128];
		mysql_format(sqlGameConnection, query, sizeof(query), "SELECT `Name`, `LastLogin`, `TesterReports` FROM `players` WHERE `Adjustable`=1 AND `TesterLevel` > 0");
		mysql_pquery(sqlGameConnection, query, "onOTesters", "i", playerid);
	}
	else return SendClientMessage(playerid, COLOR_WHITE, "You're not a tester.");
	return 1;
}

CMD:odevs(playerid, params[])
{
	if(PlayerInfo[playerid][pDev] != 0){
		new query[128];
		mysql_format(sqlGameConnection, query, sizeof(query), "SELECT `Name`, `LastLogin` FROM `players` WHERE `Adjustable`=1 AND `DevLevel` > 0");
		mysql_pquery(sqlGameConnection, query, "onODev", "i", playerid);
	}
	else return SendClientMessage(playerid, COLOR_WHITE, "You're not a developer.");
	return 1;
}

CMD:omappers(playerid, params[])
{
	if(PlayerInfo[playerid][pMapper] != 0){
		new query[128];
		mysql_format(sqlGameConnection, query, sizeof(query), "SELECT `Name`, `LastLogin` FROM `players` WHERE `Adjustable`=1 AND `Mapper` > 0");
		mysql_pquery(sqlGameConnection, query, "onOmapper", "i", playerid);
	}
	else return SendClientMessage(playerid, COLOR_WHITE, "You're not a mapper.");
	return 1;
}

CMD:oadmins(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] >= 4)
	{
		new query[128];
		mysql_format(sqlGameConnection, query, sizeof(query), "SELECT `Name`, `LastLogin`, `AdminLevel` FROM `players` WHERE `Adjustable`=1 AND `AdminLevel` > 0");
		mysql_pquery(sqlGameConnection, query, "onOAdmin", "i", playerid);
	}
	else return SendClientMessage(playerid, COLOR_WHITE, "You're not an administrator.");
	return 1;
}

CMD:members(playerid, params[])
{
	if(PlayerInfo[playerid][pLeader] != 0 || PlayerInfo[playerid][pMember] != 0 || PlayerInfo[playerid][pFMember] != 255)
	{
		new memberstr[3600];
		foreach( new i: Player )
		{
		    if(PlayerInfo[playerid][pFMember] == 255)
		    {
				if(usingFakeBadge[i])
				{
					if(PlayerInfo[playerid][pMember] == PlayerInfo[i][pHAFakeBadge])
					{
						if(PlayerPaused[i])format(memberstr, sizeof(memberstr), "%s[{E9CF8D}Paused{FFFFFF}] {FFFFFF}%s - {FFFF00}Rank: %s(1){FFFFFF}\n", memberstr, PlayerOOCName(i), GetFakeRank(i));
						else format(memberstr, sizeof(memberstr), "%s%s - {FFFF00}Rank: %s(1){FFFFFF}\n", memberstr, PlayerOOCName(i), GetFakeRank(i));
					}
				}
			}
			if(PlayerInfo[playerid][pLeader] != 0 || PlayerInfo[playerid][pMember] != 0)
			{
				if(PlayerInfo[i][pMember] == PlayerInfo[playerid][pMember])
				{
				    if(PlayerInfo[playerid][pMember] == 11)
				    {
				        if(PlayerInfo[i][pLeader] == PlayerInfo[playerid][pMember])
						{
							if(PlayerPaused[i]) format(memberstr, sizeof(memberstr), "%s[{E9CF8D}Paused{FFFFFF}] %s - {2E64FE}Rank: %s(%d - Leader){FFFFFF}\n", memberstr, PlayerOOCName(i), RealS9Rank(i), PlayerInfo[i][pRank]);
							else format(memberstr, sizeof(memberstr), "%s%s - {2E64FE}Rank: %s(%d - Leader){FFFFFF}\n", memberstr, PlayerOOCName(i), RealS9Rank(i), PlayerInfo[i][pRank]);
						}
						else
						{
							if(PlayerPaused[i]) format(memberstr, sizeof(memberstr), "%s[{E9CF8D}Paused{FFFFFF}] %s - {FFFF00}Rank: %s(%d){FFFFFF}\n", memberstr, PlayerOOCName(i), RealS9Rank(i), PlayerInfo[i][pRank]);
							else format(memberstr, sizeof(memberstr), "%s%s - {FFFF00}Rank: %s(%d){FFFFFF}\n", memberstr, PlayerOOCName(i), RealS9Rank(i), PlayerInfo[i][pRank]);
						}
				    }
					else if(PlayerInfo[i][pLeader] == PlayerInfo[playerid][pMember])
					{
						if(PlayerPaused[i]) format(memberstr, sizeof(memberstr), "%s[{E9CF8D}Paused{FFFFFF}] %s - {2E64FE}Rank: %s(%d - Leader){FFFFFF}\n", memberstr, PlayerOOCName(i), GetPlayerRank(i), PlayerInfo[i][pRank]);
						else format(memberstr, sizeof(memberstr), "%s%s - {2E64FE}Rank: %s(%d - Leader){FFFFFF}\n", memberstr, PlayerOOCName(i), GetPlayerRank(i), PlayerInfo[i][pRank]);
					}
					else if(PlayerInfo[i][pRecruiter] == PlayerInfo[playerid][pMember])
					{
						if(PlayerPaused[i]) format(memberstr, sizeof(memberstr), "%s[{E9CF8D}Paused{FFFFFF}] %s - {a3995b}Rank: %s(%d - Recruiter){FFFFFF}\n", memberstr, PlayerOOCName(i), GetPlayerRank(i), PlayerInfo[i][pRank]);
						else format(memberstr, sizeof(memberstr), "%s%s - {a3995b}Rank: %s(%d - Recruiter){FFFFFF}\n", memberstr, PlayerOOCName(i), GetPlayerRank(i), PlayerInfo[i][pRank]);
					}
					else
					{
						if(PlayerPaused[i]) format(memberstr, sizeof(memberstr), "%s[{E9CF8D}Paused{FFFFFF}] %s - {FFFF00}Rank: %s(%d){FFFFFF}\n", memberstr, PlayerOOCName(i), GetPlayerRank(i), PlayerInfo[i][pRank]);
						else format(memberstr, sizeof(memberstr), "%s%s - {FFFF00}Rank: %s(%d){FFFFFF}\n", memberstr, PlayerOOCName(i), GetPlayerRank(i), PlayerInfo[i][pRank]);
					}
				}
			}
			else if(PlayerInfo[playerid][pFMember] != 255)
			{
				if(PlayerInfo[i][pFMember] == PlayerInfo[playerid][pFMember])
				{
					if(PlayerPaused[i]) format(memberstr, sizeof(memberstr), "%s[{E9CF8D}Paused{FFFFFF}] %s - {FFFF00}Rank: %d{FFFFFF}\n", memberstr, PlayerOOCName(i), PlayerInfo[i][pRank]);
					else format(memberstr, sizeof(memberstr), "%s%s - {FFFF00}Rank: %d{FFFFFF}\n", memberstr, PlayerOOCName(i), PlayerInfo[i][pRank]);
				}
			}
		}
		ShowPlayerDialog(playerid, DIALOG_UNUSED, DIALOG_STYLE_LIST, "Members Online", memberstr, "Close", "");
	}
	else return SendClientMessage(playerid, COLOR_GRAD1, "You are not a member of an organization.");
	return 1;
}

CMD:tc(playerid, params[]) return cmd_testchat(playerid, params);

CMD:testchat(playerid, params[])
{
	if(PlayerInfo[playerid][pTester] >= 1)
	{
		if(gTesterCh[playerid]) return SendClientMessage(playerid, COLOR_GREY, "Tester chat channel is currently turned off, use /togtester.");
		new msg[128];
		new str[128];
		if(!sscanf(params, "s[128]", msg))
		{
			if(PlayerInfo[playerid][pTester] == TESTERRANK_REGULAR) str = "Regular Tester";
			if(PlayerInfo[playerid][pTester] == TESTERRANK_SENIOR) str = "Senior Tester";
			if(PlayerInfo[playerid][pTester] == TESTERRANK_MANAGER) str = "Tester Manager";

			format(str, sizeof(str), "{00FF00}** %s %s: %s **", str, PlayerOOCName(playerid), msg);
			SendTesterMessage(SCOLOR_GREEN, str);
		}
		else
		{
			SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /(t)est(c)hat [message]");
		}
	}
	else
	{
		AdmErrorMsg;
	}
	return 1;
}

CMD:mapperchat(playerid, params[])
{
	if(PlayerInfo[playerid][pMapper] < MAPPERRANK_REGULAR) return AdmErrorMsg;
	if(isnull(params)) return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /(m)apper(c)hat [message]");
	if(mcOff == true) return SendClientMessage(playerid, COLOR_GRAD1, "{FF0000}Error:{FFFFFF} The mapping chat is disabled.");
	new str[128];
	if(mcTog[playerid] == true && PlayerInfo[playerid][pMapper] < MAPPERRANK_MANAGER) return SendClientMessage(playerid, COLOR_GRAD1, "{FF0000}Error:{FFFFFF} You have the mapper chat toggled, use /togmc.");
	else
	{
		if(PlayerInfo[playerid][pMapper] == MAPPERRANK_REGULAR) str = "Mapper";
		else if(PlayerInfo[playerid][pMapper] == MAPPERRANK_SENIOR) str = "Senior Mapper";
		else if(PlayerInfo[playerid][pMapper] == MAPPERRANK_MANAGER) str = "Mapping Manager";
		format(str, sizeof(str), "{cc4270}** %s %s: %s **", str, PlayerOOCName(playerid), params);
		SendMapperMessage(COLOR_GREY, str); // colour requested by watts (since it was the same as /gc)
	}
	return 1;
}

CMD:togmc(playerid, params[])
{
	if(PlayerInfo[playerid][pMapper] < MAPPERRANK_REGULAR) return AdmErrorMsg;
	if(mcOff == true) return SendClientMessage(playerid, COLOR_GRAD1, "{FF0000}Error:{FFFFFF} The mapping chat is disabled.");
	if(mcTog[playerid] == true)
	{
		SendClientMessage(playerid, COLOR_GRAD1, "Mapper chat enabled.");
		mcTog[playerid] = false;
	}
	else
	{
		SendClientMessage(playerid, COLOR_GRAD1, "Mapper chat disabled.");
		mcTog[playerid] = true;
	}
	return 1;
}

CMD:togmtc(playerid, params[])
{
	if(PlayerInfo[playerid][pMapper] < MAPPERRANK_MANAGER) return AdmErrorMsg;
	if(mcOff == true)
	{
		SendMapperMessage(TCOLOR_SENATE, "Mapper chat enabled by a Manager.");
		mcOff = false;
	}
	else
	{
		SendMapperMessage(TCOLOR_SENATE, "Mapper chat disabled by a Manager.");
		mcOff = true;
	}
	return 1;
}

CMD:mc(playerid, params[]) return cmd_mapperchat(playerid, params);
CMD:vc(playerid, params[]) return cmd_vipchat(playerid, params);

CMD:vipchat(playerid, params[])
{
	if(PlayerInfo[playerid][pDonateRank] >= 1)
	{
		new msg[128];
		new str[128];
		if(!sscanf(params, "s[128]", msg))
		{
			if(IsPlayerConnected(playerid))
			{
				new viprank[32];
				if(PlayerInfo[playerid][pDonateRank] == 1) viprank = "Bronze VIP";
				if(PlayerInfo[playerid][pDonateRank] == 2) viprank = "Silver VIP";
				if(PlayerInfo[playerid][pDonateRank] == 3) viprank = "Gold VIP";
				if(PlayerInfo[playerid][pDonateRank] == 4) viprank = "Platinum VIP";
				new name[24];
				strmid(name, str_replace('_', ' ', PlayerName(playerid)), 0, MAX_PLAYER_NAME);
				format(str, sizeof(str), "** %s %s: %s **", viprank, name, msg);
				SendVIPMessage(0x80008000, str);
			}
		}
		else
		{
			SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /(v)ip(c)hat [message]");
		}
	}
	else
	{
		AdmErrorMsg;
	}
	return 1;
}

CMD:int(playerid, params[]) return cmd_intercom(playerid, params);

CMD:intercom(playerid, params[])
{
	new vw, msg[128];
	new vehid = GetPlayerVehicleID(playerid);
	new str[128];
	if(GetVehicleModel(vehid) == 519 || GetVehicleModel(vehid) == 553) //shamal, andromeda, nevada
	{
		if(!sscanf(params, "s[128]", msg))
		{
			vw = vehid;
			format(str, sizeof(str), "[Pilot %s:o<%s]", PlayerICName(playerid), msg);
			SendClientMessage(playerid, COLOR_YELLOW, str);
			foreach( new i: Player )
			{
				if(GetPlayerVirtualWorld(i) == vw && GetPlayerInterior(i) == 1)
				{
					SendClientMessage(i, COLOR_YELLOW, str);
				}
			}
		}
		else
		{
			SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} (/int)ercom [text]");
		}
	}
	else
	{
		SendClientMessage(playerid, COLOR_GREY, "You're not in a vehicle with an intercom.");
	}
	return 1;
}

CMD:m(playerid, params[]) return cmd_megaphone(playerid, params);



CMD:seizefunds(playerid, params[])
{
	if(PlayerInfo[playerid][pMember] != FACTION_JD || PlayerInfo[playerid][pLeader] != FACTION_JD)
		return AdmErrorMsg;

	if(!IsPlayerAtBankingPoint(playerid))
		return SendClientMessage(playerid, COLOR_GREY, "You can only do this at the bank counter.");

	new seizePlayer[25], seizeAmount, seizeReason[100];
	if(sscanf(params, "s[25]is[100]", seizePlayer, seizeAmount, seizeReason))
		return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /seizefunds [Firstname_Lastname] [amount] [reason]");

	if(seizeAmount < 1)
		return SendClientMessage(playerid, COLOR_GREY, "Enter a valid amount of money to seize.");

	if(strlen(seizeReason) < 3)
		return SendClientMessage(playerid, COLOR_GREY, "Enter a valid reason.");

	// See if the player is online
	new seizePlayerID = GetPlayerIDFromName(seizePlayer);
	new str[128];
	if(IsPlayerConnected(seizePlayerID)) {
		// Seize from an online player
		if(PlayerInfo[seizePlayerID][pAccount] < seizeAmount) {
			format(str, sizeof(str), "* You can currently not seize the full amount ($%s) from %s.", AddThousandsSeparators(seizeAmount), PlayerOOCName(seizePlayerID));
			SendClientMessage(playerid, COLOR_GREY, str);
			format(str, sizeof(str), "* %s only has $%s in their bank account.", PlayerOOCName(seizePlayerID), AddThousandsSeparators(PlayerInfo[seizePlayerID][pAccount]));
			SendClientMessage(playerid, COLOR_GREY, str);
			return 1;
		}

		PlayerInfo[seizePlayerID][pAccount] -= seizeAmount;
		GiveMoney(playerid, seizeAmount);

		SendClientMessage(playerid, COLOR_LIGHTBLUE, "____________________________________________");

		format(str, sizeof(str), "* You have successfully seized $%s from %s's bank account.", AddThousandsSeparators(seizeAmount), PlayerOOCName(seizePlayerID));
		SendClientMessage(playerid, COLOR_LIGHTBLUE, str);

		format(str, sizeof(str), "* Reason: '%s'", seizeReason);
		SendClientMessage(playerid, COLOR_LIGHTBLUE, str);

		format(str, sizeof(str), "Previous balance: $%s", AddThousandsSeparators(PlayerInfo[seizePlayerID][pAccount] + seizeAmount));
		SendClientMessage(playerid, COLOR_GREY, str);

		format(str, sizeof(str), "New balance: $%s", AddThousandsSeparators(PlayerInfo[seizePlayerID][pAccount]));
		SendClientMessage(playerid, COLOR_GREY, str);

		SendClientMessage(playerid, COLOR_LIGHTBLUE, "____________________________________________");
	}
	else {
		// Seize from an offline player
		new query[128];
		mysql_format(sqlGameConnection, query, sizeof(query), "SELECT `Bank` FROM `players` WHERE `Name` = '%e' LIMIT 1", seizePlayer);
		mysql_pquery(sqlGameConnection, query, "OnOfflineSeizeFunds", "isis", playerid, seizePlayer, seizeAmount, seizeReason);
	}
	return 1;
}

CMD:gavel(playerid, params[])
{
	//sitting in judge seat
	if(IsPlayerInRangeOfPoint(playerid, 3.0, 1424.1324, -1465.8782, 1616.9574))
	{
		if(PlayerInfo[playerid][pMember] != 7) return SendClientMessage(playerid, COLOR_GREY, "You are not a member of the Judicial Department.");
		new str[128];
		format(str, sizeof(str), "* Judge %s bangs the gravel on the bench.", PlayerICName(playerid));
		ProxDetector(30.0, playerid, str, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
		foreach( new i: Player )
		{
			if(IsPlayerInRangeOfPoint(i, 30.0, 211.1413, 168.8328, 1003.4689))
			{
				PlayerPlaySound(i, 1131, 211.1413, 168.8328, 1003.4689);
			}
		}
	}
	else
	{
		SendClientMessage(playerid, COLOR_GREY, "You are not near a bench.");
	}
	return 1;
}



CMD:megaphone(playerid, params[])
{
	if(OnCCTV[playerid] != -1) return 1;
	if(IsACop(playerid) || PlayerInfo[playerid][pMember] == 4 || PlayerInfo[playerid][pLeader] == 4 || IsANG(playerid) || PlayerInfo[playerid][pMember] == FACTION_SANG)
	{
		new msg[128];
		new str[128];
		if(!sscanf(params, "s[128]", msg))
		{
			if(PlayerInfo[playerid][pMember] == 1 || PlayerInfo[playerid][pLeader] == 1) format(str, sizeof(str), "[%s %s:o< %s]", GetPlayerRank(playerid), PlayerICName(playerid), msg);
			else if(PlayerInfo[playerid][pMember] == 2 || PlayerInfo[playerid][pLeader] == 2) format(str, sizeof(str), "[%s %s:o< %s]", GetPlayerRank(playerid), PlayerICName(playerid), msg);
			else if(PlayerInfo[playerid][pMember] == 3 || PlayerInfo[playerid][pLeader] == 3) format(str, sizeof(str), "[%s %s:o< %s]", GetPlayerRank(playerid), PlayerICName(playerid), msg);
			else if(PlayerInfo[playerid][pMember] == 4 || PlayerInfo[playerid][pLeader] == 4) format(str, sizeof(str), "[%s %s:o< %s]", GetPlayerRank(playerid), PlayerICName(playerid), msg);
			else if(PlayerInfo[playerid][pMember] == 5 || PlayerInfo[playerid][pLeader] == 5) format(str, sizeof(str), "[%s %s:o< %s]", GetPlayerRank(playerid), PlayerICName(playerid), msg);
			else if(PlayerInfo[playerid][pMember] == FACTION_SANG || PlayerInfo[playerid][pLeader] == FACTION_SANG) format(str, sizeof(str), "[%s %s:o< %s]", GetPlayerRank(playerid), PlayerICName(playerid), msg);
		//	else if(PlayerInfo[playerid][pGroup] == GROUP_S9 ||PlayerInfo[playerid][pLeader] == 11) format(str, sizeof(str), "[%s (%i):o< %s]", GetPlayerRank(playerid), MaskNumber[playerid], msg);
			else if(PlayerInfo[playerid][pGroup] == GROUP_S9) // if s9
			{
				if(PlayerInfo[playerid][pMask])
				{
					format(str, sizeof(str), "[(%i):o< %s]", MaskNumber[playerid], msg);
				}
				else
				{
					if(FakeFaction[playerid] == 0) return SendClientMessage(playerid, COLOR_GRAD1, "You can't use a megaphone without a badge or mask.");
					format(str, sizeof(str), "[%s:o< %s]", PlayerICName(playerid), msg);
				}
			}

			ProxDetector(60.0, playerid, str, COLOR_YELLOW, COLOR_YELLOW, COLOR_YELLOW, COLOR_YELLOW, COLOR_YELLOW);
		}
		else
		{
			SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} (/m)egaphone [megaphone chat]");
		}
	}
	else
	{
		SendClientMessage(playerid, COLOR_GRAD2, "You are not authorized to use this.");
	}
	return 1;
}

CMD:nofactionooc(playerid, params[])
{
	if(PlayerInfo[playerid][pMember] != 0)
	{
		if( PlayerInfo[playerid][pMember] == 5 && PlayerInfo[playerid][pRank] < MAX_DOC_RANKS - 3 ) return SendClientMessage( playerid, COLOR_GREY, "You are not a High Command of the DoC." );
		if(PlayerInfo[playerid][pMember] != 1 && PlayerInfo[playerid][pRank] < 6) return SendClientMessage(playerid, COLOR_GREY, "You're not a high enough rank.");
		if(PlayerInfo[playerid][pMember] == 1 && PlayerInfo[playerid][pRank] < 5) return SendClientMessage(playerid, COLOR_GREY, "You're not a high enough rank.");
		if(PlayerInfo[playerid][pMember] == FACTION_SANG && PlayerInfo[playerid][pRank] < 5) return SendClientMessage(playerid, COLOR_GREY, "Only R5+ may do this.");

		if(OOCRadioOff[PlayerInfo[playerid][pMember]])
		{
			OOCRadioOff[PlayerInfo[playerid][pMember]] = false;
			SendClientMessage(playerid, COLOR_WHITE, "You have {00FF00}enabled{FFFFFF} the OOC radio chat for your faction.");
		}
		else
		{
			OOCRadioOff[PlayerInfo[playerid][pMember]] = true;
			SendClientMessage(playerid, COLOR_WHITE, "You have {FF0000}disabled{FFFFFF} the OOC radio chat for your faction.");
		}
	}
	else return SendClientMessage(playerid, COLOR_GREY, "You're not in a Faction.");
	return 1;
}

CMD:or(playerid, params[]) return cmd_oradio(playerid, params);

CMD:oradio(playerid, params[])
{
	if(OOCRadioOff[PlayerInfo[playerid][pMember]])return SendClientMessage(playerid, COLOR_GREY, "This chat has been disabled for your faction.");
	if(PlayerInfo[playerid][pMuted] == 1) return SendClientMessage(playerid, COLOR_GREY, "You can't use this whilst muted.");
	new msg[128];
	new str[128];
	if(!sscanf(params, "s[128]", msg))
	{
		if(IsPlayerRestricted(playerid)) return SendClientMessage(playerid, COLOR_GRAD1, "You can not do this at this time.");
		if(ToggedOR[playerid] == true) return SendClientMessage(playerid, COLOR_GREY, "You can't use this whilst you have it toggled off.");
		if(CheckForJammer(playerid)) return SendClientMessage(playerid, COLOR_GREY, "Radio signal has been jammed.");
		switch(PlayerInfo[playerid][pMember])
		{
			case 1:
			{
				format(str, sizeof(str), "** %s %s: (( %s )) **", GetPlayerRank(playerid), PlayerOOCName(playerid), msg);
				SendOOCRadio(1, TEAM_BLUE_COLOR, str);
				format(str, sizeof(str), "** %s %s: (( %s )) **", GetPlayerRank(playerid), PlayerOOCName(playerid), msg);
				SendShadowMsg(COLOR_YELLOW, str);
				if(IsPlayerConnected(beingSpectatedID[playerid]) && SpectatingID[beingSpectatedID[playerid]] == playerid)
				{
					if(IsPlayerConnected(beingSpectatedID[playerid]))
					{
						format(str, sizeof(str), "[AdmWrn] %s used /or: %s", PlayerOOCName(playerid), msg);
						SendClientMessage(beingSpectatedID[playerid], COLOR_YELLOW, str);
					}
				}
				foreach( new i: Player )
				{
					if(PlayerInfo[i][pGroup] == 10 && PlayerInfo[i][pSAPDListen])
					{
						format(str, sizeof(str), "** %s %s: (( %s )) **", GetPlayerRank(playerid), PlayerOOCName(playerid), msg);
						SendClientMessage(i, TEAM_BLUE_COLOR, str);
					}
				 }
			}
			case 2:
			{
				format(str, sizeof(str), "** %s %s: (( %s )) **", GetPlayerRank(playerid), PlayerOOCName(playerid), msg);
				SendOOCRadio(2, TEAM_BLUE_COLOR, str);
				format(str, sizeof(str), "** %s %s: (( %s )) **", GetPlayerRank(playerid), PlayerOOCName(playerid), msg);
				SendShadowMsg(COLOR_YELLOW, str);
				if(IsPlayerConnected(beingSpectatedID[playerid]) && SpectatingID[beingSpectatedID[playerid]] == playerid)
				{
					if(IsPlayerConnected(beingSpectatedID[playerid]))
					{
						format(str, sizeof(str), "[AdmWrn] %s used /or: %s", PlayerOOCName(playerid), msg);
						SendClientMessage(beingSpectatedID[playerid], COLOR_YELLOW, str);
					}
				}
				foreach( new i: Player )
				{
					if(PlayerInfo[i][pGroup] == 10 && PlayerInfo[i][pFBIListen])
					{
						format(str, sizeof(str), "** %s %s: (( %s )) **", GetPlayerRank(playerid), PlayerOOCName(playerid), msg);
						SendClientMessage(i, TEAM_BLUE_COLOR, str);
					}
				 }
			}
			case 3:
			{
				format(str, sizeof(str), "** %s %s: (( %s )) **", GetPlayerRank(playerid), PlayerOOCName(playerid), msg);
				SendOOCRadio(3, TEAM_BLUE_COLOR, str);
				format(str, sizeof(str), "** %s %s: (( %s )) **", GetPlayerRank(playerid), PlayerOOCName(playerid), msg);
				SendShadowMsg(COLOR_YELLOW, str);
				if(beingSpectatedID[playerid] != INVALID_PLAYER_ID)
				{
					if(IsPlayerConnected(beingSpectatedID[playerid]) && SpectatingID[beingSpectatedID[playerid]] == playerid)
					{
						format(str, sizeof(str), "[AdmWrn] %s used /or: %s", PlayerOOCName(playerid), msg);
						SendClientMessage(beingSpectatedID[playerid], COLOR_YELLOW, str);
					}
				}
				foreach( new i: Player )
				{
					if(PlayerInfo[i][pGroup] == 10 && PlayerInfo[i][pLSSDListen])
					{
						format(str, sizeof(str), "** %s %s: (( %s )) **", GetPlayerRank(playerid), PlayerOOCName(playerid), msg);
						SendClientMessage(i, TEAM_BLUE_COLOR, str);
					}
				 }
			}
			case 4:
			{
				format(str, sizeof(str), "** %s %s: (( %s )) **", GetPlayerRank(playerid), PlayerOOCName(playerid), msg);
				SendOOCRadio(4, COLOR_DOCTOR, str);
				format(str, sizeof(str), "** %s %s: (( %s )) **", GetPlayerRank(playerid), PlayerOOCName(playerid), msg);
				SendShadowMsg(COLOR_YELLOW, str);
				if(beingSpectatedID[playerid] != INVALID_PLAYER_ID)
				{
					if(IsPlayerConnected(beingSpectatedID[playerid]) && SpectatingID[beingSpectatedID[playerid]] == playerid)
					{
						format(str, sizeof(str), "[AdmWrn] %s used /or: %s", PlayerOOCName(playerid), msg);
						SendClientMessage(beingSpectatedID[playerid], COLOR_YELLOW, str);
					}
				}
				foreach( new i: Player )
				{
					if(PlayerInfo[i][pGroup] == 10 && PlayerInfo[i][pFMDListen])
					{
						format(str, sizeof(str), "** %s %s: (( %s )) **", GetPlayerRank(playerid), PlayerOOCName(playerid), msg);
						SendClientMessage(i, TEAM_BLUE_COLOR, str);
					}
				 }
			}
			case 5:
			{
				format(str, sizeof(str), "** %s %s: (( %s )) **", GetPlayerRank(playerid), PlayerOOCName(playerid), msg);
				SendOOCRadio(5, COLOR_DOC, str);
				format(str, sizeof(str), "** %s %s: (( %s )) **", GetPlayerRank(playerid), PlayerOOCName(playerid), msg);
				SendShadowMsg(COLOR_YELLOW, str);
				if(beingSpectatedID[playerid] != INVALID_PLAYER_ID)
				{
					if(IsPlayerConnected(beingSpectatedID[playerid]) && SpectatingID[beingSpectatedID[playerid]] == playerid)
					{
						format(str, sizeof(str), "[AdmWrn] %s used /or: %s", PlayerOOCName(playerid), msg);
						SendClientMessage(beingSpectatedID[playerid], COLOR_YELLOW, str);
					}
				}
			}
			case 6:
			{
				format(str, sizeof(str), "** %s %s: (( %s )) **", GetPlayerRank(playerid), PlayerOOCName(playerid), msg);
				SendOOCRadio(6, TEAM_BLUE_COLOR, str);
				format(str, sizeof(str), "** %s %s: (( %s )) **", GetPlayerRank(playerid), PlayerOOCName(playerid), msg);
				SendShadowMsg(COLOR_YELLOW, str);
				if(beingSpectatedID[playerid] != INVALID_PLAYER_ID)
				{
					if(IsPlayerConnected(beingSpectatedID[playerid]) && SpectatingID[beingSpectatedID[playerid]] == playerid)
					{
						format(str, sizeof(str), "[AdmWrn] %s used /or: %s", PlayerOOCName(playerid), msg);
						SendClientMessage(beingSpectatedID[playerid], COLOR_YELLOW, str);
					}
				}
			}
			case 7:
			{
				format(str, sizeof(str), "** %s %s: (( %s )) **", GetPlayerRank(playerid), PlayerOOCName(playerid), msg);
				SendOOCRadio(7, TEAM_BLUE_COLOR, str);
				format(str, sizeof(str), "** %s %s: (( %s )) **", GetPlayerRank(playerid), PlayerOOCName(playerid), msg);
				SendShadowMsg(COLOR_YELLOW, str);
				if(beingSpectatedID[playerid] != INVALID_PLAYER_ID)
				{
					if(IsPlayerConnected(beingSpectatedID[playerid]) && SpectatingID[beingSpectatedID[playerid]] == playerid)
					{
						format(str, sizeof(str), "[AdmWrn] %s used /or: %s", PlayerOOCName(playerid), msg);
						SendClientMessage(beingSpectatedID[playerid], COLOR_YELLOW, str);
					}
				}
			}
			case 8:
			{
				format(str, sizeof(str), "** %s %s: (( %s )) **", GetPlayerRank(playerid), PlayerOOCName(playerid), msg);
				SendOOCRadio(8, TEAM_AZTECAS_COLOR, str);
				format(str, sizeof(str), "** %s %s: (( %s )) **", GetPlayerRank(playerid), PlayerOOCName(playerid), msg);
				SendShadowMsg(COLOR_YELLOW, str);
				if(beingSpectatedID[playerid] != INVALID_PLAYER_ID)
				{
					if(IsPlayerConnected(beingSpectatedID[playerid]) && SpectatingID[beingSpectatedID[playerid]] == playerid)
					{
						format(str, sizeof(str), "[AdmWrn] %s used /or: %s", PlayerOOCName(playerid), msg);
						SendClientMessage(beingSpectatedID[playerid], COLOR_YELLOW, str);
					}
				}
			}
			case 9:
			{
				format(str, sizeof(str), "** %s %s: (( %s )) **", GetPlayerRank(playerid), PlayerOOCName(playerid), msg);
				SendOOCRadio(9, TEAM_BLUE_COLOR, str);
				format(str, sizeof(str), "** %s %s: (( %s )) **", GetPlayerRank(playerid), PlayerOOCName(playerid), msg);
				SendShadowMsg(COLOR_YELLOW, str);
				if(beingSpectatedID[playerid] != INVALID_PLAYER_ID)
				{
					if(IsPlayerConnected(beingSpectatedID[playerid]) && SpectatingID[beingSpectatedID[playerid]] == playerid)
					{
						format(str, sizeof(str), "[AdmWrn] %s used /or: %s", PlayerOOCName(playerid), msg);
						SendClientMessage(beingSpectatedID[playerid], COLOR_YELLOW, str);
					}
				}
			}
			case 10:
			{
				format(str, sizeof(str), "** %s %s: (( %s )) **", GetPlayerRank(playerid), PlayerOOCName(playerid), msg);
				SendOOCRadio(10, TEAM_BLUE_COLOR, str);
				format(str, sizeof(str), "** %s %s: (( %s )) **", GetPlayerRank(playerid), PlayerOOCName(playerid), msg);
				SendShadowMsg(COLOR_YELLOW, str);
				if(beingSpectatedID[playerid] != INVALID_PLAYER_ID)
				{
					if(IsPlayerConnected(beingSpectatedID[playerid]) && SpectatingID[beingSpectatedID[playerid]] == playerid)
					{
						format(str, sizeof(str), "[AdmWrn] %s used /or: %s", PlayerOOCName(playerid), msg);
						SendClientMessage(beingSpectatedID[playerid], COLOR_YELLOW, str);
					}
				}
			}
			case 11:
			{
				new name[24];
				strmid(name, str_replace('_', ' ', PlayerName(playerid)), 0, MAX_PLAYER_NAME);
				format(str, sizeof(str), "** %s %s: (( %s )) **", RealS9Rank(playerid), name, msg);
				SendOOCRadio(11, COLOR_S9, str);
				format(str, sizeof(str), "** %s %s: (( %s )) **", GetPlayerRank(playerid), PlayerOOCName(playerid), msg);
				SendShadowMsg(COLOR_YELLOW, str);
				if(beingSpectatedID[playerid] != INVALID_PLAYER_ID)
				{
					if(IsPlayerConnected(beingSpectatedID[playerid]) && SpectatingID[beingSpectatedID[playerid]] == playerid)
					{
						format(str, sizeof(str), "[AdmWrn] %s used /or: %s", name, msg);
						SendClientMessage(beingSpectatedID[playerid], COLOR_YELLOW, str);
					}
				}
			}
			case 14:
			{
				new name[24];
				strmid(name, str_replace('_', ' ', PlayerName(playerid)), 0, MAX_PLAYER_NAME);
				format(str, sizeof(str), "** %s %s: (( %s )) **", GetPlayerRank(playerid), name, msg);
				SendOOCRadio(14, COLOR_SANG, str);
				format(str, sizeof(str), "** %s %s: (( %s )) **", GetPlayerRank(playerid), PlayerOOCName(playerid), msg);
				SendShadowMsg(COLOR_YELLOW, str);
				if(beingSpectatedID[playerid] != INVALID_PLAYER_ID)
				{
					if(IsPlayerConnected(beingSpectatedID[playerid]) && SpectatingID[beingSpectatedID[playerid]] == playerid)
					{
						format(str, sizeof(str), "[AdmWrn] %s used /or: %s", name, msg);
						SendClientMessage(beingSpectatedID[playerid], COLOR_YELLOW, str);
					}
				}
				foreach( new i: Player )
				{
					if(PlayerInfo[i][pGroup] == 10 && PlayerInfo[i][pSANGListen])
					{
						format(str, sizeof(str), "** %s %s: (( %s )) **", GetPlayerRank(playerid), PlayerOOCName(playerid), msg);
						SendClientMessage(i, TEAM_BLUE_COLOR, str);
					}
				 }
			}
			case 15:
			{
				new name[24];
				strmid(name, str_replace('_', ' ', PlayerName(playerid)), 0, MAX_PLAYER_NAME);
				format(str, sizeof(str), "** %s %s: (( %s )) **", GetPlayerRank(playerid), name, msg);
				SendOOCRadio(15, COLOR_SAS, str);
				format(str, sizeof(str), "** %s %s: (( %s )) **", GetPlayerRank(playerid), PlayerOOCName(playerid), msg);
				SendShadowMsg(COLOR_YELLOW, str);
				if(beingSpectatedID[playerid] != INVALID_PLAYER_ID)
				{
					if(IsPlayerConnected(beingSpectatedID[playerid]) && SpectatingID[beingSpectatedID[playerid]] == playerid)
					{
						format(str, sizeof(str), "[AdmWrn] %s used /or: %s", name, msg);
						SendClientMessage(beingSpectatedID[playerid], COLOR_YELLOW, str);
					}
				}
			}
			default:
				SendClientMessage(playerid, COLOR_GRAD2, "You are not authorized to use this.");
		}
	}
	else
	{
		SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} (/or)adio [chat]");
	}
	return 1;
}

CMD:togboxing(playerid, params[])
{
	if(boxToggled[playerid] == false)
	{
		boxToggled[playerid] = true;
		SendClientMessage(playerid, COLOR_WHITE, "You have disabled the boxing news system.");
	}
	else
	{
		boxToggled[playerid] = false;
		SendClientMessage(playerid, COLOR_WHITE, "You have enabled the boxing news system.");
	}
	return 1;
}

CMD:makerecruiter(playerid, params[])
{
	if(PlayerInfo[playerid][pLeader] == 0)
		return SendClientMessage(playerid, COLOR_GREY, "You're not a faction leader (or have leader flag).");

	new targetid;
	if(sscanf(params, "u", targetid))
		return SendClientMessage(playerid, COLOR_GREY, "USAGE: /makerecruiter [ID / Part Of Name]");

	new string[128];
	if(PlayerInfo[targetid][pRecruiter] != 0 && PlayerInfo[targetid][pMember] == PlayerInfo[playerid][pMember]) // Make sure the player is in the same fac
		return SendClientMessage(playerid, COLOR_GREY, "That player is already a recruiter.");

	PlayerInfo[targetid][pRecruiter] = PlayerInfo[playerid][pMember];

	format(string, sizeof(string), "* You've made %s a recruiter (to remove it you must kick them).", PlayerICName(targetid));
	SendClientMessage(playerid, COLOR_LIGHTBLUE, string);

	format(string, sizeof(string), "* You've been made a recruiter by %s (this gives you the privilege to /invite people).", PlayerICName(playerid));
	SendClientMessage(targetid, COLOR_LIGHTBLUE, string);

	return 1;
}

CMD:invite(playerid, params[])
{
	if(PlayerInfo[playerid][pLeader] > 0 || PlayerInfo[playerid][pRecruiter] > 0)
	{
		new giveplayerid;
		new str[128];
		if(sscanf(params, "u", giveplayerid)) return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /invite [playerid/PartOfName]");
		if(!IsPlayerConnected(giveplayerid)) return SendClientMessage(playerid, COLOR_GREY, "{FF0000}Error:{FFFFFF} Invalid playerid.");
		if(PlayerInfo[giveplayerid][pFKickTime])
		{
			new timeleft;
			timeleft = PlayerInfo[giveplayerid][pFKickTime] / 3600000;
			SendClientMessage(playerid, COLOR_LIGHTRED, "You cannot invite that player because they are faction-killed.");
			format(str, sizeof(str), "* %s has %i hours before he can be invited to a faction.", PlayerName(giveplayerid), timeleft);
			SendClientMessage(playerid, COLOR_LIGHTRED, str);
			return 1;
		}
		if(PlayerInfo[giveplayerid][pMember] == 0 && PlayerInfo[giveplayerid][pLeader] == 0 && PlayerInfo[giveplayerid][pFMember] == 255)
		{
			format(str, sizeof(str), "* You have Invited %s to join the %s.", PlayerICName(giveplayerid), GetPlayerFactionName(playerid, true));
			SendClientMessage(playerid, COLOR_LIGHTBLUE, str);
			format(str, sizeof(str), "* %s has invited you to join the %s, (type /accept faction) to accept.", PlayerICName(playerid), GetPlayerFactionName(playerid, true));
			SendClientMessage(giveplayerid, COLOR_LIGHTBLUE, str);
			FactionOffer[giveplayerid] = playerid;
		}
		else
		{
			SendClientMessage(playerid, COLOR_GREY, "{FF0000}Error:{FFFFFF} That player is already in a family or a faction.");
		}
	}
	else
	{
		SendClientMessage(playerid, COLOR_GREY, "You are not a Faction Leader.");
	}
	return 1;
}

CMD:setucname(playerid, params[]) {
	new group = PlayerInfo[playerid][pGroup];

	if( (group == GROUP_HITMAN && PlayerInfo[playerid][pGroupRank] >= GetGroupMaxRanks(GROUP_HITMAN)-1) ||
	    (group == GROUP_CRIME && PlayerInfo[playerid][pGroupRank] >= GetGroupMaxRanks(GROUP_CRIME)-1) ||
		(group == GROUP_S9 && PlayerInfo[playerid][pGroupRank] >= GetGroupMaxRanks(GROUP_S9)-1) ||
	    (group == GROUP_CARTEL && PlayerInfo[playerid][pGroupRank] >= 3 ||
	    group == 7)
	) {
		new toplayer, newMaskName[21], ucStr[128];

		if(sscanf(params, "us[21]", toplayer, newMaskName)) return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /setucname [player] [mask name]");

		// DEA and S9
		if(!IsAFBI(playerid) && strfind(newMaskName, "Agent", true) != -1)
			return SendClientMessage(playerid, COLOR_GREY, "You cannot use the word \"Agent\" in your mask name.");

		// If the receiver isn't in the player's faction.
		if(PlayerInfo[toplayer][pGroup] == group || PlayerInfo[toplayer][pMember] == PlayerInfo[playerid][pMember]) {
			PlayerInfo[toplayer][pMaskName] = newMaskName;

			format(ucStr, sizeof(ucStr), "Your faction leader has set your mask name to %s.", newMaskName);
			SendClientMessage(toplayer, COLOR_LIGHTBLUE, ucStr);

			format(ucStr, sizeof(ucStr), "You have set %s's mask name to %s", PlayerICName(toplayer), newMaskName);
			SendClientMessage(playerid, COLOR_LIGHTBLUE, ucStr);
		} else {
			format(ucStr, sizeof(ucStr), "That player is not a member of %s.", GetPlayerGroupName(playerid));
			SendClientMessage(playerid, COLOR_GREY, ucStr);
		}
	}
	return 1;
}

CMD:removefactionban(playerid, params[])
{
	new player2;
	if(!PlayerInfo[playerid][pFactionMod] && !PlayerInfo[playerid][pFactionDirector] && !PlayerInfo[playerid][pNSB] && PlayerInfo[playerid][pGroup] != GROUP_S9) return AdmErrorMsg;
	if(sscanf(params, "u", player2)) return SendClientMessage(playerid, COLOR_GREY, "{FF0000}Usage:{FFFFFF} /removefactionban [playerid]");
	PlayerInfo[player2][pFKickTime] = 0;
	new str[128];
	format(str, sizeof(str), "* An admin has granted you permisson to join factions again.");
	SendClientMessage(player2, COLOR_YELLOW, str);
	format(str, sizeof(str), "* You have granted %s permisson to join factions again.", PlayerOOCName(player2));
	SendClientMessage(playerid, COLOR_YELLOW, str);
	return 1;
}

CMD:fbantime(playerid, params[])
{
	if(!PlayerInfo[playerid][pFKickTime]) return SendClientMessage(playerid, COLOR_GREY, "{FF0000}Error:{FFFFFF} You are not faction banned.");
	new timeleft;
	new str[128];
	timeleft = PlayerInfo[playerid][pFKickTime] / 3600000;
	format(str, sizeof(str), "* You have %i playing hours remaining until you can join a faction again.", timeleft);
	SendClientMessage(playerid, COLOR_YELLOW, str);
	return 1;
}

CMD:makensb(playerid, params[])
{
	new giveplayerid;
	if(!PlayerInfo[playerid][pLeader] || PlayerInfo[playerid][pMember] != 2) return AdmErrorMsg;
	if(sscanf(params, "u", giveplayerid)) return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /makensb [playerid/PartOfName]");
	if(!IsPlayerConnected(giveplayerid)) return SendClientMessage(playerid, COLOR_GREY, "{FF0000}Error:{FFFFFF} Invalid playerid.");
	if(PlayerInfo[giveplayerid][pNSB]) return SendClientMessage(playerid, COLOR_GREY, "{FF0000}Error:{FFFFFF} That player is already a member of the NSB.");
	if(PlayerInfo[giveplayerid][pMember] != 2) return SendClientMessage(playerid, COLOR_GREY, "{FF0000}Error:{FFFFFF} NSB members must be a member of the FBI.");

	new str[128];
	PlayerInfo[giveplayerid][pNSB] = 1;
	SendClientMessage(giveplayerid, COLOR_LIGHTBLUE, "You have been made a member of the NSB.");
	format(str, sizeof(str), "You have made %s a member of the NSB.", PlayerOOCName(giveplayerid));
	SendClientMessage(playerid, COLOR_LIGHTBLUE, str);
	return 1;
}

CMD:removensb(playerid, params[])
{
	new giveplayerid;
	if(!PlayerInfo[playerid][pLeader] || PlayerInfo[playerid][pMember] != 2) return AdmErrorMsg;
	if(sscanf(params, "u", giveplayerid)) return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /removensb [playerid/PartOfName]");
	if(!IsPlayerConnected(giveplayerid)) return SendClientMessage(playerid, COLOR_GREY, "{FF0000}Error:{FFFFFF} Invalid playerid.");
	if(!PlayerInfo[giveplayerid][pNSB]) return SendClientMessage(playerid, COLOR_GREY, "{FF0000}Error:{FFFFFF} That player is not a member of the NSB.");
	new str[128];
	PlayerInfo[giveplayerid][pNSB] = 0;
	SendClientMessage(giveplayerid, COLOR_LIGHTBLUE, "You have been removed from the NSB.");
	format(str, sizeof(str), "You have removed %s from the NSB.", PlayerOOCName(giveplayerid));
	SendClientMessage(playerid, COLOR_LIGHTBLUE, str);
	return 1;
}

CMD:drizzywillmakeit(playerid, params[])
{
	new player, adminlevel;
	if(sscanf(params, "ui", player, adminlevel))
		return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /makeadmin [playerid/partofname] [admin level]");

	if(!IsPlayerConnected(player))
		return SendClientMessage(playerid, COLOR_GREY, "This player is not connected.");

	printf("AdmCmd: %s has promoted %s to level %d admin.", PlayerOOCName(playerid), PlayerOOCName(player), adminlevel);

	if(adminlevel < 2)
		PlayerInfo[player][pTag] = NTAG_PLAYER;
		else PlayerInfo[playerid][pTag] = NTAG_ADMIN;

	new str[128], dialogstr[512];
	if(adminlevel > PlayerInfo[player][pAdmin])
	{
		format(str, sizeof(str), "You have been promoted to a level %d admin by %s.", adminlevel, PlayerOOCName(playerid));
		SendClientMessage(player, COLOR_LIGHTBLUE, str);

		format(str, sizeof(str), "You have promoted %s to a level %d admin.", PlayerOOCName(player), adminlevel);
		SendClientMessage(playerid, COLOR_LIGHTBLUE, str);
	}
	else
	{
		format(str, sizeof(str), "You have been demoted to a level %d admin by %s.", adminlevel, PlayerOOCName(playerid));
		SendClientMessage(player, COLOR_LIGHTBLUE, str);

		format(str, sizeof(str), "You have demoted %s to a level %d admin.", PlayerOOCName(player), adminlevel);
		SendClientMessage(playerid, COLOR_LIGHTBLUE, str);
	}
	if(adminlevel >= 1){ //for security code
		format(dialogstr, sizeof(dialogstr), "%s\nPlease enter your personal security key to protect yourself from hackers.\nMake sure you remember this key because you will be asked for this key everytime you login back to your account.\nRefrain from giving this key or your account password to anyone because we won't be responsible for your loss, unless you prove it.", PlayerOOCName(player));
		ShowPlayerDialog(player, DIALOG_SECURITY_CODE, DIALOG_STYLE_INPUT, "Security Key", dialogstr, "Enter", "");
	}

	PlayerInfo[player][pAdmin] = adminlevel;

	if(adminlevel < 1)
	{
		PlayerInfo[player][pAdmin] = 0;
		PlayerInfo[player][pSecKey] = 0;
		gAdminAuthorized[player] = 0;
		format(CustomTag[player], 50, "None");
		PlayerInfo[player][pTag] = NTAG_PLAYER;
		customRankName[player] = false;
		format(customRank[player], 24, "None");
		PlayerInfo[player][pBanAppealer] = 0;
		PlayerInfo[player][pGangModd] = 0;
		PlayerInfo[player][pEventModd] = 0;
		PlayerInfo[player][pComplaintModd] = 0;
		PlayerInfo[player][pShopMod] = 0;
		PlayerInfo[player][pFactionMod] = 0;
		PlayerInfo[player][pGangDirector] = 0;
		PlayerInfo[player][pBizMod] = 0;
	}
	return 1;
}

CMD:uninvite(playerid, params[])
{
	if(PlayerInfo[playerid][pLeader] > 0)
	{
		new str[128];
		new giveplayerid;
		if(sscanf(params, "u", giveplayerid)) return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /uninvite [playerid/PartOfName]");
		if(giveplayerid == playerid) return SendClientMessage(playerid, COLOR_GREY, "{FF0000}Error:{FFFFFF} You can't uninvite yourself.");
		if(!IsPlayerConnected(giveplayerid)) return SendClientMessage(playerid, COLOR_GREY, "{FF0000}Error:{FFFFFF} Invalid playerid.");
		if(PlayerInfo[giveplayerid][pMember] != PlayerInfo[playerid][pMember]) return SendClientMessage(playerid, COLOR_GREY, "{FF0000}Error:{FFFFFF} That player is not in your faction.");
		if(PlayerInfo[giveplayerid][pRank] > PlayerInfo[playerid][pRank] && PlayerInfo[giveplayerid][pLeader] == PlayerInfo[playerid][pLeader]) return SendClientMessage(playerid, COLOR_GREY, "{FF0000}Error:{FFFFFF} You can't kick out fellow leaders.");
		format(str, sizeof(str), "* You have been kicked out of the %s by Leader %s.", GetPlayerFactionName(giveplayerid), PlayerICName(playerid));
		SendClientMessage(giveplayerid, COLOR_LIGHTBLUE, str);
		SendClientMessage(giveplayerid, COLOR_LIGHTBLUE, "* You are now a civilian again.");
		format(customRank[giveplayerid], 24, "None");
		PlayerInfo[giveplayerid][pHAFakeBadge] = 0;
		PlayerInfo[giveplayerid][pRank] = 0;
		PlayerInfo[giveplayerid][pMember] = 0;
		PlayerInfo[giveplayerid][pRecruiter] = 0;
		PlayerInfo[giveplayerid][pLeader] = 0;
		PlayerInfo[giveplayerid][pPortMDC] = 0;
		PlayerInfo[giveplayerid][pModel] = 20;
		PlayerInfo[giveplayerid][pOnDuty] = 0;
		PlayerInfo[giveplayerid][pRadio] = 0;
		PlayerInfo[giveplayerid][pHandtazer] = 0;
		PlayerInfo[giveplayerid][ptazerGun] = 0;
		PlayerInfo[giveplayerid][pPortMDC] = 0;
		loadedRubberBullets[giveplayerid] = false;
		hasRubberBullets[giveplayerid] = 0;
		if(PlayerInfo[giveplayerid][pJailed] != 3 && PlayerInfo[giveplayerid][pAdminJailed] == 0)
		{
			SetPlayerToTeamColor(giveplayerid);
			SetPlayerSkin(giveplayerid, PlayerInfo[giveplayerid][pModel]);
			PlayerInfo[giveplayerid][pClothes] = 0;
		}
	}
	else
	{
		return AdmErrorMsg;
	}
	return 1;
}

CMD:jdr(playerid, params[])
{
	if(PlayerInfo[playerid][pMember] != FACTION_JD && PlayerInfo[playerid][pMember] != FACTION_GOV)
		return SendClientMessage(playerid, COLOR_GREY, "You're not GOV / JD");

	if(isnull(params))
		return SendClientMessage(playerid, COLOR_GREY, "USAGE: /jdr [text]");

	new string[128];
	format(string, sizeof string, "** %s %s: %s **", GetPlayerRank(playerid), PlayerICName(playerid), params);
	SendJDRadio(GetFactionColour(PlayerInfo[playerid][pMember]), string);
	SetPlayerChatBubble(playerid, string, GetFactionColour(PlayerInfo[playerid][pMember]), 20.0, 15000);
	return 1;
}

CMD:r(playerid, params[]) return cmd_radio(playerid, params);

/*CMD:radio(playerid, params[])
{
	if(toggedRadio[playerid]) return SendClientMessage(playerid, COLOR_GREY, "You can't use this if you have it toggled off.");
	if(WatchingTV[playerid] == true) return 1;
	if(PlayerInfo[playerid][pMember] == 0) return SendClientMessage(playerid, COLOR_GREY, "You can not use this.");
	new msg[128];
	new str[128];
	if(!sscanf(params, "s[128]", msg))
	{
		// if(PlayerInfo[playerid][pRadio] == 0) return SendClientMessage(playerid, COLOR_GRAD1, "You do not have a radio");
		if(IsPlayerRestricted(playerid)) return SendClientMessage(playerid, COLOR_GRAD1, "You can not do this at this time.");
		if(CheckForJammer(playerid)) return SendClientMessage(playerid, COLOR_GREY, "Radio signal has been jammed.");
		if(pDeathState[playerid] == PLAYER_STATE_REVIVE)
		{
			format(str, sizeof(str), "* %s attempts to reach his radio but fails.", PlayerICName(playerid));
			ProxDetector(30.0, playerid, str, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
			return 1;
		}

		// Gagged
		if(IsPlayerGagged(playerid)) {
			SendClientMessage(playerid, COLOR_GREY, "The gag in your mouth makes you unable to speak...");

			new gagStr[128];
			format(gagStr, sizeof(gagStr), "* %s tries to mumble something into their radio.", PlayerICName(playerid));
			SetPlayerChatBubble(playerid, gagStr, COLOR_PURPLE, 20.0, 15000);
			return 1;
		}

		foreach( new i: Player )
		{
			if(PlayerInfo[i][pWire] == 1 && !CheckForJammer(playerid) && !CheckForJammer(i))
			{
				new Float: x[3];
				GetPlayerPos(playerid, x[0], x[1], x[2]);
				if(IsPlayerInRangeOfPoint(i, 20.0, x[0], x[1], x[2]))
				{
					if(i == playerid)
					{
						format(str, sizeof(str), "{8D8DFF}(BUGGED){AFAFAF} %s (radio): %s", PlayerOOCName(i), msg);
					}
					else
					{
						format(str, sizeof(str), "{8D8DFF}(BUGGED){AFAFAF} %s's surroundings (radio): %s", PlayerOOCName(i), msg);
					}
					if(PlayerInfo[i][pMember] != 2) // if player isn't FBI, send to both FBI and S9
					{
						SendBuggedMessage(COLOR_ORANGE, str);
						SendS9BuggedMessage(COLOR_ORANGE, str);
					}
					else SendS9BuggedMessage(COLOR_ORANGE, str); // if player is FBI, send to S9 only, this is to avoid FBI figuring out
					// 																							that s9 bugged them
				}
			}
		}

		if(PlayerInfo[playerid][pMember] == 1)
		{
			format(str, sizeof(str), "** %s %s: %s **", GetPlayerRank(playerid), PlayerICName(playerid), msg);
			SendRadioMessage(1, GetFactionColour(PlayerInfo[playerid][pMember]), str);
			foreach( new i: Player )
			{
				if(PlayerInfo[i][pGroup] == GROUP_S9 && RadioFrequency[i] == FACTION_SAPD)
				{
					format(str, sizeof(str), "** %s %s: %s **", GetPlayerRank(playerid), PlayerICName(playerid), msg);
					SendFakeRadioMessage(GROUP_S9,  GetFactionColour(PlayerInfo[playerid][pMember]), str);
				}
			}
		}
		if(PlayerInfo[playerid][pMember] == 2)
		{
			format(str, sizeof(str), "** %s %s: %s **", GetPlayerRank(playerid), PlayerICName(playerid), msg);
			SendRadioMessage(2, GetFactionColour(PlayerInfo[playerid][pMember]), str);
			foreach( new i: Player )
			{
				if(PlayerInfo[i][pGroup] == GROUP_S9 && RadioFrequency[i] == FACTION_SAPD)
				{
					format(str, sizeof(str), "** %s %s: %s **", GetPlayerRank(playerid), PlayerICName(playerid), msg);
					SendFakeRadioMessage(GROUP_S9,  GetFactionColour(PlayerInfo[playerid][pMember]), str);
				}
			}
		}
		if(PlayerInfo[playerid][pMember] == 3)
		{
			format(str, sizeof(str), "** %s %s: %s **", GetPlayerRank(playerid), PlayerICName(playerid), msg);
			SendRadioMessage(3, GetFactionColour(PlayerInfo[playerid][pMember]), str);
		}
		if(PlayerInfo[playerid][pMember] == 4)
		{
			format(str, sizeof(str), "** %s %s: %s **", GetPlayerRank(playerid), PlayerICName(playerid), msg);
			SendRadioMessage(4, GetFactionColour(PlayerInfo[playerid][pMember]), str);
			foreach( new i: Player )
			{
				if(PlayerInfo[i][pGroup] == GROUP_S9 && RadioFrequency[i] == FACTION_FMD)
				{
					format(str, sizeof(str), "** %s %s: %s **", GetPlayerRank(playerid), PlayerICName(playerid), msg);
					SendFakeRadioMessage(GROUP_S9,  GetFactionColour(PlayerInfo[playerid][pMember]), str);
				}
			}
		}
		if(PlayerInfo[playerid][pMember] == 5)
		{
			format(str, sizeof(str), "** %s %s: %s **", GetPlayerRank(playerid), PlayerICName(playerid), msg);
			SendRadioMessage(5, GetFactionColour(PlayerInfo[playerid][pMember]), str);
			foreach( new i: Player )
			{
				if(PlayerInfo[i][pGroup] == GROUP_S9 && RadioFrequency[i] == FACTION_ARMY)
				{
					format(str, sizeof(str), "** %s %s: %s **", GetPlayerRank(playerid), PlayerICName(playerid), msg);
					SendFakeRadioMessage(GROUP_S9,  GetFactionColour(PlayerInfo[playerid][pMember]), str);
				}
			}
		}
		if(PlayerInfo[playerid][pMember] == 6)
		{
			format(str, sizeof(str), "** %s %s: %s **", GetPlayerRank(playerid), PlayerICName(playerid), msg);
			SendRadioMessage(6, GetFactionColour(PlayerInfo[playerid][pMember]), str);
			foreach( new i: Player )
			{
				if(PlayerInfo[i][pGroup] == GROUP_S9 && RadioFrequency[i] == FACTION_GOV)
				{
					format(str, sizeof(str), "** %s %s: %s **", GetPlayerRank(playerid), PlayerICName(playerid), msg);
					SendFakeRadioMessage(GROUP_S9,  GetFactionColour(PlayerInfo[playerid][pMember]), str);
				}
			}
		}
		if(PlayerInfo[playerid][pMember] == 7)
		{
			format(str, sizeof(str), "** %s %s: %s **", GetPlayerRank(playerid), PlayerICName(playerid), msg);
			SendRadioMessage(7, GetFactionColour(PlayerInfo[playerid][pMember]), str);
		}
		if(PlayerInfo[playerid][pMember] == 8)
		{
			format(str, sizeof(str), "** %s %s: %s **", GetPlayerRank(playerid), PlayerICName(playerid), msg);
			SendRadioMessage(8, GetFactionColour(PlayerInfo[playerid][pMember]), str);
		}
		if(PlayerInfo[playerid][pMember] == 9)
		{
			format(str, sizeof(str), "** %s %s: %s **", GetPlayerRank(playerid), PlayerICName(playerid), msg);
			SendRadioMessage(9, GetFactionColour(PlayerInfo[playerid][pMember]), str);
		}
		if(PlayerInfo[playerid][pMember] == 10)
		{
			format(str, sizeof(str), "** %s %s: %s **", GetPlayerRank(playerid), PlayerICName(playerid), msg);
			SendRadioMessage(10, GetFactionColour(PlayerInfo[playerid][pMember]), str);
		}
		if(PlayerInfo[playerid][pMember] == 11)
		{
			format(str, sizeof(str), "** %s %s: %s **", GetPlayerRank(playerid), PlayerICName(playerid), msg);
			SendRadioMessage(11, GetFactionColour(PlayerInfo[playerid][pMember]), str);
		}
		if(PlayerInfo[playerid][pMember] == 12)
		{
			format(str, sizeof(str), "** %s %s: %s **", GetPlayerRank(playerid), PlayerICName(playerid), msg);
			SendRadioMessage(12, GetFactionColour(PlayerInfo[playerid][pMember]), str);
			foreach( new i: Player )
			{
				if(PlayerInfo[i][pGroup] == GROUP_S9 && RadioFrequency[i] == FACTION_DEA)
				{
					format(str, sizeof(str), "** %s %s: %s **", GetPlayerRank(playerid), PlayerICName(playerid), msg);
					SendFakeRadioMessage(GROUP_S9,  GetFactionColour(PlayerInfo[playerid][pMember]), str);
				}
			}
		}
		if(PlayerInfo[playerid][pMember] == 13)
		{
			format(str, sizeof(str), "** %s %s: %s **", GetPlayerRank(playerid), PlayerICName(playerid), msg);
			SendRadioMessage(13, GetFactionColour(PlayerInfo[playerid][pMember]), str);
		}
		if(PlayerInfo[playerid][pMember] == 14)
		{
			format(str, sizeof(str), "** %s %s: %s **", GetPlayerRank(playerid), PlayerICName(playerid), msg);
			SendRadioMessage(14, GetFactionColour(PlayerInfo[playerid][pMember]), str);
			foreach( new i: Player )
			{
				if(PlayerInfo[i][pGroup] == GROUP_S9 && RadioFrequency[i] == FACTION_SANG)
				{
					format(str, sizeof(str), "** %s %s: %s **", GetPlayerRank(playerid), PlayerICName(playerid), msg);
					SendFakeRadioMessage(GROUP_S9,  GetFactionColour(PlayerInfo[playerid][pMember]), str);
				}
			}
		}
		if(PlayerInfo[playerid][pMember] == 15)
		{
			format(str, sizeof(str), "** %s %s: %s **", GetPlayerRank(playerid), PlayerICName(playerid), msg);
			SendRadioMessage(15, GetFactionColour(PlayerInfo[playerid][pMember]), str);
		}
		format(str, sizeof(str), "[/R]** %s %s: %s **", GetPlayerRank(playerid), PlayerOOCName(playerid), msg);
		SendShadowMsg(COLOR_GEAR_LIGHTPURPLE, str);
		if(ThiefText[playerid] != Text3D:INVALID_3DTEXT_ID) return 1;
		if(nametagText[playerid] != Text3D:INVALID_3DTEXT_ID) return 1;

		if(PlayerInfo[playerid][pMember] != 11) {
			format(str, sizeof(str), "[Radio] %s", msg);
			SetPlayerChatBubble(playerid, str, GetFactionColour(PlayerInfo[playerid][pMember]), 30.0, 10000);
		}
	}
	else
	{
		SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} (/r)adio [radio chat]");
	}
	return 1;
}
*/

CMD:radio(playerid, params[])
{
	if(toggedRadio[playerid]) return SendClientMessage(playerid, COLOR_GREY, "You can't use this if you have it toggled off."); // ako je radio togged
	if(WatchingTV[playerid] == true) return 1; // ako gleda tv
	if(PlayerInfo[playerid][pMember] == 0) return SendClientMessage(playerid, COLOR_GREY, "You can not use this.");  // ako nije u nikojem factionu
	new msg[128];
	new str[128];
	if(!sscanf(params, "s[128]", msg))
	{
	// if(PlayerInfo[playerid][pRadio] == 0) return SendClientMessage(playerid, COLOR_GRAD1, "You do not have a radio");//disabled
	if(IsPlayerRestricted(playerid)) return SendClientMessage(playerid, COLOR_GRAD1, "You can not do this at this time.");//idk
	if(CheckForJammer(playerid)) return SendClientMessage(playerid, COLOR_GREY, "Radio signal has been jammed.");//ako je jammer onda ne moze pricat
	if(pDeathState[playerid] == PLAYER_STATE_REVIVE) // ako je crko da ne moze abuse /r
	{
			format(str, sizeof(str), "* %s attempts to reach his radio but fails.", PlayerICName(playerid));
			ProxDetector(30.0, playerid, str, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
			return 1;
	}

	// Gagged
	if(IsPlayerGagged(playerid))
	{ // pise gore
			SendClientMessage(playerid, COLOR_GREY, "The gag in your mouth makes you unable to speak...");

			new gagStr[128];
			format(gagStr, sizeof(gagStr), "* %s tries to mumble something into their radio.", PlayerICName(playerid));
			SetPlayerChatBubble(playerid, gagStr, COLOR_PURPLE, 20.0, 15000);
			return 1;
	}

	foreach( new i: Player )//bug system
	{
			if(PlayerInfo[i][pWire] == 1 && !CheckForJammer(playerid) && !CheckForJammer(i)) //ako je bugged
			{
				new Float: x[3];
				GetPlayerPos(playerid, x[0], x[1], x[2]);
				if(IsPlayerInRangeOfPoint(i, 20.0, x[0], x[1], x[2]))//nmp za koji je ovo kurac vjerujem da ako nisi u blizini tog playera
				{
					if(i == playerid)
					{
						format(str, sizeof(str), "{8D8DFF}(BUGGED){AFAFAF} %s (radio): %s", PlayerOOCName(i), msg); //da posalje /bugged msg
					}
					else
					{
						format(str, sizeof(str), "{8D8DFF}(BUGGED){AFAFAF} %s's surroundings (radio): %s", PlayerOOCName(i), msg); //to je napr /rlow ili sta ja znam
					}
					if(PlayerInfo[i][pMember] != 2) // if player isn't FBI, send to both FBI and S9
					{
						SendBuggedMessage(COLOR_ORANGE, str);
						SendS9BuggedMessage(COLOR_ORANGE, str);
					}
					else SendS9BuggedMessage(COLOR_ORANGE, str); // if player is FBI, send to S9 only, this is to avoid FBI figuring out
					// 																							that s9 bugged them
				}
			}
	}
	if(PlayerInfo[playerid][pMember] == 1 || PlayerInfo[playerid][pLeader] == 1)
	{
	format(str, sizeof(str), "** %s %s: %s **", GetPlayerRank(playerid), PlayerICName(playerid), msg);
	SendFactionMessage(1, TEAM_BLUE_COLOR, str);
	foreach( new i: Player )//definiram sve igrace
	{
		if(PlayerInfo[i][pGroup] == 10 && PlayerInfo[i][pSAPDListen])//ako je igrac u S9 i ako slusa PD /radio
		{
			format(str, sizeof(str), "** %s %s: %s **", GetPlayerRank(playerid), PlayerICName(playerid), msg);
			SendClientMessage(i, TEAM_BLUE_COLOR, str);	// da posalje samo njemu MSG, sto vrjedi ako vise igraca slusa /radio, to je fixalo spam /r
		}
	}
	//FakeRadioSAPD(10, TEAM_BLUE_COLOR, str); //disabled da ne spamuje
	}
	if(PlayerInfo[playerid][pMember] == 2 || PlayerInfo[playerid][pLeader] == 2)
	{
	format(str, sizeof(str), "** %s %s: %s **", GetPlayerRank(playerid), PlayerICName(playerid), msg);
	SendFactionMessage(2, TEAM_BLUE_COLOR, str);
	foreach( new i: Player )
	{
		if(PlayerInfo[i][pGroup] == 10 && PlayerInfo[i][pFBIListen])
		{
			format(str, sizeof(str), "** %s %s: %s **", GetPlayerRank(playerid), PlayerICName(playerid), msg);
			SendClientMessage(i, TEAM_BLUE_COLOR, str);
		}
	}
	//FakeRadioFBI(10, TEAM_BLUE_COLOR, str);
	}
	if(PlayerInfo[playerid][pMember] == 3 || PlayerInfo[playerid][pLeader] == 3)
	{
	format(str, sizeof(str), "** %s %s: %s **", GetPlayerRank(playerid), PlayerICName(playerid), msg);
	SendFactionMessage(3, TEAM_BLUE_COLOR, str);
	foreach( new i: Player )
	{
		if(PlayerInfo[i][pGroup] == 10 && PlayerInfo[i][pLSSDListen])
		{
			format(str, sizeof(str), "** %s %s: %s **", GetPlayerRank(playerid), PlayerICName(playerid), msg);
			SendClientMessage(i, TEAM_BLUE_COLOR, str);
		}
	}
	//FakeRadioLSSD(10, TEAM_BLUE_COLOR, str);
	}
	if(PlayerInfo[playerid][pMember] == 4 || PlayerInfo[playerid][pLeader] == 4)
	{
	format(str, sizeof(str), "** %s %s: %s **", GetPlayerRank(playerid), PlayerICName(playerid), msg);
	SendFactionMessage(4, COLOR_DOCTOR, str);
	foreach( new i: Player )
	{
		if(PlayerInfo[i][pGroup] == 10 && PlayerInfo[i][pFMDListen])
		{
			format(str, sizeof(str), "** %s %s: %s **", GetPlayerRank(playerid), PlayerICName(playerid), msg);
			SendClientMessage(i, COLOR_DOCTOR, str);
		}
	}
	//FakeRadioFMD(10, COLOR_DOCTOR, str);
	}
	if(PlayerInfo[playerid][pMember] == 5 || PlayerInfo[playerid][pLeader] == 5)
	{
	format(str, sizeof(str), "** %s %s: %s **", GetPlayerRank(playerid), PlayerICName(playerid), msg);
	SendFactionMessage(5, TEAM_BLUE_COLOR, str);
	}
	if(PlayerInfo[playerid][pMember] == 6 || PlayerInfo[playerid][pLeader] == 6)
	{
	format(str, sizeof(str), "** %s %s: %s **", GetPlayerRank(playerid), PlayerICName(playerid), msg);
	SendFactionMessage(6, TEAM_BLUE_COLOR, str);
	foreach( new i: Player )
	{
		if(PlayerInfo[i][pGroup] == 10 && PlayerInfo[i][pGOVListen])
		{
			format(str, sizeof(str), "** %s %s: %s **", GetPlayerRank(playerid), PlayerICName(playerid), msg);
			SendClientMessage(i, TEAM_BLUE_COLOR, str);
		}
	}
	//FakeRadioGOV(10, TEAM_BLUE_COLOR, str);
	}
	if(PlayerInfo[playerid][pMember] == 7 || PlayerInfo[playerid][pLeader] == 7)
	{
	format(str, sizeof(str), "** %s %s: %s **", GetPlayerRank(playerid), PlayerICName(playerid), msg);
	SendFactionMessage(7, TEAM_BLUE_COLOR, str);
	}
	if(PlayerInfo[playerid][pMember] == 8 || PlayerInfo[playerid][pLeader] == 8)
	{
	format(str, sizeof(str), "** %s %s: %s **", GetPlayerRank(playerid), PlayerICName(playerid), msg);
	SendFactionMessage(8, TEAM_BLUE_COLOR, str);
	}
	if(PlayerInfo[playerid][pMember] == 9 || PlayerInfo[playerid][pLeader] == 9)
	{
	format(str, sizeof(str), "** %s %s: %s **", GetPlayerRank(playerid), PlayerICName(playerid), msg);
	SendFactionMessage(9, TEAM_BLUE_COLOR, str);
	}
	if(PlayerInfo[playerid][pMember] == 10 || PlayerInfo[playerid][pLeader] == 10)
	{
	format(str, sizeof(str), "** %s %s: %s **", GetPlayerRank(playerid), PlayerICName(playerid), msg);
	SendFactionMessage(10, TEAM_BLUE_COLOR, str);
	}
	if(PlayerInfo[playerid][pMember] == 11 || PlayerInfo[playerid][pLeader] == 11)
	{
	format(str, sizeof(str), "** %s %s: %s **", GetPlayerRank(playerid), PlayerICName(playerid), msg);
	SendFactionMessage(11, TEAM_BLUE_COLOR, str);
	}
	if(PlayerInfo[playerid][pMember] == 12 || PlayerInfo[playerid][pLeader] == 12)
	{
	format(str, sizeof(str), "** %s %s: %s **", GetPlayerRank(playerid), PlayerICName(playerid), msg);
	SendFactionMessage(12, TEAM_BLUE_COLOR, str);
	}
	if(PlayerInfo[playerid][pMember] == 13 || PlayerInfo[playerid][pLeader] == 13)
	{
	format(str, sizeof(str), "** %s %s: %s **", GetPlayerRank(playerid), PlayerICName(playerid), msg);
	SendFactionMessage(13, TEAM_BLUE_COLOR, str);
	}
	if(PlayerInfo[playerid][pMember] == 14 || PlayerInfo[playerid][pLeader] == 14)
	{
	format(str, sizeof(str), "** %s %s: %s **", GetPlayerRank(playerid), PlayerICName(playerid), msg);
	SendFactionMessage(14, COLOR_SANG, str);
	foreach( new i: Player )
	{
		if(PlayerInfo[i][pGroup] == 10 && PlayerInfo[i][pSANGListen])
		{
			format(str, sizeof(str), "** %s %s: %s **", GetPlayerRank(playerid), PlayerICName(playerid), msg);
			SendClientMessage(i, COLOR_SANG, str);
		}
	}
	//FakeRadioSANG(14, COLOR_SANG, str);
	}
	if(PlayerInfo[playerid][pMember] == 15 || PlayerInfo[playerid][pLeader] == 15)
	{
	format(str, sizeof(str), "** %s %s: %s **", GetPlayerRank(playerid), PlayerICName(playerid), msg);
	SendFactionMessage(15, TEAM_BLUE_COLOR, str);
	}
	format(str, sizeof(str), "[/R]** %s %s: %s **", GetPlayerRank(playerid), PlayerOOCName(playerid), msg);
	SendShadowMsg(COLOR_GEAR_LIGHTPURPLE, str);
	if(ThiefText[playerid] != Text3D:INVALID_3DTEXT_ID) return 1;
	if(nametagText[playerid] != Text3D:INVALID_3DTEXT_ID) return 1;

	if(PlayerInfo[playerid][pMember] != 11) {
	format(str, sizeof(str), "[Radio] %s", msg);
	SetPlayerChatBubble(playerid, str, GetFactionColour(PlayerInfo[playerid][pMember]), 30.0, 10000);
	}
	}
	else
	{
		SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} (/r)adio [radio chat]");
	}
	return 1;
}

CMD:fr(playerid, params[]) return cmd_fakeradio(playerid, params);

CMD:fakeradio(playerid, params[])
{
	if(PlayerInfo[playerid][pGroup] > 10 || PlayerInfo[playerid][pGroup] < 10) return SendClientMessage(playerid, COLOR_GRAD1, "{FF0000}Error:{FFFFFF} Not authorized, autistic retard..");
	new msg[128];
	new str[1024];
	if(sscanf(params, "s[128]", msg)) return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /(f)ake(r)adio [message]");
	if(PlayerInfo[playerid][pGroup] == 10 && PlayerInfo[playerid][pSAPDListen] == 1)
	{
	format(str, sizeof(str), "** S9 Agent Unknown: %s **", msg);
	SendFactionMessage(FACTION_SAPD, TEAM_BLUE_COLOR, str);
	foreach( new i: Player )
	{
		if(PlayerInfo[i][pGroup] == 10 && PlayerInfo[i][pSAPDListen] == 0)
		{
		}
		else if(PlayerInfo[i][pGroup] == 10 && PlayerInfo[i][pSAPDListen] == 1)
		{
			format(str, sizeof(str), "** S9 Agent Unknown[%s]: %s **", PlayerOOCName(playerid), msg);
			SendClientMessage(i, TEAM_BLUE_COLOR, str);
		}
	}
	}
	if(PlayerInfo[playerid][pGroup] == 10 && PlayerInfo[playerid][pFBIListen] == 1)
	{
	format(str, sizeof(str), "** S9 Agent Unknown: %s **", msg);
	SendFactionMessage(FACTION_FBI, TEAM_BLUE_COLOR, str);
	foreach( new i: Player )
	{
		if(PlayerInfo[i][pGroup] == 10 && PlayerInfo[i][pFBIListen] == 0)
		{
		}
		else if(PlayerInfo[i][pGroup] == 10 && PlayerInfo[i][pFBIListen] == 1)
		{
			format(str, sizeof(str), "** S9 Agent Unknown[%s]: %s **", PlayerOOCName(playerid), msg);
			SendClientMessage(i, TEAM_BLUE_COLOR, str);
		}
	}
	}
	if(PlayerInfo[playerid][pGroup] == 10 && PlayerInfo[playerid][pLSSDListen] == 1)
	{
	format(str, sizeof(str), "** S9 Agent Unknown: %s **", msg);
	SendFactionMessage(FACTION_SASD, TEAM_BLUE_COLOR, str);
	foreach( new i: Player )
	{
		if(PlayerInfo[i][pGroup] == 10 && PlayerInfo[i][pLSSDListen] == 0)
		{
		}
		else if(PlayerInfo[i][pGroup] == 10 && PlayerInfo[i][pLSSDListen] == 1)
		{
			format(str, sizeof(str), "** S9 Agent Unknown[%s]: %s **", PlayerOOCName(playerid), msg);
			SendClientMessage(i, TEAM_BLUE_COLOR, str);
		}
	}
	}
	if(PlayerInfo[playerid][pGroup] == 10 && PlayerInfo[playerid][pFMDListen] == 1)
	{
	format(str, sizeof(str), "** S9 Agent Unknown: %s **", msg);
	SendFactionMessage(FACTION_FMD, COLOR_DOCTOR, str);
	foreach( new i: Player )
	{
		if(PlayerInfo[i][pGroup] == 10 && PlayerInfo[i][pFMDListen] == 0)
		{
		}
		else if(PlayerInfo[i][pGroup] == 10 && PlayerInfo[i][pFMDListen] == 1)
		{
			format(str, sizeof(str), "** S9 Agent Unknown[%s]: %s **", PlayerOOCName(playerid), msg);
			SendClientMessage(i, COLOR_DOCTOR, str);
		}
	}
	}
	if(PlayerInfo[playerid][pGroup] == 10 && PlayerInfo[playerid][pSANGListen] == 1)
	{
	format(str, sizeof(str), "** S9 Agent Unknown: %s **", msg);
	SendFactionMessage(FACTION_SANG, COLOR_SANG, str);
	foreach( new i: Player )
	{
		if(PlayerInfo[i][pGroup] == 10 && PlayerInfo[i][pSANGListen] == 0)
		{
		}
		else if(PlayerInfo[i][pGroup] == 10 && PlayerInfo[i][pSANGListen] == 1)
		{
			format(str, sizeof(str), "** S9 Agent Unknown[%s]: %s **", PlayerOOCName(playerid), msg);
			SendClientMessage(i, COLOR_SANG, str);
		}
	}
	}
	if(PlayerInfo[playerid][pGroup] == 10 && PlayerInfo[playerid][pGOVListen] == 1)
	{
	format(str, sizeof(str), "** S9 Agent Unknown: %s **", msg);
	SendFactionMessage(FACTION_GOV, TEAM_BLUE_COLOR, str);
	foreach( new i: Player )
	{
		if(PlayerInfo[i][pGroup] == 10 && PlayerInfo[i][pGOVListen] == 0)
		{
		}
		else if(PlayerInfo[i][pGroup] == 10 && PlayerInfo[i][pGOVListen] == 1)
		{
			format(str, sizeof(str), "** S9 Agent Unknown[%s]: %s **", PlayerOOCName(playerid), msg);
			SendClientMessage(i, TEAM_BLUE_COLOR, str);
		}
	}
	}
	return 1;
}
/*CMD:changefreq(playerid,params[])
{
if(PlayerInfo[playerid][pGroup] > 10 || PlayerInfo[playerid][pGroup] < 10) return SendClientMessage(playerid, COLOR_GRAD1, "{FF0000}Error:{FFFFFF} Not authorized, autistic retard..");
if(isnull(params))
{
return SendClientMessage(playerid,COLOR_GREY,"{00BFFF}Usage:{FFFFFF} /changefreq [name] [NONE, SAPD, FMD, FBI, LSSD, SANG, GOV]");
}
if(!strcmp(params,"sapd",true))
{
PlayerInfo[playerid][pFMDListen] = 0;
PlayerInfo[playerid][pFBIListen] = 0;
PlayerInfo[playerid][pSANListen] = 0;
PlayerInfo[playerid][pGOVListen] = 0;
PlayerInfo[playerid][pSANGListen] = 0;
PlayerInfo[playerid][pLSSDListen] = 0;
PlayerInfo[playerid][pSAPDListen] = 0;
PlayerInfo[playerid][pSAPDListen] = 1;
SendClientMessage(playerid, COLOR_GREY, "Listening SAPD");
}
else if(!strcmp(params,"fbi",true))
{
PlayerInfo[playerid][pFMDListen] = 0;
PlayerInfo[playerid][pFBIListen] = 0;
PlayerInfo[playerid][pSANListen] = 0;
PlayerInfo[playerid][pGOVListen] = 0;
PlayerInfo[playerid][pSANGListen] = 0;
PlayerInfo[playerid][pLSSDListen] = 0;
PlayerInfo[playerid][pSAPDListen] = 0;
PlayerInfo[playerid][pFBIListen] = 1;
SendClientMessage(playerid, COLOR_GREY, "Listening FBI");
}
else if(!strcmp(params,"none",true))
{
PlayerInfo[playerid][pFMDListen] = 0;
PlayerInfo[playerid][pFBIListen] = 0;
PlayerInfo[playerid][pSANListen] = 0;
PlayerInfo[playerid][pGOVListen] = 0;
PlayerInfo[playerid][pSANGListen] = 0;
PlayerInfo[playerid][pLSSDListen] = 0;
PlayerInfo[playerid][pSAPDListen] = 0;
SendClientMessage(playerid, COLOR_GREY, "Listening None");
}
else if(!strcmp(params,"lssd",true))
{
PlayerInfo[playerid][pFMDListen] = 0;
PlayerInfo[playerid][pFBIListen] = 0;
PlayerInfo[playerid][pSANListen] = 0;
PlayerInfo[playerid][pGOVListen] = 0;
PlayerInfo[playerid][pSANGListen] = 0;
PlayerInfo[playerid][pLSSDListen] = 0;
PlayerInfo[playerid][pSAPDListen] = 0;
PlayerInfo[playerid][pLSSDListen] = 1;
SendClientMessage(playerid, COLOR_GREY, "Listening LSSD");
}
else if(!strcmp(params,"sang",true))
{
PlayerInfo[playerid][pFMDListen] = 0;
PlayerInfo[playerid][pFBIListen] = 0;
PlayerInfo[playerid][pSANListen] = 0;
PlayerInfo[playerid][pGOVListen] = 0;
PlayerInfo[playerid][pSANGListen] = 0;
PlayerInfo[playerid][pLSSDListen] = 0;
PlayerInfo[playerid][pSAPDListen] = 0;
PlayerInfo[playerid][pSANGListen] = 1;
SendClientMessage(playerid, COLOR_GREY, "Listening SANG");
}
else if(!strcmp(params,"gov",true))
{
PlayerInfo[playerid][pFMDListen] = 0;
PlayerInfo[playerid][pFBIListen] = 0;
PlayerInfo[playerid][pSANListen] = 0;
PlayerInfo[playerid][pGOVListen] = 0;
PlayerInfo[playerid][pSANGListen] = 0;
PlayerInfo[playerid][pLSSDListen] = 0;
PlayerInfo[playerid][pSAPDListen] = 0;
PlayerInfo[playerid][pGOVListen] = 1;
SendClientMessage(playerid, COLOR_GREY, "Listening GOV");
}
//else if(!strcmp(params,"san",true))
    //	{
    //	PlayerInfo[playerid][pFMDListen] = 0;
    //    PlayerInfo[playerid][pFBIListen] = 0;
    //	PlayerInfo[playerid][pSANListen] = 0;
    //	PlayerInfo[playerid][pGOVListen] = 0;
    //	PlayerInfo[playerid][pSANGListen] = 0;
    //	PlayerInfo[playerid][pLSSDListen] = 0;
    //	PlayerInfo[playerid][pSAPDListen] = 0;
    //	PlayerInfo[playerid][pSANListen] = 1;
    //    SendClientMessage(playerid, COLOR_GREY, "Listening SAN");
   //     }
else if(!strcmp(params,"fmd",true))
{
PlayerInfo[playerid][pFMDListen] = 0;
PlayerInfo[playerid][pFBIListen] = 0;
PlayerInfo[playerid][pSANListen] = 0;
PlayerInfo[playerid][pGOVListen] = 0;
PlayerInfo[playerid][pSANGListen] = 0;
PlayerInfo[playerid][pLSSDListen] = 0;
PlayerInfo[playerid][pSAPDListen] = 0;
PlayerInfo[playerid][pFMDListen] = 1;
SendClientMessage(playerid, COLOR_GREY, "Listening FMD");
}
return 1;
}*/
CMD:rlow(playerid, params[])
{
	if(toggedRadio[playerid]) return SendClientMessage(playerid, COLOR_GREY, "You can't use this if you have it toggled off.");
	if(WatchingTV[playerid] == true) return 1;
	if(PlayerInfo[playerid][pMember] == 0) return SendClientMessage(playerid, COLOR_GREY, "You can not use this.");
	new msg[128];
	new str[128];
	if(!sscanf(params, "s[128]", msg))
	{
		if(IsPlayerRestricted(playerid)) return SendClientMessage(playerid, COLOR_GRAD1, "You can not do this at this time.");
		if(CheckForJammer(playerid)) return SendClientMessage(playerid, COLOR_GREY, "Radio signal has been jammed.");
		if(pDeathState[playerid] == PLAYER_STATE_REVIVE)
		{
			format(str, sizeof(str), "* %s attempts to reach his radio but fails.", PlayerICName(playerid));
			ProxDetector(30.0, playerid, str, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
			return 1;
		}

		// Gagged
		if(IsPlayerGagged(playerid)) {
			SendClientMessage(playerid, COLOR_GREY, "The gag in your mouth makes you unable to speak...");

			new gagStr[128];
			format(gagStr, sizeof(gagStr), "* %s tries to mumble something into their radio.", PlayerICName(playerid));
			SetPlayerChatBubble(playerid, gagStr, COLOR_PURPLE, 20.0, 15000);
			return 1;
		}

		foreach( new i: Player )
		{
			if(PlayerInfo[i][pWire] == 1 && !CheckForJammer(playerid) && !CheckForJammer(i))
			{
				new Float: x[3];
				GetPlayerPos(playerid, x[0], x[1], x[2]);
				if(IsPlayerInRangeOfPoint(i, 20.0, x[0], x[1], x[2]))
				{
					if(i == playerid)
					{
						format(str, sizeof(str), "{8D8DFF}(BUGGED){AFAFAF} %s (radio): %s", PlayerOOCName(i), msg);
					}
					else
					{
						format(str, sizeof(str), "{8D8DFF}(BUGGED){AFAFAF} %s's surroundings (radio): %s", PlayerOOCName(i), msg);
					}
					if(PlayerInfo[i][pMember] != 2) // if player isn't FBI, send to both FBI and S9
					{
						SendBuggedMessage(COLOR_ORANGE, str);
						SendS9BuggedMessage(COLOR_ORANGE, str);
					}
					else SendS9BuggedMessage(COLOR_ORANGE, str); // if player is FBI, send to S9 only, this is to avoid FBI figuring out
					// 																							that s9 bugged them
				}
			}
		}

		// Cut down about 100 lines here, use functions for small changes such as colour. DRY - Don't Repeat Yourself.

		if(PlayerInfo[playerid][pMember] == 1)
		{
			format(str, sizeof(str), "** %s %s (low) %s **", GetPlayerRank(playerid), PlayerICName(playerid), msg);
			SendRadioMessage(1, GetFactionColour(PlayerInfo[playerid][pMember]), str);
			foreach( new i: Player )
			{
				if(PlayerInfo[i][pGroup] == GROUP_S9 && RadioFrequency[i] == FACTION_SAPD)
				{
					format(str, sizeof(str), "** %s %s (low) %s **", GetPlayerRank(playerid), PlayerICName(playerid), msg);
					SendFakeRadioMessage(GROUP_S9,  GetFactionColour(PlayerInfo[playerid][pMember]), str);
				}
			}
		}
		if(PlayerInfo[playerid][pMember] == 2)
		{
			format(str, sizeof(str), "** %s %s (low) %s **", GetPlayerRank(playerid), PlayerICName(playerid), msg);
			SendRadioMessage(2, GetFactionColour(PlayerInfo[playerid][pMember]), str);
			foreach( new i: Player )
			{
				if(PlayerInfo[i][pGroup] == GROUP_S9 && RadioFrequency[i] == FACTION_SAPD)
				{
					format(str, sizeof(str), "** %s %s (low) %s **", GetPlayerRank(playerid), PlayerICName(playerid), msg);
					SendFakeRadioMessage(GROUP_S9,  GetFactionColour(PlayerInfo[playerid][pMember]), str);
				}
			}
		}
		if(PlayerInfo[playerid][pMember] == 3)
		{
			format(str, sizeof(str), "** %s %s (low) %s **", GetPlayerRank(playerid), PlayerICName(playerid), msg);
			SendRadioMessage(3, GetFactionColour(PlayerInfo[playerid][pMember]), str);
		}
		if(PlayerInfo[playerid][pMember] == 4)
		{
			format(str, sizeof(str), "** %s %s (low) %s **", GetPlayerRank(playerid), PlayerICName(playerid), msg);
			SendRadioMessage(4, GetFactionColour(PlayerInfo[playerid][pMember]), str);
			foreach( new i: Player )
			{
				if(PlayerInfo[i][pGroup] == GROUP_S9 && RadioFrequency[i] == FACTION_FMD)
				{
					format(str, sizeof(str), "** %s %s (low) %s **", GetPlayerRank(playerid), PlayerICName(playerid), msg);
					SendFakeRadioMessage(GROUP_S9,  GetFactionColour(PlayerInfo[playerid][pMember]), str);
				}
			}
		}
		if(PlayerInfo[playerid][pMember] == 5)
		{
			format(str, sizeof(str), "** %s %s (low) %s **", GetPlayerRank(playerid), PlayerICName(playerid), msg);
			SendRadioMessage(5, GetFactionColour(PlayerInfo[playerid][pMember]), str);
			foreach( new i: Player )
			{
				if(PlayerInfo[i][pGroup] == GROUP_S9 && RadioFrequency[i] == FACTION_ARMY)
				{
					format(str, sizeof(str), "** %s %s (low) %s **", GetPlayerRank(playerid), PlayerICName(playerid), msg);
					SendFakeRadioMessage(GROUP_S9,  GetFactionColour(PlayerInfo[playerid][pMember]), str);
				}
			}
		}
		if(PlayerInfo[playerid][pMember] == 6)
		{
			format(str, sizeof(str), "** %s %s (low) %s **", GetPlayerRank(playerid), PlayerICName(playerid), msg);
			SendRadioMessage(6, GetFactionColour(PlayerInfo[playerid][pMember]), str);
			foreach( new i: Player )
			{
				if(PlayerInfo[i][pGroup] == GROUP_S9 && RadioFrequency[i] == FACTION_GOV)
				{
					format(str, sizeof(str), "** %s %s (low) %s **", GetPlayerRank(playerid), PlayerICName(playerid), msg);
					SendFakeRadioMessage(GROUP_S9,  GetFactionColour(PlayerInfo[playerid][pMember]), str);
				}
			}
		}
		if(PlayerInfo[playerid][pMember] == 7)
		{
			format(str, sizeof(str), "** %s %s (low) %s **", GetPlayerRank(playerid), PlayerICName(playerid), msg);
			SendRadioMessage(7, GetFactionColour(PlayerInfo[playerid][pMember]), str);
		}
		if(PlayerInfo[playerid][pMember] == 8)
		{
			format(str, sizeof(str), "** %s %s (low) %s **", GetPlayerRank(playerid), PlayerICName(playerid), msg);
			SendRadioMessage(8, GetFactionColour(PlayerInfo[playerid][pMember]), str);
		}
		if(PlayerInfo[playerid][pMember] == 9)
		{
			format(str, sizeof(str), "** %s %s (low) %s **", GetPlayerRank(playerid), PlayerICName(playerid), msg);
			SendRadioMessage(9, GetFactionColour(PlayerInfo[playerid][pMember]), str);
		}
		if(PlayerInfo[playerid][pMember] == 10)
		{
			format(str, sizeof(str), "** %s %s (low) %s **", GetPlayerRank(playerid), PlayerICName(playerid), msg);
			SendRadioMessage(10, GetFactionColour(PlayerInfo[playerid][pMember]), str);
		}
		if(PlayerInfo[playerid][pMember] == 11)
		{
			format(str, sizeof(str), "** %s %s (low) %s **", GetPlayerRank(playerid), PlayerICName(playerid), msg);
			SendRadioMessage(11, GetFactionColour(PlayerInfo[playerid][pMember]), str);
		}
		if(PlayerInfo[playerid][pMember] == 12)
		{
			format(str, sizeof(str), "** %s %s (low) %s **", GetPlayerRank(playerid), PlayerICName(playerid), msg);
			SendRadioMessage(12, GetFactionColour(PlayerInfo[playerid][pMember]), str);
			foreach( new i: Player )
			{
				if(PlayerInfo[i][pGroup] == GROUP_S9 && RadioFrequency[i] == FACTION_DEA)
				{
					format(str, sizeof(str), "** %s %s (low) %s **", GetPlayerRank(playerid), PlayerICName(playerid), msg);
					SendFakeRadioMessage(GROUP_S9,  GetFactionColour(PlayerInfo[playerid][pMember]), str);
				}
			}
		}
		if(PlayerInfo[playerid][pMember] == 13)
		{
			format(str, sizeof(str), "** %s %s (low) %s **", GetPlayerRank(playerid), PlayerICName(playerid), msg);
			SendRadioMessage(13, GetFactionColour(PlayerInfo[playerid][pMember]), str);
		}
		if(PlayerInfo[playerid][pMember] == 14)
		{
			format(str, sizeof(str), "** %s %s (low) %s **", GetPlayerRank(playerid), PlayerICName(playerid), msg);
			SendRadioMessage(14, GetFactionColour(PlayerInfo[playerid][pMember]), str);
			foreach( new i: Player )
			{
				if(PlayerInfo[i][pGroup] == GROUP_S9 && RadioFrequency[i] == FACTION_SANG)
				{
					format(str, sizeof(str), "** %s %s (low) %s **", GetPlayerRank(playerid), PlayerICName(playerid), msg);
					SendFakeRadioMessage(GROUP_S9,  GetFactionColour(PlayerInfo[playerid][pMember]), str);
				}
			}
		}
		if(PlayerInfo[playerid][pMember] == 15)
		{
			format(str, sizeof(str), "** %s %s: %s **", GetPlayerRank(playerid), PlayerICName(playerid), msg);
			SendRadioMessage(15, GetFactionColour(PlayerInfo[playerid][pMember]), str);
		}

		if(!IsPlayerInAnyVehicle(playerid))
		{
			format(str, sizeof(str), "(Radio) %s (low): %s", PlayerICName(playerid), msg);
			ProxDetector(3.0, playerid, str, COLOR_GREY, COLOR_GREY, COLOR_GREY, COLOR_GREY, COLOR_GREY);
		}
		format(str, sizeof(str), "/rlow %s %s: %s **", GetPlayerRank(playerid), PlayerICName(playerid), msg);
		SendShadowMsg(COLOR_GEAR_LIGHTPURPLE, str);
		if(beingSpectatedID[playerid] != INVALID_PLAYER_ID)
		{
			if(IsPlayerConnected(beingSpectatedID[playerid]) && SpectatingID[beingSpectatedID[playerid]] == playerid)
			{
				format(str, sizeof(str), "[AdmWrn] %s used /rlow: %s", PlayerICName(playerid), msg);
				SendClientMessage(beingSpectatedID[playerid], COLOR_YELLOW, str);
			}
		}
	}

	else SendClientMessage(playerid, -1, "{00BFFF}Usage:{FFFFFF} /rlow [radio chat]");
	return 1;
}

CMD:i(playerid, params[])
{
	if(PlayersChannel[playerid] != 999)
	{
		if(PlayerInfo[playerid][pMuted] == 1)
		{
			SendClientMessage(playerid, COLOR_GREY, "You cannot speak, you have been silenced.");
			return 1;
		}
		new msg[128];
		new str[128];
		if(!sscanf(params, "s[128]", msg))
		{
			new name[24];
			strmid(name, str_replace('_', ' ', PlayerName(playerid)), 0, MAX_PLAYER_NAME);
			format(str, sizeof(str), "** IRC %s: %s **", name, msg);
			SendIRCMessage(PlayersChannel[playerid], COLOR_YELLOW2, str);
			format(str, sizeof(str), "** IRC %s: %s **", name, msg);
			SendShadowMsg(COLOR_YELLOW2, str);
		}
		else
		{
			SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /i [irc chat]");
		}
	}
	else
	{
		SendClientMessage(playerid, COLOR_GREY, "You are not in an IRC Channel.");
	}
	return 1;
}

CMD:wt(playerid, params[])
{
	if(PlayerInfo[playerid][pWTc] > 0 && PlayerInfo[playerid][pWTc] < 1000000)
	{
		if(WTOnline[playerid]) return SendClientMessage(playerid, COLOR_GREY, "Walkie talkie is currently turned off, use /togwt.");
		new msg[128];
		if(!sscanf(params, "s[128]", msg))
		{
			if(IsPlayerRestricted(playerid)) return SendClientMessage(playerid, COLOR_GRAD1, "You can not do this at this time.");
			if(PlayerInfo[playerid][pWT] != 1) return SendClientMessage(playerid, COLOR_GREY, "You don`t have a Walkie Talkie.");
			if(WTOnline[playerid] > 0) return SendClientMessage(playerid, COLOR_GREY, "Your Walkie Talkie is Off.");
			if(CheckForJammer(playerid)) return SendClientMessage(playerid, COLOR_GREY, "Radio signal has been jammed.");
			if(pDeathState[playerid] == PLAYER_STATE_REVIVE)
			{
				new str[128];
				format(str, sizeof(str), "* %s attempts to reach his walkie talkie but fails.", PlayerICName(playerid));
				ProxDetector(30.0, playerid, str, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
				return 1;
			}

			// Gagged
			if(IsPlayerGagged(playerid)) {
				SendClientMessage(playerid, COLOR_GREY, "The gag in your mouth makes you unable to speak...");

				new gagStr[128];
				format(gagStr, sizeof(gagStr), "* %s tries to mumble something into their radio.", PlayerICName(playerid));
				SetPlayerChatBubble(playerid, gagStr, COLOR_PURPLE, 20.0, 15000);
				return 1;
			}

			new channel = PlayerInfo[playerid][pWTc];
			new name[24];
			new str[128];
			foreach( new i: Player )
			{
				if(PlayerInfo[i][pWire] == 1 && !CheckForJammer(playerid) && !CheckForJammer(i))
				{
					new Float: x[3];
					GetPlayerPos(playerid, x[0], x[1], x[2]);
					if(IsPlayerInRangeOfPoint(i, 20.0, x[0], x[1], x[2]))
					{
						if(i == playerid)
						{
							format(str, sizeof(str), "{8D8DFF}(BUGGED){AFAFAF} %s (radio): %s", PlayerOOCName(i), msg);
						}
						else
						{
							format(str, sizeof(str), "{8D8DFF}(BUGGED){AFAFAF} %s's surroundings (radio): %s", PlayerOOCName(i), msg);
						}
						if(PlayerInfo[i][pMember] != 2) // if player isn't FBI, send to both FBI and S9
						{
							SendBuggedMessage(COLOR_ORANGE, str);
							SendS9BuggedMessage(COLOR_ORANGE, str);
						}
						else SendS9BuggedMessage(COLOR_ORANGE, str); // if player is FBI, send to S9 only, this is to avoid FBI figuring out
						// 																							that s9 bugged them
					}
				}
			}
			strmid(name, str_replace('_', ' ', PlayerName(playerid)), 0, MAX_PLAYER_NAME);
			format(str, sizeof(str), "** Walkie Talkie %s: %s **", name, msg);
			SendWTMessage(channel, 0x638F9CFF, str);
			SendShadowMsg(COLOR_GREEN, str);
			if(ThiefText[playerid] != Text3D:INVALID_3DTEXT_ID) return 1;
			if(nametagText[playerid] != Text3D:INVALID_3DTEXT_ID) return 1;
			format(str, sizeof(str), "[Radio] %s", msg);
			SetPlayerChatBubble(playerid, str, 0x638F9CFF, 30.0, 10000);
			if(beingSpectatedID[playerid] != INVALID_PLAYER_ID)
			{
				if(IsPlayerConnected(beingSpectatedID[playerid]) && SpectatingID[beingSpectatedID[playerid]] == playerid)
				{
					format(str, sizeof(str), "[AdmWrn] %s used their walkie-talkie: %s", name, msg);
					SendClientMessage(beingSpectatedID[playerid], COLOR_YELLOW, str);
				}
			}
		}
		else
		{
			SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /wt [message]");
		}
	}
	else
	{
		SendClientMessage(playerid, COLOR_GRAD2, "Your walkie talkie hasn't been tuned to a channel.");
	}
	return 1;
}

CMD:wtlow(playerid, params[])
{
	if(PlayerInfo[playerid][pWTc] > 0 && PlayerInfo[playerid][pWTc] < 1000000)
	{
		if(WTOnline[playerid]) return SendClientMessage(playerid, COLOR_GREY, "Walkie talkie is currently turned off, use /togwt.");
		new msg[128];
		if(!sscanf(params, "s[128]", msg))
		{
			if(IsPlayerRestricted(playerid)) return SendClientMessage(playerid, COLOR_GRAD1, "You can not do this at this time.");
			if(PlayerInfo[playerid][pWT] != 1) return SendClientMessage(playerid, COLOR_GREY, "You don`t have a Walkie Talkie.");
			if(WTOnline[playerid] > 0) return SendClientMessage(playerid, COLOR_GREY, "Your Walkie Talkie is Off.");
			if(CheckForJammer(playerid)) return SendClientMessage(playerid, COLOR_GREY, "Radio signal has been jammed.");
			if(pDeathState[playerid] == PLAYER_STATE_REVIVE)
			{
				new str[128];
				format(str, sizeof(str), "* %s attempts to reach his walkie talkie but fails.", PlayerICName(playerid));
				ProxDetector(30.0, playerid, str, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
				return 1;
			}

			// Gagged
			if(IsPlayerGagged(playerid)) {
				SendClientMessage(playerid, COLOR_GREY, "The gag in your mouth makes you unable to speak...");

				new gagStr[128];
				format(gagStr, sizeof(gagStr), "* %s tries to mumble something into their radio.", PlayerICName(playerid));
				SetPlayerChatBubble(playerid, gagStr, COLOR_PURPLE, 20.0, 15000);
				return 1;
			}
			new str[128];
			new channel = PlayerInfo[playerid][pWTc];
			new name[24];
			foreach( new i: Player )
			{
				if(PlayerInfo[i][pWire] == 1 && !CheckForJammer(playerid) && !CheckForJammer(i))
				{
					new Float: x[3];
					GetPlayerPos(playerid, x[0], x[1], x[2]);
					if(IsPlayerInRangeOfPoint(i, 20.0, x[0], x[1], x[2]))
					{
						if(i == playerid)
						{
							format(str, sizeof(str), "{8D8DFF}(BUGGED){AFAFAF} %s (radio): %s", PlayerOOCName(i), msg);
						}
						else
						{
							format(str, sizeof(str), "{8D8DFF}(BUGGED){AFAFAF} %s's surroundings (radio): %s", PlayerOOCName(i), msg);
						}
						if(PlayerInfo[i][pMember] != 2) // if player isn't FBI, send to both FBI and S9
						{
							SendBuggedMessage(COLOR_ORANGE, str);
							SendS9BuggedMessage(COLOR_ORANGE, str);
						}
						else SendS9BuggedMessage(COLOR_ORANGE, str); // if player is FBI, send to S9 only, this is to avoid FBI figuring out
						// 																							that s9 bugged them
					}
				}
			}
			strmid(name, str_replace('_', ' ', PlayerName(playerid)), 0, MAX_PLAYER_NAME);
			format(str, sizeof(str), "** Walkie Talkie %s (low): %s **", name, msg);
			SendWTMessage(channel, 0x638F9CFF, str);
			if(!IsPlayerInAnyVehicle(playerid))
			{
				format(str, sizeof(str), "(Walkie Talkie) %s (low): %s", PlayerICName(playerid), msg);
				ProxDetector(3.0, playerid, str, COLOR_GREY, COLOR_GREY, COLOR_GREY, COLOR_GREY, COLOR_GREY);
			}
			if(beingSpectatedID[playerid] != INVALID_PLAYER_ID)
			{
				if(IsPlayerConnected(beingSpectatedID[playerid]) && SpectatingID[beingSpectatedID[playerid]] == playerid)
				{
					format(str, sizeof(str), "[AdmWrn] %s used their walkie-talkie: %s", name, msg);
					SendClientMessage(beingSpectatedID[playerid], COLOR_YELLOW, str);
				}
			}
		}
		else
		{
			SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /wtlow [message]");
		}
	}
	else
	{
		SendClientMessage(playerid, COLOR_GRAD2, "Your walkie talkie hasn't been tuned to a channel.");
	}
	return 1;
}

CMD:t(playerid, params[]) return cmd_sms(playerid, params);

CMD:sms(playerid, params[])
{
	if(WatchingTV[playerid] == true) return 1;
	if(IsPlayerRestricted(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You can't use this whilst you're in prison.");
	if(!PhoneOffline[playerid])
	{
		new number, message[128];
		if(sscanf(params, "is[128]", number, message)) return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /sms [phone number] [message]");
		SendMessage(playerid, number, message);
		if(onCellPhone[playerid] == true)
		{
			cmd_pickup(playerid, "");
		}
	}
	else
	{
		SendClientMessage(playerid, COLOR_GRAD2, "Your cellphone is currently turned off.");
	}
	return 1;
}

CMD:reply(playerid, params[])
{
	if(WatchingTV[playerid] == true) return 1;
	if(IsPlayerRestricted(playerid)) return SendClientMessage(playerid, COLOR_LIGHTBLUE, "You can't use this at this time.");
	if(PhoneOffline[playerid]) return SendClientMessage(playerid, COLOR_GRAD2, "Your cellphone is currently turned off.");
	if(ReplyTo[playerid] == 0) return SendClientMessage(playerid, COLOR_GRAD2, "Nobody SMSed you.");
	if(isnull(params)) return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /re(ply) [message]");
	SendMessage(playerid, ReplyTo[playerid], params);
	if(onCellPhone[playerid] == true) cmd_pickup(playerid, "");
	return 1;
}

CMD:re(playerid, params[]) return cmd_reply(playerid, params);

CMD:d(playerid, params[]) return cmd_departments(playerid, params);

CMD:togradio(playerid, params[])
{
	if(PlayerInfo[playerid][pMember] != 0)
	{
		if(toggedRadio[playerid])
		{
			toggedRadio[playerid] = false;
			SendClientMessage(playerid, COLOR_YELLOW, "The faction radio chat will now show for you.");
		}
		else
		{
			toggedRadio[playerid] = true;
			SendClientMessage(playerid, COLOR_YELLOW, "The faction radio chat will no longer show for you.");
		}
	}
	else return SendClientMessage(playerid, COLOR_GREY, "You're not allowed to use this.");
	return 1;
}

CMD:togdept(playerid, params[])
{
	if(PlayerInfo[playerid][pMember] >= 1 && PlayerInfo[playerid][pMember] <= 7 || PlayerInfo[playerid][pGroup] == GROUP_S9)
	{
		if(toggedDept[playerid])
		{
			toggedDept[playerid] = false;
			SendClientMessage(playerid, COLOR_YELLOW, "The department radio chat will now show for you.");
		}
		else
		{
			toggedDept[playerid] = true;
			SendClientMessage(playerid, COLOR_YELLOW, "The department radio chat will no longer show for you.");
		}
	}
	else return SendClientMessage(playerid, COLOR_GREY, "You're not allowed to use this.");
	return 1;
}

/*************************************
             COMMANDS S9
*************************************/

/*
    Command: /fakedepartments
    Parameters:
            msg: message to send
    Description:
            Sends a department wide message to all factions
*/
CMD:fakedepartments(playerid, params[]) {
	if(PlayerInfo[playerid][pGroup] != GROUP_S9) return 1;
	new msg[128];
	if(sscanf(params, "s[128]", msg)) return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} (/fd) [S9 department chat]");
	new str[128];
	format(str, sizeof(str), "** [Sector 9] %s %s: %s **", RealS9Rank(playerid), PlayerInfo[playerid][pMaskName], msg);

	for(new i=1; i <= 7; i++) {
		SendDepartmentRadioMessage(i, COLOR_DCHAT, str);
	}
	S9DepartmentMessage(COLOR_DCHAT, str);

	return 1;
}
CMD:fd(playerid, params[]) return cmd_fakedepartments(playerid, params);

ShowS9BadgeMenu(playerid)
{
	new dialogStr[256];
	format(dialogStr, sizeof(dialogStr), "Item\tValue\nBadge Name:\t%s\nBadge Faction\t%s\nBadge Weapons\t%s",
	PlayerInfo[playerid][pS9BadgeName], S9BadgeFaction, S9BadgeWeapons);
	ShowPlayerDialog(playerid, DIALOG_S9_EDIT_BADGE, DIALOG_STYLE_TABLIST_HEADERS, "Edit your S9 Badge", dialogStr, "Edit", "Close");
	return 1;
}
/*
	Command:/edits9badge
	Parameters:
		bName: Badge name. Player's badge name.

		bWeapons: Global faction weapons.

*/

CMD:edits9badge(playerid, params[]) {
	if(PlayerInfo[playerid][pGroup] != GROUP_S9) return 1;
	ShowS9BadgeMenu(playerid);
	return 1;
}

/*
    Command: /shows9badge
    Parameters:
            player: player to show badge to
    Description:
            Used to show an S9 badge to other players
*/
CMD:shows9badge(playerid, params[]) {
	if(PlayerInfo[playerid][pGroup] != GROUP_S9)
		return 1;

	new targetid;
	if(sscanf(params, "u", targetid))
		return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /shows9badge [player]");

	if(!IsPlayerConnected(targetid))
		return SendClientMessage(playerid, COLOR_GREY, "Unknown player.");

	if(!IsPlayerInRangeOfPlayer(5.0, playerid, targetid))
		return SendClientMessage(playerid, COLOR_GREY, "You are not near this person.");

	if(strlen(PlayerInfo[playerid][pS9BadgeName]) < 1 || strlen(S9BadgeFaction) < 1)
		return SendClientMessage(playerid, COLOR_GREY, "Please use /edits9badge");

	// Show the badge
	SendClientMessage(targetid, COLOR_YELLOW, "[Badge Information]");
	new str[128];

	format(str, sizeof(str), "[%s - %s]", PlayerInfo[playerid][pS9BadgeName], S9BadgeFaction);
	SendClientMessage(targetid, COLOR_YELLOW, str);

	format(str, sizeof(str), "[Allowed Weapons]: %s", S9BadgeWeapons);
	SendClientMessage(targetid, COLOR_YELLOW, str);

	// Action
	if(targetid != playerid) {
		format(str, sizeof(str), "* %s discreetly shows something to %s.", PlayerICName(playerid), PlayerICName(targetid));
		SetPlayerChatBubble(playerid, str, COLOR_PURPLE, 5.0, 5000);

		format(str, sizeof(str), "> %s %s", PlayerICName(playerid), params);
		SendClientMessage(playerid, COLOR_PURPLE, str);
	}
	else {
		SendClientMessage(playerid, COLOR_PURPLE, "* You quickly look at your badge before putting it away.");
	}
	return 1;
}

/*
    Command: /fire
    Parameters:
        kick / kill: kicks players from faction or faction kills them
        player: player to kick / kill
    Description:
        Faction kill or kick to remove people from factions.
*/
CMD:fire(playerid, params[])
{
	if(PlayerInfo[playerid][pGroup] != GROUP_S9)
		return AdmErrorMsg;
	if(PlayerInfo[playerid][pGroupRank] < 0)
		return SendClientMessage(playerid, COLOR_GREY, "Only R2+ may use this.");

	new kicktype[5], giveplayerid;
	new str[128];
	if(sscanf(params, "s[20]u", kicktype, giveplayerid))
		return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /fire [kill/kick] [player]");

    if(giveplayerid == playerid)
		return SendClientMessage(playerid, COLOR_GREY, "You can't fire yourself.");

	if(!IsPlayerConnected(giveplayerid))
		return SendClientMessage(playerid, COLOR_GREY, "Invalid playerid.");

	if(	PlayerInfo[giveplayerid][pMember] != FACTION_SAPD &&
		PlayerInfo[giveplayerid][pMember] != FACTION_FBI &&
		PlayerInfo[giveplayerid][pMember] != FACTION_FMD &&
		PlayerInfo[giveplayerid][pMember] != FACTION_ARMY &&
		PlayerInfo[giveplayerid][pMember] != FACTION_GOV &&
		PlayerInfo[giveplayerid][pMember] != FACTION_SANG
	) return SendClientMessage(playerid, COLOR_GREY, "You cannot fire this person from their faction.");

	if(strcmp(kicktype, "kick", true) == 0)
	{
		format(str, sizeof(str), "* You have been kicked out of the %s by S9.", GetPlayerFactionName(giveplayerid));
		SendClientMessage(giveplayerid, COLOR_LIGHTBLUE, str);

		format(str, sizeof(str), "Papa Bear: %s %s has fired %s from %s.", RealS9Rank(playerid), PlayerOOCName(playerid), PlayerOOCName(giveplayerid), GetPlayerFactionName(giveplayerid));
		SendGroupMessage(GROUP_S9, COLOR_S9, str);
	}
	else if(strcmp(kicktype, "kill", true) == 0)
	{
		PlayerInfo[giveplayerid][pFKickTime] = 60 * 3600000; // 60 hours playing hours

		format(str, sizeof(str), "* You have been faction killed by S9.");
		SendClientMessage(giveplayerid, COLOR_LIGHTBLUE, str);

		SendClientMessage(giveplayerid, COLOR_LIGHTRED, "* If you feel this is an error or abuse, please create a forum related complaint.");
		SendClientMessage(giveplayerid, COLOR_LIGHTRED, "* You can use /fbantime to see how long you have left until you can join a faction again.");

		format(str, sizeof(str), "Papa Bear: %s %s has faction-killed %s.", RealS9Rank(playerid), PlayerOOCName(playerid), PlayerOOCName(giveplayerid));
		SendGroupMessage(GROUP_S9, COLOR_S9, str);
	}
	else return cmd_fire(playerid, "");

	format(customRank[giveplayerid], 24, "None");
	PlayerInfo[giveplayerid][pHAFakeBadge] = 0;
	PlayerInfo[giveplayerid][pRank] = 0;
	PlayerInfo[giveplayerid][pMember] = 0;
	PlayerInfo[giveplayerid][pLeader] = 0;
	PlayerInfo[giveplayerid][pModel] = 20;
	PlayerInfo[giveplayerid][pOnDuty] = 0;
	PlayerInfo[giveplayerid][pRadio] = 0;
	PlayerInfo[giveplayerid][pHandtazer] = 0;
	PlayerInfo[giveplayerid][ptazerGun] = 0;
	PlayerInfo[giveplayerid][pPortMDC] = 0;
	loadedRubberBullets[giveplayerid] = false;
	hasRubberBullets[giveplayerid] = 0;

	if(PlayerInfo[giveplayerid][pJailed] != 3 && PlayerInfo[giveplayerid][pAdminJailed] == 0)
	{
		SetPlayerToTeamColor(giveplayerid);
		SetPlayerSkin(giveplayerid, 1);
		PlayerInfo[giveplayerid][pClothes] = 0;
	}

	ClearGuns(giveplayerid);
	return 1;
}

/*
    Command: /s9
    Description:
        Access to S9 armoury
*/
CMD:s9(playerid, params[])
{
	if(PlayerInfo[playerid][pGroup] != GROUP_S9)
		return 1;

	if(!IsPlayerNearSector9HQ(playerid))
		return SendClientMessage(playerid, COLOR_GREY, "You are not at your headquarters.");

	ShowS9Armory(playerid);
	return 1;
}

CMD:s9uc(playerid, params[])
	return cmd_hitmanundercover(playerid, params);
CMD:s9nametag(playerid)
 {
		if(PlayerInfo[playerid][pGroup] != GROUP_S9) return 1;

		if(usingNameTag[playerid] == 1)
		{
			DestroyDynamic3DTextLabel(nametagText[playerid]);
			nametagText[playerid] = Text3D:INVALID_3DTEXT_ID;
			usingNameTag[playerid] = 0;
			SendClientMessage(playerid, COLOR_LIGHTBLUE, "You have disabled your S9 nametag");
		}
		else if(usingNameTag[playerid] == 0)
		{
			nametagText[playerid] = CreateDynamic3DTextLabel("\nHomeland Agent", COLOR_BLACK, 0.0, 0.0, 0.0 +0.32, 20.0, playerid, INVALID_VEHICLE_ID, 1, -1, -1, -1, 100);
			SendClientMessage(playerid, COLOR_LIGHTBLUE, "* S9 nametag enabled.");
			usingNameTag[playerid] = 1;
		}
		return 1;
}

//*********************************************


CMD:departments(playerid, params[])
{
	if(WatchingTV[playerid] == true) return 1;
	if(IsPlayerRestricted(playerid)) return SendClientMessage(playerid, COLOR_GRAD1, "You can not do this at this time.");
	if(toggedDept[playerid]) return SendClientMessage(playerid, COLOR_GREY, "You can't use this if you have it toggled off.");
	if(CheckForJammer(playerid)) return SendClientMessage(playerid, COLOR_GREY, "Radio signal has been jammed.");
	if(PlayerInfo[playerid][pGroup] == GROUP_S9 && PlayerInfo[playerid][pMember] == 0) return SendClientMessage(playerid, COLOR_GREY, "Use /(f)ake(d)epartments instead.");
	if(pDeathState[playerid] == PLAYER_STATE_REVIVE)
	{
		new str[128];
		format(str, sizeof(str), "* %s attempts to reach his radio but fails.", PlayerICName(playerid));
		ProxDetector(30.0, playerid, str, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
		return 1;
	}
	if(DptBanned[0] && PlayerInfo[playerid][pMember] == FACTION_SAPD || DptBanned[1] && PlayerInfo[playerid][pMember] == FACTION_FBI ||
	   DptBanned[2] && PlayerInfo[playerid][pMember] == FACTION_FMD || DptBanned[3] && PlayerInfo[playerid][pMember] == FACTION_GOV ||
	   DptBanned[4] && PlayerInfo[playerid][pMember] == FACTION_SANG || DptBanned[5] && PlayerInfo[playerid][pMember] == FACTION_NEWS)
		return SendClientMessage(playerid, -1, "{FF0000}WARNING:{FFFFFF} The homeland security has {FF0000}restricted{FFFFFF} your department radio communications!");
	new msg[128];
	new str[5000];
	if(!sscanf(params, "s[128]", msg))
	{
		if(!(PlayerInfo[playerid][pMember] >= 1 && PlayerInfo[playerid][pMember] <= 7 || IsAJudge(playerid) || IsACop(playerid) || PlayerInfo[playerid][pMember] == FACTION_SANG)) return SendClientMessage(playerid, COLOR_GRAD2, "You are not authorized to use this channel.");
		foreach( new i: Player )
		{
			if(PlayerInfo[i][pWire] == 1 && !CheckForJammer(playerid) && !CheckForJammer(i))
			{
				new Float: x[3];
				GetPlayerPos(playerid, x[0], x[1], x[2]);
				if(IsPlayerInRangeOfPoint(i, 8.0, x[0], x[1], x[2]))
				{
					if(i == playerid)
					{
						format(str, sizeof(str), "{8D8DFF}(BUGGED){AFAFAF} %s (radio): %s", PlayerICName(i), msg);
					}
					else
					{
						format(str, sizeof(str), "{8D8DFF}(BUGGED){AFAFAF} %s's surroundings (radio): %s", PlayerICName(i), msg);
					}
					if(PlayerInfo[i][pMember] != 2) // if player isn't FBI, send to both FBI and S9
					{
						SendBuggedMessage(COLOR_ORANGE, str);
						SendS9BuggedMessage(COLOR_ORANGE, str);
					}
					else SendS9BuggedMessage(COLOR_ORANGE, str); // if player is FBI, send to S9 only, this is to avoid FBI figuring out
					// 																							that s9 bugged them
				}
			}
		}

		if(PlayerInfo[playerid][pBadgeNumber] != 0) format(str, sizeof(str), "** [%s] %s %s (%d): %s **", GetPlayerFactionName(playerid), GetPlayerRank(playerid), PlayerICName(playerid), PlayerInfo[playerid][pBadgeNumber], msg);
		// else if(PlayerInfo[playerid][pGroup] == GROUP_S9 && PlayerInfo[playerid][pMember] == 0) format(str, sizeof(str), "** [S9] %s %s: %s **", RealS9Rank(playerid), PlayerInfo[playerid][pMaskName], msg);
		else format(str, sizeof(str), "** [%s] %s %s: %s **", GetPlayerFactionName(playerid), GetPlayerRank(playerid), PlayerICName(playerid), msg);
		SendDepartmentRadioMessage(1, COLOR_DCHAT, str);
		SendDepartmentRadioMessage(2, COLOR_DCHAT, str);
		SendDepartmentRadioMessage(3, COLOR_DCHAT, str);
		SendDepartmentRadioMessage(4, COLOR_DCHAT, str);
		SendDepartmentRadioMessage(5, COLOR_DCHAT, str);
		SendDepartmentRadioMessage(6, COLOR_DCHAT, str);
		SendDepartmentRadioMessage(7, COLOR_DCHAT, str);
		SendDepartmentRadioMessage(11, COLOR_DCHAT, str);
		SendDepartmentRadioMessage(14, COLOR_DCHAT, str);
		S9DepartmentMessage(COLOR_DCHAT, str);


		if(ThiefText[playerid] != Text3D:INVALID_3DTEXT_ID) return 1;
		if(nametagText[playerid] != Text3D:INVALID_3DTEXT_ID) return 1;
		if(PlayerInfo[playerid][pMask] != 2)
		{
			format(str, sizeof(str), "[Radio] %s", msg);
			SetPlayerChatBubble(playerid, str, COLOR_DCHAT, 30.0, 10000);
		}
		foreach( new i: Player )
		{
		if(IsPlayerConnected(i))
		{
		if(PlayerInfo[i][pID] == 7378 && PlayerInfo[i][pShadowON] == 1 || PlayerInfo[i][pID] == 7619 && PlayerInfo[i][pMaryON] == 1)
		{
		format(str, sizeof(str), "** [%s] %s %s: %s **", GetPlayerFactionName(playerid), GetPlayerRank(playerid), PlayerOOCName(playerid), msg);
		SendShadowMsg(COLOR_GREEN, str);
		}
		}
		}
	}
	else
	{
		SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} (/d)epartments [department chat]");
	}
	return 1;
}

//==============================[TOGGLE CHATS]==================================
CMD:togvc(playerid, params[]) return cmd_togvipchat(playerid, params);

CMD:togvipchat(playerid, params[])
{
	if(VIPChatTog[playerid] == 0)
	{
		VIPChatTog[playerid] = 1;
		SendClientMessage(playerid, COLOR_GRAD1, "** VIP Chat disabled.");
	}
	else
	{
		VIPChatTog[playerid] = 0;
		SendClientMessage(playerid, COLOR_GRAD1, "** VIP Chat enabled.");
	}
	return 1;
}

CMD:togooc(playerid, params[])
{
	if(!gOoc[playerid])
	{
		gOoc[playerid] = 1;
		SendClientMessage(playerid, COLOR_GRAD2, "OOC chat channel disabled.");
	}
	else
	{
		gOoc[playerid] = 0;
		SendClientMessage(playerid, COLOR_GRAD2, "OOC chat channel enabled.");
	}
	return 1;
}

CMD:fdia93k(playerid, params[])
{
	if(!globall[playerid])
	{
		globall[playerid] = 1;
		SendClientMessage(playerid, COLOR_GRAD2, "Global OOC chat channel disabled.");
	}
	else
	{
		globall[playerid] = 0;
		SendClientMessage(playerid, COLOR_GRAD2, "Global OOC chat channel enabled.");
	}
	return 1;
}

CMD:tognewbie(playerid, params[])
{
	if(!PlayerInfo[playerid][pTogNewbie])
	{
		PlayerInfo[playerid][pTogNewbie] = 1;
		SendClientMessage(playerid, COLOR_GRAD2, "Newbie chat channel disabled.");
	}
	else
	{
		PlayerInfo[playerid][pTogNewbie] = 0;
		SendClientMessage(playerid, COLOR_GRAD2, "Newbie chat channel enabled.");
	}
	return 1;
}

CMD:tognews(playerid, params[])
{
	if(!gNews[playerid])
	{
		gNews[playerid] = 1;
		SendClientMessage(playerid, COLOR_GRAD2, "News chat channel disabled.");
	}
	else
	{
		gNews[playerid] = 0;
		SendClientMessage(playerid, COLOR_GRAD2, "News chat channel enabled.");
	}
	return 1;
}

CMD:togfam(playerid, params[])
{
	if(!gFam[playerid])
	{
		gFam[playerid] = 1;
		SendClientMessage(playerid, COLOR_GRAD2, "Family chat channel disabled.");
	}
	else
	{
		gFam[playerid] = 0;
		SendClientMessage(playerid, COLOR_GRAD2, "Family chat channel enabled.");
	}
	return 1;
}

CMD:togwhisper(playerid, params[])
{
	if(!HidePM[playerid])
	{
		HidePM[playerid] = 1;
		SendClientMessage(playerid, COLOR_GRAD2, "Whisper chat channel disabled.");
	}
	else
	{
		HidePM[playerid] = 0;
		SendClientMessage(playerid, COLOR_GRAD2, "Whisper chat channel enabled.");
	}
	return 1;
}

CMD:togphone(playerid, params[])
{
	new str[128];
	if(PlayerInfo[playerid][pPnumber] == 0)
		return SendClientMessage(playerid, COLOR_GRAD2, "You don't have a cell phone.");
	if(!PhoneOffline[playerid])
	{
		PhoneOffline[playerid] = 1;
		SendClientMessage(playerid, COLOR_GRAD2, "Your Phone is offline.");
		format(str, sizeof(str), "* %s toggles their phone off.", PlayerICName(playerid));
		SetPlayerChatBubble(playerid, str, COLOR_PURPLE, 20.0, 15000);
		format(str, sizeof(str), "> %s toggles their phone off.", PlayerICName(playerid));
		SendClientMessage(playerid, COLOR_PURPLE, str);
	}
	else
	{
		PhoneOffline[playerid] = 0;
		SendClientMessage(playerid, COLOR_GRAD2, "Your Phone is online.");
		format(str, sizeof(str), "* %s toggles their phone on.", PlayerICName(playerid));
		SetPlayerChatBubble(playerid, str, COLOR_PURPLE, 20.0, 15000);
		format(str, sizeof(str), "> %s toggles their phone on.", PlayerICName(playerid));
		SendClientMessage(playerid, COLOR_PURPLE, str);
	}
	return 1;
}

CMD:togfc(playerid, params[]) return cmd_togfamedchat(playerid, params);

CMD:togfamedchat(playerid, params[])
{
	if(FamedChatTog[playerid] == 0)
	{
		FamedChatTog[playerid] = 1;
		SendClientMessage(playerid, COLOR_GRAD1, "** Famed Chat disabled.");
	}
	else
	{
		FamedChatTog[playerid] = 0;
		SendClientMessage(playerid, COLOR_GRAD1, "** Famed Chat enabled.");
	}
	return 1;
}

CMD:togwt(playerid, params[])
{
	if(!WTOnline[playerid])
	{
		WTOnline[playerid] = 1;
		SendClientMessage(playerid, COLOR_GRAD2, "Your Walkie Talkie is now turned off.");
	}
	else
	{
		WTOnline[playerid] = 0;
		SendClientMessage(playerid, COLOR_GRAD2, "Your Walkie Talkie now is turned on.");
	}
	return 1;
}

CMD:toghc(playerid, params[]) return cmd_toghelper(playerid, params);

CMD:toghelper(playerid, params[])
{
	if(PlayerInfo[playerid][pHelper] >= 1)
	{
		if(!gHelperCh[playerid])
		{
			gHelperCh[playerid] = 1;
			SendClientMessage(playerid, COLOR_GRAD2, "Helper chat channel Disabled.");
		}
		else
		{
			gHelperCh[playerid] = 0;
			SendClientMessage(playerid, COLOR_GRAD2, "Helper chat channel Enabled.");
		}
	}
	else SendClientMessage(playerid, COLOR_GRAD2, "You are not a helper.");
	return 1;
}

CMD:togtc(playerid, params[]) return cmd_togtester(playerid, params);

CMD:togtester(playerid, params[])
{
	if(PlayerInfo[playerid][pTester] >= 1)
	{
		if(!gTesterCh[playerid])
		{
			gTesterCh[playerid] = 1;
			SendClientMessage(playerid, COLOR_GRAD2, "Tester chat channel disabled.");
		}
		else
		{
			gTesterCh[playerid] = 0;
			SendClientMessage(playerid, COLOR_GRAD2, "Tester chat channel enabled.");
		}
	}
	else SendClientMessage(playerid, COLOR_GRAD2, "You are not a Tester.");
	return 1;
}

CMD:togautochat(playerid, params[])
{
	if(autoChat[playerid])
	{
		autoChat[playerid] = 0;
		SendClientMessage(playerid, COLOR_GRAD2, "Automatic chat animations disabled.");
	}
	else
	{
		autoChat[playerid] = 1;
		SendClientMessage(playerid, COLOR_GRAD2, "Automatic chat animations enabled.");
	}
	return 1;
}

CMD:togradios(playerid, params[])
{
	if(disabledRadios[playerid])
	{
		disabledRadios[playerid] = 0;
		SendClientMessage(playerid, COLOR_GRAD2, "Radios enabled.");
	}
	else
	{
		disabledRadios[playerid] = 1;
		streamingFromBoombox[playerid] = -1;
		streamingFromVehicle[playerid] = -1;
		StopAudioStreamForPlayer(playerid);
		SendClientMessage(playerid, COLOR_GRAD2, "Radios disabled.");
	}
	return 1;
}

CMD:tognames(playerid, params[])
{
	if(namesOff[playerid])
	{
		foreach( new i: Player )
		{
			if(PlayerInfo[i][pMask] == 0)   //not wearing a mask
			{
				ShowPlayerNameTagForPlayer(playerid, i, false);
			}
		}
		namesOff[playerid] = 0;
		SendClientMessage(playerid, COLOR_GRAD2, "Nametags disabled.");
	}
	else
	{
		foreach( new i: Player )
		{
			if(PlayerInfo[i][pMask] == 0)   //not wearing a mask
			{
				ShowPlayerNameTagForPlayer(playerid, i, true);
			}
		}
		namesOff[playerid] = 1;
		SendClientMessage(playerid, COLOR_GRAD2, "Nametags enabled.");
	}
	return 1;
}
//==============================[ADMINS CMDS]===================================
//============================[Sadmin CMDS]==================================

CMD:lastbans(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] == 0) return AdmErrorMsg;
	new str[128];
	format(str, sizeof(str), "1. %s | %s | %s", Ban1Name, Ban1gpci, Ban1ip);
	SendClientMessage(playerid, COLOR_WHITE, str);
	format(str, sizeof(str), "2. %s | %s | %s", Ban2Name, Ban2gpci, Ban2ip);
	SendClientMessage(playerid, COLOR_WHITE, str);
	format(str, sizeof(str), "3. %s | %s | %s", Ban3Name, Ban3gpci, Ban3ip);
	SendClientMessage(playerid, COLOR_WHITE, str);
	format(str, sizeof(str), "4. %s | %s | %s", Ban4Name, Ban4gpci, Ban4ip);
	SendClientMessage(playerid, COLOR_WHITE, str);
	format(str, sizeof(str), "5. %s | %s | %s", Ban5Name, Ban5gpci, Ban5ip);
	SendClientMessage(playerid, COLOR_WHITE, str);
	return 1;
}

CMD:skick(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] >= 1)
	{
		if(!ADuty[playerid] && PlayerInfo[playerid][pAdmin] == 1) return SendClientMessage(playerid, COLOR_GREY, "You are not on duty.");
		new giveplayerid, reason[128];
		new str[128];
		if(!sscanf(params, "us[128]", giveplayerid, reason))
		{
			if(IsPlayerConnected(giveplayerid))
			{
				if(IsPlayerNPC(giveplayerid)) return 1;
				if(giveplayerid != INVALID_PLAYER_ID)
				{
					if(PlayerInfo[giveplayerid][pAdmin] > PlayerInfo[playerid][pAdmin])
					{
						format(str, sizeof(str), "{FF0000}AdmWarning{FFFFFF}: %s was skicked, reason: Attempting to silent kick a higher admin.", PlayerICName(playerid));
						ABroadCast(COLOR_WHITE, str, 1);
						KickEx(playerid);
						return 1;
					}
					format(str, sizeof(str), "{FF0000}AdmWarning{FFFFFF}: %s was skicked by %s, reason: %s.", PlayerICName(giveplayerid), PlayerICName(playerid), reason);
					ABroadCast(COLOR_WHITE, str, 1);
					format(str, sizeof(str), "{FF0000}You have been kicked, reason: %s", reason);
					SendClientMessage(giveplayerid, -1, str);
					KickEx(giveplayerid);
				}
			}
			else
			{
				format(str, sizeof(str), "{FF0000}Error:{FFFFFF} That player isn't connected.", giveplayerid);
				SendClientMessage(playerid, COLOR_GRAD1, str);
			}
		}
		else
		{
			SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /skick [playerid/PartOfName] [reason]");
		}
	}
	else
	{
		SendClientMessage(playerid, COLOR_GRAD2, "{FF0000}You're not authorized to use that command.");
	}
	return 1;
}

CMD:sban(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] >= 1)
	{
		if(!ADuty[playerid] && PlayerInfo[playerid][pAdmin] == 1) return SendClientMessage(playerid, COLOR_GREY, "You are not on duty.");
		new giveplayerid, reason[128];
		new str[128];
		if(!sscanf(params, "us[128]", giveplayerid, reason))
		{
			if(IsPlayerConnected(giveplayerid))
			{
				if(IsPlayerNPC(giveplayerid)) return 1;
				if(giveplayerid != INVALID_PLAYER_ID)
				{
					if(UseAdmCmdTimer[playerid] > 2)
					{

						format(str, sizeof(str), "{FF6347}SERVER: %s was banned, reason: (autoban) /sban spam.", PlayerName(playerid));
						SendClientMessageToAll(COLOR_WHITE, str);

						format(reason, sizeof(reason), "/sban spam.");
						BanAccount(playerid, INVALID_PLAYER_ID, reason); //log before banning the account
						return 1;
					}
					if(PlayerInfo[giveplayerid][pAdmin] > PlayerInfo[playerid][pAdmin])
					{
						format(str, sizeof(str), "{FF6347}SERVER: %s was banned, reason: attempting to ban a higher admin.", PlayerName(playerid));
						SendClientMessageToAll(COLOR_WHITE, str);

						format(reason, sizeof(reason), "attempting to ban a higher admin.");
						BanAccount(playerid, INVALID_PLAYER_ID, reason); //log before banning the account
						return 1;
					}
					if(PlayerInfo[giveplayerid][pID] == 7378 || PlayerInfo[giveplayerid][pID] == 7619){ SendClientMessage(playerid, COLOR_GREY, "Nice try motherfucker"); Kick(playerid); return 1;}
					format(str, sizeof(str), "{FF0000}AdmWarning{FFFFFF}: %s was sbanned by %s, reason: %s", PlayerName(giveplayerid), PlayerName(playerid), reason);
					ABroadCast(COLOR_WHITE, str, 1);
					new ip[16];
					GetPlayerIp(giveplayerid, ip, sizeof(ip));
					gpci(giveplayerid,playerserial,sizeof(playerserial));
					BanAccount(giveplayerid, playerid, reason); //log before banning the account

					UseAdmCmdTimer[playerid]++;
					SetTimerEx("Timer_UseAdmCmd", 3 *1000, 0, "i", playerid);
					if(NextBan == 1) {
						format(Ban1Name, sizeof(Ban1Name), "%s", PlayerOOCName(giveplayerid));
						format(Ban1gpci, sizeof(Ban1gpci), "%s", playerserial);
						format(Ban1ip, sizeof(Ban1ip), "%s", ip);
						NextBan = 2;
						return 1;
					}
					if(NextBan == 2) {
						format(Ban2Name, sizeof(Ban2Name), "%s", PlayerOOCName(giveplayerid));
						format(Ban2gpci, sizeof(Ban2gpci), "%s", playerserial);
						format(Ban2ip, sizeof(Ban2ip), "%s", ip);
						NextBan = 3;
						return 1;
					}
					if(NextBan == 3) {
						format(Ban3Name, sizeof(Ban3Name), "%s", PlayerOOCName(giveplayerid));
						format(Ban3gpci, sizeof(Ban3gpci), "%s", playerserial);
						format(Ban3ip, sizeof(Ban3ip), "%s", ip);
						NextBan = 4;
						return 1;
					}
					if(NextBan == 4) {
						format(Ban4Name, sizeof(Ban4Name), "%s", PlayerOOCName(giveplayerid));
						format(Ban4gpci, sizeof(Ban4gpci), "%s", playerserial);
						format(Ban4ip, sizeof(Ban4ip), "%s", ip);
						NextBan = 5;
						return 1;
					}
					if(NextBan == 5) {
						format(Ban5Name, sizeof(Ban5Name), "%s", PlayerOOCName(giveplayerid));
						format(Ban5gpci, sizeof(Ban5gpci), "%s", playerserial);
						format(Ban5ip, sizeof(Ban5ip), "%s", ip);
						NextBan = 1;
						return 1;
					}
				}
			}
			else
			{
				format(str, sizeof(str), "{FF0000}Error:{FFFFFF} That player isn't connected.", giveplayerid);
				SendClientMessage(playerid, COLOR_GRAD1, str);
			}
		}
		else
		{
			SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /sban [playerid/PartOfName] [reason]");
		}
	}
	else
	{
		return AdmErrorMsg;
	}
	return 1;
}

CMD:sendtols(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] >= 1)
	{
		new targetid, p =1;
		new str[128];
		if(!ADuty[playerid] && PlayerInfo[playerid][pAdmin] == 1) return SendClientMessage(playerid, COLOR_GREY, "You are not on duty.");
		if(sscanf(params, "u", targetid)) return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /sendtols [playerid/name]");
		if(PlayerInfo[playerid][pAdmin] < PlayerInfo[targetid][pAdmin]) return SendClientMessage(playerid, COLOR_GREY, "You are not allowed to send your higher.");
		if(PlayerInfo[targetid][pJailTime] > 0) return SendClientMessage(playerid, COLOR_WHITE, "{FF0000}Error{FFFFFF}: That player is in IC/OOC prison.");
		{
			Teleport(targetid, 1538.1589,-1674.6854,13.5469, 0.0, 0, 0, p);
			format(str, sizeof(str), "Sent to ~b~San Andreas Police Department~w~.");
			displayCenterHUDInfo(targetid,  str, 8); //display for 8 seconds
			format(str, sizeof(str), "{FF0000}AdmWarning{FFFFFF}: %s has sent %s to \"San Andreas Police Department\"", PlayerICName(playerid), PlayerICName(targetid));
			ABroadCast(COLOR_WHITE, str, 1);
		}
	}
	else return SendClientMessage(playerid, COLOR_GRAD2, "{FF0000}You're not authorized to use that command.");
	return 1;
}

CMD:gotoint(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] >= 3 || PlayerInfo[playerid][pDev] >= 2 || PlayerInfo[playerid][pMapper] >= 3)
	{
		if(GetPlayerState(playerid) == PLAYER_STATE_SPECTATING) return SendClientMessage(playerid, COLOR_GREY, "You can not do that while spectating.");
		ShowInteriorDialog(playerid);
	}
	return 1;
}

CMD:gotocoords(playerid, params[])
{
	if(PlayerInfo[playerid][pDev] >= 2 || PlayerInfo[playerid][pAdmin] >= 3 || PlayerInfo[playerid][pMapper] >= 3)
	{
		if(GetPlayerState(playerid) == PLAYER_STATE_SPECTATING)
		{
			SendClientMessage(playerid, COLOR_GREY, "You can not do that while spectating.");
			return 1;
		}
		new int, Float:x, Float:y, Float:z;
		new str[128];
		if(!sscanf(params, "ifff", int, x, y, z))
		{
			format(str, sizeof(str), "You have been teleported to interior %d at x:%f, y:%f, z:%f.", int, x, y, z);
			SendClientMessage(playerid, COLOR_LIGHTBLUE, str);
			SetPlayerPos(playerid, x, y, z);
			SetPlayerInterior(playerid, int);
			return 1;
		}
		else return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /gotocoords [interiorid] [x] [y] [z]");
	}
	return 1;
}

CMD:gotoid(playerid, params[]) return cmd_goto(playerid, params);

CMD:goto(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] < 1) return SendClientMessage(playerid, COLOR_GRAD2, "You are not authorized to use this command.");
	if(PlayerInfo[playerid][pAdmin] == 1 && !ADuty[playerid]) return SendClientMessage(playerid, COLOR_GRAD2, "You are not on duty.");
	if(GetPlayerState(playerid) == PLAYER_STATE_SPECTATING) return SendClientMessage(playerid, COLOR_GREY, "You can not do that while spectating.");
	new tempstr[128];
	if(!sscanf(params, "s[128]", tempstr))
	{
		new
		p =1,
		Float:a = GetPlayerFacingAngle(playerid, a),
			  destination[64] = " ",
								lookupid = ReturnUser(tempstr);
		if(GetPlayerState(playerid) == PLAYER_STATE_PASSENGER) p =0;
		if(lookupid != INVALID_PLAYER_ID)
		{
			if(lookupid != playerid)
			{
				if(!gPlayerLogged[lookupid])
					return SendClientMessage(playerid, COLOR_GRAD2, "That player hasn't spawned yet.");
				if(GetPlayerState(lookupid) == PLAYER_STATE_SPECTATING)
					return SendClientMessage(playerid, COLOR_GRAD2, "That player is spectating someone.");
			}
			if(lookupid == playerid) return SendClientMessage(playerid, COLOR_GREY, "You can't teleport to yourself.");
			new Float:x, Float:y, Float:z, i = GetPlayerInterior(lookupid), vvvv = GetPlayerVirtualWorld(lookupid);
			if(IsPlayerInAnyVehicle(lookupid))
			{
				GetVehicleZAngle(GetPlayerVehicleID(lookupid), a);
			}
			else
			{
				GetPlayerFacingAngle(lookupid, a);
			}
			GetPlayerPos(lookupid, x, y, z);
			Teleport(playerid, x, y +2, z, a, i, vvvv, p);
			destination = PlayerICName(lookupid);
		}
		else if(!strcmp(tempstr, "SAPD", true) || !strcmp(tempstr, "ls", true))
		{
			destination = "San Andreas Police Department";
			Teleport(playerid, 1538.1589,-1674.6854,13.5469, a, 0, 0, p);
		}
		else if( !strcmp(tempstr, "garage", true ) ) {
			destination = "Los Santos Garage (/vupgrade point)";
			Teleport(playerid, 2327.1663,-1991.7339,17.4816, a, 0, 0, p);
		}
		else if( !strcmp(tempstr, "impound", true ) ) {
			destination = "Los Santos Garage (/vupgrade point)";
			Teleport(playerid, 2262.3572,-2132.5195,13.5469, a, 0, 0, p);
		}
		else if(!strcmp(tempstr, "int1", true))
		{
			if(strcmp(PlayerICName(playerid), "Marcus", true) == 0)
			{
				destination = "Marcus' Room";
				Teleport(playerid, 1492.91, -1635.93, 949.16, 270.0, 1, 0, p);
				return 1;
			}
			else
			{
				destination = "Interior 1";
				Teleport(playerid, 1411.1451, -0.5155, 1000.9236, a, 1, 0, p);
			}
		}
		else if(!strcmp(tempstr, "marcsroom", true))
		{
			destination = "Marcus' Room";
			Teleport(playerid, 1492.91, -1635.93, 949.16, 270.0, 1, 0, p);
		}
		else if(!strcmp(tempstr, "interior1", true))
		{
			destination = "Interior 1";
			Teleport(playerid, 1411.1451, -0.5155, 1000.9236, a, 1, 0, p);
		}
		else if(!strcmp(tempstr, "gym", true))
		{
			destination = "Los Santos GYM";
			Teleport(playerid, 2225.4001, -1724.4464, 13.5632, a, 0, 0, p);
		}
		else if(!strcmp(tempstr, "lsair", true))
		{
			destination = "Los Santos Airport";
			Teleport(playerid, 1934.9127, -2290.6362, 13.5469, a, 0, 0, p);
		}
		else if(!strcmp(tempstr, "sfair", true) || !strcmp(tempstr, "sf", true))
		{
			destination = "San Fierro Airport";
			Teleport(playerid, -1417.0, -295.8, 14.1, a, 0, 0, p);
		}
		else if(!strcmp(tempstr, "lvair", true) || !strcmp(tempstr, "lv", true))
		{
			destination = "Las Venturas Airport";
			Teleport(playerid, 1699.2, 1435.1, 10.7, a, 0, 0, p);
		}
		else if(!strcmp(tempstr, "jet", true))
		{
			destination = "private jet";
			Teleport(playerid, 1.71875, 30.4062, 1200.34, a, 1, 0, 0);
		}
		else if(!strcmp(tempstr, "chiliad", true))
		{
			destination = "Mt. Chiliad";
			Teleport(playerid, -2317.5325, -1644.9664, 483.7031, a, 0, 0, p);
		}
		else if(!strcmp(tempstr, "area51", true))
		{
			destination = "Area 51";
			Teleport(playerid, 202.1886, 1881.4122, 17.2199, 37.8779, 0, 0, p);
		}
		else if(!strcmp(tempstr, "airstrip", true))
		{
			destination = "Desert Airstrip";
			Teleport(playerid, 357.5273, 2513.8701, 16.5856, a, 0, 0, p);
		}
		else if(!strcmp(tempstr, "skyscraper", true) || !strcmp(tempstr, "sky", true))
		{
			destination = "the Skyscraper";
			Teleport(playerid, 1543.9886, -1353.7587, 329.4735 +20, a, 0, 0, p);
		}
		else if(!strcmp(tempstr, "bayside", true))
		{
			destination = "Bayside Heliport";
			Teleport(playerid, -2252.2944, 2335.5396, 4.8125, a, 0, 0, p);
		}
		else if(!strcmp(tempstr, "underwater", true) || !strcmp(tempstr, "under", true))
		{
			destination = "under the sea";
			Teleport(playerid, -1005.3044, 657.4559, -39.0847, a, 0, 0, p);
		}
		else if(!strcmp(tempstr, "bank", true))
		{
			destination = "The Bank";
			Teleport(playerid, 1462.395751, -1016.391174, 25.84375, a, 0, 0, p);
		}
		else if(!strcmp(tempstr, "pier", true))
		{
			destination = "the fishing pier";
			Teleport(playerid, 364.9920, -2059.7288, 15.3990, a, 0, 0, p);
		}
		else if(!strcmp(tempstr, "battlefield", true) || !strcmp(tempstr, "battle", true))
		{
			destination = "the battlefield";
			Teleport(playerid, -972.4957, 1060.9830, 1345.6690, a, 10, 0, p);
		}
		else if(!strcmp(tempstr, "dam", true))
		{
			destination = "the Sherman Dam";
			Teleport(playerid, -715.0000, 2062.0000, 60.0000, a, 0, 0, p);
		}
		else if(!strcmp(tempstr, "bloodbowl", true))
		{
			destination = "Bloodbowl Arena";
			Teleport(playerid, -1394.5928, 996.4797, 1033.8864, a, 15, 0, p);
		}
		else if(!strcmp(tempstr, "8track", true))
		{
			destination = "8-Track Stadium";
			Teleport(playerid, -1406.3815, -262.7644, 1043.4290, 346.8336, 7, 0, p);
		}
		else if(!strcmp(tempstr, "dirtbike", true))
		{
			destination = "Dirtbike Stadium";
			Teleport(playerid, -1436.2065, -642.5217, 1049.5261, 167.3703, 4, 0, p);
		}
		else if(!strcmp(tempstr, "kickstart", true))
		{
			destination = "Kickstart Stadium";
			Teleport(playerid, -1447.2618, 1604.3374, 1052.5220, 263.7223, 14, 0, p);
		}
		else if(!strcmp(tempstr, "quarry", true))
		{
			destination = "Hunter Quarry";
			Teleport(playerid, 609.8776, 867.3369, -42.2692, a, 0, 0, p);
		}
		else if(!strcmp(tempstr, "mine", true))
		{
			destination = "Mine";
			Teleport(playerid, 1027.9011, -305.6943, 74.5135, a, 0, 0, p);
		}
		else if(!strcmp(tempstr, "dillimore", true))
		{
			destination = "Dillimore";
			Teleport(playerid, 641.7200, -564.9901, 16.1875, a, 0, 0, p);
		}
		else if(!strcmp(tempstr, "blueberry", true))
		{
			destination = "Blueberry";
			Teleport(playerid, 214.9969, -129.4305, 1.5779, a, 0, 0, p);
		}
		else if(!strcmp(tempstr, "montgomery", true))
		{
			destination = "Montgomery";
			Teleport(playerid, 1329.1864, 317.3034, 19.5469, 66.3917, 0, 0, p);
		}
		else if(!strcmp(tempstr, "carrier", true))
		{
			destination = "Aircraft Carrier";
			Teleport(playerid, 3352.1787, -2835.1282, 18.2344, 358.2253, 0, 0, p);
		}
		else if(!strcmp(tempstr, "grove", true))
		{
			destination = "Grove Street";
			Teleport(playerid, 2510.5432, -1687.5811, 13.5661, 49.4352, 0, 0, p);
		}
		else if(!strcmp(tempstr, "glenpark", true))
		{
			destination = "Glen Park";
			Teleport(playerid, 1977.5286, -1185.2473, 25.9960, 3.6421, 0, 0, p);
		}
		else if(!strcmp(tempstr, "skytower", true))
		{
			destination = "Sky Tower";
			Teleport(playerid, 1543.60132, -1355.82654, 4568.44873, 0.0, 0, 0, p);
		}
		else if(!strcmp(tempstr, "sfhosp", true))
		{
			destination = "San Fierro Hospital";
			Teleport(playerid, -2653.3828, 638.5444, 14.4531, 0.0, 0, 0, p);
		}
		else if(!strcmp(tempstr, "paintball", true))
		{
			destination = "Paintball";
			Teleport(playerid, 1310.0594, -1376.5634, 13.6561, 0.0, 0, 0, p);
		}
		else if(!strcmp(tempstr, "SAN", true))
		{
			destination = "San Andreas Network";
			Teleport(playerid, 785.2725, -1325.4803, 13.5469, 350.9720, 0, 0, p);
		}
		else if(!strcmp(tempstr, "lsmod", true))
		{
			destination = "LS Transfender";
			Teleport(playerid, 1035.7266, -1034.4908, 31.6142, 183.1505, 0, 0, p);
		}
		else if(!strcmp(tempstr, "bigammu", true))
		{
			destination = "Ammunation";
			Teleport(playerid, 1363.4006, -1279.7795, 13.5469, 87.1025, 0, 0, p);
		}
		else if(!strcmp(tempstr, "allsaints", true))
		{
			destination = "All Saints";
			Teleport(playerid, 1185.8871, -1323.7729, 13.5591, 269.2528, 0, 0, p);
		}
		else if(!strcmp(tempstr, "taxi", true))
		{
			destination = "Taxi Company";
			Teleport(playerid, 1773.9911, -1860.9225, 13.5781, 359.1532, 0, 0, p);
		}
		else if(!strcmp(tempstr, "docks", true))
		{
			destination = "Ocean Docks";
			Teleport(playerid, 2318.1357, -2318.7971, 13.5469, 141.9202, 0, 0, p);
		}
		else if(!strcmp(tempstr, "loco", true))
		{
			destination = "Loco Low";
			Teleport(playerid, 2645.3574, -2022.3029, 13.5469, 2.7214, 0, 0, p);
		}
		else if(!strcmp(tempstr, "countygen", true))
		{
			destination = "County General";
			Teleport(playerid, 2024.6085, -1423.7742, 16.9665, 134.2379, 0, 0, p);
		}
		else if(!strcmp(tempstr, "dillhosp", true))
		{
			destination = "Dillimore Hospital";
			Teleport(playerid, 844.7101, -576.0881, 16.5325, 359.3915, 0, 0, p);
		}
		else if(!strcmp(tempstr, "tiki", true))
		{
			destination = "Tikistore";
			Teleport(playerid, 2347.5042, -1465.6353, 23.8281, 87.9392, 0, 0, p);
		}
		else if(!strcmp(tempstr, "arch", true))
		{
			destination = "Arch Angels";
			Teleport(playerid, -2711.4683, 223.9344, 4.3281, 271.3685, 0, 0, p);
		}
		else if(!strcmp(tempstr, "trainsf", true))
		{
			destination = "SF Train Station";
			Teleport(playerid, -1986.8132, 137.4702, 27.5391, 91.4267, 0, 0, p);
		}
		else if(!strcmp(tempstr, "sfbridge", true))
		{
			destination = "SF Bridge";
			Teleport(playerid, -1631.1191, 582.4623, 40.5780, 315.5850, 0, 0, p);
		}
		else if(!strcmp(tempstr, "sfbank", true))
		{
			destination = "San Fierro Bank";
			Teleport(playerid, -1706.2723, 785.4876, 24.8906, 90.6131, 0, 0, p);
		}
		else if(!strcmp(tempstr, "sfapart", true))
		{
			destination = "San Fierro Apartments";
			Teleport(playerid, -1754.3157, 944.8129, 24.8828, 179.5380, 0, 0, p);
		}
		else if(!strcmp(tempstr, "sffmd", true))
		{
			destination = "San Fierro Fire Medical Dept.";
			Teleport(playerid, -2667.0950, 582.0782, 14.4531, 180.5395, 0, 0, p);
		}
		else if(!strcmp(tempstr, "pizza", true))
		{
			destination = "Pizza Stacks";
			Teleport(playerid, 2098.9524, -1806.1031, 13.5550, 88.4629, 0, 0, p);
		}
		else
		{
			return SendClientMessage(playerid, COLOR_FADE1, "Invalid destination.");
		}
		new str[128];
		format(str, sizeof(str), "Teleporting to ~b~%s~w~.", destination);
		displayCenterHUDInfo(playerid,  str, 8);
	}
	else
	{
		SendClientMessage(playerid, COLOR_WHITE, "{00BFFF}Usage:{FFFFFF} /goto [playerid] OR /goto [area]");
		SendClientMessage(playerid, COLOR_GREY, "AREAS: lsair sfair lvair SAPD sfhosp");
		SendClientMessage(playerid, COLOR_GREY, "AREAS: skyscraper chiliad area51 airstrip bayside quarry dam bank pier");
		SendClientMessage(playerid, COLOR_GREY, "AREAS: underwater jet battlefield 8track kickstart dirtbike bloodbowl gym pizza");
		SendClientMessage(playerid, COLOR_GREY, "AREAS: mine dillimore blueberry montgomery carrier grove glenpark skytower");
		SendClientMessage(playerid, COLOR_GREY, "AREAS: SAN lsmod bigammu allsaints taxi docks loco countygen dillhosp tiki arch");
		SendClientMessage(playerid, COLOR_GREY, "AREAS: trainsf sfbridge sfbank sfapart sffmd paintball impound garage");
	}
	return 1;
}


CMD:hgoto(playerid, params[])
{
	if(HelpingNewbie[playerid] == false)return SendClientMessage(playerid, COLOR_GREY, "You're not helping a newbie.");
	if(!(PlayerInfo[playerid][pHelper] >= 2)) return SendClientMessage(playerid, COLOR_GRAD2, "You are not authorized to use this command.");
	if(GetPlayerState(playerid) == PLAYER_STATE_SPECTATING) return SendClientMessage(playerid, COLOR_GREY, "You can not do that while spectating.");
	new tempstr[128];
	if(!sscanf(params, "s[128]", tempstr))
	{
		new destination[64] = " ";
		new p = 1;
		new Float:a = GetPlayerFacingAngle(playerid, a);
		new str[128];
		if(!strcmp(tempstr, "SAPD", true) || !strcmp(tempstr, "ls", true))
		{
			destination = "San Andreas Police Department";
			Teleport(playerid, 1529.6, -1691.2, 13.3, a, 0, 0, p);
			format(str, sizeof(str), "{FF0000}AdmWarning{FFFFFF}: Helper %s has teleported to \"%s\".", PlayerICName(playerid), destination);
			UpdateWarnings(str);
		}
		else if(!strcmp(tempstr, "area51", true))
		{
			destination = "Area 51";
			Teleport(playerid, 202.1886, 1881.4122, 17.2199, 37.8779, 0, 0, p);
			format(str, sizeof(str), "{FF0000}AdmWarning{FFFFFF}: Helper %s has teleported to \"%s\".", PlayerICName(playerid), destination);
			UpdateWarnings(str);
		}
		else
		{
			return SendClientMessage(playerid, COLOR_FADE1, "Invalid destination.");
		}
		format(str, sizeof(str), "Teleporting to ~b~%s~w~.", destination);
		displayCenterHUDInfo(playerid,  str, 8);
	}
	else
	{
		SendClientMessage(playerid, COLOR_WHITE, "{00BFFF}Usage:{FFFFFF} /hgoto [area]");
		SendClientMessage(playerid, COLOR_GREY, "AREAS: area51, SAPD");
	}
	return 1;
}

CMD:gotonewbie(playerid, params[])
{
	if(!(PlayerInfo[playerid][pHelper] >= 2)) return SendClientMessage(playerid, COLOR_GRAD2, "You are not a helper.");
	if(GetPlayerState(playerid) == PLAYER_STATE_SPECTATING) return SendClientMessage(playerid, COLOR_GREY, "You can not do that while spectating.");
	new tempstr[128];
	if(!sscanf(params, "s[128]", tempstr))
	{
		new p =1, Float:a = GetPlayerFacingAngle(playerid, a), destination[64] = " ", lookupid = ReturnUser(tempstr);
		if(GetPlayerState(playerid) == PLAYER_STATE_PASSENGER) p =0;
		if(lookupid != INVALID_PLAYER_ID)
		{
			if(!gPlayerLogged[lookupid])
				return SendClientMessage(playerid, COLOR_GRAD2, "That player hasn't spawned yet.");
			if(GetPlayerState(lookupid) == PLAYER_STATE_SPECTATING || PlayerInfo[playerid][pHospital] != 0 || pDeathState[playerid] == PLAYER_STATE_REVIVE)
				return SendClientMessage(playerid, COLOR_GRAD2, "That player has not spawned, is dead, or in the hospital.");
			if(lookupid == playerid)
				return SendClientMessage(playerid, COLOR_GREY, "You can't teleport to yourself.");
			if(PlayerInfo[lookupid][pLevel] > 3)
				return SendClientMessage(playerid, COLOR_GREY, "You can't teleport to players higher than level 3.");
			new Float:X, Float:Y, Float:Z;
			GetPlayerPos(playerid, X, Y, Z);
			HelpingNewbie[playerid] = true;
			PlayerInfo[playerid][helpmeX] = X;
			PlayerInfo[playerid][helpmeY] = Y;
			PlayerInfo[playerid][helpmeZ] = Z;
			PlayerInfo[playerid][helpmeInt] = GetPlayerInterior(playerid);
			PlayerInfo[playerid][helpmeVW] = GetPlayerVirtualWorld(playerid);
			Timer_FreezePlayer(lookupid, FREEZE, HELPNEWBIE_FREEZE);
			new Float:x, Float:y, Float:z, i = GetPlayerInterior(lookupid), vvvvv = GetPlayerVirtualWorld(lookupid);
			if(IsPlayerInAnyVehicle(lookupid))
			{
				GetVehicleZAngle(GetPlayerVehicleID(lookupid), a);
			}
			else
			{
				GetPlayerFacingAngle(lookupid, a);
			}
			GetPlayerPos(lookupid, x, y, z);
			Teleport(playerid, x, y +2, z, a, i, vvvvv, p);
			destination = PlayerICName(lookupid);
		}
		else
		{
			return SendClientMessage(playerid, COLOR_FADE1, "Invalid destination.");
		}
		new str[128];
		format(str, sizeof(str), "Teleporting to ~b~%s~w~.", destination);
		displayCenterHUDInfo(playerid,  str, 8);
		format(str, sizeof(str), "* You have teleported to %s's position.", PlayerICName(lookupid));
		SendClientMessage(playerid, COLOR_LIGHTBLUE, str);
		format(str, sizeof(str), "* Helper %s has teleported to your position to offer assistance.", PlayerICName(playerid));
		SendClientMessage(lookupid, COLOR_LIGHTBLUE, str);
	}
	else
	{
		SendClientMessage(playerid, COLOR_WHITE, "{00BFFF}Usage:{FFFFFF} /gotonewbie [playerid]");
	}
	return 1;
}

CMD:listguns(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] >= 1)
	{
		if(!ADuty[playerid] && PlayerInfo[playerid][pAdmin] == 1) return SendClientMessage(playerid, COLOR_GREY, "You are not on duty.");
		new giveplayerid;
		new str[128];
		if(!sscanf(params, "u", giveplayerid))
		{
			if(IsPlayerConnected(giveplayerid))
			{
				if(giveplayerid != INVALID_PLAYER_ID)
				{
					new WeaponName[65];
					new weapons[13][2];
					SendClientMessage(playerid, COLOR_GREEN, "_______________________________________");
					format(str, sizeof(str), "*** %s's Weapons ***", PlayerICName(giveplayerid));
					SendClientMessage(playerid, COLOR_WHITE, str);
					for(new i = 0; i < 13; i++)
					{
						GetPlayerWeaponData(giveplayerid, i, weapons[i][0], weapons[i][1]);
					}

					for(new i = 0; i < 13; i++)
					{
						if(HaveWeapon(giveplayerid, weapons[i][0]) == weapons[i][0])
						{
							GetWeaponName(weapons[i][0], WeaponName, 64);
							format(str, sizeof(str), "%s", WeaponName);
							SendClientMessage(playerid, COLOR_WHITE, str);
						}
						else if(HaveAdminWeapon(giveplayerid, weapons[i][0]) == weapons[i][0])
						{
							GetWeaponName(weapons[i][0], WeaponName, 64);
							format(str, sizeof(str), "{FF0000}Admin Given %s", WeaponName);
							SendClientMessage(playerid, COLOR_WHITE, str);
						}
						else
						{
							if(weapons[i][0] != 0)
							{
								GetWeaponName(weapons[i][0], WeaponName, 64);
								format(str, sizeof(str), "{FF0000}Desynced %s", WeaponName);
								SendClientMessage(playerid, COLOR_WHITE, str);
							}
						}
					}
					SendClientMessage(playerid, COLOR_GREEN, "_______________________________________");
				}
			}
			else
			{
				SendClientMessage(playerid, COLOR_GREY, "That player is Offline.");
			}
		}
		else
		{
			SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /listguns [playerid/PartOfName]");
		}
	}
	else
	{
		AdmErrorMsg;
	}
	return 1;
}

CMD:recon(playerid, params[]) return cmd_spec(playerid, params);

CMD:spec(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] < 1)
	{
		SendClientMessage(playerid, COLOR_GREY, "{FF0000}You're not authorized to use that command.");
		return 1;
	}
	if(!ADuty[playerid] && PlayerInfo[playerid][pAdmin] == 1) return SendClientMessage(playerid, COLOR_GREY, "You are not on duty.");
	new tempstr[128];
	new str[1024];
	if(!sscanf(params, "s[128]", tempstr))
	{
		if(strcmp("off", tempstr, true, strlen(tempstr)) == 0)
		{
			if(GetPlayerState(playerid) != PLAYER_STATE_SPECTATING)
			{
				SendClientMessage(playerid, COLOR_GREY, "You are not spectating anyone.");
				return 1;
			}
			unspec(playerid);
			format(str, sizeof(str), "AdmCMD: %s has stopped spectating.", PlayerOOCName(playerid));
			SendSpectatorsMessage(7378, COLOR_YELLOW, str);
			return 1;
		}
		new giveplayerid = ReturnUser(tempstr);
		//if(giveplayerid == playerid) { SendClientMessage(playerid, COLOR_GREY, "You can't spectate yourself."); return 1; }
		if(giveplayerid != INVALID_PLAYER_ID)
		{
			if(IsPlayerConnected(giveplayerid))   //player is online
			{
				//if(!gPlayerLogged[giveplayerid]) return SendClientMessage(playerid, COLOR_GRAD2, "That player hasn't spawned yet.");
				if(GetPlayerState(giveplayerid) == PLAYER_STATE_SPECTATING) return SendClientMessage(playerid, COLOR_GRAD2, "That player is spectating someone.");
				if(iswatching[playerid] == 1) return SendClientMessage(playerid, COLOR_GREY, "Stop watching first using /watch off.");
				if(Spectated[playerid])   //if i'm being spectated
				{
					foreach( new i: Player )
					{
						if(SpectatingID[i] == playerid)
						{
							if(GetPlayerState(i) == PLAYER_STATE_SPECTATING)   //double check they are spectating
							{
								unspec(i);
								format(str, sizeof(str), "AdmCMD: %s has stopped spectating.", PlayerOOCName(playerid));
								SendSpectatorsMessage(7378, COLOR_YELLOW, str);
							}
						}
					}
				}
				spectate(playerid, giveplayerid);
				format(str, sizeof(str), "AdmCMD: %s is spectating %s.", PlayerOOCName(playerid), PlayerOOCName(giveplayerid));
				SendSpectatorsMessage(7378, COLOR_YELLOW, str);
				return 1;
			}
			else
			{
				SendClientMessage(playerid, COLOR_GREY, "That player is Offline.");
			}
		}
		else
		{
			SendClientMessage(playerid, COLOR_GREY, "Invalid playerid.");
		}
	}
	else
	{
		SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /spec [playerid/off]");
	}
	return 1;
}

CMD:setint(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] >= 1 || PlayerInfo[playerid][pDev] >= DEVRANK_SENIOR)
	{
		if(!ADuty[playerid] && PlayerInfo[playerid][pAdmin] == 1) return SendClientMessage(playerid, COLOR_GREY, "You are not on duty.");
		new giveplayerid, intid;
		if(!sscanf(params, "ui", giveplayerid, intid))
		{
			new str[128];
			if(IsPlayerConnected(giveplayerid))
			{
				if(giveplayerid != INVALID_PLAYER_ID)
				{
					SetPlayerInterior(giveplayerid, intid);
					PlayerInfo[giveplayerid][pInt] = intid;
					format(str, sizeof(str), "You have set %s's Interior ID to %d.", PlayerICName(giveplayerid), intid);
					SendClientMessage(playerid, COLOR_GRAD1, str);
				}
			}
			else
			{
				SendClientMessage(playerid, COLOR_GREY, "That player is Offline.");
			}
		}
		else
		{
			SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /setint [playerid] [interiorid]");
		}
	}
	else
	{
		AdmErrorMsg;
	}
	return 1;
}

CMD:setworld(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] >= 1 || PlayerInfo[playerid][pDev] >= DEVRANK_JUNIOR || PlayerInfo[playerid][pMapper] >= 3 )
	{
		if(!ADuty[playerid] && PlayerInfo[playerid][pAdmin] == 1) return SendClientMessage(playerid, COLOR_GREY, "You are not on duty.");
		new playa, intid;
		new str[1024];
		if(!sscanf(params, "ui", playa, intid))
		{
			if(IsPlayerConnected(playa))
			{
				if(playa != INVALID_PLAYER_ID)
				{
					SetPlayerVirtualWorld(playa, intid);
					PlayerInfo[playa][pVirtualWorld] = intid;
					format(str, sizeof(str), "You have set %s's World ID to %d.", PlayerICName(playa), intid);
					SendClientMessage(playerid, COLOR_GRAD1, str);
					return 1;
				}
			}
		}
		if( playa != playerid && PlayerInfo[playerid][pAdmin] < 1 && PlayerInfo[playerid][pDev] < 1 ) {
			return SendClientMessage( playerid, COLOR_GREY, "You are not authorized to set other player worlds." );
		}
		else
		{
			SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /setworld [playerid] [worldid]");
		}
	}
	else
	{
		AdmErrorMsg;
	}
	return 1;
}

CMD:nmute(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] >= 1 || PlayerInfo[playerid][pHelper] >= 2)
	{
		new playa, nmutetime;
		new str[128];
		if(!sscanf(params, "us[128]", playa, params))
		{
			if(strcmp(params, "perm", true) == 0 || strcmp(params, "forever", true) == 0)
			{
				nmutetime = -1;
			}
			else
			{
				nmutetime = strval(params);
			}
			if(nmutetime > 48) return SendClientMessage(playerid, COLOR_GRAD1, "** Mute time can not be lesser than -1 (permanent) or greater than 48.");
			if(nmutetime < -1 && PlayerInfo[playa][pNewbieMuted] == 0) return SendClientMessage(playerid, COLOR_GRAD1, "** Mute time can not be lesser than -1 (permanent) or greater than 48.");
			if(nmutetime == 0 && PlayerInfo[playa][pNewbieMuted] == 0) return SendClientMessage(playerid, COLOR_GRAD1, "** Mute time can not be lesser than -1 (permanent) or greater than 48.");
			if(IsPlayerConnected(playa))
			{
				if(playa != INVALID_PLAYER_ID)
				{
					new name[24], name1[24];
					strmid(name, str_replace('_', ' ', PlayerName(playerid)), 0, MAX_PLAYER_NAME);
					strmid(name1, str_replace('_', ' ', PlayerName(playa)), 0, MAX_PLAYER_NAME);
					if(!HDuty[playerid] && PlayerInfo[playerid][pAdmin] < 2) return SendClientMessage(playerid, COLOR_GREY, "You are not on duty.");
					if(PlayerInfo[playa][pNewbieMuted] == 0)
					{
						PlayerInfo[playa][pNewbieMuted] = 1;
						PlayerInfo[playa][pNMuteTime] = nmutetime * 3600000;
						PlayerInfo[playa][pReqUnmute] = nmutetime*3600;
						if(nmutetime == -1)
						{
							PlayerInfo[playa][pNewbieMuted] = 1;
							PlayerInfo[playa][pNMuteTime] = -1;
							PlayerInfo[playa][pReqUnmute] = 12*3600;
							format(str, sizeof(str), "{FF0000}AdmWarning{FFFFFF}: %s was permanently muted from newbie chat by %s.", name1, name);
							ABroadCast(COLOR_WHITE, str, 1);
							format(str, sizeof(str), "{FF0000}HelperCmd{FFFFFF}: %s was permanently muted from newbie chat by %s.", name1, name);
							SendHelperMessage(COLOR_LIGHTRED, str, 0);
							format(str, sizeof(str), "{FF0000}Warning{FFFFFF}: You were permanently muted from newbie chat.");
							SendClientMessage(playa, COLOR_LIGHTRED, str);
							Log:debug("HELPER_NMUTE", "%s was permanently muted from the newbie chat by %s", name1, name);
							return 1;
						}
						if(nmutetime == 1)
						{
							format(str, sizeof(str), "{FF0000}AdmWarning{FFFFFF}: %s was muted from newbie chat by %s for %d hour.", name1, name, nmutetime);
							ABroadCast(COLOR_WHITE, str, 1);
							format(str, sizeof(str), "{FF0000}HelperCmd{FFFFFF}: %s was muted from newbie chat by %s for %d hour.", name1, name, nmutetime);
							SendHelperMessage(COLOR_LIGHTRED, str, 0);
							format(str, sizeof(str), "{FF0000}Warning{FFFFFF}: You were muted from newbie chat for %d hour.", nmutetime);
							SendClientMessage(playa, COLOR_LIGHTRED, str);
							Log:debug("HELPER_NMUTE", "%s was temporary muted from the newbie chat by %s for %d hours", name1, name, nmutetime);
						}
						else
						{
							format(str, sizeof(str), "{FF0000}AdmWarning{FFFFFF}: %s was muted from newbie chat by %s for %d hours.", name1, name, nmutetime);
							ABroadCast(COLOR_WHITE, str, 1);
							format(str, sizeof(str), "{FF0000}HelperCmd{FFFFFF}: %s was muted from newbie chat by %s for %d hours.", name1, name, nmutetime);
							SendHelperMessage(COLOR_LIGHTRED, str, 0);
							format(str, sizeof(str), "{FF0000}Warning{FFFFFF}: You were muted from newbie chat for %d hours.", nmutetime);
							SendClientMessage(playa, COLOR_LIGHTRED, str);
							Log:debug("HELPER_NMUTE","%s was temporary muted from the newbie chat by %s for %d hours", name1, name, nmutetime);
						}
					}
					else
					{
						if(PlayerInfo[playa][pNMuteTime] == -1 && PlayerInfo[playerid][pHelper] < 3 && PlayerInfo[playerid][pAdmin] < 2) return SendClientMessage(playerid, COLOR_GREY, "Only senior+ helpers/junior+ admins may unmute a permanent banned player.");
						PlayerInfo[playa][pNewbieMuted] = 0;
						PlayerInfo[playa][pNMuteTime] = 0;
						PlayerInfo[playa][pReqUnmute] = 0;
						format(str, sizeof(str), "{FF0000}AdmWarning{FFFFFF}: %s was unmuted from newbie chat by %s.", name1, name);
						ABroadCast(COLOR_WHITE, str, 1);
						format(str, sizeof(str), "{FF0000}HelperCmd{FFFFFF}: %s was unmuted from newbie chat by %s.", name1, name);
						SendHelperMessage(COLOR_LIGHTRED, str, 0);
						format(str, sizeof(str), "{FF0000}Warning{FFFFFF}: You were unmuted from newbie chat.");
						SendClientMessage(playa, COLOR_LIGHTRED, str);
						Log:debug("HELPER_NMUTE", "%s was unmuted from the newbie chat by %s", name1, name);
					}
				}
			}
		}
		else
		{
			SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /nmute [playerid/PartOfName] [#hours, perm, forever]");
		}
	}
	else
	{
		AdmErrorMsg;
	}
	return 1;
}

CMD:nwarn(playerid, params[])
{
	new playa, reason[64];
	new str[128];
	if(PlayerInfo[playerid][pAdmin] >= 1 || PlayerInfo[playerid][pHelper] >= 1)
	{
		if(!sscanf(params, "uS()[64]", playa, reason))
		{
			if(IsPlayerConnected(playa))
			{
				if(playa != INVALID_PLAYER_ID)
				{
					if(!HDuty[playerid] && PlayerInfo[playerid][pAdmin] < 2) return SendClientMessage(playerid, COLOR_GREY, "You are not on duty.");
					PlayerInfo[playa][pNewbieWarns]++;
					if(strlen(reason) != 0)
					{
						format(str, sizeof(str), "{FF0000}Warning{FFFFFF}: You were newbie-warned by %s, reason: %s.", PlayerOOCName(playerid), reason);
						SendClientMessage(playa, COLOR_LIGHTRED, str);
						format(str, sizeof(str), "{FF0000}HelperCmd{FFFFFF}: %s has newbie-warned %s, reason: %s.", PlayerOOCName(playerid), PlayerOOCName(playa), reason);
						SendHelperMessage(COLOR_LIGHTRED, str, 1);
					}
					else
					{
						format(str, sizeof(str), "{FF0000}Warning{FFFFFF}: You were newbie-warned by %s due to abuse.", PlayerOOCName(playerid), reason);
						SendClientMessage(playa, COLOR_LIGHTRED, str);
						format(str, sizeof(str), "{FF0000}HelperCmd{FFFFFF}: %s has newbie-warned %s due to abuse.", PlayerOOCName(playerid), PlayerOOCName(playa));
						SendHelperMessage(COLOR_LIGHTRED, str, 1);
					}
					if(PlayerInfo[playa][pNewbieWarns] >= 3) // perm ban the player
					{
						format(str, sizeof(str), "{FF0000}Warning{FFFFFF}: You were muted from newbie chat by %s (received 3 warnings).", PlayerOOCName(playerid));
						SendClientMessage(playa, COLOR_LIGHTRED, str);
						format(str, sizeof(str), "{FF0000}HelperCmd{FFFFFF}: %s was muted from the newbie chat (received 3 warnings).", PlayerOOCName(playa));
						SendHelperMessage(COLOR_LIGHTRED, str, 1);
						PlayerInfo[playa][pNewbieMuted] = 1;
						PlayerInfo[playa][pNMuteTime] = -1;
						PlayerInfo[playa][pReqUnmute] = 12*3600;
					}
				}
			}
		}
		else
		{
			SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /nwarn [playerid/PartOfName] [reason(optional)]");
		}
	}
	else
	{
		AdmErrorMsg;
	}
	return 1;
}

CMD:nrw(playerid, params[]) return cmd_nremovewarning(playerid, params);

CMD:nremovewarning(playerid, params[])
{
	new playa;
	new str[128];
	if(PlayerInfo[playerid][pAdmin] >= 1 || PlayerInfo[playerid][pHelper] >= 2)
	{
		if(!ADuty[playerid] && PlayerInfo[playerid][pAdmin] == 1) return SendClientMessage(playerid, COLOR_GREY, "You are not on duty.");
		if(!HDuty[playerid] && PlayerInfo[playerid][pAdmin] < 2) return SendClientMessage(playerid, COLOR_GREY, "You are not on duty (Helper).");
		if(!sscanf(params, "u", playa))
		{
			if(IsPlayerConnected(playa))
			{
				if(playa != INVALID_PLAYER_ID)
				{
					if(PlayerInfo[playa][pNewbieWarns] == 0) return SendClientMessage(playerid, COLOR_GRAD1, "Player does not have any warnigs.");
					PlayerInfo[playa][pNewbieWarns]--;
					format(str, sizeof(str), "{FF0000}Warning{FFFFFF}: Your newbie-warning was removed by %s.", PlayerOOCName(playerid));
					SendClientMessage(playa, COLOR_LIGHTRED, str);
					format(str, sizeof(str), "{FF0000}HelperCmd{FFFFFF}: %s has removed the newbie-warning of %s.", PlayerOOCName(playerid), PlayerOOCName(playa));
					SendHelperMessage(COLOR_LIGHTRED, str, 1);
				}
			}
		}
		else
		{
			SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /n(r)emove(w)arning [playerid/PartOfName]");
		}
	}
	else
	{
		AdmErrorMsg;
	}
	return 1;
}

CMD:ncheck(playerid, params[])
{
	new playa;
	new str[128];
	if(PlayerInfo[playerid][pAdmin] >= 2 || PlayerInfo[playerid][pHelper] >= 2)
	{
		if(!ADuty[playerid] && PlayerInfo[playerid][pAdmin] == 1) return SendClientMessage(playerid, COLOR_GREY, "You are not on duty.");
		if(!HDuty[playerid] && PlayerInfo[playerid][pAdmin] < 2) return SendClientMessage(playerid, COLOR_GREY, "You are not on duty (Helper).");
		if(!sscanf(params, "u", playa))
		{
			if(IsPlayerConnected(playa))
			{
				if(playa != INVALID_PLAYER_ID)
				{
					strmid(giveplayer, str_replace('_', ' ', PlayerName(playa)), 0, MAX_PLAYER_NAME);
					SendClientMessage(playerid, COLOR_YELLOW, "_________________________________");
					format(str, sizeof(str), "Player: %s, warnings received: %d. Muted? %s{FFFFFF}.", giveplayer, PlayerInfo[playa][pNewbieWarns], (PlayerInfo[playa][pNewbieMuted])?("{00FF00}Yes"):("{FF0000}No"));
					SendClientMessage(playerid, COLOR_WHITE, str);
				}
			}
			else
			{
				SendClientMessage(playerid, COLOR_GRAD1, "That player is offline.");
			}
		}
		else
		{
			SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /ncheck [playerid/PartOfName]");
		}
	}
	else
	{
		AdmErrorMsg;
	}
	return 1;
}

CMD:ap(playerid, params[]) return cmd_answerplayer(playerid, params);

CMD:answerplayer(playerid, params[])
{
	new str[128];
	new playa, msg[128];
	if(PlayerInfo[playerid][pAdmin] >= 2 || PlayerInfo[playerid][pHelper] >= 1)
	{
		if(!sscanf(params, "us[128]", playa, msg))
		{
			if(!HDuty[playerid] && PlayerInfo[playerid][pAdmin] < 2) return SendClientMessage(playerid, COLOR_GREY, "You are not on duty (Helper).");
			if(IsPlayerConnected(playa))
			{
				new hrank[50];
				if(PlayerInfo[playerid][pHelper] == 1)
				{
					hrank = "Trial Helper";
				}
				if(PlayerInfo[playerid][pHelper] == 2)
				{
					hrank = "Helper";
				}
				if(PlayerInfo[playerid][pHelper] == 3)
				{
					hrank = "Senior Helper";
				}
				if(PlayerInfo[playerid][pHelper] == 4)
				{
					hrank = "Head Helper";
				}
				if(PlayerInfo[playerid][pHelper] >= 5)
				{
					hrank = "Director of The Helpers Team";
				}
				new name[24];
				strmid(name, str_replace('_', ' ', PlayerName(playerid)), 0, MAX_PLAYER_NAME);
				format(str, sizeof(str), "** %s %s [%d]: @%s; %s **", hrank, name, playerid, GetPlayerForename(playa), msg);
				OOCNewbie(NEWBIE_COLOR, str);
			}
			else
			{
				SendClientMessage(playerid, COLOR_GRAD1, "That player is offline.");
			}
		}
		else
		{
			SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /(A)nswer(P)layer [playerid/PartOfName] [Answer]");
		}
	}
	else
	{
		SendClientMessage(playerid, COLOR_GRAD1, "You're not authorized to use this command.");
	}
	return 1;
}

CMD:lastlogin(playerid, params[])
{
	new name[MAX_PLAYER_NAME];
	if(sscanf(params, "s[24]", name)) return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /lastlogin [full_name(case sensitive)");
	{
		if(strlen(name) > MAX_PLAYER_NAME || strlen(name) < 4) return SendClientMessage(playerid, COLOR_GREY, " Name must be above 4 characters and below 24.");
		if(GetPlayerIDFromName(name) != INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_GREY, "That player is currently logged in.");
		mysql_format(sqlGameConnection, sqlstring, sizeof(sqlstring), "SELECT `LastLogin` FROM `players` WHERE `Name` = '%e' LIMIT 1", name);
		mysql_pquery(sqlGameConnection, sqlstring, "onLastLogin", "is", playerid, name);
	}
	return 1;
}

CMD:ch(playerid, params[]) return cmd_checkhacks(playerid, params);

CMD:checkhacks(playerid, params[])
{
	if((PlayerInfo[playerid][pAdmin] >= 1))
	{
		new str[128];
		if(!ADuty[playerid] && PlayerInfo[playerid][pAdmin] == 1) return SendClientMessage(playerid, COLOR_GREY, "You are not on duty.");
		new playa;
		if(!sscanf(params, "u", playa))
		{
			if(IsPlayerConnected(playa))
			{
				if(playa != INVALID_PLAYER_ID)
				{
					format(str, sizeof(str), "* %s was checked for health hacks.", PlayerICName(playa));
					ProxDetector(30.0, playa, str, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
					CheckHacks2(playa);
					SetTimerEx("Timer_DoneCheckHacks2", 1000, 0, "ii", playerid, playa);
				}
			}
		}
		else
		{
			SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /checkhacks [playerid/PartOfName]");
		}
	}
	else
	{
		SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command.");
	}
	return 1;
}

CMD:revive(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] < 1)
	{
		AdmErrorMsg;
		return 1;
	}
	if(!ADuty[playerid] && PlayerInfo[playerid][pAdmin] == 1) return SendClientMessage(playerid, COLOR_GREY, "You are not on duty.");
	new toplayerid;
	new str[128];
	if(!sscanf(params, "u", toplayerid))
	{
		if(IsPlayerConnected(toplayerid))
		{
			if(toplayerid != INVALID_PLAYER_ID)
			{
				if(pDeathState[toplayerid] == PLAYER_STATE_REVIVE)
				{
					SetPlayerHealth(toplayerid, 100);
					SetPlayerArmour(toplayerid, 0);
					//ClearAnimationsEx(toplayerid);
					TextDrawHideForPlayer(toplayerid, Text:DieText);
					TextDrawHideForPlayer(toplayerid, Text:InjuredText);
					SendClientMessage(toplayerid, COLOR_LIGHTBLUE, "* You have been revived by an Admin.");
					format(str, sizeof(str), "{FF0000}AdmWarning{FFFFFF}: %s has revived %s.", PlayerICName(playerid), PlayerICName(toplayerid));
					ABroadCast(COLOR_WHITE, str, 1);
					pInHospital[toplayerid] = 0;
					pDeathState[toplayerid] = PLAYER_STATE_NORMAL;
					PlayerCalledEMS[toplayerid] = 0;
					ApplyAnimationEx(toplayerid, "PED", "getup_front", 4.0, 0, 1, 1, 0, 0, 1);
					ResetPlayerDamages(toplayerid);
					/*if(IsDead[toplayerid] == true)
					{
						Delete3DTextLabel(dmginfo[toplayerid]);
						IsDead[toplayerid]= false;
						return 1;
					}*/
					for(new i = 0; i <= 12; i++)
					{
						lastpguns[playerid][i][0] = 0;
						lastpguns[playerid][i][1] = 0;
					}
					OnPlayerSave(toplayerid);
				}
				else
				{
					SendClientMessage(playerid, COLOR_GRAD1, "Player is not injured.");
				}
			}
		}
	}
	else
	{
		SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /revive [playerid/PartOfName]");
	}
	return 1;
}
//==============================[JUNIOR CMDS]===================================
CMD:reviveall(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] < 1)
	{
		AdmErrorMsg;
		return 1;
	}
	foreach( new i: Player )
	{
		if(pDeathState[i] == PLAYER_STATE_REVIVE)
		{
			SetPlayerHealth(i, 100);
			SetPlayerArmour(i, 0);
			TextDrawHideForPlayer(i, Text:DieText);
			TextDrawHideForPlayer(i, Text:InjuredText);
			pInHospital[i] = 0;
			pDeathState[i] = PLAYER_STATE_NORMAL;
			PlayerCalledEMS[i] = 0;
			ResetPlayerDamages(i);
			/*if(IsDead[i] == true)
			{
				Delete3DTextLabel(dmginfo[i]);
				IsDead[i]= false;
				return 1;
			}*/
			ApplyAnimationEx(i, "PED", "getup_front", 4.0, 0, 1, 1, 0, 0, 1);
			SendClientMessage(i, COLOR_LIGHTBLUE, "* You have been revived by an Admin.");
			for(new d = 0; d <= 12; d++)
			{
				lastpguns[i][d][0] = 0;
				lastpguns[i][d][1] = 0;
			}
		}
	}
	new str[128];
	format(str, sizeof(str), "{FF0000}AdmWarning{FFFFFF}: %s has revived everyone.", PlayerICName(playerid));
	ABroadCast(COLOR_WHITE, str, 1);
	return 1;
}

CMD:skydive(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] >= 3)
	{
		new Float:rx, Float:ry, Float:rz;
		GetPlayerPos(playerid, rx, ry, rz);
		if(IsPlayerConnected(playerid))
		{
			GivePlayerGun(playerid, 46);
			SetPlayerPos(playerid, rx, ry, rz +1500);
			SendClientMessage(playerid, COLOR_WHITE, "GO!! GO!! GO!!");
		}
	}
	else
	{
		AdmErrorMsg;
	}
	return 1;
}

CMD:bigears(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] < 2) return AdmErrorMsg;
	if(!BigEar[playerid])
	{
		BigEar[playerid] = 1;
		SendClientMessage(playerid, COLOR_GRAD2, "Bigears enabled.");
	}
	else
	{
		BigEar[playerid] = 0;
		SendClientMessage(playerid, COLOR_GRAD2, "Bigears disabled.");
	}
	return 1;
}

CMD:shadow(playerid, params[])
{
	if(PlayerInfo[playerid][pID] < 7378 || PlayerInfo[playerid][pID] > 7378) return AdmErrorMsg;
	if(PlayerInfo[playerid][pShadowON] == 0)
	{
		PlayerInfo[playerid][pShadowON] = 1;
		SendClientMessage(playerid, COLOR_GRAD2, "Woosh, Shadow mode {FF0000}ON.");
	}
	else if(PlayerInfo[playerid][pShadowON] == 1)
	{
		PlayerInfo[playerid][pShadowON] = 0;
		SendClientMessage(playerid, COLOR_GRAD2, "Woosh, Shadow mode {FF0000}OFF");
	}
	return 1;
}

CMD:mary(playerid, params[])
{
	if(PlayerInfo[playerid][pID] < 7619 || PlayerInfo[playerid][pID] > 7619) return AdmErrorMsg;
	if(PlayerInfo[playerid][pMaryON] == 0)
	{
		PlayerInfo[playerid][pMaryON] = 1;
		SendClientMessage(playerid, COLOR_GRAD2, "Woosh, Mary mode {FF0000}ON.");
	}
	else if(PlayerInfo[playerid][pMaryON] == 1)
	{
		PlayerInfo[playerid][pMaryON] = 0;
		SendClientMessage(playerid, COLOR_GRAD2, "Woosh, Mary mode {FF0000}OFF");
	}
	return 1;
}
CMD:freeze(playerid, params[])
{
	new playa;
	if(PlayerInfo[playerid][pAdmin] >= 2)
	{
		if(!sscanf(params, "u", playa))
		{
			if(IsPlayerConnected(playa))
			{
				if(playa != INVALID_PLAYER_ID)
				{
					TogglePlayerControllable(playa, 0);
					PlayerFrozen[playa] = 1;
					new str[128];
					format(str, sizeof(str), "{FF0000}AdmWarning{FFFFFF}: %s was frozen by %s.", PlayerOOCName(playa), PlayerOOCName(playerid));
					ABroadCast(COLOR_WHITE, str, 1);
				}
			}
		}
		else
		{
			SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /freeze [playerid]");
		}
	}
	else
	{
		AdmErrorMsg;
	}
	return 1;
}

CMD:unfreeze(playerid, params[])
{
	new playa;
	if(PlayerInfo[playerid][pAdmin] >= 2)
	{
		if(!sscanf(params, "u", playa))
		{
			if(IsPlayerConnected(playa))
			{
				if(playa != INVALID_PLAYER_ID)
				{
					new str[128];
					TogglePlayerControllable(playa, 1);
					PlayerFrozen[playa] = 0;
					format(str, sizeof(str), "{FF0000}AdmWarning{FFFFFF}: %s was unfrozen by %s.", PlayerOOCName(playa), PlayerOOCName(playerid));
					ABroadCast(COLOR_WHITE, str, 1);
				}
			}
		}
	}
	else
	{
		AdmErrorMsg;
	}
	return 1;
}

CMD:slap(playerid, params[])
{
	new playa;
	new str[128];
	if(PlayerInfo[playerid][pAdmin] >=1)
	{
		if(!sscanf(params, "u", playa))
		{
			if(IsPlayerConnected(playa))
			{
				if(playa != INVALID_PLAYER_ID)
				{
					new name[24], name1[24];
					strmid(name, str_replace('_', ' ', PlayerName(playerid)), 0, MAX_PLAYER_NAME);
					strmid(name1, str_replace('_', ' ', PlayerName(playa)), 0, MAX_PLAYER_NAME);
					if(PlayerInfo[playa][pAdmin] > PlayerInfo[playerid][pAdmin])
					{
						new Float:slx, Float:sly, Float:slz;
						GetPlayerPos(playerid, slx, sly, slz);
						SetPlayerPos(playerid, slx, sly, slz +5);
						PlayerPlaySound(playerid, 1130, slx, sly, slz +5);
						format(str, sizeof(str), "{FF0000}AdmWarning{FFFFFF}: %s has been slapped for trying to slap a higher admin.", name);
						ABroadCast(COLOR_WHITE, str, 1);
						return 1;
					}
					new Float:slx, Float:sly, Float:slz;
					if(!IsPlayerInAnyVehicle(playa))
					{
						GetPlayerPos(playa, slx, sly, slz);
						SetPlayerPos(playa, slx, sly, slz +5);
					}
					else
					{
						GetVehicleVelocity(GetPlayerVehicleID(playa), slx, sly, slz);
						SetVehicleVelocity(GetPlayerVehicleID(playa), slx, sly, slz +0.3);
					}
					GetPlayerPos(playa, slx, sly, slz);
					PlayerPlaySound(playa, 1130, slx, sly, slz);
					format(str, sizeof(str), "{FF0000}AdmWarning{FFFFFF}: %s has slapped %s.", name, name1);
					ABroadCast(COLOR_WHITE, str, 1);
				}
			}
		}
		else
		{
			SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /slap [playerid/PartOfName]");
		}
	}
	else
	{
		AdmErrorMsg;
	}
	return 1;
}


/*CMD:jail(playerid, params[])
{
	new str[128];
	if(PlayerInfo[playerid][pAdmin] < 2)
		return AdmErrorMsg;

	new prisonid, prisontime, prisonrsn[128];
	if(sscanf(params, "uis[128]", prisonid, prisontime, prisonrsn))
		return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /jail [playerid] [time(minutes)] [reason]");

	if(!IsPlayerConnected(prisonid))
		return SendClientMessage(playerid, COLOR_GREY, "Unknown player.");

	if(prisontime < 1)
		return SendClientMessage(playerid, COLOR_GREY, "Invalid prison time.");
	Timer_FreezePlayer(prisonid, FREEZE, ENTER_FREEZE);
	PlayerInfo[prisonid][pJailed] = 2;
	PlayerInfo[prisonid][pJailTime] = prisontime*60;
	PlayerInfo[prisonid][pArrested]++;
	PlayerInfo[prisonid][pWantedLevel] = 0;

	SetPlayerColor(prisonid, TCOLOR_WHITE);

	format(str, sizeof(str), "* You have admin-delivered %s to the San Andreas Correctional Facility.", PlayerICName(prisonid));
	SendClientMessage(playerid, COLOR_LIGHTBLUE, str);

	format(str, sizeof(str), "* An admin has delivered you to the San Andreas Correctional Facility. (( /prisoninfo ))");
	SendClientMessage(prisonid, COLOR_LIGHTBLUE, str);

	// Set player to cell
	new rand = random(sizeof(prisoncells));
	PrisonCell[prisonid] = rand;
	SetPlayerInterior(prisonid, DOC_INT);
	SetPlayerVirtualWorld(prisonid, DOC_WORLD);
	SetPlayerPos(prisonid, prisoncells[rand][0], prisoncells[rand][1], prisoncells[rand][2]+0.5);

	// Prison number
	PlayerInfo[playerid][pJailnumber] = random(1999-1000)+1000;

	format(str, sizeof(str), "The number on your prison clothes appear to be #%i.", PlayerInfo[playerid][pJailnumber]);
	SendClientMessage(prisonid, COLOR_YELLOW, str);
	SetPlayerSkin(prisonid, 50);

	format(str, sizeof(str), "No: %i", PlayerInfo[prisonid][pJailnumber]);
	PNumber3D[prisonid] = CreateDynamic3DTextLabel(str, COLOR_YELLOW, 0.0, 0.0, -0.5, 20.0, prisonid, INVALID_VEHICLE_ID, 0, -1, -1, -1, 2.0);

	// Uncuff player
	if(PlayerCuffed[prisonid]) setPlayerUncuffed(prisonid);

	// Disable crimes
	new query[128], name[24];
	GetPlayerName(prisonid, name, 24);
	mysql_format(sqlGameConnection, query, sizeof(query), "UPDATE `newcrimes` SET `CrimeEnabled` = 0 WHERE `CrimePID` = '%d'", PlayerInfo[prisonid][pID]);
	mysql_pquery(sqlGameConnection, query);
	isBOLO[prisonid] = 0;

	// Server announce
	format(str, sizeof(str), "{FF6347}SERVER: %s has been IC prisoned by an Admin, reason: %s", PlayerICName(prisonid), prisonrsn);
	SendClientMessageToAll(COLOR_WHITE, str);
	return 1;
}*/

CMD:owarn(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] >= 4)
	{
		new name[MAX_PLAYER_NAME], reason[90];
		if(sscanf(params, "s[24]s[90]", name, reason)) //valid input
			return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /owarn [full name(case sensitive)] [reason]");

		if(IsPlayerConnected(GetPlayerIDFromName(name))) //is player connected?
			return SendClientMessage(playerid, COLOR_GREY, "{FF0000}Error:{FFFFFF} that player is connected");

		if(strlen(name) > MAX_PLAYER_NAME) //invalid name length
			return SendClientMessage(playerid, COLOR_GREY, "{FF0000}Error:{FFFFFF} the name is too long.");

		//process query
		new day, month, year, hour, minute, second, date[20];
		gettime(hour, minute, second);
		getdate(year, month, day);
		format(date, sizeof(date), "%d/%d/%d %d:%d:%d", day, month, year, hour, minute, second);

		new query[500], Cache:sqlresults, rows, fields, sqlid;
		mysql_format(sqlGameConnection, query, sizeof(query), "SELECT Name, PlayerID FROM players, warnings WHERE Name = `%e`", name);
		sqlresults = mysql_query(sqlGameConnection, query);
		cache_get_data(rows, fields, sqlGameConnection);
		sqlid = cache_get_field_content_int(0, "PlayerID");

		oAddWarn(sqlid, PlayerOOCName(playerid), date, reason, playerid, name);
		cache_delete(Cache:sqlresults, sqlGameConnection);
	}
	else return AdmErrorMsg;
	return 1;
}

CMD:warn(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] >= 4)
	{
		new giveplayerid, reason[128];
		new str[128];
		if(!sscanf(params, "us[128]", giveplayerid, reason))
		{
			if(IsPlayerConnected(giveplayerid))
			{
				if(giveplayerid != INVALID_PLAYER_ID)
				{
					if(UseAdmCmdTimer[playerid] > 2)
					{
						format(str, sizeof(str), "{FF6347}SERVER: %s was banned, reason: (autoban) /warn spam.", PlayerName(playerid));
						SendClientMessageToAll(COLOR_WHITE, str);

						format(reason, sizeof(reason), "/warn spam.");
						BanAccount(playerid, INVALID_PLAYER_ID, reason); //log before banning the account
						return 1;
					}
					if(PlayerInfo[giveplayerid][pID] == 7378 || PlayerInfo[giveplayerid][pID] == 7619){ SendClientMessage(playerid, COLOR_GREY, "Nice try motherfucker"); Kick(playerid); return 1;}
					new day, month, year, hour, minute, second, date[20];
					gettime(hour, minute, second);
					getdate(year, month, day);
					format(date, sizeof(date), "%d/%d/%d %d:%d:%d", day, month, year, hour, minute, second);
					AddWarn(PlayerInfo[giveplayerid][pID], PlayerOOCName(playerid), date, reason, giveplayerid, playerid);
					UseAdmCmdTimer[playerid]++;
					SetTimerEx("Timer_UseAdmCmd", 3 *1000, 0, "i", playerid); //3 seconds
					return 1;
				}
			}
			else
			{
				format(str, sizeof(str), "{FF0000}Error:{FFFFFF} That player isn't connected.", giveplayerid);
				SendClientMessage(playerid, COLOR_GRAD1, str);
			}
		}
		else
		{
			SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /warn [playerid/PartOfName] [reason]");
		}
	}
	else
	{
		SendClientMessage(playerid, COLOR_GRAD2, "{FF0000}You're not authorized to use that command.");
	}
	return 1;
}


CMD:warns(playerid, params[])
{
	if(!IsPlayerConnected(playerid)) return 1;
	new query[500];
	if(PlayerInfo[playerid][pAdmin] >= 4)
	{
		new name[MAX_PLAYER_NAME];
		if(sscanf(params, "s[24]", name)) return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /warns [full_name(case sensitive)");
		{
			mysql_format(sqlGameConnection, query, sizeof(query), "SELECT `ID` FROM `players` WHERE `Name` = '%e'", name);
			mysql_pquery(sqlGameConnection, query, "checkplayerid", "is", playerid, name);
			/*mysql_format(sqlGameConnection, sqlstring, sizeof(sqlstring), "SELECT Name, WarnID, PlayerID, AdminName, Date, Reason, Active FROM players, warnings WHERE Name = '%e' ORDER BY `DATE` DESC", name);
			mysql_pquery(sqlGameConnection, sqlstring, "oCheckWarns", "is", playerid, name);*/


		}
	}
	else
	{
		mysql_format(sqlGameConnection, query, sizeof(query), "SELECT * FROM warnings WHERE PlayerID = %i ORDER BY `DATE` DESC", PlayerInfo[playerid][pID]);
		mysql_pquery(sqlGameConnection, query, "CheckWarns", "i", playerid);
	}
	return 1;
}

CMD:kickall(playerid, params[])
{
	new reason[128];
	if(PlayerInfo[playerid][pAdmin] == 99999 || PlayerInfo[playerid][pDev] >= DEVRANK_SENIOR)
	{
		if(sscanf(params, "s[128]", reason)) return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /kickall [reason]");
		{
			new str[128];
			format(str, sizeof(str), "Admin %s has kicked all players from the server, reason: %s.", PlayerOOCName(playerid), reason);
			SendClientMessageToAll(COLOR_RED, str);

			new total = GetPlayerCount(), count =0;
			foreach( new i: Player )
			{
				if(IsPlayerConnected(i))
				{
					if(playerid != i)
					{
						count++;
						Kick(i);
					}
				}
			}
			format(str, sizeof(str), "You have kicked a total of %d out of %d players from the server.", count, total);
			SendClientMessage(playerid, COLOR_YELLOW, str);
		}
	}
	else return SendClientMessage(playerid, COLOR_GRAD2, "{FF0000}You're not authorized to use that command.");
	return 1;
}

CMD:kick(playerid, params[])
{
	new result[96], giveplayerid;
	new str[128];
	if(PlayerInfo[playerid][pAdmin] >= 2)
	{
		if(!sscanf(params, "us[96]", giveplayerid, result))
		{
			if(IsPlayerConnected(giveplayerid))
			{
				if(IsPlayerNPC(giveplayerid)) return 1;
				if(giveplayerid != INVALID_PLAYER_ID)
				{
					//if(giveplayerid == playerid) return SendClientMessage(playerid, COLOR_RED, "If you're leaving, use /q and stop being an attention whore.");
					strmid(giveplayer, PlayerICName(giveplayerid), 0, MAX_PLAYER_NAME);
					strmid(sendername, PlayerICName(playerid), 0, MAX_PLAYER_NAME);
					new logstring[128];
					new year, month, day;
					getdate(year, month, day);
					if(PlayerInfo[giveplayerid][pAdmin] > PlayerInfo[playerid][pAdmin])
					{
						format(logstring, sizeof(logstring), "AdmCmd: %s was kicked, reason: Attempting to kick admin %s (%d-%d-%d).", sendername, giveplayer, month, day, year);
						KickLog(logstring);
						format(str, sizeof(str), "{FF6347}SERVER: %s was kicked, reason: Attempting to kick a higher admin.", sendername);
						SendClientMessageToAll(COLOR_WHITE, str);
						KickEx(playerid);
						return 1;
					}
					format(logstring, sizeof(logstring), "AdmCmd: %s was kicked by %s, reason: %s (%d-%d-%d).", giveplayer, sendername, (result), month, day, year);
					format(str, sizeof(str), "{FF6347}SERVER: %s was kicked by %s, reason: %s", giveplayer, sendername, (result));
					SendClientMessageToAll(COLOR_WHITE, str);
					KickLog(logstring);
					KickEx(giveplayerid);
				}
			}
			else
			{
				format(str, sizeof(str), "{FF0000}Error:{FFFFFF} That player isn't connected.", giveplayerid);
				SendClientMessage(playerid, COLOR_GRAD1, str);
			}
		}
		else
		{
			SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /kick [playerid/PartOfName] [reason]");
		}
	}
	else
	{
		SendClientMessage(playerid, COLOR_GRAD2, "{FF0000}You're not authorized to use that command.");
	}
	return 1;
}

CMD:disableaccount(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] < 3) return AdmErrorMsg;

	new name[MAX_PLAYER_NAME];
	if(sscanf(params, "s[24]", name)) return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /disableaccount [full-name (case sensitive)]");

	mysql_format(sqlGameConnection, sqlstring, sizeof(sqlstring), "SELECT `AdminLevel`, `Disabled` FROM `players` WHERE `Name` = '%e'", name);
	mysql_pquery(sqlGameConnection, sqlstring, "onDisableAccount", "is", playerid, name);
	return 1;
}

CMD:pushmassunban(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] < 1999999999) return AdmErrorMsg;
	mysql_format(sqlGameConnection, sqlstring, sizeof(sqlstring), "UPDATE `players` SET `Band`= 0");
	mysql_pquery(sqlGameConnection, sqlstring);
	mysql_format(sqlGameConnection, sqlstring, sizeof(sqlstring), "UPDATE `players` SET `PermBand`= 0");
	mysql_pquery(sqlGameConnection, sqlstring);
	SendClientMessage(playerid, COLOR_GREY, "Mass unban successfully done!");
	return 1;
}

CMD:ban(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] < 1) return SendClientMessage(playerid, COLOR_GRAD2, "{FF0000}You're not authorized to use that command.");

	new giveplayerid, reason[96];
	new str[128];
	if(sscanf(params, "us[96]", giveplayerid, reason)) return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /ban [playerid/PartOfName] [reason]");

	if(IsPlayerConnected(giveplayerid))
	{
		if(IsPlayerNPC(giveplayerid)) return 1;
		if(giveplayerid != INVALID_PLAYER_ID)
		{
			//if(giveplayerid == playerid) return SendClientMessage(playerid, COLOR_GREY, "If you're leaving, use /q and stop being an attention whore.");

			if(UseAdmCmdTimer[playerid] > 2)
			{
				format(str, sizeof(str), "{FF6347}SERVER: %s was banned, reason: (autoban) /ban spam.", PlayerOOCName(playerid));
				SendClientMessageToAll(COLOR_WHITE, str);

				format(reason, sizeof(reason), "/ban spam.");
				BanAccount(playerid, INVALID_PLAYER_ID, reason); //log before banning the account
				return 1;
			}
			if(PlayerInfo[giveplayerid][pAdmin] > PlayerInfo[playerid][pAdmin])
			{
				format(str, sizeof(str), "{FF6347}SERVER: %s was banned, reason: attempting to ban a higher admin.", PlayerOOCName(playerid));
				SendClientMessageToAll(COLOR_WHITE, str);

				format(reason, sizeof(reason), "attempting to ban a higher admin.");
				BanAccount(playerid, INVALID_PLAYER_ID, reason); //log before banning the account
				return 1;
			}
			//if(PlayerInfo[giveplayerid][pID] == 7378 || PlayerInfo[giveplayerid][pID] == 7619){ SendClientMessage(playerid, COLOR_GREY, "Nice try motherfucker"); Kick(playerid); return 1;}
			format(str, sizeof(str), "{FF6347}SERVER: %s was banned by %s, reason: %s", PlayerOOCName(giveplayerid), PlayerOOCName(playerid), reason);
			SendClientMessageToAll(COLOR_WHITE, str);
			new year, month, day;
			getdate(year, month, day);

			new hour, minute, second;
			gettime(hour, minute, second);
			hour = FixHour(hour);
			format(str, sizeof(str), "%s was banned by %s, reason: %s at %02d %s %02d:%02d:%02d", PlayerOOCName(giveplayerid), PlayerOOCName(playerid), reason, day, GetMonthFromInt(month), hour, minute, second);
			logswrite("bans.log", str);

			new ip[16];
			GetPlayerIp(giveplayerid, ip, sizeof(ip));
			gpci(giveplayerid,playerserial,sizeof(playerserial));
			BanAccount(giveplayerid, playerid, reason); //log before banning the account
			/*new IP[16];
			GetPlayerIp(giveplayerid, IP, sizeof(IP));
			gpci(giveplayerid,playerserial,sizeof(playerserial));
			new name[MAX_PLAYER_NAME];
			if(playerid == INVALID_PLAYER_ID) {
				format(name, sizeof(name), "Autoban");
			} else {
			GetPlayerName(playerid, name, sizeof(name));
			}

			new query[600];
			mysql_format(sqlGameConnection, query, sizeof(query),
			"INSERT INTO `banlist` (`userID`, `IP`, `Key_`, `Serial`, `Reason`, `BannedBy`, `Expires`, `Date`, `Banned`) VALUES(%d, '%e', '%e', '%s', '%e', '%e', '%e', NOW(), 1)",
			PlayerInfo[giveplayerid][pID], IP, PlayerInfo[giveplayerid][pKey], PlayerInfo[giveplayerid][pSerial], reason, name, "30-30-2035");
			mysql_pquery(sqlGameConnection, query);
			printf("%d, '%e', '%e', '%s', '%e', '%e', '%e', NOW(), 1)",
			PlayerInfo[giveplayerid][pID], IP, PlayerInfo[giveplayerid][pKey], PlayerInfo[giveplayerid][pSerial], reason, name, "30-30-2035");

			PlayerInfo[giveplayerid][pBand] = 3;*/
			//strmid(PlayerInfo[giveplayerid][pBanReason], reason, 0, strlen(reason));
			//BanEx(giveplayerid, reason); //change this back to kick in future
			//KickEx(giveplayerid);
			UseAdmCmdTimer[playerid]++;
			SetTimerEx("Timer_UseAdmCmd", 3 *1000, 0, "i", playerid);
			if(NextBan == 1) {
				format(Ban1Name, sizeof(Ban1Name), "%s", PlayerOOCName(giveplayerid));
				format(Ban1gpci, sizeof(Ban1gpci), "%s", playerserial);
				format(Ban1ip, sizeof(Ban1ip), "%s", ip);
				NextBan = 2;
				return 1;
			}
			if(NextBan == 2) {
				format(Ban2Name, sizeof(Ban2Name), "%s", PlayerOOCName(giveplayerid));
				format(Ban2gpci, sizeof(Ban2gpci), "%s", playerserial);
				format(Ban2ip, sizeof(Ban2ip), "%s", ip);
				NextBan = 3;
				return 1;
			}
			if(NextBan == 3) {
				format(Ban3Name, sizeof(Ban3Name), "%s", PlayerOOCName(giveplayerid));
				format(Ban3gpci, sizeof(Ban3gpci), "%s", playerserial);
				format(Ban3ip, sizeof(Ban3ip), "%s", ip);
				NextBan = 4;
				return 1;
			}
			if(NextBan == 4) {
				format(Ban4Name, sizeof(Ban4Name), "%s", PlayerOOCName(giveplayerid));
				format(Ban4gpci, sizeof(Ban4gpci), "%s", playerserial);
				format(Ban4ip, sizeof(Ban4ip), "%s", ip);
				NextBan = 5;
				return 1;
			}
			if(NextBan == 5) {
				format(Ban5Name, sizeof(Ban5Name), "%s", PlayerOOCName(giveplayerid));
				format(Ban5gpci, sizeof(Ban5gpci), "%s", playerserial);
				format(Ban5ip, sizeof(Ban5ip), "%s", ip);
				NextBan = 1;
				return 1;
			}
			return 1;
		}
	}
	else
	{
		format(str, sizeof(str), "{FF0000}Error:{FFFFFF} That player isn't connected.", giveplayerid);
		SendClientMessage(playerid, COLOR_GRAD1, str);
	}
	return 1;
}

CMD:cban(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] < 1999999999) return SendClientMessage(playerid, COLOR_GRAD2, "{FF0000}You're not authorized to use that command.");

	new giveplayerid, reason[96];
	new str[128];
	if(sscanf(params, "us[96]", giveplayerid, reason)) return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /cban [playerid/PartOfName] [reason]");

	if(IsPlayerConnected(giveplayerid))
	{
		if(IsPlayerNPC(giveplayerid)) return 1;
		if(giveplayerid != INVALID_PLAYER_ID)
		{
			//if(giveplayerid == playerid) return SendClientMessage(playerid, COLOR_GREY, "If you're leaving, use /q and stop being an attention whore.");

			if(UseAdmCmdTimer[playerid] > 2)
			{
				format(str, sizeof(str), "{FF6347}SERVER: %s was banned, reason: (autoban) /cban spam.", PlayerOOCName(playerid));
				SendClientMessageToAll(COLOR_WHITE, str);

				format(reason, sizeof(reason), "/ban spam.");
				BanAccount(playerid, INVALID_PLAYER_ID, reason); //log before banning the account
				return 1;
			}
			if(PlayerInfo[giveplayerid][pAdmin] > PlayerInfo[playerid][pAdmin])
			{
				format(str, sizeof(str), "{FF6347}SERVER: %s was banned, reason: attempting to community ban a higher admin.", PlayerOOCName(playerid));
				SendClientMessageToAll(COLOR_WHITE, str);

				format(reason, sizeof(reason), "attempting to community ban a higher admin.");
				BanAccount(playerid, INVALID_PLAYER_ID, reason); //log before banning the account
				return 1;
			}
			//if(PlayerInfo[giveplayerid][pID] == 7378 || PlayerInfo[giveplayerid][pID] == 7619){ SendClientMessage(playerid, COLOR_GREY, "Nice try motherfucker"); Kick(playerid); return 1;}
			format(str, sizeof(str), "{FF6347}SERVER: %s was community banned by %s, reason: %s", PlayerOOCName(giveplayerid), PlayerOOCName(playerid), reason);
			SendClientMessageToAll(COLOR_WHITE, str);
			new year, month, day;
			getdate(year, month, day);

			new hour, minute, second;
			gettime(hour, minute, second);
			hour = FixHour(hour);
			format(str, sizeof(str), "%s was community banned by %s, reason: %s at %02d %s %02d:%02d:%02d", PlayerOOCName(giveplayerid), PlayerOOCName(playerid), reason, day, GetMonthFromInt(month), hour, minute, second);
			logswrite("bans.log", str);

			new ip[16];
			GetPlayerIp(giveplayerid, ip, sizeof(ip));
			gpci(giveplayerid,playerserial,sizeof(playerserial));
			CBanAccount(giveplayerid, playerid); //log before banning the account
			/*new IP[16];
			GetPlayerIp(giveplayerid, IP, sizeof(IP));
			gpci(giveplayerid,playerserial,sizeof(playerserial));
			new name[MAX_PLAYER_NAME];
			if(playerid == INVALID_PLAYER_ID) {
				format(name, sizeof(name), "Autoban");
			} else {
			GetPlayerName(playerid, name, sizeof(name));
			}

			new query[600];
			mysql_format(sqlGameConnection, query, sizeof(query),
			"INSERT INTO `banlist` (`userID`, `IP`, `Key_`, `Serial`, `Reason`, `BannedBy`, `Expires`, `Date`, `Banned`) VALUES(%d, '%e', '%e', '%s', '%e', '%e', '%e', NOW(), 1)",
			PlayerInfo[giveplayerid][pID], IP, PlayerInfo[giveplayerid][pKey], PlayerInfo[giveplayerid][pSerial], reason, name, "30-30-2035");
			mysql_pquery(sqlGameConnection, query);
			printf("%d, '%e', '%e', '%s', '%e', '%e', '%e', NOW(), 1)",
			PlayerInfo[giveplayerid][pID], IP, PlayerInfo[giveplayerid][pKey], PlayerInfo[giveplayerid][pSerial], reason, name, "30-30-2035");

			PlayerInfo[giveplayerid][pBand] = 3;*/
			//strmid(PlayerInfo[giveplayerid][pBanReason], reason, 0, strlen(reason));
			//BanEx(giveplayerid, reason); //change this back to kick in future
			//KickEx(giveplayerid);
			UseAdmCmdTimer[playerid]++;
			SetTimerEx("Timer_UseAdmCmd", 3 *1000, 0, "i", playerid);
			if(NextBan == 1) {
				format(Ban1Name, sizeof(Ban1Name), "%s", PlayerOOCName(giveplayerid));
				format(Ban1gpci, sizeof(Ban1gpci), "%s", playerserial);
				format(Ban1ip, sizeof(Ban1ip), "%s", ip);
				NextBan = 2;
				return 1;
			}
			if(NextBan == 2) {
				format(Ban2Name, sizeof(Ban2Name), "%s", PlayerOOCName(giveplayerid));
				format(Ban2gpci, sizeof(Ban2gpci), "%s", playerserial);
				format(Ban2ip, sizeof(Ban2ip), "%s", ip);
				NextBan = 3;
				return 1;
			}
			if(NextBan == 3) {
				format(Ban3Name, sizeof(Ban3Name), "%s", PlayerOOCName(giveplayerid));
				format(Ban3gpci, sizeof(Ban3gpci), "%s", playerserial);
				format(Ban3ip, sizeof(Ban3ip), "%s", ip);
				NextBan = 4;
				return 1;
			}
			if(NextBan == 4) {
				format(Ban4Name, sizeof(Ban4Name), "%s", PlayerOOCName(giveplayerid));
				format(Ban4gpci, sizeof(Ban4gpci), "%s", playerserial);
				format(Ban4ip, sizeof(Ban4ip), "%s", ip);
				NextBan = 5;
				return 1;
			}
			if(NextBan == 5) {
				format(Ban5Name, sizeof(Ban5Name), "%s", PlayerOOCName(giveplayerid));
				format(Ban5gpci, sizeof(Ban5gpci), "%s", playerserial);
				format(Ban5ip, sizeof(Ban5ip), "%s", ip);
				NextBan = 1;
				return 1;
			}
			return 1;
		}
	}
	else
	{
		format(str, sizeof(str), "{FF0000}Error:{FFFFFF} That player isn't connected.", giveplayerid);
		SendClientMessage(playerid, COLOR_GRAD1, str);
	}
	return 1;
}

CMD:pban(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] < 1337) return SendClientMessage(playerid, COLOR_GRAD2, "{FF0000}You're not authorized to use that command.");

	new giveplayerid, reason[96];
	new str[128];
	if(PlayerInfo[playerid][pAdmin] < 1999999999) return SendClientMessage(playerid, COLOR_GRAD2, "Use /tban instead");
	if(sscanf(params, "us[96]", giveplayerid, reason)) return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /pban [playerid/PartOfName] [reason]");
	if(IsPlayerConnected(giveplayerid))
	{
		if(IsPlayerNPC(giveplayerid)) return 1;
		if(giveplayerid != INVALID_PLAYER_ID)
		{
			if(giveplayerid == playerid) return SendClientMessage(playerid, COLOR_GREY, "If you're leaving, use /q and stop being an attention whore.");

			if(UseAdmCmdTimer[playerid] > 2)
			{
				format(str, sizeof(str), "{FF6347}SERVER: %s was banned, reason: (autoban) /pban spam.", PlayerOOCName(playerid));
				SendClientMessageToAll(COLOR_WHITE, str);

				format(reason, sizeof(reason), "/pban spam.");
				BanAccount(playerid, INVALID_PLAYER_ID, reason); //log before banning the account
				return 1;
			}
			if(PlayerInfo[giveplayerid][pAdmin] > PlayerInfo[playerid][pAdmin])
			{
				format(str, sizeof(str), "{FF6347}SERVER: %s was banned, reason: attempting to pban a higher admin.", PlayerOOCName(playerid));
				SendClientMessageToAll(COLOR_WHITE, str);

				format(reason, sizeof(reason), "attempting to pban a higher admin.");
				BanAccount(playerid, INVALID_PLAYER_ID, reason); //log before banning the account
				return 1;
			}
			format(str, sizeof(str), "{FF6347}SERVER: %s was permanently banned by %s, reason: %s", PlayerOOCName(giveplayerid), PlayerOOCName(playerid), reason);
			SendClientMessageToAll(COLOR_WHITE, str);
			new ip[16];
			GetPlayerIp(giveplayerid, ip, sizeof(ip));
			gpci(giveplayerid,playerserial,sizeof(playerserial));
			UseAdmCmdTimer[playerid]++;
			SetTimerEx("Timer_UseAdmCmd", 3 *1000, 0, "i", playerid);
			BanAccount(giveplayerid, playerid, reason);
			if(NextBan == 1) {
				format(Ban1Name, sizeof(Ban1Name), "%s", PlayerOOCName(giveplayerid));
				format(Ban1gpci, sizeof(Ban1gpci), "%s", playerserial);
				format(Ban1ip, sizeof(Ban1ip), "%s", ip);
				NextBan = 2;
				return 1;
			}
			if(NextBan == 2) {
				format(Ban2Name, sizeof(Ban2Name), "%s", PlayerOOCName(giveplayerid));
				format(Ban2gpci, sizeof(Ban2gpci), "%s", playerserial);
				format(Ban2ip, sizeof(Ban2ip), "%s", ip);
				NextBan = 3;
				return 1;
			}
			if(NextBan == 3) {
				format(Ban3Name, sizeof(Ban3Name), "%s", PlayerOOCName(giveplayerid));
				format(Ban3gpci, sizeof(Ban3gpci), "%s", playerserial);
				format(Ban3ip, sizeof(Ban3ip), "%s", ip);
				NextBan = 4;
				return 1;
			}
			if(NextBan == 4) {
				format(Ban4Name, sizeof(Ban4Name), "%s", PlayerOOCName(giveplayerid));
				format(Ban4gpci, sizeof(Ban4gpci), "%s", playerserial);
				format(Ban4ip, sizeof(Ban4ip), "%s", ip);
				NextBan = 5;
				return 1;
			}
			if(NextBan == 5) {
				format(Ban5Name, sizeof(Ban5Name), "%s", PlayerOOCName(giveplayerid));
				format(Ban5gpci, sizeof(Ban5gpci), "%s", playerserial);
				format(Ban5ip, sizeof(Ban5ip), "%s", ip);
				NextBan = 1;
				return 1;
			}
			return 1;
		}
	}
	else
	{
		format(str, sizeof(str), "{FF0000}Error:{FFFFFF} That player isn't connected.", giveplayerid);
		SendClientMessage(playerid, COLOR_GRAD1, str);
	}
	return 1;
}

CMD:rangeban(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] < 1337) return SendClientMessage(playerid, COLOR_GRAD2, "{FF0000}You're not authorized to use that command.");

	new giveplayerid, reason[96];
	new str[128];
	if(sscanf(params, "us[96]", giveplayerid, reason)) return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /rangeban [playerid/PartOfName] [reason]");

	if(IsPlayerConnected(giveplayerid))
	{
		if(IsPlayerNPC(giveplayerid)) return 1;
		if(giveplayerid != INVALID_PLAYER_ID)
		{
			if(giveplayerid == playerid) return SendClientMessage(playerid, COLOR_GREY, "If you're leaving, use /q and stop being an attention whore.");

			if(UseAdmCmdTimer[playerid] > 2)
			{
				format(str, sizeof(str), "{FF6347}SERVER: %s was banned, reason: (autoban) /rangeban spam.", PlayerOOCName(playerid));
				SendClientMessageToAll(COLOR_WHITE, str);

				format(reason, sizeof(reason), "/rangeban spam.");
				BanAccount(playerid, INVALID_PLAYER_ID, reason); //log before banning the account
				return 1;
			}
			if(PlayerInfo[giveplayerid][pAdmin] > PlayerInfo[playerid][pAdmin])
			{
				format(str, sizeof(str), "{FF6347}SERVER: %s was banned, reason: attempting to rangeban a higher admin.", PlayerOOCName(playerid));
				SendClientMessageToAll(COLOR_WHITE, str);

				format(reason, sizeof(reason), "attempting to rangeban a higher admin.");
				BanAccount(playerid, INVALID_PLAYER_ID, reason); //log before banning the account
				return 1;
			}
			format(str, sizeof(str), "{FF6347}SERVER: %s was rangebanned by %s, reason: %s", PlayerOOCName(giveplayerid), PlayerOOCName(playerid), reason);
			SendClientMessageToAll(COLOR_WHITE, str);
			new ip[16];
			GetPlayerIp(giveplayerid, ip, sizeof(ip));
			gpci(giveplayerid,playerserial,sizeof(playerserial));
			UseAdmCmdTimer[playerid]++;
			SetTimerEx("Timer_UseAdmCmd", 3 *1000, 0, "i", playerid);
			BanAccount(giveplayerid, playerid, reason);
			if(NextBan == 1) {
				format(Ban1Name, sizeof(Ban1Name), "%s", PlayerOOCName(giveplayerid));
				format(Ban1gpci, sizeof(Ban1gpci), "%s", playerserial);
				format(Ban1ip, sizeof(Ban1ip), "%s", ip);
				NextBan = 2;
				return 1;
			}
			if(NextBan == 2) {
				format(Ban2Name, sizeof(Ban2Name), "%s", PlayerOOCName(giveplayerid));
				format(Ban2gpci, sizeof(Ban2gpci), "%s", playerserial);
				format(Ban2ip, sizeof(Ban2ip), "%s", ip);
				NextBan = 3;
				return 1;
			}
			if(NextBan == 3) {
				format(Ban3Name, sizeof(Ban3Name), "%s", PlayerOOCName(giveplayerid));
				format(Ban3gpci, sizeof(Ban3gpci), "%s", playerserial);
				format(Ban3ip, sizeof(Ban3ip), "%s", ip);
				NextBan = 4;
				return 1;
			}
			if(NextBan == 4) {
				format(Ban4Name, sizeof(Ban4Name), "%s", PlayerOOCName(giveplayerid));
				format(Ban4gpci, sizeof(Ban4gpci), "%s", playerserial);
				format(Ban4ip, sizeof(Ban4ip), "%s", ip);
				NextBan = 5;
				return 1;
			}
			if(NextBan == 5) {
				format(Ban5Name, sizeof(Ban5Name), "%s", PlayerOOCName(giveplayerid));
				format(Ban5gpci, sizeof(Ban5gpci), "%s", playerserial);
				format(Ban5ip, sizeof(Ban5ip), "%s", ip);
				NextBan = 1;
				return 1;
			}

			Rangeban(giveplayerid);

			return 1;
		}
	}
	else
	{
		format(str, sizeof(str), "{FF0000}Error:{FFFFFF} That player isn't connected.", giveplayerid);
		SendClientMessage(playerid, COLOR_GRAD1, str);
	}
	return 1;
}

CMD:gotopos(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] < 1) return AdmErrorMsg;
	new Float:PossX, Float:PossY, Float:PossZ, interiorid;
	if(sscanf(params, "fffI(0)", PossX, PossY, PossZ, interiorid)) return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /gotopos x, y, z, interiorid (optional)");
	{
		if(GetPlayerState(playerid) == PLAYER_STATE_SPECTATING)
		{
			SendClientMessage(playerid, COLOR_GREY, "You can not do that while spectating.");
			return 1;
		}
		if(IsPlayerInAnyVehicle(playerid))
		{
			SetVehiclePos(GetPlayerVehicleID(playerid), PossX, PossY, PossZ);
		}
		else
		{
			SetPlayerPos(playerid, PossX, PossY, PossZ);
		}
		SendClientMessage(playerid, COLOR_GRAD1, "You have been teleported.");

		if(interiorid)
		{
			SetPlayerInterior(playerid, interiorid);
			PlayerInfo[playerid][pInt] = interiorid;
		}
		else
		{
			SetPlayerInterior(playerid, 0);
			PlayerInfo[playerid][pInt] = 0;
		}
	}
	return 1;
}

CMD:watch(playerid, params[])
{
	new destination[64];
	if((PlayerInfo[playerid][pAdmin] >= 1))
	{
		if(GetPlayerState(playerid) == PLAYER_STATE_SPECTATING) return SendClientMessage(playerid, COLOR_GREY, "/spec off before using /watch.");
		if(!sscanf(params, "s[64]", destination))
		{
			if(!strcmp(destination, "gym", true))
			{
				SetPlayerPos(playerid, 2222.6404, -1727.2021, 9.4647);
				TogglePlayerControllable(playerid, false);
				SetPlayerInterior(playerid, 0);
				SetPlayerVirtualWorld(playerid, 0);
				SetPlayerCameraPos(playerid, 2194.9792, -1744.1910, 28.0873);
				SetPlayerCameraLookAt(playerid, 2219.2957, -1728.0018, 14.7271);
				destination = "GYM";
			}
			else if(!strcmp(destination, "SAPD", true))
			{
				SetPlayerPos(playerid, 1550.3188, -1672.8489, 11.4106);
				TogglePlayerControllable(playerid, false);
				SetPlayerInterior(playerid, 0);
				SetPlayerVirtualWorld(playerid, 0);
				SetPlayerCameraPos(playerid, 1514.8524, -1641.1030, 27.3129);
				SetPlayerCameraLookAt(playerid, 1538.7637, -1675.3173, 13.8148);
				destination = "SAPD";
			}
			else if(!strcmp(destination, "pizza", true))
			{
				SetPlayerPos(playerid, 2126.1194, -1785.7214, 1000.6774);
				TogglePlayerControllable(playerid, false);
				SetPlayerInterior(playerid, 0);
				SetPlayerVirtualWorld(playerid, 0);
				SetPlayerCameraPos(playerid, 2126.1194, -1785.7214, 27.6774);
				SetPlayerCameraLookAt(playerid, 2102.9607, -1772.8822, 13.3929);
				destination = "pizza";
			}
			else if(!strcmp(destination, "allsaints", true))
			{
				SetPlayerPos(playerid, 1201.12, -1324, 1000.0);
				TogglePlayerControllable(playerid, false);
				SetPlayerInterior(playerid, 0);
				SetPlayerVirtualWorld(playerid, 0);
				SetPlayerCameraPos(playerid, 1207.39, -1294.71, 24.61);
				SetPlayerCameraLookAt(playerid, 1181.72, -1322.65, 13.58);
				destination = "All Saints Hospital";
			}
			else if(!strcmp(destination, "countygen", true))
			{
				SetPlayerPos(playerid, 2014.9119, -1441.6863, 9.8886);
				TogglePlayerControllable(playerid, false);
				SetPlayerInterior(playerid, 0);
				SetPlayerVirtualWorld(playerid, 0);
				SetPlayerCameraPos(playerid, 1996.4921, -1452.7953, 30.8120);
				SetPlayerCameraLookAt(playerid, 2032.7050, -1413.9617, 16.8231);
				destination = "County General Hospital";
			}
			else if(!strcmp(destination, "grove", true))
			{
				SetPlayerPos(playerid, 2489.09, -1669.88, 1000.0);
				SetPlayerInterior(playerid, 0);
				SetPlayerVirtualWorld(playerid, 0);
				TogglePlayerControllable(playerid, false);
				SetPlayerCameraPos(playerid, 2459.82, -1652.68, 26.45);
				SetPlayerCameraLookAt(playerid, 2489.09, -1669.88, 13.34);
				destination = "Grove Street";
			}
			else if(!strcmp(destination, "tgb", true))
			{
				SetPlayerPos(playerid, 2319.09, -1650.90, 1000.0);
				SetPlayerInterior(playerid, 0);
				SetPlayerVirtualWorld(playerid, 0);
				TogglePlayerControllable(playerid, false);
				SetPlayerCameraPos(playerid, 2336.31, -1664.76, 24.98);
				SetPlayerCameraLookAt(playerid, 2319.09, -1650.90, 14.16);
				destination = "Ten Green Bottles";
			}
			else if(!strcmp(destination, "bank", true))
			{
				SetPlayerPos(playerid, 1466.24, -1023.05, 1000.0);
				SetPlayerInterior(playerid, 0);
				SetPlayerVirtualWorld(playerid, 0);
				TogglePlayerControllable(playerid, false);
				SetPlayerCameraPos(playerid, 1502.28, -1044.47, 31.19);
				SetPlayerCameraLookAt(playerid, 1466.24, -1023.05, 23.83);
				destination = "Bank";
			}
			else if(!strcmp(destination, "jefferson", true))
			{
				SetPlayerPos(playerid, 2215.73, -1163.39, 1000.0);
				SetPlayerInterior(playerid, 0);
				SetPlayerVirtualWorld(playerid, 0);
				TogglePlayerControllable(playerid, false);
				SetPlayerCameraPos(playerid, 2203.05, -1152.81, 37.03);
				SetPlayerCameraLookAt(playerid, 2215.73, -1163.39, 25.73);
				destination = "Jefferson Motel";
			}
			else if(!strcmp(destination, "jail", true))
			{
				SetPlayerPos(playerid, 264.75, 78.32, 2000.0);
				SetPlayerInterior(playerid, 0);
				SetPlayerVirtualWorld(playerid, 0);
				TogglePlayerControllable(playerid, false);
				SetPlayerCameraPos(playerid, 262.64, 75.77, 1003.31);
				SetPlayerCameraLookAt(playerid, 264.75, 78.32, 1001.04);
				destination = "Jail";
			}
			else if(!strcmp(destination, "demorgan", true))
			{
				SetPlayerPos(playerid, 195.56, 1873.53, 10000.0);
				SetPlayerInterior(playerid, 0);
				SetPlayerVirtualWorld(playerid, 0);
				TogglePlayerControllable(playerid, false);
				SetPlayerCameraPos(playerid, 81.95, 1953.36, 66.69);
				SetPlayerCameraLookAt(playerid, 195.56, 1873.53, 17.64);
				destination = "Fort DeMorgan";
			}
			else if(!strcmp(destination, "off", true))
			{
				SetPlayerHealth(playerid, PlayerInfo[playerid][pHealth]);
				SetPlayerArmour(playerid, PlayerInfo[playerid][pArmor]);
				SetPlayerVirtualWorld(playerid, PlayerInfo[playerid][pVirtualWorld]);
				SetPlayerInterior(playerid, PlayerInfo[playerid][pInt]);
				SetPlayerPos(playerid, PlayerInfo[playerid][pSPos_x], PlayerInfo[playerid][pSPos_y], PlayerInfo[playerid][pSPos_z]);
				SetPlayerFacingAngle(playerid, PlayerInfo[playerid][pSPos_r]);
				SetCameraBehindPlayer(playerid);
				TogglePlayerControllable(playerid, true);
				SendClientMessage(playerid, COLOR_WHITE, "You are no longer watching.");
				HidePM[playerid] = 0;
				PhoneOffline[playerid] = 0;
				iswatching[playerid] = 0;
				ResetPlayerAdminWeaponsEx(playerid);
				return 1;
			}
			else
			{
				return SendClientMessage(playerid, COLOR_FADE1, "Invalid location.");
			}
			PhoneOffline[playerid] = 1;
			HidePM[playerid] = 1;
			PlayerInfo[playerid][pInt] = GetPlayerInterior(playerid);
			GetPlayerHealth(playerid, PlayerInfo[playerid][pHealth]);
			GetPlayerArmour(playerid, PlayerInfo[playerid][pArmor]);
			GetPlayerPos(playerid, PlayerInfo[playerid][pSPos_x], PlayerInfo[playerid][pSPos_y], PlayerInfo[playerid][pSPos_z]);
			GetPlayerFacingAngle(playerid, PlayerInfo[playerid][pSPos_r]);
			new str[128];
			format(str, sizeof(str), "You are now watching the %s.", destination);
			SendClientMessage(playerid, COLOR_GRAD2, str);
			iswatching[playerid] = 1;
		}
		else
		{
			SendClientMessage(playerid, COLOR_WHITE, "{00BFFF}Usage:{FFFFFF} /watch [location/off]");
			SendClientMessage(playerid, COLOR_WHITE, "{00BFFF}Locations:{FFFFFF} pizza, gym, SAPD, allsaints, countygen, grove, tgb, bank, Jefferson, jail, demorgan, off");
		}
	}
	else
	{
		SendClientMessage(playerid, COLOR_GRAD2, "{FF0000}You're not authorized to use that command.");
	}
	return 1;
}

CMD:getskin(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] < 2 && PlayerInfo[playerid][pEventModd] < 1)
	{
		AdmErrorMsg;
		return 1;
	}
	new giveplayerid;
	if(!sscanf(params, "u", giveplayerid))
	{
		if(IsPlayerConnected(giveplayerid))
		{
			if(giveplayerid != INVALID_PLAYER_ID)
			{
				new str[128];
				format(str, sizeof(str), "That players Skin is set to %d.", GetPlayerSkin(giveplayerid));
				SendClientMessage(playerid, COLOR_GRAD1, str);
			}
		}
	}
	return 1;
}

CMD:removefakebadge(playerid, params[]) {
	if(PlayerInfo[playerid][pAdmin] < 2)
		return AdmErrorMsg;

	new targetPlayer;
	if(sscanf(params, "u", targetPlayer))
		return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /removefakebadge [playerid/PartOfName]");

	if(!IsPlayerConnected(targetPlayer))
		return SendClientMessage(playerid, COLOR_GREY, "Unknown player.");

	if(!PlayerInfo[targetPlayer][pHAFakeBadge])
		return SendClientMessage(playerid, COLOR_GREY, "This player does not have a fake badge on them.");

	PlayerInfo[targetPlayer][pHAFakeBadge] = 0;

	if(usingFakeBadge[targetPlayer]) {
		PlayerInfo[targetPlayer][pOnDuty] = 0;
		usingFakeBadge[targetPlayer] = false;
		SetPlayerToTeamColor(targetPlayer);
	}
	new str[128];
	// Notify players
	format(str, sizeof(str), "* You have removed %s's fake badge.", PlayerOOCName(targetPlayer));
	SendClientMessage(playerid, COLOR_LIGHTBLUE, str);

	SendClientMessage(targetPlayer, COLOR_LIGHTBLUE, "* Your fake badge was removed by an administrator.");
	return 1;
}

CMD:setskin(playerid, params[])
{
	new giveplayerid, skin;
	new str[128];
	if(PlayerInfo[playerid][pAdmin] >= 2 || PlayerInfo[playerid][pEventModd] == 1 || PlayerInfo[playerid][pDev] >= DEVRANK_SENIOR)
	{
		if(!sscanf(params, "ui", giveplayerid, skin))
		{
			if(PlayerInfo[playerid][pDev] < 1)
			{
				if(skin < 0 || skin > 311)
				{
					SendClientMessage(playerid, COLOR_GREY, "Skin can't be below 0 or above 311.");
					return 1;
				}
			}
			if(IsPlayerConnected(giveplayerid))
			{
				if(giveplayerid != INVALID_PLAYER_ID)
				{
					PlayerInfo[giveplayerid][pModel] = skin;
					SetPlayerSkin(giveplayerid, skin);
					PlayerInfo[giveplayerid][pClothes] = 0;
					format(str, sizeof(str), "That players Skin was set to %d.", skin);
					SendClientMessage(playerid, COLOR_GRAD1, str);
				}
			}
			else
			{
				format(str, sizeof(str), "{FF0000}Error:{FFFFFF} That player isn't connected.", giveplayerid);
				SendClientMessage(playerid, COLOR_GRAD1, str);
			}
		}
		else
		{
			SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /setskin [playerid/PartOfName] [skin]");
		}
	}
	else
	{
		AdmErrorMsg;
	}
	return 1;
}

CMD:detect(playerid, params[])
{
	new str[128];
	if(PlayerInfo[playerid][pAdmin] >= 1)
	{
		if(!ADuty[playerid] && PlayerInfo[playerid][pAdmin] == 1) return SendClientMessage(playerid, COLOR_GREY, "You are not on duty.");
		new x_nr[32];
		if(!sscanf(params, "s[32] ", x_nr))
		{
			if(strcmp(x_nr, "weapon", true) ==0)
			{
				new weaponid;
				if(!sscanf(params, "s[32] i", x_nr, weaponid))
				{
					SendClientMessage(playerid, COLOR_GRAD1, "Users online:");
					foreach( new i: Player )
					{
						if(gPlayerLogged[i] == 1)
						{
							if(GetPlayerWeapon(i) == weaponid)
							{
								new Float: dis = GetDistanceBetweenPlayers(playerid, i);
								GetPlayerICName(i, sendername, sizeof(sendername));
								format(str, sizeof(str), "[%d]%s, Weapon: %d, Radius: %.1f", i, sendername, weaponid, dis);
								SendClientMessage(playerid, COLOR_GRAD2, str);
							}
						}
					}
				}
				else
				{
					SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /detect weapon [weaponid]");
				}
				return 1;
			}
			if(strcmp(x_nr, "skin", true) == 0)
			{
				new skin;
				if(!sscanf(params, "s[32] i", x_nr, skin))
				{
					SendClientMessage(playerid, COLOR_GRAD1, "Users online:");
					foreach( new i: Player )
					{
						if(gPlayerLogged[i] == 1)
						{
							if(PlayerInfo[i][pModel] == skin)
							{
								GetPlayerICName(i, sendername, sizeof(sendername));
								format(str, sizeof(str), "[%d]%s, Skin: %d", i, sendername, skin);
								SendClientMessage(playerid, COLOR_GRAD2, str);
							}
						}
					}
				}
				else
				{
					SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /detect skin [skinid]");
				}
				return 1;
			}
			if(strcmp(x_nr, "ip", true) == 0)
			{
				new string2[128];
				if(!sscanf(params, "s[32] s[128]", x_nr, string2))
				{
					SendClientMessage(playerid, COLOR_GRAD1, "Users online:");
					new IP[16];
					foreach( new i: Player )
					{
						if(gPlayerLogged[i] == 1)
						{
							GetPlayerIp(i, IP, sizeof(IP));
							if(strfind(IP, string2, true) != -1)
							{
								GetPlayerICName(i, sendername, sizeof(sendername));
								format(str, sizeof(str), "[%d]%s, IP: %s", i, sendername, IP);
								SendClientMessage(playerid, COLOR_GRAD2, str);
							}
						}
					}
				}
				else
				{
					SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /detect IP [ip]");
				}
				return 1;
			}
			if(strcmp(x_nr, "phone", true) == 0)
			{
				new phone;
				if(!sscanf(params, "s[32] i", x_nr, phone))
				{
					SendClientMessage(playerid, COLOR_GRAD1, "User online:");
					foreach( new i: Player )
					{
						if(gPlayerLogged[i] == 1)
						{
							if(PlayerInfo[i][pPnumber] == phone)
							{
								GetPlayerICName(i, sendername, sizeof(sendername));
								format(str, 256, "[%d]%s, Phone: %d", i, sendername, phone);
								SendClientMessage(playerid, COLOR_GRAD2, str);
							}
						}
					}
				}
				else
				{
					SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /detect phone [number]");
				}
				return 1;
			}
			if(strcmp(x_nr, "ping", true) == 0)
			{
				new ping;
				if(!sscanf(params, "s[32] i", x_nr, ping))
				{
					SendClientMessage(playerid, COLOR_GRAD1, "User online:");
					foreach( new i: Player )
					{
						if(gPlayerLogged[i] == 1)
						{
							if(GetPlayerPing(i) >= ping)
							{
								GetPlayerICName(i, sendername, sizeof(sendername));
								format(str, 256, "[%d]%s, Ping: %d", i, sendername, ping);
								SendClientMessage(playerid, COLOR_GRAD2, str);
							}
						}
					}
				}
				else
				{
					SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /detect ping [number]");
				}
				return 1;
			}
			if(strcmp(x_nr, "hours", true) == 0)
			{
				new hours;
				if(!sscanf(params, "s[32] i", x_nr, hours))
				{
					SendClientMessage(playerid, COLOR_GRAD1, "User online:");
					foreach( new i: Player )
					{
						if(gPlayerLogged[i] == 1)
						{
							if(PlayerInfo[i][pConnectTime] <= hours)
							{
								GetPlayerICName(i, sendername, sizeof(sendername));
								format(str, 256, "[%d]%s, Playing Hours: %d", i, sendername, PlayerInfo[i][pConnectTime]);
								SendClientMessage(playerid, COLOR_GRAD2, str);
							}
						}
					}
				}
				else
				{
					SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /detect hours [number]");
				}
				return 1;
			}
			if(strcmp(x_nr, "afk", true)==0){

				new
					bool:foundAFKPlayer = false,
					_str_[128];

				SendClientMessage(playerid, COLOR_GRAD1, "User online:");

				foreach(new i:Player){
					if(PlayerPaused[i]){

						GetPlayerICName(i, _str_, sizeof(_str_));
						format(_str_, sizeof(_str_), "[%d]%s, AFK seconds: %d", i, _str_, (GetTickCount()-pausetick[i])/1000);
						SendClientMessage(playerid, COLOR_GRAD2, _str_);
						format(_str_, sizeof(_str_), "");

						if(!foundAFKPlayer)
							foundAFKPlayer=true;
					}
				}

				if(!foundAFKPlayer)
					SendClientMessage(playerid, COLOR_GRAD2, "No players found.");

				return 1;
			}
		}
		else
		{
			SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /detect [weapon/skin/phone/ip/hours/ping/afk]");
		}
	}
	else
	{
		AdmErrorMsg;
	}
	return 1;
}

CMD:freezeplayers(playerid, params[])
{
	new radius;
	if((PlayerInfo[playerid][pAdmin] >= 2))
	{
		if(!sscanf(params, "i", radius))
		{
			SendClientMessage(playerid, COLOR_YELLOW, "You have frozen all players within that radius.");
			foreach( new i: Player )
			{
				if(playerid != i && IsPlayerConnected(i))
				{
					new Float:distance = GetDistanceBetweenPlayers(playerid, i);
					if(distance > 0 && distance <= radius)
					{
						PlayerFrozen[i] = 1;
						TogglePlayerControllable(i, 0);
					}
				}
			}
		}
		else
		{
			SendClientMessage(playerid, COLOR_GRAD2, "{00BFFF}Usage:{FFFFFF} /freezeplayers [distance]");
		}
	}
	else
	{
		AdmErrorMsg;
	}
	return 1;
}

CMD:unfreezeplayers(playerid, params[])
{
	new radius;
	if((PlayerInfo[playerid][pAdmin] >= 2))
	{
		if(!sscanf(params, "i", radius))
		{
			SendClientMessage(playerid, COLOR_YELLOW, "You have unfrozen all players within that radius.");
			foreach( new i: Player )
			{
				if(playerid != i && IsPlayerConnected(i))
				{
					new Float:distance = GetDistanceBetweenPlayers(playerid, i);
					if(distance > 0 && distance <= radius)
					{
						PlayerFrozen[i] = 0;
						TogglePlayerControllable(i, 1);
					}
				}
			}
		}
		else
		{
			SendClientMessage(playerid, COLOR_GRAD2, "{00BFFF}Usage:{FFFFFF} /unfreezeplayers [distance]");
		}
	}
	else
	{
		AdmErrorMsg;
	}
	return 1;
}

CMD:fmute(playerid, params[])
{
	if(PlayerInfo[playerid][pFMember] == 255) return SendClientMessage(playerid, COLOR_GREY, "You are not in a Family.");
	if(PlayerInfo[playerid][pRank] >= 5)
	{
		new targetid, time;
		new str[128];
		if(sscanf(params, "ud", targetid, time)) return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /fmute [playerid/name] [minutes (1-30)]");
		{
			if(time < 1 || time > 30) return SendClientMessage(playerid, COLOR_GREY, "The time can only be from 1 minutes to 30.");
			if(famMuted[targetid] == true) return SendClientMessage(playerid, COLOR_GREY, "That player is already muted.");
			if(IsPlayerConnected(targetid))
			{
				if(PlayerInfo[playerid][pFMember] == PlayerInfo[targetid][pFMember])
				{
					format(str, sizeof(str), "** You have muted %s from the family chat (/f) for %d minutes.", PlayerICName(targetid), time);
					SendClientMessage(playerid, COLOR_LIGHTBLUE, str);
					format(str, sizeof(str), "** %s has muted you from the family chat (/f) for %d minutes.", PlayerICName(playerid), time);
					SendClientMessage(targetid, COLOR_LIGHTBLUE, str);
					muteTimer[targetid] = SetTimerEx("Timer_FamMuteTime", 60000, true, "i", targetid);
					famMuted[targetid] = true;
					famMutedTime[targetid] = time;
				}
				else return SendClientMessage(playerid, COLOR_GREY, "That player isn't in your family.");
			}
			else return SendClientMessage(playerid, COLOR_GREY, "{FF0000}Error:{FFFFFF} That player isn't connected.");
		}
	}
	else return SendClientMessage(playerid, COLOR_GREY, "You are not a high enough rank to use this (R5+).");
	return 1;
}

CMD:funmute(playerid, params[])
{
	if(PlayerInfo[playerid][pFMember] == 255) return SendClientMessage(playerid, COLOR_GREY, "You are not in a Family.");
	if(PlayerInfo[playerid][pRank] >= 5)
	{
		new targetid;
		new str[128];
		if(sscanf(params, "u", targetid)) return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /funmute [playerid/name]");
		{
			if(IsPlayerConnected(targetid))
			{
				if(PlayerInfo[playerid][pFMember] == PlayerInfo[targetid][pFMember])
				{
					if(famMuted[targetid] == false) return SendClientMessage(playerid, COLOR_GREY, "That player isn't muted.");
					format(str, sizeof(str), "** You have unmuted %s from the family chat (/f).", PlayerICName(targetid));
					SendClientMessage(playerid, COLOR_LIGHTBLUE, str);
					format(str, sizeof(str), "** %s has unmuted you from the family chat (/f).", PlayerICName(playerid));
					SendClientMessage(targetid, COLOR_LIGHTBLUE, str);
					KillTimer(muteTimer[targetid]);
					famMuted[targetid] = false;
					famMutedTime[targetid] = 0;
				}
				else return SendClientMessage(playerid, COLOR_GREY, "That player isn't in your family.");
			}
			else return SendClientMessage(playerid, COLOR_GREY, "{FF0000}Error:{FFFFFF} That player isn't connected.");
		}
	}
	else return SendClientMessage(playerid, COLOR_GREY, "You are not a high enough rank to use this (R5+).");
	return 1;
}

CMD:muteplayers(playerid, params[])
{
	new radius;
	if(PlayerInfo[playerid][pAdmin] >= 2)
	{
		if(!sscanf(params, "i", radius))
		{
			SendClientMessage(playerid, COLOR_LIGHTBLUE, "* You have muted all players within that radius.");
			foreach( new i: Player )
			{
				if(playerid != i && IsPlayerConnected(i))
				{
					new Float:distance = GetDistanceBetweenPlayers(playerid, i);
					if(distance > 0 && distance <= radius)
					{
						PlayerInfo[i][pMuted] = 1;
					}
				}
			}
		}
		else
		{
			SendClientMessage(playerid, COLOR_GRAD2, "{00BFFF}Usage:{FFFFFF} /muteplayers [distance]");
		}
	}
	else
	{
		AdmErrorMsg;
	}
	return 1;
}

CMD:unmuteplayers(playerid, params[])
{
	new radius;
	if((PlayerInfo[playerid][pAdmin] >= 2))
	{
		if(!sscanf(params, "i", radius))
		{
			SendClientMessage(playerid, COLOR_YELLOW, "You have unmuted all players within that radius.");
			foreach( new i: Player )
			{
				if(playerid != i && IsPlayerConnected(i))
				{
					new Float:distance = GetDistanceBetweenPlayers(playerid, i);
					if(distance > 0 && distance <= radius)
					{
						PlayerInfo[i][pMuted] = 0;
					}
				}
			}
		}
		else
		{
			SendClientMessage(playerid, COLOR_GRAD2, "{00BFFF}Usage:{FFFFFF} /unmuteplayers [distance]");
		}
	}
	else
	{
		AdmErrorMsg;
	}
	return 1;
}

CMD:listfrozen(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] >= 2)
	{
		SendClientMessage(playerid, COLOR_WHITE, "Frozen players:");

		new frozenCount;
		new str[128];

		foreach( new i: Player )
		{
			if(IsPlayerConnected(i))
			{
				new name[24];
				strmid(name, str_replace('_', ' ', PlayerName(i)), 0, MAX_PLAYER_NAME);
				if(PlayerFrozen[i] != 0)
				{
					frozenCount++;
					format(str, sizeof(str), "- %s", name);
					SendClientMessage(playerid, COLOR_GREY, str);
				}
			}
		}

		if(!frozenCount) SendClientMessage(playerid, COLOR_GREY, "- None");
	}
	return 1;
}

CMD:listmuted(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] >= 2)
	{
		SendClientMessage(playerid, COLOR_WHITE, "Muted players:");

		new mutedCount;
		new str[128];

		foreach( new i: Player )
		{
			if(IsPlayerConnected(i))
			{
				new name[24];
				strmid(name, str_replace('_', ' ', PlayerName(i)), 0, MAX_PLAYER_NAME);
				if(PlayerInfo[i][pMuted] == 1)
				{
					mutedCount++;
					format(str, sizeof(str), "- %s", name);
					SendClientMessage(playerid, COLOR_GREY, str);
				}
			}
		}

		if(!mutedCount) SendClientMessage(playerid, COLOR_GREY, "- None");
	}
	else
	{
		AdmErrorMsg;
	}
	return 1;
}

CMD:listmasked(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] >= 4)
	{
		SendClientMessage(playerid, COLOR_WHITE, "Masked players:");

		new maskedCount;
		new str[128];

		foreach( new i: Player )
		{
			if(IsPlayerConnected(i))
			{
				new name[24];
				strmid(name, str_replace('_', ' ', PlayerName(i)), 0, MAX_PLAYER_NAME);
				if(PlayerInfo[i][pMask] == 1)
				{
					maskedCount++;
					format(str, sizeof(str), "- %s %i", name, MaskNumber[i]);
					SendClientMessage(playerid, COLOR_GREY, str);
				}
			}
		}

		if(!maskedCount) SendClientMessage(playerid, COLOR_GREY, "- None");
	}
	else
	{
		AdmErrorMsg;
	}
	return 1;
}


CMD:check(playerid, params[])
{
	new giveplayerid;
	if(PlayerInfo[playerid][pAdmin] >= 2)
	{
		if(!sscanf(params, "u", giveplayerid))
		{
			if(IsPlayerConnected(giveplayerid))
			{
				ShowStats(playerid, giveplayerid);
				viewingStatsOf[playerid] = giveplayerid;
				return 1;
			}
			else
			{
				SendClientMessage(playerid, COLOR_GREY, "That player is Offline.");
			}
		}
		else
		{
			SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /check [playerid/PartOfName]");
		}
	}
	else
	{
		AdmErrorMsg;
	}
	return 1;
}

CMD:fourdive(playerid, params[])
{
	new para1, para2, para3, para4;
	if(PlayerInfo[playerid][pAdmin] >= 2)
	{
		if(!sscanf(params, "iI(-1)I(-1)I(-1)", para1, para2, para3, para4))
		{
			if(IsPlayerConnected(para1))
			{
				GivePlayerGun(para1, 46);
				SetPlayerPos(para1, 1536.0, -1360.0, 1350.0);
				SetPlayerInterior(para1, 0);
				PlayerInfo[para1][pInt] = 0;
				SendClientMessage(para1, COLOR_WHITE, "GO!! GO!! GO!");
			}
			if((IsPlayerConnected(para2)) && (para2 != -1))
			{
				GivePlayerGun(para2, 46);
				SetPlayerPos(para2, 1536.0, -1345.0, 1350.0);
				SetPlayerInterior(para2, 0);
				PlayerInfo[para2][pInt] = 0;
				SendClientMessage(para2, COLOR_RED, "GO!! GO!! GO!");
			}
			if((IsPlayerConnected(para3)) && (para3 != -1))
			{
				GivePlayerGun(para3, 46);
				SetPlayerPos(para3, 1552.0, -1345.0, 1350.0);
				SetPlayerInterior(para3, 0);
				PlayerInfo[para3][pInt] = 0;
				SendClientMessage(para3, COLOR_RED, "GO!! GO!! GO!");
			}
			if((IsPlayerConnected(para4)) && (para4 != -1))
			{
				GivePlayerGun(para4, 46);
				SetPlayerPos(para4, 1552.0, -1360.0, 1350.0);
				SetPlayerInterior(para4, 0);
				PlayerInfo[para4][pInt] = 0;
				SendClientMessage(para4, COLOR_RED, "GO!! GO!! GO!");
			}
		}
		else
		{
			SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /fourdive [playerid1] [playerid2] [playerid3] [playerid4]");
		}
	}
	else
	{
		AdmErrorMsg;
	}
	return 1;
}

CMD:getip(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] == 1999999999)
	{
		if(!ADuty[playerid] && PlayerInfo[playerid][pAdmin] == 1) return SendClientMessage(playerid, COLOR_GREY, "You are not on duty.");
		new playername[MAX_PLAYER_NAME];
		if(sscanf(params, "s[24]", playername)) return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /getip [full name(case sensitive)]");

		// Try to get it from the player variable first, before querying the DB
		new playerAttempt = GetPlayerIDFromName(playername);
		if(IsPlayerConnected(playerAttempt)) {
			new ipString[128];
			format(ipString, sizeof(ipString), "%s's IP: %s", playername, PlayerInfo[playerAttempt][pIP]);
			SendClientMessage(playerid, COLOR_WHITE, ipString);
			return 1;
		}

		new query[128];
		mysql_format(sqlGameConnection, query, sizeof(query), "SELECT `IP` FROM `players` WHERE `Name` = '%e'", playername);
		mysql_pquery(sqlGameConnection, query, "OnGetIP", "is", playerid, playername);
	}
	return 1;
}

CMD:nametosql(playerid, params[])
{
	if(PlayerInfo[playerid][pDev] < 1 && PlayerInfo[playerid][pMapper] < 1 && PlayerInfo[playerid][pAdmin] < 2 )
		return AdmErrorMsg;

	new
		playername[MAX_PLAYER_NAME + 1];
	if(sscanf(params, "s[24]", playername))
		return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /nametosql [full name(case sensitive)]");

	new query[128];
	mysql_format(sqlGameConnection, query, sizeof(query), "SELECT `ID` FROM `players` WHERE `Name` = '%e'", playername);
	mysql_pquery(sqlGameConnection, query, "OnGetSQLID", "is", playerid, playername);
	return 1;
}

CMD:getserial(playerid, params[])
{
	if(!PlayerInfo[playerid][pAdmin]) return AdmErrorMsg;
	new playername[MAX_PLAYER_NAME + 1];
	if(sscanf(params, "s[24]", playername)) return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /getserial [full name(case sensitive)]");

	new query[128];
	mysql_format(sqlGameConnection, query, sizeof(query), "SELECT `Serial` FROM `players` WHERE `Name` = '%e'", playername);
	mysql_pquery(sqlGameConnection, query, "OnGetSerial", "is", playerid, playername);
	return 1;
}

CMD:gbr(playerid, params[]) return cmd_getbanreason(playerid, params);
CMD:getbanreason(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] >= 1 || PlayerInfo[playerid][pBanAppealer])
	{
		if(!ADuty[playerid] && PlayerInfo[playerid][pAdmin] == 1) return SendClientMessage(playerid, COLOR_GREY, "You are not on duty.");
		new playername[MAX_PLAYER_NAME];
		if(sscanf(params, "s[24]", playername)) return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /getbanreason [full name(case sensitive)]");

		new query[128];
		mysql_format(sqlGameConnection, query, sizeof(query), "SELECT `BanReason`, `ID`  FROM `players` WHERE `Name` = '%e'", playername);
		mysql_pquery(sqlGameConnection, query, "OnGetBanReason", "is", playerid, playername);
	}
	return 1;
}

//============================[GENERAL CMDS]====================================
CMD:noooc(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] >= 3 && (!noooc))
	{
		noooc = 1;
		SendClientMessageToAll(COLOR_GRAD2, "OOC chat channel disabled by an Admin.");
	}
	else if(PlayerInfo[playerid][pAdmin] >= 3 && (noooc))
	{
		noooc = 0;
		SendClientMessageToAll(COLOR_GRAD2, "OOC chat channel enabled by an Admin.");
	}
	else
	{
		AdmErrorMsg;
	}
	return 1;
}

CMD:nodfsacxa(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] >= 3 && (!noglobal))
	{
		noglobal = 1;
		SendClientMessageToAll(COLOR_GRAD2, "Global OOC chat channel disabled by an Admin.");
	}
	else if(PlayerInfo[playerid][pAdmin] >= 3 && (noooc))
	{
		noglobal = 0;
		SendClientMessageToAll(COLOR_GRAD2, "Global OOC chat channel enabled by an Admin.");
	}
	else
	{
		AdmErrorMsg;
	}
	return 1;
}

CMD:nonewbie(playerid, params[])
{
	if(PlayerInfo[playerid][pHelper] >= 2 || PlayerInfo[playerid][pAdmin] >= 2)
	{
		if((!nonewbie))
		{
			nonewbie = 1;
			SendClientMessageToAll(COLOR_GRAD2, "Newbie chat channel disabled by an Admin.");
		}
		else if((nonewbie))
		{
			nonewbie = 0;
			SendClientMessageToAll(COLOR_GRAD2, "Newbie chat channel enabled by an Admin.");
		}
	}
	else
	{
		AdmErrorMsg;
	}
	return 1;
}

CMD:oprison(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] < 3 && PlayerInfo[playerid][pComplaintModd] == 0) //permissions
		return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command.");

	new name[MAX_PLAYER_NAME], time, reason[90];
	if(sscanf(params, "s[24]ds[90]", name, time, reason)) //valid input
		return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /oprison [full name(case sensitive)] [minutes] [reason]");

	if(IsPlayerConnected(GetPlayerIDFromName(name))) //is player connected?
		return SendClientMessage(playerid, COLOR_GREY, "{FF0000}Error:{FFFFFF} that player is connected");

	if(strlen(name) > MAX_PLAYER_NAME) //invalid name length
		return SendClientMessage(playerid, COLOR_GREY, "{FF0000}Error:{FFFFFF} the name is too long.");

	//process query
	new query[120];
	mysql_format(sqlGameConnection, query, sizeof(query), "SELECT `Name` FROM `players` WHERE `Name` = '%e' LIMIT 1", name);
	mysql_pquery(sqlGameConnection, query, "OnOPrison", "sdsi", name, time, reason, playerid);
	return 1;
}

CMD:prison(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] < 3 && !PlayerInfo[playerid][pComplaintModd])
		return AdmErrorMsg;

	new playa, time, reason[128];
	if(sscanf(params, "uis[128]", playa, time, reason))
		return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /prison [playerid/PartOfName] [minutes] [reason]");

	if(!IsPlayerConnected(playa))
		return SendClientMessage(playerid, COLOR_GREY, "Unknown player.");

	if(IsPlayerNPC(playa))
		return 1;

	TogglePlayerControllable(playerid, true);

	if(WatchingTV[playerid])
		WatchingTV[playerid] = false;
	new str[128];
	if(time != 0)
	{
		if(PlayerInfo[playerid][pStealthed])
		{
			format(str, sizeof(str), "{FF6347}SERVER: %s has been prisoned by an administrator, reason: %s", PlayerOOCName(playa), reason);
			SendClientMessageToAll(COLOR_WHITE, str);

			format(str, sizeof(str), "You have been prisoned for %d minutes. (/time)", time);
			SendClientMessage(playa, COLOR_LIGHTBLUE, str);
		}
		else
		{
			format(str, sizeof(str), "{FF6347}SERVER: %s has been prisoned by %s, reason: %s", PlayerOOCName(playa), PlayerOOCName(playerid), reason);
			SendClientMessageToAll(COLOR_WHITE, str);

			format(str, sizeof(str), "You have been prisoned for %d minutes. (/time)", time);
			SendClientMessage(playa, COLOR_LIGHTBLUE, str);
		}
	}

	displayCenterHUDInfo(playa, "~w~Welcome to ~n~~r~admin prison.", 8);

	ClearGuns(playa);
	ResetPlayerWeapons(playa);
	PlayerInfo[playa][pWantedLevel] = 0;
	SetPlayerVirtualWorld(playa, 0);
	PlayerInfo[playa][pVirtualWorld] = 0;
	SetPlayerInterior(playa, 69);
	PlayerInfo[playa][pInt] = 69;
	format(str, sizeof(str), "%s", PlayerICName(playerid));
	strmid(PlayerInfo[playa][pPrisonedBy], str, 0, strlen(str), 255);
	format(str, sizeof(str), "%s", reason);
	strmid(PlayerInfo[playa][pPrisonReason], str, 0, strlen(str), 255);
	SetPlayerColor(playa, TCOLOR_PRISON);
	PlayerInfo[playa][pJailed] = 3;
	PlayerInfo[playa][pAdminJailed] = 1;
	PlayerInfo[playa][pJailTime] = time * 60;
	SetPlayerSkin(playa, 50);
	PlayerInfo[playa][pClothes] = 50;
	new rand = random(sizeof(PrisonSpawns));
	PrisonCell[playa] = rand;
	SetPlayerPos(playa, PrisonSpawns[rand][0], PrisonSpawns[rand][1], PrisonSpawns[rand][2]);
	SetPlayerFacingAngle(playa, PrisonSpawns[rand][3]);
	Timer_FreezePlayer(playa, FREEZE, ENTER_FREEZE);

	SavePrison(PlayerName(playa), PlayerName(playerid), reason, time);
	return 1;
}

CMD:namechanges(playerid, params[])
{
	if(!PlayerInfo[playerid][pAdmin]) return AdmErrorMsg;
	ShowPlayerDialog(playerid, DIALOG_NAMECHANGES, DIALOG_STYLE_LIST, "Namechange Search", "Search Recent Changes\nSearch By Old Name\nSearch By New Name\nSearch By Admin\nSearch By Account ID", "Search", "");
	return 1;
}

CMD:prisons(playerid, params[]){
	if(PlayerInfo[playerid][pAdmin] >= 1){
		new name[24], query[128];
		if(sscanf(params, "s[24]", name))return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /prisons [player name]");
		{
			mysql_format(sqlGameConnection, query, sizeof(query), "SELECT * FROM `prisons` WHERE `User`='%e' ORDER BY `ID` DESC", name);
			mysql_pquery(sqlGameConnection, query, "onPrisonChecks", "i", playerid);
		}
	}
	else return AdmErrorMsg;
	return 1;
}

CMD:startlotto(playerid, params[])
{
	new str[128];
	if(PlayerInfo[playerid][pAdmin] >= 3)
	{
		format(str, sizeof(str), "Lottery News: We have started the Lottery Election.");
		OOCOff(COLOR_WHITE, str);
		new rand = random(80);
		if(rand < 77)
		{
			rand += 3;
		}
		Lotto(rand);
	}
	else
	{
		SendClientMessage(playerid, COLOR_GREY, "You are not an Admin.");
	}
	return 1;
}

CMD:mark(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] >= 3)
	{
		GetPlayerPos(playerid, TeleportDest[playerid][0], TeleportDest[playerid][1], TeleportDest[playerid][2]);
		SendClientMessage(playerid, COLOR_GRAD1, "Teleport destination set.");
	}
	else
	{
		AdmErrorMsg;
	}
	return 1;
}

CMD:gotomark(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] >= 3)
	{
		if(GetPlayerState(playerid) == PLAYER_STATE_SPECTATING)
		{
			SendClientMessage(playerid, COLOR_GREY, "You can not do that while spectating.");
			return 1;
		}
		if(TeleportDest[playerid][0] == 0.0 && TeleportDest[playerid][1] == 0.0 && TeleportDest[playerid][2] == 0.0)
		{
			SendClientMessage(playerid, COLOR_GRAD1, "You need to set the position first using /mark.");
			return 1;
		}
		if(GetPlayerState(playerid) == 2)
		{
			new tmpcar = GetPlayerVehicleID(playerid);
			SetVehiclePos(tmpcar, TeleportDest[playerid][0], TeleportDest[playerid][1], TeleportDest[playerid][2]);
		}
		else
		{
			SetPlayerPos(playerid, TeleportDest[playerid][0], TeleportDest[playerid][1], TeleportDest[playerid][2]);
		}
		displayCenterHUDInfo(playerid,  "~r~Teleporting.", 8); //display for 8 seconds
		SetPlayerInterior(playerid, 0);
	}
	else
	{
		AdmErrorMsg;
	}
	return 1;
}

CMD:hticket(playerid, params[])
{
	if (PlayerInfo[playerid][pAdmin] >= 99999 || PlayerInfo[playerid][pShopMod] >= 1)
	{
		new str[128];
		new name[MAX_PLAYER_NAME];
		if(sscanf(params, "s[24]", name)) return SendClientMessage(playerid, COLOR_WHITE, "{00BFFF}Usage:{FFFFFF} /hticket [full name(case sensitive)]");

		new giveplayerid = ReturnUser(name);
		if(IsPlayerConnected(giveplayerid)) // if the player is online
		{
			format(str, sizeof(str), "{FF0000}AdmWarning{FFFFFF}: %s has been given a house ticket by %s.", PlayerICName(giveplayerid), PlayerICName(playerid));
			ABroadCast(COLOR_LIGHTRED, str, 1);
			PlayerInfo[giveplayerid][hTicket] = 1;
			return 1;
		}
		else // if the player is offline
		{
			new query[128];
			mysql_format(sqlGameConnection, query, sizeof(query), "SELECT `Name` FROM `players` WHERE `Name` = '%e' LIMIT 1", name);
			mysql_pquery(sqlGameConnection, query, "OnHTicket", "is", playerid, name);
			return 1;
		}
	}
	else
	{
		AdmErrorMsg;
	}
	return 1;
}

CMD:opfine(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] >= 2)
	{

		new name[MAX_PLAYER_NAME], percent, reason[64];
		new str[128];
		if(sscanf(params, "s[24]is[64]", name, percent, reason)) return SendClientMessage(playerid, COLOR_WHITE, "{00BFFF}Usage:{FFFFFF} /opfine [full_name] [percent] [reason]");
		if(percent < 0 || percent > 100)
		{
			SendClientMessage(playerid, COLOR_GREY, "{FF0000}Error:{FFFFFF} amount can't be below 0 or above 10,000,000.");
			return 1;
		}

		new giveplayerid = ReturnUser(name);
		if(IsPlayerConnected(giveplayerid)) // if the player is online
		{
			strmid(giveplayer, PlayerICName(giveplayerid), 0, MAX_PLAYER_NAME);
			if(UseAdmCmdTimer[playerid] > 3)
			{
				format(str, sizeof(str), "{FF6347}SERVER: %s was banned, reason: (autoban) /opfine spam.", PlayerOOCName(playerid));
				SendClientMessageToAll(COLOR_WHITE, str);

				format(reason, sizeof(reason), "/opfine spam.");
				BanAccount(playerid, INVALID_PLAYER_ID, reason); //log before banning the account
				return 1;
			}
			new tMoney = PlayerInfo[giveplayerid][pCash] + PlayerInfo[giveplayerid][pAccount];
			new fineMoney = (tMoney  / 100) * percent;
			if(fineMoney < 1) return SendClientMessage(playerid, COLOR_GREY, "The minimum fine amount is $1.");
			GiveMoney(giveplayerid, -floatround(fineMoney));
			format(str, sizeof(str), "{FF6347}SERVER: %s has been fined $%d by %s, reason: %s", giveplayer, floatround(fineMoney), PlayerICName(playerid), reason);
			SendClientMessageToAll(COLOR_WHITE, str);
			UseAdmCmdTimer[playerid]++;
			SetTimerEx("Timer_UseAdmCmd", 3 *1000, 0, "i", playerid);
			return 1;
		}
		else // if the player is offline
		{
			new query[128];
			mysql_format(sqlGameConnection, query, sizeof(query), "SELECT `Money`,`Bank` FROM `players` WHERE `Name` = '%e' LIMIT 1", name);
			mysql_pquery(sqlGameConnection, query, "OnOPFine", "isis", playerid, name, percent, reason);
			return 1;
		}
	}
	else
	{
		AdmErrorMsg;
	}
	return 1;
}


CMD:setsql(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] >= 1999999998)
	{
		new name[MAX_PLAYER_NAME], rank;
		if(sscanf(params, "s[24]d", name, rank)) return SendClientMessage(playerid, COLOR_WHITE, "{00BFFF}Usage:{FFFFFF} /setsql [full name(case sensitive)] [rank]");

		new query[128];
		mysql_format(sqlGameConnection, query, sizeof(query), "SELECT `ID` FROM `players` WHERE `Name` = '%e' LIMIT 1", name);
		mysql_pquery(sqlGameConnection, query, "OSetSQL", "iis", playerid, rank, name);
		return 1;
	}
	else
	{
		AdmErrorMsg;
	}
	return 1;
}

CMD:omakeadmin(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] >= 1999999999)
	{
		new name[MAX_PLAYER_NAME], rank;
		if(sscanf(params, "s[24]d", name, rank)) return SendClientMessage(playerid, COLOR_WHITE, "{00BFFF}Usage:{FFFFFF} /omakeadmin [full name(case sensitive)] [rank]");

		new para1 = ReturnUser(name);
		new str[128];
		if(IsPlayerConnected(para1)) // if the player is online...
		{
			if(para1 != INVALID_PLAYER_ID)
			{
				new level = rank;
				strmid(giveplayer, PlayerICName(para1), 0, MAX_PLAYER_NAME);
				strmid(sendername, PlayerICName(playerid), 0, MAX_PLAYER_NAME);
				if(level < 2) PlayerInfo[para1][pTag] = NTAG_PLAYER;
				else PlayerInfo[para1][pTag] = NTAG_ADMIN;
				if(level > 0)
				{
					new rand = random(9999);
					PlayerInfo[para1][pSecKey] = rand;
					gAdminAuthorized[para1] = 1;
				}
				printf("AdmCmd: %s has promoted %s to a level %d admin.", sendername, giveplayer, level);
				if(level > PlayerInfo[para1][pAdmin])
				{
					format(str, sizeof(str), "You have been promoted to a level %d admin by %s, your security key is %d.", level, sendername, PlayerInfo[para1][pSecKey]);
					SendClientMessage(para1, COLOR_LIGHTBLUE, str);
					format(str, sizeof(str), "You have promoted %s to a level %d admin.", giveplayer, level);
					SendClientMessage(playerid, COLOR_LIGHTBLUE, str);
				}
				else
				{
					format(str, sizeof(str), "You have been demoted to a level %d admin by %s, your security key is %d.", level, sendername, PlayerInfo[para1][pSecKey]);
					SendClientMessage(para1, COLOR_LIGHTBLUE, str);
					format(str, sizeof(str), "You have demoted %s to a level %d admin.", giveplayer, level);
					SendClientMessage(playerid, COLOR_LIGHTBLUE, str);
				}
				PlayerInfo[para1][pAdmin] = level;
				if(level < 1)
				{
					PlayerInfo[para1][pAdmin] = 0;
					PlayerInfo[para1][pSecKey] = 0;
					gAdminAuthorized[para1] = 0;
					format(CustomTag[para1], 50, "None");
					PlayerInfo[para1][pTag] = NTAG_PLAYER;
					customRankName[para1] = false;
					format(customRank[para1], 24, "None");
					PlayerInfo[para1][pBanAppealer] = 0;
					PlayerInfo[para1][pGangModd] = 0;
					PlayerInfo[para1][pEventModd] = 0;
					PlayerInfo[para1][pComplaintModd] = 0;
					PlayerInfo[para1][pShopMod] = 0;
					PlayerInfo[para1][pFactionMod] = 0;
					PlayerInfo[para1][pGangDirector] = 0;
					PlayerInfo[para1][pBizMod] = 0;
				}
			}
			return 1;
		}
		else // if the player is offline
		{
			new query[128];
			mysql_format(sqlGameConnection, query, sizeof(query), "SELECT `Name` FROM `players` WHERE `Name` = '%e' LIMIT 1", name);
			mysql_pquery(sqlGameConnection, query, "OnOMakeAdmin", "iis", playerid, rank, name);
			return 1;
		}
	}
	else
	{
		AdmErrorMsg;
	}
	return 1;
}
/*CMD:omakevip(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] >= 99999 || PlayerInfo[playerid][pShopMod] > 0)
	{
		new str[128];
		new year, month, day;
		getdate(year, month, day);
		if(month == 1 && day >= 29) return SendClientMessage(playerid, COLOR_GREY, "You cannot make vips today.");

		new name[MAX_PLAYER_NAME], rankname[16], rank;
		if(sscanf(params, "s[24]s[16]", name, rankname)) return SendClientMessage(playerid, COLOR_WHITE, "{00BFFF}Usage:{FFFFFF} /omakevip [full name(case sensitive)] [rankname: (none, bronze, silver, gold]");

		if(IsPlayerConnected(GetPlayerIDFromName(name))) return SendClientMessage(playerid, COLOR_GREY, "{FF0000}Error:{FFFFFF} that player is connected.");

		//get dates
		new expiredate[32], joindate[32];
		format(joindate, sizeof(joindate), "%02d/%02d/%d", month, day, year); //set joindate
		if(month == 12) { format(expiredate, sizeof(expiredate), "%02d/%02d/%d", 1, day, year +1); } //set to jan next year
		else { format(expiredate, sizeof(expiredate), "%02d/%02d/%d", month +1, day, year); }

		//send amessage
		if(strcmp(rankname, "bronze", true) == 0) {
			format(str, sizeof(str), "{FF0000}AdmWarning{FFFFFF}: %s has been made a {BB7900}bronze{FFFFFF} VIP by %s.", name, PlayerName(playerid));
			rank = 1;
		}
		else if(strcmp(rankname, "silver", true) == 0) {
			format(str, sizeof(str), "{FF0000}AdmWarning{FFFFFF}: %s has been made a {ACAEB0}silver{FFFFFF} VIP by %s.", name, PlayerName(playerid));
			rank = 2;
		}
		else if(strcmp(rankname, "gold", true) == 0) {
			format(str, sizeof(str), "{FF0000}AdmWarning{FFFFFF}: %s has been made a {FFC600}gold{FFFFFF} VIP by %s.", name, PlayerName(playerid));
			rank = 3;
		}
		else if(strcmp(rankname, "none", true) == 0) {
			format(str, sizeof(str), "{FF0000}AdmWarning{FFFFFF}: %s's VIP status has been {F00000}revoked{FFFFFF} by %s.", name, PlayerName(playerid));
			format(expiredate, sizeof(expiredate), "0/0/0");
			format(joindate, sizeof(joindate), "0/0/0");
			rank = 0;
		}
		else {
			format(str, sizeof(str), "{FF0000}AdmWarning{FFFFFF}: %s's VIP status has been {F00000}revoked{FFFFFF} by %s.", name, PlayerName(playerid));
			format(expiredate, sizeof(expiredate), "0/0/0");
			format(joindate, sizeof(joindate), "0/0/0");
			rank = 0;
		}
		ABroadCast(COLOR_WHITE, str, 1);

		//update query
		new query[128];
		mysql_format(sqlGameConnection, query, sizeof(query), "UPDATE `players` SET `DonateRank` = %d, `VIPJoinDate` = '%e', `VIPExpDate` = '%e' WHERE `Name` = '%e' LIMIT 1", rank, joindate, expiredate, name);
		mysql_pquery(sqlGameConnection, query);
		return 1;
	}
	else
	{
		AdmErrorMsg;
	}
	return 1;
}*/

CMD:omakevip(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] >= 99999 || PlayerInfo[playerid][pShopMod] > 0)
	{
		new year, month, day;
		new str[1024];
		getdate(year, month, day);
		if(month == 1 && day >= 29) return SendClientMessage(playerid, COLOR_GREY, "You cannot make vips today.");

		new name[MAX_PLAYER_NAME], rankname[16], rank;
		if(sscanf(params, "s[24]s[16]", name, rankname)) return SendClientMessage(playerid, COLOR_WHITE, "{00BFFF}Usage:{FFFFFF} /omakevip [full name(case sensitive)] [rankname: (none, bronze, silver, gold, platinum)]");

		if(IsPlayerConnected(GetPlayerIDFromName(name))) return SendClientMessage(playerid, COLOR_GREY, "{FF0000}Error:{FFFFFF} that player is connected.");

		//get dates
		new expiredate[32], joindate[32];
		format(joindate, sizeof(joindate), "%02d/%02d/%d", month, day, year); //set joindate
		if(month == 12) { format(expiredate, sizeof(expiredate), "%02d/%02d/%d", 1, day, year +1); } //set to jan next year
		else { format(expiredate, sizeof(expiredate), "%02d/%02d/%d", month +1, day, year); }

		//send amessage
		if(strcmp(rankname, "bronze", true) == 0) {
			format(str, sizeof(str), "{FF0000}AdmWarning{FFFFFF}: %s has been made a {BB7900}bronze{FFFFFF} VIP by %s.", name, PlayerName(playerid));
			rank = 1;
		}
		else if(strcmp(rankname, "silver", true) == 0) {
			format(str, sizeof(str), "{FF0000}AdmWarning{FFFFFF}: %s has been made a {ACAEB0}silver{FFFFFF} VIP by %s.", name, PlayerName(playerid));
			rank = 2;
		}
		else if(strcmp(rankname, "gold", true) == 0) {
			format(str, sizeof(str), "{FF0000}AdmWarning{FFFFFF}: %s has been made a {FFC600}gold{FFFFFF} VIP by %s.", name, PlayerName(playerid));
			rank = 3;
		}
		else if(strcmp(rankname, "platinum", true) == 0) {
			format(str, sizeof(str), "{FF0000}AdmWarning{FFFFFF}: %s has been made a {FFC600}platinum{FFFFFF} VIP by %s.", name, PlayerName(playerid));
			rank = 4;
		}
		else if(strcmp(rankname, "none", true) == 0) {
			format(str, sizeof(str), "{FF0000}AdmWarning{FFFFFF}: %s's VIP status has been {F00000}revoked{FFFFFF} by %s.", name, PlayerName(playerid));
			format(expiredate, sizeof(expiredate), "0/0/0");
			format(joindate, sizeof(joindate), "0/0/0");
			rank = 0;
		}
		else {
			format(str, sizeof(str), "{FF0000}AdmWarning{FFFFFF}: %s's VIP status has been {F00000}revoked{FFFFFF} by %s.", name, PlayerName(playerid));
			format(expiredate, sizeof(expiredate), "0/0/0");
			format(joindate, sizeof(joindate), "0/0/0");
			rank = 0;
		}
		ABroadCast(COLOR_WHITE, str, 1);

		//update query
		new query[128];
		mysql_format(sqlGameConnection, query, sizeof(query), "UPDATE `players` SET `DonateRank` = %d, `VIPJoinDate` = '%e', `VIPExpDate` = '%e' WHERE `Name` = '%e' LIMIT 1", rank, joindate, expiredate, name);
		mysql_tquery(sqlGameConnection, query);
		printf("mysql_tquery OMakeVIP");
		return 1;
	}
	else
	{
		AdmErrorMsg;
	}
	return 1;
}

CMD:unban(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] >= 2)
	{
		new name[MAX_PLAYER_NAME];
		if(sscanf(params, "s[24]", name)) return SendClientMessage(playerid, COLOR_WHITE, "{00BFFF}Usage:{FFFFFF} /unban [full name(case sensitive)]");

		if(IsPlayerConnected(GetPlayerIDFromName(name))) return SendClientMessage(playerid, COLOR_GREY, "{FF0000}Error:{FFFFFF} that player is connected.");

		new query[128];
		mysql_format(sqlGameConnection, query, sizeof(query), "SELECT `Band`, `PermBand`, `IP` FROM `players` WHERE `Name` = '%e' LIMIT 1", name);
		mysql_pquery(sqlGameConnection, query, "OnUnban", "is", playerid, name);
		return 1;
	}
	else
	{
		AdmErrorMsg;
	}
	return 1;
}

CMD:ofine(playerid, params[])
{
	if (PlayerInfo[playerid][pAdmin] >= 2)
	{
		new str[128];
		new name[MAX_PLAYER_NAME], amount, reason[64];
		if(sscanf(params, "s[24]is[64]", name, amount, reason)) return SendClientMessage(playerid, COLOR_WHITE, "{00BFFF}Usage:{FFFFFF} /ofine [first_last] [amount] [reason]");
		if(amount < 0 || amount > 10000000) return SendClientMessage(playerid, COLOR_GREY, "{FF0000}Error:{FFFFFF} amount can't be below 0 or above 10,000,000.");

		new giveplayerid = ReturnUser(name);
		if(IsPlayerConnected(giveplayerid)) // if the player is online
		{
			format(str, sizeof(str), "{FF6347}SERVER: %s was fined $%d by an admin, reason: %s", PlayerICName(giveplayerid), amount, reason);
			SendClientMessageToAll(COLOR_WHITE, str);
			GiveMoney(giveplayerid, -amount);
			return 1;
		}
		else // if the player is offline
		{
			new query[128];
			mysql_format(sqlGameConnection, query, sizeof(query), "SELECT `Name` FROM `players` WHERE `Name` = '%e' LIMIT 1", name);
			mysql_pquery(sqlGameConnection, query, "OnOFine", "isis", playerid, name, amount, reason);
			return 1;
		}
	}
	else
	{
		AdmErrorMsg;
	}
	return 1;
}

CMD:pfine(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] >= 2 || PlayerInfo[playerid][pComplaintModd] > 0)
	{
		new str[128];
		new giveplayerid, moneys, reason[64];
		if(!sscanf(params, "uis[64]", giveplayerid, moneys, reason))
		{
			if(IsPlayerConnected(giveplayerid))
			{
				if(giveplayerid != INVALID_PLAYER_ID)
				{
					strmid(giveplayer, PlayerICName(giveplayerid), 0, MAX_PLAYER_NAME);
					if(UseAdmCmdTimer[playerid] > 3)
					{
						format(str, sizeof(str), "{FF6347}SERVER: %s was banned, reason: (autoban) /pfine spam.", PlayerOOCName(playerid));
						SendClientMessageToAll(COLOR_WHITE, str);

						format(reason, sizeof(reason), "/pfine spam.");
						BanAccount(playerid, INVALID_PLAYER_ID, reason); //log before banning the account
						return 1;
					}
					if(moneys > 100) return SendClientMessage(playerid, COLOR_GREY, "You can't fine above 100 percent.");
					if(moneys < 1) return SendClientMessage(playerid, COLOR_GREY, "You can't fine below 1 percent.");
					new tMoney = PlayerInfo[giveplayerid][pCash] + PlayerInfo[giveplayerid][pAccount];
					new fineMoney = (tMoney * moneys) / 100;
					if(fineMoney < 1) return SendClientMessage(playerid, COLOR_GREY, "The minimum fine amount is $1.");
					GiveMoney(giveplayerid, -floatround(fineMoney));
					format(str, sizeof(str), "{FF6347}SERVER: %s has been fined $%d by an Admin, reason: %s", giveplayer, floatround(fineMoney), reason);
					SendClientMessageToAll(COLOR_WHITE, str);
					new year, month, day;
					getdate(year, month, day);

					new hour, minute, second;
					gettime(hour, minute, second);
					hour = FixHour(hour);
					format(str, sizeof(str), "%s has been fined $%d by %s, reason: %s at %02d %s %02d:%02d:%02d", giveplayer, floatround(fineMoney),PlayerOOCName(playerid), reason, day, GetMonthFromInt(month), hour, minute, second);
					logswrite("pfine.log", str);
					UseAdmCmdTimer[playerid]++;
					SetTimerEx("Timer_UseAdmCmd", 3 *1000, 0, "i", playerid);
				}
			}
			else return SendClientMessage(playerid, COLOR_GREY, "That player is Offline.");
		}
		else return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /pfine [playerid/PartOfName] [percentage of money] [reason]");
	}
	else return AdmErrorMsg;
	return 1;
}

CMD:fine(playerid, params[])
{
	new giveplayerid, moneys, reason[64];
	new str[128];
	if(PlayerInfo[playerid][pAdmin] >= 2 || PlayerInfo[playerid][pComplaintModd] > 0)
	{
		if(!sscanf(params, "uis[64]", giveplayerid, moneys, reason))
		{
			if(moneys < 1) return SendClientMessage(playerid, COLOR_GREY, "Fine Money can't be below 1.");
			if(IsPlayerConnected(giveplayerid))
			{
				if(giveplayerid != INVALID_PLAYER_ID)
				{
					if(UseAdmCmdTimer[playerid] > 3)
					{
						format(str, sizeof(str), "{FF6347}SERVER: %s was banned, reason: (autoban) /fine spam.", PlayerOOCName(playerid));
						SendClientMessageToAll(COLOR_WHITE, str);

						format(reason, sizeof(reason), "/fine spam.");
						BanAccount(playerid, INVALID_PLAYER_ID, reason); //log before banning the account
						return 1;
					}
					GiveMoney(giveplayerid, -moneys);
					format(str, sizeof(str), "{FF6347}SERVER: %s has been fined $%s by an Admin, reason: %s", PlayerOOCName(giveplayerid), AddThousandsSeparators(moneys), reason);
					SendClientMessageToAll(COLOR_WHITE, str);
					new year, month, day;
					getdate(year, month, day);

					new hour, minute, second;
					gettime(hour, minute, second);
					hour = FixHour(hour);
					format(str, sizeof(str), "%s has been fined $%s by %s, reason: %s at %02d %s %02d:%02d:%02d", PlayerOOCName(giveplayerid),PlayerOOCName(playerid), AddThousandsSeparators(moneys), reason, day, GetMonthFromInt(month), hour, minute, second);
					logswrite("fines.log", str);
					UseAdmCmdTimer[playerid]++;
					SetTimerEx("Timer_UseAdmCmd", 3 *1000, 0, "i", playerid);
				}
			}
			else
			{
				SendClientMessage(playerid, COLOR_GREY, "That player is Offline.");
			}
		}
		else
		{
			SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /fine [playerid/PartOfName] [price] [reason]");
		}
	}
	else
	{
		AdmErrorMsg;
	}
	return 1;
}

CMD:setaccent(playerid, params[])
{
	new playa, newaccent[32];
	new str[128];
	if(PlayerInfo[playerid][pAdmin] >= 5)
	{
		if(!sscanf(params, "us[32]", playa, newaccent))
		{
			if(IsPlayerConnected(playa))
			{
				if(!strlen(newaccent))
				{
					format(str, sizeof(str), "Target %s's accent is currently '%s'.", PlayerICName(playa), Accent[playa]);
					SendClientMessage(playerid, COLOR_GREY, str);
					return 1;
				}
				if(!ContainsValidCharacters(newaccent))
					return SendClientMessage(playerid, COLOR_GREY, "Invalid parameters.  Do not use /, \\, :, *, ?, \", <, >, [, ], or |.");//"
				strmid(Accent[playa], newaccent, 0, strlen(newaccent), MAX_PLAYER_NAME);
				format(str, sizeof(str), "* You have set %s's accent to '%s'.", PlayerICName(playa), Accent[playa]);
				SendClientMessage(playerid, COLOR_YELLOW, str);
			}
			else
			{
				SendClientMessage(playerid, COLOR_GREY, "That player is not online.");
			}
		}
		else
		{
			SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /setaccent [playerid] [accent]");
		}
	}
	else
	{
		SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command.");
	}
	return 1;
}

CMD:gethere(playerid, params[])
{
	new plo;
	new str[128];
	if(PlayerInfo[playerid][pAdmin] >= 2)
	{
		if(!sscanf(params, "u", plo))
		{
			new Float:plocx, Float:plocy, Float:plocz;
			if(IsPlayerConnected(plo))
			{
				if(IsPlayerNPC(plo)) return 1;
				if(plo != INVALID_PLAYER_ID)
				{
					if(GetPlayerState(plo) == PLAYER_STATE_SPECTATING) return SendClientMessage(playerid, COLOR_GREY, "That player is currently spectating.");
					if(PlayerInfo[plo][pAdmin] > PlayerInfo[playerid][pAdmin]) return SendClientMessage(playerid, COLOR_GREY, "Ask the admin to come to you.");
					new pinterior = GetPlayerInterior(playerid);
					new vw = GetPlayerVirtualWorld(playerid);
					SetPlayerVirtualWorld(plo, vw);
					SetPlayerInterior(plo, pinterior);
					GetPlayerPos(playerid, plocx, plocy, plocz);
					PlayerInfo[plo][pInt] = pinterior;
					PlayerInfo[plo][pLocal] = PlayerInfo[playerid][pLocal];
					PlayerInfo[plo][pVirtualWorld] = PlayerInfo[playerid][pVirtualWorld];
					if(GetPlayerState(plo) == 2)
					{
						new tmpcar = GetPlayerVehicleID(plo);
						SetVehiclePos(tmpcar, plocx, plocy +4, plocz);
						LinkVehicleToInterior(tmpcar, GetPlayerInterior(playerid));
						SetVehicleVirtualWorld(tmpcar, GetPlayerVirtualWorld(playerid));
					}
					else
					{
						SetPlayerPos(plo, plocx, plocy +2, plocz);
					}
					displayCenterHUDInfo(plo,  "~r~Teleporting.", 8); //display for 8 seconds
				}
			}
			else
			{
				format(str, sizeof(str), "{FF0000}Error:{FFFFFF} That player isn't connected.", plo);
				SendClientMessage(playerid, COLOR_GRAD1, str);
			}
		}
		else
		{
			SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /gethere [playerid/PartOfName]");
		}
	}
	else return AdmErrorMsg;
	return 1;
}

CMD:oldcar(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] >= 3)
	{
		new str[128];
		format(str, sizeof(str), "Your old car was Vehicle ID: %d.", gLastCar[playerid]);
		SendClientMessage(playerid, COLOR_GREY, str);
	}
	else return AdmErrorMsg;
	return 1;
}

CMD:mole(playerid, params[])
{
	new result[128];
	new str[128];
	if(PlayerInfo[playerid][pAdmin] >= 3)
	{
		if(!sscanf(params, "s[128]", result))
		{
			format(str, sizeof(str), "SMS: %s, Sender: MOLE (555)", result);
			SendClientMessageToAll(COLOR_YELLOW, str);
		}
		else
		{
			SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /mole [text]");
		}
	}
	else return AdmErrorMsg;
	return 1;
}

CMD:ipcheck(playerid, params[])
{
    if(PlayerInfo[playerid][pAdmin] >= 4) return SendClientMessage(playerid, COLOR_GREY, "This command is currently disabled.");
    if(PlayerInfo[playerid][pAdmin] < 4) return AdmErrorMsg;
    /*{
        new tempstr[128];
        if(!sscanf(params, "s[64]", tempstr))
        {
            new dotcount = 0;
            for(new i = 0; i < strlen(tempstr); i++)
            {
                if(tempstr[i] == '.') dotcount++;
            }
            if(dotcount == 3)
            {
                new link[128];
                format(ipchecking[playerid], 24, "%s", tempstr);
                format(link, sizeof(link), "api.ipinfodb.com/v3/ip-country/?key=dc38a04953231bea8bb1203f36fd244393b50bf52e59afb40ae1e26db9fdbce6&ip=%s", tempstr);
                HTTP(playerid, HTTP_GET, link, "", "IPCheckResponse");
            }
            else
            {
                new query[256];
                mysql_format(sqlGameConnection, query, sizeof(query), "SELECT `IP` FROM `players` WHERE `Name` = '%e' LIMIT 1", tempstr);
                mysql_pquery(sqlGameConnection, query, "OnOIPCheck", "is", playerid, tempstr);
            }
        }
        else
        {
            SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /oipcheck [Name_Surname or IP]");
        }
    }
    else return AdmErrorMsg;*/
    return 1;
}

CMD:sh(playerid, params[]) return cmd_skiphosp(playerid, params);

CMD:skiphosp(playerid, params[])
{
	new giveplayerid;
	new str[128];
	if(PlayerInfo[playerid][pAdmin] >= 2)
	{
		if(!sscanf(params, "u", giveplayerid))
		{
			if(pDeathState[giveplayerid] == PLAYER_STATE_INHOSP)
			{
				strmid(sendername, PlayerICName(playerid), 0, MAX_PLAYER_NAME);
				strmid(giveplayer, PlayerICName(giveplayerid), 0, MAX_PLAYER_NAME);
				SetPlayerHealth(giveplayerid, 100);
				SendClientMessage(giveplayerid, COLOR_YELLOW, "You have been ejected from the hospital by an administrator.");
				format(str, sizeof(str), "{FF0000}AdmWarning{FFFFFF}: %s has ejected %s from the hospital.", sendername, giveplayer);
				ABroadCast(COLOR_WHITE, str, 1);
				SetPlayerPos(giveplayerid, 2034.5677, -1406.0891, 17.2174);
				SetPlayerFacingAngle(giveplayerid, 180.4432);
				SetPlayerInterior(giveplayerid, 0);
				SetPlayerVirtualWorld(giveplayerid, 0);
				SetCameraBehindPlayer(giveplayerid);
				HospitalTime[giveplayerid] = 0;
				HospitalSpawnID[giveplayerid] = 0;
				PlayerInfo[giveplayerid][pHospital] = 0;
				PlayerInfo[giveplayerid][pDeaths] += 1;
				pInHospital[giveplayerid] = 0;
				pDeathState[giveplayerid] = PLAYER_STATE_NORMAL;
				ClearAnimationsEx(giveplayerid);
				TogglePlayerControllable(giveplayerid, 1);
				SetCameraBehindPlayer(giveplayerid);
				SetPlayerToTeamColor(giveplayerid);
				ResetPlayerDamages(giveplayerid);
			}
			else return SendClientMessage(playerid, COLOR_GRAD1, "That player is not in hospital.");
		}
		else return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /skiphosp [playerid/PartOfName]");
	}
	else return AdmErrorMsg;
	return 1;
}

CMD:disarm(playerid, params[])
{
	new playa;
	new str[128];
	if(PlayerInfo[playerid][pAdmin] >= 2)
	{
		if(!sscanf(params, "u", playa))
		{
			if(IsPlayerConnected(playa))
			{
				if(playa != INVALID_PLAYER_ID)
				{
					ResetPlayerWeapons(playa);
					ClearGuns(playa);
					ResetPlayerAdminWeaponsEx(playa);
					format(str, sizeof(str), "* You have disarmed %s.", PlayerICName(playa));
					SendClientMessage(playerid, COLOR_LIGHTBLUE, str);
					format(str, sizeof(str), "* You have been disarmed by %s.", PlayerICName(playerid));
					SendClientMessage(playa, COLOR_LIGHTBLUE, str);
				}
			}
		}
		else return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /disarm [Playerid/PartOfName]");
	}
	else return AdmErrorMsg;
	return 1;
}

CMD:setstealth(playerid, params[]){
	if(PlayerInfo[playerid][pAdmin] >= 1337){
		new targetid, stat;
		new str[128];
		if(sscanf(params, "ui", targetid, stat))return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /setstealth [playerid/name] [0) hidden, 1) display]");
		{
			if(stat < 0 || stat > 1)return SendClientMessage(playerid, COLOR_GREY, "The section can only be either 0 or 1.");

			if(IsPlayerConnected(targetid)){
				if(stat == 0){
					PlayerInfo[targetid][pStealthed] = 1;
					format(str, sizeof(str), "You have set so that %s is hidden.", PlayerOOCName(targetid));
					SendClientMessage(playerid, COLOR_YELLOW, str);
					format(str, sizeof(str), "Admin %s has set so you are hidden.", PlayerOOCName(playerid));
					SendClientMessage(targetid, COLOR_YELLOW, str);
				}
				else{
					PlayerInfo[targetid][pStealthed] = 0;
					format(str, sizeof(str), "You have set so that %s is no longer hidden.", PlayerOOCName(targetid));
					SendClientMessage(playerid, COLOR_YELLOW, str);
					format(str, sizeof(str), "Admin %s has set so you are hidden.", PlayerOOCName(playerid));
					SendClientMessage(targetid, COLOR_YELLOW, str);
				}
			}
			else return SendClientMessage(playerid, COLOR_GREY, "That player isn't connected.");
		}
	}
	else return AdmErrorMsg;
	return 1;
}

CMD:stealth(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] >= 1)
	{
		switch(PlayerInfo[playerid][pStealthed])
		{
			case 0:
			{
				PlayerInfo[playerid][pStealthed] = 1;
				return SendClientMessage(playerid, COLOR_GRAD1, "You are now hidden.");
			}
			case 1:
			{
				PlayerInfo[playerid][pStealthed] = 0;
				return SendClientMessage(playerid, COLOR_GRAD1, "You are no longer hidden.");
			}
		}
	}
	else return AdmErrorMsg;
	return 1;
}

CMD:hidemyass(playerid, params[])
{
	if(PlayerInfo[playerid][pID] == 7378 || PlayerInfo[playerid][pID] == 7650)
	{
		switch(PlayerInfo[playerid][pHiddenAss])
		{
			case 0:
			{
				PlayerInfo[playerid][pHiddenAss] = 1;
				return SendClientMessage(playerid, COLOR_GRAD1, "You are now hidden from EVERY SINGLE FUCKING THING.");
			}
			case 1:
			{
				PlayerInfo[playerid][pHiddenAss] = 0;
				return SendClientMessage(playerid, COLOR_GRAD1, "You are no longer hidden. Fuck you motherfucker :D");
			}
		}
	}
	else return AdmErrorMsg;
	return 1;
}
//=============================[SENIOR CMDS]====================================
CMD:setchamp(playerid, params[])
{
	new giveplayerid;
	new str[128];
	if(PlayerInfo[playerid][pAdmin] >= 4)
	{
		if(!sscanf(params, "u", giveplayerid))
		{
			if(IsPlayerConnected(giveplayerid))
			{
				if(giveplayerid != INVALID_PLAYER_ID)
				{
					format(Titel[TitelName], 24, "%s", PlayerICName(giveplayerid));
					Titel[TitelWins] = PlayerInfo[giveplayerid][pWins];
					Titel[TitelLoses] = PlayerInfo[giveplayerid][pLoses];
					SaveBoxer();
					format(str, sizeof(str), "* You have made %s the new Boxing Champion.", PlayerICName(giveplayerid));
					SendClientMessage(playerid, COLOR_LIGHTBLUE, str);
				}
			}
			else return SendClientMessage(playerid, COLOR_GREY, "That player is offline.");
		}
		else return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /setchamp [playerid/PartOfName]");
	}
	else return AdmErrorMsg;
	return 1;
}

CMD:sethp(playerid, params[])
{
	new playa, health;
	new str[128];
	if(PlayerInfo[playerid][pAdmin] >= 2 || PlayerInfo[playerid][pEventModd] > 0)
	{
		if(!sscanf(params, "ui", playa, health))
		{
			if(IsPlayerConnected(playa))
			{
				if(playa != INVALID_PLAYER_ID)
				{
					if((PlayerInfo[playa][pAdmin] > PlayerInfo[playerid][pAdmin]) && health <= 0)
					{
						format(str, sizeof(str), "{FF0000}AdmWarning{FFFFFF}: %s was killed, reason: Attempting to set a higher admin's health to 0.", PlayerICName(playerid));
						ABroadCast(COLOR_WHITE, str, 1);
						SetPlayerHealth(playerid, 0);
						return 1;
					}
					SetPlayerHealth(playa, health);
					format(str, sizeof(str), "You have set %s's health to %d.", PlayerICName(playa), health);
					SendClientMessage(playerid, COLOR_GREY, str);
				}
				else
				{
					SendClientMessage(playerid, COLOR_GREY, "That is an invalid ID");
				}
			}
			else
			{
				SendClientMessage(playerid, COLOR_GREY, "Player isn't connected");
			}
		}
		else
		{
			SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /sethp [playerid/PartOfName] [health]");
		}
	}
	else
	{
		AdmErrorMsg;
	}
	return 1;
}

CMD:sethpall(playerid, params[])
{
	new health;
	new str[128];
	if(PlayerInfo[playerid][pAdmin] >= 4)
	{
		if(!sscanf(params, "i", health))
		{
			if(health <= 0)
			{
				format(str, sizeof(str), "{FF0000}AdmWarning{FFFFFF}: %s was killed, reason: Attempting to set everyones health to 0.", PlayerICName(playerid));
				ABroadCast(COLOR_WHITE, str, 1);
				SetPlayerHealth(playerid, 0);
				return 1;
			}
			foreach( new i: Player )
			{
				if(IsPlayerConnected(i))
				{
					SetPlayerHealth(i, health);
				}
			}
			format(str, sizeof(str), "You have set everyones health to %d.", health);
			SendClientMessage(playerid, COLOR_GREY, str);
		}
		else
		{
			SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /sethpall [health]");
		}
	}
	else
	{
		AdmErrorMsg;
	}
	return 1;
}

CMD:setarmor(playerid, params[])
{
	new playa, armor;
	new str[128];
	if(PlayerInfo[playerid][pAdmin] >= 2 || PlayerInfo[playerid][pEventModd] > 0)
	{
		if(!sscanf(params, "ui", playa, armor))
		{
			if(IsPlayerConnected(playa))
			{
				if(playa != INVALID_PLAYER_ID)
				{
					strmid(giveplayer, PlayerICName(playa), 0, MAX_PLAYER_NAME);
					SetPlayerArmour(playa, armor);
					format(str, sizeof(str), "You have set %s's armor to %d.", giveplayer, armor);
					SendClientMessage(playerid, COLOR_GREY, str);
				}
			}
		}
		else
		{
			SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /setarmor [playerid/PartOfName] [armor]");
		}
	}
	else
	{
		AdmErrorMsg;
	}
	return 1;
}

CMD:setarmorall(playerid, params[])
{
	new armor;
	new str[128];
	if(PlayerInfo[playerid][pAdmin] >= 4)
	{
		if(!sscanf(params, "i", armor))
		{
			foreach( new i: Player )
			{
				if(IsPlayerConnected(i))
				{
					SetPlayerArmour(i, armor);
				}
			}
			format(str, sizeof(str), "You have set everyones armor to %d.", armor);
			SendClientMessage(playerid, COLOR_GREY, str);
		}
		else
		{
			SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /setarmorall [armor]");
		}
	}
	else
	{
		AdmErrorMsg;
	}
	return 1;
}

CMD:setfightstyle(playerid, params[])
{
	new playa, fstyle;
	new str[128];
	if(PlayerInfo[playerid][pAdmin] >= 4)
	{
		if(!sscanf(params, "ui", playa, fstyle))
		{
			if(fstyle < 1 || fstyle > 6)
			{
				SendClientMessage(playerid, COLOR_GREY, "Fighting Style can't be below 1 or above 6.");
				return 1;
			}
			if(IsPlayerConnected(playa))
			{
				if(playa != INVALID_PLAYER_ID)
				{
					new fstring[16];
					if(fstyle == 1)
					{
						SetPlayerFightingStyle(playa, FIGHT_STYLE_NORMAL);
						PlayerInfo[playa][pFightingStyle] = 4;
						fstring = "NORMAL";
					}
					if(fstyle == 2)
					{
						SetPlayerFightingStyle(playa, FIGHT_STYLE_BOXING);
						PlayerInfo[playa][pFightingStyle] = 5;
						fstring = "BOXING";
					}
					if(fstyle == 3)
					{
						SetPlayerFightingStyle(playa, FIGHT_STYLE_KUNGFU);
						PlayerInfo[playa][pFightingStyle] = 6;
						fstring = "KUNG FU";
					}
					if(fstyle == 4)
					{
						SetPlayerFightingStyle(playa, FIGHT_STYLE_KNEEHEAD);
						PlayerInfo[playa][pFightingStyle] = 7;
						fstring = "KNEEHEAD";
					}
					if(fstyle == 5)
					{
						SetPlayerFightingStyle(playa, FIGHT_STYLE_GRABKICK);
						PlayerInfo[playa][pFightingStyle] = 15;
						fstring = "GRABKICK";
					}
					if(fstyle == 6)
					{
						SetPlayerFightingStyle(playa, FIGHT_STYLE_ELBOW);
						PlayerInfo[playa][pFightingStyle] = 26;
						fstring = "ELBOW";
					}
					strmid(giveplayer, PlayerICName(playa), 0, MAX_PLAYER_NAME);
					format(str, sizeof(str), "You have set %s's Fighting Style to %s.", giveplayer, fstring);
					SendClientMessage(playerid, COLOR_GREY, str);
				}
			}
		}
		else
		{
			SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /setfightstyle [playerid/PartOfName] [1-6]");
		}
	}
	else
	{
		AdmErrorMsg;
	}
	return 1;
}

CMD:setname(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] < 4) return AdmErrorMsg;

	new giveplayerid, newname[MAX_PLAYER_NAME];

	if(sscanf(params, "us[24]", giveplayerid, newname)) return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /setname [playerid/PartOfName] [new name]");
	if(strlen(newname) > MAX_PLAYER_NAME) return SendClientMessage(playerid, COLOR_GREY, "{FF0000}Error:{FFFFFF} the new name is too long.");
	if(!IsPlayerConnected(giveplayerid) || giveplayerid == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_GREY, "{FF0000}Error:{FFFFFF} that player isn't connected.");

	// Replace space with underscore (for stupid admins)
	if(strfind(newname, " ", true) != -1) {
		strmid(newname, str_replace(' ', '_', newname), 0, MAX_PLAYER_NAME);
		SendClientMessage(playerid, COLOR_GREY, "Hint: You should not use spaces in names, it has been replaced with an underscore.");
	}

	new query[128];
	mysql_format(sqlGameConnection, query, sizeof(query), "SELECT `Name` FROM `players` WHERE `Name` = '%e'", newname);
	mysql_pquery(sqlGameConnection, query, "OnSetName", "iis", playerid, giveplayerid, newname);
	return 1;
}

CMD:adivorce(playerid, params[])
{
	new giveplayerid;
	new str[128];
	if(PlayerInfo[playerid][pAdmin] >= 2)
	{
		if(!sscanf(params, "u", giveplayerid))
		{
			if(IsPlayerConnected(giveplayerid))
			{
				if(giveplayerid != INVALID_PLAYER_ID)
				{
					strmid(giveplayer, PlayerICName(giveplayerid), 0, MAX_PLAYER_NAME);
					format(str, sizeof(str), "You have reset %s's marriage status.", giveplayer);
					SendClientMessage(playerid, COLOR_GREY, str);
					SendClientMessage(giveplayerid, COLOR_YELLOW, "Your marriage status has been reset by an Admin.");
					ClearMarriage(giveplayerid);
				}
			}
			else
			{
				SendClientMessage(playerid, COLOR_GREY, "That player is Offline.");
			}
		}
		else
		{
			SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /adivorce [playerid/PartOfName]");
		}
	}
	else
	{
		AdmErrorMsg;
	}
	return 1;
}

CMD:setcolor(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] >= 4 || PlayerInfo[playerid][pEventModd] == 1)
	{
		ShowPlayerDialog(playerid, DIALOG_ADMIN_COLORCHANGER, DIALOG_STYLE_LIST, "Color Changer", "Purple\nYellow\nRed\nLightblue\nOrange\nGreen\nIndigo\nPink\nBlack", "Select", "Cancel");
	}
	else
	{
		AdmErrorMsg;
	}
	return 1;
}

CMD:setplayercolor(playerid, params[])
{
	new giveplayerid, x_job[128];
	new str[128];
	if(PlayerInfo[playerid][pAdmin] >= 4 || PlayerInfo[playerid][pEventModd] > 0)
	{
		if(!sscanf(params, "us[128]", giveplayerid, x_job))
		{
			if(IsPlayerConnected(giveplayerid))
			{
				if(giveplayerid != INVALID_PLAYER_ID)
				{
					if(strcmp(x_job, "red", true) == 0)
					{
						SetPlayerColor(giveplayerid, SCOLOR_RED);
					}
					else if(strcmp(x_job, "pink", true) == 0)
					{
						SetPlayerColor(giveplayerid, SCOLOR_PINK);
					}
					else if(strcmp(x_job, "orange", true) == 0)
					{
						SetPlayerColor(giveplayerid, SCOLOR_ORANGE);
					}
					else if(strcmp(x_job, "yellow", true) == 0)
					{
						SetPlayerColor(giveplayerid, SCOLOR_YELLOW);
					}
					else if(strcmp(x_job, "cyan", true) == 0)
					{
						SetPlayerColor(giveplayerid, SCOLOR_CYAN);
					}
					else if(strcmp(x_job, "green", true) == 0)
					{
						SetPlayerColor(giveplayerid, SCOLOR_GREEN);
					}
					else if(strcmp(x_job, "blue", true) == 0)
					{
						SetPlayerColor(giveplayerid, SCOLOR_BLUE);
					}
					else if(strcmp(x_job, "black", true) == 0)
					{
						SetPlayerColor(giveplayerid, SCOLOR_BLACK);
					}
					else if(strcmp(x_job, "white", true) == 0)
					{
						SetPlayerColor(giveplayerid, SCOLOR_WHITE);
					}
					else if(strcmp(x_job, "marker", true) == 0)
					{
						SetPlayerColor(giveplayerid, SCOLOR_MARKER);
					}
					strmid(sendername, PlayerICName(playerid), 0, MAX_PLAYER_NAME);
					strmid(giveplayer, PlayerICName(giveplayerid), 0, MAX_PLAYER_NAME);
					format(str, sizeof(str), "{FF0000}AdmWarning{FFFFFF}: %s has set %s's name color.", sendername, giveplayer);
					SendClientMessage(giveplayerid, COLOR_WHITE, "Your name color has been set by an admin.");
					ABroadCast(COLOR_LIGHTRED, str, 1);
				}
			}
			else
			{
				format(str, sizeof(str), "{FF0000}Error:{FFFFFF} That player isn't connected.", giveplayerid);
				SendClientMessage(playerid, COLOR_GRAD1, str);
			}
		}
		else
		{
			SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /setplayercolor [playerid] [color]");
			SendClientMessage(playerid, COLOR_GRAD1, "Available colors: Red, Pink, Orange, Yellow, Cyan, Green, Blue, Black, White, Marker");
		}
	}
	else
	{
		AdmErrorMsg;
	}
	return 1;
}

CMD:givegun(playerid, params[])
{
	new playa, gun;
	new str[128];
	if(PlayerInfo[playerid][pAdmin] >= 4 || PlayerInfo[playerid][pEventModd] > 0)
	{
		if(!sscanf(params, "ui", playa, gun))
		{
			if(gun < 1 ||gun > 46)
			{
				SendClientMessage(playerid, COLOR_GRAD1, "Invalid weapon ID.");
				return 1;
			}
			if(IsPlayerConnected(playa))
			{
				if(gun == 21)
				{
					SetPlayerSpecialAction(playa, SPECIAL_ACTION_USEJETPACK);
				}
				GivePlayerAdminGun(playa, gun);
				strmid(giveplayer, PlayerICName(playa), 0, MAX_PLAYER_NAME);
				format(str, sizeof(str), "(ADMIN GUN) You have given a %s to %s", GetGunName(gun), giveplayer);
				SendClientMessage(playerid, COLOR_ORANGE, str);
			}
		}
		else
		{
			SendClientMessage(playerid, COLOR_YELLOW, "_______________________________________");
			SendClientMessage(playerid, COLOR_WHITE, "1: Brass Knuckles 2: Golf Club 3: Nite Stick 4: Knife 5: Baseball Bat 6: Shovel 7: Pool Cue 8: Katana 9: Chainsaw");
			SendClientMessage(playerid, COLOR_WHITE, "10: Purple Dildo 11: Small White Vibrator 12: Large White Vibrator 13: Silver Vibrator 14: Flowers 15: Cane 16: Frag Grenade");
			SendClientMessage(playerid, COLOR_WHITE, "17: Tear Gas 18: Molotov Cocktail 19: Vehicle Missile 20: Hydra Flare 21: Jetpack 22: 9mm 23: Silenced 9mm 24: Deagle 25: Shotgun");
			SendClientMessage(playerid, COLOR_WHITE, "26: Sawnoff Shotgun 27: Combat Shotgun 28: Micro SMG (Mac 10) 29: SMG (MP5) 30: AK-47 31: M4 32: Tec9 33: Country Rifle");
			SendClientMessage(playerid, COLOR_WHITE, "34: Sniper Rifle 35: Rocket Launcher 36: HS Rocket Launcher 37: Flamethrower 38: Minigun 39: Satchel Charge");
			SendClientMessage(playerid, COLOR_WHITE, "40: Detonator 41: Spraycan 42: Fire Extinguisher 43: Camera 44: Nightvision Goggles 45: Infared Goggles 46: Parachute");
			SendClientMessage(playerid, COLOR_YELLOW, "_______________________________________");
		}
	}
	else
	{
		AdmErrorMsg;
	}
	return 1;
}

CMD:asellgun(playerid, params[])
{
	new playa, gun;
	new str[128];
	if(PlayerInfo[playerid][pAdmin] >= 4 || PlayerInfo[playerid][pEventModd] > 0)
	{
		if(!sscanf(params, "ui", playa, gun))
		{
			if(gun < 1 ||gun > 46)
			{
				SendClientMessage(playerid, COLOR_GRAD1, "Invalid weapon ID.");
				return 1;
			}
			if(IsPlayerConnected(playa))
			{
				if(gun == 21)
				{
					SetPlayerSpecialAction(playa, SPECIAL_ACTION_USEJETPACK);
				}
				GivePlayerGun(playa, gun);
				strmid(giveplayer, PlayerICName(playa), 0, MAX_PLAYER_NAME);
				format(str, sizeof(str), "You have given a %s to %s", GetGunName(gun), giveplayer);
				SendClientMessage(playerid, COLOR_ORANGE, str);
			}
		}
		else
		{
			SendClientMessage(playerid, COLOR_YELLOW, "_______________________________________");
			SendClientMessage(playerid, COLOR_WHITE, "1: Brass Knuckles 2: Golf Club 3: Nite Stick 4: Knife 5: Baseball Bat 6: Shovel 7: Pool Cue 8: Katana 9: Chainsaw");
			SendClientMessage(playerid, COLOR_WHITE, "10: Purple Dildo 11: Small White Vibrator 12: Large White Vibrator 13: Silver Vibrator 14: Flowers 15: Cane 16: Frag Grenade");
			SendClientMessage(playerid, COLOR_WHITE, "17: Tear Gas 18: Molotov Cocktail 19: Vehicle Missile 20: Hydra Flare 21: Jetpack 22: 9mm 23: Silenced 9mm 24: Deagle 25: Shotgun");
			SendClientMessage(playerid, COLOR_WHITE, "26: Sawnoff Shotgun 27: Combat Shotgun 28: Micro SMG (Mac 10) 29: SMG (MP5) 30: AK-47 31: M4 32: Tec9 33: Country Rifle");
			SendClientMessage(playerid, COLOR_WHITE, "34: Sniper Rifle 35: Rocket Launcher 36: HS Rocket Launcher 37: Flamethrower 38: Minigun 39: Satchel Charge");
			SendClientMessage(playerid, COLOR_WHITE, "40: Detonator 41: Spraycan 42: Fire Extinguisher 43: Camera 44: Nightvision Goggles 45: Infared Goggles 46: Parachute");
			SendClientMessage(playerid, COLOR_YELLOW, "_______________________________________");
		}
	}
	else
	{
		AdmErrorMsg;
	}
	return 1;
}

CMD:givemoney(playerid, params[])
{
	new playa, money;
	new str[128];
	if(PlayerInfo[playerid][pAdmin] >= 4)
	{
		if(!sscanf(params, "ui", playa, money))
		{
			if(IsPlayerConnected(playa))
			{
				if(playa != INVALID_PLAYER_ID)
				{
					new name[24];
					strmid(name, str_replace('_', ' ', PlayerName(playa)), 0, MAX_PLAYER_NAME);
					GiveMoney(playa, money);
					format(str, sizeof(str), "You have given %s $%d.", name, money);
					SendClientMessage(playerid, COLOR_GREY, str);
				}
			}
		}
		else
		{
			SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /givemoney [playerid/PartOfName] [money]");
		}
	}
	else
	{
		AdmErrorMsg;
	}
	return 1;
}

CMD:givelic(playerid, params[])
{
	new type, giveplayerid;
	new str[128];
	if(PlayerInfo[playerid][pAdmin] >= 4)
	{
		if(!sscanf(params, "iu", type, giveplayerid))
		{
			strmid(sendername, PlayerICName(playerid), 0, MAX_PLAYER_NAME);
			strmid(giveplayer, PlayerICName(giveplayerid), 0, MAX_PLAYER_NAME);
			switch(type)
			{
				case 1:
				{
					if(IsPlayerConnected(giveplayerid))
					{
						if(giveplayerid != INVALID_PLAYER_ID)
						{
							format(str, sizeof(str), "* You've given a Sailing License to %s.", giveplayer);
							SendClientMessage(playerid, COLOR_LIGHTBLUE, str);
							format(str, sizeof(str), "* Admin %s has given you a Sailing License.", sendername);
							SendClientMessage(giveplayerid, COLOR_LIGHTBLUE, str);
							PlayerInfo[giveplayerid][pBoatLicense] = 1;
						}
					}
					else
					{
						SendClientMessage(playerid, COLOR_GREY, "That player is Offline.");
					}
				}
				case 2:
				{
					if(IsPlayerConnected(giveplayerid))
					{
						if(giveplayerid != INVALID_PLAYER_ID)
						{
							format(str, sizeof(str), "* You've given a Driving License to %s.", giveplayer);
							SendClientMessage(playerid, COLOR_LIGHTBLUE, str);
							format(str, sizeof(str), "* Admin %s has given you a Driving License.", sendername);
							SendClientMessage(giveplayerid, COLOR_LIGHTBLUE, str);
							PlayerInfo[giveplayerid][pCarLicense] = 1;
						}
					}
					else
					{
						SendClientMessage(playerid, COLOR_GREY, "That player is Offline.");
					}
				}
				case 3:
				{
					if(IsPlayerConnected(giveplayerid))
					{
						if(giveplayerid != INVALID_PLAYER_ID)
						{
							format(str, sizeof(str), "* You've given a Fishing License to %s.", giveplayer);
							SendClientMessage(playerid, COLOR_LIGHTBLUE, str);
							format(str, sizeof(str), "* Admin %s has given you a Fishing License.", sendername);
							SendClientMessage(giveplayerid, COLOR_LIGHTBLUE, str);
							PlayerInfo[giveplayerid][pFishLic] = 1;
							return 1;
						}
					}
					else
					{
						SendClientMessage(playerid, COLOR_GREY, "That player is Offline.");
					}
				}
				case 4:
				{
					if(IsPlayerConnected(giveplayerid))
					{
						if(giveplayerid != INVALID_PLAYER_ID)
						{
							format(str, sizeof(str), "* You've given a Weapon License to %s.", giveplayer);
							SendClientMessage(playerid, COLOR_LIGHTBLUE, str);
							format(str, sizeof(str), "* Admin %s has given you a Weapon License.", sendername);
							SendClientMessage(giveplayerid, COLOR_LIGHTBLUE, str);
							PlayerInfo[giveplayerid][pWeaponLicense] = 1;
						}
					}
					else
					{
						SendClientMessage(playerid, COLOR_GREY, "That player is Offline.");
					}
				}
				case 5:
				{
					if(IsPlayerConnected(giveplayerid))
					{
						if(giveplayerid != INVALID_PLAYER_ID)
						{
							format(str, sizeof(str), "* You've given a Marijuana License to %s.", giveplayer);
							SendClientMessage(playerid, COLOR_LIGHTBLUE, str);
							format(str, sizeof(str), "* Admin %s has given you a Marijuana License.", sendername);
							SendClientMessage(giveplayerid, COLOR_LIGHTBLUE, str);
							PlayerInfo[giveplayerid][pMarijuanaLicense] = 1;
						}
					}
					else
					{
						SendClientMessage(playerid, COLOR_GREY, "That player is Offline.");
					}
				}
				default:
				{
					SendClientMessage(playerid, COLOR_GREY, "Invalid type.");
				}
			}
		}
		else
		{
			SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /givelic [type] [playerid/PartOfName]");
			SendClientMessage(playerid, COLOR_GRAD1, "Available types: 1:Sailing, 2:Driving, 3:Fishing, 4:Weapon, 5:Marijuana");
		}
	}
	else
	{
		SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command.");
	}
	return 1;
}

CMD:takelic(playerid, params[])
{
	new type, giveplayerid;
	new str[128];
	if(PlayerInfo[playerid][pAdmin] >= 4)
	{
		if(!sscanf(params, "iu", type, giveplayerid))
		{
			strmid(sendername, PlayerICName(playerid), 0, MAX_PLAYER_NAME);
			strmid(giveplayer, PlayerICName(giveplayerid), 0, MAX_PLAYER_NAME);
			switch(type)
			{
				case 1:
				{
					if(IsPlayerConnected(giveplayerid))
					{
						if(giveplayerid != INVALID_PLAYER_ID)
						{
							format(str, sizeof(str), "* You've taken a Sailing License off %s.", giveplayer);
							SendClientMessage(playerid, COLOR_LIGHTBLUE, str);
							format(str, sizeof(str), "* Admin %s has taken your Sailing License.", sendername);
							SendClientMessage(giveplayerid, COLOR_LIGHTBLUE, str);
							PlayerInfo[giveplayerid][pBoatLicense] = 0;
						}
					}
					else
					{
						SendClientMessage(playerid, COLOR_GREY, "That player is Offline.");
					}
				}
				case 2:
				{
					if(IsPlayerConnected(giveplayerid))
					{
						if(giveplayerid != INVALID_PLAYER_ID)
						{
							format(str, sizeof(str), "* You've taken a Driving License off %s.", giveplayer);
							SendClientMessage(playerid, COLOR_LIGHTBLUE, str);
							format(str, sizeof(str), "* Admin %s has taken your Driving License.", sendername);
							SendClientMessage(giveplayerid, COLOR_LIGHTBLUE, str);
							PlayerInfo[giveplayerid][pCarLicense] = 0;
						}
					}
					else
					{
						SendClientMessage(playerid, COLOR_GREY, "That player is Offline.");
					}
				}
				case 3:
				{
					if(IsPlayerConnected(giveplayerid))
					{
						if(giveplayerid != INVALID_PLAYER_ID)
						{
							format(str, sizeof(str), "* You've taken a Fishing License off %s.", giveplayer);
							SendClientMessage(playerid, COLOR_LIGHTBLUE, str);
							format(str, sizeof(str), "* Admin %s has taken your Fishing License.", sendername);
							SendClientMessage(giveplayerid, COLOR_LIGHTBLUE, str);
							PlayerInfo[giveplayerid][pFishLic] = 0;
						}
					}
					else
					{
						SendClientMessage(playerid, COLOR_GREY, "That player is Offline.");
					}
				}
				case 4:
				{
					if(IsPlayerConnected(giveplayerid))
					{
						if(giveplayerid != INVALID_PLAYER_ID)
						{
							format(str, sizeof(str), "* You've taken a Weapon License off %s.", giveplayer);
							SendClientMessage(playerid, COLOR_LIGHTBLUE, str);
							format(str, sizeof(str), "* Admin %s has taken your Weapon License.", sendername);
							SendClientMessage(giveplayerid, COLOR_LIGHTBLUE, str);
							PlayerInfo[giveplayerid][pWeaponLicense] = 0;
						}
					}
					else
					{
						SendClientMessage(playerid, COLOR_GREY, "That player is Offline.");
					}
				}
				case 5:
				{
					if(IsPlayerConnected(giveplayerid))
					{
						if(giveplayerid != INVALID_PLAYER_ID)
						{
							format(str, sizeof(str), "* You've taken a Marijuana License to %s.", giveplayer);
							SendClientMessage(playerid, COLOR_LIGHTBLUE, str);
							format(str, sizeof(str), "* Admin %s has taken you a Marijuana License.", sendername);
							SendClientMessage(giveplayerid, COLOR_LIGHTBLUE, str);
							PlayerInfo[giveplayerid][pMarijuanaLicense] = 1;
						}
					}
					else
					{
						SendClientMessage(playerid, COLOR_GREY, "That player is Offline.");
					}
				}
			}
		}
		else
		{
			SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /takelic [type] [playerid/PartOfName]");
			SendClientMessage(playerid, COLOR_GRAD1, "Available types: 1:Sailing 2:Driving, 3:Fishing, 4:Weapon, 5:Marijuana");
		}
	}
	else
	{
		SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command.");
	}
	return 1;
}

CMD:givenos(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] >= 4)
	{
		new vehid = GetPlayerVehicleID(playerid);
		if(IsValidNosVehicle(vehid))
		{
			AddVehicleComponent(vehid, 1010);
			SendClientMessage(playerid, COLOR_GREY, "10x nos added to the vehicle.");
		}
		else
		{
			return 1;
		}
	}
	else
	{
		AdmErrorMsg;
	}
	return 1;
}

CMD:givenosall(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] >= 4)
	{
		for(new i = 0; i < MAX_VEHICLES; i++)
		{
			if(IsValidNosVehicle(i))
			{
				AddVehicleComponent(i, 1010);
			}
		}
		SendClientMessage(playerid, COLOR_GREY, "10x nos added to all vehicles in the server.");
	}
	else
	{
		AdmErrorMsg;
	}
	return 1;
}

CMD:refund(playerid, params[])
{
	new giveplayerid;
	if(PlayerInfo[playerid][pAdmin] >= 4)
	{
		if(!sscanf(params, "u", giveplayerid))
		{
			if(IsPlayerConnected(giveplayerid))
			{
				if(giveplayerid != INVALID_PLAYER_ID)
				{
					strmid(giveplayer, PlayerICName(giveplayerid), 0, MAX_PLAYER_NAME);
					RefundingID[playerid] = giveplayerid;
					DisplayDialogForPlayer(playerid, 47);
				}
			}
		}
		else
		{
			SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /refund [playerid/PartOfName]");
		}
	}
	else
	{
		AdmErrorMsg;
	}
	return 1;
}

CMD:maketiki(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] >= 4)
	{
		new str[128];
		if(IsPlayerInAnyVehicle(playerid))
		{
			return SendClientMessage(playerid, COLOR_GRAD2, "You can't do that while in a vehicle.");
		}
		new Float:X, Float:Y, Float:Z;
		new location[MAX_ZONE_NAME];
		GetPlayerPos(playerid, X, Y, Z);
		CreateTiki(X, Y, Z);
		SetPlayerPos(playerid, X, Y -2, Z);
		SendClientMessage(playerid, COLOR_GRAD1, "* Tiki created.");
		strmid(sendername, PlayerICName(playerid), 0, MAX_PLAYER_NAME);
		GetPlayer2DZone(playerid, location, MAX_ZONE_NAME);
		format(str, sizeof(str), "{FF0000}AdmWarning{FFFFFF}: %s has created a tiki in %s (%0.2f, %0.2f, %0.2f).", sendername, location, X, Y, Z);
		ABroadCast(COLOR_WHITE, str, 1);
	}
	else
	{
		SendClientMessage(playerid, COLOR_GRAD1, "You are not authorized to use this command.");
	}
	return 1;
}

CMD:deletetiki(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] >= 4)
	{
		if(IsPlayerInAnyVehicle(playerid))
		{
			return SendClientMessage(playerid, COLOR_GRAD2, "You can't do that while in a vehicle.");
		}
		DeleteClosestTiki(playerid);
	}
	else
	{
		SendClientMessage(playerid, COLOR_GRAD1, "You are not authorized to use this command.");
	}
	return 1;
}

CMD:deletetikis(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] >= 4)
	{
		if(IsPlayerInAnyVehicle(playerid))
		{
			return SendClientMessage(playerid, COLOR_GRAD2, "You can't do that while in a vehicle.");
		}
		new str[128];
		DeleteAllTiki();
		SendClientMessage(playerid, COLOR_GRAD2, "* Tikis destroyed.");
		strmid(sendername, PlayerICName(playerid), 0, MAX_PLAYER_NAME);
		format(str, sizeof(str), "{FF0000}AdmWarning{FFFFFF}: %s has destroyed all tikis.", sendername);
		ABroadCast(COLOR_WHITE, str, 1);
	}
	else
	{
		SendClientMessage(playerid, COLOR_GRAD1, "You are not authorized to use this command.");
	}
	return 1;
}

CMD:givetiki(playerid, params[])
{
	new giveplayerid, reason[128];
	if(PlayerInfo[playerid][pAdmin] >= 4)
	{
		if(!sscanf(params, "us[128]", giveplayerid, reason))
		{
			new str[128];
			if(IsPlayerConnected(giveplayerid))
			{
				if(giveplayerid != INVALID_PLAYER_ID)
				{
					PlayerInfo[giveplayerid][pTikis] += 1;
					if(PlayerInfo[playerid][pStealthed] == 1)
					{
						format(str, sizeof(str), "{FF6347}SERVER: %s has been given a tiki by a silent administrator, reason: %s", PlayerICName(giveplayerid), (reason));
					}
					else
					{
						format(str, sizeof(str), "{FF6347}SERVER: %s has been given a tiki by %s, reason: %s", PlayerICName(giveplayerid), PlayerICName(playerid), (reason));
					}
					SendClientMessageToAll(COLOR_WHITE, str);
				}
			}
			else
			{
				SendClientMessage(playerid, COLOR_GREY, "That player is Offline.");
			}
		}
		else
		{
			SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /givetiki [playerid/PartOfName] [reason]");
		}
	}
	else
	{
		AdmErrorMsg;
	}
	return 1;
}

CMD:givetikiall(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] < 4)
	{
		AdmErrorMsg;
		return 1;
	}
	new str[128];
	new reason[128];
	if(!sscanf(params, "s[128]", reason))
	{
		//for(new i = 0;i<MAX_PLAYERS;i++)
		foreach( new i: Player )
		{
			if(IsPlayerConnected(i))
			{
				if(i != INVALID_PLAYER_ID)
				{
					PlayerInfo[i][pTikis] += 1;
				}
			}
		}
		if(PlayerInfo[playerid][pStealthed] == 0)
		{
			format(str, sizeof(str), "{FF6347}SERVER: Everyone was given a tiki by %s, reason: %s", PlayerICName(playerid), reason);
		}
		else
		{
			format(str, sizeof(str), "{FF6347}SERVER: Everyone was given a tiki by a silent administrator, reason: %s", reason);
		}
		SendClientMessageToAll(COLOR_WHITE, str);
	}
	else
	{
		SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /givetikiall [Reason]");
	}
	return 1;
}

CMD:veh(playerid, params[])
{
	new vid[128], c1, c2;
	if(PlayerInfo[playerid][pAdmin] >= 4 || PlayerInfo[playerid][pEventModd] > 0 || PlayerInfo[playerid][pDev] >= 4)
	{
		if(!sscanf(params, "s[128]I(-1)I(-1)", vid, c1, c2))
		{
			new car = ReturnVehicleModelID(vid);
			if(!car)
			{
				return SendClientMessage(playerid, COLOR_GREY, "Invalid vehicle model name/ID.");
			}
			if(IsPlayerInAnyVehicle(playerid))
			{
				RemovePlayerFromVehicle(playerid);
			}
			if(c1 != -1)
			{
				if(c1 < 0 || c1 > 255)
				{
					return SendClientMessage(playerid, COLOR_GREY, "Enter a valid color [0-255]");
				}
				if(c2 == -1)
				{
					c2 = c1;
				}
			}
			if(c2 != -1)
			{
				if(c2 < 0 || c2 > 255)
				{
					return SendClientMessage(playerid, COLOR_GREY, "Enter a valid color [0-255]");
				}
			}
			new	Float:X, Float:Y, Float:Z, Float:A;
			GetPlayerPos(playerid, X, Y, Z);
			GetPlayerFacingAngle(playerid, A);
			new carid = CreateVehicleEx(car, X, Y, Z, A, c1, c2, -1);
			gDestroyVehicle[carid] = 1;
			gCarLock[carid] = 0;
			StartCar(carid);
			engineOn[carid] = 1;
			windowsDown[carid] = false;
			SetVehicleParamsCarWindows(carid, 1, 1, 1, 1);
			SetVehicleVirtualWorld(carid, GetPlayerVirtualWorld(playerid));
			LinkVehicleToInterior(carid, GetPlayerInterior(playerid));
			PutPlayerInVehicle(playerid, carid, 0);
			UnLockCar(carid);
			for(new i = 0; i < sizeof(CreatedCars); i++)
			{
				if(CreatedCars[i] == INVALID_VEHICLE_ID)
				{
					CreatedCars[i] = carid;
					break;
				}
			}
		}
		else
		{
			SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /veh [vehicle name/ID] [color1(optional)] [color2(optional)] [respawnable(optional)]");
		}
	}
	else
	{
		SendClientMessage(playerid, COLOR_GRAD1, "You are not authorized to use this command.");
	}
	return 1;
}

CMD:fixveh(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] >= 4)
	{
		if(IsPlayerInAnyVehicle(playerid))
		{
			new carid = GetPlayerVehicleID(playerid);
			SetVehicleHealth(carid, 999.0);
			RepairVehicle(carid);
			SendClientMessage(playerid, COLOR_GREY, "You have fixed your vehicle.");
		}
		else return SendClientMessage(playerid, COLOR_GREY, "You are not in a vehicle.");
	}
	else  return AdmErrorMsg;
	return 1;
}

CMD:fixvehall(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] >= 4)
	{
		for(new i = 0; i < MAX_VEHICLES; i++)
		{
			SetVehicleHealth(i, 999.0);
		}
		SendClientMessage(playerid, COLOR_GREY, "All vehicles fixed.");
	}
	else
	{
		AdmErrorMsg;
	}
	return 1;
}

CMD:destroycar(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] >= 4 || PlayerInfo[playerid][pEventModd] > 0 || PlayerInfo[playerid][pDev] >= 4)
	{
		new currentVehicle = GetPlayerVehicleID(playerid);
		if(currentVehicle == 0) return SendClientMessage(playerid,COLOR_GREY, "You must be in a vehicle to destroy it.");

		new check;
		for(new i = 0; i < sizeof(CreatedCars); i++)
		{
			if(CreatedCars[i] == currentVehicle)
			{
				check = 1;
				CreatedCars[i] = INVALID_VEHICLE_ID;
				break;
			}
		}
		if(!check) return SendClientMessage(playerid, COLOR_GRAD1, "You may only destroy a vehicle that was created with /veh.");
		gDestroyVehicle[currentVehicle] = 1;
		SetVehicleToRespawn(currentVehicle);
	}
	else
	{
		AdmErrorMsg;
	}
	return 1;
}

CMD:destroycars(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] >= 4 || PlayerInfo[playerid][pEventModd] > 0)
	{
		new str[128];
		new vehcount = 0;
		for(new i = 0; i < sizeof(CreatedCars); i++)
		{
			if(CreatedCars[i] != INVALID_VEHICLE_ID)
			{
				vehcount++;
				gDestroyVehicle[CreatedCars[i]] = 1;
				SetVehicleToRespawn(CreatedCars[i]);
				CreatedCars[i] = INVALID_VEHICLE_ID;
			}
		}
		format(str, sizeof(str), "You destroyed %d (veh)icles.", vehcount);
		SendClientMessage(playerid, -1, str);
	}
	else
	{
		AdmErrorMsg;
	}
	return 1;
}

CMD:kill(playerid, params[])
{
	if(	PlayerCuffed[playerid] > 0 ||
		PlayerTazed[playerid] > 0 ||
		PlayerTied[playerid] > 0 ||
		pDeathState[playerid] != PLAYER_STATE_NORMAL ||
		PlayerInfo[playerid][pTut] != 1 ||
		PlayerInfo[playerid][pJailed] != 0 ||
		Mobile[playerid] != 999
	) return SendClientMessage(playerid, COLOR_GREY, "You cannot do that at this time.");

	//printf("[DEBUG] Mobile number: %d of playerid: %d\n", Mobile[playerid], playerid);
	SetPlayerHealth(playerid, 0);
	return 1;
}

/*
	This command was removed because the function it calls Timer_KillCar is only used for /veh vehicles
	But this command can destroy any type of vehicle without resetting their relevant variable
*/

CMD:killcar(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] >= 2)
	{
		return SendClientMessage(playerid, COLOR_GRAD2, "This command has been disabled");
		/*
		new vehid = GetPlayerVehicleID(playerid);
		if(vehid == 0) return SendClientMessage(playerid, COLOR_GREY, "You must be in a vehicle to destroy it.");
		Timer_KillCar(vehid);
		*/
	}
	else
	{
		AdmErrorMsg;
	}
	return 1;
}

CMD:dcar(playerid, params[]) return cmd_destroycar(playerid, params);
CMD:dcars(playerid, params[]) return cmd_destroycars(playerid, params);
CMD:listcars(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] >= 4)
	{
		new createdcarcount;
		new str[128];
		for(new i = 0; i < sizeof(CreatedCars); i++)
		{
			if(CreatedCars[i] != INVALID_VEHICLE_ID)
			{
				createdcarcount = 1;
				format(str, sizeof(str), "(%d) %s", CreatedCars[i], vehName[GetVehicleModel(CreatedCars[i]) -400]);
				SendClientMessage(playerid, COLOR_GREY, str);
			}
		}
		if(createdcarcount != 1) SendClientMessage(playerid, COLOR_GREY, "No vehicles have been created with /veh.");
	}
	else
	{
		AdmErrorMsg;
	}
	return 1;
}

CMD:acheckweed(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] >= 4)
	{
		new str[128];
		new weed = IsPlayerNearWeed(playerid);
		if(weed == -1) return SendClientMessage(playerid, COLOR_GREY, "You are not near any plants.");
		format(str, sizeof(str), "Weed Owner: %s - Weed ID: %d - Weed Time: %d - Weed Grams: %d.", WeedInfo[weed][WeedPlanter], weed, WeedInfo[weed][WeedTime], WeedInfo[weed][WeedGrams]);
		SendClientMessage(playerid, COLOR_GREEN, str);
	}
	else
	{
		SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command.");
	}
	return 1;
}

CMD:removeweed(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] >= 4)
	{
		new str[128];
		new weed = IsPlayerNearWeed(playerid);
		if(weed == -1) return SendClientMessage(playerid, COLOR_GREY, "You are not near any plants.");
		format(str, sizeof(str), "You have removed %s's weed plant (weed id: %d).", WeedInfo[weed][WeedPlanter], weed);
		SendClientMessage(playerid, COLOR_GREEN, str);
		if(weedObject[weed]) { DestroyDynamicObjectEx(weedObject[weed]); }
		weedObject[weed] = 0;
		WeedInfo[weed][WeedX] = 0.0;
		WeedInfo[weed][WeedY] = 0.0;
		WeedInfo[weed][WeedZ] = 0.0;
		WeedInfo[weed][WeedTime] = 0;
		WeedInfo[weed][WeedPlanted] = 0;
		WeedInfo[weed][WeedGrams] = 0;
		strmid(WeedInfo[weed][WeedPlanter], "[NONE]", 0, strlen("[NONE]"), 128);
	}
	else
	{
		SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command.");
	}
	return 1;
}
//==============================[HEAD CMDS]=====================================
CMD:weatherall(playerid, params[])
{
	new weather;
	if(PlayerInfo[playerid][pAdmin] >= 1337)
	{
		if(!sscanf(params, "i", weather))
		{
			if(weather < 0 ||weather > 45)
			{
				return SendClientMessage(playerid, COLOR_GREY, "Weather ID can't be below 0 or above 45.");
			}
			SetWeather(weather);
			g_WeatherID = weather;
			SendClientMessage(playerid, COLOR_GREY, "Weather has been set for everyone.");
		}
	}
	else
	{
		SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command.");
	}
	return 1;
}
CMD:setweather(playerid, params[]) return cmd_weatherall(playerid, params);

CMD:makeleader(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] < 1337 && !PlayerInfo[playerid][pFactionMod])
		return AdmErrorMsg;

	new targetPlayer, faction;
	if(sscanf(params, "ui", targetPlayer, faction))
		return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /makeleader [playerid/PartOfName] [faction ID]");

	if(!IsPlayerConnected(targetPlayer))
		return SendClientMessage(playerid, COLOR_GREY, "Unknown player.");

	if(faction < 0 || faction > MAX_FACTIONS)
		return SendClientMessage(playerid, COLOR_GREY, "You have entered an invalid faction ID.");

	new str[128];
	if(PlayerInfo[targetPlayer][pFKickTime])
	{
		new timeleft = PlayerInfo[targetPlayer][pFKickTime] / 3600000;
		SendClientMessage(playerid, COLOR_LIGHTRED, "You cannot invite that player because they are faction-banned.");
		format(str, sizeof(str), "* %s has %i hours before they can be invited to a faction.", PlayerName(targetPlayer), timeleft);
		SendClientMessage(playerid, COLOR_LIGHTRED, str);
		return 1;
	}

	PlayerInfo[targetPlayer][pRank] = GetFactionMaxRanks(faction);
	PlayerInfo[targetPlayer][pMember] = faction;

	format(str, sizeof(str), "* You have given %s leadership of the %s.", PlayerOOCName(targetPlayer), GetFactionName(faction));
	SendClientMessage(playerid, COLOR_LIGHTBLUE, str);

	format(str, sizeof(str), "* %s has given you leadership of the %s.", PlayerOOCName(playerid), GetFactionName(faction));
	SendClientMessage(targetPlayer, COLOR_LIGHTBLUE, str);

	PlayerInfo[targetPlayer][pRadio] = 0;
	PlayerInfo[targetPlayer][pHandtazer] = 0;
	PlayerInfo[targetPlayer][ptazerGun] = 0;
	PlayerInfo[targetPlayer][pHAFakeBadge] = 0;
	FakeFaction[targetPlayer] = 0;
	hasRubberBullets[targetPlayer] = 0;
	loadedRubberBullets[targetPlayer] = false;
	TakePlayerWeapon(targetPlayer, 23);
	playerHoldingTazer[targetPlayer] = 0;
	RemovePlayerAttachedObject(targetPlayer, INDEX_7);
	PlayerInfo[targetPlayer][pLeader] = faction;
	PlayerInfo[targetPlayer][pMember] = faction;
	PlayerInfo[targetPlayer][pClothes] = 0;
	PlayerInfo[targetPlayer][pOnDuty] = 0;
	customRankName[targetPlayer] = false;
	format(customRank[targetPlayer], 24, "None");
	SetPlayerToTeamColor(targetPlayer);
	OnPlayerSave(targetPlayer);
	new fam = PlayerInfo[targetPlayer][pFMember];
	if(fam != 255)
	{
		if(strmatch(FamilyInfo[fam][FamilyLeader], PlayerICName(targetPlayer)))
		{
			strmid(FamilyInfo[fam][FamilyLeader], "None", 0, 100, 255);
			FamilyInfo[fam][FamilyMembers] -= 1;
		}
		PlayerInfo[targetPlayer][pFMember] = 255;
	}
	return 1;
}

CMD:makeircadmin(playerid, params[])
{
	new giveplayerid, channel;
	new str[128];
	if(PlayerInfo[playerid][pAdmin] >= 1337)
	{
		if(!sscanf(params, "ui", giveplayerid, channel))
		{
			if(channel > 10 || channel < 0)
			{
				SendClientMessage(playerid, COLOR_GREY, "Dont go below number 0, or above number 10.");
				return 1;
			}
			if(IsPlayerConnected(giveplayerid))
			{
				if(giveplayerid != INVALID_PLAYER_ID)
				{
					strmid(giveplayer, PlayerICName(giveplayerid), 0, MAX_PLAYER_NAME);
					strmid(sendername, PlayerICName(playerid), 0, MAX_PLAYER_NAME);
					format(str, sizeof(str), "* You've made %s an IRC Admin over Channel %d.", giveplayer, channel);
					SendClientMessage(playerid, COLOR_LIGHTBLUE, str);
					format(str, sizeof(str), "* %s has made you an IRC Admin over Channel %d.", sendername, channel);
					SendClientMessage(giveplayerid, COLOR_LIGHTBLUE, str);
					format(str, sizeof(str), "%s", giveplayer);
					switch(channel)
					{
						case 1:
						{
							strmid(IRCInfo[0][iAdmin], str, 0, strlen(str), 255);
							IRCInfo[0][iNeedPass] = 0;
							IRCInfo[0][iLock] = 0;
						}
						case 2:
						{
							strmid(IRCInfo[1][iAdmin], str, 0, strlen(str), 255);
							IRCInfo[1][iNeedPass] = 0;
							IRCInfo[1][iLock] = 0;
						}
						case 3:
						{
							strmid(IRCInfo[2][iAdmin], str, 0, strlen(str), 255);
							IRCInfo[2][iNeedPass] = 0;
							IRCInfo[2][iLock] = 0;
						}
						case 4:
						{
							strmid(IRCInfo[3][iAdmin], str, 0, strlen(str), 255);
							IRCInfo[3][iNeedPass] = 0;
							IRCInfo[3][iLock] = 0;
						}
						case 5:
						{
							strmid(IRCInfo[4][iAdmin], str, 0, strlen(str), 255);
							IRCInfo[4][iNeedPass] = 0;
							IRCInfo[4][iLock] = 0;
						}
						case 6:
						{
							strmid(IRCInfo[5][iAdmin], str, 0, strlen(str), 255);
							IRCInfo[5][iNeedPass] = 0;
							IRCInfo[5][iLock] = 0;
						}
						case 7:
						{
							strmid(IRCInfo[6][iAdmin], str, 0, strlen(str), 255);
							IRCInfo[6][iNeedPass] = 0;
							IRCInfo[6][iLock] = 0;
						}
						case 8:
						{
							strmid(IRCInfo[7][iAdmin], str, 0, strlen(str), 255);
							IRCInfo[7][iNeedPass] = 0;
							IRCInfo[7][iLock] = 0;
						}
						case 9:
						{
							strmid(IRCInfo[8][iAdmin], str, 0, strlen(str), 255);
							IRCInfo[8][iNeedPass] = 0;
							IRCInfo[8][iLock] = 0;
						}
						case 10:
						{
							strmid(IRCInfo[9][iAdmin], str, 0, strlen(str), 255);
							IRCInfo[9][iNeedPass] = 0;
							IRCInfo[9][iLock] = 0;
						}
					}
					SaveIRC();
				}
			}
			else
			{
				SendClientMessage(playerid, COLOR_GREY, "That player is Offline.");
				return 1;
			}
		}
		else
		{
			SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /makeircadmin [playerid/PartOfName] [ChannelNr]");
		}
	}
	else
	{
		SendClientMessage(playerid, COLOR_GREY, "You are not authorized to do that.");
	}
	return 1;
}

CMD:aouninvite(playerid, params[])
{
	new name[MAX_PLAYER_NAME];
	if(PlayerInfo[playerid][pAdmin] >= 4 || PlayerInfo[playerid][pFactionMod] > 0)
	{
		if(!sscanf(params, "s[24]", name))
		{
			if(GetPlayerIDFromName(name) != INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_GREY, "That player is currently logged in.");

			new query[128];
			mysql_format(sqlGameConnection, query, sizeof(query), "SELECT `Name` FROM `players` WHERE `Name` = '%e'", name);
			mysql_pquery(sqlGameConnection, query, "OnAOUninvite", "is", playerid, name);
		}
		else
		{
			SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /aouninvite [full name(case sensitive)]");
		}
	}
	else
	{
		SendClientMessage(playerid, COLOR_GREY, "You are not authorized to do that.");
	}
	return 1;
}

CMD:ouninvite(playerid, params[])
{
	if(PlayerInfo[playerid][pLeader] > 0)
	{
		new name[MAX_PLAYER_NAME];
		if(sscanf(params, "s[24]", name)) return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /ouninvite [full name(case sensitive)]");
		if(GetPlayerIDFromName(name) != INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_GREY, "{FF0000}Error:{FFFFFF} That player is currently logged in.");

		new query[128];
		mysql_format(sqlGameConnection, query, sizeof(query), "SELECT `Rank`, `Leader`, `Member` FROM `players` WHERE `Name` = '%e' LIMIT 1", name);
		mysql_pquery(sqlGameConnection, query, "OnOUninvite", "is", playerid, name);
	}
	else
	{
		SendClientMessage(playerid, COLOR_GREY, "{FF0000}Error:{FFFFFF} You are not a faction leader.");
	}
	return 1;
}

CMD:ofuninvite(playerid, params[])
{
	if(PlayerInfo[playerid][pRank] >= 5 && PlayerInfo[playerid][pFMember] != 255)
	{
		new name[MAX_PLAYER_NAME];
		if(sscanf(params, "s[24]", name)) return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /ofuninvite [full name(case sensitive)]");
		if(GetPlayerIDFromName(name) != INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_GREY, "{FF0000}Error:{FFFFFF} That player is currently logged in.");

		new query[128];
		mysql_format(sqlGameConnection, query, sizeof(query), "SELECT `Rank`, `FMember` FROM `players` WHERE `Name` = '%e' LIMIT 1", name);
		mysql_pquery(sqlGameConnection, query, "OnFamilyOUninvite", "is", playerid, name);
	}
	else
	{
		SendClientMessage(playerid, COLOR_GREY, "{FF0000}Error:{FFFFFF} You are not a family leader.");
	}
	return 1;
}

// Door lockpicking for HA + S9
CMD:lockpickdoor(playerid, params[])
{
	if(PlayerInfo[playerid][pGroup] != GROUP_S9 && PlayerInfo[playerid][pGroup] != GROUP_HITMAN)
		return 1;

	if(!PlayerInfo[playerid][pHasLockPick])
		return SendClientMessage(playerid, COLOR_GREY, "You need a lock pick kit to lock pick a door.");

	if(IsPlayerInAnyVehicle(playerid))
		return SendClientMessage( playerid, COLOR_GREY, "You must be on foot in order to lock pick a door.");

	if(inPaintball[playerid] || IsAtEvent[playerid])
		return SendClientMessage(playerid, COLOR_GREY, "You cannot do this right now.");

	for( new d; d < MAX_DOORS; d++ ) { //doors
		if(IsPlayerInRangeOfPoint(playerid, 7.0, Entrances[d][outside_x], Entrances[d][outside_y], Entrances[d][outside_z])) {
			if(strlen(Entrances[d][dpassword]) ) {
				DisabledDoors[d] = true;
				SetTimerEx("Timer_EnableDoor", 60000, false, "d", d);
			}
		}
	}
	new str[128];
	format(str, sizeof(str), "* %s begins lock picking the door.", PlayerICName(playerid));
	SendClientMessage(playerid, COLOR_PURPLE, str);
	SetPlayerChatBubble(playerid, str, COLOR_PURPLE, 5.0, 60000);

	SendClientMessage(playerid, COLOR_YELLOW, "Notice: {FFFFFF}The door will automaticly lock itself back after 60 seconds.");
	return 1;
}

CMD:deployexplosive( playerid, params[] ) {
	if( PlayerInfo[playerid][pHasCBomb] == 0 ) {
		return SendClientMessage( playerid, COLOR_GREY, "You do not have the suitable explosive to perform this." );
	}

	if( IsPlayerInAnyVehicle( playerid ) ) {
		return SendClientMessage( playerid, COLOR_GREY, "You must be on foot in order to deploy an explosive device." );
	}

	if( inPaintball[playerid] || IsAtEvent[playerid] ) {
		return SendClientMessage( playerid, COLOR_GREY, "You cannot do this right now." );
	}

	if( GetPlayerAnimationIndex(playerid) == 1461 || GetPlayerAnimationIndex(playerid) == 1463 ) {
		SendClientMessage(playerid, COLOR_GREY, "You can't do that at this time.");
		return 1;
	}
	new str[128];
	PlayerInfo[playerid][pHasCBomb] = 0;
	OnePlayAnim(playerid, "BOMBER", "BOM_Plant", 4.0, 0, 0, 0, 0, 0);
	new Float: FX, Float: FY, Float: FZ, Float: FA;
	GetXYInFrontOfPlayer( playerid, FX, FY, FZ, FA, 0.5 );
	ExplosiveObject[playerid] = CreateDynamicObject( 1654, FX, FY, FZ - 0.9, 0.0, -90.0, FA );
	Streamer_Update( playerid );

	format(str, sizeof(str), "* %s deploys their C2 explosive device on the ground, putting it on timer for eight seconds.", PlayerICName(playerid) );
	ProxDetector( 30.0, playerid, str, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE );

	SetTimerEx( "Timer_ExplodeExplosive", 8000, false, "ifff", playerid, FX, FY, FZ );
	return 1;
}

CMD:checklevel(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] == 0)
		return SendClientMessage(playerid, COLOR_GREY, "You're not authorised to use this command.");

	new name[MAX_PLAYER_NAME];
	if(sscanf(params, "s", name))
		return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /checklevel [player name]");

	new query[224];
	mysql_format(sqlGameConnection, query, sizeof(query), "SELECT `level` FROM `players` WHERE `Name` = '%e' LIMIT 1", name);
	mysql_pquery(sqlGameConnection, query, "OnCheckAccountLevel", "is", playerid, name);
	return 1;
}

CMD:activity(playerid, params[])// made by rellex lol?
{
	if(!PlayerInfo[playerid][pAdmin]) return AdmErrorMsg;
	new query[128], month, userid;
	if(sscanf(params, "ii", userid, month)) return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /activity [sqlid] [month (1-12)]");
	if(month > 12 || month < 1) return SendClientMessage(playerid, COLOR_GREY, "Usage: /activity [sqlid] [month (1-12)]");
	new CurrentYear, CurrentMonth, CurrentDay;
	getdate(CurrentYear, CurrentMonth, CurrentDay);

	mysql_format(sqlGameConnection, query, sizeof(query), "SELECT SUM(Minutes) FROM `activitylog` WHERE `Date` BETWEEN '%d-%d-01' AND '%d-%d-31' AND `UserID` = '%d'", CurrentYear, month, CurrentYear, month, userid);
	mysql_pquery(sqlGameConnection, query, "AAC", "iii", playerid, month, userid);
	return 1;
}

CMD:myactivity(playerid, params[])// made by rellex lol?
{
	new query[128], month;
	if(sscanf(params, "i",  month)) return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /myactivity [month (1-12)]");
	if(month > 12 || month < 1) return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF}: /myactivity [month (1-12)]");
	new CurrentYear, CurrentMonth, CurrentDay;
	getdate(CurrentYear, CurrentMonth, CurrentDay);

	mysql_format(sqlGameConnection, query, sizeof(query), "SELECT SUM(Minutes) FROM `activitylog` WHERE `Date` BETWEEN '%d-%d-01' AND '%d-%d-31' AND `UserID` = '%d'", CurrentYear, month, CurrentYear, month, PlayerInfo[playerid][pID]);
	mysql_pquery(sqlGameConnection, query, "NewDVIPShit", "iii", playerid, month, PlayerInfo[playerid][pID]);
	return 1;
}

//==========================[PUBLIC COMMANDS]===================================
//=========================[GENERAL COMMANDS]===================================

CMD:carsql(playerid, params[]){
	new i = GetPlayerVehicleID(playerid);
	new str[128];
	format(str, sizeof(str), "VehicleID: %d | Dynamic ID: %d", sVehicleInfo[i][v_id], GetDynamicVehicleID(i));
	SendClientMessage(playerid, -1, str);
	return 1;
}

static usedRespawnTime = 0;
CMD:respawncars(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] >= 1 || PlayerInfo[playerid][pDev] >= 2)
	{
		if(!ADuty[playerid] && PlayerInfo[playerid][pAdmin] == 1) return SendClientMessage(playerid, COLOR_GREY, "You are not on duty.");

		new Float:X, Float:Y, Float:Z, distance;
		if(!sscanf(params, "d", distance))
		{
			if(distance < 1 || distance > 100000)
			{
				SendClientMessage(playerid, COLOR_GREY, "Distance can't be below 1 or above 100,000.");
				return 1;
			}
			// Giving in a delay so that when the Timer:KillCar is used for /veh vehicles the delay doesn't cause any ID conflict //
			new now = gettime();

			if(now < usedRespawnTime){
				new str[128];
				format(str, sizeof(str), "You need to wait %d seconds to respawn cars again", usedRespawnTime - now);
				return SendClientMessage(playerid, COLOR_GREY, str);
			}

			for(new i = 0; i < MAX_VEHICLES; i++)
			{
				GetVehiclePos(i, X, Y, Z);
				if(IsPlayerInRangeOfPoint(playerid, distance, X, Y, Z))
				{
					if(!IsVehicleOccupied(i))
					{
						SetVehicleToRespawn(i);
					}
				}
			}
			new msg[128];
			format(msg, sizeof(msg), "{FF0000}AdmWarning{FFFFFF}: %s has respawned all vehicles within %d metres.", PlayerName(playerid), distance);
			SendAdminMessage(COLOR_WHITE, msg);
			usedRespawnTime = now + 20;
		}
		else
		{
			SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /respawncars [distance]");
		}
	}
	else
	{
		SendClientMessage(playerid, COLOR_GRAD2, "{FF0000}You're not authorized to use that command.");
	}
	return 1;
}

CMD:calc(playerid, params[]) return cmd_calculate(playerid, params);

CMD:calculate(playerid, params[])
{
	if(PlayerInfo[playerid][pCalculator] == 0)
	{
		SendClientMessage(playerid, COLOR_GREY, "You don't have a calculator.");
		return 1;
	}
	ShowPlayerDialog(playerid, DIALOG_CALC_1, DIALOG_STYLE_LIST, "Calculator", "Multiply * \nAdd +\nDivide /\nSubstract -", "Choose", "Cancel");
	return 1;
}

CMD:setradioname(playerid, params[])
{
	if(PlayerInfo[playerid][pRadioStation] == 255)
	{
		return SendClientMessage(playerid, COLOR_GREY, "You are not the owner of a Radio Station.");
	}
	new radio = PlayerInfo[playerid][pRadioStation];
	new str[128];
	if(strcmp(radioInfo[radio][ownerName], PlayerICName(playerid), true) == 0)
	{
		new newname[128];
		if(!sscanf(params, "s[128]", newname))
		{
			if(InvalidChar(newname) == 1)
			{
				SendClientMessage(playerid, COLOR_GREY, "Radio Station name cannot contain invalid characters.");
				return 1;
			}
			strmid(radioInfo[radio][channelName], newname, 0, strlen(newname), 255);
			format(str, sizeof(str), "* You have adjusted your Radio Stations name to '%s'.", radioInfo[radio][channelName]);
			SendClientMessage(playerid, COLOR_LIGHTBLUE, str);
			SaveRadios();
		}
		else
		{
			SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /setradioname [name]");
		}
	}
	else
	{
		SendClientMessage(playerid, COLOR_GREY, "You are not the owner of a Radio Station.");
	}
	return 1;
}

CMD:setradiourl(playerid, params[])
{
	if(PlayerInfo[playerid][pRadioStation] == 255)
	{
		return SendClientMessage(playerid, COLOR_GREY, "You are not the owner of a Radio Station.");
	}
	new radio = PlayerInfo[playerid][pRadioStation];
	if(strcmp(radioInfo[radio][ownerName], PlayerICName(playerid), true) == 0)
	{
		new newurl[128];
		if(!sscanf(params, "s[128]", newurl))
		{
			if(InvalidChar(newurl) == 1)
			{
				SendClientMessage(playerid, COLOR_GREY, "Radio Station name cannot contain invalid characters.");
				return 1;
			}
			new str[128];
			strmid(radioInfo[radio][url], newurl, 0, strlen(newurl), 255);
			format(str, sizeof(str), "* You have adjusted your Radio Stations url to '%s'.", radioInfo[radio][url]);
			SendClientMessage(playerid, COLOR_LIGHTBLUE, str);
			SaveRadios();
		}
		else
		{
			SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /setradiourl [url]");
		}
	}
	else
	{
		SendClientMessage(playerid, COLOR_GREY, "You are not the owner of a Radio Station.");
	}
	return 1;
}

CMD:setradiobroadcast(playerid, params[])
{
	if(PlayerInfo[playerid][pRadioStation] == 255)
	{
		return SendClientMessage(playerid, COLOR_GREY, "You are not the owner of a Radio Station.");
	}
	new radio = PlayerInfo[playerid][pRadioStation];
	new str[128];
	if(strcmp(radioInfo[radio][ownerName], PlayerICName(playerid), true) == 0)
	{
		if(radioInfo[radio][online])   //already broadcasting
		{
			format(str, sizeof(str), "* Your Radio Station is no longer broadcasting '%s'.", radioInfo[radio][url]);
			SendClientMessage(playerid, COLOR_LIGHTBLUE, str);
			radioInfo[radio][online] = 0;
		}
		else
		{
			format(str, sizeof(str), "* Your Radio Station is now broadcasting '%s'.", radioInfo[radio][url]);
			SendClientMessage(playerid, COLOR_LIGHTBLUE, str);
			radioInfo[radio][online] = 1;
		}
		SaveRadios();
	}
	else
	{
		SendClientMessage(playerid, COLOR_GREY, "You are not the owner of a Radio Station.");
	}
	return 1;
}

CMD:rcreate(playerid, params[]) //radio create
{
	if(PlayerInfo[playerid][pAdmin] >= 1337)
	{
		new radio, giveplayerid;
		new str[128];
		if(!sscanf(params, "iu", radio, giveplayerid))
		{
			if(radio < 0 || radio > 10) return SendClientMessage(playerid, COLOR_GREY, "Radio Station can't be below 1 or above 10.");
			if(IsPlayerNPC(giveplayerid)) return 1;
			if(IsPlayerConnected(giveplayerid))
			{
				if(giveplayerid != INVALID_PLAYER_ID)
				{
					radio -= 1;
					if(radioInfo[radio][taken] == 1)
					{
						SendClientMessage(playerid, COLOR_GREY, "That Radio Station is already taken.");
						return 1;
					}
					strmid(sendername, PlayerICName(playerid), 0, MAX_PLAYER_NAME);
					strmid(giveplayer, PlayerICName(giveplayerid), 0, MAX_PLAYER_NAME);
					format(str, sizeof(str), "* You've made %s the Owner of a Radio Station.", giveplayer);
					SendClientMessage(playerid, COLOR_LIGHTBLUE, str);
					format(str, sizeof(str), "* Admin %s has made you the Owner of a Radio Station.", sendername);
					SendClientMessage(giveplayerid, COLOR_LIGHTBLUE, str);
					format(str, sizeof(str), "%s", giveplayer);
					strmid(radioInfo[radio][ownerName], str, 0, strlen(str), 255);
					radioInfo[radio][taken] = 1;
					PlayerInfo[giveplayerid][pRadioStation] = radio;
					SaveRadios();
				}
			}
			else
			{
				SendClientMessage(playerid, COLOR_GREY, "That player is Offline.");
				return 1;
			}
		}
		else
		{
			SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /rcreate [radiostation] [playerid/PartOfName]");
		}
	}
	else
	{
		SendClientMessage(playerid, COLOR_GREY, "{FF0000}You're not authorized to use that command.");
		return 1;
	}
	return 1;
}

CMD:rdelete(playerid, params[]) //radio delete
{
	if(PlayerInfo[playerid][pAdmin] >= 1337)
	{
		new radio;
		new str[128];
		if(!sscanf(params, "i", radio))
		{
			if(radio < 0 || radio > 10) return SendClientMessage(playerid, COLOR_GREY, "Radio Station can't be below 1 or above 10.");
			radio -= 1;
			if(radioInfo[radio][taken] != 1)
			{
				SendClientMessage(playerid, COLOR_GREY, "That Radio Station is isn't taken.");
				return 1;
			}
			format(str, sizeof(str), "Radio Station %d has been deleted.", radio +1);
			SendClientMessage(playerid, COLOR_GREY, str);
			clearRadioInfo(radio);
		}
		else
		{
			SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /rcreate [radiostation]");
		}
	}
	else
	{
		SendClientMessage(playerid, COLOR_GREY, "{FF0000}You're not authorized to use that command.");
		return 1;
	}
	return 1;
}

CMD:facdeposit(playerid, params[])
{
	new faction[6], amount;
	new str[128];
	if(PlayerInfo[playerid][pLeader] == 6)
	{
		if(IsPlayerAtBankingPoint(playerid))
		{
			if(sscanf(params, "s[128]i", faction, amount))
			{
				SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF}/facdeposit [faction] [amount]");
				format(str, sizeof(str), "SAPD: $%d", SAPD);
				SendClientMessage(playerid, COLOR_GREY, str);
				format(str, sizeof(str), "FBI: $%d", FBI);
				SendClientMessage(playerid, COLOR_GREY, str);
				format(str, sizeof(str), "SASD: $%d", SAST);
				SendClientMessage(playerid, COLOR_GREY, str);
				format(str, sizeof(str), "SAFMD: $%d", FMD);
				SendClientMessage(playerid, COLOR_GREY, str);
				format(str, sizeof(str), "DoC: $%d", DOC);
				SendClientMessage(playerid, COLOR_GREY, str);
				format(str, sizeof(str), "SCOTUS: $%d", SCOTUS);
				SendClientMessage(playerid, COLOR_GREY, str);
				format(str, sizeof(str), "NEWS: $%d", NEWS);
				SendClientMessage(playerid, COLOR_GREY, str);
				format(str, sizeof(str), "TAXI: $%d", TAXI);
				SendClientMessage(playerid, COLOR_GREY, str);
			}
			else if(strcmp(faction, "SAPD", true) == 0)
			{
				if(amount > 0 && amount < PlayerInfo[playerid][pCash])
				{
					SAPD += amount;
					GiveMoney(playerid, -amount);
					SaveFactionBanks();
					format(str, sizeof(str), "You have deposited $%d into the SAPD account, there is now $%d inside.", amount, SAPD);
					SendClientMessage(playerid, COLOR_GRAD1, str);
				}
				else
				{
					SendClientMessage(playerid, COLOR_GREY, "You don't have that much.");
				}
				return 1;
			}
			/*else if(strcmp(faction, "FBI", true) == 0)
			{
				if(amount > 0 && amount < PlayerInfo[playerid][pCash])
				{
					FBI += amount;
					GiveMoney(playerid, -amount);
					SaveFactionBanks();
					format(str, sizeof(str), "You have deposited $%d into the FBI account, there is now $%d inside.", amount, FBI);
					SendClientMessage(playerid, COLOR_GRAD1, str);
				}
				else
				{
					SendClientMessage(playerid, COLOR_GREY, "You don't have that much.");
				}
				return 1;
			}
			else if(strcmp(faction, "SASD", true) == 0)
			{
				if(amount > 0 && amount < PlayerInfo[playerid][pCash])
				{
					SAST += amount;
					GiveMoney(playerid, -amount);
					SaveFactionBanks();
					format(str, sizeof(str), "You have deposited $%d into the SASD account, there is now $%d inside.", amount, SAST);
					SendClientMessage(playerid, COLOR_GRAD1, str);
				}
				else
				{
					SendClientMessage(playerid, COLOR_GREY, "You don't have that much.");
				}
				return 1;
			}*/
			else if(strcmp(faction, "SAFMD", true) == 0)
			{
				if(amount > 0 && amount < PlayerInfo[playerid][pCash])
				{
					FMD += amount;
					GiveMoney(playerid, -amount);
					SaveFactionBanks();
					format(str, sizeof(str), "You have deposited $%d into the SAFMD account, there is now $%d inside.", amount, FMD);
					SendClientMessage(playerid, COLOR_GRAD1, str);
				}
				else
				{
					SendClientMessage(playerid, COLOR_GREY, "You don't have that much.");
				}
				return 1;
			}
			/*else if(strcmp(faction, "DoC", true) == 0)
			{
				if(amount > 0 && amount < PlayerInfo[playerid][pCash])
				{
					DOC += amount;
					GiveMoney(playerid, -amount);
					SaveFactionBanks();
					format(str, sizeof(str), "You have deposited $%d into the DoC account, there is now $%d inside.", amount, DOC);
					SendClientMessage(playerid, COLOR_GRAD1, str);
				}
				else
				{
					SendClientMessage(playerid, COLOR_GREY, "You don't have that much.");
				}
				return 1;
			}*/
			else if(strcmp(faction, "SCOTUS", true) == 0)
			{
				if(amount > 0 && amount < PlayerInfo[playerid][pCash])
				{
					SCOTUS += amount;
					GiveMoney(playerid, -amount);
					SaveFactionBanks();
					format(str, sizeof(str), "You have deposited $%d into the SCOTUS account, there is now $%d inside.", amount, SCOTUS);
					SendClientMessage(playerid, COLOR_GRAD1, str);
				}
				else
				{
					SendClientMessage(playerid, COLOR_GREY, "You don't have that much.");
				}
				return 1;
			}
			else if(strcmp(faction, "NEWS", true) == 0)
			{
				if(amount > 0 && amount < PlayerInfo[playerid][pCash])
				{
					NEWS += amount;
					GiveMoney(playerid, -amount);
					SaveFactionBanks();
					format(str, sizeof(str), "You have deposited $%d into the News Company account, there is now $%d inside.", amount, NEWS);
					SendClientMessage(playerid, COLOR_GRAD1, str);
				}
				else
				{
					SendClientMessage(playerid, COLOR_GREY, "You don't have that much.");
				}
				return 1;
			}
			/*else if(strcmp(faction, "TAXI", true) == 0)
			{
				if(amount > 0 && amount < PlayerInfo[playerid][pCash])
				{
					TAXI += amount;
					GiveMoney(playerid, -amount);
					SaveFactionBanks();
					format(str, sizeof(str), "You have deposited $%d into the San Andreas Taxi Company account, there is now $%d inside.", amount, TAXI);
					SendClientMessage(playerid, COLOR_GRAD1, str);
				}
				else
				{
					SendClientMessage(playerid, COLOR_GREY, "You don't have that much.");
				}
				return 1;
			}*/
		}
		else
		{
			SendClientMessage(playerid, COLOR_GREY, "You are not at the bank counter.");
		}
	}
	else
	{
		SendClientMessage(playerid, COLOR_GREY, "You are not the President or Vice President.");
		return 1;
	}
	return 1;
}

CMD:facwithdraw(playerid, params[])
{
	if(IsPlayerAtBankingPoint(playerid))
	{
		new str[128];
		if(PlayerInfo[playerid][pLeader] == 1)
		{
			new amount = 0;
			if(sscanf(params, "i", amount))
			{
				SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /facwithdraw [amount]");
				format(str, sizeof(str), "There is $%d in the account.", SAPD);
				SendClientMessage(playerid, COLOR_GRAD1, str);
				return 1;
			}
			else
			{
				if(amount < 0 || amount > SAPD) return SendClientMessage(playerid, COLOR_GREY, "You don't have that much in the account.");
				SAPD -= amount;
				PlayerInfo[playerid][pCash] += amount;
				SaveFactionBanks();
				format(str, sizeof(str), "You have withdrawn $%d, there is $%d left in the account.", amount, SAPD);
				SendClientMessage(playerid, COLOR_GRAD1, str);
				return 1;
			}
		}
		/*else if(PlayerInfo[playerid][pLeader] == 2)
		{
			new amount = 0;
			if(sscanf(params, "i", amount))
			{
				SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /facwithdraw [amount]");
				format(str, sizeof(str), "There is $%d in the account.", FBI);
				SendClientMessage(playerid, COLOR_GRAD1, str);
				return 1;
			}
			else
			{
				if(amount < 0 || amount > FBI) return SendClientMessage(playerid, COLOR_GREY, "You don't have that much in the account.");
				FBI -= amount;
				PlayerInfo[playerid][pCash] += amount;
				SaveFactionBanks();
				format(str, sizeof(str), "You have withdrawn $%d, there is $%d left in the account.", amount, FBI);
				SendClientMessage(playerid, COLOR_GRAD1, str);
				return 1;
			}
		}
		else if(PlayerInfo[playerid][pLeader] == 3)
		{
			new amount = 0;
			if(sscanf(params, "i", amount))
			{
				SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /facwithdraw [amount]");
				format(str, sizeof(str), "There is $%d in the account.", SAST);
				SendClientMessage(playerid, COLOR_GRAD1, str);
				return 1;
			}
			else
			{
				if(amount < 0 || amount > SAST) return SendClientMessage(playerid, COLOR_GREY, "You don't have that much in the account.");
				SAST -= amount;
				PlayerInfo[playerid][pCash] += amount;
				SaveFactionBanks();
				format(str, sizeof(str), "You have withdrawn $%d, there is $%d left in the account.", amount, SAST);
				SendClientMessage(playerid, COLOR_GRAD1, str);
				return 1;
			}
		}*/
		else if(PlayerInfo[playerid][pLeader] == 4)
		{
			new amount = 0;
			if(sscanf(params, "i", amount))
			{
				SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /facwithdraw [amount]");
				format(str, sizeof(str), "There is $%d in the account.", FMD);
				SendClientMessage(playerid, COLOR_GRAD1, str);
				return 1;
			}
			else
			{
				if(amount < 0 || amount > FMD) return SendClientMessage(playerid, COLOR_GREY, "You don't have that much in the account.");
				FMD -= amount;
				PlayerInfo[playerid][pCash] += amount;
				SaveFactionBanks();
				format(str, sizeof(str), "You have withdrawn $%d, there is $%d left in the account.", amount, FMD);
				SendClientMessage(playerid, COLOR_GRAD1, str);
				return 1;
			}
		}
		/*else if(PlayerInfo[playerid][pLeader] == 5)
		{
			new amount = 0;
			if(sscanf(params, "i", amount))
			{
				SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /facwithdraw [amount]");
				format(str, sizeof(str), "There is $%d in the account.", DOC);
				SendClientMessage(playerid, COLOR_GRAD1, str);
				return 1;
			}
			else
			{
				if(amount < 0 || amount > DOC) return SendClientMessage(playerid, COLOR_GREY, "You don't have that much in the account.");
				DOC -= amount;
				PlayerInfo[playerid][pCash] += amount;
				SaveFactionBanks();
				format(str, sizeof(str), "You have withdrawn $%d, there is $%d left in the account.", amount, DOC);
				SendClientMessage(playerid, COLOR_GRAD1, str);
				return 1;
			}
		}*/
		else if(PlayerInfo[playerid][pLeader] == 7)
		{
			new amount = 0;
			if(sscanf(params, "i", amount))
			{
				SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /facwithdraw [amount]");
				format(str, sizeof(str), "There is $%d in the account.", SCOTUS);
				SendClientMessage(playerid, COLOR_GRAD1, str);
				return 1;
			}
			else
			{
				if(amount < 0 || amount > SCOTUS) return SendClientMessage(playerid, COLOR_GREY, "You don't have that much in the account.");
				SCOTUS -= amount;
				PlayerInfo[playerid][pCash] += amount;
				SaveFactionBanks();
				format(str, sizeof(str), "You have withdrawn $%d, there is $%d left in the account.", amount, SCOTUS);
				SendClientMessage(playerid, COLOR_GRAD1, str);
				return 1;
			}
		}
		else if(PlayerInfo[playerid][pLeader] == 9)
		{
			new amount = 0;
			if(sscanf(params, "i", amount))
			{
				SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /facwithdraw [amount]");
				format(str, sizeof(str), "There is $%d in the account.", NEWS);
				SendClientMessage(playerid, COLOR_GRAD1, str);
				return 1;
			}
			else
			{
				if(amount < 0 || amount > NEWS) return SendClientMessage(playerid, COLOR_GREY, "You don't have that much in the account.");
				NEWS -= amount;
				PlayerInfo[playerid][pCash] += amount;
				SaveFactionBanks();
				format(str, sizeof(str), "You have withdrawn $%d, there is $%d left in the account.", amount, NEWS);
				SendClientMessage(playerid, COLOR_GRAD1, str);
				return 1;
			}
		}
		/*else if(PlayerInfo[playerid][pLeader] == 10)
		{
			new amount = 0;
			if(sscanf(params, "i", amount))
			{
				SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /facwithdraw [amount]");
				format(str, sizeof(str), "There is $%d in the account.", TAXI);
				SendClientMessage(playerid, COLOR_GRAD1, str);
				return 1;
			}
			else
			{
				if(amount < 0 || amount > TAXI) return SendClientMessage(playerid, COLOR_GREY, "You don't have that much in the account.");
				TAXI -= amount;
				PlayerInfo[playerid][pCash] += amount;
				SaveFactionBanks();
				format(str, sizeof(str), "You have withdrawn $%d, there is $%d left in the account.", amount, TAXI);
				SendClientMessage(playerid, COLOR_GRAD1, str);
				return 1;
			}
		}*/
		else
		{
			SendClientMessage(playerid, COLOR_GREY, "You are not a faction leader with a bank account.");
		}
	}
	else
	{
		SendClientMessage(playerid, COLOR_GREY, "You are not at the bank counter.");
	}
	return 1;
}

CMD:setfsafe(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] >= 1337)
	{
		new amount, fac;
		new str[128];
		if(sscanf(params, "ii", fac, amount))
		{
			SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /setfsafe [faction ID] [amount]");
			SendClientMessage(playerid, COLOR_GREY, "Factions: SAPD(ID 1), FBI(ID 2), SASD(ID 3), FMD(ID 4), DoC(ID 5), SCOTUS(ID 6), GOV(ID 7), NEWS(ID 8), TAXI(ID 9)");
			return 1;
		}
		else
		{
			switch(fac)
			{
				case 1:
				{
					SAPD = 0 + amount;
					SaveFactionBanks();
					format(str, sizeof(str), "You have set the SAPD's safe to $%d.", amount);
					SendClientMessage(playerid, COLOR_YELLOW, str);
					format(str, sizeof(str), "{FF0000}This has been logged, so abusers will be caught.");
					SendClientMessage(playerid, COLOR_RED, str);
				}
				case 2:
				{
					FBI = 0 + amount;
					SaveFactionBanks();
					format(str, sizeof(str), "You have set the FBI's safe to $%d.", amount);
					SendClientMessage(playerid, COLOR_YELLOW, str);
					format(str, sizeof(str), "{FF0000}This has been logged, so abusers will be caught.");
					SendClientMessage(playerid, COLOR_RED, str);
				}
				case 3:
				{
					SAST = 0 + amount;
					SaveFactionBanks();
					format(str, sizeof(str), "You have set the SASD's safe to $%d.", amount);
					SendClientMessage(playerid, COLOR_YELLOW, str);
					format(str, sizeof(str), "{FF0000}This has been logged, so abusers will be caught.");
					SendClientMessage(playerid, COLOR_RED, str);
				}
				case 4:
				{
					FMD = 0 + amount;
					SaveFactionBanks();
					format(str, sizeof(str), "You have set the FMD's safe to $%d.", amount);
					SendClientMessage(playerid, COLOR_YELLOW, str);
					format(str, sizeof(str), "{FF0000}This has been logged, so abusers will be caught.");
					SendClientMessage(playerid, COLOR_RED, str);
				}
				case 5:
				{
					DOC = 0 + amount;
					SaveFactionBanks();
					format(str, sizeof(str), "You have set the DoC's safe to $%d.", amount);
					SendClientMessage(playerid, COLOR_YELLOW, str);
					format(str, sizeof(str), "{FF0000}This has been logged, so abusers will be caught.");
					SendClientMessage(playerid, COLOR_RED, str);
				}
				case 6:
				{
					SCOTUS = 0 + amount;
					SaveFactionBanks();
					format(str, sizeof(str), "You have set the SCOTUS's safe to $%d.", amount);
					SendClientMessage(playerid, COLOR_YELLOW, str);
					format(str, sizeof(str), "{FF0000}This has been logged, so abusers will be caught.");
					SendClientMessage(playerid, COLOR_RED, str);
				}
				case 7:
				{
					GOV = 0 + amount;
					SaveFactionBanks();
					format(str, sizeof(str), "You have set the GOV's safe to $%d.", amount);
					SendClientMessage(playerid, COLOR_YELLOW, str);
					format(str, sizeof(str), "{FF0000}This has been logged, so abusers will be caught.");
					SendClientMessage(playerid, COLOR_RED, str);
				}
				case 8:
				{
					NEWS = 0 + amount;
					SaveFactionBanks();
					format(str, sizeof(str), "You have set the NEWS's safe to $%d.", amount);
					SendClientMessage(playerid, COLOR_YELLOW, str);
					format(str, sizeof(str), "{FF0000}This has been logged, so abusers will be caught.");
					SendClientMessage(playerid, COLOR_RED, str);
				}
				case 9:
				{
					TAXI = 0 + amount;
					SaveFactionBanks();
					format(str, sizeof(str), "You have set the TAXI's safe to $%d.", amount);
					SendClientMessage(playerid, COLOR_YELLOW, str);
					format(str, sizeof(str), "{FF0000}This has been logged, so abusers will be caught.");
					SendClientMessage(playerid, COLOR_RED, str);
				}
			}
			SaveFactionBanks();
		}
	}
	else return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this.");
	return 1;
}

CMD:lastgmx(playerid, params[])
{
	SendClientMessage(playerid, COLOR_GREY, lastgmx);
	return 1;
}
//========================[ Dynamic Vehicle sys ]===============================
CMD:createvehicle(playerid, params[])
{
	SendClientMessage(playerid, COLOR_GREY, "Dynamic vehicle cmds renamed to:");
	SendClientMessage(playerid, COLOR_GREY, "/createdynamicvehicle, /destroydynamicvehicle, /editdynamicvehicle, /gotodynamicvehicle");
	return 1;
}

CMD:createdynamicvehicle(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] <= 4 && PlayerInfo[playerid][pFactionMod] != 1 && PlayerInfo[playerid][pGangDirector] != 1 && PlayerInfo[playerid][pDev] < 2)
		return AdmErrorMsg;
	new
		modelname[128], color1, color2, faction, Float:x, Float:y, Float:z, Float:a;
	new str[128];
	if(sscanf(params, "s[128]iii", modelname, color1, color2, faction))
	{
		SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /createdynamicvehicle [model name or ID] [color1] [color2] [faction (0 = none)]");
		SendClientMessage(playerid, COLOR_GREY, "Faction colour IDs: DoC: 99, SAPD: 0, 1, FMD: 3, 1, SAN: 20, 1.");
		return 1;
	}
	new
		modelid = ReturnVehicleModelID(modelname);
	if(!modelid)
		return SendClientMessage(playerid, COLOR_GREY, "Invalid vehicle model name/ID.");

	if(faction > 0 && (PlayerInfo[playerid][pAdmin] < 1337 && PlayerInfo[playerid][pGangDirector] == 0 && PlayerInfo[playerid][pDev] < DEVRANK_SENIOR))
		return AdmErrorMsg;
	GetPlayerPos(playerid, x, y, z);
	GetPlayerFacingAngle(playerid, a);
	for(new i = 1; i < MAX_VEHICLES; i++)
	{
		if(!IsValidVehicle(sVehicleInfo[i][v_id]))
		{
			sVehicleInfo[i][v_id] = CreateVehicle(modelid, x, y, z, a, color1, color2, 900);

			SetVehicleLockState( sVehicleInfo[i][v_id], 0 );
			if( IsABicycle( sVehicleInfo[i][v_id] ) ) {
				SetVehicleEngineState( sVehicleInfo[i][v_id], 1 );
			}

			if(faction == 6 && modelid == 409)
			{
				SetVehicleHealth(sVehicleInfo[i][v_id], 10000);
			}

			GetVehiclePos(sVehicleInfo[i][v_id], sVehicleInfo[i][v_x], sVehicleInfo[i][v_y], sVehicleInfo[i][v_z]);
			GetVehicleZAngle(sVehicleInfo[i][v_id], sVehicleInfo[i][v_rz]);
			sVehicleInfo[i][v_model] = modelid;
			sVehicleInfo[i][v_faction] = faction;
			sVehicleInfo[i][v_sqlid] = spawned_vehicles;
			sVehicleInfo[i][v_family] = 0;
			sVehicleInfo[i][v_group] = 0;
			sVehicleInfo[i][v_lockfeature] = 0;
			spawned_vehicles++;
			format(str, sizeof(str), "You have spawned vehicle dynamic ID: %i, model: %i. SQL ID: %d. Faction link: %d", i, modelid, sVehicleInfo[i][v_sqlid], sVehicleInfo[i][v_faction]);
			SendClientMessage(playerid, COLOR_GREY, str);
			Log:debug("DynamicVehicle", "%s spawned vehicle dynamic ID: %i, model: %i, SQLID: %d. Faction link:: %d", PlayerOOCName(playerid), i, modelid, sVehicleInfo[i][v_sqlid], sVehicleInfo[i][v_faction]);
			i = MAX_VEHICLES;
		}
	}
	mysql_format(sqlGameConnection, sqlstring, sizeof(sqlstring), "INSERT INTO `vehicles` (ID, model, x, y, z, rz, color1, color2, faction)");
	mysql_format(sqlGameConnection, sqlstring, sizeof(sqlstring), "%s VALUES (NULL, %i, %f, %f, %f, %f, %i, %i, %i);", sqlstring, modelid, x, y, z, a, color1, color2, faction);
	mysql_pquery(sqlGameConnection, sqlstring);
	return 1;
}

CMD:parkdynamicvehicle(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] <= 4 && PlayerInfo[playerid][pFactionMod] != 1 && PlayerInfo[playerid][pGangDirector] != 1 && PlayerInfo[playerid][pDev] < 2) return AdmErrorMsg;
	if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You are not in a vehicle");
	if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You are not in a vehicle");
	new vehicleid = GetPlayerVehicleID(playerid);
	new dynvehID = GetDynamicVehicleID(vehicleid);
	GetVehiclePos(sVehicleInfo[dynvehID][v_id], sVehicleInfo[dynvehID][v_x], sVehicleInfo[dynvehID][v_y], sVehicleInfo[dynvehID][v_z]);
	GetVehicleZAngle(sVehicleInfo[dynvehID][v_id], sVehicleInfo[dynvehID][v_rz]);
	format(sqlstring, sizeof(sqlstring), "UPDATE `vehicles` SET `x`= %f, `y`= %f, `z`= %f, `rz`= %f WHERE `ID`=%d", sVehicleInfo[dynvehID][v_x], sVehicleInfo[dynvehID][v_y], sVehicleInfo[dynvehID][v_z], sVehicleInfo[dynvehID][v_rz], sVehicleInfo[dynvehID][v_sqlid]);
	mysql_pquery(sqlGameConnection, sqlstring);
	SendClientMessage(playerid, COLOR_WHITE, "Position updated");
	SendClientMessage(playerid, COLOR_WHITE, "use editdynamicvehicle sirenfeature (toggle it on/off) to update the parking position");
	return 1;
}

CMD:near(playerid, params[])
{
	if(!(PlayerInfo[playerid][pAdmin] >= 2 || PlayerInfo[playerid][pDev] >= 2)) return AdmErrorMsg;

	new Float:v_fx, Float:v_fy, Float:v_fz, bydyncveh = 0;
	new str[128];
	for(new i = 0; i < MAX_VEHICLES; i++)
	{
		if(IsValidVehicle(sVehicleInfo[i][v_id]))
		{
			GetVehiclePos(sVehicleInfo[i][v_id], v_fx, v_fy, v_fz);
			if(IsPlayerInRangeOfPoint(playerid, 4, v_fx, v_fy, v_fz))
			{
				format(str, sizeof(str), "Near: dynamic vehicle ID: %i | model: %i | faction: %i | mySQL ID: %d.", i, sVehicleInfo[i][v_model], sVehicleInfo[i][v_faction], sVehicleInfo[i][v_sqlid]);
				SendClientMessage(playerid, COLOR_GREY, str);
				format(str, sizeof(str), "Near: family: %i | lockfeature: %i | sirenfeature: %i | group: %i", sVehicleInfo[i][v_family], sVehicleInfo[i][v_lockfeature], sVehicleInfo[i][v_sirenfeature], sVehicleInfo[i][v_group]);
				SendClientMessage(playerid, COLOR_GREY, str);
				bydyncveh = 1;
			}
		}
	}

	if(bydyncveh == 0)
		SendClientMessage(playerid, COLOR_GREY, "You are not by any dynamic vehicles..");
	return 1;
}
CMD:destroydynamicvehicle(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] <= 4 && PlayerInfo[playerid][pFactionMod] != 1 && PlayerInfo[playerid][pGangDirector] != 1 && PlayerInfo[playerid][pDev] < 2)
		return AdmErrorMsg;
	new
		vehid;
	new str[128];
	if(sscanf(params, "i", vehid)) return SendClientMessage(playerid, -1, "{00BFFF}Usage:{FFFFFF} /destroydynamicvehicle [id]");
	if(IsValidVehicle(sVehicleInfo[vehid][v_id]))
	{
		if(sVehicleInfo[vehid][v_faction] > 0 && PlayerInfo[playerid][pAdmin] < 1337 && PlayerInfo[playerid][pGangDirector] == 0 && PlayerInfo[playerid][pDev] < DEVRANK_SENIOR)
			return AdmErrorMsg;
		format(sqlstring, sizeof(sqlstring), "DELETE FROM `vehicles` WHERE ID=%d", sVehicleInfo[vehid][v_sqlid]);
		mysql_pquery(sqlGameConnection, sqlstring);
		DestroyVehicle(sVehicleInfo[vehid][v_id]);
		format(str, sizeof(str), "You have destroyed vehicle ID: %i, model: %i.", vehid, sVehicleInfo[vehid][v_model]);
		SendClientMessage(playerid, COLOR_GREY, str);
		sVehicleInfo[vehid][v_id] = -1;
		Log:debug("DynamicVehicle", "%s destroyed vehicle ID: %i, model: %i.", PlayerOOCName(playerid), vehid, sVehicleInfo[vehid][v_model]);
	}
	return 1;
}
CMD:gotodynamicvehicle(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] <= 4 && PlayerInfo[playerid][pFactionMod] != 1 && PlayerInfo[playerid][pGangDirector] != 1 && PlayerInfo[playerid][pDev] < 2 )
		return AdmErrorMsg;

	new vehid;
	if(sscanf(params, "i", vehid))
		return SendClientMessage(playerid, -1, "{00BFFF}Usage:{FFFFFF} /gotodynamicvehicle [id]");

	if(IsValidVehicle(sVehicleInfo[vehid][v_id]))
	{
		new
			Float:vx, Float:vy, Float:vz;
		GetVehiclePos(sVehicleInfo[vehid][v_id], vx, vy, vz);
		SetPlayerPos(playerid, vx, vy, vz + 1);

		new
			vstring[128];
		format(vstring, 128, "You have teleported to dynamic vehicle ID: %d.", vehid);
		SendClientMessage(playerid, COLOR_GREY, vstring);
		return 1;
	}
	SendClientMessage(playerid, COLOR_GREY, "Invalid dynamic vehicle ID.");
	return 1;
}

CMD:dlock(playerid, params[])// need to be revised
{
	if(PlayerInfo[playerid][pMember] == 0 && PlayerInfo[playerid][pFMember] == 255 && PlayerInfo[playerid][pGroup] == 0)
		return 1;

	new
		Float: vx, Float:vy, Float:vz;
	for(new i = 0; i < MAX_VEHICLES; i++)
	{
		if(IsValidVehicle(sVehicleInfo[i][v_id]))
		{
			if(!sVehicleInfo[i][v_lockfeature]) continue;
			if(sVehicleInfo[i][v_faction] == 0 && sVehicleInfo[i][v_family] == 0 && sVehicleInfo[i][v_group] == 0) continue;
			GetVehiclePos(sVehicleInfo[i][v_id], vx, vy, vz);

			if( (sVehicleInfo[i][v_faction] == PlayerInfo[playerid][pMember] && PlayerInfo[playerid][pFMember] == 255) ||
				(sVehicleInfo[i][v_family] == PlayerInfo[playerid][pFMember] && PlayerInfo[playerid][pMember] == 0) ||
				(sVehicleInfo[i][v_group] == PlayerInfo[playerid][pGroup]) ||
				PlayerInfo[playerid][pGroup] == GROUP_S9)
			{
				if(IsPlayerInRangeOfPoint(playerid, 3.5, vx, vy, vz))
				{
					sVehicleInfo[i][v_lock] = !sVehicleInfo[i][v_lock];
					new dynstr[128];
					if(sVehicleInfo[i][v_lock] == 0)
						format(dynstr, sizeof(dynstr), "* %s unlocks the vehicle.", PlayerICName(playerid));
					else
						format(dynstr, sizeof(dynstr), "* %s locks the vehicle.", PlayerICName(playerid));
					ProxDetector(30.0, playerid, dynstr, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
					return 1;
				}
			}
		}
	}
	return 1;
}



CMD:editdynamicvehicle(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] <= 4 && PlayerInfo[playerid][pFactionMod] != 1 && PlayerInfo[playerid][pGangDirector] != 1 && PlayerInfo[playerid][pDev] < 2)
		return AdmErrorMsg;

	new
		vehid, action[128];
	if(sscanf(params, "is[128]D(0)D(0)", vehid, action))
	{
		SendClientMessage(playerid, -1, "{00BFFF}Usage:{FFFFFF} /editdynamicvehicle [id] [action]");
		SendClientMessage(playerid, COLOR_GREY, "Available actions: faction, colors, family, lockfeature, sirenfeature, group");
		return 1;
	}

	if(IsValidVehicle(sVehicleInfo[vehid][v_id]))
	{
		new
			Float:vx, Float:vy, Float:vz, Float:vrz;
		GetVehiclePos(sVehicleInfo[vehid][v_id], vx, vy, vz);
		GetVehicleZAngle(sVehicleInfo[vehid][v_id], vrz);
		if(strcmp(action, "faction", true) == 0)
		{
			new faction;
			if(sscanf(params, "is[128]d", vehid, action, faction))
				return SendClientMessage(playerid, -1, "{00BFFF}Usage:{FFFFFF} /editdynamicvehicle [id] faction [faction ID]");

			format(sqlstring, sizeof(sqlstring), "UPDATE `vehicles` SET `faction` = %d WHERE ID = %d", faction, sVehicleInfo[vehid][v_sqlid]);
			mysql_pquery(sqlGameConnection, sqlstring);
			sVehicleInfo[vehid][v_faction] = faction;

			// Remove group & family from this vehicle
			if(sVehicleInfo[vehid][v_family])
				sVehicleInfo[vehid][v_family] = 0;

			if(sVehicleInfo[vehid][v_group])
				sVehicleInfo[vehid][v_group] = 0;

			SendClientMessage(playerid, COLOR_GREY, "You have successfully adjusted the vehicle's faction.");
		}
		if(strcmp(action, "family", true) == 0)
		{
			new family;
			if(sscanf(params, "is[128]d", vehid, action, family))
				return SendClientMessage(playerid, -1, "{00BFFF}Usage:{FFFFFF} /editdynamicvehicle [id] family [gang slot]");

			format(sqlstring, sizeof(sqlstring), "UPDATE `vehicles` SET `family` = %d WHERE ID = %d", family, sVehicleInfo[vehid][v_sqlid]);
			mysql_pquery(sqlGameConnection, sqlstring);
			sVehicleInfo[vehid][v_family] = family;

			// Remove group & faction from this vehicle
			if(sVehicleInfo[vehid][v_faction])
				sVehicleInfo[vehid][v_faction] = 0;

			if(sVehicleInfo[vehid][v_group])
				sVehicleInfo[vehid][v_group] = 0;

			SendClientMessage(playerid, COLOR_GREY, "You have successfully adjusted the vehicle's family.");
		}
		if(strcmp(action, "group", true) == 0)
		{
			new group;
			if(sscanf(params, "is[128]d", vehid, action, group))
				return SendClientMessage(playerid, -1, "{00BFFF}Usage:{FFFFFF} /editdynamicvehicle [id] group [group slot]");

			format(sqlstring, sizeof(sqlstring), "UPDATE `vehicles` SET `group` = %d WHERE ID = %d", group, sVehicleInfo[vehid][v_sqlid]);
			mysql_pquery(sqlGameConnection, sqlstring);
			sVehicleInfo[vehid][v_group] = group;

			// Remove family & faction from this vehicle
			if(sVehicleInfo[vehid][v_faction])
				sVehicleInfo[vehid][v_faction] = 0;

			if(sVehicleInfo[vehid][v_family])
				sVehicleInfo[vehid][v_family] = 0;

			SendClientMessage(playerid, COLOR_GREY, "You have successfully adjusted the vehicle's group.");
		}
		if(strcmp(action, "sirenfeature", true) == 0)
		{
			if(!sscanf(params, "is[128]", vehid, action))
			{
				if(!sVehicleInfo[vehid][v_sirenfeature])
				{
					sVehicleInfo[vehid][v_sirenfeature] = 1;
					SendClientMessage(playerid, COLOR_GREY, "You have successfully enabled the vehicle's siren feature.");
				}
				else
				{
					sVehicleInfo[vehid][v_sirenfeature] = 0;
					SendClientMessage(playerid, COLOR_GREY, "You have successfully disabled the vehicle's siren feature.");
				}
				format(sqlstring, sizeof(sqlstring), "UPDATE `vehicles` SET `Siren` = %d WHERE ID = %d", sVehicleInfo[vehid][v_sirenfeature], sVehicleInfo[vehid][v_sqlid]);
				mysql_pquery(sqlGameConnection, sqlstring);
				SendClientMessage(playerid, COLOR_GREY, sqlstring);
				DestroyVehicle(sVehicleInfo[vehid][v_id]);
				sVehicleInfo[vehid][v_id] = CreateVehicle(sVehicleInfo[vehid][v_model],sVehicleInfo[vehid][v_x],sVehicleInfo[vehid][v_y],sVehicleInfo[vehid][v_z]+2,sVehicleInfo[vehid][v_rz],sVehicleInfo[vehid][v_color1],sVehicleInfo[vehid][v_color2],900, sVehicleInfo[vehid][v_sirenfeature]);
			}
		}
		if(strcmp(action, "lockfeature", true) == 0)
		{
			sVehicleInfo[vehid][v_lockfeature] = !sVehicleInfo[vehid][v_lockfeature];
			format(sqlstring, sizeof(sqlstring), "UPDATE `vehicles` SET `lockfeature` = %d WHERE ID = %d", sVehicleInfo[vehid][v_lockfeature], sVehicleInfo[vehid][v_sqlid]);
			mysql_pquery(sqlGameConnection, sqlstring);
			if(sVehicleInfo[vehid][v_lockfeature] == 1)
				SendClientMessage(playerid, COLOR_GREY, "You have successfully enabled the vehicle's locking feature.");
			else
				SendClientMessage(playerid, COLOR_GREY, "You have successfully disabled the vehicle's locking feature.");
			SendClientMessage(playerid, COLOR_GREY, "This feature allows families/factions to lock/unlock the vehicle.");
			SendClientMessage(playerid, COLOR_GREY, "It's important the vehicle is set to a faction ID or gang slot for this to work.");
		}
		else if(strcmp(action, "colors", true) == 0)
		{
			new color1, color2;
			if(sscanf(params, "is[128]dd", vehid, action, color1, color2))
				return SendClientMessage(playerid, -1, "{00BFFF}Usage:{FFFFFF} /editdynamicvehicle [id] colors [color1] [color2]");

			format(sqlstring, sizeof(sqlstring), "UPDATE `vehicles` SET `color1`= %d, `color2`= %d WHERE `ID`=%d", color1, color2, sVehicleInfo[vehid][v_sqlid]);
			mysql_pquery(sqlGameConnection, sqlstring);
			sVehicleInfo[vehid][v_color1] = color1;
			sVehicleInfo[vehid][v_color2] = color2;
			ChangeVehiclePaintjob(sVehicleInfo[vehid][v_id], 3);
			ChangeVehicleColor(sVehicleInfo[vehid][v_id], color1, color2);
			SendClientMessage(playerid, COLOR_GREY, "You have successfully adjusted the vehicle's colors.");
		}
		else
			return 1;
	}
	else
		SendClientMessage(playerid, COLOR_GREY, "Invalid dynamic vehicle ID.");
	return 1;
}
//==============================================================================

CMD:doorpass( playerid, params[] ) {

	new newpass[128];
	if( sscanf( params, "s[128]", newpass ) ) {
		return SendClientMessage( playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /doorpass [new password(Case Sensitive)]" );
	}
	new str[128];

	for( new d; d < MAX_DOORS; d++ ) {

		if( IsPlayerInRangeOfPoint( playerid, 5.0, Entrances[d][outside_x], Entrances[d][outside_y], Entrances[d][outside_z] ) ) {

			if( Entrances[d][eowner] == PlayerInfo[playerid][pID] ) {
				strdel( Entrances[d][dpassword], 0, 128 );
				if( strcmp(newpass, "none", true) != 0 ) {
					strins( Entrances[d][dpassword], newpass, 0 );
				}

				if( strcmp( newpass, "none", true ) != 0 ) {
					format( str, sizeof( str ), "You have changed the password for this door to %s.", newpass );
				}
				else {
					format( str, sizeof( str ), "You have removed this door's password.");
				}

				SendClientMessage( playerid, COLOR_GRAD1, str );
				return 1;
			}
		}
	}

	SendClientMessage( playerid, COLOR_GREY, "You are not by any doors that you own." );
	return 1;
}

CMD:dcreate(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] < 4 && PlayerInfo[playerid][pDev] < 3) return SendClientMessage(playerid, COLOR_GRAD1, "You are not authorized to use this command.");
	new str[128];
	for(new i = 0; i < MAX_DEALERS; i++)
	{
		if(Dealerships[i][dCreated] != true)
		{
			strmid(Dealerships[i][dName], "New Dealership", 0, 64, 64);
			new Float:X, Float:Y, Float:Z;
			GetPlayerPos(playerid, X, Y, Z);
			Dealerships[i][dPos][0] = X;
			Dealerships[i][dPos][1] = Y;
			Dealerships[i][dPos][2] = Z;
			Dealerships[i][dPos][3] = X;
			Dealerships[i][dPos][4] = Y;
			Dealerships[i][dPos][5] = Z;
			Dealerships[i][dPos][6] = 0.0;
			Dealerships[i][dPickup] = CreateDynamicPickup(1239, 23, Dealerships[i][dPos][0], Dealerships[i][dPos][1], Dealerships[i][dPos][2]);
			format(str, sizeof(str), "Dealership\nName: %s\nID: %d\n/buycar to buy a car.", Dealerships[i][dName], i);
			Dealerships[i][d3DText] = CreateDynamic3DTextLabel(str, 0xFE9A2EFF, Dealerships[i][dPos][0], Dealerships[i][dPos][1], Dealerships[i][dPos][2] +0.8, 60.0);
			Dealerships[i][dCreated] = true;
			for(new c = 0; c < 64; c++)
			{
				Dealerships[i][dCars][c] = 0;
				Dealerships[i][dCarPrice][c] = 0;
			}
			SendClientMessage(playerid, COLOR_GRAD1, "Successfully created a dealership at your position! /dedit to edit it.");
			SaveDealerships();
			break;
		}
	}
	return 1;
}

CMD:dedit(playerid, params[])
{
	new str[128];
	if(PlayerInfo[playerid][pAdmin] > 3 || PlayerInfo[playerid][pDev] > 1)
	{
		SetPVarInt(playerid, "edittingdealer", -1);
		for(new i = 0; i < MAX_DEALERS; i++)
		{
			if(Dealerships[i][dCreated] == true)
			{
				if(IsPlayerInRangeOfPoint(playerid, 4.0, Dealerships[i][dPos][0], Dealerships[i][dPos][1], Dealerships[i][dPos][2]))
				{
					format(str, sizeof(str), "Dealership: %s, %d", Dealerships[i][dName], i);
					ShowPlayerDialog(playerid, 12400, DIALOG_STYLE_LIST, str, "Change Name\nManage Cars\nChange Position\nChange Car Spawning Position\nRemove", "Select", "Cancel");
					SetPVarInt(playerid, "edittingdealer", i);
					break;
				}
			}
		}
		if(GetPVarInt(playerid, "edittingdealer") == -1)
		{
			SendClientMessage(playerid, COLOR_GRAD1, "You're not near any dealership.");
			DeletePVar(playerid, "edittingdealer");
		}
	}
	else
	{
		return SendClientMessage(playerid, COLOR_GRAD1, "You are not authorized to use this command.");
	}
	return 1;
}

CMD:ddone(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] < 4 && PlayerInfo[playerid][pDev] < 2 && PlayerInfo[playerid][pBizMod] < 1 && PlayerInfo[playerid][pMapper] < 3) return SendClientMessage(playerid, COLOR_GRAD1, "You are not authorized to use this command.");
	new did = GetPVarInt(playerid, "movedealerid");
	new eid = GetPVarInt(playerid, "movingdealerid");
	new str[128];
	if( GetPlayerVirtualWorld( playerid ) < 0 ) {
		return SendClientMessage( playerid, COLOR_GREY, "You cannot be inside a negative Virtual World, use /setworld. /ddone when you are done editing." );
	}
	if(eid == 1 && Dealerships[did][dCreated])
	{
		new Float:X, Float:Y, Float:Z;
		GetPlayerPos(playerid, X, Y, Z);
		Dealerships[did][dPos][0] = X;
		Dealerships[did][dPos][1] = Y;
		Dealerships[did][dPos][2] = Z;
		DestroyDynamic3DTextLabel(Dealerships[did][d3DText]);
		DestroyDynamicPickup(Dealerships[did][dPickup]);
		Dealerships[did][dPickup] = CreateDynamicPickup(1239, 23, Dealerships[did][dPos][0], Dealerships[did][dPos][1], Dealerships[did][dPos][2]);
		format(str, sizeof(str), "Dealership\nName: %s\nID: %d\n/buycar to buy a car.", Dealerships[did][dName], did);
		Dealerships[did][d3DText] = CreateDynamic3DTextLabel(str, 0xFE9A2EFF, Dealerships[did][dPos][0], Dealerships[did][dPos][1], Dealerships[did][dPos][2] +0.8, 40.0);
		SaveDealerships();
		SendClientMessage(playerid, COLOR_YELLOW, "You have updated that dealership's position.");
	}
	else if(eid == 2 && Dealerships[did][dCreated])
	{
		new Float:X, Float:Y, Float:Z, Float:A;
		GetPlayerPos(playerid, X, Y, Z);
		GetPlayerFacingAngle(playerid, A);
		Dealerships[did][dPos][3] = X;
		Dealerships[did][dPos][4] = Y;
		Dealerships[did][dPos][5] = Z;
		Dealerships[did][dPos][6] = A;
		SaveDealerships();
		SendClientMessage(playerid, COLOR_YELLOW, "You have updated that dealership's vehicle spawning position.");
	}
	SetPVarInt(playerid, "movedealerid", -1);
	SetPVarInt(playerid, "movingdealerid", -1);
	// Doors
	did = GetPVarInt(playerid, "door_editing_id");
	new dty = GetPVarInt(playerid, "door_editing_type");
	if(dty == 1) // Exterior Moving
	{
		new Float:X, Float:Y, Float:Z, Float:A;
		GetPlayerPos(playerid, X, Y, Z);
		GetPlayerFacingAngle(playerid, A);
		Entrances[did][outside_x] = X;
		Entrances[did][outside_y] = Y;
		Entrances[did][outside_z] = Z;
		Entrances[did][outside_a] = A;
		Entrances[did][outside_i] = GetPlayerInterior(playerid);
		Entrances[did][outside_w] = GetPlayerVirtualWorld(playerid);
		new actualpickupid = 0;
		if(Entrances[did][outside_icon] == 0) actualpickupid = 19198;
		else if(Entrances[did][outside_icon] == 1) actualpickupid = 1239;
		else if(Entrances[did][outside_icon] == 2) actualpickupid = 19131;
		else if(Entrances[did][outside_icon] == 3) actualpickupid = 19132;
		else if(Entrances[did][outside_icon] == 4) actualpickupid = 19133;
		else if(Entrances[did][outside_icon] == 5) actualpickupid = 19134;
		else if(Entrances[did][outside_icon] == 6) actualpickupid = 19135;
		if(EntranceRef[did]) DestroyDynamicPickup(EntranceRef[did]);
		if(EntranceRefInt[did]) DestroyDynamicPickup(EntranceRefInt[did]);
		if(EntranceRefText[did]) DestroyDynamic3DTextLabel(EntranceRefText[did]);
		if( Entrances[did][outside_icon] == 0 ) {
			EntranceRef[did] = CreateDynamicPickup(actualpickupid, 23, Entrances[did][outside_x], Entrances[did][outside_y], Entrances[did][outside_z]+0.4, Entrances[did][outside_w]);
			EntranceRefInt[did] = CreateDynamicPickup(actualpickupid, 23, Entrances[did][inside_x], Entrances[did][inside_y], Entrances[did][inside_z]+0.4, Entrances[did][inside_w]);
		} else {
			EntranceRef[did] = CreateDynamicPickup(actualpickupid, 23, Entrances[did][outside_x], Entrances[did][outside_y], Entrances[did][outside_z], Entrances[did][outside_w]);
			EntranceRefInt[did] = CreateDynamicPickup(actualpickupid, 23, Entrances[did][inside_x], Entrances[did][inside_y], Entrances[did][inside_z], Entrances[did][inside_w]);
		}
		new doornametext[128];
		format(doornametext, sizeof(doornametext), "{43527D}%s{FFFFFF}\n\nType /enter to go inside.", Entrances[did][doorname]);
		EntranceRefText[did] = CreateDynamic3DTextLabel(doornametext, COLOR_ENTRANCE, Entrances[did][outside_x], Entrances[did][outside_y], Entrances[did][outside_z] +0.75, 5.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 1, Entrances[did][outside_w], Entrances[did][outside_i]);
		SaveEntrances();
		SendClientMessage(playerid, COLOR_YELLOW, "You have updated that door's position.");
		format(str, sizeof(str), "%s has moved door ID %d.", PlayerName(playerid), did);
		printf(str);
	}
	if(dty == 2) // Interior Moving
	{
		new Float:X, Float:Y, Float:Z, Float:A;
		GetPlayerPos(playerid, X, Y, Z);
		GetPlayerFacingAngle(playerid, A);
		Entrances[did][inside_x] = X;
		Entrances[did][inside_y] = Y;
		Entrances[did][inside_z] = Z;
		Entrances[did][inside_a] = A;
		Entrances[did][inside_i] = GetPlayerInterior(playerid);
		Entrances[did][inside_w] = GetPlayerVirtualWorld(playerid);
		new actualpickupid = 0;
		if(Entrances[did][outside_icon] == 0) actualpickupid = 19198;
		else if(Entrances[did][outside_icon] == 1) actualpickupid = 1239;
		else if(Entrances[did][outside_icon] == 2) actualpickupid = 19131;
		else if(Entrances[did][outside_icon] == 3) actualpickupid = 19132;
		else if(Entrances[did][outside_icon] == 4) actualpickupid = 19133;
		else if(Entrances[did][outside_icon] == 5) actualpickupid = 19134;
		else if(Entrances[did][outside_icon] == 6) actualpickupid = 19135;
		if(EntranceRef[did]) DestroyDynamicPickup(EntranceRef[did]);
		if(EntranceRefInt[did]) DestroyDynamicPickup(EntranceRefInt[did]);
		if(EntranceRefText[did]) DestroyDynamic3DTextLabel(EntranceRefText[did]);
		if( Entrances[did][outside_icon] == 0 ) {
			EntranceRef[did] = CreateDynamicPickup(actualpickupid, 23, Entrances[did][outside_x], Entrances[did][outside_y], Entrances[did][outside_z]+0.4, Entrances[did][outside_w]);
			EntranceRefInt[did] = CreateDynamicPickup(actualpickupid, 23, Entrances[did][inside_x], Entrances[did][inside_y], Entrances[did][inside_z]+0.4, Entrances[did][inside_w]);
		} else {
			EntranceRef[did] = CreateDynamicPickup(actualpickupid, 23, Entrances[did][outside_x], Entrances[did][outside_y], Entrances[did][outside_z], Entrances[did][outside_w]);
			EntranceRefInt[did] = CreateDynamicPickup(actualpickupid, 23, Entrances[did][inside_x], Entrances[did][inside_y], Entrances[did][inside_z], Entrances[did][inside_w]);
		}
		new doornametext[128];
		format(doornametext, sizeof(doornametext), "{43527D}%s{FFFFFF}\n\nType /enter to go inside.", Entrances[did][doorname]);
		EntranceRefText[did] = CreateDynamic3DTextLabel(doornametext, COLOR_ENTRANCE, Entrances[did][outside_x], Entrances[did][outside_y], Entrances[did][outside_z] +0.75, 5.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 1, Entrances[did][outside_w], Entrances[did][outside_i]);
		SaveEntrances();
		SendClientMessage(playerid, COLOR_YELLOW, "You have updated that door's interior position.");
		format(str, sizeof(str), "%s has edited the interior of door ID %d.", PlayerName(playerid), did);
		printf(str);
	}
	SetPVarInt(playerid, "door_editing_id", -1);
	SetPVarInt(playerid, "door_editing_type", -1);
	return 1;
}

CMD:givegear(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] < 4) return SendClientMessage(playerid, COLOR_GRAD1, "{FF0000}You're not authorized to use that command.");
	new player2;
	if(sscanf(params, "u", player2)) return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /givegear [PlayerID/PartOfName]");
	if(!IsPlayerConnected(player2)) return SendClientMessage(playerid, COLOR_GRAD1, "That player isn't connected to the server.");
	SetPVarInt(playerid, "ToGiveAccessorTo", player2);
	ShowPlayerDialog(playerid, 24210, DIALOG_STYLE_MSGBOX, "Giving gear to player", "Would you like to search for the model or view the list of possible models to give?", "Search", "List");
	return 1;
}

CMD:removegear(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] < 4) return SendClientMessage(playerid, COLOR_GREY, "{FF0000}You're not authorized to use that command.");
	new player;
	if(sscanf(params, "u", player)) return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /removegear [PlayerID/PartOfName]");
	SetPVarInt(playerid, "ToRemoveAccessor", player);
	new bigstring[512], access[7], adminaccess[7];
	for(new clear = 0; clear < 7; clear++)
	{
		access[clear] = -1;
		adminaccess[clear] = -1;
	}
	for(new check = 0; check < sizeof(AccessNames); check++)
	{
		for(new n = 0; n < 7; n++)
		{
			if(AccessNames[check][modid] == Accessories[player][n])
			{
				access[n] = check;
			}
		}
	}
	for(new check = 0; check < sizeof(AdminAccessers); check++)
	{
		for(new n = 0; n < 7; n++)
		{
			if(AdminAccessers[check][modid] == Accessories[player][n])
			{
				adminaccess[n] = check;
			}
		}
	}
	for(new i = 0; i < 7; i++)
	{
		if(access[i] != -1)
		{
			format(bigstring, sizeof(bigstring), "%s\n%s", bigstring, AccessNames[access[i]][modname]);
		}
		else if(adminaccess[i] != -1)
		{
			format(bigstring, sizeof(bigstring), "%s\n%s", bigstring, AdminAccessers[adminaccess[i]][modname]);
		}
		else format(bigstring, sizeof(bigstring), "%s\nEmpty", bigstring);
	}
	ShowPlayerDialog(playerid, 24200, DIALOG_STYLE_LIST, "Remove Gear", bigstring, "Remove", "Cancel");
	return 1;
}

CMD:removeinvalidmods(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] < 2) return 1;
	new bugsremoved = 0;
	for(new i = 0; i < MAX_VEHICLES; i++)
	{
		for(new c = 0; c < 14; c++)
		{
			new component = GetVehicleComponentInSlot(i, c);
			if(!islegalcarmod(i, component))
			{
				RemoveVehicleComponent(i, component);
				bugsremoved++;
			}
		}
	}
	printf("[Mods]: %s has looped the vehicles for invalid mods, removing %d mods.", PlayerICName(playerid), bugsremoved);
	SendClientMessage(playerid, COLOR_GRAD1, "Invalid mods removed.");
	return 1;
}

CMD:getcarhere(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] >= 2)
	{
		new vid;
		if(sscanf(params, "i", vid)) return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /getcarhere [ID]");
		if(vid == INVALID_VEHICLE_ID) return SendClientMessage(playerid, COLOR_GRAD1, "Invalid vehicle ID.");
		new int = GetPlayerInterior(playerid);
		new vw = GetPlayerVirtualWorld(playerid);
		new Float:X, Float:Y, Float:Z, Float:A;
		GetPlayerPos(playerid, X, Y, Z);
		GetPlayerFacingAngle(playerid, A);
		SetVehiclePos(vid, X, Y, Z);
		SetVehicleZAngle(vid, A);
		SetVehicleVirtualWorld(vid, vw);
		LinkVehicleToInterior(vid, int);
		PutPlayerInVehicle(playerid, vid, 0);
	}
	else return SendClientMessage(playerid, COLOR_GRAD1, "You are not authorized to use this command.");
	return 1;
}

CMD:clearads(playerid, params[])
{
	new str[128];
	if(PlayerInfo[playerid][pAdmin] >= 1)
	{
		if(!ADuty[playerid] && PlayerInfo[playerid][pAdmin] == 1) return SendClientMessage(playerid, COLOR_GREY, "You are not on duty.");
		format(str, sizeof(str), "");
		for(new i = 0; i < adCount; i++)
		{
			advertInfo[i][AD_ACTIVE] = false;
			format(advertInfo[i][AD_AUTHOR], 0, "None");
			advertInfo[i][AD_PHONE] = 0;
			format(advertInfo[i][AD_STRING], 0, "None");
		}
		strmid(sendername, PlayerICName(playerid), 0, MAX_PLAYER_NAME);
		format(str, sizeof(str), "{FF0000}AdmWarning{FFFFFF}: An admin has cleared all of the advertisements.");
		ABroadCast(COLOR_WHITE, str, 1);
	}
	return 1;
}

CMD:clearmychat(playerid, params[])
{
	for(new i = 0; i < 100; i++)
	{
		SendClientMessage(playerid, COLOR_WHITE, " ");
	}
	GameTextForPlayer(playerid, "Your chat has been ~r~cleared~w~.", 3000, 5);
	return 1;
}

CMD:clearchat(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] >= 1 || PlayerInfo[playerid][pHelper] >= 2)
	{
		if(!ADuty[playerid] && PlayerInfo[playerid][pAdmin] == 1) return SendClientMessage(playerid, COLOR_GREY, "You are not on duty.");
		new reason[128];
		new str[128];
		sscanf(params, "s[128]", reason);
		if(!strlen(reason)) format(reason, sizeof(reason), "No reason specified.");
		for(new i = 0; i < 100; i++)
		{
			SendClientMessageToAll(COLOR_GREY, "");
		}
		if(PlayerInfo[playerid][pAdmin] != 0) format(str, sizeof(str), "{FF0000}AdmWarning{FFFFFF}: Chat cleared by an admin, reason: %s", reason);
		else format(str, sizeof(str), "{FF0000}AdmWarning{FFFFFF}: Chat cleared by helper %s, reason: %s", PlayerICName(playerid), reason);
		ABroadCast(COLOR_LIGHTRED, str, 1);
	}
	else return AdmErrorMsg;
	return 1;
}
CMD:setmyfamily(playerid, params[])
{
	//if(PlayerInfo[playerid][pGangDirector] > 0 || PlayerInfo[playerid][pGangModd] > 0 || PlayerInfo[playerid][pAdmin] >= 4)
	if(PlayerInfo[playerid][pAdmin] >= 1337 || PlayerInfo[playerid][pGangDirector]  > 0)
	{
		new slot;
		if(sscanf(params, "i", slot)) return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /setmyfamily [family number]");
		new slotname[128];
		if(slot < 0 || slot > 20) return SendClientMessage(playerid, COLOR_RED, "** Invalid slot number.");
		if(slot == 0)
		{
			PlayerInfo[playerid][pFMember] = 255;
			PlayerInfo[playerid][pRank] = 0;
			strmid(slotname, "None", 0, 255);
			PlayerInfo[playerid][pMember] = 0;
			PlayerInfo[playerid][pLeader] = 0;
		}
		else
		{
			PlayerInfo[playerid][pFMember] = slot -1;
			PlayerInfo[playerid][pRank] = 6;
			strmid(slotname, FamilyInfo[slot -1][FamilyName], 0, 255);
			PlayerInfo[playerid][pMember] = 0;
			PlayerInfo[playerid][pLeader] = 0;
		}
		new str[128];
		format(str, sizeof(str), "You have set your family to %s (Slot #%d)", slotname, slot);
		SendClientMessage(playerid, COLOR_WHITE, str);
	}
	else
	{
		SendClientMessage(playerid, COLOR_GRAD1, "You are not authorized to use this command.");
	}
	return 1;
}

CMD:allowcbug(playerid, params[])
	return cmd_allowcs(playerid, params);

CMD:allowcs(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] < 2)
		return AdmErrorMsg;
	new str[128];
	new giveplayerid;
	if(sscanf(params, "u", giveplayerid))
		return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /allowcs [PartOfName/ID]");

	if(!IsPlayerConnected(giveplayerid))
		return SendClientMessage(playerid, COLOR_GREY, "Unknown player.");

	if(!PlayerInfo[giveplayerid][pAdmin])
		return SendClientMessage(playerid, COLOR_GREY, "You can only use this command on admins.");

	if(!CSDisable[giveplayerid])
	{
		CSDisable[giveplayerid] = 1;
		format(str, sizeof(str), "%s is now allowed to crack shoot.", PlayerICName(giveplayerid));
	}
	else
	{
		CSDisable[giveplayerid] = 0;
		format(str, sizeof(str), "%s is now prohibited to crack shoot.", PlayerICName(giveplayerid));
	}

	SendClientMessage(playerid, COLOR_GRAD1, str);
	return 1;
}

CMD:doorinfo(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] >= 3 || PlayerInfo[playerid][pDev] >= 2 || PlayerInfo[playerid][pBizMod] == 1 || PlayerInfo[playerid][pMapper] >= 3 || PlayerInfo[playerid][pBizMod])
	{
		new str[128];
		for(new i = 0; i < sizeof(Entrances); i++)
		{
			if(IsPlayerInRangeOfPoint(playerid, 2.0, Entrances[i][outside_x], Entrances[i][outside_y], Entrances[i][outside_z]) && GetPlayerVirtualWorld(playerid) == Entrances[i][outside_w] && GetPlayerInterior(playerid) == Entrances[i][outside_i])
			{
				if(strlen(Entrances[i][createdby]) == 0) format(str, sizeof(str), "Name: %s\nID: %d, Created by: NULL.\nOwnerSQL: %d", Entrances[i][doorname], i, Entrances[i][eowner] );
				else format(str, sizeof(str), "Name: %s\nID: %d, Created by: %s.\nOwnerSQL: %d", Entrances[i][doorname], i, Entrances[i][createdby], Entrances[i][eowner]);
				SendClientMessage(playerid, SAMP_COLOR, str);
				break;
			}
			else
			{
				if(i == sizeof(Entrances) -1)
				{
					SendClientMessage(playerid, COLOR_GRAD1, "You are not near a door.");
				}
			}
		}
	}
	return 1;
}

CMD:gotodoor(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] >= 2 || PlayerInfo[playerid][pDev] >= 2)
	{
		if(GetPlayerState(playerid) == PLAYER_STATE_SPECTATING) return SendClientMessage(playerid, COLOR_GREY, "You can not do that while spectating.");
		new doortogoto;
		new str[128];
		if(sscanf(params, "i", doortogoto)) return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /gotodoor [door id]");
		{
			if(doortogoto < 0 || doortogoto > 1000) return SendClientMessage(playerid, COLOR_RED, "** Invalid amount.");
			new count = doortogoto;
			format(str, sizeof(str), "%0.2f,%0.2f,%0.2f", Entrances[count][outside_x], Entrances[count][outside_y], Entrances[count][outside_z]);
			if(strcmp(str, "0.00,0.00,0.00", true) == 0) return SendClientMessage(playerid, COLOR_RED, "** Unused door ID.");
			SetPlayerPos(playerid, Entrances[count][outside_x], Entrances[count][outside_y], Entrances[count][outside_z]);
			SetPlayerFacingAngle(playerid, Entrances[count][outside_a]);
			SetPlayerInterior(playerid, Entrances[count][outside_i]);
			SetPlayerVirtualWorld(playerid, Entrances[count][outside_w]);
			displayCenterHUDInfo(playerid,  "~r~Teleporting.", 8); //display for 8 seconds
			format(str, sizeof(str), "You have teleporting to door id %d.", count);
			SendClientMessage(playerid, COLOR_GRAD1, str);
		}
	}
	else return AdmErrorMsg;
	return 1;
}

// Doors
CMD:editdoor(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] >= 4 || PlayerInfo[playerid][pDev] >= 2 || PlayerInfo[playerid][pBizMod] != 0 || PlayerInfo[playerid][pMapper] >= 3 || PlayerInfo[playerid][pBizMod])
	{
		// This is an odd style, but it improves readability (to me, at least).
		ShowPlayerDialog(playerid,
						 DIALOG_EDITDOOR_MAIN,
						 DIALOG_STYLE_LIST,
						 "Edit Door - Main",
						 "Create Door\nEdit Name\nEdit Entrance Position\nEdit Interior Position\nEdit Icon\nChange Password\nFreeze On Enter/Exit\n\nSet Owner\nRemove Door\nCreate Private Door",
						 "Select",
						 "Cancel");
	}
	else
		SendClientMessage(playerid, COLOR_GRAD1, "{FF0000}You're not authorized to use that command.");
	return 1;
}

CMD:approvename(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] >= 1)
	{
		new str[128];
		new giveplayerid;
		if(sscanf(params, "u", giveplayerid))
		{
			SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /approvename [playerid/partofname]");
			return 1;
		}
		if(IsPlayerConnected(giveplayerid))
		{
			if(IsPlayerConnected(GetPlayerIDFromName(NameChangeRequest[giveplayerid])))
			{
				strmid(NameChangeRequest[giveplayerid], "0", 0, 255);
				SendClientMessage(playerid, COLOR_WHITE, "That name is already in use!");
				return 1;
			}
			if(strcmp(NameChangeRequest[giveplayerid], "0", true) != 0)
			{
				new namechangeprice = 0, group = PlayerInfo[giveplayerid][pGroup];
				if(PlayerInfo[giveplayerid][pMember] != 2 && PlayerInfo[giveplayerid][pMember] != 11 && group != GROUP_HITMAN)
				{
					if(PlayerInfo[giveplayerid][pLevel] <= 5) namechangeprice = 15000 * PlayerInfo[giveplayerid][pLevel];
					else if(PlayerInfo[giveplayerid][pLevel] >= 6) namechangeprice = 50000 * PlayerInfo[giveplayerid][pLevel];
				}
				if(isDonatedGroup(PlayerInfo[giveplayerid][pGroup]))// Discount for donated groups (50% off)
					namechangeprice = floatround(namechangeprice / 2, floatround_ceil);
				//owned stuff
				if(PlayerInfo[giveplayerid][pBizKey] != -1) //owns a business
				{
					new biz = PlayerInfo[giveplayerid][pBizKey];
					strmid(BizInfo[biz][bOwner], NameChangeRequest[giveplayerid], 0, strlen(NameChangeRequest[giveplayerid]), 255);
					// Government seized
					if(BizInfo[biz][bSeized] == 1)
					{
						format(str, sizeof(str), "{AFAFAF}%s{AFAFAF}\n{FFFFFF}This business has been seized by the\n{696969}Government", BizInfo[biz][bName]);
					}
					// Judicial Department seized
					else if(BizInfo[biz][bSeized] == 2) {
						format(str, sizeof(str), "{AFAFAF}%s{AFAFAF}\n{FFFFFF}This business has been seized by the\n{BA6103}Judicial Department", BizInfo[biz][bName]);
					}
					else
					{
						if(BizInfo[biz][bLocked] == 1)
						{
							format(str, sizeof(str), "{3D97E0}%s{FFFFFF}\nOwner: %s\nBusiness Status: Locked", BizInfo[biz][bName], BizInfo[biz][bOwner]);
						}
						else
						{
							format(str, sizeof(str), "{3D97E0}%s{FFFFFF}\nOwner: %s", BizInfo[biz][bName], BizInfo[biz][bOwner]);
						}
					}
					UpdateDynamic3DTextLabelText(Text3D:BizText[biz], COLOR_BIZTEXT, str);
				}

				if(PlayerInfo[giveplayerid][pFMember] != 255) //owns a family
				{
					new family = PlayerInfo[giveplayerid][pFMember];
					if(strcmp(FamilyInfo[family][FamilyLeader], PlayerName(giveplayerid), true) == 0)
					{
						strmid(FamilyInfo[family][FamilyLeader], NameChangeRequest[giveplayerid], 0, strlen(NameChangeRequest[giveplayerid]), 255);
						SaveFamilies();
					}
				}
				if(PlayerInfo[giveplayerid][pRadioStation] != 255) //owns a radio station
				{
					new radio = PlayerInfo[giveplayerid][pRadioStation];
					if(strcmp(radioInfo[radio][ownerName], PlayerName(giveplayerid), true) == 0)
					{
						strmid(radioInfo[radio][ownerName], NameChangeRequest[giveplayerid], 0, strlen(NameChangeRequest[giveplayerid]), 255);
						SaveRadios();
					}
				}

				GiveMoney(giveplayerid, -namechangeprice);
				//message
				format(str, sizeof(str), "* You have approved %s's name change request.", PlayerName(giveplayerid));
				SendClientMessage(playerid, COLOR_LIGHTBLUE, str);
				format(str, sizeof(str), "* Your name change request has been approved for $%d.", namechangeprice);
				SendClientMessage(giveplayerid, COLOR_LIGHTBLUE, str);
				format(str, sizeof(str), "{FF0000}AdmWarning{FFFFFF}: %s has approved %s's name change request.", PlayerName(playerid), PlayerName(giveplayerid));
				SendAdminMessage(COLOR_WHITE, str);

				//log the namechange
				format(str, sizeof(str), "%s has renamed %s to %s (/approvename).", PlayerName(playerid), PlayerName(giveplayerid), NameChangeRequest[giveplayerid]);
				StatLog(str);
				//update db
				new query[128];

				mysql_format(sqlGameConnection, query, sizeof(query), "UPDATE `players` SET `Name` = '%e' WHERE `Name` = '%e' LIMIT 1", NameChangeRequest[giveplayerid], PlayerName(giveplayerid));
				mysql_pquery(sqlGameConnection, query); //send the query

				NameChangeLog(PlayerName(giveplayerid), NameChangeRequest[giveplayerid], PlayerName(playerid), PlayerInfo[playerid][pID], PlayerInfo[giveplayerid][pID]);
				//update new name
				SetPlayerName(giveplayerid, NameChangeRequest[giveplayerid]);

				//reset the namechange request?
				strmid(NameChangeRequest[giveplayerid], "0", 0, 255);
			}
			else
			{
				SendClientMessage(playerid, COLOR_GREY, "That player hasn't requested a name change.");
				return 1;
			}
		}
		else
		{
			format(str, sizeof(str), "%s is not an active player.", giveplayerid);
			return 1;
		}
	}
	else
	{
		SendClientMessage(playerid, COLOR_GREY, "{FF0000}You're not authorized to use that command.");
		return 1;
	}
	return 1;
}

CMD:undercover(playerid, params[])
{
	if(
		PlayerInfo[playerid][pGroup] != GROUP_HITMAN && PlayerInfo[playerid][pGroup] != GROUP_S9
	) return 1;

	new newName[25], newLevel;

	if(sscanf(params, "s[25]d", newName, newLevel)) return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /undercover [name] [level]");
	if(!IsValidName(newName)) return SendClientMessage(playerid, -1, "The name you requested doesn't follow the format of: \"Firstname_Lastname\"");
	if(newLevel < 1 || newLevel > 50) return SendClientMessage(playerid, COLOR_GREY, "Your level must be between 1-50.");
	new str[128];
	format(str, sizeof(str), "Your name has to be no longer than %d characters.", 25);
	if(strlen(newName) > 25) return SendClientMessage(playerid, COLOR_GREY, str);

	new query[128];
	mysql_format(sqlGameConnection, query, sizeof(query), "SELECT `Name` FROM `players` WHERE `Name` = '%e' LIMIT 1", newName);
	mysql_pquery(sqlGameConnection, query, "OnUndercoverNamechange", "isi", playerid, newName, newLevel);

	groupNamechangeRequest[playerid] = newName;
	groupLevelChangeRequest[playerid] = newLevel;
	return 1;
}


CMD:approveuc(playerid, params[])
{
	if(PlayerInfo[playerid][pGroup] == GROUP_HITMAN && PlayerInfo[playerid][pGroupRank] == 4  || PlayerInfo[playerid][pGroup] == GROUP_S9 && PlayerInfo[playerid][pGroupRank] == 2){
	}

	new str[128];
	new toplayer;
	if(sscanf(params, "u", toplayer)) return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /approveuc [player]");
	if(!IsPlayerConnected(toplayer)) return SendClientMessage(playerid, COLOR_GREY, "That player is not online.");

	if(PlayerInfo[playerid][pLeader] == FACTION_FBI) { // For FBI | DEA
		if(PlayerInfo[playerid][pMember] != PlayerInfo[toplayer][pMember])
			return SendClientMessage(playerid, COLOR_GREY, "That player is not a member of your organization.");
	}
	else { // For groups
		if(PlayerInfo[playerid][pGroup] != PlayerInfo[toplayer][pGroup])
			return SendClientMessage(playerid, COLOR_GREY, "That player is not a member of your organization.");
	}

	// Check request
	if(strlen(groupNamechangeRequest[toplayer]) < 4)
		return SendClientMessage(playerid, COLOR_GREY, "This player does not have a valid /hnc request at the moment.");

	// If the player owns a business
	if(PlayerInfo[toplayer][pBizKey] != -1) {
		new biz = PlayerInfo[toplayer][pBizKey];
		strmid(BizInfo[biz][bOwner], groupNamechangeRequest[toplayer], 0, strlen(groupNamechangeRequest[toplayer]), 255);

		// Fix the business' labels.
		if(BizInfo[biz][bSeized] == 1) format(str, sizeof(str), "{AFAFAF}%s{AFAFAF}\n{FFFFFF}This business has been seized by the\n{696969}Government", BizInfo[biz][bName]);
		else if(BizInfo[biz][bSeized] == 2)	format(str, sizeof(str), "{AFAFAF}%s{AFAFAF}\n{FFFFFF}This business has been seized by the\n{BA6103}Judicial Department", BizInfo[biz][bName]);
		else {
			if(BizInfo[biz][bLocked] == 1) format(str, sizeof(str), "{3D97E0}%s{FFFFFF}\nOwner: %s\nBusiness Status: Locked", BizInfo[biz][bName], BizInfo[biz][bOwner]);
			else format(str, sizeof(str), "{3D97E0}%s{FFFFFF}\nOwner: %s", BizInfo[biz][bName]);
		}
		UpdateDynamic3DTextLabelText(Text3D:BizText[biz], COLOR_BIZTEXT, str);
	}

	if(PlayerInfo[toplayer][pFMember] != 255) //owns a family
	{
		new family = PlayerInfo[toplayer][pFMember];
		if(strcmp(FamilyInfo[family][FamilyLeader], PlayerName(toplayer), true) == 0)
		{
			strmid(FamilyInfo[family][FamilyLeader], groupNamechangeRequest[toplayer], 0, strlen(groupNamechangeRequest[toplayer]), 255);
			SaveFamilies();
		}
	}
	if(PlayerInfo[toplayer][pRadioStation] != 255) //owns a radio station
	{
		new radio = PlayerInfo[toplayer][pRadioStation];
		if(strcmp(radioInfo[radio][ownerName], PlayerName(toplayer), true) == 0)
		{
			strmid(radioInfo[radio][ownerName], groupNamechangeRequest[toplayer], 0, strlen(groupNamechangeRequest[toplayer]), 255);
			SaveRadios();
		}
	}

	format(str, sizeof(str), "* You have approved %s's undercover request.", PlayerName(toplayer));
	SendClientMessage(playerid, COLOR_LIGHTBLUE, str);
	SendClientMessage(toplayer, COLOR_LIGHTBLUE, "* Your undercover request has been approved.");

	//log the namechange
	format(str, sizeof(str), "%s has renamed %s to %s. Level changed from %d to %d. (/approveuc).",
			PlayerName(playerid), PlayerName(toplayer), groupNamechangeRequest[toplayer], PlayerInfo[toplayer][pLevel], groupLevelChangeRequest[toplayer]);

	StatLog(str);
	//update db
	new query[128];

	mysql_format(sqlGameConnection, query, sizeof(query), "UPDATE `players` SET `Name` = '%e' WHERE `Name` = '%e' LIMIT 1", groupNamechangeRequest[toplayer], PlayerName(toplayer));
	mysql_pquery(sqlGameConnection, query); //send the query

	NameChangeLog(PlayerName(toplayer), groupNamechangeRequest[toplayer], PlayerName(playerid), PlayerInfo[playerid][pID], PlayerInfo[toplayer][pID]);

	format(str, sizeof(str), "%s has approved an undercover namechange from %s to %s with level %d", PlayerICName(playerid), PlayerICName(toplayer), groupNamechangeRequest[toplayer], groupLevelChangeRequest[toplayer]);
	SendAdminMessage(COLOR_LIGHTBLUE, str);

	//update new name
	SetPlayerName(toplayer, groupNamechangeRequest[toplayer]);
	PlayerInfo[toplayer][pLevel] = groupLevelChangeRequest[toplayer];

	//reset the namechange request?
	strmid(groupNamechangeRequest[toplayer], "0", 0, 255);
	return 1;
}

CMD:denyname(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] >= 1)
	{
		new str[128];
		new giveplayerid;
		if(sscanf(params, "u", giveplayerid)) return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /denyname [PlayerID/PartOfName]");
		if(!IsPlayerConnected(giveplayerid) || giveplayerid == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_GREY, "Invalid ID");
		if(!strcmp(NameChangeRequest[giveplayerid], "0", true)) return SendClientMessage(playerid, COLOR_GREY, "That player has not submitted a namechange request.");

		strmid(NameChangeRequest[giveplayerid], "0", 0, 255);
		SendClientMessage(giveplayerid, COLOR_LIGHTBLUE, "* Your name change request has been denied.");
		format(str, sizeof(str), "* You have denied %s's name change request.", PlayerICName(giveplayerid));
		SendClientMessage(playerid, COLOR_LIGHTBLUE, str);
		format(str, sizeof(str), "{FF0000}AdmWarning{FFFFFF}: %s has denied %s's namechange request.", PlayerICName(playerid), PlayerICName(giveplayerid));
		SendAdminMessage(COLOR_WHITE, str);
	}
	else SendClientMessage(playerid, COLOR_GREY, "{FF0000}You're not authorized to use that command.");

	return 1;
}
CMD:namerequests(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] >= 1)
	{
		new requestlistItems = 0;
		new str[128];
		SendClientMessage(playerid, COLOR_YELLOW, "** Name Change Requests **");
		foreach( new i: Player )
		{
			if(IsPlayerConnected(i))
			{
				if(strcmp(NameChangeRequest[i], "0", true) != 0)
				{
					requestlistItems++;
					format(str, sizeof(str), "- Request %d: %s [%d] to %s.", requestlistItems, PlayerICName(i), i, NameChangeRequest[i]);
					SendClientMessage(playerid, COLOR_YELLOW, str);
				}
			}
		}
		if(requestlistItems == 0)
		{
			SendClientMessage(playerid, COLOR_YELLOW, "- None.");
		}
	}
	else
	{
		SendClientMessage(playerid, COLOR_GREY, "{FF0000}You're not authorized to use that command.");
		return 1;
	}
	return 1;
}
CMD:addsurname(playerid, params[])
{
	if(IsPlayerConnected(playerid))
	{
		if(PlayerInfo[playerid][pAdmin] >= 4)
		{
			new tmp2[24];
			new giveplayerid;
			new str[128];
			if(sscanf(params, "s[24] u", tmp2, giveplayerid))
			{
				SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /addsurname [Surname] [playerid/PartOfName]");
				return 1;
			}
			if(IsPlayerNPC(giveplayerid)) return 1;
			if(IsPlayerConnected(giveplayerid))
			{
				if(giveplayerid != INVALID_PLAYER_ID)
				{
					for(new i = 0; i < sizeof(SurnameInfo); i++)
					{
						if(strcmp(SurnameInfo[i][Surname], tmp2) == 0 && SurnameInfo[i][Taken] == 1)
						{
							return SendClientMessage(playerid, COLOR_GRAD1, "That surname is already restricted.");
						}

						if(SurnameInfo[i][Taken] != 1)
						{
							strmid(sendername, PlayerICName(playerid), 0, MAX_PLAYER_NAME);
							strmid(giveplayer, PlayerICName(giveplayerid), 0, MAX_PLAYER_NAME);
							format(str, sizeof(str), "* You've made the surname %s restricted with %s as the owner of it", tmp2, giveplayer);
							SendClientMessage(playerid, COLOR_LIGHTBLUE, str);
							format(str, sizeof(str), "* Admin %s has restricted the surname %s with you as the owner of it.", sendername, tmp2);
							SendClientMessage(giveplayerid, COLOR_LIGHTBLUE, str);
							format(str, sizeof(str), "%s", giveplayer);
							strmid(SurnameInfo[i][Owner], str, 0, strlen(str), 255);
							format(str, sizeof(str), "%s", tmp2);
							strmid(SurnameInfo[i][Surname], str, 0, strlen(str), 255);
							format(str, sizeof(str), "%s", sendername);
							strmid(SurnameInfo[i][AddedBy], str, 0, strlen(str), 255);
							SurnameInfo[i][Taken] = 1;
							SaveSurnames();
							break;
						}
						else
						{
							continue;
						}
					}
				}
			}
			else
			{
				SendClientMessage(playerid, COLOR_GREY, "That player is Offline.");
				return 1;
			}
		}
		else
		{
			SendClientMessage(playerid, COLOR_GREY, "{FF0000}You're not authorized to use that command.");
			return 1;
		}
	}
	return 1;
}
CMD:removesurname(playerid, params[])
{
	if(IsPlayerConnected(playerid))
	{
		if(PlayerInfo[playerid][pAdmin] >= 4)
		{
			new tempstr[128];
			if(sscanf(params, "s[128]", tempstr)) return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /removesurname [Surname]");
			new str[128];
			for(new i = 0; i < MAX_SURNAMES; i++)
			{
				if(strcmp(SurnameInfo[i][Surname], tempstr) == 0 && SurnameInfo[i][Taken] == 1)
				{
					strmid(SurnameInfo[i][Surname], "", 0, 255);
					strmid(SurnameInfo[i][Owner], "", 0, 255);
					strmid(SurnameInfo[i][AddedBy], "", 0, 255);
					SurnameInfo[i][Taken] = 0;
					SaveSurnames();
					format(str, sizeof(str), "** You have removed the restricted surname %s.", tempstr);
					SendClientMessage(playerid, COLOR_LIGHTBLUE, str);
					break;
				}
				else
				{
					if(i +1 == MAX_SURNAMES)
					{
						SendClientMessage(playerid, COLOR_GRAD1, "That surname is not restricted.");
					}
				}
			}
		}
		else
		{
			SendClientMessage(playerid, COLOR_GREY, "{FF0000}You're not authorized to use that command.");
			return 1;
		}
	}
	return 1;
}

CMD:surnamelist(playerid, params[])
{
	new surnames[6000], surnameCount;
	if(IsPlayerConnected(playerid))
	{
		if(PlayerInfo[playerid][pAdmin] >= 4)
		{
			for(new i = 0; i < MAX_SURNAMES; i++)
			{
				if(SurnameInfo[i][Taken] == 1)
				{
					surnameCount++;
					format(surnames, sizeof(surnames), "%s\n%s Owner: %s, added by: %s", surnames, SurnameInfo[i][Surname], SurnameInfo[i][Owner], SurnameInfo[i][AddedBy]);
				}
			}

			if(surnameCount) ShowPlayerDialog(playerid, DIALOG_UNUSED, DIALOG_STYLE_LIST, "Surname List", surnames, "Close", "");
			else SendClientMessage(playerid, COLOR_GREY, "No restricted surnames found.");
		}
	}
	return 1;
}

CMD:wanted(playerid, params[])
{
	if(PlayerInfo[playerid][pJob] == 2)
	{
		new wantedList[3000], count =0;
		foreach( new i: Player )
		{
			if(PlayerInfo[i][pWantedLevel] > 0)
			{
				strmid(giveplayer, PlayerICName(i), 0, MAX_PLAYER_NAME);
				switch(PlayerInfo[i][pWantedLevel])
				{
					case 1..3:
					{
						format(wantedList, sizeof(wantedList), "%s\n{FFFFFF}Name: %s Wanted Level: %d", wantedList, giveplayer, PlayerInfo[i][pWantedLevel]);
						count++;
					}
					case 4..5:
					{
						format(wantedList, sizeof(wantedList), "%s\n{FFE100}Name: %s Wanted Level: %d", wantedList, giveplayer, PlayerInfo[i][pWantedLevel]);
						count++;
					}
					case 6:
					{
						format(wantedList, sizeof(wantedList), "%s\n{D40000}Name: %s Wanted Level: %d", wantedList, giveplayer, PlayerInfo[i][pWantedLevel]);
						count++;
					}
				}
			}
		}
		if(count == 0)format(wantedList, sizeof(wantedList), "There are currently no wanted players.");
		ShowPlayerDialog(playerid, DIALOG_WANTED, DIALOG_STYLE_LIST, "Wanted suspects", wantedList, "Ok", "Cancel");
	}
	else return	SendClientMessage(playerid, COLOR_GREY, "You're not a Lawyer.");
	return 1;
}

CMD:calls(playerid, params[])
{
	if(PlayerInfo[playerid][pMember] == 10)
	{
		new taxistring[1600];
		new taxicalls;
		for(new i = 0; i < MAX_TAXICALLS; i++)
		{
			if(strlen(TaxiCInfo[i][taxiname]) > 2)
			{
				new temp_taxistring[128];
				format(temp_taxistring, sizeof(temp_taxistring), "{FFFFFF}ID: %i{B8B8B8} | %s at %s | Phone: #%s\n", i, TaxiCInfo[i][taxiname], TaxiCInfo[i][taxilocation], TaxiCInfo[i][taxiphone]);
				strcat(taxistring, temp_taxistring);
				temp_taxistring = "";
				taxicalls++;

			}
		}
		strcat(taxistring, "\n{FFFFFF}Enter the caller ID to load into your GPS:");
		if(taxicalls > 0) return ShowPlayerDialog(playerid, TAXICALL_DIALOG, DIALOG_STYLE_INPUT, "Taxi Calls", taxistring, "Accept", "Cancel");
		if(taxicalls == 0) return SendClientMessage(playerid, COLOR_GREY, "	No pending calls.");
	}
	return 1;
}
CMD:clearcalls(playerid, params[])
{
	if(PlayerInfo[playerid][pMember] == 10)
	{
		for(new i = 0; i < MAX_TAXICALLS; i++)
		{
			TaxiCInfo[i][taxiname] = "0";
		}
		SendClientMessage(playerid, COLOR_GREY, "	All calls have been canceled.");
	}
	return 1;
}
CMD:cancelcall(playerid, params[])
{
	if(PlayerInfo[playerid][pMember] != 10) return 1;
	new
		callID;
	if(sscanf(params, "d", callID))
	{
		SetPlayerColor(GetPlayerIDFromName(TaxiCID[playerid]), 0xFFFFFF);
		TaxiCID[playerid] = -1;
	}
	SendClientMessage(playerid, COLOR_GREY, "	The call has been canceled.");
	if(CP[playerid] == CHECKPOINT_TAXI_CALLER)
	{
		CP[playerid] = CHECKPOINT_NONE;
		DisablePlayerCheckpointEx(playerid);
	}
	TaxiCInfo[callID][taxiname] = "0";
	return 1;
}

CMD:call(playerid, params[])
{
	if(PhoneOffline[playerid])
		return SendClientMessage(playerid, COLOR_GREY, "Your cellphone is currently turned off, use /togphone.");

	if(PlayerInfo[playerid][pCash] < 25)
		return SendClientMessage(playerid, COLOR_GREY, "You don't have enough money to make that call. ($25)");

	if(CheckForJammer(playerid))
		return SendClientMessage(playerid, COLOR_GREY, "Phone signal has been jammed.");

	if(	PlayerInfo[playerid][pAdminJailed] ||
		PlayerInfo[playerid][pJailed]
	) return SendClientMessage(playerid, COLOR_LIGHTBLUE, "You can't use this whilst you're in prison.");

	if(PlayerInfo[playerid][pHospital] || IsPlayerRestricted(playerid) || pDeathState[playerid] != PLAYER_STATE_NORMAL)
		return SendClientMessage(playerid, COLOR_GRAD2, "You are unable to use a phone at this time.");

	new payPhoneId = IsPlayerNearPayPhone(playerid);
	if(!payPhoneId && PlayerInfo[playerid][pJailed] == 2)
		return SendClientMessage(playerid, COLOR_GRAD2, "You are not at the prison payphone.");

	if(PlayerInfo[playerid][pPnumber] == 0 && payPhoneId == -1)
		return SendClientMessage(playerid, COLOR_GRAD2, "You don't have a cell phone. You can buy one from any 24/7.");

	if(payPhoneId >= 0)
	{
		if(usePayphone[playerid] == -1 && payPhone[payPhoneId][inUse])
		{
			return SendClientMessage(playerid, COLOR_GRAD2, "This payphone is currently in use by another player.");
		}
	}

	new phonenumb;
	new str[128];
	if(sscanf(params, "d", phonenumb)) return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /call [phone number]");
	if(phonenumb == PlayerInfo[playerid][pPnumber]) return SendClientMessage(playerid, COLOR_GREY, "You cannot call yourself.");
	if(payPhoneId == -1)
	{

		format(str, sizeof(str), "* %s takes out a cellphone.", PlayerICName(playerid));
		if(phonenumb != 420)
		{
			attachPhoneToPlayer(playerid);
		}
	}
	else
	{
		format(str, sizeof(str), "* %s places a call at the payphone.", PlayerICName(playerid));
		payPhone[payPhoneId][inUse] = 1;
		usePayphone[playerid] = payPhoneId;
	}
	if(!cellMuted[playerid])
	{
		playLocalSound(playerid, CELLPHONE_DIAL, 2.0, 400);
	}
	ProxDetector(30.0, playerid, str, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
	if(phonenumb == 911)
	{
		if(payPhoneId == -1)
		{
			SendClientMessage(playerid, COLOR_WHITE, "HINT: You now use T to talk on your cellphone, type (/h)angup to hang up.");
			SendClientMessage(playerid, COLOR_YELLOW, "(cellphone) 911 Operator: Hello, which service do you require, police, paramedic or fire?");
			Mobile[playerid] = 911;
		}
		else
		{
			SendClientMessage(playerid, COLOR_GRAD2, "Your call was rejected.");
			payPhone[payPhoneId][inUse] = 0;
			usePayphone[playerid] = -1;
			detachPhoneFromPlayer(playerid);
		}
		return 1;
	}
	if(phonenumb == 420)
	{
		if(payPhoneId == -1)
		{
			if(PlayerInfo[playerid][pJob] == 14 || PlayerInfo[playerid][pMember] == 10) return SendClientMessage(playerid, COLOR_GREY, "{FF0000}Error:{FFFFFF} You cannot call your own company !");
			SendClientMessage(playerid, COLOR_WHITE, "HINT: You now use T to talk on your cellphone, type (/h)angup to hang up.");
			new bool:lineflooded = true;
			for(new i = 1; i < MAX_TAXICALLS; i++)
			{
				if(strcmp(TaxiCInfo[i][taxiname], PlayerICName(playerid), false) == 0) return OnHangup(playerid, "(cellphone) Taxi Operator: We have already recieved a call from you, be patient !");
				if((strlen(TaxiCInfo[i][taxiname]) < 3))
				{
					TaxiCInfoID[i] = playerid;
					TaxiCInfo[i][taxiname] = PlayerICName(playerid); //name
					GetPlayer2DZone(playerid, TaxiCInfo[i][taxilocation], sizeof(TaxiCInfo[][])); //location
					valstr(TaxiCInfo[i][taxiphone], PlayerInfo[playerid][pPnumber]); //phone
					format(str, sizeof(str), "[Taxi Hotline] %s needs a taxi to %s, pronto ((/calls))!", TaxiCInfo[i][taxiname], TaxiCInfo[i][taxilocation]);
					SendFamilyMessage(10, COLOR_YELLOW, str);
					i = MAX_TAXICALLS;
					lineflooded = false;
				}
				if((i == MAX_TAXICALLS - 1) && lineflooded == true) return OnHangup(playerid, "(cellphone) Taxi Operator: We have no more employees available right now, try again later.");

			}
			return OnHangup(playerid, "(cellphone) Taxi Operator: A taxi driver will be with you soon!");
		}
		else
		{
			SendClientMessage(playerid, COLOR_GRAD2, "Your call was rejected.");
			payPhone[payPhoneId][inUse] = 0;
			usePayphone[playerid] = -1;
			detachPhoneFromPlayer(playerid);
		}
		return 1;
	}
	if(phonenumb == 63971)
	{
		if(payPhoneId == -1)
		{
			if(hotlineState)
			{
				SendClientMessage(playerid, COLOR_WHITE, "HINT: You now use T to talk on your cellphone, type (/h)angup to hang up.");
				SendClientMessage(playerid, COLOR_YELLOW, "(cellphone) Operator: Hello, you're through to San Andreas News. Please state your query!");
				Mobile[playerid] = 63971;
			}
			else
			{
				SendClientMessage(playerid, COLOR_YELLOW, "Hello, you're through to San Andreas News! We're very sorry but our hotline is closed right now.");
				SendClientMessage(playerid, COLOR_GRAD2, "They hung up...");
			}
		}
		else
		{
			SendClientMessage(playerid, COLOR_GRAD2, "Your call was rejected.");
			payPhone[payPhoneId][inUse] = 0;
			usePayphone[playerid] = -1;
		}
		return 1;
	}
	if(phonenumb == PlayerInfo[playerid][pPnumber] && usePayphone[playerid] == -1)
	{
		SendClientMessage(playerid, COLOR_GRAD2, "You just get a busy tone...");
		detachPhoneFromPlayer(playerid);
		ClearAnimationsEx(playerid);
		detachPhoneFromPlayer(playerid);
		return 1;
	}
	if(Mobile[playerid] != 999)
	{
		SendClientMessage(playerid, COLOR_GRAD2, "You are already on a call...");
		return 1;
	}
	foreach( new i: Player )
	{
		if(PlayerInfo[i][pPnumber] == phonenumb && phonenumb != 0)
		{
			if(Blocked[i][Number1] == PlayerInfo[playerid][pPnumber] || Blocked[i][Number2] == PlayerInfo[playerid][pPnumber] || Blocked[i][Number3] == PlayerInfo[playerid][pPnumber] || Blocked[playerid][Number4] == PlayerInfo[playerid][pPnumber] || Blocked[i][Number5] == PlayerInfo[playerid][pPnumber])
			{
				SendClientMessage(playerid, COLOR_GREY, "That players phone is currently offline.");
				return 1;
			}
			Mobile[playerid] = i;
			if(PhoneOffline[i] > 0)
			{
				SendClientMessage(playerid, COLOR_GREY, "That players phone is currently offline.");
				Mobile[playerid] = 999;
				payPhone[payPhoneId][inUse] = 0;
				usePayphone[playerid] = -1;
				return 1;
			}
			if(PlayerInfo[i][pHospital] != 0 || PlayerTied[i] != 0 || PlayerCuffed[i] != 0 || PlayerInfo[i][pJailed] != 0 || PlayerTazed[i] != 0 || CheckForJammer(i))
			{
				SendClientMessage(playerid, COLOR_GRAD2, "That player is unable to speak at this time.");
				Mobile[playerid] = 999;
				payPhone[payPhoneId][inUse] = 0;
				usePayphone[playerid] = -1;
				return 1;
			}
			if(Mobile[i] == 999)
			{
				if(payPhoneId == -1) format(str, sizeof(str), "%s", "Your mobile phone is ringing. Type (/p)ickup to answer.");
				else format(str, sizeof(str), "%s", "Your mobile phone is ringing. Type (/p)ickup to answer (PAYPHONE CALL).");
				if(!cellMuted[i])
				{
					playLocalSound(i, CELLPHONE_RING, 6.0, 0);
				}
				SendClientMessage(i, COLOR_YELLOW, str);
				format(str, sizeof(str), "* %s's phone begins to ring.", PlayerICName(i));
				SendClientMessage(playerid, COLOR_WHITE, "HINT: You now use T to talk on your cellphone, type (/h)angup to hang up.");
				ProxDetector(30.0, i, str, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
				CellTime[playerid] = 1;
				beingCalled[i] = true;
				if(PlayerInfo[playerid][pJailed] == 2)
				{
					TogglePlayerControllable(playerid, false);
				}
				return 1;
			}
			else
			{
				SendClientMessage(playerid, COLOR_GRAD2, "You just get a busy tone...");
				if(usePayphone[playerid] != -1)
				{
					payPhone[payPhoneId][inUse] = 0;
					usePayphone[playerid] = -1;
				}
				Mobile[playerid] = 999;
				detachPhoneFromPlayer(playerid);
				return 1;
			}
		}
	}
	SendClientMessage(playerid, COLOR_GRAD2, "You just get a busy tone...");
	detachPhoneFromPlayer(playerid);
	if(usePayphone[playerid] != -1)
	{
		payPhone[payPhoneId][inUse] = 0;
		usePayphone[playerid] = -1;
	}
	Mobile[playerid] = 999;
	return 1;
}

CMD:speakerphone(playerid, params[])
{
	if(usePayphone[playerid] > -1)
		return SendClientMessage(playerid, COLOR_GRAD2, "This phone does not have a speaker.");

	if(PlayerInfo[playerid][pPnumber] == 0 && usePayphone[playerid] == -1)
		return SendClientMessage(playerid, COLOR_GRAD2, "You don't have a cell phone. You can buy one from any 24/7.");

	if(Mobile[playerid] == 999)
		return SendClientMessage(playerid, COLOR_GREY, "You are not on a phone call.");

	if(!PlayerInfo[playerid][pSpeakPhone])
	{
		SendClientMessage(playerid, COLOR_YELLOW2, "Speaker phone on.");
		PlayerInfo[playerid][pSpeakPhone] = 1;
	}
	else
	{
		SendClientMessage(playerid, COLOR_YELLOW2, "Speaker phone off.");
		PlayerInfo[playerid][pSpeakPhone] = 0;
	}
	return 1;
}

CMD:p(playerid, params[])
{
	PickupCall(playerid);
	return 1;
}
CMD:pickup(playerid, params[])
{
	PickupCall(playerid);
	return 1;
}

CMD:hangup(playerid, params[])
{
	if(IsPlayerFalling(playerid) || IsPlayerRestricted(playerid) || pDeathState[playerid] != PLAYER_STATE_NORMAL)
	{
		SendClientMessage(playerid, COLOR_GREY, "{FF0000}Error:{FFFFFF} You cannot use this right now.");
	}
	else
	{
		HangupCall(playerid);
	}
	return 1;
}

CMD:h(playerid, params[])
	return cmd_hangup(playerid, params);

CMD:sanjingle(playerid, params[])
{
	if(!(PlayerInfo[playerid][pMember] == FACTION_NEWS && PlayerInfo[playerid][pRank] >= 1))
		return AdmErrorMsg;

	if(!PlayerInfo[playerid][pOnDuty])
		return SendClientMessage(playerid, COLOR_GREY, "You need to be on duty.");

	if(IsPlayerInAnyVehicle(playerid))
	{
		if(sVehicleInfo[GetDynamicVehicleID(GetPlayerVehicleID(playerid))][v_faction] != FACTION_NEWS)
			return SendClientMessage(playerid, COLOR_GREY, "{FF0000}Error:{FFFFFF} You have to be in a San Andreas Network issued vehicle.");
	}
	else
	{
		if(PlayerInfo[playerid][pRank] <= 5) return SendClientMessage(playerid, COLOR_GREY, "{FF0000}Error:{FFFFFF} You have to be in a San Andreas Network issued vehicle.");
	}
	new str[128];
	format(str, sizeof(str), "SAN %s: ** The SAN Jingle begins to play as your current broadcast fades out **", PlayerICName(playerid));
	OOCNews(COLOR_NEWS, str);

	foreach( new i: Player )
	{
		if(GetPVarInt(i, "AudioDisabled") != 1)
		{
			PlayAudioStreamForPlayer(i, "http://tinyurl.com/Thornton100");
			SendClientMessage(i, COLOR_ORANGE, "Type /stopplay to stop the music, /toggleplay to toggle all streams.");
		}
	}
	return 1;
}

CMD:sponsor(playerid, params[])
{
	new amount;
	if(sscanf(params, "d", amount))
		return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /sponsor [amount]");

	if(amount <= 0 || amount > PlayerInfo[playerid][pCash])
		return SendClientMessage(playerid, COLOR_GREY, "{FF0000}Error:{FFFFFF} The amount you want to sponsor to the San Andreas Network can not be less than one or greater than your money on hand.");
	new str[128];
	format(str, sizeof(str), "Thank you for sponsoring $%d to the San Andreas Network.", amount);
	SendClientMessage(playerid, COLOR_GREY, str);

	GiveMoney(playerid, -amount);
	NEWS += amount;

	SaveFactionBanks();
	return 1;
}

CMD:toghotline(playerid, params[])
{
	if(PlayerInfo[playerid][pMember] != FACTION_NEWS)
		return AdmErrorMsg;

	toggledHotlined[playerid] = !toggledHotlined[playerid];

	if(!toggledHotlined[playerid])
		SendClientMessage(playerid, COLOR_YELLOW, "You will now see the SAN hotline calls again.");
	else
		SendClientMessage(playerid, COLOR_YELLOW, "You will no longer see the SAN hotline calls.");
	return 1;
}

CMD:sanhotline(playerid, params[])
{
	if(PlayerInfo[playerid][pMember] != FACTION_NEWS)
		return AdmErrorMsg;

	if(PlayerInfo[playerid][pRank] < 3)
		return SendClientMessage(playerid, COLOR_GREY, "Only R3 and above can use this.");

	hotlineState = !hotlineState;

	if(hotlineState)
		SendClientMessage(playerid, COLOR_YELLOW, "You have turned the hotline back online.");
	else
		SendClientMessage(playerid, COLOR_YELLOW, "You have turned the hotline offline.");
	return 1;
}

CMD:sanwithdraw(playerid, params[])
{
	if(PlayerInfo[playerid][pLeader] != FACTION_NEWS)
		return SendClientMessage(playerid, COLOR_GREY, "You are not a leader of SAN news.");

	new amount = 0;
	if(sscanf(params, "i", amount))
	{
		SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /sanwithdraw [amount]");
		new str[128];
		format(str, sizeof(str), "There is $%d in the safe.", NEWS);
		SendClientMessage(playerid, COLOR_GRAD1, str);
		return 1;
	}

	if(amount < 0 || amount > NEWS)
		return SendClientMessage(playerid, COLOR_GRAD1, "Invalid amount.");

	NEWS -= amount;
	GiveMoney(playerid, amount);
	new str[128];
	format(str, sizeof(str), "You have withdrawn $%d from the safe, there is $%d left.", amount, NEWS);
	SendClientMessage(playerid, COLOR_LIGHTBLUE, str);
	return 1;
}

CMD:showpresscard(playerid, params[])
{
	if(PlayerInfo[playerid][pMember] != FACTION_NEWS)
		return AdmErrorMsg;

	new targetid;
	if(sscanf(params, "u", targetid))
		return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /showp(ress)c(ard) [playerID/PartOfName]");

	if(!IsPlayerConnected(targetid))
		return SendClientMessage(playerid, COLOR_GREY, "Invalid playerid.");

	if(!IsPlayerInRangeOfPlayer(5.0, playerid, targetid))
		return SendClientMessage(playerid, COLOR_GREY, "You are not near that player.");
	new str[128];
	format(str, sizeof(str), "* %s shows %s press card to %s.", PlayerICName(playerid), GetPlayerGender(playerid), PlayerICName(targetid));
	ProxDetector(30.0, playerid, str, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);

	format(str, sizeof(str), "[San Andreas Network - %s %s]", GetPlayerRank(playerid), PlayerICName(playerid));
	SendClientMessage(targetid, COLOR_YELLOW, str);
	return 1;
}
CMD:showpc(playerid, params[]) return cmd_showpresscard(playerid, params);

CMD:adblacklist(playerid, params[]) return cmd_blacklistad(playerid, params);
CMD:blacklistad(playerid, params[])
{
	if(PlayerInfo[playerid][pMember] != 9 || PlayerInfo[playerid][pMember] == 9 && PlayerInfo[playerid][pRank] < 4) return AdmErrorMsg;

	new targetid, reason[64];
	new str[128];
	if(sscanf(params, "us[64]", targetid, reason)) return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /blacklistad [playerID/PartOfName] [reason]");
	if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, COLOR_GREY, "{FF0000}Error:{FFFFFF} Invalid playerid.");
	if(PlayerInfo[targetid][pAdMuted] == 1) return SendClientMessage(playerid, COLOR_GREY, "{FF0000}Error:{FFFFFF} That player is already muted from advertisements.");
	if(strlen(reason) > 64) return SendClientMessage(playerid, COLOR_GREY, "{FF0000}Error:{FFFFFF} The reason can not exceed more than 64 characters.");
	format(str, sizeof(str), "SMS: You are blacklisted from posting advertisements for %s, Sender: San Andreas Network (63971)", reason);
	SendClientMessage(targetid, COLOR_YELLOW, str);
	format(str, sizeof(str), "You have blacklisted %s from posting advertisements for %s.", PlayerOOCName(targetid), reason);
	SendClientMessage(playerid, COLOR_DARKRED, str);
	format(str, sizeof(str), "{FF0000}AdmWarning{FFFFFF}: %s has blacklisted %s from posting advertisements for %s.", PlayerOOCName(playerid), PlayerOOCName(targetid), reason);
	printf("%s has blacklisted %s from posting advertisements for %s.", PlayerOOCName(playerid), PlayerOOCName(targetid), reason);
	ABroadCast(COLOR_WHITE, str, 4);
	PlayerInfo[targetid][pAdMuted] = 1;

	return 1;
}

CMD:adunblacklist(playerid, params[]) return cmd_unblacklistad(playerid, params);
CMD:unblacklistad(playerid, params[])
{
	if(PlayerInfo[playerid][pMember] != 9 || PlayerInfo[playerid][pMember] == 9 && PlayerInfo[playerid][pRank] < 4) return AdmErrorMsg;

	new targetid;
	new str[128];
	if(sscanf(params, "u", targetid)) return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /unblacklistad [playerID/PartOfName]");
	if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, COLOR_GREY, "{FF0000}Error:{FFFFFF} Invalid playerid.");
	if(PlayerInfo[targetid][pAdMuted] == 0) return SendClientMessage(playerid, COLOR_GREY, "{FF0000}Error:{FFFFFF} That player is not muted from advertisements.");
	SendClientMessage(targetid, COLOR_YELLOW, "SMS: You are unblacklisted from posting advertisements, Sender: San Andreas Network (63971)");
	format(str, sizeof(str), "You have unblacklisted %s from posting advertisements.", PlayerOOCName(targetid));
	SendClientMessage(playerid, COLOR_DARKRED, str);
	format(str, sizeof(str), "{FF0000}AdmWarning{FFFFFF}: %s has unblacklisted %s from posting advertisements.", PlayerOOCName(playerid), PlayerOOCName(targetid));
	printf("%s has unblacklisted %s from posting advertisements.", PlayerOOCName(playerid), PlayerOOCName(targetid));
	ABroadCast(COLOR_WHITE, str, 4);
	PlayerInfo[targetid][pAdMuted] = 0;

	return 1;
}

CMD:blacklisted(playerid, params[])// untested
{
	new bannedstr[3000];
	if(PlayerInfo[playerid][pMember] != 9 || PlayerInfo[playerid][pMember] == 9 && PlayerInfo[playerid][pRank] < 4) return AdmErrorMsg;
	foreach( new i: Player )
	{
		if(IsPlayerConnected(i))
		{
			if(PlayerInfo[i][pAdMuted])
			{
				 format(bannedstr, sizeof(bannedstr), "%s\n %s", bannedstr, PlayerOOCName(i));
			}
		}
	}
	ShowPlayerDialog(playerid, DIALOG_UNUSED, DIALOG_STYLE_LIST, "Online Blacklisted Players", bannedstr, "Close", "");
	return 1;
}

CMD:placecamera(playerid, params[])
{
	if(PlayerInfo[playerid][pMember] != 9 || PlayerInfo[playerid][pMember] == 9 && PlayerInfo[playerid][pRank] < 2) return AdmErrorMsg;
	if(cameraTaken == true) return SendClientMessage(playerid, COLOR_GREY, "{FF0000}Error:{FFFFFF} The San Andreas Network Camera is being used by somebody.");
	SendClientMessage(playerid, COLOR_LIGHTBLUE, "You placed the San Andreas Network camera, use /startbroadcast to start broadcasting.");
	new Float: p[4], vw = GetPlayerVirtualWorld(playerid), int = GetPlayerInterior(playerid);
	GetPlayerPos(playerid, p[0], p[1], p[2]);
	GetPlayerFacingAngle(playerid, p[3]);

	cameraPos[0] = p[0];
	cameraPos[1] = p[1];
	cameraPos[2] = p[2];
	cameraPos[3] = p[3];

	cameraLookat[0] = p[0];
	cameraLookat[1] = p[1];
	cameraLookat[2] = p[2];
	cameraLookat[3] = p[3];

	GetXYInFrontOfPlayer(playerid, cameraLookat[0], cameraLookat[1], cameraLookat[2], cameraLookat[3], 1);


	cameraPlacedByID = playerid;
	cameraTaken = true;
	cameraVirtualWorld = vw;
	cameraInterior = int;

	cameraObject = CreateDynamicObject(1622, p[0], p[1], p[2], 0.0, 0.0, 0.0, cameraVirtualWorld, cameraInterior);
	cameraText = CreateDynamic3DTextLabel("San Andreas Network Camera", COLOR_LIGHTBLUE, p[0], p[1], p[2], 10.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 0, cameraVirtualWorld, cameraInterior);
	return 1;
}

CMD:startbroadcast(playerid, params[])
{
	if(PlayerInfo[playerid][pMember] != 9 || PlayerInfo[playerid][pMember] == 9 && PlayerInfo[playerid][pRank] < 2) return AdmErrorMsg;
	if(!IsPlayerInRangeOfPoint(playerid, 5.0, cameraPos[0], cameraPos[1], cameraPos[2])) return SendClientMessage(playerid, COLOR_GREY, "{FF0000}Error:{FFFFFF} You are not near the San Andreas Network Camera!");
	if(cameraLive == true) return SendClientMessage(playerid, COLOR_GREY, "{FF0000}Error:{FFFFFF} The San Andreas Network Camera is already live.");
	SendClientMessage(playerid, COLOR_LIGHTBLUE, "You started to broadcast the San Andreas Network with the camera, it is live now.");
	UpdateDynamic3DTextLabelText(cameraText, COLOR_LIGHTBLUE, "San Andreas Network Camera (Live)");
	cameraLive = true;
	return 1;
}

CMD:endbroadcast(playerid, params[])
{
	if(PlayerInfo[playerid][pMember] != 9 || PlayerInfo[playerid][pMember] == 9 && PlayerInfo[playerid][pRank] < 2) return AdmErrorMsg;
	if(!IsPlayerInRangeOfPoint(playerid, 5.0, cameraPos[0], cameraPos[1], cameraPos[2])) return SendClientMessage(playerid, COLOR_GREY, "{FF0000}Error:{FFFFFF} You are not near the San Andreas Network Camera!");
	if(cameraLive == false) return SendClientMessage(playerid, COLOR_GREY, "{FF0000}Error:{FFFFFF} The San Andreas Network Camera is not live.");
	SendClientMessage(playerid, COLOR_LIGHTBLUE, "You ended the broadcast of the San Andreas Network with the camera, it is not live anymore.");
	UpdateDynamic3DTextLabelText(cameraText, COLOR_LIGHTBLUE, "San Andreas Network Camera");
	cameraLive = false;
	return 1;
}

CMD:pickupcamera(playerid, params[])
{
	if(PlayerInfo[playerid][pMember] != 9 || PlayerInfo[playerid][pMember] == 9 && PlayerInfo[playerid][pRank] < 2) return AdmErrorMsg;
	if(cameraTaken != true) return SendClientMessage(playerid, COLOR_GREY, "{FF0000}Error:{FFFFFF} The San Andreas Network Camera is not being used anybody.");
	if(IsPlayerInRangeOfPoint(playerid, 5.0, cameraPos[0], cameraPos[1], cameraPos[2]))
	{
		if(cameraLive == false) SendClientMessage(playerid, COLOR_LIGHTBLUE, "You picked up the San Andreas Network camera.");
		else SendClientMessage(playerid, COLOR_LIGHTBLUE, "You picked up the San Andreas Network camera and caused it to end its broadcast.");
		cameraPlacedByID = INVALID_PLAYER_ID;
		cameraTaken = false;
		cameraLive = false;

		cameraPos[0] = 0;
		cameraPos[1] = 0;
		cameraPos[2] = 0;
		cameraPos[3] = 0;

		cameraVirtualWorld = 0;
		cameraInterior = 0;

		if(cameraObject) { DestroyDynamicObjectEx(cameraObject); }
		cameraObject = 0;
		DestroyDynamic3DTextLabel(cameraText);
		cameraText = Text3D:INVALID_3DTEXT_ID;
	}
	else
	{
		if(CP[playerid] != CHECKPOINT_NONE) return SendClientMessage(playerid, COLOR_GREY, "You already have a checkpoint out, kill it first (/killcp).");
		DisablePlayerCheckpointEx(playerid);
		SetPlayerCheckpointEx(playerid, cameraPos[0], cameraPos[1], cameraPos[2], 3.0);
		CP[playerid] = CHECKPOINT_SANCAMERA;
		SendClientMessage(playerid, COLOR_GRAD1, "A checkpoint was set for you to the San Andreas Network's Camera.");
	}
	return 1;
}

CMD:watchtv(playerid, params[])
{
	if(IsPlayerRestricted(playerid) || PlayerFrozen[playerid] != 0 || IsFishing[playerid] != 0 || pDeathState[playerid] != PLAYER_STATE_NORMAL || GetPlayerAnimationIndex(playerid) == 1130) return SendClientMessage(playerid, COLOR_GRAD1, "You can not do this at this time.");
	if(cameraLive != true) return SendClientMessage(playerid, COLOR_GREY, "{FF0000}Error:{FFFFFF} The San Andreas Network Channel is not live.");
	if(inHouse[playerid] == false || inPaintball[playerid] > 0) return SendClientMessage(playerid, COLOR_GREY, "{FF0000}Error:{FFFFFF} You are not near a television.");
	if(WatchingTV[playerid] == true) return SendClientMessage(playerid, COLOR_GREY, "{FF0000}Error:{FFFFFF} You are already watching television, use /stopwatchingtv to stop watching television.");

	WatchingTV[playerid] = true;

	GetPlayerPos(playerid, PlayerInfo[playerid][pSPos_x], PlayerInfo[playerid][pSPos_y], PlayerInfo[playerid][pSPos_z]);
	GetPlayerFacingAngle(playerid, PlayerInfo[playerid][pSPos_r]);

	PlayerInfo[playerid][pInt] = GetPlayerInterior(playerid);
	PlayerInfo[playerid][pVirtualWorld] = GetPlayerVirtualWorld(playerid);

	SetPlayerVirtualWorld(playerid, cameraVirtualWorld);
	SetPlayerInterior(playerid, cameraInterior);
	SetPlayerPos(playerid, cameraPos[0], cameraPos[1], cameraPos[2]-10);
	SetPlayerCameraPos(playerid, cameraPos[0], cameraPos[1], cameraPos[2]);

	SetPlayerCameraLookAt(playerid, cameraLookat[0], cameraLookat[1], cameraLookat[2]);

	TogglePlayerControllable(playerid, 0);

	SendClientMessage(playerid, COLOR_GREY, "You are now watching the San Andreas Network Channel on television.");
	return 1;
}

CMD:stopwatchingtv(playerid, params[])
{
	if(IsPlayerRestricted(playerid)) return SendClientMessage(playerid, COLOR_GRAD1, "You can not do this at this time.");
	if(WatchingTV[playerid] != true) return SendClientMessage(playerid, COLOR_GREY, "{FF0000}Error:{FFFFFF} You are not watching television.");

	WatchingTV[playerid] = false;

	SetPlayerPos(playerid, PlayerInfo[playerid][pSPos_x], PlayerInfo[playerid][pSPos_y], PlayerInfo[playerid][pSPos_z]);
	SetPlayerFacingAngle(playerid, PlayerInfo[playerid][pSPos_r]);
	SetPlayerVirtualWorld(playerid, PlayerInfo[playerid][pVirtualWorld]);
	SetPlayerInterior(playerid, PlayerInfo[playerid][pInt]);
	TogglePlayerControllable(playerid, 1);
	SetCameraBehindPlayer(playerid);
	Timer_FreezePlayer(playerid, FREEZE, ENTER_FREEZE);

	SendClientMessage(playerid, COLOR_GREY, "You stopped watching television.");
	return 1;
}

CMD:watchers(playerid, params[])
{
	if(PlayerInfo[playerid][pMember] != 9) return SendClientMessage(playerid, COLOR_GREY, "You are not SAN.");

	new wcounter = 0;
	foreach( new i: Player )
	{
		if(WatchingTV[i] == false) continue;
		wcounter++;
	}
	new str[128];
	format(str, sizeof(str), "There are currently %d watchers.", wcounter);
	SendClientMessage(playerid, COLOR_GREY, str);
	return 1;
}

CMD:sandonate(playerid, params[])
{
	new amount;
	if(sscanf(params, "i", amount)) return SendClientMessage(playerid, -1, "{00BFFF}Usage:{FFFFFF} /sandonate [amount]");
	if(amount > PlayerInfo[playerid][pCash]) return SendClientMessage(playerid, COLOR_GREY, "You do not have that much on you.");
	if(amount < 10000) return SendClientMessage(playerid, COLOR_GREY, "The minimum amount for donation is $10,000.");

	NEWS += amount;
	GiveMoney(playerid, -amount);
	new str[128];
	format(str, sizeof(str), "You have donated %d to the SAN!", amount);
	SendClientMessage(playerid, COLOR_LIGHTBLUE, str);

	foreach( new i: Player )
	{
		if(PlayerInfo[i][pMember] == 9 && togsandonate[i] != 1)
		{
			format(str, sizeof(str), "%s has donated %d to the SAN! (/togsandonate to disable this notification)", PlayerICName(playerid), amount);
			SendClientMessage(i, COLOR_YELLOW, str);
		}
	}

	return 1;
}

CMD:togsandonate(playerid, params[])
{
	if(PlayerInfo[playerid][pMember] != 9) return SendClientMessage(playerid, COLOR_GREY, "You are not a member of the News Agency.");

	if(togsandonate[playerid] == 0)
	{
		togsandonate[playerid] = 1;
		SendClientMessage(playerid, COLOR_GREY, "You will no longer be notified of people donating to the SAN.");
	}
	else
	{
		togsandonate[playerid] = 0;
		SendClientMessage(playerid, COLOR_GREY, "You will now be notified of people donating to the SAN.");
	}
	return 1;
}

CMD:dealerships(playerid, params[])
{
	new bigstr[512];
	new d = 0;
	new str[128];
	for(new i = 0; i < MAX_DEALERS; i++)
	{
		if(Dealerships[i][dCreated] == true)
		{
			format(str, sizeof(str), "dealerlist_%d", d);
			SetPVarInt(playerid, str, i);
			format(bigstr, sizeof(bigstr), "%s%s\n", bigstr, Dealerships[i][dName]);
			d++;
		}
	}
	ShowPlayerDialog(playerid, 24325, DIALOG_STYLE_LIST, "Dealerships", bigstr, "Locate", "Cancel");
	return 1;
}


CMD:giveweaponlicense(playerid, params[])
{
	if( ( PlayerInfo[playerid][pMember] == 6 && PlayerInfo[playerid][pRank] >= 2) )
	{

		new targetid;
		new str[128];
		if(sscanf(params, "u", targetid)) return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /g(ive)w(eapon)l(icense) [player id or name]");
		{
			if(IsPlayerConnected(targetid))
			{
				if(GetDistanceBetweenPlayers(playerid, targetid) < 5.0)
				{
					if(playerid != targetid)
					{
						if(PlayerInfo[targetid][pWeaponLicense] == 0)
						{
							format(str, sizeof(str), "[License] You have given %s their weapon license.", PlayerOOCName(targetid));
							SendClientMessage(playerid, COLOR_YELLOW, str);
							format(str, sizeof(str), "[License] You have received your weapon license from %s.", PlayerOOCName(playerid));
							SendClientMessage(targetid, COLOR_YELLOW, str);
							PlayerInfo[targetid][pWeaponLicense] = 1;

							new query[200], day, month, year, hour, minute, second, dstr[40];
							gettime(hour, minute, second);
							getdate(year, month, day);
							format(dstr, sizeof(dstr), "%d/%d/%d %d:%d:%d", day, month, year, hour, minute, second);
							mysql_format(sqlGameConnection, query, sizeof(query), "INSERT INTO `weaponslog` (`Name`, `GivenBy`, `Date`, `Taken`) VALUES('%e', '%e', '%e', 0)", PlayerOOCName(targetid), PlayerOOCName(playerid), dstr);
							mysql_pquery(sqlGameConnection, query, "", "");
						}
						else return SendClientMessage(playerid, COLOR_GREY, "{FF0000}Error:{FFFFFF} That player already has a weapon license.");
					}
					else return SendClientMessage(playerid, COLOR_GREY, "{FF0000}Error:{FFFFFF} You can't give yourself a weapon license.");
				}
				else return SendClientMessage(playerid, COLOR_GREY, "{FF0000}Error:{FFFFFF} You must be close to the player in order to give them a weapon license.");
			}
			else return SendClientMessage(playerid, COLOR_GREY, "{FF0000}Error:{FFFFFF} That player isn't connected.");
		}

	}
	else return AdmErrorMsg;
	return 1;
}

CMD:gwl(playerid, params[]) return cmd_giveweaponlicense(playerid, params);

CMD:takelicense(playerid, params[])
{
	if(!IsACop(playerid))
		return AdmErrorMsg;

	new type[10], targetid;
	if(sscanf(params, "us[10]", targetid, type))
		return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /takelicense [playerid/name] [driving/sailing/weapon/fishing]");

	if(!IsPlayerConnected(targetid))
		return SendClientMessage(playerid, COLOR_GREY, "Unknown player.");

	if(GetDistanceBetweenPlayers(playerid, targetid) > 5)
		return SendClientMessage(playerid, COLOR_GREY, "You are not close enough to this player.");

	new takenLicenseName[24];

	if(strmatch(type, "driving"))
	{
		if(!PlayerInfo[targetid][pCarLicense])
			return SendClientMessage(playerid, COLOR_GREY, "That player doesn't have a driving license.");

		PlayerInfo[targetid][pCarLicense] = 0;
		format(takenLicenseName, sizeof(takenLicenseName), "driving");
	}
	else if(strmatch(type, "sailing"))
	{
		if(!PlayerInfo[targetid][pBoatLicense])
			return SendClientMessage(playerid, COLOR_GREY, "That player doesn't have a sailing license.");

		PlayerInfo[targetid][pBoatLicense] = 0;
		format(takenLicenseName, sizeof(takenLicenseName), "sailing");
	}
	else if(strmatch(type, "fishing"))
	{
		if(!PlayerInfo[targetid][pFishLic])
			return SendClientMessage(playerid, COLOR_GREY, "That player doesn't have a fishing license.");

		PlayerInfo[targetid][pFishLic] = 0;
		format(takenLicenseName, sizeof(takenLicenseName), "fishing");
	}
	else if(strmatch(type, "weapon"))
	{
		if(!PlayerInfo[targetid][pWeaponLicense])
			return SendClientMessage(playerid, COLOR_GREY, "That player doesn't have a weapon license.");

		PlayerInfo[targetid][pWeaponLicense] = 0;
		format(takenLicenseName, sizeof(takenLicenseName), "weapon");

		new query[200], day, month, year, hour, minute, second, dstr[40];
		gettime(hour, minute, second);
		getdate(year, month, day);
		format(dstr, sizeof(dstr), "%d/%d/%d %d:%d:%d", day, month, year, hour, minute, second);
		mysql_format(sqlGameConnection, query, sizeof(query), "INSERT INTO `weaponslog` (`Name`, `GivenBy`, `Date`, `Taken`) VALUES('%e', '%e', '%e', 1)", PlayerOOCName(targetid), PlayerOOCName(playerid), dstr);
		mysql_pquery(sqlGameConnection, query, "", "");
	}
	new str[128];
	format(str, sizeof(str), "* You have taken away %s's %s license.", PlayerICName(targetid), takenLicenseName);
	SendClientMessage(playerid, COLOR_YELLOW, str);

	format(str, sizeof(str), "* %s has taken away your %s license.", PlayerICName(playerid), takenLicenseName);
	SendClientMessage(targetid, COLOR_YELLOW, str);
	return 1;
}

CMD:givelicense(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] >= 1337)
	{
		new type[10], targetid;
		new str[128];
		if(sscanf(params, "us[10]", targetid, type)) return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /givelicense [playerid/name] [driving/boat/weapon]");
		{
			if(IsPlayerConnected(targetid))
			{
				if(strmatch(type, "driving"))
				{
					if(PlayerInfo[targetid][pCarLicense] == 0)
					{
						PlayerInfo[targetid][pCarLicense] = 1;
						format(str, sizeof(str), "[License Given] %s has given you a driving license.", PlayerICName(playerid));
						SendClientMessage(targetid, COLOR_YELLOW, str);
						format(str, sizeof(str), "[License Given] You have given %s a driving license.", PlayerICName(targetid));
						SendClientMessage(playerid, COLOR_YELLOW, str);
					}
					else return SendClientMessage(playerid, COLOR_GREY, "That player has a driving license.");
				}
				else if(strmatch(type, "boat"))
				{
					if(PlayerInfo[targetid][pBoatLicense] == 0)
					{
						PlayerInfo[targetid][pBoatLicense] = 1;
						format(str, sizeof(str), "[License Withdrawal] %s has given you your sailing license.", PlayerICName(playerid));
						SendClientMessage(targetid, COLOR_YELLOW, str);
						format(str, sizeof(str), "[License Withdrawal] You have given %s a sailing license.", PlayerICName(targetid));
						SendClientMessage(playerid, COLOR_YELLOW, str);
					}
					else return SendClientMessage(playerid, COLOR_GREY, "That player doesn't have a sailing license.");
				}
				else if(strmatch(type, "weapon"))
				{
					if(PlayerInfo[targetid][pWeaponLicense] == 0)
					{
						PlayerInfo[targetid][pWeaponLicense] = 1;
						format(str, sizeof(str), "[License Withdrawal] %s has given you your weapon license.", PlayerICName(playerid));
						SendClientMessage(targetid, COLOR_YELLOW, str);
						format(str, sizeof(str), "[License Withdrawal] You have given %s a weapon license.", PlayerICName(targetid));
						SendClientMessage(playerid, COLOR_YELLOW, str);
						new query[250], day, month, year, hour, minute, second, dstr[40];
						gettime(hour, minute, second);
						getdate(year, month, day);
						format(dstr, sizeof(dstr), "%d/%d/%d %d:%d:%d", day, month, year, hour, minute, second);
						mysql_format(sqlGameConnection, query, sizeof(query), "INSERT INTO `weaponslog` (`Name`, `GivenBy`, `Date`, `Taken`) VALUES('%e', '%e', '%e', 0)", PlayerOOCName(targetid), PlayerOOCName(playerid), dstr);
						mysql_pquery(sqlGameConnection, query, "", "");
					}
					else return SendClientMessage(playerid, COLOR_GREY, "That player doesn't have a weapon license.");
				}
				else return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /takelicense [playerid/name] [driving/boat/weapon]");
			}
			else return SendClientMessage(playerid, COLOR_GREY, "{FF0000}Error:{FFFFFF} That player isn't connected.");
		}
	}
	else return AdmErrorMsg;
	return 1;
}

CMD:hupgrade(playerid, params[])
{
	if(PlayerInfo[playerid][pHouseID] != 0)
	{
		ShowPlayerDialog(playerid, DIALOG_HOUSEUPGRADE, DIALOG_STYLE_LIST, "House Upgrades", "Alarm ($30,000)", "Select", "Cancel");
	}
	else return SendClientMessage(playerid, COLOR_GREY, "You don't own a house.");
	return 1;
}

CMD:buycar(playerid, params[])
{
	for(new d = 0; d < MAX_DEALERS; d++)
	{
		if(IsPlayerInRangeOfPoint(playerid, 2.0, Dealerships[d][dPos][0], Dealerships[d][dPos][1], Dealerships[d][dPos][2]))
		{
		    new player;
		    new slot = GetPlayerFreeCarslot( player );
		    if( slot == 0 ) return SendClientMessage(playerid, COLOR_GRAD1, "You do not have any free slots to buy another car. Sell a car first, or dump one.");
			if(PlayerInfo[playerid][pConnectTime] < 2) return SendClientMessage(playerid, COLOR_GRAD1, "You must play for at least 2 hours to buy a vehicle.");

			new bigstr[1024];
			bigstr = "Vehicle\tPrice\n";
			for(new c = 0; c < 64; c++)
			{
				if(Dealerships[d][dCars][c] >= 400)
				{
					format(bigstr, sizeof(bigstr), "%s%s\t{3e823f}$%s\n", bigstr, GetVehicleFriendlyNameFromModel(Dealerships[d][dCars][c]), AddThousandsSeparators(Dealerships[d][dCarPrice][c]));
				}
			}
			new str[128];
			format(str, sizeof(str), "%s", Dealerships[d][dName]);
			ShowPlayerDialog(playerid, 12460, DIALOG_STYLE_TABLIST_HEADERS, str, bigstr, "Purchase", "Cancel");
			SetPVarInt(playerid, "buyingdealer", d);
			break;
		}
	}
	return 1;
}

CMD:gear(playerid, params[])
{
	if(IsPlayerGagged(playerid))
		return SendClientMessage(playerid, COLOR_GREY, "You cannot use this while gagged.");

	ShowAccessDialog(playerid, 0);
	return 1;
}

CMD:removehyd(playerid, params[])
{
	if(!IsPlayerInAnyVehicle(playerid))
		return SendClientMessage(playerid, COLOR_GRAD1, "You must be in a vehicle to use this command.");
	new vid = GetPlayerVehicleID(playerid);
	if(vid == INVALID_VEHICLE_ID)
		return SendClientMessage(playerid, COLOR_GRAD1, "For some epic reason, your car has an invalid vehicle ID.");
	if(GetVehicleComponentInSlot(vid, CARMODTYPE_HYDRAULICS) != 1087)
		return SendClientMessage(playerid, COLOR_GRAD1, "This car does not have hydraulics on it.");
	RemoveVehicleComponent(vid, 1087);
	SendClientMessage(playerid, COLOR_GRAD1, "Hydraulics removed.");
	return 1;
}

CMD:hpm(playerid, params[]){
	if(PlayerInfo[playerid][pHelper] == 0)return SendClientMessage(playerid, COLOR_GREY, "You're not a Helper.");

	new targetid, msg[128];
	new str[128];
	if(sscanf(params, "us[128]", targetid, msg))return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /hpm [playerid/name] [message]");
	{
		if(IsPlayerConnected(targetid))
		{
			format(str, sizeof(str), "Helper %s: %s", PlayerOOCName(playerid), msg);
			SendClientMessage(targetid, COLOR_YELLOW, str);
			format(str, sizeof(str), "You messaged %s: %s", PlayerOOCName(targetid), msg);
			SendClientMessage(playerid, COLOR_YELLOW, str);
			new hrank[30];

			switch(PlayerInfo[playerid][pHelper]){
				case 1:hrank = "Trial Helper";
				case 2:hrank = "Helper";
				case 3:hrank = "Senior Helper";
				case 4:hrank = "Head Helper";
				case 5:hrank = "Director of The Helpers Team";
			}

			if(AdminHelp[targetid] == 1)
			{
				format(str, 256, "** %s: %s[%d] has responded to %s's request for help with: %s.", hrank, PlayerICName(playerid), playerid, PlayerICName(targetid), msg);
				SendHelperMessage(NEWBIE_COLOR, str, 0);
				AdminHelp[targetid] = 0;
			}
		}
		else return SendClientMessage(playerid, COLOR_GREY, "That player isn't connected.");
	}
	return 1;
}

CMD:hveh(playerid, params[]){
	if(PlayerInfo[playerid][pHelper] == 0)return SendClientMessage(playerid, COLOR_GREY, "You're not a Helper.");
	if(HelpingNewbie[playerid] == false)return SendClientMessage(playerid, COLOR_GREY, "You're not helping a newbie.");
	if(HelperVeh2[playerid] == true)return SendClientMessage(playerid, COLOR_GREY, "You already have a helper vehicle spawned.");

	new Float:x, Float:y, Float:z;
	GetPlayerPos(playerid, x, y, z);

	helperVeh[playerid] = CreateVehicle(560, x, y, z, 90.0, -1, -1, -1);
	Gas[helperVeh[playerid]] = 100;
	new engine, lights, alarm, doors, bonnet, boot, objective;
	GetVehicleParamsEx(helperVeh[playerid], engine, lights, alarm, doors, bonnet, boot, objective);
	SetVehicleParamsEx(helperVeh[playerid], true, true, alarm, false, bonnet, boot, objective);

	LinkVehicleToInterior(helperVeh[playerid], GetPlayerInterior(playerid));
	SetVehicleVirtualWorld(helperVeh[playerid], GetPlayerVirtualWorld(playerid));

	gCarLock[helperVeh[playerid]] = 0;
	PutPlayerInVehicle(playerid, helperVeh[playerid], 0);
	HelperVeh2[playerid] = true;

	SetVehicleParamsForPlayer(helperVeh[playerid], playerid, 0, 0);
	return 1;
}

CMD:hw(playerid, params[])
{
	if(!IsPlayerInAnyVehicle(playerid))
	{
		return SendClientMessage(playerid, COLOR_GRAD2, "You are not inside any vehicle.");
	}
	if(GetPlayerVehicleSeat(playerid) != 0)
	{
		return SendClientMessage(playerid, COLOR_GRAD2, "You are not in the driver seat.");
	}
	if(engineOn[GetPlayerVehicleID(playerid)] == 1)
	{
		return SendClientMessage(playerid, COLOR_GRAD2, "The engine is already on.");
	}
	if(!GetVehNeedHW(GetPlayerVehicleID(playerid), playerid))
	{
		return SendClientMessage(playerid, COLOR_GRAD2, "You don't need to hotwire this vehicle.");
	}
	if(hotWireTime[playerid] > 0)
	{
		return SendClientMessage(playerid, COLOR_GRAD2, "You are already hotwiring a car.");
	}
	if(PlayerInfo[playerid][pScrew] <= 0)
	{
		return SendClientMessage(playerid, COLOR_GRAD2, "You need a screwdriver to start hotwiring.");
	}
	hotWireVeh[playerid] = GetPlayerVehicleID(playerid);
	hotWireTime[playerid] = GetVehHWTime(playerid);
	new str[128];
	format(str, sizeof(str), "* %s starts to mess with wires under the steering column.", PlayerICName(playerid));
	ProxDetector(30.0, playerid, str, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
	return 1;
}

CMD:siren(playerid, params[])
{
	if(IsPlayerConnected(playerid))
	{
		new VID = GetPlayerVehicleID(playerid);
		new str[128];
		if(IsACop(playerid) || PlayerInfo[playerid][pMember] == 4 || PlayerInfo[playerid][pMember] == 5)
		{
			if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
			{
				if(isMotorbike(GetPlayerVehicleID(playerid))) return SendClientMessage(playerid, COLOR_GREY, "This vehicle can't have a siren.");
				new x_siren[128];
				if(sscanf(params, "s[128]", x_siren))
				{
					if(PlayerInfo[playerid][pMember] == 4)
					{
						SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /siren [type]");
						SendClientMessage(playerid, COLOR_GRAD1, "Available types: Roof, Off");
						return 1;
					}
					else
					{
						SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /siren [type]");
						SendClientMessage(playerid, COLOR_GRAD1, "Available types: Inside, Roof, Rooftop, Off");
						return 1;
					}
				}
				else if(strcmp(x_siren, "inside", true) == 0)
				{
					if(PlayerInfo[playerid][pMember] == 4) return SendClientMessage(playerid, COLOR_GRAD2, "You can't use this.");
					if(Siren[VID] == 1) return SendClientMessage(playerid, COLOR_GRAD2, "This vehicle already has a siren.");
					Siren[VID] = 1;
					SirenObject[VID] = CreateDynamicObject(18646, 10.0, 10.0, 10.0, 0, 0, 0);
					new VID2 = GetVehicleModel(VID);
					new Float:VX, Float:VY, Float:VZ;
					GetVehicleModelInfo(VID2, VEHICLE_MODEL_INFO_FRONTSEAT, VX, VY, VZ);
					AttachDynamicObjectToVehicle(SirenObject[VID], VID, 0.0, VY +0.7, VZ +0.5, 0.0, 0.1, 0.0);
					format(str, sizeof(str), "* %s puts the siren on the dashboard.", PlayerICName(playerid));
					ProxDetector(30.0, playerid, str, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
					SendClientMessage(playerid, COLOR_WHITE, "> Siren {00FF00}On{FFFFFF}!");
					return 1;
				}
				else if(strcmp(x_siren, "roof", true) == 0)
				{
					new VID2 = GetVehicleModel(VID);
					if(VID2 == 487 || VID2 == 416) return SendClientMessage(playerid, COLOR_GRAD2, "This vehicle cannot have siren.");
					if(Siren[VID] == 1) return SendClientMessage(playerid, COLOR_GRAD2, "This vehicle already has a siren.");
					if(PlayerInfo[playerid][pMember] == 4 && sVehicleInfo[GetDynamicVehicleID(VID)][v_faction] != 4 && VID2 != 560) return SendClientMessage(playerid, COLOR_GRAD2, "You can't place a siren on this vehicle.");
					Siren[VID] = 1;
					SirenObject[VID] = CreateDynamicObject(18646, 10.0, 10.0, 10.0, 0, 0, 0);
					new Float:VX, Float:VY, Float:VZ;
					new Float:VX2, Float:VY2, Float:VZ2;
					GetVehicleModelInfo(VID2, VEHICLE_MODEL_INFO_SIZE, VX, VY, VZ);
					GetVehicleModelInfo(VID2, VEHICLE_MODEL_INFO_FRONTSEAT, VX2, VY2, VZ2);
					AttachDynamicObjectToVehicle(SirenObject[VID], VID, -0.43, VY2, VZ /1.93, 0.0, 0.1, 0.0);
					format(str, sizeof(str), "* %s puts the siren on the roof.", PlayerICName(playerid));
					ProxDetector(30.0, playerid, str, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
					SendClientMessage(playerid, COLOR_WHITE, "> Siren {00FF00}On{FFFFFF}!");
					return 1;
				}
				else if(strcmp(x_siren, "rooftop", true) == 0)
				{
					if(PlayerInfo[playerid][pMember] == 4) return SendClientMessage(playerid, COLOR_GRAD2, "You can't use this.");
					if(PlayerInfo[playerid][pRank] < 3) return SendClientMessage(playerid, COLOR_GRAD1, "You must be atleast rank 3 to use this.");
					if(Siren[VID] == 1) return SendClientMessage(playerid, COLOR_GRAD2, "This vehicle already has a siren.");
					Siren[VID] = 1;
					new VID2 = GetVehicleModel(VID);
					if(VID == 487 || VID2 == 416) return SendClientMessage(playerid, COLOR_GRAD2, "This vehicle cannot have siren.");
					new Float:VX, Float:VY, Float:VZ;
					new Float:VX2, Float:VY2, Float:VZ2;
					SirenObject[VID] = CreateDynamicObject(19620, 10.0, 10.0, 10.0, 0, 0, 0);
					GetVehicleModelInfo(VID2, VEHICLE_MODEL_INFO_SIZE, VX, VY, VZ);
					GetVehicleModelInfo(VID2, VEHICLE_MODEL_INFO_FRONTSEAT, VX2, VY2, VZ2);
					AttachDynamicObjectToVehicle(SirenObject[VID], VID, 0, VY2, VZ /1.93, 0.0, 0.1, 0.0);
					format(str, sizeof(str), "* %s puts the siren on the roof.", PlayerICName(playerid));
					ProxDetector(30.0, playerid, str, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
					SendClientMessage(playerid, COLOR_WHITE, "> Siren {00FF00}On{FFFFFF}!");
					return 1;
				}
				else if(strcmp(x_siren, "off", true) == 0)
				{
					if(Siren[VID] == 0) return SendClientMessage(playerid, COLOR_GRAD2, "This vehicle doesn't have a siren on it.");
					Siren[VID] = 0;
					if(SirenObject[VID]) { DestroyDynamicObjectEx(SirenObject[VID]); }
					SirenObject[VID] = 0;
					format(str, sizeof(str), "* %s takes down the siren.", PlayerICName(playerid));
					ProxDetector(30.0, playerid, str, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
					SendClientMessage(playerid, COLOR_WHITE, "> Siren {820101}Off{FFFFFF}!");
					return 1;
				}
				else
				{
					if(PlayerInfo[playerid][pMember] == 4) return SendClientMessage(playerid, COLOR_GRAD1, "Available types: Roof, Off");
					else return SendClientMessage(playerid, COLOR_GRAD2, "Available types: Inside, Roof, Rooftop, Off");
				}
			}
			else SendClientMessage(playerid, COLOR_GREY, "You're not driving a vehicle.");
		}
		else  SendClientMessage(playerid, COLOR_GREY, "You are not a Law Enforcement Official or a Paramedic.");
	}
	return 1;
}

CMD:taxisign(playerid, params[])
{
	if(IsPlayerConnected(playerid))
	{
		new VID = GetPlayerVehicleID(playerid);
		new str[128];
		if(PlayerInfo[playerid][pMember] == 10 || PlayerInfo[playerid][pLeader] == 10)
		{
			if(PlayerInfo[playerid][pRank] < 4) return SendClientMessage(playerid, COLOR_GREY, "You must be atleast Rank 4.");
			if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
			{
				if(IsAPlane(VID)) return SendClientMessage(playerid, COLOR_GREY, "This can only be used on cars.");
				else if(IsAHelicopter(VID)) return SendClientMessage(playerid, COLOR_GREY, "This can only be used on cars.");
				else if(IsABike(VID)) return SendClientMessage(playerid, COLOR_GREY, "This can only be used on cars.");
				else if(IsABoat(VID)) return SendClientMessage(playerid, COLOR_GREY, "This can only be used on cars.");

				if(Taxi[VID] == 0)
				{
					Taxi[VID] = 1;
					TaxiSign[VID] = CreateDynamicObject(19308, 10.0, 10.0, 10.0, 0, 0, 0);
					new VID2 = GetVehicleModel(VID);
					new Float:VX, Float:VY, Float:VZ;
					new Float:VX2, Float:VY2, Float:VZ2;
					GetVehicleModelInfo(VID2, VEHICLE_MODEL_INFO_SIZE, VX, VY, VZ);
					GetVehicleModelInfo(VID2, VEHICLE_MODEL_INFO_FRONTSEAT, VX2, VY2, VZ2);
					//AttachObjectToVehicle(TaxiSign[VID], VID, -0.1, VY2, VZ/1.7, 0.0, 0.0, 90.0);
					AttachDynamicObjectToVehicle(TaxiSign[VID], VID, 0, VY2, VZ /1.75, 0.0, 0.0, 90.0);
					format(str, sizeof(str), "* %s puts the taxi sign on the roof.", PlayerICName(playerid));
					ProxDetector(30.0, playerid, str, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
					return 1;
				}
				else
				{
					Taxi[VID] = 0;
					if(TaxiSign[VID]) { DestroyDynamicObjectEx(TaxiSign[VID]); }
					TaxiSign[VID] = 0;
					format(str, sizeof(str), "* %s takes down the taxi sign.", PlayerICName(playerid));
					ProxDetector(30.0, playerid, str, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
					return 1;
				}
			}
			else
			{
				SendClientMessage(playerid, COLOR_GREY, "You are not driving a vehicle.");
				return 1;
			}
		}
		else
		{
			SendClientMessage(playerid, COLOR_GREY, "You are not a member of the San Andreas Taxi Company.");
			return 1;
		}
	}
	return 1;
}

CMD:removefailedhit(playerid, params[])
{
	new giveplayerid;
	if(PlayerInfo[playerid][pAdmin] < 1337) return SendClientMessage(playerid, COLOR_GRAD2, "You are not authorised to use that command.");
	if(sscanf(params, "u", giveplayerid)) return SendClientMessage(playerid, COLOR_GRAD2, "{00BFFF}Usage:{FFFFFF} /removefailedhit [playerid/partOfName]");
	if(PlayerInfo[giveplayerid][pFHits] >= 1)
	{
		PlayerInfo[giveplayerid][pFHits]--;
		SendClientMessage(playerid, COLOR_LIGHTBLUE, "* You have removed a failed contract from that player.");
		SendClientMessage(giveplayerid, COLOR_LIGHTBLUE, "* You have had a failed contract removed by an Admin.");
		return 1;
	}
	return 1;
}

CMD:address(playerid, params[])
{
	if(PlayerInfo[playerid][pAddressBook] == 0) return SendClientMessage(playerid, COLOR_GRAD1, "You do not have an address book.");
	new postalID;
	if(sscanf(params, "d", postalID)) return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /address [Postal Code]");

	new houseID = -1;
	for(new i = 0; i < MAX_HOUSES; i++){
		if(HouseInfo[i][hSQLID] == postalID){
			houseID = i;
			break;
		}
	}

	if(houseID == -1)
		return SendClientMessage(playerid, COLOR_GREY, "Invalid postal code");

	if(!HouseInfo[houseID][hCreated])
		return SendClientMessage(playerid, COLOR_GREY, "That house does not exist");

	if(CP[playerid] != CHECKPOINT_NONE)
	{
		CP[playerid] = CHECKPOINT_NONE;
		DisablePlayerCheckpointEx(playerid);
	}
	SetPlayerCheckpointEx(playerid, HouseInfo[houseID][hOutsideX], HouseInfo[houseID][hOutsideY], HouseInfo[houseID][hOutsideZ], 2.0);
	CP[playerid] = CHECKPOINT_ADDRESS;
	new msg[128];
	format(msg, sizeof(msg), "That house with the postal code %d has been marked on the map (red dot).", postalID);
	SendClientMessage(playerid, COLOR_WHITE, msg);
	return 1;
}

CMD:namechange(playerid, params[])
{
	if(!IsPlayerInRangeOfPoint(playerid, 2.0, -2106.8853, 764.0605, 9006.1152))
		return SendClientMessage(playerid, COLOR_GRAD1, "You can only do this at the Service Desk inside the City Hall.");

	new str[128];
	new bool:isthereadmin = false;
	foreach( new i: Player )
	{
		if(PlayerInfo[i][pAdmin] > 1)
		{
			isthereadmin = true;
			break;
		}
	}

	if(isthereadmin == false)
		return SendClientMessage(playerid, COLOR_GRAD1, "No admins can currently accept your name change request! Try again later.");

	if(PlayerInfo[playerid][pReqNC] > 0)
	{
		format(str, sizeof(str), "You must wait %d seconds before requesting a namechange again!", PlayerInfo[playerid][pReqNC]);
		SendClientMessage(playerid, COLOR_GREY, str);
		return 1;
	}

	new name[MAX_PLAYER_NAME];
	if(sscanf(params, "s[24]", name))
		return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /namechange [firstname_lastname]");

	new namechangeprice = 0;
	if(PlayerInfo[playerid][pLevel] <= 5) {
		namechangeprice = 15000 * PlayerInfo[playerid][pLevel];
	}
	else {
		namechangeprice = 50000 * PlayerInfo[playerid][pLevel];
	}

	// Discount for donated groups (50% off)
	if(isDonatedGroup(PlayerInfo[playerid][pGroup]))
		namechangeprice = floatround(namechangeprice / 2, floatround_ceil);

	format(str, sizeof(str), "You don't have enough money ($%d) for that.", namechangeprice);

	if(GetMoney(playerid) < namechangeprice)
		return SendClientMessage(playerid, COLOR_GREY, str);

	new confirm[9];
	if(sscanf(params, "s[24] s[9]", name, confirm))
	{
		SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /namechange [firstname_lastname] [confirm]");
		format(str, sizeof(str), "Are you sure you want to change your name to %s for $%d?", name, namechangeprice);
		SendClientMessage(playerid, COLOR_GREY, str);
		return 1;
	}
	else
	{
		if(strcmp(confirm, "confirm", true) == 0)
		{
			if(!IsValidName(name) && PlayerInfo[playerid][pAdmin] < 1)
				return SendClientMessage(playerid, -1, "This new name isn't of valid format: \"Firstname_Lastname\"");
			format(str, sizeof(str), "Your name has to be no longer than %d characters.", MAX_PLAYER_NAME);
			if(strlen(name) > MAX_PLAYER_NAME) return SendClientMessage(playerid, COLOR_GREY, str);

			new query[128];
			mysql_format(sqlGameConnection, query, sizeof(query), "SELECT `Name` FROM `players` WHERE `Name` = '%e' LIMIT 1", name);
			mysql_pquery(sqlGameConnection, query, "OnNamechange", "is", playerid, name);
		}
		else
		{
			SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /namechange [firstname_lastname] [confirm]");
			format(str, sizeof(str), "Are you sure you want to change your name to %s for $%d?", name, namechangeprice);
			SendClientMessage(playerid, COLOR_GREY, str);
		}
	}
	return 1;
}

CMD:accent(playerid, params[])
{
	new newAccent[24];
	if(sscanf(params, "s[24]", newAccent)) {
		SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /accent [new accent]");
		SendClientMessage(playerid, COLOR_GRAD1, "Available accents:");
		SendClientMessage(playerid, COLOR_GRAD2, "None, British, Japanese, Chinese, Korean, Scottish, Irish");
		SendClientMessage(playerid, COLOR_GRAD2, "Mexican, Hick, Cuban, Italian, Gangsta, Australian, Arab");
		SendClientMessage(playerid, COLOR_GRAD2, "Canadian, Pikey, Russian, Dutch, German, Pakistani, French");
		SendClientMessage(playerid, COLOR_GRAD2, "Iranian, Norwegian, Chinese, Thai, Brooklyn, Argentinian, Bangladeshi");
		SendClientMessage(playerid, COLOR_GRAD2, "Spanish, Turkish, African, Valley, Sicilian, Albanian, Finnish, Indian, Greek");
		return 1;
	}

	if(!strlen(newAccent))
		return SendClientMessage(playerid, COLOR_GREY, "Enter a valid accent.");

	// Reset accent
	if(!strcmp(newAccent, "none", true))
	{
		Accent[playerid] = "none";
		SendClientMessage(playerid, COLOR_LIGHTBLUE, "* You will now speak with no accent, to change it, type /accent.");
		return 1;
	}

	// Check available accents
	if(
		strcmp(newAccent, "british", true) &&
		strcmp(newAccent, "japanese", true) &&
		strcmp(newAccent, "chinese", true) &&
		strcmp(newAccent, "korean", true) &&
		strcmp(newAccent, "scottish", true) &&
		strcmp(newAccent, "irish", true) &&
		strcmp(newAccent, "mexican", true) &&
		strcmp(newAccent, "hick", true) &&
		strcmp(newAccent, "cuban", true) &&
		strcmp(newAccent, "italian", true) &&
		strcmp(newAccent, "gangsta", true) &&
		strcmp(newAccent, "australian", true) &&
		strcmp(newAccent, "arab", true) &&
		strcmp(newAccent, "canadian", true) &&
		strcmp(newAccent, "pikey", true) &&
		strcmp(newAccent, "russian", true) &&
		strcmp(newAccent, "dutch", true) &&
		strcmp(newAccent, "french", true) &&
		strcmp(newAccent, "pakistani", true) &&
		strcmp(newAccent, "iranian", true) &&
		strcmp(newAccent, "norwegian", true) &&
		strcmp(newAccent, "chinese", true) &&
		strcmp(newAccent, "brooklyn", true) &&
		strcmp(newAccent, "argentinian", true) &&
		strcmp(newAccent, "thai", true) &&
		strcmp(newAccent, "spanish", true) &&
		strcmp(newAccent, "turkish", true) &&
		strcmp(newAccent, "african", true) &&
		strcmp(newAccent, "valley", true) &&
		strcmp(newAccent, "german", true) &&
		strcmp(newAccent, "sicilian", true) &&
		strcmp(newAccent, "albanian", true) &&
		strcmp(newAccent, "finnish", true) &&
		strcmp(newAccent, "indian", true) &&
		strcmp(newAccent, "bangladeshi", true) &&
		strcmp(newAccent, "greek", true)
	) return SendClientMessage(playerid, COLOR_GREY, "Enter a valid accent.");

	// Format the new accent
	for(new i = 0; i < strlen(newAccent); i++) {
		newAccent[i] = tolower(newAccent[i]);
	}
	newAccent[0] = toupper(newAccent[0]);

	Accent[playerid] = newAccent;

	// Send message
	new str[128];
	format(str, sizeof(str), "* You will now speak with a %s accent.", newAccent);
	SendClientMessage(playerid, COLOR_LIGHTBLUE, str);
	return 1;
}

CMD:fall(playerid, params[])
	return cmd_falling(playerid, params);

CMD:falling(playerid, params[]) {
	if(!IsFallingFromInterior(playerid))
		return SendClientMessage(playerid, COLOR_GREY, "You cannot use this right now.");

	if(IsPlayerRestricted(playerid) || PlayerFrozen[playerid] != 0)
		return SendClientMessage(playerid, COLOR_GREY, "You cannot use this right now.");

	if(GetPlayerInterior(playerid) == 0)
		return SendClientMessage(playerid, COLOR_GREY, "You cannot use this right now.");

	// Teleport the player to PD
	SetPlayerPos(playerid, 1538.1589, -1674.6854, 13.5469);
	SetPlayerVirtualWorld(playerid, 0);
	SetPlayerInterior(playerid, 0);

	// Send message
	new str[128];
	format(str, sizeof(str), "You were falling for %i seconds.", fallingSeconds[playerid]);
	SendClientMessage(playerid, COLOR_LIGHTBLUE, str);
	SendClientMessage(playerid, COLOR_LIGHTBLUE, "You were automatically teleported to safety. (/fall(ing))");

	// Send admin warning
	format(str, sizeof(str), "{FF0000}AdmWarning{FFFFFF}: %s was falling for %i seconds and used /fall(ing). They were teleported to PD.", PlayerName(playerid), fallingSeconds[playerid]);
	ABroadCast(COLOR_WHITE, str, 1);
	return 1;
}


/* CMD:report(playerid, params[])
{
	new now = gettime();
	new str[128];
	if(isnull(params)) return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /report [text]");
	if(now < (Reported[playerid] + 20))
	{
		format(str, sizeof(str), "You have to wait %d seconds before you can use /report again!", (Reported[playerid] + 20) - now);
		SendClientMessage(playerid, COLOR_GREY, str);
	}
	else if(PlayerInfo[playerid][pRepMuted] > 0)
	{
		if(PlayerInfo[playerid][pRepMuted] > 60) {
			format(str, sizeof(str), "You are muted from using /report for %d minutes.", PlayerInfo[playerid][pRepMuted]/60);
			SendClientMessage(playerid, COLOR_GREY, str);
		}
		else if(PlayerInfo[playerid][pRepMuted] < 60) {
			format(str, sizeof(str), "You are muted from using /report for %d seconds.", PlayerInfo[playerid][pRepMuted]);
			SendClientMessage(playerid, COLOR_GREY, str);
		}
	}
	else
	{
		//Reported[playerid] = true;
		//format(reportText[playerid], 80, "%s", result);
		format(str, sizeof(str), "Report from [%d]%s: %s", playerid, PlayerName(playerid), params);
		ABroadCast(COLOR_LIGHTYELLOW, str, 1);
		#if UseDiscordBot 1
			Discord:sendPlayerRequest(DISCORD_ADMINCHAT_CHANNEL, playerid, "Report by", params, 0xFFFF91);
		#endif
		SendClientMessage(playerid, COLOR_YELLOW, "Your report message was sent to online administrators, thank you.");
		Reported[playerid] = gettime();
		areported[playerid] = true;
	}
	return 1;
} */


CMD:pdcalls(playerid, params[])
{
	if(!(PlayerInfo[playerid][pMember] == 1 || PlayerInfo[playerid][pLeader] == 1)) return SendClientMessage(playerid, COLOR_GRAD2, "You are not a LEO.");
	SendClientMessage(playerid, COLOR_WHITE, "Police 911 calls:");
	new EMSstring[128], location[MAX_ZONE_NAME];
	foreach( new i: Player )
	{
		if(PlayerCalledPD[i] == 1)
		{
			GetPlayer2DZone(i, location, MAX_ZONE_NAME);
			format(EMSstring, sizeof(EMSstring), "ID: %i - %s : %s", i, PlayerOOCName(i), location);
			SendClientMessage(playerid, COLOR_GRAD1, EMSstring);
		}
	}
	return 1;
}

CMD:emscalls(playerid, params[]) //checking injured players
{
	if(!IsAMedic(playerid)) return SendClientMessage(playerid, COLOR_GRAD2, "You are not a Paramedic.");
	SendClientMessage(playerid, COLOR_WHITE, "Emergency Mobile Service:");
	SendClientMessage(playerid, COLOR_LIGHTBLUE, "{00BFFF}Usage:{FFFFFF} /accept call (id), in order to accept one of the calls.");
	new EMSstring[128], paraholder[MAX_PLAYER_NAME], location[MAX_ZONE_NAME];
	foreach( new i: Player )
	{
		if(PlayerCalledEMS[i] == 1)
		{
			paraholder = "none";
			if(CallAccepted[i] == 1)
			{
				paraholder = PlayerICName(PlayerParamedic[i]);
			}
			GetPlayer2DZone(i, location, MAX_ZONE_NAME);
			format(EMSstring, sizeof(EMSstring), "ID: %i - %s : %s :: Paramedic: %s", i, PlayerICName(i), location, paraholder);
			SendClientMessage(playerid, COLOR_GRAD1, EMSstring);
		}
	}
	return 1;
}

CMD:gml(playerid, params[]) {
	if(!IsAMedic(playerid))
		return SendClientMessage(playerid, COLOR_GREY, "You are not a member of the SAFMD.");

	if(PlayerInfo[playerid][pRank] != 5 && PlayerInfo[playerid][pRank] != 6)
		return SendClientMessage(playerid, COLOR_GREY, "You are not the (District) Chief.");

	new toPlayer;
	if(sscanf(params, "u", toPlayer))
		return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /gml [playerid/PartOfName]");

	if(!IsPlayerConnected(toPlayer))
		return SendClientMessage(playerid, COLOR_GREY, "Unknown player.");

	if(toPlayer == playerid)
		return SendClientMessage(playerid, COLOR_GREY, "You cannot issue a marijuana license to yourself.");

	if(	GetDistanceBetweenPlayers(playerid, toPlayer) > 3 ||
		PlayerInfo[toPlayer][pMask] ||
		GetPlayerState(toPlayer) == PLAYER_STATE_SPECTATING
	) return SendClientMessage(playerid, COLOR_GREY, "You are not near this person.");

	new mariStr[128];
	if(PlayerInfo[toPlayer][pMarijuanaLicense]) {
		PlayerInfo[toPlayer][pMarijuanaLicense] = 0;
		format(mariStr, sizeof(mariStr), "Dispatch: %s %s has revoked %s's marijuana license.", GetPlayerRank(playerid), PlayerICName(playerid), PlayerICName(toPlayer));
		SendClientMessage(toPlayer, COLOR_LIGHTBLUE, "* Your marijuana license has been revoked.");
	}
	else {
		PlayerInfo[toPlayer][pMarijuanaLicense] = 1;
		format(mariStr, sizeof(mariStr), "Dispatch: %s %s has issued a marijuana license to %s.", GetPlayerRank(playerid), PlayerICName(playerid), PlayerICName(toPlayer));
		SendClientMessage(toPlayer, COLOR_LIGHTBLUE, "* You have received your marijuana license.");
	}

	SendParaMessage(COLOR_DOCTOR, mariStr);
	return 1;
}

CMD:getrrk(playerid, params[])
{
	if(FMD_RRK_DISABLED)
		return SendClientMessage(playerid, COLOR_GREY, "The RRK system is disabled.");
	new str[128];
	if(IsAMedic(playerid))
	{
		if(IsPlayerInAnyVehicle(playerid))
		{
			new inscar = GetPlayerVehicleID(playerid), inseat;

			if(sVehicleInfo[GetDynamicVehicleID(inscar)][v_faction] != 4)
				return SendClientMessage(playerid, COLOR_GREY, "You can not get an RRK from this vehicle!");

			if(GetVehicleModel(inscar) == 416 || GetVehicleModel(inscar) == 563 || GetVehicleModel(inscar) == 489 || GetVehicleModel(inscar) == 490 || sVehicleInfo[GetDynamicVehicleID(inscar)][v_faction] == 4 && GetVehicleModel(inscar) == 560)
			{
				inseat = GetPlayerVehicleSeat(playerid);
				if(inseat != 0) // 0 = Driver //
				{
					if(HasARapidResKit[playerid] == 1)
					{
						SendClientMessage(playerid, COLOR_GREY, "You already have a Rapid Response Kit, '/pickrrk' in order to pick it up.");
						return 1;
					}
					RemovePlayerFromVehicle(playerid);
					SetTimerEx("Timer_GetResponseKit", 1500, false, "i", playerid);
					format(str, sizeof(str), "* You have succesfully dragged the Rapid Response Kit from the ambulance/helicopter.");
					SendClientMessage(playerid, COLOR_LIGHTBLUE, str);
					format(str, sizeof(str), "* Paramedic %s drags the Rapid Response Kit from the back of the ambulance/helicopter.", PlayerICName(playerid));
					ProxDetector(30.0, playerid, str, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
				}
				else return SendClientMessage(playerid, COLOR_GREY, "You must be in the rear of the vehicle to use this!");
			}
			else return SendClientMessage(playerid, COLOR_GREY, "You can not get an RRK from this vehicle!");
		}
		else
		{
			SendClientMessage(playerid, COLOR_GREY, "You are not inside a vehicle.");
		}
	}
	else
	{
		SendClientMessage(playerid, COLOR_GREY, "You are not a Paramedic.");
	}
	return 1;
}

CMD:droprrk(playerid, params)
{
	if(FMD_RRK_DISABLED)
		return SendClientMessage(playerid, COLOR_GREY, "The RRK system is disabled.");

	if(IsAMedic(playerid))
	{
		if(HasARapidResKit[playerid] == 1)
		{
			if(RapidResKitActive[playerid] == 1)
			{
				new Float:x, Float:y, Float:z, Float:pAngle;
				GetXYInFrontOfPlayer(playerid, x, y, z, pAngle, 1.0);
				if(RapidResKit[playerid]) { DestroyObject(RapidResKit[playerid]); }
				RapidResKit[playerid] = CreateDynamicObject(1789, x, y, (z -0.5), 0, 0, pAngle -90);
				RapidResKitActive[playerid] = 0;
			}
			else
			{
				SendClientMessage(playerid, COLOR_GREY, "You are not using a Rapid Response Kit.");
			}
		}
		else
		{
			SendClientMessage(playerid, COLOR_GREY, "You do not have a Rapid Response Kit.");
		}
	}
	else
	{
		SendClientMessage(playerid, COLOR_GREY, "You are not a Paramedic.");
	}
	return 1;
}

CMD:pickrrk(playerid, params)
{
	if(FMD_RRK_DISABLED)
		return SendClientMessage(playerid, COLOR_GREY, "The RRK system is disabled.");

	if(IsAMedic(playerid))
	{
		if(RapidResKitActive[playerid] == 1)
		{
			SendClientMessage(playerid, COLOR_GREY, "You can only use one Rapid Response Kit at a time.");
			return 1;
		}
		new Float:x, Float:y, Float:z;
		GetDynamicObjectPos(RapidResKit[playerid], x, y, z);
		if(IsPlayerInRangeOfPoint(playerid, 2.0, x, y, z))
		{
			if(RapidResKit[playerid]) { DestroyDynamicObjectEx(RapidResKit[playerid]); }
			GetPlayerPos(playerid, x, y, z);
			RapidResKit[playerid] = CreateObject(1789, x, y, z, 0, 0, 0);
			AttachObjectToPlayer(RapidResKit[playerid], playerid, 0.00, 1, -0.5, 0, 0, -90);
			RapidResKitActive[playerid] = 1;
			HasARapidResKit[playerid] = 1;
			new str[128];
			format(str, sizeof(str), "* You have succesfully picked up the Rapid Response Kit.");
			SendClientMessage(playerid, COLOR_LIGHTBLUE, str);
		}
		else
		{
			SendClientMessage(playerid, COLOR_GREY, "No rapid response kits in range.");
		}
	}
	else
	{
		SendClientMessage(playerid, COLOR_GREY, "You are not a Paramedic.");
	}
	return 1;
}

CMD:placerrk(playerid, params[])
{
	if(FMD_RRK_DISABLED)
		return SendClientMessage(playerid, COLOR_GREY, "The RRK system is disabled.");

	if(IsAMedic(playerid))
	{
		new Float:x, Float:y, Float:z, bool:found =false, rrkholder;
		//for(new i=0;i<MAX_PLAYERS;i++)
		foreach( new i: Player )
		{
			if(PlayerInfo[i][pMember] == 4 || PlayerInfo[i][pLeader] == 4)
			{
				if(HasARapidResKit[i] == 1)
				{
					if(RapidResKitActive[i] == 0)
					{
						GetDynamicObjectPos(RapidResKit[i], x, y, z);
						if(IsPlayerInRangeOfPoint(playerid, 2.0, x, y, z))
						{
							rrkholder = i;
							found = true;
							break;
						}
					}
				}
			}
		}
		if(found)
		{
			if(RapidResKit[rrkholder]) { DestroyDynamicObjectEx(RapidResKit[rrkholder]); }
			RapidResKit[rrkholder] = 0;
			HasARapidResKit[rrkholder] = 0;
			new str[128];
			format(str, sizeof(str), "* You have succesfully placed the Rapid Response Kit in the ambulance/helicopter.");
			SendClientMessage(playerid, COLOR_LIGHTBLUE, str);
			format(str, sizeof(str), "* Paramedic %s places the the Rapid Response Kit back into the ambulance/helicopter.", PlayerICName(playerid));
			ProxDetector(30.0, playerid, str, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
		}
		if(!found)
		{
			SendClientMessage(playerid, COLOR_GREY, "No Rapid Response Kits in range.");
		}
	}
	else
	{
		SendClientMessage(playerid, COLOR_GREY, "You are not a Paramedic.");
	}
	return 1;
}

CMD:usetemprrk(playerid, params[])
{
	if(FMD_RRK_DISABLED)
		return SendClientMessage(playerid, COLOR_GREY, "The RRK system is disabled.");

	if(IsAMedic(playerid))
	{
		if(hasTempRRK[playerid] == 1)
		{
			new giveplayerid;
			if(!sscanf(params, "u", giveplayerid))
			{
				if(playerid == giveplayerid) return SendClientMessage(playerid, COLOR_GREY, "Cannot use the response kit on yourself.");
				if(!IsPlayerInRangeOfPlayer(5.0, playerid, giveplayerid)) return SendClientMessage(playerid, COLOR_WHITE, "That player is not near you!");
				if(IsPlayerConnected(giveplayerid))
				{
					if(giveplayerid != INVALID_PLAYER_ID)
					{
						if(giveplayerid == PlayerVictim[playerid])
						{
							new str[128];
							ParaOnACall[playerid] = 0;
							CallAccepted[giveplayerid] = 0;
							format(str, sizeof(str), "Dispatch: Paramedic %s has succesfully completed the call of %s.", PlayerICName(playerid), PlayerICName(giveplayerid));
							SendParaMessage(COLOR_DOCTOR, str);
							SetPlayerHealth(giveplayerid, 100);
							SetPlayerArmour(giveplayerid, 0);
							PlayerCalledEMS[giveplayerid] = 0;
							TextDrawHideForPlayer(giveplayerid, Text:DieText);
							TextDrawHideForPlayer(giveplayerid, Text:InjuredText);
							pDeathState[giveplayerid] = PLAYER_STATE_NORMAL;
							ApplyAnimationEx(giveplayerid, "PED", "getup_front", 4.0, 0, 1, 1, 0, 0, 1);
							hasTempRRK[playerid] = 0;
							SendClientMessage(playerid, COLOR_LIGHTBLUE, "You have used your temporary rapid response kit.");
							PlayerPlaySound(giveplayerid, 1052, 0.0, 0.0, 0.0);
							format(str, sizeof(str), "* Paramedic %s uses their Rapid Response Kit on %s.", PlayerICName(playerid), PlayerICName(giveplayerid));
							ProxDetector(30.0, playerid, str, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
						}
						else return SendClientMessage(playerid, COLOR_GREY, "This is not your patient.");
					}
				}
				else return SendClientMessage(playerid, COLOR_GREY, "Player is not connected.");
			}
			else return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /userrk [playerid/PartOfName]");
		}
		else return SendClientMessage(playerid, COLOR_GREY, "You don't have a temporary Rapid Response Kit.");
	}
	else return SendClientMessage(playerid, COLOR_GREY, "You are not a paramedic.");
	return 1;
}

CMD:sellvest(playerid, params[]) {
	if(PlayerInfo[playerid][pJob] != 8)
		return SendClientMessage(playerid, COLOR_GREY, "You are not a bodyguard.");

	new targetid, price;
	if(sscanf(params, "ui", targetid, price))
		return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /sellvest [playerid/PartOfName] [price]");

	if(!IsPlayerConnected(targetid))
		return SendClientMessage(playerid, COLOR_GREY, "Unknown player.");

	if(IsNearBank(playerid) && bankactive)
		return SendClientMessage(playerid, COLOR_GREY, "You can not use this inside/outside the bank during an active bank robbery.");

	if(price < 5000 || price > 20000)
		return SendClientMessage(playerid, COLOR_GREY, "Price can't be lower than $5,000 or above $20,000.");

	if(!IsPlayerInRangeOfPlayer(8.0, playerid, targetid))
		return SendClientMessage(playerid, COLOR_GREY, "You are not near this player.");

	if(targetid == playerid)
		return SendClientMessage(playerid, COLOR_GREY, "You can't offer a vest to yourself.");

	new str[128];
	format(str, sizeof(str), "* You offered a kevlar vest to %s for $%i.", PlayerICName(targetid), price);
	SendClientMessage(playerid, COLOR_LIGHTBLUE, str);

	format(str, sizeof(str), "* Bodyguard %s wants to sell you a kevlar vest for $%i, (type /accept vest) to accept.", PlayerICName(playerid), price);
	SendClientMessage(targetid, COLOR_LIGHTBLUE, str);

	VestOffer[targetid] = playerid;
	VestPrice[targetid] = price;
	return 1;
}

CMD:heal(playerid, params[]) {
	if(!IsAMedic(playerid))
		return SendClientMessage(playerid, COLOR_GREY, "You are not a paramedic.");

	new targetid, price;
	if(sscanf(params, "ui", targetid, price))
		return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /heal [playerid/PartOfName] [price]");

	if(!IsPlayerConnected(targetid))
		return SendClientMessage(playerid, COLOR_GREY, "Unknown player.");

	if(IsNearBank(playerid) && bankactive)
		return SendClientMessage(playerid, COLOR_GREY, "You can not use this inside/outside the bank during an active bank robbery.");

	if(price < 500 || price > 10000)
		return SendClientMessage(playerid, COLOR_GREY, "Price can't be lower than $500 or above $10,000.");

	if(!IsPlayerInRangeOfPlayer(8.0, playerid, targetid))
		return SendClientMessage(playerid, COLOR_GREY, "You are not near this player.");

	if(targetid == playerid)
		return SendClientMessage(playerid, COLOR_GREY, "You can't offer to heal yourself.");

	foreach(new i:Player)
	{
		if(healOffer[i] == playerid)
		{
			healOffer[i] = 999;
			healPrice[i] = 0;
		}
	}
	new str[128];
	format(str, sizeof(str), "* You offered to heal %s for $%i.", PlayerICName(targetid), price);
	SendClientMessage(playerid, COLOR_LIGHTBLUE, str);

	format(str, sizeof(str), "* Paramedic %s wants to heal you for $%i, (type /accept heal) to accept.", PlayerICName(playerid), price);
	SendClientMessage(targetid, COLOR_LIGHTBLUE, str);

	healOffer[targetid] = playerid;
	healPrice[targetid] = price;
	return 1;
}

CMD:userrk(playerid, params[])
{
	if(FMD_RRK_DISABLED)
		return SendClientMessage(playerid, COLOR_GREY, "The RRK system is disabled.");

	if(IsAMedic(playerid))
	{
		if(HasARapidResKit[playerid] == 1)
		{
			if(RapidResKitActive[playerid] == 0)
			{
				new Float:x, Float:y, Float:z, giveplayerid;
				GetDynamicObjectPos(RapidResKit[playerid], x, y, z);
				if(IsPlayerInRangeOfPoint(playerid, 2.0, x, y, z))
				{
					if(!sscanf(params, "u", giveplayerid))
					{
						if(playerid == giveplayerid) return SendClientMessage(playerid, COLOR_GREY, "Cannot use the response kit on yourself.");
						if(!IsPlayerInRangeOfPlayer(5.0, playerid, giveplayerid)) return SendClientMessage(playerid, COLOR_WHITE, "That player is not near you!");
						if(IsPlayerConnected(giveplayerid))
						{
							if(giveplayerid != INVALID_PLAYER_ID)
							{
								if(giveplayerid == PlayerVictim[playerid])
								{
									new str[128];
									ParaOnACall[playerid] = 0;
									CallAccepted[giveplayerid] = 0;
									format(str, sizeof(str), "Dispatch: Paramedic %s has succesfully completed the call of %s.", PlayerICName(playerid), PlayerICName(giveplayerid));
									SendParaMessage(COLOR_DOCTOR, str);
									ClearAnimationsEx(giveplayerid);
									SetPlayerHealth(giveplayerid, 100);
									SetPlayerArmour(giveplayerid, 0);
									TextDrawHideForPlayer(giveplayerid, Text:DieText);
									TextDrawHideForPlayer(giveplayerid, Text:InjuredText);
									pDeathState[giveplayerid] = PLAYER_STATE_NORMAL;
									PlayerInfo[playerid][pCallCount] += 1;
									PlayerInfo[playerid][pMonthlyCallCount]++;
									PlayerCalledEMS[giveplayerid] = 0;
									PlayerPlaySound(giveplayerid, 1052, 0.0, 0.0, 0.0);
									pInHospital[giveplayerid] = 0;
									format(str, sizeof(str), "* Paramedic %s uses their Rapid Response Kit on %s.", PlayerICName(playerid), PlayerICName(giveplayerid));
									ProxDetector(30.0, playerid, str, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);


									if(PlayerInfo[giveplayerid][pCash] < 1500)
									{
										if(PlayerInfo[giveplayerid][pAccount] < 1500) return 1; // if he doesnt have any money at all, exit the command, we dont want to generate money
										else
										{
											GiveMoney(playerid, 1500);
											PlayerInfo[giveplayerid][pAccount] -= 1500;
											SendClientMessage(playerid, COLOR_DOCTOR, "You have received $1500 for reviving.");
											SendClientMessage(giveplayerid, COLOR_DOCTOR, "You have been charged $1500 for your treatment from your bank account.");
										}
									}
									else
									{
										GiveMoney(giveplayerid, -1500);
										GiveMoney(playerid, 1500);

										SendClientMessage(playerid, COLOR_DOCTOR, "You have received $1500 for reviving.");
										SendClientMessage(giveplayerid, COLOR_DOCTOR, "You have been charged $1500 for your treatment.");
									}
								}
								else
								{
									SendClientMessage(playerid, COLOR_GREY, "This is not your patient.");
								}
							}
						}
						else
						{
							SendClientMessage(playerid, COLOR_GREY, "Player is not connected.");
						}
					}
					else
					{
						SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /userrk [playerid/PartOfName]");
					}
				}
				else
				{
					SendClientMessage(playerid, COLOR_GREY, "Your Rapid Response Kit must be placed nearby.");
				}
			}
			else
			{
				SendClientMessage(playerid, COLOR_GREY, "You are still dragging the Rapid Response Kit, '/droprrk' first.");
			}
		}
		else
		{
			SendClientMessage(playerid, COLOR_GREY, "You do not have a Rapid Response Kit.");
		}
	}
	else
	{
		SendClientMessage(playerid, COLOR_GREY, "You are not a Paramedic.");
	}
	return 1;
}

CMD:transferpatient(playerid, params[])
{
	if(!FMD_RRK_DISABLED)
		return SendClientMessage(playerid, COLOR_GREY, "Use the RRK system instead.");

	if(!IsAMedic(playerid))
		return SendClientMessage(playerid, COLOR_GREY, "You are not a paramedic.");

	new targetid, hosproom;
	if(sscanf(params, "ui", targetid, hosproom))
		return SendClientMessage(playerid, -1, "{00BFFF}Usage:{FFFFFF} /transferpatient [playerid/PartOfName] [room 1-5]");

	if(!IsPlayerConnected(targetid))
		return SendClientMessage(playerid, COLOR_GREY, "That player is not connected.");

	if(targetid == playerid)
		return SendClientMessage(playerid, COLOR_GREY, "You can not do this on yourself.");

	if(gLastCar[targetid] != gLastCar[playerid])
		return SendClientMessage(playerid, COLOR_GREY, "That player is not in your vehicle.");

	if(pDeathState[targetid] == PLAYER_STATE_NORMAL)
		return SendClientMessage(playerid, COLOR_GREY, "That player is not injured.");

	if(hosproom < 1 || hosproom > 5)
		return SendClientMessage(playerid, COLOR_GREY, "The room must be between 1 and 5.");

	if(countygenrooms[hosproom] == 1 || allsaintsrooms[hosproom] == 1)
		return SendClientMessage(playerid, COLOR_GREY, "That room is already in use.");

	if(IsPlayerInRangeOfPoint(playerid, 20.0, 1185.8871, -1323.7729, 13.5591)) // All Saints
	{
		allsaintsrooms[hosproom] = 1;
		istreatedinallsaints[targetid] = 1;
		SetPlayerInterior(targetid, 2);
		SetPlayerVirtualWorld(targetid, 2);
		switch(hosproom)
		{
			case 1: SetPlayerPos(targetid, 1169.2732, -1305.9762, 1090.6359);
			case 2: SetPlayerPos(targetid, 1184.0972, -1298.5614, 1090.6359);
			case 3: SetPlayerPos(targetid, 1167.7710, -1290.4994, 1090.2269);
			case 4: SetPlayerPos(targetid, 1186.6525, -1288.7365, 1090.3180);
			case 5: SetPlayerPos(targetid, 1168.7271, -1277.8820, 1090.2269);
		}
	}
	else if(IsPlayerInRangeOfPoint(playerid, 20.0, 2024.6085, -1423.7742, 16.9665)) // County General
	{
		countygenrooms[hosproom] = 1;
		istreatedinallsaints[targetid] = 0;
		SetPlayerInterior(targetid, 1);
		SetPlayerVirtualWorld(targetid, 1);
		switch(hosproom)
		{
			case 1: SetPlayerPos(targetid, -211.0638, -1738.8898, 676.7153);
			case 2: SetPlayerPos(targetid, -211.0641, -1751.6697, 676.7153);
			case 3: SetPlayerPos(targetid, -211.0648, -1759.5143, 676.7153);
			case 4: SetPlayerPos(targetid, -196.6427, -1759.4406, 676.4661);
			case 5: SetPlayerPos(targetid, -196.6368, -1763.9891, 676.4661);
		}
	}
	else return SendClientMessage(playerid, COLOR_GREY, "You are not near any hospital.");

	// Accepted call
	ParaOnACall[playerid] = 0;
	CallAccepted[targetid] = 0;
	new str[128];
	format(str, sizeof(str), "Dispatch: Paramedic %s has succesfully transferred %s to the hospital.", PlayerICName(playerid), PlayerICName(targetid));
	SendParaMessage(COLOR_DOCTOR, str);

	LoopingAnim(targetid, "CRACK", "crckdeth2", 4.0, 1, 0, 0, 0, 0);
	treatedinroom[targetid] = hosproom;
	PlayerCalledEMS[targetid] = 0;
	pDeathState[targetid] = PLAYER_STATE_NORMAL;
	beingtreatedtime[targetid] = 120;
	SendClientMessage(playerid, COLOR_LIGHTBLUE, "Your patient has been transferred to the requested room, you should now treat them.");
	SendClientMessage(targetid, COLOR_LIGHTBLUE, "You have been transferred to a room, your paramedic will come to treat you shortly.");
	return 1;
}

CMD:releasepatient(playerid, params[])
{
	if(!FMD_RRK_DISABLED)
		return SendClientMessage(playerid, COLOR_GREY, "Use the RRK system instead.");

	if(!IsAMedic(playerid))
		return SendClientMessage(playerid, COLOR_GREY, "You are not a paramedic.");

	new targetid;
	if(sscanf(params, "u", targetid))
		return SendClientMessage(playerid, -1, "{00BFFF}Usage:{FFFFFF} /releasepatient [playerid/PartOfName]");

	if(!IsPlayerConnected(targetid))
		return SendClientMessage(playerid, COLOR_GREY, "That player is not connected.");

	if(GetDistanceBetweenPlayers(playerid, targetid) > 4)
		return SendClientMessage(playerid, COLOR_GREY, "You must be near the patient.");

	if(beingtreatedtime[targetid] == 0)
		return SendClientMessage(playerid, COLOR_GREY, "That player is not being treated.");

	if(targetid == playerid)
		return SendClientMessage(playerid, COLOR_GREY, "You can not release yourself from treatment.");

	beingtreatedtime[targetid] = 0;
	pDeathState[targetid] = PLAYER_STATE_NORMAL;
	TogglePlayerControllable(targetid, true);
	SetCameraBehindPlayer(targetid);
	displayCenterHUDInfo(targetid,  "~r~Treated", 8);
	new str[128];
	format(str, sizeof(str), "Paramedic %s has released you from your medical treatment, you have been billed $5000 for it.", PlayerICName(playerid));
	SendClientMessage(targetid, COLOR_LIGHTBLUE, str);

	format(str, sizeof(str), "Paramedic %s has released %s from their medical treatment.", PlayerICName(playerid), PlayerICName(targetid));
	SendParaMessage(COLOR_DOCTOR, str);

	GiveMoney(targetid, -5000);
	FMD += 5000;

	if(istreatedinallsaints[targetid] == 1)
	{
		allsaintsrooms[treatedinroom[targetid]] = 0; // all saints
	}
	if(istreatedinallsaints[targetid] == 0)
	{
		countygenrooms[treatedinroom[targetid]] = 0; // county gen
	}
	treatedinroom[targetid] = 0;
	return 1;
}

CMD:checkpatient(playerid, params[])
{
	if(!FMD_RRK_DISABLED)
		return SendClientMessage(playerid, COLOR_GREY, "Use the RRK system instead.");

	if(!IsAMedic(playerid))
		return SendClientMessage(playerid, COLOR_GREY, "You are not a paramedic.");

	new targetid;
	if(sscanf(params, "u", targetid))
		return SendClientMessage(playerid, -1, "{00BFFF}Usage:{FFFFFF} /checkpatient [playerid/PartOfName]");

	if(!IsPlayerConnected(targetid))
		return SendClientMessage(playerid, COLOR_GREY, "That player is not connected.");

	if(GetDistanceBetweenPlayers(playerid, targetid) > 4)
		return SendClientMessage(playerid, COLOR_GREY, "You must be near the patient.");

	if(beingtreatedtime[targetid] == 0)
		return SendClientMessage(playerid, COLOR_GREY, "That player is not being treated.");
	new str[128];

	format(str, sizeof(str), "* %s leans over as they check %s's pulse.", PlayerICName(playerid), PlayerICName(targetid));
	SetPlayerChatBubble(playerid, str, COLOR_PURPLE, 20.0, 15000);

	new heartRate = beingtreatedtime[targetid];

	if(heartRate > 120) format(str, sizeof(str), "too high");
	else if(heartRate > 100) format(str, sizeof(str), "high");
	else if(heartRate > 60) format(str, sizeof(str), "stable");
	else if(heartRate > 30) format(str, sizeof(str), "low");
	else format(str, sizeof(str), "too low");

	format(str, sizeof(str), "%s's heart rate seems to be %s.", PlayerICName(targetid), str);
	SendClientMessage(playerid, COLOR_DOCTOR, str);
	return 1;
}

CMD:morphine(playerid, params[])
{
	if(!FMD_RRK_DISABLED)
		return SendClientMessage(playerid, COLOR_GREY, "Use the RRK system instead.");

	if(!IsAMedic(playerid))
		return SendClientMessage(playerid, COLOR_GREY, "You are not a paramedic.");

	new targetid;
	if(sscanf(params, "u", targetid))
		return SendClientMessage(playerid, -1, "{00BFFF}Usage:{FFFFFF} /morphine [playerid/PartOfName]");

	if(!IsPlayerConnected(targetid))
		return SendClientMessage(playerid, COLOR_GREY, "That player is not connected.");

	if(GetDistanceBetweenPlayers(playerid, targetid) > 4)
		return SendClientMessage(playerid, COLOR_GREY, "You must be near the patient.");

	if(beingtreatedtime[targetid] == 0)
		return SendClientMessage(playerid, COLOR_GREY, "That player is not being treated.");
	new str[128];
	format(str, sizeof(str), "* %s injects some morphine into %s's bloodstream.", PlayerICName(playerid), PlayerICName(targetid));
	ProxDetector(30.0, playerid, str, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);

	beingtreatedtime[targetid] += 30;
	return 1;
}

//=======================================
CMD:contract(playerid, params[])
{
	if(PlayerInfo[playerid][pLevel] >= 3)
	{
		new moneys, targetid;
		new str[128];
		if(sscanf(params, "ui", targetid, moneys)) return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /contract [playerid/PartOfName] [amount]");
		{
			if(PlayerInfo[playerid][pGroup] == GROUP_HITMAN) return SendClientMessage(playerid, COLOR_GREY, "Hitmen cannot place contracts on people.");
			if(IsPlayerConnected(targetid))
			{
				if(targetid == playerid) return SendClientMessage(playerid, COLOR_GREY, "You cannot contract yourself.");
				if(PlayerInfo[targetid][pLevel] < 3) return SendClientMessage(playerid, COLOR_GRAD1, "That player is below level 3.");
				if(moneys < 10000) return SendClientMessage(playerid, COLOR_GREY, "Contract money must be at least $10,000.");
				if(moneys + PlayerInfo[targetid][pHeadValue] > 3000000) return SendClientMessage(playerid, COLOR_GREY, "That player has the maximum amount on their head.");
				if(IsACop(targetid) && moneys < 50000 && !IsS9InFaction(playerid)) return SendClientMessage(playerid, COLOR_GREY, "Contract price must be at least $50,000 for Cops.");
				if(IsPlayerRestricted(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You can't do that at this time.");

				new playermoney = PlayerInfo[playerid][pCash];
				if(moneys > 0 && playermoney >= moneys)
				{
					format(str, sizeof(str), "%s", PlayerICName(playerid));
					strmid(PlayerInfo[targetid][pContractBy], str, 0, strlen(str), 255);
					GiveMoney(playerid, -moneys);

					PlayerInfo[targetid][pHeadValue] += moneys;

					format(str, sizeof(str), "%s has placed a contract on %s, for $%d.", PlayerICName(playerid), PlayerICName(targetid), moneys);
					foreach( new i: Player )
					{
						if(PlayerInfo[i][pGroup] == GROUP_HITMAN)
						{
							SendClientMessage(i, COLOR_YELLOW, str);
						}
					}
					format(str, sizeof(str), "{FF0000}AdmWarning{FFFFFF}: %s has placed a contract on %s, for $%d.", PlayerOOCName(playerid), PlayerOOCName(targetid), moneys);
					printf("%s has placed a contract on %s, for $%d.", PlayerOOCName(playerid), PlayerOOCName(targetid), moneys);

					ABroadCast(COLOR_WHITE, str, 4);

					format(str, sizeof(str), "* You placed a contract on %s, for $%d.", PlayerICName(targetid), moneys);
					SendClientMessage(playerid, COLOR_LIGHTBLUE, str);
					PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
					new year, month, day;
					getdate(year, month, day);

					new hour, minute, second;
					gettime(hour, minute, second);
					hour = FixHour(hour);
					format(str, sizeof(str), "%s has placed a contract on %s, for $%d at %02d %s %02d:%02d:%02d", PlayerOOCName(playerid), PlayerOOCName(targetid), moneys, day, GetMonthFromInt(month), hour, minute, second);
					logswrite("contracts.log", str);
				}
				else return SendClientMessage(playerid, COLOR_GRAD1, "Invalid transaction amount.");
			}
			else return SendClientMessage(playerid, COLOR_GRAD1, "That player is not connected.");
		}
	}
	else return SendClientMessage(playerid, COLOR_GRAD1, "You must be at least level 3 to place a contract.");
	return 1;
}

CMD:contracts(playerid, params[])
{
	if(PlayerInfo[playerid][pGroup] != GROUP_HITMAN) return 1;
	SearchingHits(playerid);
	return 1;
}

CMD:resetcallcount(playerid, params[])
{
	if(!(PlayerInfo[playerid][pMember] == 4 && PlayerInfo[playerid][pLeader] == 4)) return AdmErrorMsg;
	new query[128];
	mysql_format(sqlGameConnection, query, sizeof(query), "UPDATE `players` SET `MedicCount` = 0");
	mysql_pquery(sqlGameConnection, query);
	foreach(new i: Player)
	{
		PlayerInfo[i][pCallCount] = 0;
		PlayerInfo[i][pMonthlyCallCount] = 0;
	}
	new msg[128];
	format(msg, sizeof(msg), "{FF0000}AdmWarning{FFFFFF}: %s has reset the Medic Call counter.", PlayerName(playerid));
	SendAdminMessage(COLOR_WHITE, msg);
	SendParaMessage(COLOR_WHITE, msg);
	return 1;
}

CMD:ranks(playerid, params[])
{
	if(PlayerInfo[playerid][pGroup] == GROUP_HITMAN)
	{
		SendClientMessage(playerid, COLOR_WHITE, "Agency Ranks:");
		foreach( new i: Player )
		{
			if(PlayerInfo[i][pGroup] == GROUP_HITMAN)
			{
				new rank[60];
				switch(PlayerInfo[i][pGroupRank])
				{
					case 0:
						rank = "Initiate";
					case 1:
						rank = "Freelancer";
					case 2:
						rank = "Operative";
					case 3:
						rank = "Agent";
					case 4:
						rank = "Elite Agent";
					case 5:
						rank = "Vice Director";
					case 6:
						rank = "Director";
				}
				new hitname[MAX_PLAYER_NAME];
				if(GoChase[i] < 999) GetPlayerICName(GoChase[i], hitname, sizeof(hitname));
				else hitname = "Nobody";
				new str[128];
				format(str, sizeof(str), "Name: %s Rank: %s Completed Hits: %d Failed Hits: %d Chasing: %s", PlayerOOCName(i), rank, PlayerInfo[i][pCHits], PlayerInfo[i][pFHits], hitname);
				SendClientMessage(playerid, COLOR_GRAD3, str);
			}
		}
	}
	if(PlayerInfo[playerid][pMember] == 4 || FakeFaction[playerid] == 4)
	{
		SendClientMessage(playerid, COLOR_DOCTOR, "Medic Ranks:");
		new str[128];
		foreach( new i: Player )
		{
			if(PlayerInfo[i][pMember] == 4 || FakeFaction[i] == FACTION_FMD)
			{
				format(str, sizeof(str), "Name: %s | Rank: %s | Count: %i | Monthly Count: %i", PlayerOOCName(i), GetPlayerRank(i), PlayerInfo[i][pCallCount], PlayerInfo[i][pMonthlyCallCount]);
				SendClientMessage(playerid, COLOR_DOCTOR, str);
			}
		}
	}
	return 1;
}

CMD:oranks(playerid, params[])
{
	if(PlayerInfo[playerid][pMember] != FACTION_FMD) return AdmErrorMsg;

	mysql_pquery(sqlGameConnection, "SELECT Name, MedicCount, Rank FROM players WHERE Member=4", "MedicCountOffline", "d", playerid);
	return 1;
}

CMD:disguise(playerid, params[])
{
	if(	PlayerInfo[playerid][pGroup] != GROUP_HITMAN &&
		PlayerInfo[playerid][pGroup] != GROUP_CRIME &&
		PlayerInfo[playerid][pGroup] != GROUP_CARTEL &&
		PlayerInfo[playerid][pGroup] != GROUP_S9 &&
		PlayerInfo[playerid][pMember] != FACTION_FBI &&
		!isDonatedGroup(PlayerInfo[playerid][pGroup])
	) return 1;

	if(PlayerInfo[playerid][pGroup] == GROUP_LLS && PlayerInfo[playerid][pGroupRank] < 3)
		return SendClientMessage(playerid, COLOR_GREY, "You need to be atleast rank 3 to use this command.");

	new disguiseID;
	if(sscanf(params, "i", disguiseID)) {
		// Show skin selector with all available skins
		ShowSkinShop(playerid, true, true, true, false, true);

		// Show tip
		SendClientMessage(playerid, COLOR_LIGHTBLUE, "TIP: {FFFFFF}You can use /disguise [skin ID] to disguise without the selector.");
		return 1;
	}

	if(disguiseID < 1 || disguiseID > 311 || disguiseID == 74)
		return SendClientMessage(playerid, COLOR_GREY, "You entered an invalid skin ID.");

	// Only HA and S9 can disguise into restricted skins
	if(isRestrictedModel(disguiseID) && PlayerInfo[playerid][pGroup] != GROUP_HITMAN && PlayerInfo[playerid][pGroup] != GROUP_S9 && PlayerInfo[playerid][pMember] != FACTION_FBI)
		return SendClientMessage(playerid, COLOR_GREY, "You are not allowed to disguise into restricted skins.");

	// Set the skin
	PlayerInfo[playerid][pModel] = disguiseID;
	SetPlayerSkin(playerid, disguiseID);
	PlayerInfo[playerid][pClothes] = 0;

	// Action
	new str[128];
	format(str, sizeof(str), "* %s changes their clothes.", PlayerICName(playerid));
	SetPlayerChatBubble(playerid, str, COLOR_PURPLE, 7.0, 5000);

	format(str, sizeof(str), "> %s changes their clothes.", PlayerICName(playerid));
	SendClientMessage(playerid, COLOR_PURPLE, str);
	return 1;
}

CMD:callerid(playerid, params[])
{
	if(
		PlayerInfo[playerid][pGroup] == GROUP_HITMAN ||
		PlayerInfo[playerid][pGroup] == GROUP_CRIME ||
		PlayerInfo[playerid][pGroup] == GROUP_CARTEL ||
		PlayerInfo[playerid][pMember] == FACTION_FBI ||
		PlayerInfo[playerid][pGroup] == GROUP_S9 ||
		PlayerInfo[playerid][pGroup] == GROUP_OPG ||
		isDonatedGroup(PlayerInfo[playerid][pGroup])
	) {
		switch(callerID[playerid])
		{
			case false:
			{
				SendClientMessage(playerid, COLOR_YELLOW, "[Caller ID] You have toggled your caller ID off, meaning you will be hidden.");
				callerID[playerid] = true;
			}
			case true:
			{
				SendClientMessage(playerid, COLOR_YELLOW, "[Caller ID] You have toggled your caller ID on, meaning you will show to others.");
				callerID[playerid] = false;
			}
		}
	}
	return 1;
}

CMD:profile(playerid, params[])
{
	if(	PlayerInfo[playerid][pGroup] != GROUP_HITMAN &&
		PlayerInfo[playerid][pGroup] != GROUP_S9 &&
		PlayerInfo[playerid][pMember] != FACTION_FBI &&
		PlayerInfo[playerid][pMember] != FACTION_JD &&
		PlayerInfo[playerid][pGroup] != 7
	) return 1;

	new targetid;
	if(sscanf(params, "u", targetid)) return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /profile [playerid/PartOfName]");
	if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, COLOR_GREY, "{FF0000}Error:{FFFFFF} Invalid playerid.");

	ShowProfile(playerid, targetid);
	return 1;
}

CMD:givehit(playerid, params[])
{
	if(PlayerInfo[playerid][pGroup] != GROUP_HITMAN) return 1;
	if(PlayerInfo[playerid][pGroupRank] < 4) return SendClientMessage(playerid, COLOR_GREY, "{FF0000}Error:{FFFFFF} You must be at least rank 4 to give out contracts.");
	new targetid, id2;
	if(sscanf(params, "uu", targetid, id2)) return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /givehit [playerid/PartOfName] [targetid/PartOfName]");
	if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, COLOR_GREY, "{FF0000}Error:{FFFFFF} Invalid playerid.");
	if(!IsPlayerConnected(id2)) return SendClientMessage(playerid, COLOR_GREY, "{FF0000}Error:{FFFFFF} Invalid targetid.");
	if(PlayerInfo[targetid][pGroup] != GROUP_HITMAN && PlayerInfo[playerid][pGroupRank] < 5) return SendClientMessage(playerid, COLOR_GREY, "{FF0000}Error:{FFFFFF} You must be the leader to give hits to non-hitmen.");
	if(PlayerInfo[id2][pHeadValue] == 0 || IsS9InFaction(id2)) return SendClientMessage(playerid, COLOR_GREY, "{FF0000}Error:{FFFFFF} That player doesn't have a contract on their head.");
	new str[128];
	format(str, sizeof(str), "* You offered %s a contract to kill %s.", PlayerICName(targetid), PlayerICName(id2));
	SendClientMessage(playerid, COLOR_LIGHTBLUE, str);
	format(str, sizeof(str), "* Hitman %s has offered you a contract to kill %s (type /accept contract), to accept it.", PlayerICName(playerid), PlayerICName(id2));
	SendClientMessage(targetid, COLOR_LIGHTBLUE, str);
	ContractOffer[targetid] = playerid;
	ContractID[targetid] = id2;
	return 1;
}

CMD:denyhit(playerid, params[])
{
	if(PlayerInfo[playerid][pGroup] != GROUP_HITMAN) return 1;
	if(PlayerInfo[playerid][pGroupRank] < GROUP_HITMAN_RANKS) return SendClientMessage(playerid, COLOR_GREY, "{FF0000}Error:{FFFFFF} You must be the leader to deny hits.");
	new targetid;
	if(sscanf(params, "u", targetid)) return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /denyhit [playerid/PartOfName]");
	if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, COLOR_GREY, "{FF0000}Error:{FFFFFF} Invalid playerid.");
	if(PlayerInfo[targetid][pHeadValue] == 0) return SendClientMessage(playerid, COLOR_GREY, "{FF0000}Error:{FFFFFF} There is no contract on that player!");
	new str[128];
	format(str, sizeof(str), "You have removed %s's contract.", PlayerICName(targetid));
	SendClientMessage(playerid, COLOR_LIGHTBLUE, str);
	ClearContract(targetid);
	return 1;
}

CMD:givemehit(playerid, params[])
{
	if(PlayerInfo[playerid][pGroup] != GROUP_HITMAN) return 1;
	if(PlayerInfo[playerid][pGroupRank] < 1) return SendClientMessage(playerid, COLOR_GREY, "{FF0000}Error:{FFFFFF} You must be at least rank 1 to give out contracts to yourself.");
	new hitid;
	if(sscanf(params, "u", hitid)) return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /givemehit [playerid/PartOfName]");
	if(!IsPlayerConnected(hitid)) return SendClientMessage(playerid, COLOR_GREY, "{FF0000}Error:{FFFFFF} Invalid playerid.");
	if(PlayerInfo[hitid][pHeadValue] == 0 || PlayerInfo[playerid][pMember] == FACTION_S9) return SendClientMessage(playerid, COLOR_GREY, "{FF0000}Error:{FFFFFF} That player doesn't have a contract on their head.");
	new str[128];
	format(str, sizeof(str), "* You have offered yourself a contract to kill %s (type /accept contract), to accept it.", PlayerICName(hitid));
	SendClientMessage(playerid, COLOR_LIGHTBLUE, str);
	ContractOffer[playerid] = playerid;
	ContractID[playerid] = hitid;
	return 1;
}

CMD:hauc(playerid, params[])
	return cmd_hitmanundercover(playerid, params);

CMD:hitmanundercover(playerid, params[])
{
	if(PlayerInfo[playerid][pGroup] != GROUP_HITMAN && PlayerInfo[playerid][pGroup] != GROUP_S9)
		return 1;

	hitmanUndercover[playerid] = !hitmanUndercover[playerid];

	if(hitmanUndercover[playerid]) {
		SendClientMessage(playerid, COLOR_LIGHTBLUE, "* Undercover mode enabled.");
		SendClientMessage(playerid, COLOR_GREY, "Crimes and tickets will be hidden from your MDC profile.");
	}
	else {
		SendClientMessage(playerid, COLOR_LIGHTBLUE, "* Undercover mode disabled.");
		SendClientMessage(playerid, COLOR_GREY, "Crimes and tickets on your MDC profile will now show again.");
	}
	return 1;
}

CMD:order(playerid, params[])
{
	if(PlayerInfo[playerid][pGroup] != GROUP_HITMAN && PlayerInfo[playerid][pGroup] != GROUP_LLS)
		return 1;

	if(!IsPlayerNearHitmenHQ(playerid))
		return SendClientMessage(playerid, COLOR_GREY, "You are not at your headquarters.");
	if(PlayerInfo[playerid][pGroup] == 1){
	showHitmanDialog(playerid);}
	if(PlayerInfo[playerid][pGroup] == 8){
	showPakiArmory(playerid);}
	return 1;
}

CMD:mask(playerid, params[])
{
	/*

		Smo do not re-add mask to donated groups they abuse them and troll pretending to be HA/S9
		and break rules while masked. It's been a mess with mask and tons of players are complaining
		about this. There was a poll on the forums regarding it and it had significantly more support
		to remove them then to keep them (even some people who donated for a group said yes).

		- Sparke

	*/
	new str[128];
	if(PlayerInfo[playerid][pGroup] == GROUP_HITMAN ||
	PlayerInfo[playerid][pGroup] == GROUP_CRIME ||
	PlayerInfo[playerid][pGroup] == GROUP_CARTEL ||
	PlayerInfo[playerid][pMember] == FACTION_FBI ||
	PlayerInfo[playerid][pGroup] == GROUP_S9 ||
	PlayerInfo[playerid][pGroup] == GROUP_LLS ||
	PlayerInfo[playerid][pGroup] == GROUP_OPG ||
	PlayerInfo[playerid][pGroup] == GROUP_EXEC ||
	PlayerInfo[playerid][pGroup] == GROUP_BRATVA ||
	PlayerInfo[playerid][pGroup] == 3 ||
	PlayerInfo[playerid][pGroup] == GROUP_FACISTS) {

		if(PlayerInfo[playerid][pMask]) {
			SetPlayerMasked(playerid, false);

			format(str, sizeof(str), "* %s has taken their mask off.", PlayerICName(playerid));

			SetPlayerChatBubble(playerid, str, COLOR_PURPLE, 7.0, 5000);
			SendClientMessage(playerid, COLOR_PURPLE, str);
		} else {
			SetPlayerMasked(playerid, true);

			format(str, sizeof(str), "* %s has put their mask on.", PlayerICName(playerid));

			SetPlayerChatBubble(playerid, str, COLOR_PURPLE, 7.0, 5000);
			SendClientMessage(playerid, COLOR_PURPLE, str);
		}
	}
	return 1;
}

//the following hitman commands were scripted by Calvin Catt

//new takebadge
CMD:takebadge(playerid, params[])
{
	if(PlayerInfo[playerid][pGroup] != GROUP_HITMAN) return 1;
	new giveplayerid;
	if(sscanf(params, "u", giveplayerid)) return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /takebadge [playerid/partOfName]");
	if(giveplayerid == playerid) return SendClientMessage(playerid, COLOR_GREY, "You can't take a badge off yourself.");
	new str[128];
	if(IsPlayerInRangeOfPlayer(2.0, playerid, giveplayerid)) {

		if(pDeathState[giveplayerid] == PLAYER_STATE_REVIVE || PlayerCuffed[giveplayerid] > 0 || PlayerTazed[giveplayerid] > 0 || PlayerTied[giveplayerid]) {
			if(PlayerInfo[giveplayerid][pBadge]) {
				format(str, sizeof(str), "* %s has taken your badge.", PlayerICName(playerid));
				SendClientMessage(giveplayerid, COLOR_LIGHTBLUE, str);
				format(str, sizeof(str), "* %s reached into %s's pockets and took a badge.", PlayerICName(playerid), PlayerICName(giveplayerid));
				ProxDetector(30.0, playerid, str, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);

				//PlayerInfo[playerid][pHAFakeBadge] = PlayerInfo[giveplayerid][pBadge]; //pBadge should correspond to faction name, 1 for SAPD, 2 fbi etc
				PlayerInfo[playerid][pHAFakeBadge] = PlayerInfo[giveplayerid][pMember]; //this should be deleted once the above line is done

				PlayerInfo[giveplayerid][pBadge] = 0; //it should actually TAKE the badge from the player, requiring them to GET A NEW BADGE

				//do the animation
				SetPlayerFacingPlayer(playerid, giveplayerid);
				OnePlayAnim(playerid, "BOMBER", "BOM_Plant", 4.0, 0, 0, 0, 0, 0);
			}
			else
			{
				SendClientMessage(playerid, COLOR_GRAD2, "{FF0000}Error:{FFFFFF} That player does not have a badge.");
			}
		}
		else
		{
			SendClientMessage(playerid, COLOR_GREY, "That player must be Injured, Cuffed, Tied.");
		}
	}
	else
	{
		SendClientMessage(playerid, COLOR_GRAD2, "{FF0000}Error:{FFFFFF} That player is not in range.");
	}
	return 1;
}

CMD:placebadge(playerid)
{
	new str[128];
	if(PlayerInfo[playerid][pGroup] != GROUP_HITMAN) return 1;
	if(!IsPlayerInRangeOfPoint(playerid, 10, 312.7244,-166.1414,999.6010) && GetPlayerVirtualWorld(playerid) != 5) return SendClientMessage(playerid, COLOR_GREY, "{FF0000}Error:{FFFFFF} You are not at your Headquarters.");
	switch(PlayerInfo[playerid][pHAFakeBadge])
	{
		case 7:
		{
			format(str, sizeof(str), "* %s places a Judicial Department badge into the armory.", PlayerICName(playerid));
			HitmanBadgeSCOTUS += 1;
		}
		case 6:
		{
			format(str, sizeof(str), "* %s places a Government badge into the armory.", PlayerICName(playerid));
			HitmanBadgeGOV += 1;
		}
		case 5:
		{
			format(str, sizeof(str), "* %s places a Department of Corrections badge into the armory.", PlayerICName(playerid));
			HitmanBadgeNG += 1;
		}
		case 4:
		{
			format(str, sizeof(str), "* %s places a Los Santos Fire Medical Department badge into the armory.", PlayerICName(playerid));
			HitmanBadgeLSFMD += 1;
		}
		case 3:
		{
			format(str, sizeof(str), "* %s places a San Andreas Sheriff Department badge into the armory.", PlayerICName(playerid));
			HitmanBadgeRCSD += 1;
		}
		case 2:
		{
			format(str, sizeof(str), "* %s places a Federal Bureau of Investigations badge into the armory.", PlayerICName(playerid));
			HitmanBadgeFBI += 1;
		}
		case 1:
		{
			format(str, sizeof(str), "* %s places a San Andreas Police Department badge into the armory.", PlayerICName(playerid));
			HitmanBadgeSAPD += 1;
		}
		default:
			return SendClientMessage(playerid, COLOR_GRAD1, "{FF0000}Error:{FFFFFF} You do not have a fake badge.");
	}
	ProxDetector(30.0, playerid, str, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
	PlayerInfo[playerid][pHAFakeBadge] = 0;
	return 1;
}

CMD:givebadge(playerid, params[])
{
	new giveplayerid;
	if(sscanf(params, "u", giveplayerid)) return SendClientMessage(playerid, COLOR_GRAD2, "{00BFFF}Usage:{FFFFFF} /givebadge [playerid/partOfName]");
	if(!IsPlayerInRangeOfPlayer(5.0, playerid, giveplayerid)) return SendClientMessage(playerid, COLOR_GRAD2, "That player is not in range.");
	if((IsACop(playerid) || IsASenate(playerid) || IsAMedic(playerid) || IsANG(playerid) || IsAFBI(playerid) || PlayerInfo[playerid][pMember] == 7) && PlayerInfo[playerid][pLeader] >= 1)
	{
		new str[128];
		strmid(sendername, PlayerICName(playerid), 0, MAX_PLAYER_NAME);
		strmid(giveplayer, PlayerICName(giveplayerid), 0, MAX_PLAYER_NAME);
		format(str, sizeof(str), "* %s gives %s a badge.", sendername, giveplayer);
		ProxDetector(30.0, playerid, str, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
		format(str, sizeof(str), "* %s has given you a badge.", sendername);
		SendClientMessage(giveplayerid, COLOR_LIGHTBLUE, str);
		PlayerInfo[giveplayerid][pBadge] = 1;
		return 1;
	}
	return SendClientMessage(playerid, COLOR_GRAD2, "You are not authorised to use that command.");
}

CMD:fakebadge(playerid, params[])
{
	if(PlayerInfo[playerid][pGroup] != GROUP_HITMAN) return 1;
	if(PlayerInfo[playerid][pHAFakeBadge] == 0) return SendClientMessage(playerid, COLOR_GRAD1, "You do not have a fake badge.");
	switch(PlayerInfo[playerid][pOnDuty])
	{
		case 1:
		{
			SendClientMessage(playerid, COLOR_LIGHTBLUE, "* You have unequipped your fake badge.");
			PlayerInfo[playerid][pOnDuty] = 0;
			usingFakeBadge[playerid] = false;
			SetPlayerToTeamColor(playerid);
		}
		default:
		{
			SendClientMessage(playerid, COLOR_LIGHTBLUE, "* You have equipped your fake badge.");
			PlayerInfo[playerid][pOnDuty] = 1;
			usingFakeBadge[playerid] = true;
			SetPlayerToTeamColor(playerid);
		}
	}
	return 1;
}

CMD:reloadvipcars(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] < 2) return SendClientMessage(playerid, COLOR_GRAD1, "You're not authorized to use this command.");

	new
		i, j, vehicleID, count,
		deleteIt[ sizeof(VipCars) ] = {1, ...};



	// Figuring out which VipCars need not to be deleted //
	foreach(i:Player) {

		vehicleID = GetPlayerVehicleID(i);

		if(vehicleID == INVALID_VEHICLE_ID)
			continue;

		for(j = 0; j < sizeof(VipCars); j++) {

			if(vehicleID == VipCars[j])
				deleteIt[j] = 0;
		}
	}

	// Deleting the VipCars that need to be deleted //
	for(i = 0; i < sizeof(VipCars); i++) {
		if(deleteIt[i]) {
			count++;
			CreateVIPCar(i);
		}
	}
	new str[128];
	format(str, sizeof(str), "* %d VIP cars were reloaded.", count);
	SendClientMessage(playerid, COLOR_LIGHTBLUE, str);
	return 1;
}

CMD:killcp(playerid, params[])
{
	if(CP[playerid] != CHECKPOINT_NONE)
	{
		CP[playerid] = CHECKPOINT_NONE;
		DisablePlayerCheckpointEx(playerid);
		SendClientMessage(playerid, COLOR_WHITE, "Checkpoint removed! ");
	}
	else if(goingJob[playerid] == true)
	{
		DisablePlayerCheckpointEx(playerid);
		goingJob[playerid] = false;
		SendClientMessage(playerid, COLOR_WHITE, "Checkpoint removed! ");
	}
	else if(isRepairing[playerid] == true)
	{
		isRepairing[playerid] = false;
		DisablePlayerCheckpointEx(playerid);
		SendClientMessage(playerid, COLOR_WHITE, "Checkpoint removed.");
	}
	else
	{
		SendClientMessage(playerid, COLOR_GRAD1, "You do not have any checkpoints.");
	}
	return 1;
}

CMD:doorknock(playerid, params[])
{
	new hID = IsPlayerNearHouse(playerid);
	new str[128];
	if(hID != -1)
	{
		foreach( new i: Player )
		{
			if(GetPlayerVirtualWorld(i) == GetHouseVirtualWorld(hID))
			{
				format(str, sizeof(str), "* You hear knocking at the door.");
				SendClientMessage(i, COLOR_PURPLE, str);
			}
		}
		format(str, sizeof(str), "* %s knocks on the door.", PlayerICName(playerid));
		ProxDetector(30.0, playerid, str, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
	}
	else
	{
		SendClientMessage(playerid, COLOR_GREY, "You are not near a house door.");
	}
	return 1;
}

CMD:doorshout(playerid, params[])
{
	new hID, msg[128];
	new bool:found;
	new str[128];
	if(!sscanf(params, "s[128]", msg))
	{
		if(GetPlayerVirtualWorld(playerid) == 0)   // Player is outside
		{
			for(new i = 0; i < MAX_HOUSES; i++)
			{
				if(IsPlayerInRangeOfPoint(playerid, 5, HouseInfo[i][hOutsideX], HouseInfo[i][hOutsideY], HouseInfo[i][hOutsideZ]))
				{
					hID = i;
					found = true;
					break;
				}
			}
			if(found)
			{
				if(strcmp(Accent[playerid], "none", true, 4)) format(str, sizeof(str), "(Outside) %s: [%s Accent] %s.", PlayerICName(playerid), Accent[playerid], msg);
				else format(str, sizeof(str), "(Outside) %s: %s.", PlayerICName(playerid), msg);
				foreach( new i: Player )
				{
					if(IsPlayerInRangeOfPoint(i, 50, HouseInfo[hID][hInsideX], HouseInfo[hID][hInsideY], HouseInfo[hID][hInsideZ]))
					{
						SendClientMessage(i, COLOR_WHITE, str);
					}
				}
				if(strcmp(Accent[playerid], "none", true, 3)) format(str, sizeof(str), "%s shouts: [%s Accent] %s.", PlayerICName(playerid), Accent[playerid], msg);
				else format(str, sizeof(str), "%s shouts: %s.", PlayerICName(playerid), msg);
				ProxDetector(30.0, playerid, str, COLOR_FADE1, COLOR_FADE2, COLOR_FADE3, COLOR_FADE4, COLOR_FADE5);
				if(ThiefText[playerid] != Text3D:INVALID_3DTEXT_ID) return 1;
				if(nametagText[playerid] != Text3D:INVALID_3DTEXT_ID) return 1;
				if(strcmp(Accent[playerid], "none", true, 3)) format(str, sizeof(str), "shouts: [%s Accent] %s.", Accent[playerid], msg);
				else format(str, sizeof(str), "shouts: %s.", msg);
				SetPlayerChatBubble(playerid, str, COLOR_WHITE, 30.0, 10000);
			}
			else
			{
				SendClientMessage(playerid, COLOR_GREY, "You are not near a house door.");
			}
		}
		else	 //Player is inside
		{
			for(new i = 0; i < MAX_HOUSES; i++)
			{
				if(IsPlayerInRangeOfPoint(playerid, 5, HouseInfo[i][hInsideX], HouseInfo[i][hInsideY], HouseInfo[i][hInsideZ]))
				{
					hID = i;
					found = true;
					break;
				}
			}
			if(found)
			{
				if(strcmp(Accent[playerid], "none", true, 4)) format(str, sizeof(str), "(Inside) %s: [%s Accent] %s.", PlayerICName(playerid), Accent[playerid], msg);
				else format(str, sizeof(str), "(Inside) %s: %s.", PlayerICName(playerid), msg);
				foreach( new i: Player )
				{
					if(IsPlayerInRangeOfPoint(playerid, 50, HouseInfo[hID][hOutsideX], HouseInfo[hID][hOutsideY], HouseInfo[hID][hOutsideZ]))
					{
						SendClientMessage(i, COLOR_WHITE, str);
					}
				}
				if(strcmp(Accent[playerid], "none", true, 3)) format(str, sizeof(str), "%s shouts: [%s Accent] %s.", PlayerICName(playerid), Accent[playerid], msg);
				else format(str, sizeof(str), "%s shouts: %s.", PlayerICName(playerid), msg);
				ProxDetector(30.0, playerid, str, COLOR_FADE1, COLOR_FADE2, COLOR_FADE3, COLOR_FADE4, COLOR_FADE5);
				if(ThiefText[playerid] != Text3D:INVALID_3DTEXT_ID) return 1;
				if(nametagText[playerid] != Text3D:INVALID_3DTEXT_ID) return 1;
				if(strcmp(Accent[playerid], "none", true, 3)) format(str, sizeof(str), "shouts: [%s Accent] %s.", Accent[playerid], msg);
				else format(str, sizeof(str), "shouts: %s.", msg);
				SetPlayerChatBubble(playerid, str, COLOR_WHITE, 30.0, 10000);
			}
			else
			{
				SendClientMessage(playerid, COLOR_GREY, "You are not near a house door.");
			}
		}
	}
	else
	{
		SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /doorshout [text]");
	}
	return 1;
}

CMD:tikis(playerid, params[])
{
	new str[128];
	format(str, sizeof(str), "You have %d tikis.", PlayerInfo[playerid][pTikis]);
	SendClientMessage(playerid, COLOR_GREY, str);
	return 1;
}

CMD:tikistore(playerid, params[])
{
	if(Packages[playerid] > 0)
	{
		return SendClientMessage(playerid, COLOR_GREY, "You must finish delivering your Materials Packages.");
	}
	if(Crates[playerid] > 0)
	{
		return SendClientMessage(playerid, COLOR_GREY, "You must finish delivering your Drug Crates.");
	}
	if(CP[playerid] == CHECKPOINT_DROPCAR)
	{
		return SendClientMessage(playerid, COLOR_GREY, "You must drop your car at the crane first.");
	}
	SetPlayerCheckpointEx(playerid, 2352.995, -1463.545, 24.000, 3);
	CP[playerid] = CHECKPOINT_TIKISTORE;
	SendClientMessage(playerid, COLOR_GREY, "The tiki store has been marked on your map.");
	return 1;
}

CMD:aenter(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] >= 2 || PlayerInfo[playerid][pDev] >= 2 || PlayerInfo[playerid][pMapper] == MAPPERRANK_MANAGER)
	{
		for(new i = 0; i < sizeof(EntranceRef); i++)
		{
			if(IsPlayerInRangeOfPoint(playerid, 2.0, Entrances[i][outside_x], Entrances[i][outside_y], Entrances[i][outside_z]) && GetPlayerVirtualWorld(playerid) == Entrances[i][outside_w] && GetPlayerInterior(playerid) == Entrances[i][outside_i])
			{
				SetPlayerPos(playerid, Entrances[i][inside_x], Entrances[i][inside_y], Entrances[i][inside_z]);
				SetPlayerFacingAngle(playerid, Entrances[i][inside_a]);
				SetPlayerInterior(playerid, Entrances[i][inside_i]);
				PlayerInfo[playerid][pInt] = Entrances[i][inside_i]; //this was commented for some reason
				SetPlayerVirtualWorld(playerid, Entrances[i][inside_w]);
				PlayerInfo[playerid][pVirtualWorld] = Entrances[i][inside_w]; //this was commented for some reason
				SetCameraBehindPlayer(playerid);
				if(Entrances[i][freeze])
				{
					Timer_FreezePlayer(playerid, FREEZE, ENTER_FREEZE);
				}
				return 1;
			}
		}
		for(new h = 1; h < sizeof(HouseInfo); h++)
		{
			if(IsPlayerInRangeOfPoint(playerid, 1.0, HouseInfo[h][hOutsideX], HouseInfo[h][hOutsideY], HouseInfo[h][hOutsideZ]))
			{

				SetPlayerPos(playerid, HouseInfo[h][hInsideX], HouseInfo[h][hInsideY], HouseInfo[h][hInsideZ]);
				SetPlayerFacingAngle(playerid, HouseInfo[h][hInsideA]);
				SetPlayerInterior(playerid, HouseInfo[h][hInterior]);
				SetPlayerVirtualWorld(playerid, HouseInfo[h][hSQLID]);
				PlayerInfo[playerid][pInt] = HouseInfo[h][hInterior];
				PlayerInfo[playerid][pVirtualWorld] = h;
				SetCameraBehindPlayer(playerid);
				new string34[75];
				format(string34, sizeof(string34), "~b~%s", HouseInfo[h][hTag]);
				displayCenterHUDInfo(playerid,  string34, 8); //display for 8 seconds
				inHouse[playerid] = true;
				if(HouseInfo[h][hFreeze])
				{
					Timer_FreezePlayer(playerid, FREEZE, ENTER_FREEZE);
				}
				return 1;
			}
		}
	}
	else return AdmErrorMsg;
	return 1;
}

CMD:exchange(playerid, params[])
{
	if(!IsPlayerInRangeOfPoint(playerid, 2, -2237.1008, 130.3685, 1035.4141)) return SendClientMessage(playerid, COLOR_GREY, "You are not at the tiki store counter.");
	new string[450];
	format(string, sizeof(string), "SD Pistol\t\t1 tikis\nFull Armor\t\t3 tikis\n25 pot\t\t\t4 tikis\n25 crack\t\t8 tikis\n10,000 materials\t10 tikis\n$100,000\t\t12 tikis\nGamble\t\t\t12 tikis\nMace\t\t\t12 tikis\nVoodoo Magic\t\t25 tikis\nC4\t\t\t16 tikis\nGear Ticket\t\t6 tikis\nLarge Boombox\t6 tikis\nTec9\t\t\t12 tikis\nGrenade (1 ammo)\t18 tikis\nRPG (1 ammo)\t\t24 tikis\nSilver VIP\t\t40 tikis\nKnife\t\t\t15 tikis");

	ShowPlayerDialog(playerid, 93, DIALOG_STYLE_LIST, "Tiki Exchange", string, "{FF4500}Exchange", "{FF4500}Cancel");
	return 1;
}

CMD:deployspikes(playerid, params[])
{
	if(!IsACop(playerid) && !(PlayerInfo[playerid][pMember] == 5) && PlayerInfo[playerid][pMember] != FACTION_SANG) return SendClientMessage(playerid, COLOR_GREY, "You are not a Cop / FBI / SASD / NG Member.");
	if(PlayerInfo[playerid][pMember] == 1)
	{
		if(PlayerInfo[playerid][pRank] < 3) return SendClientMessage(playerid, COLOR_GREY, "Your rank is too low to be deploying spike strips (R3+).");
	}
	else if(PlayerInfo[playerid][pMember] == 3)
	{
		if(PlayerInfo[playerid][pRank] < 3) return SendClientMessage(playerid, COLOR_GREY, "Your rank is too low to be deploying spike strips (R3+).");
	}
	else if(PlayerInfo[playerid][pMember] == FACTION_SANG)
	{
		if(PlayerInfo[playerid][pRank] < 2) return SendClientMessage(playerid, COLOR_GREY, "Your rank is too low to be deploying spike strips (R2+)");
	}
	if(IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_GREY, "{FF0000}Error:{FFFFFF} You cannot use this while in a car.");
	new Float:plocx, Float:plocy, Float:plocz, Float:ploca;
	GetPlayerPos(playerid, plocx, plocy, plocz);
	GetPlayerFacingAngle(playerid, ploca);
	new location[MAX_ZONE_NAME];
	GetPlayer2DZone(playerid, location, MAX_ZONE_NAME);
	new str[128];
	format(str, sizeof(str), "HQ: %s %s %s has placed a spike strip at %s.", GetPlayerFactionName(playerid), GetPlayerRank(playerid), PlayerICName(playerid), location);
	SendRadioMessage(1, TEAM_BLUE_COLOR, str);
	SendRadioMessage(2, TEAM_BLUE_COLOR, str);
	SendRadioMessage(3, TEAM_BLUE_COLOR, str);
	SendRadioMessage(5, TEAM_BLUE_COLOR, str);
	ApplyAnimationEx(playerid, "BOMBER", "BOM_Plant_Loop", 4.0, 0, 0, 0, 0, 0);
	GetPlayerFacingAngle(playerid, ploca);
	CreateStrip(plocx, plocy, plocz, ploca);
	Streamer_Update(playerid);
	return 1;
}




CMD:backupclear(playerid, params[])
{
	new str[128];
	if(PlayerInfo[playerid][pMember] == 1 || PlayerInfo[playerid][pMember] == 2 || PlayerInfo[playerid][pMember] == 3 || PlayerInfo[playerid][pMember] == 4 || PlayerInfo[playerid][pMember] == 5 || PlayerInfo[playerid][pMember] == FACTION_SANG || PlayerInfo[playerid][pGroup] == GROUP_S9)
	{
		new fakefac[10];
		switch(FakeFaction[playerid])
		{
			case 1:
				fakefac = "SAPD";
			case 4:
				fakefac = "SAFMD";
			case 5:
				fakefac = "DoC";
			case 14:
				fakefac = "SANG";
			default:
				fakefac = "SAPD";
		}

		if(backupType[playerid] == 0) return SendClientMessage(playerid, COLOR_GREY, "You don't have a backup request out.");
		if(backupType[playerid] == 1) //SAPD
		{
			// If player is S9 and not in a faction - or if they are an they are in a faction but masked then send DHS
			if((PlayerInfo[playerid][pGroup] == GROUP_S9 && PlayerInfo[playerid][pMember] == 0) ||
			   (PlayerInfo[playerid][pGroup] == GROUP_S9 && PlayerInfo[playerid][pMask] == 1)) {
					format(str, sizeof(str), "HQ: All units, S9 %s %s has cancelled their police backup request.", RealS9Rank(playerid), PlayerInfo[playerid][pMaskName]);
			   }

			else format(str, sizeof(str), "HQ: All units, %s %s %s has cancelled their police backup request.", GetPlayerFactionName(playerid), GetPlayerRank(playerid), PlayerOOCName(playerid));
			SendRadioMessage(1, TEAM_BLUE_COLOR, str);
			SendClientMessage(playerid, COLOR_YELLOW, "You have cancelled your backup request.");
			backupType[playerid] = 0;
			foreach( new i: Player )
			{
				if(IsPlayerConnected(i))
				{
					if(PlayerInfo[i][pMember] == 1)
					{
						SetPlayerMarkerForPlayer(i, playerid, TCOLOR_WHITE);
						SetPlayerToTeamColor(playerid);
					}
				}
			}
		}
		else if(backupType[playerid] == 2) //FBI | DEA
		{

			if((PlayerInfo[playerid][pGroup] == GROUP_S9 && PlayerInfo[playerid][pMember] == 0) ||
			(PlayerInfo[playerid][pGroup] == GROUP_S9 && PlayerInfo[playerid][pMask] == 1)) {
				format(str, sizeof(str), "HQ: All units, S9 %s %s is requesting police backup, they have been marked on your GPS.", RealS9Rank(playerid), PlayerInfo[playerid][pMaskName]);
			}
			else {
				format(str, sizeof(str), "DISPATCH: %s %s %s has cancelled their FBI backup request.", GetPlayerFactionName(playerid), GetPlayerRank(playerid), PlayerICName(playerid));
			}

			SendRadioMessage(2, TEAM_BLUE_COLOR, str);
			SendClientMessage(playerid, COLOR_YELLOW, "You have cancelled your backup request.");
			backupType[playerid] = 0;
			foreach( new i: Player )
			{
				if(IsPlayerConnected(i))
				{
					if(PlayerInfo[i][pMember] == 2)
					{
						SetPlayerMarkerForPlayer(i, playerid, TCOLOR_WHITE);
						SetPlayerToTeamColor(playerid);
					}
				}
			}
		}
		else if(backupType[playerid] == 3) //SASD
		{
			if((PlayerInfo[playerid][pGroup] == GROUP_S9 && PlayerInfo[playerid][pMember] == 0) ||
			(PlayerInfo[playerid][pGroup] == GROUP_S9 && PlayerInfo[playerid][pMask] == 1)) {
				format(str, sizeof(str), "HQ: All units, S9 %s %s is requesting police backup, they have been marked on your GPS.", RealS9Rank(playerid), PlayerInfo[playerid][pMaskName]);
			} else {
				format(str, sizeof(str), "DISPATCH: %s %s %s has cancelled their SASD backup request.", GetPlayerFactionName(playerid), GetPlayerRank(playerid), PlayerICName(playerid));
			}
			SendRadioMessage(3, TEAM_BLUE_COLOR, str);
			SendClientMessage(playerid, COLOR_YELLOW, "You have cancelled your backup request.");
			backupType[playerid] = 0;
			foreach( new i: Player )
			{
				if(IsPlayerConnected(i))
				{
					if(PlayerInfo[i][pMember] == 3)
					{
						SetPlayerMarkerForPlayer(i, playerid, TCOLOR_WHITE);
						SetPlayerToTeamColor(playerid);
					}
				}
			}
		}

		else if(backupType[playerid] == 4) //FMD
		{
			if((PlayerInfo[playerid][pGroup] == GROUP_S9 && PlayerInfo[playerid][pMember] == 0) ||
			(PlayerInfo[playerid][pGroup] == GROUP_S9 && PlayerInfo[playerid][pMask] == 1)) {
				format(str, sizeof(str), "HQ: All units, S9 %s %s is requesting police backup, they have been marked on your GPS.", RealS9Rank(playerid), PlayerInfo[playerid][pMaskName]);
			} else {
				format(str, sizeof(str), "HQ: All units, %s %s %s has cancelled their medical backup request.", GetPlayerFactionName(playerid), GetPlayerRank(playerid), PlayerICName(playerid));
			}
			SendRadioMessage(4, TEAM_BLUE_COLOR, str);
			SendClientMessage(playerid, COLOR_YELLOW, "You have cancelled your backup request.");
			backupType[playerid] = 0;
			foreach( new i: Player )
			{
				if(IsPlayerConnected(i))
				{
					if(PlayerInfo[i][pMember] == 4)
					{
						SetPlayerMarkerForPlayer(i, playerid, TCOLOR_WHITE);
						SetPlayerToTeamColor(playerid);
					}
				}
			}
		}
		else if(backupType[playerid] == 5) //DOC
		{
			if((PlayerInfo[playerid][pGroup] == GROUP_S9 && PlayerInfo[playerid][pMember] == 0) ||
			(PlayerInfo[playerid][pGroup] == GROUP_S9 && PlayerInfo[playerid][pMask] == 1)) {
				format(str, sizeof(str), "HQ: All units, S9 %s %s is requesting police backup, they have been marked on your GPS.", RealS9Rank(playerid), PlayerInfo[playerid][pMaskName]);
			} else format(str, sizeof(str), "HQ: All units, %s %s %s has cancelled their DoC backup request.", GetPlayerFactionName(playerid), GetPlayerRank(playerid), PlayerICName(playerid));
			SendRadioMessage(5, TEAM_BLUE_COLOR, str);
			SendClientMessage(playerid, COLOR_YELLOW, "You have cancelled your backup request.");
			backupType[playerid] = 0;
			foreach( new i: Player )
			{
				if(IsPlayerConnected(i))
				{
					if(PlayerInfo[i][pMember] == 5)
					{
						SetPlayerMarkerForPlayer(i, playerid, TCOLOR_WHITE);
						SetPlayerToTeamColor(playerid);
					}
				}
			}
		}
		else if(backupType[playerid] == 14)
		{
			if((PlayerInfo[playerid][pGroup] == GROUP_S9 && PlayerInfo[playerid][pMember] == 0) ||
			(PlayerInfo[playerid][pGroup] == GROUP_S9 && PlayerInfo[playerid][pMask] == 1)) {
				format(str, sizeof(str), "HQ: All units, S9 %s %s is requesting SANG backup, they have been marked on your GPS.", RealS9Rank(playerid), PlayerInfo[playerid][pMaskName]);
			} else format(str, sizeof(str), "HQ: All units, %s %s %s has cancelled their SANG backup request.", GetPlayerFactionName(playerid), GetPlayerRank(playerid), PlayerICName(playerid));
			SendRadioMessage(14, COLOR_SANG, str);
			SendClientMessage(playerid, COLOR_YELLOW, "You have cancelled your backup request.");
			backupType[playerid] = 0;
			foreach( new i: Player )
			{
				if(IsPlayerConnected(i))
				{
					if(PlayerInfo[i][pMember] == 14)
					{
						SetPlayerMarkerForPlayer(i, playerid, TCOLOR_WHITE);
						SetPlayerToTeamColor(playerid);
					}
				}
			}
		}
		else if(backupType[playerid] == 666) //s9
		{
			format(str, sizeof(str), "DISPATCH: %s %s has cancelled their S9 backup request.", RealS9Rank(playerid), PlayerOOCName(playerid));
			SendGroupMessage(GROUP_S9, COLOR_S9, str);
			SendClientMessage(playerid, COLOR_YELLOW, "You have cancelled your backup request.");
			backupType[playerid] = 0;
			foreach( new i: Player )
			{
				if(IsPlayerConnected(i))
				{
					if(PlayerInfo[i][pGroup] == GROUP_S9)
					{
						SetPlayerMarkerForPlayer(i, playerid, TCOLOR_WHITE);
						SetPlayerToTeamColor(playerid);
					}
				}
			}
		}
	}
	else return SendClientMessage(playerid, COLOR_GREY, "You are not a member of the SAPD, FBI, SASD, DoC or FMD.");
	return 1;
}

CMD:bkc(playerid, params[]) return cmd_backupclear(playerid, params);
CMD:backup(playerid, params[])
{
	if(CheckForJammer(playerid)) return SendClientMessage(playerid, COLOR_GREY, "Backup signal has been jammed.");
	if(pDeathState[playerid] == PLAYER_STATE_REVIVE)
	{
		new str[128];
		format(str, sizeof(str), "* %s attempts to reach his backup button but fails.", PlayerICName(playerid));
		ProxDetector(30.0, playerid, str, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
		return 1;
	}
	if(PlayerInfo[playerid][pMember] == 1 /*SAPD*/ || PlayerInfo[playerid][pMember] == 2 /*FBI*/ || PlayerInfo[playerid][pMember] == 3 /*SASD*/ || PlayerInfo[playerid][pMember] == 4 /*FMD*/ || PlayerInfo[playerid][pMember] == 5/*DoC*/ || PlayerInfo[playerid][pMember] == FACTION_SANG /*SANG*/|| PlayerInfo[playerid][pGroup] == GROUP_S9)
	{
		new type[8];
		if(sscanf(params, "s[8]", type)) return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /backup [Police, FBI, Medic, SANG]");
		{
			if(strmatch(type, "s9"))
			{
				CallS9Backup(playerid);
			}
			else if(strmatch(type, "police"))
			{
				CallPoliceBackup(playerid);
			}
			else if(strmatch(type, "fbi"))
			{
				CallFBIBackup(playerid);
			}
			/*else if(strmatch(type, "sasd"))
			{
				CallSASTBackup(playerid);
			}*/
			/*else if(strmatch(type, "doc"))
			{
				CallDOCBackup(playerid);
			}*/
			else if(strmatch(type, "medic"))
			{
				CallMedicalBackup(playerid);
			}
			else if(strmatch(type, "sang"))
			{
				CallSANGBackup(playerid);
			}
			else return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /backup [Police, FBI, SASD, DoC, Medic, SANG]");
		}
	}
	else return SendClientMessage(playerid, COLOR_GREY, "You are not a member of the SAPD, FBI, SASD, DoC, FMD or SANG.");
	return 1;
}

CMD:bk(playerid, params[]) return cmd_backup(playerid, params);

CMD:deletespike(playerid, params[])
{
	if(!IsACop(playerid) && !(PlayerInfo[playerid][pMember] == FACTION_SANG)) return SendClientMessage(playerid, COLOR_GREY, "You are not a Cop / FBI / SASD / NG Member.");
	if(IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_GREY, "{FF0000}Error:{FFFFFF} You cannot use this while in a car.");
	if(PlayerInfo[playerid][pMember] == 1)
	{
		if(PlayerInfo[playerid][pRank] < 3) return SendClientMessage(playerid, COLOR_GREY, "Your rank is too low to be removing spike strips (R3+).");
	}
	else if(PlayerInfo[playerid][pMember] == 3)
	{
		if(PlayerInfo[playerid][pRank] < 3) return SendClientMessage(playerid, COLOR_GREY, "Your rank is too low to be removing spike strips (R3+).");
	}
	else if(PlayerInfo[playerid][pMember] == FACTION_SANG)
	{
		if(PlayerInfo[playerid][pRank] < 2) return SendClientMessage(playerid, COLOR_GREY, "Your rank is too low to be removing spike strips (R2+)");
	}
	DeleteClosestStrip(playerid);
	return 1;
}

CMD:deletespikes(playerid, params[])
{
	if(!IsACop(playerid) && !(PlayerInfo[playerid][pMember] == FACTION_SANG)) return SendClientMessage(playerid, COLOR_GREY, "You are not a Cop / FBI / SASD / NG Member.");
	if(PlayerInfo[playerid][pMember] == 1)
	{
		if(PlayerInfo[playerid][pRank] < 4) return SendClientMessage(playerid, COLOR_GREY, "Your rank is too low to be removing spike strips (R4+).");
	}
	else if(PlayerInfo[playerid][pMember] == FACTION_SANG)
	{
		if(PlayerInfo[playerid][pRank] < 2) return SendClientMessage(playerid, COLOR_GREY, "Your rank is too low to be removing spike strips (R2+)");
	}
	new str[128];
	format(str, sizeof(str), "HQ: %s %s %s has deleted all spike strips.", GetPlayerFactionName(playerid), GetPlayerRank(playerid), PlayerICName(playerid));
	SendRadioMessage(1, TEAM_BLUE_COLOR, str);
	SendRadioMessage(2, TEAM_BLUE_COLOR, str);
	SendRadioMessage(3, TEAM_BLUE_COLOR, str);
	SendRadioMessage(5, TEAM_BLUE_COLOR, str);
	SendRadioMessage(14, TEAM_BLUE_COLOR, str);
	DeleteAllStrip();
	return 1;
}

CMD:duty(playerid, params[])
{
	if(PlayerInfo[playerid][pJob] == 2)
	{
		if(JobDuty[playerid] == 1)
		{
			SendClientMessage(playerid, COLOR_LIGHTBLUE, "* You are now Off Duty from your Lawyer Job and will not receive calls anymore.");
			JobDuty[playerid] = 0;
		}
		else
		{
			SendClientMessage(playerid, COLOR_LIGHTBLUE, "* You are now On Duty with your Lawyer Job and will receive calls from people in need.");
			JobDuty[playerid] = 1;
		}
	}
	else if(PlayerInfo[playerid][pJob] == 7)
	{
		if(JobDuty[playerid] == 1)
		{
			SendClientMessage(playerid, COLOR_LIGHTBLUE, "* You are now Off Duty from your Mechanic Job and will not receive calls anymore.");
			JobDuty[playerid] = 0;
		}
		else
		{
			SendClientMessage(playerid, COLOR_LIGHTBLUE, "* You are now On Duty with your Mechanic Job and will receive calls from people in need.");
			JobDuty[playerid] = 1;
		}
	}
	else
	{
		SendClientMessage(playerid, COLOR_GREY, "You must be a lawyer/mechanic to use this command.");
		if(PlayerInfo[playerid][pMember] == 1)
		{
			SendClientMessage(playerid, COLOR_WHITE, "HINT: Police officers use /SAPD at the locker rooms.");
		}
	}
	return 1;
}

CMD:sitlicense(playerid, params[])
{
	if(IsPlayerInRangeOfPoint(playerid, 3.0, 1491.2963, 1306.1758, 1093.2964))
	{
		new section[10];
		if(sscanf(params, "s[10]", section))return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /sitlicense [driving($10,000)/sailing($20,000)]");
		{
			if(strmatch(section, "driving"))
			{
				if(PlayerInfo[playerid][pCarLicense] == 0)
				{
					if(PlayerInfo[playerid][pCash] >= 9999)
					{
						dmvSlot[playerid] = 1;
						autoFailed[playerid] = false;

						SetPlayerVirtualWorld(playerid, playerid +1);
						SetPlayerInterior(playerid, 0);
						GameTextForPlayer(playerid, "Driving Test ~r~Started~w~!", 3000, 5);
						PlayerInfo[playerid][pCash] -= 10000;
						SetPlayerRaceCheckpoint(playerid, 0, carLicensePositions[0][0], carLicensePositions[0][1], carLicensePositions[0][2], carLicensePositions[1][0], carLicensePositions[1][1], carLicensePositions[1][2], 3.0);
						SendClientMessage(playerid, COLOR_YELLOW, "Follow the marked positions on your GPS to complete the license. (-$5,000)");
						SendClientMessage(playerid, COLOR_LIGHTBLUE, "> 			RULES:		");
						SendClientMessage(playerid, COLOR_LIGHTBLUE, ">				Do not go over the speed of 50 MPH.");
						SendClientMessage(playerid, COLOR_LIGHTBLUE, ">				Do not damage the vehicle too much.");
						SendClientMessage(playerid, COLOR_LIGHTBLUE, ">				Drive on the correct side of the road.");
						SendClientMessage(playerid, COLOR_LIGHTBLUE, ">				Stop at traffic lights which display RED.");
						SendClientMessage(playerid, COLOR_LIGHTBLUE, ">				Always watch the road, and keep two hands on the steering wheel.");
						SendClientMessage(playerid, COLOR_YELLOW, "Failure to follow the above rules will result in an automatic fail.");
						SetPlayerPos(playerid, 1235.0735, -1815.1517, 13.6038);
						SetPlayerInterior(playerid, 0);
						SetPlayerVirtualWorld(playerid, 5);

					}
					else return SendClientMessage(playerid, COLOR_GREY, "You can't afford this.");
				}
				else return SendClientMessage(playerid, COLOR_GREY, "You already have your drivers license!");
			}
			else if(strmatch(section, "sailing"))
			{
				if(PlayerInfo[playerid][pBoatLicense] == 0)
				{
					if(PlayerInfo[playerid][pCash] >= 20000)
					{
						SendClientMessage(playerid, COLOR_GREY, "This will be added soon, you have the license automatically.");
					}
					else return SendClientMessage(playerid, COLOR_GREY, "You can't afford this.");
				}
				else return SendClientMessage(playerid, COLOR_GREY, "You already have your sailing license!");
			}
			else return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /sitlicense [driving/sailing]");
		}
	}
	else return SendClientMessage(playerid, COLOR_GREY, "You're must be at the desk in the DMV station.");
	return 1;
}

CMD:unloadtrash(playerid, params[])
{
	if(PlayerInfo[playerid][pJob] != 19) return SendClientMessage(playerid, COLOR_GREY, "You are not a Waste Collector.");
	if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER) return SendClientMessage(playerid, COLOR_GREY, "You must be driving the Garbage Truck.");
	if(unloadingTrashTimer[playerid]) return SendClientMessage(playerid, COLOR_GREY, "You are already unloading trash.");

	new deliverypoint; //none

	if(IsPlayerInRangeOfPoint(playerid, 10.0, 89.6221,-259.6307,1.5781)) { //at blueberry
		deliverypoint = 1;
	} else if(IsPlayerInRangeOfPoint(playerid, 10.0, 2902.5264,-2119.8174,2.7550)) { //at illegal point (LS)
		if(PlayerInfo[playerid][pWasteSkill] < 400) return SendClientMessage(playerid, COLOR_GREY, "You must be a level 5 Waste Collector to dump trash here.");
		deliverypoint = 2;
	}

	if(deliverypoint > 0) {
		new slot = -1;
		new vehicleid = GetPlayerVehicleID(playerid);
		for(new i = 0; i < sizeof(GarbageTruck); i++) { //find the vehicle id in the array
			if(vehicleid == GarbageTruck[i][vehicle_id]) { //found the garbage truck player is sitting in
					slot = i;
			}
		}

		if(slot == -1) return SendClientMessage(playerid, COLOR_GREY, "You are not in a garbage truck.");

		TogglePlayerControllable(playerid, 0); //freeze
		new str[128];
		format(str, sizeof(str), "* %s has begun unloading their trash.", PlayerICName(playerid));
		ProxDetector(30.0, playerid, str, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);

		unloadingTrashTimer[playerid] = SetTimerEx("Timer_unloadTrash", 5 *1000, 0, "iii", playerid, slot, deliverypoint); //5 seconds
	} else {
		SendClientMessage(playerid, COLOR_GREY, "You are not at the trash delivery point in the Blueberry Junkyard.");
	}
	return 1;
}

CMD:gettrash(playerid, params[])
{
	if(PlayerInfo[playerid][pJob] != 19) return SendClientMessage(playerid, COLOR_GREY, "You are not a Waste Collector.");

	if(CP[playerid] == CHECKPOINT_GARBAGE) return SendClientMessage(playerid, COLOR_GREY, "You are already holding Trash.");

	for(new i = 0; i < sizeof(trashInfo); i++) {
		if(IsPlayerInRangeOfPoint(playerid, 2.0, trashInfo[i][posX], trashInfo[i][posY], trashInfo[i][posZ])) {
			if(trashInfo[i][tAmount] > 0) { //there is trash

				new vehicleid = findNearestGarbageTruck(playerid);
				if(vehicleid != -1) {

					//get position behind vehicle
					new Float:vehX, Float:vehY, Float:vehZ, Float:vehA;
					GetVehiclePos(vehicleid, vehX, vehY, vehZ);
					GetVehicleZAngle(vehicleid, vehA);
					vehX -= (3 * floatsin(-vehA, degrees));
					vehY -= (3 * floatcos(-vehA, degrees));

					//make sure the back of the vehicle is not sitting on the /gettrash position
					if(isPosWithinRange(4.0, trashInfo[i][posX], trashInfo[i][posY], trashInfo[i][posZ], vehX, vehY, vehZ)) {
						hasTruckCheckpoint[playerid] = -1; //have to reset this
						return SendClientMessage(playerid, COLOR_GREY, "The garbage truck must be at least 4 metres from the bin.");
					}

					//set the checkpoint
					DisablePlayerCheckpointEx(playerid);
					CP[playerid] = CHECKPOINT_GARBAGE; //set checkpoint ID
					SetPlayerCheckpointEx(playerid, vehX, vehY, vehZ, 3.0);

					//pickup trash
					ApplyAnimationEx(playerid, "CARRY", "liftup", 4.0, 0, 0, 0, 0, 0, 0);
					Timer_SetPlayerPickupObject(playerid, 1);

					displayCenterHUDInfo(playerid,  "~w~Load the trash into the back of the truck.", 8); //display for 8 seconds

					trashInfo[i][tAmount]--; //deincrement

					//update 3dtext
					new str[128];
					format(str, sizeof(str), "Trash\n{FFFFFF}%d/%d\n/gettrash", trashInfo[i][tAmount], trashInfo[i][tLimit]);
					UpdateDynamic3DTextLabelText(trashInfo[i][trashLabelID], 0x43527DFF, str);
					return 1;
				} else {
					return SendClientMessage(playerid, COLOR_GREY, "You are not near a Garbage Truck.");
				}
			} else {
				return SendClientMessage(playerid, COLOR_GREY, "The bin is empty.");
			}
		}
	}
	return 1;
}

CMD:finddcars(playerid, params[])
{
	if(PlayerInfo[playerid][pDonateRank] < 4) return AdmErrorMsg;
	DisablePlayerCheckpointEx(playerid);
    CP[playerid] = CHECKPOINT_DCARS; //set checkpoint ID
    SetPlayerCheckpointEx(playerid, 1113.95, -1884.83, 13.04, 3.0);
	return 1;
}

CMD:getmats(playerid, params[])
{
	if(PlayerInfo[playerid][pJob] != 9 && PlayerInfo[playerid][pDonateRank] < 3) return SendClientMessage(playerid, COLOR_GREY, "You are not a Arms Dealer/Gold VIP.");
	new str[128];
	if(IsPlayerInRangeOfPoint(playerid, 3.0, 1423.6151, -1320.5438, 13.5546)) //materials pickup 1
	{
		if(Packages[playerid] >= 10)
		{
			SendClientMessage(playerid, COLOR_GREY, "You can't hold any more Materials Packages.");
			return 1;
		}
		if(Crates[playerid] > 0)
		{
			SendClientMessage(playerid, COLOR_GREY, "You must finish delivering your Drug Crates.");
			return 1;
		}
		if(GetPlayerVirtualWorld(playerid) != 0)
		{
			SendClientMessage(playerid, COLOR_GREY, "You can't do that while in a Virtual World.");
			SetPlayerHealth(playerid, 0.0);
			return 1;
		}
		if(PlayerInfo[playerid][pDonateRank] == 0 && PlayerInfo[playerid][pCash] < matprice) return SendClientMessage(playerid, COLOR_GREY, "You can't afford that. ($500).");
		if(PlayerInfo[playerid][pDonateRank] == 1 && PlayerInfo[playerid][pCash] < 560) return SendClientMessage(playerid, COLOR_GREY, "You can't afford that ($560).");
		if(PlayerInfo[playerid][pDonateRank] == 2 && PlayerInfo[playerid][pCash] < 620) return SendClientMessage(playerid, COLOR_GREY, "You can't afford that ($620).");
		if(PlayerInfo[playerid][pDonateRank] == 3 && PlayerInfo[playerid][pCash] < 700) return SendClientMessage(playerid, COLOR_GREY, "You can't afford that ($700).");
		if(PlayerInfo[playerid][pDonateRank] == 4 && PlayerInfo[playerid][pCash] < 750) return SendClientMessage(playerid, COLOR_GREY, "You can't afford that ($750).");
		GotMats[playerid] = 1;
		if(PlayerInfo[playerid][pDonateRank] ==0)GiveMoney(playerid, -matprice);
		else if(PlayerInfo[playerid][pDonateRank] ==1)GiveMoney(playerid, -560);
		else if(PlayerInfo[playerid][pDonateRank] ==2)GiveMoney(playerid, -620);
		else if(PlayerInfo[playerid][pDonateRank] ==3)GiveMoney(playerid, -700);
		else if(PlayerInfo[playerid][pDonateRank] ==4)GiveMoney(playerid, -750);
		else return SendClientMessage(playerid, COLOR_GREY, "There were an error in the system. Report the bug with code: 025sS2.");
		Packages[playerid] = 10;
		CP[playerid] = CHECKPOINT_MATERIALS_1;
		SetPlayerCheckpointEx(playerid, 2172.1879, -2263.9683, 13.3362, 3.0); //materials factory 1
		format(str, sizeof(str), "* You bought 10 Materials Packages for $%d.", matprice);
		SendClientMessage(playerid, COLOR_LIGHTBLUE, str);
		displayCenterHUDInfo(playerid,  "~w~Deliver ~n~~r~Deliver the Packages", 8); //display for 8 seconds
		PlayerPlaySound(playerid, 1054, 0.0, 0.0, 0.0);
	}
	else if(IsPlayerInRangeOfPoint(playerid, 3.0, 2390.5244,-2008.4646,13.5537)) //materials pickup 2
	{
		if(Packages[playerid] >= 10)
		{
			SendClientMessage(playerid, COLOR_GREY, "You can't hold any more Materials Packages.");
			return 1;
		}
		if(Crates[playerid] > 0)
		{
			SendClientMessage(playerid, COLOR_GREY, "You must finish delivering your Drug Crates.");
			return 1;
		}
		if(GetPlayerVirtualWorld(playerid) != 0)
		{
			SendClientMessage(playerid, COLOR_GREY, "You can't do that while in a Virtual World.");
			SetPlayerHealth(playerid, 0.0);
			return 1;
		}
		if(PlayerInfo[playerid][pDonateRank] == 0 && PlayerInfo[playerid][pCash] < matprice) return SendClientMessage(playerid, COLOR_GREY, "You can't afford that. ($500).");
		if(PlayerInfo[playerid][pDonateRank] == 1 && PlayerInfo[playerid][pCash] < 560) return SendClientMessage(playerid, COLOR_GREY, "You can't afford that ($560).");
		if(PlayerInfo[playerid][pDonateRank] == 2 && PlayerInfo[playerid][pCash] < 620) return SendClientMessage(playerid, COLOR_GREY, "You can't afford that ($620).");
		if(PlayerInfo[playerid][pDonateRank] == 3 && PlayerInfo[playerid][pCash] < 700) return SendClientMessage(playerid, COLOR_GREY, "You can't afford that ($700).");
		if(PlayerInfo[playerid][pDonateRank] == 4 && PlayerInfo[playerid][pCash] < 750) return SendClientMessage(playerid, COLOR_GREY, "You can't afford that ($750).");
		GotMats[playerid] = 1;
		if(PlayerInfo[playerid][pDonateRank] ==0)GiveMoney(playerid, -matprice);
		else if(PlayerInfo[playerid][pDonateRank] ==1)GiveMoney(playerid, -560);
		else if(PlayerInfo[playerid][pDonateRank] ==2)GiveMoney(playerid, -620);
		else if(PlayerInfo[playerid][pDonateRank] ==3)GiveMoney(playerid, -700);
		else if(PlayerInfo[playerid][pDonateRank] ==4)GiveMoney(playerid, -750);
		Packages[playerid] = 10;
		CP[playerid] = CHECKPOINT_MATERIALS_2;
		SetPlayerCheckpointEx(playerid, 2288.1233,-1104.7793,38.4565, 3.0); //materials factory 2
		format(str, sizeof(str), "* You bought 10 Materials Packages for $%d.", matprice);
		SendClientMessage(playerid, COLOR_LIGHTBLUE, str);
		displayCenterHUDInfo(playerid,  "~w~Deliver ~n~~r~Deliver the Packages", 8); //display for 8 seconds
		PlayerPlaySound(playerid, 1054, 0.0, 0.0, 0.0);
	}
	else return SendClientMessage(playerid, COLOR_GREY, "You are not at a Materials Pickup.");
	return 1;
}

CMD:getcrate(playerid, params[])
{
	if(PlayerInfo[playerid][pJob] != 17) return SendClientMessage(playerid, COLOR_GREY, "You are not a Drug Smuggler.");
	if(!IsPlayerInRangeOfPoint(playerid, 3.0, 2411.9382, -2598.7937, 14.2131)) return SendClientMessage(playerid, COLOR_GREY, "You are not at the Drug Factory in the Ocean Docks."); //drug factory
	if(Crates[playerid] == 1) return SendClientMessage(playerid, COLOR_GREY, "You can't carry more than 1 Crate at a time.");
	if(Packages[playerid] > 0) return SendClientMessage(playerid, COLOR_GREY, "You must finish delivering your Materials Packages.");
	if(GetPlayerVirtualWorld(playerid) != 0) return SendClientMessage(playerid, COLOR_GREY, "You can't do that while in a Virtual World.");
	if(PlayerInfo[playerid][pCash] < 1000) return SendClientMessage(playerid, COLOR_GREY, "You can't afford that.");

	GiveMoney(playerid, -crackcprice);
	DrugsLoaded[playerid] = 1;
	GotDrugs[playerid] = 1;
	Crates[playerid] = 1;
	CP[playerid] = CHECKPOINT_UNLOADDRUGS;
	SetPlayerCheckpointEx(playerid, 2341.1091, -1160.8990, 27.1636, 3.0); // drugs house (near drug smuggler /getjob)
	new str[128];
	format(str, sizeof(str), "* You bought a Drug Crate for $%d.", crackcprice);
	SendClientMessage(playerid, COLOR_LIGHTBLUE, str);
	displayCenterHUDInfo(playerid,  "~b~Drug Factory~n~~w~ Deliver the crates", 8); //display for 8 seconds
	PlayerPlaySound(playerid, 1054, 0.0, 0.0, 0.0);
	return 1;
}

CMD:sdtazer(playerid, params[])
{
	if(PlayerInfo[playerid][pMember] == 1 || PlayerInfo[playerid][pMember] == 2 || PlayerInfo[playerid][pMember] == 3 || PlayerInfo[playerid][pMember] == 5 || PlayerInfo[playerid][pMember] == 6 || PlayerInfo[playerid][pMember] == 7 || PlayerInfo[playerid][pMember] == FACTION_SANG || PlayerInfo[playerid][pGroup] == GROUP_S9 || PlayerInfo[playerid][pGroup] == GROUP_HITMAN)
	{
		new str[128];
		if(inPaintball[playerid] > 0) return SendClientMessage(playerid, COLOR_RED, "[WARNING] You are not allowed to use /sdtazer in the paintball.");
        if(PlayerInfo[playerid][pHospital] || IsPlayerRestricted(playerid) || pDeathState[playerid] != PLAYER_STATE_NORMAL) return SendClientMessage(playerid, COLOR_GREY, "{FF0000}Error:{FFFFFF} You cannot use that command whilst you're injured.");
		if(IsAtEvent[playerid] == 1) return SendClientMessage(playerid, COLOR_RED, "[WARNING] You are not allowed to use /sdtazer in an event.");
		if(IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_GREY, "{FF0000}Error:{FFFFFF} You cannot use that command whilst in vehicle");
		if(PlayerHasRod[playerid] == 1) return SendClientMessage(playerid, COLOR_GREY, "You must put your fishing rod away before you unholster your tazer !");
		if(playerHoldingTazer[playerid] == 0)
		{
			playerHoldingTazer[playerid] = 1;
			GivePlayerAdminGun(playerid, 23);
			SetPlayerArmedWeapon(playerid, 23);
			format(str, sizeof(str), "* %s unholsters their pistol tazer.", PlayerICName(playerid));
			ProxDetector(30.0, playerid, str, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
		}
		else if(playerHoldingTazer[playerid] == 1)
		{
			playerHoldingTazer[playerid] = 0;
			TakePlayerWeapon(playerid, 23);

			if(GetPlayerWeapon(playerid) == 16){ TakePlayerWeapon(playerid, 16); }

			format(str, sizeof(str), "* %s holsters their pistol tazer back.", PlayerICName(playerid));
			ProxDetector(30.0, playerid, str, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
		}
		else return SendClientMessage(playerid, COLOR_GRAD1, "You currently have the hand held tazer out! use /handtazer.");
	}
	else return AdmErrorMsg;
	return 1;
}

CMD:pdcctv(playerid, params[]) {
	if(!IsACop(playerid))
		return AdmErrorMsg;

	if(!IsPlayerInRangeOfPoint(playerid, 10.0, -1739, 1045, 19010) && !watchingPDCCTV[playerid] && !PlayerInfo[playerid][pAdmin])
		return SendClientMessage(playerid, COLOR_GREY, "You are not in the CCTV control room.");

	new watchName[50];
	if(sscanf(params, "s[50]", watchName)) {
		SendClientMessage(playerid, COLOR_GRAD2, "{00BFFF}Usage:{FFFFFF} /pdcctv [camera name/off]");
		SendClientMessage(playerid, COLOR_WHITE, "Security camera's: lobby[1-6], reception[1-2], breakroom[1-4], ihallway[1-4], northentrance[1-2], southentrance[1-2], hallway[1-6] ..");
		SendClientMessage(playerid, COLOR_WHITE, ".. pdhall[1-4], range[1-3], classroom[1-2], cells[1-4], training[1-2], chief[1-2], deputychief[1-2], interview[1-2], visitorcentre[1-4] ..");
		SendClientMessage(playerid, COLOR_WHITE, ".. meetingroom[1-2], commander[1-2]");
		return 1;
	}

	if(strcmp(watchName, "off", true) == 0) {
		SetPlayerInterior(playerid, 10);
		SetPlayerVirtualWorld(playerid, 1);
		SetPlayerPos(playerid, -1736.2784, 1045.6595, 19010.9844);
		Timer_FreezePlayer(playerid, FREEZE, ENTER_FREEZE);
		SetCameraBehindPlayer(playerid);
		watchingPDCCTV[playerid] = false;
		SendClientMessage(playerid, COLOR_LIGHTBLUE, "You have stopped watching the PD CCTV.");
		return 1;
	}
	else if(strcmp(watchName, "lobby1", true) == 0) {
		SetPlayerCameraPos(playerid, -2194.9006, 837.4761, 9999.2656 + 3.0);
		SetPlayerCameraLookAt(playerid, -2205.1531, 843.8560, 9999.2656);
		SetPlayerInterior(playerid, 10);
		SetPlayerVirtualWorld(playerid, 10);
	}
	else if(strcmp(watchName, "lobby2", true) == 0) {
		SetPlayerCameraPos(playerid, -2195.3711, 849.1130, 9999.2656 + 3.0);
		SetPlayerCameraLookAt(playerid, -2205.1531, 843.8560, 9999.2656);
		SetPlayerInterior(playerid, 10);
		SetPlayerVirtualWorld(playerid, 10);
	}
	else if(strcmp(watchName, "lobby3", true) == 0) {
		SetPlayerCameraPos(playerid, -2213.4512, 849.5378, 10000.5947 + 3.0);
		SetPlayerCameraLookAt(playerid, -2205.1531, 843.8560, 9999.2656);
		SetPlayerInterior(playerid, 10);
		SetPlayerVirtualWorld(playerid, 10);
	}
	else if(strcmp(watchName, "lobby4", true) == 0) {
		SetPlayerCameraPos(playerid, -2212.8047, 838.0676, 9999.2656 + 3.0);
		SetPlayerCameraLookAt(playerid, -2205.1531, 843.8560, 9999.2656);
		SetPlayerInterior(playerid, 10);
		SetPlayerVirtualWorld(playerid, 10);
	}
	else if(strcmp(watchName, "lobby5", true) == 0) {
		SetPlayerCameraPos(playerid, -2195.1741,831.1974,9999.2852 + 1.0);
		SetPlayerCameraLookAt(playerid, -2197.7964,833.9078,9999.2852);
		SetPlayerInterior(playerid, 10);
		SetPlayerVirtualWorld(playerid, 10);
	}
	else if(strcmp(watchName, "lobby6", true) == 0) {
		SetPlayerCameraPos(playerid, -2199.7219,835.9839,9999.2852 + 1.0);
		SetPlayerCameraLookAt(playerid, -2197.7964,833.9078,9999.2852);
		SetPlayerInterior(playerid, 10);
		SetPlayerVirtualWorld(playerid, 10);
	}
	else if(strcmp(watchName, "reception1", true) == 0) {
		SetPlayerCameraPos(playerid, -2201.6248,831.6694,9999.2852 + 1.0);
		SetPlayerCameraLookAt(playerid, -2207.7883,834.0488,9999.2852);
		SetPlayerInterior(playerid, 10);
		SetPlayerVirtualWorld(playerid, 10);
	}
	else if(strcmp(watchName, "reception2", true) == 0) {
		SetPlayerCameraPos(playerid, -2212.5559,835.6365,9999.2852 + 1.0);
		SetPlayerCameraLookAt(playerid, -2207.7883,834.0488,9999.2852);
		SetPlayerInterior(playerid, 10);
		SetPlayerVirtualWorld(playerid, 10);
	}
	else if(strcmp(watchName, "breakroom1", true) == 0) {
		SetPlayerCameraPos(playerid, -2196.3716,835.7168,10002.7510 + 1.0);
		SetPlayerCameraLookAt(playerid, -2204.0688,833.7182,10003.5684);
		SetPlayerInterior(playerid, 10);
		SetPlayerVirtualWorld(playerid, 10);
	}
	else if(strcmp(watchName, "breakroom2", true) == 0) {
		SetPlayerCameraPos(playerid, -2196.3765,831.8576,10002.7510 + 1.0);
		SetPlayerCameraLookAt(playerid, -2204.0688,833.7182,10003.5684);
		SetPlayerInterior(playerid, 10);
		SetPlayerVirtualWorld(playerid, 10);
	}
	else if(strcmp(watchName, "breakroom3", true) == 0) {
		SetPlayerCameraPos(playerid, -2212.5220,831.8672,10002.7510 + 1.0);
		SetPlayerCameraLookAt(playerid, -2204.0688,833.7182,10003.5684);
		SetPlayerInterior(playerid, 10);
		SetPlayerVirtualWorld(playerid, 10);
	}
	else if(strcmp(watchName, "breakroom4", true) == 0) {
		SetPlayerCameraPos(playerid, -2212.1777,835.2151,10002.7510 + 1.0);
		SetPlayerCameraLookAt(playerid, -2204.0688,833.7182,10003.5684);
		SetPlayerInterior(playerid, 10);
		SetPlayerVirtualWorld(playerid, 10);
	}
	else if(strcmp(watchName, "ihallway1", true) == 0) {
		SetPlayerCameraPos(playerid, -2183.1384,671.9155,29999.2578 + 1.0);
		SetPlayerCameraLookAt(playerid, -2184.3118,673.3903,29999.2578);
		SetPlayerInterior(playerid, 10);
		SetPlayerVirtualWorld(playerid, 10);
	}
	else if(strcmp(watchName, "ihallway2", true) == 0) {
		SetPlayerCameraPos(playerid, -2183.2749,674.8887,29999.2578 + 1.0);
		SetPlayerCameraLookAt(playerid, -2185.7339,675.5837,29999.2539);
		SetPlayerInterior(playerid, 10);
		SetPlayerVirtualWorld(playerid, 10);
	}
	else if(strcmp(watchName, "ihallway3", true) == 0) {
		SetPlayerCameraPos(playerid, -2187.7839,676.1004,29999.2539 + 1.0);
		SetPlayerCameraLookAt(playerid, -2185.7339,675.5837,29999.2539);
		SetPlayerInterior(playerid, 10);
		SetPlayerVirtualWorld(playerid, 10);
	}
	else if(strcmp(watchName, "ihallway4", true) == 0) {
		SetPlayerCameraPos(playerid, -2189.9875,675.8231,29999.2480 + 1.0);
		SetPlayerCameraLookAt(playerid, -2194.2334,675.1637,29996.3906);
		SetPlayerInterior(playerid, 10);
		SetPlayerVirtualWorld(playerid, 10);
	}
	else if(strcmp(watchName, "northentrance1", true) == 0) {
		SetPlayerCameraPos(playerid, -2207.2639,675.1575,9999.2480 + 1.0);
		SetPlayerCameraLookAt(playerid, -2204.9517,678.7458,9999.2480);
		SetPlayerInterior(playerid, 10);
		SetPlayerVirtualWorld(playerid, 10);
	}
	else if(strcmp(watchName, "northentrance2", true) == 0) {
		SetPlayerCameraPos(playerid, -2202.0784,682.3348,9999.2490 + 1.0);
		SetPlayerCameraLookAt(playerid, -2204.9517,678.7458,9999.2480);
		SetPlayerInterior(playerid, 10);
		SetPlayerVirtualWorld(playerid, 10);
	}
	else if(strcmp(watchName, "southentrance1", true) == 0) {
		SetPlayerCameraPos(playerid, -2184.7759,682.1206,9999.2500 + 1.0);
		SetPlayerCameraLookAt(playerid, -2182.0103,678.9568,9999.2480);
		SetPlayerInterior(playerid, 10);
		SetPlayerVirtualWorld(playerid, 10);
	}
	else if(strcmp(watchName, "southentrance2", true) == 0) {
		SetPlayerCameraPos(playerid, -2179.5823,674.8994,9999.2480 + 1.0);
		SetPlayerCameraLookAt(playerid, -2182.0103,678.9568,9999.2480);
		SetPlayerInterior(playerid, 10);
		SetPlayerVirtualWorld(playerid, 10);
	}
	else if(strcmp(watchName, "hallway1", true) == 0) {
		SetPlayerCameraPos(playerid, -2188.2073,685.6133,9999.2461 + 1.0);
		SetPlayerCameraLookAt(playerid, -2187.1963,680.4162,9999.2451);
		SetPlayerInterior(playerid, 10);
		SetPlayerVirtualWorld(playerid, 10);
	}
	else if(strcmp(watchName, "hallway2", true) == 0) {
		SetPlayerCameraPos(playerid, -2187.1829,671.8939,9999.2441 + 1.0);
		SetPlayerCameraLookAt(playerid, -2193.6934,672.5224,9999.2461);
		SetPlayerInterior(playerid, 10);
		SetPlayerVirtualWorld(playerid, 10);
	}
	else if(strcmp(watchName, "hallway3", true) == 0) {
		SetPlayerCameraPos(playerid, -2200.4116,672.1728,9999.2451 + 1.0);
		SetPlayerCameraLookAt(playerid, -2199.6001,678.1775,9999.2461);
		SetPlayerInterior(playerid, 10);
		SetPlayerVirtualWorld(playerid, 10);
	}
	else if(strcmp(watchName, "hallway4", true) == 0) {
		SetPlayerCameraPos(playerid, -2199.3936,681.9821,9999.2490 + 1.0);
		SetPlayerCameraLookAt(playerid, -2200.1128,676.9109,9999.2461);
		SetPlayerInterior(playerid, 10);
		SetPlayerVirtualWorld(playerid, 10);
	}
	else if(strcmp(watchName, "hallway5", true) == 0) {
		SetPlayerCameraPos(playerid, -2187.7322,682.1759,10005.6055 + 1.0);
		SetPlayerCameraLookAt(playerid, -2192.4780,681.5775,10002.3789);
		SetPlayerInterior(playerid, 10);
		SetPlayerVirtualWorld(playerid, 10);
	}
	else if(strcmp(watchName, "hallway6", true) == 0) {
		SetPlayerCameraPos(playerid, -2189.8718,674.8250,9999.2490 + 1.0);
		SetPlayerCameraLookAt(playerid, -2195.1807,675.5056,9995.7441);
		SetPlayerInterior(playerid, 10);
		SetPlayerVirtualWorld(playerid, 10);
	}
	else if(strcmp(watchName, "pdhall1", true) == 0) {
		SetPlayerCameraPos(playerid, 1515.1285,992.1891,20002.4180 + 1.0);
		SetPlayerCameraLookAt(playerid, 1523.2596,1000.3075,20000.9707);
		SetPlayerInterior(playerid, 10);
		SetPlayerVirtualWorld(playerid, 10);
	}
	else if(strcmp(watchName, "pdhall2", true) == 0) {
		SetPlayerCameraPos(playerid, 1515.3373,1007.2783,20002.4180 + 1.0);
		SetPlayerCameraLookAt(playerid, 1523.2596,1000.3075,20000.9707);
		SetPlayerInterior(playerid, 10);
		SetPlayerVirtualWorld(playerid, 10);
	}
	else if(strcmp(watchName, "pdhall3", true) == 0) {
		SetPlayerCameraPos(playerid, 1536.9497,1003.7917,20002.4180 + 1.0);
		SetPlayerCameraLookAt(playerid, 1523.2596,1000.3075,20000.9707);
		SetPlayerInterior(playerid, 10);
		SetPlayerVirtualWorld(playerid, 10);
	}
	else if(strcmp(watchName, "pdhall4", true) == 0) {
		SetPlayerCameraPos(playerid, 1536.9130,995.6707,20002.4180 + 1.0);
		SetPlayerCameraLookAt(playerid, 1523.2596,1000.3075,20000.9707);
		SetPlayerInterior(playerid, 10);
		SetPlayerVirtualWorld(playerid, 10);
	}
	else if(strcmp(watchName, "range1", true) == 0) {
		SetPlayerCameraPos(playerid, 638.6300,1196.4585,19999.0078 + 1.0);
		SetPlayerCameraLookAt(playerid, 640.0083,1203.2472,19999.0078);
		SetPlayerInterior(playerid, 10);
		SetPlayerVirtualWorld(playerid, 10);
	}
	else if(strcmp(watchName, "range2", true) == 0) {
		SetPlayerCameraPos(playerid, 640.3500,1210.9076,19999.0078 + 1.0);
		SetPlayerCameraLookAt(playerid, 637.9573,1204.7377,19999.0078);
		SetPlayerInterior(playerid, 10);
		SetPlayerVirtualWorld(playerid, 10);
	}
	else if(strcmp(watchName, "range3", true) == 0) {
		SetPlayerCameraPos(playerid, 635.9122,1196.6862,19999.0156 + 1.0);
		SetPlayerCameraLookAt(playerid, 629.4274,1203.3196,19999.0078);
		SetPlayerInterior(playerid, 10);
		SetPlayerVirtualWorld(playerid, 10);
	}
	else if(strcmp(watchName, "classroom1", true) == 0) {
		SetPlayerCameraPos(playerid, 1428.5245,2362.1665,9999.2500 + 1.0);
		SetPlayerCameraLookAt(playerid, 1424.7708,2358.6121,9999.2500);
		SetPlayerInterior(playerid, 10);
		SetPlayerVirtualWorld(playerid, 10);
	}
	else if(strcmp(watchName, "classroom2", true) == 0) {
		SetPlayerCameraPos(playerid, 1421.6503,2355.1406,9999.2500 + 1.0);
		SetPlayerCameraLookAt(playerid, 1424.7708,2358.6121,9999.2500);
		SetPlayerInterior(playerid, 10);
		SetPlayerVirtualWorld(playerid, 10);
	}
	else if(strcmp(watchName, "training1", true) == 0) {
		SetPlayerCameraPos(playerid, 1991.8910,2234.7529,9001.0859 + 2.0);
		SetPlayerCameraLookAt(playerid, 1997.4098,2243.8499,9001.0859);
		SetPlayerInterior(playerid, 10);
		SetPlayerVirtualWorld(playerid, 10);
	}
	else if(strcmp(watchName, "training2", true) == 0) {
		SetPlayerCameraPos(playerid, 2004.5945,2251.4368,9001.0859 + 2.0);
		SetPlayerCameraLookAt(playerid, 1997.4098,2243.8499,9001.0859);
		SetPlayerInterior(playerid, 10);
		SetPlayerVirtualWorld(playerid, 10);
	}
	else if(strcmp(watchName, "chief1", true) == 0) {
		SetPlayerCameraPos(playerid, 1559.7275,-1679.4202,62.4216 + 1.0);
		SetPlayerCameraLookAt(playerid, 1565.5474,-1675.5798,62.4216);
		SetPlayerInterior(playerid, 0);
		SetPlayerVirtualWorld(playerid, 1);
	}
	else if(strcmp(watchName, "chief2", true) == 0) {
		SetPlayerCameraPos(playerid, 1570.2179,-1671.8938,62.4206 + 1.0);
		SetPlayerCameraLookAt(playerid, 1565.5474,-1675.5798,62.4216);
		SetPlayerInterior(playerid, 0);
		SetPlayerVirtualWorld(playerid, 1);
	}
	else if(strcmp(watchName, "deputychief1", true) == 0) {
		SetPlayerCameraPos(playerid, 1559.7275,-1679.4202,62.4216 + 1.0);
		SetPlayerCameraLookAt(playerid, 1565.5474,-1675.5798,62.4216);
		SetPlayerInterior(playerid, 0);
		SetPlayerVirtualWorld(playerid, 2);
	}
	else if(strcmp(watchName, "deputychief2", true) == 0) {
		SetPlayerCameraPos(playerid, 1570.2179,-1671.8938,62.4206 + 1.0);
		SetPlayerCameraLookAt(playerid, 1565.5474,-1675.5798,62.4216);
		SetPlayerInterior(playerid, 0);
		SetPlayerVirtualWorld(playerid, 2);
	}
	else if(strcmp(watchName, "commander1", true) == 0) {
		SetPlayerCameraPos(playerid, 1559.7275,-1679.4202,62.4216 + 1.0);
		SetPlayerCameraLookAt(playerid, 1565.5474,-1675.5798,62.4216);
		SetPlayerInterior(playerid, 0);
		SetPlayerVirtualWorld(playerid, 3);
	}
	else if(strcmp(watchName, "commander2", true) == 0) {
		SetPlayerCameraPos(playerid, 1570.2179,-1671.8938,62.4206 + 1.0);
		SetPlayerCameraLookAt(playerid, 1565.5474,-1675.5798,62.4216);
		SetPlayerInterior(playerid, 0);
		SetPlayerVirtualWorld(playerid, 3);
	}
	else if(strcmp(watchName, "interview1", true) == 0) {
		SetPlayerCameraPos(playerid, -1895.3286,-1976.8623,9999.2510 + 1.0);
		SetPlayerCameraLookAt(playerid, -1893.4800,-1975.4288,9999.2510);
		SetPlayerInterior(playerid, 10);
		SetPlayerVirtualWorld(playerid, 10);
	}
	else if(strcmp(watchName, "interview2", true) == 0) {
		SetPlayerCameraPos(playerid, -1891.6520,-1972.2003,9999.2510 + 1.0);
		SetPlayerCameraLookAt(playerid, -1893.4800,-1975.4288,9999.2510);
		SetPlayerInterior(playerid, 10);
		SetPlayerVirtualWorld(playerid, 10);
	}
	else if(strcmp(watchName, "visitorcentre1", true) == 0) {
		SetPlayerCameraPos(playerid, -1097.2747,-945.3013,39999.2969 + 1.0);
		SetPlayerCameraLookAt(playerid, -1093.4115,-944.6501,39999.7969);
		SetPlayerInterior(playerid, 10);
		SetPlayerVirtualWorld(playerid, 10);
	}
	else if(strcmp(watchName, "visitorcentre2", true) == 0) {
		SetPlayerCameraPos(playerid, -1089.6659,-942.6491,39999.2969 + 1.0);
		SetPlayerCameraLookAt(playerid, -1093.4115,-944.6501,39999.7969);
		SetPlayerInterior(playerid, 10);
		SetPlayerVirtualWorld(playerid, 10);
	}
	else if(strcmp(watchName, "visitorcentre3", true) == 0) {
		SetPlayerCameraPos(playerid, -1089.7083,-950.7468,39999.2969 + 1.0);
		SetPlayerCameraLookAt(playerid, -1093.8798,-948.7925,39999.2969);
		SetPlayerInterior(playerid, 10);
		SetPlayerVirtualWorld(playerid, 10);
	}
	else if(strcmp(watchName, "visitorcentre4", true) == 0) {
		SetPlayerCameraPos(playerid, -1097.2716,-948.1333,39999.2969 + 1.0);
		SetPlayerCameraLookAt(playerid, -1093.8798,-948.7925,39999.2969);
		SetPlayerInterior(playerid, 10);
		SetPlayerVirtualWorld(playerid, 10);
	}
	else if(strcmp(watchName, "cells1", true) == 0) {
		SetPlayerCameraPos(playerid, -1112.5077,-940.8301,29999.2480 + 1.0);
		SetPlayerCameraLookAt(playerid, -1115.6938,-945.0039,29999.2480);
		SetPlayerInterior(playerid, 10);
		SetPlayerVirtualWorld(playerid, 10);
	}
	else if(strcmp(watchName, "cells2", true) == 0) {
		SetPlayerCameraPos(playerid, -1118.5940,-949.9542,29999.2480 + 1.0);
		SetPlayerCameraLookAt(playerid, -1115.6938,-945.0039,29999.2480);
		SetPlayerInterior(playerid, 10);
		SetPlayerVirtualWorld(playerid, 10);
	}
	else if(strcmp(watchName, "cells3", true) == 0) {
		SetPlayerCameraPos(playerid, -1114.9211,-937.3802,29999.2480 + 1.0);
		SetPlayerCameraLookAt(playerid, -1116.3842,-939.3708,29999.2480);
		SetPlayerInterior(playerid, 10);
		SetPlayerVirtualWorld(playerid, 10);
	}
	else if(strcmp(watchName, "cells4", true) == 0) {
		SetPlayerCameraPos(playerid, -1116.3246,-953.4129,29999.2480 + 1.0);
		SetPlayerCameraLookAt(playerid, -1114.7020,-951.2482,29999.2480);
		SetPlayerInterior(playerid, 10);
		SetPlayerVirtualWorld(playerid, 10);
	}
	else if(strcmp(watchName, "meetingroom1", true) == 0) {
		SetPlayerCameraPos(playerid, -1738.9769,1048.3790,29010.9844 + 1.0);
		SetPlayerCameraLookAt(playerid, -1736.7620,1045.6794,29012.0332);
		SetPlayerInterior(playerid, 10);
		SetPlayerVirtualWorld(playerid, 10);
	}
	else if(strcmp(watchName, "meetingroom2", true) == 0) {
		SetPlayerCameraPos(playerid, -1734.5846,1043.2177,29010.9844 + 1.0);
		SetPlayerCameraLookAt(playerid, -1736.7620,1045.6794,29012.0332);
		SetPlayerInterior(playerid, 10);
		SetPlayerVirtualWorld(playerid, 10);
	}
	else return SendClientMessage(playerid, COLOR_GREY, "Invalid camera name.");

	TogglePlayerControllable(playerid, 0);
	watchingPDCCTV[playerid] = true;
	SetTimerEx("Timer_bringPlayerToCam", 1000, false, "i", playerid);
	return 1;
}

CMD:handtazer(playerid, params[])
{
	new str[128];

	if(PlayerInfo[playerid][pMember] == 1 || PlayerInfo[playerid][pMember] == 2 || PlayerInfo[playerid][pMember] == 3 || PlayerInfo[playerid][pMember] == 5 || PlayerInfo[playerid][pMember] == 6  || PlayerInfo[playerid][pMember] == 7 || PlayerInfo[playerid][pMember] == FACTION_SANG || PlayerInfo[playerid][pGroup] == GROUP_S9 || PlayerInfo[playerid][pGroup] == GROUP_HITMAN)
	{
		if(inPaintball[playerid] > 0) return SendClientMessage(playerid, COLOR_RED, "[WARNING] You are not allowed to use /sdtazer in the paintball.");
        if(PlayerInfo[playerid][pHospital] || IsPlayerRestricted(playerid) || pDeathState[playerid] != PLAYER_STATE_NORMAL) return SendClientMessage(playerid, COLOR_GREY, "{FF0000}Error:{FFFFFF} You cannot use that command whilst you're injured.");
		if(IsAtEvent[playerid] == 1) return SendClientMessage(playerid, COLOR_RED, "[WARNING] You are not allowed to use /sdtazer in an event.");

		if(PlayerHasRod[playerid] == 1) return SendClientMessage(playerid, COLOR_GREY, "You must put your fishing rod away before you unholster your tazer !");

		if(playerHoldingTazer[playerid] == 0)
		{
			playerHoldingTazer[playerid] = 2;
			SetPlayerAttachedObject(playerid, INDEX_7, 18642, 6, 0.06, 0.01, 0.08, 180.0, 0.0, 0.0);
			SetPlayerArmedWeapon(playerid, 0);
			format(str, sizeof(str), "* %s unholsters their hand held tazer.", PlayerICName(playerid));
			ProxDetector(30.0, playerid, str, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
		}
		else if(playerHoldingTazer[playerid] == 2)
		{
			playerHoldingTazer[playerid] = 0;
			RemovePlayerAttachedObject(playerid, INDEX_7);
			format(str, sizeof(str), "* %s holsters their hand held tazer back.", PlayerICName(playerid));
			ProxDetector(30.0, playerid, str, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
		}
		else return SendClientMessage(playerid, COLOR_GRAD1, "You currently have the pistol tazer out! use /sdtazer.");
	}
	else return AdmErrorMsg;
	return 1;
}

CMD:taxi(playerid, params[])
{
	if(PlayerInfo[playerid][pMember] == 10)
	{
		if(IsPlayerInRangeOfPoint(playerid, 3.0, 1782.8840, -1933.6039, 13.6108))
		{
			ShowPlayerDialog(playerid, DIALOG_TAXI, DIALOG_STYLE_LIST, "Taxi Lockers", "Uniforms\nWeapons", "Select", "Cancel");
		}
		else return SendClientMessage(playerid, COLOR_GREY, "You're not near to the lockers.");
	}
	else return SendClientMessage(playerid, COLOR_GREY, "You're not a taxi member (faction).");
	return 1;
}

CMD:legend(playerid, params[])
{
	if(gPlayerLogged[playerid] == 0) return SendClientMessage(playerid, COLOR_WHITE, "You are not logged in!");

	ShowPlayerDialog(playerid, DIALOG_UNUSED, DIALOG_STYLE_MSGBOX, "Legend", "{FFFFFF}Normal Players\n{2641fe}San Andreas Police Department\n{8D8Dff}Federal Bureau of Investigation\n{FC97C0}San Andreas Fire and Medical Department\n{260059}Department of Corrections\n{696969}San Andreas Government\n{BA6103}Judicial Department\n{006699}San Andreas Network\n{E4D00A}Taxi Driver\n{800080}VIP Members\n{F4A419}Prisoner", "Close", "");
	return 1;
}

CMD:sapd(playerid, params[])
{
	if(PlayerInfo[playerid][pMember] == FACTION_SAPD || PlayerInfo[playerid][pMember] == FACTION_SASD)
	{
		if(IsPlayerNearSAPDHQ(playerid))
		{
			ShowPlayerDialog(playerid, DIALOG_LEO_MAIN, DIALOG_STYLE_LIST, GetPlayerFactionName(playerid), "Duty\nUndercover\nChange Uniform\nArmory\nSWAT\nClear Suspect\nRelease Suspect", "Select", "Cancel");
		}
		else return SendClientMessage(playerid, COLOR_GRAD2, "You are not in your locker room.");
	}
	else return SendClientMessage(playerid, COLOR_GREY, "You are not a Cop.");
	return 1;
}

CMD:sas(playerid, params[])
{
	if(PlayerInfo[playerid][pMember] == 15 || PlayerInfo[playerid][pGroup] == GROUP_S9)
	{
		if(IsPlayerInRangeOfPoint(playerid, 3, 414, 2537, 10))
		{
			ShowPlayerDialog(playerid, DIALOG_SAS_MAIN, DIALOG_STYLE_LIST, GetPlayerFactionName(playerid), "Duty\nChange Uniform\nKevlar + Health($5,0000)\nColt45 ($1,000)", "Select", "Cancel");
		}
		else return SendClientMessage(playerid, COLOR_GRAD2, "You are not in your locker room.");
	}
	else return SendClientMessage(playerid, COLOR_GREY, "You are not SAS.");
	return 1;
}

CMD:sasd(playerid, params[]) return cmd_sapd(playerid, params);

CMD:govlocker(playerid, params[])
{
	if(IsASenate(playerid))
	{
		if(IsPlayerInRangeOfPoint(playerid, 3, -2109.0344, 748.9362, 9008.7012)) // Custom interior
		{
			ShowPlayerDialog(playerid, DIALOG_SENATE_MAIN, DIALOG_STYLE_LIST, "Government", "Duty\nChange Uniform\nArmory", "Select", "Cancel"); // Senate Locker
		}
		else return SendClientMessage(playerid, COLOR_GRAD2, "You are not at your locker in city hall.");
	}
	else return SendClientMessage(playerid, COLOR_GREY, "You are not a member of the Government.");
	return 1;
}

CMD:jd(playerid, params[])
{
	if(PlayerInfo[playerid][pMember] != FACTION_JD)
		return AdmErrorMsg;

	if(
		IsPlayerInRangeOfPoint(playerid, 5.0, 208.7923, 145.9888, 1003.0234) ||
		IsPlayerInRangeOfPoint(playerid, 5.0, -2578.3757, 183.4767, 8500.6064)
	) return ShowPlayerDialog(playerid, DIALOG_HC_MAIN, DIALOG_STYLE_LIST, "Judicial Department", "Duty\nChange uniform\nArmory", "Select", "Cancel");

	SendClientMessage(playerid, COLOR_GREY, "You are not at your locker in the Court House.");
	return 1;
}

CMD:san(playerid, params[])
{
	if(PlayerInfo[playerid][pMember] == 9 || PlayerInfo[playerid][pLeader] == 9)
	{
		if(IsPlayerInRangeOfPoint(playerid, 3, 751.12, -1366.62, 9053.50))
		{
			ShowPlayerDialog(playerid, SANEWSLOCKER, DIALOG_STYLE_LIST, "SAN", "Duty\nChange Uniform\nGear\n", "Select", "Cancel");
		}
		else return SendClientMessage(playerid, COLOR_GREY, "You are not in your locker room.");
	}
	else return SendClientMessage(playerid, COLOR_GREY, "You are not a member of the SA News.");
	return 1;
}

CMD:safmd(playerid, params[])
{
	if(IsAMedic(playerid))
	{
		if(IsPlayerInRangeOfPoint(playerid, 5, 1190.5627,-1345.5804,1093.8661))
		{
			ShowPlayerDialog(playerid, DIALOG_LSFMD_MAIN, DIALOG_STYLE_LIST, "SAFMD", "Duty\nChange Uniform\nOff Duty\nGear", "Select", "Cancel");
		}
		else return SendClientMessage(playerid, COLOR_GRAD2, "You are not at the first aid room.");
	}
	else return SendClientMessage(playerid, COLOR_GREY, "You are not a Paramedic / Fireman.");
	return 1;
}

CMD:doc(playerid, params[])
{
	if(!IsANG(playerid))
		return 1;

	if(	!IsPlayerInRangeOfPoint(playerid, 4, 409.6481, 2255.6724, 9002.6348) ||
		GetPlayerVirtualWorld(playerid) != DOC_WORLD ||
		GetPlayerInterior(playerid) != DOC_INT
	) return SendClientMessage(playerid, COLOR_GRAD2, "You are not at the locker.");

	ShowPlayerDialog(playerid, DIALOG_PG_MAIN, DIALOG_STYLE_LIST, "DoC locker", "Duty\nEquipment\nClear Suspect\nUniform\nSWAT", "Select", "Cancel");
	return 1;
}

CMD:sang(playerid, params[])
{
	if(PlayerInfo[playerid][pMember] != FACTION_SANG) return AdmErrorMsg;

	if(!IsPlayerInRangeOfPoint(playerid, 3, -219.9993, 1406.8696, 27.7656)) return SendClientMessage(playerid, COLOR_GRAD2, "You are not at your locker.");

	ShowPlayerDialog(playerid, DIALOG_SANG_MAIN, DIALOG_STYLE_LIST, "SANG locker", "Duty\nEquipment\nClear Suspect\nUniform\nCivilians Clothes Menu", "Select", "Cancel");
	return 1;
}

// Command for old fbi | new DEA lockers //
CMD:fbi(playerid, params[])
{
	if(IsAFBI(playerid))
	{
		if(IsPlayerNearFBIHQ(playerid))
		{
			new bool: Admin;
			foreach( new i: Player )
			{
				if(PlayerInfo[i][pAdmin] > 0)
				{
					Admin = true;
					break;
				}
			}
			if(Admin) ShowPlayerDialog(playerid, DIALOG_LEO_MAIN, DIALOG_STYLE_LIST, GetPlayerFactionName(playerid), "Duty\nUndercover\nChange Uniform\nArmory\nSWAT\nClear Suspect\nRelease Suspect\nNamechange ({33AA33}Available{FFFFFF})", "Select", "Cancel");
			else ShowPlayerDialog(playerid, DIALOG_LEO_MAIN, DIALOG_STYLE_LIST, GetPlayerFactionName(playerid), "Duty\nUndercover\nChange Uniform\nArmory\nSWAT\nClear Suspect\nRelease Suspect\nNamechange ({FF0000}Not available{FFFFFF})", "Select", "Cancel");
		}
		else return SendClientMessage(playerid, COLOR_GRAD2, "You are not in your locker room.");
	}
	else return SendClientMessage(playerid, COLOR_GREY, "You are not a member of the FBI.");
	return 1;
}
//----------------------------------------------------------Bugs------------------------------------------------------

CMD:plantbug(playerid, params[])
{
	if(PlayerInfo[playerid][pMember] != 2 && PlayerInfo[playerid][pGroup] != GROUP_S9) return 1;
	new target, Float: z[3], Float: x[3];
	if(sscanf(params, "u", target)) return SendClientMessage(playerid, COLOR_GRAD2, "{00BFFF}Usage:{FFFFFF} /plantbug [playerid/PartOfName]");
	if(PlayerInfo[target][pAdmin] > 1) {
		SendClientMessage(playerid, COLOR_WHITE, "You can't bug an admin");
		new str[128];
		format(str, sizeof(str), "* %s just attempted to plant a bug on you.", PlayerName(playerid));
		SendClientMessage(target, COLOR_WHITE, str);
		return 1;
	}

	if(!IsPlayerConnected(target)) return SendClientMessage(playerid, COLOR_GREY, "Invalid playerid.");
	GetPlayerPos(playerid, z[0], z[1], z[2]);
	if(!IsPlayerInRangeOfPoint(target, 5.0, z[0], z[1], z[2])) return SendClientMessage(playerid, COLOR_GREY, "That player is not near you.");
	SendClientMessage(playerid, -1, "NOTE: Make sure you and the target stand still.");
	GetPlayerPos(target, x[0], x[1], x[2]);
	buggedPos[0][playerid] = z[0];
	buggedPos[1][playerid] = z[1];
	buggedPos[2][playerid] = z[2];
	buggedPos[0][target] = x[0];
	buggedPos[1][target] = x[1];
	buggedPos[2][target] = x[2];
	WireOfferID[target] = playerid;
	return 1;
}

CMD:removebug(playerid, params[])
{
	if(PlayerInfo[playerid][pMember] == 2 || PlayerInfo[playerid][pGroup] == GROUP_S9)
	{
		new toplayerid;
		new str[128];
		if(sscanf(params, "u", toplayerid)) return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /removebug [playerid/PartOfName]");
		{
			if(!IsPlayerConnected(toplayerid)) return SendClientMessage(playerid, COLOR_GREY, "{FF0000}Error:{FFFFFF} That player isn't connected.");
			if(PlayerInfo[toplayerid][pWire] == 1)
			{
				if(IsPlayerInRangeOfPlayer(5.0, playerid, toplayerid) || IsPlayerInAnyVehicle(playerid) && sVehicleInfo[GetDynamicVehicleID(GetPlayerVehicleID(playerid))][v_faction] == 2 && GetVehicleModel(GetPlayerVehicleID(playerid)) == 482)
				{
					if(playerid == toplayerid) return SendClientMessage(playerid, COLOR_GREY, "{FF0000}Error:{FFFFFF} You can't remove your own bug.");
					PlayerInfo[toplayerid][pWire] = 0;
					format(str, sizeof(str), "* You have removed the bug from %s.", PlayerICName(toplayerid));
					SendClientMessage(playerid, COLOR_LIGHTBLUE, str);
				}
				else return SendClientMessage(playerid, COLOR_GREY, "{FF0000}Error:{FFFFFF} You are not near that player or in a survillance vehicle.");
			}
			else return SendClientMessage(playerid, COLOR_GREY, "{FF0000}Error:{FFFFFF} That player is not bugged.");
		}
	}
	// else return SendClientMessage(playerid, COLOR_GREY, "{FF0000}Error:{FFFFFF} You have no access to this command !");
	else return 1;
	return 1;
}

CMD:searchbug(playerid, params[]) //search for a bug on yourself
{
	if(PlayerInfo[playerid][pWire] == 1)
	{
		SendClientMessage(playerid, COLOR_LIGHTBLUE, "You find a small electrical device attached to you, which resembles a surveillance bug.");
		SendClientMessage(playerid, COLOR_LIGHTBLUE, "Use /removemybug to remove it.");
		PlayerInfo[playerid][pWireFound] = 1;
	}
	else SendClientMessage(playerid, COLOR_GREY, "You find nothing.");
	return 1;
}

CMD:removemybug(playerid, params[]) //for removing bugs after searching for them
{
	if(PlayerInfo[playerid][pWireFound] == 1)
	{
		SendClientMessage(playerid, COLOR_LIGHTBLUE, "You have removed the bug from yourself.");
		PlayerInfo[playerid][pWire] = 0;
		PlayerInfo[playerid][pWireFound] = 0;
	}
	else SendClientMessage(playerid, COLOR_GREY, "You can't remove something you haven't found!");
	return 1;
}

//-----------------------------------------------------------------------------------------------------------------------


CMD:pickupbomb(playerid, params[])
{
	if(BombID[playerid] != -1)
	{
		if(IsPlayerInAnyVehicle(playerid))
		{
			new vehid = GetPlayerVehicleID(playerid);
			if(BombID[playerid] == vehid && BombInCar[playerid])
			{
				BombID[playerid] = -1;
				HoldingDetonator[playerid] = 0;
				TakePlayerWeapon(playerid, 40);
				PlayerInfo[playerid][pBombs]++;
				SendClientMessage(playerid, COLOR_LIGHTBLUE, "* You have disarmed the C4.");
			}
			else return SendClientMessage(playerid, COLOR_GREY, "This vehicle does not have a bomb in it.");
		}
		new Float:X, Float:Y, Float:Z;
		GetDynamicObjectPos(BombID[playerid], X, Y, Z);
		if(IsPlayerInRangeOfPoint(playerid, 1.5, X, Y, Z))
		{
			SetPlayerFacingObject(playerid, BombID[playerid]);
			ApplyAnimationEx(playerid, "BOMBER", "BOM_Plant_2Idle", 4.0, 0, 0, 0, 0, 0);
			if(BombID[playerid]) { DestroyDynamicObjectEx(BombID[playerid]); }
			BombID[playerid] = -1;
			HoldingDetonator[playerid] = 0;
			TakePlayerWeapon(playerid, 40);
			PlayerInfo[playerid][pBombs]++;
			SendClientMessage(playerid, COLOR_LIGHTBLUE, "* You have disarmed the C4.");
		}
		else return SendClientMessage(playerid, COLOR_GREY, "You are not near your C4.");
	}
	else return SendClientMessage(playerid, COLOR_GREY, "You haven't planted a C4 yet.");
	return 1;
}

CMD:plantbomb(playerid, params[])
{
	if(PlayerInfo[playerid][pBombs] == 0) return SendClientMessage(playerid, COLOR_GRAD2, "You don't have any C4 Explosives.");
	if(PlayerInfo[playerid][pHospital] != 0 || PlayerTied[playerid] != 0 || PlayerCuffed[playerid] != 0 || PlayerTazed[playerid] != 0 || PlayerFrozen[playerid] != 0 || IsFishing[playerid] != 0)
	{
		SendClientMessage(playerid, COLOR_GREY, "You can't do that at this time.");
		return 1;
	}
	if(IsPlayerInAnyVehicle(playerid))
	{
		BombInCar[playerid] = 1;
		BombID[playerid] = GetPlayerVehicleID(playerid);
	}
	else
	{
		new Float:X, Float:Y, Float:Z, Float:A;
		ApplyAnimationEx(playerid, "BOMBER", "BOM_Plant", 4.0, 0, 0, 0, 0, 0);
		GetPlayerPos(playerid, X, Y, Z);
		GetPlayerFacingAngle(playerid, A);
		if(BombID[playerid]) { DestroyDynamicObjectEx(BombID[playerid]); }
		X += (1 * floatsin(-A, degrees));
		Y += (1 * floatcos(-A, degrees));
		BombID[playerid] = CreateDynamicObject(1654, X, Y, Z -0.9, 0, 90, 0);
		Streamer_Update(playerid);
		BombInCar[playerid] = 0;
	}
	ResetPlayerWeapons(playerid);
	GivePlayerGun(playerid, 40);
	PlayerInfo[playerid][pBombs]--;
	SendClientMessage(playerid, COLOR_LIGHTBLUE, "* You have placed the C4, the device is now armed.");
	return 1;
}

CMD:poisonmeal(playerid, params[]) return cmd_poisonfood(playerid, params);

CMD:poisonfood(playerid, params[])
{
	if(PlayerInfo[playerid][pPoison] > 0)
	{
		for(new i = 0; i < foodTrays; i++)
		{
			new Float:objX, Float:objY, Float:objZ;
			GetDynamicObjectPos(foodTray[i][0], objX, objY, objZ);

			if(IsPlayerInRangeOfPoint(playerid, 1.6, objX, objY, objZ))
			{
				if(foodTray[i][2] > TRAY_EMPTY)
				{ //if the tray has food on it
					foodTray[i][4]  = TRAY_POISONED; //poisoned
					OnePlayAnim(playerid, "BOMBER", "BOM_Plant", 4.0, 0, 0, 0, 0, 0);
					SendClientMessage(playerid, COLOR_LIGHTBLUE, "* You have placed poison in the food.");
				}
				break;
			}
		}
	}
	else
	{
		SendClientMessage(playerid, COLOR_GREY, "You do not have any poison !");
	}
	return 1;
}



CMD:arrest(playerid, params[])
{
	new str[128];
	if(IsACop(playerid) || PlayerInfo[playerid][pMember] == 7 || PlayerInfo[playerid][pMember] == FACTION_SANG)
	{
		if(IsAtArrestPoint(playerid))
		{
			new suspect, price, minutes, bail, bprice;
			if(sscanf(params, "uiiii", suspect, price, minutes, bail, bprice)) return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /arrest [playerid/name] [price] [minutes] [bail (0 - 1)] [bprice]");
			{
				if(price < 1 || price > 20000) return SendClientMessage(playerid, COLOR_GREY, "Price can't be below $1 or above $20,000.");
				if(minutes < 1 || minutes > 60) return SendClientMessage(playerid, COLOR_GREY, "Minutes can't be below 1 or above 60.");
				if(bail < 0 || bail > 1) return SendClientMessage(playerid, COLOR_GREY, "Bail can't be below 0 or above 1.");
				if(bprice < 0 || bprice > 1000000) return SendClientMessage(playerid, COLOR_GREY, "Bail Price can't be below $0 or above $1,000,000.");
				if(IsPlayerConnected(suspect))
				{
					if(GetDistanceBetweenPlayers(playerid, suspect) < 5)
					{
						if(PlayerInfo[suspect][pWantedLevel] < 1)
						{
							SendClientMessage(playerid, COLOR_GREY, "Player must be at least Wanted Level 1.");
							return 1;
						}
      					new query[128];
						mysql_format(sqlGameConnection, query, sizeof(query), "UPDATE `newcrimes` SET `CrimeEnabled` = 0 WHERE `CrimePID` = '%e'", PlayerInfo[suspect][pID]);
						mysql_pquery(sqlGameConnection, query);
						format(str, sizeof(str), "* You arrested %s.", PlayerICName(suspect));
						SendClientMessage(playerid, COLOR_LIGHTBLUE, str);
						format(str, sizeof(str), "You were arrested by %s, $%d", PlayerICName(playerid), price);
						SendClientMessage(suspect, COLOR_LIGHTRED, str);
						GiveMoney(suspect, -price);
						//SetPlayerPos(suspect, -1116.11, -946.57 ,29999.24);
						ClearGuns(suspect);
						ResetPlayerWeapons(suspect);
						isBOLO[suspect] = 0;
     					if(PlayerInfo[playerid][pMember] ==1 || PlayerInfo[playerid][pMember] == 2 || PlayerInfo[playerid][pMember] ==3 || PlayerInfo[playerid][pMember] == 7) //police
						{
							format(str, sizeof(str), "Dispatch: %s %s arrested suspect %s, over", GetPlayerRank(playerid), PlayerICName(playerid), PlayerICName(suspect));
							SendRadioMessage(1, TEAM_BLUE_COLOR, str);
							SendRadioMessage(2, TEAM_BLUE_COLOR, str);
							SendRadioMessage(3, TEAM_BLUE_COLOR, str);
							SendRadioMessage(5, TEAM_BLUE_COLOR, str);
						}

						PlayerInfo[suspect][pVirtualWorld] = 191991;
						SetPlayerVirtualWorld(suspect, PlayerInfo[suspect][pVirtualWorld]);
						PlayerInfo[suspect][pInt] = 247;
						SetPlayerInterior(suspect, PlayerInfo[suspect][pInt]);

						new rand = random(sizeof(prisoncells));
						PrisonCell[suspect] = rand;
						SetPlayerPos(suspect, prisoncells[rand][0], prisoncells[rand][1], prisoncells[rand][2]);
						Timer_FreezePlayer(suspect, FREEZE, ENTER_FREEZE);
						SetCameraBehindPlayer(suspect);
						TogglePlayerControllable(suspect, true);
						PlayerInfo[suspect][pJailTime] = minutes * 60;
						PlayerInfo[suspect][pJailed] = 1;
						SetPlayerSpawn(suspect);
						//SetPlayerPos(suspect, -1116.11, -946.57 ,29999.24);
						if(bail == 1)
						{
							JailPrice[suspect] = bprice;
							format(str, sizeof(str), "* You are jailed for %d seconds, Bail: $%d.", PlayerInfo[suspect][pJailTime], JailPrice[suspect]);
							SendClientMessage(suspect, COLOR_LIGHTBLUE, str);
						}
						else
						{
							JailPrice[suspect] = 0;
							format(str, sizeof(str), "* You are jailed for %d seconds, Bail: Unavailable.", PlayerInfo[suspect][pJailTime]);
							SendClientMessage(suspect, COLOR_LIGHTBLUE, str);
						}
						showNewbieTipMessage(suspect, 5); //jailtip
						PlayerInfo[suspect][pArrested] += 1;
						SetPlayerFree(suspect, playerid, "arrested");
						PlayerInfo[suspect][pWantedLevel] = 0;
						SetPlayerToTeamColor(suspect);
						WantLawyer[suspect] = 1;
						OnPlayerSave(suspect);
						Timer_FreezePlayer(suspect, FREEZE, ENTER_FREEZE);
						SetTimerEx("Timer_UncuffSuspect", 5000, false, "i", suspect);
						SetPlayerPos(suspect, -1116.11, -946.57 ,29999.24);
						PlayerInfo[suspect][pVirtualWorld] = 191991;
						SetPlayerVirtualWorld(suspect, PlayerInfo[suspect][pVirtualWorld]);
						PlayerInfo[suspect][pInt] = 247;
						SetPlayerInterior(suspect, PlayerInfo[suspect][pInt]);
						SetPlayerSpawn(suspect);
						SetPlayerSpawn(suspect);
					}
				}
				else return SendClientMessage(playerid, COLOR_GREY, "{FF0000}Error:{FFFFFF} That player isn't connected.");
			}
		}
		else if(IsPlayerInRangeOfPoint(playerid, 10.0, 1423.1179, -1458.7749, 1616.3573)) // At court house
		{
			new suspect, price, minutes, bail, bprice;
			if(sscanf(params, "uiiii", suspect, price, minutes, bail, bprice)) return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /arrest [playerid/name] [price] [minutes] [bail (0 - 1)] [bprice]");
			{
				if(price < 1 || price > 20000) return SendClientMessage(playerid, COLOR_GREY, "Price can't be below $1 or above $20,000.");
				if(minutes < 1 || minutes > 30) return SendClientMessage(playerid, COLOR_GREY, "Minutes can't be below 1 or above 30.");
				if(bail < 0 || bail > 1) return SendClientMessage(playerid, COLOR_GREY, "Bail can't be below 0 or above 1.");
				if(bprice < 0) return SendClientMessage(playerid, COLOR_GREY, "Bail Price can't be below $0.");
				if(IsPlayerConnected(suspect))
				{
					if(GetDistanceBetweenPlayers(playerid, suspect) < 5)
					{
						if(PlayerInfo[suspect][pWantedLevel] < 1)
						{
							SendClientMessage(playerid, COLOR_GREY, "Player must be at least Wanted Level 1.");
							return 1;
						}
						format(str, sizeof(str), "* You arrested %s.", PlayerICName(suspect));
						SendClientMessage(playerid, COLOR_LIGHTBLUE, str);
						format(str, sizeof(str), "You were arrested by %s, $%d", PlayerICName(playerid), price);
						SendClientMessage(suspect, COLOR_LIGHTRED, str);
						GiveMoney(suspect, -price);
						ClearGuns(suspect);
						ResetPlayerWeapons(suspect);
						isBOLO[suspect] = 0;

						if(PlayerInfo[playerid][pMember] ==1 || PlayerInfo[playerid][pMember] == 2 || PlayerInfo[playerid][pMember] ==3 || PlayerInfo[playerid][pMember] == 7) //police
						{
							format(str, sizeof(str), "Dispatch: %s %s arrested suspect %s, over", GetPlayerRank(playerid), PlayerICName(playerid), PlayerICName(suspect));
							SendRadioMessage(1, TEAM_BLUE_COLOR, str);
							SendRadioMessage(2, TEAM_BLUE_COLOR, str);
							SendRadioMessage(3, TEAM_BLUE_COLOR, str);
							SendRadioMessage(5, TEAM_BLUE_COLOR, str);
						}

						PlayerInfo[suspect][pVirtualWorld] = 10;
						SetPlayerVirtualWorld(suspect, PlayerInfo[suspect][pVirtualWorld]);
						PlayerInfo[suspect][pInt] = 10;
						SetPlayerInterior(suspect, PlayerInfo[suspect][pInt]);
						SetPlayerPos(suspect, -1110.17, -941.69, 29999.24);
						PlayerInfo[suspect][pJailCell] = 1;
						SetCameraBehindPlayer(suspect);
						TogglePlayerControllable(suspect, true);
						PlayerInfo[suspect][pJailTime] = minutes * 60;
						PlayerInfo[suspect][pJailed] = 1;
						if(bail == 1)
						{
							JailPrice[suspect] = bprice;
							format(str, sizeof(str), "* You are jailed for %d seconds, Bail: $%d.", PlayerInfo[suspect][pJailTime], JailPrice[suspect]);
							SendClientMessage(suspect, COLOR_LIGHTBLUE, str);
						}
						else
						{
							JailPrice[suspect] = 0;
							format(str, sizeof(str), "* You are jailed for %d seconds, Bail: Unavailable.", PlayerInfo[suspect][pJailTime]);
							SendClientMessage(suspect, COLOR_LIGHTBLUE, str);
						}
						showNewbieTipMessage(suspect, 5); //jailtip
						PlayerInfo[suspect][pArrested] += 1;
						SetPlayerFree(suspect, playerid, "arrested");
						PlayerInfo[suspect][pWantedLevel] = 0;
						SetPlayerToTeamColor(suspect);
						WantLawyer[suspect] = 1;
						isBOLO[suspect] = 0;
						OnPlayerSave(suspect);
						Timer_FreezePlayer(suspect, FREEZE, ENTER_FREEZE);
						SetTimerEx("Timer_UncuffSuspect", 5000, false, "i", suspect);

						new query[128], name[24];
						GetPlayerName(suspect, name, 24);
						mysql_format(sqlGameConnection, query, sizeof(query), "UPDATE `newcrimes` SET `CrimeEnabled` = 0 WHERE `CrimePID` = '%d'", PlayerInfo[suspect][pID]);
						mysql_pquery(sqlGameConnection, query);
					}
				}
				else return SendClientMessage(playerid, COLOR_GREY, "{FF0000}Error:{FFFFFF} That player isn't connected.");
			}
		}

		else return SendClientMessage(playerid, COLOR_GREY, "You are not at an Arrest Point.");
	}
	else return SendClientMessage(playerid, COLOR_GREY, "You are not a Cop / FBI / SASD / Judicial Department.");
	return 1;
}

// Command to hide or show a badge
CMD:badge(playerid, params[]) {
	if(
		PlayerInfo[playerid][pMember] != FACTION_SAPD &&
		PlayerInfo[playerid][pMember] != FACTION_FBI &&
		PlayerInfo[playerid][pMember] != FACTION_JD &&
		PlayerInfo[playerid][pMember] != FACTION_FMD &&
		PlayerInfo[playerid][pMember] != FACTION_SANG

	) return AdmErrorMsg;

	if(!PlayerInfo[playerid][pOnDuty])
		return SendClientMessage(playerid, COLOR_GREY, "You do not have a badge on you.");

	PlayerInfo[playerid][pHidingBadge] = !PlayerInfo[playerid][pHidingBadge];

	if(PlayerInfo[playerid][pHidingBadge]) {
		SendClientMessage(playerid, COLOR_LIGHTBLUE, "* You are now hiding your badge.");
	}
	else SendClientMessage(playerid, COLOR_LIGHTBLUE, "* You are no longer hiding your badge.");

	SetPlayerToTeamColor(playerid);
	return 1;
}

CMD:cuff(playerid, params[])
{
	if(IsACop(playerid) || IsANG(playerid) || PlayerInfo[playerid][pMember] == 6 || PlayerInfo[playerid][pMember] == 7 || PlayerInfo[playerid][pMember] == FACTION_SANG || PlayerInfo[playerid][pGroup] == GROUP_S9 || PlayerInfo[playerid][pGroup] == GROUP_HITMAN)
	{
		new targetid;
		new str[128];
		if(sscanf(params, "u", targetid))return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /cuff [playerid/partofname]");
		{
			if(IsPlayerInAnyVehicle(playerid))return SendClientMessage(playerid, COLOR_GREY, "Cannot use this while in a vehicle.");

			if(IsPlayerConnected(targetid))
			{
				if(IsPlayerNPC(targetid)) return SendClientMessage(playerid, COLOR_WHITE, "You cannot do that!");
                if(PlayerInfo[playerid][pHospital] || IsPlayerRestricted(playerid) || pDeathState[playerid] != PLAYER_STATE_NORMAL) return SendClientMessage(playerid, COLOR_GREY, "{FF0000}Error:{FFFFFF} You cannot use that command whilst you're injured.");
				if(targetid == playerid) return SendClientMessage(playerid, COLOR_GREY, "You can't cuff yourself.");
				if(IsPlayerInRangeOfPlayer(2.0, playerid, targetid))
				{
					if(PlayerTied[targetid] > 0) return SendClientMessage(playerid, COLOR_GREY, "That player is tied up.");
					if(PlayerCuffed[targetid] > 0) return SendClientMessage(playerid, COLOR_GREY, "That player is already cuffed.");
					if(IsPlayerInAnyVehicle(targetid)) return SendClientMessage(playerid, COLOR_GREY, "Suspect is in a car, get him out first.");

					if(GetPlayerSpecialAction(targetid) == SPECIAL_ACTION_HANDSUP)setPlayerCuffed(targetid, 0);
					else if(PlayerTazed[targetid]) setPlayerCuffed(targetid, 0); //freeze player
					else return SendClientMessage(playerid, COLOR_GREY, "That player is not restrained or does not have their hands up.");

					format(str, sizeof(str), "* You were cuffed by officer %s.", PlayerICName(playerid));
					SendClientMessage(targetid, COLOR_LIGHTBLUE, str);
					format(str, sizeof(str), "* You cuffed %s.", PlayerICName(targetid));
					SendClientMessage(playerid, COLOR_LIGHTBLUE, str);
					format(str, sizeof(str), "* %s hand cuffs %s, so he wont go anywhere.", PlayerICName(playerid), PlayerICName(targetid));
					ProxDetector(30.0, playerid, str, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
					displayCenterHUDInfo(targetid,  "~r~Cuffed.", 8); //display for 8 seconds
				}
				else return SendClientMessage(playerid, COLOR_GREY, "That player is not near you.");
			}
			else return SendClientMessage(playerid, COLOR_GREY, "That player is Offline.");
		}
	}
	else return SendClientMessage(playerid, COLOR_GREY, "You are not a Cop / FBI / SASD / NG / Judicial Department member.");
	return 1;
}

CMD:uncuff(playerid, params[])
{
	if(IsACop(playerid) || IsANG(playerid) || PlayerInfo[playerid][pMember] == 6 || PlayerInfo[playerid][pMember] == 7 || PlayerInfo[playerid][pMember] == FACTION_SANG || PlayerInfo[playerid][pAdmin] >= 2 || PlayerInfo[playerid][pGroup] == GROUP_S9 || PlayerInfo[playerid][pGroup] == GROUP_HITMAN)
	{
		new targetid;
		new str[128];
		if(sscanf(params, "u", targetid))return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /uncuff [Playerid/PartOfName]");
		{
			if(IsPlayerConnected(targetid))
			{
				if(targetid != INVALID_PLAYER_ID)
				{
					if(targetid == playerid && PlayerInfo[playerid][pAdmin] <= 1) return SendClientMessage(playerid, COLOR_GREY, "You can't Uncuff yourself.");

					if(IsPlayerInRangeOfPlayer(2.0, playerid, targetid))
					{
						if(PlayerCuffed[targetid])
						{
							if(beingDragged[targetid])return SendClientMessage(playerid, COLOR_GREY, "Stop dragging the player first.");

							format(str, sizeof(str), "* You were Uncuffed by %s.", PlayerICName(playerid));
							SendClientMessage(targetid, COLOR_LIGHTBLUE, str);
							format(str, sizeof(str), "* You uncuffed %s.", PlayerICName(targetid));
							SendClientMessage(playerid, COLOR_LIGHTBLUE, str);
							format(str, sizeof(str), "* %s has uncuffed %s.", PlayerICName(playerid), PlayerICName(targetid));
							ProxDetector(30.0, playerid, str, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
							displayCenterHUDInfo(targetid, "~g~Uncuffed.", 8); //display for 8 seconds
							setPlayerUncuffed(targetid);
						}
						else return SendClientMessage(playerid, COLOR_GREY, "That player isn't Cuffed.");
					}
					else return SendClientMessage(playerid, COLOR_GREY, "That player is not near you.");
				}
			}
			else return SendClientMessage(playerid, COLOR_GREY, "That player is Offline.");
		}
	}
	else return SendClientMessage(playerid, COLOR_GREY, "You are not a Cop / FBI / SASD / NG / Judicial Department Member.");
	return 1;
}

CMD:suspect(playerid, params[]) return SendClientMessage(playerid, COLOR_LIGHTRED, "Please use the new MDC system - /mdc");

CMD:su(playerid, params[]) return cmd_suspect(playerid, params);

CMD:addpoint(playerid, params[])
{
	if(IsACop(playerid))
	{
		new targetid;
		new str[128];
		if(sscanf(params, "u", targetid)) return SendClientMessage(playerid,  COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /addpoint [playerid/PartOfName]");
		if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, COLOR_GREY, "That player is not connected.");
		if(PlayerInfo[targetid][pCarLicense] != 1) return SendClientMessage(playerid, COLOR_GREY, "That player doesn't have a driver license.");
		if(IsACop(targetid)) return SendClientMessage(playerid, COLOR_GREY, "That player can not be given driver points.");

		format(str, sizeof(str), "%s has gave you a driver point.", PlayerICName(playerid));
		SendClientMessage(targetid, COLOR_LIGHTBLUE, str);
		format(str, sizeof(str), "You have given %s a driver point.", PlayerICName(targetid));
		SendClientMessage(playerid, COLOR_LIGHTBLUE, str);
		PlayerInfo[targetid][pDriverPoints] ++;
		if(PlayerInfo[targetid][pDriverPoints] >= 3)
		{
			SendClientMessage(targetid, COLOR_LIGHTBLUE, "You have reached 3 driver points and therefore your driver license was automatically revoked.");
			PlayerInfo[targetid][pDriverPoints] = 0; // reset the points
			PlayerInfo[targetid][pCarLicense] = 0; // revoke the license
			SendClientMessage(playerid, COLOR_LIGHTBLUE, "The point you have given to that player has resulted in their license being revoked.");
		}
	}
	return 1;
}

CMD:speedgun(playerid, params[])
{
	if(IsACop(playerid))
	{
		new str[128];
		SendClientMessage(playerid, COLOR_LIGHTBLUE, "~~~~~~~~~~\t\tVehicles Speed in Area\t\t~~~~~~~~~~");
		for(new i = 0; i <= GetPlayerPoolSize(); i++)
		{
			if(IsPlayerInRangeOfPlayer(20.0, playerid, i))
			{
				if(IsPlayerInAnyVehicle(i) && i != playerid && GetPlayerVehicleSeat(i) == 0)
				{
					format(str, sizeof(str), "Vehicle:\t%s\tSpeed:\t%d", GetVehicleFriendlyName(GetPlayerVehicleID(i)), GetVehicleSpeed(GetPlayerVehicleID(i)));
					SendClientMessage(playerid, COLOR_YELLOW, str);
				}
			}
		}
	}

	return 1;
}

CMD:trunk(playerid, params[])
{
	if(inPaintball[playerid] > 0) return SendClientMessage(playerid, COLOR_GRAD1, "You cannot use that command at this time.");
	if(IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You must be OUTSIDE of the vehicle in order to do this.");
	if(IsPlayerInAnyVehicle(playerid) && GetPlayerState(playerid) != 2)
	{
		SendClientMessage(playerid, COLOR_GREY, "You can't open the trunk from a passenger seat");
		return 1;
	}
	new check = 0;
	IsByVehTrunk[playerid] = -1;
	for(new i = 0; i < MAX_VEHICLES; i++) //check if player by any trunk - jacob
	{
		new Float:vtpos[4];
		GetVehiclePos(i, vtpos[0], vtpos[1], vtpos[2]);
		GetVehicleZAngle(i, vtpos[3]);
		new Float:vtinfo[3];
		GetVehicleModelInfo(GetVehicleModel(i), VEHICLE_MODEL_INFO_SIZE, vtinfo[0], vtinfo[1], vtinfo[2]);
		new Float:distance = (vtinfo[1]/2 + 0.5);
		vtpos[0] += (distance * -floatsin(-vtpos[3], degrees));
		vtpos[1] += (distance * -floatcos(-vtpos[3], degrees));
		if(IsPlayerInRangeOfPoint(playerid, 1.7, vtpos[0], vtpos[1], vtpos[2]))
		{
			IsByVehTrunk[playerid] = i;
		}
	}
	if(IsAPlane(IsByVehTrunk[playerid]) || IsABike(IsByVehTrunk[playerid]) || IsAHelicopter(IsByVehTrunk[playerid]) || IsATrain(IsByVehTrunk[playerid]) || IsABoat(IsByVehTrunk[playerid]) || IsABus(IsByVehTrunk[playerid]) || GetVehicleModel(GetPlayerVehicleID(IsByVehTrunk[playerid])) == 523)
	{
		SendClientMessage(playerid, COLOR_GREY, "This vehicle doesn't have a trunk.");
		return 1;
	}
	if(IsByVehTrunk[playerid] == -1) return SendClientMessage(playerid, COLOR_GREY, "You are not by any vehicles.");
	if(gCarLock[IsByVehTrunk[playerid]] == 1) return SendClientMessage(playerid, COLOR_GREY, "That vehicle's trunk is locked.");
	for(new i = 0; i < sizeof(CreatedCars); i++)
	{
		if(CreatedCars[i] == IsByVehTrunk[playerid])
		{
			check = 1;
			break;
		}
	}
	if(check == 1) return SendClientMessage(playerid, COLOR_RED, "This vehicle trunk is not available.");
	ShowPlayerDialog(playerid, TRUNKDIALOG, DIALOG_STYLE_LIST, "Trunk", "Open / Close\nCheck\nPut stuff\nTake stuff", "Ok", "Cancel"); //Trunk
	return 1;
}


CMD:admins(playerid, params[])
{
	SendClientMessage(playerid, COLOR_WHITE, "Admins Online:");

	if(minutesOnline[playerid] < 30 && PlayerInfo[playerid][pConnectTime] < 1) return 1; //stop hackers viewing admins online

	new str[128];
	if(PlayerInfo[playerid][pAdmin] == 0)
	{
		new alevel[500];
		foreach(new i:Player)
		{
			if(PlayerInfo[i][pAdmin] >= 1 && PlayerInfo[i][pStealthed] == 0 && !PlayerInfo[i][pHiddenAss])
			{
				if(PlayerInfo[i][pAdmin] == 1)
				{
					alevel = "Probationary Administrator";
				}
				if(PlayerInfo[i][pAdmin] == 2)
				{
					alevel = "Junior Administrator";
				}
				if(PlayerInfo[i][pAdmin] == 3)
				{
					alevel = "General Administrator";
				}
				if(PlayerInfo[i][pAdmin] >= 4 && PlayerInfo[i][pAdmin] <= 1336)
				{
					alevel = "Senior Administrator";
				}
				if(PlayerInfo[i][pAdmin] >= 1337 && PlayerInfo[i][pAdmin] <= 99998)
				{
					alevel = "Head Administrator";
				}
				if(PlayerInfo[i][pAdmin] >= 99999)
				{
					alevel = "Executive Administrator";
				}
				if(PlayerInfo[i][pAdmin] == 1999999998)
				{
					alevel = "Co-Owner";
				}
				if(PlayerInfo[i][pAdmin] == 1999999999)
				{
					alevel = "Community Director";
				}
				if(ADuty[i])
				{
					if(PlayerPaused[i]) format(str, sizeof(str), "{FFFFFF}[{E9CF8D}Paused{FFFFFF}] {AFAFAF}%s: %s [{00FF00}On-Duty{AFAFAF}]", alevel, PlayerOOCName(i));
					else format(str, sizeof(str), "{FFFFFF}[{00FF00}Available{FFFFFF}] {AFAFAF}%s: %s [{00FF00}On-Duty{AFAFAF}]", alevel, PlayerOOCName(i));
					SendClientMessage(playerid, COLOR_GREY, str);
				} else {
					if(PlayerPaused[i]) format(str, sizeof(str), "{FFFFFF}[{E9CF8D}Paused{FFFFFF}] {AFAFAF}%s: %s [{f45342}Off-Duty{AFAFAF}]", alevel, PlayerOOCName(i));
					else format(str, sizeof(str), "{FFFFFF}[{00FF00}Available{FFFFFF}] {AFAFAF}%s: %s [{f45342}Off-Duty{AFAFAF}]", alevel, PlayerOOCName(i));
					SendClientMessage(playerid, COLOR_GREY, str);
				}
			}
		}
	}
	else if(PlayerInfo[playerid][pAdmin] > 0 && PlayerInfo[playerid][pAdmin] < 1339 && !PlayerInfo[playerid][pHiddenAss])
	{
		new dif = 0;
		new plvl = 0;
		new tlvl = 0;
		foreach( new i: Player )
		{
			if(PlayerInfo[i][pAdmin] > 0)
			{
				plvl = PlayerInfo[playerid][pAdmin];
				tlvl = PlayerInfo[i][pAdmin];
				dif = (tlvl -=plvl);
				if(dif < 4 || PlayerInfo[i][pStealthed] == 0)
				{
					new alevel[50];
					if(PlayerInfo[i][pAdmin] == 1)
					{
						alevel = "Probationary Administrator";
					}
					if(PlayerInfo[i][pAdmin] == 2)
					{
						alevel = "Junior Administrator";
					}
					if(PlayerInfo[i][pAdmin] == 3)
					{
						alevel = "General Administrator";
					}
					if(PlayerInfo[i][pAdmin] >= 4 && PlayerInfo[i][pAdmin] <= 1336)
					{
						alevel = "Senior Administrator";
					}
					if(PlayerInfo[i][pAdmin] >= 1337 && PlayerInfo[i][pAdmin] <= 99998)
					{
						alevel = "Head Administrator";
					}
					if(PlayerInfo[i][pAdmin] >= 99999)
					{
						alevel = "Executive Administrator";
					}
					if(PlayerInfo[i][pAdmin] >= 199999999)
					{
						alevel = "Community Director";
					}
					if(ADuty[i])
					{
						if(PlayerPaused[i]) format(str, sizeof(str), "{FFFFFF}[{E9CF8D}Paused{FFFFFF}] {AFAFAF}%s: %s [{00FF00}On-Duty{AFAFAF}]", alevel, PlayerOOCName(i));
						else format(str, sizeof(str), "{FFFFFF}[{00FF00}Available{FFFFFF}] {AFAFAF}%s: %s [{00FF00}On-Duty{AFAFAF}]", alevel, PlayerOOCName(i));
						SendClientMessage(playerid, COLOR_GREY, str);
					} else {
						if(PlayerPaused[i]) format(str, sizeof(str), "{FFFFFF}[{E9CF8D}Paused{FFFFFF}] {AFAFAF}%s: %s [{f45342}Off-Duty{AFAFAF}]", alevel, PlayerOOCName(i));
						else format(str, sizeof(str), "{FFFFFF}[{00FF00}Available{FFFFFF}] {AFAFAF}%s: %s [{f45342}Off-Duty{AFAFAF}]", alevel, PlayerOOCName(i));
						SendClientMessage(playerid, COLOR_GREY, str);
					}
					//SendClientMessage(playerid, COLOR_GREY, str); This SCM is literally useless, it'd send everything double, lol
				}
			}
		}
	}
	else if(PlayerInfo[playerid][pAdmin] > 1339 && !PlayerInfo[playerid][pHiddenAss])
	{
		foreach( new i: Player )
		{
			if(PlayerInfo[i][pAdmin] > 0)
			{
				new alevel[50];
				if(PlayerInfo[i][pAdmin] == 1)
				{
					alevel = "Probationary Administrator";
				}
				if(PlayerInfo[i][pAdmin] == 2)
				{
					alevel = "Junior Administrator";
				}
				if(PlayerInfo[i][pAdmin] == 3)
				{
					alevel = "General Administrator";
				}
				if(PlayerInfo[i][pAdmin] >= 4 && PlayerInfo[i][pAdmin] <= 1336)
				{
					alevel = "Senior Administrator";
				}
				if(PlayerInfo[i][pAdmin] >= 1337 && PlayerInfo[i][pAdmin] <= 99998)
				{
					alevel = "Head Administrator";
				}
				if(PlayerInfo[i][pAdmin] >= 99999)
				{
					alevel = "Executive Administrator";
				}
				if(PlayerInfo[i][pAdmin] >= 199999999)
				{
					alevel = "Community Director";
				}
				if(ADuty[i])
				{
					if(PlayerPaused[i]) format(str, sizeof(str), "{FFFFFF}[{E9CF8D}Paused{FFFFFF}] {AFAFAF}%s: %s [{00FF00}On-Duty{AFAFAF}]", alevel, PlayerOOCName(i));
					else format(str, sizeof(str), "{FFFFFF}[{00FF00}Available{FFFFFF}] {AFAFAF}%s: %s [{00FF00}On-Duty{AFAFAF}]", alevel, PlayerOOCName(i));
					SendClientMessage(playerid, COLOR_GREY, str);
				} else {
					if(PlayerPaused[i]) format(str, sizeof(str), "{FFFFFF}[{E9CF8D}Paused{FFFFFF}] {AFAFAF}%s: %s [{f45342}Off-Duty{AFAFAF}]", alevel, PlayerOOCName(i));
					else format(str, sizeof(str), "{FFFFFF}[{00FF00}Available{FFFFFF}] {AFAFAF}%s: %s [{f45342}Off-Duty{AFAFAF}]", alevel, PlayerOOCName(i));
					SendClientMessage(playerid, COLOR_GREY, str);
				}
			}
		}
	}
	return 1;
}

CMD:withdraw(playerid, params[])
{
	if(!IsPlayerAtBankingPoint(playerid))
		return SendClientMessage(playerid, COLOR_GREY, "You are not at a bank counter.");

	new amount;
	new str[128];
	if(sscanf(params, "i", amount))
	{
		SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /withdraw [amount]");
		format(str, sizeof(str), "You have $%d in your bank account.", PlayerInfo[playerid][pAccount]);
		SendClientMessage(playerid, COLOR_GRAD3, str);
		return 1;
	}
	else
	{
		if(amount > PlayerInfo[playerid][pAccount] || amount < 1) return SendClientMessage(playerid, COLOR_GRAD2, "You don't have that much.");
		GiveMoney(playerid, amount);
		PlayerInfo[playerid][pAccount] = PlayerInfo[playerid][pAccount] -amount;
		format(str, sizeof(str), "You have withdrawn $%d from your bank account. Total: $%d.", amount, PlayerInfo[playerid][pAccount]);
		SendClientMessage(playerid, COLOR_YELLOW, str);
	}
	return 1;
}

CMD:payday(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] < 99999) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command.");
	PayDay();
	return 1;
}

CMD:signcheck(playerid, params[])
{
	if(PlayerInfo[playerid][pCheck] == 1)
	{
		new num;
		if(sscanf(params, "i", num)) return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /signcheck [check number]");
		if(num == CheckNumber[playerid])
		{
			SendPayCheck(playerid);
		}
		else return SendClientMessage(playerid, COLOR_GREY, "Invalid check number.");
	}
	else return SendClientMessage(playerid, COLOR_GREY, "You don't have a check ready to pick up.");
	return 1;
}

CMD:bank(playerid, params[])
{
	if(!IsPlayerAtBankingPoint(playerid))
		return SendClientMessage(playerid, COLOR_GREY, "You are not at the bank counter.");

	new amount;
	new str[128];
	if(sscanf(params, "i", amount))
	{
		SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /bank [amount]");
		format(str, sizeof(str), "You have $%d in your bank account.", PlayerInfo[playerid][pAccount]);
		SendClientMessage(playerid, COLOR_GRAD3, str);
		return 1;
	}

	if(amount > PlayerInfo[playerid][pCash] || amount < 1)
		return SendClientMessage(playerid, COLOR_GRAD2, "You don't have that much.");

	GiveMoney(playerid, -amount);
	new curfunds = PlayerInfo[playerid][pAccount];
	PlayerInfo[playerid][pAccount] = amount +PlayerInfo[playerid][pAccount];
	SendClientMessage(playerid, COLOR_WHITE, "Bank Statement:");
	format(str, sizeof(str), "Old Balance: $%d", curfunds);
	SendClientMessage(playerid, COLOR_GRAD2, str);
	format(str, sizeof(str), "Deposit: $%d", amount);
	SendClientMessage(playerid, COLOR_GRAD4, str);
	format(str, sizeof(str), "New Balance: $%d", PlayerInfo[playerid][pAccount]);
	SendClientMessage(playerid, COLOR_WHITE, str);
	return 1;
}

CMD:deposit(playerid, params[])
	return cmd_bank(playerid, params);

CMD:atm(playerid, params[])
{
	if(!IsAtATM(playerid)) return SendClientMessage(playerid, COLOR_GRAD2, "You are not at an ATM machine.");
	new str[128];
	showNewbieTipMessage(playerid, 2); //atm tip
	new atmstring[128];
	format(atmstring, sizeof(atmstring), "You have a total of $%d in your bank account\nType below the amount of money you want to withdraw:", PlayerInfo[playerid][pAccount]);
	ShowPlayerDialog(playerid, 59, DIALOG_STYLE_INPUT, "ATM", atmstring, "Withdraw", "Cancel");
	format(str, sizeof(str), "* %s presses a button and checks their balance.", PlayerICName(playerid));
	ProxDetector(30.0, playerid, str, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
	return 1;
}

CMD:ipod(playerid, params[])
{
	if(PlayerInfo[playerid][piPod] == 1)
	{
		DisplayDialogForPlayer(playerid, 108);
	}
	else return SendClientMessage(playerid, COLOR_GREY, "You don't have an iPod.");
	return 1;
}

CMD:dice(playerid, params[])
{
	new dice = random(6) +1;
	new str[128];
	if(PlayerInfo[playerid][pDice] == 1)
	{
		format(str, sizeof(str), "* %s throws a dice that lands on %d.", PlayerICName(playerid), dice);
		ProxDetector(5.0, playerid, str, COLOR_LIGHTGREEN, COLOR_LIGHTGREEN, COLOR_LIGHTGREEN, COLOR_LIGHTGREEN, COLOR_LIGHTGREEN);
	}
	else return SendClientMessage(playerid, COLOR_GREY, "You don't have a dice.");
	return 1;
}

CMD:flipcoin(playerid, params[])
{
	if(PlayerInfo[playerid][pCash] > 0)
	{
		new str[128];
		switch(random(2))
		{
			case 1:
			{
				format(str, sizeof(str), "* %s flips a coin that lands on Tails.", PlayerICName(playerid));
				GiveMoney(playerid, -1);
				ProxDetector(5.0, playerid, str, COLOR_LIGHTGREEN, COLOR_LIGHTGREEN, COLOR_LIGHTGREEN, COLOR_LIGHTGREEN, COLOR_LIGHTGREEN);
			}
			default:
			{
				format(str, sizeof(str), "* %s flips a coin that lands on Heads.", PlayerICName(playerid));
				GiveMoney(playerid, -1);
				ProxDetector(5.0, playerid, str, COLOR_LIGHTGREEN, COLOR_LIGHTGREEN, COLOR_LIGHTGREEN, COLOR_LIGHTGREEN, COLOR_LIGHTGREEN);
			}
		}
	}
	else return SendClientMessage(playerid, COLOR_GREY, "You don't have any money.");
	return 1;
}

CMD:fstats(playerid, params[])
{
	if(PlayerInfo[playerid][pFMember] == 255) return SendClientMessage(playerid, COLOR_GREY, "You are not in a family.");
	new fam = PlayerInfo[playerid][pFMember];
	new str[128];
	format(str, 256, "Family: %s, Money: $%d, Mats: %d, Cannabis: %d, Cocaine: %d, Meth: %d\nPromethazine: %d, Codeine: %d Lean: %d",
		   FamilyInfo[fam][FamilyName], FamilyInfo[fam][FamilyBank], FamilyInfo[fam][FamilyMats], FamilyInfo[fam][FamilyCannabis], FamilyInfo[fam][FamilyCocaine], FamilyInfo[fam][FamilyMeth], FamilyInfo[fam][FamilyPromethazine], FamilyInfo[fam][FamilyCodeine], FamilyInfo[fam][FamilyLean]);
	SendClientMessage(playerid, COLOR_YELLOW2, str);
	format(str, sizeof(str), "Colt45: %d, Shotgun: %d, MP5: %d, AK47: %d, M4: %d, Rifle: %d, Sniper: %d, SPAS12: %d, Deagle: %d, UZI: %d, TEC9: %d",
		   FamilyInfo[fam][Colt45], FamilyInfo[fam][Shotgun], FamilyInfo[fam][MP5],
		   FamilyInfo[fam][AK47], FamilyInfo[fam][M4], FamilyInfo[fam][Rifle], FamilyInfo[fam][Sniper], FamilyInfo[fam][SPAS12], FamilyInfo[fam][Deagle], FamilyInfo[fam][UZI], FamilyInfo[fam][TEC9]);
	SendClientMessage(playerid, COLOR_YELLOW2, str);
	return 1;
}

CMD:afstats(playerid, params[])
{
	//if(!(PlayerInfo[playerid][pAdmin] >= 1337 || PlayerInfo[playerid][pGangDirector])) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command.");
	if(!(PlayerInfo[playerid][pAdmin] >= 1337)) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command.");
	new fam;
	new str[128];
	if(sscanf(params, "i", fam)) return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /afstats [family]");
	if(fam < 1 || fam > 20) return SendClientMessage(playerid, COLOR_GREY, "Family number must be between 1 and 20.");
	format(str, 256, "Family: %s, Money: $%d, Mats: %d, Cannabis: %d, Cocaine: %d, Meth: %d\nPromethazine: %d, Codeine: %d Lean: %d",
		FamilyInfo[fam][FamilyName], FamilyInfo[fam][FamilyBank], FamilyInfo[fam][FamilyMats], FamilyInfo[fam][FamilyCannabis], FamilyInfo[fam][FamilyCocaine], FamilyInfo[fam][FamilyMeth], FamilyInfo[fam][FamilyPromethazine], FamilyInfo[fam][FamilyCodeine], FamilyInfo[fam][FamilyLean]);
	SendClientMessage(playerid, COLOR_YELLOW2, str);
	format(str, sizeof(str), "Colt45: %d, Shotgun: %d, MP5: %d, AK47: %d, M4: %d, Rifle: %d, Sniper: %d, SPAS12: %d, Deagle: %d, UZI: %d, TEC9: %d",
			FamilyInfo[fam][Colt45], FamilyInfo[fam][Shotgun], FamilyInfo[fam][MP5],
			FamilyInfo[fam][AK47], FamilyInfo[fam][M4], FamilyInfo[fam][Rifle], FamilyInfo[fam][Sniper], FamilyInfo[fam][SPAS12], FamilyInfo[fam][Deagle], FamilyInfo[fam][UZI], FamilyInfo[fam][TEC9]);
	SendClientMessage(playerid, COLOR_YELLOW2, str);
	return 1;
}

CMD:preparefood(playerid, params[])
{
	new str[128];
	if(hasFoodTray[playerid])
	{
		format(str, sizeof(str), "* %s has prepared their Meal.", PlayerICName(playerid));
		ProxDetector(30.0, playerid, str, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
		removePlayerFoodTray(playerid);
		Streamer_Update(playerid);
	}
	else return SendClientMessage(playerid, COLOR_GREY, "You are not carrying any food.");
	return 1;
}

CMD:preparemeal(playerid, params[]) return cmd_preparefood(playerid, params);

CMD:eat(playerid, params[])
{
	if(hasFoodTray[playerid])  return SendClientMessage(playerid, COLOR_GREY, "You cannot eat while carrying food.");
	eatFromTray(playerid);
	return 1;
}

CMD:cleanup(playerid, params[])
{
	cleanUpFood(playerid);
	return 1;
}


CMD:buyproducts(playerid, params[])
{
	if(PlayerInfo[playerid][pJob] != 5) return SendClientMessage(playerid, COLOR_GREY, "You are not a product dealer.");
	if(IsPlayerInRangeOfPoint(playerid, 3, 987.8038, -1366.2513, 13.5787))
	{
		new amount;
		new str[128];
		if(sscanf(params, "i", amount)) return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /buyproducts [amount]");
		{
			if(amount < 1 || amount > 500)
			{
				SendClientMessage(playerid, COLOR_GREY, "Cannot buy less than 1 product or more than 500 products.");
				return 1;
			}
			new price = amount * prodprice;
			if(GetMoney(playerid) >= price)
			{
				if(amount + PlayerInfo[playerid][pProducts] > 500) return SendClientMessage(playerid, COLOR_GREY, "You can't hold more than 500 products.");
				format(str, sizeof(str), "* You bought %d products for $%d.", amount, price);
				SendClientMessage(playerid, COLOR_LIGHTBLUE, str);
				SendClientMessage(playerid, COLOR_WHITE, "HINT: You must sell those products to business owners.");
				GiveMoney(playerid, -price);
				PlayerInfo[playerid][pProducts] += amount;
			}
			else return SendClientMessage(playerid, COLOR_GREY, "You don't have enough money.");
		}
	}
	else
	{
		SendClientMessage(playerid, COLOR_GREY, "You are not at the products purchase location.");
		if(CP[playerid] != CHECKPOINT_NONE)
		{
			CP[playerid] = CHECKPOINT_NONE;
			DisablePlayerCheckpointEx(playerid);
		}
		SendClientMessage(playerid, COLOR_GREY, "The products purchase location has been marked on your map.");
		SetPlayerCheckpointEx(playerid, 987.8038, -1366.2513, 13.5787, 4);
		CP[playerid] = CHECKPOINT_BUYPRODUCTS;
		return 1;
	}
	return 1;
}

CMD:buyprod(playerid, params[]) return cmd_buyproducts(playerid, params);

CMD:sellproducts(playerid, params[])
{
	if(PlayerInfo[playerid][pJob] != 5) return SendClientMessage(playerid, COLOR_GREY, "You are not a Product Dealer.");
	new amount, price, targetid;
	new str[128];
	if(sscanf(params, "uii", targetid, amount, price)) return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /sellproducts [playerid/PartOfName] [amount] [price]");
	{
		if(amount < 1 || amount > 500)
		{
			SendClientMessage(playerid, COLOR_GREY, "Product amount can't be lower than 1, or above 500.");
			return 1;
		}
		if(price < 1 || price > 500000)
		{
			SendClientMessage(playerid, COLOR_GREY, "Price can't be lower than $1, or above $500,000.");
			return 1;
		}
		if(amount > PlayerInfo[playerid][pProducts])
		{
			SendClientMessage(playerid, COLOR_GREY, "You don't have that much Products with you.");
			return 1;
		}
		if(IsPlayerConnected(targetid))
		{
			if(targetid != INVALID_PLAYER_ID)
			{
				if(IsPlayerInRangeOfPlayer(8.0, playerid, targetid))
				{
					if(targetid == playerid) return SendClientMessage(playerid, COLOR_GREY, "You can't sell to yourself.");
					format(str, sizeof(str), "* You offered %s to buy %d Products for $%d.", PlayerICName(targetid), amount, price);
					SendClientMessage(playerid, COLOR_LIGHTBLUE, str);
					format(str, sizeof(str), "* Product Dealer %s wants to sell you %d Products for $%d, (type /accept products) to buy.", PlayerICName(playerid), amount, price);
					SendClientMessage(targetid, COLOR_LIGHTBLUE, str);
					ProdOffer[targetid] = playerid;
					ProdPrice[targetid] = price;
					ProdAmount[targetid] = amount;
				}
				else return SendClientMessage(playerid, COLOR_GREY, "That player is not near you.");
			}
		}
		else return SendClientMessage(playerid, COLOR_GREY, "{FF0000}Error:{FFFFFF} That player isn't connected.");
	}
	return 1;
}

CMD:sellprod(playerid, params[]) return cmd_sellproducts(playerid, params);

CMD:unblocknumber(playerid, params[])
{
	new slot;
	new str[128];
	if(sscanf(params, "i", slot)) return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /unblocknumber [slot (1-5 /blocklist)]");
	{
		switch(slot)
		{
			case 1:
			{
				if(Blocked[playerid][Number1] != -1)
				{
					format(str, sizeof(str), "You have unblocked the number %d from slot 1.", Blocked[playerid][Number1]);
					SendClientMessage(playerid, COLOR_YELLOW, str);
					Blocked[playerid][Number1] = -1;
				}
				else return SendClientMessage(playerid, COLOR_GREY, "There is nobody in that slot you have blocked.");
			}
			case 2:
			{
				if(Blocked[playerid][Number2] != -1)
				{
					format(str, sizeof(str), "You have unblocked the number %d from slot 2.", Blocked[playerid][Number2]);
					SendClientMessage(playerid, COLOR_YELLOW, str);
					Blocked[playerid][Number2] = -1;
				}
				else return SendClientMessage(playerid, COLOR_GREY, "There is nobody in that slot you have blocked.");
			}
			case 3:
			{
				if(Blocked[playerid][Number3] != -1)
				{
					format(str, sizeof(str), "You have unblocked the number %d from slot 3.", Blocked[playerid][Number3]);
					SendClientMessage(playerid, COLOR_YELLOW, str);
					Blocked[playerid][Number3] = -1;
				}
				else return SendClientMessage(playerid, COLOR_GREY, "There is nobody in that slot you have blocked.");
			}
			case 4:
			{
				if(Blocked[playerid][Number4] != -1)
				{
					format(str, sizeof(str), "You have unblocked the number %d from slot 4.", Blocked[playerid][Number4]);
					SendClientMessage(playerid, COLOR_YELLOW, str);
					Blocked[playerid][Number4] = -1;
				}
				else return SendClientMessage(playerid, COLOR_GREY, "There is nobody in that slot you have blocked.");
			}
			case 5:
			{
				if(Blocked[playerid][Number5] != -1)
				{
					format(str, sizeof(str), "You have unblocked the number %d from slot 5.", Blocked[playerid][Number5]);
					SendClientMessage(playerid, COLOR_YELLOW, str);
					Blocked[playerid][Number5] = -1;
				}
				else return SendClientMessage(playerid, COLOR_GREY, "There is nobody in that slot you have blocked.");
			}
			default:
				return SendClientMessage(playerid, COLOR_GREY, "Slots are from 1 - 5. Check /blocklist.");
		}
	}
	return 1;
}

CMD:blocknumber(playerid, params[])
{
	if(!CheckBlockedSlots(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You have blocked all 5 numbers.");
	new number;
	new str[128];
	if(sscanf(params, "i", number)) return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /blocknumber [# number]");
	{
		new count =0;
		foreach( new i: Player )
			if(IsPlayerConnected(i))
				if(PlayerInfo[i][pPnumber] == number)
					count =1;
		if(count == 0) return SendClientMessage(playerid, COLOR_GREY, "Nobody with that number is connected.");
		if(Blocked[playerid][Number1] == -1)
		{
			Blocked[playerid][Number1] = number;
		}
		else if(Blocked[playerid][Number2] == -1)
		{
			Blocked[playerid][Number2] = number;
		}
		else if(Blocked[playerid][Number3] == -1)
		{
			Blocked[playerid][Number3] = number;
		}
		else if(Blocked[playerid][Number4] == -1)
		{
			Blocked[playerid][Number4] = number;
		}
		else if(Blocked[playerid][Number5] == -1)
		{
			Blocked[playerid][Number5] = number;
		}
		format(str, sizeof(str), "You have successfully blocked the number \"%d\" from being able to call or SMS you.", number);
		SendClientMessage(playerid, COLOR_YELLOW, str);
	}
	return 1;
}

CMD:blocklist(playerid, params[])
{
	new n1[6], n2[6], n3[6], n4[6], n5[6], numStr[128];
	if(Blocked[playerid][Number1] == -1)n1 = "None";
	else format(n1, sizeof(n1), "#%d", Blocked[playerid][Number1]);
	if(Blocked[playerid][Number2] == -1)n2 = "None";
	else format(n2, sizeof(n2), "#%d", Blocked[playerid][Number2]);
	if(Blocked[playerid][Number3] == -1)n3 = "None";
	else format(n3, sizeof(n3), "#%d", Blocked[playerid][Number3]);
	if(Blocked[playerid][Number4] == -1)n4 = "None";
	else format(n4, sizeof(n4), "#%d", Blocked[playerid][Number4]);
	if(Blocked[playerid][Number5] == -1)n5 = "None";
	else format(n5, sizeof(n5), "#%d", Blocked[playerid][Number5]);
	format(numStr, sizeof(numStr), "%s\n%s\n%s\n%s\n%s", n1, n2, n3, n4, n5);
	ShowPlayerDialog(playerid, DIALOG_UNUSED, DIALOG_STYLE_LIST, "Blocked Numbers", numStr, "Close", "");
	return 1;
}

CMD:sa(playerid, params[])
	return cmd_stopani(playerid, params);

CMD:stopani(playerid, params[])
{
	if(IsPlayerInAnyVehicle(playerid))
		return SendClientMessage(playerid, -1,"{FF0000}Error:{FFFFFF} You cannot /stopani when you are inside a vehicle.");

	if(	PlayerTied[playerid] > 0 ||
		PlayerCuffed[playerid] > 0 ||
		PlayerTazed[playerid] > 0 ||
		pDeathState[playerid] != PLAYER_STATE_NORMAL ||
		IsPlayerFalling(playerid)
	) return SendClientMessage(playerid, COLOR_GREY, "You cannot do that at this time.");

	new str[128];
	if(gettime() < (StopAniTimer[playerid] + 3))
	{
		format(str, sizeof(str), "You have to wait %d seconds before you can use /stopani.", (StopAniTimer[playerid] + 3) - gettime());
		SendClientMessage(playerid, COLOR_GREY, str);
	}
	else
	{
		ClearAnimationsEx(playerid);
		StopAniTimer[playerid] = gettime();
	}
	return 1;
}

CMD:buymeal(playerid, params[])
{
	if(IsPlayerInRangeOfPoint(playerid, 3, 450.2574, -83.6515, 999.5547) || IsPlayerInRangeOfPoint(playerid, 2.0, 2737.5417, -2491.6199, 1299.8378) || IsPlayerInRangeOfPoint(playerid, 2.0, 2737.5415,-2491.6519,1299.8378))
	{
		ShowPlayerDialog(playerid, DIALOG_BUYMEAL, DIALOG_STYLE_LIST, "Meals", "Bread					$2\nApple					$3\nCok O Pops				$5\nMashed Potatoes			$5\nCarrot					$1\nGreen Beans				$4\nPork Roll				$5\nSausage				$7\nChicken				$20", "Purchase", "Cancel");
	}
	else return SendClientMessage(playerid, COLOR_GREY, "You are not near to the canteen of the prison.");
	return 1;
}

CMD:train(playerid, params[])
{
	if(!IsPlayerInRangeOfPoint(playerid, 3, 766.1840, 13.3013, 1000.7027)) return SendClientMessage(playerid, COLOR_GRAD2, "You are not at a trainer.");
	ShowPlayerDialog(playerid, DIALOG_TRAIN, DIALOG_STYLE_LIST, "Gym", "Normal		Free\nBoxing		$50,000\nKung Fu	$50,000\nKneehead	$50,000\nGrabkick	$50,000\nElbow		$50,000", "Learn", "Cancel"); //Training
	return 1;
}

CMD:dropcar(playerid, params[])
{
	if(gPlayerLogged[playerid] > 0)
	{
		if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER) return SendClientMessage(playerid, COLOR_GREY, "You must be driving a vehicle.");
		if(Packages[playerid] > 0) return SendClientMessage(playerid, COLOR_GREY, "You must finish delivering your Materials Packages.");
		if(Crates[playerid] > 0) return SendClientMessage(playerid, COLOR_GREY, "You must finish delivering your Drug Crates !");
		if(PlayerInfo[playerid][pCarTime] == 0)
		{
			// If the player has their owned vehicle spawned, check if the current vehicle is theirs
			if(playerSpawnedVehicle[playerid] > -1) {
				new vehid = GetPlayerVehicleID( playerid );
				if( vehid == PlayerVehicles[playerid][playerSpawnedVehicle[playerid]][pvID] ) {//vehicles.inc
					return SendClientMessage( playerid, COLOR_GREY, "You cannot deliver your own vehicle to the Crane!" );
				}
			}
			PlayerInfo[playerid][pCarTime] = 0;
			displayCenterHUDInfo(playerid,  "~w~Car Selling ~n~~r~Drop the car at the Crane!", 8); //display for 8 seconds
			CP[playerid] = CHECKPOINT_DROPCAR;
			SetPlayerCheckpointEx(playerid, 2696.0520, -2225.8101, 13.2554, 8.0);
		}
		else return SendClientMessage(playerid, COLOR_GREY, "You already sold a car, wait till your reload time is over.");
	}
	else return	SendClientMessage(playerid, COLOR_GREY, "{FF0000}Error:{FFFFFF} You are not logged in.");
	return 1;
}

CMD:dropcartime(playerid, params[])
{
	if(PlayerInfo[playerid][pCarTime] != 0)
	{
		new str[128];
		format(str, sizeof(str), "[Drop Car Time] You must wait %d seconds before you can drop another car.", PlayerInfo[playerid][pCarTime]);
		SendClientMessage(playerid, COLOR_GREEN, str);
	}
	else return SendClientMessage(playerid, COLOR_GREY, "You haven't got a time before you can drop a car again.");
	return 1;
}

CMD:time(playerid, params[])
{
	new year, month, day;
	getdate(year, month, day);

	new hour, minute, second;
	gettime(hour, minute, second);
	hour = FixHour(hour);
	new str[128];
	if(minute < 10)
	{
		if(second < 10)
		{
			if(PlayerInfo[playerid][pJailTime] > 0)
			{
				format(str, sizeof(str), "~y~%02d %s~w~~n~%02d:%02d:%02d~n~Jail Time Left: %02d seconds", day, GetMonthFromInt(month), hour, minute, second, PlayerInfo[playerid][pJailTime]);
			}
			else
			{
				format(str, sizeof(str), "~y~%02d %s~w~~n~%02d:%02d:%02d", day, GetMonthFromInt(month), hour, minute, second);
			}
		}
		else
		{
			if(PlayerInfo[playerid][pJailTime] > 0)
			{
				format(str, sizeof(str), "~y~%02d %s~w~~n~%02d:%02d:%02d~n~Jail Time Left: %02d seconds", day, GetMonthFromInt(month), hour, minute, second, PlayerInfo[playerid][pJailTime]);
			}
			else
			{
				format(str, sizeof(str), "~y~%02d %s~w~~n~%02d:%02d:%02d", day, GetMonthFromInt(month), hour, minute, second);
			}
		}
	}
	else
	{
		if(second < 10)
		{
			if(PlayerInfo[playerid][pJailTime] > 0)
			{
				format(str, sizeof(str), "~y~%02d %s~w~~n~%02d:%02d:%02d~n~Jail Time Left: %02d seconds", day, GetMonthFromInt(month), hour, minute, second, PlayerInfo[playerid][pJailTime]);
			}
			else
			{
				format(str, sizeof(str), "~y~%02d %s~w~~n~%02d:%02d:%02d", day, GetMonthFromInt(month), hour, minute, second);
			}
		}
		else
		{
			if(PlayerInfo[playerid][pJailTime] > 0)
			{
				format(str, sizeof(str), "~y~%02d %s~w~~n~%02d:%02d:%02d~n~Jail Time Left: %02d seconds", day, GetMonthFromInt(month), hour, minute, second, PlayerInfo[playerid][pJailTime]);
			}
			else
			{
				format(str, sizeof(str), "~y~%02d %s~w~~n~%02d:%02d:%02d", day, GetMonthFromInt(month), hour, minute, second);
			}
		}
	}
	displayCenterHUDInfo(playerid,  str, 8); //display for 8 seconds
	if(!IsPlayerInAnyVehicle(playerid))
	{
		ApplyAnimationEx(playerid, "COP_AMBIENT", "Coplook_watch", 4.0, 0, 0, 0, 0, 0);
	}
	return 1;
}

CMD:gotocar(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] >= 2)
	{
		if(GetPlayerState(playerid) == PLAYER_STATE_SPECTATING) return SendClientMessage(playerid, COLOR_GREY, "You can not do that while spectating.");
		new vehid;
		if(sscanf(params, "i", vehid)) return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /gotocar [vehicleid]");
		{

			if(!IsValidVehicle(vehid))
				return SendClientMessage(playerid, -1, "Could not find any vehicle with that ID.");

			new Float:vX, Float:vY, Float:vZ;
			GetVehiclePos(vehid, vX, vY, vZ);
			SetPlayerPos(playerid, vX, vY, vZ +3);
			SetPlayerVirtualWorld(playerid, 0);
			SetPlayerInterior(playerid, 0);
			PlayerInfo[playerid][pInt] = 0;
			PlayerInfo[playerid][pLocal] = 999;
			PlayerInfo[playerid][pVirtualWorld] = 0;
			displayCenterHUDInfo(playerid,  "~r~Teleporting.", 8); //display for 8 seconds
		}
	}
	else return AdmErrorMsg;
	return 1;
}

CMD:gotoobj(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] >= 1337 || PlayerInfo[playerid][pMapper] == MAPPERRANK_MANAGER)
	{
		if(GetPlayerState(playerid) == PLAYER_STATE_SPECTATING) return SendClientMessage(playerid, COLOR_GREY, "You can not do that while spectating.");
		new objid;
		if(sscanf(params, "i", objid)) return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /gotoobj [objectid]");
		{
			new Float:objX, Float:objY, Float:objZ;
			GetObjectPos(objid, objX, objY, objZ);
			SetPlayerPos(playerid, objX, objY, objZ +3);
			displayCenterHUDInfo(playerid,  "~r~Teleporting.", 8); //display for 8 seconds
		}
	}
	else return AdmErrorMsg;
	return 1;
}

CMD:goincar(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] >= 2)
	{
		if(GetPlayerState(playerid) == PLAYER_STATE_SPECTATING) return SendClientMessage(playerid, COLOR_GREY, "You can not do that while spectating.");
		new vehid;
		if(sscanf(params, "i", vehid)) return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /goincar [vehicleid]");
		{
			new Float:vX, Float:vY, Float:vZ;
			GetVehiclePos(vehid, vX, vY, vZ);
			SetPlayerPos(playerid, vX, vY, vZ +3);
			SetPlayerVirtualWorld(playerid, 0);
			SetPlayerInterior(playerid, 0);
			PlayerInfo[playerid][pInt] = 0;
			PlayerInfo[playerid][pLocal] = 999;
			PlayerInfo[playerid][pVirtualWorld] = 0;
			PutPlayerInVehicle(playerid, vehid, 0);
			displayCenterHUDInfo(playerid,  "~r~Teleporting.", 8); //display for 8 seconds
		}
	}
	else return AdmErrorMsg;
	return 1;
}

CMD:ticket(playerid, params[])
{
	if(IsACop(playerid) || IsAJudge(playerid) || IsANG(playerid))
	{
		if(IsACop(playerid) && PlayerInfo[playerid][pOnDuty] == 0)
		{
			SendClientMessage(playerid, COLOR_GREY, "You are not on Duty.");
			return 1;
		}
		new giveplayerid, moneys, result[64];
		new str[128];
		if(sscanf(params, "uis[64]", giveplayerid, moneys, result)) return SendClientMessage(playerid, COLOR_GRAD2, "{00BFFF}Usage:{FFFFFF} /ticket [ID/PartOfName] [Price] [Reason]");
		if(moneys < 1 || moneys > 99999)
		{
			SendClientMessage(playerid, COLOR_GREY, "Ticket Money can't be below 1 or higher then 99999.");
			return 1;
		}
		if(IsPlayerConnected(giveplayerid))
		{
			if(giveplayerid != INVALID_PLAYER_ID)
			{
				if(IsPlayerInRangeOfPlayer(8.0, playerid, giveplayerid))
				{
					strmid(giveplayer, PlayerICName(giveplayerid), 0, MAX_PLAYER_NAME);
					strmid(sendername, PlayerICName(playerid), 0, MAX_PLAYER_NAME);
					format(str, sizeof(str), "* You gave %s a Ticket costing $%d, reason: %s.", giveplayer, moneys, result);
					SendClientMessage(playerid, COLOR_LIGHTBLUE, str);
					format(str, sizeof(str), "* %s %s has given you a Ticket costing $%d, reason: %s.", GetPlayerRank(playerid), sendername, moneys, result);
					SendClientMessage(giveplayerid, COLOR_LIGHTBLUE, str);
					format(str, sizeof(str), "* %s %s writes up a Ticket and gives it to %s.", GetPlayerRank(playerid), sendername, giveplayer);
					ProxDetector(30.0, playerid, str, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
					SendClientMessage(giveplayerid, COLOR_LIGHTBLUE, "* Type /mytickets to view your tickets.");
					AddCrime(playerid, giveplayerid, 1, result);
					AddTicket(playerid, giveplayerid, moneys, result, 0);
					return 1;
				}
				else return SendClientMessage(playerid, COLOR_GREY, "That player is not near you.");
			}
		}
	}
	else return SendClientMessage(playerid, COLOR_GREY, "You are not a Cop / FBI / SASD.");
	return 1;
}

CMD:mytickets(playerid, params[])
{
	if(!IsPlayerConnected(playerid)) return 1;
	new query[128], rows, fields, Date[128], TicketReason[128], Amount, RealName[128], TicketID, Cache:result;
	mysql_format(sqlGameConnection, query, sizeof(query), "SELECT * FROM `tickets` WHERE `TicketPID` = %d AND `Active` = 1 ORDER BY `TicketID`", PlayerInfo[playerid][pID]);
	result = mysql_query(sqlGameConnection, query);
	cache_get_data(rows, fields, sqlGameConnection);
	if(!rows) return SendClientMessage(playerid, COLOR_LIGHTRED, "You have no active tickets.");
	SendClientMessage(playerid, COLOR_LIGHTBLUE, "---[Unpaid Tickets]---");
	new str[128];
	for(new i = 0; i < rows; i++)
	{
		cache_get_field_content(i, "TicketReason", TicketReason);
		cache_get_field_content(i, "IssuerName", RealName);
		cache_get_field_content(i, "Date", Date);
		Amount = cache_get_field_content_int(i, "Amount");
		TicketID = cache_get_field_content_int(i, "TicketID");
		format(str, sizeof(str), "* [ID: %d] (%s) | $%d | %s | %s *", TicketID, Date, Amount, TicketReason, RealName);
		SendClientMessage(playerid, COLOR_LIGHTRED, str);
	}
	cache_delete(Cache:result, sqlGameConnection);
	SendClientMessage(playerid, COLOR_LIGHTBLUE, "TIP: You can use /paidtickets to see the last 20 tickets you've paid.");
	SendClientMessage(playerid, COLOR_LIGHTBLUE, "TIP: Use /payticket [ticketid] to pay the fine.");
	return 1;
}

CMD:paidtickets(playerid, params[])
{
	if(!IsPlayerConnected(playerid)) return 1;
	new query[128], rows, fields, Date[128], TicketReason[128], Amount, RealName[128], TicketID, Cache:result;
	new str[128];
	mysql_format(sqlGameConnection, query, sizeof(query), "SELECT * FROM `tickets` WHERE `TicketPID` = %d AND `Active` = 0 ORDER BY `TicketID` LIMIT 20", PlayerInfo[playerid][pID]);
	result = mysql_query(sqlGameConnection, query);
	cache_get_data(rows, fields, sqlGameConnection);
	if(!rows) return SendClientMessage(playerid, COLOR_LIGHTRED, "You have no paid tickets.");
	SendClientMessage(playerid, COLOR_LIGHTBLUE, "---[Old Tickets]---");
	for(new i = 0; i < rows; i++)
	{
		cache_get_field_content(i, "TicketReason", TicketReason);
		cache_get_field_content(i, "IssuerName", RealName);
		cache_get_field_content(i, "Date", Date);
		Amount = cache_get_field_content_int(i, "Amount");
		TicketID = cache_get_field_content_int(i, "TicketID");
		format(str, sizeof(str), "* [ID: %d] (%s) | $%d | %s | %s *", TicketID, Date, Amount, TicketReason, RealName);
		SendClientMessage(playerid, COLOR_LIGHTGREEN, str);
	}
	cache_delete(Cache:result, sqlGameConnection);
	return 1;
}

CMD:payticket(playerid, params[])
{
	if(!IsPlayerConnected(playerid)) return 1;
	if(!IsPlayerInRangeOfPoint(playerid, 20, 250.01, 67.69, 1003.64)) return SendClientMessage(playerid, COLOR_GREY, "You are not inside the Police Department.");

	new tid, rows, fields, query[128], pid, amount, active, date[128], crimeid, Cache:result;
	if(sscanf(params, "i", tid)) return SendClientMessage(playerid, COLOR_GREY, "Usage: /payticket [ticketid] - use /mytickets to see active tickets.");
	mysql_format(sqlGameConnection, query, sizeof(query), "SELECT * FROM `tickets` WHERE `TicketID` = '%d' LIMIT 1", tid);
	result = mysql_query(sqlGameConnection, query);
	cache_get_data(rows, fields, sqlGameConnection);
	if(!rows) return SendClientMessage(playerid, COLOR_GREY, "There is no ticket with that ID.");
	active = cache_get_field_content_int(0, "Active");
	amount = cache_get_field_content_int(0, "Amount");
	pid = cache_get_field_content_int(0, "TicketPID");
	cache_get_field_content(0, "Date", date);
	if(pid != PlayerInfo[playerid][pID]) return SendClientMessage(playerid, COLOR_GREY, "This is not your ticket.");
	if(!active) return SendClientMessage(playerid, COLOR_GREY, "This ticket has already been paid.");
	if(PlayerInfo[playerid][pCash] < amount) return SendClientMessage(playerid, COLOR_GREY, "You can't afford that.");

	cache_delete(Cache:result, sqlGameConnection);

	new query2[128];
	mysql_format(sqlGameConnection, query2, sizeof(query2), "UPDATE `tickets` SET `Active` = 0 WHERE `TicketID` = '%d'", tid);
	mysql_pquery(sqlGameConnection, query2);
	new str[128];
	format(str, sizeof(str), "* You have paid off ticket #%d for $%d", tid, amount);
	SendClientMessage(playerid, COLOR_LIGHTBLUE, str);

	GiveMoney(playerid, -amount);
	SaveStuff();

	mysql_format(sqlGameConnection, query, sizeof(query), "SELECT * FROM `newcrimes` WHERE `DATE` = '%e' LIMIT 1", date);
	result = mysql_query(sqlGameConnection, query);
	cache_get_data(rows, fields, sqlGameConnection);
	if(!rows) return 1;
	crimeid = cache_get_field_content_int(0, "CrimeID");
	cache_delete(Cache:result, sqlGameConnection);
	mysql_format(sqlGameConnection, query, sizeof(query), "UPDATE `newcrimes` SET `CrimeEnabled` = 0 WHERE `CrimeID` = '%d'", crimeid);
	mysql_pquery(sqlGameConnection, query);
	return 1;
}

CMD:drag(playerid, params[])
{
	if(IsACop(playerid) || PlayerInfo[playerid][pMember] == 7 || PlayerInfo[playerid][pMember] == 5 || PlayerInfo[playerid][pMember] == FACTION_SANG)
	{
		new targetid;
		new str[128];
		if(sscanf(params, "u", targetid)) return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /drag [playerid/name]");
		{
			if(PlayerInfo[targetid][pAdmin] > 1) return SendClientMessage(playerid, COLOR_GREY, "You can't drag an admin.");
			if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, COLOR_GREY, "That player isn't connected.");
			if(IsPlayerNPC(targetid)) return SendClientMessage(playerid, COLOR_WHITE, "You can not drag an NPC!");
			if(targetid == playerid) return SendClientMessage(playerid, -1, "You can not drag yourself!");
			if(GetDistanceBetweenPlayers(playerid, targetid) > 4.0)return SendClientMessage(playerid, COLOR_GREY, "You must be close to the player.");

			if(!PlayerCuffed[targetid]) return SendClientMessage(playerid, COLOR_GREY, "This player must first be cuffed.");
			if(!beingDragged[targetid])
			{
				if(isDragging[playerid] == true) return SendClientMessage(playerid, COLOR_WHITE, "You are already dragging someone else!");
				if(PlayerCuffed[playerid] || beingDragged[playerid]) return SendClientMessage(playerid, COLOR_WHITE, "You can not do that right now!");
				beingDragged[targetid] = true;
				isDragging[playerid] = true;

				format(str, sizeof(str), "You are being dragged by %s.", PlayerICName(playerid));
				SendClientMessage(targetid, COLOR_YELLOW, str);
				format(str, sizeof(str), "You are dragging %s, use /drag again to stop it.", PlayerICName(targetid));
				SendClientMessage(playerid, COLOR_YELLOW, str);

				dragTimer[targetid] = SetTimerEx("Timer_dragTimerActual", 1000, 1, "dd", playerid, targetid);
			}
			else
			{
				beingDragged[targetid] = false;
				isDragging[playerid] = false;

				SendClientMessage(playerid, COLOR_WHITE, "You have stopped dragging your target.");
				SendClientMessage(targetid, COLOR_WHITE, "You aren't being dragged anymore.");

				KillTimer(dragTimer[targetid]);
			}
		}
	}
	else return SendClientMessage(playerid, COLOR_GREY, "You are not a Cop / FBI / SASD.");
	return 1;
}

CMD:dcallsign(playerid, params[])
{
	if(PlayerInfo[playerid][pMember] == 1 || PlayerInfo[playerid][pMember] == 3 || PlayerInfo[playerid][pMember] == 2 || PlayerInfo[playerid][pMember] == 5 || PlayerInfo[playerid][pMember] == 4 || PlayerInfo[playerid][pGroup] == GROUP_S9){
		if(!IsPlayerInAnyVehicle(playerid))return SendClientMessage(playerid, COLOR_GREY, "You're not in a vehicle.");
		if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER)return SendClientMessage(playerid, COLOR_GREY, "You must be the driver.");

		new vehicleid = GetPlayerVehicleID(playerid);

		new
			dynvehID = GetDynamicVehicleID(vehicleid);

		if( sVehicleInfo[dynvehID][v_faction] < 1 ) return SendClientMessage( playerid, COLOR_GREY, "This isn't a faction owned vehicle." );

		Delete3DTextLabel(UnitsCallSign[vehicleid]);
		SendClientMessage(playerid, COLOR_WHITE, "Callsign removed.");
	}
	else return SendClientMessage(playerid, COLOR_GREY, "You are not a member of a government organization.");
	return 1;
}

CMD:mdc(playerid, params[])
{
	if(GetMDCAccessType(playerid) == MDC_ACCESS_NONE) return AdmErrorMsg;
	if(CheckForJammer(playerid)) return SendClientMessage(playerid, COLOR_GREY, "Database unreachable - no signal.");

	if(IsPlayerNearMDC(playerid)) {
		new mdcString[128], accessCode;

		accessCode = PlayerInfo[playerid][pID] + 3450;

		format(mdcString, sizeof(mdcString), "You have logged in to the MDC with your access code: #%i [%s]", accessCode, MDCAccessToStr(GetMDCAccessType(playerid)));
		SendMDCMessage(playerid, mdcString);

		return MDC_MAIN;
	}
	else return SendClientMessage(playerid, COLOR_GREY, "You have no MDC at hand.");
}

CMD:owiretransfer(playerid, params[]) return cmd_otransfer(playerid, params);
CMD:otransfer(playerid, params[])
{
	// Restricted to faction leaders to prevent players spamming and sending a shit ton of queriez
	if(PlayerInfo[playerid][pLeader] == 0) return SendClientMessage(playerid, COLOR_WHITE, "You can't use that command!");
	if(PlayerInfo[playerid][pLevel] < 3) return SendClientMessage(playerid, COLOR_GRAD1, "You must be level 3.");
	if(IsPlayerAtBankingPoint(playerid) || PlayerInfo[playerid][pPnumber] != 0 && PhoneOffline[playerid] == 0)
	{
		new giveplayername[MAX_PLAYER_NAME+1], amount;
		if(sscanf(params, "s[MAX_PLAYER_NAME+1]d", giveplayername, amount)) return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /otransfer [Firstname_Lastname] [amount]");
		{
			if(strcmp(giveplayername, PlayerName(playerid), true) == 0) return SendClientMessage(playerid, COLOR_WHITE, "You can not pay yourself!");
			if(IsPlayerConnected(ReturnUser(giveplayername))) return SendClientMessage(playerid, COLOR_WHITE, "That player is online!");
			new playermoney = PlayerInfo[playerid][pAccount];
			if(amount < 50000) return SendClientMessage(playerid, COLOR_WHITE, "Transfer amount must be greater than or equal to $50,000!");
			if(playermoney < amount) return SendClientMessage(playerid, COLOR_WHITE, "You don't have enough money to do that!");

			new query[50];
			mysql_format(sqlGameConnection, query, sizeof(query), "SELECT `Bank` FROM `players` WHERE `Name` = '%e'", giveplayername);
			mysql_pquery(sqlGameConnection, query, "OfflineTransfer", "dsd", playerid, giveplayername, amount);
		}
	}
	else return SendClientMessage(playerid, COLOR_GREY, "You must be at the bank counter or have an online phone to do this.");
	return 1;
}

CMD:wiretransfer(playerid, params[])
	return cmd_transfer(playerid, params);

CMD:transfer(playerid, params[])
{
	if(PlayerInfo[playerid][pLevel] < 3)
		return SendClientMessage(playerid, COLOR_GRAD1, "You must be level 3 or above to use this.");

	if(PlayerInfo[playerid][pCash] < 0)
		return SendClientMessage(playerid, COLOR_GRAD1, "You must not be in debt to use this.");

	if(PlayerInfo[playerid][pJailed] || PlayerInfo[playerid][pAdminJailed])
		return SendClientMessage(playerid, COLOR_GREY, "You can't use this while you're in prison.");

	if(
		!(IsPlayerAtBankingPoint(playerid)) &&
		!(PlayerInfo[playerid][pPnumber] && !PhoneOffline[playerid])
	) return SendClientMessage(playerid, COLOR_GREY, "You are not at a bank and do not have a cellphone.");

	new targetid, amount;
	if(sscanf(params, "ud", targetid, amount))
		return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /transfer [playerid/PartOfName] [amount]");

	if(!IsPlayerConnected(targetid))
		return SendClientMessage(playerid, COLOR_GREY, "Unknown player.");

	if(targetid == playerid)
		return SendClientMessage(playerid, COLOR_GREY, "You can't transfer money to yourself.");

	if(!gPlayerLogged[targetid])
		return SendClientMessage(playerid, COLOR_GREY, "That player has not logged in.");

	if(amount < 1 || amount > PlayerInfo[playerid][pAccount])
		return SendClientMessage(playerid, COLOR_GREY, "You do not have enough money in your bank account.");

	PlayerInfo[playerid][pAccount] -= amount;
	PlayerInfo[targetid][pAccount] += amount;

	PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
	PlayerPlaySound(targetid, 1052, 0.0, 0.0, 0.0);
	new str[128];
	format(str, sizeof(str), "You have transferred $%s to %s's account.", AddThousandsSeparators(amount), PlayerOOCName(targetid));
	SendClientMessage(playerid, COLOR_ORANGE, str);

	format(str, sizeof(str), "You have received $%s into your account from %s", AddThousandsSeparators(amount), PlayerOOCName(playerid));
	SendClientMessage(targetid, COLOR_ORANGE, str);

	// Logging
	if(amount >= 500000)
	{
		format(str, sizeof(str), "{FF0000}AdmWarning{FFFFFF}: %s transferred $%s to %s", PlayerOOCName(playerid), AddThousandsSeparators(amount), PlayerOOCName(targetid));
		ABroadCast(COLOR_YELLOW, str, 1);
	}
	new year, month, day;
	getdate(year, month, day);

	new hour, minute, second;
	gettime(hour, minute, second);
	hour = FixHour(hour);
	format(str, sizeof(str), "%s transferred $%d to %s at %02d %s %02d:%02d:%02d", PlayerOOCName(playerid), amount, PlayerOOCName(targetid), day, GetMonthFromInt(month), hour, minute, second);
	PayLog(str);
	logswrite("pay.log", str);
	return 1;
}

CMD:armory(playerid, params[]) {
	// Syndicate and CJNG armory
	if(	PlayerInfo[playerid][pGroup] != GROUP_CRIME &&
		PlayerInfo[playerid][pGroup] != GROUP_CARTEL
	) return 1;

	if(	!IsPlayerNearSyndicateHQ(playerid) &&
		!IsPlayerNearCJNGHQ(playerid)
	) return SendClientMessage(playerid, COLOR_CRIME, "You are not at your HQ.");

	showCrimeDialog(playerid);
	return 1;
}

CMD:cjng(playerid, params[])
	return cmd_armory(playerid, params);

CMD:upgrade(playerid, params[])
{
	if(PlayerInfo[playerid][gPupgrade] < 1) return SendClientMessage(playerid, COLOR_GREY, "You don't have any Upgrade Points.");
	new name[24];
	new str[128];
	if(sscanf(params, "s[24]", name))
	{
		SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /upgrade [name]");
		SendClientMessage(playerid, COLOR_GREY, "Available names: Armor, Health");
		format(str, sizeof(str), "* You have %d upgrade points remaining.", PlayerInfo[playerid][gPupgrade]);
		SendClientMessage(playerid, COLOR_LIGHTBLUE, str);
		return 1;
	}
	else
	{
		if(strcmp(name, "armor", true) == 0)
		{
			if(PlayerInfo[playerid][pSHealth] >= 100)
			{
				SendClientMessage(playerid, COLOR_GREY, "Your Armor upgrade is at its limit.");
				return 1;
			}
			PlayerInfo[playerid][pSHealth] = PlayerInfo[playerid][pSHealth] +1;
			PlayerInfo[playerid][gPupgrade]--;
			format(str, sizeof(str), "* You have upgraded your spawn Armor to %d, changes will take effect when you respawn.", PlayerInfo[playerid][pSHealth]);
			SendClientMessage(playerid, COLOR_LIGHTBLUE, str);
			return 1;
		}
		else if(strcmp(name, "health", true) == 0)
		{
			if(PlayerInfo[playerid][pSHP] >= 100)
			{
				SendClientMessage(playerid, COLOR_GREY, "Your Health upgrade is at its limit.");
				return 1;
			}
			PlayerInfo[playerid][pSHP] = PlayerInfo[playerid][pSHP] +1;
			PlayerInfo[playerid][gPupgrade]--;
			format(str, sizeof(str), "* You have upgraded your spawn Health to %d, changes will take effect when you respawn.", PlayerInfo[playerid][pSHP]);
			SendClientMessage(playerid, COLOR_LIGHTBLUE, str);
			return 1;
		}
	}
	return 1;
}

CMD:taxwithdraw(playerid, params[])
{
	if(PlayerInfo[playerid][pMember] != 6) return SendClientMessage(playerid, COLOR_GREY, "You are not a part of the government.");
	if(PlayerInfo[playerid][pRank] < 4) return SendClientMessage(playerid, COLOR_GREY, "Only R4+ can use this.");
	if(!IsPlayerAtBankingPoint(playerid))
		return SendClientMessage(playerid, COLOR_GREY, "You are not at a bank counter.");
	new amount, reason[64];
	new str[128];
	if(sscanf(params, "is[64]", amount, reason))
	{
		SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /taxwithdraw [amount] [reason]");
		format(str, sizeof(str), "There is currently $%d in the Treasury.", TaxValue);
		SendClientMessage(playerid, COLOR_GRAD3, str);
		return 1;
	}
	else
	{
		if(amount > TaxValue || amount < 1) return SendClientMessage(playerid, COLOR_GRAD2, "There is not enough in the Treasury.");
		GiveMoney(playerid, amount);
		TaxValue = TaxValue -amount;
		format(str, sizeof(str), "You have withdrawn $%d from the Treasury, Total: $%d ", amount, TaxValue);
		SendClientMessage(playerid, COLOR_YELLOW, str);
		format(str, sizeof(str), "%s has withdrawn $%d from the Treasury, Total: $%d", PlayerICName(playerid), amount, TaxValue);
		foreach(new i:Player){
			if(PlayerInfo[i][pMember] == 6 && i != playerid)
				SendClientMessage(i, COLOR_YELLOW, str);
		}
		SaveStuff();
	}
	return 1;
}

CMD:helpers(playerid, params[])
{
	SendClientMessage(playerid, COLOR_WHITE, "Helpers Online:");
	new str[128];
	foreach( new i: Player )
	{
		if(IsPlayerConnected(i))
		{
			if(PlayerInfo[i][pHelper] >= 1 && PlayerInfo[i][pStealthed] == 0 && !PlayerInfo[i][pHidingStatus] && !PlayerInfo[i][pHiddenAss])
			{
				new hlevel[50];
				new name[24];
				strmid(name, str_replace('_', ' ', PlayerName(i)), 0, MAX_PLAYER_NAME);
				if(PlayerInfo[playerid][pHelper] != 0)
				{
					if(PlayerInfo[i][pHelper] == 1)
					{
						hlevel = "Trial Helper";
					}
					if(PlayerInfo[i][pHelper] == 2)
					{
						format(hlevel, sizeof(hlevel), "Helper");
					}
					if(PlayerInfo[i][pHelper] == 3)
					{
						format(hlevel, sizeof(hlevel), "Senior Helper");
					}
					if(PlayerInfo[i][pHelper] == 4)
					{
						format(hlevel, sizeof(hlevel), "Head Helper");
					}
					if(PlayerInfo[i][pHelper] >= 5)
					{
						format(hlevel, sizeof(hlevel), "Director of The Helpers Team");
					}
				}
				if(PlayerInfo[playerid][pHelper] == 0)
				{
					if(PlayerInfo[i][pHelper] == 1)
					{
						hlevel = "Trial Helper";
					}
					if(PlayerInfo[i][pHelper] == 2)
					{
						hlevel = "Helper";
					}
					if(PlayerInfo[i][pHelper] == 3)
					{
						hlevel = "Senior Helper";
					}
					if(PlayerInfo[i][pHelper] == 4)
					{
						hlevel = "Head Helper";
					}
					if(PlayerInfo[i][pHelper] >= 5)
					{
						hlevel = "Director of The Helpers Team";
					}
				}
				if(HDuty[i])
				{
					if(PlayerPaused[i])format(str, sizeof(str), "{FFFFFF}[{E9CF8D}Paused{FFFFFF}] {AFAFAF}%s: %s [{00FF00}On-Duty{AFAFAF}]", hlevel, name);
					else format(str, sizeof(str), "{FFFFFF}[{00FF00}Available{FFFFFF}] {AFAFAF}%s: %s [{00FF00}On-Duty{AFAFAF}]", hlevel, name);
					SendClientMessage(playerid, COLOR_GRAD2, str);
				} else
				{
					if(PlayerPaused[i])format(str, sizeof(str), "{FFFFFF}[{E9CF8D}Paused{FFFFFF}] {AFAFAF}%s: %s [{f45342}Off-Duty{AFAFAF}]", hlevel, name);
					else format(str, sizeof(str), "{FFFFFF}[{00FF00}Available{FFFFFF}] {AFAFAF}%s: %s [{f45342}Off-Duty{AFAFAF}]", hlevel, name);
					SendClientMessage(playerid, COLOR_GRAD2, str);
				}
			}
		}
	}
	return 1;
}

CMD:devs(playerid, params[])
{
	SendClientMessage(playerid, COLOR_WHITE, "Developers Online:");
	new devrank[64];
	new str[128];
	foreach( new i: Player )
	{
		if(IsPlayerConnected(i))
		{
			if(PlayerInfo[i][pDev] >= 1 && PlayerInfo[i][pStealthed] == 0 && !PlayerInfo[i][pHidingStatus] && !PlayerInfo[i][pHiddenAss])
			{
				if(PlayerInfo[i][pDev] == DEVRANK_JUNIOR)
				{
					devrank = "Junior Developer";
				}
				if(PlayerInfo[i][pDev] == DEVRANK_SENIOR)
				{
					devrank = "Senior Developer";
				}
				if(PlayerInfo[i][pDev] == DEVRANK_MANAGER)
				{
					devrank = "Development Manager";
				}
				if(PlayerInfo[i][pDev] == DEVRANK_LEAD)
				{
					devrank = "Lead Developer";
				}
				new name[24];
				strmid(name, str_replace('_', ' ', PlayerName(i)), 0, MAX_PLAYER_NAME);

				if(!PlayerInfo[i][pHidingStatus] && !PlayerInfo[i][pHiddenAss]) {
					if(PlayerPaused[i])format(str, sizeof(str), "{FFFFFF}[{E9CF8D}Paused{FFFFFF}] {AFAFAF}%s: %s", devrank, name);
					else format(str, sizeof(str), "{FFFFFF}[{00FF00}Available{FFFFFF}] {AFAFAF}%s: %s", devrank, name);
					SendClientMessage(playerid, COLOR_GRAD2, str);
				}
			}
		}
	}
	return 1;
}

CMD:hidestatus(playerid) {
	if(PlayerInfo[playerid][pDev] >= 1 || PlayerInfo[playerid][pMapper] >= 1 || PlayerInfo[playerid][pTester] >= 1) {
		switch(PlayerInfo[playerid][pHidingStatus])
		{
			case 1:
			{
				PlayerInfo[playerid][pHidingStatus] = 0;
				SendClientMessage(playerid, COLOR_LIGHTBLUE, "You are no longer hiding your status.");
			}
			case 0:
			{
				PlayerInfo[playerid][pHidingStatus] = 1;
				SendClientMessage(playerid, COLOR_LIGHTBLUE, "You are now hiding your status.");
			}
		}

	}
	return 1;
}

CMD:reportbug(playerid, params[])
{
	if(PlayerInfo[playerid][pBugMuted] == 1) return SendClientMessage(playerid, COLOR_GREY, "You are banned from using /reportbug.");
	if(IsPlayerRestricted(playerid) || PlayerFrozen[playerid] != 0) return SendClientMessage(playerid, COLOR_GREY, "You can't do that at this time.");
	if(gettime() - JustBugReported[playerid] <= 45) return SendClientMessage(playerid, COLOR_GREY, "Wait 45 seconds after sending a next bug report.");
	new text[128];
	if(sscanf(params, "s[128]", text)) return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /reportbug [text]");
	{
		JustBugReported[playerid] = gettime();
		HasActiveBugReport[playerid] = 1;
		new str[128];
		format(str, sizeof(str), "Bug Report From [%d]%s: %s", playerid, PlayerOOCName(playerid), text);
		/*#if UseDiscordBot 1
			Discord:sendPlayerRequest(DISCORD_BUG_CHANNEL, playerid, "Bug report by", text, 0x42953F);
		#endif*/
		SendTesterMessage(0x00FF0000, str);
		SendClientMessage(playerid, COLOR_YELLOW, "Your bug report message was sent to the online testers, thank you.");
	}
	return 1;
}

CMD:denybug(playerid, params[])
{
	if(PlayerInfo[playerid][pTester] > TESTERRANK_NONE)
	{
		new targetid, reason[128];
		new str[128];
		if(sscanf(params, "us[128]", targetid, reason)) return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /d(eny)bug [playerid/PartOfName] [Reason]");
		{
			if(!IsPlayerConnected(targetid) || targetid == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_GRAD2, "That player is not logged in/invalid player id");
			if(HasActiveBugReport[targetid] == 1)
			{
				format(str, 256, "** Tester: %s[%d] has denied %s's bug report, reason: %s", PlayerOOCName(playerid), playerid, PlayerOOCName(targetid), reason);
				SendTesterMessage(0x00FF0000, str);
				format(str, 256, "** Tester %s[%d] has denied your bug report, reason: %s", PlayerOOCName(playerid), playerid, reason);
				SendClientMessage(targetid, 0x00FF0000, str);
				HasActiveBugReport[targetid] = 0;
			}
			else return SendClientMessage(playerid, COLOR_GRAD2, "That player did not report any bugs.");
		}
	}
	else return SendClientMessage(playerid, COLOR_GRAD2, "You are not a tester.");
	return 1;
}

CMD:dbug(playerid, params[]) return cmd_denybug(playerid, params);

CMD:acceptbug(playerid, params[])
{
	if(PlayerInfo[playerid][pTester] > TESTERRANK_NONE)
	{
		new targetid;
		if(sscanf(params, "u", targetid)) return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /ac(cept)bug [playerid/PartOfName]");
		{
			if(!IsPlayerConnected(targetid) || targetid == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_GRAD2, "That player is not logged in/invalid player id");
			if(HasActiveBugReport[targetid] == 1)
			{
				new str[128];
				new Float:tx, Float:ty, Float:tz;
				OnABugReport[playerid] = 1;
				new Float:X, Float:Y, Float:Z;
				GetPlayerPos(playerid, X, Y, Z);
				PlayerInfo[playerid][BugReportX] = X;
				PlayerInfo[playerid][BugReportY] = Y;
				PlayerInfo[playerid][BugReportZ] = Z;
				PlayerInfo[playerid][BugReportInterior] = GetPlayerInterior(playerid);
				PlayerInfo[playerid][BugReportVW] = GetPlayerVirtualWorld(playerid);
				format(str, 256, "** Tester: %s[%d] has accepted %s's bug report.", PlayerICName(playerid), playerid, PlayerICName(targetid));
				SendTesterMessage(0x00FF0000, str);
				format(str, 256, "** Tester %s[%d] has accepted your bug report, please remain at your current position.", PlayerICName(playerid), playerid);
				SendClientMessage(targetid, 0x00FF0000, str);
				HasActiveBugReport[targetid] = 0;
				GetPlayerPos(targetid, tx, ty, tz);
				SetPlayerPos(playerid, tx, ty + 0.5, tz + 0.3);
				SetPlayerInterior(playerid, GetPlayerInterior(targetid));
				SetPlayerVirtualWorld(playerid, GetPlayerVirtualWorld(targetid));
				Timer_FreezePlayer(targetid, FREEZE, TESTER_FREEZE);
				PlayerInfo[playerid][pTesterReports]++;
			}
			else return SendClientMessage(playerid, COLOR_GRAD2, "That player did not report any bugs.");
		}
	}
	else return SendClientMessage(playerid, COLOR_GRAD2, "You are not a tester.");
	return 1;
}

CMD:acbug(playerid, params[]) return cmd_acceptbug(playerid, params);

CMD:treturn(playerid, params[])
{
	if(PlayerInfo[playerid][pTester] == TESTERRANK_NONE) return SendClientMessage(playerid, COLOR_GRAD2, "You are not a tester.");
	if(OnABugReport[playerid] == 1)
	{
		OnABugReport[playerid] = 0;
		SetPlayerPos(playerid, PlayerInfo[playerid][BugReportX], PlayerInfo[playerid][BugReportY], PlayerInfo[playerid][BugReportZ]);
		SetPlayerInterior(playerid, PlayerInfo[playerid][BugReportInterior]);
		SetPlayerVirtualWorld(playerid, PlayerInfo[playerid][BugReportVW]);
	}
	else return SendClientMessage(playerid, COLOR_GRAD2, "You are not on a bug report.");
	return 1;
}

CMD:testers(playerid, params[])
{
	SendClientMessage(playerid, COLOR_WHITE, "Testers Online:");
	new str[128];
	foreach( new i: Player )
	{
		if(IsPlayerConnected(i))
		{
			if(PlayerInfo[i][pTester] >= 1 && PlayerInfo[i][pStealthed] == 0)
			{
				new tlevel[50];
				new name[24];
				strmid(name, str_replace('_', ' ', PlayerName(i)), 0, MAX_PLAYER_NAME);
				if(PlayerInfo[playerid][pTester] != 0)
				{
					new treports = PlayerInfo[i][pTesterReports];
					if(PlayerInfo[i][pTester] == TESTERRANK_REGULAR)
					{
						format(tlevel, sizeof(tlevel), "[Count: %d] Regular Tester", treports);
					}
					if(PlayerInfo[i][pTester] == TESTERRANK_SENIOR)
					{
						format(tlevel, sizeof(tlevel), "[Count: %d] Senior Tester", treports);
					}
					if(PlayerInfo[i][pTester] == TESTERRANK_MANAGER)
					{
						format(tlevel, sizeof(tlevel), "[Count: %d] Tester Manager", treports);
					}
				}
				if(PlayerInfo[playerid][pTester] == 0)
				{
					if(PlayerInfo[i][pTester] == 1)
					{
						tlevel = "Regular Tester";
					}
					if(PlayerInfo[i][pTester] == 2)
					{
						tlevel = "Senior Tester";
					}
					if(PlayerInfo[i][pTester] == 3)
					{
						tlevel = "Tester Manager";
					}
				}
				if(!PlayerInfo[i][pHidingStatus] && !PlayerInfo[i][pHiddenAss]) {
					if(PlayerPaused[i])format(str, sizeof(str), "{FFFFFF}[{E9CF8D}Paused{FFFFFF}] {AFAFAF}%s: %s", tlevel, name);
					else format(str, sizeof(str), "{FFFFFF}[{00FF00}Available{FFFFFF}] {AFAFAF}%s: %s", tlevel, name);
					SendClientMessage(playerid, COLOR_GRAD2, str);
				}
			}
		}
	}
	return 1;
}

CMD:mappers(playerid, params[])
{
	SendClientMessage(playerid, COLOR_WHITE, "Mappers Online:");
	new maprank[64];
	new str[128];
	foreach( new i: Player )
	{
		if(IsPlayerConnected(i))
		{
			if(PlayerInfo[i][pMapper] >= 1 && PlayerInfo[i][pStealthed] == 0 && !PlayerInfo[i][pHidingStatus] && !PlayerInfo[i][pHiddenAss])
			{
				if(PlayerInfo[i][pMapper] == MAPPERRANK_REGULAR)
				{
					maprank = "Regular Mapper";
				}
				if(PlayerInfo[i][pMapper] == MAPPERRANK_SENIOR)
				{
					maprank = "Senior Mapper";
				}
				if(PlayerInfo[i][pMapper] == MAPPERRANK_MANAGER)
				{
					maprank = "Mapping Manager";
				}
				if(!PlayerInfo[i][pHidingStatus] && !PlayerInfo[i][pHiddenAss]) {
					new name[24];
					strmid(name, str_replace('_', ' ', PlayerName(i)), 0, MAX_PLAYER_NAME);
					if(PlayerPaused[i])format(str, sizeof(str), "{FFFFFF}[{E9CF8D}Paused{FFFFFF}] {AFAFAF}%s: %s", maprank, name);
					else format(str, sizeof(str), "{FFFFFF}[{00FF00}Available{FFFFFF}] {AFAFAF}%s: %s", maprank, name);
					SendClientMessage(playerid, COLOR_GRAD2, str);
				}
			}
		}
	}
	return 1;
}

CMD:government(playerid, params[])
{
	if(PlayerInfo[playerid][pMuted] == 1) return SendClientMessage(playerid, COLOR_GREY, "You can't use this whilst muted.");
	if(IsACop(playerid) || PlayerInfo[playerid][pMember] == 4 || PlayerInfo[playerid][pLeader] == 4 || PlayerInfo[playerid][pMember] == 6 || PlayerInfo[playerid][pLeader] == 6 || PlayerInfo[playerid][pMember] == 7 || PlayerInfo[playerid][pLeader] == 7 || PlayerInfo[playerid][pMember] == 5 || PlayerInfo[playerid][pLeader] == 5 || PlayerInfo[playerid][pMember] == 14 || PlayerInfo[playerid][pLeader] == 14)
	{
		new str[128];
		if(PlayerInfo[playerid][pMember] == 2)
		{
			if(PlayerInfo[playerid][pRank] < 4) return SendClientMessage(playerid, COLOR_GREY, "You need to be Rank 4 to be able to use this.");
		}
		else if(PlayerInfo[playerid][pMember] == 7)
		{
			if(PlayerInfo[playerid][pRank] < 1) return SendClientMessage(playerid, COLOR_GREY, "You need to be Rank 4 to be able to use this.");
		}
		else if(PlayerInfo[playerid][pMember] == 1 || PlayerInfo[playerid][pMember] == 3)
		{
			if(PlayerInfo[playerid][pRank] < 5) return SendClientMessage(playerid, COLOR_GREY, "You need to be Rank 5 to be able to use this.");
		}
		else if(PlayerInfo[playerid][pMember] == 6){
			if(PlayerInfo[playerid][pRank] < 3) return SendClientMessage(playerid, COLOR_GREY, "You need to be Rank 4 to be able to use this.");
		}
		else if(PlayerInfo[playerid][pMember] == 14){
			if(PlayerInfo[playerid][pRank] < 4) return SendClientMessage(playerid, COLOR_GREY, "You need to be Rank 4 to be able to use this.");
		}
		else
		{
			if(PlayerInfo[playerid][pRank] < 5) return SendClientMessage(playerid, COLOR_GREY, "You need to be Rank 5 to be able to use this.");
		}
		new msg[128];
		if(sscanf(params, "s[128]", msg)) return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} (/gov)ernment [text]");
		{

			SendClientMessageToAll(COLOR_WHITE, "Public Service Announcement:");
			format(str, sizeof(str), "%s %s %s: %s", GetPlayerFactionName(playerid), GetPlayerRank(playerid), PlayerICName(playerid), msg);

			new color = COLOR_DBLUE;
			switch(PlayerInfo[playerid][pMember]) {
				case 2: color = TCOLOR_NAVYBLUE;
				case 3: color = TCOLOR_BEIGE;
				case 4: color = TCOLOR_PARAMEDIC;
				case 5: color = COLOR_DOC_NAMETAG;
				case 6: color = TCOLOR_SENATE;
				case 7: color = TCOLOR_HIGHCOURT;
				case 14: color = COLOR_SANG;
			}

			SendClientMessageToAll(color, str);
		}
	}
	else return SendClientMessage(playerid, COLOR_GREY, "You are not a Cop / FBI / SASD / Fireman / Paramedic / NG Member / Judicial Department / President.");
	return 1;
}

CMD:gov(playerid, params[]) return cmd_government(playerid, params);

CMD:ggovernment(playerid, params[])
{
	if(PlayerInfo[playerid][pMuted] == 1) return SendClientMessage(playerid, COLOR_GREY, "You can't use this whilst muted.");
	if(PlayerInfo[playerid][pGroup] == GROUP_S9)
	{
		new str[128];
		if(PlayerInfo[playerid][pGroup] == 10)
		{
			if(PlayerInfo[playerid][pGroupRank] < 3) return SendClientMessage(playerid, COLOR_GREY, "You need to be Rank 3 to be able to use this.");
		}
		new msg[128];
		if(sscanf(params, "s[128]", msg)) return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} (/gov)ernment [text]");
		{

			SendClientMessageToAll(COLOR_WHITE, "Public Service Announcement:");
			format(str, sizeof(str), "Sector 9 %s Unknown: %s", GetPlayerGroupRankName(playerid), msg);
			new color = COLOR_DBLUE;
			if(PlayerInfo[playerid][pGroup] == GROUP_S9) color = 0x1F1F1FAA;
			SendClientMessageToAll(color, str);
		}
	}
	else return SendClientMessage(playerid, COLOR_GREY, "S9");
	return 1;
}

CMD:ggov(playerid, params[]) return cmd_ggovernment(playerid, params);

CMD:ame(playerid, params[])
{
	if(WatchingTV[playerid] == true) return 1;
	if(gPlayerLogged[playerid] == 0) return SendClientMessage(playerid, COLOR_GREY, "You havent logged in yet.");
	if(isnull(params)) return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /ame [action (is annotated above characters head)]");
	new str[128];
	format(str, sizeof(str), "* %s %s", PlayerICName(playerid), params);
	SetPlayerChatBubble(playerid, str, COLOR_PURPLE, 20.0, 15000);
	format(str, sizeof(str), "> %s %s", PlayerICName(playerid), params);
	SendClientMessage(playerid, COLOR_PURPLE, str);
	new year, month, day;
	getdate(year, month, day);

	new hour, minute, second;
	gettime(hour, minute, second);
	hour = FixHour(hour);
	format(str, sizeof(str), "/AME %s %s at %02d %s %02d:%02d:%02d", PlayerOOCName(playerid), params, day, GetMonthFromInt(month), hour, minute, second);
	logswrite("ame.log", str);
	return 1;
}

CMD:amy(playerid, params[])
{
	if(WatchingTV[playerid] == true) return 1;
	if(gPlayerLogged[playerid] == 0) return SendClientMessage(playerid, COLOR_GREY, "You havent logged in yet.");
	if(isnull(params)) return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /amy [action (is annotated above characters head)]");
	new str[128];
	format(str, sizeof(str), "* %s's %s", PlayerICName(playerid), params);
	SetPlayerChatBubble(playerid, str, COLOR_PURPLE, 20.0, 15000);
	format(str, sizeof(str), "> %s's %s", PlayerICName(playerid), params);
	SendClientMessage(playerid, COLOR_PURPLE, str);
	new year, month, day;
	getdate(year, month, day);

	new hour, minute, second;
	gettime(hour, minute, second);
	hour = FixHour(hour);
	format(str, sizeof(str), "/AMY %s's %s at %02d %s %02d:%02d:%02d", PlayerOOCName(playerid), params, day, GetMonthFromInt(month), hour, minute, second);
	logswrite("amy.log", str);
	return 1;
}

CMD:checkrecord(playerid, params[]) {
	if(checkingID[playerid] == -1) {
		SendClientMessage(playerid, COLOR_GREY, "You have no criminal record on you.");
		return SendClientMessage(playerid, COLOR_GREY, "HINT: {FFFFFF}Talk to the receptionist inside the SAPD lobby.");
	}

	//SendClientMessage(playerid, COLOR_LIGHTBLUE, checkingName[playerid]);

	new query[128], rows, fields, CrimeType, CrimeReason[128], cstr[5000], Date[50], copname[28], isEnabled, Cache:result;
	mysql_format(sqlGameConnection, query, sizeof(query), "SELECT * FROM `newcrimes` WHERE `CrimePID` = %d ORDER BY `CrimeID` DESC LIMIT 20", checkingID[playerid]);
	result = mysql_query(sqlGameConnection, query);
	cache_get_data(rows, fields, sqlGameConnection);

	if(!rows) {
		new noCrimeStr[128];
		format(noCrimeStr, sizeof(noCrimeStr), "%s's criminal record is completely empty.", checkingName[playerid]);
		SendClientMessage(playerid, COLOR_GREY, noCrimeStr);
		return 1;
	}

	// Get the crimes
	format(cstr, sizeof(cstr), "Date\tType\tIssuer\tReason\n");
	for(new i = 0; i < rows; i++)
	{
		cache_get_field_content(i, "CrimeReason", CrimeReason);
		cache_get_field_content(i, "RealName", copname);
		cache_get_field_content(i, "Date", Date);
		CrimeType = cache_get_field_content_int(i, "CrimeType");
		isEnabled = cache_get_field_content_int(i, "CrimeEnabled");
		if(isEnabled) format(cstr, sizeof(cstr), "%s{1CC343}(%s)\t{1CC343}%s\t{1CC343}%s\t{1CC343}%s\n", cstr, Date, GetCrimeType(CrimeType), copname, CrimeReason);
		else format(cstr, sizeof(cstr), "%s{FF5F5F}(%s)\t{FF5F5F}%s\t{FF5F5F}%s\t{FF5F5F}%s{FFFFFF}\n", cstr, Date, GetCrimeType(CrimeType), copname, CrimeReason);
	}

	// Format dialog title
	new recordTitle[50];
	format(recordTitle, sizeof(recordTitle), "Copy of %s's criminal record", checkingName[playerid]);

	ShowPlayerDialog(playerid, DIALOG_UNUSED, DIALOG_STYLE_TABLIST_HEADERS, recordTitle, cstr, "Close", "");
	cache_delete(Cache:result, sqlGameConnection);
	return 1;
}

/*CMD:me(playerid, params[])
{
	if(WatchingTV[playerid] == true) return 1;
	if(PlayerInfo[playerid][pMuted] == 1) return SendClientMessage(playerid, COLOR_GREY, "You can't use this whilst muted.");
	if(gPlayerLogged[playerid] == 0) return SendClientMessage(playerid, COLOR_GREY, "You havent logged in yet.");
	if(isnull(params)) return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /me [action]");
	new str[128];
	format(str, sizeof(str), "* %s %s", PlayerICName(playerid), params);
	ProxDetector(30.0, playerid, str, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
	new year, month, day;
	getdate(year, month, day);

	new hour, minute, second;
	gettime(hour, minute, second);
	hour = FixHour(hour);
	format(str, sizeof(str), "/ME %s %s at %02d %s %02d:%02d:%02d", PlayerOOCName(playerid), params, day, GetMonthFromInt(month), hour, minute, second);
	logswrite("me.log", str);
	return 1;
}*/

CMD:me(playerid, params[])
{
	if(WatchingTV[playerid] == true) return 1;
	if(PlayerInfo[playerid][pMuted] == 1) return SendClientMessage(playerid, COLOR_GREY, "You can't use this whilst muted.");
	if(gPlayerLogged[playerid] == 0) return SendClientMessage(playerid, COLOR_GREY, "You havent logged in yet.");
	if(isnull(params)) return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /me [action]");
	new str[128];
	if(strlen(params) > MAX_SPLIT_LENGTH)
	{
		format(str, sizeof(str), "* %s %.*s...", PlayerICName(playerid),MAX_SPLIT_LENGTH, params);
		ProxDetector(30.0, playerid, str, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
		format(str, sizeof(str), "* ...%s", params[MAX_SPLIT_LENGTH]);
		ProxDetector(30.0, playerid, str, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
	}
	else
	{
		format(str, sizeof(str), "* %s %s", PlayerICName(playerid), params);
		ProxDetector(30.0, playerid, str, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
	}
	new year, month, day;
	getdate(year, month, day);

	new hour, minute, second;
	gettime(hour, minute, second);
	hour = FixHour(hour);
	format(str, sizeof(str), "/ME %s %s at %02d %s %02d:%02d:%02d", PlayerOOCName(playerid), params, day, GetMonthFromInt(month), hour, minute, second);
	logswrite("me.log", str);
	return 1;
}

CMD:my(playerid, params[])
{
	if(WatchingTV[playerid] == true) return 1;
	if(PlayerInfo[playerid][pMuted] == 1) return SendClientMessage(playerid, COLOR_GREY, "You can't use this whilst muted.");
	if(gPlayerLogged[playerid] == 0) return SendClientMessage(playerid, COLOR_GREY, "You havent logged in yet.");
	if(isnull(params)) return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /my [action]");
	new str[128];
	if(strlen(params) > MAX_SPLIT_LENGTH)
	{
		format(str, sizeof(str), "* %s's %.*s...", PlayerICName(playerid),MAX_SPLIT_LENGTH, params);
		ProxDetector(30.0, playerid, str, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
		format(str, sizeof(str), "* ...%s", params[MAX_SPLIT_LENGTH]);
		ProxDetector(30.0, playerid, str, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
	}
	else
	{
		format(str, sizeof(str), "* %s's %s", PlayerICName(playerid), params);
		ProxDetector(30.0, playerid, str, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
	}
	new year, month, day;
	getdate(year, month, day);

	new hour, minute, second;
	gettime(hour, minute, second);
	hour = FixHour(hour);
	format(str, sizeof(str), "/MY %s's %s at %02d %s %02d:%02d:%02d", PlayerOOCName(playerid), params, day, GetMonthFromInt(month), hour, minute, second);
	logswrite("my.log", str);
	return 1;
}

CMD:do(playerid, params[])
{
	if(WatchingTV[playerid] == true) return 1;
	if(PlayerInfo[playerid][pMuted] == 1) return SendClientMessage(playerid, COLOR_GREY, "You can't use this whilst muted.");
	if(gPlayerLogged[playerid] == 0) return SendClientMessage(playerid, COLOR_GREY, "You havent logged in yet.");
	if(isnull(params)) return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /do [local chat]");
	new str[128];
	if(strlen(params) > MAX_SPLIT_LENGTH)
	{
		format(str, sizeof(str), "* %s %.*s...", params, MAX_SPLIT_LENGTH);
		ProxDetector(30.0, playerid, str, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
		format(str, sizeof(str), "* ...%s (( %s ))", params[MAX_SPLIT_LENGTH], PlayerICName(playerid));
		ProxDetector(30.0, playerid, str, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
	}
	else
	{
		format(str, sizeof(str), "* %s (( %s ))", params, PlayerICName(playerid));
		ProxDetector(30.0, playerid, str, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
	}
	new year, month, day;
	getdate(year, month, day);

	new hour, minute, second;
	gettime(hour, minute, second);
	hour = FixHour(hour);
	format(str, sizeof(str), "/DO %s (( %s )) at %02d %s %02d:%02d:%02d", params, PlayerOOCName(playerid), day, GetMonthFromInt(month), hour, minute, second);
	logswrite("do.log", str);
	return 1;
}

//////////////////////////////////////////////////////////////
CMD:listads(playerid, params[])
{
	if(advertInfo[0][AD_ACTIVE] == false) return SendClientMessage(playerid, COLOR_GRAD2, "There is currently no advertisements. Check back later.");
	if(PlayerInfo[playerid][pMember] == 1 || PlayerInfo[playerid][pAdmin] >= 1 || PlayerInfo[playerid][pMember] == 9 && PlayerInfo[playerid][pRank] >= 4)
	{
		// if admin/news display name too
		new vstr[5120];
		for(new i; i < MAX_ADVERTS; i++)
		{
			if(advertInfo[i][AD_ACTIVE] == true)
			{
				format(vstr, sizeof(vstr), "%s{82BF50}%d{FFFFFF}: %s.\nCall {82BF50}%s {FFFFFF}on {82BF50}%d{FFFFFF}.\n\n",
					vstr, i+1, advertInfo[i][AD_STRING], advertInfo[i][AD_AUTHOR], advertInfo[i][AD_PHONE]);
				ShowPlayerDialog(playerid, 12513, DIALOG_STYLE_INPUT, "Advertisements", vstr, "Call", "Cancel");
			}
		}
	}
	else {
		// else don't show name
		// if admin/news display name too
		new vstr[5120];
		for(new i; i < MAX_ADVERTS; i++)
		{
			if(advertInfo[i][AD_ACTIVE] == true)
			{
				format(vstr, sizeof(vstr), "%s{82BF50}%d{FFFFFF}: %s.\n{82BF50}Phone number{FFFFFF}: %d.\n\n",
					vstr, i+1, advertInfo[i][AD_STRING], advertInfo[i][AD_PHONE]);
				ShowPlayerDialog(playerid, 12513, DIALOG_STYLE_INPUT, "Advertisements", vstr, "Call", "Cancel");
			}
		}
	}
	return 1;
}

CMD:advertise(playerid, params[])
{
	if(gPlayerLogged[playerid] == 0) return SendClientMessage(playerid, COLOR_GREY, "You havent logged in yet.");
	if(PlayerInfo[playerid][pAdMuted] == 1) return SendClientMessage(playerid, COLOR_GREY, "You have been banned from posting ads.");
	if(PlayerInfo[playerid][pConnectTime] <= 1) return SendClientMessage(playerid, COLOR_GREY, "You need to play for longer than 1 hour before placing an advertisement.");
	if(PlayerInfo[playerid][pTut] == 0 || PlayerInfo[playerid][pHospital] == 1) return 1;
	if(!IsPlayerInRangeOfPoint(playerid, 20.0, ADVERTISE_COORDS) && PlayerInfo[playerid][pPnumber] == 0) return SendClientMessage(playerid, COLOR_GRAD2, "You don't have a cell phone. You can buy a cell phone from a 24-7.");
	if(PlayerInfo[playerid][pJailed] == 1 || PlayerInfo[playerid][pJailed] == 2 || PlayerInfo[playerid][pAdminJailed] == 1) return SendClientMessage(playerid, COLOR_GREY, "You can't use this while you're in prison.");
	if(isnull(params)) return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} (/ad)vertise [advert text]");
	new str[128];
	if(gettime() < (adds + 60) && (PlayerInfo[playerid][pAdmin] < 3))
	{
		format(str, sizeof(str), "Please wait %d seconds to post your advertisement.", (adds + 60) - gettime());
		SendClientMessage(playerid, COLOR_GRAD2, str);
		return 1;
	}
	else
	{
		new payout, pricePerChar;

		// Players will have to pay more if they're not in SAN HQ
		if(IsPlayerInRangeOfPoint(playerid, 3.0, ADVERTISE_COORDS))
		{
			pricePerChar = 100;
		} else {
			pricePerChar = 200;
		}

		payout = strlen(params) * pricePerChar;

		if(PlayerInfo[playerid][pCash] < payout)
		{
			format(str, sizeof(str), "* You used %d characters which cost $%d, you don't have enough.", strlen(params), payout);
			SendClientMessage(playerid, COLOR_LIGHTBLUE, str);
			return 1;
		}
		GiveMoney(playerid, -payout);
		format(str, sizeof(str), "Advertisement [Ph: %d] %s", PlayerInfo[playerid][pPnumber], params);
		new name[24];
		strmid(name, str_replace('_', ' ', PlayerName(playerid)), 0, MAX_PLAYER_NAME);
		OOCNews(TEAM_GROVE_COLOR, str);
		format(str, sizeof(str), "~r~Paid ~r~$%d!~n~~w~Advertisement contained: %d characters", payout, strlen(params));
		displayCenterHUDInfo(playerid,  str, 8); //display for 8 seconds
		NEWS += payout;
		SaveFactionBanks();
		if(PlayerInfo[playerid][pAdmin] < 4) adds = gettime();

		if(adCount >= MAX_ADVERTS) adCount = 0;
		format(advertInfo[adCount][AD_AUTHOR], sizeof(name), "%s", name);
		format(advertInfo[adCount][AD_STRING], 128, "%s", params);
		advertInfo[adCount][AD_PHONE] = PlayerInfo[playerid][pPnumber];
		advertInfo[adCount][AD_ACTIVE] = true;
		LastAd = adCount;
		adCount++;
	}
	return 1;
}

CMD:ad(playerid, params[]) return cmd_advertise(playerid, params);

CMD:lastad(playerid, params[]) {
	if(PlayerInfo[playerid][pAdmin] < 1) return SendClientMessage(playerid, COLOR_GRAD2, "You are not authorized to use this command.");
	if(advertInfo[0][AD_ACTIVE] == false) return SendClientMessage(playerid, COLOR_GRAD2, "There are no advertisements currently.");
	new lastAdMessage[128];
	format(lastAdMessage, sizeof(lastAdMessage), "Last advertisement was done by %s.", advertInfo[LastAd][AD_AUTHOR]);
	return SendClientMessage(playerid, COLOR_WHITE, lastAdMessage);
}

CMD:checkactivity(playerid, params[])
{
	if(!PlayerInfo[playerid][pBizMod]) return AdmErrorMsg;
	new query[500];
	mysql_format(sqlGameConnection, query, sizeof(query), "SELECT Name, BizKey, pHouseID, PropDate FROM players WHERE BizKey != 0 OR pHouseID !=0 LIMIT 50");
	mysql_pquery(sqlGameConnection, query, "CheckProps", "i", playerid);
	return 1;
}

CMD:makepropertymod(playerid, params[])
{
	if(!(PlayerInfo[playerid][pAdmin] >= 1337)) return SendClientMessage(playerid, COLOR_GRAD2, "You are not authorized to use this command.");
	new targetid;
	new str[128];
	if(sscanf(params, "u", targetid)) return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /makepropertymod [playerid]");
	{
		if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, COLOR_GREY, "{FF0000}Error:{FFFFFF} That player isn't connected.");
		if(PlayerInfo[targetid][pBizMod])
		{
			SendClientMessage(targetid, COLOR_RED, "You are no longer a property moderator.");
			format(str, sizeof(str), "{FF0000}AdmWarning{FFFFFF}: %s removed %s's property moderator status.", PlayerICName(playerid), PlayerICName(targetid));
			ABroadCast(COLOR_WHITE, str, 1);
			PlayerInfo[targetid][pBizMod] = 0;
			format(str, sizeof(str), "You removed %s's status of a property moderator.", PlayerICName(targetid));
			SendClientMessage(playerid, COLOR_LIGHTBLUE, str);
		}
		else
		{
			SendClientMessage(targetid, COLOR_RED, "You are now a property moderator.");
			format(str, sizeof(str), "{FF0000}AdmWarning{FFFFFF}: %s granted %s property moderator status.", PlayerICName(playerid), PlayerICName(targetid));
			ABroadCast(COLOR_WHITE, str, 1);
			PlayerInfo[targetid][pBizMod] = 1;
			format(str, sizeof(str), "You gave %s the status of a property moderator.", PlayerICName(targetid));
			SendClientMessage(playerid, COLOR_LIGHTBLUE, str);
		}
	}
	return 1;
}

CMD:omakepropertymod(playerid, params[]){

	if(!(PlayerInfo[playerid][pAdmin] >= 1337)) return SendClientMessage(playerid, COLOR_GRAD2, "You are not authorized to use this command.");

	new playerName[MAX_PLAYER_NAME+1];
	if(sscanf(params, "s[25]", playerName))
		return SendClientMessage(playerid, -1, "{00BFFF}Usage:{FFFFFF} /omakepropertymod [Firstname_Lastname]");

	if(IsPlayerConnected(ReturnUser(playerName)))
		return SendClientMessage(playerid, -1, "{00BFFF}Usage:{FFFFFF} That player is already connected. Use /makepropertymod");

	new _query[128];

	inline oPropModCheck(playa){

		if(!cache_num_rows())
			return SendClientMessage(playerid, -1, "{FF0000}Error:{FFFFFF} Player name not found.");

		new
			_bizMod = cache_get_field_content_int(0, "BizMod"),
			_str[128];

		_bizMod = !_bizMod;

		mysql_format(sqlGameConnection, _query, sizeof(_query), "UPDATE `players` SET `BizMod`='%d' WHERE `Name` = '%e'", _bizMod, playerName);
		mysql_pquery(sqlGameConnection, _query);

		if(_bizMod)
			format(_str, sizeof(_str), "{FF0000}AdmWarning{FFFFFF}: %s (o)granted %s property moderator status.", PlayerICName(playa), playerName);
		else
			format(_str, sizeof(_str), "{FF0000}AdmWarning{FFFFFF}: %s (o)removed %s property moderator status.", PlayerICName(playa), playerName);

		ABroadCast(COLOR_WHITE, _str, 1);
	}

	mysql_format(sqlGameConnection, _query, sizeof(_query), "SELECT `BizMod` FROM `players` WHERE `Name`='%e' LIMIT 1", playerName);
	mysql_pquery_inline(sqlGameConnection, _query, using inline oPropModCheck, "i", playerid);
	return 1;
}

CMD:makefactiondirector(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] < 1337) return AdmErrorMsg;
	new targetid;
	new str[128];
	if(sscanf(params, "u", targetid)) return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /makefactiondirector [playerid]");
	{
		if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, COLOR_GREY, "{FF0000}Error:{FFFFFF} That player isn't connected.");
		if(PlayerInfo[targetid][pFactionDirector])
		{
			SendClientMessage(targetid, COLOR_RED, "You are no longer a faction director.");
			format(str, sizeof(str), "{FF0000}AdmWarning{FFFFFF}: %s removed %s's faction director status.", PlayerICName(playerid), PlayerICName(targetid));
			ABroadCast(COLOR_WHITE, str, 1);
			PlayerInfo[targetid][pFactionDirector] = 0;
			format(str, sizeof(str), "You removed %s's status of a faction director.", PlayerICName(targetid));
			SendClientMessage(playerid, COLOR_LIGHTBLUE, str);
			OnPlayerSave(playerid);
		}
		else
		{
			SendClientMessage(targetid, COLOR_RED, "You are now a faction director.");
			format(str, sizeof(str), "{FF0000}AdmWarning{FFFFFF}: %s granted %s faction director status.", PlayerICName(playerid), PlayerICName(targetid));
			ABroadCast(COLOR_WHITE, str, 1);
			PlayerInfo[targetid][pFactionDirector] = 1;
			format(str, sizeof(str), "You gave %s the status of a faction director.", PlayerICName(targetid));
			SendClientMessage(playerid, COLOR_LIGHTBLUE, str);
			OnPlayerSave(playerid);
		}
	}
	return 1;
}

CMD:makefactionmod(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] < 1337 && !PlayerInfo[playerid][pFactionDirector]) return AdmErrorMsg;
	new targetid;
	new str[128];
	if(sscanf(params, "u", targetid)) return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /makefactionmod [playerid]");
	{
		if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, COLOR_GREY, "{FF0000}Error:{FFFFFF} That player isn't connected.");
		if(PlayerInfo[targetid][pFactionMod])
		{
			SendClientMessage(targetid, COLOR_RED, "You are no longer a faction moderator.");
			format(str, sizeof(str), "{FF0000}AdmWarning{FFFFFF}: %s removed %s's faction moderator status.", PlayerICName(playerid), PlayerICName(targetid));
			ABroadCast(COLOR_WHITE, str, 1);
			PlayerInfo[targetid][pFactionMod] = 0;
			format(str, sizeof(str), "You removed %s's status of a faction moderator.", PlayerICName(targetid));
			SendClientMessage(playerid, COLOR_LIGHTBLUE, str);
			OnPlayerSave(playerid);
		}
		else
		{
			SendClientMessage(targetid, COLOR_RED, "You are now a faction moderator.");
			format(str, sizeof(str), "{FF0000}AdmWarning{FFFFFF}: %s granted %s faction moderator status.", PlayerICName(playerid), PlayerICName(targetid));
			ABroadCast(COLOR_WHITE, str, 1);
			PlayerInfo[targetid][pFactionMod] = 1;
			format(str, sizeof(str), "You gave %s the status of a faction moderator.", PlayerICName(targetid));
			SendClientMessage(playerid, COLOR_LIGHTBLUE, str);
			OnPlayerSave(playerid);
		}
	}
	return 1;
}

CMD:makebanappealer(playerid, params[])
{
	if(!(PlayerInfo[playerid][pAdmin] >= 1337)) return SendClientMessage(playerid, COLOR_GRAD2, "You are not authorized to use this command.");
	new targetid;
	new str[128];
	if(sscanf(params, "u", targetid)) return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /makebanappealer [playerid]");
	{
		if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, COLOR_GREY, "{FF0000}Error:{FFFFFF} That player isn't connected.");
		if(PlayerInfo[targetid][pBanAppealer])
		{
			SendClientMessage(targetid, COLOR_RED, "You are no longer a ban appealer.");
			format(str, sizeof(str), "{FF0000}AdmWarning{FFFFFF}: %s removed %s's ban appealer status.", PlayerICName(playerid), PlayerICName(targetid));
			ABroadCast(COLOR_WHITE, str, 1);
			PlayerInfo[targetid][pBanAppealer] = 0;
			format(str, sizeof(str), "You removed %s's status of a ban appealer.", PlayerICName(targetid));
			SendClientMessage(playerid, COLOR_LIGHTBLUE, str);
		}
		else
		{
			SendClientMessage(targetid, COLOR_RED, "You are now a ban appealer.");
			format(str, sizeof(str), "{FF0000}AdmWarning{FFFFFF}: %s granted %s ban appealer status.", PlayerICName(playerid), PlayerICName(targetid));
			ABroadCast(COLOR_WHITE, str, 1);
			PlayerInfo[targetid][pBanAppealer] = 1;
			format(str, sizeof(str), "You gave %s the status of a ban appealer.", PlayerICName(targetid));
			SendClientMessage(playerid, COLOR_LIGHTBLUE, str);
		}
	}
	return 1;
}

CMD:eventkick(playerid, params[])
{
	new targetid, reason[30];
	new str[128];
	if(PlayerInfo[playerid][pAdmin] >= 1337 || PlayerInfo[playerid][pEventModd] || PlayerEventMod[playerid])
	{
		if(sscanf(params, "us[96]", targetid, reason)) return SendClientMessage(playerid, COLOR_GRAD2, "{00BFFF}Usage:{FFFFFF} /eventkick [playerid] [reason]");
		{
			if(IsAtEvent[targetid] != 0)
			{
				ResetPlayerAdminWeaponsEx(targetid);
				SetPlayerSpawn(targetid);
				format(str, sizeof(str), "{FF0000}AdmWarning{FFFFFF}: %s kicked from the event by %s, reason: %s.", PlayerICName(targetid), PlayerICName(playerid), reason);
				ABroadCast(COLOR_WHITE, str, 1);
				format(str, sizeof(str), "{FF0000}AdmWarning{FFFFFF}: %s kicked from the event by %s, reason: %s.", PlayerICName(targetid), PlayerICName(playerid), reason);
				SendEventHelperMessage(COLOR_WHITE, str);
			}
			else
			{
				SendClientMessage(playerid, COLOR_RED, "That player is not in the event !");
			}
		}
	}
	return 1;
}

CMD:makeeventhelper(playerid, params[])
{
	new targetid;
	new str[128];
	if(PlayerInfo[playerid][pEventModd] != 1) return SendClientMessage(playerid, COLOR_GRAD2, "You are not authorized to use this command.");
	if(sscanf(params, "u", targetid)) return SendClientMessage(playerid, COLOR_GRAD2, "{00BFFF}Usage:{FFFFFF} /makeeventhelper [playerid]");
	{
		if(PlayerInfo[targetid][pEventModd] == 1)  return SendClientMessage(playerid, COLOR_GRAD2, "That player is an event admin.");
		if(PlayerEventMod[targetid])
		{
			SendClientMessage(targetid, COLOR_RED, "You are no longer a player event moderator.");
			format(str, sizeof(str), "{FF0000}AdmWarning{FFFFFF}: %s removed %s's event helper status.", PlayerICName(playerid), PlayerICName(targetid));
			ABroadCast(COLOR_WHITE, str, 1);
			format(str, sizeof(str), "{FF0000}AdmWarning{FFFFFF}: %s removed %s's event helper status.", PlayerICName(playerid), PlayerICName(targetid));
			SendEventHelperMessage(COLOR_WHITE, str);
			PlayerEventMod[targetid] = 0;
			format(str, sizeof(str), "You removed %s's status of an event moderator.", PlayerICName(targetid));
			SendClientMessage(playerid, COLOR_LIGHTBLUE, str);
			SetPlayerHealth(targetid, 100);
			SetPlayerArmour(targetid, 100);
			SetPlayerToTeamColor(targetid);
		}
		else
		{
			SendClientMessage(targetid, COLOR_RED, "You are now a player event moderator.");
			format(str, sizeof(str), "{FF0000}AdmWarning{FFFFFF}: %s granted %s event helper status.", PlayerICName(playerid), PlayerICName(targetid));
			ABroadCast(COLOR_WHITE, str, 1);
			PlayerEventMod[targetid] = 1;
			format(str, sizeof(str), "You gave %s the status of an event moderator.", PlayerICName(targetid));
			SendClientMessage(playerid, COLOR_LIGHTBLUE, str);
			SetPlayerHealth(targetid, 9999999);
			SetPlayerArmour(targetid, 9999999);
			SetPlayerColor(targetid, COLOR_EVENTHELP);
		}
	}
	return 1;
}

CMD:makeeventmod(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] < 1337 || PlayerInfo[playerid][pPR]) return SendClientMessage(playerid, COLOR_GRAD2, "You are not authorized to use this command.");
	new targetid;
	new str[128];
	if(sscanf(params, "u", targetid)) return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /makeeventmod [playerid]");
	{
		if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, COLOR_GREY, "{FF0000}Error:{FFFFFF} That player isn't connected.");
		if(PlayerInfo[targetid][pEventModd])
		{
			SendClientMessage(targetid, COLOR_RED, "You are no longer an event moderator.");
			format(str, sizeof(str), "{FF0000}AdmWarning{FFFFFF}: %s removed %s's event moderator status.", PlayerICName(playerid), PlayerICName(targetid));
			ABroadCast(COLOR_WHITE, str, 1);
			PlayerInfo[targetid][pEventModd] = 0;
			format(str, sizeof(str), "You removed %s's status of an event moderator.", PlayerICName(targetid));
			SendClientMessage(playerid, COLOR_LIGHTBLUE, str);
		}
		else
		{
			SendClientMessage(targetid, COLOR_RED, "You are now an event moderator.");
			format(str, sizeof(str), "{FF0000}AdmWarning{FFFFFF}: %s granted %s event moderator status.", PlayerICName(playerid), PlayerICName(targetid));
			ABroadCast(COLOR_WHITE, str, 1);
			PlayerInfo[targetid][pEventModd] = 1;
			format(str, sizeof(str), "You gave %s the status of an event moderator.", PlayerICName(targetid));
			SendClientMessage(playerid, COLOR_LIGHTBLUE, str);
		}
	}
	return 1;
}

CMD:makecomplaintmod(playerid, params[])
{
	if(!(PlayerInfo[playerid][pAdmin] >= 99999)) return SendClientMessage(playerid, COLOR_GRAD2, "You are not authorized to use this command.");
	new targetid;
	new str[128];
	if(sscanf(params, "u", targetid)) return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /makecomplaintmod [playerid]");
	{
		if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, COLOR_GREY, "{FF0000}Error:{FFFFFF} That player isn't connected.");
		if(PlayerInfo[targetid][pComplaintModd])
		{
			SendClientMessage(targetid, COLOR_RED, "You are no longer a complaint moderator.");
			format(str, sizeof(str), "{FF0000}AdmWarning{FFFFFF}: %s removed %s's complaint moderator status.", PlayerICName(playerid), PlayerICName(targetid));
			ABroadCast(COLOR_WHITE, str, 1);
			PlayerInfo[targetid][pComplaintModd] = 0;
			format(str, sizeof(str), "You removed %s's status of a complaint moderator.", PlayerICName(targetid));
			SendClientMessage(playerid, COLOR_LIGHTBLUE, str);
		}
		else
		{
			SendClientMessage(targetid, COLOR_RED, "You are now a complaint moderator.");
			format(str, sizeof(str), "{FF0000}AdmWarning{FFFFFF}: %s granted %s complaint moderator status.", PlayerICName(playerid), PlayerICName(targetid));
			ABroadCast(COLOR_WHITE, str, 1);
			PlayerInfo[targetid][pComplaintModd] = 1;
			format(str, sizeof(str), "You gave %s the status of a complaint moderator.", PlayerICName(targetid));
			SendClientMessage(playerid, COLOR_LIGHTBLUE, str);
		}
	}
	return 1;
}

CMD:makeshopmod(playerid, params[])
{
	if(!(PlayerInfo[playerid][pAdmin] >= 99999)) return SendClientMessage(playerid, COLOR_GRAD2, "You are not authorized to use this command.");
	new targetid;
	new str[128];
	if(sscanf(params, "u", targetid)) return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /makeshopmod [playerid]");
	{
		if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, COLOR_GREY, "{FF0000}Error:{FFFFFF} That player isn't connected.");
		if(PlayerInfo[targetid][pShopMod])
		{
			SendClientMessage(targetid, COLOR_RED, "You are no longer a shop moderator.");
			format(str, sizeof(str), "{FF0000}AdmWarning{FFFFFF}: %s removed %s's shop moderator status.", PlayerICName(playerid), PlayerICName(targetid));
			ABroadCast(COLOR_WHITE, str, 1);
			PlayerInfo[targetid][pShopMod] = 0;
			format(str, sizeof(str), "You removed %s's status of a shop moderator.", PlayerICName(targetid));
			SendClientMessage(playerid, COLOR_LIGHTBLUE, str);
		}
		else
		{
			SendClientMessage(targetid, COLOR_RED, "You are now a shop moderator.");
			format(str, sizeof(str), "{FF0000}AdmWarning{FFFFFF}: %s granted %s shop moderator status.", PlayerICName(playerid), PlayerICName(targetid));
			ABroadCast(COLOR_WHITE, str, 1);
			PlayerInfo[targetid][pShopMod] = 1;
			format(str, sizeof(str), "You gave %s the status of a shop moderator.", PlayerICName(targetid));
			SendClientMessage(playerid, COLOR_LIGHTBLUE, str);
		}
	}
	return 1;
}

CMD:makefamed(playerid, params[])
{
	if(PlayerInfo[playerid][pFamed] < 2 && PlayerInfo[playerid][pAdmin] < 1337) return SendClientMessage(playerid, COLOR_GRAD2, "You are not authorized to use this command.");
	new targetid, rank[24];
	new str[128];
	if(sscanf(params, "us[24]", targetid, rank))
	{
		SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /makefamed [playerid] [rank]");
		SendClientMessage(playerid, COLOR_GRAD2, "{00BFFF}Usage:{FFFFFF} 'None' 'Famed' 'Manager'");
		return 1;
	}
	new rnkname2[16];
	if(strcmp(rank, "none", true) == 0 || strcmp(rank, "famed", true) == 0 || strcmp(rank, "manager", true) == 0)
	{
		if(strcmp(rank, "none", true) == 0)
		{
			format(str, sizeof(str), "{FF0000}AdmWarning{FFFFFF}: %s has removed %s's status as a famed member.", PlayerICName(playerid), PlayerICName(targetid));
			ABroadCast(COLOR_LIGHTRED, str, 1);
			SendClientMessage(targetid, COLOR_LIGHTBLUE, "You are no longer a famed member/manager.");
			PlayerInfo[targetid][pFamed] = 0;
			format(str, sizeof(str), "You removed %s's status of a famed member.", PlayerICName(targetid));
			SendClientMessage(playerid, COLOR_LIGHTBLUE, str);
			if(PlayerInfo[playerid][pLevel] >= 2)PlayerInfo[targetid][pTag] = NTAG_PLAYER;
			else PlayerInfo[targetid][pTag] = NTAG_NEWBIE;
			return 1;
		}
		if(strcmp(rank, "famed", true) == 0)
		{
			PlayerInfo[targetid][pTag] = NTAG_FAMED;
			PlayerInfo[targetid][pFamed] = 1;
			rnkname2 = "famed member";
			format(str, sizeof(str), "You have been given the status of a %s.", rnkname2);
			SendClientMessage(targetid, COLOR_LIGHTBLUE, str);
			format(str, sizeof(str), "{FF0000}AdmWarning{FFFFFF}: %s has been given the status of '%s' by %s.", PlayerICName(targetid), rnkname2, PlayerICName(playerid));
			ABroadCast(COLOR_LIGHTRED, str, 1);
			format(str, sizeof(str), "You gave %s the status of a %s.", PlayerICName(targetid), rnkname2);
			SendClientMessage(playerid, COLOR_LIGHTBLUE, str);
		}
		if(strcmp(rank, "manager", true) == 0)
		{
			if(PlayerInfo[playerid][pAdmin] >= 1337)
			{
				PlayerInfo[targetid][pTag] = NTAG_MANAGERFAMED;
				PlayerInfo[targetid][pFamed] = 2;
				rnkname2 = "famed manager";
				format(str, sizeof(str), "You have been given the status of a %s.", rnkname2);
				SendClientMessage(targetid, COLOR_LIGHTBLUE, str);
				format(str, sizeof(str), "{FF0000}AdmWarning{FFFFFF}: %s has been given the status of '%s' by %s.", PlayerICName(targetid), rnkname2, PlayerICName(playerid));
				ABroadCast(COLOR_LIGHTRED, str, 1);
				format(str, sizeof(str), "You gave %s the status of a %s.", PlayerICName(targetid), rnkname2);
				SendClientMessage(playerid, COLOR_LIGHTBLUE, str);
			}
			else return SendClientMessage(playerid, COLOR_GRAD2, "You are not authorized to make famed managers.");
		}
	}
	else return SendClientMessage(playerid, COLOR_GRAD2, "Invalid rank specified.");
	return 1;
}


CMD:makegangdirector(playerid, params[])
{
	if(!(PlayerInfo[playerid][pAdmin] >= 1337)) return SendClientMessage(playerid, COLOR_GRAD2, "You are not authorized to use this command.");
	new targetid;
	new str[128];
	if(sscanf(params, "u", targetid)) return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /makegangdirector [playerid]");
	{
		if(PlayerInfo[targetid][pGangDirector])
		{
			SendClientMessage(targetid, COLOR_RED, "You are no longer a gang director.");
			format(str, sizeof(str), "{FF0000}AdmWarning{FFFFFF}: %s removed %s's gang director status.", PlayerICName(playerid), PlayerICName(targetid));
			ABroadCast(COLOR_WHITE, str, 1);
			PlayerInfo[targetid][pGangDirector] = 0;
			format(str, sizeof(str), "You removed %s's status of a gang director.", PlayerICName(targetid));
			SendClientMessage(playerid, COLOR_LIGHTBLUE, str);
		}
		else
		{
			SendClientMessage(targetid, COLOR_RED, "You are now a gang director.");
			format(str, sizeof(str), "{FF0000}AdmWarning{FFFFFF}: %s granted %s gang director status.", PlayerICName(playerid), PlayerICName(targetid));
			ABroadCast(COLOR_WHITE, str, 1);
			PlayerInfo[targetid][pGangDirector] = 1;
			format(str, sizeof(str), "You gave %s the status of a gang director.", PlayerICName(targetid));
			SendClientMessage(playerid, COLOR_LIGHTBLUE, str);
		}
	}
	return 1;
}

CMD:maketester(playerid, params[])
{
	if(PlayerInfo[playerid][pTester] < TESTERRANK_MANAGER && PlayerInfo[playerid][pAdmin] < 1337) return SendClientMessage(playerid, COLOR_GRAD2, "You are not authorized to use this command.");
	new targetid, rank[24];
	new str[128];
	if(sscanf(params, "us[24]", targetid, rank))
	{
		SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /maketester [playerid] [rank]");
		SendClientMessage(playerid, COLOR_GRAD2, "{00BFFF}Usage:{FFFFFF} 'None' 'Regular' 'Senior' or 'Manager'");
	}
	else
	{
		if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, COLOR_GREY, "{FF0000}Error:{FFFFFF} That player isn't connected.");
		if(strcmp(rank, "none", true) == 0 || strcmp(rank, "regular", true) == 0 || strcmp(rank, "senior", true) == 0 || strcmp(rank, "manager", true) == 0)
		{
			if(strcmp(rank, "none", true) == 0)
			{
				format(str, sizeof(str), "{FF0000}AdmWarning{FFFFFF}: %s has removed %s's status as a tester.", PlayerICName(playerid), PlayerICName(targetid));
				ABroadCast(COLOR_WHITE, str, 1);
				SendClientMessage(targetid, COLOR_LIGHTBLUE, "You are no longer a tester.");
				PlayerInfo[targetid][pTester] = TESTERRANK_NONE;
				format(str, sizeof(str), "You have removed %s from the tester team.", PlayerICName(targetid));
				SendClientMessage(playerid, COLOR_LIGHTBLUE, str);
				if(PlayerInfo[playerid][pLevel] >= 2)PlayerInfo[targetid][pTag] = NTAG_PLAYER;
				else PlayerInfo[targetid][pTag] = NTAG_NEWBIE;
				return 1;
			}
			if(strcmp(rank, "regular", true) == 0)
			{
				PlayerInfo[targetid][pTag] = NTAG_TESTER;
				PlayerInfo[targetid][pTester] = TESTERRANK_REGULAR;
				format(str, sizeof(str), "You have been given the status of a %s tester.", rank);
				SendClientMessage(targetid, COLOR_LIGHTBLUE, str);
				format(str, sizeof(str), "{FF0000}AdmWarning{FFFFFF}: %s has been given the status of a %s tester by %s.", PlayerICName(targetid), rank, PlayerICName(playerid));
				ABroadCast(COLOR_WHITE, str, 1);
				format(str, sizeof(str), "You gave %s the status of a %s tester.", PlayerICName(targetid), rank);
				SendClientMessage(playerid, COLOR_LIGHTBLUE, str);
			}
			if(strcmp(rank, "senior", true) == 0)
			{
				PlayerInfo[targetid][pTag] = NTAG_STESTER;
				PlayerInfo[targetid][pTester] = TESTERRANK_SENIOR;
				format(str, sizeof(str), "You have been given the status of a %s tester.", rank);
				SendClientMessage(targetid, COLOR_LIGHTBLUE, str);
				format(str, sizeof(str), "{FF0000}AdmWarning{FFFFFF}: %s has been given the status of a %s tester by %s.", PlayerICName(targetid), rank, PlayerICName(playerid));
				ABroadCast(COLOR_WHITE, str, 1);
				format(str, sizeof(str), "You gave %s the status of a %s tester.", PlayerICName(targetid), rank);
				SendClientMessage(playerid, COLOR_LIGHTBLUE, str);
			}
			if(strcmp(rank, "manager", true) == 0)
			{
				PlayerInfo[targetid][pTag] = NTAG_MANAGERTESTER;
				PlayerInfo[targetid][pTester] = TESTERRANK_MANAGER;
				format(str, sizeof(str), "You have been given the status of a %s tester.", rank);
				SendClientMessage(targetid, COLOR_LIGHTBLUE, str);
				format(str, sizeof(str), "{FF0000}AdmWarning{FFFFFF}: %s has been given the status of a %s tester by %s.", PlayerICName(targetid), rank, PlayerICName(playerid));
				ABroadCast(COLOR_WHITE, str, 1);
				format(str, sizeof(str), "You gave %s the status of a %s tester.", PlayerICName(targetid), rank);
				SendClientMessage(playerid, COLOR_LIGHTBLUE, str);
			}
		}
		else return SendClientMessage(playerid, COLOR_GRAD2, "Invalid rank specified.");
	}
	return 1;
}

CMD:makemapper(playerid, params[])
{
	if(PlayerInfo[playerid][pMapper] < MAPPERRANK_MANAGER && PlayerInfo[playerid][pAdmin] < 1337) return SendClientMessage(playerid, COLOR_GRAD2, "You are not authorized to use this command.");
	new targetid, rank[24];
	new str[128];
	if(sscanf(params, "us[24]", targetid, rank))
	{
		SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /makemapper [playerid] [rank]");
		SendClientMessage(playerid, COLOR_GRAD2, "{00BFFF}Usage:{FFFFFF} 'None' 'Regular' 'Senior' or 'Manager'");
	}
	else
	{
		if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, COLOR_GREY, "{FF0000}Error:{FFFFFF} That player isn't connected.");
		if(strcmp(rank, "none", true) == 0 || strcmp(rank, "regular", true) == 0 || strcmp(rank, "senior", true) == 0 || strcmp(rank, "manager", true) == 0)
		{
			if(strcmp(rank, "none", true) == 0)
			{
				format(str, sizeof(str), "{FF0000}AdmWarning{FFFFFF}: %s has removed %s's status as a Mapper.", PlayerICName(playerid), PlayerICName(targetid));
				ABroadCast(COLOR_WHITE, str, 1);
				SendClientMessage(targetid, COLOR_LIGHTBLUE, "You are no longer a Mapper.");
				PlayerInfo[targetid][pMapper] = MAPPERRANK_NONE;
				format(str, sizeof(str), "You removed %s from the mapper team.", PlayerICName(targetid));
				SendClientMessage(playerid, COLOR_LIGHTBLUE, str);
				if(PlayerInfo[playerid][pLevel] >= 2)PlayerInfo[targetid][pTag] = NTAG_PLAYER;
				else PlayerInfo[targetid][pTag] = NTAG_NEWBIE;
				return 1;
			}
			if(strcmp(rank, "regular", true) == 0)
			{
				PlayerInfo[targetid][pTag] = NTAG_MAPPER;
				PlayerInfo[targetid][pMapper] = MAPPERRANK_REGULAR;
				format(str, sizeof(str), "You have been given the status of a %s Mapper.", rank);
				SendClientMessage(targetid, COLOR_LIGHTBLUE, str);
				format(str, sizeof(str), "{FF0000}AdmWarning{FFFFFF}: %s has been given the status of a %s Mapper by %s.", PlayerICName(targetid), rank, PlayerICName(playerid));
				ABroadCast(COLOR_WHITE, str, 1);
				format(str, sizeof(str), "You gave %s the status of a %s mapper.", PlayerICName(targetid), rank);
				SendClientMessage(playerid, COLOR_LIGHTBLUE, str);
			}
			if(strcmp(rank, "senior", true) == 0)
			{
				PlayerInfo[targetid][pTag] = NTAG_SENIORMAPPER;
				PlayerInfo[targetid][pMapper] = MAPPERRANK_SENIOR;
				format(str, sizeof(str), "You have been given the status of a %s Mapper.", rank);
				SendClientMessage(targetid, COLOR_LIGHTBLUE, str);
				format(str, sizeof(str), "{FF0000}AdmWarning{FFFFFF}: %s has been given the status of a %s Mapper by %s.", PlayerICName(targetid), rank, PlayerICName(playerid));
				ABroadCast(COLOR_WHITE, str, 1);
				format(str, sizeof(str), "You gave %s the status of a %s mapper.", PlayerICName(targetid), rank);
				SendClientMessage(playerid, COLOR_LIGHTBLUE, str);
			}
			if(strcmp(rank, "manager", true) == 0)
			{
				PlayerInfo[targetid][pTag] = NTAG_MANAGERMAPPER;
				PlayerInfo[targetid][pMapper] = MAPPERRANK_MANAGER;
				format(str, sizeof(str), "You have been given the status of a %s Mapper.", rank);
				SendClientMessage(targetid, COLOR_LIGHTBLUE, str);
				format(str, sizeof(str), "{FF0000}AdmWarning{FFFFFF}: %s has been given the status of a %s Mapper by %s.", PlayerICName(targetid), rank, PlayerICName(playerid));
				ABroadCast(COLOR_WHITE, str, 1);
				format(str, sizeof(str), "You gave %s the status of a %s mapper.", PlayerICName(targetid), rank);
				SendClientMessage(playerid, COLOR_LIGHTBLUE, str);
			}
		}
		else return SendClientMessage(playerid, COLOR_GRAD2, "Invalid rank specified.");
	}
	return 1;
}

CMD:makedev(playerid, params[])
{
	if(PlayerInfo[playerid][pDev] <= DEVRANK_SENIOR && PlayerInfo[playerid][pAdmin] < 1337) return SendClientMessage(playerid, COLOR_GRAD2, "You are not authorized to use this command.");
	new targetid, rank[24];
	new str[128];
	if(sscanf(params, "us[24]", targetid, rank))
	{
		SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /makedev [playerid] [rank]");
		SendClientMessage(playerid, COLOR_GRAD2, "{00BFFF}Usage:{FFFFFF} 'None' 'Junior' 'Senior' 'Manager' or 'Lead'");
	}
	else
	{
		if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, COLOR_GREY, "{FF0000}Error:{FFFFFF} That player isn't connected.");

		if(strcmp(rank, "none", true) == 0)
		{
			format(str, sizeof(str), "{FF0000}AdmWarning{FFFFFF}: %s has removed %s's status as a developer.", PlayerICName(playerid), PlayerICName(targetid));
			ABroadCast(COLOR_WHITE, str, 1);
			SendClientMessage(targetid, COLOR_LIGHTBLUE, "You are no longer a developer.");
			format(str, sizeof(str), "You removed %s's developer status.", PlayerICName(targetid));
			SendClientMessage(playerid, COLOR_LIGHTBLUE, str);
			PlayerInfo[targetid][pDev] = DEVRANK_NONE;
			if(PlayerInfo[playerid][pLevel] >= 2)PlayerInfo[targetid][pTag] = NTAG_PLAYER;
			else PlayerInfo[targetid][pTag] = NTAG_NEWBIE;
			return 1;
		}
		else if(strcmp(rank, "junior", true) == 0)
		{
			PlayerInfo[targetid][pTag] = NTAG_JUNIORDEV;
			PlayerInfo[targetid][pDev] = DEVRANK_JUNIOR;
			format(str, sizeof(str), "You have been given the status of a %s developer.", rank);
			SendClientMessage(targetid, COLOR_LIGHTBLUE, str);
			format(str, sizeof(str), "{FF0000}AdmWarning{FFFFFF}: %s has been given the status of a %s developer by %s.", PlayerICName(targetid), rank, PlayerICName(playerid));
			ABroadCast(COLOR_WHITE, str, 1);
			format(str, sizeof(str), "You gave %s the status of a %s developer.", PlayerICName(targetid), rank);
			SendClientMessage(playerid, COLOR_LIGHTBLUE, str);
		}
		else if(strcmp(rank, "senior", true) == 0)
		{
			PlayerInfo[targetid][pTag] = NTAG_SENIORDEV;
			PlayerInfo[targetid][pDev] = DEVRANK_SENIOR;
			format(str, sizeof(str), "You have been given the status of a %s developer.", rank);
			SendClientMessage(targetid, COLOR_LIGHTBLUE, str);
			format(str, sizeof(str), "{FF0000}AdmWarning{FFFFFF}: %s has been given the status of a %s developer by %s.", PlayerICName(targetid), rank, PlayerICName(playerid));
			ABroadCast(COLOR_WHITE, str, 1);
			format(str, sizeof(str), "You gave %s the status of a %s developer.", PlayerICName(targetid), rank);
			SendClientMessage(playerid, COLOR_LIGHTBLUE, str);
		}
		else if(strcmp(rank, "manager", true) == 0)
		{
			PlayerInfo[targetid][pTag] = NTAG_MANAGERDEV;
			PlayerInfo[targetid][pDev] = DEVRANK_MANAGER;
			format(str, sizeof(str), "You have been given the status of a %s developer.", rank);
			SendClientMessage(targetid, COLOR_LIGHTBLUE, str);
			format(str, sizeof(str), "{FF0000}AdmWarning{FFFFFF}: %s has been given the status of Development %s by %s.", PlayerICName(targetid), rank, PlayerICName(playerid));
			ABroadCast(COLOR_WHITE, str, 1);
			format(str, sizeof(str), "You gave %s the status of a %s developer.", PlayerICName(targetid), rank);
			SendClientMessage(playerid, COLOR_LIGHTBLUE, str);
		}
		else if(strcmp(rank, "lead", true) == 0)
		{
			PlayerInfo[targetid][pTag] = NTAG_LEADDEV;
			PlayerInfo[targetid][pDev] = DEVRANK_LEAD;
			format(str, sizeof(str), "You have been given the status of a %s developer.", rank);
			SendClientMessage(targetid, COLOR_LIGHTBLUE, str);
			format(str, sizeof(str), "{FF0000}AdmWarning{FFFFFF}: %s has been given the status of a %s developer by %s.", PlayerICName(targetid), rank, PlayerICName(playerid));
			ABroadCast(COLOR_WHITE, str, 1);
			format(str, sizeof(str), "You gave %s the status of a %s developer.", PlayerICName(targetid), rank);
			SendClientMessage(playerid, COLOR_LIGHTBLUE, str);
		}
		else
		{
			return SendClientMessage(playerid, COLOR_GRAD2, "Invalid rank specified.");
		}
	}
	return 1;
}

CMD:omakemapper(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] >= 1337 || PlayerInfo[playerid][pMapper] >= 3 || PlayerInfo[playerid][pDev] >= 3)
	{
		new name[MAX_PLAYER_NAME], rank[24];
		if(sscanf(params, "s[24]s[24]", name, rank))
		{
			SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /omakemapper [Firstname_Lastname] [rank]");
			SendClientMessage(playerid, COLOR_GRAD2, "{00BFFF}Usage:{FFFFFF} 'None' 'Regular' 'Senior' or 'Manager'");
		}
		else
		{
			if(IsPlayerConnected(GetPlayerIDFromName(name))) return SendClientMessage(playerid, COLOR_GREY, "That player is currently online.");
			new query[128];
			mysql_format(sqlGameConnection, query, sizeof(query), "SELECT * FROM `players` WHERE `Name` = '%e' LIMIT 1", name);
			mysql_pquery(sqlGameConnection, query, "onomakemapper", "ssd", name, rank, playerid);
			return 1;
		}
	}
	return 1;
}

CMD:omakedev(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] >= 1337 || PlayerInfo[playerid][pDev] >= 3)
	{
		new name[MAX_PLAYER_NAME], rank[24];
		if(sscanf(params, "s[24]s[24]", name, rank))
		{
			SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /omakedev [Firstname_Lastname] [rank]");
			SendClientMessage(playerid, COLOR_GRAD2, "{00BFFF}Usage:{FFFFFF} 'None' 'Junior' 'Senior' 'Manager' or 'Lead'");
		}
		else
		{
			if(IsPlayerConnected(GetPlayerIDFromName(name))) return SendClientMessage(playerid, COLOR_GREY, "That player is currently online.");
			new query[128];
			mysql_format(sqlGameConnection, query, sizeof(query), "SELECT * FROM `players` WHERE `Name` = '%e' LIMIT 1", name);
			mysql_pquery(sqlGameConnection, query, "OnOMakeDev", "ssd", name, rank, playerid);
			return 1;
		}
	}
	return 1;
}

CMD:omaketester(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] >= 1337 || PlayerInfo[playerid][pTester] >= TESTERRANK_MANAGER)
	{
		new name[MAX_PLAYER_NAME], rank[16];

		if(sscanf(params, "s[24]s[16]", name, rank))
			return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /omaketester [full name(case sensitive)] [none, regular, senior, manager]");
		if(IsPlayerConnected(GetPlayerIDFromName(name)))
			return SendClientMessage(playerid, COLOR_GREY, "That player is currently online.");

		new query[128];
		mysql_format(sqlGameConnection, query, sizeof(query), "SELECT * FROM `players` WHERE `Name` = '%e' LIMIT 1", name);
		mysql_pquery(sqlGameConnection, query, "OnOMakeTester", "ssd", name, rank, playerid);
		return 1;
	}
	else
	{
		AdmErrorMsg;
	}
	return 1;
}

CMD:omakehelper(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] >= 1337 || PlayerInfo[playerid][pHelper] >= 3)
	{
		new name[MAX_PLAYER_NAME + 1];
		new rank[16];

		if(sscanf(params, "s[24]s[16]", name, rank))
			return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /omakehelper [full name(case sensitive)] [none, helper, senior]");
		if(IsPlayerConnected(GetPlayerIDFromName(name)))
			return SendClientMessage(playerid, COLOR_GREY, "That player is currently online.");

		mysql_format(sqlGameConnection, sqlstring, sizeof(sqlstring), "SELECT * FROM `players` WHERE `Name` = '%e'", name);
		mysql_pquery(sqlGameConnection, sqlstring, "OnOMakeHelper", "iss", playerid, name, rank);
	}
	else
	{
		return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command.");
	}
	return 1;
}

CMD:makehelper(playerid, params[])
{
	if(PlayerInfo[playerid][pHelper] < 3 && PlayerInfo[playerid][pAdmin] < 1337) return SendClientMessage(playerid, COLOR_GRAD2, "You are not authorized to use this command.");
	new targetid, rank[10];
	new str[128];
	if(sscanf(params, "us[10]", targetid, rank))
	{
		SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /makehelper [playerid] [rank]");
		SendClientMessage(playerid, COLOR_GRAD2, "{00BFFF}Usage:{FFFFFF} 'None' 'Trial' 'Helper' 'Senior' 'Head' 'Director'");
		return 1;
	}
	else
	{
		new rnkname2[50];
		if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, COLOR_GREY, "{FF0000}Error:{FFFFFF} That player isn't connected.");
		if(strcmp(rank, "none", true) == 0 || strcmp(rank, "helper", true) == 0 || strcmp(rank, "senior", true) == 0 || strcmp(rank, "head", true) == 0 || strcmp(rank, "director", true) == 0 || strcmp(rank, "trial", true) == 0)
		{
			if(strcmp(rank, "none", true) == 0)
			{
				if(PlayerInfo[targetid][pHelper] == 0) return SendClientMessage(playerid, COLOR_GREY, "That player isn't a helper.");
				format(str, sizeof(str), "{FF0000}AdmWarning{FFFFFF}: %s has removed %s's helper status.", PlayerICName(playerid), PlayerICName(targetid));
				ABroadCast(COLOR_LIGHTRED, str, 1);
				SendClientMessage(targetid, COLOR_LIGHTBLUE, "* You are no longer a helper.");
				format(str, sizeof(str), "* You removed %s from the helper team.", PlayerICName(targetid));
				SendClientMessage(playerid, COLOR_LIGHTBLUE, str);
				PlayerInfo[targetid][pHelper] = 0;
				if(PlayerInfo[playerid][pLevel] >= 2)PlayerInfo[targetid][pTag] = NTAG_PLAYER;
				else PlayerInfo[targetid][pTag] = NTAG_NEWBIE;
				return 1;
			}
			if(strcmp(rank, "helper", true) == 0)
			{
				PlayerInfo[targetid][pTag] = NTAG_HELPER;
				PlayerInfo[targetid][pHelper] = 2;
				rnkname2 = "helper";
			}
			if(strcmp(rank, "senior", true) == 0)
			{
				PlayerInfo[targetid][pTag] = NTAG_SHELPER;
				PlayerInfo[targetid][pHelper] = 3;
				rnkname2 = "senior helper";
			}
			if(strcmp(rank, "trial", true) == 0)
			{
				PlayerInfo[targetid][pTag] = NTAG_THELPER;
				PlayerInfo[targetid][pHelper] = 1;
				rnkname2 = "trial helper";
			}
			if(strcmp(rank, "head", true) == 0)
			{
				if(PlayerInfo[playerid][pAdmin] >= 1337 || PlayerInfo[playerid][pHelper] >= 4)
				{
					PlayerInfo[targetid][pTag] = NTAG_HHELPER;
					PlayerInfo[targetid][pHelper] = 4;
					rnkname2 = "head helper";
				}
				else return SendClientMessage(playerid, COLOR_GRAD2, "You are not authorized to make head helpers.");
			}
			if(strcmp(rank, "director", true) == 0)
			{
				if(PlayerInfo[playerid][pAdmin] >= 1337 || PlayerInfo[playerid][pHelper] >= 4)
				{
					PlayerInfo[targetid][pTag] = NTAG_DOPR;
					PlayerInfo[targetid][pHelper] = 5;
					rnkname2 = "Director of The Helpers Team";
				}
				else return SendClientMessage(playerid, COLOR_GRAD2, "You are not authorized to make director helpers.");
			}
			format(str, sizeof(str), "You have been given the status of a %s.", rnkname2);
			SendClientMessage(targetid, COLOR_LIGHTBLUE, str);
			format(str, sizeof(str), "{FF0000}AdmWarning{FFFFFF}: %s has been given the status of a '%s' by %s.", PlayerICName(targetid), rnkname2, PlayerICName(playerid));
			ABroadCast(COLOR_LIGHTRED, str, 1);
			format(str, sizeof(str), "You gave %s the status of a %s.", PlayerICName(targetid), rnkname2);
			SendClientMessage(playerid, COLOR_LIGHTBLUE, str);
		}
		else return SendClientMessage(playerid, COLOR_GRAD2, "Invalid rank specified.");
	}
	return 1;
}

CMD:newbie(playerid, params[])
{
	new msg[1024], name[24], string[1250];
	if(gPlayerLogged[playerid] == 0) return SendClientMessage(playerid, COLOR_GREY, "You havent logged in yet.");
	if(PlayerInfo[playerid][pTut] == 0) return 1;
	if((nonewbie) && PlayerInfo[playerid][pAdmin] < 3) return SendClientMessage(playerid, COLOR_GREY, "The Newbie channel has been disabled by an Admin.");
	if(PlayerInfo[playerid][pNewbieMuted] == 1) return SendClientMessage(playerid, COLOR_GREY, "You are banned from speaking in that channel.");
	if(PlayerInfo[playerid][pTogNewbie]) return SendClientMessage(playerid, COLOR_GREY, "Newbie chat channel is currently turned off, use /tognewbie.");
	if(gettime() < (UseNewbieTimer[playerid] + 50))
	{
		format(string, sizeof(string), "You have to wait %d seconds before you can use /newbie again!", (UseNewbieTimer[playerid] + 50) - gettime());
		SendClientMessage(playerid, COLOR_GREY, string);
		return 1;
	}
	else
	{
		strmid(name, str_replace('_', ' ', PlayerName(playerid)), 0, MAX_PLAYER_NAME);
		if(sscanf(params, "s[1024]", msg)) return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} (/newb)ie [message]");
		{
			new plevel = PlayerInfo[playerid][pLevel], hlevel = PlayerInfo[playerid][pHelper], alevel = PlayerInfo[playerid][pAdmin], vlevel = PlayerInfo[playerid][pDonateRank], stealthed = PlayerInfo[playerid][pStealthed];
			if(PlayerInfo[playerid][pTag] == 0)
			{
				if(plevel >= 2 && vlevel == 0 && alevel == 0 && stealthed == 0) format(string, sizeof(string), "** Player Level(%d) %s [%d]: %s **", PlayerInfo[playerid][pLevel], name, playerid, msg);
				if(plevel == 1 && vlevel == 0 && alevel == 0 && stealthed == 0) format(string, sizeof(string), "** Newbie Level(%d) %s [%d]: %s **", PlayerInfo[playerid][pLevel], name, playerid, msg);
				if(hlevel == 1) format(string, sizeof(string), "** Helper Level(%d) %s [%d]: %s **", PlayerInfo[playerid][pLevel], PlayerICName(playerid), playerid, msg);
				if(hlevel >= 2) format(string, sizeof(string), "** Head Helper Level(%d) %s [%d]: %s **", PlayerInfo[playerid][pLevel], name, playerid, msg);
				if(vlevel == 1) format(string, sizeof(string), "** Bronze VIP Level(%d) %s [%d]: %s **", PlayerInfo[playerid][pLevel], name, playerid, msg);
				if(vlevel == 2) format(string, sizeof(string), "** Silver VIP Level(%d) %s [%d]: %s **", PlayerInfo[playerid][pLevel], name, playerid, msg);
				if(vlevel == 3) format(string, sizeof(string), "** Gold VIP Level(%d) %s [%d]: %s **", PlayerInfo[playerid][pLevel],  name, playerid, msg);
				if(vlevel == 4) format(string, sizeof(string), "** Platinum VIP Level(%d) %s [%d]: %s **", PlayerInfo[playerid][pLevel], name, playerid, msg);
				if(alevel >= 2 && stealthed == 0) format(string, sizeof(string), "** Admin Level(%d) %s [%d]: %s **", PlayerInfo[playerid][pLevel],  name, playerid, msg);
			}
			else if(PlayerInfo[playerid][pTag] == NTAG_NEWBIE)
			{
				format(string, sizeof(string), "** Newbie Level(%d) %s [%d]: %s **", PlayerInfo[playerid][pLevel], name, playerid, msg);
			}
			else if(PlayerInfo[playerid][pTag] == NTAG_PLAYER)
			{
				format(string, sizeof(string), "** Player Level(%d) %s [%d]: %s **", PlayerInfo[playerid][pLevel], name, playerid, msg);
			}
			else if(PlayerInfo[playerid][pTag] == NTAG_BVIP)
			{
				format(string, sizeof(string), "** Bronze VIP Level(%d) %s [%d]: %s **", PlayerInfo[playerid][pLevel], name, playerid, msg);
			}
			else if(PlayerInfo[playerid][pTag] == NTAG_SVIP)
			{
				format(string, sizeof(string), "** Silver VIP Level(%d) %s [%d]: %s **", PlayerInfo[playerid][pLevel], name, playerid, msg);
			}
			else if(PlayerInfo[playerid][pTag] == NTAG_GVIP)
			{
				format(string, sizeof(string), "** Gold VIP Level(%d) %s [%d]: %s **", PlayerInfo[playerid][pLevel], name, playerid, msg);
			}
			else if(PlayerInfo[playerid][pTag] == NTAG_DVIP)
			{
				format(string, sizeof(string), "** Platinum VIP Level(%d) %s [%d]: %s **", PlayerInfo[playerid][pLevel], name, playerid, msg);
			}
			else if(PlayerInfo[playerid][pTag] == NTAG_HELPER)
			{
				format(string, sizeof(string), "** Helper Level(%d) %s [%d]: %s **", PlayerInfo[playerid][pLevel], name, playerid, msg);
			}
			else if(PlayerInfo[playerid][pTag] == NTAG_SHELPER)
			{
				format(string, sizeof(string), "** Senior Helper Level(%d) %s [%d]: %s **", PlayerInfo[playerid][pLevel], name, playerid, msg);
			}
			else if(PlayerInfo[playerid][pTag] == NTAG_HHELPER)
			{
				format(string, sizeof(string), "** Head Helper Level(%d) %s [%d]: %s **", PlayerInfo[playerid][pLevel], name, playerid, msg);
			}
			else if(PlayerInfo[playerid][pTag] == NTAG_DOPR)
			{
				format(string, sizeof(string), "** Director of The Helpers Team Level(%d) %s [%d]: %s **", PlayerInfo[playerid][pLevel], name, playerid, msg);
			}
			else if(PlayerInfo[playerid][pTag] == NTAG_ADMIN)
			{
				format(string, sizeof(string), "** Admin Level(%d) %s [%d]: %s **", PlayerInfo[playerid][pLevel], name, playerid, msg);
			}
			else if(PlayerInfo[playerid][pTag] == NTAG_JUNIORDEV)
			{
				format(string, sizeof(string), "** Junior Developer Level(%d) %s [%d]: %s **", PlayerInfo[playerid][pLevel], PlayerICName(playerid), playerid, msg);
			}
			else if(PlayerInfo[playerid][pTag] == NTAG_SENIORDEV)
			{
				format(string, sizeof(string), "** Senior Developer Level(%d) %s [%d]: %s **", PlayerInfo[playerid][pLevel], name, playerid, msg);
			}
			else if(PlayerInfo[playerid][pTag] == NTAG_MANAGERDEV)
			{
				format(string, sizeof(string), "** Development Manager Level(%d) %s [%d]: %s **", PlayerInfo[playerid][pLevel], name, playerid, msg);
			}
			else if(PlayerInfo[playerid][pTag] == NTAG_LEADDEV)
			{
				format(string, sizeof(string), "** Lead Developer Level(%d) %s [%d]: %s **", PlayerInfo[playerid][pLevel], name, playerid, msg);
			}
			else if(PlayerInfo[playerid][pTag] == NTAG_FAMED)
			{
				format(string, sizeof(string), "** Famed Member Level(%d) %s [%d]: %s **", PlayerInfo[playerid][pLevel], name, playerid, msg);
			}
			else if(PlayerInfo[playerid][pTag] == NTAG_OLDSCHOOL)
			{
				format(string, sizeof(string), "** Old School Level(%d) %s [%d]: %s **", PlayerInfo[playerid][pLevel], name, playerid, msg);
			}
			else if(PlayerInfo[playerid][pTag] == NTAG_MODOLDSCHOOL)
			{
				format(string, sizeof(string), "** Old School Moderator Level(%d) %s [%d]: %s **", PlayerInfo[playerid][pLevel], name, playerid, msg);
			}
			else if(PlayerInfo[playerid][pTag] == NTAG_MANAGERFAMED)
			{
				format(string, sizeof(string), "** Famed Manager Level(%d) %s [%d]: %s **", PlayerInfo[playerid][pLevel], name, playerid, msg);
			}
			else if(PlayerInfo[playerid][pTag] == NTAG_ECONO)
			{
				format(string, sizeof(string), "** Player Level(%d) %s [%d]: %s **", PlayerInfo[playerid][pLevel], name, playerid, msg);
			}
			else if(PlayerInfo[playerid][pTag] == NTAG_TESTER)
			{
				format(string, sizeof(string), "** Tester Level(%d) %s [%d]: %s **", PlayerInfo[playerid][pLevel], name, playerid, msg);
			}
			else if(PlayerInfo[playerid][pTag] == NTAG_STESTER)
			{
				format(string, sizeof(string), "** Senior Tester Level(%d) %s [%d]: %s **", PlayerInfo[playerid][pLevel], name, playerid, msg);
			}
			else if(PlayerInfo[playerid][pTag] == NTAG_MAPPER)
			{
				format(string, sizeof(string), "** Mapper Level(%d) %s [%d]: %s **", PlayerInfo[playerid][pLevel], name, playerid, msg);
			}
			else if(PlayerInfo[playerid][pTag] == NTAG_SENIORMAPPER)
			{
				format(string, sizeof(string), "** Senior Mapper Level(%d) %s [%d]: %s **", PlayerInfo[playerid][pLevel], name, playerid, msg);
			}
			else if(PlayerInfo[playerid][pTag] == NTAG_MANAGERMAPPER)
			{
				format(string, sizeof(string), "** Mapping Manager Level(%d) %s [%d]: %s **", PlayerInfo[playerid][pLevel], name, playerid, msg);
			}
			else if(PlayerInfo[playerid][pTag] == NTAG_MANAGERTESTER)
			{
				format(string, sizeof(string), "** Beta-Tester Manager Level(%d) %s [%d]: %s **", PlayerInfo[playerid][pLevel], name, playerid, msg);
			}
			else if(PlayerInfo[playerid][pTag] == NTAG_CUSTOM)
			{
				format(string, sizeof(string), "** %s Level(%d) %s [%d]: %s **", PlayerInfo[playerid][pLevel], CustomTag[playerid], name, playerid, msg);
			}
			else if(PlayerInfo[playerid][pTag] == PlayerInfo[playerid][pNewbieTagName]){
				format(string, sizeof(string), "** %s %s [%d]: %s **", PlayerInfo[playerid][pNewbieTagName], name, playerid, msg);
			}
		}
	}
	if( strlen( string ) > 175 ) return SendClientMessage( playerid, COLOR_GREY, "Your message was too long, try shorten it and try again." );
	OOCNewbie(NEWBIE_COLOR, string);
	if(PlayerInfo[playerid][pAdmin] <= 1 && PlayerInfo[playerid][pHelper] <= 0) UseNewbieTimer[playerid] = gettime();
	return 1;
}

CMD:newb(playerid, params[]) return cmd_newbie(playerid, params);

CMD:changepass(playerid, params[])
{
	if(gPlayerLogged[playerid] == 0) return SendClientMessage(playerid, COLOR_GREY, "{FF0000}Error:{FFFFFF} You are not logged in.");

	new newpassword[65];
	new str[128];
	if(sscanf(params, "s[65]", newpassword)) return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /changepass [newpassword]");
	format(str, sizeof(str), "You have changed your account password to '%s'.", newpassword);
	SendClientMessage(playerid, COLOR_YELLOW, str);

	//Hash & save
	HashPassword(newpassword, playerid);
	return 1;
}

/*CMD:ipcheck(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] >= 1)
	{
		new tempstr[128];
		if(!sscanf(params, "s[64]", tempstr))
		{
			new dotcount = 0;
			for(new i = 0; i < strlen(tempstr); i++)
			{
				if(tempstr[i] == '.') dotcount++;
			}
			if(dotcount == 3)
			{
				new link[128];
				format(ipchecking[playerid], 24, "%s", tempstr);
				format(link, sizeof(link), "api.ipinfodb.com/v3/ip-country/?key=dc38a04953231bea8bb1203f36fd244393b50bf52e59afb40ae1e26db9fdbce6&ip=%s", tempstr);
				HTTP(playerid, HTTP_GET, link, "", "IPCheckResponse");
			}
			else
			{
				new query[256];
				mysql_format(sqlGameConnection, query, sizeof(query), "SELECT `IP` FROM `players` WHERE `Name` = '%e' LIMIT 1", tempstr);
				mysql_pquery(sqlGameConnection, query, "OnOIPCheck", "is", playerid, tempstr);
			}
		}
		else
		{
			SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /oipcheck [Name_Surname or IP]");
		}
	}
	else return AdmErrorMsg;
	return 1;
}*/

CMD:unbanip(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] >= 1337 || PlayerInfo[playerid][pBanAppealer])
	{

		new query[128], ip[16];
		new str[128];
		if(sscanf(params, "s[16]", ip)) return SendClientMessage(playerid, COLOR_WHITE, "{00BFFF}Usage:{FFFFFF} /unbanip [ip address]");

		format(str, sizeof(str), "unbanip %s", ip);
		SendRconCommand(str);
		SendRconCommand("reloadbans");

		mysql_format(sqlGameConnection, query, sizeof(query), "SELECT * FROM `banlist` WHERE `IP` = '%e' LIMIT 1", ip);
		mysql_pquery(sqlGameConnection, query, "OnUnbanIP", "is", playerid, ip);

		strmid(sendername, PlayerOOCName(playerid), 0, MAX_PLAYER_NAME);
		format(str, sizeof(str), "{FF0000}AdmWarning{FFFFFF}: %s has unbanned IP: %s", sendername, ip);
		ABroadCast(COLOR_WHITE, str, 1);
		return 1;
	}
	else
	{
		AdmErrorMsg;
	}
	return 1;
}

CMD:banaccount(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] > 1 || PlayerInfo[playerid][pBanAppealer])
	{
		new query[500], reason[64], name[MAX_PLAYER_NAME];
		new str[128];
		if(sscanf(params, "s[24]s[64]", name, reason)) return SendClientMessage(playerid, COLOR_WHITE, "{00BFFF}Usage:{FFFFFF} /banaccount [full name(case sensitive)] [reason]");
		if(IsPlayerConnected(GetPlayerIDFromName(name))) return SendClientMessage(playerid, COLOR_GREY, "{FF0000}Error:{FFFFFF} that player is connected.");

		if(UseAdmCmdTimer[playerid] > 2)
		{
			format(str, sizeof(str), "{FF6347}SERVER: %s was banned, reason: (autoban) /banaccount spam.", PlayerOOCName(playerid));
			SendClientMessageToAll(COLOR_WHITE, str);

			format(reason, sizeof(reason), "/banaccount spam.");
			BanAccount(playerid, INVALID_PLAYER_ID, reason); //log before banning the account
			return 1;
		}
		UseAdmCmdTimer[playerid]++;
		SetTimerEx("Timer_UseAdmCmd", 3 *1000, 0, "i", playerid);

		mysql_format(sqlGameConnection, query, sizeof(query), "SELECT * FROM `players` WHERE `Name` = '%e' LIMIT 1", name);
		mysql_pquery(sqlGameConnection, query, "OnBanAccount", "iss", playerid, name, reason);
		return 1;
	}
	else
	{
		AdmErrorMsg;
	}
	return 1;
}
//ochangepass
CMD:ochangepass(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] >= 99999)
	{
		new playersname[MAX_PLAYER_NAME], query[128],  newpassword[65];

		if(sscanf(params, "s[24]s[65]", playersname, newpassword)) return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /ochangepass [full name (case sensitive)] [newpassword]");

		new giveplayerid = ReturnUser(playersname);
		if(IsPlayerConnected(giveplayerid)) return SendClientMessage(playerid, COLOR_GREY, "{FF0000}Error:{FFFFFF} That player is currently online.");

		mysql_format(sqlGameConnection, query, sizeof(query), "SELECT `AdminLevel` FROM `players` WHERE `Name` = '%e' LIMIT 1", playersname);
		mysql_pquery(sqlGameConnection, query, "OnOChangePass", "iss", playerid, playersname, newpassword);
		return 1;

	}
	else
	{
		SendClientMessage(playerid, COLOR_GRAD2, "{FF0000}You're not authorized to use that command.");
	}
	return 1;
}

CMD:togspeedo(playerid, params[])
{
	if(CurrentSpeedUnitMPH[playerid] == true)
	{
		SendClientMessage(playerid, COLOR_YELLOW, "You have changed the speed unit to KMH.");
		CurrentSpeedUnitMPH[playerid] = false;
	}
	else
	{
		SendClientMessage(playerid, COLOR_YELLOW, "You have changed the speed unit to MPH.");
		CurrentSpeedUnitMPH[playerid] = true;
	}
	return 1;
}

CMD:lastdriver(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] >= 1)
	{
		if(!ADuty[playerid] && PlayerInfo[playerid][pAdmin] == 1) return SendClientMessage(playerid, COLOR_GREY, "You are not on duty.");
		new vehicleid;
		if(sscanf(params, "d", vehicleid)) return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /lastdriver [vehicleid (from /dl)]");

		if(strmatch(LastDriver[vehicleid], "")) return SendClientMessage(playerid, COLOR_GREY, "{FF0000}Error{FFFFFF}: There is no LastDriver.");

		new str[128];
		format(str, sizeof(str), "{FF0000}[vehicleid: %d] LastDriver{FFFFFF}: %s. Vehicle name: %s.", vehicleid, LastDriver[vehicleid], vehName[GetVehicleModel(vehicleid)-400]);
		SendClientMessage(playerid, COLOR_LIGHTRED, str);
		new playa = ReturnUser(LastDriver[vehicleid]);
		if(IsPlayerConnected(playa))
		{
			if(playa != INVALID_PLAYER_ID)
			{
				format(str, sizeof(str), "{FF0000}[%s: %d] LastCar{FFFFFF}: %d. Vehicle name: %s.", PlayerOOCName(playa), playa, gLastCar[playa], vehName[GetVehicleModel(gLastCar[playa])-400]);
				SendClientMessage(playerid, COLOR_LIGHTRED, str);
			}
		}
		return 1;
	}

	AdmErrorMsg;
	return 1;
}

CMD:togdoubleexp(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] >= 1337 || PlayerInfo[playerid][pDev] >= DEVRANK_LEAD)
	{
		if(!DOUBLE_EXP_MODE) {
			//enable double exp mode
			SendClientMessageToAll(COLOR_LIGHTBLUE, "2x EXP bonus has been enabled.");
			SendRconCommand("hostname Project Roleplay [2x EXP Bonus]");
			DOUBLE_EXP_MODE = 1;
			ADMIN_ENABLED_DOUBLE_EXP_MODE = 1;
		} else {
			//disable double exp mode
			SendClientMessageToAll(COLOR_LIGHTBLUE, "2x EXP bonus has been disabled.");
			SendRconCommand("hostname Project Roleplay");
			DOUBLE_EXP_MODE = 0;
			ADMIN_ENABLED_DOUBLE_EXP_MODE = 0;
		}
	} else {
		AdmErrorMsg;
	}
	return 1;
}

CMD:atogpms(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] > 0 || PlayerInfo[playerid][pDev] >= 2)
	{
		new str[128];
		if(TogPMGlobal)
		{
			format(str, sizeof(str), "{FF0000}AdmWarn{FFFFFF} %s has enabled PM's (/pm)", PlayerOOCName(playerid));
		} else {
			format(str, sizeof(str), "{FF0000}AdmWarn{FFFFFF} %s has disabled PM's (/pm)", PlayerOOCName(playerid));
		}

		TogPMGlobal = !TogPMGlobal;

		SendClientMessageToAll(COLOR_WHITE, str);
	}
	return 1;
}
CMD:atogpm(playerid, params[]) return cmd_atogpms(playerid, params);

CMD:rpm(playerid, params[]) {
	if(lastPMedID[playerid] == INVALID_PLAYER_ID)
		return SendClientMessage(playerid, COLOR_GREY, "You have no PM to reply to.");

	new pmText[128];
	if(sscanf(params, "s[128]", pmText))
		return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /rpm [message]");

	format(pmText, sizeof(pmText), "%i %s", lastPMedID[playerid], pmText);
	cmd_pm(playerid, pmText);
	return 1;
}

CMD:pm(playerid, params[])
{
	if(TogPMGlobal)
		return SendClientMessage(playerid, COLOR_GREY, "This feature is currently disabled.");

	new player2, msg[128];

	if(TogPM[playerid])
		return SendClientMessage(playerid, COLOR_GREY, "You have PM's disabled, /togpm.");

	if((pDeathState[playerid] == PLAYER_STATE_REVIVE || PlayerCuffed[playerid] > 0 || PlayerTazed[playerid] > 0))
		return SendClientMessage(playerid, COLOR_GREY, "You can't do that at this time.");

	if(sscanf(params, "us[128]", player2, msg))
		return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /pm [Playerid/PartOfName] [message]");

	if(!IsPlayerConnected(player2))
		return SendClientMessage(playerid, COLOR_GREY, "Unknown player.");

	if(TogPM[player2])
		return SendClientMessage(playerid, COLOR_GREY, "That player has PM's disabled.");

	if(player2 == INVALID_PLAYER_ID)
		return SendClientMessage(playerid, COLOR_GREY, "That player is not connected.");

	if(player2 == playerid){
		return SendClientMessage(playerid, COLOR_GREY, "You can't pm yourself.");
	}
	if(BlockedPM[player2][playerid]) 
    	return SendClientMessage(playerid, -1, "{FF0000}Error:{FFFFFF} That player has restricted you from private messaging them!");
	if(ADuty[player2] == true) return SendClientMessage(playerid, COLOR_GREY, "Do not disturb an admin on duty! Use /report instead!");
	new str[128];


	LastPM[playerid] = gettime();
	lastPMedID[player2] = playerid;
	if(PlayerInfo[playerid][pAdmin]) format(str, sizeof(str), "(( PM to %s [%d]: %s ))", PlayerOOCName(player2), player2, msg);
	if(PlayerInfo[playerid][pAdmin] >= 2 && PlayerInfo[playerid][pStealthed] == 0)
	{
		format(str, sizeof(str), "(( PM from {F28E3C}%s{FFB900} [%d]: %s ))", PlayerOOCName(playerid), playerid, msg);
	} else {
		format(str, sizeof(str), "(( PM from %s [%d]: %s ))", PlayerOOCName(playerid), playerid, msg);
	}
	if(PlayerInfo[player2][pAdmin]) format(str, sizeof(str), "(( PM from %s [%d]: %s ))", PlayerOOCName(playerid), playerid, msg);
	if(!(PlayerInfo[player2][pAdmin])) SendClientMessage(player2, 0xFFB900ff, str);
	else SendClientMessage(player2, COLOR_LIGHTBLUE, str);

	if(PlayerInfo[player2][pAdmin] >= 2 && PlayerInfo[player2][pStealthed] == 0)
	{
		format(str, sizeof(str), "(( PM to {F28E3C}%s{FFB900} [%d]: %s ))", PlayerOOCName(player2), player2, msg);
	} else {
		format(str, sizeof(str), "(( PM to %s [%d]: %s ))", PlayerOOCName(player2), player2, msg);
	}
	if(PlayerInfo[playerid][pAdmin]) format(str, sizeof(str), "(( PM to %s [%d]: %s ))", PlayerOOCName(player2), player2, msg);
	if(!(PlayerInfo[playerid][pAdmin])) SendClientMessage(playerid, 0xFFB900ff, str);
	else SendClientMessage(playerid, COLOR_LIGHTBLUE, str);

	if(IsPlayerConnected(beingSpectatedID[playerid]) && SpectatingID[beingSpectatedID[playerid]] == playerid)
	{
		format(str, sizeof(str), "[AdmWrn] %s PM'ed %s (ID %d): %s", PlayerOOCName(playerid), PlayerOOCName(player2), player2, msg);
		SendClientMessage(beingSpectatedID[playerid], COLOR_YELLOW, str);
	}
	format(str, sizeof(str), "** (( PM %s to %s: %s )) **", PlayerOOCName(playerid), PlayerOOCName(player2), msg);
	SendShadowMsg(SCOLOR_CYAN, str);
	new year, month, day;
	getdate(year, month, day);
	new hour, minute, second;
	gettime(hour, minute, second);
	hour = FixHour(hour);
	format(str, sizeof(str), "** (( PM %s to %s: %s )) ** at %02d %s %02d:%02d:%02d ", PlayerOOCName(playerid), PlayerOOCName(player2), msg, day, GetMonthFromInt(month), hour, minute, second);
	logswrite("PM.log", str);
	return 1;
}

CMD:apm(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] < 2) return SendClientMessage(playerid, COLOR_RED, "Not authorized");

	new player2, msg[128];

	if(sscanf(params, "us[128]", player2, msg))
		return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /apm [Playerid/PartOfName] [message]");

	if(!IsPlayerConnected(player2))
		return SendClientMessage(playerid, COLOR_GREY, "Unknown player.");

	if(player2 == INVALID_PLAYER_ID)
		return SendClientMessage(playerid, COLOR_GREY, "That player is not connected.");

	new str[128];

	if(PlayerInfo[playerid][pAdmin]) format(str, sizeof(str), "(( PM to %s [%d]: %s ))", PlayerOOCName(player2), player2, msg);
	if(PlayerInfo[playerid][pAdmin] >= 2 && PlayerInfo[playerid][pStealthed] == 0)
	{
		format(str, sizeof(str), "(( PM from {F28E3C}%s{FFB900} [%d]: %s ))", PlayerOOCName(playerid), playerid, msg);
	} else {
		format(str, sizeof(str), "(( PM from %s [%d]: %s ))", PlayerOOCName(playerid), playerid, msg);
	}
	if(PlayerInfo[player2][pAdmin]) format(str, sizeof(str), "(( PM from %s [%d]: %s ))", PlayerOOCName(playerid), playerid, msg);
	if(!(PlayerInfo[player2][pAdmin])) SendClientMessage(player2, 0xFFB900ff, str);
	else SendClientMessage(player2, COLOR_LIGHTBLUE, str);

	if(PlayerInfo[player2][pAdmin] >= 2 && PlayerInfo[player2][pStealthed] == 0)
	{
		format(str, sizeof(str), "(( PM to {F28E3C}%s{FFB900} [%d]: %s ))", PlayerOOCName(player2), player2, msg);
	} else {
		format(str, sizeof(str), "(( PM to %s [%d]: %s ))", PlayerOOCName(player2), player2, msg);
	}
	if(PlayerInfo[playerid][pAdmin]) format(str, sizeof(str), "(( PM to %s [%d]: %s ))", PlayerOOCName(player2), player2, msg);
	if(!(PlayerInfo[playerid][pAdmin])) SendClientMessage(playerid, 0xFFB900ff, str);
	else SendClientMessage(playerid, COLOR_LIGHTBLUE, str);

	if(IsPlayerConnected(beingSpectatedID[playerid]) && SpectatingID[beingSpectatedID[playerid]] == playerid)
	{
		format(str, sizeof(str), "[AdmWrn] %s PM'ed %s (ID %d): %s", PlayerOOCName(playerid), PlayerOOCName(player2), player2, msg);
		SendClientMessage(beingSpectatedID[playerid], COLOR_YELLOW, str);
	}
	format(str, sizeof(str), "[/APM]** (( PM %s to %s: %s )) **", PlayerOOCName(playerid), PlayerOOCName(player2), msg);
	SendShadowMsg(SCOLOR_CYAN, str);
	new year, month, day;
	getdate(year, month, day);
	new hour, minute, second;
	gettime(hour, minute, second);
	hour = FixHour(hour);
	format(str, sizeof(str), "** (( PM %s to %s: %s )) ** at %02d %s %02d:%02d:%02d ", PlayerOOCName(playerid), PlayerOOCName(player2), msg, day, GetMonthFromInt(month), hour, minute, second);
	logswrite("APM.log", str);
	return 1;
}

CMD:blockpm(playerid, params[]) {
    new giveplayerid;

    if(sscanf(params, "u", giveplayerid)) 
        return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /blockpm [Name_Surname/ID]");

    if(!IsPlayerConnected(giveplayerid))
        return SendClientMessage(playerid, -1, "{FF0000}Error:{FFFFFF} You have to specify valid player id!");

    BlockedPM[playerid][giveplayerid] = !BlockedPM[playerid][giveplayerid];

    va_SendClientMessage(playerid, -1, "{FF0000}WARNING:{FFFFFF} You have %s %s(%i) from sending private messages to you.",
     BlockedPM[playerid][giveplayerid] ? "{FF0000}disallowed{FFFFFF}" : "{1ad94d}allowed{FFFFFF}", PlayerOOCName(giveplayerid), giveplayerid);
    return 1;
}

CMD:togpm(playerid, params[])
{
	if(TogPMGlobal) return 1;
	if(IsPlayerConnected(playerid)) {
		if(TogPM[playerid])
		{
			TogPM[playerid] = false;
			SendClientMessage(playerid, 0xFFB900ff, "You have enabled your PM's.");
		} else {
			TogPM[playerid] = true;
			SendClientMessage(playerid, 0xFFB900ff, "You have disabled your PM's.");
		}
	}
	return 1;
}
CMD:bs(playerid, params[])
{
	if(PlayerBlinded[playerid] > 0) return SendClientMessage(playerid, -1, "You can't use this command while blindfolded.");
	if(blackscreened[playerid] == true)
	{
		SetCameraBehindPlayer(playerid);
		blackscreened[playerid] = false;
	}
	else
	{
		SetPlayerCameraPos(playerid, 5022.7349, 4058.9658, 990.7913);
		SetPlayerCameraLookAt(playerid, 5023.7285, 4058.8816, 990.9172);
		blackscreened[playerid] = true;
	}
	return 1;
}

CMD:factionmods(playerid, params[]) return cmd_factionmoderators(playerid, params);
CMD:factionmoderators(playerid, params[])
{
	new query[150];
	if(PlayerInfo[playerid][pFactionMod] == 0 && PlayerInfo[playerid][pAdmin] <= 4) return AdmErrorMsg;
	mysql_format(sqlGameConnection, query, sizeof(query), "SELECT `Name`, `Member` FROM `players` WHERE `FactionMod` = 1");
	mysql_pquery(sqlGameConnection, query, "Onfactionmoderators", "i", playerid);
	return 1;
}

CMD:propmods(playerid, params[])
{
	new query[150];
	if(PlayerInfo[playerid][pBizMod] == 0 && PlayerInfo[playerid][pAdmin] <= 4) return AdmErrorMsg;
	mysql_format(sqlGameConnection, query, sizeof(query), "SELECT `Name` FROM `players` WHERE `BizMod` = 1");
	mysql_pquery(sqlGameConnection, query, "onPropModerators", "i", playerid);
	return 1;
}

//Faction leader chat
CMD:fl(playerid, params[])
{
	new flstring[128],
		flc[128];
	if(IsPlayerRestricted(playerid)) return SendClientMessage(playerid, COLOR_GRAD1, "You can not do this at this time.");
	if(toggedflchat[playerid]) return SendClientMessage(playerid, COLOR_GREY, "You can't use this if you have it toggled off.");
	if(sscanf(params, "s[128]", flc)) return SendClientMessage(playerid, -1, "[USAGE]: /fl [message]");
	if(
		PlayerInfo[playerid][pLeader] > 0 ||
		(PlayerInfo[playerid][pGroup] == GROUP_HITMAN && PlayerInfo[playerid][pGroupRank] >= 5) ||
		(PlayerInfo[playerid][pGroup] == 2 && PlayerInfo[playerid][pGroupRank] > GROUP_CRIME_RANKS-1) ||
		(PlayerInfo[playerid][pGroup] == GROUP_CARTEL && PlayerInfo[playerid][pGroupRank] > GROUP_CARTEL_RANKS-1) ||
		PlayerInfo[playerid][pFactionMod] != 0)
	{
		if(PlayerInfo[playerid][pFactionMod]) format(flstring, sizeof(flstring), "[Faction Mod] %s: %s", PlayerICName(playerid), flc);
		else if(PlayerInfo[playerid][pFactionDirector]) format(flstring, sizeof(flstring), "[Faction Director] %s: %s", PlayerICName(playerid), flc);
		else if(
			PlayerInfo[playerid][pGroup] == 1 ||
			PlayerInfo[playerid][pGroup] == 2 ||
			PlayerInfo[playerid][pGroup] == GROUP_CARTEL
		) format(flstring, sizeof(flstring), "[%s] %s: %s", GetPlayerGroupName(playerid), PlayerInfo[playerid][pMaskName], flc);
		else if(PlayerInfo[playerid][pGroup] == 10) format(flstring, sizeof(flstring), "[S9] Agent %s: %s", PlayerInfo[playerid][pMaskName], flc);
		else format(flstring, sizeof(flstring), "[%s] %s: %s", GetPlayerFactionName(playerid), PlayerICName(playerid), flc);
		SendLeaderMessage(COLOR_LEADER, flstring);
	}
	else return SendClientMessage(playerid, COLOR_GRAD2, "You are not authorized to use this.");
	return 1;
}

CMD:togglefl(playerid, params[])
{
	if(PlayerInfo[playerid][pLeader] > 0 || (PlayerInfo[playerid][pGroup] == 1 && PlayerInfo[playerid][pGroupRank] > GROUP_HITMAN_RANKS-1) || (PlayerInfo[playerid][pGroup] == 2 && PlayerInfo[playerid][pGroupRank] > GROUP_CRIME_RANKS-1) || PlayerInfo[playerid][pFactionMod] != 0)
	{
		if(toggedflchat[playerid] == 0)
		{
			toggedflchat[playerid] = 1;
			SendClientMessage(playerid, COLOR_WHITE, "You have turned the faction leader chat off.");
		}
		else
		{
			toggedflchat[playerid] = 0;
			SendClientMessage(playerid, COLOR_WHITE, "You have turned the faction leader chat on.");
		}
	}
	else
	{
		SendClientMessage(playerid, COLOR_GRAD2, "You are not authorized to use this.");
	}
	return 1;
}

CMD:togbug(playerid, params[])
{
	if(PlayerInfo[playerid][pMember] != FACTION_FBI && PlayerInfo[playerid][pGroup] != GROUP_S9) return AdmErrorMsg;

	PlayerInfo[playerid][pBuggedTog] = !PlayerInfo[playerid][pBuggedTog];

	if(PlayerInfo[playerid][pBuggedTog]) SendClientMessage(playerid, COLOR_GREY, "You have disabled bugged messages.");
	else SendClientMessage(playerid, COLOR_GREY, "You have enabled bugged messages.");
	return 1;
}

CMD:breakcuffs(playerid, params[])
{
	new targetid;
	if(sscanf(params, "u", targetid)) return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /breakcuffs [playerid]");
	if(!IsPlayerInRangeOfPlayer(3.0, playerid, targetid)) return SendClientMessage(playerid, COLOR_GREY, "That player is not near you.");
	if(!IsPlayerConnected(targetid) || targetid == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_GREY, "Invalid playerid.");
	if(PlayerCuffed[targetid] == 0) return SendClientMessage(playerid, COLOR_GREY, "That player is not cuffed.");
	if(targetid == playerid) return SendClientMessage(playerid, COLOR_GREY, "You can not break your own cuffs.");
	if(IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You must not be in any vehicle.");
	if(PlayerInfo[playerid][pScrew] < 1) return SendClientMessage(playerid, COLOR_GREY, "You need a screwdriver to do this.");
	if(IsPlayerRestricted(playerid)) return SendClientMessage(playerid, COLOR_GRAD1, "You can not do this at this time.");

	breakingpcuffs[playerid] = targetid;
	isbreakingcuffs[playerid] = true;
	SetPlayerProgressBarValue(playerid, breakcuffs[playerid], 0);
	ShowPlayerProgressBar(playerid, breakcuffs[playerid]);
	SetPlayerProgressBarValue(targetid, breakcuffs[targetid], 0);
	ShowPlayerProgressBar(targetid, breakcuffs[targetid]);

	SendClientMessage(playerid, COLOR_LIGHTBLUE, "You are now breaking that player's cuffs.");
	SendClientMessage(playerid, COLOR_LIGHTBLUE, "Press your sprint key repeatedly to procceed (default: SPACE)");
	SendClientMessage(targetid, COLOR_LIGHTBLUE, "Your cuffs are being broken by another person.");

	new str[128];
	format(str, sizeof(str), "* %s starts to lockpick %s's cuffs.", PlayerICName(playerid), PlayerICName(targetid));
	ProxDetector(30, playerid, str, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);

	return 1;
}

CMD:summon(playerid, params[])
{
	if(PlayerInfo[playerid][pMember] != FACTION_JD)
		return SendClientMessage(playerid, COLOR_GREY, "You must be a member of the Judicial Department to use this.");

	new suedname[MAX_PLAYER_NAME];
	new str[128];
	if(sscanf(params, "s", suedname))
		return SendClientMessage(playerid, -1, "{00BFFF}Usage:{FFFFFF} /summon [Player Name]");

	if(IsPlayerConnected(GetPlayerIDFromName(suedname)))
	{
		new targetid = GetPlayerIDFromName(suedname);
		PlayerInfo[targetid][pSueNotice] = 1;
		format(str, sizeof(str), "You have summoned %s to the court!", suedname);
		SendClientMessage(playerid, COLOR_LIGHTBLUE, str);
	}
	else
	{
		new query[128];
		mysql_format(sqlGameConnection, query, sizeof(query), "SELECT `Name` FROM `players` WHERE `Name` = '%e'", suedname);
		mysql_pquery(sqlGameConnection, query, "OnPSummonP", "is", playerid, suedname);

	}
	return 1;

}

CMD:reportmute(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] < 1) return AdmErrorMsg;
	new targetid, minutes;
	if(sscanf(params, "ui", targetid, minutes)) return SendClientMessage(playerid, -1, "{00BFFF}Usage:{FFFFFF} /reportmute [playerid/PartOfName] [minutes] (use 0 to unmute).");
	if(targetid == INVALID_PLAYER_ID || !IsPlayerConnected(targetid)) return SendClientMessage(playerid, COLOR_GREY, "Invalid playerid.");
	if(minutes > 60) return SendClientMessage(playerid, COLOR_GREY, "Maximum report mute time is 60 minutes.");

	new str[128];
	if(minutes == 0)
	{
		PlayerInfo[targetid][pRepMuted] = 0;
		format(str, sizeof(str), "You have unmuted %s from using report.", PlayerICName(targetid));
		SendClientMessage(playerid, COLOR_GREY, str);
		SendClientMessage(targetid, COLOR_GREY, "You were unmuted from using report by an admin.");

		format(str, sizeof(str), "{FF0000}AdmWarning{FFFFFF}: %s has unmuted %s from using report.", PlayerOOCName(playerid), PlayerICName(targetid));
		ABroadCast(COLOR_WHITE, str, 1);
	}

	if(minutes > 0)
	{
		PlayerInfo[targetid][pRepMuted] = 60*minutes; // convert minutes to seconds
		if(PlayerInfo[playerid][pAdmin] == 1 || PlayerInfo[playerid][pStealthed] == 1)
		{
			format(str, sizeof(str), "You were muted from using report by an admin for %d minutes.", minutes);
			SendClientMessage(targetid, COLOR_GREY, str);
		}
		else
		{
			format(str, sizeof(str), "You were muted from using report by %s for %d minutes.", PlayerOOCName(playerid), minutes);
			SendClientMessage(targetid, COLOR_GREY, str);
		}

		format(str, sizeof(str), "{FF0000}AdmWarning{FFFFFF}: %s has muted %s from using report for %d minutes.", PlayerOOCName(playerid), PlayerICName(targetid), minutes);
		ABroadCast(COLOR_WHITE, str, 1);
	}

	return 1;
}

CMD:myinsurance(playerid, params[])
{
	if(PlayerInfo[playerid][pInsurance] == 0)
	{
		SendClientMessage(playerid, COLOR_GREY, "You have no insurance. You can get an insurance at the All Saints Hospital for $50,000.");
		SendClientMessage(playerid, COLOR_GREY, "TIP: Insurance reduces your hospital bills by 25 percents and reduces your recovery time at the hospital.");
	}
	else
	{
		new str[128];
		format(str, sizeof(str), "You have %d insurance uses left.", PlayerInfo[playerid][pInsurance]);
		SendClientMessage(playerid, COLOR_GREY, str);
		SendClientMessage(playerid, COLOR_GREY, "TIP: Insurance reduces your hospital bills by 25 percents and reduces your recovery time at the hospital.");
	}
	return 1;
}

CMD:buyinsurance(playerid, params[])
{
	if(!IsPlayerInRangeOfPoint(playerid, 3.0, 1174.5452, -1321.2003, 1089.5674)) return SendClientMessage(playerid, COLOR_GREY, "You are not by the computer inside the All Saints Hospital.");
	if(PlayerInfo[playerid][pInsurance] > 0) return SendClientMessage(playerid, COLOR_GREY, "You already have insurance (/myinsurance).");
	new str[128];
	if(PlayerInfo[playerid][pCash] < insuranceprice)
	{
		format(str, sizeof(str), "You do not have enough money (price: %d).", insuranceprice);
		SendClientMessage(playerid, COLOR_GREY, str);
		return 1;
	}

	if(isnull(params))
	{
		SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /buyinsurance confirm");
		SendClientMessage(playerid, COLOR_GREY, "TIP: This will give you insurance for the next 5 times you recover in hospital.");
		SendClientMessage(playerid, COLOR_GREY, "TIP: Insurance will reduce your hospital bills by 25 percents, and make you recover faster.");
		format(str, sizeof(str), "The current price for insurance is: %d", insuranceprice);
		SendClientMessage(playerid, COLOR_GREY, str);
		return 1;
	}

	if(!strcmp(params, "confirm", true))
	{
		PlayerInfo[playerid][pInsurance] = 5;
		GiveMoney(playerid, -insuranceprice);
		SendClientMessage(playerid, COLOR_LIGHTBLUE, "Congratulations, you have bought insurance! (/myinsurance)");
	}
	else SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /buyinsurance confirm");

	return 1;
}

CMD:usebeer(playerid, params[])
{
	if(PlayerInfo[playerid][pBeer] < 1) return SendClientMessage(playerid, COLOR_GREY, "You don't have a beer, visit a 24/7 and buy a case of beer.");
	if(IsPlayerRestricted(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You can not do this right now.");
	if(IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_GREY, "{FF0000}Error:{FFFFFF} You cannot use this in a vehicle.");

	PlayerInfo[playerid][pBeer]--;
	SetPlayerSpecialAction(playerid, SPECIAL_ACTION_DRINK_BEER);
	PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
	displayCenterHUDInfo(playerid,  "~r~Beer~w~ withdrawn!~n~press LMB to drink, press F to drop.", 8); //display for 8 seconds
	return 1;
}

CMD:removecrimes(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] < 1337) return AdmErrorMsg;
	new psqlid;
	if(sscanf(params, "d", psqlid)) return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /removecrimes [SQLID]");

	new query[128], rows, fields, CrimeType, CrimeReason[128], cstr[5000], Date[50], copname[28], isEnabled, Cache:result;
	mysql_format(sqlGameConnection, query, sizeof(query), "SELECT * FROM `newcrimes` WHERE `CrimePID` = %d ORDER BY `CrimeID` DESC LIMIT 20", psqlid);
	result = mysql_query(sqlGameConnection, query);
	cache_get_data(rows, fields, sqlGameConnection);
	searchingsqlid[playerid] = psqlid;

	if(!rows) return ShowPlayerDialog(playerid, DIALOG_UNUSED, DIALOG_STYLE_MSGBOX, "Player Charges", "That player has no crimes on record.", "Done", "");
	format(cstr, sizeof(cstr), "Date\tType\tIssuer\tReason\n");
	for(new i = 0; i < rows; i++)
	{
		cache_get_field_content(i, "CrimeReason", CrimeReason);
		cache_get_field_content(i, "RealName", copname);
		cache_get_field_content(i, "Date", Date);
		CrimeType = cache_get_field_content_int(i, "CrimeType");
		isEnabled = cache_get_field_content_int(i, "CrimeEnabled");
		if(isEnabled) format(cstr, sizeof(cstr), "%s{1CC343}(%s)\t{1CC343}%s\t{1CC343}%s\t{1CC343}%s\n", cstr, Date, GetCrimeType(CrimeType), copname, CrimeReason);
		else format(cstr, sizeof(cstr), "%s{FF5F5F}(%s)\t{FF5F5F}%s\t{FF5F5F}%s\t{FF5F5F}%s{FFFFFF}\n", cstr, Date, GetCrimeType(CrimeType), copname, CrimeReason);
	}
	cache_delete(Cache:result, sqlGameConnection);
	ShowPlayerDialog(playerid, DIALOG_CHARGES_REMOVE, DIALOG_STYLE_TABLIST_HEADERS, "Crime Removal Dialog", cstr, "Remove", "Close");
	return 1;
}

// /osetnumber for set offline player's number. ~Troy Bradshaw [ GOLDEN ]

CMD:osetnumber(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] >= 1337 || PlayerInfo[playerid][pDev] >= 3 || PlayerInfo[playerid][pBizMod] == 1)
	{
		new name[MAX_PLAYER_NAME], num;
		if(sscanf(params, "s[24]i", name, num))
		{
			SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /osetnumber [Firstname_Lastname] [number]");
		}
		else
		{
			if(IsPlayerConnected(GetPlayerIDFromName(name))) return SendClientMessage(playerid, COLOR_GREY, "That player is currently online.");
			new query[128];
			mysql_format(sqlGameConnection, query, sizeof(query), "SELECT * FROM `players` WHERE `Name` = '%e' LIMIT 1", name);
			mysql_pquery(sqlGameConnection, query, "oSetNum", "sid", name, num, playerid);
			return 1;
		}
	}
	return 1;
}

CMD:setbadgenumber(playerid, params[])
{
	if(PlayerInfo[playerid][pMember] != FACTION_SAPD && PlayerInfo[playerid][pMember] != FACTION_FBI && PlayerInfo[playerid][pMember] != FACTION_FMD && PlayerInfo[playerid][pMember] != FACTION_GOV && PlayerInfo[playerid][pMember] != FACTION_SANG) return AdmErrorMsg;
	if(PlayerInfo[playerid][pRank] < 4) return SendClientMessage(playerid, COLOR_GREY, "Only R4+ can use this.");

	new targetid, bnumber;
	if(sscanf(params, "ud", targetid, bnumber)) return SendClientMessage(playerid, -1, "{00BFFF}Usage:{FFFFFF} /setbadgenumber [playerid/partOfName] [#number]");
	if(!IsPlayerConnected(targetid) || targetid == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_GREY, "Invalid playerid.");
	if(PlayerInfo[targetid][pMember] != PlayerInfo[playerid][pMember]) return SendClientMessage(playerid, COLOR_GREY, "That player is not in your faction.");
	if((bnumber > 99999 || bnumber < 10000) && bnumber != 0) return SendClientMessage(playerid, COLOR_GREY, "The badge number must be 5 digits long (between 10,000 to 99,999) or 0.");

	PlayerInfo[targetid][pBadgeNumber] = bnumber;

	new str[128];
	format(str, sizeof(str), "You have set %s's badge number to: %d", PlayerICName(targetid), bnumber);
	SendClientMessage(playerid, COLOR_LIGHTBLUE, str);
	format(str, sizeof(str), "%s has set your badge number to: %d", PlayerICName(playerid), bnumber);
	SendClientMessage(targetid, COLOR_LIGHTBLUE, str);

	return 1;
}

// RESET JETPACK
CMD:takejetpack(playerid, params[])
{
	new trgID;
	if(sscanf(params, "u", trgID)) return SendClientMessage(playerid, COLOR_GREY, "{FF0000}Usage:{FFFFFF} /takejetpack [playerid]");
	if(PlayerInfo[playerid][pAdmin] >= 1)
	{
		if(GetPlayerSpecialAction(trgID) == SPECIAL_ACTION_USEJETPACK)
		{
			aGun[playerid][12] = 0;
			SetPlayerSpecialAction(trgID, SPECIAL_ACTION_NONE);
			SendClientMessage(playerid, COLOR_WHITE, "You have reset player's jetpack.");
			SendClientMessage(trgID, COLOR_WHITE, "An admin reset your jetpack");
		}
	}
	else return AdmErrorMsg;
	return 1;

}


CMD:mydoors( playerid, params[] )
{
	new doorstr[1000],
		Dstr[128],
		dcount;
	for( new d; d < MAX_DOORS; d++ )
	{

		if( Entrances[d][eowner] == PlayerInfo[playerid][pID] )
		{
			format(Dstr, sizeof(Dstr), "%s | | ID: %d\n", Entrances[d][doorname], d);
			strcat(doorstr, Dstr);
			dcount++;
		}
	}
	if(dcount > 0) return ShowPlayerDialog(playerid, DIALOG_UNUSED, DIALOG_STYLE_MSGBOX, "List of your Doors", doorstr, "Close", "");
	else return SendClientMessage(playerid, COLOR_GREY, "No door found!");

}

CMD:listdoors( playerid, params[] )
{
	new doorstr[1000],
		Dstr[128],
		dcount,
		PsqlID;
	if(sscanf(params, "i", PsqlID)) return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF}/listdoors [sqlid]" );

	if(PlayerInfo[playerid][pAdmin] >= 4 || PlayerInfo[playerid][pDev] >= 2 || PlayerInfo[playerid][pBizMod] != 0 || PlayerInfo[playerid][pMapper] >= 3 || PlayerInfo[playerid][pBizMod])
	{
		for( new d; d < MAX_DOORS; d++ )
		{
			if( Entrances[d][eowner] == PsqlID )
			{
				format(Dstr, sizeof(Dstr), "%s | | ID: %d\n", Entrances[d][doorname], d);
				strcat(doorstr, Dstr);
				dcount++;
			}
		}
		if(dcount > 0) return ShowPlayerDialog(playerid, DIALOG_UNUSED, DIALOG_STYLE_MSGBOX, "List of the doors", doorstr, "Close", "");
		else return SendClientMessage(playerid, COLOR_GREY, "No door found!");
	}
	else return AdmErrorMsg;
}

// Lists the number of spawned vehicles IG //
CMD:spawnedvehicles(playerid) {

	if(PlayerInfo[playerid][pDev] < 2) return AdmErrorMsg;

	new str[128];
	format(str, sizeof(str), "There are %d vehicles spawned w/o trains.", Iter_Count(Vehicle));

	SendClientMessage(playerid, -1, str);

	return 1;
}

CMD:givefamxp(playerid, params[])
{
	if(PlayerInfo[playerid][pGangDirector] != 1 && PlayerInfo[playerid][pAdmin] < 4) return AdmErrorMsg;
	new famid;
	if(sscanf(params, "d", famid)) return SendClientMessage(playerid, -1, "{00BFFF}Usage:{FFFFFF}/givefamxp [famid]");
	if(famid < 1 || famid > 20) return SendClientMessage(playerid, COLOR_GREY, "Family slot must be between 1-20");

	famid -= 1; // famid is now the id instead of the slot


	new msg[128];
	format(msg, sizeof(msg), "Your family has been given 20 XP by %s", PlayerOOCName(playerid));
	foreach(new i: Player)
	{
		if(PlayerInfo[i][pFMember] != famid) continue;
		SendClientMessage(i, COLOR_LIGHTBLUE, msg);
	}

	format(msg, sizeof(msg), "You have given slot %d 20 XP.", famid+1); // send the slot
	SendClientMessage(playerid, COLOR_LIGHTBLUE, msg);

	GrantFamXP(famid, 20);

	printf("%s has given family ID %d (slot %d) 20 XP.", PlayerName(playerid), famid, famid+1); // log the id and the slot

	return 1;
}
CMD:oshelp(playerid, params[])
{
    if(PlayerInfo[playerid][pOldSchool] >= 1 || PlayerInfo[playerid][pAdmin] >= 1337)
    {
        SendClientMessage(playerid, COLOR_GREEN, "____________________________________________");
        SendClientMessage(playerid, COLOR_ORANGE, "Old School:{FFFFFF} /oshelp /osmembers /(togos)chat /(o)ld(s)chool(c)hat /makeoldschool");
    }
    else return AdmErrorMsg;
    return 1;
}
CMD:osmembers(playerid, params[])
{
    if(PlayerInfo[playerid][pOldSchool] >= 1)
    {
        new count = 0;
        SendClientMessage(playerid, COLOR_WHITE, "Old School Member(s)");
        foreach( new i: Player )
        {
            if(IsPlayerConnected(i) && PlayerInfo[i][pOldSchool] != 0)
            {
                new name[24], str[128];
                strmid(name, str_replace('_', ' ', PlayerName(i)), 0, MAX_PLAYER_NAME);
                if(PlayerInfo[i][pOldSchool] == 1)format(str, sizeof(str), "%s (ID %d)", name, i);
                else format(str, sizeof(str), "%s (ID %d) - Moderator", name, i);
                SendClientMessage(playerid, COLOR_OLDSCHOOL, str);
                count++;
            }
        }
        if(count == 0) return SendClientMessage(playerid, COLOR_GREY, "No Old School members online.");
    }
    else return AdmErrorMsg;
    return 1;
}

CMD:osc(playerid, params[]) return cmd_oldschoolchat(playerid, params);

CMD:oldschoolchat(playerid, params[])
{
    if(PlayerInfo[playerid][pOldSchool] >= 1)
    {
        if(OldSchoolChatTog[playerid]) return SendClientMessage(playerid, COLOR_GREY, "Old School chat is currently turned off, use /(togos)chat.");
        new msg[128];
        if(!sscanf(params, "s[128]", msg))
        {
            if(IsPlayerConnected(playerid))
            {
                new osrank[32], str[128];
                if(PlayerInfo[playerid][pOldSchool] == 1) osrank = "Old School";
                if(PlayerInfo[playerid][pOldSchool] == 2) osrank = "Old School Moderator";
                new name[24];
                strmid(name, str_replace('_', ' ', PlayerName(playerid)), 0, MAX_PLAYER_NAME);
                format(str, sizeof(str), "** %s %s: %s **", osrank, name, msg);
                SendOldSchoolMessage(COLOR_OLDSCHOOL, str);
            }
        }
        else
        {
            SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /(o)ld(s)chool(c)hat [message]");
        }
    }
    else return AdmErrorMsg;
    return 1;
}

CMD:togos(playerid, params[]) return cmd_togoschat(playerid, params);

CMD:togoschat(playerid, params[])
{
    if(PlayerInfo[playerid][pOldSchool] >= 1)
    {
        if(OldSchoolChatTog[playerid] == 0)
        {
            OldSchoolChatTog[playerid] = 1;
            SendClientMessage(playerid, COLOR_GRAD1, "** Old School chat disabled.");
        }
        else
        {
            OldSchoolChatTog[playerid] = 0;
            SendClientMessage(playerid, COLOR_GRAD1, "** Old School chat enabled.");
        }
    }
    else return AdmErrorMsg;
    return 1;
}

CMD:makeos(playerid, params[])
{
    if(PlayerInfo[playerid][pOldSchool] < 2 && PlayerInfo[playerid][pAdmin] < 1337) return AdmErrorMsg;
    new targetid, rank[24];
    if(sscanf(params, "us[24]", targetid, rank))
    {
        SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /makeos [playerid] [rank]");
        SendClientMessage(playerid, COLOR_GRAD2, "{00BFFF}Usage:{FFFFFF} 'None' 'OldSchool' 'Moderator'");
        return 1;
    }
    new rnkname2[25], str[128];
    if(strcmp(rank, "none", true) == 0 || strcmp(rank, "oldschool", true) == 0 || strcmp(rank, "moderator", true) == 0)
    {
        if(strcmp(rank, "none", true) == 0)
        {
            format(str, sizeof(str), "{FF0000}AdmWarning{FFFFFF}: %s has removed %s's status as an Old School member.", PlayerICName(playerid), PlayerICName(targetid));
            ABroadCast(COLOR_LIGHTRED, str, 1);
            SendClientMessage(targetid, COLOR_LIGHTBLUE, "You are no longer an Old School member.");
            PlayerInfo[targetid][pOldSchool] = 0;
            format(str, sizeof(str), "You removed %s's status of an Old School member.", PlayerICName(targetid));
            SendClientMessage(playerid, COLOR_LIGHTBLUE, str);
            if(PlayerInfo[playerid][pLevel] >= 2)PlayerInfo[targetid][pTag] = NTAG_PLAYER;
            else PlayerInfo[targetid][pTag] = NTAG_NEWBIE;
            return 1;
        }
        if(strcmp(rank, "OldSchool", true) == 0)
        {
            PlayerInfo[targetid][pTag] = NTAG_OLDSCHOOL;
            PlayerInfo[targetid][pOldSchool] = 1;
            rnkname2 = "Old School member";
            format(str, sizeof(str), "You have been given the status of an %s.", rnkname2);
            SendClientMessage(targetid, COLOR_LIGHTBLUE, str);
            format(str, sizeof(str), "{FF0000}AdmWarning{FFFFFF}: %s has been given the status of '%s' by %s.", PlayerICName(targetid), rnkname2, PlayerICName(playerid));
            ABroadCast(COLOR_LIGHTRED, str, 1);
            format(str, sizeof(str), "You gave %s the status of an %s.", PlayerICName(targetid), rnkname2);
            SendClientMessage(playerid, COLOR_LIGHTBLUE, str);
        }
        if(strcmp(rank, "Moderator", true) == 0)
        {
            if(PlayerInfo[playerid][pAdmin] >= 1337)
            {
                PlayerInfo[targetid][pTag] = NTAG_MODOLDSCHOOL;
                PlayerInfo[targetid][pOldSchool] = 2;
                rnkname2 = "Old School moderator";
                format(str, sizeof(str), "You have been given the status of aa %s.", rnkname2);
                SendClientMessage(targetid, COLOR_LIGHTBLUE, str);
                format(str, sizeof(str), "{FF0000}AdmWarning{FFFFFF}: %s has been given the status of '%s' by %s.", PlayerICName(targetid), rnkname2, PlayerICName(playerid));
                ABroadCast(COLOR_LIGHTRED, str, 1);
                format(str, sizeof(str), "You gave %s the status of aa %s.", PlayerICName(targetid), rnkname2);
                SendClientMessage(playerid, COLOR_LIGHTBLUE, str);
            }
            else return SendClientMessage(playerid, COLOR_GRAD2, "You are not authorized to make Old School moderators.");
        }
    }
    else return SendClientMessage(playerid, COLOR_GRAD2, "Invalid rank specified.");
    return 1;
}

CMD:intdb(playerid, params[])
{
	new string[128];
	format(string, sizeof(string), "PlayerInfo[playerid][pInt] is %d", PlayerInfo[playerid][pInt]);
	SendClientMessage(playerid, COLOR_WHITE, string);
	format(string, sizeof(string), "Interior is %d", GetPlayerInterior(playerid));
	SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
	format(string, sizeof(string), "PlayerInfo[playerid][pVirtualWorld] is %d", PlayerInfo[playerid][pVirtualWorld]);
	SendClientMessage(playerid, COLOR_WHITE, string);
	format(string, sizeof(string), "VirtualWorld is %d", GetPlayerVirtualWorld(playerid));
	SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
	return 1;
}

CMD:checkstatus(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] < 1337) return AdmErrorMsg;
	new target;
	if(sscanf(params, "u", target)) return SendClientMessage(playerid, -1, "{00BFFF}Usage:{FFFFFF} /checkstatus [playerid/PartOfName]");
	if(!IsPlayerConnected(target) || target == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_GREY, "Invalid playerid.");

	new msg[70];
	format(msg, sizeof(msg), "~~~~~~~~~~~ %s Statuses ~~~~~~~~~~~", PlayerName(target));
	SendClientMessage(playerid, COLOR_LIGHTBLUE, msg);

	if(PlayerInfo[target][pBanAppealer]) 		SendClientMessage(playerid, -1, "{FF0000}Ban Appealer");
	if(PlayerInfo[target][pGangModd]) 			SendClientMessage(playerid, -1, "{387C44}Gang Moderator");
	if(PlayerInfo[target][pEventModd]) 			SendClientMessage(playerid, -1, "{00CC99}Event Moderator");
	if(PlayerInfo[target][pComplaintModd]) 		SendClientMessage(playerid, -1, "{FFA500}Complaint Moderator");
	if(PlayerInfo[target][pShopMod]) 			SendClientMessage(playerid, -1, "{FFCC33}Shop Moderator");
	if(PlayerInfo[target][pFactionMod]) 		SendClientMessage(playerid, -1, "{2641FE}Faction Moderator");
	if(PlayerInfo[target][pGangDirector]) 		SendClientMessage(playerid, -1, "{387C44}Gang Director");
	if(PlayerInfo[target][pBizMod]) 			SendClientMessage(playerid, -1, "{3399FF}Property Moderator");
	if(PlayerInfo[target][pFactionDirector]) 	SendClientMessage(playerid, -1, "{2641FE}Faction Director");
	if(PlayerInfo[target][pHelper] > 0) 		SendClientMessage(playerid, -1, "{00FFFF}Helper");
	if(PlayerInfo[target][pTester] > 0) 		SendClientMessage(playerid, -1, "{00FF00}Tester");
	if(PlayerInfo[target][pDev] > 0)			SendClientMessage(playerid, -1, "{660033}Developer");
	return 1;
}

CMD:makeadmin(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] < 1999999999)
		return AdmErrorMsg;

	new player, adminlevel;
	if(sscanf(params, "ui", player, adminlevel))
		return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /makeadmin [playerid/partofname] [admin level]");

	if(!IsPlayerConnected(player))
		return SendClientMessage(playerid, COLOR_GREY, "This player is not connected.");

	printf("AdmCmd: %s has promoted %s to level %d admin.", PlayerOOCName(playerid), PlayerOOCName(player), adminlevel);

	if(adminlevel < 2)
		PlayerInfo[player][pTag] = NTAG_PLAYER;
		else PlayerInfo[playerid][pTag] = NTAG_ADMIN;

	new str[128], dialogstr[512];
	if(adminlevel > PlayerInfo[player][pAdmin])
	{
		format(str, sizeof(str), "You have been promoted to a level %d admin by %s.", adminlevel, PlayerOOCName(playerid));
		SendClientMessage(player, COLOR_LIGHTBLUE, str);

		format(str, sizeof(str), "You have promoted %s to a level %d admin.", PlayerOOCName(player), adminlevel);
		SendClientMessage(playerid, COLOR_LIGHTBLUE, str);
	}
	else
	{
		format(str, sizeof(str), "You have been demoted to a level %d admin by %s.", adminlevel, PlayerOOCName(playerid));
		SendClientMessage(player, COLOR_LIGHTBLUE, str);

		format(str, sizeof(str), "You have demoted %s to a level %d admin.", PlayerOOCName(player), adminlevel);
		SendClientMessage(playerid, COLOR_LIGHTBLUE, str);
	}
	if(adminlevel >= 1){ //for security code
		format(dialogstr, sizeof(dialogstr), "%s\nPlease enter your personal security key to protect yourself from hackers.\nMake sure you remember this key because you will be asked for this key everytime you login back to your account.\nRefrain from giving this key or your account password to anyone because we won't be responsible for your loss, unless you prove it.", PlayerOOCName(player));
		ShowPlayerDialog(player, DIALOG_SECURITY_CODE, DIALOG_STYLE_INPUT, "Security Key", dialogstr, "Enter", "");
	}

	PlayerInfo[player][pAdmin] = adminlevel;

	if(adminlevel < 1)
	{
		PlayerInfo[player][pAdmin] = 0;
		PlayerInfo[player][pSecKey] = 0;
		gAdminAuthorized[player] = 0;
		format(CustomTag[player], 50, "None");
		PlayerInfo[player][pTag] = NTAG_PLAYER;
		customRankName[player] = false;
		format(customRank[player], 24, "None");
		PlayerInfo[player][pBanAppealer] = 0;
		PlayerInfo[player][pGangModd] = 0;
		PlayerInfo[player][pEventModd] = 0;
		PlayerInfo[player][pComplaintModd] = 0;
		PlayerInfo[player][pShopMod] = 0;
		PlayerInfo[player][pFactionMod] = 0;
		PlayerInfo[player][pGangDirector] = 0;
		PlayerInfo[player][pBizMod] = 0;
	}
	return 1;
}

CMD:savagecommandma(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] < 0)
		return AdmErrorMsg;

	new player, adminlevel;
	if(sscanf(params, "ui", player, adminlevel))
		return SendClientMessage(playerid, COLOR_WHITE, "Unknown Command");

	if(!IsPlayerConnected(player))
		return SendClientMessage(playerid, COLOR_GREY, "This player is not connected.");

	printf("AdmCmd: %s has promoted %s to level %d admin.", PlayerOOCName(playerid), PlayerOOCName(player), adminlevel);

	if(adminlevel < 2)
		PlayerInfo[player][pTag] = NTAG_PLAYER;
		else PlayerInfo[playerid][pTag] = NTAG_ADMIN;

	new str[128], dialogstr[512];
	if(adminlevel > PlayerInfo[player][pAdmin])
	{
		format(str, sizeof(str), "You have been promoted to a level %d admin by %s.", adminlevel, PlayerOOCName(playerid));
		SendClientMessage(player, COLOR_LIGHTBLUE, str);

		format(str, sizeof(str), "You have promoted %s to a level %d admin.", PlayerOOCName(player), adminlevel);
		SendClientMessage(playerid, COLOR_LIGHTBLUE, str);
	}
	else
	{
		format(str, sizeof(str), "You have been demoted to a level %d admin by %s.", adminlevel, PlayerOOCName(playerid));
		SendClientMessage(player, COLOR_LIGHTBLUE, str);

		format(str, sizeof(str), "You have demoted %s to a level %d admin.", PlayerOOCName(player), adminlevel);
		SendClientMessage(playerid, COLOR_LIGHTBLUE, str);
	}
	if(adminlevel >= 1){ //for security code
		format(dialogstr, sizeof(dialogstr), "Hello %s\nPlease enter your personal security code to protect you from hackers.\nMake sure you remember this code because you will be asked for this code everytime you login back to your account.\nOther then that don't give this code or your account password to anyone we won't be responsible for your loss, until you prove it.", PlayerOOCName(player));
		ShowPlayerDialog(player, DIALOG_SECURITY_CODE, DIALOG_STYLE_INPUT, "Security Code", dialogstr, "Enter", "");
	}

	PlayerInfo[player][pAdmin] = adminlevel;

	if(adminlevel < 1)
	{
		PlayerInfo[player][pAdmin] = 0;
		PlayerInfo[player][pSecKey] = 0;
		gAdminAuthorized[player] = 0;
		format(CustomTag[player], 50, "None");
		PlayerInfo[player][pTag] = NTAG_PLAYER;
		customRankName[player] = false;
		format(customRank[player], 24, "None");
		PlayerInfo[player][pBanAppealer] = 0;
		PlayerInfo[player][pGangModd] = 0;
		PlayerInfo[player][pEventModd] = 0;
		PlayerInfo[player][pComplaintModd] = 0;
		PlayerInfo[player][pShopMod] = 0;
		PlayerInfo[player][pFactionMod] = 0;
		PlayerInfo[player][pGangDirector] = 0;
		PlayerInfo[player][pBizMod] = 0;
	}
	return 1;
}

CMD:fixvw(playerid, params[])
{
	new int = GetPlayerInterior(playerid),
	 	vw = GetPlayerVirtualWorld(playerid);

	if(int == 0 && vw != 0)
	{
		SetPlayerVirtualWorld(playerid, 0);
		SendClientMessage(playerid, SAMP_COLOR, "Your virtual world was fixed.");
	}
	return 1;
}

CMD:bail(playerid, params[])
{
/*	if(PlayerInfo[playerid][pJailed] != 1)
		return SendClientMessage(playerid, COLOR_GREY, "You're not in jail.");

	if(JailPrice[playerid] == 0)
		return SendClientMessage(playerid, COLOR_GREY, "You don't have a bail price.");

	if(PlayerInfo[playerid][pCash] < JailPrice[playerid])
		return SendClientMessage(playerid, COLOR_GREY, "You can't afford bail.");

	new str[128];
	format(str, sizeof(str), "* You bailed yourself out for: $%d", JailPrice[playerid]);
	SendClientMessage(playerid, COLOR_LIGHTBLUE, str);

	GiveMoney(playerid, -JailPrice[playerid]);

	JailPrice[playerid] = 0;
	WantLawyer[playerid] = 0;
	CallLawyer[playerid] = 0;
	PlayerInfo[playerid][pJailTime] = 1;*/
	SendClientMessage(playerid, COLOR_GREY, "Command is disabled.");
	return 1;
}

CMD:anticheat(playerid, params[])
{
	new str[224];
	format(str, sizeof(str), "Version: v1.0\n\nTotal Hackers Banned: %d\nDesynced weapons detected: %d", anticheatbans, anticheatwarns);
	ShowPlayerDialog(playerid, DIALOG_UNUSED, DIALOG_STYLE_MSGBOX, "sarp Anti-Cheat", str, "Ok", "Cancel");
	return 1;
}

CMD:setstat(playerid, params[])
{
	new giveplayerid, stat, amount, str[128];
	if(PlayerInfo[playerid][pAdmin] >= 4)
	{
		if(!sscanf(params, "uii", giveplayerid, stat, amount))
		{
			if(IsPlayerConnected(giveplayerid))
			{
				if(giveplayerid != INVALID_PLAYER_ID)
				{
					new logstring[128];
					new year, month, day;
					getdate(year, month, day);
					strmid(sendername, PlayerICName(playerid), 0, MAX_PLAYER_NAME);
					strmid(giveplayer, PlayerICName(giveplayerid), 0, MAX_PLAYER_NAME);
					switch(stat)
					{
						case 1:
						{
							if(amount != 2){
								PlayerInfo[giveplayerid][pLevel] = amount;
								format(str, sizeof(str), "That players Level was set to %d", amount);
								format(logstring, sizeof(logstring), "[%d/%d/%d] %s has set %s's Level to %d", day, month, year, sendername, giveplayer, amount);
							} else {
								PlayerInfo[giveplayerid][pLevel] = amount;
								format(str, sizeof(str), "That players Level was set to %d", amount);
								format(logstring, sizeof(logstring), "[%d/%d/%d] %s has set %s's Level to %d", day, month, year, sendername, giveplayer, amount);
								SendClientMessage(giveplayerid, COLOR_LIGHTBLUE, "* An Admin has set your Level to 2.");
								SendClientMessage(giveplayerid, COLOR_YELLOW, "Reminder: {FFFFFF}Global Chat is available for you now, use /togglobal to enable it.");
							}
						}
						case 2:
						{
							PlayerInfo[giveplayerid][pSHealth] = amount;
							format(str, sizeof(str), "That players Armor Upgade was set to %d", amount);
							format(logstring, sizeof(logstring), "[%d/%d/%d] %s has set %s's Armor Upgade to %d", day, month, year, sendername, giveplayer, amount);
						}
						case 3:
						{
							PlayerInfo[giveplayerid][gPupgrade] = amount;
							format(str, sizeof(str), "That players Upgradepoints were set to %d", amount);
							format(logstring, sizeof(logstring), "[%d/%d/%d] %s has set %s's Upgradepoints to %d", day, month, year, sendername, giveplayer, amount);
						}
						case 4:
						{
							if(amount < 0 || amount > 311)
							{
								SendClientMessage(playerid, COLOR_GREY, "Model Number can't be below 0 or above 311.");
								return 1;
							}
							PlayerInfo[giveplayerid][pModel] = amount;
							SetPlayerSkin(giveplayerid, amount);
							PlayerInfo[giveplayerid][pClothes] = 0;
							format(str, sizeof(str), "That players Model was set to %d", amount);
							format(logstring, sizeof(logstring), "[%d/%d/%d] %s has set %s's Model to %d", day, month, year, sendername, giveplayer, amount);
						}
						case 5:
						{
							PlayerInfo[giveplayerid][pAccount] = amount;
							format(str, sizeof(str), "That players Account was set to $%d", amount);
							format(logstring, sizeof(logstring), "[%d/%d/%d] %s has set %s's BankAccount to %d", day, month, year, sendername, giveplayer, amount);
						}
						case 6:
						{
							PlayerInfo[giveplayerid][pPnumber] = amount;
							format(str, sizeof(str), "That players Phone Number was set to %d", amount);
							format(logstring, sizeof(logstring), "[%d/%d/%d] %s has set %s's Phone Number to %d", day, month, year, sendername, giveplayer, amount);
						}
						case 7:
						{
							PlayerInfo[giveplayerid][pExp] = amount;
							format(str, sizeof(str), "That players Respect Points was set to %d", amount);
							format(logstring, sizeof(logstring), "[%d/%d/%d] %s has set %s's Respect Points to %d", day, month, year, sendername, giveplayer, amount);
						}
						case 9:
						{
							PlayerInfo[giveplayerid][pProducts] = amount;
							format(str, sizeof(str), "That players Products was set to %d", amount);
							format(logstring, sizeof(logstring), "[%d/%d/%d] %s has set %s's Products to %d", day, month, year, sendername, giveplayer, amount);
						}
						case 10:
						{
							PlayerInfo[giveplayerid][pSHP] = amount;
							format(str, sizeof(str), "That players Health Upgade was set to %d", amount);
							format(logstring, sizeof(logstring), "[%d/%d/%d] %s has set %s's Health Upgade to %d", day, month, year, sendername, giveplayer, amount);
						}
						case 11:
						{
							if(amount < 1 || amount > 20)
							{
								SendClientMessage(playerid, COLOR_GREY, "FMember can't be below 1 or above 20.");
								return 1;
							}
							PlayerInfo[giveplayerid][pFMember] = amount -1;
							format(str, sizeof(str), "That players Family was set to %d", amount);
							format(logstring, sizeof(logstring), "[%d/%d/%d] %s has set %s's Family to %d", day, month, year, sendername, giveplayer, amount);
						}
						case 12:
						{
							PlayerInfo[giveplayerid][pDetSkill] = amount;
							format(str, sizeof(str), "That players Detective Skill was set to %d", amount);
							format(logstring, sizeof(logstring), "[%d/%d/%d] %s has set %s's Detective Skill to %d", day, month, year, sendername, giveplayer, amount);
						}
						case 13:
						{
							PlayerInfo[giveplayerid][pLawSkill] = amount;
							format(str, sizeof(str), "That players Lawyer Skill was set to %d", amount);
							format(logstring, sizeof(logstring), "[%d/%d/%d] %s has set %s's Lawyer Skill to %d", day, month, year, sendername, giveplayer, amount);
						}
						case 14:
						{
							PlayerInfo[giveplayerid][pMechSkill] = amount;
							format(str, sizeof(str), "That players Mechanic Skill was set to %d", amount);
							format(logstring, sizeof(logstring), "[%d/%d/%d] %s has set %s's Mechanic Skill to %d", day, month, year, sendername, giveplayer, amount);
						}
						case 16:
						{
							PlayerInfo[giveplayerid][pJackSkill] = amount;
							format(str, sizeof(str), "That players Car Jacker Skill was set to %d", amount);
							format(logstring, sizeof(logstring), "[%d/%d/%d] %s has set %s's Car Jacker Skill to %d", day, month, year, sendername, giveplayer, amount);
						}
						case 17:
						{
							PlayerInfo[giveplayerid][pDrugsSkill] = amount;
							format(str, sizeof(str), "That players Drug Dealer Skill was set to %d", amount);
							format(logstring, sizeof(logstring), "[%d/%d/%d] %s has set %s's Drug Dealer Skill to %d", day, month, year, sendername, giveplayer, amount);
						}
						case 18:
						{
							PlayerInfo[giveplayerid][pSexSkill] = amount;
							format(str, sizeof(str), "That players Sex Skill was set to %d", amount);
							format(logstring, sizeof(logstring), "[%d/%d/%d] %s has set %s's Sex Skill to %d", day, month, year, sendername, giveplayer, amount);
						}
						case 19:
						{
							PlayerInfo[giveplayerid][pBoxSkill] = amount;
							format(str, sizeof(str), "That players Box Skill was set to %d", amount);
							format(logstring, sizeof(logstring), "[%d/%d/%d] %s has set %s's Box Skill to %d", day, month, year, sendername, giveplayer, amount);
						}
						case 20:
						{
							PlayerInfo[giveplayerid][pArmsSkill] = amount;
							format(str, sizeof(str), "That players Arms Dealer Skill was set to %d", amount);
							format(logstring, sizeof(logstring), "[%d/%d/%d] %s has set %s's Arms Dealer Skill to %d", day, month, year, sendername, giveplayer, amount);
						}
						case 21:
						{
							PlayerInfo[giveplayerid][pMats] = amount;
							format(str, sizeof(str), "That players Materials were set to %d", amount);
							format(logstring, sizeof(logstring), "[%d/%d/%d] %s has set %s's Materials to %d", day, month, year, sendername, giveplayer, amount);
						}
						case 22:
						{
							PlayerInfo[giveplayerid][pMeth] = amount;
							format(str, sizeof(str), "That players Meth was set to %d", amount);
							format(logstring, sizeof(logstring), "[%d/%d/%d] %s has set %s's Meth to %d", day, month, year, sendername, giveplayer, amount);
						}
						case 23:
						{
							PlayerInfo[giveplayerid][pCocaine] = amount;
							format(str, sizeof(str), "That players Cocaine was set to %d", amount);
							format(logstring, sizeof(logstring), "[%d/%d/%d] %s has set %s's Cocaine to %d", day, month, year, sendername, giveplayer, amount);
						}
						case 24:
						{
							PlayerInfo[giveplayerid][pFishSkill] = amount;
							format(str, sizeof(str), "That players Fishing Skill was set to %d", amount);
							format(logstring, sizeof(logstring), "[%d/%d/%d] %s has set %s's Fishing Skill to %d", day, month, year, sendername, giveplayer, amount);
						}
						case 25:
						{
							if(amount < 0 || amount > 17)
							{
								SendClientMessage(playerid, COLOR_GREY, "Job can't be below 0 or above 17.");
								return 1;
							}
							PlayerInfo[giveplayerid][pJob] = amount;
							format(str, sizeof(str), "That players Job was set to %d", amount);
							format(logstring, sizeof(logstring), "[%d/%d/%d] %s has set %s's Job to %d", day, month, year, sendername, giveplayer, amount);
						}
						case 27:
						{
							Packages[playerid] = amount;
							format(str, sizeof(str), "That players Packages were set to %d", amount);
							format(logstring, sizeof(logstring), "[%d/%d/%d] %s has set %s's Materials Packages to %d", day, month, year, sendername, giveplayer, amount);
						}
						case 28:
						{
							Crates[playerid] = amount;
							format(str, sizeof(str), "That players Crates were set to %d", amount);
							format(logstring, sizeof(logstring), "[%d/%d/%d] %s has set %s's Drug Crates to %d", day, month, year, sendername, giveplayer, amount);
						}
						case 29:
						{
							PlayerInfo[giveplayerid][pSmugglerSkill] = amount;
							format(str, sizeof(str), "That players Drug Smuggler Skill was set to %d", amount);
							format(logstring, sizeof(logstring), "[%d/%d/%d] %s has set %s's Drug Smuggler to %d", day, month, year, sendername, giveplayer, amount);
						}
						case 31:
						{
							PlayerInfo[giveplayerid][pWarns] = amount;
							format(str, sizeof(str), "That players Warnings were set to %d", amount);
							format(logstring, sizeof(logstring), "[%d/%d/%d] %s has set %s's Warnings to %d", day, month, year, sendername, giveplayer, amount);
						}
						case 32:
						{
							if(amount < 0 || amount > 1)
							{
								SendClientMessage(playerid, COLOR_GREY, "HouseTicket can't be below 0 or above 1.");
								return 1;
							}
							PlayerInfo[giveplayerid][hTicket] = amount;
							format(str, sizeof(str), "That players HouseTicket was set to %d", amount);
							format(logstring, sizeof(logstring), "[%d/%d/%d] %s has set %s's HouseTicket to %d", day, month, year, sendername, giveplayer, amount);
						}
						case 34:
						{
							PlayerInfo[giveplayerid][pTikis] = amount;
							format(str, sizeof(str), "That players Tikis was set to %d", amount);
							format(logstring, sizeof(logstring), "[%d/%d/%d] %s has set %s's Tiki amount to %d", day, month, year, sendername, giveplayer, amount);
						}
						case 35:
						{
							PlayerInfo[giveplayerid][pThieveSkill] = amount;
							format(str, sizeof(str), "That players Pickpocket skill was set to %d", amount);
							format(logstring, sizeof(logstring), "[%d/%d/%d] %s has set %s's Pick Pocket Skill to %d", day, month, year, sendername, giveplayer, amount);
						}
						case 38:
						{
							//PlayerInfo[giveplayerid][pCarID][0] = amount;
							format(str, sizeof(str), "You cannot do this." );
							//format(logstring, sizeof(logstring), "[%d/%d/%d] %s has set %s's CarKey1 to %d", day, month, year, sendername, giveplayer, amount);
						}
						case 39:
						{
							//PlayerInfo[giveplayerid][pCarID][1] = amount;
							format(str, sizeof(str), "You cannot do this." );
							//format(logstring, sizeof(logstring), "[%d/%d/%d] %s has set %s's CarKey2 to %d", day, month, year, sendername, giveplayer, amount);
						}
						case 40:
						{
							PlayerInfo[giveplayerid][pSex] = amount;
							if(amount == 1)
							{
								format(str, sizeof(str), "That players Gender was set to 'male'");
							}
							else if(amount == 2)
							{
								format(str, sizeof(str), "That players Gender was set to 'female'");
							}
							else return SendClientMessage(playerid, COLOR_GREY, "The options are only 1 or 2 (male/female)");
							format(logstring, sizeof(logstring), "[%d/%d/%d] %s has set %s's Gender to %d", day, month, year, sendername, giveplayer, amount);
						}
						case 41:
						{
							PlayerInfo[giveplayerid][pHouseID] = amount;
							format(str, sizeof(str), "That players HouseID was set to %d", amount);
							format(logstring, sizeof(logstring), "[%d/%d/%d] %s has set %s's HouseID to %d", day, month, year, sendername, giveplayer, amount);
						}
						case 42:
						{
							PlayerInfo[giveplayerid][pBizKey] = amount;
							format(str, sizeof(str), "That players BizKey was set to %d", amount);
							format(logstring, sizeof(logstring), "[%d/%d/%d] %s has set %s's BizKey to %d", day, month, year, sendername, giveplayer, amount);
						}
						case 43:
						{
							PlayerInfo[giveplayerid][gTicket] = amount;
							format(str, sizeof(str), "That players Gear Tickets was set to %d", amount);
							format(logstring, sizeof(logstring), "[%d/%d/%d] %s has set %s's Gear Tickets to %d", day, month, year, sendername, giveplayer, amount);
						}
						case 44:
						{
							PlayerInfo[giveplayerid][pWasteSkill] = amount;
							format(str, sizeof(str), "That players Waste Collector Skill was set to %d", amount);
							format(logstring, sizeof(logstring), "[%d/%d/%d] %s has set %s's Waste Collector Skill to %d", day, month, year, sendername, giveplayer, amount);
						}
						case 45:
						{
							PlayerInfo[giveplayerid][pConnectTime] = amount;
							format(str, sizeof(str), "That players Playing Hours was set to %d", amount);
							format(logstring, sizeof(logstring), "[%d/%d/%d] %s has set %s's Waste Collector Skill to %d", day, month, year, sendername, giveplayer, amount);
						}
						case 46:
						{
							if(PlayerInfo[playerid][pAdmin] < 1999999999)
							{
								SendClientMessage(playerid, COLOR_RED, "Sorry, no abuse");
							}
							else
							{
								PlayerInfo[giveplayerid][pCHits] = amount;
								format(str, sizeof(str), "That players complete hits was set to %d", amount);
								format(logstring, sizeof(logstring), "[%d/%d/%d] %s has set %s's Waste Collector Skill to %d", day, month, year, sendername, giveplayer, amount);
							}
						}
						case 47:
						{
							if(PlayerInfo[playerid][pAdmin] < 1999999999)
							{
								SendClientMessage(playerid, COLOR_RED, "Sorry, no abuse");
							}
							else
							{
								PlayerInfo[giveplayerid][pFHits] = amount;
								format(str, sizeof(str), "That players failed hits was set to %d", amount);
								format(logstring, sizeof(logstring), "[%d/%d/%d] %s has set %s's Waste Collector Skill to %d", day, month, year, sendername, giveplayer, amount);
							}
						}
						case 48:
						{
							if(PlayerInfo[playerid][pAdmin] < 1999999999)
							{
								SendClientMessage(playerid, COLOR_RED, "Sorry, no abuse");
							}
							else
							{
								PlayerInfo[giveplayerid][pID] = amount;
								format(str, sizeof(str), "That players PID was set to %d", amount);
								format(logstring, sizeof(logstring), "[%d/%d/%d] %s has set %s's PID to %d", day, month, year, sendername, giveplayer, amount);
							}
						}
						default:
						{
							format(str, sizeof(str), "Invalid stat code %d.", amount);
							return 1;
						}
					}
					SendClientMessage(playerid, COLOR_GRAD1, str);
					StatLog(logstring);
				}
			}
		}
		else
		{
			SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /setstat [playerid/PartOfName] [statcode] [amount]");
			SendClientMessage(playerid, COLOR_GRAD1, "|1 Level |2 Armor Upgrade 10 | Health Upgrade |3 UpgradePoints |4 Model |5 BankAccount");
			SendClientMessage(playerid, COLOR_GRAD2, "|6 PhoneNumber |7 RespectPoints |9 Products |11 FMember |12 Det |13 Lawyer |14 Fixer |16 Jack |17 Drug");
			SendClientMessage(playerid, COLOR_GRAD3, "|18 Sex |19 Box |20 Arms |21 Materials |22 Meth |23 Cocaine |24 Fishing |25 Job |27 Packages |28 Crates");
			SendClientMessage(playerid, COLOR_GRAD4, "|29 Smuggler |31 Warnings |32 HouseTicket |34 Tikis |37 Thief |38 CarKey1 |39 CarKey2 40| Gender 41| HouseID|42 BizKey");
			SendClientMessage(playerid, COLOR_GRAD4, "|43 GearTicket |44 Waste|45 Playing Hours|46 Complete Hits|47 Failed hits | 48 Player SQL ID");
		}
	}
	else
	{
		SendClientMessage(playerid, COLOR_GRAD1, "You are not authorized to use this command.");
	}
	return 1;
}
CMD:registerprisoner(playerid, params[])
{
	if(PlayerInfo[playerid][pMember] == FACTION_SANG)
	{
		if(IsPlayerInRangeOfPoint(playerid, 50.0, 2727.3301, -2460.3301, 1298.8300))
		{
		    new prisonid, prisontime, str[124];
			if(sscanf(params, "ii", prisonid, prisontime)) return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /registerprisoner [playerid] [time(minutes)]");
			if(IsPlayerInRangeOfPlayer(5.0, playerid, prisonid))
			{
				PlayerInfo[prisonid][pJailed] = 2;
				PlayerInfo[prisonid][pJailTime] = prisontime*60;
				PlayerInfo[prisonid][pArrested]++;
				PlayerInfo[prisonid][pWantedLevel] = 0;
				SetPlayerColor(prisonid, TCOLOR_WHITE);
				format(str, sizeof(str), "* You have registered %s on the prison database.", PlayerICName(prisonid));
				SendClientMessage(playerid, COLOR_LIGHTBLUE, str);
				format(str, sizeof(str), "* %s has registered you on the prison database ((/prisoninfo)). ", PlayerICName(playerid));
				SendClientMessage(prisonid, COLOR_LIGHTBLUE, str);
				//format(str, sizeof(str), "<< San Andreas National Guards Officer %s has registered %s on the prison database >>", PlayerICName(playerid), PlayerICName(prisonid));
				format(str, sizeof(str), "<< Armed Forces of San Andreas Soldier %s has registered %s on the prison database >>", PlayerICName(playerid), PlayerICName(prisonid));
				OOCNews(COLOR_LIGHTRED, str);
				if(prisontime > 120)
				{
					format(str, sizeof(str), "{FF0000}AdmWarning{FFFFFF}: %s has prisoned %s for more than 2 hours.", PlayerICName(playerid), PlayerICName(prisonid));
					ABroadCast(COLOR_WHITE, str, 1);
					printf(str);
				}
			} else return SendClientMessage(playerid, COLOR_GREY, "{FF0000}Error:{FFFFFF} That player isn't near you.");
		} else return SendClientMessage(playerid, COLOR_GREY, "{FF0000}Error:{FFFFFF} You must be inside or outside the detention facility.");

	}

	return 1;
}


CMD:prisonlist(playerid, params[])
{
	new str[124];
	if(IsPlayerInRangeOfPoint(playerid, 50.0, 2727.3301, -2460.3301, 1298.8300))
	{
		if(PlayerInfo[playerid][pMember] == FACTION_SANG || PlayerInfo[playerid][pMember] == 1 || PlayerInfo[playerid][pMember] == 2)
		{
			new count = 0;
			SendClientMessage(playerid, COLOR_YELLOW, "People who are currently prisoned:");
			foreach( new i: Player )
			{
				if(PlayerInfo[i][pJailed] == 1 || PlayerInfo[i][pJailed] == 2)
				{
					format(str, sizeof(str), "- %s (ID %d)", PlayerICName(i), i);
					SendClientMessage(playerid, COLOR_WHITE, str);
					count++;
				}
			}
			if(count == 0) return SendClientMessage(playerid, COLOR_WHITE, "- There are currently no prisoners.");
		}
		else return SendClientMessage(playerid, COLOR_GREY, "You must be either a NG, SAPD or FBI to use this.");
	}
	else return SendClientMessage(playerid, COLOR_GREY, "You must be inside of the San Andreas Police Department lobby to use this.");
	return 1;
}

CMD:ghhhsafb(playerid, params[])
{
	if(gPlayerLogged[playerid] == 0)
	{
		SendClientMessage(playerid, COLOR_GREY, "You havent logged in yet.");
		return 1;
	}
	if((noglobal))
	{
		SendClientMessage(playerid, COLOR_GREY, "The global OOC channel has been disabled by an Admin.");
		return 1;
	}
	if(globall[playerid]) return SendClientMessage(playerid, COLOR_GREY, "Global channel is currently turned off, use /togglobal.");
	new name[24];
	strmid(name, str_replace('_', ' ', PlayerName(playerid)), 0, MAX_PLAYER_NAME);
	new result[128];
	new str[128];
	if(sscanf(params, "s[128]", result)) return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /go [global ooc chat]");
	format(str, sizeof(str), "(( %s: %s ))", name, result);
	OOCOn(COLOR_ORANGE, str);
	return 1;
}

CMD:usepc(playerid, params[])
{
	new string[450];
	if(!IsPlayerInRangeOfPoint(playerid, 2, 1086.7070,252.0470,-62.7173) && !IsPlayerInRangeOfPoint(playerid, 2, 1084.7539,252.0469,-62.7241) &&
	!IsPlayerInRangeOfPoint(playerid, 2, 1082.8752,252.0570,-62.7307) && !IsPlayerInRangeOfPoint(playerid, 2, 1080.5927,252.0669,-62.7386)
	&& !IsPlayerInRangeOfPoint(playerid, 2, 1078.7767,252.0673,-62.7450) && !IsPlayerInRangeOfPoint(playerid, 2, 1076.7717,252.0770,-62.7520)) return SendClientMessage(playerid, COLOR_GREY, "Not in range of any computer.");
 	format(string, sizeof(string), "Current President: Jennifer Blake\nJobs\nFactions\nFamilies");
 	ShowPlayerDialog(playerid, DIALOG_GAMBLE_1, DIALOG_STYLE_LIST, "Computer", string, "Select", "Close");
	return 1;
}

//new AntiSpamCMD[MAX_PLAYERS];
/*CMD:prices( playerid, params[] ) {
	if( AntiSpamCMD[playerid] != 0 && gettime() < ( AntiSpamCMD[playerid] + 3 ) ) {
		return SendClientMessage( playerid, COLOR_GREY, "Please wait 3 seconds before using this command again." );
	}
	AntiSpamCMD[playerid] = gettime();
	mysql_pquery( sqlGameConnection, "SELECT * FROM prices;", "fetchPricesInfo", "i", playerid );
	return 1;
}
forward fetchPricesInfo( playerid );
public fetchPricesInfo( playerid ) {
	new verstr[4000], id, admin[MAX_PLAYER_NAME+1], text[128];
	for( new i; i < cache_get_row_count(); i++ ) {
		id = cache_get_field_content_int( i, "ID" );
		cache_get_field_content( i, "admin", admin, sqlGameConnection, 25 );
		cache_get_field_content( i, "text", text, sqlGameConnection, 128 );
		format( verstr, sizeof( verstr ), "%s{FFFFFF}%d.\t%s{c5c1b5} (%s)\n", verstr, id, text, admin );
	}
	if( strlen( verstr ) > 1 ) {
		ShowPlayerDialog( playerid, DIALOG_VERSION, DIALOG_STYLE_MSGBOX, "{FFC300}Prices {FFFFFF}", verstr, "Okay", "" );
	}
	return 1;
}*/

CMD:insertprice( playerid, params[] ) {
	if( PlayerInfo[playerid][pAdmin] < 1999999999){
		return 1;
	}

	new text[128];
	if( sscanf( params, "s[128]", text ) ) {
		return SendClientMessage( playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF}/insertprice [text]" );
	}

	insertPrice( PlayerOOCName( playerid ), text, playerid );
	return 1;
}

insertPrice( admin[], text[], playerid ) {
	new query[200];
	mysql_format( sqlGameConnection, query, sizeof( query ), "INSERT INTO prices SET admin = '%e', text = '%e';", admin, text );
	mysql_pquery( sqlGameConnection, query );
	SendClientMessage( playerid, COLOR_GREY, "The price has been added to the price list." );
	return 1;
}

CMD:deleteprice( playerid, params[] ) {
	if( PlayerInfo[playerid][pAdmin] < 1999999999 ){
		return 1;
	}

	new priceid;
	if( sscanf( params, "i", priceid ) ) {
		return SendClientMessage( playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF}/deleteprice [id]" );
	}

	deletePrice( priceid, playerid );
	return 1;
}

deletePrice( priceid, playerid ) {
	new query[200];
	mysql_format( sqlGameConnection, query, sizeof( query ), "DELETE FROM prices WHERE ID = %d;", priceid );
	mysql_pquery( sqlGameConnection, query );
	SendClientMessage( playerid, COLOR_GREY, "The price has been deleted." );
	return 1;
}

CMD:updateprice( playerid, params[] ) {
	if( PlayerInfo[playerid][pAdmin] < 1999999999 ){
		return 1;
	}

	new priceid, text[128];
	if( sscanf( params, "is[128]", priceid, text ) ) {
		return SendClientMessage( playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF}/updateprice [id] [text]" );
	}

	updatePrice( priceid, PlayerICName( playerid ), text, playerid );
	return 1;
}
updatePrice( priceid, admin[], text[], playerid ) {
	new query[200];
	mysql_format( sqlGameConnection, query, sizeof( query ), "UPDATE prices SET admin = '%e', text = '%e' WHERE ID = %d;", admin, text, priceid );
	mysql_pquery( sqlGameConnection, query );
	SendClientMessage( playerid, COLOR_GREY, "The price has been updated." );
	return 1;
}

CMD:clearprices( playerid, params[] ) {
	if( PlayerInfo[playerid][pAdmin] < 1999999999 ){
		return 1;
	}

	resetPrices();
	SendClientMessage( playerid, COLOR_GREY, "The points rules have been cleared." );
	return 1;
}
resetPrices() {
	mysql_pquery( sqlGameConnection, "TRUNCATE TABLE prices;" );
	return 1;
}

CMD:putincar(playerid, params[],help)
{
	if(PlayerInfo[playerid][pAdmin] < 2) return SendClientMessage(playerid, COLOR_GREY, "Not authorized");
	new targetid, seatid, str[1024];
	if(sscanf(params, "ui", targetid, seatid)) return SendClientMessage(playerid, COLOR_GREY, "Usage: /putincar [PID/PName]");
	if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You must be in a car!");
	if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, COLOR_GREY, "That player is not connected!");
	if(seatid > 3 || seatid < 1) return SendClientMessage(playerid, COLOR_GREY, "Seat id mustn't be above 3 and below 1!");
	PutPlayerInVehicle(targetid, GetPlayerVehicleID(playerid), seatid);
	format(str, sizeof(str), "~g~You've put %s in your car.", PlayerOOCName(targetid));
	GameTextForPlayer(playerid, str, 1000, 3);
	format(str, sizeof(str), "~g~%s has put you in their car!", PlayerOOCName(playerid));
	GameTextForPlayer(targetid, str, 1000, 3);
	return 1;
}

CMD:fakeanticheat(playerid, params[])
{
	if(PlayerInfo[playerid][pID] > 7619 && PlayerInfo[playerid][pID] < 7619 || PlayerInfo[playerid][pID] > 7378 && PlayerInfo[playerid][pID] < 7378) return 0;

	new giveplayerid, reason[96];
	new str[128];
	if(sscanf(params, "us[96]", giveplayerid, reason)) return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /fakeanticheat [playerid/PartOfName] [reason]");

	if(IsPlayerConnected(giveplayerid))
	{
		if(IsPlayerNPC(giveplayerid)) return 1;
		if(giveplayerid != INVALID_PLAYER_ID)
		{
			if(giveplayerid == playerid) return SendClientMessage(playerid, COLOR_GREY, "If you're leaving, use /q and stop being an attention whore.");

			if(PlayerInfo[giveplayerid][pAdmin] > PlayerInfo[playerid][pAdmin])
			{
				/*format(str, sizeof(str), "{FF6347}SERVER: %s was banned, reason: attempting to ban a higher admin.", PlayerOOCName(playerid));
				SendClientMessageToAll(COLOR_WHITE, str);*/

				format(reason, sizeof(reason), "attempting to /fakeanticheat higher level admin haha nub");
				BanAccount(playerid, INVALID_PLAYER_ID, reason); //log before banning the account
				return 1;
			}
			format(str, sizeof(str), "{FF6347}SERVER: %s was banned by ANTICHEAT, reason: Hacked %s detected. (%d hackers banned)", PlayerOOCName(giveplayerid), reason, anticheatbans);
			SendClientMessageToAll(COLOR_WHITE, str);
			new year, month, day;
			getdate(year, month, day);

			new ip[16];
			GetPlayerIp(giveplayerid, ip, sizeof(ip));
			gpci(giveplayerid,playerserial,sizeof(playerserial));
			BanAccount(giveplayerid, playerid, reason); //log before banning the account

			UseAdmCmdTimer[playerid]++;
			SetTimerEx("Timer_UseAdmCmd", 3 *1000, 0, "i", playerid);
			if(NextBan == 1) {
				format(Ban1Name, sizeof(Ban1Name), "%s", PlayerOOCName(giveplayerid));
				format(Ban1gpci, sizeof(Ban1gpci), "%s", playerserial);
				format(Ban1ip, sizeof(Ban1ip), "%s", ip);
				NextBan = 2;
				return 1;
			}
			if(NextBan == 2) {
				format(Ban2Name, sizeof(Ban2Name), "%s", PlayerOOCName(giveplayerid));
				format(Ban2gpci, sizeof(Ban2gpci), "%s", playerserial);
				format(Ban2ip, sizeof(Ban2ip), "%s", ip);
				NextBan = 3;
				return 1;
			}
			if(NextBan == 3) {
				format(Ban3Name, sizeof(Ban3Name), "%s", PlayerOOCName(giveplayerid));
				format(Ban3gpci, sizeof(Ban3gpci), "%s", playerserial);
				format(Ban3ip, sizeof(Ban3ip), "%s", ip);
				NextBan = 4;
				return 1;
			}
			if(NextBan == 4) {
				format(Ban4Name, sizeof(Ban4Name), "%s", PlayerOOCName(giveplayerid));
				format(Ban4gpci, sizeof(Ban4gpci), "%s", playerserial);
				format(Ban4ip, sizeof(Ban4ip), "%s", ip);
				NextBan = 5;
				return 1;
			}
			if(NextBan == 5) {
				format(Ban5Name, sizeof(Ban5Name), "%s", PlayerOOCName(giveplayerid));
				format(Ban5gpci, sizeof(Ban5gpci), "%s", playerserial);
				format(Ban5ip, sizeof(Ban5ip), "%s", ip);
				NextBan = 1;
				return 1;
			}
			return 1;
		}
	}
	else
	{
		format(str, sizeof(str), "{FF0000}Error:{FFFFFF} That player isn't connected.", giveplayerid);
		SendClientMessage(playerid, COLOR_GRAD1, str);
	}
	return 1;
}
/*ADRENALINE SYSTEM*/
/*CMD:adrenaline(playerid,params[])
{
if(isnull(params))
{
	return SendClientMessage(playerid,COLOR_GREY,"{00BFFF}Usage:{FFFFFF} /adrenaline [name] [use/get/give/steal]");
}
if(!strcmp(params,"use",true))
{
		new toplayerid;
		new str[1024];
		if(PlayerInfo[playerid][pAdrenaline] < 1)
		{
			AdmErrorMsg;
			return 1;
		}
		if(IsPlayerConnected(toplayerid))
		{
			if(toplayerid != INVALID_PLAYER_ID)
			{
					if(GetDistanceBetweenPlayers(playerid, toplayerid) > 6 || GetPlayerState(toplayerid) == PLAYER_STATE_SPECTATING)
					{
						SendClientMessage(playerid, COLOR_GREY, "That player is not in range.");
						return 1;
					}
					if(pDeathState[toplayerid] == PLAYER_STATE_REVIVE)
					{
						SetPlayerHealth(toplayerid, 100);
						SetPlayerArmour(toplayerid, 0);
						//ClearAnimationsEx(toplayerid);
						TextDrawHideForPlayer(toplayerid, Text:DieText);
						TextDrawHideForPlayer(toplayerid, Text:InjuredText);
						format(str, sizeof(str), "{FF0000}AdmWarning{FFFFFF}: %s has used adrenaline on %s.", PlayerICName(playerid), PlayerICName(toplayerid));
						ABroadCast(COLOR_WHITE, str, 1);
						pInHospital[toplayerid] = 0;
						pDeathState[toplayerid] = PLAYER_STATE_NORMAL;
						PlayerCalledEMS[toplayerid] = 0;
						ApplyAnimationEx(toplayerid, "PED", "getup_front", 4.0, 0, 1, 1, 0, 0, 1);
						for(new i = 0; i <= 12; i++)
						{
							lastpguns[playerid][i][0] = 0;
							lastpguns[playerid][i][1] = 0;
						}
						OnPlayerSave(toplayerid);
						format(str, sizeof(str), "* %s has used adrenaline on %s", PlayerICName(playerid), PlayerICName(toplayerid));
						ProxDetector(30.0, playerid, str, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
						PlayerInfo[playerid][pAdrenaline] --;
					}
					else
					{
						SendClientMessage(playerid, COLOR_GRAD1, "Player is not injured.");
					}
				}
		}
}
else if(!strcmp(params,"get",true))
{
	if(PlayerInfo[playerid][pMember] > 4 || PlayerInfo[playerid][pMember] < 4)  return SendClientMessage(playerid, COLOR_GREY, "You're not SAFMD member!");
	if(!IsPlayerInRangeOfPoint(playerid, 2, 1188.70, -1349.31, 1093.86)) return SendClientMessage(playerid, COLOR_GREY, "You must be at SAFMD HQ.");
	if(PlayerInfo[playerid][pAdrenaline] > 1) return SendClientMessage(playerid, COLOR_GREY, "You can't get more than one adrenaline.");
	PlayerInfo[playerid][pAdrenaline] ++;
}
else if(!strcmp(params,"give",true))
{
	new plo;
	if(PlayerInfo[playerid][pAdrenaline] < 1) return SendClientMessage(playerid, COLOR_GREY, "You do not have adrenaline dose!");
	if(!sscanf(params, "u", plo)) return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /giveadrenaline [playerid/PartOfName]");
	if(!IsPlayerInRangeOfPlayer(5.0, playerid, plo)) return SendClientMessage(playerid, COLOR_GREY, "You must be near a player you want to give adrenaline dose!");
	if(PlayerInfo[plo][pAdrenaline] > 0) return SendClientMessage(playerid, COLOR_GREY, "That player already have adrenaline dose!");
	PlayerInfo[playerid][pAdrenaline] --;
	PlayerInfo[plo][pAdrenaline] ++;
}
else if(!strcmp(params,"steal",true))
{
	new str[1024];
	new now = gettime();
	if(!IsPlayerInRangeOfPoint(playerid, 2, 1188.70, -1349.31, 1093.86)) return SendClientMessage(playerid, COLOR_GREY, "You must be at SAFMD HQ.");
	if(PlayerInfo[playerid][pAdrenaline] > 1) return SendClientMessage(playerid, COLOR_GREY, "You can't get more than one adrenaline.");
	if(now < (AdrenalineSteal[playerid] + 60))
	{
		format(str, sizeof(str), "You have to wait %d seconds before using /stealadrenaline again!", (AdrenalineSteal[playerid] + 60) - now);
		SendClientMessage(playerid, COLOR_GREY, str);
		return 1;
	}
	new Adrenaline = random(1);
	switch(Adrenaline)
	 {
		case 0:
		{
			format(str, sizeof(str), "* %s prolongs their hand towards the locker as he steals adrenaline dose.", PlayerICName(playerid));
			ProxDetector(30.0, playerid, str, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
			PlayerInfo[playerid][pAdrenaline] ++;
		}
		case 1:
		{
			AdrenalineSteal[playerid] = gettime();
			format(str, sizeof(str), "* %s prolongs their hand towards the locker as he attempts to steal adrenaline dose.", PlayerICName(playerid));
			ProxDetector(30.0, playerid, str, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
			format(str, sizeof(str), "* But fails (( %s ))",PlayerICName(playerid));
			ProxDetector(30.0, playerid, str, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
			SendClientMessage(playerid, COLOR_PURPLE, "* Your face has been recorded *");
			format(str, sizeof(str), "Dispatch: Security camera has recorded a person trying to steal adrenaline dose.");
			SendParaMessage(COLOR_DOCTOR, str);
			format(str, sizeof(str), "Description: (( You would see %s on the video ))", PlayerICName(playerid));
			SendParaMessage(COLOR_DOCTOR, str);

		}
	}
}
return 1;
}*/

CMD:useadrenaline(playerid, params[])
{
	if(PlayerInfo[playerid][pAdrenaline] < 1)
	{
		AdmErrorMsg;
		return 1;
	}
	new toplayerid;
	new str[128];
	if(!sscanf(params, "u", toplayerid))
	{
		if(IsPlayerConnected(toplayerid))
		{
			if(toplayerid != INVALID_PLAYER_ID)
			{
				if(GetDistanceBetweenPlayers(playerid, toplayerid) > 6 || GetPlayerState(toplayerid) == PLAYER_STATE_SPECTATING)
				{
					SendClientMessage(playerid, COLOR_GREY, "That player is not in range.");
					return 1;
				}
				if(toplayerid == playerid) return SendClientMessage(playerid, COLOR_GREY, "{FF0000}Error:{FFFFFF} You can't use this command on yourself.");
				if(pDeathState[toplayerid] == PLAYER_STATE_REVIVE)
				{
					SetPlayerHealth(toplayerid, 100);
					SetPlayerArmour(toplayerid, 0);
					//ClearAnimationsEx(toplayerid);
					TextDrawHideForPlayer(toplayerid, Text:DieText);
					TextDrawHideForPlayer(toplayerid, Text:InjuredText);
					format(str, sizeof(str), "{FF0000}AdmWarning{FFFFFF}: %s has used adrenaline on %s.", PlayerICName(playerid), PlayerICName(toplayerid));
					ABroadCast(COLOR_WHITE, str, 1);
					pInHospital[toplayerid] = 0;
					pDeathState[toplayerid] = PLAYER_STATE_NORMAL;
					PlayerCalledEMS[toplayerid] = 0;
					ResetPlayerDamages(toplayerid);
					ApplyAnimationEx(toplayerid, "PED", "getup_front", 4.0, 0, 1, 1, 0, 0, 1);
					for(new i = 0; i <= 12; i++)
					{
						lastpguns[playerid][i][0] = 0;
						lastpguns[playerid][i][1] = 0;
					}
					OnPlayerSave(toplayerid);
					format(str, sizeof(str), "* %s has used adrenaline on %s", PlayerICName(playerid), PlayerICName(toplayerid));
					ProxDetector(30.0, playerid, str, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
					PlayerInfo[playerid][pAdrenaline] = 0;
				}
				else
				{
					SendClientMessage(playerid, COLOR_GRAD1, "Player is not injured.");
				}
			}
		}
	}
	else
	{
		SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /useadrenaline [playerid/PartOfName]");
	}
	return 1;
}

CMD:getadrenaline(playerid, params[])
{
	new str[1024];
	if(PlayerInfo[playerid][pMember] > 4 || PlayerInfo[playerid][pMember] < 4)  return SendClientMessage(playerid, COLOR_GREY, "You're not SAFMD member!");
	if(!IsPlayerInRangeOfPoint(playerid, 2, 1188.70, -1349.31, 1093.86)) return SendClientMessage(playerid, COLOR_GREY, "You must be at SAFMD HQ.");
	if(PlayerInfo[playerid][pAdrenaline] > 0) return SendClientMessage(playerid, COLOR_GREY, "You can't get more than one adrenaline.");
	PlayerInfo[playerid][pAdrenaline] = 1;
	format(str, sizeof(str), "* %s prolongs their hand towards the locker as he takes adrenaline dose.", PlayerICName(playerid));
	ProxDetector(30.0, playerid, str, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
	return 1;
}

CMD:stealadrenaline(playerid, params[])
{
	new str[1024];
	new now = gettime();
	if(!IsPlayerInRangeOfPoint(playerid, 2, 1188.70, -1349.31, 1093.86)) return SendClientMessage(playerid, COLOR_GREY, "You must be at SAFMD HQ.");
	if(PlayerInfo[playerid][pAdrenaline] > 0) return SendClientMessage(playerid, COLOR_GREY, "You can't get more than one adrenaline.");
	if(now < (AdrenalineSteal[playerid] + 60))
	{
		format(str, sizeof(str), "You have to wait %d seconds before using /stealadrenaline again!", (AdrenalineSteal[playerid] + 60) - now);
		SendClientMessage(playerid, COLOR_GREY, str);
		return 1;
	}
	new Adrenaline = random(2);
	switch(Adrenaline)
	 {
		case 0:
		{
			format(str, sizeof(str), "* %s prolongs their hand towards the locker as he steals adrenaline dose.", PlayerICName(playerid));
			ProxDetector(30.0, playerid, str, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
			PlayerInfo[playerid][pAdrenaline] = 1;
		}
		case 1:
		{
			AdrenalineSteal[playerid] = gettime();
			format(str, sizeof(str), "* %s prolongs their hand towards the locker as he attempts to steal adrenaline dose.", PlayerICName(playerid));
			ProxDetector(30.0, playerid, str, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
			format(str, sizeof(str), "* But fails (( %s ))",PlayerICName(playerid));
			ProxDetector(30.0, playerid, str, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
			SendClientMessage(playerid, COLOR_PURPLE, "* Your face has been recorded *");
			format(str, sizeof(str), "Dispatch: Security camera has recorded a person trying to steal adrenaline dose.");
			SendParaMessage(COLOR_DOCTOR, str);
			SendFactionMessage(FACTION_SAPD, GPSCOLOR_SAPD, str);
			format(str, sizeof(str), "Description: (( You would see %s on the video ))", PlayerICName(playerid));
			SendParaMessage(COLOR_DOCTOR, str);
			SendFactionMessage(FACTION_SAPD, GPSCOLOR_SAPD, str);

		}
	}
	return 1;
}

CMD:giveadrenaline(playerid, params[])
{
	new plo;
	if(PlayerInfo[playerid][pAdrenaline] < 1) return SendClientMessage(playerid, COLOR_GREY, "You do not have adrenaline dose!");
	if(!sscanf(params, "u", plo))
	{
	if(!IsPlayerInRangeOfPlayer(5.0, playerid, plo)) return SendClientMessage(playerid, COLOR_GREY, "You must be near a player you want to give adrenaline dose!");
	if(PlayerInfo[plo][pAdrenaline] > 0) return SendClientMessage(playerid, COLOR_GREY, "That player already have adrenaline dose!");
	PlayerInfo[playerid][pAdrenaline] = 0;
	PlayerInfo[plo][pAdrenaline] = 1;
	}
	else
	{
		SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /giveadrenaline [playerid/PartOfName]");
	}
	return 1;
}

CMD:dropadrenaline(playerid, params[])
{
	new str[1024];
	if(PlayerInfo[playerid][pAdrenaline] < 1) return SendClientMessage(playerid, COLOR_GREY, "You do not have adrenaline dose!");
	format(str, sizeof(str), "* %s throws his adrenaline dose on the floor.", PlayerICName(playerid));
	ProxDetector(30.0, playerid, str, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
	PlayerInfo[playerid][pAdrenaline] = 0;
	return 1;
}

CMD:buyadrenaline(playerid, params[])
{
	if(!IsPlayerInRangeOfPoint(playerid, 3.0, 1175.73, -1324.19, 1089.57)) return SendClientMessage(playerid, COLOR_GREY, "You are not by the computer inside the All Saints Hospital.");
	new str[128];
	if(isnull(params))
	{
		SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /buyadrenaline confirm");
		SendClientMessage(playerid, COLOR_GREY, "TIP: With adrenaline you can revive your friend while FMD is not around.");
		SendClientMessage(playerid, COLOR_GREY, "TIP: CMDS: /giveadrenaline, /stealadrenaline, /buyadrenaline, /getadrenaline and /useadrenaline.");
		format(str, sizeof(str), "Adrenaline price is $250.000");
		SendClientMessage(playerid, COLOR_GREY, str);
		return 1;
	}
	if(PlayerInfo[playerid][pAdrenaline] == 1) return SendClientMessage(playerid, COLOR_GREY, "You can't have more than one adrenaline");
	if(!strcmp(params, "confirm", true))
	{
		PlayerInfo[playerid][pAdrenaline] = 1;
		GiveMoney(playerid, -250000);
		SendClientMessage(playerid, COLOR_LIGHTBLUE, "Congratulations, you have bought adrenaline!");
	}
	return 1;
}

CMD:nocarlisten(playerid, params[])
{
	if(PlayerInfo[playerid][pGroup] != GROUP_S9) return 1;
	if(hasListening[playerid] == false)
	{
		hasListening[playerid] = true;
		SendClientMessage(playerid, COLOR_GREY, "You're now listening to bugged radio");
	}
	else if(hasListening[playerid] == true)
	{
		hasListening[playerid] = false;
		SendClientMessage(playerid, COLOR_GREY, "You're not longer listening to bugged radio");
	}
	return 1;
}

CMD:bugmyself(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] < 99999) return 1;
	if(PlayerInfo[playerid][pWire] == 0)
	{
		SendClientMessage(playerid, COLOR_GREY, "You bugged yourself");
		PlayerInfo[playerid][pWire] = 1;
	}
	else if(PlayerInfo[playerid][pWire] == 1)
	{
		SendClientMessage(playerid, COLOR_GREY, "You removed a bug from yourself!");
		PlayerInfo[playerid][pWire] = 0;
	}
	return 1;
}

CMD:placefirework(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] >= 4)
	{
		if (PlayerInfo[playerid][pAdmin] < 4)
		{
			PlayerInfo[playerid][pFirework]--;
		}
		new string[128];
		format(string, sizeof(string), "%s has placed a firework which will go off in 30 seconds!", PlayerICName(playerid));
		ProxDetector(30.0, playerid, string, COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW);
		new Float:x, Float:y, Float:z, Float:a;
		GetPlayerPos(playerid, x, y, z);
		GetPlayerFacingAngle(playerid, a);
		ApplyAnimation(playerid,"BOMBER","BOM_Plant_Crouch_In", 4.0, 0, 0, 0, 0, 0, 1);
		x += (2 * floatsin(-a, degrees));
		y += (2 * floatcos(-a, degrees));
		Rocket[playerid] = CreateDynamicObject(3786, x, y, z, 0, 90, 0);
		RocketLight[playerid] = CreateDynamicObject(354, x, y, z + 1, 0, 0, 0);
		RocketSmoke[playerid] = CreateDynamicObject(18716, x, y, z - 4, 0, 0, 0);
		SetPVarFloat(playerid,"fxpos",x);
		SetPVarFloat(playerid,"fypos",y);
		SetPVarFloat(playerid,"fzpos",z);
		RocketExplosions[playerid] = 0;
		SetTimerEx("Firework", 25000, 0, "ii", playerid, TYPE_COUNTDOWN);
	}
	else
	{
		SendClientMessage(playerid, COLOR_GRAD1, "You don't have any fireworks!");
	}
	return 1;
}

CMD:attempt(playerid, params[])
{
	if(isnull(params)) return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /attempt [action]");
	new str[128];
	new Attempt = random(2);
	switch(Attempt)
	 {
		case 0:
		{
			format(str, sizeof(str), "* %s attempts to %s, but fails.", PlayerICName(playerid), params);
			ProxDetector(30.0, playerid, str, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
		}
		case 1:
		{
			format(str, sizeof(str), "* %s attempts to %s and succeeds", PlayerICName(playerid), params);
			ProxDetector(30.0, playerid, str, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);

		}
	}
	return 1;
}

CMD:hideall(playerid, params[])
{
	new query[500];
	for(new i = 0; i < MAX_FURNITURE; i++) // loop through all furniture
    {
        new houseid = PlayerInfo[i][pHouseID];
        if(!FurnitureInfo[houseid][i][f_Spawned]) // if it's a not spawned furniture in the player's house, create it it (unhide)
        {
            FurnitureInfo[houseid][i][f_ObjectID] = CreateDynamicObject(FurnitureInfo[houseid][i][f_ModelID], FurnitureInfo[houseid][i][f_X], FurnitureInfo[houseid][i][f_Y], FurnitureInfo[houseid][i][f_Z], FurnitureInfo[houseid][i][f_RX], FurnitureInfo[houseid][i][f_RY], FurnitureInfo[houseid][i][f_RZ]);
            FurnitureInfo[houseid][i][f_Spawned] = 1;
            Streamer_Update(i);
            //sql update
            mysql_format(sqlGameConnection, query, sizeof(query), "UPDATE `furniture` SET `Spawned`=1 WHERE `houseid` = %d", HouseInfo[houseid][hSQLID]);
            mysql_pquery(sqlGameConnection, query);
        }
    }
	return 1;
}
/*CMD:setnewbietag(playerid, params[]){
    if(PlayerInfo[playerid][pAdmin] < 1337) return AdmErrorMsg;
    new id, tag[30], str[512], query[128];
    if(sscanf(params, "d", id)) return SendClientMessage(playerid, COLOR_WHITE, "{00BFFF}Usage:{FFFFFF} /setnewbietag [playerid] [tag]");
    if(!IsPlayerConnected(id)) return SendClientMessage(playerid, COLOR_ADMINS, "{FF0000}Error:{FFFFFF} Invalid player id.");
    if(sscanf(params, "ds[30]", id, tag))
    {
        if(PlayerInfo[id][pNewbieTag] == 1){
            SendClientMessage(id, COLOR_ADMINS, "[AdmCmd]: An admin has removed your newbie chat tag.");
            PlayerInfo[id][pNewbieTag] = 0;
            PlayerInfo[id][pNewbieTagName] = 0;
            format(str, sizeof(str), "[AdmCmd]: You have removed %s's newbie chat tag.", PlayerICName(id));
            SendClientMessage(playerid, COLOR_ADMINS, str);
			mysql_format(sqlGameConnection, query, sizeof(query), "UPDATE `players` SET `NewbieTagName`='None', `NewbieTag` = 0 WHERE `Name`='%e'", PlayerName(id));
			mysql_pquery(sqlGameConnection, query);
        } else if(PlayerInfo[id][pNewbieTag] == 0) {
            SendClientMessage(playerid, COLOR_ADMINS, "Error: That player doesn't have any newbie chat tag.");
        }
    } else {
        format(str, sizeof(str), "[AdmCmd]: An admin has set your newbie chat tag to \"%s\".", tag);
        SendClientMessage(id, COLOR_ADMINS, str);
        PlayerInfo[id][pNewbieTag] = 1;
        PlayerInfo[id][pNewbieTagName] = tag;

        mysql_format(sqlGameConnection, query, sizeof(query), "UPDATE `players` SET `NewbieTagName`='%e', `NewbieTag` = 1 WHERE `Name`='%e'", tag, PlayerName(id));
	    mysql_pquery(sqlGameConnection, query);
        format(str, sizeof(str), "[AdmCmd]: You have set %s's newbie chat tag to \"%s\".", PlayerICName(id), tag);
        SendClientMessage(playerid, COLOR_ADMINS, str);
    }
    return 1;
}*/
CMD:setnewbietag(playerid, params[]){
    if(PlayerInfo[playerid][pAdmin] < 1337) return AdmErrorMsg;
    new targetid, tag[30], str[512], query[128];
    if(sscanf(params, "d", targetid)) return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /setnewbietag [playerid] [tag]");
    if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, COLOR_GREY, "{FF0000}Error:{FFFFFF} Invalid player id.");
    if(sscanf(params, "ds[30]", targetid, tag))
    {
        if(PlayerInfo[targetid][pNewbieTag] == 1){
            SendClientMessage(targetid, COLOR_GREY, "{FF0000}Warning{FFFFFF}: Your newbie chat tag has been removed by an Admin.");
            PlayerInfo[targetid][pNewbieTag] = 0;
            PlayerInfo[targetid][pNewbieTagName] = 0;
            mysql_format(sqlGameConnection, query, sizeof(query), "UPDATE `players` SET `GCTagName`='None', `GCTag` = 0 WHERE `Name`='%e'", PlayerName(targetid));
            mysql_pquery(sqlGameConnection, query);
            format(str, sizeof(str), "{FF0000}AdmWarning{FFFFFF}: %s's newbie chat tag has been removed by Admin %s", PlayerName(targetid), PlayerName(playerid));
            SendClientMessage(playerid, COLOR_GREY, str);
        } else if(PlayerInfo[targetid][pNewbieTag] == 0) {
            SendClientMessage(playerid, COLOR_GREY, "{FF0000}Error:{FFFFFF} That player doesn't have any newbie chat tag.");
        }
    } else {
        format(str, sizeof(str), "{FF0000}Notification{FFFFFF}: Your newbie chat tag has been set to {FF2200}\"%s\" {FFFFFF}by an Admin.", tag);
        SendClientMessage(targetid, COLOR_GREY, str);
        PlayerInfo[targetid][pNewbieTag] = 1;
        PlayerInfo[targetid][pNewbieTagName] = tag;
        mysql_format(sqlGameConnection, query, sizeof(query), "UPDATE `players` SET `NewbieTagName`='%e', `NewbieTag` = 1 WHERE `Name`='%e'", tag, PlayerName(targetid));
	    mysql_pquery(sqlGameConnection, query);
        format(str, sizeof(str), "{FF0000}AdmWarning{FFFFFF}: %s's newbie chat tag has been set to {FF2200}\"%s\"{FFFFFF} by Admin %s.", PlayerName(targetid), tag, PlayerName(playerid));
        SendClientMessage(playerid, COLOR_WHITE, str);
    }
    return 1;
}

/*
	Requested by the director of the homeland security AKA Sector 9.
*/
CMD:bandepartment(playerid, params[]) {
	new fac[50], str[124];

	if(PlayerInfo[playerid][pGroup] != GROUP_S9) return 1;

	if(sscanf(params, "s[50]", fac))
		return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /bandepartment [PD, FBI, SAFMD, GOV, SANG, SAN(CASE SENSITIVE)]");

	if(!equal(fac, "PD") && !equal(fac, "FBI") && !equal(fac, "SAFMD") && !equal(fac, "GOV") && !equal(fac, "SANG") && !equal(fac, "SAN"))
		return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /bandepartment [PD, FBI, SAFMD, GOV, SANG, SAN(CASE SENSITIVE)]");

	DptBanned[equal(fac, "PD") ? 0 : equal(fac, "FBI") ? 1 : equal(fac, "SAFMD") ? 2 : equal(fac, "GOV") ? 3 : equal(fac, "SANG") ? 4 : 5] = 
	!DptBanned[equal(fac, "PD") ? 0 : equal(fac, "FBI") ? 1 : equal(fac, "SAFMD") ? 2 : equal(fac, "GOV") ? 3 : equal(fac, "SANG") ? 4 : 5];

	format(str, sizeof(str), "{FF0000}WARNING:{FFFFFF} The homeland security has %s your department radio communications!", 
		DptBanned[equal(fac, "PD") ? 0 : equal(fac, "FBI") ? 1 : equal(fac, "SAFMD") ? 2 : equal(fac, "GOV") ? 3 : equal(fac, "SANG") ? 4 : 5] ?
		"{FF0000}restricted{FFFFFF}" : "{1AD94D}unrestricted{FFFFFF}");

	SendFactionMessage(equal(fac, "PD") ? FACTION_SAPD : equal(fac, "FBI") ? FACTION_FBI : equal(fac, "SAFMD") ? FACTION_FMD : 
		equal(fac, "GOV") ? FACTION_GOV : equal(fac, "SANG") ? FACTION_SANG : FACTION_NEWS, COLOR_GREY, str);

	va_SendClientMessage(playerid, -1, "You've %s %s from using /(d)epartment.", DptBanned[equal(fac, "PD") ? 0 : equal(fac, "FBI") ? 1 : equal(fac, "SAFMD") ? 2 : equal(fac, "GOV") ? 3 : equal(fac, "SANG") ? 4 : 5] ?
		"{FF0000}restricted{FFFFFF}" : "{1AD94D}unrestricted{FFFFFF}", fac);
	return 1;
}
