下面是引用 AykinDalike 于 2009-09-29 23:17 发表的 :
换个方式问好了...
有人知道 把武器『丢弃』的指令码吗?
谢谢!!
以下内容是截取于
yymmychat大大的「无后座力M4+AK」插件
如果你会新增SMA档的内容的话:
须复制的内容:
复制程式
const PRIMARY_WEAPONS_BIT_SUM = (1<<CSW_SCOUT)|(1<<CSW_XM1014)|(1<<CSW_MAC10)|(1<<CSW_AUG)|(1<<CSW_UMP45)|(1<<CSW_SG550)|
(1<<CSW_GALIL)|(1<<CSW_FAMAS)|(1<<CSW_AWP)|(1<<CSW_MP5NAVY)|(1<<CSW_M249)|(1<<CSW_M3)|(1<<CSW_M4A1)|(1<<CSW_TMP)|
(1<<CSW_G3SG1)|(1<<CSW_SG552)|(1<<CSW_AK47)|(1<<CSW_P90)
const SECONDARY_WEAPONS_BIT_SUM = (1<<CSW_P228)|(1<<CSW_ELITE)|(1<<CSW_FIVESEVEN)|(1<<CSW_USP)|(1<<CSW_GLOCK18)|(1<<CSW_DEAGLE)
以下内容是「丢弃主要武器」:
复制程式
stock drop_primary_weapons(id)
{
// Get user weapons
static weapons[32], num, i, weaponid
num = 0 // reset passed weapons count (bugfix)
get_user_weapons(id, weapons, num)
for (i = 0; i < num; i++)
{
weaponid = weapons[i]
if ((1<<weaponid) & PRIMARY_WEAPONS_BIT_SUM)
{
static wname[32]
get_weaponname(weaponid, wname, sizeof wname - 1)
engclient_cmd(id, "drop", wname)
}
}
}
以下内容是「丢弃目前手上武器」:
复制程式
stock drop_current_weapon(id)
{
static weapon_id, clip, ammo
weapon_id = get_user_weapon(id, clip, ammo)
if (((1<<weapon_id) & PRIMARY_WEAPONS_BIT_SUM) || ((1<<weapon_id) & SECONDARY_WEAPONS_BIT_SUM))
{
static weapon_name[32]
get_weaponname(weapon_id, weapon_name, sizeof weapon_name - 1)
engclient_cmd(id, "drop", weapon_name)
}
}
如果要使用指令的话,只是在假设好的条件内加入
"drop_primary_weapons(id)"或"drop_current_weapon(id)"即可。
(如果转档时发生错误再说…我怕我又少讲什么了…
)