06.12.2017, 17:45
Quote:
Make sure you are using a recent version of YSI - there were some issues with this that were fixed about 2 months ago.
|
or
in version 3.0 this is how
PHP код:
public OnPlayerCommandPerformed(playerid, cmdtext[], success)
{
for(new i=0; i<=MAX_PLAYERS; i++) if (!IsPlayerAdmin(playerid) && PlayerInfo[i][Admin] < 1) va_SendClientMessage(i, 0x3366FFFF, "Hrбč %s (%d) cmdtext: %s", PlayerName(playerid), playerid, cmdtext);
if(!success) va_SendClientMessage(playerid,0xFF7F7FFF,"Command Error %s",cmdtext);
return 1;
}
PHP код:
public e_COMMAND_ERRORS:OnPlayerCommandPerformed(playerid, cmdtext[], e_COMMAND_ERRORS:success)
{
for(new i=0; i<=MAX_PLAYERS; i++) if (!IsPlayerAdmin(playerid) && PlayerInfo[i][Admin] < 1) va_SendClientMessage(i, 0x3366FFFF, "Hrбč %s (%d) cmdtext: %s", PlayerName(playerid), playerid, cmdtext);
if(!success) va_SendClientMessage(playerid,0xFF7F7FFF,"Command Error %s",cmdtext);
return COMMAND_OK;
}
Quote:
Re: OnPlayerCommandPerformed Because !success means the command returned 0, and you probably return 1 https://github.com/Misiur/YSI-Includes/issues/5 And you need to use `e_COMMAND_ERRORS:OnPlayerCommandReceived` instead To catch any unsuccessful command Code: public e_COMMAND_ERRORS:OnPlayerCommandReceived(playerid, cmdtext[], e_COMMAND_ERRORSuccess) { if (success != COMMAND_OK) { printf("The command was not successful for player %d", playerid); return success; } return COMMAND_OK; } |