/REPORT ??
#1

Hey i'm trying to make that when a player does /report [id] [reason] it sends to the online admins the report. also i want to make a command /reports to display the last couple reports , my problem is not really with /report [id] [reason] but how can i make the /reports cmd , any help ?
Reply
#2

I'd like to think it explains itself really. Below is an example, well more like an already drawn out cmd for you. But this should more or less do the job

Код HTML:
CMD:report(playerid)
{
	if(!isnull(text))
	{
	    new string[128];
		format(string, sizeof(string), "Report from %s: %s", PlayerNameEx(playerid), text);
		ABroadCast(COLOR_YELLOW,string,1);
		#if Report-Log
		new File:Reports;
		new day, month, year, minute, second, hour;
		gettime(hour,minute,second);
		getdate(year, month, day);
		Reports = fopen("logs/Reports.txt",io_append);
		format(string,sizeof(string),"[%02d/%02d/%02d %02d:%02d:%02d] Report from %s: %s\r\n",day, month, year,hour, minute, second,PlayerName(playerid),text);
		fwrite(Reports,string);
		fclose(Reports);
		print(string);
		#endif
		SendClientMessage(playerid, COLOR_YELLOW, "Your report was sent to the admin team:");
		SendClientMessage(playerid, COLOR_YELLOW, text);
		PlayerMuteInfo[playerid][ReportCool] = 20;
	}
	else
	{
	    SendClientMessage(playerid, COLOR_WHITE, "USAGE: /Report [Text]");
	    SendClientMessage(playerid, COLOR_LIGHTBLUE, "Please be specific in your report!");
	}
	return 1;
}
Reply
#3

Quote:
Originally Posted by Jay_Dixon
Посмотреть сообщение
I'd like to think it explains itself really. Below is an example, well more like an already drawn out cmd for you. But this should more or less do the job

Код HTML:
CMD:report(playerid)
{
	if(!isnull(text))
	{
	    new string[128];
		format(string, sizeof(string), "Report from %s: %s", PlayerNameEx(playerid), text);
		ABroadCast(COLOR_YELLOW,string,1);
		#if Report-Log
		new File:Reports;
		new day, month, year, minute, second, hour;
		gettime(hour,minute,second);
		getdate(year, month, day);
		Reports = fopen("logs/Reports.txt",io_append);
		format(string,sizeof(string),"[%02d/%02d/%02d %02d:%02d:%02d] Report from %s: %s\r\n",day, month, year,hour, minute, second,PlayerName(playerid),text);
		fwrite(Reports,string);
		fclose(Reports);
		print(string);
		#endif
		SendClientMessage(playerid, COLOR_YELLOW, "Your report was sent to the admin team:");
		SendClientMessage(playerid, COLOR_YELLOW, text);
		PlayerMuteInfo[playerid][ReportCool] = 20;
	}
	else
	{
	    SendClientMessage(playerid, COLOR_WHITE, "USAGE: /Report [Text]");
	    SendClientMessage(playerid, COLOR_LIGHTBLUE, "Please be specific in your report!");
	}
	return 1;
}
Thanks but what i meant is that i make a separate /reports command so that admins can see the reports from in-game , you know what i mean ?
Reply
#4

If your script is MySQL, you could make a thing that saves the reports in a database. That way you could make a command to pull up all those reports made that day?
Reply
#5

im using Y_ini but i dont really know how to make the command , thats actually why i made the thread in the first place xD
Reply
#6

PHP код:
CMD:report(playeridparams[])
{
    new 
sstring[256], giveplayeridreason[128], playername[25], giveplayer[25], string[128];
    if (
sscanf(params"us[128]"giveplayeridreason)) return SendClientMessage(playerid0xFFFFFFFF"Usage: /report [playerid] [reason]");
    if (!
IsPlayerConnected(giveplayerid)) return SendClientMessage(playerid0xFF000000"Error: Inactive player id!");
    
GetPlayerName(playeridplayernameMAX_PLAYER_NAME);
    
GetPlayerName(giveplayeridgiveplayerMAX_PLAYER_NAME);
    
format(sstringsizeof(sstring), "%s reported player %s (Id%d) - %s.\r\n"playernamegiveplayergiveplayeridreason);
    
SendMessageToAdmins(0xFFFFFFFFsstring);
    
format(string128"Your report regarding %s has been sent to server admins."giveplayer);
    
SendClientMessage(playerid0xFFFFFFFFstring);
    
GameTextForPlayer(playerid"~b~~h~~h~Report sent"50003);
    
printf("[report] %s has reported player %s (Id%d) - %s."playernamegiveplayergiveplayeridreason);
    new 
Filefile fopen("reports.cfg"io_append);
    
fwrite(filesstring);
    
fclose(file);
    return 
1;

/Reports command:

PHP код:
CMD:reports(playeridparams[])
{
    if (!
IsPlayerAdmin(playerid)) return 0//You can change the admin system which you got.
    
new strings[128], Filefile fopen("reports.cfg"io_read), idxx=1;
    
SendClientMessage(playerid0xFFFFFFF"[Reports]:");
    while(
fread(filestrings))
    {
        
format(stringssizeof(strings), "%d) %s"idxxstrings);
        
SendClientMessage(playerid0xFFFFFFFstrings);
        
idxx ++;
    }
    
fclose(file);
    return 
1;

stock of sending message to admins:
PHP код:
SendMessageToAdmins(colormessage[])
{
    for (new 
0PLAYERSi++)
    {
        if (
IsPlayerConnected(i) && IsPlayerAdmin(i)) SendClientMessage2(icolormessage); //You can change the admin system which you got.
    
}

Reply
#7

thanks it worked , will reputate u when i can
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)