SA-MP Forums Archive
Changing Unknow 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)
+--- Thread: Changing Unknow Command (/showthread.php?tid=283981)



Changing Unknow Command - ServerScripter - 17.09.2011

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


Re: Changing Unknow Command - =WoR=Varth - 17.09.2011

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


Re: Changing Unknow Command - Tee - 17.09.2011

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


Re: Changing Unknow Command - Xyrex - 17.09.2011

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");
}



Re: Changing Unknow Command - ServerScripter - 17.09.2011

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;
}



Re: Changing Unknow Command - doreto - 17.09.2011

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;




Re: Changing Unknow Command - =WoR=Varth - 17.09.2011

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.


Re: Changing Unknow Command - Xyrex - 17.09.2011

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.