/makeadmin, small problem.
#10

Use this....

Код:
CMD:makeadmin(playerid, params[])
{
   	if(!IsPlayerLoggedIn(playerid) || PlayerInfo[playerid][pAsshole] == 1) return SendClientMessage(playerid, COLOR_GREY, "You are not allowed to use command.");
	if(IsPlayerAdmin(playerid))
	{
	    new playerb, admin, string[128];
	    if(sscanf(params, "ui", playerb, admin)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /no1canknowdis [playerid] [level]");
		if(!IsPlayerLoggedIn(playerb)) return SendClientMessage(playerid, COLOR_GREY, "Invalid player id.");
	    if(PlayerInfo[playerb][pAdmin] != admin)
	    {
	        new log[256];
		    if(PlayerInfo[playerb][pAdmin] < admin)
			{
		    	format(string, sizeof(string), "AdmWarn: %s has {33AA33}promoted {AA3333}%s to level {33AA33}%d {AA3333}admin.", RPN(playerid), RPN(playerb), admin);
            	format(log, sizeof(log), "AdmWarn: %s (%s) has promoted %s (%s) to level %d admin.", RPN(playerid), RPIP(playerid), RPN(playerb), RPIP(playerb), admin);
			}
			else if(PlayerInfo[playerb][pAdmin] > admin)
			{
	  	    	format(string, sizeof(string), "AdmWarn: %s has {FF9900}demoted {AA3333}%s to level {FF9900}%d {AA3333}admin.", RPN(playerid), RPN(playerb), admin);
	  	    	format(log, sizeof(log), "AdmWarn: %s (%s) has demoted %s (%s) to level %d admin.", RPN(playerid), RPIP(playerid), RPN(playerb), RPIP(playerb), admin);
			}
			Log("logs/makeadmin.log", log);
			PlayerInfo[playerb][pAdmin] = admin;
			PlayerInfo[playerb][pSafeAdmin] = 1;
			SendAdminMessage(COLOR_DARKRED, 1, string);
			if(!PlayerInfo[playerb][pAdmin])
			{
			    PlayerInfo[playerb][pSafeAdmin] = 0;
			    PlayerInfo[playerid][pGangMod] = 0;
			    PlayerInfo[playerid][pFacMod] = 0;
			    PlayerInfo[playerid][pBanAppealer] = 0;
			    SendClientMessage(playerb, COLOR_DARKRED, string);
			}
			new file[32];
			format(file, sizeof(file), "users/%s.ini", RPNU(playerb));
			format(file, sizeof(file), "users/%s.ini", dini_Get(file, "AdminName"));
			if(dini_Exists(file))
			{
				dini_IntSet(file, "Admin", PlayerInfo[playerb][pAdmin]);
			}
			format(file, sizeof(file), "users/%s.ini", RPNU(playerb));
			if(dini_Int(file, "AdminAccount") == 1)
			{
			    format(file, sizeof(file), "users/%s.ini", dini_Get(file, "OldName"));
			    dini_IntSet(file, "Admin", PlayerInfo[playerb][pAdmin]);
			}
		}
		else SendClientMessage(playerid, COLOR_GREY, "Player already has this admin level.");
	}
	else
	{
	    SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command.");
	}
	return 1;
}
Reply


Messages In This Thread
/makeadmin, small problem. - by zClaw - 31.05.2013, 14:52
Re: /makeadmin, small problem. - by GiamPy. - 31.05.2013, 14:55
Re: /makeadmin, small problem. - by zClaw - 31.05.2013, 14:57
Re: /makeadmin, small problem. - by GiamPy. - 31.05.2013, 14:59
Re: /makeadmin, small problem. - by [ABK]Antonio - 31.05.2013, 15:05
Re: /makeadmin, small problem. - by zClaw - 31.05.2013, 15:45
Re: /makeadmin, small problem. - by Konstantinos - 31.05.2013, 15:47
Re: /makeadmin, small problem. - by [ABK]Antonio - 31.05.2013, 15:48
Re: /makeadmin, small problem. - by zClaw - 31.05.2013, 19:28
Re: /makeadmin, small problem. - by RalphHaro - 31.05.2013, 19:57

Forum Jump:


Users browsing this thread: 2 Guest(s)