Jump to content

protect models


Recommended Posts

Can someone give me an example on how too make dff, txd, and col files from being accessible from client? I've seen other servers do such a thing. Also seen 50p's post about how to make them server side only, but im not sure how to do it

To protect your models (dff) and textures (txd) you can use file functions server-side to read the files and then send the content of the file to client as a string when needed. Once they are sent you can then create temporary files client-side which can then be loaded and deleted straight away. I haven't tried that but I'm pretty sure it should work. You could do this for all the files, even Lua script files.

Link to comment
  • 2 weeks later...

Start with something simple, such as an image. Store the picture on the server, then you can use fileOpen to open the file - after you have opened the file, you can use fileRead to read its contents. If you store the data in a variable, you can later send this variable(now a string) to the client.

Upon sending this data to a client, the client can then use this string to create a new file via use of fileCreate and fileWrite. Once created, you can then draw this picture using GUI/DX functions.

I've been away from MTA for some time, so I forget whether you can use the file functions on a file that does not exist in the meta.xml or not. But if such is the case, you should be able to use the XML functions to edit the meta file.

fileExists -- Check if the file exists beforehand(optional since fileOpen sort of does it for you) 
fileOpen -- Open a file of your choice, to read it and store the data 
fileRead -- Read the data of an opened file, store it in a variable 
fileClose -- Close the opened file to clear up memory 
fileWrite -- Write data into a new file 
addEvent -- Create a custom client-side event to retrieve the data with 
addEventHandler -- The event obviously needs a handler 
triggerClientEvent -- Use this to trigger the client-sided event you created. Pass the data as an optional argument 

Go ahead and try it a bit, in the end - programming and scripting is pretty much all about trial and error. If you get stuck I'll try and help you from there - but I will not provide you with lengthy examples as I believe it won't really teach you anything :)

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