Advertisement
Guest User

Help me !

a guest
Jan 2nd, 2016
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 15.69 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.  
  68. enum ginfo
  69. {
  70.     grname[75],
  71.     leader,
  72.     active
  73. };
  74.  
  75. enum pginfo
  76. {
  77.     gid,
  78.     order,
  79.     invited,
  80.     attemptjoin
  81. };
  82.  
  83. new BAND[MAX_PLAYERS][pginfo];
  84. new BANDinfo[MAX_BANDS][ginfo];
  85.  
  86. public OnFilterScriptInit()
  87. {
  88.     for(new x; x<MAX_PLAYERS; x++)
  89.     {
  90.         BAND[x][gid] = -1;
  91.         BAND[x][order] = -1;
  92.         BAND[x][invited] = -1;
  93.         BAND[x][attemptjoin] = -1;
  94.     }
  95.     print(" Band filterscript by JR is started :)!  ");
  96.     return 1;
  97. }
  98.  
  99. public OnPlayerConnect(playerid)
  100. {
  101.     BAND[playerid][gid] = -1;
  102.     BAND[playerid][invited] = -1;
  103.     BAND[playerid][attemptjoin] = -1;
  104.     return 1;
  105. }
  106.  
  107. public OnPlayerDisconnect(playerid, reason)
  108. {
  109.     return 1;
  110. }
  111.  
  112. COMMAND:gangcreate(playerid, params[])
  113. {
  114.     if(BAND[playerid][gid] != -1) return SendClientMessage(playerid, 0xFF0000, "Leave your band with {FFFFFF}/Gangleave{FF0000} before creating a new one!");
  115.     if(strlen(params) > 49 || strlen(params) < 3) return SendClientMessage(playerid, 0xFF0000, "Usage: {FFFFFF}/Gangcreate{FF0000} (Gang name 3-50 characters)!");
  116.     if(IsBANDTaken(params)) return SendClientMessage(playerid, 0xFF0000, "ERROR: Gang name is already in Use!");
  117.     if(GetPlayerScore(playerid) < 500) return SendClientMessage(playerid, 0xFF0000, "You can't Create gang if your score under 500 !");
  118.     CreateBAND(params, playerid);
  119.     return 1;
  120. }
  121.  
  122. COMMAND:gangleave(playerid, params[])
  123. {
  124.     if(BAND[playerid][gid] == -1) return SendClientMessage(playerid, 0xFF0000, "ERROR:You are not in a Gang to leave one!");
  125.     LeaveBAND(playerid, 0);
  126.     return 1;
  127. }
  128. COMMAND:gangaccept(playerid, params[])
  129. {
  130.     if(BAND[playerid][order] != 1) return SendClientMessage(playerid, 0xFF0000, "You are not the leader of the Gang, you cannot invite people!");
  131.     new cid;
  132.     if(isnull(params)) return SendClientMessage(playerid, 0xFF0000, "Usage: {FFFFFF}/Gangaccept{FF0000} [id]");
  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(ID.%d){FFCC66} by {FFFFFF}%s(ID.%d). /Gangjoin %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(ID.%d){FFCC66} to join your band!", pname, cid);
  145.     SendClientMessage(playerid, 0xFFCC66, string);
  146.     return 1;
  147. }
  148.  
  149. COMMAND:gangowner(playerid, params[])
  150. {
  151.     if(BAND[playerid][order] != 1) return SendClientMessage(playerid, 0xFF0000, "You are not the leader of the Gang, you cannot change the leader!");
  152.     new cid;
  153.     if(isnull(params)) return SendClientMessage(playerid, 0xFF0000, "Usage: {FFFFFF}/Gangowner{FF0000} [id]");
  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 now Gang Leader :D!");
  157.     if(BAND[playerid][gid] != BAND[cid][gid]) return SendClientMessage(playerid, 0xFF0000, "Player Is not in your Gang!");
  158.     ChangeMemberOrder(BAND[playerid][gid], 1);
  159.     BAND[playerid][order] = BANDMembers(BAND[playerid][gid]);
  160.     return 1;
  161. }
  162. COMMAND:gangjoin(playerid, params[])
  163. {
  164.     if(BAND[playerid][gid] != -1) return SendClientMessage(playerid, 0xFF0000, "You are already in a Gang! Leave your current one before joining another one!");
  165.     new grid;
  166.     if( (isnull(params) && BAND[playerid][invited] != -1 ) || ( strval(params) == BAND[playerid][invited] && BAND[playerid][invited] != -1) ) return BANDJoin(playerid, BAND[playerid][invited]);
  167.     if(isnull(params)) return SendClientMessage(playerid, 0xFF0000, "Usage: {FFFFFF}/Gangjoin{FF0000} [id]");
  168.     grid = strval(params);
  169.     if(!BANDinfo[grid][active]) return SendClientMessage(playerid, COLOR_RED, "ERROR: You wanted to join band which doesnt Exsist!!");
  170.     BAND[playerid][attemptjoin] = grid;
  171.     new string[125], pname[24];
  172.     GetPlayerName(playerid, pname, 24);
  173.     format(string, sizeof(string), "You have requested to join band %s(ID:%d)", BANDinfo[grid][grname], grid);
  174.     SendClientMessage(playerid, 0xFFCC66, string);
  175.     format(string, sizeof(string), "{FFFFFF}%s(ID.%d) {FFCC66}has requested to join your Gang. Type /Gangaccept %d to accept him!", pname, playerid, playerid);
  176.     SendMessageToLeader(grid, string);
  177.     return 1;
  178. }
  179.  
  180. COMMAND:gangkick(playerid, params[])
  181. {
  182.     if(BAND[playerid][order] != 1) return SendClientMessage(playerid, COLOR_RED, "ERROR:You are not the leader of a Gang, you cannot kick!");
  183.     new cid;
  184.     if(isnull(params)) return SendClientMessage(playerid, 0xFF0000, "Usage: {FFFFFF}/Gangkick{FF0000} [id]");
  185.     cid = strval(params);
  186.     if(!IsPlayerConnected(cid)) return SendClientMessage(playerid, 0xFF0000, "Player Is not connected!");
  187.     if(cid == playerid)  return SendClientMessage(playerid, 0xFF0000, "You cannot kick yourself, silly.");
  188.     if(BAND[playerid][gid] != BAND[cid][gid]) return SendClientMessage(playerid, 0xFF0000, "Player Is not in your Gang!");
  189.     LeaveBAND(cid, 1);
  190.     return 1;
  191. }
  192. COMMAND:bm(playerid, params[])
  193. {
  194.     if(BAND[playerid][gid] == -1) return SendClientMessage(playerid, 0xFF0000, "ERROR: You are not in Band. You cannot Talk over Radio!");
  195.     if(isnull(params)) return SendClientMessage(playerid, COLOR_RED, "USAGE: ! [message]. WARNING! Its ICly!");
  196.     new pname[24], string[140+24];
  197.     GetPlayerName(playerid, pname, 24);
  198.     format(string, sizeof(string), "%s(ID.%d): %s", pname, playerid, params);
  199.     SendMessageToAllBANDMembers(BAND[playerid][gid], string);
  200.     return 1;
  201. }
  202. COMMAND:gangsinfo(playerid, params[])
  203. {
  204.     if(BAND[playerid][gid] == -1) return SendClientMessage(playerid, COLOR_GREEN, "ERROR: You are not in Gang. To check Gang Stats, go in your Gang!");
  205.     SendClientMessage(playerid, COLOR_GREEN ,"Warning: Gang Stats are Currently Under Construction! Need ideas for it. ");
  206.     return 1;
  207. }
  208.  
  209. COMMAND:ganglist(playerid, params[])
  210. {
  211.     if(isnull(params) && BAND[playerid][gid] == -1) return SendClientMessage(playerid, 0xFF0000, "Usage: {FFFFFF}/Ganglist{FF0000} [id]");
  212.     if(isnull(params))
  213.     {
  214.         DisplayBANDMembers(BAND[playerid][gid], playerid);
  215.         return 1;
  216.     }
  217.     new grid = strval(params);
  218.     if(!BANDinfo[grid][active]) return SendClientMessage(playerid, 0xFF0000, "The band ID you have entered is not active!");
  219.     DisplayBANDMembers(grid, playerid);
  220.     return 1;
  221. }
  222.  
  223. COMMAND:gangs(playerid, params[])
  224. {
  225.     ListBANDs(playerid);
  226.     return 1;
  227. }
  228.  
  229. COMMAND:grl(playerid, params[])
  230.     return cmd_gangleave(playerid, params);
  231.  
  232. COMMAND:grc(playerid, params[])
  233.     return cmd_gangcreate(playerid, params);
  234.  
  235. COMMAND:gri(playerid, params[])
  236.     return cmd_gangaccept(playerid, params);
  237.  
  238. COMMAND:grlead(playerid, params[])
  239.     return cmd_gangowner(playerid, params);
  240.  
  241. COMMAND:grj(playerid, params[])
  242.     return cmd_gangjoin(playerid, params);
  243.  
  244. COMMAND:grk(playerid, params[])
  245.     return cmd_gangkick(playerid, params);
  246.  
  247. COMMAND:gm(playerid, params[])
  248.     return cmd_bm(playerid, params);
  249.  
  250. COMMAND:grlist(playerid, params[])
  251.     return cmd_ganglist(playerid, params);
  252.  
  253. CMD:ganghelp(playerid,params[])
  254. {
  255.     SendClientMessage(playerid,0xFFFFFF,"For Create gang type /gangcreate [name]");
  256.     SendClientMessage(playerid,0xFFFFFF,"For leave gang type /gangleave");
  257.     SendClientMessage(playerid,0xFFFFFF,"For accept Join Type /gangaccept");
  258.     SendClientMessage(playerid,0xFFFFFF,"For Change gang owner type /gangowner");
  259.     SendClientMessage(playerid,0xFFFFFF,"For Join Gang type /gangjoin");
  260.     SendClientMessage(playerid,0xFFFFFF,"For Kick Members gang type /gangkick");
  261.     SendClientMessage(playerid,0xFFFFFF,"For Chat On Gang type /bm [text]");
  262.     SendClientMessage(playerid,0xFFFFFF,"For see Gang members type /ganglist");
  263.     SendClientMessage(playerid,0xFFFFFF,"For see Exist members type /gangs");
  264.     SendClientMessage(playerid,0xFFFFFF,"For see List gang type /ganglist");
  265.     return 1;
  266. }
  267. stock DisplayBANDMembers(BANDid, playerid)
  268. {
  269.     new amount[2], string[200], shortstr[55], pname[24];
  270.     format(string, sizeof(string), "Band Members for %s(ID:%d)", BANDinfo[BANDid][grname], BANDid);
  271.     SendClientMessage(playerid, 0xFFFFFF, string);
  272.     string = "";
  273.     for(new x; x<MAX_PLAYERS; x++)
  274.     {
  275.         if(BAND[x][gid] == BANDid)
  276.         {
  277.             amount[0] ++;
  278.             amount[1] ++;
  279.             GetPlayerName(x, pname, 24);
  280.             if(BANDinfo[BANDid][leader] != x) format(shortstr, sizeof(shortstr), "%s(%d),", pname, x);
  281.             if(BANDinfo[BANDid][leader] == x) format(shortstr, sizeof(shortstr), "[Leader]%s(%d),", pname, x);
  282.             if(amount[1] == 1) format(string, sizeof(string), "%s", shortstr);
  283.             if(amount[1] != 1) format(string, sizeof(string), "%s %s", string, shortstr);
  284.             if(amount[0] == 6)
  285.             {
  286.                 strdel(string, strlen(string)-1, strlen(string));
  287.                 SendClientMessage(playerid, 0xFFCC66, string);
  288.                 string = "";
  289.                 amount[0] = 0;
  290.             }
  291.         }
  292.     }
  293.     strdel(string, strlen(string)-1, strlen(string));
  294.     if(amount[0] != 0) SendClientMessage(playerid, 0xFFCC66, string);
  295.     return 1;
  296. }
  297.  
  298. stock ListBANDs(playerid)
  299. {
  300.     new amount[2], string[200], shortstr[55];
  301.     SendClientMessage(playerid, 0xFFFFFF, "Current Active Gangs:");
  302.     for(new x=0; x<MAX_BANDS; x++)
  303.     {
  304.         if(BANDinfo[x][active])
  305.         {
  306.             amount[0] ++;
  307.             amount[1] ++;
  308.             format(shortstr, sizeof(shortstr), "%s(ID:%d)", BANDinfo[x][grname], x);
  309.             if(amount[1] == 1) format(string, sizeof(string), "%s", shortstr);
  310.             if(amount[1] != 1) format(string, sizeof(string), "%s %s", string, shortstr);
  311.             if(amount[0] == 4)
  312.             {
  313.                 SendClientMessage(playerid, 0xFFCC66, string);
  314.                 string = "";
  315.                 amount[0] = 0;
  316.             }
  317.         }
  318.     }
  319.     if(amount[1] == 0) SendClientMessage(playerid, 0xFFFF00, "There are currently no active gangs!");
  320.     if(amount[1] != 0) SendClientMessage(playerid, 0xFFCC66, string);
  321.     return 1;
  322. }
  323.  
  324.  
  325.  
  326.  
  327. stock SendMessageToLeader(BANDi, message[])
  328.     return SendClientMessage(BANDinfo[BANDi][leader], 0xFFCC66, message);
  329.  
  330. stock BANDJoin(playerid, BANDi)
  331. {
  332.     BAND[playerid][gid] = BANDi;
  333.     BAND[playerid][order] = BANDMembers(BANDi);
  334.     BAND[playerid][attemptjoin] = -1;
  335.     BAND[playerid][invited] = -1;
  336.     new pname[24], string[130];
  337.     GetPlayerName(playerid, pname, 24);
  338.     format(string, sizeof(string), "%s is now in your Gang!", pname);
  339.     SendMessageToAllBANDMembers(BANDi, string);
  340.     format(string, sizeof(string), "You are now in gang %s(ID:%d)", BANDinfo[BANDi][grname] ,BANDi);
  341.     SendClientMessage(playerid, 0xFFCC66, string);
  342.     return 1;
  343. }
  344.  
  345. stock FindNextSlot()
  346. {
  347.     new id;
  348.     while(BANDinfo[id][active]) id ++;
  349.     return id;
  350. }
  351.  
  352. stock IsBANDTaken(grpname[])
  353. {
  354.     for(new x; x<MAX_BANDS; x++)
  355.     {
  356.         if(BANDinfo[x][active] == 1)
  357.         {
  358.             if(!strcmp(grpname, BANDinfo[x][grname], true) && strlen(BANDinfo[x][grname]) != 0) return 1;
  359.         }
  360.     }
  361.     return 0;
  362. }
  363.  
  364. stock BANDInvite(playerid, BANDid)
  365.     return BAND[playerid][invited] = BANDid;
  366.  
  367. stock CreateBAND(grpname[], owner)
  368. {
  369.     new slotid = FindNextSlot();
  370.     BANDinfo[slotid][leader] = owner;
  371.     format(BANDinfo[slotid][grname], 75, "%s", grpname);
  372.     BANDinfo[slotid][active] = 1;
  373.     BAND[owner][gid] = slotid;
  374.     BAND[owner][order] = 1;
  375.     new string[120];
  376.     format(string, sizeof(string), "You created Gang %s(ID:%d)", grpname, slotid);
  377.     SendClientMessage(owner, 0xFFCC66, string);
  378.     return slotid;
  379. }
  380.  
  381. stock LeaveBAND(playerid, reason)
  382. {
  383.     new BANDid = BAND[playerid][gid], orderid = BAND[playerid][order], string[100], pname[24];
  384.     BAND[playerid][gid] = -1;
  385.     BAND[playerid][order] = -1;
  386.     BANDCheck(BANDid, orderid);
  387.     GetPlayerName(playerid, pname, 24);
  388.     if(reason == 0)
  389.     {
  390.     format(string, sizeof(string), "{FFFFFF}%s(%d){FFCC66} has left the Gang!", pname, playerid);
  391.     SendClientMessage(playerid, 0xFFCC66, "You are leave from the gang");
  392.     }
  393.     if(reason == 1)
  394.     {
  395.         format(string, sizeof(string), "{FFFFFF}%s(%d){FFCC66} has kicked from the Gang!", pname, playerid);
  396.         SendClientMessage(playerid, 0xFFCC66, "You are kicked from the gang!");
  397.     }
  398.     if(reason == 2) format(string, sizeof(string), "{FFFFFF}%s(%d){FFCC66} has left your Gang (Disconnected)!", pname, playerid);
  399.     SendMessageToAllBANDMembers(BANDid, string);
  400.     return 1;
  401. }
  402.  
  403. stock BANDCheck(BANDid, orderid)
  404. {
  405.     new gmems = BANDMembers(BANDid);
  406.     if(!gmems) BANDinfo[BANDid][active] = 0;
  407.     if(gmems != 0) ChangeMemberOrder(BANDid, orderid);
  408.     return 1;
  409. }
  410.  
  411. stock BANDMembers(BANDid)
  412. {
  413.     if(!BANDinfo[BANDid][active]) return 0;
  414.     new BANDmembers;
  415.     for(new i; i<MAX_PLAYERS; i++) if(BAND[i][gid] == BANDid) BANDmembers++;
  416.     return BANDmembers;
  417. }
  418.  
  419. stock ChangeMemberOrder(BANDid, orderid)
  420. {
  421.     for(new x; x<MAX_PLAYERS; x++)
  422.     {
  423.         if(BAND[x][gid] != BANDid || BAND[x][order] < orderid) continue;
  424.         BAND[x][order] --;
  425.         if(BAND[x][order] == 1)
  426.         {
  427.             BANDinfo[BANDid][leader] = x;
  428.             new string[128], pname[24];
  429.             GetPlayerName(x, pname, 24);
  430.             format(string, sizeof(string), "{FFFFFF}%s(ID.%d){FFCC66} is now Gang Leader! Congratiulations!", pname, x);
  431.             SendMessageToAllBANDMembers(BANDid, string);
  432.         }
  433.     }
  434.     return 1;
  435. }
  436.  
  437. stock SendMessageToAllBANDMembers(BANDid, message[])
  438. {
  439.     if(!BANDinfo[BANDid][active]) return 0;
  440.     for(new x; x<MAX_PLAYERS; x++) if(BAND[x][gid] == BANDid) SendClientMessage(x, 0xFFCC66, message);
  441.     return 1;
  442. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement