搜索
查看: 2410|回复: 3

hltv插件编译不了???

[复制链接]
发表于 2006-9-30 09:21:03 | 显示全部楼层 |阅读模式 来自 中国–广东–深圳
hltv.sma(97) : error 017: undefine symbol "strtonum"
  1. /* AMX Mod script.
  2. *
  3. * (c) 2005, BeeJump
  4. * This file is provided as is (no warranties).
  5. *
  6. *
  7. * Note: You can copy this two cvar in your AMX.CFG. (Very good idea)
  8. * amx_hltv_proxypassword "passwordsetinyourhltv.cfg"
  9. *
  10. * Check value 'adminpassword' in your
  11. * hltv.cfg (if // behind, remove it and set your password)
  12. * adminpassword        "mypassword"
  13. *
  14. * Commands:
  15. * hltv_r - Start record HLTV (HLTV Proxy must be started of course)
  16. * hltv_s - Stop record HLTV
  17. *
  18. *
  19. * NOTE: Dont add value after hltv_r.
  20. * Format of recordfile: Hostname-yymmddhhmm-mapname.dem
  21. *
  22. * Dont forget: Invalid adminpassword = NO RECORD
  23. *
  24. * Tips:
  25. * If you want a small Menu, set cmds.ini in addons/amx
  26. * "HLTV Start Record" "hltv_r" "b" "u"
  27. * "HLTV Stop Record" "hltv_s" "b" "u"
  28. *
  29. */


  30. #include <amxmodx>
  31. #include <amxmisc>
  32. #include <udp>


  33. new address_hltv = -1
  34. new record_hltv = 0
  35. new error_hltv = 2
  36. new g_logFile[16]

  37. public restart_round(time[])
  38. {
  39.         server_cmd("sv_restartround %s",time)
  40.         return PLUGIN_CONTINUE
  41. }

  42. public live_msg()
  43. {
  44.         set_hudmessage(0, 255, 255, -1.0, 0.32, 0, 2.0, 6.0, 0.8, 0.8, 2)
  45.         show_hudmessage(0,"--[ LIVE !!! GL & HF ]--^n--[ LIVE !!! GL & HF ]--^n--[ LIVE !!! GL & HF ]--")
  46.         return PLUGIN_CONTINUE
  47. }

  48. public stop_msg()
  49. {
  50.         set_hudmessage(0, 255, 255, -1.0, 0.32, 0, 2.0, 6.0, 0.8, 0.8, 2)
  51.         show_hudmessage(0,"* GG !! GOOD JOB *^n* GG !! GOOD JOB *^n* GG !! GOOD JOB *")
  52.         return PLUGIN_CONTINUE
  53. }

  54. public start_half(id,level,cid)
  55. {
  56.         hltv_rec(id,level,cid)
  57.         set_task(2.0,"restart_round",0,"1",1)
  58.         set_task(4.0,"restart_round",0,"3",1)
  59.         set_task(8.0,"restart_round",0,"5",1)
  60.         set_task(14.0,"live_msg")
  61.         return PLUGIN_CONTINUE
  62. }

  63. public stop_half(id,level,cid)
  64. {
  65.         set_task(2.0,"stop_msg")
  66.         hltv_stoprec(id,level,cid)
  67.         return PLUGIN_CONTINUE
  68. }

  69. public hltv_init(id,level,cid)
  70. {
  71.    new address[32], ip[32]
  72.    // get the id of the hltv server
  73.    new hltvid, hltv
  74.    new players[32], inum  
  75.    get_players(players,inum)     
  76.    for(new i=0; i<inum; ++i){
  77.     if (is_user_hltv(i))
  78.      {
  79.      hltvid = get_user_userid(i)
  80.      }
  81.    }
  82.    hltv = find_player("k", hltvid)
  83.    if (hltv) {  
  84.       get_user_ip(hltv,ip,31)
  85.       new pos = copyc(address,31,ip,':') + 1
  86.       console_print(id,"* HLTV found: (%s:%s)",address,ip[pos])
  87.       address_hltv = set_iaddress(address,strtonum(ip[pos]))
  88.       new hltvpassword[32]
  89.       get_cvar_string("amx_hltv_proxypassword",hltvpassword,31)
  90.       client_print(id,print_chat,"* Challenged the access with success")

  91.       new rcv[256],snd[256]
  92.       new rconid[13]
  93.       new pass[64]
  94.       get_cvar_string("amx_hltv_proxypassword",pass,63)

  95.       setc(snd,4,0xff)
  96.       copy(snd[4],255,"challenge rcon")
  97.       setc(snd[18],1,'^n')
  98.    
  99.       query_udp_msg(address_hltv,rcv,255,snd)
  100.       copy(rconid,12,rcv[15])
  101.       replace(rconid,255,"^n","")
  102.       setc(snd,4,0xff)
  103.       format(snd[4],255,"rcon %s ^"%s^" stoprecording^n",rconid,pass)
  104.       send_udp_msg(address_hltv,snd)
  105.       error_hltv = 0
  106.    }
  107.    else {
  108.      client_print(id,print_chat,"* WARNING: HLTV Proxy Not Found. HLTV Proxy is not started or not connected here")
  109.      error_hltv = 1
  110.    }
  111.    return PLUGIN_HANDLED
  112. }

  113. public hltv_rec(id,level,cid)
  114. {
  115.    
  116.     if (address_hltv==-1)
  117.       hltv_init(id,level,cid)

  118.     if (error_hltv == 1)
  119.       return PLUGIN_HANDLED

  120.     new rcv[255], snd[256]
  121.     new rconid[13]
  122.     new pass[64]
  123.     new demoname[501],players[32],playername[32]
  124.     new playerteam[16],curmap[32],time_date[32]
  125.     new nbr,i

  126.     get_players(players,nbr)
  127.     get_mapname(curmap,31)
  128.     get_time("%Y.%m.%d-%H.%M.%S",time_date,31)
  129.     for(i=0; i<nbr; i++) {
  130.         get_user_team(players[i],playerteam,15)
  131.         if (equal(playerteam,"CT")) {
  132.                 get_user_name(players[i],playername,31)
  133.                 format(demoname,500,"%s_%s(CT)_%s.dem",playername,curmap,time_date)
  134.         }
  135.         else {
  136.                 if (equal(playerteam,"TERRORIST")) {
  137.                         get_user_name(players[i],playername,31)
  138.                         format(demoname,500,"%s_%s(T)_%s.dem",playername,curmap,time_date)
  139.                 }
  140.         }
  141.         if ((equal(playerteam,"CT"))||(equal(playerteam,"TERRORIST"))) {
  142.                 // Removes bad strings before recording
  143.                 while(replace(demoname,500,"/","-")) {}
  144.                 while(replace(demoname,500,"","-")) {}
  145.                 while(replace(demoname,500,":","-")) {}
  146.                 while(replace(demoname,500,"*","-")) {}
  147.                 while(replace(demoname,500,"?","-")) {}
  148.                 while(replace(demoname,500,">","-")) {}
  149.                 while(replace(demoname,500,"<","-")) {}
  150.                 while(replace(demoname,500,"|","-")) {}
  151.                 client_cmd(players[i],"stop")
  152.                 client_cmd(players[i],"record ^"%s.a^"",demoname)
  153.                 client_print(players[i],print_chat,"* Record a DEMO on your PC: %s",demoname)
  154.         }
  155.     }

  156.     get_cvar_string("amx_hltv_proxypassword",pass,63)

  157.     setc(snd,4,0xff)
  158.     copy(snd[4],255,"challenge rcon")
  159.     setc(snd[18],1,'^n')

  160.     if (query_udp_msg(address_hltv,rcv,255,snd) < 1){
  161.     client_print(id,print_chat,"* WARNING: Lost HLTV Connection")
  162.     address_hltv = -1
  163.     record_hltv = 0
  164.     return PLUGIN_HANDLED
  165.     }

  166.     if (record_hltv == 1){
  167.       client_print(id,print_chat,"* There is already one record")
  168.       return PLUGIN_HANDLED
  169.     }

  170.     copy(rconid,12,rcv[15])
  171.     replace(rconid,255,"^n","")
  172.     setc(snd,4,0xff)

  173.     new hostname[256]
  174.     get_cvar_string("hostname",hostname,255)
  175.     format(demoname,500,"%s",hostname)

  176.     // Remove bad strings before recording

  177.     while(replace(demoname,500,"/","-")) {}
  178.     while(replace(demoname,500,"","-")) {}
  179.     while(replace(demoname,500,":","-")) {}
  180.     while(replace(demoname,500,"*","-")) {}
  181.     while(replace(demoname,500,"?","-")) {}
  182.     while(replace(demoname,500,">","-")) {}
  183.     while(replace(demoname,500,"<","-")) {}
  184.     while(replace(demoname,500,"|","-")) {}
  185.     while(replace(demoname,500," ","")) {}

  186.     format(snd[4],255,"rcon %s ^"%s^" record ../demo/%s^n",rconid,pass,demoname)
  187.     send_udp_msg(address_hltv,snd)

  188.     new authid[32],name[32]
  189.     get_user_authid(id,authid,31)
  190.     get_user_name(id,name,31)
  191.     switch(get_cvar_num("amx_show_activity")){
  192.     case 2: client_print(0,print_chat,"OP: Start Record HLTV DEMO",name)
  193.     case 1: client_print(0,print_chat,"ADMIN: Record HLTV DEMO",name)
  194.     }
  195.   
  196.     log_to_file(g_logFile,"Cmd: ^"%s<%d><%s><>^" Start record HLTV ",name,get_user_userid(id),authid)

  197.     record_hltv = 1
  198.     return PLUGIN_HANDLED
  199. }

  200. public hltv_stoprec(id,level,cid)
  201. {

  202.     if (address_hltv==-1)
  203.       hltv_init(id,level,cid)

  204.     if (error_hltv == 1)
  205.       return PLUGIN_HANDLED

  206.     new rcv[256],snd[256]
  207.     new rconid[13]
  208.     new pass[64]

  209.     new players[32],playerteam[16]
  210.     new nbr,i
  211.     get_players(players,nbr)
  212.     for(i=0; i<nbr; i++) {
  213.         get_user_team(players[i],playerteam,15)
  214.         if ((equal(playerteam,"CT"))||(equal(playerteam,"TERRORIST"))) {
  215.                 client_cmd(players[i],"stop")
  216.                 client_print(players[i],print_chat,"* Stop Record Your DEMO.")
  217.         }
  218.     }

  219.     get_cvar_string("amx_hltv_proxypassword",pass,63)

  220.     setc(snd,4,0xff)
  221.     copy(snd[4],255,"challenge rcon")
  222.     setc(snd[18],1,'^n')
  223.    
  224.     if (query_udp_msg(address_hltv,rcv,255,snd) < 1){
  225.      client_print(id,print_chat,"* WARNING: Lost HLTV Connection")
  226.      address_hltv = -1
  227.      record_hltv = 0
  228.      return PLUGIN_HANDLED
  229.     }

  230.     if (record_hltv == 0){
  231.       client_print(id,print_chat,"* There is no record to cancel")
  232.       return PLUGIN_HANDLED
  233.     }

  234.     copy(rconid,12,rcv[15])
  235.     replace(rconid,255,"^n","")
  236.     setc(snd,4,0xff)
  237.     format(snd[4],255,"rcon %s ^"%s^" stoprecording^n",rconid,pass)
  238.     send_udp_msg(address_hltv,snd)

  239.     new authid[32],name[32]
  240.     get_user_authid(id,authid,31)
  241.     get_user_name(id,name,31)
  242.     switch(get_cvar_num("amx_show_activity")) {
  243.     case 2: client_print(0,print_chat,"OP: Stop Record HLTV DEMO",name)
  244.     case 1: client_print(0,print_chat,"ADMIN: Stop Record HLTV DEMO",name)
  245.     }
  246.   
  247.     log_to_file(g_logFile,"Cmd: ^"%s<%d><%s><>^" Stop record HLTV ",name,get_user_userid(id),authid)
  248.    
  249.     record_hltv = 0
  250.     return PLUGIN_HANDLED
  251. }

  252. public plugin_end()
  253. {

  254.         if (error_hltv == 1)
  255.               return PLUGIN_HANDLED

  256.         if (record_hltv == 0)
  257.               return PLUGIN_HANDLED

  258.         new rcv[256],snd[256]
  259.         new rconid[13]
  260.         new pass[64]
  261.         get_cvar_string("amx_hltv_proxypassword",pass,63)

  262.         setc(snd,4,0xff)
  263.         copy(snd[4],255,"challenge rcon")
  264.         setc(snd[18],1,'^n')
  265.    
  266.         query_udp_msg(address_hltv,rcv,255,snd)
  267.         copy(rconid,12,rcv[15])
  268.         replace(rconid,255,"^n","")
  269.         setc(snd,4,0xff)
  270.         format(snd[4],255,"rcon %s ^"%s^" stoprecording^n",rconid,pass)
  271.         send_udp_msg(address_hltv,snd)
  272.         address_hltv = -1
  273.         record_hltv = 0
  274.         return PLUGIN_CONTINUE
  275. }

  276. public plugin_init()
  277. {
  278.    register_plugin("HLTV&DEMO","1.0","BeeJump")
  279.    register_concmd("hltv_r","hltv_rec",ADMIN_LEVEL_A,"- 开始录制HLTV")
  280.    register_concmd("hltv_s","hltv_stoprec",ADMIN_LEVEL_A,"- 停止录制HLTV")
  281.    register_concmd("r3","start_half",ADMIN_LEVEL_A,"- 开始比赛并录制HLTV&Player DEMO")
  282.    register_concmd("stop_r3","stop_half",ADMIN_LEVEL_A,"- 停止比赛并停止录制HLTV&Player DEMO")

  283.    register_clcmd("say hltv_r","hltv_rec",ADMIN_LEVEL_A,"- 开始录制HLTV")
  284.    register_clcmd("say hltv_s","hltv_stoprec",ADMIN_LEVEL_A,"- 停止录制HLTV")

  285.    register_cvar("amx_hltv_proxypassword","hltvpassword")
  286.       
  287.    get_time("admin%m%d.log",g_logFile,15)
  288.   
  289.    return PLUGIN_CONTINUE
  290. }
复制代码

本帖子中包含更多资源

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

×
发表于 2006-9-30 10:31:17 | 显示全部楼层 来自 中国–黑龙江–哈尔滨

回复: hltv插件编译不了???

undefine symbol "strtonum"  
未定义符号: strtonum
amxx中使用 str_to_num
回复

使用道具 举报

 楼主| 发表于 2006-9-30 11:20:42 | 显示全部楼层 来自 中国–广东–深圳–南山区

回复: hltv插件编译不了???

谢谢:cool: :super:
回复

使用道具 举报

发表于 2006-9-30 13:36:35 | 显示全部楼层 来自 中国–山西–忻州

回复: hltv插件编译不了???

kinsprite   vbmenu_register("postmenu_236054", true);
C.H.M 汉化组 !! 强!!!
回复

使用道具 举报

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

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