SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Filterscripts

Reply
 
Thread Tools Display Modes
Old 07/07/2019, 11:31 PM   #31
AzaMx
Huge Clucker
 
Join Date: Aug 2014
Location: Home.
Posts: 332
Reputation: 63
Default Re: Dynamic biz system v2.0

Can you update it so we can use as many as investors we want?
AzaMx is offline   Reply With Quote
Old 09/01/2020, 07:08 PM   #32
DominikMarvLisy
Little Clucker
 
Join Date: Jun 2013
Posts: 11
Reputation: 0
Default Re: Dynamic biz system v2.0

Quote:
Originally Posted by OuDayas View Post
Yes is the MySQL version, but idk why in compiling will gert blocked on pawno
I have the same problem...please help
DominikMarvLisy is offline   Reply With Quote
Old 12/01/2020, 04:59 AM   #33
DominikMarvLisy
Little Clucker
 
Join Date: Jun 2013
Posts: 11
Reputation: 0
Default Re: Dynamic biz system v2.0

THIS IS OKEJ
Code:
//--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
// ===========================================================================================================================================================================================
//                          																	Dynamic Biz System - Dayrion - v2.3
// ===========================================================================================================================================================================================
//--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

#define FILTERSCRIPT

#include <a_samp>
#include <a_mysql>
#include <izcmd>
#include <sscanf2>
#include <YSI_data\y_foreach>
#include <YSI\y_va>
#include <easyDialog>

#tryinclude <streamer>

#if defined STREAMER_TYPE_PICKUP && defined STREAMER_TYPE_3D_TEXT_LABEL && defined STREAMER_TYPE_OBJECT
	#define Streamer_Plugin true
#else
	#define Streamer_Plugin false
#endif

//--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

#define                     RED                                     0xFF0000FF
#define                     WHITE                                   0xFFFFFFFF
#define                     BLUE	                                0x99CCFFFF
#define                     LBLUE                                   0x99D6FFFF
#define                     GREEN   	                            0x008000FF
#define                     BROWN                                 	0x9E3E3EFF

#define                     RED_U                                   "{FF0000}"
#define                     WHITE_U                                 "{FFFFFF}"
#define                     BLUE_U                                  "{66A3FF}"
#define                     LBLUE_U                                 "{99D6FF}"
#define                     GREEN_U                                 "{39AC39}"
#define                     BROWN_U                                 "{9E3E3E}"
#define 					LGOLD_U		 							"{ffc34d}"

#define                     X11_CORNSILK_2                          0xEEE8CDFF
#define                     X11_PEACH_PUFF_2                        0xEECBADFF
#define                     X11_NAVAJO_WHITE_2                      0xEECFA1FF

//--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

#define 					MAX_BIZ									100							// Number of biz
#define 					MAX_INTERIOR							50
#define 					MAX_BALANCE								1000000						// Max amount of money in a biz
#define 					MAX_OBJECTS_PER_BIZ						50
#define 					MAX_BIZ_NAME							MAX_PLAYER_NAME*2			// The max lengh of a biz's name
#define 					INVALID_BIZ_ID							(MAX_BIZ+10)*2				// Don't change this

/* Recommanded pickup ID :
» 19523 - 19524 - 1275 - 1247 - 1273 - 19132 - 19522*/

#define 					ICON_BIZ_LOCKED							19133
#define 					ICON_BIZ_OPEN							1318
#define 					ICON_BIZ_PENDING_OPEN					1272
#define 					ICON_BIZ_PENDING_CLOSED					19523
#define 					ICON_BIZ_INTERIOR						1239

#define 					VERSION_FS								"2.3"
#define 					PUBLIC:%0(%1)							forward %0(%1); public %0(%1)

#define 					FPRINT 									"[FS - BIZ] "
#define 					INVALID_BIZ_MSG 						"Invalid biz ID!"
#define 					PLAYER_HAVE_BIZ							"You have already a biz."
#define 					PLAYER_HAVE_NOT_BIZ						"You don't have already a biz."
#define 					NOT_NEAR_A_BIZ							"You are not near a biz."
#define 					NOT_INSIDE_A_BIZ						"You are not inside the biz."

#define MYSQL_HOST    												"casa1.fakaheda.eu"
#define MYSQL_USER    												"309817_mysql_db"
#define MYSQL_PASSWORD   										    "k7WZN0iLA0Mg8zfSj9VQRp9VbZID1zU"
#define MYSQL_DATABASE												"309817_mysql_db"

#define 					DIALOG(%0)								Dialog:%0(playerid, response, listitem, inputtext[])

#define IsValidBiz(%0) Iter_Contains(It_Biz, %0)
#define IsValidInvestor(%0) Iter_Contains(It_Investor, %0)
#define IsValidInterior(%0) Iter_Contains(It_Interior, %0)

//--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

//Please, don't remove/change this.
#if MAX_BIZ_NAME < 12
	#error "MAX_BIZ_NAME is too short. [Min 12]"
#endif

#if MAX_BALANCE < 1
	#error "MAX_BALANCE need to be higher than 1$"
#endif

#if MAX_BIZ < 1
	#error "MAX_BIZ need to be higher than 0"
#endif

#if !Streamer_Plugin && MAX_OBJECTS_PER_BIZ > 1000
	#error "You can't have more than 1000 objects if you don't use a streamer plugin."
#endif

//--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

//		Redefining strval(string[]) - Credits : Dayrion

strval_(const source[])
{
	new
		i,
		number,
		secondNumber,
		bool: negative;

	if (source[0] == '-')
	{
		negative = true;
		i = 1;
	}

	for (new length = strlen(source); i < length; i++)
	{
		if (!('0' <= source[i] <= '9')) return 0;

		secondNumber = (number*10) + source[i] - '0';

		if(cellmax - number <= secondNumber <= 0 || secondNumber <= 0) return 0;
		else number = (number*10) + source[i] - '0';
	}
	return negative ? -number : number;
}

#if defined _ALS_strval
	#undef strval
#else
	#define _ALS_strval
#endif
	#define strval strval_

//--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
// ===========================================================================================================================================================================================
//                          																		Variables
// ===========================================================================================================================================================================================
//--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------


enum E_BIZ_VALUES
{
	bSQLID,
	bPickupID,
	bPickupEnter,
	bType,
	bInterior,
	bLevel,
	bPrice,
	bVW,
	bEVW,
	bEInt,
	bSafe,
	bObjects,
	bEnterPrice,
	bool:bOpen,
	bool:bBought,
	bool:bInvestor,
	bool:bCreated,
	Float:bX,
	Float:bY,
	Float:bZ,
	Float:beX,
	Float:beY,
	Float:beZ,
	bOwner[MAX_PLAYER_NAME],
	bName[MAX_BIZ_NAME],
	Text3D:bLabelID,
	Text3D:bLabelEnterID
};

enum E_INVESTOR_VALUES
{
	iSQLID,
	iName[MAX_PLAYER_NAME],
	bool:iInves,
	bool:iSafe,
	bool:iLock,
	bool:iEnterPrice,
	bool:iRename,
	bool:iDeposit,
	bool:iWithdraw
};

enum E_BIZ_INTERIOR_TYPE
{
	Float:X,
	Float:Y,
	Float:Z,
	Interior,
	Name[50],
	Type
};

enum E_CUSTOM_INTERIOR
{
	i_SQLID,
	Float:i_X,
	Float:i_Y,
	Float:i_Z,
	i_Interior,
	i_Name[50]
};

enum E_OBJECTS
{
	oSQLID,
	oBiz,
	oID,
	oSID,
	oInterior,
	oVirtualWorld,
	Float:oX,
	Float:oY,
	Float:oZ,
	Float:oRX,
	Float:oRY,
	Float:oRZ,
	Float:oDrawDistance
}

enum E_PLAYER_VARS
{
	BizCreating,
	InteriorCreating,
	ObjectEditing,
	LastBizVisited
}

// ============================================================================================================================================================================================

static const BizData[][E_BIZ_INTERIOR_TYPE] =
{
//	{x, y, z, interiorid, name, type} -> to know what each type is, check InteriorName - You can also add type with name - IF YOU ADD A TYPE; CHANGE LINE 505
	{772.111999,-3.898649,1000.728820, 5, "LS Gym", 1},
	{774.213989,-48.924297,1000.585937, 6, "SF Gym", 1},
	{773.579956,-77.096694,1000.655029, 7, "LV Gym", 1},

	{-25.884498,-185.868988,1003.546875, 17, "24/7 1 - (Need mapping)", 2},
	{6.091179,-29.271898,1003.549438,	 10, "24/7 2 - (Need mapping)", 2},
	{-30.946699,-89.609596,1003.546875,	 18, "24/7 3 - (Need mapping)", 2},
	{-25.132598,-139.066986,1003.546875, 16, "24/7 4", 2},
	{-27.312299,-29.277599,1003.557250,	 4, "24/7 5 - (Need a bit of mapping)", 2},
	{-26.691598,-55.714897,1003.546875,  6, "24/7 6", 2},

	{286.148986,-40.644397,1001.515625, 1, "Ammunation 1", 3},
	{286.800994,-82.547599,1001.515625, 4, "Ammunation 2", 3},
	{296.6996,-110.8405,1001.5156, 6, "Ammunation 3", 3},
	{316.524993,-167.706985,999.593750, 6, "Ammunation 4", 3},

	{-100.4078,-24.5987,1000.7188, 3,	"Sex Shop", 4},
	{963.418762,2108.292480,1011.030273, 1,	"Meat Factory", 4},
	{-2240.468505,137.060440,1035.414062, 6, "Zero's RC Shop", 4},

	{207.737991,-109.019996,1005.132812, 15, "Binco", 5},
	{204.332992,-166.694992,1000.523437, 14, "Didier Sachs", 5},
	{207.054992,-138.804992,1003.507812, 3, "Prolaps", 5},
	{203.777999,-48.492397,1001.804687, 1, "Suburban", 5},
	{226.293991,-7.431529,1002.210937, 5, "Victim", 5},
	{161.391006,-93.159156,1001.804687, 18, "Zip", 5},

	{501.980987,-69.150199,998.757812, 11, "Bar", 6},
	{-227.027999,1401.229980,27.765625, 18, "Lil' probe inn", 6},
	{457.304748,-88.428497,999.554687, 4, "Jay's diner", 6},
	{363.4929,-74.7067,1001.5078, 10, "Burger Shot", 6},
	{364.9168,-11.0500,1001.8516, 9, "Clukin' Bell", 6},
	{372.3154,-132.9696,1001.4922, 5, "Well Stacked pizza", 6},
	{377.3160,-192.9741,1000.6401, 17, "Rusty Browns donuts", 6}
};

static const InteriorName[][] =
{
	"Custom Interior",
	"Sport",
	"24/7",
	"Ammunation",
	"Shop",
	"Clothes Shop",
	"Food Chain"
};

static const OpenFormatBiz[][] =
{
	"Closed",
	"Open"
};

// ============================================================================================================================================================================================

new
	CurrentMaxBizID,
	CurrentMaxCustomInterior,
	NumberOfInterior,
	CurrentMaxObjects,
	BizVW = 214799999,

	BizInfo[MAX_BIZ][E_BIZ_VALUES],
	BizInv[MAX_BIZ][E_INVESTOR_VALUES],
	BizInterior[MAX_INTERIOR][E_CUSTOM_INTERIOR],
	BizObjects[MAX_OBJECTS][E_OBJECTS],

	p_Biz[MAX_PLAYERS][E_PLAYER_VARS],

	MySQL:MySQL,

	Iterator:It_Biz<MAX_BIZ>,
	Iterator:It_Investor<MAX_BIZ>,
	Iterator:It_Interior<MAX_INTERIOR>,
	Iterator:It_Objects<MAX_OBJECTS>;


forward bool:PlayerHasABiz(playerid);
forward bool:IsValidObjectModel(modelid);

//--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
// ===========================================================================================================================================================================================
//                          																		Callback
// ===========================================================================================================================================================================================
//--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

public OnFilterScriptInit()
{
	print("\n==================================");
	print("» Biz FilterScript [Version "VERSION_FS"] «");
	print("==================================\n");
	mysql_global_options(DUPLICATE_CONNECTIONS, true);
	MySQL = mysql_connect(MYSQL_HOST, MYSQL_USER, MYSQL_PASSWORD, MYSQL_DATABASE);
	if(MySQL == MYSQL_INVALID_HANDLE || mysql_errno(MySQL) != 0)
	{
		print("\n==================================");
		print("[FS - ERROR] Unable to connect to MYSQL.");
		print("[FS - ERROR] Host: "MYSQL_HOST" | Database: "MYSQL_DATABASE" | User: "MYSQL_USER" | Password: Hidden");
		print("[FS - ERROR] Please, to avoid any MySQL Errors or involuntary crashs; unload this filterscript. (Biz FilterScript [Version "VERSION_FS"])");
		print("\n==================================");
		return 1;
	}
	for(new i; i < MAX_BIZ; i++)
	{
		BizInfo[i][bPickupID] =
		BizInfo[i][bPickupEnter] =
		_:BizInfo[i][bLabelID] =
		_:BizInfo[i][bLabelEnterID] = -1;
	}
	foreach(new i : Player)
	{
		p_Biz[i][LastBizVisited] = INVALID_BIZ_ID;
		p_Biz[i][BizCreating] =
		p_Biz[i][InteriorCreating] =
		p_Biz[i][ObjectEditing] = -1;
	}
	new query[1200];
	format(query, sizeof(query), "CREATE TABLE IF NOT EXISTS `Biz_Data` (`SQLID` INTEGER PRIMARY KEY AUTO_INCREMENT, `Type` SMALLINT NOT NULL DEFAULT '0', `Interior` INT NOT NULL DEFAULT '0', `Level` INT NOT NULL DEFAULT '0', `Price` INT NOT NULL DEFAULT '0',");
	strcat(query, " `Safe` SMALLINT NOT NULL DEFAULT '0', `EnterPrice` INT NOT NULL DEFAULT '0', `VW` INT NOT NULL DEFAULT '0', `Bought` TINYINT NOT NULL DEFAULT '0', `Open` TINYINT NOT NULL DEFAULT '0', `Investor` SMALLINT NOT NULL DEFAULT '0', `Objects` SMALLINT NOT NULL DEFAULT '0',");
	strcat(query, " `X` FLOAT NOT NULL DEFAULT '0.0', `Y` FLOAT NOT NULL DEFAULT '0.0', `Z` FLOAT NOT NULL DEFAULT '0.0', `eX` FLOAT NOT NULL DEFAULT '0.0', `eY` FLOAT NOT NULL DEFAULT '0.0', `eZ` FLOAT NOT NULL DEFAULT '0.0', `eVW` INT NOT NULL DEFAULT '0', `eInter` SMALLINT NOT NULL DEFAULT '0',");
	strcat(query, " `Owner` VARCHAR(25) NOT NULL DEFAULT 'None', `BizName` VARCHAR(50) NOT NULL DEFAULT 'None')");
	mysql_pquery(MySQL, query);
	format(query, sizeof(query), "CREATE TABLE IF NOT EXISTS `Biz_Investor` (`SQLID` INTEGER PRIMARY KEY, `Safe` SMALLINT NOT NULL DEFAULT '0', `Lock` SMALLINT NOT NULL DEFAULT '0', `EnterPrice` SMALLINT NOT NULL DEFAULT '0', `Rename` SMALLINT NOT NULL DEFAULT '0', `Deposit` SMALLINT NOT NULL DEFAULT '0',");
	strcat(query, " `Withdraw` SMALLINT NOT NULL DEFAULT '0', `Name` VARCHAR(25) NOT NULL DEFAULT '')");
	mysql_pquery(MySQL, query);
	format(query, sizeof(query), "CREATE TABLE IF NOT EXISTS `Biz_CustomInterior` (`SQLID` INTEGER PRIMARY KEY AUTO_INCREMENT, `X` FLOAT NOT NULL DEFAULT '0.0', `Y` FLOAT NOT NULL DEFAULT '0.0', `Z` FLOAT NOT NULL DEFAULT '0.0', `InteriorID` INT NOT NULL DEFAULT '0', `Name` VARCHAR(50) NOT NULL DEFAULT 'NoName')");
	mysql_pquery(MySQL, query);
	format(query, sizeof(query), "CREATE TABLE IF NOT EXISTS `Biz_Object` (`SQLID` INTEGER PRIMARY KEY AUTO_INCREMENT, `X` FLOAT NOT NULL DEFAULT '0.0', `Y` FLOAT NOT NULL DEFAULT '0.0', `Z` FLOAT NOT NULL DEFAULT '0.0', `rX` FLOAT NOT NULL DEFAULT '0.0', `rY` FLOAT NOT NULL DEFAULT '0.0',");
    strcat(query, " `rZ` FLOAT NOT NULL DEFAULT '0.0', `DrawDistance` FLOAT NOT NULL DEFAULT '0.0', `Biz` SMALLINT NOT NULL DEFAULT '0', `ID` SMALLINT NOT NULL DEFAULT '0', `Interior` SMALLINT NOT NULL DEFAULT '0', `VirtualWorld` INT NOT NULL DEFAULT '0')");
	mysql_pquery(MySQL, query);
	print(FPRINT"MYSQL Tables sucessfuly created if needed.");
	mysql_tquery(MySQL, "SELECT * FROM Biz_Data ORDER BY SQLID", "OnBizsLoading");
	mysql_tquery(MySQL, "SELECT * FROM Biz_Investor ORDER BY SQLID", "OnInvestorsLoading");
	mysql_tquery(MySQL, "SELECT * FROM Biz_CustomInterior ORDER BY SQLID", "OnCustomInteriorLoading");
	mysql_tquery(MySQL, "SELECT * FROM Biz_Object ORDER BY SQLID", "OnObjectsLoading");
	print(FPRINT"MYSQL Tables sucessfuly loaded.");
	print(FPRINT"Filterscript sucessfuly loaded");
	return 1;
}

