Advertisement
Guest User

Untitled

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