/report Help
#1

I need a /report command that will show to all admins on my current admin filterscript. If you need some sort of resource from my script, reply. Here is a snippet if you need some info:

I just need a command that allows a player to /report ID REASON, I do not need it to be in mysql form. Just a simple command that shows to admins please.

Код:
	if (strcmp(cmd, "/kick", true) == 0)
	{
	  if (PlayerInfo[playerid][Admin] >=1 || IsPlayerAdmin(playerid))
		{
			tmpp = strtok(cmdtext, idx);
			if	(!strlen(tmpp))
			{
				SendClientMessage(playerid, COLOR_GREEN, "USAGE: /kick [playerid] [reason]");
				return 1;
			}
			pid = strval(tmpp);
			
			if 	(!(IsPlayerConnected(pid)))
			{
				SendClientMessage(playerid, COLOR_RED, "THAT PLAYER IS NOT CONNECTED!");
				return 1;
			}
			GetPlayerName(pid, pidName, sizeof(pidName));
			GetPlayerName(playerid, AdminName, sizeof(AdminName));
			GetPlayerIp(playerid,AdminIP,20);
			GetPlayerIp(pid, PidIP, 20);
			gettime(hour, minute, second);
			getdate(year, month, day);
			format(query, sizeof(query), "INSERT INTO `kick` (kickid, kicked, kickedip, kicker, kickerip, reason, time, date) VALUES(0, \"%s\", \"%s\", \"%s\", \"%s\", \"%s\", \"%d:%d:%d\", \"%d.%d.%d\")", pidName, PidIP, AdminName, AdminIP, cmdtext[idx], hour, minute, second, day, month, year);
			samp_mysql_query(query);
			samp_mysql_store_result();
      format(string, sizeof(string), "~RecludeBot~ %s (ID: %d) has been kicked ! Reason: %s | Time: %d:%d:%d | Date: %d.%d.%d", pidName, pid, cmdtext[idx], hour, minute, second, day, month, year);
			SendClientMessageToAll(COLOR_RED, string);
			print(string);
			Kick(pid);
		}
		else
		{
	  	SendClientMessage(playerid,COLOR_RED,"~RecludeBot~ You can't use that command !");
			return 1;
		}
		return 1;
	}
Reply
#2

Snip from a GF script:

pawn Код:
if(strcmp(cmd, "/report", true) == 0)
    {
      if(IsPlayerConnected(playerid))
      {
        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, COLOR_GRAD2, "USAGE: /report [text]");
                return 1;
            }
            format(string, sizeof(string), "Report from [%d]%s: %s", playerid, sendername, (result));
            ABroadCast(COLOR_YELLOW,string,1);
            SendClientMessage(playerid, COLOR_YELLOW, "Your Report Message was sent to the Admins.");
      }
      return 1;
    }
ABroadcast is a function that gets all admins on server and sends the message to them.
If you don't know how to make it:

pawn Код:
forward ABroadCast(color,const string[],level);
pawn Код:
public ABroadCast(color,const string[],level)
{
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
            if (PlayerInfo[i][pAdmin] >= level)
            {
                SendClientMessage(i, color, string);
                printf("%s", string);
            }
        }
    }
    return 1;
}
Reply
#3

Well if you want the report command and not script it yourself, I suggest you download an Admin Filterscrpt and get the report command from that
Reply
#4

Thank you BLT, This really helped. I was going to ask how to make an admin chat and player chat too.. But you just solved that..


There is one thing though.. How do I make an /admins command to list my online admins?
Reply
#5

Quote:
Originally Posted by iRape
Thank you BLT, This really helped. I was going to ask how to make an admin chat and player chat too.. But you just solved that..


There is one thing though.. How do I make an /admins command to list my online admins?
/admins
pawn Код:
if (strcmp(cmd, "/admins", true) == 0)
    {
    if(IsPlayerConnected(playerid))
      {
            SendClientMessage(playerid, COLOR_GRAD1, "Admins Online:");
            for(new i = 0; i < MAX_PLAYERS; i++)
            {
                if(IsPlayerConnected(i))
                {
                  if(PlayerInfo[i][pAdmin] >= 1 && PlayerInfo[i][pAdmin] < 1338)
                  {
                        new adminlevel = PlayerInfo[i][pAdmin];
                        GetPlayerName(i, sendername, sizeof(sendername));
                        format(string, 256, "*Admin:(ID: %d) %s Admin Level:(%d)*", i, sendername, adminlevel);
                        SendClientMessage(playerid, COLOR_GREEN, string);
                }
            }
        }
        }
        return 1;
    }
If you don't use GF, you should edit that to your own standards
Reply
#6

Having a problem, with both snippets that I added to my script.. When I try and compile it tells me the following or something similar:

C:\Users\admin\Desktop\ser 0.3\filterscripts\RAdmin.pwn(53 : warning 217: loose indentation
C:\Users\admin\Desktop\ser 0.3\filterscripts\RAdmin.pwn(542) : error 017: undefined symbol "COLOR_GRAD1"
C:\Users\admin\Desktop\ser 0.3\filterscripts\RAdmin.pwn(550) : error 017: undefined symbol "sendername"
C:\Users\admin\Desktop\ser 0.3\filterscripts\RAdmin.pwn(550) : error 017: undefined symbol "sendername"
C:\Users\admin\Desktop\ser 0.3\filterscripts\RAdmin.pwn(550) : error 029: invalid expression, assumed zero
C:\Users\admin\Desktop\ser 0.3\filterscripts\RAdmin.pwn(550) : fatal error 107: too many error messages on one line
Reply
#7

pawn Код:
#define COLOR_GRAD1 0xB4B5B7FF
That fixes the COLOR error.

But this is getting more GF related, so I think I need to force you to continue about this at GF topic: http://forum.sa-mp.com/index.php?topic=24634.0
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)