10.01.2013, 04:46
please im in a great problem in my /admins command in this command look at the commented part
if i change
to
look what happened
it is showing names of players with level 0 if i dont change that no player can use that only admins can use /admins command please help me
pawn Код:
CMD:admins(playerid,params[]) {
#pragma unused params
new Count[2], i, string[128];
for(i = 0; i < MAX_PLAYERS; i++) if(IsPlayerConnected(i))
{
if(PlayerInfo[i][Level] >= 1) Count[0]++;// problem is here when it is 1 only level 1 admins and abhove can use that no player can use that
if(IsPlayerAdmin(i)) Count[1]++;
}
if( (Count[0] >= 7 && Count[1] >= 0) || (Count[0] == 0 && Count[1] >= 1 && PlayerInfo[playerid][Level] >= 0) )
return ShowPlayerDialog(playerid, 13412, DIALOG_STYLE_MSGBOX, "Online Admin List...", "No Admins Online", "Ok", "");
if(Count[0] >= 1) {
for(i = 0; i < MAX_PLAYERS; i++) if(IsPlayerConnected(i) && PlayerInfo[i][Level] >= 0) {
format(string, sizeof(string), "Level: %d - %s (Id:%d)", PlayerInfo[i][Level], PlayerName2(i), i);
ShowPlayerDialog(playerid, 4,DIALOG_STYLE_MSGBOX,"online admins...", string, "цk", "");
}
}
if(Count[0] == 1) {
new x; format(string, sizeof(string), "Admins: ");
for(i = 0; i < MAX_PLAYERS; i++) if(IsPlayerConnected(i) && PlayerInfo[i][Level] > 0)
{
format(string,sizeof(string),"Level: %d - %s (Id:%d)",string,i,PlayerName2(i),PlayerInfo[i][Level]);
x++;
if(x >= 5) {
ShowPlayerDialog(playerid, 4, DIALOG_STYLE_MSGBOX, "Online admins...",string, "ok", ""); format(string, sizeof(string), "Admins: "); x = 0;
}
else format(string, sizeof(string), "%s, ", string);
}
if(x <= 4 && x > 0) {
string[strlen(string)-3] = '.';
SendClientMessage(playerid, blue, string);
}
}
if( (Count[1] == 1) && (PlayerInfo[playerid][Level] >= 0) ) {
for(i = 0; i < MAX_PLAYERS; i++) if(IsPlayerConnected(i) && IsPlayerAdmin(i)) {
format(string, sizeof(string), "RCON Admin: (%d)%s", i, PlayerName2(i)); SendClientMessage(playerid, COLOR_WHITE, string);
}
}
if(Count[1] == 0) {
new x; format(string, sizeof(string), "RCON Admins: ");
for(i = 0; i < MAX_PLAYERS; i++) if(IsPlayerConnected(i) && IsPlayerAdmin(i))
{
format(string,sizeof(string),"%s(%d)%s",string,i,PlayerName2(i));
x++;
if(x >= 5) {
SendClientMessage(playerid, COLOR_WHITE, string); format(string, sizeof(string), "RCON Admins: "); x = 0;
}
else format(string, sizeof(string), "%s, ", string);
}
if(x <= 4 && x > 0) {
string[strlen(string)-3] = '.';
SendClientMessage(playerid, COLOR_WHITE, string);
}
}
return 1;
}
Код:
if(PlayerInfo[i][Level] >= 1) Count[0]++;//
Код:
if(PlayerInfo[i][Level] >= 0) Count[0]++;//
it is showing names of players with level 0 if i dont change that no player can use that only admins can use /admins command please help me