public OnPlayerConnect(playerid)
{
	p_Biz[playerid][LastBizVisited] = INVALID_BIZ_ID;
	p_Biz[playerid][BizCreating] =
	p_Biz[playerid][InteriorCreating] =
	p_Biz[playerid][ObjectEditing] = -1;
	return 1;
}

//--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

PUBLIC:OnBizsLoading()
{
	new temporaire,
		number,
		nbBiz = cache_num_rows();

	if(!nbBiz) return print(FPRINT"No bizs loaded.");
	for(new i; i != nbBiz; i++)
	{
		cache_get_value_int(i, "SQLID", temporaire); // SQLID
		BizInfo[temporaire][bSQLID] = CurrentMaxBizID = temporaire;
		cache_get_value_int(i, "Type", BizInfo[temporaire][bType]);
		cache_get_value_int(i, "Level", BizInfo[temporaire][bLevel]);
		cache_get_value_int(i, "Price", BizInfo[temporaire][bPrice]);
		cache_get_value_int(i, "Safe", BizInfo[temporaire][bSafe]);
		cache_get_value_int(i, "EnterPrice", BizInfo[temporaire][bEnterPrice]);
		cache_get_value_int(i, "VW", BizInfo[temporaire][bVW]);
		cache_get_value_int(i, "Interior", BizInfo[temporaire][bInterior]);
		cache_get_value_int(i, "Objects", BizInfo[temporaire][bObjects]);

		cache_get_value_int(i, "eVW", BizInfo[temporaire][bEVW]);
		cache_get_value_int(i, "eInter", BizInfo[temporaire][bEInt]);

		cache_get_value_float(i, "X", BizInfo[temporaire][bX]);
		cache_get_value_float(i, "Y", BizInfo[temporaire][bY]);
		cache_get_value_float(i, "Z", BizInfo[temporaire][bZ]);
		cache_get_value_float(i, "eX", BizInfo[temporaire][beX]);
		cache_get_value_float(i, "eY", BizInfo[temporaire][beY]);
		cache_get_value_float(i, "eZ", BizInfo[temporaire][beZ]);

		cache_get_value_int(i, "Bought", bool:BizInfo[temporaire][bBought]);
		cache_get_value_int(i, "Open", bool:BizInfo[temporaire][bOpen]);
		cache_get_value_int(i, "Investor", bool:BizInfo[temporaire][bInvestor]);

		BizInfo[temporaire][bCreated] = true;
		Iter_Add(It_Biz, temporaire);

		cache_get_value(i, "Owner", BizInfo[temporaire][bOwner], MAX_PLAYER_NAME);
		cache_get_value(i, "BizName", BizInfo[temporaire][bName], MAX_BIZ_NAME);

		if(BizInfo[temporaire][bEnterPrice] != 0 && !BizInfo[temporaire][bBought])
		{
			BizInfo[temporaire][bEnterPrice] = 0, printf(FPRINT"Loading... | Biz %i | Price enter resetted");
			number++;
		}
	}
	BizVW = BizInfo[CurrentMaxBizID][bVW];
	printf(FPRINT"%i bizs loaded (max ID: %i)", number, CurrentMaxBizID);
	return 1;
}

//--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

PUBLIC:OnInvestorsLoading()
{
	new temporaire;
	for(new i, j = cache_num_rows(); i != j; i++)
	{
		cache_get_value_int(i, "SQLID", temporaire);
		BizInv[temporaire][iSQLID] = temporaire;
		BizInv[temporaire][iInves] = true;
		cache_get_value_int(i, "Safe", bool:BizInv[temporaire][iSafe]);
		cache_get_value_int(i, "Lock", bool:BizInv[temporaire][iLock]);
		cache_get_value_int(i, "EnterPrice", bool:BizInv[temporaire][iEnterPrice]);
		cache_get_value_int(i, "Rename", bool:BizInv[temporaire][iRename]);
		cache_get_value_int(i, "Deposit", bool:BizInv[temporaire][iDeposit]);
		cache_get_value_int(i, "Withdraw", bool:BizInv[temporaire][iWithdraw]);
		cache_get_value(i, "Name", BizInv[temporaire][iName], MAX_PLAYER_NAME);
		Iter_Add(It_Investor, temporaire);
		SetBizInfos(temporaire, false, true, true, true, true);
	}
	print(FPRINT"Investors's data loaded");
}

//--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

PUBLIC:OnCustomInteriorLoading()
{
	new temporaire;
	for(new i, j = cache_num_rows(); i != j; i++)
	{
		cache_get_value_int(i, "SQLID", temporaire);
		BizInterior[temporaire][i_SQLID] = CurrentMaxCustomInterior = temporaire;
		cache_get_value_float(i, "X", BizInterior[temporaire][i_X]);
		cache_get_value_float(i, "Y", BizInterior[temporaire][i_Y]);
		cache_get_value_float(i, "Z", BizInterior[temporaire][i_Z]);
		cache_get_value_int(i, "InteriorID", BizInterior[temporaire][i_Interior]);
		cache_get_value(i, "Name", BizInterior[temporaire][i_Name], MAX_BIZ_NAME);
		NumberOfInterior++;
		Iter_Add(It_Interior, temporaire);
	}
	printf(FPRINT"Custom interiors loaded (maxID: %i)!", CurrentMaxCustomInterior);
}

//--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

PUBLIC:OnObjectsLoading()
{
	new temporaire[E_OBJECTS], index;

	for(new i, j = cache_num_rows(); i != j; i++)
	{
		cache_get_value_int(i, "SQLID", temporaire[oSQLID]);
		cache_get_value_int(i, "Biz", temporaire[oBiz]);
		cache_get_value_int(i, "ID", temporaire[oID]);
		cache_get_value_int(i, "Interior", temporaire[oInterior]);
		cache_get_value_int(i, "VirtualWorld", temporaire[oVirtualWorld]);
		cache_get_value_float(i, "X", temporaire[oX]);
		cache_get_value_float(i, "Y", temporaire[oY]);
		cache_get_value_float(i, "Z", temporaire[oZ]);
		cache_get_value_float(i, "rX", temporaire[oRX]);
		cache_get_value_float(i, "rY", temporaire[oRY]);
		cache_get_value_float(i, "rZ", temporaire[oRZ]);
		cache_get_value_float(i, "DrawDistance", temporaire[oDrawDistance]);
		#if !Streamer_Plugin
			temporaire[oSID] = CreateObject(temporaire[oID], temporaire[oX], temporaire[oY], temporaire[oZ], temporaire[oRX], temporaire[oRX], temporaire[oRX], temporaire[oDrawDistance]);
		#else
			temporaire[oSID] = CreateDynamicObject(temporaire[oID], temporaire[oX], temporaire[oY], temporaire[oZ], temporaire[oRX], temporaire[oRY], temporaire[oRZ], temporaire[oVirtualWorld], temporaire[oInterior], .drawdistance = temporaire[oDrawDistance]);
		#endif
		index = temporaire[oSID];
		BizObjects[index] = temporaire;
		BizObjects[index][oSQLID] = CurrentMaxObjects = temporaire[oSQLID];
		Iter_Add(It_Objects, index);
	}
	printf(FPRINT"Objects on mapping loaded (number of objects: %i)!", CurrentMaxObjects);
}

// ============================================================================================================================================================================================

public OnFilterScriptExit()
{
	foreach(new i : It_Biz)
	{
		#if !Streamer_Plugin
			Delete3DTextLabel(BizInfo[i][bLabelID]);
			Delete3DTextLabel(BizInfo[i][bLabelEnterID]);
			DestroyPickup(BizInfo[i][bPickupID]);
			DestroyPickup(BizInfo[i][bPickupEnter]);
		#else
			DestroyDynamic3DTextLabel(BizInfo[i][bLabelID]);
			DestroyDynamic3DTextLabel(BizInfo[i][bLabelEnterID]);
			DestroyDynamicPickup(BizInfo[i][bPickupID]);
			DestroyDynamicPickup(BizInfo[i][bPickupEnter]);
		#endif
		SaveBizData(i);
		SaveInvestorData(i);
	}
	new query[200];
	foreach(new i : It_Interior)
	{
		mysql_format(MySQL, query, sizeof(query), "UPDATE `Biz_CustomInterior` SET `X` = '%f', `Y` = '%f', `Z` = '%f', `InteriorID` = '%i', `Name` = '%e' WHERE `SQLID` = '%i'",
			BizInterior[i][i_X], BizInterior[i][i_Y], BizInterior[i][i_Z], BizInterior[i][i_Interior], BizInterior[i][i_Name], BizInterior[i][i_SQLID]);
		mysql_pquery(MySQL, query);
	}
	foreach(new i : Player)
	{
		if(p_Biz[i][LastBizVisited] != INVALID_BIZ_ID)
		{
			if(!IsValidBiz(p_Biz[i][LastBizVisited])) continue;

			SetPlayerPos(i, BizInfo[p_Biz[i][LastBizVisited]][bX], BizInfo[p_Biz[i][LastBizVisited]][bY], BizInfo[p_Biz[i][LastBizVisited]][bZ]);
			#if Streamer_Plugin
				SetPlayerInterior(i, BizInfo[p_Biz[i][LastBizVisited]][bEInt]);
				SetPlayerVirtualWorld(i, BizInfo[p_Biz[i][LastBizVisited]][bEVW]);
			#else
				SetPlayerInterior(i, 0);
				SetPlayerVirtualWorld(i, 0);
			#endif
			ErrorMsg(i, "An administrator has unloaded the filterscript, you have been teleported out of the biz.");
			printf(FPRINT"Unloading ... | Player %s | Teleported out of a biz (ID:%i)", GetName(i, true), p_Biz[i][LastBizVisited]);
		}
	}
	foreach(new i : It_Objects)
	{
		#if Streamer_Plugin
			DestroyDynamicObject(i);
		#else
			DestroyObject(i);
		#endif
		SaveObject(i);
		ResetObjectData(i);
	}
	mysql_close(MySQL);
	print(FPRINT"Filterscript sucessfuly unloaded");
	return 1;
}

// ============================================================================================================================================================================================
// ============================================================================================================================================================================================

public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
{
	if(p_Biz[playerid][LastBizVisited] != INVALID_BIZ_ID && newinteriorid == 0)
	{
		SetTimerEx("TeleChecking", 1000, false, "i", playerid);
	}
	return 1;
}

// ============================================================================================================================================================================================

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
	if((newkeys == KEY_SECONDARY_ATTACK) && (oldkeys == 0) && IsNearABiz(playerid))
	{
		new bizid = GetNearestBiz(playerid), pBiz = GetPlayerBiz(playerid);
		if(pBiz != bizid && !IsPlayerAdmin(playerid) && !BizInfo[bizid][bBought]) return ErrorMsg(playerid, "This biz is closed.");
		if(BizInfo[bizid][bEnterPrice] > GetPlayerMoney(playerid) && pBiz != bizid) return ErrorMsg(playerid, "You don't have enough money to enter in this biz.");
		EnterInABiz(playerid, bizid);
		if(!BizInfo[bizid][bBought] || pBiz == bizid || BizInfo[bizid][bEnterPrice] == 0)return 1;
		SetMoneyGameText(playerid, -BizInfo[bizid][bEnterPrice]);
		GivePlayerMoney(playerid, -BizInfo[bizid][bEnterPrice]);
		BizInfo[bizid][bSafe] += BizInfo[bizid][bEnterPrice];
	}
	if((newkeys == KEY_SECONDARY_ATTACK) && (oldkeys == 0) && p_Biz[playerid][LastBizVisited] != INVALID_BIZ_ID && IsPlayerInRangeOfPoint(playerid, 3, BizInfo[p_Biz[playerid][LastBizVisited]][beX], BizInfo[p_Biz[playerid][LastBizVisited]][beY], BizInfo[p_Biz[playerid][LastBizVisited]][beZ]))
	{
		ExitABiz(playerid, p_Biz[playerid][LastBizVisited]);
	}
	return 1;
}
//--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
// ===========================================================================================================================================================================================
//                          																		Commands
// ===========================================================================================================================================================================================
//--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

CMD:createbiz(playerid, params[])
{
	new price,
		level,
		interior,
		Float:x,
		Float:y,
		Float:z,
		str[451 + EOS],
		str1[100];

	if(sscanf(params,"iii", interior, level, price))
	{
		SCM(playerid, LBLUE, "[USE] /createbiz [type] [level] [price]");
		format(str, sizeof(str), "{33adff}[USE] "LBLUE_U"/createbiz [type] [level] [price]\n\
		"LGOLD_U"type: "LBLUE_U"Which type of buisness it will be\n\
		"LGOLD_U"level: "LBLUE_U"Level (score) required to buy this biz\n\
		"LGOLD_U"price: "LBLUE_U"Money required to buy this biz.\n\nSort of type (biz):");
		for(new i; i < sizeof(InteriorName); i++)
		{
			format(str1, sizeof(str1), LGOLD_U"\nType %i : "WHITE_U"%s", i, InteriorName[i]);
			strcat(str, str1);
		}
		Dialog_Show(playerid, createbizhelp, DIALOG_STYLE_MSGBOX, "Help for /createbiz", str, "Ok", "");
		return 1;
	}
	if(GetNearestBiz(playerid) != INVALID_BIZ_ID) return ErrorMsg(playerid, "The biz is too close to another. (Nearest Biz -> ID:%i)", GetNearestBiz(playerid));
	if(!(0 <= interior <= 6))
	return ErrorMsg(playerid, "Wrong interior ID (%i). [only 0-6]", interior); // Change 6 if you added more type!
	if(!interior && !NumberOfInterior) return ErrorMsg(playerid, "There is no custom interior available. You need to create one at least.");
	if(price < 10) return ErrorMsg(playerid, "The price need to be at least 10$.");
	if(level < 1) return ErrorMsg(playerid, "The level need to be at least 1.");
	new query[250];
	mysql_format(MySQL, query, sizeof(query), "INSERT INTO `Biz_Data` (`X`, `Y`, `Z`, `Type`) VALUES ('%f', '%f', '%f', '%i')", x, y, z, interior);
	mysql_tquery(MySQL, query, "OnBizCreated", "iiiifff", playerid, price, level, interior, x, y, z);
	return 1;
}

//--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

PUBLIC:OnBizCreated(playerid, price, level, interior, Float:x, Float:y, Float:z)
{
	GetPlayerPos(playerid, x, y, z);
	CurrentMaxBizID = cache_insert_id();
	new	str[200], str1[200];
	BizVW++;
	BizInfo[CurrentMaxBizID][bX] 		= x;
	BizInfo[CurrentMaxBizID][bY]		= y;
	BizInfo[CurrentMaxBizID][bZ]		= z;
	BizInfo[CurrentMaxBizID][bOpen] 	=
	BizInfo[CurrentMaxBizID][bCreated] 	= true;
	BizInfo[CurrentMaxBizID][bPrice] 	= price;
	BizInfo[CurrentMaxBizID][bSQLID] 	= CurrentMaxBizID;
	BizInfo[CurrentMaxBizID][bType] 	= interior;
	BizInfo[CurrentMaxBizID][bLevel] 	= level;
	BizInfo[CurrentMaxBizID][bVW] 		= BizVW;
	BizInfo[CurrentMaxBizID][bEVW] 		= GetPlayerVirtualWorld(playerid);
	BizInfo[CurrentMaxBizID][bEInt] 	= GetPlayerInterior(playerid);
	format(BizInfo[CurrentMaxBizID][bOwner], MAX_PLAYER_NAME, "None");
	format(BizInfo[CurrentMaxBizID][bName], MAX_BIZ_NAME, "%s", InteriorName[interior]);
	p_Biz[playerid][BizCreating] = CurrentMaxBizID;
	AnnonceMsg(playerid, "You have creeated a biz ! Biz ID: %i - Price : %i$ - Level required %i", CurrentMaxBizID, price, level);
	mysql_format(MySQL, str, sizeof(str), "INSERT INTO `Biz_Investor` (`SQLID`, `Name`) VALUES ('%i', '%e')", (BizInv[CurrentMaxBizID][iSQLID] = CurrentMaxBizID), "None");
	mysql_pquery(MySQL, str);
	ResetInvestorData(CurrentMaxBizID);
	if(interior)
	{
		for(new i, j = sizeof(BizData); i < j; i++)
		{
			if(BizData[i][Type] != interior) continue;
			format(str, sizeof(str), "\n%i - %s", i, BizData[i][Name]);
			strcat(str1, str);
		}
	}
	else
	{
		foreach(new i : It_Interior)
		{
			format(str, sizeof(str), "\n%i - %s", i, BizInterior[i][i_Name]);
			strcat(str1, str);
		}
	}
	Dialog_Show(playerid, DIALOG_CREATEBIZ, DIALOG_STYLE_LIST, InteriorName[interior], str1, "Choose", "Cancel");
	return 1;
}
//--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
DIALOG(DIALOG_CREATEBIZ)
{
	if(!response)
	{
		goto failed;
		failed:
		{
			ResetBizData(p_Biz[playerid][BizCreating], false);
			p_Biz[playerid][BizCreating] = -1;
			return 1;
		}
	}

	if(BizInfo[p_Biz[playerid][BizCreating]][bType])
	{
		listitem += FirstIntID(BizInfo[p_Biz[playerid][BizCreating]][bType]);
		if(BizInfo[p_Biz[playerid][BizCreating]][bInterior] >= INVALID_BIZ_ID)
		{
			printf(FPRINT"Error during choosing an interior! (Biz ID: %i & Player: %s)", p_Biz[playerid][BizCreating], GetName(playerid, true));
			goto failed;
			return 1;
		}
		BizInfo[p_Biz[playerid][BizCreating]][bInterior] = listitem;
		BizInfo[p_Biz[playerid][BizCreating]][beX]	= BizData[listitem][X];
		BizInfo[p_Biz[playerid][BizCreating]][beY]	= BizData[listitem][Y];
		BizInfo[p_Biz[playerid][BizCreating]][beZ]	= BizData[listitem][Z];
	}
	else
	{
		listitem++;
		new a;
		foreach(new i : It_Interior)
		{
			a++;
			if(a == listitem)
			{
				BizInfo[p_Biz[playerid][BizCreating]][bInterior] = BizInterior[i][i_SQLID];
				BizInfo[p_Biz[playerid][BizCreating]][beX]	= BizInterior[i][i_X];
				BizInfo[p_Biz[playerid][BizCreating]][beY]	= BizInterior[i][i_Y];
				BizInfo[p_Biz[playerid][BizCreating]][beZ]	= BizInterior[i][i_Z];
				format(BizInfo[p_Biz[playerid][BizCreating]][bName], MAX_BIZ_NAME, "%s", BizInterior[i][i_Name]);
				break;
			}
		}
	}
	DestroyPickup(BizInfo[p_Biz[playerid][BizCreating]][bPickupID]);
	SetBizInfos(p_Biz[playerid][BizCreating], true, true, true, true, true);
	SaveBizData(p_Biz[playerid][BizCreating]);
	EnterInABiz(playerid, p_Biz[playerid][BizCreating]);
	p_Biz[playerid][BizCreating] = -1;
	return 1;
}

// ============================================================================================================================================================================================

CMD:destroybiz(playerid, params[])
{
	new bizid;
	if(sscanf(params, "i", bizid)) return SCM(playerid, LBLUE, "[USE] /destroybiz [bizid] [-1: ALL]");
	if(!IsValidBiz(bizid) && bizid != -1) return ErrorMsg(playerid, INVALID_BIZ_MSG);
	if(bizid != -1)
	{
		foreach(new i : Player)
		{
			if(p_Biz[i][LastBizVisited] == bizid)
			{
				SetPlayerPos(i, BizInfo[p_Biz[i][LastBizVisited]][bX], BizInfo[p_Biz[i][LastBizVisited]][bY], BizInfo[p_Biz[i][LastBizVisited]][bZ]);
				SetPlayerInterior(i, 0);
				SetPlayerVirtualWorld(i, 0);
				ErrorMsg(i, "An administrator has destroyed the biz, you have been teleported out of the biz.");
				printf(FPRINT"Admin | Player: %s | Teleported out of a biz (ID:%i) - Biz destroyed", GetName(i, true), p_Biz[i][LastBizVisited]);
			}
		}
		ResetBizData(bizid);
		AdminMsg(playerid, "You have destroyed the biz ID %i!", bizid);
	}
	else
	{
		foreach(new i : It_Biz)
		{
			foreach(new j : Player)
			{
				if(p_Biz[j][LastBizVisited] == i)
				{
					SetPlayerPos(j, BizInfo[p_Biz[j][LastBizVisited]][bX], BizInfo[p_Biz[j][LastBizVisited]][bY], BizInfo[p_Biz[j][LastBizVisited]][bZ]);
					SetPlayerInterior(j, 0);
					SetPlayerVirtualWorld(j, 0);
					ErrorMsg(j, "An administrator has destroyed the biz, you have been teleported out of the biz.");
					printf(FPRINT"Admin | Player: %s | Teleported out of a biz (ID:%i)", GetName(j, true), p_Biz[j][LastBizVisited]);
				}
			}
			ResetBizData(i);
		}
		CurrentMaxBizID = 0;
		AdminMsg(playerid, "You have destroyed all biz.");
	}
	return 1;
}

// ============================================================================================================================================================================================

CMD:buybiz(playerid, params[])
{
	if(PlayerHasABiz(playerid)) return ErrorMsg(playerid, PLAYER_HAVE_BIZ);
	new bizid = GetNearestBiz(playerid);
	if(bizid == INVALID_BIZ_ID) return ErrorMsg(playerid, NOT_NEAR_A_BIZ);
	if(BizInfo[bizid][bBought]) return ErrorMsg(playerid, "This biz have a owner.");
	if(GetPlayerMoney(playerid) < BizInfo[bizid][bPrice]) return ErrorMsg(playerid, "You need %i$ for buy this biz (Missing money: "RED_U"%i${CC0000})", BizInfo[bizid][bPrice], BizInfo[bizid][bPrice]-GetPlayerMoney(playerid));
	if(GetPlayerScore(playerid) < BizInfo[bizid][bLevel]) return ErrorMsg(playerid, "You need to be at least level %i", BizInfo[bizid][bLevel]);
	format(BizInfo[bizid][bOwner], MAX_PLAYER_NAME, "%s", GetName(playerid));
	BizInfo[bizid][bOpen] 	=
	BizInfo[bizid][bBought] = true;
	ResetInvestorData(bizid);
	SetBizInfos(bizid, true, true, false, true);
	GivePlayerMoney(playerid, -BizInfo[bizid][bPrice]);
	if(BizInfo[bizid][bType])
	{
	    AnnonceMsg(playerid, "You have bought this biz! It cost %i$ and it's a the shop is: %s", BizInfo[bizid][bPrice], InteriorName[BizInfo[bizid][bType]][0]);
	}
	else
	{
		AnnonceMsg(playerid, "You have bought this biz! It cost %i$ and it's a the shop is: %s", BizInfo[bizid][bPrice], BizInterior[BizInfo[bizid][bInterior]][i_Name]);
    }
	return 1;
}

// ============================================================================================================================================================================================

CMD:managebiz(playerid)
{
	// if(!PlayerHasABiz(playerid))
	// 	return 1;

	return !PlayerHasABiz(playerid) ? ErrorMsg(playerid, PLAYER_HAVE_NOT_BIZ) :	Dialog_Show(playerid, DIALOG_INFO_BIZ, DIALOG_STYLE_TABLIST, "Info", "View informations of your biz\nChange the enter price \t\t%i$\nOpen/Lock your biz\t\t%s\nDeposit money\nWithdraw money\nRename your biz", "Choose", "Cancel", BizInfo[GetPlayerBiz(playerid)][bEnterPrice], OpenFormatBiz[BizInfo[GetPlayerBiz(playerid)][bOpen]][0]);
}

DIALOG(DIALOG_INFO_BIZ)
{
	if(!response) return 1;
	new bizid = GetPlayerBiz(playerid);
	if(bizid == INVALID_BIZ_ID) return Dialog_Show(playerid, ERROR, DIALOG_STYLE_MSGBOX, "Unknown", WHITE_U"An error occured. Take a screenshoot [F8] and inform Dayrion.\nError ID: 03", "Ok", "");
	switch(listitem)
	{
		case 0:
		{
			new str[550];
			format(str, sizeof(str), "- Biz ID: %i\n- Owner: %s\n- Door: %s\n- Resale price: %i$\n- Safe: %i$\n- Name: %s\n- Investor: %s\n- Object(s): %i ", BizInfo[bizid][bSQLID], BizInfo[bizid][bOwner], OpenFormatBiz[BizInfo[bizid][bOpen]], floatround(BizInfo[bizid][bPrice]/2, floatround_round), BizInfo[bizid][bSafe], BizInfo[bizid][bName], BizInv[bizid][iName], BizInfo[bizid][bObjects]);
			Dialog_Show(playerid, DIALOG_INFO1, DIALOG_STYLE_MSGBOX, "Info biz", str, "Ok", "");
		}
		case 1:
		{
			p_Biz[playerid][BizCreating] = bizid;
			Dialog_Show(playerid, DIALOG_PRICECHANGER, DIALOG_STYLE_INPUT, "Change the price enter", "Change the enter price", "Confirm", "Cancel");
		}
		case 2:
		{
			if(GetNearestBiz(playerid) != bizid && p_Biz[playerid][LastBizVisited] != bizid) return ErrorMsg(playerid, "You are too far away from your biz.");
			if(BizInfo[bizid][bOpen])
			{
				BizInfo[bizid][bOpen] = false;
				DestroyPickup(BizInfo[bizid][bPickupID]);
				SCM(playerid, RED, "You have locked your biz.");
				SetBizInfos(bizid, .save = true, .pID = true);
			}
			else
			{
				BizInfo[bizid][bOpen] = true;
				DestroyPickup(BizInfo[bizid][bPickupID]);
				SCM(playerid, GREEN, "You have opened your biz.");
				SetBizInfos(bizid, .save = true, .pID = true);
			}
		}
		case 3:
		{
			if(p_Biz[playerid][LastBizVisited] != bizid) return ErrorMsg(playerid, NOT_INSIDE_A_BIZ);

			p_Biz[playerid][BizCreating] = bizid;
			Dialog_Show(playerid, DIALOG_DEPOSIT, DIALOG_STYLE_INPUT, "Deposit money", "Set the amount of money to deposit it.", "Confirm", "Cancel");
		}
		case 4:
		{
			if(p_Biz[playerid][LastBizVisited] != bizid) return ErrorMsg(playerid, NOT_INSIDE_A_BIZ);
			p_Biz[playerid][BizCreating] = bizid;
			Dialog_Show(playerid, DIALOG_WITHDRAW, DIALOG_STYLE_INPUT, "Withdraw money", "Set the amount of money to withdraw it.", "Confirm", "Cancel");
		}
		case 5:
		{
			if(p_Biz[playerid][LastBizVisited] != bizid && GetNearestBiz(playerid) != bizid) return ErrorMsg(playerid, NOT_INSIDE_A_BIZ);
			p_Biz[playerid][BizCreating] = bizid;
			Dialog_Show(playerid, DIALOG_NAME, DIALOG_STYLE_INPUT, "Name your biz", "Enter a name for your biz.", "Confirm", "Cancel");
		}
		default : Dialog_Show(playerid, ERROR, DIALOG_STYLE_MSGBOX, "Unknown", WHITE_U"An error occured. Take a screenshoot [F8] and inform Dayrion.\nError ID: 04", "Ok", "");
	}
	return 1;
}

// ============================================================================================================================================================================================

CMD:closestbiz(playerid)
{
	new a = GetNearestBiz(playerid);
	return a == INVALID_BIZ_ID ? ErrorMsg(playerid, NOT_NEAR_A_BIZ) : AdminMsg(playerid, "The closest biz is ID %i - Name : '%s'", a, BizInfo[a][bName]);
}

// ============================================================================================================================================================================================

CMD:sellbiz(playerid)
{
	if(!PlayerHasABiz(playerid)) return ErrorMsg(playerid, PLAYER_HAVE_NOT_BIZ);
	if(GetNearestBiz(playerid) != GetPlayerBiz(playerid)) return ErrorMsg(playerid, "You need to be near your biz to do that.");
	new bizid = GetNearestBiz(playerid);
	BizInfo[bizid][bBought] = false;
	BizInfo[bizid][bSafe] 		=
	BizInfo[bizid][bEnterPrice] = 0;
	format(BizInfo[bizid][bOwner], MAX_PLAYER_NAME, "None");
	if(!BizInfo[bizid][bType])
	{
		format(BizInfo[bizid][bName], MAX_BIZ_NAME, "%s", BizInterior[BizInfo[bizid][bInterior]][i_Name]);
    }
	else
	{
		format(BizInfo[bizid][bName], MAX_BIZ_NAME, "%s", InteriorName[BizInfo[bizid][bType]][0]);
    }
	GivePlayerMoney(playerid, BizInfo[bizid][bPrice]/2);
	AnnonceMsg(playerid, "You have sold your biz for %i$.", BizInfo[bizid][bPrice]/2);
	SetBizInfos(bizid, true, true, false, true);
	return 1;
}

// ============================================================================================================================================================================================

CMD:editbiz(playerid, params[])
{
	new bizid;
	if(sscanf(params, "i", bizid)) return SCM(playerid, LBLUE, "[USE] /modifybiz [bizid]");
	if(!IsValidBiz(bizid)) return ErrorMsg(playerid, INVALID_BIZ_MSG);
	p_Biz[playerid][BizCreating] = bizid;
	Dialog_Show(playerid, DIALOG_INFO_BIZ_ADMIN, DIALOG_STYLE_TABLIST, "Info biz", "View informations of the biz\nChange the enter price \t%i\nOpen/Lock the biz\t%s\nChange the balance\nRename the biz\nSell the biz\nChange the interior\nChange the biz's type", "Choose", "Cancel", bizid, BizInfo[bizid][bEnterPrice], OpenFormatBiz[BizInfo[bizid][bOpen]]);
	return 1;
}

