Jump to content

Prioq

Members
  • Posts

    4
  • Joined

  • Last visited

Recent Profile Visitors

532 profile views

Prioq's Achievements

Vic

Vic (3/54)

0

Reputation

  1. local angX = 0 local angY = 0 local angZ = 0 local modelToRotate = false sx, sy = guiGetScreenSize() addEventHandler("onClientRender", root, function () if isCursorShowing() then if getKeyState("4") then angX = (angX + 1) % 360 end if getKeyState("5") then angY = (angY + 1) % 360 end if getKeyState("6") then angZ = (angZ + 1) % 360 end dxDrawText("X:" .. angX .. " Y:" .. angY .. " Z:" .. angZ, 300, 60) local relX, relY = getCursorPosition() local cursorX, cursorY = relX * sx, relY * sy local camX, camY, camZ = getCameraMatrix() local cursorWorldPosX, cursorWorldPosY, cursorWorldPosZ = getWorldFromScreenPosition(cursorX, cursorY, 20) local hit, hitX, hitY, hitZ, hitElement, normalX, normalY, normalZ = processLineOfSight(camX, camY, camZ, cursorWorldPosX, cursorWorldPosY, cursorWorldPosZ, true, false, false, true, false, true, false, true) if isElement(modelToRotate) then destroyElement(modelToRotate) end modelToRotate = createObject(1238, hitX, hitY, hitZ, 0, 0, 0, true) -- Convert the Euler angles to radians local radX = math.rad(angX) local radY = math.rad(angY) local radZ = math.rad(angZ) -- Calculate the sin and cosine values local sinX = math.sin(radX) local cosX = math.cos(radX) local sinY = math.sin(radY) local cosY = math.cos(radY) local sinZ = math.sin(radZ) local cosZ = math.cos(radZ) -- Calculate the rotation matrix manually local rotMatrix = {{}, {}, {}, {}} rotMatrix[1][1] = cosY * cosZ rotMatrix[1][2] = cosY * sinZ rotMatrix[1][3] = -sinY rotMatrix[1][4] = 0 rotMatrix[2][1] = sinX * sinY * cosZ - cosX * sinZ rotMatrix[2][2] = sinX * sinY * sinZ + cosX * cosZ rotMatrix[2][3] = sinX * cosY rotMatrix[2][4] = 0 rotMatrix[3][1] = cosX * sinY * cosZ + sinX * sinZ rotMatrix[3][2] = cosX * sinY * sinZ - sinX * cosZ rotMatrix[3][3] = cosX * cosY rotMatrix[3][4] = 0 rotMatrix[4][1] = hitX rotMatrix[4][2] = hitY rotMatrix[4][3] = hitZ rotMatrix[4][4] = 1 -- Apply the rotation matrix to the object setElementMatrix(modelToRotate, rotMatrix) end end ) Is this what you're trying to achieve?
  2. target is the player you're looking for, no need to get him from name local targetid = target
  3. Is it possible to toggle the hydra aim lock based on the targeted vehicle driver's team ? If so can you please link me all the needed functions and events. Thanks in advance.
×
×
  • Create New...