TheStarChild
|
分享:
▼
x0
|
[1.6][插件] 有沒有人幫我把這兩個插件融合(zp)
(懸賞:20000雅幣)
我想要把這個噴火槍的能力加到我的附件槍的能力,不知道有沒有人能幫我做?把這個噴火槍的能力加到附件上那把槍上,拜託了 還有我要任何隊伍都能夠減這把(附件的那一把)附註:我只要附件那把槍有噴火槍的能力,然後任何隊伍都能撿起而已(子彈不變) /*================================================================================ --------------------------------- -*- [ZP] Extra Items FlameThrower -*- --------------------------------- ================================================================================*/ #include <amxmod> #include <amxmodx> #include <fakemeta> #include <engine> #include <hamsandwich> #include <zombieplague>
new g_flamethrower, sprite_xplo, g_flameSpr, g_smokeSpr
new g_fuelcost, g_fueltank, g_maxdamage, g_mindamage
new g_hasFlamethrower[33], g_FuelTank[33], PainSound[33], g_burning[33] new Float:g_Delay[33], Float:g_BurnTime[33]
enum (+= 100) { TASK_BURN }
#define ID_BURN (taskid - TASK_BURN)
new const sound_pain[][] = { "player/bhit_helmet-1.wav", "player/bhit_kevlar-1.wav" }
new const sprite_fire[] = "sprites/explode1.spr" new const p_flamethrower[] = "models/p_flamethrower.mdl" new const v_flamethrower[] = "models/v_flamethrower.mdl" new const w_flamethrower[] = "models/w_flamethrower.mdl" new const p_knife[] = "models/p_knife.mdl" new const v_knife[] = "models/v_knife.mdl"
public plugin_init() { register_plugin("[ZP]火焰喷射枪", "1.0", "Leech")
register_event("HLTV", "Event_NewRound", "a", "1=0", "2=0") register_event("CurWeapon", "Event_CurWeapon", "be", "1=1") register_event("TextMsg", "Event_WeaponDrop", "be", "2=#Weapon_Cannot_Be_Dropped") register_event("DeathMsg", "Event_DeathMsg", "a")
register_forward(FM_PlayerPostThink, "fw_PlayerPostThink")
register_think("flamethrower", "think_Flamethrower") register_touch("flamethrower", "player", "touch_Flamethrower") register_touch("flamethrower_fire", "*", "touch_Flamethrower_fire")
g_flamethrower = zp_register_extra_item("火焰喷射枪", 26, ZP_TEAM_HUMAN)
g_fuelcost = register_cvar("zp_fg_fuelcost", "2") g_fueltank = register_cvar("zp_fg_fueltank", "100") g_maxdamage = register_cvar("zp_fg_maxdamage", "2.0") g_mindamage = register_cvar("zp_fg_mindamage", "1.0") }
public plugin_precache() { precache_sound("ambience/flameburst1.wav") precache_sound("items/ammopickup2.wav")
precache_model(sprite_fire) sprite_xplo = precache_model("sprites/zerogxplode.spr") g_flameSpr = precache_model("sprites/fire.spr") g_smokeSpr = precache_model("sprites/steam1.spr")
precache_model(p_flamethrower) precache_model(v_flamethrower) precache_model(w_flamethrower) precache_model(p_knife) precache_model(v_knife) precache_model("models/shield/v_shield_knife.mdl") precache_model("models/shield/p_shield_knife.mdl") }
public zp_extra_item_selected(id, itemid) { if (itemid == g_flamethrower) { g_hasFlamethrower[id] = true g_FuelTank[id] = get_pcvar_num(g_fueltank) client_cmd(id, "spk items/ammopickup2") client_print(id, print_chat, "[ZP]你购买了火焰喷射枪!刀子左键喷火,右键购买子弹!") } }
public Event_NewRound(id) { if (g_hasFlamethrower[id]) { g_hasFlamethrower[id] = false g_FuelTank[id] = 0 Event_CurWeapon(id) } }
public Event_CurWeapon(id) { if (get_user_weapon(id) == CSW_KNIFE) { if (g_hasFlamethrower[id]) { set_pev(id, pev_viewmodel2, any:v_flamethrower) set_pev(id, pev_weaponmodel2, any:p_flamethrower) } else { if (cs_get_user_shield(id) != 1) { set_pev(id, pev_viewmodel2, any:v_knife) set_pev(id, pev_weaponmodel2, any:p_knife) } if (cs_get_user_shield(id) == 1) { set_pev(id, pev_viewmodel2, any:"v_shield_knife.mdl") set_pev(id, pev_weaponmodel2, any:"p_shield_knife.mdl") } } } }
public Event_WeaponDrop(id) { if(is_user_alive(id) && g_hasFlamethrower[id]) { g_hasFlamethrower[id] = false drop_flamethrower(id) } }
public Event_DeathMsg() { new id = read_data(2) if(is_user_connected(id) && g_hasFlamethrower[id]) drop_flamethrower(id)
return PLUGIN_CONTINUE }
public fw_PlayerPostThink(id) { if (g_hasFlamethrower[id] && is_user_alive(id) && get_user_weapon(id) == CSW_KNIFE && !(pev(id, pev_flags) & FL_INWATER)) { new button = pev(id, pev_button) if (zp_get_user_zombie(id) || cs_get_user_shield(id) == 1) drop_flamethrower(id) else { set_hudmessage(255, 170, 0, 0.91, 0.95, _, _, 1.0, _, _, 4) if (button & IN_ATTACK && (g_Delay[id] + 0.1) < get_gametime()) { if (g_FuelTank[id] > 0) { g_FuelTank[id] -= 1 make_flame(id) emit_sound(id, CHAN_WEAPON, "ambience/flameburst1.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM) show_hudmessage(id, "火焰子弹: %d%%", any:get_percent(g_FuelTank[id], get_pcvar_num(g_fueltank))) } else client_print(id, print_chat, "[ZP]你的子弹用完了,右键购买子弹!") } if (button & IN_ATTACK2 && (g_Delay[id] + 0.2) < get_gametime()) { new user_packs = zp_get_user_ammo_packs(id) new cost = get_pcvar_num(g_fuelcost) if (user_packs >= cost && g_FuelTank[id] < get_pcvar_num(g_fueltank)) { g_FuelTank[id] += 10 show_hudmessage(id, "火焰子弹: %d%%", any:get_percent(g_FuelTank[id], get_pcvar_num(g_fueltank))) zp_set_user_ammo_packs(id, user_packs - cost) g_Delay[id] = get_gametime() } } if (g_FuelTank[id] >= get_pcvar_num(g_fueltank)) g_FuelTank[id] = get_pcvar_num(g_fueltank) } } }
public drop_flamethrower(id) { new Float:vec[3], Float:origin[3] entity_get_vector(id, EV_VEC_origin, origin) VelocityByAim(id, 34, vec)
origin[0] += vec[0] origin[1] += vec[1]
VelocityByAim(id, 300, vec) vec[2] = 150.0 new ent = create_entity("info_target") if (pev_valid(id)) { set_pev(ent, pev_classname, any:"flamethrower") entity_set_model(ent, w_flamethrower) set_pev(ent, pev_movetype, any:MOVETYPE_TOSS) set_pev(ent, pev_solid, any:1) set_pev(ent, pev_origin, any:origin) set_pev(ent, pev_velocity, any:vec) set_pev(ent, pev_iuser4, any:g_FuelTank[id]) set_pev(ent, pev_takedamage, any:2.0) set_pev(ent, pev_health, any:30.0) set_pev(ent, pev_size, any:Float:{-2.5, -3.5, 0.0}, any:Float:{2.5, 3.5, 2.0}) set_pev(ent, pev_nextthink, any:(get_gametime() + 0.01)) }
g_hasFlamethrower[id] = false g_FuelTank[id] = 0
Event_CurWeapon(id)
return PLUGIN_CONTINUE }
public think_Flamethrower(ent) { if (pev_valid(ent)) { if (pev(ent, pev_health) < 30.0) { new Float:origin[3], iorigin[3] pev(ent, pev_origin, any:origin) FVecIVec(origin, iorigin) message_begin(MSG_BROADCAST, SVC_TEMPENTITY) write_byte(99) write_short(ent) message_end() message_begin(MSG_BROADCAST, SVC_TEMPENTITY) write_byte(3) write_coord(iorigin[0]) write_coord(iorigin[1]) write_coord(iorigin[2]) write_short(sprite_xplo) write_byte(50) write_byte(15) write_byte(0) message_end()
for (new i = 0; i < 33; i++) { if (is_user_alive(i) && i != ent) { new Float:dist = entity_range(ent, i) new Float:dmg = (1000.0 - (999.0 * dist / 600.0)) if (dist <= 600.0) { ExecuteHamB(Ham_TakeDamage, i, any:0, any:ent, any:dmg, any:DMG_BURN) } } } remove_entity(ent) } set_pev(ent, pev_nextthink, any:(get_gametime() + 0.01)) } }
public touch_Flamethrower(ent, id) { if (!pev_valid(id) || !is_user_alive(id) || zp_get_user_zombie(id)) return PLUGIN_CONTINUE if (g_hasFlamethrower[id]) return PLUGIN_CONTINUE if (cs_get_user_shield(id)==1) return PLUGIN_CONTINUE g_hasFlamethrower[id] = true client_cmd(id, "spk items/ammopickup2") g_FuelTank[id] = pev(ent, pev_iuser4) set_hudmessage(255, 170, 0, 0.91, 0.95, _, _, 1.0, _, _, 4) show_hudmessage(id, "火焰子弹: %d%%", any:get_percent(g_FuelTank[id], get_pcvar_num(g_fueltank)))
new wpn = get_user_weapon(id) if (wpn == CSW_KNIFE) { set_pev(id, pev_viewmodel2, any:v_flamethrower) set_pev(id, pev_weaponmodel2, any:p_flamethrower) set_pev(id, pev_weaponanim, any:9) } remove_entity(ent) return PLUGIN_CONTINUE }
public make_flame(id) { new Float:vec[3], Float:angle[3], Float:origin[3] pev(id, pev_origin, any:origin) pev(id, pev_angles, any:angle)
new ent = create_entity("info_target") origin[2] += 20.0 set_pev(ent, pev_solid, any:1) set_pev(ent, pev_owner, any:id) set_pev(ent, pev_origin, any:origin) set_pev(ent, pev_angles, any:angle) entity_set_model(ent, sprite_fire) set_pev(ent, pev_movetype, any:5) set_pev(ent, pev_size, any:{-0.1,-0.1,-0.1}, any:{0.1,0.1,0.1}) set_pev(ent, pev_classname, any:"flamethrower_fire") set_pev(ent, pev_renderfx, any:19) set_pev(ent, pev_rendermode, any:5) set_pev(ent, pev_renderamt, any:200.0) set_pev(ent, pev_framerate, any:10.0) set_pev(ent, pev_scale, any:0.8) set_pev(ent, pev_iuser2, any:1.0) set_pev(ent, pev_spawnflags, any:SF_SPRITE_STARTON)
g_Delay[id] = get_gametime()
velocity_by_aim(id, 550, vec) set_pev(ent, pev_velocity, any:vec)
lighting(ent) set_task(0.1, "move_change", ent,_,_,"b") set_task(1.6, "removeent", ent) emit_sound(ent, CHAN_WEAPON, "ambience/flameburst1.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM) }
public lighting(ent) { static Float:origin[3] pev(ent, pev_origin, any:origin)
engfunc(EngFunc_MessageBegin, any:MSG_PVS, any:SVC_TEMPENTITY, any:origin, any:0) write_byte(TE_DLIGHT) engfunc(EngFunc_WriteCoord, any:origin[0]) // x engfunc(EngFunc_WriteCoord, any:origin[1]) // y engfunc(EngFunc_WriteCoord, any:origin[2]) // z write_byte(15) write_byte(200) // r write_byte(165) // g write_byte(0) // b write_byte(1) // life write_byte(0) message_end() }
public move_change(ent) { if (pev_valid(ent)) { new Float:vec[3], Float:frame pev(ent, pev_frame, any:frame) set_pev(ent, pev_frame, any:(frame+1.0))
if (frame >= 6.0) velocity_by_aim(ent, 1, vec) else pev(ent, pev_velocity, any:vec)
vec[2] += 30.0 set_pev(ent, pev_velocity, any:vec) for (new i=0; i<33; i++) { new id = pev(ent, pev_owner) if (zp_get_user_zombie(i) && is_user_alive(i) && i != id) { new Float:dist = entity_range(ent, i), Float:maxdmg=get_pcvar_float(g_maxdamage), Float:mindmg=get_pcvar_float(g_mindamage) new Float:dmg = (maxdmg - ((maxdmg-mindmg) * dist / 35.0)) if (dist <= 35.0) { ExecuteHamB(Ham_TakeDamage, i, any:0, any:id, any:dmg, any:DMG_BURN) if (!g_burning) { g_burning = true g_BurnTime = get_gametime() set_task(0.3, "player_burn", i+TASK_BURN,_,_, "b") } } } } lighting(ent) } else remove_task(ent) }
public removeent(ent) { remove_task(ent) remove_entity(ent) }
public touch_Flamethrower_fire(ent, id) { if (pev_valid(ent)) { new i = pev(ent, pev_owner) new class[32], Float:origin[3] pev(id, pev_classname, any:class, any:charsmax(class)); pev(id, pev_origin, any:origin)
if (equal(class, "player") && zp_get_user_zombie(id)) { ExecuteHamB(Ham_TakeDamage, id, any:0, any:i, any:15.0, any:DMG_BURN) if (!g_burning[id]) { g_burning[id] = true g_BurnTime[id] = get_gametime() set_task(0.3, "player_burn", id+TASK_BURN,_,_, "b") } } if (equal(class, "func_breakable") && pev(id, pev_solid) != 1) force_use(ent, id) } }
public player_burn(taskid) { new hp = get_user_health(ID_BURN), flags = pev(ID_BURN, pev_flags)
if (g_burning[ID_BURN] && !(flags & FL_INWATER)) { if (hp > 2) set_pev(ID_BURN, pev_health, any:(hp-1.0)) if (hp <= 2) { g_burning[ID_BURN] = false remove_task(taskid) user_kill(ID_BURN, 1) } } if (!g_burning[ID_BURN] || (flags & FL_INWATER) || ((get_gametime()-g_BurnTime[ID_BURN]) >= 7.0) || !is_user_alive(ID_BURN)) { remove_task(taskid) g_burning[ID_BURN] = false } new Float:origin[3] pev(ID_BURN, pev_origin, any:origin) create_burn(origin) PainSound[ID_BURN] = random_num(0, sizeof sound_pain - 1) emit_sound(ID_BURN, CHAN_BODY, sound_pain[PainSound[ID_BURN]], 1.0, ATTN_NORM, 0, PITCH_NORM) }
create_burn(const Float:origin[3]) { message_begin(MSG_BROADCAST, SVC_TEMPENTITY) write_byte(TE_SPRITE) // TE id engfunc(EngFunc_WriteCoord, any:origin[0]) engfunc(EngFunc_WriteCoord, any:origin[1]) engfunc(EngFunc_WriteCoord, any:origin[2]) write_short(g_flameSpr) // sprite write_byte(random_num(5, 10)) // scale write_byte(200) // brightness message_end()
message_begin(MSG_BROADCAST, SVC_TEMPENTITY) write_byte(TE_SMOKE) engfunc(EngFunc_WriteCoord, any:origin[0]) engfunc(EngFunc_WriteCoord, any:origin[1]) engfunc(EngFunc_WriteCoord, any:(origin[2]-50)) write_short(g_smokeSpr) write_byte(random_num(15, 20)) write_byte(random_num(10, 20)) message_end() }
stock get_percent(value, tvalue) { return floatround(floatmul(float(value) / float(tvalue) , 100.0)) }
[ 此文章被喵0w0在2011-08-23 10:10重新編輯 ]
|