Abend zusammen,
und zwar habe ich folgende Blips Klick mich die soweit auch ganz gut aussehen nun habe ich das Problem das bei jedem Joinen mal ein paar Icons da sind und ein paar nicht mit den Fehlermeldungen ansich komm ich auch nicht weiter viellicht weiß einer von euch was das sein könnte...
Fehlermeldungen
Externer Inhalt
www2.pic-upload.de
Inhalte von externen Seiten werden ohne Ihre Zustimmung nicht automatisch geladen und angezeigt.
Lua: customblips.lua
---------------BUGS-------------------
--* 1) There's a period in between entering and exiting a vehicle whereby the camera switches its "lock on" from the ped to the vehicle or vice versa
-- During this period, It is not possible to rotate the camera, but getCameraMatrix returns the lookAt point as if it had rotated.
-- This means the customblip rotates like crazy but the radar doesnt
--
--* 2) showPlayerHUDComponent has the ability to hide the radar, but custom blips is not aware of this.
-- All scripts would also need to hook into customblips to notify it whenever hiding the radar
--
-- Bug #2 is most easily fixed if we get a isRadarVisible/isPlayerHUDComponentVisible function or something to that effect
local g_screenX,g_screenY = guiGetScreenSize()
local localPlayer = getLocalPlayer()
--Radar position/size
local rel = { pos_x = 0.0625,
pos_y = 0.76333333333333333333333333333333,
size_x = 0.15,
size_y = 0.175,
radar_blip_y = 0.03333333333333333333333333333333,
}
local abs = { pos_x = math.floor(rel.pos_x * g_screenX),
pos_y = math.floor(rel.pos_y * g_screenY),
size_x = math.floor(rel.size_x * g_screenX),
size_y = math.floor(rel.size_y * g_screenY),
radar_blip_y = math.floor(rel.radar_blip_y * g_screenY)
}
abs.half_size_x = abs.size_x/2
abs.half_size_y = abs.size_y/2
abs.center_x = abs.pos_x + abs.half_size_x
abs.center_y = abs.pos_y +abs.half_size_y
local minBound = 0.1*g_screenY
function getRadarScreenRadius ( angle ) --Since the radar is not a perfect ciricle, we work out the screen size of the radius at a certain angle
return math.max(math.abs((math.sin(angle)*(abs.half_size_x - abs.half_size_y))) + abs.half_size_y,minBound)
end
function renderBlip ( blip, toF11Map, radarWorldX, radarWorldY, camRot, radarRadius, F11minX, F11minY, F11maxX, F11maxY, F11sizeX, F11sizeY )
local blipX,blipY = streamedBlips[blip].x,streamedBlips[blip].y
local width,height = streamedBlips[blip].width,streamedBlips[blip].height
local radarScale = streamedBlips[blip].radarScale
if not toF11Map then
local toBlipRot = getVectorRotation(radarWorldX,radarWorldY,blipX,blipY )
local blipRot = toBlipRot - camRot
--Get the screen radius at that rotation
local radius = getRadarScreenRadius ( blipRot )
local distance = getDistanceBetweenPoints2D ( radarWorldX,radarWorldY,blipX,blipY )
if (distance <= radarRadius) then
radius = (distance/radarRadius)*radius
end
local tx = radius * math.sin(blipRot) + abs.center_x
local ty = -radius * math.cos(blipRot) + abs.center_y
--
local sx,sy = width,height
if radarScale then
sx,sy = width*radarScale, height*radarScale
setWidgetSize (blip,sx,sy)
else
--If the user hasnt forced a radar blip scale, we use GTA's default sizing
local ratio = abs.radar_blip_y/height
sx = ratio*width
sy = abs.radar_blip_y
setWidgetSize (blip,sx,sy)
end
setWidgetPosition(blip,tx-sx/2,ty-sy/2)
else --Render to f11 map
local minX, minY, maxX, maxY, sizeX, sizeY = F11minX, F11minY, F11maxX, F11maxY, F11sizeX, F11sizeY
--
local mapX = blipX + 3000
local mapY = blipY + 3000
mapX = mapX*sizeX + minX
mapY = maxY - mapY*sizeY
--We set the original size in the F11 map
local sx,sy = width,height
setWidgetSize (blip,width,height)
setWidgetPosition(blip,mapX-sx/2,mapY-sy/2)
end
end
Alles anzeigen
Lua: imagelib.lua
dxImage = {}
dxImage_mt = { __index = dxImage }
local g_screenX,g_screenY = guiGetScreenSize()
local visibleImages = {}
local idImages = {}
local idCounter = 0
------
local defaults = {
fX = 0.5,
fY = 0.5,
fWidth = 0,
fHeight = 0,
bRelativePosition = true,
bRelativeSize = true,
fRot = 0,
fRotXOff = 0,
fRotYOff = 0,
strPath = "",
tColor = {255,255,255,255},
bPostGUI = false,
bVisible = true,
}
function dxImage:getByID ( id )
return idImages[id]
end
function dxImage:create( path, x, y, width, height, relative )
assert(not self.fX, "attempt to call method 'create' (a nil value)")
if ( type(path) ~= "string" ) or ( not tonumber(x) ) or ( not tonumber(y) ) then
outputDebugString ( "dxImage:create - Bad argument", 0, 112, 112, 112 )
return false
end
local new = {}
setmetatable( new, dxImage_mt )
--Add default settings
for i,v in pairs(defaults) do
new[i] = v
end
new.fX = x or new.fX
new.fY = y or new.fY
new.strPath = path
new.fWidth = width or new.fWidth
new.fHeight = height or new.fHeight
idCounter = idCounter + 1
idImages[idCounter] = new
new.id = idCounter
if type(relative) == "boolean" then
new.bRelativePosition = relative
new.bRelativeSize = relative
end
visibleImages[new] = true
return new
end
function dxImage:path(path)
if type(path) ~= "string" then return self.strPath end
self.strPath = path
return true
end
function dxImage:position(x,y,relative)
if not tonumber(x) then return self.fX, self.fY end
self.fX = x
self.fY = y
if type(relative) == "boolean" then
self.bRelativePosition = relative
else
self.bRelativePosition = true
end
return true
end
function dxImage:size(x,y,relative)
if not tonumber(x) then return self.fWidth, self.fHeight end
self.fWidth = x
self.fHeight = y
if type(relative) == "boolean" then
self.bRelativeSize = relative
else
self.bRelativeSize = true
end
return true
end
function dxImage:color(r,g,b,a)
if not tonumber(r) then return unpack(self.tColor) end
g = g or self.tColor[2]
b = b or self.tColor[3]
a = a or self.tColor[4]
self.tColor = { r,g,b,a }
return true
end
function dxImage:rotation(rot,xoff,yoff)
if not tonumber(rot) then return self.fRot,self.fRotXOff,self.fRotYOff end
self.fRot = rot or self.fRot
self.fRotXOff = xoff or self.fRotXOff
self.fRotYOff = yoff or self.fRotYOff
return true
end
function dxImage:visible(bool)
if type(bool) ~= "boolean" then return self.bVisible end
self.bVisible = bool
if bool then
visibleImages[self] = true
else
visibleImages[self] = nil
end
return true
end
function dxImage:destroy()
self.bDestroyed = true
setmetatable( self, self )
idImages[self.id] = nil
return true
end
function dxImage:postGUI(bool)
if type(bool) ~= "boolean" then return self.bPostGUI end
self.bPostGUI = bool
return true
end
addEventHandler ( "onClientRender", getRootElement(),
function()
for self,_ in pairs(visibleImages) do
while true do
if self.bDestroyed then
visibleImages[self] = nil
break
end
local x,y,width,height = self.fX,self.fY,self.fWidth,self.fHeight
if self.bRelativePosition then
x = x/g_screenX
y = y/g_screenY
end
if self.bRelativeSize then
width = width/g_screenX
height = height/g_screenY
end
dxDrawImage ( x,y, width, height, self.strPath, self.fRot, self.fRotXOff, self.fRotYOff, tocolor(unpack(self.tColor)), self.bPostGUI )
break
end
end
end
)
Alles anzeigen