Introduction

Hello my fellows, today i decided to learn you or obviously give you a tutorial about this commands, /KickAll, /MuteAll, /Unmuteall, Maybe they are useless for real scripters, but will help beginner scripter's alot.


Requirements
-zcmd include
-a_samp include

Let we start,

Add this codes into your gamemode,filterscript.

PHP Code:
enum pInfo {
Level,
Muted,
MuteWarnings,
};
,

PHP Code:
new PNAME[MAX_PLAYER_NAME];
,

PHP Code:
enum ServerData
{
MaxMuteWarnings,
MaxAdminLevel,
}
,

PHP Code:
new ServerInfo[ServerData];


these enum's job is to define the MaxMuteWarnings, and MaxAdminLevel, And to see if this player has level, and if yes, which one, and also to see him if he is muted.



Step 1 - Kickall

Full Code
PHP Code:
CMD:kickall(playerid,params[]) {
if(PlayerInfo[playerid][Level] >= 5 || IsPlayerAdmin(playerid))
{
for(new i = 0; i < MAX_PLAYERS; i++) {
if(IsPlayerConnected(i) && (i != playerid) && i != ServerInfo[MaxAdminLevel]) {
PlayerPlaySound(i,1057,0.0,0.0,0.0); Kick(i);
}
}
new string[128]; format(string,sizeof(string),"Administrator '%s' has kicked all players", PNAME);
//SaveToFile("KickLog",string);
return SendClientMessageToAll(COLOR_LIGHTBLUE, string);
} else return SendClientMessage(playerid, red,"-Error You ain't high enough level to use this command");
}
Explaination:


The first line
PHP Code:
if(PlayerInfo[playerid][Level] >= 5 || IsPlayerAdmin(playerid))
job's is to check if this player who used the command is admin level 5 or not, if you wont it for level 5 you can change it by replacing the level number instead of number 5, also it will work with Rcon admins.
----

the second couple of lines
PHP Code:
for(new i = 0; i < MAX_PLAYERS; i++) {
if(IsPlayerConnected(i) && (i != playerid) && i != ServerInfo[MaxAdminLevel])
is to check if player(s) is/are connected nor, also the max admin level.
----



the third line
PHP Code:
PlayerPlaySound(i,1057,0.0,0.0,0.0); Kick(i);
job's is to kick the player(S).
----


the fours couple of lines
PHP Code:
new string[128]; format(string,sizeof(string),"Administrator %s has kicked all players", PNAME);
//SaveToFile("KickLog",string);
return SendClientMessageToAll(COLOR_LIGHTBLUE, string);
job's is to send a message for all that admin (Name) has kicked all the players.
----


This line:
PHP Code:
} else return SendClientMessage(playerid, red,"-Error You ain't high enough level to use this command");
}
job's is to deny the command if its used from a normal player, so it will send for him a dialog, telling him that you aint allowed to use this command.
----

This line's job is to save the kick-command in the server log file, so if you want it, remove the two slash's (//) and change the name of this file "KickLog" to your log file name, and if you wont it, dont do anything.
PHP Code:
//SaveToFile("KickLog",string);



Step 2 - MuteAll

Full Code
PHP Code:
CMD:muteall(playerid,params[]) {

if(PlayerInfo[playerid][Level] >= 5 || IsPlayerAdmin(playerid))
{
for(new i = 0; i < MAX_PLAYERS; i++) {
if(IsPlayerConnected(i) && (i != playerid) && i != ServerInfo[MaxAdminLevel]) {
PlayerPlaySound(i,1057,0.0,0.0,0.0); PlayerInfo[i][Muted] = 1; PlayerInfo[i][MuteWarnings] = 0;
}
}
new string[128]; format(string,sizeof(string),"Administrator '%s' has muted all players",PNAME);
return SendClientMessageToAll(COLOR_LIGHTBLUE, string);
} else return SendClientMessage(playerid, red,"-Error You ain't high enough level to use this command");
}
Explaination:


It's all the same, just 1 thing different,
PHP Code:
PlayerPlaySound(i,1057,0.0,0.0,0.0); PlayerInfo[i][Muted] = 1; PlayerInfo[i][MuteWarnings] = 0;
And it's job is to mute, (so mute instead of kick, but it's abit the same code)
-----

