GetVehicleNameFromID: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
Line 15: Line 15:
Returns ''true'' if vehicle exists, ''false'' otherwise.
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.
<syntaxhighlight lang="lua">
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
</syntaxhighlight>


==See Also==
==See Also==
{{Vehicle functions}}
{{Vehicle functions}}

Revision as of 03:32, 9 September 2006


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.


See Also