查看: 5558|回复: 50

[源码]让指定地图使用特定的插件

[复制链接]
发表于 2013-12-24 01:07:21 | 显示全部楼层 |阅读模式
在config/maps/ 文件夹下建立名为cs_bloodstrike.cfg 的文件 写入以下代码
mp_timelimit 30                 ;地图时间30分钟
mp_buytime 2                        ;武器购买时间2分钟
mp_roundtime 2.0                ; 每局2分钟
amx_restrict on flash                ;禁闪光雷
amx_restrict on hegren                 ;禁高爆雷
amx_restrict on sgren                 ;禁烟雾雷
mp_friendlyfire 0                ;友军误伤 关闭0/开启1
mp_friendly_grenade_damage 0         ;手雷友军伤害 关闭0/开启1
amxx pause say_menu.amxx     ;禁用客户端菜单插件


这样就可以实现不同的地图使用不同的插件了


在SEVER.CFG中把应该禁用的都禁用
amxx pause XXXX.amxx


然后每个地图想开启哪个插件就开哪个
amxx unpause XXXX.amxx


比如默认是混战不开魔兽也不开死亡插件,就在SERVER.cfg中加入
amxx pause 魔兽.amxx
amxx pause 死亡.amxx
然后在config/maps/  下建立相应的地图文件de_dust2.cfg 中加入amxx unpause 魔兽.amxx
在de_inferno 中加入amxx unpause 死亡.amxx

不用其它插件可以实现每个地图不同的插件加载和配置更改了!

其中prefix_de.cfg 是指所有的DE开头的地图都使用这个配置文件
plugins-de.ini 是指所有的DE开头的地图都加载这里面的插件

其它的文件是单个地图的,自己要哪个地图自己改

这样我们就可以在plugins.ini中只加载最基本的AMXX插件,其它娱乐和第三方插件可以全放到plugins-de.ini 和 plugins-cs.ini 中去或者其它前缀的文件名


  09-10-2006 , 11:54   Mapconfig Extended
#1
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


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

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

mapconfig.rar

1.95 KB, 下载次数: 9

售价: 10 金钱  [记录]

发表于 2013-12-24 16:17:59 | 显示全部楼层
楼主good  
发表于 2013-12-25 09:02:49 | 显示全部楼层
琴棋书画不会,洗衣做饭嫌累。  
发表于 2013-12-25 17:08:57 | 显示全部楼层
呵呵,等着就等着....  
发表于 2013-12-26 03:06:14 | 显示全部楼层
哦...............  
发表于 2013-12-26 13:21:09 | 显示全部楼层
琴棋书画不会,洗衣做饭嫌累。  
发表于 2013-12-26 23:06:20 | 显示全部楼层
呵呵 高高实在是高~~~~~  
发表于 2013-12-27 00:59:55 | 显示全部楼层
谢谢哦  
发表于 2013-12-29 00:08:20 | 显示全部楼层
看看..  
发表于 2013-12-29 03:04:34 | 显示全部楼层
我不是你想象中的那样完美那样坚强,金钱和美女就足以把我征服!  
您需要登录后才可以回帖 登录 | 中文注册

本版积分规则