Doesn't shows the reason - 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: Doesn't shows the reason (
/showthread.php?tid=424614)
Doesn't shows the reason -
Nivniv2 - 23.03.2013
Код:
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
Re: Doesn't shows the reason -
RoboN1X - 23.03.2013
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.