Just Shows One Line -
IceSKull - 14.02.2017
hey Guys! i have this /admins cmd!
its Kinda bug!
When there are players of Same Levels, its just shows one! even theres count++;
Код:
CMD:admins(playerid, params[])
{
new id;
new n[MAX_PLAYER_NAME];
new count = 0, string19[256];
new Admins;
GetPlayerName(id,n,sizeof(n));
for(new i = 0; i < MAX_PLAYERS; i ++)
{
if(IsPlayerConnected(i))
{
if(adlvl[Admins] == 1)
{
format(string19, sizeof(string19), "Trial Moderator - Level 1: %s (%i)",n ,playerid);
count++;
}
if(adlvl[Admins] == 2)
{
format(string19, sizeof(string19), "Moderator - Level 2: %s (%i)",n ,playerid);
count++;
}
if(adlvl[Admins] == 3)
{
format(string19, sizeof(string19), "Admin - Level 3: %s (%i)",n ,playerid);
count++;
}
if(adlvl[Admins] == 4)
{
format(string19, sizeof(string19), "Server Manager - Level 4: %s (%i)",n ,playerid);
count++;
}
if(adlvl[Admins] == 5)
{
format(string19, sizeof(string19), "Server Co-Owner - Level 5: %s (%i)",n ,playerid);
count++;
}
if(adlvl[Admins] == 6)
{
format(string19, sizeof(string19), "Server Owner - Level 6: %s (%i)",n ,playerid);
count++;
}
}
}
if(count == 0)
{
SendClientMessage(playerid, COLOR_GREEN, "");
SendClientMessage(playerid, COLOR_GREEN, "|======== Online Admins =======|");
SendClientMessage(playerid, COLOR_WHITE, "- No Admins Online at Time!");
SendClientMessage(playerid, COLOR_GREEN, "|==============================|");
SendClientMessage(playerid, COLOR_GREEN, "");
}
else
{
SendClientMessage(playerid, COLOR_GREEN, "");
SendClientMessage(playerid, COLOR_GREEN, "|======== Online Admins =======|");
SendClientMessage(playerid, COLOR_WHITE, string19);
SendClientMessage(playerid, COLOR_GREEN, "|==============================|");
SendClientMessage(playerid, COLOR_GREEN, "");
}
return 1;
}
Re: Just Shows One Line -
RyderX - 14.02.2017
Fixed it, sent you it in PM [because u asked me there...]
Re: Just Shows One Line -
RyderX - 14.02.2017
PHP код:
CMD:admins(playerid, params[])
{
new count = 0, string[256];
for(new i = 0; i < MAX_PLAYERS; i ++)
{
if(IsPlayerConnected(i))
{
if(adlvl[i][pAdmin] == 1)
{
format(string, sizeof(string),"- {00ffff}%s%s | (ID:%d) | Trial Moderator\n", string, GetName(i), i);
count++;
}
if(adlvl[i][pAdmin] == 2)
{
format(string, sizeof(string),"- {ff3399}%s%s | (ID:%d) | Moderator\n", string, GetName(i), i);
count++;
}
if(adlvl[i][pAdmin] == 3)
{
format(string, sizeof(string),"- {ffff00}%s%s | (ID:%d) | Admin\n", string, GetName(i), i);
count++;
}
if(adlvl[i][pAdmin] == 4)
{
format(string, sizeof(string),"- {ff9900}%s%s | (ID:%d) | Management\n", string, GetName(i), i);
count++;
}
if(adlvl[i][pAdmin] == 5)
{
format(string, sizeof(string),"- {ff0000}%s%s | (ID:%d) | Co-Owner\n", string, GetName(i), i);
count++;
}
if(adlvl[i][pAdmin] == 6)
{
format(string, sizeof(string),"- {ff0000}%s%s | (ID:%d) | Community Founder\n", string, GetName(i), i);
count++;
}
}
}
if(count == 0)
{
ShowPlayerDialog(playerid, 8, DIALOG_STYLE_MSGBOX,"{00ffff}Online Admin(s):",string, "Ok", "");
}
else
{
ShowPlayerDialog(playerid, 9, DIALOG_STYLE_MSGBOX,"{00ffff}Online Admin(s):", "{ff0000}There isn't any online admin right now!", "Ok", "");
}
return 1;
}
my admin system has
pAdmin as Administrator rank enumerator i don't yours so if you got any newest errors report it here! thanks
Re: Just Shows One Line -
IceSKull - 15.02.2017
The Problem is that i just have "adlvl[playerid] < level".
Re: Just Shows One Line -
Threshold - 15.02.2017
Because you're treating the message as if it was going to be put into a dialog. This is being sent through client messages, and because you can't split client messages easily, you need to send the message through each iteration in the loop.
PHP код:
CMD:admins(playerid, params[])
{
SendClientMessage(playerid, COLOR_GREEN, "");
SendClientMessage(playerid, COLOR_GREEN, "|======== Online Admins =======|");
new
playername[MAX_PLAYER_NAME],
rankname[16],
count = 0,
fstr[60]
;
for(new i = 0, j = GetPlayerPoolSize(); i <= j; i++)
{
if(!IsPlayerConnected(i)) continue;
switch(adlvl[i])
{
case 1: rankname = "Trial Moderator";
case 2: rankname = "Moderator";
case 3: rankname = "Admin";
case 4: rankname = "Server Manager";
case 5: rankname = "Server Co-Owner";
case 6: rankname = "Server Owner";
default: continue;
}
GetPlayerName(i, playername, sizeof(playername));
format(fstr, sizeof(fstr), "%s - Level %d: %s (%d)", rankname, adlvl[i], playername, i);
SendClientMessage(playerid, COLOR_WHITE, fstr);
count++;
}
if(count == 0) SendClientMessage(playerid, COLOR_WHITE, "- No Admins Online At This Time!");
SendClientMessage(playerid, COLOR_GREEN, "|==============================|");
SendClientMessage(playerid, COLOR_GREEN, "");
return 1;
}