Please Help Me
#1

I Want To make that a person will only be able to buy house if he had more then 5000 Scores Please Help Me Here is My BuyHouse command
Код:
YCMD:buyhouse(playerid, params[], help)
{
        #pragma unused help
        #pragma unused params
        new string[210];
        new i = GetClosetHouseID(playerid);
 		if(Player[playerid][Houseid] != 999) return SCM(playerid,COLOR_RED,"EROR: "COL_WHITE"You already have house");
		if(!IsPlayerInRangeOfPoint(playerid,5.0,House[i][EnterX],House[i][EnterY],House[i][EnterZ])) return SCM(playerid,COLOR_RED,"You are not close to your house.");
		if(GetPlayerMoney(playerid) < House[i][Price]) return SCM(playerid, COLOR_RED, "You don't have that kind of money.");
		format(House[i][Owner], 32, "%s", GetName(playerid));
		if(House[i][hCar] > 0) format(HouseOwner[House[i][hCar]],64,"%s",GetName(playerid));
		House[i][On_Sell] = 0;
		Player[playerid][Houseid] = i;
		DestroyDynamicPickup(House[i][PickupU]);
		House[i][PickupU] = CreateDynamicPickup(1272, 23,  House[i][EnterX],House[i][EnterY],House[i][EnterZ],-1,-1,-1,100.0);
		GivePlayerMoney(playerid, -House[i][Price]);
		DestroyDynamicMapIcon(House[i][Icon]);
		House[i][Icon] = CreateDynamicMapIcon(House[i][EnterX],House[i][EnterY],House[i][EnterZ], 32, 0, -1, -1, -1, 100.0);
		CheckHouse(i);
		format(string,sizeof(string),"{E0BC1B}Owner: "COL_WHITE"%s\n{E0BC1B}House name: "COL_WHITE"%s\n{E0BC1B}Price: "COL_WHITE"%d\n{E0BC1B}Level: "COL_WHITE"%d\n{E0BC1B}Rent price: "COL_WHITE"%d\n{E0BC1B}Address: "COL_WHITE"%s\n (/renthouse)",House[i][Owner],House[i][HouseName],House[i][Price],House[i][Level],House[i][RentPrice],House[i][Address]);
        UpdateDynamic3DTextLabelText(House[i][DLabel],-1,string);
        UpdatePlayerInformation(playerid);
		return 1;
}
Reply
#2

PHP код:
YCMD:buyhouse(playeridparams[], help)
{
        
#pragma unused help
        #pragma unused params
        
new string[210];
        new 
GetClosetHouseID(playerid);
         if(
Player[playerid][Houseid] != 999) return SCM(playerid,COLOR_RED,"EROR: "COL_WHITE"You already have house");
        if(!
IsPlayerInRangeOfPoint(playerid,5.0,House[i][EnterX],House[i][EnterY],House[i][EnterZ])) return SCM(playerid,COLOR_RED,"You are not close to your house.");
if(
GetPlayerScore(playerid)<=5000)return SCM(playerid,COLOR_RED,"You need more than 5000 score to use this cmd !");        
if(
GetPlayerMoney(playerid) < House[i][Price]) return SCM(playeridCOLOR_RED"You don't have that kind of money.");
        
format(House[i][Owner], 32"%s"GetName(playerid));
        if(
House[i][hCar] > 0format(HouseOwner[House[i][hCar]],64,"%s",GetName(playerid));
        
House[i][On_Sell] = 0;
        
Player[playerid][Houseid] = i;
        
DestroyDynamicPickup(House[i][PickupU]);
        
House[i][PickupU] = CreateDynamicPickup(127223,  House[i][EnterX],House[i][EnterY],House[i][EnterZ],-1,-1,-1,100.0);
        
GivePlayerMoney(playerid, -House[i][Price]);
        
DestroyDynamicMapIcon(House[i][Icon]);
        
House[i][Icon] = CreateDynamicMapIcon(House[i][EnterX],House[i][EnterY],House[i][EnterZ], 320, -1, -1, -1100.0);
        
CheckHouse(i);
        
format(string,sizeof(string),"{E0BC1B}Owner: "COL_WHITE"%s\n{E0BC1B}House name: "COL_WHITE"%s\n{E0BC1B}Price: "COL_WHITE"%d\n{E0BC1B}Level: "COL_WHITE"%d\n{E0BC1B}Rent price: "COL_WHITE"%d\n{E0BC1B}Address: "COL_WHITE"%s\n (/renthouse)",House[i][Owner],House[i][HouseName],House[i][Price],House[i][Level],House[i][RentPrice],House[i][Address]);
        
UpdateDynamic3DTextLabelText(House[i][DLabel],-1,string);
        
UpdatePlayerInformation(playerid);
        return 
1;

Reply
#3

Thanks
Reply
#4

But It is Not Working
Reply
#5

Quote:
Originally Posted by CarRamper
Посмотреть сообщение
But It is Not Working
how come thats not working what is the problem? it will work only if you have more than 5000 score not equal to 5000
Reply
#6

It Gives me House Even If i Don't have 5000 Scores.Let i try Again
Reply
#7

yes I Am Sure It Is Not Working
Reply
#8

Here is The Whole Script Can U Check It Sreyas
Код:
/*
/hwithdraw - changed to /hdeposit
/hdeposit - changed to /hwithdraw
-Fixed my bad english. Special thanks to Pillhead2007
-Fixed bug with /removehouse (Added to destroy MapIcon)
-Fixed bug with labels,pickups on coordinates 0,0,0
*/
#define filterscript
#include <a_samp>
#include <foreach>
#include <sscanf2>
#include <YSI\y_ini>
#include <YSI\y_commands>
#include <streamer>
#pragma tabsize 0

#define MAX_HOUSE   500 //This is limit u can change
#define House_File  "House/%d.ini" //Place where save houses
#define FILE_FOR_PLAYER "House/Player/%s.ini"
#define DIALOG_HOUSE     1391//Dialog for house
#define SCM SendClientMessage
#define MAX_DAYS    7
//-Colors-
#define COL_YELLOW "{F5E618}"
#define COL_GREEN "{2EAD15}"
#define COL_WHITE "{FFFFFF}"
#define COL_BLUE "{345ACF}"
#define COLOR_RED 0xE01B4CFF
#define COLOR_PURPLE 0xC21BE0
#define randomEx(%0,%1)             (random((%1) - (%0)) + (%0))
new bool:False = false, _S_T_R_[128];
#define SendFormatMSG(%0,%1,%2,%3)\
		do{\
			format(_S_T_R_, sizeof (_S_T_R_), (%2), %3);\
			SendClientMessage((%0),(%1), _S_T_R_);\
		}\
		while (False)

new Text:LockTD0[MAX_PLAYERS],
	Text:LockTD1[MAX_PLAYERS],
	Text:LockTD2[MAX_PLAYERS],
	Text:LockTD3[MAX_PLAYERS],
	Text:LockTD4[MAX_PLAYERS],
	Text:LockTD5[MAX_PLAYERS],
	Text:LockTD6[MAX_PLAYERS],
	Text:Phone0[MAX_PLAYERS],
	Text:Phone1[MAX_PLAYERS],
	Text:Phone2[MAX_PLAYERS],
	Text:Phone3[MAX_PLAYERS],
	Text:Phone4[MAX_PLAYERS],
	Text:Phone5[MAX_PLAYERS],
	Text:hUp[MAX_PLAYERS],
	Choose[MAX_PLAYERS],
	TypeText[5][MAX_PLAYERS],
	HouseOwner[32][MAX_VEHICLES],
	ChooseInt[MAX_PLAYERS],
	HouseID1[MAX_PLAYERS],
	PhoneChoose[MAX_PLAYERS],
	Calling[MAX_PLAYERS],
	TalkWith[MAX_PLAYERS],
	CallFrom[MAX_PLAYERS],
	PlayerCP[MAX_PLAYERS];
	
enum plinfo
{
	Float:SpawnX,
	Float:SpawnY,
	Float:SpawnZ,
	SpawnInt,
	SpawnVW,
	Spawn,
	RobHouse,
	Houseid,
	Sec,
	Min,
}
new Player[MAX_PLAYERS][plinfo];
enum house
{
	Float:EnterX,
	Float:EnterY,
	Float:EnterZ,
	Float:ExitX,
	Float:ExitY,
	Float:ExitZ,
	Text3D:DLabel,
	PickupU,
	HouseName[48],
	Owner[32],
	IntID,
	VW,
	On_Sell,
	Price,
	Level,
	Lock,
	LockPass[5],
	RentPrice,
	Player_Rent[48],
	Money,
	Gun1,
	Gun2,
	Ammo1,
	Ammo2,
	Icon,
	Float:hCarX,
	Float:hCarY,
	Float:hCarZ,
	Float:hCarA,
	hCarC1,
	hCarC2,
	hCarID,
	hCar,
	hCarMoney,
	hCarGun1,
	hCarGun2,
	hCarAmmo1,
	hCarAmmo2,
	PhoneNum[5],
	Address[48],
	DayEnter,
	MonthEnter,
}
new House[MAX_HOUSE][house];

enum MainZone
{
	Zone_Name[28],
	Float:Zone_Area[6]
};

static const SanAndreasZones[][MainZone] = {

	{"The Big Ear",	                {-410.00,1403.30,-3.00,-137.90,1681.20,200.00}},
	{"Aldea Malvada",               {-1372.10,2498.50,0.00,-1277.50,2615.30,200.00}},
	{"Angel Pine",                  {-2324.90,-2584.20,-6.10,-1964.20,-2212.10,200.00}},
	{"Arco del Oeste",              {-901.10,2221.80,0.00,-592.00,2571.90,200.00}},
	{"Avispa Country Club",         {-2646.40,-355.40,0.00,-2270.00,-222.50,200.00}},
	{"Avispa Country Club",         {-2831.80,-430.20,-6.10,-2646.40,-222.50,200.00}},
	{"Avispa Country Club",         {-2361.50,-417.10,0.00,-2270.00,-355.40,200.00}},
	{"Avispa Country Club",         {-2667.80,-302.10,-28.80,-2646.40,-262.30,71.10}},
	{"Avispa Country Club",         {-2470.00,-355.40,0.00,-2270.00,-318.40,46.10}},
	{"Avispa Country Club",         {-2550.00,-355.40,0.00,-2470.00,-318.40,39.70}},
	{"Back o Beyond",               {-1166.90,-2641.10,0.00,-321.70,-1856.00,200.00}},
	{"Battery Point",               {-2741.00,1268.40,-4.50,-2533.00,1490.40,200.00}},
	{"Bayside",                     {-2741.00,2175.10,0.00,-2353.10,2722.70,200.00}},
	{"Bayside Marina",              {-2353.10,2275.70,0.00,-2153.10,2475.70,200.00}},
	{"Beacon Hill",                 {-399.60,-1075.50,-1.40,-319.00,-977.50,198.50}},
	{"Blackfield",                  {964.30,1203.20,-89.00,1197.30,1403.20,110.90}},
	{"Blackfield",                  {964.30,1403.20,-89.00,1197.30,1726.20,110.90}},
	{"Blackfield Chapel",           {1375.60,596.30,-89.00,1558.00,823.20,110.90}},
	{"Blackfield Chapel",           {1325.60,596.30,-89.00,1375.60,795.00,110.90}},
	{"Blackfield Intersection",     {1197.30,1044.60,-89.00,1277.00,1163.30,110.90}},
	{"Blackfield Intersection",     {1166.50,795.00,-89.00,1375.60,1044.60,110.90}},
	{"Blackfield Intersection",     {1277.00,1044.60,-89.00,1315.30,1087.60,110.90}},
	{"Blackfield Intersection",     {1375.60,823.20,-89.00,1457.30,919.40,110.90}},
	{"Blueberry",                   {104.50,-220.10,2.30,349.60,152.20,200.00}},
	{"Blueberry",                   {19.60,-404.10,3.80,349.60,-220.10,200.00}},
	{"Blueberry Acres",             {-319.60,-220.10,0.00,104.50,293.30,200.00}},
	{"Caligula's Palace",           {2087.30,1543.20,-89.00,2437.30,1703.20,110.90}},
	{"Caligula's Palace",           {2137.40,1703.20,-89.00,2437.30,1783.20,110.90}},
	{"Calton Heights",              {-2274.10,744.10,-6.10,-1982.30,1358.90,200.00}},
	{"Chinatown",                   {-2274.10,578.30,-7.60,-2078.60,744.10,200.00}},
	{"City Hall",                   {-2867.80,277.40,-9.10,-2593.40,458.40,200.00}},
	{"Come-A-Lot",                  {2087.30,943.20,-89.00,2623.10,1203.20,110.90}},
	{"Commerce",                    {1323.90,-1842.20,-89.00,1701.90,-1722.20,110.90}},
	{"Commerce",                    {1323.90,-1722.20,-89.00,1440.90,-1577.50,110.90}},
	{"Commerce",                    {1370.80,-1577.50,-89.00,1463.90,-1384.90,110.90}},
	{"Commerce",                    {1463.90,-1577.50,-89.00,1667.90,-1430.80,110.90}},
	{"Commerce",                    {1583.50,-1722.20,-89.00,1758.90,-1577.50,110.90}},
	{"Commerce",                    {1667.90,-1577.50,-89.00,1812.60,-1430.80,110.90}},
	{"Conference Center",           {1046.10,-1804.20,-89.00,1323.90,-1722.20,110.90}},
	{"Conference Center",           {1073.20,-1842.20,-89.00,1323.90,-1804.20,110.90}},
	{"Cranberry Station",           {-2007.80,56.30,0.00,-1922.00,224.70,100.00}},
	{"Creek",                       {2749.90,1937.20,-89.00,2921.60,2669.70,110.90}},
	{"Dillimore",                   {580.70,-674.80,-9.50,861.00,-404.70,200.00}},
	{"Doherty",                     {-2270.00,-324.10,-0.00,-1794.90,-222.50,200.00}},
	{"Doherty",                     {-2173.00,-222.50,-0.00,-1794.90,265.20,200.00}},
	{"Downtown",                    {-1982.30,744.10,-6.10,-1871.70,1274.20,200.00}},
	{"Downtown",                    {-1871.70,1176.40,-4.50,-1620.30,1274.20,200.00}},
	{"Downtown",                    {-1700.00,744.20,-6.10,-1580.00,1176.50,200.00}},
	{"Downtown",                    {-1580.00,744.20,-6.10,-1499.80,1025.90,200.00}},
	{"Downtown",                    {-2078.60,578.30,-7.60,-1499.80,744.20,200.00}},
	{"Downtown",                    {-1993.20,265.20,-9.10,-1794.90,578.30,200.00}},
	{"Downtown Los Santos",         {1463.90,-1430.80,-89.00,1724.70,-1290.80,110.90}},
	{"Downtown Los Santos",         {1724.70,-1430.80,-89.00,1812.60,-1250.90,110.90}},
	{"Downtown Los Santos",         {1463.90,-1290.80,-89.00,1724.70,-1150.80,110.90}},
	{"Downtown Los Santos",         {1370.80,-1384.90,-89.00,1463.90,-1170.80,110.90}},
	{"Downtown Los Santos",         {1724.70,-1250.90,-89.00,1812.60,-1150.80,110.90}},
	{"Downtown Los Santos",         {1370.80,-1170.80,-89.00,1463.90,-1130.80,110.90}},
	{"Downtown Los Santos",         {1378.30,-1130.80,-89.00,1463.90,-1026.30,110.90}},
	{"Downtown Los Santos",         {1391.00,-1026.30,-89.00,1463.90,-926.90,110.90}},
	{"Downtown Los Santos",         {1507.50,-1385.20,110.90,1582.50,-1325.30,335.90}},
	{"East Beach",                  {2632.80,-1852.80,-89.00,2959.30,-1668.10,110.90}},
	{"East Beach",                  {2632.80,-1668.10,-89.00,2747.70,-1393.40,110.90}},
	{"East Beach",                  {2747.70,-1668.10,-89.00,2959.30,-1498.60,110.90}},
	{"East Beach",                  {2747.70,-1498.60,-89.00,2959.30,-1120.00,110.90}},
	{"East Los Santos",             {2421.00,-1628.50,-89.00,2632.80,-1454.30,110.90}},
	{"East Los Santos",             {2222.50,-1628.50,-89.00,2421.00,-1494.00,110.90}},
	{"East Los Santos",             {2266.20,-1494.00,-89.00,2381.60,-1372.00,110.90}},
	{"East Los Santos",             {2381.60,-1494.00,-89.00,2421.00,-1454.30,110.90}},
	{"East Los Santos",             {2281.40,-1372.00,-89.00,2381.60,-1135.00,110.90}},
	{"East Los Santos",             {2381.60,-1454.30,-89.00,2462.10,-1135.00,110.90}},
	{"East Los Santos",             {2462.10,-1454.30,-89.00,2581.70,-1135.00,110.90}},
	{"Easter Basin",                {-1794.90,249.90,-9.10,-1242.90,578.30,200.00}},
	{"Easter Basin",                {-1794.90,-50.00,-0.00,-1499.80,249.90,200.00}},
	{"Easter Bay Airport",          {-1499.80,-50.00,-0.00,-1242.90,249.90,200.00}},
	{"Easter Bay Airport",          {-1794.90,-730.10,-3.00,-1213.90,-50.00,200.00}},
	{"Easter Bay Airport",          {-1213.90,-730.10,0.00,-1132.80,-50.00,200.00}},
	{"Easter Bay Airport",          {-1242.90,-50.00,0.00,-1213.90,578.30,200.00}},
	{"Easter Bay Airport",          {-1213.90,-50.00,-4.50,-947.90,578.30,200.00}},
	{"Easter Bay Airport",          {-1315.40,-405.30,15.40,-1264.40,-209.50,25.40}},
	{"Easter Bay Airport",          {-1354.30,-287.30,15.40,-1315.40,-209.50,25.40}},
	{"Easter Bay Airport",          {-1490.30,-209.50,15.40,-1264.40,-148.30,25.40}},
	{"Easter Bay Chemicals",        {-1132.80,-768.00,0.00,-956.40,-578.10,200.00}},
	{"Easter Bay Chemicals",        {-1132.80,-787.30,0.00,-956.40,-768.00,200.00}},
	{"El Castillo del Diablo",      {-464.50,2217.60,0.00,-208.50,2580.30,200.00}},
	{"El Castillo del Diablo",      {-208.50,2123.00,-7.60,114.00,2337.10,200.00}},
	{"El Castillo del Diablo",      {-208.50,2337.10,0.00,8.40,2487.10,200.00}},
	{"El Corona",                   {1812.60,-2179.20,-89.00,1970.60,-1852.80,110.90}},
	{"El Corona",                   {1692.60,-2179.20,-89.00,1812.60,-1842.20,110.90}},
	{"El Quebrados",                {-1645.20,2498.50,0.00,-1372.10,2777.80,200.00}},
	{"Esplanade East",              {-1620.30,1176.50,-4.50,-1580.00,1274.20,200.00}},
	{"Esplanade East",              {-1580.00,1025.90,-6.10,-1499.80,1274.20,200.00}},
	{"Esplanade East",              {-1499.80,578.30,-79.60,-1339.80,1274.20,20.30}},
	{"Esplanade North",             {-2533.00,1358.90,-4.50,-1996.60,1501.20,200.00}},
	{"Esplanade North",             {-1996.60,1358.90,-4.50,-1524.20,1592.50,200.00}},
	{"Esplanade North",             {-1982.30,1274.20,-4.50,-1524.20,1358.90,200.00}},
	{"Fallen Tree",                 {-792.20,-698.50,-5.30,-452.40,-380.00,200.00}},
	{"Fallow Bridge",               {434.30,366.50,0.00,603.00,555.60,200.00}},
	{"Fern Ridge",                  {508.10,-139.20,0.00,1306.60,119.50,200.00}},
	{"Financial",                   {-1871.70,744.10,-6.10,-1701.30,1176.40,300.00}},
	{"Fisher's Lagoon",             {1916.90,-233.30,-100.00,2131.70,13.80,200.00}},
	{"Flint Intersection",          {-187.70,-1596.70,-89.00,17.00,-1276.60,110.90}},
	{"Flint Range",                 {-594.10,-1648.50,0.00,-187.70,-1276.60,200.00}},
	{"Fort Carson",                 {-376.20,826.30,-3.00,123.70,1220.40,200.00}},
	{"Foster Valley",               {-2270.00,-430.20,-0.00,-2178.60,-324.10,200.00}},
	{"Foster Valley",               {-2178.60,-599.80,-0.00,-1794.90,-324.10,200.00}},
	{"Foster Valley",               {-2178.60,-1115.50,0.00,-1794.90,-599.80,200.00}},
	{"Foster Valley",               {-2178.60,-1250.90,0.00,-1794.90,-1115.50,200.00}},
	{"Frederick Bridge",            {2759.20,296.50,0.00,2774.20,594.70,200.00}},
	{"Gant Bridge",                 {-2741.40,1659.60,-6.10,-2616.40,2175.10,200.00}},
	{"Gant Bridge",                 {-2741.00,1490.40,-6.10,-2616.40,1659.60,200.00}},
	{"Ganton",                      {2222.50,-1852.80,-89.00,2632.80,-1722.30,110.90}},
	{"Ganton",                      {2222.50,-1722.30,-89.00,2632.80,-1628.50,110.90}},
	{"Garcia",                      {-2411.20,-222.50,-0.00,-2173.00,265.20,200.00}},
	{"Garcia",                      {-2395.10,-222.50,-5.30,-2354.00,-204.70,200.00}},
	{"Garver Bridge",               {-1339.80,828.10,-89.00,-1213.90,1057.00,110.90}},
	{"Garver Bridge",               {-1213.90,950.00,-89.00,-1087.90,1178.90,110.90}},
	{"Garver Bridge",               {-1499.80,696.40,-179.60,-1339.80,925.30,20.30}},
	{"Glen Park",                   {1812.60,-1449.60,-89.00,1996.90,-1350.70,110.90}},
	{"Glen Park",                   {1812.60,-1100.80,-89.00,1994.30,-973.30,110.90}},
	{"Glen Park",                   {1812.60,-1350.70,-89.00,2056.80,-1100.80,110.90}},
	{"Green Palms",                 {176.50,1305.40,-3.00,338.60,1520.70,200.00}},
	{"Greenglass College",          {964.30,1044.60,-89.00,1197.30,1203.20,110.90}},
	{"Greenglass College",          {964.30,930.80,-89.00,1166.50,1044.60,110.90}},
	{"Hampton Barns",               {603.00,264.30,0.00,761.90,366.50,200.00}},
	{"Hankypanky Point",            {2576.90,62.10,0.00,2759.20,385.50,200.00}},
	{"Harry Gold Parkway",          {1777.30,863.20,-89.00,1817.30,2342.80,110.90}},
	{"Hashbury",                    {-2593.40,-222.50,-0.00,-2411.20,54.70,200.00}},
	{"Hilltop Farm",                {967.30,-450.30,-3.00,1176.70,-217.90,200.00}},
	{"Hunter Quarry",               {337.20,710.80,-115.20,860.50,1031.70,203.70}},
	{"Idlewood",                    {1812.60,-1852.80,-89.00,1971.60,-1742.30,110.90}},
	{"Idlewood",                    {1812.60,-1742.30,-89.00,1951.60,-1602.30,110.90}},
	{"Idlewood",                    {1951.60,-1742.30,-89.00,2124.60,-1602.30,110.90}},
	{"Idlewood",                    {1812.60,-1602.30,-89.00,2124.60,-1449.60,110.90}},
	{"Idlewood",                    {2124.60,-1742.30,-89.00,2222.50,-1494.00,110.90}},
	{"Idlewood",                    {1971.60,-1852.80,-89.00,2222.50,-1742.30,110.90}},
	{"Jefferson",                   {1996.90,-1449.60,-89.00,2056.80,-1350.70,110.90}},
	{"Jefferson",                   {2124.60,-1494.00,-89.00,2266.20,-1449.60,110.90}},
	{"Jefferson",                   {2056.80,-1372.00,-89.00,2281.40,-1210.70,110.90}},
	{"Jefferson",                   {2056.80,-1210.70,-89.00,2185.30,-1126.30,110.90}},
	{"Jefferson",                   {2185.30,-1210.70,-89.00,2281.40,-1154.50,110.90}},
	{"Jefferson",                   {2056.80,-1449.60,-89.00,2266.20,-1372.00,110.90}},
	{"Julius Thruway East",         {2623.10,943.20,-89.00,2749.90,1055.90,110.90}},
	{"Julius Thruway East",         {2685.10,1055.90,-89.00,2749.90,2626.50,110.90}},
	{"Julius Thruway East",         {2536.40,2442.50,-89.00,2685.10,2542.50,110.90}},
	{"Julius Thruway East",         {2625.10,2202.70,-89.00,2685.10,2442.50,110.90}},
	{"Julius Thruway North",        {2498.20,2542.50,-89.00,2685.10,2626.50,110.90}},
	{"Julius Thruway North",        {2237.40,2542.50,-89.00,2498.20,2663.10,110.90}},
	{"Julius Thruway North",        {2121.40,2508.20,-89.00,2237.40,2663.10,110.90}},
	{"Julius Thruway North",        {1938.80,2508.20,-89.00,2121.40,2624.20,110.90}},
	{"Julius Thruway North",        {1534.50,2433.20,-89.00,1848.40,2583.20,110.90}},
	{"Julius Thruway North",        {1848.40,2478.40,-89.00,1938.80,2553.40,110.90}},
	{"Julius Thruway North",        {1704.50,2342.80,-89.00,1848.40,2433.20,110.90}},
	{"Julius Thruway North",        {1377.30,2433.20,-89.00,1534.50,2507.20,110.90}},
	{"Julius Thruway South",        {1457.30,823.20,-89.00,2377.30,863.20,110.90}},
	{"Julius Thruway South",        {2377.30,788.80,-89.00,2537.30,897.90,110.90}},
	{"Julius Thruway West",         {1197.30,1163.30,-89.00,1236.60,2243.20,110.90}},
	{"Julius Thruway West",         {1236.60,2142.80,-89.00,1297.40,2243.20,110.90}},
	{"Juniper Hill",                {-2533.00,578.30,-7.60,-2274.10,968.30,200.00}},
	{"Juniper Hollow",              {-2533.00,968.30,-6.10,-2274.10,1358.90,200.00}},
	{"K.A.C.C. Military Fuels",     {2498.20,2626.50,-89.00,2749.90,2861.50,110.90}},
	{"Kincaid Bridge",              {-1339.80,599.20,-89.00,-1213.90,828.10,110.90}},
	{"Kincaid Bridge",              {-1213.90,721.10,-89.00,-1087.90,950.00,110.90}},
	{"Kincaid Bridge",              {-1087.90,855.30,-89.00,-961.90,986.20,110.90}},
	{"King's",                      {-2329.30,458.40,-7.60,-1993.20,578.30,200.00}},
	{"King's",                      {-2411.20,265.20,-9.10,-1993.20,373.50,200.00}},
	{"King's",                      {-2253.50,373.50,-9.10,-1993.20,458.40,200.00}},
	{"LVA Freight Depot",           {1457.30,863.20,-89.00,1777.40,1143.20,110.90}},
	{"LVA Freight Depot",           {1375.60,919.40,-89.00,1457.30,1203.20,110.90}},
	{"LVA Freight Depot",           {1277.00,1087.60,-89.00,1375.60,1203.20,110.90}},
	{"LVA Freight Depot",           {1315.30,1044.60,-89.00,1375.60,1087.60,110.90}},
	{"LVA Freight Depot",           {1236.60,1163.40,-89.00,1277.00,1203.20,110.90}},
	{"Las Barrancas",               {-926.10,1398.70,-3.00,-719.20,1634.60,200.00}},
	{"Las Brujas",                  {-365.10,2123.00,-3.00,-208.50,2217.60,200.00}},
	{"Las Colinas",                 {1994.30,-1100.80,-89.00,2056.80,-920.80,110.90}},
	{"Las Colinas",                 {2056.80,-1126.30,-89.00,2126.80,-920.80,110.90}},
	{"Las Colinas",                 {2185.30,-1154.50,-89.00,2281.40,-934.40,110.90}},
	{"Las Colinas",                 {2126.80,-1126.30,-89.00,2185.30,-934.40,110.90}},
	{"Las Colinas",                 {2747.70,-1120.00,-89.00,2959.30,-945.00,110.90}},
	{"Las Colinas",                 {2632.70,-1135.00,-89.00,2747.70,-945.00,110.90}},
	{"Las Colinas",                 {2281.40,-1135.00,-89.00,2632.70,-945.00,110.90}},
	{"Las Payasadas",               {-354.30,2580.30,2.00,-133.60,2816.80,200.00}},
	{"Las Venturas Airport",        {1236.60,1203.20,-89.00,1457.30,1883.10,110.90}},
	{"Las Venturas Airport",        {1457.30,1203.20,-89.00,1777.30,1883.10,110.90}},
	{"Las Venturas Airport",        {1457.30,1143.20,-89.00,1777.40,1203.20,110.90}},
	{"Las Venturas Airport",        {1515.80,1586.40,-12.50,1729.90,1714.50,87.50}},
	{"Last Dime Motel",             {1823.00,596.30,-89.00,1997.20,823.20,110.90}},
	{"Leafy Hollow",                {-1166.90,-1856.00,0.00,-815.60,-1602.00,200.00}},
	{"Liberty City",                {-1000.00,400.00,1300.00,-700.00,600.00,1400.00}},
	{"Lil' Probe Inn",              {-90.20,1286.80,-3.00,153.80,1554.10,200.00}},
	{"Linden Side",                 {2749.90,943.20,-89.00,2923.30,1198.90,110.90}},
	{"Linden Station",              {2749.90,1198.90,-89.00,2923.30,1548.90,110.90}},
	{"Linden Station",              {2811.20,1229.50,-39.50,2861.20,1407.50,60.40}},
	{"Little Mexico",               {1701.90,-1842.20,-89.00,1812.60,-1722.20,110.90}},
	{"Little Mexico",               {1758.90,-1722.20,-89.00,1812.60,-1577.50,110.90}},
	{"Los Flores",                  {2581.70,-1454.30,-89.00,2632.80,-1393.40,110.90}},
	{"Los Flores",                  {2581.70,-1393.40,-89.00,2747.70,-1135.00,110.90}},
	{"Los Santos International",    {1249.60,-2394.30,-89.00,1852.00,-2179.20,110.90}},
	{"Los Santos International",    {1852.00,-2394.30,-89.00,2089.00,-2179.20,110.90}},
	{"Los Santos International",    {1382.70,-2730.80,-89.00,2201.80,-2394.30,110.90}},
	{"Los Santos International",    {1974.60,-2394.30,-39.00,2089.00,-2256.50,60.90}},
	{"Los Santos International",    {1400.90,-2669.20,-39.00,2189.80,-2597.20,60.90}},
	{"Los Santos International",    {2051.60,-2597.20,-39.00,2152.40,-2394.30,60.90}},
	{"Marina",                      {647.70,-1804.20,-89.00,851.40,-1577.50,110.90}},
	{"Marina",                      {647.70,-1577.50,-89.00,807.90,-1416.20,110.90}},
	{"Marina",                      {807.90,-1577.50,-89.00,926.90,-1416.20,110.90}},
	{"Market",                      {787.40,-1416.20,-89.00,1072.60,-1310.20,110.90}},
	{"Market",                      {952.60,-1310.20,-89.00,1072.60,-1130.80,110.90}},
	{"Market",                      {1072.60,-1416.20,-89.00,1370.80,-1130.80,110.90}},
	{"Market",                      {926.90,-1577.50,-89.00,1370.80,-1416.20,110.90}},
	{"Market Station",              {787.40,-1410.90,-34.10,866.00,-1310.20,65.80}},
	{"Martin Bridge",               {-222.10,293.30,0.00,-122.10,476.40,200.00}},
	{"Missionary Hill",             {-2994.40,-811.20,0.00,-2178.60,-430.20,200.00}},
	{"Montgomery",                  {1119.50,119.50,-3.00,1451.40,493.30,200.00}},
	{"Montgomery",                  {1451.40,347.40,-6.10,1582.40,420.80,200.00}},
	{"Montgomery Intersection",     {1546.60,208.10,0.00,1745.80,347.40,200.00}},
	{"Montgomery Intersection",     {1582.40,347.40,0.00,1664.60,401.70,200.00}},
	{"Mulholland",                  {1414.00,-768.00,-89.00,1667.60,-452.40,110.90}},
	{"Mulholland",                  {1281.10,-452.40,-89.00,1641.10,-290.90,110.90}},
	{"Mulholland",                  {1269.10,-768.00,-89.00,1414.00,-452.40,110.90}},
	{"Mulholland",                  {1357.00,-926.90,-89.00,1463.90,-768.00,110.90}},
	{"Mulholland",                  {1318.10,-910.10,-89.00,1357.00,-768.00,110.90}},
	{"Mulholland",                  {1169.10,-910.10,-89.00,1318.10,-768.00,110.90}},
	{"Mulholland",                  {768.60,-954.60,-89.00,952.60,-860.60,110.90}},
	{"Mulholland",                  {687.80,-860.60,-89.00,911.80,-768.00,110.90}},
	{"Mulholland",                  {737.50,-768.00,-89.00,1142.20,-674.80,110.90}},
	{"Mulholland",                  {1096.40,-910.10,-89.00,1169.10,-768.00,110.90}},
	{"Mulholland",                  {952.60,-937.10,-89.00,1096.40,-860.60,110.90}},
	{"Mulholland",                  {911.80,-860.60,-89.00,1096.40,-768.00,110.90}},
	{"Mulholland",                  {861.00,-674.80,-89.00,1156.50,-600.80,110.90}},
	{"Mulholland Intersection",     {1463.90,-1150.80,-89.00,1812.60,-768.00,110.90}},
	{"North Rock",                  {2285.30,-768.00,0.00,2770.50,-269.70,200.00}},
	{"Ocean Docks",                 {2373.70,-2697.00,-89.00,2809.20,-2330.40,110.90}},
	{"Ocean Docks",                 {2201.80,-2418.30,-89.00,2324.00,-2095.00,110.90}},
	{"Ocean Docks",                 {2324.00,-2302.30,-89.00,2703.50,-2145.10,110.90}},
	{"Ocean Docks",                 {2089.00,-2394.30,-89.00,2201.80,-2235.80,110.90}},
	{"Ocean Docks",                 {2201.80,-2730.80,-89.00,2324.00,-2418.30,110.90}},
	{"Ocean Docks",                 {2703.50,-2302.30,-89.00,2959.30,-2126.90,110.90}},
	{"Ocean Docks",                 {2324.00,-2145.10,-89.00,2703.50,-2059.20,110.90}},
	{"Ocean Flats",                 {-2994.40,277.40,-9.10,-2867.80,458.40,200.00}},
	{"Ocean Flats",                 {-2994.40,-222.50,-0.00,-2593.40,277.40,200.00}},
	{"Ocean Flats",                 {-2994.40,-430.20,-0.00,-2831.80,-222.50,200.00}},
	{"Octane Springs",              {338.60,1228.50,0.00,664.30,1655.00,200.00}},
	{"Old Venturas Strip",          {2162.30,2012.10,-89.00,2685.10,2202.70,110.90}},
	{"Palisades",                   {-2994.40,458.40,-6.10,-2741.00,1339.60,200.00}},
	{"Palomino Creek",              {2160.20,-149.00,0.00,2576.90,228.30,200.00}},
	{"Paradiso",                    {-2741.00,793.40,-6.10,-2533.00,1268.40,200.00}},
	{"Pershing Square",             {1440.90,-1722.20,-89.00,1583.50,-1577.50,110.90}},
	{"Pilgrim",                     {2437.30,1383.20,-89.00,2624.40,1783.20,110.90}},
	{"Pilgrim",                     {2624.40,1383.20,-89.00,2685.10,1783.20,110.90}},
	{"Pilson Intersection",         {1098.30,2243.20,-89.00,1377.30,2507.20,110.90}},
	{"Pirates in Men's Pants",      {1817.30,1469.20,-89.00,2027.40,1703.20,110.90}},
	{"Playa del Seville",           {2703.50,-2126.90,-89.00,2959.30,-1852.80,110.90}},
	{"Prickle Pine",                {1534.50,2583.20,-89.00,1848.40,2863.20,110.90}},
	{"Prickle Pine",                {1117.40,2507.20,-89.00,1534.50,2723.20,110.90}},
	{"Prickle Pine",                {1848.40,2553.40,-89.00,1938.80,2863.20,110.90}},
	{"Prickle Pine",                {1938.80,2624.20,-89.00,2121.40,2861.50,110.90}},
	{"Queens",                      {-2533.00,458.40,0.00,-2329.30,578.30,200.00}},
	{"Queens",                      {-2593.40,54.70,0.00,-2411.20,458.40,200.00}},
	{"Queens",                      {-2411.20,373.50,0.00,-2253.50,458.40,200.00}},
	{"Randolph Industrial",         {1558.00,596.30,-89.00,1823.00,823.20,110.90}},
	{"Redsands East",               {1817.30,2011.80,-89.00,2106.70,2202.70,110.90}},
	{"Redsands East",               {1817.30,2202.70,-89.00,2011.90,2342.80,110.90}},
	{"Redsands East",               {1848.40,2342.80,-89.00,2011.90,2478.40,110.90}},
	{"Redsands West",               {1236.60,1883.10,-89.00,1777.30,2142.80,110.90}},
	{"Redsands West",               {1297.40,2142.80,-89.00,1777.30,2243.20,110.90}},
	{"Redsands West",               {1377.30,2243.20,-89.00,1704.50,2433.20,110.90}},
	{"Redsands West",               {1704.50,2243.20,-89.00,1777.30,2342.80,110.90}},
	{"Regular Tom",                 {-405.70,1712.80,-3.00,-276.70,1892.70,200.00}},
	{"Richman",                     {647.50,-1118.20,-89.00,787.40,-954.60,110.90}},
	{"Richman",                     {647.50,-954.60,-89.00,768.60,-860.60,110.90}},
	{"Richman",                     {225.10,-1369.60,-89.00,334.50,-1292.00,110.90}},
	{"Richman",                     {225.10,-1292.00,-89.00,466.20,-1235.00,110.90}},
	{"Richman",                     {72.60,-1404.90,-89.00,225.10,-1235.00,110.90}},
	{"Richman",                     {72.60,-1235.00,-89.00,321.30,-1008.10,110.90}},
	{"Richman",                     {321.30,-1235.00,-89.00,647.50,-1044.00,110.90}},
	{"Richman",                     {321.30,-1044.00,-89.00,647.50,-860.60,110.90}},
	{"Richman",                     {321.30,-860.60,-89.00,687.80,-768.00,110.90}},
	{"Richman",                     {321.30,-768.00,-89.00,700.70,-674.80,110.90}},
	{"Robada Intersection",         {-1119.00,1178.90,-89.00,-862.00,1351.40,110.90}},
	{"Roca Escalante",              {2237.40,2202.70,-89.00,2536.40,2542.50,110.90}},
	{"Roca Escalante",              {2536.40,2202.70,-89.00,2625.10,2442.50,110.90}},
	{"Rockshore East",              {2537.30,676.50,-89.00,2902.30,943.20,110.90}},
	{"Rockshore West",              {1997.20,596.30,-89.00,2377.30,823.20,110.90}},
	{"Rockshore West",              {2377.30,596.30,-89.00,2537.30,788.80,110.90}},
	{"Rodeo",                       {72.60,-1684.60,-89.00,225.10,-1544.10,110.90}},
	{"Rodeo",                       {72.60,-1544.10,-89.00,225.10,-1404.90,110.90}},
	{"Rodeo",                       {225.10,-1684.60,-89.00,312.80,-1501.90,110.90}},
	{"Rodeo",                       {225.10,-1501.90,-89.00,334.50,-1369.60,110.90}},
	{"Rodeo",                       {334.50,-1501.90,-89.00,422.60,-1406.00,110.90}},
	{"Rodeo",                       {312.80,-1684.60,-89.00,422.60,-1501.90,110.90}},
	{"Rodeo",                       {422.60,-1684.60,-89.00,558.00,-1570.20,110.90}},
	{"Rodeo",                       {558.00,-1684.60,-89.00,647.50,-1384.90,110.90}},
	{"Rodeo",                       {466.20,-1570.20,-89.00,558.00,-1385.00,110.90}},
	{"Rodeo",                       {422.60,-1570.20,-89.00,466.20,-1406.00,110.90}},
	{"Rodeo",                       {466.20,-1385.00,-89.00,647.50,-1235.00,110.90}},
	{"Rodeo",                       {334.50,-1406.00,-89.00,466.20,-1292.00,110.90}},
	{"Royal Casino",                {2087.30,1383.20,-89.00,2437.30,1543.20,110.90}},
	{"San Andreas Sound",           {2450.30,385.50,-100.00,2759.20,562.30,200.00}},
	{"Santa Flora",                 {-2741.00,458.40,-7.60,-2533.00,793.40,200.00}},
	{"Santa Maria Beach",           {342.60,-2173.20,-89.00,647.70,-1684.60,110.90}},
	{"Santa Maria Beach",           {72.60,-2173.20,-89.00,342.60,-1684.60,110.90}},
	{"Shady Cabin",                 {-1632.80,-2263.40,-3.00,-1601.30,-2231.70,200.00}},
	{"Shady Creeks",                {-1820.60,-2643.60,-8.00,-1226.70,-1771.60,200.00}},
	{"Shady Creeks",                {-2030.10,-2174.80,-6.10,-1820.60,-1771.60,200.00}},
	{"Sobell Rail Yards",           {2749.90,1548.90,-89.00,2923.30,1937.20,110.90}},
	{"Spinybed",                    {2121.40,2663.10,-89.00,2498.20,2861.50,110.90}},
	{"Starfish Casino",             {2437.30,1783.20,-89.00,2685.10,2012.10,110.90}},
	{"Starfish Casino",             {2437.30,1858.10,-39.00,2495.00,1970.80,60.90}},
	{"Starfish Casino",             {2162.30,1883.20,-89.00,2437.30,2012.10,110.90}},
	{"Temple",                      {1252.30,-1130.80,-89.00,1378.30,-1026.30,110.90}},
	{"Temple",                      {1252.30,-1026.30,-89.00,1391.00,-926.90,110.90}},
	{"Temple",                      {1252.30,-926.90,-89.00,1357.00,-910.10,110.90}},
	{"Temple",                      {952.60,-1130.80,-89.00,1096.40,-937.10,110.90}},
	{"Temple",                      {1096.40,-1130.80,-89.00,1252.30,-1026.30,110.90}},
	{"Temple",                      {1096.40,-1026.30,-89.00,1252.30,-910.10,110.90}},
	{"The Camel's Toe",             {2087.30,1203.20,-89.00,2640.40,1383.20,110.90}},
	{"The Clown's Pocket",          {2162.30,1783.20,-89.00,2437.30,1883.20,110.90}},
	{"The Emerald Isle",            {2011.90,2202.70,-89.00,2237.40,2508.20,110.90}},
	{"The Farm",                    {-1209.60,-1317.10,114.90,-908.10,-787.30,251.90}},
	{"Four Dragons Casino",         {1817.30,863.20,-89.00,2027.30,1083.20,110.90}},
	{"The High Roller",             {1817.30,1283.20,-89.00,2027.30,1469.20,110.90}},
	{"The Mako Span",               {1664.60,401.70,0.00,1785.10,567.20,200.00}},
	{"The Panopticon",              {-947.90,-304.30,-1.10,-319.60,327.00,200.00}},
	{"The Pink Swan",               {1817.30,1083.20,-89.00,2027.30,1283.20,110.90}},
	{"The Sherman Dam",             {-968.70,1929.40,-3.00,-481.10,2155.20,200.00}},
	{"The Strip",                   {2027.40,863.20,-89.00,2087.30,1703.20,110.90}},
	{"The Strip",                   {2106.70,1863.20,-89.00,2162.30,2202.70,110.90}},
	{"The Strip",                   {2027.40,1783.20,-89.00,2162.30,1863.20,110.90}},
	{"The Strip",                   {2027.40,1703.20,-89.00,2137.40,1783.20,110.90}},
	{"The Visage",                  {1817.30,1863.20,-89.00,2106.70,2011.80,110.90}},
	{"The Visage",                  {1817.30,1703.20,-89.00,2027.40,1863.20,110.90}},
	{"Unity Station",               {1692.60,-1971.80,-20.40,1812.60,-1932.80,79.50}},
	{"Valle Ocultado",              {-936.60,2611.40,2.00,-715.90,2847.90,200.00}},
	{"Verdant Bluffs",              {930.20,-2488.40,-89.00,1249.60,-2006.70,110.90}},
	{"Verdant Bluffs",              {1073.20,-2006.70,-89.00,1249.60,-1842.20,110.90}},
	{"Verdant Bluffs",              {1249.60,-2179.20,-89.00,1692.60,-1842.20,110.90}},
	{"Verdant Meadows",             {37.00,2337.10,-3.00,435.90,2677.90,200.00}},
	{"Verona Beach",                {647.70,-2173.20,-89.00,930.20,-1804.20,110.90}},
	{"Verona Beach",                {930.20,-2006.70,-89.00,1073.20,-1804.20,110.90}},
	{"Verona Beach",                {851.40,-1804.20,-89.00,1046.10,-1577.50,110.90}},
	{"Verona Beach",                {1161.50,-1722.20,-89.00,1323.90,-1577.50,110.90}},
	{"Verona Beach",                {1046.10,-1722.20,-89.00,1161.50,-1577.50,110.90}},
	{"Vinewood",                    {787.40,-1310.20,-89.00,952.60,-1130.80,110.90}},
	{"Vinewood",                    {787.40,-1130.80,-89.00,952.60,-954.60,110.90}},
	{"Vinewood",                    {647.50,-1227.20,-89.00,787.40,-1118.20,110.90}},
	{"Vinewood",                    {647.70,-1416.20,-89.00,787.40,-1227.20,110.90}},
	{"Whitewood Estates",           {883.30,1726.20,-89.00,1098.30,2507.20,110.90}},
	{"Whitewood Estates",           {1098.30,1726.20,-89.00,1197.30,2243.20,110.90}},
	{"Willowfield",                 {1970.60,-2179.20,-89.00,2089.00,-1852.80,110.90}},
	{"Willowfield",                 {2089.00,-2235.80,-89.00,2201.80,-1989.90,110.90}},
	{"Willowfield",                 {2089.00,-1989.90,-89.00,2324.00,-1852.80,110.90}},
	{"Willowfield",                 {2201.80,-2095.00,-89.00,2324.00,-1989.90,110.90}},
	{"Willowfield",                 {2541.70,-1941.40,-89.00,2703.50,-1852.80,110.90}},
	{"Willowfield",                 {2324.00,-2059.20,-89.00,2541.70,-1852.80,110.90}},
	{"Willowfield",                 {2541.70,-2059.20,-89.00,2703.50,-1941.40,110.90}},
	{"Yellow Bell Station",         {1377.40,2600.40,-21.90,1492.40,2687.30,78.00}},
	// Citys Zones
	{"Los Santos",                  {44.60,-2892.90,-242.90,2997.00,-768.00,900.00}},
	{"Las Venturas",                {869.40,596.30,-242.90,2997.00,2993.80,900.00}},
	{"Bone County",                 {-480.50,596.30,-242.90,869.40,2993.80,900.00}},
	{"Tierra Robada",               {-2997.40,1659.60,-242.90,-480.50,2993.80,900.00}},
	{"Tierra Robada",               {-1213.90,596.30,-242.90,-480.50,1659.60,900.00}},
	{"San Fierro",                  {-2997.40,-1115.50,-242.90,-1213.90,1659.60,900.00}},
	{"Red County",                  {-1213.90,-768.00,-242.90,2997.00,596.30,900.00}},
	{"Flint County",                {-1213.90,-2892.90,-242.90,44.60,-768.00,900.00}},
	{"Whetstone",                   {-2997.40,-2892.90,-242.90,-1213.90,-1115.50,900.00}}
};


public OnFilterScriptInit()
{
	print("\n--------------------------------------");
	print(" Gagi's House System by: Mr.Gagi(Gagi_Corleone)");
	print("--------------------------------------\n");
	DisableInteriorEnterExits();
	SetTimer("GlobalTimer",1000,true);
 	for(new i = 0; i <= MAX_HOUSE; i++)
  	{
  	    new gFile[35];
		format(gFile, 35, House_File ,i);
		if(fexist(gFile))
		{
		INI_ParseFile(gFile, "LoadHouse", .bExtra = true, .extra = i);
		ReadHouse(i);
		}
	}
	return 1;
}

public OnFilterScriptExit()
{
	return 1;
}

main()
{
	print("\n----------------------------------");
	print(" Blank Gamemode by your name here");
	print("----------------------------------\n");
}


public OnGameModeInit()
{
	AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
	return 1;
}

public OnGameModeExit()
{
	return 1;
}

public OnPlayerRequestClass(playerid, classid)
{
	SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
	SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
	SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
	return 1;
}

public OnPlayerConnect(playerid)
{
Player[playerid][Houseid] = 999;
Phone0[playerid] = TextDrawCreate(48.000000, 150.000000, "~n~");
TextDrawBackgroundColor(Phone0[playerid], 255);
TextDrawFont(Phone0[playerid], 1);
TextDrawLetterSize(Phone0[playerid], 0.500000, 14.199999);
TextDrawColor(Phone0[playerid], -1);
TextDrawSetOutline(Phone0[playerid], 0);
TextDrawSetProportional(Phone0[playerid], 1);
TextDrawSetShadow(Phone0[playerid], 1);
TextDrawUseBox(Phone0[playerid], 1);
TextDrawBoxColor(Phone0[playerid], 100);
TextDrawTextSize(Phone0[playerid], 130.000000, 0.000000);

Phone1[playerid] = TextDrawCreate(59.000000, 216.000000, "1 2 3~n~4 5 6~n~7 8 9~n~* 0 #");
TextDrawBackgroundColor(Phone1[playerid], 255);
TextDrawFont(Phone1[playerid], 1);
TextDrawLetterSize(Phone1[playerid], 0.559997, 1.299998);
TextDrawColor(Phone1[playerid], -1);
TextDrawSetOutline(Phone1[playerid], 0);
TextDrawSetProportional(Phone1[playerid], 1);
TextDrawSetShadow(Phone1[playerid], 1);

Phone2[playerid] = TextDrawCreate(56.000000, 170.000000, "~n~");
TextDrawBackgroundColor(Phone2[playerid], 255);
TextDrawFont(Phone2[playerid], 1);
TextDrawLetterSize(Phone2[playerid], 1.000000, 4.000000);
TextDrawColor(Phone2[playerid], -1);
TextDrawSetOutline(Phone2[playerid], 0);
TextDrawSetProportional(Phone2[playerid], 1);
TextDrawSetShadow(Phone2[playerid], 1);
TextDrawUseBox(Phone2[playerid], 1);
TextDrawBoxColor(Phone2[playerid], 310843903);
TextDrawTextSize(Phone2[playerid], 119.000000, 0.000000);

Phone3[playerid] = TextDrawCreate(120.000000, 126.000000, "~n~");
TextDrawBackgroundColor(Phone3[playerid], 255);
TextDrawFont(Phone3[playerid], 1);
TextDrawLetterSize(Phone3[playerid], 0.500000, 2.000000);
TextDrawColor(Phone3[playerid], -1);
TextDrawSetOutline(Phone3[playerid], 0);
TextDrawSetProportional(Phone3[playerid], 1);
TextDrawSetShadow(Phone3[playerid], 1);
TextDrawUseBox(Phone3[playerid], 1);
TextDrawBoxColor(Phone3[playerid], 100);
TextDrawTextSize(Phone3[playerid], 120.000000, 0.000000);

Phone4[playerid] = TextDrawCreate(53.000000, 182.000000, "Call 1111");
TextDrawBackgroundColor(Phone4[playerid], 255);
TextDrawFont(Phone4[playerid], 2);
TextDrawLetterSize(Phone4[playerid], 0.289999, 1.000000);
TextDrawColor(Phone4[playerid], -1);
TextDrawSetOutline(Phone4[playerid], 1);
TextDrawSetProportional(Phone4[playerid], 1);

Phone5[playerid] = TextDrawCreate(69.000000, 150.000000, "ooo~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~ooo");
TextDrawBackgroundColor(Phone5[playerid], 255);
TextDrawFont(Phone5[playerid], 1);
TextDrawLetterSize(Phone5[playerid], 0.500000, 1.000000);
TextDrawColor(Phone5[playerid], -1);
TextDrawSetOutline(Phone5[playerid], 1);
TextDrawSetProportional(Phone5[playerid], 1);

hUp[playerid] = TextDrawCreate(260.000000, 363.000000, "  House Upgrade~n~~n~~r~< ~w~Price: ~g~$90000 ~r~>");
TextDrawBackgroundColor(hUp[playerid], 255);
TextDrawFont(hUp[playerid], 2);
TextDrawLetterSize(hUp[playerid], 0.349999, 1.200000);
TextDrawColor(hUp[playerid], -1);
TextDrawSetOutline(hUp[playerid], 1);
TextDrawSetProportional(hUp[playerid], 1);

LockTD0[playerid] = TextDrawCreate(37.000000, 150.000000, "~n~");
TextDrawBackgroundColor(LockTD0[playerid], 255);
TextDrawFont(LockTD0[playerid], 1);
TextDrawLetterSize(LockTD0[playerid], 0.500000, 6.899999);
TextDrawColor(LockTD0[playerid], -1);
TextDrawSetOutline(LockTD0[playerid], 0);
TextDrawSetProportional(LockTD0[playerid], 1);
TextDrawSetShadow(LockTD0[playerid], 1);
TextDrawUseBox(LockTD0[playerid], 1);
TextDrawBoxColor(LockTD0[playerid], -206);
TextDrawTextSize(LockTD0[playerid], 150.000000, 0.000000);

LockTD1[playerid] = TextDrawCreate(47.000000, 162.000000, "~n~");
TextDrawBackgroundColor(LockTD1[playerid], 255);
TextDrawFont(LockTD1[playerid], 1);
TextDrawLetterSize(LockTD1[playerid], 0.500000, 3.399998);
TextDrawColor(LockTD1[playerid], -1);
TextDrawSetOutline(LockTD1[playerid], 0);
TextDrawSetProportional(LockTD1[playerid], 1);
TextDrawSetShadow(LockTD1[playerid], 1);
TextDrawUseBox(LockTD1[playerid], 1);
TextDrawBoxColor(LockTD1[playerid], -1633968897);
TextDrawTextSize(LockTD1[playerid], 79.000000, 10.000000);

LockTD2[playerid] = TextDrawCreate(45.000000, 171.000000, "1234");
TextDrawBackgroundColor(LockTD2[playerid], 255);
TextDrawFont(LockTD2[playerid], 3);
TextDrawLetterSize(LockTD2[playerid], 0.380000, 0.899999);
TextDrawColor(LockTD2[playerid], -1199695105);
TextDrawSetOutline(LockTD2[playerid], 1);
TextDrawSetProportional(LockTD2[playerid], 1);

LockTD3[playerid] = TextDrawCreate(95.000000, 157.000000, "~r~1 ~w~2 3~n~4 5 6~n~7 8 9~n~  0");
TextDrawBackgroundColor(LockTD3[playerid], 255);
TextDrawFont(LockTD3[playerid], 1);
TextDrawLetterSize(LockTD3[playerid], 0.450000, 1.000000);
TextDrawColor(LockTD3[playerid], -1);
TextDrawSetOutline(LockTD3[playerid], 1);
TextDrawSetProportional(LockTD3[playerid], 1);

LockTD4[playerid] = TextDrawCreate(44.000000, 200.000000, "Enter  Close");
TextDrawBackgroundColor(LockTD4[playerid], 255);
TextDrawFont(LockTD4[playerid], 1);
TextDrawLetterSize(LockTD4[playerid], 0.460000, 1.000000);
TextDrawColor(LockTD4[playerid], -1);
TextDrawSetOutline(LockTD4[playerid], 1);
TextDrawSetProportional(LockTD4[playerid], 1);

LockTD5[playerid] = TextDrawCreate(34.000000, 149.000000, "~n~");
TextDrawBackgroundColor(LockTD5[playerid], 255);
TextDrawFont(LockTD5[playerid], 1);
TextDrawLetterSize(LockTD5[playerid], 0.500000, -0.400000);
TextDrawColor(LockTD5[playerid], -1);
TextDrawSetOutline(LockTD5[playerid], 0);
TextDrawSetProportional(LockTD5[playerid], 1);
TextDrawSetShadow(LockTD5[playerid], 1);
TextDrawUseBox(LockTD5[playerid], 1);
TextDrawBoxColor(LockTD5[playerid], -1166599937);
TextDrawTextSize(LockTD5[playerid], 153.000000, 0.000000);

LockTD6[playerid] = TextDrawCreate(34.000000, 217.000000, "~n~");
TextDrawBackgroundColor(LockTD6[playerid], 255);
TextDrawFont(LockTD6[playerid], 1);
TextDrawLetterSize(LockTD6[playerid], 0.500000, -0.400000);
TextDrawColor(LockTD6[playerid], -1);
TextDrawSetOutline(LockTD6[playerid], 0);
TextDrawSetProportional(LockTD6[playerid], 1);
TextDrawSetShadow(LockTD6[playerid], 1);
TextDrawUseBox(LockTD6[playerid], 1);
TextDrawBoxColor(LockTD6[playerid], -1166599937);
TextDrawTextSize(LockTD6[playerid], 153.000000, 0.000000);
new pFile[48];
format(pFile, 48, FILE_FOR_PLAYER, GetName(playerid));

if(!fexist(pFile))
{
    new
    INI:UserFile = INI_Open(pFile);
    INI_WriteFloat(UserFile, "pSpawnX", 0);
    INI_WriteFloat(UserFile, "pSpawnY", 0);
    INI_WriteFloat(UserFile, "pSpawnZ", 0);
    INI_WriteInt(UserFile, "pSpawn",0);
    INI_WriteInt(UserFile, "pSpawnInt", 0);
    INI_WriteInt(UserFile, "pVW", 0);
    INI_WriteInt(UserFile, "RobHouse", 0);
    INI_WriteInt(UserFile, "HouseID", 999);
    INI_WriteInt(UserFile, "Bill", 0);
    INI_Close(UserFile);
}
INI_ParseFile(pFile, "LoadPlayerData", .bExtra = true, .extra = playerid);
return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
	TextDrawDestroy(LockTD0[playerid]);
	TextDrawDestroy(LockTD1[playerid]);
	TextDrawDestroy(LockTD2[playerid]);
	TextDrawDestroy(LockTD3[playerid]);
	TextDrawDestroy(LockTD4[playerid]);
	TextDrawDestroy(LockTD5[playerid]);
	TextDrawDestroy(LockTD6[playerid]);
	TextDrawDestroy(hUp[playerid]);
	TextDrawDestroy(Phone0[playerid]);
	TextDrawDestroy(Phone1[playerid]);
	TextDrawDestroy(Phone2[playerid]);
	TextDrawDestroy(Phone3[playerid]);
	TextDrawDestroy(Phone4[playerid]);
	TextDrawDestroy(Phone5[playerid]);
	new
        pFile[35];

   format(pFile, 35, FILE_FOR_PLAYER, GetName(playerid));
    new
    INI:UserFile = INI_Open(pFile);
    INI_WriteFloat(UserFile, "pSpawnX", Player[playerid][SpawnX]);
    INI_WriteFloat(UserFile, "pSpawnY", Player[playerid][SpawnY]);
    INI_WriteFloat(UserFile, "pSpawnZ", Player[playerid][SpawnZ]);
    INI_WriteInt(UserFile, "pSpawn", Player[playerid][Spawn]);
    INI_WriteInt(UserFile, "pSpawnInt", Player[playerid][SpawnInt]);
    INI_WriteInt(UserFile, "pVW", Player[playerid][SpawnVW]);
    INI_WriteInt(UserFile, "RobHouse", Player[playerid][RobHouse]);
    INI_WriteInt(UserFile, "HouseID", Player[playerid][Houseid]);
    INI_WriteInt(UserFile, "Bill", Player[playerid][Min]);
    INI_Close(UserFile);
	return 1;
}
forward LoadPlayerData(playerid, name[], value[]);
public LoadPlayerData(playerid, name[], value[])
{
    INI_Float("pSpawnX", Player[playerid][SpawnX]);
    INI_Float("pSpawnY", Player[playerid][SpawnY]);
    INI_Float("pSpawnZ", Player[playerid][SpawnZ]);
    INI_Int("pSpawn", Player[playerid][Spawn]);
    INI_Int("pSpawnInt", Player[playerid][SpawnInt]);
    INI_Int("pVW", Player[playerid][SpawnVW]);
    INI_Int("RobHouse", Player[playerid][RobHouse]);
    INI_Int("HouseID", Player[playerid][Houseid]);
    INI_Int("Bill", Player[playerid][Min]);
    return 1;
}
public OnPlayerSpawn(playerid)
{
if(Player[playerid][Spawn] == 1)
{
	SetPlayerPos(playerid,Player[playerid][SpawnX],Player[playerid][SpawnY],Player[playerid][SpawnZ]);
	SetPlayerInterior(playerid,Player[playerid][SpawnInt]);
	SetPlayerVirtualWorld(playerid,Player[playerid][SpawnVW]);
}
return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
	return 1;
}

public OnVehicleSpawn(vehicleid)
{
	return 1;
}

public OnVehicleDeath(vehicleid, killerid)
{
	return 1;
}

public OnPlayerText(playerid, text[])
{
	new string[128];
	if(TalkWith[playerid] != 999)
	{
	format(string,sizeof(string),"%s: %s",GetName(playerid),text);
	SCM(TalkWith[playerid],-1,string);
	}
	return 0;
}


public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
	new string[64],Float:Pos[3]; GetPlayerPos(playerid,Pos[0],Pos[1],Pos[2]);
				if(strcmp(HouseOwner[vehicleid],GetName(playerid),false) == 0)
				{
				}
				else
				{
					format(string,128,"{1BBCE0}Owner: "COL_WHITE"%s",HouseOwner[vehicleid]);
					SCM(playerid,-1,string);
					SCM(playerid,-1,"{1BBCE0}You don't have a Key.");
					SetPlayerPos(playerid,Pos[0],Pos[1],Pos[2]);
				}
	return 1;
}

public OnPlayerExitVehicle(playerid, vehicleid)
{
	return 1;
}

public OnPlayerStateChange(playerid, newstate, oldstate)
{
	return 1;
}

public OnPlayerEnterCheckpoint(playerid)
{
	new i = Player[playerid][Houseid];
	if(PlayerCP[playerid] == 1)
	{
	if(IsPlayerInRangeOfPoint(playerid,2.0,House[i][EnterX],House[i][EnterY],House[i][EnterZ]))
	{
 		DisablePlayerCheckpoint(playerid);
 		PlayerCP[playerid] = 0;
 	}
	}
	return 1;
}

public OnPlayerLeaveCheckpoint(playerid)
{
	return 1;
}

public OnPlayerEnterRaceCheckpoint(playerid)
{
	return 1;
}

public OnPlayerLeaveRaceCheckpoint(playerid)
{
	return 1;
}

public OnRconCommand(cmd[])
{
	return 1;
}

public OnPlayerRequestSpawn(playerid)
{
	return 1;
}

public OnObjectMoved(objectid)
{
	return 1;
}

public OnPlayerObjectMoved(playerid, objectid)
{
	return 1;
}

public OnPlayerPickUpPickup(playerid, pickupid)
{
	return 1;
}

public OnVehicleMod(playerid, vehicleid, componentid)
{
	return 1;
}

public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
{
	return 1;
}

public OnVehicleRespray(playerid, vehicleid, color1, color2)
{
	return 1;
}

public OnPlayerSelectedMenuRow(playerid, row)
{
	return 1;
}

public OnPlayerExitedMenu(playerid)
{
	return 1;
}

public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
{
	return 1;
}

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
	if(newkeys == KEY_SECONDARY_ATTACK)
	{
	    if(PhoneChoose[playerid] == 1)
	        {
	        if(strlen(TypeText[playerid]) >= 4) return SCM(playerid,COLOR_RED,"EROR: "COL_WHITE"Just 4 number please!");
	        strcat(TypeText[playerid], "1");
			TextDrawSetString(Phone4[playerid],TypeText[playerid]);
	        }
	    else if(PhoneChoose[playerid] == 2)
	        {
	        if(strlen(TypeText[playerid]) >= 4) return SCM(playerid,COLOR_RED,"EROR: "COL_WHITE"Just 4 number please!");
	        strcat(TypeText[playerid], "2");
			TextDrawSetString(Phone4[playerid],TypeText[playerid]);
	        }
	    else if(PhoneChoose[playerid] == 3)
	        {
	        if(strlen(TypeText[playerid]) >= 4) return SCM(playerid,COLOR_RED,"EROR: "COL_WHITE"Just 4 number please!");
	        strcat(TypeText[playerid], "3");
			TextDrawSetString(Phone4[playerid],TypeText[playerid]);
	        }
	    else if(PhoneChoose[playerid] == 4)
	        {
	        if(strlen(TypeText[playerid]) >= 4) return SCM(playerid,COLOR_RED,"EROR: "COL_WHITE"Just 4 number please!");
	        strcat(TypeText[playerid], "4");
			TextDrawSetString(Phone4[playerid],TypeText[playerid]);
	        }
	    else if(PhoneChoose[playerid] == 5)
	        {
	        if(strlen(TypeText[playerid]) >= 4) return SCM(playerid,COLOR_RED,"EROR: "COL_WHITE"Just 4 number please!");
	        strcat(TypeText[playerid], "5");
			TextDrawSetString(Phone4[playerid],TypeText[playerid]);
	        }
	    else if(PhoneChoose[playerid] == 6)
	        {
	        if(strlen(TypeText[playerid]) >= 4) return SCM(playerid,COLOR_RED,"EROR: "COL_WHITE"Just 4 number please!");
	        strcat(TypeText[playerid], "6");
			TextDrawSetString(Phone4[playerid],TypeText[playerid]);
	        }
	    else if(PhoneChoose[playerid] == 7)
	        {
	        if(strlen(TypeText[playerid]) >= 4) return SCM(playerid,COLOR_RED,"EROR: "COL_WHITE"Just 4 number please!");
	        strcat(TypeText[playerid], "7");
			TextDrawSetString(Phone4[playerid],TypeText[playerid]);
	        }
	    else if(PhoneChoose[playerid] == 8)
	        {
	        if(strlen(TypeText[playerid]) >= 4) return SCM(playerid,COLOR_RED,"EROR: "COL_WHITE"Just 4 number please!");
	        strcat(TypeText[playerid], "8");
			TextDrawSetString(Phone4[playerid],TypeText[playerid]);
	        }
	    else if(PhoneChoose[playerid] == 9)
	        {
	        if(strlen(TypeText[playerid]) >= 4) return SCM(playerid,COLOR_RED,"EROR: "COL_WHITE"Just 4 number please!");
	        strcat(TypeText[playerid], "9");
			TextDrawSetString(Phone4[playerid],TypeText[playerid]);
	        }
	    else if(PhoneChoose[playerid] == 10)
	        {
	        new string[32];
	        for(new id = 0; id <= MAX_HOUSE; id++)
	        {
	        format(string,32,House_File,id);
	        if(!fexist(string)) continue;
	        if(strcmp(House[id][PhoneNum],TypeText[playerid],false) == 0)
	        {
         	if(strcmp(House[id][Owner],"Apartment",false) == 0) continue;
	        foreach(Player, i)
	        {
			if(IsPlayerInRangeOfPoint(i,10.0,House[id][ExitX],House[id][ExitY],House[id][ExitZ]) && GetPlayerVirtualWorld(i) == House[id][VW])
			{
	        PhoneChoose[playerid] = 0;
	        TextDrawHideForPlayer(playerid,Phone0[playerid]);
	        TextDrawHideForPlayer(playerid,Phone1[playerid]);
	        TextDrawHideForPlayer(playerid,Phone2[playerid]);
	        TextDrawHideForPlayer(playerid,Phone3[playerid]);
	        TextDrawHideForPlayer(playerid,Phone4[playerid]);
	        TextDrawHideForPlayer(playerid,Phone5[playerid]);
	        TogglePlayerControllable(playerid,true);
	        SCM(playerid,-1,"Calling...");
	        SCM(playerid,-1,"Wait for answer.");
	        Calling[playerid] = 10;
	        CallFrom[i] = playerid;
	        }
	        }
	        }
			}
	        }
	    else if(PhoneChoose[playerid] == 11)
	        {
	        if(strlen(TypeText[playerid]) >= 4) return SCM(playerid,COLOR_RED,"EROR: "COL_WHITE"Just 4 number please!");
	        strcat(TypeText[playerid], "0");
			TextDrawSetString(Phone4[playerid],TypeText[playerid]);
	        }
	    else if(PhoneChoose[playerid] == 12)
	        {
	        PhoneChoose[playerid] = 0;
	        TextDrawHideForPlayer(playerid,Phone0[playerid]);
	        TextDrawHideForPlayer(playerid,Phone1[playerid]);
	        TextDrawHideForPlayer(playerid,Phone2[playerid]);
	        TextDrawHideForPlayer(playerid,Phone3[playerid]);
	        TextDrawHideForPlayer(playerid,Phone4[playerid]);
	        TextDrawHideForPlayer(playerid,Phone5[playerid]);
	        TogglePlayerControllable(playerid,true);
	        SCM(playerid,-1,"You are hangup phone");
	        }
	    if(ChooseInt[playerid] == 1)
	        {
	        new h = Player[playerid][Houseid];
			if(GetPlayerMoney(playerid) < 15000) return SCM(playerid,COLOR_RED,"EROR: "COL_WHITE"You don't have enough money.");
	        House[h][ExitX] = 2496.049804;
	        House[h][ExitY] = -1695.238159;
	        House[h][ExitZ] = 1014.742187;
	        House[h][IntID] = 3;
	        SetPlayerVirtualWorld(playerid,House[h][VW]);
			SetPlayerPos(playerid,House[h][ExitX],House[h][ExitY],House[h][ExitZ]);
			SetPlayerInterior(playerid,House[h][IntID]);
	        TextDrawHideForPlayer(playerid,hUp[playerid]);
	        GivePlayerMoney(playerid,-15000);
	        ChooseInt[playerid] = 0;
			CheckHouse(h);
			}
	    else if(ChooseInt[playerid] == 2)
	        {
	        new h = Player[playerid][Houseid];
	        if(GetPlayerMoney(playerid) < 13000) return SCM(playerid,COLOR_RED,"EROR: "COL_WHITE"You don't have enough money.");
	        House[h][ExitX] = 2527.654052;
	        House[h][ExitY] = -1679.388305;
	        House[h][ExitZ] = 1015.498596;
	        House[h][IntID] = 1;
	        SetPlayerVirtualWorld(playerid,House[h][VW]);
			SetPlayerPos(playerid,House[h][ExitX],House[h][ExitY],House[h][ExitZ]);
			SetPlayerInterior(playerid,House[h][IntID]);
	        TextDrawHideForPlayer(playerid,hUp[playerid]);
	        GivePlayerMoney(playerid,-13000);
	        ChooseInt[playerid] = 0;
			CheckHouse(h);
	        }
	    else if(ChooseInt[playerid] == 3)
	        {
	        new h = Player[playerid][Houseid];
	        if(GetPlayerMoney(playerid) < 17000) return SCM(playerid,COLOR_RED,"EROR: "COL_WHITE"You don't have enough money.");
	        House[h][ExitX] = 2807.619873;
	        House[h][ExitY] = -1171.899902;
	        House[h][ExitZ] = 1025.570312;
	        House[h][IntID] = 8;
	        SetPlayerVirtualWorld(playerid,House[h][VW]);
			SetPlayerPos(playerid,House[h][ExitX],House[h][ExitY],House[h][ExitZ]);
			SetPlayerInterior(playerid,House[h][IntID]);
	        TextDrawHideForPlayer(playerid,hUp[playerid]);
	        GivePlayerMoney(playerid,-17000);
	        ChooseInt[playerid] = 0;
			CheckHouse(h);
	        }
	    if(Choose[playerid] == 1)
	        {
	        if(strlen(TypeText[playerid]) >= 4) return SCM(playerid,COLOR_RED,"EROR: "COL_WHITE"Just 4 number please!");
	        strcat(TypeText[playerid], "1");
			TextDrawSetString(LockTD2[playerid],TypeText[playerid]);
	        }
	    else if(Choose[playerid] == 2)
	        {
	        if(strlen(TypeText[playerid]) >= 4) return SCM(playerid,COLOR_RED,"EROR: "COL_WHITE"Just 4 number please!");
	        strcat(TypeText[playerid], "2");
			TextDrawSetString(LockTD2[playerid],TypeText[playerid]);
	        }
	    else if(Choose[playerid] == 3)
	        {
	        if(strlen(TypeText[playerid]) >= 4) return SCM(playerid,COLOR_RED,"EROR: "COL_WHITE"Just 4 number please!");
	        strcat(TypeText[playerid], "3");
			TextDrawSetString(LockTD2[playerid],TypeText[playerid]);
	        }
	    else if(Choose[playerid] == 4)
	        {
	        if(strlen(TypeText[playerid]) >= 4) return SCM(playerid,COLOR_RED,"EROR: "COL_WHITE"Just 4 number please!");
	        strcat(TypeText[playerid], "4");
			TextDrawSetString(LockTD2[playerid],TypeText[playerid]);
	        }
	    else if(Choose[playerid] == 5)
	        {
	        if(strlen(TypeText[playerid]) >= 4) return SCM(playerid,COLOR_RED,"EROR: "COL_WHITE"Just 4 number please!");
	        strcat(TypeText[playerid], "5");
			TextDrawSetString(LockTD2[playerid],TypeText[playerid]);
	        }
	    else if(Choose[playerid] == 6)
	        {
	        if(strlen(TypeText[playerid]) >= 4) return SCM(playerid,COLOR_RED,"EROR: "COL_WHITE"Just 4 number please!");
	        strcat(TypeText[playerid], "6");
			TextDrawSetString(LockTD2[playerid],TypeText[playerid]);
	        }
	    else if(Choose[playerid] == 7)
	        {
	        if(strlen(TypeText[playerid]) >= 4) return SCM(playerid,COLOR_RED,"EROR: "COL_WHITE"Just 4 number please!");
	        strcat(TypeText[playerid], "7");
			TextDrawSetString(LockTD2[playerid],TypeText[playerid]);
	        }
	    else if(Choose[playerid] == 8)
	        {
	        if(strlen(TypeText[playerid]) >= 4) return SCM(playerid,COLOR_RED,"EROR: "COL_WHITE"Just 4 number please!");
	        strcat(TypeText[playerid], "8");
			TextDrawSetString(LockTD2[playerid],TypeText[playerid]);
	        }
	    else if(Choose[playerid] == 9)
	        {
	        if(strlen(TypeText[playerid]) >= 4) return SCM(playerid,COLOR_RED,"EROR: "COL_WHITE"Just 4 number please!");
	        strcat(TypeText[playerid], "9");
			TextDrawSetString(LockTD2[playerid],TypeText[playerid]);
	        }
	    else if(Choose[playerid] == 10)
	        {
	        if(strlen(TypeText[playerid]) >= 4) return SCM(playerid,COLOR_RED,"EROR: "COL_WHITE"Just 4 number please!");
	        strcat(TypeText[playerid], "0");
			TextDrawSetString(LockTD2[playerid],TypeText[playerid]);
	        }
	    else if(Choose[playerid] == 10)
	        {
	        if(strlen(TypeText[playerid]) >= 4) return SCM(playerid,COLOR_RED,"EROR: "COL_WHITE"Just 4 number please!");
	        strcat(TypeText[playerid], "0");
			TextDrawSetString(LockTD2[playerid],TypeText[playerid]);
	        }
	    else if(Choose[playerid] == 11)
	        {
	        new id = GetClosetHouseID(playerid);
	        if(strcmp(House[id][LockPass],TypeText[playerid],false) == 0)
	        {
	        House[id][Lock] = 1;
	        Choose[playerid] = 0;
	        TextDrawHideForPlayer(playerid,LockTD0[playerid]);
	        TextDrawHideForPlayer(playerid,LockTD1[playerid]);
	        TextDrawHideForPlayer(playerid,LockTD2[playerid]);
	        TextDrawHideForPlayer(playerid,LockTD3[playerid]);
	        TextDrawHideForPlayer(playerid,LockTD4[playerid]);
	        TextDrawHideForPlayer(playerid,LockTD5[playerid]);
	        TextDrawHideForPlayer(playerid,LockTD6[playerid]);
	        TogglePlayerControllable(playerid,true);
	        SCM(playerid,-1,"House is locked.");
	        CheckHouse(id);
	        }
	        else return SCM(playerid,COLOR_RED,"EROR: "COL_WHITE"Wrong password");
	        }
	    else if(Choose[playerid] == 12)
	        {
	        TextDrawHideForPlayer(playerid,LockTD0[playerid]);
	        TextDrawHideForPlayer(playerid,LockTD1[playerid]);
	        TextDrawHideForPlayer(playerid,LockTD2[playerid]);
	        TextDrawHideForPlayer(playerid,LockTD3[playerid]);
	        TextDrawHideForPlayer(playerid,LockTD4[playerid]);
	        TextDrawHideForPlayer(playerid,LockTD5[playerid]);
	        TextDrawHideForPlayer(playerid,LockTD6[playerid]);
	        TogglePlayerControllable(playerid,true);
	        }
	}
	return 1;
}

public OnRconLoginAttempt(ip[], password[], success)
{
	return 1;
}
public OnPlayerUpdate(playerid)
{
new k, ud, lr;
GetPlayerKeys(playerid, k, ud, lr);
if(lr > 0)
{
	if(ChooseInt[playerid] == 1)
	{
		ChooseInt[playerid] = 2;
		SetPlayerPos(playerid,2527.654052,-1679.388305,1015.498596);
		SetPlayerInterior(playerid,1);
		TextDrawSetString(hUp[playerid],"  House Upgrade~n~~n~~r~< ~w~Price: ~g~$13000 ~r~>");
		TextDrawShowForPlayer(playerid,hUp[playerid]);
	}
	else if(ChooseInt[playerid] == 2)
	{
		ChooseInt[playerid] = 3;
		SetPlayerPos(playerid,2807.619873,-1171.899902,1025.570312);
		SetPlayerInterior(playerid,8);
		TextDrawSetString(hUp[playerid],"  House Upgrade~n~~n~~r~< ~w~Price: ~g~$17000 ~r~>");
		TextDrawShowForPlayer(playerid,hUp[playerid]);
	}
	else if(ChooseInt[playerid] == 3)
	{
		ChooseInt[playerid] = 1;
		SetPlayerPos(playerid,2496.049804,-1695.238159,1014.742187);
		SetPlayerInterior(playerid,3);
		TextDrawSetString(hUp[playerid],"  House Upgrade~n~~n~~r~< ~w~Price: ~g~$20000 ~r~>");
		TextDrawShowForPlayer(playerid,hUp[playerid]);
	}
	
}
if(ud > 0)
{
	if(PhoneChoose[playerid] == 1)
	{
		TextDrawSetString(Phone1[playerid],"~w~1 ~y~2 ~w~3~n~4 5 6~n~7 8 9~n~~g~~g~C ~w~0 ~r~H");
		PhoneChoose[playerid] = 2;
	}
	else if(PhoneChoose[playerid] == 2)
	{
		TextDrawSetString(Phone1[playerid],"~w~1 2 ~y~3~n~~w~4 5 6~n~7 8 9~n~~g~~g~C ~w~0 ~r~H");
		PhoneChoose[playerid] = 3;
	}
	else if(PhoneChoose[playerid] == 3)
	{
		TextDrawSetString(Phone1[playerid],"~w~1 2 3~n~~y~4 ~w~5 6~n~7 8 9~n~~g~~g~C ~w~0 ~r~H");
		PhoneChoose[playerid] = 4;
	}
	else if(PhoneChoose[playerid] == 4)
	{
		TextDrawSetString(Phone1[playerid],"~w~1 2 3~n~4 ~y~5 ~w~6~n~7 8 9~n~~g~~g~C ~w~0 ~r~H");
		PhoneChoose[playerid] = 5;
	}
	else if(PhoneChoose[playerid] == 5)
	{
		TextDrawSetString(Phone1[playerid],"~w~1 2 3~n~4 5 ~y~6~n~~w~7 8 9~n~~g~~g~C ~w~0 ~r~H");
		PhoneChoose[playerid] = 6;
	}
	else if(PhoneChoose[playerid] == 6)
	{
		TextDrawSetString(Phone1[playerid],"~w~1 2 3~n~4 5 6~n~~y~7 ~w~8 9~n~~g~~g~C ~w~0 ~r~H");
		PhoneChoose[playerid] = 7;
	}
	else if(PhoneChoose[playerid] == 7)
	{
		TextDrawSetString(Phone1[playerid],"~w~1 2 3~n~4 5 6~n~7 ~y~8 ~w~9~n~~g~~g~C ~w~0 ~r~H");
		PhoneChoose[playerid] = 8;
	}
	else if(PhoneChoose[playerid] == 8)
	{
		TextDrawSetString(Phone1[playerid],"~w~1 2 3~n~4 5 6~n~7 8 ~y~9~n~~g~~g~C ~w~0 ~r~H");
		PhoneChoose[playerid] = 9;
	}
	else if(PhoneChoose[playerid] == 9)
	{
		TextDrawSetString(Phone1[playerid],"~w~1 2 3~n~4 5 6~n~7 8 9~n~~y~C ~w~0 ~r~H");
		PhoneChoose[playerid] = 10;
	}
	else if(PhoneChoose[playerid] == 10)
	{
		TextDrawSetString(Phone1[playerid],"~w~1 2 3~n~4 5 6~n~7 8 9~n~~g~~g~C ~y~0 ~r~H");
		PhoneChoose[playerid] = 11;
	}
	else if(PhoneChoose[playerid] == 11)
	{
		TextDrawSetString(Phone1[playerid],"~w~1 2 3~n~4 5 6~n~7 8 9~n~~g~~g~C ~w~0 ~y~H");
		PhoneChoose[playerid] = 12;
	}
	else if(PhoneChoose[playerid] == 12)
	{
		TextDrawSetString(Phone1[playerid],"~y~1 ~w~2 3~n~4 5 6~n~7 8 9~n~~g~~g~C ~w~0 ~r~H");
		PhoneChoose[playerid] = 1;
	}
//Alarm
	if(Choose[playerid] == 1)
	{
		TextDrawSetString(LockTD3[playerid],"~w~1 ~r~2 ~w~3~n~4 5 6~n~7 8 9~n~  0");
		Choose[playerid] = 2;
	}
	else if(Choose[playerid] == 2)
	{
		TextDrawSetString(LockTD3[playerid],"~w~1 2 ~r~3~n~~w~4 5 6~n~7 8 9~n~  0");
		Choose[playerid] = 3;
	}
	else if(Choose[playerid] == 3)
	{
		TextDrawSetString(LockTD3[playerid],"~w~1 2 3~n~~r~4 ~w~5 6~n~7 8 9~n~  0");
		Choose[playerid] = 4;
	}
	else if(Choose[playerid] == 4)
	{
		TextDrawSetString(LockTD3[playerid],"~w~1 2 3~n~4 ~r~5 ~w~6~n~7 8 9~n~  0");
		Choose[playerid] = 5;
	}
	else if(Choose[playerid] == 5)
	{
		TextDrawSetString(LockTD3[playerid],"~w~1 2 3~n~4 5 ~r~6~n~~w~7 8 9~n~  0");
		Choose[playerid] = 6;
	}
	else if(Choose[playerid] == 6)
	{
		TextDrawSetString(LockTD3[playerid],"~w~1 2 3~n~4 5 6~n~~r~7 ~w~8 9~n~  0");
		Choose[playerid] = 7;
	}
	else if(Choose[playerid] == 7)
	{
		TextDrawSetString(LockTD3[playerid],"~w~1 2 3~n~4 5 6~n~7 ~r~8 ~w~9~n~  0");
		Choose[playerid] = 8;
	}
	else if(Choose[playerid] == 8)
	{
		TextDrawSetString(LockTD3[playerid],"~w~1 2 3~n~4 5 6~n~7 8 ~r~9~n~  ~w~0");
		Choose[playerid] = 9;
	}
	else if(Choose[playerid] == 9)
	{
		TextDrawSetString(LockTD3[playerid],"~w~1 2 3~n~4 5 6~n~7 8 9~n~  ~r~0");
		Choose[playerid] = 10;
	}
	else if(Choose[playerid] == 10)
	{
		TextDrawSetString(LockTD3[playerid],"~w~1 2 3~n~4 5 6~n~7 8 9~n~  0");
		TextDrawSetString(LockTD4[playerid],"~r~Enter  ~w~Close");
		Choose[playerid] = 11;
	}
	else if(Choose[playerid] == 11)
	{
		TextDrawSetString(LockTD4[playerid],"~w~Enter  ~r~Close");
		Choose[playerid] = 12;
	}
	else if(Choose[playerid] == 12)
	{
		TextDrawSetString(LockTD4[playerid],"~w~Enter  ~w~Close");
		TextDrawSetString(LockTD3[playerid],"~r~1 ~w~2 3~n~4 5 6~n~7 8 9~n~  0");
		Choose[playerid] = 1;
	}
}
else if(ud < 0)
{
	if(Choose[playerid] == 1)
	{
		TextDrawSetString(LockTD3[playerid],"~w~1 2 ~w~3~n~4 5 6~n~7 8 9~n~  ~w~0");
		TextDrawSetString(LockTD4[playerid],"~w~Enter  ~r~Close");
		Choose[playerid] = 12;
	}
	else if(Choose[playerid] == 12)
	{
		TextDrawSetString(LockTD4[playerid],"~r~Enter  ~w~Close");
		Choose[playerid] = 11;
	}
	else if(Choose[playerid] == 11)
	{
		TextDrawSetString(LockTD4[playerid],"~w~Enter  ~w~Close");
		TextDrawSetString(LockTD3[playerid],"~w~1 2 3~n~4 5 6~n~7 8 9~n~  ~r~0");
		Choose[playerid] = 10;
	}
	else if(Choose[playerid] == 10)
	{
		TextDrawSetString(LockTD3[playerid],"~w~1 2 3~n~4 5 6~n~7 8 ~r~9~n~  ~w~0");
		Choose[playerid] = 9;
	}
	else if(Choose[playerid] == 9)
	{
		TextDrawSetString(LockTD3[playerid],"~w~1 2 3~n~4 5 6~n~7 ~r~8 ~w~9~n~  0");
		Choose[playerid] = 8;
	}
	else if(Choose[playerid] == 8)
	{
		TextDrawSetString(LockTD3[playerid],"~w~1 2 3~n~4 5 6~n~~r~7 ~w~8 9~n~  0");
		Choose[playerid] = 7;
	}
	else if(Choose[playerid] == 7)
	{
		TextDrawSetString(LockTD3[playerid],"~w~1 2 3~n~4 5 ~r~6~n~~w~7 8 9~n~  0");
		Choose[playerid] = 6;
	}
	else if(Choose[playerid] == 6)
	{
		TextDrawSetString(LockTD3[playerid],"~w~1 2 3~n~4 ~r~5 ~w~6~n~7 8 9~n~  0");
		Choose[playerid] = 5;
	}
	else if(Choose[playerid] == 5)
	{
		TextDrawSetString(LockTD3[playerid],"~w~1 2 3~n~~r~4 ~w~5 6~n~7 8 9~n~  0");
		Choose[playerid] = 4;
	}
	else if(Choose[playerid] == 4)
	{
		TextDrawSetString(LockTD3[playerid],"~w~1 2 ~r~3~n~~w~4 5 6~n~7 8 9~n~  0");
		Choose[playerid] = 3;
	}
	else if(Choose[playerid] == 3)
	{
		TextDrawSetString(LockTD3[playerid],"~w~1 ~r~2 ~w~3~n~4 5 6~n~7 8 9~n~  0");
		Choose[playerid] = 2;
	}
	else if(Choose[playerid] == 2)
	{
		TextDrawSetString(LockTD3[playerid],"~r~1 ~w~2 3~n~4 5 6~n~7 8 9~n~  0");
		Choose[playerid] = 1;
	}
}
	return 1;
}

