return 0 custom for commands - 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: return 0 custom for commands (
/showthread.php?tid=364317)
return 0 custom for commands -
SomebodyAndMe - 30.07.2012
How do some servers have, when typing a wrong command like: /aslkfaslkjfaslkj it doesn't say ERROR Unkown command but like: Error, we dont know that command! Please check: /blabla for the commands
How is that possible?
Re: return 0 custom for commands -
SEnergy - 30.07.2012
pawn Код:
if(stuff for command)
else if(stuff for command)
else if(stuff for command)
else{
SendClientMessage(playerid, -1, "We don't know that command!");
return 1;
}
Re: return 0 custom for commands -
SomebodyAndMe - 30.07.2012
So I have to add all my commands to that? Isn't there a smarter way to do this? Like return string;
pawn Код:
new string[128];
format(string, sizeof(string), "Sorry we do not know the command");
return string;
Re: return 0 custom for commands -
Ironboy - 30.07.2012
pawn Код:
public OnPlayerCommandPerformed(playerid, cmdtext[], success)
{
if(success == 0)
{
SendClientMessage(playerid,-1,"Message");
return 1;
}
return 1;
}
Re: return 0 custom for commands -
Vince - 30.07.2012
Replace
return 0 with
return SendClientMessage() at the end of the callback. If you use ZCMD then use OnPlayerCommandPerformed.
Re: return 0 custom for commands -
SomebodyAndMe - 30.07.2012
Quote:
Originally Posted by Ironboy
pawn Код:
public OnPlayerCommandPerformed(playerid, cmdtext[], success) { if(success == 0) { SendClientMessage(playerid,-1,"Message"); return 1; } return 1; }
|
Thanks it worked, learned something again!
REP.
Re: return 0 custom for commands -
milanosie - 30.07.2012
Quote:
Originally Posted by SomebodyAndMe
So I have to add all my commands to that? Isn't there a smarter way to do this? Like return string;
pawn Код:
new string[128]; format(string, sizeof(string), "Sorry we do not know the command");
return string;
|
Why would you format a string when its a static message?
Re: return 0 custom for commands -
SEnergy - 30.07.2012
Quote:
Originally Posted by SomebodyAndMe
So I have to add all my commands to that? Isn't there a smarter way to do this? Like return string;
pawn Код:
new string[128]; format(string, sizeof(string), "Sorry we do not know the command");
return string;
|
how do oyu want to use a command if you don't want to create it? do you wanna use some kind of magic to tell your server that you want to kick player when you use /kick ID?