Skin Selection
#1

pawn Код:
case DIALOG_SKIN:
            {
                if(response)
                {
                    new skinid;
                    skinid = strval(inputtext);

                    if(skinid < 0 || skinid > 299)
                    {
                        if(skinid == 280 || skinid == 281 || skinid == 282 || skinid ==283 || skinid ==288 || skinid ==284 || skinid ==285 || skinid ==286 || skinid ==287)return SendClientMessage(playerid, GREY, "This skin is restricted, therefore you can't use it.");
                        if(skinid ==277 || skinid == 278 || skinid ==279 || skinid ==274 || skinid ==275 || skinid == 276)return SendClientMessage(playerid, GREY, "This skin is restricted, therefore you can't use it.");

                        Player[playerid][Clothes1] = skinid;
                        SetPlayerSkin(playerid, skinid);
                        SendClientMessage(playerid, WHITE, ""GREEN_EMBED"Character Creation ~ "WHITE_EMBED"Completed");
                    }
                    else
                    {
                        SendClientMessage(playerid, WHITE, ""GREEN_EMBED"Character Creation ~ "WHITE_EMBED"INVALID SKIN ID");
                        ShowPlayerDialog(playerid, DIALOG_SKIN, DIALOG_STYLE_INPUT, ""GREEN_EMBED"Skin selection",""WHITE_EMBED"Input the ID of the skin you wish to use.\n\nIf you do not know, please input ID 0 for default","Choose","");
                    }
                }
            }
I tried a new system but it just comes up "INVALID_SKIN_ID", help?
Reply
#2

anyone?
Reply
#3

you can't use else inside switch and you have a useless bracket inside else
Reply
#4

You can use else inside of a switch, I have done it elsewhere in the script.
Reply
#5

oh i am sorry about that, never tried it. Anyway, remove that bracket.
Reply
#6

No problem, anyways I have rescripted it but it just wont assign the skin:

pawn Код:
case DIALOG_SKIN:
            {
                if(response)
                {
                    new skinid;
                    skinid = strval(inputtext);

                    if(skinid < 0 || skinid > 299)
                    {
                        if(skinid == 280 || skinid == 281 || skinid == 282 || skinid ==283 || skinid ==288 || skinid ==284 || skinid ==285 || skinid ==286 || skinid ==287)return SendClientMessage(playerid, GREY, "This skin is restricted, therefore you can't use it.");
                        if(skinid ==277 || skinid == 278 || skinid ==279 || skinid ==274 || skinid ==275 || skinid == 276)return SendClientMessage(playerid, GREY, "This skin is restricted, therefore you can't use it.");

                        Player[playerid][Clothes1] = skinid;
                        SetPlayerSkin(playerid, skinid);
                        SendClientMessage(playerid, WHITE, ""GREEN_EMBED"Character Creation ~ "WHITE_EMBED"Completed");
                    }
                    else
                    {
                        SendClientMessage(playerid, WHITE, ""GREEN_EMBED"Character Creation ~ "WHITE_EMBED"INVALID SKIN ID");
                        ShowPlayerDialog(playerid, DIALOG_SKIN, DIALOG_STYLE_INPUT, ""GREEN_EMBED"Skin selection",""WHITE_EMBED"Input the ID of the skin you wish to use.\n\nIf you do not know, please input ID 0 for default","Choose","");
                    }
                }
            }
Reply
#7

Try this:
pawn Код:
// Credits to whoever made this
stock IsValidSkin(skinid)
{
    new badSkins[22] =
    { 3, 4, 5, 6, 8, 42, 65, 74, 86, 119, 149, 208, 268, 273, 289 };
    if(skinid > 299 || skinid < 0) return 0;
    for(new i = 0; i < 22; i++)
    {
        if(skinid == badSkins[i]) return 0;
    }
    return 1;
}
pawn Код:
case DIALOG_SKIN:
            {
                if(response)
                {
                    new skinid;
                    skinid = strval(inputtext);

                    if(IsValidSkin(skinid))
                    {
                        if(skinid == 280 || skinid == 281 || skinid == 282 || skinid ==283 || skinid ==288 || skinid ==284 || skinid ==285 || skinid ==286 || skinid ==287)return SendClientMessage(playerid, GREY, "This skin is restricted, therefore you can't use it.");
                        if(skinid ==277 || skinid == 278 || skinid ==279 || skinid ==274 || skinid ==275 || skinid == 276)return SendClientMessage(playerid, GREY, "This skin is restricted, therefore you can't use it.");

                        Player[playerid][Clothes1] = skinid;
                        SetPlayerSkin(playerid, skinid);
                        SendClientMessage(playerid, WHITE, ""GREEN_EMBED"Character Creation ~ "WHITE_EMBED"Completed");
                    }
                    else
                    {
                        SendClientMessage(playerid, WHITE, ""GREEN_EMBED"Character Creation ~ "WHITE_EMBED"INVALID SKIN ID");
                        ShowPlayerDialog(playerid, DIALOG_SKIN, DIALOG_STYLE_INPUT, ""GREEN_EMBED"Skin selection",""WHITE_EMBED"Input the ID of the skin you wish to use.\n\nIf you do not know, please input ID 0 for default","Choose","");
                    }
                }
            }
Reply
#8

if(skinid < 0 || skinid > 299)

Try to insert -5454 id, i'm sure the script will assign it.
Change with: if (skinid >= 0 && skinid <= 299)
Reply
#9

Thanks! Sorry for bumping my post by the way.
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)