搜索
查看: 2153|回复: 2

哪位能帮我汉化汉化代码

[复制链接]
发表于 2008-9-10 04:24:09 | 显示全部楼层 |阅读模式 来自 中国–福建–泉州
  1. #include <amxmodx>
  2. #include <amxmisc>
  3. /* Player Menus */
  4. #define MAX_MENU_NUM 24
  5. new g_MenuName[ MAX_MENU_NUM ][32]
  6. new g_MenuCmd[ MAX_MENU_NUM ][32]
  7. new PMenuName[] = "Player Menu"
  8. new g_MenuItem[3][] = {
  9. "More",
  10. "Back",
  11. "Exit"
  12. }
  13. new g_cNum
  14. new g_menuPosition[33]
  15. public plugin_init() {
  16. register_plugin("Player Menu","0.1","nwb13")
  17. register_menucmd(register_menuid( PMenuName ),1023,"actionPlMenu")
  18. register_clcmd("say menu","PlMenu",ADMIN_ALL, "display player menu" )
  19. new configs[64]
  20. get_configsdir(configs, 63)
  21. format(configs, 63, "%s/%s", configs, "plmenu.ini")
  22. loadSettings(configs)
  23. }
  24. loadSettings(plmenuconfig[]) {
  25. if (!file_exists(plmenuconfig))
  26.   return 0
  27. new temp[256]
  28. new a, pos = 0
  29. while ( g_cNum < MAX_MENU_NUM && read_file(plmenuconfig,pos++,temp,255,a) ) {      
  30. if ( temp[0] == ';' )
  31.   continue
  32. if (parse(temp,g_MenuName[g_cNum],31,g_MenuCmd[g_cNum],31) < 2)
  33.   continue
  34. ++g_cNum
  35. }
  36. return 1
  37. }
  38. public PlMenu(id){
  39. if (is_user_connected(id))
  40.   disPlayerMenu(id,g_menuPosition[id] = 0)
  41. return PLUGIN_HANDLED
  42. }
  43. disPlayerMenu(id,pos) {
  44. if (pos < 0)  return
  45. new menuBody[512]
  46. new b = 0
  47. new start = pos * 8
  48. if (start >= g_cNum )
  49.   start = pos = g_menuPosition[id] = 0
  50. new len = format(menuBody,511,"\y%s\R%d/%d^n\w^n",PMenuName,pos+1,( g_cNum / 8 + ((g_cNum % 8) ? 1 : 0 )) )
  51. new end = start + 8
  52. new keys = MENU_KEY_0
  53. if (end > g_cNum )
  54.   end = g_cNum
  55. for (new a = start; a < end; ++a) {
  56.   keys |= (1<<b)
  57.   len += format(menuBody[len],511-len,"%d. %s^n",++b,g_MenuName[a])
  58. }
  59. if (end != g_cNum ) {
  60.       format(menuBody[len],511-len,"^n9. %s...^n0. %s", g_MenuItem[0], pos ? g_MenuItem[1] : g_MenuItem[2])
  61.   keys |= MENU_KEY_9
  62. }
  63. else format(menuBody[len],511-len,"^n0. %s",pos ? g_MenuItem[1] : g_MenuItem[2])
  64. show_menu(id,keys,menuBody,-1,PMenuName)
  65. }
  66. public actionPlMenu(id,key){
  67. switch(key){
  68.   case 8:{
  69.    disPlayerMenu(id,++g_menuPosition[id])
  70.   }
  71.   case 9:{
  72.    disPlayerMenu(id,--g_menuPosition[id])
  73.   }
  74.   default:{
  75.    new menuitem = g_menuPosition[id] * 8 + key
  76.    client_cmd(id,"%s",g_MenuCmd[menuitem])
  77.   }
  78. }
  79. return PLUGIN_HANDLED
  80. }
复制代码

哪位能帮我汉化汉化这段代码!
 楼主| 发表于 2008-9-10 04:44:04 | 显示全部楼层 来自 中国–福建–泉州

回复: 哪位能帮我汉化汉化代码

