Jayceon

Members
  • Content count

    78
  • Joined

  • Last visited

Community Reputation

18 Decent

About Jayceon

  • Rank
    Transformer
  • Birthday 14/04/2000

Recent Profile Visitors

1,935 profile views
  1. Path quality problem

    I solved this problem with a 8x8 circle image. Added image to the every node position in RT and looks better. What I mean? dxSetRenderTarget(gpsRouteImage) dxSetBlendMode("modulate_add") for i = 2, #gpsLines do if gpsLines[i - 1] then local x0 = gpsLines[i][1] - routeStartPosX + 8 local y0 = gpsLines[i][2] - routeStartPosY + 8 local x1 = gpsLines[i - 1][1] - routeStartPosX + 8 local y1 = gpsLines[i - 1][2] - routeStartPosY + 8 dxDrawImage(x0 - 4, y0 - 4, 8, 8, "dot.png") dxDrawLine(x0, y0, x1, y1, tocolor(255, 255, 255), 9) end end dxSetBlendMode("blend") dxSetRenderTarget()
  2. engineLoadIFP error!

    Your code in client side?
  3. engineLoadIFP error!

    I think MTA Team didn't added to the stable build. Download and update your MTA client with https://nightly.mtasa.com/ I tested yesterday and works very well.
  4. How to let x resource start before y resource starts

    I'm using the download_priority_group in the meta.xml and it works fine. Higher priority resources load earlier than lower priorities, so: Admin-system: <download_priority_group>2</download_priority_group> Accounts-system: <download_priority_group>1</download_priority_group>
  5. [HELP] fileRead

    Or simply: local ourText = [[This is line 1 This is line 2 This is line 3 This is line 4 This is line 5 ]] local textLines = split(ourText, "\n") print(table.concat(textLines, "\n"))
  6. [Help] Arrow that targeting one position

  7. Check if something is within four given points

    customBoundaries = { -- this boundary is between the big brown building(s) and the skatepark on the road in LS ["test"] = { {x = 1842.2908935547, y = -1412.469360351}, {x = 1856.8596191406, y = -1412.555664062}, {x = 1851.5925292969, y = -1436.5225830078}, {x = 1842.0438232422, y = -1424.5217285156}, }, } local colorOfBounds = tocolor(255, 0, 0) bindKey("e", "down", function () if isElementWithinBoundary(localPlayer, "test") then colorOfBounds = tocolor(0, 255, 0) else colorOfBounds = tocolor(255, 0, 0) end end ) addEventHandler("onClientRender", getRootElement(), function () local localX, localY, localZ = getElementPosition(localPlayer) local boundary = "test" for i = 1, #customBoundaries[boundary] do local currentPoint = customBoundaries[boundary][i] local nextPoint = customBoundaries[boundary][i + 1] if currentPoint then if i == #customBoundaries[boundary] then nextPoint = customBoundaries[boundary][1] dxDrawLine3D(currentPoint.x, currentPoint.y, localZ, nextPoint.x, nextPoint.y, localZ, colorOfBounds, 3) end dxDrawLine3D(currentPoint.x, currentPoint.y, localZ, nextPoint.x, nextPoint.y, localZ, colorOfBounds, 3) end end end ) function isElementWithinBoundary(element, boundary) if isElement(element) and boundary and customBoundaries[boundary] and #customBoundaries[boundary] >= 3 then local pointX, pointY, pointZ = getElementPosition(element) local intersections = 0 for i = 1, #customBoundaries[boundary] do local currentPoint = customBoundaries[boundary][i] if currentPoint then local nextPoint = customBoundaries[boundary][i + 1] local previousPoint = customBoundaries[boundary][i - 1] if i == 1 then previousPoint = customBoundaries[boundary][1] elseif i == #customBoundaries[boundary] then nextPoint = customBoundaries[boundary][1] end if areIntersecting(pointX, pointY, previousPoint.x, previousPoint.y, currentPoint.x, currentPoint.y, nextPoint.x, nextPoint.y) then intersections = intersections + 1 end end end if intersections > 0 then return true end end return false end function sign(x1, y1, x2, y2, x3, y3) return (x1 - x3) * (y2 - y3) - (x2 - x3) * (y1 - y3) end function areIntersecting(pointX, pointY, x1, y1, x2, y2, x3, y3) local b1 = sign(pointX, pointY, x1, y1, x2, y2) < 0 local b2 = sign(pointX, pointY, x2, y2, x3, y3) < 0 local b3 = sign(pointX, pointY, x3, y3, x1, y1) < 0 return b1 == b2 and b2 == b3 end Tested. Works with 3 or more points. Yes, you can check the element within the the polygon.
  8. Call functions in other directories?

    When you export function and call it in another resource you use those formats: exports.resname:functionName(arguments) or exports["resname"]:functionName(arguments) Then: --script1.lua function output() print ("ok") end --script1 meta.xml <meta> <script src="script1.lua" type="server"/> <export function="output"/> </meta> --script2.lua exports.script1:output() --script2 meta.xml <meta> <include resource="script1"/> <script src="script2.lua" type="server"/> </meta>
  9. Call functions in other directories?

    You can put <include resource="resname" /> or use fileOpen, fileRead, pcall and loadstring functions. local fileHandler = fileOpen(":resfolder/otherScript.lua") if fileHandler then local fileContent = fileRead(fileHandler, fileGetSize(fileHandler)) fileClose(fileHandler) pcall(loadstring(fileContent)) end
  10. Camber

    Use the setElementRotation with rotation order ZYX. Works very well for me.
  11. MTA Checking is player looking at XYZ

    I'm using this one: isLineOfSightClear(playerX, playerY, playerZ, explosionX, explosionY, explosionZ, true, true, false, true, true) Another: local _, _, playerRotZ = getElementRotation(localPlayer) local angle = math.atan2(explosionY - playerY, explosionX - playerX) + math.rad(180 - playerRotZ) if angle < 0 then angle = angle + math.rad(360) end if math.deg(angle) >= 180 then -- facing of explosion -- player flashed end PlayerX/Y/Z works with camera poses.
  12. Bad Quality RenderTarget

    This is font is default-bold? Try to use custom dx font with my opinion. When i use default MTA Fonts my quality looks like yours.
  13. Bad Quality RenderTarget

    For me works very well. I'm using custom dx font with antialiased flag and in the dxDrawText the scale is every time is 1 + added modulate_add blend to renderTarget. The final view: https://i.imgur.com/AYxroK1.png The font size/quality and the scale in render can increase/decrease the quality.
  14. [HELP]

    Yes, enough to change the texture.. or use dxDrawMaterialLine3D https://wiki.multitheftauto.com/wiki/DxDrawMaterialLine3D
  15. Simple question

    Yes, it's possible.