SA-MP Forums Archive
i need script /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: i need script /report (/showthread.php?tid=202801)



i need script /report - doryn3l - 25.12.2010

I need to script /report [text], you can give reports to 2 minutes and admins can respond to the report /acceptreport


Re: i need script /report - Sascha - 25.12.2010

Код:
dcmd_report(playerid, params[])
{
	new tmp[256], idx;
	tmp = strtok(params, idx);
	if(!strlen(tmp)){
	    SendClientMessage(playerid, 0x555252AA, "/report [id] [reason]");
	    return 1;
	}else{
	    new pid = strval(tmp);
		tmp = strrest(params, idx);
		if(!IsPlayerConnected(pid)){
		    SendClientMessage(playerid, 0x555252AA, "Invalid Player");
		    return 1;
		}else{
		    if(!strlen(tmp)){
		        SendClientMessage(playerid, 0x555252AA, "/report [id] [reason]");
		        return 1;
			}else{
			    new name[MAX_PLAYER_NAME], name2[MAX_PLAYER_NAME], string[200];
			    GetPlayerName(playerid, name, sizeof(name));
			    GetPlayerName(pid, name2, sizeof(name2));
			    format(string, sizeof(string), "*%s(%d) reported %s(%d) for '%s'", name, playerid, name2, pid, tmp);
				for(new i=0; i<GetMaxPlayers(); i++){
				    if(IsPlayerConnected(i)){
				        if(IsPlayerAdmin(i)){
				            SendClientMessage(i, 0x555252AA, string);
						}
					}
				}
			}
		}
	}
	return 1;
}

stock strrest(const string[], index)
{
	new length = strlen(string),offset = index,result[256];
	while ((index < length) && ((index - offset) < (sizeof(result) - 1)) && (string[index] > '\r'))
	{
		result[index - offset] = string[index];
		index++;
	}
	result[index - offset] = EOS;
	return result;
}
and the "dcmd(report, 6, cmdtext);" at OnPlayerCommandText.

(Possible output: "Sascha(0) reported doryn3l(2) for 'lalalalala'")

I hope it works as I just wrote it up...


Re: i need script /report - doryn3l - 25.12.2010

I need /report [text] no /report [id] [reason]


Re: i need script /report - Sascha - 25.12.2010

Код:
dcmd_report(playerid, params[])
{
	if(!strlen(params)){
		SendClientMessage(playerid, 0x555252AA, "/report [text]");
		return 1;
	}else{
	    new name[MAX_PLAYER_NAME], string[200];
	    GetPlayerName(playerid, name, sizeof(name));
	    format(string, sizeof(string), "*Report by %s: %s", name, params);
		for(new i=0; i<GetMaxPlayers(); i++){
		    if(IsPlayerConnected(i)){
		        if(IsPlayerAdmin(i)){
					SendClientMessage(i, 0x555252AA, string);
				}
			}
		}
	}
	return 1;
}