businesses.inc 35 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925
  1. #if defined BUSINESSES_INCLUDED
  2. #endinput
  3. #endif
  4. #define BUSINESSES_INCLUDED
  5. #include "..\gamemodes\inc\Property\bars.inc"
  6. static str[144];
  7. enum bInfo
  8. {
  9. bName[64],
  10. bOwned,
  11. bOwner[MAX_PLAYER_NAME],
  12. Float:bOutsideX,
  13. Float:bOutsideY,
  14. Float:bOutsideZ,
  15. Float:bOutsideAng,
  16. bOutsideWorld,
  17. bOutsideInt,
  18. bOutsidePickup,
  19. Float:bInsideX,
  20. Float:bInsideY,
  21. Float:bInsideZ,
  22. Float:bInsideAng,
  23. bInsideInt,
  24. bInsidePickup,
  25. bEntryFee,
  26. bValue,
  27. bTill,
  28. bLocked,
  29. bType,
  30. bProducts,
  31. bSeized,
  32. bNoProdsDate[128],
  33. bDonated
  34. };
  35. new BizInfo[MAX_BIZ][bInfo];
  36. CMD:biztypes(playerid, params[])
  37. {
  38. if(PlayerInfo[playerid][pAdmin] >= 99999 || PlayerInfo[playerid][pBizMod] == 1)
  39. {
  40. new ammucount, ffcount, itemcount, barcount, sexshopcount, clothescount;
  41. for(new i = 0; i < 50; i++)
  42. {
  43. switch(BizInfo[i][bType])
  44. {
  45. case 1:
  46. ammucount++;
  47. case 2:
  48. ffcount++;
  49. case 3:
  50. itemcount++;
  51. case 4:
  52. barcount++;
  53. case 5:
  54. sexshopcount++;
  55. case 6:
  56. clothescount++;
  57. }
  58. }
  59. format(str, sizeof(str), "Ammunations: %d, Fast-Food Restaurants: %d, 24/7s: %d, Bars & Clubs: %d, Sex Shops: %d, Clothing Shops: %d", ammucount, ffcount, itemcount, barcount, sexshopcount, clothescount);
  60. SendClientMessage(playerid, COLOR_YELLOW, str);
  61. }
  62. return 1;
  63. }
  64. CMD:bizinfo(playerid, params[])
  65. {
  66. if(PlayerInfo[playerid][pAdmin] >= 99999 || PlayerInfo[playerid][pBizMod] == 1)
  67. {
  68. new biz;
  69. if(sscanf(params, "i", biz)) return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /bizinfo [id]");
  70. {
  71. format(str, sizeof(str), "Business ID: %d, Name: %s, Owner: %s, Till: $%d, Products: %d, Type: %d, Value: $%d, Seized: %d",
  72. biz, BizInfo[biz][bName], BizInfo[biz][bOwner], BizInfo[biz][bTill], BizInfo[biz][bProducts], BizInfo[biz][bType], BizInfo[biz][bValue], BizInfo[biz][bSeized]);
  73. SendClientMessage(playerid, COLOR_YELLOW2, str);
  74. }
  75. }
  76. else return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command.");
  77. return 1;
  78. }
  79. CMD:checkbizstock(playerid, params[])
  80. {
  81. if(PlayerInfo[playerid][pAdmin] >= 99999 || PlayerInfo[playerid][pBizMod] == 1)
  82. {
  83. SearchBizProducts(playerid);
  84. }
  85. else
  86. {
  87. AdmErrorMsg;
  88. return 1;
  89. }
  90. return 1;
  91. }
  92. CMD:govbizinfo(playerid, params[])
  93. {
  94. if(PlayerInfo[playerid][pMember] != 6) return SendClientMessage(playerid, COLOR_GREY, "You are not a part of the government");
  95. new biz = IsPlayerNearBiz(playerid);
  96. if(biz == -1) return SendClientMessage(playerid, COLOR_GREY, "You must be near the business to get the biz ID.");
  97. SendClientMessage(playerid, COLOR_GREY, "Available Types: 1: gunshop, 2: burgershot, 3: 247, 4: bar/club, 5: sexshop, 6: clothes store, 7: donut store");
  98. SendClientMessage(playerid, COLOR_GREY, "Available Types: 8: clucknbell, 9: pizzastack, 10: bank, 11: electronics store, 12: furniture store 13: fishing");
  99. if(BizInfo[biz][bSeized]) format(str, sizeof(str), "Name: %s, Owner: %s, Type: %d - SEIZED", BizInfo[biz][bName], BizInfo[biz][bOwner], BizInfo[biz][bType]);
  100. else format(str, sizeof(str), "Name: %s, Owner: %s, Type: %d - NOT SEIZED", BizInfo[biz][bName], BizInfo[biz][bOwner], BizInfo[biz][bType]);
  101. SendClientMessage(playerid, COLOR_GREY, str);
  102. return 1;
  103. }
  104. CMD:goventer(playerid, params[])
  105. {
  106. if(PlayerInfo[playerid][pMember] != 6) return SendClientMessage(playerid, COLOR_GREY, "You are not a part of the government");
  107. new biz = IsPlayerNearBiz(playerid);
  108. if(biz == -1) return SendClientMessage(playerid, COLOR_GREY, "You are not by a business to enter.");
  109. SetPlayerVirtualWorld(playerid, biz);
  110. PlayerInfo[playerid][pVirtualWorld] = biz;
  111. SetPlayerInterior(playerid, BizInfo[biz][bInsideInt]);
  112. PlayerInfo[playerid][pInt] = BizInfo[biz][bInsideInt];
  113. SetPlayerPos(playerid, BizInfo[biz][bInsideX], BizInfo[biz][bInsideY], BizInfo[biz][bInsideZ]);
  114. SetPlayerFacingAngle(playerid, BizInfo[biz][bInsideAng]);
  115. SetCameraBehindPlayer(playerid);
  116. return 1;
  117. }
  118. //==============================================================================
  119. stock IsAtClothShop(playerid)
  120. {
  121. for(new i = 0; i < sizeof(BizInfo); i++)
  122. {
  123. if(IsPlayerInRangeOfPoint(playerid, 25.0, BizInfo[i][bInsideX], BizInfo[i][bInsideY], BizInfo[i][bInsideZ]))
  124. {
  125. if(GetPlayerVirtualWorld(playerid) == i)
  126. {
  127. if(BizInfo[i][bType] == 6)
  128. {
  129. return 1;
  130. }
  131. }
  132. }
  133. }
  134. return 0;
  135. }
  136. stock displayMapIcons(playerid)
  137. {
  138. for(new i = 0; i < MAX_BIZ; i++) //businesses
  139. {
  140. if(i != PlayerInfo[playerid][pBizKey]) //not the business i own
  141. {
  142. if(BizInfo[i][bType] == 1) //ammunation
  143. {
  144. SetPlayerMapIcon(playerid, iconCount[playerid], BizInfo[i][bOutsideX], BizInfo[i][bOutsideY], BizInfo[i][bOutsideZ], 18, 0, MAPICON_LOCAL);
  145. iconCount[playerid]++;
  146. }
  147. else if(BizInfo[i][bType] == 2) //burgershot
  148. {
  149. SetPlayerMapIcon(playerid, iconCount[playerid], BizInfo[i][bOutsideX], BizInfo[i][bOutsideY], BizInfo[i][bOutsideZ], 10, 0, MAPICON_LOCAL);
  150. iconCount[playerid]++;
  151. }
  152. else if(BizInfo[i][bType] == 3) //247
  153. {
  154. SetPlayerMapIcon(playerid, iconCount[playerid], BizInfo[i][bOutsideX], BizInfo[i][bOutsideY], BizInfo[i][bOutsideZ], 17, 0, MAPICON_LOCAL);
  155. iconCount[playerid]++;
  156. }
  157. else if(BizInfo[i][bType] == 4) //club
  158. {
  159. SetPlayerMapIcon(playerid, iconCount[playerid], BizInfo[i][bOutsideX], BizInfo[i][bOutsideY], BizInfo[i][bOutsideZ], 49, 0, MAPICON_LOCAL);
  160. iconCount[playerid]++;
  161. }
  162. else if(BizInfo[i][bType] == 5) //sexshop
  163. {
  164. SetPlayerMapIcon(playerid, iconCount[playerid], BizInfo[i][bOutsideX], BizInfo[i][bOutsideY], BizInfo[i][bOutsideZ], 38, 0, MAPICON_LOCAL);
  165. iconCount[playerid]++;
  166. }
  167. else if(BizInfo[i][bType] == 6) //clothes store
  168. {
  169. SetPlayerMapIcon(playerid, iconCount[playerid], BizInfo[i][bOutsideX], BizInfo[i][bOutsideY], BizInfo[i][bOutsideZ], 45, 0, MAPICON_LOCAL);
  170. iconCount[playerid]++;
  171. }
  172. else if(BizInfo[i][bType] == 7) //donut store
  173. {
  174. SetPlayerMapIcon(playerid, iconCount[playerid], BizInfo[i][bOutsideX], BizInfo[i][bOutsideY], BizInfo[i][bOutsideZ], 50, 0, MAPICON_LOCAL);
  175. iconCount[playerid]++;
  176. }
  177. else if(BizInfo[i][bType] == 8) //clucknbell
  178. {
  179. SetPlayerMapIcon(playerid, iconCount[playerid], BizInfo[i][bOutsideX], BizInfo[i][bOutsideY], BizInfo[i][bOutsideZ], 14, 0, MAPICON_LOCAL);
  180. iconCount[playerid]++;
  181. }
  182. else if(BizInfo[i][bType] == 9) //pizza stack
  183. {
  184. SetPlayerMapIcon(playerid, iconCount[playerid], BizInfo[i][bOutsideX], BizInfo[i][bOutsideY], BizInfo[i][bOutsideZ], 29, 0, MAPICON_LOCAL);
  185. iconCount[playerid]++;
  186. }
  187. else if(BizInfo[i][bType] == 10) //bank
  188. {
  189. SetPlayerMapIcon(playerid, iconCount[playerid], BizInfo[i][bOutsideX], BizInfo[i][bOutsideY], BizInfo[i][bOutsideZ], 52, 0, MAPICON_LOCAL);
  190. iconCount[playerid]++;
  191. }
  192. else if(BizInfo[i][bType] == 11) //electronics store
  193. {
  194. SetPlayerMapIcon(playerid, iconCount[playerid], BizInfo[i][bOutsideX], BizInfo[i][bOutsideY], BizInfo[i][bOutsideZ], 38, 0, MAPICON_LOCAL);
  195. iconCount[playerid]++;
  196. }
  197. else if(BizInfo[i][bType] == 12) //electronics store
  198. {
  199. SetPlayerMapIcon(playerid, iconCount[playerid], BizInfo[i][bOutsideX], BizInfo[i][bOutsideY], BizInfo[i][bOutsideZ], 38, 0, MAPICON_LOCAL);
  200. iconCount[playerid]++;
  201. }
  202. else if(BizInfo[i][bType] == 13) //fishing store
  203. {
  204. SetPlayerMapIcon(playerid, iconCount[playerid], BizInfo[i][bOutsideX], BizInfo[i][bOutsideY], BizInfo[i][bOutsideZ], 8, 0, MAPICON_LOCAL);
  205. iconCount[playerid]++;
  206. }
  207. else //unknown biz type
  208. {
  209. SetPlayerMapIcon(playerid, iconCount[playerid], BizInfo[i][bOutsideX], BizInfo[i][bOutsideY], BizInfo[i][bOutsideZ], 37, 0, MAPICON_LOCAL);
  210. iconCount[playerid]++;
  211. }
  212. }
  213. }
  214. SetPlayerMapIcon(playerid, iconCount[playerid], 2143.5302, -2259.8565, 26.5776, 51, 0, MAPICON_LOCAL); //matfactory 01
  215. iconCount[playerid]++;
  216. SetPlayerMapIcon(playerid, iconCount[playerid], 2166.3771, -1675.383, 15.0859, 24, 0, MAPICON_LOCAL); //drughouse
  217. iconCount[playerid]++;
  218. SetPlayerMapIcon(playerid, iconCount[playerid], 2337.8855, -1185.4025, 35.5452, 16, 0, MAPICON_LOCAL); //crackhouse
  219. iconCount[playerid]++;
  220. SetPlayerMapIcon(playerid, iconCount[playerid], 411.8294, -2050.2601, -0.4745, 9, 0, MAPICON_LOCAL); //pier
  221. iconCount[playerid]++;
  222. SetPlayerMapIcon(playerid, iconCount[playerid], 385.6571, -283.4588, 2.5919, 9, 0, MAPICON_LOCAL); //pier
  223. iconCount[playerid]++;
  224. SetPlayerMapIcon(playerid, iconCount[playerid], 2329.4089, -2316.0997, 13.5468, 56, 0, MAPICON_LOCAL); //job mechanic
  225. iconCount[playerid]++;
  226. SetPlayerMapIcon(playerid, iconCount[playerid], 165.7221, -280.6324, 1.9747, 56, 0, MAPICON_LOCAL); //job garbage
  227. iconCount[playerid]++;
  228. SetPlayerMapIcon(playerid, iconCount[playerid], 2243.0278,-1715.1628,13.6365, 56, 0, MAPICON_LOCAL); //job bodyguard
  229. iconCount[playerid]++;
  230. SetPlayerMapIcon(playerid, iconCount[playerid], 1741.7062, -1863.6664, 13.5748, 56, 0, MAPICON_LOCAL); //job taxi (ls)
  231. iconCount[playerid]++;
  232. SetPlayerMapIcon(playerid, iconCount[playerid], -1982.0994, 131.8526, 27.6875, 56, 0, MAPICON_LOCAL); //job taxi (sf)
  233. iconCount[playerid]++;
  234. SetPlayerMapIcon(playerid, iconCount[playerid], 1381.0413, -1088.8511, 27.3906, 56, 0, MAPICON_LOCAL); //job lawyer
  235. iconCount[playerid]++;
  236. SetPlayerMapIcon(playerid, iconCount[playerid], 2048.4106, -1409.1826, 75.0372, 22, 0, MAPICON_LOCAL); //hospital 01
  237. iconCount[playerid]++;
  238. SetPlayerMapIcon(playerid, iconCount[playerid], 1147.9742, -1344.0618, 49.2668, 22, 0, MAPICON_LOCAL); //hospital 02
  239. iconCount[playerid]++;
  240. SetPlayerMapIcon(playerid, iconCount[playerid], -2714.6499, 210.9217, 4.3281, 56, 0, MAPICON_LOCAL); //mechanic (sf)
  241. iconCount[playerid]++;
  242. SetPlayerMapIcon(playerid, iconCount[playerid], -2764.7473, 384.7114, 6.3281, 56, 0, MAPICON_LOCAL); //lawyer (sf)
  243. iconCount[playerid]++;
  244. SetPlayerMapIcon(playerid, iconCount[playerid], -1551.8896, 1154.8134, 7.1875, 56, 0, MAPICON_LOCAL); //bodyguard (sf)
  245. iconCount[playerid]++;
  246. SetPlayerMapIcon(playerid, iconCount[playerid], 859.6895, -590.0837, 17.5327, 22, 0, MAPICON_LOCAL); //hospital 03
  247. iconCount[playerid]++;
  248. SetPlayerMapIcon(playerid, iconCount[playerid], 1498.4185, -2182.5278, 14.1682, 20, 0, MAPICON_LOCAL); //fire department
  249. iconCount[playerid]++;
  250. SetPlayerMapIcon(playerid, iconCount[playerid], 1318.8472, 392.6770, 19.5547, 11, 0, MAPICON_LOCAL); //drug factory
  251. iconCount[playerid]++;
  252. SetPlayerMapIcon(playerid, iconCount[playerid], 612.8910, -564.9972, 26.1432, 30, 0, MAPICON_LOCAL); //PD
  253. iconCount[playerid]++;
  254. SetPlayerMapIcon(playerid, iconCount[playerid], 972.0325, -1385.7533, 13.5476, 56, 0, MAPICON_LOCAL); //job product dealer
  255. iconCount[playerid]++;
  256. SetPlayerMapIcon(playerid, iconCount[playerid], 1244.7333, 205.3294, 19.6454, 50, 0, MAPICON_LOCAL); //montgomery cafe
  257. iconCount[playerid]++;
  258. SetPlayerMapIcon(playerid, iconCount[playerid], 1564.5457, -1675.3245, 61.8977, 30, 0, MAPICON_LOCAL); //SAPD
  259. iconCount[playerid]++;
  260. SetPlayerMapIcon(playerid, iconCount[playerid], 1461.8095, -1010.9515, 61.1702, 52, 0, MAPICON_LOCAL); //bank
  261. iconCount[playerid]++;
  262. SetPlayerMapIcon(playerid, iconCount[playerid], 1025.05, -1024.23, 32.1, 63, 0, MAPICON_LOCAL); //payandspray
  263. iconCount[playerid]++;
  264. SetPlayerMapIcon(playerid, iconCount[playerid], 487.68, -1740.87, 11.13, 63, 0, MAPICON_LOCAL); //payandspray
  265. iconCount[playerid]++;
  266. SetPlayerMapIcon(playerid, iconCount[playerid], -1420.73, 2583.37, 55.56, 63, 0, MAPICON_LOCAL); //payandspray
  267. iconCount[playerid]++;
  268. SetPlayerMapIcon(playerid, iconCount[playerid], -1904.39, 284.97, 40.75, 63, 0, MAPICON_LOCAL); //payandspray
  269. iconCount[playerid]++;
  270. SetPlayerMapIcon(playerid, iconCount[playerid], -2425.91, 1022.33, 50.10, 63, 0, MAPICON_LOCAL); //payandspray
  271. iconCount[playerid]++;
  272. SetPlayerMapIcon(playerid, iconCount[playerid], 1975.60, 2162.16, 10.77, 63, 0, MAPICON_LOCAL); //payandspray
  273. iconCount[playerid]++;
  274. SetPlayerMapIcon(playerid, iconCount[playerid], 2065.38, -1831.51, 13.25, 63, 0, MAPICON_LOCAL); //payandspray
  275. iconCount[playerid]++;
  276. SetPlayerMapIcon(playerid, iconCount[playerid], -99.55, 1118.36, 19.44, 63, 0, MAPICON_LOCAL); //payandspray
  277. iconCount[playerid]++;
  278. SetPlayerMapIcon(playerid, iconCount[playerid], 721.07, -455.94, 16.04, 63, 0, MAPICON_LOCAL); //payandspray
  279. iconCount[playerid]++;
  280. SetPlayerMapIcon(playerid, iconCount[playerid], 2393.74, 1493.01, 10.52, 63, 0, MAPICON_LOCAL); //payandspray
  281. iconCount[playerid]++;
  282. SetPlayerMapIcon(playerid, iconCount[playerid], 2288.1233,-1104.7793,38.4565, 51, 0, MAPICON_LOCAL); //matfactory dillimore
  283. iconCount[playerid]++;
  284. SetPlayerMapIcon(playerid, iconCount[playerid], 249.8837, -56.2413, 5.8828, 49, 0, MAPICON_LOCAL); //liquor store in blueberry
  285. iconCount[playerid]++;
  286. SetPlayerMapIcon(playerid, iconCount[playerid], 1995.8113, -1115.6873, 26.7737, 59, 0, MAPICON_LOCAL); //ballas joingang icon
  287. iconCount[playerid]++;
  288. SetPlayerMapIcon(playerid, iconCount[playerid], 2521.3630, -1678.5033, 15.3839, 62, 0, MAPICON_LOCAL); //grove joingang icon
  289. iconCount[playerid]++;
  290. //SetPlayerMapIcon(playerid, iconCount[playerid], 1015.9748, -311.7639, 74.5135, 56, 0, MAPICON_LOCAL); //job miner
  291. //iconCount[playerid]++;
  292. if(PlayerInfo[playerid][pBizKey] != -1) //biz owner
  293. {
  294. new icontype;
  295. new pbizid = PlayerInfo[playerid][pBizKey];
  296. switch(BizInfo[pbizid][bType])
  297. {
  298. case 1:
  299. icontype = 18;
  300. case 2:
  301. icontype = 10;
  302. case 3:
  303. icontype = 17;
  304. case 4:
  305. icontype = 49;
  306. case 5:
  307. icontype = 38;
  308. case 6:
  309. icontype = 45;
  310. case 7:
  311. icontype = 50;
  312. case 8:
  313. icontype = 14;
  314. case 9:
  315. icontype = 29;
  316. case 10:
  317. icontype = 52;
  318. case 11:
  319. icontype = 38;
  320. case 12:
  321. icontype = 11;
  322. case 13:
  323. icontype = 37;
  324. }
  325. new bizid = PlayerInfo[playerid][pBizKey];
  326. SetPlayerMapIcon(playerid, iconCount[playerid], BizInfo[bizid][bOutsideX], BizInfo[bizid][bOutsideY], BizInfo[bizid][bOutsideZ], icontype, 0, MAPICON_GLOBAL);
  327. bizIconID[playerid] = iconCount[playerid];
  328. iconCount[playerid]++;
  329. }
  330. //printf("map icons created: %d", iconCount[playerid]);
  331. }
  332. SaveBizProductDates()
  333. {
  334. new file[20], idx, string[64];
  335. file = "bizz-products.ini";
  336. if(dini_Exists(file))
  337. {
  338. while(idx < sizeof(BizInfo))
  339. {
  340. format(string, sizeof(string), "biz%d", idx);
  341. dini_Set("bizz-products.ini", string, BizInfo[idx][bNoProdsDate]);
  342. idx++;
  343. }
  344. return 1;
  345. }
  346. dini_Create(file);
  347. while(idx < sizeof(BizInfo))
  348. {
  349. format(string, sizeof(string), "biz%d", idx);
  350. dini_Set("bizz-products.ini", string, BizInfo[idx][bNoProdsDate]);
  351. idx++;
  352. }
  353. return 1;
  354. }
  355. LoadBizProductDates()
  356. {
  357. new file[20], idx;
  358. file = "bizz-products.ini";
  359. if(dini_Exists(file))
  360. {
  361. while(idx < sizeof(BizInfo))
  362. {
  363. new string[64];
  364. format(string, sizeof(string), "biz%d", idx);
  365. strmid(BizInfo[idx][bNoProdsDate], dini_Get(file, string), false, strlen(dini_Get(file, string)), 64);
  366. if(strmatch(BizInfo[idx][bNoProdsDate], ""))
  367. {
  368. SetNoProductsDate(idx);
  369. }
  370. idx++;
  371. }
  372. return 1;
  373. }
  374. while(idx < sizeof(BizInfo)) // if there's no file set all the dates
  375. {
  376. SetNoProductsDate(idx);
  377. }
  378. return 1;
  379. }
  380. //==============================================================================
  381. SaveBusinesses()
  382. {
  383. SaveBizProductDates();
  384. new idx;
  385. new File:file;
  386. file = fopen("bizz.cfg", io_write);
  387. fclose(file);
  388. file = fopen("bizz.cfg", io_append);
  389. new coordsstring[512];
  390. if(file) {
  391. while(idx < sizeof(BizInfo))
  392. {
  393. format(coordsstring, sizeof(coordsstring), "%s|%d|%s|%f|%f|%f|%f|%d|%d|%f|%f|%f|%f|%d|%d|%d|%d|%d|%d|%d|%d\n",
  394. BizInfo[idx][bName],
  395. BizInfo[idx][bOwned],
  396. BizInfo[idx][bOwner],
  397. BizInfo[idx][bOutsideX],
  398. BizInfo[idx][bOutsideY],
  399. BizInfo[idx][bOutsideZ],
  400. BizInfo[idx][bOutsideAng],
  401. BizInfo[idx][bOutsideWorld],
  402. BizInfo[idx][bOutsideInt],
  403. BizInfo[idx][bInsideX],
  404. BizInfo[idx][bInsideY],
  405. BizInfo[idx][bInsideZ],
  406. BizInfo[idx][bInsideAng],
  407. BizInfo[idx][bInsideInt],
  408. BizInfo[idx][bEntryFee],
  409. BizInfo[idx][bValue],
  410. BizInfo[idx][bTill],
  411. BizInfo[idx][bLocked],
  412. BizInfo[idx][bType],
  413. BizInfo[idx][bProducts],
  414. BizInfo[idx][bSeized]);
  415. fwrite(file, coordsstring);
  416. idx++;
  417. }
  418. fclose(file);
  419. } else {
  420. printf("[error] Failed to find bizz.cfg");
  421. }
  422. return 1;
  423. }
  424. //==============================================================================
  425. LoadBusinesses()
  426. {
  427. LoadBizProductDates();
  428. new arrCoords[21][64];
  429. new strFromFile2[270];
  430. new File: file = fopen("bizz.cfg", io_read);
  431. if(file)
  432. {
  433. new idx;
  434. while(idx < sizeof(BizInfo))
  435. {
  436. fread(file, strFromFile2);
  437. split(strFromFile2, arrCoords, '|');
  438. strmid(BizInfo[idx][bName], arrCoords[0], 0, strlen(arrCoords[0]), 255);
  439. BizInfo[idx][bOwned] = strval(arrCoords[1]);
  440. strmid(BizInfo[idx][bOwner], arrCoords[2], 0, strlen(arrCoords[2]), 255);
  441. BizInfo[idx][bOutsideX] = floatstr(arrCoords[3]);
  442. BizInfo[idx][bOutsideY] = floatstr(arrCoords[4]);
  443. BizInfo[idx][bOutsideZ] = floatstr(arrCoords[5]);
  444. BizInfo[idx][bOutsideAng] = floatstr(arrCoords[6]);
  445. BizInfo[idx][bOutsideWorld] = strval(arrCoords[7]);
  446. BizInfo[idx][bOutsideInt] = strval(arrCoords[8]);
  447. BizInfo[idx][bInsideX] = floatstr(arrCoords[9]);
  448. BizInfo[idx][bInsideY] = floatstr(arrCoords[10]);
  449. BizInfo[idx][bInsideZ] = floatstr(arrCoords[11]);
  450. BizInfo[idx][bInsideAng] = floatstr(arrCoords[12]);
  451. BizInfo[idx][bInsideInt] = strval(arrCoords[13]);
  452. BizInfo[idx][bEntryFee] = strval(arrCoords[14]);
  453. BizInfo[idx][bValue] = strval(arrCoords[15]);
  454. BizInfo[idx][bTill] = strval(arrCoords[16]);
  455. BizInfo[idx][bLocked] = strval(arrCoords[17]);
  456. BizInfo[idx][bType] = strval(arrCoords[18]);
  457. BizInfo[idx][bProducts] = strval(arrCoords[19]);
  458. BizInfo[idx][bSeized] = strval(arrCoords[20]);
  459. //load pickups
  460. if(BizInfo[idx][bOutsidePickup]) DestroyDynamicPickup(BizInfo[idx][bOutsidePickup]);
  461. if(BizInfo[idx][bInsidePickup]) DestroyDynamicPickup(BizInfo[idx][bInsidePickup]);
  462. BizInfo[idx][bOutsidePickup] = CreateDynamicPickup(1272, 23, BizInfo[idx][bOutsideX], BizInfo[idx][bOutsideY], BizInfo[idx][bOutsideZ]);
  463. BizInfo[idx][bInsidePickup] = CreateDynamicPickup(1272, 23, BizInfo[idx][bInsideX], BizInfo[idx][bInsideY], BizInfo[idx][bInsideZ], idx);
  464. //load 3dtext
  465. if(BizText[idx]) DestroyDynamic3DTextLabel(BizText[idx]);
  466. if(BizInfo[idx][bOwned] == 0)
  467. {
  468. new pricestring[32];
  469. new price = BizInfo[idx][bValue];
  470. new j = valstr(pricestring, price);
  471. while(j >= 4)
  472. {
  473. j -= 3;
  474. strins(pricestring, ",", j);
  475. }
  476. strins(pricestring, "$", 0);
  477. format(str, sizeof(str), "{3D97E0}%s{FFFFFF}\nStatus: For Sale\nPrice: %s", BizInfo[idx][bName], pricestring);
  478. }
  479. else if(BizInfo[idx][bOwned] == 1)
  480. {
  481. // Government seized
  482. if(BizInfo[idx][bSeized] == 1)
  483. {
  484. format(str, sizeof(str), "{AFAFAF}%s{AFAFAF}\n{FFFFFF}This business has been seized by the\n{696969}Government", BizInfo[idx][bName]);
  485. }
  486. // Judicial Department seized
  487. else if(BizInfo[idx][bSeized] == 2) {
  488. format(str, sizeof(str), "{AFAFAF}%s{AFAFAF}\n{FFFFFF}This business has been seized by the\n{BA6103}Judicial Department", BizInfo[idx][bName]);
  489. }
  490. else
  491. {
  492. if(BizInfo[idx][bLocked] == 1)
  493. {
  494. format(str, sizeof(str), "{3D97E0}%s{FFFFFF}\nOwner: %s", BizInfo[idx][bName], BizInfo[idx][bOwner]);
  495. }
  496. else
  497. {
  498. format(str, sizeof(str), "{3D97E0}%s{FFFFFF}\nOwner: %s", BizInfo[idx][bName], BizInfo[idx][bOwner]);
  499. }
  500. }
  501. }
  502. BizText[idx] = CreateDynamic3DTextLabel(str, COLOR_BIZTEXT, BizInfo[idx][bOutsideX], BizInfo[idx][bOutsideY], BizInfo[idx][bOutsideZ] +0.88, 5.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 1, -1, -1, -1, 100);
  503. idx++;
  504. bizcount++;
  505. }
  506. fclose(file);
  507. } else {
  508. printf("[error] Failed to find bizz.cfg");
  509. }
  510. return 1;
  511. }
  512. CMD:getdrink(playerid, params[])
  513. {
  514. for(new i = 0; i < sizeof(BizInfo); i++)
  515. {
  516. if(IsPlayerInRangeOfPoint(playerid, 25.0, BizInfo[i][bInsideX], BizInfo[i][bInsideY], BizInfo[i][bInsideZ]))
  517. {
  518. if(GetPlayerVirtualWorld(playerid) == i)
  519. {
  520. if(BizInfo[i][bType] == 4) //bar
  521. {
  522. if(BizInfo[i][bProducts] > 0)
  523. {
  524. ShowPlayerDialog(playerid, DIALOG_BAR_DYN, DIALOG_STYLE_LIST, "Bar Dialog", "Beer\nVodka\nWhiskey\nWine\nSprunk", "Ok", "Cancel");
  525. }
  526. }
  527. }
  528. }
  529. }
  530. new count = 0;
  531. for(new i = 0; i < MAX_BARS; i++)
  532. {
  533. if(IsPlayerInRangeOfPoint(playerid, 3, DynBars[i][BarX], DynBars[i][BarY], DynBars[i][BarZ]))
  534. {
  535. count++;
  536. }
  537. }
  538. if(count == 0) return SendClientMessage(playerid, COLOR_GREY, "You're not near a bar.");
  539. else
  540. {
  541. ShowPlayerDialog(playerid, DIALOG_BAR_DYN, DIALOG_STYLE_LIST, "Bar Dialog", "Beer\nVodka\nWhiskey\nWine\nSprunk", "Ok", "Cancel");
  542. }
  543. return 1;
  544. }
  545. // Command to buy clothing in a clothes store
  546. CMD:buyclothes(playerid, params[])
  547. {
  548. for(new i = 0; i < sizeof(BizInfo); i++)
  549. {
  550. if(GetPlayerVirtualWorld(playerid) != i)
  551. continue;
  552. if(BizInfo[i][bType] != 6)
  553. continue;
  554. if(!IsPlayerInRangeOfPoint(playerid, 25.0, BizInfo[i][bInsideX], BizInfo[i][bInsideY], BizInfo[i][bInsideZ]))
  555. continue;
  556. if(BizInfo[i][bProducts] <= 0)
  557. return SendClientMessage(playerid, COLOR_GREY, "This business doesn't have any products left.");
  558. ShowSkinShop(playerid);
  559. return 1;
  560. }
  561. SendClientMessage(playerid, COLOR_GREY, "You are not in a clothing store.");
  562. return 1;
  563. }
  564. CMD:buygear(playerid, params[]) {
  565. for(new i = 0; i < sizeof(BizInfo); i++)
  566. {
  567. if(IsPlayerInRangeOfPoint(playerid,25.0,BizInfo[i][bInsideX],BizInfo[i][bInsideY],BizInfo[i][bInsideZ]))
  568. {
  569. if(GetPlayerVirtualWorld(playerid) == i)
  570. {
  571. if(BizInfo[i][bType] == 6)
  572. {
  573. if(BizInfo[i][bProducts] <= 0)
  574. {
  575. SendClientMessage(playerid, COLOR_GREY, "This business doesn't have any products left.");
  576. return 1;
  577. }
  578. ShowPlayerDialog(playerid, DIALOG_BUYACCESSOR_MAIN, DIALOG_STYLE_LIST, "Gear", "Clothing Items 1\nClothing Items 2\nToys 1\nToys 2\nSpecial", "Select", "Cancel");
  579. return 1;
  580. } else {
  581. return SendClientMessage(playerid, COLOR_GREY, "You are not in a Clothing Store !");
  582. }
  583. }
  584. }
  585. }
  586. return 1;
  587. }
  588. CMD:buy(playerid, params[])
  589. {
  590. for(new i = 0; i < sizeof(BizInfo); i++)
  591. {
  592. if(IsPlayerInRangeOfPoint(playerid, 25.0, BizInfo[i][bInsideX], BizInfo[i][bInsideY], BizInfo[i][bInsideZ]))
  593. {
  594. if(GetPlayerVirtualWorld(playerid) == i)
  595. {
  596. switch(BizInfo[i][bType])
  597. {
  598. case 2: // Fast-Food
  599. {
  600. if(BizInfo[i][bProducts] <= 0) return SendClientMessage(playerid, COLOR_GREY, "This business doesn't have any products left.");
  601. DisplayDialogForPlayer(playerid, 70); //burger shot
  602. }
  603. case 3: // 24-7
  604. {
  605. if(BizInfo[i][bProducts] <= 0) return SendClientMessage(playerid, COLOR_GREY, "This business doesn't have any products left.");
  606. new finalstring[5000];
  607. format(finalstring, sizeof(finalstring), "Item Name\tPrice\n\
  608. Cellphone\t\t{4a8e4a}$500\n\
  609. Phonebook\t\t{4a8e4a}$5,000\n\
  610. Dice\t\t\t{4a8e4a}$500\n\
  611. iPod\t\t\t{4a8e4a}$2,500\n\
  612. Spray Can\t\t{4a8e4a}$200\n\
  613. Ropes\t\t\t{4a8e4a}$1,000\n\
  614. Cigars\t\t\t{4a8e4a}$50\n\
  615. Sprunk\t\t\t{4a8e4a}$9\n\
  616. Walkie Talkie\t\t{4a8e4a}$200\n\
  617. Screw Driver\t\t{4a8e4a}$50\n\
  618. Blindfolds\t\t{4a8e4a}$2,500\n\
  619. Cards\t\t\t{4a8e4a}$2,000\n\
  620. Address Book\t\t{4a8e4a}$1,000\n\
  621. Calculator\t\t{4a8e4a}$50\n\
  622. Boombox\t\t{4a8e4a}$3,500\n\
  623. Map\t\t\t{4a8e4a}$500\n\
  624. Box of Matches\t{4a8e4a}$500\n\
  625. Jerry Can\t\t{4a8e4a}$1,000\n\
  626. Case of beer\t\t{4a8e4a}$1,000\n\
  627. Drill\t\t\t{4a8e4a}$250,000\n\
  628. Duffle Bag\t\t{4a8e4a}$5,000");
  629. ShowPlayerDialog(playerid, DIALOG_BUSSINESS_BUY, DIALOG_STYLE_TABLIST_HEADERS, "24/7", finalstring, "Buy", "Cancel");
  630. }
  631. case 5: // Sex Shop
  632. {
  633. if(BizInfo[i][bProducts] <= 0) return SendClientMessage(playerid, COLOR_GREY, "This business doesn't have any products left.");
  634. DisplayDialogForPlayer(playerid, 76);
  635. }
  636. case 7: // Donut Store
  637. {
  638. if(BizInfo[i][bProducts] <= 0) return SendClientMessage(playerid, COLOR_GREY, "This business doesn't have any products left.");
  639. DisplayDialogForPlayer(playerid, 107);
  640. }
  641. case 8: // Cluck n Bell
  642. {
  643. if(BizInfo[i][bProducts] <= 0) return SendClientMessage(playerid, COLOR_GREY, "This business doesn't have any products left.");
  644. DisplayDialogForPlayer(playerid, 71);
  645. }
  646. case 9: // Pizza Stack
  647. {
  648. if(BizInfo[i][bProducts] <= 0) return SendClientMessage(playerid, COLOR_GREY, "This business doesn't have any products left.");
  649. DisplayDialogForPlayer(playerid, 72);
  650. }
  651. case 13: //Fishing
  652. {
  653. if(BizInfo[i][bProducts] <= 0) return SendClientMessage(playerid, COLOR_GREY, "This business doesn't have any products left.");
  654. DisplayDialogForPlayer(playerid, 102);
  655. }
  656. default:
  657. SendClientMessage(playerid, COLOR_GREY, "You are not in a business that can sell products.");
  658. }
  659. }
  660. }
  661. }
  662. return 1;
  663. }
  664. stock SetNoProductsDate(biz)
  665. {
  666. new string[64];
  667. new year, month, day;
  668. getdate(year, month, day);
  669. format(string, sizeof(string), "%d/%d/%d", day, month, year);
  670. strmid(BizInfo[biz][bNoProdsDate], string, 0, strlen(string), 255);
  671. SaveBizProductDates();
  672. return 1;
  673. }
  674. CMD:buygun(playerid, params[])
  675. {
  676. for(new i = 0; i < sizeof(BizInfo); i++)
  677. {
  678. if(IsPlayerInRangeOfPoint(playerid, 25.0, BizInfo[i][bInsideX], BizInfo[i][bInsideY], BizInfo[i][bInsideZ]))
  679. {
  680. if(GetPlayerVirtualWorld(playerid) == i)
  681. {
  682. if(BizInfo[i][bType] == 1) //gunshop
  683. {
  684. if(BizInfo[i][bProducts] > 0)
  685. {
  686. new x_info[24], wstring[128];
  687. if(sscanf(params, "s[24]", x_info))
  688. {
  689. if(PlayerInfo[playerid][pWeaponLicense] != 1)
  690. {
  691. format(wstring, sizeof(wstring), "{FF0000}%s:", BizInfo[i][bName]);
  692. SendClientMessage(playerid, COLOR_WHITE, wstring);
  693. SendClientMessage(playerid, COLOR_GREY, "Vest ($6,500)");
  694. }
  695. else
  696. {
  697. format(wstring, sizeof(wstring), "{FF0000}%s:", BizInfo[i][bName]);
  698. SendClientMessage(playerid, COLOR_WHITE, wstring);
  699. SendClientMessage(playerid, COLOR_GREY, "BrassKnuckles ($90), Katana ($500), Bat ($200)");
  700. SendClientMessage(playerid, COLOR_GREY, "Colt45 ($1,600), Deagle ($50,000) Shotgun ($2200), Rifle ($3,000) Vest ($6,500)");
  701. }
  702. return 1;
  703. }
  704. else
  705. {
  706. if(strcmp(x_info, "colt45", true) == 0)
  707. {
  708. if(PlayerInfo[playerid][pLevel] < 2) return SendClientMessage(playerid, COLOR_GREY, "You must be atleast level 2 to buy firearms from ammunation.");
  709. if(PlayerInfo[playerid][pWeaponLicense] != 1) return SendClientMessage(playerid, COLOR_GRAD2, "You do not have a weapons license.");
  710. if(GetMoney(playerid) >= 1600)
  711. {
  712. GivePlayerGun(playerid, 22);
  713. GiveMoney(playerid, -1600);
  714. SendClientMessage(playerid, COLOR_LIGHTBLUE, "* You have bought a Colt45 from the gunshop.");
  715. BizInfo[i][bProducts] --;
  716. BizInfo[i][bTill] += 1600;
  717. SaveBusinesses();
  718. format(str, sizeof(str), "* %s hands the clerk some money and receives their weapon.", PlayerICName(playerid));
  719. ProxDetector(30.0, playerid, str, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
  720. }
  721. else return SendClientMessage(playerid, COLOR_GREY, "You don't have enough money.");
  722. }
  723. if(strcmp(x_info, "deagle", true) == 0)
  724. {
  725. if(PlayerInfo[playerid][pLevel] < 2) return SendClientMessage(playerid, COLOR_GREY, "You must be atleast level 2 to buy firearms from ammunation.");
  726. if(PlayerInfo[playerid][pWeaponLicense] != 1) return SendClientMessage(playerid, COLOR_GRAD2, "You do not have a weapons license.");
  727. if(GetMoney(playerid) >= 50000)
  728. {
  729. GivePlayerGun(playerid, 24);
  730. GiveMoney(playerid, -50000);
  731. SendClientMessage(playerid, COLOR_LIGHTBLUE, "* You have bought a Deagle from the gunshop.");
  732. BizInfo[i][bProducts] --;
  733. BizInfo[i][bTill] += 10000;
  734. SaveBusinesses();
  735. format(str, sizeof(str), "* %s hands the clerk some money and receives their weapon.", PlayerICName(playerid));
  736. ProxDetector(30.0, playerid, str, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
  737. }
  738. else return SendClientMessage(playerid, COLOR_GREY, "You don't have enough money.");
  739. }
  740. else if(strcmp(x_info, "shotgun", true) == 0)
  741. {
  742. if(PlayerInfo[playerid][pLevel] < 2) return SendClientMessage(playerid, COLOR_GREY, "You must be atleast level 2 to buy firearms from ammunation.");
  743. if(PlayerInfo[playerid][pWeaponLicense] != 1) return SendClientMessage(playerid, COLOR_GRAD2, "You do not have a weapons license.");
  744. if(GetMoney(playerid) >= 2200)
  745. {
  746. GivePlayerGun(playerid, 25);
  747. GiveMoney(playerid, -2200);
  748. SendClientMessage(playerid, COLOR_LIGHTBLUE, "* You have bought a Shotgun from the gunshop.");
  749. BizInfo[i][bProducts] --;
  750. BizInfo[i][bTill] += 2200;
  751. SaveBusinesses();
  752. format(str, sizeof(str), "* %s hands the clerk some money and receives their weapon.", PlayerICName(playerid));
  753. ProxDetector(30.0, playerid, str, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
  754. }
  755. else
  756. {
  757. SendClientMessage(playerid, COLOR_GREY, "You don't have enough money.");
  758. return 1;
  759. }
  760. }
  761. if(strcmp(x_info, "rifle", true) == 0)
  762. {
  763. if(PlayerInfo[playerid][pLevel] < 2) return SendClientMessage(playerid, COLOR_GREY, "You must be atleast level 2 to buy firearms from ammunation.");
  764. if(PlayerInfo[playerid][pWeaponLicense] == 1)
  765. {
  766. if(GetMoney(playerid) >= 3000)
  767. {
  768. GiveMoney(playerid, -3000);
  769. GivePlayerGun(playerid, 33);
  770. SendClientMessage(playerid, COLOR_LIGHTBLUE, "* You have bought a Country Rifle from the gunshop.");
  771. BizInfo[i][bProducts] --;
  772. BizInfo[i][bTill] += 3000;
  773. SaveBusinesses();
  774. format(str, sizeof(str), "* %s hands the clerk some money and receives their rifle.", PlayerICName(playerid));
  775. ProxDetector(30.0, playerid, str, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
  776. }
  777. else return SendClientMessage(playerid, COLOR_GREY, "You don't have enough money.");
  778. }
  779. else return SendClientMessage(playerid, COLOR_GREY, "You must have a weapon license in order to purchase this.");
  780. }
  781. else if(strcmp(x_info, "BrassKnuckles", true) == 0)
  782. {
  783. if(PlayerInfo[playerid][pWeaponLicense] != 1) return SendClientMessage(playerid, COLOR_GRAD2, "You do not have a weapons license.");
  784. if(GetMoney(playerid) >= 500)
  785. {
  786. GiveMoney(playerid, -500);
  787. GivePlayerGun(playerid, 1);
  788. SendClientMessage(playerid, COLOR_LIGHTBLUE, "* You have bought some Brass Knuckles from the gunshop.");
  789. BizInfo[i][bProducts] --;
  790. BizInfo[i][bTill] += 500; // let's let the biz owners at least break even on this
  791. SaveBusinesses();
  792. format(str, sizeof(str), "* %s hands the clerk some money and receives their Brass Knuckles.", PlayerICName(playerid));
  793. ProxDetector(30.0, playerid, str, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
  794. }
  795. else return SendClientMessage(playerid, COLOR_GREY, "You don't have enough money.");
  796. }
  797. else if(strcmp(x_info, "katana", true) == 0)
  798. {
  799. if(PlayerInfo[playerid][pWeaponLicense] != 1) return SendClientMessage(playerid, COLOR_GRAD2, "You do not have a weapons license.");
  800. if(GetMoney(playerid) >= 500)
  801. {
  802. GiveMoney(playerid, -500);
  803. GivePlayerGun(playerid, 8);
  804. SendClientMessage(playerid, COLOR_LIGHTBLUE, "* You have bought a Katana from the gunshop.");
  805. BizInfo[i][bProducts] --;
  806. BizInfo[i][bTill] += 500;
  807. SaveBusinesses();
  808. format(str, sizeof(str), "* %s hands the clerk some money and receives their Katana.", PlayerICName(playerid));
  809. ProxDetector(30.0, playerid, str, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
  810. }
  811. else return SendClientMessage(playerid, COLOR_GREY, "You don't have enough money.");
  812. }
  813. else if(strcmp(x_info, "bat", true) == 0)
  814. {
  815. if(PlayerInfo[playerid][pWeaponLicense] != 1) return SendClientMessage(playerid, COLOR_GRAD2, "You do not have a weapons license.");
  816. if(GetMoney(playerid) >= 500)
  817. {
  818. GiveMoney(playerid, -500);
  819. GivePlayerGun(playerid, 5);
  820. SendClientMessage(playerid, COLOR_LIGHTBLUE, "* You have bought a Baseball Bat from the gunshop.");
  821. BizInfo[i][bProducts] --;
  822. BizInfo[i][bTill] += 500; // let's let the biz owners at least break even on this
  823. SaveBusinesses();
  824. format(str, sizeof(str), "* %s hands the clerk some money and receives their Baseball Bat.", PlayerICName(playerid));
  825. ProxDetector(30.0, playerid, str, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
  826. }
  827. else return SendClientMessage(playerid, COLOR_GREY, "You don't have enough money.");
  828. }
  829. else if(strcmp(x_info, "vest", true) == 0)
  830. {
  831. if(GetMoney(playerid) >= 6500)
  832. {
  833. SetPlayerArmour(playerid, 50);
  834. GiveMoney(playerid, -6500);
  835. SendClientMessage(playerid, COLOR_LIGHTBLUE, "* You have bought a Kevlar Vest from the gunshop.");
  836. BizInfo[i][bProducts] --;
  837. BizInfo[i][bTill] += 6500;
  838. SaveBusinesses();
  839. format(str, sizeof(str), "* %s hands the clerk some money and receives their kevlar vest.", PlayerICName(playerid));
  840. ProxDetector(30.0, playerid, str, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
  841. }
  842. else return SendClientMessage(playerid, COLOR_GREY, "You don't have enough money.");
  843. }
  844. if(BizInfo[i][bProducts] <= 0) SetNoProductsDate(i);
  845. }
  846. }
  847. else
  848. {
  849. SendClientMessage(playerid, COLOR_GREY, "This business doesn't have any products left.");
  850. return 1;
  851. }
  852. }
  853. return 1;
  854. }
  855. }
  856. }
  857. return 1;
  858. }
  859. CMD:setbizdonated(playerid, params[])
  860. {
  861. if(PlayerInfo[playerid][pAdmin] < 1337 && !PlayerInfo[playerid][pBizMod]) return AdmErrorMsg;
  862. new bizid;
  863. if(sscanf(params, "i", bizid)) return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /setbizdonated [bizID]");
  864. if(!BizInfo[bizid][bOwned]) return SendClientMessage(playerid, COLOR_GREY, "You cannot edit this business as it is not owned by someone.");
  865. BizInfo[bizid][bDonated] = !BizInfo[bizid][bDonated];
  866. new msg[100];
  867. if(BizInfo[bizid][bDonated])
  868. {
  869. format(msg, sizeof(msg), "Business ID %d is now donated and can not be sold.", bizid);
  870. SendClientMessage(playerid, COLOR_GREY, msg);
  871. }
  872. else
  873. {
  874. format(msg, sizeof(msg), "Business ID %d is no longer donated and can be sold.", bizid);
  875. SendClientMessage(playerid, COLOR_GREY, msg);
  876. }
  877. return 1;
  878. }
  879. IsPlayerNearBiz(playerid)
  880. {
  881. for(new i = 0; i < MAX_BIZ; i++)
  882. {
  883. if(IsPlayerInRangeOfPoint(playerid, 1.0, BizInfo[i][bOutsideX], BizInfo[i][bOutsideY], BizInfo[i][bOutsideZ]))
  884. {
  885. return i;
  886. }
  887. }
  888. return -1;
  889. }