GetVehicleNumberOfSeats: Difference between revisions

From Onset Developer Wiki
No edit summary
(Add client support for v1.1.0)
 
Line 1: Line 1:
{{Info|Function|Server|1.0}}
{{Info|Function|Server & Client|1.0}}


{{FuncDescription|Returns the amount of seats a given vehicle has.}}
{{FuncDescription|Returns the amount of seats a given vehicle has.}}

Latest revision as of 20:47, 7 March 2020

GetVehicleNumberOfSeats

Type: Function
Context: Server & Client
Introduced: v1.0

Description

Returns the amount of seats a given vehicle has.

Syntax

GetVehicleNumberOfSeats(vehicle)

Parameters

  • vehicle
    The vehicle identifier.

Return Value

  • Number of valid seats the given vehicle has. Returns false on error.

Example

function cmd_vehicleseats(player, vehicle)
	if (vehicle == nil) then
		return AddPlayerChat(player, "Usage: /vehicleseats <vehicle>")
	end

	if (not IsValidVehicle(vehicle)) then
		return AddPlayerChat(player, "Vehicle (ID: "..vehicle..") does not exist")
	end

	local seats = GetVehicleNumberOfSeats(vehicle)

	AddPlayerChat(player, "Vehicle "..vehicle.." has "..seats)
end
AddCommand("passengers", cmd_passengers)

See also