greentumbleweed Posted November 24, 2015 Share Posted November 24, 2015 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
Dealman Posted November 25, 2015 Share Posted November 25, 2015 Put the files on the server instead, and read them using fileRead. Then use triggerClientEvent to send the information to the client(s). You can then use fileCreate to create a new file and use fileWrite to write the information sent to the client via the server. And there you have it, simply delete it after it has been loaded. Link to comment
greentumbleweed Posted November 25, 2015 Author Share Posted November 25, 2015 thx for replying and the help! Link to comment
greentumbleweed Posted November 25, 2015 Author Share Posted November 25, 2015 if you dont mind im having a few problems understanding how to use these functions, never used em before maybe you can give me some lines? would be highly appreciated<3 Link to comment
Dealman Posted December 6, 2015 Share Posted December 6, 2015 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
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now