26.02.2016, 16:50
Quote:
Have a callback? like OnPlayerCommandReceived or wher I need to put the code from OnPlayerCommandReceived?
|
OnPlayerCommandReceived:
PHP код:
OnPlayerCommandReceived(playerid, cmdtext[])
At the same time using the return 1/0 can enable/disable the command.
Example:
PHP код:
public OnPlayerCommandReceived(playerid, cmdtext[])
{
if(PlayerInfo[playerid][pMute] == 1) // if player have a mute (/mute)
{
SendClientMessage(playerid, -1, "You have a mute, wait!");
return 0; // transmit information for plugin, to not he execute command
}
return 1; // allow command execution
}
PHP код:
OnPlayerCommandPerformed(playerid, cmdtext[], success);
Moreover, if 'success = 1' - the team is successful, 'success = 0' - error, 'success = -1' - command not found.
This way you can make independently support for standard commands:
PHP код:
public OnPlayerCommandPerformed(playerid, cmdtext[], success)
{
if(success == -1) // if command not found
{
return OnPlayerCommandText(playerid, cmdtext);
}
return 1; // allow command execution
}
PHP код:
public OnPlayerCommandPerformed(playerid, cmdtext[], success)
{
if(success == -1) // if command not found
{
return SendClientMessage(playerid, -1, "This command not found on the server, please use /help.");
}
return 1;
}
Latest version plugin v2.8
Link: https://www.dropbox.com/s/3s7kjp5ipn..._v2.8.zip?dl=0