DIALOG(DIALOG_INFO_BIZ_ADMIN)
{
	new bizid = p_Biz[playerid][BizCreating];
	if(response)
	{
		switch(listitem)
		{
			case 0:
			{
				new str[350];
				format(str, sizeof(str),
				LGOLD_U"- Biz ID: "WHITE_U"%i\n\
				"LGOLD_U"- Owner : "WHITE_U"%s\n\
				"LGOLD_U"- Door : "WHITE_U"%s\n\
				"LGOLD_U"- Resale price : "WHITE_U"%i$\n\
				"LGOLD_U"- Safe : "WHITE_U"%i$\n\
				"LGOLD_U"- Name : "WHITE_U"%s\n\
				"LGOLD_U"- Investor : "WHITE_U"%s", BizInfo[bizid][bSQLID], BizInfo[bizid][bOwner], OpenFormatBiz[BizInfo[bizid][bOpen]], floatround(BizInfo[bizid][bPrice]/2, floatround_round), BizInfo[bizid][bSafe], BizInfo[bizid][bName], BizInv[bizid][iName]);
				Dialog_Show(playerid, DIALOG_INFO1, DIALOG_STYLE_MSGBOX, "Info biz", str, "Ok", "");
			}
			case 1: Dialog_Show(playerid, DIALOG_PRICECHANGER, DIALOG_STYLE_INPUT, "Change the price enter", "Change the enter price.\nActually : %i$", "Confirm", "Cancel", BizInfo[bizid][bEnterPrice]);
			case 2:
			{
				if(BizInfo[bizid][bOpen])
				{
					BizInfo[bizid][bOpen] = false;
					DestroyPickup(BizInfo[bizid][bPickupID]);
					SCM(playerid, RED, "You have closed this biz.");
					SetBizInfos(bizid, .save = true, .pID = true);
				}
				else
				{
					BizInfo[bizid][bOpen] = true;
					DestroyPickup(BizInfo[bizid][bPickupID]);
					SCM(playerid, GREEN, "You have opened this biz.");
					SetBizInfos(bizid, .save = true, .pID = true);
				}
			}
			case 3:	Dialog_Show(playerid, DIALOG_BALANCE, DIALOG_STYLE_INPUT, "Modify balance", "Modify the current balance.\nActually : %i$", "Confirm", "Cancel", BizInfo[bizid][bSafe]);
			case 4:	Dialog_Show(playerid, DIALOG_NAME, DIALOG_STYLE_INPUT, "Name your biz", "Enter a name for the biz ID:%i (Actually : '%s')", "Confirm", "Cancel", bizid, BizInfo[bizid][bName]);
			case 5:
			{
				if(!BizInfo[bizid][bBought]) return ErrorMsg(playerid, "This biz is free and can't be sell right now.");
				BizInfo[bizid][bBought] = false;
				format(BizInfo[bizid][bOwner], MAX_PLAYER_NAME, "None");
				format(BizInfo[bizid][bName], MAX_BIZ_NAME, "None");
				BizInfo[bizid][bSafe] = 0;
				GivePlayerMoney(playerid, BizInfo[bizid][bPrice]/2);
				SetBizInfos(bizid, true, false, false, true);
				AdminMsg(playerid, "You have correctly sold biz ID:%i", bizid);
			}
			case 6:
			{
				new str1[100], str[100];
				if(BizInfo[bizid][bType])
				{
					for(new i, j = sizeof(BizData); i < j; i++)
					{
						if(BizData[i][Type] != BizInfo[bizid][bType]) continue;
						format(str, sizeof(str), "\n%i - %s", i, BizData[i][Name]);
						strcat(str1, str);
					}
				}
				else
				{
					if(!NumberOfInterior) return ErrorMsg(playerid, "There is no custom interior available. You need to create one at least.");
					for(new i; i < CurrentMaxCustomInterior; i++)
					{
						if(!IsValidInterior(i)) continue;
						format(str, sizeof(str), "\n%i - %s", i, BizInterior[i][i_Name]);
						strcat(str1, str);
					}
				}
				Dialog_Show(playerid, DIALOG_MODIFY_INTERIOR, DIALOG_STYLE_LIST, InteriorName[BizInfo[bizid][bType]][0], str1, "Choose", "Cancel");
			}

			case 7:
			{
				new	str[250],str1[120];
				for(new i; i < sizeof(InteriorName); i++)
				{
					format(str1, sizeof(str1), LGOLD_U"Type %i : "WHITE_U"%s\n", i, InteriorName[i][0]);
					strcat(str, str1);
				}
				Dialog_Show(playerid, DIALOG_MODIFY_TYPE, DIALOG_STYLE_LIST, "Change the biz's type", str, "Ok", "Cancel");
			}
			default : Dialog_Show(playerid, ERROR, DIALOG_STYLE_MSGBOX, "Unknown", LBLUE_U"An error occured. Take a screenshoot [F8] and inform Dayrion.\nError ID: 06", "Ok", "");
		}
		if(!BizInfo[bizid][bBought])
		{
			SCM(playerid, RED, "[Admin] Be careful, nobody bought this biz!");
		}

		else
		{
			p_Biz[playerid][BizCreating] = -1;
        }
    }
	return 1;
}

DIALOG(DIALOG_MODIFY_INTERIOR)
{
	if(!response) return Dialog_Show(playerid, DIALOG_INFO_BIZ_ADMIN, DIALOG_STYLE_TABLIST, "Info biz", "View informations of the biz\nChange the enter price \t%i\nOpen/Lock the biz\t%s\nChange the balance\nRename the biz\nSell the biz\nChange the interior\nChange the biz's type", "Choose", "Cancel", p_Biz[playerid][BizCreating], BizInfo[p_Biz[playerid][BizCreating]][bEnterPrice], OpenFormatBiz[BizInfo[p_Biz[playerid][BizCreating]][bOpen]]);
	listitem = (listitem) + FirstIntID(BizInfo[p_Biz[playerid][BizCreating]][bType]);
	BizInfo[p_Biz[playerid][BizCreating]][bInterior] = listitem;
	if(BizInfo[p_Biz[playerid][BizCreating]][bInterior] >= INVALID_BIZ_ID)
	{
		Dialog_Show(playerid, ERROR, DIALOG_STYLE_MSGBOX, "Unknown", LBLUE_U"An error occured. Take a screenshoot [F8] and inform Dayrion.\nError ID: 11", "Ok", "");
		p_Biz[playerid][BizCreating] = -1;
		return 1;
	}
	BizInfo[p_Biz[playerid][BizCreating]][beX]	= BizData[listitem][X];
	BizInfo[p_Biz[playerid][BizCreating]][beY]	= BizData[listitem][Y];
	BizInfo[p_Biz[playerid][BizCreating]][beZ]	= BizData[listitem][Z];
	if(!BizInfo[p_Biz[playerid][BizCreating]][bBought])
	{
		format(BizInfo[p_Biz[playerid][BizCreating]][bName], MAX_BIZ_NAME, "%s", BizInfo[p_Biz[playerid][BizCreating]][bType] ? InteriorName[BizInfo[p_Biz[playerid][BizCreating]][bType]][0] : BizInterior[BizInfo[p_Biz[playerid][BizCreating]][bInterior]][i_Name]);
    }
	SetBizInfos(p_Biz[playerid][BizCreating], true, true, true, true, true);
	p_Biz[playerid][BizCreating] = -1;
	return 1;
}

DIALOG(DIALOG_MODIFY_TYPE)
{
	if(!response) return Dialog_Show(playerid, DIALOG_INFO_BIZ_ADMIN, DIALOG_STYLE_TABLIST, "Info biz", "View informations of the biz\nChange the enter price \t%i\nOpen/Lock the biz\t%s\nChange the balance\nRename the biz\nSell the biz\nChange the interior\nChange the biz's type", "Choose", "Cancel", p_Biz[playerid][BizCreating], BizInfo[p_Biz[playerid][BizCreating]][bEnterPrice], OpenFormatBiz[BizInfo[p_Biz[playerid][BizCreating]][bOpen]]);
	if(!NumberOfInterior && !listitem) return ErrorMsg(playerid, "There is no custom interior available. You need to create one at least.");
	BizInfo[p_Biz[playerid][BizCreating]][bType] = listitem;
	new str1[300],str[200];
	if(BizInfo[p_Biz[playerid][BizCreating]][bType])
	{
		for(new i, j = sizeof(BizData); i < j; i++)
		{
			if(BizData[i][Type] != BizInfo[p_Biz[playerid][BizCreating]][bType]) continue;
			format(str, sizeof(str), "\n%i - %s", i, BizData[i][Name]);
			strcat(str1, str);
		}
	}
	else
	{
		foreach(new i : It_Interior)
		{
			format(str, sizeof(str), "\n%i - %s", i, BizInterior[i][i_Name]);
			strcat(str1, str);
		}
	}
	Dialog_Show(playerid, DIALOG_MODIFY_INTERIOR, DIALOG_STYLE_LIST, InteriorName[BizInfo[p_Biz[playerid][BizCreating]][bType]], str1, "Choose", "");
	return 1;
}
// ============================================================================================================================================================================================
CMD:makeinvestor(playerid, params[])
{
	if(!PlayerHasABiz(playerid)) return ErrorMsg(playerid, PLAYER_HAVE_NOT_BIZ);
	new target, bizid = GetPlayerBiz(playerid);
	if(sscanf(params, "i", target)) return SCM(playerid, LBLUE, "[USE] /makeinvestor [playerid] [-1 : Cancel investor]");
	if(!IsPlayerConnected(target) && target != -1) return ErrorMsg(playerid, "This player isn't connected or be more accurate in the name.");
	if(target == playerid) return ErrorMsg(playerid, "You can't make yourself as an investor.");
	if(target == -1)
	{
		if(IsPlayerConnected(target))
		{
			AnnonceMsg(target, "You are no longer an investor of the %s's biz (%s)", GetName(playerid), BizInfo[bizid][bName]);
        }
		AnnonceMsg(playerid, "%s has been removed of your investor.", BizInv[bizid][iName]);
		ResetInvestorData(bizid);
		SetBizInfos(bizid, true, false, false, true);
		return 1;
	}
	if(BizInv[bizid][iInves]) return ErrorMsg(playerid, "You have already an investor : %s", BizInv[bizid][iName]);
	format(BizInv[bizid][iName], MAX_PLAYER_NAME, "%s", GetName(target));
	BizInv[bizid][iInves]	=
	BizInv[bizid][iSafe]	= true;
	AnnonceMsg(playerid, "%s is now the new investor in your biz ('%s')", GetName(target), BizInfo[bizid][bName]);
	AnnonceMsg(target, "%s made you the new investor in his/her biz ('%s')", GetName(target), BizInfo[bizid][bName]);
	SetBizInfos(bizid, true, false, false, true);
	return 1;
}

// ============================================================================================================================================================================================

CMD:editinvestor(playerid)
{
	if(!PlayerHasABiz(playerid)) return ErrorMsg(playerid, PLAYER_HAVE_NOT_BIZ);
	if(!IsValidInvestor(GetPlayerBiz(playerid))) return ErrorMsg(playerid, "You don't have investor.");
	ShowDialogInvPerm(playerid, GetPlayerBiz(playerid));
	return 1;
}

// ============================================================================================================================================================================================

CMD:aeditinvestor(playerid, params[])
{
	new bizid;
	if(sscanf(params, "i", bizid)) return SCM(playerid, LBLUE, "[USE] /amodifinvestor [bizid]");
	if(!IsValidBiz(bizid)) return ErrorMsg(playerid, INVALID_BIZ_MSG);
	if(!IsValidInvestor(bizid)) return ErrorMsg(playerid, "This biz doesn't have an investor.");
	ShowDialogInvPerm(playerid, bizid);
	return 1;
}

// ============================================================================================================================================================================================

CMD:ibiz(playerid)
{
	if(GetInvestorBizID(playerid) == INVALID_BIZ_ID) return ErrorMsg(playerid, "You are not an investor of a biz.");
	ShowDialogInvestor(playerid, GetInvestorBizID(playerid));
	return 1;
}

// ============================================================================================================================================================================================

CMD:asetinvestor(playerid, params[])
{
	new bizid, name[MAX_PLAYER_NAME];
	if(sscanf(params, "is[24]", bizid, name)) return SCM(playerid, LBLUE, "[USE] /asetinvestor [bizid] [name]");
	if(!IsValidBiz(bizid)) return ErrorMsg(playerid, INVALID_BIZ_MSG);
	format(BizInv[bizid][iName], MAX_PLAYER_NAME, "%s", name);
	new target = GetIDByName(name);
	if(IsPlayerConnected(target))
	{
		AnnonceMsg(target, "An admin made you investor of the biz %s (Owner: %s) !", BizInfo[bizid][bName], BizInfo[bizid][bOwner]);
    }
	if(IsPlayerConnected((target = GetIDByName(BizInfo[bizid][bOwner]))))
	{
		AnnonceMsg(target, "An admin made %s an investor of your biz !", name);
    }
	SetBizInfos(bizid, true, false, false, true);
	return 1;
}

// ============================================================================================================================================================================================

CMD:gotobiz(playerid, params[])
{
	new bizid;
	if(sscanf(params, "i", bizid)) return SCM(playerid, LBLUE, "[USE] /gotobiz [bizid]");
	if(!IsValidBiz(bizid)) return ErrorMsg(playerid, INVALID_BIZ_MSG);
	SetPlayerPos(playerid, BizInfo[bizid][bX], BizInfo[bizid][bY], BizInfo[bizid][bZ]);
	#if Streamer_Plugin
		SetPlayerInterior(playerid, BizInfo[bizid][bEInt]);
		SetPlayerVirtualWorld(playerid, BizInfo[bizid][bEVW]);
	#else
		SetPlayerInterior(playerid, 0);
		SetPlayerVirtualWorld(playerid, 0);
	#endif
	AdminMsg(playerid, "You teleported on biz ID %i.", bizid);
	return 1;
}

// ============================================================================================================================================================================================

CMD:createinterior(playerid, params[])
{
	new b_Name[MAX_BIZ_NAME];
	if(sscanf(params, "s[50]", b_Name)) return SCM(playerid, LBLUE, "[Use] /createinterior [Name]");
	new Float:x,Float:y,Float:z,query[300];
	GetPlayerPos(playerid, x, y, z);
	mysql_format(MySQL, query, sizeof(query), "INSERT INTO `Biz_CustomInterior` (`Name`, `X`, `Y`, `Z`, `InteriorID`) VALUES ('%e', '%f', '%f', '%f', '%i')", b_Name, x, y, z, GetPlayerInterior(playerid));
	mysql_tquery(MySQL, query, "OnPlayerCreateCustomInterior", "iifffs", playerid, GetPlayerInterior(playerid), x, y, z, b_Name);
	return 1;
}

PUBLIC:OnPlayerCreateCustomInterior(playerid, interior, Float:x, Float:y, Float:z, name[MAX_BIZ_NAME])
{
	CurrentMaxCustomInterior = cache_insert_id();
	BizInterior[CurrentMaxCustomInterior][i_SQLID] = CurrentMaxCustomInterior;
	BizInterior[CurrentMaxCustomInterior][i_X] = x;
	BizInterior[CurrentMaxCustomInterior][i_Y] = y;
	BizInterior[CurrentMaxCustomInterior][i_Z] = z;
	format(BizInterior[CurrentMaxCustomInterior][i_Name], MAX_BIZ_NAME, "%s", name);
	BizInterior[CurrentMaxCustomInterior][i_Interior] = interior;
	AnnonceMsg(playerid, "You have created a new interior called %s.", name);
	Iter_Add(It_Interior, CurrentMaxCustomInterior);
	NumberOfInterior++;
	return 1;
}

// ============================================================================================================================================================================================

CMD:editinterior(playerid, params[])
{
	if(!CurrentMaxCustomInterior) return ErrorMsg(playerid, "There is no custom interior available. You need to create one at least.");
	new interior;
	if(sscanf(params, "i", interior))
	{
		SCM(playerid, LBLUE, "[Use] /editinterior [interior id]");
		SCM(playerid, LBLUE, "[Use] Type -1 as [interior id] to delete all interiors.");
		cmd_interiorlist(playerid);
		return 1;
	}
	if(!IsValidInterior(interior) && interior != -1) return ErrorMsg(playerid, "This interior id doesn't exist (id: %i).", interior);
	if(interior == -1)
	{
		AdminMsg(playerid, "All interiors will be deleted. It can take a time.");
		for(new i; i <= CurrentMaxCustomInterior; i++)
		{
			if(!IsValidInterior(i)) continue;
			new query[170];
			mysql_format(MySQL, query, sizeof(query), "DELETE FROM `Biz_CustomInterior` WHERE `SQLID` = '%d'", BizInterior[i][i_SQLID]);
			mysql_pquery(MySQL, query);
			KickPlayersFromAnInterior(i);
			ResetInteriorData(i);
		}
		AdminMsg(playerid, "You have deleted all interior.");
		NumberOfInterior = CurrentMaxCustomInterior = 0;
		return 1;
	}
	Dialog_Show(playerid, DIALOG_EDIT_INTERIOR, DIALOG_STYLE_LIST, BizInterior[interior][i_Name], "- Rename the interior\n- Moove the interior's enter at your current position\n- Delete the interior", "Select", "Cancel");
	p_Biz[playerid][InteriorCreating] = interior;
	return 1;
}

