搜索
查看: 2380|回复: 2

关于"index out of bounds"的问题

[复制链接]
发表于 2008-2-13 21:31:30 | 显示全部楼层 |阅读模式 来自 中国–广西–梧州
今天我测试火箭筒插件的时候发现了个问题:玩家连续购买火箭筒后,再把火箭筒扔向同一个方向,并且扔两次以上,包括两次,(即购买一支后扔掉,然后再购买一支,朝同一方向再扔掉),控制台就会马上出现debug出错报告,屡试不爽.出错信息如下:
L 09/25/2007 - 19:25:21: [AMXX] Displaying debug trace (plugin "bazooka.amxx")
L 09/25/2007 - 19:25:21: [AMXX] Run time error 4: index out of bounds
L 09/25/2007 - 19:25:21: [AMXX] [0] bazooka.sma: fn_touch(line 939)
L 09/25/2007 - 19:25:21: [AMXX] Displaying debug trace (plugin "bazooka.amxx")
L 09/25/2007 - 19:25:21: [AMXX] Run time error 4: index out of bounds
L 09/25/2007 - 19:25:21: [AMXX] [0] bazooka.sma: fn_touch (line 939)
L 09/25/2007 - 19:25:21: [AMXX] Displaying debug trace (plugin "bazooka.amxx")
L 09/25/2007 - 19:25:21: [AMXX] Run time error 4: index out of bounds
L 09/25/2007 - 19:25:21: [AMXX] [0] bazooka.sma: fn_touch (line 939)
L 09/25/2007 - 19:25:21: [AMXX] Displaying debug trace (plugin "bazooka.amxx")
L 09/25/2007 - 19:25:21: [AMXX] Run time error 4: index out of bounds
L 09/25/2007 - 19:25:21: [AMXX] [0] bazooka.sma: fn_touch (line 939)
麻烦高手们看看到底是什么原因?
发表于 2008-2-13 22:51:13 | 显示全部楼层 来自 中国–广东–惠州

回复: 关于"index out of bounds"的问题

在这少了个判断,增加两行代码试下.
  1. public pfn_touch (toucher, touched) {
  2. new ClassName1[32]
  3. new ClassName2[32]
  4. if(!is_valid_ent(toucher))
  5.   return PLUGIN_CONTINUE
  6. if (is_valid_ent(toucher))
  7.   entity_get_string(toucher, EV_SZ_classname, ClassName1, 31)
  8. if (is_valid_ent(touched))
  9.   entity_get_string(touched, EV_SZ_classname, ClassName2, 31)
  10. if(equal(ClassName1, "rpglancher")&&equal(ClassName2, "rpglancher")) //增加行
  11.   return PLUGIN_CONTINUE  //增加行
  12. if (equal(ClassName1, "rpgrocket")) {
复制代码
回复

使用道具 举报

 楼主| 发表于 2008-2-14 14:07:23 | 显示全部楼层 来自 中国–广西–梧州

回复: 关于"index out of bounds"的问题

谢谢zwfgdlc楼主!问题解决了!
回复

使用道具 举报

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

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