[Problem] /Skin cmd help please
#8

You put this under OnPlayerCommandText:
pawn Код:
new cmd[128], idx;
cmd = strtok(cmdtext, idx);
So it gets like this (idk):
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    new cmd[128], idx;
    cmd = strtok(cmdtext, idx);

    if(strcmp(cmd, "/skin", true)==0)
    {
        if(IsPlayerInRangeOfPoint(playerid, 10, 198.9780, -127.8640, 1003.5152))
        {
            new tmp[128];
            tmp = strtok (cmdtext, idx);

            if(strlen(tmp)==0) SendClientMessage(playerid, COLOR_RED, "USAGE: /skin [ID]");
       
            SetPlayerSkin(playerid, strval(tmp));
        }
        else SendClientMessage(playerid, COLOR_RED, "You must be in the clothing store.");
        return 1;
    }

    //Other commands here. Dont forget to use cmd instead of cmdtext ;)

    return 0;
}
Put this at bottom of script:
pawn Код:
strtok(const string[], &index)
{
    new length = strlen(string);
    while ((index < length) && (string[index] <= ' '))
    {
        index++;
    }

    new offset = index;
    new result[20];
    while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
    {
        result[index - offset] = string[index];
        index++;
    }
    result[index - offset] = EOS;
    return result;
}
Reply


Messages In This Thread
[Problem] /Skin cmd help please - by XoSarahMoX - 20.11.2010, 18:02
Re: [Problem] /Skin cmd help please - by [NWA]Hannes - 20.11.2010, 19:21
Re: [Problem] /Skin cmd help please - by XoSarahMoX - 20.11.2010, 20:01
Re: [Problem] /Skin cmd help please - by Jay. - 20.11.2010, 20:03
Re: [Problem] /Skin cmd help please - by TheArcher - 20.11.2010, 20:06
Re: [Problem] /Skin cmd help please - by XoSarahMoX - 20.11.2010, 20:15
Re: [Problem] /Skin cmd help please - by Biesmen - 20.11.2010, 20:25
Re: [Problem] /Skin cmd help please - by [NWA]Hannes - 20.11.2010, 20:26

Forum Jump:


Users browsing this thread: 2 Guest(s)