GetVehicleNumberOfSeats: Difference between revisions

From Onset Developer Wiki
No edit summary
28days (talk | contribs)
Add client support for v1.1.0
 
(One intermediate revision by one other user not shown)
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.}}
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 ==

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