Faction Problem
#1

So I have a serious problem for me.
We are working on server SA: MP and I thought to take another GM v1 to v2 made ​​by the author was working The factions in v2 have to do with / createfactions and are bugged. Most of v1 works perfectly with small bugs they fix.

I talked to some scripter who helps me with only $ [Romanian mentality]. They took me as it cost me about 7 $ / 5 Euro it's more work.

We leave orders and if there's anything will leave.
/ factions V1
pawn Код:
if(strcmp(cmd, "/factions", true) == 0)
    {
        new members_1, members_2, members_3;
        new members_4, members_5, members_6;
        new members_7, members_8, members_9;
        new members_10;
        for(new i = 0; i < MAX_PLAYERS; i++)
        {
            switch(PlayerInfo[i][pMember])
            {
                case 1: members_1++;
                case 2: members_2++;
                case 3: members_3++;
                case 4: members_4++;
                case 5: members_5++;
                case 6: members_6++;
                case 7: members_7++;
                case 8: members_8++;
                case 9: members_9++;
                case 10: members_10++;
            }
        }
        //SendClientMessage(playerid, GREEN, "___________________________________________________");
        if(FactionInfo[1][FactionType] != 6) format(string, sizeof(string), "Faction #1: %s | Owner: %s | Online Members: %d | Total Members: %d", FactionEmbed(1), FACTION1_OWNER, members_1, TOTAL_FACTION1_MEMBERS);
        else format(string, sizeof(string), "Faction #1: %s | Owner: Classified | Online Members: ? | Total Members: ?", FACTION_1);
        SendClientMessage(playerid, WHITE, string);

        if(FactionInfo[2][FactionType] != 6) format(string, sizeof(string), "Faction #2: %s | Owner: %s | Online Members: %d | Total Members: %d", FactionEmbed(2), FACTION2_OWNER, members_2, TOTAL_FACTION2_MEMBERS);
        else format(string, sizeof(string), "Faction #2: %s | Owner: Classified | Online Members: ? | Total Members: ?", FACTION_2);
        SendClientMessage(playerid, WHITE, string);

        if(FactionInfo[3][FactionType] != 6) format(string, sizeof(string), "Faction #3: %s | Owner: %s | Online Members: %d | Total Members: %d", FactionEmbed(3), FACTION3_OWNER, members_3, TOTAL_FACTION3_MEMBERS);
        else format(string, sizeof(string), "Faction #3: %s | Owner: Classified | Online Members: ? | Total Members: ?", FACTION_3);
        SendClientMessage(playerid, WHITE, string);

        if(FactionInfo[4][FactionType] != 6) format(string, sizeof(string), "Faction #4: %s | Owner: %s | Online Members: %d | Total Members: %d", FactionEmbed(4), FACTION4_OWNER, members_4, TOTAL_FACTION4_MEMBERS);
        else format(string, sizeof(string), "Faction #4: %s | Owner: Classified | Online Members: ? | Total Members: ?", FACTION_4);
        SendClientMessage(playerid, WHITE, string);

        if(FactionInfo[5][FactionType] != 6) format(string, sizeof(string), "Faction #5: %s | Owner: %s | Online Members: %d | Total Members: %d", FactionEmbed(5), FACTION5_OWNER, members_5, TOTAL_FACTION5_MEMBERS);
        else format(string, sizeof(string), "Faction #5: %s | Owner: Classified | Online Members: ? | Total Members: ?", FACTION_5);
        SendClientMessage(playerid, WHITE, string);

        if(FactionInfo[6][FactionType] != 6) format(string, sizeof(string), "Faction #6: %s | Owner: %s | Online Members: %d | Total Members: %d", FactionEmbed(6), FACTION6_OWNER, members_6, TOTAL_FACTION6_MEMBERS);
        else format(string, sizeof(string), "Faction #6: %s | Owner: Classified | Online Members: ? | Total Members: ?", FACTION_6);
        SendClientMessage(playerid, WHITE, string);

        if(FactionInfo[7][FactionType] != 6) format(string, sizeof(string), "Faction #7: %s | Owner: %s | Online Members: %d | Total Members: %d", FactionEmbed(7), FACTION7_OWNER, members_7, TOTAL_FACTION7_MEMBERS);
        else format(string, sizeof(string), "Faction #7: %s | Owner: Classified | Online Members: ? | Total Members: ?", FACTION_7);
        SendClientMessage(playerid, WHITE, string);

        if(FactionInfo[8][FactionType] != 6) format(string, sizeof(string), "Faction #8: %s | Owner: %s | Online Members: %d | Total Members: %d", FactionEmbed(8), FACTION8_OWNER, members_8, TOTAL_FACTION8_MEMBERS);
        else format(string, sizeof(string), "Faction #8: %s | Owner: Classified | Online Members: ? | Total Members: ?", FACTION_8);
        SendClientMessage(playerid, WHITE, string);

        if(FactionInfo[9][FactionType] != 6) format(string, sizeof(string), "Faction #9: %s | Owner: %s | Online Members: %d | Total Members: %d", FactionEmbed(9), FACTION9_OWNER, members_9, TOTAL_FACTION9_MEMBERS);
        else format(string, sizeof(string), "Faction #9: %s | Owner: Classified | Online Members: ? | Total Members: ?", FACTION_9);
        SendClientMessage(playerid, WHITE, string);

        if(FactionInfo[10][FactionType] != 6) format(string, sizeof(string), "Faction #10: %s | Owner: %s | Online Members: %d | Total Members: %d", FactionEmbed(10), FACTION10_OWNER, members_10, TOTAL_FACTION10_MEMBERS);
        else format(string, sizeof(string), "Faction #10: %s | Owner: Classified | Online Members: ? | Total Members: ?", FACTION_10);
        SendClientMessage(playerid, WHITE, string);
        //SendClientMessage(playerid, GREEN, "___________________________________________________");
        return 1;
    }
