fenghf 发表于 2011-9-21 22:42

服务器中文名字[配置文件版] SP源码 v1.0.2版本 ,修复BUG题

本帖最后由 fenghf 于 2014-4-13 22:20 编辑

如果你看得懂,sp应该都不用下载了
txt文件记住另存为 UTF-8格式.
1.0.1
       -原本修改发布
1.0.2
       -修复换图后不再次读取 hostname.txt问题
      (通过round_start增加读取,还有OnMapStart方法..我觉得round_start比较合适)#pragma semicolon 1
#include <sourcemod>
public Plugin:myinfo =
{
        name = "L4D 中文伺服器名[配置文件版]",
        author = "fenghf",
        description = "讓伺服器名稱使用中文[配置文件版]",
        version = "1.0.7",
        url = "http://bbs.blacksheepgame.com/forum.php?mod=viewthread&tid=2345308"
}
public OnPluginStart()
{
      HookEvent("round_start", CheckTheChineseName);
}
public CheckTheChineseName(Handle:event, const String:name[], bool:dontBroadcast)
{

      new String:sPath;
      BuildPath(Path_SM, sPath, sizeof(sPath),"configs/hostname/hostname.txt");
      
      new Handle:file = OpenFile(sPath, "r");
      if(file == INVALID_HANDLE)
      return;
      
      new String:readData;
      while(!IsEndOfFile(file) && ReadFileLine(file, readData, sizeof(readData)))
      {
                SetConVarString(FindConVar("hostname"),readData);
      }
}


polo2500 发表于 2011-9-21 23:50

疯哥,我收下了。请你喝茶{:3_149:}

fenghf 发表于 2011-9-24 07:57

回复 2# polo2500


    哈哈
页: [1]
查看完整版本: 服务器中文名字[配置文件版] SP源码 v1.0.2版本 ,修复BUG题