Last active
August 29, 2015 14:09
-
-
Save IvanMMM/615a01088137c7c2b698 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
==Install== | |
Location ot the files: | |
1. \client\lockSystem\vehicle_lock.sqf | |
2. \client\lockSystem\vehicle_unlock.sqf | |
3. \client\functions\canVehicleLock.sqf | |
4. \client\functions\canVehicleUnlock.sqf | |
5. \client\functions\playerActions.sqf | |
6. \persistence\world\vLoad.sqf | |
7. \persistence\world\oSave.sqf | |
8. \globalCompile.sqf | |
==Features== | |
It allows to lock/unlock vehicles if matches these conditions: | |
* Player CAN unlock sameside locked vehicles if side is OPFOR/BLUFOR. | |
* Player always CAN unlock vehicle he locked. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ****************************************************************************************** | |
// * This project is licensed under the GNU Affero GPL v3. Copyright © 2014 A3Wasteland.com * | |
// ****************************************************************************************** | |
// @file Name: canVehicleLock.sqf | |
// @file Author: BadVolt | |
private ["_target"]; | |
_target = _this select 0; | |
if ({ _target isKindOf _x } count ['Air','Tank','Motorcycle','Car','Ship'] > 0) then | |
{ | |
!isNull _target && (alive _target) && | |
!((locked _target)==2) && (count crew _target == 0) && | |
!(_target getVariable ['R3F_LOG_disabled', false]) && | |
(player distance _target) < 5; | |
}else{ | |
false; | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ****************************************************************************************** | |
// * This project is licensed under the GNU Affero GPL v3. Copyright © 2014 A3Wasteland.com * | |
// ****************************************************************************************** | |
// @file Name: canVehicleUnlock.sqf | |
// @file Author: BadVolt | |
private ["_target","_side","_owner","_playerUID","_strToSide"]; | |
_target = _this select 0; | |
_side = _target getVariable ["R3F_Side",""]; | |
_owner = _target getVariable ["ownerUID","0"]; | |
_strToSide = | |
{ | |
switch (toUpper _this) do | |
{ | |
case "WEST": { BLUFOR }; | |
case "EAST": { OPFOR }; | |
case "GUER": { INDEPENDENT }; | |
case "CIV": { CIVILIAN }; | |
case "LOGIC": { sideLogic }; | |
default { sideUnknown }; | |
}; | |
}; | |
if (typeName _side != "SIDE") then { | |
_side = _side call _strToSide; | |
}; | |
if ({ _target isKindOf _x } count ['Air','Tank','Motorcycle','Car','Ship'] > 0) then | |
{ | |
!isNull _target | |
&& (alive _target) | |
&& (locked _target==2) | |
&& ((player distance _target) < 5) | |
&& (((_side == playerSide) && (_side in [EAST,WEST])) || (_owner == getPlayerUID player)); | |
}else{ | |
false | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ****************************************************************************************** | |
// * This project is licensed under the GNU Affero GPL v3. Copyright © 2014 A3Wasteland.com * | |
// ****************************************************************************************** | |
// @file Name: clientCompile.sqf | |
// @file Author: [404] Deadbeat, [404] Costlyy, [GoT] JoSchaap, MercyfulFate, AgentRev | |
// @file Args: | |
mf_notify_client = "client\functions\notifyClient.sqf" call mf_compile; | |
mf_util_playUntil = "client\functions\playUntil.sqf" call mf_compile; | |
// Event handlers | |
getInVehicle = "client\clientEvents\getInVehicle.sqf" call mf_compile; | |
getOutVehicle = "client\clientEvents\getOutVehicle.sqf" call mf_compile; | |
onRespawn = "client\clientEvents\onRespawn.sqf" call mf_compile; | |
onKilled = "client\clientEvents\onKilled.sqf" call mf_compile; | |
onKeyPress = "client\clientEvents\onKeyPress.sqf" call mf_compile; | |
onKeyRelease = "client\clientEvents\onKeyRelease.sqf" call mf_compile; | |
onPut = "client\clientEvents\onPut.sqf" call mf_compile; | |
// Functions | |
A3W_fnc_copilotTakeControl = "client\functions\copilotTakeControl.sqf" call mf_compile; | |
A3W_fnc_titleTextMessage = "client\functions\titleTextMessage.sqf" call mf_compile; | |
addWeaponInventory = "client\functions\addWeaponInventory.sqf" call mf_compile; | |
canPushPlaneBack = "client\functions\canPushPlaneBack.sqf" call mf_compile; | |
canPushVehicleOnFoot = "client\functions\canPushVehicleOnFoot.sqf" call mf_compile; | |
canPushWatercraft = "client\functions\canPushWatercraft.sqf" call mf_compile; | |
canVehicleLock = "client\functions\canVehicleLock.sqf" call mf_compile; | |
canVehicleUnlock = "client\functions\canVehicleUnlock.sqf" call mf_compile; | |
deleteEmptyGroup = "client\functions\deleteEmptyGroup.sqf" call mf_compile; | |
findHackedVehicles = "client\systems\adminPanel\findHackedVehicles.sqf" call mf_compile; | |
fn_addManagedAction = "client\functions\fn_addManagedAction.sqf" call mf_compile; | |
fn_disableCollision = "client\functions\fn_disableCollision.sqf" call mf_compile; | |
fn_encodeText = "client\functions\fn_encodeText.sqf" call mf_compile; | |
fn_fitsInventory = "client\functions\fn_fitsInventory.sqf" call mf_compile; | |
fn_formatTimer = "client\functions\fn_formatTimer.sqf" call mf_compile; | |
fn_removeAllManagedActions = "client\functions\fn_removeAllManagedActions.sqf" call mf_compile; | |
fn_removeManagedAction = "client\functions\fn_removeManagedAction.sqf" call mf_compile; | |
getDefaultClothing = "client\functions\getDefaultClothing.sqf" call mf_compile; | |
getFullMove = "client\functions\getFullMove.sqf" call mf_compile; | |
getMoveParams = "client\functions\getMoveParams.sqf" call mf_compile; | |
getPushPlaneAction = "client\functions\getPushPlaneAction.sqf" call mf_compile; | |
groupNotify = "client\functions\groupNotify.sqf" call mf_compile; | |
isAdmin = "client\systems\adminPanel\isAdmin.sqf" call mf_compile; | |
isAssignableBinocular = "client\functions\isAssignableBinocular.sqf" call mf_compile; | |
isPVarTarget = "client\functions\isPVarTarget.sqf" call mf_compile; | |
isWeaponType = "client\functions\isWeaponType.sqf" call mf_compile; | |
parseMove = "client\functions\parseMove.sqf" call mf_compile; | |
playerEventServer = "client\functions\playerEventServer.sqf" call mf_compile; | |
serverMessage = "client\functions\serverMessage.sqf" call mf_compile; | |
uniformConverter = "client\functions\uniformConverter.sqf" call mf_compile; | |
unitHandleDamage = "client\functions\unitHandleDamage.sqf" call mf_compile; | |
updateTerritoryMarkers = "territory\client\updateTerritoryMarkers.sqf" call mf_compile; | |
vehicleSideCfg = "client\functions\vehicleSideCfg.sqf" call mf_compile; | |
// Player details and actions | |
loadPlayerMenu = "client\systems\playerMenu\init.sqf" call mf_compile; | |
playerSpawn = "client\functions\playerSpawn.sqf" call mf_compile; | |
playerSetup = "client\functions\playerSetup.sqf" call mf_compile; | |
playerSetupStart = "client\functions\playerSetupStart.sqf" call mf_compile; | |
playerSetupGear = "client\functions\playerSetupGear.sqf" call mf_compile; | |
playerSetupEnd = "client\functions\playerSetupEnd.sqf" call mf_compile; | |
spawnAction = "client\functions\spawnAction.sqf" call mf_compile; | |
spawnInTown = "client\functions\spawnInTown.sqf" call mf_compile; | |
spawnOnBeacon = "client\functions\spawnOnBeacon.sqf" call mf_compile; | |
spawnRandom = "client\functions\spawnRandom.sqf" call mf_compile; | |
// placeSpawnBeacon = "client\systems\playerMenu\placeSpawnBeacon.sqf" call mf_compile; | |
// refuelVehicle = "client\systems\playerMenu\refuel.sqf" call mf_compile; | |
// repairVehicle = "client\systems\playerMenu\repair.sqf" call mf_compile; | |
// Sync client with server time | |
timeSync = "client\functions\clientTimeSync.sqf" call mf_compile; | |
// Update scripts | |
updateTeamKiller = "client\functions\updateTeamKiller.sqf" call mf_compile; | |
// Team-kill system | |
teamkillAction = "client\functions\doTeamKillAction.sqf" call mf_compile; | |
teamkillMessage = "client\functions\showTeamKillMessage.sqf" call mf_compile; | |
// Dialog compiles | |
client_respawnDialog = "client\systems\playerMenu\dialog\loadRespawnDialog.sqf" call mf_compile; | |
fn_respawnTimer = "client\systems\scoreboard\fn_respawnTimer.sqf" call mf_compile; | |
loadGeneralStore = "client\systems\generalStore\loadGenStore.sqf" call mf_compile; | |
loadGunStore = "client\systems\gunStore\loadGunStore.sqf" call mf_compile; | |
loadScoreboard = "client\systems\scoreboard\loadScoreboard.sqf" call mf_compile; | |
gearProperties = "client\functions\gearProperties.sqf" call mf_compile; | |
getCapacity = "client\functions\getCapacity.sqf" call mf_compile; | |
getItemInfo = "client\functions\getItemInfo.sqf" call mf_compile; | |
getSellPriceList = "client\systems\selling\getSellPriceList.sqf" call mf_compile; | |
requestStoreObject = "client\functions\requestStoreObject.sqf" call mf_compile; | |
if (isNil "A3W_fnc_MP") then { A3W_fnc_MP = compile preprocessFileLineNumbers "\A3\functions_f\MP\fn_MP.sqf" }; | |
if (isNil "A3W_fnc_MPexec") then { A3W_fnc_MPexec = compile preprocessFileLineNumbers "\A3\functions_f\MP\fn_MPexec.sqf" }; | |
player groupChat "Wasteland - Client Compile Complete"; | |
sleep 1; | |
playerCompiledScripts = true; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ****************************************************************************************** | |
// * This project is licensed under the GNU Affero GPL v3. Copyright © 2014 A3Wasteland.com * | |
// ****************************************************************************************** | |
// @file Version: 1.0 | |
// @file Name: globalCompile.sqf | |
// @file Author: AgentRev, MercyfulFate | |
// @file Created: 07/09/2013 15:06 | |
// The purpose of this script is to compile certain functions both on client and server. | |
private ["_DEBUG", "_clientFunc", "_serverFunc"]; | |
_DEBUG = format ["%1", _this select 0]; | |
// Compile a function from a file. | |
// if in debug mode, the function will be dyncamically compiled every call. | |
// if not in debug mode, the function will be compileFinal'd | |
// example: my_fnc_name = ["path/to/folder", "my_fnc.sqf"] call mf_compile; | |
// example: my_fnc_name = ["path/to/folder/my_fnc.sqf"] call mf_compile; | |
// later in the code you can simply use call my_fnc_name; | |
// you can also pass raw code to get it compileFinal'd | |
// example: my_fnc_name = {diag_log "hey"} call mf_compile; | |
mf_compile = compileFinal | |
(' | |
private ["_path", "_isDebug", "_code"]; | |
_path = ""; | |
_isDebug = ' + _DEBUG + '; | |
switch (toUpper typeName _this) do { | |
case "STRING": { | |
_path = _this; | |
}; | |
case "ARRAY": { | |
_path = format["%1\%2", _this select 0, _this select 1]; | |
}; | |
case "CODE": { | |
_code = toArray str _this; | |
_code set [0, (toArray " ") select 0]; | |
_code set [count _code - 1, (toArray " ") select 0]; | |
}; | |
}; | |
if (isNil "_code") then { | |
if (_isDebug) then { | |
compile format ["call compile preProcessFileLineNumbers ""%1""", _path] | |
} else { | |
compileFinal preProcessFileLineNumbers _path | |
}; | |
} else { | |
if (_isDebug) then { | |
compile toString _code | |
} else { | |
compileFinal toString _code | |
}; | |
}; | |
'); | |
// Simple command I use to make initialization scripts clean and simple. | |
// uses mf_ namespace to avoid any issues. | |
mf_init = | |
{ | |
private "_path"; | |
_path = if (typeName _this == "STRING") then { | |
_this | |
} else { | |
format ["%1\%2", _this select 0, _this select 1] | |
}; | |
_path call compile preProcessFileLineNumbers format ["%1\init.sqf", _path]; | |
} call mf_compile; | |
_clientFunc = "client\functions"; | |
_serverFunc = "server\functions"; | |
A3W_fnc_pushVehicle = [_serverFunc, "pushVehicle.sqf"] call mf_compile; | |
A3W_fnc_setName = [_clientFunc, "fn_setName.sqf"] call mf_compile; | |
A3W_fnc_towingHelper = [_serverFunc, "towingHelper.sqf"] call mf_compile; | |
A3W_fnc_setLockState = { (objectFromNetId (_this select 0)) lock (_this select 1) } call mf_compile; | |
allPlayers = [_serverFunc, "allPlayers.sqf"] call mf_compile; | |
applyVehicleTexture = "client\systems\vehicleStore\applyVehicleTexture.sqf" call mf_compile; | |
cargoToPairs = [_serverFunc, "cargoToPairs.sqf"] call mf_compile; | |
detachTowedObject = [_serverFunc, "detachTowedObject.sqf"] call mf_compile; | |
findSafePos = [_serverFunc, "findSafePos.sqf"] call mf_compile; | |
fn_addScore = [_serverFunc, "fn_addScore.sqf"] call mf_compile; | |
fn_addToPairs = [_serverFunc, "fn_addToPairs.sqf"] call mf_compile; | |
fn_boundingBoxReal = [_serverFunc, "fn_boundingBoxReal.sqf"] call mf_compile; | |
fn_enableSimulationGlobal = [_serverFunc, "fn_enableSimulationGlobal.sqf"] call mf_compile; | |
fn_filterString = [_serverFunc, "fn_filterString.sqf"] call mf_compile; | |
fn_findString = [_serverFunc, "fn_findString.sqf"] call mf_compile; | |
fn_forceAddItem = [_clientFunc, "fn_forceAddItem.sqf"] call mf_compile; | |
fn_getFromPairs = [_serverFunc, "fn_getFromPairs.sqf"] call mf_compile; | |
fn_getPos3D = [_serverFunc, "fn_getPos3D.sqf"] call mf_compile; | |
fn_getScore = [_serverFunc, "fn_getScore.sqf"] call mf_compile; | |
fn_getTeamScore = [_serverFunc, "fn_getTeamScore.sqf"] call mf_compile; | |
fn_numbersText = [_serverFunc, "fn_numbersText.sqf"] call mf_compile; | |
fn_numToStr = [_serverFunc, "fn_numToStr.sqf"] call mf_compile; | |
fn_removeFromPairs = [_serverFunc, "fn_removeFromPairs.sqf"] call mf_compile; | |
fn_setToPairs = [_serverFunc, "fn_setToPairs.sqf"] call mf_compile; | |
fn_splitString = [_serverFunc, "fn_splitString.sqf"] call mf_compile; | |
fn_startsWith = [_serverFunc, "fn_startsWith.sqf"] call mf_compile; | |
//fn_vehicleInit = [_serverFunc, "fn_vehicleInit.sqf"] call mf_compile; | |
getBallMagazine = [_serverFunc, "getBallMagazine.sqf"] call mf_compile; | |
getFwdVelocity = [_serverFunc, "getFwdVelocity.sqf"] call mf_compile; | |
getHitPoints = [_serverFunc, "getHitPoints.sqf"] call mf_compile; | |
getMagAmmoCount = [_serverFunc, "getMagAmmoCount.sqf"] call mf_compile; | |
getMoveWeapon = [_clientFunc, "getMoveWeapon.sqf"] call mf_compile; | |
getPublicVar = [_serverFunc, "getPublicVar.sqf"] call mf_compile; | |
getTeamMarkerColor = "territory\client\getTeamMarkerColor.sqf" call mf_compile; | |
isConfigOn = [_serverFunc, "isConfigOn.sqf"] call mf_compile; | |
relativePos = [_serverFunc, "relativePos.sqf"] call mf_compile; | |
removeNegativeScore = [_serverFunc, "removeNegativeScore.sqf"] call mf_compile; | |
splitWeaponItems = [_serverFunc, "splitWeaponItems.sqf"] call mf_compile; | |
switchMoveGlobal = [_clientFunc, "switchMoveGlobal.sqf"] call mf_compile; | |
vehicleDammagedEvent = [_serverFunc, "vehicleDammagedEvent.sqf"] call mf_compile; | |
vehicleEngineEvent = [_serverFunc, "vehicleEngineEvent.sqf"] call mf_compile; | |
vehicleHandleDamage = [_serverFunc, "vehicleHandleDamage.sqf"] call mf_compile; | |
"pvar_switchMoveGlobal" addPublicVariableEventHandler { ((_this select 1) select 0) switchMove ((_this select 1) select 1) }; | |
"pvar_detachTowedObject" addPublicVariableEventHandler { (_this select 1) spawn detachTowedObject }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ****************************************************************************************** | |
// * This project is licensed under the GNU Affero GPL v3. Copyright © 2014 A3Wasteland.com * | |
// ****************************************************************************************** | |
// @file Version: 1.2 | |
// @file Name: oSave.sqf | |
// @file Author: [GoT] JoSchaap, AgentRev | |
// @file Description: Basesaving save script | |
if (!isServer) exitWith {}; | |
#include "functions.sqf" | |
_saveableObjects = []; | |
_isSaveable = | |
{ | |
_result = false; | |
{ if (_this == _x) exitWith { _result = true } } forEach _saveableObjects; | |
_result | |
}; | |
// Add objectList & general store objects | |
{ | |
_index = _forEachIndex; | |
{ | |
_obj = _x; | |
if (_index > 0) then { _obj = _x select 1 }; | |
if (!(_obj isKindOf "ReammoBox_F") && {!(_obj call _isSaveable)}) then | |
{ | |
_saveableObjects pushBack _obj; | |
}; | |
} forEach _x; | |
} forEach [objectList, call genObjectsArray]; | |
// If file doesn't exist, create Info section at the top | |
if !(_fileName call PDB_exists) then // iniDB_exists | |
{ | |
[_fileName, "Info", "ObjCount", 0] call PDB_write; // iniDB_write | |
}; | |
_savingMethod = ["A3W_savingMethod", 1] call getPublicVar; | |
_purchasedVehicleSaving = ["A3W_purchasedVehicleSaving"] call isConfigOn; | |
_missionVehicleSaving = ["A3W_missionVehicleSaving"] call isConfigOn; | |
_vehicleSaving = (_purchasedVehicleSaving || _missionVehicleSaving); | |
_vehFileName = "Vehicles" call PDB_objectFileName; | |
// If file doesn't exist, create Info section at the top | |
if (_vehicleSaving && !(_vehFileName call PDB_exists)) then // iniDB_exists | |
{ | |
[_vehFileName, "Info", "VehCount", 0] call PDB_write; // iniDB_write | |
}; | |
while {true} do | |
{ | |
uiSleep 30; | |
_oldObjCount = [_fileName, "Info", "ObjCount", "NUMBER"] call PDB_read; // iniDB_read | |
_objCount = 0; | |
{ | |
_obj = _x; | |
if (alive _obj) then | |
{ | |
_class = typeOf _obj; | |
if (_obj getVariable ["objectLocked", false] && | |
{(_baseSavingOn && {_class call _isSaveable}) || | |
(_boxSavingOn && {_class call _isBox}) || | |
(_staticWeaponSavingOn && {_class call _isStaticWeapon})} || | |
{_warchestSavingOn && {_obj call _isWarchest}} || | |
{_beaconSavingOn && {_obj call _isBeacon}}) then | |
{ | |
_netId = netId _obj; | |
_pos = ASLtoATL getPosWorld _obj; | |
{ _pos set [_forEachIndex, _x call fn_numToStr] } forEach _pos; | |
_dir = [vectorDir _obj, vectorUp _obj]; | |
_damage = damage _obj; | |
_allowDamage = if (_obj getVariable ["allowDamage", false]) then { 1 } else { 0 }; | |
_spawningTime = _obj getVariable "baseSaving_spawningTime"; | |
if (isNil "_spawningTime") then | |
{ | |
_spawningTime = diag_tickTime; | |
_obj setVariable ["baseSaving_spawningTime", _spawningTime]; | |
}; | |
_hoursAlive = (_obj getVariable ["baseSaving_hoursAlive", 0]) + ((diag_tickTime - _spawningTime) / 3600); | |
_variables = []; | |
switch (true) do | |
{ | |
case (_obj isKindOf "Land_Sacks_goods_F"): | |
{ | |
_variables pushBack ["food", _obj getVariable ["food", 20]]; | |
}; | |
case (_obj isKindOf "Land_BarrelWater_F"): | |
{ | |
_variables pushBack ["water", _obj getVariable ["water", 20]]; | |
}; | |
}; | |
_owner = _obj getVariable ["ownerUID", ""]; | |
if (_owner != "") then | |
{ | |
_variables pushBack ["ownerUID", _owner]; | |
}; | |
switch (true) do | |
{ | |
case (_obj call _isBox): | |
{ | |
_variables pushBack ["cmoney", _obj getVariable ["cmoney", 0]]; | |
}; | |
case (_obj call _isWarchest): | |
{ | |
_variables pushBack ["a3w_warchest", true]; | |
_variables pushBack ["R3F_LOG_disabled", true]; | |
_variables pushBack ["side", str (_obj getVariable ["side", sideUnknown])]; | |
}; | |
case (_obj call _isBeacon): | |
{ | |
_variables pushBack ["a3w_spawnBeacon", true]; | |
_variables pushBack ["R3F_LOG_disabled", true]; | |
_variables pushBack ["side", str (_obj getVariable ["side", sideUnknown])]; | |
_variables pushBack ["packing", false]; | |
_variables pushBack ["groupOnly", _obj getVariable ["groupOnly", false]]; | |
_variables pushBack ["ownerName", toArray (_obj getVariable ["ownerName", "[Beacon]"])]; | |
}; | |
}; | |
_r3fSide = _obj getVariable "R3F_Side"; | |
if (!isNil "_r3fSide") then | |
{ | |
_variables pushBack ["R3F_Side", str _r3fSide]; | |
}; | |
_weapons = []; | |
_magazines = []; | |
_items = []; | |
_backpacks = []; | |
if (_class call _hasInventory) then | |
{ | |
// Save weapons & ammo | |
_weapons = (getWeaponCargo _obj) call cargoToPairs; | |
_magazines = (getMagazineCargo _obj) call cargoToPairs; | |
_items = (getItemCargo _obj) call cargoToPairs; | |
_backpacks = (getBackpackCargo _obj) call cargoToPairs; | |
}; | |
_turretMags = []; | |
if (_staticWeaponSavingOn && {_class call _isStaticWeapon}) then | |
{ | |
_turretMags = magazinesAmmo _obj; | |
}; | |
_ammoCargo = getAmmoCargo _obj; | |
_fuelCargo = getFuelCargo _obj; | |
_repairCargo = getRepairCargo _obj; | |
// Fix for -1.#IND | |
if !(_ammoCargo >= 0) then { _ammoCargo = 0 }; | |
if !(_fuelCargo >= 0) then { _fuelCargo = 0 }; | |
if !(_repairCargo >= 0) then { _repairCargo = 0 }; | |
// Save data | |
_objCount = _objCount + 1; | |
_objName = format ["Obj%1", _objCount]; | |
{ | |
[_fileName, _objName, _x select 0, _x select 1, false] call PDB_write; // iniDB_write | |
} | |
forEach | |
[ | |
["Class", _class], | |
["Position", _pos], | |
["Direction", _dir], | |
["HoursAlive", _hoursAlive], | |
["Damage", _damage], | |
["AllowDamage", _allowDamage], | |
["Variables", _variables], | |
["Weapons", _weapons], | |
["Magazines", _magazines], | |
["Items", _items], | |
["Backpacks", _backpacks], | |
["TurretMagazines", _turretMags], | |
["AmmoCargo", _ammoCargo], | |
["FuelCargo", _fuelCargo], | |
["RepairCargo", _repairCargo] | |
]; | |
sleep 0.01; | |
}; | |
}; | |
} forEach allMissionObjects "All"; | |
[_fileName, "Info", "ObjCount", _objCount] call PDB_write; // iniDB_write | |
_fundsWest = 0; | |
_fundsEast = 0; | |
if (["A3W_warchestMoneySaving"] call isConfigOn) then | |
{ | |
_fundsWest = ["pvar_warchest_funds_west", 0] call getPublicVar; | |
_fundsEast = ["pvar_warchest_funds_east", 0] call getPublicVar; | |
}; | |
[_fileName, "Info", "WarchestMoneyBLUFOR", _fundsWest] call PDB_write; // iniDB_write | |
[_fileName, "Info", "WarchestMoneyOPFOR", _fundsEast] call PDB_write; // iniDB_write | |
diag_log format ["A3W - %1 baseparts and objects have been saved with %2", _objCount, ["A3W_savingMethodName", "-ERROR-"] call getPublicVar]; | |
// Reverse-delete old objects | |
if (_oldObjCount > _objCount) then | |
{ | |
for "_i" from _oldObjCount to (_objCount + 1) step -1 do | |
{ | |
[_fileName, format ["Obj%1", _i], false] call PDB_deleteSection; // iniDB_deleteSection | |
}; | |
}; | |
if (_savingMethod == 1) then | |
{ | |
saveProfileNamespace; // this line is crucial to ensure all profileNamespace data submitted to the server is saved | |
diag_log "A3W - profileNamespace saved"; | |
}; | |
uiSleep 30; | |
// Vehicle saving | |
if (_vehicleSaving) then | |
{ | |
_oldVehCount = [_vehFileName, "Info", "VehCount", "NUMBER"] call PDB_read; // iniDB_read | |
_vehCount = 0; | |
{ | |
_veh = _x; | |
// Only save vehicles that are alive and touching the ground or water | |
if (!(_veh isKindOf "Man") && {alive _veh && (isTouchingGround _veh || (getPos _veh) select 2 < 1)}) then | |
{ | |
_class = typeOf _veh; | |
_purchasedVehicle = _veh getVariable ["A3W_purchasedVehicle", false]; | |
_missionVehicle = (_veh getVariable ["A3W_missionVehicle", false] && !(_veh getVariable ["R3F_LOG_disabled", false])); | |
if ((_purchasedVehicle && _purchasedVehicleSaving) || | |
(_missionVehicle && _missionVehicleSaving)) then | |
{ | |
_pos = ASLtoATL getPosWorld _veh; | |
{ _pos set [_forEachIndex, _x call fn_numToStr] } forEach _pos; | |
_dir = [vectorDir _veh, vectorUp _veh]; | |
_fuel = fuel _veh; | |
_damage = damage _veh; | |
_hitPoints = []; | |
{ | |
_hitPoint = configName _x; | |
_hitPoints set [count _hitPoints, [_hitPoint, _veh getHitPointDamage _hitPoint]]; | |
} forEach (_class call getHitPoints); | |
_spawningTime = _veh getVariable "vehSaving_spawningTime"; | |
if (isNil "_spawningTime") then | |
{ | |
_spawningTime = diag_tickTime; | |
_veh setVariable ["vehSaving_spawningTime", _spawningTime]; | |
}; | |
_lastUse = _veh getVariable ["vehSaving_lastUse", _spawningTime]; | |
if ({isPlayer _x} count crew _veh > 0 || isPlayer ((uavControl _veh) select 0)) then | |
{ | |
_lastUse = diag_tickTime; | |
_veh setVariable ["vehSaving_lastUse", _lastUse]; | |
_veh setVariable ["vehSaving_hoursUnused", 0]; | |
}; | |
_hoursAlive = (_veh getVariable ["vehSaving_hoursAlive", 0]) + ((diag_tickTime - _spawningTime) / 3600); | |
_hoursUnused = (_veh getVariable ["vehSaving_hoursUnused", 0]) + ((diag_tickTime - _lastUse) / 3600); | |
_variables = []; | |
_owner = _veh getVariable ["ownerUID", ""]; | |
if !(_owner in ["","0"]) then | |
{ | |
_variables pushBack ["ownerUID", _owner]; | |
}; | |
//Saving locked state | |
_lockedState = _veh getVariable ["vehicleLocked",0]; | |
if (_lockedState>0) then | |
{ | |
_variables pushBack ["vehicleLocked", _lockedState]; | |
}; | |
switch (true) do | |
{ | |
case _purchasedVehicle: | |
{ | |
_variables pushBack ["A3W_purchasedVehicle", true]; | |
}; | |
case _missionVehicle: | |
{ | |
_variables pushBack ["A3W_missionVehicle", true]; | |
}; | |
}; | |
_textures = []; | |
{ | |
[_textures, _x select 1, [_x select 0]] call fn_addToPairs; | |
} forEach (_veh getVariable ["A3W_objectTextures", []]); | |
_weapons = []; | |
_magazines = []; | |
_items = []; | |
_backpacks = []; | |
if (_class call _hasInventory) then | |
{ | |
// Save weapons & ammo | |
_weapons = (getWeaponCargo _veh) call cargoToPairs; | |
_magazines = (getMagazineCargo _veh) call cargoToPairs; | |
_items = (getItemCargo _veh) call cargoToPairs; | |
_backpacks = (getBackpackCargo _veh) call cargoToPairs; | |
}; | |
_turretMags = magazinesAmmo _veh; | |
_turretMags2 = []; | |
_turretMags3 = []; | |
_hasDoorGuns = isClass (configFile >> "CfgVehicles" >> _class >> "Turrets" >> "RightDoorGun"); | |
_turrets = if (_hasDoorGuns) then { [[-1],[2]] } else { [[-1]] + ([_veh, []] call BIS_fnc_getTurrets) }; | |
{ | |
_path = _x; | |
{ | |
if ([_turretMags, _x, -1] call fn_getFromPairs == -1 || _hasDoorGuns) then | |
{ | |
if (_veh currentMagazineTurret _path == _x && {count _turretMags3 == 0}) then | |
{ | |
_turretMags3 set [count _turretMags3, [_x, _path, [_veh currentMagazineDetailTurret _path] call getMagazineDetailAmmo]]; | |
} | |
else | |
{ | |
_turretMags2 set [count _turretMags2, [_x, _path]]; | |
}; | |
}; | |
} forEach (_veh magazinesTurret _path); | |
} forEach _turrets; | |
_ammoCargo = getAmmoCargo _veh; | |
_fuelCargo = getFuelCargo _veh; | |
_repairCargo = getRepairCargo _veh; | |
// Fix for -1.#IND | |
if !(_ammoCargo >= 0) then { _ammoCargo = 0 }; | |
if !(_fuelCargo >= 0) then { _fuelCargo = 0 }; | |
if !(_repairCargo >= 0) then { _repairCargo = 0 }; | |
// Save data | |
_vehCount = _vehCount + 1; | |
_vehName = format ["Veh%1", _vehCount]; | |
{ | |
[_vehFileName, _vehName, _x select 0, _x select 1, false] call PDB_write; // iniDB_write | |
} | |
forEach | |
[ | |
["Class", _class], | |
["Position", _pos], | |
["Direction", _dir], | |
["HoursAlive", _hoursAlive], | |
["HoursUnused", _hoursUnused], | |
["Fuel", _fuel], | |
["Damage", _damage], | |
["HitPoints", _hitPoints], | |
["Variables", _variables], | |
["Textures", _textures], | |
["Weapons", _weapons], | |
["Magazines", _magazines], | |
["Items", _items], | |
["Backpacks", _backpacks], | |
["TurretMagazines", _turretMags], | |
["TurretMagazines2", _turretMags2], | |
["TurretMagazines3", _turretMags3], | |
["AmmoCargo", _ammoCargo], | |
["FuelCargo", _fuelCargo], | |
["RepairCargo", _repairCargo] | |
]; | |
sleep 0.01; | |
}; | |
}; | |
} forEach allMissionObjects "AllVehicles"; | |
[_vehFileName, "Info", "VehCount", _vehCount] call PDB_write; // iniDB_write | |
diag_log format ["A3W - %1 vehicles have been saved with %2", _vehCount, ["A3W_savingMethodName", "-ERROR-"] call getPublicVar]; | |
// Reverse-delete old vehicles | |
if (_oldVehCount > _vehCount) then | |
{ | |
for "_i" from _oldVehCount to (_vehCount + 1) step -1 do | |
{ | |
[_vehFileName, format ["Veh%1", _i], false] call PDB_deleteSection; // iniDB_deleteSection | |
}; | |
}; | |
if (_savingMethod == 1) then | |
{ | |
saveProfileNamespace; | |
diag_log "A3W - profileNamespace saved"; | |
}; | |
}; | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ****************************************************************************************** | |
// * This project is licensed under the GNU Affero GPL v3. Copyright © 2014 A3Wasteland.com * | |
// ****************************************************************************************** | |
// @file Version: 1.2 | |
// @file Name: playerActions.sqf | |
// @file Author: [404] Deadbeat, [404] Costlyy, [GoT] JoSchaap, AgentRev | |
// @file Created: 20/11/2012 05:19 | |
{ [player, _x] call fn_addManagedAction} forEach | |
[ | |
["<img image='client\icons\r3f_lock.paa'/> Lock Vehicle", "client\lockSystem\vehicle_lock.sqf", [], 1,false,false,"","[cursorTarget] call canVehicleLock"], | |
["<img image='client\icons\r3f_unlock.paa'/> Unlock Vehicle", "client\lockSystem\vehicle_unlock.sqf", [], 1,false,false,"","[cursorTarget] call canVehicleUnlock"], | |
["Holster Weapon", { player action ["SwitchWeapon", player, player, 100] }, [], -11, false, false, "", "vehicle player == player && currentWeapon player != ''"], | |
["Unholster Primary Weapon", { player action ["SwitchWeapon", player, player, 0] }, [], -11, false, false, "", "vehicle player == player && currentWeapon player == '' && primaryWeapon player != ''"], | |
[format ["<img image='client\icons\playerMenu.paa' color='%1'/> <t color='%1'>[</t>Player Menu<t color='%1'>]</t>", "#FF8000"], "client\systems\playerMenu\init.sqf", [], -10, false], //, false, "", ""], | |
["<img image='client\icons\money.paa'/> Pickup Money", "client\actions\pickupMoney.sqf", [], 1, false, false, "", "{_x getVariable ['owner', ''] != 'mission'} count (player nearEntities ['Land_Money_F', 5]) > 0"], | |
["<img image='\a3\Ui_f\data\GUI\Cfg\CommunicationMenu\transport_ca.paa'/> <t color='#FFFFFF'>Cancel Action</t>", { doCancelAction = true }, [], 1, false, false, "", "mutexScriptInProgress"], | |
["<img image='client\icons\repair.paa'/> Salvage", "client\actions\salvage.sqf", [], 1.1, false, false, "", "!isNull cursorTarget && !alive cursorTarget && {cursorTarget isKindOf 'AllVehicles' && !(cursorTarget isKindOf 'Man') && player distance cursorTarget <= (sizeOf typeOf cursorTarget / 3) max 2}"], | |
["<img image='client\icons\repair.paa'/> Repair", "addons\scripts\tower_repair.sqf", [], 1.1, false, false, "", "!isNull cursorTarget && alive cursorTarget && (({cursorTarget isKindOf _x} count ['Land_Cargo_Patrol_V1_ruins_F','Land_Cargo_Tower_V1_ruins_F'] > 0) && player distance cursorTarget <= (sizeOf typeOf cursorTarget / 3) max 2)"], | |
["[0]"] call getPushPlaneAction, | |
["Push vehicle", "server\functions\pushVehicle.sqf", [2.5, true], 1, false, false, "", "[2.5] call canPushVehicleOnFoot"], | |
["Push vehicle forward", "server\functions\pushVehicle.sqf", [2.5], 1, false, false, "", "[2.5] call canPushWatercraft"], | |
["Push vehicle backward", "server\functions\pushVehicle.sqf", [-2.5], 1, false, false, "", "[-2.5] call canPushWatercraft"], | |
["<t color='#FF0000'>Emergency eject</t>", "client\actions\forceEject.sqf", [], -9, false, true, "", "(vehicle player) isKindOf 'Air'"], | |
["<t color='#FF00FF'>Open magic parachute</t>", "client\actions\openParachute.sqf", [], 20, true, true, "", "vehicle player == player && (getPos player) select 2 > 2.5"] | |
]; | |
// Hehehe... | |
if !(288520 in getDLCs 1) then | |
{ | |
[player, ["<t color='#00FFFF'>Get in as Driver</t>", "client\actions\moveInDriver.sqf", [], 6, true, true, "", "cursorTarget isKindOf 'Kart_01_Base_F' && player distance cursorTarget < 3.4 && isNull driver cursorTarget"]] call fn_addManagedAction; | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//@file Version: 1.2 | |
//@file Name: vehiclesave.sqf | |
//@file Author: MercyfulFate edited by Gigatek && BadVolt | |
//@file Created: 06/09/2014 | |
//@file Description: Save the nearest Vehicle | |
#define DURATION 5 | |
#define ANIMATION "AinvPknlMstpSlayWrflDnon_medic" | |
#define ERR_IN_vehicle "Locking Failed! You can't do that in a vehicle." | |
#define ERR_DESTROYED "The vehicle is too damaged to lock." | |
#define ERR_TOO_FAR_AWAY "Locking Failed! You are too far away from the vehicle." | |
#define ERR_NOT_VEHICLE "Locking Failed! This is not a vehicle." | |
#define ERR_CANCELLED "Locking Cancelled!" | |
private ["_vehicle", "_checks", "_success", "_nearvehicle"]; | |
//_nearvehicle = nearestObjects [player, ['Air','Tank','Motorcycle','Car','Ship'], 7]; | |
//_vehicle = _nearvehicle select 0; | |
_vehicle = cursorTarget; | |
_checks = { | |
private ["_progress","_failed", "_text"]; | |
_progress = _this select 0; | |
_vehicle = _this select 1; | |
_text = ""; | |
_failed = true; | |
switch (true) do { | |
case (!alive player): {}; // player is dead, no need for a notification | |
case (vehicle player != player): {_text = ERR_IN_vehicle}; | |
case (player distance _vehicle > (sizeOf typeOf _vehicle / 3) max 5): {_text = ERR_TOO_FAR_AWAY}; | |
case (!alive _vehicle): {_error = ERR_DESTROYED}; | |
case ({(typeOf _vehicle) isKindOf _x } count ['Air','Tank','Motorcycle','Car','Ship'] == 0 ): {_text = ERR_NOT_VEHICLE}; | |
case (doCancelAction): {_text = ERR_CANCELLED; doCancelAction = false;}; | |
default { | |
_text = format["Vehicle Locking %1%2 Complete", round(100 * _progress), "%"]; | |
_failed = false; | |
}; | |
}; | |
[_failed, _text]; | |
}; | |
_success = [DURATION, ANIMATION, _checks, [_vehicle]] call a3w_actions_start; | |
if (_success) then { | |
[[netId _vehicle, 2], "A3W_fnc_setLockState", _vehicle] call A3W_fnc_MP; // Lock | |
_vehicle setVariable ["R3F_Side", playerSide, true]; | |
_vehicle setVariable ["vehicleLocked", 2, true]; | |
_vehicle setVariable ["ownerUID", getPlayerUID player, true]; | |
player action ["engineOff", _vehicle]; | |
player action ["lightOff", _vehicle]; | |
["Vehicle Lock complete!", 5] call mf_notify_client; | |
}; | |
_success; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//@file Version: 1.2 | |
//@file Name: vehiclesave.sqf | |
//@file Author: MercyfulFate edited by Gigatek && BadVolt | |
//@file Created: 06/09/2014 | |
//@file Description: Save the nearest Vehicle | |
#define DURATION 5 | |
#define ANIMATION "AinvPknlMstpSlayWrflDnon_medic" | |
#define ERR_IN_vehicle "Unlocking Failed! You can't do that in a vehicle." | |
#define ERR_DESTROYED "The vehicle is too damaged to unlock." | |
#define ERR_TOO_FAR_AWAY "Unlocking Failed! You are too far away from the vehicle." | |
#define ERR_NOT_VEHICLE "Unlocking Failed! This is not a vehicle." | |
#define ERR_CANCELLED "Unlocking Cancelled!" | |
private ["_vehicle", "_checks", "_success", "_nearvehicle"]; | |
//_nearvehicle = nearestObjects [player, ['Air','Tank','Motorcycle','Car','Ship'], 7]; | |
//_vehicle = _nearvehicle select 0; | |
_vehicle = cursorTarget; | |
_checks = { | |
private ["_progress","_failed", "_text"]; | |
_progress = _this select 0; | |
_vehicle = _this select 1; | |
_text = ""; | |
_failed = true; | |
switch (true) do { | |
case (!alive player): {}; // player is dead, no need for a notification | |
case (vehicle player != player): {_text = ERR_IN_vehicle}; | |
case (player distance _vehicle > (sizeOf typeOf _vehicle / 3) max 5): {_text = ERR_TOO_FAR_AWAY}; | |
case (!alive _vehicle): {_error = ERR_DESTROYED}; | |
case ({(typeOf _vehicle) isKindOf _x } count ['Air','Tank','Motorcycle','Car','Ship'] == 0 ): {_text = ERR_NOT_VEHICLE}; | |
case (doCancelAction): {_text = ERR_CANCELLED; doCancelAction = false;}; | |
default { | |
_text = format["Vehicle Unlocking %1%2 Complete", round(100 * _progress), "%"]; | |
_failed = false; | |
}; | |
}; | |
[_failed, _text]; | |
}; | |
_success = [DURATION, ANIMATION, _checks, [_vehicle]] call a3w_actions_start; | |
if (_success) then { | |
[[netId _vehicle, 0], "A3W_fnc_setLockState", _vehicle] call A3W_fnc_MP; // Lock | |
_vehicle setVariable ["R3F_Side", nil, true]; | |
_vehicle setVariable ["vehicleLocked", 0, true]; | |
_vehicle setVariable ["ownerUID", nil, true]; | |
player action ["lightOn", _vehicle]; | |
sleep 1; | |
player action ["lightOff", _vehicle]; | |
["Vehicle Unlock Complete!", 5] call mf_notify_client; | |
}; | |
_success; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ****************************************************************************************** | |
// * This project is licensed under the GNU Affero GPL v3. Copyright © 2014 A3Wasteland.com * | |
// ****************************************************************************************** | |
// @file Version: 1.2 | |
// @file Name: vLoad.sqf | |
// @file Author: JoSchaap, AgentRev, Austerror | |
// @file Description: Vehicle saving load script | |
if (!isServer) exitWith {}; | |
_vehFileName = "Vehicles" call PDB_objectFileName; | |
_maxLifetime = ["A3W_vehicleLifetime", 0] call getPublicVar; | |
_maxUnusedTime = ["A3W_vehicleMaxUnusedTime", 0] call getPublicVar; | |
_exists = _vehFileName call PDB_exists; // iniDB_exists | |
_vehCount = 0; | |
_savingMethod = ["A3W_savingMethod", 1] call getPublicVar; | |
if (!isNil "_exists" && {_exists}) then | |
{ | |
_vehCount = [_vehFileName, "Info", "VehCount", "NUMBER"] call PDB_read; // iniDB_read | |
if (!isNil "_vehCount") then | |
{ | |
for "_i" from 1 to _vehCount do | |
{ | |
_vehName = format ["Veh%1", _i]; | |
_class = [_vehFileName, _vehName, "Class", "STRING"] call PDB_read; // iniDB_read | |
_pos = [_vehFileName, _vehName, "Position", "ARRAY"] call PDB_read; // iniDB_read | |
_hoursAlive = [_vehFileName, _vehName, "HoursAlive", "NUMBER"] call PDB_read; // iniDB_read | |
_hoursUnused = [_vehFileName, _vehName, "HoursUnused", "NUMBER"] call PDB_read; // iniDB_read | |
if (!isNil "_class" && !isNil "_pos" && {(_maxLifetime <= 0 || _hoursAlive < _maxLifetime) && (_maxUnusedTime <= 0 || _hoursUnused < _maxUnusedTime)}) then | |
{ | |
_variables = [_vehFileName, _vehName, "Variables", "ARRAY"] call PDB_read; // iniDB_read | |
_dir = [_vehFileName, _vehName, "Direction", "ARRAY"] call PDB_read; // iniDB_read | |
_fuel = [_vehFileName, _vehName, "Fuel", "NUMBER"] call PDB_read; // iniDB_read | |
_damage = [_vehFileName, _vehName, "Damage", "NUMBER"] call PDB_read; // iniDB_read | |
_hitPoints = [_vehFileName, _vehName, "HitPoints", "ARRAY"] call PDB_read; // iniDB_read | |
_textures = [_vehFileName, _vehName, "Textures", "ARRAY"] call PDB_read; // iniDB_read | |
{ if (typeName _x == "STRING") then { _pos set [_forEachIndex, parseNumber _x] } } forEach _pos; | |
_veh = createVehicle [_class, _pos, [], 0, "None"]; | |
_veh setPosWorld ATLtoASL _pos; | |
if (!isNil "_dir") then | |
{ | |
_veh setVectorDirAndUp _dir; | |
}; | |
[_veh] call vehicleSetup; | |
_veh setVariable ["vehSaving_hoursAlive", _hoursAlive]; | |
_veh setVariable ["vehSaving_spawningTime", diag_tickTime]; | |
_veh setVariable ["vehSaving_hoursUnused", _hoursUnused]; | |
_veh setVariable ["vehSaving_lastUse", diag_tickTime]; | |
_veh setDamage _damage; | |
{ _veh setHitPointDamage _x } forEach _hitPoints; | |
_veh setFuel _fuel; | |
if (!isNil "_textures") then | |
{ | |
_veh setVariable ["BIS_enableRandomization", false, true]; | |
_objTextures = []; | |
{ | |
_texture = _x select 0; | |
{ | |
_veh setObjectTextureGlobal [_x, _texture]; | |
[_objTextures, _x, _texture] call fn_setToPairs; | |
} forEach (_x select 1); | |
} forEach _textures; | |
_veh setVariable ["A3W_objectTextures", _objTextures, true]; | |
}; | |
{ | |
_var = _x select 0; | |
_value = _x select 1; | |
//Add action to loaded vehicle | |
switch (_var) do { | |
case "vehicleLocked": {_veh lock _value}; | |
}; | |
_veh setVariable [_var, _value] | |
} forEach _variables; | |
clearWeaponCargoGlobal _veh; | |
clearMagazineCargoGlobal _veh; | |
clearItemCargoGlobal _veh; | |
clearBackpackCargoGlobal _veh; | |
_weapons = [_vehFileName, _vehName, "Weapons", "ARRAY"] call PDB_read; // iniDB_read | |
_magazines = [_vehFileName, _vehName, "Magazines", "ARRAY"] call PDB_read; // iniDB_read | |
_items = [_vehFileName, _vehName, "Items", "ARRAY"] call PDB_read; // iniDB_read | |
_backpacks = [_vehFileName, _vehName, "Backpacks", "ARRAY"] call PDB_read; // iniDB_read | |
if (!isNil "_weapons") then | |
{ | |
{ _veh addWeaponCargoGlobal _x } forEach _weapons; | |
}; | |
if (!isNil "_magazines") then | |
{ | |
{ _veh addMagazineCargoGlobal _x } forEach _magazines; | |
}; | |
if (!isNil "_items") then | |
{ | |
{ _veh addItemCargoGlobal _x } forEach _items; | |
}; | |
if (!isNil "_backpacks") then | |
{ | |
{ | |
if !((_x select 0) isKindOf "Weapon_Bag_Base") then | |
{ | |
_veh addBackpackCargoGlobal _x; | |
}; | |
} forEach _backpacks; | |
}; | |
_turretMags = [_vehFileName, _vehName, "TurretMagazines", "ARRAY"] call PDB_read; // iniDB_read | |
_turretMags2 = [_vehFileName, _vehName, "TurretMagazines2", "ARRAY"] call PDB_read; // iniDB_read | |
_turretMags3 = [_vehFileName, _vehName, "TurretMagazines3", "ARRAY"] call PDB_read; // iniDB_read | |
_veh setVehicleAmmo 0; | |
if (!isNil "_turretMags3") then | |
{ | |
{ | |
_veh addMagazineTurret [_x select 0, _x select 1]; | |
_veh setVehicleAmmo (_x select 2); | |
} forEach _turretMags3; | |
}; | |
if (!isNil "_turretMags") then | |
{ | |
{ _veh addMagazine _x } forEach _turretMags; | |
}; | |
if (!isNil "_turretMags2") then | |
{ | |
{ _veh addMagazineTurret _x } forEach _turretMags2; | |
}; | |
_ammoCargo = [_vehFileName, _vehName, "AmmoCargo", "NUMBER"] call PDB_read; // iniDB_read | |
_fuelCargo = [_vehFileName, _vehName, "FuelCargo", "NUMBER"] call PDB_read; // iniDB_read | |
_repairCargo = [_vehFileName, _vehName, "RepairCargo", "NUMBER"] call PDB_read; // iniDB_read | |
if (!isNil "_ammoCargo") then { _veh setAmmoCargo _ammoCargo }; | |
if (!isNil "_fuelCargo") then { _veh setFuelCargo _fuelCargo }; | |
if (!isNil "_repairCargo") then { _veh setRepairCargo _repairCargo }; | |
reload _veh; | |
// UAV AI | |
if (getNumber (configFile >> "CfgVehicles" >> _class >> "isUav") > 0) then | |
{ | |
createVehicleCrew _veh; | |
_veh spawn | |
{ | |
waitUntil {!isNull driver _this}; | |
{ | |
[[_x, ["AI","",""]], "A3W_fnc_setName", true] call A3W_fnc_MP; | |
} forEach crew _this; | |
}; | |
}; | |
}; | |
}; | |
}; | |
}; | |
diag_log format ["A3Wasteland - world persistence loaded %1 vehicles from %2", _vehCount, ["A3W_savingMethodName", "a rip in the fabric of space-time"] call getPublicVar]; |
Vehicles are saving at oSave.sqf.
So what do i have to add to that script exectly?
You only provided the variables above, where do i have to put them?
Well, usually you need to do sth like
_variables pushBack ["R3F_Side", _veh getVariable ["R3F_Side",""]];
So you didnt test if it works?
Sure. But I have other saving script now, can't give you exact working one.
I'll test this in a couple of hours.
So far Save is working but loading fails. I'll keep you posted.
Thanks,
Mike.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Did you mean vehiclesaving.sqf in the readme.txt?
Because i cant find this file, nor can i find saving.sqf or anything else "saving" related