SendMessageToAdmins Sending to all players
#1

pawn Код:
stock SendMessageToAdmins(msg[])
{
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(pInfo[i][Adminlevel] >= 1)
        {
            SendClientMessage(i,-1,msg);
        }
    }
}
It sends a message to all players instead of just admins.
Reply
#2

pawn Код:
stock SendMessageToAdmins(const string[])
{
    for(new i = 0; i < MAX_PLAYERS; i++) if(IsPlayerConnected(i) == 1) if(pInfo[i][Adminlevel] > 0) SendClientMessage(i, -1, string);
    return 1;
}
Reply
#3

pawn Код:
stock SendMessageToAdmins(msg[])
{
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(pInfo[i][Adminlevel] >= 1)
        {
            SendClientMessage(playerid,-1,msg); // dont loop this
        }
    }
}
I think it will be work
Reply
#4

Your code is correct. There must be error somewhere else.
Reply
#5

There's probably a problem with the adminlevel variable.
Reply
#6

hmm try using foreach

pawn Код:
stock SendMessageToAdmins(msg[])
{
     foreach(Player,i)
    {
           if(IsPlayerConnected(i) == 1)
          if(pInfo[i][Adminlevel] > 0)
           SendClientMessage(i,-1,msg);
    }
}
Reply
#7

No,no.. Try change >=1 to >=2. You have probably Adminlevel variable set defaultly to 1 for all players.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)