peinneon

NGangSys-0.1

Sep 5th, 2011
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 20.41 KB | None | 0 0
  1. // Noobist Gang System v0.1
  2. // By Noobist | Credits: YLess, Double-o-Seven, DracoBlue, Zeex, sheen
  3. // DO NOT REMOVE THE CREDITS!
  4. // DON'T FORGET TO CREATE FOLDER NAMED "NGangSys" INSIDE THE SCRIPTFILES FOLDER AND CREATE FOLDER NAMED "Gangs" AND "Players" INSIDE THE "NGangSys" FOLDER !
  5.  
  6. // Includes
  7.  
  8. #include <a_samp>
  9. #include <sscanf2>
  10. #include <Double-o-Files_2> // set it to convert dini.
  11. #include <zcmd>
  12.  
  13. // Defines
  14.  
  15. #define FILTERSCRIPT
  16. #define MAX_GANG_NAME 64 // Max gang name digit.
  17. #define MAX_GANG_TAG 6
  18. #define MAX_STRING 128
  19. #define GANG_NAME_ID 1212 // Gang name input dialog ID, change if you have a dialog with this ID.
  20. #define GANG_TAG_ID 1213 // Gang tag input dialog ID, change if you have a dialog with this ID.
  21. #define GangChat // Gang chat using GangChatKey. Comment this to disable it.
  22. #define GangChatKey '!' // Gang chat key.
  23. #define SFile "NGangSys\\Server.ngs" // Server file path.
  24. #define GDir "NGangSys\\Gangs" // Gang file path.
  25. #define GTDir "NGangSys\\Tags" // GangTag file path.
  26. #define PDir "NGangSys\\Players" // Player file path.
  27. #define COLOR_GANGCHAT 0x0090FFFF // Gang chat color.
  28. #define COLOR_ERROR 0xFF0000FF // Error color.
  29. #define COLOR_USAGE 0x00FF00FF // USAGE color.
  30. #define COLOR_SUCCESS 0xFFFF00FF // Command Success color.
  31.  
  32. // Enums
  33.  
  34. enum pInfo
  35. {
  36.     HasGang,
  37.     GangName[MAX_STRING],
  38.     GangLeader,
  39.     InviterGangName[MAX_STRING]
  40. }
  41.  
  42. // Global variables
  43.  
  44. new PGangInfo[MAX_PLAYERS][pInfo];
  45. new GangCount;
  46.  
  47. // Stocks
  48.  
  49. stock NameEx(playerid) // by sheen, edited by me
  50. {
  51.     new Str[MAX_STRING], pos;
  52.     strmid(Str, Name(playerid), 0, MAX_PLAYER_NAME, sizeof(Str));
  53.     for(new i = 0; i < MAX_PLAYER_NAME; i++)
  54.     {
  55.         if (Str[i] == ']') pos = i+1;
  56.     }
  57.     strmid(Str, Name(playerid), pos, MAX_PLAYER_NAME, sizeof(Str));
  58.     return Str;
  59. }
  60.  
  61. stock Name(playerid)
  62. {
  63.     new Str[MAX_PLAYER_NAME];
  64.     GetPlayerName(playerid, Str, sizeof(Str));
  65.     return Str;
  66. }
  67.  
  68. stock PFile(playerid)
  69. {
  70.     new Str[MAX_STRING];
  71.     format(Str, sizeof(Str), "%s\\%s.ngs", PDir, NameEx(playerid));
  72.     return Str;
  73. }
  74.    
  75. stock GFile(playerid)
  76. {
  77.     new Str[MAX_STRING];
  78.     format(Str, sizeof(Str), "%s\\%s.ngs", GDir, dini_Get(PFile(playerid), "GangName"));
  79.     return Str;
  80. }
  81.  
  82. stock GTFile(playerid)
  83. {
  84.     new Str[MAX_STRING];
  85.     format(Str, sizeof(Str), "%s\\%s.ngs", GTDir, dini_Get(GFile(playerid), "Tag"));
  86.     return Str;
  87. }
  88.  
  89. stock GT(playerid)
  90. {
  91.     new Str[MAX_STRING];
  92.     format(Str, sizeof(Str), "%s", dini_Get(GFile(playerid), "Tag"));
  93.     return Str;
  94. }
  95.  
  96. stock GFileEx(const filename[])
  97. {
  98.     new Str[MAX_STRING];
  99.     format(Str, sizeof(Str), "%s\\%s.ngs", GDir, filename);
  100.     return Str;
  101. }
  102.  
  103. stock GTFileEx(const filename[])
  104. {
  105.     new Str[MAX_STRING];
  106.     format(Str, sizeof(Str), "%s\\%s.ngs", GTDir, filename);
  107.     return Str;
  108. }
  109.  
  110. stock NGS_IsPlayerAdmin(playerid)
  111. {
  112.     if(IsPlayerAdmin(playerid)) return 1;
  113.     else return 0;
  114. }
  115.  
  116. // Forwards
  117.  
  118. forward CallConnect();
  119. forward CallDisconnect();
  120. forward AddGangTag(playerid);
  121. forward AddGangTagEx(playerid, const tag[]);
  122. forward SendClientMessageToGang(playerid, const color, const text[]);
  123.  
  124. // Functions
  125.  
  126. public CallConnect()
  127. {
  128.     for(new i = 0; i < MAX_PLAYERS; i++)
  129.     {
  130.         if(IsPlayerConnected(i)) CallLocalFunction("OnPlayerConnect", "i", i);
  131.     }
  132.     return true;
  133. }
  134.  
  135. public CallDisconnect()
  136. {
  137.     for(new i = 0; i < MAX_PLAYERS; i++)
  138.     {
  139.         if(IsPlayerConnected(i)) CallLocalFunction("OnPlayerDisconnect", "i", i);
  140.     }
  141.     return true;
  142. }
  143.  
  144. public AddGangTag(playerid)
  145. {
  146.     new Str[MAX_PLAYER_NAME];
  147.     format(Str, sizeof(Str), "[%s]%s", GT(playerid), NameEx(playerid));
  148.     SetPlayerName(playerid, Str);
  149.     return true;
  150. }
  151.  
  152. public AddGangTagEx(playerid, const tag[])
  153. {
  154.     new Str[MAX_PLAYER_NAME];
  155.     format(Str, sizeof(Str), "[%s]%s", tag, NameEx(playerid));
  156.     SetPlayerName(playerid, Str);
  157.     return true;
  158. }
  159.  
  160. public SendClientMessageToGang(playerid, const color, const text[])
  161. {
  162.     for(new i = 0; i < MAX_PLAYERS; i++)
  163.     {
  164.         if(IsPlayerConnected(i) && PGangInfo[i][GangName] == PGangInfo[playerid][GangName])
  165.         {
  166.             SendClientMessage(i, color, text);
  167.         }
  168.     }
  169. }
  170.  
  171. // Here we go!
  172.  
  173. #if defined FILTERSCRIPT
  174.  
  175. public OnFilterScriptInit()
  176. {
  177.     if(!dini_Exists(SFile))
  178.     {
  179.         dini_Create(SFile);
  180.         dini_IntSet(SFile, "GangCount", 0);
  181.         GangCount = 0;
  182.     }
  183.     else GangCount = dini_Int(SFile, "GangCount");
  184.     CallConnect();
  185.     print("\n--------------------------------------");
  186.     print(" NGangSys 0.1 Loaded!");
  187.     printf(" %i gangs are in scriptfiles folder.", dini_Int(SFile, "GangCount"));
  188.     print("--------------------------------------\n");
  189.     return 1;
  190. }
  191.  
  192. public OnFilterScriptExit()
  193. {
  194.     dini_IntSet(SFile, "GangCount", GangCount);
  195.     CallDisconnect();
  196.     DOF2_Exit();
  197.     print("\n--------------------------------------");
  198.     print(" NGangSys 0.1 Unloaded!");
  199.     print("--------------------------------------\n");
  200.     return 1;
  201. }
  202.  
  203. #endif
  204.  
  205. public OnPlayerConnect(playerid)
  206. {
  207.     if(strfind(Name(playerid), "]", false) != -1 ||
  208.     strfind(Name(playerid), "[", false) != -1)
  209.     {
  210.         SendClientMessage(playerid, COLOR_ERROR, "ERROR: Please remove your nick from '[' and ']' to enter this server!");
  211.         return Kick(playerid);
  212.     }
  213.     if(dini_Exists(PFile(playerid)))
  214.     {
  215.         if(dini_Int(PFile(playerid), "HasGang") == 1)
  216.         {
  217.             if(!dini_Exists(GFile(playerid)))
  218.             {
  219.                 PGangInfo[playerid][HasGang] = 0;
  220.                 PGangInfo[playerid][GangName] = 0;
  221.                 PGangInfo[playerid][GangLeader] = 0;
  222.             }
  223.             else
  224.             {
  225.                 AddGangTag(playerid);
  226.                 PGangInfo[playerid][HasGang] = 1;
  227.                 PGangInfo[playerid][GangName] = dini_Get(PFile(playerid), "GangName");
  228.                 PGangInfo[playerid][GangLeader] = dini_Int(PFile(playerid), "GangLeader");
  229.             }
  230.         }
  231.     }
  232.     else
  233.     {
  234.         PGangInfo[playerid][HasGang] = 0;
  235.         PGangInfo[playerid][GangName] = 0;
  236.         PGangInfo[playerid][GangLeader] = 0;
  237.     }
  238.     return 1;
  239. }
  240.  
  241. public OnPlayerDisconnect(playerid, reason)
  242. {
  243.     #pragma unused reason
  244.     SetPlayerName(playerid, NameEx(playerid));
  245.     dini_IntSet(PFile(playerid), "HasGang", PGangInfo[playerid][HasGang]);
  246.     dini_Set(PFile(playerid), "GangName", PGangInfo[playerid][GangName]);
  247.     dini_IntSet(PFile(playerid), "GangLeader", PGangInfo[playerid][GangLeader]);
  248.     return 1;
  249. }
  250.  
  251. public OnPlayerText(playerid, text[])
  252. {
  253.     if(text[0] == GangChatKey && PGangInfo[playerid][HasGang] == 1)
  254.     {
  255.         for(new i = 0; i < MAX_PLAYERS; i++)
  256.         {
  257.             if(PGangInfo[playerid][GangName] == PGangInfo[i][GangName])
  258.             {
  259.                 new Str[MAX_STRING];
  260.                 format(Str, sizeof(Str), "[GANG] %s:{FFFFFF} %s", NameEx(i), text[1]);
  261.                 SendClientMessage(i, COLOR_GANGCHAT, Str);
  262.             }
  263.         }
  264.         return 0;
  265.     }
  266.     return 1;
  267. }
  268.  
  269. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  270. {
  271.     if(dialogid == GANG_NAME_ID && response)
  272.     {
  273.         if(strlen(inputtext) > MAX_GANG_NAME)
  274.         {
  275.             SendClientMessage(playerid, COLOR_ERROR, "ERROR: Input length is too long!");
  276.             return ShowPlayerDialog(playerid, GANG_NAME_ID, DIALOG_STYLE_INPUT, "Noobist Gang System", "Please input your new gang name.", "OK", "Cancel");
  277.         }
  278.         if(strlen(inputtext) < 5)
  279.         {
  280.             SendClientMessage(playerid, COLOR_ERROR, "ERROR: Input length is too short!");
  281.             return ShowPlayerDialog(playerid, GANG_NAME_ID, DIALOG_STYLE_INPUT, "Noobist Gang System", "Please input your new gang name.", "OK", "Cancel");
  282.         }
  283.         if(dini_Exists(GFileEx(inputtext)))
  284.         {
  285.             SendClientMessage(playerid, COLOR_ERROR, "ERROR: Gang name is already used by another gang!");
  286.             return ShowPlayerDialog(playerid, GANG_NAME_ID, DIALOG_STYLE_INPUT, "Noobist Gang System", "Please input your new gang name.", "OK", "Cancel");
  287.         }
  288.         else
  289.         {
  290.             SetPVarString(playerid, "TempGName", inputtext);
  291.             return ShowPlayerDialog(playerid, GANG_TAG_ID, DIALOG_STYLE_INPUT, "Noobist Gang System", "Please input your new gang tag without numbers and symbols.", "OK", "Cancel");
  292.         }
  293.     }
  294.     if(dialogid == GANG_TAG_ID)
  295.     {
  296.         if(!response) return ShowPlayerDialog(playerid, GANG_NAME_ID, DIALOG_STYLE_INPUT, "Noobist Gang System", "Please input your new gang tag without numbers and symbols.", "OK", "Cancel");
  297.         if(response)
  298.         {
  299.             if(strlen(inputtext) > MAX_GANG_TAG)
  300.             {
  301.                 SendClientMessage(playerid, COLOR_ERROR, "ERROR: Input length is too long!");
  302.                 return ShowPlayerDialog(playerid, GANG_TAG_ID, DIALOG_STYLE_INPUT, "Noobist Gang System", "Please input your new gang tag without numbers and symbols.", "OK", "Back");
  303.             }
  304.             if(strlen(inputtext) < 1)
  305.             {
  306.                 SendClientMessage(playerid, COLOR_ERROR, "ERROR: Input length is too short!");
  307.                 return ShowPlayerDialog(playerid, GANG_TAG_ID, DIALOG_STYLE_INPUT, "Noobist Gang System", "Please input your new gang tag without numbers and symbols.", "OK", "Back");
  308.             }
  309.             if(dini_Exists(GTFileEx(inputtext)))
  310.             {
  311.                 SendClientMessage(playerid, COLOR_ERROR, "ERROR: Tag is already used by another gang!");
  312.                 return ShowPlayerDialog(playerid, GANG_TAG_ID, DIALOG_STYLE_INPUT, "Noobist Gang System", "Please input your new gang tag without numbers and symbols.", "OK", "Back");
  313.             }
  314.             if(strfind(inputtext, "=", false) != -1 ||
  315.             strfind(inputtext, "[", false) != -1 ||
  316.             strfind(inputtext, "$", false) != -1 ||
  317.             strfind(inputtext, "]", false) != -1 ||
  318.             strfind(inputtext, "_", false) != -1 ||
  319.             strfind(inputtext, "@", false) != -1 ||
  320.             strfind(inputtext, "(", false) != -1 ||
  321.             strfind(inputtext, ")", false) != -1 ||
  322.             strfind(inputtext, "'", false) != -1 ||
  323.             strfind(inputtext, ".", false) != -1 ||
  324.             strfind(inputtext, "1", false) != -1 ||
  325.             strfind(inputtext, "2", false) != -1 ||
  326.             strfind(inputtext, "3", false) != -1 ||
  327.             strfind(inputtext, "4", false) != -1 ||
  328.             strfind(inputtext, "5", false) != -1 ||
  329.             strfind(inputtext, "6", false) != -1 ||
  330.             strfind(inputtext, "7", false) != -1 ||
  331.             strfind(inputtext, "8", false) != -1 ||
  332.             strfind(inputtext, "9", false) != -1 ||
  333.             strfind(inputtext, "0", false) != -1)
  334.             {
  335.                 SendClientMessage(playerid, 0xFF0000FF, "Gang tag contains number/symbols!");
  336.                 return ShowPlayerDialog(playerid, GANG_TAG_ID, DIALOG_STYLE_INPUT, "Noobist Gang System", "Please input your new gang tag without numbers and symbols.", "OK", "Back");
  337.             }
  338.             else
  339.             {
  340.                 new TempPName[MAX_PLAYER_NAME], TempPName2[MAX_PLAYER_NAME];
  341.                 GetPlayerName(playerid, TempPName, sizeof(TempPName));
  342.                 AddGangTagEx(playerid, inputtext);
  343.                 GetPlayerName(playerid, TempPName2, sizeof(TempPName2));
  344.                 if(TempPName2[playerid] == TempPName[playerid])
  345.                 {
  346.                     SendClientMessage(playerid, 0xFF0000FF, "Gang tag contains number/symbols!");
  347.                     return ShowPlayerDialog(playerid, GANG_TAG_ID, DIALOG_STYLE_INPUT, "Noobist Gang System", "Please input your new gang tag without numbers and symbols.", "OK", "Back");
  348.                 }
  349.                 else
  350.                 {
  351.                     new GName[MAX_STRING];
  352.                     GetPVarString(playerid, "TempGName", GName, sizeof(GName));
  353.                     dini_Create(GFileEx(GName));
  354.                     dini_Create(GTFileEx(inputtext));
  355.                     dini_Set(GFileEx(GName), "Tag", inputtext);
  356.                     PGangInfo[playerid][HasGang] = 1;
  357.                     PGangInfo[playerid][GangName] = GName;
  358.                     PGangInfo[playerid][GangLeader] = 1;
  359.                     SendClientMessage(playerid, COLOR_SUCCESS, "You have successfully created your gang, you can try inviting people by using /invite or /ganghelp for more information.");
  360.                     GangCount = GangCount+1;
  361.                     return 1;
  362.                 }
  363.             }
  364.         }
  365.     }
  366.     return 0;
  367. }
  368.  
  369. CMD:creategang(playerid)
  370. {
  371.     if(PGangInfo[playerid][HasGang] == 1) return SendClientMessage(playerid, COLOR_ERROR, "ERROR: You already have a gang!");
  372.     else return ShowPlayerDialog(playerid, GANG_NAME_ID, DIALOG_STYLE_INPUT, "Noobist Gang System", "Please input your gang name.", "OK", "Cancel");
  373. }
  374.  
  375. CMD:invite(playerid, params[])
  376. {
  377.     if(PGangInfo[playerid][HasGang] == 0) return SendClientMessage(playerid, COLOR_ERROR, "ERROR: You don't have a gang! Type /creategang to create a gang.");
  378.     if(PGangInfo[playerid][GangLeader] == 0) return SendClientMessage(playerid, COLOR_ERROR, "ERROR: You are not the gang leader!");
  379.     new targetid;
  380.     if(sscanf(params, "u", targetid)) return SendClientMessage(playerid, COLOR_USAGE, "USAGE: /invite <id>");
  381.     if(PGangInfo[targetid][HasGang] == 1) return SendClientMessage(playerid, COLOR_ERROR, "ERROR: Player is already have a gang!");
  382.     if(targetid == playerid) return SendClientMessage(playerid, COLOR_ERROR, "ERROR: You cannot invite yourself!");
  383.     if(targetid == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_ERROR, "ERROR: Player not connected!");
  384.     if(PGangInfo[targetid][InviterGangName] != 0 && PGangInfo[targetid][InviterGangName] != PGangInfo[playerid][GangName]) return SendClientMessage(playerid, COLOR_ERROR, "ERROR: Player is already been invited by another gang, please stand by for input.");
  385.     if(PGangInfo[targetid][InviterGangName] == PGangInfo[playerid][GangName]) return SendClientMessage(playerid, COLOR_ERROR, "ERROR: You have invited this player, please stand by for input.");
  386.     else
  387.     {
  388.         new PStr[MAX_STRING], TStr[MAX_STRING];
  389.         PGangInfo[targetid][InviterGangName] = PGangInfo[playerid][GangName];
  390.         format(PStr, sizeof(PStr), "You have invited %s to your gang, please stand by for input.", Name(targetid));
  391.         format(TStr, sizeof(TStr), "You have been invited to %s. Use /accept to accept the invitation or /decline to decline the invitation.", PGangInfo[playerid][GangName]);
  392.         SendClientMessage(playerid, COLOR_SUCCESS, PStr);
  393.         SendClientMessage(targetid, COLOR_SUCCESS, TStr);
  394.         return 1;
  395.     }
  396. }
  397.  
  398. CMD:accept(playerid)
  399. {
  400.     if(PGangInfo[playerid][InviterGangName] == 0) return SendClientMessage(playerid, COLOR_ERROR, "ERROR: You are not invited by any gang!");
  401.     else
  402.     {
  403.         new PStr[MAX_STRING];
  404.         PGangInfo[playerid][GangName] = PGangInfo[playerid][InviterGangName];
  405.         PGangInfo[playerid][InviterGangName] = 0;
  406.         format(PStr, sizeof(PStr), "You have accepted the invitation, welcome to %s!", PGangInfo[playerid][GangName]);
  407.         SendClientMessage(playerid, COLOR_SUCCESS, PStr);
  408.         AddGangTag(playerid);
  409.         return 1;
  410.     }
  411. }
  412.  
  413. CMD:decline(playerid)
  414. {
  415.     if(PGangInfo[playerid][InviterGangName] == 0) return SendClientMessage(playerid, COLOR_ERROR, "ERROR: You are not invited by any gang!");
  416.     else
  417.     {
  418.         PGangInfo[playerid][InviterGangName] = 0;
  419.         SendClientMessage(playerid, COLOR_SUCCESS, "You have declined the invitation.");
  420.         return 1;
  421.     }
  422. }
  423.  
  424. CMD:gangleave(playerid)
  425. {
  426.     if(PGangInfo[playerid][HasGang] == 0) return SendClientMessage(playerid, COLOR_ERROR, "ERROR: You don't have a gang! Use /creategang to create a gang.");
  427.     if(PGangInfo[playerid][GangLeader] == 1) return SendClientMessage(playerid, COLOR_ERROR, "ERROR; You are the gang leader! If you want to disband your gang, use /gangdisband");
  428.     else
  429.     {
  430.         new GStr[MAX_STRING];  
  431.         format(GStr, sizeof(GStr), "%s has left the gang.");
  432.         SendClientMessageToGang(playerid, COLOR_SUCCESS, GStr);
  433.         PGangInfo[playerid][HasGang] = 0;
  434.         PGangInfo[playerid][GangName] = 0;
  435.         PGangInfo[playerid][GangLeader] = 0;
  436.         SendClientMessage(playerid, COLOR_SUCCESS, "You have left the gang.");
  437.         SetPlayerName(playerid, NameEx(playerid));
  438.         return 1;
  439.     }
  440. }
  441.  
  442. CMD:gangkick(playerid, params[])
  443. {
  444.     if(PGangInfo[playerid][HasGang] == 0) return SendClientMessage(playerid, COLOR_ERROR, "ERROR: You don't have a gang! Type /creategang to create a gang.");
  445.     if(PGangInfo[playerid][GangLeader] == 0) return SendClientMessage(playerid, COLOR_ERROR, "ERROR: You are not the gang leader!");
  446.     new targetid;
  447.     if(sscanf(params, "u", targetid)) return SendClientMessage(playerid, COLOR_USAGE, "USAGE: /gangkick <id>");
  448.     if(PGangInfo[targetid][GangName] != PGangInfo[playerid][GangName]) return SendClientMessage(playerid, COLOR_ERROR, "ERROR: Player is not in your gang!");
  449.     if(targetid == playerid) return SendClientMessage(playerid, COLOR_ERROR, "ERROR: You cannot kick yourself!");
  450.     if(targetid == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_ERROR, "ERROR: Player not connected!");
  451.     else
  452.     {
  453.         new Str[MAX_STRING], TStr[MAX_STRING];
  454.         PGangInfo[targetid][HasGang] = 0;
  455.         PGangInfo[targetid][GangName] = 0;
  456.         PGangInfo[targetid][GangLeader] = 0;
  457.         format(Str, sizeof(Str), "%s has kicked %s from gang!");
  458.         format(TStr, sizeof(TStr), "%s has kicked you from gang!");
  459.         SendClientMessageToGang(playerid, COLOR_SUCCESS, Str);
  460.         SendClientMessage(targetid, COLOR_ERROR, TStr);
  461.         SetPlayerName(targetid, NameEx(targetid));
  462.         return 1;
  463.     }
  464. }
  465.  
  466. CMD:gangdisband(playerid)
  467. {
  468.     if(PGangInfo[playerid][HasGang] == 0) return SendClientMessage(playerid, COLOR_ERROR, "ERROR: You don't have a gang! Type /creategang to create a gang.");
  469.     if(PGangInfo[playerid][GangLeader] == 0) return SendClientMessage(playerid, COLOR_ERROR, "ERROR: You are not the gang leader!");
  470.     else
  471.     {
  472.         new Str[MAX_STRING];
  473.         dini_Remove(GTFile(playerid));
  474.         dini_Remove(GFile(playerid));
  475.         format(Str, sizeof(Str), "%s has been disbanded by %s!", PGangInfo[playerid][GangName], Name(playerid));
  476.         SendClientMessageToGang(playerid, COLOR_ERROR, Str);
  477.         GangCount = GangCount-1;
  478.         for(new i = 0; i < MAX_PLAYERS; i++)
  479.         {
  480.             if(IsPlayerConnected(i) && PGangInfo[playerid][GangName] == PGangInfo[i][GangName])
  481.             {
  482.                 PGangInfo[i][HasGang] = 0;
  483.                 PGangInfo[i][GangName] = 0;
  484.                 PGangInfo[i][GangLeader] = 0;
  485.                 SetPlayerName(i, NameEx(i));
  486.             }
  487.         }
  488.         return 1;
  489.     }
  490. }
  491.  
  492. CMD:forcegangdisband(playerid, params[])
  493. {
  494.     if(!NGS_IsPlayerAdmin(playerid)) return 0;
  495.     new targetid;
  496.     if(sscanf(params, "u", targetid)) return SendClientMessage(playerid, COLOR_USAGE, "USAGE: /forcegangdisband <player-id-that-has-a gang-that-you-want-to-disband>"); // Too long..
  497.     if(PGangInfo[targetid][HasGang] == 0) return SendClientMessage(playerid, COLOR_ERROR, "ERROR: Player has no gang.");
  498.     if(targetid == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_ERROR, "ERROR: Player not connected.");
  499.     else
  500.     {
  501.         new Str[MAX_STRING];
  502.         dini_Remove(GTFile(targetid));
  503.         dini_Remove(GFile(targetid));
  504.         format(Str, sizeof(Str), "%s has been force disbanded by Administrator %s!", PGangInfo[playerid][GangName], Name(playerid));
  505.         SendClientMessageToGang(targetid, COLOR_ERROR, Str);
  506.         GangCount = GangCount-1;
  507.         for(new i = 0; i < MAX_PLAYERS; i++)
  508.         {
  509.             if(IsPlayerConnected(i) && PGangInfo[targetid][GangName] == PGangInfo[i][GangName])
  510.             {
  511.                 PGangInfo[i][HasGang] = 0;
  512.                 PGangInfo[i][GangName] = 0;
  513.                 PGangInfo[i][GangLeader] = 0;
  514.                 SetPlayerName(i, NameEx(i));
  515.             }
  516.         }
  517.         return 1;
  518.     }
  519. }
  520.  
  521. CMD:forcegangleave(playerid, params[])
  522. {
  523.     if(!NGS_IsPlayerAdmin(playerid)) return 0;
  524.     new targetid;
  525.     if(sscanf(params, "u", targetid)) return SendClientMessage(playerid, COLOR_USAGE, "USAGE: /forcegangleave <id>");
  526.     if(PGangInfo[targetid][HasGang] == 0) return SendClientMessage(playerid, COLOR_ERROR, "ERROR: Player has no gang.");
  527.     if(targetid == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_ERROR, "ERROR: Player not connected.");
  528.     else
  529.     {
  530.         new GStr[MAX_STRING], TStr[MAX_STRING];
  531.         format(GStr, sizeof(GStr), "%s has been forced to leave the gang by Administrator %s.", Name(targetid), Name(playerid));
  532.         SendClientMessageToGang(targetid, COLOR_SUCCESS, GStr);
  533.         format(TStr, sizeof(TStr), "You have been forced to leave the gang by Administrator %s.", Name(playerid));
  534.         SendClientMessage(targetid, COLOR_ERROR, TStr);
  535.         PGangInfo[targetid][HasGang] = 0;
  536.         PGangInfo[targetid][GangName] = 0;
  537.         PGangInfo[targetid][GangLeader] = 0;
  538.         SetPlayerName(targetid, NameEx(targetid));
  539.         return 1;
  540.     }
  541. }
  542.  
  543. CMD:ganghelp(playerid)
  544. {
  545.     SendClientMessage(playerid, COLOR_USAGE, "Noobist Gang System v0.1 - Help");
  546.     SendClientMessage(playerid, COLOR_USAGE, "By Noobist | Credits: YLess, Double-o-Seven, DracoBlue, Zeex, sheen");
  547.     SendClientMessage(playerid, COLOR_USAGE, "/creategang --> Create a gang.");
  548.     SendClientMessage(playerid, COLOR_USAGE, "/invite <id> --> Invite a player to your gang.");
  549.     SendClientMessage(playerid, COLOR_USAGE, "/accept --> Accept gang invitation.");
  550.     SendClientMessage(playerid, COLOR_USAGE, "/decline --> Decline gang invitation.");
  551.     SendClientMessage(playerid, COLOR_USAGE, "/gangleave --> Leave a gang.");
  552.     SendClientMessage(playerid, COLOR_USAGE, "/gangkick <id> --> Kick player from gang.");
  553.     if(NGS_IsPlayerAdmin(playerid)) SendClientMessage(playerid, COLOR_USAGE, "Administrator Commands --> /admganghelp");
  554.     return 1;
  555. }
  556.  
  557. CMD:admganghelp(playerid)
  558. {
  559.     if(!NGS_IsPlayerAdmin(playerid)) return 0;
  560.     else
  561.     {
  562.         SendClientMessage(playerid, COLOR_USAGE, "Noobist Gang System v0.1 - Administrator commands");
  563.         SendClientMessage(playerid, COLOR_USAGE, "By Noobist | Credits: YLess, Double-o-Seven, DracoBlue, Zeex, sheen");
  564.         SendClientMessage(playerid, COLOR_USAGE, "/forcegangdisband <id-that-has-a-gang-that-you-want-to-disband> --> Force gang to disband.");
  565.         SendClientMessage(playerid, COLOR_USAGE, "/forcegangleave <id> --> Force player to leave a gang");
  566.         return 1;
  567.     }
  568. }
  569.  
  570. // The end.
Advertisement
Add Comment
Please, Sign In to add comment