Makeleader v1

pawn Код:
if(strcmp(cmd, "/makeleader", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SyntaxMessage(playerid, "/makeleader [playerid/name] [number]");
                return 1;
            }
            new para1;
            para1 = ReturnUser(tmp);
            if(IsPlayerNPC(para1)) return 1;
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SyntaxMessage(playerid, "/makeleader [playerid/name] [number]");
                return 1;
            }
            new faction;
            faction = strval(tmp);
            if(faction < 0 || faction > 10) { SendClientMessage(playerid, GREY, "Don't go below number 0, or above number 10."); return 1; }
            if(PlayerInfo[playerid][pAdmin] >= 1337 || PlayerInfo[playerid][pFactionMod] > 0)
            {
                if(IsPlayerConnected(para1))
                {
                    if(para1 != INVALID_PLAYER_ID)
                    {
                        new ftext[100];
                        GetPlayerName(playerid, sendername, sizeof(sendername));
                        GetPlayerName(para1, giveplayer, sizeof(giveplayer));
                        if(faction == 0) { /*PlayerInfo[para1][pModel] = noobskin;*/ PlayerInfo[para1][pRank] = 0; ftext = "None"; MakeLeaderOf(para1, 0); }
                        else if(faction == 1) { /*PlayerInfo[para1][pModel] = 265;*/ PlayerInfo[para1][pRank] = 6; ftext = FACTION_1; MakeLeaderOf(para1, 1); }
                        else if(faction == 2) { /*PlayerInfo[para1][pModel] = 286;*/ PlayerInfo[para1][pRank] = 6; ftext = FACTION_2; MakeLeaderOf(para1, 2); }
                        else if(faction == 3) { /*PlayerInfo[para1][pModel] = 288;*/ PlayerInfo[para1][pRank] = 6; ftext = FACTION_3; MakeLeaderOf(para1, 3); }
                        else if(faction == 4) { /*PlayerInfo[para1][pModel] = 274;*/ PlayerInfo[para1][pRank] = 6; ftext = FACTION_4; MakeLeaderOf(para1, 4); }
                        else if(faction == 5) { /*PlayerInfo[para1][pModel] = 287;*/ PlayerInfo[para1][pRank] = 6; ftext = FACTION_5; MakeLeaderOf(para1, 5); }
                        else if(faction == 6) { /*PlayerInfo[para1][pModel] = 147;*/ PlayerInfo[para1][pRank] = 6; ftext = FACTION_6; MakeLeaderOf(para1, 6); }
                        else if(faction == 7) { /*PlayerInfo[para1][pModel] = 285;*/ PlayerInfo[para1][pRank] = 6; ftext = FACTION_7; MakeLeaderOf(para1, 7); }
                        else if(faction == 8) { /*PlayerInfo[para1][pModel] = 294;*/ PlayerInfo[para1][pRank] = 6; ftext = FACTION_8; MakeLeaderOf(para1, 8); }
                        else if(faction == 9) { /*PlayerInfo[para1][pModel] = 227;*/ PlayerInfo[para1][pRank] = 6; ftext = FACTION_9; MakeLeaderOf(para1, 9); }
                        else if(faction == 10) { /*PlayerInfo[para1][pModel] = 61;*/ PlayerInfo[para1][pRank] = 6; ftext = FACTION_10; MakeLeaderOf(para1, 10); }
                        format(string, sizeof(string), "* You have given %s leadership of the %s.", giveplayer,ftext);
                        SendClientMessage(playerid, LIGHTBLUE, string);
                        format(string, sizeof(string), "* %s has given you leadership of the %s.",sendername,ftext);
                        SendClientMessage(para1, LIGHTBLUE, string);
                        PlayerInfo[para1][pLeader] = faction;
                        PlayerInfo[para1][pMember] = faction;
                        PlayerInfo[para1][pDivision] = 0;
                        //SetPlayerSkin(para1, PlayerInfo[para1][pModel]);
                        SetPlayerToTeamColor(para1);
                        OnPlayerSave(para1);
                    }
                }
            }
            else
            {
                SendClientMessage(playerid, GREY, "    You are not authorized to use that command.");
            }
        }
        return 1;
    }

