torekss

Помогите сделать добычу авто

Вопрос

Подскажите пожалуйста как сделать автодобычу ресурсов до полного рюкзака! версия 3.1. 4. 8

Изменено пользователем torekss (история изменений)

Поделиться сообщением


Ссылка на сообщение
Поделиться на других сайтах

4 ответа на этот вопрос

Подскажите пожалуйста как сделать автодобычу ресурсов до полного рюкзака! версия 3.1. 4. 8

Можно ваш файл fn_gather.sqf

Поделиться сообщением


Ссылка на сообщение
Поделиться на других сайтах
Забронировать это рекламное место


if(isNil "life_action_gathering") then {life_action_gathering = false;};
private["_gather","_itemWeight","_diff","_itemName","_val","_resourceZones","_zone","_bool","_time","_cpUp","_profName","_data","_cP","_ui"];
_resourceZones = ["apple_1","apple_2","apple_3","apple_4","cucumber_1","cucumber_2","cucumber_3","cucumber_4","peaches_1","peaches_2","peaches_3","peaches_4","heroin_1","cocaine_1","weed_1","crystal_1"];
_zone = "";
_bool = true;
if(visiblemap) exitwith {};
if(life_action_gathering) exitWith {}; //Action is in use, exit to prevent spamming.
life_action_gathering = true;


//Find out what zone we're near
{
    if(player distance (getMarkerPos _x) < 30) exitWith {_zone = _x;};
} foreach _resourceZones;


if(_zone == "") exitWith {life_action_gathering = false;};


//Get the resource that will be gathered from the zone name...
switch(true) do {
    case (_zone in ["apple_1","apple_2","apple_3","apple_4"]): {_gather = "apple"; _val = 3;};
    case (_zone in ["peaches_1","peaches_2","peaches_3","peaches_4"]): {_gather = "peach"; _val = 3;};
    case (_zone in ["cucumber_1","cucumber_2","cucumber_3","cucumber_4"]): {_gather = "cucumber"; _val = 3;};
    case (_zone in ["heroin_1"]): {_gather = "heroinu"; _val = 1;};
    case (_zone in ["cocaine_1"]): {_gather = "cocaine"; _val = 1;};
    case (_zone in ["weed_1"]): {_gather = "cannabis"; _val = 1;};
    case (_zone in ["crystal_1"]): {_gather = "methu"; _val = 1;};
    default {""};
};
//gather check??
if(vehicle player != player) exitWith {life_action_gathering = false;};
_itemName = [([_gather,0] call life_fnc_varHandle)] call life_fnc_varToStr;


_diff = [_gather,_val,life_carryWeight,life_maxWeight] call life_fnc_calWeightDiff;
if(_diff == 0) exitWith {hint localize "STR_NOTF_InvFull";life_action_gathering = false;};
life_action_inUse = true;


_upp = format["Добываю %1",_itemName];
//Setup our progress bar.
disableSerialization;
5 cutRsc ["life_progress","PLAIN"];
_ui = uiNameSpace getVariable "life_progress";
_progress = _ui displayCtrl 38201;
_pgText = _ui displayCtrl 38202;
_pgText ctrlSetText format["%2 (1%1)...","%",_upp];
_progress progressSetPosition 0.01;
_cP = 0;    
_time = 0.2;           
_cpUp = 0.02;
_profName = [_gather] call life_fnc_profType;
_data = missionNamespace getVariable (_profName);
if(_profName != "") then 
{
switch ( _data select 0 ) do
{
case 1: { _time = 0.2;};
case 2: { _time = 0.19;};
case 3: { _time = 0.18;};
case 4: { _time = 0.17;};
case 5: { _time = 0.16;};
case 6: { _time = 0.15;};
case 7: { _time = 0.14; };
case 8: { _time = 0.13;};
case 9: { _time = 0.12;};
case 10: { _time = 0.11;};
};
};
while{true} do
{
if(_bool) then {
                [] spawn {
                    _bool = false;
                    player playMoveNow "AinvPercMstpSnonWnonDnon_Putdown_AmovPercMstpSnonWnonDnon";
                    sleep 2.5;
                    _bool = true;
                };
            };
sleep _time;
_cP = _cP + _cpUp;
_progress progressSetPosition _cP;
_pgText ctrlSetText format["%3 (%1%2)...",round(_cP * 100),"%",_upp];
if(_cP >= 1) exitWith {}; 
if(visiblemap) exitwith {};
if(life_interrupted) exitwith {};
if(!alive player) exitWith {};
};
if(!alive player) exitWith {life_action_inUse = false;life_action_gathering = false;};
if(visiblemap) exitwith {life_action_inUse = false;life_action_gathering = false;_ui = "osefStatusBar" call BIS_fnc_rscLayer;_ui cutRsc["osefStatusBar","PLAIN"];};
player playActionNow "stop";
if(life_interrupted) exitwith {life_action_inUse = false;life_interrupted= false;life_action_gathering = false; titleText[localize "STR_NOTF_ActionCancel","PLAIN"];_ui = "osefStatusBar" call BIS_fnc_rscLayer;_ui cutRsc["osefStatusBar","PLAIN"];};




if(([true,_gather,_diff] call life_fnc_handleInv)) then {
titleText[format[localize "STR_NOTF_Gather_Success",_itemName,_diff],"PLAIN"];
if( _profName != "" ) then {
[_profName,round ((random 3)+7)] call life_fnc_addExp;
};
};


life_action_gathering = false;
life_action_inUse = false;
_ui = "osefStatusBar" call BIS_fnc_rscLayer;_ui cutRsc["osefStatusBar","PLA
 

 

IN"];
Изменено пользователем TheFirstNoob
AAAAA! Пользуйтесь кодом! -_- (история изменений)

Поделиться сообщением


Ссылка на сообщение
Поделиться на других сайтах

 

if(isNil "life_action_gathering") then {life_action_gathering = false;};
private["_gather","_itemWeight","_diff","_itemName","_val","_resourceZones","_zone","_bool","_time","_cpUp","_profName","_data","_cP","_ui"];
_resourceZones = ["apple_1","apple_2","apple_3","apple_4","cucumber_1","cucumber_2","cucumber_3","cucumber_4","peaches_1","peaches_2","peaches_3","peaches_4","heroin_1","cocaine_1","weed_1","crystal_1"];
_zone = "";
_bool = true;
if(visiblemap) exitwith {};
if(life_action_gathering) exitWith {}; //Action is in use, exit to prevent spamming.
life_action_gathering = true;


//Find out what zone we're near
{
    if(player distance (getMarkerPos _x) < 30) exitWith {_zone = _x;};
} foreach _resourceZones;


if(_zone == "") exitWith {life_action_gathering = false;};


//Get the resource that will be gathered from the zone name...
switch(true) do {
    case (_zone in ["apple_1","apple_2","apple_3","apple_4"]): {_gather = "apple"; _val = 3;};
    case (_zone in ["peaches_1","peaches_2","peaches_3","peaches_4"]): {_gather = "peach"; _val = 3;};
    case (_zone in ["cucumber_1","cucumber_2","cucumber_3","cucumber_4"]): {_gather = "cucumber"; _val = 3;};
    case (_zone in ["heroin_1"]): {_gather = "heroinu"; _val = 1;};
    case (_zone in ["cocaine_1"]): {_gather = "cocaine"; _val = 1;};
    case (_zone in ["weed_1"]): {_gather = "cannabis"; _val = 1;};
    case (_zone in ["crystal_1"]): {_gather = "methu"; _val = 1;};
    default {""};
};
//gather check??
if(vehicle player != player) exitWith {life_action_gathering = false;};
_itemName = [([_gather,0] call life_fnc_varHandle)] call life_fnc_varToStr;


_diff = [_gather,_val,life_carryWeight,life_maxWeight] call life_fnc_calWeightDiff;
if(_diff == 0) exitWith {hint localize "STR_NOTF_InvFull";life_action_gathering = false;};
life_action_inUse = true;


_upp = format["Добываю %1",_itemName];
//Setup our progress bar.
disableSerialization;
5 cutRsc ["life_progress","PLAIN"];
_ui = uiNameSpace getVariable "life_progress";
_progress = _ui displayCtrl 38201;
_pgText = _ui displayCtrl 38202;
_pgText ctrlSetText format["%2 (1%1)...","%",_upp];
_progress progressSetPosition 0.01;
_cP = 0;    
_time = 0.2;           
_cpUp = 0.02;
_profName = [_gather] call life_fnc_profType;
_data = missionNamespace getVariable (_profName);
if(_profName != "") then 
{
switch ( _data select 0 ) do
{
case 1: { _time = 0.2;};
case 2: { _time = 0.19;};
case 3: { _time = 0.18;};
case 4: { _time = 0.17;};
case 5: { _time = 0.16;};
case 6: { _time = 0.15;};
case 7: { _time = 0.14; };
case 8: { _time = 0.13;};
case 9: { _time = 0.12;};
case 10: { _time = 0.11;};
};
};
while{true} do
{
if(_bool) then {
                [] spawn {
                    _bool = false;
                    player playMoveNow "AinvPercMstpSnonWnonDnon_Putdown_AmovPercMstpSnonWnonDnon";
                    sleep 2.5;
                    _bool = true;
                };
            };
sleep _time;
_cP = _cP + _cpUp;
_progress progressSetPosition _cP;
_pgText ctrlSetText format["%3 (%1%2)...",round(_cP * 100),"%",_upp];
if(_cP >= 1) exitWith {}; 
if(visiblemap) exitwith {};
if(life_interrupted) exitwith {};
if(!alive player) exitWith {};
};
if(!alive player) exitWith {life_action_inUse = false;life_action_gathering = false;};
if(visiblemap) exitwith {life_action_inUse = false;life_action_gathering = false;_ui = "osefStatusBar" call BIS_fnc_rscLayer;_ui cutRsc["osefStatusBar","PLAIN"];};
player playActionNow "stop";
if(life_interrupted) exitwith {life_action_inUse = false;life_interrupted= false;life_action_gathering = false; titleText[localize "STR_NOTF_ActionCancel","PLAIN"];_ui = "osefStatusBar" call BIS_fnc_rscLayer;_ui cutRsc["osefStatusBar","PLAIN"];};




if(([true,_gather,_diff] call life_fnc_handleInv)) then {
titleText[format[localize "STR_NOTF_Gather_Success",_itemName,_diff],"PLAIN"];
if( _profName != "" ) then {
[_profName,round ((random 3)+7)] call life_fnc_addExp;
};
};


life_action_gathering = false;
life_action_inUse = false;
_ui = "osefStatusBar" call BIS_fnc_rscLayer;_ui cutRsc["osefStatusBar","PLA
 

 

IN"];

Попробуйте это, только резерв вашего файла сделайте. И да, в коде столько мусора что ппц.

if(isNil "life_action_gathering") then {life_action_gathering = false;};
private["_gather","_itemWeight","_diff","_itemName","_val","_resourceZones","_zone","_bool","_time","_cpUp","_profName","_data","_cP","_ui"];
_resourceZones = ["apple_1","apple_2","apple_3","apple_4","cucumber_1","cucumber_2","cucumber_3","cucumber_4","peaches_1","peaches_2","peaches_3","peaches_4","heroin_1","cocaine_1","weed_1","crystal_1"];
_zone = "";
_bool = true;
if(visiblemap) exitwith {};
if(life_action_gathering) exitWith {}; //Action is in use, exit to prevent spamming.
life_action_gathering = true;
life_interrupted = false; 
 
//Find out what zone we're near
{
    if(player distance (getMarkerPos _x) < 30) exitWith {_zone = _x;};
} foreach _resourceZones;
 
 
if(_zone == "") exitWith {life_action_gathering = false;};
 
 
//Get the resource that will be gathered from the zone name...
switch(true) do {
    case (_zone in ["apple_1","apple_2","apple_3","apple_4"]): {_gather = "apple"; _val = 3;};
    case (_zone in ["peaches_1","peaches_2","peaches_3","peaches_4"]): {_gather = "peach"; _val = 3;};
    case (_zone in ["cucumber_1","cucumber_2","cucumber_3","cucumber_4"]): {_gather = "cucumber"; _val = 3;};
    case (_zone in ["heroin_1"]): {_gather = "heroinu"; _val = 1;};
    case (_zone in ["cocaine_1"]): {_gather = "cocaine"; _val = 1;};
    case (_zone in ["weed_1"]): {_gather = "cannabis"; _val = 1;};
    case (_zone in ["crystal_1"]): {_gather = "methu"; _val = 1;};
    default {""};
};
//gather check??
if(vehicle player != player OR player getVariable "surrender") exitWith {};

_itemName = [([_gather,0] call life_fnc_varHandle)] call life_fnc_varToStr; 
_upp = format["Добываю %1",_itemName];
hint "Начните движение, чтобы остановить процесс добычи";


_diff = [_gather,_val,life_carryWeight,life_maxWeight] call life_fnc_calWeightDiff;
if(_diff == 0) exitWith {hint localize "STR_NOTF_InvFull";life_action_gathering = false;};
life_action_inUse = true;
//Setup our progress bar.
disableSerialization;
5 cutRsc ["life_progress","PLAIN"];
_ui = uiNameSpace getVariable "life_progress";
_progress = _ui displayCtrl 38201;
_pgText = _ui displayCtrl 38202;
_pgText ctrlSetText format["%2 (1%1)...","%",_upp];
_progress progressSetPosition 0.01;
_cP = 0;    
_time = 0.2;           
_cpUp = 0.02;
_profName = [_gather] call life_fnc_profType;
_data = missionNamespace getVariable (_profName);
if(_profName != "") then 
{
switch ( _data select 0 ) do
{
case 1: { _time = 0.2;};
case 2: { _time = 0.19;};
case 3: { _time = 0.18;};
case 4: { _time = 0.17;};
case 5: { _time = 0.16;};
case 6: { _time = 0.15;};
case 7: { _time = 0.14; };
case 8: { _time = 0.13;};
case 9: { _time = 0.12;};
case 10: { _time = 0.11;};
};
};
while{true} do
{
if(_bool) then {
                [] spawn {
                    _bool = false;
                    player playMoveNow "AinvPercMstpSnonWnonDnon_Putdown_AmovPercMstpSnonWnonDnon";
                    sleep 2.5;
                    _bool = true;
                };
            };
sleep _time;
_cP = _cP + _cpUp;
_progress progressSetPosition _cP;
_pgText ctrlSetText format["%3 (%1%2)...",round(_cP * 100),"%",_upp];
if(_cP >= 1) exitWith {}; 
if(visiblemap) exitwith {};
if(life_interrupted) exitwith {};
if(!alive player) exitWith {};
};

	if(_error) exitWith {titleText["Добыча прервана","PLAIN"];};
	if(([true,_gather,_diff] call life_fnc_handleInv)) then
	{
		_itemName = [([_gather,0] call life_fnc_varHandle)] call life_fnc_varToStr;
		titleText[format[localize "STR_NOTF_Gather_Success",_itemName,_diff],"PLAIN"];
	};
 
5 cutText ["","PLAIN"]; 
life_action_gathering = false;
life_action_inUse = false;

Поделиться сообщением


Ссылка на сообщение
Поделиться на других сайтах

Создайте аккаунт или войдите в него для комментирования

Вы должны быть пользователем, чтобы оставить комментарий

Создать аккаунт

Зарегистрируйтесь для получения аккаунта. Это просто!


Зарегистрировать аккаунт

Войти

Уже зарегистрированы? Войдите здесь.


Войти сейчас

  • Похожие публикации

    • Автор: Miduznya
      Как сделать стартовый лут на сервере???
    • Автор: BorizzK
      Дружбан ваяет тягач/грузовик и тп
      Он довольно большой и фургон/кузов загораживает обзор + ему надо было разглядеть подвеску в работе поподробней
      Те камеру надо было отодвинуть
      Поскольку бегемоты, то ли по глупости, то ли по скудоумию (скорее оба варианта ), в конфиге модели не предусмотрели таких параметров как
      дистанция камеры, углы ее наклона итд итп, а сделали это тупо в скрипте, пришлось моддидь.
       
      Вариант моддинга внешней (от 3го лица) камеры автомобильчика, как обычно через класс, но моддим конструктор (без override). Я не стал изобретать велосипед и поступил по "серверному"... Вроде получилось и все работает как надо. Зил кажет нормально, остальные то же.
       
      modded class DayZPlayerCamera3rdPersonVehicle extends DayZPlayerCameraBase { void DayZPlayerCamera3rdPersonVehicle (DayZPlayer pPlayer, HumanInputController pInput) { Print("CLIENT: КАМЕРА ДЛЯ ТОЧИЛЫ: ИГРОК: " + pPlayer.ToString() + ", ТОЧИЛА: " + pPlayer.GetCommand_Vehicle().GetTransport().GetType()); if (pPlayer.GetCommand_Vehicle().GetTransport().GetType() == "ZIL130") { m_fDistance = 8.0; //дистанция m_CameraOffsetMS = "0.0 1.3 0.0"; //стартовый наклон камеры Print("CLIENT: КАМЕРА ДЛЯ ТОЧИЛЫ: МОЯ КРУТАЯ ТОЧИЛА: ДИСТАНЦИЯ КАМЕРЫ: " + m_fDistance); return; } m_fDistance = 4.0; //стандартная дистанция m_CameraOffsetMS = "0.0 1.3 0.0"; //стартовый наклон камеры Print("CLIENT: КАМЕРА ДЛЯ ТОЧИЛЫ: СТАНДАРТНАЯ ТОЧИЛА: ДИСТАНЦИЯ КАМЕРЫ: " + m_fDistance); } }  
      Понятно что это для клиента (ну те для обычного мода) и на сервере бесполезно.
       
      Фото с тестового грузовика из АРМА 3 мод. свои он пока просил не показывать

      Пожалуйста, Войдите или Зарегистрируйтесь, чтобы увидеть это: Вложение.

      Пожалуйста, Войдите или Зарегистрируйтесь, чтобы увидеть это: Вложение.
    • Автор: BorizzK
      Как бы в цикле сделать задержку 3-5 сек между выводами сообщений в чат
      вывелось 2 строки
      задержка 3 сек
      вывелось еще 2 строки
      снова задержка
       
      Нужно для скана обьектов и вывода в чат обнаруженных
      int radius = cData.ToInt(); array<Object> nearest_objects = new array<Object>; array<CargoBase> proxy_cargos = new array<CargoBase>; Object object; string className; if (radius > 0 && radius <= 120) { GetGame().GetObjectsAtPosition(AdminPosition, radius, nearest_objects, proxy_cargos); for ( int chk = 0; chk < nearest_objects.Count(); chk++ ) { object = nearest_objects.Get(chk); className = object.GetType(); if (className) { string Msg1 = "Obj:" + chk + ":" + className; } else { Msg1 = "Obj:" + chk + ":" + object.ToString(); } string Msg2 = "Pos:" + chk + ":" + object.GetPosition().ToString(); Msgparam = new Param1<string>(Msg1); Msgparam1 = new Param1<string>(Msg2); GetGame().RPCSingleParam(playerAdmin, ERPCs.RPC_USER_ACTION_MESSAGE, Msgparam, true, playerAdmin.GetIdentity()); GetGame().RPCSingleParam(playerAdmin, ERPCs.RPC_USER_ACTION_MESSAGE, Msgparam1, true, playerAdmin.GetIdentity()); Print("::: AdminMod.c ::: /check ::: " + Msg1); Print("::: AdminMod.c ::: /check ::: " + Msg2); //Тут бы придумать задержку, что бы между выводом в чат инфо по каждому обьекту проходило 2-3 сек... //это не работает float wt0 = 0.00; while (wt0 < 36000 ) { wt0 = wt0 + 0.01; } } } если их много то слишком быстро выводятся (((
       
    • Автор: 123new
      В данной теме напишу простенький гайд о том, как самому на своем собственном сервере DayZ установить костомный (мой) скрипт на спавн, респавн и чистку транспорта.
       
      Гайд пригодится тем, кто сам делает свою сборку сервера, либо по каким-то причинам пользуется не моей сборкой сервера (где это уже сделано), а чьей-либо еще. Обращаю ваше внимание на тот факт, что часть файлов, описанных в гайде, у вас могут уже быть вынесены в другое место или названы несколько иначе (это зависит от сборки сервера, которую вы используете, например, в сборке dankdayz вся mpmissions вынесена в отдельный файл в addons сервера), гайд основывается на чистых серверных файлах игры и отталкивается от них.
      Гайд сделан для версий игры с серверной частью 0.60-0.62, но может быть совместим и с другими версиями игры, если файлы серверной части игры не поменяли своего текущего месторасположения и содержания. Гайд составлен по версии серверных файлов игры 0.62 чистой "девственной" и не правленой никем версии игры.
      Напоминаю заранее, в моих серверных файлах версий 0.60, 0.61 и 0.62 из моих гайдов на данном форуме это уже сделано и делать это не нужно!!!

      Нам понадобятся:
      1. Notepad++ https://notepad-plus-plus.org/download/
      2. Ваши серверные файлы игры
       
      И так, приступим.
      1. Первое, что нам понадобится - создать сам скрипт. Создаем по пути: "MPMissions\dayz_Auto.ChernarusPlus\"  папку "scripts" , в ней папку "custom"  , и в ней файл с именем "SpawnCars.sqf" . Если такие папки у вас уже имеются, просто не создавайте их, а перейдите в них. Если файл с там именем уже имеется у вас, задайте ему другое имя.
      2. Вписываем в созданный файл код следующего содержания (либо скачайте его):
      Пожалуйста, Войдите или Зарегистрируйтесь, чтобы увидеть это: Вложение.
      diag_log format [" SpawnCar: Reading Settings ..."]; /* Car Spawner for DayZ Standalone v 0.60.133.913 and high versions author: 123new Thanks for help: user BorizzK from s-platoon.ru for help and tests parts script and all community for this. Install: .\mpmissions\init.sqf Add in end file: init_spawn_cars = compile preprocessFileLineNumbers "scripts\custom\SpawnCars.sqf"; Call init_spawn_cars; and place this script file in: .\mpmissions\{your mission name}\scripts\custom\SpawnCars.sqf WARNING: add after string: dbInitEconomy CAUTION: When you are on the spawn cars in the game server with version 0.60 and higher (0.61 and 0.62 version it blocks events.xml) the transport can be re-spelled and re-spelled by the server itself, regardless of the script. For correct operation it is highly recommended to disable the official transport spawn! Info about script: This script will scan the server database for the specified transport types, push it to the server along with its parts in case of shortage, and clean the destroyed vehicles. A first massives - details for car (all details will be spawned) A second massives - possible spawn points of the technique (the spawn point will be selected randomly) A third (end) massive - configuration: specify the number of cars on writed type, a list of possible spawn points car for writed type and massive from first block with parts car. Settings format: A first massives: [count loot,type loot] A second massives: [(coordinate x),(coordinate y),(coordinate z)] A third (end) massive: [max count this type car, type car(classname) or massive types car for random select, selected second massive name, selected first massive name] If add after in 'A third (end) massive' 5 and more massives elements with details car, script will be select random details. */ // MAIN SETTINGS _enable_detect_old_ruined_cars = true; // Enable detect old ruined cars in server and delete him _enable_detect_old_cars_in_point_spawn_in_meters = true; // Enable detect old cars in point spawn in writed meters and secure him for spawn new car _meters_check_old_car_in_point_spawn = 10; // How many meters for chack old car in point spawn - wored only with _enable_detect_old_cars_in_point_spawn_in_meters = true - not recommend set up more 15 meters _check_damage_for_delete_ruined_car = 1; // How many damage for object car for delete him from server (for set up min 0.1 max 1) - wored only with _enable_detect_old_ruined_cars = true /////////////////////////// ---> A first massives <--- /////////////////////////// // (count this detail in vehicle),(type detail vehicle) _items_car_Volga = [ [4,"CivSedanWheel"], [1,"CivSedanDoors_Driver"], [1,"CivSedanDoors_CoDriver"], [1,"CivSedanDoors_BackLeft"], [1,"CivSedanDoors_BackRight"], [1,"CivSedanHood"], [1,"CivSedanTrunk"], [1,"CarRadiator"], [1,"CarBattery"], [1,"SparkPlug"], [2,"HeadlightH7"] ]; _items_car_Niva = [ [4,"HatchbackWheel"], [1,"HatchbackDoors_Driver"], [1,"HatchbackDoors_CoDriver"], [1,"HatchbackHood"], [1,"HatchbackTrunk"], [1,"CarRadiator"], [1,"CarBattery"], [1,"SparkPlug"], [1,"HeadlightH7"] ]; _items_car_Bus = [ [2,"TransitBusWheel"], [2,"TransitBusWheelDouble"], [1,"TruckBattery"], [1,"GlowPlug"], [1,"TruckRadiator"], [1,"LightBulb"], [1,"EngineBelt"] ]; _items_car_V3S = [ [4,"V3SWheel"], [4,"V3SWheelDouble"], [1,"V3SDoors_Driver"], [1,"V3SDoors_CoDriver"], [1,"V3SHood"], [1,"TruckBattery"], [2,"LightBulb"], [1,"EngineBelt"], [1,"HeadlightH7"] ]; _items_car_V3S_Blue = [ [4,"V3SWheel"], [4,"V3SWheelDouble"], [1,"V3SDoors_Driver_Blue"], [1,"V3SDoors_CoDriver_Blue"], [1,"V3SHood_Blue"], [1,"TruckBattery"], [2,"LightBulb"], [1,"EngineBelt"], [1,"HeadlightH7"] ]; _items_car_V3S_Grey = [ [4,"V3SWheel"], [4,"V3SWheelDouble"], [1,"V3SDoors_Driver_Grey"], [1,"V3SDoors_CoDriver_Grey"], [1,"V3SHood_Grey"], [1,"TruckBattery"], [2,"LightBulb"], [1,"EngineBelt"], [1,"HeadlightH7"] ]; _items_car_V3S_Orange = [ [4,"V3SWheel"], [4,"V3SWheelDouble"], [1,"V3SDoors_Driver_Orange"], [1,"V3SDoors_CoDriver_Orange"], [1,"V3SHood_Orange"], [1,"TruckBattery"], [2,"LightBulb"], [1,"EngineBelt"], [1,"HeadlightH7"] ]; /////////////////////////// ---> A second massives <--- /////////////////////////// // massives points spawn for vehicles _points_car_Volga = [ [10493.7,2348.17,0], [10150.7,1810.41,0], [11986.2,3839.67,0], [12883.2,6259.25,0], [12937.6,10185.7,0], [13845.8,13216.7,0], [4163.03,11104.75,0], [5954.25,10366.5,0], [3751.32,8858.37,0], [3048.92,7787.31,0], [2583.23,5073.8,0], [2654.09,5289.31,0] ]; _points_car_Niva = [ [13891.7,13425.6,0], [11262.4,12212.2,0], [4794.11,2539.87,0], [10740.4,10788.2,0], [10661.3,7994.43,0], [6063.77,7871.36,0], [4519.95,8291.32,0], [2182.85,3307.73,0], [3658.2,2194.58,0], [6855.9,2471.24,0], [6565.1,2547.52,0], [4262.06,11235,0], [6255.8,3256.48,0], [6682.32,3580.23,0], [13785.5,2930.17,0] ]; _points_car_Bus = [ [12275.8,9123.41,0], [11885.6,12469.2,0], [7185,7675.18,0], [4795.56,10250.1,0], [2716.53,10031.4,0], [2589.18,6355.03,0], [1672.24,3843.93,0], [1878.72,2254.03,0], [4334.19,2462.08,0], [5691.65,2579.14,0], [7805.4,3534.9,0], [12238.9,12635,0] ]; _points_car_V3S = [ [4767.29,9594.32,0], [13980.3,2931.02,0], [12238.9,12635,0], [12229.7,12590.2,0], [7216.52,7755.26,0], [3711.64,5969.98,0], [4392.4,10510.4,0], [1741.44,7930.12,0], [5590.24,2699.39,0] ]; /////////////////////////// ---> A third (end) massive <--- /////////////////////////// // (max count vehicles this type in server),(type vehicle or massive types for random select),(massive coords for spawn vehicle),(massive items for this car) // If add 5 and more massives elements with details car, script will be select random details. _types_car_V3S = ["V3S_Cargo_Orange","V3S_Cargo_Blue","V3S_Cargo_Grey","V3S_Cargo"]; /// massive types cars for random select _types_car_V3S_Chassis = ["V3S_Chassis_Orange","V3S_Chassis_Blue","V3S_Chassis_Grey","V3S_Chassis"]; /// massive types cars for random select _CarsSpawnConfig = [ [10,"CivilianSedan", _points_car_Volga, _items_car_Volga], [12,"TransitBus", _points_car_Bus, _items_car_Bus], [7,"OffroadHatchback", _points_car_Niva, _items_car_Niva], [4,_types_car_V3S, _points_car_V3S, _items_car_V3S,_items_car_V3S_Blue,_items_car_V3S_Grey,_items_car_V3S_Orange], [5,_types_car_V3S_Chassis, _points_car_V3S, _items_car_V3S,_items_car_V3S_Blue,_items_car_V3S_Grey,_items_car_V3S_Orange] ]; { if ((count _x) > 4) then { _rand = floor (random ((count _x) - 1)); while {(_rand < 4)} do { _rand = floor (random ((count _x) - 1)); }; _selected_items_car = _x select _rand; }; } foreach _CarsSpawnConfig; //////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////// ---> NEXT CODE DON'T EDIT <--- /////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////// diag_log format [" SpawnCar: Readed Settings! Start spawn car!"]; fnc_random_int_select = { private["_min","_max","_rand"]; _min = _this select 0; _max = _this select 1; _rand = round (random _max); if ((_rand < _min) or (_rand > _max)) then { while {(_rand < _min) or (_rand > _max)} do { _rand = round (random _max); }; }; _rand }; _massive_writed_alltypes_cars = []; _massive_writed_allcoords_cars = []; fnc_spawnCar = { _SelectedLine = _this; _selected_count_car = _this select 0; _selected_type_car = _this select 1; _selected_points_car = _this select 2; _selected_items_car = _this select 3; _count_incar_loot = 0; _count_aroundcar_loot = 0; _count_selected_type_car_in_server = 0; _count_selected_type_car_in_server = 0; if((typeName _selected_type_car) == "ARRAY") then { { _count_selected_type_car_in_server = _count_selected_type_car_in_server + (count (allMissionObjects _x)); } forEach _selected_type_car; diag_log format [" SpawnCar: %2 old cars of types '%1' has been detected on the server",_selected_type_car,_count_selected_type_car_in_server]; } else { _count_selected_type_car_in_server = count (allMissionObjects _selected_type_car); diag_log format [" SpawnCar: %2 old cars of type '%1' has been detected on the server",_selected_type_car,_count_selected_type_car_in_server]; }; if (_enable_detect_old_cars_in_point_spawn_in_meters) then { _temp_selected_points_car = _selected_points_car; { _selected_point_car = _x; { if (((typeOf _x) in _massive_writed_alltypes_cars) && (_selected_point_car in _massive_writed_allcoords_cars)) then { if (count _selected_points_car > 0) then { _selected_points_car = _selected_points_car - [_selected_point_car]; diag_log format [" SpawnCar: Detected previously spawned car in server: type '%1' at position %2 - point spawn %3 deleted from list spawn this type!",(typeOf _x),(getPos _x),_selected_point_car]; } else { diag_log format [" SpawnCar: Detected previously spawned car in server: type '%1' at position %2 - point spawn %3 can't be deleted from list spawn this type because spawnpoints this type allready <= 0!",(typeOf _x),(getPos _x),_selected_point_car]; }; }; } forEach (_selected_point_car nearObjects _meters_check_old_car_in_point_spawn); } forEach _temp_selected_points_car; }; if (_count_selected_type_car_in_server < _selected_count_car) then { _selected_count_car = _selected_count_car - _count_selected_type_car_in_server; if((typeName _selected_type_car) == "ARRAY") then { diag_log format [" SpawnCar: Required spawn %2 cars of type list '%1'",_selected_type_car,_selected_count_car]; } else { diag_log format [" SpawnCar: Required spawn %2 cars of type '%1'",_selected_type_car,_selected_count_car]; }; if (count _selected_points_car > 0) then { for "_j" from 1 to _selected_count_car do { _car_in_server = NULL; if (count _selected_points_car > 0) then { _selected_type_car_for_spawn = ""; if((typeName _selected_type_car) == "ARRAY") then { _selected_type_car_for_spawn = _selected_type_car select ([0,(count _selected_type_car)-1] call fnc_random_int_select); } else { _selected_type_car_for_spawn = _selected_type_car; }; if ((count _SelectedLine) > 4) then { _selected_items_car = _SelectedLine select ([3,(count _SelectedLine)-1] call fnc_random_int_select); diag_log format [" SpawnCar: Selected for next car massive details: %1 ",_selected_items_car]; }; _selected_point_car = _selected_points_car select ([0,(count _selected_points_car)-1] call fnc_random_int_select); _car_in_server = createvehicle [_selected_type_car_for_spawn, _selected_point_car, [], 0, "CAN_COLLIDE"]; if !(isNull _car_in_server) then { _selected_points_car = _selected_points_car - [_selected_point_car]; _car_in_server setDir floor(random 360); _selected_name_car = (displayName _car_in_server); _originalPos = getPosATL _car_in_server; _Damage = random 0.7; _map_pos_car = mapGridPosition _car_in_server; { _count_sel_loot = _x select 0; _type_sel_loot = _x select 1; for [{_i = 0}, {_i < _count_sel_loot}, {_i = _i + 1}] do { _loot_car = NULL; _loot_car = _car_in_server createInInventory _type_sel_loot; if (isNull _loot_car) then { _loot_car = createvehicle [_type_sel_loot, _originalPos, [], 5, "CAN_COLLIDE"]; if ((floor(random 4)) >= 2) then { _Damage_loot = random 0.7; _loot_car setDamage _Damage_loot; }; _count_aroundcar_loot = _count_aroundcar_loot + 1; } else { _count_incar_loot = _count_incar_loot + 1; }; }; } foreach _selected_items_car; diag_log format [" SpawnCar: Spawned %1 in %2 with %3 loot in Car and %4 loot around car ",_selected_name_car,_map_pos_car,_count_incar_loot,_count_aroundcar_loot]; } else { diag_log format [" SpawnCar: Type car '%1' is not spawned in server, because when i try spawn car in point '%2' exist errors!",_selected_type_car_for_spawn,_selected_point_car]; }; } else { if((typeName _selected_type_car) == "ARRAY") then { diag_log format [" SpawnCar: Random type car from array '%1' is not can be spawned in server, because setuped count cars this types > possible count points spawn this type!",_selected_type_car]; } else { diag_log format [" SpawnCar: Type car '%1' is not can be spawned in server, because setuped count cars this type > possible count points spawn this type!",_selected_type_car]; }; }; }; } else { if((typeName _selected_type_car) == "ARRAY") then { diag_log format [" SpawnCar: Spawn car from type list '%1' is not possible because not have possible points to spawn.",_selected_type_car]; } else { diag_log format [" SpawnCar: Spawn car type(s) '%1' is not possible because not have possible points to spawn.",_selected_type_car]; }; }; } else { if((typeName _selected_type_car) == "ARRAY") then { diag_log format [" SpawnCar: Random type car from array '%1' is not need spawn in server, because cars this types allready is max (or more max) in server!",_selected_type_car]; } else { diag_log format [" SpawnCar: Type car '%1' is not need spawn in server, because this cars allready is max (or more max) in server!",_selected_type_car]; }; }; }; if (_enable_detect_old_ruined_cars) then { _deleted_ruined_Cars = 0; { if (damage _x == _check_damage_for_delete_ruined_car) then { deleteVehicle _x; _deleted_ruined_Cars = _deleted_ruined_Cars + 1; }; } forEach (allMissionObjects "Car"); if (_deleted_ruined_Cars > 0) then { diag_log format [" SpawnCar: Deleted %1 old ruined cars from server",_deleted_ruined_Cars]; }; }; if (_enable_detect_old_cars_in_point_spawn_in_meters) then { { if((typeName(_x select 1)) == "ARRAY") then { { if (!(_x in _massive_writed_alltypes_cars)) then { _massive_writed_alltypes_cars = _massive_writed_alltypes_cars + [_x]; }; } foreach (_x select 1); } else { if (!((_x select 1) in _massive_writed_alltypes_cars)) then { _massive_writed_alltypes_cars = _massive_writed_alltypes_cars + [(_x select 1)]; }; }; { if (!(_x in _massive_writed_allcoords_cars)) then { _massive_writed_allcoords_cars = _massive_writed_allcoords_cars + [_x]; }; } foreach (_x select 2); } foreach _CarsSpawnConfig; }; { _x call fnc_spawnCar; } foreach _CarsSpawnConfig; 3. Создаем по пути: "MPMissions\dayz_Auto.ChernarusPlus\"  папку "scripts" , и в ней файл с именем "compiles.sqf" . Если такая папка у вас уже имеются, просто не создавайте ее,  а перейдите в нее. Если файл с там именем уже имеется у вас, то не создавайте его, а допишите информацию со следующего пункта инструкции в конец файла!
      4. Вставляем в файл следующую строку:
      init_spawn_cars = compile preprocessFileLineNumbers "scripts\custom\SpawnCars.sqf"; 5. Открываем по указанному далее пути файл в "Notepad++": "MPMissions\dayz_Auto.ChernarusPlus\init.sqf". Находим в файле строки с
      call compile preprocessFileLineNumbers 5. Вставляем после всех "call compile preprocessFileLineNumbers" следующее:
      call compile preprocessFileLineNumbers "scripts\compiles.sqf"; _Enable_SPAWNER_CARS = true; // Кастомный скрипт спавна транспорта (true - включить, false - выключить) 6. В этом же файле находим строки:
      simulWeatherSync; dbInitEconomy [true]; setTimeForScripts 0.03; 7. Добавляем после них:
      if (_Enable_SPAWNER_CARS) then { Call init_spawn_cars; }; Вот и все.
       
      ВАЖНО:
      Перед активацией скрипта отключите официальный спавнер транспорта сервера из официальной системы сервера игры. Инструкция есть тут:
       
      Как вы уже догадались, этой строкой мы можем включить или отключить сам кастомный скрипт без долгого копания в коде.
      _Enable_SPAWNER_CARS = false; // Кастомный скрипт спавна транспорта (true - включить, false - выключить) Все настройки по спавну транспорта есть в самом файле скрипта, который в п. 2 инструкции вы и создавали. Надеюсь, сложности с его настройкой не возникнет, пояснения там имеются.
    • Автор: JEKA666
      Кто нибудь знает как настроить( Х ) НА  лут в лучах и рыбалку какие команды прописывать? Хочется чтоб они приносили что-то нужное и полезное или только модом.