Advertisement
Guest User

Bands Filterscript by John Ridar

a guest
Dec 30th, 2012
950
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 16.01 KB | None | 0 0
  1. //Bands like in Real Life or Gang Band for Radios!
  2. //Created by zohartrejx aka John Ridar!
  3. //unique do not release it
  4. #include <a_samp>
  5. #include <zcmd>
  6. //WARNING It Requirest ZCMD To Run it!
  7. //Including Colors. WARNING: Some of them are Custom Made by zohartrejx
  8. #define COLOR_LIGHTBLUE 0x33CCFFAA
  9. #define COLOR_RED 0xAA3333AA
  10. #define COLOR_GREY 0xAFAFAFAA
  11. #define COLOR_YELLOW 0xFFFF00AA
  12. #define COLOR_PINK 0xFF66FFAA
  13. #define COLOR_BLUE 0x0000BBAA
  14. #define COLOR_WHITE 0xFFFFFFAA
  15. #define COLOR_DARKRED 0x660000AA
  16. #define COLOR_ORANGE 0xFF9900AA
  17. #define COLOR_BRIGHTRED 0xFF0000AA
  18. #define COLOR_INDIGO 0x4B00B0AA
  19. #define COLOR_VIOLET 0x9955DEEE
  20. #define COLOR_LIGHTRED 0xFF99AADD
  21. #define COLOR_SEAGREEN 0x00EEADDF
  22. #define COLOR_GRAYWHITE 0xEEEEFFC4
  23. #define COLOR_LIGHTNEUTRALBLUE 0xabcdef66
  24. #define COLOR_GREENISHGOLD 0xCCFFDD56
  25. #define COLOR_LIGHTBLUEGREEN 0x0FFDD349
  26. #define COLOR_NEUTRALBLUE 0xABCDEF01
  27. #define COLOR_LIGHTCYAN 0xAAFFCC33
  28. #define COLOR_LEMON 0xDDDD2357
  29. #define COLOR_MEDIUMBLUE 0x63AFF00A
  30. #define COLOR_NEUTRAL 0xABCDEF97
  31. #define COLOR_BLACK 0x00000000
  32. #define COLOR_NEUTRALGREEN 0x81CFAB00
  33. #define COLOR_DARKGREEN 0x12900BBF
  34. #define COLOR_LIGHTGREEN 0x24FF0AB9
  35. #define COLOR_DARKBLUE 0x300FFAAB
  36. #define COLOR_BLUEGREEN 0x46BBAA00
  37. #define COLOR_PINK 0xFF66FFAA
  38. #define COLOR_LIGHTBLUE 0x33CCFFAA
  39. #define COLOR_DARKRED 0x660000AA
  40. #define COLOR_ORANGE 0xFF9900AA
  41. #define COLOR_PURPLE 0x800080AA
  42. #define COLOR_GRAD1 0xB4B5B7FF
  43. #define COLOR_GRAD2 0xBFC0C2FF
  44. #define COLOR_RED1 0xFF0000AA
  45. #define COLOR_GREY 0xAFAFAFAA
  46. #define COLOR_GREEN 0x33AA33AA
  47. #define COLOR_RED 0xAA3333AA
  48. #define COLOR_YELLOW 0xFFFF00AA
  49. #define COLOR_WHITE 0xFFFFFFAA
  50. #define COLOR_BROWN 0x993300AA
  51. #define COLOR_CYAN 0x99FFFFAA
  52. #define COLOR_TAN 0xFFFFCCAA
  53. #define COLOR_PINK 0xFF66FFAA
  54. #define COLOR_KHAKI 0x999900AA
  55. #define COLOR_LIME 0x99FF00AA
  56. #define COLOR_SYSTEM 0xEFEFF7AA
  57. #define COLOR_GRAD2 0xBFC0C2FF
  58. #define COLOR_GRAD4 0xD8D8D8FF
  59. #define COLOR_GRAD6 0xF0F0F0FF
  60. #define COLOR_GRAD2 0xBFC0C2FF
  61. #define COLOR_GRAD3 0xCBCCCEFF
  62. #define COLOR_GRAD5 0xE3E3E3FF
  63. #define COLOR_GRAD1 0xB4B5B7FF
  64. //Variables
  65. #define MAX_BANDS 10 // Changed to Max Groups 10 for no Abuses. You can change to max up to 500!
  66.  
  67. enum ginfo
  68. {
  69. grname[75],
  70. leader,
  71. active
  72. };
  73.  
  74. enum pginfo
  75. {
  76. gid,
  77. order,
  78. invited,
  79. attemptjoin
  80. };
  81.  
  82. new BAND[MAX_PLAYERS][pginfo];
  83. new BANDinfo[MAX_BANDS][ginfo];
  84.  
  85. public OnFilterScriptInit()
  86. {
  87. for(new x; x<MAX_PLAYERS; x++)
  88. {
  89. BAND[x][gid] = -1;
  90. BAND[x][order] = -1;
  91. BAND[x][invited] = -1;
  92. BAND[x][attemptjoin] = -1;
  93. }
  94. print(" Band filterscript by JR is started :)! ");
  95. return 1;
  96. }
  97.  
  98. public OnPlayerConnect(playerid)
  99. {
  100. BAND[playerid][gid] = -1;
  101. BAND[playerid][invited] = -1;
  102. BAND[playerid][attemptjoin] = -1;
  103. return 1;
  104. }
  105.  
  106. public OnPlayerDisconnect(playerid, reason)
  107. {
  108. LeaveBAND(playerid, 2);
  109. return 1;
  110. }
  111.  
  112. COMMAND:bandcreate(playerid, params[])
  113. {
  114. if(BAND[playerid][gid] != -1) return SendClientMessage(playerid, 0xFF0000, "Leave your band with {FFFFFF}/Bandleave{FF0000} before creating a new one!");
  115. if(strlen(params) > 49 || strlen(params) < 3) return SendClientMessage(playerid, 0xFF0000, "Usage: {FFFFFF}/Bandcreate{FF0000} (Band name 3-50 characters)!");
  116. if(IsBANDTaken(params)) return SendClientMessage(playerid, 0xFF0000, "ERROR: Band name is already in Use!");
  117. CreateBAND(params, playerid);
  118. return 1;
  119. }
  120.  
  121. COMMAND:bandleave(playerid, params[])
  122. {
  123. if(BAND[playerid][gid] == -1) return SendClientMessage(playerid, 0xFF0000, "ERROR:You are not in a Band to leave one!");
  124. LeaveBAND(playerid, 0);
  125. return 1;
  126. }
  127.  
  128. COMMAND:bandinvite(playerid, params[])
  129. {
  130. if(BAND[playerid][order] != 1) return SendClientMessage(playerid, 0xFF0000, "You are not the leader of the band, you cannot invite people!");
  131. new cid;
  132. if(isnull(params)) return SendClientMessage(playerid, 0xFF0000, "Usage: {FFFFFF}/Bandinvite{FF0000} (playerid)");
  133. cid = strval(params);
  134. if(!IsPlayerConnected(cid)) return SendClientMessage(playerid, 0xFF0000, "Player Is not connected!");
  135. if(BAND[cid][gid] == BAND[playerid][gid]) return SendClientMessage(playerid, 0xFF0000, "Player Is already in your band!");
  136. if(BAND[cid][invited] == BAND[playerid][gid]) return SendClientMessage(playerid, 0xFF0000, "Player has already been invited to your band!");
  137. if(BAND[cid][attemptjoin] == BAND[playerid][gid]) return BANDJoin(cid, BAND[playerid][gid]);
  138. BAND[cid][invited] = BAND[playerid][gid];
  139. new string[125], pname[24];
  140. GetPlayerName(playerid, pname, 24);
  141. format(string, sizeof(string), "You have been invited to join Band {FFFFFF}%s(%d){FFCC66} by {FFFFFF}%s(%d). /Bandjoin %d", BANDinfo[BAND[playerid][gid]][grname], BAND[playerid][gid], pname, playerid, BAND[playerid][gid]);
  142. SendClientMessage(cid, 0xFFCC66, string);
  143. GetPlayerName(cid, pname, 24);
  144. format(string, sizeof(string), "You have invited {FFFFFF}%s(%d){FFCC66} to join your band!", pname, cid);
  145. SendClientMessage(playerid, 0xFFCC66, string);
  146. return 1;
  147. }
  148.  
  149. COMMAND:bandowner(playerid, params[])
  150. {
  151. if(BAND[playerid][order] != 1) return SendClientMessage(playerid, 0xFF0000, "You are not the leader of the band, you cannot change the leader!");
  152. new cid;
  153. if(isnull(params)) return SendClientMessage(playerid, 0xFF0000, "Usage: {FFFFFF}/bandowner{FF0000} (playerid)");
  154. cid = strval(params);
  155. if(!IsPlayerConnected(cid)) return SendClientMessage(playerid, 0xFF0000, "Player Is not connected!");
  156. if(cid == playerid) return SendClientMessage(playerid, 0xFF0000, "ERROR: You are Band Owner :D!");
  157. if(BAND[playerid][gid] != BAND[cid][gid]) return SendClientMessage(playerid, 0xFF0000, "Player Is not in your band!");
  158. ChangeMemberOrder(BAND[playerid][gid], 1);
  159. BAND[playerid][order] = BANDMembers(BAND[playerid][gid]);
  160. return 1;
  161. }
  162.  
  163. COMMAND:bandhelp(playerid, params[])
  164. {
  165. SendClientMessage(playerid, 0xFF0000, "|-----------Band Help by John Rider---------------------|");
  166. SendClientMessage(playerid, 0xFF0000, "| /bandcreate,/bands,/bandjoin,/bandowner |");
  167. SendClientMessage(playerid, 0xFF0000, "| /bandkick,/bm,/bandlist,/bandinvite,/bstats |");
  168. SendClientMessage(playerid, 0xFF0000, "| /bm = IC Radio. /bmooc = OOC Radio |");
  169. SendClientMessage(playerid, COLOR_RED, "| All has been Created by John Ridar! aka Zohartrejx | ");
  170. SendClientMessage(playerid, 0xFF0000, "|-----------------End of Help---------------------------|");
  171. return 1;
  172. }
  173.  
  174. COMMAND:bandjoin(playerid, params[])
  175. {
  176. if(BAND[playerid][gid] != -1) return SendClientMessage(playerid, 0xFF0000, "You are already in a band! Leave your current one before joining another one!");
  177. new grid;
  178. if( (isnull(params) && BAND[playerid][invited] != -1 ) || ( strval(params) == BAND[playerid][invited] && BAND[playerid][invited] != -1) ) return BANDJoin(playerid, BAND[playerid][invited]);
  179. if(isnull(params)) return SendClientMessage(playerid, 0xFF0000, "Usage: {FFFFFF}/BANDjoin{FF0000} (bandid)");
  180. grid = strval(params);
  181. if(!BANDinfo[grid][active]) return SendClientMessage(playerid, COLOR_RED, "ERROR: You wanted to join band which doesnt Exsist!!");
  182. BAND[playerid][attemptjoin] = grid;
  183. new string[125], pname[24];
  184. GetPlayerName(playerid, pname, 24);
  185. format(string, sizeof(string), "You have requested to join band %s(ID:%d)", BANDinfo[grid][grname], grid);
  186. SendClientMessage(playerid, 0xFFCC66, string);
  187. format(string, sizeof(string), "{FFFFFF}%s(%d) {FFCC66}has requested to join your band. Type /Bandinvite %d to accept him!", pname, playerid, playerid);
  188. SendMessageToLeader(grid, string);
  189. return 1;
  190. }
  191.  
  192. COMMAND:bandkick(playerid, params[])
  193. {
  194. if(BAND[playerid][order] != 1) return SendClientMessage(playerid, COLOR_RED, "ERROR:You are not the leader of a band, you cannot kick!");
  195. new cid;
  196. if(isnull(params)) return SendClientMessage(playerid, 0xFF0000, "Usage: {FFFFFF}/Bandkick{FF0000} (playerid)");
  197. cid = strval(params);
  198. if(!IsPlayerConnected(cid)) return SendClientMessage(playerid, 0xFF0000, "Player Is not connected!");
  199. if(cid == playerid) return SendClientMessage(playerid, 0xFF0000, "You cannot kick yourself, silly.");
  200. if(BAND[playerid][gid] != BAND[cid][gid]) return SendClientMessage(playerid, 0xFF0000, "Player Is not in your band!");
  201. LeaveBAND(cid, 1);
  202. return 1;
  203. }
  204.  
  205. COMMAND:bm(playerid, params[])
  206. {
  207. if(BAND[playerid][gid] == -1) return SendClientMessage(playerid, 0xFF0000, "ERROR: You are not in Band. You cannot Talk over Radio!");
  208. if(isnull(params)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /bm [message]. WARNING! Its ICly!");
  209. new pname[24], string[140+24];
  210. GetPlayerName(playerid, pname, 24);
  211. format(string, sizeof(string), "%s(%d): %s", pname, playerid, params);
  212. SendMessageToAllBANDMembers(BAND[playerid][gid], string);
  213. return 1;
  214. }
  215. COMMAND:bmooc(playerid, params[])
  216. {
  217. if(BAND[playerid][gid] == -1) return SendClientMessage(playerid, 0xFF0000, "ERROR: You are not in Band. You cannot Talk over Radio!");
  218. if(isnull(params)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /bm [message]. WARNING! Its OOCly!");
  219. new pname[24], string[140+24];
  220. GetPlayerName(playerid, pname, 24);
  221. format(string, sizeof(string), "((%s(%d): %s ))", pname, playerid, params);
  222. SendMessageToAllBANDMembers(BAND[playerid][gid], string);
  223. return 1;
  224. }
  225. COMMAND:bstats(playerid, params[])
  226. {
  227. if(BAND[playerid][gid] == -1) return SendClientMessage(playerid, COLOR_GREEN, "ERROR: You are not in band. To check Band Stats, go in your band!");
  228. SendClientMessage(playerid, COLOR_GREEN ,"Warning: Band Stats are Currently Under Construction! Need ideas for it. ");
  229. return 1;
  230. }
  231.  
  232. COMMAND:bandlist(playerid, params[])
  233. {
  234. if(isnull(params) && BAND[playerid][gid] == -1) return SendClientMessage(playerid, 0xFF0000, "Usage: {FFFFFF}/BANDlist{FF0000} (BAND)");
  235. if(isnull(params))
  236. {
  237. DisplayBANDMembers(BAND[playerid][gid], playerid);
  238. return 1;
  239. }
  240. new grid = strval(params);
  241. if(!BANDinfo[grid][active]) return SendClientMessage(playerid, 0xFF0000, "The band ID you have entered is not active!");
  242. DisplayBANDMembers(grid, playerid);
  243. return 1;
  244. }
  245.  
  246. COMMAND:bands(playerid, params[])
  247. {
  248. ListBANDs(playerid);
  249. return 1;
  250. }
  251.  
  252. COMMAND:grl(playerid, params[])
  253. return cmd_bandleave(playerid, params);
  254.  
  255. COMMAND:grc(playerid, params[])
  256. return cmd_bandcreate(playerid, params);
  257.  
  258. COMMAND:gri(playerid, params[])
  259. return cmd_bandinvite(playerid, params);
  260.  
  261. COMMAND:grlead(playerid, params[])
  262. return cmd_bandowner(playerid, params);
  263.  
  264. COMMAND:grj(playerid, params[])
  265. return cmd_bandjoin(playerid, params);
  266.  
  267. COMMAND:grk(playerid, params[])
  268. return cmd_bandkick(playerid, params);
  269.  
  270. COMMAND:gm(playerid, params[])
  271. return cmd_bm(playerid, params);
  272.  
  273. COMMAND:grlist(playerid, params[])
  274. return cmd_bandlist(playerid, params);
  275.  
  276.  
  277. stock DisplayBANDMembers(BANDid, playerid)
  278. {
  279. new amount[2], string[200], shortstr[55], pname[24];
  280. format(string, sizeof(string), "Band Members for %s(ID:%d)", BANDinfo[BANDid][grname], BANDid);
  281. SendClientMessage(playerid, 0xFFFFFF, string);
  282. string = "";
  283. for(new x; x<MAX_PLAYERS; x++)
  284. {
  285. if(BAND[x][gid] == BANDid)
  286. {
  287. amount[0] ++;
  288. amount[1] ++;
  289. GetPlayerName(x, pname, 24);
  290. if(BANDinfo[BANDid][leader] != x) format(shortstr, sizeof(shortstr), "%s(%d),", pname, x);
  291. if(BANDinfo[BANDid][leader] == x) format(shortstr, sizeof(shortstr), "[BOSS]%s(%d),", pname, x);
  292. if(amount[1] == 1) format(string, sizeof(string), "%s", shortstr);
  293. if(amount[1] != 1) format(string, sizeof(string), "%s %s", string, shortstr);
  294. if(amount[0] == 6)
  295. {
  296. strdel(string, strlen(string)-1, strlen(string));
  297. SendClientMessage(playerid, 0xFFCC66, string);
  298. string = "";
  299. amount[0] = 0;
  300. }
  301. }
  302. }
  303. strdel(string, strlen(string)-1, strlen(string));
  304. if(amount[0] != 0) SendClientMessage(playerid, 0xFFCC66, string);
  305. return 1;
  306. }
  307.  
  308. stock ListBANDs(playerid)
  309. {
  310. new amount[2], string[200], shortstr[55];
  311. SendClientMessage(playerid, 0xFFFFFF, "Current Active Bands:");
  312. for(new x=0; x<MAX_BANDS; x++)
  313. {
  314. if(BANDinfo[x][active])
  315. {
  316. amount[0] ++;
  317. amount[1] ++;
  318. format(shortstr, sizeof(shortstr), "%s(ID:%d)", BANDinfo[x][grname], x);
  319. if(amount[1] == 1) format(string, sizeof(string), "%s", shortstr);
  320. if(amount[1] != 1) format(string, sizeof(string), "%s %s", string, shortstr);
  321. if(amount[0] == 4)
  322. {
  323. SendClientMessage(playerid, 0xFFCC66, string);
  324. string = "";
  325. amount[0] = 0;
  326. }
  327. }
  328. }
  329. if(amount[1] == 0) SendClientMessage(playerid, 0xFFFF00, "There are currently no active bands!");
  330. if(amount[1] != 0) SendClientMessage(playerid, 0xFFCC66, string);
  331. return 1;
  332. }
  333.  
  334.  
  335.  
  336.  
  337. stock SendMessageToLeader(BANDi, message[])
  338. return SendClientMessage(BANDinfo[BANDi][leader], 0xFFCC66, message);
  339.  
  340. stock BANDJoin(playerid, BANDi)
  341. {
  342. BAND[playerid][gid] = BANDi;
  343. BAND[playerid][order] = BANDMembers(BANDi);
  344. BAND[playerid][attemptjoin] = -1;
  345. BAND[playerid][invited] = -1;
  346. new pname[24], string[130];
  347. GetPlayerName(playerid, pname, 24);
  348. format(string, sizeof(string), "%s has joined your band!", pname);
  349. SendMessageToAllBANDMembers(BANDi, string);
  350. format(string, sizeof(string), "You have joined band %s(ID:%d)", BANDinfo[BANDi][grname] ,BANDi);
  351. SendClientMessage(playerid, 0xFFCC66, string);
  352. return 1;
  353. }
  354.  
  355. stock FindNextSlot()
  356. {
  357. new id;
  358. while(BANDinfo[id][active]) id ++;
  359. return id;
  360. }
  361.  
  362. stock IsBANDTaken(grpname[])
  363. {
  364. for(new x; x<MAX_BANDS; x++)
  365. {
  366. if(BANDinfo[x][active] == 1)
  367. {
  368. if(!strcmp(grpname, BANDinfo[x][grname], true) && strlen(BANDinfo[x][grname]) != 0) return 1;
  369. }
  370. }
  371. return 0;
  372. }
  373.  
  374. stock BANDInvite(playerid, BANDid)
  375. return BAND[playerid][invited] = BANDid;
  376.  
  377. stock CreateBAND(grpname[], owner)
  378. {
  379. new slotid = FindNextSlot();
  380. BANDinfo[slotid][leader] = owner;
  381. format(BANDinfo[slotid][grname], 75, "%s", grpname);
  382. BANDinfo[slotid][active] = 1;
  383. BAND[owner][gid] = slotid;
  384. BAND[owner][order] = 1;
  385. new string[120];
  386. format(string, sizeof(string), "You have created the band %s(ID:%d)", grpname, slotid);
  387. SendClientMessage(owner, 0xFFCC66, string);
  388. return slotid;
  389. }
  390.  
  391. stock LeaveBAND(playerid, reason)
  392. {
  393. new BANDid = BAND[playerid][gid], orderid = BAND[playerid][order], string[100], pname[24];
  394. BAND[playerid][gid] = -1;
  395. BAND[playerid][order] = -1;
  396. BANDCheck(BANDid, orderid);
  397. GetPlayerName(playerid, pname, 24);
  398. if(reason == 0)
  399. {
  400. format(string, sizeof(string), "{FFFFFF}%s(%d){FFCC66} has left your band!", pname, playerid);
  401. SendClientMessage(playerid, 0xFFCC66, "You have left your band");
  402. }
  403. if(reason == 1)
  404. {
  405. format(string, sizeof(string), "{FFFFFF}%s(%d){FFCC66} has left your band (Kicked by the leader)!", pname, playerid);
  406. SendClientMessage(playerid, 0xFFCC66, "You have been kicked from your band!");
  407. }
  408. if(reason == 2) format(string, sizeof(string), "{FFFFFF}%s(%d){FFCC66} has left your band (Disconnected)!", pname, playerid);
  409. SendMessageToAllBANDMembers(BANDid, string);
  410. return 1;
  411. }
  412.  
  413. stock BANDCheck(BANDid, orderid)
  414. {
  415. new gmems = BANDMembers(BANDid);
  416. if(!gmems) BANDinfo[BANDid][active] = 0;
  417. if(gmems != 0) ChangeMemberOrder(BANDid, orderid);
  418. return 1;
  419. }
  420.  
  421. stock BANDMembers(BANDid)
  422. {
  423. if(!BANDinfo[BANDid][active]) return 0;
  424. new BANDmembers;
  425. for(new i; i<MAX_PLAYERS; i++) if(BAND[i][gid] == BANDid) BANDmembers++;
  426. return BANDmembers;
  427. }
  428.  
  429. stock ChangeMemberOrder(BANDid, orderid)
  430. {
  431. for(new x; x<MAX_PLAYERS; x++)
  432. {
  433. if(BAND[x][gid] != BANDid || BAND[x][order] < orderid) continue;
  434. BAND[x][order] --;
  435. if(BAND[x][order] == 1)
  436. {
  437. BANDinfo[BANDid][leader] = x;
  438. new string[128], pname[24];
  439. GetPlayerName(x, pname, 24);
  440. format(string, sizeof(string), "{FFFFFF}%s(%d){FFCC66} Has been Promoted to the new Band Leader! Congratiulations!", pname, x);
  441. SendMessageToAllBANDMembers(BANDid, string);
  442. }
  443. }
  444. return 1;
  445. }
  446.  
  447. stock SendMessageToAllBANDMembers(BANDid, message[])
  448. {
  449. if(!BANDinfo[BANDid][active]) return 0;
  450. for(new x; x<MAX_PLAYERS; x++) if(BAND[x][gid] == BANDid) SendClientMessage(x, 0xFFCC66, message);
  451. return 1;
  452. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement