SA-MP Forums Archive
Car Whisper - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Car Whisper (/showthread.php?tid=79709)



Car Whisper - FreeSoul - 30.05.2009

Anybody has a command like /carwhisper that will send a message only for the players that are in the car? Like
X says in the car: Hello and only the people in the car can see it.


Re: Car Whisper - Lewwy - 30.05.2009

This is how you would check anyway.

pawn Code:
for(new i = 0; i < MAX_PLAYERS; i ++)
{
  if(IsPlayerConnected(i))
  {
    if(IsPlayerInVehicle(i, GetPlayerVehicleID(playerid)))
    {
      SendClientMessage(i, color, string);
    }
  }
  return 1;
}



Re: Car Whisper - Castle - 30.05.2009

I suggest making it into a callback...
Example:
pawn Code:
forward SendCarMessage(color, string[]);

public SendCarMessage(color, string[])
{
    for(new i = 0; i < MAX_PLAYERS; i ++)
    {
    if(IsPlayerConnected(i))
      {
        if(IsPlayerInVehicle(i, GetPlayerVehicleID(i)))
            {
            SendClientMessage(i, color, string);
            }
      }
    }
}