GetVehicleNumberOfSeats: Difference between revisions

From Onset Developer Wiki
Created page with "{{Info|Function|Server|1.0}} {{FuncDescription|__EDIT_ME__}} {{FuncSyntax|GetVehicleNumberOfSeats(vehicle)}} {{FuncParameters}} {{FuncParam|vehicle|__EDIT_ME__}} {{FuncRet..."
 
No edit summary
Line 1: Line 1:
{{Info|Function|Server|1.0}}
{{Info|Function|Server|1.0}}


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


{{FuncSyntax|GetVehicleNumberOfSeats(vehicle)}}
{{FuncSyntax|GetVehicleNumberOfSeats(vehicle)}}


{{FuncParameters}}
{{FuncParameters}}
{{FuncParam|vehicle|__EDIT_ME__}}
{{FuncParam|vehicle|The vehicle identifier.}}


{{FuncReturnValue|__EDIT_ME__}}
{{FuncReturnValue|Number of valid seats the given vehicle has.}}


== Example ==
== Example ==
__EDIT_ME__
<syntaxhighlight lang="Lua">
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)
</syntaxhighlight>


{{RelatedFunctions}}
{{RelatedFunctions}}
__EDIT_ME__
{{VehicleFunctions}}

Revision as of 13:08, 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.

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