Problem with a script.
#5

Quote:
Originally Posted by Funtime
Посмотреть сообщение
pawn Код:
if(strcmp(cmd, "/skin", true) == 0)
{
    if(IsAtClothShop(playerid))
    {
        tmp = strtok(cmdtext, idx);
        new chosenskin = strval(tmp);
        SetPlayerSkin(playerid, chosenskin);
    }
    else
    {
       //do nothing
    }
    return 1;
}
Idk if it works
If you "do nothing" you can just use this:

pawn Код:
if(strcmp(cmd, "/skin", true) == 0)
{
    if(IsAtClothShop(playerid))
    {
        tmp = strtok(cmdtext, idx);
        new chosenskin = strval(tmp);
        SetPlayerSkin(playerid, chosenskin);
    }
    else return 1;//Works as a { else }  without the brackets
    return 1;
}

Or even easyer:

pawn Код:
if(strcmp(cmd, "/skin", true) == 0)
{
    if(!IsAtClothShop(playerid)) return 1; //if the player is NOT at a clothing shop (hence the "!")
    tmp = strtok(cmdtext, idx);
    new chosenskin = strval(tmp);
    SetPlayerSkin(playerid, chosenskin);
    return 1;
}
If it fails to set the skin, you might considering using sscanf and zcmd, then the code will look like this:

pawn Код:
CMD:setskin(playerid, params[])//ZCMD
{
    new chosenskin;
    if(!IsAtClothShop(playerid)) return 1; //if the player is NOT at a clothing shop (hence the "!")
    if(sscanf(params,"d",chosenskin)) return SendClientMessage(playerid, COLOR, "Usage: /skin [skinid]");//SSCANF; If the player types just /skin or like /skin 0 4
    SetPlayerSkin(playerid, chosenskin);
    return 1;
}
Reply


Messages In This Thread
Problem with a script. - by Jack_Leslie - 04.06.2011, 13:03
Re: Problem with a script. - by Swiftz - 04.06.2011, 13:08
Re: Problem with a script. - by Jack_Leslie - 04.06.2011, 13:09
Re: Problem with a script. - by Jay. - 04.06.2011, 13:12
Re: Problem with a script. - by alpha500delta - 04.06.2011, 13:25
Re: Problem with a script. - by Jay. - 04.06.2011, 13:26

Forum Jump:


Users browsing this thread: 4 Guest(s)