WJ. J Posted June 5, 2015 Posted June 5, 2015 Hi Guys, im new in MTA and tryed to create a TP wich can TP the player and vehicles. The problem is, everything above and under will be tp too. Is there a function where i can check the z axis? Its ignoring it why ever. marker = createMarker( ....... ) function teleport(player, matchingDimension) if source == marker then if getElementType(player)=="player" then if isPedInVehicle(player) then local vehicle=getPedOccupiedVehicle(player) setElementPosition(vehicle, x, y, z) setElementRotation(vehicle, x, y, z) ) end setElementPosition(player, x, y, z)) end end end addEventHandler("onClientMarkerHit", resourceRoot, teleport) PLS and thanks
Walid Posted June 5, 2015 Posted June 5, 2015 Try to explaine your problem better -- Server side marker = createMarker( ....... ) function teleport(player, matchingDimension) if matchingDimension and isElement(player) and getElementType(player) == "player" then if isPedInVehicle(player) then local vehicle = getPedOccupiedVehicle(player) setElementPosition(vehicle, x, y, z) setElementRotation(vehicle, x, y, z) else setElementPosition(player, x, y, z) end end end addEventHandler("onMarkerHit", marker, teleport) Do not yield your back to your enemy, might feel something strange in your ass. Two things are infinite the universe and human stupidity and i'm not sure about the universe. UF: IsTextInGridList | GetGridListRowIndexFromText | Table.removeValue | removeHex | dxDrawTriangle Skype: SaSuki102 | About Me | Youtube channel | Lua Tips & Tricks | Lua Strings | Lua Tables | Lua Operators
WJ. J Posted June 5, 2015 Author Posted June 5, 2015 when for example the tp is @pos local x = -1000 local y = -200 local z = 100 and im exactly under the z axis @ z = 0, it will tp me, but im not in the marker
Walid Posted June 5, 2015 Posted June 5, 2015 Try to use something like this local x, y, z = getElementPosition( player ) local mx, my, mz = getElementPosition( source ) if ((mz <= z+2) and (z >= mz-1)) then -- Your code here end Do not yield your back to your enemy, might feel something strange in your ass. Two things are infinite the universe and human stupidity and i'm not sure about the universe. UF: IsTextInGridList | GetGridListRowIndexFromText | Table.removeValue | removeHex | dxDrawTriangle Skype: SaSuki102 | About Me | Youtube channel | Lua Tips & Tricks | Lua Strings | Lua Tables | Lua Operators
Walid Posted June 5, 2015 Posted June 5, 2015 np. Do not yield your back to your enemy, might feel something strange in your ass. Two things are infinite the universe and human stupidity and i'm not sure about the universe. UF: IsTextInGridList | GetGridListRowIndexFromText | Table.removeValue | removeHex | dxDrawTriangle Skype: SaSuki102 | About Me | Youtube channel | Lua Tips & Tricks | Lua Strings | Lua Tables | Lua Operators
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