Jump to content

Compiling Images?


Karuzo

Recommended Posts

Posted

Hey guys,

I wanted to "compile" my images , so people who use leaked scripts , can't use them.

But i don't know how i could save my images ...

Or is there a way in the meta.xml like : ?

Any ideas?

Thank you for your replies.

Posted
haha funny, i didn't say that i don't like people , i just don't like them who steal scripts.

hmm , you mean with fetchRemote ?

fileDelete("image.png") 

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

Posted

Hmm, that's true.

I've already compiled the script , and set my cache to false.

Well if there's no other way its ok.

But thank you for your help.

Posted (edited)

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

Or what you can do is to do a bit ADDITION in each byte of the pixels so that image gets like 'compiled', and when you read it you do REMOVE that bit from each byte.

Posted

@xXMADEXx, if the server has enough network speed, there won't be any lag cause latent events don't block main traffic thus not touching the main thread. So that relies only on host's network bandwidth.

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