SA-MP Forums Archive
Help in making /reports 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: Help in making /reports command (/showthread.php?tid=549179)



Help in making /reports command - Youssef221 - 05.12.2014

I don't know how to make /reports command to load the reports done from /report command, help please

pawn Код:
COMMAND:report(playerid,params[])
{
      new str[128], string[128], target, reporter[MAX_PLAYER_NAME], reported[MAX_PLAYER_NAME];
      GetPlayerName(playerid, reporter, MAX_PLAYER_NAME);
      if(sscanf(params, "us[128]", target, str)) return SendClientMessage(playerid, 0xFF0000AA, "USAGE: /report [playerid] [reason]");
      if(target == playerid) return SendClientMessage(playerid, 0xFF0000AA, "You Cannot Report Yourself!");
      if(!IsPlayerConnected(target) || target == INVALID_PLAYER_ID) return SendClientMessage(playerid, 0xFF0000AA, "Player Is Not Connected.");
      GetPlayerName(target, reported, MAX_PLAYER_NAME);
      SendClientMessage(playerid, 0xFFF700FF, "You Report Has Successfully Sent To Online Admins, Thanks For Reporting!");
      foreach(Player, i)
      {
      if(PlayerInfo[i][pAdmin] > 0)
      {
      format(string, sizeof(string), "[Report]: %s (%d) Is Reporting %s (%d) -  Reason: %s.", reporter, playerid, reported, target, str);
      SendClientMessage(i, 0xFFA600AA, string);
      }
      }
      return 1;
}



Re: Help in making /reports command - xCrazyMonkey - 05.12.2014

what do you mean with load? Do you want the report to be shown on the screen in the chat of the admin or in a dialog?


Re: Help in making /reports command - OsteeN - 05.12.2014

Quote:
Originally Posted by xCrazyMonkey
Посмотреть сообщение
what do you mean with load? Do you want the report to be shown on the screen in the chat of the admin or in a dialog?
I think he means he would like to allow admins to load the reports that have been made.

I.E: /showreports would show a dialog or alike with all current reports.

@OP
You will have to store the reports in a variable or alike to do this. (if that's what you want)


Re: Help in making /reports command - Youssef221 - 05.12.2014

ahh how can i do that?, can anyone give me an example


Re: Help in making /reports command - Youssef221 - 05.12.2014

Hello? Anyone?


Re: Help in making /reports command - Diti1 - 05.12.2014

PHP код:
COMMAND:report(playeridparams[])
{
    new 
pName[MAX_PLAYER_NAME], aName[MAX_PLAYER_NAME], str[128], reasoniD;
    if (
sscanf(params"dz"iDreason)) return SendClientMessage(playerid0xAA3333AA"Usage: /report [id] [reason]");
    if (
iD == INVALID_PLAYER_ID) return SendClientMessage(playerid0xAA3333AA"Invalid ID.");
    
GetPlayerName(playeridpNamesizeof(pName));
    
GetPlayerName(iDaNamesizeof(aName));
    
SendClientMessage(playerid,COLOR_RED,"Your report has been sent to admins");
    for (new 
0MAX_PLAYERSi++)
    {
        if (
IsPlayerConnected(i))
        {
            new 
zName[MAX_PLAYER_NAME], pFile[256];
            
GetPlayerName(izNamesizeof(zName));
            
format(pFilesizeof(pFile), "Admin\%s.ini"zName);
            if (
PInfo[playerid][Level] <1)
            {
                
format(strsizeof(str), "%s(%d) has reported %s(%d) for: %s"pNameplayeridaNameiDreason);
                
SendClientMessage(i0xFFFFFFFFstr);
            }
        }
    }
    return 
1;