SA-MP Forums Archive
OnPlayerCommandPerformed - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: OnPlayerCommandPerformed (/showthread.php?tid=645888)



OnPlayerCommandPerformed - EmpireSk - 06.12.2017

When I enter the wrong command it will not show me that I have entered a bad command.
I use 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;




Re: OnPlayerCommandPerformed - Pizzy - 06.12.2017

I would recommend trying to change commands to ZCMD. It's so much easier.


Re: OnPlayerCommandPerformed - Kaperstone - 06.12.2017

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
Код:
public e_COMMAND_ERRORS:OnPlayerCommandReceived(playerid, cmdtext[], e_COMMAND_ERRORS:success)
{
    if (success != COMMAND_OK) {
        printf("The command was not successful for player %d", playerid);
        return success;
    }
    return COMMAND_OK;
}



Re: OnPlayerCommandPerformed - Meller - 06.12.2017

Quote:
Originally Posted by Pizzy
Посмотреть сообщение
I would recommend trying to change commands to ZCMD. It's so much easier.
Are you just stupid or mentally challanged?


Re: OnPlayerCommandPerformed - EmpireSk - 06.12.2017

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?