return 0 custom for commands
#1

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?
Reply
#2

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;

}
Reply
#3

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;
Reply
#4

pawn Код:
public OnPlayerCommandPerformed(playerid, cmdtext[], success)
{
    if(success == 0)
    {
        SendClientMessage(playerid,-1,"Message");
        return 1;
    }
    return 1;
}
Reply
#5

Replace return 0 with return SendClientMessage() at the end of the callback. If you use ZCMD then use OnPlayerCommandPerformed.
Reply
#6

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.
Reply
#7

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?
Reply
#8

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?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)