server.cfg

描述

  • server.cfg是一个服务器配置文件,允许您更改 sa-mp 服务器的各种设置。
  • 该文件对于每个服务器都是必需的,并且必须位于服务器应用程序 (samp-server.exe) 旁边的服务器目录中。

Console

Setting Type Default value Read-only Rule Effect
echo string Executing Server Config… Yes No 执行 server.cfg 时 samp-server.exe 在服务器控制台中打印的内容。根本不需要更改此设置,因为您将是唯一看到控制台的人。
rcon_password string changeme No No 用于管理服务器和使用远程控制台 (rcon) 的密码。您必须确保将其更改为难以破解的内容,以便其他人无法控制您的服务器。如果changeme是RCON密码,你的服务器将不会启动!
rcon bool 1 No No 切换是否应使用远程控制台功能。设置为 1 启用或设置为 0 禁用。

Scripts

Setting Type Default value Read-only Rule Effect
gamemode(n) (N) (t) string gamemode0 grandlarc 1 No No 服务器应使用 gamemodes 文件夹中的 .amx 文件作为游戏模式运行。(n) 是游戏模式编号,(N) 是不带 .amx 扩展名的游戏模式名称,(t) 是切换到下一个游戏模式之前应玩该游戏模式的次数。
filterscripts (N) string Yes No 服务器应使用 filterscripts 文件夹中的 .amx 文件作为过滤器脚本运行。(N) 是不带 .amx 扩展名的过滤器脚本名称。过滤器脚本是在游戏模式后台运行的脚本。他们可以在不编辑游戏模式的情况下向服务器添加额外内容。如果您想将特定属性应用于多个游戏模式,那么它非常有用。如果您要加载多个过滤器脚本,请将它们全部放在一行中,并用“空格”分隔,例如filterscripts script1 script2。
plugins (N) string Yes No 插件文件夹中的 .dll 或 .so 文件,服务器应使用它作为插件运行。在 Windows (N) 上是不带 .dll 扩展名的插件名称。但是,在 Linux 上需要 .so 扩展名!插件是旨在增强游戏模式和过滤器脚本的脚本。如果您要加载多个插件,请将它们全部放在一行中,并用“空格”分隔,例如插件插件1插件2。

Server browser

Setting Type Default value Read-only Rule Effect
announce bool 1 No No 切换是否应将服务器公布到 SA-MP 主列表。设置为 1 启用或设置为 0 禁用。
query bool 1 No No 切换服务器信息是否应显示在服务器浏览器中。设置为 1 启用或设置为 0 禁用。玩家仍然可以加入禁用查询的服务器,但服务器浏览器不会显示任何信息。
hostname string SA-MP Server No No 当玩家连接到服务器时将在服务器浏览器中显示的名称。
language string No No 服务器浏览器中显示的语言。玩家可以使用它在服务器浏览器中按语言过滤服务器。 注意:此服务器变量是在 0.3.7 中添加的,在以前的版本中不会产生任何影响。
mapname string San Andreas No Yes 显示在服务器浏览器中的地图名称。这可以是任何东西,例如我的特技地图。
gamemodetext string Unknown No No 将在服务器浏览器中显示的模式。使用SetGameModeText具有相同的效果并覆盖 server.cfg 中使用的值。如果您有多个游戏模式需要不同的游戏模式文本,请使用该功能。
weather string* 10 No Yes 服务器使用的全球天气将显示在服务器浏览器中。在 server.cfg 文件中使用此设置将使服务器应用程序在启动时崩溃。使用SetWeather来更改此设置。
worldtime string* 12:00 No Yes 服务器使用并将显示在服务器浏览器中的全球时间。在 server.cfg 文件中使用此设置没有任何效果。使用SetWorldTime来更改此设置。
gravity string* 0.008 No No 服务器使用的全局重力。在 server.cfg 文件中使用此设置将使服务器应用程序在启动时崩溃。使用SetGravity来更改此设置。
weburl string www.open.mp No Yes 人们可以访问该网站来获取有关服务器的更多信息。
version string Yes Yes 服务器使用的 SA-MP 版本将显示在服务器浏览器中。在 server.cfg 文件中使用此设置没有任何效果。
maxplayers int 50 Yes No 您的服务器可以容纳的最大玩家数量。通过更改此数字,您可以更改可以进入服务器的玩家数量。最大值为 1000,最小值为 1。
password string No No 用于锁定服务器的密码。使用此功能时,只有知道该密码的玩家才能加入服务器。
[*]某些设置的类型与您想象的不同。

Networking

