#include "..\script_component.hpp"

/*
 * Author: IDSolutions
 * Sends a message
 *
 * Arguments:
 * 0: Number <STRING> - The number to send to
 * 1: Message <STRING> - The message to send
 *
 * Return Value:
 * None
 *
 * Example:
 * ["1234567890", "Hello World"] call forge_client_phone_fnc_sendMsg;
 *
 * Public: Yes
 */

params ["_number", "_msg"];

private _defaultPhoneNumber = "unknown";
private _pNumber = GETVAR(player,FORGE_Phone_Number,_defaultPhoneNumber);

{
	private _tmpNumber = GETVAR(_x,FORGE_Phone_Number,_defaultPhoneNumber);

	if (_tmpNumber isEqualTo _number) then {
		[_pNumber] remoteExec ["forge_client_phone_fnc_newMsg", _x, false];
	};
} forEach playableUnits;

// ["listadd", _number, "", -1, [_pNumber, _msg], "", false] spawn dragonfly_db_fnc_addTask;
["listadd", _number, "", -1, [_pNumber, _msg], "", false] remoteExec ["dragonfly_db_fnc_addTask", 2, false];