|
发表于 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 的一个例子,去除制定武器。 |
|