Home   Help Search Login Register  

Author Topic: magazine, need help  (Read 424 times)

0 Members and 1 Guest are viewing this topic.

CopyrightPhilly

  • Guest
magazine, need help
« on: 14 Apr 2004, 00:23:19 »
ok i made a little scipt that will add 1 magazine to the player that activated the scipt, i need a little bit of code that will quary if they have full ammo or not, and if they have then to goto "full"...

so if there any code that will quary if the player has full ammo?

cheers, Philly

Offline myke13021

  • Contributing Member
  • **
  • Myke
Re:magazine, need help
« Reply #1 on: 14 Apr 2004, 01:23:58 »
uhm...could it be you look for this?

magazines vehicle

Operand types:
vehicle: Object
Type of returned value:
Array
Description:
Returns array of types names of all vehicle's magazines.

Example:
magazines player
 
:edit:
or maybe this:

unit ammo magazine

Operand types:
unit: Object
magazine: String
Type of returned value:
Number
Description:
Count how many shots are left for given magazine type.

Example:
player ammo "M16"
« Last Edit: 14 Apr 2004, 01:26:15 by myke13021 »

Offline dmakatra

  • Members
  • *
  • Better known as Armsty
Re:magazine, need help
« Reply #2 on: 14 Apr 2004, 16:30:47 »
If he does have full there will be no error or anything, the command will just fly away...

I wonder what kind of drugs the commands use... Can I get some? ::) :P

:beat: *Gets Shot* :beat:

Kammak

  • Guest
Re:magazine, need help
« Reply #3 on: 15 Apr 2004, 01:10:07 »
One thing to be aware of with those functions - the strings returned are odd regarding cases.

If you try to do a match against the string values returned from magazines, its a nightmare.  Somewhere along the way OFP changes the case of some of them, and they don't match what is defined in the units config.cpp

example: the config says the guy will have "mym4mag", "mym4mag"
But magazines will return "Mym4mag", "Mym4mag" on one guy, but on another guy it will return "MyM4mag", "MyM4mag"

so trying to do a
?_mag=="mym4mag":

turns into
?_mag=="mym4mag" || _mag=="MyM4mag" || _mag=="MyM4Mag"
etc....


I ran into this trying to make a very generalized swap out script for ammo - looking at each magazine and replacing it with something else...ended up aborting it because of the case issue.  If OFP had some case functions (UCase, LCase, etc...) it would solve the issue, but alas no joy.