Whats wrong with this ZCMD command? - 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: Whats wrong with this ZCMD command? (
/showthread.php?tid=397739)
Whats wrong with this ZCMD command? -
101 - 06.12.2012
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?
Re: Whats wrong with this ZCMD command? -
ViniBorn - 06.12.2012
pawn Код:
new otherplayer,reason[64];
if(sscanf(params, "rs[64]", otherplayer, reason)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /report [id] [reason]");
Re: Whats wrong with this ZCMD command? -
101 - 06.12.2012
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"