SetVehiclePlateText: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
(Created page with "{{Server client function}} __NOTOC__ {{New feature/item|3.0140|1.3.3|5394| This function can be used to change/set the numberplate text from a car. }} ==Syntax== <syntaxhighlight lang="lua"> f...")
 
Line 22: Line 22:
==Example==
==Example==
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
-- Todo
function PlateText(thePlayer,commandName,text)
Vehicle = getPedOccupiedVehicle(thePlayer)
if Vehicle then
if text then
setVehiclePlateText( Vehicle, tostring(text) )
else
outputChatBox("You must enter a message.",thePlayer)
end
else
outputChatBox("You must be a Vehicle.",thePlayer)
end
end
addCommandHandler("setplate",PlateText)
</syntaxhighlight>
</syntaxhighlight>
==See Also==
==See Also==
{{Vehicle_functions}}
{{Vehicle_functions}}

Revision as of 02:48, 15 May 2013

This function can be used to change/set the numberplate text from a car.

Syntax

float setVehiclePlateText( element theVehicle, string numberplate )

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)
	Vehicle = getPedOccupiedVehicle(thePlayer)
	if Vehicle then
		if text then
			setVehiclePlateText( Vehicle, tostring(text) )
		else
			outputChatBox("You must enter a message.",thePlayer)
		end
	else
		outputChatBox("You must be a Vehicle.",thePlayer)
	end
end
addCommandHandler("setplate",PlateText)

See Also