|
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[16]
- 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[32], ip[32]
- // get the id of the hltv server
- new hltvid, hltv
- new players[32], 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[pos])
- address_hltv = set_iaddress(address,strtonum(ip[pos]))
- new hltvpassword[32]
- get_cvar_string("amx_hltv_proxypassword",hltvpassword,31)
- client_print(id,print_chat,"* Challenged the access with success")
- new rcv[256],snd[256]
- new rconid[13]
- new pass[64]
- get_cvar_string("amx_hltv_proxypassword",pass,63)
- setc(snd,4,0xff)
- copy(snd[4],255,"challenge rcon")
- setc(snd[18],1,'^n')
-
- query_udp_msg(address_hltv,rcv,255,snd)
- copy(rconid,12,rcv[15])
- replace(rconid,255,"^n","")
- setc(snd,4,0xff)
- format(snd[4],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[255], snd[256]
- new rconid[13]
- new pass[64]
- new demoname[501],players[32],playername[32]
- new playerteam[16],curmap[32],time_date[32]
- 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[i],playerteam,15)
- if (equal(playerteam,"CT")) {
- get_user_name(players[i],playername,31)
- format(demoname,500,"%s_%s(CT)_%s.dem",playername,curmap,time_date)
- }
- else {
- if (equal(playerteam,"TERRORIST")) {
- get_user_name(players[i],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[i],"stop")
- client_cmd(players[i],"record ^"%s.a^"",demoname)
- client_print(players[i],print_chat,"* Record a DEMO on your PC: %s",demoname)
- }
- }
- get_cvar_string("amx_hltv_proxypassword",pass,63)
- setc(snd,4,0xff)
- copy(snd[4],255,"challenge rcon")
- setc(snd[18],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[15])
- replace(rconid,255,"^n","")
- setc(snd,4,0xff)
- new hostname[256]
- 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[4],255,"rcon %s ^"%s^" record ../demo/%s^n",rconid,pass,demoname)
- send_udp_msg(address_hltv,snd)
- new authid[32],name[32]
- 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[256],snd[256]
- new rconid[13]
- new pass[64]
- new players[32],playerteam[16]
- new nbr,i
- get_players(players,nbr)
- for(i=0; i<nbr; i++) {
- get_user_team(players[i],playerteam,15)
- if ((equal(playerteam,"CT"))||(equal(playerteam,"TERRORIST"))) {
- client_cmd(players[i],"stop")
- client_print(players[i],print_chat,"* Stop Record Your DEMO.")
- }
- }
- get_cvar_string("amx_hltv_proxypassword",pass,63)
- setc(snd,4,0xff)
- copy(snd[4],255,"challenge rcon")
- setc(snd[18],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[15])
- replace(rconid,255,"^n","")
- setc(snd,4,0xff)
- format(snd[4],255,"rcon %s ^"%s^" stoprecording^n",rconid,pass)
- send_udp_msg(address_hltv,snd)
- new authid[32],name[32]
- 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[256],snd[256]
- new rconid[13]
- new pass[64]
- get_cvar_string("amx_hltv_proxypassword",pass,63)
- setc(snd,4,0xff)
- copy(snd[4],255,"challenge rcon")
- setc(snd[18],1,'^n')
-
- query_udp_msg(address_hltv,rcv,255,snd)
- copy(rconid,12,rcv[15])
- replace(rconid,255,"^n","")
- setc(snd,4,0xff)
- format(snd[4],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
- }
复制代码 |
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有账号?注个册吧
×
|