我是艾西,再上一篇中我详细的说了csgo社区/私人服务器的搭建过程以及需要注意的一些事项,那么很多小伙伴对于插件可能还是会有些疑惑,主流的现在就是SourceMod&MetaMod插件,今天教大家如何将插件完整部署到服务器中以及插件文件的深度解析!!!
SourceMod&MetaMod
在CS1.6版本,CS服务器插件均为.dll格式(动态链接库),需要使用CS提供的sdk生成.dll,同时将.vdf放入addons中引导.dll生效实现插件的自定义功能。由于该部分需要对sdk及C语言的深入了解,门槛过高。
之后Allied团队将sdk改写后,提供了接口供C 语言对插件的编写,这个有接口的sdk平台就是MetaMod(准确的来说应该是MetaMod:Source)。之后为了适配pawn语言又用同样的方法构建了SourceMod平台。(在这里深深的对Allied团队鞠躬)
可以说SourceMod和MetaMod是CS这个系列插件的重要支撑与基石,在部署了SourceMod&MetaMod之后,我们便可以装载插件,实现自定义功能了。
SourceMod GW:sourcemod.net
MetaMod GW:metamodsource.net
部署利用PuTTY以csgoserver身份连接服务器
进入csgo目录下
cd /home/csgoserver/serverfiles/csgo
我们需要将SourceMod与MetaMod下载并解压,在资源里找到Linux开始加载
Wget xxxxx://sm.alliedmods.net/smdrop/1.10/sourcemod-1.10.0-git6528-linux.tar.gz
wget xxxxx://mms.alliedmods.net/mmsdrop/1.11/mmsource-1.11.0-git1145-linux.tar.gz
下载之后解压缩
tar -xzvf sourcemod-1.10.0-git6528-linux.tar.gz
tar -xzvf mmsource-1.11.0-git1145-linux.tar.gz
删除安装包
rm sourcemod-1.10.0-git6528-linux.tar.gz
rm mmsource-1.11.0-git1145-linux.tar.gz
接下来配置服务器参数,配置文件为csgoserver.cfg
位于 /home/csgoserver/serverfiles/csgo/cfg目录下。
注意:该文件与/lgsm下的csgoserver.cfg作用不同
配置csgoserver.cfg
如果在该目录下不存在csgoserver.cfg文件,请新建一个。如果存在一个名称为server.cfg的文件或存在csgoserver.cfg,将其重命名后按照下面的样例进行修改。
仅供参考:
//csgoserver.cfg
// .................................. Basic ................................. //
// Hostname - Name of the server.
hostname ""
//hostname为服务器在公网上的名称(例:IP:xxx.xxx.xxx.xxx)
// RCON - remote console password.
rcon_password ""
//RCON,也称RC,是在csgo客户端内远程控制服务器控制台的工具,此处为该工具的密码
// Server password - for private servers.
sv_password ""
//此处为服务器密码,设置admin文件后管理员权限可不输入密码进入
// Email - Server admin email.
// Example: sv_contact "email@example.com"
sv_contact ""
//此处不用管直接过
// LAN mode - Server is a LAN server; can't connect from the internet. VAC (Valve Anti-Cheat) is disabled in this mode.
// Default: sv_lan 0
sv_lan 0
//同上
// Cheats mode - Server is disabled to use cheats by default;Commands like noclip,god are disabled to be exploited by the players. VAC (Valve Anti-Cheat) is disabled in this mode when value is set to '1'.
// Default: sv_cheats 0
// Cheats ON: sv_cheats 1
sv_cheats 0
//服务器作弊参数 一般不是娱乐服务器请不要改动
// Tags - Used to provide extra information to clients when they're browsing for servers. Separate tags with a comma.
// Example: sv_tags "128-tick,deathmatch,dm,ffa,pistol,dust2"
sv_tags ""
//服务器标签,可以参考如下设置
//sv_tags "128tick,competitive,5v5"
// Region - The region of the world to report this server in.
// Default: -1
// 0 - US East, 1 - US West, 2 - South America, 3 - Europe, 4 - Asia, 5 - Australia, 6 - Middle East, 7 - Africa
sv_region 4//服务器所在地区,一般填4标记为亚洲,也可缺省为-1
sv_prime_accounts_only 1
//此处参数为仅限优先账户进入,可对服务器玩家的种类进行限制
//以下内容默认不变
// ............................. Server Logging ............................. //
// Enable log - Enables logging to file, console, and udp < on | off >.
// Recommended: log on
log on
// Log bans - Log server bans in the server logs.// Default: sv_logbans 1
// Recommended: sv_logbans 1
sv_logbans 1
// Log echo - Display log information to the server console.// Default: sv_logecho 1
// Recommended: sv_logecho 1
sv_logecho 1
// Log file - Log server information in the log file.
// Default: sv_logfile 1
// Recommended: sv_logfile 1
sv_logfile 1
// One file log - Log server information to only one file.
// Default: sv_log_onefile 0
// Recommended: sv_log_onefile 0
sv_log_onefile 0
// Server Hibernation
sv_hibernate_when_empty 1
sv_hibernate_ms 5
// ............................. Server Query ............................. //
// More info at:
xxx.gametracker.com/games/csgo/forum.php?thread=91691
host_name_store 1
host_info_show 1
host_players_show 2
// ................................ Ban List ................................ //
// User ban - Server banlist based on user steam ID.// Recommended: exec banned_user.cfg
exec banned_user.cfg
// IP ban - Server banlist based on user IP.
// Recommended: exec banned_ip.cfg
exec banned_ip.cfg
// Write ID - Writes a list of permanently-banned user IDs to banned_user.cfg.
writeid
// Write IP - Save the ban list to banned_ip.cfg.
writeip
如上设置完成后,重启服务器并从CSGO客户端进入,输入!admin后出现如下图提示,证明此时SourceMod&MetaMod已成功加载。
配置admins_simple.ini
到这里服务器插件框架已经正确加载,我们要给自己增加一个游戏内的admin权限。
SourceMod管理员配置文件一般为admin.cfg,为了简化操作
我们可以通过修改更为简单的admins_simple.ini文件实现,该文件的目录如下:
/home/csgoserver/serverfiles/csgo/addons/sourcemod/configs
进入目录并打开文件
// admins_simple.ini
// READ THIS CAREFULLY! SEE BOTTOM FOR EXAMPLES//
// For each admin, you need three settings:
// "identity" "permissions" "password"//
// For the Identity, you can use a SteamID or Name. To use an IP address, prepend a ! character.
// For the Permissions, you can use a flag string and an optional password.//
// PERMISSIONS:
// Flag definitions are in "admin_levels.cfg"
// You can combine flags into a string like this:
// "abcdefgh"//
// If you want to specify a group instead of a flag, use an @ symbol. Example:
// "@Full Admins"//
// You can also specify immunity values. Two examples:
// "83:abcdefgh"
//Immunity is 83, flags are abcdefgh
// "6:@Full Admins"
//Immunity is 6, group is "Full Admins"//
// Immunity values can be any number. An admin cannot target an admin with
// a higher access value (see sm_immunity_mode to tweak the rules). Default
// immunity value is 0 (no immunity).//
// PASSWORDS:
// Passwords are generally not needed unless you have name-based authentication.
// In this case, admins must type this in their console://
// setinfo "KEY" "PASSWORD"//
// Where KEY is the "PassInfoVar" setting in your core.cfg file, and "PASSWORD"
// is their password. With name based authentication, this must be done before// changing names or connecting. Otherwise, SourceMod will automatically detect// the password being set.
//
////////////////////////////////
// Examples: (do not put // in front of real lines, as // means 'comment')//
// "STEAM_0:1:16" "bce"
//generic, kick, unban for this steam ID, no immunity
// "!127.0.0.1" "99:z"
//all permissions for this ip, immunity value is 99
// "BAILOPAN" "abc" "Gab3n"
//name BAILOPAN, password "Gab3n": gets reservation, generic, kick
////////////////////////////////
上面的文件主要介绍了如何添加管理员,可以根据steam16位ID、ip地址、steam组来设置对应的权限。
介绍下根据steamID设置的方法:
如何获取steam 16位ID?
方法 一:游戏服务器内获取
进入任意GF服务器,按“~”键打开控制台,输入status显示服务器内玩家列表
找到自己对应的steamID,格式一般为"STEAM_0:1:1234567",与文件中的"STEAM_0:1:16"相符。
方法二:输入steam主页地址(登录steam后进入个人资料 ,右键选择复制网页url即可),即可查询到steam16位ID
在获取了SteamID后,按照如下格式在文件中新增一行
"STEAM_0:1:1234567"(此处为SteamID) “99:z”(最高管理权限,豁免计数99)
之后重启服务器,从CSGO客户端登录后输入:admin