public OnPlayerStreamIn(playerid, forplayerid)
{
	return 1;
}

public OnPlayerStreamOut(playerid, forplayerid)
{
	return 1;
}

public OnVehicleStreamIn(vehicleid, forplayerid)
{
	return 1;
}

public OnVehicleStreamOut(vehicleid, forplayerid)
{
	return 1;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
switch(dialogid)
{
			case DIALOG_HOUSE:
			{
            if(!response) return 1;
			new
				string[200];
				switch(listitem)
				{
				case 0: {
    			new id = Player[playerid][Houseid];
				if(id == 999) return SCM(playerid,COLOR_RED,"EROR: "COL_WHITE"You don't have a house");
				if(!IsPlayerInRangeOfPoint(playerid,3.0,House[id][EnterX],House[id][EnterY],House[id][EnterZ])) return SCM(playerid,COLOR_RED,"EROR: "COL_WHITE"You are not near your house");
				format(House[id][Owner], 32, "Apartment");
				if(House[id][hCar] > 0) format(HouseOwner[House[id][hCar]],64,"Apartment");
				House[id][On_Sell] = 1;
				Player[playerid][Houseid] = 999;
				GivePlayerMoney(playerid,House[id][Price]/2);
				DestroyDynamicPickup(House[id][PickupU]);
				House[id][PickupU] = CreateDynamicPickup(1273, 23,  House[id][EnterX],House[id][EnterY],House[id][EnterZ],-1,-1,-1,100.0);
				DestroyDynamicMapIcon(House[id][Icon]);
				House[id][Icon] = CreateDynamicMapIcon(House[id][EnterX],House[id][EnterY],House[id][EnterZ], 31, 0, -1, -1, -1, 100.0);
				CheckHouse(id);
				UpdatePlayerInformation(playerid);
				format(string,sizeof(string),"{29CC3F}Owner: "COL_WHITE"Apartment\n{29CC3F}House Name: "COL_WHITE"%s\n{29CC3F}Price: "COL_WHITE"%d\n{29CC3F}Level: "COL_WHITE"%d\n{29CC3F}Address: "COL_WHITE"%s\n (/buyhouse)",House[id][HouseName],House[id][Price],House[id][Level],House[id][Address]);
        		UpdateDynamic3DTextLabelText(House[id][DLabel],-1,string);
				}
				case 1: {
				ShowPlayerDialog(playerid,DIALOG_HOUSE+1,DIALOG_STYLE_INPUT,""COL_YELLOW"Rent house",""COL_BLUE"Type rent price","Put","Close"); }
				case 2:
				{
				new id = Player[playerid][Houseid];
				foreach (Player, i)
				{
					if(i != playerid)
					{
					if(strcmp(House[id][Player_Rent],GetName(playerid), false ) == 0) {SCM(i,COLOR_RED,"You have been evicted from house");}
					format(House[id][Player_Rent],48,"Nobody");
					}
					}
					}
				case 3: {
						ShowPlayerDialog(playerid,DIALOG_HOUSE+2,DIALOG_STYLE_INPUT,""COL_YELLOW"House name",""COL_WHITE"Type new name of house","Name","Close");
						}
				case 4: {
						ShowPlayerDialog(playerid,DIALOG_HOUSE+3,DIALOG_STYLE_INPUT,""COL_YELLOW"Lock Password (numbers only)",""COL_WHITE"Type new password","Insert","Close");
						}
					}
				}
		   case DIALOG_HOUSE+1:
		   {
			if(!response) return 1;
			new string[210];
			new id = Player[playerid][Houseid];
			if(strval(inputtext) <= 0) return SCM(playerid,COLOR_RED,"EROR: "COL_WHITE"Price can't be less 1");
			House[id][RentPrice] = strval(inputtext);
			format(string,sizeof(string),"New rent price is $%d",strval(inputtext)); SCM(playerid,-1,string);
			format(string,sizeof(string),"{E0BC1B}Owner: "COL_WHITE"%s\n{E0BC1B}House name: "COL_WHITE"%s\n{E0BC1B}Price: "COL_WHITE"%d\n{E0BC1B}Level: "COL_WHITE"%d\n{E0BC1B}Rent price: "COL_WHITE"%d\n{E0BC1B}Address: "COL_WHITE"%s\n (/renthouse)",House[id][Owner],House[id][HouseName],House[id][Price],House[id][Level],House[id][RentPrice],House[id][Address]);
        	UpdateDynamic3DTextLabelText(House[id][DLabel],-1,string);
			CheckHouse(id);
		   }
		   case DIALOG_HOUSE+2:
		   {
			if(!response) return 1;
			new string[210];
			new id = Player[playerid][Houseid];
			format(House[id][HouseName], 32, "%s", inputtext);
			format(string,sizeof(string),"{E0BC1B}Owner: "COL_WHITE"%s\n{E0BC1B}House name: "COL_WHITE"%s\n{E0BC1B}Price: "COL_WHITE"%d\n{E0BC1B}Level: "COL_WHITE"%d\n{E0BC1B}Rent price: "COL_WHITE"%d\n{E0BC1B}Address: "COL_WHITE"%s\n (/renthouse)",House[id][Owner],House[id][HouseName],House[id][Price],House[id][Level],House[id][RentPrice],House[id][Address]);
        	UpdateDynamic3DTextLabelText(House[id][DLabel],-1,string);
			CheckHouse(id);
		   }
		   case DIALOG_HOUSE+3:
		   {
			if(!response) return 1;
			new string[128];
			new id = Player[playerid][Houseid];
			if(strlen(inputtext) >= 5 || strlen(inputtext) < 4) return ShowPlayerDialog(playerid,DIALOG_HOUSE+3,DIALOG_STYLE_INPUT,""COL_WHITE"Lock Password",""COL_BLUE"Type new password","Insert","Close"),SCM(playerid,COLOR_RED,"EROR: "COL_WHITE"Just four numbers");
			format(House[id][LockPass],5,"%d",strval(inputtext));
			format(string,sizeof(string),"New password is %d",strval(inputtext)); SCM(playerid,-1,string);
			CheckHouse(id);
		   }
		   }
	return 1;
}

public OnPlayerClickPlayer(playerid, clickedplayerid, source)
{
	return 1;
}
forward LoadHouse(id, name[], value[]);
public LoadHouse(id, name[], value[])
{
    INI_Float("EnterX", House[id][EnterX]);
    INI_Float("EnterY", House[id][EnterY]);
    INI_Float("EnterZ", House[id][EnterZ]);
    INI_Float("ExitX", House[id][ExitX]);
    INI_Float("ExitY", House[id][ExitY]);
    INI_Float("ExitZ", House[id][ExitZ]);
    INI_String("HouseName", House[id][HouseName] , 32 );
    INI_String("Owner", House[id][Owner] , 32 );
    INI_Int("Price", House[id][Price]);
    INI_Int("Level", House[id][Level]);
    INI_Int("Interior", House[id][IntID]);
    INI_Int("VW", House[id][VW]);
    INI_Int("On_Sell", House[id][On_Sell]);
    INI_Int("Lock", House[id][Lock]);
    INI_Int("RentPrice", House[id][RentPrice]);
    INI_String("PlayerRent", House[id][Player_Rent] , 32 );
	INI_Int("Money", House[id][Money]);
	INI_Int("Gun1", House[id][Gun1]);
	INI_Int("Gun2", House[id][Gun2]);
	INI_Int("Ammo1", House[id][Ammo1]);
	INI_Int("Ammo2", House[id][Ammo2]);
 	INI_String("LockPass", House[id][LockPass] , 5 );
	INI_Float("hCarX", House[id][hCarX]);
	INI_Float("hCarY", House[id][hCarY]);
	INI_Float("hCarZ", House[id][hCarZ]);
	INI_Float("hCarA", House[id][hCarA]);
	INI_Int("hCarC1", House[id][hCarC1]);
	INI_Int("hCarC2", House[id][hCarC2]);
	INI_Int("hCarID", House[id][hCarID]);
	INI_Int("hCarMoney", House[id][hCarMoney]);
	INI_Int("hCarGun1", House[id][hCarGun1]);
	INI_Int("hCarGun2", House[id][hCarGun2]);
	INI_Int("hCarAmmo1", House[id][hCarAmmo1]);
	INI_Int("hCarAmmo2", House[id][hCarAmmo2]);
	INI_String("PhoneNum", House[id][PhoneNum] , 5 );
	INI_String("Address", House[id][Address] , 48);
	INI_Int("DayEnter", House[id][DayEnter]);
	INI_Int("MonthEnter", House[id][MonthEnter]);

    return 1;
}
//==================House System=====================
YCMD:chouse(playerid, params[], help)
{
        #pragma unused help
        if(!IsPlayerAdmin(playerid)) return SCM(playerid, COLOR_RED, "You must be RCON admin");
        new
			Float:Pos[3],string[64],id,name[48],price,level;
        if(sscanf(params, "is[48]ii",id,name,price,level)) return SCM(playerid, COLOR_RED, "Usage:"COL_WHITE" /chouse [ID] [Name] [Price] [Level]");
        if(id >= MAX_HOUSE) return SCM(playerid, COLOR_RED, "EROR: "COL_WHITE"Try again. You have typed the wrong house id.");
        format(string, sizeof(string), House_File, id);
		if(fexist(string)) return SCM(playerid, COLOR_RED, "House on that id already exists.!");
		GetPlayerPos(playerid,Pos[0],Pos[1],Pos[2]);
		CreateSaveHouse(name,id,price,level,id+1,Pos[0],Pos[1],Pos[2]);
    	SCM(playerid, -1, ""COL_YELLOW"You have Created a house..");
		return 1;
}
YCMD:removehouse(playerid, params[], help)
{
        #pragma unused help
        #pragma unused params
        if(!IsPlayerAdmin(playerid)) return SCM(playerid, COLOR_RED, "You must be RCON admin");
		new h = GetClosetHouseID(playerid),file[32];
		if(h == -1) return SCM(playerid,COLOR_RED,"EROR: "COL_WHITE"There is no house.");
		format(file,32,House_File,h);
			if(fexist(file))
			{
			    fremove(file);
			    DestroyDynamicPickup(House[h][PickupU]);
			    DestroyDynamic3DTextLabel(House[h][DLabel]);
			    DestroyDynamicMapIcon(House[h][Icon]);
			}
		return 1;
}
YCMD:gotohouse(playerid, params[], help)
{
        #pragma unused help
        new id,file[32];
        if(!IsPlayerAdmin(playerid)) return SCM(playerid, COLOR_RED, "You must be RCON admin");
        if(sscanf(params,"i",id)) return SCM(playerid,COLOR_RED,"EROR: "COL_WHITE"Usage: /gotohouse [ID]");
		format(file,32,House_File,id);
		if(!fexist(file)) return SCM(playerid,-1,"There is no house on that id.");
        SetPlayerPos(playerid,House[id][EnterX],House[id][EnterY],House[id][EnterZ]);
		return 1;
}
YCMD:buyhouse(playerid, params[], help)
{
        #pragma unused help
        #pragma unused params
        new string[210];
        new i = GetClosetHouseID(playerid);
         if(Player[playerid][Houseid] != 999) return SCM(playerid,COLOR_RED,"EROR: "COL_WHITE"You already have house");
        if(!IsPlayerInRangeOfPoint(playerid,5.0,House[i][EnterX],House[i][EnterY],House[i][EnterZ])) return SCM(playerid,COLOR_RED,"You are not close to your house.");
if(GetPlayerScore(playerid)<=5000)return SCM(playerid,COLOR_RED,"You need more than 5000 score to use this cmd !");
if(GetPlayerMoney(playerid) < House[i][Price]) return SCM(playerid, COLOR_RED, "You don't have that kind of money.");
        format(House[i][Owner], 32, "%s", GetName(playerid));
        if(House[i][hCar] > 0) format(HouseOwner[House[i][hCar]],64,"%s",GetName(playerid));
        House[i][On_Sell] = 0;
        Player[playerid][Houseid] = i;
        DestroyDynamicPickup(House[i][PickupU]);
        House[i][PickupU] = CreateDynamicPickup(1272, 23,  House[i][EnterX],House[i][EnterY],House[i][EnterZ],-1,-1,-1,100.0);
        GivePlayerMoney(playerid, -House[i][Price]);
        DestroyDynamicMapIcon(House[i][Icon]);
        House[i][Icon] = CreateDynamicMapIcon(House[i][EnterX],House[i][EnterY],House[i][EnterZ], 32, 0, -1, -1, -1, 100.0);
        CheckHouse(i);
        format(string,sizeof(string),"{E0BC1B}Owner: "COL_WHITE"%s\n{E0BC1B}House name: "COL_WHITE"%s\n{E0BC1B}Price: "COL_WHITE"%d\n{E0BC1B}Level: "COL_WHITE"%d\n{E0BC1B}Rent price: "COL_WHITE"%d\n{E0BC1B}Address: "COL_WHITE"%s\n (/renthouse)",House[i][Owner],House[i][HouseName],House[i][Price],House[i][Level],House[i][RentPrice],House[i][Address]);
        UpdateDynamic3DTextLabelText(House[i][DLabel],-1,string);
        UpdatePlayerInformation(playerid);
        return 1;
}
YCMD:house(playerid, params[], help)
{
        #pragma unused help
        #pragma unused params
        new id = Player[playerid][Houseid];
        if(id == 999) return SCM(playerid,COLOR_RED,"EROR: "COL_WHITE"You don't have a house.");
		if(!IsPlayerInRangeOfPoint(playerid,5.0,House[id][EnterX],House[id][EnterY],House[id][EnterZ])) return SCM(playerid,COLOR_RED,"This Is not Your House.!");
		ShowPlayerDialog(playerid,DIALOG_HOUSE,DIALOG_STYLE_LIST,"House control panel","Sell\nChange rent\nEvict\nHouse name\nLock Password","Choose","Close");
		return 1;
}
YCMD:renthouse(playerid, params[], help)
{
        #pragma unused help
        #pragma unused params
        new id = GetClosetHouseID(playerid);
        if(id == -1) return SCM(playerid,COLOR_RED,"EROR: "COL_WHITE"There is no house.");
		if(strcmp(House[id][Owner],"Apartment", false ) == 0)
		{
		SCM(playerid,COLOR_RED,"This house does not have an owner.");
		return 1;
		}
		if(strcmp(House[id][Player_Rent],"Nobody", false ) == 0)
		{
        new string[128];
		if(!IsPlayerInRangeOfPoint(playerid,5.0,House[id][EnterX],House[id][EnterY],House[id][EnterZ])) return SCM(playerid,COLOR_RED,"Niste blizu nijedne kuce!");
        House[id][Money] += House[id][RentPrice];
        GivePlayerMoney(playerid, -House[id][RentPrice]);
        format(House[id][Player_Rent],48,"%s",GetName(playerid));
		format(string,sizeof(string),"{E0BC1B}You owe rent for House $%d",House[id][RentPrice]);
        SCM(playerid,-1,string);
        CheckHouse(id);
        }
		else return SCM(playerid,COLOR_RED,"Somebody already rented this house.");
		return 1;
}
YCMD:unrenthouse(playerid, params[], help)
{
        #pragma unused help
        #pragma unused params
        new id = GetClosetHouseID(playerid);
        if(id == -1) return SCM(playerid,COLOR_RED,"EROR: "COL_WHITE"There is no house.");
		if(strcmp(House[id][Owner],"Apartment", false ) == 0)
		{
		SCM(playerid,COLOR_RED,"This house does not have an owner.");
		return 1;
		}
		if(strcmp(House[id][Player_Rent],GetName(playerid), false ) == 0)
		{
		if(!IsPlayerInRangeOfPoint(playerid,5.0,House[id][EnterX],House[id][EnterY],House[id][EnterZ])) return SCM(playerid,COLOR_RED,"Niste blizu nijedne kuce!");
        format(House[id][Player_Rent],48,"Nobody");
        SCM(playerid,-1,"You are unrent house");
        CheckHouse(id);
        }
		else return SCM(playerid,COLOR_RED,"EROR:"COL_WHITE" You don't rent this house.");
		return 1;
}
YCMD:hdeposit(playerid, params[], help)
{
        #pragma unused help
        #pragma unused params
        new id = Player[playerid][Houseid];
        if(id == 999) return SCM(playerid,COLOR_RED,"EROR: "COL_WHITE"You don't have a house.");
        new string[128],money;
		if(!IsPlayerInRangeOfPoint(playerid,5.0,House[id][ExitX],House[id][ExitY],House[id][ExitZ])) return SCM(playerid,COLOR_RED,"You are not at right position!");
		if(sscanf(params, "i",money)) return SCM(playerid, COLOR_RED, "Usage: /hdeposit [Money]");
		if(money > GetPlayerMoney(playerid)) return SCM(playerid, COLOR_RED, "You don't have that kind of money.");
		if(money < 1) return SCM(playerid, COLOR_RED, "Money can't be less then 1");
        House[id][Money] += money;
        GivePlayerMoney(playerid, -money);
		format(string,sizeof(string),"{E0BC1B}You have put in the safe $%d.Now you have $%d",money,House[id][Money]);
        SCM(playerid,-1,string);
        CheckHouse(id);
		return 1;
}
YCMD:hwithdraw(playerid, params[], help)
{
        #pragma unused help
        #pragma unused params
        new id = Player[playerid][Houseid];
        if(id == 999) return SCM(playerid,COLOR_RED,"EROR: "COL_WHITE"You don't have a house.");
        new string[128],money;
		if(!IsPlayerInRangeOfPoint(playerid,5.0,House[id][ExitX],House[id][ExitY],House[id][ExitZ])) return SCM(playerid,COLOR_RED,"You are not in your house!");
		if(sscanf(params, "i",money)) return SCM(playerid, COLOR_RED, "Usage: /hwithdraw [Money]");
		if(money > House[id][Money]) return SCM(playerid, COLOR_RED, "You Don't have this sum of money.");
		if(money < 1) return SCM(playerid, COLOR_RED, "Money can't be less then 1");
        House[id][Money] -= money;
        GivePlayerMoney(playerid, money);
		format(string,sizeof(string),""COL_YELLOW"You are take from safe"COL_GREEN"$%d"COL_YELLOW".Now there is "COL_GREEN"$%d",money,House[id][Money]);
        SCM(playerid,-1,string);
        CheckHouse(id);
		return 1;
}
YCMD:hputgun(playerid, params[], help)
{
        #pragma unused help
        #pragma unused params
       new id = Player[playerid][Houseid];
        if(id == 999) return SCM(playerid,COLOR_RED,"EROR: "COL_WHITE"You don't have a house.");
        new string[128],slot,ammo;
		if(!IsPlayerInRangeOfPoint(playerid,30.0,House[id][ExitX],House[id][ExitY],House[id][ExitZ])) return SCM(playerid,COLOR_RED,"You are not at right position!");
		if(sscanf(params, "ii",slot,ammo)) return SCM(playerid, COLOR_RED, "Usage: /hputgun [Slot 1/2] [Ammo]");
		if(ammo > GetPlayerAmmo(playerid)) return SCM(playerid, COLOR_RED, "You don't have that much ammo.");
		if(ammo < 1) return SCM(playerid, COLOR_RED, "Ammo can't be less then 1");
		if(slot == 1)
		{
		if(House[id][Gun1] != 0) return SCM(playerid,COLOR_RED,"EROR: "COL_WHITE"There is already gun on this slot.");
        House[id][Gun1] = GetPlayerWeapon(playerid);
        House[id][Ammo1] = ammo;
        SetPlayerAmmo(playerid,GetPlayerWeapon(playerid),GetPlayerAmmo(playerid)-ammo);
		format(string,sizeof(string),"{E0BC1B}You have put gun on slot 1.With %d ammo",ammo);
        SCM(playerid,-1,string);
        CheckHouse(id);
        }
		if(slot == 2)
		{
		if(House[id][Gun2] != 0) return SCM(playerid,COLOR_RED,"EROR: "COL_WHITE"There is already gun on this slot.");
        House[id][Gun2] = GetPlayerWeapon(playerid);
        House[id][Ammo2] = ammo;
        SetPlayerAmmo(playerid,GetPlayerWeapon(playerid),GetPlayerAmmo(playerid)-ammo);
		format(string,sizeof(string),"{E0BC1B}You have put gun on slot 2.With %d ammo",ammo);
        SCM(playerid,-1,string);
        CheckHouse(id);
        }
		return 1;
}
YCMD:htakegun(playerid, params[], help)
{
        #pragma unused help
        #pragma unused params
       	new id = Player[playerid][Houseid];
        if(id == 999) return SCM(playerid,COLOR_RED,"EROR: "COL_WHITE"You don't have a house.");
		if(!IsPlayerInRangeOfPoint(playerid,5.0,House[id][ExitX],House[id][ExitY],House[id][ExitZ])) return SCM(playerid,COLOR_RED,"You are not in your house!");
        new string[128],slot,ammo;
		if(!IsPlayerInRangeOfPoint(playerid,5.0,House[id][ExitX],House[id][ExitY],House[id][ExitZ])) return SCM(playerid,COLOR_RED,"You are not at right position!");
		if(sscanf(params, "ii",slot,ammo)) return SCM(playerid, COLOR_RED, "Usage: /htakegun [Slot 1/2] [Ammo]");
		if(ammo < 1) return SCM(playerid, COLOR_RED, "Ammo can't be less then 1");
		if(slot == 1)
		{
		if(House[id][Gun1] == 0) return SCM(playerid,COLOR_RED,"EROR: "COL_WHITE"There is no gun on this slot.");
		if(ammo > House[id][Ammo1]) return SCM(playerid, COLOR_RED, "EROR:"COL_WHITE" In the safe does not have that much ammo.");
		GivePlayerWeapon(playerid,House[id][Gun1],ammo);
		House[id][Ammo1] -= ammo;
		if(House[id][Ammo1] == 0) {House[id][Gun1] = 0;}
		format(string,sizeof(string),"{E0BC1B}You are take gun from slot 1.With %d ammo",ammo);
        SCM(playerid,-1,string);
        CheckHouse(id);
        }
		if(slot == 2)
		{
		if(House[id][Gun2] == 0) return SCM(playerid,COLOR_RED,"EROR: "COL_WHITE"There is no gun on this slot.");
		if(ammo > House[id][Ammo2]) return SCM(playerid, COLOR_RED, "EROR:"COL_WHITE" In the safe does not have that much ammo.");
		GivePlayerWeapon(playerid,House[id][Gun2],ammo);
		House[id][Ammo2] -= ammo;
		if(House[id][Ammo2] == 0) {House[id][Gun2] = 0;}
		format(string,sizeof(string),"{E0BC2B}You have taken gun from slot 2.With %d ammo",ammo);
        SCM(playerid,-1,string);
        CheckHouse(id);
        }
		return 1;
}
YCMD:checksafe(playerid, params[], help)
{
        #pragma unused help
        #pragma unused params
       	new h = Player[playerid][Houseid];
        if(h == 999) return SCM(playerid,COLOR_RED,"EROR: "COL_WHITE"You don't have a house.");
        new string[128];
		format(string,sizeof(string),""COL_YELLOW"Money"COL_GREEN" $%d",House[h][Money]);
		format(string,sizeof(string),""COL_YELLOW"Slot 1 | Gun:"COL_GREEN" %d "COL_YELLOW"| Ammo:"COL_GREEN" %d",House[h][Gun1],House[h][Ammo1]);
		format(string,sizeof(string),""COL_YELLOW"Slot 2 | Gun:"COL_GREEN" %d "COL_YELLOW"| Ammo:"COL_GREEN" %d",House[h][Gun2],House[h][Ammo2]);
        SCM(playerid,-1,string);
		return 1;
}
YCMD:knock(playerid, params[], help)
{
		#pragma unused params
  		#pragma unused help
		 new i = GetClosetHouseID(playerid), string[128];
		 if(i == -1) return SCM(playerid,COLOR_RED,"EROR: "COL_WHITE"There is no house.");
				if (IsPlayerInRangeOfPoint(playerid,5.0,House[i][EnterX], House[i][EnterY], House[i][EnterZ]))
				{
                    format(string, sizeof(string), "* %s knocks on the door.", GetName(playerid));
					ProxDetector(playerid, string, COLOR_PURPLE,30);
					foreach (Player, p)
					{
					    if (IsPlayerInRangeOfPoint(p,5.0,House[i][ExitX], House[i][ExitY], House[i][ExitZ]))
					    {
					        SendClientMessage(p, COLOR_PURPLE, "* Somebody has knocked on the door.");
					    }
					}
				}
		return 1;
}
YCMD:lockdoor(playerid, params[], help)
{
		#pragma unused params
  		#pragma unused help
       	new h = Player[playerid][Houseid];
        if(h == 999) return SCM(playerid,COLOR_RED,"EROR: "COL_WHITE"You don't have a house.");
		if(House[h][Lock] == 1) return SCM(playerid,COLOR_RED,"EROR: "COL_WHITE"House is already locked.");
		if(!IsPlayerInRangeOfPoint(playerid,3.0,House[h][EnterX],House[h][EnterY],House[h][EnterZ])) return SCM(playerid,COLOR_RED,"EROR: "COL_WHITE"You are not near your house");
		Choose[playerid] = 1;
		TextDrawSetString(LockTD3[playerid],"~r~1 ~w~2 3~n~4 5 6~n~7 8 9~n~  0");
		TextDrawShowForPlayer(playerid,LockTD0[playerid]);
		TextDrawShowForPlayer(playerid,LockTD1[playerid]);
		TextDrawShowForPlayer(playerid,LockTD2[playerid]);
		TextDrawShowForPlayer(playerid,LockTD3[playerid]);
		TextDrawShowForPlayer(playerid,LockTD4[playerid]);
		TextDrawShowForPlayer(playerid,LockTD5[playerid]);
		TextDrawShowForPlayer(playerid,LockTD6[playerid]);
		TogglePlayerControllable(playerid,false);
		format(TypeText[playerid],5,"");
		TextDrawSetString(LockTD2[playerid],TypeText[playerid]);
		TextDrawSetString(LockTD4[playerid],"~w~Enter  Close");
		return 1;
}
YCMD:unlockdoor(playerid, params[], help)
{
		#pragma unused params
  		#pragma unused help
       	new h = Player[playerid][Houseid];
        if(h == 999) return SCM(playerid,COLOR_RED,"EROR: "COL_WHITE"You don't have a house.");
        if(!IsPlayerInRangeOfPoint(playerid,3.0,House[h][EnterX],House[h][EnterY],House[h][EnterZ])) return SCM(playerid,COLOR_RED,"EROR: "COL_WHITE"You are not near your house");
		House[h][Lock] = 0;
		SCM(playerid,-1,"Now your door is unlocked.");
		return 1;
}
YCMD:enter(playerid, params[], help)
{
		#pragma unused params
  		#pragma unused help
        new h = GetClosetHouseID(playerid);
        if(h == -1) return SCM(playerid,COLOR_RED,"EROR: "COL_WHITE"There is no house.");
		if(House[h][On_Sell] == 0 && House[h][Lock] == 0)
		{
  			SetPlayerPos(playerid,House[h][ExitX],House[h][ExitY],House[h][ExitZ]);
  			SetPlayerInterior(playerid,House[h][IntID]);
  			SetPlayerVirtualWorld(playerid,House[h][VW]);
		}
		else return SCM(playerid,COLOR_RED,"EROR: "COL_WHITE"House is locked/Is not on sale.");
		if(strcmp(House[h][Owner],GetName(playerid),false) == 0)
		{
		new Year, Month, Day;
		getdate(Year, Month, Day);
		House[h][DayEnter] = Day;
	 	House[h][MonthEnter] = Month;
		CheckHouse(h);
		}
		return 1;
}
YCMD:exit(playerid, params[], help)
{
		#pragma unused params
  		#pragma unused help
        new h = GetClosetHouseIntID(playerid);
        if(h == -1) return SCM(playerid,COLOR_RED,"EROR: "COL_WHITE"There is no house.");
		SetPlayerPos(playerid,House[h][EnterX],House[h][EnterY],House[h][EnterZ]);
		SetPlayerInterior(playerid,0);
		SetPlayerVirtualWorld(playerid,0);
		return 1;
}
YCMD:payrent(playerid, params[], help)
{
		#pragma unused params
  		#pragma unused help
        new h = GetClosetHouseID(playerid),string[128];
        if(h == -1) return SCM(playerid,COLOR_RED,"EROR: "COL_WHITE"There is no house.");
		if(strcmp(House[h][Player_Rent],GetName(playerid), false ) == 0)
		{
		if(House[h][RentPrice] > GetPlayerMoney(playerid)) return SCM(playerid,COLOR_RED,"EROR: "COL_WHITE"You don't have that kind of money..");
		House[h][Money] += House[h][RentPrice];
		GivePlayerMoney(playerid,-House[h][RentPrice]);
		format(string,128,"You have pay "COL_GREEN"$%d "COL_WHITE"for rent",House[h][RentPrice]);
		SCM(playerid,-1,string);
		}
		else return SCM(playerid,COLOR_RED,"EROR: "COL_WHITE"You aren't owner of this house");
		return 1;
}
YCMD:hcar(playerid, params[], help)
{
        #pragma unused help
        if(!IsPlayerAdmin(playerid)) return SCM(playerid, COLOR_RED, "You must be RCON admin");
        new
			Float:Pos[4],id,vehicle,color[2],string[32];
        if(sscanf(params, "iiii",id,vehicle,color[0],color[1])) return SCM(playerid, COLOR_RED, "Usage:"COL_WHITE" /hcar [House ID] [Vehicle ID] [Color1] [Color2]");
        if(id >= MAX_HOUSE) return SCM(playerid, COLOR_RED, "EROR: "COL_WHITE"Try again. You have typed the wrong house id.");
        format(string, sizeof(string), House_File, id);
		if(fexist(string))
		{
		GetPlayerPos(playerid,Pos[0],Pos[1],Pos[2]);
		GetPlayerFacingAngle(playerid,Pos[3]);
		House[id][hCar] = AddStaticVehicleEx(vehicle,Pos[0],Pos[1]+1,Pos[2],Pos[3],color[0],color[1],3600);
		House[id][hCarX] = Pos[0];
		House[id][hCarY] = Pos[1];
		House[id][hCarZ] = Pos[2];
		House[id][hCarA] = Pos[3];
		House[id][hCarC1] = color[0];
		House[id][hCarC2] = color[1];
		House[id][hCarID] = vehicle;
		CheckHouse(id);
    	}
		return 1;
}
YCMD:findmycar(playerid, params[], help)
{
        #pragma unused help
        #pragma unused params
        new
			Float:Pos[4];
       	new id = Player[playerid][Houseid];
        if(id == 999) return SCM(playerid,COLOR_RED,"EROR: "COL_WHITE"You don't have a house.");
        GetVehiclePos(House[id][hCar],Pos[0],Pos[1],Pos[2]);
        SetPlayerCheckpoint(playerid,Pos[0],Pos[1],Pos[2],5.0);
        SCM(playerid,-1,"Your car is marked on map.");
		return 1;
}
YCMD:hupgrade(playerid, params[], help)
{
        #pragma unused help
        #pragma unused params
    	new h = Player[playerid][Houseid];
        if(h == 999) return SCM(playerid,COLOR_RED,"EROR: "COL_WHITE"You don't have a house.");
        if(!IsPlayerInRangeOfPoint(playerid,3.0,House[h][ExitX],House[h][ExitY],House[h][ExitZ])) return SCM(playerid,COLOR_RED,"EROR: "COL_WHITE"You are not near your house");
		if(ChooseInt[playerid] == 0)
		{
		HouseID1[playerid] = h;
		ChooseInt[playerid] = 1;
		SetPlayerPos(playerid,2496.049804,-1695.238159,1014.742187);
		SetPlayerInterior(playerid,3);
		SetPlayerVirtualWorld(playerid,0);
		TextDrawSetString(hUp[playerid],"  House Upgrade~n~~n~~r~< ~w~Price: ~g~$20000 ~r~>");
		TextDrawShowForPlayer(playerid,hUp[playerid]);
		}
		else
		{
		ChooseInt[playerid] = 0;
		SetPlayerPos(playerid,House[HouseID1[playerid]][ExitX],House[HouseID1[playerid]][ExitY],House[HouseID1[playerid]][ExitZ]);
		SetPlayerInterior(playerid,House[HouseID1[playerid]][IntID]);
		TextDrawHideForPlayer(playerid,hUp[playerid]);
		}
		return 1;
}
//=====House car storage
YCMD:hcarwithdraw(playerid, params[], help)
{
        #pragma unused help
        #pragma unused params
        new houseid = 0,string[128];
       	new i = Player[playerid][Houseid];
        if(i == 999) return SCM(playerid,COLOR_RED,"EROR: "COL_WHITE"You don't have a house.");
		if(House[i][hCarID] > 0)
		{
		new Float:Pos[3]; GetVehiclePos(House[i][hCar],Pos[0],Pos[1],Pos[2]);
		if(!IsPlayerInRangeOfPoint(playerid,10.0,Pos[0],Pos[1],Pos[2])) return SCM(playerid,COLOR_RED,"EROR: "COL_WHITE"You are not near your house car.");
		houseid = i;
        new money;
		if(sscanf(params, "i",money)) return SCM(playerid, COLOR_RED, "Usage: /hcarwithdraw [Money]");
		if(money > GetPlayerMoney(playerid)) return SCM(playerid, COLOR_RED, "You don't have that kind of money.");
		if(money < 1) return SCM(playerid, COLOR_RED, "Money can't be less then 1");
        House[houseid][hCarMoney] += money;
        GivePlayerMoney(playerid, -money);
		format(string,sizeof(string),"{E0BC1B}You have put in car $%d.Now you have $%d",money,House[houseid][hCarMoney]);
        SCM(playerid,-1,string);
        CheckHouse(houseid);
        }
		return 1;
}
YCMD:hcardeposit(playerid, params[], help)
{
        #pragma unused help
        #pragma unused params
        new houseid = 0,string[128];
       	new i = Player[playerid][Houseid];
        if(i == 999) return SCM(playerid,COLOR_RED,"EROR: "COL_WHITE"You don't have a house.");
		if(House[i][hCarID] > 0)
		{
		new Float:Pos[3]; GetVehiclePos(House[i][hCar],Pos[0],Pos[1],Pos[2]);
		if(!IsPlayerInRangeOfPoint(playerid,10.0,Pos[0],Pos[1],Pos[2])) return SCM(playerid,COLOR_RED,"EROR: "COL_WHITE"You are not near your house car.");
        new money;
		if(sscanf(params, "i",money)) return SCM(playerid, COLOR_RED, "Usage: /hcardeposit [Money]");
		if(money > GetPlayerMoney(playerid)) return SCM(playerid, COLOR_RED, "You don't have that kind of money.");
		if(money < 1) return SCM(playerid, COLOR_RED, "Money can't be less then 1");
        House[houseid][hCarMoney] -= money;
        GivePlayerMoney(playerid, money);
		format(string,sizeof(string),"{E0BC1B}You have taken car storage $%d.Now you have $%d",money,House[houseid][hCarMoney]);
        SCM(playerid,-1,string);
        CheckHouse(houseid);
        }
		return 1;
}
YCMD:hcarputgun(playerid, params[], help)
{
        #pragma unused help
        #pragma unused params
        new houseid = 0,string[128];
       	new id = Player[playerid][Houseid];
        if(id == 999) return SCM(playerid,COLOR_RED,"EROR: "COL_WHITE"You don't have a house.");
		if(House[id][hCarID] > 0)
		{
		new Float:Pos[3]; GetVehiclePos(House[id][hCar],Pos[0],Pos[1],Pos[2]);
		if(!IsPlayerInRangeOfPoint(playerid,10.0,Pos[0],Pos[1],Pos[2])) return SCM(playerid,COLOR_RED,"EROR: "COL_WHITE"You are not near your house car.");
        new slot,ammo;
		if(sscanf(params, "ii",slot,ammo)) return SCM(playerid, COLOR_RED, "Usage: /hcarputgun [Slot 1/2] [Ammo]");
		if(ammo > GetPlayerAmmo(playerid)) return SCM(playerid, COLOR_RED, "You don't have that much ammo.");
		if(ammo < 1) return SCM(playerid, COLOR_RED, "Ammo can't be less then 1");
		if(slot == 1)
		{
		if(House[houseid][hCarGun1] != 0) return SCM(playerid,COLOR_RED,"EROR: "COL_WHITE"There is already gun on this slot.");
        House[houseid][hCarGun1] = GetPlayerWeapon(playerid);
        House[houseid][hCarAmmo1] = ammo;
        SetPlayerAmmo(playerid,GetPlayerWeapon(playerid),GetPlayerAmmo(playerid)-ammo);
		format(string,sizeof(string),"{E0BC1B}You have put gun on slot 1.With %d ammo",ammo);
        SCM(playerid,-1,string);
        CheckHouse(id);
        }
		if(slot == 2)
		{
		if(House[houseid][hCarGun1] != 0) return SCM(playerid,COLOR_RED,"EROR: "COL_WHITE"There is already gun on this slot.");
        House[houseid][hCarGun2] = GetPlayerWeapon(playerid);
        House[houseid][hCarAmmo2] = ammo;
        SetPlayerAmmo(playerid,GetPlayerWeapon(playerid),GetPlayerAmmo(playerid)-ammo);
		format(string,sizeof(string),"{E0BC1B}You have put gun on slot 2.With %d ammo",ammo);
        SCM(playerid,-1,string);
        CheckHouse(id);
        }
        }
		return 1;
}
YCMD:hcartakegun(playerid, params[], help)
{
        #pragma unused help
        #pragma unused params
        new houseid = 0,string[128];
       	new id = Player[playerid][Houseid];
        if(id == 999) return SCM(playerid,COLOR_RED,"EROR: "COL_WHITE"You don't have a house.");
		if(House[id][hCarID] > 0)
		{
		new Float:Pos[3]; GetVehiclePos(House[id][hCar],Pos[0],Pos[1],Pos[2]);
		if(!IsPlayerInRangeOfPoint(playerid,10.0,Pos[0],Pos[1],Pos[2])) return SCM(playerid,COLOR_RED,"EROR: "COL_WHITE"You are not near your house car.");
        new slot,ammo;
		if(sscanf(params, "ii",slot,ammo)) return SCM(playerid, COLOR_RED, "Usage: /htakegun [Slot 1/2] [Ammo]");
		if(ammo < 1) return SCM(playerid, COLOR_RED, "Ammo can't be less then 1");
		if(slot == 1)
		{
		if(House[houseid][hCarGun1] == 0) return SCM(playerid,COLOR_RED,"EROR: "COL_WHITE"There is no gun on this slot.");
		if(ammo > House[houseid][hCarAmmo1]) return SCM(playerid, COLOR_RED, "EROR:"COL_WHITE" In the safe does not have that much ammo.");
		GivePlayerWeapon(playerid,House[houseid][hCarGun1],ammo);
		House[houseid][hCarAmmo1] -= ammo;
		if(House[houseid][hCarAmmo1] == 0) {House[houseid][hCarGun1] = 0;}
		format(string,sizeof(string),"{E0BC1B}You are take gun from slot 1.With %d ammo",ammo);
        SCM(playerid,-1,string);
        CheckHouse(id);
        }
		if(slot == 2)
		{
		if(House[houseid][hCarGun2] == 0) return SCM(playerid,COLOR_RED,"EROR: "COL_WHITE"There is no gun on this slot.");
		if(ammo > House[houseid][hCarAmmo2]) return SCM(playerid, COLOR_RED, "EROR:"COL_WHITE" In the safe does not have that much ammo.");
		GivePlayerWeapon(playerid,House[houseid][hCarGun2],ammo);
		House[houseid][hCarAmmo2] -= ammo;
		if(House[houseid][hCarAmmo2] == 0) {House[houseid][hCarGun2] = 0;}
		format(string,sizeof(string),"{E0BC2B}You have taken gun from slot 2.With %d ammo",ammo);
        SCM(playerid,-1,string);
        CheckHouse(id);
        }
        }
		return 1;
}
YCMD:hcarpark(playerid, params[], help)
{
        #pragma unused help
        #pragma unused params
		if(!IsPlayerInAnyVehicle(playerid)) return SCM(playerid,COLOR_RED,"EROR: "COL_WHITE"You must be in a vehicle");
        new hid,Float:Pos[4];
        GetPlayerPos(playerid,Pos[0],Pos[1],Pos[2]);
        GetPlayerFacingAngle(playerid,Pos[3]);
       	new id = Player[playerid][Houseid];
        if(id == 999) return SCM(playerid,COLOR_RED,"EROR: "COL_WHITE"You don't have a house.");
		if(House[id][hCar] > 0)
		{
		if(House[id][hCar] != GetPlayerVehicleID(playerid)) return SCM(playerid,COLOR_RED,"EROR: "COL_WHITE"This is not your car.");
	    House[hid][hCarX] = Pos[0];
	    House[hid][hCarY] = Pos[1];
	    House[hid][hCarZ] = Pos[2];
	    House[hid][hCarA] = Pos[3];
	    GameTextForPlayer(playerid,"Car ~r~parked",3000,0);
        CheckHouse(hid);
        }
		return 1;
}
YCMD:hcarcolor(playerid, params[], help)
{
        #pragma unused help
        #pragma unused params
        if(!IsPlayerInAnyVehicle(playerid)) return SCM(playerid,COLOR_RED,"EROR: "COL_WHITE"You must be in a vehicle");
        new id = GetPlayerVehicleID(playerid),hid,C[2];
     	new i = Player[playerid][Houseid];
        if(i == 999) return SCM(playerid,COLOR_RED,"EROR: "COL_WHITE"You don't have a house.");
		if(House[i][hCarID] > 0)
		{
		if(House[i][hCar] != GetPlayerVehicleID(playerid)) return SCM(playerid,COLOR_RED,"EROR: "COL_WHITE"This is not your car.");
        hid = i;
		if(sscanf(params,"ii",C[0],C[1])) return SCM(playerid,COLOR_RED,"Usage: "COL_WHITE"/hcarcolor [Color 1] [Color 2]");
	    House[hid][hCarC1] = C[0];
	    House[hid][hCarC2] = C[1];
	    ChangeVehicleColor(id,House[hid][hCarC1],House[hid][hCarC2]);
	    GameTextForPlayer(playerid,"Car color changed",3000,0);
        CheckHouse(hid);
        }
		return 1;
}
YCMD:hphone(playerid, params[], help)
{
        #pragma unused help
        #pragma unused params
        new id = Player[playerid][Houseid];
		if(id == 999) return SCM(playerid,COLOR_RED,"EROR: "COL_WHITE"You don't have a house");
		if(!IsPlayerInRangeOfPoint(playerid,3.0,House[id][ExitX],House[id][ExitY],House[id][ExitZ])) return SCM(playerid,COLOR_RED,"EROR: "COL_WHITE"You are not near your house");
		TogglePlayerControllable(playerid,false);
		PhoneChoose[playerid] = 1;
		TextDrawSetString(Phone1[playerid],"~y~1 2 3~n~4 5 6~n~7 8 9~n~~g~~g~C ~w~0 ~r~H");
		TextDrawSetString(Phone4[playerid],"");
		TextDrawShowForPlayer(playerid,Phone0[playerid]);
		TextDrawShowForPlayer(playerid,Phone1[playerid]);
		TextDrawShowForPlayer(playerid,Phone2[playerid]);
		TextDrawShowForPlayer(playerid,Phone3[playerid]);
		TextDrawShowForPlayer(playerid,Phone4[playerid]);
		TextDrawShowForPlayer(playerid,Phone5[playerid]);
		return 1;
}
YCMD:answeronphone(playerid, params[], help)
{
        #pragma unused help
        #pragma unused params
		if(CallFrom[playerid] != 999 && Calling[CallFrom[playerid]] > 0)
	        {
	            TalkWith[playerid] = CallFrom[playerid];
	            TalkWith[CallFrom[playerid]] = playerid;
	            SCM(playerid,-1,"Somebody has answer the phone");
	            Calling[CallFrom[playerid]] = 0;
	            CallFrom[playerid] = 999;
	        }
		return 1;
}
YCMD:changespawn(playerid, params[], help)
{
        #pragma unused help
        #pragma unused params
    	new id = Player[playerid][Houseid];
		if(id == 999) return SCM(playerid,COLOR_RED,"EROR: "COL_WHITE"You don't have a house");
		if(!IsPlayerInRangeOfPoint(playerid,3.0,House[id][ExitX],House[id][ExitY],House[id][ExitZ])) return SCM(playerid,COLOR_RED,"EROR: "COL_WHITE"You must be in your house.");
		    Player[playerid][Spawn] = 1;
			Player[playerid][SpawnX] = House[id][ExitX];
			Player[playerid][SpawnY] = House[id][ExitY];
			Player[playerid][SpawnZ] = House[id][ExitZ];
			Player[playerid][SpawnInt] = House[id][IntID];
			Player[playerid][SpawnVW] = House[id][VW];
			SCM(playerid,-1,"Spawn has been changed to a specific location.");
		return 1;
}
YCMD:robhouse(playerid, params[], help)
{
        #pragma unused help
        #pragma unused params
		new id = GetClosetHouseID(playerid),password[5],string[128];
		if(id == -1) return SCM(playerid,-1,"There is no house");
		if(Player[playerid][RobHouse] > 0) return SCM(playerid,-1,"You are already robhouse");
		if(sscanf(params,"s[5]",password)) return SCM(playerid,-1,"Usage: /robhouse [Password]");
		if(strcmp(House[id][LockPass],password,false) == 0)
		{
		    if(House[id][Money] == 0)return SCM(playerid,-1,"There is no money in the house or safe.");
		    Player[playerid][RobHouse] = 3600;
		    GivePlayerMoney(playerid,House[id][Money]/2);
		    House[id][Money] -= House[id][Money]/2;
			format(string,128,"You have robbed a house and taken $%d",House[id][Money]/2);
			SCM(playerid,-1,string);
		}
		else return SCM(playerid,-1,"Wrong password");
		return 1;
}
//Update 1.2
YCMD:givekey(playerid, params[], help)
{
        #pragma unused help
        new string[170],id;
        new i = Player[playerid][Houseid];
 		if(Player[playerid][Houseid] == 999) return SCM(playerid,COLOR_RED,"EROR: "COL_WHITE"You don't have a house");
		if(sscanf(params,"u",id))return SCM(playerid,COLOR_RED,"Usage: "COL_WHITE"/givekey [Player ID/Part of name]");
		if(id == INVALID_PLAYER_ID) return SCM(playerid, COLOR_RED, "EROR: "COL_WHITE"Invalid player id.");
		if(Player[id][Houseid] != 999) return SCM(playerid, COLOR_RED, "EROR: "COL_WHITE"That player already has a house.");
		format(House[i][Owner], 32, "%s", GetName(id));
		Player[id][Houseid] = Player[playerid][Houseid];
		Player[playerid][Houseid] = 999;
		Player[id][Houseid] = Player[playerid][Houseid];
		CheckHouse(i);
		format(string,sizeof(string),"{E0BC1B}Owner: "COL_WHITE"%s\n{E0BC1B}House name: "COL_WHITE"%s\n{E0BC1B}Price: "COL_WHITE"%d\n{E0BC1B}Level: "COL_WHITE"%d\n{E0BC1B}Rent price: "COL_WHITE"%d\n{E0BC1B}Address: "COL_WHITE"%s\n (/renthouse)",House[i][Owner],House[i][HouseName],House[i][Price],House[i][Level],House[i][RentPrice],House[i][Address]);
        UpdateDynamic3DTextLabelText(House[i][DLabel],-1,string);
        UpdatePlayerInformation(playerid);
		return 1;
}
YCMD:myhouse(playerid, params[], help)
{
        #pragma unused help
        #pragma unused params
        new i = Player[playerid][Houseid];
 		if(Player[playerid][Houseid] == 999) return SCM(playerid,COLOR_RED,"EROR: "COL_WHITE"You don't have a house");
		SetPlayerCheckpoint(playerid,House[i][EnterX],House[i][EnterY],House[i][EnterZ],2.0);
		PlayerCP[playerid] = 1;
		SendFormatMSG(playerid,-1,"Your house address is %s.House is marked on map",House[i][Address]);
		return 1;
}
//==========Stock
stock CreateSaveHouse(name[],id,price,level,vw,Float:PosX,Float:PosY,Float:PosZ)
{
		new dFile[32],string[200],number = randomEx(1000,9999);
		new zone[48];
		new Year, Month, Day;
		getdate(Year, Month, Day);
		GetHouse2DZone(id, zone, 48);
		format(dFile, 35, House_File, id);

		new
			INI:File = INI_Open(dFile);

    		INI_WriteFloat(File, "EnterX", PosX);
    		INI_WriteFloat(File, "EnterY", PosY);
    		INI_WriteFloat(File, "EnterZ", PosZ);
    		INI_WriteFloat(File, "ExitX", 223.42928466797);
    		INI_WriteFloat(File, "ExitY", 1287.3064941406);
    		INI_WriteFloat(File, "ExitZ", 1082.14);
    		INI_WriteString(File, "HouseName", name);
    		INI_WriteString(File, "Owner", "Apartment");
    		INI_WriteInt(File, "Price", price);
    		INI_WriteInt(File, "Level", level);
    		INI_WriteInt(File, "Interior", 1);
    		INI_WriteInt(File, "VW", vw);
    		INI_WriteInt(File, "On_Sell", 1);
    		INI_WriteInt(File, "Lock", 0);
    		INI_WriteInt(File, "RentPrice", 100);
    		INI_WriteString(File, "PlayerRent", "Nobody");
    		INI_WriteInt(File, "Money", 0);
    		INI_WriteInt(File, "Gun1", 0);
    		INI_WriteInt(File, "Gun2", 0);
    		INI_WriteInt(File, "Ammo1", 0);
    		INI_WriteInt(File, "Ammo2", 0);
    		INI_WriteString(File, "LockPass", "1111");
    		INI_WriteFloat(File, "hCarX", 0);
    		INI_WriteFloat(File, "hCarY", 0);
    		INI_WriteFloat(File, "hCarZ", 0);
    		INI_WriteFloat(File, "hCarA", 0);
    		INI_WriteInt(File, "hCarC1", 0);
    		INI_WriteInt(File, "hCarC2", 0);
    		INI_WriteInt(File, "hCarID", 0);
    		INI_WriteInt(File, "hCarMoney",0);
    		INI_WriteInt(File, "hCarGun1",0);
    		INI_WriteInt(File, "hCarGun2",0);
    		INI_WriteInt(File, "hCarAmmo1", 0);
    		INI_WriteInt(File, "hCarAmmo2", 0);
    		format(string,sizeof(string),"%d",number);
    		INI_WriteString(File, "PhoneNum", string);
    		format(string,sizeof(string),"%s %d",zone,id);
    		INI_WriteString(File, "Address", string);
    		INI_WriteInt(File, "DayEnter", Day);
    		INI_WriteInt(File, "MonthEnter", Month);
    		
    		INI_Close(File);

            House[id][EnterX] = PosX;
            House[id][EnterY] = PosY;
            House[id][EnterZ] = PosZ;
            House[id][ExitX] = 223.42928466797;
            House[id][ExitY] = 1287.3064941406;
            House[id][ExitZ] = 1082.14;
			format(House[id][HouseName],48,"%s",name);
            format(House[id][Owner],48,"Apartment");
            House[id][Price] = price;
            House[id][Level] = level;
            House[id][IntID] = 1;
            House[id][VW] = vw;
            House[id][On_Sell] = 1;
            House[id][Lock] = 0;
            House[id][RentPrice] = 100;
            format(House[id][Player_Rent],48,"Nobody");
            House[id][Money] = 0;
            House[id][Gun1] = 0;
            House[id][Gun2] = 0;
            House[id][Ammo1] = 0;
            House[id][Ammo2] = 0;
            format(House[id][LockPass],48,"1111");
            House[id][hCarX] = 0;
            House[id][hCarY] = 0;
            House[id][hCarZ] = 0;
            House[id][hCarA] = 0;
            House[id][hCarC1] = 0;
            House[id][hCarC2] = 0;
            House[id][hCarID] = 0;
            House[id][hCarMoney] = 0;
            House[id][hCarGun1] = 0;
            House[id][hCarGun2] = 0;
            House[id][hCarAmmo1] = 0;
            House[id][hCarAmmo2] = 0;
            format(House[id][PhoneNum],5,"%d",number);
            format(House[id][Address],32,"%s %d",zone,id);
            House[id][DayEnter] = Day;
            House[id][MonthEnter] = Month;
            
    		House[id][PickupU] = CreateDynamicPickup(1273, 23,  PosX,PosY,PosZ,-1,-1,-1,100.0);
    		format(string,sizeof(string),"{29CC3F}Owner: "COL_WHITE"Apartment\n{29CC3F}House name: "COL_WHITE"%s\n{29CC3F}Price: "COL_WHITE"%d\n{29CC3F}Level: "COL_WHITE"%d\n{29CC3F}Address: "COL_WHITE"%s %d\n (/buyhouse)",name,price,level,zone,id);
    		House[id][DLabel] = CreateDynamic3DTextLabel(string, 0xFFFFFF,  PosX,PosY,PosZ, 100, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 0, -1, -1, -1, 100);
            House[id][Icon] = CreateDynamicMapIcon(PosX,PosY,PosZ, 31, 0, -1, -1, -1, 100.0);
}
stock CheckHouse(id)
{
		new dFile[32];
		format(dFile, 35, House_File, id);

		new
			INI:File = INI_Open(dFile);

    		INI_WriteFloat(File, "EnterX", House[id][EnterX]);
    		INI_WriteFloat(File, "EnterY", House[id][EnterY]);
    		INI_WriteFloat(File, "EnterZ", House[id][EnterZ]);
    		INI_WriteFloat(File, "ExitX", House[id][ExitX]);
    		INI_WriteFloat(File, "ExitY", House[id][ExitY]);
    		INI_WriteFloat(File, "ExitZ", House[id][ExitZ]);
    		INI_WriteString(File, "HouseName", House[id][HouseName]);
    		INI_WriteString(File, "Owner", House[id][Owner]);
    		INI_WriteInt(File, "Price", House[id][Price]);
    		INI_WriteInt(File, "Level", House[id][Level]);
    		INI_WriteInt(File, "Interior", House[id][IntID]);
    		INI_WriteInt(File, "VW", House[id][VW]);
    		INI_WriteInt(File, "On_Sell", House[id][On_Sell]);
    		INI_WriteInt(File, "Lock", House[id][Lock]);
    		INI_WriteInt(File, "RentPrice", House[id][RentPrice]);
    		INI_WriteString(File, "PlayerRent", House[id][Player_Rent]);
    		INI_WriteInt(File, "Money", House[id][Money]);
    		INI_WriteInt(File, "Gun1", House[id][Gun1]);
    		INI_WriteInt(File, "Gun2", House[id][Gun2]);
    		INI_WriteInt(File, "Ammo1", House[id][Ammo1]);
    		INI_WriteInt(File, "Ammo2", House[id][Ammo2]);
			INI_WriteString(File, "LockPass", House[id][LockPass]);
    		INI_WriteFloat(File, "hCarX", House[id][hCarX]);
    		INI_WriteFloat(File, "hCarY", House[id][hCarY]);
    		INI_WriteFloat(File, "hCarZ", House[id][hCarZ]);
    		INI_WriteFloat(File, "hCarA", House[id][hCarA]);
    		INI_WriteInt(File, "hCarC1", House[id][hCarC1]);
    		INI_WriteInt(File, "hCarC2", House[id][hCarC2]);
    		INI_WriteInt(File, "hCarID", House[id][hCarID]);
    		INI_WriteInt(File, "hCarMoney", House[id][hCarMoney]);
    		INI_WriteInt(File, "hCarGun1", House[id][hCarGun1]);
    		INI_WriteInt(File, "hCarGun2", House[id][hCarGun2]);
    		INI_WriteInt(File, "hCarAmmo1", House[id][hCarAmmo1]);
    		INI_WriteInt(File, "hCarAmmo2", House[id][hCarAmmo2]);
    		INI_WriteString(File, "PhoneNum", House[id][PhoneNum]);
    		INI_WriteString(File, "Address", House[id][Address]);
			INI_WriteInt(File, "DayEnter", House[id][DayEnter]);
			INI_WriteInt(File, "MonthEnter", House[id][MonthEnter]);
    		INI_Close(File);
}
stock ReadHouse(i)
{
	new string[200];
 	if(House[i][On_Sell] == 1)
    {
	format(string,sizeof(string),"{29CC3F}Owner: "COL_WHITE"Apartment\n{29CC3F}House name: "COL_WHITE"%s\n{29CC3F}Price: "COL_WHITE"%d\n{29CC3F}Level: "COL_WHITE"%d\n{29CC3F}Address: "COL_WHITE"%s\n (/buyhouse)",House[i][HouseName],House[i][Price],House[i][Level],House[i][Address]);
	House[i][DLabel] = CreateDynamic3DTextLabel(string, 0xFFFFFF, House[i][EnterX],House[i][EnterY],House[i][EnterZ], 100, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 0, -1, -1, -1, 100);
	House[i][PickupU] = CreateDynamicPickup(1273, 23,  House[i][EnterX],House[i][EnterY],House[i][EnterZ],-1,-1,-1,100.0);
    House[i][Icon] = CreateDynamicMapIcon(House[i][EnterX],House[i][EnterY],House[i][EnterZ], 31, 0, -1, -1, -1, 100.0);
   	if(House[i][hCarID] != 0)
	{
	    House[i][hCar] = AddStaticVehicleEx(House[i][hCarID],House[i][hCarX],House[i][hCarY],House[i][hCarZ],House[i][hCarA],House[i][hCarC1],House[i][hCarC2],3600);
        format(HouseOwner[House[i][hCar]],32,"%s",House[i][Owner]);
	}
	else if(House[i][hCarID] == 0)
	{
	House[i][hCar] = 0;
	}
	}
	else if(House[i][On_Sell] == 0)
	{
	format(string,sizeof(string),"{E0BC1B}Owner: "COL_WHITE"%s\n{E0BC1B}House name: "COL_WHITE"%s\n{E0BC1B}Price: "COL_WHITE"%d\n{E0BC1B}Level: "COL_WHITE"%d\n{E0BC1B}Rent price: "COL_WHITE"%d\n{E0BC1B}Address: "COL_WHITE"%s\n (/renthouse)",House[i][Owner],House[i][HouseName],House[i][Price],House[i][Level],House[i][RentPrice],House[i][Address]);
    House[i][DLabel] = CreateDynamic3DTextLabel(string, 0xFFFFFF,  House[i][EnterX],House[i][EnterY],House[i][EnterZ], 100, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 0, -1, -1, -1, 100);
	House[i][PickupU] = CreateDynamicPickup(1272, 23,  House[i][EnterX],House[i][EnterY],House[i][EnterZ],-1,-1,-1,100.0);
    House[i][Icon] = CreateDynamicMapIcon(House[i][EnterX],House[i][EnterY],House[i][EnterZ], 32, 0, -1, -1, -1, 100.0);
	if(House[i][hCarID] != 0)
	{
	    House[i][hCar] = AddStaticVehicleEx(House[i][hCarID],House[i][hCarX],House[i][hCarY],House[i][hCarZ],House[i][hCarA],House[i][hCarC1],House[i][hCarC2],3600);
		format(HouseOwner[House[i][hCar]],32,"%s",House[i][Owner]);
	}
	else if(House[i][hCarID] == 0)
	{
	House[i][hCar] = 0;
	}
	}
}
//==========Public
forward GetClosetHouseID(playerid);
public GetClosetHouseID(playerid)
{
	new Float:Distance;
	for(new h; h<MAX_HOUSE; h++)
	{
	    Distance = GetDistanceToHouse(playerid, h);
	    if(Distance < 2.0)
	    {
	        return h;
		}
	}
	return -1;
}
forward Float:GetDistanceToHouse(playerid, h);
public Float:GetDistanceToHouse(playerid, h)
{
	new Float:x1,Float:y1,Float:z1,Float:x2,Float:y2,Float:z2;
	GetPlayerPos(playerid,x1,y1,z1);
	x2 = House[h][EnterX];
	y2 = House[h][EnterY];
	z2 = House[h][EnterZ];
	return floatsqroot(floatpower(floatabs(floatsub(x2,x1)),2)+floatpower(floatabs(floatsub(y2,y1)),2)+floatpower(floatabs(floatsub(z2,z1)),2));
}
forward GetClosetHouseIntID(playerid);
public GetClosetHouseIntID(playerid)
{
	new Float:Distance;
	for(new h; h<MAX_HOUSE; h++)
	{
	    Distance = GetDistanceToHouseInt(playerid, h);
	    if(Distance < 10.0 && House[h][VW] == GetPlayerVirtualWorld(playerid))
	    {
	        return h;
		}
	}
	return -1;
}
forward Float:GetDistanceToHouseInt(playerid, h);
public Float:GetDistanceToHouseInt(playerid, h)
{
	new Float:x1,Float:y1,Float:z1,Float:x2,Float:y2,Float:z2;
	GetPlayerPos(playerid,x1,y1,z1);
	x2 = House[h][ExitX];
	y2 = House[h][ExitY];
	z2 = House[h][ExitZ];
	return floatsqroot(floatpower(floatabs(floatsub(x2,x1)),2)+floatpower(floatabs(floatsub(y2,y1)),2)+floatpower(floatabs(floatsub(z2,z1)),2));
}
stock GetName(playerid)
{
    new
        pName[MAX_PLAYER_NAME];

    GetPlayerName(playerid, pName, MAX_PLAYER_NAME);
    return pName;
}
stock ProxDetector(playerid, const msg [], color, maxdistance = 50)
{
    new
        Float: x1,
        Float: y1,
        Float: z1,
        distance,
        string [128];

    if (GetPlayerName (playerid, string, sizeof string))
    {
        format (string, sizeof string, "%s", msg);
        GetPlayerPos (playerid, x1, y1, z1);
        for (new i = 0; i < MAX_PLAYERS; ++i)
        {
            if (IsPlayerConnected (i) && !IsPlayerNPC (i))
            {
                if (i == playerid)
                    SCM (i, color, string);
                else
                {
                    distance = floatround (GetPlayerDistanceFromPoint (i, x1, y1, z1));
                    if (distance <= maxdistance)
                        SCM (i, ColorFade (color, distance, maxdistance), string);
                }
            }
        }
        return 1;
    }
    return 0;
}
stock ColorFade (color, value, maxvalue)
{
    if (0 <= value <= maxvalue)
    {
        new
            Float: ratio = float (value) / float (maxvalue);
        new
            r = max (0, min (255, floatround (float ((color >> 24) & 0xFF) * ratio))),
            g = max (0, min (255, floatround (float ((color >> 16) & 0xFF) * ratio))),
            b = max (0, min (255, floatround (float ((color >> 8) & 0xFF) * ratio)));
        return (r << 24) | (g << 16) | (b << 8) | (value & 0xFF);
    }
    return 0;
}
stock GetClosestVehicleID(playerid)
{
	new
		Float:Pos[3],
		Float:dist,
		Float:closedist=10.0,
		closeveh;
	for(new i=0; i < MAX_VEHICLES; i++)
	{
		if(GetVehiclePos(i, Pos[0], Pos[1], Pos[2]))
		{
			dist = GetPlayerDistanceFromPoint(playerid, Pos[0], Pos[1], Pos[2]);
			if(dist < closedist)
			{
				closedist = dist;
				closeveh = i;
			}
		}
	}
	return closeveh;
}
forward GlobalTimer();
public GlobalTimer()
{
new Year, Month, Day,string[64];
getdate(Year, Month, Day);
for(new id = 0; id <= MAX_HOUSE;id++)
{
format(string,64,House_File,id);
if(House[id][DayEnter]+MAX_DAYS <= Day && House[id][On_Sell] == 0)
{
if(fexist(string))
{
//If month have 31 days
if(House[id][MonthEnter] == 1 || House[id][MonthEnter] == 3 || House[id][MonthEnter] == 5 || House[id][MonthEnter] == 7 || House[id][MonthEnter] == 8 || House[id][MonthEnter] == 10 || House[id][MonthEnter] == 12)
{
if(House[id][DayEnter]+MAX_DAYS > 31)
{
new newday = (31-House[id][DayEnter]);
new newday1 = MAX_DAYS-newday;
if(newday1 != Day) return 1;
}
}
//If month have 30 days
if(House[id][MonthEnter] == 4 || House[id][MonthEnter] == 6 || House[id][MonthEnter] == 9 || House[id][MonthEnter] == 11)
{
if(House[id][DayEnter]+MAX_DAYS > 30)
{
new newday = (30-House[id][DayEnter]);
new newday1 = MAX_DAYS-newday;
if(newday1 != Day) return 1;
}
}
//If month have 29 days
if(House[id][MonthEnter] == 2)
{
if(House[id][DayEnter]+MAX_DAYS > 29)
{
new newday = (29-House[id][DayEnter]);
new newday1 = MAX_DAYS-newday;
if(newday1 != Day) return 1;
}
}
ResetPlayerHouseID(House[id][Owner]);
House[id][On_Sell] = 1;
format(House[id][Owner],48,"Apartment");
CheckHouse(id);
DestroyDynamicPickup(House[id][PickupU]);
House[id][PickupU] = CreateDynamicPickup(1273, 23,  House[id][EnterX],House[id][EnterY],House[id][EnterZ],-1,-1,-1,100.0);
DestroyDynamicMapIcon(House[id][Icon]);
House[id][Icon] = CreateDynamicMapIcon(House[id][EnterX],House[id][EnterY],House[id][EnterZ], 31, 0, -1, -1, -1, 100.0);
format(string,sizeof(string),"{29CC3F}Owner: "COL_WHITE"Apartment\n{29CC3F}House Name: "COL_WHITE"%s\n{29CC3F}Price: "COL_WHITE"%d\n{29CC3F}Level: "COL_WHITE"%d\n{29CC3F}Address: "COL_WHITE"%s\n (/buyhouse)",House[id][HouseName],House[id][Price],House[id][Level],House[id][Address]);
UpdateDynamic3DTextLabelText(House[id][DLabel],-1,string);
printf("House ID %d has been unowned",id);
}
}
}
foreach(Player, i)
{
//===Bills===
if(Player[i][Houseid] != 999)
{
Player[i][Sec]++;
if(Player[i][Sec] >= 60) {Player[i][Sec] = 0; Player[i][Min]++;}
if(Player[i][Min] == 60)
{
Player[i][Min] = 0;
new money = randomEx(50,150);
SendFormatMSG(i,-1,"You pay for house bills {13AD32}$%d",money);
GivePlayerMoney(i,-money);
}
}
//Phone
if(Calling[i] > 0)
{
Calling[i]--;
if(Calling[i] == 0) {SCM(i,-1,"There is no answer.");}
}
if(Player[i][RobHouse] > 0) Player[i][RobHouse]--;
}
return 1;
}
stock UpdatePlayerInformation(playerid)
{
new dFile[32];
format(dFile, 35, FILE_FOR_PLAYER, GetName(playerid));

new
	INI:UserFile = INI_Open(dFile);

    INI_WriteFloat(UserFile, "pSpawnX", Player[playerid][SpawnX]);
    INI_WriteFloat(UserFile, "pSpawnY", Player[playerid][SpawnY]);
    INI_WriteFloat(UserFile, "pSpawnZ", Player[playerid][SpawnZ]);
    INI_WriteInt(UserFile, "pSpawn", Player[playerid][Spawn]);
    INI_WriteInt(UserFile, "pSpawnInt", Player[playerid][SpawnInt]);
    INI_WriteInt(UserFile, "pVW", Player[playerid][SpawnVW]);
    INI_WriteInt(UserFile, "RobHouse", Player[playerid][RobHouse]);
    INI_WriteInt(UserFile, "HouseID", Player[playerid][Houseid]);
    INI_WriteInt(UserFile, "Bill", Player[playerid][Min]);

	INI_Close(UserFile);
}
stock ResetPlayerHouseID(name[])
{
new dFile[32];
format(dFile, 35, FILE_FOR_PLAYER, name);

new
	INI:UserFile = INI_Open(dFile);

    INI_WriteInt(UserFile, "HouseID", 999);
	INI_Close(UserFile);
}


stock GetHouse2DZone(id, zone[], len)
{
	new Float:x = House[id][EnterX], Float:y = House[id][EnterY];
 	for(new i = 0; i != sizeof(SanAndreasZones); i++ )
	{
		if(x >= SanAndreasZones[i][Zone_Area][0] && x <= SanAndreasZones[i][Zone_Area][3] && y >= SanAndreasZones[i][Zone_Area][1] && y <= SanAndreasZones[i][Zone_Area][4])
			return format(zone, len, SanAndreasZones[i][Zone_Name], 0);
	}
	return 0;
}
Reply
#9

PHP код:
if(GetPlayerScore(playerid) < 5000)) return SCM(playerid,COLOR_RED,"You need more than 5000 score to buy this house."); 
Reply
#10

Quote:
Originally Posted by (*|Flake|*)
Посмотреть сообщение
PHP код:
if(GetPlayerScore(playerid) > 5000) return SCM(playerid,COLOR_RED,"You need more than 5000 score to buy this house."); 
flake that wont work you have logical error it should be like as sreyas did
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)