report
#1

Hi,

Im trying to add a report script to the orc echo script i use but its an ingame command just echoes the report on irc aswell but i get errors

Код:
	if (strcmp("/report", command, true, 7) == 0)
	{
    if(IsPlayerConnected(playerid))
    {
	    new string[256], sendername[MAX_PLAYER_NAME];
      GetPlayerName(playerid, sendername, sizeof(sendername));
	 	  new length = strlen(cmdtext);
		  while ((idx < length) && (cmdtext[idx] <= ' '))
		  {
			  idx++;
		  }
		  new offset = idx;
		  new result[64];
		  while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
		  {
			  result[idx - offset] = cmdtext[idx];
			  idx++;
		  }
		  result[idx - offset] = EOS;
		  if(!strlen(result))
		  {
			 SendClientMessage(playerid, 0xFFFFFFAA, "USAGE: /report <playerid> <reason>");
		   return 1;
      }
		  format(string, sizeof(string), "Report from %s(%d): %s", sendername, playerid, result);
		  SendAdminMessage( 0xFF4646FF, string);
		  format(string, sizeof(string), "6Report from %s(%d): %s", sendername, playerid, result);
   ircSay(EchoConnection, AdminChan, string);
		  format(string, sizeof(string), "[Report] %s(%d) %s", sendername, playerid, result);
		  add_log(string);
		  SendClientMessage(playerid, 0xFF9900AA, "Report sent to currently online admins.");
		}
		return 1;
	}
Quote:

C:\Users\Admin\Desktop\New Folder (4)\f\ech.pwn(1219) : warning 215: expression has no effect
C:\Users\~\Desktop\New Folder (4)\f\ech.pwn(1221) : warning 217: loose indentation
C:\Users\~\Desktop\New Folder (4)\f\ech.pwn(1221) : error 029: invalid expression, assumed zero
C:\Users\~\Desktop\New Folder (4)\f\ech.pwn(1221) : warning 215: expression has no effect
C:\Users\~\Desktop\New Folder (4)\f\ech.pwn(1221) : error 001: expected token: ";", but found ")"
C:\Users\~\Desktop\New Folder (4)\f\ech.pwn(1221) : error 029: invalid expression, assumed zero
C:\Users\~\Desktop\New Folder (4)\f\ech.pwn(1221) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


4 Errors.

I have no idea what im doing lol but i'v been messing around for the last 3 hours and nothing

http://pastebin.com/m160612ad
Reply
#2

pawn Код:
if(strcmp(cmd, "/report", true) == 0)
    {
        tmp = strtok(cmdtext, idx);
        if(!strlen(tmp))
        {
            SendClientMessage(playerid, ORANGE, "USAGE: /report [playername/id] [reason]");
            SendClientMessage(playerid, ORANGE, "FUNCTION: Will report the specified player to the administrators(online).");
            return 1;
        }
        new targetid = ReturnUser(tmp);
        if(targetid != INVALID_PLAYER_ID)
        {
          GetPlayerName(targetid, giveplayername, sizeof(giveplayername));
            GetPlayerName(playerid, sendername, sizeof(sendername));
            new reason[128];
            reason = bigstrtok(cmdtext, idx);
            if(!strlen(reason)) return SendClientMessage(playerid, ORANGE, "USAGE: /report [playerid] [reason]");
            format(string, sizeof(string), "|- %s reported %s [ Reason: %s ]", sendername,giveplayername,reason);
            SendClientMessageToAdmins(ADMIN_RED, string,1);
            format(string, sizeof(string), "Your report on '%s' has been sent to the current online admins. Thank you.", giveplayername);
            SendClientMessage(playerid, GREEN, string);
        }

        else if(giveplayerid == INVALID_PLAYER_ID)
        {
            format(string, sizeof(string), "%d is not an active player.", giveplayerid);
            SendClientMessage(playerid, RED, string);
        }
        return 1;
    }
by Seif_
Reply
#3

That wouldn't work for a irc echo report, It needs to so the command can be used ingame but also so the report is shown to @, & and ~
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)