Baseplate Posted November 9, 2013 Share Posted November 9, 2013 How to get a vehicle's unoccupied seat? Link to comment
Spajk Posted November 9, 2013 Share Posted November 9, 2013 (edited) This should do the trick: function getUnoccupiedSeats(vehicle) local seats = {} local maxp = getVehicleMaxPassengers(vehicle) for i = 0, maxp-1 do if(not getVehicleOccupant(vehicle, i))then table.insert(seats, i) end end if(#seats > 0)then return seats else return false end end Edited November 9, 2013 by Guest Link to comment
Baseplate Posted November 9, 2013 Author Share Posted November 9, 2013 So should I loop through it? Link to comment
Castillo Posted November 9, 2013 Share Posted November 9, 2013 https://wiki.multitheftauto.com/wiki/Ge ... eOccupants That function also returns the occupants. Link to comment
Baseplate Posted November 23, 2013 Author Share Posted November 23, 2013 How can I exactly use it? Link to comment
glowdemon1 Posted November 23, 2013 Share Posted November 23, 2013 Didn't test the function spaijk made but this should work if you ofcourse add spaijk's function. for a,b in pairs(getUnoccupiedSeats(vehicle)) do outputChatBox("Unoccupied seats : " ..b) end 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