OnPlayerCommandReceived Question
#7

Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
No need to, his way was good. His only mistake was the way he compared the string. He'll be still using ZCMD.

If the player is injured and the command was performed is not equal to "/ems", then do something.
Oh, he doesn't want anyone that's injured to use commands, except /ems? I thought he wanted to compare those 150 commands (and that he had more) on that callback and return 0 afterwards if a match was found (making strcmp type of commands).

Anyway, it should look like this:
pawn Код:
public OnPlayerCommandReceived(playerid, cmdtext[])
{
    if(GetPVarInt(playerid, "Injured") != 0 || GetPVarInt(playerid, "Cuffed") != 0)
    {
        if(strcmp(cmdtext, "ems", true, 3) == 0)
        {
            SendClientMessage(playerid,COLOR_RED, "[SERVER]: You can't use commands while: injured/recovering/cuffed.");
            return 0;
        }
    }
    return 1;
}
"cmdtext" returns the command and params too.
Reply


Messages In This Thread
OnPlayerCommandReceived Question - by maximthepain - 27.03.2015, 14:45
Re: OnPlayerCommandReceived Question - by Konstantinos - 27.03.2015, 14:47
Re: OnPlayerCommandReceived Question - by SickAttack - 27.03.2015, 14:48
Re: OnPlayerCommandReceived Question - by maximthepain - 27.03.2015, 14:50
Re: OnPlayerCommandReceived Question - by SickAttack - 27.03.2015, 14:53
Re: OnPlayerCommandReceived Question - by Konstantinos - 27.03.2015, 14:55
Re: OnPlayerCommandReceived Question - by SickAttack - 27.03.2015, 15:01
Re: OnPlayerCommandReceived Question - by Konstantinos - 27.03.2015, 15:07
Re: OnPlayerCommandReceived Question - by SickAttack - 27.03.2015, 15:10
Re: OnPlayerCommandReceived Question - by maximthepain - 27.03.2015, 15:16

Forum Jump:


Users browsing this thread: 1 Guest(s)