Fabioxps Posted April 4, 2013 Share Posted April 4, 2013 can someone tell me what's wrong with line 63 and 65 local localPlayer = getLocalPlayer() 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 / 16 local lpsize = height / 8 local range = 180 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 local huntersonly = false setTimer( function() huntersonly = true for id, player in ipairs(getElementsByType("player")) do if getElementData(player, "state") == "alive" then if getPedOccupiedVehicle(player) and getElementModel(getPedOccupiedVehicle(player)) ~= 425 then huntersonly = false end end end local target = getCameraTarget() if target and getElementType(target) == "vehicle" then localPlayer = getVehicleOccupant(target) else localPlayer = getLocalPlayer() end end,1000,0) rotationRotator = 0 addEventHandler("onClientHUDRender", getRootElement(), function() showPlayerHudComponent("radar", false) local px, py, pz = getElementPosition(localPlayer) local pr = getPedRotation(localPlayer) local cx,cy,_,tx,ty = getCameraMatrix() local north = findRotation(cx,cy,tx,ty) dxDrawImage(posx,posy,height,height, "img/radar.png") dxDrawImage(posx,posy,height,height, "img/north.png", north) for id, player in ipairs(getElementsByType("player")) do local veh = getPedOccupiedVehicle(player) local dimension = getElementDimension(player) if getElementData(localPlayer, "state") == "alive" or getElementData(localPlayer, "state") == "Training" and veh and dimension and player ~= localPlayer then local _,_,rot = getElementRotation(veh) local ex, ey, ez = getElementPosition(veh) 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 local img = "img/blip.png" if (ez - pz) >= 5 then img = "img/blipup.png" elseif (ez - pz) <= -5 then img = "img/blipdown.png" end if tonumber(getElementModel(veh)) == 425 then img = "img/hunter.png" end dxDrawImage(blipx, blipy, blipsize, blipsize, img, north-rot+45, 0, 0, tocolor(r,g,b,a)) if img == "img/hunter.png" then rotationRotator = rotationRotator + 1.25 dxDrawImage(blipx, blipy, blipsize, blipsize, "img/rotor.png", north-rot+45+rotationRotator, 0, 0) end end local vehicle = getPedOccupiedVehicle(localPlayer) dxDrawImage(centerleft - lpsize/2, centertop - lpsize/2, lpsize,lpsize, "img/local.png", north-pr,0,0,tocolor(255,255,255,255)) end end ) Link to comment
Ludo Posted April 4, 2013 Share Posted April 4, 2013 Can you please tell us what does your /debugscript 3 say? Link to comment
Fabioxps Posted April 4, 2013 Author Share Posted April 4, 2013 Can you please tell us what does your /debugscript 3 say? has no errors but the beeps(blips) of players who are in training appears to them that are with state alive Link to comment
Ludo Posted April 4, 2013 Share Posted April 4, 2013 Can you please tell us what does your /debugscript 3 say? has no errors but the beeps(blips) of players who are in training appears to them that are with state alive Of course, because here in line 65 you put: if getElementData(localPlayer, "state") == "alive" or getElementData(localPlayer, "state") == "Training" and veh and dimension and player ~= localPlayer then that creates the blips for both in-training and alive player, so you just have to replace it with: if getElementData(localPlayer, "state") == "alive" and veh and dimension and player ~= localPlayer then Link to comment
Fabioxps Posted April 4, 2013 Author Share Posted April 4, 2013 but I want to hide the blips of players alive when I'm in training I see blips of all players Link to comment
Ludo Posted April 4, 2013 Share Posted April 4, 2013 but I want to hide the blips of players alive when I'm in training I see blips of all players This function shows the blips of alive players TO alive players and blips of in-training players TO in-training players rotationRotator = 0 addEventHandler("onClientHUDRender", getRootElement(), function() showPlayerHudComponent("radar", false) local px, py, pz = getElementPosition(localPlayer) local pr = getPedRotation(localPlayer) local cx,cy,_,tx,ty = getCameraMatrix() local north = findRotation(cx,cy,tx,ty) dxDrawImage(posx,posy,height,height, "img/radar.png") dxDrawImage(posx,posy,height,height, "img/north.png", north) for id, player in ipairs(getElementsByType("player")) do local veh = getPedOccupiedVehicle(player) local dimension = getElementDimension(player) if getElementData(player, "state") == getElementData(localPlayer, "state") then if player ~= localPlayer then local _,_,rot = getElementRotation(veh) local ex, ey, ez = getElementPosition(veh) 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 local img = "img/blip.png" if (ez - pz) >= 5 then img = "img/blipup.png" elseif (ez - pz) <= -5 then img = "img/blipdown.png" end if tonumber(getElementModel(veh)) == 425 then img = "img/hunter.png" end dxDrawImage(blipx, blipy, blipsize, blipsize, img, north-rot+45, 0, 0, tocolor(r,g,b,a)) if img == "img/hunter.png" then rotationRotator = rotationRotator + 1.25 dxDrawImage(blipx, blipy, blipsize, blipsize, "img/rotor.png", north-rot+45+rotationRotator, 0, 0) end end end local vehicle = getPedOccupiedVehicle(localPlayer) dxDrawImage(centerleft - lpsize/2, centertop - lpsize/2, lpsize,lpsize, "img/local.png", north-pr,0,0,tocolor(255,255,255,255)) end end ) Link to comment
Fabioxps Posted April 4, 2013 Author Share Posted April 4, 2013 but I want to hide the blips of players alive when I'm in training I see blips of all players This function shows the blips of alive players TO alive players and blips of in-training players TO in-training players rotationRotator = 0 addEventHandler("onClientHUDRender", getRootElement(), function() showPlayerHudComponent("radar", false) local px, py, pz = getElementPosition(localPlayer) local pr = getPedRotation(localPlayer) local cx,cy,_,tx,ty = getCameraMatrix() local north = findRotation(cx,cy,tx,ty) dxDrawImage(posx,posy,height,height, "img/radar.png") dxDrawImage(posx,posy,height,height, "img/north.png", north) for id, player in ipairs(getElementsByType("player")) do local veh = getPedOccupiedVehicle(player) local dimension = getElementDimension(player) if getElementData(player, "state") == getElementData(localPlayer, "state") then if player ~= localPlayer then local _,_,rot = getElementRotation(veh) local ex, ey, ez = getElementPosition(veh) 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 local img = "img/blip.png" if (ez - pz) >= 5 then img = "img/blipup.png" elseif (ez - pz) <= -5 then img = "img/blipdown.png" end if tonumber(getElementModel(veh)) == 425 then img = "img/hunter.png" end dxDrawImage(blipx, blipy, blipsize, blipsize, img, north-rot+45, 0, 0, tocolor(r,g,b,a)) if img == "img/hunter.png" then rotationRotator = rotationRotator + 1.25 dxDrawImage(blipx, blipy, blipsize, blipsize, "img/rotor.png", north-rot+45+rotationRotator, 0, 0) end end end local vehicle = getPedOccupiedVehicle(localPlayer) dxDrawImage(centerleft - lpsize/2, centertop - lpsize/2, lpsize,lpsize, "img/local.png", north-pr,0,0,tocolor(255,255,255,255)) end end ) thx,thank you 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