cmds always wrong - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: cmds always wrong (
/showthread.php?tid=69692)
cmds always wrong -
CJ101 - 19.03.2009
every time i type a command the command works, but then it says unknown command.
all the returns are there, all the code is fine. what could be causing this?
Re: cmds always wrong -
Shellegg - 19.03.2009
i'm getting that thing to on the command /enter i think it was because i scripted to press F is the same as /enter
Re: cmds always wrong -
Jack_Fox - 19.03.2009
Be sure every function in de commands returns 1. If it is returning 0, it will say Unknown command...
Re: cmds always wrong -
CJ101 - 20.03.2009
there are no return 0's.
see code here
http://pastebin.com/d1aa7ef1a
Re: cmds always wrong -
ICECOLDKILLAK8 - 20.03.2009
1) Return 0 not 1 at the end of OnPlayerCommandText and your problem should be fixed
2) Make commands like
pawn Код:
if(strcmp(cmdtext, "/mycommand", true, 3)==0)
into
pawn Код:
if(strcmp(cmdtext, "/mycommand", true)==0)
Re: cmds always wrong -
CJ101 - 20.03.2009
ivve done all of this, and im still having this retarded problem..
Re: cmds always wrong -
[RP]Rav - 20.03.2009
at then end of every command add
Re: cmds always wrong -
joco96 - 20.03.2009
Here is an example, think it'll work ^^:
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
new cmd[256], idx;
cmd = strtok(cmdtext, idx); // <== If u have strtok, u don't need tu compare "/speedo" with cmdtext, just with cmd.
if(!strcmp(cmd, "/speedo", true))
{
if(SpeedoToggle[playerid] == false)
{
SpeedoToggle[playerid] = true;
SendClientMessage(playerid, 0xFFFF00FF, "Speedo toggled on.");
}
else
{
SpeedoToggle[playerid] = false;
SendClientMessage(playerid, 0xFFFF00FF, "Speedo toggled off.");
}
return 1;
}
return 0;
}
Re: cmds always wrong -
MenaceX^ - 20.03.2009
He said it happens only at known commands, not at unknown commands.
Be sure you return every command.
Quote:
Originally Posted by Shellegg
i'm getting that thing to on the command /enter i think it was because i scripted to press F is the same as /enter
|
Oh'rly? You scripter? Nice.