SA-MP Forums Archive
Skin Selection - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Skin Selection (/showthread.php?tid=444662)



Skin Selection - Lyksus - 17.06.2013

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?


Re: Skin Selection - Lyksus - 17.06.2013

anyone?


AW: Skin Selection - HurtLocker - 17.06.2013

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


Re: Skin Selection - Lyksus - 17.06.2013

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


AW: Skin Selection - HurtLocker - 17.06.2013

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


Re: Skin Selection - Lyksus - 17.06.2013

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","");
                    }
                }
            }



Re: Skin Selection - JJB562 - 17.06.2013

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","");
                    }
                }
            }



Re: Skin Selection - ReVo_ - 17.06.2013

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)


Re: Skin Selection - Lyksus - 18.06.2013

Thanks! Sorry for bumping my post by the way.