+ recoded vehicle lock/unlock code fixes #69
+ added "vehicle locked" addaction. fixes #116
+ added cargo check to all vehicles fixes #115
This commit is contained in:
vbawol
2013-02-20 11:27:42 -06:00
parent fcada965e2
commit c0d38c824c
4 changed files with 56 additions and 7 deletions

View File

@@ -0,0 +1,24 @@
private["_vehicle"];
_vehicle = _this select 3;
_class = typeOf _vehicle;
// Get max magazines count
_maxMagazines = getNumber (configFile >> "CfgVehicles" >> _class >> "transportMaxMagazines");
// Get max weapon count
_maxWeapons = getNumber (configFile >> "CfgVehicles" >> _class >> "transportMaxWeapons");
// Get max backpack count
_maxBackpacks = getNumber (configFile >> "CfgVehicles" >> _class >> "transportmaxbackpacks");
// Count and show magazines available space
_magazineCount = count (getMagazineCargo _vehicle);
// Count and show weapons available space
_weaponsCount = count (getWeaponCargo _vehicle);
// Count and show backpacks available space
_backpackCount = count (getBackpackCargo _vehicle);
cutText [format[("Magazine %1 / %2 - Weapons %3 / %4 - Backpacks %5 / %6"),_magazineCount,_maxMagazines,_weaponsCount,_maxWeapons,_backpackCount,_maxBackpacks], "PLAIN DOWN"];

View File

@@ -101,16 +101,28 @@ if (!isNull cursorTarget and !_inVehicle and (player distance cursorTarget < 6))
// Allow Owner to lock and unlock vehicle
if(_isVehicle and !_isMan and _canDo and _ownerID != "0" and _ownerID == dayz_playerUID) then {
if(_isVehicle and !_isMan and _canDo and _ownerID != "0") then {
if (s_player_lockUnlock_crtl < 0) then {
_Unlock = player addAction [format["Unlock %1",_text], "\z\addons\dayz_code\actions\unlock_veh.sqf",cursorTarget, 2, true, true, "", "(locked cursorTarget)"];
_lock = player addAction [format["Lock %1",_text], "\z\addons\dayz_code\actions\lock_veh.sqf",cursorTarget, 1, true, true, "", "(!locked cursorTarget)"];
s_player_lockunlock set [count s_player_lockunlock,_Unlock];
s_player_lockunlock set [count s_player_lockunlock,_lock];
if(locked cursorTarget) then {
if(_ownerID == dayz_playerUID) then {
_Unlock = player addAction [format["Unlock %1",_text], "\z\addons\dayz_code\actions\unlock_veh.sqf",cursorTarget, 2, true, true, "", ""];
s_player_lockunlock set [count s_player_lockunlock,_Unlock];
s_player_lockUnlock_crtl = 1;
} else {
_Unlock = player addAction ["Vehicle Locked", "",cursorTarget, 2, true, true, "", ""];
s_player_lockunlock set [count s_player_lockunlock,_Unlock];
s_player_lockUnlock_crtl = 1;
};
} else {
if(_ownerID == dayz_playerUID) then {
_lock = player addAction [format["Lock %1",_text], "\z\addons\dayz_code\actions\lock_veh.sqf",cursorTarget, 1, true, true, "", ""];
s_player_lockunlock set [count s_player_lockunlock,_lock];
s_player_lockUnlock_crtl = 1;
};
};
s_player_lockUnlock_crtl = 1;
};
} else {
@@ -129,6 +141,16 @@ if (!isNull cursorTarget and !_inVehicle and (player distance cursorTarget < 6))
s_player_forceSave = -1;
};
*/
if((_isVehicle or _isTent) and _canDo and !_isMan) then {
if (s_player_checkGear < 0) then {
s_player_checkGear = player addAction ["Cargo Check", "\z\addons\dayz_code\actions\checkcargo.sqf",cursorTarget, 1, true, true, "", ""];
};
} else {
player removeAction s_player_checkGear;
s_player_checkGear = -1;
};
//flip vehicle
if ((_isVehicletype) and !_canmove and _isAlive and (player distance cursorTarget >= 2) and (count (crew cursorTarget))== 0 and ((vectorUp cursorTarget) select 2) < 0.5) then {
if (s_player_flipveh < 0) then {

View File

@@ -117,6 +117,7 @@ dayz_resetSelfActions = {
s_build_Wire_cat1 = -1;
s_player_deleteBuild = -1;
s_player_forceSave = -1;
s_player_checkGear = -1;
s_player_flipveh = -1;
s_player_stats = -1;
s_player_sleep = -1;

View File

@@ -68,6 +68,8 @@ if (_spawnDMG) then {
};
};
// TODO: check if uid already exists and if so increment by 1 and check again as soon as we find nothing continue.
//Send request
_key = format["CHILD:308:%1:%2:%3:%4:%5:%6:%7:%8:%9:",dayZ_instance, _class, _damage , _characterID, _worldspace, [], _array, _fuel,_uid];
diag_log ("HIVE: WRITE: "+ str(_key));