補給箱丟武器指令教學

Home Home
引用 | 編輯 弒血
2010-01-23 21:00
樓主
推文 x3
今天我要教大家的是補給箱武器丟掉指令,也就是設定補給箱撿取後,會把手上的武器丟棄,撿取補給箱內的武器指令。

我先打上武器丟棄指令;

drop_primary_weapons(id)  //丟棄主要武器指令
drop_secondary_weapons(id)  //丟棄小槍武器指令
drop_current_weapon(id)  //丟棄手上拿的槍指令

以上紅色的那三行是武器的丟棄指令。

請大家在dtgift_weapons的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
  
  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)
 }
}


stock drop_secondary_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
  
  if ((1<<weaponid) & SECONDARY_WEAPONS_BIT_SUM)
  {
   static wname[32]
   get_weaponname(weaponid, wname, sizeof wname - 1)
   engclient_cmd(id, "drop", wname)
  }
 }
}



我先示範輸入指令:

public get_sg552( id){

        drop_primary_weapons(id) ←這個是主槍丟棄指令
        give_item( id, "weapon_sg552");  
        give_item( id, "ammo_556nato");
        give_item( id, "ammo_556nato");
        give_item( id, "ammo_556nato");


上方的紅色代表是主武器丟棄指令:

public get_de( id){

       drop_secondary_weapons(id)  ←這個是小槍丟棄指令
       give_item( id, "weapon_deagle");
       give_item( id, "ammo_50ae");
       give_item( id, "ammo_50ae");
       give_item( id, "ammo_50ae");
       give_item( id, "ammo_50ae");


這個紅色代表是小槍丟棄指令。

記得要把指令排在補給箱,武器前面別亂排,要不然撿到後會亂丟

要打指令前,記得要分清楚主槍小槍。

重點:您的回覆或是推薦是我發教學的動力來源表情

獻花 x1
引用 | 編輯 66976697
2010-01-23 21:22
1樓
  
我沒有dtgift_weapons@@
和物錯

獻花 x0
引用 | 編輯 夜魂
2010-01-23 21:23
2樓
  
不錯 又是個好教學
還有續集媽??

獻花 x0
引用 | 編輯 弒血
2010-01-23 21:26
3樓
  
沒有dtgift_weapons檔的SMA,就沒辦法改補給箱的指令。 表情

獻花 x0
引用 | 編輯 supermanhugo
2010-01-23 22:20
4樓
  
下面是引用 s8720419 於 2010-01-23 21:26 發表的 : 到引言文
沒有dtgift_weapons檔的SMA,就沒辦法改補給箱的指令。 表情

自己寫一個就好了表情

獻花 x0
引用 | 編輯 chapecs
2010-01-24 08:02
5樓
  
有可以設定補給箱的武器教學媽 表情

獻花 x0
引用 | 編輯 弒血
2010-01-24 12:08
6樓
  
有呀~如果你要的話 可以跟我說,我在發教學

獻花 x0
引用 | 編輯 chapecs
2010-01-25 06:24
7樓
  
下面是引用 s8720419 於 2010-01-24 12:08 發表的 : 到引言文
有呀~如果你要的話 可以跟我說,我在發教學

我要~~~

建議你付上補給箱的載點
這樣之後進來的新人才不會ˋ看說覺得
這是甚麼東西 看不懂這樣表情

獻花 x0
引用 | 編輯 a7811311622
2010-01-25 09:19
8樓
  
我怎麼覺得內容好像以前我在提問區回答的答案…
不過至少這內容放教學區總比放提問區好多了…也不太可能有人跑到提問區找教學…

獻花 x0
引用 | 編輯 弒血
2010-01-25 16:41
9樓
  
我不會放載點,我還是個新手,只是還在研究怎改寫插件。

我只發教學,至於載點在(插件區) 就找的到了。 表情

獻花 x0
引用 | 編輯 M1665978
2010-02-13 11:07
10樓
  
呵呵加油

獻花 x0
引用 | 編輯 092124895
2010-03-12 20:46
11樓
  
回文了

獻花 x0
引用 | 編輯 calove00
2010-03-13 22:44
12樓
  
樓主你不如用SMA排好位置....

這樣可以清析一點 表情

獻花 x0
引用 | 編輯 dennis888
2010-03-19 08:24
13樓
  
多謝你的分享,不過我見到你set 子彈量要
    drop_secondary_weapons(id)
    give_item( id, "weapon_deagle");
    give_item( id, "ammo_50ae");
    give_item( id, "ammo_50ae");
    give_item( id, "ammo_50ae");
    give_item( id, "ammo_50ae");

可以
#include <amxmodx>
#include <fakemeta>
#include <zombieplague>
#include <zp_presents2>
#include <cstrike>

打左#include <cstrike> 呢個指令
你可以
    drop_secondary_weapons(id)
    give_item( id, "weapon_deagle");
    cs_set_user_bpammo(id, CSW_DEAGLE, 70);
70 就係子彈量數目
希望幫到你 (好似有人講過)

在此聲明,我唔係抄人

獻花 x0
引用 | 編輯 andyhui
2010-03-21 16:12
14樓
  
好像很漂亮

獻花 x0
引用 | 編輯 andyhui
2010-03-21 16:13
15樓
  
上面打錯,是好複雜

獻花 x0
引用 | 編輯 皇帝企鵝
2010-07-19 16:29
16樓
  
我拿到補給箱武器就換掉啦

獻花 x0
引用 | 編輯 弒血
2010-07-19 22:04
17樓
  
請看文 表情
這是丟武器教學 表情

獻花 x0
引用 | 編輯 IGLA_VIP
2011-08-08 14:25
18樓
  
我不明白是什麼呢?

獻花 x0
引用 | 編輯 S3xTy
2020-12-20 08:02
19樓
  
回 覆 鎖 定 :

  此回覆已被鎖定,只有『管理員及回覆者』看的到 !!!



獻花 x0