OnPlayerCommandPerformed
#5

Quote:
Originally Posted by ******
Посмотреть сообщение
Make sure you are using a recent version of YSI - there were some issues with this that were fixed about 2 months ago.
I use the latest version 4.0

or
in version 3.0 this is how
PHP код:
public OnPlayerCommandPerformed(playeridcmdtext[], success)
{
    for(new 
i=0i<=MAX_PLAYERSi++) if (!IsPlayerAdmin(playerid) && PlayerInfo[i][Admin] < 1va_SendClientMessage(i0x3366FFFF"Hrбč %s (%d) cmdtext: %s"PlayerName(playerid), playeridcmdtext);  
    if(!
successva_SendClientMessage(playerid,0xFF7F7FFF,"Command Error %s",cmdtext);  
    return 
1;

else YSI 4.0

PHP код:
public e_COMMAND_ERRORS:OnPlayerCommandPerformed(playeridcmdtext[], e_COMMAND_ERRORS:success

    for(new 
i=0i<=MAX_PLAYERSi++) if (!IsPlayerAdmin(playerid) && PlayerInfo[i][Admin] < 1va_SendClientMessage(i0x3366FFFF"Hrбč %s (%d) cmdtext: %s"PlayerName(playerid), playeridcmdtext); 
    if(!
successva_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;
}

So I use this?
Reply


Messages In This Thread
OnPlayerCommandPerformed - by EmpireSk - 06.12.2017, 11:15
Re: OnPlayerCommandPerformed - by Pizzy - 06.12.2017, 16:57
Re: OnPlayerCommandPerformed - by Kaperstone - 06.12.2017, 17:02
Re: OnPlayerCommandPerformed - by Meller - 06.12.2017, 17:09
Re: OnPlayerCommandPerformed - by EmpireSk - 06.12.2017, 17:45

Forum Jump:


Users browsing this thread: 1 Guest(s)