Advertisement
glitchdetector

RDR3 RedM Train Script

Nov 12th, 2019
3,063
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.25 KB | None | 0 0
  1. local TRAIN_HASHES = {
  2.     -1464742217,
  3.     -577630801,
  4.     -1901305252,
  5.     -1719006020,
  6.     519580241,
  7.     1495948496,
  8.     1365127661,
  9.     -1083616881,
  10.     1030903581,
  11.     -2006657222,
  12.     1285344034,
  13.     -156591884,
  14.     987516329,
  15.     -1740474560,
  16.     -651487570,
  17.     -593637311,
  18.     1094934838,
  19.     1054492269,
  20.     1216031719,
  21. }
  22.  
  23. -- train list command (/trains)
  24. RegisterCommand("trains", function()
  25.     print("id", "hash", "wagons")
  26.     for trainId, trainHash in next, TRAIN_HASHES do
  27.         print(trainId, trainHash, N_0x635423d55ca84fc8(trainHash))
  28.     end
  29. end)
  30.  
  31. CURRENT_TRAIN = nil
  32.  
  33. function SpawnTrain(n)
  34.     local trainHash = TRAIN_HASHES[n]
  35.     local trainWagons = N_0x635423d55ca84fc8(trainHash)
  36.     for wagonIndex = 0, trainWagons - 1 do
  37.         local trainWagonModel = N_0x8df5f6a19f99f0d5(trainHash, wagonIndex)
  38.         PerformRequest(trainWagonModel)
  39.     end
  40.     local train = N_0xc239dbd9a57d2a71(trainHash, GetEntityCoords(PlayerPedId()), 0, 0, 1, 1)
  41.     SetTrainSpeed(train, 0.0)
  42.     TaskWarpPedIntoVehicle(PlayerPedId(), train, -1)
  43.     CURRENT_TRAIN = train
  44. end
  45.  
  46. -- train spawn command (/train id)
  47. RegisterCommand("train", function(source, args, raw)
  48.     local n = tonumber(args[1])
  49.     SpawnTrain(n)
  50. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement