30.01.2013, 00:20
How to change the returning "Unknown Command" for ZCMD?
public OnPlayerCommandPerformed(playerid, cmdtext[], success)
{
if(!success) return SendMessage(playerid, 0xE86633FF, "ERROR: {FFFFFF}Non-existent command.");
return 1;
}
public OnPlayerCommandReceived(playerid, cmdtext[ ])
{
return 1;
}
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!");
}
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;
}
Originally Posted by Roach
Or by using OnPlayerCommandReceived
|
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!");
}
Or OnPlayerCommandText if you're using strcmp.
If you're using strcmp... pawn Код:
pawn Код:
|