/admins - Unknown123 - 10.02.2011
This script is bugged when it is 2 or more admins online.. How to fix it.. i guess i made it on a stupid way but :S
Can someone make it working? xD
pawn Код:
dcmd_admins(playerid, params[])
{
#pragma unused params
SendClientMessage(playerid, 0xDEEE20FF, "Online Admins:");
new names[MAX_PLAYER_NAME], string[44];
GetPlayerName(playerid, names, sizeof(names));
for(new i = 0; i < MAX_PLAYERS; i++)
if(PlayerData[i][AdminLevel] == 5 && IsPlayerConnected(i) && IsAppearingOnList[i] == 1)
{
format(string, sizeof(string), "%s(%d) - Admin Level 5",names ,i);
SendClientMessage(playerid, 0x0054A8AA, string);
return 1;
}
else if(PlayerData[i][AdminLevel] == 4 && IsPlayerConnected(i) && IsAppearingOnList[i] == 1)
{
format(string, sizeof(string), "%s(%d) - Admin Level 4",names ,i);
SendClientMessage(playerid, 0x0054A8AA, string);
return 1;
}
else if(PlayerData[i][AdminLevel] == 3 && IsPlayerConnected(i) && IsAppearingOnList[i] == 1)
{
format(string, sizeof(string), "%s(%d) - Admin Level 3",names ,i);
SendClientMessage(playerid, 0x0054A8AA, string);
return 1;
}
else if(PlayerData[i][AdminLevel] == 2 && IsPlayerConnected(i) && IsAppearingOnList[i] == 1)
{
format(string, sizeof(string), "%s(%d) - Admin Level 2",names ,i);
SendClientMessage(playerid, 0x0054A8AA, string);
return 1;
}
else if(PlayerData[i][AdminLevel] == 1 && IsPlayerConnected(i) && IsAppearingOnList[i] == 1)
{
format(string, sizeof(string), "%s(%d) - Admin Level 1",names ,i);
SendClientMessage(playerid, 0x0054A8AA, string);
return 1;
}
return SendClientMessage(playerid, 0x0054A8AA, "[BOT] Anti-Cheat");
}
Re: /admins -
berz - 10.02.2011
Take my /admins command.
You can change AdminLevels, etc..
Код:
if (strcmp(cmd, "/admins", true) == 0)
{
if(IsPlayerConnected(playerid))
{
SendClientMessage(playerid, COLOR_RED, ".:: Administrator Team ::.");
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(PlayerInfo[i][pAdmin] >= 1 && PlayerInfo[i][pAdmin] < 4243)
{
new admtext[64];
if(PlayerInfo[i][pAdmin] == 4242) { admtext = "Server Owner"; }
else if(PlayerInfo[i][pAdmin] == 1337) { admtext = "1337 Admin"; }
else if(PlayerInfo[i][pAdmin] == 4) { admtext = "Level 4 Admin"; }
else if(PlayerInfo[i][pAdmin] == 3) { admtext = "Level 3 Admin"; }
else if(PlayerInfo[i][pAdmin] == 2) { admtext = "Level 2 Admin"; }
else if(PlayerInfo[i][pAdmin] == 1) { admtext = "Moderator"; }
else { admtext = "Level 1 Moderator"; }
GetPlayerName(i, sendername, sizeof(sendername));
if(AdminDuty[i] == 0)
{
format(string, 256, "%s: %s", admtext, sendername);
SendClientMessage(playerid, COLOR_WHITE, string);
}
else
{
format(string, 256, "%s: %s (on duty)", admtext, sendername);
SendClientMessage(playerid, COLOR_GREEN1, string);
}
}
}
}
}
return 1;
}
AW: /admins -
thiaZ_ - 10.02.2011
pawn Код:
new szTemp[ MAX_PLAYER_NAME + 4 ],
szOut[ 128 ],
iIndex;
for( new i; i < MAX_PLAYERS; i++ ) { // I prefer using ******' foreach
if( !IsPlayerConnected( i ) ) {
continue;
}
if( playerArray[ i ][ iAdminLevel ] == 0 ) {
continue;
}
if( iIndex == 0 ) {
format( szOut, 128, "Online administrators: " );
}
if( strlen( szOut ) >= ( 128 - sizeof( szTemp ) ) ) {
SendClientMessage( playerid, 0xFFFFFFFF, szOut );
strdel( szOut, 0, strlen( szOut ) );
}
format( szTemp, sizeof( szTemp ), "%s (%d)", playerArray[ i ][ szName ], playerArray[ i ][ iAdminLevel ] );
format( szOut, 128, "%s%s, ", szOut, szTemp );
iIndex++;
}
strdel( szOut, strlen( szOut ) - 2, strlen( szOut ) );
SendClientMessage( playerid, 0xFFFFFFFF, szOut );
That will output something like
Код:
Online administrators: Me (1337), You (1), He_She_It(3),
We_You_They(2)
Not tested, don't blame me, I'm tired.
Re: /admins - Unknown123 - 10.02.2011
Berz, i didnt get it working xD
thiaZ_, i didnt get it working =/