31.07.2012, 22:05
Well, easily create a per-player global variable, set it to 1 when a player in a dm and to 0 if not in dm. Then you can check if it's set to 1 and if true do not execute your cmd. Example:
pawn Код:
// top of script
new Dming[MAX_PLAYERS]; // here's the per-player global variable
// if the value of this variable is 0 then the player isn't in a dm
// else he is in a dm
// ---------------------------------------------------------------
// In your dm command set that variable to 1 (To tell the script that this player is in a dm)
// by putting the following code inside the cmd
Dming[playerid] = 1;
// ---------------------------------------------------------------
// Now you can check as I said above if it's 1
// Example:
if(Dming[playerid] == 1) // checking if it's equal to 1 (In a deathmatch)
{
SendClientMessage(playerid, -1, "You cannot do that while in a dm!");
return 1;
}
// ---------------------------------------------------------------
// And to reset it when a player leaves a dm
// The following code should be added in a .. /leavedm command
Dming[playerid] = 0; // 0 = not in a dm