Jump to content

BLIPS NO GPS


Recommended Posts

Pessoal estou com um sistema de gps completo, mais ele não exibe os blips alguem poderia me ajudar pf ?

 

local wx, hy = guiGetScreenSize()
local gpsX = 250
local gpsY = 196
local mapSizeX = 214
local mapSizeY = 121
local mapX = -7.00
local mapY = hy-gpsY- -1
local playerX = mapX+127
local playerY = mapY+83.5
local playerSizeX = 26
local playerSizeY = 27
local playerSizeX2 = 16
local playerSizeY2 = 16

addEventHandler("onClientResourceStart", getResourceRootElement(),function()
	xsize = mapSizeX+30
	rr = dxCreateRenderTarget(xsize,xsize,true)
	rr2 = dxCreateRenderTarget(xsize,xsize,true)
	centerleft = xsize / 2 
	centertop = mapSizeY / 2 
	blipsize = 16
end)

playerTexture = dxCreateTexture ("images/GPS/player.png","argb",false,"clamp")
playerTexture2 = dxCreateTexture ("images/GPS/player.png","argb",false,"clamp")
mapTexture = dxCreateTexture ("images/GPS/radar.jpg","argb",false,"clamp")
gpsTexture = dxCreateTexture ("images/GPS/gps.png","argb",false,"clamp")

function drawPlayersInTeam(x,y)
    setPlayerHudComponentVisible("radar", false)
	if not getElementData(getLocalPlayer(),"logedin") then return end
	if getElementData(getLocalPlayer(),"GPS") < 1 then return end
	for i, player in ipairs(getElementsByType("player")) do
		if getElementData(player,"gang") == getElementData(getLocalPlayer(),"gang") and getElementData(localPlayer,"gang") ~= 5000 and player ~= localPlayer and getElementData(player,"GPS") > 0 then
			local playerx,playery = getElementPosition (player)
			local _,_,rotplayer = getElementRotation(player)
			if getDistanceBetweenPoints2D ( x,y,playerx,playery) < 5000 then
				local markx, marky
				if x > 0 and y > 0 then
					markx, marky = centerleft+(math.abs(playerx/2)-math.abs(x/2)), centerleft-(math.abs(playery/2)-math.abs(y/2))
				elseif x < 0 and y < 0 then
					markx, marky = centerleft-(math.abs(playerx/2)-math.abs(x/2)), centerleft+(math.abs(playery/2)-math.abs(y/2))
				elseif x < 0 and y > 0 then
					markx, marky = centerleft-(math.abs(playerx/2)-math.abs(x/2)), centerleft-(math.abs(playery/2)-math.abs(y/2))
				elseif x > 0 and y < 0 then
					markx, marky = centerleft+(math.abs(playerx/2)-math.abs(x/2)), centerleft+(math.abs(playery/2)-math.abs(y/2))
				end
				dxDrawImage(markx-(playerSizeX2/2), marky-(playerSizeY2/2),playerSizeX2,playerSizeY2,playerTexture2,-rotplayer,0,0,tocolor(0, 0, 255))
				--dxDrawImage(markx-(playerSizeX2/2), marky-(playerSizeY2/2),playerSizeX2,playerSizeY2,playerTexture2,-rotplayer,0,0,tocolor(0, 0, 255))
				--dxDrawImage(markx-(playerSizeX2/2), marky-(playerSizeY2/2),playerSizeX2,playerSizeY2,playerTexture2,-rotplayer,0,0,tocolor(0, 0, 255))
			end
		end	
	end	
end

function createGPS()
	--if not getElementData(getLocalPlayer(),"logedin") then return end
	if getElementData(getLocalPlayer(),"GPS") < 1 then return end
	local x,y = getElementPosition(getLocalPlayer())
    local _, _,camrot = getElementRotation(getCamera())
	dxSetRenderTarget(rr)
	dxDrawImageSection(0,0,xsize,xsize,1500+x/2-centerleft,1500-y/2-centerleft,xsize,xsize,mapTexture,0,0,0)
	drawPlayersInTeam(x,y)
	dxSetRenderTarget()
	dxSetRenderTarget(rr2)	
	dxDrawImage(0,0,xsize,xsize,rr,camrot)
	dxSetRenderTarget()
	dxDrawImageSection(mapX+20,mapY+22,mapSizeX,mapSizeY,(xsize-mapSizeX)/2,(xsize-mapSizeY)/2,mapSizeX,mapSizeY,rr2,0,0,0)
	dxDrawImage(playerX-playerSizeX/2,playerY-playerSizeY/2,playerSizeX,playerSizeY,playerTexture,0,0,0,tocolor(255, 0, 0, 255))
	dxDrawImage(playerX-playerSizeX/2,playerY-playerSizeY/2,playerSizeX,playerSizeY,playerTexture,0,0,0,tocolor(255, 0, 0, 255))
	--dxDrawImage(playerX-playerSizeX/2,playerY-playerSizeY/2,playerSizeX,playerSizeY,playerTexture,0,0,0,tocolor(255, 0, 0, 255))
	dxDrawImage(mapX+7,mapY,gpsX,gpsY,gpsTexture)
