Jump to content
  • 0

Disable Random Vehicle Spawn


onetwothree

Question

I tried to disable the random Vehicle Spawn by just setting

allowedVehiclesList[] = {};

it works

, but if I do this also cant spawn any vehicles on other ways like adminmenu from antihack.

 

So is there any way to disable the random spawns and set the vehicle limit separately?

I also need the vehicles spawned by scripts and adminmenu to be saved.

 

I'm a beginner in ArmA scripting and tried to search for solutions already in ArmA 3 scripting section, sorry if this is duplicate or anything.

 

EDIT:

skaronator antihack uses

_permVehicleSpawner = {
    _item = _this;
    _return = false;
    if (_item isKindOf 'Air' || _item isKindOf 'Ship' || _item isKindOf 'LandVehicle') then{
        if !(EPOCH_VehicleSlots isEqualTo[]) then{
            _position = getPosATL _target;
            _slot = EPOCH_VehicleSlots select 0;
            EPOCH_VehicleSlots = EPOCH_VehicleSlots - [_slot];
            EPOCH_VehicleSlotCount = count EPOCH_VehicleSlots;
            publicVariable 'EPOCH_VehicleSlotCount';
            _vehObj = createVehicle[_item, _position, [], 20, 'NONE'];
            _return = true;
            _vehObj call EPOCH_server_setVToken;
            addToRemainsCollector[_vehObj];
            _vehObj disableTIEquipment true;
            clearWeaponCargoGlobal    _vehObj;
            clearMagazineCargoGlobal  _vehObj;
            clearBackpackCargoGlobal  _vehObj;
            clearItemCargoGlobal  _vehObj;
            _vehObj lock true;
            _plyrUID = getPlayerUID _target;
            _plyrGroup = _target getVariable['GROUP', ''];
            _lockOwner = _plyrUID;
            if (_plyrGroup != '') then{
                _lockOwner = _plyrGroup;
            };
            _vehObj setVariable['LOCK_OWNER', _lockOwner];
            _vehObj setVariable['LOCKED_TILL', serverTime + 1800];
            _config = (configFile >> 'CfgVehicles' >> _item >> 'availableColors');
            if (isArray(_config)) then{
                _textureSelectionIndex = configFile >> 'CfgVehicles' >> _item >> 'textureSelectionIndex';
                _selections = if (isArray(_textureSelectionIndex)) then{getArray(_textureSelectionIndex)} else {[0]};
                _colors = getArray(_config);
                _textures = _colors select 0;
                _color = floor(random(count _textures));
                _count = (count _colors) - 1;
                {
                    if (_count >= _forEachIndex) then{
                        _textures = _colors select _forEachIndex;
                    };
                    _vehObj setObjectTextureGlobal[_x, (_textures select _color)];
                } forEach _selections;
                _vehObj setVariable['VEHICLE_TEXTURE', _color];
            };
            _vehObj setVariable['VEHICLE_SLOT', _slot, true];
            _vehObj call EPOCH_server_save_vehicle;
            _vehObj call EPOCH_server_vehicleInit;
        } else {
            diag_log 'ADMIN: Unable to spawn vehicle, no slots available';
        };
    };
    _return
};

but somehow it doesnt throw me the

 

'ADMIN: Unable to spawn vehicle, no slots available'

error in .rpt file

 

so could I use the script just without the vehicleslot is empty check to create vehicles which are being saved?

Link to comment
Share on other sites

1 answer to this question

Recommended Posts

  • 0

I tryed to use

_permVehicleSpawner = {
	_item = _this;
	_return = false;
	if (_item isKindOf 'Air' || _item isKindOf 'Ship' || _item isKindOf 'LandVehicle') then{
			_position = getPosATL _target;
			_vehObj = createVehicle[_item, _position, [], 20, 'NONE'];
			_return = true;
			_vehObj call EPOCH_server_setVToken;
			addToRemainsCollector[_vehObj];
			_vehObj disableTIEquipment true;
			clearWeaponCargoGlobal    _vehObj;
			clearMagazineCargoGlobal  _vehObj;
			clearBackpackCargoGlobal  _vehObj;
			clearItemCargoGlobal  _vehObj;
			_vehObj lock true;
			_plyrUID = getPlayerUID _target;
			_plyrGroup = _target getVariable['GROUP', ''];
			_lockOwner = _plyrUID;
			if (_plyrGroup != '') then{
				_lockOwner = _plyrGroup;
			};
			_vehObj setVariable['LOCK_OWNER', _lockOwner];
			_vehObj setVariable['LOCKED_TILL', serverTime + 1800];
			_config = (configFile >> 'CfgVehicles' >> _item >> 'availableColors');
			if (isArray(_config)) then{
				_textureSelectionIndex = configFile >> 'CfgVehicles' >> _item >> 'textureSelectionIndex';
				_selections = if (isArray(_textureSelectionIndex)) then{getArray(_textureSelectionIndex)} else {[0]};
				_colors = getArray(_config);
				_textures = _colors select 0;
				_color = floor(random(count _textures));
				_count = (count _colors) - 1;
				{
					if (_count >= _forEachIndex) then{
						_textures = _colors select _forEachIndex;
					};
					_vehObj setObjectTextureGlobal[_x, (_textures select _color)];
				} forEach _selections;
				_vehObj setVariable['VEHICLE_TEXTURE', _color];
			};
			_vehObj setVariable['VEHICLE_SLOT', 0, true];
			_vehObj call EPOCH_server_save_vehicle;
			_vehObj call EPOCH_server_vehicleInit;
	};
	_return
};
"ebike_epoch" call _permVehicleSpawner;

now, but it doesn't seem to work the vehicle is not spawned at all.

 

I also don't know how to debug scripts correctly, is there a way to create output into server console?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement
  • Discord

×
×
  • Create New...