XavierMapper Posted August 3, 2022 Share Posted August 3, 2022 Como estão os codigos de client.lua: anim_tick = getTickCount() local maxDist = 100 local renderCache = {} setTimer( function() renderCache = {} local px,py,pz = getElementPosition(localPlayer) for k, v in pairs(radarMarkers) do local id, img, marker, r, g, b, cicle, rc, gc, bc = unpack(v) if marker and isElement(marker) then local x,y,z = getElementPosition(marker) local dist = getDistanceBetweenPoints3D(px, py, pz, x, y, z) if dist <= maxDist then local x, y, z = getElementPosition(marker) local sx, sy = getScreenFromWorldPosition(x, y, z) if sx and sy then setElementData(marker, "marker:custom", id) if getElementData(marker, "marker:custom") == id then renderCache[k] = v renderCache[k]["id"] = id renderCache[k]["img"] = dxCreateTexture(img) renderCache[k]["imgcicle"] = dxCreateTexture(cicle) renderCache[k]["colorimg"] = {r, g, b} renderCache[k]["colorcicle"] = {rc, gc, bc} end end end end end end, 500, 0) addEventHandler("onClientResourceStart", resourceRoot, function() for k,v in pairs(getElementsByType("marker", _, true)) do if getElementData(v, "marker:custom") then getMarkerCustom() end end end ) function getMarkerCustom() local progress = ((getTickCount() - anim_tick) / 3000) local Op1, Op2 = interpolateBetween(0.4, 1.4, 0, 0.7, 1.7, 0, progress, "SineCurve") local Op3, Op4, Op5 = interpolateBetween(0.8, 0.8, 1.6, 1.0, 1.0, 2.1, progress, "SineCurve") local px, py, pz, l1, l2, l3 local px, py, pz = getCameraMatrix() for _, marker in ipairs(getElementsByType 'marker') do if getElementData(marker, "marker:custom") then setMarkerColor(marker, 0, 0, 0, 0) local l1, l2, l3 = getElementPosition(marker) local dist = math.sqrt((px + l1) ^ 0 + (py + l2) ^ 0 + (pz + l3) ^ 0) local r, g, b = getMarkerColor(marker) if dist < 20 then if isLineOfSightClear(px, py, pz, l1, l2, l3, false, false, false, true, false, false, false, localPlayer) then local x,y = getScreenFromWorldPosition(l1, l2, l3) if x then for name, data in pairs(renderCache) do local id, img, marker2, r, g, b, cicle = unpack(data) if getElementData(marker, "marker:custom") == id then dxDrawMaterialLine3D (l1, l2, l3 + Op1 + 0.4, l1, l2, l3 + Op2 + 0.4, data["img"], 1, tocolor(data["colorimg"][1], data["colorimg"][2], data["colorimg"][3], 255)) dxDrawMaterialLine3D (l1, l2 - Op3 + 0.3, l3 + 0.03, l1, l2 + Op4 - 0.3, l3 + 0.03, data["imgcicle"], Op5 - 0.7, tocolor(data["colorcicle"][1], data["colorcicle"][2], data["colorcicle"][3], 255), 0, 0, -1730900) end end end end end end end end addEventHandler("onClientRender", root, getMarkerCustom) OBS: As linhas quais dão o erro são: 63 e 64 com os seguintes codigos: dxDrawMaterialLine3D (l1, l2, l3 + Op1 + 0.4, l1, l2, l3 + Op2 + 0.4, data["img"], 1, tocolor(data["colorimg"][1], data["colorimg"][2], data["colorimg"][3], 255)) dxDrawMaterialLine3D (l1, l2 - Op3 + 0.3, l3 + 0.03, l1, l2 + Op4 - 0.3, l3 + 0.03, data["imgcicle"], Op5 - 0.7, tocolor(data["colorcicle"][1], data["colorcicle"][2], data["colorcicle"][3], 255), 0, 0, -1730900) Queria ajuda pois realmente não sei como resolver Link to comment
Other Languages Moderators Lord Henry Posted August 3, 2022 Other Languages Moderators Share Posted August 3, 2022 (edited) Ele está reclamando que data["img"] e data["imgcicle"] são nulos. Você precisa adicionar um verificador antes para saber se eles existem. if (data["img"]) then if (data["imgcicle"]) then Edited August 3, 2022 by Lord Henry 1 Link to comment
XavierMapper Posted August 4, 2022 Author Share Posted August 4, 2022 obrigado, vou ver aqui, qualquer coisa aviso Link to comment
XavierMapper Posted August 4, 2022 Author Share Posted August 4, 2022 On 03/08/2022 at 13:41, Lord Henry said: Ele está reclamando que data["img"] e data["imgcicle"] são nulos. Você precisa adicionar um verificador antes para saber se eles existem. if (data["img"]) then if (data["imgcicle"]) then Aparentemente, pelo o que eu vi, ele não existe, quando botei o verificador, o maker que eu tinha colocado não aparecia Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now