OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: websnake on 23 Oct 2005, 20:24:03
-
I want to be able to detect if a player has a magazine.
For example the player has an m21 magazine, he doesnt have a m21 rifle but i want to be able to know if he holds a magazine.
I know i can use 'hasweapon' to know if the man has a certain weapon, but i need something like this for magazines.
cheers
-
Hmmm........
magazines player
maybe?
Planck
-
I've tried 'magazines player' and this returns an array of mags held by the player, how do i within a script search this array for one specific type of mag. for example an m21 magazine?
-
if ("M21" in magazines player) then {....} else {....}
-
how do i run this for more than one player?
-
ok i think i have it working for more than one player, tho it needs more testing. I have now hit another problem, i'm trying to add an action to the player when he has an m21 mag
example - _u = _this select 0
_mags = magazines _u
if ("m21" in magazines _u) then {_u addaction ["Got one","true.sqs"]}
if ("m60" in magazines _u) then {_u addaction ["Got two","true1.sqs"]}
problem is that it keeps adding the same addaction to the menu over and over again, i also want to delete the action when the script true or true1 has been fired. any suggestions?