Jump to content

Marker Custom


Hiuguer

Recommended Posts

I have two MarkerCustom mods, the first one changes all markers, the other one has the marker I want but doesn't change them all, I wanted someone to merge these two mods into one

--Marker client file that replaces all markers in the city

addEventHandler("onClientResourceStart", resourceRoot,
function()
	shwaeki = dxCreateShader( "Arquivos/Castiel.fx" )
	texture = dxCreateTexture("Arquivos/marker.png")
	dxSetShaderValue(shwaeki, "MarkerSkin", texture)
	engineApplyShaderToWorldTexture(shwaeki, "cj_w_grad")
end )
-- Client file of the marker I want

anim_tick = getTickCount()

local maxDist = 5
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)

 

assets/tipos/1.png

assets/circulos/1.png

 

(The marker files I want)

mta-screen_2021-07-16_15-42-58.png

 

The marker I want

Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...