Jump to content

[HELP] dxDrawImage from link


#Viniih

Recommended Posts

(IF POSSIBLE / SE FOR POSSÍVEL)

How do I use an internet img in the dxDrawImage function?

Como faço para usar uma img da internet na função dxDrawImage?

Example:

local link = "https://media.rockstargames.com/rockstargames-newsite/img/global/downloads/buddyiconsconavatars/sanandreas_truth_256x256.jpg"
function teste()
	dxDrawImage(0, 0, 256, 256, link, 0, 0, 0, tocolor(255, 255, 255, 255), false)
end
addEventHandler("onClientRender", root, teste)
Link to comment

not supported, however you can do this...

local link = "https://media.rockstargames.com/rockstargames-newsite/img/global/downloads/buddyiconsconavatars/sanandreas_truth_256x256.jpg"
local pix

requestBrowserDomains({link}, true, function(accepted)
	if not accepted then return end
	fetchRemote(link, function(data, err)
		if err > 0 then error('Error: ', err) end
		pix = dxCreateTexture(data)
	end)	
end)

function teste()
	if pix then
		dxDrawImage(0, 0, 256, 256, pix, 0, 0, 0, tocolor(255, 255, 255, 255), false)
	end
end
addEventHandler("onClientRender", root, teste)

I didn't test it but it should work

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