DIALOG(DIALOG_EDIT_INTERIOR)
{
	if(!response) return 1;
	new bizid = p_Biz[playerid][InteriorCreating];
	switch(listitem)
	{
		case 0 : Dialog_Show(playerid, DIALOG_INTERIOR_RENAME, DIALOG_STYLE_INPUT, BizInterior[bizid][i_Name], "Rename the interior name.", "Ok", "Cancel", BizInterior[bizid][i_Name]);
		case 1 :
		{
			AdminMsg(playerid, "You moved the interior '%s' at your current positions & interior !", BizInterior[bizid][i_Name]);
			new Float:x,Float:y,Float:z;
			GetPlayerPos(playerid, x, y, z);
			BizInterior[bizid][i_X] = x;
			BizInterior[bizid][i_Y] = y;
			BizInterior[bizid][i_Z] = z;
			BizInterior[bizid][i_Interior] = GetPlayerInterior(playerid);
			foreach(new i : Player)
			{
				if(p_Biz[i][LastBizVisited] == INVALID_BIZ_ID) continue;
				if(BizInfo[p_Biz[i][LastBizVisited]][bInterior] == bizid)
				{
					SetPlayerPos(i, x, y, z);
					SetPlayerInterior(i, BizInterior[bizid][i_Interior]);
					AnnonceMsg(i, "An administrator changes the interior %s, you have been teleported.", BizInterior[bizid][i_Name]);
				}
			}

			new query[200];
			mysql_format(MySQL, query, sizeof(query), "UPDATE `Biz_CustomInterior` SET `X` = '%f', `Y` = '%f', `Z` = '%f', `InteriorID` = '%i' WHERE `SQLID` = '%i'", x, y, z, BizInterior[bizid][i_Interior], BizInterior[bizid][i_SQLID]);
			mysql_pquery(MySQL, query);
			p_Biz[playerid][InteriorCreating] = -1;
		}
		case 2:
		{
			AdminMsg(playerid, "You have deleted the interior '%s' !", BizInterior[bizid][i_Name]);
			Iter_Remove(It_Interior, bizid);
			KickPlayersFromAnInterior(bizid);
			NumberOfInterior--;
			new query[80];
			mysql_format(MySQL, query, sizeof(query), "DELETE FROM `Biz_CustomInterior` WHERE `SQLID` = '%d'", BizInterior[bizid][i_SQLID]);
			mysql_pquery(MySQL, query);
			ResetInteriorData(bizid);
			p_Biz[playerid][InteriorCreating] = -1;
		}
	}
	return 1;
}

DIALOG(DIALOG_INTERIOR_RENAME)
{
	if(!response) return 1;
	if(strlen(inputtext) > MAX_BIZ_NAME) return Dialog_Show(playerid, DIALOG_INTERIOR_RENAME, DIALOG_STYLE_INPUT, BizInterior[p_Biz[playerid][InteriorCreating]][i_Name], "Rename the interior name.\n"RED_U"The name is too long.", "Ok", "Cancel", BizInterior[p_Biz[playerid][InteriorCreating]][i_Name]);
	SCMF(playerid, X11_PEACH_PUFF_2, "You renamed the interior : '%s' -> '%s'", BizInterior[p_Biz[playerid][InteriorCreating]][i_Name], inputtext);
	format(BizInterior[p_Biz[playerid][InteriorCreating]][i_Name], MAX_BIZ_NAME, "%s", inputtext);
	new query[250];
	mysql_format(MySQL, query, sizeof(query), "UPDATE `Biz_CustomInterior` SET `Name` = '%e' WHERE `SQLID` = '%i'", inputtext, BizInterior[p_Biz[playerid][InteriorCreating]][i_SQLID]);
	mysql_pquery(MySQL, query);
	foreach(new i : It_Biz)
	{
		SetBizInfos(i, .lID = true);
    }
	p_Biz[playerid][InteriorCreating] = -1;
	return 1;
}

// ============================================================================================================================================================================================

CMD:interiorlist(playerid)
{
	new str[100], str1[250];

	foreach(new i : It_Interior)
	{
		format(str, sizeof(str), "ID: %i » %s\n", i, BizInterior[i][i_Name]);
		strcat(str1, str);
	}
	Dialog_Show(playerid, NOTHING, DIALOG_STYLE_MSGBOX, "All custom interiors", str1, "Ok", "");
	return 1;
}

// ============================================================================================================================================================================================

CMD:biz_object(playerid, params[])
{
	if(!PlayerHasABiz(playerid)) return ErrorMsg(playerid, "You don't own a biz.");
	new p_biz = GetPlayerBiz(playerid);
	if(p_Biz[playerid][LastBizVisited] != p_biz) return ErrorMsg(playerid, "You must be in your own biz.");
	new s_cmd[7],parameter[10];
	if(sscanf(params, "s[7]S()[10]", s_cmd, parameter)) return SCM(playerid, LBLUE, "[Use] /objects [create/move/delete/list]");
	if(!strcmp(s_cmd, "create"))
	{
		if((BizInfo[p_biz][bObjects] + 1) >= MAX_OBJECTS_PER_BIZ) return ErrorMsg(playerid, "You can't create more object in your biz.");
		new modelid,Float:DrawDistance;
		if(sscanf(parameter, "iF(20.0)", modelid, DrawDistance)) return SCM(playerid, LBLUE, "[Use] /cobject [modelid] [Optional: DrawDistance]");
		if(!IsValidObjectModel(modelid)) return ErrorMsg(playerid, "Invalid object model ID.");
		new Float:x,Float:y,Float:z,vw, int;
		GetPlayerPos(playerid, x, y, z);
		#if Streamer_Plugin
			p_Biz[playerid][ObjectEditing] = CreateDynamicObject(modelid, x, y, z, 0.0, 0.0, 0.0, (vw = GetPlayerVirtualWorld(playerid)), (int = GetPlayerInterior(playerid)), .drawdistance = DrawDistance);
			SCM(playerid, LBLUE, "» You can edit the object. Press Echap to cancel your edition.");
			SelectObject(playerid);
		#else
			p_Biz[playerid][ObjectEditing] = CreateObject(modelid, x, y, z, 0.0, 0.0, 0.0, DrawDistance);
			SCM(playerid, LBLUE, "» You can edit the object. Press Echap to cancel your edition.");
			SelectObject(playerid);
		#endif
		new query[450];
		mysql_format(MySQL, query, sizeof(query), "INSERT INTO `Biz_Object` (`X`, `Y`, `Z`, `rX`, `rY`, `rZ`) VALUES ('%f', '%f', '%f', '%f', '%f', '%f')", x, y, z, 0.0, 0.0, 0.0);
		mysql_tquery(MySQL, query, "OnObjectCreated", "iiiiif", p_Biz[playerid][ObjectEditing], modelid, p_biz, vw, int, DrawDistance);
		BizInfo[p_biz][bObjects]++;
		return 1;
	}
	else if(!strcmp("move", s_cmd))
	{
		if(!BizInfo[p_biz][bObjects]) return ErrorMsg(playerid, "You don't have any objects in your biz.");
		SCM(playerid, LBLUE, "» You can edit the object. Press Echap to cancel your edition.");
		SelectObject(playerid);
		return 1;
	}

	else if(!strcmp("delete", s_cmd))
	{
		if(!BizInfo[p_biz][bObjects]) return ErrorMsg(playerid, "You don't have any objects in your biz.");
		SCM(playerid, LBLUE, "You can delete any objects");
		SelectObject(playerid);
		p_Biz[playerid][ObjectEditing] = 0;
		return 1;
	}

	else if(!strcmp("list", s_cmd))
	{
		if(!BizInfo[p_biz][bObjects]) return ErrorMsg(playerid, "You don't have any objects in your biz.");

		new str[300],s_str[100];
		foreach(new i : It_Objects)
		{
			format(s_str, sizeof(s_str), LGOLD_U"» Object ID "WHITE_U"%i "LGOLD_U"\tModel : "WHITE_U"%i\n", i, BizObjects[i][oID]);
			strcat(str, s_str);
		}
		format(s_str, sizeof(s_str), "Biz's object (total: %i)", BizInfo[p_biz][bObjects]);
		Dialog_Show(playerid, BizInfo[p_biz][bVW], DIALOG_STYLE_MSGBOX, s_str, str, "Ok", "", BizInfo[p_biz][bObjects]);
		return 1;
	}
	else return ErrorMsg(playerid, "Incorrect parameter.");
}

#if !defined Streamer_Plugin
	public OnPlayerSelectObject(playerid, type, objectid, modelid, Float:fX, Float:fY, Float:fZ)
	{
		if(!BizObjects[objectid][oID] && p_Biz[playerid][ObjectEditing] != -1) return ErrorMsg(playerid, "This object cannot be edited by the filterscipt.");
		if(BizObjects[objectid][oBiz] != GetPlayerBiz(playerid) && p_Biz[playerid][ObjectEditing] != -1) return ErrorMsg(playerid, "You can't select an object which is not from your biz.");
		if(!p_Biz[playerid][ObjectEditing])
		{
			new query[60];
			DestroyObject(objectid);
			mysql_format(MySQL, query, sizeof(query), "DELETE FROM `Biz_Object` WHERE `SQLID` = '%d'", BizObjects[objectid][oSQLID]);
			mysql_pquery(MySQL, query);
			ResetObjectData(objectid);
			p_Biz[playerid][ObjectEditing] = -1;
			CancelEdit(playerid);
			BizInfo[GetPlayerBiz(playerid)][bObjects]--;
		}
		else
		{
			p_Biz[playerid][ObjectEditing] = objectid;
			EditObject(playerid, objectid);
		}
		return 1;
	}

	public OnPlayerEditObject(playerid, playerobject, objectid, response, Float:fX, Float:fY, Float:fZ, Float:fRotX, Float:fRotY, Float:fRotZ)
	{
		new Float:oldX, Float:oldY, Float:oldZ, Float:oldRotX, Float:oldRotY, Float:oldRotZ;

		if(!playerobject && p_Biz[playerid][ObjectEditing] > -1)
		{
			if(response == EDIT_RESPONSE_FINAL)
			{
				SetDynamicObjectPos(objectid, x, y, z);
				SetDynamicObjectRot(objectid, rx, ry, rz);
				BizObjects[objectid][oX] = x;
				BizObjects[objectid][oY] = y;
				BizObjects[objectid][oZ] = z;
				BizObjects[objectid][oRX] = rx;
				BizObjects[objectid][oRY] = ry;
				BizObjects[objectid][oRZ] = rz;
				SaveObject(objectid);
				p_Biz[playerid][ObjectEditing] = -1;
			}

			if(response == EDIT_RESPONSE_CANCEL)
			{
				GetDynamicObjectPos(objectid, oldX, oldY, oldZ);
				GetDynamicObjectRot(objectid, oldRotX, oldRotY, oldRotZ);
				BizObjects[objectid][oX] = oldX;
				BizObjects[objectid][oY] = oldY;
				BizObjects[objectid][oZ] = oldZ;
				BizObjects[objectid][oRX] = oldRotX;
				BizObjects[objectid][oRY] = oldRotY;
				BizObjects[objectid][oRZ] = oldRotZ;
				SetDynamicObjectPos(objectid, oldX, oldY, oldZ);
				SetDynamicObjectRot(objectid, oldRotX, oldRotY, oldRotZ);
				SaveObject(objectid);
				p_Biz[playerid][ObjectEditing] = -1;
			}
		}
	}
#else
	public OnPlayerSelectDynamicObject(playerid, objectid, modelid, Float:x, Float:y, Float:z)
	{
		if(!BizObjects[objectid][oID] && p_Biz[playerid][ObjectEditing] != -1) return ErrorMsg(playerid, "This object cannot be edited by the filterscipt.");
		if(BizObjects[objectid][oBiz] != GetPlayerBiz(playerid) && p_Biz[playerid][ObjectEditing] != -1) return ErrorMsg(playerid, "You can't select an object which is not from your biz.");
		if(!p_Biz[playerid][ObjectEditing])
		{
			new query[60];
			DestroyDynamicObject(objectid);
			mysql_format(MySQL, query, sizeof(query), "DELETE FROM `Biz_Object` WHERE `SQLID` = '%d'", BizObjects[objectid][oSQLID]);
			mysql_pquery(MySQL, query);
			ResetObjectData(objectid);
			p_Biz[playerid][ObjectEditing] = -1;
			CancelEdit(playerid);
			BizInfo[GetPlayerBiz(playerid)][bObjects]--;
		}
		else
		{
			p_Biz[playerid][ObjectEditing] = objectid;
			EditDynamicObject(playerid, objectid);
		}
		return 1;
	}
	public OnPlayerEditDynamicObject(playerid, objectid, response, Float:x, Float:y, Float:z, Float:rx, Float:ry, Float:rz)
	{
		new Float:oldX, Float:oldY, Float:oldZ, Float:oldRotX, Float:oldRotY, Float:oldRotZ;
		if(p_Biz[playerid][ObjectEditing] > -1)
		{
			if(response == EDIT_RESPONSE_FINAL && p_Biz[playerid][ObjectEditing] > -1)
			{
				SetDynamicObjectPos(objectid, x, y, z);
				SetDynamicObjectRot(objectid, rx, ry, rz);
				BizObjects[objectid][oX] = x;
				BizObjects[objectid][oY] = y;
				BizObjects[objectid][oZ] = z;
				BizObjects[objectid][oRX] = rx;
				BizObjects[objectid][oRY] = ry;
				BizObjects[objectid][oRZ] = rz;
				SaveObject(objectid);
				p_Biz[playerid][ObjectEditing] = -1;
			}
			if(response == EDIT_RESPONSE_CANCEL && p_Biz[playerid][ObjectEditing] > -1)
			{
				GetDynamicObjectPos(objectid, oldX, oldY, oldZ);
				GetDynamicObjectRot(objectid, oldRotX, oldRotY, oldRotZ);
				BizObjects[objectid][oX] = oldX;
				BizObjects[objectid][oY] = oldY;
				BizObjects[objectid][oZ] = oldZ;
				BizObjects[objectid][oRX] = oldRotX;
				BizObjects[objectid][oRY] = oldRotY;
				BizObjects[objectid][oRZ] = oldRotZ;
				SetDynamicObjectPos(objectid, oldX, oldY, oldZ);
				SetDynamicObjectRot(objectid, oldRotX, oldRotY, oldRotZ);
				SaveObject(objectid);
				p_Biz[playerid][ObjectEditing] = -1;
			}
		}
	}
#endif

PUBLIC:OnObjectCreated(objectid, modelid, bizid, VirtualWorld, interior, Float:Drawdistance)
{
	CurrentMaxObjects = cache_insert_id();
	BizObjects[objectid][oSQLID] = CurrentMaxObjects;
	BizObjects[objectid][oID] = modelid;
	BizObjects[objectid][oBiz] = bizid;
	BizObjects[objectid][oVirtualWorld] = VirtualWorld;
	BizObjects[objectid][oInterior] = interior;
	BizObjects[objectid][oDrawDistance] = Drawdistance;
	Iter_Add(It_Objects, objectid);
}

// ============================================================================================================================================================================================
//	ALIAS:

CMD:b_o(playerid, params[]) return cmd_biz_object(playerid, params);
CMD:biz(playerid) return cmd_managebiz(playerid);
CMD:cinterior(playerid, params[]) return cmd_createinterior(playerid, params);

//--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
// ===========================================================================================================================================================================================
//                          																		Dialogs
// ===========================================================================================================================================================================================
//--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

