playboi
|
分享:
▼
x0
|
[1.6][插件] 這個SMA是哪裡有問題??
抱歉不會貼圖~~
所以就只好這樣放了~~
問題:
自從改了fm_get_user_bpammo(id, CSW_P228, 130)................
就是獲得的子彈數量~~
就便這樣了~~
謝謝摟~
-------------
#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, 16) //最小為1 最大為20 隨機取得 可自行增加與減少 switch (num) { case 1: { drop_weapons(id, 2) fm_give_item(id, "weapon_p228") fm_give_item(id, "ammo_357sig") fm_get_user_bpammo(id, CSW_P228, 130) client_print(0, print_center, "%s 撿到一把 P228 <次要武器>", name) } case 2: { drop_weapons(id, 2) fm_give_item(id, "weapon_fiveseven") fm_give_item(id, "ammo_57mm") fm_get_user_bpammo(id, CSW_FIVESEVEN, 200) client_print(0, print_center, "%s 撿到一把 FIVESEVEN <次要武器>", name) } case 3: { drop_weapons(id, 2) fm_give_item(id, "weapon_deagle") fm_give_item(id, "ammo_50ae") fm_get_user_bpammo(id, CSW_DEAGLE, 70) client_print(0, print_center, "%s 撿到一把 DEAGLE <次要武器>", name) } case 4: { drop_weapons(id, 1) fm_give_item(id, "weapon_mp5navy") fm_give_item(id, "ammo_9mm") fm_get_user_bpammo(id, CSW_MP5NAVY, 150) client_print(0, print_center, "%s 撿到一把 MP5 <主要武器>", name) } case 5: { drop_weapons(id, 1) fm_give_item(id, "weapon_tmp") fm_give_item(id, "ammo_9mm") fm_get_user_bpammo(id, CSW_TMP, 150) client_print(0, print_center, "%s 撿到一把 TMP <主要武器>", name) } case 6: { drop_weapons(id, 1) fm_give_item(id, "weapon_mac10") fm_give_item(id, "ammo_45acp") fm_get_user_bpammo(id, CSW_MAC10, 150) client_print(0, print_center, "%s 撿到一把 MAC10 <主要武器>", name) } case 7: { drop_weapons(id, 1) fm_give_item(id, "weapon_ump45") fm_give_item(id, "ammo_45acp") fm_get_user_bpammo(id, CSW_UMP45, 125) client_print(0, print_center, "%s 撿到一把 UMP45 <主要武器>", name) } case 8: { drop_weapons(id, 1) fm_give_item(id, "weapon_p90") fm_give_item(id, "ammo_57mm") fm_get_user_bpammo(id, CSW_P90, 150) client_print(0, print_center, "%s 撿到一把 P90 <主要武器>", name) } case 9: { drop_weapons(id, 1) fm_give_item(id, "weapon_galil") fm_give_item(id, "ammo_556nato") fm_get_user_bpammo(id, CSW_GALIL, 175) client_print(0, print_center, "%s 撿到一把 GALIL <主要武器>", name) } case 10: { drop_weapons(id, 1) fm_give_item(id, "weapon_famas") fm_give_item(id, "ammo_556nato") fm_get_user_bpammo(id, CSW_FAMAS, 125) client_print(0, print_center, "%s 撿到一把 FAMAS <主要武器>", name) } case 11: { drop_weapons(id, 1) fm_give_item(id, "weapon_ak47") fm_give_item(id, "ammo_762nato") fm_get_user_bpammo(id, CSW_AK47, 150) client_print(0, print_center, "%s 撿到一把 AK47 <主要武器>", name) } case 12: { drop_weapons(id, 1) fm_give_item(id, "weapon_m4a1") fm_give_item(id, "ammo_556nato") fm_get_user_bpammo(id, CSW_M4A1, 150) client_print(0, print_center, "%s 撿到一把 M4A1 <主要武器>", name) } case 13: { drop_weapons(id, 1) fm_give_item(id, "weapon_sg552") fm_give_item(id, "ammo_556nato") fm_get_user_bpammo(id, CSW_SG552, 150) client_print(0, print_center, "%s 撿到一把 SG552 <主要武器>", name) } case 14: { drop_weapons(id, 1) fm_give_item(id, "weapon_aug") fm_give_item(id, "ammo_556nato") fm_get_user_bpammo(id, CSW_AUG, 150) client_print(0, print_center, "%s 撿到一把 AUG <主要武器>", name) } case 15: { drop_weapons(id, 1) fm_give_item(id, "weapon_scout") fm_give_item(id, "ammo_762nato") fm_get_user_bpammo(id, CSW_SCOUT, 100) client_print(0, print_center, "%s 撿到一把 SCOUT <主要武器>", name) } case 16: { drop_weapons(id, 1) fm_give_item(id, "weapon_awp") fm_give_item(id, "ammo_338magnum") fm_get_user_bpammo(id, CSW_AWP, 50) client_print(0, print_center, "%s 撿到一把 AWP <主要武器>", 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) } } }
[ 此文章被shxs101tw在2011-01-22 00:14重新編輯 ]
此文章被評分,最近評分記錄財富:0 (by 惡魔之槍) | 理由: 你的圖片到底在哪? | |
|
|
|