OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: Jim666 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?
-
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.
-
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:
_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
_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
-
I got this error 'action_ = this select 2|#|': Error Select: Type Object, expected Array
-
Nvm fixed it