dugasz1 Posted July 25, 2017 Share Posted July 25, 2017 (edited) Hello. This is in my meta: <script src="../oop.lua" type="shared" /> So, why this isn't work? I want to include something outside my resource's folder. Is it possible? Edited July 25, 2017 by dugasz1 Link to comment
dugasz1 Posted July 26, 2017 Author Share Posted July 26, 2017 I want to include OOP definitions this way. Because it's faster and more comfortable. Is it not supported to go back in directory or what? Link to comment
Mr.Loki Posted July 26, 2017 Share Posted July 26, 2017 I have never seen it before so I doubt it. Link to comment
xboxxxxd Posted July 26, 2017 Share Posted July 26, 2017 (edited) If you want to use a OOP being loaded and/or used within a new resource, while this OOP is not inside the new resource, you could do 2 things out of my knowledge: as example we use; the OOP resource you want to use is called 'ExistingOOP', and now you want to use it in your new resource, so... 1. Simply just Copy the 'ExistingOOP' Folder, and rename the copy'd ExistingOOP folder to your liking, then from there on, code whatever you where intended to do, like just use the same resource, but modify it. or.. 2. Create a new folder, call it for example 'NewOOP', now open that folder, create the meta.xml file, and 1 other folder, like 'files' or something, to put other files in for later on.. i geus, now open your meta.xml in 'NewOOP', and on top, before every other syntax, (like second row of text.), so bellow "<meta>", Put first this in to make sure you have any OOP function enabled because by default it's disabled!; <oop>true</oop> put in this piece of code under the other piece of code i described above; <include resource="ExistingOOP" /> to make sure it has been loaded before anything else loads with your 'NewOOP' resource, Now you should be fine using any client, server, shared, both, and other type's of using a script/oop to your liking!.. More Information can be found here: Short Info, OOP: https://wiki.multitheftauto.com/wiki/OOP Full Info, OOP (Introduction): https://wiki.multitheftauto.com/wiki/OOP_Introduction meta.xml Info: https://wiki.multitheftauto.com/wiki/Meta.xml (Look arround the meta.xml wiki page, there is some good detailed piece's of code there!). Gr.xboxxxxd PS: If anything is wrong on my reply here, feel free to correct me in any way possible, it won't bother me. Edited July 26, 2017 by xboxxxxd Link to comment
dugasz1 Posted July 26, 2017 Author Share Posted July 26, 2017 I want to avoid the first method because it would be a lot of copy of the same file. And the second is not the way too sadly, include doesn't load the included resources script files into that resource. (As far as i experienced include only force resource on client side to load before that script which includes that) (My example maybe was a bit confusing i don't want to enable the oop MTA functionality just use a file in a resource which isn't in the resource's folder) Link to comment
Moderators IIYAMA Posted July 26, 2017 Moderators Share Posted July 26, 2017 You could use an export to import a table with your custom oop functions. Even though you will be indexing this table to access these functions instead of multiple variables. Another option could be loadstring. https://www.lua.org/pil/8.html 1 Link to comment
dugasz1 Posted July 26, 2017 Author Share Posted July 26, 2017 Thank you but just now i found a solution. I created a symbolic link in the resource folder which points to the resources folder. (If someone need it: On windows: mklink /d "...myresourcefolder\link_name" "...deathmatch\resources") Link to comment
dugasz1 Posted July 26, 2017 Author Share Posted July 26, 2017 Now i just realised that it is only works on server So @IIYAMA i will use your solution. Thank you 1 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