houses.inc 89 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966
  1. #if defined HOUSES_INCLUDED
  2. #endinput
  3. #endif
  4. #define HOUSES_INCLUDED
  5. #include "..\gamemodes\inc\Property\gates.inc"
  6. // IMPORTANT NOTICE; HouseInfo[houseid][hModified] = 1; enables saving to that house
  7. // set hModified to 1, only when the house is modified and requires saving.
  8. // this is for improved performance.
  9. //============================[ Loading/Saving ]================================
  10. static str[128], tmp[128];
  11. enum _houseInteriorInfo
  12. {
  13. hInteriorID,
  14. Float:hX,
  15. Float:hY,
  16. Float:hZ,
  17. Float:hA,
  18. hName[32],
  19. hFreeze,
  20. hLevel
  21. }
  22. new houseInteriorInfo[][_houseInteriorInfo] = {
  23. {0, 1.7592,12.9488,999.4284,89.8906, "Angel Pine Trailer", 0, 1}, //index 0
  24. {1, 244.5000, 305.0000, 999.1484, 270.0000, "Small Room 1", 0, 1},
  25. {2, 267.1000, 305.0000, 999.1484, 270.0000, "Small Room 2", 0, 1},
  26. {10, 2259.3948, -1135.8015, 1050.6403, 270.0000, "Motel Room", 0, 2},
  27. {15, 386.8663, 1471.6508, 1080.1949, 86.6616, "Small House 1", 0, 3},
  28. {5, 22.7071, 1403.3888, 1084.4370, 359.5774, "Small House 2", 0,4},
  29. {4, 301.3000, 306.3000, 1003.5391, 270.0000, "Wood House", 0, 7},
  30. {15, 295.0853, 1472.4978, 1080.2578, 357.6974, "Med House 1", 0, 5},
  31. {15, 386.8132, 1471.5809, 1080.1949, 87.9148, "Med House 2", 0, 6},
  32. {2, 446.9661, 1397.6705, 1084.3047, 3.1456, "Med House 3", 0, 8},
  33. {15, 376.3000, 1417.2000, 1081.3281, 84.5970, "Rich House 1", 0, 9},
  34. {15, 295.0820, 1472.5895, 1080.2578, 357.9638, "Rich House 2", 0, 6},
  35. {6, 234.1893, 1064.2260, 1084.2115, 357.8933, "Rich House 3", 0, 11},
  36. {7, 225.7264, 1021.7980, 1084.0167, 0.4233, "Rich House 4", 0, 50},
  37. {12, 2324.4729, -1148.9298, 1050.7101, 359.4833, "Rich House 5", 0, 55},
  38. {3, 235.2827, 1187.0928, 1080.2578, 358.8566, "Rich House 6", 0, 45},
  39. {6, 344.4200, 304.9100, 999.1484, 280.0000, "BDSM Lair", 0, 20},
  40. {5, 1226.5758, -812.2072, 1084.0078, 0.0000, "Office", 0, 5},
  41. {6, 0744.4441, 1437.6198, 1102.7031, 360.0000, "Stripclub", 0, 5},
  42. {3, 963.4101, -53.1195, 1001.1246, 87.6137, "Brothel", 0, 10},
  43. {2, 2549.1807, -1294.7899, 1060.9844, 262.7453, "Big Smokes", 0, 40},
  44. {5, 226.54, 1114.31, 1080.99, 270.0000, "VIP House 1", 0, 60},
  45. {5, 140.26, 1366.78, 1083.86, 0.0000, "VIP House 2", 0, 45},
  46. {10, 23.9781, 1340.4080, 1084.3750, 357.0715, "New House", 0, 40},
  47. {4, -260.9349,1456.6975,1084.3672,86.3724, "New House", 0, 32},
  48. {9, 83.0348,1322.7543,1083.8662,359.8916, "New House", 0, 37},
  49. {9, 2317.8899,-1026.7600,1050.2178,359.8916, "New House", 0, 37},
  50. {3, 2495.9409,-1692.5228,1014.7422,178.8066, "New House", 0, 37},
  51. {8, 2807.6604,-1174.4706,1025.5703,358.0116, "New House", 0, 24},
  52. {6, 2196.5779,-1204.4008,1049.0234,93.5792, "New House", 0, 26},
  53. {10, 2270.1311,-1210.4797,1047.5625,89.1925, "New House", 0, 21},
  54. {8, 2365.2231,-1135.3877,1050.8750,0.5182, "New House", 0, 10},
  55. {2, 2237.5620,-1081.2277,1049.0234,358.0116, "New House", 0, 27},
  56. {4, 261.0469,1284.5985,1080.2578,358.9516, "New House", 0, 20},
  57. {4, 221.8893,1140.6204,1082.6094,358.0116, "New House", 0, 15},
  58. {6, -68.8100,1351.2100,1080.2109,358.0116, "New House", 0, 17},
  59. {9, 260.7921,1237.5183,1084.2578,359.5782, "New House", 0, 29},
  60. {2, 2468.5461,-1698.2461,1013.5078,87.9392, "New House", 0, 24},
  61. {1, 223.1488,1287.3376,1082.1406,359.2650, "New House", 0, 21},
  62. {11, 2282.9709,-1140.0293,1050.8984,357.3849, "New House", 0, 8},
  63. {15, 327.9431,1477.9525,1084.4375,359.5781, "New House", 0, 8},
  64. {8, -42.5900,1405.4700,1084.4297,359.5781, "New House", 0, 15},
  65. {6, 2308.7700,-1212.9399,1049.0234,359.5781, "New House", 0, 18},
  66. {1, 2524.4788,-1679.4126,1015.4986,268.7106, "New House", 0, 15}, //43
  67. {1, 243.9651,304.9588,1008.6194,272.0475, "Empty House", 1, 18},
  68. {1, 266.7557,304.9372,1009.5787,269.2274, "Empty House", 1, 15},
  69. {1, 2259.5396,-1135.8944,1061.3513,269.2040, "Empty House", 1, 22},
  70. {1, 446.9709,1397.0635,1096.2762,2.6000, "Empty House", 1, 10},
  71. {1, 376.9538,1417.4308,1090.5320,89.0590, "Empty House", 1, 11},
  72. {1, 295.2011,1472.5571,1288.4384,359.6507, "Empty House", 1, 20}, //needs new coords
  73. {1, 234.1711,1064.0579,1098.0194,1.3946, "Empty House", 1, 20},
  74. {1, 225.7832,1021.6218,1096.2322,1.0814, "Empty House", 1, 25},
  75. {1, 2324.5049,-1149.2339,1064.2856,358.9350, "Empty House", 1, 60},
  76. {1, 235.3277,1187.0463,1092.5670,357.8173, "Empty House", 1, 60}, //needs new coords
  77. {1, 343.9464,304.9431,1009.9575,266.2343, "Empty House", 1, 55},
  78. {1, 226.4931,1114.1849,1291.2213,271.0233, "Empty House", 1, 31}, //needs new coords
  79. {1, 140.3286,1366.1735,1096.6440,1.2222, "Empty House", 1, 15},
  80. {1, 24.0189,1340.3876,1099.2056,359.9922, "Empty House", 1, 28},
  81. {1, -260.8597,1456.7130,1097.5079,91.1497, "Empty House", 1, 41},
  82. {1, 83.0698,1322.4150,1097.1952,0.3056, "Empty House", 1, 37},
  83. {1, 2317.7932,-1026.7068,1065.2538,359.7022, "Empty House", 1, 39},
  84. {1, 2495.9241,-1692.2426,1029.1273,180.5206, "Empty House", 1, 37},
  85. {1, 2807.6565,-1174.5311,1037.6699,358.8089, "Empty House", 1, 28},
  86. {1, 2196.6406,-1204.3497,1259.0602,90.8549, "Empty House", 1, 25}, //needs new coords //
  87. {1, 2270.1367,-1210.4171,1256.5388,89.8916, "Empty House", 1, 25}, //needs new coords //
  88. {1, 2237.5422,-1081.2633,1257.1143,1.2175, "Empty House", 1, 21}, //needs new coords //
  89. // {0, 2365.2249,-1135.3840,1061.4880,359.5294, "Empty House", 1, 21}, //major transparent
  90. {1, 260.9997,1284.4519,1087.7015,357.0461, "Empty House", 1, 20},
  91. {1, 221.8969,1140.3651,1087.5343,358.0563, "Empty House", 1, 18},
  92. {1, -68.8098,1351.5551,1088.9017,1.1661, "Empty House", 1, 20},
  93. {1, 260.8188,1237.6218,1092.3868,359.3095, "Empty House", 1, 21},
  94. {1, 223.1048,1287.0809,1088.4839,5.8894, "Empty House", 1, 22},
  95. {1, 2282.9199,-1139.9753,1057.4589,2.7327, "Empty House", 1, 10},
  96. {1, 328.0080,1477.9692,1091.9458,358.9727, "Empty House", 1, 10},
  97. {1, -42.5948,1405.7189,1091.6273,4.2994, "Empty House", 1, 17},
  98. {1, 2253.7280,-1114.0651,850.8878,5.8827, "Empty Motel Room", 0, 10 },
  99. {1, 698.0511,338.8492,803.5403,269.6884, "Empty House", 0, 12 },
  100. {1, 424.7157,2519.7791,9.9994,94.2435, "Empty House", 0, 10 }
  101. };
  102. #define MAX_HOUSE_INTERIORS sizeof(houseInteriorInfo)
  103. #define INVALID_HOUSE_ID MAX_HOUSES+1
  104. forward GetHouseVirtualWorld(houseid);
  105. new HouseFiresRemaining[MAX_HOUSES]; //fires remaining at house, fire system
  106. stock GetHousePool()
  107. {
  108. new pool, Cache:housesPool;
  109. housesPool = mysql_query(sqlGameConnection, "SELECT HouseID FROM houses ORDER BY HouseID DESC LIMIT 1;");
  110. pool = cache_get_field_content_int(0, "HouseID");
  111. cache_delete(housesPool);
  112. return pool;
  113. }
  114. stock LoadOwnedHouses()
  115. {
  116. mysql_tquery(sqlGameConnection, "SELECT houses.*, players.Name FROM houses INNER JOIN players ON houses.OwnerID = players.ID", "OnLoadOwnedHouses", "");
  117. printf("mysql_tquery OnLoadOwnedHouses");
  118. return 1;
  119. }
  120. new
  121. ownedHousesPool = 0;
  122. //static str[128], tmp[128]; //this is already defined in the
  123. forward OnLoadOwnedHouses();
  124. public OnLoadOwnedHouses()
  125. {
  126. new
  127. value[100];
  128. for(new i = 1; i < cache_num_rows(); i++)
  129. {
  130. if(i == MAX_HOUSES)
  131. return print("[HouseInfo] WARNING: maximum houses reached.");
  132. //important variables/general variables
  133. if(!(cache_get_field_content_int(i, "Created"))) continue;
  134. HouseInfo[i][hSQLID] = cache_get_field_content_int(i, "HouseID");
  135. HouseInfo[i][hOwnerID] = cache_get_field_content_int(i, "OwnerID");
  136. cache_get_field_content(i, "Name", value);
  137. format(HouseInfo[i][hOwner], MAX_PLAYER_NAME + 1, "%s", value);
  138. HouseInfo[i][hOwned] = cache_get_field_content_int(i, "Owned");
  139. HouseInfo[i][hValue] = cache_get_field_content_int(i, "Value");
  140. cache_get_field_content(i, "Tag", value);
  141. strmid(HouseInfo[i][hTag], value, 0, strlen(value), 255);
  142. HouseInfo[i][hLevel] = cache_get_field_content_int(i, "Level");
  143. HouseInfo[i][hDonated] = cache_get_field_content_int(i, "Donated");
  144. //icon location variables
  145. cache_get_field_content(i, "OutsideX", value);
  146. HouseInfo[i][hOutsideX] = floatstr(value);
  147. cache_get_field_content(i, "OutsideY", value);
  148. HouseInfo[i][hOutsideY] = floatstr(value);
  149. cache_get_field_content(i, "OutsideZ", value);
  150. HouseInfo[i][hOutsideZ] = floatstr(value);
  151. cache_get_field_content(i, "OutsideA", value);
  152. HouseInfo[i][hOutsideA] = floatstr(value);
  153. cache_get_field_content(i, "InsideX", value);
  154. HouseInfo[i][hInsideX] = floatstr(value);
  155. cache_get_field_content(i, "InsideY", value);
  156. HouseInfo[i][hInsideY] = floatstr(value);
  157. cache_get_field_content(i, "InsideZ", value);
  158. HouseInfo[i][hInsideZ] = floatstr(value);
  159. cache_get_field_content(i, "InsideA", value);
  160. HouseInfo[i][hInsideA] = floatstr(value);
  161. HouseInfo[i][hWorld] = i;
  162. HouseInfo[i][hInterior] = cache_get_field_content_int(i, "Interior");
  163. //upgrades/storage
  164. HouseInfo[i][hLocked] = cache_get_field_content_int(i, "Locked");
  165. HouseInfo[i][hAlarm] = cache_get_field_content_int(i, "Alarm");
  166. HouseInfo[i][hAlarmStatus] = cache_get_field_content_int(i, "AlarmStatus");
  167. HouseInfo[i][hCash] = cache_get_field_content_int(i, "Cash");
  168. HouseInfo[i][hMaterials] = cache_get_field_content_int(i, "Materials");
  169. HouseInfo[i][hCannabis] = cache_get_field_content_int(i, "Cannabis");
  170. HouseInfo[i][hCocaine] = cache_get_field_content_int(i, "Cocaine");
  171. HouseInfo[i][hMeth] = cache_get_field_content_int(i, "Meth");
  172. HouseInfo[i][hXanax] = cache_get_field_content_int(i, "Xanax");
  173. HouseInfo[i][hPromethazine] = cache_get_field_content_int(i, "Promethazine");
  174. HouseInfo[i][hCodeine] = cache_get_field_content_int(i, "Codeine");
  175. HouseInfo[i][hLean] = cache_get_field_content_int(i, "Lean");
  176. HouseInfo[i][hGun1] = cache_get_field_content_int(i, "Gun1");
  177. HouseInfo[i][hGun2] = cache_get_field_content_int(i, "Gun2");
  178. HouseInfo[i][hGun3] = cache_get_field_content_int(i, "Gun3");
  179. HouseInfo[i][hGun4] = cache_get_field_content_int(i, "Gun4");
  180. HouseInfo[i][hGun5] = cache_get_field_content_int(i, "Gun5");
  181. HouseInfo[i][hGun6] = cache_get_field_content_int(i, "Gun6");
  182. HouseInfo[i][hGun7] = cache_get_field_content_int(i, "Gun7");
  183. HouseInfo[i][hHasFurniture] = cache_get_field_content_int(i, "HasFurniture");
  184. HouseInfo[i][hFreeze] = cache_get_field_content_int(i, "Freeze");
  185. HouseInfo[i][hModified] = 0;
  186. HouseInfo[i][hOutsidePickup] = CreateDynamicPickup(HOUSE_OFFLINE, 1, HouseInfo[i][hOutsideX], HouseInfo[i][hOutsideY], HouseInfo[i][hOutsideZ]);
  187. HouseInfoText3D[i] = CreateDynamic3DTextLabel("", COLOR_HOUSETEXT, HouseInfo[i][hOutsideX], HouseInfo[i][hOutsideY], HouseInfo[i][hOutsideZ] +0.88, 20.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 1, -1, -1, -1, 100);
  188. SetHouseTag(i);
  189. //load the furniture if the house has furniture
  190. if(HouseInfo[i][hHasFurniture]) {
  191. printf("[Furniture] loading house furniture for houseid %d (sqlid %d)", i, HouseInfo[i][hSQLID]);
  192. LoadFurniture(i, HouseInfo[i][hSQLID]);
  193. }
  194. HouseInfo[i][hCreated] = 1;
  195. houseCount++;
  196. }
  197. ownedHousesPool = houseCount;
  198. lastSQLhouseID = GetHousePool();
  199. printf("[HouseInfo] %d owned houses were loaded.", ownedHousesPool);
  200. mysql_tquery(sqlGameConnection, "SELECT * FROM houses WHERE OwnerID = 0", "OnLoadUnownedHouses", "");
  201. printf("mysql_tquery OnLoadUnownedHouses");
  202. return 1;
  203. }
  204. forward OnLoadUnownedHouses();
  205. public OnLoadUnownedHouses()
  206. {
  207. new
  208. value[100], houseCountUnowned = 0;
  209. for(new i = ownedHousesPool + 1; i < cache_num_rows() + ownedHousesPool; i++) //starts at 1
  210. {
  211. if(i == MAX_HOUSES)
  212. return print("[HouseInfo] WARNING: maximum houses reached.");
  213. //important variables/general variables
  214. if(!(cache_get_field_content_int(i, "Created"))) continue;
  215. HouseInfo[i][hSQLID] = cache_get_field_content_int(i, "HouseID");
  216. HouseInfo[i][hOwnerID] = 0;
  217. HouseInfo[i][hOwned] = 0;
  218. HouseInfo[i][hValue] = cache_get_field_content_int(i, "Value");
  219. cache_get_field_content(i, "Tag", value);
  220. strmid(HouseInfo[i][hTag], value, 0, strlen(value), 255);
  221. HouseInfo[i][hLevel] = cache_get_field_content_int(i, "Level");
  222. HouseInfo[i][hDonated] = cache_get_field_content_int(i, "Donated");
  223. //icon location variables
  224. cache_get_field_content(i, "OutsideX", value);
  225. HouseInfo[i][hOutsideX] = floatstr(value);
  226. cache_get_field_content(i, "OutsideY", value);
  227. HouseInfo[i][hOutsideY] = floatstr(value);
  228. cache_get_field_content(i, "OutsideZ", value);
  229. HouseInfo[i][hOutsideZ] = floatstr(value);
  230. cache_get_field_content(i, "OutsideA", value);
  231. HouseInfo[i][hOutsideA] = floatstr(value);
  232. cache_get_field_content(i, "InsideX", value);
  233. HouseInfo[i][hInsideX] = floatstr(value);
  234. cache_get_field_content(i, "InsideY", value);
  235. HouseInfo[i][hInsideY] = floatstr(value);
  236. cache_get_field_content(i, "InsideZ", value);
  237. HouseInfo[i][hInsideZ] = floatstr(value);
  238. cache_get_field_content(i, "InsideA", value);
  239. HouseInfo[i][hInsideA] = floatstr(value);
  240. HouseInfo[i][hInterior] = cache_get_field_content_int(i, "Interior");
  241. HouseInfo[i][hModified] = 0;
  242. HouseInfo[i][hOutsidePickup] = CreateDynamicPickup(HOUSE_UNOWNED, 1, HouseInfo[i][hOutsideX], HouseInfo[i][hOutsideY], HouseInfo[i][hOutsideZ]);
  243. HouseInfoText3D[i] = CreateDynamic3DTextLabel("", COLOR_HOUSETEXT, HouseInfo[i][hOutsideX], HouseInfo[i][hOutsideY], HouseInfo[i][hOutsideZ] +0.88, 20.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 1, -1, -1, -1, 100);
  244. SetHouseTag(i);
  245. HouseInfo[i][hCreated] = 1;
  246. houseCountUnowned++;
  247. }
  248. printf("[HouseInfo] %d unowned houses were loaded. The last SQL ID in the table is; %d.", houseCountUnowned, lastSQLhouseID);
  249. return 1;
  250. }
  251. public SaveHouses()
  252. {
  253. new
  254. houseCountSaved = 0;
  255. for(new i = 1; i < sizeof(HouseInfo); i++)
  256. {
  257. if(!HouseInfo[i][hCreated]) continue;
  258. if(!HouseInfo[i][hModified]) continue;
  259. new query[2500];
  260. mysql_format(sqlGameConnection, query, sizeof(query), "UPDATE `houses` SET `OwnerID` = %d, `Created` = %d, `Owned` = %d,",
  261. HouseInfo[i][hOwnerID], HouseInfo[i][hCreated], HouseInfo[i][hOwned]);
  262. mysql_format(sqlGameConnection, query, sizeof(query), "%s `Value` = %d, `OutsideX` = %f, `OutsideY` = %f, `OutsideZ` = %f,",
  263. query, HouseInfo[i][hValue], HouseInfo[i][hOutsideX], HouseInfo[i][hOutsideY], HouseInfo[i][hOutsideZ]);
  264. mysql_format(sqlGameConnection, query, sizeof(query), "%s `OutsideA` = %f, `InsideX` = %f, `InsideY` = %f, `InsideZ` = %f,",
  265. query, HouseInfo[i][hOutsideA], HouseInfo[i][hInsideX], HouseInfo[i][hInsideY], HouseInfo[i][hInsideZ]);
  266. mysql_format(sqlGameConnection, query, sizeof(query), "%s `InsideA` = %f, `Interior` = %d, `Locked` = %d, `Alarm` = %d,",
  267. query, HouseInfo[i][hInsideA], HouseInfo[i][hInterior], HouseInfo[i][hLocked], HouseInfo[i][hAlarm]);
  268. mysql_format(sqlGameConnection, query, sizeof(query), "%s `AlarmStatus` = %d, `Cash` = %d, `Materials` = %d, `Cannabis` = %d,",
  269. query, HouseInfo[i][hAlarmStatus], HouseInfo[i][hCash], HouseInfo[i][hMaterials], HouseInfo[i][hCannabis]);
  270. mysql_format(sqlGameConnection, query, sizeof(query), "%s `Xanax` = %d, `Promethazine` = %d, `Codeine` = %d, `Lean` = %d,",
  271. query, HouseInfo[i][hXanax], HouseInfo[i][hPromethazine], HouseInfo[i][hCodeine], HouseInfo[i][hLean]);
  272. mysql_format(sqlGameConnection, query, sizeof(query), "%s `Cocaine` = %d, `Meth` = %d, `Gun1` = %d, `Gun2` = %d, `Gun3` = %d,",
  273. query, HouseInfo[i][hCocaine], HouseInfo[i][hMeth], HouseInfo[i][hGun1], HouseInfo[i][hGun2], HouseInfo[i][hGun3]);
  274. mysql_format(sqlGameConnection, query, sizeof(query), "%s `Gun4` = %d, `Gun5` = %d, `Gun6` = %d, `Gun7` = %d, `Tag` = '%e', `Level` = %d , `Freeze` = %d, `Donated`=%d, `HasFurniture`=%d WHERE `HouseID` = %d",
  275. query, HouseInfo[i][hGun4], HouseInfo[i][hGun5], HouseInfo[i][hGun6], HouseInfo[i][hGun7], HouseInfo[i][hTag], HouseInfo[i][hLevel], HouseInfo[i][hFreeze], HouseInfo[i][hDonated], HouseInfo[i][hHasFurniture], HouseInfo[i][hSQLID]);
  276. mysql_tquery(sqlGameConnection, query);
  277. HouseInfo[i][hModified] = 0;
  278. houseCountSaved++;
  279. }
  280. printf("[HouseInfo] %d houses were saved.", houseCountSaved);
  281. return 1;
  282. }
  283. //===========================[ Useful functions ]===============================
  284. //simple getter
  285. public GetHouseVirtualWorld(houseid) {
  286. if(!(0 < houseid < MAX_HOUSES)) return INVALID_HOUSE_ID;
  287. return HouseInfo[houseid][hSQLID];
  288. }
  289. stock SetHouseTag(hid)
  290. {
  291. new
  292. newhousetag[180], location[60];
  293. Get2DZone(location, MAX_ZONE_NAME, HouseInfo[hid][hOutsideX], HouseInfo[hid][hOutsideY], HouseInfo[hid][hOutsideZ]);
  294. if(HouseInfo[hid][hOwned] == 1)
  295. {
  296. format(newhousetag, sizeof(newhousetag), "{5BC435}%s{FFFFFF}\nAddress: %d %s\nPost code: %d\nType /enter to go inside.", HouseInfo[hid][hTag], hid, location, HouseInfo[hid][hSQLID]);
  297. }
  298. else
  299. {
  300. format(newhousetag, sizeof(newhousetag), "{5BC435}This property is for sale!{FFFFFF}\nAddress: %d %s\nPost code: %d\nType /buyhouse to buy it for $%d", hid, location, HouseInfo[hid][hSQLID], HouseInfo[hid][hValue]);
  301. }
  302. UpdateDynamic3DTextLabelText(HouseInfoText3D[hid], COLOR_HOUSETEXT, newhousetag);
  303. return 1;
  304. }
  305. stock GetHouseOwnerIDFromSQLID(sqlid)
  306. {
  307. for(new i = 1; i < MAX_HOUSES; i++)
  308. {
  309. if(HouseInfo[i][hOwnerID] == sqlid)
  310. {
  311. print("house ID obtained.");
  312. return i;
  313. }
  314. }
  315. return 0;
  316. }
  317. stock GetHouseIDFromSQLID(sqlid)
  318. {
  319. for(new i = 0; i < MAX_HOUSES; i++)
  320. {
  321. if(HouseInfo[i][hSQLID] == sqlid)
  322. {
  323. return i;
  324. }
  325. }
  326. return 0;
  327. }
  328. stock GetHouseOwner(sqlid, playerid){
  329. new query[128];
  330. mysql_format(sqlGameConnection, query, sizeof(query), "SELECT `HouseID` FROM `houses` WHERE `OwnerID`=%d", sqlid);
  331. mysql_tquery(sqlGameConnection, query, "OnGetHouseOwner", "i", playerid);
  332. return 1;
  333. }
  334. forward OnGetHouseOwner(playerid);
  335. public OnGetHouseOwner(playerid)
  336. {
  337. new ID;
  338. if(cache_num_rows() != 0)
  339. {
  340. ID = cache_get_field_content_int(0, "HouseID");
  341. }
  342. else
  343. ID = 0;
  344. PlayerInfo[playerid][pHouseID] = ID;
  345. }
  346. stock GetPlayerNearHouseID(playerid)
  347. {
  348. for(new i = 1; i < sizeof(HouseInfo); i++)
  349. {
  350. if(IsPlayerInRangeOfPoint(playerid, 1.0, HouseInfo[i][hOutsideX], HouseInfo[i][hOutsideY], HouseInfo[i][hOutsideZ]))
  351. {
  352. return i;
  353. }
  354. }
  355. return 0;
  356. }
  357. stock GetHouseLocation(houseid)
  358. {
  359. new location[MAX_ZONE_NAME];
  360. Get2DZone(location, MAX_ZONE_NAME, HouseInfo[houseid][hOutsideX], HouseInfo[houseid][hOutsideY], HouseInfo[houseid][hOutsideZ]);
  361. return location;
  362. }
  363. stock DeleteHouse(houseid)
  364. {
  365. DestroyDynamic3DTextLabel(HouseInfoText3D[houseid]);
  366. HouseInfoText3D[houseid] = Text3D:INVALID_3DTEXT_ID;
  367. HouseInfo[houseid][hCreated] = 0;
  368. HouseInfo[houseid][hOwned] = 0;
  369. HouseInfo[houseid][hValue] = 0;
  370. HouseInfo[houseid][hOutsideX] = 0;
  371. HouseInfo[houseid][hOutsideY] = 0;
  372. HouseInfo[houseid][hOutsideZ] = 0;
  373. HouseInfo[houseid][hOutsideA] = 0;
  374. HouseInfo[houseid][hInsideX] = 0;
  375. HouseInfo[houseid][hInsideY] = 0;
  376. HouseInfo[houseid][hInsideZ] = 0;
  377. HouseInfo[houseid][hInsideA] = 0;
  378. HouseInfo[houseid][hInterior] = 0;
  379. HouseInfo[houseid][hLocked] = 0;
  380. HouseInfo[houseid][hAlarm] = 0;
  381. HouseInfo[houseid][hAlarmStatus] = 0;
  382. HouseInfo[houseid][hCash] = 0;
  383. HouseInfo[houseid][hMaterials] = 0;
  384. HouseInfo[houseid][hCannabis] = 0;
  385. HouseInfo[houseid][hCocaine] = 0;
  386. HouseInfo[houseid][hMeth] = 0;
  387. HouseInfo[houseid][hGun1] = 0;
  388. HouseInfo[houseid][hGun2] = 0;
  389. HouseInfo[houseid][hGun3] = 0;
  390. HouseInfo[houseid][hGun4] = 0;
  391. HouseInfo[houseid][hGun5] = 0;
  392. HouseInfo[houseid][hGun6] = 0;
  393. HouseInfo[houseid][hGun7] = 0;
  394. HouseInfo[houseid][hOwnerID] = -1;
  395. strdel(HouseInfo[houseid][hTag], 0, strlen(HouseInfo[houseid][hTag]));
  396. strins(HouseInfo[houseid][hTag], "House", 0);
  397. HouseInfo[houseid][hLevel] = 0;
  398. HouseInfo[houseid][hDonated] = 0;
  399. if(HouseInfo[houseid][hOutsidePickup])
  400. {
  401. DestroyDynamicPickup(HouseInfo[houseid][hOutsidePickup]);
  402. }
  403. HouseInfo[houseid][hSQLID] = 0;
  404. return 1;
  405. }
  406. //==============================[ Admin commands ]==============================
  407. CMD:cleanhouses(playerid, params[]) //data cleanups
  408. {
  409. if(PlayerInfo[playerid][pAdmin] < 99999)
  410. return AdmErrorMsg;
  411. new confirm[128];
  412. if(sscanf(params, "s[128]", confirm))
  413. {
  414. if(strcmp(confirm, "confirm", true) == 0)
  415. {
  416. SendClientMessage(playerid, COLOR_LIGHTBLUE, "This action will delete all houses at coordinates 0.0, 0.0, 0.0 and houses not created.");
  417. return SendClientMessage(playerid, COLOR_GREY, "Type /cleanhouses confirm to clean up the houses table.");
  418. }
  419. }
  420. for(new i = 1; i < MAX_HOUSES; i++)
  421. {
  422. if(HouseInfo[i][hOutsideX] == 0.0 && HouseInfo[i][hOutsideY] == 0.0)
  423. {
  424. DeleteHouse(i);
  425. }
  426. }
  427. mysql_tquery(sqlGameConnection, "DELETE FROM houses WHERE OutsideX = 0.0 AND OutsideY = 0.0", "", "");
  428. mysql_tquery(sqlGameConnection, "DELETE FROM houses WHERE Created = 0", "", "");
  429. SendClientMessage(playerid, COLOR_GREY, "You have cleaned out the houses table.");
  430. return 1;
  431. }
  432. CMD:createhouse(playerid, params[])
  433. {
  434. if(PlayerInfo[playerid][pAdmin] >= 99999 || PlayerInfo[playerid][pBizMod] == 1)
  435. {
  436. new price, interiorid, houseid, Float:X, Float:Y, Float:Z, Float:A, check = 0;
  437. if(sscanf(params, "dd", price, interiorid))
  438. {
  439. SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /createhouse [price] [interior id]");
  440. format(str, sizeof(str), "{00BFFF}Usage:{FFFFFF} /viewhouseint [0-%d] or /gotoint", MAX_HOUSE_INTERIORS);
  441. SendClientMessage(playerid, COLOR_GRAD2, str);
  442. return 1;
  443. }
  444. GetPlayerPos(playerid, X, Y, Z);
  445. GetPlayerFacingAngle(playerid, A);
  446. for(new i = 1; i < sizeof(HouseInfo); i++)
  447. {
  448. if(HouseInfo[i][hCreated] == 0)
  449. {
  450. check = 1;
  451. houseid = i;
  452. break;
  453. }
  454. }
  455. if(!check) return SendClientMessage(playerid, COLOR_GRAD2, "1000/1000 houses have already been created.");
  456. lastSQLhouseID++;
  457. HouseInfo[houseid][hSQLID] = lastSQLhouseID;
  458. HouseInfo[houseid][hOutsideX] = X;
  459. HouseInfo[houseid][hOutsideY] = Y;
  460. HouseInfo[houseid][hOutsideZ] = Z;
  461. HouseInfo[houseid][hOutsideA] = A;
  462. HouseInfo[houseid][hCreated] = 1;
  463. HouseInfo[houseid][hValue] = price;
  464. strdel(HouseInfo[houseid][hTag], 0, strlen(HouseInfo[houseid][hTag]));
  465. strins(HouseInfo[houseid][hTag], "House", 0);
  466. SetHouseInterior(houseid, interiorid);
  467. ownedHousesPool++;
  468. if(HouseInfo[houseid][hOutsidePickup])
  469. {
  470. DestroyDynamicPickup(HouseInfo[houseid][hOutsidePickup]);
  471. }
  472. HouseInfo[houseid][hOutsidePickup] = CreateDynamicPickup(1273, 1, HouseInfo[houseid][hOutsideX], HouseInfo[houseid][hOutsideY], HouseInfo[houseid][hOutsideZ]);
  473. if(HouseInfoText3D[houseid])
  474. {
  475. DestroyDynamic3DTextLabel(HouseInfoText3D[houseid]);
  476. }
  477. HouseInfoText3D[houseid] = CreateDynamic3DTextLabel("", COLOR_HOUSETEXT, HouseInfo[houseid][hOutsideX], HouseInfo[houseid][hOutsideY], HouseInfo[houseid][hOutsideZ] +0.88, 20.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 1, -1, -1, -1, 100);
  478. SetHouseTag(houseid);
  479. format(str, sizeof(str), "You have created houseid %d with the price of $%d and interiorid %d", houseid, price, interiorid);
  480. SendClientMessage(playerid, COLOR_GRAD1, str);
  481. new query[500];
  482. format(query, sizeof(query), "INSERT INTO `houses` (`OwnerID`, `Created`, `Owned`, `Value`, `OutsideX`, `OutsideY`, `OutsideZ`, `OutsideA`, `InsideX`, `InsideY`, `InsideZ`, `InsideA`, `Interior`, `Tag`, `Level`)");
  483. format(query, sizeof(query), "%s VALUES(-1, 1, 0, %d, %f, %f, %f, %f, %f, %f, %f, %f, %d, 'House', 2)", query, price, X, Y, Z, A, HouseInfo[houseid][hInsideX], HouseInfo[houseid][hInsideY], HouseInfo[houseid][hInsideZ], HouseInfo[houseid][hInsideA], HouseInfo[houseid][hInterior]);
  484. mysql_tquery(sqlGameConnection, query, "sqlAddHouse", "i", houseid);
  485. }
  486. else return AdmErrorMsg;
  487. return 1;
  488. }
  489. CMD:deletehouse(playerid, params[])
  490. {
  491. if(PlayerInfo[playerid][pAdmin] >= 4 || PlayerInfo[playerid][pBizMod] == 1)
  492. {
  493. new houseid;
  494. if(sscanf(params, "ds[128]", houseid, str))
  495. {
  496. SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /deletehouse [houseid] [confirm]");
  497. return 1;
  498. }
  499. if(HouseInfo[houseid][hCreated] == 0) return SendClientMessage(playerid, COLOR_GRAD1, "That house has not even been created yet.");
  500. if(strcmp(str, "confirm", true) == 0)
  501. {
  502. foreach( new i: Player )
  503. {
  504. if(IsPlayerConnected(i))
  505. {
  506. if(PlayerInfo[i][pHouseID] == houseid)
  507. {
  508. SendClientMessage(i, COLOR_LIGHTBLUE, "* Your house has been deleted by an admin, you are no longer the owner.");
  509. PlayerInfo[i][pHouseID] = 0;
  510. }
  511. }
  512. }
  513. new query[100];
  514. format(query, sizeof(query), "DELETE FROM `houses` WHERE `HouseID` = %d", HouseInfo[houseid][hSQLID]);
  515. mysql_tquery(sqlGameConnection, query);
  516. format(str, sizeof(str), "You have fully deleted houseid %d.", houseid);
  517. SendClientMessage(playerid, COLOR_GRAD1, str);
  518. DeleteHouse(houseid);
  519. }
  520. else
  521. {
  522. SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /deletehouse [houseid] [confirm]");
  523. format(str, sizeof(str), "Are you sure you want to delete house id %d?", houseid);
  524. SendClientMessage(playerid, COLOR_GRAD2, str);
  525. return 1;
  526. }
  527. }
  528. else return AdmErrorMsg;
  529. return 1;
  530. }
  531. CMD:resethouse(playerid, params[])
  532. {
  533. if(PlayerInfo[playerid][pAdmin] >= 4 || PlayerInfo[playerid][pBizMod] == 1)
  534. {
  535. new houseid;
  536. if(sscanf(params, "ds[128]", houseid, str))return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /resethouse [houseid] [confirm]");
  537. if(HouseInfo[houseid][hCreated] == 0) return SendClientMessage(playerid, COLOR_GRAD1, "That house has not even been created yet! ");
  538. if(strcmp(str, "confirm", true) == 0)
  539. {
  540. foreach( new i: Player )
  541. {
  542. if(IsPlayerConnected(i))
  543. {
  544. if(PlayerInfo[i][pHouseID] == houseid)
  545. {
  546. SendClientMessage(i, COLOR_LIGHTBLUE, "* Your house has been reset by an admin, you are no longer the owner.");
  547. PlayerInfo[i][pHouseID] = 0;
  548. }
  549. }
  550. }
  551. SetHouseOnSale(houseid);
  552. format(str, sizeof(str), "You have reset houseid %d.", houseid);
  553. SendClientMessage(playerid, COLOR_GRAD1, str);
  554. return 1;
  555. }
  556. }
  557. else return AdmErrorMsg;
  558. return 1;
  559. }
  560. CMD:gotohouse(playerid, params[])
  561. {
  562. if(PlayerInfo[playerid][pAdmin] >= 4 || PlayerInfo[playerid][pBizMod] == 1)
  563. {
  564. new houseid;
  565. if(sscanf(params, "d", houseid)) return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /gotohouse [id]");
  566. if(HouseInfo[houseid][hCreated] == 0) return SendClientMessage(playerid, COLOR_GRAD1, "That house hasn't been created yet.");
  567. if(GetPlayerState(playerid) == PLAYER_STATE_SPECTATING)
  568. {
  569. SendClientMessage(playerid, COLOR_GREY, "You can not do that while spectating.");
  570. return 1;
  571. }
  572. SetPlayerPos(playerid, HouseInfo[houseid][hOutsideX], HouseInfo[houseid][hOutsideY], HouseInfo[houseid][hOutsideZ]);
  573. SetPlayerInterior(playerid, 0);
  574. PlayerInfo[playerid][pInt] = 0;
  575. SetPlayerVirtualWorld(playerid, 0);
  576. PlayerInfo[playerid][pVirtualWorld] = 0;
  577. format(str, sizeof(str), "~w~Teleporting to ~b~\"%s\"~w~.", HouseInfo[houseid][hTag]);
  578. displayCenterHUDInfo(playerid, str, 8); //display for 8 seconds
  579. }
  580. else
  581. {
  582. AdmErrorMsg;
  583. }
  584. return 1;
  585. }
  586. CMD:gotohousesqlid(playerid, params[])
  587. {
  588. if(PlayerInfo[playerid][pAdmin] >= 4 || PlayerInfo[playerid][pBizMod] == 1)
  589. {
  590. new houseid;
  591. if(sscanf(params, "d", houseid))
  592. return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /gotohousesqlid [post code/SQL ID]");
  593. houseid = GetHouseIDFromSQLID(houseid);
  594. if(HouseInfo[houseid][hCreated] == 0)
  595. return SendClientMessage(playerid, COLOR_GRAD1, "That house hasn't been created yet.");
  596. if(GetPlayerState(playerid) == PLAYER_STATE_SPECTATING)
  597. return SendClientMessage(playerid, COLOR_GREY, "You can not do that while spectating.");
  598. SetPlayerPos(playerid, HouseInfo[houseid][hOutsideX], HouseInfo[houseid][hOutsideY], HouseInfo[houseid][hOutsideZ]);
  599. SetPlayerInterior(playerid, 0);
  600. PlayerInfo[playerid][pInt] = 0;
  601. SetPlayerVirtualWorld(playerid, 0);
  602. PlayerInfo[playerid][pVirtualWorld] = 0;
  603. format(str, sizeof(str), "~w~Teleporting to ~b~\"%s\"~w~.", HouseInfo[houseid][hTag]);
  604. displayCenterHUDInfo(playerid, str, 8); //display for 8 seconds
  605. }
  606. else
  607. {
  608. AdmErrorMsg;
  609. }
  610. return 1;
  611. }
  612. CMD:asethousetag(playerid, params[])
  613. {
  614. if(PlayerInfo[playerid][pAdmin] >= 4 || PlayerInfo[playerid][pBizMod] == 1)
  615. {
  616. new houseid;
  617. if(sscanf(params, "ds[128]", houseid, tmp)) return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /asethousetag [House ID] [New Tag]");
  618. if(HouseInfo[houseid][hCreated] == 0) return SendClientMessage(playerid, COLOR_GRAD1, "That house hasn't been created yet.");
  619. if(HouseInfo[houseid][hOwned] == 0) return SendClientMessage(playerid, COLOR_GRAD1, "That house isn't owned yet.");
  620. if(strlen(tmp) < 4 || strlen(tmp) > 25) return SendClientMessage(playerid, COLOR_GRAD1, "The tag must be greater than 4 and lesser than 26.");
  621. strdel(HouseInfo[houseid][hTag], 0, 25);
  622. strmid(HouseInfo[houseid][hTag], tmp, 0, sizeof(tmp), 25);
  623. SetHouseTag(houseid);
  624. format(str, sizeof(str), "That house's tag has been set to \"%s\"", HouseInfo[houseid][hTag]);
  625. SendClientMessage(playerid, COLOR_GRAD1, str);
  626. HouseInfo[houseid][hModified] = 1;
  627. }
  628. else
  629. {
  630. AdmErrorMsg;
  631. }
  632. return 1;
  633. }
  634. CMD:ogethouseowner(playerid, params[])
  635. {
  636. if(PlayerInfo[playerid][pAdmin] < 1 && PlayerInfo[playerid][pBizMod] != 1)
  637. return AdmErrorMsg;
  638. new name[MAX_PLAYER_NAME + 1];
  639. if(sscanf(params, "s[25]", name))
  640. return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /ogethouseowner [full name (case matters)]");
  641. new query[300];
  642. mysql_format(sqlGameConnection, query, sizeof(query), "SELECT HouseID FROM houses INNER JOIN players ON houses.OwnerID = players.ID WHERE players.Name = '%e' LIMIT 1", name);
  643. mysql_tquery(sqlGameConnection, query, "Onogethouseowner", "is", playerid, name);
  644. return 1;
  645. }
  646. forward Onogethouseowner(playerid, name[]);
  647. public Onogethouseowner(playerid, name[])
  648. {
  649. if(cache_num_rows() != 0)
  650. {
  651. new
  652. ownerstr[128], sqlid = cache_get_field_content_int(0, "HouseID");
  653. format(ownerstr, 128, "Owner: %s, SQL house ID/post code: %d", name, sqlid);
  654. SendClientMessage(playerid, COLOR_GREY, ownerstr);
  655. return 1;
  656. }
  657. SendClientMessage(playerid, COLOR_GREY, "That player doesn't own a house.");
  658. return 1;
  659. }
  660. forward SetHouseOnSale(houseid);
  661. public SetHouseOnSale(houseid)
  662. {
  663. HouseInfo[houseid][hOwned] = 0;
  664. HouseInfo[houseid][hLocked] = 0;
  665. HouseInfo[houseid][hCash] = 0;
  666. HouseInfo[houseid][hMaterials] = 0;
  667. HouseInfo[houseid][hCannabis] = 0;
  668. HouseInfo[houseid][hCocaine] = 0;
  669. HouseInfo[houseid][hMeth] = 0;
  670. HouseInfo[houseid][hAlarm] = 0;
  671. HouseInfo[houseid][hAlarmStatus] = 0;
  672. HouseInfo[houseid][hGun1] = 0;
  673. HouseInfo[houseid][hGun2] = 0;
  674. HouseInfo[houseid][hGun3] = 0;
  675. HouseInfo[houseid][hGun4] = 0;
  676. HouseInfo[houseid][hGun5] = 0;
  677. HouseInfo[houseid][hGun6] = 0;
  678. HouseInfo[houseid][hGun7] = 0;
  679. HouseInfo[houseid][hOwnerID] = -1;
  680. // if the value is less than 1m, set it to 1.5m
  681. // this must be before SetHouseTag so we can assure it displays the correct price
  682. if(HouseInfo[houseid][hValue] < 100000) HouseInfo[houseid][hValue] = 1500000;
  683. strdel(HouseInfo[houseid][hTag], 0, strlen(HouseInfo[houseid][hTag]));
  684. strins(HouseInfo[houseid][hTag], "House", 0);
  685. SetHouseTag(houseid);
  686. ClearHouseFurniture(houseid);
  687. HouseInfo[houseid][hHasFurniture] = 0;
  688. HouseInfo[houseid][hModified] = 1;
  689. return 1;
  690. }
  691. CMD:houseinfo(playerid, params[])
  692. {
  693. if(PlayerInfo[playerid][pAdmin] >= 1 || PlayerInfo[playerid][pBizMod] == 1)
  694. {
  695. for(new i = 0; i < MAX_HOUSES; i++)
  696. {
  697. if(HouseInfo[i][hCreated] == 1)
  698. {
  699. if(IsPlayerInRangeOfPoint(playerid, 1.0, HouseInfo[i][hOutsideX], HouseInfo[i][hOutsideY], HouseInfo[i][hOutsideZ]))
  700. {
  701. format(str, sizeof(str), "Owner: %s, ID: %d, Owner SQL ID: %d", HouseInfo[i][hOwner], i, HouseInfo[i][hOwnerID]);
  702. SendClientMessage(playerid, COLOR_GRAD1, str);
  703. new bool:gates = false;
  704. for(new gt =1; gt <MAX_GATES; gt++)
  705. {
  706. if(Gates[gt][GateCreated] == 1)
  707. {
  708. if(Gates[gt][GateHouseID] == HouseInfo[i][hSQLID])
  709. {
  710. format(str, sizeof(str), "Gate ID: %d", gt);
  711. SendClientMessage(playerid, COLOR_GRAD1, str);
  712. gates = true;
  713. }
  714. }
  715. }
  716. if(gates == false) SendClientMessage(playerid, COLOR_GRAD1, "There is no gates connected to this house.");
  717. return 1;
  718. }
  719. }
  720. }
  721. }
  722. return 1;
  723. }
  724. CMD:edithouse(playerid, params[])
  725. {
  726. if(PlayerInfo[playerid][pAdmin] >= 4 || PlayerInfo[playerid][pBizMod] == 1)
  727. {
  728. new tmp2[128];
  729. new houseid;
  730. if(sscanf(params, "s[128] ", tmp))
  731. {
  732. SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /edithouse [action] [houseid]");
  733. SendClientMessage(playerid, COLOR_GRAD2, "ACTIONS: entrance, interior, value, freeze, exit");
  734. return 1;
  735. }
  736. if(strcmp(tmp, "entrance", true) == 0)
  737. {
  738. if(sscanf(params, "s[8] d", tmp2, houseid))
  739. {
  740. SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /edithouse entrance [houseid]");
  741. return 1;
  742. }
  743. new Float:X, Float:Y, Float:Z, Float:A;
  744. GetPlayerPos(playerid, X, Y, Z);
  745. GetPlayerFacingAngle(playerid, A);
  746. if(HouseInfo[houseid][hCreated] == 0) return SendClientMessage(playerid, COLOR_GRAD1, "That house has not even been created yet.");
  747. HouseInfo[houseid][hOutsideX] = X;
  748. HouseInfo[houseid][hOutsideY] = Y;
  749. HouseInfo[houseid][hOutsideZ] = Z;
  750. HouseInfo[houseid][hOutsideA] = A;
  751. if(HouseInfo[houseid][hOutsidePickup])
  752. {
  753. DestroyDynamicPickup(HouseInfo[houseid][hOutsidePickup]);
  754. }
  755. HouseInfo[houseid][hOutsidePickup] = CreateDynamicPickup(1273, 1, HouseInfo[houseid][hOutsideX], HouseInfo[houseid][hOutsideY], HouseInfo[houseid][hOutsideZ]);
  756. DestroyDynamic3DTextLabel(HouseInfoText3D[houseid]);
  757. HouseInfoText3D[houseid] = CreateDynamic3DTextLabel("", COLOR_HOUSETEXT, HouseInfo[houseid][hOutsideX], HouseInfo[houseid][hOutsideY], HouseInfo[houseid][hOutsideZ] +0.88, 20.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 1, -1, -1, -1, 100);
  758. SetHouseTag(houseid);
  759. format(str, sizeof(str), "You have moved houseid %d's entrance.", houseid);
  760. SendClientMessage(playerid, COLOR_GRAD1, str);
  761. HouseInfo[houseid][hModified] = 1;
  762. return 1;
  763. }
  764. else if(strcmp(tmp, "interior", true) == 0)
  765. {
  766. new interiorid;
  767. if(sscanf(params, "s[128] dd", tmp2, houseid, interiorid))
  768. {
  769. SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /edithouse interior [houseid] [interiorid]");
  770. format(str, sizeof(str), "{00BFFF}Usage:{FFFFFF} /viewhouseint [0-%d] or /gotoint", MAX_HOUSE_INTERIORS);
  771. SendClientMessage(playerid, COLOR_GRAD2, str);
  772. return 1;
  773. }
  774. if(HouseInfo[houseid][hCreated] == 0) return SendClientMessage(playerid, COLOR_GRAD1, "That house has not even been created yet.");
  775. if(interiorid < 0 || interiorid > MAX_HOUSE_INTERIORS)
  776. {
  777. format(str, sizeof(str), "Number can't be below 0 or above %d.", MAX_HOUSE_INTERIORS);
  778. SendClientMessage(playerid, COLOR_GREY, str);
  779. return 1;
  780. }
  781. SetHouseInterior(houseid, interiorid);
  782. format(str, sizeof(str), "You have edited houseid %d's interiorid to %d.", houseid, interiorid);
  783. SendClientMessage(playerid, COLOR_GRAD1, str);
  784. HouseInfo[houseid][hModified] = 1;
  785. return 1;
  786. }
  787. else if(strcmp(tmp, "value", true) == 0)
  788. {
  789. new value;
  790. if(sscanf(params, "s[128] dd", tmp2, houseid, value))
  791. {
  792. SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /edithouse value [houseid] [new value]");
  793. return 1;
  794. }
  795. if(HouseInfo[houseid][hCreated] == 0) return SendClientMessage(playerid, COLOR_GRAD1, "That house has not even been created yet.");
  796. if(value < 0) return SendClientMessage(playerid, COLOR_GRAD1, "You can't set a house price lower than 0!");
  797. HouseInfo[houseid][hValue] = value;
  798. SetHouseTag(houseid);
  799. format(str, sizeof(str), "You have edited houseid %d's value to $%d.", houseid, value);
  800. SendClientMessage(playerid, COLOR_GRAD1, str);
  801. HouseInfo[houseid][hModified] = 1;
  802. return 1;
  803. }
  804. else if(strcmp(tmp, "freeze", true) == 0)
  805. {
  806. new frozen;
  807. if(sscanf(params, "s[128] dd", tmp2, houseid, frozen))
  808. {
  809. SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /edithouse freeze [houseid] [1/0]");
  810. return 1;
  811. }
  812. if(HouseInfo[houseid][hCreated] == 0) return SendClientMessage(playerid, COLOR_GRAD1, "That house has not even been created yet.");
  813. HouseInfo[houseid][hFreeze] = frozen;
  814. format(str, sizeof(str), "You have set houseid %d's frozen to %d.", houseid, frozen);
  815. SendClientMessage(playerid, COLOR_GRAD1, str);
  816. HouseInfo[houseid][hModified] = 1;
  817. return 1;
  818. }
  819. else if(strcmp(tmp, "exit", true) == 0)
  820. {
  821. if(sscanf(params, "s[8] d", tmp2, houseid))
  822. {
  823. SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /edithouse exit [houseid]");
  824. return 1;
  825. }
  826. new Float:X, Float:Y, Float:Z, Float:A;
  827. GetPlayerPos(playerid, X, Y, Z);
  828. GetPlayerFacingAngle(playerid, A);
  829. if(HouseInfo[houseid][hCreated] == 0) return SendClientMessage(playerid, COLOR_GRAD1, "That house has not even been created yet.");
  830. HouseInfo[houseid][hInsideX] = X;
  831. HouseInfo[houseid][hInsideY] = Y;
  832. HouseInfo[houseid][hInsideZ] = Z;
  833. HouseInfo[houseid][hInsideA] = A;
  834. format(str, sizeof(str), "You have moved houseid %d's exit position.", houseid);
  835. SendClientMessage(playerid, COLOR_GRAD1, str);
  836. HouseInfo[houseid][hModified] = 1;
  837. return 1;
  838. }
  839. else
  840. {
  841. format(str, sizeof(str), "Invalid action \"%s\".", tmp);
  842. SendClientMessage(playerid, COLOR_GRAD1, str);
  843. return 1;
  844. }
  845. }
  846. else
  847. {
  848. AdmErrorMsg;
  849. }
  850. return 1;
  851. }
  852. CMD:viewhouseint(playerid, params[])
  853. {
  854. if(PlayerInfo[playerid][pAdmin] >=4 || PlayerInfo[playerid][pBizMod] == 1 || PlayerInfo[playerid][pDev] > 1)
  855. {
  856. new interiorid;
  857. if(sscanf(params, "i", interiorid)) {
  858. format(str, sizeof(str), "{00BFFF}Usage:{FFFFFF} /viewhouseint [0-%d]", MAX_HOUSE_INTERIORS);
  859. SendClientMessage(playerid, COLOR_GREY, str);
  860. return 1;
  861. }
  862. if(interiorid < 0 || interiorid > MAX_HOUSE_INTERIORS - 1)
  863. {
  864. format(str, sizeof(str), "Number can't be below 0 or above %d.", MAX_HOUSE_INTERIORS);
  865. SendClientMessage(playerid, COLOR_GREY, str);
  866. return 1;
  867. }
  868. SetPlayerInHouseInterior(playerid, interiorid);
  869. }
  870. return 1;
  871. }
  872. //=============================[ Player Commands ]==============================
  873. CMD:sellhousetomarket(playerid, params[])
  874. {
  875. //Conditions
  876. if(PlayerInfo[playerid][pHouseID] == 0)
  877. return SendClientMessage(playerid, COLOR_GRAD1, "You do not own a house to sell.");
  878. if(HouseFiresRemaining[PlayerInfo[playerid][pHouseID]] > 0)
  879. return SendClientMessage(playerid, COLOR_GRAD1, "You cannot sell your house while its on fire!");
  880. new
  881. houseid = PlayerInfo[playerid][pHouseID], location[60],
  882. value = HouseInfo[houseid][hValue] / 4;
  883. Get2DZone(location, MAX_ZONE_NAME, HouseInfo[houseid][hOutsideX], HouseInfo[houseid][hOutsideY], HouseInfo[houseid][hOutsideZ]);
  884. if(sscanf(params, "s[128]", str))
  885. {
  886. format(str, sizeof(str), "Your property is currently worth {FFFF00}$%d{FAFAFA}, type {FF0000}/sellhousetomarket confirm{FAFAFA} to sell {FFFF00}%d %s.", value, houseid, location);
  887. return SendClientMessage(playerid, COLOR_WHITE, str);
  888. }
  889. //Sell the house
  890. if(strcmp(str, "confirm", true) == 0)
  891. {
  892. GiveMoney(playerid, value);
  893. HouseInfo[houseid][hOwned] = 0;
  894. HouseInfo[houseid][hLocked] = 0;
  895. HouseInfo[houseid][hCash] = 0;
  896. HouseInfo[houseid][hMaterials] = 0;
  897. HouseInfo[houseid][hCannabis] = 0;
  898. HouseInfo[houseid][hCocaine] = 0;
  899. HouseInfo[houseid][hMeth] = 0;
  900. HouseInfo[houseid][hAlarm] = 0;
  901. HouseInfo[houseid][hAlarmStatus] = 0;
  902. HouseInfo[houseid][hGun1] = 0;
  903. HouseInfo[houseid][hGun2] = 0;
  904. HouseInfo[houseid][hGun3] = 0;
  905. HouseInfo[houseid][hGun4] = 0;
  906. HouseInfo[houseid][hGun5] = 0;
  907. HouseInfo[houseid][hGun6] = 0;
  908. HouseInfo[houseid][hGun7] = 0;
  909. HouseInfo[houseid][hOwnerID] = -1;
  910. format(HouseInfo[houseid][hOwner], 24, "Nobody");
  911. PlayerInfo[playerid][pHouseID] = 0;
  912. format(str, sizeof(str), "Congratulations, you have sold {FFFF00}%d %s{FAFAFA} for $%d.", houseid, location, value);
  913. SendClientMessage(playerid, COLOR_WHITE, str);
  914. strdel(HouseInfo[houseid][hTag], 0, strlen(HouseInfo[houseid][hTag]));
  915. strins(HouseInfo[houseid][hTag], "House", 0);
  916. DestroyDynamicPickup(HouseInfo[houseid][hOutsidePickup]);
  917. HouseInfo[houseid][hOutsidePickup] = CreateDynamicPickup(HOUSE_UNOWNED, 1, HouseInfo[houseid][hOutsideX], HouseInfo[houseid][hOutsideY], HouseInfo[houseid][hOutsideZ]);
  918. SetHouseTag(houseid);
  919. HouseInfo[houseid][hModified] = 1;
  920. }
  921. else
  922. {
  923. format(str, sizeof(str), "Your property is currently worth {FFFF00}$%d{FAFAFA}, type {FF0000}/sellhousetomarket confirm{FAFAFA} to sell {FFFF00}%d %s.", value, houseid, location);
  924. SendClientMessage(playerid, COLOR_WHITE, str);
  925. }
  926. return 1;
  927. }
  928. CMD:sethousetag(playerid, params[])
  929. {
  930. if(PlayerInfo[playerid][pHouseID] == 0) return SendClientMessage(playerid, COLOR_GRAD1, "You do not own a house.");
  931. new houseid = PlayerInfo[playerid][pHouseID];
  932. if(sscanf(params, "s[128]", str)) return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /sethousetag [Text]");
  933. if(strlen(str) < 4 || strlen(str) > 25) return SendClientMessage(playerid, COLOR_GRAD1, "The tag must be greater than 4 and lesser than 26.");
  934. if(!AlphaNumeric(tmp))
  935. {
  936. SendClientMessage(playerid, COLOR_RED, "** Invalid characters.");
  937. return 1;
  938. }
  939. strdel(HouseInfo[houseid][hTag], 0, 25);
  940. strmid(HouseInfo[houseid][hTag], str, 0, sizeof(str), 25);
  941. SetHouseTag(houseid);
  942. format(str, sizeof(str), "Your house's tag has been set to \"%s\"", HouseInfo[houseid][hTag]);
  943. SendClientMessage(playerid, COLOR_GRAD1, str);
  944. HouseInfo[houseid][hModified] = 1;
  945. return 1;
  946. }
  947. CMD:house(playerid, params[])
  948. {
  949. if(PlayerInfo[playerid][pHouseID] == 0) return SendClientMessage(playerid, COLOR_GRAD1, "You do not own a house.");
  950. new houseid = PlayerInfo[playerid][pHouseID];
  951. if(HouseInfo[houseid][hOwnerID] != PlayerInfo[playerid][pID])
  952. return SendClientMessage(playerid, COLOR_GREY, "You don't own this house.");
  953. if(!IsPlayerInRangeOfPoint(playerid, 100.0, HouseInfo[houseid][hInsideX], HouseInfo[houseid][hInsideY], HouseInfo[houseid][hInsideZ]) || GetPlayerVirtualWorld(playerid) != HouseInfo[houseid][hSQLID])
  954. {
  955. SendClientMessage(playerid, COLOR_GRAD1, "You are not inside your house.");
  956. return 1;
  957. }
  958. new action[2][32];
  959. if(sscanf(params, "s[32] ", action[0]))
  960. {
  961. SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /house [action]");
  962. SendClientMessage(playerid, COLOR_GRAD2, "ACTIONS: store, get, check.");
  963. return 1;
  964. }
  965. if(strcmp(action[0], "store", true) == 0)
  966. {
  967. if(sscanf(params, "s[32] s[32] ", action[0], action[1]))
  968. {
  969. SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /house store [item]");
  970. SendClientMessage(playerid, COLOR_GRAD2, "Items: gun, cash, materials, cannabis, cocaine, meth, xanax, promethazine, codeine, lean");
  971. return 1;
  972. }
  973. if(strcmp(action[1], "gun", true) == 0)
  974. {
  975. if(GetPlayerSpecialAction(playerid) == SPECIAL_ACTION_USEJETPACK) return SendClientMessage(playerid, COLOR_GREY, "You cannot use this at this time");
  976. if(IsACop(playerid) == 1 || IsANG(playerid) == 1 || IsAMedic(playerid) == 1 || IsASenate(playerid) || PlayerInfo[playerid][pMember] == 10 || PlayerInfo[playerid][pMember] == 9 || PlayerInfo[playerid][pMember] == FACTION_SANG)
  977. return SendClientMessage(playerid, COLOR_GRAD1, "Cops/DEA/SANG/SAN/Taxi Company can not use this command.");
  978. new weaponid = GetPlayerWeapon(playerid);
  979. if(HaveWeapon(playerid, weaponid) == weaponid && (weaponid == 22 || weaponid == 24 || weaponid == 25 || weaponid == 27 || weaponid == 29 || weaponid == 31 || weaponid == 30 || weaponid == 33 || weaponid == 34 || weaponid == 28 || weaponid == 32 || weaponid == 26 || weaponid == 4))
  980. {
  981. new weaponname[64];
  982. GetWeaponName(weaponid, weaponname, 64);
  983. if(HouseInfo[houseid][hGun1] == 0)
  984. {
  985. if(PlayerInfo[playerid][pMask] == 0)
  986. {
  987. // The str only gets sent if the player does NOT have a mask on due to the fact someone could reveal a hitman by knowing the owner of the house
  988. format(str, sizeof(str), "* %s stores a %s into their safe.", PlayerICName(playerid), weaponname);
  989. ProxDetector(30.0, playerid, str, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
  990. }
  991. format(str, sizeof(str), "* You have stored a %s.", weaponname);
  992. SendClientMessage(playerid, COLOR_LIGHTBLUE, str);
  993. HouseInfo[houseid][hGun1] = weaponid;
  994. TakePlayerWeapon(playerid, weaponid);
  995. SetPlayerArmedWeapon(playerid, 0);
  996. HouseInfo[houseid][hModified] = 1;
  997. return 1;
  998. }
  999. else if(HouseInfo[houseid][hGun2] == 0)
  1000. {
  1001. if(PlayerInfo[playerid][pMask] == 0)
  1002. {
  1003. // The str only gets sent if the player does NOT have a mask on due to the fact someone could reveal a hitman by knowing the owner of the house
  1004. format(str, sizeof(str), "* %s stores a %s into their safe.", PlayerICName(playerid), weaponname);
  1005. ProxDetector(30.0, playerid, str, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
  1006. }
  1007. format(str, sizeof(str), "* You have stored a %s.", weaponname);
  1008. SendClientMessage(playerid, COLOR_LIGHTBLUE, str);
  1009. HouseInfo[houseid][hGun2] = weaponid;
  1010. TakePlayerWeapon(playerid, weaponid);
  1011. SetPlayerArmedWeapon(playerid, 0);
  1012. HouseInfo[houseid][hModified] = 1;
  1013. return 1;
  1014. }
  1015. else if(HouseInfo[houseid][hGun3] == 0)
  1016. {
  1017. if(PlayerInfo[playerid][pMask] == 0)
  1018. {
  1019. // The str only gets sent if the player does NOT have a mask on due to the fact someone could reveal a hitman by knowing the owner of the house
  1020. format(str, sizeof(str), "* %s stores a %s into their safe.", PlayerICName(playerid), weaponname);
  1021. ProxDetector(30.0, playerid, str, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
  1022. }
  1023. format(str, sizeof(str), "* You have stored a %s.", weaponname);
  1024. SendClientMessage(playerid, COLOR_LIGHTBLUE, str);
  1025. HouseInfo[houseid][hGun3] = weaponid;
  1026. TakePlayerWeapon(playerid, weaponid);
  1027. SetPlayerArmedWeapon(playerid, 0);
  1028. HouseInfo[houseid][hModified] = 1;
  1029. return 1;
  1030. }
  1031. else if(HouseInfo[houseid][hGun4] == 0)
  1032. {
  1033. if(PlayerInfo[playerid][pMask] == 0)
  1034. {
  1035. // The str only gets sent if the player does NOT have a mask on due to the fact someone could reveal a hitman by knowing the owner of the house
  1036. format(str, sizeof(str), "* %s stores a %s into their safe.", PlayerICName(playerid), weaponname);
  1037. ProxDetector(30.0, playerid, str, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
  1038. }
  1039. format(str, sizeof(str), "* You have stored a %s.", weaponname);
  1040. SendClientMessage(playerid, COLOR_LIGHTBLUE, str);
  1041. HouseInfo[houseid][hGun4] = weaponid;
  1042. TakePlayerWeapon(playerid, weaponid);
  1043. SetPlayerArmedWeapon(playerid, 0);
  1044. HouseInfo[houseid][hModified] = 1;
  1045. return 1;
  1046. }
  1047. else if(HouseInfo[houseid][hGun5] == 0)
  1048. {
  1049. if(PlayerInfo[playerid][pMask] == 0)
  1050. {
  1051. // The str only gets sent if the player does NOT have a mask on due to the fact someone could reveal a hitman by knowing the owner of the house
  1052. format(str, sizeof(str), "* %s stores a %s into their safe.", PlayerICName(playerid), weaponname);
  1053. ProxDetector(30.0, playerid, str, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
  1054. }
  1055. format(str, sizeof(str), "* You have stored a %s.", weaponname);
  1056. SendClientMessage(playerid, COLOR_LIGHTBLUE, str);
  1057. HouseInfo[houseid][hGun5] = weaponid;
  1058. TakePlayerWeapon(playerid, weaponid);
  1059. SetPlayerArmedWeapon(playerid, 0);
  1060. HouseInfo[houseid][hModified] = 1;
  1061. return 1;
  1062. }
  1063. else if(HouseInfo[houseid][hGun6] == 0)
  1064. {
  1065. if(PlayerInfo[playerid][pMask] == 0)
  1066. {
  1067. // The str only gets sent if the player does NOT have a mask on due to the fact someone could reveal a hitman by knowing the owner of the house
  1068. format(str, sizeof(str), "* %s stores a %s into their safe.", PlayerICName(playerid), weaponname);
  1069. ProxDetector(30.0, playerid, str, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
  1070. }
  1071. format(str, sizeof(str), "* You have stored a %s.", weaponname);
  1072. SendClientMessage(playerid, COLOR_LIGHTBLUE, str);
  1073. HouseInfo[houseid][hGun6] = weaponid;
  1074. TakePlayerWeapon(playerid, weaponid);
  1075. SetPlayerArmedWeapon(playerid, 0);
  1076. HouseInfo[houseid][hModified] = 1;
  1077. return 1;
  1078. }
  1079. else if(HouseInfo[houseid][hGun7] == 0)
  1080. {
  1081. if(PlayerInfo[playerid][pMask] == 0)
  1082. {
  1083. // The str only gets sent if the player does NOT have a mask on due to the fact someone could reveal a hitman by knowing the owner of the house
  1084. format(str, sizeof(str), "* %s stores a %s into their safe.", PlayerICName(playerid), weaponname);
  1085. ProxDetector(30.0, playerid, str, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
  1086. }
  1087. format(str, sizeof(str), "* You have stored a %s.", weaponname);
  1088. SendClientMessage(playerid, COLOR_LIGHTBLUE, str);
  1089. HouseInfo[houseid][hGun7] = weaponid;
  1090. TakePlayerWeapon(playerid, weaponid);
  1091. SetPlayerArmedWeapon(playerid, 0);
  1092. HouseInfo[houseid][hModified] = 1;
  1093. return 1;
  1094. }
  1095. else
  1096. {
  1097. SendClientMessage(playerid, COLOR_GRAD1, "None of your gun slots are empty.");
  1098. }
  1099. return 1;
  1100. }
  1101. else
  1102. {
  1103. SendClientMessage(playerid, COLOR_GRAD1, "You can not store this.");
  1104. }
  1105. }
  1106. if(strcmp(action[1], "cannabis", true) == 0 || strcmp(action[1], "weed", true) == 0)
  1107. {
  1108. new cannabisam = 0;
  1109. if(sscanf(params, "s[32] s[32] d", action[0], action[1], cannabisam)) return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /house store cannabis [amount]");
  1110. if(cannabisam < 1 || cannabisam > 15000) return SendClientMessage(playerid, COLOR_GRAD1, "Invalid amount.");
  1111. if(cannabisam > PlayerInfo[playerid][pCannabis]) return SendClientMessage(playerid, COLOR_GRAD1, "You don't have that much cannabis.");
  1112. if(HouseInfo[houseid][hCannabis] +cannabisam > 15000) return SendClientMessage(playerid, COLOR_GRAD1, "Your safe is at or greater than it's cannabis limit.");
  1113. HouseInfo[houseid][hCannabis] += cannabisam;
  1114. PlayerInfo[playerid][pCannabis] -= cannabisam;
  1115. if(PlayerInfo[playerid][pMask] == 0)
  1116. {
  1117. format(str, sizeof(str), "* %s takes out some cannabis and puts it into their safe.", PlayerICName(playerid));
  1118. ProxDetector(30.0, playerid, str, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
  1119. }
  1120. format(str, sizeof(str), "* You have stored %d cannabis into your safe.", cannabisam);
  1121. SendClientMessage(playerid, COLOR_LIGHTBLUE, str);
  1122. HouseInfo[houseid][hModified] = 1;
  1123. }
  1124. if(strcmp(action[1], "cocaine", true) == 0)
  1125. {
  1126. new cokeam = 0;
  1127. if(sscanf(params, "s[32] s[32] d", action[0], action[1], cokeam)) return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /house store cocaine [amount]");
  1128. if(cokeam < 1 || cokeam > 15000) return SendClientMessage(playerid, COLOR_GRAD1, "Invalid amount.");
  1129. if(cokeam > PlayerInfo[playerid][pCocaine]) return SendClientMessage(playerid, COLOR_GRAD1, "You don't have that much cocaine.");
  1130. if(HouseInfo[houseid][hCocaine] +cokeam > 15000) return SendClientMessage(playerid, COLOR_GRAD1, "Your safe is at or greater than it's cocaine limit.");
  1131. HouseInfo[houseid][hCocaine] += cokeam;
  1132. PlayerInfo[playerid][pCocaine] -= cokeam;
  1133. if(PlayerInfo[playerid][pMask] == 0)
  1134. {
  1135. // The str only gets sent if the player does NOT have a mask on due to the fact someone could reveal a hitman by knowing the owner of the house
  1136. format(str, sizeof(str), "* %s takes out some cocaine and puts it into their safe.", PlayerICName(playerid));
  1137. ProxDetector(30.0, playerid, str, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
  1138. }
  1139. format(str, sizeof(str), "* You have stored %d cocaine into your safe.", cokeam);
  1140. SendClientMessage(playerid, COLOR_LIGHTBLUE, str);
  1141. HouseInfo[houseid][hModified] = 1;
  1142. }
  1143. if(strcmp(action[1], "meth", true) == 0)
  1144. {
  1145. new metham = 0;
  1146. if(sscanf(params, "s[32] s[32] d", action[0], action[1], metham)) return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /house store meth [amount]");
  1147. if(metham < 1 || metham > 15000) return SendClientMessage(playerid, COLOR_GRAD1, "Invalid amount.");
  1148. if(metham > PlayerInfo[playerid][pMeth]) return SendClientMessage(playerid, COLOR_GRAD1, "You don't have that much meth.");
  1149. if(HouseInfo[houseid][hMeth] + metham > 15000) return SendClientMessage(playerid, COLOR_GRAD1, "Your safe is at or greater than it's meth limit.");
  1150. HouseInfo[houseid][hMeth] += metham;
  1151. PlayerInfo[playerid][pMeth] -= metham;
  1152. if(PlayerInfo[playerid][pMask] == 0)
  1153. {
  1154. // The str only gets sent if the player does NOT have a mask on due to the fact someone could reveal a hitman by knowing the owner of the house
  1155. format(str, sizeof(str), "* %s takes out some meth and puts it into their safe.", PlayerICName(playerid));
  1156. ProxDetector(30.0, playerid, str, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
  1157. }
  1158. format(str, sizeof(str), "* You have stored %d meth into your safe.", metham);
  1159. SendClientMessage(playerid, COLOR_LIGHTBLUE, str);
  1160. HouseInfo[houseid][hModified] = 1;
  1161. }
  1162. if(strcmp(action[1], "xanax", true) == 0)
  1163. {
  1164. new xanam = 0;
  1165. if(sscanf(params, "s[32] s[32] d", action[0], action[1], xanam)) return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /house store xanax [amount]");
  1166. if(xanam < 1 || xanam > 15000) return SendClientMessage(playerid, COLOR_GRAD1, "Invalid amount.");
  1167. if(xanam > PlayerInfo[playerid][pXanax]) return SendClientMessage(playerid, COLOR_GRAD1, "You don't have that much xanax.");
  1168. if(HouseInfo[houseid][hXanax] + xanam > 15000) return SendClientMessage(playerid, COLOR_GRAD1, "Your safe is at or greater than it's xanax limit.");
  1169. HouseInfo[houseid][hXanax] += xanam;
  1170. PlayerInfo[playerid][pXanax] -= xanam;
  1171. if(PlayerInfo[playerid][pMask] == 0)
  1172. {
  1173. // The str only gets sent if the player does NOT have a mask on due to the fact someone could reveal a hitman by knowing the owner of the house
  1174. format(str, sizeof(str), "* %s takes out some xanax and puts it into their safe.", PlayerICName(playerid));
  1175. ProxDetector(30.0, playerid, str, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
  1176. }
  1177. format(str, sizeof(str), "* You have stored %d xanax into your safe.", xanam);
  1178. SendClientMessage(playerid, COLOR_LIGHTBLUE, str);
  1179. HouseInfo[houseid][hModified] = 1;
  1180. }
  1181. if(strcmp(action[1], "promethazine", true) == 0)
  1182. {
  1183. new prometham = 0;
  1184. if(sscanf(params, "s[32] s[32] d", action[0], action[1], prometham)) return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /house store promethazine [amount]");
  1185. if(prometham < 1 || prometham > 15000) return SendClientMessage(playerid, COLOR_GRAD1, "Invalid amount.");
  1186. if(prometham > PlayerInfo[playerid][pPromethazine]) return SendClientMessage(playerid, COLOR_GRAD1, "You don't have that much promethazine.");
  1187. if(HouseInfo[houseid][hPromethazine] + prometham > 15000) return SendClientMessage(playerid, COLOR_GRAD1, "Your safe is at or greater than it's promethazine limit.");
  1188. HouseInfo[houseid][hPromethazine] += prometham;
  1189. PlayerInfo[playerid][pPromethazine] -= prometham;
  1190. if(PlayerInfo[playerid][pMask] == 0)
  1191. {
  1192. // The str only gets sent if the player does NOT have a mask on due to the fact someone could reveal a hitman by knowing the owner of the house
  1193. format(str, sizeof(str), "* %s takes out some promethazine and puts it into their safe.", PlayerICName(playerid));
  1194. ProxDetector(30.0, playerid, str, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
  1195. }
  1196. format(str, sizeof(str), "* You have stored %d promethazine into your safe.", prometham);
  1197. SendClientMessage(playerid, COLOR_LIGHTBLUE, str);
  1198. HouseInfo[houseid][hModified] = 1;
  1199. }
  1200. if(strcmp(action[1], "codeine", true) == 0)
  1201. {
  1202. new codeineam = 0;
  1203. if(sscanf(params, "s[32] s[32] d", action[0], action[1], codeineam)) return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /house store codeine [amount]");
  1204. if(codeineam < 1 || codeineam > 15000) return SendClientMessage(playerid, COLOR_GRAD1, "Invalid amount.");
  1205. if(codeineam > PlayerInfo[playerid][pCodeine]) return SendClientMessage(playerid, COLOR_GRAD1, "You don't have that much codeine.");
  1206. if(HouseInfo[houseid][hCodeine] + codeineam > 15000) return SendClientMessage(playerid, COLOR_GRAD1, "Your safe is at or greater than it's codeine limit.");
  1207. HouseInfo[houseid][hCodeine] += codeineam;
  1208. PlayerInfo[playerid][pCodeine] -= codeineam;
  1209. if(PlayerInfo[playerid][pMask] == 0)
  1210. {
  1211. // The str only gets sent if the player does NOT have a mask on due to the fact someone could reveal a hitman by knowing the owner of the house
  1212. format(str, sizeof(str), "* %s takes out some codeine and puts it into their safe.", PlayerICName(playerid));
  1213. ProxDetector(30.0, playerid, str, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
  1214. }
  1215. format(str, sizeof(str), "* You have stored %d codeine into your safe.", codeineam);
  1216. SendClientMessage(playerid, COLOR_LIGHTBLUE, str);
  1217. HouseInfo[houseid][hModified] = 1;
  1218. }
  1219. if(strcmp(action[1], "lean", true) == 0)
  1220. {
  1221. new leanam = 0;
  1222. if(sscanf(params, "s[32] s[32] d", action[0], action[1], leanam)) return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /house store lean [amount]");
  1223. if(leanam < 1 || leanam > 15000) return SendClientMessage(playerid, COLOR_GRAD1, "Invalid amount.");
  1224. if(leanam > PlayerInfo[playerid][pLean]) return SendClientMessage(playerid, COLOR_GRAD1, "You don't have that much lean.");
  1225. if(HouseInfo[houseid][hLean] + leanam > 15000) return SendClientMessage(playerid, COLOR_GRAD1, "Your safe is at or greater than it's lean limit.");
  1226. HouseInfo[houseid][hLean] += leanam;
  1227. PlayerInfo[playerid][pLean] -= leanam;
  1228. if(PlayerInfo[playerid][pMask] == 0)
  1229. {
  1230. // The str only gets sent if the player does NOT have a mask on due to the fact someone could reveal a hitman by knowing the owner of the house
  1231. format(str, sizeof(str), "* %s takes out some lean and puts it into their safe.", PlayerICName(playerid));
  1232. ProxDetector(30.0, playerid, str, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
  1233. }
  1234. format(str, sizeof(str), "* You have stored %d lean into your safe.", leanam);
  1235. SendClientMessage(playerid, COLOR_LIGHTBLUE, str);
  1236. HouseInfo[houseid][hModified] = 1;
  1237. }
  1238. if(strcmp(action[1], "materials", true) == 0 || strcmp(action[1], "mats", true) == 0)
  1239. {
  1240. new matam = 0;
  1241. if(sscanf(params, "s[32] s[32] d", action[0], action[1], matam)) return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /house store mats/materials [amount]");
  1242. if(matam < 1 || matam > 500000) return SendClientMessage(playerid, COLOR_GRAD1, "Invalid amount.");
  1243. if(matam > PlayerInfo[playerid][pMats]) return SendClientMessage(playerid, COLOR_GRAD1, "You don't have that many materials.");
  1244. if(HouseInfo[houseid][hMaterials] +matam > 500000) return SendClientMessage(playerid, COLOR_GRAD1, "Your safe is at or greater than it's materials limit.");
  1245. HouseInfo[houseid][hMaterials] += matam;
  1246. PlayerInfo[playerid][pMats] -= matam;
  1247. if(PlayerInfo[playerid][pMask] == 0)
  1248. {
  1249. // The str only gets sent if the player does NOT have a mask on due to the fact someone could reveal a hitman by knowing the owner of the house
  1250. format(str, sizeof(str), "* %s takes out some materials and puts it into their safe.", PlayerICName(playerid));
  1251. ProxDetector(30.0, playerid, str, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
  1252. }
  1253. format(str, sizeof(str), "* You have stored %d materials into your safe.", matam);
  1254. SendClientMessage(playerid, COLOR_LIGHTBLUE, str);
  1255. HouseInfo[houseid][hModified] = 1;
  1256. }
  1257. if(strcmp(action[1], "money", true) == 0 || strcmp(action[1], "cash", true) == 0)
  1258. {
  1259. new casham;
  1260. if(sscanf(params, "s[32] s[32] d", action[0], action[1], casham)) return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /house store money/cash [amount]");
  1261. if(casham < 1 || casham > 2000000) return SendClientMessage(playerid, COLOR_GRAD1, "Invalid amount.");
  1262. if(casham > PlayerInfo[playerid][pCash]) return SendClientMessage(playerid, COLOR_GRAD1, "You don't have that much cash.");
  1263. if(HouseInfo[houseid][hCash] +casham > 2000000) return SendClientMessage(playerid, COLOR_GRAD1, "Your safe is at or greater than it's cash limit.");
  1264. HouseInfo[houseid][hCash] += casham;
  1265. PlayerInfo[playerid][pCash] -= casham;
  1266. if(PlayerInfo[playerid][pMask] == 0)
  1267. {
  1268. // The str only gets sent if the player does NOT have a mask on due to the fact someone could reveal a hitman by knowing the owner of the house
  1269. format(str, sizeof(str), "* %s takes out some cash and puts it into their safe.", PlayerICName(playerid));
  1270. ProxDetector(30.0, playerid, str, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
  1271. }
  1272. format(str, sizeof(str), "* You have stored $%d cash into your safe.", casham);
  1273. SendClientMessage(playerid, COLOR_LIGHTBLUE, str);
  1274. HouseInfo[houseid][hModified] = 1;
  1275. }
  1276. return 1;
  1277. }
  1278. if(strcmp(action[0], "get", true) == 0)
  1279. {
  1280. if(sscanf(params, "s[32] s[32] ", action[0], action[1]))
  1281. {
  1282. SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /house get [item]");
  1283. SendClientMessage(playerid, COLOR_GRAD2, "Items: gun, cash, materials, cannabis, cocaine, xanax, promethazine, lean");
  1284. return 1;
  1285. }
  1286. if(strcmp(action[1], "gun", true) == 0)
  1287. {
  1288. if(IsACop(playerid) == 1 || IsANG(playerid) == 1 || IsAMedic(playerid) == 1 || IsASenate(playerid) || PlayerInfo[playerid][pMember] == 10 || PlayerInfo[playerid][pMember] == 9)
  1289. return SendClientMessage(playerid, COLOR_GRAD1, "Cops/DEA/SANG/SAN/Taxi Company can not use this command.");
  1290. new slot = 0;
  1291. if(sscanf(params, "s[32] s[32] d", action[0], action[1], slot))
  1292. {
  1293. SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /house get gun [1-7]");
  1294. return 1;
  1295. }
  1296. new weaponname[64];
  1297. if(slot == 1)
  1298. {
  1299. if(HouseInfo[houseid][hGun1] == 0) return SendClientMessage(playerid, COLOR_GRAD1, "That slot is empty.");
  1300. new weaponid = HouseInfo[houseid][hGun1];
  1301. GivePlayerGun(playerid, weaponid);
  1302. GetWeaponName(weaponid, weaponname, 64);
  1303. if(PlayerInfo[playerid][pMask] == 0)
  1304. {
  1305. // The str only gets sent if the player does NOT have a mask on due to the fact someone could reveal a hitman by knowing the owner of the house
  1306. format(str, sizeof(str), "* %s takes a weapon from their safe.", PlayerICName(playerid));
  1307. ProxDetector(30.0, playerid, str, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
  1308. }
  1309. format(str, sizeof(str), "* You have taken a %s from your house.", weaponname);
  1310. SendClientMessage(playerid, COLOR_LIGHTBLUE, str);
  1311. HouseInfo[houseid][hGun1] = 0;
  1312. HouseInfo[houseid][hModified] = 1;
  1313. return 1;
  1314. }
  1315. if(slot == 2)
  1316. {
  1317. if(HouseInfo[houseid][hGun2] == 0) return SendClientMessage(playerid, COLOR_GRAD1, "That slot is empty.");
  1318. new weaponid = HouseInfo[houseid][hGun2];
  1319. GivePlayerGun(playerid, weaponid);
  1320. GetWeaponName(weaponid, weaponname, 64);
  1321. if(PlayerInfo[playerid][pMask] == 0)
  1322. {
  1323. // The str only gets sent if the player does NOT have a mask on due to the fact someone could reveal a hitman by knowing the owner of the house
  1324. format(str, sizeof(str), "* %s takes a weapon from their safe.", PlayerICName(playerid));
  1325. ProxDetector(30.0, playerid, str, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
  1326. }
  1327. format(str, sizeof(str), "* You have taken a %s from your house.", weaponname);
  1328. SendClientMessage(playerid, COLOR_LIGHTBLUE, str);
  1329. HouseInfo[houseid][hGun2] = 0;
  1330. HouseInfo[houseid][hModified] = 1;
  1331. return 1;
  1332. }
  1333. if(slot == 3)
  1334. {
  1335. if(HouseInfo[houseid][hGun3] == 0) return SendClientMessage(playerid, COLOR_GRAD1, "That slot is empty.");
  1336. new weaponid = HouseInfo[houseid][hGun3];
  1337. GivePlayerGun(playerid, weaponid);
  1338. GetWeaponName(weaponid, weaponname, 64);
  1339. if(PlayerInfo[playerid][pMask] == 0)
  1340. {
  1341. // The str only gets sent if the player does NOT have a mask on due to the fact someone could reveal a hitman by knowing the owner of the house
  1342. format(str, sizeof(str), "* %s takes a weapon from their safe.", PlayerICName(playerid));
  1343. ProxDetector(30.0, playerid, str, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
  1344. }
  1345. format(str, sizeof(str), "* You have taken a %s from your house.", weaponname);
  1346. SendClientMessage(playerid, COLOR_LIGHTBLUE, str);
  1347. HouseInfo[houseid][hGun3] = 0;
  1348. HouseInfo[houseid][hModified] = 1;
  1349. return 1;
  1350. }
  1351. if(slot == 4)
  1352. {
  1353. if(HouseInfo[houseid][hGun4] == 0) return SendClientMessage(playerid, COLOR_GRAD1, "That slot is empty.");
  1354. new weaponid = HouseInfo[houseid][hGun4];
  1355. GivePlayerGun(playerid, weaponid);
  1356. GetWeaponName(weaponid, weaponname, 64);
  1357. if(PlayerInfo[playerid][pMask] == 0)
  1358. {
  1359. // The str only gets sent if the player does NOT have a mask on due to the fact someone could reveal a hitman by knowing the owner of the house
  1360. format(str, sizeof(str), "* %s takes a weapon from their safe.", PlayerICName(playerid));
  1361. ProxDetector(30.0, playerid, str, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
  1362. }
  1363. format(str, sizeof(str), "* You have taken a %s from your house.", weaponname);
  1364. SendClientMessage(playerid, COLOR_LIGHTBLUE, str);
  1365. HouseInfo[houseid][hGun4] = 0;
  1366. HouseInfo[houseid][hModified] = 1;
  1367. return 1;
  1368. }
  1369. if(slot == 5)
  1370. {
  1371. if(HouseInfo[houseid][hGun5] == 0) return SendClientMessage(playerid, COLOR_GRAD1, "That slot is empty.");
  1372. new weaponid = HouseInfo[houseid][hGun5];
  1373. GivePlayerGun(playerid, weaponid);
  1374. GetWeaponName(weaponid, weaponname, 64);
  1375. if(PlayerInfo[playerid][pMask] == 0)
  1376. {
  1377. // The str only gets sent if the player does NOT have a mask on due to the fact someone could reveal a hitman by knowing the owner of the house
  1378. format(str, sizeof(str), "* %s takes a weapon from their safe.", PlayerICName(playerid));
  1379. ProxDetector(30.0, playerid, str, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
  1380. }
  1381. format(str, sizeof(str), "* You have taken a %s from your house.", weaponname);
  1382. SendClientMessage(playerid, COLOR_LIGHTBLUE, str);
  1383. HouseInfo[houseid][hGun5] = 0;
  1384. HouseInfo[houseid][hModified] = 1;
  1385. return 1;
  1386. }
  1387. if(slot == 6)
  1388. {
  1389. if(HouseInfo[houseid][hGun6] == 0) return SendClientMessage(playerid, COLOR_GRAD1, "That slot is empty.");
  1390. new weaponid = HouseInfo[houseid][hGun6];
  1391. GivePlayerGun(playerid, weaponid);
  1392. GetWeaponName(weaponid, weaponname, 64);
  1393. if(PlayerInfo[playerid][pMask] == 0)
  1394. {
  1395. // The str only gets sent if the player does NOT have a mask on due to the fact someone could reveal a hitman by knowing the owner of the house
  1396. format(str, sizeof(str), "* %s takes a weapon from their safe.", PlayerICName(playerid));
  1397. ProxDetector(30.0, playerid, str, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
  1398. }
  1399. format(str, sizeof(str), "* You have taken a %s from your house.", weaponname);
  1400. SendClientMessage(playerid, COLOR_LIGHTBLUE, str);
  1401. HouseInfo[houseid][hGun6] = 0;
  1402. HouseInfo[houseid][hModified] = 1;
  1403. return 1;
  1404. }
  1405. if(slot == 7)
  1406. {
  1407. if(HouseInfo[houseid][hGun7] == 0) return SendClientMessage(playerid, COLOR_GRAD1, "That slot is empty.");
  1408. new weaponid = HouseInfo[houseid][hGun7];
  1409. GivePlayerGun(playerid, weaponid);
  1410. GetWeaponName(weaponid, weaponname, 64);
  1411. if(PlayerInfo[playerid][pMask] == 0)
  1412. {
  1413. // The str only gets sent if the player does NOT have a mask on due to the fact someone could reveal a hitman by knowing the owner of the house
  1414. format(str, sizeof(str), "* %s takes a weapon from their safe.", PlayerICName(playerid));
  1415. ProxDetector(30.0, playerid, str, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
  1416. }
  1417. format(str, sizeof(str), "* You have taken a %s from your house.", weaponname);
  1418. SendClientMessage(playerid, COLOR_LIGHTBLUE, str);
  1419. HouseInfo[houseid][hGun7] = 0;
  1420. HouseInfo[houseid][hModified] = 1;
  1421. return 1;
  1422. }
  1423. else
  1424. {
  1425. SendClientMessage(playerid, COLOR_GRAD1, "Invalid weapon slot.");
  1426. return 1;
  1427. }
  1428. }
  1429. if(strcmp(action[1], "cannabis", true) == 0 || strcmp(action[1], "weed", true) == 0)
  1430. {
  1431. new cannabisam = 0;
  1432. if(sscanf(params, "s[32] s[32] d", action[0], action[1], cannabisam))
  1433. {
  1434. SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /house get cannabis [amount]");
  1435. return 1;
  1436. }
  1437. if(cannabisam < 1 || cannabisam > 15000) return SendClientMessage(playerid, COLOR_GRAD1, "Invalid amount.");
  1438. if(cannabisam > HouseInfo[houseid][hCannabis]) return SendClientMessage(playerid, COLOR_GRAD1, "Your safe doesn't have that much cannabis.");
  1439. HouseInfo[houseid][hCannabis] -= cannabisam;
  1440. PlayerInfo[playerid][pCannabis] += cannabisam;
  1441. if(PlayerInfo[playerid][pMask] == 0)
  1442. {
  1443. // The str only gets sent if the player does NOT have a mask on due to the fact someone could reveal a hitman by knowing the owner of the house
  1444. format(str, sizeof(str), "* %s takes some cannabis from their safe.", PlayerICName(playerid));
  1445. ProxDetector(30.0, playerid, str, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
  1446. }
  1447. format(str, sizeof(str), "* You have taken %d cannabis from your safe.", cannabisam);
  1448. SendClientMessage(playerid, COLOR_LIGHTBLUE, str);
  1449. HouseInfo[houseid][hModified] = 1;
  1450. }
  1451. if(strcmp(action[1], "cocaine", true) == 0)
  1452. {
  1453. new cokeam = 0;
  1454. if(sscanf(params, "s[32] s[32] d", action[0], action[1], cokeam))
  1455. {
  1456. SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /house get cocaine [amount]");
  1457. return 1;
  1458. }
  1459. if(cokeam < 1 || cokeam > 15000) return SendClientMessage(playerid, COLOR_GRAD1, "Invalid amount.");
  1460. if(cokeam > HouseInfo[houseid][hCocaine]) return SendClientMessage(playerid, COLOR_GRAD1, "Your safe doesn't have that much cocaine.");
  1461. HouseInfo[houseid][hCocaine] -= cokeam;
  1462. PlayerInfo[playerid][pCocaine] += cokeam;
  1463. if(PlayerInfo[playerid][pMask] == 0)
  1464. {
  1465. // The str only gets sent if the player does NOT have a mask on due to the fact someone could reveal a hitman by knowing the owner of the house
  1466. format(str, sizeof(str), "* %s takes some cocaine from their safe.", PlayerICName(playerid));
  1467. ProxDetector(30.0, playerid, str, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
  1468. }
  1469. format(str, sizeof(str), "* You have taken %d cocaine from your safe.", cokeam);
  1470. SendClientMessage(playerid, COLOR_LIGHTBLUE, str);
  1471. HouseInfo[houseid][hModified] = 1;
  1472. }
  1473. if(strcmp(action[1], "meth", true) == 0)
  1474. {
  1475. new metham = 0;
  1476. if(sscanf(params, "s[32] s[32] d", action[0], action[1], metham))
  1477. {
  1478. SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /house get meth [amount]");
  1479. return 1;
  1480. }
  1481. if(metham < 1 || metham > 15000) return SendClientMessage(playerid, COLOR_GRAD1, "Invalid amount.");
  1482. if(metham > HouseInfo[houseid][hMeth]) return SendClientMessage(playerid, COLOR_GRAD1, "Your safe doesn't have that much meth.");
  1483. HouseInfo[houseid][hMeth] -= metham;
  1484. PlayerInfo[playerid][pMeth] += metham;
  1485. if(PlayerInfo[playerid][pMask] == 0)
  1486. {
  1487. // The str only gets sent if the player does NOT have a mask on due to the fact someone could reveal a hitman by knowing the owner of the house
  1488. format(str, sizeof(str), "* %s takes some meth from their safe.", PlayerICName(playerid));
  1489. ProxDetector(30.0, playerid, str, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
  1490. }
  1491. format(str, sizeof(str), "* You have taken %d meth from your safe.", metham);
  1492. SendClientMessage(playerid, COLOR_LIGHTBLUE, str);
  1493. HouseInfo[houseid][hModified] = 1;
  1494. }
  1495. if(strcmp(action[1], "xanax", true) == 0)
  1496. {
  1497. new xanam = 0;
  1498. if(sscanf(params, "s[32] s[32] d", action[0], action[1], xanam))
  1499. {
  1500. SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /house get xanax [amount]");
  1501. return 1;
  1502. }
  1503. if(xanam < 1 || xanam > 15000) return SendClientMessage(playerid, COLOR_GRAD1, "Invalid amount.");
  1504. if(xanam > HouseInfo[houseid][hXanax]) return SendClientMessage(playerid, COLOR_GRAD1, "Your safe doesn't have that much xanax.");
  1505. HouseInfo[houseid][hXanax] -= xanam;
  1506. PlayerInfo[playerid][pXanax] += xanam;
  1507. if(PlayerInfo[playerid][pMask] == 0)
  1508. {
  1509. // The str only gets sent if the player does NOT have a mask on due to the fact someone could reveal a hitman by knowing the owner of the house
  1510. format(str, sizeof(str), "* %s takes some xanax from their safe.", PlayerICName(playerid));
  1511. ProxDetector(30.0, playerid, str, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
  1512. }
  1513. format(str, sizeof(str), "* You have taken %d xanax from your safe.", xanam);
  1514. SendClientMessage(playerid, COLOR_LIGHTBLUE, str);
  1515. HouseInfo[houseid][hModified] = 1;
  1516. }
  1517. if(strcmp(action[1], "promethazine", true) == 0)
  1518. {
  1519. new prometham = 0;
  1520. if(sscanf(params, "s[32] s[32] d", action[0], action[1], prometham))
  1521. {
  1522. SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /house get promethazine [amount]");
  1523. return 1;
  1524. }
  1525. if(prometham < 1 || prometham > 15000) return SendClientMessage(playerid, COLOR_GRAD1, "Invalid amount.");
  1526. if(prometham > HouseInfo[houseid][hPromethazine]) return SendClientMessage(playerid, COLOR_GRAD1, "Your safe doesn't have that much promethazine.");
  1527. HouseInfo[houseid][hPromethazine] -= prometham;
  1528. PlayerInfo[playerid][pPromethazine] += prometham;
  1529. if(PlayerInfo[playerid][pMask] == 0)
  1530. {
  1531. // The str only gets sent if the player does NOT have a mask on due to the fact someone could reveal a hitman by knowing the owner of the house
  1532. format(str, sizeof(str), "* %s takes some promethazine from their safe.", PlayerICName(playerid));
  1533. ProxDetector(30.0, playerid, str, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
  1534. }
  1535. format(str, sizeof(str), "* You have taken %d promethazine from your safe.", prometham);
  1536. SendClientMessage(playerid, COLOR_LIGHTBLUE, str);
  1537. HouseInfo[houseid][hModified] = 1;
  1538. }
  1539. if(strcmp(action[1], "codeine", true) == 0)
  1540. {
  1541. new codeineam = 0;
  1542. if(sscanf(params, "s[32] s[32] d", action[0], action[1], codeineam))
  1543. {
  1544. SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /house get codeine [amount]");
  1545. return 1;
  1546. }
  1547. if(codeineam < 1 || codeineam > 15000) return SendClientMessage(playerid, COLOR_GRAD1, "Invalid amount.");
  1548. if(codeineam > HouseInfo[houseid][hCodeine]) return SendClientMessage(playerid, COLOR_GRAD1, "Your safe doesn't have that much codeine.");
  1549. HouseInfo[houseid][hCodeine] -= codeineam;
  1550. PlayerInfo[playerid][pCodeine] += codeineam;
  1551. if(PlayerInfo[playerid][pMask] == 0)
  1552. {
  1553. // The str only gets sent if the player does NOT have a mask on due to the fact someone could reveal a hitman by knowing the owner of the house
  1554. format(str, sizeof(str), "* %s takes some codeine from their safe.", PlayerICName(playerid));
  1555. ProxDetector(30.0, playerid, str, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
  1556. }
  1557. format(str, sizeof(str), "* You have taken %d codeine from your safe.", codeineam);
  1558. SendClientMessage(playerid, COLOR_LIGHTBLUE, str);
  1559. HouseInfo[houseid][hModified] = 1;
  1560. }
  1561. if(strcmp(action[1], "lean", true) == 0)
  1562. {
  1563. new codeineam = 0;
  1564. if(sscanf(params, "s[32] s[32] d", action[0], action[1], codeineam))
  1565. {
  1566. SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /house get lean [amount]");
  1567. return 1;
  1568. }
  1569. if(codeineam < 1 || codeineam > 15000) return SendClientMessage(playerid, COLOR_GRAD1, "Invalid amount.");
  1570. if(codeineam > HouseInfo[houseid][hLean]) return SendClientMessage(playerid, COLOR_GRAD1, "Your safe doesn't have that much lean.");
  1571. HouseInfo[houseid][hLean] -= codeineam;
  1572. PlayerInfo[playerid][pLean] += codeineam;
  1573. if(PlayerInfo[playerid][pMask] == 0)
  1574. {
  1575. // The str only gets sent if the player does NOT have a mask on due to the fact someone could reveal a hitman by knowing the owner of the house
  1576. format(str, sizeof(str), "* %s takes some lean from their safe.", PlayerICName(playerid));
  1577. ProxDetector(30.0, playerid, str, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
  1578. }
  1579. format(str, sizeof(str), "* You have taken %d lean from your safe.", codeineam);
  1580. SendClientMessage(playerid, COLOR_LIGHTBLUE, str);
  1581. HouseInfo[houseid][hModified] = 1;
  1582. }
  1583. if(strcmp(action[1], "materials", true) == 0 || strcmp(action[1], "mats", true) == 0)
  1584. {
  1585. new matam = 0;
  1586. if(sscanf(params, "s[32] s[32] d", action[0], action[1], matam))
  1587. {
  1588. SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /house get materials [amount]");
  1589. return 1;
  1590. }
  1591. if(matam < 1 || matam > 500000) return SendClientMessage(playerid, COLOR_GRAD1, "Invalid amount.");
  1592. if(matam > HouseInfo[houseid][hMaterials]) return SendClientMessage(playerid, COLOR_GRAD1, "Your safe doesn't have that many materials.");
  1593. HouseInfo[houseid][hMaterials] -= matam;
  1594. PlayerInfo[playerid][pMats] += matam;
  1595. if(PlayerInfo[playerid][pMask] == 0)
  1596. {
  1597. // The str only gets sent if the player does NOT have a mask on due to the fact someone could reveal a hitman by knowing the owner of the house
  1598. format(str, sizeof(str), "* %s takes some materials from their safe.", PlayerICName(playerid));
  1599. ProxDetector(30.0, playerid, str, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
  1600. }
  1601. format(str, sizeof(str), "* You have taken %d materials from your safe.", matam);
  1602. SendClientMessage(playerid, COLOR_LIGHTBLUE, str);
  1603. HouseInfo[houseid][hModified] = 1;
  1604. }
  1605. if(strcmp(action[1], "money", true) == 0 || strcmp(action[1], "cash", true) == 0)
  1606. {
  1607. new casham = 0;
  1608. if(sscanf(params, "s[32] s[32] d", action[0], action[1], casham))
  1609. {
  1610. SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /house get money [amount]");
  1611. return 1;
  1612. }
  1613. if(casham < 1 || casham > 2000000) return SendClientMessage(playerid, COLOR_GRAD1, "Invalid amount.");
  1614. if(casham > HouseInfo[houseid][hCash]) return SendClientMessage(playerid, COLOR_GRAD1, "Your safe doesn't have that much cash.");
  1615. HouseInfo[houseid][hCash] -= casham;
  1616. PlayerInfo[playerid][pCash] += casham;
  1617. if(PlayerInfo[playerid][pMask] == 0)
  1618. {
  1619. // The str only gets sent if the player does NOT have a mask on due to the fact someone could reveal a hitman by knowing the owner of the house
  1620. format(str, sizeof(str), "* %s takes some cash from their safe.", PlayerICName(playerid));
  1621. ProxDetector(30.0, playerid, str, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
  1622. }
  1623. format(str, sizeof(str), "* You have taken $%d cash from your safe.", casham);
  1624. SendClientMessage(playerid, COLOR_LIGHTBLUE, str);
  1625. HouseInfo[houseid][hModified] = 1;
  1626. }
  1627. return 1;
  1628. }
  1629. if(strcmp(action[0], "check", true) == 0)
  1630. {
  1631. DisplaySafeInfo(houseid, playerid);
  1632. return 1;
  1633. }
  1634. return 1;
  1635. }
  1636. CMD:ahouse(playerid, params[])
  1637. {
  1638. if(!(PlayerInfo[playerid][pAdmin] > 2 || PlayerInfo[playerid][pBizMod])) return AdmErrorMsg;
  1639. new houseid;
  1640. if(sscanf(params, "i", houseid)) return SendClientMessage(playerid, COLOR_GRAD1, "Usage: /ahouse [houseid]");
  1641. if(HouseInfo[houseid][hCreated] == 0) return SendClientMessage(playerid, COLOR_GRAD1, "That house hasn't been created yet.");
  1642. DisplaySafeInfo(houseid, playerid);
  1643. return 1;
  1644. }
  1645. CMD:setsale(playerid, params[])
  1646. {
  1647. if(PlayerInfo[playerid][pHouseID] == 0) return SendClientMessage(playerid, COLOR_GRAD1, "You do not own a house.");
  1648. new confirmed[24];
  1649. if(!sscanf(params, "s[24]", confirmed))
  1650. {
  1651. if(!(strcmp(confirmed, "confirm", true) != 0))
  1652. {
  1653. if(!(gForSales[playerid][PlayerHasASaleBoard]))
  1654. {
  1655. new houseid = PlayerInfo[playerid][pHouseID];
  1656. if(HouseInfo[houseid][hOwnerID] != PlayerInfo[playerid][pID])
  1657. return SendClientMessage(playerid, COLOR_GREY, "You don't own this house.");
  1658. if(IsPlayerInRangeOfPoint(playerid, 15.0, HouseInfo[houseid][hOutsideX], HouseInfo[houseid][hOutsideY], HouseInfo[houseid][hOutsideZ]))
  1659. {
  1660. new pcash = GetPlayerMoney(playerid);
  1661. if(pcash > 5000)
  1662. {
  1663. GiveMoney(playerid, -5000);
  1664. new Float:x, Float:y, Float:z, Float:Angle;
  1665. GetPlayerPos(playerid, x, y, z);
  1666. GetPlayerFacingAngle(playerid, Angle);
  1667. SendClientMessage(playerid, COLOR_LIGHTBLUE, "For-Sale was succesfully added, '/destroysale' in order to remove it.");
  1668. gForSales[playerid][Saleobject] = CreateDynamicObject(19471, (x -0.1), (y -0.1), (z -1), 0, 0, (Angle -270));
  1669. gForSales[playerid][PlayerHasASaleBoard] = true;
  1670. }
  1671. else SendClientMessage(playerid, COLOR_GREY, "You can't afford that.");
  1672. }
  1673. else SendClientMessage(playerid, COLOR_GREY, "You are not in range of your house.");
  1674. }
  1675. else SendClientMessage(playerid, COLOR_GREY, "You already have a For-Sale.");
  1676. }
  1677. }
  1678. else
  1679. {
  1680. SendClientMessage(playerid, COLOR_LIGHTBLUE, "** This costs 5000$, Point youself in the position you want it to be pointed at.");
  1681. SendClientMessage(playerid, COLOR_LIGHTBLUE, "** add the parameter \"confirm\" to confirm the sale-board.");
  1682. }
  1683. return 1;
  1684. }
  1685. CMD:destroysale(playerid, params[])
  1686. {
  1687. if(gForSales[playerid][PlayerHasASaleBoard])
  1688. {
  1689. new Float:x, Float:y, Float:z;
  1690. GetDynamicObjectPos(gForSales[playerid][Saleobject], x, y, z);
  1691. if(IsPlayerInRangeOfPoint(playerid, 3.0, x, y, z))
  1692. {
  1693. DestroyDynamicObjectEx(gForSales[playerid][Saleobject]);
  1694. gForSales[playerid][Saleobject] = 0;
  1695. SendClientMessage(playerid, COLOR_LIGHTBLUE, "For-Sale was succesfully destroyed");
  1696. gForSales[playerid][PlayerHasASaleBoard] = false;
  1697. }
  1698. else SendClientMessage(playerid, COLOR_GREY, "You have to be in range of your For-Sale in order to destroy it.");
  1699. }
  1700. else SendClientMessage(playerid, COLOR_GREY, "You do not have a For-Sale.");
  1701. return 1;
  1702. }
  1703. CMD:lockhouse(playerid, params[])
  1704. {
  1705. new houseid = PlayerInfo[playerid][pHouseID];
  1706. if(houseid !=0)
  1707. {
  1708. if(HouseInfo[houseid][hOwnerID] != PlayerInfo[playerid][pID])return SendClientMessage(playerid, COLOR_GREY, "You don't own this house.");
  1709. if(IsPlayerInRangeOfPoint(playerid, 1.0, HouseInfo[houseid][hOutsideX], HouseInfo[houseid][hOutsideY], HouseInfo[houseid][hOutsideZ]) || IsPlayerInRangeOfPoint(playerid, 3.0, HouseInfo[houseid][hInsideX], HouseInfo[houseid][hInsideY], HouseInfo[houseid][hInsideZ]) && GetPlayerVirtualWorld(playerid) == HouseInfo[houseid][hSQLID])
  1710. {
  1711. if(HouseInfo[houseid][hLocked])
  1712. {
  1713. format(str, sizeof(str), "* %s has unlocked the door to their property.", PlayerICName(playerid));
  1714. ProxDetector(30.0, playerid, str, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
  1715. HouseInfo[houseid][hLocked] = 0;
  1716. HouseInfo[houseid][hModified] = 1;
  1717. return 1;
  1718. }
  1719. else
  1720. {
  1721. format(str, sizeof(str), "* %s has locked the door to their property.", PlayerICName(playerid));
  1722. ProxDetector(30.0, playerid, str, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
  1723. HouseInfo[houseid][hLocked] = 1;
  1724. HouseInfo[houseid][hModified] = 1;
  1725. return 1;
  1726. }
  1727. }
  1728. else
  1729. {
  1730. SendClientMessage(playerid, COLOR_GRAD1, "You are not near / inside the property you own.");
  1731. return 1;
  1732. }
  1733. }
  1734. return 1;
  1735. }
  1736. CMD:buyhouse(playerid, params[])
  1737. {
  1738. new hdebug[256];
  1739. if(PlayerInfo[playerid][pHouseID] != 0)
  1740. return SendClientMessage(playerid, COLOR_GRAD1, "You already own a house.");
  1741. if(PlayerInfo[playerid][pLevel] == 1)
  1742. return SendClientMessage(playerid, COLOR_GRAD1, "You must be level 2+ to buy a house.");
  1743. new houseid = GetPlayerNearHouseID(playerid);
  1744. if(!houseid)
  1745. return SendClientMessage(playerid, COLOR_GRAD1, "You are not near a house.");
  1746. if(HouseInfo[houseid][hOwned] == 1)
  1747. return SendClientMessage(playerid, COLOR_GRAD1, "This property is already owned.");
  1748. if(PlayerInfo[playerid][pCash] < HouseInfo[houseid][hValue] && PlayerInfo[playerid][hTicket] == 0)
  1749. return SendClientMessage(playerid, COLOR_GRAD1, "You have incufficent funds to purchase this property.");
  1750. new location[MAX_ZONE_NAME];
  1751. location = GetHouseLocation(houseid);
  1752. if(sscanf(params, "s[128] ", str))
  1753. {
  1754. format(str, sizeof(str), "This property will cost you $%d, type {FF0000}/buyhouse confirm{F8ECE0} to purchase {FFFF00}%d %s", HouseInfo[houseid][hValue], houseid, location);
  1755. SendClientMessage(playerid, COLOR_WHITE, str);
  1756. return 1;
  1757. }
  1758. if(strcmp(str, "confirm", true) == 0)
  1759. {
  1760. HouseInfo[houseid][hOwned] = 1;
  1761. PlayerInfo[playerid][pHouseID] = houseid;
  1762. HouseInfo[houseid][hOwnerID] = PlayerInfo[playerid][pID];
  1763. strmid(HouseInfo[houseid][hOwner], PlayerName(playerid), 0, strlen(PlayerName(playerid)), 255);
  1764. GiveMoney(playerid, -HouseInfo[houseid][hValue]);
  1765. format(str, sizeof(str), "Congratulations, you just purchased {FFFF00}%d %s{F8ECE0} for $%d.", houseid, location, HouseInfo[houseid][hValue]);
  1766. SendClientMessage(playerid, COLOR_WHITE, str);
  1767. SendClientMessage(playerid, COLOR_WHITE, "Type {FF0000}/househelp{F8ECE0} for assistance.");
  1768. strdel(HouseInfo[houseid][hTag], 0, strlen(HouseInfo[houseid][hTag]));
  1769. strins(HouseInfo[houseid][hTag], "House", 0);
  1770. DestroyDynamicPickup(HouseInfo[houseid][hOutsidePickup]);
  1771. HouseInfo[houseid][hOutsidePickup] = CreateDynamicPickup(1273, 1, HouseInfo[houseid][hOutsideX], HouseInfo[houseid][hOutsideY], HouseInfo[houseid][hOutsideZ]);
  1772. SetHouseTag(houseid);
  1773. /*format(str, sizeof(str), "%s has purchased a house in %s.", PlayerICName(playerid), location);
  1774. UpdateGameFeed(str, GAMEFEED_COLOR_GREEN);*/
  1775. format(hdebug, sizeof(hdebug), "%s has bought house ID %d [%s] for %d.", PlayerName(playerid), houseid, location, HouseInfo[houseid][hValue]);
  1776. Log:debug("HOUSE", "%s", hdebug);
  1777. HouseInfo[houseid][hModified] = 1;
  1778. return 1;
  1779. }
  1780. return 1;
  1781. }
  1782. CMD:sellhouse(playerid, params[])
  1783. {
  1784. new houseid = PlayerInfo[playerid][pHouseID];
  1785. if(HouseFiresRemaining[houseid] > 0)
  1786. return SendClientMessage(playerid, COLOR_GRAD1, "You cannot sell your house while its on fire!");
  1787. if(PlayerInfo[playerid][pHouseID] == 0) return SendClientMessage(playerid, COLOR_GRAD1, "You do not own a house to sell.");
  1788. if(HouseInfo[houseid][hDonated]) return SendClientMessage(playerid, COLOR_GRAD1, "You can not sell this house as it is donated.");
  1789. if(!IsPlayerInRangeOfPoint(playerid, 20.0, HouseInfo[houseid][hOutsideX], HouseInfo[houseid][hOutsideY], HouseInfo[houseid][hOutsideZ])) return SendClientMessage(playerid, COLOR_GRAD1, "You are not near your house.");
  1790. new location[MAX_ZONE_NAME];
  1791. Get2DZone(location, MAX_ZONE_NAME, HouseInfo[houseid][hOutsideX], HouseInfo[houseid][hOutsideY], HouseInfo[houseid][hOutsideZ]);
  1792. new selltoid, hoprice = 0;
  1793. if(sscanf(params, "ud", selltoid, hoprice))
  1794. {
  1795. SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /sellhouse [PlayerID/PartOfName] [Price]");
  1796. return 1;
  1797. }
  1798. if(IsPlayerConnected(selltoid))
  1799. {
  1800. new Float:pgx, Float:pgy, Float:pgz;
  1801. GetPlayerPos(selltoid, pgx, pgy, pgz);
  1802. if(!IsPlayerInRangeOfPoint(playerid, 3.0, pgx, pgy, pgz)) return SendClientMessage(playerid, COLOR_GREY, "You are not near the player! ");
  1803. if(hoprice < 10000 || hoprice > 5000000) return SendClientMessage(playerid, COLOR_GRAD1, "Price must be in between $10,000 and $5,000,000.");
  1804. if(PlayerInfo[selltoid][pHouseID] != 0) return SendClientMessage(playerid, COLOR_GRAD1, "This player already owns a house.");
  1805. if(selltoid == playerid) return SendClientMessage(playerid, COLOR_GRAD1, "You can not sell your house to yourself.");
  1806. OfferedSellHouse[selltoid][0] = playerid;
  1807. OfferedSellHouse[selltoid][1] = hoprice;
  1808. OfferedSellHouse[selltoid][2] = houseid;
  1809. format(str, sizeof(str), "** %s has offered to sell you their house (%d %s) for $%d! /accept house to accept.", PlayerICName(playerid), houseid, location, hoprice);
  1810. SendClientMessage(selltoid, COLOR_LIGHTBLUE, str);
  1811. format(str, sizeof(str), "** You have offered to sell your house to %s (%d %s) for $%d.", PlayerICName(selltoid), houseid, location, hoprice);
  1812. SendClientMessage(playerid, COLOR_LIGHTBLUE, str);
  1813. HouseInfo[houseid][hModified] = 1;
  1814. return 1;
  1815. }
  1816. return 1;
  1817. }
  1818. CMD:sethousedonated(playerid, params[])
  1819. {
  1820. if(PlayerInfo[playerid][pAdmin] < 1337 && !PlayerInfo[playerid][pBizMod]) return AdmErrorMsg;
  1821. new houseid;
  1822. if(sscanf(params, "d", houseid)) return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /sethousedonated [houseid]");
  1823. if(!HouseInfo[houseid][hCreated]) return SendClientMessage(playerid, COLOR_GRAD1, "That house has not been created yet! ");
  1824. HouseInfo[houseid][hDonated] = !HouseInfo[houseid][hDonated];
  1825. new msg[100];
  1826. if(HouseInfo[houseid][hDonated])
  1827. {
  1828. format(msg, sizeof(msg), "House ID %d is now donated and can not be sold.", houseid);
  1829. SendClientMessage(playerid, COLOR_GREY, msg);
  1830. }
  1831. else
  1832. {
  1833. format(msg, sizeof(msg), "House ID %d is no longer donated and can be sold.", houseid);
  1834. SendClientMessage(playerid, COLOR_GREY, msg);
  1835. }
  1836. return 1;
  1837. }
  1838. stock SetHouseInterior(houseid, level)
  1839. {
  1840. HouseInfo[houseid][hInterior] = houseInteriorInfo[level][hInteriorID];
  1841. HouseInfo[houseid][hLevel] = houseInteriorInfo[level][hLevel];
  1842. HouseInfo[houseid][hInsideX] = houseInteriorInfo[level][hX];
  1843. HouseInfo[houseid][hInsideY] = houseInteriorInfo[level][hY];
  1844. HouseInfo[houseid][hInsideZ] = houseInteriorInfo[level][hZ];
  1845. HouseInfo[houseid][hInsideA] = houseInteriorInfo[level][hA];
  1846. HouseInfo[houseid][hFreeze] = houseInteriorInfo[level][hFreeze];
  1847. HouseInfo[houseid][hModified] = 1;
  1848. return 1;
  1849. }
  1850. stock SetPlayerInHouseInterior(playerid, level)
  1851. {
  1852. PlayerInfo[playerid][pInt] = houseInteriorInfo[level][hInteriorID];
  1853. SetPlayerInterior(playerid, PlayerInfo[playerid][pInt]);
  1854. SetPlayerPos(playerid, houseInteriorInfo[level][hX], houseInteriorInfo[level][hY], houseInteriorInfo[level][hZ]);
  1855. SetPlayerFacingAngle(playerid, houseInteriorInfo[level][hA]);
  1856. return 1;
  1857. }
  1858. IsPlayerNearHouse(playerid)
  1859. {
  1860. for(new i = 0; i < MAX_HOUSES; i++)
  1861. {
  1862. if(IsPlayerInRangeOfPoint(playerid, 1.0, HouseInfo[i][hOutsideX], HouseInfo[i][hOutsideY], HouseInfo[i][hOutsideZ]))
  1863. {
  1864. return i;
  1865. }
  1866. }
  1867. return -1;
  1868. }