Home   Help Search Login Register  

Author Topic: Detecting Mags  (Read 837 times)

0 Members and 1 Guest are viewing this topic.

websnake

  • Guest
Detecting Mags
« 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

Offline Planck

  • Honoured
  • Former Staff
  • ****
  • I'm never wrong ....I'm just not always right !
Re:Detecting Mags
« Reply #1 on: 23 Oct 2005, 20:27:27 »
Hmmm........

magazines player

maybe?


Planck
I know a little about a lot, and a lot about a little.

websnake

  • Guest
Re:Detecting Mags
« Reply #2 on: 23 Oct 2005, 21:41:22 »
 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?

Offline THobson

  • OFPEC Patron
  • Former Staff
  • ****
Re:Detecting Mags
« Reply #3 on: 23 Oct 2005, 22:55:38 »
if ("M21" in magazines player) then {....} else {....}
« Last Edit: 23 Oct 2005, 22:55:50 by THobson »

websnake

  • Guest
Re:Detecting Mags
« Reply #4 on: 24 Oct 2005, 00:33:29 »
how do i run this for more than one player?

websnake

  • Guest
Re:Detecting Mags
« Reply #5 on: 24 Oct 2005, 01:12:53 »
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?