Can a scripter help me figure out the problem with this:
#3

Not tested.
pawn Код:
CMD:demote(playerid, params[])
{
    if(LoggedIn[playerid] == 0) return SendClientMessage(playerid, COLOUR_GREY, "You must be logged in to use this command.");
    new
        giveplayerid;
    else if(isnull(params)) return SendClientMessage(playerid, COLOUR_GREY, "Usage: /demote [player id or name]");
    else if(FRank[playerid] < 6) return SendClientMessage(playerid, COLOUR_GREY, "You are not a high enough rank.");
    else if(Faction[playerid] < 1) return SendClientMessage(playerid, COLOUR_GREY, "You are not in a faction.");
    else if(Faction[giveplayerid] != Faction[playerid]) return SendClientMessage(playerid, COLOUR_GREY, "That player is not in your faction.");
    else {
        new
            string[200],
            string1[200],
            rank;
        FRank[giveplayerid] --;
        new
            factionid = Faction[playerid];
        if(rank > FRank[giveplayerid]) switch(rank) {
            case 1: format(string, sizeof(string), "You have demoted %s to the rank of %s(2)", GetNameEx(giveplayerid), FactionRank2[factionid]);
            case 2: format(string, sizeof(string), "You have demoted %s to the rank of %s(3)", GetNameEx(giveplayerid), FactionRank3[factionid]);
            case 3: format(string, sizeof(string), "You have demoted %s to the rank of %s(4)", GetNameEx(giveplayerid), FactionRank4[factionid]);
            case 4: format(string, sizeof(string), "You have demoted %s to the rank of %s(5)", GetNameEx(giveplayerid), FactionRank5[factionid]);
            case 5: format(string, sizeof(string), "You have demoted %s to the rank of %s(6)", GetNameEx(giveplayerid), FactionRank6[factionid]);
            case 6: format(string, sizeof(string), "You have demoted %s to the rank of %s(7)", GetNameEx(giveplayerid), FactionRank7[factionid]);
            SendClientMessage(playerid, COLOUR_ORANGE, string);
            case 1: format(string1, sizeof(string1), "%s has demoted you to the rank of %s(2)", GetNameEx(playerid), FactionRank2[factionid]);
            case 2: format(string1, sizeof(string1), "%s has demoted you to the rank of %s(3)", GetNameEx(playerid), FactionRank3[factionid]);
            case 3: format(string1, sizeof(string1), "%s has demoted you to the rank of %s(4)", GetNameEx(playerid), FactionRank4[factionid]);
            case 4: format(string1, sizeof(string1), "%s has demoted you to the rank of %s(5)", GetNameEx(playerid), FactionRank5[factionid]);
            case 5: format(string1, sizeof(string1), "%s has demoted you to the rank of %s(6)", GetNameEx(playerid), FactionRank6[factionid]);
            case 6: format(string1, sizeof(string1), "%s has demoted you to the rank of %s(7)", GetNameEx(playerid), FactionRank7[factionid]);
            SendClientMessage(giveplayerid, COLOUR_ORANGE, string1);
        }
    }
    FRank[playerid] = rank;
    MySQL_SetInteger(PlayerSQLID[playerid], "FRank", rank, "Accounts");
    return 1;
}
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)