Advertisement
Guest User

Untitled

a guest
Oct 12th, 2013
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 184.30 KB | None | 0 0
  1. //==============================================================================
  2. // GarHouse v2.0 by [03]Garsino!
  3. //==============================================================================
  4. // - Credits to DracoBlue for udb_hash.
  5. // - Credits to Incognito for his awesome streamer.
  6. // - Credits to Y_Less for sscanf2, y_ini and foreach.
  7. // - Credits to Zeex for ZCMD.
  8. // - Credits to whoever made GetPosInFrontOfPlayer.
  9. // - Credits to ~Cueball~, Betamaster, Mabako and Simon for the a_zones.inc array.
  10. // - Thanks to cessil for helping me with a weird issue with ShowInfoBoxEx.
  11. // - Thanks to everyone who gave me ideas for this house system and helped me find bugs.
  12. //==============================================================================
  13. // Changelog v2.0
  14. //==============================================================================
  15. // - [Script] Rewrote script so that it now uses y_ini instead of dini. Should be a lot faster.
  16. // - [Script] Script now uses an enum instead of directly loading the values from the files.
  17. // - [Script] Script now uses foreach instead of regular player loops.
  18. // - [Added] Added another house selling option. People can set their house for sale for a price they choose (between MIN_HOUSE_VALUE and MAX_HOUSE_VALUE).
  19. // - People can buy the house while the houseowner is offline. The houseowner will then get the money and a message upon next connect.
  20. // - [Added] Added cancelling option for house selling in /housemenu.
  21. // - [Added] Additional updates around the script.
  22. // - [Added] Added house privacy option in /housemenu. The house owner can open/close their house for guests.
  23. // - [Script] Script now uses zcmd instead of dcmd for increased speed.
  24. // - [Added] Housecars are now personal and can only be driven by the owner of the house.
  25. // - [Added] It now uses SA:MP 0.3c colour embedding and the option to only use 1 button - you must update to SA:MP 0.3c to use this version unless you edit the script yourself.
  26. // - [Added] Added dynamic house interiors - the data is loaded from files now. You don't have to worry about manually editing the script anymore.
  27. // - [Added] Added /createhint.
  28. // - [Added] Added /changehintspawn.
  29. // - [Added] Added /removehint.
  30. // - [Added] Added a define (GH_USE_HOUSESTORAGE) to decide whether you want to use the house storage feature or not.
  31. // - [Script] Updated the configuration section of this script. Features are no longer disabled by commenting then out. Simply just change "true" to "false" if you want to disable a feature.
  32. // - [Added] Added /myhouses - when selecting one of your houses you can decide whether you want to show information about that house or teleport to it (disabled by default).
  33. // - [Script] Instead of looping trough all houses and checking if the file exists it now uses foreach for this which should speed up the script a bit.
  34. // - [Changed] 3D text labels are now streamed using the streamer plugin as I finnaly solved the issue with them not drawing.
  35. // - [Changed] Other minor changes around the script.
  36. // - [Removed] Removed the debug printf's.
  37. // - [Changed] Decapitalized all words which should not be capitalized all over the script.
  38. // - [Fixed] Fixed some typos which were repeating all over the script.
  39. // - [Added] More dialogs, yay!
  40. // - [Script] Script now deletes PVars on filterscript exit to reduce memory usage.
  41. // - [Script] IsInHouse "char" array for increased speed (compared to checking if a player is in a house using GetPVarInt. However you can still access the IsInHouse PVar in other scripts using GetPVarInt).
  42. // - [Fixed] Last two "missing" message macros added to the script.
  43. // - [Added] Added the ability to breakin to houses. There is a 30% chance for successfully breaking into the house and 70% chance of failing. You can disable this feature by setting the GH_ALLOW_BREAKIN define to false.
  44. // - [Added] Added an user management menu to /housemenu. You can kick out players from your house, give players house keys to your house and take away house keys from players.
  45. // - [Added] Players with house keys can enter the house automaticly - just like the house owner. They can not access the house menu though.
  46. // - [Added] Added the ability to "upgrade" your house with things like house alarm, security camera, security dog and better houselock. All those "upgrades" have their own ability.
  47. // - [Added] Players will gain wanted level when they succeed/fail at breaking into/robbing a house IF the house has either an alarm or a security camera. You can disable this feature by setting the GH_GIVE_WANTEDLEVEL define to false.
  48. // - [Added] Added the ability to rob houses. The player can rob a maximum of X percent of the house storage (25% by default - can be changed in the script). But there is a maximum limit of how much money can be stolen. You can only rob houses if the houseowner is connected.
  49. // - [Added] Players will take X damage from each bite from the security dog of a house when attempting to breakin or rob a house (values can be changed in the script. The default is -25 health points per bite. And the dog bites 3 times).
  50. // - [Added] It will be harder to breakin to your house if you have bought the houselock upgrade. There will be a 90% chance of failing and 10% chance of succeeding.
  51. // - [Added] House owners will be warned when someone is doing a breakin or a robbery in their house (the other players name will stay anonymous unless the house owner has bought the security camera upgrade).
  52. // - [Added] Added automatic ejection from house when the filterscript is unloaded.
  53. // - [Added] Added automatic ejection from house when the current house the player is in gets deleted.
  54. // - [Fixed] Fixed problem with some messagebox dialogs not appearing.
  55. // - [Added] Added feature to set the house interior to the default one if the current one the house uses gets deleted.
  56. //==============================================================================
  57. // Includes
  58. //==============================================================================
  59. #define FILTERSCRIPT // Important
  60. #include <a_samp> // Credits to the SA:MP Developement Team
  61. #include <sscanf2> // Credits to Y_Less
  62. #include <YSI\y_ini> // Credits to Y_Less
  63. #include <ZCMD> // Credits to Zeex
  64. #include <streamer> // Credits to Incognito
  65. #include <foreach> // Credits to Y_Less
  66. //##############################################################################
  67. // Do NOT Replace!!!{FFFFFF}LV-GW {FF0000}Radio Stations
  68. //##############################################################################
  69. #define INFORMATION_HEADER "{FFFFFF}LV-GW {FF0000}Houses"
  70. #define LABELTEXT1 "{FF0000}House Name: {F6F6F6}%s\n{FF0000}House Owner: {F6F6F6}No Owner\n{FF0000}House Value: {F6F6F6}$%d\n{FF0000}For Sale: {F6F6F6}No\n{FF0000}House Privacy: {F6F6F6}Closed\n{FF0000}House ID: {F6F6F6}%d"
  71. #define LABELTEXT2 "{FF0000}House Name: {F6F6F6}%s\n{FF0000}House Owner: {F6F6F6}%s\n{FF0000}House Value: {F6F6F6}$%d\n{FF0000}For Sale: {F6F6F6}%s\n{FF0000}House Privacy: {F6F6F6}%s\n{FF0000}House ID: {F6F6F6}%d"
  72. //==============================================================================
  73. // Macros
  74. //==============================================================================
  75. new CMDSString[1000], IsInHouse[MAX_PLAYERS char];
  76. #define YesNo(%0) ((%0) == (1)) ? ("Yes") : ("No")
  77. #define Answer(%0,%1,%2) (%0) == (1) ? (%1) : (%2)
  78. #define IsPlayerInHouse(%0,%1) ((GetPVarInt(%0, "LastHouseCP") == (%1)) && (IsInHouse{%0} == (1))) ? (1) : (0)
  79. #define ShowInfoBox(%0,%1,%2) do{CMDSString = ""; format(CMDSString, 1000, %1, %2); ShowPlayerDialog(%0, HOUSEMENU-1, DIALOG_STYLE_MSGBOX, INFORMATION_HEADER, CMDSString, "Close", "");}while(FALSE)
  80. #define GameTextEx(%0,%1,%2,%3,%4) do{CMDSString = ""; format(CMDSString, 1000, %3, %4); GameTextForPlayer(%0, CMDSString, %1, %2);}while(FALSE)
  81. #define Loop(%0,%1,%2) for(new %0 = %2; %0 < %1; %0++)
  82. #define function%0(%1) forward %0(%1); public %0(%1)
  83. #define TYPE_OUT (0)
  84. #define TYPE_INT (1)
  85. //==============================================================================
  86. // Colours
  87. //==============================================================================
  88. #define COLOUR_INFO 0x00CC33FF
  89. #define COLOUR_SYSTEM 0xFF0000FF
  90. #define COLOUR_YELLOW 0xFFFF2AFF
  91. #define COLOUR_GREEN 0x00BC00FF
  92. #define COLOUR_DIALOG 0xF6F6F6AA
  93. //==============================================================================
  94. #define DC_SAMP "{F6F6F6}"
  95. #define DC_DIALOG "{F6F6F6}"
  96. #define DC_ERROR "{FF0000}"
  97. #define DC_ADMIN "{CC00CC}"
  98. #define DC_INFO "{00BC00}"
  99. //==============================================================================
  100. // Configuration
  101. //==============================================================================
  102. #define MAX_HOUSES 500 // Max houses created
  103. #define MAX_HOUSE_INTERIORS 15 // Max house interiors created
  104. #define MAX_HOUSES_OWNED 1 // Max houses owned per player
  105. #define HOUSEMENU 21700 // Dialog ID
  106. #define FILEPATH "/GarHouse/Houses/%d.ini"
  107. #define HINT_FILEPATH "/GarHouse/Interiors/%d.ini"
  108. #define USERPATH "/GarHouse/Users/%s.ini"
  109. //------------------------------------------------------------------------------
  110. #define GH_USE_MAPICONS true // true = use mapicons | false = do not use mapicons
  111. #define GH_USE_CPS true // true = use checkpoints | false = use pickups
  112. #define GH_HINTERIOR_UPGRADE true // true = allow players to upgrade their house interior | false = do not allow players to upgrade their house interior
  113. #define GH_USE_HOUSESTORAGE true // true = allow players to use the house storage | false = do not allow players to use the house storage
  114. #define GH_HOUSECARS true // true = enable house cars | false = disable house cars
  115. #define SPAWN_IN_HOUSE true // true = players will spawn in their house on their first spawn | false = players will not spawn in their house on their first spawn
  116. #define CASE_SENSETIVE true // true = ignore case sensetive in strcmp | false = do not ignore case sensetive in strcmp
  117. #define GH_ALLOW_BREAKIN true // true = allow players to breakin to houses | false = do not allow players to breakin to houses
  118. #define GH_GIVE_WANTEDLEVEL true // true = increase the players wanted level when they either attempt to breakin/rob a house or they succeed in doing so | false = do not increase the players wanted level when they either attempt to breakin/rob a house or they succeed in doing so
  119. #define GH_ALLOW_HOUSEROBBERY true // true = allow players to rob houses | false = do not allow players to rob houses
  120. #define GH_SAVE_ADMINWEPS false // true = save admin weapons (f.ex: minigun, grenades, RPG) | false = do not save admin weapons (f.ex: minigun, grenades, RPG)
  121. #define GH_USE_WEAPONSTORAGE true // true = allow players to store weapons in their house | false = do not allow players to store weapons in their house
  122. #define GH_ALLOW_HOUSETELEPORT false // true = allow players to teleport to their house using /myhouses | false = do not allow players to teleport to their house using /myhouses
  123. //------------------------------------------------------------------------------
  124. #define HOUSEFILE_LENGTH 30
  125. #define INTERIORFILE_LENGTH 30
  126. #define MIN_HOUSE_VALUE 1 // Min house value of a house (ofc prices will change when a house is bought/sold nearby)
  127. #define MAX_HOUSE_VALUE 25000000 // Max house value of a house (ofc prices will change when a house is bought/sold nearby)
  128. #define MIN_HINT_VALUE 10000 // Min house interior value
  129. #define MAX_HINT_VALUE 50000000 // Max house interior value
  130. #define HOUSE_ROBBERY_PERCENT 25 // How many percent of the cash in the house storage will be robbed?
  131. #define MAX_MONEY_ROBBED 500000 // Max money you can rob from a house.
  132. #define HSPAWN_TIMER_RATE 1000 // After how long will the timer call the spawn in house function? (in ms)
  133. #define MICON_VD 700.0 // Map icon visible range (drawdistance).
  134. #define TEXTLABEL_DISTANCE 300.0 // 3D text visible range (drawdistance)
  135. #define TEXTLABEL_TESTLOS 1 // 1 makes the 3D text label visible trough walls.
  136. #define CP_DRAWDISTANCE 200.0 // checkpoint visible range (drawdistance)
  137. #define DEFAULT_H_INTERIOR 0 // Default house interior when creating a house
  138. #define HCAR_COLOUR1 -1 // The first colour of the housecar
  139. #define HCAR_COLOUR2 -1 // The second colour of the housecar
  140. #define HCAR_RESPAWN 60 // The respawn delay of the house car (in seconds)
  141. #define HCAR_RANGE 10.0 // The range to check for nearby vehicles when saving the house car.
  142. #define PICKUP_MODEL_OUT 1273 // Pickup model ID which shows up OUTSIDE the house.
  143. #define PICKUP_MODEL_INT 1272 // Pickup model ID which shows up INSIDE the house.
  144. #define PICKUP_TYPE 1 // The pickup type if you decide to not use checkpoints
  145. #define MAX_VISIT_TIME 1 // The max time the player can be visiting in (In Minutes).
  146. #define TIME_BETWEEN_VISITS 0 // The time the player have to wait before previewing a new house interior (In minutes).
  147. #define TIME_BETWEEN_BREAKINS 5 // The time the player have to wait before attempting to breakin to a house again (In minutes).
  148. #define TIME_BETWEEN_ROBBERIES 10 // The time the player have to wait before attempting to rob a house again (In minutes).
  149. #define HOUSE_SELLING_PROCENT 75 // The amount of the house value the player will get when the house is sold.
  150. #define HOUSE_SELLING_PROCENT2 6.5 // The total percentage the nearby houses will go up/down by when a house is sold/bought nearby.
  151. #define RANGE_BETWEEN_HOUSES 200 // The range used when increasing/decreasing the value of nearby houses when a house is bought/sold (set to 0 to disable)
  152. #define MAX_HOUSE_NAME 35 // Max length of a house name
  153. #define MIN_HOUSE_NAME 4 // Min length of a house name
  154. #define MAX_HINT_NAME 35 // Max length of a house interior name
  155. #define MIN_HINT_NAME 4 // Min length of a house interior name
  156. #define MAX_HOUSE_PASSWORD 35 // Max length of a house password
  157. #define MIN_HOUSE_PASSWORD 4 // Min length of a house password
  158. #define MAX_ZONE_NAME 60 // Max length of a zone name
  159. #define MIN_ROB_TIME 30 // The minimum amount of time the player have to be in the house to be able to rob it (In seconds)
  160. #define MAX_ROB_TIME 60 // The maximum amount of time the player have to be in the house to be able to rob it (In seconds)
  161. #define HUPGRADE_ALARM 10000 // How much the player should pay for the house alarm upgrade.
  162. #define HUPGRADE_CAMERA 25000 // How much the player should pay for the security camera upgrade.
  163. #define HUPGRADE_DOG 35000 // How much the player should pay for the security dog upgrade.
  164. #define HUPGRADE_UPGRADED_HLOCK 40000 // How much the player should pay for the doorlock upgrade.
  165. #define HBREAKIN_WL 0 // How much should the players wanted level increase by when they fail/succeed at breaking into a house (if the house has a house alarm/security camera).
  166. #define HROBBERY_WL 0 // How much should the players wanted level increase by when they fail/succeed at robbing a house (if the house has a house alarm/security camera).
  167. #define GH_MAX_WANTED_LEVEL 0 // What is the max wanted level a player can get?
  168. #define SECURITYDOG_HEALTHLOSS 25.00 // How much health should the player lose after each bit?
  169. #define SECURITYDOG_BITS 3 // How many times will the dog bite the player during a breakin/robbery?
  170. #define INVALID_HOWNER_NAME "INVALID_PLAYER_ID" // The "name" of the house owner when there is no owner of the house
  171. #define DEFAULT_HOUSE_NAME "House For Sale!" // The default name when a house is created/sold
  172. #define SPAWN_IN_HOUSE true // true = players will spawn in their house on their first spawn | false = players will not spawn in their house on their first spawn
  173. //------------------------------------------------------------------------------
  174. new Iterator:Houses<MAX_HOUSES>, Text3D:HouseLabel[MAX_HOUSES], Float:X, Float:Y, Float:Z, Float:Angle;
  175. #if GH_USE_CPS == true
  176. new HouseCPOut[MAX_HOUSES], HouseCPInt[MAX_HOUSES];
  177. #else
  178. new HousePickupOut[MAX_HOUSES], HousePickupInt[MAX_HOUSES];
  179. #endif
  180. #if GH_USE_MAPICONS == true
  181. new HouseMIcon[MAX_HOUSES];
  182. #endif
  183. #if GH_HOUSECARS == true
  184. new HCar[MAX_HOUSES];
  185. #endif
  186. enum Data
  187. {
  188. HousePassword,
  189. HouseOwner[MAX_PLAYER_NAME],
  190. HouseName[MAX_HOUSE_NAME],
  191. HouseLocation[MAX_ZONE_NAME],
  192. Float:SpawnOutAngle,
  193. SpawnInterior,
  194. SpawnWorld,
  195. Float:CPOutX,
  196. Float:CPOutY,
  197. Float:CPOutZ,
  198. Float:SpawnOutX,
  199. Float:SpawnOutY,
  200. Float:SpawnOutZ,
  201. HouseValue,
  202. HouseStorage,
  203. HouseInterior,
  204. HouseCar,
  205. HouseCarModel,
  206. HouseCarWorld,
  207. HouseCarInterior,
  208. Float:HouseCarPosX,
  209. Float:HouseCarPosY,
  210. Float:HouseCarPosZ,
  211. Float:HouseCarAngle,
  212. QuitInHouse,
  213. Weapon[14],
  214. Ammo[14],
  215. ForSale,
  216. ForSalePrice,
  217. HousePrivacy,
  218. HouseAlarm,
  219. HouseCamera,
  220. HouseDog,
  221. UpgradedLock
  222. }
  223. enum hIntData
  224. {
  225. IntName[30],
  226. Float:IntSpawnX,
  227. Float:IntSpawnY,
  228. Float:IntSpawnZ,
  229. Float:IntSpawnAngle,
  230. Float:IntCPX,
  231. Float:IntCPY,
  232. Float:IntCPZ,
  233. IntInterior,
  234. IntValue
  235. }
  236. new hInfo[MAX_HOUSES][Data], hIntInfo[MAX_HOUSE_INTERIORS][hIntData];
  237. new CurrentID;
  238. //==============================================================================
  239. // Translation / SendClientMessage Messages
  240. //==============================================================================
  241. /*
  242. - Below you will find a list of messages.
  243. - You can translate these messages to whatever language you want.
  244. - When updating to a new version, simply replace the messages with the ones you translated.
  245. - But read the note where it says what version the messages below were added for.
  246. - There might have been some more messages added after this version of GarHouse (v2.0),
  247. - so do not replace all of the messages without looking carefully if there is any new ones.
  248. - And be careful when editing messages containing placeholders (%s, %d, %i, etc),
  249. - if you change the position of these it will screw up eventually.
  250. - and do not remove or add any more placeholders if you do NOT know what you're doing.
  251. - Oh and one more thing, I did not translate the dialogs wich uses list items. You will have to do that yourself.
  252.  
  253.  
  254. Thanks,
  255. [03]Garsino.
  256. */
  257. /*
  258. ----------------------------------
  259. VERSION 2.0 NOTES - IMPORTANT!
  260. ----------------------------------
  261. All messages needs to be replaced
  262. */
  263. //##############################################################################
  264. // Messages added in v2.0
  265. //##############################################################################
  266. #define E_NO_HOUSES_OWNED "{F6F6F6}You do not own any houses."
  267. #define I_HMENU "{F6F6F6}Type /housemenu to access the house menu."
  268. #define E_H_ALREADY_OWNED "{F6F6F6}This house is already owned by someone else."
  269. #define E_INVALID_HPASS_LENGTH "{F6F6F6}Invalid house password length"
  270. #define E_INVALID_HPASS "{F6F6F6}Invalid house password. You may not use this house password."
  271. #define E_INVALID_HPASS_CHARS "{F6F6F6}Your house password contains illegal characters ({00BC00}percentage sign {F6F6F6}or {00BC00}~{F6F6F6})."
  272. #define E_INVALID_HNAME_LENGTH "{F6F6F6}Invalid house name length."
  273. #define E_INVALID_HNAME_CHARS "{F6F6F6}Your house name contains illegal characters ({00BC00}percentage sign {F6F6F6}or {00BC00}~{F6F6F6})."
  274. #define I_HPASS_NO_CHANGE "{F6F6F6}Your house password remains the same."
  275. #define I_HPASS_REMOVED "{F6F6F6}The house password for this house has been removed."
  276. #define E_NOT_ENOUGH_PMONEY "{F6F6F6}You do not have that much money."
  277. #define E_INVALID_AMOUNT "{F6F6F6}Invalid amount."
  278. #define E_HSTORAGE_L_REACHED "{F6F6F6}You can not deposit this much money into your house storage. It can only hold up to {00BC00}$25,000,000{F6F6F6}."
  279. #define E_NOT_ENOUGH_HSMONEY "{F6F6F6}You do not have that much money in your house storage."
  280. #define E_NO_WEAPONS "{F6F6F6}You do not have any weapons to store."
  281. #define E_NO_HS_WEAPONS "{F6F6F6}You do not have any weapons in your house storage."
  282. #define E_INVALID_HPASS_CHARS2 "{F6F6F6}The entered house password contains illegal characters ({00BC00}percentage sign {F6F6F6}or {00BC00}~{F6F6F6})."
  283. #define E_C_ACCESS_SE_HM "{F6F6F6}You can not access someone elses house menu."
  284. #define E_NOT_IN_HOUSE "{F6F6F6}You need to be in a house to use this command."
  285. #define E_NOT_HOWNER "{F6F6F6}You need to be the owner of a house to use this command."
  286. #define E_HCAR_NOT_IN_VEH "{F6F6F6}You need to be in a vehicle to add a house car."
  287. #define E_INVALID_HID "{F6F6F6}Invalid house ID. This house ID does not exist."
  288. #define E_NO_HCAR "{F6F6F6}This house ID does not have a house car. Unable to delete."
  289. #define E_H_A_F_SALE "{F6F6F6}This house is already for sale. You can not sell it."
  290. #define E_ALREADY_HAVE_HINTERIOR "{F6F6F6}You already have this house interior."
  291. #define E_HINT_WAIT_BEFORE_VISITING "{F6F6F6}Please wait before visiting a house interior again."
  292. #define I_WRONG_HPASS1 "{F6F6F6}You have failed to enter {00BC00}%s's {F6F6F6}house using the password {00BC00}%s{F6F6F6}."
  293. #define I_WRONG_HPASS2 "{00BC00}%s (%d) {F6F6F6}has attempted to enter your house using the password {00BC00}%s{F6F6F6}."
  294. #define I_CORRECT_HPASS1 "{F6F6F6}You have successfully entered {00BC00}%s's {F6F6F6}house using the password {00BC00}%s{F6F6F6}."
  295. #define I_CORRECT_HPASS2 "{00BC00}%s (%d) {F6F6F6}has successfully entered your house using the password {00BC00}%s{F6F6F6}!"
  296. #define E_TOO_MANY_HOUSES "{F6F6F6}Sorry, but there are already {00BC00}%d {F6F6F6}houses created.\nDelete one of the current ones or increase the limit in the script."
  297. #define I_H_CREATED "{F6F6F6}House ID {00BC00}%d {F6F6F6}created..."
  298. #define I_HCAR_EXIST_ALREADY "{F6F6F6}House ID %d {F6F6F6}already have a house car. Overwriting current one."
  299. #define I_HCAR_CREATED "{F6F6F6}House car for house ID {00BC00}%d {F6F6F6}created..."
  300. #define I_H_DESTROYED "{F6F6F6}House ID {00BC00}%d {F6F6F6}destroyed..."
  301. #define I_HCAR_REMOVED "{F6F6F6}House car for house ID {00BC00}%d {F6F6F6}removed..."
  302. #define I_ALLH_DESTROYED "{F6F6F6}All houses removed. ({00BC00}%d {F6F6F6}in total)"
  303. #define I_ALLHCAR_REMOVED "{F6F6F6}All house cars removed. ({00BC00}%d {F6F6F6}in total)"
  304. #define I_HSPAWN_CHANGED "{F6F6F6}You have changed the spawnposition and angle for house ID {00BC00}%d{F6F6F6}."
  305. #define I_TELEPORT_MSG "{F6F6F6}You have teleported to house ID {00BC00}%d{F6F6F6}."
  306. #define I_H_SOLD "{F6F6F6}You have sold house ID {00BC00}%d{F6F6F6}..."
  307. #define I_ALLH_SOLD "{F6F6F6}All houses on the server has been sold. ({00BC00}%d {F6F6F6}in total)"
  308. #define I_H_PRICE_CHANGED "{F6F6F6}The value for house ID {00BC00}%d has been changed to {00BC00}$%d{F6F6F6}."
  309. #define I_ALLH_PRICE_CHANGED "{F6F6F6}You have changed the value of all houses on the server to {00BC00}$%d. ({00BC00}%d {F6F6F6}in total)"
  310. #define I_HINT_VISIT_OVER "{F6F6F6}Your visiting time is over.\nDo you want to buy the house interior {00BC00}%s {F6F6F6}for {00BC00}$%d{F6F6F6}?"
  311. #define E_INVALID_HCAR_MODEL "{F6F6F6}Invalid car model. Accepted car models are between {00BC00}400 {F6F6F6}and {00BC00}612."
  312. #define I_HCAR_CHANGED "{F6F6F6}Car model for house ID {00BC00}%d {F6F6F6}changed to {00BC00}%d."
  313. #define HMENU_SELL_HOUSE2 "{F6F6F6}Type in how much you want to sell your house for below:"
  314. #define HMENU_CANCEL_HOUSE_SALE "{F6F6F6}Your house is no longer for sale."
  315. #define HMENU_HSALE_CANCEL "{F6F6F6}Click {00BC00}\"Remove\" {F6F6F6}to cancel the house sale for this house."
  316. #define E_H_NOT_FOR_SALE "{F6F6F6}This house is not for sale."
  317. #define E_INVALID_HSELL_AMOUNT "{F6F6F6}Invalid amount. The price you want to sell your house for can not be higher than {00BC00}$"#MAX_HOUSE_VALUE" {F6F6F6}or lower than {00BC00}$"#MIN_HOUSE_VALUE"{F6F6F6}."
  318. #define I_H_SET_FOR_SALE "{F6F6F6}You have successfully set your house {00BC00}%s {F6F6F6}for sale for {00BC00}$%d{F6F6F6}."
  319. #define HSELL_BUY_DIALOG "{00BC00}Current House Owner: {F6F6F6}%s\n{00BC00}Current House Name: {F6F6F6}%s\n\nAre You Sure You Want To Buy This House For {00BC00}$%d{F6F6F6}?"
  320. #define HSELLER_CONNECTED_MSG1 "{F6F6F6}Your house {00BC00}%s {F6F6F6}has been sold to {00BC00}%s (%d){F6F6F6}.\n"
  321. #define HSELLER_CONNECTED_MSG2 "{00BC00}You receive: {F6F6F6}$%d\n{00BC00}House Storage: {F6F6F6}$%d\n{00BC00}House Price: {F6F6F6}$%d"
  322. #define HSELLER_OFFLINE_MSG1 "{F6F6F6}Your house {00BC00}%s {F6F6F6}has been sold to {00BC00}%s {F6F6F6}while you were offline.\n"
  323. #define HSELLER_OFFLINE_MSG2 "{00BC00}You receive: {F6F6F6}$%d\n{00BC00}House Storage: {F6F6F6}$%d\n{00BC00}House Price: {F6F6F6}$%d"
  324. #define E_NOT_HOUSECAR_OWNER "{F6F6F6}You can not drive this vehicle as it belongs to the owner of house ID {F6F6F6}%d which is {F6F6F6}%s."
  325. #define I_HOUSECAR_OWNER "{F6F6F6}Welcome to your vehicle, {00BC00}%s{F6F6F6}! This vehicle belongs to your house (ID {00BC00}%d{F6F6F6}) so therefore only you can drive it."
  326. #define I_TO_PLAYERS_HSOLD "{F6F6F6}This house has been sold.\nYou have been automaticly kicked out from the house."
  327. #define E_INVALID_HINT "{F6F6F6}Invalid house interior. Accepted house interiors are between {00BC00}0 {F6F6F6}and {00BC00}"#MAX_HOUSE_INTERIORS"{F6F6F6}."
  328. #define E_CMD_USAGE_CHANGEHINTSPAWN "Usage:{F6F6F6} /changehintspawn (house interior)"
  329. #define E_CMD_USAGE_CREATEHINT "Usage:{F6F6F6} /createhint (value) (name)"
  330. #define E_CMD_USAGE_REMOVEHINT "Usage:{F6F6F6} /removehint (house interior)"
  331. #define E_CMD_USAGE_CREATEHOUSE "Usage:{F6F6F6} /createhouse (house value) (optional: house interior)"
  332. #define E_CMD_USAGE_ADDHCAR "Usage:{F6F6F6} /addhcar (house id)"
  333. #define E_CMD_USAGE_REMOVEHOUSE "Usage:{F6F6F6} /removehouse (houseid)"
  334. #define E_CMD_USAGE_REMOVEHCAR "Usage:{F6F6F6} /removehcar (house id)"
  335. #define E_CMD_USAGE_CHANGEHCAR "Usage:{F6F6F6} /changehcar (house id) (modelid: 400-612)"
  336. #define E_CMD_USAGE_CHANGESPAWN "Usage:{F6F6F6} /changespawn (houseid)"
  337. #define E_CMD_USAGE_GOTOHOUSE "Usage:{F6F6F6} /gotohouse (houseid)"
  338. #define E_CMD_USAGE_SELLHOUSE "Usage:{F6F6F6} /sellhouse (houseid)"
  339. #define E_CMD_USAGE_CHANGEPRICE "Usage:{F6F6F6} /changeprice (houseid) (price)"
  340. #define E_CMD_USAGE_CHANGEALLPRICE "Usage:{F6F6F6} /changeallprices (price)"
  341. #define E_INVALID_HINT_ID "{F6F6F6}Invalid house interior ID."
  342. #define I_HINT_SPAWN_CHANGED "{F6F6F6}You have changed the spawn position and angel for house interior ID %d."
  343. #define I_HINT_CREATED "{F6F6F6}House interior ID {00BC00}%d {F6F6F6}created...\n{00BC00}House Interior Value: {F6F6F6}$%d\n{00BC00}House Interior Name: {F6F6F6}%s"
  344. #define E_TOO_MANY_HINTS "{F6F6F6}Sorry, but there are already {00BC00}%d {F6F6F6}house interiors created.\nDelete one of the current ones or increase the limit in the script."
  345. #define E_INVALID_HINT_VALUE "{F6F6F6}Invalid house interior value. The value must be between {00BC00}$"#MIN_HINT_VALUE" {F6F6F6}and {00BC00}$"#MAX_HINT_VALUE"{F6F6F6}."
  346. #define E_INVALID_HINT_LENGTH "{F6F6F6}Invalid house interior name length. The length must be between {00BC00}"#MIN_HINT_NAME" {F6F6F6}and {00BC00}"#MAX_HINT_NAME"{F6F6F6}."
  347. #define I_HINT_DESTROYED "{F6F6F6}House interior ID {00BC00}%d {F6F6F6}has been deleted..."
  348. #define E_NO_HOUSESTORAGE "{F6F6F6}The house storage feature has been disabled in this server. You can not use it."
  349. #define I_HOWNER_HINFO_1 "{00BC00}House Name: {F6F6F6}%s\n{00BC00}House Location: {F6F6F6}%s\n{00BC00}Distance to house from you: {F6F6F6}%0.2f feet\n"
  350. #define I_HOWNER_HINFO_2 "{00BC00}House Value: {F6F6F6}$%d\n{00BC00}House Storage: {F6F6F6}$%d\n{00BC00}House Privacy: {F6F6F6}%s\n{00BC00}House ID: {F6F6F6}%d"
  351. #define HMENU_ENTER_PASS "{00BC00}House Name: {F6F6F6}%s\n{00BC00}House Owner: {F6F6F6}%s\n{00BC00}House Value: {F6F6F6}$%d\n{00BC00}House ID: {F6F6F6}%d\n\nEnter The Password For The House Below If You Wish To Enter:"
  352. #define I_HINT_DEPOSIT1 "{F6F6F6}You have {00BC00}$%d {F6F6F6}in your house storage.\n\nType in the amount you want to deposit below:"
  353. #define I_HINT_WITHDRAW1 "{F6F6F6}You have {00BC00}$%d {F6F6F6}in your house storage.\n\nType in the amount you want to withdraw below:"
  354. #define I_HINT_DEPOSIT2 "{F6F6F6}You have successfully deposited {00BC00}$%d {F6F6F6}Into your house storage.\n{00BC00}Current Balance: {F6F6F6}$%d"
  355. #define I_HINT_WITHDRAW2 "{F6F6F6}You have successfully withdrawn {00BC00}$%d {F6F6F6}From your house storage.\n{00BC00}Current Balance: {F6F6F6}$%d"
  356. #define I_HINT_CHECKBALANCE "{F6F6F6}You have {00BC00}$%d {F6F6F6}in your house storage."
  357. #define E_HINT_DOESNT_EXIST "{F6F6F6}Invalid house interior. This house interior does not exist."
  358. #define HMENU_BUY_HOUSE "{F6F6F6}Do you want to buy this house for {00BC00}$%d{F6F6F6}?"
  359. #define HMENU_BUY_HINTERIOR "{F6F6F6}Do you want to buy the house interior {00BC00}%s {F6F6F6}for {00BC00}$%d{F6F6F6}?"
  360. #define HMENU_SELL_HOUSE "{F6F6F6}Are you sure you want to sell your house {00BC00}%s {F6F6F6}for {00BC00}$%d{F6F6F6}?"
  361. #define I_SELL_HOUSE1_1 "{F6F6F6}You have successfully sold your house for {00BC00}$%d\n"
  362. #define I_SELL_HOUSE1_2 "{00BC00}Selling Fee: {F6F6F6}$%d\nThe {00BC00}$%d {F6F6F6}in your house storage has been transfered to your pocket."
  363. #define I_SELL_HOUSE2 "{F6F6F6}You have successfully sold your house {00BC00}%s {F6F6F6}for {00BC00}$%d.\n{00BC00}Selling Fee: {F6F6F6}$%d"
  364. #define I_BUY_HOUSE "{F6F6F6}You have successfully bought this house for {00BC00}$%d{F6F6F6}!"
  365. #define I_HPASSWORD_CHANGED "{F6F6F6}You have successfully set the house password to {00BC00}%s{F6F6F6}!"
  366. #define I_HNAME_CHANGED "{F6F6F6}You have successfully set the house name to {00BC00}%s{F6F6F6}!"
  367. #define I_VISITING_HOUSEINT "{F6F6F6}You're now visiting the house interior {00BC00}%s{F6F6F6}.\nThis house interior costs {00BC00}$%d{F6F6F6}.\nYour visit time will end in {00BC00}%d {F6F6F6}minute%s."
  368. #define E_CANT_AFFORD_HINT1 "{F6F6F6}You can not afford to buy the house interior {00BC00}%s{F6F6F6}.\n{00BC00}House Interior Price: {F6F6F6}$%d\n"
  369. #define E_CANT_AFFORD_HINT2 "{00BC00}You have: {F6F6F6}$%d\n{00BC00}You Need: {F6F6F6}$%d"
  370. #define I_HINT_BOUGHT "{F6F6F6}You have bought the house interior {00BC00}%s {F6F6F6}for {00BC00}$%d."
  371. #define I_HS_WEAPONS1 "{F6F6F6}You have successfully stored {00BC00}%d {F6F6F6}weapon%s in your house storage."
  372. #define I_HS_WEAPONS2 "{F6F6F6}You have successfully received {00BC00}%d {F6F6F6}weapon%s from your house storage."
  373. #define E_INVALID_HVALUE "{F6F6F6}Invalid house value. The house value must be between {00BC00}$"#MIN_HOUSE_VALUE" {F6F6F6}and {00BC00}$"#MAX_HOUSE_VALUE"{F6F6F6}."
  374. #define I_HOPEN_FOR_VISITORS "{F6F6F6}You have successfully opened your house for visitors."
  375. #define I_CLOSED_FOR_VISITORS1 "{F6F6F6}You have successfully closed your house for visitors.\n{00BC00}Total visitors kicked out: {F6F6F6}%d"
  376. #define I_CLOSED_FOR_VISITORS2 "{00BC00}%s (%d) {F6F6F6}has closed their house for visitors. Automaticly exiting house..."
  377. #define E_MAX_HOUSES_OWNED "{F6F6F6}You already own {00BC00}%d {F6F6F6}house%s. Sell one of your others before buying a new."
  378. #define E_CANT_AFFORD_HOUSE "{F6F6F6}You can not afford to buy this house.\n{00BC00}House Value: {F6F6F6}$%d\n{00BC00}You Have: {F6F6F6}$%d\n{00BC00}You Need: {F6F6F6}$%d"
  379. #define I_SUCCESSFULL_BREAKIN1_1 "{00BC00}%s (%d) {F6F6F6}has successfully broken into your house {00BC00}%s {F6F6F6}in {00BC00}%s{F6F6F6}."
  380. #define I_SUCCESSFULL_BREAKIN1_2 "{F6F6F6}Someone has successfully broken into your house {00BC00}%s {F6F6F6}in {00BC00}%s{F6F6F6}."
  381. #define I_SUCCESSFULL_BREAKIN2 "{F6F6F6}You have successfully broken into this house.\n{00BC00}House Name: {F6F6F6}%s\n{00BC00}House Owner: {F6F6F6}%s"
  382. #define E_FAILED_BREAKIN1_1 "{00BC00}%s (%d) {F6F6F6}has failed to breakin to your house {00BC00}%s {F6F6F6}in {00BC00}%s{F6F6F6}."
  383. #define E_FAILED_BREAKIN1_2 "{F6F6F6}Someone has failed to breakin to your house {00BC00}%s {F6F6F6}in {00BC00}%s{F6F6F6}."
  384. #define E_FAILED_BREAKIN2 "{F6F6F6}You have failed to breakin to this house.\n{00BC00}House Name: {F6F6F6}%s\n{00BC00}House Owner: {F6F6F6}%s"
  385. #define E_NO_HOUSE_BREAKIN "{F6F6F6}The breakin feature has been disabled in this server. You can not use it."
  386. #define E_KICKED_NOT_IN_HOUSE "{F6F6F6}This player is not in your house."
  387. #define I_KICKED_FROM_HOUSE1 "{F6F6F6}You have kicked out {00BC00}%s (%d) {F6F6F6}from your house."
  388. #define I_KICKED_FROM_HOUSE2 "{F6F6F6}You have been kicked out from the house by {00BC00}%s (%d){F6F6F6}."
  389. #define E_ALREADY_HAVE_HOUSEKEYS "{F6F6F6}You have already given the house keys for this house to this player."
  390. #define I_HOUSEKEYS_RECIEVED_1 "{F6F6F6}You have given {00BC00}%s (%d) {F6F6F6}house keys to this house."
  391. #define I_HOUSEKEYS_RECIEVED_2 "{F6F6F6}You have been given house keys to {00BC00}%s {F6F6F6}in {00BC00}%s {F6F6F6}by {00BC00}%s (%d){F6F6F6}."
  392. #define E_DOESNT_HAVE_HOUSEKEYS "{F6F6F6}This player does not have the house keys for this house."
  393. #define I_HOUSEKEYS_TAKEN_1 "{F6F6F6}You have taken away {00BC00}%s's (%d) {F6F6F6}house keys to this house."
  394. #define I_HOUSEKEYS_TAKEN_2 "{00BC00}%s (%d) {F6F6F6}has taken away the house keys to his house {00BC00}%s {F6F6F6}in {00BC00}%s{F6F6F6}."
  395. #define E_NONE_IN_HOUSE "{F6F6F6}There isn't anyone in your house."
  396. #define E_CANT_ROB_OWN_HOUSE "{F6F6F6}You can not rob your own house."
  397. #define E_ALREADY_HAVE_ALARM "{F6F6F6}You have already bought a house alarm for this house."
  398. #define E_ALREADY_HAVE_CAMERA "{F6F6F6}You have already bought a security camera for this house."
  399. #define E_ALREADY_HAVE_DOG "{F6F6F6}You have already bought a security dog for this house."
  400. #define E_ALREADY_HAVE_UPGRADED_HLOCK "{F6F6F6}You have already bought a better doorlock for this house."
  401. #define E_NOT_ENOUGH_MONEY_ALARM "{F6F6F6}You do not have enough money to buy a house alarm for your house."
  402. #define E_NOT_ENOUGH_MONEY_CAMERA "{F6F6F6}You do not have enough money to buy a security camera for your house."
  403. #define E_NOT_ENOUGH_MONEY_DOG "{F6F6F6}You do not have enough money to buy a security dog for your house."
  404. #define E_NOT_ENOUGH_MONEY_UPGRADED_HLOCK "{F6F6F6}You do not have enough money to buy a better doorlock for your house."
  405. #define I_HUPGRADE_ALARM "{F6F6F6}You have bought a alarm for your house.\nThis alarm will warn you when someone tries to or succeed in either robbing or breaking into your house.\n{00BC00}Note: {F6F6F6}It does not notify you of who it is."
  406. #define I_HUPGRADE_CAMERA "{F6F6F6}You have bought a security camera for your house.\nThis security camera will warn you when someone tries to or succeed in either robbing or breaking into your house.\n{00BC00}Note: {F6F6F6}It does notify you of who it is."
  407. #define I_HUPGRADE_DOG "{F6F6F6}You have bought a security dog for your house.\nThis security dog will try to kill anyone who tries to either rob or breakin to your house."
  408. #define I_HUPGRADE_UPGRADED_HLOCK "{F6F6F6}You have bought upgraded the doorlock for your house.\nIt will now be harder to breakin to your house."
  409. #define E_FAILED_HROB1_1 "{00BC00}%s (%d) {F6F6F6}has failed to rob your house {00BC00}%s {F6F6F6}in {00BC00}%s{F6F6F6}."
  410. #define E_FAILED_HROB1_2 "{F6F6F6}Someone has failed to rob your house {00BC00}%s {F6F6F6}in {00BC00}%s{F6F6F6}."
  411. #define I_HROB_STARTED1_1 "{F6F6F6}Someone is currently robbing your house %s {F6F6F6}in %s{F6F6F6}."
  412. #define I_HROB_STARTED1_2 "{00BC00}%s (%d) {F6F6F6}is currently robbing your house %s {F6F6F6}in %s{F6F6F6}."
  413. #define I_HROB_STARTED2 "{F6F6F6}You have started the robbery of {00BC00}%s's {F6F6F6}house {00BC00}%s {F6F6F6}in {00BC00}%s{F6F6F6}.\n\n{00BC00}Stay alive and do not leave the house until the robbery finishes!"
  414. #define E_HROB_OWNER_NOT_CONNECTED "{F6F6F6}You can not rob this house since the owner of it is not connected."
  415. #define I_HROB_FAILED_DEATH "{F6F6F6}You have died.\nThe attempt to rob the house {00BC00}%s {F6F6F6}has failed."
  416. #define I_HROB_FAILED_HEXIT "{F6F6F6}You have left the house.\nThe attempt to rob the house {00BC00}%s {F6F6F6}has failed."
  417. #define I_HROB_FAILED_NOT_IN_HOUSE "{F6F6F6}You are not in the house you were attempting to rob.\nThe attempt to rob the house {00BC00}%s {F6F6F6}has failed."
  418. #define E_FAILED_HROB2 "{F6F6F6}House robbery failed."
  419. #define I_HROB_COMPLETED1_1 "{F6F6F6}Your house {00BC00}%s {F6F6F6}in {00BC00}%s {F6F6F6}has been robbed for {00BC00}$%d{F6F6F6}."
  420. #define I_HROB_COMPLETED1_2 "{00BC00}%s (%d) {F6F6F6}has robbed your house {00BC00}%s {F6F6F6}in {00BC00}%s {F6F6F6}for {00BC00}$%d{F6F6F6}."
  421. #define I_HROB_COMPLETED2 "{F6F6F6}House robbery completed.\nYou got away with {00BC00}$%d {F6F6F6}from {00BC00}%s's {F6F6F6}house {00BC00}%s {F6F6F6}in {00BC00}%s{F6F6F6}."
  422. #define HROB_FAILED1 "{F6F6F6}You have been bit to death by the security dog for this house.\nRobbery failed."
  423. #define HBREAKIN_FAILED1 "{F6F6F6}You have been bit to death by the security dog for this house.\nHouse breakin failed."
  424. #define E_WAIT_BEFORE_BREAKIN "{F6F6F6}Please wait before attempting to breakin to a house again."
  425. #define E_WAIT_BEFORE_ROBBING "{F6F6F6}Please wait before attempting to rob a house again."
  426. #define E_ALREADY_ROBBING_HOUSE "{F6F6F6}You are already robbing a house."
  427. #define HROB_FAILED2 "{F6F6F6}House robbery failed.\nYou have been bit by the security dog for this house."
  428. #define HBREAKIN_FAILED2 "{F6F6F6}House breakin failed.\nYou have been bit by the security dog for this house."
  429. //==============================================================================
  430. // Awesomeness
  431. //==============================================================================
  432. public OnFilterScriptInit()
  433. {
  434. print("\n>> Attempting to load GarHouse v2.0... <<\n");
  435. INI_Load("/GarHouse/House.ini");
  436. LoadHouses(); // Load houses
  437. foreach(Player, i)
  438. {
  439. SetPVarInt(i, "HousePrevTime", 0);
  440. SetPVarInt(i, "TimeSinceHouseRobbery", 0);
  441. SetPVarInt(i, "TimeSinceHouseBreakin", 0);
  442. SetPVarInt(i, "HouseRobberyTimer", -1);
  443. }
  444. print("\n>> GarHouse v2.0 By [03]Garsino Loaded <<\n");
  445. return 1;
  446. }
  447. public OnFilterScriptExit()
  448. {
  449. new INI:file, lasthcp;
  450. foreach(Player, i)
  451. {
  452. EndHouseRobbery(i);
  453. SetPVarInt(i, "IsRobbingHouse", 0);
  454. lasthcp = GetPVarInt(i, "LastHouseCP");
  455. if(!strcmp(hInfo[lasthcp][HouseOwner], pNick(i), CASE_SENSETIVE) && IsInHouse{i} == 1 && fexist(HouseFile(lasthcp)))
  456. {
  457. file = INI_Open(HouseFile(lasthcp));
  458. INI_WriteInt(file, "QuitInHouse", 1);
  459. INI_Close(file);
  460. #if GH_HOUSECARS == true
  461. SaveHouseCar(lasthcp);
  462. #endif
  463. }
  464. ExitHouse(i, lasthcp);
  465. DeletePVars(i);
  466. }
  467. UnloadHouses(); // Unload houses (also unloads the house cars)
  468. print("\n>> GarHouse v2.0 By [03]Garsino Unloaded <<\n");
  469. return 1;
  470. }
  471. public OnPlayerDeath(playerid, killerid, reason)
  472. {
  473. if(GetPVarInt(playerid, "IsRobbingHouse") == 1)
  474. {
  475. ShowInfoBox(playerid, I_HROB_FAILED_DEATH, hInfo[GetPVarInt(playerid, "LastHouseCP")][HouseName]);
  476. EndHouseRobbery(playerid);
  477. SetPVarInt(playerid, "IsRobbingHouse", 0);
  478. SetPVarInt(playerid, "TimeSinceHouseRobbery", GetTickCount());
  479. }
  480. return 1;
  481. }
  482. public OnPlayerSpawn(playerid)
  483. {
  484. #if SPAWN_IN_HOUSE == true
  485. if(GetPVarInt(playerid, "FirstSpawn") == 0)
  486. {
  487. SetTimerEx("HouseSpawning", HSPAWN_TIMER_RATE, false, "i", playerid); // Increase timer rate if your gamemodes OnPlayerSpawn gets called after the timer has ended
  488. }
  489. #endif
  490. if(GetPVarInt(playerid, "IsAnimsPreloaded") == 0)
  491. {
  492. ApplyAnimation(playerid, "CRACK", "null", 0.0, 0, 0, 0, 0, 0);
  493. SetPVarInt(playerid, "IsAnimsPreloaded", 1);
  494. }
  495. #if SPAWN_IN_HOUSE == true
  496. if(GetPVarInt(playerid, "FirstSpawn") == 0)
  497. {
  498. SetTimerEx("HouseSpawning", HSPAWN_TIMER_RATE, false, "i", playerid); // Increase timer rate if your gamemodes OnPlayerSpawn gets called after the timer has ended
  499. }
  500. #endif
  501. return 1;
  502. }
  503. #if GH_HOUSECARS == true
  504. public OnPlayerStateChange(playerid, newstate, oldstate)
  505. {
  506. if(newstate == PLAYER_STATE_DRIVER)
  507. {
  508. foreach(Houses, h)
  509. {
  510. if(GetPlayerVehicleID(playerid) == HCar[h])
  511. {
  512. switch(strcmp(hInfo[h][HouseOwner], pNick(playerid), CASE_SENSETIVE))
  513. {
  514. case 0: ShowInfoBox(playerid, I_HOUSECAR_OWNER, pNick(playerid), h);
  515. case 1:
  516. {
  517. GetPlayerPos(playerid, X, Y, Z);
  518. SetPlayerPos(playerid, (X + 3), Y, Z);
  519. ShowInfoBox(playerid, E_NOT_HOUSECAR_OWNER, h, hInfo[h][HouseOwner]);
  520. }
  521. }
  522. break;
  523. }
  524. }
  525. }
  526. return 1;
  527. }
  528. #endif
  529. public OnPlayerConnect(playerid)
  530. {
  531. new filename[HOUSEFILE_LENGTH], string1[MAX_PLAYER_NAME], string2[MAX_HOUSE_NAME], _tmpstring[256];
  532. format(filename, sizeof(filename), USERPATH, pNick(playerid));
  533. if(fexist(filename))
  534. {
  535. new hs = GetPVarInt(playerid, "GA_TMP_HOUSESTORAGE"), price = GetPVarInt(playerid, "GA_TMP_HOUSEFORSALEPRICE");
  536. INI_ParseFile(filename, "LoadUserData", false, true, playerid, true, false);
  537. fremove(filename);
  538. GetPVarString(playerid, "GA_TMP_NEWHOUSEOWNER", string2, MAX_PLAYER_NAME);
  539. GetPVarString(playerid, "GA_TMP_HOUSENAME", string1, MAX_HOUSE_NAME);
  540. CMDSString = "";
  541. format(_tmpstring, sizeof(_tmpstring), HSELLER_OFFLINE_MSG1, string1, string2);
  542. strcat(CMDSString, _tmpstring);
  543. format(_tmpstring, sizeof(_tmpstring), HSELLER_OFFLINE_MSG2, (hs + price), hs, price);
  544. strcat(CMDSString, _tmpstring);
  545. ShowInfoBoxEx(playerid, COLOUR_INFO, CMDSString);
  546. DeletePVar(playerid, "GA_TMP_HOUSESTORAGE"), DeletePVar(playerid, "GA_TMP_HOUSEFORSALEPRICE"), DeletePVar(playerid, "GA_TMP_NEWHOUSEOWNER"), DeletePVar(playerid, "GA_TMP_HOUSENAME");
  547. }
  548. SetPVarInt(playerid, "HouseRobberyTimer", -1);
  549. IsInHouse{playerid} = 0;
  550. return 1;
  551. }
  552. public OnPlayerDisconnect(playerid, reason)
  553. {
  554. new year, month, day, lastvisited[20], lasthcp = GetPVarInt(playerid, "LastHouseCP");
  555. EndHouseRobbery(playerid);
  556. if(!strcmp(hInfo[lasthcp][HouseOwner], pNick(playerid), CASE_SENSETIVE) && IsInHouse{playerid} == 1 && fexist(HouseFile(lasthcp)))
  557. {
  558. getdate(year, month, day);
  559. format(lastvisited, sizeof(lastvisited), "%02d/%02d/%d", day, month, year);
  560. new INI:file = INI_Open(HouseFile(lasthcp));
  561. INI_WriteInt(file, "QuitInHouse", 1);
  562. INI_WriteString(file, "LastVisited", lastvisited);
  563. INI_Close(file);
  564. #if GH_HOUSECARS == true
  565. SaveHouseCar(lasthcp);
  566. UnloadHouseCar(lasthcp);
  567. #endif
  568. }
  569. IsInHouse{playerid} = 0;
  570. return 1;
  571. }
  572. #if GH_USE_CPS == true
  573. public OnPlayerEnterDynamicCP(playerid, checkpointid)
  574. {
  575. if(GetPlayerState(playerid) == PLAYER_STATE_ONFOOT)
  576. {
  577. new string[256], tmpstring[50];
  578. foreach(Houses, h)
  579. {
  580. if(checkpointid == HouseCPOut[h])
  581. {
  582. SetPVarInt(playerid, "LastHouseCP", h);
  583. if(!strcmp(hInfo[h][HouseOwner], pNick(playerid), CASE_SENSETIVE))
  584. {
  585. SetPlayerHouseInterior(playerid, h);
  586. ShowInfoBoxEx(playerid, COLOUR_INFO, I_HMENU);
  587. break;
  588. }
  589. format(tmpstring, sizeof(tmpstring), "HouseKeys_%d", h);
  590. if(GetPVarInt(playerid, tmpstring) == 1)
  591. {
  592. SetPlayerHouseInterior(playerid, h);
  593. break;
  594. }
  595. if(strcmp(hInfo[h][HouseOwner], pNick(playerid), CASE_SENSETIVE) && strcmp(hInfo[h][HouseOwner], INVALID_HOWNER_NAME, CASE_SENSETIVE))
  596. {
  597. if(hInfo[h][HousePassword] == udb_hash("INVALID_HOUSE_PASSWORD"))
  598. {
  599. switch(hInfo[h][ForSale])
  600. {
  601. case 0: ShowInfoBox(playerid, LABELTEXT2, hInfo[h][HouseName], hInfo[h][HouseOwner], hInfo[h][HouseValue], h);
  602. case 1:
  603. {
  604. switch(hInfo[h][HousePrivacy])
  605. {
  606. case 0: ShowPlayerDialog(playerid, HOUSEMENU+23, DIALOG_STYLE_LIST, INFORMATION_HEADER, "Buy House (Step 1)\nBreak In", "Select", "Cancel");
  607. case 1: ShowPlayerDialog(playerid, HOUSEMENU+23, DIALOG_STYLE_LIST, INFORMATION_HEADER, "Buy House (Step 1)\nBreak In\nEnter House", "Select", "Cancel");
  608. }
  609. }
  610. }
  611. break;
  612. }
  613. if(hInfo[h][HousePassword] != udb_hash("INVALID_HOUSE_PASSWORD"))
  614. {
  615. switch(hInfo[h][ForSale])
  616. {
  617. case 0:
  618. {
  619. switch(hInfo[h][HousePrivacy])
  620. {
  621. case 0: ShowPlayerDialog(playerid, HOUSEMENU+28, DIALOG_STYLE_LIST, INFORMATION_HEADER, "Enter House Using Password\nBreak In", "Select", "Cancel");
  622. case 1: ShowPlayerDialog(playerid, HOUSEMENU+28, DIALOG_STYLE_LIST, INFORMATION_HEADER, "Enter House Using Password\nBreak In\nEnter House", "Select", "Cancel");
  623. }
  624. }
  625. case 1: ShowPlayerDialog(playerid, HOUSEMENU+23, DIALOG_STYLE_LIST, INFORMATION_HEADER, "Buy House (Step 1)\nBreak In\nEnter House", "Select", "Cancel");
  626. }
  627. break;
  628. }
  629. }
  630. if(!strcmp(hInfo[h][HouseOwner], INVALID_HOWNER_NAME, CASE_SENSETIVE) && hInfo[h][HouseValue] > 0 && GetPVarInt(playerid, "JustCreatedHouse") == 0)
  631. {
  632. format(string, sizeof(string), HMENU_BUY_HOUSE, hInfo[h][HouseValue]);
  633. ShowPlayerDialog(playerid, HOUSEMENU+4, DIALOG_STYLE_MSGBOX, INFORMATION_HEADER, string, "Buy", "Cancel");
  634. break;
  635. }
  636. }
  637. if(checkpointid == HouseCPInt[h])
  638. {
  639. switch(GetPVarInt(playerid, "HousePreview"))
  640. {
  641. case 0: ExitHouse(playerid, h);
  642. #if GH_HINTERIOR_UPGRADE == true
  643. case 1:
  644. {
  645. GetPVarString(playerid, "HousePrevName", tmpstring, 50);
  646. format(string, sizeof(string), HMENU_BUY_HINTERIOR, tmpstring, GetPVarInt(playerid, "HousePrevValue"));
  647. ShowPlayerDialog(playerid, HOUSEMENU+17, DIALOG_STYLE_MSGBOX, INFORMATION_HEADER, string, "Buy", "Cancel");
  648. }
  649. #endif
  650. }
  651. break;
  652. }
  653. }
  654. }
  655. return 1;
  656. }
  657. public OnPlayerLeaveDynamicCP(playerid, checkpointid)
  658. {
  659. if(GetPlayerState(playerid) == PLAYER_STATE_ONFOOT && GetPVarInt(playerid, "JustCreatedHouse") == 1)
  660. {
  661. foreach(Houses, h)
  662. {
  663. if(checkpointid == HouseCPOut[h])
  664. {
  665. DeletePVar(playerid, "JustCreatedHouse");
  666. break;
  667. }
  668. }
  669. }
  670. return 1;
  671. }
  672. #else
  673. public OnPlayerPickUpDynamicPickup(playerid, pickupid)
  674. {
  675. if(GetPlayerState(playerid) == PLAYER_STATE_ONFOOT)
  676. {
  677. new string[256], tmpstring[50];
  678. foreach(Houses, h)
  679. {
  680. if(pickupid == HousePickupOut[h])
  681. {
  682. SetPVarInt(playerid, "LastHouseCP", h);
  683. if(!strcmp(hInfo[h][HouseOwner], pNick(playerid), CASE_SENSETIVE))
  684. {
  685. SetPlayerHouseInterior(playerid, h);
  686. ShowInfoBoxEx(playerid, COLOUR_INFO, I_HMENU);
  687. break;
  688. }
  689. format(tmpstring, sizeof(tmpstring), "HouseKeys_%d", h);
  690. if(GetPVarInt(playerid, tmpstring) == 1)
  691. {
  692. SetPlayerHouseInterior(playerid, h);
  693. break;
  694. }
  695. if(strcmp(hInfo[h][HouseOwner], pNick(playerid), CASE_SENSETIVE) && strcmp(hInfo[h][HouseOwner], INVALID_HOWNER_NAME, CASE_SENSETIVE))
  696. {
  697. if(hInfo[h][HousePassword] == udb_hash("INVALID_HOUSE_PASSWORD"))
  698. {
  699. switch(hInfo[h][ForSale])
  700. {
  701. case 0: ShowInfoBox(playerid, LABELTEXT2, hInfo[h][HouseName], hInfo[h][HouseOwner], hInfo[h][HouseValue], h);
  702. case 1:
  703. {
  704. switch(hInfo[h][HousePrivacy])
  705. {
  706. case 0: ShowPlayerDialog(playerid, HOUSEMENU+23, DIALOG_STYLE_LIST, INFORMATION_HEADER, "Buy House (Step 1)\nBreak In", "Select", "Cancel");
  707. case 1: ShowPlayerDialog(playerid, HOUSEMENU+23, DIALOG_STYLE_LIST, INFORMATION_HEADER, "Buy House (Step 1)\nBreak In\nEnter House", "Select", "Cancel");
  708. }
  709. }
  710. }
  711. break;
  712. }
  713. if(hInfo[h][HousePassword] != udb_hash("INVALID_HOUSE_PASSWORD"))
  714. {
  715. switch(hInfo[h][ForSale])
  716. {
  717. case 0:
  718. {
  719. switch(hInfo[h][HousePrivacy])
  720. {
  721. case 0: ShowPlayerDialog(playerid, HOUSEMENU+28, DIALOG_STYLE_LIST, INFORMATION_HEADER, "Enter House Using Password\nBreak In", "Select", "Cancel");
  722. case 1: ShowPlayerDialog(playerid, HOUSEMENU+28, DIALOG_STYLE_LIST, INFORMATION_HEADER, "Enter House Using Password\nBreak In\nEnter House", "Select", "Cancel");
  723. }
  724. }
  725. case 1: ShowPlayerDialog(playerid, HOUSEMENU+23, DIALOG_STYLE_LIST, INFORMATION_HEADER, "Buy House (Step 1)\nBreak In\nEnter House", "Select", "Cancel");
  726. }
  727. break;
  728. }
  729. }
  730. if(!strcmp(hInfo[h][HouseOwner], INVALID_HOWNER_NAME, CASE_SENSETIVE) && hInfo[h][HouseValue] > 0 && GetPVarInt(playerid, "JustCreatedHouse") == 0)
  731. {
  732. format(string, sizeof(string), HMENU_BUY_HOUSE, hInfo[h][HouseValue]);
  733. ShowPlayerDialog(playerid, HOUSEMENU+4, DIALOG_STYLE_MSGBOX, INFORMATION_HEADER, string, "Buy", "Cancel");
  734. break;
  735. }
  736. }
  737. if(pickupid == HousePickupInt[h])
  738. {
  739. switch(GetPVarInt(playerid, "HousePreview"))
  740. {
  741. case 0: ExitHouse(playerid, h);
  742. #if GH_HINTERIOR_UPGRADE == true
  743. case 1:
  744. {
  745. GetPVarString(playerid, "HousePrevName", tmpstring, 50);
  746. format(string, sizeof(string), HMENU_BUY_HINTERIOR, tmpstring, GetPVarInt(playerid, "HousePrevValue"));
  747. ShowPlayerDialog(playerid, HOUSEMENU+17, DIALOG_STYLE_MSGBOX, INFORMATION_HEADER, string, "Buy", "Cancel");
  748. }
  749. #endif
  750. }
  751. break;
  752. }
  753. }
  754. }
  755. return 1;
  756. }
  757. #endif
  758. stock Float:DistanceToPoint(Float:X1, Float:Y1, Float:Z1, Float:X2, Float:Y2, Float:Z2) return Float:floatsqroot(((X2 - X1) * (X2 - X1)) + ((Y2 - Y1) * (Y2 - Y1)) + ((Z2 - Z1) * (Z2 - Z1)));
  759. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  760. {
  761. new string[400], _tmpstring[256], INI:file, filename[HOUSEFILE_LENGTH], h = GetPVarInt(playerid, "LastHouseCP"), amount = floatround(strval(inputtext));
  762. format(filename, sizeof(filename), FILEPATH, h);
  763. if(dialogid == HOUSEMENU && response)
  764. {
  765. switch(listitem)
  766. {
  767. case 0: ShowPlayerDialog(playerid, HOUSEMENU+19, DIALOG_STYLE_LIST, INFORMATION_HEADER, "Set House For Sale\nCancel Active House Sale\nSell House", "Select", "Cancel");
  768. case 1:
  769. {
  770. #if GH_USE_HOUSESTORAGE == false
  771. ShowInfoBoxEx(playerid, COLOUR_INFO, E_NO_HOUSESTORAGE);
  772. #else
  773. #if GH_USE_WEAPONSTORAGE == true
  774. ShowPlayerDialog(playerid, HOUSEMENU+18, DIALOG_STYLE_LIST, INFORMATION_HEADER, "Money Storage\nWeapon Storage", "Select", "Cancel");
  775. #else
  776. ShowPlayerDialog(playerid, HOUSEMENU+10, DIALOG_STYLE_LIST, INFORMATION_HEADER, "Deposit Money\nWithdraw Money\nCheck Balance", "Select", "Cancel");
  777. #endif
  778. #endif
  779. }
  780. case 2: ShowPlayerDialog(playerid, HOUSEMENU+14, DIALOG_STYLE_INPUT, INFORMATION_HEADER, "Type In The New House Name Below:\n\nPress 'Cancel' To Cancel", "Done", "Cancel");
  781. case 3: ShowPlayerDialog(playerid, HOUSEMENU+13, DIALOG_STYLE_INPUT, INFORMATION_HEADER, "Type In The New House Password Below:\nLeave The Box Empty If You Want To Keep Your Current House Password.\nPress 'Remove' To Remove The House Password.", "Done", "Remove");
  782. case 4:
  783. {
  784. #if GH_HINTERIOR_UPGRADE == true
  785. ShowPlayerDialog(playerid, HOUSEMENU+16, DIALOG_STYLE_LIST, INFORMATION_HEADER, "Preview House Interior\nBuy House Interior", "Select", "Cancel");
  786. #else
  787. ShowPlayerDialog(playerid, HOUSEMENU+24, DIALOG_STYLE_LIST, INFORMATION_HEADER, "Open House For Visitors\nClose House For Visitors", "Select", "Cancel");
  788. #endif
  789. }
  790. case 5:
  791. {
  792. #if GH_HINTERIOR_UPGRADE == true
  793. ShowPlayerDialog(playerid, HOUSEMENU+24, DIALOG_STYLE_LIST, INFORMATION_HEADER, "Open House For Visitors\nClose House For Visitors", "Select", "Cancel");
  794. #else
  795. new tmpcount = 1, total = (CountPlayersInHouse(h) - 1);
  796. if(CountPlayersInHouse(h) == 0) return ShowInfoBoxEx(playerid, COLOUR_SYSTEM, E_NONE_IN_HOUSE);
  797. CMDSString = "";
  798. foreach(Player, i)
  799. {
  800. if(!IsPlayerInHouse(i, h)) continue;
  801. if(playerid == i) continue;
  802. if(tmpcount == total)
  803. {
  804. format(_tmpstring, sizeof(_tmpstring), "{00BC00}%d.\t{FFFF2A}%s in %s", tmpcount, pNick(i), i);
  805. }
  806. else format(_tmpstring, sizeof(_tmpstring), "{00BC00}%d.\t{FFFF2A}%s (%d)\n", tmpcount, pNick(i), i);
  807. strcat(CMDSString, _tmpstring);
  808. tmpcount++;
  809. }
  810. ShowPlayerDialog(playerid, HOUSEMENU+25, DIALOG_STYLE_LIST, INFORMATION_HEADER, CMDSString, "Select", "Cancel");
  811. #endif
  812. }
  813. case 6:
  814. {
  815. #if GH_HINTERIOR_UPGRADE == true
  816. new tmpcount = 1, total = (CountPlayersInHouse(h) - 1);
  817. if(CountPlayersInHouse(h) == 0) return ShowInfoBoxEx(playerid, COLOUR_SYSTEM, E_NONE_IN_HOUSE);
  818. CMDSString = "";
  819. foreach(Player, i)
  820. {
  821. if(!IsPlayerInHouse(i, h)) continue;
  822. if(playerid == i) continue;
  823. if(tmpcount == total)
  824. {
  825. format(_tmpstring, sizeof(_tmpstring), "{00BC00}%d.\t{FFFF2A}%s in %s", tmpcount, pNick(i), i);
  826. }
  827. else format(_tmpstring, sizeof(_tmpstring), "{00BC00}%d.\t{FFFF2A}%s (%d)\n", tmpcount, pNick(i), i);
  828. strcat(CMDSString, _tmpstring);
  829. tmpcount++;
  830. }
  831. ShowPlayerDialog(playerid, HOUSEMENU+25, DIALOG_STYLE_LIST, INFORMATION_HEADER, CMDSString, "Select", "Cancel");
  832. #else
  833. ShowPlayerDialog(playerid, HOUSEMENU+27, DIALOG_STYLE_LIST, INFORMATION_HEADER, "Buy House Alarm\t\t$"#HUPGRADE_ALARM"\nBuy Security Camera\t\t$"#HUPGRADE_CAMERA"\nBuy House Security Dog\t$"#HUPGRADE_DOG"\nBuy Better Houselock\t\t$"#HUPGRADE_UPGRADED_HLOCK"", "Select", "Cancel");
  834. #endif
  835. }
  836. case 7: ShowPlayerDialog(playerid, HOUSEMENU+27, DIALOG_STYLE_LIST, INFORMATION_HEADER, "Buy House Alarm\t\t$"#HUPGRADE_ALARM"\nBuy Security Camera\t\t$"#HUPGRADE_CAMERA"\nBuy House Security Dog\t$"#HUPGRADE_DOG"\nBuy Better Houselock\t\t$"#HUPGRADE_UPGRADED_HLOCK"", "Select", "Cancel");
  837. }
  838. return 1;
  839. }
  840. //------------------------------------------------------------------------------
  841. // House Sale
  842. //------------------------------------------------------------------------------
  843. if(dialogid == HOUSEMENU+3 && response)
  844. {
  845. if(GetOwnedHouses(playerid) == 0) return ShowInfoBoxEx(playerid, COLOUR_SYSTEM, E_NO_HOUSES_OWNED);
  846. else
  847. {
  848. new procent = ReturnProcent(hInfo[h][HouseValue], HOUSE_SELLING_PROCENT);
  849. GivePlayerMoney(playerid, procent);
  850. if(hInfo[h][HouseStorage] >= 1)
  851. {
  852. CMDSString = "";
  853. format(_tmpstring, sizeof(_tmpstring), I_SELL_HOUSE1_1, procent);
  854. strcat(CMDSString, _tmpstring);
  855. format(_tmpstring, sizeof(_tmpstring), I_SELL_HOUSE1_2, (hInfo[h][HouseValue] - procent), hInfo[h][HouseStorage]);
  856. strcat(CMDSString, _tmpstring);
  857. ShowInfoBoxEx(playerid, COLOUR_INFO, CMDSString);
  858. GivePlayerMoney(playerid, hInfo[h][HouseStorage]);
  859. }
  860. if(hInfo[h][HouseStorage] == 0)
  861. {
  862. ShowInfoBox(playerid, I_SELL_HOUSE2, hInfo[h][HouseName], procent, (hInfo[h][HouseValue] - procent));
  863. }
  864. format(hInfo[h][HouseName], MAX_HOUSE_NAME, "%s", DEFAULT_HOUSE_NAME);
  865. format(hInfo[h][HouseOwner], MAX_PLAYER_NAME, "%s", INVALID_HOWNER_NAME);
  866. hInfo[h][HousePassword] = udb_hash("INVALID_HOUSE_PASSWORD");
  867. hInfo[h][HouseStorage] = hInfo[h][HouseAlarm] = hInfo[h][HouseDog] = hInfo[h][HouseCamera] = hInfo[h][UpgradedLock] = 0;
  868. hInfo[h][HouseValue] = ReturnProcent(hInfo[h][HouseValue], HOUSE_SELLING_PROCENT);
  869. file = INI_Open(filename);
  870. INI_WriteInt(file, "HouseValue", hInfo[h][HouseValue]);
  871. INI_WriteString(file, "HouseOwner", INVALID_HOWNER_NAME);
  872. INI_WriteInt(file, "HousePassword", hInfo[h][HousePassword]);
  873. INI_WriteString(file, "HouseName", DEFAULT_HOUSE_NAME);
  874. INI_WriteInt(file, "HouseStorage", 0);
  875. INI_Close(file);
  876. foreach(Houses, h2)
  877. {
  878. if(IsHouseInRangeOfHouse(h, h2, RANGE_BETWEEN_HOUSES) && h2 != h)
  879. {
  880. hInfo[h2][HouseValue] = (hInfo[h2][HouseValue] - ReturnProcent(hInfo[h2][HouseValue], HOUSE_SELLING_PROCENT2));
  881. file = INI_Open(HouseFile(h2));
  882. INI_WriteInt(file, "HouseValue", hInfo[h2][HouseValue]);
  883. INI_Close(file);
  884. UpdateHouseText(h2);
  885. }
  886. }
  887. foreach(Player, i)
  888. {
  889. if(IsPlayerInHouse(i, h))
  890. {
  891. ExitHouse(i, h);
  892. ShowInfoBoxEx(i, COLOUR_INFO, I_TO_PLAYERS_HSOLD);
  893. }
  894. }
  895. #if GH_USE_MAPICONS == true
  896. DestroyDynamicMapIcon(HouseMIcon[h]);
  897. HouseMIcon[h] = CreateDynamicMapIcon(hInfo[h][CPOutX], hInfo[h][CPOutY], hInfo[h][CPOutZ], 31, -1, hInfo[h][SpawnWorld], hInfo[h][SpawnInterior], -1, MICON_VD);
  898. #endif
  899. UpdateHouseText(h);
  900. }
  901. return 1;
  902. }
  903. //------------------------------------------------------------------------------
  904. // House Buying
  905. //------------------------------------------------------------------------------
  906. if(dialogid == HOUSEMENU+4)
  907. {
  908. if(response)
  909. {
  910. new hname[MAX_PLAYER_NAME+9];
  911. if(GetOwnedHouses(playerid) >= MAX_HOUSES_OWNED) { ShowInfoBox(playerid, E_MAX_HOUSES_OWNED, MAX_HOUSES_OWNED, AddS(MAX_HOUSES_OWNED)); return 1; }
  912. if(strcmp(hInfo[h][HouseOwner], pNick(playerid), CASE_SENSETIVE) && strcmp(hInfo[h][HouseOwner], INVALID_HOWNER_NAME, CASE_SENSETIVE)) return ShowInfoBoxEx(playerid, COLOUR_SYSTEM, E_H_ALREADY_OWNED);
  913. if(hInfo[h][HouseValue] > GetPlayerMoney(playerid)) { ShowInfoBox(playerid, E_CANT_AFFORD_HOUSE, hInfo[h][HouseValue], GetPlayerMoney(playerid), (hInfo[h][HouseValue] - GetPlayerMoney(playerid))); return 1; }
  914. else
  915. {
  916. format(hname, sizeof(hname), "%s's House", pNick(playerid));
  917. format(hInfo[h][HouseName], sizeof(hname), "%s", hname);
  918. format(hInfo[h][HouseOwner], MAX_PLAYER_NAME, "%s", pNick(playerid));
  919. hInfo[h][HousePassword] = udb_hash("INVALID_HOUSE_PASSWORD");
  920. hInfo[h][HouseStorage] = 0;
  921. GivePlayerMoney(playerid, -hInfo[h][HouseValue]);
  922. file = INI_Open(filename);
  923. INI_WriteString(file, "HouseOwner", pNick(playerid));
  924. INI_WriteInt(file, "HousePassword", hInfo[h][HousePassword]);
  925. INI_WriteString(file, "HouseName", hname);
  926. INI_WriteInt(file, "HouseStorage", 0);
  927. INI_Close(file);
  928. ShowInfoBox(playerid, I_BUY_HOUSE, hInfo[h][HouseValue]);
  929. foreach(Houses, h2)
  930. {
  931. if(IsHouseInRangeOfHouse(h, h2, RANGE_BETWEEN_HOUSES) && h2 != h)
  932. {
  933. file = INI_Open(HouseFile(h2));
  934. INI_WriteInt(file, "HouseValue", (hInfo[h2][HouseValue] + ReturnProcent(hInfo[h2][HouseValue], HOUSE_SELLING_PROCENT2)));
  935. UpdateHouseText(h2);
  936. INI_Close(file);
  937. }
  938. }
  939. #if GH_USE_MAPICONS == true
  940. DestroyDynamicMapIcon(HouseMIcon[h]);
  941. HouseMIcon[h] = CreateDynamicMapIcon(hInfo[h][CPOutX], hInfo[h][CPOutY], hInfo[h][CPOutZ], 32, -1, hInfo[h][SpawnWorld], hInfo[h][SpawnInterior], -1, MICON_VD);
  942. #endif
  943. UpdateHouseText(h);
  944. }
  945. }
  946. return 1;
  947. }
  948. //------------------------------------------------------------------------------
  949. // House Password
  950. //------------------------------------------------------------------------------
  951. if(dialogid == HOUSEMENU+13)
  952. {
  953. if(response)
  954. {
  955. if(strlen(inputtext) > MAX_HOUSE_PASSWORD || (strlen(inputtext) < MIN_HOUSE_PASSWORD && strlen(inputtext) >= 1)) return ShowInfoBoxEx(playerid, COLOUR_SYSTEM, E_INVALID_HPASS_LENGTH);
  956. if(!strcmp(inputtext, "INVALID_HOUSE_PASSWORD", CASE_SENSETIVE)) return ShowInfoBoxEx(playerid, COLOUR_SYSTEM, E_INVALID_HPASS);
  957. if(strfind(inputtext, "%", CASE_SENSETIVE) != -1 || strfind(inputtext, "~", CASE_SENSETIVE) != -1) return ShowInfoBoxEx(playerid, COLOUR_SYSTEM, E_INVALID_HPASS_CHARS);
  958. else
  959. {
  960. if(strlen(inputtext) >= 1)
  961. {
  962. hInfo[h][HousePassword] = udb_hash(inputtext);
  963. file = INI_Open(filename);
  964. INI_WriteInt(file, "HousePassword", hInfo[h][HousePassword]);
  965. INI_Close(file);
  966. ShowInfoBox(playerid, I_HPASSWORD_CHANGED, inputtext);
  967. }
  968. else ShowInfoBoxEx(playerid, COLOUR_INFO, I_HPASS_NO_CHANGE);
  969. }
  970. }
  971. if(!response)
  972. {
  973. file = INI_Open(filename);
  974. INI_WriteInt(file, "HousePassword", udb_hash("INVALID_HOUSE_PASSWORD"));
  975. INI_Close(file);
  976. ShowInfoBoxEx(playerid, COLOUR_INFO, I_HPASS_REMOVED);
  977. }
  978. return 1;
  979. }
  980. //------------------------------------------------------------------------------
  981. // House Name
  982. //------------------------------------------------------------------------------
  983. if(dialogid == HOUSEMENU+14)
  984. {
  985. if(response)
  986. {
  987. if(strfind(inputtext, "%", CASE_SENSETIVE) != -1 || strfind(inputtext, "~", CASE_SENSETIVE) != -1) return ShowInfoBoxEx(playerid, COLOUR_SYSTEM, E_INVALID_HNAME_CHARS);
  988. if(strlen(inputtext) < MIN_HOUSE_NAME || strlen(inputtext) > MAX_HOUSE_NAME) return ShowInfoBoxEx(playerid, COLOUR_SYSTEM, E_INVALID_HNAME_LENGTH);
  989. else
  990. {
  991. format(hInfo[h][HouseName], MAX_HOUSE_NAME, "%s", inputtext);
  992. file = INI_Open(filename);
  993. INI_WriteString(file, "HouseName", inputtext);
  994. INI_Close(file);
  995. ShowInfoBox(playerid, I_HNAME_CHANGED, inputtext);
  996. UpdateHouseText(h);
  997. }
  998. }
  999. return 1;
  1000. }
  1001. //------------------------------------------------------------------------------
  1002. // House Interior Upgrade
  1003. //------------------------------------------------------------------------------
  1004. if(dialogid == HOUSEMENU+15 && response)
  1005. {
  1006. new _int = hInfo[h][HouseInterior];
  1007. SetPVarInt(playerid, "OldHouseInt", _int);
  1008. Loop(hint, MAX_HOUSE_INTERIORS, 0)
  1009. {
  1010. if(hint == listitem)
  1011. {
  1012. SetPVarInt(playerid, "HousePrevInt", hint), SetPVarInt(playerid, "HousePrevValue", hIntInfo[hint][IntValue]), SetPVarString(playerid, "HousePrevName", hIntInfo[hint][IntName]);
  1013. }
  1014. }
  1015. if(_int == GetPVarInt(playerid, "HousePrevInt")) return ShowInfoBoxEx(playerid, COLOUR_SYSTEM, E_ALREADY_HAVE_HINTERIOR);
  1016. else
  1017. {
  1018. new hprevvalue = GetPVarInt(playerid, "HousePrevValue");
  1019. GetPVarString(playerid, "HousePrevName", string, 50);
  1020. //------------------------------------------------------------------------------
  1021. switch(GetPVarInt(playerid, "HouseIntUpgradeMod"))
  1022. {
  1023. case 1:
  1024. {
  1025. if(GetSecondsBetweenAction(GetPVarInt(playerid, "HousePrevTime")) < (TIME_BETWEEN_VISITS * 60000) && GetPVarInt(playerid, "HousePrevTime") != 0) return ShowInfoBoxEx(playerid, COLOUR_SYSTEM, E_HINT_WAIT_BEFORE_VISITING);
  1026. SetPVarInt(playerid, "IsHouseVisiting", 1);
  1027. SetPVarInt(playerid, "HousePreview", 1);
  1028. SetPVarInt(playerid, "ChangeHouseInt", 1);
  1029. SetPVarInt(playerid, "HousePrevTime", GetTickCount());
  1030. SetPVarInt(playerid, "HousePrevTimer", SetTimerEx("HouseVisiting", (MAX_VISIT_TIME * 60000), false, "i", playerid));
  1031. ShowInfoBox(playerid, I_VISITING_HOUSEINT, string, hprevvalue, MAX_VISIT_TIME, AddS(MAX_VISIT_TIME));
  1032.  
  1033. }
  1034. case 2:
  1035. {
  1036. if(hprevvalue > GetPlayerMoney(playerid))
  1037. {
  1038. CMDSString = "";
  1039. format(_tmpstring, sizeof(_tmpstring), E_CANT_AFFORD_HINT1, string, hprevvalue);
  1040. strcat(CMDSString, _tmpstring);
  1041. format(_tmpstring, sizeof(_tmpstring), E_CANT_AFFORD_HINT2, GetPlayerMoney(playerid), (hprevvalue - GetPlayerMoney(playerid)));
  1042. strcat(CMDSString, _tmpstring);
  1043. ShowInfoBoxEx(playerid, COLOUR_INFO, CMDSString);
  1044. }
  1045. if(hprevvalue <= GetPlayerMoney(playerid))
  1046. {
  1047. GivePlayerMoney(playerid, -hprevvalue);
  1048. SetPVarInt(playerid, "ChangeHouseInt", 1);
  1049. file = INI_Open(filename);
  1050. INI_Close(file);
  1051. ShowInfoBox(playerid, I_HINT_BOUGHT, string, hprevvalue);
  1052. }
  1053. }
  1054. }
  1055. //------------------------------------------------------------------------------
  1056. if(GetPVarInt(playerid, "ChangeHouseInt") == 1)
  1057. {
  1058. hInfo[h][HouseInterior] = GetPVarInt(playerid, "HousePrevInt");
  1059. file = INI_Open(filename);
  1060. INI_WriteInt(file, "HouseInterior", hInfo[h][HouseInterior]);
  1061. INI_Close(file);
  1062. DestroyHouseEntrance(h, TYPE_INT);
  1063. CreateCorrectHouseExitCP(h);
  1064. foreach(Player, i)
  1065. {
  1066. if(GetPVarInt(i, "LastHouseCP") == h && IsInHouse{i} == 1)
  1067. {
  1068. SetPlayerHouseInterior(i, h);
  1069. }
  1070. }
  1071. DeletePVar(playerid, "ChangeHouseInt");
  1072. }
  1073. //------------------------------------------------------------------------------
  1074. }
  1075. return 1;
  1076. }
  1077. //------------------------------------------------------------------------------
  1078. // House Interior Mode Selecting
  1079. //------------------------------------------------------------------------------
  1080. #if GH_HINTERIOR_UPGRADE == true
  1081. if(dialogid == HOUSEMENU+16 && response)
  1082. {
  1083. switch(listitem)
  1084. {
  1085. case 0: SetPVarInt(playerid, "HouseIntUpgradeMod", 1);
  1086. case 1: SetPVarInt(playerid, "HouseIntUpgradeMod", 2);
  1087. }
  1088. CMDSString = "";
  1089. Loop(i, MAX_HOUSE_INTERIORS, 0)
  1090. {
  1091. format(filename, sizeof(filename), HINT_FILEPATH, i);
  1092. if(!fexist(filename)) continue;
  1093. if(i == (MAX_HOUSE_INTERIORS-1))
  1094. {
  1095. switch(strlen(hIntInfo[i][IntName]))
  1096. {
  1097. case 0..13: format(_tmpstring, sizeof(_tmpstring), "{00BC00}%d.\t{FFFF2A}%s\t\t\t{00BC00}$%d", (i + 1), hIntInfo[i][IntName], hIntInfo[i][IntValue]);
  1098. default: format(_tmpstring, sizeof(_tmpstring), "{00BC00}%d.\t{FFFF2A}%s\t\t{00BC00}$%d", (i + 1), hIntInfo[i][IntName], hIntInfo[i][IntValue]);
  1099. }
  1100. }
  1101. else
  1102. {
  1103. switch(strlen(hIntInfo[i][IntName]))
  1104. {
  1105. case 0..13: format(_tmpstring, sizeof(_tmpstring), "{00BC00}%d.\t{FFFF2A}%s\t\t\t{00BC00}$%d\n", (i + 1), hIntInfo[i][IntName], hIntInfo[i][IntValue]);
  1106. default: format(_tmpstring, sizeof(_tmpstring), "{00BC00}%d.\t{FFFF2A}%s\t\t{00BC00}$%d\n", (i + 1), hIntInfo[i][IntName], hIntInfo[i][IntValue]);
  1107. }
  1108. }
  1109. strcat(CMDSString, _tmpstring);
  1110. }
  1111. ShowPlayerDialog(playerid, HOUSEMENU+15, DIALOG_STYLE_LIST, INFORMATION_HEADER, CMDSString, "Buy", "Cancel");
  1112. return 1;
  1113. }
  1114. #endif
  1115. //------------------------------------------------------------------------------
  1116. // House Interior Upgrade
  1117. //------------------------------------------------------------------------------
  1118. #if GH_HINTERIOR_UPGRADE == true
  1119. if(dialogid == HOUSEMENU+17)
  1120. {
  1121. KillTimer(GetPVarInt(playerid, "HousePrevTimer"));
  1122. DeletePVar(playerid, "IsHouseVisiting"), DeletePVar(playerid, "HousePrevTimer");
  1123. file = INI_Open(filename);
  1124. switch(response)
  1125. {
  1126. case 0:
  1127. {
  1128. hInfo[h][HouseInterior] = GetPVarInt(playerid, "OldHouseInt");
  1129. INI_WriteInt(file, "HouseInterior", hInfo[h][HouseInterior]);
  1130. }
  1131. case 1:
  1132. {
  1133. new hprevvalue = GetPVarInt(playerid, "HousePrevValue");
  1134. GetPVarString(playerid, "HousePrevName", string, 50);
  1135. if(GetPlayerMoney(playerid) < GetPVarInt(playerid, "HousePrevValue"))
  1136. {
  1137. hInfo[h][HouseInterior] = GetPVarInt(playerid, "OldHouseInt");
  1138. INI_WriteInt(file, "HouseInterior", hInfo[h][HouseInterior]);
  1139. CMDSString = "";
  1140. format(_tmpstring, sizeof(_tmpstring), E_CANT_AFFORD_HINT1, string, hprevvalue);
  1141. strcat(CMDSString, _tmpstring);
  1142. format(_tmpstring, sizeof(_tmpstring), E_CANT_AFFORD_HINT2, GetPlayerMoney(playerid), (hprevvalue - GetPlayerMoney(playerid)));
  1143. strcat(CMDSString, _tmpstring);
  1144. ShowInfoBoxEx(playerid, COLOUR_INFO, CMDSString);
  1145. }
  1146. else
  1147. {
  1148. GivePlayerMoney(playerid, -hprevvalue);
  1149. hInfo[h][HouseInterior] = GetPVarInt(playerid, "HousePrevInt");
  1150. INI_WriteString(file, "HouseInteriorName", string);
  1151. INI_WriteInt(file, "HouseInterior", hInfo[h][HouseInterior]);
  1152. INI_WriteInt(file, "HouseInteriorValue", hprevvalue);
  1153. ShowInfoBox(playerid, I_HINT_BOUGHT, string, hprevvalue);
  1154. }
  1155. }
  1156. }
  1157. INI_Close(file);
  1158. //------------------------------------------------------------------------------
  1159. DestroyHouseEntrance(h, TYPE_INT);
  1160. CreateCorrectHouseExitCP(h);
  1161. foreach(Player, i)
  1162. {
  1163. if(GetPVarInt(i, "LastHouseCP") == h && IsInHouse{i} == 1)
  1164. {
  1165. SetPlayerHouseInterior(i, h);
  1166. }
  1167. }
  1168. SetPVarInt(playerid, "HousePreview", 0);
  1169. //------------------------------------------------------------------------------
  1170. return 1;
  1171. }
  1172. #endif
  1173. //------------------------------------------------------------------------------
  1174. // Money Storage
  1175. //------------------------------------------------------------------------------
  1176. if(dialogid == HOUSEMENU+10 && response)
  1177. {
  1178. if(listitem == 0) // Deposit
  1179. {
  1180. format(string, sizeof(string), I_HINT_DEPOSIT1, hInfo[h][HouseStorage]);
  1181. ShowPlayerDialog(playerid, HOUSEMENU+11, DIALOG_STYLE_INPUT, INFORMATION_HEADER, string, "Deposit", "Cancel");
  1182. }
  1183. if(listitem == 1) // Withdraw
  1184. {
  1185. format(string, sizeof(string), I_HINT_WITHDRAW1, hInfo[h][HouseStorage]);
  1186. ShowPlayerDialog(playerid, HOUSEMENU+12, DIALOG_STYLE_INPUT, INFORMATION_HEADER, string, "Withdraw", "Cancel");
  1187. }
  1188. if(listitem == 2) // Check Balance
  1189. {
  1190. ShowInfoBox(playerid, I_HINT_CHECKBALANCE, hInfo[h][HouseStorage]);
  1191. }
  1192. return 1;
  1193. }
  1194. //------------------------------------------------------------------------------
  1195. if(dialogid == HOUSEMENU+11 && response)
  1196. {
  1197. if(amount > GetPlayerMoney(playerid)) return ShowInfoBoxEx(playerid, COLOUR_SYSTEM, E_NOT_ENOUGH_PMONEY);
  1198. if(amount < 1) return ShowInfoBoxEx(playerid, COLOUR_SYSTEM, E_INVALID_AMOUNT);
  1199. if((hInfo[h][HouseStorage] + amount) >= 25000000) return ShowInfoBoxEx(playerid, COLOUR_SYSTEM, E_HSTORAGE_L_REACHED);
  1200. else
  1201. {
  1202. hInfo[h][HouseStorage] = (hInfo[h][HouseStorage] + amount);
  1203. file = INI_Open(filename);
  1204. INI_WriteInt(file, "HouseStorage", hInfo[h][HouseStorage]);
  1205. INI_Close(file);
  1206. GivePlayerMoney(playerid, -amount);
  1207. ShowInfoBox(playerid, I_HINT_DEPOSIT2, amount, hInfo[h][HouseStorage]);
  1208. }
  1209. return 1;
  1210. }
  1211. //------------------------------------------------------------------------------
  1212. if(dialogid == HOUSEMENU+12 && response)
  1213. {
  1214. if(amount > hInfo[h][HouseStorage]) return ShowInfoBoxEx(playerid, COLOUR_SYSTEM, E_NOT_ENOUGH_HSMONEY);
  1215. if(amount < 1) return ShowInfoBoxEx(playerid, COLOUR_SYSTEM, E_INVALID_AMOUNT);
  1216. else
  1217. {
  1218. hInfo[h][HouseStorage] = (hInfo[h][HouseStorage] - amount);
  1219. file = INI_Open(filename);
  1220. INI_WriteInt(file, "HouseStorage", hInfo[h][HouseStorage]);
  1221. INI_Close(file);
  1222. GivePlayerMoney(playerid, amount);
  1223. ShowInfoBox(playerid, I_HINT_WITHDRAW2, amount, hInfo[h][HouseStorage]);
  1224. }
  1225. return 1;
  1226. }
  1227. //------------------------------------------------------------------------------
  1228. // House Sale
  1229. //------------------------------------------------------------------------------
  1230. if(dialogid == HOUSEMENU+18 && response)
  1231. {
  1232. switch(listitem)
  1233. {
  1234. case 0: ShowPlayerDialog(playerid, HOUSEMENU+10, DIALOG_STYLE_LIST, INFORMATION_HEADER, "Deposit Money\nWithdraw Money\nCheck Balance", "Select", "Cancel");
  1235. case 1: ShowPlayerDialog(playerid, HOUSEMENU+30, DIALOG_STYLE_LIST, INFORMATION_HEADER, "Store Your Current Weapons\nReceive House Storage Weapons", "Select", "Cancel");
  1236. }
  1237. }
  1238. //------------------------------------------------------------------------------
  1239. // Selling House
  1240. //------------------------------------------------------------------------------
  1241. if(dialogid == HOUSEMENU+19 && response)
  1242. {
  1243. switch(listitem)
  1244. {
  1245. case 0: ShowPlayerDialog(playerid, HOUSEMENU+20, DIALOG_STYLE_INPUT, INFORMATION_HEADER, HMENU_SELL_HOUSE2, "Select", "Cancel");
  1246. case 1: ShowPlayerDialog(playerid, HOUSEMENU+21, DIALOG_STYLE_MSGBOX, INFORMATION_HEADER, HMENU_HSALE_CANCEL, "Remove", "Cancel");
  1247. case 2:
  1248. {
  1249. format(string, sizeof(string), HMENU_SELL_HOUSE, hInfo[h][HouseName], ReturnProcent(hInfo[h][HouseValue], HOUSE_SELLING_PROCENT));
  1250. ShowPlayerDialog(playerid, HOUSEMENU+3, DIALOG_STYLE_MSGBOX, INFORMATION_HEADER, string, "Sell", "Cancel");
  1251. }
  1252. }
  1253. return 1;
  1254. }
  1255. //------------------------------------------------------------------------------
  1256. // Selling House
  1257. //------------------------------------------------------------------------------
  1258. if(dialogid == HOUSEMENU+20 && response)
  1259. {
  1260. if(amount < MIN_HOUSE_VALUE || amount > MAX_HOUSE_VALUE) return ShowInfoBoxEx(playerid, COLOUR_SYSTEM, E_INVALID_HSELL_AMOUNT);
  1261. else
  1262. {
  1263. hInfo[h][ForSalePrice] = amount;
  1264. hInfo[h][ForSale] = 1;
  1265. file = INI_Open(filename);
  1266. INI_WriteInt(file, "ForSale", 1);
  1267. INI_WriteInt(file, "ForSalePrice", amount);
  1268. INI_Close(file);
  1269. ShowInfoBox(playerid, I_H_SET_FOR_SALE, hInfo[h][HouseName], amount);
  1270. UpdateHouseText(h);
  1271. }
  1272. return 1;
  1273. }
  1274. //------------------------------------------------------------------------------
  1275. // Cancelling House Sale
  1276. //------------------------------------------------------------------------------
  1277. if(dialogid == HOUSEMENU+21 && response)
  1278. {
  1279. if(hInfo[h][ForSale] != 1) return ShowInfoBoxEx(playerid, COLOUR_SYSTEM, E_H_NOT_FOR_SALE);
  1280. else
  1281. {
  1282. hInfo[h][ForSalePrice] = 0;
  1283. hInfo[h][ForSale] = 0;
  1284. file = INI_Open(filename);
  1285. INI_WriteInt(file, "ForSale", 0);
  1286. INI_WriteInt(file, "ForSalePrice", 0);
  1287. INI_Close(file);
  1288. ShowInfoBoxEx(playerid, COLOUR_INFO, HMENU_CANCEL_HOUSE_SALE);
  1289. UpdateHouseText(h);
  1290. }
  1291. return 1;
  1292. }
  1293. //------------------------------------------------------------------------------
  1294. // Selecting some stuff
  1295. //------------------------------------------------------------------------------
  1296. if(dialogid == HOUSEMENU+22 && response)
  1297. {
  1298. if(GetPlayerMoney(playerid) < hInfo[h][ForSalePrice]) return ShowInfoBoxEx(playerid, COLOUR_SYSTEM, E_NOT_ENOUGH_PMONEY);
  1299. else
  1300. {
  1301. new houseowner = GetHouseOwnerEx(h);
  1302. switch(IsPlayerConnected(houseowner))
  1303. {
  1304. case 0:
  1305. {
  1306. new filename2[50];
  1307. format(filename2, sizeof(filename2), USERPATH, hInfo[h][HouseOwner]);
  1308. if(!fexist(filename2))
  1309. {
  1310. fcreate(filename2);
  1311. }
  1312. file = INI_Open(filename2);
  1313. INI_WriteInt(file, "MoneyToGive", hInfo[h][ForSalePrice]);
  1314. INI_WriteInt(file, "MoneyToGiveHS", hInfo[h][HouseStorage]);
  1315. INI_WriteString(file, "HouseName", hInfo[h][HouseName]);
  1316. INI_WriteString(file, "HouseBuyer", pNick(playerid));
  1317. INI_Close(file);
  1318. }
  1319. case 1:
  1320. {
  1321. CMDSString = "";
  1322. format(_tmpstring, sizeof(_tmpstring), HSELLER_CONNECTED_MSG1, hInfo[h][HouseName], pNick(playerid), playerid);
  1323. strcat(CMDSString, _tmpstring);
  1324. format(_tmpstring, sizeof(_tmpstring), HSELLER_CONNECTED_MSG2, (hInfo[h][HouseStorage] + hInfo[h][ForSalePrice]), hInfo[h][HouseStorage], hInfo[h][ForSalePrice]);
  1325. strcat(CMDSString, _tmpstring);
  1326. ShowInfoBoxEx(houseowner, COLOUR_INFO, CMDSString);
  1327. GivePlayerMoney(houseowner, (hInfo[h][ForSalePrice] + hInfo[h][HouseStorage]));
  1328. }
  1329. }
  1330. GivePlayerMoney(playerid, -hInfo[h][ForSalePrice]);
  1331. format(hInfo[h][HouseName], MAX_HOUSE_NAME, "%s's House", pNick(playerid));
  1332. format(hInfo[h][HouseOwner], MAX_PLAYER_NAME, "%s", pNick(playerid));
  1333. hInfo[h][HousePassword] = udb_hash("INVALID_HOUSE_PASSWORD");
  1334. hInfo[h][ForSale] = 0;
  1335. hInfo[h][ForSalePrice] = 0;
  1336. hInfo[h][HouseStorage] = 0;
  1337. file = INI_Open(filename);
  1338. INI_WriteString(file, "HouseOwner", pNick(playerid));
  1339. INI_WriteInt(file, "HousePassword", hInfo[h][HousePassword]);
  1340. INI_WriteString(file, "HouseName", hInfo[h][HouseName]);
  1341. INI_WriteInt(file, "HouseStorage", 0);
  1342. INI_WriteInt(file, "ForSale", 0);
  1343. INI_WriteInt(file, "ForSalePrice", 0);
  1344. INI_Close(file);
  1345. UpdateHouseText(h);
  1346. #if GH_USE_MAPICONS == true
  1347. DestroyDynamicMapIcon(HouseMIcon[h]);
  1348. HouseMIcon[h] = CreateDynamicMapIcon(hInfo[h][CPOutX], hInfo[h][CPOutY], hInfo[h][CPOutZ], 31, -1, hInfo[h][SpawnWorld], hInfo[h][SpawnInterior], -1, MICON_VD);
  1349. #endif
  1350. UpdateHouseText(h);
  1351. }
  1352. return 1;
  1353. }
  1354. //------------------------------------------------------------------------------
  1355. // Selecting some stuff
  1356. //------------------------------------------------------------------------------
  1357. if(dialogid == HOUSEMENU+23 && response)
  1358. {
  1359. switch(listitem)
  1360. {
  1361. case 0:
  1362. {
  1363. format(string,sizeof(string), HSELL_BUY_DIALOG, hInfo[h][HouseOwner], hInfo[h][HouseName], hInfo[h][ForSalePrice]);
  1364. ShowPlayerDialog(playerid, HOUSEMENU+22, DIALOG_STYLE_MSGBOX, INFORMATION_HEADER, string, "Buy", "Cancel");
  1365. }
  1366. case 1:
  1367. {
  1368. #if GH_ALLOW_BREAKIN == false
  1369. ShowInfoBoxEx(playerid, COLOUR_INFO, E_NO_HOUSE_BREAKIN);
  1370. #else
  1371. new breakintime = GetPVarInt(playerid, "TimeSinceHouseBreakin"), houseowner = GetHouseOwnerEx(h), bi_chance = random(10000);
  1372. if(GetSecondsBetweenAction(breakintime) < (TIME_BETWEEN_BREAKINS * 60000) && breakintime != 0) return ShowInfoBoxEx(playerid, COLOUR_SYSTEM, E_WAIT_BEFORE_BREAKIN);
  1373. SetPVarInt(playerid, "TimeSinceHouseBreakin", GetTickCount());
  1374. if((hInfo[h][UpgradedLock] == 0 && bi_chance < 7000) || (hInfo[h][UpgradedLock] == 1 && bi_chance < 9000))
  1375. {
  1376. if(IsPlayerConnected(houseowner))
  1377. {
  1378. switch(hInfo[h][HouseCamera])
  1379. {
  1380. case 0:
  1381. {
  1382. if(hInfo[h][HouseAlarm] == 1)
  1383. {
  1384. ShowInfoBox(houseowner, E_FAILED_BREAKIN1_2, hInfo[h][HouseName], hInfo[h][HouseLocation]);
  1385. }
  1386. }
  1387. case 1: ShowInfoBox(houseowner, E_FAILED_BREAKIN1_1, pNick(playerid), playerid, hInfo[h][HouseName], hInfo[h][HouseLocation]);
  1388. }
  1389. }
  1390. ShowInfoBox(playerid, E_FAILED_BREAKIN2, hInfo[h][HouseName], hInfo[h][HouseOwner]);
  1391. SecurityDog_Bite(playerid, h, 0, 1);
  1392. }
  1393. if((hInfo[h][UpgradedLock] == 0 && bi_chance >= 7000) || (hInfo[h][UpgradedLock] == 1 && bi_chance >= 9000))
  1394. {
  1395. if(IsPlayerConnected(houseowner))
  1396. {
  1397. switch(hInfo[h][HouseCamera])
  1398. {
  1399. case 0:
  1400. {
  1401. if(hInfo[h][HouseAlarm] == 1)
  1402. {
  1403. ShowInfoBox(houseowner, I_SUCCESSFULL_BREAKIN1_2, hInfo[h][HouseName], hInfo[h][HouseLocation]);
  1404. }
  1405. }
  1406. case 1: ShowInfoBox(houseowner, I_SUCCESSFULL_BREAKIN1_1, pNick(playerid), playerid, hInfo[h][HouseName], hInfo[h][HouseLocation]);
  1407. }
  1408. }
  1409. ShowInfoBox(playerid, I_SUCCESSFULL_BREAKIN2, hInfo[h][HouseName], hInfo[h][HouseOwner]);
  1410. SetPlayerHouseInterior(playerid, h);
  1411. }
  1412. #if GH_GIVE_WANTEDLEVEL == true
  1413. if((GetPlayerWantedLevel(playerid) + HBREAKIN_WL) > GH_MAX_WANTED_LEVEL)
  1414. {
  1415. SetPlayerWantedLevel(playerid, GH_MAX_WANTED_LEVEL);
  1416. }
  1417. else SetPlayerWantedLevel(playerid, (GetPlayerWantedLevel(playerid) + HBREAKIN_WL));
  1418. #endif
  1419. #endif
  1420. }
  1421. case 2:
  1422. {
  1423. if(hInfo[h][HousePassword] != udb_hash("INVALID_HOUSE_PASSWORD"))
  1424. {
  1425. format(string, sizeof(string), HMENU_ENTER_PASS, hInfo[h][HouseName], hInfo[h][HouseOwner], hInfo[h][HouseValue], h);
  1426. ShowPlayerDialog(playerid, HOUSEMENU+60, DIALOG_STYLE_INPUT, INFORMATION_HEADER, string, "Enter", "Close");
  1427. }
  1428. else SetPlayerHouseInterior(playerid, h);
  1429. }
  1430. }
  1431. return 1;
  1432. }
  1433. //------------------------------------------------------------------------------
  1434. // Selecting some stuff
  1435. //------------------------------------------------------------------------------
  1436. if(dialogid == HOUSEMENU+28 && response)
  1437. {
  1438. switch(listitem)
  1439. {
  1440. case 0:
  1441. {
  1442. if(hInfo[h][HousePassword] != udb_hash("INVALID_HOUSE_PASSWORD"))
  1443. {
  1444. format(string,sizeof(string), HMENU_ENTER_PASS, hInfo[h][HouseName], hInfo[h][HouseOwner], hInfo[h][HouseValue], h);
  1445. ShowPlayerDialog(playerid, HOUSEMENU+60, DIALOG_STYLE_INPUT, INFORMATION_HEADER, string, "Enter", "Close");
  1446. }
  1447. }
  1448. case 1:
  1449. {
  1450. #if GH_ALLOW_BREAKIN == false
  1451. ShowInfoBoxEx(playerid, COLOUR_INFO, E_NO_HOUSE_BREAKIN);
  1452. #else
  1453. new breakintime = GetPVarInt(playerid, "TimeSinceHouseBreakin"), houseowner = GetHouseOwnerEx(h), bi_chance = random(10000);
  1454. if(GetSecondsBetweenAction(breakintime) < (TIME_BETWEEN_BREAKINS * 60000) && breakintime != 0) return ShowInfoBoxEx(playerid, COLOUR_SYSTEM, E_WAIT_BEFORE_BREAKIN);
  1455. SetPVarInt(playerid, "TimeSinceHouseBreakin", GetTickCount());
  1456. if((hInfo[h][UpgradedLock] == 0 && bi_chance < 7000) || (hInfo[h][UpgradedLock] == 1 && bi_chance < 9000))
  1457. {
  1458. if(IsPlayerConnected(houseowner))
  1459. {
  1460. switch(hInfo[h][HouseCamera])
  1461. {
  1462. case 0:
  1463. {
  1464. if(hInfo[h][HouseAlarm] == 1)
  1465. {
  1466. ShowInfoBox(houseowner, E_FAILED_BREAKIN1_2, hInfo[h][HouseName], hInfo[h][HouseLocation]);
  1467. }
  1468. }
  1469. case 1: ShowInfoBox(houseowner, E_FAILED_BREAKIN1_1, pNick(playerid), playerid, hInfo[h][HouseName], hInfo[h][HouseLocation]);
  1470. }
  1471. }
  1472. ShowInfoBox(playerid, E_FAILED_BREAKIN2, hInfo[h][HouseName], hInfo[h][HouseOwner]);
  1473. SecurityDog_Bite(playerid, h, 0, 1);
  1474. }
  1475. if((hInfo[h][UpgradedLock] == 0 && bi_chance >= 7000) || (hInfo[h][UpgradedLock] == 1 && bi_chance >= 9000))
  1476. {
  1477. if(IsPlayerConnected(houseowner))
  1478. {
  1479. switch(hInfo[h][HouseCamera])
  1480. {
  1481. case 0:
  1482. {
  1483. if(hInfo[h][HouseAlarm] == 1)
  1484. {
  1485. ShowInfoBox(houseowner, I_SUCCESSFULL_BREAKIN1_2, hInfo[h][HouseName], hInfo[h][HouseLocation]);
  1486. }
  1487. }
  1488. case 1: ShowInfoBox(houseowner, I_SUCCESSFULL_BREAKIN1_1, pNick(playerid), playerid, hInfo[h][HouseName], hInfo[h][HouseLocation]);
  1489. }
  1490. }
  1491. ShowInfoBox(playerid, I_SUCCESSFULL_BREAKIN2, hInfo[h][HouseName], hInfo[h][HouseOwner]);
  1492. SetPlayerHouseInterior(playerid, h);
  1493. }
  1494. #if GH_GIVE_WANTEDLEVEL == true
  1495. if((GetPlayerWantedLevel(playerid) + HBREAKIN_WL) > GH_MAX_WANTED_LEVEL)
  1496. {
  1497. SetPlayerWantedLevel(playerid, GH_MAX_WANTED_LEVEL);
  1498. }
  1499. else SetPlayerWantedLevel(playerid, (GetPlayerWantedLevel(playerid) + HBREAKIN_WL));
  1500. #endif
  1501. #endif
  1502. }
  1503. case 2: SetPlayerHouseInterior(playerid, h);
  1504. }
  1505. return 1;
  1506. }
  1507. //------------------------------------------------------------------------------
  1508. // House Privacy
  1509. //------------------------------------------------------------------------------
  1510. if(dialogid == HOUSEMENU+24 && response)
  1511. {
  1512. switch(listitem)
  1513. {
  1514. case 0: // Open
  1515. {
  1516. hInfo[h][HousePrivacy] = 1;
  1517. file = INI_Open(filename);
  1518. INI_WriteInt(file, "HousePrivacy", 1);
  1519. INI_Close(file);
  1520. ShowInfoBoxEx(playerid, COLOUR_INFO, I_HOPEN_FOR_VISITORS);
  1521. }
  1522. case 1: // Closed
  1523. {
  1524. new count;
  1525. hInfo[h][HousePrivacy] = 0;
  1526. file = INI_Open(filename);
  1527. INI_WriteInt(file, "HousePrivacy", 0);
  1528. INI_Close(file);
  1529. foreach(Player, i)
  1530. {
  1531. if(i == playerid) continue;
  1532. if(GetPVarInt(i, "LastHouseCP") == h && IsInHouse{i} == 1)
  1533. {
  1534. ExitHouse(i, GetPVarInt(i, "LastHouseCP"));
  1535. ShowInfoBox(playerid, I_CLOSED_FOR_VISITORS2 , pNick(playerid), playerid);
  1536. count++;
  1537. }
  1538. }
  1539. ShowInfoBox(playerid, I_CLOSED_FOR_VISITORS1, count);
  1540. }
  1541. }
  1542. UpdateHouseText(h);
  1543. return 1;
  1544. }
  1545. //------------------------------------------------------------------------------
  1546. // Player Selecting - Part 1
  1547. //------------------------------------------------------------------------------
  1548. if(dialogid == HOUSEMENU+25 && response)
  1549. {
  1550. new tmpcount;
  1551. foreach(Player, i)
  1552. {
  1553. if(!IsPlayerInHouse(i, h)) continue;
  1554. if(playerid == i) continue;
  1555. if(listitem == tmpcount)
  1556. {
  1557. SetPVarInt(playerid, "ClickedPlayer", i);
  1558. break;
  1559. }
  1560. tmpcount++;
  1561. }
  1562. ShowPlayerDialog(playerid, HOUSEMENU+26, DIALOG_STYLE_LIST, INFORMATION_HEADER, "Kick Out From House\nGive House Key\nTake House Key", "Select", "Cancel");
  1563. return 1;
  1564. }
  1565. //------------------------------------------------------------------------------
  1566. // Player Selecting - Part 2
  1567. //------------------------------------------------------------------------------
  1568. if(dialogid == HOUSEMENU+26 && response)
  1569. {
  1570. new clickedplayer = GetPVarInt(playerid, "ClickedPlayer"), _temp_[17];
  1571. switch(listitem)
  1572. {
  1573. case 0:
  1574. {
  1575. if(!IsPlayerInHouse(clickedplayer, h)) return ShowInfoBoxEx(playerid, COLOUR_SYSTEM, E_KICKED_NOT_IN_HOUSE);
  1576. ExitHouse(clickedplayer, h);
  1577. ShowInfoBox(playerid, I_KICKED_FROM_HOUSE1, pNick(clickedplayer), clickedplayer);
  1578. ShowInfoBox(clickedplayer, I_KICKED_FROM_HOUSE2, pNick(playerid), playerid);
  1579. }
  1580. case 1:
  1581. {
  1582. format(_temp_, sizeof(_temp_), "HouseKeys_%d", h);
  1583. if(GetPVarInt(clickedplayer, _temp_) == 1) return ShowInfoBoxEx(playerid, COLOUR_SYSTEM, E_ALREADY_HAVE_HOUSEKEYS);
  1584. SetPVarInt(clickedplayer, _temp_, 1);
  1585. ShowInfoBox(playerid, I_HOUSEKEYS_RECIEVED_1, pNick(clickedplayer), clickedplayer);
  1586. ShowInfoBox(clickedplayer, I_HOUSEKEYS_RECIEVED_2, hInfo[h][HouseName], hInfo[h][HouseLocation], pNick(playerid), playerid);
  1587. }
  1588. case 2:
  1589. {
  1590. format(_temp_, sizeof(_temp_), "HouseKeys_%d", h);
  1591. if(GetPVarInt(clickedplayer, _temp_) == 0) return ShowInfoBoxEx(playerid, COLOUR_SYSTEM, E_DOESNT_HAVE_HOUSEKEYS);
  1592. DeletePVar(clickedplayer, _temp_);
  1593. ShowInfoBox(playerid, I_HOUSEKEYS_TAKEN_1, pNick(clickedplayer), clickedplayer);
  1594. ShowInfoBox(clickedplayer, I_HOUSEKEYS_TAKEN_2, pNick(playerid), playerid, hInfo[h][HouseName], hInfo[h][HouseLocation]);
  1595. }
  1596. }
  1597. return 1;
  1598. }
  1599. //------------------------------------------------------------------------------
  1600. // House Security
  1601. //------------------------------------------------------------------------------
  1602. if(dialogid == HOUSEMENU+27 && response)
  1603. {
  1604. file = INI_Open(filename);
  1605. switch(listitem)
  1606. {
  1607. case 0: // House Alarm
  1608. {
  1609. if(hInfo[h][HouseAlarm] == 1) return ShowInfoBoxEx(playerid, COLOUR_SYSTEM, E_ALREADY_HAVE_ALARM);
  1610. if(GetPlayerMoney(playerid) < HUPGRADE_ALARM) return ShowInfoBoxEx(playerid, COLOUR_SYSTEM, E_NOT_ENOUGH_MONEY_ALARM);
  1611. GivePlayerMoney(playerid, -HUPGRADE_ALARM);
  1612. hInfo[h][HouseAlarm] = 1;
  1613. INI_WriteInt(file, "HouseAlarm", 1);
  1614. ShowInfoBoxEx(playerid, COLOUR_INFO, I_HUPGRADE_ALARM);
  1615. }
  1616. case 1: // Security Camera
  1617. {
  1618. if(hInfo[h][HouseCamera] == 1) return ShowInfoBoxEx(playerid, COLOUR_SYSTEM, E_ALREADY_HAVE_CAMERA);
  1619. if(GetPlayerMoney(playerid) < HUPGRADE_CAMERA) return ShowInfoBoxEx(playerid, COLOUR_SYSTEM, E_NOT_ENOUGH_MONEY_CAMERA);
  1620. GivePlayerMoney(playerid, -HUPGRADE_CAMERA);
  1621. hInfo[h][HouseCamera] = 1;
  1622. INI_WriteInt(file, "HouseCamera", 1);
  1623. ShowInfoBoxEx(playerid, COLOUR_INFO, I_HUPGRADE_CAMERA);
  1624. }
  1625. case 2: // House Security Dog
  1626. {
  1627. if(hInfo[h][HouseDog] == 1) return ShowInfoBoxEx(playerid, COLOUR_SYSTEM, E_ALREADY_HAVE_DOG);
  1628. if(GetPlayerMoney(playerid) < HUPGRADE_DOG) return ShowInfoBoxEx(playerid, COLOUR_SYSTEM, E_NOT_ENOUGH_MONEY_DOG);
  1629. GivePlayerMoney(playerid, -HUPGRADE_DOG);
  1630. hInfo[h][HouseDog] = 1;
  1631. INI_WriteInt(file, "HouseDog", 1);
  1632. ShowInfoBoxEx(playerid, COLOUR_INFO, I_HUPGRADE_DOG);
  1633. }
  1634. case 3: // Better Houselock
  1635. {
  1636. if(hInfo[h][UpgradedLock] == 1) return ShowInfoBoxEx(playerid, COLOUR_SYSTEM, E_ALREADY_HAVE_UPGRADED_HLOCK);
  1637. if(GetPlayerMoney(playerid) < HUPGRADE_UPGRADED_HLOCK) return ShowInfoBoxEx(playerid, COLOUR_SYSTEM, E_NOT_ENOUGH_MONEY_UPGRADED_HLOCK);
  1638. GivePlayerMoney(playerid, -HUPGRADE_UPGRADED_HLOCK);
  1639. hInfo[h][UpgradedLock] = 1;
  1640. INI_WriteInt(file, "HouseUpgradedLock", 1);
  1641. ShowInfoBoxEx(playerid, COLOUR_INFO, I_HUPGRADE_UPGRADED_HLOCK);
  1642. }
  1643. }
  1644. INI_Close(file);
  1645. return 1;
  1646. }
  1647. //------------------------------------------------------------------------------
  1648. // Weapon Storage
  1649. //------------------------------------------------------------------------------
  1650. if(dialogid == HOUSEMENU+30 && response)
  1651. {
  1652. new tmp[9], tmp2[13], tmpcount;
  1653. switch(listitem)
  1654. {
  1655. case 0: // Store weapons
  1656. {
  1657. file = INI_Open(filename);
  1658. Loop(weap, 14, 1)
  1659. {
  1660. format(tmp, sizeof(tmp), "Weapon%d", weap);
  1661. format(tmp2, sizeof(tmp2), "Weapon%dAmmo", weap);
  1662. #if GH_SAVE_ADMINWEPS == false
  1663. if(weap == 7 || weap == 8 || weap == 9 || weap == 12) continue;
  1664. #endif
  1665. GetPlayerWeaponData(playerid, weap, hInfo[h][Weapon][weap], hInfo[h][Ammo][weap]);
  1666. if(hInfo[h][Ammo][weap] < 1 || (weap == 11 && hInfo[h][Weapon][weap] != 46)) continue;
  1667. INI_WriteInt(file, tmp, hInfo[h][Weapon][weap]);
  1668. INI_WriteInt(file, tmp2, hInfo[h][Ammo][weap]);
  1669. GivePlayerWeapon(playerid, hInfo[h][Weapon][weap], -hInfo[h][Ammo][weap]);
  1670. tmpcount++;
  1671. }
  1672. INI_Close(file);
  1673. switch(tmpcount)
  1674. {
  1675. case 0: ShowInfoBox(playerid, E_NO_WEAPONS, tmpcount);
  1676. default: ShowInfoBox(playerid, I_HS_WEAPONS1, tmpcount, AddS(tmpcount));
  1677. }
  1678. }
  1679. case 1: // Receive Weapons
  1680. {
  1681. file = INI_Open(filename);
  1682. Loop(weap, 14, 1)
  1683. {
  1684. format(tmp, sizeof(tmp), "Weapon%d", weap);
  1685. format(tmp2, sizeof(tmp2), "Weapon%dAmmo", weap);
  1686. if(hInfo[h][Ammo][weap] < 1) continue;
  1687. #if GH_SAVE_ADMINWEPS == false
  1688. if(weap == 7 || weap == 8 || weap == 9 || weap == 11 || weap == 12) continue;
  1689. #endif
  1690. GivePlayerWeapon(playerid, hInfo[h][Weapon][weap], hInfo[h][Ammo][weap]);
  1691. INI_WriteInt(file, tmp, 0);
  1692. INI_WriteInt(file, tmp2, 0);
  1693. tmpcount++;
  1694. }
  1695. INI_Close(file);
  1696. switch(tmpcount)
  1697. {
  1698. case 0: ShowInfoBoxEx(playerid, COLOUR_INFO, E_NO_HS_WEAPONS);
  1699. default: ShowInfoBox(playerid, I_HS_WEAPONS2, tmpcount, AddS(tmpcount));
  1700. }
  1701. }
  1702. }
  1703. }
  1704. //------------------------------------------------------------------------------
  1705. // /myhouse House Selecting - Part 1
  1706. //------------------------------------------------------------------------------
  1707. if(dialogid == (HOUSEMENU+50) && response)
  1708. {
  1709. SetPVarInt(playerid, "ClickedHouse", ReturnPlayerHouseID(playerid, (listitem + 1)));
  1710. #if GH_ALLOW_HOUSETELEPORT == true
  1711. ShowPlayerDialog(playerid, HOUSEMENU+51, DIALOG_STYLE_LIST, INFORMATION_HEADER, "Show Information\nTeleport To This House", "Select", "Cancel");
  1712. #else
  1713. ShowPlayerDialog(playerid, HOUSEMENU+51, DIALOG_STYLE_LIST, INFORMATION_HEADER, "Show Information", "Select", "Cancel");
  1714. #endif
  1715. return 1;
  1716. }
  1717. //------------------------------------------------------------------------------
  1718. // /myhouse House Selecting - Part 2
  1719. //------------------------------------------------------------------------------
  1720. if(dialogid == (HOUSEMENU+51) && response)
  1721. {
  1722. new _h = GetPVarInt(playerid, "ClickedHouse");
  1723. switch(listitem)
  1724. {
  1725. case 0:
  1726. {
  1727. GetPlayerPos(playerid, X, Y, Z);
  1728. CMDSString = "";
  1729. format(_tmpstring, sizeof(_tmpstring), I_HOWNER_HINFO_1, hInfo[_h][HouseName], hInfo[_h][HouseLocation], DistanceToPoint(X, Y, Z, hInfo[h][CPOutX], hInfo[h][CPOutY], hInfo[h][CPOutZ]));
  1730. strcat(CMDSString, _tmpstring);
  1731. format(_tmpstring, sizeof(_tmpstring), I_HOWNER_HINFO_2, hInfo[_h][HouseValue], hInfo[_h][HouseStorage], Answer(hInfo[_h][HousePrivacy], "Open For Public", "Closed For Public"), _h);
  1732. strcat(CMDSString, _tmpstring);
  1733. ShowInfoBoxEx(playerid, COLOUR_INFO, CMDSString);
  1734. }
  1735. case 1: SetPlayerHouseInterior(playerid, _h);
  1736. }
  1737. return 1;
  1738. }
  1739. //------------------------------------------------------------------------------
  1740. // Enter House Using Password
  1741. //------------------------------------------------------------------------------
  1742. if(dialogid == HOUSEMENU+60)
  1743. {
  1744. if(response)
  1745. {
  1746. new _tmp_ = GetHouseOwnerEx(h);
  1747. if(strfind(inputtext, "%", CASE_SENSETIVE) != -1 || strfind(inputtext, "~", CASE_SENSETIVE) != -1) return ShowInfoBoxEx(playerid, COLOUR_SYSTEM, E_INVALID_HPASS_CHARS2);
  1748. if(strlen(inputtext) < MIN_HOUSE_PASSWORD || strlen(inputtext) > MAX_HOUSE_PASSWORD) return ShowInfoBoxEx(playerid, COLOUR_SYSTEM, E_INVALID_HPASS_LENGTH);
  1749. if(udb_hash(inputtext) != hInfo[h][HousePassword])
  1750. {
  1751. ShowInfoBox(playerid, I_WRONG_HPASS1, hInfo[h][HouseOwner], inputtext);
  1752. if(IsPlayerConnected(_tmp_))
  1753. {
  1754. ShowInfoBox(_tmp_, INFORMATION_HEADER, I_WRONG_HPASS2, pNick(playerid), playerid, inputtext);
  1755. }
  1756. }
  1757. else
  1758. {
  1759. ShowInfoBox(playerid, I_CORRECT_HPASS1, hInfo[h][HouseOwner], inputtext);
  1760. SetPlayerHouseInterior(playerid, h);
  1761. if(IsPlayerConnected(_tmp_))
  1762. {
  1763. ShowInfoBox(_tmp_, INFORMATION_HEADER, I_CORRECT_HPASS2, pNick(playerid), playerid, inputtext);
  1764. }
  1765. }
  1766. }
  1767. return 1;
  1768. }
  1769. return 0; // It is important to have return 0; here at the end of ALL your scripts which uses dialogs.
  1770. }
  1771. //==============================================================================
  1772. // GetPosInFrontOfPlayer(playerid, &Float:x, &Float:y, Float:distance);
  1773. // Used to get the position infront of a player.
  1774. // Credits to whoever made this!
  1775. //==============================================================================
  1776. stock Float:GetPosInFrontOfPlayer(playerid, &Float:x, &Float:y, Float:distance)
  1777. {
  1778. new Float:a;
  1779. GetPlayerPos(playerid, x, y, a);
  1780. switch(IsPlayerInAnyVehicle(playerid))
  1781. {
  1782. case 0: GetPlayerFacingAngle(playerid, a);
  1783. case 1: GetVehicleZAngle(GetPlayerVehicleID(playerid), a);
  1784. }
  1785. x += (distance * floatsin(-a, degrees));
  1786. y += (distance * floatcos(-a, degrees));
  1787. return a;
  1788. }
  1789. //##############################################################################
  1790. // Commands
  1791. //##############################################################################
  1792. // By [03]Garsino!
  1793. //==============================================================================
  1794. // This command is used to display the house owner menu
  1795. // when a player is in a house and is the house owner.
  1796. //==============================================================================
  1797. CMD:housemenu(playerid, params[])
  1798. {
  1799. #pragma unused params
  1800. new h = GetPVarInt(playerid, "LastHouseCP");
  1801. if(strcmp(hInfo[h][HouseOwner], pNick(playerid), CASE_SENSETIVE) && IsInHouse{playerid} == 1) return ShowInfoBoxEx(playerid, COLOUR_SYSTEM, E_C_ACCESS_SE_HM);
  1802. if(IsInHouse{playerid} == 0) return ShowInfoBoxEx(playerid, COLOUR_SYSTEM, E_NOT_IN_HOUSE);
  1803. if(GetOwnedHouses(playerid) == 0) return ShowInfoBoxEx(playerid, COLOUR_SYSTEM, E_NOT_HOWNER);
  1804. if(IsInHouse{playerid} == 1 && !strcmp(hInfo[h][HouseOwner], pNick(playerid), CASE_SENSETIVE) && GetOwnedHouses(playerid) >= 1)
  1805. {
  1806. #if GH_HINTERIOR_UPGRADE == true
  1807. ShowPlayerDialog(playerid, HOUSEMENU, DIALOG_STYLE_LIST, INFORMATION_HEADER, "House Selling\nHouse Storage\nSet House Name\nSet House Password\nBuy/Preview House Interior\nToggle House Privacy\nManage Players In House\nHouse Security", "Select", "Cancel");
  1808. #else
  1809. ShowPlayerDialog(playerid, HOUSEMENU, DIALOG_STYLE_LIST, INFORMATION_HEADER, "House Selling\nHouse Storage\nSet House Name\nSet House Password\nToggle House Privacy\nManage Players In House\nHouse Security", "Select", "Cancel");
  1810. #endif
  1811. }
  1812. return 1;
  1813. }
  1814. //==============================================================================
  1815. // This command is used to trigger a house robbery
  1816. //==============================================================================
  1817. #if GH_ALLOW_HOUSEROBBERY == true
  1818. CMD:robhouse(playerid, params[])
  1819. {
  1820. #pragma unused params
  1821. new h = GetPVarInt(playerid, "LastHouseCP"), houseowner = GetHouseOwnerEx(GetPVarInt(playerid, "LastHouseCP")), robtime = GetPVarInt(playerid, "TimeSinceHouseBreakin");
  1822. if(IsInHouse{playerid} == 0) return ShowInfoBoxEx(playerid, COLOUR_SYSTEM, E_NOT_IN_HOUSE);
  1823. if(!strcmp(hInfo[h][HouseOwner], pNick(playerid), CASE_SENSETIVE)) return ShowInfoBoxEx(playerid, COLOUR_SYSTEM, E_CANT_ROB_OWN_HOUSE);
  1824. if(!IsPlayerConnected(houseowner)) return ShowInfoBoxEx(playerid, COLOUR_SYSTEM, E_HROB_OWNER_NOT_CONNECTED);
  1825. if(GetPVarInt(playerid, "IsRobbingHouse") == 1) return ShowInfoBoxEx(playerid, COLOUR_SYSTEM, E_ALREADY_ROBBING_HOUSE);
  1826. if(GetSecondsBetweenAction(robtime) < (TIME_BETWEEN_ROBBERIES * 60000) && robtime != 0) return ShowInfoBoxEx(playerid, COLOUR_SYSTEM, E_WAIT_BEFORE_ROBBING);
  1827. switch(random(10000))
  1828. {
  1829. case 0..6999: // Failed robbery
  1830. {
  1831. switch(hInfo[h][HouseCamera])
  1832. {
  1833. case 0:
  1834. {
  1835. if(hInfo[h][HouseAlarm] == 1)
  1836. {
  1837. ShowInfoBox(houseowner, E_FAILED_HROB1_2, hInfo[h][HouseName], hInfo[h][HouseLocation]);
  1838. }
  1839. }
  1840. case 1: ShowInfoBox(houseowner, E_FAILED_HROB1_1, pNick(playerid), playerid, hInfo[h][HouseName], hInfo[h][HouseLocation]);
  1841. }
  1842. SecurityDog_Bite(playerid, h, 1, 1);
  1843. ShowInfoBox(playerid, E_FAILED_HROB2, hInfo[h][HouseName], hInfo[h][HouseOwner]);
  1844. }
  1845. case 7000..9999: // Successfull robbery
  1846. {
  1847. switch(hInfo[h][HouseCamera])
  1848. {
  1849. case 0:
  1850. {
  1851. if(hInfo[h][HouseAlarm] == 1)
  1852. {
  1853. ShowInfoBox(houseowner, I_HROB_STARTED1_1, hInfo[h][HouseName], hInfo[h][HouseLocation]);
  1854. }
  1855. }
  1856. case 1: ShowInfoBox(houseowner, I_HROB_STARTED1_2, pNick(playerid), playerid, hInfo[h][HouseName], hInfo[h][HouseLocation]);
  1857. }
  1858. ShowInfoBox(playerid, I_HROB_STARTED2, hInfo[h][HouseOwner], hInfo[h][HouseName], hInfo[h][HouseLocation]);
  1859. SetPVarInt(playerid, "IsRobbingHouse", 1), SetPVarInt(playerid, "HouseRobberyTime", RandomEx(MIN_ROB_TIME, MAX_ROB_TIME));
  1860. SetPVarInt(playerid, "HouseRobberyTimer", SetTimerEx("HouseRobbery", 999, true, "ii", playerid, h));
  1861. }
  1862. }
  1863. #if GH_GIVE_WANTEDLEVEL == true
  1864. if((GetPlayerWantedLevel(playerid) + HROBBERY_WL) > GH_MAX_WANTED_LEVEL)
  1865. {
  1866. SetPlayerWantedLevel(playerid, GH_MAX_WANTED_LEVEL);
  1867. }
  1868. else SetPlayerWantedLevel(playerid, (GetPlayerWantedLevel(playerid) + HROBBERY_WL));
  1869. #endif
  1870. SetPVarInt(playerid, "TimeSinceHouseRobbery", GetTickCount());
  1871. return 1;
  1872. }
  1873. #endif
  1874. #if GH_ALLOW_HOUSEROBBERY == true
  1875. function HouseRobbery(playerid, houseid)
  1876. {
  1877. new robberytime = GetPVarInt(playerid, "HouseRobberyTime");
  1878. if(GetPVarInt(playerid, "IsRobbingHouse") == 1)
  1879. {
  1880. switch(robberytime)
  1881. {
  1882. case 1..MAX_ROB_TIME: GameTextEx(playerid, 999, 3, "~n~ ~g~Robbery in Progress... ~n~ ~r~%d ~w~Seconds Remaining...", robberytime);
  1883. case 0:
  1884. {
  1885. switch(IsPlayerInHouse(playerid, houseid))
  1886. {
  1887. case 0: ShowInfoBox(playerid, I_HROB_FAILED_NOT_IN_HOUSE, hInfo[houseid][HouseName]);
  1888. case 1:
  1889. {
  1890. new RobAmount = ReturnProcent(hInfo[houseid][HouseStorage], HOUSE_ROBBERY_PERCENT), houseowner = GetHouseOwnerEx(houseid);
  1891. if(RobAmount > MAX_MONEY_ROBBED)
  1892. {
  1893. RobAmount = MAX_MONEY_ROBBED;
  1894. }
  1895. if(IsPlayerConnected(houseowner))
  1896. {
  1897. switch(hInfo[houseid][HouseCamera])
  1898. {
  1899. case 0:
  1900. {
  1901. if(hInfo[houseid][HouseAlarm] == 1)
  1902. {
  1903. ShowInfoBox(houseowner, I_HROB_COMPLETED1_2, hInfo[houseid][HouseName], hInfo[houseid][HouseLocation], RobAmount);
  1904. }
  1905. }
  1906. case 1: ShowInfoBox(houseowner, I_HROB_COMPLETED1_1, pNick(playerid), playerid, hInfo[houseid][HouseName], hInfo[houseid][HouseLocation], RobAmount);
  1907. }
  1908. }
  1909. hInfo[houseid][HouseStorage] -= RobAmount;
  1910. new INI:file = INI_Open(HouseFile(houseid));
  1911. INI_WriteInt(file, "HouseStorage", hInfo[houseid][HouseStorage]);
  1912. INI_Close(file);
  1913. GivePlayerMoney(playerid, RobAmount);
  1914. ShowInfoBox(playerid, I_HROB_COMPLETED2, RobAmount, hInfo[houseid][HouseOwner], hInfo[houseid][HouseName], hInfo[houseid][HouseLocation]);
  1915. GameTextEx(playerid, 4500, 3, "~n~ ~p~Robbery Completed~w~! ~n~ Robbed ~g~$%d~w~!", RobAmount);
  1916. }
  1917. }
  1918. EndHouseRobbery(playerid);
  1919. SetPVarInt(playerid, "IsRobbingHouse", 0);
  1920. SetPVarInt(playerid, "TimeSinceHouseRobbery", GetTickCount());
  1921. DeletePVar(playerid, "HouseRobberyTimer");
  1922. }
  1923. }
  1924. }
  1925. return SetPVarInt(playerid, "HouseRobberyTime", (robberytime - 1));
  1926. }
  1927. #endif
  1928. //==============================================================================
  1929. // This command is used to display the players houses.
  1930. //==============================================================================
  1931. CMD:myhouses(playerid, params[])
  1932. {
  1933. #pragma unused params
  1934. if(GetOwnedHouses(playerid) == 0) return ShowInfoBoxEx(playerid, COLOUR_SYSTEM, E_NO_HOUSES_OWNED);
  1935. new h, _tmpstring[128], count = GetOwnedHouses(playerid);
  1936. CMDSString = "";
  1937. Loop(i, (count + 1), 1)
  1938. {
  1939. h = ReturnPlayerHouseID(playerid, i);
  1940. if(i == count)
  1941. {
  1942. format(_tmpstring, sizeof(_tmpstring), "{00BC00}%d.\t{FFFF2A}%s in %s", i, hInfo[h][HouseName], hInfo[h][HouseLocation]);
  1943. }
  1944. else format(_tmpstring, sizeof(_tmpstring), "{00BC00}%d.\t{FFFF2A}%s in %s\n", i, hInfo[h][HouseName], hInfo[h][HouseLocation]);
  1945. strcat(CMDSString, _tmpstring);
  1946. }
  1947. ShowPlayerDialog(playerid, HOUSEMENU+50, DIALOG_STYLE_LIST, INFORMATION_HEADER, CMDSString, "Select", "Cancel");
  1948. return 1;
  1949. }
  1950. //==============================================================================
  1951. // This command is used to create a house.
  1952. // The only thing you have to enter is the house value,
  1953. // the rest is done by the script.
  1954. //==============================================================================
  1955. CMD:createhouse(playerid, params[])
  1956. {
  1957. new cost, h = GetFreeHouseID(), labeltext[250], hint;
  1958. if(!IsPlayerAdmin(playerid)) return 0;
  1959. if(sscanf(params, "dD(" #DEFAULT_H_INTERIOR ")", cost, hint)) return ShowInfoBoxEx(playerid, COLOUR_SYSTEM, E_CMD_USAGE_CREATEHOUSE);
  1960. if(h < 0)
  1961. {
  1962. ShowInfoBox(playerid, E_TOO_MANY_HOUSES, MAX_HOUSES);
  1963. return 1;
  1964. }
  1965. if(hint < 0 || hint > MAX_HOUSE_INTERIORS) return ShowInfoBoxEx(playerid, COLOUR_SYSTEM, E_INVALID_HINT);
  1966. if(IsHouseInteriorValid(hint) == 0) return ShowInfoBoxEx(playerid, COLOUR_SYSTEM, E_HINT_DOESNT_EXIST);
  1967. if(cost < MIN_HOUSE_VALUE || cost > MAX_HOUSE_VALUE) return ShowInfoBoxEx(playerid, COLOUR_SYSTEM, E_INVALID_HVALUE);
  1968. else
  1969. {
  1970. fcreate(HouseFile(h));
  1971. GetPlayerPos(playerid, X, Y, Z);
  1972. GetPlayerFacingAngle(playerid, Angle);
  1973. new world = GetPlayerVirtualWorld(playerid), interior = GetPlayerInterior(playerid);
  1974. hInfo[h][CPOutX] = X, hInfo[h][CPOutY] = Y, hInfo[h][CPOutZ] = Z;
  1975. format(hInfo[h][HouseName], MAX_HOUSE_NAME, "%s", DEFAULT_HOUSE_NAME);
  1976. format(hInfo[h][HouseOwner], MAX_PLAYER_NAME, "%s", INVALID_HOWNER_NAME);
  1977. format(hInfo[h][HouseLocation], MAX_ZONE_NAME, "%s", GetHouseLocation(h));
  1978. hInfo[h][HousePassword] = udb_hash("INVALID_HOUSE_PASSWORD");
  1979. hInfo[h][HouseValue] = cost, hInfo[h][HouseStorage] = 0;
  1980. new INI:file = INI_Open(HouseFile(h));
  1981. INI_WriteFloat(file, "CPOutX", X);
  1982. INI_WriteFloat(file, "CPOutY", Y);
  1983. INI_WriteFloat(file, "CPOutZ", Z);
  1984. INI_WriteString(file, "HouseName", DEFAULT_HOUSE_NAME);
  1985. INI_WriteString(file, "HouseOwner", INVALID_HOWNER_NAME);
  1986. INI_WriteString(file, "HouseLocation", hInfo[h][HouseLocation]);
  1987. INI_WriteInt(file, "HousePassword", hInfo[h][HousePassword]);
  1988. INI_WriteString(file, "HouseCreator", pNick(playerid));
  1989. INI_WriteInt(file, "HouseValue", cost);
  1990. INI_WriteInt(file, "HouseStorage", 0);
  1991. format(labeltext, sizeof(labeltext), LABELTEXT1, DEFAULT_HOUSE_NAME, cost, h);
  1992. #if GH_USE_CPS == true
  1993. HouseCPOut[h] = CreateDynamicCP(X, Y, Z, 1.5, world, interior, -1, CP_DRAWDISTANCE);
  1994. HouseCPInt[h] = CreateDynamicCP(hIntInfo[hint][IntCPX], hIntInfo[hint][IntCPY], hIntInfo[hint][IntCPZ], 1.5, (h + 1000), hIntInfo[hint][IntInterior], -1, 15.0);
  1995. #else
  1996. HousePickupOut[h] = CreateDynamicPickup(PICKUP_MODEL_OUT, PICKUP_TYPE, X, Y, Z, world, interior, -1, 15.0);
  1997. HousePickupInt[h] = CreateDynamicPickup(PICKUP_MODEL_INT, PICKUP_TYPE, hIntInfo[hint][IntCPX], hIntInfo[hint][IntCPY], hIntInfo[hint][IntCPZ], (h + 1000), hIntInfo[hint][IntInterior], -1, 15.0);
  1998. #endif
  1999. #if GH_USE_MAPICONS == true
  2000. HouseMIcon[h] = CreateDynamicMapIcon(X, Y, Z, 31, -1, world, interior, -1, 50.0);
  2001. #endif
  2002. HouseLabel[h] = CreateDynamic3DTextLabel(labeltext, COLOUR_GREEN, X, Y, Z+0.7, TEXTLABEL_DISTANCE, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, TEXTLABEL_TESTLOS, world, interior, -1, TEXTLABEL_DISTANCE);
  2003. ShowInfoBox(playerid, I_H_CREATED, h);
  2004. GetPosInFrontOfPlayer(playerid, X, Y, -2.5);
  2005. INI_WriteFloat(file, "SpawnOutX", X);
  2006. INI_WriteFloat(file, "SpawnOutY", Y);
  2007. INI_WriteFloat(file, "SpawnOutZ", Z);
  2008. INI_WriteFloat(file, "SpawnOutAngle", (180.0 + Angle));
  2009. INI_WriteInt(file, "SpawnWorld", world);
  2010. INI_WriteInt(file, "SpawnInterior", interior);
  2011. INI_WriteInt(file, "HouseInterior", hint);
  2012. hInfo[h][SpawnOutX] = X, hInfo[h][SpawnOutY] = Y, hInfo[h][SpawnOutZ] = Z, hInfo[h][SpawnOutAngle] = (180.0 + Angle);
  2013. hInfo[h][SpawnWorld] = world, hInfo[h][SpawnInterior] = interior, hInfo[h][HouseInterior] = hint;
  2014. hInfo[h][HouseAlarm] = hInfo[h][HouseDog] = hInfo[h][HouseCamera] = hInfo[h][UpgradedLock] = 0;
  2015. INI_Close(file);
  2016. CurrentID++;
  2017. file = INI_Open("/GarHouse/House.ini");
  2018. INI_WriteInt(file, "CurrentID", CurrentID);
  2019. INI_Close(file);
  2020. SetPVarInt(playerid, "JustCreatedHouse", 1);
  2021. Iter_Add(Houses, h);
  2022. }
  2023. return 1;
  2024. }
  2025. //==============================================================================
  2026. // This command is used to add a house car for a house.
  2027. // The only thing you have to enter is the house value,
  2028. // the rest is done by the script.
  2029. //==============================================================================
  2030. CMD:addhcar(playerid, params[])
  2031. {
  2032. new h;
  2033. if(!IsPlayerAdmin(playerid)) return 0;
  2034. if(!IsPlayerInAnyVehicle(playerid)) return ShowInfoBoxEx(playerid, COLOUR_SYSTEM, E_HCAR_NOT_IN_VEH);
  2035. if(sscanf(params, "d", h)) return ShowInfoBoxEx(playerid, COLOUR_SYSTEM, E_CMD_USAGE_ADDHCAR);
  2036. if(!fexist(HouseFile(h))) return ShowInfoBoxEx(playerid, COLOUR_SYSTEM, E_INVALID_HID);
  2037. else
  2038. {
  2039. if(hInfo[h][HouseCar] == 1) { ShowInfoBox(playerid, I_HCAR_EXIST_ALREADY, h); }
  2040. if(hInfo[h][HouseCar] == 0) { ShowInfoBox(playerid, I_HCAR_CREATED, h); }
  2041. GetVehiclePos(GetPlayerVehicleID(playerid), X, Y, Z);
  2042. GetVehicleZAngle(GetPlayerVehicleID(playerid), Angle);
  2043. new world = GetPlayerVirtualWorld(playerid), interior = GetPlayerInterior(playerid);
  2044. hInfo[h][HouseCar] = 1, hInfo[h][HouseCarPosX] = X, hInfo[h][HouseCarPosY] = Y, hInfo[h][HouseCarPosZ] = Z, hInfo[h][HouseCarAngle] = Angle;
  2045. hInfo[h][HouseCarModel] = GetVehicleModel(GetPlayerVehicleID(playerid)), hInfo[h][HouseCarInterior] = interior, hInfo[h][HouseCarWorld] = world;
  2046. new INI:file = INI_Open(HouseFile(h));
  2047. INI_WriteFloat(file, "HCarPosX", X);
  2048. INI_WriteFloat(file, "HCarPosY", Y);
  2049. INI_WriteFloat(file, "HCarPosZ", Z);
  2050. INI_WriteFloat(file, "HCarAngle", Angle);
  2051. INI_WriteInt(file, "HCar", 1);
  2052. INI_WriteInt(file, "HCarWorld", world);
  2053. INI_WriteInt(file, "HCarInt", interior);
  2054. INI_WriteInt(file, "HCarModel", hInfo[h][HouseCarModel]);
  2055. INI_Close(file);
  2056. }
  2057. return 1;
  2058. }
  2059. //==============================================================================
  2060. // This command is used to delete a house.
  2061. // Note: It does not give any money to the house owner when the house is deleted
  2062. //==============================================================================
  2063. CMD:removehouse(playerid, params[])
  2064. {
  2065. new h;
  2066. if(!IsPlayerAdmin(playerid)) return 0;
  2067. if(sscanf(params, "d", h)) return ShowInfoBoxEx(playerid, COLOUR_SYSTEM, E_CMD_USAGE_REMOVEHOUSE);
  2068. if(!fexist(HouseFile(h))) return ShowInfoBoxEx(playerid, COLOUR_SYSTEM, E_INVALID_HID);
  2069. else
  2070. {
  2071. foreach(Player, i)
  2072. {
  2073. if(IsInHouse{i} == 0) continue;
  2074. ExitHouse(i, h);
  2075. }
  2076. DestroyHouseEntrance(h, TYPE_OUT);
  2077. DestroyHouseEntrance(h, TYPE_INT);
  2078. #if GH_USE_MAPICONS == true
  2079. DestroyDynamicMapIcon(HouseMIcon[h]);
  2080. #endif
  2081. DestroyDynamic3DTextLabel(HouseLabel[h]);
  2082. ShowInfoBox(playerid, I_H_DESTROYED, h);
  2083. fremove(HouseFile(h));
  2084. Iter_Remove(Houses, h);
  2085. }
  2086. return 1;
  2087. }
  2088. //==============================================================================
  2089. // This command is used to remove the house car for a house.
  2090. //==============================================================================
  2091. CMD:removehcar(playerid, params[])
  2092. {
  2093. new h;
  2094. if(!IsPlayerAdmin(playerid)) return 0;
  2095. if(sscanf(params, "d", h)) return ShowInfoBoxEx(playerid, COLOUR_SYSTEM, E_CMD_USAGE_REMOVEHCAR);
  2096. if(!fexist(HouseFile(h))) return ShowInfoBoxEx(playerid, COLOUR_SYSTEM, E_INVALID_HID);
  2097. if(hInfo[h][HouseCar] == 0) return ShowInfoBoxEx(playerid, COLOUR_SYSTEM, E_NO_HCAR);
  2098. else
  2099. {
  2100. UnloadHouseCar(h);
  2101. hInfo[h][HouseCar] = 0;
  2102. new INI:file = INI_Open(HouseFile(h));
  2103. INI_WriteInt(file, "HCar", 0);
  2104. INI_Close(file);
  2105. ShowInfoBox(playerid, I_HCAR_REMOVED, h);
  2106. }
  2107. return 1;
  2108. }
  2109. //==============================================================================
  2110. // This command is used to change the modelid of a housecar.
  2111. //==============================================================================
  2112. CMD:changehcar(playerid, params[])
  2113. {
  2114. new h, modelid;
  2115. if(!IsPlayerAdmin(playerid)) return 0;
  2116. if(sscanf(params, "dd", h, modelid)) return ShowInfoBoxEx(playerid, COLOUR_SYSTEM, E_CMD_USAGE_CHANGEHCAR);
  2117. if(!fexist(HouseFile(h))) return ShowInfoBoxEx(playerid, COLOUR_SYSTEM, E_INVALID_HID);
  2118. if(modelid < 400 || modelid > 612) return ShowInfoBoxEx(playerid, COLOUR_SYSTEM, E_INVALID_HCAR_MODEL);
  2119. else
  2120. {
  2121. hInfo[h][HouseCarModel] = modelid;
  2122. new INI:file = INI_Open(HouseFile(h));
  2123. INI_WriteInt(file, "HCarModel", modelid);
  2124. INI_Close(file);
  2125. ShowInfoBox(playerid, I_HCAR_CHANGED, h, modelid);
  2126. #if GH_HOUSECARS == true
  2127. if(GetVehicleModel(HCar[h]) != -1)
  2128. {
  2129. if(IsVehicleOccupied(HCar[h]))
  2130. {
  2131. new Float:Velocity[3], Float:Pos[4], Seat[MAX_PLAYERS char] = -1, interior, vw = GetVehicleVirtualWorld(HCar[h]);
  2132. foreach(Player, i)
  2133. {
  2134. if(IsPlayerInVehicle(i, HCar[h]))
  2135. {
  2136. Seat{i} = GetPlayerVehicleSeat(i);
  2137. if(Seat{i} == 0)
  2138. {
  2139. interior = GetPlayerInterior(i); // Have to do it this way because there is no GetVehicleInterior..
  2140. }
  2141. }
  2142. }
  2143. GetVehiclePos(HCar[h], Pos[0], Pos[1], Pos[2]);
  2144. GetVehicleZAngle(HCar[h], Pos[3]);
  2145. GetVehicleVelocity(HCar[h], Velocity[0], Velocity[1], Velocity[2]);
  2146. DestroyVehicle(HCar[h]);
  2147. HCar[h] = CreateVehicle(modelid, Pos[0], Pos[1], Pos[2], Pos[3], HCAR_COLOUR1, HCAR_COLOUR2, HCAR_RESPAWN);
  2148. LinkVehicleToInterior(HCar[h], interior);
  2149. SetVehicleVirtualWorld(HCar[h], vw);
  2150. foreach(Player, i)
  2151. {
  2152. if(Seat[i] != -1)
  2153. {
  2154. PutPlayerInVehicle(i, HCar[h], Seat{i});
  2155. Seat{i} = -1;
  2156. }
  2157. }
  2158. SetVehicleVelocity(HCar[h], Velocity[0], Velocity[1], Velocity[2]);
  2159. }
  2160. if(!IsVehicleOccupied(HCar[h]))
  2161. {
  2162. UnloadHouseCar(h);
  2163. LoadHouseCar(h);
  2164. }
  2165. }
  2166. #endif
  2167. }
  2168. return 1;
  2169. }
  2170. //==============================================================================
  2171. // This command is used to delete all houses.
  2172. // It does not give any money to the house owners when the houses is deleted.
  2173. //==============================================================================
  2174. CMD:removeallhouses(playerid, params[])
  2175. {
  2176. #pragma unused params
  2177. new hcount;
  2178. if(!IsPlayerAdmin(playerid)) return 0;
  2179. else
  2180. {
  2181. foreach(Houses, h)
  2182. {
  2183. foreach(Player, i)
  2184. {
  2185. if(IsInHouse{i} == 0) continue;
  2186. ExitHouse(i, h);
  2187. }
  2188. UnloadHouseCar(h);
  2189. DestroyHouseEntrance(h, TYPE_OUT);
  2190. DestroyHouseEntrance(h, TYPE_INT);
  2191. #if GH_USE_MAPICONS == true
  2192. DestroyDynamicMapIcon(HouseMIcon[h]);
  2193. #endif
  2194. DestroyDynamic3DTextLabel(HouseLabel[h]);
  2195. fremove(HouseFile(h));
  2196. hcount++;
  2197. Iter_Remove(Houses, h);
  2198. }
  2199. ShowInfoBox(playerid, I_ALLH_DESTROYED, hcount);
  2200. }
  2201. return 1;
  2202. }
  2203. //==============================================================================
  2204. // This command is used remove all house cars.
  2205. // It does not delete the house cars itself due to SA:MP mixing up vehicle ID's.
  2206. //==============================================================================
  2207. CMD:removeallhcars(playerid, params[])
  2208. {
  2209. #pragma unused params
  2210. new hcount, INI:file, filename[HOUSEFILE_LENGTH];
  2211. if(!IsPlayerAdmin(playerid)) return 0;
  2212. else
  2213. {
  2214. foreach(Houses, h)
  2215. {
  2216. UnloadHouseCar(h);
  2217. hInfo[h][HouseCar] = 0;
  2218. file = INI_Open(filename);
  2219. INI_WriteInt(file, "HCar", 0);
  2220. INI_Close(file);
  2221. }
  2222. ShowInfoBox(playerid, I_ALLHCAR_REMOVED, hcount);
  2223. }
  2224. return 1;
  2225. }
  2226. //==============================================================================
  2227. // This command is used to change the spawnposition details of a house
  2228. //==============================================================================
  2229. CMD:changespawn(playerid, params[])
  2230. {
  2231. new h;
  2232. if(!IsPlayerAdmin(playerid)) return 0;
  2233. if(sscanf(params, "d", h)) return ShowInfoBoxEx(playerid, COLOUR_SYSTEM, E_CMD_USAGE_CHANGESPAWN);
  2234. if(!fexist(HouseFile(h))) return ShowInfoBoxEx(playerid, COLOUR_SYSTEM, E_INVALID_HID);
  2235. else
  2236. {
  2237. GetPlayerPos(playerid, X, Y, Z);
  2238. GetPlayerFacingAngle(playerid, Angle);
  2239. new world = GetPlayerVirtualWorld(playerid), interior = GetPlayerInterior(playerid);
  2240. hInfo[h][SpawnOutX] = X, hInfo[h][SpawnOutY] = Y, hInfo[h][SpawnOutZ] = Z, hInfo[h][SpawnOutAngle] = (180.0 + Angle);
  2241. hInfo[h][SpawnWorld] = world, hInfo[h][SpawnInterior] = interior;
  2242. new INI:file = INI_Open(HouseFile(h));
  2243. INI_WriteFloat(file, "SpawnOutX", X);
  2244. INI_WriteFloat(file, "SpawnOutY", Y);
  2245. INI_WriteFloat(file, "SpawnOutZ", Z);
  2246. INI_WriteFloat(file, "SpawnOutAngle", Angle);
  2247. INI_WriteInt(file, "SpawnWorld", world);
  2248. INI_WriteInt(file, "SpawnInterior", interior);
  2249. INI_Close(file);
  2250. ShowInfoBox(playerid, I_HSPAWN_CHANGED, h);
  2251. }
  2252. return 1;
  2253. }
  2254. //==============================================================================
  2255. // This command is used to change the spawnposition details of a house interior
  2256. //==============================================================================
  2257. CMD:changehintspawn(playerid, params[])
  2258. {
  2259. new hint, filename[HOUSEFILE_LENGTH];
  2260. if(!IsPlayerAdmin(playerid)) return 0;
  2261. if(sscanf(params, "d", hint)) return ShowInfoBoxEx(playerid, COLOUR_SYSTEM, E_CMD_USAGE_CHANGEHINTSPAWN);
  2262. format(filename, sizeof(filename), HINT_FILEPATH, hint);
  2263. if(!fexist(filename)) return ShowInfoBoxEx(playerid, COLOUR_SYSTEM, E_INVALID_HINT_ID);
  2264. else
  2265. {
  2266. GetPlayerPos(playerid, X, Y, Z);
  2267. GetPlayerFacingAngle(playerid, Angle);
  2268. hIntInfo[hint][IntSpawnX] = X, hIntInfo[hint][IntSpawnY] = Y, hIntInfo[hint][IntSpawnZ] = Z, hIntInfo[hint][IntInterior] = GetPlayerInterior(playerid);
  2269. hIntInfo[hint][IntSpawnAngle] = (Angle + 180.0);
  2270. new INI:file = INI_Open(filename);
  2271. INI_WriteFloat(file, "SpawnX", X);
  2272. INI_WriteFloat(file, "SpawnY", Y);
  2273. INI_WriteFloat(file, "SpawnZ", Z);
  2274. INI_WriteFloat(file, "Angle", hIntInfo[hint][IntSpawnAngle]);
  2275. INI_WriteInt(file, "Interior", hIntInfo[hint][IntInterior]);
  2276. INI_Close(file);
  2277. ShowInfoBox(playerid, I_HINT_SPAWN_CHANGED, hint);
  2278. }
  2279. return 1;
  2280. }
  2281. //==============================================================================
  2282. // This command is used to create a house interior.
  2283. //==============================================================================
  2284. CMD:createhint(playerid, params[])
  2285. {
  2286. new filename[HOUSEFILE_LENGTH], h = GetFreeInteriorID(), value, name[31], interior = GetPlayerInterior(playerid);
  2287. if(!IsPlayerAdmin(playerid)) return 0;
  2288. if(sscanf(params, "ds[30]", value, name)) return ShowInfoBoxEx(playerid, COLOUR_SYSTEM, E_CMD_USAGE_CREATEHINT);
  2289. if(h < 0)
  2290. {
  2291. ShowInfoBox(playerid, E_TOO_MANY_HINTS, MAX_HOUSE_INTERIORS);
  2292. return 1;
  2293. }
  2294. if(value < MIN_HINT_VALUE || value > MAX_HINT_VALUE) return ShowInfoBoxEx(playerid, COLOUR_SYSTEM, E_INVALID_HINT_VALUE);
  2295. if(name[30]) return ShowInfoBoxEx(playerid, COLOUR_SYSTEM, E_INVALID_HINT_LENGTH);
  2296. else
  2297. {
  2298. format(filename, sizeof(filename), HINT_FILEPATH, h);
  2299. fcreate(filename);
  2300. GetPlayerPos(playerid, X, Y, Z);
  2301. GetPlayerFacingAngle(playerid, Angle);
  2302. hIntInfo[h][IntCPX] = X, hIntInfo[h][IntCPY] = Y, hIntInfo[h][IntCPZ] = Z;
  2303. hIntInfo[h][IntInterior] = interior, hIntInfo[h][IntSpawnAngle] = (Angle + 180.0), format(hIntInfo[h][IntName], 30, "%s", name), hIntInfo[h][IntValue] = value;
  2304. new INI:file = INI_Open(filename);
  2305. INI_WriteFloat(file, "CPX", X);
  2306. INI_WriteFloat(file, "CPY", Y);
  2307. INI_WriteFloat(file, "CPZ", Z);
  2308. INI_WriteString(file, "Name", name);
  2309. INI_WriteInt(file, "Value", value);
  2310. GetPosInFrontOfPlayer(playerid, X, Y, -2.5);
  2311. INI_WriteFloat(file, "SpawnX", X);
  2312. INI_WriteFloat(file, "SpawnY", Y);
  2313. INI_WriteFloat(file, "SpawnZ", Z);
  2314. INI_WriteFloat(file, "Angle", hIntInfo[h][IntSpawnAngle]);
  2315. INI_WriteInt(file, "Interior", interior);
  2316. INI_Close(file);
  2317. hIntInfo[h][IntSpawnX] = X, hIntInfo[h][IntSpawnY] = Y, hIntInfo[h][IntSpawnZ] = Z;
  2318. ShowInfoBox(playerid, I_HINT_CREATED, h, value, name);
  2319. }
  2320. return 1;
  2321. }
  2322. //==============================================================================
  2323. // This command is used to remove a house interior.
  2324. //==============================================================================
  2325. CMD:removehint(playerid, params[])
  2326. {
  2327. new hint, filename[HOUSEFILE_LENGTH];
  2328. if(!IsPlayerAdmin(playerid)) return 0;
  2329. if(sscanf(params, "d", hint)) return ShowInfoBoxEx(playerid, COLOUR_SYSTEM, E_CMD_USAGE_REMOVEHINT);
  2330. format(filename, sizeof(filename), HINT_FILEPATH, hint);
  2331. if(!fexist(filename)) return ShowInfoBoxEx(playerid, COLOUR_SYSTEM, E_INVALID_HINT);
  2332. ShowInfoBox(playerid, I_HINT_DESTROYED, hint);
  2333. fremove(filename);
  2334. foreach(Houses, h)
  2335. {
  2336. if(hInfo[h][HouseInterior] == hint)
  2337. {
  2338. hInfo[h][HouseInterior] = DEFAULT_H_INTERIOR;
  2339. new INI:file = INI_Open(HouseFile(h));
  2340. INI_WriteInt(file, "HouseInterior", DEFAULT_H_INTERIOR);
  2341. INI_Close(file);
  2342. }
  2343. }
  2344. return 1;
  2345. }
  2346. //==============================================================================
  2347. // This command is used to teleport to a house.
  2348. //==============================================================================
  2349. CMD:gotohouse(playerid, params[])
  2350. {
  2351. new h;
  2352. if(!IsPlayerAdmin(playerid)) return 0;
  2353. if(sscanf(params, "d", h)) return ShowInfoBoxEx(playerid, COLOUR_SYSTEM, E_CMD_USAGE_GOTOHOUSE);
  2354. if(!fexist(HouseFile(h))) return ShowInfoBoxEx(playerid, COLOUR_SYSTEM, E_INVALID_HID);
  2355. SetPlayerPosEx(playerid, hInfo[h][SpawnOutX], hInfo[h][SpawnOutY], hInfo[h][SpawnOutZ], hInfo[h][SpawnInterior], hInfo[h][SpawnWorld]);
  2356. ShowInfoBox(playerid, I_TELEPORT_MSG, h);
  2357. return 1;
  2358. }
  2359. //==============================================================================
  2360. // This command is used to sell a house.
  2361. // If the house owner is connected while selling the house,
  2362. // the amount in the house storage and 75% of the house value will be given to the house owner.
  2363. //==============================================================================
  2364. CMD:sellhouse(playerid, params[])
  2365. {
  2366. new h;
  2367. if(!IsPlayerAdmin(playerid)) return 0;
  2368. if(sscanf(params, "d", h)) return ShowInfoBoxEx(playerid, COLOUR_SYSTEM, E_CMD_USAGE_SELLHOUSE);
  2369. if(!fexist(HouseFile(h))) return ShowInfoBoxEx(playerid, COLOUR_SYSTEM, E_INVALID_HID);
  2370. if(!strcmp(hInfo[h][HouseOwner], INVALID_HOWNER_NAME, CASE_SENSETIVE)) return ShowInfoBoxEx(playerid, COLOUR_SYSTEM, E_H_A_F_SALE);
  2371. else
  2372. {
  2373. ShowInfoBox(playerid, I_H_SOLD, h);
  2374. if(hInfo[h][HouseStorage] >= 1 && IsPlayerConnected(GetHouseOwnerEx(h)))
  2375. {
  2376. GivePlayerMoney(playerid, (hInfo[h][HouseStorage] + ReturnProcent(hInfo[h][HouseValue], HOUSE_SELLING_PROCENT)));
  2377. }
  2378. hInfo[h][HouseValue] = ReturnProcent(hInfo[h][HouseValue], HOUSE_SELLING_PROCENT);
  2379. format(hInfo[h][HouseOwner], MAX_PLAYER_NAME, "%s", INVALID_HOWNER_NAME);
  2380. hInfo[h][HousePassword] = udb_hash("INVALID_HOUSE_PASSWORD");
  2381. format(hInfo[h][HouseName], MAX_HOUSE_NAME, "%s", DEFAULT_HOUSE_NAME);
  2382. hInfo[h][HouseStorage] = hInfo[h][HouseAlarm] = hInfo[h][HouseDog] = hInfo[h][HouseCamera] = hInfo[h][UpgradedLock] = 0;
  2383. new INI:file = INI_Open(HouseFile(h));
  2384. INI_WriteInt(file, "HouseValue", hInfo[h][HouseValue]);
  2385. INI_WriteString(file, "HouseOwner", INVALID_HOWNER_NAME);
  2386. INI_WriteInt(file, "HousePassword", hInfo[h][HousePassword]);
  2387. INI_WriteString(file, "HouseName", DEFAULT_HOUSE_NAME);
  2388. INI_WriteInt(file, "HouseStorage", 0);
  2389. INI_Close(file);
  2390. foreach(Houses, h2)
  2391. {
  2392. if(IsHouseInRangeOfHouse(h, h2, RANGE_BETWEEN_HOUSES) && h2 != h)
  2393. {
  2394. hInfo[h2][HouseValue] = (hInfo[h2][HouseValue] - ReturnProcent(hInfo[h2][HouseValue], HOUSE_SELLING_PROCENT2));
  2395. file = INI_Open(HouseFile(h2));
  2396. INI_WriteInt(file, "HouseValue", hInfo[h2][HouseValue]);
  2397. INI_Close(file);
  2398. }
  2399. }
  2400. foreach(Player, i)
  2401. {
  2402. if(IsPlayerInHouse(i, h))
  2403. {
  2404. ExitHouse(i, h);
  2405. ShowInfoBoxEx(i, COLOUR_INFO, I_TO_PLAYERS_HSOLD);
  2406. }
  2407. }
  2408. #if GH_USE_MAPICONS == true
  2409. DestroyDynamicMapIcon(HouseMIcon[h]);
  2410. HouseMIcon[h] = CreateDynamicMapIcon(hInfo[h][CPOutX], hInfo[h][CPOutY], hInfo[h][CPOutZ], 31, -1, hInfo[h][SpawnWorld], hInfo[h][SpawnInterior], -1, MICON_VD);
  2411. #endif
  2412. UpdateHouseText(h);
  2413. }
  2414. return 1;
  2415. }
  2416. //==============================================================================
  2417. // This command is used to sell a house.
  2418. // If the house owner is connected while selling the house,
  2419. // the amount in the house storage and 75% of the house value will be given to the house owner.
  2420. //==============================================================================
  2421. CMD:sellallhouses(playerid, params[])
  2422. {
  2423. #pragma unused params
  2424. new INI:file, hcount;
  2425. if(!IsPlayerAdmin(playerid)) return 0;
  2426. else
  2427. {
  2428. foreach(Houses, h)
  2429. {
  2430. if(strcmp(hInfo[h][HouseOwner], INVALID_HOWNER_NAME, CASE_SENSETIVE))
  2431. {
  2432. if(hInfo[h][HouseStorage] >= 1 && IsPlayerConnected(GetHouseOwnerEx(h)))
  2433. {
  2434. GivePlayerMoney(playerid, (hInfo[h][HouseStorage] + ReturnProcent(hInfo[h][HouseValue], HOUSE_SELLING_PROCENT)));
  2435. }
  2436. hInfo[h][HouseValue] = ReturnProcent(hInfo[h][HouseValue], HOUSE_SELLING_PROCENT);
  2437. format(hInfo[h][HouseOwner], MAX_PLAYER_NAME, "%s", INVALID_HOWNER_NAME);
  2438. hInfo[h][HousePassword] = udb_hash("INVALID_HOUSE_PASSWORD");
  2439. format(hInfo[h][HouseName], MAX_HOUSE_NAME, "%s", DEFAULT_HOUSE_NAME);
  2440. hInfo[h][HouseStorage] = hInfo[h][HouseAlarm] = hInfo[h][HouseDog] = hInfo[h][HouseCamera] = hInfo[h][UpgradedLock] = 0;
  2441. file = INI_Open(HouseFile(h));
  2442. INI_WriteInt(file, "HouseValue", hInfo[h][HouseValue]);
  2443. INI_WriteString(file, "HouseOwner", INVALID_HOWNER_NAME);
  2444. INI_WriteInt(file, "HousePassword", hInfo[h][HousePassword]);
  2445. INI_WriteString(file, "HouseName", DEFAULT_HOUSE_NAME);
  2446. INI_WriteInt(file, "HouseStorage", 0);
  2447. INI_Close(file);
  2448. #if GH_USE_MAPICONS == true
  2449. DestroyDynamicMapIcon(HouseMIcon[h]);
  2450. HouseMIcon[h] = CreateDynamicMapIcon(hInfo[h][CPOutX], hInfo[h][CPOutY], hInfo[h][CPOutZ], 31, -1, hInfo[h][SpawnWorld], hInfo[h][SpawnInterior], -1, MICON_VD);
  2451. #endif
  2452. UpdateHouseText(h);
  2453. hcount++;
  2454. }
  2455. }
  2456. foreach(Player, i)
  2457. {
  2458. if(IsInHouse{i} == 1)
  2459. {
  2460. ExitHouse(i, GetPVarInt(i, "LastHouseCP"));
  2461. ShowInfoBoxEx(i, COLOUR_INFO, I_TO_PLAYERS_HSOLD);
  2462. }
  2463. }
  2464. ShowInfoBox(playerid, I_ALLH_SOLD, hcount);
  2465. }
  2466. return 1;
  2467. }
  2468. //==============================================================================
  2469. // This command is used to change the value of a house.
  2470. //==============================================================================
  2471. CMD:changeprice(playerid, params[])
  2472. {
  2473. new h, price;
  2474. if(!IsPlayerAdmin(playerid)) return 0;
  2475. if(sscanf(params, "dd", h, price)) return ShowInfoBoxEx(playerid, COLOUR_SYSTEM, E_CMD_USAGE_CHANGEPRICE);
  2476. if(!fexist(HouseFile(h))) return ShowInfoBoxEx(playerid, COLOUR_SYSTEM, E_INVALID_HID);
  2477. if(price < MIN_HOUSE_VALUE || price > MAX_HOUSE_VALUE) return ShowInfoBoxEx(playerid, COLOUR_SYSTEM, E_INVALID_HVALUE);
  2478. hInfo[h][HouseValue] = price;
  2479. new INI:file = INI_Open(HouseFile(h));
  2480. INI_WriteInt(file, "HouseValue", price);
  2481. INI_Close(file);
  2482. ShowInfoBox(playerid, I_H_PRICE_CHANGED, h, price);
  2483. UpdateHouseText(h);
  2484. return 1;
  2485. }
  2486. //==============================================================================
  2487. // This command is used to change the value of all houses on the server.
  2488. //==============================================================================
  2489. CMD:changeallprices(playerid, params[])
  2490. {
  2491. new hcount, INI:file, price;
  2492. if(!IsPlayerAdmin(playerid)) return 0;
  2493. if(sscanf(params, "d", price)) return ShowInfoBoxEx(playerid, COLOUR_SYSTEM, E_CMD_USAGE_CHANGEALLPRICE);
  2494. if(price < MIN_HOUSE_VALUE || price > MAX_HOUSE_VALUE) return ShowInfoBoxEx(playerid, COLOUR_SYSTEM, E_INVALID_HVALUE);
  2495. else
  2496. {
  2497. foreach(Houses, h)
  2498. {
  2499. hInfo[h][HouseValue] = price;
  2500. file = INI_Open(HouseFile(h));
  2501. INI_WriteInt(file, "HouseValue", price);
  2502. INI_Close(file);
  2503. UpdateHouseText(h);
  2504. hcount++;
  2505. }
  2506. ShowInfoBox(playerid, I_ALLH_PRICE_CHANGED, price, hcount);
  2507. }
  2508. return 1;
  2509. }
  2510. CMD:ghcmds(playerid, params[])
  2511. {
  2512. #pragma unused params
  2513. if(!IsPlayerAdmin(playerid)) return 0;
  2514. else return ShowPlayerDialog(playerid, HOUSEMENU-1, DIALOG_STYLE_MSGBOX, INFORMATION_HEADER, "/changeallprices\n/removeallhcars\n/sellallhouses\n/changeprice\n/changespawn\n/removehcar\n/sellhouse\n/housemenu\n/gotohouse\n/addhcar\n/changehcar\n/changehintspawn\n/createhint\n/removehint\n/ghcmds", "Close", "");
  2515. }
  2516. //##############################################################################
  2517. // Callbacks
  2518. //##############################################################################
  2519. function HouseVisiting(playerid)
  2520. {
  2521. new string[200], tmpstring[50];
  2522. GetPVarString(playerid, "HousePrevName", tmpstring, 50);
  2523. format(string, sizeof(string), I_HINT_VISIT_OVER, tmpstring, GetPVarInt(playerid, "HousePrevValue"));
  2524. ShowPlayerDialog(playerid, HOUSEMENU+17, DIALOG_STYLE_MSGBOX, INFORMATION_HEADER, string, "Buy", "Cancel");
  2525. return 1;
  2526. }
  2527. function HouseSpawning(playerid)
  2528. {
  2529. foreach(Houses, h)
  2530. {
  2531. if(!strcmp(hInfo[h][HouseOwner], pNick(playerid), CASE_SENSETIVE))
  2532. {
  2533. if(hInfo[h][QuitInHouse] == 1)
  2534. {
  2535. SetPVarInt(playerid, "LastHouseCP", h);
  2536. SetPlayerHouseInterior(playerid, h);
  2537. #if GH_HOUSECARS == true
  2538. LoadHouseCar(h);
  2539. #endif
  2540. ShowInfoBoxEx(playerid, COLOUR_INFO, I_HMENU);
  2541. hInfo[h][QuitInHouse] = 0;
  2542. new INI:file = INI_Open(HouseFile(h));
  2543. INI_WriteInt(file, "QuitInHouse", 0);
  2544. INI_Close(file);
  2545. break;
  2546. }
  2547. }
  2548. }
  2549. SetPVarInt(playerid, "FirstSpawn", 1);
  2550. return 1;
  2551. }
  2552. function LoadHouseData(h, name[], value[])
  2553. {
  2554. if(!strcmp(name, "HouseName", true)) { format(hInfo[h][HouseName], MAX_HOUSE_NAME, "%s", value); }
  2555. if(!strcmp(name, "HouseOwner", true)) { format(hInfo[h][HouseOwner], MAX_PLAYER_NAME, "%s", value); }
  2556. if(!strcmp(name, "HouseLocation", true)) { format(hInfo[h][HouseLocation], MAX_ZONE_NAME, "%s", GetHouseLocation(h)); }
  2557. if(!strcmp(name, "HousePassword", true))
  2558. {
  2559. switch(strcmp(value, "INVALID_HOUSE_PASSWORD", true))
  2560. {
  2561. case 0: hInfo[h][HousePassword] = udb_hash(value);
  2562. case 1: hInfo[h][HousePassword] = strval(value);
  2563. }
  2564. }
  2565. if(!strcmp(name, "SpawnOutX", true)) { hInfo[h][SpawnOutX] = floatstr(value); }
  2566. if(!strcmp(name, "SpawnOutY", true)) { hInfo[h][SpawnOutY] = floatstr(value); }
  2567. if(!strcmp(name, "SpawnOutZ", true)) { hInfo[h][SpawnOutZ] = floatstr(value); }
  2568. if(!strcmp(name, "SpawnOutAngle", true)) { hInfo[h][SpawnOutAngle] = floatstr(value); }
  2569. if(!strcmp(name, "SpawnInterior", true)) { hInfo[h][SpawnInterior] = strval(value); }
  2570. if(!strcmp(name, "SpawnWorld", true)) { hInfo[h][SpawnWorld] = strval(value); }
  2571. if(!strcmp(name, "CPOutX", true)) { hInfo[h][CPOutX] = floatstr(value); }
  2572. if(!strcmp(name, "CPOutY", true)) { hInfo[h][CPOutY] = floatstr(value); }
  2573. if(!strcmp(name, "CPOutZ", true)) { hInfo[h][CPOutZ] = floatstr(value); }
  2574. if(!strcmp(name, "HouseValue", true)) { hInfo[h][HouseValue] = strval(value); }
  2575. if(!strcmp(name, "HouseStorage", true)) { hInfo[h][HouseStorage] = strval(value); }
  2576. if(!strcmp(name, "HouseInterior", true)) { hInfo[h][HouseInterior] = strval(value); }
  2577. if(!strcmp(name, "HouseWorld", true)) { hInfo[h][SpawnWorld] = strval(value); }
  2578. if(!strcmp(name, "HouseCar", true)) { hInfo[h][HouseCar] = strval(value); }
  2579. if(!strcmp(name, "HCarPosX", true)) { hInfo[h][HouseCarPosX] = floatstr(value); }
  2580. if(!strcmp(name, "HCarPosY", true)) { hInfo[h][HouseCarPosY] = floatstr(value); }
  2581. if(!strcmp(name, "HCarPosZ", true)) { hInfo[h][HouseCarPosZ] = floatstr(value); }
  2582. if(!strcmp(name, "HCarAngle", true)) { hInfo[h][HouseCarAngle] = floatstr(value); }
  2583. if(!strcmp(name, "HCarModel", true)) { hInfo[h][HouseCarModel] = strval(value); }
  2584. if(!strcmp(name, "HCarWorld", true)) { hInfo[h][HouseCarWorld] = strval(value); }
  2585. if(!strcmp(name, "HCarInt", true)) { hInfo[h][HouseCarInterior] = strval(value); }
  2586. if(!strcmp(name, "QuitInHouse", true)) { hInfo[h][QuitInHouse] = strval(value); }
  2587. if(!strcmp(name, "ForSale", true)) { hInfo[h][ForSale] = strval(value); }
  2588. if(!strcmp(name, "ForSalePrice", true)) { hInfo[h][ForSalePrice] = strval(value); }
  2589. if(!strcmp(name, "HousePrivacy", true)) { hInfo[h][HousePrivacy] = strval(value); }
  2590. if(!strcmp(name, "HouseAlarm", true)) { hInfo[h][HouseAlarm] = strval(value); }
  2591. if(!strcmp(name, "HouseCamera", true)) { hInfo[h][HouseCamera] = strval(value); }
  2592. if(!strcmp(name, "HouseDog", true)) { hInfo[h][HouseDog] = strval(value); }
  2593. if(!strcmp(name, "HouseUpgradedLock", true)) { hInfo[h][UpgradedLock] = strval(value); }
  2594. return 0;
  2595. }
  2596. function LoadHouseInteriorData(hint, name[], value[])
  2597. {
  2598. if(!strcmp(name, "Name", true)) { format(hIntInfo[hint][IntName], 30, "%s", value); }
  2599. if(!strcmp(name, "SpawnX", true)) { hIntInfo[hint][IntSpawnX] = floatstr(value); }
  2600. if(!strcmp(name, "SpawnY", true)) { hIntInfo[hint][IntSpawnY] = floatstr(value); }
  2601. if(!strcmp(name, "SpawnZ", true)) { hIntInfo[hint][IntSpawnZ] = floatstr(value); }
  2602. if(!strcmp(name, "Angle", true)) { hIntInfo[hint][IntSpawnAngle] = floatstr(value); }
  2603. if(!strcmp(name, "CPX", true)) { hIntInfo[hint][IntCPX] = floatstr(value); }
  2604. if(!strcmp(name, "CPY", true)) { hIntInfo[hint][IntCPY] = floatstr(value); }
  2605. if(!strcmp(name, "CPZ", true)) { hIntInfo[hint][IntCPZ] = floatstr(value); }
  2606. if(!strcmp(name, "Interior", true)) { hIntInfo[hint][IntInterior] = strval(value); }
  2607. if(!strcmp(name, "Value", true)) { hIntInfo[hint][IntValue] = strval(value); }
  2608. return 0;
  2609. }
  2610. function LoadUserData(playerid, name[], value[])
  2611. {
  2612. if(!strcmp(name, "MoneyToGive", true)) { GivePlayerMoney(playerid, strval(value)), SetPVarInt(playerid, "GA_TMP_HOUSEFORSALEPRICE", strval(value)); }
  2613. if(!strcmp(name, "MoneyToGiveHS", true)) { GivePlayerMoney(playerid, strval(value)), SetPVarInt(playerid, "GA_TMP_HOUSESTORAGE", strval(value)); }
  2614. if(!strcmp(name, "HouseName", true)) { SetPVarString(playerid, "GA_TMP_HOUSENAME", value); }
  2615. if(!strcmp(name, "HouseBuyer", true)) { SetPVarString(playerid, "GA_TMP_NEWHOUSEOWNER", value); }
  2616. return 0;
  2617. }
  2618. INI:currentid[](name[], value[])
  2619. {
  2620. if(!strcmp(name, "CurrentID", true)) { CurrentID = strval(value); }
  2621. return 0;
  2622. }
  2623. function SecurityDog_ClearAnimations(playerid)
  2624. {
  2625. return ClearAnimations(playerid);
  2626. }
  2627. //##############################################################################
  2628. // Functions
  2629. //##############################################################################
  2630. // By [03]Garsino!
  2631. //==============================================================================
  2632. // LoadHouses();
  2633. // This function is used to load the houses.
  2634. // It creates all the checkpoints, map icons and
  2635. // 3D texts for all the houses and sets the correct 3D text information.
  2636. //==============================================================================
  2637. stock LoadHouses()
  2638. {
  2639. new hcount, labeltext[250], countstart = GetTickCount(), INI:file;
  2640. LoadHouseInteriors(); // Load house interiors
  2641. Loop(h, MAX_HOUSES, 0)
  2642. {
  2643. if(fexist(HouseFile(h)))
  2644. {
  2645. INI_ParseFile(HouseFile(h), "LoadHouseData", false, true, h, true, false );
  2646. #if GH_USE_CPS == true
  2647. HouseCPOut[h] = CreateDynamicCP(hInfo[h][CPOutX], hInfo[h][CPOutY], hInfo[h][CPOutZ], 1.5, hInfo[h][SpawnWorld], hInfo[h][SpawnInterior], -1, 15.0);
  2648. #else
  2649. HousePickupOut[h] = CreateDynamicPickup(PICKUP_MODEL_OUT, PICKUP_TYPE, hInfo[h][CPOutX], hInfo[h][CPOutY], hInfo[h][CPOutZ], hInfo[h][SpawnWorld], hInfo[h][SpawnInterior], -1, 15.0);
  2650. #endif
  2651. CreateCorrectHouseExitCP(h);
  2652. if(!strcmp(hInfo[h][HouseOwner], INVALID_HOWNER_NAME, CASE_SENSETIVE))
  2653. {
  2654. format(labeltext, sizeof(labeltext), LABELTEXT1, hInfo[h][HouseName], hInfo[h][HouseValue], h);
  2655. #if GH_USE_MAPICONS == true
  2656. HouseMIcon[h] = CreateDynamicMapIcon(hInfo[h][CPOutX], hInfo[h][CPOutY], hInfo[h][CPOutZ], 31, -1, hInfo[h][SpawnWorld], hInfo[h][SpawnInterior], -1, MICON_VD);
  2657. #endif
  2658. }
  2659. if(strcmp(hInfo[h][HouseOwner], INVALID_HOWNER_NAME, CASE_SENSETIVE))
  2660. {
  2661. format(labeltext, sizeof(labeltext), LABELTEXT2, hInfo[h][HouseName], hInfo[h][HouseOwner], hInfo[h][HouseValue], YesNo(hInfo[h][ForSale]), Answer(hInfo[h][HousePrivacy], "Open", "Closed"), h);
  2662. #if GH_USE_MAPICONS == true
  2663. HouseMIcon[h] = CreateDynamicMapIcon(hInfo[h][CPOutX], hInfo[h][CPOutY], hInfo[h][CPOutZ], 32, -1, hInfo[h][SpawnWorld], hInfo[h][SpawnInterior], -1, MICON_VD);
  2664. #endif
  2665. }
  2666. HouseLabel[h] = CreateDynamic3DTextLabel(labeltext, COLOUR_GREEN, hInfo[h][CPOutX], hInfo[h][CPOutY], hInfo[h][CPOutZ]+0.7, TEXTLABEL_DISTANCE, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, TEXTLABEL_TESTLOS, hInfo[h][SpawnWorld], hInfo[h][SpawnInterior], -1, TEXTLABEL_DISTANCE);
  2667. if(isnull(hIntInfo[hInfo[h][HouseInterior]][IntName]))
  2668. {
  2669. hInfo[h][HouseInterior] = DEFAULT_H_INTERIOR;
  2670. file = INI_Open(HouseFile(h));
  2671. INI_WriteInt(file, "HouseInterior", DEFAULT_H_INTERIOR);
  2672. INI_Close(file);
  2673. }
  2674. Iter_Add(Houses, h);
  2675. hcount++;
  2676. }
  2677. }
  2678. return printf("\nTotal Houses Loaded: %d. Duration: %d ms\n", hcount, (GetTickCount() - countstart));
  2679. }
  2680. //==============================================================================
  2681. // LoadHouseCar(houseid);
  2682. // This function is used to load the house car for a house.
  2683. //==============================================================================
  2684. stock LoadHouseCar(houseid)
  2685. {
  2686. #if GH_HOUSECARS == true
  2687. if(fexist(HouseFile(houseid)) && hInfo[houseid][HouseCar] == 1)
  2688. {
  2689. HCar[houseid] = CreateVehicle(hInfo[houseid][HouseCarModel], hInfo[houseid][HouseCarPosX], hInfo[houseid][HouseCarPosY], hInfo[houseid][HouseCarPosZ], hInfo[houseid][HouseCarAngle], HCAR_COLOUR1, HCAR_COLOUR2, HCAR_RESPAWN);
  2690. SetVehicleVirtualWorld(HCar[houseid], hInfo[houseid][HouseCarWorld]);
  2691. LinkVehicleToInterior(HCar[houseid], hInfo[houseid][HouseCarInterior]);
  2692. }
  2693. #endif
  2694. return 1;
  2695. }
  2696. //==============================================================================
  2697. // UnloadHouseCar(houseid);
  2698. // This function is used to the unload house car for a house.
  2699. //==============================================================================
  2700. stock UnloadHouseCar(houseid)
  2701. {
  2702. #if GH_HOUSECARS == false
  2703. #pragma unused houseid
  2704. #else
  2705. if(fexist(HouseFile(houseid)) && hInfo[houseid][HouseCar] == 1)
  2706. {
  2707. if(GetVehicleModel(HCar[houseid]) >= 400 && GetVehicleModel(HCar[houseid]) <= 611 && HCar[houseid] >= 1)
  2708. {
  2709. DestroyVehicle(HCar[houseid]);
  2710. HCar[houseid] = -1;
  2711. }
  2712. }
  2713. #endif
  2714. return 1;
  2715. }
  2716. //==============================================================================
  2717. // SaveHouseCar(houseid);
  2718. // This function is used to check if there is any vehicles
  2719. // near the housecar spawn.
  2720. //==============================================================================
  2721. stock SaveHouseCar(houseid)
  2722. {
  2723. #if GH_HOUSECARS == true
  2724. if(fexist(HouseFile(houseid)) && hInfo[houseid][HouseCar] == 1)
  2725. {
  2726. Loop(v, MAX_VEHICLES, 0)
  2727. {
  2728. if(GetVehicleModel(v) < 400 || GetVehicleModel(v) > 611 || IsVehicleOccupied(v)) continue;
  2729. GetVehiclePos(v, X, Y, Z);
  2730. if(PointInRangeOfPoint(HCAR_RANGE, X, Y, Z, hInfo[houseid][HouseCarPosX], hInfo[houseid][HouseCarPosY], hInfo[houseid][HouseCarPosZ]))
  2731. {
  2732. new INI:file = INI_Open(HouseFile(houseid));
  2733. INI_WriteInt(file, "HCarModel", GetVehicleModel(v));
  2734. INI_Close(file);
  2735. DestroyVehicle(v);
  2736. break;
  2737. }
  2738. }
  2739. }
  2740. #endif
  2741. return 1;
  2742. }
  2743. //==============================================================================
  2744. // LoadHouseInteriors();
  2745. // This function is used to load the house interior datas from the files.
  2746. //==============================================================================
  2747. stock LoadHouseInteriors()
  2748. {
  2749. new hintcount, filename[HOUSEFILE_LENGTH], countstart = GetTickCount();
  2750. Loop(hint, MAX_HOUSE_INTERIORS, 0)
  2751. {
  2752. format(filename, sizeof(filename), HINT_FILEPATH, hint);
  2753. if(fexist(filename))
  2754. {
  2755. INI_ParseFile(filename, "LoadHouseInteriorData", false, true, hint, true, false);
  2756. hintcount++;
  2757. }
  2758. }
  2759. return printf("\nTotal House Interiors Loaded: %d. Duration: %d ms\n", hintcount, (GetTickCount() - countstart));
  2760. }
  2761. //==============================================================================
  2762. // GetOwnedHouses(playerid);
  2763. // This function is used to find out how many houses a player owns
  2764. //==============================================================================
  2765. stock GetOwnedHouses(playerid)
  2766. {
  2767. new tmpcount;
  2768. foreach(Houses, h)
  2769. {
  2770. if(!strcmp(hInfo[h][HouseOwner], pNick(playerid), CASE_SENSETIVE))
  2771. {
  2772. tmpcount++;
  2773. }
  2774. }
  2775. return tmpcount;
  2776. }
  2777. //==============================================================================
  2778. // GetHouseOwnerEx(houseid);
  2779. // This function is used to get the house owner of a house
  2780. // and return the playerid, it will return INVALID_PLAYER_ID
  2781. // if the house owner is not connected
  2782. //==============================================================================
  2783. stock GetHouseOwnerEx(houseid)
  2784. {
  2785. if(fexist(HouseFile(houseid)))
  2786. {
  2787. foreach(Character, i)
  2788. {
  2789. if(!strcmp(pNick(i), hInfo[houseid][HouseOwner], CASE_SENSETIVE))
  2790. {
  2791. return i;
  2792. }
  2793. }
  2794. }
  2795. return INVALID_PLAYER_ID;
  2796. }
  2797. //==============================================================================
  2798. // ReturnPlayerHouseID(playerid, houseslot);
  2799. // This function is used to return the house id from a players house 'slot'
  2800. // Example: ReturnPlayerHouseID(playerid, 0);
  2801. // Would return for example house ID 500.
  2802. //==============================================================================
  2803. stock ReturnPlayerHouseID(playerid, houseslot)
  2804. {
  2805. new tmpcount;
  2806. if(houseslot < 1 && houseslot > MAX_HOUSES_OWNED) return -1;
  2807. foreach(Houses, h)
  2808. {
  2809. if(!strcmp(pNick(playerid), hInfo[h][HouseOwner], CASE_SENSETIVE))
  2810. {
  2811. tmpcount++;
  2812. if(tmpcount == houseslot)
  2813. {
  2814. return h;
  2815. }
  2816. }
  2817. }
  2818. return -1;
  2819. }
  2820. //==============================================================================
  2821. // UnloadHouses();
  2822. // This function is used to unload the houses.
  2823. // It deletes all the checkpoints, map icons and 3D texts for all the houses.
  2824. //==============================================================================
  2825. stock UnloadHouses()
  2826. {
  2827. foreach(Houses, h)
  2828. {
  2829. DestroyHouseEntrance(h, TYPE_OUT);
  2830. DestroyHouseEntrance(h, TYPE_INT);
  2831. #if GH_USE_MAPICONS == true
  2832. DestroyDynamicMapIcon(HouseMIcon[h]);
  2833. #endif
  2834. DestroyDynamic3DTextLabel(HouseLabel[h]);
  2835. #if GH_HOUSECARS == true
  2836. UnloadHouseCar(h);
  2837. #endif
  2838. }
  2839. Iter_Clear(Houses);
  2840. return 1;
  2841. }
  2842. //==============================================================================
  2843. // IsHouseInRangeOfHouse(house, house2, Float:range);
  2844. // This function is used to check if a house is in range of another house
  2845. // Default range is 250.0
  2846. //==============================================================================
  2847. stock IsHouseInRangeOfHouse(house, house2, Float:range = 250.0)
  2848. {
  2849. if(fexist(HouseFile(house)) && fexist(HouseFile(house2)))
  2850. {
  2851. if(PointInRangeOfPoint(range, hInfo[house][CPOutX], hInfo[house][CPOutY], hInfo[house][CPOutZ], hInfo[house2][CPOutX], hInfo[house2][CPOutY], hInfo[house2][CPOutZ]))
  2852. {
  2853. return 1;
  2854. }
  2855. }
  2856. return 0;
  2857. }
  2858. //==============================================================================
  2859. // CreateCorrectHouseExitCP(houseid);
  2860. // This function is used to create the correct house exit checkpoint for the houseid
  2861. // based on the house interior ID
  2862. //==============================================================================
  2863. stock CreateCorrectHouseExitCP(houseid)
  2864. {
  2865. new _int = hInfo[houseid][HouseInterior];
  2866. #if GH_USE_CPS == true
  2867. HouseCPInt[houseid] = CreateDynamicCP(hIntInfo[_int][IntCPX], hIntInfo[_int][IntCPY], hIntInfo[_int][IntCPZ], 1.5, (houseid + 1000), hIntInfo[_int][IntInterior], -1, 15.0);
  2868. #else
  2869. HousePickupInt[houseid] = CreateDynamicPickup(PICKUP_MODEL_INT, PICKUP_TYPE, hIntInfo[_int][IntCPX], hIntInfo[_int][IntCPY], hIntInfo[_int][IntCPZ], (houseid + 1000), hIntInfo[_int][IntInterior], -1, 15.0);
  2870. #endif
  2871. return 1;
  2872. }
  2873. //==============================================================================
  2874. // SetPlayerHouseInterior(playerid, house);
  2875. // This function is used to set the correct house interior for a player when he enters a house or buy a new house interior.
  2876. //==============================================================================
  2877. stock SetPlayerHouseInterior(playerid, houseid)
  2878. {
  2879. new _int = hInfo[houseid][HouseInterior];
  2880. SetPVarInt(playerid, "IsInHouse", 1), IsInHouse{playerid} = 1;
  2881. SetPlayerPosEx(playerid, hIntInfo[_int][IntSpawnX], hIntInfo[_int][IntSpawnY], hIntInfo[_int][IntSpawnZ], hIntInfo[_int][IntInterior], (houseid + 1000));
  2882. SetPlayerFacingAngle(playerid, hIntInfo[_int][IntSpawnAngle]);
  2883. }
  2884. //==============================================================================
  2885. // pNick(playerid);
  2886. // Used to get the name of a player.
  2887. //==============================================================================
  2888. stock pNick(playerid)
  2889. {
  2890. new GHNick[MAX_PLAYER_NAME];
  2891. GetPlayerName(playerid, GHNick, MAX_PLAYER_NAME);
  2892. return GHNick;
  2893. }
  2894. //==============================================================================
  2895. // PointInRangeOfPoint(Float:range, Float:x2, Float:y2, Float:z2, Float:X2, Float:Y2, Float:Z2);
  2896. // Used to check if a point is in range of another point.
  2897. // Credits to whoever made this!
  2898. //==============================================================================
  2899. stock PointInRangeOfPoint(Float:range, Float:x2, Float:y2, Float:z2, Float:X2, Float:Y2, Float:Z2)
  2900. {
  2901. X2 -= x2, Y2 -= y2, Z2 -= z2;
  2902. return ((X2 * X2) + (Y2 * Y2) + (Z2 * Z2)) < (range * range);
  2903. }
  2904. //==============================================================================
  2905. // ReturnProcent(Float:amount, Float:procent);
  2906. // Used to return the procent of an value.
  2907. //==============================================================================
  2908. stock ReturnProcent(Float:amount, Float:procent) return floatround(((amount / 100) * procent));
  2909. //==============================================================================
  2910. // SetPlayerPosEx(playerid, Float:posX, Float:posY, Float:posZ, Interior = 0, World = 0);
  2911. // Used to set the position of a player with optional interiorid and worldid parameters
  2912. //==============================================================================
  2913. stock SetPlayerPosEx(playerid, Float:posX, Float:posY, Float:posZ, Interior = 0, World = 0)
  2914. {
  2915. SetPlayerVirtualWorld(playerid, World), SetPlayerInterior(playerid, Interior), SetPlayerPos(playerid, posX, posY, posZ), SetCameraBehindPlayer(playerid);
  2916. return 1;
  2917. }
  2918. //==============================================================================
  2919. // GetFreeHouseID();
  2920. // Used to get the next free house ID. Will return -1 if there is none free.
  2921. //==============================================================================
  2922. stock GetFreeHouseID()
  2923. {
  2924. Loop(h, MAX_HOUSES, 0)
  2925. {
  2926. if(!fexist(HouseFile(h)))
  2927. {
  2928. return h;
  2929. }
  2930. }
  2931. return -1;
  2932. }
  2933. //==============================================================================
  2934. // GetFreeInteriorID();
  2935. // Used to get the next free house interior ID. Will return -1 if there is none free.
  2936. //==============================================================================
  2937. stock GetFreeInteriorID()
  2938. {
  2939. new filename[INTERIORFILE_LENGTH];
  2940. Loop(hint, MAX_HOUSE_INTERIORS, 0)
  2941. {
  2942. format(filename, sizeof(filename), HINT_FILEPATH, hint);
  2943. if(!fexist(filename))
  2944. {
  2945. return hint;
  2946. }
  2947. }
  2948. return -1;
  2949. }
  2950. //==============================================================================
  2951. // GetTotalHouses();
  2952. // Used to get the amount of existing houses.
  2953. //==============================================================================
  2954. stock GetTotalHouses() return Iter_Count(Houses);
  2955. //==============================================================================
  2956. // IsHouseInteriorValid(houseinterior);
  2957. // Used to check if a house interior does exist.
  2958. //==============================================================================
  2959. stock IsHouseInteriorValid(houseinterior)
  2960. {
  2961. new filename[INTERIORFILE_LENGTH];
  2962. format(filename, sizeof(filename), HINT_FILEPATH, houseinterior);
  2963. return fexist(filename);
  2964. }
  2965. //==============================================================================
  2966. // UpdateHouseText();
  2967. // Updates the 3D text label.
  2968. //==============================================================================
  2969. stock UpdateHouseText(houseid)
  2970. {
  2971. new labeltext[250];
  2972. if(fexist(HouseFile(houseid)))
  2973. {
  2974. switch(strcmp(INVALID_HOWNER_NAME, hInfo[houseid][HouseOwner], CASE_SENSETIVE))
  2975. {
  2976. case 0: format(labeltext, sizeof(labeltext), LABELTEXT1, hInfo[houseid][HouseName], hInfo[houseid][HouseValue], houseid);
  2977. case 1: format(labeltext, sizeof(labeltext), LABELTEXT2, hInfo[houseid][HouseName], hInfo[houseid][HouseOwner], hInfo[houseid][HouseValue], YesNo(hInfo[houseid][ForSale]), Answer(hInfo[houseid][HousePrivacy], "Open", "Closed"), houseid);
  2978. }
  2979. UpdateDynamic3DTextLabelText(HouseLabel[houseid], COLOUR_GREEN, labeltext);
  2980. }
  2981. }
  2982. //==============================================================================
  2983. // AddS(amount);
  2984. // By [03]Garsino.
  2985. //==============================================================================
  2986. stock AddS(amount)
  2987. {
  2988. new returnstring[2];
  2989. format(returnstring, 2, "");
  2990. if(amount != 1 && amount != -1)
  2991. {
  2992. format(returnstring, 2, "s");
  2993. }
  2994. return returnstring;
  2995. }
  2996. //==============================================================================
  2997. // GetSecondsBetweenAction(action);
  2998. // By [03]Garsino.
  2999. //==============================================================================
  3000. stock GetSecondsBetweenAction(action) return floatround(floatdiv((GetTickCount() - action), 1000), floatround_tozero);
  3001. //==============================================================================
  3002. // DestroyHouseEntrance(houseid, type);
  3003. // Destroys the house entrance of a house (pickup or checkpoint).
  3004. // Type can be: TYPE_OUT (0) and TYPE_INT (1)
  3005. // By [03]Garsino.
  3006. //==============================================================================
  3007. stock DestroyHouseEntrance(houseid, type)
  3008. {
  3009. #if GH_USE_CPS == true
  3010. if(type == TYPE_OUT) { DestroyDynamicCP(HouseCPOut[houseid]); }
  3011. if(type == TYPE_INT) { DestroyDynamicCP(HouseCPInt[houseid]); }
  3012. #else
  3013. if(type == TYPE_OUT) { DestroyDynamicPickup(HousePickupOut[houseid]); }
  3014. if(type == TYPE_INT) { DestroyDynamicPickup(HousePickupInt[houseid]); }
  3015. #endif
  3016. return 1;
  3017. }
  3018. //==============================================================================
  3019. // IsVehicleOccupied(vehicleid);
  3020. // Checks if a vehicle is occupied or not.
  3021. // By [03]Garsino.
  3022. //==============================================================================
  3023. stock IsVehicleOccupied(vehicleid)
  3024. {
  3025. foreach(Player, i)
  3026. {
  3027. if(IsPlayerInVehicle(i, vehicleid))
  3028. {
  3029. return 1;
  3030. }
  3031. }
  3032. return 0;
  3033. }
  3034. //==============================================================================
  3035. stock CountPlayersInHouse(houseid)
  3036. {
  3037. new count;
  3038. foreach(Player, i)
  3039. {
  3040. if(!IsPlayerInHouse(i, houseid)) continue;
  3041. count++;
  3042. }
  3043. return count;
  3044. }
  3045. stock ShowInfoBoxEx(playerid, colour, message[])
  3046. {
  3047. new HugeAssString[1000];
  3048. format(HugeAssString, sizeof(HugeAssString), "{%06x}%s", (colour >>> 8), message);
  3049. return ShowPlayerDialog(playerid, (HOUSEMENU-1), DIALOG_STYLE_MSGBOX, INFORMATION_HEADER, HugeAssString, "Close", "");
  3050. }
  3051. stock DeletePVars(playerid)
  3052. {
  3053. DeletePVar(playerid, "LastHouseCP"), DeletePVar(playerid, "IsInHouse"), DeletePVar(playerid, "FirstSpawn");
  3054. DeletePVar(playerid, "GA_TMP_HOUSESTORAGE"), DeletePVar(playerid, "GA_TMP_NEWHOUSEOWNER"), DeletePVar(playerid, "GA_TMP_HOUSEFORSALEPRICE"), DeletePVar(playerid, "GA_TMP_HOUSENAME");
  3055. DeletePVar(playerid, "JustCreatedHouse"), DeletePVar(playerid, "HousePreview"), DeletePVar(playerid, "HousePrevValue"), DeletePVar(playerid, "HousePrevName");
  3056. DeletePVar(playerid, "HousePrevInt"), DeletePVar(playerid, "HouseIntUpgradeMod"), DeletePVar(playerid, "IsHouseVisiting"), DeletePVar(playerid, "ChangeHouseInt");
  3057. DeletePVar(playerid, "HousePrevTime"), DeletePVar(playerid, "HousePrevTimer"), DeletePVar(playerid, "OldHouseInt"), DeletePVar(playerid, "ClickedHouse");
  3058. DeletePVar(playerid, "ClickedPlayer"), DeletePVar(playerid, "TimeSinceHouseBreakin");
  3059. DeletePVar(playerid, "IsRobbingHouse"), DeletePVar(playerid, "HouseRobberyTime"), DeletePVar(playerid, "HouseRobberyTimer"), DeletePVar(playerid, "TimeSinceHouseRobbery");
  3060. return 1;
  3061. }
  3062. stock fcreate(filename[])
  3063. {
  3064. if(fexist(filename)) return 0;
  3065. new File:file = fopen(filename, io_write);
  3066. fclose(file);
  3067. return 1;
  3068. }
  3069. stock RandomEx(min, max) return (random((max - min)) + min);
  3070. stock ExitHouse(playerid, houseid)
  3071. {
  3072. if(!IsPlayerInHouse(playerid, houseid)) return 1;
  3073. DeletePVar(playerid, "IsInHouse");
  3074. IsInHouse{playerid} = 0;
  3075. SetPlayerPosEx(playerid, hInfo[houseid][SpawnOutX], hInfo[houseid][SpawnOutY], hInfo[houseid][SpawnOutZ], hInfo[houseid][SpawnInterior], hInfo[houseid][SpawnWorld]);
  3076. SetPlayerFacingAngle(playerid, hInfo[houseid][SpawnOutAngle]);
  3077. SetPlayerInterior(playerid, hInfo[houseid][SpawnInterior]);
  3078. SetPlayerVirtualWorld(playerid, hInfo[houseid][SpawnWorld]);
  3079. if(GetPVarInt(playerid, "IsRobbingHouse") == 1)
  3080. {
  3081. ShowInfoBox(playerid, I_HROB_FAILED_HEXIT, hInfo[houseid][HouseName]);
  3082. EndHouseRobbery(playerid);
  3083. SetPVarInt(playerid, "IsRobbingHouse", 0);
  3084. SetPVarInt(playerid, "TimeSinceHouseRobbery", GetTickCount());
  3085. }
  3086. return 1;
  3087. }
  3088. stock udb_hash(buf[]) // By DracoBlue
  3089. {
  3090. new length = strlen(buf), s1 = 1, s2;
  3091. Loop(n, length, 0)
  3092. {
  3093. s1 = (s1 + buf[n]) % 65521, s2 = (s2 + s1) % 65521;
  3094. }
  3095. return (s2 << 16) + s1;
  3096. }
  3097. enum SAZONE_MAIN { SAZONE_NAME[28], Float:SAZONE_AREA[6] }; // By BetaMaster
  3098. static const gSAZones[][SAZONE_MAIN] =
  3099. {
  3100. {"24/7", {-34.23,-186.02,1003.54,-4.24,-169.91,1003.54}},
  3101. {"The Big Ear", {-410.00,1403.30,-3.00,-137.90,1681.20,200.00}},
  3102. {"Aldea Malvada", {-1372.10,2498.50,0.00,-1277.50,2615.30,200.00}},
  3103. {"Angel Pine", {-2324.90,-2584.20,-6.10,-1964.20,-2212.10,200.00}},
  3104. {"Arco del Oeste", {-901.10,2221.80,0.00,-592.00,2571.90,200.00}},
  3105. {"Avispa Country Club", {-2646.40,-355.40,0.00,-2270.00,-222.50,200.00}},
  3106. {"Avispa Country Club", {-2831.80,-430.20,-6.10,-2646.40,-222.50,200.00}},
  3107. {"Avispa Country Club", {-2361.50,-417.10,0.00,-2270.00,-355.40,200.00}},
  3108. {"Avispa Country Club", {-2667.80,-302.10,-28.80,-2646.40,-262.30,71.10}},
  3109. {"Avispa Country Club", {-2470.00,-355.40,0.00,-2270.00,-318.40,46.10}},
  3110. {"Avispa Country Club", {-2550.00,-355.40,0.00,-2470.00,-318.40,39.70}},
  3111. {"Back o' Beyond", {-1166.90,-2641.10,0.00,-321.70,-1856.00,200.00}},
  3112. {"Bar", {487.65,-88.76,998.75,512.06,-67.74,999.25}},
  3113. {"Battery Point", {-2741.00,1268.40,-4.50,-2533.00,1490.40,200.00}},
  3114. {"Bayside", {-2741.00,2175.10,0.00,-2353.10,2722.70,200.00}},
  3115. {"Bayside Marina", {-2353.10,2275.70,0.00,-2153.10,2475.70,200.00}},
  3116. {"Beacon Hill", {-399.60,-1075.50,-1.40,-319.00,-977.50,198.50}},
  3117. {"Blackfield", {964.30,1203.20,-89.00,1197.30,1403.20,110.90}},
  3118. {"Blackfield", {964.30,1403.20,-89.00,1197.30,1726.20,110.90}},
  3119. {"Blackfield Chapel", {1375.60,596.30,-89.00,1558.00,823.20,110.90}},
  3120. {"Blackfield Chapel", {1325.60,596.30,-89.00,1375.60,795.00,110.90}},
  3121. {"Blackfield Intersection", {1197.30,1044.60,-89.00,1277.00,1163.30,110.90}},
  3122. {"Blackfield Intersection", {1166.50,795.00,-89.00,1375.60,1044.60,110.90}},
  3123. {"Blackfield Intersection", {1277.00,1044.60,-89.00,1315.30,1087.60,110.90}},
  3124. {"Blackfield Intersection", {1375.60,823.20,-89.00,1457.30,919.40,110.90}},
  3125. {"Blueberry", {104.50,-220.10,2.30,349.60,152.20,200.00}},
  3126. {"Blueberry", {19.60,-404.10,3.80,349.60,-220.10,200.00}},
  3127. {"Blueberry Acres", {-319.60,-220.10,0.00,104.50,293.30,200.00}},
  3128. {"Caligula's Casino", {2087.30,1543.20,-89.00,2437.30,1703.20,110.90}},
  3129. {"Caligula's Casino", {2137.40,1703.20,-89.00,2437.30,1783.20,110.90}},
  3130. {"Calton Heights", {-2274.10,744.10,-6.10,-1982.30,1358.90,200.00}},
  3131. {"Chinatown", {-2274.10,578.30,-7.60,-2078.60,744.10,200.00}},
  3132. {"City Hall", {-2867.80,277.40,-9.10,-2593.40,458.40,200.00}},
  3133. {"Come-A-Lot", {2087.30,943.20,-89.00,2623.10,1203.20,110.90}},
  3134. {"Commerce", {1323.90,-1842.20,-89.00,1701.90,-1722.20,110.90}},
  3135. {"Commerce", {1323.90,-1722.20,-89.00,1440.90,-1577.50,110.90}},
  3136. {"Commerce", {1370.80,-1577.50,-89.00,1463.90,-1384.90,110.90}},
  3137. {"Commerce", {1463.90,-1577.50,-89.00,1667.90,-1430.80,110.90}},
  3138. {"Commerce", {1583.50,-1722.20,-89.00,1758.90,-1577.50,110.90}},
  3139. {"Commerce", {1667.90,-1577.50,-89.00,1812.60,-1430.80,110.90}},
  3140. {"Conference Center", {1046.10,-1804.20,-89.00,1323.90,-1722.20,110.90}},
  3141. {"Conference Center", {1073.20,-1842.20,-89.00,1323.90,-1804.20,110.90}},
  3142. {"Cranberry Station", {-2007.80,56.30,0.00,-1922.00,224.70,100.00}},
  3143. {"Creek", {2749.90,1937.20,-89.00,2921.60,2669.70,110.90}},
  3144. {"Dillimore", {580.70,-674.80,-9.50,861.00,-404.70,200.00}},
  3145. {"Downtown San Fierro", {-2270.00,-324.10,-0.00,-1794.90,-222.50,200.00}},
  3146. {"Downtown San Fierro", {-2173.00,-222.50,-0.00,-1794.90,265.20,200.00}},
  3147. {"Downtown San Fierro", {-1982.30,744.10,-6.10,-1871.70,1274.20,200.00}},
  3148. {"Downtown San Fierro", {-1871.70,1176.40,-4.50,-1620.30,1274.20,200.00}},
  3149. {"Downtown San Fierro", {-1700.00,744.20,-6.10,-1580.00,1176.50,200.00}},
  3150. {"Downtown San Fierro", {-1580.00,744.20,-6.10,-1499.80,1025.90,200.00}},
  3151. {"Downtown San Fierro", {-2078.60,578.30,-7.60,-1499.80,744.20,200.00}},
  3152. {"Downtown San Fierro", {-1993.20,265.20,-9.10,-1794.90,578.30,200.00}},
  3153. {"Downtown Los Santos", {1463.90,-1430.80,-89.00,1724.70,-1290.80,110.90}},
  3154. {"Downtown Los Santos", {1724.70,-1430.80,-89.00,1812.60,-1250.90,110.90}},
  3155. {"Downtown Los Santos", {1463.90,-1290.80,-89.00,1724.70,-1150.80,110.90}},
  3156. {"Downtown Los Santos", {1370.80,-1384.90,-89.00,1463.90,-1170.80,110.90}},
  3157. {"Downtown Los Santos", {1724.70,-1250.90,-89.00,1812.60,-1150.80,110.90}},
  3158. {"Downtown Los Santos", {1370.80,-1170.80,-89.00,1463.90,-1130.80,110.90}},
  3159. {"Downtown Los Santos", {1378.30,-1130.80,-89.00,1463.90,-1026.30,110.90}},
  3160. {"Downtown Los Santos", {1391.00,-1026.30,-89.00,1463.90,-926.90,110.90}},
  3161. {"Downtown Los Santos", {1507.50,-1385.20,110.90,1582.50,-1325.30,335.90}},
  3162. {"East Beach", {2632.80,-1852.80,-89.00,2959.30,-1668.10,110.90}},
  3163. {"East Beach", {2632.80,-1668.10,-89.00,2747.70,-1393.40,110.90}},
  3164. {"East Beach", {2747.70,-1668.10,-89.00,2959.30,-1498.60,110.90}},
  3165. {"East Beach", {2747.70,-1498.60,-89.00,2959.30,-1120.00,110.90}},
  3166. {"East Los Santos", {2421.00,-1628.50,-89.00,2632.80,-1454.30,110.90}},
  3167. {"East Los Santos", {2222.50,-1628.50,-89.00,2421.00,-1494.00,110.90}},
  3168. {"East Los Santos", {2266.20,-1494.00,-89.00,2381.60,-1372.00,110.90}},
  3169. {"East Los Santos", {2381.60,-1494.00,-89.00,2421.00,-1454.30,110.90}},
  3170. {"East Los Santos", {2281.40,-1372.00,-89.00,2381.60,-1135.00,110.90}},
  3171. {"East Los Santos", {2381.60,-1454.30,-89.00,2462.10,-1135.00,110.90}},
  3172. {"East Los Santos", {2462.10,-1454.30,-89.00,2581.70,-1135.00,110.90}},
  3173. {"Easter Basin", {-1794.90,249.90,-9.10,-1242.90,578.30,200.00}},
  3174. {"Easter Basin", {-1794.90,-50.00,-0.00,-1499.80,249.90,200.00}},
  3175. {"Easter Bay Airport", {-1499.80,-50.00,-0.00,-1242.90,249.90,200.00}},
  3176. {"Easter Bay Airport", {-1794.90,-730.10,-3.00,-1213.90,-50.00,200.00}},
  3177. {"Easter Bay Airport", {-1213.90,-730.10,0.00,-1132.80,-50.00,200.00}},
  3178. {"Easter Bay Airport", {-1242.90,-50.00,0.00,-1213.90,578.30,200.00}},
  3179. {"Easter Bay Airport", {-1213.90,-50.00,-4.50,-947.90,578.30,200.00}},
  3180. {"Easter Bay Airport", {-1315.40,-405.30,15.40,-1264.40,-209.50,25.40}},
  3181. {"Easter Bay Airport", {-1354.30,-287.30,15.40,-1315.40,-209.50,25.40}},
  3182. {"Easter Bay Airport", {-1490.30,-209.50,15.40,-1264.40,-148.30,25.40}},
  3183. {"Easter Bay Chemicals", {-1132.80,-768.00,0.00,-956.40,-578.10,200.00}},
  3184. {"Easter Bay Chemicals", {-1132.80,-787.30,0.00,-956.40,-768.00,200.00}},
  3185. {"El Castillo del Diablo", {-464.50,2217.60,0.00,-208.50,2580.30,200.00}},
  3186. {"El Castillo del Diablo", {-208.50,2123.00,-7.60,114.00,2337.10,200.00}},
  3187. {"El Castillo del Diablo", {-208.50,2337.10,0.00,8.40,2487.10,200.00}},
  3188. {"El Corona", {1812.60,-2179.20,-89.00,1970.60,-1852.80,110.90}},
  3189. {"El Corona", {1692.60,-2179.20,-89.00,1812.60,-1842.20,110.90}},
  3190. {"El Quebrados", {-1645.20,2498.50,0.00,-1372.10,2777.80,200.00}},
  3191. {"Esplanade East", {-1620.30,1176.50,-4.50,-1580.00,1274.20,200.00}},
  3192. {"Esplanade East", {-1580.00,1025.90,-6.10,-1499.80,1274.20,200.00}},
  3193. {"Esplanade East", {-1499.80,578.30,-79.60,-1339.80,1274.20,20.30}},
  3194. {"Esplanade North", {-2533.00,1358.90,-4.50,-1996.60,1501.20,200.00}},
  3195. {"Esplanade North", {-1996.60,1358.90,-4.50,-1524.20,1592.50,200.00}},
  3196. {"Esplanade North", {-1982.30,1274.20,-4.50,-1524.20,1358.90,200.00}},
  3197. {"Fallen Tree", {-792.20,-698.50,-5.30,-452.40,-380.00,200.00}},
  3198. {"Fallow Bridge", {434.30,366.50,0.00,603.00,555.60,200.00}},
  3199. {"Fern Ridge", {508.10,-139.20,0.00,1306.60,119.50,200.00}},
  3200. {"Financial", {-1871.70,744.10,-6.10,-1701.30,1176.40,300.00}},
  3201. {"Fisher's Lagoon", {1916.90,-233.30,-100.00,2131.70,13.80,200.00}},
  3202. {"Flint Intersection", {-187.70,-1596.70,-89.00,17.00,-1276.60,110.90}},
  3203. {"Flint Range", {-594.10,-1648.50,0.00,-187.70,-1276.60,200.00}},
  3204. {"Fort Carson", {-376.20,826.30,-3.00,123.70,1220.40,200.00}},
  3205. {"Foster Valley", {-2270.00,-430.20,-0.00,-2178.60,-324.10,200.00}},
  3206. {"Foster Valley", {-2178.60,-599.80,-0.00,-1794.90,-324.10,200.00}},
  3207. {"Foster Valley", {-2178.60,-1115.50,0.00,-1794.90,-599.80,200.00}},
  3208. {"Foster Valley", {-2178.60,-1250.90,0.00,-1794.90,-1115.50,200.00}},
  3209. {"Frederick Bridge", {2759.20,296.50,0.00,2774.20,594.70,200.00}},
  3210. {"Gant Bridge", {-2741.40,1659.60,-6.10,-2616.40,2175.10,200.00}},
  3211. {"Gant Bridge", {-2741.00,1490.40,-6.10,-2616.40,1659.60,200.00}},
  3212. {"Ganton", {2222.50,-1852.80,-89.00,2632.80,-1722.30,110.90}},
  3213. {"Ganton", {2222.50,-1722.30,-89.00,2632.80,-1628.50,110.90}},
  3214. {"Garcia", {-2411.20,-222.50,-0.00,-2173.00,265.20,200.00}},
  3215. {"Garcia", {-2395.10,-222.50,-5.30,-2354.00,-204.70,200.00}},
  3216. {"Garver Bridge", {-1339.80,828.10,-89.00,-1213.90,1057.00,110.90}},
  3217. {"Garver Bridge", {-1213.90,950.00,-89.00,-1087.90,1178.90,110.90}},
  3218. {"Garver Bridge", {-1499.80,696.40,-179.60,-1339.80,925.30,20.30}},
  3219. {"Glen Park", {1812.60,-1449.60,-89.00,1996.90,-1350.70,110.90}},
  3220. {"Glen Park", {1812.60,-1100.80,-89.00,1994.30,-973.30,110.90}},
  3221. {"Glen Park", {1812.60,-1350.70,-89.00,2056.80,-1100.80,110.90}},
  3222. {"Green Palms", {176.50,1305.40,-3.00,338.60,1520.70,200.00}},
  3223. {"Greenglass College", {964.30,1044.60,-89.00,1197.30,1203.20,110.90}},
  3224. {"Greenglass College", {964.30,930.80,-89.00,1166.50,1044.60,110.90}},
  3225. {"Hampton Barns", {603.00,264.30,0.00,761.90,366.50,200.00}},
  3226. {"Hankypanky Point", {2576.90,62.10,0.00,2759.20,385.50,200.00}},
  3227. {"Harry Gold Parkway", {1777.30,863.20,-89.00,1817.30,2342.80,110.90}},
  3228. {"Hashbury", {-2593.40,-222.50,-0.00,-2411.20,54.70,200.00}},
  3229. {"Hilltop Farm", {967.30,-450.30,-3.00,1176.70,-217.90,200.00}},
  3230. {"Hunter Quarry", {337.20,710.80,-115.20,860.50,1031.70,203.70}},
  3231. {"Idlewood", {1812.60,-1852.80,-89.00,1971.60,-1742.30,110.90}},
  3232. {"Idlewood", {1812.60,-1742.30,-89.00,1951.60,-1602.30,110.90}},
  3233. {"Idlewood", {1951.60,-1742.30,-89.00,2124.60,-1602.30,110.90}},
  3234. {"Idlewood", {1812.60,-1602.30,-89.00,2124.60,-1449.60,110.90}},
  3235. {"Idlewood", {2124.60,-1742.30,-89.00,2222.50,-1494.00,110.90}},
  3236. {"Idlewood", {1971.60,-1852.80,-89.00,2222.50,-1742.30,110.90}},
  3237. {"Jefferson", {1996.90,-1449.60,-89.00,2056.80,-1350.70,110.90}},
  3238. {"Jefferson", {2124.60,-1494.00,-89.00,2266.20,-1449.60,110.90}},
  3239. {"Jefferson", {2056.80,-1372.00,-89.00,2281.40,-1210.70,110.90}},
  3240. {"Jefferson", {2056.80,-1210.70,-89.00,2185.30,-1126.30,110.90}},
  3241. {"Jefferson", {2185.30,-1210.70,-89.00,2281.40,-1154.50,110.90}},
  3242. {"Jefferson", {2056.80,-1449.60,-89.00,2266.20,-1372.00,110.90}},
  3243. {"Julius Thruway East", {2623.10,943.20,-89.00,2749.90,1055.90,110.90}},
  3244. {"Julius Thruway East", {2685.10,1055.90,-89.00,2749.90,2626.50,110.90}},
  3245. {"Julius Thruway East", {2536.40,2442.50,-89.00,2685.10,2542.50,110.90}},
  3246. {"Julius Thruway East", {2625.10,2202.70,-89.00,2685.10,2442.50,110.90}},
  3247. {"Julius Thruway North", {2498.20,2542.50,-89.00,2685.10,2626.50,110.90}},
  3248. {"Julius Thruway North", {2237.40,2542.50,-89.00,2498.20,2663.10,110.90}},
  3249. {"Julius Thruway North", {2121.40,2508.20,-89.00,2237.40,2663.10,110.90}},
  3250. {"Julius Thruway North", {1938.80,2508.20,-89.00,2121.40,2624.20,110.90}},
  3251. {"Julius Thruway North", {1534.50,2433.20,-89.00,1848.40,2583.20,110.90}},
  3252. {"Julius Thruway North", {1848.40,2478.40,-89.00,1938.80,2553.40,110.90}},
  3253. {"Julius Thruway North", {1704.50,2342.80,-89.00,1848.40,2433.20,110.90}},
  3254. {"Julius Thruway North", {1377.30,2433.20,-89.00,1534.50,2507.20,110.90}},
  3255. {"Julius Thruway South", {1457.30,823.20,-89.00,2377.30,863.20,110.90}},
  3256. {"Julius Thruway South", {2377.30,788.80,-89.00,2537.30,897.90,110.90}},
  3257. {"Julius Thruway West", {1197.30,1163.30,-89.00,1236.60,2243.20,110.90}},
  3258. {"Julius Thruway West", {1236.60,2142.80,-89.00,1297.40,2243.20,110.90}},
  3259. {"Juniper Hill", {-2533.00,578.30,-7.60,-2274.10,968.30,200.00}},
  3260. {"Juniper Hollow", {-2533.00,968.30,-6.10,-2274.10,1358.90,200.00}},
  3261. {"K.A.C.C. Military Fuels", {2498.20,2626.50,-89.00,2749.90,2861.50,110.90}},
  3262. {"Kincaid Bridge", {-1339.80,599.20,-89.00,-1213.90,828.10,110.90}},
  3263. {"Kincaid Bridge", {-1213.90,721.10,-89.00,-1087.90,950.00,110.90}},
  3264. {"Kincaid Bridge", {-1087.90,855.30,-89.00,-961.90,986.20,110.90}},
  3265. {"King's", {-2329.30,458.40,-7.60,-1993.20,578.30,200.00}},
  3266. {"King's", {-2411.20,265.20,-9.10,-1993.20,373.50,200.00}},
  3267. {"King's", {-2253.50,373.50,-9.10,-1993.20,458.40,200.00}},
  3268. {"LVA Freight Depot", {1457.30,863.20,-89.00,1777.40,1143.20,110.90}},
  3269. {"LVA Freight Depot", {1375.60,919.40,-89.00,1457.30,1203.20,110.90}},
  3270. {"LVA Freight Depot", {1277.00,1087.60,-89.00,1375.60,1203.20,110.90}},
  3271. {"LVA Freight Depot", {1315.30,1044.60,-89.00,1375.60,1087.60,110.90}},
  3272. {"LVA Freight Depot", {1236.60,1163.40,-89.00,1277.00,1203.20,110.90}},
  3273. {"Las Barrancas", {-926.10,1398.70,-3.00,-719.20,1634.60,200.00}},
  3274. {"Las Brujas", {-365.10,2123.00,-3.00,-208.50,2217.60,200.00}},
  3275. {"Las Colinas", {1994.30,-1100.80,-89.00,2056.80,-920.80,110.90}},
  3276. {"Las Colinas", {2056.80,-1126.30,-89.00,2126.80,-920.80,110.90}},
  3277. {"Las Colinas", {2185.30,-1154.50,-89.00,2281.40,-934.40,110.90}},
  3278. {"Las Colinas", {2126.80,-1126.30,-89.00,2185.30,-934.40,110.90}},
  3279. {"Las Colinas", {2747.70,-1120.00,-89.00,2959.30,-945.00,110.90}},
  3280. {"Las Colinas", {2632.70,-1135.00,-89.00,2747.70,-945.00,110.90}},
  3281. {"Las Colinas", {2281.40,-1135.00,-89.00,2632.70,-945.00,110.90}},
  3282. {"Las Payasadas", {-354.30,2580.30,2.00,-133.60,2816.80,200.00}},
  3283. {"Las Venturas Airport", {1236.60,1203.20,-89.00,1457.30,1883.10,110.90}},
  3284. {"Las Venturas Airport", {1457.30,1203.20,-89.00,1777.30,1883.10,110.90}},
  3285. {"Las Venturas Airport", {1457.30,1143.20,-89.00,1777.40,1203.20,110.90}},
  3286. {"Las Venturas Airport", {1515.80,1586.40,-12.50,1729.90,1714.50,87.50}},
  3287. {"Last Dime Motel", {1823.00,596.30,-89.00,1997.20,823.20,110.90}},
  3288. {"Leafy Hollow", {-1166.90,-1856.00,0.00,-815.60,-1602.00,200.00}},
  3289. {"Liberty City", {-1000.00,400.00,1300.00,-700.00,600.00,1400.00}},
  3290. {"Lil' Probe Inn", {-90.20,1286.80,-3.00,153.80,1554.10,200.00}},
  3291. {"Linden Side", {2749.90,943.20,-89.00,2923.30,1198.90,110.90}},
  3292. {"Linden Station", {2749.90,1198.90,-89.00,2923.30,1548.90,110.90}},
  3293. {"Linden Station", {2811.20,1229.50,-39.50,2861.20,1407.50,60.40}},
  3294. {"Little Mexico", {1701.90,-1842.20,-89.00,1812.60,-1722.20,110.90}},
  3295. {"Little Mexico", {1758.90,-1722.20,-89.00,1812.60,-1577.50,110.90}},
  3296. {"Los Flores", {2581.70,-1454.30,-89.00,2632.80,-1393.40,110.90}},
  3297. {"Los Flores", {2581.70,-1393.40,-89.00,2747.70,-1135.00,110.90}},
  3298. {"Los Santos International", {1249.60,-2394.30,-89.00,1852.00,-2179.20,110.90}},
  3299. {"Los Santos International", {1852.00,-2394.30,-89.00,2089.00,-2179.20,110.90}},
  3300. {"Los Santos International", {1382.70,-2730.80,-89.00,2201.80,-2394.30,110.90}},
  3301. {"Los Santos International", {1974.60,-2394.30,-39.00,2089.00,-2256.50,60.90}},
  3302. {"Los Santos International", {1400.90,-2669.20,-39.00,2189.80,-2597.20,60.90}},
  3303. {"Los Santos International", {2051.60,-2597.20,-39.00,2152.40,-2394.30,60.90}},
  3304. {"Marina", {647.70,-1804.20,-89.00,851.40,-1577.50,110.90}},
  3305. {"Marina", {647.70,-1577.50,-89.00,807.90,-1416.20,110.90}},
  3306. {"Marina", {807.90,-1577.50,-89.00,926.90,-1416.20,110.90}},
  3307. {"Market", {787.40,-1416.20,-89.00,1072.60,-1310.20,110.90}},
  3308. {"Market", {952.60,-1310.20,-89.00,1072.60,-1130.80,110.90}},
  3309. {"Market", {1072.60,-1416.20,-89.00,1370.80,-1130.80,110.90}},
  3310. {"Market", {926.90,-1577.50,-89.00,1370.80,-1416.20,110.90}},
  3311. {"Market Station", {787.40,-1410.90,-34.10,866.00,-1310.20,65.80}},
  3312. {"Martin Bridge", {-222.10,293.30,0.00,-122.10,476.40,200.00}},
  3313. {"Missionary Hill", {-2994.40,-811.20,0.00,-2178.60,-430.20,200.00}},
  3314. {"Montgomery", {1119.50,119.50,-3.00,1451.40,493.30,200.00}},
  3315. {"Montgomery", {1451.40,347.40,-6.10,1582.40,420.80,200.00}},
  3316. {"Montgomery Intersection", {1546.60,208.10,0.00,1745.80,347.40,200.00}},
  3317. {"Montgomery Intersection", {1582.40,347.40,0.00,1664.60,401.70,200.00}},
  3318. {"Mulholland", {1414.00,-768.00,-89.00,1667.60,-452.40,110.90}},
  3319. {"Mulholland", {1281.10,-452.40,-89.00,1641.10,-290.90,110.90}},
  3320. {"Mulholland", {1269.10,-768.00,-89.00,1414.00,-452.40,110.90}},
  3321. {"Mulholland", {1357.00,-926.90,-89.00,1463.90,-768.00,110.90}},
  3322. {"Mulholland", {1318.10,-910.10,-89.00,1357.00,-768.00,110.90}},
  3323. {"Mulholland", {1169.10,-910.10,-89.00,1318.10,-768.00,110.90}},
  3324. {"Mulholland", {768.60,-954.60,-89.00,952.60,-860.60,110.90}},
  3325. {"Mulholland", {687.80,-860.60,-89.00,911.80,-768.00,110.90}},
  3326. {"Mulholland", {737.50,-768.00,-89.00,1142.20,-674.80,110.90}},
  3327. {"Mulholland", {1096.40,-910.10,-89.00,1169.10,-768.00,110.90}},
  3328. {"Mulholland", {952.60,-937.10,-89.00,1096.40,-860.60,110.90}},
  3329. {"Mulholland", {911.80,-860.60,-89.00,1096.40,-768.00,110.90}},
  3330. {"Mulholland", {861.00,-674.80,-89.00,1156.50,-600.80,110.90}},
  3331. {"Mulholland Intersection", {1463.90,-1150.80,-89.00,1812.60,-768.00,110.90}},
  3332. {"North Rock", {2285.30,-768.00,0.00,2770.50,-269.70,200.00}},
  3333. {"Ocean Docks", {2373.70,-2697.00,-89.00,2809.20,-2330.40,110.90}},
  3334. {"Ocean Docks", {2201.80,-2418.30,-89.00,2324.00,-2095.00,110.90}},
  3335. {"Ocean Docks", {2324.00,-2302.30,-89.00,2703.50,-2145.10,110.90}},
  3336. {"Ocean Docks", {2089.00,-2394.30,-89.00,2201.80,-2235.80,110.90}},
  3337. {"Ocean Docks", {2201.80,-2730.80,-89.00,2324.00,-2418.30,110.90}},
  3338. {"Ocean Docks", {2703.50,-2302.30,-89.00,2959.30,-2126.90,110.90}},
  3339. {"Ocean Docks", {2324.00,-2145.10,-89.00,2703.50,-2059.20,110.90}},
  3340. {"Ocean Flats", {-2994.40,277.40,-9.10,-2867.80,458.40,200.00}},
  3341. {"Ocean Flats", {-2994.40,-222.50,-0.00,-2593.40,277.40,200.00}},
  3342. {"Ocean Flats", {-2994.40,-430.20,-0.00,-2831.80,-222.50,200.00}},
  3343. {"Octane Springs", {338.60,1228.50,0.00,664.30,1655.00,200.00}},
  3344. {"Old Venturas Strip", {2162.30,2012.10,-89.00,2685.10,2202.70,110.90}},
  3345. {"Palisades", {-2994.40,458.40,-6.10,-2741.00,1339.60,200.00}},
  3346. {"Palomino Creek", {2160.20,-149.00,0.00,2576.90,228.30,200.00}},
  3347. {"Paradiso", {-2741.00,793.40,-6.10,-2533.00,1268.40,200.00}},
  3348. {"Pershing Square", {1440.90,-1722.20,-89.00,1583.50,-1577.50,110.90}},
  3349. {"Pilgrim", {2437.30,1383.20,-89.00,2624.40,1783.20,110.90}},
  3350. {"Pilgrim", {2624.40,1383.20,-89.00,2685.10,1783.20,110.90}},
  3351. {"Pilson Intersection", {1098.30,2243.20,-89.00,1377.30,2507.20,110.90}},
  3352. {"Pirates in Men's Pants", {1817.30,1469.20,-89.00,2027.40,1703.20,110.90}},
  3353. {"Playa del Seville", {2703.50,-2126.90,-89.00,2959.30,-1852.80,110.90}},
  3354. {"Prickle Pine", {1534.50,2583.20,-89.00,1848.40,2863.20,110.90}},
  3355. {"Prickle Pine", {1117.40,2507.20,-89.00,1534.50,2723.20,110.90}},
  3356. {"Prickle Pine", {1848.40,2553.40,-89.00,1938.80,2863.20,110.90}},
  3357. {"Prickle Pine", {1938.80,2624.20,-89.00,2121.40,2861.50,110.90}},
  3358. {"Queens", {-2533.00,458.40,0.00,-2329.30,578.30,200.00}},
  3359. {"Queens", {-2593.40,54.70,0.00,-2411.20,458.40,200.00}},
  3360. {"Queens", {-2411.20,373.50,0.00,-2253.50,458.40,200.00}},
  3361. {"Randolph Industrial Estate", {1558.00,596.30,-89.00,1823.00,823.20,110.90}},
  3362. {"Redsands East", {1817.30,2011.80,-89.00,2106.70,2202.70,110.90}},
  3363. {"Redsands East", {1817.30,2202.70,-89.00,2011.90,2342.80,110.90}},
  3364. {"Redsands East", {1848.40,2342.80,-89.00,2011.90,2478.40,110.90}},
  3365. {"Redsands West", {1236.60,1883.10,-89.00,1777.30,2142.80,110.90}},
  3366. {"Redsands West", {1297.40,2142.80,-89.00,1777.30,2243.20,110.90}},
  3367. {"Redsands West", {1377.30,2243.20,-89.00,1704.50,2433.20,110.90}},
  3368. {"Redsands West", {1704.50,2243.20,-89.00,1777.30,2342.80,110.90}},
  3369. {"Regular Tom", {-405.70,1712.80,-3.00,-276.70,1892.70,200.00}},
  3370. {"Restraunt", {-229.07,1393.80,28.35,-222.40,1412.19,27.77}},
  3371. {"Restraunt", {-221.54,1401.45,27.77,-217.49,1407.54,28.41}},
  3372. {"Richman", {647.50,-1118.20,-89.00,787.40,-954.60,110.90}},
  3373. {"Richman", {647.50,-954.60,-89.00,768.60,-860.60,110.90}},
  3374. {"Richman", {225.10,-1369.60,-89.00,334.50,-1292.00,110.90}},
  3375. {"Richman", {225.10,-1292.00,-89.00,466.20,-1235.00,110.90}},
  3376. {"Richman", {72.60,-1404.90,-89.00,225.10,-1235.00,110.90}},
  3377. {"Richman", {72.60,-1235.00,-89.00,321.30,-1008.10,110.90}},
  3378. {"Richman", {321.30,-1235.00,-89.00,647.50,-1044.00,110.90}},
  3379. {"Richman", {321.30,-1044.00,-89.00,647.50,-860.60,110.90}},
  3380. {"Richman", {321.30,-860.60,-89.00,687.80,-768.00,110.90}},
  3381. {"Richman", {321.30,-768.00,-89.00,700.70,-674.80,110.90}},
  3382. {"Robada Intersection", {-1119.00,1178.90,-89.00,-862.00,1351.40,110.90}},
  3383. {"Roca Escalante", {2237.40,2202.70,-89.00,2536.40,2542.50,110.90}},
  3384. {"Roca Escalante", {2536.40,2202.70,-89.00,2625.10,2442.50,110.90}},
  3385. {"Rockshore East", {2537.30,676.50,-89.00,2902.30,943.20,110.90}},
  3386. {"Rockshore West", {1997.20,596.30,-89.00,2377.30,823.20,110.90}},
  3387. {"Rockshore West", {2377.30,596.30,-89.00,2537.30,788.80,110.90}},
  3388. {"Rodeo", {72.60,-1684.60,-89.00,225.10,-1544.10,110.90}},
  3389. {"Rodeo", {72.60,-1544.10,-89.00,225.10,-1404.90,110.90}},
  3390. {"Rodeo", {225.10,-1684.60,-89.00,312.80,-1501.90,110.90}},
  3391. {"Rodeo", {225.10,-1501.90,-89.00,334.50,-1369.60,110.90}},
  3392. {"Rodeo", {334.50,-1501.90,-89.00,422.60,-1406.00,110.90}},
  3393. {"Rodeo", {312.80,-1684.60,-89.00,422.60,-1501.90,110.90}},
  3394. {"Rodeo", {422.60,-1684.60,-89.00,558.00,-1570.20,110.90}},
  3395. {"Rodeo", {558.00,-1684.60,-89.00,647.50,-1384.90,110.90}},
  3396. {"Rodeo", {466.20,-1570.20,-89.00,558.00,-1385.00,110.90}},
  3397. {"Rodeo", {422.60,-1570.20,-89.00,466.20,-1406.00,110.90}},
  3398. {"Rodeo", {466.20,-1385.00,-89.00,647.50,-1235.00,110.90}},
  3399. {"Rodeo", {334.50,-1406.00,-89.00,466.20,-1292.00,110.90}},
  3400. {"Royal Casino", {2087.30,1383.20,-89.00,2437.30,1543.20,110.90}},
  3401. {"San Andreas Sound", {2450.30,385.50,-100.00,2759.20,562.30,200.00}},
  3402. {"Santa Flora", {-2741.00,458.40,-7.60,-2533.00,793.40,200.00}},
  3403. {"Santa Maria Beach", {342.60,-2173.20,-89.00,647.70,-1684.60,110.90}},
  3404. {"Santa Maria Beach", {72.60,-2173.20,-89.00,342.60,-1684.60,110.90}},
  3405. {"Shady Cabin", {-1632.80,-2263.40,-3.00,-1601.30,-2231.70,200.00}},
  3406. {"Shady Creeks", {-1820.60,-2643.60,-8.00,-1226.70,-1771.60,200.00}},
  3407. {"Shady Creeks", {-2030.10,-2174.80,-6.10,-1820.60,-1771.60,200.00}},
  3408. {"Sobell Rail Yards", {2749.90,1548.90,-89.00,2923.30,1937.20,110.90}},
  3409. {"Spinybed", {2121.40,2663.10,-89.00,2498.20,2861.50,110.90}},
  3410. {"Starfish Casino", {2437.30,1783.20,-89.00,2685.10,2012.10,110.90}},
  3411. {"Starfish Casino", {2437.30,1858.10,-39.00,2495.00,1970.80,60.90}},
  3412. {"Starfish Casino", {2162.30,1883.20,-89.00,2437.30,2012.10,110.90}},
  3413. {"Temple", {1252.30,-1130.80,-89.00,1378.30,-1026.30,110.90}},
  3414. {"Temple", {1252.30,-1026.30,-89.00,1391.00,-926.90,110.90}},
  3415. {"Temple", {1252.30,-926.90,-89.00,1357.00,-910.10,110.90}},
  3416. {"Temple", {952.60,-1130.80,-89.00,1096.40,-937.10,110.90}},
  3417. {"Temple", {1096.40,-1130.80,-89.00,1252.30,-1026.30,110.90}},
  3418. {"Temple", {1096.40,-1026.30,-89.00,1252.30,-910.10,110.90}},
  3419. {"The Camel's Toe", {2087.30,1203.20,-89.00,2640.40,1383.20,110.90}},
  3420. {"The Clown's Pocket", {2162.30,1783.20,-89.00,2437.30,1883.20,110.90}},
  3421. {"The Emerald Isle", {2011.90,2202.70,-89.00,2237.40,2508.20,110.90}},
  3422. {"The Farm", {-1209.60,-1317.10,114.90,-908.10,-787.30,251.90}},
  3423. {"The Four Dragons Casino", {1817.30,863.20,-89.00,2027.30,1083.20,110.90}},
  3424. {"The High Roller", {1817.30,1283.20,-89.00,2027.30,1469.20,110.90}},
  3425. {"The Mako Span", {1664.60,401.70,0.00,1785.10,567.20,200.00}},
  3426. {"The Panopticon", {-947.90,-304.30,-1.10,-319.60,327.00,200.00}},
  3427. {"The Pink Swan", {1817.30,1083.20,-89.00,2027.30,1283.20,110.90}},
  3428. {"The Sherman Dam", {-968.70,1929.40,-3.00,-481.10,2155.20,200.00}},
  3429. {"The Strip", {2027.40,863.20,-89.00,2087.30,1703.20,110.90}},
  3430. {"The Strip", {2106.70,1863.20,-89.00,2162.30,2202.70,110.90}},
  3431. {"The Strip", {2027.40,1783.20,-89.00,2162.30,1863.20,110.90}},
  3432. {"The Strip", {2027.40,1703.20,-89.00,2137.40,1783.20,110.90}},
  3433. {"The Visage", {1817.30,1863.20,-89.00,2106.70,2011.80,110.90}},
  3434. {"The Visage", {1817.30,1703.20,-89.00,2027.40,1863.20,110.90}},
  3435. {"Unity Station", {1692.60,-1971.80,-20.40,1812.60,-1932.80,79.50}},
  3436. {"Valle Ocultado", {-936.60,2611.40,2.00,-715.90,2847.90,200.00}},
  3437. {"Verdant Bluffs", {930.20,-2488.40,-89.00,1249.60,-2006.70,110.90}},
  3438. {"Verdant Bluffs", {1073.20,-2006.70,-89.00,1249.60,-1842.20,110.90}},
  3439. {"Verdant Bluffs", {1249.60,-2179.20,-89.00,1692.60,-1842.20,110.90}},
  3440. {"Verdant Meadows", {37.00,2337.10,-3.00,435.90,2677.90,200.00}},
  3441. {"Verona Beach", {647.70,-2173.20,-89.00,930.20,-1804.20,110.90}},
  3442. {"Verona Beach", {930.20,-2006.70,-89.00,1073.20,-1804.20,110.90}},
  3443. {"Verona Beach", {851.40,-1804.20,-89.00,1046.10,-1577.50,110.90}},
  3444. {"Verona Beach", {1161.50,-1722.20,-89.00,1323.90,-1577.50,110.90}},
  3445. {"Verona Beach", {1046.10,-1722.20,-89.00,1161.50,-1577.50,110.90}},
  3446. {"Vinewood", {787.40,-1310.20,-89.00,952.60,-1130.80,110.90}},
  3447. {"Vinewood", {787.40,-1130.80,-89.00,952.60,-954.60,110.90}},
  3448. {"Vinewood", {647.50,-1227.20,-89.00,787.40,-1118.20,110.90}},
  3449. {"Vinewood", {647.70,-1416.20,-89.00,787.40,-1227.20,110.90}},
  3450. {"Whitewood Estates", {883.30,1726.20,-89.00,1098.30,2507.20,110.90}},
  3451. {"Whitewood Estates", {1098.30,1726.20,-89.00,1197.30,2243.20,110.90}},
  3452. {"Willowfield", {1970.60,-2179.20,-89.00,2089.00,-1852.80,110.90}},
  3453. {"Willowfield", {2089.00,-2235.80,-89.00,2201.80,-1989.90,110.90}},
  3454. {"Willowfield", {2089.00,-1989.90,-89.00,2324.00,-1852.80,110.90}},
  3455. {"Willowfield", {2201.80,-2095.00,-89.00,2324.00,-1989.90,110.90}},
  3456. {"Willowfield", {2541.70,-1941.40,-89.00,2703.50,-1852.80,110.90}},
  3457. {"Willowfield", {2324.00,-2059.20,-89.00,2541.70,-1852.80,110.90}},
  3458. {"Willowfield", {2541.70,-2059.20,-89.00,2703.50,-1941.40,110.90}},
  3459. {"Yellow Bell Station", {1377.40,2600.40,-21.90,1492.40,2687.30,78.00}},
  3460. // Main Zones
  3461. {"Los Santos", {44.60,-2892.90,-242.90,2997.00,-768.00,900.00}},
  3462. {"Las Venturas", {869.40,596.30,-242.90,2997.00,2993.80,900.00}},
  3463. {"Bone County", {-480.50,596.30,-242.90,869.40,2993.80,900.00}},
  3464. {"Tierra Robada", {-2997.40,1659.60,-242.90,-480.50,2993.80,900.00}},
  3465. {"Tierra Robada", {-1213.90,596.30,-242.90,-480.50,1659.60,900.00}},
  3466. {"San Fierro", {-2997.40,-1115.50,-242.90,-1213.90,1659.60,900.00}},
  3467. {"Red County", {-1213.90,-768.00,-242.90,2997.00,596.30,900.00}},
  3468. {"Flint County", {-1213.90,-2892.90,-242.90,44.60,-768.00,900.00}},
  3469. {"San Andreas", {4601.083, -2989.536, -242.90, 2989.536, -3666.853, 1500.00}},
  3470. {"Mount Chilliad", {-2997.40,-2892.90,-242.90,-1213.90,-1115.50,900.00}}
  3471. };
  3472. stock GetHouseLocation(houseid) // By [03]Garsino
  3473. {
  3474. new zone[MAX_ZONE_NAME];
  3475. format(zone, MAX_ZONE_NAME, "Unknown");
  3476. new size = sizeof(gSAZones);
  3477. Loop(i, size, 0)
  3478. {
  3479. if(hInfo[houseid][CPOutX] >= gSAZones[i][SAZONE_AREA][0] && hInfo[houseid][CPOutX] <= gSAZones[i][SAZONE_AREA][3] && hInfo[houseid][CPOutY] >= gSAZones[i][SAZONE_AREA][1] && hInfo[houseid][CPOutY] <= gSAZones[i][SAZONE_AREA][4])
  3480. {
  3481. format(zone, MAX_ZONE_NAME, "%s", gSAZones[i][SAZONE_NAME]);
  3482. return zone;
  3483. }
  3484. }
  3485. return zone;
  3486. }
  3487. stock HouseFile(houseid)
  3488. {
  3489. new filename[HOUSEFILE_LENGTH];
  3490. format(filename, sizeof(filename), FILEPATH, houseid);
  3491. return filename;
  3492. }
  3493. stock EndHouseRobbery(playerid)
  3494. {
  3495. new timer_state = GetPVarInt(playerid, "HouseRobberyTimer");
  3496. if(timer_state != -1)
  3497. {
  3498. KillTimer(timer_state);
  3499. SetPVarInt(playerid, "HouseRobberyTimer", -1);
  3500. }
  3501. return 1;
  3502. }
  3503. stock SecurityDog_Bite(playerid, houseid, type, failed = 0)
  3504. {
  3505. if(hInfo[houseid][HouseDog] == 0) return 1;
  3506. new Float:health;
  3507. GetPlayerHealth(playerid, health);
  3508. ApplyAnimation(playerid, "CRACK", "crckdeth2", 4.0, 1, 0, 0, 0, 0);
  3509. if((health - (SECURITYDOG_HEALTHLOSS * SECURITYDOG_BITS)) <= 0.00)
  3510. {
  3511. SetPlayerHealth(playerid, 0.00);
  3512. switch(type)
  3513. {
  3514. case 0: ShowInfoBoxEx(playerid, COLOUR_SYSTEM, HBREAKIN_FAILED1);
  3515. case 1: ShowInfoBoxEx(playerid, COLOUR_SYSTEM, HROB_FAILED1);
  3516. }
  3517. }
  3518. else
  3519. {
  3520. SetPlayerHealth(playerid, (health - (SECURITYDOG_HEALTHLOSS * SECURITYDOG_BITS)));
  3521. if(failed == 1)
  3522. {
  3523. switch(type)
  3524. {
  3525. case 0: ShowInfoBoxEx(playerid, COLOUR_SYSTEM, HBREAKIN_FAILED2);
  3526. case 1: ShowInfoBoxEx(playerid, COLOUR_SYSTEM, HROB_FAILED2);
  3527. }
  3528. }
  3529. }
  3530. SetTimerEx("SecurityDog_ClearAnimations", 4000, false, "i", playerid);
  3531. return 1;
  3532. }
  3533. // © [03]Garsino - Keep The Credits!
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement