搜索
查看: 3212|回复: 3

如何去除玩家武器

[复制链接]
发表于 2007-3-13 16:55:13 | 显示全部楼层 |阅读模式 来自 山东淄博
我的思路是
首先得到武器的entity id,然后利用remove_entity函数取掉武器

但是遇到一个问题,如果武器是被扔到地上的,那么remove_entity可以成功执行
但如果武器还在玩家身上,那么执行remove_entity的结果是服务器直接报错关闭~

请达人指教!
发表于 2007-3-13 17:55:28 | 显示全部楼层 来自 广东深圳

回复: 如何去除玩家武器

[php]
// only weapon index or its name can be passed, if neither is passed then the current gun will be stripped
stock bool:fm_strip_user_gun(index, wid = 0, const wname[] = "") {
   new ent_class[32]
   if (!wid && wname[0])
      copy(ent_class, sizeof ent_class - 1, wname)
   else {
      new weapon = wid, clip, ammo
      if (!weapon && !(weapon = get_user_weapon(index, clip, ammo)))
         return false
      
      get_weaponname(weapon, ent_class, sizeof ent_class - 1)
   }
   new ent_weap = fm_find_ent_by_owner(-1, ent_class, index)
   if (!ent_weap)
      return false
   engclient_cmd(index, "drop", ent_class)
   new ent_box = pev(ent_weap, pev_owner)
   if (!ent_box || ent_box == index)
      return false
   dllfunc(DLLFunc_Think, ent_box)
   return true
}
[/php]

copy from  VEN's fakemeta_util_stocks.inc

使用 fakemeta 的一个例子,去除制定武器。
回复

使用道具 举报

发表于 2011-1-14 00:48:53 | 显示全部楼层 来自 上海
没有用呀!
回复

使用道具 举报

发表于 2011-6-27 16:13:12 | 显示全部楼层 来自 湖南
可以的。。。
回复

使用道具 举报

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

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