DizzasTeR Posted December 13, 2015 Share Posted December 13, 2015 So basically I'm working on a multigamemode, everything is well, performance is great, maps load excellently fast and all that. The problem which occurred towards me is that how can I load the scripts of the maps. Now I've been searching around the wiki and the forum and found some stuff regarding loadstring, I tried that by opening all the client scripts of the map which is loaded and execute them but that didn't work out pretty well due to errors such as 'unknown setModelLODDistance' and stuff. So basically all I need help with is to start the scripts of the map which has been loaded and ofcourse without any downloads. So I would like some ways how can I do that. I didn't do tests to see yet if loadstring executes scripts as client side or server side but still, I can't manage to play the music files of maps since they are not in the core resource's meta. Any ways? If you are still unable to understand me then please let me know and I'll try to explain better. Link to comment
Moderators IIYAMA Posted December 13, 2015 Moderators Share Posted December 13, 2015 Serverside scripts right? You can use loadstring, but I recommend you to splits the scripts from the maps. Otherwise you probably have to edit the scripts. Because the event "onResourceStart" doesn't get triggered when you start a script with loadstring. Just start them with: https://wiki.multitheftauto.com/wiki/StartResource And add in the meta of the maps: <include resource="theResourceName" /> Which also gives you the benefit that you can also load client files easy. Or you use my map loader for that: https://community.multitheftauto.com/in ... s&id=12068 Documentation: https://forum.multitheftauto.com/viewtopic.php?f=108&t=92549 Link to comment
DizzasTeR Posted December 13, 2015 Author Share Posted December 13, 2015 The startResource works well but its not fine in this case because it causes download for the client which I don't want. I want to play the map music and load the scripts without downloads so any idea? Link to comment
Moderators IIYAMA Posted December 13, 2015 Moderators Share Posted December 13, 2015 Playing music requires client functions. https://wiki.multitheftauto.com/wiki/PlaySound But that doesn't mean you have to execute that function on the script of the map. You can also execute that function on your gamemode.(as long it has access to the file or url) If you don't want clients to download music, you can stream them from an URL. Required Arguments soundPath: the filepath or URL of the sound file you want to play. (Sound specified by filepath has to be predefined in the meta.xml file with tag.) I have never streamed music from an url, so you have to figure that out for yourself. Link to comment
DizzasTeR Posted December 13, 2015 Author Share Posted December 13, 2015 Alright so the music can be streamed but what would you suggest regarding loading scripts. Since loadstring can't do the job and startResource causes downloads, how can I load important map scripts for instance model replacements etc. Link to comment
Moderators IIYAMA Posted December 13, 2015 Moderators Share Posted December 13, 2015 Replace models in your gamemode when needed. https://wiki.multitheftauto.com/wiki/DownloadFile Just make a table which keeps all resource names that have mods, audio and other things. And load what needs to be loaded. Mods can't be streamed, that is obvious. Link to comment
DizzasTeR Posted December 14, 2015 Author Share Posted December 14, 2015 Well its kinda weird to hear that, as you already ( maybe ) know a few servers doing that, but the question is how exactly because they don't have a download bar on the start of maps and even though if there is any download how they have made it this fast and customize it? I have been trying to do alot of stuff and code in order to get a solution but all in vain, so I'm hoping that if someone else might know the answer if you don't from this point. Link to comment
Moderators IIYAMA Posted December 14, 2015 Moderators Share Posted December 14, 2015 They are using https://wiki.multitheftauto.com/wiki/Tr ... lientEvent for that. They read the files and transfer them as a string. But this is not the same as streaming, this is just transfering it a different way and not faster if you ask me. The mods are available when they are downloaded, there is no way around that. 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