Jump to content

object dim/int problem


Hero192

Recommended Posts

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

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