SA-MP Forums Archive
How to add msg when wrong 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: How to add msg when wrong command (/showthread.php?tid=126333)



How to add msg when wrong command - ruckfules99 - 07.02.2010

How do i make it so when someone types a command that is not available it automatically says something like


"Command does not exist, read /commands for available commands"



Without me putting it into each command.


Re: How to add msg when wrong command - Coicatak - 07.02.2010

At the bottom of OnPlayerCommandText replace the line "return 0;" by:
pawn Код:
return SendClientMessage(playerid, color, "Command does not exist, read /commands for available commands"); // replace color with your color name;
}



Re: How to add msg when wrong command - Babul - 07.02.2010

i was about to suggest this one:
below all other commands in
Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
// all commands
// ...
	SendClientMessageToAll(0xff0000ff,"no command found matching your requested one");
	return 0;
}
and i now know i was wrong
thx, Coicatak! you fixed one bug in my script


Re: How to add msg when wrong command - Coicatak - 07.02.2010

Quote:
Originally Posted by Babul
i was about to suggest this one:
below all other commands in
Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
// all commands
// ...
	SendClientMessageToAll(0xff0000ff,"no command found matching your requested one");
	return 0;
}
and i now know i was wrong
thx, Coicatak! you fixed one bug in my script
Actually this should also work.
And you're welcome


Re: How to add msg when wrong command - Daren_Jacobson - 08.02.2010

It would work but then it would show

"no command found matching your requested one"
"SERVER: Unknown Command."


Re: How to add msg when wrong command - Coicatak - 08.02.2010

Oups, you're right.


Re: How to add msg when wrong command - Babul - 09.02.2010

smart aleck. i wrote "i was wrong", and i accepted the other solution too - further i typed it in approx 40 seconds, please forgive me my bad scripting. and maybe you can read the text around the code section too - then you wouldnt need to push your posts up?
btw: its not that hard to figure out the return 0; will print the unknown-shit, then to remove it, aint it? its 1 line below my (wrong) suggestion...
i wont answer to that topic anymore. i see it as solved now. so flame me, insult me. i wont respond here


Re: How to add msg when wrong command - Daren_Jacobson - 10.02.2010

I lol'ed. We never insulted or flamed you, and you freak out, this is lol worthy.