SendClientMessageToALL only for LoggedON == 1 ?
#1

How can i make :

SendClientMessageToALL to send the message ONLY to the players who have LoggedON == 1 ) ?
a stock something ?
Reply
#2

pawn Код:
stock SendClientMessageToAllEx(color,msg[]){
     for(new i = 0; i < MAX_PLAYERS; i++){
          if(LoggedIn[i] == 1){
                SendClientMessage(i,color,msg);
          }
      }
}
Reply
#3

pawn Код:
stock SendClientMessageToAllEx(color, const string[])
{
    for(new i = 0; i < MAX_PLAYERS; i++) //Foreach is recommended here.
    {
        if(!IsPlayerConnected(i)) continue; //Remove if you are using foreach.
        if(!LoggedOn[i]) continue; //This means, if they are not logged in, skip them.
        SendClientMessage(i, color, string);
    }
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)