How to change the returning "Unknown Command"
#1

How to change the returning "Unknown Command" for ZCMD?
Reply
#2

This should help you:
pawn Код:
public OnPlayerCommandPerformed(playerid, cmdtext[], success)
{
    if(!success) return SendMessage(playerid, 0xE86633FF, "ERROR: {FFFFFF}Non-existent command.");
    return 1;
}
Reply
#3

Quote:
Originally Posted by Roach_
Посмотреть сообщение
This should help you:
pawn Код:
public OnPlayerCommandPerformed(playerid, cmdtext[], success)
{
    if(!success) return SendMessage(playerid, 0xE86633FF, "ERROR: {FFFFFF}Non-existent command.");
    return 1;
}
I don't have that call back on GM. I have to add it?
Reply
#4

Yes.. You have to Add it, and this too: OnPlayerCommandReceived(playerid, cmdtext[])
pawn Код:
public OnPlayerCommandReceived(playerid, cmdtext[ ])
{
    return 1;
}
You will use it later..
Reply
#5

Or OnPlayerCommandText if you're using strcmp.

If you're using strcmp...
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(strcmp(cmdtext, "/mycommand", true) == 0)
    {
        //My stuff here
        return 1; //Make sure your commands are all returning a value of 1
    }
    return SendClientMessage(playerid, 0xFF0000FF, "This command does not exist in this server!");
}
For ZCMD:
pawn Код:
public OnPlayerCommandPerformed(playerid, cmdtext[], success)
{
    if(!success) return SendClientMessage(playerid, 0xFF0000FF, "This command does not exist on this server!");
    //if the command was unsuccessful/does not exist
    return 1;
}
Quote:
Originally Posted by Roach
Or by using OnPlayerCommandReceived
pawn Код:
public OnPlayerCommandReceived(playerid, cmdtext[])
{
    if(strcmp(cmdtext, "/mycommand", true) == 0)
    {
        //My stuff here
        return 1;
    } //Basically the same as OnPlayerCommandText
    return SendClientMessage(playerid, 0xFF0000FF, "This command does not exist in this server!");
}
(NOTE: Roach, it's OnPlayerCommandPerformed, not received, because the performed uses a 'success' parameter which tells us whether the command was executed or not. Unless of course, you were referring to using this as a 'strcmp' method.)

EDIT #2: Also didn't see your first post on OnPlayerCommandPerformed, my bad
Reply
#6

Quote:
Originally Posted by BenzoAMG
Посмотреть сообщение
Or OnPlayerCommandText if you're using strcmp.

If you're using strcmp...
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(strcmp(cmdtext, "/mycommand", true) == 0)
    {
        //My stuff here
        return 1; //Make sure your commands are all returning a value of 1
    }
    return SendClientMessage(playerid, 0xFF0000FF, "This command does not exist in this server!");
}
For ZCMD:
pawn Код:
public OnPlayerCommandPerformed(playerid, cmdtext[], success)
{
    if(!success) return SendClientMessage(playerid, 0xFF0000FF, "This command does not exist on this server!");
    //if the command was unsuccessful/does not exist
    return 1;
}
(NOTE: Roach, it's OnPlayerCommandPerformed, not received, because the performed uses a 'success' parameter which tells us whether the command was executed or not. Unless of course, you were referring to using this as a 'strcmp' method.)
I said that if he want he can add that too, he will use it later...
OPTIONAL, do you understand ?
Reply
#7

Quote:
Originally Posted by Roach_
Посмотреть сообщение
I said that if he want he can add that too, he will use it later...
OPTIONAL, do you understand ?
Yea I understand
But this works too with ZCMD, not only with strcmp
Reply
#8

Quote:
Originally Posted by Roach_
Посмотреть сообщение
Yes.. You have to Add it, and this too: OnPlayerCommandReceived(playerid, cmdtext[])
pawn Код:
public OnPlayerCommandReceived(playerid, cmdtext[ ])
{
    return 1;
}
You will use it later..
Thank you Roach_... Again haha . And thanks to everyone how answer.
Reply
#9

Quote:
Originally Posted by martin3644
Посмотреть сообщение
Yea I understand
But this works too with ZCMD, not only with strcmp
He didn't said it to you men.
Reply
#10

Quote:
Originally Posted by Lauder
Посмотреть сообщение
He didn't said it to you men.
My Bad. Everybody makes mistakes.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)