GetVehicleNameFromID

From Multi Theft Auto: Wiki
Revision as of 03:31, 9 September 2006 by Ransom (talk | contribs)
Jump to navigation Jump to search


Allows you to input a vehicleID and return a vehicle name from that ID

Syntax

string getVehicleNameFromID ( int id )            

Required Arguments

  • id: This is a vehicle id. See vehicle to see what values will return names (true).

Returns

Returns true if vehicle exists, false otherwise.

Example

This example allows you to use the chatbot to type a command. The command is used to check the vehiclename of the vehicleid the user entered.

addEventHandler ( "onConsole", root, "onConsole" )
function onConsole ( message ) 
	local command = gettok(message, 1, 32) --A varible called command stores a message typed in the chatbox by a player
		if (command == "!namevehicle #") then --If the typed chat is equal to this, the code commences
			outputChatBox ( "The name of # is".. vehiclename, source ) --the chatbox outputs the vehiclename of the vehicleid the player entered
		end
end

See Also