Код:
CMD: setadmin(playerid, params[]) // Delete the space between the ":" and the "s", because in forum it creates a emoji
{
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You're not authorized to use this command.");
new target,level;
if(sscanf(params,"ud",target,level)) return SendClientMessage(playerid,COLOR_WHITE, "USAGE: /setadmin [playerid] [level 1-4]");
if(target == INVALID_PLAYER_ID) return SendClientMessage(playerid,COLOR_RED, "ERROR: Player is not connected.");
if(level > 4) return SendClientMessage(playerid, COLOR_RED, "ERROR: Maximum Administrator level is 4.");
new tstring[128];
new pstring[128];
//
if(level == 0)
{
format(tstring,sizeof(tstring), "%s %s has taken away your Administration rights.",GetAdminLvlName(playerid),GetName(playeri d));
format(pstring,sizeof(pstring), "You have removed %s's Administration rights.",GetName(target));
SendClientMessage(target,COLOR_LIGHTGREEN, tstring);
SendClientMessage(playerid, COLOR_LIGHTGREEN, pstring);
PlayerInfo[target][pAdmin] = 0;
}
else if(level == 1)
{
format(tstring,sizeof(tstring), "You have been promoted/demoted to a Moderator by %s %s",GetAdminLvlName(playerid),GetName(playerid)) ;
format(pstring,sizeof(pstring), "You have made %s a Moderator.",GetName(target));
SendClientMessage(target,COLOR_LIGHTGREEN, tstring);
SendClientMessage(playerid, COLOR_LIGHTGREEN, pstring);
PlayerInfo[target][pAdmin] = 1;
}
else if(level == 2)
{
format(tstring,sizeof(tstring), "You have been promoted/demoted to a General Administrator by %s %s",GetAdminLvlName(playerid),GetName(playerid)) ;
format(pstring,sizeof(pstring), "You have made %s a General Administrator.",GetName(target));
SendClientMessage(target,COLOR_LIGHTGREEN, tstring);
SendClientMessage(playerid, COLOR_LIGHTGREEN, pstring);
PlayerInfo[target][pAdmin] = 2;
}
else if(level == 3)
{
format(tstring,sizeof(tstring), "You have been promoted/demoted to a Senior Administrator by %s %s",GetAdminLvlName(playerid),GetName(playerid)) ;
format(pstring,sizeof(pstring), "You have made %s a Senior Administrator.",GetName(target));
SendClientMessage(target,COLOR_LIGHTGREEN, tstring);
SendClientMessage(playerid, COLOR_LIGHTGREEN, pstring);
PlayerInfo[target][pAdmin] = 3;
}
else if(level == 4)
{
format(tstring,sizeof(tstring), "You have been promoted to a Server Owner by %s %s",GetAdminLvlName(playerid),GetName(playerid)) ;
format(pstring,sizeof(pstring), "You have made %s a Server Owner.",GetName(target));
SendClientMessage(target,COLOR_LIGHTGREEN, tstring);
SendClientMessage(playerid, COLOR_LIGHTGREEN, pstring);
PlayerInfo[target][pAdmin] = 4;
}
return 1;
}
Try like this... From now on try to use tab.