AE86 发表于 2006-9-30 09:21:03

hltv插件编译不了???

hltv.sma(97) : error 017: undefine symbol "strtonum"
/* AMX Mod script.
*
* (c) 2005, BeeJump
* This file is provided as is (no warranties).
*
*
* Note: You can copy this two cvar in your AMX.CFG. (Very good idea)
* amx_hltv_proxypassword "passwordsetinyourhltv.cfg"
*
* Check value 'adminpassword' in your
* hltv.cfg (if // behind, remove it and set your password)
* adminpassword        "mypassword"
*
* Commands:
* hltv_r - Start record HLTV (HLTV Proxy must be started of course)
* hltv_s - Stop record HLTV
*
*
* NOTE: Dont add value after hltv_r.
* Format of recordfile: Hostname-yymmddhhmm-mapname.dem
*
* Dont forget: Invalid adminpassword = NO RECORD
*
* Tips:
* If you want a small Menu, set cmds.ini in addons/amx
* "HLTV Start Record" "hltv_r" "b" "u"
* "HLTV Stop Record" "hltv_s" "b" "u"
*
*/


#include <amxmodx>
#include <amxmisc>
#include <udp>


new address_hltv = -1
new record_hltv = 0
new error_hltv = 2
new g_logFile

public restart_round(time[])
{
        server_cmd("sv_restartround %s",time)
        return PLUGIN_CONTINUE
}

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

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

public start_half(id,level,cid)
{
        hltv_rec(id,level,cid)
        set_task(2.0,"restart_round",0,"1",1)
        set_task(4.0,"restart_round",0,"3",1)
        set_task(8.0,"restart_round",0,"5",1)
        set_task(14.0,"live_msg")
        return PLUGIN_CONTINUE
}

public stop_half(id,level,cid)
{
        set_task(2.0,"stop_msg")
        hltv_stoprec(id,level,cid)
        return PLUGIN_CONTINUE
}

public hltv_init(id,level,cid)
{
   new address, ip
   // get the id of the hltv server
   new hltvid, hltv
   new players, inum
   get_players(players,inum)   
   for(new i=0; i<inum; ++i){
    if (is_user_hltv(i))
   {
   hltvid = get_user_userid(i)
   }
   }
   hltv = find_player("k", hltvid)
   if (hltv) {
      get_user_ip(hltv,ip,31)
      new pos = copyc(address,31,ip,':') + 1
      console_print(id,"* HLTV found: (%s:%s)",address,ip)
      address_hltv = set_iaddress(address,strtonum(ip))
      new hltvpassword
      get_cvar_string("amx_hltv_proxypassword",hltvpassword,31)
      client_print(id,print_chat,"* Challenged the access with success")

      new rcv,snd
      new rconid
      new pass
      get_cvar_string("amx_hltv_proxypassword",pass,63)

      setc(snd,4,0xff)
      copy(snd,255,"challenge rcon")
      setc(snd,1,'^n')
   
      query_udp_msg(address_hltv,rcv,255,snd)
      copy(rconid,12,rcv)
      replace(rconid,255,"^n","")
      setc(snd,4,0xff)
      format(snd,255,"rcon %s ^"%s^" stoprecording^n",rconid,pass)
      send_udp_msg(address_hltv,snd)
      error_hltv = 0
   }
   else {
   client_print(id,print_chat,"* WARNING: HLTV Proxy Not Found. HLTV Proxy is not started or not connected here")
   error_hltv = 1
   }
   return PLUGIN_HANDLED
}

