SA-MP Forums Archive
Admins PM - 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: Admins PM (/showthread.php?tid=562554)



Admins PM - Thoma - 09.02.2015

Is there any command or link anyone can point me to enable my admins to be able to read the PMs sent by users? I have searched and only found an FS for rcon but i dont need that


Re: Admins PM - HazardouS - 09.02.2015

Define PM, because it can be some sort of forum PM, in-game PM stored in some sort of inbox, in-game PM as a chat message etc.


Re: Admins PM - Sascha - 09.02.2015

If you are talking about reading live /pm messaging on the forum, you won't find any FS for that (except an admin script that includes /pm).
Most people send PMs with SendClientMessage or SendPlayerMessageToPlayer.. There is no way to detect whether such a message is being sent, therefore no secondary script (FS) could provide such a feature..
The solution to this is to create a player variable like
pawn Код:
new readpm[MAX_PLAYERS;
which is set to 0 when connecting (or disconnecting)
Then you would run a loop when a player uses the /pm command.

Let's say you used SendClientMessage to send the PM. Then you would have some variable (let's call it "string") that stores the text... E.G.
pawn Код:
format(string, sizeof(string), "PM by %s to %s: %s", name1, name2, msgtext);
SendClientMessage(pid, 0x999999AA, string);
You would add the loop behind of this. The loop would run through all players and detect whether the player is online and reading pms (readpm[playerid] == 1) (and optional whether the player is an admin)
something like this:
pawn Код:
for(new i=0; i<GetMaxPlayers(); i++)
{
    if(IsPlayerConnected(i))
    {
        if(readpm[i] == 1)
        {
            SendClientMessage(i, 0x999999AA, string);
        }
    }
}

a player would (in this version) have to use a command to enable reading, which would be done inside of the command with
pawn Код:
readpm[playerid] = 1;



Re: Admins PM - Thoma - 09.02.2015

No i mean i have a in-game pm system i need to know how i can allow my admins to read the pms being sent by the members.


Re: Admins PM - Sascha - 09.02.2015

Quote:
Originally Posted by Sascha
Посмотреть сообщение
If you are talking about reading live /pm messaging on the forum, you won't find any FS for that (except an admin script that includes /pm).
Most people send PMs with SendClientMessage or SendPlayerMessageToPlayer.. There is no way to detect whether such a message is being sent, therefore no secondary script (FS) could provide such a feature..
The solution to this is to create a player variable like
pawn Код:
new readpm[MAX_PLAYERS;
which is set to 0 when connecting (or disconnecting)
Then you would run a loop when a player uses the /pm command.

Let's say you used SendClientMessage to send the PM. Then you would have some variable (let's call it "string") that stores the text... E.G.
pawn Код:
format(string, sizeof(string), "PM by %s to %s: %s", name1, name2, msgtext);
SendClientMessage(pid, 0x999999AA, string);
You would add the loop behind of this. The loop would run through all players and detect whether the player is online and reading pms (readpm[playerid] == 1) (and optional whether the player is an admin)
something like this:
pawn Код:
for(new i=0; i<GetMaxPlayers(); i++)
{
    if(IsPlayerConnected(i))
    {
        if(readpm[i] == 1)
        {
            SendClientMessage(i, 0x999999AA, string);
        }
    }
}

a player would (in this version) have to use a command to enable reading, which would be done inside of the command with
pawn Код:
readpm[playerid] = 1;
like that...

if you want a solution that fits to your PM system, you won't get around of posting your PM command and your definition (variables) for admins here...


Re: Admins PM - CalvinC - 10.02.2015

When someone sends a private message to someone else, send it to administrators too.
Example:
pawn Код:
new string[128]; // Defines the string we are gonna use
for(new i = 0; i < MAX_PLAYERS; i++) // Loops through all players and defines them as "i"
{
    if(IsPlayerConnected && IsPlayerAdmin(i)) // If "i" is an RCON admin and is connected it sends the message below
    {
        format(string, sizeof(string), "(PM) %s > %s: %s"); // Formats the string
        SendClientMessage(i, -1, string); // Sends the string message to the admin
    }
}