CMD:admins(playerid, params[]) { new count = 0, string[128]; foreach (new i : Player) if (PlayerData[i][pAdmin] > 0 && PlayerData[i][pAdminHide] < 1) { if (PlayerData[i][pAdminDuty]) format(string,sizeof(string), "%s\t{33CC33}(Level: %d)\t {01DF01}(On Duty)\n", ReturnName(i, 0), PlayerData[i][pAdmin]); else format(string,sizeof(string), "%s\t{33CC33}(Level: %d)\t {DF0101}(Off Duty)\n", ReturnName(i, 0), PlayerData[i][pAdmin]); count++; } if (!count) { format(string,sizeof(string), "There's no online Administrators."); } Dialog_Show(playerid, AdminList, DIALOG_STYLE_TABLIST, "Adminitrators", string, "OK", ""); return 1; }
foreach (new i : Player) // OLD
new count = 0, i;
foreach(Player, i) // NEW
CMD:admins(playerid, params[])
{
new LongString[1024],ShortString[180],Count = 0;
if(pInfo[playerid][pAdmin] <= 2)
{
foreach(Player, i)
{
if(pInfo[i][pAdmin] > 0 && pInfo[i][pHide] == 0)
{
Count++;
format(ShortString, sizeof(ShortString), embed_orange"%s "embed_white"[ "embed_orange"ID:%d"embed_white" ]\n", pName[i],i);
strcat(LongString,ShortString);
}
}
}
else
{
foreach(Player, i)
{
if(pInfo[i][pAdmin] > 0)
{
Count++;
format(ShortString, sizeof(ShortString), embed_orange"%s "embed_white"[ "embed_orange"ID:%d"embed_white"| %s "embed_white"]\n", pName[i],i, pInfo[i][pHide] ? (embed_red"Hide") : (embed_green"Dont Hide"));
strcat(LongString,ShortString);
}
}
}
if(Count == 0) return ShowPlayerDialog(playerid, 1299, DIALOG_STYLE_MSGBOX ,embed_grey"Online Admins",embed_red"There is no admins online","Ok","");
else return ShowPlayerDialog(playerid, 1299, DIALOG_STYLE_MSGBOX,embed_grey"Online Admins",LongString,"Ok","");
}
CMD:admins(playerid, params[])
{
new string[128];
foreach(new i : Player)
{
if (PlayerData[i][pAdmin] > 0 && PlayerData[i][pAdminHide] < 1)
{
if(PlayerData[i][pAdminDuty]) format(string,sizeof(string), "%s\t{33CC33}(Level: %d)\t {01DF01}(On Duty)\n%s", ReturnName(i, 0), PlayerData[i][pAdmin],string);
else format(string,sizeof(string), "%s\t{33CC33}(Level: %d)\t {DF0101}(Off Duty)\n%s", ReturnName(i, 0), PlayerData[i][pAdmin],string);
}
else format(string,sizeof(string), "There's no online Administrators.");
}
Dialog_Show(playerid, AdminList, DIALOG_STYLE_TABLIST, "Adminitrators", string, "OK", "");
return 1;
}
CMD:admins(playerid, params[]) { new string[128]; foreach(new i : Player) { if(pInfo[i][pAdmin] > 0 && pInfo[i][pHide] == 0) { if(PlayerData[i][pAdminDuty]) format(string,sizeof(string), "%s(%s): %s(ID: %i) Status: {4BB74C}Administrating", ReturnName(i, 0), PlayerData[i][pAdmin],string); else format(string,sizeof(string), "%s(%s): %s(ID: %i) Status: {FF0000}Roleplaying", ReturnName(i, 0), PlayerData[i][pAdmin],string); } else format(string,sizeof(string), "There's no online Administrators."); } ShowPlayerDialog(playerid, AdminList, DIALOG_STYLE_TABLIST, "Adminitrators", string, "OK", ""); return 1; }
if(pInfo[i][pAdmin] > 0 && pInfo[i][pHide] == 0)
C:\Users\User.User-PC\Downloads\JakartaGamers-Roleplay-v1.6.0\JakartaGamers Roleplay\Aman\gamemodes\a.pwn(37649) : error 028: invalid subscript (not an array or too many subscripts): "pInfo"
C:\Users\User.User-PC\Downloads\JakartaGamers-Roleplay-v1.6.0\JakartaGamers Roleplay\Aman\gamemodes\a.pwn(37649) : warning 215: expression has no effect C:\Users\User.User-PC\Downloads\JakartaGamers-Roleplay-v1.6.0\JakartaGamers Roleplay\Aman\gamemodes\a.pwn(37649) : error 001: expected token: ";", but found "]" C:\Users\User.User-PC\Downloads\JakartaGamers-Roleplay-v1.6.0\JakartaGamers Roleplay\Aman\gamemodes\a.pwn(37649) : error 029: invalid expression, assumed zero C:\Users\User.User-PC\Downloads\JakartaGamers-Roleplay-v1.6.0\JakartaGamers Roleplay\Aman\gamemodes\a.pwn(37649) : fatal error 107: too many error messages on one line Code CMD:admins Код:
CMD:admins(playerid, params[]) { new string[128]; foreach(new i : Player) { if(pInfo[i][pAdmin] > 0 && pInfo[i][pHide] == 0) { if(PlayerData[i][pAdminDuty]) format(string,sizeof(string), "%s(%s): %s(ID: %i) Status: {4BB74C}Administrating", ReturnName(i, 0), PlayerData[i][pAdmin],string); else format(string,sizeof(string), "%s(%s): %s(ID: %i) Status: {FF0000}Roleplaying", ReturnName(i, 0), PlayerData[i][pAdmin],string); } else format(string,sizeof(string), "There's no online Administrators."); } ShowPlayerDialog(playerid, AdminList, DIALOG_STYLE_TABLIST, "Adminitrators", string, "OK", ""); return 1; } Код:
if(pInfo[i][pAdmin] > 0 && pInfo[i][pHide] == 0) |
enum pInfo { pAdmin, pHidden }; new PlayerInfo[MAX_PLAYERS][pInfo];
Код:
CMD:admins(playerid, params[]) { new count = 0, string[128]; foreach (new i : Player) if (PlayerData[i][pAdmin] > 0 && PlayerData[i][pAdminHide] < 1) { if (PlayerData[i][pAdminDuty]) format(string,sizeof(string), "%s\t{33CC33}(Level: %d)\t {01DF01}(On Duty)\n", ReturnName(i, 0), PlayerData[i][pAdmin]); else format(string,sizeof(string), "%s\t{33CC33}(Level: %d)\t {DF0101}(Off Duty)\n", ReturnName(i, 0), PlayerData[i][pAdmin]); count++; } if (!count) { format(string,sizeof(string), "There's no online Administrators."); } Dialog_Show(playerid, AdminList, DIALOG_STYLE_TABLIST, "Adminitrators", string, "OK", ""); return 1; } |
new count, string[1000]; //otherwise the more admins will be the problem