dontdo Posted June 20, 2016 Share Posted June 20, 2016 Can't unlock vehicles in the colSphere function Lock (EnterPerson) local car = getPedOccupiedVehicle (EnterPerson) local x,y,z = getElementPosition( EnterPerson ) local col = createColSphere ( x,y,z, 10 ) local veh = getElementsWithinColShape (col, "vehicle") if isPedInVehicle ( EnterPerson ) then setVehicleLocked (car, true) outputChatBox ("locked", EnterPerson) end if isPedInVehicle ( EnterPerson ) == false then setVehicleLocked (veh, false) outputChatBox ("Unlocked", EnterPerson) end end addCommandHandler ("Lock", Lock, false , false) Link to comment
Hale Posted June 20, 2016 Share Posted June 20, 2016 'getElementsWithinColShape' - Returns a table containing all the elements inside the colshape, of the specified type. Returns an empty table if there are no elements inside. Returns false if the colshape is invalid. Link to comment
Captain Cody Posted June 20, 2016 Share Posted June 20, 2016 function Lock (EnterPerson) local car = getPedOccupiedVehicle (EnterPerson) local x,y,z = getElementPosition( EnterPerson ) local col = createColSphere ( x,y,z, 10 ) local veh = getElementsWithinColShape (col, "vehicle") if isPedInVehicle ( EnterPerson ) then setVehicleLocked (car, true) outputChatBox ("locked", EnterPerson) end if isPedInVehicle ( EnterPerson ) == false then for i,v in pairs(veh) do setVehicleLocked (v, false) outputChatBox ("Unlocked", EnterPerson) end end addCommandHandler ("Lock", Lock, false , false) Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now