11.01.2013, 17:49
Well, it's quite simple, really.
First make a global bool to store information if the certain playerid is DnD or not:
Then you have to make sure it's set to false when players disconnects, so that it won't stay activated after a player leaves and another one joins with the same playerid
Now you may create your command, which should simply toggle the g_IsDnD variable; something like this:
Now, for the OnPlayerPrivMsg callback, simply insert this piece of code:
And there you have it.
First make a global bool to store information if the certain playerid is DnD or not:
pawn Код:
g_IsDnD[ MAX_PLAYERS ]; //The array is to be to set for individual players
pawn Код:
//OnPlayerDisconnect
g_IsDnD[ playerid ] = false;
pawn Код:
CMD:dnd(playerid, params[]) //zcmd
{
if( g_IsDnD[ playerid ] )
{
g_IsDnD[ playerid ] = false;
}
else
{
g_IsDnD[ playerid ] = true;
}
return true;
}
pawn Код:
//OnPlayerPrivMsg
if( g_IsDnD[ recieverid ] ) //you want to check if the reciever is DnD, not the sender(playerid)
{
return false; //return the callback to not execute more code - make it false to not send the message
}

