PlayerPlaySound to admins when new report is up. and level 4 admins can read it only
#1

Код:
PlayerPlaySound(i,1057,0.0,0.0,0.0);
when someone /reports

right now I have:
Код:
CMD:report(playerid,params[]) {
    new reported, tmp[256], tmp2[256], Index;		tmp = strtok(params,Index), tmp2 = strtok(params,Index);
    if(isnull(params)) return SendClientMessage(playerid, red, "USAGE: /report [playerid] [reason]");
	reported = strval(tmp);

 	if(IsPlayerConnected(reported) && reported != INVALID_PLAYER_ID) {
		if(PlayerInfo[reported][Level] == ServerInfo[MaxAdminLevel]) return SendClientMessage(playerid,red,"ERROR: You cannot report this administrator");
		if(playerid == reported) return SendClientMessage(playerid,red,"ERROR: You Cannot report yourself");
		if(strlen(params) > 3) {
			new reportedname[MAX_PLAYER_NAME], reporter[MAX_PLAYER_NAME], str[128], hour,minute,second; gettime(hour,minute,second);
			GetPlayerName(reported, reportedname, sizeof(reportedname));	GetPlayerName(playerid, reporter, sizeof(reporter));
			format(str, sizeof(str), "{00FF00}||NewReport||  %s(%d) reported %s(%d) Reason: %s |@%d:%d:%d|", reporter,playerid, reportedname, reported, params[strlen(tmp)+1], hour,minute,second);
			MessageToTwice(red,str);
			SaveToFile("ReportLog",str);
			format(str, sizeof(str), "Report(%d:%d:%d): %s(%d) reported %s(%d) Reason: %s", hour,minute,second, reporter,playerid, reportedname, reported, params[strlen(tmp)+1]);
			for(new i = 1; i < MAX_REPORTS-1; i++) Reports[i] = Reports[i+1];
			Reports[MAX_REPORTS-1] = str;
			return SendClientMessage(playerid,yellow, "Your report has been sent to online administrators.");
		} else return SendClientMessage(playerid,red,"ERROR: Must be a valid reason");
	} else return SendClientMessage(playerid, red, "Player is not connected");
}
Reply
#2

My guess you need to turn your attention to this function.

MessageToTwice(red,str);

It will contain a loop that messages all admins put it there.
Reply
#3

pawn Код:
CMD:report(playerid,params[]) {
    new reported, tmp[256], tmp2[256], Index;       tmp = strtok(params,Index), tmp2 = strtok(params,Index);
    if(isnull(params)) return SendClientMessage(playerid, red, "USAGE: /report [playerid] [reason]");
    reported = strval(tmp);
O
    if(IsPlayerConnected(reported) && reported != INVALID_PLAYER_ID) {
        if(PlayerInfo[reported][Level] == ServerInfo[MaxAdminLevel]) return SendClientMessage(playerid,red,"ERROR: You cannot report this administrator");
        if(playerid == reported) return SendClientMessage(playerid,red,"ERROR: You Cannot report yourself");
        if(strlen(params) > 3) {
            new reportedname[MAX_PLAYER_NAME], reporter[MAX_PLAYER_NAME], str[128], hour,minute,second; gettime(hour,minute,second);
            GetPlayerName(reported, reportedname, sizeof(reportedname));    GetPlayerName(playerid, reporter, sizeof(reporter));
            format(str, sizeof(str), "{00FF00}||NewReport||  %s(%d) reported %s(%d) Reason: %s |@%d:%d:%d|", reporter,playerid, reportedname, reported, params[strlen(tmp)+1], hour,minute,second);
            MessageToTwice(red,str);
            SaveToFile("ReportLog",str);
            format(str, sizeof(str), "Report(%d:%d:%d): %s(%d) reported %s(%d) Reason: %s", hour,minute,second, reporter,playerid, reportedname, reported, params[strlen(tmp)+1]);
            for(new i = 1; i < MAX_REPORTS-1; i++) Reports[i] = Reports[i+1];
            Reports[MAX_REPORTS-1] = str;
            for(new i; i < MAX_PLAYERS; i++)
            {
                  if(IsPlayerAdmin(i))
                 {
                        new Float:x,Float:y,Float:z;
                        GetPlayerPos(i,x,y,z);
                        PlayerPlaySound(i,1057,x,y,z);
                  }
             }
            return SendClientMessage(playerid,yellow, "Your report has been sent to online administrators.");
        } else return SendClientMessage(playerid,red,"ERROR: Must be a valid reason");
    } else return SendClientMessage(playerid, red, "Player is not connected");
}
Use loop to play sound for all admin
Reply
#4