end
addEventHandler("onClientRender", getRootElement(), createGPS)

 

Link to comment

tente assim agora: 

local wx, hy = guiGetScreenSize()
local gpsX = 250
local gpsY = 196
local mapSizeX = 214
local mapSizeY = 121
local mapX = -7.00
local mapY = hy-gpsY- -1
local playerX = mapX+127
local playerY = mapY+83.5
local playerSizeX = 26
local playerSizeY = 27
local playerSizeX2 = 16
local playerSizeY2 = 16

addEventHandler("onClientResourceStart", getResourceRootElement(),function()
	xsize = mapSizeX+30
	rr = dxCreateRenderTarget(xsize,xsize,true)
	rr2 = dxCreateRenderTarget(xsize,xsize,true)
	centerleft = xsize / 2 
	centertop = mapSizeY / 2 
	blipsize = 16
end)

playerTexture = dxCreateTexture ("images/GPS/player.png","argb",false,"clamp")
playerTexture2 = dxCreateTexture ("images/GPS/player.png","argb",false,"clamp")
mapTexture = dxCreateTexture ("images/GPS/radar.jpg","argb",false,"clamp")
gpsTexture = dxCreateTexture ("images/GPS/gps.png","argb",false,"clamp")

function drawPlayersInTeam(x,y)
    setPlayerHudComponentVisible("radar", false)
	--if not getElementData(getLocalPlayer(),"logedin") then return end
	if getElementData(getLocalPlayer(),"GPS") < 1 then return end
	for i, player in ipairs(getElementsByType("player")) do
		if getElementData(player,"gang") == getElementData(getLocalPlayer(),"gang") and getElementData(localPlayer,"gang") ~= 5000 and player ~= localPlayer and getElementData(player,"GPS") > 0 then
			local playerx,playery = getElementPosition (player)
			local _,_,rotplayer = getElementRotation(player)
			if getDistanceBetweenPoints2D ( x,y,playerx,playery) < 5000 then
				local markx, marky
				if x > 0 and y > 0 then
					markx, marky = centerleft+(math.abs(playerx/2)-math.abs(x/2)), centerleft-(math.abs(playery/2)-math.abs(y/2))
				elseif x < 0 and y < 0 then
					markx, marky = centerleft-(math.abs(playerx/2)-math.abs(x/2)), centerleft+(math.abs(playery/2)-math.abs(y/2))
				elseif x < 0 and y > 0 then
					markx, marky = centerleft-(math.abs(playerx/2)-math.abs(x/2)), centerleft-(math.abs(playery/2)-math.abs(y/2))
				elseif x > 0 and y < 0 then
					markx, marky = centerleft+(math.abs(playerx/2)-math.abs(x/2)), centerleft+(math.abs(playery/2)-math.abs(y/2))
				end
				dxDrawImage(markx-(playerSizeX2/2), marky-(playerSizeY2/2),playerSizeX2,playerSizeY2,playerTexture2,-rotplayer,0,0,tocolor(0, 0, 255))
				--dxDrawImage(markx-(playerSizeX2/2), marky-(playerSizeY2/2),playerSizeX2,playerSizeY2,playerTexture2,-rotplayer,0,0,tocolor(0, 0, 255))
				--dxDrawImage(markx-(playerSizeX2/2), marky-(playerSizeY2/2),playerSizeX2,playerSizeY2,playerTexture2,-rotplayer,0,0,tocolor(0, 0, 255))
			end
		end	
	end	
end

function createGPS()
	--if not getElementData(getLocalPlayer(),"logedin") then return end
	if getElementData(getLocalPlayer(),"GPS") < 1 then return end
	local x,y = getElementPosition(getLocalPlayer())
    local _, _,camrot = getElementRotation(getCamera())
	dxSetRenderTarget(rr)
	dxDrawImageSection(0,0,xsize,xsize,1500+x/2-centerleft,1500-y/2-centerleft,xsize,xsize,mapTexture,0,0,0)
	drawPlayersInTeam(x,y)
	dxSetRenderTarget()
	dxSetRenderTarget(rr2)	
	dxDrawImage(0,0,xsize,xsize,rr,camrot)
	dxSetRenderTarget()
	dxDrawImageSection(mapX+20,mapY+22,mapSizeX,mapSizeY,(xsize-mapSizeX)/2,(xsize-mapSizeY)/2,mapSizeX,mapSizeY,rr2,0,0,0)
	dxDrawImage(playerX-playerSizeX/2,playerY-playerSizeY/2,playerSizeX,playerSizeY,playerTexture,0,0,0,tocolor(255, 0, 0, 255))
	dxDrawImage(playerX-playerSizeX/2,playerY-playerSizeY/2,playerSizeX,playerSizeY,playerTexture,0,0,0,tocolor(255, 0, 0, 255))
	--dxDrawImage(playerX-playerSizeX/2,playerY-playerSizeY/2,playerSizeX,playerSizeY,playerTexture,0,0,0,tocolor(255, 0, 0, 255))
	dxDrawImage(mapX+7,mapY,gpsX,gpsY,gpsTexture)
end
addEventHandler("onClientRender", getRootElement(), createGPS)

 

  • Thanks 1
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...