Jump to content

xxMANxx

Members
  • Posts

    24
  • Joined

  • Last visited

Everything posted by xxMANxx

  1. setPedLookAt and setPedAimTarget doest not working on players in vehicle green line - a gaze direction of player are there any ways to solve this?
  2. how to find out that the rectangles collide knowing the coordinates of all their vertices?
  3. how to know for example that there is water within a radius of 20 meters from the player?
  4. how to know that the player is under water? (dived) ye i know that z < 0 it's under water line, but if wave heights? or dam zone (tierra robada), there's a different water line
  5. thanks for help, I'll try to understand
  6. when turn the camera, it turns as if roll = 0
  7. I am doing First Person Perspective. When camera roll = 0, everything works fine. But if the camera roll is not equal to 0, then the camera also rotates as if the camera roll is 0. principle: addEventHandler ('onClientCursorMove',root, freecamMouse) function freecamMouse (cX,cY,aX,aY) -- how far have we moved the mouse from the screen center? local width, height = guiGetScreenSize() aX = aX - width / 2 aY = aY - height / 2 rotX = rotX + aX * mouseSensitivity * 0.01745 rotY = rotY - aY * mouseSensitivity * 0.01745 end addEventHandler ('onClientPreRender', root, updateCamera) function updateCamera() local camPosXr, camPosYr, camPosZr = getPedBonePosition (localPlayer, 6) local camPosXl, camPosYl, camPosZl = getPedBonePosition (localPlayer, 7) local camPosX, camPosY, camPosZ = (camPosXr + camPosXl) / 2, (camPosYr + camPosYl) / 2, (camPosZr + camPosZl) / 2 -- note the vehicle rotation if inVehicle then local rx,ry,rz = getElementRotation(getPedOccupiedVehicle(localPlayer)) roll = -ry if rx > 90 and rx < 270 then roll = ry - 180 end if not wasInVehicle then rotX = rotX + math.rad(rz) if rotY > -PI/15 then rotY = -PI/15 end end cameraAngleX = rotX - math.rad(rz) cameraAngleY = rotY + math.rad(rx) else roll = 0 cameraAngleX = rotX cameraAngleY = rotY end --Taken from the freecam resource made by eAi -- work out an angle in radians based on the number of pixels the cursor has moved (ever) local freeModeAngleZ = math.sin(cameraAngleY) local freeModeAngleY = math.cos(cameraAngleY) * math.cos(cameraAngleX) local freeModeAngleX = math.cos(cameraAngleY) * math.sin(cameraAngleX) -- calculate a target based on the current position and an offset based on the angle local camTargetX = camPosX + freeModeAngleX * 100 local camTargetY = camPosY + freeModeAngleY * 100 local camTargetZ = camPosZ + freeModeAngleZ * 100 -- Work out the distance between the target and the camera (should be 100 units) local camAngleX = camPosX - camTargetX local camAngleY = camPosY - camTargetY local camAngleZ = 0 -- we ignore this otherwise our vertical angle affects how fast you can strafe -- Calulcate the length of the vector local angleLength = math.sqrt(camAngleX*camAngleX+camAngleY*camAngleY+camAngleZ*camAngleZ) -- Normalize the vector, ignoring the Z axis, as the camera is stuck to the XY plane (it can't roll) local camNormalizedAngleX = camAngleX / angleLength local camNormalizedAngleY = camAngleY / angleLength local camNormalizedAngleZ = 0 -- We use this as our rotation vector local normalAngleX = 0 local normalAngleY = 0 local normalAngleZ = 1 -- Perform a cross product with the rotation vector and the normalzied angle local normalX = (camNormalizedAngleY * normalAngleZ - camNormalizedAngleZ * normalAngleY) local normalY = (camNormalizedAngleZ * normalAngleX - camNormalizedAngleX * normalAngleZ) local normalZ = (camNormalizedAngleX * normalAngleY - camNormalizedAngleY * normalAngleX) -- Update the target based on the new camera position (again, otherwise the camera kind of sways as the target is out by a frame) camTargetX = camPosX + freeModeAngleX * 100 camTargetY = camPosY + freeModeAngleY * 100 camTargetZ = camPosZ + freeModeAngleZ * 100 -- Set the new camera position and target setCameraMatrix (camPosX, camPosY, camPosZ, camTargetX, camTargetY, camTargetZ, roll, fov) end I think need something like that. but I don’t know how to do this, because the parameter "roll" in setCameraMatrix rotates only “visually” and not the coordinate system
  8. you helped me again thanks
  9. How to fix it? f everything is fine here
  10. xxMANxx

    Need help

    it works thank you so much
  11. xxMANxx

    Need help

    I am doing first-person view and want to limit the camera so that it does not rotate 360 degrees. if cameraRotation > playerRotation + 90 then cameraRotation = playerRotation + 90 elseif cameraRotation < playerRotation - 90 then cameraRotation = playerRotation - 90 end Everything works until playerRotation becomes 350, and the cameraRotation >360 and becomes 0, then the condition works, but it should not work.
  12. https://wiki.multitheftauto.com/wiki/EngineImportTXD https://wiki.multitheftauto.com/wiki/EngineLoadTXD https://wiki.multitheftauto.com/wiki/EngineLoadDFF https://wiki.multitheftauto.com/wiki/EngineReplaceModel Example 1: This example loads a combination of a custom DFF and TXD file to replace the Euros vehicle in-game. The collisions are embedded inside the DFF file. outputChatBox ( "> replacing the euros vehicle" ) txd = engineLoadTXD ( "data/euros.txd" ) engineImportTXD ( txd, 587 ) dff = engineLoadDFF ( "data/euros.dff" ) engineReplaceModel ( dff, 587 )
  13. i changed the folder name now and this doing properly but that workaround
  14. this is not a problem I think that the fact is that the model is loaded from the cache, how to let the server understand that the model has changed and needs to be loaded again?
  15. meta.xml <meta> <script src="replace_models_c.Lua" type="client"/> <file src="models/m4.dff" type="client"/> <file src="models/m4.txd" type="client"/> </meta> replace_models_c.Lua (client side) local id = 356 local txd = engineLoadTXD('m4.txd', id) engineImportTXD(txd, id) local dff = engineLoadDFF('m4.dff', id) engineReplaceModel(dff, id) The problem is that the G36S model was first in the files, then when I changed the model to M4A1, the G36C is loaded, although it is not in the files.
  16. I had some model of weapon. Once in the files I replaced with another one, the past is loaded anyway. I tried to clean the cache, but it does not help.
  17. omg as I could not scroll down to see this feature ??????????????????? thanks
  18. setPedRotation rotates the camera along the axis z if I use setCameraMatrix, the target gets lost, if the target is put again, the camera is reset how to set camera rotation X? (weapon recoil)
  19. setPedRotation rotates the camera along the axis z if I use setCameraMatrix, the target gets lost, if the target is put again, the camera is reset how to set camera rotation X?
×
×
  • Create New...