Unknown command
#1

Well I'm testing something and I copied that command from wiki also and it says UNKNOWN COMMAND when I tried it

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    new cmd[128], idx;
    cmd = strtok(cmdtext, idx);

    if(strcmp(cmd, "/kick", true) == 0)
    {
        new tmp[128];
        tmp = strtok(cmdtext, idx);

        if(strlen(tmp) == 0) return SendClientMessage(playerid, 0xFFFFFFFF, "USAGE: /kick [playerid]");

        Kick(strval(tmp));
        return 1;
    }
    return 0;
}
there isn't any error or anything it just don't want to work
Reply
#2

Do you use any other command processors, e.g. ZCMD? (have something like this in your script:
CMD:hi(playerid,params[])
)
Reply
#3

Nope this is my first command I'm trying to check how it works and so on and I added it.
Reply
#4

Have you added it in fs?
Reply
#5

No it's in my Gamemode

This is what I have for my commands..
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;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
    new cmd[128], idx;
    cmd = strtok(cmdtext, idx);

    if(strcmp(cmd, "/kick", true) == 0)
    {
        new tmp[128];
        tmp = strtok(cmdtext, idx);

        if(strlen(tmp) == 0) return SendClientMessage(playerid, 0xFFFFFFFF, "USAGE: /kick [playerid]");

        Kick(strval(tmp));
        return 1;
    }
    return 0;
}
Nothing else..
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)