hey I have a new problem, only level 4 admins can see the report and /helpme. in order to see reports, they must do /reports. how to make it all admin levels can see it right away?
How to make it level 1 and up can see it?

also I have /helpme command it has messagetotwice but i dont know how to add the playerplaysound

Код:
CMD:helpme(playerid, params[])
{
	new str[128], Name1[MAX_PLAYER_NAME];
	if(sscanf(params,"s[128]", str))
	{
	 SendClientMessage(playerid, red,"CORRECT USAGE: /helpme [text]");
	 return 1;
	}
	GetPlayerName(playerid, Name1, sizeof(Name1));
	format(str, sizeof(str),"{B80000}**New help request** {00FFF0}from - %s[%i]:{FFFF00} %s",Name1,playerid,str);
	MessageToTwice(red, str);
	SendClientMessage(playerid, yellow,"Your help request has been sent to online administrators, please be patient.");
	return 1;
}
Reply
#5

Post the "MessageToTwice" function.
Reply
#6

Thank you, i searched that function and i saw the level needed to read.
so I have /helpme command it has messagetotwice but i dont know how to add the playerplaysound

Код:
CMD:helpme(playerid, params[])
{
	new str[128], Name1[MAX_PLAYER_NAME];
	if(sscanf(params,"s[128]", str))
	{
	 SendClientMessage(playerid, red,"CORRECT USAGE: /helpme [text]");
	 return 1;
	}
	GetPlayerName(playerid, Name1, sizeof(Name1));
	format(str, sizeof(str),"{B80000}**New help request** {00FFF0}from - %s[%i]:{FFFF00} %s",Name1,playerid,str);
	MessageToTwice(red, str);
	SendClientMessage(playerid, yellow,"Your help request has been sent to online administrators, please be patient.");
	return 1;
}
[/QUOTE]
Reply
#7

pawn Код:
CMD:helpme(playerid, params[])
{
    new str[128], Name1[MAX_PLAYER_NAME];
    if(sscanf(params,"s[128]", str))
    {
     SendClientMessage(playerid, red,"CORRECT USAGE: /helpme [text]");
     return 1;
    }
    GetPlayerName(playerid, Name1, sizeof(Name1));
    format(str, sizeof(str),"{B80000}**New help request** {00FFF0}from - %s[%i]:{FFFF00} %s",Name1,playerid,str);
    for(new i; i < MAX_PLAYERS; i++)
    {
        if(PlayerInfo[i][pAdmin] >= 4) // Change your admin here. I'm just make a exemple for this
        {
            SendClientMessage(i,red,str);
        }
    }
    SendClientMessage(playerid, yellow,"Your help request has been sent to online administrators, please be patient.");
    return 1;
}
Reply
#8

Fixed!! Thanks everyone
Reply
#9

Why does it give all players the sound?
Код:
            for(new i; i < MAX_PLAYERS; i++)
            {
                  if(IsPlayerAdmin(i))
                 {
                        new Float:x,Float:y,Float:z;
                        GetPlayerPos(i,x,y,z);
                        PlayerPlaySound(i,1057,x,y,z);
                  }
             }
will it be fixed if it is under the Message to twice functions?
Код:
forward MessageToTwice(color,const string[]);
public MessageToTwice(color,const string[])
{
	for(new i = 0; i < MAX_PLAYERS; i++)
	{
		if(IsPlayerConnected(i) == 1) if (PlayerInfo[i][OnDuty] == 1 || PlayerInfo[i][Level] >= 1 || PlayerInfo[i][Helper] == 1) SendClientMessage(i, color, string);
	}
	return 1;
}
Reply
#10

Next time use [PAWN] don't use [CODE]

pawn Код:
stock MessageToTwice(color,const string[])
{
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i)
        {
            if(PlayerInfo[i][OnDuty] == 1)
            {
                if(PlayerInfo[i][Level] >= 1 && PlayerInfo[i][Helper] == 1)
                {
                    SendClientMessage(i, color, string);
                }
            }
        }
    }
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)