搜索
查看: 2293|回复: 3

Voice_Comm_Control.amxx 插件报错!谁来帮忙看看BUG日志

[复制链接]
发表于 2008-5-14 16:15:27 | 显示全部楼层 |阅读模式 来自 中国–福建–三明
L 05/12/2008 - 23:54:18: Start of error session.
L 05/12/2008 - 23:54:18: Info (map "de_inferno") (logfile "error_051208.log")
L 05/12/2008 - 23:54:18: [ENGINE] Invalid player 20
L 05/12/2008 - 23:54:18: [AMXX] Displaying debug trace (plugin "Voice_Comm_Control.amxx")
L 05/12/2008 - 23:54:18: [AMXX] Run time error 10: native error (native "set_speak")
L 05/12/2008 - 23:54:18: [AMXX]    [0] Voice_Comm_Control.sma::eventResetHud (line 58)

==================以下是代码请帮忙修改=========================


/*new g_teamsNames[2][] = {"TERRORIST","CT"}*/
/*Voice Comm Control
Control dead player can voice comm each other, but alive player can not hear them.
*/
public plugin_init(){
register_plugin("Voice Comm Control","0.0.1","Zhao")
register_event("ResetHUD", "eventResetHud", "be")
register_event("DeathMsg","eDeathMsg","a")
register_concmd("amx_mute","amx_mute_player",ADMIN_VOTE,"playername --Mute players Microphone")
register_concmd("amx_unmute","amx_mute_player",ADMIN_VOTE,"playername --Unmute player's Microphone")
set_task(15.0,"alltalkoff")
}
public alltalkoff(){
set_cvar_num("sv_alltalk",0)
}
public amx_mute_player(id,level,cid){
new playername[33]
if (!cmd_access(id,level,cid,2))
  return PLUGIN_HANDLED
//new argc = read_argc()
new cmdname[33]
read_argv(0,cmdname,32)
read_argv(1,playername,32)
new player = cmd_target(id,playername,1)
if (!player) return PLUGIN_HANDLED
new imname[32],name2[32]
get_user_name(player,imname,31)
get_user_name(id,name2,31)

if(equal(cmdname,"amx_mute")){
  set_speak(player,SPEAK_MUTED)
  console_print(id,"%s is Muted",imname)
  log_amx("Mute:%s Muted %s microphone",name2,imname)
  }else{
  set_speak(player,SPEAK_NORMAL)
  console_print(id,"%s is Unmuted",imname)
  log_amx("Mute:%s unmuted %s microphone",name2,imname)
}

return PLUGIN_HANDLED
}
public client_putinserver(id){
set_speak(id,SPEAK_LISTENALL)
}
public eventResetHud(id){
new clmsg[513]
set_speak(id,SPEAK_NORMAL)
format(clmsg,512,"^x04[amxx]^x03现在语音通话被限制在队友之间")
message_begin(MSG_ONE, get_user_msgid("SayText"), {0,0,0}, id)
write_byte(id)
write_string(clmsg)
message_end()
}
public eDeathMsg(){
new victim=read_data(2)
new clmsg[513]
set_speak(victim,SPEAK_LISTENALL)
remove_voice_from_alive(victim)
format(clmsg,512,"^x04[amxx]^x01牺牲了,可以听所有玩家语音通话,但活的队友听不到你的声音")
message_begin(MSG_ONE, get_user_msgid("SayText"), {0,0,0}, victim)
write_byte(victim)
write_string(clmsg)
message_end()
}
发表于 2008-5-14 16:39:19 | 显示全部楼层 来自 中国–北京–北京–海淀区

回复: Voice_Comm_Control.amxx 插件报错!谁来帮忙看看BUG日志

run time error 10 不是什么严重的bug,通常是你要执行的参数的对象不存在。
具体到这个插件里就是set_speak(id, _); 这个id不在服务器内。
解决此办法的最好方法就是在前面加 if(is_user_connected(id))
如果是对entity操作就需要在前面加 if(pev_valid(id))
说此bug不严重是因为在调用这个native时,amxx或子模块会检查 entity是否存在,不存在就报错run time error 10并停止执行函数,所以不加你不加检查也是没事儿的。
回复

使用道具 举报

 楼主| 发表于 2008-5-14 16:51:30 | 显示全部楼层 来自 中国–福建–三明

回复: Voice_Comm_Control.amxx 插件报错!谁来帮忙看看BUG日志

谢谢 JIM_YANG 的解答!特此感谢.
回复

使用道具 举报

发表于 2008-5-14 16:58:04 | 显示全部楼层 来自 中国–浙江–嘉兴–海宁市

回复: Voice_Comm_Control.amxx 插件报错!谁来帮忙看看BUG日志

专业!!!!!!!!!!!!!!!
回复

使用道具 举报

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

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