getVehicleOccupants
Compartido
Devuelve todos los peds y jugadores dentro de un vehículo.
table|false getVehicleOccupants(vehicle vehicle)
Parámetros
| Nombre | Tipo | Descripción |
|---|---|---|
| vehicle | vehicle | El vehículo. |
Retorno
Una tabla de asiento → ped o jugador, con el conductor en el asiento 0; o false si el elemento no es un vehículo.
Ejemplo
addCommandHandler("ocupantes", function(player)
local vehicle = getPedOccupiedVehicle(player)
if not vehicle then return end
for seat, occupant in pairs(getVehicleOccupants(vehicle)) do
outputDebugString("seat " .. seat .. " is taken")
end
end)AtenciónEl conductor está en la clave
0, que ipairs y # no ven. Recorre la tabla con pairs.