DIALOG(DIALOG_INVESTOR)
{
	if(!response) return 1;
	new bizid = GetInvestorBizID(playerid);
	if(bizid == INVALID_BIZ_ID) return Dialog_Show(playerid, ERROR, DIALOG_STYLE_MSGBOX, "Unknown", WHITE_U"An error occured. Take a screenshoot [F8] and inform Dayrion.\nError ID: 09", "Ok", "");
	switch(listitem)
	{
		case 0:
		{
			if(!BizInv[bizid][iSafe]) return ShowDialogInvestor(playerid, bizid), ErrorMsg(playerid, "You are not allowed to do that.");
			new str[250];
			format(str, sizeof(str),
			LGOLD_U"- Biz ID: "WHITE_U"%i\n\
			"LGOLD_U"- Owner : "WHITE_U"%s\n\
			"LGOLD_U"- Door : "WHITE_U"%s\n\
			"LGOLD_U"- Resale price : "WHITE_U"%i$\n\
			"LGOLD_U"- Safe : "WHITE_U"%i$\n\
			"LGOLD_U"- Investor : "WHITE_U"%s", BizInfo[bizid][bSQLID], BizInfo[bizid][bOwner], OpenFormatBiz[BizInfo[bizid][bOpen]], floatround(BizInfo[bizid][bPrice]/2, floatround_round), BizInfo[bizid][bSafe], BizInv[bizid][iName]);
			p_Biz[playerid][BizCreating] = bizid;
			Dialog_Show(playerid, DIALOG_INFO, DIALOG_STYLE_MSGBOX, "Info biz", str, "Ok", "Back");
		}

		case 2:
		{
			if(!BizInv[bizid][iEnterPrice]) return ShowDialogInvestor(playerid, bizid), ErrorMsg(playerid, "You are not allowed to do that.");
			p_Biz[playerid][BizCreating] = bizid;
			Dialog_Show(playerid, DIALOG_PRICECHANGER, DIALOG_STYLE_INPUT, "Change the price enter", "Change the enter price", "Confirm", "Cancel");
		}

		case 1:
		{
			if(!BizInv[bizid][iLock]) return ShowDialogInvestor(playerid, bizid), ErrorMsg(playerid, "You are not allowed to do that.");
			if(GetNearestBiz(playerid) != bizid && p_Biz[playerid][LastBizVisited] != bizid) return ErrorMsg(playerid, "You are too far away from the biz.");
			if(BizInfo[bizid][bOpen])
			{
				BizInfo[bizid][bOpen] = false;
				DestroyPickup(BizInfo[bizid][bPickupID]);
				SCM(playerid, RED, "You have locked the biz.");
				SetBizInfos(bizid, .pID = true);
			}
			else
			{
				BizInfo[bizid][bOpen] = true;
				DestroyPickup(BizInfo[bizid][bPickupID]);
				SCM(playerid, GREEN, "You have opened the biz.");
				SetBizInfos(bizid, .pID = true);
			}
		}
		case 4:
		{
			if(!BizInv[bizid][iDeposit]) return ShowDialogInvestor(playerid, bizid), ErrorMsg(playerid, "You are not allowed to do that.");
			if(p_Biz[playerid][LastBizVisited] != bizid) return ErrorMsg(playerid, "You need to be inside in the biz to do that.");
			p_Biz[playerid][BizCreating] = bizid;
			Dialog_Show(playerid, DIALOG_DEPOSIT, DIALOG_STYLE_INPUT, "Deposit money", "Set the amount of money to deposit it.", "Confirm", "Cancel");
		}

		case 5:
		{
			if(!BizInv[bizid][iWithdraw]) return ShowDialogInvestor(playerid, bizid), ErrorMsg(playerid, "You are not allowed to do that.");
			if(p_Biz[playerid][LastBizVisited] != bizid) return ErrorMsg(playerid, "You need to be inside in the biz to do that.");
			p_Biz[playerid][BizCreating] = bizid;
			Dialog_Show(playerid, DIALOG_WITHDRAW, DIALOG_STYLE_INPUT, "Withdraw money", "Set the amount of money to withdraw it.", "Confirm", "Cancel");
		}

		case 3:
		{
			if(!BizInv[bizid][iRename]) return ShowDialogInvestor(playerid, bizid), ErrorMsg(playerid, "You are not allowed to do that.");
			if(p_Biz[playerid][LastBizVisited] != bizid && GetNearestBiz(playerid) != bizid) return ErrorMsg(playerid, "You have to far away from the biz.");
			p_Biz[playerid][BizCreating] = bizid;
			Dialog_Show(playerid, DIALOG_NAME, DIALOG_STYLE_INPUT, "Name your biz", "Enter a name for your biz.", "Confirm", "Cancel");
		}
		default : Dialog_Show(playerid, ERROR, DIALOG_STYLE_MSGBOX, "Unknown", WHITE_U"An error occured. Take a screenshoot [F8] and inform Dayrion.\nError ID: 10", "Ok", "");
	}
	return 1;
}

// ============================================================================================================================================================================================

DIALOG(DIALOG_MODIFY_INVESTOR)
{
	if(!response) return 1;
	new bizid = p_Biz[playerid][BizCreating];
	if(p_Biz[playerid][BizCreating] == -1) return Dialog_Show(playerid, ERROR, DIALOG_STYLE_MSGBOX, "Unknown", WHITE_U"An error occured. Take a screenshoot [F8] and inform Dayrion.\nError ID: 08", "Ok", "");
	switch(listitem)
	{
		case 0:
		{
			if(!BizInv[bizid][iSafe])
			{
				BizInv[bizid][iSafe] = true;
				SCMF(playerid, GREEN, "%s can now access to the biz's informations.", BizInv[bizid][iName]);
				ShowDialogInvPerm(playerid, bizid);
			}
			else
			{
				BizInv[bizid][iSafe] = false;
				SCMF(playerid, RED, "%s can not anymore access to the biz's informations.", BizInv[bizid][iName]);
				ShowDialogInvPerm(playerid, bizid);

			}
		}
		case 1:
		{
			if(!BizInv[bizid][iLock])
			{
				BizInv[bizid][iLock] = true;
				SCMF(playerid, GREEN, "%s can lock your biz.", BizInv[bizid][iName]);
				ShowDialogInvPerm(playerid, bizid);
			}
			else
			{
				BizInv[bizid][iLock] = false;
				SCMF(playerid, RED, "%s can not anymore lock your biz.", BizInv[bizid][iName]);
				ShowDialogInvPerm(playerid, bizid);
			}
		}
		case 2:
		{
			if(!BizInv[bizid][iEnterPrice])
			{
				BizInv[bizid][iEnterPrice] = true;
				SCMF(playerid, GREEN, "%s can modify the enter price of your biz.", BizInv[bizid][iName]);
				ShowDialogInvPerm(playerid, bizid);
			}
			else
			{
				BizInv[bizid][iEnterPrice] = false;
				SCMF(playerid, RED, "%s can not anymore modify the enter price of your biz.", BizInv[bizid][iName]);
				ShowDialogInvPerm(playerid, bizid);
			}
		}
		case 3:
		{
			if(!BizInv[bizid][iRename])
			{
				BizInv[bizid][iRename] = true;
				SCMF(playerid, GREEN, "%s can now rename your biz.", BizInv[bizid][iName]);
				ShowDialogInvPerm(playerid, bizid);
			}
			else
			{
				BizInv[bizid][iRename] = false;
				SCMF(playerid, RED, "%s can not anymore rename your biz.", BizInv[bizid][iName]);
				ShowDialogInvPerm(playerid, bizid);
			}
		}
		case 4:
		{
			if(!BizInv[bizid][iDeposit])
			{
				BizInv[bizid][iDeposit] = true;
				SCMF(playerid, GREEN, "%s can deposit in your biz.", BizInv[bizid][iName]);
				ShowDialogInvPerm(playerid, bizid);
			}
			else
			{
				BizInv[bizid][iDeposit] = false;
				SCMF(playerid, RED, "%s can not anymore deposit in your biz.", BizInv[bizid][iName]);
				ShowDialogInvPerm(playerid, bizid);
			}
		}
		case 5:
		{
			if(!BizInv[bizid][iWithdraw])
			{
				BizInv[bizid][iWithdraw] = true;
				SCMF(playerid, GREEN, "%s can withdraw in your biz.", BizInv[bizid][iName]);
				ShowDialogInvPerm(playerid, bizid);
			}
			else
			{
				BizInv[bizid][iWithdraw] = false;
				SCMF(playerid, RED, "%s can not anymore withdraw in your biz.", BizInv[bizid][iName]);
				ShowDialogInvPerm(playerid, bizid);
			}
		}
		default : return Dialog_Show(playerid, ERROR, DIALOG_STYLE_MSGBOX, "Unknown", WHITE_U"An error occured. Take a screenshoot [F8] and inform Dayrion.\nError ID: 07", "Ok", "");
	}
	return 1;
}

// ============================================================================================================================================================================================

DIALOG(DIALOG_INFO)
{
	if(response)
	{
		p_Biz[playerid][BizCreating] = -1;
	}
	else
	{
		if(!strcmp(BizInv[p_Biz[playerid][BizCreating]][iName], GetName(playerid)) && p_Biz[playerid][BizCreating] != -1) cmd_ibiz(playerid);
		else cmd_managebiz(playerid);
	}
	return 1;
}

// ============================================================================================================================================================================================

DIALOG(DIALOG_PRICECHANGER)
{
	if(response)
	{
		if(!BizInfo[p_Biz[playerid][BizCreating]][bBought]) return ErrorMsg(playerid, "Nobody have buy this biz, you can't change the enter price.");
		if(strval(inputtext) > cellmax || strval(inputtext) < 0) return Dialog_Show(playerid, DIALOG_PRICECHANGER, DIALOG_STYLE_INPUT, "Change the price enter", "Change the enter price\n"RED_U"The value should be between 1$ & %i$", "Confirm", "Cancel", cellmax);
		SCMF(playerid, X11_NAVAJO_WHITE_2, "You have changed the enter price : %i$ -> %i$", BizInfo[p_Biz[playerid][BizCreating]][bEnterPrice], strval(inputtext));
		BizInfo[p_Biz[playerid][BizCreating]][bEnterPrice] = strval(inputtext);
		SetBizInfos(p_Biz[playerid][BizCreating], true, false, false, true);
		p_Biz[playerid][BizCreating] = -1;
	}
	return 1;
}

// ============================================================================================================================================================================================

DIALOG(DIALOG_DEPOSIT)
{
	if(response)
	{
		if(strval(inputtext) == 0) return Dialog_Show(playerid, DIALOG_DEPOSIT, DIALOG_STYLE_INPUT, "Deposit money", "Set the amount of money to deposit it.\n"RED_U"Please use only numeric values or wrong values [Between: 1$-%i$]", "Confirm", "Cancel", cellmax);
		if(strval(inputtext) > GetPlayerMoney(playerid)) return Dialog_Show(playerid, DIALOG_DEPOSIT, DIALOG_STYLE_INPUT, "Deposit money", "Set the amount of money to deposit it.\n"RED_U"You don't have this amount of money.", "Confirm", "Cancel");
		if(strval(inputtext) < 0) return Dialog_Show(playerid, DIALOG_DEPOSIT, DIALOG_STYLE_INPUT, "Deposit money", "Set the amount of money to deposit it.\n"RED_U"Please use only positive values.", "Confirm", "Cancel");
		if(strval(inputtext) + BizInfo[p_Biz[playerid][BizCreating]][bSafe] > MAX_BALANCE) return Dialog_Show(playerid, DIALOG_DEPOSIT, DIALOG_STYLE_INPUT, "Deposit money", "Set the amount of money to deposit it.\n"RED_U"This amount exceed the limit.", "Confirm", "Cancel");
		BizInfo[p_Biz[playerid][BizCreating]][bSafe] += strval(inputtext);
		SCMF(playerid, X11_CORNSILK_2, "You deposit %i$. (Balance : %i$)", strval(inputtext), BizInfo[p_Biz[playerid][BizCreating]][bSafe]);
		GivePlayerMoney(playerid, -strval(inputtext));
		SetMoneyGameText(playerid, -strval(inputtext));
		if(BizInv[p_Biz[playerid][BizCreating]][iInves])
		{
			if(!IsPlayerConnectedByName(BizInv[p_Biz[playerid][BizCreating]][iName]) || !IsPlayerConnectedByName(BizInfo[p_Biz[playerid][BizCreating]][bOwner]))
			{
				p_Biz[playerid][BizCreating] = -1;
				return 1;
			}
			else
			{
				GivePlayerMoney(GetIDByName(BizInv[p_Biz[playerid][BizCreating]][iName]), floatround(strval(inputtext)*0.1));
				if(IsPlayerConnectedByName(BizInfo[p_Biz[playerid][BizCreating]][bOwner]))
				{
					SCMF(GetIDByName(BizInfo[p_Biz[playerid][BizCreating]][bOwner]), RED, "%s won %i$.", BizInv[p_Biz[playerid][BizCreating]][iName], floatround(strval(inputtext)*0.1), strval(inputtext));
                }
				SetMoneyGameText(playerid, strval(inputtext));
				p_Biz[playerid][BizCreating] = -1;
				return 1;
			}
		}
	}
	return 1;
}

// ============================================================================================================================================================================================

DIALOG(DIALOG_WITHDRAW)
{
	if(response)
	{
		if(strval(inputtext) == 0) return Dialog_Show(playerid, DIALOG_WITHDRAW, DIALOG_STYLE_INPUT, "Deposit money", "Set the amount of money to withdraw it.\n"RED_U"Please use only numeric values.", "Confirm", "Cancel");
		if(strval(inputtext) > BizInfo[p_Biz[playerid][BizCreating]][bSafe]) return Dialog_Show(playerid, DIALOG_WITHDRAW, DIALOG_STYLE_INPUT, "Deposit money", "Set the amount of money to withdraw it.\n"RED_U"You don't have this amount of money in your biz.", "Confirm", "Cancel");
		if(strval(inputtext) < 0) return Dialog_Show(playerid, DIALOG_WITHDRAW, DIALOG_STYLE_INPUT, "Deposit money", "Set the amount of money to withdraw it.\n"RED_U"Please use only positive values.", "Confirm", "Cancel");
		if(BizInfo[p_Biz[playerid][BizCreating]][bSafe] - strval(inputtext) < 0) return Dialog_Show(playerid, DIALOG_WITHDRAW, DIALOG_STYLE_INPUT, "Deposit money", "Set the amount of money to withdraw it.\n"RED_U"You don't have this money on your biz.", "Confirm", "Cancel");
		BizInfo[p_Biz[playerid][BizCreating]][bSafe] -= strval(inputtext);
		SetMoneyGameText(playerid, strval(inputtext));
		SCMF(playerid, X11_CORNSILK_2, "You withdraw %i$. (Balance : %i$)", strval(inputtext), BizInfo[p_Biz[playerid][BizCreating]][bSafe]);
		GivePlayerMoney(playerid, strval(inputtext));
		p_Biz[playerid][BizCreating] = -1;
	}
	return 1;
}

// ============================================================================================================================================================================================

DIALOG(DIALOG_NAME)
{
	if(response)
	{
		if(strlen(inputtext) > MAX_BIZ_NAME && IsPlayerAdmin(playerid)) return Dialog_Show(playerid, DIALOG_NAME, DIALOG_STYLE_INPUT, "Name your biz", "Enter a name for the biz ID:%i (Actually: '%s').\n"RED_U"The name is too long.", "Confirm", "Cancel", p_Biz[playerid][BizCreating], BizInfo[p_Biz[playerid][BizCreating]][bName]);
		else if(strlen(inputtext) > MAX_BIZ_NAME && !IsPlayerAdmin(playerid)) return Dialog_Show(playerid, DIALOG_NAME, DIALOG_STYLE_INPUT, "Name your biz", "Enter a name for your biz.\n"RED_U"The name is too long.", "Confirm", "Cancel");
		SCMF(playerid, X11_PEACH_PUFF_2, "You renamed your biz : '%s' -> '%s'", BizInfo[p_Biz[playerid][BizCreating]][bName], inputtext);
		format(BizInfo[p_Biz[playerid][BizCreating]][bName], MAX_BIZ_NAME, inputtext);
		SetBizInfos(p_Biz[playerid][BizCreating], true, false, false, true);
		p_Biz[playerid][BizCreating] = -1;
	}
	return 1;
}

// ============================================================================================================================================================================================

