Admin Rank - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Admin Rank (
/showthread.php?tid=192705)
Admin Rank -
Linus- - 23.11.2010
Hey guys
here is the cmd
pawn Код:
new AdmRank[128];
dcmd_admins(playerid,params[])
{
#pragma unused params
new count = 0;
new string[128];
for(new i = 0; i < MAX_PLAYERS; i++)
{
if (IsPlayerConnected(i))
{
if(PlayerInfo[i][Level] >= 1 && PlayerInfo[i][Level] <= 5 /*&& Hide[i] == 0*/)
{
if(IsPlayerAdmin(playerid)) AdmRank = "RCON Administrator";
else
switch(PlayerInfo[i][Level])
{
case 1: AdmRank = "Basic Moderator";
case 2: AdmRank = "Moderator";
case 3: AdmRank = "Mod";
case 4: AdmRank = "Admin";
case 5: AdmRank = "Owner";
}
format(string, 128, "Admin: %s [%s],",PlayerName2(i), AdmRank);
SendClientMessage(playerid, blue, string);
count++;
}
}
}
if (count == 0)
SendClientMessage(playerid,red,"No admin online in the list");
return 1;
}
When i type /admins im getting spam
Online admins
Linus-[Owner]
Lolipop[Admin]
hahaw[Mod]
How to make it like this?:
Admins: Linus-[Owner], Lolipop[Admin], hahaw[Mod]
Help me please.
Sorry for my bad english
Re: Admin Rank -
Zh3r0 - 23.11.2010
pawn Код:
dcmd_admins(playerid,params[])
{
#pragma unused params
new count = 0;
new string[128];
for(new i = 0; i < MAX_PLAYERS; i++)
{
if (IsPlayerConnected(i))
{
if(PlayerInfo[i][Level] >= 1 && PlayerInfo[i][Level] <= 5)
{
if(IsPlayerAdmin(playerid)) AdmRank = "RCON Administrator";
else
switch(PlayerInfo[i][Level])
{
case 1: AdmRank = "Basic Moderator";
case 2: AdmRank = "Moderator";
case 3: AdmRank = "Mod";
case 4: AdmRank = "Admin";
case 5: AdmRank = "Owner";
}
format(string, 128, "%s [%s],",PlayerName2(i), AdmRank);
count++;
}
}
}
SendClientMessage(playerid, white, "Administrators Online:");
SendClientMessage(playerid, blue, string);
if (count == 0)
SendClientMessage(playerid,red,"No admin online in the list");
return 1;
}
You put SendClientMessage in your loop.
Re: Admin Rank -
Vince - 23.11.2010
pawn Код:
new
tmp[64],
string[128];
for(new i = 0; i < MAX_PLAYERS; i++)
{
if (IsPlayerConnected(i))
{
if(1 <= PlayerInfo[i][Level] <= 5)
{
if(IsPlayerAdmin(playerid)) AdmRank = "RCON Administrator";
else
switch(PlayerInfo[i][Level])
{
case 1: AdmRank = "Basic Moderator";
case 2: AdmRank = "Moderator";
case 3: AdmRank = "Mod";
case 4: AdmRank = "Admin";
case 5: AdmRank = "Owner";
}
format(tmp, sizeof(tmp), "%s [%s], ",PlayerName2(i), AdmRank)
strcat(string, tmp);
if ((i % 3) == 0) // This will print 3 names on one line and then move on to the next line
{
SendClientMessage(playerid, blue, string);
string[0] = EOS;
// Note: EOS = End Of String = '\0'
// It empties the string (so to say)
// This is needed for strcat to work correctly
}
count++;
}
}
}
Re: Admin Rank -
Linus- - 23.11.2010
I'll test it later, btw, thank you u both.
Re: Admin Rank -
Jefff - 23.11.2010
or that :P
pawn Код:
dcmd_admins(playerid,params[])
{
#pragma unused params
new count,string[255];
for(new i,g=GetMaxPlayers(); i < g; i++)
{
if(IsPlayerConnected(i))
{
if(1 <= PlayerInfo[i][Level] <= 5)
{
if(IsPlayerAdmin(i)) AdmRank = "RCON Administrator";
switch(PlayerInfo[i][Level])
{
case 1: AdmRank = "Basic Moderator";
case 2: AdmRank = "Moderator";
case 3: AdmRank = "Mod";
case 4: AdmRank = "Admin";
case 5: AdmRank = "Owner";
}
format(string,255, "%s%s [%s], ",string,PlayerName2(i),AdmRank);
count++;
}
}
}
format(string,255,"Admins: %s",string);
SendClientMessage(playerid, blue, string);
if(!count) SendClientMessage(playerid,red,"No admin online in the list");
return 1;
}