Jump to content

[Help] Delete image


Recommended Posts

Haven't tried it but you could check if the file exists as they're disconnecting, if it does, delete it. It's not optimal since they can still get it while the server is running.

You can also try to make it private, read this for info. They can still find it - if they know where to look.

Other than that I guess you're out of luck since it's very hard to protect images in general. Since they could just take a screenshot while in-game and go from there.

Link to comment
Haven't tried it but you could check if the file exists as they're disconnecting, if it does, delete it. It's not optimal since they can still get it while the server is running.
He can also just delete it as soon as the script is loaded by just typing the fileDelete function anywhere in the script file, it will be loaded as soon as the script is ran, bypassing it will still be possible by downloading the image and disconnecting before the script is ran, a bit hard but possible.

Another way would be to use fetchRemote on an image on the web and then drawing it for the client, check the wiki page for more info and an example.

Link to comment
Yes, you can simply disconnect before the script that deletes the file is ran. Best way to do this would be fetching the image content from the web and drawing it.

ve if you can help me.

got this from the client side script

local screenWidth,screenHeight = guiGetScreenSize() 
  
function createText1 ( ) 
      if getElementData(getLocalPlayer(), "grung") >= 4 and getElementData(getLocalPlayer(), "grung") <= 7 then 
    
    grung1= dxDrawImage(screenWidth * 0.93, screenHeight * 0.85, screenHeight * 0.070, screenHeight * 0.070, "image1.png", 0, 0, 0, tocolor(250, 100,100)) 
    end 
      if getElementData(getLocalPlayer(), "grung") >= 1 and getElementData(getLocalPlayer(), "grung") <= 5 then 
    grung2= dxDrawImage(screenWidth * 0.93, screenHeight * 0.85, screenHeight * 0.070, screenHeight * 0.070, "image2.png", 0, 0, 0, tocolor(250, 150,150)) 
    end 
     end 
function HandleTheRendering ( ) 
 if render then 
    removeEventHandler ( "onClientRender", root, createText1 ) 
    render = false 
 else 
   addEventHandler ( "onClientRender", root, createText1 ) 
   render = true 
 end 
end 
addEventHandler ( "onClientResourceStart", resourceRoot, HandleTheRendering )   
bindKey( 'F3', 'down', HandleTheRendering ) 

as I lay fetch that script?

image1 http://1.bp.blogspot.com/-t29gjlF4SKo/U ... 0/icon.png

image2: https://fbcdn-profile-a.akamaihd.net/hp ... 7854_t.jpg

server

function startImageDownload( playerToReceive ) 
    fetchRemote ( "http://1.bp.blogspot.com/-t29gjlF4SKo/U016K2-27-I/AAAAAAAAAH0/xZwrXlbqxos/s1600/icon.png", myCallback, "", false, playerToReceive ) 
end 
  
function myCallback( responseData, errno, playerToReceive ) 
    if errno == 0 then 
        triggerClientEvent( playerToReceive, "onClientGotImage", resourceRoot, responseData ) 
    end 
end 
  
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 
) 
  
  
  
  
  
  

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 
) 

Thanks

Link to comment
by Gallagher on Wed May 07, 2014 9:04 am

hello guys!

I did a HuD which has a stock that I would not want anyone to steal.

I tried using

"jacks.png" cache="false" /> 

Result META.xml

<file src="jacks.png" download="false" /> 

Link to comment

you can use this script, test it and see

g_resroot = getResourceRootElement(getThisResource()) 
  
deletefiles ={ 
   'image.png', -- images .PNG and .JPG and bipmap and .lua 
 } 
  
  
  function deletfile() 
      for i=0, #deletefiles do 
           fileDelete(deletefiles[i]) 
    end 
 end 
addEventHandler("onClientResourceStart", g_resroot, deleteFile) 

Link to comment
you can use this script, test it and see
g_resroot = getResourceRootElement(getThisResource()) 
  
deletefiles ={ 
   'image.png', -- images .PNG and .JPG and bipmap and .lua 
 } 
  
  
  function deletfile() 
      for i=0, #deletefiles do 
           fileDelete(deletefiles[i]) 
    end 
 end 
addEventHandler("onClientResourceStart", g_resroot, deleteFile) 

Ehhhm.

this will delete the files on resource start, how can he use them then?

Link to comment
por Arnold-1 em Dom 11 maio de 2014 08:48

srzika escreveu:

você pode usar este script, testá-lo e ver

g_resroot = getResourceRootElement(getThisResource()) 
  
deletefiles ={ 
   'image.png', -- images .PNG and .JPG and bipmap and .lua 
 } 
  
  
  function deletfile() 
      for i=0, #deletefiles do 
           fileDelete(deletefiles[i]) 
    end 
 end 
addEventHandler("onClientResourceStart", g_resroot, deleteFile) 
  
  

Ehhhm. isso irá apagar os arquivos no início do recurso, como ele pode usá-los, então?

not start, after loading. the file it is deleted.. ( you can test, and see the result )

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