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 |
|
|
|