CMD:adjustfacmotd(playerid, params[])
{
new motd, string[128];
if(!IsPlayerLoggedIn(playerid) || PlayerInfo[playerid][pAsshole] == 1) return SendClientMessage(playerid, COLOR_GREY, "You are not allowed to use this command.");
if(!PlayerInfo[playerid][pFacLeader]) return SendClientMessage(playerid, COLOR_GREY, "You are not a faction leader.");
if(sscanf(params, "s[128]", motd)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /adjustfacmotd [MOTD]");
format(FacInfo[PlayerInfo[playerid][pFac]][facMOTD], 128, "%s", motd);
format(string, sizeof(string), " %s %s has edited the faction Message of The Day.", RPFRN(playerid), RPN(playerid));
SendPlayerFactionMessage(playerid, 0, COLOR_RADIO, string);
format(string, sizeof(string), " %s", motd);
SendPlayerFactionMessage(playerid, 0, COLOR_RADIO, string);
SendClientMessage(playerid, COLOR_WHITE, "You have edited your faction's MOTD");
return 1;
}
public OnPlayerCommandPerformed(playerid, cmdtext[], success)
{
new string[128];
format(string, sizeof(string), "[cmd] [%s]: %s", RPN(playerid), cmdtext);
print(string);
if(!success)
{
SendClientMessage(playerid, COLOR_RED, "** The command you attempt to use doesn't exist on our server.");
}
return 1;
}
FacInfo[PlayerInfo[playerid][pFac]][facMOTD]
"motd" would need to be a string/array. sscanf is not needed actually for such a case, use isnull and params instead.
pawn Код:
|
The last part I mentioned is the actual problem that needs to get fixed.
About the sscanf, it will probably throw a warning in the console and print wrong data to format but that wouldn't cause the unknown command. You need to change that though in order for it to work properly. |