dcmd_setlevel(playerid,params[])
{
if(AccInfo[playerid][LoggedIn] == 1)
{
if(AccInfo[playerid][Level] >= 5 || IsPlayerAdmin(playerid))
{
new tmp [256];
new tmp2[256];
new Index;
tmp = strtok(params,Index);
tmp2 = strtok(params,Index);
if(!strlen(params))
{
new string[128];
format(string,sizeof(string),"Usage: /setlevel [PlayerID] [Level (0-%d)]", ServerInfo[MaxAdminLevel]);
SendClientMessage(playerid,LIGHTBLUE2,string);
return SendClientMessage(playerid, orange, "Function: Will set the Level of Administration of the Specific Player");
}
new player1, level, playername[MAX_PLAYER_NAME], adminname[MAX_PLAYER_NAME], string[128];
player1 = strval(tmp);
if(!strlen(tmp2)) return
SendClientMessage(playerid, LIGHTBLUE2, "Usage: /setlevel [PlayerID] [Level (0/5)]") &&
SendClientMessage(playerid, orange, "Function: Will set the Level of Administration of the Specific Player");
level = strval(tmp2);
if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID) {
if(AccInfo[player1][LoggedIn] == 1)
{
if(level > ServerInfo[MaxAdminLevel])
return SendClientMessage(playerid,red,"ERROR: Invalid Level");
if(level == AccInfo[player1][Level])
return SendClientMessage(playerid,red,"ERROR: Player is already this level");
SendCommandToAdmins(playerid,"SetLevel");
GetPlayerName(player1, playername, sizeof(playername));
GetPlayerName(playerid, adminname, sizeof(adminname));
new year,month,day;
new hour,minute,second;
getdate(year, month, day);
gettime(hour,minute,second);
if(level > 5)
{
AdmRank = "Professional Admin";
}
switch(level)
{
case 1: AdmRank = "Admin Level 2";
case 2: AdmRank = "Moderator";
case 3: AdmRank = "Master Moderator";
case 4: AdmRank = "Administrator";
case 5: AdmRank = "Master Administrator";
}
if(level > 0)
format(string,sizeof(string),"|- Administrator %s has set you to Administrator Status | Level: %d - %s -|",adminname, level, AdmRank);
else
format(string,sizeof(string),"|- Administrator %s has set you to Player Status | Level: %d -|",adminname, level);
SendClientMessage(player1,LIGHTBLUE,string);
if(level > AccInfo[player1][Level])
GameTextForPlayer(player1,"Promoted", 2000, 3);
else GameTextForPlayer(player1,"Demoted", 2000, 3);
format(string,sizeof(string),"You have given %s Level %d on '%d/%d/%d' at '%d:%d:%d'", playername, level, day, month, year, hour, minute, second);
SendClientMessage(playerid,yellow,string);
format(string,sizeof(string),"Administrator %s has made %s Level %d",adminname, playername, level);
SaveIn("AdminLog",string);
dUserSetINT(PlayerName2(player1)).("Level",(level));
AccInfo[player1][Level] = level;
return PlayerPlaySound(player1,1057,0.0,0.0,0.0);
}
else return SendClientMessage(playerid,red,"ERROR: This player is not Registred or Logged!");
}
else return ErrorMessages(playerid, 2);
}
else return ErrorMessages(playerid, 1);
}
else return SendClientMessage(playerid,red,"ERROR: You must be logged in to use this commands");
}
Wie verbiete ich niedrigeren Admin Levels höhere Admin Levels zu promoten?