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.