diff --git a/kp_liberation.brf_sumava/init.sqf b/kp_liberation.brf_sumava/init.sqf index fc834e3..bcfa70a 100644 --- a/kp_liberation.brf_sumava/init.sqf +++ b/kp_liberation.brf_sumava/init.sqf @@ -1,4 +1,3 @@ - KPLIB_init = false; // Version of the KP Liberation framework @@ -63,9 +62,4 @@ if (isServer) then { publicVariable "KPLIB_initServer"; }; -// WIP - this doesn't work yet, i don't know why. -/* -// Spawn and activate the GM Save Pictures module at mission start -private _m = createVehicle ["gm_moduleSavePictures", [0, 0, 0], [], 0, "NONE"]; -_m setVariable ["BIS_fnc_initModules_activate", true, true]; -*/ \ No newline at end of file +null = [] execVM "scripts\client\misc\fnc_initPhotoHandler.sqf"; \ No newline at end of file diff --git a/kp_liberation.brf_sumava/scripts/client/misc/fnc_initPhotoHandler.sqf b/kp_liberation.brf_sumava/scripts/client/misc/fnc_initPhotoHandler.sqf new file mode 100644 index 0000000..5a27ee0 --- /dev/null +++ b/kp_liberation.brf_sumava/scripts/client/misc/fnc_initPhotoHandler.sqf @@ -0,0 +1,26 @@ +// fnc_initPhotoHandler.sqf +// This function is a bypass for gm_moduleSavePictures, because it didn't want to behave. +// The screenshots taken by the camera will be located in User\Documents\Arma 3\Screenshots\gm_photocamera +// You're welcome, Cammie + +[missionNamespace, "gm_photocamera_takePicture", { + private _time = date; // [year, month, day, hour, minute] + private _year = _time select 0; + private _month = _time select 1; + private _day = _time select 2; + private _hour = _time select 3; + private _minute = _time select 4; + private _second = floor (diag_tickTime % 60); + + if (_month < 10) then {_month = "0" + str _month;} else {_month = str _month;}; + if (_day < 10) then {_day = "0" + str _day;} else {_day = str _day;}; + if (_hour < 10) then {_hour = "0" + str _hour;} else {_hour = str _hour;}; + if (_minute < 10) then {_minute = "0" + str _minute;} else {_minute = str _minute;}; + if (_second < 10) then {_second = "0" + str _second;} else {_second = str _second;}; + + private _timestamp = format ["%1-%2-%3_%4-%5-%6", _year, _month, _day, _hour, _minute, _second]; + private _filename = format ["gm_photocamera/photo_%1.png", _timestamp]; + + screenshot _filename; + systemChat format ["Saved photo: %1", _filename]; +}] call BIS_fnc_addScriptedEventHandler;