I have a dynamic drug field script but it's not working right and looking for some help.
I get error codes:
And :
C++:
#include "\life_server\script_macros.hpp"
/*
File: fn_dynDrugFields.sqf
Author: Your Mom /(.)(.)\
*/
diag_log "--------------------------------------";
diag_log "Dyn Drug Fields: Initializing...";
diag_log "--------------------------------------";
private _drugLocations = [
["weed", "Weed Field", "ColorRed", "mil_dot"],
["heroin", "Heroin Field", "ColorRed", "mil_dot"],
["cocaine", "Cocaine Field", "ColorRed", "mil_dot"]
];
private _stayTime = getNumber(missionConfigFile >> "CfgDynMarkers" >> "DynMarkers_Settings" >> "fields_position_time");
if (_stayTime == 0) exitWith {
diag_log "--------------------------------------";
diag_log "Error: fields_position_time is set to 0!";
diag_log "--------------------------------------";
};
private ["_createDrugFieldMarker", "_createDrugFieldAreaMarker"];
_createDrugFieldMarker = {
private ["_drugType", "_drugName", "_color", "_markerType", "_location", "_markerName", "_drugFieldMarker"];
_drugType = _this select 0;
_drugName = _this select 1;
_color = _this select 2;
_markerType = _this select 3;
_locationArray = configFile >> "CfgDynMarkers" >> "DynMarkers_Settings" >> format ["%1_locations", _drugType];
if (count _locationArray == 0) exitWith {
diag_log format ["Error: No %1 locations defined!", _drugType];
};
_location = selectRandom _locationArray;
_markerName = format ["%1_1", _drugType];
deleteMarker _markerName;
_drugFieldMarker = createMarker [_markerName, _location];
_drugFieldMarker setMarkerColor _color;
_drugFieldMarker setMarkerType _markerType;
_drugFieldMarker setMarkerText _drugName;
format ["%1_field", _drugType] setMarkerPos _location;
diag_log format ["Created %1 field marker at %2", _drugType, _location];
};
_createDrugFieldAreaMarker = {
private ["_drugType", "_areaMarkerName", "_areaMarkerPos", "_drugFieldAreaMarker"];
_drugType = _this select 0;
_areaMarkerName = format ["%1_field", _drugType];
_areaMarkerPos = getMarkerPos _areaMarkerName;
deleteMarker _areaMarkerName;
_drugFieldAreaMarker = createMarker [_areaMarkerName, _areaMarkerPos];
_drugFieldAreaMarker setMarkerColor "ColorWhite";
_drugFieldAreaMarker setMarkerType "empty";
_drugFieldAreaMarker setMarkerShape "ELLIPSE";
_drugFieldAreaMarker setMarkerSize [35, 35];
diag_log format ["Created %1 field area marker at %2", _drugType, _areaMarkerPos];
};
{
_drugType = _x select 0;
[_x] call _createDrugFieldMarker;
[_x] call _createDrugFieldAreaMarker;
[0,format ["<t align='center'><t size='2.4'><t color='#FF0000'>Drug Field</t></t><br/> A %1 field has been spoted and marked on your map!",_drugType]] remoteExecCall ["life_fnc_broadcast",west,civilian];
} forEach _drugLocations;
sleep (_stayTime * 60);
[0,format ["<t align='center'><t size='2.4'><t color='#FF0000'>Drug Field</t></t><br/> The Drug Field is moving to a new location. The new location will be marked on map in 10 Min!"]] remoteExecCall ["life_fnc_broadcast",west,civilian];
{
private _markerName = format ["%1_1", _x select 0];
private _areaMarkerName = format ["%1_field", _x select 0];
deleteMarker _markerName;
deleteMarker _areaMarkerName;
diag_log format ["Removed %1 field marker and area marker", _x select 0];
} forEach _drugLocations;
diag_log "---------------------------";
diag_log "Dyn Drug Fields: Removed...";
diag_log "---------------------------";
[]spawn TON_fnc_drugFieldsInit;
I get error codes:
C++:
"Error: No [""weed"",""Weed Field"",""ColorRed"",""mil_dot""] locations defined!"
Error in expression <ugName = _this select 1;
_color = _this select 2;
_markerType = _this select 3;
>
Error position: <select 2;
_markerType = _this select 3;
>
Error Zero divisor
File life_server\Functions\Systems\fn_dynDrugFields.sqf..., line 31
And :
C++:
"Created [""weed"",""Weed Field"",""ColorRed"",""mil_dot""] field area marker at [0,0,0]"
Error in expression <ed and marked on your map!",_drugType]] remoteExecCall ["life_fnc_broadcast",wes>
Error position: <remoteExecCall ["life_fnc_broadcast",wes>
Error Type Side, expected String, Bool, Object, Group
File life_server\Functions\Systems\fn_dynDrugFields.sqf..., line 74