搜索
查看: 3068|回复: 1

哪位会修改这个中文ID插件

[复制链接]
发表于 2011-5-19 13:15:59 | 显示全部楼层 |阅读模式 来自 广东清远
哪位会修改这个中文ID插件,加回个老友记1.0版的禁止改名功能进去
  1. new const PLUGINNAME[] = "中文ID"

  2. new const VERSION[]    = "2.1"

  3. new const AUTHORS[]    = "poohoo @ 老友记"



  4. #include <amxmodx>

  5. #include <amxmisc>

  6. #include <fakemeta>





  7. new g_SetName[33][32]

  8. new g_SetAllow[33]

  9. new FILE[256]



  10. public plugin_init()

  11. {

  12.    register_plugin(PLUGINNAME, VERSION, AUTHORS)



  13.    new configsdir[128]

  14.    get_configsdir(configsdir, sizeof(configsdir)-1)

  15.    formatex(FILE, sizeof(FILE)-1, "%s/chinese_id.ini", configsdir)



  16.    if (!file_exists(FILE))

  17.       set_fail_state("File (configs/chinese_id.ini) open error.")

  18. }







  19. // 设置 id 需要的名字

  20. public set_name(id, const newname[])

  21. {

  22.    if (strlen(newname)<1)

  23.       return



  24.    g_SetAllow[id] = 1

  25.    copy(g_SetName[id], 31, newname)

  26.    //one_name(id, g_SetName[id], 31)

  27.    set_user_info(id, "name", g_SetName[id])

  28. }



  29. public client_connect(id)

  30. {

  31.    remove_task(id)

  32.    g_SetAllow[id] = 0

  33. }



  34. public client_putinserver(id)

  35. {

  36.    // 延时足够的时间,等待 admin 权限认证插件完成权限设置后,再执行更换名字

  37.    set_task(random_float(3.0,3.0), "get_name_from_file", id)

  38. }



  39. // 从文件里检查是否有对应的中文ID

  40. public get_name_from_file(id)

  41. {

  42.    if (!is_user_connected(id))

  43.       return

  44.    

  45.    new name[32]

  46.    get_user_name(id, name, 31)



  47.    new set = 0

  48.    new hFile = fopen(FILE, "r")

  49.    if (hFile)

  50.    {

  51.       new line[128], tmpName[64], tmpNameCN[64]



  52.       while (fgets(hFile, line, sizeof(line)-1))

  53.       {

  54.          tmpName = ""

  55.          tmpNameCN = ""

  56.          trim(line)

  57.          if (line[0]==';' || line[0]=='/') continue



  58.          parse(line, tmpName,sizeof(tmpName)-1, tmpNameCN,sizeof(tmpNameCN)-1)

  59.          trim(tmpName)

  60.          trim(tmpNameCN)



  61.          if (strcmp(name, tmpName)==0)

  62.          {

  63.             copy(name, 31, tmpNameCN)

  64.             set = 1

  65.             break

  66.          }

  67.       }

  68.    }

  69.    fclose(hFile)



  70.    // 完成后,设置新的名字

  71.    if (set)

  72.       set_name(id, name)
  73. }
复制代码

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?注个册吧

×
发表于 2015-6-3 16:55:28 | 显示全部楼层 来自 辽宁葫芦岛
歉,搜索 点通币-1,本操作后您的点通币将不足 0
回复

使用道具 举报

游客
回复
您需要登录后才可以回帖 登录 | 注个册吧

快速回复 返回顶部 返回列表