How to change the returning "Unknown Command" -
RiChArD_A - 30.01.2013
How to change the returning "Unknown Command" for ZCMD?
Re: How to change the returning "Unknown Command" -
Roach_ - 30.01.2013
This should help you:
pawn Код:
public OnPlayerCommandPerformed(playerid, cmdtext[], success)
{
if(!success) return SendMessage(playerid, 0xE86633FF, "ERROR: {FFFFFF}Non-existent command.");
return 1;
}
Respuesta: Re: How to change the returning "Unknown Command" -
RiChArD_A - 30.01.2013
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?
Re: How to change the returning "Unknown Command" -
Roach_ - 30.01.2013
Yes.. You have to Add it, and this too:
OnPlayerCommandReceived(playerid, cmdtext[])
pawn Код:
public OnPlayerCommandReceived(playerid, cmdtext[ ])
{
return 1;
}
You will use it later..
Re: How to change the returning "Unknown Command" -
Threshold - 30.01.2013
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
Re: How to change the returning "Unknown Command" -
Roach_ - 30.01.2013
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 ?
Re: How to change the returning "Unknown Command" -
martin3644 - 30.01.2013
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
Respuesta: Re: How to change the returning "Unknown Command" -
RiChArD_A - 30.01.2013
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.
Respuesta: Re: How to change the returning "Unknown Command" -
RiChArD_A - 30.01.2013
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.
Re: Respuesta: Re: How to change the returning "Unknown Command" -
martin3644 - 30.01.2013
Quote:
Originally Posted by Lauder
He didn't said it to you men. 
|
My Bad. Everybody makes mistakes.