In the DM mode how to prohibit players to use the command
#4

Quote:
Originally Posted by Gammix
Посмотреть сообщение
If you are using OnPlayerCommandText, then simply return 0 or 1 whenever a player types one, must be on the top.
Example:
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(dm_check[playerid]) return SendClientMessage(playerid, -1, "You cannot use commands while you are in DM.");
    return 1;
}
SendClientMessage always return 1, so no Unknown Command error will appear. In case you want to enable some commands. Declare this code under those commands. Make sure you have a returning value in those commands.

In case of zcmd, we'll do same but in zcmd's custom callback:
pawn Код:
public OnPlayerCommandReceived(playerid, cmdtext[])
{
    if(dm_check[playerid]) return SendClientMessage(playerid, -1, "You cannot use commands while you are in DM.");
    return 1;
}
NOTE: dm_check[playerid] is your variable or boolean which checks if the player is in deathmatch or not.

You can also perform those checks in each command.
Thankes you
Reply


Messages In This Thread
In the DM mode how to prohibit players to use the command - by oppo1234 - 04.06.2015, 10:25
Re: In the DM mode how to prohibit players to use the command - by RaeF - 04.06.2015, 10:40
Re: In the DM mode how to prohibit players to use the command - by Gammix - 04.06.2015, 11:00
Re: In the DM mode how to prohibit players to use the command - by oppo1234 - 04.06.2015, 13:32
Re: In the DM mode how to prohibit players to use the command - by oppo1234 - 04.06.2015, 13:34

Forum Jump:


Users browsing this thread: 1 Guest(s)