
Originally Posted by
SaMatra
Oh its not really a "vehicle" there, just replaced actual variable with it here on forums. If I swap _x and nil, then everyone sees global chat message instead of just people inside
Hmm think you actually need to use _x both places instead. The first is who says the message, the second is on what machine that should happen. So my guess is that:
Code:
[nil, _x, "loc", rGlobalChat, "Some message"] call RE;
Doesn't work because it ends up something like: nil globalChat "Some Message";
And
Code:
[_x, nil, "loc", rGlobalChat, "Some message"] call RE;
doesn't work because the "local object" is nil it just ignores and does it for everybody.
So try:
Code:
[_x, _x, "loc", rGlobalChat, "Some message"] call RE;
Another issue if there are AI's in the game you may want to filter away those. Otherwise if you for instance the host is also playing (not a dedicated) and there are say 3 AI's in the vehicle he will see the message 3 times. So you can filter way AI's like this:
Code:
//Assume the vehice in question is _vehicle;
_toChatTo = [];
{
if (isPlayer _x) then {
_toChatTo set [count _toChatTo, _x];
};
} forEach (crew _vehicle);
{
[_x, _x, "loc", rGlobalChat, "Some message"] call RE;
} forEach _toChatTo;