hi , i just started use fetchRemote
and i tried the example from the wiki ( the image one ) , but it didn't work although the url is working ..
-- server
function ShowImage (player)
outputChatBox ( "event called, fetching image..." )
fetchRemote ( "https://img.icons8.com/cotton/2x/baby.png",
function ( response, error )
if error == 0 then
if player then
triggerClientEvent ( player, "onClientGotImage", player, response )
outputChatBox ( "data sucessfully send to the player" )
else
outputChatBox ( "bad argument (player) ("..tostring(player)..")" )
end
else
outputChatBox ( "error "..error.." when fetching image." )
end
end
)
end
addEventHandler("onResourceStart",root,ShowImage)
--- client
local myTexture
addEvent( "onClientGotImage", true )
addEventHandler( "onClientGotImage", root,
function( pixels )
outputChatBox ( "client: ok." )
if myTexture and isElement ( myTexture ) then
destroyElement( myTexture )
end
myTexture = dxCreateTexture( pixels )
end
)
addEventHandler("onClientRender", root,
function()
if myTexture then
local w,h = dxGetMaterialSize( myTexture )
dxDrawImage( 200, 100, w, h, myTexture )
end
end )
it says data has been sent but nothing happens
thanks in advance