View Single Post
Plugin Info:     Modification:          Category:          Approver:   Hawk552 (427)
NeoMatrix99
New Member
Join Date: Feb 2008
Old 02-28-2008 , 06:32   Random Map for server startup
Reply With Quote #1

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
maps you would like to pick from for your startup map.

Set #define MAP_LIMIT 32 to the max number of maps you want it to find.
I suggest making it a few above how many maps you have.

If you use crab map manager do the following to let this plugin read your
history file:
Set #define CRABMAP 0 to 1
Set #define HISTORY_LIMIT 3 to match what you have in your crab map
manager SMA file.

The map history file default location is inside your amxmodx configs folder
so you can place the file there or let the plugin create it's own. Make sure
this is the same as your crab map manager maphistory.ini location.

Place randommap.cfg in your amxmodx configs folder if you follow the
directions below to edit your server command line. If the map inside is
not a map you have or use change the map name to something you
would use.

If you want to edit your server command line set #define COMMANDLINE
in the SMA file to 1 (defaulted to 0) and follow the step below.

In your server start command remove +map ******* and put in
+exec /path/to/amxmodx/configs/randommap.cfg
ex. +exec addons/amxmodx/configs/randommap.cfg
Attached Files
File Type: cfg randommap.cfg (15 Bytes, 843 views)
File Type: txt randommap.txt (73 Bytes, 809 views)
File Type: sma Get Plugin or Get Source (randommap.sma - 2041 views - 6.6 KB)

Last edited by NeoMatrix99; 02-29-2008 at 08:55. Reason: Update
NeoMatrix99 is offline