SA-MP Forums Archive
Chat id what player cant see the message? - 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: Chat id what player cant see the message? (/showthread.php?tid=583773)



Chat id what player cant see the message? - DerickClark - 30.07.2015

Hm what if player cant see the message? if I set it to SendClientMessage
Like something like this


pawn Код:
if(Chat[playerid] == true)
    {
        new string[128];
        format(string,sizeof(string),"(%i) %s: {FFFFFF}%s",playerid, ReturnName(playerid),text);
        SendClientMessageToAll(GetPlayerColor(playerid), string);
        if(Chat[playerid] == false) // For the ones who didnt type /chatid
        {
            format(string,sizeof(string),"%s: {FFFFFF}%s",playerid, ReturnName(playerid),text);
            SendClientMessageToAll(GetPlayerColor(playerid), string);
            //SendClientMessage(playerid, -1, string);
        }
    }
    else
    {
        new string[128];
        format(string,sizeof(string),"%s: {FFFFFF}%s",ReturnName(playerid),text);
        SendClientMessageToAll(GetPlayerColor(playerid), string);
    }



Re: Chat id what player cant see the message? - Abagail - 30.07.2015

You mean you want to send it to everyone on the server but the player?

pawn Код:
SendClientMessageToAllExcept(noplayer, color[], string[])
{
      for(new i; i < MAX_PLAYERS; i++) {
          if(!IsPlayerConnected(i)) continue;
          if(i == playerid) continue;
 
          if(!IsPlayerNPC(i)) SendClientMessage(i, color, string);
      }

      return 1;
}
This loops through online players, makes sure the player is connected, checks if the player equals the player specified and then finally sends the message if the player isn't a NPC.


Re: Chat id what player cant see the message? - DerickClark - 30.07.2015

i mean like /togglechat now he have (0) Test: -->
if the player didnt /togglechat it will have Test: -->
he will still see the chat message, its something like my code


Re: Chat id what player cant see the message? - youssefehab500 - 30.07.2015

PHP код:
new string[128];
if(
Chat[playerid] == true)
{
    
format(string,sizeof(string),"(%i) %s: {FFFFFF}%s",playeridReturnName(playerid),text);
    
SendClientMessageToAll(GetPlayerColor(playerid), string);
}
else
{
    
format(string,sizeof(string),"%s: {FFFFFF}%s",playeridReturnName(playerid),text);
    
SendClientMessageToAll(GetPlayerColor(playerid), string);