[HELP] Admin Can Read PM's
#1

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;
}
Reply
#2

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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)