Advertisement
Guest User

Biz fs

a guest
Jul 20th, 2014
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 42.28 KB | None | 0 0
  1. #include <a_samp>
  2. #include <ZCMD>
  3. #include <YSI/y_ini>
  4. #include <streamer>
  5. #include <sscanf2>
  6. #include <foreach>
  7.  
  8. #pragma tabsize 0
  9. #define FILTERSCRIPT
  10. // Color Defines
  11. #define COLOR_WHITE 0xFFFFFFFF
  12. #define COLOR_FADE1 0xE6E6E6E6
  13. #define COLOR_PM1 0xA65FC7FF
  14. #define COLOR_PM2 0xD35FC7FF
  15. #define COLOR_FADE2 0xC8C8C8C8
  16. #define COLOR_FADE3 0xAAAAAAAA
  17. #define COLOR_FADE4 0x8C8C8C8C
  18. #define COLOR_FADE5 0x6E6E6E6E
  19. #define COLOR_OOC 0xE0FFFFFF
  20. #define COLOR_GREY 0xAFAFAFFF
  21. #define COLOR_LIGHTGREEN 0xADFF2FFF
  22. #define COLOR_LIGHTRED 0xFF6347FF
  23. #define COLOR_DARKRED 0xAA3333FF
  24. #define COLOR_RED 0xFF0606FF
  25. #define COLOR_LIGHTBLUE 0x33CCFFFF
  26. #define COLOR_GREEN 0x33AA33FF
  27. #define COLOR_YELLOW 0xFFFF00FF
  28. #define COLOR_PURPLE 0xC2A2DAFF
  29. #define COLOR_ORANGE 0xFF9900FF
  30. #define COLOR_REPORT 0xFFFF91FF
  31. #define COLOR_RADIO 0x8D8DFFFF
  32. #define COLOR_DEPTRADIO 0xFFD700FF
  33. #define COLOR_BLUE 0x2641FEFF
  34. #define COLOR_MEDIC 0xFF8282FF
  35. #define COLOR_NEWBIE 0x7DAEFFFF
  36. #define COLOR_LIME 0x00FF00FF
  37. #define COLOR_NEWS 0x049C7100
  38. #define COLOR_CYAN 0x01FCFFFF
  39. #define COLOR_VIP 0xC93CCEFF
  40. #define COLOR_GOLD 0xFFD700FF
  41.  
  42. // Biz Defines
  43. #define MAX_BIZ 500
  44. #define COE "{F07B0F}"
  45. #define CWE "{FFFFFF}"
  46. #define CGE "{2A8A07}"
  47.  
  48. enum pInfo
  49. {
  50. pAdmin,
  51. pCash,
  52. pBiz,
  53. pMaskOn,
  54. pHideOn,
  55. pVBiz
  56. };
  57. new PlayerInfo[MAX_PLAYERS][pInfo];
  58.  
  59. enum bizInfo
  60. {
  61. bType,
  62. bStatus,
  63. bOwner[32],
  64. Float:bX,
  65. Float:bY,
  66. Float:bZ,
  67. bPickup,
  68. bMoney,
  69. bProducts,
  70. Text3D:bText,
  71. bSold,
  72. bLevel,
  73. bPrice,
  74. bAP
  75. }
  76. new BizInfo[MAX_BIZ][bizInfo];
  77.  
  78. public OnFilterScriptInit()
  79. {
  80. LoadBiz();
  81. print("\n--------------------------------------");
  82. print(" Business System By Mariooo");
  83. print("--------------------------------------\n");
  84. return 1;
  85. }
  86.  
  87. public OnFilterScriptExit()
  88. {
  89. SaveBiz();
  90. return 1;
  91. }
  92. stock CheckFiles()
  93. {
  94. if(!dini_Exists("businesses.cfg")) dini_Create("businesses.cfg");
  95. return 1;
  96. }
  97. stock LoadBiz()
  98. {
  99. if(!fexist("businesses.cfg")) fcreate("businesses.cfg");
  100. new binfo[12][32];
  101. new string[256];
  102. new File:file = fopen("businesses.cfg", io_read);
  103. if(file)
  104. {
  105. new idx = 1;
  106. while(idx < MAX_BIZ)
  107. {
  108. fread(file, string);
  109. split(string, binfo, '|');
  110. BizInfo[idx][bType] = strval(binfo[0]);
  111. BizInfo[idx][bStatus] = strval(binfo[1]);
  112. format(BizInfo[idx][bOwner], 32, "%s", binfo[2]);
  113. BizInfo[idx][bX] = floatstr(binfo[3]);
  114. BizInfo[idx][bY] = floatstr(binfo[4]);
  115. BizInfo[idx][bZ] = floatstr(binfo[5]);
  116. BizInfo[idx][bMoney] = strval(binfo[6]);
  117. BizInfo[idx][bProducts] = strval(binfo[7]);
  118. BizInfo[idx][bSold] = strval(binfo[8]);
  119. BizInfo[idx][bLevel] = strval(binfo[9]);
  120. BizInfo[idx][bPrice] = strval(binfo[10]);
  121. BizInfo[idx][bAP] = strval(binfo[11]);
  122. if(BizInfo[idx][bType]) // If Business is owned
  123. {
  124. BizInfo[idx][bPickup] = CreateDynamicPickup(1272, 1, BizInfo[idx][bX], BizInfo[idx][bY], BizInfo[idx][bZ], 0);
  125. if(!strcmp("The State", BizInfo[idx][bOwner])) format(string, sizeof(string), "[Business ID: %d]\nBusiness Type: %s\nBusiness Owner: %s\nStatus: For Sale\nPrice: $%d", idx, RBT(idx), BizInfo[idx][bOwner], BizInfo[idx][bPrice]);
  126. //else format(string, sizeof(string), "ID: %d\n%s\nOwner: %s\nStatus: %s", idx, RBT(idx), BizInfo[idx][bOwner], RBS(idx));
  127. else format(string, sizeof(string), "[Business ID: %d]\nBusiness Type: %s\nBusiness Owner: %s\nStatus: %s", idx, RBT(idx), BizInfo[idx][bOwner], RBS(idx));
  128. BizInfo[idx][bText] = CreateDynamic3DTextLabel(string, COLOR_WHITE, BizInfo[idx][bX], BizInfo[idx][bY], BizInfo[idx][bZ]+0.3, 15);
  129. }
  130. idx++;
  131. }
  132. }
  133. print("Businesses loaded successfully.");
  134. return 1;
  135. }
  136.  
  137. stock SaveBiz()
  138. {
  139. if(!fexist("businesses.cfg")) fcreate("businesses.cfg");
  140. new idx = 1, File:file;
  141. new string[256];
  142. while(idx < MAX_BIZ)
  143. {
  144. format(string, sizeof(string), "%d|%d|%s|%f|%f|%f|%d|%d|%d|%d|%d|%d\r\n", BizInfo[idx][bType], BizInfo[idx][bStatus], BizInfo[idx][bOwner], BizInfo[idx][bX], BizInfo[idx][bY], BizInfo[idx][bZ], BizInfo[idx][bMoney], BizInfo[idx][bProducts], BizInfo[idx][bSold], BizInfo[idx][bLevel], BizInfo[idx][bPrice], BizInfo[idx][bAP]);
  145. if(idx == 1)
  146. {
  147. file = fopen("businesses.cfg", io_write);
  148. }
  149. else
  150. {
  151. file = fopen("businesses.cfg", io_append);
  152. }
  153. fwrite(file, string);
  154. fclose(file);
  155. idx++;
  156. }
  157. print("Businesses saved successfully.");
  158. }
  159. CMD:createbiz(playerid, params[])
  160. {
  161. new type, string[128];
  162. if(!IsPlayerConnected(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
  163. if(IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command.");
  164. // if(!aDuty[playerid]) return SendClientMessage(playerid, COLOR_GREY, "You are not on admin duty.");
  165. if(sscanf(params, "i", type))
  166. {
  167. SendClientMessage(playerid, COLOR_WHITE, "USAGE: /createbiz [type]");
  168. SendClientMessage(playerid, COLOR_GREY, "TYPES: 1) 24/7 | 2) Clothes Shop | 3) Ammunation | 4) Club | 5) Advertisement Agency | 6) Fast Food | 7) Casino");
  169. return 1;
  170. }
  171. if(type < 1 || type > 7) return SendClientMessage(playerid, COLOR_GREY, "Businesses are between 1 and 7.");
  172. for(new idx=1; idx<MAX_BIZ; idx++)
  173. {
  174. if(!BizInfo[idx][bType])
  175. {
  176. //g_bizRobber[idx] = -1;
  177. // Getting Business Setup
  178. new Float:X, Float:Y, Float:Z;
  179. GetPlayerPos(playerid, X, Y, Z);
  180. // Making Business
  181. BizInfo[idx][bType] = type;
  182. BizInfo[idx][bStatus] = 0;
  183. format(BizInfo[idx][bOwner], 32, "The State");
  184. BizInfo[idx][bX] = X;
  185. BizInfo[idx][bY] = Y;
  186. BizInfo[idx][bZ] = Z;
  187. BizInfo[idx][bMoney] = 0;
  188. BizInfo[idx][bProducts] = 0;
  189. BizInfo[idx][bSold] = 0;
  190. BizInfo[idx][bLevel] = 1;
  191. BizInfo[idx][bPrice] = 500000;
  192. BizInfo[idx][bPickup] = CreateDynamicPickup(1272, 1, X, Y, Z, 0);
  193. format(string, sizeof(string), "[Business ID: %d]\nBusiness Type: %s\nBusiness Owner: %s\nStatus: For Sale\nPrice: $%d", idx, RBT(idx), BizInfo[idx][bOwner], BizInfo[idx][bPrice]);
  194. BizInfo[idx][bText] = CreateDynamic3DTextLabel(string, COLOR_WHITE, X, Y, Z, 15);
  195. format(string, sizeof(string), "{FF0000}[Admin Warn]{FF6347} %s has created business ID %d.", RPN(playerid), idx);
  196. //SendAdminMessage(COLOR_DARKRED, 1, string);
  197. Log("logs/business.log", string);
  198. idx = MAX_BIZ;
  199. }
  200. }
  201. return 1;
  202. }
  203.  
  204. CMD:deletebiz(playerid, params[])
  205. {
  206. new id, string[128];
  207. if(!IsPlayerConnected(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
  208. if(IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command.");
  209. // if(!aDuty[playerid]) return SendClientMessage(playerid, COLOR_GREY, "You are not on admin duty.");
  210. if(sscanf(params, "i", id)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /deletebiz [bizid]");
  211. if(!BizInfo[id][bType]) return SendClientMessage(playerid, COLOR_GREY, "Invalid business id.");
  212. foreach(Player, i)
  213. {
  214. if(IsPlayerConnected(i) && PlayerInfo[i][pBiz] == id)
  215. {
  216. PlayerInfo[playerid][pBiz] = 0;
  217. format(string, sizeof(string), " Adminstrator %s has deleted your business.", RPN(playerid));
  218. SendClientMessage(i, COLOR_WHITE, string);
  219. }
  220. }
  221. if(!strcmp("The State", BizInfo[id][bOwner]))
  222. {
  223. format(string, sizeof(string), "{FF0000}[Admin Warn]{FF6347} %s has deleted business ID %d.", RPN(playerid), id);
  224. }
  225. else
  226. {
  227. format(string, sizeof(string), "{FF0000}[Admin Warn]{FF6347} %s has deleted %s's business. (ID %d)", RPN(playerid), BizInfo[id][bOwner], id);
  228. }
  229. //SendAdminMessage(COLOR_DARKRED, 1, string);
  230. Log("logs/business.log", string);
  231. BizInfo[id][bType] = 0;
  232. BizInfo[id][bStatus] = 0;
  233. format(BizInfo[id][bOwner], 32, "");
  234. BizInfo[id][bX] = 0;
  235. BizInfo[id][bY] = 0;
  236. BizInfo[id][bZ] = 0;
  237. BizInfo[id][bMoney] = 0;
  238. BizInfo[id][bProducts] = 0;
  239. DestroyDynamicPickup(BizInfo[id][bPickup]);
  240. DestroyDynamic3DTextLabel(BizInfo[id][bText]);
  241. return 1;
  242. }
  243. CMD:bizhelp(playerid, params[])
  244. {
  245. if(!IsPlayerConnected(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
  246. SendClientMessage(playerid, COLOR_YELLOW, "BUSINESS: {FFFFFF}/buybiz");
  247. if(PlayerInfo[playerid][pBiz] || PlayerInfo[playerid][pVBiz]) SendClientMessage(playerid, COLOR_YELLOW, "BUSINESS OWNER: {FFFFFF}/vault /lock /buyproducts /sellbiztomarket");
  248. return 1;
  249. }
  250. CMD:vault(playerid, params[])
  251. {
  252. new value, string[128];
  253. new idx = PlayerInfo[playerid][pBiz];
  254. if(!IsPlayerConnected(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
  255. if(!PlayerInfo[playerid][pBiz] && !PlayerInfo[playerid][pVBiz]) return SendClientMessage(playerid, COLOR_GREY, "You don't own a busines.");
  256. if(GetPlayerVirtualWorld(playerid)-100 != idx && !PlayerInfo[playerid][pVBiz]) return SendClientMessage(playerid, COLOR_GREY, "You are not inside your business.");
  257. if(GetPlayerVirtualWorld(playerid)-100 != idx && PlayerInfo[playerid][pVBiz])
  258. {
  259. idx = PlayerInfo[playerid][pVBiz];
  260. if(GetPlayerVirtualWorld(playerid)-100 != idx) return SendClientMessage(playerid, COLOR_GREY, "You are not inside your business.");
  261. }
  262. if(sscanf(params, "s[32]", params))
  263. {
  264. SendClientMessage(playerid, COLOR_WHITE, "USAGE: /vault [option]");
  265. SendClientMessage(playerid, COLOR_GREY, "OPTIONS: withdraw | deposit");
  266. return 1;
  267. }
  268. if(!strcmp(params, "withdraw", false, 8))
  269. {
  270. if(sscanf(params, "s[32]i", params, value))
  271. {
  272. SendClientMessage(playerid, COLOR_WHITE, "USAGE: /vault withdraw [amount]");
  273. format(string, sizeof(string), "Current Vault Money: $%d", BizInfo[idx][bMoney]);
  274. SendClientMessage(playerid, COLOR_GREY, string);
  275. return 1;
  276. }
  277. if(value > BizInfo[idx][bMoney]) return SendClientMessage(playerid, COLOR_GREY, "You don't have this much money in your business vault.");
  278. BizInfo[idx][bMoney] -= value;
  279. GivePlayerCash(playerid, value);
  280. format(string, sizeof(string), "* %s has withdrawn money from their business vault.", RPN(playerid));
  281. SendNearbyMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
  282. format(string, sizeof(string), " You have withdrawn $%d from your business vault, amount left: $%d", value, BizInfo[idx][bMoney]);
  283. SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
  284. }
  285. else if(!strcmp(params, "deposit", false, 7))
  286. {
  287. if(sscanf(params, "s[32]i", params, value))
  288. {
  289. SendClientMessage(playerid, COLOR_WHITE, "USAGE: /vault deposit [amount]");
  290. format(string, sizeof(string), "Current Vault Money: $%d", BizInfo[idx][bMoney]);
  291. SendClientMessage(playerid, COLOR_GREY, string);
  292. return 1;
  293. }
  294. if(value > PlayerInfo[playerid][pCash]) return SendClientMessage(playerid, COLOR_GREY, "You don't have this much money on you.");
  295. BizInfo[idx][bMoney] += value;
  296. GivePlayerCash(playerid, -value);
  297. format(string, sizeof(string), "* %s has deposited money to their business vault.", RPN(playerid));
  298. SendNearbyMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
  299. format(string, sizeof(string), " You have deposited $%d to your business vault, current amount: $%d", value, BizInfo[idx][bMoney]);
  300. SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
  301. }
  302. return 1;
  303. }
  304. /*CMD:buyproducts(playerid, params[])
  305. {
  306. new amount, price, string[128];
  307. new idx = PlayerInfo[playerid][pBiz];
  308. if(!IsPlayerConnected(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
  309. if(!PlayerInfo[playerid][pBiz] && !PlayerInfo[playerid][pVBiz]) return SendClientMessage(playerid, COLOR_GREY, "You don't own a business.");
  310. if(GetPlayerVirtualWorld(playerid)-100 != idx && !PlayerInfo[playerid][pVBiz]) return SendClientMessage(playerid, COLOR_GREY, "You are not inside your business.");
  311. if(GetPlayerVirtualWorld(playerid)-100 != idx && PlayerInfo[playerid][pVBiz])
  312. {
  313. idx = PlayerInfo[playerid][pVBiz];
  314. if(GetPlayerVirtualWorld(playerid)-100 != idx) return SendClientMessage(playerid, COLOR_GREY, "You are not inside your business.");
  315. }
  316. if(sscanf(params, "i", amount)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /buyproducts [amount]");
  317. if(amount < 0) return SendClientMessage(playerid, COLOR_GREY, "Invalid products amount.");
  318. if(Products < amount)
  319. {
  320. format(string, sizeof(string), "The products dropoff currently has %d products only.", Products);
  321. SendClientMessage(playerid, COLOR_GREY, string);
  322. return 1;
  323. }
  324. price = amount*20;
  325. if(PlayerInfo[playerid][pCash] < price)
  326. {
  327. format(string, sizeof(string), "You don't have that much money on you. ($%d)", price);
  328. SendClientMessage(playerid, COLOR_GREY, string);
  329. return 1;
  330. }
  331. if(BizInfo[idx][bProducts]+amount > 500) return SendClientMessage(playerid, COLOR_GREY, "Your business can't hold that much products.");
  332. GivePlayerCash(playerid, -price);
  333. BizInfo[idx][bProducts] += amount;
  334. Products -= amount;
  335. format(string, sizeof(string), "* %s has purchased %d products for $%d.", RPN(playerid), amount, price);
  336. SendNearbyMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
  337. format(string, sizeof(string), "Packages Dropoff\n{FFFF00}/deliverpackages to deliver crates\nAvailable Products: %d/20000", Products);
  338. UpdateDynamic3DTextLabelText(ProductsText, COLOR_RED, string);
  339. return 1;
  340. }*/
  341. CMD:lockb(playerid, params[])
  342. {
  343. new string[128], idx, done, lockdone;
  344. if(!IsPlayerConnected(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
  345. if(PlayerInfo[playerid][pBiz])
  346. {
  347. if(IsPlayerInRangeOfPoint(playerid, 2, BizInfo[PlayerInfo[playerid][pBiz]][bX], BizInfo[PlayerInfo[playerid][pBiz]][bY], BizInfo[PlayerInfo[playerid][pBiz]][bZ]))
  348. {
  349. if(!BizInfo[PlayerInfo[playerid][pBiz]][bStatus])
  350. {
  351. BizInfo[PlayerInfo[playerid][pBiz]][bStatus] = 1;
  352. format(string, sizeof(string), "[Business ID: %d]\nBusiness Type: %s\nBusiness Owner: %s\nStatus: %s", PlayerInfo[playerid][pBiz], RBT(PlayerInfo[playerid][pBiz]), BizInfo[PlayerInfo[playerid][pBiz]][bOwner], RBS(PlayerInfo[playerid][pBiz]));
  353. UpdateDynamic3DTextLabelText(BizInfo[PlayerInfo[playerid][pBiz]][bText], COLOR_WHITE, string);
  354. format(string, sizeof(string), "* %s takes out their business keys and unlocks it.", RPN(playerid));
  355. SendNearbyMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
  356. GameTextForPlayer(playerid, "~g~Business Unlocked", 3500, 3);
  357. }
  358. else if(BizInfo[PlayerInfo[playerid][pBiz]][bStatus])
  359. {
  360. BizInfo[PlayerInfo[playerid][pBiz]][bStatus] = 0;
  361. format(string, sizeof(string), "[Business ID: %d]\nBusiness Type: %s\nBusiness Owner: %s\nStatus: %s", PlayerInfo[playerid][pBiz], RBT(PlayerInfo[playerid][pBiz]), BizInfo[PlayerInfo[playerid][pBiz]][bOwner], RBS(PlayerInfo[playerid][pBiz]));
  362. UpdateDynamic3DTextLabelText(BizInfo[PlayerInfo[playerid][pBiz]][bText], COLOR_WHITE, string);
  363. format(string, sizeof(string), "* %s takes out their business keys and locks it.", RPN(playerid));
  364. SendNearbyMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
  365. GameTextForPlayer(playerid, "~r~Business Locked", 3500, 3);
  366. }
  367. done = 1;
  368. lockdone = 1;
  369. }
  370. }
  371. return 1;
  372. }
  373. CMD:buybiz(playerid, params[])
  374. {
  375. new string[128], done;
  376. if(!IsPlayerConnected(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
  377. if(PlayerInfo[playerid][pBiz] == 1) return SendClientMessage(playerid, COLOR_GREY, "You already own a businesses.");
  378. //if(PlayerInfo[playerid][pBiz] && PlayerInfo[playerid][pVIP] < 4) return SendClientMessage(playerid, COLOR_GREY, "You already own a business.");
  379. for(new idx=1; idx<MAX_BIZ; idx++)
  380. {
  381. if(IsPlayerInRangeOfPoint(playerid, 2, BizInfo[idx][bX], BizInfo[idx][bY], BizInfo[idx][bZ]))
  382. {
  383. if(!strcmp("The State", BizInfo[idx][bOwner], false))
  384. {
  385. if(GetPlayerMoney(playerid) < BizInfo[idx][bPrice]) return SendClientMessage(playerid, COLOR_GREY, "You don't have enough money to buy this business.");
  386. {
  387. GivePlayerCash(playerid, -BizInfo[idx][bPrice]);
  388. if(PlayerInfo[playerid][pBiz]) PlayerInfo[playerid][pVBiz] = idx;
  389. else PlayerInfo[playerid][pBiz] = idx;
  390. format(BizInfo[idx][bOwner], 32, "%s", RPNU(playerid));
  391. format(string, sizeof(string), "[Business ID: %d]\nBusiness Type: %s\nBusiness Owner: %s\nStatus: %s", idx, RBT(idx), BizInfo[idx][bOwner], RBS(idx));
  392. UpdateDynamic3DTextLabelText(BizInfo[idx][bText], COLOR_WHITE, string);
  393. SendClientMessage(playerid, COLOR_GREEN, " You have successfully bought a business.");
  394. SendClientMessage(playerid, COLOR_WHITE, " Type /bizhelp to view your business commands.");
  395. BizInfo[idx][bProducts] = 99999;
  396. format(string, sizeof(string), "%s has bought business id %d.", RPN(playerid), idx);
  397. Log("logs/business.log", string);
  398. idx = MAX_BIZ;
  399. done = 1;
  400. }
  401. if(idx == MAX_BIZ-1 && !done)
  402. {
  403. SendClientMessage(playerid, COLOR_GREY, "This business is owned by someone else.");
  404. }
  405. }
  406. if(idx == MAX_BIZ-1 && !done)
  407. {
  408. SendClientMessage(playerid, COLOR_GREY, "You are not near a buyable business.");
  409. }
  410. }
  411. }
  412. return 1;
  413. }
  414.  
  415.  
  416.  
  417. CMD:sellbiztomarket(playerid, params[])
  418. {
  419. new string[128];
  420. if(!IsPlayerConnected(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
  421. if(!PlayerInfo[playerid][pBiz] && !PlayerInfo[playerid][pVBiz]) return SendClientMessage(playerid, COLOR_GREY, "You don't own a business.");
  422. if(sscanf(params, "s[8]", params)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /sellbiztomarket confirm");
  423. if(!strcmp(params, "confirm", true))
  424. {
  425. new done;
  426. if(IsPlayerInRangeOfPoint(playerid, 2, BizInfo[PlayerInfo[playerid][pBiz]][bX], BizInfo[PlayerInfo[playerid][pBiz]][bY], BizInfo[PlayerInfo[playerid][pBiz]][bZ]))
  427. {
  428. GivePlayerCash(playerid, (75*BizInfo[PlayerInfo[playerid][pBiz]][bPrice])/100);
  429. BizInfo[PlayerInfo[playerid][pBiz]][bStatus] = 0;
  430. format(BizInfo[PlayerInfo[playerid][pBiz]][bOwner], 32, "The State");
  431. format(string, sizeof(string), "[Business ID:% d]\nBusiness Type: %s\nBusiness Owner: %s\nStatus: For Sale\nPrice: $%d", PlayerInfo[playerid][pBiz], RBT(PlayerInfo[playerid][pBiz]), BizInfo[PlayerInfo[playerid][pBiz]][bOwner], BizInfo[PlayerInfo[playerid][pBiz]][bPrice]);
  432. UpdateDynamic3DTextLabelText(BizInfo[PlayerInfo[playerid][pBiz]][bText], COLOR_WHITE, string);
  433. SendClientMessage(playerid, COLOR_GREEN, " You have successfully sold your business to The State. (75 percent of original price was paid back)");
  434. format(string, sizeof(string), "%s has sold business id %d to the market.", RPN(playerid), PlayerInfo[playerid][pBiz]);
  435. Log("logs/business.log", string);
  436. PlayerInfo[playerid][pBiz] = 0;
  437. done = 1;
  438. }
  439. if(!done)
  440. {
  441. new idx = PlayerInfo[playerid][pVBiz];
  442. if(IsPlayerInRangeOfPoint(playerid, 2, BizInfo[idx][bX], BizInfo[idx][bY], BizInfo[idx][bZ]))
  443. {
  444. GivePlayerCash(playerid, (75*BizInfo[idx][bPrice])/100);
  445. BizInfo[idx][bStatus] = 0;
  446. format(BizInfo[idx][bOwner], 32, "The State");
  447. format(string, sizeof(string), "[Business ID: %d]\nBusiness Type: %s\nBusiness Owner: %s\nStatus: For Sale\nPrice: $%d", idx, RBT(idx), BizInfo[idx][bOwner], BizInfo[idx][bPrice]);
  448. UpdateDynamic3DTextLabelText(BizInfo[idx][bText], COLOR_WHITE, string);
  449. SendClientMessage(playerid, COLOR_GREEN, " You have successfully sold your business to The State. (75 percent of original price was paid back)");
  450. format(string, sizeof(string), "%s has sold business id %d to the market.", RPN(playerid), idx);
  451. Log("logs/business.log", string);
  452. PlayerInfo[playerid][pVBiz] = 0;
  453. done = 1;
  454. }
  455. }
  456. if(!done)
  457. {
  458. SendClientMessage(playerid, COLOR_GREY, "You are not near your business.");
  459. return 1;
  460. }
  461. }
  462. return 1;
  463. }
  464. CMD:enter(playerid, params[])
  465. {
  466. new string[128];
  467. for(new idx=1; idx<MAX_BIZ; idx++)
  468. {
  469. if(IsPlayerInRangeOfPoint(playerid, 2, BizInfo[idx][bX], BizInfo[idx][bY], BizInfo[idx][bZ]))
  470. {
  471. if(!BizInfo[idx][bStatus] && PlayerInfo[playerid][pBiz] != idx && !PlayerInfo[playerid][pVBiz]) return SendClientMessage(playerid, COLOR_GREY, "This business is closed.");
  472. if(BizInfo[idx][bType] == 1) // 24/7 Business
  473. {
  474. format(string, sizeof(string), "* %s pushes the door and enters the shop.", RPN(playerid));
  475. SendNearbyMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
  476. SetPlayerPos(playerid, -27.3025,-57.6649,1003.5469);
  477. SetPlayerFacingAngle(playerid, 357.5915);
  478. SetCameraBehindPlayer(playerid);
  479. SetPlayerInterior(playerid, 6);
  480. SetPlayerVirtualWorld(playerid, idx+100);
  481. format(string, sizeof(string), "** Welcome to %s's 24/7 Market (( /list & /buy )) **", BizInfo[idx][bOwner]);
  482. SendClientMessage(playerid, COLOR_ORANGE, string);
  483. return 1;
  484. }
  485. else if(BizInfo[idx][bType] == 2) // Clothes Shop Business
  486. {
  487. format(string, sizeof(string), "* %s pushes the door and enters the shop.", RPN(playerid));
  488. SendNearbyMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
  489. SetPlayerPos(playerid, 207.0638,-139.9965,1003.5078);
  490. SetPlayerFacingAngle(playerid, 356.3849);
  491. SetCameraBehindPlayer(playerid);
  492. SetPlayerInterior(playerid, 3);
  493. SetPlayerVirtualWorld(playerid, idx+100);
  494. format(string, sizeof(string), "** Welcome to %s's Clothes Shop (( /buyclothes(old) & /buytoys )) **", BizInfo[idx][bOwner]);
  495. SendClientMessage(playerid, COLOR_ORANGE, string);
  496. return 1;
  497. }
  498. else if(BizInfo[idx][bType] == 3) // Ammunation Business
  499. {
  500. format(string, sizeof(string), "* %s pushes the door and enters the shop.", RPN(playerid));
  501. SendNearbyMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
  502. SetPlayerPos(playerid, 285.8044,-85.9956,1001.5229);
  503. SetPlayerFacingAngle(playerid, 358.9898);
  504. SetCameraBehindPlayer(playerid);
  505. SetPlayerInterior(playerid, 4);
  506. SetPlayerVirtualWorld(playerid, idx+100);
  507. format(string, sizeof(string), "** Welcome to %s's Ammunation (( /list & /buy /buyweapon )) **", BizInfo[idx][bOwner]);
  508. SendClientMessage(playerid, COLOR_ORANGE, string);
  509. return 1;
  510. }
  511. else if(BizInfo[idx][bType] == 4) // Club Business
  512. {
  513. format(string, sizeof(string), "* %s pushes the door and enters the shop.", RPN(playerid));
  514. SendNearbyMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
  515. SetPlayerPos(playerid, 493.4252,-24.3061,1000.6797);
  516. SetPlayerFacingAngle(playerid, 0.2432);
  517. SetCameraBehindPlayer(playerid);
  518. SetPlayerInterior(playerid, 17);
  519. SetPlayerVirtualWorld(playerid, idx+100);
  520. format(string, sizeof(string), "** Welcome to %s's Club (( /list & /buy )) **", BizInfo[idx][bOwner]);
  521. SendClientMessage(playerid, COLOR_ORANGE, string);
  522. return 1;
  523. }
  524. else if(BizInfo[idx][bType] == 5) // Advertisement Agency
  525. {
  526. format(string, sizeof(string), "* %s pushes the door and enters the shop.", RPN(playerid));
  527. SendNearbyMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
  528. SetPlayerPos(playerid, 834.1631,7.4883,1004.1797);
  529. SetPlayerFacingAngle(playerid, 86.7239);
  530. SetCameraBehindPlayer(playerid);
  531. SetPlayerInterior(playerid, 3);
  532. SetPlayerVirtualWorld(playerid, idx+100);
  533. format(string, sizeof(string), "** Welcome to %s's Advertisement Agency (( /ad )) **", BizInfo[idx][bOwner]);
  534. SendClientMessage(playerid, COLOR_ORANGE, string);
  535. return 1;
  536. }
  537. else if(BizInfo[idx][bType] == 6) // Fast Food
  538. {
  539. format(string, sizeof(string), "* %s pushes the door and enters the shop.", RPN(playerid));
  540. SendNearbyMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
  541. SetPlayerPos(playerid, 372.3830,-133.2579,1001.4922);
  542. SetPlayerFacingAngle(playerid, 0.4216);
  543. SetCameraBehindPlayer(playerid);
  544. SetPlayerInterior(playerid, 5);
  545. SetPlayerVirtualWorld(playerid, idx+100);
  546. format(string, sizeof(string), "** Welcome to %s's Fast Food (( /list /buy )) **", BizInfo[idx][bOwner]);
  547. SendClientMessage(playerid, COLOR_ORANGE, string);
  548. return 1;
  549. }
  550. else if(BizInfo[idx][bType] == 7) // Casino
  551. {
  552. format(string, sizeof(string), "* %s pushes the door and enters the casino.", RPN(playerid));
  553. SendNearbyMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
  554. SetPlayerPos(playerid, 2233.8032,1712.2303,1011.7632);
  555. SetPlayerFacingAngle(playerid, 0.4216);
  556. SetCameraBehindPlayer(playerid);
  557. SetPlayerInterior(playerid, 1);
  558. SetPlayerVirtualWorld(playerid, idx+100);
  559. format(string, sizeof(string), "** Welcome to %s's Casino (( /list /buy )) **", BizInfo[idx][bOwner]);
  560. SendClientMessage(playerid, COLOR_ORANGE, string);
  561. return 1;
  562. }
  563. }
  564. }
  565. return 1;
  566. }
  567. CMD:exit(playerid, params[])
  568. {
  569. new done, string[128];
  570. if(IsPlayerInRangeOfPoint(playerid, 5, 2233.8032,1712.2303,1011.7632) || IsPlayerInRangeOfPoint(playerid, 2, -27.3025,-57.6649,1003.5469) || IsPlayerInRangeOfPoint(playerid, 2, 207.0638,-139.9965,1003.5078) || IsPlayerInRangeOfPoint(playerid, 2, 285.8044,-85.9956,1001.5229) || IsPlayerInRangeOfPoint(playerid, 2, 493.4252,-24.3061,1000.6797) || IsPlayerInRangeOfPoint(playerid, 2, 834.1631,7.4883,1004.1797) || IsPlayerInRangeOfPoint(playerid, 2, 372.3830,-133.2579,1001.4922))
  571. {
  572. new idx;
  573. idx = GetPlayerVirtualWorld(playerid)-100;
  574. if(!done && idx < MAX_BIZ && BizInfo[idx][bType])
  575. {
  576. if(BizInfo[idx][bX], BizInfo[idx][bY], BizInfo[idx][bZ])
  577. {
  578. idx = GetPlayerVirtualWorld(playerid)-100;
  579. if(!done && idx < MAX_BIZ && BizInfo[idx][bType])
  580. {
  581. SetPlayerPos(playerid, BizInfo[idx][bX], BizInfo[idx][bY], BizInfo[idx][bZ]);
  582. SetPlayerInterior(playerid, 0);
  583. SetPlayerVirtualWorld(playerid, 0);
  584. }
  585. done = 1;
  586. return 1;
  587. }
  588. format(string, sizeof(string), "* %s pushes the door and exits the shop.", RPN(playerid));
  589. if(PlayerInfo[playerid][pMaskOn] == 1)
  590. {
  591. format(string, sizeof(string), "* Stranger pushes the door and exits the shop.");
  592. }
  593. else
  594. {
  595. format(string, sizeof(string), "* %s pushes the door and exits the shop.", RPN(playerid));
  596. }
  597. SendNearbyMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
  598. SetPlayerPos(playerid, BizInfo[idx][bX], BizInfo[idx][bY], BizInfo[idx][bZ]);
  599. SetPlayerInterior(playerid, 0);
  600. SetPlayerVirtualWorld(playerid, 0);
  601. }
  602. done = 1;
  603. }
  604. return 1;
  605. }
  606. CMD:bused(playerid, params[])
  607. {
  608. new string[128];
  609. if(!IsPlayerConnected(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
  610. if(IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command.");
  611. // if(!aDuty[playerid]) return SendClientMessage(playerid, COLOR_GREY, "You are not on admin duty.");
  612. SendClientMessage(playerid, COLOR_ORANGE, "[Used Businesses]:");
  613. for(new idx=1; idx<MAX_BIZ; idx++)
  614. {
  615. if(BizInfo[idx][bType])
  616. {
  617. format(string, sizeof(string), "ID: %d | Type: %s | Level: %d | Price: $%d | Products: %d | Vault: $%d | Owner: %s", idx, RBT(idx), BizInfo[idx][bLevel], BizInfo[idx][bPrice],BizInfo[idx][bProducts], BizInfo[idx][bMoney], BizInfo[idx][bOwner]);
  618. SendClientMessage(playerid, COLOR_ORANGE, string);
  619. }
  620. }
  621. return 1;
  622. }
  623. CMD:bedit(playerid, params[])
  624. {
  625. new bizid, string[128], input;
  626. if(!IsPlayerConnected(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
  627. if(IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You are not an authorized to use this command.");
  628. // if(!aDuty[playerid]) return SendClientMessage(playerid, COLOR_GREY, "You are not on admin duty.");
  629. if(sscanf(params, "s[32]", params))
  630. {
  631. SendClientMessage(playerid, COLOR_WHITE, "USAGE: /bedit [option] [bizid]");
  632. SendClientMessage(playerid, COLOR_GREY, "OPTIONS: location | price | level | products | vault | truckers");
  633. return 1;
  634. }
  635. if(!strcmp(params, "location", true, 8))
  636. {
  637. if(sscanf(params, "s[32]i", params, bizid)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /bedit location [bizid]");
  638. new idx=bizid;
  639. if(!BizInfo[bizid][bType]) return SendClientMessage(playerid, COLOR_GREY, "Invalid business id.");
  640. GetPlayerPos(playerid, BizInfo[bizid][bX], BizInfo[bizid][bY], BizInfo[bizid][bZ]);
  641. DestroyDynamicPickup(BizInfo[bizid][bPickup]);
  642. BizInfo[bizid][bPickup] = CreateDynamicPickup(1272, 1, BizInfo[bizid][bX], BizInfo[bizid][bY], BizInfo[bizid][bZ], 0);
  643. DestroyDynamic3DTextLabel(BizInfo[bizid][bText]);
  644. if(!strcmp("The State", BizInfo[idx][bOwner])) format(string, sizeof(string), "[Business ID: %d]\nBusiness Type: %s\nBusiness Owner: %s\nStatus: For Sale\nPrice: $%d", idx, RBT(idx), BizInfo[idx][bOwner], BizInfo[idx][bPrice]);
  645. else format(string, sizeof(string), "[Business ID: %d]\nBusiness Type: %s\nBusiness Owner: %s\nStatus: %s", idx, RBT(idx), BizInfo[idx][bOwner], RBS(idx));
  646. BizInfo[bizid][bText] = CreateDynamic3DTextLabel(string, COLOR_WHITE, BizInfo[bizid][bX], BizInfo[bizid][bY], BizInfo[bizid][bZ]+0.3, 15);
  647. format(string, sizeof(string), "{FF0000}[Admin Warn]{FF6347} %s has changed business ID %d's location.", NORPN(playerid), bizid);
  648. //SendAdminMessage(COLOR_DARKRED, 1, string);
  649. Log("logs/business.log", string);
  650. }
  651. else if(!strcmp(params, "price", true, 5))
  652. {
  653. if(sscanf(params, "s[32]ii", params, bizid, input)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /bedit price [bizid] [price]");
  654. if(!BizInfo[bizid][bType]) return SendClientMessage(playerid, COLOR_GREY, "Invalid business id.");
  655. if(strcmp("The State", BizInfo[bizid][bOwner])) return SendClientMessage(playerid, COLOR_GREY, "You can't edit the price of owned businesses.");
  656. BizInfo[bizid][bPrice] = input;
  657. format(string, sizeof(string), "[Business ID: %d]\nBusiness Type: %s\nBusiness Owner: %s\nStatus: For Sale\nPrice: $%d", bizid, RBT(bizid), BizInfo[bizid][bOwner], BizInfo[bizid][bPrice]);
  658. UpdateDynamic3DTextLabelText(BizInfo[bizid][bText], COLOR_WHITE, string);
  659. format(string, sizeof(string), "{FF0000}[Admin Warn]{FF6347} %s has set business ID %d's price to $%d.", NORPN(playerid), bizid, input);
  660. //SendAdminMessage(COLOR_DARKRED, 1, string);
  661. Log("logs/business.log", string);
  662. }
  663. else if(!strcmp(params, "level", true, 5))
  664. {
  665. // L1: 0 | L2: 100 | L3: 300 | L4: 700 | L5: 1200
  666. if(sscanf(params, "s[32]ii", params, bizid, input)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /bedit level [bizid] [level]");
  667. if(!BizInfo[bizid][bType]) return SendClientMessage(playerid, COLOR_GREY, "Invalid business id.");
  668. if(input < 0 || input > 5) return SendClientMessage(playerid, COLOR_GREY, "Levels are between 1 and 5.");
  669. BizInfo[bizid][bLevel] = input;
  670. if(input == 1) BizInfo[bizid][bSold] = 0;
  671. if(input == 2) BizInfo[bizid][bSold] = 100;
  672. if(input == 3) BizInfo[bizid][bSold] = 300;
  673. if(input == 4) BizInfo[bizid][bSold] = 700;
  674. if(input == 5) BizInfo[bizid][bSold] = 1200;
  675. format(string, sizeof(string), "{FF0000}[Admin Warn]{FF6347} %s has set business ID %d's level to %d.", NORPN(playerid), bizid, input);
  676. //SendAdminMessage(COLOR_DARKRED, 1, string);
  677. Log("logs/business.log", string);
  678. }
  679. else if(!strcmp(params, "products", true, 8))
  680. {
  681. if(sscanf(params, "s[32]ii", params, bizid, input)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /bedit products [bizid] [amount]");
  682. if(!BizInfo[bizid][bType]) return SendClientMessage(playerid, COLOR_GREY, "Invalid business id.");
  683. if(input < 0) return SendClientMessage(playerid, COLOR_GREY, "Products can't be negative.");
  684. BizInfo[bizid][bProducts] = input;
  685. format(string, sizeof(string), "{FF0000}[Admin Warn]{FF6347} %s has set business ID %d's products to %d.", NORPN(playerid), bizid, input);
  686. //SendAdminMessage(COLOR_DARKRED, 1, string);
  687. Log("logs/business.log", string);
  688. }
  689. else if(!strcmp(params, "vault", true, 5))
  690. {
  691. if(sscanf(params, "s[32]ii", params, bizid, input)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /bedit vault [bizid] [amount]");
  692. if(!BizInfo[bizid][bType]) return SendClientMessage(playerid, COLOR_GREY, "Invalid business id.");
  693. if(input < 0) return SendClientMessage(playerid, COLOR_GREY, "Vault money can't be negative.");
  694. BizInfo[bizid][bMoney] = input;
  695. format(string, sizeof(string), "{FF0000}[Admin Warn]{FF6347} %s has set business ID %d's vault money to $%d.", NORPN(playerid), bizid, input);
  696. //SendAdminMessage(COLOR_DARKRED, 1, string);
  697. Log("logs/business.log", string);
  698. }
  699. else if(!strcmp(params, "truckers", true, 8))
  700. {
  701. if(sscanf(params, "s[32]ii", params, bizid, input)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /bedit truckers [bizid] [type] (1=Accepting | 2=NotAccepting");
  702. if(!BizInfo[bizid][bAP])
  703. {
  704. BizInfo[bizid][bAP] = 1;
  705. format(string, sizeof(string), "{FF0000}[Admin Warn]{FF6347} %s has set business ID %d to accept truckers.", NORPN(playerid), bizid);
  706. //SendAdminMessage(COLOR_DARKRED, 1, string);
  707. Log("logs/business.log", string);
  708. }
  709. else
  710. {
  711. BizInfo[bizid][bAP] = 0;
  712. format(string, sizeof(string), "{FF0000}[Admin Warn]{FF6347} %s has set business ID %d to NOT accept truckers.", NORPN(playerid), bizid);
  713. //SendAdminMessage(COLOR_DARKRED, 1, string);
  714. Log("logs/business.log", string);
  715. }
  716. }
  717. return 1;
  718. }
  719. CMD:gotobiz(playerid, params[])
  720. {
  721. new idx, string[128];
  722. if(!IsPlayerConnected(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
  723. if(IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You are not an authorized to use this command.");
  724. // if(!aDuty[playerid]) return SendClientMessage(playerid, COLOR_GREY, "You are not on admin duty.");
  725. if(sscanf(params, "i", idx)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /gotobiz [bizid]");
  726. if(!BizInfo[idx][bType]) return SendClientMessage(playerid, COLOR_GREY, "Invalid business id.");
  727. SetPlayerVirtualWorld(playerid, 0);
  728. SetPlayerInterior(playerid, 0);
  729. SetPlayerPos(playerid, BizInfo[idx][bX], BizInfo[idx][bY], BizInfo[idx][bZ]);
  730. format(string, sizeof(string), " You have teleported to business ID %d.", idx);
  731. SendClientMessage(playerid, COLOR_WHITE, string);
  732. return 1;
  733. }
  734.  
  735. CMD:asellbiz(playerid, params[])
  736. {
  737. new bizid, string[128];
  738. if(!IsPlayerConnected(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
  739. if(IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You are not an authorized to use this command.");
  740. // if(!aDuty[playerid]) return SendClientMessage(playerid, COLOR_GREY, "You are not on admin duty.");
  741. if(sscanf(params, "i", bizid)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /asellbiz [bizid]");
  742. if(!BizInfo[bizid][bType]) return SendClientMessage(playerid, COLOR_GREY, "Invalid business id.");
  743. if(!strcmp("The State", BizInfo[bizid][bOwner], true)) return SendClientMessage(playerid, COLOR_GREY, "This business is not owned by anybody.");
  744. foreach(Player, i)
  745. {
  746. if(IsPlayerConnected(i) && PlayerInfo[i][pBiz] == bizid)
  747. {
  748. PlayerInfo[i][pBiz] = 0;
  749. format(string, sizeof(string), " Administrator %s has sold your business.", RPN(playerid));
  750. SendClientMessage(i, COLOR_WHITE, string);
  751. }
  752. }
  753. format(string, sizeof(string), "{FF0000}[Admin Warn]{FF6347} %s has sold %s's business. (ID %d)", RPN(playerid), BizInfo[bizid][bOwner], bizid);
  754. //SendAdminMessage(COLOR_DARKRED, 1, string);
  755. Log("logs/business.log", string);
  756. BizInfo[bizid][bStatus] = 0;
  757. format(BizInfo[bizid][bOwner], 32, "The State");
  758. format(string, sizeof(string), "[Business ID: %d]\nBusiness Type: %s\nBusiness Owner: %s\nStatus: For Sale\nPrice: $%d", bizid, RBT(bizid), BizInfo[bizid][bOwner], BizInfo[bizid][bPrice]);
  759. UpdateDynamic3DTextLabelText(BizInfo[bizid][bText], COLOR_WHITE, string);
  760. return 1;
  761. }
  762. stock GivePlayerCash(playerid, money)
  763. {
  764. SetPVarInt(playerid, "Cash", GetPVarInt(playerid, "Cash")+money);
  765. GivePlayerMoney(playerid, money);
  766. return 1;
  767. }
  768. stock fcreate(filename[])
  769. {
  770. if (fexist(filename)) return false;
  771. new File:fhnd;
  772. fhnd=fopen(filename,io_write);
  773. if (fhnd) {
  774. fclose(fhnd);
  775. return true;
  776. }
  777. return false;
  778. }
  779. stock RBT(bizid)
  780. {
  781. new string[24];
  782. if(!BizInfo[bizid][bType]) format(string, sizeof(string), "None");
  783. else if(BizInfo[bizid][bType] == 1) format(string, sizeof(string), "24/7 Market");
  784. else if(BizInfo[bizid][bType] == 2) format(string, sizeof(string), "Clothes Shop");
  785. else if(BizInfo[bizid][bType] == 3) format(string, sizeof(string), "Ammunation");
  786. else if(BizInfo[bizid][bType] == 4) format(string, sizeof(string), "Club");
  787. //else if(BizInfo[bizid][bType] == 5) format(string, sizeof(string), "Advertisement Agency");
  788. else if(BizInfo[bizid][bType] == 5) format(string, sizeof(string), "Adv. Agency");
  789. else if(BizInfo[bizid][bType] == 6) format(string, sizeof(string), "Fast Food");
  790. else if(BizInfo[bizid][bType] == 7) format(string, sizeof(string), "Casino");
  791. return string;
  792. }
  793. stock RHS(bizid)
  794. {
  795. new string[16];
  796. if(!HouseInfo[bizid][hStatus]) format(string, sizeof(string), "Closed");
  797. else if(HouseInfo[bizid][hStatus]) format(string, sizeof(string), "Open");
  798. return string;
  799. }
  800.  
  801. stock RBS(bizid)
  802. {
  803. new string[16];
  804. if(!BizInfo[bizid][bStatus]) format(string, sizeof(string), "Closed");
  805. else if(BizInfo[bizid][bStatus]) format(string, sizeof(string), "Open");
  806. return string;
  807. }
  808.  
  809. stock RPBP(playerid)
  810. {
  811. new string[32];
  812. if(!PlayerInfo[playerid][pBiz]) format(string, sizeof(string), "None");
  813. else if(PlayerInfo[playerid][pBiz]) format(string, sizeof(string), "%d", BizInfo[PlayerInfo[playerid][pBiz]][bProducts]);
  814. return string;
  815. }
  816. stock RPN(playerid)
  817. {
  818. new string[25];
  819. if(PlayerInfo[playerid][pMaskOn] == 0)format(string, sizeof(string), "%s", RemoveUnderScore(playerid));
  820. else if(PlayerInfo[playerid][pMaskOn] == 1)format(string, sizeof(string), "Stranger");
  821. return string;
  822. }
  823. stock Log(sz_fileName[], sz_input[]) {
  824.  
  825. new sz_logEntry[156], i_dateTime[2][3], File: fileHandle = fopen(sz_fileName, io_append);
  826. gettime(i_dateTime[0][0], i_dateTime[0][1], i_dateTime[0][2]);
  827. getdate(i_dateTime[1][0], i_dateTime[1][1], i_dateTime[1][2]);
  828. format(sz_logEntry, sizeof(sz_logEntry), "[%i/%i/%i - %i:%i:%i] %s\r\n", i_dateTime[1][0], i_dateTime[1][1], i_dateTime[1][2], i_dateTime[0][0], i_dateTime[0][1], i_dateTime[0][2], sz_input);
  829. fwrite(fileHandle, sz_logEntry);
  830. return fclose(fileHandle);
  831. }
  832. stock SendNearbyMessage(playerid, Float:radius, string[], col1, col2, col3, col4, col5)
  833. {
  834. new Float:x, Float:y, Float:z;
  835. GetPlayerPos(playerid, x, y, z);
  836. new Float:ix, Float:iy, Float:iz;
  837. new Float:cx, Float:cy, Float:cz;
  838. foreach(Player, i)
  839. {
  840. if(IsPlayerConnected(i))
  841. {
  842. if(GetPlayerInterior(playerid) == GetPlayerInterior(i) && GetPlayerVirtualWorld(playerid) == GetPlayerVirtualWorld(i))
  843. {
  844. GetPlayerPos(i, ix, iy, iz);
  845. cx = (x - ix);
  846. cy = (y - iy);
  847. cz = (z - iz);
  848. if(((cx < radius/16) && (cx > -radius/16)) && ((cy < radius/16) && (cy > -radius/16)) && ((cz < radius/16) && (cz > -radius/16)))
  849. {
  850. SendClientMessage(i, col1, string);
  851. }
  852. else if(((cx < radius/8) && (cx > -radius/8)) && ((cy < radius/8) && (cy > -radius/8)) && ((cz < radius/8) && (cz > -radius/8)))
  853. {
  854. SendClientMessage(i, col2, string);
  855. }
  856. else if(((cx < radius/4) && (cx > -radius/4)) && ((cy < radius/4) && (cy > -radius/4)) && ((cz < radius/4) && (cz > -radius/4)))
  857. {
  858. SendClientMessage(i, col3, string);
  859. }
  860. else if(((cx < radius/2) && (cx > -radius/2)) && ((cy < radius/2) && (cy > -radius/2)) && ((cz < radius/2) && (cz > -radius/2)))
  861. {
  862. SendClientMessage(i, col4, string);
  863. }
  864. else if(((cx < radius) && (cx > -radius)) && ((cy < radius) && (cy > -radius)) && ((cz < radius) && (cz > -radius)))
  865. {
  866. SendClientMessage(i, col5, string);
  867. }
  868. }
  869. }
  870. }
  871. return 1;
  872. }
  873. stock RPNU(playerid)
  874. {
  875. new name[MAX_PLAYER_NAME];
  876. GetPlayerName(playerid, name, sizeof(name));
  877. return name;
  878. }
  879. stock NORPN(playerid)
  880. {
  881. new astring[25];
  882. if(PlayerInfo[playerid][pHideOn] == 0)format(astring, sizeof(astring), "%s", RemoveUnderScore(playerid));
  883. else if(PlayerInfo[playerid][pHideOn] == 1)format(astring, sizeof(astring), "Anon");
  884. return astring;
  885. }
  886. stock RemoveUnderScore(playerid)
  887. {
  888. new name[MAX_PLAYER_NAME];
  889. GetPlayerName(playerid,name,sizeof(name));
  890. for(new i = 0; i < MAX_PLAYER_NAME; i++)
  891. {
  892. if(name[i] == '_') name[i] = ' ';
  893. }
  894. return name;
  895. }
  896. stock split(const strsrc[], strdest[][], delimiter)
  897. {
  898. new i, li;
  899. new aNum;
  900. new len;
  901. while(i <= strlen(strsrc))
  902. {
  903. if(strsrc[i] == delimiter || i == strlen(strsrc))
  904. {
  905. len = strmid(strdest[aNum], strsrc, li, i, 128);
  906. strdest[aNum][len] = 0;
  907. li = i+1;
  908. aNum++;
  909. }
  910. i++;
  911. }
  912. return 1;
  913. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement