iPollo Posted March 8, 2020 Share Posted March 8, 2020 Hello, the first problem I am facing, is that in this function, there are no parameters that appear in the Wiki, it was supposed to have a height parameter, and two others (height and length of the image itself), but when I modify these values, only the width affects the image, because the height is related to the height of the drawing in relation to the element, so I cannot resize the image correctly. function dxDrawImageOnElement(TheElement,Image,distance,height,width,R,G,B,alpha) local x, y, z = getElementPosition(TheElement) local x2, y2, z2 = getElementPosition(localPlayer) local distance = distance or 20 local height = height or 1 local width = width or 1 local checkBuildings = checkBuildings or true local checkVehicles = checkVehicles or false local checkPeds = checkPeds or false local checkObjects = checkObjects or true local checkDummies = checkDummies or true local seeThroughStuff = seeThroughStuff or false local ignoreSomeObjectsForCamera = ignoreSomeObjectsForCamera or false local ignoredElement = ignoredElement or nil if (isLineOfSightClear(x, y, z, x2, y2, z2, checkBuildings, checkVehicles, checkPeds , checkObjects,checkDummies,seeThroughStuff,ignoreSomeObjectsForCamera,ignoredElement)) then local sx, sy = getScreenFromWorldPosition(x, y, z+height) if(sx) and (sy) then local distanceBetweenPoints = getDistanceBetweenPoints3D(x, y, z, x2, y2, z2) if(distanceBetweenPoints < distance) then dxDrawMaterialLine3D(x, y, z+1+height-(distanceBetweenPoints/distance), x, y, z+height, Image, width-(distanceBetweenPoints/distance), tocolor(R or 255, G or 255, B or 255, alpha or 255)) end end end end On the wiki: Required arguments TheElement: The element you want to draw the image on it. Image: The image you want. Use dxCreateTexture to create it. Optional arguments height: The height of the text, it's 1 by default. distance: The distance you will be able to view the image from, it's 20 by default. height: The height of the image, it's 1 by default. width: The width of the image, it's 1 by default. it seems that there is no second image height parameter (third item of optional arguments), only the first one. Link to comment
_Ace Posted March 8, 2020 Share Posted March 8, 2020 try this: function dxDrawImageOnElement(TheElement,Image,distance,height,width,R,G,B,alpha) local x, y, z = getElementPosition(TheElement) local x2, y2, z2 = getElementPosition(localPlayer) local distance = distance or 20 local height = height or 1 local width = width or 1 local checkBuildings = checkBuildings or true local checkVehicles = checkVehicles or false local checkPeds = checkPeds or false local checkObjects = checkObjects or true local checkDummies = checkDummies or true local seeThroughStuff = seeThroughStuff or false local ignoreSomeObjectsForCamera = ignoreSomeObjectsForCamera or false local ignoredElement = ignoredElement or nil if (isLineOfSightClear(x, y, z, x2, y2, z2, checkBuildings, checkVehicles, checkPeds , checkObjects,checkDummies,seeThroughStuff,ignoreSomeObjectsForCamera,ignoredElement)) then local sx, sy = getScreenFromWorldPosition(x, y, z+height) if(sx) and (sy) then local distanceBetweenPoints = getDistanceBetweenPoints3D(x, y, z, x2, y2, z2) if(distanceBetweenPoints < distance) then dxDrawMaterialLine3D(x, y, z+1+height-(distanceBetweenPoints/distance*width)-1+width, x, y, z+height, Image, width-(distanceBetweenPoints/distance*width), tocolor(R or 255, G or 255, B or 255, alpha or 255)) end end end end I edited the line: dxDrawMaterialLine3D(x, y, z+1+height-(distanceBetweenPoints/distance*width)-1+width, x, y, z+height, Image, width-(distanceBetweenPoints/distance*width), tocolor(R or 255, G or 255, B or 255, alpha or 255)) to make the width parameter to work as scale/resize, use dxDrawImageOnElement with 4 in parameter width for example, will make the image 4x larger 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