Jump to content

Can't enter train


Tails

Recommended Posts

Posted (edited)

For some reason it's not letting me enter the train, same thing on server side. WarpPedIntoVehicle isn't working either.

function interCity() 
    local train = createVehicle(538,-1948.413, -0.929, 25.711) 
end 
addEventHandler("onClientResourceStart",resourceRoot,interCity) 

Any ideas?

Edited by Guest

Discord: its.tails

Posted

It's not letting me enter any train. Only when I spawn them in through freeroam panel.

Did you check the code? Does it work for you?

Discord: its.tails

Posted

try this maybe

server.lua

function interCity(thePlayer) 
    local train = createVehicle(538,-1948.413, -0.929, 25.711) 
    warpPedIntoVehicle(thePlayer, train) 
end 
addEventHandler("onResourceStart",resourceRoot,interCity) 

 DUyJ810.gif

Posted
Expected ped getting resource-data in debug

Look the example "warpPedIntoVehicle " in WIKI mta

function setupForRace ( ) 
    local RacerPed = createPed ( 252, 0, 0, 3 ) 
    local RaceVehicle = createVehicle ( 411, 4, 0, 3 )            -- create a vehicle. 
    warpPedIntoVehicle ( RacerPed, RaceVehicle )                  -- warp the ped straight into the vehicle 
end 
addCommandHandler ( "startrace", setupForRace )   

 DUyJ810.gif

Posted
is easy, or not? :|

Sure is. I thought I tested it my code server side but apparently I didn't.

There's another issue, however, the train will only go in one direction when driving it?

You can't enter vehicles created in client side

Thanks, ALw7sH, I did not know that.

Discord: its.tails

Posted

What do you mean?

Server side:

function interCity() 
    local train = createVehicle(538,-1948.413, -0.929, 25.711) 
end 
addEventHandler("onResourceStart",resourceRoot,interCity) 

Yes, you can enter the train now. But try it for yourself, it will only go in one direction.

Trains just confuse me. They never do what I want.

Discord: its.tails

Posted

try this :|

Server side:

function interCity(thePlayer) 
    local train = createVehicle(538,-1948.413, -0.929, 25.711) 
    warpPedIntoVehicle(thePlayer, train) 
    setVehicleRotation ( train, 0, 0, 270 ) 
end 
addEventHandler("onResourceStart",resourceRoot,interCity) 

 DUyJ810.gif

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...