Server: 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Server: Unknown Command (
/showthread.php?tid=235167)
Server: Unknown Command -
G*Mafia - 05.03.2011
I'm having this issuse, When I type a command like /credits it gives me the credits of who made this script, so the cmd works fine, but it also says, SEVER: UNKNOWN COMMAND, but it is a known command, so how can i fix it?
Re: Server: Unknown Command - [L3th4l] - 05.03.2011
Make sure you return something. In most cases:
Re: Server: Unknown Command -
Ironboy - 05.03.2011
show the script
Re: Server: Unknown Command -
Markx - 05.03.2011
Use Zcmd or Dcmd
Re: Server: Unknown Command -
HyperZ - 05.03.2011
Show the command code.
Re: Server: Unknown Command -
Mean - 05.03.2011
This is when the problem happens:
pawn Код:
if( !strcmp( cmdtext, "/somecommand", true, 12 ) )
{
SendClientMessage( playerid, 0xAAAAAA, "Hi" );
}
See, you aren't returning anything, so it just skips to the "return 0" in OnPlayerCmdtext.
So correct would be
pawn Код:
if( !strcmp( cmdtext, "/somecommand", true, 12 ) )
{
SendClientMessage( playerid, 0xAAAAAA, "Hi" );
return 1; // You need to put this in every command
}
Or you can put return in front of your last function ( note: not all the time ) :
pawn Код:
if( !strcmp( cmdtext, "/somecommand", true, 12 ) )
{
return SendClientMessage( playerid, 0xAAAAAA, "Hi" );
}
Hope I helped.
Cheers!
-Mean.
Re: Server: Unknown Command -
G*Mafia - 05.03.2011
Thanks! I managed to fix it.