admin and admin on duty help! -
nastoe - 31.01.2010
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?
Re: admin and admin on duty help! -
ray187 - 31.01.2010
One random solution without knowing details of your script:
Loop through all players if they are admins check whether they are on duty. If they are print them out as being on duty for the player who does /admins and if they ain`t print them out as offduty.
Re: admin and admin on duty help! -
nastoe - 01.02.2010
can anyone help me?
Re: admin and admin on duty help! -
VonLeeuwen - 01.02.2010
So you want an /admin script, which shows up all admins expect the one who are not on duty?
Then we also need to know how you set the adminlevels, you got something like adminlevel[playerid]? Or something else?
Re: admin and admin on duty help! -
nastoe - 01.02.2010
yes, yes i have /setlevel
Re: admin and admin on duty help! -
VonLeeuwen - 01.02.2010
What does it say at the top on the script?
Код:
new adminlevel[MAX_PLAYERS];
Or something else? And what does change when you type /setlevel?
Re: admin and admin on duty help! -
nastoe - 01.02.2010
Код:
//----------------------------------[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;
}
that is code of making admin
i have this code
Код:
#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)
i have alot defines for colors but i have this too
Код:
static gTeam[MAX_PLAYERS]
Re: admin and admin on duty help! -
VonLeeuwen - 01.02.2010
PlayerInfo[para1][pAdmin] = level; Thats was I was looking for..
And how do you go onduty/offduty ?
Re: admin and admin on duty help! -
nastoe - 01.02.2010
Код:
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;
}
Re: admin and admin on duty help! -
VonLeeuwen - 01.02.2010
Untested, but I think this should work fine
Код:
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;
}