Hero192 Posted February 19, 2016 Share Posted February 19, 2016 Hello guys, I am doing a loc system which an object be over the player's head, I made it, but the problem is with the element doesn't follow the player in every interior / dimension only work in dim 0 & int 0. Can anyone tell me what I have to do? Link to comment
Alexs Posted February 19, 2016 Share Posted February 19, 2016 Change the element dimension and interior to the same of the player. Link to comment
Noki Posted February 20, 2016 Share Posted February 20, 2016 You can make an event like onPlayerDimensionChange/onPlayerInteriorChange which triggers every time a player's dimension is set. I would recommend making a centralized function for this with one triggerEvent in that function for ease. In that event, you can include the code which would change the dimension/interior of the object over a player's head. Or you can use an infinite timer that checks if a player's dimension/interior are different to that of his attached object, which may give you a slight performance hit. The second option is much easier to make. Though the first option would be considered more "proper" I guess. Link to comment
Hero192 Posted February 21, 2016 Author Share Posted February 21, 2016 You can make an event like onPlayerDimensionChange/onPlayerInteriorChange which triggers every time a player's dimension is set. I would recommend making a centralized function for this with one triggerEvent in that function for ease. In that event, you can include the code which would change the dimension/interior of the object over a player's head.Or you can use an infinite timer that checks if a player's dimension/interior are different to that of his attached object, which may give you a slight performance hit. The second option is much easier to make. Though the first option would be considered more "proper" I guess. Well, you are totally right man, I did the second one it worked but it cause lags, so now I want to start with the first idea, what I have to do , I mean which functions / events I have to use?, please give me the light to follow Note: thanks dude Link to comment
Noki Posted February 21, 2016 Share Posted February 21, 2016 function changeObjectDimension(dim) -- Set the object that is above the player's head to the player's new dimension -- source is the player whose dimension was changed setElementDimension(object, dim or getElementDimension(source)) end addEvent("onPlayerDimensionChange") addEventHandler("onPlayerDimensionChange", root, changeObjectDimension) function setPlayerDimension(plr, dim) -- do standard checks here setElementDimension(plr, dim) triggerEvent("onPlayerDimensionChange", plr, dim) -- Triggers the event with the player whose dimension was changed as the source, and their new dimension as the first parameter end Obviously untested. Just use setPlayerDimension as an exported function whenever you want to change a player's dimension. Link to comment
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