deletedacc Posted May 1, 2020 Share Posted May 1, 2020 what's the problem in this codes: local x, y, z = getElementPosition(localPlayer); if (x == 1554.2001953125) then if (y == -1675.599609375) then if (z == 15.199999809265) then outputChatBox ("Entered", source, 0, 255, 0, false) spawnPlayer (source, 923.5, -1143.5, 392.79998779297, 180, math.random (0,288), 0, 0, spawnTeam) fadeCamera (source, true) setCameraTarget (source, source) end end end ??????????????????????????????????????????????????? Link to comment
Tekken Posted May 1, 2020 Share Posted May 1, 2020 1 localPlayer is for the client side 2 It't almost impossible to check a position like that, you may try getDistanceBetweenPoints3D Link to comment
deletedacc Posted May 1, 2020 Author Share Posted May 1, 2020 AllRight!So What's The Problem Now? function EnterToPD () local x, y, z = getElementPosition ( thePlayer ) if (x == 1554.2001953125) then if (y == 1554.2001953125) then if (z == 15.199999809265) then outputChatBox ("Entered", source, 0, 255, 0, false) spawnPlayer (source, 923.5, -1143.5, 392.79998779297, 180, math.random (0,288), 0, 0, spawnTeam) fadeCamera (source, true) setCameraTarget (source, source) end end end end addCommandHandler("in", EnterToPD) Please Help Me!!!!!!!!!!!!!And If My Code's Wrong So Tell Me What can I Do? In fact, Just Send Me The Code Thank's Link to comment
-Ilker. Posted May 1, 2020 Share Posted May 1, 2020 (edited) function EnterToPD (source) local x, y, z = getElementPosition ( source ) if (x == 1554.2001953125 and y == 1554.2001953125 and z == 15.199999809265 ) then outputChatBox ("Entered", source, 0, 255, 0, false) spawnPlayer (source, 923.5, -1143.5, 392.79998779297, 180, math.random (0,288), 0, 0, spawnTeam) fadeCamera (source, true) setCameraTarget (source, source) end end addCommandHandler("in", EnterToPD) Edited May 1, 2020 by -Ilker. Link to comment
deletedacc Posted May 1, 2020 Author Share Posted May 1, 2020 19 minutes ago, -Ilker. said: function EnterToPD (source) local x, y, z = getElementPosition ( source ) if (x == 1554.2001953125 and y == 1554.2001953125 and z == 15.199999809265 ) then outputChatBox ("Entered", source, 0, 255, 0, false) spawnPlayer (source, 923.5, -1143.5, 392.79998779297, 180, math.random (0,288), 0, 0, spawnTeam) fadeCamera (source, true) setCameraTarget (source, source) end end addCommandHandler("in", EnterToPD) It didn't work either. My goal is to get into the PDHQ when the player is in the marker.Can you give me the necessary codes? Link to comment
-Ilker. Posted May 1, 2020 Share Posted May 1, 2020 yourmarker = createMarker(....) function EnterToPD (source) local x, y, z = getElementPosition ( source ) if ( isElementWithinMarker ( source , yourmarker ) ) then outputChatBox ("Entered", source, 0, 255, 0, false) spawnPlayer (source, 923.5, -1143.5, 392.79998779297, 180, math.random (0,288), 0, 0, spawnTeam) fadeCamera (source, true) setCameraTarget (source, source) end end addCommandHandler("in", EnterToPD) Do you mean like this? Link to comment
deletedacc Posted May 1, 2020 Author Share Posted May 1, 2020 i got error in console : Line 4 : Bad Argument @ 'isElementWithInMarker' [Expected marker at argument 2, got boolean I mean, when the player is in the back of the police station, it will show up inside. That's it! Like a normal "door" system on MTA! 32 minutes ago, -Ilker. said: yourmarker = createMarker(....) function EnterToPD (source) local x, y, z = getElementPosition ( source ) if ( isElementWithinMarker ( source , yourmarker ) ) then outputChatBox ("Entered", source, 0, 255, 0, false) spawnPlayer (source, 923.5, -1143.5, 392.79998779297, 180, math.random (0,288), 0, 0, spawnTeam) fadeCamera (source, true) setCameraTarget (source, source) end end addCommandHandler("in", EnterToPD) Do you mean like this? i got error in console : Line 4 : Bad Argument @ 'isElementWithInMarker' [Expected marker at argument 2, got boolean I mean, when the player is in the back of the police station, it will show up inside. That's it! Like a normal "door" system on MTA! 32 minutes ago, -Ilker. said: yourmarker = createMarker(....) function EnterToPD (source) local x, y, z = getElementPosition ( source ) if ( isElementWithinMarker ( source , yourmarker ) ) then outputChatBox ("Entered", source, 0, 255, 0, false) spawnPlayer (source, 923.5, -1143.5, 392.79998779297, 180, math.random (0,288), 0, 0, spawnTeam) fadeCamera (source, true) setCameraTarget (source, source) end end addCommandHandler("in", EnterToPD) Do you mean like this? i got error in console : Line 4 : Bad Argument @ 'isElementWithInMarker' [Expected marker at argument 2, got boolean I mean, when the player is in the back of the police station, it will show up inside. That's it! Like a normal "door" system on MTA! Link to comment
Tekken Posted May 3, 2020 Share Posted May 3, 2020 Well in this case you may try an interior system, there are plenty on the community. https://community.multitheftauto.com/ Link to comment
Tekken Posted May 3, 2020 Share Posted May 3, 2020 (edited) Also I have already told you, you can't check a player position like that, try using getDistanceBetweenPoints3D local x,y,z = getElementPosition(player); local tx,ty,tz = 1554.2001953125, -1675.599609375, 15.199999809265; if getDistanceBetweenPoints3D(x,y,z,tx,ty,tz) <= 1 then -- do something end Edited May 3, 2020 by Tekken 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