31.01.2010, 20:38
can anyone help me, i need to make when player type /admins to show online admins who are on duty admins who are not on duty to dont show they, if you need i can post script of /admins and /adminduty?
new adminlevel[MAX_PLAYERS];
//----------------------------------[MAKEADMIN]------------------------------------------------
if(strcmp(cmd, "/makeadmin", true) == 0)
{
if(IsPlayerConnected(playerid))
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /makeadmin [playerid/PartOfName] [level(1-3)]");
return 1;
}
new para1;
new level;
para1 = ReturnUser(tmp);
tmp = strtok(cmdtext, idx);
level = strval(tmp);
if(PlayerInfo[playerid][pAdmin] >= 1337)
{
if(IsPlayerConnected(para1))
{
if(para1 != INVALID_PLAYER_ID)
{
GetPlayerName(para1, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
PlayerInfo[para1][pAdmin] = level;
printf("AdmCmd: %s has promoted %s to a level %d admin.", sendername, giveplayer, level);
format(string, sizeof(string), " You have been promoted to a level %d admin by %s", level, sendername);
SendClientMessage(para1, COLOR_WHITE, string);
format(string, sizeof(string), " You have promoted %s to a level %d admin.", giveplayer,level);
SendClientMessage(playerid, COLOR_WHITE, string);
}
}
}
else
{
SendClientMessage(playerid, COLOR_GRAD1, " you are not authorized to use that command!");
}
}
return 1;
}
#define MAX_TRUNK_SLOTS (5) // Is actually 4. #define MAX_VEHICLE_MODELS (70) #define MAX_PLYVEH_RATIO (20) // per player. #define MAX_VEHICLE_PLATE (7)
static gTeam[MAX_PLAYERS]
if(!strcmp(cmdtext, "/adminduty", true)) // By Ellis
{
if(IsPlayerConnected(playerid))
{
if(gPlayerLogged[playerid] == 0)
{
SendClientMessage(playerid, COLOR_GREY, " You need to login first !");
return 1;
}
if(PlayerInfo[playerid][pAdmin] > 0)
{
if(AdminDuty[playerid] == 0)
{
AdminDuty[playerid] = 1;
SetPlayerArmour(playerid, 999);
SetPlayerHealth(playerid, 999);
SetPlayerColor(playerid,TEAM_VAGOS_COLOR);
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "[ADMIN] [ID:%d]%s goes on duty as admin", playerid, sendername);
ABroadCast(COLOR_YELLOW,string,1);
if(PlayerInfo[playerid][pAdmin] >= 1337)
{
for(new i = 0; i < sizeof(CarInfo); i++)
{
SetVehicleParamsForPlayer(i,playerid,0,0);
}
}
return 1;
}
else if(AdminDuty[playerid] == 1)
{
AdminDuty[playerid] = 0;
SetPlayerArmour(playerid, 0);
SetPlayerHealth(playerid, 100);
SetPlayerColor(playerid,TEAM_HIT_COLOR);
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "[ADMIN] [ID:%d]%s goes off duty as admin", playerid, sendername);
ABroadCast(COLOR_YELLOW,string,1);
return 1;
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, " You're not the admin !");
return 1;
}
}
return 1;
}
if(strcmp(cmd, "/admins", true) == 0)
{
new count = 0;
SendClientMessage(playerid,COLOR_YELLOW," [Online Admins]");
for(new i = 0; i <MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(PlayerInfo[i][pAdmin] >= 1 && AdminDuty[i] == 1)
{
new adminname[MAX_PLAYER_NAME], message[128];
GetPlayerName(i,adminname,sizeof(adminname));
format(message,sizeof(message), "Level %d [%i]%s", PlayerInfo[i][pAdmin][i],i,adminname);
SendClientMessage(playerid,COLOR_GREEN, message);
count++;
}
}
}
if(count == 0) SendClientMessage(playerid,COLOR_RED, "No administators online.");
return 1;
}