new bool:Bloqueado[MAX_PLAYERS]; public OnPlayerText(playerid, text[]){ if(Bloqueado[playerid] == false){ new string[128]; format(string, 128, "%s disse: %s", playerName[playerid], text); SendPlayerMessageToAll(playerid, string); } return 0; }
new BlockedPlayer[MAX_PLAYERS];
public OnPlayerText(playerid, text[])
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i) && BlockedPlayer[i] != playerid)
{
//mensagem
}
}
return 1;
}
//OnPlayerConnect
BlockedPlayer[playerid] = -1;
//OnPlayerDisconnect
for(new i = 0; i < MAX_PLAYERS; i++) if(BlockedPlayer[i] == playerid) BlockedPlayer[i] = -1;
Код:
new bool:Bloqueado[MAX_PLAYERS]; public OnPlayerText(playerid, text[]){ if(Bloqueado[playerid] == false){ new string[128]; format(string, 128, "%s disse: %s", playerName[playerid], text); SendPlayerMessageToAll(playerid, string); } return 0; } |
PHP код:
|
new bool:Block[MAX_PLAYERS][MAX_PLAYERS]; public OnPlayerConnect(playerid) { for(new i = 0; i < MAX_PLAYERS; i++) { Block[playerid][i] = false; Block[i][playerid] = false; } return 1; } public OnPlayerDisconnect(playerid) { for(new i = 0; i < MAX_PLAYERS; i++) { Block[playerid][i] = true; Block[i][playerid] = true; } return 1; } public OnPlayerText(playerid, text[]) { for(new i = 0; i < GetPlayerPoolSize(); i++) { if(Block[playerid][i] || Block[i][playerid]) continue; // Mensagem } return 0; } // Alйm disso, na бrea do comando que for criar, use: // Block[playerid][ID_DO_BLOQUEADO] = true; // Block[ID_DO_BLOQUEADO][playerid] = true;
Dessa maneira o player ou estarб bloqueado para todos ou nгo estarб para ninguйm.
|