Jump to content

Search the Community

Showing results for tags 'offset'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Multi Theft Auto: San Andreas 1.x
    • Support for MTA:SA 1.x
    • User Guides
    • Open Source Contributors
    • Suggestions
    • Ban appeals
  • General MTA
    • News
    • Media
    • Site/Forum/Discord/Mantis/Wiki related
    • MTA Chat
    • Other languages
  • MTA Community
    • Scripting
    • Maps
    • Resources
    • Other Creations & GTA modding
    • Competitive gameplay
    • Servers
  • Other
    • General
    • Multi Theft Auto 0.5r2
    • Third party GTA mods
  • Archive
    • Archived Items
    • Trash

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Member Title


Gang


Location


Occupation


Interests

Found 3 results

  1. Hello forums! I've been working on a project of mine, and I'm in need of a function which is similar to getPositionFromElementOffset (scroll down to examples). I can't wrap my head around matrices at all, and I would love to have a similar function, but with rotations instead (getting a rotation offset from an element). Would someone be able to help me out? I'd be very thankful!
  2. Hello again, I'm trying to spawn the player onto an element. This element has a non-fixed rotation. I'm just wondering if the function getPointFromDistanceRotation isn't enough to do this? Player details can be found here and the ships details are here I'm currently using this snippet (to try) to get the explained result: addCommandHandler("boat", function(player, cmd) local x, y, z = getElementPosition(player) local _, _, r = getElementRotation(player) outputChatBox("player pos: "..x..","..y..","..z..","..r, player) local ship = createShip(x, y, z, r) -- returns model of pirateship local x, y, z = getElementPosition(ship) local _, _, r = getElementRotation(ship) outputChatBox("ship pos: "..x..","..y..","..z..","..r, player) local x, y = getPointFromDistanceRotation(x - 0.1, y - 2.7, 5, r) -- offset included outputChatBox("new player pos: "..x..","..y..","..z..","..r, player) setElementPosition(player, x, y, 43.7) end) What am I'm doing wrong? Do I need to calculate the offset coordinates extra? Greetings, Maurize
  3. Okey, so im currently working on a repair script for my server, until this point everything worked, but now i need to calculate some offsets(world offset, and rotation offset too), and i have no idea how to do it.So, the basic idea is to hold every demounted component like this.Heres the script i made. --CLIENT SIDE local r = { ["door_lf_dummy"] = {90,0,-90}, ["door_rf_dummy"] = {90,0,-90}, ["door_lr_dummy"] = {90,0,-90}, ["door_rr_dummy"] = {90,0,-90}, } addEvent("addVehComponentToPlayer",true) function funkzson(veh,comp,player) setTimer(function() local rotx,roty,rotz = getElementRotation(player) setElementRotation(veh,rotx,rotx,rotz) for k in pairs(getVehicleComponents(veh)) do if not (k==comp) then setVehicleComponentVisible(veh,k,false) end end local cX,cY,cZ = getVehicleComponentPosition(veh,comp,"world") local vX,vY,vZ = getElementPosition(veh) local offsetX,offsetY,offsetZ = (vX-cX),(vY-cY),(cZ-vZ) exports.bone_attach:attachElementToBone(veh,player,2,0,-0.4,-0.65,r[comp][1],r[comp][2],r[comp][3]) setPedAnimation(player,"carry","crry_prtial",0,false,false,false) end,50,1) end addEventHandler("addVehComponentToPlayer",getLocalPlayer(),funkzson) --SERVER SIDE addCommandHandler("setcompstate",function(source,_,comp) local x,y,z = getElementPosition(source) local veh = createVehicle(440,x,y,z,rotx,roty,rotz) setElementCollisionsEnabled(veh,false) setVehicleDamageProof(veh,true) setElementData(veh,"onlyfixveh",true) triggerClientEvent("addVehComponentToPlayer",root,veh,comp,source) end) Ignore that i attached the server side triggerClientEvent to a command, i made it like this only for testing purposes. btw, maybe i will post the full script as a community script.
×
×
  • Create New...