View Single Post
NeoMatrix99
New Member
Join Date: Feb 2008
Old 02-29-2008 , 00:13   Re: Random Map for server startup
Reply With Quote #4

Quote:
Originally Posted by YamiKaitou View Post
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]);
I hardcode the paths because I give admins the option of deciding where to put thier files. For instance on 187combat we have the history file in the ns directory.

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:
you should read the file once to an array, than compare the arrays.
I don't know how to do arrays but I'll look into it, I'm learning how to make these plugins as I go along.
NeoMatrix99 is offline