Random Map for server startup
3 Attachment(s)
File Name: Random Map on Start
Author: NeoMatrix99.j2 Category: Misc Current Version: 1.1 Platform / Test Machine: Windows - Amxx 1.8.0 and Amxx 1.8.1.3679 - NS 3.2 Required Modules: none CVars: firstmap, used to save the firstmap on server startup if COMMANDLINE is set to 0 Natives: none Credits: Crab Map Manager by Head crab - Most of the base code - For maximum compatibility 187comat Server run by Scrow - Getting me started on the idea and testing first beta versions nsmod.org (originally modns.org) - For giving me a chance to release this to the public Commands: none Features: Set a random map to start with on server startup. Description: By default it picks a random map on server startup and changes to it. Otherwise it will pick a new map after each map change and set it in a config to use as the servers first map. The random map can not be in the history file (if you use Crab Map Manager) and not the current map. This does work without Crab's Map Manager without needing any modifications to the code. Read below for instructions on how to use with or without Crab's Map Manager. Changelog: 1.1 - 2/29/2008 - Switched out hardcoded paths for required files. ----- Allows compatability if the location of the amxmodx configs directory changes in the future. - Added support for servers who either are unable or will not change their server command lines. ----- In this mode this plugin conflicts with vote map after crash. Conflicts: In it's default mode this plugin will conflict with votemap after crash causing a vote to not launch. This plugin could theoretically be used with other mods but has yet to be tested with anything other than NS 3.2 Code:
Place randommap.txt in your amxmodx configs folder, put inside a list of the |
Re: Random Map for server startup
Okay, some things about your code.
Do not hardcode paths. Use the get_configsdir function to do what you are doing. Why do you have a map name hardcoded in? co_angst Where are you changing the map? Instead of changing the command line (some people can't do this), let the command line be and use server_cmd("changelevel %s", ValidMaps[randommap]); |
Re: Random Map for server startup
also:
Code:
while (a < MAP_LIMIT) { |
Re: Random Map for server startup
Quote:
I don't change the map. When you don't include a "+map mapname" in the command line the server will hang, however with the +exec line in there it execs that file which only contains the one command "map mapname" which is the same as putting "+map mapname" in the command line. This way my method works with programs like serverdoc. Thus allowing me to set a random map for it to start with instead of starting the server and then immediately change the map which could lead to crash issues on linux boxes seeing as I try to use timers as little as possible in my plugins. This also allows clients to reconnect back as soon as possible. As for the map co_angst there are two versions of the map out which are co_angst and co_angst8. On 187combat we have both and the maps are nearly identical but have thier little differences but still gets pretty annoying to play them back to back so that line I put in there makes them seem like the same map when reading both the randommap.txt and the maphistory.ini Quote:
|
Re: Random Map for server startup
Make the plugin change the map. Some people do not have the ability to change the command line. Issuing a changelevel will not crash the server and doesn't kick the clients.
Do not hardcode the file paths. It looks bad and is unprofessional. Also, I believe it can not be approved because of this. FYI, white space is good for readability. |
Re: Random Map for server startup
I guess I can put in a define so if someone doesn't want to or can't change the command line it will issue a changelevel but otherwise will do it this way. I'll have to find a way of detecting whether this is the first map of the server or not but thats easy enough. Will have to wait till I get home for changes to be put in. Atm it simply reads the history file (unless set not to) and the randommap.txt every mapchange and writes the new random map to randommap.cfg
This will have to instead detect if this is the first map, choose a new map, and then change. My original method was adopted because we have startup crash issues on 187combat which is on a linux box and I didn't want to add to the problem. Will also make a change to the hardcoded paths. |
Re: Random Map for server startup
Plugin updated.
1.1 - 2/29/2008 - Switched out hardcoded paths for required files. ----- Allows compatability if the location of the amxmodx configs directory changes in the future. - Added support for servers who either are unable or will not change their server command lines. ----- In this mode this plugin conflicts with vote map after crash. |
All times are GMT -4. The time now is 01:33. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.