SA-MP Forums Archive
/makeadmin cmd - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: /makeadmin cmd (/showthread.php?tid=589347)



/makeadmin cmd - Gogorakis - 18.09.2015

So I found a /makeadmin cmd. When I type this, it doesn't response..It just appears the same message.



Код:
CMD:makeadmin(playerid, params[])
{
	if(pInfo[playerid][AdminLevel] >= 6 || IsPlayerAdmin(playerid))
	{
		new id, level, string[126];

		if(sscanf(params, "ud", id, level))
			return SendClientMessage(playerid, -1, "Syntax: /makeadmin [playerid] [level]");

		if(pInfo[playerid][AdminLevel] > pInfo[id][AdminLevel])
		{
			pInfo[id][AdminLevel] = level;

			format(string, sizeof(string), "%s has made you admin level %d", GetNameEx(playerid), level);
			SendClientMessage(id, -1, string);

			format(string, sizeof(string), "You have made %s an admin level %d", GetNameEx(id), level);
			SendClientMessage(playerid, -1, string);
		}
	}
	return 1;
}



Re: /makeadmin cmd - TheLegend1 - 18.09.2015

try to change from
PHP код:
if(sscanf(params"ud"idlevel))
            return 
SendClientMessage(playerid, -1"Syntax: /makeadmin [playerid] [level]"); 
To
PHP код:
if( sscanf params"ud"idlevel)) return SendClientMessage(playerid,-1"[PlayerID/PartOfName] [adminlvl]"); 



Re: /makeadmin cmd - TheLegend1 - 18.09.2015

PHP код:
COMMAND:makeadmin(playeridparams[])
{
    if(
GetAdminLevel(playerid) < 11 && !IsPlayerAdmin(playerid)) return SendClientError(playeridCANT_USE_CMD);
    new 
iPlayeriLevel;
    if( 
sscanf params"ud"iPlayeriLevel)) return SCP(playerid"[PlayerID/PartOfName] [adminlvl]");
    if(!
IsPlayerConnected(iPlayer)) return SendClientError(playeridPLAYER_NOT_FOUND);
    
pInfo[playerid][AdminLevel] = iLevel
    SendClientMSG
(playeridCOLOR_WHITE"Player %s (%d) is now admin level %d!"RPName(iPlayer), iPlayeriLevel);
    return 
1;