Home   Help Search Login Register  

Author Topic: Get vehicle type.  (Read 764 times)

0 Members and 1 Guest are viewing this topic.

CopyrightPhilly

  • Guest
Get vehicle type.
« on: 22 Dec 2004, 12:23:41 »
i'm been searching the forums and the command reference but i couldnt find anything.

How would i return the type (not name) of a vehicle?
Say the vehicle is a Abrams it would return "M1Abrams"

cheers

Offline Artak

  • The old beanbag shaker
  • Former Staff
  • ****
  • You want to talk about it, yes?
    • OFP Team Finlanders
Re:Get vehicle type.
« Reply #1 on: 22 Dec 2004, 12:33:11 »
vehicletype = typeOf unitname

 :wave:
Not all is lost.

CopyrightPhilly

  • Guest
Re:Get vehicle type.
« Reply #2 on: 22 Dec 2004, 12:42:25 »
yeai i tryed that but like the following:

vehicle init:

[this] exec "script.sqs"



script.sqs:

_unit=_this select 0
_type = typeOf _unit
hint format["%1",_type]
end




but when i run that i get an error with the _unit part:
_type = typeOf #_unit

any ideas?

cheers
« Last Edit: 22 Dec 2004, 12:42:51 by CopyrightPhilly »

Offline Artak

  • The old beanbag shaker
  • Former Staff
  • ****
  • You want to talk about it, yes?
    • OFP Team Finlanders
Re:Get vehicle type.
« Reply #3 on: 22 Dec 2004, 12:48:46 »
Hmm.. Can't see anything wrong with it. Try hint format ["%1",_unit] and see what it gives you.

by the way, what version are you running? typeof was added in 1.85 or was it 1.91  :-X
Not all is lost.

CopyrightPhilly

  • Guest
Re:Get vehicle type.
« Reply #4 on: 22 Dec 2004, 12:51:11 »
that would explane why that one dosnt work then...

I am making it for 1.46 and not res...

is there any way to do it for 1.46?

cheers

Offline Artak

  • The old beanbag shaker
  • Former Staff
  • ****
  • You want to talk about it, yes?
    • OFP Team Finlanders
Re:Get vehicle type.
« Reply #5 on: 22 Dec 2004, 12:56:35 »
No not that I know of.
That's why the typeof command was added, to solve situations like this.  :-\
Not all is lost.

CopyrightPhilly

  • Guest
Re:Get vehicle type.
« Reply #6 on: 22 Dec 2004, 12:58:16 »
k, what i'll do then is add the type the the exec...

so say:
[this,M1Abrams] exec "script.sqs"

that should solve me problem...

thanks for the help anyway Artak

Offline Triggerhappy

  • Contributing Member
  • **
  • Llama, it's what's for dinner.
Re:Get vehicle type.
« Reply #7 on: 22 Dec 2004, 13:47:57 »
vehicle types are strings, so it would be "M1Abrams"