FuriouZ Posted April 27, 2015 Share Posted April 27, 2015 Hey! I haven't been scripting over a five months for now, so I don't remember almost anything How I can fix it ? Doesn't matter what marker i enter, my pos always will be the LS Las Colinas pos.. I know that I have to define the positions somehow, but i don't remember how Parachuting_marker_pos = { { 1467.03149, -1088.79663, 23 }; --Temple { 1593, -2267.2, 12 }; --LS Airport { 2805.70703, -1109.63428, 29 } --LS Las Colinas } Parachuting_pos = { { 1435.64771, -1048.69482, 213.38281 }; --Temple { 1627.28125, -2286.68359, 94.13281 }; --LS Airport { 2833.78076, -1089.68665, 201.60696 } --LS Las Colinas } for k,v in ipairs (Parachuting_marker_pos) do local pBlip = createBlip ( v[1], v[2], v[3], 0 ) setBlipVisibleDistance(pBlip, 500) pMarker = createMarker( v[1],v[2],v[3], "cylinder",4,0,120,200,200) end addEventHandler ( "onClientMarkerHit", root, function() for k,v in ipairs (Parachuting_pos) do setElementPosition ( localPlayer, v[1], v[2], v[3] ) end end ) Link to comment
MTA Team botder Posted April 27, 2015 MTA Team Share Posted April 27, 2015 Code Explanation In the beginning you create 2 tables called Parachuting_marker_pos and Parachuting_pos. Each of those contain another tables with each 3 number values (the position). After creating the tables you start a loop for the table Parachuting_marker_pos for each element (each table) inside it. Each iteration inside the loop creates a blip and a marker using the coordinates from the table from Parachuting_marker_pos. The last table's marker element will be stored in the variable pMarker. Your memory should look like that: Parachuting_marker_pos : tableParachuting_pos : table pMarker : userdata (marker element) At the end you add an event handler for the event onClientMarkerHit, which will be used everytime for ANY player, which hits the marker. That player will be teleported to each position stored in the table Parachuting_pos, resulting in placing the player in the last position in that table. The Problem(s) You don't check if the local player hits the marker. You don't check if the player enters a marker, which was made by your resource. You set always the last position in your location table for the local player - that code will teleport EVERY player to the position. Link to comment
FuriouZ Posted April 28, 2015 Author Share Posted April 28, 2015 A bit easyer explain would help Link to comment
MTA Team botder Posted April 28, 2015 MTA Team Share Posted April 28, 2015 Sorry, but what did you not understand? Link to comment
yazan Posted April 29, 2015 Share Posted April 29, 2015 Markers = { [1] = { 1467.03149, -1088.79663, 23 }, [2] = { 1593, -2267.2, 12 }, [3] = { 2805.70703, -1109.63428, 29 } } post = { [1] = { 1435.64771, -1048.69482, 213.38281 }; --Temple [2] = { 1627.28125, -2286.68359, 94.13281 }; --LS Airport [3] = { 2833.78076, -1089.68665, 201.60696 } --LS Las Colinas } addEventHandler ( "onClientResourceStart", resourceRoot, function ( ) for _, TheMarkers in ipairs ( Markers ) do TheMarkerr = createMarker ( TheMarkers[1], TheMarkers[2], TheMarkers[3] - 1, "cylinder", 2, 25, 205, 100, 150 ) local pBlip = createBlip ( TheMarkers[1], TheMarkers[2], TheMarkers[3], 0 ) end end ) addEventHandler ( "onClientMarkerHit", resourceRoot, function(element) if ( element == localPlayer ) then if ( element == localPlayer ) then for _, Thepost in ipairs ( post ) do setElementPosition ( element, Thepost[1], Thepost[2], Thepost[3] ) end end end) Link to comment
FuriouZ Posted April 29, 2015 Author Share Posted April 29, 2015 Thanks, but I figured it out myself 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