Last active
April 11, 2017 20:36
-
-
Save bosoy/bd633f270e6c75d7be729daef0cc0658 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (secondaryweapon player call bis_fnc_baseWeapon == "rhs_weap_rpg7" && {(secondaryweapon player != currentweapon player)}) then | |
{ | |
private ["_magazine"]; | |
_magazine = (secondaryWeaponMagazine player) select 0; | |
if !(isnil "_magazine") then | |
{ | |
player removeSecondaryWeaponItem _magazine; | |
if (player canAddItemToBackpack _magazine) then | |
{ | |
player addItemToBackpack _magazine; | |
}else{ | |
_holder = createVehicle ["WeaponHolderSimulated",player modelToWorld [0,2,0],[],0, "CAN_COLLIDE"]; | |
_holder addMagazineCargoGlobal [_magazine, 1]; | |
}; | |
}; | |
}; | |
onRPGUse = ' | |
params ["_target", "", "", "_action", "", "", "", "", "", "", "_event"]; | |
if (_action in ["HandGunOff","HandGunOn"]) then | |
{ | |
if (_event == "Action" && {(secondaryweapon _target call bis_fnc_baseWeapon == "rhs_weap_rpg7")}) then | |
{ | |
private ["_magazine"]; | |
_magazine = (secondaryWeaponMagazine player) select 0; | |
if !(isnil "_magazine") then | |
{ | |
_target removeSecondaryWeaponItem _magazine; | |
if (_target canAddItemToBackpack _magazine) then | |
{ | |
_target addItemToBackpack _magazine; | |
}else{ | |
_holder = createVehicle ["WeaponHolderSimulated",_target modelToWorld [0,2,0],[],0, "CAN_COLLIDE"]; | |
_holder addMagazineCargoGlobal [_magazine, 1]; | |
}; | |
}; | |
}; | |
}; | |
false | |
'; | |
InventoryClosed = ' | |
_target = _this select 0; | |
if (secondaryweapon _target call bis_fnc_baseWeapon == "rhs_weap_rpg7" && {(secondaryweapon _target != currentweapon _target)}) then | |
{ | |
private ["_magazine"]; | |
_magazine = (secondaryWeaponMagazine player) select 0; | |
if !(isnil "_magazine") then | |
{ | |
_target removeSecondaryWeaponItem _magazine; | |
if (_target canAddItemToBackpack _magazine) then | |
{ | |
_target addItemToBackpack _magazine; | |
}else{ | |
_holder = createVehicle ["WeaponHolderSimulated",_target modelToWorld [0,2,0],[],0, "CAN_COLLIDE"]; | |
_holder addMagazineCargoGlobal [_magazine, 1]; | |
}; | |
}; | |
}; | |
'; | |
TakeClosed = ' | |
_target = _this select 0; | |
_ammo = _this select 3; | |
if (secondaryweapon _target call bis_fnc_baseWeapon == "rhs_weap_rpg7" && {(secondaryweapon _target != currentweapon _target)}) then | |
{ | |
private ["_magazine"]; | |
_magazine = (secondaryWeaponMagazine player) select 0; | |
if !(isnil "_magazine") then | |
{ | |
_target removeSecondaryWeaponItem _magazine; | |
if (_target canAddItemToBackpack _magazine) then | |
{ | |
_target addItemToBackpack _magazine; | |
}else{ | |
_holder = createVehicle ["WeaponHolderSimulated",_target modelToWorld [0,2,0],[],0, "CAN_COLLIDE"]; | |
_holder addMagazineCargoGlobal [_magazine, 1]; | |
}; | |
}; | |
}; | |
'; | |
inGameUISetEventHandler ["Action", onRPGUse]; | |
player addEventHandler ["InventoryClosed",InventoryClosed]; | |
player addEventHandler ["Take",TakeClosed]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment