下面是引用 岳岳 於 2014-01-19 02:45 發表的 ZP狙擊手模式問題:
要怎麼讓倖存者跟狙擊手不能丟槍?...每次打字鍵沒按到結果以為有打字不小心按個G就扔掉在也減不回來然後成了一名廢物= =
然後再來是怎麼讓倖存者跟狙擊手不會掉槍?每次槍一震掉馬上又變回了廢物= =....
這兩個問題無法解決其實就等於沒這兩個模式= =|||
.......
是那段沒錯…
不過有時候槍被「震掉」不是ZP主插件的問題…
而是執行「震掉」這動作的插件沒做判斷…
例如我在別的插件隨便執行「engclient_cmd(id, "drop", "weapon_m249")」…
只要手上拿M249的不論是不是倖存者全都得丟槍…
除非用<hamsandwich>的 Ham_CS_Item_CanDrop 去阻止…
例如:
複製程式
// Weapons calssname
new const weapon_classname[][] = { "", "weapon_p228", "", "weapon_scout", "weapon_hegrenade", "weapon_xm1014", "weapon_c4", "weapon_mac10",
"weapon_aug", "weapon_smokegrenade", "weapon_elite", "weapon_fiveseven", "weapon_ump45", "weapon_sg550", "weapon_galil", "weapon_famas",
"weapon_usp", "weapon_glock18", "weapon_awp", "weapon_mp5navy", "weapon_m249", "weapon_m3", "weapon_m4a1",
"weapon_tmp", "weapon_g3sg1", "weapon_flashbang", "weapon_deagle", "weapon_sg552", "weapon_ak47", "weapon_knife", "weapon_p90" }
public plugin_init()
{
for (new i = 0; i < sizeof weapon_classname; i++) if (strlen(weapon_classname[i]) != 0)
{
RegisterHam(Ham_CS_Item_CanDrop, weapon_classname[i], "fw_Item_CanDrop")
}
}
public fw_Item_CanDrop(weapon)
{
static id; id = pev(weapon, pev_owner)
if (is_user_alive(id) && zp_get_user_survivor(id))
{
SetHamReturnInteger(0)
return HAM_SUPERCEDE;
}
return HAM_IGNORED;
}
被這樣設定過的倖存者…只要還活著…武器都會像小刀或手榴彈一樣無法丟棄…
這樣誰都別想讓我丟掉武器啦~
當然遇到 strip_user_weapons 還是得哭哭…