CreateVehicle: Difference between revisions

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


==Syntax==
==Syntax==
  vehicle createVehicle ( model, x, y, z [, rx, ry, rz ] )
  [[vehicle]] createVehicle ( model, x, y, z [, rx, ry, rz ] )


==Example==
==Example==
  function onPlayerChat ( player, chat )
  function [[onPlayerChat]] ( player, chat )
   if ( strtok ( chat, 1, 32 ) == "!createhydra" ) then
   if ( [[strtok]] ( chat, 1, 32 ) == "!createhydra" ) then
     x, y, z = getPlayerPosition ( player )
     x, y, z = [[getPlayerPosition]] ( player )
     createVehicle ( 520, x + 5, y, z )
     '''createVehicle''' ( 520, x + 5, y, z )
     playerPM ( player, "You got a hydra" )
     [[playerPM]] ( player, "You got a hydra" )
   end
   end
  end
  end

Revision as of 13:11, 24 March 2006

Description

This function creates a vehicle and returns a handle to the created vehicle. If it fails, it will return false. This can happen if you exceed the upper vehicle limit at 65535 or due to an another unspecified future reason.

Syntax

vehicle createVehicle ( model, x, y, z [, rx, ry, rz ] )

Example

function onPlayerChat ( player, chat )
  if ( strtok ( chat, 1, 32 ) == "!createhydra" ) then
    x, y, z = getPlayerPosition ( player )
    createVehicle ( 520, x + 5, y, z )
    playerPM ( player, "You got a hydra" )
  end
end