From 68d4c9bbd80ed2e6528244569c79676b87295bd1 Mon Sep 17 00:00:00 2001 From: hybrid Date: Thu, 11 Jun 2026 19:54:45 +0300 Subject: init --- Client/Functions/Client_RespawnBag.sqf | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 Client/Functions/Client_RespawnBag.sqf (limited to 'Client/Functions/Client_RespawnBag.sqf') diff --git a/Client/Functions/Client_RespawnBag.sqf b/Client/Functions/Client_RespawnBag.sqf new file mode 100644 index 0000000..dd20527 --- /dev/null +++ b/Client/Functions/Client_RespawnBag.sqf @@ -0,0 +1,33 @@ +private ["_add"]; + +if !(isNil 'respawnBag') then { + _add = false; + /* Player did purchase a backpack and have one by default */ + if !(isNull (unitBackPack player)) then { + /* If the backpack type is different from the current one, then we remove it */ + if (typeOf (unitBackPack player) != respawnBag) then { + removeBackpack player; + _add = true; + }; + } else { + _add = true; + }; + + /* We give a new backpack to the player */ + if (_add) then {player addBackpack respawnBag}; + + /* We clear the new backpack content */ + clearMagazineCargo (unitBackpack player); + + /* We add the player's backpack content inside the new one */ + if (count (respawnBagContent select 0) > 0) then { + for '_u' from 0 to count(respawnBagContent select 0)-1 do { + (unitBackpack player) addMagazineCargo [(respawnBagContent select 0) select _u, (respawnBagContent select 1) select _u]; + }; + }; +} else { + /* Player did not purchase a backpack but have one by default */ + if !(isNull (unitBackPack player)) then { + removeBackpack player; + }; +}; \ No newline at end of file -- cgit v1.3.1