if(!isServer) exitWith{};
private ["_Grp","_type","_side","_vec","_unit","_pos","_rad ius"];
_type = _this select 0;
_side = _this select 1;
_pos = _this select 2;
_radius = _this select 3;
_x = _pos select 0;
_y = _pos select 1;
_Grp = createGroup _side;
_spawnpos = [0,0];
While{surfaceIsWater _spawnpos} do {
_spawnpos = [_x + _radius - random (_radius*2), _y + _radius - random (_radius*2)];
};
_spawnpos set [2,0];
_vec = _type createVehicle _spawnpos;
_crewtype = getArray (configFile >> "CfgVehicles" >> _type >> "typicalCargo");
_max = (count _crewtype)-1;
if(count(_crewtype - ["Soldier"])==0) then{
if(_side==EAST) then{_crewtype = ["RU_Soldier"]}
else {_crewtype = ["USMC_Soldier"]};
};
if((_vec emptyPositions "commander") > 0) then {
_unit = _grp createUnit [_crewtype select (round random _max), _pos, [], random 1, "NONE"];
_unit moveinCommander _vec;
};
if((_vec emptyPositions "gunner") > 0) then {
_unit = _grp createUnit [_crewtype select (round random _max), _pos, [], random 1, "NONE"];
_unit moveinGunner _vec;
};
if((_vec emptyPositions "driver") > 0) then {
_unit = _grp createUnit [_crewtype select (round random _max), _pos, [], random 1, "NONE"];
_unit moveinDriver _vec;
};
_nul=[_vec,""markerToPatrol""] execVM ""ups.sqf"";
_Grp