Jump to content

Question regarding some stuff


DizzasTeR

Recommended Posts

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

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
  • Moderators

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

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

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