ScriptsM Trains 2.0

ScriptsM Trains 2.0

This script will allow players riding metro & freight trains with realistic passengers system, advanced ticket machines and more!

Installation

Download a resource (opens in a new tab) from keymaster or buy it by buttons at the top

Install additional resources

  • ESX or QBCore Frameworks
  • Ox or Qb Inventory
start Your framework
start Your inventory system
start ScriptsM-Trains

Running on Liberty City

If you running script with Liberty City map, you need to set this values to true:

Config.UseLiberty = true -- In Config.lua
 
let source = 'lc'; -- In html/config.js

Config

There you can find an config of resource with description for all params

Config = {}
 
Config.LsMachineLocations = { -- Ticket buy locations for Los Santos
    { coords = vector3(-213.1, -1036.19, 30.14) },
    { coords = vector3(-215.35, -1035.39, 30.14) },
-- more in original config...
}
 
Config.LibertyMachineLocations = { -- Ticket buy locations for Liberty City
    {coords = vector3(1262.936, -61.61985, 16.06512)},
    {coords = vector3(1265.781, -40.1385, 16.06513)},
-- more in original config...
}
 
Config.LsStationLocation = { -- Station blips location for Los Santos
    {coords = vector3(114.9856, -1723.951, 30.11269)},
    {coords = vector3(-213.692, -1032.897, 31.27678)},
-- more in original config...
 
}
 
Config.LibertyStationLocation = { -- Station blips location for Liberty City
    {coords = vector3(359.545, -212.3146, 4.999634)},
    {coords = vector3(-85.81433, 108.8691, 4.909734)},
-- more in original config...
}
 
