Help with if inputtext is 200
#1

Hey,

I made a /skin command, then you can enter a skin id.

But some skins are not allowed to choose.

so I tried this...

pawn Код:
case 3859:
            {
                if(strlen(inputtext) >= 1)
                {
                if(strlen(inputtext) == 200)
                    {
                        SCM(playerid, RED, "You can't choose this skin");
                    }
                    else
                    {
                        Player[playerid][LastSkin] = strval(inputtext);
                        SetPlayerSkin(playerid, strval(inputtext));
                    }
                }
                else
                {
                    SendClientMessage(playerid, WHITE, "Must be longer than 1 char.");
                }
            }
but that doesn't work.

the command:

pawn Код:
command(skin, playerid, params[])
{
    #pragma unused params
    if(Player[playerid][Human] == 1)
    {
        ShowPlayerDialog(playerid, 3859, DIALOG_STYLE_INPUT, "Change skin", "Please select a new, roleplay skin.", "Change", "Cancel");
    }
    else if(Player[playerid][Zombie] == 1)
    {
        SCM(playerid, RED, "Zombies can't set there skin");
    }
    return 1;
}
Reply
#2

You are using strlen and it should be strval.

pawn Код:
case 3859:
{
    if(strlen(inputtext))
    {
        new skinid = strval(inputtext);
        if(skinid == 200)
        {
            SCM(playerid, RED, "You can't choose this skin");
        }
        else
        {
            if(skinid > -1 && skinid < 300)
            {
                Player[playerid][LastSkin] = strval(inputtext);
                SetPlayerSkin(playerid, strval(inputtext));
            }
            else
            {
                SCM(playerid, RED, "Invalid skin id.");
            }
        }
    }
    else
    {
        SendClientMessage(playerid, WHITE, "Must be longer than 0 char.");
    }
}
This checks for valid skins too.
Reply
#3

Thanks!!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)