/factions V2
pawn Код:
if(strcmp(cmd, "/factions", true) == 0)
    {
        new members;
        for (new i = 1; i < MAX_FACTIONS + 1; i ++)
        {
            if (!FactionInfo[i][FactionExists]) continue;
            for (new j = 0; j < MAX_PLAYERS; j ++)
            {
                if (!IsPlayerConnected(j)) continue;
                if (PlayerInfo[j][pMember] == i)
                {
                    members++;
                }
            }
            if (FactionInfo[i][FactionType] != 6) format(string, sizeof(string), "Faction #%d: %s | Owner: %s | Online Members: %d | Total Members: %d", i, FactionEmbed(i), FactionInfo[i][FactionLeader], members, FactionInfo[i][FactionMembers]);
            else format(string, sizeof(string), "Faction #%d: %s | Owner: Classified | Online Members: ? | Total Members: ?", i, FactionInfo[i][FactionName]);
            SendClientMessage(playerid, WHITE, string);
            members = 0;
        }
        return 1;
    }

Createfaction [only v2]
pawn Код:
if (strcmp(cmd, "/createfaction", true) == 0)
    {
        if(PlayerInfo[playerid][pAdmin] >= 1339 || PlayerInfo[playerid][pFactionMod])
        {
            new name[64];
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SyntaxMessage(playerid, "/createfaction [type] [name]");
                SendClientMessage(playerid, WHITE, "Available types: None[0], Law Enforcement[1], Agent[2], Army[3], Government[4], SWAT[5], Gov-Serv's Light Removal[6], News[7], Medic[8]");
                return 1;
            }
            new type = strval(tmp);
            if (type < 0 || type > 8)
            {
                SendClientMessage(playerid, GREY, "Invalid type ID.");
                return 1;
            }
            new factionid = -1;
            for (new i = 1; i < MAX_FACTIONS + 1; i ++)
            {
                if (!FactionInfo[i][FactionExists])
                {
                    factionid = i;
                    break;
                }
            }
            strmid(name, cmdtext, idx + 1, strlen(cmdtext));
            FactionInfo[factionid][FactionExists] = true;
            format(FactionInfo[factionid][FactionName], 64, name);
            format(FactionInfo[factionid][FactionLeader], 24, "None");
            FactionInfo[factionid][FactionMembers] = 0;
            FactionInfo[factionid][MaximumSkins] = 1;
            FactionInfo[factionid][FactionSkins] = 0;
            FactionInfo[factionid][FactionType] = type;
            FactionInfo[factionid][FactionColor] = 0;
            FactionInfo[factionid][FactionDivisions] = 0;

            SaveFactions();
            format(string, sizeof(string), "You have created a faction (ID: %d).", factionid);
            SendClientMessage(playerid, YELLOW, string);
            SendClientMessage(playerid, WHITE, "NOTE: Type /editfaction to edit this faction.");
            return 1;
        }
        else
        {
            SendClientMessage(playerid, GREY, "    You are not authorized to use this command.");
        }
        return 1;
    }
/makeleader V2

pawn Код:
if(strcmp(cmd, "/makeleader", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SyntaxMessage(playerid, "/makeleader [playerid/name] [number]");
                return 1;
            }
            new para1;
            para1 = ReturnUser(tmp);
            if(IsPlayerNPC(para1)) return 1;
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SyntaxMessage(playerid, "/makeleader [playerid/name] [number]");
                return 1;
            }
            new faction;
            faction = strval(tmp);
            if(faction < 0 || faction > MAX_FACTIONS) { format(string, sizeof(string), "Faction ID can't be below 0 or above %d.", MAX_FACTIONS); SendClientMessage(playerid, GREY, string); return 1; }
            if(faction != 0 && !FactionInfo[faction][FactionExists]) return SendClientMessage(playerid, GREY, "Invalid faction ID.");
            if(PlayerInfo[playerid][pAdmin] >= 99999 || PlayerInfo[playerid][pFactionMod] > 0)
            {
                if(IsPlayerConnected(para1))
                {
                    if(para1 != INVALID_PLAYER_ID)
                    {
                        GetPlayerName(playerid, sendername, sizeof(sendername));
                        GetPlayerName(para1, giveplayer, sizeof(giveplayer));
                        PlayerInfo[para1][pRank] = (faction) ? (6) : (0);
                        MakeLeaderOf(para1, faction);
                        format(string, sizeof(string), "WARNING :- You have given %s the leadership-badge of the %s orgnizaiton.", giveplayer,FactionInfo[faction][FactionName]);
                        SendClientMessage(playerid, LIGHTBLUE, string);
                        format(string, sizeof(string), "WARNING :- Adminstrator %s has given you the leadership-badge of the %s orgnization.",sendername,FactionInfo[faction][FactionName]);
                        SendClientMessage(para1, COLOR_LIGHTRED, string);
                        PlayerInfo[para1][pLeader] = faction;
                        PlayerInfo[para1][pMember] = faction;
                        PlayerInfo[para1][pDivision] = 0;
                        SetPlayerToTeamColor(para1);
                        OnPlayerSave(para1);
                    }
                }
            }
            else
            {
                SendClientMessage(playerid, GREY, "    You are not authorized to use that command.");
            }
        }
        return 1;
    }
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)