GetVehicleID: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
 
No edit summary
Line 2: Line 2:


__NOTOC__  
__NOTOC__  
This fake function is for use with blah & blah and does blahblahblabhalbhl
This function retrieves the ID of a vehicle as an integer value.


==Syntax==  
==Syntax==  
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
int getVehicleID ( vehicle vehicle )             
int getVehicleID ( vehicle theVehicle )             
</syntaxhighlight>  
</syntaxhighlight>  


===Required Arguments===  
===Required Arguments===  
*'''argumentName:''' description
*'''theVehicle:''' The vehicle you want to get the ID of.
 
===Optional Arguments===
{{OptionalArg}}
*'''argumentName2:''' descriptiona
*'''argumentName3:''' description


===Returns===
===Returns===
Returns ''true'' if blah, ''false'' otherwise.
Returns an integer containing the requested vehicle's ID, or false if the vehicle passed to the function is invalid.


==Example==  
==Example==  
This example does...
This example checks whether a player enters an AT-400 or a Shamal. If they do, it announces it to the chat specifying what vehicle was stolen.
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
--This line does...
-- add the event to the event handler
blabhalbalhb --abababa
addEventHandler ( "onPlayerEnterVehicle", root, "onPlayerEnterVehicle" )
--This line does this...
function onPlayerEnterVehicle ( vehicle, seat, jacked ) --when someone enters a vehicle
mooo
  id = getVehicleID ( vehicle ) -- get the ID of the vehicle
  if id == 519 or 577 then --if the vehicle is one of these two planes
    vehiclename = getVehicleName ( vehicle ) -- define the vehicle name
    outputChatBox ( "Someone stole the "..vehiclename.."!" ) -- announce that someone stole the plane
  end
end
</syntaxhighlight>
</syntaxhighlight>


==See Also==
==See Also==
{{FunctionArea_Functions}}
{{IDs}}
 
{{Vehicle_functions}}

Revision as of 01:59, 30 July 2006


This function retrieves the ID of a vehicle as an integer value.

Syntax

int getVehicleID ( vehicle theVehicle )             

Required Arguments

  • theVehicle: The vehicle you want to get the ID of.

Returns

Returns an integer containing the requested vehicle's ID, or false if the vehicle passed to the function is invalid.

Example

This example checks whether a player enters an AT-400 or a Shamal. If they do, it announces it to the chat specifying what vehicle was stolen.

-- add the event to the event handler
addEventHandler ( "onPlayerEnterVehicle", root, "onPlayerEnterVehicle" )
function onPlayerEnterVehicle ( vehicle, seat, jacked ) --when someone enters a vehicle
  id = getVehicleID ( vehicle ) -- get the ID of the vehicle
  if id == 519 or 577 then --if the vehicle is one of these two planes
     vehiclename = getVehicleName ( vehicle ) -- define the vehicle name 
     outputChatBox ( "Someone stole the "..vehiclename.."!" ) -- announce that someone stole the plane
  end
end

See Also

GTASA IDs (vehicles, weapons, weathers, characters, colors): http://info.vces.net/ (Special thanks to Brophy and Ratt for making these lists)