Setting Type Default value Read-only Rule Effect
sleep int 5 No No The time in milliseconds the main sa-mp and raknet networking thread will “sleep” idly during each sync cycle. Higher values decreases server processing, but reduces sync quality. Lower values increases server processing, but improves sync quality. It is not advisable to change this value unless your player count is very high and you have server fps stability issues.
lanmode bool 0 No No Deprecated variable, has no effect.
bind string Yes No The IP address the server should use. The server will be forced to use this IP address instead of automatically choosing a free IP address. This IP address must match one assigned to a network card on the server. This is useful for running multiple servers on the same port on the same box.
port int 8192 (7777 is also commonly used) Yes No The port the server should use. You will need to Port Forward
in order for players to join your server from outside your LAN.
conncookies int* 1 No No Toggles the 0.3.7 connection cookie system. Set to 1 to enable or 0 to disable. NOTE: This server var was added in 0.3.7 R2 and will have no effect in previous versions.
cookielogging int* 0 No No Toggles logging of connection cookies requested by newly connecting players. Set to 1 to enable or 0 to disable. NOTE: This server var was added in 0.3.7 R2 and will have no effect in previous versions.
connseedtime int 300000 No No The time in milliseconds the connection cookie seed value updates. NOTE: This server var was added in 0.3.7 and will have no effect in previous versions.
minconnectiontime int 0 No No The time in milliseconds the server will wait before accepting another incoming connection. It is not recommended that you use this variable unless your server is under a connection flood attack. NOTE: This server var was added in 0.3z and will have no effect in previous versions.
messageslimit int 500 No No The maximum number of messages a user can send per second.
messageholelimit int 3000 No No See here
.
ackslimit int 3000 No No See here
.
playertimeout int 10000 No No The time in miliseconds after which a player will timeout when not sending any data to the server.
mtu int 576 Yes No See here
. NOTE: This server var was added in 0.3.8 and will have no effect in previous versions.
[*] Some settings are a different type than you might think.

Logging

Setting Type Default value Read-only Rule Effect
output bool 0 No No Toggles if log messages (e.g. print/printf from scripts or logprintf from plugins) should be duplicated in the server console. Set to 1 to enable or 0 to disable. This option has effect only on Linux servers.
timestamp bool 1 No No Toggles if a timestamp should be printed with every console message. Set to 1 to enable or 0 to disable.
logtimeformat string [%H:%M:%S] Yes No The timestamp format that should be used. The format is based on the strftime
format from C/C++. Here are some examples: [%H:%M:%S] This displays only the time, and is the default format for all previous SA-MP server versions. [%d/%m/%Y %H:%M:%S] This would display the date in dd/mm/yyyy format followed by the time in hour:minute:second format.
logqueries bool 0 No No Toggles if all queries sent to the server by players should be logged. Set to 1 to enable or 0 to disable. It is considerably useful during a DDoS attack.
chatlogging int* 1 No No Toggles if player chat should be shown in the server console. Useful to stop the log from becoming bloated, or if you have another scripted chat logging solution. Set to 1 to enable or 0 to disable. NOTE: This server var was added in 0.3e R2 and will have no effect in previous versions.
db_logging int* 0 No No Logs sqlite db_ function errors in the server console. *NOTE: This server var was added in 0.3.7 R2 and will have no effect in previous versions.
db_log_queries int* 0 No No Logs all sqlite db_query calls, including the query string. NOTE: This server var was added in 0.3.7 R2 and will have no effect in previous versions.
[*] Some settings are a different type than you might think.

Client

Setting Type Default value Read-only Rule Effect
onfoot_rate* int 30 Yes No The time in milliseconds a client should update the server with new data while on foot.
incar_rate int 30 Yes No The time in milliseconds a client should update the server with new data while in a vehicle.
weapon_rate int 30 Yes No The time in milliseconds a client should update the server with new data while firing a weapon.
stream_distance* float 200.0 No No The distance on the X,Y plane players will stream in server entities. The maximum is 400.0 and the minimum is 50.0. Higher values makes players see server entities at a greater distance, but requires more client processing and potentially more bandwidth.
stream_rate* int 1000 No No The time in milliseconds before the streaming in of server entities is retested for each player. The maximum is 5000 and the minimum is 500. Lower values increases server processing as it has to recheck streaming conditions more frequently for each player.
[*] Lower values of onfoot_rate, incar_rate and weapon_rate increases sync performance, but uses more bandwidth.

NPCs

Setting Type Default value Read-only Rule Effect
maxnpc int 0 No No The maximum amount of NPCs your server can hold. By changing this number you can alter how many of the player slots can be used by NPCs.

Lag compensation

Setting Type Default value Read-only Rule Effect
lagcompmode int 1 Yes No 0: Fully disable lag compensation. 1: Fully enable lag compensation. 2: Enable position-only lag compensation. This means player rotation won’t be lag compensated for. NOTE: This server var was added in 0.3z and will have no effect in previous versions.
lagcomp string On Yes Yes Probably set automatically to On or Off depending on the lagcompmode setting.

Custom models

Setting Type Default value Read-only Rule Effect
useartwork bool 0 Yes No Toggles if the server uses custom models from the models folder. Set to 1 to enable or 0 to disable. NOTE: This server var was added in 0.3.8 and will have no effect in previous versions.
artwork string No Yes Yes Probably set automatically to No or Yes depending on the useartwork setting. NOTE: This server var was added in 0.3.8 and will have no effect in previous versions.
artpath string models Yes No The path where the custom models are located. NOTE: This server var was added in 0.3.8 and will have no effect in previous versions.

Others

Setting Type Default value Read-only Rule Effect
myriad bool 0 No No Unused. It probably enabled some compatibility with an old GTA San Andreas mod called “Myriad Islands” years ago, probably earlier than year 2008.
nosign string Yes No Unused.

Notes

  • Values marked as “Read-only” (as shown by /rcon varlist) can not be changed during runtime. All other values can be (temporarily) changed by passing them to SendRconCommand.
  • Values marked as “Rule” (as shown by /rcon varlist) are displayed in the server browser in the Rules section.
  • Scripts do not have to be in the gamemodes or filterscripts folders. The information in server.cfg is a path, and can therefore use “..”.