[Help]Gang/Group
#1

Ok i trying to make cmd to allow admin's join some gang/group without invite
They check for existing names and just enter name for gang to join

/joingang [GANG NAME]

pawn Код:
//Create Gang//
        if(gangcmd==1)
        {
          if(playerGang[playerid]>0)
          {
                SendClientMessage(playerid, 0x83BFBFFF, "You are already in a gang!");
                return 1;
          }


          if(GangNameExists(tmp)) return SendClientMessage(playerid, 0x83BFBFFF, "This gang name already exists!");

          for(new i = 1; i < MAX_GANGS; i++)
          {
                    if(gangInfo[i][0]==0)
                    {
                    //name gang
                    format(gangNames[i], MAX_GANG_NAME, "%s", tmp);
                    //Gang exists
                    gangInfo[i][0]=1;
                    //There is one member
                    gangInfo[i][1]=1;
                    //Gang color is player's color
                    gangInfo[i][2]=playerColors[playerid];

                    //Player is the first gang member
                    gangMembers[i][0] = playerid;
                    format(string, sizeof(string),"You have create the gang '%s' (id: %d)", gangNames[i], i);
                    SendClientMessage(playerid, 0x83BFBFFF, string);

                    playerGang[playerid]=i;

                    return 1;
                }
          }
          return 1;

        //Join Gang//
        }
        else if (gangcmd==3)
        {
            gangnum = gangInvite[playerid];

            if(playerGang[playerid]>0)
          {
                SendClientMessage(playerid, 0x83BFBFFF, "You are already in a gang.");
                return 1;
          }
            if(gangInvite[playerid]==0)
            {
                SendClientMessage(playerid, 0x83BFBFFF, "You are not invite in a gang.");
                return 1;
            }
            if(gangInfo[gangnum][0]==0)
            {
                SendClientMessage(playerid, 0x83BFBFFF, "This gang doesnt exist.");
                return 1;
            }

            if(gangInfo[gangnum][1] < MAX_GANG_MEMBERS)
            {
              new i = gangInfo[gangnum][1];

              gangInvite[playerid]=0;

              gangMembers[gangnum][i] = playerid;

              GetPlayerName(playerid, sendername, MAX_PLAYER_NAME);
              for(new j = 0; j < gangInfo[gangnum][1]; j++)
              {
              format(string, sizeof(string),"%s joined your gang.", sendername);
              SendClientMessage(gangMembers[gangnum][j], COLOR_ORANGE, string);
              }

              gangInfo[gangnum][1]++;
              playerGang[playerid] = gangnum;

              SetPlayerColor(playerid,gangInfo[gangnum][2]);

              format(string, sizeof(string),"You join the gang '%s'(id: %d)", gangNames[gangnum], gangnum);
              SendClientMessage(playerid, 0x83BFBFFF, string);

              return 1;
            }

            SendClientMessage(playerid, 0x83BFBFFF, "No members searched");
            return 1;

        //Invite to Gang//
            }
//By:PotH3Ad
GangNameExists(gangname[])
{
    for(new x=0; x!=MAX_GANGS; x++)
    {
        if(strfind(gangNames[x], gangname, true) != -1) return 1;
    }
    return 0;
}
I dont need CMD i just need to know how i can get gang ID if player input existing gang name
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)