SA-MP Forums Archive
/report - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: /report (/showthread.php?tid=167871)



/report - GOSIMP - 14.08.2010

Hey im new to scripting And i want to make a /report cmd but how do i make it so when players use /report it only sends it to online admins


Re: /report - mrmuffins - 14.08.2010

Use a for loop.

Loop through all the admins currently on and send the report to all that are on.

Example:

Код:
COMMAND:report(playerid, params[]) {
	new string[128], id, reason[128];
	if (!sscanf(params, "is", id, reason)) {
		for (new i = 0; i < MAX_PLAYERS; i++) {
	    	if (GetPVarInt(i, "Admin") >= 1) {
	        	format(string, sizeof(string), "REPORT: Player %s(%d) Has Reported %s(%d), [Reason: %s ]", Name(playerid),playerid, Name(id),id, reason);
	        	SendClientMessage(i, COLOR_WHITE, string);
	    	}
		}
		SendClientMessage(playerid, COLOR_WHITE, "Your report has been sent successfully :)");
	}
	return 1;
}
//Not tested. Example
Hope this helps