Need assistance.
#3

pawn Код:
CMD:makeleader(playerid, params[])
{
    new playerb, faction, string[128];
    if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
    if(PlayerInfo[playerid][pAdmin] < 1337 && !PlayerInfo[playerid][pFacMod]) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command.");

    if(sscanf(params, "ui", playerb, faction))
    {
        SendClientMessage(playerid, COLOR_WHITE, "[Usage]: /makeleader [playerid] [factionid]");
        SendClientMessage(playerid, COLOR_GREY, "Available Factions: 0) Civilian | 1) LSPD | 2) Government | 3) Hitman Agency | 4) News Agency | 5) LSFMD | 6) FBI | 7) SAR");
        return 1;
    }
    if(FacInfo[faction][pFacLeader]) return SendClientMessage(playerid, COLOR_GREY, "There is already one leading this Faction.");
    if(!IsPlayerLoggedIn(playerb)) return SendClientMessage(playerid, COLOR_GREY, "Player is not connected.");
    if(faction < 0 || faction > 7) return SendClientMessage(playerid, COLOR_GREY, "Factions are between 0 and 7");
    // Setting Player's Stats
    if(faction == 0)
    {
        PlayerInfo[playerb][pFac] = 0;
        PlayerInfo[playerb][pFacRank] = 0;
        PlayerInfo[playerb][pFacLeader] = 0;
    }
    else
    {
        PlayerInfo[playerb][pFac] = faction;
        PlayerInfo[playerb][pFacRank] = 6;
        PlayerInfo[playerb][pFacLeader] = 1;
        PlayerInfo[playerb][pFacDiv] = 0;
        PlayerInfo[playerb][pFacDivLeader] = 0;
    }
    // Admin & Player messages
    format(string, sizeof(string), "AdmInfo: %s has given %s the {33AA33}%s{FF6347} Faction leadership.", RPN(playerid), RPN(playerb), RPFNEx(playerb));
    SendAdminMessage(COLOR_DARKRED, 1, string);
    format(string, sizeof(string), " %s has given you the Leadership over {33AA33}%s{33CCFF}.", RPN(playerid), RPFNEx(playerb));
    SendClientMessage(playerb, COLOR_LIGHTBLUE, string);
    format(string, sizeof(string), "AdmInfo: %s has given %s the %s faction leadership.", RPN(playerid), RPN(playerb), RPFNEx(playerb));
    Log("logs/factions.log", string);
    return 1;
}
Quite unsure why you even had an idx in the first place.

edit:

If "FacInfo[faction][pFacLeader]" is a string then this will not work.
Reply


Messages In This Thread
Need assistance. - by Laure - 28.11.2012, 10:56
Re: Need assistance. - by Laure - 29.11.2012, 00:58
Re: Need assistance. - by maramizo - 29.11.2012, 01:03
Re: Need assistance. - by Laure - 29.11.2012, 01:10
Re: Need assistance. - by Laure - 29.11.2012, 13:07

Forum Jump:


Users browsing this thread: 1 Guest(s)