Help, Please
#1

Hello, when I am in Faction ID 11, I try to use /departments but it keeps saying "You Are Not part of a Team"

Here is the Code

Ids 1 and 7 are public service factions and Id 11 is the Prison Guards Faction

pawn Код:
if(strcmp(cmd, "/departments", true) == 0 || strcmp(cmd, "/d", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            if(!(PlayerInfo[playerid][pMember] >= 1 && PlayerInfo[playerid][pMember] <= 7) || PlayerInfo[playerid][pMember] == 11)
            {
                SendClientMessage(playerid, COLOR_GRAD2, "   You are not part of a Team!");
                return 1;
            }
            new length = strlen(cmdtext);
            while ((idx < length) && (cmdtext[idx] <= ' '))
            {
                idx++;
            }
            new sub[15];
            if(PlayerInfo[playerid][pSFMember] == 0) { sub = "Default"; }
            else if(PlayerInfo[playerid][pSFMember] == 1) { sub = "SWAT"; }
            else if(PlayerInfo[playerid][pSFMember] == 2) { sub = "IA"; }
            else if(PlayerInfo[playerid][pSFMember] == 3) { sub = "SIU"; }
            else if(PlayerInfo[playerid][pSFMember] == 4) { sub = "ACU"; }
            else if(PlayerInfo[playerid][pSFMember] == 5) { sub = "GHOST"; }
            else if(PlayerInfo[playerid][pSFMember] == 6) { sub = "Default"; }
            else if(PlayerInfo[playerid][pSFMember] == 7) { sub = "MIFD"; }
            else if(PlayerInfo[playerid][pSFMember] == 8) { sub = "DF"; }
            else if(PlayerInfo[playerid][pSFMember] == 9) { sub = "AF"; }
            else if(PlayerInfo[playerid][pSFMember] == 10) { sub = "MIS"; }
            else if(PlayerInfo[playerid][pSFMember] == 11) { sub = "E"; }
            new offset = idx;
            new result[256];
            while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
            {
                result[idx - offset] = cmdtext[idx];
                idx++;
            }
            result[idx - offset] = EOS;
            if(!strlen(result))
            {
                SendClientMessage(playerid, COLOR_WHITE, "USAGE: (/d)epartments [Departments Chat]");
                return 1;
            }
            format(string, sizeof(string), "** [%s] [%s] %s %s: %s. **", GetPlayerFactionName(playerid), sub, GetPlayerRank(playerid), RemoveUnderScore(PlayerName(playerid)), result);
            SendFamilyMessage(1, COLOR_DCHAT, string);
            SendFamilyMessage(2, COLOR_DCHAT, string);
            SendFamilyMessage(3, COLOR_DCHAT, string);
            SendFamilyMessage(4, COLOR_DCHAT, string);
            SendFamilyMessage(5, COLOR_DCHAT, string);
            SendFamilyMessage(6, COLOR_DCHAT, string);
            SendFamilyMessage(7, COLOR_DCHAT, string);
            SendFamilyMessage(11, COLOR_DCHAT, string);
            format(string, sizeof(string), "[Radio] %s.", result);
            SetPlayerChatBubble(playerid, string, COLOR_WHITE, 30.0, 10000);
            return 1;
        }
        return 1;
    }
Reply
#2

You have to add pLeader too, not only pMember if i am right !
Reply
#3

Is this ok?

pawn Код:
if(strcmp(cmd, "/departments", true) == 0 || strcmp(cmd, "/d", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            if(!(PlayerInfo[playerid][pMember] >= 1 && PlayerInfo[playerid][pMember] <= 7) || PlayerInfo[playerid][pMember] == 11 || PlayerInfo[playerid][pLeader] == 11)
            {
                SendClientMessage(playerid, COLOR_GRAD2, "   You are not part of a Team!");
                return 1;
            }
            new length = strlen(cmdtext);
            while ((idx < length) && (cmdtext[idx] <= ' '))
            {
                idx++;
            }
            new sub[15];
            if(PlayerInfo[playerid][pSFMember] == 0) { sub = "Default"; }
            else if(PlayerInfo[playerid][pSFMember] == 1) { sub = "SWAT"; }
            else if(PlayerInfo[playerid][pSFMember] == 2) { sub = "IA"; }
            else if(PlayerInfo[playerid][pSFMember] == 3) { sub = "SIU"; }
            else if(PlayerInfo[playerid][pSFMember] == 4) { sub = "ACU"; }
            else if(PlayerInfo[playerid][pSFMember] == 5) { sub = "GHOST"; }
            else if(PlayerInfo[playerid][pSFMember] == 6) { sub = "Default"; }
            else if(PlayerInfo[playerid][pSFMember] == 7) { sub = "MIFD"; }
            else if(PlayerInfo[playerid][pSFMember] == 8) { sub = "DF"; }
            else if(PlayerInfo[playerid][pSFMember] == 9) { sub = "AF"; }
            else if(PlayerInfo[playerid][pSFMember] == 10) { sub = "MIS"; }
            else if(PlayerInfo[playerid][pSFMember] == 11) { sub = "E"; }
            new offset = idx;
            new result[256];
            while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
            {
                result[idx - offset] = cmdtext[idx];
                idx++;
            }
            result[idx - offset] = EOS;
            if(!strlen(result))
            {
                SendClientMessage(playerid, COLOR_WHITE, "USAGE: (/d)epartments [Departments Chat]");
                return 1;
            }
            format(string, sizeof(string), "** [%s] [%s] %s %s: %s. **", GetPlayerFactionName(playerid), sub, GetPlayerRank(playerid), RemoveUnderScore(PlayerName(playerid)), result);
            SendFamilyMessage(1, COLOR_DCHAT, string);
            SendFamilyMessage(2, COLOR_DCHAT, string);
            SendFamilyMessage(3, COLOR_DCHAT, string);
            SendFamilyMessage(4, COLOR_DCHAT, string);
            SendFamilyMessage(5, COLOR_DCHAT, string);
            SendFamilyMessage(6, COLOR_DCHAT, string);
            SendFamilyMessage(7, COLOR_DCHAT, string);
            SendFamilyMessage(11, COLOR_DCHAT, string);
            format(string, sizeof(string), "[Radio] %s.", result);
            SetPlayerChatBubble(playerid, string, COLOR_WHITE, 30.0, 10000);
            return 1;
        }
        return 1;
    }
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)