Whats wrong with this ZCMD command?
#1

pawn Код:
CMD:report(playerid, params[])
{
    new otherplayer,reason;
    if(sscanf(params, "us[256]", otherplayer, reason)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /report [id] [reason]");
    if(!IsPlayerConnected(otherplayer)) return SendClientMessage(playerid, COLOR_RED, "That Player Is Not Connected!");
    format(gstring, sizeof(gstring), "Report from: [ID:%d] %s, Reported player: [ID:%d] %s.", playerid, GetName(playerid), otherplayer, GetName(otherplayer));
    ABroadCast(COLOR_GREEN,gstring,1);
    format(gstring, sizeof(gstring), "Report text: %s", reason);
    ABroadCast(COLOR_GREEN,gstring,1);
    SendClientMessage(playerid, 0xFFFF00FF, "Thank you for your report, your report will now be checked and action will be taken.");
    format(gstring, sizeof(gstring), "Report from: [ID:%d] %s, Reported player: [ID:%d] %s [Report Text: %s]", playerid, GetName(playerid), otherplayer, GetName(otherplayer), reason);
    SaveToFile("Reports",gstring);
    return 1;
}
I just started switching to ZCMD. Basically if I type /report 1 D it reports ID 0 (ID 1 is offline). Also to make it so they can only use IDs in /report ID do I use the "i" specifier?
Reply
#2

pawn Код:
new otherplayer,reason[64];
    if(sscanf(params, "rs[64]", otherplayer, reason)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /report [id] [reason]");
Reply
#3

Works now, thank you Vini. Can you tell me the difference between the specifiers RS and US?

I know U is for username and R for player name but does that matter? Also I think the reason it did not work was the fact that I didn't define "new reason" with a size, so I have to do it like that all the time right? I mean "new reason[128]" and not just "new reason"
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)