summaryrefslogtreecommitdiffstats
path: root/Client/Functions/Client_RespawnBag.sqf
diff options
context:
space:
mode:
authorhybrid <hybrid@hybridlabs.pro>2026-06-11 19:38:09 +0300
committerhybrid <hybrid@hybridlabs.pro>2026-06-11 19:38:09 +0300
commita3a91d4f45b22fd487ecbc954ad979be5d03efdd (patch)
treea554ab159a347dcd6c00ca1c7c26c1ec3ac0a6bd /Client/Functions/Client_RespawnBag.sqf
downloada2wf_chernarus-a3a91d4f45b22fd487ecbc954ad979be5d03efdd.tar.gz
a2wf_chernarus-a3a91d4f45b22fd487ecbc954ad979be5d03efdd.tar.bz2
a2wf_chernarus-a3a91d4f45b22fd487ecbc954ad979be5d03efdd.zip
Diffstat (limited to 'Client/Functions/Client_RespawnBag.sqf')
-rw-r--r--Client/Functions/Client_RespawnBag.sqf33
1 files changed, 33 insertions, 0 deletions
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