muhammadj

Dodhouse

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