pawn Код:
stock AdminChat(level, Msg[]) //Level is the minium admin what we must have to see the command, and msg[] is the string.
{
for(new i = 0; i < MAX_PLAYERS)//Loop through all players, you can use foreach if you prefer.
{
if(IsPlayerConnected(i) && Info[i][Admin] => level)//If the player are connected and the Admin is equal to or greater.
//Change 'Info[i][Admin]' for your variable.
{
SendClientMessage(i, -1, Msg);//Send to all players the 'Msg'
}
}
return 1;
}
pawn Код:
CMD:admin(playerid, params[])
{
new string[172];//The string...
if(isnull(params)) return SendClientMessage(playerid, -1, "Please use /admin [Message]"); //If the player only send '/admin'.
new PlayerName[MAX_PLAYER_NAME+1]; //The string to store the name.
GetPlayerName(playerid, PlayerName, sizeof(PlayerName)); //We get the player name.
format(string, sizeof(string), "AdminChat %s: %s", PlayerName, params); //The final message...
AdminChat(1, string); // The minium admin level is 1, and the message is the string.
return 1;
}