new PMenuName[] = "Player Menu"
new g_MenuItem[3][] = {
"More",
"Back",
"Exit"

这部分我起初写成中文编译出来就是乱码!不懂AMXX的语法规则!
回复

使用道具 举报

发表于 2009-7-5 19:40:06 | 显示全部楼层 来自 中国–新疆–哈密
这个是玩家菜单的插件,你只需要在config里面的plmenu.ini里修改就可以了
  1. #include <amxmodx>
  2. #include <amxmisc>
  3. /* Player Menus */
  4. #define MAX_MENU_NUM 24
  5. new g_MenuName[ MAX_MENU_NUM ][32]
  6. new g_MenuCmd[ MAX_MENU_NUM ][32]
  7. new PMenuName[] = "玩家菜单"
  8. new g_MenuItem[3][] = {
  9. "下页",
  10. "上页",
  11. "退出"
  12. }
  13. new g_cNum
  14. new g_menuPosition[33]
  15. public plugin_init() {
  16. register_plugin("Player Menu","0.1","nwb13")
  17. register_menucmd(register_menuid( PMenuName ),1023,"actionPlMenu")
  18. register_clcmd("say menu","PlMenu",ADMIN_ALL, "display player menu" )
  19. new configs[64]
  20. get_configsdir(configs, 63)
  21. format(configs, 63, "%s/%s", configs, "plmenu.ini")
  22. loadSettings(configs)
  23. }
  24. loadSettings(plmenuconfig[]) {
  25. if (!file_exists(plmenuconfig))
  26.   return 0
  27. new temp[256]
  28. new a, pos = 0
  29. while ( g_cNum < MAX_MENU_NUM && read_file(plmenuconfig,pos++,temp,255,a) ) {      
  30. if ( temp[0] == ';' )
  31.   continue
  32. if (parse(temp,g_MenuName[g_cNum],31,g_MenuCmd[g_cNum],31) < 2)
  33.   continue
  34. ++g_cNum
  35. }
  36. return 1
  37. }
  38. public PlMenu(id){
  39. if (is_user_connected(id))
  40.   disPlayerMenu(id,g_menuPosition[id] = 0)
  41. return PLUGIN_HANDLED
  42. }
  43. disPlayerMenu(id,pos) {
  44. if (pos < 0)  return
  45. new menuBody[512]
  46. new b = 0
  47. new start = pos * 8
  48. if (start >= g_cNum )
  49.   start = pos = g_menuPosition[id] = 0
  50. new len = format(menuBody,511,"\y%s\R%d/%d^n\w^n",PMenuName,pos+1,( g_cNum / 8 + ((g_cNum % 8) ? 1 : 0 )) )
  51. new end = start + 8
  52. new keys = MENU_KEY_0
  53. if (end > g_cNum )
  54.   end = g_cNum
  55. for (new a = start; a < end; ++a) {
  56.   keys |= (1<<b)
  57.   len += format(menuBody[len],511-len,"%d. %s^n",++b,g_MenuName[a])
  58. }
  59. if (end != g_cNum ) {
  60.       format(menuBody[len],511-len,"^n9. %s...^n0. %s", g_MenuItem[0], pos ? g_MenuItem[1] : g_MenuItem[2])
  61.   keys |= MENU_KEY_9
  62. }
  63. else format(menuBody[len],511-len,"^n0. %s",pos ? g_MenuItem[1] : g_MenuItem[2])
  64. show_menu(id,keys,menuBody,-1,PMenuName)
  65. }
  66. public actionPlMenu(id,key){
  67. switch(key){
  68.   case 8:{
  69.    disPlayerMenu(id,++g_menuPosition[id])
  70.   }
  71.   case 9:{
  72.    disPlayerMenu(id,--g_menuPosition[id])
  73.   }
  74.   default:{
  75.    new menuitem = g_menuPosition[id] * 8 + key
  76.    client_cmd(id,"%s",g_MenuCmd[menuitem])
  77.   }
  78. }
  79. return PLUGIN_HANDLED
  80. }
复制代码
回复

使用道具 举报

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

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