29 lines
1.0 KiB
Plaintext
29 lines
1.0 KiB
Plaintext
/*
|
|
File : fn_deleteDBContainer.sqf
|
|
Author: NiiRoZz
|
|
|
|
This file is for Nanou's HeadlessClient.
|
|
|
|
Description:
|
|
Delete Container and remove Container in Database
|
|
*/
|
|
private ["_house","_houseID","_ownerID","_housePos","_query","_radius","_containers"];
|
|
_container = [_this,0,objNull,[objNull]] call BIS_fnc_param;
|
|
if (isNull _container) exitWith {diag_log "container null";};
|
|
|
|
_containerID = _container getVariable ["container_id",-1];
|
|
if (_containerID isEqualTo -1) then {
|
|
_containerPos = getPosATL _container;
|
|
_ownerID = (_container getVariable "container_owner") select 0;
|
|
_query = format ["UPDATE containers SET owned='0', pos='[]' WHERE pid='%1' AND pos='%2' AND owned='1'",_ownerID,_containerPos];
|
|
} else {
|
|
_query = format ["UPDATE containers SET owned='0', pos='[]' WHERE id='%1'",_containerID];
|
|
};
|
|
_container setVariable ["container_id",nil,true];
|
|
_container setVariable ["container_owner",nil,true];
|
|
|
|
[_query,1] call HC_fnc_asyncCall;
|
|
|
|
["CALL deleteOldContainers",1] call HC_fnc_asyncCall;
|
|
deleteVehicle _container;
|