Admin Level System. -
Bug. - 26.09.2012
How to here
[||||]
Admin level system with "rcon /makeadmin cmd"
Admin Levels:
1. Level1
2. Level2
1. Owner
Please +rep 4 help.
Re: Admin Level System. -
BlueGames - 26.09.2012
pawn Код:
if(strcmp(cmd, "/setadmin",true) == 0)
{
if(IsPlayerAdmin(playerid))
{
new tmp[256];
tmp = strtok(cmdtext,idx);
if(!strlen(tmp))
{
SendClientUsage(playerid,cmd,"[PartOfName/ID] [admin level]");
return 1;
}
if(!IsNumeric(tmp) && (PlayerID(tmp)==-2 || PlayerID(tmp)==-1))
{
SendClientError(playerid, "ID not found. Invalid part of name or multiple results");
return 1;
}
if(!IsNumeric(tmp) && PlayerID(tmp)>=0) giveplayerid = PlayerID(tmp);
if(IsNumeric(tmp)) giveplayerid = strval(tmp);
if(!IsPlayerConnected(giveplayerid))
{
SendClientError(playerid, "ID not found. Invalid part of name or multiple results");
return 1;
}
if(giveplayerid==playerid) return 1;
tmp = strtok(cmdtext,idx);
if(!strlen(tmp))
{
SendClientUsage(playerid,cmd,"[PartOfName/ID] [admin level]");
return 1;
}
new adminlvl=strval(tmp);
if(adminlvl < 0 || adminlvl > 31337) return SendClientError(playerid,"Admin level cannot be below 0 or above 12");
if(PlayerInfo[giveplayerid][power]==adminlvl) return SendClientError(playerid,"This admin is already that admin level");
new stringa[MAX_STRING];
if(adminlvl==1 && PlayerInfo[giveplayerid][power]==0) {
format(stringa,sizeof(stringa),"=>>> %s has been promoted to trial admin - Congratulations <<<=",NameEx(giveplayerid));
SendClientMessageToAll(COLOR_GREENYELLOW,stringa);
PlayerInfo[giveplayerid][power]=1;
dUserSetINT(PlayerName(giveplayerid)).("power",1);
return 1;
}
else if(adminlvl>1 && PlayerInfo[giveplayerid][power]>0 && PlayerInfo[giveplayerid][power]<adminlvl) {
format(stringa,sizeof(stringa),"=>>> Admin %s has been promoted from admin level %d to admin level %d - Congratulations <<<=",NameEx(giveplayerid),PlayerInfo[giveplayerid][power],adminlvl);
SendAdminMessage(COLOR_GREENYELLOW, stringa);
PlayerInfo[giveplayerid][power]=adminlvl;
dUserSetINT(PlayerName(giveplayerid)).("power",adminlvl);
return 1;
}
else if(adminlvl>1 && PlayerInfo[giveplayerid][power]==0)
{
SendClientInfoEx(playerid,"%s has been promoted to admin level %d successfully",NameEx(giveplayerid),adminlvl);
SendClientInfoEx(giveplayerid,"You have been promoted to admin level %d by Admin %s",adminlvl,NameEx(playerid));
PlayerInfo[giveplayerid][power]=adminlvl;
dUserSetINT(PlayerName(giveplayerid)).("power",adminlvl);
return 1;
}
else if(adminlvl>1 && PlayerInfo[giveplayerid][power]>adminlvl)
{
SendClientInfoEx(playerid,"%s has been demoted from admin level %d to admin level %d",NameEx(giveplayerid),PlayerInfo[giveplayerid][power],adminlvl);
SendClientInfoEx(giveplayerid,"You have been demoted from admin level %d to admin level %d by Admin %s",PlayerInfo[giveplayerid][power],adminlvl,NameEx(playerid));
PlayerInfo[giveplayerid][power]=adminlvl;
dUserSetINT(PlayerName(giveplayerid)).("power",adminlvl);
return 1;
}
else if(adminlvl==0 && PlayerInfo[giveplayerid][power]>0)
{
SendClientInfoEx(giveplayerid,"You have been removed from admin team by admin %s",NameEx(playerid));
SendClientInfoEx(playerid,"You removed %s from admin team",NameEx(giveplayerid));
PlayerInfo[giveplayerid][power]=0;
dUserSetINT(PlayerName(giveplayerid)).("power",0);
return 1;
}
}
}
Re: Admin Level System. -
Bug. - 26.09.2012
Where i need add this and how much admins levels in that script/system??
Re: Admin Level System. -
GangsterLifeRP - 26.09.2012
You can add as many levels as you want in it, Even up yo 999999 Rank if you wish
Re: Admin Level System. -
Bug. - 26.09.2012
How to add this i need 3 ,levels 1,2,Owner
And where i need add this
Re: Admin Level System. -
GangsterLifeRP - 26.09.2012
I dont know where to Add and How to add, But i only know that you can place as many ranks as you want in the RCON :/
Re: Admin Level System. -
Bug. - 26.09.2012
You know how to add /admins cmd
Re: Admin Level System. -
BlueGames - 26.09.2012
As i writed if you was read or something you was see that /setadmin system using this system
pawn Код:
dUserSetINT(PlayerName(giveplayerid)).("power",0);
Also you control the levels via send the power / pAdmin to User file.
SendClientError(playerid,"Admin level cannot be below 0 or above 12");
Dont forget to rep if i helped you !
Re: Admin Level System. -
GangsterLifeRP - 26.09.2012
Nope sorry, I just know Mapping and how to create servers, And small bits of scripting, SORRY
Re: Admin Level System. -
West X - 26.09.2012
Quote:
Originally Posted by Bug.
You know how to add /admins cmd
|
This command will only detect users who are logged into remote console. You can change it to detect users and the admin level variable.
pawn Код:
CMD:admins(playerid, params[])
{
SendClientMessage(playerid, -1, "______________________________________________________"); // Simply for aesthetics.
new acount = 0, string[100], pName[MAX_PLAYER_NAME]; // New variables are created.
foreach(Player, i) // Looping through users.
{
if(!IsPlayerNPC(i) && IsPlayerAdmin(i)) // Foreach doesn't loop through users if they aren't connected. Added a check to ensure they aren't NPC's along with checking if they are logged into RCON.
{
acount += 1; // Increase the count of the variable everytime an administrator is found online.
GetPlayerName(i, pName, sizeof(pName)); // Get the administrator's name, storing it into the variable. (pName).
format(string, sizeof(string), "Administrator - %s.", pName); // Format the string with the administrator's name which is in the variable. (pName).
SendClientMessage(playerid, -1, string); // Send the user the message we formatted above.
}
}
if(acount == 0) SendClientMessage(playerid, -1, "No server administrators are currently online."); // If the variable is found at zero at the end of the loop, no administrators are logged into RCON or online.
SendClientMessage(playerid, -1, "______________________________________________________"); // Simply for aesthetics.
return 1;
}
Refer to:
Loops
Format
IsPlayerNPC
IsPlayerAdmin
SendClientMessage
The command also uses zeex's ZCMD command processing include and ******'s foreach include.
ZCMD
Foreach