SetVehiclePlateText: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
(added info about issue #8158)
(Updated according to r7939)
Line 2: Line 2:
{{Server client function}}
{{Server client function}}
{{New feature/item|3.0133|1.3.3|5394|
{{New feature/item|3.0133|1.3.3|5394|
This function can be used to change/set the numberplate text of a car.
This function can be used to set the numberplate text of a car.
}}
{{New feature/item|3.0160|1.6.0|7939|
It now also changes the numberplate text of any vehicle that has visual numberplates.
}}
}}


Line 36: Line 39:
addCommandHandler("setplate",PlateText)
addCommandHandler("setplate",PlateText)
</syntaxhighlight>
</syntaxhighlight>
== Issues ==
{{Issues|
{{Issue|8158|setVehiclePlateText doesn't seem to change visual plate texture on most (if not all) motorcycles.}}
}}


==See Also==
==See Also==
{{Vehicle_functions}}
{{Vehicle_functions}}

Revision as of 16:08, 6 April 2016

This function can be used to set the numberplate text of a car. It now also changes the numberplate text of any vehicle that has visual numberplates.

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

Minimum server version 1.3.3
Minimum client version 1.3.3

Note: Using this feature requires the resource to have the above minimum version declared in the meta.xml <min_mta_version> section. e.g. <min_mta_version server="1.3.3" client="1.3.3" />

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.",thePlayer)
		end
	else
		outputChatBox("You must be in a Vehicle.",thePlayer)
	end
end
addCommandHandler("setplate",PlateText)

See Also