AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Approved Plugins (https://forums.alliedmods.net/forumdisplay.php?f=8)
-   -   Mapconfig Extended (https://forums.alliedmods.net/showthread.php?t=44659)

_KaszpiR_ 09-10-2006 10:54

Mapconfig Extended
 
1 Attachment(s)
Description
Modification of default mapconfig.sma, so it loads also general prefix map config. For example it executes _de_.cfg and later de_dust.cfg custom maps configs.

Plugin is compatible with old configs :) to that's why it is extension.

NOTICE: current AMX Mod X versions allready execute custom map configs (cause it is written within Admin.sma plugin that control admin access) but it does not executes general prefix map configs. So if you use this plugin your custom map config will be executed twice.



Installation
- Download compiled version or download .sma and compile for yourself
- Replace old amxmodx/plugins/mapconfig.amxx with new one
- Create in amxmodx/configs/maps/ files like _de_.cfg _cs_.cfg _aim_.cfg _fy_.cfg and so on, fill them with desired commands.
- Edit amxmodx/configs/mapconfig.ini to edit prefixes
- Change map to load new plugin
- Enyoy :D


Extended info
For example you have fy_ maps, and on all of them you want some specific settings, but on one of them you want to alter it . So instead of making 20 files for each map (where 19 will be the same) to have the one specific changed, you can make two files - general config, and the config for specific map.

How to use general config:
In addons/amxmodx/configs/maps/ make config named like _prefix.cfg for example:
_de_.cfg (for all de_ maps)
_aim_.cfg (it will be executed for all aim_ maps)
_fy_.cfg ( for fy_ maps)

and so on , you can use any prefix that you got maps with like csde_ aswell, or if you got a set of maps with de_rats prefix, then you can add de_rats_ as prefis and then edit _de_rats_.cfg file

I suggest not to use more than 5 prefixes per map (in example if you got map named de_dust_blow2.cfg and you got the following prefixes
de_
de_dust
de_dust_blow
then all of them will be executerd if the config files exist, respectively
_de_.cfg
_de_dust.cfg
_de_dust_blow.cf

Notice - you shoud not add prefix like cs (without underscore - otherwise it can be executed on cs_ maps and csde_ maps and other without the prefix , lik cstest or if you use de prefix without undersore it can be executed on deagle map -and it may be not the thing you want :D

Example
I got some quite a lot of de_ maps, most of them are on the same config, but some are small and i want to decrease round time,

_de_.cfg
mp_roundtime 2
mp_c4time 45


de_spree.cfg - using builtin system, by the admin.sma that is in default AMX Mod X standard
mp_roundtime 1.75
mp_c4time 30


Other general config examples

_cs_.cfg
mp_roundtime 3

_aim_.cfg
mp_freezetime 0
mp_timelimit 30
amx_spawnprotect 2

_fy_.cfg
mp_freezetime 0
mp_timelimit 30
sv_gravity 600

Notice
Once i modded default plugin for AMX Mod, after some changes and fixes by Kr@tal it is in the recent AMX Mod releases.
I just forgot to port it to AMX Mod X cause i thought it was allready done :)

Changelog
* 1.0.3 - added cvar amx_mce_cfg that defines the file containing prefixess (default mapconfig.ini)
- added cvar amx_mce_dir that defines the directory cintaining the configg files with prefixes by default 'maps' that is
later finned to addons/amxmodx/configs/maps. Do not add any beginning or ending slashes.
- changed the configs naming to load fies with _prefix.cfg where prefix is changed to the found text, like de_ cs_ etc
so now for de_ prefix it loads _de_.cfg file
- prefixes occurence in mapconfig.ini is important.
- i suggest not to use more than 5 prefixes per map (in example if you got map named de_dust_blow2.cfg and you got the following prefixes
de_
de_dust
de_dust_blow
then all of them will be executerd if the config files exist, respectively
_de_.cfg
_de_dust.cfg
_de_dust_blow.cf

- optimizations suggested by Zenith77 and Xanimos
- on map load i suggest looking at server status window via rcon to find any errors and warnings

* 1.0.2 - Complete change, it loads prefixes form file named addons/amxmodx/configs/mapconfig.ini and loads only prefix files
* the custom map configs are not executed cause the amdin.sma allready do it.
* 1.0.1 - Modified to support general map prefix configs like de_ aim_ fy_ - you must have de_.cfg aim_.cfg fy_.cfg
* files in addons/amxmodx/configs/maps/ (modification by _KaszpiR_)
* 1.0.0 - Ported to AMX MOD X (without translations)
* 0.9.9 - Added translations support for AMX Mod 0.9.9
* 0.61 - Changes load delay to 6s (to work better with SQL ServerCfg)
* 0.6 - Execs configs rather than loading file
* - Delays execution for 5s after map changes
* 0.5 - Initial release

Zenith77 09-10-2006 12:48

Re: Mapconfig Extended
 
Quote:

the general config is named as prefix, prefix is a first file name part untill the first _ character. That means if you got maps named de_rats_map1 de_rats_map2 then prefix is de_ and not de_rats_ !!!!
This plugin would be much better if you could do that.

Something like this:
Code:
new prefix[] = "de_rats_"; if (containi(mapname, prefix) == 0) // == 0 to make sure it is at the begining of the map name {      // Code... }

Naturally, the prefix array would be replaced with the file name or something.

_KaszpiR_ 09-10-2006 14:03

Re: Mapconfig Extended
 
quite good idea, but i think it would be better to store prefixes in cvar, then explode it via space and perform rest of action

second i think i gonna remove the execution of map specific config - because admin.sma does it allready, so no need for duplicating.

Xanimos 09-10-2006 16:01

Re: Mapconfig Extended
 
Quote:

Originally Posted by _KaszpiR_ (Post 379600)
quite good idea, but i think it would be better to store prefixes in cvar, then explode it via space and perform rest of action

second i think i gonna remove the execution of map specific config - because admin.sma does it allready, so no need for duplicating.

Don't put it in a cvar like that.

_KaszpiR_ 09-10-2006 17:06

Re: Mapconfig Extended
 
why?
i decided to use cvar cause it is easier to edit and transform than a file (in example ini file) or hardcoded values in sma
besides, ig you got 127 chars, it is quite a lot to add about 16 prefixes

second you can have different prefixes loaded on configl lodaed (easy tto transform and make different server behaviour depending on the running mapcycle sheme.

and if you can you could next time describe why you wrote euch reply, cause now i can find about 8 different reasons why not to use cvar

Zenith77 09-10-2006 18:57

Re: Mapconfig Extended
 
Because, that would be stupid, just go ahead and code it, you'll see why.
Also, people like Xanimos know what their talking about, you should listen.

_KaszpiR_ 09-11-2006 09:39

Re: Mapconfig Extended
 
any suggested solutions?

PS about cvar it would look like amx_mc_prefix "de aim cs awp fy de_rats"

Zenith77 09-11-2006 12:21

Re: Mapconfig Extended
 
No, just allow the client to put the prefix in the file name, it makes more sense.

Xanimos 09-12-2006 01:49

Re: Mapconfig Extended
 
You know that you can read out the contents of the folders right? So you can see if the filename is in the name of the map.

_KaszpiR_ 09-12-2006 02:39

Re: Mapconfig Extended
 
EDIT - below text can be ignored

i did it like that
1. read prefixes from mapconfig.ini to the array (of course check if the mapconfig.ini exists etc)
2. walk array and check if there is a match of prefix within map name and execute config

so in example if you got following prefixes in mapcinfog.ini
de
de_rats

then the script will execute de_.cfg and de_rats_.cfg (if they exist) in order of coourrence wthin mapconfig.ini

today beta testing



EDIT
hmm i guess i gonna make it without exporting prefixes to array, i guess it will be better


All times are GMT -4. The time now is 02:27.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.