Report System
#1

Howdy, So im working on a report system so that one they do /report [Text]

It send's the message to Admins Only.

The only problem is that i do not know how i would make it sent to Admins Only.

Here is the /report Command so Far.

pawn Код:
CMD:report(playerid,params[])
{
    new text,pName[MAX_PLAYER_NAME],string[128];
    if(sscanf(params, "s[125]", text)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /report [Text]");
    else
    {
        PlayerInfo[playerid][pReportSent] = 1;
        SendClientMessage(playerid,COLOR_YELLOW,"Your Report Has Been Sent Succesfully...");
        GetPlayerName(playerid, pName, MAX_PLAYER_NAME);
        format(string,128,"%s:[%d]:%s",pName,playerid,text);
        SendClientMessage(playerid,COLOR_ORANGE,string);
    }
    return 1;
}
Reply
#2

You have to make a separate function, like MessageToAdmins. Here:

pawn Код:
forward MessageToAdmins(color,const string[]);
public MessageToAdmins(color,const string[])
{
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i) == 1)
        {
            if(IsPlayerAdmin(i))
            {
                SendClientMessage(i, color, string);
            }
        }
    }
    return 1;
}
Then, when you format the message, use MessageToAdmins(COLOR_HERE,string); instead of SendClientMessage(...);

You can change IsPlayerAdmin to your admin variables if you have any.
Reply
#3

Quote:
Originally Posted by grand.Theft.Otto
Посмотреть сообщение
You have to make a separate function, like MessageToAdmins. Here:

pawn Код:
forward MessageToAdmins(color,const string[]);
public MessageToAdmins(color,const string[])
{
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i) == 1)
        {
            if(IsPlayerAdmin(i))
            {
                SendClientMessage(i, color, string);
            }
        }
    }
    return 1;
}
Then, when you format the message, use MessageToAdmins(COLOR_HERE,string); instead of SendClientMessage(...);

You can change IsPlayerAdmin to your admin variables if you have any.
Thanks for this public funcion , rep+
Reply
#4

Quote:
Originally Posted by JohnD123
Посмотреть сообщение
Thanks for this public funcion , rep+
Bumping 2 year old topic, Hmm nice, i like it.
Reply
#5

Quote:
Originally Posted by Hanuman
Посмотреть сообщение
Bumping 2 year old topic, Hmm nice, i like it.
Better than creating a new one, though!

Quote:
Originally Posted by JohnD123
Посмотреть сообщение
Thanks for this public funcion , rep+
Might I suggest a minor improvement? Remove IsPlayerConnected because IsPlayerAdmin will always return 0 if the player's not connected.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)