JeViCo Posted August 5, 2019 Posted August 5, 2019 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 IIYAMA Posted August 5, 2019 Moderators Posted August 5, 2019 20 minutes ago, JeViCo said: Any ideas? remove the player from the vehicle first. https://wiki.multitheftauto.com/wiki/RemovePedFromVehicle 1 Do you want to improve your Lua programming skills and make less mistakes? Start with Lua Language Server! Useful functions 3x Spoiler checkPassiveTimer getScreenStartPositionFromBox getPedGender Tutorials 4x Spoiler Scaling DX Events Attach an addEventHandler on a group of elements Debugging
DNL291 Posted August 5, 2019 Posted August 5, 2019 You must set the position for the vehicle instead of for the driver (if he's in a vehicle). 1 Please do not PM me with scripting related question nor support, use the forums instead.
JeViCo Posted August 10, 2019 Author Posted August 10, 2019 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
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now