31.03.2012, 10:36
i want to make a command /admins so tht when we do tht we can see
(No.) Admins are online..
pls help me . +rep
(No.) Admins are online..
pls help me . +rep
new foundAdmins;
foreach(Player, i) // or for(new i = 0; i != MAX_PLAYERS; i++) with a IsPlayerConnected check
{
if(IsPlayerAdmin(i))
{
foundAdmins ++;
// display admin name or whatever
}
}
if(!foundAdmin)
{
// No admins were found.
}
//on Command:/admins
for(new i=0;i!=Max_PLAYERS;i++)
{
if(IsPlayerConnected(playerid))
{
if(IsPlayerAdmin(i))
{
new Name[MAX_PLAYER_NAME];
GetPlayerName(i,Name);
new Str[256];
format(Str,sizeof(Str),"Admin (%d) : %s was online",i,Name);
SendClientMessage(playerid,COLOR_WHITE,Str);
}
}
}
//Try this
#undef
#define MAX_PLAYERS 100 // for a server with 100 slots
if(IsPlayerConnected(i))
{
if(IsPlayerAdmin(i))
{
}
}
if(IsPlayerConnected(i) && IsPlayerAdmin(i))
for(new i = 0; i != MAX_PLAYERS; i++)
{
if(IsPlayerAdmin(i))
{
// code
}
}
//on Command:/admins for(new i=0;i!=Max_PLAYERS;i++) { if(IsPlayerConnected(playerid)) { if(IsPlayerAdmin(i)) { new Name[MAX_PLAYER_NAME]; GetPlayerName(i,Name); new Str[256]; format(Str,sizeof(Str),"Admin (%d) : %s was online",i,Name); SendClientMessage(playerid,COLOR_WHITE,Str); } } } |