DIALOG(DIALOG_BALANCE)
{
	if(response)
	{
		if(strval(inputtext) == 0) return Dialog_Show(playerid, DIALOG_BALANCE, DIALOG_STYLE_INPUT, "Modify balance", "Modify the current balance.\nActually : %i$\n"RED_U"Please use only numeric values [Between: 1$-%i$].", "Confirm", "Cancel", BizInfo[p_Biz[playerid][BizCreating]][bSafe], cellmax);
		if(strval(inputtext) < 0) return Dialog_Show(playerid, DIALOG_BALANCE, DIALOG_STYLE_INPUT, "Deposit money", "Modify the current balance.\nActually : %i$\n"RED_U"Please use only positive values.", "Confirm", "Cancel", BizInfo[p_Biz[playerid][BizCreating]][bSafe]);
		AdminMsg(playerid, "You have changed the current balance of the biz ID:%i » %i$ -> %i$", p_Biz[playerid][BizCreating], BizInfo[p_Biz[playerid][BizCreating]][bSafe], strval(inputtext));
		BizInfo[p_Biz[playerid][BizCreating]][bSafe] = strval(inputtext);
		p_Biz[playerid][BizCreating] = -1;
		return 1;
	}
	else p_Biz[playerid][BizCreating] = -1;
	return 1;
}

// ============================================================================================================================================================================================
// ===========================================================================================================================================================================================
//                          																		Functions
// ===========================================================================================================================================================================================
// ============================================================================================================================================================================================

SaveBizData(bizid)
{
	if(!IsValidBiz(bizid)) return 1;

	new query[750];
	strcat(query, "UPDATE `Biz_Data` SET  `Type` = '%i', `Interior` = '%i', `Level` = '%i', `Price` = '%i', `Safe` = '%i', `EnterPrice` = '%i', `VW` = '%i', `Bought` = '%i', `Open` = '%i', `Investor` = '%i', `Objects` = '%i',");
	strcat(query, " `X` = '%0.5f',  `Y` = '%0.5f', `Z` = '%0.5f', `eX` = '%0.5f', `eY` = '%0.5f', `eZ` = '%0.5f', `eVW` = '%i', `eInter` = '%i', `Owner` = '%e', `BizName` = '%e' WHERE SQLID = '%i'");
	mysql_format(MySQL, query, sizeof(query), query, BizInfo[bizid][bType], BizInfo[bizid][bInterior], BizInfo[bizid][bLevel], BizInfo[bizid][bPrice], BizInfo[bizid][bSafe], BizInfo[bizid][bEnterPrice], BizInfo[bizid][bVW], BizInfo[bizid][bBought],
	BizInfo[bizid][bOpen], BizInfo[bizid][bInvestor], BizInfo[bizid][bObjects], BizInfo[bizid][bX], BizInfo[bizid][bY], BizInfo[bizid][bZ], BizInfo[bizid][beX], BizInfo[bizid][beY], BizInfo[bizid][beZ], BizInfo[bizid][bEVW], BizInfo[bizid][bEInt], BizInfo[bizid][bOwner], BizInfo[bizid][bName], BizInfo[bizid][bSQLID]);
	mysql_pquery(MySQL, query);
    return 1;
}

// ============================================================================================================================================================================================

SaveObject(objectid)
{
	#if Streamer_Plugin
		if(!IsValidDynamicObject(objectid)) return 1;
	#else
		if(!IsValidObject(objectid)) return 1;
	#endif
	new query[300];
	mysql_format(MySQL, query, sizeof(query), "UPDATE `Biz_Object` SET  `Biz` = '%i', `ID` = '%i', `Interior` = '%i', `VirtualWorld` = '%i', `X` = '%0.5f', `Y` = '%0.5f', `Z` = '%0.5f', `rX` = '%0.5f', `rY` = '%0.5f', `rZ` = '%0.5f', `DrawDistance` = '%0.5f' WHERE SQLID = '%i'",
	BizObjects[objectid][oBiz], BizObjects[objectid][oID], BizObjects[objectid][oInterior], BizObjects[objectid][oVirtualWorld], BizObjects[objectid][oX], BizObjects[objectid][oY], BizObjects[objectid][oZ], BizObjects[objectid][oRX], BizObjects[objectid][oRY], BizObjects[objectid][oRZ],
	BizObjects[objectid][oDrawDistance], BizObjects[objectid][oSQLID]);
	mysql_tquery(MySQL, query);
	return 1;
}

// ============================================================================================================================================================================================

ResetObjectData(objectid)
{
	new reset_obj[E_OBJECTS];
	BizObjects[objectid] = reset_obj;
	// BizObjects[objectid][oSID] =
	// BizObjects[objectid][oSQLID] =
	// BizObjects[objectid][oBiz] =
	// BizObjects[objectid][oVirtualWorld] =
	// BizObjects[objectid][oInterior] =
	// BizObjects[objectid][oID] = 0;
	// BizObjects[objectid][oX] =
	// BizObjects[objectid][oY] =
	// BizObjects[objectid][oZ] =
	// BizObjects[objectid][oRX] =
	// BizObjects[objectid][oRY] =
	// BizObjects[objectid][oRZ] =
	// BizObjects[objectid][oDrawDistance] = 0.0;
}

// ============================================================================================================================================================================================

FirstIntID(typeid)
{
	for(new i, j = sizeof(BizData); i < j; i++)
	{
		if(BizData[i][Type] != typeid) continue;
		return i;
	}
	return INVALID_BIZ_ID;
}

// ============================================================================================================================================================================================

ResetBizData(bizid, label = true)
{
	new query[60];
	mysql_format(MySQL, query, sizeof(query), "DELETE FROM `Biz_Investor` WHERE `SQLID` = '%d'", BizInv[bizid][iSQLID]);
	mysql_pquery(MySQL, query);
	if(label)
	{
		#if !Streamer_Plugin
			Delete3DTextLabel(BizInfo[bizid][bLabelID]);
			Delete3DTextLabel(BizInfo[bizid][bLabelEnterID]);
			DestroyPickup(BizInfo[bizid][bPickupID]);
			DestroyPickup(BizInfo[bizid][bPickupEnter]);
		#else
			DestroyDynamic3DTextLabel(BizInfo[bizid][bLabelID]);
			DestroyDynamic3DTextLabel(BizInfo[bizid][bLabelEnterID]);
			DestroyDynamicPickup(BizInfo[bizid][bPickupID]);
			DestroyDynamicPickup(BizInfo[bizid][bPickupEnter]);
		#endif
	}
	new reset_bizData[E_BIZ_VALUES];
	reset_bizData[bSQLID] 		= bizid;
	BizInfo[bizid] 		= reset_bizData;
	BizInfo[bizid][bInterior]	=
	BizInfo[bizid][bPickupID] =
	BizInfo[bizid][bPickupEnter] =
	_:BizInfo[bizid][bLabelID] =
	_:BizInfo[bizid][bLabelEnterID] = -1;
	BizInfo[bizid][bOpen]		= true;
	format(BizInfo[bizid][bOwner], MAX_PLAYER_NAME, "None");
	format(BizInfo[bizid][bName], MAX_BIZ_NAME, "None");
	mysql_format(MySQL, query, sizeof(query), "DELETE FROM `Biz_Data` WHERE `SQLID` = '%d'", BizInfo[bizid][bSQLID]);
	mysql_pquery(MySQL, query);
}

// ============================================================================================================================================================================================

SaveInvestorData(bizid)
{
	if(!(IsValidInvestor(bizid) && IsValidBiz(bizid))) return 1;

	new query[350];
	mysql_format(MySQL, query, sizeof(query), "UPDATE `Biz_Investor` SET `Safe` = '%i', `Lock` = '%i', `EnterPrice` = '%i', `Rename` = '%i', `Deposit` = '%i', `Withdraw` = '%i', `Name` = '%e' WHERE SQLID = '%i'",
	BizInv[bizid][iSafe], BizInv[bizid][iLock], BizInv[bizid][iEnterPrice], BizInv[bizid][iRename], BizInv[bizid][iDeposit], BizInv[bizid][iWithdraw], BizInv[bizid][iName], BizInv[bizid][iSQLID]);
	mysql_pquery(MySQL, query);
	return 1;
}

ResetInteriorData(interiorid)
{
	if(!IsValidInterior(interiorid)) return 1;
	BizInterior[interiorid][i_X] =
	BizInterior[interiorid][i_Y] =
	BizInterior[interiorid][i_Z] = 0.0;
	BizInterior[interiorid][i_SQLID] =
	BizInterior[interiorid][i_Interior] = 0;
	format(BizInterior[interiorid][i_Name], MAX_BIZ_NAME, "NoName");
	return 1;
}


// ============================================================================================================================================================================================

bool:PlayerHasABiz(playerid)
{
	static name[MAX_PLAYER_NAME];
	GetPlayerName(playerid, name, sizeof(name));
	foreach(new i : It_Biz)
	{
		if(!strcmp(name, BizInfo[i][bOwner])) return true;
	}
	return false;
}

// ============================================================================================================================================================================================

GetName(const playerid, id = false)
{
	static str[MAX_PLAYER_NAME+9];
	GetPlayerName(playerid, str, sizeof(str));
	if(id)
	{
		format(str, sizeof(str), "%s (ID: %i)", str, playerid);
    }
	return str;
}

// ============================================================================================================================================================================================

SCMF(playerid, couleur, const msg[], va_args<>)
{
	static string[145];
	va_format(string, sizeof(string), msg, va_start<3>);
	return SendClientMessage(playerid, couleur, string);
}

SCM(playerid, color, const msg[]) return SendClientMessage(playerid, color, msg);

// ============================================================================================================================================================================================

ErrorMsg(playerid, const msg[], va_args<>)
{
	new message[190];
    static const premsg[] = "[Error] %s";
	if(numargs() == 2) return SCMF(playerid, 0xCC0000FF, premsg, msg);
	va_format(message, sizeof(message), msg, va_start<2>);
	return SCMF(playerid, 0xCC0000FF, "[Error] %s", message);
}

AdminMsg(playerid, const msg[], va_args<>)
{
	new message[190];
    static const premsg[] = "» [Admin]{ffb31a} %s";
	if(numargs() == 2) return SCMF(playerid, 0xFF0000FF, premsg, msg);
	va_format(message, sizeof(message), msg, va_start<2>);
	return SCMF(playerid, 0xFF0000FF, "» [Admin]{ffb31a} %s", message);
}

AnnonceMsg(playerid, const message[], va_args<>)
{
    static msg[190];
    static const premsg[] = "[Biz info] {b3e0ff}%s";
    if(numargs() == 2) return SCMF(playerid, 0x66a3ffff, premsg, message);
    va_format(msg, sizeof(msg), message, va_start<2>);
    return SCMF(playerid, 0x66a3ffff, premsg, msg);
}

// ============================================================================================================================================================================================

SetBizInfos(bizid, bool:save = false, bool:pID = false, bool:pEnter = false, bool:lID = false, bool:lEnter = false)
{
	if(!BizInfo[bizid][bCreated]) return printf(FPRINT"An error occured during setting infos of the biz ID: %i | Error ID: 07", bizid);
	static str[120];
	#if !Streamer_Plugin
		if(pID)
		{
			if(BizInfo[bizid][bPickupID] != -1)
			{
				DestroyPickup(BizInfo[bizid][bPickupID]);
            }
			if(!BizInfo[bizid][bBought])
			{
				if(BizInfo[bizid][bOpen])
				{
					BizInfo[bizid][bPickupID] = CreatePickup(ICON_BIZ_PENDING_OPEN, 1, BizInfo[bizid][bX], BizInfo[bizid][bY], BizInfo[bizid][bZ], -1);
                }
				else
				{
					BizInfo[bizid][bPickupID] = CreatePickup(ICON_BIZ_PENDING_CLOSED, 1, BizInfo[bizid][bX], BizInfo[bizid][bY], BizInfo[bizid][bZ], -1);
                }
			}
			else
			{
				if(BizInfo[bizid][bOpen])
				{
					BizInfo[bizid][bPickupID] = CreatePickup(ICON_BIZ_OPEN, 1, BizInfo[bizid][bX], BizInfo[bizid][bY], BizInfo[bizid][bZ], -1);
                }
				else
				{
					BizInfo[bizid][bPickupID] = CreatePickup(ICON_BIZ_LOCKED, 1, BizInfo[bizid][bX], BizInfo[bizid][bY], BizInfo[bizid][bZ], -1);
                }
			}
		}
		if(pEnter)
		{
			if(BizInfo[bizid][bPickupEnter] != -1)
			{
				DestroyPickup(BizInfo[bizid][bPickupEnter]);
            }
			BizInfo[bizid][bPickupEnter] = CreatePickup(ICON_BIZ_INTERIOR, 1, BizInfo[bizid][beX], BizInfo[bizid][beY], BizInfo[bizid][beZ], BizInfo[bizid][bVW]);
		}
		if(lID)
		{
			if(!BizInfo[bizid][bBought])
			{
				format(str, sizeof(str), "~ FOR SALE ~\n"LBLUE_U"%s\nLevel : "WHITE_U"%i\n"LBLUE_U"Price : "WHITE_U"%i$", BizInfo[bizid][bName], BizInfo[bizid][bLevel], BizInfo[bizid][bPrice]);
			}
			else
			{
				format(str, sizeof(str), "%s\nOwner : "WHITE_U"%s\n"LBLUE_U"Enter price : "WHITE_U"%i$\n"LBLUE_U"Investor : "WHITE_U"%s", BizInfo[bizid][bName], BizInfo[bizid][bOwner], BizInfo[bizid][bEnterPrice], BizInv[bizid][iName]);
            }
			if(_:BizInfo[bizid][bLabelID] != -1)
			{
				Delete3DTextLabel(BizInfo[bizid][bLabelID]);
            }
			BizInfo[bizid][bLabelID] = Create3DTextLabel(str, LBLUE, BizInfo[bizid][bX], BizInfo[bizid][bY], BizInfo[bizid][bZ], 20.0, 0, 0);
		}

		if(lEnter)
		{
			if(_:BizInfo[bizid][bLabelEnterID] != -1)
			{
				Delete3DTextLabel(BizInfo[bizid][bLabelEnterID]);
            }
			BizInfo[bizid][bLabelEnterID] = Create3DTextLabel("~ Press F to exit ~", WHITE, BizInfo[bizid][beX], BizInfo[bizid][beY], BizInfo[bizid][beZ], 20.0, BizInfo[bizid][bVW], 0);
		}

	#else
		if(pID)
		{
			if(BizInfo[bizid][bPickupID] != -1)
			{
				DestroyDynamicPickup(BizInfo[bizid][bPickupID]);
            }
			if(!BizInfo[bizid][bBought])
			{
				if(BizInfo[bizid][bOpen])
				{
					BizInfo[bizid][bPickupID] = CreateDynamicPickup(ICON_BIZ_PENDING_OPEN, 1, BizInfo[bizid][bX], BizInfo[bizid][bY], BizInfo[bizid][bZ], .worldid = BizInfo[bizid][bEVW], .interiorid = BizInfo[bizid][bEInt]);
                }
				else
                {
					BizInfo[bizid][bPickupID] = CreateDynamicPickup(ICON_BIZ_PENDING_CLOSED, 1, BizInfo[bizid][bX], BizInfo[bizid][bY], BizInfo[bizid][bZ], .worldid = BizInfo[bizid][bEVW], .interiorid = BizInfo[bizid][bEInt]);
                }
			}
			else
			{
				if(BizInfo[bizid][bOpen])
				{
					BizInfo[bizid][bPickupID] = CreateDynamicPickup(ICON_BIZ_OPEN, 1, BizInfo[bizid][bX], BizInfo[bizid][bY], BizInfo[bizid][bZ], .worldid = BizInfo[bizid][bEVW], .interiorid = BizInfo[bizid][bEInt]);
                }
				else
				{
					BizInfo[bizid][bPickupID] = CreateDynamicPickup(ICON_BIZ_LOCKED, 1, BizInfo[bizid][bX], BizInfo[bizid][bY], BizInfo[bizid][bZ], .worldid = BizInfo[bizid][bEVW], .interiorid = BizInfo[bizid][bEInt]);
                }
			}
		}
		if(pEnter)
		{
			if(BizInfo[bizid][bPickupEnter] != -1)
			{
				DestroyDynamicPickup(BizInfo[bizid][bPickupEnter]);
            }
			BizInfo[bizid][bPickupEnter] = CreateDynamicPickup(ICON_BIZ_INTERIOR, 1, BizInfo[bizid][beX], BizInfo[bizid][beY], BizInfo[bizid][beZ], .worldid = BizInfo[bizid][bVW]);
		}
		if(lID)
		{
			if(!BizInfo[bizid][bBought])
			{
				format(str, sizeof(str), "~ FOR SALE ~\n"LBLUE_U"%s\nLevel : "WHITE_U"%i\n"LBLUE_U"Price : "WHITE_U"%i$", BizInfo[bizid][bName], BizInfo[bizid][bLevel], BizInfo[bizid][bPrice]);
            }
			else
			{
				format(str, sizeof(str), "%s\nOwner : "WHITE_U"%s\n"LBLUE_U"Enter price : "WHITE_U"%i$\n"LBLUE_U"Investor : "WHITE_U"%s", BizInfo[bizid][bName], BizInfo[bizid][bOwner], BizInfo[bizid][bEnterPrice], BizInv[bizid][iName]);
            }
			if(_:BizInfo[bizid][bLabelID] != -1)
			{
				DestroyDynamic3DTextLabel(BizInfo[bizid][bLabelID]);
            }
			BizInfo[bizid][bLabelID] = CreateDynamic3DTextLabel(str, LBLUE, BizInfo[bizid][bX], BizInfo[bizid][bY], BizInfo[bizid][bZ], 20.0, .worldid = BizInfo[bizid][bEVW], .interiorid = BizInfo[bizid][bEInt]);
		}
		if(lEnter)
		{
			if(_:BizInfo[bizid][bLabelEnterID] != -1)
			{
				DestroyDynamic3DTextLabel(BizInfo[bizid][bLabelEnterID]);
            }
			BizInfo[bizid][bLabelEnterID] = CreateDynamic3DTextLabel("~ Press F to exit ~", WHITE, BizInfo[bizid][beX], BizInfo[bizid][beY], BizInfo[bizid][beZ], 20.0, .worldid = BizInfo[bizid][bVW]);
		}
	#endif
	if(save) return SaveBizData(bizid);
	return 1;
}

