Unknown command - 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: Unknown command (
/showthread.php?tid=462750)
Unknown command -
Lajko1 - 08.09.2013
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
Re: Unknown command -
bensmart469 - 08.09.2013
Do you use any other command processors, e.g. ZCMD? (have something like this in your script:
CMD:hi(playerid,params[])
)
Re: Unknown command -
Lajko1 - 09.09.2013
Nope this is my first command I'm trying to check how it works and so on and I added it.
Re: Unknown command -
PrinceKumar - 09.09.2013
Have you added it in fs?
Re: Unknown command -
Lajko1 - 09.09.2013
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..