SA-MP Forums Archive
SendClientMessageToALL only for LoggedON == 1 ? - 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: SendClientMessageToALL only for LoggedON == 1 ? (/showthread.php?tid=494576)



SendClientMessageToALL only for LoggedON == 1 ? - Kapone21 - 13.02.2014

How can i make :

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


Re: SendClientMessageToALL only for LoggedON == 1 ? - jtemple042996 - 13.02.2014

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



Re: SendClientMessageToALL only for LoggedON == 1 ? - Threshold - 14.02.2014

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;
}