Jump to content
Sign in to follow this  
Heaney

Send global chat message to one player?

Recommended Posts

Hi.

Right now I am using

[-1, {player globalChat _this}, _themessage] call CBA_fnc_globalExecute;

To give a global chat message.

Problem is of course that this is on all clients.

Any way I can have it come over global chat, but only to one client?

Share this post


Link to post
Share on other sites

What Riouken said, except you should use CBA_fnc_whereLocalEvent instead. CBA_fnc_remoteLocalEvent was not meant to be a public function. Rather it is used to implement the "local" based event system and not meant to be used outside of CBA.

Share this post


Link to post
Share on other sites

Yep, thanks muzzleflash, I always get them mixed up , by which one is depreciated.

Share this post


Link to post
Share on other sites

How would I use this to achieve what I was asking about?

I don't see how to use code with this.

Edited by Heaney

Share this post


Link to post
Share on other sites

First you add an "event handler" on all machines, could be a place like init.sqf. The first parameter has to be the object that must be local. Eg. if you want a message to show up at player A then player A would be the first parameter. The message is the second.

["local_msg", {
   (_this select 0) globalChat (_this select 1);
}] call CBA_fnc_addLocalEventHandler;

This is how you would send the event

//Assume that the player object who you want to see this message is in _thePlayer
//The message is "Hello world!"
["local_msg", [_thePlayer, "Hello world!"]] call CBA_fnc_whereLocalEvent;

Basically that is how event handlers work in CBA. You register them on machines and then send the events. In this case the first argument determines where it is run. There are also CBA event handlers that don't care created by CBA_fnc_addEventHandler and activated by CBA_fnc_globalEvent

Share this post


Link to post
Share on other sites

Wow that's a great explanation, I get it now. Thanks!

Share this post


Link to post
Share on other sites

EDIT: Ignore.

Edited by Heaney

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×