Potato_Tomato420 Posted March 26, 2021 Share Posted March 26, 2021 (edited) So i created a warper to warp a player inside and also outside a building. For some reason the first warp seems to work fine but then when i try it again it spawns me at the exact same location. I use setElementData to prevent the player from looping in the spawn. I think the bug is somewhere in that part. local enCol = createColCuboid (1554.56, -1677.10, 15.2, 1.2, 3, 2.4) local exCol = createColCuboid (245.30, 62.10, 1002.64, 3, 1.2, 2.5) setElementInterior (exCol, 6) setElementDimension (exCol, 1) local policeDepartment = createBlip (1555.16, -1675.62, 15.2, 58) function onColHit (hitElement, matchingDim) if (hitElement == localPlayer) and (matchingDim) then if (source == enCol) and (getElementData (hitElement, "warpedPoliceDepartment") == false) then setElementInterior (hitElement, 6) setElementDimension (hitElement, 1) setElementPosition (hitElement, 246.79, 63.06, 1003.64) setElementData (hitElement, "warpedPoliceDepartment", 1) elseif (source == exCol) and (getElementData (hitElement, "warpedPoliceDepartment") == false) then setElementInterior (hitElement, 0) setElementDimension (hitElement, 0) setElementPosition (hitElement, 1555.16, -1675.62, 16.2) setElementData (hitElement, "warpedPoliceDepartment", 1) end end end addEventHandler("onClientColShapeHit", getRootElement(), onColHit) function onColLeave (leaveElement, matchingDim) if (leaveElement == localPlayer) and (matchingDim) then if (source == enCol) then setElementData (leaveElement, "warpedPoliceDepartment", false) elseif (source == exCol) then setElementData (leaveElement, "warpedPoliceDepartment", false) end end end addEventHandler("onClientColShapeLeave", getRootElement(), onColLeave) Edited March 26, 2021 by Potato_Tomato420 Link to comment
Potato_Tomato420 Posted March 26, 2021 Author Share Posted March 26, 2021 Update: already soleved This seems to work: (Line 3, 4 and 5 added) function onColHit (hitElement, matchingDim) if (hitElement == localPlayer) and (matchingDim) then if (getElementData (hitElement, "warpedPoliceDepartment") == false) then setElementData (hitElement, "warpedPoliceDepartment", 0) end if (source == enterCol) and (getElementData (hitElement, "warpedPoliceDepartment") == 0) then setElementData (hitElement, "warpedPoliceDepartment", 1) setElementInterior (hitElement, 6) setElementDimension (hitElement, 1) setElementPosition (hitElement, 246.79, 63.06, 1003.64) elseif (source == exitCol) and (getElementData (hitElement, "warpedPoliceDepartment") == 0) then setElementData (hitElement, "warpedPoliceDepartment", 1) setElementInterior (hitElement, 0) setElementDimension (hitElement, 0) setElementPosition (hitElement, 1555.16, -1675.62, 16.2) end end end addEventHandler("onClientColShapeHit", getRootElement(), onColHit) 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