Changing Unknow Command
#1

Hi , as you know , whene we do a bad command , the server Says:
Код:
SERVER:UNKNOW COMMAND
So , my question is Simple , how to change it to an other like " Bad command, do /help to see all avaible commands"

Thanx
Reply
#2

https://sampforum.blast.hk/showthread.php?tid=283928
Reply
#3

If you use ZCMD, you can do this:

pawn Код:
public OnPlayerCommandPerformed(playerid, cmdtext[], success)
{
    if(!success)return SendClientMessage(playerid,-1,"That command does not exist, please use /help or /cmds.");
    return 1;
}
Edit: Defeated...
Reply
#4

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    //Commands here
    if(strcmp(cmd, "/pay", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
        }
        return 1;
    }
    return SendClientMessage(playerid, COLOR,"Bad command, do /help to see all avaible commands");
}
Reply
#5

thanx all! this Perfect work for me :

pawn Код:
public OnPlayerCommandPerformed(playerid, cmdtext[], success)
{
    if(!success)return SendClientMessage(playerid,-1,"That command does not exist, please use /help or /cmds.");
    return 1;
}
Reply
#6

Quote:
Originally Posted by Xyrex
Посмотреть сообщение
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    //Commands here
    if(strcmp(cmd, "/pay", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
        }
        return 1;
    }
    return SendClientMessage(playerid, COLOR,"Bad command, do /help to see all avaible commands");
}
if he have big gamemode on each command he must put ""SendClientMessage(playerid, COLOR,"Bad command, do /help to see all avaible commands");"" bether choise is like Tee say
PHP код:
public OnPlayerCommandPerformed(playeridcmdtext[], success)
{
    if(!
success)return SendClientMessage(playerid,-1,"That command does not exist, please use /help or /cmds.");
    return 
1;

Reply
#7

Quote:
Originally Posted by doreto
Посмотреть сообщение
if he have big gamemode on each command he must put ""SendClientMessage(playerid, COLOR,"Bad command, do /help to see all avaible commands");"" bether choise is like Tee say
PHP код:
public OnPlayerCommandPerformed(playeridcmdtext[], success)
{
    if(!
success)return SendClientMessage(playerid,-1,"That command does not exist, please use /help or /cmds.");
    return 
1;

Tee's is zcmd, Xyrex use default OnPlayerCommandText. They're different.
Reply
#8

Quote:
Originally Posted by doreto
Посмотреть сообщение
if he have big gamemode on each command he must put ""SendClientMessage(playerid, COLOR,"Bad command, do /help to see all avaible commands");"" bether choise is like Tee say
PHP код:
public OnPlayerCommandPerformed(playeridcmdtext[], success)
{
    if(!
success)return SendClientMessage(playerid,-1,"That command does not exist, please use /help or /cmds.");
    return 
1;

You are wrong, you don't have to add any line in each command. As you can see the message is the default "return 0;" of "OnPlayerCommandText".

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(!strcmp(cmdtext, "/help", true))
    {
        //Example
    }
    return 0;
/* Returning '0' is used to inform the server that the command
has not been successfully processed, and passes it to other scripts.
If there hasn't been a successful process, then you will get that
'SERVER: Unknown Command.' error.
*/

}
The code I posted is the natural (and general) way , not everybody uses ZCMD.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)