Advertisement
iMaikel

[FilterScript] Ganz System Zones

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