Jump to content

[Help] Delete image


Recommended Posts

Posted

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" />  

but not deleted the picture.

Is there any way to delete the image from the client harddisk?

Posted

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.

If I help you in a thread and you need further assistance, please don't PM me - use the thread you created instead. This way everyone on the forum can take advantage of it.

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

Business System viewtopic.php?f=108&t=35797

Notepad++ Syntax Highlighting & Auto Completion viewtopic.php?f=91&t=76726

SQLite Tutorial viewtopic.php?f=148&t=38203

  • Moderators
Posted (edited)

or just change the image to a texture and delete the file.

https://wiki.multitheftauto.com/wiki/CreateTexture

https://wiki.multitheftauto.com/wiki/FileDelete

Which makes stealing very hard.

Before they can copy it, it will be gone.

Edited by Guest

Do you want to improve your Lua programming skills and make less mistakes?   Start with Lua Language Server!   🙀

 

  Useful functions  3x 

  Tutorials  4x 

 

Posted
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

Posted
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" /> 

 DUyJ810.gif

Posted
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" /> 

dont work

Posted
Can't you read or smth like that?

LOL

btw upload it to imgur.com then use the link.

Ingame Name: Arnold

If you need my help, contact me on Skype @bshr.ara

NOTE:DO NOT ASK ME FOR SCRIPTS, ASK ME FOR HELP

Posted

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) 

 DUyJ810.gif

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

Ingame Name: Arnold

If you need my help, contact me on Skype @bshr.ara

NOTE:DO NOT ASK ME FOR SCRIPTS, ASK ME FOR HELP

  • Moderators
Posted

@ Arnold-1

by making textures of it, but yes he isn't doing that....

Do you want to improve your Lua programming skills and make less mistakes?   Start with Lua Language Server!   🙀

 

  Useful functions  3x 

  Tutorials  4x 

 

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

 DUyJ810.gif

Posted

That would be completely useless if you don't create a texture of that picture. So you're basically just downloading and deleting it.

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