core.inc 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546
  1. #include <YSI_Coding\y_hooks>
  2. forward OnPropertyCreated(propertyid);
  3. forward OnPropertyDeleted(propertyid);
  4. #define INVALID_PROPERTY_ID -1
  5. #define MAX_PROP_DESCRIPTION 129
  6. #define MAX_PROP_ADDRESS 37
  7. // Blank pickup model 19300
  8. #define PROP_PICKUP 19524
  9. #define PROP_PICKUP_DISTANCE 20.00
  10. #define TYPE_HOUSE 10
  11. #define TYPE_BIZ_STORE 20
  12. #define TYPE_BIZ_CLOTHING 21
  13. #define TYPE_BIZ_BAR 22
  14. #define TYPE_BIZ_CASINO 23
  15. #define TYPE_BIZ_FURNITURE 24
  16. #define TYPE_BIZ_RESTAURANT 25
  17. #define TYPE_ENT_NONE 40
  18. #define TYPE_ENT_POLICE 41
  19. static PropOwnerSQLID[MAX_PROPERTIES];
  20. static PropType[MAX_PROPERTIES];
  21. static PropDescription[MAX_PROPERTIES][MAX_PROP_DESCRIPTION];
  22. static PropAddress[MAX_PROPERTIES][MAX_PROP_ADDRESS];
  23. static PropPrice[MAX_PROPERTIES];
  24. static PropPickup[MAX_PROPERTIES];
  25. static PropOutsideInt[MAX_PROPERTIES];
  26. static PropInsideInt[MAX_PROPERTIES];
  27. static PropOutsideVW[MAX_PROPERTIES];
  28. static Float:PropExtPosX[MAX_PROPERTIES];
  29. static Float:PropExtPosY[MAX_PROPERTIES];
  30. static Float:PropExtPosZ[MAX_PROPERTIES];
  31. static Float:PropExtPosA[MAX_PROPERTIES];
  32. static Float:PropIntPosX[MAX_PROPERTIES];
  33. static Float:PropIntPosY[MAX_PROPERTIES];
  34. static Float:PropIntPosZ[MAX_PROPERTIES];
  35. static Float:PropIntPosA[MAX_PROPERTIES];
  36. new Iterator:Property<MAX_PROPERTIES>;
  37. new Iterator:House<MAX_PROPERTIES>;
  38. new Iterator:Business<MAX_PROPERTIES>;
  39. new Iterator:Entrance<MAX_PROPERTIES>;
  40. hook OnMySQLConnected()
  41. {
  42. inline const OnPropertyFound()
  43. {
  44. for(new i; i < cache_num_rows(); i++)
  45. {
  46. if(Iter_Free(Property) == INVALID_ITERATOR_SLOT)
  47. {
  48. printf("The maximum amount of properties has been reached. (%d)", Iter_Count(Property));
  49. break;
  50. }
  51. new propertyid = INVALID_ITERATOR_SLOT;
  52. cache_get_value_name_int(i, "id", propertyid);
  53. cache_get_value_name_int(i, "owner_id", PropOwnerSQLID[propertyid]);
  54. cache_get_value_name_int(i, "type", PropType[propertyid]);
  55. cache_get_value_name(i, "description", PropDescription[propertyid]);
  56. cache_get_value_name(i, "address", PropAddress[propertyid]);
  57. cache_get_value_name_int(i, "price", PropPrice[propertyid]);
  58. cache_get_value_name_int(i, "outside_int", PropOutsideInt[propertyid]);
  59. cache_get_value_name_int(i, "inside_int", PropInsideInt[propertyid]);
  60. cache_get_value_name_int(i, "outside_vw", PropOutsideVW[propertyid]);
  61. cache_get_value_name_float(i, "ext_pos_x", PropExtPosX[propertyid]);
  62. cache_get_value_name_float(i, "ext_pos_y", PropExtPosY[propertyid]);
  63. cache_get_value_name_float(i, "ext_pos_z", PropExtPosZ[propertyid]);
  64. cache_get_value_name_float(i, "ext_pos_a", PropExtPosA[propertyid]);
  65. cache_get_value_name_float(i, "int_pos_x", PropIntPosX[propertyid]);
  66. cache_get_value_name_float(i, "int_pos_y", PropIntPosY[propertyid]);
  67. cache_get_value_name_float(i, "int_pos_z", PropIntPosZ[propertyid]);
  68. cache_get_value_name_float(i, "int_pos_a", PropIntPosA[propertyid]);
  69. PropPickup[propertyid] = CreateDynamicPickup(PROP_PICKUP, 1, PropExtPosX[propertyid], PropExtPosY[propertyid], PropExtPosZ[propertyid], PropOutsideVW[propertyid], PropOutsideInt[propertyid]);
  70. switch(PropType[propertyid])
  71. {
  72. case 10..19: Iter_Add(House, propertyid);
  73. case 20..39: Iter_Add(Business, propertyid);
  74. case 40..60: Iter_Add(Entrance, propertyid);
  75. }
  76. Iter_Add(Property, propertyid);
  77. }
  78. }
  79. MySQL_TQueryInline(MySQL_GetHandle(), using inline OnPropertyFound, "SELECT * FROM properties");
  80. }
  81. CMD:createproperty(playerid, params[])
  82. {
  83. if(Iter_Free(Property) == INVALID_ITERATOR_SLOT) return SendErrorMessage(playerid, "The maximum amount of properties has been reached.");
  84. if(isnull(params)) return SendSyntaxMessage(playerid, "/createproperty (options: house, business, entrance)");
  85. new address[MAX_PROP_ADDRESS];
  86. new description[MAX_PROP_DESCRIPTION];
  87. new zoneName[MAX_MAP_ZONE_NAME];
  88. new price;
  89. new interiorid;
  90. new type = TYPE_HOUSE;
  91. new propertyid = Iter_Free(Property);
  92. new outsideInt = GetPlayerInterior(playerid);
  93. new outsideVW = GetPlayerVirtualWorld(playerid);
  94. new MapZone:zone = GetPlayerMapZone(playerid);
  95. new Float:eX, Float:eY, Float:eZ, Float:eA;
  96. GetPlayerPos(playerid, eX, eY, eZ);
  97. GetPlayerFacingAngle(playerid, eA);
  98. GetMapZoneName(zone, zoneName);
  99. if(!strcmp(params, "house", true, 5))
  100. {
  101. if(sscanf(params, "{s[6]}ii", interiorid, price)) return SendSyntaxMessage(playerid, "/createproperty house (interior) (price)");
  102. format(address, sizeof(address), "%d, %s, Los Santos", propertyid + 1000, zoneName);
  103. format(description, sizeof(description), "House");
  104. }
  105. else if(!strcmp(params, "business", true, 8))
  106. {
  107. if(sscanf(params, "{s[9]}iii", type, interiorid, price))
  108. {
  109. SendSyntaxMessage(playerid, "/createproperty business (type) (interior) (price)");
  110. return va_SendClientMessage(playerid, 0xc2a3a3ff, "Types: %d (Store) | %d (Clothing) | %d (Bar) | %d (Casino) | %d (Furniture) | %d (Restaurant)",
  111. TYPE_BIZ_STORE, TYPE_BIZ_CLOTHING, TYPE_BIZ_BAR, TYPE_BIZ_CASINO, TYPE_BIZ_FURNITURE, TYPE_BIZ_RESTAURANT);
  112. }
  113. if(!IsBusinessTypeValid(type))
  114. {
  115. SendErrorMessage(playerid, "That business type is not valid.");
  116. return va_SendClientMessage(playerid, 0xc2a3a3ff, "Types: %d (Store) | %d (Clothing) | %d (Bar) | %d (Casino) | %d (Furniture) | %d (Restaurant)",
  117. TYPE_BIZ_STORE, TYPE_BIZ_CLOTHING, TYPE_BIZ_BAR, TYPE_BIZ_CASINO, TYPE_BIZ_FURNITURE, TYPE_BIZ_RESTAURANT);
  118. }
  119. format(address, sizeof(address), "%s, Los Santos", zoneName);
  120. format(description, sizeof(description), "Business");
  121. }
  122. else if(!strcmp(params, "entrance", true, 8))
  123. {
  124. if(sscanf(params, "{s[9]}iis[128]", type, interiorid, description))
  125. {
  126. SendSyntaxMessage(playerid, "/createproperty entrance (type) (interior) (description)");
  127. return va_SendClientMessage(playerid, 0xc2a3a3ff, "Types: %d (None) | %d (Police)", TYPE_ENT_NONE, TYPE_ENT_POLICE);
  128. }
  129. if(!IsEntranceTypeValid(type))
  130. {
  131. SendErrorMessage(playerid, "That entrance type is not valid.");
  132. return va_SendClientMessage(playerid, 0xc2a3a3ff, "Types: %d (None) | %d (Police)", TYPE_ENT_NONE, TYPE_ENT_POLICE);
  133. }
  134. if(strlen(description) > MAX_PROP_DESCRIPTION - 1)
  135. return SendErrorMessageF(playerid, "Invalid description length, it must be below %d characters.", MAX_PROP_DESCRIPTION - 1);
  136. format(address, sizeof(address), "%s, Los Santos", zoneName);
  137. }
  138. else return SendSyntaxMessage(playerid, "/createproperty (options: house, business, entrance)");
  139. if(!IsValidInterior(interiorid))
  140. return SendErrorMessage(playerid, "You specified an invalid interior ID.");
  141. if(price < 0)
  142. return SendErrorMessage(playerid, "Please enter a valid price.");
  143. new Float:iX, Float:iY, Float:iZ, Float:iA;
  144. new insideInt = Interior_GetInterior(interiorid);
  145. Interior_GetPosition(interiorid, iX, iY, iZ, iA);
  146. PropType[propertyid] = type;
  147. PropDescription[propertyid] = description;
  148. PropAddress[propertyid] = address;
  149. PropPrice[propertyid] = price;
  150. PropOutsideInt[propertyid] = outsideInt;
  151. PropInsideInt[propertyid] = insideInt;
  152. PropOutsideVW[propertyid] = outsideVW;
  153. PropExtPosX[propertyid] = eX;
  154. PropExtPosY[propertyid] = eY;
  155. PropExtPosZ[propertyid] = eZ;
  156. PropExtPosA[propertyid] = eA;
  157. PropIntPosX[propertyid] = iX;
  158. PropIntPosY[propertyid] = iY;
  159. PropIntPosZ[propertyid] = iZ;
  160. PropIntPosA[propertyid] = iA;
  161. PropPickup[propertyid] = CreateDynamicPickup(PROP_PICKUP, 1, PropExtPosX[propertyid], PropExtPosY[propertyid], PropExtPosZ[propertyid], PropOutsideVW[propertyid], PropOutsideInt[propertyid]);
  162. new query[582];
  163. mysql_format(MySQL_GetHandle(), query, sizeof(query), "INSERT INTO properties (id, type, description, address, price, outside_int, inside_int, outside_vw, ext_pos_x, ext_pos_y, ext_pos_z, ext_pos_a, int_pos_x, int_pos_y, int_pos_z, int_pos_a) VALUES (%d, %d, '%e', '%e', %d, %d, %d, %d, %f, %f, %f, %f, %f, %f, %f, %f)", propertyid, type, description, address, price, outsideInt, insideInt, outsideVW, eX, eY, eZ, eA, iX, iY, iZ, iA);
  164. mysql_tquery(MySQL_GetHandle(), query);
  165. switch(PropType[propertyid])
  166. {
  167. case 10..19: Iter_Add(House, propertyid);
  168. case 20..39: Iter_Add(Business, propertyid);
  169. case 40..60: Iter_Add(Entrance, propertyid);
  170. }
  171. Iter_Add(Property, propertyid);
  172. CallRemoteFunction("OnPropertyCreated", "i", propertyid);
  173. SendAdminWarningF(playerid, "You have created a property. ID: %d, Type: %d - %s, Price: $%s, Description: %s", propertyid, type, Property_GetTypeName(type), MoneyFormat(price), description);
  174. return 1;
  175. }
  176. CMD:deleteproperty(playerid, params[])
  177. {
  178. new propertyid = INVALID_PROPERTY_ID;
  179. if(isnull(params))
  180. {
  181. propertyid = GetCurrentProperty(playerid);
  182. if(propertyid == INVALID_PROPERTY_ID)
  183. {
  184. propertyid = GetNearbyProperty(playerid);
  185. if(propertyid == INVALID_PROPERTY_ID)
  186. return SendErrorMessage(playerid, "You need to be at one of the properties to delete it. (or type /deleteproperty id)");
  187. }
  188. }
  189. else
  190. {
  191. if(sscanf(params, "i", propertyid)) return SendSyntaxMessage(playerid, "/deleteproperty (id)");
  192. if(!IsValidProperty(propertyid)) return SendErrorMessage(playerid, "You specified an invalid property.");
  193. }
  194. foreach(new i : Player) if(GetCurrentProperty(i) == propertyid)
  195. {
  196. SendAdminWarning(i, "This property has been deleted.");
  197. SetPlayerPos(i, PropExtPosX[propertyid], PropExtPosY[propertyid], PropExtPosZ[propertyid]);
  198. SetPlayerFacingAngle(i, PropExtPosA[propertyid]);
  199. SetPlayerInterior(i, PropOutsideInt[propertyid]);
  200. SetPlayerVirtualWorld(i, PropOutsideVW[propertyid]);
  201. SetCameraBehindPlayer(i);
  202. }
  203. DestroyDynamicPickup(PropPickup[propertyid]);
  204. new query[78];
  205. mysql_format(MySQL_GetHandle(), query, sizeof(query), "DELETE FROM properties WHERE id = %d", propertyid);
  206. mysql_tquery(MySQL_GetHandle(), query);
  207. Iter_Remove(House, propertyid);
  208. Iter_Remove(Business, propertyid);
  209. Iter_Remove(Entrance, propertyid);
  210. Iter_Remove(Property, propertyid);
  211. CallRemoteFunction("OnPropertyDeleted", "i", propertyid);
  212. SendAdminWarningF(playerid, "You have deleted a property. (ID %d)", propertyid);
  213. return 1;
  214. }
  215. CMD:gotoproperty(playerid, params[])
  216. {
  217. new propertyid;
  218. if(sscanf(params, "i", propertyid)) return SendSyntaxMessage(playerid, "/gotoproperty (id)");
  219. if(!IsValidProperty(propertyid)) return SendErrorMessage(playerid, "You specified an invalid property.");
  220. SetPlayerPos(playerid, PropExtPosX[propertyid], PropExtPosY[propertyid], PropExtPosZ[propertyid]);
  221. SetPlayerFacingAngle(playerid, PropExtPosA[propertyid]);
  222. SetPlayerInterior(playerid, PropOutsideInt[propertyid]);
  223. SetPlayerVirtualWorld(playerid, PropOutsideVW[propertyid]);
  224. SetCameraBehindPlayer(playerid);
  225. SendAdminWarningF(playerid, "You have teleported to a property. (ID %d)", propertyid);
  226. return 1;
  227. }
  228. CMD:enter(playerid, params[])
  229. {
  230. new propertyid = GetNearbyProperty(playerid);
  231. if(propertyid == INVALID_PROPERTY_ID) return 1;
  232. SetPlayerPos(playerid, PropIntPosX[propertyid], PropIntPosY[propertyid], PropIntPosZ[propertyid]);
  233. SetPlayerInterior(playerid, PropInsideInt[propertyid]);
  234. SetPlayerVirtualWorld(playerid, propertyid + 1000);
  235. SetPlayerFacingAngle(playerid, PropIntPosA[propertyid]);
  236. SetCameraBehindPlayer(playerid);
  237. return 1;
  238. }
  239. CMD:exit(playerid, params[])
  240. {
  241. new propertyid = GetCurrentProperty(playerid);
  242. if(propertyid == INVALID_PROPERTY_ID) return 1;
  243. if(IsPlayerInRangeOfPoint(playerid, 1.5, PropIntPosX[propertyid], PropIntPosY[propertyid], PropIntPosZ[propertyid]))
  244. {
  245. SetPlayerPos(playerid, PropExtPosX[propertyid], PropExtPosY[propertyid], PropExtPosZ[propertyid]);
  246. SetPlayerInterior(playerid, PropOutsideInt[propertyid]);
  247. SetPlayerVirtualWorld(playerid, PropOutsideVW[propertyid]);
  248. SetPlayerFacingAngle(playerid, PropExtPosA[propertyid]);
  249. SetCameraBehindPlayer(playerid);
  250. }
  251. return 1;
  252. }
  253. stock GetNearbyProperty(playerid)
  254. {
  255. foreach(new i : Property)
  256. {
  257. if(IsPlayerInRangeOfPoint(playerid, 1.5, PropExtPosX[i], PropExtPosY[i], PropExtPosZ[i]))
  258. {
  259. if(GetPlayerVirtualWorld(playerid) == PropOutsideVW[i] && GetPlayerInterior(playerid) == PropOutsideInt[i]) return i;
  260. }
  261. }
  262. return INVALID_PROPERTY_ID;
  263. }
  264. stock GetCurrentProperty(playerid)
  265. {
  266. new propertyid = GetPlayerVirtualWorld(playerid) - 1000;
  267. if(!IsValidProperty(propertyid))
  268. {
  269. return INVALID_PROPERTY_ID;
  270. }
  271. return propertyid;
  272. }
  273. stock Property_SetOwnerSQLID(propertyid, ownerid)
  274. {
  275. PropOwnerSQLID[propertyid] = ownerid;
  276. new query[84];
  277. mysql_format(MySQL_GetHandle(), query, sizeof(query), "UPDATE properties SET owner_id = %d WHERE id = %d", ownerid, propertyid);
  278. mysql_tquery(MySQL_GetHandle(), query);
  279. }
  280. stock Property_GetOwnerSQLID(propertyid)
  281. {
  282. return PropOwnerSQLID[propertyid];
  283. }
  284. stock Property_SetType(propertyid, type)
  285. {
  286. PropType[propertyid] = type;
  287. new query[84];
  288. mysql_format(MySQL_GetHandle(), query, sizeof(query), "UPDATE properties SET type = %d WHERE id = %d", type, propertyid);
  289. mysql_tquery(MySQL_GetHandle(), query);
  290. }
  291. stock Property_GetType(propertyid)
  292. {
  293. return PropType[propertyid];
  294. }
  295. stock Property_GetTypeName(type)
  296. {
  297. new string[18];
  298. switch(type)
  299. {
  300. case TYPE_HOUSE: strcat(string, "House");
  301. case TYPE_BIZ_STORE: strcat(string, "Store");
  302. case TYPE_BIZ_CLOTHING: strcat(string, "Clothing");
  303. case TYPE_BIZ_BAR: strcat(string, "Bar");
  304. case TYPE_BIZ_CASINO: strcat(string, "Casino");
  305. case TYPE_BIZ_FURNITURE: strcat(string, "Furniture Store");
  306. case TYPE_BIZ_RESTAURANT: strcat(string, "Restaurant");
  307. case TYPE_ENT_NONE: strcat(string, "None");
  308. case TYPE_ENT_POLICE: strcat(string, "Police");
  309. }
  310. return string;
  311. }
  312. stock Property_SetDescription(propertyid, const description[])
  313. {
  314. format(PropDescription[propertyid], MAX_PROP_DESCRIPTION, description);
  315. new query[178];
  316. mysql_format(MySQL_GetHandle(), query, sizeof(query), "UPDATE properties SET description = '%e' WHERE id = %d", description, propertyid);
  317. mysql_tquery(MySQL_GetHandle(), query);
  318. }
  319. stock Property_GetDescription(propertyid)
  320. {
  321. return PropDescription[propertyid];
  322. }
  323. stock Property_SetAddress(propertyid, const address[])
  324. {
  325. format(PropAddress[propertyid], MAX_PROP_ADDRESS, address);
  326. new query[112];
  327. mysql_format(MySQL_GetHandle(), query, sizeof(query), "UPDATE properties SET address = '%e' WHERE id = %d", address, propertyid);
  328. mysql_tquery(MySQL_GetHandle(), query);
  329. }
  330. stock Property_GetAddress(propertyid)
  331. {
  332. return PropAddress[propertyid];
  333. }
  334. stock Property_SetPrice(propertyid, price)
  335. {
  336. PropPrice[propertyid] = price;
  337. new query[84];
  338. mysql_format(MySQL_GetHandle(), query, sizeof(query), "UPDATE properties SET price = %d WHERE id = %d", price, propertyid);
  339. mysql_tquery(MySQL_GetHandle(), query);
  340. }
  341. stock Property_GetPrice(propertyid)
  342. {
  343. return PropPrice[propertyid];
  344. }
  345. stock Property_GetPickup(propertyid)
  346. {
  347. return PropPickup[propertyid];
  348. }
  349. stock Property_GetOutsideInterior(propertyid)
  350. {
  351. return PropOutsideInt[propertyid];
  352. }
  353. stock Property_GetInsideInterior(propertyid)
  354. {
  355. return PropInsideInt[propertyid];
  356. }
  357. stock Property_GetOutsideVW(propertyid)
  358. {
  359. return PropOutsideVW[propertyid];
  360. }
  361. stock Property_SetExtPos(propertyid, world, interior, Float:x, Float:y, Float:z, Float:a)
  362. {
  363. PropOutsideVW[propertyid] = world;
  364. PropOutsideInt[propertyid] = interior;
  365. PropExtPosX[propertyid] = x;
  366. PropExtPosY[propertyid] = y;
  367. PropExtPosZ[propertyid] = z;
  368. PropExtPosA[propertyid] = a;
  369. DestroyDynamicPickup(PropPickup[propertyid]);
  370. PropPickup[propertyid] = CreateDynamicPickup(PROP_PICKUP, 1, x, y, z, world, interior, -1, PROP_PICKUP_DISTANCE);
  371. new query[208];
  372. mysql_format(MySQL_GetHandle(), query, sizeof(query), "UPDATE properties SET outside_vw = %d, outside_int = %d, ext_pos_x = %f, ext_pos_y = %f, ext_pos_z = %f, ext_pos_a = %f WHERE id = %d", world, interior, x, y, z, a, propertyid);
  373. mysql_tquery(MySQL_GetHandle(), query);
  374. }
  375. stock Property_GetExtPos(propertyid, &Float:x, &Float:y, &Float:z, &Float:a = 0.0)
  376. {
  377. #pragma unused x, y, z, a
  378. x = PropExtPosX[propertyid];
  379. y = PropExtPosY[propertyid];
  380. z = PropExtPosZ[propertyid];
  381. a = PropExtPosA[propertyid];
  382. }
  383. stock Property_SetIntPos(propertyid, interior, Float:x, Float:y, Float:z, Float:a)
  384. {
  385. PropInsideInt[propertyid] = interior;
  386. PropIntPosX[propertyid] = x;
  387. PropIntPosY[propertyid] = y;
  388. PropIntPosZ[propertyid] = z;
  389. PropIntPosA[propertyid] = a;
  390. new query[178];
  391. mysql_format(MySQL_GetHandle(), query, sizeof(query), "UPDATE properties SET inside_int = %d, int_pos_x = %f, int_pos_y = %f, int_pos_z = %f, int_pos_a = %f WHERE id = %d", interior, x, y, z, a, propertyid);
  392. mysql_tquery(MySQL_GetHandle(), query);
  393. }
  394. stock Property_GetIntPos(propertyid, &Float:x, &Float:y, &Float:z, &Float:a = 0.0)
  395. {
  396. #pragma unused x, y, z, a
  397. x = PropIntPosX[propertyid];
  398. y = PropIntPosY[propertyid];
  399. z = PropIntPosZ[propertyid];
  400. a = PropIntPosA[propertyid];
  401. }
  402. stock IsValidProperty(propertyid)
  403. {
  404. if(Iter_Contains(Property, propertyid))
  405. {
  406. return true;
  407. }
  408. return false;
  409. }
  410. stock IsPropertyAHouse(propertyid)
  411. {
  412. if(Iter_Contains(House, propertyid))
  413. {
  414. return true;
  415. }
  416. return false;
  417. }
  418. stock IsPropertyABusiness(propertyid)
  419. {
  420. if(Iter_Contains(Business, propertyid))
  421. {
  422. return true;
  423. }
  424. return false;
  425. }
  426. stock IsPropertyAnEntrance(propertyid)
  427. {
  428. if(Iter_Contains(Entrance, propertyid))
  429. {
  430. return true;
  431. }
  432. return false;
  433. }
  434. stock IsHouseTypeValid(type)
  435. {
  436. switch(type)
  437. {
  438. case TYPE_HOUSE: return true;
  439. }
  440. return false;
  441. }
  442. stock IsBusinessTypeValid(type)
  443. {
  444. switch(type)
  445. {
  446. case TYPE_BIZ_STORE, TYPE_BIZ_CLOTHING, TYPE_BIZ_BAR, TYPE_BIZ_CASINO, TYPE_BIZ_FURNITURE, TYPE_BIZ_RESTAURANT: return true;
  447. }
  448. return false;
  449. }
  450. stock IsEntranceTypeValid(type)
  451. {
  452. switch(type)
  453. {
  454. case TYPE_ENT_NONE, TYPE_ENT_POLICE: return true;
  455. }
  456. return false;
  457. }