Advertisement
System32

S32_House

Nov 10th, 2011
547
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 125.88 KB | None | 0 0
  1. /*
  2.  * S32_House - Create house with just one line (MySQL)!
  3.  * Copyright(c)System32
  4.  * This file is provided as is (no warranties)
  5.  
  6.  
  7.  * I started developing this include a 2-3 months ago but I had a big problems, now it's fixed and everything works!
  8.  * Functions: 52
  9.  * Commands: 16
  10.  * Callbacks: 4
  11.  * Credits:
  12.      * System32 - Almost everything!
  13.      * The Guy - Helped me a lot, thank you!
  14.      * Y_Less - y_hooks, y_commands, sscanf & foreach!
  15.      * G-Stylezz (BlueG) - MySQL plugin!
  16.      * Some guy on forums like wups, Y_Less - helped me with some things!
  17.  * That is basically it, have fun with this include and easy scripting!
  18.  */
  19.  
  20. #if !defined _inc_a_samp
  21.     #include <a_samp>
  22. #endif
  23. #if !defined _inc_a_mysql
  24.     #include <a_mysql>
  25. #endif
  26. #if !defined _inc_foreach
  27.     #include <foreach>
  28. #endif
  29. #include <YSI\y_hooks>
  30. #include <YSI\y_commands>
  31.  
  32. #define MAX_HOUSES 150
  33. #define house_version "v1.5.0"
  34. #if !defined MAX_HOUSES
  35.     #error Please define the max houses (#define MAX_HOUSES)
  36. #endif
  37.  
  38. #define COLOR_LIME                                              0x10F441AA
  39. #define COLOR_KRED                                              0xFF0000FF
  40. #define COLOR_YELLOW                                            0xFFFF00AA
  41.  
  42. enum hInfo
  43. {
  44.     hOwner[24],
  45.     Float: hEnterX,
  46.     Float: hEnterY,
  47.     Float: hEnterZ,
  48.     Float: hExitX,
  49.     Float: hExitY,
  50.     Float: hExitZ,
  51.     hInterior,
  52.     hPrice,
  53.     hVirtualWorld,
  54.     hOwned,
  55.     hLocked,
  56.     Text3D:hLabel,
  57.     hPickup,
  58.     hWeaponID1,
  59.     hWeaponID2,
  60.     hWeaponID3,
  61.     hWeaponID1Ammo,
  62.     hWeaponID2Ammo,
  63.     hWeaponID3Ammo,
  64.     hMoney,
  65.     hRentUser[24],
  66.     hRentPrice,
  67.     hRented,
  68.     hRentDisabled,
  69.     hAlarm,
  70.     hCar,
  71.     hVehicleID,
  72.     Float: hCarX,
  73.     Float: hCarY,
  74.     Float: hCarZ,
  75.     Float: hCarA,
  76.     hCarColor1,
  77.     hCarColor2,
  78.     hCarLocked,
  79.     hCarOwner[24],
  80.     hCarWeaponID1,
  81.     hCarWeaponID2,
  82.     hCarWeaponID1Ammo,
  83.     hCarWeaponID2Ammo,
  84.     hCarMoney
  85. };
  86. new HouseInfo[MAX_HOUSES][hInfo];
  87.  
  88. new Iterator:Houses<MAX_HOUSES>, hstring[128], HQuery[1000], HouseID, hsavingstring[3000], House_Weapon[MAX_PLAYERS][13], House_Ammo[MAX_PLAYERS][13], RentFeeTimer, Float: PPos[4];
  89. new bool: PlayerEnteredHisHouse[MAX_PLAYERS] = false, bool: PlayerEnteredHisHouseCar[MAX_PLAYERS] = false, HouseLockBreaking[MAX_PLAYERS];
  90.  
  91. forward OnPlayerEnterHouse(playerid, houseid);
  92. forward OnPlayerExitHouse(playerid, houseid);
  93. forward OnPlayerEnterHouseVehicle(playerid);
  94. forward OnPlayerExitHouseVehicle(playerid);
  95. forward RentFeeUp();
  96. forward BreakingLock(playerid);
  97.  
  98. //*****************************           *****************************
  99. //***************************** FUNCTIONS *****************************
  100. //*****************************           *****************************
  101.  
  102.  
  103.  
  104.  
  105. /*
  106.  
  107.  • Function: CreateHouse(Float: EnterX, Float: EnterY, Float: EnterZ, Interior, Float: InteriorX, Float: InteriorY, Float: InteriorZ, Price, VirtualWorld, RentPrice)
  108.  • Data storage: MySQL (G-Stylezzz's plugin)
  109.  • Usage: Creating house, use this in OnGameModeInit or OnFilterScriptInit!
  110.  • Parameters:
  111.         EnterX, EnterY, EnterZ: Coordinates where you can enter house, also on that coordiantes will create pickup and 3D text!
  112.         ExitX, ExitY, ExitZ: Coordinates where you can exit house, this coordinates are coordiantes of interior, you can find interiors on http://weedarr.wikidot.com/interior or http://wiki.sa-mp.com/wiki/InteriorIDs
  113.         Interior: ID od interior you want, see the web page on the parameter above
  114.         Price: Price for buying house
  115.         VirtulWorld: Always increase this because if you have 2 same interior and player are in the (Example one is in his house, second is in his too) they will see themself, It will look that they have same house! (Bad explained :/)
  116.         RentPrice: Price for renting house, when player buy house maximum rent price is 10000 so, if you put it 20000 than he change it, he won't be able to set it again on 20000
  117.  • Example: CreateHouse(-2521.3315,-623.4722,132.7717, 3, 1527.229980,-11.574499,1002.097106, 1000, 0, 5000);
  118.  
  119. */
  120.  
  121. stock CreateHouse(Float: EnterX, Float: EnterY, Float: EnterZ, Interior, Float: ExitX, Float: ExitY, Float: ExitZ, Price, VirtualWorld, RentPrice, VehicleID = 0, Float: CarX = 0.0, Float: CarY = 0.0, Float: CarZ = 0.0, Float: CarA = 0.0, CarColor1 = 0, CarColor2 = 0)
  122. {
  123.     format(HQuery, sizeof(HQuery), "SELECT * FROM `house` WHERE `HouseID` = %d", HouseID);
  124.     mysql_query(HQuery);
  125.     mysql_store_result();
  126.     if(mysql_num_rows() == 0)
  127.     {
  128.         format(HouseInfo[HouseID][hOwner], 24, "None");
  129.         format(HouseInfo[HouseID][hRentUser], 24, "None");
  130.         format(HouseInfo[HouseID][hCarOwner], 24, "None");
  131.         HouseInfo[HouseID][hEnterX] = EnterX;
  132.         HouseInfo[HouseID][hEnterY] = EnterY;
  133.         HouseInfo[HouseID][hEnterZ] = EnterZ;
  134.         HouseInfo[HouseID][hExitX] = ExitX;
  135.         HouseInfo[HouseID][hExitY] = ExitY;
  136.         HouseInfo[HouseID][hExitZ] = ExitZ;
  137.         HouseInfo[HouseID][hInterior] = Interior;
  138.         HouseInfo[HouseID][hVirtualWorld] = VirtualWorld;
  139.         HouseInfo[HouseID][hPrice] = Price;
  140.         HouseInfo[HouseID][hRentPrice] = RentPrice;
  141.         HouseInfo[HouseID][hVehicleID] = VehicleID;
  142.         HouseInfo[HouseID][hCarX] = CarX;
  143.         HouseInfo[HouseID][hCarY] = CarY;
  144.         HouseInfo[HouseID][hCarZ] = CarZ;
  145.         HouseInfo[HouseID][hCarA] = CarA;
  146.         HouseInfo[HouseID][hCarColor1] = CarColor1;
  147.         HouseInfo[HouseID][hCarColor2] = CarColor2;
  148.         format(hstring, sizeof(hstring), "For sale!\nPrice: %d\nHouse ID: %d\nType /buyhouse to buy house!", Price, HouseID);
  149.         format(HQuery, sizeof(HQuery), "INSERT INTO `house` (`User`, `EnterX`, `EnterY`, `EnterZ`, `ExitX`, `ExitY`, `ExitZ`, `Interior`, `Price`, `VirtualWorld`, `Owned`, `Locked`, `Alarm`, `Weapon ID 1`, `Weapon ID 2`, `Weapon ID 3`, `Weapon ID 1 Ammo`, `Weapon ID 2 Ammo`, `Weapon ID 3 Ammo`, `Money`,");
  150.         format(HQuery, sizeof(HQuery), "%s `Rent User`, `Rent Price`, `Rented`, `Rent Disabled`, `VehicleID`, `CarX`, `CarY`, `CarZ`, `CarA`, `Color1`, `Color2`, `Car Locked`, `Car Owner`, `Car Weapon ID 1`, `Car Weapon ID 2`, `Car Weapon ID 1 Ammo`, `Car Weapon ID 2 Ammo`, `Car Money`, `HouseID`) VALUES", HQuery);
  151.         format(HQuery, sizeof(HQuery), "%s  ('None', %f, %f, %f, %f, %f, %f, %d, %d, %d, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'None', %d, 0, 0, %d, %f, %f, %f, %f, %d, %d, 0, 'None', 0, 0, 0, 0, 0, %d)", HQuery, HouseInfo[HouseID][hEnterX], HouseInfo[HouseID][hEnterY], HouseInfo[HouseID][hEnterZ], HouseInfo[HouseID][hExitX], HouseInfo[HouseID][hExitY],
  152.         HouseInfo[HouseID][hExitZ], HouseInfo[HouseID][hInterior], HouseInfo[HouseID][hPrice], HouseInfo[HouseID][hVirtualWorld], HouseInfo[HouseID][hRentPrice], HouseInfo[HouseID][hVehicleID], HouseInfo[HouseID][hCarX], HouseInfo[HouseID][hCarY], HouseInfo[HouseID][hCarZ], HouseInfo[HouseID][hCarA], HouseInfo[HouseID][hCarColor1], HouseInfo[HouseID][hCarColor2], HouseID);
  153.         mysql_query(HQuery);
  154.         HouseInfo[HouseID][hLabel] = Create3DTextLabel(hstring, 0x21DD00FF, EnterX, EnterY, EnterZ, 40.0, 0);
  155.         HouseInfo[HouseID][hPickup] = CreatePickup(1273, 23, EnterX, EnterY, EnterZ, 0);
  156.         if(HouseInfo[HouseID][hVehicleID] != 0 && HouseInfo[HouseID][hCarX] != 0.0 && HouseInfo[HouseID][hCarY] != 0.0 && HouseInfo[HouseID][hCarZ] != 0.0 && HouseInfo[HouseID][hCarA] > 0.0)
  157.         {
  158.             HouseInfo[HouseID][hCar] = AddStaticVehicle(VehicleID, CarX, CarY, CarZ, CarA, CarColor1, CarColor2);
  159.         }
  160.     }
  161.     else
  162.     {
  163.         if(mysql_fetch_row_format(HQuery, "|"))
  164.         {
  165.             mysql_fetch_field_row(hsavingstring, "User"); format(HouseInfo[HouseID][hOwner], 24, "%s", hsavingstring);
  166.             mysql_fetch_field_row(hsavingstring, "EnterX"); HouseInfo[HouseID][hEnterX] = floatstr(hsavingstring);
  167.             mysql_fetch_field_row(hsavingstring, "EnterY"); HouseInfo[HouseID][hEnterY] = floatstr(hsavingstring);
  168.             mysql_fetch_field_row(hsavingstring, "EnterZ"); HouseInfo[HouseID][hEnterZ] = floatstr(hsavingstring);
  169.             mysql_fetch_field_row(hsavingstring, "ExitX"); HouseInfo[HouseID][hExitX] = floatstr(hsavingstring);
  170.             mysql_fetch_field_row(hsavingstring, "ExitY"); HouseInfo[HouseID][hExitY] = floatstr(hsavingstring);
  171.             mysql_fetch_field_row(hsavingstring, "ExitZ"); HouseInfo[HouseID][hExitZ] = floatstr(hsavingstring);
  172.             mysql_fetch_field_row(hsavingstring, "Interior"); HouseInfo[HouseID][hInterior] = strval(hsavingstring);
  173.             mysql_fetch_field_row(hsavingstring, "Price"); HouseInfo[HouseID][hPrice] = strval(hsavingstring);
  174.             mysql_fetch_field_row(hsavingstring, "VirtualWorld"); HouseInfo[HouseID][hVirtualWorld] = strval(hsavingstring);
  175.             mysql_fetch_field_row(hsavingstring, "Owned"); HouseInfo[HouseID][hOwned] = strval(hsavingstring);
  176.             mysql_fetch_field_row(hsavingstring, "Locked"); HouseInfo[HouseID][hLocked] = strval(hsavingstring);
  177.             mysql_fetch_field_row(hsavingstring, "Weapon ID 1"); HouseInfo[HouseID][hWeaponID1] = strval(hsavingstring);
  178.             mysql_fetch_field_row(hsavingstring, "Weapon ID 2"); HouseInfo[HouseID][hWeaponID2] = strval(hsavingstring);
  179.             mysql_fetch_field_row(hsavingstring, "Weapon ID 3"); HouseInfo[HouseID][hWeaponID3] = strval(hsavingstring);
  180.             mysql_fetch_field_row(hsavingstring, "Weapon ID 1 Ammo"); HouseInfo[HouseID][hWeaponID1Ammo] = strval(hsavingstring);
  181.             mysql_fetch_field_row(hsavingstring, "Weapon ID 2 Ammo"); HouseInfo[HouseID][hWeaponID2Ammo] = strval(hsavingstring);
  182.             mysql_fetch_field_row(hsavingstring, "Weapon ID 3 Ammo"); HouseInfo[HouseID][hWeaponID3Ammo] = strval(hsavingstring);
  183.             mysql_fetch_field_row(hsavingstring, "Money"); HouseInfo[HouseID][hMoney] = strval(hsavingstring);
  184.             mysql_fetch_field_row(hsavingstring, "Rent User"); format(HouseInfo[HouseID][hRentUser], 24, "%s", hsavingstring);
  185.             mysql_fetch_field_row(hsavingstring, "Rent Price"); HouseInfo[HouseID][hRentPrice] = strval(hsavingstring);
  186.             mysql_fetch_field_row(hsavingstring, "Rented"); HouseInfo[HouseID][hRented] = strval(hsavingstring);
  187.             mysql_fetch_field_row(hsavingstring, "Rent Disabled"); HouseInfo[HouseID][hRentDisabled] = strval(hsavingstring);
  188.             mysql_fetch_field_row(hsavingstring, "Alarm"); HouseInfo[HouseID][hAlarm] = strval(hsavingstring);
  189.             mysql_fetch_field_row(hsavingstring, "VehicleID"); HouseInfo[HouseID][hVehicleID] = strval(hsavingstring);
  190.             mysql_fetch_field_row(hsavingstring, "CarX"); HouseInfo[HouseID][hCarX] = floatstr(hsavingstring);
  191.             mysql_fetch_field_row(hsavingstring, "CarY"); HouseInfo[HouseID][hCarY] = floatstr(hsavingstring);
  192.             mysql_fetch_field_row(hsavingstring, "CarZ"); HouseInfo[HouseID][hCarZ] = floatstr(hsavingstring);
  193.             mysql_fetch_field_row(hsavingstring, "CarA"); HouseInfo[HouseID][hCarA] = floatstr(hsavingstring);
  194.             mysql_fetch_field_row(hsavingstring, "Color1"); HouseInfo[HouseID][hCarColor1] = strval(hsavingstring);
  195.             mysql_fetch_field_row(hsavingstring, "Color2"); HouseInfo[HouseID][hCarColor2] = strval(hsavingstring);
  196.             mysql_fetch_field_row(hsavingstring, "Car Locked"); HouseInfo[HouseID][hCarLocked] = strval(hsavingstring);
  197.             mysql_fetch_field_row(hsavingstring, "Car Owner"); format(HouseInfo[HouseID][hCarOwner], 24, "%s", hsavingstring);
  198.             mysql_fetch_field_row(hsavingstring, "Car Weapon ID 1"); HouseInfo[HouseID][hCarWeaponID1] = strval(hsavingstring);
  199.             mysql_fetch_field_row(hsavingstring, "Car Weapon ID 2"); HouseInfo[HouseID][hCarWeaponID2] = strval(hsavingstring);
  200.             mysql_fetch_field_row(hsavingstring, "Car Weapon ID 1 Ammo"); HouseInfo[HouseID][hCarWeaponID1Ammo] = strval(hsavingstring);
  201.             mysql_fetch_field_row(hsavingstring, "Car Weapon ID 2 Ammo"); HouseInfo[HouseID][hCarWeaponID2Ammo] = strval(hsavingstring);
  202.             mysql_fetch_field_row(hsavingstring, "Car Money"); HouseInfo[HouseID][hCarMoney] = strval(hsavingstring);
  203.             if(HouseInfo[HouseID][hOwned] == 1)
  204.             {
  205.                 if(HouseInfo[HouseID][hRentDisabled] == 0)
  206.                 {
  207.                     format(hstring, sizeof(hstring), "Owner: %s\nHouse ID: %d\nRent User: %s\nRent Price: %d", HouseInfo[HouseID][hOwner], HouseID, HouseInfo[HouseID][hRentUser], HouseInfo[HouseID][hRentPrice]);
  208.                     HouseInfo[HouseID][hLabel] = Create3DTextLabel(hstring, 0x21DD00FF, HouseInfo[HouseID][hEnterX], HouseInfo[HouseID][hEnterY], HouseInfo[HouseID][hEnterZ], 40.0, 0);
  209.                     HouseInfo[HouseID][hPickup] = CreatePickup(1239, 23, HouseInfo[HouseID][hEnterX], HouseInfo[HouseID][hEnterY], HouseInfo[HouseID][hEnterZ], 0);
  210.                 }
  211.                 else
  212.                 {
  213.                     format(hstring, sizeof(hstring), "Owner: %s\nHouse ID: %d\nRent Disabled", HouseInfo[HouseID][hOwner], HouseID);
  214.                     HouseInfo[HouseID][hLabel] = Create3DTextLabel(hstring, 0x21DD00FF, HouseInfo[HouseID][hEnterX], HouseInfo[HouseID][hEnterY], HouseInfo[HouseID][hEnterZ], 40.0, 0);
  215.                     HouseInfo[HouseID][hPickup] = CreatePickup(1239, 23, HouseInfo[HouseID][hEnterX], HouseInfo[HouseID][hEnterY], HouseInfo[HouseID][hEnterZ], 0);
  216.                 }
  217.             }
  218.             else
  219.             {
  220.                 format(hstring, sizeof(hstring), "For sale!\nPrice: %d\nHouse ID: %d\nType /buyhouse to buy house!", Price, HouseID);
  221.                 HouseInfo[HouseID][hLabel] = Create3DTextLabel(hstring, 0x21DD00FF, HouseInfo[HouseID][hEnterX], HouseInfo[HouseID][hEnterY], HouseInfo[HouseID][hEnterZ], 40.0, 0);
  222.                 HouseInfo[HouseID][hPickup] = CreatePickup(1273, 23, HouseInfo[HouseID][hEnterX], HouseInfo[HouseID][hEnterY], HouseInfo[HouseID][hEnterZ], 0);
  223.             }
  224.         }
  225.         if(HouseInfo[HouseID][hVehicleID] != 0 && HouseInfo[HouseID][hCarX] != 0.0 && HouseInfo[HouseID][hCarY] != 0.0 && HouseInfo[HouseID][hCarZ] != 0.0 && HouseInfo[HouseID][hCarA] > 0.0)
  226.         {
  227.             HouseInfo[HouseID][hCar] = AddStaticVehicle(HouseInfo[HouseID][hVehicleID], HouseInfo[HouseID][hCarX], HouseInfo[HouseID][hCarY], HouseInfo[HouseID][hCarZ], HouseInfo[HouseID][hCarA], HouseInfo[HouseID][hCarColor1], HouseInfo[HouseID][hCarColor2]);
  228.         }
  229.     }
  230.     mysql_free_result();
  231.     HouseID++;
  232.     if(HouseID > MAX_HOUSES)
  233.     {
  234.         print("You reached maximum number of houses! Please enlarge the #define MAX_HOUSES\nin S32_House.inc! If you don't enlarge it, some houses won't work properly!");
  235.     }
  236.     Iter_Add(Houses, HouseID);
  237.     return 1;
  238. }
  239.  
  240.  
  241.  
  242. /*
  243.  
  244.  • Function: GetHouseUser(houseid)
  245.  • Usage: Getting name of user of specific house!
  246.  • Parameters:
  247.         houseid: ID of house that you want to get user (owner)
  248.  • Example: format(string, sizeof(string), "House user of house id %d is %s", houseid, GetHouseUser(houseid));
  249.  
  250. */
  251.  
  252. stock GetHouseUser(houseid)
  253. {
  254.     new howner[24];
  255.     format(howner, sizeof(howner), "%s", HouseInfo[houseid][hOwner]);
  256.     return howner;
  257. }
  258.  
  259.  
  260.  
  261. /*
  262.  
  263.  • Function: GetHouseRentUser(houseid)
  264.  • Usage: Getting name of rent user of specific house!
  265.  • Parameters:
  266.         houseid: ID of house that you want to get rent user
  267.  • Example: format(string, sizeof(string), "House rent user of house id %d is %s", houseid, GetHouseRentUser(houseid));
  268.  
  269. */
  270.  
  271. stock GetHouseRentUser(houseid)
  272. {
  273.     new howner[24];
  274.     format(howner, sizeof(howner), "%s", HouseInfo[houseid][hRentUser]);
  275.     return howner;
  276. }
  277.  
  278.  
  279.  
  280. /*
  281.  
  282.  • Function: GetHouseEnterPos(houseid)
  283.  • Usage: Getting the enter position (XYZ) of specific house!
  284.  • Parameters:
  285.         houseid: ID of house that you want to get enter position
  286.  • Example: format(string, sizeof(string), "House enter XYZ of house id %d is %s", houseid, GetHouseEnterPos(houseid));
  287.  
  288. */
  289.  
  290. stock GetHouseEnterPos(houseid)
  291. {
  292.     new getxyz[128];
  293.     format(getxyz, sizeof(getxyz), "%f, %f, %f", HouseInfo[houseid][hEnterX], HouseInfo[houseid][hEnterY], HouseInfo[houseid][hEnterZ]);
  294.     return getxyz;
  295. }
  296.  
  297.  
  298.  
  299. /*
  300.  
  301.  • Function: GetHouseExitPos(houseid)
  302.  • Usage: Getting the exit position (XYZ) of specific house!
  303.  • Parameters:
  304.         houseid: ID of house that you want to get exit position
  305.  • Example: format(string, sizeof(string), "House exit XYZ of house id %d is %s", houseid, GetHouseExitPos(houseid));
  306.  
  307. */
  308.  
  309. stock GetHouseExitPos(houseid)
  310. {
  311.     new getxyz[128];
  312.     format(getxyz, sizeof(getxyz), "%f, %f, %f", HouseInfo[houseid][hExitX], HouseInfo[houseid][hExitY], HouseInfo[houseid][hExitZ]);
  313.     return getxyz;
  314. }
  315.  
  316.  
  317.  
  318. /*
  319.  
  320.  • Function: GetHouseEnterX(houseid)
  321.  • Usage: Getting the enter X position of specific house!
  322.  • Parameters:
  323.         houseid: ID of house that you want to get enter X position
  324.  • Example: format(string, sizeof(string), "House enter X of house id %d is %s", houseid, GetHouseEnterX(houseid));
  325.  
  326. */
  327.  
  328. stock GetHouseEnterX(houseid)
  329. {
  330.     new getx[128];
  331.     format(getx, sizeof(getx), "%f", HouseInfo[houseid][hEnterX]);
  332.     return getx;
  333. }
  334.  
  335.  
  336.  
  337. /*
  338.  
  339.  • Function: GetHouseEnterY(houseid)
  340.  • Usage: Getting the enter Y position of specific house!
  341.  • Parameters:
  342.         houseid: ID of house that you want to get enter Y position
  343.  • Example: format(string, sizeof(string), "House enter Y of house id %d is %s", houseid, GetHouseEnterY(houseid));
  344.  
  345. */
  346.  
  347. stock GetHouseEnterY(houseid)
  348. {
  349.     new gety[128];
  350.     format(gety, sizeof(gety), "%f", HouseInfo[houseid][hEnterY]);
  351.     return gety;
  352. }
  353.  
  354.  
  355.  
  356. /*
  357.  
  358.  • Function: GetHouseEnterZ(houseid)
  359.  • Usage: Getting the enter Z position of specific house!
  360.  • Parameters:
  361.         houseid: ID of house that you want to get enter Z position
  362.  • Example: format(string, sizeof(string), "House enter Z of house id %d is %s", houseid, GetHouseEnterZ(houseid));
  363.  
  364. */
  365.  
  366. stock GetHouseEnterZ(houseid)
  367. {
  368.     new getz[128];
  369.     format(getz, sizeof(getz), "%f", HouseInfo[houseid][hEnterZ]);
  370.     return getz;
  371. }
  372.  
  373.  
  374.  
  375. /*
  376.  
  377.  • Function: GetHouseExitX(houseid)
  378.  • Usage: Getting the enter X position of specific house!
  379.  • Parameters:
  380.         houseid: ID of house that you want to get enter X position
  381.  • Example: format(string, sizeof(string), "House exit X of house id %d is %s", houseid, GetHouseExitX(houseid));
  382.  
  383. */
  384.  
  385. stock GetHouseExitX(houseid)
  386. {
  387.     new getx[128];
  388.     format(getx, sizeof(getx), "%f", HouseInfo[houseid][hExitX]);
  389.     return getx;
  390. }
  391.  
  392.  
  393.  
  394. /*
  395.  
  396.  • Function: GetHouseExitY(houseid)
  397.  • Usage: Getting the enter Y position of specific house!
  398.  • Parameters:
  399.         houseid: ID of house that you want to get enter Y position
  400.  • Example: format(string, sizeof(string), "House exit Y of house id %d is %s", houseid, GetHouseExitY(houseid));
  401.  
  402. */
  403.  
  404. stock GetHouseExitY(houseid)
  405. {
  406.     new gety[128];
  407.     format(gety, sizeof(gety), "%f", HouseInfo[houseid][hExitY]);
  408.     return gety;
  409. }
  410.  
  411.  
  412.  
  413. /*
  414.  
  415.  • Function: GetHouseExitZ(houseid)
  416.  • Usage: Getting the enter Z position of specific house!
  417.  • Parameters:
  418.         houseid: ID of house that you want to get enter Z position
  419.  • Example: format(string, sizeof(string), "House exit Z of house id %d is %s", houseid, GetHouseExitZ(houseid));
  420.  
  421. */
  422.  
  423. stock GetHouseExitZ(houseid)
  424. {
  425.     new getz[128];
  426.     format(getz, sizeof(getz), "%f", HouseInfo[houseid][hExitZ]);
  427.     return getz;
  428. }
  429.  
  430.  
  431.  
  432. /*
  433.  
  434.  • Function: GetHousePrice(houseid)
  435.  • Usage: Getting the price of specific house!
  436.  • Parameters:
  437.         houseid: ID of house that you want to get price
  438.  • Example: format(string, sizeof(string), "House price of house id %d is %d", houseid, GetHousePrice(houseid));
  439.  
  440. */
  441.  
  442. stock GetHousePrice(houseid) return HouseInfo[houseid][hPrice];
  443.  
  444.  
  445.  
  446. /*
  447.  
  448.  • Function: GetHouseInterior(houseid)
  449.  • Usage: Getting the interior of specific house!
  450.  • Parameters:
  451.         houseid: ID of house that you want to get interior
  452.  • Example: format(string, sizeof(string), "House interior of house id %d is %d", houseid, GetHouseInterior(houseid));
  453.  
  454. */
  455.  
  456. stock GetHouseInterior(houseid) return HouseInfo[houseid][hInterior];
  457.  
  458.  
  459.  
  460. /*
  461.  
  462.  • Function: GetHouseVirtualWorld(houseid)
  463.  • Usage: Getting the virtualworld of specific house!
  464.  • Parameters:
  465.         houseid: ID of house that you want to get virtualworld
  466.  • Example: format(string, sizeof(string), "House virtualworld of house id %d is %d", houseid, GetHouseVirtualWorld(houseid));
  467.  
  468. */
  469.  
  470. stock GetHouseVirtualWorld(houseid) return HouseInfo[houseid][hVirtualWorld];
  471.  
  472.  
  473.  
  474. /*
  475.  
  476.  • Function: GetHouseRentPrice(houseid)
  477.  • Usage: Getting the rent price of specific house!
  478.  • Parameters:
  479.         houseid: ID of house that you want to get rent price
  480.  • Example: format(string, sizeof(string), "House rent priceof house id %d is %d", houseid, GetHouseRentPrice(houseid));
  481.  
  482. */
  483.  
  484. stock GetHouseRentPrice(houseid) return HouseInfo[houseid][hRentPrice];
  485.  
  486.  
  487.  
  488. /*
  489.  
  490.  • Function: GetHouseMoney(houseid)
  491.  • Usage: Getting the money (stored money) of specific house!
  492.  • Parameters:
  493.         houseid: ID of house that you want to get money
  494.  • Example: format(string, sizeof(string), "House money of house id %d is %d", houseid, GetHouseMoney(houseid));
  495.  
  496. */
  497.  
  498. stock GetHouseMoney(houseid) return HouseInfo[houseid][hMoney];
  499.  
  500.  
  501.  
  502. /*
  503.  
  504.  • Function: GetHouseWeaponID1(houseid)
  505.  • Usage: Getting the weapon id 1 of specific house!
  506.  • Parameters:
  507.         houseid: ID of house that you want to get the weapon id 1
  508.  • Example: format(string, sizeof(string), "House weapon id 1 of house id %d is %d", houseid, GetHouseWeaponID1(houseid));
  509.  
  510. */
  511.  
  512. stock GetHouseWeaponID1(houseid) return HouseInfo[houseid][hWeaponID1];
  513.  
  514.  
  515.  
  516. /*
  517.  
  518.  • Function: GetHouseWeaponID2(houseid)
  519.  • Usage: Getting the weapon id 2 of specific house!
  520.  • Parameters:
  521.         houseid: ID of house that you want to get the weapon id 2
  522.  • Example: format(string, sizeof(string), "House weapon id 2 of house id %d is %d", houseid, GetHouseWeaponID2(houseid));
  523.  
  524. */
  525. stock GetHouseWeaponID2(houseid) return HouseInfo[houseid][hWeaponID2];
  526.  
  527.  
  528.  
  529. /*
  530.  
  531.  • Function: GetHouseWeaponID3(houseid)
  532.  • Usage: Getting the weapon id 3 of specific house!
  533.  • Parameters:
  534.         houseid: ID of house that you want to get the weapon id 3
  535.  • Example: format(string, sizeof(string), "House weapon id 3 of house id %d is %d", houseid, GetHouseWeaponID3(houseid));
  536.  
  537. */
  538.  
  539. stock GetHouseWeaponID3(houseid) return HouseInfo[houseid][hWeaponID3];
  540.  
  541.  
  542.  
  543. /*
  544.  
  545.  • Function: GetHouseWeaponID1Ammo(houseid)
  546.  • Usage: Getting the weapon id 1 of specific house!
  547.  • Parameters:
  548.         houseid: ID of house that you want to get the weapon id 1 ammo
  549.  • Example: format(string, sizeof(string), "House weapon id 1 ammo of house id %d is %d", houseid, GetHouseWeaponID1Ammo(houseid));
  550.  
  551. */
  552.  
  553. stock GetHouseWeaponID1Ammo(houseid) return HouseInfo[houseid][hWeaponID1Ammo];
  554.  
  555.  
  556.  
  557. /*
  558.  
  559.  • Function: GetHouseWeaponID2Ammo(houseid)
  560.  • Usage: Getting the weapon id 2 of specific house!
  561.  • Parameters:
  562.         houseid: ID of house that you want to get the weapon id 2 ammo
  563.  • Example: format(string, sizeof(string), "House weapon id 2 ammo of house id %d is %d", houseid, GetHouseWeaponID2Ammo(houseid));
  564.  
  565. */
  566.  
  567. stock GetHouseWeaponID2Ammo(houseid) return HouseInfo[houseid][hWeaponID2Ammo];
  568.  
  569.  
  570.  
  571. /*
  572.  
  573.  • Function: GetHouseWeaponID3Ammo(houseid)
  574.  • Usage: Getting the weapon id 3 of specific house!
  575.  • Parameters:
  576.         houseid: ID of house that you want to get the weapon id 3 ammo
  577.  • Example: format(string, sizeof(string), "House weapon id 3 ammo of house id %d is %d", houseid, GetHouseWeaponID3Ammo(houseid));
  578.  
  579. */
  580.  
  581. stock GetHouseWeaponID3Ammo(houseid) return HouseInfo[houseid][hWeaponID3Ammo];
  582.  
  583.  
  584.  
  585. /*
  586.  
  587.  • Function: GetHouseWeaponID1Name(houseid)
  588.  • Usage: Getting the name of weapon id 1 of specific house!
  589.  • Parameters:
  590.         houseid: ID of house that you want to get the name of weapon id 1
  591.  • Example: format(string, sizeof(string), "House name of weapon id 1 of house id %d is %d", houseid, GetHouseWeaponID1Name(houseid));
  592.  
  593. */
  594.  
  595. stock GetHouseWeaponID1Name(houseid)
  596. {
  597.     new weaponid[128], weaponid2[128];
  598.     format(weaponid, sizeof(weaponid), "%s", GetWeapon(HouseInfo[houseid][hWeaponID1]));
  599.     format(weaponid2, sizeof(weaponid2), "Nothing");
  600.     if(HouseInfo[houseid][hWeaponID1] > 0) return weaponid;
  601.     else return weaponid2;
  602. }
  603.  
  604.  
  605.  
  606. /*
  607.  
  608.  • Function: GetHouseWeaponID2Name(houseid)
  609.  • Usage: Getting the name of weapon id 2 of specific house!
  610.  • Parameters:
  611.         houseid: ID of house that you want to get the name of weapon id 2
  612.  • Example: format(string, sizeof(string), "House name of weapon id 2 of house id %d is %d", houseid, GetHouseWeaponID2Name(houseid));
  613.  
  614. */
  615.  
  616. stock GetHouseWeaponID2Name(houseid)
  617. {
  618.     new weaponid[128], weaponid2[128];
  619.     format(weaponid, sizeof(weaponid), "%s", GetWeapon(HouseInfo[houseid][hWeaponID2]));
  620.     format(weaponid2, sizeof(weaponid2), "Nothing");
  621.     if(HouseInfo[houseid][hWeaponID2] > 0) return weaponid;
  622.     else return weaponid2;
  623. }
  624.  
  625.  
  626.  
  627. /*
  628.  
  629.  • Function: GetHouseWeaponID13Name(houseid)
  630.  • Usage: Getting the name of weapon id 3 of specific house!
  631.  • Parameters:
  632.         houseid: ID of house that you want to get the name of weapon id 3
  633.  • Example: format(string, sizeof(string), "House name of weapon id 3 of house id %d is %d", houseid, GetHouseWeaponID3Name(houseid));
  634.  
  635. */
  636.  
  637. stock GetHouseWeaponID3Name(houseid)
  638. {
  639.     new weaponid[128], weaponid2[128];
  640.     format(weaponid, sizeof(weaponid), "%s", GetWeapon(HouseInfo[houseid][hWeaponID3]));
  641.     format(weaponid2, sizeof(weaponid2), "Nothing");
  642.     if(HouseInfo[houseid][hWeaponID3] > 0) return weaponid;
  643.     else return weaponid2;
  644. }
  645.  
  646.  
  647.  
  648. /*
  649.  
  650.  • Function: IsHouseOwned(houseid)
  651.  • Usage: Checking if is house owned of specific house!
  652.  • Parameters:
  653.         houseid: ID of house that you want to check if is owned
  654.  • Example: if(IsHouseOwned(houseid)) return SendClientMessage(playerid, -1, "House is owned!");
  655.             else SendClientMessage(playerid, -1, "House is not owned!");
  656.  
  657. */
  658.  
  659. stock IsHouseOwned(houseid)
  660. {
  661.     if(HouseInfo[houseid][hOwned] == 1) return 1;
  662.     else return 0;
  663. }
  664.  
  665.  
  666.  
  667. /*
  668.  
  669.  • Function: IsHouseLocked(houseid)
  670.  • Usage: Checking if is house locked of specific house!
  671.  • Parameters:
  672.         houseid: ID of house that you want to check if is locked
  673.  • Example: if(IsHouseLocked(houseid)) return SendClientMessage(playerid, -1, "House is locked!");
  674.             else SendClientMessage(playerid, -1, "House is not locked!");
  675.  
  676. */
  677.  
  678. stock IsHouseLocked(houseid)
  679. {
  680.     if(HouseInfo[houseid][hLocked] == 1) return 1;
  681.     else return 0;
  682. }
  683.  
  684.  
  685.  
  686. /*
  687.  
  688.  • Function: IsHouseRented(houseid)
  689.  • Usage: Checking if is house owned of specific house!
  690.  • Parameters:
  691.         houseid: ID of house that you want to check if is rented
  692.  • Example: if(IsHouseRented(houseid)) return SendClientMessage(playerid, -1, "House is rented!");
  693.             else SendClientMessage(playerid, -1, "House is not rented!");
  694.  
  695. */
  696.  
  697. stock IsHouseRented(houseid)
  698. {
  699.     if(HouseInfo[houseid][hRented] == 1) return 1;
  700.     else return 0;
  701. }
  702.  
  703.  
  704.  
  705. /*
  706.  
  707.  • Function: IsHouseRentDisabled(houseid)
  708.  • Usage: Checking if is house owned of specific house!
  709.  • Parameters:
  710.         houseid: ID of house that you want to check if is rent disabled
  711.  • Example: if(IsHouseRentDisabled(houseid)) return SendClientMessage(playerid, -1, "House rent is disabled!");
  712.             else SendClientMessage(playerid, -1, "House rent is not disabled!");
  713.  
  714. */
  715.  
  716. stock IsHouseRentDisabled(houseid)
  717. {
  718.     if(HouseInfo[houseid][hRentDisabled] == 1) return 1;
  719.     else return 0;
  720. }
  721.  
  722.  
  723.  
  724. /*
  725.  
  726.  • Function: IsHouseHaveAlarm(houseid)
  727.  • Usage: Checking if is house have an alarm!
  728.  • Parameters:
  729.         houseid: ID of house that you want to check if it have an alarm
  730.  • Example: if(IsHouseHaveAlarm(houseid)) return SendClientMessage(playerid, -1, "House have an alarm!");
  731.             else SendClientMessage(playerid, -1, "House doesn't have an alarm!");
  732.  
  733. */
  734.  
  735. stock IsHouseHaveAlarm(houseid)
  736. {
  737.     if(HouseInfo[houseid][hAlarm] == 1) return 1;
  738.     else return 0;
  739. }
  740.  
  741.  
  742.  
  743. /*
  744.  
  745.  • Function: IsPlayerHouseOwner(playerid, houseid)
  746.  • Usage: Checking if is player owner of specific house!
  747.  • Parameters:
  748.         playerid: ID of player that you want preform check
  749.         houseid: ID of house that you want to check if is player owner
  750.  • Example: if(IsPlayerHouseOwner(playerid, houseid)) return SendClientMessage(playerid, -1, "You are owner of the house!");
  751.             else SendClientMessage(playerid, -1, "You are not owner of the house!");
  752.  
  753. */
  754.  
  755. stock IsPlayerHouseOwner(playerid, houseid)
  756. {
  757.     if(!strcmp(HouseInfo[houseid][hOwner], GetName(playerid), false)) return 1;
  758.     else return 0;
  759. }
  760.  
  761.  
  762.  
  763. /*
  764.  
  765.  • Function: IsPlayerBuyAnyHouse(playerid)
  766.  • Usage: Checking if is player buyed house and he is owner of any house (used when you try to rent room but you already have house)!
  767.  • Parameters:
  768.         playerid: ID of player that you want preform check
  769.  • Example: if(IsPlayerBuyAnyHouse(playerid)) return SendClientMessage(playerid, -1, "You have house already!");
  770.             else SendClientMessage(playerid, -1, "You don't have house!");
  771.  
  772. */
  773.  
  774. stock IsPlayerBuyAnyHouse(playerid)
  775. {
  776.     new HQuery2[200];
  777.     format(HQuery2, sizeof(HQuery2), "SELECT User FROM `house` WHERE `User` = '%s'", GetName(playerid));
  778.     mysql_query(HQuery2);
  779.     mysql_store_result();
  780.     if(mysql_num_rows() == 1)
  781.     {
  782.         mysql_free_result();
  783.         return 1;
  784.     }
  785.     else
  786.     {
  787.         mysql_free_result();
  788.         return 0;
  789.     }
  790. }
  791.  
  792.  
  793.  
  794. /*
  795.  
  796.  • Function: IsPlayerRentAnyHouse(playerid)
  797.  • Usage: Checking if is player rented house and he is rent user of any house (used when you try to rent room but you already rented some house)!
  798.  • Parameters:
  799.         playerid: ID of player that you want preform check
  800.  • Example: if(IsPlayerRentAnyHouse(playerid)) return SendClientMessage(playerid, -1, "You rent house already!");
  801.             else SendClientMessage(playerid, -1, "You don't rent house!");
  802.  
  803. */
  804.  
  805. stock IsPlayerRentAnyHouse(playerid)
  806. {
  807.     new HQuery2[200];
  808.     format(HQuery2, sizeof(HQuery2), "SELECT `Rent User` FROM `house` WHERE `Rent User` = '%s'", GetName(playerid));
  809.     mysql_query(HQuery2);
  810.     mysql_store_result();
  811.     if(mysql_num_rows() == 1)
  812.     {
  813.         mysql_free_result();
  814.         return 1;
  815.     }
  816.     else
  817.     {
  818.         mysql_free_result();
  819.         return 0;
  820.     }
  821. }
  822.  
  823.  
  824.  
  825. /*
  826.  
  827.  • Function: IsPlayerBuyHouse(playerid, houseid)
  828.  • Usage: Checking if is player rented house and he is rent user of any house (used when you try to rent room but you already rented some house)!
  829.  • Parameters:
  830.         playerid: ID of player that you want preform check
  831.         houseid: ID of house that you want to check if is player buy house
  832.  • Example: if(IsPlayerBuyHouse(playerid, houseid)) return SendClientMessage(playerid, -1, "You buy this house already!");
  833.             else SendClientMessage(playerid, -1, "You didn't buy rent this house!");
  834.  
  835. */
  836.  
  837. stock IsPlayerBuyHouse(playerid, houseid)
  838. {
  839.     new HQuery2[200];
  840.     format(HQuery2, sizeof(HQuery2), "SELECT User FROM `house` WHERE `User` = '%s' AND `HouseID` = %d", GetName(playerid), houseid);
  841.     mysql_query(HQuery2);
  842.     mysql_store_result();
  843.     if(mysql_num_rows() == 1)
  844.     {
  845.         mysql_free_result();
  846.         return 1;
  847.     }
  848.     else
  849.     {
  850.         mysql_free_result();
  851.         return 0;
  852.     }
  853. }
  854.  
  855.  
  856.  
  857. /*
  858.  
  859.  • Function: IsPlayerRentHouse(playerid, houseid)
  860.  • Usage: Checking if is player rented house and he is rent user of any house (used when you try to rent room but you already rented some house)!
  861.  • Parameters:
  862.         playerid: ID of player that you want preform check
  863.         houseid: ID of house that you want to check if is player rented user
  864.  • Example: if(IsPlayerRentAnyHouse(playerid, houseid)) return SendClientMessage(playerid, -1, "You rent this house already!");
  865.             else SendClientMessage(playerid, -1, "You don't rent this house!");
  866.  
  867. */
  868.  
  869. stock IsPlayerRentHouse(playerid, houseid)
  870. {
  871.     new HQuery2[200];
  872.     format(HQuery2, sizeof(HQuery2), "SELECT `Rent User` FROM `house` WHERE `Rent User` = '%s' AND `HouseID` = %d", GetName(playerid), houseid);
  873.     mysql_query(HQuery2);
  874.     mysql_store_result();
  875.     if(mysql_num_rows() == 1)
  876.     {
  877.         mysql_free_result();
  878.         return 1;
  879.     }
  880.     else
  881.     {
  882.         mysql_free_result();
  883.         return 0;
  884.     }
  885. }
  886.  
  887.  
  888.  
  889. /*
  890.  
  891.  • Function: IsHouseExist(houseid)
  892.  • Usage: Checking if is player rented house and he is rent user of any house (used when you try to rent room but you already rented some house)!
  893.  • Parameters:
  894.         houseid: ID of house that you want to check if is exist
  895.  • Example: if(IsHouseExist(houseid)) return SendClientMessage(playerid, -1, "House exist!");
  896.             else SendClientMessage(playerid, -1, "House doesn't exist!");
  897.  
  898. */
  899.  
  900. stock IsHouseExist(houseid)
  901. {
  902.     new HQuery2[200];
  903.     format(HQuery2, sizeof(HQuery2), "SELECT HouseID FROM `house` WHERE `HouseID` = '%d'", houseid);
  904.     mysql_query(HQuery2);
  905.     mysql_store_result();
  906.     if(mysql_num_rows() == 1)
  907.     {
  908.         mysql_free_result();
  909.         return 1;
  910.     }
  911.     else
  912.     {
  913.         mysql_free_result();
  914.         return 0;
  915.     }
  916. }
  917.  
  918.  
  919.  
  920. /*
  921.  
  922.  • Function: IsPlayerHouseRentUser(playerid, houseid)
  923.  • Usage: Checking if is player rent user of specific house!
  924.  • Parameters:
  925.         playerid: ID of player that you want preform check
  926.         houseid: ID of house that you want to check if is player rent user
  927.  • Example: if(IsPlayerHouseRentUser(playerid, houseid)) return SendClientMessage(playerid, -1, "You are rent user of the house!");
  928.             else SendClientMessage(playerid, -1, "You are not rent user of the house!");
  929.  
  930. */
  931.  
  932. stock IsPlayerHouseRentUser(playerid, houseid)
  933. {
  934.     if(!strcmp(HouseInfo[houseid][hRentUser], GetName(playerid), false)) return 1;
  935.     else return 0;
  936. }
  937.  
  938.  
  939.  
  940. /*
  941.  
  942.  • Function: GetTotalHouses(playerid, houseid)
  943.  • Usage: Getting all houses, easiser than counting line etc.! Use this in OnGameModeInit after all houses!
  944.  • Example: printf("Total houses: %d", GetTotalHouses());
  945.  
  946. */
  947.  
  948. stock GetTotalHouses() return Iter_Count(Houses);
  949.  
  950.  
  951.  
  952. /*
  953.  
  954.  • Function: IsHouseWeaponSlotFree(houseid, slot)
  955.  • Usage: Checking if is slot free in stored weapons of specific house!
  956.  • Parameters:
  957.         houseid: ID of house that you want to check if is slot free
  958.         slot: Slot of stored weapons from 1-3!
  959.  • Example: if(IsHouseWeaponSlotFree(houseid, 1)) return SendClientMessage(playerid, -1, "Slot 1 is free!");
  960.             else SendClientMessage(playerid, -1, "Slot 1 is not free!");
  961.  
  962. */
  963.  
  964. stock IsHouseWeaponSlotFree(houseid, slot)
  965. {
  966.     switch(slot)
  967.     {
  968.         case 1:
  969.         {
  970.             if(HouseInfo[houseid][hWeaponID1] < 1) return 1;
  971.             else return 0;
  972.         }
  973.         case 2:
  974.         {
  975.             if(HouseInfo[houseid][hWeaponID2] < 1) return 1;
  976.             else return 0;
  977.         }
  978.         case 3:
  979.         {
  980.             if(HouseInfo[houseid][hWeaponID3] < 1) return 1;
  981.             else return 0;
  982.         }
  983.     }
  984.     return slot;
  985. }
  986.  
  987.  
  988.  
  989. /*
  990.  
  991.  • Function: SpawnPlayerAtHouse(playerid)
  992.  • Usage: Spawning player at his house, use this in OnPlayerSpawn!
  993.  • Parameters:
  994.         playerid: ID of player that you want to spawn!
  995.  • Example: SpawnPlayerAtHouse(playerid);
  996.  
  997. */
  998.  
  999. stock SpawnPlayerAtHouse(playerid)
  1000. {
  1001.     foreach(Houses, i)
  1002.     {
  1003.         if(!strcmp(HouseInfo[i][hOwner], GetName(playerid), false) || !strcmp(HouseInfo[i][hRentUser], GetName(playerid), false) && HouseInfo[i][hOwned] == 1)
  1004.         {
  1005.             new HQuery2[200];
  1006.             format(HQuery2, sizeof(HQuery2), "SELECT HouseID FROM `house` WHERE `HouseID` = '%d'", i);
  1007.             mysql_query(HQuery2);
  1008.             mysql_store_result();
  1009.             if(mysql_num_rows() == 1)
  1010.             {
  1011.                 SetPlayerPos(playerid, HouseInfo[i][hExitX], HouseInfo[i][hExitY], HouseInfo[i][hExitZ]);
  1012.                 SetPlayerInterior(playerid, HouseInfo[i][hInterior]);
  1013.                 SetPlayerVirtualWorld(playerid, HouseInfo[i][hVirtualWorld]);
  1014.                 PlayerEnteredHisHouse[playerid] = true;
  1015.                 mysql_free_result();
  1016.                 return 1;
  1017.             }
  1018.         }
  1019.     }
  1020.     return 0;
  1021. }
  1022.  
  1023.  
  1024.  
  1025. /*
  1026.  
  1027.  • Function: GetHouseCarID(houseid)
  1028.  • Usage: Getting vehicle ID of house car
  1029.  • Parameters:
  1030.         houseid: ID of house that you want to get vehicle ID
  1031.  • Example: format(string, sizeof(string), "Vehicle ID of House ID %d: %d", houseid, GetHouseCar(houseid));
  1032.  
  1033. */
  1034.  
  1035. stock GetHouseCarID(houseid) return HouseInfo[houseid][hVehicleID];
  1036.  
  1037.  
  1038.  
  1039. /*
  1040.  
  1041.  • Function: GetHouseCarPos(houseid)
  1042.  • Usage: Getting vehicle pos of house car
  1043.  • Parameters:
  1044.         houseid: ID of house that you want to get vehicle pos
  1045.  • Example: format(string, sizeof(string), "Vehicle pos of House ID %d: %s", houseid, GetHouseCarPos(houseid));
  1046.  
  1047. */
  1048.  
  1049. stock GetHouseCarPos(houseid)
  1050. {
  1051.     new getxyz[128];
  1052.     format(getxyz, sizeof(getxyz), "%f, %f, %f", HouseInfo[houseid][hCarX], HouseInfo[houseid][hCarY], HouseInfo[houseid][hCarZ]);
  1053.     return getxyz;
  1054. }
  1055.  
  1056.  
  1057. /*
  1058.  
  1059.  • Function: GetHouseCarAngle(houseid)
  1060.  • Usage: Getting vehicle angle of house car
  1061.  • Parameters:
  1062.         houseid: ID of house that you want to get vehicle angle
  1063.  • Example: format(string, sizeof(string), "Vehicle angle of House ID %d: %s", houseid, GetHouseCarAngle(houseid));
  1064.  
  1065. */
  1066.  
  1067. stock GetHouseCarAngle(houseid)
  1068. {
  1069.     new geta[128];
  1070.     format(geta, sizeof(geta), "%f", HouseInfo[houseid][hCarA]);
  1071.     return geta;
  1072. }
  1073.  
  1074.  
  1075.  
  1076. /*
  1077.  
  1078.  • Function: GetHouseCarColor1(houseid)
  1079.  • Usage: Getting vehicle color 1 of house car
  1080.  • Parameters:
  1081.         houseid: ID of house that you want to get vehicle color 1
  1082.  • Example: format(string, sizeof(string), "Vehicle color 1 of House ID %d: %d", houseid, GetHouseCarColor1(houseid));
  1083.  
  1084. */
  1085.  
  1086. stock GetHouseCarColor1(houseid) return HouseInfo[houseid][hCarColor1];
  1087.  
  1088.  
  1089. /*
  1090.  
  1091.  • Function: GetHouseCarColor2(houseid)
  1092.  • Usage: Getting vehicle color 2 of house car
  1093.  • Parameters:
  1094.         houseid: ID of house that you want to get vehicle color 2
  1095.  • Example: format(string, sizeof(string), "Vehicle color 2 of House ID %d: %d", houseid, GetHouseCarColor2(houseid));
  1096.  
  1097. */
  1098.  
  1099. stock GetHouseCarColor2(houseid) return HouseInfo[houseid][hCarColor2];
  1100.  
  1101.  
  1102.  
  1103. /*
  1104.  
  1105.  • Function: GetHouseCarWeaponID1(houseid)
  1106.  • Usage: Getting weapon id 1 of house car
  1107.  • Parameters:
  1108.         houseid: ID of house that you want to get vehicle weapon id 1
  1109.  • Example: format(string, sizeof(string), "Vehicle weapon id 1 of House ID %d: %d", houseid, GetHouseCarWeaponID1(houseid));
  1110.  
  1111. */
  1112.  
  1113. stock GetHouseCarWeaponID1(houseid) return HouseInfo[houseid][hCarWeaponID1];
  1114.  
  1115.  
  1116.  
  1117. /*
  1118.  
  1119.  • Function: GetHouseCarWeaponID2(houseid)
  1120.  • Usage: Getting weapon id 2 of house car
  1121.  • Parameters:
  1122.         houseid: ID of house that you want to get vehicle weapon id 2
  1123.  • Example: format(string, sizeof(string), "Vehicle weapon id 2 of House ID %d: %d", houseid, GetHouseCarWeaponID2(houseid));
  1124.  
  1125. */
  1126.  
  1127. stock GetHouseCarWeaponID2(houseid) return HouseInfo[houseid][hCarWeaponID2];
  1128.  
  1129.  
  1130.  
  1131. /*
  1132.  
  1133.  • Function: GetHouseCarWeaponID1Ammo(houseid)
  1134.  • Usage: Getting weapon id 1 ammo of house car
  1135.  • Parameters:
  1136.         houseid: ID of house that you want to get vehicle weapon id 1 ammo
  1137.  • Example: format(string, sizeof(string), "Vehicle weapon id 1 ammo of House ID %d: %d", houseid, GetHouseCarWeaponID1Ammo(houseid));
  1138.  
  1139. */
  1140.  
  1141. stock GetHouseCarWeaponID1Ammo(houseid) return HouseInfo[houseid][hCarWeaponID1Ammo];
  1142.  
  1143.  
  1144.  
  1145. /*
  1146.  
  1147.  • Function: GetHouseCarWeaponID2Ammo(houseid)
  1148.  • Usage: Getting weapon id 2 ammo of house car
  1149.  • Parameters:
  1150.         houseid: ID of house that you want to get vehicle weapon id 2 ammo
  1151.  • Example: format(string, sizeof(string), "Vehicle weapon id 2 ammo of House ID %d: %d", houseid, GetHouseCarWeaponID2Ammo(houseid));
  1152.  
  1153. */
  1154.  
  1155. stock GetHouseCarWeaponID2Ammo(houseid) return HouseInfo[houseid][hCarWeaponID2Ammo];
  1156.  
  1157.  
  1158. /*
  1159.  
  1160.  • Function: GetHouseCarWeaponID1Name(houseid)
  1161.  • Usage: Getting name of weapon id 1 of house car
  1162.  • Parameters:
  1163.         houseid: ID of house that you want to get vehicle name of weapon id 1
  1164.  • Example: format(string, sizeof(string), "Vehicle weapon id 1 name of House ID %d: %s", houseid, GetHouseCarWeaponID1Name(houseid));
  1165.  
  1166. */
  1167.  
  1168. stock GetHouseCarWeaponID1Name(houseid)
  1169. {
  1170.     new weaponid[128], weaponid2[128];
  1171.     format(weaponid, sizeof(weaponid), "%s", GetWeapon(HouseInfo[houseid][hCarWeaponID1]));
  1172.     format(weaponid2, sizeof(weaponid2), "Nothing");
  1173.     if(HouseInfo[houseid][hCarWeaponID1] > 0) return weaponid;
  1174.     else return weaponid2;
  1175. }
  1176.  
  1177.  
  1178.  
  1179. /*
  1180.  
  1181.  • Function: GetHouseCarWeaponID2Name(houseid)
  1182.  • Usage: Getting name of weapon id 2 of house car
  1183.  • Parameters:
  1184.         houseid: ID of house that you want to get vehicle name of weapon id 2
  1185.  • Example: format(string, sizeof(string), "Vehicle weapon id 2 name of House ID %d: %s", houseid, GetHouseCarWeaponID2Name(houseid));
  1186.  
  1187. */
  1188.  
  1189. stock GetHouseCarWeaponID2Name(houseid)
  1190. {
  1191.     new weaponid[128], weaponid2[128];
  1192.     format(weaponid, sizeof(weaponid), "%s", GetWeapon(HouseInfo[houseid][hCarWeaponID2]));
  1193.     format(weaponid2, sizeof(weaponid2), "Nothing");
  1194.     if(HouseInfo[houseid][hCarWeaponID2] > 0) return weaponid;
  1195.     else return weaponid2;
  1196. }
  1197.  
  1198.  
  1199.  
  1200. /*
  1201.  
  1202.  • Function: GetHouseCarMoney(houseid)
  1203.  • Usage: Getting money of house car
  1204.  • Parameters:
  1205.         houseid: ID of house that you want to get vehicle money
  1206.  • Example: format(string, sizeof(string), "Vehicle money of House ID %d: %d", houseid, GetHouseCarMoney(houseid));
  1207.  
  1208. */
  1209.  
  1210. stock GetHouseCarMoney(houseid) return HouseInfo[houseid][hCarMoney];
  1211.  
  1212.  
  1213.  
  1214. /*
  1215.  
  1216.  • Function: IsHouseCarLocked(houseid)
  1217.  • Usage: Checking if is hosue car locked
  1218.  • Parameters:
  1219.         houseid: ID of house that you want to check if is house car locked
  1220.  • Example: if(IsHouseCarLocked(houseid)) SendClientMessae(playerid, -1, "House car is locked!");
  1221.             else SendClientMessage(playerid, -1, "House car is not locked!");
  1222.  
  1223. */
  1224.  
  1225. stock IsHouseCarLocked(houseid)
  1226. {
  1227.     if(HouseInfo[houseid][hCarLocked] == 1) return 1;
  1228.     else return 0;
  1229. }
  1230.  
  1231. //----Stocks for easier scripting!----
  1232. /*stock GetName(playerid)
  1233. {
  1234.     new pName[MAX_PLAYER_NAME];
  1235.     GetPlayerName(playerid, pName, MAX_PLAYER_NAME);
  1236.     return pName;
  1237. }
  1238.  
  1239. stock GetWeapon(weaponid)
  1240. {
  1241.     new gunname[32];
  1242.     GetWeaponName(weaponid, gunname, sizeof(gunname));
  1243.     return gunname;
  1244. }*/
  1245.  
  1246. stock Custom_GetPlayerWeapon(playerid)
  1247. {
  1248.     for(new w = 0; w < 13; w++)
  1249.     {
  1250.         GetPlayerWeaponData(playerid, w, House_Weapon[playerid][w], House_Ammo[playerid][w]);
  1251.     }
  1252.     return 1;
  1253. }
  1254.  
  1255. stock Custom_GetSlot(weaponid)
  1256. {
  1257.     new slot;
  1258.     if(weaponid == 0 || weaponid == 1){slot = 0;}
  1259.     else if(weaponid > 8 && weaponid < 10){slot = 1;}
  1260.     else if(weaponid > 9 && weaponid < 16){slot = 10;}
  1261.     else if(weaponid > 15 && weaponid < 20){slot = 8;}
  1262.     else if(weaponid > 21 && weaponid < 25){slot = 2;}
  1263.     else if(weaponid > 24 && weaponid < 28){slot = 3;}
  1264.     else if(weaponid == 28 || weaponid == 29 || weaponid == 32){slot = 4;}
  1265.     else if(weaponid == 30 || weaponid == 31){slot = 5;}
  1266.     else if(weaponid == 33 || weaponid == 34){slot = 6;}
  1267.     else if(weaponid > 34 || weaponid < 39){slot = 7;}
  1268.     return slot;
  1269. }
  1270.  
  1271. stock IsPlayerNearPlayer(playerid, playerid2, Float: radius)
  1272. {
  1273.     new Float: pPos[4];
  1274.     GetPlayerPos(playerid2, pPos[0], pPos[1], pPos[2]);
  1275.     if(IsPlayerInRangeOfPoint(playerid, radius, pPos[0], pPos[1], pPos[2])) return 1;
  1276.     return 0;
  1277. }
  1278. //----End of stocks!----
  1279.  
  1280.  
  1281. //*****************************          *****************************
  1282. //***************************** COMMANDS *****************************
  1283. //*****************************          *****************************
  1284.  
  1285.  
  1286.  
  1287.  
  1288. /*
  1289.  
  1290.  • Command: /buyhouse
  1291.  • Processor: y_commands (YCMD)
  1292.  • Usage: Buying house (Player must be in range of house he want to buy!)
  1293.  
  1294. */
  1295.  
  1296. YCMD:buyhouse(playerid, params[], help)
  1297. {
  1298.     #pragma unused help
  1299.     #pragma unused params
  1300.     foreach(Houses, i)
  1301.     {
  1302.         if(IsPlayerInRangeOfPoint(playerid, 3.0, HouseInfo[i][hEnterX], HouseInfo[i][hEnterY], HouseInfo[i][hEnterZ]))
  1303.         {
  1304.             if(HouseInfo[i][hOwned] == 1) return SendClientMessage(playerid, COLOR_KRED, "House is already owned!");
  1305.             if(GetPlayerMoney(playerid) < HouseInfo[i][hPrice]) return SendClientMessage(playerid, COLOR_KRED, "You don't have enough money!");
  1306.            
  1307.             new HQuery2[200];
  1308.             format(HQuery2, sizeof(HQuery2), "SELECT User FROM `house` WHERE `User` = '%s'", GetName(playerid));
  1309.             mysql_query(HQuery2);
  1310.             mysql_store_result();
  1311.             if(mysql_num_rows() == 1) return SendClientMessage(playerid, COLOR_KRED, "You have house already!");
  1312.             mysql_free_result();
  1313.  
  1314.             format(HouseInfo[i][hOwner], 24, "%s", GetName(playerid));
  1315.             format(HouseInfo[i][hCarOwner], 24, "%s", GetName(playerid));
  1316.             HouseInfo[i][hOwned] = 1;
  1317.             DestroyPickup(HouseInfo[i][hPickup]);
  1318.             HouseInfo[i][hPickup] = CreatePickup(1239, 23, HouseInfo[i][hEnterX], HouseInfo[i][hEnterY], HouseInfo[i][hEnterZ], 0);
  1319.             format(hstring, sizeof(hstring), "Owner: %s\nHouse ID: %d\nRent User: %s\nRent Price: %d", HouseInfo[i][hOwner], i, HouseInfo[i][hRentUser], HouseInfo[i][hRentPrice]);
  1320.             Update3DTextLabelText(HouseInfo[i][hLabel], 0x21DD00FF, hstring);
  1321.             GivePlayerMoney(playerid, -HouseInfo[i][hPrice]);
  1322.             SendClientMessage(playerid, COLOR_LIME, "House bought!");
  1323.            
  1324.             format(HQuery, sizeof(HQuery), "UPDATE `house` SET `User` = '%s', `Car Owner` = '%s', `Owned` = 1 WHERE `HouseID` = %d", GetName(playerid), GetName(playerid), i);
  1325.             mysql_query(HQuery);
  1326.         }
  1327.     }
  1328.     return 1;
  1329. }
  1330.  
  1331. /*
  1332.  
  1333.  • Command: /sellhouse
  1334.  • Processor: y_commands (YCMD)
  1335.  • Usage: Selling house (Player must be in range of house he want to sell!)
  1336.  
  1337. */
  1338.  
  1339. YCMD:sellhouse(playerid, params[], help)
  1340. {
  1341.     #pragma unused help
  1342.     #pragma unused params
  1343.     foreach(Houses, i)
  1344.     {
  1345.         if(IsPlayerInRangeOfPoint(playerid, 3.0, HouseInfo[i][hEnterX], HouseInfo[i][hEnterY], HouseInfo[i][hEnterZ]))
  1346.         {
  1347.             if(!strcmp(HouseInfo[i][hOwner], GetName(playerid), false))
  1348.             {
  1349.                 format(HouseInfo[i][hOwner], 24, "None");
  1350.                 format(HouseInfo[i][hRentUser], 24, "None");
  1351.                 format(HouseInfo[i][hCarOwner], 24, "None");
  1352.                 HouseInfo[i][hOwned] = 0;
  1353.                 HouseInfo[i][hLocked] = 0;
  1354.                 HouseInfo[i][hRented] = 0;
  1355.                 DestroyPickup(HouseInfo[i][hPickup]);
  1356.                 HouseInfo[i][hPickup] = CreatePickup(1273, 23, HouseInfo[i][hEnterX], HouseInfo[i][hEnterY], HouseInfo[i][hEnterZ], 0);
  1357.                 format(hstring, sizeof(hstring), "For sale!\nPrice: %d\nHouse ID: %d\nType /buyhouse to buy house!", HouseInfo[i][hPrice], i);
  1358.                 Update3DTextLabelText(HouseInfo[i][hLabel], 0x21DD00FF, hstring);
  1359.                 GivePlayerMoney(playerid, HouseInfo[i][hPrice]);
  1360.                 SendClientMessage(playerid, COLOR_LIME, "House sold!");
  1361.  
  1362.                 format(HQuery, sizeof(HQuery), "UPDATE `house` SET `User` = 'None', `Owned` = 0, `Locked` = 0, `Rent User` = 'None', `Rented` = 0 WHERE `HouseID` = %d", i);
  1363.                 mysql_query(HQuery);
  1364.             }
  1365.         }
  1366.     }
  1367.     return 1;
  1368. }
  1369.  
  1370. /*
  1371.  
  1372.  • Command: /sellhouseto
  1373.  • Processor: y_commands (YCMD)
  1374.  • Usage: Selling house to other player (must be near you!)
  1375.  • Parameters:
  1376.         id: The id of player you want to sell house
  1377.  
  1378. */
  1379.  
  1380. YCMD:sellhouseto(playerid, params[], help)
  1381. {
  1382.     #pragma unused help
  1383.     #pragma unused params
  1384.     new id, selltostring[128];
  1385.     foreach(Houses, i)
  1386.     {
  1387.         if(IsPlayerInRangeOfPoint(playerid, 3.0, HouseInfo[i][hEnterX], HouseInfo[i][hEnterY], HouseInfo[i][hEnterZ]))
  1388.         {
  1389.             if(!strcmp(HouseInfo[i][hOwner], GetName(playerid), false))
  1390.             {
  1391.                 if(sscanf(params, "i", id)) return SendClientMessage(playerid, -1, "Usage: /sellhouseto [ID]");
  1392.                 else if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, -1, "Invalid ID");
  1393.                 else if(id == playerid) return SendClientMessage(playerid, -1, "You can't sell house to yourself!");
  1394.                 if(!IsPlayerNearPlayer(playerid, id, 7.0)) return SendClientMessage(playerid, -1, "Player is not near you!");
  1395.                 format(selltostring, sizeof(selltostring), "Do you want to buy house from player %s for %d$?", GetName(playerid), HouseInfo[i][hPrice]);
  1396.                 ShowPlayerDialog(id, 5688, DIALOG_STYLE_MSGBOX, "  Buy house", selltostring, "Yes", "No");
  1397.                 SetPVarInt(id, "Seller", playerid);
  1398.             }
  1399.         }
  1400.     }
  1401.     return 1;
  1402. }
  1403.  
  1404. /*
  1405.  
  1406.  • Command: /lockhouse
  1407.  • Processor: y_commands (YCMD)
  1408.  • Usage: Locking house (Player must be in range of his house to lock it!)
  1409.  
  1410. */
  1411.  
  1412. YCMD:lockhouse(playerid, params[], help)
  1413. {
  1414.     #pragma unused help
  1415.     #pragma unused params
  1416.     foreach(Houses, i)
  1417.     {
  1418.         if(IsPlayerInRangeOfPoint(playerid, 3.0, HouseInfo[i][hEnterX], HouseInfo[i][hEnterY], HouseInfo[i][hEnterZ]) || IsPlayerInRangeOfPoint(playerid, 3.0, HouseInfo[i][hExitX], HouseInfo[i][hExitY], HouseInfo[i][hExitZ]))
  1419.         {
  1420.             if(!strcmp(HouseInfo[i][hOwner], GetName(playerid), false) || !strcmp(HouseInfo[i][hRentUser], GetName(playerid), false))
  1421.             {
  1422.                 HouseInfo[i][hLocked] = 1;
  1423.                 GameTextForPlayer(playerid, "House ~r~locked!", 2000, 5);
  1424.  
  1425.                 format(HQuery, sizeof(HQuery), "UPDATE `house` SET `Locked` = 1 WHERE `HouseID` = %d", i);
  1426.                 mysql_query(HQuery);
  1427.             }
  1428.         }
  1429.     }
  1430.     return 1;
  1431. }
  1432.  
  1433. /*
  1434.  
  1435.  • Command: /unlockhouse
  1436.  • Processor: y_commands (YCMD)
  1437.  • Usage: Unlocking house (Player must be in range of his house to unlock it!)
  1438.  
  1439. */
  1440.  
  1441. YCMD:unlockhouse(playerid, params[], help)
  1442. {
  1443.     #pragma unused help
  1444.     #pragma unused params
  1445.     foreach(Houses, i)
  1446.     {
  1447.         if(IsPlayerInRangeOfPoint(playerid, 3.0, HouseInfo[i][hEnterX], HouseInfo[i][hEnterY], HouseInfo[i][hEnterZ]) || IsPlayerInRangeOfPoint(playerid, 3.0, HouseInfo[i][hExitX], HouseInfo[i][hExitY], HouseInfo[i][hExitZ]))
  1448.         {
  1449.             if(!strcmp(HouseInfo[i][hOwner], GetName(playerid), false) || !strcmp(HouseInfo[i][hRentUser], GetName(playerid), false))
  1450.             {
  1451.                 HouseInfo[i][hLocked] = 0;
  1452.                 GameTextForPlayer(playerid, "House ~g~unlocked!", 2000, 5);
  1453.  
  1454.                 format(HQuery, sizeof(HQuery), "UPDATE `house` SET `Locked` = 0 WHERE `HouseID` = %d", i);
  1455.                 mysql_query(HQuery);
  1456.             }
  1457.         }
  1458.     }
  1459.     return 1;
  1460. }
  1461.  
  1462. /*
  1463.  
  1464.  • Command: /rentroom
  1465.  • Processor: y_commands (YCMD)
  1466.  • Usage: Renting room (house) (Player must be in range of house that he want to rent it!)
  1467.  
  1468. */
  1469.  
  1470. YCMD:rentroom(playerid, params[], help)
  1471. {
  1472.     #pragma unused help
  1473.     #pragma unused params
  1474.     foreach(Houses, i)
  1475.     {
  1476.         if(IsPlayerInRangeOfPoint(playerid, 3.0, HouseInfo[i][hEnterX], HouseInfo[i][hEnterY], HouseInfo[i][hEnterZ]))
  1477.         {
  1478.             if(HouseInfo[i][hOwned] == 1)
  1479.             {
  1480.  
  1481.                 new HQuery2[200], HQuery3[200];
  1482.                 format(HQuery2, sizeof(HQuery2), "SELECT `Rent User` FROM `house` WHERE `Rent User` = '%s'", GetName(playerid));
  1483.                 mysql_query(HQuery2);
  1484.                 mysql_store_result();
  1485.                 if(mysql_num_rows() == 1) return SendClientMessage(playerid, COLOR_KRED, "You have rented house already!");
  1486.                 mysql_free_result();
  1487.                
  1488.                 format(HQuery3, sizeof(HQuery3), "SELECT User FROM `house` WHERE `User` = '%s'", GetName(playerid));
  1489.                 mysql_query(HQuery3);
  1490.                 mysql_store_result();
  1491.                 if(mysql_num_rows() == 1) return SendClientMessage(playerid, COLOR_KRED, "You have house!");
  1492.                 mysql_free_result();
  1493.            
  1494.                 if(GetPlayerMoney(playerid) < HouseInfo[i][hRentPrice]) return SendClientMessage(playerid, COLOR_KRED, "You don't have enough money!");
  1495.                 if(HouseInfo[i][hRented] == 1) return SendClientMessage(playerid, COLOR_KRED, "House is already rented!");
  1496.                 if(HouseInfo[i][hRentDisabled] == 1) return SendClientMessage(playerid, COLOR_KRED, "Renting this house is disabled!");
  1497.                 format(HouseInfo[i][hRentUser], 24, "%s", GetName(playerid));
  1498.                 HouseInfo[i][hRented] = 1;
  1499.                 GivePlayerMoney(playerid, -HouseInfo[i][hRentPrice]);
  1500.                 format(hstring, sizeof(hstring), "Owner: %s\nHouse ID: %d\nRent User: %s\nRent Price: %d", HouseInfo[i][hOwner], i, HouseInfo[i][hRentUser], HouseInfo[i][hRentPrice]);
  1501.                 Update3DTextLabelText(HouseInfo[i][hLabel], 0x21DD00FF, hstring);
  1502.                 SendClientMessage(playerid, COLOR_YELLOW, "Now you rent this house!");
  1503.  
  1504.                 format(HQuery, sizeof(HQuery), "UPDATE `house` SET `Rent User` = '%s', `Rented` = 1 WHERE `HouseID` = %d", HouseInfo[i][hRentUser], i);
  1505.                 mysql_query(HQuery);
  1506.             }
  1507.             else SendClientMessage(playerid, COLOR_KRED, "That house is not owned! You can buy it but not rent it!");
  1508.         }
  1509.     }
  1510.     return 1;
  1511. }
  1512.  
  1513. /*
  1514.  
  1515.  • Command: /stoprent
  1516.  • Processor: y_commands (YCMD)
  1517.  • Usage: Stop renting room (house) (Player must be in range of his rented house to stop renting it!)
  1518.  
  1519. */
  1520.  
  1521. YCMD:stoprent(playerid, params[], help)
  1522. {
  1523.     #pragma unused help
  1524.     #pragma unused params
  1525.     foreach(Houses, i)
  1526.     {
  1527.         if(IsPlayerInRangeOfPoint(playerid, 3.0, HouseInfo[i][hEnterX], HouseInfo[i][hEnterY], HouseInfo[i][hEnterZ]))
  1528.         {
  1529.             if(HouseInfo[i][hOwned] == 1)
  1530.             {
  1531.                 if(strcmp(HouseInfo[i][hRentUser], GetName(playerid), false)) return SendClientMessage(playerid, COLOR_KRED, "You don't rent this room!");
  1532.                 format(HouseInfo[i][hRentUser], 24, "None");
  1533.                 HouseInfo[i][hRented] = 0;
  1534.                 format(hstring, sizeof(hstring), "Owner: %s\nHouse ID: %d\nRent User: %s\nRent Price: %d", HouseInfo[i][hOwner], i, HouseInfo[i][hRentUser], HouseInfo[i][hRentPrice]);
  1535.                 Update3DTextLabelText(HouseInfo[i][hLabel], 0x21DD00FF, hstring);
  1536.                 SendClientMessage(playerid, COLOR_YELLOW, "You stop renting this house!");
  1537.  
  1538.                 format(HQuery, sizeof(HQuery), "UPDATE `house` SET `Rent User` = 'None', `Rented` = 0 WHERE `HouseID` = %d", i);
  1539.                 mysql_query(HQuery);
  1540.             }
  1541.             else SendClientMessage(playerid, COLOR_KRED, "That house is not owned!");
  1542.         }
  1543.     }
  1544.     return 1;
  1545. }
  1546.  
  1547. /*
  1548.  
  1549.  • Command: /housecontrol
  1550.  • Processor: y_commands (YCMD)
  1551.  • Usage: Controling your house: lock house, unlock house, set rent price, storing weapons in house, taking weapons from house, storing money in house, taking money from house & kicking rented user from house (Player must be in his house to control it!)
  1552.  
  1553. */
  1554.  
  1555. YCMD:housecontrol(playerid, params[], help)
  1556. {
  1557.     #pragma unused help
  1558.     #pragma unused params
  1559.     foreach(Houses, i)
  1560.     {
  1561.         if(IsPlayerInRangeOfPoint(playerid, 20.0, HouseInfo[i][hExitX], HouseInfo[i][hExitY], HouseInfo[i][hExitZ]))
  1562.         {
  1563.             if(!strcmp(HouseInfo[i][hOwner], GetName(playerid), false) && PlayerEnteredHisHouse[playerid] == true)
  1564.             {
  1565.                 ShowPlayerDialog(playerid, 5678, DIALOG_STYLE_LIST, "   Control your house!", "Lock house\nUnlock house\nSet rent price\nStore weapon\nTake weapon\nStore money\nTake money\nKick rent user\nBuy alarm | $2000\nSell alarm", "Ok", "Exit");
  1566.             }
  1567.             else SendClientMessage(playerid, COLOR_KRED, "You must enter your house!");
  1568.         }
  1569.     }
  1570.     return 1;
  1571. }
  1572.  
  1573. /*
  1574.  
  1575.  • Command: /houseinfo
  1576.  • Processor: y_commands (YCMD)
  1577.  • Usage: Getting stats of your house, is locked, unlocked blabalba
  1578.  
  1579. */
  1580.  
  1581. YCMD:housestats(playerid, params[], help)
  1582. {
  1583.     #pragma unused help
  1584.     #pragma unused params
  1585.     foreach(Houses, i)
  1586.     {
  1587.         format(HQuery, sizeof(HQuery), "SELECT HouseID FROM `house` WHERE `HouseID` = '%d'", i);
  1588.         mysql_query(HQuery);
  1589.         mysql_store_result();
  1590.         if(mysql_num_rows() == 1)
  1591.         {
  1592.             if(!strcmp(HouseInfo[i][hOwner], GetName(playerid), false))
  1593.             {
  1594.                 new gunstring1[128], gunstring2[128], gunstring3[128];
  1595.                 if(HouseInfo[i][hWeaponID1] == 0) format(gunstring1, sizeof(gunstring1), "{FFFFFF}Weapon: {F81414}Nothing");
  1596.                 else format(gunstring1, sizeof(gunstring1), "{FFFFFF}Weapon: {F81414}%s {FFFFFF}| Ammo: {F81414}%d", GetWeapon(HouseInfo[i][hWeaponID1]), HouseInfo[i][hWeaponID1Ammo]);
  1597.  
  1598.                 if(HouseInfo[i][hWeaponID2] == 0) format(gunstring2, sizeof(gunstring1), "{FFFFFF}Weapon: {F81414}Nothing");
  1599.                 else format(gunstring2, sizeof(gunstring2), "{FFFFFF}Weapon: {F81414}%s {FFFFFF}| Ammo: {F81414}%d", GetWeapon(HouseInfo[i][hWeaponID2]), HouseInfo[i][hWeaponID2Ammo]);
  1600.  
  1601.                 if(HouseInfo[i][hWeaponID3] == 0) format(gunstring3, sizeof(gunstring1), "{FFFFFF}Weapon: {F81414}Nothing");
  1602.                 else format(gunstring3, sizeof(gunstring3), "{FFFFFF}Weapon: {F81414}%s {FFFFFF}| Ammo: {F81414}%d", GetWeapon(HouseInfo[i][hWeaponID3]), HouseInfo[i][hWeaponID3Ammo]);
  1603.                
  1604.                 format(hstring, 256, "{FFFFFF}Money: {F81414}%d\n{FFFFFF}Rent User: {F81414}%s\n{FFFFFF}Price: {F81414}%d\n{FFFFFF}Rent Price: {F81414}%d\n%s\n%s\n%s", HouseInfo[i][hMoney], HouseInfo[i][hRentUser], HouseInfo[i][hPrice], HouseInfo[i][hRentPrice], gunstring1, gunstring2, gunstring3);
  1605.                 ShowPlayerDialog(playerid, 500, DIALOG_STYLE_MSGBOX, "   House information!", hstring, "Ok", "");
  1606.             }
  1607.         }
  1608.         mysql_free_result();
  1609.     }
  1610.     return 1;
  1611. }
  1612.  
  1613. /*
  1614.  
  1615.  • Command: /breaklock
  1616.  • Processor: y_commands (YCMD)
  1617.  • Usage: Breaking lock of house
  1618.  
  1619. */
  1620.  
  1621. YCMD:breaklock(playerid, params[], help)
  1622. {
  1623.     #pragma unused help
  1624.     #pragma unused params
  1625.     foreach(Houses, i)
  1626.     {
  1627.         if(IsPlayerInRangeOfPoint(playerid, 3.0, HouseInfo[i][hEnterX], HouseInfo[i][hEnterY], HouseInfo[i][hEnterZ]))
  1628.         {
  1629.             if(!strcmp(HouseInfo[i][hOwner], GetName(playerid), false) || !strcmp(HouseInfo[i][hRentUser], GetName(playerid), false)) return SendClientMessage(playerid, COLOR_KRED, "You can't break lock of your house!");
  1630.             if(HouseInfo[i][hOwned] == 0) return SendClientMessage(playerid, COLOR_KRED, "That house is not owned!");
  1631.             if(HouseInfo[i][hLocked] == 0) return SendClientMessage(playerid, COLOR_KRED, "That house is not locked!");
  1632.             SendClientMessage(playerid, COLOR_LIME, "Breaking house lock...");
  1633.             TogglePlayerControllable(playerid, 0);
  1634.             HouseLockBreaking[playerid] = SetTimerEx("BreakingLock", 5000, 0, "d", playerid);
  1635.         }
  1636.     }
  1637.     return 1;
  1638. }
  1639.  
  1640. /*
  1641.  
  1642.  • Command: /asellhouse (RCON Admins only)
  1643.  • Processor: y_commands (YCMD)
  1644.  • Usage: Selling specific house
  1645.  • Parameters:
  1646.         houseid: you don't need to be in range of house, just type ID of house that you want to sell!
  1647.  
  1648. */
  1649.  
  1650. YCMD:asellhouse(playerid, params[], help)
  1651. {
  1652.     #pragma unused help
  1653.     new houseid;
  1654.     if(IsPlayerAdmin(playerid))
  1655.     {
  1656.         if(sscanf(params, "i", houseid)) return SendClientMessage(playerid, -1, "Usage: /asellhouse [House ID]");
  1657.         else if(houseid <= -1) return SendClientMessage(playerid, -1, "Invalid ID");
  1658.         else if(HouseInfo[houseid][hOwned] == 0) return SendClientMessage(playerid, -1, "That house is not owned!");
  1659.         else
  1660.         format(HouseInfo[houseid][hOwner], 24, "None");
  1661.         format(HouseInfo[houseid][hRentUser], 24, "None");
  1662.         HouseInfo[houseid][hOwned] = 0;
  1663.         HouseInfo[houseid][hLocked] = 0;
  1664.         HouseInfo[houseid][hRented] = 0;
  1665.         DestroyPickup(HouseInfo[houseid][hPickup]);
  1666.         HouseInfo[houseid][hPickup] = CreatePickup(1273, 23, HouseInfo[houseid][hEnterX], HouseInfo[houseid][hEnterY], HouseInfo[houseid][hEnterZ], 0);
  1667.         format(hstring, sizeof(hstring), "For sale!\nPrice: %d\nHouse ID: %d\nType /buyhouse to buy house!", HouseInfo[houseid][hPrice], houseid);
  1668.         Update3DTextLabelText(HouseInfo[houseid][hLabel], 0x21DD00FF, hstring);
  1669.         SendClientMessage(playerid, COLOR_LIME, "House sold!");
  1670.  
  1671.         format(HQuery, sizeof(HQuery), "UPDATE `house` SET `User` = 'None', `Owned` = 0, `Locked` = 0, `Rent User` = 'None', `Rented` = 0 WHERE `HouseID` = %d", houseid);
  1672.         mysql_query(HQuery);
  1673.        
  1674.     }
  1675.     else SendClientMessage(playerid, COLOR_KRED, "Only RCON admin can use this!");
  1676.     return 1;
  1677. }
  1678.  
  1679. /*
  1680.  
  1681.  • Command: /asetprice (RCON Admins only)
  1682.  • Processor: y_commands (YCMD)
  1683.  • Usage: Setting price of specific house
  1684.  • Parameters:
  1685.         houseid: you don't need to be in range of house, just type ID of house that you want to sell!
  1686.         price: price that you want to set
  1687.  
  1688. */
  1689.  
  1690. YCMD:asetprice(playerid, params[], help)
  1691. {
  1692.     #pragma unused help
  1693.     new houseid, price, pricestring[128];
  1694.     if(IsPlayerAdmin(playerid))
  1695.     {
  1696.         if(sscanf(params, "ii", houseid, price)) return SendClientMessage(playerid, -1, "Usage: /asetprice [House ID][Price]");
  1697.         else if(houseid <= -1) return SendClientMessage(playerid, -1, "Invalid ID");
  1698.         else if(HouseInfo[houseid][hOwned] == 1) return SendClientMessage(playerid, -1, "That house is owned!");
  1699.         else
  1700.         HouseInfo[houseid][hPrice] = price;
  1701.         format(hstring, sizeof(hstring), "For sale!\nPrice: %d\nHouse ID: %d\nType /buyhouse to buy house!", HouseInfo[houseid][hPrice], houseid);
  1702.         Update3DTextLabelText(HouseInfo[houseid][hLabel], 0x21DD00FF, hstring);
  1703.         format(pricestring, sizeof(pricestring), "House price set on %d!", price);
  1704.         SendClientMessage(playerid, COLOR_LIME, pricestring);
  1705.  
  1706.         format(HQuery, sizeof(HQuery), "UPDATE `house` SET `Price` = %d WHERE `HouseID` = %d", price, houseid);
  1707.         mysql_query(HQuery);
  1708.  
  1709.     }
  1710.     else SendClientMessage(playerid, COLOR_KRED, "Only RCON admin can use this!");
  1711.     return 1;
  1712. }
  1713.  
  1714. /*
  1715.  
  1716.  • Command: /agotohouse (RCON Admins only)
  1717.  • Processor: y_commands (YCMD)
  1718.  • Usage: Teleporting to a specific house
  1719.  • Parameters:
  1720.         houseid: you don't need to be in range of house, just type ID of house that you want to go!
  1721.  
  1722. */
  1723.  
  1724. YCMD:agotohouse(playerid, params[], help)
  1725. {
  1726.     #pragma unused help
  1727.     new houseid;
  1728.     if(IsPlayerAdmin(playerid))
  1729.     {
  1730.         if(sscanf(params, "i", houseid)) return SendClientMessage(playerid, -1, "Usage: /agotohouse [House ID]");
  1731.         else if(houseid <= -1) return SendClientMessage(playerid, -1, "Invalid ID");
  1732.         new HQuery2[200];
  1733.         format(HQuery2, sizeof(HQuery2), "SELECT HouseID FROM `house` WHERE `HouseID` = '%d'", houseid);
  1734.         mysql_query(HQuery2);
  1735.         mysql_store_result();
  1736.         if(mysql_num_rows() == 0) return SendClientMessage(playerid, COLOR_KRED, "House doesn't exist!");
  1737.         mysql_free_result();
  1738.            
  1739.         SetPlayerPos(playerid, HouseInfo[houseid][hEnterX], HouseInfo[houseid][hEnterY], HouseInfo[houseid][hEnterZ]);
  1740.         SendClientMessage(playerid, COLOR_LIME, "You have been teleported to the house!");
  1741.     }
  1742.     else SendClientMessage(playerid, COLOR_KRED, "Only RCON admin can use this!");
  1743.     return 1;
  1744. }
  1745.  
  1746. /*
  1747.  
  1748.  • Command: /lockhousecar
  1749.  • Processor: y_commands (YCMD)
  1750.  • Usage: Locking your house car
  1751.  
  1752. */
  1753.  
  1754. YCMD:lockhousecar(playerid, params[], help)
  1755. {
  1756.     #pragma unused help
  1757.     #pragma unused params
  1758.     foreach(Houses, i)
  1759.     {
  1760.         new HQuery2[200];
  1761.         format(HQuery2, sizeof(HQuery2), "SELECT HouseID FROM `house` WHERE `HouseID` = '%d'", i);
  1762.         mysql_query(HQuery2);
  1763.         mysql_store_result();
  1764.         if(!strcmp(HouseInfo[i][hCarOwner], GetName(playerid), false))
  1765.         {
  1766.             HouseInfo[i][hCarLocked] = 1;
  1767.             GameTextForPlayer(playerid, "House car ~r~locked!", 2000, 5);
  1768.  
  1769.             format(HQuery, sizeof(HQuery), "UPDATE `house` SET `Car Locked` = 1 WHERE `HouseID` = %d", i);
  1770.             mysql_query(HQuery);
  1771.         }
  1772.         mysql_free_result();
  1773.     }
  1774.     return 1;
  1775. }
  1776.  
  1777. /*
  1778.  
  1779.  • Command: /unlockhousecar
  1780.  • Processor: y_commands (YCMD)
  1781.  • Usage: Unlocking your house car
  1782.  
  1783. */
  1784.  
  1785. YCMD:unlockhousecar(playerid, params[], help)
  1786. {
  1787.     #pragma unused help
  1788.     #pragma unused params
  1789.     foreach(Houses, i)
  1790.     {
  1791.         new HQuery2[200];
  1792.         format(HQuery2, sizeof(HQuery2), "SELECT HouseID FROM `house` WHERE `HouseID` = '%d'", i);
  1793.         mysql_query(HQuery2);
  1794.         mysql_store_result();
  1795.         if(!strcmp(HouseInfo[i][hCarOwner], GetName(playerid), false))
  1796.         {
  1797.             HouseInfo[i][hCarLocked] = 0;
  1798.             GameTextForPlayer(playerid, "House car ~g~unlocked!", 2000, 5);
  1799.  
  1800.             format(HQuery, sizeof(HQuery), "UPDATE `house` SET `Car Locked` = 0 WHERE `HouseID` = %d", i);
  1801.             mysql_query(HQuery);
  1802.         }
  1803.         mysql_free_result();
  1804.     }
  1805.     return 1;
  1806. }
  1807.  
  1808. /*
  1809.  
  1810.  • Command: /housecarcontrol
  1811.  • Processor: y_commands (YCMD)
  1812.  • Usage: Controling your house car: lock house car, unlock house car, storing weapons in house car, taking weapons from house car, storing money in house car, taking money from house car (Player must be in his house car to control it!)
  1813.  
  1814. */
  1815.  
  1816. YCMD:housecarcontrol(playerid, params[], help)
  1817. {
  1818.     #pragma unused help
  1819.     #pragma unused params
  1820.     foreach(Houses, i)
  1821.     {
  1822.         new HQuery2[200];
  1823.         format(HQuery2, sizeof(HQuery2), "SELECT HouseID FROM `house` WHERE `HouseID` = '%d'", i);
  1824.         mysql_query(HQuery2);
  1825.         mysql_store_result();
  1826.         if(mysql_num_rows() == 1)
  1827.         {
  1828.             if(!strcmp(HouseInfo[i][hOwner], GetName(playerid), false))
  1829.             {
  1830.                 if(PlayerEnteredHisHouseCar[playerid] == true)
  1831.                 {
  1832.                     ShowPlayerDialog(playerid, 5689, DIALOG_STYLE_LIST, "   Control your house car!", "Lock house car\nUnlock house car\nStore weapon\nTake weapon\nStore money\nTake money", "Ok", "Exit");
  1833.                 }
  1834.                 else SendClientMessage(playerid, COLOR_KRED, "You must enter your house car!");
  1835.             }
  1836.         }
  1837.         mysql_free_result();
  1838.     }
  1839.     return 1;
  1840. }
  1841.  
  1842. public RentFeeUp()
  1843. {
  1844.     foreach(Player, p)
  1845.     {
  1846.         if(!IsPlayerConnected(p)) continue;
  1847.         foreach(Houses, i)
  1848.         {
  1849.             new HQuery2[200];
  1850.             format(HQuery2, sizeof(HQuery2), "SELECT HouseID FROM `house` WHERE `HouseID` = '%d'", i);
  1851.             mysql_query(HQuery2);
  1852.             mysql_store_result();
  1853.             if(mysql_num_rows() == 1)
  1854.             {
  1855.                 if(!strcmp(HouseInfo[i][hRentUser], GetName(p), false))
  1856.                 {
  1857.                     GivePlayerMoney(p, -HouseInfo[i][hRentPrice]);
  1858.                     HouseInfo[i][hMoney] += HouseInfo[i][hRentPrice];
  1859.                     format(hstring, sizeof(hstring), "Rent fee: %d", HouseInfo[i][hRentPrice]);
  1860.                     printf("Rent fee: %d", HouseInfo[i][hRentPrice]);
  1861.                     SendClientMessage(p, COLOR_LIME, hstring);
  1862.                     mysql_free_result();
  1863.  
  1864.                     format(HQuery, sizeof(HQuery), "UPDATE `house` SET `Money` = %d WHERE `HouseID` = %d", HouseInfo[i][hMoney], i);
  1865.                     mysql_query(HQuery);
  1866.                 }
  1867.             }
  1868.         }
  1869.     }
  1870.     return 1;
  1871. }
  1872.  
  1873. public BreakingLock(playerid)
  1874. {
  1875.     foreach(Houses, i)
  1876.     {
  1877.         if(IsPlayerInRangeOfPoint(playerid, 3.0, HouseInfo[i][hEnterX], HouseInfo[i][hEnterY], HouseInfo[i][hEnterZ]))
  1878.         {
  1879.             if(HouseInfo[i][hAlarm] == 0)
  1880.             {
  1881.                 new breaking = random(4);
  1882.                 switch(breaking)
  1883.                 {
  1884.                     case 0,1,2:
  1885.                     {
  1886.                         TogglePlayerControllable(playerid, 1);
  1887.                         KillTimer(HouseLockBreaking[playerid]);
  1888.                         SendClientMessage(playerid, COLOR_YELLOW, "Breaking unsuccessfully!");
  1889.                     }
  1890.                     case 3:
  1891.                     {
  1892.                         HouseInfo[i][hLocked] = 0;
  1893.                         TogglePlayerControllable(playerid, 1);
  1894.                         KillTimer(HouseLockBreaking[playerid]);
  1895.                         SendClientMessage(playerid, COLOR_YELLOW, "Breaking successfully!");
  1896.  
  1897.                         format(HQuery, sizeof(HQuery), "UPDATE `house` SET `Locked` = 0 WHERE `HouseID` = %d", i);
  1898.                         mysql_query(HQuery);
  1899.                     }
  1900.                 }
  1901.             }
  1902.             else
  1903.             {
  1904.                 new breaking = random(5);
  1905.                 switch(breaking)
  1906.                 {
  1907.                     case 0,1,2,3:
  1908.                     {
  1909.                         TogglePlayerControllable(playerid, 1);
  1910.                         KillTimer(HouseLockBreaking[playerid]);
  1911.                         SendClientMessage(playerid, COLOR_YELLOW, "Breaking unsuccessfully!");
  1912.                     }
  1913.                     case 4:
  1914.                     {
  1915.                         HouseInfo[i][hLocked] = 0;
  1916.                         TogglePlayerControllable(playerid, 1);
  1917.                         KillTimer(HouseLockBreaking[playerid]);
  1918.                         SendClientMessage(playerid, COLOR_YELLOW, "Breaking successfully!");
  1919.  
  1920.                         format(HQuery, sizeof(HQuery), "UPDATE `house` SET `Locked` = 0 WHERE `HouseID` = %d", i);
  1921.                         mysql_query(HQuery);
  1922.                     }
  1923.                 }
  1924.             }
  1925.         }
  1926.     }
  1927.     return 1;
  1928. }
  1929.  
  1930.  
  1931. //*****************************           *****************************
  1932. //***************************** CALLBACKS *****************************
  1933. //*****************************           *****************************
  1934.  
  1935.  
  1936.  
  1937.  
  1938. /*
  1939.  
  1940.  • Callback: OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])  (Hooked using y_hook)
  1941.  • Action: Dialogs for house controling, later will be more for dynamic creating house!
  1942.  
  1943. */
  1944.  
  1945. Hook:H1_OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  1946. {
  1947.     switch(dialogid)
  1948.     {
  1949.         case 5678: //Dialog for house controling
  1950.         {
  1951.             if(!response) return 0;
  1952.             switch(listitem)
  1953.             {
  1954.                 case 0: //locking house
  1955.                 {
  1956.                     foreach(Houses, i)
  1957.                     {
  1958.                         if(IsPlayerInRangeOfPoint(playerid, 20.0, HouseInfo[i][hExitX], HouseInfo[i][hExitY], HouseInfo[i][hExitZ]))
  1959.                         {
  1960.                             if(!strcmp(HouseInfo[i][hOwner], GetName(playerid), false))
  1961.                             {
  1962.                                 HouseInfo[i][hLocked] = 1;
  1963.                                 GameTextForPlayer(playerid, "House ~r~locked!", 2000, 5);
  1964.                                 ShowPlayerDialog(playerid, 5678, DIALOG_STYLE_LIST, "   Control your house!", "Lock house\nUnlock house\nSet rent price\nStore weapon\nTake weapon\nStore money\nTake money\nKick rent user\nBuy alarm | $2000\nSell alarm", "Ok", "Exit");
  1965.  
  1966.                                 format(HQuery, sizeof(HQuery), "UPDATE `house` SET `Locked` = 1 WHERE `HouseID` = %d", i);
  1967.                                 mysql_query(HQuery);
  1968.                             }
  1969.                         }
  1970.                     }
  1971.                 }
  1972.                 case 1: //unlocking house
  1973.                 {
  1974.                     foreach(Houses, i)
  1975.                     {
  1976.                         if(IsPlayerInRangeOfPoint(playerid, 20.0, HouseInfo[i][hExitX], HouseInfo[i][hExitY], HouseInfo[i][hExitZ]))
  1977.                         {
  1978.                             if(!strcmp(HouseInfo[i][hOwner], GetName(playerid), false))
  1979.                             {
  1980.                                 HouseInfo[i][hLocked] = 0;
  1981.                                 GameTextForPlayer(playerid, "House ~g~unlocked!", 2000, 5);
  1982.                                 ShowPlayerDialog(playerid, 5678, DIALOG_STYLE_LIST, "   Control your house!", "Lock house\nUnlock house\nSet rent price\nStore weapon\nTake weapon\nStore money\nTake money\nKick rent user\nBuy alarm | $2000\nSell alarm", "Ok", "Exit");
  1983.  
  1984.                                 format(HQuery, sizeof(HQuery), "UPDATE `house` SET `Locked` = 0 WHERE `HouseID` = %d", i);
  1985.                                 mysql_query(HQuery);
  1986.                             }
  1987.                         }
  1988.                     }
  1989.                 }
  1990.                 case 2: //setting rent fee
  1991.                 {
  1992.                     if(!response) return ShowPlayerDialog(playerid, 5678, DIALOG_STYLE_LIST, "   Control your house!", "Lock house\nUnlock house\nSet rent price\nStore weapon\nTake weapon\nStore money\nTake money\nKick rent user\nBuy alarm | $2000\nSell alarm", "Ok", "Exit");
  1993.                     foreach(Houses, i)
  1994.                     {
  1995.                         if(IsPlayerInRangeOfPoint(playerid, 20.0, HouseInfo[i][hExitX], HouseInfo[i][hExitY], HouseInfo[i][hExitZ]))
  1996.                         {
  1997.                             if(!strcmp(HouseInfo[i][hOwner], GetName(playerid), false))
  1998.                             {
  1999.                                 format(hstring, sizeof(hstring), "Current rent price: %d\nType ammount of price that you want to set for renting\n0 for disabling rent!", HouseInfo[i][hRentPrice]);
  2000.                                 ShowPlayerDialog(playerid, 5686, DIALOG_STYLE_INPUT, "   Rent price", hstring, "Ok", "Back");
  2001.                             }
  2002.                         }
  2003.                     }
  2004.                 }
  2005.                 case 3: //storing a gun
  2006.                 {
  2007.                     if(!response) return ShowPlayerDialog(playerid, 5678, DIALOG_STYLE_LIST, "   Control your house!", "Lock house\nUnlock house\nSet rent price\nStore weapon\nTake weapon\nStore money\nTake money\nKick rent user\nBuy alarm | $2000\nSell alarm", "Ok", "Exit");
  2008.                     foreach(Houses, i)
  2009.                     {
  2010.                         if(IsPlayerInRangeOfPoint(playerid, 20.0, HouseInfo[i][hExitX], HouseInfo[i][hExitY], HouseInfo[i][hExitZ]))
  2011.                         {
  2012.                             if(!strcmp(HouseInfo[i][hOwner], GetName(playerid), false))
  2013.                             {
  2014.                                 new gunstring[128], gunstring1[128], gunstring2[128], gunstring3[128];
  2015.                                 if(HouseInfo[i][hWeaponID1] == 0) format(gunstring1, sizeof(gunstring1), "Nothing");
  2016.                                 else format(gunstring1, sizeof(gunstring1), "Weapon: %s | Ammo: %d", GetWeapon(HouseInfo[i][hWeaponID1]), HouseInfo[i][hWeaponID1Ammo]);
  2017.                                
  2018.                                 if(HouseInfo[i][hWeaponID2] == 0) format(gunstring2, sizeof(gunstring1), "Nothing");
  2019.                                 else format(gunstring2, sizeof(gunstring2), "Weapon: %s | Ammo: %d", GetWeapon(HouseInfo[i][hWeaponID2]), HouseInfo[i][hWeaponID2Ammo]);
  2020.                                
  2021.                                 if(HouseInfo[i][hWeaponID3] == 0) format(gunstring3, sizeof(gunstring1), "Nothing");
  2022.                                 else format(gunstring3, sizeof(gunstring3), "Weapon: %s | Ammo: %d", GetWeapon(HouseInfo[i][hWeaponID3]), HouseInfo[i][hWeaponID3Ammo]);
  2023.                                
  2024.                                 format(gunstring, sizeof(gunstring), "%s\n%s\n%s", gunstring1, gunstring2, gunstring3);
  2025.                                 ShowPlayerDialog(playerid, 5679, DIALOG_STYLE_LIST, "  Stored guns", gunstring, "Ok", "Back");
  2026.                             }
  2027.                         }
  2028.                     }
  2029.                 }
  2030.                 case 4: //taking a gun
  2031.                 {
  2032.                     if(!response) return ShowPlayerDialog(playerid, 5678, DIALOG_STYLE_LIST, "   Control your house!", "Lock house\nUnlock house\nSet rent price\nStore weapon\nTake weapon\nStore money\nTake money\nKick rent user\nBuy alarm | $2000\nSell alarm", "Ok", "Exit");
  2033.                     foreach(Houses, i)
  2034.                     {
  2035.                         if(IsPlayerInRangeOfPoint(playerid, 20.0, HouseInfo[i][hExitX], HouseInfo[i][hExitY], HouseInfo[i][hExitZ]))
  2036.                         {
  2037.                             if(!strcmp(HouseInfo[i][hOwner], GetName(playerid), false))
  2038.                             {
  2039.                                 new gunstring[128], gunstring1[128], gunstring2[128], gunstring3[128];
  2040.                                 if(HouseInfo[i][hWeaponID1] == 0) format(gunstring1, sizeof(gunstring1), "Nothing");
  2041.                                 else format(gunstring1, sizeof(gunstring1), "Weapon: %s | Ammo: %d", GetWeapon(HouseInfo[i][hWeaponID1]), HouseInfo[i][hWeaponID1Ammo]);
  2042.  
  2043.                                 if(HouseInfo[i][hWeaponID2] == 0) format(gunstring2, sizeof(gunstring1), "Nothing");
  2044.                                 else format(gunstring2, sizeof(gunstring2), "Weapon: %s | Ammo: %d", GetWeapon(HouseInfo[i][hWeaponID2]), HouseInfo[i][hWeaponID2Ammo]);
  2045.  
  2046.                                 if(HouseInfo[i][hWeaponID3] == 0) format(gunstring3, sizeof(gunstring1), "Nothing");
  2047.                                 else format(gunstring3, sizeof(gunstring3), "Weapon: %s | Ammo: %d", GetWeapon(HouseInfo[i][hWeaponID3]), HouseInfo[i][hWeaponID3Ammo]);
  2048.  
  2049.                                 format(gunstring, sizeof(gunstring), "%s\n%s\n%s", gunstring1, gunstring2, gunstring3);
  2050.                                 ShowPlayerDialog(playerid, 5683, DIALOG_STYLE_LIST, "  Stored guns", gunstring, "Ok", "Back");
  2051.                             }
  2052.                         }
  2053.                     }
  2054.                 }
  2055.                 case 5: //storing money
  2056.                 {
  2057.                     if(!response) return ShowPlayerDialog(playerid, 5678, DIALOG_STYLE_LIST, "   Control your house!", "Lock house\nUnlock house\nSet rent price\nStore weapon\nTake weapon\nStore money\nTake money\nKick rent user\nBuy alarm | $2000\nSell alarm", "Ok", "Exit");
  2058.                     foreach(Houses, i)
  2059.                     {
  2060.                         if(IsPlayerInRangeOfPoint(playerid, 20.0, HouseInfo[i][hExitX], HouseInfo[i][hExitY], HouseInfo[i][hExitZ]))
  2061.                         {
  2062.                             if(!strcmp(HouseInfo[i][hOwner], GetName(playerid), false))
  2063.                             {
  2064.                                 new moneystring[128];
  2065.                                 format(moneystring, sizeof(moneystring), "Current stored money: %d\n\nType ammount of money that you want to store", HouseInfo[i][hMoney]);
  2066.                                 ShowPlayerDialog(playerid, 5684, DIALOG_STYLE_INPUT, "   Stored money", moneystring, "Ok", "Back");
  2067.                             }
  2068.                         }
  2069.                     }
  2070.                 }
  2071.                 case 6: //taking money
  2072.                 {
  2073.                     if(!response) return ShowPlayerDialog(playerid, 5678, DIALOG_STYLE_LIST, "   Control your house!", "Lock house\nUnlock house\nSet rent price\nStore weapon\nTake weapon\nStore money\nTake money\nKick rent user\nBuy alarm | $2000\nSell alarm", "Ok", "Exit");
  2074.                     foreach(Houses, i)
  2075.                     {
  2076.                         if(IsPlayerInRangeOfPoint(playerid, 20.0, HouseInfo[i][hExitX], HouseInfo[i][hExitY], HouseInfo[i][hExitZ]))
  2077.                         {
  2078.                             if(!strcmp(HouseInfo[i][hOwner], GetName(playerid), false))
  2079.                             {
  2080.                                 new moneystring[128];
  2081.                                 format(moneystring, sizeof(moneystring), "Current stored money: %d\n\nType ammount of money that you want to take", HouseInfo[i][hMoney]);
  2082.                                 ShowPlayerDialog(playerid, 5685, DIALOG_STYLE_INPUT, "   Stored money", moneystring, "Ok", "Back");
  2083.                             }
  2084.                         }
  2085.                     }
  2086.                 }
  2087.                 case 7: //kicking rent user
  2088.                 {
  2089.                     if(!response) return ShowPlayerDialog(playerid, 5678, DIALOG_STYLE_LIST, "   Control your house!", "Lock house\nUnlock house\nSet rent price\nStore weapon\nTake weapon\nStore money\nTake money\nKick rent user\nBuy alarm | $2000\nSell alarm", "Ok", "Exit");
  2090.                     foreach(Houses, i)
  2091.                     {
  2092.                         if(IsPlayerInRangeOfPoint(playerid, 20.0, HouseInfo[i][hExitX], HouseInfo[i][hExitY], HouseInfo[i][hExitZ]))
  2093.                         {
  2094.                             if(!strcmp(HouseInfo[i][hOwner], GetName(playerid), false))
  2095.                             {
  2096.                                 if(HouseInfo[i][hRented] == 0)
  2097.                                 {
  2098.                                     SendClientMessage(playerid, COLOR_KRED, "No one doesn't rent this house!");
  2099.                                     ShowPlayerDialog(playerid, 5678, DIALOG_STYLE_LIST, "   Control your house!", "Lock house\nUnlock house\nSet rent price\nStore weapon\nTake weapon\nStore money\nTake money\nKick rent user\nBuy alarm | $2000\nSell alarm", "Ok", "Exit");
  2100.                                     return 1;
  2101.                                 }
  2102.                                 new moneystring[128];
  2103.                                 format(moneystring, sizeof(moneystring), "Current rent user: %s\n\nDo you want to kick him?", HouseInfo[i][hRentUser]);
  2104.                                 ShowPlayerDialog(playerid, 5687, DIALOG_STYLE_MSGBOX, "   Kick rent user", moneystring, "Yes", "No");
  2105.                             }
  2106.                         }
  2107.                     }
  2108.                 }
  2109.                 case 8: //buying an alarm
  2110.                 {
  2111.                     if(!response) return ShowPlayerDialog(playerid, 5678, DIALOG_STYLE_LIST, "   Control your house!", "Lock house\nUnlock house\nSet rent price\nStore weapon\nTake weapon\nStore money\nTake money\nKick rent user\nBuy alarm | $2000\nSell alarm", "Ok", "Exit");
  2112.                     foreach(Houses, i)
  2113.                     {
  2114.                         if(IsPlayerInRangeOfPoint(playerid, 20.0, HouseInfo[i][hExitX], HouseInfo[i][hExitY], HouseInfo[i][hExitZ]))
  2115.                         {
  2116.                             if(!strcmp(HouseInfo[i][hOwner], GetName(playerid), false))
  2117.                             {
  2118.                                 if(HouseInfo[i][hAlarm] == 1)
  2119.                                 {
  2120.                                     SendClientMessage(playerid, COLOR_KRED, "House already have an alarm!");
  2121.                                     ShowPlayerDialog(playerid, 5678, DIALOG_STYLE_LIST, "   Control your house!", "Lock house\nUnlock house\nSet rent price\nStore weapon\nTake weapon\nStore money\nTake money\nKick rent user\nBuy alarm | $2000\nSell alarm", "Ok", "Exit");
  2122.                                     return 1;
  2123.                                 }
  2124.                                 if(GetPlayerMoney(playerid) < 2000)
  2125.                                 {
  2126.                                     SendClientMessage(playerid, COLOR_KRED, "You don't have enough money!");
  2127.                                     ShowPlayerDialog(playerid, 5678, DIALOG_STYLE_LIST, "   Control your house!", "Lock house\nUnlock house\nSet rent price\nStore weapon\nTake weapon\nStore money\nTake money\nKick rent user\nBuy alarm | $2000\nSell alarm", "Ok", "Exit");
  2128.                                     return 1;
  2129.                                 }
  2130.                                 HouseInfo[i][hAlarm] = 1;
  2131.                                 GivePlayerMoney(playerid, -2000);
  2132.                                 SendClientMessage(playerid, COLOR_YELLOW, "You buyed an alarm for your house!");
  2133.                                 ShowPlayerDialog(playerid, 5678, DIALOG_STYLE_LIST, "   Control your house!", "Lock house\nUnlock house\nSet rent price\nStore weapon\nTake weapon\nStore money\nTake money\nKick rent user\nBuy alarm | $2000\nSell alarm", "Ok", "Exit");
  2134.                                
  2135.                                 format(HQuery, sizeof(HQuery), "UPDATE `house` SET `Alarm` = 1 WHERE `HouseID` = %d", i);
  2136.                                 mysql_query(HQuery);
  2137.                             }
  2138.                         }
  2139.                     }
  2140.                 }
  2141.                 case 9: //selling an alarm
  2142.                 {
  2143.                     if(!response) return ShowPlayerDialog(playerid, 5678, DIALOG_STYLE_LIST, "   Control your house!", "Lock house\nUnlock house\nSet rent price\nStore weapon\nTake weapon\nStore money\nTake money\nKick rent user\nBuy alarm | $2000\nSell alarm", "Ok", "Exit");
  2144.                     foreach(Houses, i)
  2145.                     {
  2146.                         if(IsPlayerInRangeOfPoint(playerid, 20.0, HouseInfo[i][hExitX], HouseInfo[i][hExitY], HouseInfo[i][hExitZ]))
  2147.                         {
  2148.                             if(!strcmp(HouseInfo[i][hOwner], GetName(playerid), false))
  2149.                             {
  2150.                                 if(HouseInfo[i][hAlarm] == 0)
  2151.                                 {
  2152.                                     SendClientMessage(playerid, COLOR_KRED, "House doesn't have an alarm!");
  2153.                                     ShowPlayerDialog(playerid, 5678, DIALOG_STYLE_LIST, "   Control your house!", "Lock house\nUnlock house\nSet rent price\nStore weapon\nTake weapon\nStore money\nTake money\nKick rent user\nBuy alarm | $2000\nSell alarm", "Ok", "Exit");
  2154.                                     return 1;
  2155.                                 }
  2156.                                 HouseInfo[i][hAlarm] = 0;
  2157.                                 GivePlayerMoney(playerid, 2000);
  2158.                                 SendClientMessage(playerid, COLOR_YELLOW, "You sell an alarm of your house!");
  2159.                                 ShowPlayerDialog(playerid, 5678, DIALOG_STYLE_LIST, "   Control your house!", "Lock house\nUnlock house\nSet rent price\nStore weapon\nTake weapon\nStore money\nTake money\nKick rent user\nBuy alarm | $2000\nSell alarm", "Ok", "Exit");
  2160.  
  2161.                                 format(HQuery, sizeof(HQuery), "UPDATE `house` SET `Alarm` = 0 WHERE `HouseID` = %d", i);
  2162.                                 mysql_query(HQuery);
  2163.                             }
  2164.                         }
  2165.                     }
  2166.                 }
  2167.             }
  2168.         }
  2169.         case 5679: //dialog with all stored guns
  2170.         {
  2171.             if(!response) return ShowPlayerDialog(playerid, 5678, DIALOG_STYLE_LIST, "   Control your house!", "Lock house\nUnlock house\nSet rent price\nStore weapon\nTake weapon\nStore money\nTake money\nKick rent user\nBuy alarm | $2000\nSell alarm", "Ok", "Exit");
  2172.             switch(listitem)
  2173.             {
  2174.                 case 0: //slot 1
  2175.                 {
  2176.                     foreach(Houses, i)
  2177.                     {
  2178.                         if(IsPlayerInRangeOfPoint(playerid, 20.0, HouseInfo[i][hExitX], HouseInfo[i][hExitY], HouseInfo[i][hExitZ]))
  2179.                         {
  2180.                             if(!strcmp(HouseInfo[i][hOwner], GetName(playerid), false))
  2181.                             {
  2182.                                 ShowPlayerDialog(playerid, 5680, DIALOG_STYLE_INPUT, "  Gun", "Type a gun ID that you want to store!", "Ok", "Exit");
  2183.                             }
  2184.                         }
  2185.                     }
  2186.                 }
  2187.                 case 1: //slot 2
  2188.                 {
  2189.                     foreach(Houses, i)
  2190.                     {
  2191.                         if(IsPlayerInRangeOfPoint(playerid, 20.0, HouseInfo[i][hExitX], HouseInfo[i][hExitY], HouseInfo[i][hExitZ]))
  2192.                         {
  2193.                             if(!strcmp(HouseInfo[i][hOwner], GetName(playerid), false))
  2194.                             {
  2195.                                 ShowPlayerDialog(playerid, 5681, DIALOG_STYLE_INPUT, "  Gun", "Type a gun ID that you want to store!", "Ok", "Exit");
  2196.                             }
  2197.                         }
  2198.                     }
  2199.                 }
  2200.                 case 2: //slot 3
  2201.                 {
  2202.                     foreach(Houses, i)
  2203.                     {
  2204.                         if(IsPlayerInRangeOfPoint(playerid, 20.0, HouseInfo[i][hExitX], HouseInfo[i][hExitY], HouseInfo[i][hExitZ]))
  2205.                         {
  2206.                             if(!strcmp(HouseInfo[i][hOwner], GetName(playerid), false))
  2207.                             {
  2208.                                 ShowPlayerDialog(playerid, 5682, DIALOG_STYLE_INPUT, "  Gun", "Type a gun ID that you want to store!", "Ok", "Exit");
  2209.                             }
  2210.                         }
  2211.                     }
  2212.                 }
  2213.             }
  2214.         }
  2215.         case 5680: //dialog for storing gun in slot 1
  2216.         {
  2217.             if(!response) return ShowPlayerDialog(playerid, 5678, DIALOG_STYLE_LIST, "   Control your house!", "Lock house\nUnlock house\nSet rent price\nStore weapon\nTake weapon\nStore money\nTake money\nKick rent user\nBuy alarm | $2000\nSell alarm", "Ok", "Exit");
  2218.             foreach(Houses, i)
  2219.             {
  2220.                 if(IsPlayerInRangeOfPoint(playerid, 20.0, HouseInfo[i][hExitX], HouseInfo[i][hExitY], HouseInfo[i][hExitZ]))
  2221.                 {
  2222.                     if(!strcmp(HouseInfo[i][hOwner], GetName(playerid), false))
  2223.                     {
  2224.                         Custom_GetPlayerWeapon(playerid);
  2225.                         if(House_Weapon[playerid][Custom_GetSlot(strval(inputtext))] == strval(inputtext))
  2226.                         {
  2227.                             if(strval(inputtext) > 0 || strval(inputtext) < 46)
  2228.                             {
  2229.                                 HouseInfo[i][hWeaponID1] = strval(inputtext);
  2230.                                 HouseInfo[i][hWeaponID1Ammo] = House_Ammo[playerid][Custom_GetSlot(HouseInfo[i][hWeaponID1])];
  2231.                                 format(hstring, sizeof(hstring), "Gun ID %d stored in the slot 1", strval(inputtext));
  2232.                                 SendClientMessage(playerid, COLOR_LIME, hstring);
  2233.                                 ShowPlayerDialog(playerid, 5678, DIALOG_STYLE_LIST, "   Control your house!", "Lock house\nUnlock house\nSet rent price\nStore weapon\nTake weapon\nKick rent user", "Ok", "Exit\nBuy alarm | $2000\nSell alarm");
  2234.  
  2235.                                 format(HQuery, sizeof(HQuery), "UPDATE `house` SET `Weapon ID 1` = %d, `Weapon ID 1 Ammo` = %d WHERE `HouseID` = %d", strval(inputtext), HouseInfo[i][hWeaponID1Ammo], i);
  2236.                                 mysql_query(HQuery);
  2237.                             }
  2238.                             else
  2239.                             {
  2240.                                 SendClientMessage(playerid, COLOR_KRED, "Invalid gun ID!");
  2241.                                 ShowPlayerDialog(playerid, 5680, DIALOG_STYLE_INPUT, "  Gun", "Type a gun ID that you want to store!", "Ok", "Exit");
  2242.                             }
  2243.                         }
  2244.                         else
  2245.                         {
  2246.                             SendClientMessage(playerid, COLOR_KRED, "You don't have that gun!");
  2247.                             ShowPlayerDialog(playerid, 5680, DIALOG_STYLE_INPUT, "  Gun", "Type a gun ID that you want to store!", "Ok", "Exit");
  2248.                         }
  2249.                     }
  2250.                 }
  2251.             }
  2252.         }
  2253.         case 5681: //dialog for storing gun in slot 2
  2254.         {
  2255.             if(!response) return ShowPlayerDialog(playerid, 5678, DIALOG_STYLE_LIST, "   Control your house!", "Lock house\nUnlock house\nSet rent price\nStore weapon\nTake weapon\nStore money\nTake money\nKick rent user\nBuy alarm | $2000\nSell alarm", "Ok", "Exit");
  2256.             foreach(Houses, i)
  2257.             {
  2258.                 if(IsPlayerInRangeOfPoint(playerid, 20.0, HouseInfo[i][hExitX], HouseInfo[i][hExitY], HouseInfo[i][hExitZ]))
  2259.                 {
  2260.                     if(!strcmp(HouseInfo[i][hOwner], GetName(playerid), false))
  2261.                     {
  2262.                         Custom_GetPlayerWeapon(playerid);
  2263.                         if(House_Weapon[playerid][Custom_GetSlot(strval(inputtext))] == strval(inputtext))
  2264.                         {
  2265.                             if(strval(inputtext) > 0 || strval(inputtext) < 46)
  2266.                             {
  2267.                                 HouseInfo[i][hWeaponID2] = strval(inputtext);
  2268.                                 HouseInfo[i][hWeaponID2Ammo] = House_Ammo[playerid][Custom_GetSlot(HouseInfo[i][hWeaponID2])];
  2269.                                 format(hstring, sizeof(hstring), "Gun ID %d stored in the slot 2", strval(inputtext));
  2270.                                 SendClientMessage(playerid, COLOR_LIME, hstring);
  2271.                                 ShowPlayerDialog(playerid, 5678, DIALOG_STYLE_LIST, "   Control your house!", "Lock house\nUnlock house\nSet rent price\nStore weapon\nTake weapon\nKick rent user\nBuy alarm | $2000\nSell alarm", "Ok", "Exit");
  2272.  
  2273.                                 format(HQuery, sizeof(HQuery), "UPDATE `house` SET `Weapon ID 2` = %d, `Weapon ID 2 Ammo` = %d WHERE `HouseID` = %d", strval(inputtext), HouseInfo[i][hWeaponID2Ammo], i);
  2274.                                 mysql_query(HQuery);
  2275.                             }
  2276.                             else
  2277.                             {
  2278.                                 SendClientMessage(playerid, COLOR_KRED, "Invalid gun ID!");
  2279.                                 ShowPlayerDialog(playerid, 5680, DIALOG_STYLE_INPUT, "  Gun", "Type a gun ID that you want to store!", "Ok", "Exit");
  2280.                             }
  2281.                         }
  2282.                         else
  2283.                         {
  2284.                             SendClientMessage(playerid, COLOR_KRED, "You don't have that gun!");
  2285.                             ShowPlayerDialog(playerid, 5680, DIALOG_STYLE_INPUT, "  Gun", "Type a gun ID that you want to store!", "Ok", "Exit");
  2286.                         }
  2287.                     }
  2288.                 }
  2289.             }
  2290.         }
  2291.         case 5682: //dialog for storing gun in slot 3
  2292.         {
  2293.             if(!response) return ShowPlayerDialog(playerid, 5678, DIALOG_STYLE_LIST, "   Control your house!", "Lock house\nUnlock house\nSet rent price\nStore weapon\nTake weapon\nStore money\nTake money\nKick rent user\nBuy alarm | $2000\nSell alarm", "Ok", "Exit");
  2294.             foreach(Houses, i)
  2295.             {
  2296.                 if(IsPlayerInRangeOfPoint(playerid, 20.0, HouseInfo[i][hExitX], HouseInfo[i][hExitY], HouseInfo[i][hExitZ]))
  2297.                 {
  2298.                     if(!strcmp(HouseInfo[i][hOwner], GetName(playerid), false))
  2299.                     {
  2300.                         Custom_GetPlayerWeapon(playerid);
  2301.                         if(House_Weapon[playerid][Custom_GetSlot(strval(inputtext))] == strval(inputtext))
  2302.                         {
  2303.                             if(strval(inputtext) > 0 || strval(inputtext) < 46)
  2304.                             {
  2305.                                 HouseInfo[i][hWeaponID3] = strval(inputtext);
  2306.                                 HouseInfo[i][hWeaponID3Ammo] = House_Ammo[playerid][Custom_GetSlot(HouseInfo[i][hWeaponID3])];
  2307.                                 format(hstring, sizeof(hstring), "Gun ID %d stored in the slot 3", strval(inputtext));
  2308.                                 SendClientMessage(playerid, COLOR_LIME, hstring);
  2309.                                 ShowPlayerDialog(playerid, 5678, DIALOG_STYLE_LIST, "   Control your house!", "Lock house\nUnlock house\nSet rent price\nStore weapon\nTake weapon\nKick rent user\nBuy alarm | $2000\nSell alarm", "Ok", "Exit");
  2310.  
  2311.                                 format(HQuery, sizeof(HQuery), "UPDATE `house` SET `Weapon ID 3` = %d, `Weapon ID 3 Ammo` = %d WHERE `HouseID` = %d", strval(inputtext), HouseInfo[i][hWeaponID3Ammo], i);
  2312.                                 mysql_query(HQuery);
  2313.                             }
  2314.                             else
  2315.                             {
  2316.                                 SendClientMessage(playerid, COLOR_KRED, "Invalid gun ID!");
  2317.                                 ShowPlayerDialog(playerid, 5680, DIALOG_STYLE_INPUT, "  Gun", "Type a gun ID that you want to store!", "Ok", "Exit");
  2318.                             }
  2319.                         }
  2320.                         else
  2321.                         {
  2322.                             SendClientMessage(playerid, COLOR_KRED, "You don't have that gun!");
  2323.                             ShowPlayerDialog(playerid, 5680, DIALOG_STYLE_INPUT, "  Gun", "Type a gun ID that you want to store!", "Ok", "Exit");
  2324.                         }
  2325.                     }
  2326.                 }
  2327.             }
  2328.         }
  2329.         case 5683: //dialog for taking gun
  2330.         {
  2331.             if(!response) return ShowPlayerDialog(playerid, 5678, DIALOG_STYLE_LIST, "   Control your house!", "Lock house\nUnlock house\nSet rent price\nStore weapon\nTake weapon\nStore money\nTake money\nKick rent user\nBuy alarm | $2000\nSell alarm", "Ok", "Exit");
  2332.             switch(listitem)
  2333.             {
  2334.                 case 0: //slot 1
  2335.                 {
  2336.                     foreach(Houses, i)
  2337.                     {
  2338.                         if(IsPlayerInRangeOfPoint(playerid, 20.0, HouseInfo[i][hExitX], HouseInfo[i][hExitY], HouseInfo[i][hExitZ]))
  2339.                         {
  2340.                             if(!strcmp(HouseInfo[i][hOwner], GetName(playerid), false))
  2341.                             {
  2342.                                 if(HouseInfo[i][hWeaponID1] > 1) //if slot isn't empty (Emty slot is weapon ID 0 (Hand))
  2343.                                 {
  2344.                                     GivePlayerWeapon(playerid, HouseInfo[i][hWeaponID1], HouseInfo[i][hWeaponID1Ammo]);
  2345.                                     HouseInfo[i][hWeaponID1] = 0;
  2346.                                     HouseInfo[i][hWeaponID1Ammo] = 0;
  2347.                                     ShowPlayerDialog(playerid, 5678, DIALOG_STYLE_LIST, "   Control your house!", "Lock house\nUnlock house\nSet rent price\nStore weapon\nTake weapon\nStore money\nTake money\nKick rent user\nBuy alarm | $2000\nSell alarm", "Ok", "Exit");
  2348.                                    
  2349.                                     format(HQuery, sizeof(HQuery), "UPDATE `house` SET `Weapon ID 1` = 0, `Weapon ID 1 Ammo` = 0 WHERE `HouseID` = %d", i);
  2350.                                     mysql_query(HQuery);
  2351.                                 }
  2352.                                 else
  2353.                                 {
  2354.                                     SendClientMessage(playerid, COLOR_KRED, "That slot is empty!");
  2355.                                     ShowPlayerDialog(playerid, 5678, DIALOG_STYLE_LIST, "   Control your house!", "Lock house\nUnlock house\nSet rent price\nStore weapon\nTake weapon\nKick rent user\nBuy alarm | $2000\nSell alarm", "Ok", "Exit");
  2356.                                 }
  2357.                             }
  2358.                         }
  2359.                     }
  2360.                 }
  2361.                 case 1: //slot 2
  2362.                 {
  2363.                     foreach(Houses, i)
  2364.                     {
  2365.                         if(IsPlayerInRangeOfPoint(playerid, 20.0, HouseInfo[i][hExitX], HouseInfo[i][hExitY], HouseInfo[i][hExitZ]))
  2366.                         {
  2367.                             if(!strcmp(HouseInfo[i][hOwner], GetName(playerid), false))
  2368.                             {
  2369.                                 if(HouseInfo[i][hWeaponID2] > 1) //if slot isn't empty (Emty slot is weapon ID 0 (Hand))
  2370.                                 {
  2371.                                     GivePlayerWeapon(playerid, HouseInfo[i][hWeaponID2], HouseInfo[i][hWeaponID2Ammo]);
  2372.                                     HouseInfo[i][hWeaponID2] = 0;
  2373.                                     HouseInfo[i][hWeaponID2Ammo] = 0;
  2374.                                     ShowPlayerDialog(playerid, 5678, DIALOG_STYLE_LIST, "   Control your house!", "Lock house\nUnlock house\nSet rent price\nStore weapon\nTake weapon\nStore money\nTake money\nKick rent user\nBuy alarm | $2000\nSell alarm", "Ok", "Exit");
  2375.  
  2376.                                     format(HQuery, sizeof(HQuery), "UPDATE `house` SET `Weapon ID 2` = 0, `Weapon ID 2 Ammo` = 0 WHERE `HouseID` = %d", i);
  2377.                                     mysql_query(HQuery);
  2378.                                 }
  2379.                                 else
  2380.                                 {
  2381.                                     SendClientMessage(playerid, COLOR_KRED, "That slot is empty!");
  2382.                                     ShowPlayerDialog(playerid, 5678, DIALOG_STYLE_LIST, "   Control your house!", "Lock house\nUnlock house\nSet rent price\nStore weapon\nTake weapon\nKick rent user\nBuy alarm | $2000\nSell alarm", "Ok", "Exit");
  2383.                                 }
  2384.                             }
  2385.                         }
  2386.                     }
  2387.                 }
  2388.                 case 2: //slot 3
  2389.                 {
  2390.                     foreach(Houses, i)
  2391.                     {
  2392.                         if(IsPlayerInRangeOfPoint(playerid, 20.0, HouseInfo[i][hExitX], HouseInfo[i][hExitY], HouseInfo[i][hExitZ]))
  2393.                         {
  2394.                             if(!strcmp(HouseInfo[i][hOwner], GetName(playerid), false))
  2395.                             {
  2396.                                 if(!strcmp(HouseInfo[i][hOwner], GetName(playerid), false))
  2397.                                 {
  2398.                                     if(HouseInfo[i][hWeaponID3] > 1) //if slot isn't empty (Emty slot is weapon ID 0 (Hand))
  2399.                                     {
  2400.                                         GivePlayerWeapon(playerid, HouseInfo[i][hWeaponID3], HouseInfo[i][hWeaponID3Ammo]);
  2401.                                         HouseInfo[i][hWeaponID3] = 0;
  2402.                                         HouseInfo[i][hWeaponID3Ammo] = 0;
  2403.                                         ShowPlayerDialog(playerid, 5678, DIALOG_STYLE_LIST, "   Control your house!", "Lock house\nUnlock house\nSet rent price\nStore weapon\nTake weapon\nStore money\nTake money\nKick rent user\nBuy alarm | $2000\nSell alarm", "Ok", "Exit");
  2404.  
  2405.                                         format(HQuery, sizeof(HQuery), "UPDATE `house` SET `Weapon ID 3` = 0, `Weapon ID 3 Ammo` = 0 WHERE `HouseID` = %d", i);
  2406.                                         mysql_query(HQuery);
  2407.                                     }
  2408.                                     else
  2409.                                     {
  2410.                                         SendClientMessage(playerid, COLOR_KRED, "That slot is empty!");
  2411.                                         ShowPlayerDialog(playerid, 5678, DIALOG_STYLE_LIST, "   Control your house!", "Lock house\nUnlock house\nSet rent price\nStore weapon\nTake weapon\nKick rent user\nBuy alarm | $2000\nSell alarm", "Ok", "Exit");
  2412.                                     }
  2413.                                 }
  2414.                             }
  2415.                         }
  2416.                     }
  2417.                 }
  2418.             }
  2419.         }
  2420.         case 5684: //dialog for storing money
  2421.         {
  2422.             if(!response) return ShowPlayerDialog(playerid, 5678, DIALOG_STYLE_LIST, "   Control your house!", "Lock house\nUnlock house\nSet rent price\nStore weapon\nTake weapon\nStore money\nTake money\nKick rent user\nBuy alarm | $2000\nSell alarm", "Ok", "Exit");
  2423.             foreach(Houses, i)
  2424.             {
  2425.                 if(IsPlayerInRangeOfPoint(playerid, 20.0, HouseInfo[i][hExitX], HouseInfo[i][hExitY], HouseInfo[i][hExitZ]))
  2426.                 {
  2427.                     if(!strcmp(HouseInfo[i][hOwner], GetName(playerid), false))
  2428.                     {
  2429.                         new moneystring[128];
  2430.                         format(moneystring, sizeof(moneystring), "Current stored money: %d\n\nType ammount of money that you want to store", HouseInfo[i][hMoney]);
  2431.                         if(!strlen(inputtext)) return ShowPlayerDialog(playerid, 5684, DIALOG_STYLE_INPUT, "   Stored money", moneystring, "Ok", "Back");
  2432.                         if(GetPlayerMoney(playerid) < strval(inputtext))
  2433.                         {
  2434.                             SendClientMessage(playerid, COLOR_KRED, "You don't have enoguh money to store!");
  2435.                             ShowPlayerDialog(playerid, 5684, DIALOG_STYLE_INPUT, "   Stored money", moneystring, "Ok", "Back");
  2436.                             return 1;
  2437.                         }
  2438.                         if(strval(inputtext) > 10000000)
  2439.                         {
  2440.                             SendClientMessage(playerid, COLOR_KRED, "You can store maximum 10000000!");
  2441.                             ShowPlayerDialog(playerid, 5684, DIALOG_STYLE_INPUT, "   Stored money", moneystring, "Ok", "Back");
  2442.                             return 1;
  2443.                         }
  2444.                         HouseInfo[i][hMoney] += strval(inputtext);
  2445.                         GivePlayerMoney(playerid, -strval(inputtext));
  2446.                         format(hstring, sizeof(hstring), "You store %d$! Current stored money: %d", strval(inputtext), HouseInfo[i][hMoney]);
  2447.                         SendClientMessage(playerid, COLOR_YELLOW, hstring);
  2448.                         ShowPlayerDialog(playerid, 5678, DIALOG_STYLE_LIST, "   Control your house!", "Lock house\nUnlock house\nSet rent price\nStore weapon\nTake weapon\nStore money\nTake money\nKick rent user\nBuy alarm | $2000\nSell alarm", "Ok", "Exit");
  2449.                        
  2450.                         format(HQuery, sizeof(HQuery), "UPDATE `house` SET `Money` = %d WHERE `HouseID` = %d", HouseInfo[i][hMoney], i);
  2451.                         mysql_query(HQuery);
  2452.                     }
  2453.                 }
  2454.             }
  2455.         }
  2456.         case 5685: //dialog for taking money
  2457.         {
  2458.             if(!response) return ShowPlayerDialog(playerid, 5678, DIALOG_STYLE_LIST, "   Control your house!", "Lock house\nUnlock house\nSet rent price\nStore weapon\nTake weapon\nStore money\nTake money\nKick rent user\nBuy alarm | $2000\nSell alarm", "Ok", "Exit");
  2459.             foreach(Houses, i)
  2460.             {
  2461.                 if(IsPlayerInRangeOfPoint(playerid, 20.0, HouseInfo[i][hExitX], HouseInfo[i][hExitY], HouseInfo[i][hExitZ]))
  2462.                 {
  2463.                     if(!strcmp(HouseInfo[i][hOwner], GetName(playerid), false))
  2464.                     {
  2465.                         new moneystring[128];
  2466.                         format(moneystring, sizeof(moneystring), "Current stored money: %d\n\nType ammount of money that you want to take", HouseInfo[i][hMoney]);
  2467.                         if(!strlen(inputtext)) return ShowPlayerDialog(playerid, 5685, DIALOG_STYLE_INPUT, "   Stored money", moneystring, "Ok", "Back");
  2468.                         if(strval(inputtext) > HouseInfo[i][hMoney])
  2469.                         {
  2470.                             SendClientMessage(playerid, COLOR_KRED, "House does not have that much money!");
  2471.                             ShowPlayerDialog(playerid, 5685, DIALOG_STYLE_INPUT, "   Stored money", moneystring, "Ok", "Back");
  2472.                             return 1;
  2473.                         }
  2474.                         HouseInfo[i][hMoney] -= strval(inputtext);
  2475.                         GivePlayerMoney(playerid, strval(inputtext));
  2476.                         format(hstring, sizeof(hstring), "You take %d$! Current stored money: %d", strval(inputtext), HouseInfo[i][hMoney]);
  2477.                         SendClientMessage(playerid, COLOR_YELLOW, hstring);
  2478.                         ShowPlayerDialog(playerid, 5678, DIALOG_STYLE_LIST, "   Control your house!", "Lock house\nUnlock house\nSet rent price\nStore weapon\nTake weapon\nStore money\nTake money\nKick rent user\nBuy alarm | $2000\nSell alarm", "Ok", "Exit");
  2479.  
  2480.                         format(HQuery, sizeof(HQuery), "UPDATE `house` SET `Money` = %d WHERE `HouseID` = %d", HouseInfo[i][hMoney], i);
  2481.                         mysql_query(HQuery);
  2482.                     }
  2483.                 }
  2484.             }
  2485.         }
  2486.         case 5686: //dialog for setting rent price
  2487.         {
  2488.             if(!response) return ShowPlayerDialog(playerid, 5678, DIALOG_STYLE_LIST, "   Control your house!", "Lock house\nUnlock house\nSet rent price\nStore weapon\nTake weapon\nStore money\nTake money\nKick rent user\nBuy alarm | $2000\nSell alarm", "Ok", "Exit");
  2489.             foreach(Houses, i)
  2490.             {
  2491.                 if(IsPlayerInRangeOfPoint(playerid, 20.0, HouseInfo[i][hExitX], HouseInfo[i][hExitY], HouseInfo[i][hExitZ]))
  2492.                 {
  2493.                     if(!strcmp(HouseInfo[i][hOwner], GetName(playerid), false))
  2494.                     {
  2495.                         new rentstring[128], labelstring[128];
  2496.                         format(rentstring, sizeof(rentstring), "Current rent price: %d\nType ammount of price that you want to set for renting\n0 for disabling rent!", HouseInfo[i][hRentPrice]);
  2497.                         if(!strlen(inputtext)) return ShowPlayerDialog(playerid, 5686, DIALOG_STYLE_INPUT, "   Rent price", rentstring, "Ok", "Back");
  2498.                         if(strval(inputtext) < 0 || strval(inputtext) > 10000) return ShowPlayerDialog(playerid, 5686, DIALOG_STYLE_INPUT, "   Rent price", rentstring, "Ok", "Back");
  2499.                         if(strval(inputtext) == 0)
  2500.                         {
  2501.                             HouseInfo[i][hRentDisabled] = 1;
  2502.                             HouseInfo[i][hRented] = 0;
  2503.                             format(HouseInfo[i][hRentUser], 24, "None");
  2504.                             SendClientMessage(playerid, COLOR_YELLOW, "Rent disabled!");
  2505.                             format(labelstring, sizeof(labelstring), "Owner: %s\nHouse ID: %d\nRent Disabled", HouseInfo[i][hOwner], i);
  2506.                             Update3DTextLabelText(HouseInfo[i][hLabel], 0x21DD00FF, labelstring);
  2507.  
  2508.                             format(HQuery, sizeof(HQuery), "UPDATE `house` SET `Rent User` = 'None', `Rented` = 0, `Rent Disabled` = 1 WHERE `HouseID` = %d", i);
  2509.                             mysql_query(HQuery);
  2510.                             return ShowPlayerDialog(playerid, 5678, DIALOG_STYLE_LIST, "   Control your house!", "Lock house\nUnlock house\nSet rent price\nStore weapon\nTake weapon\nStore money\nTake money\nKick rent user\nBuy alarm | $2000\nSell alarm", "Ok", "Exit");
  2511.                         }
  2512.                         HouseInfo[i][hRentDisabled] = 0;
  2513.                         HouseInfo[i][hRentPrice] = strval(inputtext);
  2514.                         format(labelstring, sizeof(labelstring), "Owner: %s\nHouse ID: %d\nRent User: %s\nRent Price: %d", HouseInfo[i][hOwner], i, HouseInfo[i][hRentUser], HouseInfo[i][hRentPrice]);
  2515.                         Update3DTextLabelText(HouseInfo[i][hLabel], 0x21DD00FF, labelstring);
  2516.                         format(hstring, sizeof(hstring), "Rent price set on %d", HouseInfo[i][hRentPrice]);
  2517.                         SendClientMessage(playerid, COLOR_YELLOW, hstring);
  2518.                         ShowPlayerDialog(playerid, 5678, DIALOG_STYLE_LIST, "   Control your house!", "Lock house\nUnlock house\nSet rent price\nStore weapon\nTake weapon\nStore money\nTake money\nKick rent user\nBuy alarm | $2000\nSell alarm", "Ok", "Exit");
  2519.                        
  2520.                         format(HQuery, sizeof(HQuery), "UPDATE `house` SET `Rent Price` = %d, `Rent Disabled` = 0 WHERE `HouseID` = %d", HouseInfo[i][hRentPrice], i);
  2521.                         mysql_query(HQuery);
  2522.                     }
  2523.                 }
  2524.             }
  2525.         }
  2526.         case 5687: //dialog for kicking rent user
  2527.         {
  2528.             if(!response) return ShowPlayerDialog(playerid, 5678, DIALOG_STYLE_LIST, "   Control your house!", "Lock house\nUnlock house\nSet rent price\nStore weapon\nTake weapon\nStore money\nTake money\nKick rent user\nBuy alarm | $2000\nSell alarm", "Ok", "Exit");
  2529.             foreach(Houses, i)
  2530.             {
  2531.                 if(IsPlayerInRangeOfPoint(playerid, 20.0, HouseInfo[i][hExitX], HouseInfo[i][hExitY], HouseInfo[i][hExitZ]))
  2532.                 {
  2533.                     if(!strcmp(HouseInfo[i][hOwner], GetName(playerid), false))
  2534.                     {
  2535.                         new labelstring[128];
  2536.                         HouseInfo[i][hRented] = 0;
  2537.                         format(hstring, sizeof(hstring), "You kicked %s", HouseInfo[i][hRentUser]);
  2538.                         SendClientMessage(playerid, COLOR_YELLOW, hstring);
  2539.                         format(HouseInfo[i][hRentUser], 24, "None");
  2540.                         format(labelstring, sizeof(labelstring), "Owner: %s\nHouse ID: %d\nRent User: %s\nRent Price: %d", HouseInfo[i][hOwner], i, HouseInfo[i][hRentUser], HouseInfo[i][hRentPrice]);
  2541.                         Update3DTextLabelText(HouseInfo[i][hLabel], 0x21DD00FF, labelstring);
  2542.                         ShowPlayerDialog(playerid, 5678, DIALOG_STYLE_LIST, "   Control your house!", "Lock house\nUnlock house\nSet rent price\nStore weapon\nTake weapon\nStore money\nTake money\nKick rent user\nBuy alarm | $2000\nSell alarm", "Ok", "Exit");
  2543.  
  2544.                         format(HQuery, sizeof(HQuery), "UPDATE `house` SET `Rent User` = 'None', `Rented` = 0 WHERE `HouseID` = %d", i);
  2545.                         mysql_query(HQuery);
  2546.                     }
  2547.                 }
  2548.             }
  2549.         }
  2550.         case 5688: //sell to player house
  2551.         {
  2552.             new selledstring[128], selledstring2[128];
  2553.             if(!response)
  2554.             {
  2555.                 SendClientMessage(playerid, COLOR_YELLOW, "You canceled buying house!");
  2556.                 SendClientMessage(GetPVarInt(playerid, "Seller"), COLOR_YELLOW, "Player canceled buying house!");
  2557.                 return 1;
  2558.             }
  2559.             print("Calls under response");
  2560.             foreach(Houses, i)
  2561.             {
  2562.                 if(IsPlayerInRangeOfPoint(GetPVarInt(playerid, "Seller"), 3.0, HouseInfo[i][hEnterX], HouseInfo[i][hEnterY], HouseInfo[i][hEnterZ]))
  2563.                 {
  2564.                     if(!strcmp(HouseInfo[i][hOwner], GetName(GetPVarInt(playerid, "Seller")), false) && HouseInfo[i][hOwned] == 1)
  2565.                     {
  2566.                         new HQuery2[200];
  2567.                         format(HQuery2, sizeof(HQuery2), "SELECT HouseID FROM `house` WHERE `HouseID` = '%d'", i);
  2568.                         mysql_query(HQuery2);
  2569.                         mysql_store_result();
  2570.                         if(mysql_num_rows() == 1)
  2571.                         {
  2572.                             print("House sold!");
  2573.                             format(HouseInfo[i][hOwner], 24, "%s", GetName(playerid));
  2574.                             format(HouseInfo[i][hRentUser], 24, "None");
  2575.                             HouseInfo[i][hOwned] = 1;
  2576.                             HouseInfo[i][hLocked] = 0;
  2577.                             HouseInfo[i][hRented] = 0;
  2578.                             GivePlayerMoney(playerid, -HouseInfo[i][hPrice]);
  2579.                             GivePlayerMoney(GetPVarInt(playerid, "Seller"), HouseInfo[i][hPrice]);
  2580.                             if(HouseInfo[i][hRentDisabled] == 0)
  2581.                             {
  2582.                                 DestroyPickup(HouseInfo[i][hPickup]);
  2583.                                 HouseInfo[i][hPickup] = CreatePickup(1239, 23, HouseInfo[i][hEnterX], HouseInfo[i][hEnterY], HouseInfo[i][hEnterZ], 0);
  2584.                                 format(hstring, sizeof(hstring), "Owner: %s\nHouse ID: %d\nRent User: %s\nRent Price: %d", HouseInfo[i][hOwner], i, HouseInfo[i][hRentUser], HouseInfo[i][hRentPrice]);
  2585.                                 Update3DTextLabelText(HouseInfo[i][hLabel], 0x21DD00FF, hstring);
  2586.                             }
  2587.                             else
  2588.                             {
  2589.                                 DestroyPickup(HouseInfo[i][hPickup]);
  2590.                                 HouseInfo[i][hPickup] = CreatePickup(1239, 23, HouseInfo[i][hEnterX], HouseInfo[i][hEnterY], HouseInfo[i][hEnterZ], 0);
  2591.                                 format(hstring, sizeof(hstring), "Owner: %s\nHouse ID: %d\nRent Disabled", HouseInfo[i][hOwner], i);
  2592.                                 Update3DTextLabelText(HouseInfo[i][hLabel], 0x21DD00FF, hstring);
  2593.                             }
  2594.                             format(selledstring, sizeof(selledstring), "You bought house from player %s for %d$", GetName(GetPVarInt(playerid, "Seller")), HouseInfo[i][hPrice]);
  2595.                             SendClientMessage(playerid, COLOR_YELLOW, selledstring);
  2596.                             format(selledstring2, sizeof(selledstring2), "House sold to player %s for %d$", GetName(playerid), HouseInfo[i][hPrice]);
  2597.                             SendClientMessage(GetPVarInt(playerid, "Seller"), COLOR_YELLOW, selledstring2);
  2598.                             mysql_free_result();
  2599.  
  2600.                             format(HQuery, sizeof(HQuery), "UPDATE `house` SET `User` = '%s', `Owned` = 1, `Locked` = 0, `Rent User` = 'None', `Rented` = 0 WHERE `HouseID` = %d", GetName(playerid), i);
  2601.                             mysql_query(HQuery);
  2602.                         }
  2603.                     }
  2604.                 }
  2605.             }
  2606.         }
  2607.         case 5689: //dialog for house car controling
  2608.         {
  2609.             if(!response) return 0;
  2610.             switch(listitem)
  2611.             {
  2612.                 case 0:
  2613.                 {
  2614.                     if(!response) return 0;
  2615.                     foreach(Houses, i)
  2616.                     {
  2617.                         new HQuery2[200];
  2618.                         format(HQuery2, sizeof(HQuery2), "SELECT HouseID FROM `house` WHERE `HouseID` = '%d'", i);
  2619.                         mysql_query(HQuery2);
  2620.                         mysql_store_result();
  2621.                         if(!strcmp(HouseInfo[i][hCarOwner], GetName(playerid), false))
  2622.                         {
  2623.                             HouseInfo[i][hCarLocked] = 1;
  2624.                             GameTextForPlayer(playerid, "House car ~r~locked!", 2000, 5);
  2625.  
  2626.                             format(HQuery, sizeof(HQuery), "UPDATE `house` SET `Car Locked` = 1 WHERE `HouseID` = %d", i);
  2627.                             mysql_query(HQuery);
  2628.                         }
  2629.                         mysql_free_result();
  2630.                     }
  2631.                 }
  2632.                 case 1:
  2633.                 {
  2634.                     if(!response) return 0;
  2635.                     foreach(Houses, i)
  2636.                     {
  2637.                         new HQuery2[200];
  2638.                         format(HQuery2, sizeof(HQuery2), "SELECT HouseID FROM `house` WHERE `HouseID` = '%d'", i);
  2639.                         mysql_query(HQuery2);
  2640.                         mysql_store_result();
  2641.                         if(!strcmp(HouseInfo[i][hCarOwner], GetName(playerid), false))
  2642.                         {
  2643.                             HouseInfo[i][hCarLocked] = 0;
  2644.                             GameTextForPlayer(playerid, "House car ~g~unlocked!", 2000, 5);
  2645.  
  2646.                             format(HQuery, sizeof(HQuery), "UPDATE `house` SET `Car Locked` = 0 WHERE `HouseID` = %d", i);
  2647.                             mysql_query(HQuery);
  2648.                         }
  2649.                         mysql_free_result();
  2650.                     }
  2651.                 }
  2652.                 case 2:
  2653.                 {
  2654.                     if(!response) return ShowPlayerDialog(playerid, 5689, DIALOG_STYLE_LIST, "   Control your house car!", "Lock house car\nUnlock house car\nStore weapon\nTake weapon\nStore money\nTake money", "Ok", "Exit");
  2655.                     foreach(Houses, i)
  2656.                     {
  2657.                         new HQuery2[200];
  2658.                         format(HQuery2, sizeof(HQuery2), "SELECT HouseID FROM `house` WHERE `HouseID` = '%d'", i);
  2659.                         mysql_query(HQuery2);
  2660.                         mysql_store_result();
  2661.                         if(mysql_num_rows() == 1)
  2662.                         {
  2663.                             if(!strcmp(HouseInfo[i][hCarOwner], GetName(playerid), false))
  2664.                             {
  2665.                                 new gunstring[128], gunstring1[128], gunstring2[128];
  2666.                                 if(HouseInfo[i][hCarWeaponID1] == 0) format(gunstring1, sizeof(gunstring1), "Nothing");
  2667.                                 else format(gunstring1, sizeof(gunstring1), "Weapon: %s | Ammo: %d", GetWeapon(HouseInfo[i][hCarWeaponID1]), HouseInfo[i][hCarWeaponID1Ammo]);
  2668.  
  2669.                                 if(HouseInfo[i][hCarWeaponID2] == 0) format(gunstring2, sizeof(gunstring1), "Nothing");
  2670.                                 else format(gunstring2, sizeof(gunstring2), "Weapon: %s | Ammo: %d", GetWeapon(HouseInfo[i][hCarWeaponID2]), HouseInfo[i][hCarWeaponID2Ammo]);
  2671.  
  2672.                                 format(gunstring, sizeof(gunstring), "%s\n%s", gunstring1, gunstring2);
  2673.  
  2674.                                 ShowPlayerDialog(playerid, 5690, DIALOG_STYLE_LIST, "   Stored guns", gunstring, "Ok", "Exit");
  2675.                             }
  2676.                         }
  2677.                         mysql_free_result();
  2678.                     }
  2679.                 }
  2680.                 case 3:
  2681.                 {
  2682.                     if(!response) return ShowPlayerDialog(playerid, 5689, DIALOG_STYLE_LIST, "   Control your house car!", "Lock house car\nUnlock house car\nStore weapon\nTake weapon\nStore money\nTake money", "Ok", "Exit");
  2683.                     foreach(Houses, i)
  2684.                     {
  2685.                         new HQuery2[200];
  2686.                         format(HQuery2, sizeof(HQuery2), "SELECT HouseID FROM `house` WHERE `HouseID` = '%d'", i);
  2687.                         mysql_query(HQuery2);
  2688.                         mysql_store_result();
  2689.                         if(mysql_num_rows() == 1)
  2690.                         {
  2691.                             if(!strcmp(HouseInfo[i][hCarOwner], GetName(playerid), false))
  2692.                             {
  2693.                                 new gunstring[128], gunstring1[128], gunstring2[128];
  2694.                                 if(HouseInfo[i][hCarWeaponID1] == 0) format(gunstring1, sizeof(gunstring1), "Nothing");
  2695.                                 else format(gunstring1, sizeof(gunstring1), "Weapon: %s | Ammo: %d", GetWeapon(HouseInfo[i][hCarWeaponID1]), HouseInfo[i][hCarWeaponID1Ammo]);
  2696.  
  2697.                                 if(HouseInfo[i][hCarWeaponID2] == 0) format(gunstring2, sizeof(gunstring1), "Nothing");
  2698.                                 else format(gunstring2, sizeof(gunstring2), "Weapon: %s | Ammo: %d", GetWeapon(HouseInfo[i][hCarWeaponID2]), HouseInfo[i][hCarWeaponID2Ammo]);
  2699.  
  2700.                                 format(gunstring, sizeof(gunstring), "%s\n%s", gunstring1, gunstring2);
  2701.  
  2702.                                 ShowPlayerDialog(playerid, 5693, DIALOG_STYLE_LIST, "   Stored guns", gunstring, "Ok", "Exit");
  2703.                             }
  2704.                             mysql_free_result();
  2705.                         }
  2706.                     }
  2707.                 }
  2708.                 case 4:
  2709.                 {
  2710.                     if(!response) return ShowPlayerDialog(playerid, 5689, DIALOG_STYLE_LIST, "   Control your house car!", "Lock house car\nUnlock house car\nStore weapon\nTake weapon\nStore money\nTake money", "Ok", "Exit");
  2711.                     foreach(Houses, i)
  2712.                     {
  2713.                         new HQuery2[200];
  2714.                         format(HQuery2, sizeof(HQuery2), "SELECT HouseID FROM `house` WHERE `HouseID` = '%d'", i);
  2715.                         mysql_query(HQuery2);
  2716.                         mysql_store_result();
  2717.                         if(mysql_num_rows() == 1)
  2718.                         {
  2719.                             if(!strcmp(HouseInfo[i][hCarOwner], GetName(playerid), false))
  2720.                             {
  2721.                                 new moneystring[128];
  2722.                                 format(moneystring, sizeof(moneystring), "Current stored money: %d\n\nType ammount of money that you want to store", HouseInfo[i][hCarMoney]);
  2723.                                 ShowPlayerDialog(playerid, 5694, DIALOG_STYLE_INPUT, "   Stored money", moneystring, "Ok", "Back");
  2724.                             }
  2725.                         }
  2726.                         mysql_free_result();
  2727.                     }
  2728.                 }
  2729.                 case 5:
  2730.                 {
  2731.                     if(!response) return ShowPlayerDialog(playerid, 5689, DIALOG_STYLE_LIST, "   Control your house car!", "Lock house car\nUnlock house car\nStore weapon\nTake weapon\nStore money\nTake money", "Ok", "Exit");
  2732.                     foreach(Houses, i)
  2733.                     {
  2734.                         new HQuery2[200];
  2735.                         format(HQuery2, sizeof(HQuery2), "SELECT HouseID FROM `house` WHERE `HouseID` = '%d'", i);
  2736.                         mysql_query(HQuery2);
  2737.                         mysql_store_result();
  2738.                         if(mysql_num_rows() == 1)
  2739.                         {
  2740.                             if(!strcmp(HouseInfo[i][hCarOwner], GetName(playerid), false))
  2741.                             {
  2742.                                 new moneystring[128];
  2743.                                 format(moneystring, sizeof(moneystring), "Current stored money: %d\n\nType ammount of money that you want to take", HouseInfo[i][hCarMoney]);
  2744.                                 ShowPlayerDialog(playerid, 5695, DIALOG_STYLE_INPUT, "   Stored money", moneystring, "Ok", "Back");
  2745.                             }
  2746.                         }
  2747.                         mysql_free_result();
  2748.                     }
  2749.                 }
  2750.             }
  2751.         }
  2752.         case 5690: //dialog with all stored guns
  2753.         {
  2754.             if(!response) return ShowPlayerDialog(playerid, 5689, DIALOG_STYLE_LIST, "   Control your house car!", "Lock house car\nUnlock house car\nStore weapon\nTake weapon\nStore money\nTake money", "Ok", "Exit");
  2755.             switch(listitem)
  2756.             {
  2757.                 case 0:
  2758.                 {
  2759.                     ShowPlayerDialog(playerid, 5691, DIALOG_STYLE_INPUT, "  Gun", "Type a gun ID that you want to store!", "Ok", "Exit");
  2760.                 }
  2761.                 case 1:
  2762.                 {
  2763.                     ShowPlayerDialog(playerid, 5692, DIALOG_STYLE_INPUT, "  Gun", "Type a gun ID that you want to store!", "Ok", "Exit");
  2764.                 }
  2765.             }
  2766.         }
  2767.         case 5691: //dialog for storing gun in slot 1
  2768.         {
  2769.             if(!response) return ShowPlayerDialog(playerid, 5689, DIALOG_STYLE_LIST, "   Control your house car!", "Lock house car\nUnlock house car\nStore weapon\nTake weapon\nStore money\nTake money", "Ok", "Exit");
  2770.             foreach(Houses, i)
  2771.             {
  2772.                 new HQuery2[200];
  2773.                 format(HQuery2, sizeof(HQuery2), "SELECT HouseID FROM `house` WHERE `HouseID` = '%d'", i);
  2774.                 mysql_query(HQuery2);
  2775.                 mysql_store_result();
  2776.                 if(mysql_num_rows() == 1)
  2777.                 {
  2778.                     if(!strcmp(HouseInfo[i][hCarOwner], GetName(playerid), false))
  2779.                     {
  2780.                         Custom_GetPlayerWeapon(playerid);
  2781.                         if(House_Weapon[playerid][Custom_GetSlot(strval(inputtext))] == strval(inputtext))
  2782.                         {
  2783.                             if(strval(inputtext) > 0 || strval(inputtext) < 46)
  2784.                             {
  2785.                                 HouseInfo[i][hCarWeaponID1] = strval(inputtext);
  2786.                                 HouseInfo[i][hCarWeaponID1Ammo] = House_Ammo[playerid][Custom_GetSlot(HouseInfo[i][hCarWeaponID1])];
  2787.                                 format(hstring, sizeof(hstring), "Gun ID %d stored in the slot 1", strval(inputtext));
  2788.                                 SendClientMessage(playerid, COLOR_LIME, hstring);
  2789.                                 ShowPlayerDialog(playerid, 5689, DIALOG_STYLE_LIST, "   Control your house car!", "Lock house car\nUnlock house car\nStore weapon\nTake weapon\nStore money\nTake money", "Ok", "Exit");
  2790.  
  2791.                                 format(HQuery, sizeof(HQuery), "UPDATE `house` SET `Car Weapon ID 1` = %d, `Car Weapon ID 1 Ammo` = %d WHERE `HouseID` = %d", strval(inputtext), HouseInfo[i][hCarWeaponID1Ammo], i);
  2792.                                 mysql_query(HQuery);
  2793.                             }
  2794.                             else
  2795.                             {
  2796.                                 SendClientMessage(playerid, COLOR_KRED, "Invalid gun ID!");
  2797.                                 ShowPlayerDialog(playerid, 5691, DIALOG_STYLE_INPUT, "  Gun", "Type a gun ID that you want to store!", "Ok", "Exit");
  2798.                             }
  2799.                         }
  2800.                         else
  2801.                         {
  2802.                             SendClientMessage(playerid, COLOR_KRED, "You don't have that gun!");
  2803.                             ShowPlayerDialog(playerid, 5691, DIALOG_STYLE_INPUT, "  Gun", "Type a gun ID that you want to store!", "Ok", "Exit");
  2804.                         }
  2805.                     }
  2806.                 }
  2807.                 mysql_free_result();
  2808.             }
  2809.         }
  2810.         case 5692: //dialog for storing gun in slot 2
  2811.         {
  2812.             if(!response) return ShowPlayerDialog(playerid, 5689, DIALOG_STYLE_LIST, "   Control your house car!", "Lock house car\nUnlock house car\nStore weapon\nTake weapon\nStore money\nTake money", "Ok", "Exit");
  2813.             foreach(Houses, i)
  2814.             {
  2815.                 new HQuery2[200];
  2816.                 format(HQuery2, sizeof(HQuery2), "SELECT HouseID FROM `house` WHERE `HouseID` = '%d'", i);
  2817.                 mysql_query(HQuery2);
  2818.                 mysql_store_result();
  2819.                 if(mysql_num_rows() == 1)
  2820.                 {
  2821.                     if(!strcmp(HouseInfo[i][hCarOwner], GetName(playerid), false))
  2822.                     {
  2823.                         Custom_GetPlayerWeapon(playerid);
  2824.                         if(House_Weapon[playerid][Custom_GetSlot(strval(inputtext))] == strval(inputtext))
  2825.                         {
  2826.                             if(strval(inputtext) > 0 || strval(inputtext) < 46)
  2827.                             {
  2828.                                 HouseInfo[i][hCarWeaponID2] = strval(inputtext);
  2829.                                 HouseInfo[i][hCarWeaponID2Ammo] = House_Ammo[playerid][Custom_GetSlot(HouseInfo[i][hCarWeaponID2])];
  2830.                                 format(hstring, sizeof(hstring), "Gun ID %d stored in the slot 2", strval(inputtext));
  2831.                                 SendClientMessage(playerid, COLOR_LIME, hstring);
  2832.                                 ShowPlayerDialog(playerid, 5689, DIALOG_STYLE_LIST, "   Control your house car!", "Lock house car\nUnlock house car\nStore weapon\nTake weapon\nStore money\nTake money", "Ok", "Exit");
  2833.  
  2834.                                 format(HQuery, sizeof(HQuery), "UPDATE `house` SET `Car Weapon ID 2` = %d, `Car Weapon ID 2 Ammo` = %d WHERE `HouseID` = %d", strval(inputtext), HouseInfo[i][hCarWeaponID2Ammo], i);
  2835.                                 mysql_query(HQuery);
  2836.                             }
  2837.                             else
  2838.                             {
  2839.                                 SendClientMessage(playerid, COLOR_KRED, "Invalid gun ID!");
  2840.                                 ShowPlayerDialog(playerid, 5691, DIALOG_STYLE_INPUT, "  Gun", "Type a gun ID that you want to store!", "Ok", "Exit");
  2841.                             }
  2842.                         }
  2843.                         else
  2844.                         {
  2845.                             SendClientMessage(playerid, COLOR_KRED, "You don't have that gun!");
  2846.                             ShowPlayerDialog(playerid, 5691, DIALOG_STYLE_INPUT, "  Gun", "Type a gun ID that you want to store!", "Ok", "Exit");
  2847.                         }
  2848.                     }
  2849.                 }
  2850.                 mysql_free_result();
  2851.             }
  2852.         }
  2853.         case 5693: //dialog for taking gun
  2854.         {
  2855.             if(!response) return ShowPlayerDialog(playerid, 5678, DIALOG_STYLE_LIST, "   Control your house!", "Lock house\nUnlock house\nSet rent price\nStore weapon\nTake weapon\nStore money\nTake money\nKick rent user", "Ok", "Exit");
  2856.             switch(listitem)
  2857.             {
  2858.                 case 0: //slot 1
  2859.                 {
  2860.                     if(!response) return ShowPlayerDialog(playerid, 5689, DIALOG_STYLE_LIST, "   Control your house car!", "Lock house car\nUnlock house car\nStore weapon\nTake weapon\nStore money\nTake money", "Ok", "Exit");
  2861.                     foreach(Houses, i)
  2862.                     {
  2863.                         new HQuery2[200];
  2864.                         format(HQuery2, sizeof(HQuery2), "SELECT HouseID FROM `house` WHERE `HouseID` = '%d'", i);
  2865.                         mysql_query(HQuery2);
  2866.                         mysql_store_result();
  2867.                         if(mysql_num_rows() == 1)
  2868.                         {
  2869.                             if(!strcmp(HouseInfo[i][hCarOwner], GetName(playerid), false))
  2870.                             {
  2871.                                 if(HouseInfo[i][hCarWeaponID1] > 1) //if slot isn't empty (Emty slot is weapon ID 0 (Hand))
  2872.                                 {
  2873.                                     GivePlayerWeapon(playerid, HouseInfo[i][hCarWeaponID1], HouseInfo[i][hCarWeaponID1Ammo]);
  2874.                                     HouseInfo[i][hCarWeaponID1] = 0;
  2875.                                     HouseInfo[i][hCarWeaponID1Ammo] = 0;
  2876.                                     ShowPlayerDialog(playerid, 5689, DIALOG_STYLE_LIST, "   Control your house car!", "Lock house car\nUnlock house car\nStore weapon\nTake weapon\nStore money\nTake money", "Ok", "Exit");
  2877.  
  2878.                                     format(HQuery, sizeof(HQuery), "UPDATE `house` SET `Car Weapon ID 1` = 0, `Car Weapon ID 1 Ammo` = 0 WHERE `HouseID` = %d", i);
  2879.                                     mysql_query(HQuery);
  2880.                                 }
  2881.                                 else
  2882.                                 {
  2883.                                     SendClientMessage(playerid, COLOR_KRED, "That slot is empty!");
  2884.                                     ShowPlayerDialog(playerid, 5689, DIALOG_STYLE_LIST, "   Control your house car!", "Lock house car\nUnlock house car\nStore weapon\nTake weapon\nStore money\nTake money", "Ok", "Exit");
  2885.                                 }
  2886.                             }
  2887.                             mysql_free_result();
  2888.                         }
  2889.                     }
  2890.                 }
  2891.                 case 1: //slot 2
  2892.                 {
  2893.                     if(!response) return ShowPlayerDialog(playerid, 5689, DIALOG_STYLE_LIST, "   Control your house car!", "Lock house car\nUnlock house car\nStore weapon\nTake weapon\nStore money\nTake money", "Ok", "Exit");
  2894.                     foreach(Houses, i)
  2895.                     {
  2896.                         new HQuery2[200];
  2897.                         format(HQuery2, sizeof(HQuery2), "SELECT HouseID FROM `house` WHERE `HouseID` = '%d'", i);
  2898.                         mysql_query(HQuery2);
  2899.                         mysql_store_result();
  2900.                         if(mysql_num_rows() == 1)
  2901.                         {
  2902.                             if(!strcmp(HouseInfo[i][hCarOwner], GetName(playerid), false))
  2903.                             {
  2904.                                 if(HouseInfo[i][hCarWeaponID2] > 1) //if slot isn't empty (Emty slot is weapon ID 0 (Hand))
  2905.                                 {
  2906.                                     GivePlayerWeapon(playerid, HouseInfo[i][hCarWeaponID2], HouseInfo[i][hCarWeaponID2Ammo]);
  2907.                                     HouseInfo[i][hCarWeaponID2] = 0;
  2908.                                     HouseInfo[i][hCarWeaponID2Ammo] = 0;
  2909.                                     ShowPlayerDialog(playerid, 5689, DIALOG_STYLE_LIST, "   Control your house car!", "Lock house car\nUnlock house car\nStore weapon\nTake weapon\nStore money\nTake money", "Ok", "Exit");
  2910.  
  2911.                                     format(HQuery, sizeof(HQuery), "UPDATE `house` SET `Car Weapon ID 2` = 0, `Car Weapon ID 2 Ammo` = 0 WHERE `HouseID` = %d", i);
  2912.                                     mysql_query(HQuery);
  2913.                                 }
  2914.                                 else
  2915.                                 {
  2916.                                     SendClientMessage(playerid, COLOR_KRED, "That slot is empty!");
  2917.                                     ShowPlayerDialog(playerid, 5689, DIALOG_STYLE_LIST, "   Control your house car!", "Lock house car\nUnlock house car\nStore weapon\nTake weapon\nStore money\nTake money", "Ok", "Exit");
  2918.                                 }
  2919.                             }
  2920.                         }
  2921.                         mysql_free_result();
  2922.                     }
  2923.                 }
  2924.             }
  2925.         }
  2926.         case 5694: //dialog for storing money
  2927.         {
  2928.             if(!response) return ShowPlayerDialog(playerid, 5689, DIALOG_STYLE_LIST, "   Control your house car!", "Lock house car\nUnlock house car\nStore weapon\nTake weapon\nStore money\nTake money", "Ok", "Exit");
  2929.             foreach(Houses, i)
  2930.             {
  2931.                 new HQuery2[200];
  2932.                 format(HQuery2, sizeof(HQuery2), "SELECT HouseID FROM `house` WHERE `HouseID` = '%d'", i);
  2933.                 mysql_query(HQuery2);
  2934.                 mysql_store_result();
  2935.                 if(mysql_num_rows() == 1)
  2936.                 {
  2937.                     if(!strcmp(HouseInfo[i][hCarOwner], GetName(playerid), false))
  2938.                     {
  2939.                         new moneystring[128];
  2940.                         format(moneystring, sizeof(moneystring), "Current stored money: %d\n\nType ammount of money that you want to store", HouseInfo[i][hCarMoney]);
  2941.                         if(!strlen(inputtext)) return ShowPlayerDialog(playerid, 5684, DIALOG_STYLE_INPUT, "   Stored money", moneystring, "Ok", "Back");
  2942.                         if(GetPlayerMoney(playerid) < strval(inputtext))
  2943.                         {
  2944.                             SendClientMessage(playerid, COLOR_KRED, "You don't have enoguh money to store!");
  2945.                             ShowPlayerDialog(playerid, 5694, DIALOG_STYLE_INPUT, "   Stored money", moneystring, "Ok", "Back");
  2946.                             return 1;
  2947.                         }
  2948.                         if(strval(inputtext) > 10000000)
  2949.                         {
  2950.                             SendClientMessage(playerid, COLOR_KRED, "You can store maximum 10000000!");
  2951.                             ShowPlayerDialog(playerid, 5694, DIALOG_STYLE_INPUT, "   Stored money", moneystring, "Ok", "Back");
  2952.                             return 1;
  2953.                         }
  2954.                         HouseInfo[i][hCarMoney] += strval(inputtext);
  2955.                         GivePlayerMoney(playerid, -strval(inputtext));
  2956.                         format(hstring, sizeof(hstring), "You store %d$! Current stored money: %d", strval(inputtext), HouseInfo[i][hCarMoney]);
  2957.                         SendClientMessage(playerid, COLOR_YELLOW, hstring);
  2958.                         ShowPlayerDialog(playerid, 5689, DIALOG_STYLE_LIST, "   Control your house car!", "Lock house car\nUnlock house car\nStore weapon\nTake weapon\nStore money\nTake money", "Ok", "Exit");
  2959.  
  2960.                         format(HQuery, sizeof(HQuery), "UPDATE `house` SET `Car Money` = %d WHERE `HouseID` = %d", HouseInfo[i][hCarMoney], i);
  2961.                         mysql_query(HQuery);
  2962.                     }
  2963.                 }
  2964.                 mysql_free_result();
  2965.             }
  2966.         }
  2967.         case 5695: //dialog for taking money
  2968.         {
  2969.             if(!response) return ShowPlayerDialog(playerid, 5689, DIALOG_STYLE_LIST, "   Control your house car!", "Lock house car\nUnlock house car\nStore weapon\nTake weapon\nStore money\nTake money", "Ok", "Exit");
  2970.             foreach(Houses, i)
  2971.             {
  2972.                 new HQuery2[200];
  2973.                 format(HQuery2, sizeof(HQuery2), "SELECT HouseID FROM `house` WHERE `HouseID` = '%d'", i);
  2974.                 mysql_query(HQuery2);
  2975.                 mysql_store_result();
  2976.                 if(mysql_num_rows() == 1)
  2977.                 {
  2978.                     if(!strcmp(HouseInfo[i][hCarOwner], GetName(playerid), false))
  2979.                     {
  2980.                         new moneystring[128];
  2981.                         format(moneystring, sizeof(moneystring), "Current stored money: %d\n\nType ammount of money that you want to take", HouseInfo[i][hCarMoney]);
  2982.                         if(!strlen(inputtext)) return ShowPlayerDialog(playerid, 5685, DIALOG_STYLE_INPUT, "   Stored money", moneystring, "Ok", "Back");
  2983.                         if(strval(inputtext) > HouseInfo[i][hCarMoney])
  2984.                         {
  2985.                             SendClientMessage(playerid, COLOR_KRED, "House car does not have that much money!");
  2986.                             ShowPlayerDialog(playerid, 5695, DIALOG_STYLE_INPUT, "   Stored money", moneystring, "Ok", "Back");
  2987.                             return 1;
  2988.                         }
  2989.                         HouseInfo[i][hCarMoney] -= strval(inputtext);
  2990.                         GivePlayerMoney(playerid, strval(inputtext));
  2991.                         format(hstring, sizeof(hstring), "You take %d$! Current stored money: %d", strval(inputtext), HouseInfo[i][hCarMoney]);
  2992.                         SendClientMessage(playerid, COLOR_YELLOW, hstring);
  2993.                         ShowPlayerDialog(playerid, 5689, DIALOG_STYLE_LIST, "   Control your house car!", "Lock house car\nUnlock house car\nStore weapon\nTake weapon\nStore money\nTake money", "Ok", "Exit");
  2994.  
  2995.                         format(HQuery, sizeof(HQuery), "UPDATE `house` SET `Car Money` = %d WHERE `HouseID` = %d", HouseInfo[i][hCarMoney], i);
  2996.                         mysql_query(HQuery);
  2997.                     }
  2998.                 }
  2999.                 mysql_free_result();
  3000.             }
  3001.         }
  3002.     }
  3003.     return 1;
  3004. }
  3005.  
  3006. /*
  3007.  
  3008.  • Callback: OnPlayerKeyStateChange(playerid, newkeys, oldkeys)  (Hooked using y_hook)
  3009.  • Action: Player can enter house (If is not locked!) using F or Enter (by default in GTA:SA)
  3010.  
  3011. */
  3012.  
  3013. Hook:H2_OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  3014. {
  3015.     if(newkeys & KEY_SECONDARY_ATTACK && !IsPlayerInAnyVehicle(playerid))
  3016.     {
  3017.         foreach(Houses, i)
  3018.         {
  3019.             if(IsPlayerInRangeOfPoint(playerid, 3.0, HouseInfo[i][hEnterX], HouseInfo[i][hEnterY], HouseInfo[i][hEnterZ]) && GetPlayerInterior(playerid) == 0 && GetPlayerVirtualWorld(playerid) == 0)
  3020.             {
  3021.                 if(HouseInfo[i][hLocked] == 0)
  3022.                 {
  3023.                     if(!strcmp(HouseInfo[i][hOwner], GetName(playerid), false))
  3024.                     {
  3025.                         PlayerEnteredHisHouse[playerid] = true;
  3026.                     }
  3027.                     SetPlayerInterior(playerid, HouseInfo[i][hInterior]);
  3028.                     SetPlayerVirtualWorld(playerid, HouseInfo[i][hVirtualWorld]);
  3029.                     SetPlayerPos(playerid, HouseInfo[i][hExitX], HouseInfo[i][hExitY], HouseInfo[i][hExitZ]);
  3030.                     return CallLocalFunction("OnPlayerEnterHouse", "dd", playerid, i);
  3031.                 }
  3032.                 else SendClientMessage(playerid, COLOR_KRED, "House is locked!");
  3033.             }
  3034.             else if(IsPlayerInRangeOfPoint(playerid, 3.0, HouseInfo[i][hExitX], HouseInfo[i][hExitY], HouseInfo[i][hExitZ]) && GetPlayerInterior(playerid) == HouseInfo[i][hInterior] && GetPlayerVirtualWorld(playerid) == HouseInfo[i][hVirtualWorld])
  3035.             {
  3036.                 if(HouseInfo[i][hLocked] == 0)
  3037.                 {
  3038.                     if(!strcmp(HouseInfo[i][hOwner], GetName(playerid), false))
  3039.                     {
  3040.                         PlayerEnteredHisHouse[playerid] = false;
  3041.                     }
  3042.                     SetPlayerInterior(playerid, 0);
  3043.                     SetPlayerVirtualWorld(playerid, 0);
  3044.                     SetPlayerPos(playerid, HouseInfo[i][hEnterX], HouseInfo[i][hEnterY], HouseInfo[i][hEnterZ]);
  3045.                     return CallLocalFunction("OnPlayerExitHouse", "dd", playerid, i);
  3046.                 }
  3047.                 else SendClientMessage(playerid, COLOR_KRED, "House is locked!");
  3048.             }
  3049.         }
  3050.     }
  3051.     return 1;
  3052. }
  3053.  
  3054. Hook:H3_OnGameModeInit()
  3055. {
  3056.     RentFeeTimer = SetTimer("RentFeeUp", 3600000, 0);
  3057.     return 1;
  3058. }
  3059.  
  3060. Hook:H4_OnGameModeExit()
  3061. {
  3062.     KillTimer(RentFeeTimer);
  3063.     return 1;
  3064. }
  3065.  
  3066. /*
  3067.  
  3068.  • Callback: OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)  (Hooked using y_hook)
  3069.  • Action: Player can enter house car (If is not locked!) using F or Enter (by default in GTA:SA)
  3070.  
  3071. */
  3072.  
  3073. Hook:H5_OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
  3074. {
  3075.     foreach(Houses, i)
  3076.     {
  3077.         new HQuery2[200];
  3078.         format(HQuery2, sizeof(HQuery2), "SELECT HouseID FROM `house` WHERE `HouseID` = '%d'", i);
  3079.         mysql_query(HQuery2);
  3080.         mysql_store_result();
  3081.         if(mysql_num_rows() == 1)
  3082.         {
  3083.             if(vehicleid == HouseInfo[i][hCar]) CallLocalFunction("OnPlayerEnterHouseVehicle", "d", playerid);
  3084.             if(HouseInfo[i][hCarLocked] == 1 && !IsPlayerInAnyVehicle(playerid))
  3085.             {
  3086.                 SendClientMessage(playerid, COLOR_KRED, "House car is locked!");
  3087.                 GetPlayerPos(playerid, PPos[0], PPos[1], PPos[2]);
  3088.                 SetPlayerPos(playerid, PPos[0], PPos[1], PPos[2]);
  3089.                 return 1;
  3090.             }
  3091.             if(!strcmp(HouseInfo[i][hCarOwner], GetName(playerid), false))
  3092.             {
  3093.                 PlayerEnteredHisHouseCar[playerid] = true;
  3094.             }
  3095.         }
  3096.         mysql_free_result();
  3097.     }
  3098.     return 1;
  3099. }
  3100.  
  3101. /*
  3102.  
  3103.  • Callback: OnPlayerExitVehicle(playerid, vehicleid)  (Hooked using y_hook)
  3104.  • Action: Player can exit house car using F or Enter (by default in GTA:SA)
  3105.  
  3106. */
  3107.  
  3108. Hook:H6_OnPlayerExitVehicle(playerid, vehicleid)
  3109. {
  3110.     foreach(Houses, i)
  3111.     {
  3112.         new HQuery2[200];
  3113.         format(HQuery2, sizeof(HQuery2), "SELECT HouseID FROM `house` WHERE `HouseID` = '%d'", i);
  3114.         mysql_query(HQuery2);
  3115.         mysql_store_result();
  3116.         if(mysql_num_rows() == 1)
  3117.         {
  3118.             if(vehicleid == HouseInfo[i][hCar]) CallLocalFunction("OnPlayerExitHouseVehicle", "d", playerid);
  3119.             if(HouseInfo[i][hCarLocked] == 1 && !IsPlayerInAnyVehicle(playerid))
  3120.             {
  3121.                 SendClientMessage(playerid, COLOR_KRED, "House car is locked!");
  3122.                 GetPlayerPos(playerid, PPos[0], PPos[1], PPos[2]);
  3123.                 SetPlayerPos(playerid, PPos[0], PPos[1], PPos[2]);
  3124.                 return 1;
  3125.             }
  3126.             if(!strcmp(HouseInfo[i][hCarOwner], GetName(playerid), false))
  3127.             {
  3128.                 PlayerEnteredHisHouseCar[playerid] = false;
  3129.             }
  3130.         }
  3131.         mysql_free_result();
  3132.     }
  3133.     return 1;
  3134. }
  3135.  
  3136. Hook:H7_OnPlayerConnect(playerid)
  3137. {
  3138.     new credits[128];
  3139.     format(credits, sizeof(credits), "This server use S32_House %s by System32!", house_version);
  3140.     SendClientMessage(playerid, COLOR_LIME, credits);
  3141.    
  3142.     PlayerEnteredHisHouse[playerid] = false;
  3143.     PlayerEnteredHisHouseCar[playerid] = false;
  3144.     HouseLockBreaking[playerid] = 0;
  3145.     return 1;
  3146. }
  3147.  
  3148. Hook:H8_OnPlayerDisconnect(playerid, reason)
  3149. {
  3150.     PlayerEnteredHisHouse[playerid] = false;
  3151.     PlayerEnteredHisHouseCar[playerid] = false;
  3152.     HouseLockBreaking[playerid] = 0;
  3153.     return 1;
  3154. }
  3155.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement