SetVehiclePlateText: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
mNo edit summary
(rephrase description)
Line 1: Line 1:
__NOTOC__
__NOTOC__
{{Server client function}}
{{Server client function}}
{{New feature/item|3.0133|1.3.3|5394|
This function can be used to set the numberplate text of a vehicle.
This function can be used to set the numberplate text of a car.
}}
{{New feature/item|3.0153|1.5.2|8077|
It now also changes the numberplate text of any vehicle that has visual numberplates.
}}


==Syntax==
==Syntax==

Revision as of 05:16, 1 December 2021

This function can be used to set the numberplate text of a vehicle.

Syntax

bool setVehiclePlateText( element theVehicle, string numberplate )

OOP Syntax Help! I don't understand this!

Method: vehicle:setPlateText(...)
Variable: .plateText
Counterpart: getVehiclePlateText


Required Arguments

  • theVehicle: the vehicle whose numberplate you want to change.
  • numberplate: a string that will go on the number plate of the car (max 8 characters).

Returns

Returns true if the numberplate was changed successfully, or false if invalid arguments were passed

Requirements

This template will be deleted.

Example

function PlateText(thePlayer,commandName,text)
	local Vehicle = getPedOccupiedVehicle(thePlayer)
	if Vehicle then
		if text then
			setVehiclePlateText( Vehicle, text )
		else
			outputChatBox("You must enter a message or the plate is incorrect.",thePlayer)
		end
	else
		outputChatBox("You must be in a Vehicle.",thePlayer)
	end
end
addCommandHandler("setplate",PlateText)

See Also