[FilterScript] Maploader
#1

Maploader



  • What is 'Maploader'?
Maploader is a small and very basic filterscript, that allows you to use multiple maps in a session (without restarting the server to change the maps).
It allows you to add unlimited maps, and set your own switch time.
When a switch is initiated, the old map is removed, and a random map (fase) is loaded.
The idea was that it would be usefull on small servers with CoD/BF like maps and minigames.
The script has only one command, for RCON admins. /changenow, which will force the map change.
I know it's basic, so if you have any suggestions, tell me, and I will try to put that into the next update.
Version 1.0b and 1.1 do NOT come with any mapping, I might add maps in the future if people want that.
The Maploader is an idea from zClaw, credits to him for the idea!
  • Commands
/changenow - this will initiate the map switch process (with a 10 second player warn delay).
  • Requirements
  • Zcmd - Credits to Zeex - Original thread (for download, use the solidfiles link, the other ones don't work).
  • Incognito's Streamer plugin - Credits to Incognito - Original thread
  • Slice's Timer Fix - Credits to Slice - Original thread
  • Mapping.inc - More information below
  • Known bugs
  • None yet, please post bugs if you find some!
  • Installation
After you've compiled the maploader.pwn, place the .amx file in your filterscripts folder, and add 'maploader' to your filterscripts line in your server.cfg .
Maploader will read from and write to a file located in your scriptfiles directory, so make sure your scriptfiles folder writable!
In the source, you will find some comments which explain how to add new mapping or change the switchtime.
  • Changelog
Code:
[5/7/13] - Updated topic with new layout and documentation
[5/7/13] - Version 1.1 released
           Optimized code
           New map loading system
           Timers fixed

[15/02/2013] - Version 1.0b released
  • Next update
  • No updates/new features planned
  • Download
  • Last note
This is my first public release, so maybe some of you think it sucks, that's ok, please tell me that, and tell me what I can do better in the future!
Documentation


  • Adding new mappings
Adding new mappings is easier than you might think! First, open up the mapping.inc, go to the fase you want the mapping to be in, and paste it there. Now, save the include, and recompile the script. Easy as that! If you have any problems with adding maps, post a reply and ask for help, I'll do my best to help you.
  • Configurables

The following things are there for you to configure to your needs.


The change interval:

pawn Code:
#define CHANGE_INTERVAL 15*60000
The change interval holds the value of the switch timer. Change the number before the *60000 to the time in minutes you want between the switch times.

The max fases:

pawn Code:
#define MAX_FASES 3
The MAX_FASES define holds the number of fases the script has. Everytime you add a fase, increase this number.
  • Adding more fases

I can understand if 3 fases are not enough for you. To add fases, do the following.
  1. Increase the MAX_FASES define at the top of the script with the amount of fases you add.
  2. Go to the Changemap(fase); public, and add a case.
  3. Inside the case, add 'Mapping_CreateFase<full number>'. Replace <full number> with the name of the number, like Four, Five or Six.
  4. Go to the mapping.inc, add a forward for the new fase public.
  5. In the mapping.inc, also add the public Mapping_CreateFase<full number>.
  6. Inside the callback in the mapping.inc, add the mapping for the new fase.
  7. Done!
If you have any problems when adding fases, post a reply, and we'll solve it.
Reply
#2

cool release but can we get pastebin link?
Reply
#3

Quote:
Originally Posted by Niko_boy
View Post
cool release but can we get pastebin link?
Thanks
And, surething, I will upload it to pastebin in a minute.
Reply
#4

very good release good work
Reply
#5

Nice .. useful for derby servers ..
Reply
#6

Thanks all
Anyone any suggestions so far?
Reply
#7

Nice, good script.
Reply
#8

EDIT: Wrong section, my bad.
Reply
#9

nice job man
Reply
#10

Very Nice,as always
Reply
#11

#define CHANGE_INTERVAL 15*60000 //change this to the amount of minutes to trigger the map change, change the first number (time in minutes)

This is not 15 minutes, timers are bugged read here.

https://sampforum.blast.hk/showthread.php?tid=289675

pawn Code:
if(fase == 0)
{
}
if(fase == 1)
{
}
Do it like this....

pawn Code:
switch(fase)
{
    case 0: { }
    case 1: { }
}
Also really bad idea to dump all your map code into that function it's messy and will cause the function to potentially extend for thousands of lines depending on how many maps there is I would make includes then call the map functions inside of them which is a lot easier to organize for example.

pawn Code:
#include <maps\mymap1>
#include <maps\mymap2>

case 0: { LoadMyMap1(); }
case 1: { LoadMyMap2(); }
Easier to read, easier to edit, easier to keep organized don't you think?
Reply
#12

Quote:
Originally Posted by [uL]Pottus
View Post
#define CHANGE_INTERVAL 15*60000 //change this to the amount of minutes to trigger the map change, change the first number (time in minutes)

This is not 15 minutes, timers are bugged read here.

https://sampforum.blast.hk/showthread.php?tid=289675

pawn Code:
if(fase == 0)
{
}
if(fase == 1)
{
}
Do it like this....

pawn Code:
switch(fase)
{
    case 0: { }
    case 1: { }
}
Also really bad idea to dump all your map code into that function it's messy and will cause the function to potentially extend for thousands of lines depending on how many maps there is I would make includes then call the map functions inside of them which is a lot easier to organize for example.

pawn Code:
#include <maps\mymap1>
#include <maps\mymap2>

case 0: { LoadMyMap1(); }
case 1: { LoadMyMap2(); }
Easier to read, easier to edit, easier to keep organized don't you think?
Very nice, thanks for the suggestions. I'll redo those things in the next update. Thanks!
Reply
#13

No problem, your on the right track but at the wrong station
Reply
#14

Quote:
Originally Posted by [uL]Pottus
View Post
No problem, your on the right track but at the wrong station
In my personal scripts, I do use the #include <map> idea to do the maps, but since there are people here who don't know how to do this, I left it out. I'll add it in the script, and I'll also explain in the main topic how you add maps. If there's anything more, all suggestions are welcome :3
Reply
#15

Script updated to v1.1! Check the main thread for the changelog and documentation. If this script is not needed anymore, let the thread die. Updates will only be made if the script is actually used by someone.
Reply
#16

Cool idea dude
Very useful
Good work
Reply
#17

Nice!
Reply
#18

I thought you'd like to know, "Fase" isn't a word. I guess the word you are looking for is "phase". (They are pronounced the same way.)

Nice idea overall.
Reply
#19

Quote:
Originally Posted by [FSaF]Jarno
View Post
I thought you'd like to know, "Fase" isn't a word. I guess the word you are looking for is "phase". (They are pronounced the same way.)

Nice idea overall.
Thanks for pointing that out, my native language is not English, so that was a little mistake there
Reply
#20

very userull
This is just amazing
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)