/set script issue
#2

Your checks were out of whack a bit? Try this
pawn Код:
if(strcmp(cmd, "/set", true) == 0)
{
    new string[128], opt[20];
    if(PlayerInfo[playerid][pAdmin] < 3) return 1;
    if(sscanf(params, "us[20]i", id, opt, Value))
    {
        SendClientMessage(playerid, -1, "SYNTAX: /set [Playerid] [Option] [Value]");
        SendClientMessage(playerid, -1, "OPTIONS: Army, Origin, Interior, Skin, ArmyRank, Money, Age");
        SendClientMessage(playerid, -1, "OPTIONS: Armor, VW, Playinghours, Score, Experience");
    }
    else
    {
        if(strcmp(opt, "army", true) == 0)
        {
            SavePlayerDat(id);
            PlayerInfo[id][pArmy] = Value;
            PlayerInfo[id][pArmyRank] = 1;
            if(Value == 1)
            {
                format(string, sizeof(string), "You have set %s's Army to the United States Military. (ID %d)", GetName(id), Value);
                SendClientMessage(playerid, -1, string);
                format(string, sizeof(string), "Administrator %s has set your Army to the United States Military. (ID %d)", GetName(playerid), Value);
                SendClientMessage(id, -1, string);
            }
            else if(Value == 3)
            {
                format(string, sizeof(string), "You have set %s's Army to the Soviet Union. (ID %d)", GetName(id), Value);
                SendClientMessage(playerid, -1, string);
                format(string, sizeof(string), "Administrator %s has set your Army to the Soviet Union. (ID %d)", GetName(playerid), Value);
                SendClientMessage(id, -1, string);
            }
            else if(Value == 2)
            {
                format(string, sizeof(string), "You have set %s's Army to the European Alliance. (ID %d)", GetName(id), Value);
                SendClientMessage(playerid, -1, string);
                format(string, sizeof(string), "Administrator %s has set your Army to the European Alliance. (ID %d)", GetName(playerid), Value);
                SendClientMessage(id, -1, string);
            }
            else if(Value == 4)
            {
                format(string, sizeof(string), "You have set %s's Army to the Asian Military Forces. (ID %d)", GetName(id), Value);
                SendClientMessage(playerid, -1, string);
                format(string, sizeof(string), "Administrator %s has set your Army to the Asian Military Forces. (ID %d)", GetName(playerid), Value);
                SendClientMessage(id, -1, string);
            }
            else if(Value == 5)
            {
                format(string, sizeof(string), "You have set %s's Army to the German Armed Forces. (ID %d)", GetName(id), Value);
                SendClientMessage(playerid, -1, string);
                format(string, sizeof(string), "Administrator %s has set your Army to the German Armed Forces. (ID %d)", GetName(playerid), Value);
                SendClientMessage(id, -1, string);
            }
            else if(Value == 6)
            {
                format(string, sizeof(string), "You have set %s's Army to the Taliban. (ID %d)", GetName(id), Value);
                SendClientMessage(playerid, -1, string);
                format(string, sizeof(string), "Administrator %s has set your Army to the Taliban. (ID %d)", GetName(playerid), Value);
                SendClientMessage(id, -1, string);
            }
        }
        if(strcmp(opt, "origin", true) == 0)
        {
            SavePlayerDat(id);
            PlayerInfo[id][pOrigin] = Value;
            if(Value == 1)
            {
                format(string, sizeof(string), "You have set %s's Origin to American (ID %d)", GetName(id), Value);
                SendClientMessage(playerid, -1, string);
                format(string, sizeof(string), "Administrator %s has set your Origin to American. (ID %d)", GetName(playerid), Value);
                SendClientMessage(id, -1, string);
            }
            else if(Value == 3)
            {
                format(string, sizeof(string), "You have set %s's Origin to European (ID %d)", GetName(id), Value);
                SendClientMessage(playerid, -1, string);
                format(string, sizeof(string), "Administrator %s has set your Origin to European. (ID %d)", GetName(playerid), Value);
                SendClientMessage(id, -1, string);
            }
            else if(Value == 2)
            {
                format(string, sizeof(string), "You have set %s's Origin to Russian (ID %d)", GetName(id), Value);
                SendClientMessage(playerid, -1, string);
                format(string, sizeof(string), "Administrator %s has set your Origin to Russian. (ID %d)", GetName(playerid), Value);
                SendClientMessage(id, -1, string);
            }
            else if(Value == 4)
            {
                format(string, sizeof(string), "You have set %s's Origin to Asian (ID %d)", GetName(id), Value);
                SendClientMessage(playerid, -1, string);
                format(string, sizeof(string), "Administrator %s has set your Origin to Asian. (ID %d)", GetName(playerid), Value);
                SendClientMessage(id, -1, string);
            }
            else if(Value == 5)
            {
                format(string, sizeof(string), "You have set %s's Origin to German (ID %d)", GetName(id), Value);
                SendClientMessage(playerid, -1, string);
                format(string, sizeof(string), "Administrator %s has set your Origin to German. (ID %d)", GetName(playerid), Value);
                SendClientMessage(id, -1, string);
            }
            else if(Value == 6)
            {
                format(string, sizeof(string), "You have set %s's Origin to Taliban (ID %d)", GetName(id), Value);
                SendClientMessage(playerid, -1, string);
                format(string, sizeof(string), "Administrator %s has set your Origin to Taliban. (ID %d)", GetName(playerid), Value);
                SendClientMessage(id, -1, string);
            }
            else if(Value == 7)
            {
                format(string, sizeof(string), "You have set %s's Origin to Other (ID %d)", GetName(id), Value);
                SendClientMessage(playerid, -1, string);
                format(string, sizeof(string), "Administrator %s has set your Origin to Other. (ID %d)", GetName(playerid), Value);
                SendClientMessage(id, -1, string);
            }
        }
        if(strcmp(opt, "interior", true) == 0)
        {
            SetPlayerInterior(playerid, Value);
        }
        if(strcmp(opt, "skin", true) == 0)
        {
            SetPlayerSkin(playerid, Value);
            SavePlayerDat(playerid);
            format(string, sizeof(string), "You have set %s's skin to ID: %d", GetName(id), Value);
            SendClientMessage(playerid, -1, string);
            format(string, sizeof(string), "Administrator %s has set your skin to ID: %d", GetName(playerid), Value);
            SendClientMessage(id, -1, string);
        }
        if(strcmp(opt, "armyrank", true) == 0)
        {
            new army;
            PlayerInfo[playerid][pArmyRank] = Value;
            SavePlayerDat(playerid);
            format(string, sizeof(string), "You have set %s's army rank to %d", GetName(id), Value);
            SendClientMessage(playerid, -1, string);
            if(Value == 0)
            {
                format(string, sizeof(string), "Administrator %s has set your army rank to %d (0)", GetName(playerid), ArmyInfo[army][RankName0]);
                SendClientMessage(playerid, -1, string);
            }
            if(Value == 1)
            {
                format(string, sizeof(string), "Administrator %s has set your army rank to %d (1)", GetName(playerid), ArmyInfo[army][RankName0]);
                SendClientMessage(playerid, -1, string);
            }
            if(Value == 2)
            {
                format(string, sizeof(string), "Administrator %s has set your army rank to %d (2)", GetName(playerid), ArmyInfo[army][RankName0]);
                SendClientMessage(playerid, -1, string);
            }
            if(Value == 3)
            {
                format(string, sizeof(string), "Administrator %s has set your army rank to %d (3)", GetName(playerid), ArmyInfo[army][RankName0]);
                SendClientMessage(playerid, -1, string);
            }
            if(Value == 4)
            {
                format(string, sizeof(string), "Administrator %s has set your army rank to %d (4)", GetName(playerid), ArmyInfo[army][RankName0]);
                SendClientMessage(playerid, -1, string);
            }
            if(Value == 5)
            {
                format(string, sizeof(string), "Administrator %s has set your army rank to %d (5)", GetName(playerid), ArmyInfo[army][RankName0]);
                SendClientMessage(playerid, -1, string);
            }
            if(Value == 6)
            {
                format(string, sizeof(string), "Administrator %s has set your army rank to %d (6)", GetName(playerid), ArmyInfo[army][RankName0]);
                SendClientMessage(playerid, -1, string);
            }
            if(Value == 7)
            {
                format(string, sizeof(string), "Administrator %s has set your army rank to %d (7)", GetName(playerid), ArmyInfo[army][RankName0]);
                SendClientMessage(playerid, -1, string);
            }
            if(Value == 8)
            {
                format(string, sizeof(string), "Administrator %s has set your army rank to %d (8)", GetName(playerid), ArmyInfo[army][RankName0]);
                SendClientMessage(playerid, -1, string);
            }
            if(Value == 9)
            {
                format(string, sizeof(string), "Administrator %s has set your army rank to %d (9)", GetName(playerid), ArmyInfo[army][RankName0]);
                SendClientMessage(playerid, -1, string);
            }
            if(Value == 10)
            {
                format(string, sizeof(string), "Administrator %s has set your army rank to %d (10)", GetName(playerid), ArmyInfo[army][RankName0]);
                SendClientMessage(playerid, -1, string);
            }
            if(Value == 11)
            {
                format(string, sizeof(string), "Administrator %s has set your army rank to %d (11)", GetName(playerid), ArmyInfo[army][RankName0]);
                SendClientMessage(playerid, -1, string);
            }
            if(Value == 12)
            {
                format(string, sizeof(string), "Administrator %s has set your army rank to %d (12)", GetName(playerid), ArmyInfo[army][RankName0]);
                SendClientMessage(playerid, -1, string);
            }
            if(Value == 13)
            {
                format(string, sizeof(string), "Administrator %s has set your army rank to %d (13)", GetName(playerid), ArmyInfo[army][RankName0]);
                SendClientMessage(playerid, -1, string);
            }
            if(Value == 14)
            {
                format(string, sizeof(string), "Administrator %s has set your army rank to %d (14)", GetName(playerid), ArmyInfo[army][RankName0]);
                SendClientMessage(playerid, -1, string);
            }
            if(Value == 15)
            {
                format(string, sizeof(string), "Administrator %s has set your army rank to %d (15)", GetName(playerid), ArmyInfo[army][RankName0]);
                SendClientMessage(playerid, -1, string);
            }
            if(Value == 16)
            {
                format(string, sizeof(string), "Administrator %s has set your army rank to %d (16)", GetName(playerid), ArmyInfo[army][RankName0]);
                SendClientMessage(playerid, -1, string);
            }
            if(Value == 17)
            {
                format(string, sizeof(string), "Administrator %s has set your army rank to %d (17)", GetName(playerid), ArmyInfo[army][RankName0]);
                SendClientMessage(playerid, -1, string);
            }
            if(Value == 18)
            {
                format(string, sizeof(string), "Administrator %s has set your army rank to %d (18)", GetName(playerid), ArmyInfo[army][RankName0]);
                SendClientMessage(playerid, -1, string);
            }
            if(Value == 19)
            {
                format(string, sizeof(string), "Administrator %s has set your army rank to %d (19)", GetName(playerid), ArmyInfo[army][RankName0]);
                SendClientMessage(playerid, -1, string);
            }
            if(Value == 20)
            {
                format(string, sizeof(string), "Administrator %s has set your army rank to %d (20)", GetName(playerid), ArmyInfo[army][RankName0]);
                SendClientMessage(playerid, -1, string);
            }
            if(Value == 21)
            {
                format(string, sizeof(string), "Administrator %s has set your army rank to %d (21)", GetName(playerid), ArmyInfo[army][RankName0]);
                SendClientMessage(playerid, -1, string);
            }
            if(Value == 22)
            {
                format(string, sizeof(string), "Administrator %s has set your army rank to %d (22)", GetName(playerid), ArmyInfo[army][RankName0]);
                SendClientMessage(playerid, -1, string);
            }
            if(Value == 23)
            {
                format(string, sizeof(string), "Administrator %s has set your army rank to %d (23)", GetName(playerid), ArmyInfo[army][RankName0]);
                SendClientMessage(playerid, -1, string);
            }
            if(Value == 24)
            {
                format(string, sizeof(string), "Administrator %s has set your army rank to %d (24)", GetName(playerid), ArmyInfo[army][RankName0]);
                SendClientMessage(playerid, -1, string);
            }
        }
        if(strcmp(opt, "money", true) == 0)
        {
            SetPlayerMoney(playerid, Value);
            SavePlayerDat(playerid);
            format(string, sizeof(string), "You have set %s's money to: $%d", GetName(id), Value);
            SendClientMessage(playerid, -1, string);
            format(string, sizeof(string), "Administrator %s has set your money to: $%d", GetName(playerid), Value);
            SendClientMessage(id, -1, string);
        }
    }
    return 1;
}
PS You don't need that many if statements...
Reply


Messages In This Thread
/set script issue - by nmader - 02.05.2012, 01:55
Re: /set script issue - by ReneG - 02.05.2012, 02:03
Re: /set script issue - by nmader - 03.05.2012, 00:46
Re: /set script issue - by PrawkC - 03.05.2012, 01:25
Re: /set script issue - by nmader - 03.05.2012, 01:31
Re: /set script issue - by SuperViper - 03.05.2012, 01:36
Re: /set script issue - by Ballu Miaa - 03.05.2012, 01:59
Re: /set script issue - by JaKe Elite - 03.05.2012, 02:01

Forum Jump:


Users browsing this thread: 1 Guest(s)