Jump to content

Search the Community

Showing results for tags 'rotate'.

  • 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 5 results

  1. I'm daring myself to add more little things to the tutorials shown here. It's of great pleasure to announce that the following code works. I know it is not much, but it's one more step closer to my dream server. So, function joinHandler() spawnPlayer(source, 2023, 1008, 10.83, -90, math.random (1,288)) fadeCamera(source, true) setCameraTarget(source, source) outputChatBox("¡Bienvenido!", source) end addEventHandler("onPlayerJoin", getRootElement(), joinHandler) You can skip the spanish words. The result is as expected: when the player joins, the chatbox shows the text, the player is looking at the east, and the skin is randomized between 1 and 288. However, the camera is aiming at its default value: 0. The result has a rather inconvenient detail: the camera is looking at the right side of the character's body. UPDATE: I added setPedCameraRotation. There are no errors being detected, but the camera is not changing at all. function joinHandler() spawnPlayer(source, 2023, 1008, 10.83, -90, math.random (1,288)) fadeCamera(source, true) setCameraTarget(source, source) setPedCameraRotation(source, 90) outputChatBox("¡Bienvenido!", source) end addEventHandler("onPlayerJoin", getRootElement(), joinHandler) How can I modify where the camera is looking at when a player joins, so that way it looks at the same place the character is looking?
  2. local NPC = createPed(285,376.39947509766,-65.617164611816,1001.5078125) setElementInterior( NPC, 10 ) function NPCRotate ( ) local rotX, rotY, rotZ = getElementRotation(NPC) -- get the local players's rotation setElementRotation(NPC,0,0,rotZ+10,"default",true) -- turn the player 10 degrees clockwise end addCommandHandler ( "turn", NPCRotate ) local screenWidth, screenHeight = guiGetScreenSize() local range = 10 function NPCnametag() local x,y,z = getPedBonePosition(NPC,6) local px,py,pz = getElementPosition(localPlayer) if getDistanceBetweenPoints3D(x,y,z,px,py,pz) <= range then local sx,sy = getScreenFromWorldPosition(x,y,z) if sx then dxDrawText("Bob",sx,sy,sx,sy,tocolor ( 255, 255, 0, 255 ), 2,"sans") end end end function HandleTheRendering() addEventHandler("onClientRender",getRootElement(), NPCnametag) end addEventHandler("onClientResourceStart",resourceRoot, HandleTheRendering)
  3. local redcircle = dxCreateTexture("teszt.png") addEventHandler("onClientRender", root, function() dxDrawMaterialLine3D(-1989.73804, 214.91431, 50,-1989.73804, 214.91431,43.1096496582031, redcircle, 6, tocolor(255,255,255),0,5,6) end) I change numbers, but i cannot rotate the image... how to rotate the image? sorry for my bad english..
  4. Olá, estou tentando criar uma rotação circular no meu objeto. Para fazer isso, ele deve rotacionar em Z usando o Easing "SineCurve". (exemplo 20º) Até aí tudo certo... Mas o problema ocorre quando eu coloco outra rotação nos demais parâmetros, pois ele coloca "SineCurve" em todas as rotações informadas do moveObject, só que eu preciso que ele faça na rotação X com o Easing "CosineCurve", pois se usar o "SineCurve" no X também, ele rotaciona numa diagonal apenas. Imagem para ilustrar meu problema: Obs: Na luz já consigo fazer isso, pois ela tem uma espécie de "lookAt" porque ela aponta para uma coordenada em vez de ser rotacionada, já no objeto isso não é possível... Obs2: Colocar a rotação X em um moveObject separado não funciona, pois cancela o moveObject anterior deste objeto. Obs3: Anexar o objeto a outro não resolve, uma vez que moveObject não funciona em objetos-filho. Traduzindo tudo acima: Preciso que o objeto faça um "lookAt" em um ponto que irá se movimentar circularmente.
  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 )
×
×
  • Create New...