[Tutorial] How to make a basic /setlevel command for your server
#2

Code:
CMD:setlevel(playerid, params[])
{
	if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_RED,">>Error<< You have to be logged in rcon to use this command!");
	else if(sscanf(params,"ud",params[0],params[1]))return SendClientMessage(playerid, COLOR_RED,"Usage: /setlevel [player id] [level]");
	else if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "That player is not connected.");
	else if(level > 5) return SendClientMessage(playerid, COLOR_RED,"Admin levels are between 1 and 5!");
        new msg[50+MAX_PLAYER_NAME],name[MAX_PLAYER_NAME];
	pInfo[params[0]][Adminlevel] = params[1];
	format(msg,sizeof(msg),"Your admin level has been set to %d.",params[1]);
	SendClientMessage(params[0],COLOR_GREEN,msg);
	GetPlayerName(params[0],name,sizeof(name));
	format(msg,sizeof(msg),"You have set %s's admin level to %d.",name,params[1]);
	SendClientMessage(playerid,COLOR_GREEN,msg);
	return 1;
}
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)