Doesn't shows the reason
#1

Код:
CMD:clearflag(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] >= 3)
	{
		new string[128], giveplayerid, reason;
		if(sscanf(params, "u", giveplayerid, reason)) return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /clearflag [playerid] [reason]");

		if(IsPlayerConnected(giveplayerid))
		{
			if(RemoveFlag(giveplayerid))
			{
				format(PlayerInfo[giveplayerid][pFlag], 128, "");
				format(string, sizeof(string), "{AA3333}AdmWarning{FFFF00}: %s has cleared all flags on %s, reason: %s.",GetPlayerNameEx(playerid),GetPlayerNameEx(giveplayerid), reason);
				ABroadCast(COLOR_YELLOW,string,2);
			}
			else
			{
				format(string, sizeof(string), "   %s does not have any outstanding flags.", GetPlayerNameEx(giveplayerid));
				SendClientMessageEx(playerid, COLOR_GRAD1, string);
			}

		}
	}
	else
	{
		SendClientMessageEx(playerid, COLOR_GRAD1, "   You are not authorized to use that command !");
		return 1;
	}
	return 1;
}
when im doing /clearflag 0 test
its says:

Код:
AdmWarning: Admin has cleared all flags on Player, reason: .
it doesn't shows the reason that i wrote over /clearflag
Reply
#2

pawn Код:
new string[128], giveplayerid, reason[100];
if(sscanf(params, "us[100]", giveplayerid, reason)) return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /clearflag [playerid] [reason]");
It seems you forgot to add string to be unformatted to reason, and also the reason is not string.
if you want the reason marked as optional parameter, then you can use uppercase "S", so when the reason is not specified, it will pass the usage message.
pawn Код:
if(sscanf(params, "uS[100]", giveplayerid, reason)) return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /clearflag [playerid] [reason]");
Not yet tested, hope it helps.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)