# VEHICLE::_CREATE_MISSION_TRAIN

- **Hash:** `0xC239DBD9A57D2A71`
- **Namespace:** VEHICLE
- **Runtime name (Lua/JS):** `CreateMissionTrain`
- **Side:** client (game native)
- **Name status:** community guess (may change)
- **Documentation:** described
- **Since game build:** 1207
- **URL:** https://natives.borderlinerp.com/natives/VEHICLE/_CREATE_MISSION_TRAIN

## Signature

```c
Vehicle _CREATE_MISSION_TRAIN(Hash configHash, float x, float y, float z, BOOL direction, BOOL passengers, BOOL p6, BOOL conductor);
```

## Parameters

- `configHash` (`Hash`)
- `x` (`float`)
- `y` (`float`)
- `z` (`float`)
- `direction` (`BOOL`)
- `passengers` (`BOOL`)
- `p6` (`BOOL`)
- `conductor` (`BOOL`)

## Returns

`Vehicle`

## Description

*Source: alloc8or RDR3 NativeDB*

configHash: https://alloc8or.re/rdr3/doc/enums/eTrainConfig.txt
For more information, see trainconfigs.ymt
To make the train AI controlled, set conductor to true and set the speed once.

*Source: femga rdr3_discoveries*

```
0xc239dbd9a57d2a71 (By Smallos)

N_0xc239dbd9a57d2a71(trainHash, GetEntityCoords(PlayerPedId()), 0, 0, 1, 1)
It's for trains
Will automatically spawn a train on the closest tracks to the coords specified.
```

## Usage

### Lua

```lua
local retval = CreateMissionTrain(configHash, x, y, z, direction, passengers, p6, conductor)

-- always available, by hash
local retval = Citizen.InvokeNative(0xC239DBD9A57D2A71, configHash, x, y, z, direction, passengers, p6, conductor, Citizen.ResultAsInteger())
```

### JavaScript

```js
const retval = CreateMissionTrain(configHash, x, y, z, direction, passengers, p6, conductor);

// by hash
const retval = Citizen.invokeNative('0xC239DBD9A57D2A71', configHash, x + 0.0000001, y + 0.0000001, z + 0.0000001, direction, passengers, p6, conductor, Citizen.returnResultAnyway(), Citizen.resultAsInteger());
```

### C#

```csharp
int retval = Function.Call<int>((Hash)0xC239DBD9A57D2A71, configHash, x, y, z, direction, passengers, p6, conductor);
```

- Hash parameters: the named function also accepts a string and hashes it for you; `Citizen.InvokeNative` needs the number — pass `joaat("name")` or a backtick literal like `` `name` ``.
- Float parameters: Lua integers (`10`, or whole numbers decoded from NUI/JSON) are sent as ints and read as garbage. Write `10.0` or `value + 0.0`. The generated JS wrappers add `0.0000001` to non-zero floats for the same reason.
- The name is a community guess and may change. If the named call is missing in your client build, use `InvokeNative` with the hash — it always works.

## See also

- [VEHICLE::DELETE_MISSION_TRAIN](https://natives.borderlinerp.com/natives/VEHICLE/DELETE_MISSION_TRAIN.md)

*Sources: alloc8or RDR3 NativeDB, femga rdr3_discoveries.*
