maihym 12 Posted October 22, 2017 So Im trying to pull an entire file from the server for the client to use. Does anyone know of a way to do this? Essentially I want to use #include somehow to pull the entire file but without using public/global variables. Share this post Link to post Share on other sites
HazJ 1288 Posted October 23, 2017 Note: You can't execVM that on the client. It's on server. What you can do is PV function to clients instead. You can also use remoteExec command. Share this post Link to post Share on other sites
maihym 12 Posted October 23, 2017 1 minute ago, HazJ said: Note: You can't execVM that on the client. It's on server. What you can do is PV function to clients instead. You can also use remoteExec command. So this is what I've essentially done so far. I made a folder called "Client" on my server and inside there I copied the original files from the client side into that directory. Then I made a function called "client_fnc_pullFileFromServer" and that is the code below: /* File: fn_pullFileFromServer.sqf Description: Pull entire files from the server and send them to the cliet. Author: Maihym */ _file = _this select 0; _start = _file splitString "\"; _start set [0,""]; _start set [1,""]; _file = _start joinString ""; _return = [_file] remoteExec ["#include",2]; _return; Then I insert this code into the file that I copied from the client to the server. _fuckyou = [__FILE__] remoteExec ["client_fnc_pullFileFromServer",2]; _fuckyou; So far it has worked on most files but there are some files that by doing this break the client because remoteExec can't execute fast enough. I just did this for fun and to see if I can find some sort of alternative to encrypting or obfuscating code to protect my mission file from thiefs. Share this post Link to post Share on other sites
HazJ 1288 Posted October 23, 2017 What?! _return = [_file] remoteExec ["#include",2]; That won't work. You can't #include or execVM files located on the server, to the client. Have your client functions on the server and PV them to clients or remoteExec to the client you want. Share this post Link to post Share on other sites
Tajin 348 Posted October 23, 2017 #include is part of the preprocessor... as in it happens BEFORE scripts are beeing run. You can't use it like that. You could just make those functions public variables. Simple. "client_fnc_pullFileFromServer" I certainly wouldn't feel safer with a function like that ... Share this post Link to post Share on other sites
maihym 12 Posted October 23, 2017 6 hours ago, HazJ said: What?! _return = [_file] remoteExec ["#include",2]; That won't work. You can't #include or execVM files located on the server, to the client. Have your client functions on the server and PV them to clients or remoteExec to the client you want. 2 hours ago, Tajin said: #include is part of the preprocessor... as in it happens BEFORE scripts are beeing run. You can't use it like that. You could just make those functions public variables. Simple. "client_fnc_pullFileFromServer" I certainly wouldn't feel safer with a function like that ... Well so far I've been able to use this to replace my init file and I didn't plan on doing this to every file. It works right now but like I said not for every file. For example if I use this on my init player local file it breaks the server but this is just a test. Share this post Link to post Share on other sites
xjoker_ 25 Posted October 24, 2017 20 hours ago, maihym said: It works right now but like I said not for every file. ???? It can't even work you're using remoteExec from the server, to the server ( '2' as last parameter ) so you send nothing to clients Share this post Link to post Share on other sites
maihym 12 Posted October 24, 2017 2 hours ago, xjoker_ said: ???? It can't even work you're using remoteExec from the server, to the server ( '2' as last parameter ) so you send nothing to clients I use returns Share this post Link to post Share on other sites
freak69 5 Posted October 24, 2017 lol no mate, whatever you think you are doing. You are not doing that. This _return = [_file] remoteExec ["#include",2]; doesn't work at all. However it might run the init.sqf (which is probably your _file in this case) as the preprocessor already does it. If you want to have files on your server sent to the client, you can only do it with an external .dll besides that you can not use files from the server on the client. BUT you can use / execute the code from within files on the server, from the client. E.g. by preCompiling thus code into a variable -> function and remoteExecuting that function on the client 2 Share this post Link to post Share on other sites