下面是引用 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)"即可。
(如果轉檔時發生錯誤再說…我怕我又少講什麼了…
)