Jump to content

Some Train questions and !


CodX

Recommended Posts

Hello !

The train has some bugs in GTA multiplayer (MTA Server).

When a player climb up like passager in train, he will die after tunnel of Los Santos and another location.

Can be solve this bug ?

 

P.S: Sorry if my english is bad, i from Romanian.

Link to comment
  • Discord Moderators

*Can i solve this bug * im from Romania.

No, you cant solve this.. this is a sync bug, MTA is good at syincing, but not when syncing towned vehicles, trains, and anything thats attached.

 

Or maybe you can, if you disable player damage, or attach yourself to the train(i dont think that this will work..)

Edited by Pirulax
Link to comment

You could try this :

addEventHandler("onClientVehicleEnter", root,
  function (thePlayer)
    if thePlayer == localPlayer then
      local model = getElementModel(source)
      if model == 538 or model == 570 or model == 537 then
        addEventHandler("onClientPlayerDamage", localPlayer, function() cancelEvent() end )
      end
    end
  end
)

addEventHandler("onClientVehicleExit", root,
  function (thePlayer)
    if thePlayer == localPlayer then
      local model = getElementModel(source)
      if model == 538 or model == 570 or model == 537 then
        removeEventHandler("onClientPlayerDamage", localPlayer, function() cancelEvent() end )
      end
    end
  end
)

It should work

Edited by Gordon_G
Link to comment

Doesn't not work.

The script doesn't have errors but players take damage when they climb up in train.

 

I will try to find o solution for that..

But I have a more serious problem on the train, that with the injury I will solve it somehow.

After 5-10 minutes, the train moves its location a few meters further and no longer climbs up into it, unless it just wipes out and makes another.

Edited by CodX
Link to comment
  • Administrators

Does removing event handlers work like that? (when using anonymous functions)

I'd much rather store it in a variable, or create a named function for that.

Link to comment
39 minutes ago, CodX said:

Yes.


<meta>
     <script src="bug.lua" type="server" />
     <script src="bug.lua" type="client" />
</meta>

 

I am a very bad scripter....  But you have 2 of the same file, one is server, and one client.

Try replacing the meta with this.

<meta>
     <script src="bug.lua" type="client" />
</meta>

 

Link to comment

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...