public hltv_rec(id,level,cid)
{
   
    if (address_hltv==-1)
      hltv_init(id,level,cid)

    if (error_hltv == 1)
      return PLUGIN_HANDLED

    new rcv, snd
    new rconid
    new pass
    new demoname,players,playername
    new playerteam,curmap,time_date
    new nbr,i

    get_players(players,nbr)
    get_mapname(curmap,31)
    get_time("%Y.%m.%d-%H.%M.%S",time_date,31)
    for(i=0; i<nbr; i++) {
        get_user_team(players,playerteam,15)
        if (equal(playerteam,"CT")) {
                get_user_name(players,playername,31)
                format(demoname,500,"%s_%s(CT)_%s.dem",playername,curmap,time_date)
        }
        else {
                if (equal(playerteam,"TERRORIST")) {
                        get_user_name(players,playername,31)
                        format(demoname,500,"%s_%s(T)_%s.dem",playername,curmap,time_date)
                }
        }
        if ((equal(playerteam,"CT"))||(equal(playerteam,"TERRORIST"))) {
                // Removes bad strings before recording
                while(replace(demoname,500,"/","-")) {}
                while(replace(demoname,500,"\","-")) {}
                while(replace(demoname,500,":","-")) {}
                while(replace(demoname,500,"*","-")) {}
                while(replace(demoname,500,"?","-")) {}
                while(replace(demoname,500,">","-")) {}
                while(replace(demoname,500,"<","-")) {}
                while(replace(demoname,500,"|","-")) {}
                client_cmd(players,"stop")
                client_cmd(players,"record ^"%s.a^"",demoname)
                client_print(players,print_chat,"* Record a DEMO on your PC: %s",demoname)
        }
    }

    get_cvar_string("amx_hltv_proxypassword",pass,63)

    setc(snd,4,0xff)
    copy(snd,255,"challenge rcon")
    setc(snd,1,'^n')

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

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

    copy(rconid,12,rcv)
    replace(rconid,255,"^n","")
    setc(snd,4,0xff)

    new hostname
    get_cvar_string("hostname",hostname,255)
    format(demoname,500,"%s",hostname)

    // Remove bad strings before recording

    while(replace(demoname,500,"/","-")) {}
    while(replace(demoname,500,"\","-")) {}
    while(replace(demoname,500,":","-")) {}
    while(replace(demoname,500,"*","-")) {}
    while(replace(demoname,500,"?","-")) {}
    while(replace(demoname,500,">","-")) {}
    while(replace(demoname,500,"<","-")) {}
    while(replace(demoname,500,"|","-")) {}
    while(replace(demoname,500," ","")) {}

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

    new authid,name
    get_user_authid(id,authid,31)
    get_user_name(id,name,31)
    switch(get_cvar_num("amx_show_activity")){
    case 2: client_print(0,print_chat,"OP: Start Record HLTV DEMO",name)
    case 1: client_print(0,print_chat,"ADMIN: Record HLTV DEMO",name)
    }

    log_to_file(g_logFile,"Cmd: ^"%s<%d><%s><>^" Start record HLTV ",name,get_user_userid(id),authid)

    record_hltv = 1
    return PLUGIN_HANDLED
}

public hltv_stoprec(id,level,cid)
{

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

    if (error_hltv == 1)
      return PLUGIN_HANDLED

    new rcv,snd
    new rconid
    new pass

    new players,playerteam
    new nbr,i
    get_players(players,nbr)
    for(i=0; i<nbr; i++) {
        get_user_team(players,playerteam,15)
        if ((equal(playerteam,"CT"))||(equal(playerteam,"TERRORIST"))) {
                client_cmd(players,"stop")
                client_print(players,print_chat,"* Stop Record Your DEMO.")
        }
    }

    get_cvar_string("amx_hltv_proxypassword",pass,63)

    setc(snd,4,0xff)
    copy(snd,255,"challenge rcon")
    setc(snd,1,'^n')
   
    if (query_udp_msg(address_hltv,rcv,255,snd) < 1){
   client_print(id,print_chat,"* WARNING: Lost HLTV Connection")
   address_hltv = -1
   record_hltv = 0
   return PLUGIN_HANDLED
    }

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

    copy(rconid,12,rcv)
    replace(rconid,255,"^n","")
    setc(snd,4,0xff)
    format(snd,255,"rcon %s ^"%s^" stoprecording^n",rconid,pass)
    send_udp_msg(address_hltv,snd)

    new authid,name
    get_user_authid(id,authid,31)
    get_user_name(id,name,31)
    switch(get_cvar_num("amx_show_activity")) {
    case 2: client_print(0,print_chat,"OP: Stop Record HLTV DEMO",name)
    case 1: client_print(0,print_chat,"ADMIN: Stop Record HLTV DEMO",name)
    }

    log_to_file(g_logFile,"Cmd: ^"%s<%d><%s><>^" Stop record HLTV ",name,get_user_userid(id),authid)
   
    record_hltv = 0
    return PLUGIN_HANDLED
}

public plugin_end()
{

        if (error_hltv == 1)
              return PLUGIN_HANDLED

        if (record_hltv == 0)
              return PLUGIN_HANDLED

        new rcv,snd
        new rconid
        new pass
        get_cvar_string("amx_hltv_proxypassword",pass,63)

        setc(snd,4,0xff)
        copy(snd,255,"challenge rcon")
        setc(snd,1,'^n')
   
        query_udp_msg(address_hltv,rcv,255,snd)
        copy(rconid,12,rcv)
        replace(rconid,255,"^n","")
        setc(snd,4,0xff)
        format(snd,255,"rcon %s ^"%s^" stoprecording^n",rconid,pass)
        send_udp_msg(address_hltv,snd)
        address_hltv = -1
        record_hltv = 0
      return PLUGIN_CONTINUE
}

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

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

   register_cvar("amx_hltv_proxypassword","hltvpassword")
      
   get_time("admin%m%d.log",g_logFile,15)

   return PLUGIN_CONTINUE
}

kinsprite 发表于 2006-9-30 10:31:17

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

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

AE86 发表于 2006-9-30 11:20:42

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

谢谢:cool: :super:

hqzycs 发表于 2006-9-30 13:36:35

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

kinsprite http://forum.dt-club.net/images/dt/misc/male.gifvbmenu_register("postmenu_236054", true);
C.H.M 汉化组 !! 强!!!
页: [1]
查看完整版本: hltv插件编译不了???