引用 | 編輯
qazwsxedc202
2011-07-17 19:47 |
樓主
▼ |
||
x0
我想作一個T一有武器在手就會自動去除的插件,根據這一篇的教學(http://bbs.mychat.to/reads.php?tid=901922)那是不是這樣 複製程式 如果(玩家是T) { 檢查玩家是否持有武器 } 如果(玩家持有武器) { 去除玩家武器 如果是,那些語法又是甚麼? 敬請各位大大賜教! x0
|
引用 | 編輯
fouury
2011-07-18 01:47 |
2樓
▲ ▼ |
= =""
樓上的public這樣寫無效吧..... 複製程式 register_forward(FM_PlayerPreThink, "fwd_PlayerPreThink", 1) //首要forward public fwd_PlayerPreThink(id) { if(cs_get_user_team(id) != CS_TEAM_CT)//如果此ID不屬於CT那對 { if(get_user_weapon(id) != CSW_KNIFE)//如果玩家持有武器不是刀子(感謝a78大提醒^^"") { strip_user_weapons(id) //噴光她的武器,完全消失0.0 fm_give_item(id, "weapon_knife")//給這噴光武器(連手榴彈一起噴)的可憐傢伙一把刀. } } } 至於檢查.. 不就是判斷玩家有沒有武器嗎???.......... -------------------------------------------------------------------------題外 總覺得這次的寫法是"大雜燴" 除了amxmodx之外...., 一下fun, 一下fakemeta, 一下又cstrike的.... 其實以上有些可以用fakemeta做到的... 但懶的寫stock... 就直接用navite上場了.. x0 |
引用 | 編輯
fouury
2011-07-18 09:19 |
4樓
▲ ▼ |
其實可以用此stock做成效果0.0 但有點麻煩.. 可以參考一下= =""
複製程式 stock drop_weapons(id, dropwhat) // dropwhat: 1 = primary weapon , 2 = secondary weapon { // Get user weapons static weapons[32], num, i, weaponid num = 0 // reset passed weapons count (bugfix) get_user_weapons(id, weapons, num) // Loop through them and drop primaries or secondaries for (i = 0; i < num; i++) { // Prevent re-indexing the array weaponid = weapons[i] if ((dropwhat == 1 && ((1<<weaponid) & PRIMARY_WEAPONS_BIT_SUM)) || (dropwhat == 2 && ((1<<weaponid) & SECONDARY_WEAPONS_BIT_SUM))) { // Get weapon name static wname[32] get_weaponname(weaponid, wname, charsmax(wname)) // Drop weapon engclient_cmd(id, "drop", wname) } } } dropwhat參數為2 則丟棄次要槍. 但是不知為啥用了此stock.. 如果運用在開局上且模式為zp(4.3) 會產生跳機的現象(就是我的0.0) 所以保險一點我就用上面的寫法...(現在自己的zp也是這樣寫法= ="") x0 |
引用 | 編輯
a7811311622
2011-07-18 12:17 |
5樓
▲ ▼ |
下面是引用 fouury 於 2011-07-18 01:47 發表的 : 為何我覺得這寫法會重複噴光武器呢…?||= = 有刀的話 get_user_weapon(id) 也會回傳 true 吧… 那這樣不就又會滿足條件繼續噴光…? x1 |
引用 | 編輯
qma
2011-07-18 15:26 |
6樓
▲ ▼ |
我的辦法是
複製程式 public plugin_init() { RegisterHam( Ham_Spawn, "player", "FwdHamPlayerSpawn", 1 ); } public FwdHamPlayerSpawn( id ) { strip_user_weapons( id ); give_item( id, "weapon_knife" ); } 再寫一個插件 複製程式 new g_msgAmmoPickup public plugin_natives() { RegisterHam(Ham_Touch, "weaponbox", "fw_TouchWeapon") RegisterHam(Ham_Touch, "armoury_entity", "fw_TouchWeapon") g_msgAmmoPickup = get_user_msgid("AmmoPickup") register_message(get_user_msgid("WeapPickup"), "message_weappickup") register_message(g_msgAmmoPickup, "message_ammopickup") } // Ham Weapon Touch Forward public fw_TouchWeapon(weapon, id) { // Not a player if (!is_user_connected(id)) return HAM_IGNORED; if( is_user_alive(id)) return HAM_SUPERCEDE; return HAM_IGNORED; } public message_weappickup(msg_id, msg_dest, msg_entity) { if (is_user_alive(msg_entity)) return PLUGIN_HANDLED; return PLUGIN_CONTINUE; } // Prevent zombies from seeing any ammo pickup icon public message_ammopickup(msg_id, msg_dest, msg_entity) { if (is_user_alive(msg_entity)) return PLUGIN_HANDLED; return PLUGIN_CONTINUE; } 雖然麻煩 但效果更佳 上面的是 沒收武器 下面的是 不能撿起武器 +在一起不就很好嗎 自己弄 include 好像是這幾個 #include <amxmodx> #include <fakemeta> #include <hamsandwich> #include <cstrike> #include < fun > x0 |
引用 | 編輯
man1996116
2011-07-19 13:02 |
7樓
▲ |
很復雜耶..
x0 |