Whats Wrong ?
#2

Код:
if (sscanf(params, "dd", giveid, value)) SendClientMessage(playerid,COLOR_BLUE,"**USAGE:/MakeAdmin [Playerid/PlayerName] [Level]");
Or try this:

Код:
CMD:setadmin(playerid, params[])
{
	new otherId;
	new adminLevel;

	if(PlayerInfo[playerid][pLogged] == 0)
	    return SendClientMessage(playerid, COLOR_RED, "[Error]: Please login before using this command.");
 	if(PlayerInfo[playerid][pAdmin] < 3)
	    return SendClientMessage(playerid, COLOR_RED, ADMIN_CMD_ERROR);

	GetPlayerName(otherId, otherName, sizeof(otherName));
	GetPlayerName(playerid, playerName, sizeof(playerName));

	if(sscanf(params, "dd", otherId, adminLevel))
	{
	    SendClientMessage(playerid, COLOR_STEELBLUE, "[USAGE]: /setadmin [playerid] [Admin Level]");
	    return true;
	}

	if (PlayerInfo[otherId][pAdmin] == PlayerInfo[playerid][pAdmin])
	{
	format(stri, sizeof(stri), "[AdminSys]: You cannot demote/promote %s.",PlayerInfo[playerid][pName]);
	SendClientMessage(otherId, COLOR_YELLOW,stri);
	SendClientMessage(playerid, COLOR_RED, "[Error]: You are not allowed to demote/promote this Admin.");
	return 1;
	}

 	if(PlayerInfo[otherId][pAdmin] == adminLevel)
	{
	    format(stri, sizeof(stri), "[Error]: Player is already level %d.", adminLevel);
	    SendClientMessage(playerid, COLOR_RED, stri);
		return true;
	}

	if(!IsPlayerConnected(otherId))
	    return SendClientMessage(playerid, COLOR_RED, "[Error]: Invalid Player ID.");

	if(adminLevel > 4)
		return SendClientMessage(playerid, COLOR_RED, "[Error]: Level can't be higher than 4.");

	if(adminLevel < 0)
		return SendClientMessage(playerid, COLOR_RED, "[Error]: Level can't be lower than 0.");

	if(adminLevel > PlayerInfo[otherId][pAdmin]) {
	format(stri, sizeof(stri), "[AdminSys]: You have been promoted to level %d administrator, by admin %s", adminLevel, playerName);
	SendClientMessage(otherId, COLOR_YELLOW, stri);
	format(stri, sizeof(stri), "[AdminSys]: You have promoted %s to level %d administrator.", otherName, adminLevel);
	SendClientMessage(playerid, COLOR_YELLOW, stri); }
	if(adminLevel < PlayerInfo[otherId][pAdmin]) {
	format(stri, sizeof(stri), "[AdminSys]: You have been demoted to level %d administrator, by admin %s", adminLevel, playerName);
	SendClientMessage(otherId, COLOR_YELLOW, stri);
	format(stri, sizeof(stri), "[AdminSys]: You have demoted %s to level %d administrator.", otherName, adminLevel);
	SendClientMessage(playerid, COLOR_YELLOW, stri); }

	PlayerInfo[otherId][pAdmin] = adminLevel;

	SavePlayer(otherId);

	return true;
}
Reply


Messages In This Thread
Whats Wrong ? - by iRana - 23.11.2010, 10:45
Re: Whats Wrong ? - by FreshDoubleX - 23.11.2010, 11:41
Re: Whats Wrong ? - by Vince - 23.11.2010, 11:54
Re: Whats Wrong ? - by Zh3r0 - 23.11.2010, 12:02
Re: Whats Wrong ? - by FreshDoubleX - 23.11.2010, 12:11
Re: Whats Wrong ? - by Vince - 23.11.2010, 12:13
Re: Whats Wrong ? - by iRana - 24.11.2010, 15:17
Re: Whats Wrong ? - by FreshDoubleX - 24.11.2010, 16:37
Re: Whats Wrong ? - by iRana - 25.11.2010, 03:34
Re: Whats Wrong ? - by iRana - 25.11.2010, 09:59
Re: Whats Wrong ? - by Basicz - 25.11.2010, 10:37
Re: Whats Wrong ? - by iRana - 25.11.2010, 11:30
Re: Whats Wrong ? - by iRana - 25.11.2010, 11:34
Re: Whats Wrong ? - by iRana - 25.11.2010, 16:35

Forum Jump:


Users browsing this thread: 1 Guest(s)