|
本帖最后由 13diy 于 2013-2-18 23:49 编辑
- #include <sourcemod>
- #include <sdktools>
- public Plugin:myinfo =
- {
- name = "CS:GO Chinese Host Name",
- author = "k1nader",
- description = "CS:GO Chinese Host Name",
- version = "0.1",
- url = "http://csmod.com"
- };
- public OnPluginStart()
- RegServerCmd("sm_refresh_hostname", TReLoadHostName, "Refresh Host Name");
- public OnMapStart()
- ReLoadHostName();
- public Action:TReLoadHostName(args)
- ReLoadHostName();
- public ReLoadHostName()
- {
- decl String:Path[PLATFORM_MAX_PATH];
-
- new iPort = GetConVarInt(FindConVar("hostport"));
- BuildPath(Path_SM, Path, PLATFORM_MAX_PATH, "%d_hostname.txt", iPort);
- decl String:HostName[128];
-
- if(FileExists(Path, false))
- {
- new Handle:FileHandle = OpenFile(Path, "r");
- ReadFileLine(FileHandle, HostName, sizeof(HostName));
- CloseHandle(FileHandle);
- }
- else{
- LogError("Cant find %s", Path);
- HostName = "CS:GO 服务器";
- }
-
- new Handle:Convar = FindConVar("hostname");
- SetConVarString(Convar, HostName, true, true);
- }
复制代码 使用方法:
csgo\addons\sourcemod\端口_hostname.txt 写入服务器名称。(注意用UTF-8保存)
例子:
27015_hostname.txt 写入"CSGO 服务器[娱乐模式]" 即可 |
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有账号?注个册吧
×
|