CMD:offline( playerid, params[ ] )
{
LevelCheck( playerid, 1 );
GameTextForPlayer(playerid, "~g~ACCOUNT STATUS: ~r~ OFFLINE", 5000, 3);
PlayerInfo[ playerid ] [ Offline ] = 1;
return 1;
}
CMD:online( playerid, params[ ] )
{
LevelCheck( playerid, 1 );
GameTextForPlayer(playerid, "~g~ACCOUNT STATUS: ~r~ ONLINE", 5000, 3);
PlayerInfo[ playerid ] [ Offline ] = 0;
return 1;
}
This is something that i want it to look alike, i found the picture online
|
CMD:admins(playerid, params[])
{
new count = 0, name[24], stringON[128], stringOFF[258];
SendClientMessage(playerid, COLOR_LIGHTBLUE, ""SERVER_NAME" Administrators Online");
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i) && PlayerInfo[i][pAdminLevel] >= 1)
{
if(aDuty[i] == 1)
{
GetPlayerName(i, name, sizeof(name));
format(stringON, sizeof(stringON), "%s %s [ID: %i] [{33FF00}ON-DUTY{FFFFFF}]", GetAdminRankCOLOR(i), GetName(i), i);
SendClientMessage(playerid, -1, stringON);
count ++;
}
else if(aDuty[i] == 0)
{
GetPlayerName(i, name, sizeof(name));
format(stringOFF, sizeof(stringOFF), "%s %s [ID: %i] [{FF0000}OFF-DUTY{FFFFFF}]", GetAdminRankCOLOR(i), GetName(i), i);
SendClientMessage(playerid, -1, stringOFF);
count ++;
}
}
}
if(count == 0)
{
SendClientMessage(playerid, COLOR_LIGHTBLUE, "[!] No Administrators Online");
}
return 1;
}
stock GetAdminRankCOLOR(i)
{
new tmpString[32];
switch(PlayerInfo[i][pAdminLevel])
{
case 0: format(tmpString, sizeof(tmpString), "Player");
case 1: format(tmpString, sizeof(tmpString), "{FF0000}A1{FFFFFF}");
case 2: format(tmpString, sizeof(tmpString), "{FF0000}A2{FFFFFF}");
case 3: format(tmpString, sizeof(tmpString), "{FF0000}A3{FFFFFF}");
case 4: format(tmpString, sizeof(tmpString), "{FF0000}A4{FFFFFF}");
case 5: format(tmpString, sizeof(tmpString), "{FF0000}A5{FFFFFF}");
case 6: format(tmpString, sizeof(tmpString), "{FF0000}A6{FFFFFF}");
case 7: format(tmpString, sizeof(tmpString), "{FF0000}A7{FFFFFF}");
default: format(tmpString, sizeof(tmpString), "Undefined Admin");
}
return tmpString;
}
stock GetName(playerid)
{
new pName[MAX_PLAYER_NAME];
GetPlayerName(playerid, pName, MAX_PLAYER_NAME);
return pName;
}
// top of gm
#define MAX_ADMINS 10
new AdminNames[MAX_ADMINS][MAX_PLAYER_NAME char];
new AdminsInGame;
// Creating list of admins in OnGameModeInit
new len;
new File:F = fopen("Admins.ini",io_read);
while((len = fread(F,str)) && AdminsInGame < MAX_ADMINS)
{
str[len - 2] = EOS;
strpack(AdminNames[AdminsInGame++],str,sizeof(AdminNames[]));
}
fclose(F);
/*In file
Nick1
Nick2
Nick3 and after last nick must be enter key*/
// cmd /admins
new bool:found,count;
static tempAdmins[MAX_ADMINS][MAX_PLAYER_NAME char];
new name[MAX_PLAYER_NAME + 1];
for(new i=0; i != MAX_PLAYERS; i++)
if(IsPlayerConnected(i) && IsAdmin(i) && count < MAX_ADMINS)
{
GetPlayerName(i,name,sizeof(name));
strpack(tempAdmins[count++],name,sizeof(tempAdmins[]));
}
new str[(MAX_PLAYER_NAME + 11) * MAX_ADMINS];
static status[][] = {"offline","online"};
for(new i=0,d; i != AdminsInGame; i++)
{
found = false;
for(d=0; d != count; d++)
if(!strcmp(AdminNames[i],tempAdmins[d]))
{
found = true;
break;
}
}
strunpack(name,AdminNames[i]);
format(str,sizeof(str),"%s%s (%s)\n",str,name,status[found]);
}
// ShowPlayerDialog(...);
loop through all of the existing players and check wether one of the players is an admin and if he does retreive his ame and format a message, then sendclientmessage with the information and you're done.
|
for(new i = 0;i < MAX_PLAYERS; i++)
{
if(IsPlayerAdmin(i))
{
new name[MAX_PLAYER_NAME],str[256];
GetPlayerName(i,Name,sizeof(Name));
format(str,sizeof(str)),"Admin %s is online.",name);
SendClientMessage(playerid,0,str);
}
}