Skip to content

Instantly share code, notes, and snippets.

@Xinerki
Created June 6, 2023 06:59
Show Gist options
  • Save Xinerki/bbad067595c560d336174497a136b0d4 to your computer and use it in GitHub Desktop.
Save Xinerki/bbad067595c560d336174497a136b0d4 to your computer and use it in GitHub Desktop.
nfs heat style
function math.clamp(value, minClamp, maxClamp)
return math.min(maxClamp, math.max(value, minClamp))
end
function DrawSprite3D(textureDict, textureName, x, y, z, width, height, heading, red, green, blue, alpha)
x = x + math.sin(math.rad(-heading-90.0)) * (width*0.5)
y = y + math.cos(math.rad(-heading-90.0)) * (width*0.5)
--z = z -0.5
local offX = math.sin(math.rad(-heading+90)) * width
local offY = math.cos(math.rad(-heading+90)) * width
DrawSpritePoly(
x+offX, y+offY, z, -- bottom right
x, y, z+height, -- top left
x, y, z, -- bottom left
red, green, blue, alpha,
textureDict,
textureName,
1.0, 0.0, 0.0,
0.0, -1.0, 0.0,
0.0, 0.0, 1.0)
DrawSpritePoly(
x, y, z+height, -- top left
x+offX, y+offY, z, -- bottom right
x+offX, y+offY, z+height, -- top right
red, green, blue, alpha,
textureDict,
textureName,
-1.0, 0.0, 0.0,
0.0, 1.0, 0.0,
0.0, 0.0, 1.0)
end
local locations = {
vector3(-318.859039, 6074.433105, 30.614943),
vector3(1704.671997, 3748.880615, 33.286053),
vector3(-1108.600830, 2685.694092, 18.177374),
vector3(-3155.888672, 1073.844482, 20.188726),
vector3(2571.371826, 313.879608, 107.970573),
vector3(235.666794, -42.263149, 69.221313),
vector3(-1328.592896, -387.114410, 36.126881),
vector3(-665.232727, -952.522522, 20.866556),
vector3(844.439026, -1009.422424, 27.511728),
vector3(17.377790, -1122.183105, 28.469843),
vector3(814.442017, -2130.448486, 28.867798),
}
CreateThread(function()
while true do Wait(0)
for i,v in pairs(locations) do
local distance = math.max(#(GetFinalRenderedCamCoord().xy - v.xy) - 100, 0)
local alpha = (1-(15/distance))*255
local alpha = math.floor(math.clamp(alpha, 0, 128))
DrawMarker(1,
v.x, v.y, 0.0,
0.0, 0.0, 0.0,
0.0, 0.0, 0.0,
10.0, 10.0, GetEntityCoords(PlayerPedId()).z + 200.0,
255, 255, 255, alpha,
false,
false,
0,
false)
DrawSprite3D("commonmenu", "shop_gunclub_icon_a", v.x, v.y, GetEntityCoords(PlayerPedId()).z + 200.0, 50.0, 50.0, GetFinalRenderedCamRot().z, 255, 255, 255, alpha)
end
end
end)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment