Errors with this command
#3

Use the code inside a block of code { } for more than 1 statement.
pawn Код:
CMD:makegroupleader(playerid, params[])
{
    if(PlayerInfo[playerid][pAdmin] >= 4)
    {
        new iTargetID, iGroupID;
        if(sscanf(params, "ud", iTargetID, iGroupID)) return SendClientMessage(playerid, COLOR_GRAD1, SYNTAX_MESSAGE"/makegroupleader [playerid] [groupid(/listgroups)]");
        new string[128];
        if(iGroupID > MAX_GROUPS && iGroupID != 255 || iGroupID < 0)
        {
            format(string, sizeof(string),"Invalid group, ranges from 0 to %i & 255 - Remove.", MAX_GROUPS);
            SendClientMessage(playerid, COLOR_GREY, string);
            return 1;
        }
        if(IsPlayerConnected(iTargetID))
        {
            if(PlayerData[iTargetID][pGangID] != 255) return SendClientMessage(playerid, COLOR_GRAD1, "The specified player is in a gang.");
            if(iGroupID == 255)
            {
                if(pTazer{iTargetID} == 1)
                {
                    // ...
                }
                format(string, sizeof(string), "Your leadership has been taken by Administrator %s.", getPlayerName(playerid));
                SendClientMessage(iTargetID, COLOR_LIGHTBLUE, string);
               
                format(string, sizeof(string), "You have taken %s leadership.", getPlayerName(iTargetID));
                SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
               
                format(string, sizeof(string), "%s has taken %s leadership.", getPlayerName(playerid), getPlayerName(iTargetID));
                Log("logs/makeleader.log", string);
               
                PlayerData[iTargetID][pRank] = 255;
                PlayerData[iTargetID][pDivision] = 255;
                PlayerData[iTargetID][pLeader] = 255;
                PlayerData[iTargetID][pFaction] = 255;
               
                HitmanBadge[iTargetID] = 255;
                return 1;
            }
            if(GroupData[iGroupID][g_szGroupName][0] == 0) return SendClientMessage(playerid, COLOR_GRAD1, "The specified group has not been setup.");
            if(GroupData[iGroupID][g_iDisabled] == 1) return SendClientMessage(playerid, COLOR_GRAD1, "You cannot make anyone the leader of this group, it's disabled.");
            new iRankCount = 0;
            for(new i = 0; i < MAX_GROUP_RANKS; i++)
            {
                if(strlen(GroupRanks[iGroupID][i]) >= 1 && strcmp(GroupRanks[iGroupID][i], "None", true))
                {
                    ++iRankCount;
                }
            }
            PlayerData[iTargetID][pLeader] = iGroupID;
            PlayerData[iTargetID][pRank] = iRankCount-1;
            PlayerData[iTargetID][pFaction] = iGroupID;
            PlayerData[iTargetID][pDivision] = 0;
           
            format(string, sizeof(string), "You have been made the leader of the %s by Administrator %s.", GroupData[iGroupID][g_szGroupName], getPlayerName(playerid));
            SendClientMessage(iTargetID, COLOR_LIGHTBLUE, string);
           
            format(string, sizeof(string), "You have made %s the leader of the %s.", getPlayerName(iTargetID), GroupData[iGroupID][g_szGroupName]);
            SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
           
            format(string, sizeof(string), "%s had made %s the leader of %s (%i).", getPlayerName(playerid), getPlayerName(iTargetID), GroupData[iGroupID][g_szGroupName], iGroupID);
            Log("logs/makeleader.log", string);
           
            PlayerData[iTargetID][pDuty] = 0;
            SetPlayerToTeamColor(iTargetID);
        }
    }
    else Invalid_Admin(playerid);
    return 1;
}
On the part I commented: // ...
I don't know whether you want if pTazerReplace{iTargetID} > 0 then GivePlayerValidWeapon only:
pawn Код:
RemovePlayerWeapon(iTargetID, 23);
if(pTazerReplace{iTargetID} > 0) GivePlayerValidWeapon(iTargetID, pTazerReplace{iTargetID}, 60000);
pTazer{iTargetID} = 0;
pTazerReplace{iTargetID} = 0;
Or if pTazerReplace{iTargetID} > 0 then GivePlayerValidWeapon and reset the values:
pawn Код:
RemovePlayerWeapon(iTargetID, 23);
if(pTazerReplace{iTargetID} > 0)
{
    GivePlayerValidWeapon(iTargetID, pTazerReplace{iTargetID}, 60000);
    pTazer{iTargetID} = 0;
    pTazerReplace{iTargetID} = 0;
}
Change accordingly.
Reply


Messages In This Thread
Errors with this command - by Rydur - 02.01.2014, 11:45
Re: Errors with this command - by WhiteNigger - 02.01.2014, 11:52
Re: Errors with this command - by Konstantinos - 02.01.2014, 11:56
Re: Errors with this command - by Rydur - 02.01.2014, 12:10
Re: Errors with this command - by camaro8 - 02.01.2014, 12:14
Re: Errors with this command - by Rydur - 02.01.2014, 12:16
Re: Errors with this command - by camaro8 - 02.01.2014, 12:20
Re: Errors with this command - by Rydur - 02.01.2014, 12:26
Re: Errors with this command - by HB - 02.01.2014, 12:30
Re: Errors with this command - by Rydur - 02.01.2014, 13:06

Forum Jump:


Users browsing this thread: 1 Guest(s)