Config.PedClip = { -- Passanger Ped hashes (https://docs.fivem.net/docs/game-references/ped-models/)
    `csb_abigail`,
    `ig_mp_agent14`,
-- more in original config...
}
 
Config.TrainBones = { -- Don't touch
    'seat_dside_r',
    'seat_dside_r1',
-- more in original config...
}
 
Config.UseLiberty = true -- Set to true if you are using Liberty City. False if using los santos
 
Config.AnimationsClip = { -- Animations of sitting for train passengers. (https://github.com/criminalist/Animations-list-GTA5-Fivem/blob/master/anim-list.txt)
    {animdict = 'amb@prop_human_seat_chair@male@right_foot_out@idle_b', clip='idle_d', pos = vector3(0.0, 0.0, 0.1)},
    {animdict = 'amb@prop_human_seat_chair_mp@female@proper@base', clip='base', pos = vector3(0.0, 0.0, 0.1)},
-- more in original config...
}
 
Config.PedTimeMulitplier = { -- The number of passengers at different times of the day. 0.0 - no passengers, 1.0 - maximum number of passengers
    ['0-6'] = 0.1,
    ['6-12'] = 0.5,
    ['12-18'] = 1.0,
    ['18-0'] = 0.4,
}
 
Config.Locales = { -- Locales
    ['buyTicket'] = 'Buy Ticket for 1$ : ~INPUT_PICKUP~',
    ['sitTrain'] = 'Take Sit : ~INPUT_PICKUP~',
    ['companyName'] = 'Liberty City Transport Authority',
    ['thanksText'] = 'Thank you for riding Liberty City Transport Authority, your ticket will be valid only for one ride on metro.',
    ['noMoney'] = 'You have not enough money to buy ticket.',
    ['buyTicketTarget'] = 'Buy ticket for 1$',
    ['blipName'] = 'Metro',
    ['nextStation'] = 'The next station is ~g~~a~',
    ['fineText'] = 'You have paid 10$ fine for riding without a ticket',
    ['standUP'] = 'Get out of the seat: ~INPUT_VEH_DUCK~',
    ['StationblipName'] = 'Metro Station',
    ['PoliceFineText'] = 'You have not enought money for pay fine. Police has been called',
 
}
 
Config.Keys = { -- Hotkeys. You can find it here: https://docs.fivem.net/docs/game-references/controls/
    ['SeatChair'] = 38,
    ['standUP'] = 73,
    ['BuyTicket'] = 51,  
}
 
Config.Stations = { -- Station names
    { node = 179,  name = "Strawberry",      },
-- more in original config...
}
 
--[[Config.Stations = { -- IN DEVELOPMENT
    { node = 181, name = "Eastson",    }, -- TRAINS17.DAT
    { node = 207, name = "Emerald",   },
-- more in original config...
}--]]
 
Config.DisableMetro = false -- Disable metro trains
Config.DisableFreightTrain = false -- Disable freight trains
Config.UseCommand = true -- Set this to false if you don't wanna use command to disable trains.
Config.SpawnFreq = 120000 -- Set spawn frequency, default gta is 120000. You can change this value if you having problem with trains duplicating.
 
Config.UseNotify = true -- Show notifications or not
Config.BuyNotifyIcon = 'CHAR_LS_TOURIST_BOARD' -- Set your icon for notifications
Config.BuyNotifyColor = 2 -- You can find all colors here - https://docs.fivem.net/docs/game-references/hud-colors/
 
Config.NotEnoughtMoneyNotifyIcon = 'CHAR_LS_TOURIST_BOARD' -- Set your icon for notifications
Config.NotEnoughtMoneyNotifyColor = 2 -- You can find all colors here - https://docs.fivem.net/docs/game-references/hud-colors/
 
Config.Framework = 'esx' -- 'esx' or 'qb' or 'standalone'
Config.Inventory = 'ox' -- 'ox' or 'qb'
Config.TicketPrice = 1 -- Ticket price 
Config.TicketFinePrice = 10 -- The price of a fine for riding train without a ticket
Config.FineAccount = 'bank' -- 'bank' or 'money'
Config.UseTicketUI = true -- Use new ticket menu for ticket buying process. Recommended to set true
 
Config.EnableMetroBlips = true -- Enable or disable metro blips
Config.ShowBlipsAlways = true -- Show blips if you don't buy ticket
Config.BlipSprite = 795 -- Blip sprite: https://docs.fivem.net/docs/game-references/blips/
Config.BlipColour = 1 -- Blip color: https://docs.fivem.net/docs/game-references/hud-colors
Config.BlipScale = 0.5 -- Blip scale
 
Config.EnableStationBlips = true
Config.StationBlipSprite = 795 -- Blip sprite: https://docs.fivem.net/docs/game-references/blips/
Config.StationBlipColour = 2 -- Blip color: https://docs.fivem.net/docs/game-references/hud-colors
Config.StationBlipScale = 0.5 -- Blip scale
 
Config.UseQbTarget = false -- Use qb target
Config.UseOxTarget = true -- Use ox target
Config.UseNextStation = true -- Use next station notify or not
 
Config.UseSeat = true -- Use the opportunity to take sit in metro or not
 
Config.UseCustomNotify = true -- Use custom buy notifications or no
Config.CustomBoughtTicketNotification = function()
-- Your export here
end
 
Config.CustomNotEnoughtMoneyNotification = function()
-- Your export here
end
 
Config.UseCustomHelpNotify = false -- If you wanna use custom hotkey help notification, make it true
 
Config.HotkeyHelpExport = function(msg, key) -- If you wanna use custom hotkey help notification, put your export below
-- Your export here
end
 
 
Config.CallPoliceFine = function() -- Export from MDT to call police when player riding without ticket
-- Your export here
end
 
Config.FineNotify = function() -- Fine notify
-- Your export here
end
 
Config.GetInventoryItem = function()
if Config.Inventory == 'ox' then
local itemName = 'metroticket'
local itemcount = exports.ox_inventory:GetItemCount(itemName, false, false)
if itemcount >= 1 then
	return true
else
	return false
end
end
if Config.Inventory == 'qb' then
local itemName = 'metroticket'
local hasItem = exports['qb-inventory']:HasItem(itemName, 1)
	return hasItem
end
end
 
-- ALSO GO TO HTML/CONFIG.JS to setup ticket ui menu