[Tutorial] Using the Dynamic Map System Filterscript

Dynamically loading maps using the Dynamic Map System filterscript
In short the system allows you to reduce the size of your filterscript and keep your mapping more organized(and dynamically alterable). This tutorial shows you how to use the filterscript and import your mapping into the database.

Let's say we have a small map(this isn't a real map just some random lines I created for the tutorial):

pawn Code:
CreateObject(19302, 0.0, 0.0, 0.0, 5.0, 7.5, 0.3);
CreateObject(19303, 0.5, 0.889, 0.33, 9.3, 5.0, 0.3);
CreateObject(1495, 105.0, 5.5, 3.3, 309.3, 7.5, 0.95465);
We want to import this into the database. The first thing we need to do is (if not already) download the github repository and open the filterscripts folder.

Then we need to open the "import.pwn" file(inside the filterscript directory). It should look something like this:

Then simply paste your code into the OnFilterScriptInit callback:

Hit "CTRL+H" to open the "Find & Replace" dialog, which should look something like:

For the search box either type CreateDynamicObject or CreateObject depending on the type of objects your code is using.

Then in the replace simply type "ImportObject". Our code should now look something like:

Next simply compile the script. Then, we need to download the SA-MP server package. You can find it at sa-mp.com/download. After that, you'll need to copy the filterscript + scriptfiles folders into the SA-MP server package.

(You'll need to download the streamer plugin if you intend on running the streamer version of maps.pwn - maps_streamer.pwn).

Open the server and run the "import.amx" filterscript. The objects should import into the database(objects.db). After this is done and the "import filterscript has been loaded" message pops up you can simply load the maps filterscript and the maps should be in-game.

You can find the filterscript here: https://sampforum.blast.hk/showthread.php?tid=583179

If I missed anything or anything is unclear feel free to reply with your feedback.

That mean. I just need to use ImportObject , by replacing the CreateObject or CreateDynamicObject ? Is there any of it? or anything? like if i use only FS , it lag a bit, If i use this, will the lag gone or still have like before?

Well if the objects itself are the source of the lag, I don't see this doing anything, all it does is load (and also unload, etc) a set of objects from a database.

I am also working on a PHP script that won't require you to import via the filterscript. But yes as for your original question simply replace it with ImportObject(make sure it's in OnFilterScriptInit), run the server and load the filterscript once.

Thanks for the tutorial, useful for neewbies.

Forum Jump:

Users browsing this thread: 1 Guest(s)