Step 3 - UnMuteAll

Full Code
PHP Code:
CMD:unmuteall(playerid,params[]) {
if(PlayerInfo[playerid][Level] >= 5 || IsPlayerAdmin(playerid))
{
for(new i = 0; i < MAX_PLAYERS; i++) {
if(IsPlayerConnected(i) && (i != playerid) && i != ServerInfo[MaxAdminLevel]) {
PlayerPlaySound(i,1057,0.0,0.0,0.0); PlayerInfo[i][Muted] = 0; PlayerInfo[i][MuteWarnings] = 0;
}
}
new string[128]; format(string,sizeof(string),"Administrator '%s' has unmuted all players",PNAME);
return SendClientMessageToAll(COLOR_LIGHTBLUE, string);
} else return SendClientMessage(playerid, red,"-Error You ain't high enough level to use this command");
}
Explaination:


It's all the same, just 1 thing different,
PHP Code:
PlayerPlaySound(i,1057,0.0,0.0,0.0); PlayerInfo[i][Muted] = 0; PlayerInfo[i][MuteWarnings] = 0;
And it's job is to un mute all, (so unmute instead mute, but it's abit the same code)
-----



Full Code, with commands:
PHP Code:
#include <a_samp>
#include <zcmd>

#define COLOR_LIGHTBLUE 0x33CCFFAA

new PNAME[MAX_PLAYER_NAME];

enum pInfo {
Level,
Muted,
MuteWarnings,
};

new PlayerInfo[MAX_PLAYERS][pInfo];

enum ServerData
{
MaxMuteWarnings,
MaxAdminLevel,
}

new ServerInfo[ServerData];

CMD:kickall(playerid,params[]) {
if(PlayerInfo[playerid][Level] >= 5 || IsPlayerAdmin(playerid))
{
for(new i = 0; i < MAX_PLAYERS; i++) {
if(IsPlayerConnected(i) && (i != playerid) && i != ServerInfo[MaxAdminLevel]) {
PlayerPlaySound(i,1057,0.0,0.0,0.0); Kick(i);
}
}
new string[128]; format(string,sizeof(string),"Administrator '%s' has kicked all players", PNAME);
//SaveToFile("KickLog",string);
return SendClientMessageToAll(COLOR_LIGHTBLUE, string);
} else return SendClientMessage(playerid, red,"-Error You ain't high enough level to use this command");
}

CMD:muteall(playerid,params[]) {

if(PlayerInfo[playerid][Level] >= 5 || IsPlayerAdmin(playerid))
{
for(new i = 0; i < MAX_PLAYERS; i++) {
if(IsPlayerConnected(i) && (i != playerid) && i != ServerInfo[MaxAdminLevel]) {
PlayerPlaySound(i,1057,0.0,0.0,0.0); PlayerInfo[i][Muted] = 1; PlayerInfo[i][MuteWarnings] = 0;
}
}
new string[128]; format(string,sizeof(string),"Administrator '%s' has muted all players",PNAME);
return SendClientMessageToAll(COLOR_LIGHTBLUE, string);
} else return SendClientMessage(playerid, red,"-Error You ain't high enough level to use this command");
}

CMD:unmuteall(playerid,params[]) {
if(PlayerInfo[playerid][Level] >= 5 || IsPlayerAdmin(playerid))
{
for(new i = 0; i < MAX_PLAYERS; i++) {
if(IsPlayerConnected(i) && (i != playerid) && i != ServerInfo[MaxAdminLevel]) {
PlayerPlaySound(i,1057,0.0,0.0,0.0); PlayerInfo[i][Muted] = 0; PlayerInfo[i][MuteWarnings] = 0;
}
}
new string[128]; format(string,sizeof(string),"Administrator '%s' has unmuted all players",PNAME);
return SendClientMessageToAll(COLOR_LIGHTBLUE, string);
} else return SendClientMessage(playerid, red,"-Error You ain't high enough level to use this command");
}

This is my first tutorial, maybe there's some mistakes, if there's just appoint me. Thanks for reading my tutorial hope i helped you guys .