Guest User

garhouse

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