14.06.2014, 06:51
pawn Код:
COMMAND:makeadmin(playerid, params[])
{
if(PlayerInfo[playerid][pAdmin] < 10) return SendClientMessage(playerid, 0xFF0000FF, "You Are Not The Owner!");
new giveplayerid, level;
if(sscanf(params, "ud", giveplayerid, level))
{
SendClientMessage(playerid, -1, "USAGE: /makeadmin <playerid> <Admin level 1 - 10>");
SendClientMessage(playerid, 0x008CFFFF, "NOTE: Admin Level 1 = Trial Moderator, Admin Level 2 = Moderator, Admin Level 3 = Master Moderator");
SendClientMessage(playerid, 0x008CFFFF, "NOTE: Admin Level 4 = Trial Adminstrator, Admin Level 5 = Adminstrator, Admin Level 6 = Master Adminstrator");
return SendClientMessage(playerid, 0x008CFFFF, "NOTE: Admin Level 7 = Head Adminstrator, Admin Level 8 = Trusted Adminstrator, Admin Level 9 = Co-Owner, Admin Level 10 = Owner");
}
if(!IsPlayerConnected(giveplayerid) || giveplayerid == INVALID_PLAYER_ID) return SendClientMessage(playerid, 0xFF0000FF, "Player Is Not Connected!");
if(!(0 < level < 11)) return SendClientMessage(playerid, 0xFF0000FF, "Admin Levels Cannot Be More Than 10 Or Less Than 1!");
new var = PlayerInfo[giveplayerid][pAdmin];
if(var == level) return SendClientMessage(playerid, 0xFF0000FF, "Player Is Already At This Admin Level.");
new astr[128], PNAME[MAX_PLAYER_NAME], ANAME[MAX_PLAYER_NAME], Rank[22];
GetPlayerName(giveplayerid, PNAME, sizeof(PNAME));
GetPlayerName(playerid, ANAME, sizeof(ANAME));
switch(var)
{
case 1: Rank = "Trial Moderator";
case 2: Rank = "Moderator";
case 3: Rank = "Master Moderator";
case 4: Rank = "Trial Administrator";
case 5: Rank = "Administrator";
case 6: Rank = "Master Administrator";
case 7: Rank = "Head Administrator";
case 8: Rank = "Trusted Administrator";
case 9: Rank = "Co-Owner";
case 10: Rank = "Owner";
}
format(astr, sizeof(astr), (var < level) ? ("You Have Been Promoted To Level {00FFFB}%d - %s{FF5900}.") : ("You Have Been Demoted To Level {00FFFB}%d - %s{FF5900}."), level, Rank);
SendClientMessage(giveplayerid, 0xFF5900FF, astr);
format(astr, sizeof(astr), (var < level) ? ("%s (%d) Has Been Promoted To Level {00FFFB}%d - %s{00FFFF}.") : ("%s (%d) Has Been Demoted To Level {00FFFB}%d - %s{00FFFF}."), PNAME, giveplayerid, level, Rank);
SendClientMessageToAll(0x00FFFFFF, astr);
GameTextForPlayer(giveplayerid, (var < level) ? ("~g~Promoted") : ("~r~Demoted"), 5000, 4);
foreach(Player, i)
{
if(!PlayerInfo[i][pAdmin]) continue;
format(astr, sizeof(astr), "The Owner %s (%d) Has Made %s (%d) An Admin Level {00FFFB}%d - %s{FF5900}.", ANAME, playerid, PNAME, giveplayerid, level, Rank);
SendClientMessage(i, 0xFF5900FF, astr);
}
PlayerInfo[giveplayerid][pAdmin] = level;
return 1;
}