error 075: input line too long (after substitutions)
#1

Having a major brainfart at what to do here... Could any one give me any tips? I know the if(skinid < 1 etc etc line is too long but I need all the skin id's in there. How do I solve this?

pawn Код:
if(dialogid == 17)
    {
        if(!response)
        {
            TogglePlayerControllable(playerid,1);
            return 1;
        }
        if(response)
        {
            new skinid = strval(inputtext);
            if(!strlen(inputtext)) return ShowPlayerDialog(playerid,17,DIALOG_STYLE_INPUT,"Select your Skin ID","Type the ID of the skin you wish to use: ","Select","Cancel");
            if(skinid < 1 || skinid > 299 || skinid == 274 || skinid == 275 || skinid == 276 || skinid == 280 || skinid == 281 || skinid == 282 || skinid == 283 || skinid == 288 || skinid == 285 || skinid == 287 || skinid == 163 || skinid == 164 || skinid == 165 || skinid == 166 || skinid == 286 || skinid == 277 || skinid == 278 || skinid == 279 || skinid == 105 || skinid == 106 || skinid == 107 || skinid == 102 || skinid == 103 || skinid == 104 || skinid == 114 || skinid == 115 || skinid == 116 || skinid == 173 || skinid == 174 || skinid == 175 || skinid == 117 || skinid == 118 || skinid == 120 || skinid == 121 || skinid == 122 || skinid == 123)
            {
                SendClientMessage(playerid, COLOR_RED, "Invalid OR Faction Skin!");
                ShowPlayerDialog(playerid,17,DIALOG_STYLE_INPUT,"Select your Skin ID","Type the ID of the skin you wish to use: ","Select","Cancel");
                return 1;
            }
            else
            {
                SetPlayerSkin(playerid, skinid);
                PlayerInfo[playerid][pSkin] = skinid;
                SendClientMessage(playerid, COLOR_ORANGE, "Your Skin has been changed!");
                TogglePlayerControllable(playerid,1);
                GivePlayerCash(playerid, -350);
                return 1;
            }
        }
    }
EDIT: I think I solved it... Compiled with no errors...

pawn Код:
if(dialogid == 17)
    {
        if(!response)
        {
            TogglePlayerControllable(playerid,1);
            return 1;
        }
        if(response)
        {
            new skinid = strval(inputtext);
            if(!strlen(inputtext)) return ShowPlayerDialog(playerid,17,DIALOG_STYLE_INPUT,"Select your Skin ID","Type the ID of the skin you wish to use: ","Select","Cancel");
            if(skinid < 1 || skinid > 299 || skinid == 274 || skinid == 275 || skinid == 276 || skinid == 280 || skinid == 281 || skinid == 282 || skinid == 283 || skinid == 288 || skinid == 285 ||
            skinid == 287 || skinid == 163 || skinid == 164 || skinid == 165 || skinid == 166 || skinid == 286 || skinid == 277 || skinid == 278 || skinid == 279 || skinid == 105 || skinid == 106 ||
            skinid == 107 || skinid == 102 || skinid == 103 || skinid == 104 || skinid == 114 || skinid == 115 || skinid == 116 || skinid == 173 || skinid == 174 || skinid == 175 || skinid == 117 || skinid == 118 || skinid == 120 || skinid == 121 || skinid == 122 || skinid == 123)
            {
                SendClientMessage(playerid, COLOR_RED, "Invalid OR Faction Skin!");
                ShowPlayerDialog(playerid,17,DIALOG_STYLE_INPUT,"Select your Skin ID","Type the ID of the skin you wish to use: ","Select","Cancel");
                return 1;
            }
            else
            {
                SetPlayerSkin(playerid, skinid);
                PlayerInfo[playerid][pSkin] = skinid;
                SendClientMessage(playerid, COLOR_ORANGE, "Your Skin has been changed!");
                TogglePlayerControllable(playerid,1);
                GivePlayerCash(playerid, -350);
                return 1;
            }
        }
    }
Reply
#2

Make an array of the skins and loop through them, or use switch().
Reply
#3

pawn Код:
if(dialogid == 17)
{
    if(!response) TogglePlayerControllable(playerid,1);
    else
    {
        if(!strlen(inputtext)) return ShowPlayerDialog(playerid,17,DIALOG_STYLE_INPUT,"Select your Skin ID","Type the ID of the skin you wish to use: ","Select","Cancel");
        new skinid = strval(inputtext);
        switch (skinid)
        {
            case 1 .. 101, 108 .. 113, 119, 124 .. 162, 167 .. 172, 176 .. 273, 284, 289 .. 299:
            {
                SetPlayerSkin(playerid, skinid);
                PlayerInfo[playerid][pSkin] = skinid;
                SendClientMessage(playerid, COLOR_ORANGE, "Your Skin has been changed!");
                TogglePlayerControllable(playerid,1);
                GivePlayerCash(playerid, -350);
            }
            default:
            {
                SendClientMessage(playerid, COLOR_RED, "Invalid OR Faction Skin!");
                ShowPlayerDialog(playerid,17,DIALOG_STYLE_INPUT,"Select your Skin ID","Type the ID of the skin you wish to use: ","Select","Cancel");
            }
        }
    }
    return 1;
}
Reply
#4

Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
pawn Код:
if(dialogid == 17)
{
    if(!response) TogglePlayerControllable(playerid,1);
    else
    {
        if(!strlen(inputtext)) return ShowPlayerDialog(playerid,17,DIALOG_STYLE_INPUT,"Select your Skin ID","Type the ID of the skin you wish to use: ","Select","Cancel");
        new skinid = strval(inputtext);
        switch (skinid)
        {
            case 1 .. 101, 108 .. 113, 119, 124 .. 162, 167 .. 172, 176 .. 273, 284, 289 .. 299:
            {
                SetPlayerSkin(playerid, skinid);
                PlayerInfo[playerid][pSkin] = skinid;
                SendClientMessage(playerid, COLOR_ORANGE, "Your Skin has been changed!");
                TogglePlayerControllable(playerid,1);
                GivePlayerCash(playerid, -350);
            }
            default:
            {
                SendClientMessage(playerid, COLOR_RED, "Invalid OR Faction Skin!");
                ShowPlayerDialog(playerid,17,DIALOG_STYLE_INPUT,"Select your Skin ID","Type the ID of the skin you wish to use: ","Select","Cancel");
            }
        }
    }
    return 1;
}
I don't think you read what my code was doing exactly... I just simply want to carry the code onto 3 lines. Also the skin id's I've defined are NOT to be used as they are faction/gang skins.
Reply
#5

Quote:
Originally Posted by Phil_Cutcliffe
Посмотреть сообщение
I don't think you read what my code was doing exactly... I just simply want to carry the code onto 3 lines. Also the skin id's I've defined are NOT to be used as they are faction/gang skins.
I did and that's what my code does. I simply check if the skin is valid (not those numbers of faction/gang skins) and in the default part goes any invalid skin. Using an if statement with so many expressions of OR (||) inside that statement is really bad, that's why I used switch which is faster.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)