Hello guys ..
I would like someone to help me.
This is a Radar script designed for race gamemode by Borderline. You can only see the players blips but... what should I do to see the other blips? I mean, all these blips:
https://wiki.multitheftauto.com/wiki/Radar_Blips
local sx,sy = guiGetScreenSize()
local posx = sy * 0.05
local posy = sy * 0.725
local height = sy * 0.225
local centerleft = posx + height / 2
local centertop = posy + height / 2
local blipsize = height / 13
local lpsize = height / 8
local range = 90
rotFX = 0.0
local lp = getLocalPlayer()
blipDistance = 100
function findRotation(x1,y1,x2,y2)
local t = -math.deg(math.atan2(x2-x1,y2-y1))
if t < 0 then t = t + 360 end
return t
end
function getDistanceRotation(x, y, dist, angle)
local a = math.rad(90 - angle)
local dx = math.cos(a) * dist
local dy = math.sin(a) * dist
return x+dx, y+dy
end
addEventHandler("onClientRender", getRootElement(),
function()
setPlayerHudComponentVisible("radar", false)
local px, py, pz = getElementPosition(lp)
local pr = getPedRotation(lp)
local cx,cy,_,tx,ty = getCameraMatrix()
local north = findRotation(cx,cy,tx,ty)
rotFX = rotFX + 1.0
health = getElementHealth( getLocalPlayer() )
lineLength1 = 114 * ( health / 100 )
local maxHealth = 100;
local colourPercent = ( health / maxHealth ) * 200;
local red, green;
if health < ( maxHealth / 2 ) then
red = 200;
green = ( health / 50 ) * ( colourPercent * 2 );
else
green = 200;
red = 200 - ( ( health - 50 ) / 50 ) * 200;
end
local color2 = tocolor( red, green, 0, 200 )
dxDrawImage(posx,posy,height,height, "Radar/Images/radar_illustration.png", rotFX,0, 0, color2)
dxDrawImage(posx,posy,height,height, "Radar/Images/radar.png")
dxDrawImage(posx,posy,height,height, "Radar/Images/north.png", north)
for id, player in ipairs(getElementsByType("player")) do
local veh = getPedOccupiedVehicle(player)
if player ~= lp then
local _,_,rot = getElementRotation(player)
local ex, ey, ez = getElementPosition(player)
local dist = getDistanceBetweenPoints2D(px,py,ex,ey)
if dist > range then
dist = tonumber(range)
end
local angle = 180-north + findRotation(px,py,ex,ey)
local cblipx, cblipy = getDistanceRotation(0, 0, height*(dist/range)/2, angle)
local blipx = centerleft+cblipx-blipsize/2
local blipy = centertop+cblipy-blipsize/2
local yoff = 0
local r,g,b,a = 255,255,255,255
if getPlayerTeam(player) then
r,g,b = getTeamColor( getPlayerTeam(player) )
end
if (getDistanceBetweenPoints3D ( px, py, pz, ex, ey, ez ) <= blipDistance ) then
local img = "Radar/Images/blip.png"
if (ez - pz) >= 5 then
img = "Radar/Images/blipup.png"
elseif (ez - pz) <= -5 then
img = "Radar/Images/blipdown.png"
end
dxDrawImage(blipx, blipy, blipsize, blipsize, img, 0, 0, 0, tocolor(r,g,b,a))
end
end
end
dxDrawImage(centerleft - lpsize/2, centertop - lpsize/2, lpsize,lpsize, "Radar/Images/local.png", north-pr)
end
)