SetVehicleLicensePlate: Difference between revisions

From Onset Developer Wiki
Kuzkay (talk | contribs)
No edit summary
Kuzkay (talk | contribs)
No edit summary
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
{{Info|Function|Server|1.0}}
{{Info|Function|Server|1.0}}


{{FuncDescription|Sets vehicle license plate text (up to 13 characters)}}
{{FuncDescription|Sets the vehicle license plate text}}


{{FuncSyntax|SetVehicleLicensePlate(vehicle, text)}}
{{FuncSyntax|SetVehicleLicensePlate(vehicle, text)}}
Line 7: Line 7:
{{FuncParameters}}
{{FuncParameters}}
{{FuncParam|vehicle|Vehicle identifier of vehicle which you wish to change license plate text}}
{{FuncParam|vehicle|Vehicle identifier of vehicle which you wish to change license plate text}}
{{FuncParam|text|New license plate text}}
{{FuncParam|text|New license plate text (up to 13 characters)}}


{{FuncReturnValue|This function has no return value}}
{{FuncReturnValue|This function has no return value}}

Latest revision as of 14:50, 12 August 2019

SetVehicleLicensePlate

Type: Function
Context: Server
Introduced: v1.0

Description

Sets the vehicle license plate text

Syntax

SetVehicleLicensePlate(vehicle, text)

Parameters

  • vehicle
    Vehicle identifier of vehicle which you wish to change license plate text
  • text
    New license plate text (up to 13 characters)

Return Value

  • This function has no return value

Example

function cmd_lp(player, ...)

	local message = table.concat({...}, " ") 

	if (#{...} == 0) then
		return AddPlayerChat(player, "Usage: /lp <new license plate text>")
	end

	local vehicle = GetPlayerVehicle(player)
	if (vehicle == 0) then
		return AddPlayerChat(player, '<span color="#ff0000ee">You must be in a vehicle!</>')
	end

	if (GetPlayerVehicleSeat(player) ~= 1) then
		return AddPlayerChat(player, "You must be the driver of the vehicle")
	end
	
	SetVehicleLicensePlate(vehicle, message)
end
AddCommand("lp", cmd_lp)

See also