Jump to content
Sign in to follow this  
icebreakr

Command (driver vehiclename) sidechat "";

Recommended Posts

Does anyone have a clue how to fix this command below to work on dedicated?

(driver name_of_the_vehicle) sidechat "We have engine problems...";

?

Share this post


Link to post
Share on other sites

It's not that simple. It needs to be broadcast to all clients. There are various ways of doing it. I think 6thSense uses Network Services Lite library for it, not certain. You may be able to do it with triggers. I've opted to just use a scripted solution for broadcasting chat messages and in fact, any broadcast script. See blue text below. It has solved all of my MP broadcasting requirements.

It looks complicated, but who cares, once it's implemented, it becomes as easy as a call like:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">[soldierW1, 'Hello'] call fn_GroupChat;

mission.sqm

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">...add a gameLogic called GLexec

<span style='color:blue'>Scripts\Broadcast\ExecVM.sqf</span> - I highly recommend having a script like this one. <span style='color:red'>This is the key to it all.</span>

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">// Desc: Broadcast a script execution on all clients and server

// Exec: anywhere

//-----------------------------------------------------------------------------

// params

_code = _this select 0;

// Notes: GLexec is a Game Logic used by this script (rather than using a vehicle)

GLexec setVehicleInit _code;

processInitCommands;

clearVehicleInit GLexec;

Scripts\Broadcast\Chat\GroupChat.sqf

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">// Desc: call groupChat on each (group member's) client

// Note: _msg cannot contain single double-quote chars.

//-----------------------------------------------------------------------------

_callerID = _this select 0; // determines relevant group

_msg = _this select 1;

_code=format["['%1', '%2'] execVM 'Scripts\Broadcast\Chat\GroupChatNotify.sqf'", _callerID, _msg];

nul=[format["%1", _code]] execVM "Scripts\Broadcast\ExecVM.sqf";

Scripts\Broadcast\Chat\GroupChatNotify.sqf

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">// Desc: call groupChat on each (group member's) client

// Exec: all clients - broadcast

//-----------------------------------------------------------------------------

// locality

if (!isClient) exitWith {};

// params

_callerID = _this select 0; // used to determine group

_chatMsg = _this select 1;

// convert ID strings to valid objects

_playerList = units player;

_caller = [_callerID, _playerList] call fn_FindObjectString;

if (isNull _caller) exitWith {};

//-----------------------------------------------------------------------------

// if (group player == group _caller) then

if (player in (units _caller)) then

{

_caller groupChat _chatMsg;

};

Scripts\CommonFunctions.sqf

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">fn_groupChat = compile preprocessFile "Scripts\Broadcast\Chat\GroupChat.sqf";

Scripts\CommonFunctions.sqf

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">fn_FindObjectString =

{

private ["_result", "_objectString", "_objectsList", "_obj"];

_objectString = _this select 0; // object string = format["%1", object]. Object is often a player or AI

_objectsList = _this select 1; // array of objects

_result = objNull;

{

_obj = _x;

if (_objectString == format["%1", _obj]) then

{

_result = _obj;

};

} forEach _objectsList;

_result;

};

There's also code available for:

- GlobalChat.sqf

- GroupChat.sqf

- HQGroupChat.sqf

- ProximityChat.sqf

- SideChat.sqf

- VehicleChat.sqf

Handling [WEST, "HQ"] for sideChat becomes a little trickier too.

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  

×