mirror of
https://github.com/EpochModTeam/DayZ-Epoch.git
synced 2026-02-24 00:50:50 +03:00
Fix infinite antibiotics when given to another player
Vanilla development commit:
4e6ea24577
This commit is contained in:
@@ -5,8 +5,17 @@ private ["_msg","_antibiotics","_hasAntibiotics","_id","_hasMeds","_unit"];
|
|||||||
_unit = _this select 0;
|
_unit = _this select 0;
|
||||||
_medsUsed = _this select 1;
|
_medsUsed = _this select 1;
|
||||||
_antibiotics =["ItemAntibiotic","ItemAntibiotic1","ItemAntibiotic2","ItemAntibiotic3","ItemAntibiotic4","ItemAntibiotic5","ItemAntibiotic6"];
|
_antibiotics =["ItemAntibiotic","ItemAntibiotic1","ItemAntibiotic2","ItemAntibiotic3","ItemAntibiotic4","ItemAntibiotic5","ItemAntibiotic6"];
|
||||||
|
_hasAntibiotics = false;
|
||||||
|
|
||||||
_hasAntibiotics = Array_Any(magazines player, {_this in _antibiotics});
|
{
|
||||||
|
if (_x in magazines player) exitWith {
|
||||||
|
// Set antibiotics if not defined (used when giving to somebody)
|
||||||
|
if(isNil "_medsUsed") then {
|
||||||
|
_medsUsed = _x;
|
||||||
|
};
|
||||||
|
_hasAntibiotics = true;
|
||||||
|
};
|
||||||
|
} count _antibiotics;
|
||||||
|
|
||||||
_msg = "You seem to have misplaced your antibiotics.";
|
_msg = "You seem to have misplaced your antibiotics.";
|
||||||
|
|
||||||
@@ -28,19 +37,19 @@ if (_hasAntibiotics) then {
|
|||||||
if ((_unit == player) or (vehicle player != player)) then {
|
if ((_unit == player) or (vehicle player != player)) then {
|
||||||
//Self Healing
|
//Self Healing
|
||||||
_id = [player,player] execVM "\z\addons\dayz_code\medical\publicEH\medAntibiotics.sqf";
|
_id = [player,player] execVM "\z\addons\dayz_code\medical\publicEH\medAntibiotics.sqf";
|
||||||
|
|
||||||
_msg = "You have taken antibiotics.";
|
_msg = "You have taken antibiotics.";
|
||||||
} else {
|
} else {
|
||||||
//Send request to other player
|
//Send request to other player
|
||||||
PVDZ_send = [_unit,"Antibiotics",[_unit,player]];
|
PVDZ_send = [_unit,"Antibiotics",[_unit,player]];
|
||||||
publicVariableServer "PVDZ_send";
|
publicVariableServer "PVDZ_send";
|
||||||
|
|
||||||
//Give humnaity for good deeds
|
//Give humnaity for good deeds
|
||||||
[player,20] call player_humanityChange;
|
[player,20] call player_humanityChange;
|
||||||
|
|
||||||
_msg = "You gave antibiotics.";
|
_msg = "You gave antibiotics.";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
_msg call dayz_rollingMessages;
|
_msg call dayz_rollingMessages;
|
||||||
|
|||||||
Reference in New Issue
Block a user