// ============================================================================================================================================================================================

GetNearestBiz(playerid)
{
	new	near = INVALID_BIZ_ID, p_int = GetPlayerInterior(playerid), p_vw = GetPlayerVirtualWorld(playerid);
	foreach(new i : It_Biz)
	{
		#if Streamer_Plugin
			if(BizInfo[i][bEInt] != p_int || BizInfo[i][bEVW] != p_vw) continue;
		#endif
		if(!IsPlayerInRangeOfPoint(playerid, 3.0, BizInfo[i][bX], BizInfo[i][bY], BizInfo[i][bZ])) continue;
		near = i;
	}
	return near;
}

// ============================================================================================================================================================================================

IsNearABiz(playerid) return GetNearestBiz(playerid) == INVALID_BIZ_ID ? false : true;

// ============================================================================================================================================================================================

EnterInABiz(playerid, bizid)
{
	new IntA = BizInfo[bizid][bInterior];
	if(BizInfo[bizid][bType])
	{
		SetPlayerPos(playerid, BizData[IntA][X], BizData[IntA][Y], BizData[IntA][Z]);
		SetPlayerInterior(playerid, BizData[IntA][Interior]);
	}
	else
	{
		SetPlayerPos(playerid, BizInterior[IntA][i_X], BizInterior[IntA][i_Y], BizInterior[IntA][i_Z]);
		SetPlayerInterior(playerid, BizInterior[IntA][i_Interior]);
	}
	SetPlayerVirtualWorld(playerid, BizInfo[bizid][bVW]);
	p_Biz[playerid][LastBizVisited] = bizid;
	return 1;
}

// ============================================================================================================================================================================================

ExitABiz(playerid, bizid)
{
	#if Streamer_Plugin
		SetPlayerInterior(playerid, BizInfo[bizid][bEInt]);
		SetPlayerVirtualWorld(playerid, BizInfo[bizid][bEVW]);
	#else
		SetPlayerInterior(playerid, 0);
		SetPlayerVirtualWorld(playerid, 0);
	#endif
	SetPlayerPos(playerid, BizInfo[bizid][bX], BizInfo[bizid][bY], BizInfo[bizid][bZ]);
	p_Biz[playerid][LastBizVisited] = INVALID_BIZ_ID;
	return 1;
}

// ============================================================================================================================================================================================

GetPlayerBiz(playerid)
{
	new biz = INVALID_BIZ_ID;
	foreach(new i : It_Biz)
	{
		if(!strcmp(BizInfo[i][bOwner], GetName(playerid)))
		{
			biz = i;
        }
		else
		{
			continue;
        }
	}
	return biz;
}

// ============================================================================================================================================================================================

forward TeleChecking(playerid);
public TeleChecking(playerid)
{
	if(GetPlayerInterior(playerid) > 0 && GetPlayerVirtualWorld(playerid) > 214799999) return 1;

	SCMF(playerid, RED, "An error occured. You left a biz by teleportation.");
	printf(FPRINT"Admin | %s left a biz by teleportation | p_Biz ID:[LastBizVisited]%i", GetName(playerid, true), p_Biz[playerid][LastBizVisited]);
	p_Biz[playerid][LastBizVisited] = INVALID_BIZ_ID;
	return 1;
}
// ============================================================================================================================================================================================

IsPlayerConnectedByName(const name[])
{
	foreach(new i : Player)
	{
		if(strcmp(name, GetName(i))) continue;
		return true;
	}
	return false;
}

// ============================================================================================================================================================================================

GetIDByName(const name[])
{
	foreach(new i : Player)
	{
		if(!strcmp(GetName(i), name)) return i;
	}
	printf("[FS] Error : No player found for the name '%s'.", name);
	return INVALID_PLAYER_ID;
}

// ============================================================================================================================================================================================

ShowDialogInvPerm(playerid, bizid)
{
	new final[1000], str[150];
	if(BizInv[bizid][iSafe]) format(str, sizeof(str), "Access to biz's informations : "GREEN_U"Authorized"), strcat(final, str);
	else format(str, sizeof(str), WHITE_U "Access to biz's informations : "RED_U"Unauthorized"), strcat(final, str);
	if(BizInv[bizid][iLock]) format(str, sizeof(str), "\nCan lock the biz : "GREEN_U"Authorized"), strcat(final, str);
	else format(str, sizeof(str), "\nCan lock the biz : "RED_U"Unauthorized"), strcat(final, str);
	if(BizInv[bizid][iEnterPrice]) format(str, sizeof(str), "\nModfiy the enter price : "GREEN_U"Authorized"), strcat(final, str);
	else format(str, sizeof(str), "\nModfiy the enter price : "RED_U"Unauthorized"), strcat(final, str);
	if(BizInv[bizid][iRename]) format(str, sizeof(str), "\nRename the biz : "GREEN_U"Authorized"), strcat(final, str);
	else format(str, sizeof(str), "\nRename the biz : "RED_U"Unauthorized"), strcat(final, str);
	if(BizInv[bizid][iDeposit]) format(str, sizeof(str), "\nCan deposit : "GREEN_U"Authorized"), strcat(final, str);
	else format(str, sizeof(str), "\nCan deposit : "RED_U"Unauthorized"), strcat(final, str);
	if(BizInv[bizid][iWithdraw]) format(str, sizeof(str), "\nCan withdraw : "GREEN_U"Authorized"), strcat(final, str);
	else format(str, sizeof(str),  "\nCan withdraw : "RED_U"Unauthorized"), strcat(final, str);
	format(str, sizeof(str), WHITE_U "Modify investor's rights of %s", BizInv[bizid][iName]);
	Dialog_Show(playerid, DIALOG_MODIFY_INVESTOR, DIALOG_STYLE_LIST, str, final, "Choose", "Cancel");
	p_Biz[playerid][BizCreating] = bizid;
	return 1;
}

// ============================================================================================================================================================================================

ShowDialogInvestor(playerid, bizid)
{
	new final[1000], str[150];
	if(BizInv[bizid][iSafe]) format(str, sizeof(str), "Access to biz's informations : "GREEN_U"Authorized"), strcat(final, str);
	else format(str, sizeof(str), WHITE_U "Access to biz's informations : "RED_U"Unauthorized"), strcat(final, str);
	if(BizInv[bizid][iLock]) format(str, sizeof(str), "\nCan lock the biz : "GREEN_U"Authorized"), strcat(final, str);
	else format(str, sizeof(str), "\nCan lock the biz : "RED_U"Unauthorized"), strcat(final, str);
	if(BizInv[bizid][iEnterPrice]) format(str, sizeof(str), "\nModfiy the enter price : "GREEN_U"Authorized"), strcat(final, str);
	else format(str, sizeof(str), "\nModfiy the enter price : "RED_U"Unauthorized"), strcat(final, str);
	if(BizInv[bizid][iRename]) format(str, sizeof(str), "\nRename the biz : "GREEN_U"Authorized"), strcat(final, str);
	else format(str, sizeof(str), "\nRename the biz : "RED_U"Unauthorized"), strcat(final, str);
	if(BizInv[bizid][iDeposit]) format(str, sizeof(str), "\nCan deposit : "GREEN_U"Authorized"), strcat(final, str);
	else format(str, sizeof(str), "\nCan deposit : "RED_U"Unauthorized"), strcat(final, str);
	if(BizInv[bizid][iWithdraw]) format(str, sizeof(str), "\nCan withdraw : "GREEN_U"Authorized"), strcat(final, str);
	else format(str, sizeof(str),  "\nCan withdraw : "RED_U"Unauthorized"), strcat(final, str);
	format(str, sizeof(str), WHITE_U "Info the %s's biz.", BizInfo[bizid][bOwner]);
	Dialog_Show(playerid, DIALOG_INVESTOR, DIALOG_STYLE_LIST, str, final, "Choose", "Cancel");
	return 1;
}

// ============================================================================================================================================================================================

ResetInvestorData(bizid)
{
	format(BizInv[bizid][iName], MAX_PLAYER_NAME, "Nobody");
	new reset_investor[E_INVESTOR_VALUES];
	BizInv[bizid] = reset_investor;
	SaveInvestorData(bizid);
	return 1;
}

// ============================================================================================================================================================================================

GetInvestorBizID(playerid)
{
	foreach(new i : It_Investor)
	{
		if(strcmp(GetName(playerid), BizInv[i][iName])) continue;
		return i;
	}
	return INVALID_BIZ_ID;
}

// ============================================================================================================================================================================================

SetMoneyGameText(playerid, amount)
{
	new str[10];
	if(amount < 0)
	{
		format(str, sizeof(str), "~r~%-i$", amount);
    }
	else
	{
		format(str, sizeof(str), "~g~+%i$", amount);
    }
	GameTextForPlayer(playerid, str, 1, 1);
	return 1;
}

// ============================================================================================================================================================================================

KickPlayersFromAnInterior(interiorid)
{
	new id;
	foreach(new i : It_Biz)
	{
		if(BizInfo[i][bInterior] != interiorid) continue;

		foreach(new p : Player)
		{
			if(p_Biz[p][LastBizVisited] == i)
			{
				SetPlayerPos(p, BizInfo[p_Biz[p][LastBizVisited]][bX], BizInfo[p_Biz[p][LastBizVisited]][bY], BizInfo[p_Biz[p][LastBizVisited]][bZ]);
				#if Streamer_Plugin
					SetPlayerInterior(p, BizInfo[p_Biz[p][LastBizVisited]][bEInt]);
					SetPlayerVirtualWorld(p, BizInfo[p_Biz[p][LastBizVisited]][bEVW]);
				#else
					SetPlayerInterior(p, 0);
					SetPlayerVirtualWorld(p, 0);
				#endif
				ErrorMsg(p, "An administrator has deleted this interior, you have been teleported out of the biz.");
				printf(FPRINT"%s has been teleported out of the biz : %i - An admin deleted an interior", GetName(p, true), p_Biz[i][LastBizVisited]);
				p_Biz[p][LastBizVisited] = -1;
			}
		}
		BizInfo[i][bInterior] = BizInfo[i][bType] = 1;
		BizInfo[i][beX]	= BizData[1][X];
		BizInfo[i][beY]	= BizData[1][Y];
		BizInfo[i][beZ]	= BizData[1][Z];
		format(BizInfo[i][bName], MAX_BIZ_NAME, "Deleted_Interior");
		SetBizInfos(i, true, _, true, true, true);
		if(BizInfo[i][bBought])
		{
			if(IsPlayerConnected((id = GetIDByName(BizInfo[i][bOwner]))))
			{
				AnnonceMsg(id, "The interior of your biz has been deleted. Contact an administrator to change it. The new interior is %s.", BizData[1][Name]);
            }
        }
	}
}

// ============================================================================================================================================================================================

bool:IsValidObjectModel(modelid)
{
	switch(modelid)
	{
		case 615 .. 661 : return true;
		case 664 : return true;
		case 669 .. 698 : return true;
		case 700 .. 792 : return true;
		case 800 .. 906 : return true;
		case 910 .. 964 : return true;
		case 966 .. 998 : return true;
		case 1000 .. 1193 : return true;
		case 1207 .. 1325 : return true;
		case 1327 .. 1572 : return true;
		case 1574 .. 1698 : return true;
		case 1700 .. 2882 : return true;
		case 2885 .. 3135 : return true;
		case 3167 .. 3175 : return true;
		case 3178 : return true;
		case 3187 : return true;
		case 3193 : return true;
		case 3214 : return true;
		case 3221 : return true;
		case 3241 .. 3244 : return true;
		case 3246 : return true;
		case 3249 .. 3250 : return true;
		case 3252 .. 3253 : return true;
		case 3255 .. 3265 : return true;
		case 3267 .. 3347 : return true;
		case 3350 .. 3415 : return true;
		case 3417 .. 3428 : return true;
		case 3430 .. 3609 : return true;
		case 3612 .. 3783 : return true;
		case 3785 .. 3869 : return true;
		case 3872 .. 3882 : return true;
		case 3884 .. 3888 : return true;
		case 3890 .. 3973 : return true;
		case 3975 .. 4541 : return true;
		case 4550 .. 4762 : return true;
		case 4806 .. 5084 : return true;
		case 5086 .. 5089 : return true;
		case 5105 .. 5375 : return true;
		case 5390 .. 5682 : return true;
		case 5703 .. 6010 : return true;
		case 6035 .. 6253 : return true;
		case 6255 .. 6257 : return true;
		case 6280 .. 6347 : return true;
		case 6349 .. 6525 : return true;
		case 6863 .. 7392 : return true;
		case 7415 .. 7973 : return true;
		case 7978 .. 9193 : return true;
		case 9205 .. 9267 : return true;
		case 9269 .. 9478 : return true;
		case 9482 .. 10310 : return true;
		case 10315 .. 10744 : return true;
		case 10750 .. 11417 : return true;
		case 11420 .. 11753 : return true;
		case 12800 .. 13563 : return true;
		case 13590 .. 13667 : return true;
		case 13672 .. 13890 : return true;
		case 14383 .. 14528 : return true;
		case 14530 .. 14554 : return true;
		case 14556 : return true;
		case 14558 .. 14643 : return true;
		case 14650 .. 14657 : return true;
		case 14660 .. 14695 : return true;
		case 14699 .. 14728 : return true;
		case 14735 .. 14765 : return true;
		case 14770 .. 14856 : return true;
		case 14858 .. 14883 : return true;
		case 14885 .. 14898 : return true;
		case 14900 .. 14903 : return true;
		case 15025 .. 15064 : return true;
		case 16000 .. 16790 : return true;
		case 17000 .. 17474 : return true;
		case 17500 .. 17974 : return true;
		case 17976 : return true;
		case 17978 : return true;
		case 18000 .. 18036 : return true;
		case 18038 .. 18102 : return true;
		case 18104 .. 18105 : return true;
		case 18109 : return true;
		case 18112 : return true;
		case 18200 .. 18859 : return true;
		case 18862 .. 19198 : return true;
		case 19200 .. 19274 : return true;
		case 19277 .. 19595 : return true;
		case 19597 .. 19999 : return true;
	}
	return false;
}
DominikMarvLisy is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[FilterScript] Dynamic House System v0.5 (w/Dialog Builder System+Customizable) ABKPot Filterscripts 19 27/01/2015 06:56 PM
[FilterScript] Dynamic Box [Vip System/Help System/2 previous script all in dBox!] JaKe Elite Filterscripts 6 28/11/2014 05:48 AM
[FilterScript] Jueix's bank system and Dynamic ATM system. jueix Filterscripts 23 31/03/2014 12:44 AM
[FilterScript] DWS - Dynamic Weapon System (Gun object, Saving system,...More) JusstinRoller Filterscripts 15 31/07/2013 11:02 AM


All times are GMT. The time now is 11:04 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.