GetVehicleNumberOfSeats: Difference between revisions

From Onset Developer Wiki
No edit summary
No edit summary
Line 8: Line 8:
{{FuncParam|vehicle|The vehicle identifier.}}
{{FuncParam|vehicle|The vehicle identifier.}}


{{FuncReturnValue|Number of valid seats the given vehicle has.}}
{{FuncReturnValue|Number of valid seats the given vehicle has. Returns '''false''' on error.}}


== Example ==
== Example ==

Revision as of 13:09, 22 March 2019

GetVehicleNumberOfSeats

Type: Function
Context: Server
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