house13.pwn 107 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228
  1. /*
  2. Yet Another House System by rootcause
  3. Current Version: 1.3
  4. Topic: http://forum.sa-mp.com/showthread.php?p=3409290
  5. Changelog (v1.3):
  6. - Added house selling, you can put your houses for sale. When your house is bought by an another player, you'll receive your money.
  7. - Added a house buying limiter, a player can't buy more than LIMIT_PER_PLAYER houses. Set LIMIT_PER_PLAYER to 0 if you want no limits.
  8. - Internal changes like replacing GetPlayerName with Player_GetName or replacing the DIALOG_HOUSE+x format with e_dialogids enum.
  9. */
  10. #define FILTERSCRIPT
  11. #include <a_samp>
  12. #include <a_mysql>
  13. #include <streamer>
  14. #include <sscanf2>
  15. #include <YSI\y_iterate>
  16. #include <zcmd>
  17. #define MAX_HOUSES (100)
  18. #define MAX_HOUSE_NAME (48)
  19. #define MAX_HOUSE_PASSWORD (16)
  20. #define MAX_HOUSE_ADDRESS (48)
  21. #define MAX_INT_NAME (32)
  22. #define INVALID_HOUSE_ID (-1)
  23. #define HOUSE_COOLDOWN (6)
  24. #define LIMIT_PER_PLAYER (3)
  25. #define SQL_HOST "127.0.0.1"
  26. #define SQL_USER "root"
  27. #define SQL_PASSWORD ""
  28. #define SQL_DBNAME "housedb"
  29. enum _:e_lockmodes
  30. {
  31. LOCK_MODE_NOLOCK,
  32. LOCK_MODE_PASSWORD,
  33. LOCK_MODE_KEYS,
  34. LOCK_MODE_OWNER
  35. }
  36. enum _:e_selectmodes
  37. {
  38. SELECT_MODE_NONE,
  39. SELECT_MODE_EDIT,
  40. SELECT_MODE_SELL
  41. }
  42. enum _:e_dialogids
  43. {
  44. DIALOG_BUY_HOUSE = 7500,
  45. DIALOG_HOUSE_PASSWORD,
  46. DIALOG_HOUSE_MENU,
  47. DIALOG_HOUSE_NAME,
  48. DIALOG_HOUSE_NEW_PASSWORD,
  49. DIALOG_HOUSE_LOCK,
  50. DIALOG_SAFE_MENU,
  51. DIALOG_SAFE_TAKE,
  52. DIALOG_SAFE_PUT,
  53. DIALOG_GUNS_MENU,
  54. DIALOG_GUNS_TAKE,
  55. DIALOG_FURNITURE_MENU,
  56. DIALOG_FURNITURE_BUY,
  57. DIALOG_FURNITURE_SELL,
  58. DIALOG_VISITORS_MENU,
  59. DIALOG_VISITORS,
  60. DIALOG_KEYS_MENU,
  61. DIALOG_KEYS,
  62. DIALOG_SAFE_HISTORY,
  63. DIALOG_MY_KEYS,
  64. DIALOG_BUY_HOUSE_FROM_OWNER,
  65. DIALOG_SELL_HOUSE,
  66. DIALOG_SELLING_PRICE
  67. }
  68. enum e_house
  69. {
  70. Name[MAX_HOUSE_NAME],
  71. Owner[MAX_PLAYER_NAME],
  72. Password[MAX_HOUSE_PASSWORD],
  73. Address[MAX_HOUSE_ADDRESS],
  74. Float: houseX,
  75. Float: houseY,
  76. Float: houseZ,
  77. Price,
  78. SalePrice,
  79. Interior,
  80. LockMode,
  81. SafeMoney,
  82. LastEntered,
  83. Text3D: HouseLabel,
  84. HousePickup,
  85. HouseIcon,
  86. bool: Save
  87. };
  88. enum e_interior
  89. {
  90. IntName[MAX_INT_NAME],
  91. Float: intX,
  92. Float: intY,
  93. Float: intZ,
  94. intID,
  95. Text3D: intLabel,
  96. intPickup
  97. };
  98. enum e_furnituredata
  99. {
  100. ModelID,
  101. Name[32],
  102. Price
  103. };
  104. enum e_furniture
  105. {
  106. SQLID,
  107. HouseID,
  108. ArrayID,
  109. Float: furnitureX,
  110. Float: furnitureY,
  111. Float: furnitureZ,
  112. Float: furnitureRX,
  113. Float: furnitureRY,
  114. Float: furnitureRZ
  115. };
  116. enum e_sazone
  117. {
  118. SAZONE_NAME[28],
  119. Float: SAZONE_AREA[6]
  120. };
  121. new
  122. SQLHandle,
  123. HouseTimer = -1,
  124. HouseData[MAX_HOUSES][e_house],
  125. Iterator: Houses<MAX_HOUSES>,
  126. Iterator: HouseKeys[MAX_PLAYERS]<MAX_HOUSES>,
  127. InHouse[MAX_PLAYERS] = {INVALID_HOUSE_ID, ...},
  128. SelectMode[MAX_PLAYERS] = {SELECT_MODE_NONE, ...},
  129. LastVisitedHouse[MAX_PLAYERS] = {INVALID_HOUSE_ID, ...},
  130. ListPage[MAX_PLAYERS] = {0, ...},
  131. bool: EditingFurniture[MAX_PLAYERS] = {false, ...};
  132. new
  133. HouseInteriors[][e_interior] = {
  134. // int name, x, y, z, intid
  135. {"Interior 1", 2233.4900, -1114.4435, 1050.8828, 5},
  136. {"Interior 2", 2196.3943, -1204.1359, 1049.0234, 6},
  137. {"Interior 3", 2318.1616, -1026.3762, 1050.2109, 9},
  138. {"Interior 4", 421.8333, 2536.9814, 10.0000, 10},
  139. {"Interior 5", 225.5707, 1240.0643, 1082.1406, 2},
  140. {"Interior 6", 2496.2087, -1692.3149, 1014.7422, 3},
  141. {"Interior 7", 226.7545, 1114.4180, 1080.9952, 5},
  142. {"Interior 8", 2269.9636, -1210.3275, 1047.5625, 10}
  143. };
  144. new
  145. HouseFurnitures[][e_furnituredata] = {
  146. // modelid, furniture name, price
  147. {3111, "Building Plan", 500},
  148. {2894, "Book", 20},
  149. {2277, "Cat Picture", 100},
  150. {1753, "Leather Couch", 150},
  151. {1703, "Black Couch", 200},
  152. {1255, "Lounger", 75},
  153. {19581, "Frying Pan", 10},
  154. {19584, "Sauce Pan", 12},
  155. {19590, "Woozie's Sword", 1000},
  156. {19525, "Wedding Cake", 50},
  157. {1742, "Bookshelf", 80},
  158. {1518, "TV 1", 130},
  159. {19609, "Drum Kit", 500},
  160. {19787, "Small LCD TV", 2000},
  161. {19786, "Big LCD TV", 4000},
  162. {2627, "Treadmill", 130}
  163. };
  164. new
  165. SAZones[][e_sazone] = {
  166. {"The Big Ear", {-410.00,1403.30,-3.00,-137.90,1681.20,200.00}},
  167. {"Aldea Malvada", {-1372.10,2498.50,0.00,-1277.50,2615.30,200.00}},
  168. {"Angel Pine", {-2324.90,-2584.20,-6.10,-1964.20,-2212.10,200.00}},
  169. {"Arco del Oeste", {-901.10,2221.80,0.00,-592.00,2571.90,200.00}},
  170. {"Avispa Country Club", {-2646.40,-355.40,0.00,-2270.00,-222.50,200.00}},
  171. {"Avispa Country Club", {-2831.80,-430.20,-6.10,-2646.40,-222.50,200.00}},
  172. {"Avispa Country Club", {-2361.50,-417.10,0.00,-2270.00,-355.40,200.00}},
  173. {"Avispa Country Club", {-2667.80,-302.10,-28.80,-2646.40,-262.30,71.10}},
  174. {"Avispa Country Club", {-2470.00,-355.40,0.00,-2270.00,-318.40,46.10}},
  175. {"Avispa Country Club", {-2550.00,-355.40,0.00,-2470.00,-318.40,39.70}},
  176. {"Back o Beyond", {-1166.90,-2641.10,0.00,-321.70,-1856.00,200.00}},
  177. {"Battery Point", {-2741.00,1268.40,-4.50,-2533.00,1490.40,200.00}},
  178. {"Bayside", {-2741.00,2175.10,0.00,-2353.10,2722.70,200.00}},
  179. {"Bayside Marina", {-2353.10,2275.70,0.00,-2153.10,2475.70,200.00}},
  180. {"Beacon Hill", {-399.60,-1075.50,-1.40,-319.00,-977.50,198.50}},
  181. {"Blackfield", {964.30,1203.20,-89.00,1197.30,1403.20,110.90}},
  182. {"Blackfield", {964.30,1403.20,-89.00,1197.30,1726.20,110.90}},
  183. {"Blackfield Chapel", {1375.60,596.30,-89.00,1558.00,823.20,110.90}},
  184. {"Blackfield Chapel", {1325.60,596.30,-89.00,1375.60,795.00,110.90}},
  185. {"Blackfield Intersection", {1197.30,1044.60,-89.00,1277.00,1163.30,110.90}},
  186. {"Blackfield Intersection", {1166.50,795.00,-89.00,1375.60,1044.60,110.90}},
  187. {"Blackfield Intersection", {1277.00,1044.60,-89.00,1315.30,1087.60,110.90}},
  188. {"Blackfield Intersection", {1375.60,823.20,-89.00,1457.30,919.40,110.90}},
  189. {"Blueberry", {104.50,-220.10,2.30,349.60,152.20,200.00}},
  190. {"Blueberry", {19.60,-404.10,3.80,349.60,-220.10,200.00}},
  191. {"Blueberry Acres", {-319.60,-220.10,0.00,104.50,293.30,200.00}},
  192. {"Caligula's Palace", {2087.30,1543.20,-89.00,2437.30,1703.20,110.90}},
  193. {"Caligula's Palace", {2137.40,1703.20,-89.00,2437.30,1783.20,110.90}},
  194. {"Calton Heights", {-2274.10,744.10,-6.10,-1982.30,1358.90,200.00}},
  195. {"Chinatown", {-2274.10,578.30,-7.60,-2078.60,744.10,200.00}},
  196. {"City Hall", {-2867.80,277.40,-9.10,-2593.40,458.40,200.00}},
  197. {"Come-A-Lot", {2087.30,943.20,-89.00,2623.10,1203.20,110.90}},
  198. {"Commerce", {1323.90,-1842.20,-89.00,1701.90,-1722.20,110.90}},
  199. {"Commerce", {1323.90,-1722.20,-89.00,1440.90,-1577.50,110.90}},
  200. {"Commerce", {1370.80,-1577.50,-89.00,1463.90,-1384.90,110.90}},
  201. {"Commerce", {1463.90,-1577.50,-89.00,1667.90,-1430.80,110.90}},
  202. {"Commerce", {1583.50,-1722.20,-89.00,1758.90,-1577.50,110.90}},
  203. {"Commerce", {1667.90,-1577.50,-89.00,1812.60,-1430.80,110.90}},
  204. {"Conference Center", {1046.10,-1804.20,-89.00,1323.90,-1722.20,110.90}},
  205. {"Conference Center", {1073.20,-1842.20,-89.00,1323.90,-1804.20,110.90}},
  206. {"Cranberry Station", {-2007.80,56.30,0.00,-1922.00,224.70,100.00}},
  207. {"Creek", {2749.90,1937.20,-89.00,2921.60,2669.70,110.90}},
  208. {"Dillimore", {580.70,-674.80,-9.50,861.00,-404.70,200.00}},
  209. {"Doherty", {-2270.00,-324.10,-0.00,-1794.90,-222.50,200.00}},
  210. {"Doherty", {-2173.00,-222.50,-0.00,-1794.90,265.20,200.00}},
  211. {"Downtown", {-1982.30,744.10,-6.10,-1871.70,1274.20,200.00}},
  212. {"Downtown", {-1871.70,1176.40,-4.50,-1620.30,1274.20,200.00}},
  213. {"Downtown", {-1700.00,744.20,-6.10,-1580.00,1176.50,200.00}},
  214. {"Downtown", {-1580.00,744.20,-6.10,-1499.80,1025.90,200.00}},
  215. {"Downtown", {-2078.60,578.30,-7.60,-1499.80,744.20,200.00}},
  216. {"Downtown", {-1993.20,265.20,-9.10,-1794.90,578.30,200.00}},
  217. {"Downtown Los Santos", {1463.90,-1430.80,-89.00,1724.70,-1290.80,110.90}},
  218. {"Downtown Los Santos", {1724.70,-1430.80,-89.00,1812.60,-1250.90,110.90}},
  219. {"Downtown Los Santos", {1463.90,-1290.80,-89.00,1724.70,-1150.80,110.90}},
  220. {"Downtown Los Santos", {1370.80,-1384.90,-89.00,1463.90,-1170.80,110.90}},
  221. {"Downtown Los Santos", {1724.70,-1250.90,-89.00,1812.60,-1150.80,110.90}},
  222. {"Downtown Los Santos", {1370.80,-1170.80,-89.00,1463.90,-1130.80,110.90}},
  223. {"Downtown Los Santos", {1378.30,-1130.80,-89.00,1463.90,-1026.30,110.90}},
  224. {"Downtown Los Santos", {1391.00,-1026.30,-89.00,1463.90,-926.90,110.90}},
  225. {"Downtown Los Santos", {1507.50,-1385.20,110.90,1582.50,-1325.30,335.90}},
  226. {"East Beach", {2632.80,-1852.80,-89.00,2959.30,-1668.10,110.90}},
  227. {"East Beach", {2632.80,-1668.10,-89.00,2747.70,-1393.40,110.90}},
  228. {"East Beach", {2747.70,-1668.10,-89.00,2959.30,-1498.60,110.90}},
  229. {"East Beach", {2747.70,-1498.60,-89.00,2959.30,-1120.00,110.90}},
  230. {"East Los Santos", {2421.00,-1628.50,-89.00,2632.80,-1454.30,110.90}},
  231. {"East Los Santos", {2222.50,-1628.50,-89.00,2421.00,-1494.00,110.90}},
  232. {"East Los Santos", {2266.20,-1494.00,-89.00,2381.60,-1372.00,110.90}},
  233. {"East Los Santos", {2381.60,-1494.00,-89.00,2421.00,-1454.30,110.90}},
  234. {"East Los Santos", {2281.40,-1372.00,-89.00,2381.60,-1135.00,110.90}},
  235. {"East Los Santos", {2381.60,-1454.30,-89.00,2462.10,-1135.00,110.90}},
  236. {"East Los Santos", {2462.10,-1454.30,-89.00,2581.70,-1135.00,110.90}},
  237. {"Easter Basin", {-1794.90,249.90,-9.10,-1242.90,578.30,200.00}},
  238. {"Easter Basin", {-1794.90,-50.00,-0.00,-1499.80,249.90,200.00}},
  239. {"Easter Bay Airport", {-1499.80,-50.00,-0.00,-1242.90,249.90,200.00}},
  240. {"Easter Bay Airport", {-1794.90,-730.10,-3.00,-1213.90,-50.00,200.00}},
  241. {"Easter Bay Airport", {-1213.90,-730.10,0.00,-1132.80,-50.00,200.00}},
  242. {"Easter Bay Airport", {-1242.90,-50.00,0.00,-1213.90,578.30,200.00}},
  243. {"Easter Bay Airport", {-1213.90,-50.00,-4.50,-947.90,578.30,200.00}},
  244. {"Easter Bay Airport", {-1315.40,-405.30,15.40,-1264.40,-209.50,25.40}},
  245. {"Easter Bay Airport", {-1354.30,-287.30,15.40,-1315.40,-209.50,25.40}},
  246. {"Easter Bay Airport", {-1490.30,-209.50,15.40,-1264.40,-148.30,25.40}},
  247. {"Easter Bay Chemicals", {-1132.80,-768.00,0.00,-956.40,-578.10,200.00}},
  248. {"Easter Bay Chemicals", {-1132.80,-787.30,0.00,-956.40,-768.00,200.00}},
  249. {"El Castillo del Diablo", {-464.50,2217.60,0.00,-208.50,2580.30,200.00}},
  250. {"El Castillo del Diablo", {-208.50,2123.00,-7.60,114.00,2337.10,200.00}},
  251. {"El Castillo del Diablo", {-208.50,2337.10,0.00,8.40,2487.10,200.00}},
  252. {"El Corona", {1812.60,-2179.20,-89.00,1970.60,-1852.80,110.90}},
  253. {"El Corona", {1692.60,-2179.20,-89.00,1812.60,-1842.20,110.90}},
  254. {"El Quebrados", {-1645.20,2498.50,0.00,-1372.10,2777.80,200.00}},
  255. {"Esplanade East", {-1620.30,1176.50,-4.50,-1580.00,1274.20,200.00}},
  256. {"Esplanade East", {-1580.00,1025.90,-6.10,-1499.80,1274.20,200.00}},
  257. {"Esplanade East", {-1499.80,578.30,-79.60,-1339.80,1274.20,20.30}},
  258. {"Esplanade North", {-2533.00,1358.90,-4.50,-1996.60,1501.20,200.00}},
  259. {"Esplanade North", {-1996.60,1358.90,-4.50,-1524.20,1592.50,200.00}},
  260. {"Esplanade North", {-1982.30,1274.20,-4.50,-1524.20,1358.90,200.00}},
  261. {"Fallen Tree", {-792.20,-698.50,-5.30,-452.40,-380.00,200.00}},
  262. {"Fallow Bridge", {434.30,366.50,0.00,603.00,555.60,200.00}},
  263. {"Fern Ridge", {508.10,-139.20,0.00,1306.60,119.50,200.00}},
  264. {"Financial", {-1871.70,744.10,-6.10,-1701.30,1176.40,300.00}},
  265. {"Fisher's Lagoon", {1916.90,-233.30,-100.00,2131.70,13.80,200.00}},
  266. {"Flint Intersection", {-187.70,-1596.70,-89.00,17.00,-1276.60,110.90}},
  267. {"Flint Range", {-594.10,-1648.50,0.00,-187.70,-1276.60,200.00}},
  268. {"Fort Carson", {-376.20,826.30,-3.00,123.70,1220.40,200.00}},
  269. {"Foster Valley", {-2270.00,-430.20,-0.00,-2178.60,-324.10,200.00}},
  270. {"Foster Valley", {-2178.60,-599.80,-0.00,-1794.90,-324.10,200.00}},
  271. {"Foster Valley", {-2178.60,-1115.50,0.00,-1794.90,-599.80,200.00}},
  272. {"Foster Valley", {-2178.60,-1250.90,0.00,-1794.90,-1115.50,200.00}},
  273. {"Frederick Bridge", {2759.20,296.50,0.00,2774.20,594.70,200.00}},
  274. {"Gant Bridge", {-2741.40,1659.60,-6.10,-2616.40,2175.10,200.00}},
  275. {"Gant Bridge", {-2741.00,1490.40,-6.10,-2616.40,1659.60,200.00}},
  276. {"Ganton", {2222.50,-1852.80,-89.00,2632.80,-1722.30,110.90}},
  277. {"Ganton", {2222.50,-1722.30,-89.00,2632.80,-1628.50,110.90}},
  278. {"Garcia", {-2411.20,-222.50,-0.00,-2173.00,265.20,200.00}},
  279. {"Garcia", {-2395.10,-222.50,-5.30,-2354.00,-204.70,200.00}},
  280. {"Garver Bridge", {-1339.80,828.10,-89.00,-1213.90,1057.00,110.90}},
  281. {"Garver Bridge", {-1213.90,950.00,-89.00,-1087.90,1178.90,110.90}},
  282. {"Garver Bridge", {-1499.80,696.40,-179.60,-1339.80,925.30,20.30}},
  283. {"Glen Park", {1812.60,-1449.60,-89.00,1996.90,-1350.70,110.90}},
  284. {"Glen Park", {1812.60,-1100.80,-89.00,1994.30,-973.30,110.90}},
  285. {"Glen Park", {1812.60,-1350.70,-89.00,2056.80,-1100.80,110.90}},
  286. {"Green Palms", {176.50,1305.40,-3.00,338.60,1520.70,200.00}},
  287. {"Greenglass College", {964.30,1044.60,-89.00,1197.30,1203.20,110.90}},
  288. {"Greenglass College", {964.30,930.80,-89.00,1166.50,1044.60,110.90}},
  289. {"Hampton Barns", {603.00,264.30,0.00,761.90,366.50,200.00}},
  290. {"Hankypanky Point", {2576.90,62.10,0.00,2759.20,385.50,200.00}},
  291. {"Harry Gold Parkway", {1777.30,863.20,-89.00,1817.30,2342.80,110.90}},
  292. {"Hashbury", {-2593.40,-222.50,-0.00,-2411.20,54.70,200.00}},
  293. {"Hilltop Farm", {967.30,-450.30,-3.00,1176.70,-217.90,200.00}},
  294. {"Hunter Quarry", {337.20,710.80,-115.20,860.50,1031.70,203.70}},
  295. {"Idlewood", {1812.60,-1852.80,-89.00,1971.60,-1742.30,110.90}},
  296. {"Idlewood", {1812.60,-1742.30,-89.00,1951.60,-1602.30,110.90}},
  297. {"Idlewood", {1951.60,-1742.30,-89.00,2124.60,-1602.30,110.90}},
  298. {"Idlewood", {1812.60,-1602.30,-89.00,2124.60,-1449.60,110.90}},
  299. {"Idlewood", {2124.60,-1742.30,-89.00,2222.50,-1494.00,110.90}},
  300. {"Idlewood", {1971.60,-1852.80,-89.00,2222.50,-1742.30,110.90}},
  301. {"Jefferson", {1996.90,-1449.60,-89.00,2056.80,-1350.70,110.90}},
  302. {"Jefferson", {2124.60,-1494.00,-89.00,2266.20,-1449.60,110.90}},
  303. {"Jefferson", {2056.80,-1372.00,-89.00,2281.40,-1210.70,110.90}},
  304. {"Jefferson", {2056.80,-1210.70,-89.00,2185.30,-1126.30,110.90}},
  305. {"Jefferson", {2185.30,-1210.70,-89.00,2281.40,-1154.50,110.90}},
  306. {"Jefferson", {2056.80,-1449.60,-89.00,2266.20,-1372.00,110.90}},
  307. {"Julius Thruway East", {2623.10,943.20,-89.00,2749.90,1055.90,110.90}},
  308. {"Julius Thruway East", {2685.10,1055.90,-89.00,2749.90,2626.50,110.90}},
  309. {"Julius Thruway East", {2536.40,2442.50,-89.00,2685.10,2542.50,110.90}},
  310. {"Julius Thruway East", {2625.10,2202.70,-89.00,2685.10,2442.50,110.90}},
  311. {"Julius Thruway North", {2498.20,2542.50,-89.00,2685.10,2626.50,110.90}},
  312. {"Julius Thruway North", {2237.40,2542.50,-89.00,2498.20,2663.10,110.90}},
  313. {"Julius Thruway North", {2121.40,2508.20,-89.00,2237.40,2663.10,110.90}},
  314. {"Julius Thruway North", {1938.80,2508.20,-89.00,2121.40,2624.20,110.90}},
  315. {"Julius Thruway North", {1534.50,2433.20,-89.00,1848.40,2583.20,110.90}},
  316. {"Julius Thruway North", {1848.40,2478.40,-89.00,1938.80,2553.40,110.90}},
  317. {"Julius Thruway North", {1704.50,2342.80,-89.00,1848.40,2433.20,110.90}},
  318. {"Julius Thruway North", {1377.30,2433.20,-89.00,1534.50,2507.20,110.90}},
  319. {"Julius Thruway South", {1457.30,823.20,-89.00,2377.30,863.20,110.90}},
  320. {"Julius Thruway South", {2377.30,788.80,-89.00,2537.30,897.90,110.90}},
  321. {"Julius Thruway West", {1197.30,1163.30,-89.00,1236.60,2243.20,110.90}},
  322. {"Julius Thruway West", {1236.60,2142.80,-89.00,1297.40,2243.20,110.90}},
  323. {"Juniper Hill", {-2533.00,578.30,-7.60,-2274.10,968.30,200.00}},
  324. {"Juniper Hollow", {-2533.00,968.30,-6.10,-2274.10,1358.90,200.00}},
  325. {"K.A.C.C. Military Fuels", {2498.20,2626.50,-89.00,2749.90,2861.50,110.90}},
  326. {"Kincaid Bridge", {-1339.80,599.20,-89.00,-1213.90,828.10,110.90}},
  327. {"Kincaid Bridge", {-1213.90,721.10,-89.00,-1087.90,950.00,110.90}},
  328. {"Kincaid Bridge", {-1087.90,855.30,-89.00,-961.90,986.20,110.90}},
  329. {"King's", {-2329.30,458.40,-7.60,-1993.20,578.30,200.00}},
  330. {"King's", {-2411.20,265.20,-9.10,-1993.20,373.50,200.00}},
  331. {"King's", {-2253.50,373.50,-9.10,-1993.20,458.40,200.00}},
  332. {"LVA Freight Depot", {1457.30,863.20,-89.00,1777.40,1143.20,110.90}},
  333. {"LVA Freight Depot", {1375.60,919.40,-89.00,1457.30,1203.20,110.90}},
  334. {"LVA Freight Depot", {1277.00,1087.60,-89.00,1375.60,1203.20,110.90}},
  335. {"LVA Freight Depot", {1315.30,1044.60,-89.00,1375.60,1087.60,110.90}},
  336. {"LVA Freight Depot", {1236.60,1163.40,-89.00,1277.00,1203.20,110.90}},
  337. {"Las Barrancas", {-926.10,1398.70,-3.00,-719.20,1634.60,200.00}},
  338. {"Las Brujas", {-365.10,2123.00,-3.00,-208.50,2217.60,200.00}},
  339. {"Las Colinas", {1994.30,-1100.80,-89.00,2056.80,-920.80,110.90}},
  340. {"Las Colinas", {2056.80,-1126.30,-89.00,2126.80,-920.80,110.90}},
  341. {"Las Colinas", {2185.30,-1154.50,-89.00,2281.40,-934.40,110.90}},
  342. {"Las Colinas", {2126.80,-1126.30,-89.00,2185.30,-934.40,110.90}},
  343. {"Las Colinas", {2747.70,-1120.00,-89.00,2959.30,-945.00,110.90}},
  344. {"Las Colinas", {2632.70,-1135.00,-89.00,2747.70,-945.00,110.90}},
  345. {"Las Colinas", {2281.40,-1135.00,-89.00,2632.70,-945.00,110.90}},
  346. {"Las Payasadas", {-354.30,2580.30,2.00,-133.60,2816.80,200.00}},
  347. {"Las Venturas Airport", {1236.60,1203.20,-89.00,1457.30,1883.10,110.90}},
  348. {"Las Venturas Airport", {1457.30,1203.20,-89.00,1777.30,1883.10,110.90}},
  349. {"Las Venturas Airport", {1457.30,1143.20,-89.00,1777.40,1203.20,110.90}},
  350. {"Las Venturas Airport", {1515.80,1586.40,-12.50,1729.90,1714.50,87.50}},
  351. {"Last Dime Motel", {1823.00,596.30,-89.00,1997.20,823.20,110.90}},
  352. {"Leafy Hollow", {-1166.90,-1856.00,0.00,-815.60,-1602.00,200.00}},
  353. {"Liberty City", {-1000.00,400.00,1300.00,-700.00,600.00,1400.00}},
  354. {"Lil' Probe Inn", {-90.20,1286.80,-3.00,153.80,1554.10,200.00}},
  355. {"Linden Side", {2749.90,943.20,-89.00,2923.30,1198.90,110.90}},
  356. {"Linden Station", {2749.90,1198.90,-89.00,2923.30,1548.90,110.90}},
  357. {"Linden Station", {2811.20,1229.50,-39.50,2861.20,1407.50,60.40}},
  358. {"Little Mexico", {1701.90,-1842.20,-89.00,1812.60,-1722.20,110.90}},
  359. {"Little Mexico", {1758.90,-1722.20,-89.00,1812.60,-1577.50,110.90}},
  360. {"Los Flores", {2581.70,-1454.30,-89.00,2632.80,-1393.40,110.90}},
  361. {"Los Flores", {2581.70,-1393.40,-89.00,2747.70,-1135.00,110.90}},
  362. {"Los Santos International", {1249.60,-2394.30,-89.00,1852.00,-2179.20,110.90}},
  363. {"Los Santos International", {1852.00,-2394.30,-89.00,2089.00,-2179.20,110.90}},
  364. {"Los Santos International", {1382.70,-2730.80,-89.00,2201.80,-2394.30,110.90}},
  365. {"Los Santos International", {1974.60,-2394.30,-39.00,2089.00,-2256.50,60.90}},
  366. {"Los Santos International", {1400.90,-2669.20,-39.00,2189.80,-2597.20,60.90}},
  367. {"Los Santos International", {2051.60,-2597.20,-39.00,2152.40,-2394.30,60.90}},
  368. {"Marina", {647.70,-1804.20,-89.00,851.40,-1577.50,110.90}},
  369. {"Marina", {647.70,-1577.50,-89.00,807.90,-1416.20,110.90}},
  370. {"Marina", {807.90,-1577.50,-89.00,926.90,-1416.20,110.90}},
  371. {"Market", {787.40,-1416.20,-89.00,1072.60,-1310.20,110.90}},
  372. {"Market", {952.60,-1310.20,-89.00,1072.60,-1130.80,110.90}},
  373. {"Market", {1072.60,-1416.20,-89.00,1370.80,-1130.80,110.90}},
  374. {"Market", {926.90,-1577.50,-89.00,1370.80,-1416.20,110.90}},
  375. {"Market Station", {787.40,-1410.90,-34.10,866.00,-1310.20,65.80}},
  376. {"Martin Bridge", {-222.10,293.30,0.00,-122.10,476.40,200.00}},
  377. {"Missionary Hill", {-2994.40,-811.20,0.00,-2178.60,-430.20,200.00}},
  378. {"Montgomery", {1119.50,119.50,-3.00,1451.40,493.30,200.00}},
  379. {"Montgomery", {1451.40,347.40,-6.10,1582.40,420.80,200.00}},
  380. {"Montgomery Intersection", {1546.60,208.10,0.00,1745.80,347.40,200.00}},
  381. {"Montgomery Intersection", {1582.40,347.40,0.00,1664.60,401.70,200.00}},
  382. {"Mulholland", {1414.00,-768.00,-89.00,1667.60,-452.40,110.90}},
  383. {"Mulholland", {1281.10,-452.40,-89.00,1641.10,-290.90,110.90}},
  384. {"Mulholland", {1269.10,-768.00,-89.00,1414.00,-452.40,110.90}},
  385. {"Mulholland", {1357.00,-926.90,-89.00,1463.90,-768.00,110.90}},
  386. {"Mulholland", {1318.10,-910.10,-89.00,1357.00,-768.00,110.90}},
  387. {"Mulholland", {1169.10,-910.10,-89.00,1318.10,-768.00,110.90}},
  388. {"Mulholland", {768.60,-954.60,-89.00,952.60,-860.60,110.90}},
  389. {"Mulholland", {687.80,-860.60,-89.00,911.80,-768.00,110.90}},
  390. {"Mulholland", {737.50,-768.00,-89.00,1142.20,-674.80,110.90}},
  391. {"Mulholland", {1096.40,-910.10,-89.00,1169.10,-768.00,110.90}},
  392. {"Mulholland", {952.60,-937.10,-89.00,1096.40,-860.60,110.90}},
  393. {"Mulholland", {911.80,-860.60,-89.00,1096.40,-768.00,110.90}},
  394. {"Mulholland", {861.00,-674.80,-89.00,1156.50,-600.80,110.90}},
  395. {"Mulholland Intersection", {1463.90,-1150.80,-89.00,1812.60,-768.00,110.90}},
  396. {"North Rock", {2285.30,-768.00,0.00,2770.50,-269.70,200.00}},
  397. {"Ocean Docks", {2373.70,-2697.00,-89.00,2809.20,-2330.40,110.90}},
  398. {"Ocean Docks", {2201.80,-2418.30,-89.00,2324.00,-2095.00,110.90}},
  399. {"Ocean Docks", {2324.00,-2302.30,-89.00,2703.50,-2145.10,110.90}},
  400. {"Ocean Docks", {2089.00,-2394.30,-89.00,2201.80,-2235.80,110.90}},
  401. {"Ocean Docks", {2201.80,-2730.80,-89.00,2324.00,-2418.30,110.90}},
  402. {"Ocean Docks", {2703.50,-2302.30,-89.00,2959.30,-2126.90,110.90}},
  403. {"Ocean Docks", {2324.00,-2145.10,-89.00,2703.50,-2059.20,110.90}},
  404. {"Ocean Flats", {-2994.40,277.40,-9.10,-2867.80,458.40,200.00}},
  405. {"Ocean Flats", {-2994.40,-222.50,-0.00,-2593.40,277.40,200.00}},
  406. {"Ocean Flats", {-2994.40,-430.20,-0.00,-2831.80,-222.50,200.00}},
  407. {"Octane Springs", {338.60,1228.50,0.00,664.30,1655.00,200.00}},
  408. {"Old Venturas Strip", {2162.30,2012.10,-89.00,2685.10,2202.70,110.90}},
  409. {"Palisades", {-2994.40,458.40,-6.10,-2741.00,1339.60,200.00}},
  410. {"Palomino Creek", {2160.20,-149.00,0.00,2576.90,228.30,200.00}},
  411. {"Paradiso", {-2741.00,793.40,-6.10,-2533.00,1268.40,200.00}},
  412. {"Pershing Square", {1440.90,-1722.20,-89.00,1583.50,-1577.50,110.90}},
  413. {"Pilgrim", {2437.30,1383.20,-89.00,2624.40,1783.20,110.90}},
  414. {"Pilgrim", {2624.40,1383.20,-89.00,2685.10,1783.20,110.90}},
  415. {"Pilson Intersection", {1098.30,2243.20,-89.00,1377.30,2507.20,110.90}},
  416. {"Pirates in Men's Pants", {1817.30,1469.20,-89.00,2027.40,1703.20,110.90}},
  417. {"Playa del Seville", {2703.50,-2126.90,-89.00,2959.30,-1852.80,110.90}},
  418. {"Prickle Pine", {1534.50,2583.20,-89.00,1848.40,2863.20,110.90}},
  419. {"Prickle Pine", {1117.40,2507.20,-89.00,1534.50,2723.20,110.90}},
  420. {"Prickle Pine", {1848.40,2553.40,-89.00,1938.80,2863.20,110.90}},
  421. {"Prickle Pine", {1938.80,2624.20,-89.00,2121.40,2861.50,110.90}},
  422. {"Queens", {-2533.00,458.40,0.00,-2329.30,578.30,200.00}},
  423. {"Queens", {-2593.40,54.70,0.00,-2411.20,458.40,200.00}},
  424. {"Queens", {-2411.20,373.50,0.00,-2253.50,458.40,200.00}},
  425. {"Randolph Industrial Estate", {1558.00,596.30,-89.00,1823.00,823.20,110.90}},
  426. {"Redsands East", {1817.30,2011.80,-89.00,2106.70,2202.70,110.90}},
  427. {"Redsands East", {1817.30,2202.70,-89.00,2011.90,2342.80,110.90}},
  428. {"Redsands East", {1848.40,2342.80,-89.00,2011.90,2478.40,110.90}},
  429. {"Redsands West", {1236.60,1883.10,-89.00,1777.30,2142.80,110.90}},
  430. {"Redsands West", {1297.40,2142.80,-89.00,1777.30,2243.20,110.90}},
  431. {"Redsands West", {1377.30,2243.20,-89.00,1704.50,2433.20,110.90}},
  432. {"Redsands West", {1704.50,2243.20,-89.00,1777.30,2342.80,110.90}},
  433. {"Regular Tom", {-405.70,1712.80,-3.00,-276.70,1892.70,200.00}},
  434. {"Richman", {647.50,-1118.20,-89.00,787.40,-954.60,110.90}},
  435. {"Richman", {647.50,-954.60,-89.00,768.60,-860.60,110.90}},
  436. {"Richman", {225.10,-1369.60,-89.00,334.50,-1292.00,110.90}},
  437. {"Richman", {225.10,-1292.00,-89.00,466.20,-1235.00,110.90}},
  438. {"Richman", {72.60,-1404.90,-89.00,225.10,-1235.00,110.90}},
  439. {"Richman", {72.60,-1235.00,-89.00,321.30,-1008.10,110.90}},
  440. {"Richman", {321.30,-1235.00,-89.00,647.50,-1044.00,110.90}},
  441. {"Richman", {321.30,-1044.00,-89.00,647.50,-860.60,110.90}},
  442. {"Richman", {321.30,-860.60,-89.00,687.80,-768.00,110.90}},
  443. {"Richman", {321.30,-768.00,-89.00,700.70,-674.80,110.90}},
  444. {"Robada Intersection", {-1119.00,1178.90,-89.00,-862.00,1351.40,110.90}},
  445. {"Roca Escalante", {2237.40,2202.70,-89.00,2536.40,2542.50,110.90}},
  446. {"Roca Escalante", {2536.40,2202.70,-89.00,2625.10,2442.50,110.90}},
  447. {"Rockshore East", {2537.30,676.50,-89.00,2902.30,943.20,110.90}},
  448. {"Rockshore West", {1997.20,596.30,-89.00,2377.30,823.20,110.90}},
  449. {"Rockshore West", {2377.30,596.30,-89.00,2537.30,788.80,110.90}},
  450. {"Rodeo", {72.60,-1684.60,-89.00,225.10,-1544.10,110.90}},
  451. {"Rodeo", {72.60,-1544.10,-89.00,225.10,-1404.90,110.90}},
  452. {"Rodeo", {225.10,-1684.60,-89.00,312.80,-1501.90,110.90}},
  453. {"Rodeo", {225.10,-1501.90,-89.00,334.50,-1369.60,110.90}},
  454. {"Rodeo", {334.50,-1501.90,-89.00,422.60,-1406.00,110.90}},
  455. {"Rodeo", {312.80,-1684.60,-89.00,422.60,-1501.90,110.90}},
  456. {"Rodeo", {422.60,-1684.60,-89.00,558.00,-1570.20,110.90}},
  457. {"Rodeo", {558.00,-1684.60,-89.00,647.50,-1384.90,110.90}},
  458. {"Rodeo", {466.20,-1570.20,-89.00,558.00,-1385.00,110.90}},
  459. {"Rodeo", {422.60,-1570.20,-89.00,466.20,-1406.00,110.90}},
  460. {"Rodeo", {466.20,-1385.00,-89.00,647.50,-1235.00,110.90}},
  461. {"Rodeo", {334.50,-1406.00,-89.00,466.20,-1292.00,110.90}},
  462. {"Royal Casino", {2087.30,1383.20,-89.00,2437.30,1543.20,110.90}},
  463. {"San Andreas Sound", {2450.30,385.50,-100.00,2759.20,562.30,200.00}},
  464. {"Santa Flora", {-2741.00,458.40,-7.60,-2533.00,793.40,200.00}},
  465. {"Santa Maria Beach", {342.60,-2173.20,-89.00,647.70,-1684.60,110.90}},
  466. {"Santa Maria Beach", {72.60,-2173.20,-89.00,342.60,-1684.60,110.90}},
  467. {"Shady Cabin", {-1632.80,-2263.40,-3.00,-1601.30,-2231.70,200.00}},
  468. {"Shady Creeks", {-1820.60,-2643.60,-8.00,-1226.70,-1771.60,200.00}},
  469. {"Shady Creeks", {-2030.10,-2174.80,-6.10,-1820.60,-1771.60,200.00}},
  470. {"Sobell Rail Yards", {2749.90,1548.90,-89.00,2923.30,1937.20,110.90}},
  471. {"Spinybed", {2121.40,2663.10,-89.00,2498.20,2861.50,110.90}},
  472. {"Starfish Casino", {2437.30,1783.20,-89.00,2685.10,2012.10,110.90}},
  473. {"Starfish Casino", {2437.30,1858.10,-39.00,2495.00,1970.80,60.90}},
  474. {"Starfish Casino", {2162.30,1883.20,-89.00,2437.30,2012.10,110.90}},
  475. {"Temple", {1252.30,-1130.80,-89.00,1378.30,-1026.30,110.90}},
  476. {"Temple", {1252.30,-1026.30,-89.00,1391.00,-926.90,110.90}},
  477. {"Temple", {1252.30,-926.90,-89.00,1357.00,-910.10,110.90}},
  478. {"Temple", {952.60,-1130.80,-89.00,1096.40,-937.10,110.90}},
  479. {"Temple", {1096.40,-1130.80,-89.00,1252.30,-1026.30,110.90}},
  480. {"Temple", {1096.40,-1026.30,-89.00,1252.30,-910.10,110.90}},
  481. {"The Camel's Toe", {2087.30,1203.20,-89.00,2640.40,1383.20,110.90}},
  482. {"The Clown's Pocket", {2162.30,1783.20,-89.00,2437.30,1883.20,110.90}},
  483. {"The Emerald Isle", {2011.90,2202.70,-89.00,2237.40,2508.20,110.90}},
  484. {"The Farm", {-1209.60,-1317.10,114.90,-908.10,-787.30,251.90}},
  485. {"The Four Dragons Casino", {1817.30,863.20,-89.00,2027.30,1083.20,110.90}},
  486. {"The High Roller", {1817.30,1283.20,-89.00,2027.30,1469.20,110.90}},
  487. {"The Mako Span", {1664.60,401.70,0.00,1785.10,567.20,200.00}},
  488. {"The Panopticon", {-947.90,-304.30,-1.10,-319.60,327.00,200.00}},
  489. {"The Pink Swan", {1817.30,1083.20,-89.00,2027.30,1283.20,110.90}},
  490. {"The Sherman Dam", {-968.70,1929.40,-3.00,-481.10,2155.20,200.00}},
  491. {"The Strip", {2027.40,863.20,-89.00,2087.30,1703.20,110.90}},
  492. {"The Strip", {2106.70,1863.20,-89.00,2162.30,2202.70,110.90}},
  493. {"The Strip", {2027.40,1783.20,-89.00,2162.30,1863.20,110.90}},
  494. {"The Strip", {2027.40,1703.20,-89.00,2137.40,1783.20,110.90}},
  495. {"The Visage", {1817.30,1863.20,-89.00,2106.70,2011.80,110.90}},
  496. {"The Visage", {1817.30,1703.20,-89.00,2027.40,1863.20,110.90}},
  497. {"Unity Station", {1692.60,-1971.80,-20.40,1812.60,-1932.80,79.50}},
  498. {"Valle Ocultado", {-936.60,2611.40,2.00,-715.90,2847.90,200.00}},
  499. {"Verdant Bluffs", {930.20,-2488.40,-89.00,1249.60,-2006.70,110.90}},
  500. {"Verdant Bluffs", {1073.20,-2006.70,-89.00,1249.60,-1842.20,110.90}},
  501. {"Verdant Bluffs", {1249.60,-2179.20,-89.00,1692.60,-1842.20,110.90}},
  502. {"Verdant Meadows", {37.00,2337.10,-3.00,435.90,2677.90,200.00}},
  503. {"Verona Beach", {647.70,-2173.20,-89.00,930.20,-1804.20,110.90}},
  504. {"Verona Beach", {930.20,-2006.70,-89.00,1073.20,-1804.20,110.90}},
  505. {"Verona Beach", {851.40,-1804.20,-89.00,1046.10,-1577.50,110.90}},
  506. {"Verona Beach", {1161.50,-1722.20,-89.00,1323.90,-1577.50,110.90}},
  507. {"Verona Beach", {1046.10,-1722.20,-89.00,1161.50,-1577.50,110.90}},
  508. {"Vinewood", {787.40,-1310.20,-89.00,952.60,-1130.80,110.90}},
  509. {"Vinewood", {787.40,-1130.80,-89.00,952.60,-954.60,110.90}},
  510. {"Vinewood", {647.50,-1227.20,-89.00,787.40,-1118.20,110.90}},
  511. {"Vinewood", {647.70,-1416.20,-89.00,787.40,-1227.20,110.90}},
  512. {"Whitewood Estates", {883.30,1726.20,-89.00,1098.30,2507.20,110.90}},
  513. {"Whitewood Estates", {1098.30,1726.20,-89.00,1197.30,2243.20,110.90}},
  514. {"Willowfield", {1970.60,-2179.20,-89.00,2089.00,-1852.80,110.90}},
  515. {"Willowfield", {2089.00,-2235.80,-89.00,2201.80,-1989.90,110.90}},
  516. {"Willowfield", {2089.00,-1989.90,-89.00,2324.00,-1852.80,110.90}},
  517. {"Willowfield", {2201.80,-2095.00,-89.00,2324.00,-1989.90,110.90}},
  518. {"Willowfield", {2541.70,-1941.40,-89.00,2703.50,-1852.80,110.90}},
  519. {"Willowfield", {2324.00,-2059.20,-89.00,2541.70,-1852.80,110.90}},
  520. {"Willowfield", {2541.70,-2059.20,-89.00,2703.50,-1941.40,110.90}},
  521. {"Yellow Bell Station", {1377.40,2600.40,-21.90,1492.40,2687.30,78.00}},
  522. {"Los Santos", {44.60,-2892.90,-242.90,2997.00,-768.00,900.00}},
  523. {"Las Venturas", {869.40,596.30,-242.90,2997.00,2993.80,900.00}},
  524. {"Bone County", {-480.50,596.30,-242.90,869.40,2993.80,900.00}},
  525. {"Tierra Robada", {-2997.40,1659.60,-242.90,-480.50,2993.80,900.00}},
  526. {"Tierra Robada", {-1213.90,596.30,-242.90,-480.50,1659.60,900.00}},
  527. {"San Fierro", {-2997.40,-1115.50,-242.90,-1213.90,1659.60,900.00}},
  528. {"Red County", {-1213.90,-768.00,-242.90,2997.00,596.30,900.00}},
  529. {"Flint County", {-1213.90,-2892.90,-242.90,44.60,-768.00,900.00}},
  530. {"Whetstone", {-2997.40,-2892.90,-242.90,-1213.90,-1115.50,900.00}}
  531. };
  532. new
  533. LockNames[4][32] = {"{2ECC71}Not Locked", "{E74C3C}Password Locked", "{E74C3C}Requires Keys", "{E74C3C}Owner Only"},
  534. TransactionNames[2][16] = {"{E74C3C}Taken", "{2ECC71}Added"};
  535. stock LoadHouseKeys(playerid)
  536. {
  537. Iter_Clear(HouseKeys[playerid]);
  538. new query[72];
  539. mysql_format(SQLHandle, query, sizeof(query), "SELECT * FROM housekeys WHERE Player='%e'", Player_GetName(playerid));
  540. mysql_tquery(SQLHandle, query, "GiveHouseKeys", "i", playerid);
  541. return 1;
  542. }
  543. stock GetZoneName(Float: x, Float: y, Float: z)
  544. {
  545. new zone[28];
  546. for(new i = 0; i < sizeof(SAZones); i++)
  547. {
  548. if(x >= SAZones[i][SAZONE_AREA][0] && x <= SAZones[i][SAZONE_AREA][3] && y >= SAZones[i][SAZONE_AREA][1] && y <= SAZones[i][SAZONE_AREA][4] && z >= SAZones[i][SAZONE_AREA][2] && z <= SAZones[i][SAZONE_AREA][5])
  549. {
  550. strcat(zone, SAZones[i][SAZONE_NAME]);
  551. return zone;
  552. }
  553. }
  554. strcat(zone, "Unknown");
  555. return zone;
  556. }
  557. stock GetCityName(Float: x, Float: y, Float: z)
  558. {
  559. new city[28];
  560. for(new i = 356; i < sizeof(SAZones); i++)
  561. {
  562. if(x >= SAZones[i][SAZONE_AREA][0] && x <= SAZones[i][SAZONE_AREA][3] && y >= SAZones[i][SAZONE_AREA][1] && y <= SAZones[i][SAZONE_AREA][4] && z >= SAZones[i][SAZONE_AREA][2] && z <= SAZones[i][SAZONE_AREA][5])
  563. {
  564. strcat(city, SAZones[i][SAZONE_NAME]);
  565. return city;
  566. }
  567. }
  568. strcat(city, "San Andreas");
  569. return city;
  570. }
  571. stock convertNumber(value)
  572. {
  573. // http://forum.sa-mp.com/showthread.php?p=843781#post843781
  574. new string[24];
  575. format(string, sizeof(string), "%d", value);
  576. for(new i = (strlen(string) - 3); i > (value < 0 ? 1 : 0) ; i -= 3)
  577. {
  578. strins(string[i], ",", 0);
  579. }
  580. return string;
  581. }
  582. stock RemovePlayerWeapon(playerid, weapon)
  583. {
  584. new weapons[13], ammo[13];
  585. for(new i; i < 13; i++) GetPlayerWeaponData(playerid, i, weapons[i], ammo[i]);
  586. ResetPlayerWeapons(playerid);
  587. for(new i; i < 13; i++)
  588. {
  589. if(weapons[i] == weapon) continue;
  590. GivePlayerWeapon(playerid, weapons[i], ammo[i]);
  591. }
  592. return 1;
  593. }
  594. stock GetXYInFrontOfPlayer(playerid, &Float:x, &Float:y, Float:distance)
  595. {
  596. new Float: a;
  597. GetPlayerPos(playerid, x, y, a);
  598. GetPlayerFacingAngle(playerid, a);
  599. if (GetPlayerVehicleID(playerid)) GetVehicleZAngle(GetPlayerVehicleID(playerid), a);
  600. x += (distance * floatsin(-a, degrees));
  601. y += (distance * floatcos(-a, degrees));
  602. }
  603. stock Player_GetName(playerid)
  604. {
  605. new name[MAX_PLAYER_NAME];
  606. GetPlayerName(playerid, name, MAX_PLAYER_NAME);
  607. return name;
  608. }
  609. stock SendToHouse(playerid, id)
  610. {
  611. if(!Iter_Contains(Houses, id)) return 0;
  612. SetPVarInt(playerid, "HousePickupCooldown", gettime() + HOUSE_COOLDOWN);
  613. InHouse[playerid] = id;
  614. SetPlayerVirtualWorld(playerid, id);
  615. SetPlayerInterior(playerid, HouseInteriors[ HouseData[id][Interior] ][intID]);
  616. SetPlayerPos(playerid, HouseInteriors[ HouseData[id][Interior] ][intX], HouseInteriors[ HouseData[id][Interior] ][intY], HouseInteriors[ HouseData[id][Interior] ][intZ]);
  617. new string[128];
  618. format(string, sizeof(string), "Welcome to %s's house, %s{FFFFFF}!", HouseData[id][Owner], HouseData[id][Name]);
  619. SendClientMessage(playerid, 0xFFFFFFFF, string);
  620. if(!strcmp(HouseData[id][Owner], Player_GetName(playerid)))
  621. {
  622. HouseData[id][LastEntered] = gettime();
  623. HouseData[id][Save] = true;
  624. SendClientMessage(playerid, 0xFFFFFFFF, "Use {3498DB}/house {FFFFFF}to open the house menu.");
  625. }
  626. if(HouseData[id][LockMode] == LOCK_MODE_NOLOCK && LastVisitedHouse[playerid] != id)
  627. {
  628. new query[128];
  629. mysql_format(SQLHandle, query, sizeof(query), "INSERT INTO housevisitors SET HouseID=%d, Visitor='%e', Date=UNIX_TIMESTAMP()", id, Player_GetName(playerid));
  630. mysql_tquery(SQLHandle, query, "", "");
  631. LastVisitedHouse[playerid] = id;
  632. }
  633. return 1;
  634. }
  635. stock ShowHouseMenu(playerid)
  636. {
  637. if(strcmp(HouseData[ InHouse[playerid] ][Owner], Player_GetName(playerid))) return SendClientMessage(playerid, 0xE74C3CFF, "You're not the owner of this house.");
  638. new string[256], id = InHouse[playerid];
  639. format(string, sizeof(string), "House Name: %s\nPassword: %s\nLock: %s\nHouse Safe {2ECC71}($%s)\nFurnitures\nGuns\nVisitors\nKeys\nKick Everybody\nSell House", HouseData[id][Name], HouseData[id][Password], LockNames[ HouseData[id][LockMode] ], convertNumber(HouseData[id][SafeMoney]));
  640. ShowPlayerDialog(playerid, DIALOG_HOUSE_MENU, DIALOG_STYLE_LIST, HouseData[id][Name], string, "Select", "Close");
  641. return 1;
  642. }
  643. stock ResetHouse(id)
  644. {
  645. if(!Iter_Contains(Houses, id)) return 0;
  646. format(HouseData[id][Name], MAX_HOUSE_NAME, "House For Sale");
  647. format(HouseData[id][Owner], MAX_PLAYER_NAME, "-");
  648. format(HouseData[id][Password], MAX_HOUSE_PASSWORD, "-");
  649. HouseData[id][LockMode] = LOCK_MODE_NOLOCK;
  650. HouseData[id][SalePrice] = HouseData[id][SafeMoney] = HouseData[id][LastEntered] = 0;
  651. HouseData[id][Save] = true;
  652. new label[200];
  653. format(label, sizeof(label), "{2ECC71}House For Sale (ID: %d)\n{FFFFFF}%s\n{F1C40F}Price: {2ECC71}$%s", id, HouseInteriors[ HouseData[id][Interior] ][IntName], convertNumber(HouseData[id][Price]));
  654. UpdateDynamic3DTextLabelText(HouseData[id][HouseLabel], 0xFFFFFFFF, label);
  655. Streamer_SetIntData(STREAMER_TYPE_PICKUP, HouseData[id][HousePickup], E_STREAMER_MODEL_ID, 1273);
  656. Streamer_SetIntData(STREAMER_TYPE_MAP_ICON, HouseData[id][HouseIcon], E_STREAMER_TYPE, 31);
  657. foreach(new i : Player)
  658. {
  659. if(InHouse[i] == id)
  660. {
  661. SetPVarInt(i, "HousePickupCooldown", gettime() + HOUSE_COOLDOWN);
  662. SetPlayerVirtualWorld(i, 0);
  663. SetPlayerInterior(i, 0);
  664. SetPlayerPos(i, HouseData[id][houseX], HouseData[id][houseY], HouseData[id][houseZ]);
  665. InHouse[i] = INVALID_HOUSE_ID;
  666. }
  667. if(Iter_Contains(HouseKeys[i], id)) Iter_Remove(HouseKeys[i], id);
  668. }
  669. new query[64], data[e_furniture];
  670. mysql_format(SQLHandle, query, sizeof(query), "DELETE FROM houseguns WHERE HouseID=%d", id);
  671. mysql_tquery(SQLHandle, query, "", "");
  672. for(new i, maxval = Streamer_GetUpperBound(STREAMER_TYPE_OBJECT); i <= maxval; ++i)
  673. {
  674. if(!IsValidDynamicObject(i)) continue;
  675. Streamer_GetArrayData(STREAMER_TYPE_OBJECT, i, E_STREAMER_EXTRA_ID, data);
  676. if(data[SQLID] > 0 && data[HouseID] == id) DestroyDynamicObject(i);
  677. }
  678. mysql_format(SQLHandle, query, sizeof(query), "DELETE FROM housefurnitures WHERE HouseID=%d", id);
  679. mysql_tquery(SQLHandle, query, "", "");
  680. mysql_format(SQLHandle, query, sizeof(query), "DELETE FROM housevisitors WHERE HouseID=%d", id);
  681. mysql_tquery(SQLHandle, query, "", "");
  682. mysql_format(SQLHandle, query, sizeof(query), "DELETE FROM housekeys WHERE HouseID=%d", id);
  683. mysql_tquery(SQLHandle, query, "", "");
  684. mysql_format(SQLHandle, query, sizeof(query), "DELETE FROM housesafelogs WHERE HouseID=%d", id);
  685. mysql_tquery(SQLHandle, query, "", "");
  686. return 1;
  687. }
  688. stock SaveHouse(id)
  689. {
  690. if(!Iter_Contains(Houses, id)) return 0;
  691. new query[256];
  692. mysql_format(SQLHandle, query, sizeof(query), "UPDATE houses SET HouseName='%e', HouseOwner='%e', HousePassword='%e', HouseSalePrice=%d, HouseLock=%d, HouseMoney=%d, LastEntered=%d WHERE ID=%d",
  693. HouseData[id][Name], HouseData[id][Owner], HouseData[id][Password], HouseData[id][SalePrice], HouseData[id][LockMode], HouseData[id][SafeMoney], HouseData[id][LastEntered], id);
  694. mysql_tquery(SQLHandle, query, "", "");
  695. HouseData[id][Save] = false;
  696. return 1;
  697. }
  698. stock UpdateHouseLabel(id)
  699. {
  700. if(!Iter_Contains(Houses, id)) return 0;
  701. new label[256];
  702. if(!strcmp(HouseData[id][Owner], "-")) {
  703. format(label, sizeof(label), "{2ECC71}House For Sale (ID: %d)\n{FFFFFF}%s\n{F1C40F}Price: {2ECC71}$%s", id, HouseInteriors[ HouseData[id][Interior] ][IntName], convertNumber(HouseData[id][Price]));
  704. }else{
  705. if(HouseData[id][SalePrice] > 0) {
  706. format(label, sizeof(label), "{E67E22}%s's House For Sale (ID: %d)\n{FFFFFF}%s\n{FFFFFF}%s\n{F1C40F}Price: {2ECC71}$%s", HouseData[id][Owner], id, HouseData[id][Name], HouseInteriors[ HouseData[id][Interior] ][IntName], convertNumber(HouseData[id][SalePrice]));
  707. }else{
  708. format(label, sizeof(label), "{E67E22}%s's House (ID: %d)\n{FFFFFF}%s\n{FFFFFF}%s\n%s\n{FFFFFF}%s", HouseData[id][Owner], id, HouseData[id][Name], HouseInteriors[ HouseData[id][Interior] ][IntName], LockNames[ HouseData[id][LockMode] ], HouseData[id][Address]);
  709. }
  710. }
  711. UpdateDynamic3DTextLabelText(HouseData[id][HouseLabel], 0xFFFFFFFF, label);
  712. return 1;
  713. }
  714. stock House_PlayerInit(playerid)
  715. {
  716. InHouse[playerid] = LastVisitedHouse[playerid] = INVALID_HOUSE_ID;
  717. ListPage[playerid] = SelectMode[playerid] = SELECT_MODE_NONE;
  718. EditingFurniture[playerid] = false;
  719. LoadHouseKeys(playerid);
  720. return 1;
  721. }
  722. stock OwnedHouses(playerid)
  723. {
  724. #if LIMIT_PER_PLAYER != 0
  725. new count;
  726. foreach(new i : Houses) if(!strcmp(HouseData[i][Owner], Player_GetName(playerid), true)) count++;
  727. return count;
  728. #else
  729. return 0;
  730. #endif
  731. }
  732. forward ResetAndSaveHouses();
  733. forward LoadHouses();
  734. forward LoadFurnitures();
  735. forward GiveHouseKeys(playerid);
  736. forward HouseSaleMoney(playerid);
  737. public ResetAndSaveHouses()
  738. {
  739. foreach(new i : Houses)
  740. {
  741. if(HouseData[i][LastEntered] > 0 && gettime()-HouseData[i][LastEntered] > 604800) ResetHouse(i);
  742. if(HouseData[i][Save]) SaveHouse(i);
  743. }
  744. return 1;
  745. }
  746. public LoadHouses()
  747. {
  748. new rows = cache_num_rows();
  749. if(rows)
  750. {
  751. new id, loaded, for_sale, label[256];
  752. while(loaded < rows)
  753. {
  754. id = cache_get_field_content_int(loaded, "ID");
  755. cache_get_field_content(loaded, "HouseName", HouseData[id][Name], .max_len = MAX_HOUSE_NAME);
  756. cache_get_field_content(loaded, "HouseOwner", HouseData[id][Owner], .max_len = MAX_PLAYER_NAME);
  757. cache_get_field_content(loaded, "HousePassword", HouseData[id][Password], .max_len = MAX_HOUSE_PASSWORD);
  758. HouseData[id][houseX] = cache_get_field_content_float(loaded, "HouseX");
  759. HouseData[id][houseY] = cache_get_field_content_float(loaded, "HouseY");
  760. HouseData[id][houseZ] = cache_get_field_content_float(loaded, "HouseZ");
  761. HouseData[id][Price] = cache_get_field_content_int(loaded, "HousePrice");
  762. HouseData[id][SalePrice] = cache_get_field_content_int(loaded, "HouseSalePrice");
  763. HouseData[id][Interior] = cache_get_field_content_int(loaded, "HouseInterior");
  764. HouseData[id][LockMode] = cache_get_field_content_int(loaded, "HouseLock");
  765. HouseData[id][SafeMoney] = cache_get_field_content_int(loaded, "HouseMoney");
  766. HouseData[id][LastEntered] = cache_get_field_content_int(loaded, "LastEntered");
  767. format(HouseData[id][Address], MAX_HOUSE_ADDRESS, "%d, %s, %s", id, GetZoneName(HouseData[id][houseX], HouseData[id][houseY], HouseData[id][houseZ]), GetCityName(HouseData[id][houseX], HouseData[id][houseY], HouseData[id][houseZ]));
  768. if(strcmp(HouseData[id][Owner], "-")) {
  769. if(HouseData[id][SalePrice] > 0) {
  770. for_sale = 1;
  771. format(label, sizeof(label), "{E67E22}%s's House For Sale (ID: %d)\n{FFFFFF}%s\n{FFFFFF}%s\n{F1C40F}Price: {2ECC71}$%s", HouseData[id][Owner], id, HouseData[id][Name], HouseInteriors[ HouseData[id][Interior] ][IntName], convertNumber(HouseData[id][SalePrice]));
  772. }else{
  773. for_sale = 0;
  774. format(label, sizeof(label), "{E67E22}%s's House (ID: %d)\n{FFFFFF}%s\n{FFFFFF}%s\n%s\n{FFFFFF}%s", HouseData[id][Owner], id, HouseData[id][Name], HouseInteriors[ HouseData[id][Interior] ][IntName], LockNames[ HouseData[id][LockMode] ], HouseData[id][Address]);
  775. }
  776. }else{
  777. for_sale = 1;
  778. format(label, sizeof(label), "{2ECC71}House For Sale (ID: %d)\n{FFFFFF}%s\n{F1C40F}Price: {2ECC71}$%s", id, HouseInteriors[ HouseData[id][Interior] ][IntName], convertNumber(HouseData[id][Price]));
  779. }
  780. HouseData[id][HousePickup] = CreateDynamicPickup((!for_sale) ? 19522 : 1273, 1, HouseData[id][houseX], HouseData[id][houseY], HouseData[id][houseZ]);
  781. HouseData[id][HouseIcon] = CreateDynamicMapIcon(HouseData[id][houseX], HouseData[id][houseY], HouseData[id][houseZ], (!for_sale) ? 32 : 31, 0);
  782. HouseData[id][HouseLabel] = CreateDynamic3DTextLabel(label, 0xFFFFFFFF, HouseData[id][houseX], HouseData[id][houseY], HouseData[id][houseZ]+0.35, 15.0, .testlos = 1);
  783. Iter_Add(Houses, id);
  784. loaded++;
  785. }
  786. printf(" [House System] Loaded %d houses.", loaded);
  787. }
  788. return 1;
  789. }
  790. public LoadFurnitures()
  791. {
  792. new rows = cache_num_rows();
  793. if(rows)
  794. {
  795. new id, loaded, data[e_furniture];
  796. while(loaded < rows)
  797. {
  798. data[SQLID] = cache_get_field_content_int(loaded, "ID");
  799. data[HouseID] = cache_get_field_content_int(loaded, "HouseID");
  800. data[ArrayID] = cache_get_field_content_int(loaded, "FurnitureID");
  801. data[furnitureX] = cache_get_field_content_float(loaded, "FurnitureX");
  802. data[furnitureY] = cache_get_field_content_float(loaded, "FurnitureY");
  803. data[furnitureZ] = cache_get_field_content_float(loaded, "FurnitureZ");
  804. data[furnitureRX] = cache_get_field_content_float(loaded, "FurnitureRX");
  805. data[furnitureRY] = cache_get_field_content_float(loaded, "FurnitureRY");
  806. data[furnitureRZ] = cache_get_field_content_float(loaded, "FurnitureRZ");
  807. id = CreateDynamicObject(
  808. HouseFurnitures[ data[ArrayID] ][ModelID],
  809. data[furnitureX], data[furnitureY], data[furnitureZ],
  810. data[furnitureRX], data[furnitureRY], data[furnitureRZ],
  811. cache_get_field_content_int(loaded, "FurnitureVW"), cache_get_field_content_int(loaded, "FurnitureInt")
  812. );
  813. Streamer_SetArrayData(STREAMER_TYPE_OBJECT, id, E_STREAMER_EXTRA_ID, data);
  814. loaded++;
  815. }
  816. printf(" [House System] Loaded %d furnitures.", loaded);
  817. }
  818. return 1;
  819. }
  820. public GiveHouseKeys(playerid)
  821. {
  822. if(!IsPlayerConnected(playerid)) return 1;
  823. new rows = cache_num_rows();
  824. if(rows)
  825. {
  826. new loaded;
  827. while(loaded < rows)
  828. {
  829. Iter_Add(HouseKeys[playerid], cache_get_field_content_int(loaded, "HouseID"));
  830. loaded++;
  831. }
  832. }
  833. return 1;
  834. }
  835. public HouseSaleMoney(playerid)
  836. {
  837. new rows = cache_num_rows();
  838. if(rows)
  839. {
  840. new new_owner[MAX_PLAYER_NAME], price, string[128];
  841. for(new i; i < rows; i++)
  842. {
  843. cache_get_field_content(i, "NewOwner", new_owner);
  844. price = cache_get_field_content_int(i, "Price");
  845. format(string, sizeof(string), "You sold a house to %s for $%s. (Transaction ID: #%d)", new_owner, convertNumber(price), cache_get_field_content_int(i, "ID"));
  846. SendClientMessage(playerid, -1, string);
  847. GivePlayerMoney(playerid, price);
  848. }
  849. new query[128];
  850. mysql_format(SQLHandle, query, sizeof(query), "DELETE FROM housesales WHERE OldOwner='%e'", Player_GetName(playerid));
  851. mysql_tquery(SQLHandle, query, "", "");
  852. }
  853. return 1;
  854. }
  855. public OnFilterScriptInit()
  856. {
  857. for(new i; i < MAX_HOUSES; ++i)
  858. {
  859. HouseData[i][HouseLabel] = Text3D: INVALID_3DTEXT_ID;
  860. HouseData[i][HousePickup] = -1;
  861. HouseData[i][HouseIcon] = -1;
  862. HouseData[i][Save] = false;
  863. }
  864. for(new i; i < sizeof(HouseInteriors); ++i)
  865. {
  866. HouseInteriors[i][intLabel] = CreateDynamic3DTextLabel("Leave House", 0xE67E22FF, HouseInteriors[i][intX], HouseInteriors[i][intY], HouseInteriors[i][intZ]+0.35, 10.0, .testlos = 1, .interiorid = HouseInteriors[i][intID]);
  867. HouseInteriors[i][intPickup] = CreateDynamicPickup(1318, 1, HouseInteriors[i][intX], HouseInteriors[i][intY], HouseInteriors[i][intZ], .interiorid = HouseInteriors[i][intID]);
  868. }
  869. Iter_Init(HouseKeys);
  870. DisableInteriorEnterExits();
  871. SQLHandle = mysql_connect(SQL_HOST, SQL_USER, SQL_DBNAME, SQL_PASSWORD);
  872. mysql_log(LOG_ERROR | LOG_WARNING, LOG_TYPE_HTML);
  873. if(mysql_errno() != 0) return print(" [House System] Can't connect to MySQL.");
  874. /* Create Tables */
  875. new query[1024];
  876. strcat(query, "CREATE TABLE IF NOT EXISTS `houses` (\
  877. `ID` int(11) NOT NULL,\
  878. `HouseName` varchar(48) NOT NULL default 'House For Sale',\
  879. `HouseOwner` varchar(24) NOT NULL default '-',\
  880. `HousePassword` varchar(16) NOT NULL default '-',\
  881. `HouseX` float NOT NULL,\
  882. `HouseY` float NOT NULL,\
  883. `HouseZ` float NOT NULL,\
  884. `HousePrice` int(11) NOT NULL,\
  885. `HouseInterior` tinyint(4) NOT NULL default '0',\
  886. `HouseLock` tinyint(4) NOT NULL default '0',\
  887. `HouseMoney` int(11) NOT NULL default '0',"
  888. );
  889. strcat(query, "`LastEntered` int(11) NOT NULL,\
  890. PRIMARY KEY (`ID`),\
  891. UNIQUE KEY `ID_2` (`ID`),\
  892. KEY `ID` (`ID`)\
  893. ) ENGINE=InnoDB DEFAULT CHARSET=utf8;"
  894. );
  895. mysql_tquery(SQLHandle, query, "", "");
  896. mysql_tquery(SQLHandle, "CREATE TABLE IF NOT EXISTS `housefurnitures` (\
  897. `ID` int(11) NOT NULL auto_increment,\
  898. `HouseID` int(11) NOT NULL,\
  899. `FurnitureID` tinyint(11) NOT NULL,\
  900. `FurnitureX` float NOT NULL,\
  901. `FurnitureY` float NOT NULL,\
  902. `FurnitureZ` float NOT NULL,\
  903. `FurnitureRX` float NOT NULL,\
  904. `FurnitureRY` float NOT NULL,\
  905. `FurnitureRZ` float NOT NULL,\
  906. `FurnitureVW` int(11) NOT NULL,\
  907. `FurnitureInt` int(11) NOT NULL,\
  908. PRIMARY KEY (`ID`)\
  909. ) ENGINE=MyISAM DEFAULT CHARSET=utf8;", "", "");
  910. mysql_tquery(SQLHandle, "CREATE TABLE IF NOT EXISTS `houseguns` (\
  911. `HouseID` int(11) NOT NULL,\
  912. `WeaponID` tinyint(4) NOT NULL,\
  913. `Ammo` int(11) NOT NULL,\
  914. UNIQUE KEY `HouseID_2` (`HouseID`,`WeaponID`),\
  915. KEY `HouseID` (`HouseID`),\
  916. CONSTRAINT `houseguns_ibfk_1` FOREIGN KEY (`HouseID`) REFERENCES `houses` (`ID`) ON DELETE CASCADE ON UPDATE CASCADE\
  917. ) ENGINE=InnoDB DEFAULT CHARSET=utf8;", "", "");
  918. mysql_tquery(SQLHandle, "CREATE TABLE IF NOT EXISTS `housevisitors` (\
  919. `HouseID` int(11) NOT NULL,\
  920. `Visitor` varchar(24) NOT NULL,\
  921. `Date` int(11) NOT NULL\
  922. ) ENGINE=MyISAM DEFAULT CHARSET=utf8;", "", "");
  923. mysql_tquery(SQLHandle, "CREATE TABLE IF NOT EXISTS `housekeys` (\
  924. `HouseID` int(11) NOT NULL,\
  925. `Player` varchar(24) NOT NULL,\
  926. `Date` int(11) NOT NULL\
  927. ) ENGINE=MyISAM DEFAULT CHARSET=utf8;", "", "");
  928. mysql_tquery(SQLHandle, "CREATE TABLE IF NOT EXISTS `housesafelogs` (\
  929. `HouseID` int(11) NOT NULL,\
  930. `Type` int(11) NOT NULL,\
  931. `Amount` int(11) NOT NULL,\
  932. `Date` int(11) NOT NULL\
  933. ) ENGINE=MyISAM DEFAULT CHARSET=utf8;", "", "");
  934. mysql_tquery(SQLHandle, "CREATE TABLE IF NOT EXISTS `housesales` (\
  935. `ID` int(11) NOT NULL AUTO_INCREMENT,\
  936. `OldOwner` varchar(24) NOT NULL,\
  937. `NewOwner` varchar(24) NOT NULL,\
  938. `Price` int(11) NOT NULL,\
  939. PRIMARY KEY (`ID`)\
  940. ) ENGINE=MyISAM DEFAULT CHARSET=utf8;", "", "");
  941. // 1.3 update, add HouseSalePrice to the houses table
  942. if(!fexist("house_updated.txt"))
  943. {
  944. mysql_tquery(SQLHandle, "ALTER TABLE houses ADD HouseSalePrice INT(11) NOT NULL AFTER HousePrice");
  945. new File: updateFile = fopen("house_updated.txt", io_append);
  946. if(updateFile)
  947. {
  948. fwrite(updateFile, "Don't remove this file.");
  949. fclose(updateFile);
  950. }
  951. }
  952. /* Loading & Stuff */
  953. mysql_tquery(SQLHandle, "SELECT * FROM houses", "LoadHouses", "");
  954. mysql_tquery(SQLHandle, "SELECT * FROM housefurnitures", "LoadFurnitures", "");
  955. foreach(new i : Player) House_PlayerInit(i);
  956. HouseTimer = SetTimer("ResetAndSaveHouses", 10 * 60000, true);
  957. return 1;
  958. }
  959. public OnFilterScriptExit()
  960. {
  961. foreach(new i : Houses) if(HouseData[i][Save]) SaveHouse(i);
  962. KillTimer(HouseTimer);
  963. return 1;
  964. }
  965. public OnPlayerConnect(playerid)
  966. {
  967. House_PlayerInit(playerid);
  968. return 1;
  969. }
  970. public OnPlayerSpawn(playerid)
  971. {
  972. InHouse[playerid] = INVALID_HOUSE_ID;
  973. new query[128];
  974. mysql_format(SQLHandle, query, sizeof(query), "SELECT * FROM housesales WHERE OldOwner='%e'", Player_GetName(playerid));
  975. mysql_tquery(SQLHandle, query, "HouseSaleMoney", "i", playerid);
  976. return 1;
  977. }
  978. public OnPlayerPickUpDynamicPickup(playerid, pickupid)
  979. {
  980. if(GetPVarInt(playerid, "HousePickupCooldown") < gettime())
  981. {
  982. if(InHouse[playerid] == INVALID_HOUSE_ID) {
  983. foreach(new i : Houses)
  984. {
  985. if(pickupid == HouseData[i][HousePickup])
  986. {
  987. SetPVarInt(playerid, "HousePickupCooldown", gettime() + HOUSE_COOLDOWN);
  988. SetPVarInt(playerid, "PickupHouseID", i);
  989. if(!strcmp(HouseData[i][Owner], "-")) {
  990. new string[64];
  991. format(string, sizeof(string), "This house is for sale!\n\nPrice: {2ECC71}$%s", convertNumber(HouseData[i][Price]));
  992. ShowPlayerDialog(playerid, DIALOG_BUY_HOUSE, DIALOG_STYLE_MSGBOX, "House For Sale", string, "Buy", "Close");
  993. }else{
  994. if(HouseData[i][SalePrice] > 0 && strcmp(HouseData[i][Owner], Player_GetName(playerid)))
  995. {
  996. new string[64];
  997. format(string, sizeof(string), "This house is for sale!\n\nPrice: {2ECC71}$%s", convertNumber(HouseData[i][SalePrice]));
  998. ShowPlayerDialog(playerid, DIALOG_BUY_HOUSE_FROM_OWNER, DIALOG_STYLE_MSGBOX, "House For Sale", string, "Buy", "Close");
  999. return 1;
  1000. }
  1001. switch(HouseData[i][LockMode])
  1002. {
  1003. case LOCK_MODE_NOLOCK: SendToHouse(playerid, i);
  1004. case LOCK_MODE_PASSWORD: ShowPlayerDialog(playerid, DIALOG_HOUSE_PASSWORD, DIALOG_STYLE_INPUT, "House Password", "This house is password protected.\n\nEnter house password:", "Done", "Close");
  1005. case LOCK_MODE_KEYS:
  1006. {
  1007. new gotkeys = Iter_Contains(HouseKeys[playerid], i);
  1008. if(!gotkeys) if(!strcmp(HouseData[i][Owner], Player_GetName(playerid))) gotkeys = 1;
  1009. if(gotkeys) {
  1010. SendToHouse(playerid, i);
  1011. }else{
  1012. SendClientMessage(playerid, 0xE74C3CFF, "You don't have keys for this house, you can't enter.");
  1013. }
  1014. }
  1015. case LOCK_MODE_OWNER:
  1016. {
  1017. if(!strcmp(HouseData[i][Owner], Player_GetName(playerid))) {
  1018. SetPVarInt(playerid, "HousePickupCooldown", gettime() + HOUSE_COOLDOWN);
  1019. SendToHouse(playerid, i);
  1020. }else{
  1021. SendClientMessage(playerid, 0xE74C3CFF, "Sorry, only the owner can enter this house.");
  1022. }
  1023. }
  1024. }
  1025. }
  1026. return 1;
  1027. }
  1028. }
  1029. }else{
  1030. for(new i; i < sizeof(HouseInteriors); ++i)
  1031. {
  1032. if(pickupid == HouseInteriors[i][intPickup])
  1033. {
  1034. SetPVarInt(playerid, "HousePickupCooldown", gettime() + HOUSE_COOLDOWN);
  1035. SetPlayerVirtualWorld(playerid, 0);
  1036. SetPlayerInterior(playerid, 0);
  1037. SetPlayerPos(playerid, HouseData[ InHouse[playerid] ][houseX], HouseData[ InHouse[playerid] ][houseY], HouseData[ InHouse[playerid] ][houseZ]);
  1038. InHouse[playerid] = INVALID_HOUSE_ID;
  1039. return 1;
  1040. }
  1041. }
  1042. }
  1043. }
  1044. return 1;
  1045. }
  1046. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  1047. {
  1048. if(dialogid == DIALOG_BUY_HOUSE)
  1049. {
  1050. if(!response) return 1;
  1051. new id = GetPVarInt(playerid, "PickupHouseID");
  1052. if(!IsPlayerInRangeOfPoint(playerid, 2.0, HouseData[id][houseX], HouseData[id][houseY], HouseData[id][houseZ])) return SendClientMessage(playerid, 0xE74C3CFF, "You're not near any house.");
  1053. #if LIMIT_PER_PLAYER > 0
  1054. if(OwnedHouses(playerid) + 1 > LIMIT_PER_PLAYER) return SendClientMessage(playerid, 0xE74C3CFF, "You can't buy any more houses.");
  1055. #endif
  1056. if(HouseData[id][Price] > GetPlayerMoney(playerid)) return SendClientMessage(playerid, 0xE74C3CFF, "You can't afford this house.");
  1057. if(strcmp(HouseData[id][Owner], "-")) return SendClientMessage(playerid, 0xE74C3CFF, "Someone already owns this house.");
  1058. GivePlayerMoney(playerid, -HouseData[id][Price]);
  1059. GetPlayerName(playerid, HouseData[id][Owner], MAX_PLAYER_NAME);
  1060. HouseData[id][LastEntered] = gettime();
  1061. HouseData[id][Save] = true;
  1062. UpdateHouseLabel(id);
  1063. Streamer_SetIntData(STREAMER_TYPE_PICKUP, HouseData[id][HousePickup], E_STREAMER_MODEL_ID, 19522);
  1064. Streamer_SetIntData(STREAMER_TYPE_MAP_ICON, HouseData[id][HouseIcon], E_STREAMER_TYPE, 32);
  1065. SendToHouse(playerid, id);
  1066. return 1;
  1067. }
  1068. if(dialogid == DIALOG_HOUSE_PASSWORD)
  1069. {
  1070. if(!response) return 1;
  1071. new id = GetPVarInt(playerid, "PickupHouseID");
  1072. if(!IsPlayerInRangeOfPoint(playerid, 2.0, HouseData[id][houseX], HouseData[id][houseY], HouseData[id][houseZ])) return SendClientMessage(playerid, 0xE74C3CFF, "You're not near any house.");
  1073. if(!(1 <= strlen(inputtext) <= MAX_HOUSE_PASSWORD)) return ShowPlayerDialog(playerid, DIALOG_HOUSE_PASSWORD, DIALOG_STYLE_INPUT, "House Password", "This house is password protected.\n\nEnter house password:\n\n{E74C3C}The password you entered is either too short or too long.", "Try Again", "Close");
  1074. if(strcmp(HouseData[id][Password], inputtext)) return ShowPlayerDialog(playerid, DIALOG_HOUSE_PASSWORD, DIALOG_STYLE_INPUT, "House Password", "This house is password protected.\n\nEnter house password:\n\n{E74C3C}Wrong password.", "Try Again", "Close");
  1075. SendToHouse(playerid, id);
  1076. return 1;
  1077. }
  1078. if(dialogid == DIALOG_HOUSE_MENU)
  1079. {
  1080. if(!response) return 1;
  1081. new id = InHouse[playerid];
  1082. if(id == INVALID_HOUSE_ID) return SendClientMessage(playerid, 0xE74C3CFF, "You're not in a house.");
  1083. if(strcmp(HouseData[id][Owner], Player_GetName(playerid))) return SendClientMessage(playerid, 0xE74C3CFF, "You're not the owner of this house.");
  1084. if(listitem == 0) ShowPlayerDialog(playerid, DIALOG_HOUSE_NAME, DIALOG_STYLE_INPUT, "House Name", "Write a new name for this house:", "Change", "Back");
  1085. if(listitem == 1) ShowPlayerDialog(playerid, DIALOG_HOUSE_NEW_PASSWORD, DIALOG_STYLE_INPUT, "House Password", "Write a new password for this house:", "Change", "Back");
  1086. if(listitem == 2) ShowPlayerDialog(playerid, DIALOG_HOUSE_LOCK, DIALOG_STYLE_LIST, "House Lock", "Not Locked\nPassword Lock\nKeys\nOwner Only", "Change", "Back");
  1087. if(listitem == 3)
  1088. {
  1089. if(HouseData[id][SalePrice] > 0)
  1090. {
  1091. SendClientMessage(playerid, 0xE74C3CFF, "You can't use this feature while the house is for sale.");
  1092. return ShowHouseMenu(playerid);
  1093. }
  1094. new string[144];
  1095. format(string, sizeof(string), "Take Money From Safe {2ECC71}($%s)\nPut Money To Safe {2ECC71}($%s)\nView Safe History\nClear Safe History", convertNumber(HouseData[id][SafeMoney]), convertNumber(GetPlayerMoney(playerid)));
  1096. ShowPlayerDialog(playerid, DIALOG_SAFE_MENU, DIALOG_STYLE_LIST, "House Safe", string, "Choose", "Back");
  1097. }
  1098. if(listitem == 4)
  1099. {
  1100. if(HouseData[id][SalePrice] > 0)
  1101. {
  1102. SendClientMessage(playerid, 0xE74C3CFF, "You can't use this feature while the house is for sale.");
  1103. return ShowHouseMenu(playerid);
  1104. }
  1105. ShowPlayerDialog(playerid, DIALOG_FURNITURE_MENU, DIALOG_STYLE_LIST, "Furnitures", "Buy Furniture\nEdit Furniture\nSell Furniture\nSell All Furnitures", "Choose", "Back");
  1106. }
  1107. if(listitem == 5) ShowPlayerDialog(playerid, DIALOG_GUNS_MENU, DIALOG_STYLE_LIST, "Guns", "Put Gun\nTake Gun", "Choose", "Back");
  1108. if(listitem == 6)
  1109. {
  1110. ListPage[playerid] = 0;
  1111. ShowPlayerDialog(playerid, DIALOG_VISITORS_MENU, DIALOG_STYLE_LIST, "Visitors", "Look Visitor History\nClear Visitor History", "Choose", "Back");
  1112. }
  1113. if(listitem == 7)
  1114. {
  1115. ListPage[playerid] = 0;
  1116. ShowPlayerDialog(playerid, DIALOG_KEYS_MENU, DIALOG_STYLE_LIST, "Keys", "View Key Owners\nChange Locks", "Choose", "Back");
  1117. }
  1118. if(listitem == 8)
  1119. {
  1120. new string[128];
  1121. format(string, sizeof(string), "House owner %s kicked everybody from the house.", HouseData[id][Owner]);
  1122. foreach(new i : Player)
  1123. {
  1124. if(i == playerid) continue;
  1125. if(InHouse[i] == id)
  1126. {
  1127. SetPVarInt(i, "HousePickupCooldown", gettime() + HOUSE_COOLDOWN);
  1128. SetPlayerVirtualWorld(i, 0);
  1129. SetPlayerInterior(i, 0);
  1130. SetPlayerPos(i, HouseData[id][houseX], HouseData[id][houseY], HouseData[id][houseZ]);
  1131. InHouse[i] = INVALID_HOUSE_ID;
  1132. SendClientMessage(i, -1, string);
  1133. }
  1134. }
  1135. SendClientMessage(playerid, -1, "You kicked everybody from your house.");
  1136. }
  1137. if(listitem == 9)
  1138. {
  1139. new string[128];
  1140. format(string, sizeof(string), "Sell Instantly\t{2ECC71}$%s\n%s", convertNumber(floatround(HouseData[id][Price]*0.85)), (HouseData[id][SalePrice] > 0) ? ("Remove From Sale") : ("Put For Sale"));
  1141. ShowPlayerDialog(playerid, DIALOG_SELL_HOUSE, DIALOG_STYLE_TABLIST, "Sell House", string, "Choose", "Back");
  1142. }
  1143. return 1;
  1144. }
  1145. if(dialogid == DIALOG_HOUSE_NAME)
  1146. {
  1147. if(!response) return ShowHouseMenu(playerid);
  1148. new id = InHouse[playerid];
  1149. if(id == INVALID_HOUSE_ID) return SendClientMessage(playerid, 0xE74C3CFF, "You're not in a house.");
  1150. if(strcmp(HouseData[id][Owner], Player_GetName(playerid))) return SendClientMessage(playerid, 0xE74C3CFF, "You're not the owner of this house.");
  1151. if(!(1 <= strlen(inputtext) <= MAX_HOUSE_NAME)) return ShowPlayerDialog(playerid, DIALOG_HOUSE_NAME, DIALOG_STYLE_INPUT, "House Name", "Write a new name for this house:\n\n{E74C3C}The name you entered is either too short or too long.", "Change", "Back");
  1152. format(HouseData[id][Name], MAX_HOUSE_NAME, "%s", inputtext);
  1153. HouseData[id][Save] = true;
  1154. UpdateHouseLabel(id);
  1155. ShowHouseMenu(playerid);
  1156. return 1;
  1157. }
  1158. if(dialogid == DIALOG_HOUSE_NEW_PASSWORD)
  1159. {
  1160. if(!response) return ShowHouseMenu(playerid);
  1161. new id = InHouse[playerid];
  1162. if(id == INVALID_HOUSE_ID) return SendClientMessage(playerid, 0xE74C3CFF, "You're not in a house.");
  1163. if(strcmp(HouseData[id][Owner], Player_GetName(playerid))) return SendClientMessage(playerid, 0xE74C3CFF, "You're not the owner of this house.");
  1164. if(!(1 <= strlen(inputtext) <= MAX_HOUSE_PASSWORD)) return ShowPlayerDialog(playerid, DIALOG_HOUSE_NEW_PASSWORD, DIALOG_STYLE_INPUT, "House Password", "Write a new password for this house:\n\n{E74C3C}The pasword you entered is either too short or too long.", "Change", "Back");
  1165. format(HouseData[id][Password], MAX_HOUSE_PASSWORD, "%s", inputtext);
  1166. HouseData[id][Save] = true;
  1167. ShowHouseMenu(playerid);
  1168. return 1;
  1169. }
  1170. if(dialogid == DIALOG_HOUSE_LOCK)
  1171. {
  1172. if(!response) return ShowHouseMenu(playerid);
  1173. new id = InHouse[playerid];
  1174. if(id == INVALID_HOUSE_ID) return SendClientMessage(playerid, 0xE74C3CFF, "You're not in a house.");
  1175. if(strcmp(HouseData[id][Owner], Player_GetName(playerid))) return SendClientMessage(playerid, 0xE74C3CFF, "You're not the owner of this house.");
  1176. HouseData[id][LockMode] = listitem;
  1177. HouseData[id][Save] = true;
  1178. UpdateHouseLabel(id);
  1179. ShowHouseMenu(playerid);
  1180. return 1;
  1181. }
  1182. if(dialogid == DIALOG_SAFE_MENU)
  1183. {
  1184. if(!response) return ShowHouseMenu(playerid);
  1185. new id = InHouse[playerid];
  1186. if(id == INVALID_HOUSE_ID) return SendClientMessage(playerid, 0xE74C3CFF, "You're not in a house.");
  1187. if(strcmp(HouseData[id][Owner], Player_GetName(playerid))) return SendClientMessage(playerid, 0xE74C3CFF, "You're not the owner of this house.");
  1188. if(HouseData[id][SalePrice] > 0) return SendClientMessage(playerid, 0xE74C3CFF, "You can't use this feature while the house is for sale.");
  1189. if(listitem == 0) ShowPlayerDialog(playerid, DIALOG_SAFE_TAKE, DIALOG_STYLE_INPUT, "Safe: Take Money", "Write the amount you want to take from safe:", "Take", "Back");
  1190. if(listitem == 1) ShowPlayerDialog(playerid, DIALOG_SAFE_PUT, DIALOG_STYLE_INPUT, "Safe: Put Money", "Write the amount you want to put to safe:", "Put", "Back");
  1191. if(listitem == 2)
  1192. {
  1193. ListPage[playerid] = 0;
  1194. new query[200], Cache: safelog;
  1195. mysql_format(SQLHandle, query, sizeof(query), "SELECT Type, Amount, FROM_UNIXTIME(Date, '%%d/%%m/%%Y %%H:%%i') as TransactionDate FROM housesafelogs WHERE HouseID=%d ORDER BY Date DESC LIMIT 0, 15", id);
  1196. safelog = mysql_query(SQLHandle, query);
  1197. new rows = cache_num_rows();
  1198. if(rows) {
  1199. new list[1024], date[20];
  1200. format(list, sizeof(list), "Action\tDate\n");
  1201. for(new i; i < rows; ++i)
  1202. {
  1203. cache_get_field_content(i, "TransactionDate", date);
  1204. format(list, sizeof(list), "%s%s $%s\t{FFFFFF}%s\n", list, TransactionNames[ cache_get_field_content_int(i, "Type") ], convertNumber(cache_get_field_content_int(i, "Amount")), date);
  1205. }
  1206. ShowPlayerDialog(playerid, DIALOG_SAFE_HISTORY, DIALOG_STYLE_TABLIST_HEADERS, "Safe History (Page 1)", list, "Next", "Previous");
  1207. }else{
  1208. SendClientMessage(playerid, 0xE74C3CFF, "Can't find any safe history.");
  1209. }
  1210. cache_delete(safelog);
  1211. }
  1212. if(listitem == 3)
  1213. {
  1214. new query[64];
  1215. mysql_format(SQLHandle, query, sizeof(query), "DELETE FROM housesafelogs WHERE HouseID=%d", id);
  1216. mysql_tquery(SQLHandle, query, "", "");
  1217. ShowHouseMenu(playerid);
  1218. }
  1219. return 1;
  1220. }
  1221. if(dialogid == DIALOG_SAFE_TAKE)
  1222. {
  1223. if(!response) return ShowHouseMenu(playerid);
  1224. new id = InHouse[playerid];
  1225. if(id == INVALID_HOUSE_ID) return SendClientMessage(playerid, 0xE74C3CFF, "You're not in a house.");
  1226. if(strcmp(HouseData[id][Owner], Player_GetName(playerid))) return SendClientMessage(playerid, 0xE74C3CFF, "You're not the owner of this house.");
  1227. if(HouseData[id][SalePrice] > 0) return SendClientMessage(playerid, 0xE74C3CFF, "You can't use this feature while the house is for sale.");
  1228. new amount = strval(inputtext);
  1229. if(!(1 <= amount <= 10000000)) return ShowPlayerDialog(playerid, DIALOG_SAFE_TAKE, DIALOG_STYLE_INPUT, "Safe: Take Money", "Write the amount you want to take from safe:\n\n{E74C3C}Invalid amount. You can take between $1 - $10,000,000 at a time.", "Take", "Back");
  1230. if(amount > HouseData[id][SafeMoney]) return ShowPlayerDialog(playerid, DIALOG_SAFE_TAKE, DIALOG_STYLE_INPUT, "Safe: Take Money", "Write the amount you want to take from safe:\n\n{E74C3C}You don't have that much money in your safe.", "Take", "Back");
  1231. new query[128];
  1232. mysql_format(SQLHandle, query, sizeof(query), "INSERT INTO housesafelogs SET HouseID=%d, Type=0, Amount=%d, Date=UNIX_TIMESTAMP()", id, amount);
  1233. mysql_tquery(SQLHandle, query, "", "");
  1234. GivePlayerMoney(playerid, amount);
  1235. HouseData[id][SafeMoney] -= amount;
  1236. HouseData[id][Save] = true;
  1237. ShowHouseMenu(playerid);
  1238. return 1;
  1239. }
  1240. if(dialogid == DIALOG_SAFE_PUT)
  1241. {
  1242. if(!response) return ShowHouseMenu(playerid);
  1243. new id = InHouse[playerid];
  1244. if(id == INVALID_HOUSE_ID) return SendClientMessage(playerid, 0xE74C3CFF, "You're not in a house.");
  1245. if(strcmp(HouseData[id][Owner], Player_GetName(playerid))) return SendClientMessage(playerid, 0xE74C3CFF, "You're not the owner of this house.");
  1246. new amount = strval(inputtext);
  1247. if(!(1 <= amount <= 10000000)) return ShowPlayerDialog(playerid, DIALOG_SAFE_PUT, DIALOG_STYLE_INPUT, "Safe: Put Money", "Write the amount you want to put to safe:\n\n{E74C3C}Invalid amount. You can put between $1 - $10,000,000 at a time.", "Put", "Back");
  1248. if(amount > GetPlayerMoney(playerid)) return ShowPlayerDialog(playerid, DIALOG_SAFE_PUT, DIALOG_STYLE_INPUT, "Safe: Put Money", "Write the amount you want to put to safe:\n\n{E74C3C}You don't have that much money on you.", "Put", "Back");
  1249. new query[128];
  1250. mysql_format(SQLHandle, query, sizeof(query), "INSERT INTO housesafelogs SET HouseID=%d, Type=1, Amount=%d, Date=UNIX_TIMESTAMP()", id, amount);
  1251. mysql_tquery(SQLHandle, query, "", "");
  1252. GivePlayerMoney(playerid, -amount);
  1253. HouseData[id][SafeMoney] += amount;
  1254. HouseData[id][Save] = true;
  1255. ShowHouseMenu(playerid);
  1256. return 1;
  1257. }
  1258. if(dialogid == DIALOG_GUNS_MENU)
  1259. {
  1260. if(!response) return ShowHouseMenu(playerid);
  1261. new id = InHouse[playerid];
  1262. if(id == INVALID_HOUSE_ID) return SendClientMessage(playerid, 0xE74C3CFF, "You're not in a house.");
  1263. if(strcmp(HouseData[id][Owner], Player_GetName(playerid))) return SendClientMessage(playerid, 0xE74C3CFF, "You're not the owner of this house.");
  1264. if(listitem == 0)
  1265. {
  1266. if(GetPlayerWeapon(playerid) == 0) return SendClientMessage(playerid, 0xE74C3CFF, "You can't put your fists in your house.");
  1267. new query[128], weapon = GetPlayerWeapon(playerid), 60000 = GetPlayerAmmo(playerid);
  1268. RemovePlayerWeapon(playerid, weapon);
  1269. mysql_format(SQLHandle, query, sizeof(query), "INSERT INTO houseguns VALUES (%d, %d, %d) ON DUPLICATE KEY UPDATE 60000", id, weapon, 60000, 60000);
  1270. mysql_tquery(SQLHandle, query, "", "");
  1271. ShowHouseMenu(playerid);
  1272. }
  1273. if(listitem == 1)
  1274. {
  1275. new query[80], Cache: weapons;
  1276. mysql_format(SQLHandle, query, sizeof(query), "SELECT WeaponID, Ammo FROM houseguns WHERE HouseID=%d ORDER BY WeaponID ASC", id);
  1277. weapons = mysql_query(SQLHandle, query);
  1278. new rows = cache_num_rows();
  1279. if(rows) {
  1280. new list[512], weapname[32];
  1281. format(list, sizeof(list), "#\tWeapon Name\t\n");
  1282. for(new i; i < rows; ++i)
  1283. {
  1284. GetWeaponName(cache_get_field_content_int(i, "WeaponID"), weapname, sizeof(weapname));
  1285. format(list, sizeof(list), "%s%d\t%s\t%s\n", list, i+1, weapname, convertNumber(cache_get_field_content_int(i, 60000)));
  1286. }
  1287. ShowPlayerDialog(playerid, DIALOG_GUNS_TAKE, DIALOG_STYLE_TABLIST_HEADERS, "House Guns", list, "Take", "Back");
  1288. }else{
  1289. SendClientMessage(playerid, 0xE74C3CFF, "You don't have any guns in your house.");
  1290. }
  1291. cache_delete(weapons);
  1292. }
  1293. return 1;
  1294. }
  1295. if(dialogid == DIALOG_GUNS_TAKE)
  1296. {
  1297. if(!response) return ShowHouseMenu(playerid);
  1298. new id = InHouse[playerid];
  1299. if(id == INVALID_HOUSE_ID) return SendClientMessage(playerid, 0xE74C3CFF, "You're not in a house.");
  1300. if(strcmp(HouseData[id][Owner], Player_GetName(playerid))) return SendClientMessage(playerid, 0xE74C3CFF, "You're not the owner of this house.");
  1301. new query[96], Cache: weapon;
  1302. mysql_format(SQLHandle, query, sizeof(query), "SELECT WeaponID, Ammo FROM houseguns WHERE HouseID=%d ORDER BY WeaponID ASC LIMIT %d, 1", id, listitem);
  1303. weapon = mysql_query(SQLHandle, query);
  1304. new rows = cache_num_rows();
  1305. if(rows) {
  1306. new string[64], weapname[32], weaponid = cache_get_field_content_int(0, "WeaponID");
  1307. GetWeaponName(weaponid, weapname, sizeof(weapname));
  1308. GivePlayerWeapon(playerid, weaponid, cache_get_field_content_int(0, 60000));
  1309. format(string, sizeof(string), "You've taken a %s from your house.", weapname);
  1310. SendClientMessage(playerid, 0xFFFFFFFF, string);
  1311. mysql_format(SQLHandle, query, sizeof(query), "DELETE FROM houseguns WHERE HouseID=%d AND WeaponID=%d", id, weaponid);
  1312. mysql_tquery(SQLHandle, query, "", "");
  1313. }else{
  1314. SendClientMessage(playerid, 0xE74C3CFF, "Can't find that weapon.");
  1315. }
  1316. cache_delete(weapon);
  1317. return 1;
  1318. }
  1319. if(dialogid == DIALOG_FURNITURE_MENU)
  1320. {
  1321. if(!response) return ShowHouseMenu(playerid);
  1322. new id = InHouse[playerid];
  1323. if(id == INVALID_HOUSE_ID) return SendClientMessage(playerid, 0xE74C3CFF, "You're not in a house.");
  1324. if(strcmp(HouseData[id][Owner], Player_GetName(playerid))) return SendClientMessage(playerid, 0xE74C3CFF, "You're not the owner of this house.");
  1325. if(HouseData[id][SalePrice] > 0) return SendClientMessage(playerid, 0xE74C3CFF, "You can't use this feature while the house is for sale.");
  1326. if(listitem == 0)
  1327. {
  1328. new list[512];
  1329. format(list, sizeof(list), "#\tFurniture Name\tPrice\n");
  1330. for(new i; i < sizeof(HouseFurnitures); ++i)
  1331. {
  1332. format(list, sizeof(list), "%s%d\t%s\t$%s\n", list, i+1, HouseFurnitures[i][Name], convertNumber(HouseFurnitures[i][Price]));
  1333. }
  1334. ShowPlayerDialog(playerid, DIALOG_FURNITURE_BUY, DIALOG_STYLE_TABLIST_HEADERS, "Buy Furniture", list, "Buy", "Back");
  1335. }
  1336. if(listitem == 1)
  1337. {
  1338. SelectMode[playerid] = SELECT_MODE_EDIT;
  1339. SelectObject(playerid);
  1340. SendClientMessage(playerid, 0xFFFFFFFF, "Click on the furniture you want to edit.");
  1341. }
  1342. if(listitem == 2)
  1343. {
  1344. SelectMode[playerid] = SELECT_MODE_SELL;
  1345. SelectObject(playerid);
  1346. SendClientMessage(playerid, 0xFFFFFFFF, "Click on the furniture you want to sell.");
  1347. }
  1348. if(listitem == 3)
  1349. {
  1350. new money, sold, data[e_furniture], query[64];
  1351. for(new i; i < Streamer_GetUpperBound(STREAMER_TYPE_OBJECT); ++i)
  1352. {
  1353. if(!IsValidDynamicObject(i)) continue;
  1354. Streamer_GetArrayData(STREAMER_TYPE_OBJECT, i, E_STREAMER_EXTRA_ID, data);
  1355. if(data[SQLID] > 0 && data[HouseID] == id)
  1356. {
  1357. sold++;
  1358. money += HouseFurnitures[ data[ArrayID] ][Price];
  1359. DestroyDynamicObject(i);
  1360. }
  1361. }
  1362. new string[64];
  1363. format(string, sizeof(string), "Sold %d furnitures for $%s.", sold, convertNumber(money));
  1364. SendClientMessage(playerid, -1, string);
  1365. GivePlayerMoney(playerid, money);
  1366. mysql_format(SQLHandle, query, sizeof(query), "DELETE FROM housefurnitures WHERE HouseID=%d", id);
  1367. mysql_tquery(SQLHandle, query, "", "");
  1368. }
  1369. return 1;
  1370. }
  1371. if(dialogid == DIALOG_FURNITURE_BUY)
  1372. {
  1373. if(!response) return ShowHouseMenu(playerid);
  1374. new id = InHouse[playerid];
  1375. if(id == INVALID_HOUSE_ID) return SendClientMessage(playerid, 0xE74C3CFF, "You're not in a house.");
  1376. if(strcmp(HouseData[id][Owner], Player_GetName(playerid))) return SendClientMessage(playerid, 0xE74C3CFF, "You're not the owner of this house.");
  1377. if(HouseData[id][SalePrice] > 0) return SendClientMessage(playerid, 0xE74C3CFF, "You can't use this feature while the house is for sale.");
  1378. if(HouseFurnitures[listitem][Price] > GetPlayerMoney(playerid)) return SendClientMessage(playerid, 0xE74C3CFF, "You can't afford this furniture.");
  1379. GivePlayerMoney(playerid, -HouseFurnitures[listitem][Price]);
  1380. new Float: x, Float: y, Float: z;
  1381. GetPlayerPos(playerid, x, y, z);
  1382. GetXYInFrontOfPlayer(playerid, x, y, 3.0);
  1383. new objectid = CreateDynamicObject(HouseFurnitures[listitem][ModelID], x, y, z, 0.0, 0.0, 0.0, GetPlayerVirtualWorld(playerid), GetPlayerInterior(playerid)), query[256];
  1384. mysql_format(SQLHandle, query, sizeof(query), "INSERT INTO housefurnitures SET HouseID=%d, FurnitureID=%d, FurnitureX=%f, FurnitureY=%f, FurnitureZ=%f, FurnitureVW=%d, FurnitureInt=%d", id, listitem, x, y, z, GetPlayerVirtualWorld(playerid), GetPlayerInterior(playerid));
  1385. new Cache: add = mysql_query(SQLHandle, query), data[e_furniture];
  1386. data[SQLID] = cache_insert_id();
  1387. data[HouseID] = id;
  1388. data[ArrayID] = listitem;
  1389. data[furnitureX] = x;
  1390. data[furnitureY] = y;
  1391. data[furnitureZ] = z;
  1392. data[furnitureRX] = 0.0;
  1393. data[furnitureRY] = 0.0;
  1394. data[furnitureRZ] = 0.0;
  1395. cache_delete(add);
  1396. Streamer_SetArrayData(STREAMER_TYPE_OBJECT, objectid, E_STREAMER_EXTRA_ID, data);
  1397. EditingFurniture[playerid] = true;
  1398. EditDynamicObject(playerid, objectid);
  1399. return 1;
  1400. }
  1401. if(dialogid == DIALOG_FURNITURE_SELL)
  1402. {
  1403. if(!response) return 1;
  1404. new id = InHouse[playerid];
  1405. if(id == INVALID_HOUSE_ID) return SendClientMessage(playerid, 0xE74C3CFF, "You're not in a house.");
  1406. if(strcmp(HouseData[id][Owner], Player_GetName(playerid))) return SendClientMessage(playerid, 0xE74C3CFF, "You're not the owner of this house.");
  1407. if(HouseData[id][SalePrice] > 0) return SendClientMessage(playerid, 0xE74C3CFF, "You can't use this feature while the house is for sale.");
  1408. new objectid = GetPVarInt(playerid, "SelectedFurniture"), query[64], data[e_furniture];
  1409. Streamer_GetArrayData(STREAMER_TYPE_OBJECT, objectid, E_STREAMER_EXTRA_ID, data);
  1410. GivePlayerMoney(playerid, HouseFurnitures[ data[ArrayID] ][Price]);
  1411. mysql_format(SQLHandle, query, sizeof(query), "DELETE FROM housefurnitures WHERE ID=%d", data[SQLID]);
  1412. mysql_tquery(SQLHandle, query, "", "");
  1413. DestroyDynamicObject(objectid);
  1414. DeletePVar(playerid, "SelectedFurniture");
  1415. return 1;
  1416. }
  1417. if(dialogid == DIALOG_VISITORS_MENU)
  1418. {
  1419. if(!response) return ShowHouseMenu(playerid);
  1420. new id = InHouse[playerid];
  1421. if(id == INVALID_HOUSE_ID) return SendClientMessage(playerid, 0xE74C3CFF, "You're not in a house.");
  1422. if(strcmp(HouseData[id][Owner], Player_GetName(playerid))) return SendClientMessage(playerid, 0xE74C3CFF, "You're not the owner of this house.");
  1423. if(listitem == 0)
  1424. {
  1425. new query[200], Cache: visitors;
  1426. mysql_format(SQLHandle, query, sizeof(query), "SELECT Visitor, FROM_UNIXTIME(Date, '%%d/%%m/%%Y %%H:%%i') as VisitDate FROM housevisitors WHERE HouseID=%d ORDER BY Date DESC LIMIT 0, 15", id);
  1427. visitors = mysql_query(SQLHandle, query);
  1428. new rows = cache_num_rows();
  1429. if(rows) {
  1430. new list[1024], visitor_name[MAX_PLAYER_NAME], visit_date[20];
  1431. format(list, sizeof(list), "Visitor Name\tDate\n");
  1432. for(new i; i < rows; ++i)
  1433. {
  1434. cache_get_field_content(i, "Visitor", visitor_name);
  1435. cache_get_field_content(i, "VisitDate", visit_date);
  1436. format(list, sizeof(list), "%s%s\t%s\n", list, visitor_name, visit_date);
  1437. }
  1438. ShowPlayerDialog(playerid, DIALOG_VISITORS, DIALOG_STYLE_TABLIST_HEADERS, "House Visitors (Page 1)", list, "Next", "Previous");
  1439. }else{
  1440. SendClientMessage(playerid, 0xE74C3CFF, "You didn't had any visitors.");
  1441. }
  1442. cache_delete(visitors);
  1443. }
  1444. if(listitem == 1)
  1445. {
  1446. new query[64];
  1447. mysql_format(SQLHandle, query, sizeof(query), "DELETE FROM housevisitors WHERE HouseID=%d", id);
  1448. mysql_tquery(SQLHandle, query, "", "");
  1449. ShowHouseMenu(playerid);
  1450. }
  1451. return 1;
  1452. }
  1453. if(dialogid == DIALOG_VISITORS)
  1454. {
  1455. if(!response) {
  1456. ListPage[playerid]--;
  1457. if(ListPage[playerid] < 0)
  1458. {
  1459. ListPage[playerid] = 0;
  1460. ShowHouseMenu(playerid);
  1461. return 1;
  1462. }
  1463. }else{
  1464. ListPage[playerid]++;
  1465. }
  1466. new id = InHouse[playerid];
  1467. if(id == INVALID_HOUSE_ID) return SendClientMessage(playerid, 0xE74C3CFF, "You're not in a house.");
  1468. if(strcmp(HouseData[id][Owner], Player_GetName(playerid))) return SendClientMessage(playerid, 0xE74C3CFF, "You're not the owner of this house.");
  1469. new query[200], Cache: visitors;
  1470. mysql_format(SQLHandle, query, sizeof(query), "SELECT Visitor, FROM_UNIXTIME(Date, '%%d/%%m/%%Y %%H:%%i') as VisitDate FROM housevisitors WHERE HouseID=%d ORDER BY Date DESC LIMIT %d, 15", id, ListPage[playerid]*15);
  1471. visitors = mysql_query(SQLHandle, query);
  1472. new rows = cache_num_rows();
  1473. if(rows) {
  1474. new list[1024], visitor_name[MAX_PLAYER_NAME], visit_date[20];
  1475. format(list, sizeof(list), "Visitor Name\tDate\n");
  1476. for(new i; i < rows; ++i)
  1477. {
  1478. cache_get_field_content(i, "Visitor", visitor_name);
  1479. cache_get_field_content(i, "VisitDate", visit_date);
  1480. format(list, sizeof(list), "%s%s\t%s\n", list, visitor_name, visit_date);
  1481. }
  1482. new title[32];
  1483. format(title, sizeof(title), "House Visitors (Page %d)", ListPage[playerid]+1);
  1484. ShowPlayerDialog(playerid, DIALOG_VISITORS, DIALOG_STYLE_TABLIST_HEADERS, title, list, "Next", "Previous");
  1485. }else{
  1486. SendClientMessage(playerid, 0xE74C3CFF, "Can't find any more visitors.");
  1487. ListPage[playerid] = 0;
  1488. ShowHouseMenu(playerid);
  1489. }
  1490. cache_delete(visitors);
  1491. return 1;
  1492. }
  1493. if(dialogid == DIALOG_KEYS_MENU)
  1494. {
  1495. if(!response) return ShowHouseMenu(playerid);
  1496. new id = InHouse[playerid];
  1497. if(id == INVALID_HOUSE_ID) return SendClientMessage(playerid, 0xE74C3CFF, "You're not in a house.");
  1498. if(strcmp(HouseData[id][Owner], Player_GetName(playerid))) return SendClientMessage(playerid, 0xE74C3CFF, "You're not the owner of this house.");
  1499. if(listitem == 0)
  1500. {
  1501. new query[200], Cache: keyowners;
  1502. mysql_format(SQLHandle, query, sizeof(query), "SELECT Player, FROM_UNIXTIME(Date, '%%d/%%m/%%Y %%H:%%i') as KeyDate FROM housekeys WHERE HouseID=%d ORDER BY Date DESC LIMIT %d, 15", id, ListPage[playerid]*15);
  1503. keyowners = mysql_query(SQLHandle, query);
  1504. new rows = cache_num_rows();
  1505. if(rows) {
  1506. new list[1024], key_name[MAX_PLAYER_NAME], key_date[20];
  1507. format(list, sizeof(list), "Key Owner\tKey Given On\n");
  1508. for(new i; i < rows; ++i)
  1509. {
  1510. cache_get_field_content(i, "Player", key_name);
  1511. cache_get_field_content(i, "KeyDate", key_date);
  1512. format(list, sizeof(list), "%s%s\t%s\n", list, key_name, key_date);
  1513. }
  1514. ShowPlayerDialog(playerid, DIALOG_KEYS, DIALOG_STYLE_TABLIST_HEADERS, "Key Owners (Page 1)", list, "Next", "Previous");
  1515. }else{
  1516. SendClientMessage(playerid, 0xE74C3CFF, "Can't find any key owners.");
  1517. }
  1518. cache_delete(keyowners);
  1519. }
  1520. if(listitem == 1)
  1521. {
  1522. foreach(new i : Player)
  1523. {
  1524. if(Iter_Contains(HouseKeys[i], id)) Iter_Remove(HouseKeys[i], id);
  1525. }
  1526. new query[64];
  1527. mysql_format(SQLHandle, query, sizeof(query), "DELETE FROM housekeys WHERE HouseID=%d", id);
  1528. mysql_tquery(SQLHandle, query, "", "");
  1529. ShowHouseMenu(playerid);
  1530. }
  1531. return 1;
  1532. }
  1533. if(dialogid == DIALOG_KEYS)
  1534. {
  1535. if(!response) {
  1536. ListPage[playerid]--;
  1537. if(ListPage[playerid] < 0)
  1538. {
  1539. ListPage[playerid] = 0;
  1540. ShowHouseMenu(playerid);
  1541. return 1;
  1542. }
  1543. }else{
  1544. ListPage[playerid]++;
  1545. }
  1546. new id = InHouse[playerid];
  1547. if(id == INVALID_HOUSE_ID) return SendClientMessage(playerid, 0xE74C3CFF, "You're not in a house.");
  1548. if(strcmp(HouseData[id][Owner], Player_GetName(playerid))) return SendClientMessage(playerid, 0xE74C3CFF, "You're not the owner of this house.");
  1549. new query[200], Cache: keyowners;
  1550. mysql_format(SQLHandle, query, sizeof(query), "SELECT Player, FROM_UNIXTIME(Date, '%%d/%%m/%%Y %%H:%%i') as KeyDate FROM housekeys WHERE HouseID=%d ORDER BY Date DESC LIMIT %d, 15", id, ListPage[playerid]*15);
  1551. keyowners = mysql_query(SQLHandle, query);
  1552. new rows = cache_num_rows();
  1553. if(rows) {
  1554. new list[1024], key_name[MAX_PLAYER_NAME], key_date[20];
  1555. format(list, sizeof(list), "Key Owner\tKey Given On\n");
  1556. for(new i; i < rows; ++i)
  1557. {
  1558. cache_get_field_content(i, "Player", key_name);
  1559. cache_get_field_content(i, "KeyDate", key_date);
  1560. format(list, sizeof(list), "%s%s\t%s\n", list, key_name, key_date);
  1561. }
  1562. new title[32];
  1563. format(title, sizeof(title), "Key Owners (Page %d)", ListPage[playerid]+1);
  1564. ShowPlayerDialog(playerid, DIALOG_KEYS, DIALOG_STYLE_TABLIST_HEADERS, title, list, "Next", "Previous");
  1565. }else{
  1566. ListPage[playerid] = 0;
  1567. ShowHouseMenu(playerid);
  1568. SendClientMessage(playerid, 0xE74C3CFF, "Can't find any more key owners.");
  1569. }
  1570. cache_delete(keyowners);
  1571. return 1;
  1572. }
  1573. if(dialogid == DIALOG_SAFE_HISTORY)
  1574. {
  1575. if(!response) {
  1576. ListPage[playerid]--;
  1577. if(ListPage[playerid] < 0)
  1578. {
  1579. ListPage[playerid] = 0;
  1580. ShowHouseMenu(playerid);
  1581. return 1;
  1582. }
  1583. }else{
  1584. ListPage[playerid]++;
  1585. }
  1586. new id = InHouse[playerid];
  1587. if(id == INVALID_HOUSE_ID) return SendClientMessage(playerid, 0xE74C3CFF, "You're not in a house.");
  1588. if(strcmp(HouseData[id][Owner], Player_GetName(playerid))) return SendClientMessage(playerid, 0xE74C3CFF, "You're not the owner of this house.");
  1589. new query[200], Cache: safelog;
  1590. mysql_format(SQLHandle, query, sizeof(query), "SELECT Type, Amount, FROM_UNIXTIME(Date, '%%d/%%m/%%Y %%H:%%i') as TransactionDate FROM housesafelogs WHERE HouseID=%d ORDER BY Date DESC LIMIT %d, 15", id, ListPage[playerid]*15);
  1591. safelog = mysql_query(SQLHandle, query);
  1592. new rows = cache_num_rows();
  1593. if(rows) {
  1594. new list[1024], date[20];
  1595. format(list, sizeof(list), "Action\tDate\n");
  1596. for(new i; i < rows; ++i)
  1597. {
  1598. cache_get_field_content(i, "TransactionDate", date);
  1599. format(list, sizeof(list), "%s%s $%s\t{FFFFFF}%s\n", list, TransactionNames[ cache_get_field_content_int(i, "Type") ], convertNumber(cache_get_field_content_int(i, "Amount")), date);
  1600. }
  1601. new title[32];
  1602. format(title, sizeof(title), "Safe History (Page %d)", ListPage[playerid]+1);
  1603. ShowPlayerDialog(playerid, DIALOG_SAFE_HISTORY, DIALOG_STYLE_TABLIST_HEADERS, title, list, "Next", "Previous");
  1604. }else{
  1605. SendClientMessage(playerid, 0xE74C3CFF, "Can't find any more safe history.");
  1606. }
  1607. cache_delete(safelog);
  1608. return 1;
  1609. }
  1610. if(dialogid == DIALOG_MY_KEYS)
  1611. {
  1612. if(!response) {
  1613. ListPage[playerid]--;
  1614. if(ListPage[playerid] < 0)
  1615. {
  1616. ListPage[playerid] = 0;
  1617. return 1;
  1618. }
  1619. }else{
  1620. ListPage[playerid]++;
  1621. }
  1622. new query[200], Cache: mykeys;
  1623. mysql_format(SQLHandle, query, sizeof(query), "SELECT HouseID, FROM_UNIXTIME(Date, '%%d/%%m/%%Y %%H:%%i') as KeyDate FROM housekeys WHERE Player='%e' ORDER BY Date DESC LIMIT %d, 15", Player_GetName(playerid), ListPage[playerid]*15);
  1624. mykeys = mysql_query(SQLHandle, query);
  1625. new rows = cache_num_rows();
  1626. if(rows) {
  1627. new list[1024], id, key_date[20];
  1628. format(list, sizeof(list), "House Info\tKey Given On\n");
  1629. for(new i; i < rows; ++i)
  1630. {
  1631. id = cache_get_field_content_int(i, "HouseID");
  1632. cache_get_field_content(i, "KeyDate", key_date);
  1633. format(list, sizeof(list), "%s%s's %s\t%s\n", list, HouseData[id][Owner], HouseData[id][Name], key_date);
  1634. }
  1635. new title[32];
  1636. format(title, sizeof(title), "My Keys (Page %d)", ListPage[playerid]+1);
  1637. ShowPlayerDialog(playerid, DIALOG_MY_KEYS, DIALOG_STYLE_TABLIST_HEADERS, title, list, "Next", "Previous");
  1638. }else{
  1639. ListPage[playerid] = 0;
  1640. SendClientMessage(playerid, 0xE74C3CFF, "Can't find any more keys.");
  1641. }
  1642. cache_delete(mykeys);
  1643. return 1;
  1644. }
  1645. if(dialogid == DIALOG_BUY_HOUSE_FROM_OWNER)
  1646. {
  1647. if(!response) return 1;
  1648. new id = GetPVarInt(playerid, "PickupHouseID");
  1649. if(!IsPlayerInRangeOfPoint(playerid, 2.0, HouseData[id][houseX], HouseData[id][houseY], HouseData[id][houseZ])) return SendClientMessage(playerid, 0xE74C3CFF, "You're not near any house.");
  1650. #if LIMIT_PER_PLAYER > 0
  1651. if(OwnedHouses(playerid) + 1 > LIMIT_PER_PLAYER) return SendClientMessage(playerid, 0xE74C3CFF, "You can't buy any more houses.");
  1652. #endif
  1653. if(HouseData[id][SalePrice] > GetPlayerMoney(playerid)) return SendClientMessage(playerid, 0xE74C3CFF, "You can't afford this house.");
  1654. if(HouseData[id][SalePrice] < 1) return SendClientMessage(playerid, 0xE74C3CFF, "Someone already owns this house.");
  1655. new old_owner[MAX_PLAYER_NAME], price = HouseData[id][SalePrice], owner_id = INVALID_PLAYER_ID;
  1656. format(old_owner, MAX_PLAYER_NAME, "%s", HouseData[id][Owner]);
  1657. foreach(new i : Player)
  1658. {
  1659. if(!strcmp(HouseData[id][Owner], Player_GetName(i)))
  1660. {
  1661. owner_id = i;
  1662. break;
  1663. }
  1664. }
  1665. GivePlayerMoney(playerid, -HouseData[id][SalePrice]);
  1666. GetPlayerName(playerid, HouseData[id][Owner], MAX_PLAYER_NAME);
  1667. HouseData[id][LastEntered] = gettime();
  1668. HouseData[id][SalePrice] = 0;
  1669. HouseData[id][Save] = true;
  1670. UpdateHouseLabel(id);
  1671. Streamer_SetIntData(STREAMER_TYPE_PICKUP, HouseData[id][HousePickup], E_STREAMER_MODEL_ID, 19522);
  1672. Streamer_SetIntData(STREAMER_TYPE_MAP_ICON, HouseData[id][HouseIcon], E_STREAMER_TYPE, 32);
  1673. SendToHouse(playerid, id);
  1674. foreach(new i : Player)
  1675. {
  1676. if(i == playerid) continue;
  1677. if(InHouse[i] == id)
  1678. {
  1679. SetPVarInt(i, "HousePickupCooldown", gettime() + HOUSE_COOLDOWN);
  1680. SetPlayerVirtualWorld(i, 0);
  1681. SetPlayerInterior(i, 0);
  1682. SetPlayerPos(i, HouseData[id][houseX], HouseData[id][houseY], HouseData[id][houseZ]);
  1683. InHouse[i] = INVALID_HOUSE_ID;
  1684. }
  1685. if(Iter_Contains(HouseKeys[i], id)) Iter_Remove(HouseKeys[i], id);
  1686. }
  1687. new query[128];
  1688. if(IsPlayerConnected(owner_id)) {
  1689. GivePlayerMoney(owner_id, price);
  1690. new string[128];
  1691. format(string, sizeof(string), "%s(%d) has bought your house for $%s.", HouseData[id][Owner], playerid, convertNumber(price));
  1692. SendClientMessage(owner_id, -1, string);
  1693. }else{
  1694. mysql_format(SQLHandle, query, sizeof(query), "INSERT INTO housesales SET OldOwner='%e', NewOwner='%e', Price=%d", old_owner, HouseData[id][Owner], price);
  1695. mysql_tquery(SQLHandle, query, "", "");
  1696. }
  1697. mysql_format(SQLHandle, query, sizeof(query), "DELETE FROM housevisitors WHERE HouseID=%d", id);
  1698. mysql_tquery(SQLHandle, query, "", "");
  1699. mysql_format(SQLHandle, query, sizeof(query), "DELETE FROM housekeys WHERE HouseID=%d", id);
  1700. mysql_tquery(SQLHandle, query, "", "");
  1701. mysql_format(SQLHandle, query, sizeof(query), "DELETE FROM housesafelogs WHERE HouseID=%d", id);
  1702. mysql_tquery(SQLHandle, query, "", "");
  1703. return 1;
  1704. }
  1705. if(dialogid == DIALOG_SELL_HOUSE)
  1706. {
  1707. if(!response) return ShowHouseMenu(playerid);
  1708. new id = InHouse[playerid];
  1709. if(id == INVALID_HOUSE_ID) return SendClientMessage(playerid, 0xE74C3CFF, "You're not in a house.");
  1710. if(strcmp(HouseData[id][Owner], Player_GetName(playerid))) return SendClientMessage(playerid, 0xE74C3CFF, "You're not the owner of this house.");
  1711. if(listitem == 0)
  1712. {
  1713. new money = floatround(HouseData[id][Price] * 0.85) + HouseData[id][SafeMoney];
  1714. GivePlayerMoney(playerid, money);
  1715. ResetHouse(id);
  1716. }
  1717. if(listitem == 1)
  1718. {
  1719. if(HouseData[id][SalePrice] > 0) {
  1720. HouseData[id][SalePrice] = 0;
  1721. HouseData[id][Save] = true;
  1722. UpdateHouseLabel(id);
  1723. Streamer_SetIntData(STREAMER_TYPE_PICKUP, HouseData[id][HousePickup], E_STREAMER_MODEL_ID, 19522);
  1724. Streamer_SetIntData(STREAMER_TYPE_MAP_ICON, HouseData[id][HouseIcon], E_STREAMER_TYPE, 32);
  1725. SendClientMessage(playerid, -1, "Your house is no longer for sale.");
  1726. }else{
  1727. if(HouseData[id][SafeMoney] > 0) return SendClientMessage(playerid, 0xE74C3CFF, "You can't put your house for sale if there's money in the safe.");
  1728. ShowPlayerDialog(playerid, DIALOG_SELLING_PRICE, DIALOG_STYLE_INPUT, "Sell House", "How much do you want for your house?", "Put For Sale", "Cancel");
  1729. }
  1730. }
  1731. return 1;
  1732. }
  1733. if(dialogid == DIALOG_SELLING_PRICE)
  1734. {
  1735. if(!response) return ShowHouseMenu(playerid);
  1736. new id = InHouse[playerid];
  1737. if(id == INVALID_HOUSE_ID) return SendClientMessage(playerid, 0xE74C3CFF, "You're not in a house.");
  1738. if(strcmp(HouseData[id][Owner], Player_GetName(playerid))) return SendClientMessage(playerid, 0xE74C3CFF, "You're not the owner of this house.");
  1739. new amount = strval(inputtext);
  1740. if(!(1 <= amount <= 10000000)) return ShowPlayerDialog(playerid, DIALOG_SELLING_PRICE, DIALOG_STYLE_INPUT, "Sell House", "{E74C3C}You can't put your house for sale for less than $1 or more than $100,000,000.\n\n{FFFFFF}How much do you want for your house?", "Put For Sale", "Cancel");
  1741. HouseData[id][SalePrice] = amount;
  1742. HouseData[id][Save] = true;
  1743. UpdateHouseLabel(id);
  1744. Streamer_SetIntData(STREAMER_TYPE_PICKUP, HouseData[id][HousePickup], E_STREAMER_MODEL_ID, 1273);
  1745. Streamer_SetIntData(STREAMER_TYPE_MAP_ICON, HouseData[id][HouseIcon], E_STREAMER_TYPE, 31);
  1746. new string[128];
  1747. format(string, sizeof(string), "You put your house for sale for $%s.", convertNumber(amount));
  1748. SendClientMessage(playerid, -1, string);
  1749. return 1;
  1750. }
  1751. return 0;
  1752. }
  1753. public OnPlayerSelectDynamicObject(playerid, objectid, modelid, Float: x, Float: y, Float: z)
  1754. {
  1755. switch(SelectMode[playerid])
  1756. {
  1757. case SELECT_MODE_EDIT:
  1758. {
  1759. EditingFurniture[playerid] = true;
  1760. EditDynamicObject(playerid, objectid);
  1761. }
  1762. case SELECT_MODE_SELL:
  1763. {
  1764. CancelEdit(playerid);
  1765. new data[e_furniture], string[128];
  1766. SetPVarInt(playerid, "SelectedFurniture", objectid);
  1767. Streamer_GetArrayData(STREAMER_TYPE_OBJECT, objectid, E_STREAMER_EXTRA_ID, data);
  1768. format(string, sizeof(string), "Do you want to sell your %s?\nYou'll get {2ECC71}$%s.", HouseFurnitures[ data[ArrayID] ][Name], convertNumber(HouseFurnitures[ data[ArrayID] ][Price]));
  1769. ShowPlayerDialog(playerid, DIALOG_FURNITURE_SELL, DIALOG_STYLE_MSGBOX, "Confirm Sale", string, "Sell", "Close");
  1770. }
  1771. }
  1772. SelectMode[playerid] = SELECT_MODE_NONE;
  1773. return 1;
  1774. }
  1775. public OnPlayerEditDynamicObject(playerid, objectid, response, Float: x, Float: y, Float: z, Float: rx, Float: ry, Float: rz)
  1776. {
  1777. if(EditingFurniture[playerid])
  1778. {
  1779. switch(response)
  1780. {
  1781. case EDIT_RESPONSE_CANCEL:
  1782. {
  1783. new data[e_furniture];
  1784. Streamer_GetArrayData(STREAMER_TYPE_OBJECT, objectid, E_STREAMER_EXTRA_ID, data);
  1785. SetDynamicObjectPos(objectid, data[furnitureX], data[furnitureY], data[furnitureZ]);
  1786. SetDynamicObjectRot(objectid, data[furnitureRX], data[furnitureRY], data[furnitureRZ]);
  1787. EditingFurniture[playerid] = false;
  1788. }
  1789. case EDIT_RESPONSE_FINAL:
  1790. {
  1791. new data[e_furniture], query[256];
  1792. Streamer_GetArrayData(STREAMER_TYPE_OBJECT, objectid, E_STREAMER_EXTRA_ID, data);
  1793. data[furnitureX] = x;
  1794. data[furnitureY] = y;
  1795. data[furnitureZ] = z;
  1796. data[furnitureRX] = rx;
  1797. data[furnitureRY] = ry;
  1798. data[furnitureRZ] = rz;
  1799. SetDynamicObjectPos(objectid, data[furnitureX], data[furnitureY], data[furnitureZ]);
  1800. SetDynamicObjectRot(objectid, data[furnitureRX], data[furnitureRY], data[furnitureRZ]);
  1801. Streamer_SetArrayData(STREAMER_TYPE_OBJECT, objectid, E_STREAMER_EXTRA_ID, data);
  1802. mysql_format(SQLHandle, query, sizeof(query), "UPDATE housefurnitures SET FurnitureX=%f, FurnitureY=%f, FurnitureZ=%f, FurnitureRX=%f, FurnitureRY=%f, FurnitureRZ=%f WHERE ID=%d", data[furnitureX], data[furnitureY], data[furnitureZ], data[furnitureRX], data[furnitureRY], data[furnitureRZ], data[SQLID]);
  1803. mysql_tquery(SQLHandle, query, "", "");
  1804. EditingFurniture[playerid] = false;
  1805. }
  1806. }
  1807. }
  1808. return 1;
  1809. }
  1810. /* ============ Player Commands ============ */
  1811. CMD:house(playerid, params[])
  1812. {
  1813. if(InHouse[playerid] == INVALID_HOUSE_ID) return SendClientMessage(playerid, 0xE74C3CFF, "You're not in a house.");
  1814. ShowHouseMenu(playerid);
  1815. return 1;
  1816. }
  1817. CMD:myhousekeys(playerid, params[])
  1818. {
  1819. new query[200], Cache: mykeys;
  1820. mysql_format(SQLHandle, query, sizeof(query), "SELECT HouseID, FROM_UNIXTIME(Date, '%%d/%%m/%%Y %%H:%%i') as KeyDate FROM housekeys WHERE Player='%e' ORDER BY Date DESC LIMIT 0, 15", Player_GetName(playerid));
  1821. mykeys = mysql_query(SQLHandle, query);
  1822. ListPage[playerid] = 0;
  1823. new rows = cache_num_rows();
  1824. if(rows) {
  1825. new list[1024], id, key_date[20];
  1826. format(list, sizeof(list), "House Info\tKey Given On\n");
  1827. for(new i; i < rows; ++i)
  1828. {
  1829. id = cache_get_field_content_int(i, "HouseID");
  1830. cache_get_field_content(i, "KeyDate", key_date);
  1831. format(list, sizeof(list), "%s%s's %s\t%s\n", list, HouseData[id][Owner], HouseData[id][Name], key_date);
  1832. }
  1833. ShowPlayerDialog(playerid, DIALOG_MY_KEYS, DIALOG_STYLE_TABLIST_HEADERS, "My Keys (Page 1)", list, "Next", "Close");
  1834. }else{
  1835. SendClientMessage(playerid, 0xE74C3CFF, "You don't have any keys for any houses.");
  1836. }
  1837. cache_delete(mykeys);
  1838. return 1;
  1839. }
  1840. CMD:givehousekeys(playerid, params[])
  1841. {
  1842. if(InHouse[playerid] == INVALID_HOUSE_ID) return SendClientMessage(playerid, 0xE74C3CFF, "You're not in a house.");
  1843. new id, houseid = InHouse[playerid];
  1844. if(strcmp(HouseData[houseid][Owner], Player_GetName(playerid))) return SendClientMessage(playerid, 0xE74C3CFF, "You're not the owner of this house.");
  1845. if(sscanf(params, "u", id)) return SendClientMessage(playerid, 0xE74C3CFF, "USAGE: /givehousekeys [player id]");
  1846. if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, 0xE74C3CFF, "Invalid player ID.");
  1847. if(id == playerid) return SendClientMessage(playerid, 0xE74C3CFF, "You're the owner, you don't need keys.");
  1848. if(Iter_Contains(HouseKeys[id], houseid)) return SendClientMessage(playerid, 0xE74C3CFF, "That player has keys for this house.");
  1849. Iter_Add(HouseKeys[id], houseid);
  1850. new query[128];
  1851. mysql_format(SQLHandle, query, sizeof(query), "INSERT INTO housekeys SET HouseID=%d, Player='%e', Date=UNIX_TIMESTAMP()", houseid, Player_GetName(id));
  1852. mysql_tquery(SQLHandle, query, "", "");
  1853. format(query, sizeof(query), "You've given keys to %s for this house.", Player_GetName(id));
  1854. SendClientMessage(playerid, -1, query);
  1855. format(query, sizeof(query), "Now you have keys for %s's house, %s.", HouseData[houseid][Owner], HouseData[houseid][Name]);
  1856. SendClientMessage(id, -1, query);
  1857. return 1;
  1858. }
  1859. CMD:takehousekeys(playerid, params[])
  1860. {
  1861. if(InHouse[playerid] == INVALID_HOUSE_ID) return SendClientMessage(playerid, 0xE74C3CFF, "You're not in a house.");
  1862. new id, houseid = InHouse[playerid];
  1863. if(strcmp(HouseData[houseid][Owner], Player_GetName(playerid))) return SendClientMessage(playerid, 0xE74C3CFF, "You're not the owner of this house.");
  1864. if(sscanf(params, "u", id)) return SendClientMessage(playerid, 0xE74C3CFF, "USAGE: /takehousekeys [player id]");
  1865. if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, 0xE74C3CFF, "Invalid player ID.");
  1866. if(id == playerid) return SendClientMessage(playerid, 0xE74C3CFF, "You're the owner, you can't take your keys.");
  1867. if(!Iter_Contains(HouseKeys[id], houseid)) return SendClientMessage(playerid, 0xE74C3CFF, "That player doesn't have keys for this house.");
  1868. Iter_Remove(HouseKeys[id], houseid);
  1869. new query[128];
  1870. mysql_format(SQLHandle, query, sizeof(query), "DELETE FROM housekeys WHERE HouseID=%d AND Player='%e'", houseid, Player_GetName(id));
  1871. mysql_tquery(SQLHandle, query, "", "");
  1872. format(query, sizeof(query), "You've taken keys from %s for this house.", Player_GetName(id));
  1873. SendClientMessage(playerid, -1, query);
  1874. format(query, sizeof(query), "House owner %s has taken your keys for their house %s.", HouseData[houseid][Owner], HouseData[houseid][Name]);
  1875. SendClientMessage(id, -1, query);
  1876. return 1;
  1877. }
  1878. CMD:kickfromhouse(playerid, params[])
  1879. {
  1880. if(InHouse[playerid] == INVALID_HOUSE_ID) return SendClientMessage(playerid, 0xE74C3CFF, "You're not in a house.");
  1881. new id, houseid = InHouse[playerid];
  1882. if(strcmp(HouseData[houseid][Owner], Player_GetName(playerid))) return SendClientMessage(playerid, 0xE74C3CFF, "You're not the owner of this house.");
  1883. if(sscanf(params, "u", id)) return SendClientMessage(playerid, 0xE74C3CFF, "USAGE: /kickfromhouse [player id]");
  1884. if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, 0xE74C3CFF, "Invalid player ID.");
  1885. if(id == playerid) return SendClientMessage(playerid, 0xE74C3CFF, "You can't kick yourself from your house.");
  1886. if(InHouse[id] != houseid) return SendClientMessage(playerid, 0xE74C3CFF, "That player isn't in your house.");
  1887. SendClientMessage(playerid, -1, "Player kicked.");
  1888. SendClientMessage(id, -1, "You got kicked by the house owner.");
  1889. SetPVarInt(id, "HousePickupCooldown", gettime() + HOUSE_COOLDOWN);
  1890. SetPlayerVirtualWorld(id, 0);
  1891. SetPlayerInterior(id, 0);
  1892. SetPlayerPos(id, HouseData[houseid][houseX], HouseData[houseid][houseY], HouseData[houseid][houseZ]);
  1893. InHouse[id] = INVALID_HOUSE_ID;
  1894. return 1;
  1895. }
  1896. /* ============ Admin Commands ============ */
  1897. CMD:createhouse(playerid, params[])
  1898. {
  1899. if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, 0xE74C3CFF, "You can't use this command.");
  1900. new interior, price;
  1901. if(sscanf(params, "ii", price, interior)) return SendClientMessage(playerid, 0xE74C3CFF, "USAGE: /createhouse [price] [interior id]");
  1902. if(!(0 <= interior <= sizeof(HouseInteriors)-1)) return SendClientMessage(playerid, 0xE74C3CFF, "Interior ID you entered does not exist.");
  1903. new id = Iter_Free(Houses);
  1904. if(id == -1) return SendClientMessage(playerid, 0xE74C3CFF, "You can't create more houses.");
  1905. SetPVarInt(playerid, "HousePickupCooldown", gettime() + HOUSE_COOLDOWN);
  1906. format(HouseData[id][Name], MAX_HOUSE_NAME, "House For Sale");
  1907. format(HouseData[id][Owner], MAX_PLAYER_NAME, "-");
  1908. format(HouseData[id][Password], MAX_HOUSE_PASSWORD, "-");
  1909. GetPlayerPos(playerid, HouseData[id][houseX], HouseData[id][houseY], HouseData[id][houseZ]);
  1910. HouseData[id][Price] = price;
  1911. HouseData[id][Interior] = interior;
  1912. HouseData[id][LockMode] = LOCK_MODE_NOLOCK;
  1913. HouseData[id][SalePrice] = HouseData[id][SafeMoney] = HouseData[id][LastEntered] = 0;
  1914. format(HouseData[id][Address], MAX_HOUSE_ADDRESS, "%d, %s, %s", id, GetZoneName(HouseData[id][houseX], HouseData[id][houseY], HouseData[id][houseZ]), GetCityName(HouseData[id][houseX], HouseData[id][houseY], HouseData[id][houseZ]));
  1915. HouseData[id][Save] = true;
  1916. new label[200];
  1917. format(label, sizeof(label), "{2ECC71}House For Sale (ID: %d)\n{FFFFFF}%s\n{F1C40F}Price: {2ECC71}$%s", id, HouseInteriors[interior][IntName], convertNumber(price));
  1918. HouseData[id][HouseLabel] = CreateDynamic3DTextLabel(label, 0xFFFFFFFF, HouseData[id][houseX], HouseData[id][houseY], HouseData[id][houseZ]+0.35, 15.0, .testlos = 1);
  1919. HouseData[id][HousePickup] = CreateDynamicPickup(1273, 1, HouseData[id][houseX], HouseData[id][houseY], HouseData[id][houseZ]);
  1920. HouseData[id][HouseIcon] = CreateDynamicMapIcon(HouseData[id][houseX], HouseData[id][houseY], HouseData[id][houseZ], 31, 0);
  1921. new query[256];
  1922. mysql_format(SQLHandle, query, sizeof(query), "INSERT INTO houses SET ID=%d, HouseX=%f, HouseY=%f, HouseZ=%f, HousePrice=%d, HouseInterior=%d", id, HouseData[id][houseX], HouseData[id][houseY], HouseData[id][houseZ], price, interior);
  1923. mysql_tquery(SQLHandle, query, "", "");
  1924. Iter_Add(Houses, id);
  1925. return 1;
  1926. }
  1927. CMD:gotohouse(playerid, params[])
  1928. {
  1929. if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, 0xE74C3CFF, "You can't use this command.");
  1930. new id;
  1931. if(sscanf(params, "i", id)) return SendClientMessage(playerid, 0xE74C3CFF, "USAGE: /gotohouse [house id]");
  1932. if(!Iter_Contains(Houses, id)) return SendClientMessage(playerid, 0xE74C3CFF, "House ID you entered does not exist.");
  1933. SetPVarInt(playerid, "HousePickupCooldown", gettime() + HOUSE_COOLDOWN);
  1934. SetPlayerPos(playerid, HouseData[id][houseX], HouseData[id][houseY], HouseData[id][houseZ]);
  1935. SetPlayerInterior(playerid, 0);
  1936. SetPlayerVirtualWorld(playerid, 0);
  1937. return 1;
  1938. }
  1939. CMD:hsetinterior(playerid, params[])
  1940. {
  1941. if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, 0xE74C3CFF, "You can't use this command.");
  1942. new id, interior;
  1943. if(sscanf(params, "ii", id, interior)) return SendClientMessage(playerid, 0xE74C3CFF, "USAGE: /hsetinterior [house id] [interior id]");
  1944. if(!Iter_Contains(Houses, id)) return SendClientMessage(playerid, 0xE74C3CFF, "House ID you entered does not exist.");
  1945. if(!(0 <= interior <= sizeof(HouseInteriors)-1)) return SendClientMessage(playerid, 0xE74C3CFF, "Interior ID you entered does not exist.");
  1946. HouseData[id][Interior] = interior;
  1947. new query[64];
  1948. mysql_format(SQLHandle, query, sizeof(query), "UPDATE houses SET HouseInterior=%d WHERE ID=%d", interior, id);
  1949. mysql_tquery(SQLHandle, query, "", "");
  1950. UpdateHouseLabel(id);
  1951. SendClientMessage(playerid, -1, "Interior updated.");
  1952. return 1;
  1953. }
  1954. CMD:hsetprice(playerid, params[])
  1955. {
  1956. if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, 0xE74C3CFF, "You can't use this command.");
  1957. new id, price;
  1958. if(sscanf(params, "ii", id, price)) return SendClientMessage(playerid, 0xE74C3CFF, "USAGE: /hsetprice [house id] [price]");
  1959. if(!Iter_Contains(Houses, id)) return SendClientMessage(playerid, 0xE74C3CFF, "House ID you entered does not exist.");
  1960. HouseData[id][Price] = price;
  1961. new query[64];
  1962. mysql_format(SQLHandle, query, sizeof(query), "UPDATE houses SET HousePrice=%d WHERE ID=%d", price, id);
  1963. mysql_tquery(SQLHandle, query, "", "");
  1964. UpdateHouseLabel(id);
  1965. SendClientMessage(playerid, -1, "Price updated.");
  1966. return 1;
  1967. }
  1968. CMD:resethouse(playerid, params[])
  1969. {
  1970. if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, 0xE74C3CFF, "You can't use this command.");
  1971. new id;
  1972. if(sscanf(params, "i", id)) return SendClientMessage(playerid, 0xE74C3CFF, "USAGE: /resethouse [house id]");
  1973. if(!Iter_Contains(Houses, id)) return SendClientMessage(playerid, 0xE74C3CFF, "House ID you entered does not exist.");
  1974. ResetHouse(id);
  1975. SendClientMessage(playerid, -1, "House reset.");
  1976. return 1;
  1977. }
  1978. CMD:deletehouse(playerid, params[])
  1979. {
  1980. if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, 0xE74C3CFF, "You can't use this command.");
  1981. new id;
  1982. if(sscanf(params, "i", id)) return SendClientMessage(playerid, 0xE74C3CFF, "USAGE: /deletehouse [house id]");
  1983. if(!Iter_Contains(Houses, id)) return SendClientMessage(playerid, 0xE74C3CFF, "House ID you entered does not exist.");
  1984. ResetHouse(id);
  1985. DestroyDynamic3DTextLabel(HouseData[id][HouseLabel]);
  1986. DestroyDynamicPickup(HouseData[id][HousePickup]);
  1987. DestroyDynamicMapIcon(HouseData[id][HouseIcon]);
  1988. Iter_Remove(Houses, id);
  1989. HouseData[id][HouseLabel] = Text3D: INVALID_3DTEXT_ID;
  1990. HouseData[id][HousePickup] = HouseData[id][HouseIcon] = -1;
  1991. HouseData[id][Save] = false;
  1992. new query[64];
  1993. mysql_format(SQLHandle, query, sizeof(query), "DELETE FROM houses WHERE ID=%d", id);
  1994. mysql_tquery(SQLHandle, query, "", "");
  1995. SendClientMessage(playerid, -1, "House deleted.");
  1996. return 1;
  1997. }