Search the Community

Showing results for tags 'attach'.



More search options

  • 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
    • Open Source Contributors
    • Suggestions
    • Ban appeals
  • General MTA
    • News
    • Media
    • Site/Forum/IRC/Mantis/Wiki related
    • MTA Chat
    • Other languages
  • community.mtasa.com
    • 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
  • Private Bugtracker

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Gang


Location


Occupation


Interests

Found 10 results

  1. Hello! I need to use attachElements with an object in a player's gun, but from what I noticed the player's weapon is not recognized as "element". Code: function customM4(source) if getPedWeapon(source) == 31 then local gunModel = createObject(1487, 1, 2, 3) attachElements(gunModel, getPedWeapon(source)) end end addCommandHandler("m4skin", customM4)
  2. Hello forums! to the current script: I created a boat (vehicle) and attached a pirateship to it. On the pirateship there are some doors attached. I'm using following function to interact with the objects: addEvent("onPlayerInteraction", true) addEventHandler("onPlayerInteraction", server.root, function() local nearest = getNearest(source, "object", 5) -- is working if (nearest) then outputChatBox("object found", source) local id = getElementData(nearest, "action") if (id) then local action = server.actions[id] action(source, nearest) outputChatBox("object found with id"..id, source) else outputChatBox("object found with no id", source) end else outputChatBox("no object found", source) end end) If the ship is created (and not moved) everything works fine. As soon as the ship is moved the function outputs "no object found". Is this a known bug or am I'm missing something?
  3. Lormateve

    How to save the objects attached

    What I wanted to do, was that the user to buy a certain accessory color and object, that is saved and at the beginning, not only can see it, but also can see others. Server: function Cortina1(paintjobID, color) local vehicle = getPedOccupiedVehicle( client ) local player = client if ( vehicle ) then local pos = {getElementPosition( vehicle )} Cortinapuesta = createObject( 1000, pos[1], pos[2], pos[3] ) attachElements( Cortinapuesta, vehicle, 0, 0, 0, 0, 0, 0 ) triggerClientEvent (root, "setShader", resourceRoot, paintjobID, color) end end addEvent("PonerCortina", true) addEventHandler("PonerCortina", resourceRoot, Cortina1) function CancelarCortina() local vehicle = getPedOccupiedVehicle( source ) if ( vehicle ) then destroyElement(Cortinapuesta) end end addEvent("SacarCortina", true) addEventHandler("SacarCortina", root, CancelarCortina) ----------------------------------------------------------------------------------------------------- function addPJfction (player) triggerClientEvent (getRootElement(),"addPJ2", getRootElement(), player ) end addEvent( "addPJ", true ) addEventHandler( "addPJ", resourceRoot, addPJfction ) function removePJfction (player) triggerClientEvent (getRootElement(),"removePJ2", getRootElement(),player ) end addEvent( "removePJ", true ) addEventHandler( "removePJ", resourceRoot, removePJfction ) Client: Ventana1 = createMarker (2194.4677734375, 1440.5966796875, 10.8203125-1, "cylinder", 1.5, 0, 255, 0, 170 ) local NormalTextColour = "FFFB0202" function mapLoad ( Bondi2018OBJETOS ) local txdCortinas1518 = engineLoadTXD( "objetos/metalpar1518/vehicle.txd" ) local dffCortinas1518 = engineLoadDFF( "objetos/metalpar1518/spl_b_mar_m.dff", 0 ) engineImportTXD( txdCortinas1518, 1000 ) engineReplaceModel( dffCortinas1518, 1000 ) end addEventHandler ( "onClientResourceStart", resourceRoot, mapLoad ) addEventHandler("onClientMarkerHit", Ventana1, function(localPlayer) if localPlayer == getLocalPlayer() then Ventana = guiCreateWindow(997, 226, 228, 743, "BONDI 2018 - Taller \"Libertad\"", false);guiSetVisible(Ventana, true) guiWindowSetSizable(Ventana, false) guiSetProperty(Ventana, "CaptionColour", "FF0EF1E3") showCursor(true) veh = getPedOccupiedVehicle( localPlayer ) Boton1 = guiCreateButton(15, 66, 108, 31, " CORTINAS", false, Ventana); guiSetProperty(Boton1, "NormalTextColour", "FFFB0202") Boton2 = guiCreateButton(15, 107, 108, 31, " Parachoques", false, Ventana);guiSetProperty(Boton2, "NormalTextColour", "FFFB0202") Boton3 = guiCreateButton(15, 148, 108, 31, " ASIENTOS", false, Ventana);guiSetProperty(Boton3, "NormalTextColour", " FFFB0202") Boton4 = guiCreateButton(15, 189, 108, 31, " VIDRIOS", false, Ventana);guiSetProperty(Boton4, "NormalTextColour", "FFFB0202") Boton5 = guiCreateButton(15, 230, 108, 31, " OPTICAS", false, Ventana);guiSetProperty(Boton5, "NormalTextColour", "FFFB0202") Boton6 = guiCreateButton(15, 271, 108, 31, "", false, Ventana);guiSetProperty(Boton6, "NormalTextColour", " FFFB0202") Boton7 = guiCreateButton(15, 312, 108, 31, "", false, Ventana);guiSetProperty(Boton7, "NormalTextColour", " FFFB0202") Boton8 = guiCreateButton(15, 353, 108, 31, "", false, Ventana);guiSetProperty(Boton8, "NormalTextColour", " FFFB0202") Boton9 = guiCreateButton(15, 394, 108, 31, "", false, Ventana);guiSetProperty(Boton9, "NormalTextColour", " FFFB0202") BotonCERRAR = guiCreateButton(15, 700, 108, 31, "CERRAR", false, Ventana);guiSetProperty(BotonCERRAR, "NormalTextColour", "FFFB0202") end end ) Ventana2 = guiCreateWindow(997, 226, 228, 743, "BONDI 2018 - Taller \"Libertad\"", false);guiSetVisible(Ventana2, false);guiWindowSetSizable(Ventana2, false);guiSetProperty(Ventana2, "CaptionColour", "FF0EF1E3") Boton1 = guiCreateButton(60, 66, 108, 31, "Cortinas Simples", false, Ventana2); guiSetProperty(Boton1, "NormalTextColour", "FFFB0202") Boton2 = guiCreateButton(15, 107, 108, 31, " Turquesas", false, Ventana2);guiSetProperty(Boton2, "NormalTextColour", "FFFB0202") Boton2b = guiCreateMemo(150, 107, 64, 31, "2500", false, Ventana2); guiSetProperty(Boton2b, "NormalTextColour", "FFFB0202");guiMemoSetReadOnly( Boton2b, true ) Boton3 = guiCreateButton(15, 148, 108, 31, " 2", false, Ventana2);guiSetProperty(Boton3, "NormalTextColour", " FFFB0202"); Boton4 = guiCreateButton(15, 189, 108, 31, " 3", false, Ventana2);guiSetProperty(Boton4, "NormalTextColour", "FFFB0202") Boton5 = guiCreateButton(15, 230, 108, 31, " 4", false, Ventana2);guiSetProperty(Boton5, "NormalTextColour", "FFFB0202") Boton6 = guiCreateButton(15, 271, 108, 31, "5", false, Ventana2);guiSetProperty(Boton6, "NormalTextColour", " FFFB0202") Boton7 = guiCreateButton(15, 312, 108, 31, "6", false, Ventana2);guiSetProperty(Boton7, "NormalTextColour", " FFFB0202") Boton8 = guiCreateButton(60, 353, 108, 31, "Cortinas Completas", false, Ventana2);guiSetProperty(Boton8, "NormalTextColour", " FFFB0202") Boton9a = guiCreateButton(15, 394, 108, 31, "Turquesas", false, Ventana2);guiSetProperty(Boton9a, "NormalTextColour", " FFFB0202") Boton10a = guiCreateButton(15, 435, 108, 31, "Rojas", false, Ventana2);guiSetProperty(Boton10a, "NormalTextColour", " FFFB0202") Boton11a = guiCreateButton(15, 476, 108, 31, "Azules", false, Ventana2);guiSetProperty(Boton11a, "NormalTextColour", " FFFB0202") Boton12a = guiCreateButton(15, 517, 108, 31, "Blancas", false, Ventana2);guiSetProperty(Boton12a, "NormalTextColour", " FFFB0202") Boton13a = guiCreateButton(15, 558, 108, 31, "Celestes", false, Ventana2);guiSetProperty(Boton13a, "NormalTextColour", " FFFB0202") BotonTOTAL = guiCreateMemo (15, 650, 60, 31, "Total:", false, Ventana2);guiSetProperty(BotonTOTAL, "NormalTextColour", "FFFB0202");guiMemoSetReadOnly( BotonTOTAL, true ) BotonTOTAL2 = guiCreateMemo (75, 650, 60, 31, "0", false, Ventana2);guiSetProperty(BotonTOTAL2, "NormalTextColour", "FFFB0202");guiMemoSetReadOnly( BotonTOTAL2, true ) BotonCOMPRAR = guiCreateButton (135, 650, 65, 31, "COMPRAR", false, Ventana2);guiSetProperty(BotonCOMPRAR, "NormalTextColour", "FFFB0202") BotonCERRAR2 = guiCreateButton(15, 700, 108, 31, "CERRAR", false, Ventana2);guiSetProperty(BotonCERRAR2, "NormalTextColour", "FFFB0202") addEventHandler("onClientGUIClick", guiRoot, --VENTANA function() local getGui = guiGetVisible(Ventana) if source == BotonCERRAR then if getGui then guiSetVisible(Ventana, false) showCursor(false) veh = getPedOccupiedVehicle( localPlayer ) end end end ) -------------------------------------------------------------------------------------------- --------------------------------------------------------------------------------------------- ------------------------------------------------------------------------------------------- addEventHandler("onClientGUIClick", guiRoot, --VENTANA function() local getGui = guiGetVisible(Ventana2) if source == BotonCERRAR2 then if getGui then guiSetVisible(Ventana2, false) showCursor(false) veh = getPedOccupiedVehicle( localPlayer ) triggerServerEvent("SacarCortina", localPlayer, localPlayer) end end end ) addEventHandler("onClientGUIClick", guiRoot, --VENTANA2 = CORTINAS function() local getGui = guiGetVisible(Ventana) if source == Boton1 then if getGui then guiSetVisible(Ventana, false) guiSetVisible(Ventana2, true) veh = getPedOccupiedVehicle( localPlayer ) end end end ) --------------------------------------------------------------------------------------------------------- addEventHandler("onClientGUIClick", guiRoot, --VENTANA2 = CORTINAS > Completas > Turquesas function () local getGui = guiGetVisible(Ventana2) if source == Boton9a then local color = "nada" triggerServerEvent("PonerCortina", resourceRoot, paintjobID, color) PrecioCortinasCompletas = 3500 PrecioTotal = PrecioCortinasCompletas guiSetText(BotonTOTAL2, PrecioCortinasCompletas) else if source == Boton10a then --ROJAS local color = "red" triggerServerEvent("PonerCortina", resourceRoot, paintjobID, color) PrecioCortinasCompletas = 3500 PrecioTotal = PrecioCortinasCompletas guiSetText(BotonTOTAL2, PrecioCortinasCompletas) end end end ) addEvent( "addPJ2", true ) addEventHandler( "addPJ2", getLocalPlayer(), CortinasCompletas ) function addPaintjob2(paintjobID, color) outputChatBox("the color is:" .. color) if color == "red" then CortinasRojas = dxCreateTexture ( "CortinasRojas.png" ) engineRemoveShaderFromWorldTexture (shader_cars,"cortinas", getPedOccupiedVehicle ( player )) shader_cars , tec = dxCreateShader ( "shader.fx" ) engineApplyShaderToWorldTexture (shader_cars,"cortinas", getPedOccupiedVehicle ( player )) dxSetShaderValue (shader_cars,"TX0",CortinasRojas) elseif color == "blue" then CortinasAzules = dxCreateTexture ( "CortinasAzules.png" ) engineRemoveShaderFromWorldTexture (shader_cars,"cortinas", getPedOccupiedVehicle ( player )) shader_cars , tec = dxCreateShader ( "shader.fx" ) engineApplyShaderToWorldTexture (shader_cars,"cortinas", getPedOccupiedVehicle ( player )) dxSetShaderValue (shader_cars,"TX0",CortinasAzules) elseif color == "Nada" then outputChatBox ("Asi como está") end end addEvent( "setShader", true ) addEventHandler( "setShader", resourceRoot, addPaintjob2 ) -------------------------------------------------------------------------------------- addEventHandler("onClientGUIClick", guiRoot, --VENTANAS > BOTON COMPRAR function(localPlayer) local getGui = guiGetVisible(Ventana2) local money = getPlayerMoney (localPlayer) if source == BotonCOMPRAR then if (money > PrecioTotal) then outputChatBox ("Dinero CALCULADO") takePlayerMoney ( PrecioTotal ) outputChatBox ("Usted ha comprado las cortinas") guiSetVisible(Ventana2, false) showCursor (false) else outputChatBox ("No tiene el dinero suficiente para comprarlas!!") end end end)
  4. Dear staff, when I post on this forum, I usually need to attach images. Now I'm using an external webserver where host them, but I want to store them in this forum engine. Is it possible? And how? Thanks
  5. maximumdrive

    Additional object editor implementation

    Hi all, I'm in search for a component/library having positioning controls like on the pic shown. Here's a samp's "Attached object editor" screenshot, but I've seen the same solutions being 100% lua-implemented on several MTA (many of them were not that "professionally built") servers, this "editor mode" looked the same everywhere, so I guess there could be an open-source issue.
  6. Working on a First Person Shooter gamemode, and i found a bug. The event onClientPreRender causes some delay at attachElements. Can somebody reproduce attachElements maths for me?
  7. Hello, guys. It is possible to create effect and attach it to player/ped? This code doesn't works, may be I doing something wrong? addCommandHandler('eff1', function() local eff local x, y, z = getElementPosition(localPlayer) eff = createEffect('fire', x, y, z, 0.0, 0.0, 0.0) setElementInterior(eff, getElementInterior(localPlayer)) attachElements(eff, localPlayer) end) Please help
  8. Turbo777

    How to attach wagon to the train?

    i want attach to the train what i drive, but how?
  9. Ernoso

    bone attach error pls help

    Hey, guys! I need some help, please! I have a Rust server for MTA:SA, but there is lagging FPS a lot for all players and I think bone attach is the problem cause a lot of errors are appearing on debugscript like dup1055x Errors: http://prnt.sc/drdrf8 (IT DOESN'T STOP, IT'S LIKE A INFINITE LOOP!) This is my bone_attach_c file function sendReadyMessage() triggerServerEvent("boneAttach_requestAttachmentData",root) end addEventHandler("onClientResourceStart",resourceRoot,sendReadyMessage) function getAttachmentData(ped,bone,x,y,z,rx,ry,rz) for element,att_ped in pairs(ped) do setElementCollisionsEnabled(element,false) attached_ped[element] = att_ped attached_bone[element] = bone[element] attached_x[element] = x[element] attached_y[element] = y[element] attached_z[element] = z[element] attached_rx[element] = rx[element] attached_ry[element] = ry[element] attached_rz[element] = rz[element] end end addEvent("boneAttach_sendAttachmentData",true) addEventHandler("boneAttach_sendAttachmentData",root,getAttachmentData) function initAttach() addEvent("boneAttach_attach",true) addEvent("boneAttach_detach",true) addEventHandler("boneAttach_attach",root,attachElementToBone) addEventHandler("boneAttach_detach",root,detachElementFromBone) end addEventHandler("onClientResourceStart",resourceRoot,initAttach) bone_0,bone_t,bone_f = {},{},{} bone_0[1],bone_t[1],bone_f[1] = 5,nil,6 --head bone_0[2],bone_t[2],bone_f[2] = 4,5,8 --neck bone_0[3],bone_t[3],bone_f[3] = 3,nil,31 --spine bone_0[4],bone_t[4],bone_f[4] = 1,2,3 --pelvis bone_0[5],bone_t[5],bone_f[5] = 4,32,5 --left clavicle bone_0[6],bone_t[6],bone_f[6] = 4,22,5 --right clavicle bone_0[7],bone_t[7],bone_f[7] = 32,33,34 --left shoulder bone_0[8],bone_t[8],bone_f[8] = 22,23,24 --right shoulder bone_0[9],bone_t[9],bone_f[9] = 33,34,32 --left elbow bone_0[10],bone_t[10],bone_f[10] = 23,24,22 --right elbow bone_0[11],bone_t[11],bone_f[11] = 34,35,36 --left hand bone_0[12],bone_t[12],bone_f[12] = 24,25,26 --right hand bone_0[13],bone_t[13],bone_f[13] = 41,42,43 --left hip bone_0[14],bone_t[14],bone_f[14] = 51,52,53 --right hip bone_0[15],bone_t[15],bone_f[15] = 42,43,44 --left knee bone_0[16],bone_t[16],bone_f[16] = 52,53,54 --right knee bone_0[17],bone_t[17],bone_f[17] = 43,42,44 --left ankle bone_0[18],bone_t[18],bone_f[18] = 53,52,54 --right angle bone_0[19],bone_t[19],bone_f[19] = 44,43,42 --left foot bone_0[20],bone_t[20],bone_f[20] = 54,53,52 --right foot function putAttachedElementsOnBones() for element,ped in pairs(attached_ped) do if not isElement(element) then clearAttachmentData(element) elseif isElementStreamedIn(ped) then local bone = attached_bone[element] local x,y,z = getPedBonePosition(ped,bone_0[bone]) local xx,xy,xz,yx,yy,yz,zx,zy,zz = getBoneMatrix(ped,bone) local offx,offy,offz = attached_x[element],attached_y[element],attached_z[element] local offrx,offry,offrz = attached_rx[element],attached_ry[element],attached_rz[element] local objx = x+offx*xx+offy*yx+offz*zx local objy = y+offx*xy+offy*yy+offz*zy local objz = z+offx*xz+offy*yz+offz*zz local rxx,rxy,rxz,ryx,ryy,ryz,rzx,rzy,rzz = getMatrixFromEulerAngles(offrx,offry,offrz) local txx = rxx*xx+rxy*yx+rxz*zx local txy = rxx*xy+rxy*yy+rxz*zy local txz = rxx*xz+rxy*yz+rxz*zz local tyx = ryx*xx+ryy*yx+ryz*zx local tyy = ryx*xy+ryy*yy+ryz*zy local tyz = ryx*xz+ryy*yz+ryz*zz local tzx = rzx*xx+rzy*yx+rzz*zx local tzy = rzx*xy+rzy*yy+rzz*zy local tzz = rzx*xz+rzy*yz+rzz*zz offrx,offry,offrz = getEulerAnglesFromMatrix(txx,txy,txz,tyx,tyy,tyz,tzx,tzy,tzz) if (not tonumber(tostring(objx)) or not tonumber(tostring(objy)) or not tonumber(tostring(objz))) then return end if (not tonumber(tostring(offrx)) or not tonumber(tostring(offry)) or not tonumber(tostring(offrz))) then return end setElementPosition(element,objx,objy,objz) setElementRotation(element,offrx,offry,offrz,"ZXY") else setElementPosition(element,getElementPosition(ped)) end end end addEventHandler("onClientPreRender",root,putAttachedElementsOnBones) Please, help!!!
  10. Everythink is working in the code, only the rotating not. When i press mouse1 then the weapons and the object will be created but its not rotating. This rotating function makes possible to rotate the object called "object3" to that direction where the "misc_a" (vehicle component) and the "misc_c" (vehicle component) is rotating at. The problem is that its not rotating the object. I hope you can help me again. Thanks in advance! client object3 = {}; mg1 = {}; mg2 = {}; addEvent ( 'fire_mg',true ); addEventHandler ( 'fire_mg',root, function ( aVehicle,aX,aY,aZ ) if aVehicle and aX and aY and aZ then object3 [ aVehicle ] = createObject ( 357, aX,aY,aZ) attachElements ( object3 [ aVehicle ], aVehicle, -0.05,10,3, 0,0,90 ) mg1 [ aVehicle ] = createWeapon("m4", aX,aY,aZ) mg2 [ aVehicle ] = createWeapon("m4", aX,aY,aZ) setWeaponFiringRate(mg1 [ aVehicle ], 20) setWeaponFiringRate(mg2 [ aVehicle ], 20) setWeaponState(mg1 [ aVehicle ], "firing") setWeaponState(mg2 [ aVehicle ], "firing") attachElements(mg1 [ aVehicle ], object3 [ aVehicle ], 0.2, 0.2, 0, 0, 0, 0) attachElements(mg2 [ aVehicle ], object3 [ aVehicle ], 0.2, -0.3, 0, 0, 0, 0) setElementData ( aVehicle,'mgFireOn',true ); local veh = getPedOccupiedVehicle(localPlayer) setElementData ( aVehicle,'object3',object3 [ aVehicle ] ); addEventHandler("onClientRender",root,rotate_object) end end ); function rotate_object() local veh = getPedOccupiedVehicle(localPlayer) local _,_,rz = getVehicleComponentRotation(veh, "misc_a") local rx,_,_ = getVehicleComponentRotation(veh, "misc_c") triggerServerEvent("rotateWeapon", localPlayer, rx,rz) end server function rotateWeapon(rx,rz) outputChatBox("rotate_s") local object3 = getElementData ( aVehicle, "object3" ) rx = (-rx) setElementAttachedOffsets ( object3, 0, 5.25, 2.45, 0, rx+7, rz+96) end addEvent("rotateWeapon", true) addEventHandler("rotateWeapon", root, rotateWeapon) function fire ( aPlayer ) if aPlayer and getElementType ( aPlayer ) == 'player' then if isPedInVehicle ( aPlayer ) then local aVehicle = getPedOccupiedVehicle( aPlayer ); if aVehicle and getElementModel ( aVehicle ) == 592 then local aX,aY,aZ = getElementPosition ( aVehicle ); triggerClientEvent ( root,'fire_mg',root,aVehicle,aX,aY,aZ ); end end end end function bind_start() for _,aPlayers in ipairs ( getElementsByType ( 'player' ) ) do bindKey ( aPlayers,'mouse1','down',fire ); end end addEventHandler ( 'onResourceStart',resourceRoot,bind_start) function bind_join() bindKey ( aPlayers,'mouse1','down',fire ); end addEventHandler ( 'onPlayerJoin',root,bind_join )