Jump to content

setElementInterior, player + vehicle problem


JeViCo

Recommended Posts

Posted

Hello there. I've recently tried to change vehicle's interior server-side and met a problem. My current code:

-- client
triggerServerEvent("teleporter", localPlayer, {10, 10, 2}, 1, math.random(65000))


-- server
addEvent("teleporter", true)
addEventHandler("teleporter", root, function(pos, int, dim)
    local x, y, z = unpack(pos)
    setElementInterior(source, int, x, y, z)
    setElementDimension(source, dim)
    
end)

Everything works perfect except for setElementInterior function. Interior changes, however coordinates are not.

By the way, player in vehicle (driver).

Any ideas?

  • Moderators
Posted
20 minutes ago, JeViCo said:

Any ideas?

 

remove the player from the vehicle first.

https://wiki.multitheftauto.com/wiki/RemovePedFromVehicle

 

  • Like 1

Do you want to improve your Lua programming skills and make less mistakes?   Start with Lua Language Server!   🙀

 

  Useful functions  3x 

  Tutorials  4x 

 

Posted

You must set the position for the vehicle instead of for the driver (if he's in a vehicle).

  • Like 1

Please do not PM me with scripting related question nor support, use the forums instead.

Posted

Thank you guys, both options work perfect. My vehicle element was driving through the marker and this caused the problem. I used setElementFrozen function to fix it

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