Advertisement
Sasino97

[ITALIANO]SLARP Houses - A version adapted to my RP GM

Jul 9th, 2011
231
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 58.11 KB | None | 0 0
  1. /*
  2. *                                             Sasino's Los Angeles Real Life Roleplay v1
  3. *
  4. *                                                     AUTORE: [GF]Sasino97
  5. */
  6.  
  7. /*******************************************************[ SLARP HOUSES ]*******************************************************/
  8.  
  9.  
  10.  
  11. #include <a_samp>                                                        //GRAZIE ALLA SA-MP TEAM
  12. #include <SII>                                                           //GRAZIE A [DRuG]Slick PER "Slick's INI Include (SII)"
  13.  
  14. #define FILTERSCRIPT
  15. #define INVALID_HOUSE_ID            -255                                 //Usa Un Qualsiasi Numero Negativo Per Questo (Default -255)
  16.  
  17. #define MAX_HOUSES                  100                                  //Massimo Case
  18. #define MAX_BUSINESSES              100                                  //Massimo Negozi
  19. #define HOUSE_FILE                  "SlarpHouses/Houses/HouseID%d.ini"   //Se Vuoi Cambia Percorso, Ma Non Rimuovere %d.ini
  20. #define BIZ_FILE                    "SlarpHouses/Stores/BizID%d.ini"     //Se Vuoi Cambia Percorso, Ma Non Rimuovere %d.ini
  21. #define COSTO_MERCI                 100                                  //$/Merce
  22. #define PRINT_HOUSES                                                     //Metti Due Barre Davanti Se Non Vuoi Che Si Stampino Le Azioni Delle Case E Dei Negozi
  23. #define KEY_ENTER_PROPERTY          KEY_SPRINT                           //Cambia Questo Con Il Tasto Che Preferisci Si Usi Per Entrare/Uscire(Default Mouse Cen).
  24.  
  25. #define DIALOG_FORSALE_HOUSE        1500                                 //Non Usare 2 ID Uguali Per I Dialoghi!
  26. #define DIALOG_OTHERS_HOUSE         1501
  27. #define DIALOG_FORSALE_STORE        1504
  28. #define DIALOG_MY_HOUSE             1502
  29. #define DIALOG_SELL_HOUSE           1503
  30. #define DIALOG_OTHERS_STORE         1505
  31. #define DIALOG_MY_STORE             1506
  32. #define DIALOG_SELL_STORE           1507
  33. #define DIALOG_RENAME_STORE         1508
  34. #define DIALOG_MAIN_STORAGE         1509
  35. #define DIALOG_DEPOSIT_MONEY        1510
  36. #define DIALOG_WITHDRAW_MONEY       1511
  37. #define DIALOG_DEPOSIT_WEAPONS      1512
  38. #define DIALOG_WITHDRAW_WEAPONS     1513
  39. #define DIALOG_ORDER_GOODS          1514
  40.  
  41. forward AddBusinessMoney(bizid, money);
  42. forward SaveHouseAndStoreInformation();
  43.  
  44. new HousePickup[MAX_HOUSES];
  45. new BizPickup[MAX_BUSINESSES];
  46. new LastHouse[MAX_PLAYERS];
  47.  
  48. enum StorageInfo
  49. {
  50.   sMoney,
  51.   Weap0,
  52.   Ammo0,
  53.   Weap1,
  54.   Ammo1,
  55.   Weap2,
  56.   Ammo2,
  57.   Weap3,
  58.   Ammo3,
  59.   Weap4,
  60.   Ammo4,
  61.   Weap5,
  62.   Ammo5,
  63.   Weap6,
  64.   Ammo6,
  65.   Weap7,
  66.   Ammo7,
  67.   Weap8,
  68.   Ammo8,
  69.   Weap9,
  70.   Ammo9,
  71.   Weap10,
  72.   Ammo10,
  73.   Weap11,
  74.   Ammo11,
  75.   Weap12,
  76.   Ammo12,
  77. }
  78.  
  79. new sInfo[MAX_HOUSES][StorageInfo];
  80.  
  81. enum HouseInfo
  82. {
  83.   Name[24],
  84.   Cost,
  85.   Sell,
  86.   Interior,
  87.   Exterior,
  88.   VirtualWorld,
  89.   Locked,
  90.   Float:InteriorX,
  91.   Float:InteriorY,
  92.   Float:InteriorZ,
  93.   Float:ExteriorX,
  94.   Float:ExteriorY,
  95.   Float:ExteriorZ,
  96. }
  97.  
  98. new hInfo[MAX_HOUSES][HouseInfo];
  99.  
  100. enum BusinessInfo
  101. {
  102.   bName[24],
  103.   bTitle[51],
  104.   bCost,
  105.   bSell,
  106.   bInterior,
  107.   bVirtualWorld,
  108.   bLocked,
  109.   bCashRegister,
  110.   bRifornimenti,
  111.   bEnter,
  112.   Float:bInteriorX,
  113.   Float:bInteriorY,
  114.   Float:bInteriorZ,
  115.   Float:bExteriorX,
  116.   Float:bExteriorY,
  117.   Float:bExteriorZ,
  118. }
  119.  
  120. new bInfo[MAX_BUSINESSES][BusinessInfo];
  121.  
  122. public OnFilterScriptInit()
  123. {
  124.   print("\n-------------FILTERSCRIPT-----------------");
  125.   print(" SLARP - Gamemode di [GF]Sasino97 - 2011    ");
  126.   print("------------------------------------------\n");
  127.  
  128.   //CASE
  129.  
  130.   /*LOS ANGELES*/
  131.  
  132.   /*
  133.     0 CreateSlarpObject(14714, 1500.8342, -1723.4686, -50.3142, 0.0000, 0.0000, 0.0000, STREAM_DISTANCE); //Piani: 1. Corridoio a L, tre stanze con tappeto, una con parquet e una con mattonelle.
  134.     1 CreateSlarpObject(14700, 1550.8342, -1723.4686, -50.3142, 0.0000, 0.0000, 0.0000, STREAM_DISTANCE); //Piani: 1. Breve corridoio, tre stanze con tappeto e 2 con mattonelle.
  135.     2 CreateSlarpObject(14711, 1600.8342, -1723.4686, -50.3142, 0.0000, 0.0000, 0.0000, STREAM_DISTANCE); //Piani: 1. Corridoio a L, 1 salotto una stanza e una cucina.
  136.     3 CreateSlarpObject(14701, 1650.8342, -1723.4686, -50.3142, 0.0000, 0.0000, 0.0000, STREAM_DISTANCE); //Piani: 1. Corridoio a L, 3 stanze parquet, 2 mattonelle.
  137.     4 CreateSlarpObject(14710, 1700.8342, -1723.4686, -50.3142, 0.0000, 0.0000, 0.0000, STREAM_DISTANCE); //Piani: 1. Corridoio a mezza svastica, 4 stanze di differenti dimensioni.
  138.     5 CreateSlarpObject(14712, 1750.8342, -1723.4686, -50.3142, 0.0000, 0.0000, 0.0000, STREAM_DISTANCE); //Piani: 1. Entrata in salotto con tappeto, cucina e bagno con mattonelle, stanza da letto con tappeto.
  139.     6 CreateSlarpObject(14708, 1800.8342, -1723.4686, -50.3142, 0.0000, 0.0000, 0.0000, STREAM_DISTANCE); //Piani: 2. Corridoio a I, 4 stanze con parquet, due con mattonelle.
  140.     7 CreateSlarpObject(14707, 1850.8342, -1723.4686, -50.3142, 0.0000, 0.0000, 0.0000, STREAM_DISTANCE); //Piani: 2. 2 Corridoi, uno a I e uno a L, 2 stanze parquet grandi, 2 parquet piccole e 2 mattonellate.
  141.     8 CreateSlarpObject(14758, 1900.8342, -1723.4686, -50.3142, 0.0000, 0.0000, 0.0000, STREAM_DISTANCE); //Piani: 2. Casa che uso io al momento.
  142.     9 CreateSlarpObject(14754, 1950.8342, -1723.4686, -50.3142, 0.0000, 0.0000, 0.0000, STREAM_DISTANCE); //Piani: 2. Corridoio a I. 2 camere parquet, una mattonelle grande e 2 piccole.
  143.     10 CreateSlarpObject(14750, 2000.8342, -1723.4686, -50.3142, 0.0000, 0.0000, 0.0000, STREAM_DISTANCE); //Piani: 2. Corridoio a I. Salotto e altre 3 stanze in parquet, un bagno in mattonelle.
  144.   */
  145.  
  146.   CreateHouse(0, 2249.9990, -1238.4978, 25.8984, 1550.7722, -1726.3321, -50.8142, 55000, 50000, 1, 0, 0);//Case normali
  147.   CreateHouse(1,  822.3635,-1504.9675,14.3474, 1753.8463, -1729.9902, -50.8845, 200000, 150000, 1, 0, 0);// *
  148.   CreateHouse(2,  2579.5705, -1034.4310, 69.5809, 1550.7722, -1726.3321, -50.8142, 30000, 20000, 1, 0, 1);// *
  149.   CreateHouse(3,  2576.1394,-1070.8746,69.8322, 1500.8623, -1730.9697, -51.1188, 50000, 30000, 1, 0, 0);// *
  150.   CreateHouse(4,  2527.6689,-1060.7572,69.5688, 1500.8623, -1730.9697, -51.1188, 20000, 12000, 1, 0, 1);// *
  151.   CreateHouse(5,  2389.8701,-1037.7082,53.5693, 1608.7480, -1716.1524, -50.9083, 40000, 25000, 1, 0, 0);// *
  152.   CreateHouse(6,  2279.1657,-1076.7059,47.6714, 1650.4968, -1732.9945, -51.3845, 50000, 30000, 1, 0, 0);// *
  153.   CreateHouse(7,  2186.2875,-998.2521,66.4687, 1753.8463, -1729.9902, -50.8845, 80000, 60000, 1, 0, 1);// *
  154.   CreateHouse(8,  2091.2529,-973.0701,51.9824, 1650.4968, -1732.9945, -51.3845, 60000, 40000, 1, 0, 1);// *
  155.   CreateHouse(9,  1886.1549,-1113.7022,26.2758, 1650.4968, -1732.9945, -51.3845, 100000, 65000, 1, 0, 2);// *
  156.   CreateHouse(10,  1939.0140, -1114.4953, 27.4522, 1997.5093, -1731.8872, -55.8142, 150000, 100000, 1, 0, 0);// *
  157.   CreateHouse(11,  2092.1232, -1166.6259, 26.5859, 1997.5093, -1731.8872, -55.8142, 150000, 100000, 1, 0, 1);// *
  158.   CreateHouse(12,  2148.0493,-1484.8009,26.6241, 1948.2426, -1731.9064, -53.2526, 200000, 140000, 1, 0, 0);// *
  159.   CreateHouse(13,  2495.3466,-1690.5718,14.7656, 1948.2426, -1731.9064, -53.2526, 300000, 280000, 1, 0, 1);// *
  160.   CreateHouse(14,  2486.4008,-1645.7712,14.0771, 1948.2426, -1731.9064, -53.2526, 300000, 280000, 1, 0, 2);// *
  161.   CreateHouse(15,  2459.3266,-1690.4101,13.5467, 1753.8463, -1729.9902, -50.8845, 300000, 260000, 1, 0, 2);// *
  162.   CreateHouse(16,  2368.2141,-1674.7031,14.1681, 1550.7722, -1726.3321, -50.8142, 100000, 80000, 1, 0, 0);// *
  163.   CreateHouse(17,  2327.7263,-1682.0593,14.9296, 1709.2257, -1726.6661, -50.8298, 100000, 70000, 1, 0, 0);// *
  164.   CreateHouse(18,  2240.1894,-1159.8574,1029.7968, 2236.7822,-1159.6846,1029.7968, 750, 0, 15, 15, 0);// Hotel jefferson
  165.   CreateHouse(19,  2240.4987,-1170.8002,1029.7968, 2236.7731,-1170.7275,1029.7968, 750, 0, 15, 15, 0);//
  166.   CreateHouse(20,  2225.5041,-1187.4376,1029.7968, 2225.4670,-1184.3275,1029.7968, 750, 0, 15, 15, 0);//
  167.   CreateHouse(21,  2209.5314,-1189.3044,1029.7968, 2209.3708,-1192.3546,1029.7968, 750, 0, 15, 15, 0);//
  168.   CreateHouse(22,  2193.8833,-1172.9208,1029.7968, 2197.7578,-1173.0030,1029.8043, 750, 0, 15, 15, 0);//
  169.   CreateHouse(23,  2192.3337,-1157.0329,1029.7968, 2188.4440,-1156.9011,1029.7968, 750, 0, 15, 15, 0);//
  170.   CreateHouse(24, 2266.6511, 1633.4680, 1084.2343, 2217.4606, -1076.2921, 1050.4843, 1000, 1000, 1, 1, 0); //Suite college
  171.   CreateHouse(25, 2271.1032, 1633.5720, 1084.2343, 2217.4606, -1076.2921, 1050.4843, 1000, 1000, 1, 1, 1);
  172.   CreateHouse(26, 2266.8315, 1642.3613, 1084.2343, 2217.4606, -1076.2921, 1050.4843, 1000, 1000, 1, 1, 2);
  173.   CreateHouse(27, 2271.0366, 1642.0928, 1084.2343, 2217.4606, -1076.2921, 1050.4843, 1000, 1000, 1, 1, 3);
  174.   CreateHouse(28, 2266.8239, 1652.6484, 1084.2343, 2217.4606, -1076.2921, 1050.4843, 1000, 1000, 1, 1, 4);
  175.   CreateHouse(29, 2270.8886, 1652.5377, 1084.2343, 2217.4606, -1076.2921, 1050.4843, 1000, 1000, 1, 1, 5);
  176.   CreateHouse(30, 2266.5461, 1662.5410, 1084.2343, 2217.4606, -1076.2921, 1050.4843, 1000, 1000, 1, 1, 6);
  177.   CreateHouse(31, 2270.7197, 1662.4924, 1084.2343, 2217.4606, -1076.2921, 1050.4843, 1000, 1000, 1, 1, 7); //Fine suite
  178.  
  179.   /*SAN FRANCISCO*/
  180.  
  181.   CreateHouse(32, -1842.4879, 1114.6098, 45.4453, 1799.7270, -1731.6682, -51.0754, 200000, 180000, 1, 0, 0);
  182.   CreateHouse(33, -2574.0520, 1151.8555, 55.7265, 1838.3778, -1736.8720, -53.9010, 250000, 200000, 1, 0, 0);
  183.   CreateHouse(34, -2534.5698, 1142.8642, 55.7265, 1838.3778, -1736.8720, -53.9010, 250000, 200000, 1, 0, 1);
  184.   CreateHouse(35, -2493.5131, 1141.3239, 55.7265, 1838.3778, -1736.8720, -53.9010, 250000, 200000, 1, 0, 2);
  185.   CreateHouse(36, -2280.8898, 916.4746, 66.6484, 1709.2257, -1726.6661, -50.8298, 300000, 300000, 1, 0, 1);
  186.   CreateHouse(37, -2168.8242, 743.9059, 64.9659, 1550.7722, -1726.3321, -50.8142, 100000, 70000, 1, 0, 3);
  187.   CreateHouse(38, -2721.4953, 14.4938, 4.3359, 1948.2426, -1731.9064, -53.2526, 400000, 400000, 1, 0, 3);
  188.  
  189.  
  190.   //CreateHouse(houseid, Float:eX, Float:eY, Float:eZ, Float:iX, Float:iY, Float:iZ, BuyPrice, SellPrice, INT, EXT, VW);
  191.  
  192.   //NEGOZI
  193.  
  194.   /*LOS ANGELES*/
  195.  
  196.   CreateBusiness(0,  "Negozio Di Armi", 1367.5292, -1279.8209, 13.5468, 285.8361, -39.0166, 1001.5156, 150000, 100000, 5000,  1, 0, 0);//
  197.   CreateBusiness(1,  "Bar", 2309.5498, -1643.9216, 14.8270, 501.9578, -70.5648, 998.7578, 80000, 50000, 500, 11, 0, 0);//
  198.   CreateBusiness(2,  "Fast Food", 2420.7973, -1508.8027, 24.0000, 366.0002, -9.4338, 1001.8516, 50000, 40000, 1000, 9, 0, 0);//
  199.   CreateBusiness(3,  "Night Club", 2421.6008, -1220.7491, 25.4641, 1204.6689, -13.5429, 1000.9219, 200000, 150000, 1000, 2, 0, 100);//
  200.   CreateBusiness(4,  "Discoteca", 816.0202, -1386.9570, 13.6083, 493.1443, -24.2607, 1000.6797, 100000, 80000, 3000, 17, 0, 20);//
  201.   CreateBusiness(5,  "Burger King", 811.3378, -1616.1252, 13.5468, 366.0248, -73.3478, 1001.5078, 100000, 80000, 1000, 10, 0, 0);//
  202.   CreateBusiness(6,  "Supermercato", 1832.5937, -1842.5585, 13.5781, -25.7220, -187.8216, 1003.5469, 300000, 200000, 5000, 17, 0, 0);//
  203.   CreateBusiness(7,  "Bar", 1952.4853, -2041.3128, 13.5468, 501.9578, -70.5648, 998.7578, 70000, 40000, 500, 11, 1, 0);//
  204.   CreateBusiness(8,  "Sexy Shop", 1940.8619, -2116.1708, 13.6953, -100.2674, -22.9376, 1000.7188, 100000, 50000, 800, 3, 0, 0);//
  205.   CreateBusiness(9,  "Fast Food", 927.5415, -1352.9653, 13.3437, 366.0002, -9.4338, 1001.8516, 150000, 40000, 1000, 9, 1, 0);//
  206.   CreateBusiness(10, "Colazione", 1038.1558, -1339.2880, 13.7265, 449.0172,-88.9894,999.5547, 50000, 40000, 800, 4, 0, 0);//
  207.   CreateBusiness(11, "Supermercato", 2152.5615, -1013.5268, 62.8583, -25.7220, -187.8216, 1003.5469, 300000, 200000, 2000, 17, 1, 0);//
  208.   CreateBusiness(12, "Pizzeria", 2103.7822, -1806.6022, 13.5546, 372.5565, -131.3607, 1001.4922, 200000, 150000, 1000, 5, 0, 0);//
  209.   CreateBusiness(13, "Bar", 2057.6054, -1898.6342, 13.5538, 501.9578, -70.5648, 998.7578, 70000, 40000, 500, 11, 2, 0);//
  210.   CreateBusiness(14, "Supermercato", 1929.9487, -1776.2971, 13.5468, -25.7220, -187.8216, 1003.5469, 300000, 200000, 5000, 17, 2, 0);//
  211.   CreateBusiness(15, "Discoteca", 1835.8925, -1682.4217, 13.3707, -2638.8232, 1407.3395, 906.4609, 250000, 180000, 5000, 3, 0, 20);//
  212.   CreateBusiness(16, "Sub Urban", 2112.7836, -1212.0937, 23.9637, 203.7967, -50.1281, 1001.8046, 300000, 200000, 5000, 1, 0, 0);//
  213.   CreateBusiness(17, "Supermercato", 1352.3432, -1758.1309, 13.5078, -25.7220,-187.8216,1003.5469, 300000, 200000, 5000, 1, 3, 0);//
  214.   CreateBusiness(18, "Scuola Guida", 919.1737, -1252.4110, 16.2109, -2026.8864, -104.5427, 1035.1718, 500000, 300000, 10000, 3, 0, 0);//
  215.   CreateBusiness(19, "Motel", 2232.5322, -1159.7178, 25.8906, 2217.8987, -1150.5592, 1025.7969, 750000, 500000, 20000, 15, 0, 0);//
  216.   CreateBusiness(20, "Palestra", 2226.6572, -1723.6589, 13.5517, 1459.5135, -1731.0631, -1.1080, 200000, 100000, 2000, 1, 0, 100); //
  217.   CreateBusiness(21, "Bar", 2362.0966, -1332.4641, 24.0078, 501.9578, -70.5648, 998.7578, 50000, 10000, 500, 11, 3, 0);//
  218.   CreateBusiness(22, "Fast Food", 2398.2177, -1898.2623, 13.5468, 366.0002, -9.4338, 1001.8516, 150000, 1000, 1000, 9, 2, 0);//
  219.   CreateBusiness(23, "Pronto Soccorso", 2034.1430, -1402.6352, 17.2945, 2365.840087,-1128.746582,1060.790039, 1000000, 900000, 10000, 1, 0, 0);//
  220.   CreateBusiness(24, "College", 1279.5942, -1509.5168, 10.0468, 389.2320, 173.6734, 1008.3828, 1000000, 780000, 20000, 3, 0, 0); //
  221.   CreateBusiness(25, "Supermercato", 2140.2929, -1176.6031, 23.9921, -25.7220, -187.8216, 1003.5469, 300000, 200000, 5000, 17, 4, 0);//
  222.   CreateBusiness(26, "Negozio Arredamento", 2351.3559, -1412.2904, 23.9924, 1250.3684, 6.0684, 1008.2578, 800000, 600000, 10000, 18, 0, 0);//
  223.  
  224.   /*SAN FRANCISCO*/
  225.  
  226.   CreateBusiness(27, "Cluckin' Bell", -2671.4484, 258.5975, 4.6328, 366.0002, -9.4338, 1001.8516, 80000, 60000, 5000, 9, 3, 5);
  227.   CreateBusiness(28, "Banca SF", -2765.6757, 375.4502, 6.335, 2306.3826, -15.2365, 26.7496, 3500000, 3000000, 30000, 0, 1, -10); // -10 = (Interessi)
  228.   CreateBusiness(29, "Pronto Soccorso", -2658.3635, 638.8464, 14.4531, 2365.840087,-1128.746582,1060.790039, 1500000, 120000, 10000, 1, 1, 0);//
  229.   CreateBusiness(30, "Cluckin' Bell", -2671.4484, 258.5975, 4.6328, 366.0002, -9.4338, 1001.8516, 80000, 60000, 5000, 9, 4, 5);//
  230.   CreateBusiness(31, "Distretto Polizia", -1605.5728, 711.6525, 13.8671, 288.4723, 170.0647, 1007.1794, 2500000, 2000000, 25000, 3, 0, 0);//
  231.   CreateBusiness(32, "Burger King", -1911.7137, 828.4608, 35.1726,  366.0248, -73.3478, 1001.5078, 50000, 45000, 1000, 10, 1, 5);//
  232.   CreateBusiness(33, "Pizzeria", -1807.9168, 944.7548, 24.8906, 372.5565, -131.3607, 1001.4922, 80000, 60000, 1500, 5, 1, 5);//
  233.   CreateBusiness(34, "Burger King", -2356.8049, 1008.2071, 50.8984,  366.0248, -73.3478, 1001.5078, 50000, 45000, 1000, 10, 2, 5);//
  234.   CreateBusiness(35, "Negozio RC", -2242.7067, 128.6041, 35.3203, -2240.1028, 136.973, 1035.4141, 40000, 30000, 1000, 6, 0, 10);//
  235.   CreateBusiness(36, "Bar", -2243.0686, -88.0907, 35.3203, 501.9578, -70.5648, 998.7578, 40000, 30000, 1000, 11, 4, 5);//
  236.   CreateBusiness(37, "Muay Thai", -2269.8142, -155.9803, 35.3203, 773.8887, -47.7698, 1000.5859, 350000, 275000, 3000, 6, 0, 200);//
  237.   CreateBusiness(38, "Burger King", -2335.8691, -166.8283, 35.5546, 366.0248, -73.3478, 1001.5078, 60000, 50000, 1200, 10, 3, 5);//
  238.   CreateBusiness(39, "Supermercato", -2509.6132, -50.0326, 25.6826, -26.8339, -55.5846, 1003.5469, 200000, 180000, 5000, 6, 0, 10);//
  239.   CreateBusiness(40, "Sub Urban", -2491.3344, -29.0582, 25.7656, 204.1174, -46.8047, 1001.8047, 250000, 225000, 6000, 1, 1, 5);//
  240.   CreateBusiness(41, "Bar", -2491.3415, -16.8991, 25.7656, 501.9578, -70.5648, 998.7578, 60000, 50000, 600, 11, 5, 15);//
  241.   CreateBusiness(42, "Scuola Guida", -2026.6647, -101.8719, 35.1640, -2026.8864, -104.5427, 1035.1718, 600000, 600000, 15000, 3, 1, 0);//
  242.   CreateBusiness(43, "Victim", -1695.6286, 951.2150, 24.8906, 225.0306, -9.1838, 1002.218, 300000, 350000, 8000, 5, 0, 5);//
  243.   CreateBusiness(44, "Supermercato", -1675.7785, 431.7738, 7.1796, -30.9875, -89.6806, 1003.5469, 100000, 150000, 5000, 18, 0, 5);//
  244.   CreateBusiness(45, "Solarin Industries", -1827.2707, 9.6928, 15.1227, -944.2402, 1886.1536, 5.0051, 5000000, 3000000, 50000, 17, 0, 0);//
  245.  
  246.   //CreateBusiness(bizid, defaultname[51], Float:eX, Float:eY, Float:eZ, Float:iX, Float:iY, Float:iZ, BuyPrice, SellPrice, Earn, INT, VW, EnterPrice);//
  247.  
  248.   SetTimer("SaveHouseAndStoreInformation", 1000, true);
  249.   return 1;
  250. }
  251.  
  252. public OnFilterScriptExit()
  253. {
  254.   DestroyAllHouses();
  255.   DestroyAllStores();
  256.   return 1;
  257. }
  258.  
  259. stock DestroyAllHouses()
  260. {
  261.   for(new i=0;i<MAX_HOUSES;i++)
  262.   {
  263.     DestroyPickup(HousePickup[i]);
  264.   }
  265.   return 1;
  266. }
  267.  
  268. stock DestroyAllStores()
  269. {
  270.   new Text3D:labelid;
  271.   for(new i=0;i<MAX_BUSINESSES;i++)
  272.   {
  273.     DestroyPickup(BizPickup[i]);
  274.   }
  275.   for(new i=0;i<MAX_3DTEXT_GLOBAL;i++)
  276.   {
  277.     Delete3DTextLabel(labelid);
  278.     labelid ++;
  279.   }
  280.   return 1;
  281. }
  282.  
  283. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  284. {
  285.   switch(dialogid)
  286.   {
  287.     case DIALOG_DEPOSIT_MONEY:
  288.     {
  289.       new houseid = LastHouse[playerid];
  290.       if(strval(inputtext) > 100000) return ShowPlayerDialog(playerid, 1499, DIALOG_STYLE_MSGBOX, "{FF0000}ERRORE", "Il Massimo E' $100000","OK","");
  291.       if(strval(inputtext) > GetPlayerMoney(playerid))
  292.       {
  293.         new str[256];
  294.         format(str,sizeof(str),"Non Hai $%d Nel Portafogli", strval(inputtext));
  295.         ShowPlayerDialog(playerid, 1499, DIALOG_STYLE_MSGBOX, "{FF0000}ERRORE", str,"OK","");
  296.         return 1;
  297.       }
  298.       new string[256];
  299.       format(string,sizeof(string),HOUSE_FILE, houseid);
  300.       INI_Open(string);
  301.       new X = INI_ReadInt("StorageMoney");
  302.       INI_WriteInt("StorageMoney", X+strval(inputtext));
  303.       INI_Save();
  304.       INI_Close();
  305.       GivePlayerMoney(playerid, -strval(inputtext));
  306.       return 1;
  307.     }
  308.     case DIALOG_WITHDRAW_MONEY:
  309.     {
  310.       new houseid = LastHouse[playerid];
  311.       if(strval(inputtext) > 100000) return ShowPlayerDialog(playerid, 1499, DIALOG_STYLE_MSGBOX, "{FF0000}ERRORE", "Il Massimo E' $100000","OK","");
  312.       new string[256];
  313.       format(string,sizeof(string),HOUSE_FILE, houseid);
  314.       INI_Open(string);
  315.       new X = INI_ReadInt("StorageMoney");
  316.       if(strval(inputtext) > X)
  317.       {
  318.         new str[256];
  319.         format(str,sizeof(str),"Non Hai $%d Nello Storage", strval(inputtext));
  320.         ShowPlayerDialog(playerid, 1499, DIALOG_STYLE_MSGBOX, "{FF0000}ERRORE", str,"OK","");
  321.         INI_Close();
  322.         return 1;
  323.       }
  324.       INI_WriteInt("StorageMoney", X-strval(inputtext));
  325.       INI_Save();
  326.       INI_Close();
  327.       GivePlayerMoney(playerid, strval(inputtext));
  328.       return 1;
  329.     }
  330.     case DIALOG_MAIN_STORAGE:
  331.     {
  332.       new houseid = LastHouse[playerid];
  333.       if(!response) return 1;
  334.       switch(listitem)
  335.       {
  336.         case 0:
  337.         {
  338.           new string[256];
  339.           new X;
  340.           format(string,sizeof(string), HOUSE_FILE, houseid);
  341.           INI_Open(string);
  342.           X = INI_ReadInt("StorageMoney");
  343.           INI_Close();
  344.           new str[128];
  345.           format(str,sizeof(str),"{FFFFFF}Hai {33AA33}$%d {FFFFFF}Nello Storage",X);
  346.           ShowPlayerDialog(playerid, DIALOG_DEPOSIT_MONEY, DIALOG_STYLE_INPUT, "{33AA33}Inserisci La Quantità Da Inserire",str, "OK", "Annulla");
  347.         }
  348.         case 1:
  349.         {
  350.           new string[256];
  351.           new X;
  352.           format(string,sizeof(string), HOUSE_FILE, houseid);
  353.           INI_Open(string);
  354.           X = INI_ReadInt("StorageMoney");
  355.           INI_Close();
  356.           new str[128];
  357.           format(str,sizeof(str),"{FFFFFF}Hai {33AA33}$%d {FFFFFF}Nello Storage",X);
  358.           ShowPlayerDialog(playerid, DIALOG_WITHDRAW_MONEY,DIALOG_STYLE_INPUT, "{33AA33}Inserisci La Quantità Da Prelevare",str, "OK", "Annulla");
  359.         }
  360.         case 2:
  361.         {
  362.           GetPlayerWeaponData(playerid, 0, sInfo[houseid][Weap0],sInfo[houseid][Ammo0]);
  363.           GetPlayerWeaponData(playerid, 1, sInfo[houseid][Weap1],sInfo[houseid][Ammo1]);
  364.           GetPlayerWeaponData(playerid, 2, sInfo[houseid][Weap2],sInfo[houseid][Ammo2]);
  365.           GetPlayerWeaponData(playerid, 3, sInfo[houseid][Weap3],sInfo[houseid][Ammo3]);
  366.           GetPlayerWeaponData(playerid, 4, sInfo[houseid][Weap4],sInfo[houseid][Ammo4]);
  367.           GetPlayerWeaponData(playerid, 5, sInfo[houseid][Weap5],sInfo[houseid][Ammo5]);
  368.           GetPlayerWeaponData(playerid, 6, sInfo[houseid][Weap6],sInfo[houseid][Ammo6]);
  369.           GetPlayerWeaponData(playerid, 7, sInfo[houseid][Weap7],sInfo[houseid][Ammo7]);
  370.           GetPlayerWeaponData(playerid, 8, sInfo[houseid][Weap8],sInfo[houseid][Ammo8]);
  371.           GetPlayerWeaponData(playerid, 9, sInfo[houseid][Weap9],sInfo[houseid][Ammo9]);
  372.           GetPlayerWeaponData(playerid, 10, sInfo[houseid][Weap10],sInfo[houseid][Ammo10]);
  373.           GetPlayerWeaponData(playerid, 11, sInfo[houseid][Weap11],sInfo[houseid][Ammo11]);
  374.           GetPlayerWeaponData(playerid, 12, sInfo[houseid][Weap12],sInfo[houseid][Ammo12]);
  375.  
  376.           new string[256];
  377.           format(string,sizeof(string),HOUSE_FILE, houseid);
  378.           INI_Open(string);
  379.           INI_WriteInt("Weapon0", sInfo[houseid][Weap0]);
  380.           INI_WriteInt("Ammo0", sInfo[houseid][Ammo0]);
  381.           INI_WriteInt("Weapon1", sInfo[houseid][Weap1]);
  382.           INI_WriteInt("Ammo1", sInfo[houseid][Ammo1]);
  383.           INI_WriteInt("Weapon2", sInfo[houseid][Weap2]);
  384.           INI_WriteInt("Ammo2", sInfo[houseid][Ammo2]);
  385.           INI_WriteInt("Weapon3", sInfo[houseid][Weap3]);
  386.           INI_WriteInt("Ammo3", sInfo[houseid][Ammo3]);
  387.           INI_WriteInt("Weapon4", sInfo[houseid][Weap4]);
  388.           INI_WriteInt("Ammo4", sInfo[houseid][Ammo4]);
  389.           INI_WriteInt("Weapon5", sInfo[houseid][Weap5]);
  390.           INI_WriteInt("Ammo5", sInfo[houseid][Ammo5]);
  391.           INI_WriteInt("Weapon6", sInfo[houseid][Weap6]);
  392.           INI_WriteInt("Ammo6", sInfo[houseid][Ammo6]);
  393.           INI_WriteInt("Weapon7", sInfo[houseid][Weap7]);
  394.           INI_WriteInt("Ammo7", sInfo[houseid][Ammo7]);
  395.           INI_WriteInt("Weapon8", sInfo[houseid][Weap8]);
  396.           INI_WriteInt("Ammo8", sInfo[houseid][Ammo8]);
  397.           INI_WriteInt("Weapon9", sInfo[houseid][Weap9]);
  398.           INI_WriteInt("Ammo9", sInfo[houseid][Ammo9]);
  399.           INI_WriteInt("Weapon10", sInfo[houseid][Weap10]);
  400.           INI_WriteInt("Ammo10", sInfo[houseid][Ammo10]);
  401.           INI_WriteInt("Weapon11", sInfo[houseid][Weap11]);
  402.           INI_WriteInt("Ammo11", sInfo[houseid][Ammo11]);
  403.           INI_WriteInt("Weapon12", sInfo[houseid][Weap12]);
  404.           INI_WriteInt("Ammo12", sInfo[houseid][Ammo12]);
  405.           INI_Save();
  406.           INI_Close();
  407.           ResetPlayerWeapons(playerid);
  408.           ShowPlayerDialog(playerid, 1499, DIALOG_STYLE_MSGBOX,"{33AA33}COMANDO", "Hai Depositato Le Tue Armi", "OK", "");
  409.         }
  410.         case 3:
  411.         {
  412.           new string[256];
  413.           format(string,sizeof(string),HOUSE_FILE, houseid);
  414.           INI_Open(string);
  415.           if(INI_ReadInt("Weapon0") != 0) GivePlayerWeapon(playerid, INI_ReadInt("Weapon0"), INI_ReadInt("Ammo0"));
  416.           if(INI_ReadInt("Weapon1") != 0) GivePlayerWeapon(playerid, INI_ReadInt("Weapon1"), INI_ReadInt("Ammo1"));
  417.           if(INI_ReadInt("Weapon2") != 0) GivePlayerWeapon(playerid, INI_ReadInt("Weapon2"), INI_ReadInt("Ammo2"));
  418.           if(INI_ReadInt("Weapon3") != 0) GivePlayerWeapon(playerid, INI_ReadInt("Weapon3"), INI_ReadInt("Ammo3"));
  419.           if(INI_ReadInt("Weapon4") != 0) GivePlayerWeapon(playerid, INI_ReadInt("Weapon4"), INI_ReadInt("Ammo4"));
  420.           if(INI_ReadInt("Weapon5") != 0) GivePlayerWeapon(playerid, INI_ReadInt("Weapon5"), INI_ReadInt("Ammo5"));
  421.           if(INI_ReadInt("Weapon6") != 0) GivePlayerWeapon(playerid, INI_ReadInt("Weapon6"), INI_ReadInt("Ammo6"));
  422.           if(INI_ReadInt("Weapon7") != 0) GivePlayerWeapon(playerid, INI_ReadInt("Weapon7"), INI_ReadInt("Ammo7"));
  423.           if(INI_ReadInt("Weapon8") != 0) GivePlayerWeapon(playerid, INI_ReadInt("Weapon8"), INI_ReadInt("Ammo8"));
  424.           if(INI_ReadInt("Weapon9") != 0) GivePlayerWeapon(playerid, INI_ReadInt("Weapon9"), INI_ReadInt("Ammo9"));
  425.           if(INI_ReadInt("Weapon10") != 0) GivePlayerWeapon(playerid, INI_ReadInt("Weapon10"), INI_ReadInt("Ammo10"));
  426.           if(INI_ReadInt("Weapon11") != 0) GivePlayerWeapon(playerid, INI_ReadInt("Weapon11"), INI_ReadInt("Ammo11"));
  427.           if(INI_ReadInt("Weapon12") != 0) GivePlayerWeapon(playerid, INI_ReadInt("Weapon12"), INI_ReadInt("Ammo12"));
  428.  
  429.           INI_WriteInt("Weapon0", 0);
  430.           INI_WriteInt("Ammo0", 0);
  431.           INI_WriteInt("Weapon1", 0);
  432.           INI_WriteInt("Ammo1", 0);
  433.           INI_WriteInt("Weapon2", 0);
  434.           INI_WriteInt("Ammo2", 0);
  435.           INI_WriteInt("Weapon3", 0);
  436.           INI_WriteInt("Ammo3", 0);
  437.           INI_WriteInt("Weapon4", 0);
  438.           INI_WriteInt("Ammo4", 0);
  439.           INI_WriteInt("Weapon5", 0);
  440.           INI_WriteInt("Ammo5", 0);
  441.           INI_WriteInt("Weapon6", 0);
  442.           INI_WriteInt("Ammo6", 0);
  443.           INI_WriteInt("Weapon7", 0);
  444.           INI_WriteInt("Ammo7", 0);
  445.           INI_WriteInt("Weapon8", 0);
  446.           INI_WriteInt("Ammo8", 0);
  447.           INI_WriteInt("Weapon9", 0);
  448.           INI_WriteInt("Ammo9", 0);
  449.           INI_WriteInt("Weapon10", 0);
  450.           INI_WriteInt("Ammo10", 0);
  451.           INI_WriteInt("Weapon11", 0);
  452.           INI_WriteInt("Ammo11", 0);
  453.           INI_WriteInt("Weapon12", 0);
  454.           INI_WriteInt("Ammo12", 0);
  455.  
  456.           sInfo[houseid][Weap0] = 0;
  457.           sInfo[houseid][Weap1] = 0;
  458.           sInfo[houseid][Weap2] = 0;
  459.           sInfo[houseid][Weap3] = 0;
  460.           sInfo[houseid][Weap4] = 0;
  461.           sInfo[houseid][Weap5] = 0;
  462.           sInfo[houseid][Weap6] = 0;
  463.           sInfo[houseid][Weap7] = 0;
  464.           sInfo[houseid][Weap9] = 0;
  465.           sInfo[houseid][Weap10] = 0;
  466.           sInfo[houseid][Weap11] = 0;
  467.           sInfo[houseid][Weap12] = 0;
  468.  
  469.           sInfo[houseid][Ammo0] = 0;
  470.           sInfo[houseid][Ammo1] = 0;
  471.           sInfo[houseid][Ammo2] = 0;
  472.           sInfo[houseid][Ammo3] = 0;
  473.           sInfo[houseid][Ammo4] = 0;
  474.           sInfo[houseid][Ammo5] = 0;
  475.           sInfo[houseid][Ammo6] = 0;
  476.           sInfo[houseid][Ammo7] = 0;
  477.           sInfo[houseid][Ammo9] = 0;
  478.           sInfo[houseid][Ammo10] = 0;
  479.           sInfo[houseid][Ammo11] = 0;
  480.           sInfo[houseid][Ammo12] = 0;
  481.  
  482.           INI_Close();
  483.           ShowPlayerDialog(playerid, 1499, DIALOG_STYLE_MSGBOX,"{33AA33}COMANDO", "Hai Raccolto Le Tue Armi", "OK", "");
  484.         }
  485.         case 4:
  486.         {
  487.           if(hInfo[LastHouse[playerid]][Locked] == 1)
  488.           {
  489.             hInfo[LastHouse[playerid]][Locked] = 0;
  490.             UnlockYourHouseMessage(playerid);
  491.           }
  492.           else
  493.           {
  494.             hInfo[LastHouse[playerid]][Locked] = 1;
  495.             LockYourHouseMessage(playerid);
  496.           }
  497.           return 1;
  498.         }
  499.       }
  500.       return 1;
  501.     }
  502.     case DIALOG_FORSALE_HOUSE:
  503.     {
  504.       if(!response) return 1;
  505.       if(GetPlayerMoney(playerid) < hInfo[GetHouseID(playerid)][Cost]) return ShowNoMoneyMessage(playerid);
  506.       BuyHouse(playerid, GetHouseID(playerid));
  507.       return 1;
  508.     }
  509.     case DIALOG_FORSALE_STORE:
  510.     {
  511.       if(!response) return 1;
  512.       switch(listitem)
  513.       {
  514.         case 0:
  515.         {
  516.           EnterBusiness(playerid, GetBizID(playerid));
  517.         }
  518.         case 1:
  519.         {
  520.           if(GetPlayerMoney(playerid) < bInfo[GetBizID(playerid)][bCost]) return ShowNoMoneyMessage(playerid);
  521.           BuyBusiness(playerid, GetBizID(playerid));
  522.         }
  523.  
  524.       }
  525.       return 1;
  526.     }
  527.     case DIALOG_OTHERS_HOUSE:
  528.     {
  529.       if(!response) return 1;
  530.       if(hInfo[GetHouseID(playerid)][Locked] == 1) return ShowLockedHouseMessage(playerid);
  531.       EnterHouse(playerid, GetHouseID(playerid));
  532.       return 1;
  533.     }
  534.     case DIALOG_OTHERS_STORE:
  535.     {
  536.       if(!response) return 1;
  537.       if(bInfo[GetBizID(playerid)][bLocked] == 1) return ShowLockedStoreMessage(playerid);
  538.       EnterBusiness(playerid, GetBizID(playerid));
  539.       return 1;
  540.     }
  541.     case DIALOG_MY_HOUSE:
  542.     {
  543.       if(!response) return 1;
  544.       switch(listitem)
  545.       {
  546.         case 0:
  547.         {
  548.           if(hInfo[GetHouseID(playerid)][Locked] == 1) return ShowLockedHouseMessage(playerid);
  549.           EnterHouse(playerid, GetHouseID(playerid));
  550.           return 1;
  551.         }
  552.         case 1:
  553.         {
  554.           if(hInfo[GetHouseID(playerid)][Locked] == 1)
  555.           {
  556.             hInfo[GetHouseID(playerid)][Locked] = 0;
  557.             UnlockYourHouseMessage(playerid);
  558.           }
  559.           else
  560.           {
  561.             hInfo[GetHouseID(playerid)][Locked] = 1;
  562.             LockYourHouseMessage(playerid);
  563.           }
  564.           return 1;
  565.         }
  566.         case 2:
  567.         {
  568.           new string[101];
  569.           format(string,sizeof(string), "Vuoi Veramente Vendere La Tua Casa Per $%d?", hInfo[GetHouseID(playerid)][Sell]);
  570.           ShowPlayerDialog(playerid, DIALOG_SELL_HOUSE, DIALOG_STYLE_MSGBOX, "{33AA33}COMANDO", string, "Si", "No");
  571.           return 1;
  572.         }
  573.  
  574.       }
  575.       return 1;
  576.     }
  577.     case DIALOG_MY_STORE:
  578.     {
  579.       if(!response) return 1;
  580.       switch(listitem)
  581.       {
  582.         case 0:
  583.         {
  584.           if(bInfo[GetBizID(playerid)][bLocked] == 1) return ShowLockedStoreMessage(playerid);
  585.           EnterBusiness(playerid, GetBizID(playerid));
  586.           return 1;
  587.         }
  588.         case 1:
  589.         {
  590.           if(bInfo[GetBizID(playerid)][bLocked] == 1)
  591.           {
  592.             bInfo[GetBizID(playerid)][bLocked] = 0;
  593.             UnlockYourStoreMessage(playerid);
  594.           }
  595.           else
  596.           {
  597.             bInfo[GetBizID(playerid)][bLocked] = 1;
  598.             LockYourStoreMessage(playerid);
  599.           }
  600.           return 1;
  601.         }
  602.         case 2:
  603.         {
  604.           ShowPlayerDialog(playerid, DIALOG_RENAME_STORE,DIALOG_STYLE_INPUT, "Scrivi Un Nuovo Nome Per Il Tuo Negozio","TIP: Se Conosci La Notazione Esadecimale Puoi Fare I Colori Usando \"{RRGGBB}Nome\"", "OK", "Annulla");
  605.           return 1;
  606.         }
  607.         case 3:
  608.         {
  609.           GetBusinessMoney(playerid, GetBizID(playerid));
  610.           return 1;
  611.         }
  612.         case 4:
  613.         {
  614.           new string[256];
  615.           format(string,sizeof(string), "Quante merci vuoi ordinare? Prezzo: %d$/Merce.", COSTO_MERCI);
  616.           ShowPlayerDialog(playerid, DIALOG_ORDER_GOODS, DIALOG_STYLE_INPUT, "{33AA33}COMANDO", string, "OK", "Annulla");
  617.           return 1;
  618.         }
  619.         case 5:
  620.         {
  621.           new string[256];
  622.           format(string,sizeof(string), "Vuoi Veramente Vendere Il Tuo Negozio Per $%d?", bInfo[GetBizID(playerid)][bSell]);
  623.           ShowPlayerDialog(playerid, DIALOG_SELL_STORE, DIALOG_STYLE_MSGBOX, "{33AA33}COMANDO", string, "Si", "No");
  624.           return 1;
  625.         }
  626.  
  627.       }
  628.       return 1;
  629.     }
  630.     case DIALOG_ORDER_GOODS:
  631.     {
  632.       if(strval(inputtext) == 0) return 1;
  633.       if(GetPlayerMoney(playerid) < (strval(inputtext)*COSTO_MERCI)) return ShowNoMoneyMessage(playerid);
  634.       GivePlayerMoney(playerid, -strval(inputtext)*COSTO_MERCI);
  635.       bInfo[GetBizID(playerid)][bRifornimenti] += strval(inputtext);
  636.       new string[256];
  637.       format(string, sizeof(string), "Hai Rifornito Di %d Merci Il Tuo Negozio Per $%d!", strval(inputtext), strval(inputtext)*COSTO_MERCI);
  638.       ShowPlayerDialog(playerid, 1499, DIALOG_STYLE_MSGBOX, "{33AA33}COMANDO", string, "OK", "");
  639.       return 1;
  640.     }
  641.     case DIALOG_SELL_HOUSE:
  642.     {
  643.       if(!response) return 1;
  644.       SellHouse(playerid, GetHouseID(playerid));
  645.       return 1;
  646.     }
  647.     case DIALOG_SELL_STORE:
  648.     {
  649.       if(!response) return 1;
  650.       SellBusiness(playerid, GetBizID(playerid));
  651.       return 1;
  652.     }
  653.     case DIALOG_RENAME_STORE:
  654.     {
  655.       if(!response) return 1;
  656.       if(strlen(inputtext) >= 51)
  657.       {
  658.         ShowPlayerDialog(playerid, 1499, DIALOG_STYLE_MSGBOX, "{FF0000}ERRORE", "La Massima Lunghezza E' 50 Caratteri", "OK", "");
  659.         return 1;
  660.       }
  661.       new string[256];
  662.       format(bInfo[GetBizID(playerid)][bTitle],51, inputtext);
  663.       format(string, 256, BIZ_FILE, GetBizID(playerid));
  664.       INI_Open(string);
  665.       INI_WriteString("Title",bInfo[GetBizID(playerid)][bTitle]);
  666.       INI_Save();
  667.       INI_Close();
  668.       return 1;
  669.     }
  670.   }
  671.   return 0;
  672. }
  673.  
  674. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  675. {
  676.   if(newkeys & KEY_ENTER_PROPERTY)
  677.   {
  678.     new name[24];
  679.     GetPlayerName(playerid,name,24);
  680.     if(LastHouse[playerid] != INVALID_HOUSE_ID
  681.     && !IsPlayerNearPoint(2.0, playerid, hInfo[LastHouse[playerid]][InteriorX], hInfo[LastHouse[playerid]][InteriorY], hInfo[LastHouse[playerid]][InteriorZ])
  682.     && strcmp(name,hInfo[LastHouse[playerid]][Name],true) == 0)
  683.     {
  684.       ShowPlayerDialog(playerid,DIALOG_MAIN_STORAGE, DIALOG_STYLE_LIST, "{33AA33}Cosa Vuoi Fare Con Lo Storage?","{00FFFF}Deposita Soldi\n{00FFFF}Preleva Soldi\n{AFAFAF}Deposita Armi\n{AFAFAF}Preleva Armi\n{00FF00}Apri/Chiudi A Chiave La Porta","OK","Annulla");
  685.       return 1;
  686.     }
  687.     for(new i=0; i<MAX_HOUSES; i++)
  688.     {
  689.       if(IsPlayerNearPoint(2.0, playerid, hInfo[i][InteriorX], hInfo[i][InteriorY], hInfo[i][InteriorZ]) && GetPlayerVirtualWorld(playerid) == hInfo[i][VirtualWorld])
  690.       {
  691.         ExitHouse(playerid, i);
  692.       }
  693.     }
  694.     for(new i=0; i<MAX_BUSINESSES; i++)
  695.     {
  696.       if(IsPlayerNearPoint(2.0, playerid, bInfo[i][bInteriorX], bInfo[i][bInteriorY], bInfo[i][bInteriorZ]) && bInfo[i][bVirtualWorld] == GetPlayerVirtualWorld(playerid))
  697.       {
  698.         ExitBusiness(playerid, i);
  699.       }
  700.     }
  701.     if(GetHouseID(playerid) != INVALID_HOUSE_ID)
  702.     {
  703.       OpenHouseDialog(playerid, GetHouseID(playerid));
  704.       return 1;
  705.     }
  706.     else if(GetBizID(playerid) != INVALID_HOUSE_ID)
  707.     {
  708.       OpenBusinessDialog(playerid, GetBizID(playerid));
  709.       return 1;
  710.     }
  711.  
  712.   }
  713.   return 1;
  714. }
  715.  
  716. /*
  717.                              CreateHouse
  718.  Funzione: Crea Una Casa.
  719.  
  720.  Da Usare Con: OnFilterScriptInit
  721.  
  722.  Parametri:
  723.    -houseid: L'ID della casa. Non creare 2 case con lo stesso ID.
  724.    -eX, eY, eZ: La posizione esteriore della casa (L'entrata)
  725.    -iX, iY, iZ: La posizione interiore della casa (L'uscita)
  726.    -BuyPrice: Il costo della casa
  727.    -SellPrice: La quantità che viene data al proprietario quando la rivende
  728.    -INT: L' ID dell'interior della casa
  729.    -VW: Il mondo virtuale della casa (Usa 2 VW diversi se vuoi avere 2 case con lo stesso interior)
  730.  
  731.  Riporta:
  732.    -true(1): Quando la casa esisteva gia, ed è stata caricata
  733.    -null(-1): Quando la casa non esisteva ed è stata creata
  734.    -false(0): Quando è impossibile caricare o creare
  735. */
  736.  
  737. stock CreateHouse(houseid, Float:eX, Float:eY, Float:eZ, Float:iX, Float:iY, Float:iZ, BuyPrice, SellPrice, INT, EXT, VW)
  738. {
  739.   new housefile[51];
  740.   format(housefile, sizeof(housefile), HOUSE_FILE, houseid);
  741.   if(!INI_Exist(housefile)) //Se il file non esiste:
  742.   {
  743.     INI_Open(housefile);
  744.     format(hInfo[houseid][Name], 24, "ForSale");
  745.     INI_WriteString("Name", "ForSale");
  746.  
  747.     hInfo[houseid][Cost] = BuyPrice;
  748.     INI_WriteInt("Cost", BuyPrice);
  749.  
  750.     hInfo[houseid][Sell] = SellPrice;
  751.     INI_WriteInt("Sell", SellPrice);
  752.  
  753.     hInfo[houseid][Interior] = INT;
  754.     INI_WriteInt("Interior", INT);
  755.  
  756.     hInfo[houseid][Exterior] = EXT;
  757.     INI_WriteInt("Exterior", EXT);
  758.  
  759.     hInfo[houseid][VirtualWorld] = VW;
  760.     INI_WriteInt("VirtualWorld", VW);
  761.  
  762.     hInfo[houseid][Locked] = 1;
  763.     INI_WriteInt("Locked", 1);
  764.  
  765.     hInfo[houseid][InteriorX] = iX;
  766.     hInfo[houseid][InteriorY] = iY;
  767.     hInfo[houseid][InteriorZ] = iZ;
  768.     INI_WriteFloat("InteriorX", iX);
  769.     INI_WriteFloat("InteriorY", iY);
  770.     INI_WriteFloat("InteriorZ", iZ);
  771.  
  772.     hInfo[houseid][ExteriorX] = eX;
  773.     hInfo[houseid][ExteriorY] = eY;
  774.     hInfo[houseid][ExteriorZ] = eZ;
  775.     INI_WriteFloat("ExteriorX", eX);
  776.     INI_WriteFloat("ExteriorY", eY);
  777.     INI_WriteFloat("ExteriorZ", eZ);
  778.  
  779.     HousePickup[houseid] = CreatePickup(1273, 23, eX, eY, eZ);
  780.     Create3DTextLabel("Usa Spazio Per Aprire Il Menu", 0x00FF00FF, eX, eY, eZ+1, 20, 0, 0);
  781.     Create3DTextLabel("Usa Spazio Per Uscire", 0x00FF00FF, iX, iY, iZ+1, 20, VW, 0);
  782.  
  783.     #if defined PRINT_HOUSES
  784.     print("------------Nuova Casa Creata------------");
  785.     printf("- Houseid: %d", houseid);
  786.     printf("- Costo: %d", BuyPrice);
  787.     printf("- Ricavo Vendita: %d", SellPrice);
  788.     printf("- Interior: %d", INT);
  789.     printf("- Virtual World: %d", VW);
  790.     print("-----------------------------------------");
  791.     #endif
  792.     INI_Save();
  793.     INI_Close();
  794.     return -1;
  795.   }
  796.   else if(INI_Exist(housefile))//altrimenti, se esiste il file
  797.   {
  798.     new destination[24];
  799.  
  800.     INI_Open(housefile);
  801.  
  802.     INI_ReadString(destination, "Name");
  803.     format(hInfo[houseid][Name], 24, destination);
  804.     hInfo[houseid][Locked] = INI_ReadInt("Locked");
  805.  
  806.     INI_Close();
  807.  
  808.     hInfo[houseid][Cost] = BuyPrice;
  809.     hInfo[houseid][Sell] = SellPrice;
  810.  
  811.     hInfo[houseid][Interior] = INT;
  812.     hInfo[houseid][Exterior] = EXT;
  813.  
  814.     hInfo[houseid][VirtualWorld] = VW;
  815.  
  816.     hInfo[houseid][InteriorX] = iX;
  817.     hInfo[houseid][InteriorY] = iY;
  818.     hInfo[houseid][InteriorZ] = iZ;
  819.  
  820.     hInfo[houseid][ExteriorX] = eX;
  821.     hInfo[houseid][ExteriorY] = eY;
  822.     hInfo[houseid][ExteriorZ] = eZ;
  823.  
  824.     if(strcmp(hInfo[houseid][Name],"ForSale",true) == 0)
  825.     {
  826.       HousePickup[houseid] = CreatePickup(1273, 23, eX, eY, eZ);
  827.     }
  828.     else
  829.     {
  830.       HousePickup[houseid] = CreatePickup(1272, 23, eX, eY, eZ);
  831.     }
  832.     Create3DTextLabel("Usa Spazio Per Aprire Il Menu", 0x00FF00FF, eX, eY, eZ+1, 20, 0, 0);
  833.     Create3DTextLabel("Usa Spazio Per Uscire", 0x00FF00FF, iX, iY, iZ+1, 20, VW, 0);
  834.     #if defined PRINT_HOUSES
  835.     print("------------Casa Esistente Caricata------------");
  836.     printf("- Houseid: %d", houseid);
  837.     printf("- Costo: %d", BuyPrice);
  838.     printf("- Ricavo Vendita: %d", SellPrice);
  839.     printf("- Interior: %d", INT);
  840.     printf("- Virtual World: %d", VW);
  841.     print("----------------------------------------------");
  842.     #endif
  843.     return 1;
  844.   }
  845.   print("E Impossibile Creare Una Casa. Controlla Di Avere Le Seguenti Cartelle In Scriptfiles:");
  846.   print("SasiHouses ------>");
  847.   print("           Houses");
  848.   print("           Stores");
  849.   print("           Users");
  850.   return 0;
  851. }
  852.  
  853. /*
  854.                              CreateBusiness
  855.  Funzione: Crea Un Negozio.
  856.  
  857.  Da Usare Con: OnFilterScriptInit
  858.  
  859.  Parametri:
  860.    -bizid: L'ID del negozio. Non creare 2 negozi con lo stesso ID.
  861.    -defaultname: Il nome iniziale del negozio.
  862.    -eX, eY, eZ: La posizione esteriore del negozio (L'entrata)
  863.    -iX, iY, iZ: La posizione interiore del negozio (L'uscita)
  864.    -BuyPrice: Il costo del negozio
  865.    -SellPrice: La quantità che viene data al proprietario quando lo rivende
  866.    -INT: L'ID dell'interior del negozio
  867.    -VW: Il mondo virtuale del negozio (Usa 2 VW diversi se vuoi avere 2 negozi con lo stesso interior)
  868.  
  869.  Riporta:
  870.    -true(1): Quando il negozio esisteva gia, ed è stata caricata
  871.    -null(-1): Quando il negozio non esisteva ed è stata creata
  872.    -false(0): Quando è impossibile caricare o creare
  873. */
  874.  
  875. stock CreateBusiness(bizid, defaultname[51], Float:eX, Float:eY, Float:eZ, Float:iX, Float:iY, Float:iZ, BuyPrice, SellPrice, Earn, INT, VW, EnterPrice)
  876. {
  877.   new bizfile[51];
  878.   format(bizfile, sizeof(bizfile), BIZ_FILE, bizid);
  879.   if(!INI_Exist(bizfile))
  880.   {
  881.     INI_Open(bizfile);
  882.     format(bInfo[bizid][bName], 24, "ForSale");
  883.     INI_WriteString("Name", "ForSale");
  884.  
  885.     format(bInfo[bizid][bTitle], 51, defaultname);
  886.     INI_WriteString("Title", defaultname);
  887.  
  888.     bInfo[bizid][bCost] = BuyPrice;
  889.     INI_WriteInt("Cost", BuyPrice);
  890.  
  891.     bInfo[bizid][bSell] = SellPrice;
  892.     INI_WriteInt("Sell", SellPrice);
  893.  
  894.     bInfo[bizid][bCashRegister] = 0;
  895.     INI_WriteInt("Money", 0);
  896.  
  897.     bInfo[bizid][bInterior] = INT;
  898.     INI_WriteInt("Interior", INT);
  899.  
  900.     bInfo[bizid][bVirtualWorld] = VW;
  901.     INI_WriteInt("VirtualWorld", VW);
  902.  
  903.     bInfo[bizid][bLocked] = 0;
  904.     INI_WriteInt("Locked", 0);
  905.    
  906.     bInfo[bizid][bEnter] = EnterPrice;
  907.     INI_WriteInt("EnterPrice", bInfo[bizid][bEnter]);
  908.    
  909.     bInfo[bizid][bRifornimenti] = 0;
  910.     INI_WriteInt("Merci", bInfo[bizid][bRifornimenti]);
  911.  
  912.     bInfo[bizid][bInteriorX] = iX;
  913.     bInfo[bizid][bInteriorY] = iY;
  914.     bInfo[bizid][bInteriorZ] = iZ;
  915.     INI_WriteFloat("bInteriorX", iX);
  916.     INI_WriteFloat("bInteriorY", iY);
  917.     INI_WriteFloat("bInteriorZ", iZ);
  918.  
  919.     bInfo[bizid][bExteriorX] = eX;
  920.     bInfo[bizid][bExteriorY] = eY;
  921.     bInfo[bizid][bExteriorZ] = eZ;
  922.     INI_WriteFloat("ExteriorX", eX);
  923.     INI_WriteFloat("ExteriorY", eY);
  924.     INI_WriteFloat("ExteriorZ", eZ);
  925.  
  926.     BizPickup[bizid] = CreatePickup(1318, 23, eX, eY, eZ);
  927.  
  928.     Create3DTextLabel("Usa Spazio Per Aprire Il Menu", 0x00FF00FF, eX, eY, eZ+1, 20, 0, 0);
  929.     Create3DTextLabel("Usa Spazio Per Uscire", 0x00FF00FF, iX, iY, iZ+1, 20, VW, 0);
  930.     SetTimerEx("AddBusinessMoney", 600000, true, "ii", bizid, Earn); //Millisecondi * Secondi * Minuti
  931.  
  932.     #if defined PRINT_HOUSES
  933.     print("------------Nuovo Negozio Creato------------");
  934.     printf("- Business ID: %d", bizid);
  935.     printf("- Buy Cost: %d", BuyPrice);
  936.     printf("- Sell Cost: %d", SellPrice);
  937.     printf("- Interior: %d", INT);
  938.     printf("- Virtual World: %d", VW);
  939.     print("--------------------------------------------");
  940.     #endif
  941.     INI_Save();
  942.     INI_Close();
  943.     return -1;
  944.   }
  945.   else if(INI_Exist(bizfile))
  946.   {
  947.     new destination[24];
  948.     new dest2[24];
  949.  
  950.     INI_Open(bizfile);
  951.  
  952.     INI_ReadString(destination, "Name");
  953.     INI_ReadString(dest2, "Title");
  954.     format(bInfo[bizid][bName], 24, destination);
  955.     format(bInfo[bizid][bTitle], 51, dest2);
  956.     bInfo[bizid][bLocked] = INI_ReadInt("Locked");
  957.     bInfo[bizid][bCashRegister] = INI_ReadInt("Money");
  958.     bInfo[bizid][bRifornimenti] = INI_ReadInt("Merci");
  959.    
  960.     INI_Close();
  961.  
  962.     bInfo[bizid][bCost] = BuyPrice;
  963.     bInfo[bizid][bSell] = SellPrice;
  964.     bInfo[bizid][bEnter] = EnterPrice;
  965.  
  966.     bInfo[bizid][bInterior] = INT;
  967.     bInfo[bizid][bVirtualWorld] = VW;
  968.  
  969.     bInfo[bizid][bInteriorX] = iX;
  970.     bInfo[bizid][bInteriorY] = iY;
  971.     bInfo[bizid][bInteriorZ] = iZ;
  972.  
  973.     bInfo[bizid][bExteriorX] = eX;
  974.     bInfo[bizid][bExteriorY] = eY;
  975.     bInfo[bizid][bExteriorZ] = eZ;
  976.    
  977.     BizPickup[bizid] = CreatePickup(1318, 23, eX, eY, eZ);
  978.  
  979.     Create3DTextLabel("Usa Spazio Per Aprire Il Menu", 0x00FF00FF, eX, eY, eZ+1, 20, 0, 0);
  980.     Create3DTextLabel("Usa Spazio Per Uscire", 0x00FF00FF, iX, iY, iZ+1, 20, VW, 0);
  981.     SetTimerEx("AddBusinessMoney", 600000, true, "ii", bizid, Earn); //Millisecondi * Secondi * Minuti
  982.  
  983.     #if defined PRINT_HOUSES
  984.     print("--------------Negozio Caricato--------------");
  985.     printf("- Business ID: %d", bizid);
  986.     printf("- Buy Cost: %d", BuyPrice);
  987.     printf("- Sell Cost: %d", SellPrice);
  988.     printf("- Interior: %d", INT);
  989.     printf("- Virtual World: %d", VW);
  990.     print("--------------------------------------------");
  991.     #endif
  992.     return 1;
  993.   }
  994.   print("E Impossibile Creare Un Negozio. Controlla Di Avere Le Seguenti Cartelle In Scriptfiles:");
  995.   print("SasiHouses ------>");
  996.   print("           Houses");
  997.   print("           Stores");
  998.   print("           Users");
  999.   return 0;
  1000. }
  1001.  
  1002. /*
  1003.                              OpenHouseDialog
  1004.  Function: Shows the dialog.
  1005.  
  1006.  Parameters:
  1007.    -playerid: The ID of the player.
  1008.    -houseid: The ID of the house.
  1009.  
  1010.  Returns:
  1011.    -true(1): When the house is for sale.
  1012.    -null(-1): When the house is bought.
  1013.    -false(0): When the house is bought and playerid is the owner.
  1014. */
  1015.  
  1016. stock OpenHouseDialog(playerid, houseid)
  1017. {
  1018.   if(strcmp(hInfo[houseid][Name], "ForSale",true) == 0)
  1019.   {
  1020.     new string[180];
  1021.     if(GetPlayerMoney(playerid) >= hInfo[houseid][Cost]) { format(string,sizeof(string),"{33AA33}Compra Questa Casa Per $%d", hInfo[houseid][Cost]); }
  1022.     else { format(string,sizeof(string),"{FF0000}Compra Questa Casa Per $%d", hInfo[houseid][Cost]); }
  1023.     ShowPlayerDialog(playerid, DIALOG_FORSALE_HOUSE, DIALOG_STYLE_LIST, "{33AA33}Casa In Vendita!", string, "OK", "Chiudi");
  1024.     return 1;
  1025.   }
  1026.   else
  1027.   {
  1028.     new string2[180];
  1029.     new name[24];
  1030.     GetPlayerName(playerid,name,sizeof(name));
  1031.     if(strcmp(hInfo[houseid][Name], name, true) == 0)
  1032.     {
  1033.       ShowPlayerDialog(playerid, DIALOG_MY_HOUSE,DIALOG_STYLE_LIST, "{33AA33}Bentornato A Casa", "{33AA33}Entra In Casa\n{33AA33}Apri/Chiudi A Chiave La Porta\n{33AA33}Rivendi La Tua Casa", "OK", "Chiudi");
  1034.       return 0;
  1035.     }
  1036.     else
  1037.     {
  1038.       if(hInfo[houseid][Locked] == 1) { format(string2, sizeof(string2), "{FF0000}Entra In Questa Casa");}
  1039.       else { format(string2, sizeof(string2), "{33AA33}Entra In Questa Casa"); }
  1040.       new string3[256];
  1041.       format(string3,sizeof(string3), "{33AA33}Casa ID %d", houseid);
  1042.       ShowPlayerDialog(playerid, DIALOG_OTHERS_HOUSE,DIALOG_STYLE_LIST, string3, string2, "OK", "Chiudi");
  1043.       return -1;
  1044.     }
  1045.  
  1046.   }
  1047.  
  1048. }
  1049.  
  1050. /*
  1051.                              OpenBusinessDialog
  1052.  Function: Shows the dialog.
  1053.  
  1054.  Parameters:
  1055.    -playerid: The ID of the player.
  1056.    -bizid: The ID of the business.
  1057.  
  1058.  Returns:
  1059.    -true(1): When the biz is for sale.
  1060.    -null(-1): When the biz is bought.
  1061.    -false(0): When the biz is bought and playerid is the owner.
  1062. */
  1063.  
  1064. stock OpenBusinessDialog(playerid, bizid)
  1065. {
  1066.   if(strcmp(bInfo[bizid][bName], "ForSale",true) == 0)
  1067.   {
  1068.     new string[256];
  1069.     new str2[180];
  1070.     if(GetPlayerMoney(playerid) >= bInfo[bizid][bCost]) { format(string,sizeof(string),"{33AA33}Entra In Questo Negozio\n{33AA33}Compra Questo Negozio Per $%d", bInfo[bizid][bCost]); }
  1071.     else { format(string,sizeof(string),"{33AA33}Entra In Questo Negozio\n{FF0000}Compra Questo Negozio Per $%d", bInfo[bizid][bCost]); }
  1072.     format(str2,sizeof(str2),"{FF0000}\"%s\" {33AA33}Negozio In Vendita!",bInfo[bizid][bTitle]);
  1073.     ShowPlayerDialog(playerid, DIALOG_FORSALE_STORE, DIALOG_STYLE_LIST, str2, string, "OK", "Chiudi");
  1074.     return 1;
  1075.   }
  1076.   else
  1077.   {
  1078.     new string[180];
  1079.     new string2[180];
  1080.     new name[24];
  1081.     GetPlayerName(playerid,name,sizeof(name));
  1082.     if(strcmp(bInfo[bizid][bName], name, true) == 0)
  1083.     {
  1084.       new str[1001];
  1085.       new str2[256];
  1086.       format(str,sizeof(str), "{0000FF}\"%s\" - Merci Rimanenti: %d", bInfo[bizid][bTitle], bInfo[bizid][bRifornimenti]);
  1087.       if(bInfo[bizid][bCashRegister] == 0)
  1088.       {
  1089.         format(str2,sizeof(str2),"{33AA33}Entra Nel Tuo Negozio\n{33AA33}Apri/Chiudi Il Tuo Negozio\n{33AA33}Rinomina Il Tuo Negozio\n{FF0000}Ritira Incasso\n{33AA33}Rifornisci Il Negozio\n{33AA33}Vendi Il Negozio");
  1090.       }
  1091.       else
  1092.       {
  1093.         format(str2,sizeof(str2),"{33AA33}Entra Nel Tuo Negozio\n{33AA33}Apri/Chiudi Il Tuo Negozio\n{33AA33}Rinomina Il Tuo Negozio\n{33AA33}Ritira Incasso\n{33AA33}Rifornisci Il Negozio\n{33AA33}Vendi Il Negozio");
  1094.       }
  1095.       ShowPlayerDialog(playerid, DIALOG_MY_STORE, DIALOG_STYLE_LIST, str, str2, "OK", "Chiudi");
  1096.       return 0;
  1097.     }
  1098.     else
  1099.     {
  1100.       format(string, sizeof(string), "%s -=-=- Costo Entrata: {33AA33}$%d", bInfo[bizid][bTitle], bInfo[bizid][bEnter]);
  1101.       if(bInfo[bizid][bLocked] == 1) { format(string2, sizeof(string2), "{FF0000}Entra In Questo Negozio");}
  1102.       else { format(string2, sizeof(string2), "{33AA33}Entra In Questo Negozio"); }
  1103.       ShowPlayerDialog(playerid, DIALOG_OTHERS_STORE, DIALOG_STYLE_LIST, string, string2, "OK", "Chiudi");
  1104.       return -1;
  1105.     }
  1106.  
  1107.   }
  1108.  
  1109. }
  1110.  
  1111. /*
  1112.                              GetHouseID
  1113.  Function: Gets the house ID of the player.
  1114.  
  1115.  Parameters:
  1116.    -playerid: The ID of the player.
  1117.  
  1118.  Returns:
  1119.    -houseid(): When playerid is near to any house pickup
  1120.    -invalid(-255): When playerid isn't near to any house
  1121.  
  1122. */
  1123.  
  1124. stock GetHouseID(playerid)
  1125. {
  1126.   for(new i=0; i<MAX_HOUSES; i++)
  1127.   {
  1128.     if(IsPlayerNearPoint(2.0, playerid, hInfo[i][ExteriorX], hInfo[i][ExteriorY], hInfo[i][ExteriorZ]))
  1129.     {
  1130.       return i;
  1131.     }
  1132.   }
  1133.   return INVALID_HOUSE_ID;
  1134. }
  1135.  
  1136. /*
  1137.                              GetBizID
  1138.  Function: Gets the biz ID of the player.
  1139.  
  1140.  Parameters:
  1141.    -playerid: The ID of the player.
  1142.  
  1143.  Returns:
  1144.    -bizid): When playerid is near to any biz pickup
  1145.    -invalid(-255): When playerid isn't near to any biz
  1146.  
  1147. */
  1148.  
  1149. stock GetBizID(playerid)
  1150. {
  1151.   for(new i=0; i<MAX_HOUSES; i++)
  1152.   {
  1153.     if(IsPlayerNearPoint(2.0, playerid, bInfo[i][bExteriorX], bInfo[i][bExteriorY], bInfo[i][bExteriorZ]))
  1154.     {
  1155.       return i;
  1156.     }
  1157.   }
  1158.   return INVALID_HOUSE_ID;
  1159. }
  1160.  
  1161. /*
  1162.                              IsPlayerNearPoint
  1163.  Function: Returns wheter playerid is near a point
  1164.  
  1165.  Parameters:
  1166.    -radi: The radius of the sphere.
  1167.    -playerid: The ID of the player.
  1168.    -x, y, z: The coordinates of the second point
  1169.  
  1170.  Returns:
  1171.    -true: When playerid is connected and near x,y,z
  1172.    -false: When playerid is connected but isn't near x,y,z
  1173.    -null: When playerid isn't connected
  1174. */
  1175.  
  1176. stock IsPlayerNearPoint(Float:radi, playerid, Float:x, Float:y, Float:z)
  1177. {
  1178.   if(IsPlayerConnected(playerid))
  1179.   {
  1180.       new Float:oldposx, Float:oldposy, Float:oldposz;
  1181.       new Float:tempposx, Float:tempposy, Float:tempposz;
  1182.       GetPlayerPos(playerid, oldposx, oldposy, oldposz);
  1183.       tempposx = (oldposx -x);
  1184.       tempposy = (oldposy -y);
  1185.       tempposz = (oldposz -z);
  1186.       if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
  1187.       {
  1188.         return 1;
  1189.       }
  1190.       return 0;
  1191.   }
  1192.   return -1;
  1193. }
  1194.  
  1195. /*
  1196.                              BuyHouse
  1197.  Function: The player buys the house
  1198.  
  1199.  Parameters:
  1200.    -playerid: The ID of the player.
  1201.    -houseid: The ID of the house.
  1202.  
  1203.  Returns:
  1204.    -true(1): When bought successfully
  1205.    -false(0): When an error has occurred
  1206. */
  1207.  
  1208. stock BuyHouse(playerid, houseid)
  1209. {
  1210.   new string2[256];
  1211.   new name[24];
  1212.   GetPlayerName(playerid, name, sizeof(name));
  1213.   #if defined PRINT_HOUSES
  1214.     printf("%s Ha Comprato La Casa ID %d", name, houseid);
  1215.   #endif
  1216.   GivePlayerMoney(playerid, -hInfo[houseid][Cost]);
  1217.   format(string2,sizeof(string2), HOUSE_FILE, houseid);
  1218.   INI_Open(string2);
  1219.   INI_WriteString("Name", name);
  1220.   INI_WriteInt("Locked", 0);
  1221.   INI_Save();
  1222.   INI_Close();
  1223.   hInfo[houseid][Name] = name;
  1224.   hInfo[houseid][Locked] = 0;
  1225.   DestroyPickup(HousePickup[houseid]);
  1226.   HousePickup[houseid] = CreatePickup(1272, 23, hInfo[houseid][ExteriorX], hInfo[houseid][ExteriorY], hInfo[houseid][ExteriorZ]);
  1227.   ShowBoughtHouseMessage(playerid);
  1228.   return 1;
  1229. }
  1230.  
  1231. /*
  1232.                              BuyBusiness
  1233.  Function: The player buys the biz
  1234.  
  1235.  Parameters:
  1236.    -playerid: The ID of the player.
  1237.    -bizid: The ID of the biz.
  1238.  
  1239.  Returns:
  1240.    -true(1): When bought successfully
  1241.    -false(0): When an error has occurred
  1242. */
  1243.  
  1244. stock BuyBusiness(playerid, bizid)
  1245. {
  1246.   new string2[256];
  1247.   new name[24];
  1248.   GetPlayerName(playerid, name, sizeof(name));
  1249.   #if defined PRINT_HOUSES
  1250.     printf("%s Ha Comprato Il Negozio ID %d", name, bizid);
  1251.   #endif
  1252.   GivePlayerMoney(playerid, -bInfo[bizid][bCost]);
  1253.   format(string2,sizeof(string2), BIZ_FILE, bizid);
  1254.   INI_Open(string2);
  1255.   INI_WriteString("Name", name);
  1256.   INI_WriteInt("Locked", 0);
  1257.   INI_Save();
  1258.   INI_Close();
  1259.   bInfo[bizid][bName] = name;
  1260.   bInfo[bizid][bLocked] = 0;
  1261.   ResetBusinessMoney(bizid);
  1262.   ShowBoughtStoreMessage(playerid);
  1263.   return 1;
  1264. }
  1265.  
  1266. /*
  1267.                              SellHouse
  1268.  Function: The player sells the house
  1269.  
  1270.  Parameters:
  1271.    -playerid: The ID of the player.
  1272.    -houseid: The ID of the house.
  1273.  
  1274.  Returns:
  1275.    -true(1): When sold successfully
  1276.    -false(0): When an error has occurred
  1277. */
  1278.  
  1279. stock SellHouse(playerid, houseid)
  1280. {
  1281.   new string[256];
  1282.   new name[24];
  1283.   GetPlayerName(playerid, name, sizeof(name));
  1284.   format(string,sizeof(string),HOUSE_FILE, houseid);
  1285.   INI_Open(string);
  1286.   INI_WriteString("Name","ForSale");
  1287.   INI_WriteInt("Locked", 1);
  1288.   INI_Save();
  1289.   INI_Close();
  1290.   #if defined PRINT_HOUSES
  1291.     printf("%s Ha Venduto La Casa ID %d", name, houseid);
  1292.   #endif
  1293.   GivePlayerMoney(playerid, hInfo[houseid][Sell]);
  1294.   hInfo[houseid][Locked] = 1;
  1295.   format(hInfo[houseid][Name], 255, "ForSale");
  1296.   DestroyPickup(HousePickup[houseid]);
  1297.   HousePickup[houseid] = CreatePickup(1273, 23, hInfo[houseid][ExteriorX], hInfo[houseid][ExteriorY], hInfo[houseid][ExteriorZ]);
  1298.   ShowSoldHouseMessage(playerid);
  1299.   return 1;
  1300. }
  1301.  
  1302. /*
  1303.                              SellBusiness
  1304.  Function: The player sells the business
  1305.  
  1306.  Parameters:
  1307.    -playerid: The ID of the player.
  1308.    -bizid: The ID of the biz.
  1309.  
  1310.  Returns:
  1311.    -true(1): When sold successfully
  1312.    -false(0): When an error has occurred
  1313. */
  1314.  
  1315. stock SellBusiness(playerid, bizid)
  1316. {
  1317.   new string[256];
  1318.   new name[24];
  1319.   GetPlayerName(playerid, name, sizeof(name));
  1320.   format(string,sizeof(string),BIZ_FILE, bizid);
  1321.   INI_Open(string);
  1322.   INI_WriteString("Name","ForSale");
  1323.   INI_WriteInt("Locked", 1);
  1324.   INI_Save();
  1325.   INI_Close();
  1326.   #if defined PRINT_HOUSES
  1327.     printf("%s Ha Venduto Il Negozio ID %d", name, bizid);
  1328.   #endif
  1329.   GivePlayerMoney(playerid, bInfo[bizid][bSell]);
  1330.   bInfo[bizid][bLocked] = 0;
  1331.   format(bInfo[bizid][bName], 255, "ForSale");
  1332.   ShowSoldStoreMessage(playerid);
  1333.   return 1;
  1334. }
  1335.  
  1336. /*
  1337.                              EnterHouse
  1338.  Function: The player enters the house
  1339.  
  1340.  Parameters:
  1341.    -playerid: The ID of the player.
  1342.    -houseid: The ID of the house.
  1343.  
  1344.  Returns:
  1345.    -true(1): Everyway
  1346. */
  1347.  
  1348. stock EnterHouse(playerid, houseid)
  1349. {
  1350.   SetPlayerPos(playerid, hInfo[houseid][InteriorX], hInfo[houseid][InteriorY], hInfo[houseid][InteriorZ]);
  1351.   SetPlayerInterior(playerid, hInfo[houseid][Interior]);
  1352.   SetPlayerVirtualWorld(playerid, hInfo[houseid][VirtualWorld]);
  1353.   LastHouse[playerid] = houseid;
  1354.   return 1;
  1355. }
  1356.  
  1357. /*
  1358.                              EnterBusiness
  1359.  Function: The player enters the business
  1360.  
  1361.  Parameters:
  1362.    -playerid: The ID of the player.
  1363.    -bizid: The ID of the biz.
  1364.  
  1365.  Returns:
  1366.    -true(1): Everyway
  1367. */
  1368.  
  1369. stock EnterBusiness(playerid, bizid)
  1370. {
  1371.   new name[24];
  1372.   GetPlayerName(playerid,name,sizeof(name));
  1373.  
  1374.   if(strcmp(bInfo[bizid][bName], name, true) != 0)
  1375.   {
  1376.     if(bInfo[bizid][bRifornimenti] <= 0 && strcmp(bInfo[bizid][bName], "ForSale", true) != 0) return ShowNoGoodsMessage(playerid);
  1377.     if(GetPlayerMoney(playerid) < bInfo[bizid][bEnter]) return ShowNoMoneyMessage(playerid);
  1378.     GivePlayerMoney(playerid, -bInfo[bizid][bEnter]);
  1379.     AddBusinessMoney(bizid, bInfo[bizid][bEnter]);
  1380.   }
  1381.   else
  1382.   {
  1383.     if(bInfo[bizid][bRifornimenti] <= 0) ShowOwnerNoGoodsMessage(playerid);
  1384.   }
  1385.   SetPlayerPos(playerid, bInfo[bizid][bInteriorX], bInfo[bizid][bInteriorY], bInfo[bizid][bInteriorZ]);
  1386.   SetPlayerInterior(playerid, bInfo[bizid][bInterior]);
  1387.   SetPlayerVirtualWorld(playerid, bInfo[bizid][bVirtualWorld]);
  1388.   new string[180];
  1389.   format(string,sizeof(string),"Benvenuto A %s!", bInfo[bizid][bTitle]);
  1390.   ShowPlayerDialog(playerid,1499,DIALOG_STYLE_MSGBOX, string, "", "OK", "");
  1391.   return 1;
  1392. }
  1393.  
  1394. /*
  1395.                              ExitHouse
  1396.  Function: The player exits the house
  1397.  
  1398.  Parameters:
  1399.    -playerid: The ID of the player.
  1400.    -houseid: The ID of the house.
  1401.  
  1402.  Returns:
  1403.    -true(1): Everyway
  1404. */
  1405.  
  1406. stock ExitHouse(playerid, houseid)
  1407. {
  1408.   SetPlayerPos(playerid, hInfo[houseid][ExteriorX], hInfo[houseid][ExteriorY], hInfo[houseid][ExteriorZ]);
  1409.   SetPlayerInterior(playerid, hInfo[houseid][Exterior]);
  1410.   SetPlayerVirtualWorld(playerid, 0);
  1411.   LastHouse[playerid] = INVALID_HOUSE_ID;
  1412.   return 1;
  1413. }
  1414.  
  1415. /*
  1416.                              ExitBusiness
  1417.  Function: The player exits the business
  1418.  
  1419.  Parameters:
  1420.    -playerid: The ID of the player.
  1421.    -bizid: The ID of the biz.
  1422.  
  1423.  Returns:
  1424.    -true(1): Everyway
  1425. */
  1426.  
  1427. stock ExitBusiness(playerid, bizid)
  1428. {
  1429.   SetPlayerPos(playerid, bInfo[bizid][bExteriorX], bInfo[bizid][bExteriorY], bInfo[bizid][bExteriorZ]);
  1430.   SetPlayerInterior(playerid, 0);
  1431.   SetPlayerVirtualWorld(playerid, 0);
  1432.  
  1433.   new name[24];
  1434.   GetPlayerName(playerid, name, 24);
  1435.   if(strcmp(bInfo[bizid][bName], name, true) != 0 && strcmp(bInfo[bizid][bName], "ForSale", true) != 0) bInfo[bizid][bRifornimenti] -= 1;
  1436.   return 1;
  1437. }
  1438.  
  1439. stock GetBusinessMoney(playerid, bizid)
  1440. {
  1441.   if(bInfo[bizid][bCashRegister] == 0)
  1442.   {
  1443.     ShowPlayerDialog(playerid, 1499, DIALOG_STYLE_MSGBOX, "{FF0000}ERRORE", "Il Registratore Di Cassa E' Vuoto!", "OK", "");
  1444.     return 0;
  1445.   }
  1446.   new string2[180];
  1447.   GivePlayerMoney(playerid, bInfo[bizid][bCashRegister]);
  1448.   format(string2, sizeof(string2), "$%d Ritirati Dal Registratore Di Cassa!", bInfo[bizid][bCashRegister]);
  1449.   ShowPlayerDialog(playerid, 1499, DIALOG_STYLE_MSGBOX, "{33AA33}COMANDO", string2, "OK", "");
  1450.   new string[180];
  1451.   bInfo[bizid][bCashRegister] = 0;
  1452.   format(string,sizeof(string),BIZ_FILE, bizid);
  1453.   INI_Open(string);
  1454.   INI_WriteInt("Money", bInfo[bizid][bCashRegister]);
  1455.   INI_Save();
  1456.   INI_Close();
  1457.   return 1;
  1458. }
  1459.  
  1460. stock ResetBusinessMoney(bizid)
  1461. {
  1462.   new string[180];
  1463.   bInfo[bizid][bCashRegister] = 0;
  1464.   format(string,sizeof(string), BIZ_FILE, bizid);
  1465.   INI_Open(string);
  1466.   INI_WriteInt("Money", 0);
  1467.   INI_Save();
  1468.   INI_Close();
  1469.   return 1;
  1470. }
  1471.  
  1472. public AddBusinessMoney(bizid, money)
  1473. {
  1474.   if(bInfo[bizid][bRifornimenti] <= 0)
  1475.   {
  1476.     bInfo[bizid][bRifornimenti] = 0;
  1477.     return 1;
  1478.   }
  1479.   new string[180];
  1480.   bInfo[bizid][bCashRegister] += money;
  1481.   bInfo[bizid][bRifornimenti] -= money/1000;
  1482.   format(string, sizeof(string), BIZ_FILE, bizid);
  1483.   INI_Open(string);
  1484.   INI_WriteInt("Money", bInfo[bizid][bCashRegister]);
  1485.   INI_WriteInt("Merci", bInfo[bizid][bRifornimenti]);
  1486.   INI_Save();
  1487.   INI_Close();
  1488.   return 1;
  1489. }
  1490.  
  1491. public SaveHouseAndStoreInformation()
  1492. {
  1493.   new string[180];
  1494.  
  1495.   for(new i=0;i<MAX_HOUSES;i++)
  1496.   {
  1497.     if(hInfo[i][InteriorX] != 0.0)
  1498.     {
  1499.         format(string,sizeof(string), HOUSE_FILE, i);
  1500.         INI_Open(string);
  1501.         INI_WriteInt("Locked", bInfo[i][bLocked]);
  1502.         INI_Save();
  1503.         INI_Close();
  1504.     }
  1505.   }
  1506.   for(new i=0;i<MAX_BUSINESSES;i++)
  1507.   {
  1508.     if(bInfo[i][bInteriorX] != 0.0)
  1509.     {
  1510.         format(string,sizeof(string), BIZ_FILE, i);
  1511.         INI_Open(string);
  1512.         INI_WriteInt("Locked", bInfo[i][bLocked]);
  1513.         INI_WriteInt("Merci", bInfo[i][bRifornimenti]);
  1514.         INI_Save();
  1515.         INI_Close();
  1516.     }
  1517.   }
  1518.   return 1;
  1519. }
  1520.  
  1521. //MESSAGES
  1522.  
  1523. stock ShowLockedHouseMessage(playerid)
  1524. {
  1525.   ShowPlayerDialog(playerid, 1499, DIALOG_STYLE_MSGBOX, "{FF0000}ERRORE","La Porta E' Chiusa A Chiave!","OK","");
  1526.   return 1;
  1527. }
  1528.  
  1529. stock ShowLockedStoreMessage(playerid)
  1530. {
  1531.   ShowPlayerDialog(playerid, 1499, DIALOG_STYLE_MSGBOX, "{FF0000}ERRORE","Ci Dispiace Ma Questo Negozio E' Chiuso. Torna Piu Tardi.","OK","");
  1532.   return 1;
  1533. }
  1534.  
  1535. stock ShowNoMoneyMessage(playerid)
  1536. {
  1537.   ShowPlayerDialog(playerid, 1499, DIALOG_STYLE_MSGBOX, "{FF0000}ERRORE","Non Hai Abbastanza Soldi!","OK","");
  1538.   return 1;
  1539. }
  1540.  
  1541. stock ShowNoGoodsMessage(playerid)
  1542. {
  1543.   ShowPlayerDialog(playerid, 1499, DIALOG_STYLE_MSGBOX, "{FF0000}ERRORE","Ci Dispiace Ma Questo Negozio Ha Esaurito Le Merci.","OK","");
  1544.   return 1;
  1545. }
  1546.  
  1547. stock ShowOwnerNoGoodsMessage(playerid)
  1548. {
  1549.   ShowPlayerDialog(playerid, 1499, DIALOG_STYLE_MSGBOX, "{FFAA00}WARNING","Il Tuo Negozio Non Ha Rifornimenti.","OK","");
  1550.   return 1;
  1551. }
  1552.  
  1553. stock ShowSoldHouseMessage(playerid)
  1554. {
  1555.   new string[51];
  1556.   format(string,sizeof(string),"Casa Venduta Per $%d!", hInfo[GetHouseID(playerid)][Sell]);
  1557.   ShowPlayerDialog(playerid, 1499, DIALOG_STYLE_MSGBOX, "{33AA33}COMANDO", string, "OK", "");
  1558.   return 1;
  1559. }
  1560.  
  1561. stock ShowSoldStoreMessage(playerid)
  1562. {
  1563.   new string[51];
  1564.   format(string,sizeof(string),"Negozio Venduto Per $%d!", hInfo[GetHouseID(playerid)][Sell]);
  1565.   ShowPlayerDialog(playerid, 1499, DIALOG_STYLE_MSGBOX, "{33AA33}COMANDO", string, "OK", "");
  1566.   return 1;
  1567. }
  1568.  
  1569. stock ShowBoughtHouseMessage(playerid)
  1570. {
  1571.   new string[51];
  1572.   format(string,sizeof(string),"Casa Acquistata Per $%d!", hInfo[GetHouseID(playerid)][Cost]);
  1573.   ShowPlayerDialog(playerid, 1499, DIALOG_STYLE_MSGBOX, "{33AA33}COMANDO", string, "OK", "");
  1574.   return 1;
  1575. }
  1576.  
  1577. stock ShowBoughtStoreMessage(playerid)
  1578. {
  1579.   new string[51];
  1580.   format(string,sizeof(string),"Negozio Acquistato Per $%d!", hInfo[GetHouseID(playerid)][Cost]);
  1581.   ShowPlayerDialog(playerid, 1499, DIALOG_STYLE_MSGBOX, "{33AA33}COMANDO", string, "OK", "");
  1582.   return 1;
  1583. }
  1584.  
  1585. stock LockYourHouseMessage(playerid)
  1586. {
  1587.   ShowPlayerDialog(playerid, 1499, DIALOG_STYLE_MSGBOX, "{33AA33}COMANDO","Hai Chiuso A Chiave La Porta!","OK","");
  1588.   return 1;
  1589. }
  1590.  
  1591. stock LockYourStoreMessage(playerid)
  1592. {
  1593.   ShowPlayerDialog(playerid, 1499, DIALOG_STYLE_MSGBOX, "{33AA33}COMANDO","Hai Chiuso Il Negozio!","OK","");
  1594.   return 1;
  1595. }
  1596.  
  1597. stock UnlockYourHouseMessage(playerid)
  1598. {
  1599.   ShowPlayerDialog(playerid, 1499, DIALOG_STYLE_MSGBOX, "{33AA33}COMANDO","Hai Aperto La Porta!","OK","");
  1600.   return 1;
  1601. }
  1602.  
  1603. stock UnlockYourStoreMessage(playerid)
  1604. {
  1605.   ShowPlayerDialog(playerid, 1499, DIALOG_STYLE_MSGBOX, "{33AA33}COMANDO","Hai Aperto Il Negozio!","OK","");
  1606.   return 1;
  1607. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement