- Documentation
- Shared functions
- getVehicleMaxPassengers
Function
getVehicleMaxPassengers
Returns the number of passenger seats of a vehicle or model (not counting the driver): e.g. 1 for a two-seater, 3 for a saloon. The data comes from the game, so the server only knows it once a client reports it (usually after the model first appears for a player); before that it returns false.
Syntax
int getVehicleMaxPassengers(vehicle/int vehicleOrModel)Arguments
vehicleOrModelvehicle/int- A vehicle or a model ID.
Returns
The number of passenger seats, or false.
Example
local vehicle = getPedOccupiedVehicle(localPlayer)
if vehicle then
outputChatBox("Miejsc dla pasazerow: " .. tostring(getVehicleMaxPassengers(vehicle)))
end
See also
getModelMaxPassengersReturns a model's number of passenger seats after applying the limit fromsetModelMaxPassengers.setModelMaxPassengersLimits a model's passenger seats: players cannot get into seats with a higher number (the server cancels entering). Also works for new models fromengineRequestModel. You cannot add seats the base model does not have.nilorfalseremoves the limit.getVehicleOccupantsReturns everyone (players and peds) sitting in the vehicle as a table of seat number → occupant. Empty seats are not in the table, so loop over it withpairs, notipairs(seat 0 is not an array index).setVehicleMaxPassengersStores a model's number of passenger seats on the server. The game client usually does this automatically; a script can provide it earlier sogetVehicleMaxPassengersknows it from the start.