Will this send a message to only people who are silent?
#1

pawn Код:
public OnPlayerText(playerid, text[])
{
    if(playerInSilent[playerid] == 1)
    {
      for(new i=0; i<MAX_PLAYERS; i++)
        {
          if(playerInSilent[i] == 1)
          {
            SendPlayerMessageToPlayer(i, playerid, text);
            return 0;
            }
        }
    }
    return 1;
}
Will that send a message to people who are only InSilent?
Because sometimes i cant speak, Sometimes others cant speak, Sometimes others cant see me speak, And sometimes i cant see them speak,

How would i do this? To send a message to all people who are silent IF im silent
Reply
#2

The message will be sent to all 'InSilent' players if the player who typed the message is also 'InSilent'
Reply
#3

Um,
pawn Код:
if(playerInSilent[i] == 1)
{
  SendPlayerMessageToPlayer(i, playerid, text);
  return 0; //Here is the problem ;).
}
It should be like this
pawn Код:
public OnPlayerText(playerid, text[])
{
    if(playerInSilent[playerid] == 1)
    {
      for(new i=0; i<MAX_PLAYERS; i++)
        {
          if(playerInSilent[i] == 1)
          {
            SendPlayerMessageToPlayer(i, playerid, text);
            }
        }
        return 0;
    }
    return 1;
}
If you return in a loop it will hault the loop there so only the lowest ID (First person in the loop) with PlayerIsSilent will see the message.
Reply
#4

It works except when i talk.. Everytime i talk i cant see what i say but other silent room users can
Reply
#5

Quote:
Originally Posted by Joe Torran C
It works except when i talk.. Everytime i talk i cant see what i say but other silent room users can
Then just do this

pawn Код:
public OnPlayerText(playerid, text[])
{
    if(playerInSilent[playerid] == 1)
    {
      for(new i=0; i<MAX_PLAYERS; i++)
        {
          if(playerInSilent[i] == 1)
          {
            SendPlayerMessageToPlayer(i, playerid, text);
            SendClientMessage(playerid, COLOR, text);
            }
        }
        return 0;
    }
    return 1;
}
I don't see why it wouldn't work though, it's something with your SendPlayerMessageToPlayer function .
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)