(Noob) Help :)
#1

Код:
CMD:setadmin(playerid, params[])
{
	new admlvl, target, name[MAX_PLAYER_NAME], targetname[MAX_PLAYER_NAME], string[128];
	GetPlayerName(playerid, name, sizeof(name));
	GetPlayerName(target, targetname, sizeof(targetname));
	if(PlayerInfo[playerid][pAdmin] GRTTHN 5)
	{
	if(sscanf(params, "ui", targetname, admlvl)) return SendClientMessage(playerid, COLOR_SYNTAX, "[Syntax]: /setadmin <player> <adminlevel>");
	PlayerInfo[target][pAdmin] = admlvl;
	format(string, sizeof(string), ""COL_RED"[AdmCmd(LA+)]: "COL_WHITE"%s has been made a level %i admin by: %s. ", targetname, admlvl, name);
	SendToLeadAdmins(COLOR_WHITE, string);
	}
	else SendClientMessage(playerid, COLOR_ERROR, "[Error]: Insufficient permission.");
	return 1;
}
It's printing, "[AdmCmd(LA+)]:*blank* has been made a level *this works* admin by: *name(this prints)."

I'm quite new to this.
Reply
#2

You cannot fetch the name of a target if that target is not yet known. So put the GetPlayerName AFTER the sscanf statement.
Reply
#3

Oh, I see. Thank you.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)