mirror of
https://github.com/valmojr/armatak.git
synced 2026-06-13 15:03:30 +00:00
added start and stop functions for the UDP Socket
This commit is contained in:
@@ -1,2 +1,4 @@
|
||||
PREP(convertClientLocation);
|
||||
PREP(extractClientPosition);
|
||||
PREP(startUDPSocket);
|
||||
PREP(stopUDPSocket);
|
||||
31
addons/client/functions/fnc_startUDPSocket.sqf
Normal file
31
addons/client/functions/fnc_startUDPSocket.sqf
Normal file
@@ -0,0 +1,31 @@
|
||||
#include "..\script_component.hpp"
|
||||
|
||||
params ["_logic"];
|
||||
|
||||
_socket_is_running = player getVariable [QGVAR(eudConnected), false];
|
||||
|
||||
if (_socket_is_running) exitWith {
|
||||
["Socket is already running", "error", "UDP Socket"] call EFUNC(main,notify);
|
||||
closeDialog 1;
|
||||
};
|
||||
|
||||
disableSerialization;
|
||||
|
||||
_udp_socket_instance_address = ctrlText 16961;
|
||||
_udp_socket_instance_port = ctrlText 16962;
|
||||
|
||||
_udp_socket_fulladdress = ((_udp_socket_instance_address) + ":" + (_udp_socket_instance_port));
|
||||
|
||||
player setVariable [QGVAR(udp_socket_address), _udp_socket_fulladdress];
|
||||
player setVariable [QGVAR(eudConnected), true];
|
||||
|
||||
"armatak" callExtension ["udp_socket:start", [_udp_socket_fulladdress]];
|
||||
|
||||
[{
|
||||
if (player getVariable [QGVAR(eudConnected), false]) then {
|
||||
"armatak" callExtension ["udp_socket:send_gps_cot", [player call FUNC(extractClientPosition)]];
|
||||
};
|
||||
}, 2, []] call CBA_fnc_addPerFrameHandler;
|
||||
|
||||
deleteVehicle _logic;
|
||||
closeDialog 1;
|
||||
0
addons/client/functions/fnc_stopUDPSocket.sqf
Normal file
0
addons/client/functions/fnc_stopUDPSocket.sqf
Normal file
Reference in New Issue
Block a user