Advertisement
Guest User

Business System

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