Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Container bugfix #652

Open
wants to merge 2 commits into
base: v5.X.X
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 26 additions & 21 deletions life_server/Functions/Housing/fn_houseCleanup.sqf
Original file line number Diff line number Diff line change
@@ -1,21 +1,26 @@
/*
File: fn_houseCleanup.sqf
Author: NiiRoZz

Description:
Cleans up containers inside in house of player.
*/
params [
["_uid","",[""]]
];

private _query = format ["SELECT pos FROM containers WHERE pid='%1' AND owned='1'",_uid];
private _containers = [_query,2,true] call DB_fnc_asyncCall;

{
_x params ["_pos"];
_pos = parseSimpleArray _pos;
{
deleteVehicle _x;
} forEach (nearestObjects[_pos,["Box_IND_Grenades_F","B_supplyCrate_F"],12]);
} forEach _containers;
/*
File: fn_houseCleanup.sqf
Author: NiiRoZz

Description:
Cleans up containers inside in house of player.
*/
params [
["_uid","",[""]]
];

private _query = format ["SELECT pos FROM containers WHERE pid='%1' AND owned='1'",_uid];
private _containers = [_query,2,true] call DB_fnc_asyncCall;

{
_x params ["_pos"];
_pos = parseSimpleArray _pos;
{
deleteVehicle _x;
} forEach (nearestObjects[_pos,["Box_IND_Grenades_F","B_supplyCrate_F"],12]);

private _house = nearestObject [_pos, "House"];
if !(_house getVariable ["containers",[]] isEqualTo []) then {
DomT602 marked this conversation as resolved.
Show resolved Hide resolved
_house setVariable ["containers",nil,true];
};
} forEach _containers;
98 changes: 49 additions & 49 deletions life_server/Functions/Systems/fn_clientDisconnect.sqf
Original file line number Diff line number Diff line change
@@ -1,49 +1,49 @@
#include "\life_server\script_macros.hpp"
/*
File: fn_clientDisconnect.sqf
Author: Bryan "Tonic" Boardwine

Description:
When a client disconnects this will remove their corpse and
clean up their storage boxes in their house. Also, saves player infos & position.
*/
params [
["_unit",objNull,[objNull]],
"",
["_uid","",[""]]
];
if (isNull _unit) exitWith {};

//Save civilian position
if (life_save_civilian_position && {side _unit isEqualTo civilian}) then {
if (isNil "HC_UID" || {!(_uid isEqualTo HC_UID)}) then {
private _position = getPosATL _unit;
if ((getMarkerPos "respawn_civilian" distance _position) > 300) then {
private _alive = alive _unit;
if (life_HC_isActive) then {[_uid,civilian,_alive,4,_position] remoteExec ["HC_fnc_updatePartial",HC_Life]} else {[_uid,civilian,_alive,4,_position] spawn DB_fnc_updatePartial};
};
};
};

if !(alive _unit) then {
diag_log format["%1 disconnected while dead.",_uid];
} else {
{
_x params [
["_corpseUID","",[""]],
["_corpse",objNull,[objNull]]
];
if (_corpseUID isEqualTo _uid) exitWith {
if (isNull _corpse) exitWith {server_corpses deleteAt _forEachIndex};
[_corpse] remoteExecCall ["life_fnc_corpse",0];
diag_log format["%1 disconnected while dead.",_corpseUID];
server_corpses deleteAt _forEachIndex;
};
} forEach server_corpses;
};

private _containers = nearestObjects[_unit,["WeaponHolderSimulated"],5];
{deleteVehicle _x} forEach _containers;
deleteVehicle _unit;

[_uid] spawn TON_fnc_houseCleanup;
#include "\life_server\script_macros.hpp"
/*
File: fn_clientDisconnect.sqf
Author: Bryan "Tonic" Boardwine
Description:
When a client disconnects this will remove their corpse and
clean up their storage boxes in their house. Also, saves player infos & position.
*/
params [
["_unit",objNull,[objNull]],
"",
["_uid","",[""]]
];
if (isNull _unit) exitWith {};
//Save civilian position
if (life_save_civilian_position && {side _unit isEqualTo civilian}) then {
if (isNil "HC_UID" || {!(_uid isEqualTo HC_UID)}) then {
private _position = getPosATL _unit;
if ((getMarkerPos "respawn_civilian" distance _position) > 300) then {
private _alive = alive _unit;
if (life_HC_isActive) then {[_uid,civilian,_alive,4,_position] remoteExec ["HC_fnc_updatePartial",HC_Life]} else {[_uid,civilian,_alive,4,_position] spawn DB_fnc_updatePartial};
};
};
};
if !(alive _unit) then {
diag_log format["%1 disconnected while dead.",_uid];
} else {
{
_x params [
["_corpseUID","",[""]],
["_corpse",objNull,[objNull]]
];
if (_corpseUID isEqualTo _uid) exitWith {
if (isNull _corpse) exitWith {server_corpses deleteAt _forEachIndex};
[_corpse] remoteExecCall ["life_fnc_corpse",0];
diag_log format["%1 disconnected while dead.",_corpseUID];
server_corpses deleteAt _forEachIndex;
};
} forEach server_corpses;
};
private _containers = nearestObjects[_unit,["WeaponHolderSimulated"],5];
{deleteVehicle _x} forEach _containers;
deleteVehicle _unit;
[_uid] call TON_fnc_houseCleanup;