enum pInfo {
Level,
Muted,
MuteWarnings,
};
new PNAME[MAX_PLAYER_NAME];
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");
}
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");
}
//SaveToFile("KickLog",string);
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");
}
PlayerPlaySound(i,1057,0.0,0.0,0.0); PlayerInfo[i][Muted] = 1; PlayerInfo[i][MuteWarnings] = 0;
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");
}
PlayerPlaySound(i,1057,0.0,0.0,0.0); PlayerInfo[i][Muted] = 0; PlayerInfo[i][MuteWarnings] = 0;
#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");
}
.
|
Thanks alot, but i used random numbers because there's some people migh be copying the code and paste it, so, as they are beginners, maybe they had another dialogs with the real-real-integer numbers like 1 2 3, so i used randomly due to that, as also, i dont see a problem with making it a dialog function, But anyways i changed it to be a sendclientmessage, just for you
![]() |
CMD:kickall(playerid, params[]) {
if(PlayerInfo[playerid][eLevel] < 5 || !IsPlayerAdmin(playerid)) return SendClientMessage(playerid, red, "-Error You ain't high enough level to use this command");
for(new i = 0, j = GetPlayerPoolSize(); i <= j; i++) {
PlayerPlaySound(i, 1057, 0.0, 0.0, 0.0);
Kick(i);
}
new szString[128];
format(szString, sizeof szString, "Administrator '%s' has kicked all players", GetPlayerNameEx(playerid));
SendClientMessage(playerid, COLOR_LIGHTBLUE, szString);
return 1;
}
CMD:muteall(playerid, params[]) {
if(PlayerInfo[playerid][eLevel] < 5 || !IsPlayerAdmin(playerid)) return SendClientMessage(playerid, red, "-Error You ain't high enough level to use this command");
for(new i = 0, j = GetPlayerPoolSize(); i <= j; i++) {
if(IsPlayerConnected(i) && (i != playerid)) {
PlayerPlaySound(i, 1057, 0.0, 0.0, 0.0);
PlayerInfo[i][Muted] = 1;
PlayerInfo[i][MuteWarnings] = 0;
}
}
new szString[128];
format(szString, sizeof szString, "Administrator '%s' has muted all players", GetPlayerNameEx(playerid));
SendClientMessage(playerid, COLOR_LIGHTBLUE, szString);
return 1;
}
CMD:unmuteall(playerid, params[]) {
if(PlayerInfo[playerid][eLevel] < 5 || !IsPlayerAdmin(playerid)) return SendClientMessage(playerid, red, "-Error You ain't high enough level to use this command");
for(new i = 0, j = GetPlayerPoolSize(); i <= j; i++) {
if(IsPlayerConnected(i) && (i != playerid)) {
PlayerPlaySound(i, 1057, 0.0, 0.0, 0.0);
PlayerInfo[i][Muted] = PlayerInfo[i][MuteWarnings] = 0;
}
}
new szString[128];
format(szString, sizeof szString, "Administrator '%s' has unmuted all players", GetPlayerNameEx(playerid));
SendClientMessage(playerid, COLOR_LIGHTBLUE, szString);
return 1;
}
GetPlayerNameEx(playerid) {
new szName[MAX_PLAYER_NAME + 1];
GetPlayerName(playerid, szName, sizeof szName);
return szName;
}
|
1. Why loop with MAX_PLAYERS?
From 0.3.7 we have GetPlayerPoolSize that get the highest playerid in use on the server. 2. You haven't defined "red" color. 3. PNAME is a blank variable because you haven't assigned nothing with GetPlayerName 4. You can use opposite condition instead of use a lots of brackets 5. "Level" variable in pInfo enum is never used 6. I don't understand this condition "i != ServerInfo[MaxAdminLevel]" 7. For a concept of order and code reading, uses a line for each instruction. This is the correct script: pawn Code:
|
|
No, Level, is definitely used, see in every command, if player info, level = 5 , so .. anyways, it's okay as i dont see much problems to correct, Red? i dont need to define colors as you (target whatever who) are going to change it, and you didnt appointed any other thing, completly a useless reply.
|