hi,

Originally Posted by
Incubus
u right, not works in MP
Hey Inc,
Not anymore
I rewrote the script to make it MP compatable and I cleaned the code to have better performance.
Here's the first version. It is more performance hungry but when you getin/getout a vehicle the holder addAction appears faster. It is SP/MP compatable but I recommand it for SP.
back_packv1.sqs
Code:
;******************************************************************************************
;Multiple Rifle Script Originaly Made By BLIP
;All credits go to the autor(s)
;Modified by Nikiller for MP compatability and code cleaning v0.9b
;NOTE: place a game logic named server somewhere on your map
;NOTE2: it takes 30 sec for the holder addAction to appear at the mission start
;NOTE3: In MP holder addAction will appear for all players
;NOTE4: If you get in a vehicle it can take some times for the addAction to appear again
;[unitName,ammoType,numberOfAmmo,weaponType,numberOfWeapon] exec "scriptname.sqs"
;example: [guy1,"SteyrMag",3,"Steyr",1] exec "scriptname.sqs"
;WARNING: Don't put too much weapons in the holder or it could create an ammo bug (ofp bug)
;******************************************************************************************
_u = _this select 0
_ammotype = _this select 1
_ammonum = _this select 2
_weapontype = _this select 3
_weaponnum = _this select 4
_pu=getPos _u
_px=_pu select 0
_py=_pu select 1
_pz=_pu select 2
_pz=_pz-0.5
_s=local server
_d=0.5
? _s: _holder="weaponHolder" createVehicle [0,0,0]
~2
if (_s) then {_holder setPos [_px,_py,_pz]}
@ !(isNull _holder)
_holder addMagazineCargo [_ammotype,_ammonum]
_holder addWeaponCargo [_weapontype,_weaponnum]
if (_s) then {} else {goto "ende"}
#loop
~_d
if (alive _u) then {} else {goto "ende"}
_pu=getPos _u
_px=_pu select 0
_py=_pu select 1
_pz=_pu select 2
_pz=_pz-0.5
_holder setPos [_px,_py,_pz]
if (vehicle _u==_u) then {goto "loop"}
#loop2
~_d
if (alive _u) then {} else {goto "ende"}
_pu=getPos _u
_px=_pu select 0
_py=_pu select 1
_pz=_pu select 2
_pz=_pz+500
_holder setPos [_px,_py,_pz]
if (vehicle _u==_u) then {goto "loop"} else {goto "loop2"}
#ende
exit
Here's the second version more suited for MP (better performance) but when you getin/getout a vehicle the holder addAction appear slower (sometimes 30 sec after you get out)
back_packv2.sqs
Code:
;******************************************************************************************
;Multiple Rifle Script Originaly Made By BLIP
;All credits go to the autor(s)
;Modified by Nikiller for MP compatability and code cleaning v0.9b
;NOTE: place a game logic named server somewhere on your map
;NOTE2: it takes 30 sec for the holder addAction to appear at the mission start
;NOTE3: In MP holder addAction will appear for all players
;NOTE4: If you get in a vehicle it can take some times for the addAction to appear again
;[unitName,ammoType,numberOfAmmo,weaponType,numberOfWeapon] exec "scriptname.sqs"
;example: [guy1,"SteyrMag",3,"Steyr",1] exec "scriptname.sqs"
;WARNING: Don't put too much weapons in the holder or it could create an ammo bug (ofp bug)
;******************************************************************************************
_u = _this select 0
_ammotype = _this select 1
_ammonum = _this select 2
_weapontype = _this select 3
_weaponnum = _this select 4
_pu=getPos _u
_px=_pu select 0
_py=_pu select 1
_pz=_pu select 2
_pz=_pz-0.5
_s=local server
_d=0.5
? _s: _holder="weaponHolder" createVehicle [0,0,0]
~2
if (_s) then {_holder setPos [_px,_py,_pz]}
@ !(isNull _holder)
_holder addMagazineCargo [_ammotype,_ammonum]
_holder addWeaponCargo [_weapontype,_weaponnum]
if (_s) then {} else {goto "ende"}
#loop
~_d
if (alive _u) then {} else {goto "ende"}
_pu=getPos _u
_px=_pu select 0
_py=_pu select 1
_pz=_pu select 2
_pz=_pz-0.5
_holder setPos [_px,_py,_pz]
if (vehicle _u==_u) then {goto "loop"}
#in
~_d
if (vehicle _u==_u) then {goto "loop"}
_holder setPos [0,0,0]
#loop2
~_d
if (alive _u) then {} else {goto "ende"}
if (vehicle _u==_u) then {goto "loop"} else {goto "loop2"}
#ende
exit
Here's a demo to show how it works.
DEMO LINK
cya.
Nikiller.