Home   Help Search Login Register  

Author Topic: Locking Unlocking vehicles?  (Read 911 times)

0 Members and 1 Guest are viewing this topic.

Jim666

  • Guest
Locking Unlocking vehicles?
« on: 13 Dec 2004, 21:24:00 »
How do i make it so a sspecific player can have like his own vehicle? and only he can lock and unlock it?

Offline macguba

  • Former Staff
  • ****
    • macguba's operation flashpoint page
Re:Locking Unlocking vehicles?
« Reply #1 on: 13 Dec 2004, 21:35:06 »
If a given vehicle may be driven only by a certain player (I'm assuming this is for MP) then I would suggest that you use addAction to give the player the power to lock and unlock his own wagon.
Plenty of reviewed ArmA missions for you to play

Offline Triggerhappy

  • Contributing Member
  • **
  • Llama, it's what's for dinner.
Re:Locking Unlocking vehicles?
« Reply #2 on: 13 Dec 2004, 21:38:40 »
heres an idea:
in the player's init field put:
owner = this

then on the car that he will unlock put:
this addaction ["Unlock Car","unlock.sqs"]

then this is the unlock.sqs:
Code: [Select]
_car = this select 0
_unit = _this select 1
_action = _this select 2

?!(_unit == owner):hint "This isn't your car!";exit
_car removeaction _action
_car lock false
;here you could add a sound like unlocking a door
_car addaction ["Lock car","lock.sqs"]
exit

and this will be lock.sqs, which is added by the unlock script
Code: [Select]
_car = _this select 0
_unit = _this select 1
_action = _this select 2
?!(_unit == owner):hint "This isn't your car!";exit
_car removeaction _action
_car lock true
_car addaction ["Unlock car","unlock.sqs"]
exit

that will work with the car starting locked, if it starts unlocked, then switch the action to the lock script
« Last Edit: 15 Dec 2004, 15:00:18 by Triggerhappy »

Jim666

  • Guest
Re:Locking Unlocking vehicles?
« Reply #3 on: 15 Dec 2004, 11:34:23 »
I got this error 'action_ = this select 2|#|': Error Select: Type Object, expected Array
« Last Edit: 15 Dec 2004, 11:40:32 by Jim666 »

Jim666

  • Guest
Re:Locking Unlocking vehicles?
« Reply #4 on: 15 Dec 2004, 11:45:54 »
Nvm fixed it