Search the Community

Showing results for tags 'attachelements'.



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
    • 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
  • Archive
  • 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


About Me


Gang


Location


Occupation


Interests

Found 5 results

  1. 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?
  2. Eae pessoal. Bom, hoje trago um novo problema com objetos anexados. Estou criando um script que cria e movimenta um guindaste localizado nas docas de SF (lá onde faz exportação/importação de veículos). Para criar esse guindaste, eu criei 6 objetos e anexei eles da seguinte maneira: guindasteBase (criado normalmente na posição e rotação correta, não está anexado em nenhum objeto) guindasteMiddle (anexado no guindasteBase, sem nenhum offset) guindasteTop (anexado no guindasteBase com offset de x = 0, y = -3.2, z = 19) guindasteSupport (anexado no guindasteTop com offset de x = 0, y = 50, z = 3.45) guindasteMagnet (anexado no guindasteSupport com offset de x = 0, y = 0, z = -1) theCam (Uma caixa invisível, anexada no guindasteSupport com offset de x = 15, y = -60, z = 20. Será onde a câmera do jogador vai ficar.) Até aí tudo certo, os objetos estão devidamente anexados e suas posições estão aparentemente corretas. O problema surge na hora de começar a movimentar o guindaste. Movimentando a base do guindaste (só se movimenta em duas direções, pra frente e pra trás), não ocorre nenhum problema. Todos os elementos anexados acompanham corretamente a movimentação, que é feita da seguinte maneira: function moveBaseUp () if isTimer (baseTimer) then killTimer (baseTimer) end if not getElementData (guindasteBase, "movingUp") then setElementData (guindasteBase, "movingUp", true) setMarkerSize (enterMarker, 0) baseTimer = setTimer (function() local x, y, z = getElementPosition (guindasteBase) if x <= -1532.5 then setElementPosition (guindasteBase, x+0.1, y+0.1, z) end end, 50, 0) else setElementData (guindasteBase, "movingUp", false) end end function moveBaseDown () if isTimer (baseTimer) then killTimer (baseTimer) end if not getElementData (guindasteBase, "movingDown") then setElementData (guindasteBase, "movingDown", true) baseTimer = setTimer (function() local x, y, z = getElementPosition (guindasteBase) if x >= -1647.5 then setElementPosition (guindasteBase, x-0.1, y-0.1, z) end end, 50, 0) else setElementData (guindasteBase, "movingDown", false) end end Quando o jogador entra no guindaste, as teclas W e S são bindadas para ativar essas funções. W para moveBaseUp e S para moveBaseDown. bindKey (thePlayer, "w", "both", moveBaseUp) bindKey (thePlayer, "s", "both", moveBaseDown) Obs: O movimento da base é na diagonal. Até então tudo certo. O problema começa quando eu rotaciono o guindasteTop, os elementos anexados nele acompanham corretamente mas não é mais possível obter a real localização deles, pois a localização deles depende da rotação do guindasteTop e não mais de sua posição. Como faço para obter a real posição dos objetos anexados no guindasteTop depois de rotacioná-lo? E dos objetos anexados nos objetos que estão anexados nele? Obs: Estou rotacionando ele assim: function rotateTopLeft () if isTimer (topTimer) then killTimer (topTimer) end if not getElementData (guindasteTop, "movingLeft") then setElementData (guindasteTop, "movingLeft", true) setMarkerSize (enterMarker, 0) topTimer = setTimer (function() local x, y, z, rx, ry, rz = getElementAttachedOffsets (guindasteTop) setElementAttachedOffsets (guindasteTop, x, y, z, rx, ry, rz+0.1) end, 50, 0) else setElementData (guindasteTop, "movingLeft", false) end end function rotateTopRight () if isTimer (topTimer) then killTimer (topTimer) end if not getElementData (guindasteTop, "movingRight") then setElementData (guindasteTop, "movingRight", true) topTimer = setTimer (function() local x, y, z, rx, ry, rz = getElementAttachedOffsets (guindasteTop) setElementAttachedOffsets (guindasteTop, x, y, z, rx, ry, rz-0.1) end, 50, 0) else setElementData (guindasteTop, "movingRight", false) end end
  3. 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?
  4. Hello, i need help i tried to attach a 3d sound to a slothbot ped but it doesn't work, the ped works nice and everything but the sound is not attached to him. Server side script: triggerClientEvent ( "JasonSoundClientEvent", root, jasonbot ) Client side script: addEvent("JasonSoundClientEvent", true) addEventHandler("JasonSoundClientEvent", root, function ( ped ) local jasonsound = playSound3D("sounds/jasonsound.mp3", -1633.8134765625, -2234.517578125, 31.4765625, true) setSoundMaxDistance( jasonsound, 50 ) setSoundEffectEnabled(jasonsound, echo, true) setSoundVolume(jasonsound, 1) attachElements(jasonsound, ped) end) Why it doesn't work? Nvm fixed lol i had AttachElements and is attachElements because A doesn't work xDDDD
  5. 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 )