SA-MP Forums Archive
[HELP] Admin Can Read PM's - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: [HELP] Admin Can Read PM's (/showthread.php?tid=213297)



[HELP] Admin Can Read PM's - Larsey123IsMe - 18.01.2011

I did something like: (BUT that dont work xD, How to fix O.o)
pawn Код:
dcmd_readpm(playerid, params[])
{
    #pragma unused params
    if(IsPlayerAdmin(playerid))
    {
        if(ReadingPM[playerid] == 1)
        {
            SendClientMessage(playerid, 0xFF0000FF, "You is already reading the PM's");
            return 1;
        }
        else
        {
            ReadingPM[playerid] = 1;
            SendClientMessage(playerid, 0xFF0000FF, "You is now reading the PM's");
               
            for(new i = 0; i < MAX_PLAYERS; i++)
            {
                new pName [MAX_PLAYER_NAME], tName [MAX_PLAYER_NAME], PMstring[128], targetid, message[64];
                GetPlayerName(i, pName, MAX_PLAYER_NAME);
                GetPlayerName(targetid, tName, MAX_PLAYER_NAME);
           
                format(PMstring, sizeof(PMstring), "pm from %s(%d): %s to %s(%d)", pName, i, message, tName, targetid);
                SendClientMessage(targetid, COLOR_PM, PMstring);
                return 1;
            }
        }
    }
    return 0;
}

dcmd_readpmoff(playerid, params[])
{
    #pragma unused params
    if(IsPlayerAdmin(playerid))
    {
        if(ReadingPM[playerid] == 0)
        {
            SendClientMessage(playerid, 0xFF0000FF, "You is not reading the PM's");
            return 1;
        }
        else
        {
            ReadingPM[playerid] = 0;
            SendClientMessage(playerid, 0xFF0000FF, "You dont read the PM's anymore");
            return 1;
        }
    }
    return 0;
}



Re: [HELP] Admin Can Read PM's - Lorenc_ - 19.01.2011

Your looping through all players.

pawn Код:
for(new i = 0; i < MAX_PLAYERS; i++)
{
       if(GetPVarInt(i, "Admin") > 0)
       {
             //code
       }
}
Basicly you need something to check if the players are admin