JanriKallas Posted November 23, 2015 Share Posted November 23, 2015 How to calculate position front of the car. I want to put ped on to the front of the car. Link to comment
MTA Team botder Posted November 23, 2015 MTA Team Share Posted November 23, 2015 You need true in meta.xml https://wiki.multitheftauto.com/wiki/Ma ... g_Matrices local position = vehicle.matrix.position + vehicle.matrix.forward * 3 player:setPosition(position) Link to comment
JanriKallas Posted November 25, 2015 Author Share Posted November 25, 2015 Thank you! Link to comment
JanriKallas Posted November 25, 2015 Author Share Posted November 25, 2015 Can you answer one more question? local duty = "Mechanic" setElementVisibleTo(player, dutyMarker) in ElementVisibleTo I want to replace the duty word. How to do it? Link to comment
MTA Team botder Posted November 26, 2015 MTA Team Share Posted November 26, 2015 Create a marker and use that. Could you explain your problem further? Link to comment
JanriKallas Posted November 27, 2015 Author Share Posted November 27, 2015 Lets say theres a three markers MechanicMarker MedicMarker PoliceMarker They are all invisible. Then function makes one of the Marker visible that player chose from clientside. So to not make three different function for policemarker, medicmarker, mechanicmarker Function () --clientside duty = GuigetText (bla1) TriggerEvent ("serverfunc", localplayer, localplayer, duty) End Function (player,duty) --duty is "Mechanic" / "Medic" / "Police" setElementVisibleTo (player, ..duty..Marker) end I alrady tried: (tostring(duty)Marker) and tostring (duty)..Marker Link to comment
ALw7sH Posted November 27, 2015 Share Posted November 27, 2015 local markers = { ["Mechanic"] = createMarker(...), ["Medic"] = createMarker(...), ["Police"] = createMarker(...), } function anFunction(player,duty) setElementVisibleTo(markers[duty],player,true) for k,v in pairs(markers) do if k ~= duty then setElementVisibleTo(v,player,false) end end end anFunction(getRandomPlayer(),"Police") Is that what you mean? Link to comment
Dealman Posted November 28, 2015 Share Posted November 28, 2015 You actually don't need to enable OOP if you prefer not to use it. If you look at the wiki page of getElementMatrix you have this example which does exactly what you want; function getPositionFromElementOffset(element,offX,offY,offZ) local m = getElementMatrix ( element ) -- Get the matrix local x = offX * m[1][1] + offY * m[2][1] + offZ * m[3][1] + m[4][1] -- Apply transform local y = offX * m[1][2] + offY * m[2][2] + offZ * m[3][2] + m[4][2] local z = offX * m[1][3] + offY * m[2][3] + offZ * m[3][3] + m[4][3] return x, y, z -- Return the transformed point end -- Get the position of a point 3 units to the right of the element: x,y,z = getPositionFromElementOffset(element,3,0,0) -- Get the position of a point 2 units in front of the element: x,y,z = getPositionFromElementOffset(element,0,2,0) -- Get the position of a point 1 unit above the element: x,y,z = getPositionFromElementOffset(element,0,0,1) Link to comment
JanriKallas Posted November 28, 2015 Author Share Posted November 28, 2015 Thank you! 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