Jump to content

Compiling Images?


Karuzo

Recommended Posts

and create it if i need it ?

wouldn't it be to much work ?

I don't even know if this works at all.

Not sure if the file has to exist the whole time.

Wouldn't it be easier to keep your scripts safe?

People can still take screenshots if your pictures are that awesome.

Link to comment

there is another way. You can send the image clientside with triggerLatentClientEvent (use latent instead of default here cause it doesn't block the main traffic!) with the pixels. Here goes the tutorial from wiki:

-- SERVER 
function startImageDownload( playerToReceive ) 
    fetchRemote ( "http://www.example.com/image.jpg", myCallback, "", false, playerToReceive ) 
end 
  
function myCallback( responseData, errno, playerToReceive ) 
    if errno == 0 then 
        triggerClientEvent( playerToReceive, "onClientGotImage", resourceRoot, responseData ) 
    end 
end 

--CLIENT 
addEvent( "onClientGotImage", true ) 
addEventHandler( "onClientGotImage", resourceRoot, 
    function( pixels ) 
        if 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 
) 

This way, the image won't be even saved to the drive. fileDelete doesn't trigger until you finish the download so ANYONE can get your images while downloading. Same with scripts.

Edited by Guest
Link to comment
there is another way. You can send the image clientside with triggerLatentClientEvent (use latent instead of default here cause it doesn't block the main traffic!) with the pixels. Here goes the tutorial from wiki:
-- SERVER 
function startImageDownload( playerToReceive ) 
    fetchRemote ( "http://www.example.com/image.jpg", myCallback, "", false, playerToReceive ) 
end 
  
function myCallback( responseData, errno, playerToReceive ) 
    if errno == 0 then 
        triggerClientEvent( playerToReceive, "onClientGotImage", resourceRoot, responseData ) 
    end 
end 

--CLIENT 
addEvent( "onClientGotImage", true ) 
addEventHandler( "onClientGotImage", resourceRoot, 
    function( pixels ) 
        if 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 
) 

This way, the image won't be even saved to the drive. fileDelete doesn't trigger until you finish the download so ANYONE can get your images while downloading. Same with scripts.

This would require the server to download the image every time the function is called, and welll... You'll get some nice lag.
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...