GetVehiclePassenger
From Onset Developer Wiki
Description
Get any occupant of a vehicle at a given seat.
Syntax
GetVehiclePassenger(vehicle, seat)
Parameters
- vehicle
The vehicle to get a passenger from. - seat
The seat to the passenger.
Return Value
- Returns the player identifier. If there is no passenger in that seat 0 is returned.
Example
function cmd_passengers(player, vehicle)
if (vehicle == nil) then
return AddPlayerChat(player, "Usage: /passengers <vehicle>")
end
if (not IsValidVehicle(vehicle)) then
return AddPlayerChat(player, "Vehicle (ID: "..vehicle..") does not exist")
end
for i=1, GetVehicleNumberOfSeats(vehicle) do
local passenger = GetVehiclePassenger(vehicle, i)
if (passenger == 0) then
occupants[i] = "Empty"
else
occupants[i] = GetPlayerName(passenger).."("..passenger..")"
end
end
for k, v in ipairs(occupants) do
AddPlayerChat(player, ' Seat '..k..': '..v)
end
end
AddCommand("passengers", cmd_passengers)
See also
- CreateVehicle
- DestroyVehicle
- IsValidVehicle
- GetVehicleCount
- GetAllVehicles
- GetVehicleModel
- GetVehicleModelName
- SetVehicleRespawnParams
- IsVehicleStreamedIn
- GetStreamedVehiclesForPlayer
- GetStreamedVehicles
- SetVehicleLocation
- GetVehicleLocation
- SetVehicleRotation
- GetVehicleRotation
- SetVehicleHeading
- GetVehicleHeading
- SetVehicleHealth
- GetVehicleHealth
- SetVehicleLicensePlate
- GetVehicleVelocity
- GetVehicleDriver
- GetVehiclePassenger
- GetVehicleNumberOfSeats
- SetVehicleColor
- GetVehicleColor
- SetVehicleLinearVelocity
- SetVehicleAngularVelocity
- GetVehicleGear
- SetVehicleHoodRatio
- GetVehicleHoodRatio
- SetVehicleTrunkRatio
- GetVehicleTrunkRatio
- StartVehicleEngine
- StopVehicleEngine
- GetVehicleEngineState
- SetVehicleLightEnabled
- GetVehicleLightState
- SetVehicleDamage
- GetVehicleDamage
- AttachVehicleNitro