star7335739
|
分享:
▼
x0
|
[1.6][插件] 可以幫我看一下我插件的問題嗎?補給箱內容的
|
|
|
|
#include <amxmodx> #include <fakemeta> #include <zombieplague> #include <zp_presents2> #define PLUGIN_NAME "ZP 補給箱" #define PLUGIN_VERSION "1.0" #define PLUGIN_AUTHOR "xp200798" #define fm_create_entity(%1) engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, %1)) #define OFFSET_AWM_AMMO 377 #define OFFSET_SCOUT_AMMO 378 #define OFFSET_PARA_AMMO 379 #define OFFSET_FAMAS_AMMO 380 #define OFFSET_M3_AMMO 381 #define OFFSET_USP_AMMO 382 #define OFFSET_FIVESEVEN_AMMO 383 #define OFFSET_DEAGLE_AMMO 384 #define OFFSET_P228_AMMO 385 #define OFFSET_GLOCK_AMMO 386 #define OFFSET_FLASH_AMMO 387 #define OFFSET_HE_AMMO 388 #define OFFSET_SMOKE_AMMO 389 #define OFFSET_C4_AMMO 390 // Weapon bitsums 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) public plugin_init() { register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR) } public zp_present_get(id,const name[]) { new num = random_num(1, 20) //最小為1 最大為20 隨機選取一個號碼為撿取物 可自行增加或減少 switch (num) { case 1: // 範例 編號 1 { drop_weapons(id, 1) // 丟棄槍枝 1為主槍 2為小槍 fm_give_item(id, "weapon_mp5navy") // 撿取槍枝為 MP5 fm_give_item(id, "ammo_9mm") // 子彈類型 9mm fm_give_item(id, "ammo_9mm") fm_give_item(id, "ammo_9mm") fm_give_item(id, "ammo_9mm") client_print(0, print_center, "%s 獲得了雙持PM7A1", name) // 撿取後的提示 } case 2: { drop_weapons(id, 1) fm_give_item(id, "weapon_aug") fm_give_item(id, "ammo_556nato") fm_give_item(id, "ammo_556nato") fm_give_item(id, "ammo_556nato") fm_give_item(id, "ammo_556nato") client_print(0, print_center, "%s 獲得了領航者F2000", name) } case 3: { drop_weapons(id, 1) fm_give_item(id, "weapon_ak47") fm_give_item(id, "ammo_762nato") fm_give_item(id, "ammo_762nato") fm_give_item(id, "ammo_762nato") fm_give_item(id, "ammo_762nato") client_print(0, print_center, "%s 獲得了CV-47 60R", name) } case 4: { drop_weapons(id, 1) fm_give_item(id, "weapon_m3") fm_give_item(id, "ammo_buckshot") fm_give_item(id, "ammo_buckshot") fm_give_item(id, "ammo_buckshot") fm_give_item(id, "ammo_buckshot") client_print(0, print_center, "%s 獲得了閃靈獵手", name) } case 5: { for (new i = 1 ; i < 5; i++) { fm_give_item(id, "ammo_357sig") fm_give_item(id, "ammo_762nato") fm_give_item(id, "ammo_buckshot") fm_give_item(id, "ammo_45acp") fm_give_item(id, "ammo_556nato") fm_give_item(id, "ammo_9mm") fm_give_item(id, "ammo_57mm") fm_give_item(id, "ammo_338magnum") fm_give_item(id, "ammo_556natobox") fm_give_item(id, "ammo_50ae") } client_print(0, print_center, "%s 撿到了一些彈夾", name) } case 6: { new n_currentFB = fm_get_user_bpammo(id, CSW_FLASHBANG) if (n_currentFB <= 0) fm_give_item(id, "weapon_flashbang") fm_set_user_bpammo(id, CSW_FLASHBANG, n_currentFB + 2) // 數字2為撿到冰凍彈的數量 client_print(0, print_center, "%s 撿到2顆冰凍彈", name) } case 7: { new n_currentFB = fm_get_user_bpammo(id, CSW_HEGRENADE) if (n_currentFB <= 0) fm_give_item(id, "weapon_higrenhand") fm_set_user_bpammo(id, CSW_HEGRENADE, n_currentFB + 2) client_print(0, print_center, "%s 撿到2顆手榴彈", name) } case 8: { new n_currentFB = fm_get_user_bpammo(id, CSW_SMOKEGRENADE) if (n_currentFB <= 0) fm_give_item(id, "weapon_smokegrenade") fm_set_user_bpammo(id, CSW_SMOKEGRENADE, n_currentFB + 1) client_print(0, print_center, "%s 撿到1顆照明彈", name) } case 9: { drop_weapons(id, 1) fm_give_item(id, "weapon_awp") fm_give_item(id, "ammo_338magnum") fm_give_item(id, "ammo_338magnum") fm_give_item(id, "ammo_338magnum") fm_give_item(id, "ammo_338magnum") client_print(0, print_center, "%s 獲得了鷹眼M200", name) } case 10: { zp_set_user_ammo_packs(id, zp_get_user_ammo_packs(id) + 1) // 數字1為撿取時給予的彈藥包數量 client_print(0, print_center, "%s 獲得了1個彈藥包", name) } case 11: { zp_set_user_ammo_packs(id, zp_get_user_ammo_packs(id) + 2) client_print(0, print_center, "%s 獲得了2個彈藥包", name) } case 12: { zp_set_user_ammo_packs(id, zp_get_user_ammo_packs(id) + 2) client_print(0, print_center, "%s 獲得了2個彈藥包", name) } case 13: { zp_set_user_ammo_packs(id, zp_get_user_ammo_packs(id) + 3) client_print(0, print_center, "%s 撿到了3個彈藥包", name) } case 14: { zp_set_user_ammo_packs(id, zp_get_user_ammo_packs(id) + 4) client_print(0, print_center, "%s 撿到了4個彈藥包", name) } case 15: { drop_weapons(id, 1) fm_give_item(id, "weapon_mp5navy") fm_give_item(id, "ammo_9mm") fm_give_item(id, "ammo_9mm") fm_give_item(id, "ammo_9mm") fm_give_item(id, "ammo_9mm") client_print(0, print_center, "%s 獲得了雙持PM7A1", name) } case 16: { drop_weapons(id, 1) fm_give_item(id, "weapon_ak47") fm_give_item(id, "ammo_762nato") fm_give_item(id, "ammo_762nato") fm_give_item(id, "ammo_762nato") fm_give_item(id, "ammo_762nato") client_print(0, print_center, "%s 獲得了CV-47 60R", name) } case 17: { drop_weapons(id, 2) fm_give_item(id, "weapon_elite") fm_give_item(id, "ammo_9mm") fm_give_item(id, "ammo_9mm") fm_give_item(id, "ammo_9mm") fm_give_item(id, "ammo_9mm") client_print(0, print_center, "%s 獲得了銀狼雙襲", name) } case 18: { drop_weapons(id, 2) fm_give_item(id, "weapon_elite") fm_give_item(id, "ammo_9mm") fm_give_item(id, "ammo_9mm") fm_give_item(id, "ammo_9mm") fm_give_item(id, "ammo_9mm") client_print(0, print_center, "%s 獲得了銀狼雙襲", name) } case 20: { drop_weapons(id, 1) fm_give_item(id, "weapon_awp") fm_give_item(id, "ammo_338magnum") fm_give_item(id, "ammo_338magnum") fm_give_item(id, "ammo_338magnum") fm_give_item(id, "ammo_338magnum") client_print(0, print_center, "%s 獲得了鷹眼M200", name) } default: //預設 { client_print(0, print_center, "%s 真是倒楣,箱子裡沒有任何東西", name) } } } stock fm_give_item(index, const item[]) { if (!equal(item, "weapon_", 7) && !equal(item, "ammo_", 5) && !equal(item, "item_", 5) && !equal(item, "tf_weapon_", 10)) return 0; new ent = fm_create_entity(item); if (!pev_valid(ent)) return 0; new Float:origin[3]; pev(index, pev_origin, origin); set_pev(ent, pev_origin, origin); set_pev(ent, pev_spawnflags, pev(ent, pev_spawnflags) | SF_NORESPAWN); dllfunc(DLLFunc_Spawn, ent); new save = pev(ent, pev_solid); dllfunc(DLLFunc_Touch, ent, index); if (pev(ent, pev_solid) != save) return ent; engfunc(EngFunc_RemoveEntity, ent); return -1; } stock fm_set_user_bpammo(index, weapon, amount) { new offset; switch(weapon) { case CSW_AWP: offset = OFFSET_AWM_AMMO; case CSW_SCOUT,CSW_AK47,CSW_G3SG1: offset = OFFSET_SCOUT_AMMO; case CSW_M249: offset = OFFSET_PARA_AMMO; case CSW_M4A1,CSW_FAMAS,CSW_AUG,CSW_SG550,CSW_GALIL,CSW_SG552: offset = OFFSET_FAMAS_AMMO; case CSW_M3,CSW_XM1014: offset = OFFSET_M3_AMMO; case CSW_USP,CSW_UMP45,CSW_MAC10: offset = OFFSET_USP_AMMO; case CSW_FIVESEVEN,CSW_P90: offset = OFFSET_FIVESEVEN_AMMO; case CSW_DEAGLE: offset = OFFSET_DEAGLE_AMMO; case CSW_P228: offset = OFFSET_P228_AMMO; case CSW_GLOCK18,CSW_MP5NAVY,CSW_TMP,CSW_ELITE: offset = OFFSET_GLOCK_AMMO; case CSW_FLASHBANG: offset = OFFSET_FLASH_AMMO; case CSW_HEGRENADE: offset = OFFSET_HE_AMMO; case CSW_SMOKEGRENADE: offset = OFFSET_SMOKE_AMMO; case CSW_C4: offset = OFFSET_C4_AMMO; default: { new invalidMsg[20 + 7]; formatex(invalidMsg,20 + 6,"Invalid weapon id %d",weapon); set_fail_state(invalidMsg); return 0; } } set_pdata_int(index,offset,amount); return 1; } stock fm_get_user_bpammo(index, weapon) { new offset; switch(weapon) { case CSW_AWP: offset = OFFSET_AWM_AMMO; case CSW_SCOUT,CSW_AK47,CSW_G3SG1: offset = OFFSET_SCOUT_AMMO; case CSW_M249: offset = OFFSET_PARA_AMMO; case CSW_M4A1,CSW_FAMAS,CSW_AUG,CSW_SG550,CSW_GALIL,CSW_SG552: offset = OFFSET_FAMAS_AMMO; case CSW_M3,CSW_XM1014: offset = OFFSET_M3_AMMO; case CSW_USP,CSW_UMP45,CSW_MAC10: offset = OFFSET_USP_AMMO; case CSW_FIVESEVEN,CSW_P90: offset = OFFSET_FIVESEVEN_AMMO; case CSW_DEAGLE: offset = OFFSET_DEAGLE_AMMO; case CSW_P228: offset = OFFSET_P228_AMMO; case CSW_GLOCK18,CSW_MP5NAVY,CSW_TMP,CSW_ELITE: offset = OFFSET_GLOCK_AMMO; case CSW_FLASHBANG: offset = OFFSET_FLASH_AMMO; case CSW_HEGRENADE: offset = OFFSET_HE_AMMO; case CSW_SMOKEGRENADE: offset = OFFSET_SMOKE_AMMO; case CSW_C4: offset = OFFSET_C4_AMMO; default: { new invalidMsg[20 + 7]; formatex(invalidMsg,20 + 6,"Invalid weapon id %d",weapon); set_fail_state(invalidMsg); return 0; } } return get_pdata_int(index,offset); } 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 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) } } }
為什麼明明ak子彈上限是300
可是從補給箱檢起來只有90
mp5的上限是320
可是撿起來只有120
為什麼用買得跟用撿得不一樣
fm_give_item(id, "ammo_9mm")
像這種東西加在多也沒用
zombie_plague40裡的子彈上限
明明沒有那麼少
誰可以告訴我為什麼?
並且教我怎麼做?
我把檔案丟上來
|
|
|
|
|
|
|
x0
[樓 主]
From:鳳信有線 | Posted:2010-07-10 15:58 |
|
|
史來姆
|
分享:
▲
▼
複製程式
fm_set_user_bpammo(id, CSW_GLOCK18, 200)
fm_set_user_bpammo(id, CSW_USP, 200)
fm_set_user_bpammo(id, CSW_DEAGLE, 70)
fm_set_user_bpammo(id, CSW_P228, 200)
fm_set_user_bpammo(id, CSW_FIVESEVEN, 200)
fm_set_user_bpammo(id, CSW_P90, 160)
fm_set_user_bpammo(id, CSW_M3, 64)
fm_set_user_bpammo(id, CSW_XM1014, 64)
fm_set_user_bpammo(id, CSW_MP5NAVY, 200)
fm_set_user_bpammo(id, CSW_TMP, 200)
fm_set_user_bpammo(id, CSW_MAC10, 160)
fm_set_user_bpammo(id, CSW_UMP45, 200)
fm_set_user_bpammo(id, CSW_FAMAS, 180)
fm_set_user_bpammo(id, CSW_GALIL, 180)
fm_set_user_bpammo(id, CSW_AK47, 180)
fm_set_user_bpammo(id, CSW_SG552, 180)
fm_set_user_bpammo(id, CSW_M4A1, 180)
fm_set_user_bpammo(id, CSW_AUG, 180)
fm_set_user_bpammo(id, CSW_SCOUT, 180)
fm_set_user_bpammo(id, CSW_AWP, 60)
fm_set_user_bpammo(id, CSW_G3SG1, 180)
fm_set_user_bpammo(id, CSW_SG550, 180)
fm_set_user_bpammo(id, CSW_M249, 200)
fm_set_user_bpammo(id, CSW_ELITE, 200) 只要在fm_give_item(id, "ammo_XXX)之後加上這些就行了,CSW_XXX 之後的數字便是後備彈的彈數 希望幫到你吧
|
|
x0
[1 樓]
From:香港網上行 | Posted:2010-07-12 22:49 |
|
|
皮洨歪
|
分享:
▲
▼
首先....找到#include <fakemeta> 再下方 增加 複製程式
舉例 更改 mp5 撿取時 附加的備用彈夾為 N彈夾的話 case 1: { drop_weapons(id, 1) fm_give_item(id, "weapon_mp5navy") fm_give_item(id, "ammo_9mm") fm_give_item(id, "ammo_9mm") fm_give_item(id, "ammo_9mm") fm_give_item(id, "ammo_9mm") client_print(0, print_center, "%s 撿到一把 MP5", name) }
更改為 複製程式
case 1:
{
drop_weapons(id, 1)
fm_set_user_bpammo(id, CSW_MP5NAVY, 200)
client_print(0, print_center, "%s 撿到一把 MP5", name)
}
CSW_MP5NAVY 部份為槍枝名稱 , 200部分為 撿取時附加的備用彈夾為 N彈夾 後面更改 以此類推...
|
|
x0
[2 樓]
From:台灣中華電信 | Posted:2010-07-12 23:56 |
|
|
離之彥
|
分享:
▲
▼
...這個我之前問過皮大了...只不過是私下問@@"
#include <cstrike> 這個模塊不能少...
還有一點就是...通用的子彈... 例: scout輕狙的子彈是7.62 你把scout的子彈量設定成200發 然後同7.62子彈的ak47設定成180發 然而你從補給箱撿到的ak47會是跟scout一樣200發...
那是因為他們的通聯性... 去看一下皮大補給箱武器原碼的這一段你就會明白了
case CSW_AWP: offset = OFFSET_AWM_AMMO; case CSW_SCOUT,CSW_AK47,CSW_G3SG1: offset = OFFSET_SCOUT_AMMO; case CSW_M249: offset = OFFSET_PARA_AMMO; case CSW_M4A1,CSW_FAMAS,CSW_AUG,CSW_SG550,CSW_GALIL,CSW_SG552: offset = OFFSET_FAMAS_AMMO; case CSW_M3,CSW_XM1014: offset = OFFSET_M3_AMMO; case CSW_USP,CSW_UMP45: offset = OFFSET_USP_AMMO; case CSW_FIVESEVEN,CSW_P90: offset = OFFSET_FIVESEVEN_AMMO; case CSW_DEAGLE: offset = OFFSET_DEAGLE_AMMO; case CSW_P228: offset = OFFSET_P228_AMMO; case CSW_GLOCK18,CSW_MP5NAVY,CSW_TMP,CSW_ELITE: offset = OFFSET_GLOCK_AMMO; case CSW_FLASHBANG: offset = OFFSET_FLASH_AMMO; case CSW_HEGRENADE: offset = OFFSET_HE_AMMO; case CSW_SMOKEGRENADE: offset = OFFSET_SMOKE_AMMO; case CSW_C4: offset = OFFSET_C4_AMMO;
他是以後面OFFSET_XXX_AMMO (XXX為武器名稱) 這個槍的性質定義其他同性質槍的子彈量...
case CSW_SCOUT,CSW_AK47,CSW_G3SG1: offset = OFFSET_SCOUT_AMMO; 剛剛說的就是這一句....是等於scout的子彈性質...
就算改的也不會變歐... 可能還會轉不成...
所以要怎麼分配就要看你自己想辦法了...
[ 此文章被離之彥在2010-08-13 08:29重新編輯 ]
|
|
x0
[8 樓]
From:台灣中華電信 | Posted:2010-08-13 08:22 |
|
|
|