|
發表於 8-2-2009 21:28:59
|
顯示全部樓層
本帖最後由 TestingServer 於 8-2-2009 21:36 編輯
#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
#include <fakemeta_cstrike>
#include <hamsandwich>
#include <zombieplague>
const Float:EXPLOSION_RADIUS = 240.0
// Stupid compiler
#pragma unused g_models_i
new Float:g_models_i // delay between Model Change messages
new g_zclass_boom, g_exploSpr, g_msgDeathMsg, g_msgScoreInfo, g_msgScoreAttrib
new const sound_armorhit[] = "player/bhit_helmet-1.wav"
new const grenade_infect_player[][] = { "scientist/scream20.wav", "scientist/scream22.wav", "scientist/scream05.wav" }
new const sprite_grenade_ring[] = { "sprites/shockwave.spr" }
new const zclass_name[] = { "-Boomer-" }
new const zclass_info[] = { "會被擊退" }
new const zclass_model[] = { "3fung_ser2" }
new const zclass_clawmodel[] = {"v_fungser.mdl" }
const zclass_health = 550
const zclass_speed = 280
const Float:zclass_gravity = 1.0
const Float:zclass_knockback = 8.0
public plugin_init()
{
register_plugin("[ZP] Boomer","1.0","Awp King + oN.")
register_event("DeathMsg","death","a")
g_msgScoreInfo = get_user_msgid("ScoreInfo")
g_msgDeathMsg = get_user_msgid("DeathMsg")
g_msgScoreAttrib = get_user_msgid("ScoreAttrib")
register_clcmd("zb_boom", "pushboom")
g_zclass_boom = zp_register_zombie_class(zclass_name, zclass_info, zclass_model, zclass_clawmodel, zclass_health, zclass_speed, zclass_gravity, zclass_knockback)
}
public plugin_precache()
{
new i
engfunc(EngFunc_PrecacheSound, sound_armorhit)
for (i = 0; i < sizeof grenade_infect_player; i++)
engfunc(EngFunc_PrecacheSound, grenade_infect_player)
g_exploSpr = engfunc(EngFunc_PrecacheModel, sprite_grenade_ring)
}
public death(id)
{
new victim = read_data(2)
new id = victim
if(zp_get_user_zombie_class(id) == g_zclass_boom && zp_get_user_zombie(id))
{
BlowUp(id)
}
}
public pushboom(id)
{
if(zp_get_user_zombie_class(id) == g_zclass_boom && zp_get_user_zombie(id))
{
BlowUp(id)
user_kill(id, 0)
}
}
public BlowUp(id)
{
// Get origin
static Float riginF[3]
pev(id, pev_origin, originF)
// Make the explosion
create_blast(originF)
// Infection nade explode sound
//engfunc(EngFunc_EmitSound, id, CHAN_WEAPON, grenade_infect[random_num(0, sizeof grenade_infect - 1)], 1.0, ATTN_NORM, 0, PITCH_NORM)
// Get attacker
static attacker
attacker = pev(id, pev_owner)
g_models_i = 0.0 // reset model change counter
// Collisions
static victim
victim = -1
while ((victim = engfunc(EngFunc_FindEntityInSphere, victim, originF, EXPLOSION_RADIUS)) != 0)
{
// Only effect alive non-spawnprotected humans
if (!is_user_alive(victim) || zp_get_user_zombie(victim))
continue;
static Float:armor
pev(victim, pev_armorvalue, armor)
// Human has armor?
if (armor > 99)
{
set_pev(victim, pev_armorvalue, floatmax(0.0, armor - 100))
engfunc(EngFunc_EmitSound, victim, CHAN_BODY, sound_armorhit, 1.0, ATTN_NORM, 0, PITCH_NORM)
continue;
}
// Last human is killed
if (zp_get_user_last_human(victim))
{
ExecuteHamB(Ham_Killed, victim, attacker, 0)
continue;
}
// Infected victim's sound
engfunc(EngFunc_EmitSound, victim, CHAN_VOICE, grenade_infect_player[random_num(0, sizeof grenade_infect_player - 1)], 1.0, ATTN_NORM, 0, PITCH_NORM)
SendDeathMsg(attacker, victim) // send death notice
FixDeadAttrib(victim) // fix the "dead" attrib on scoreboard
UpdateFrags(attacker, victim, 1, 1, 1) // add corresponding frags & deaths
user_kill((victim, [1] )
zp_respawn_user(victim, CS_TEAM_T)
zp_set_user_ammo_packs(id, zp_get_user_ammo_packs(id) + 1)
}
// Get rid of the grenade
engfunc(EngFunc_RemoveEntity, id)
}
// Infection Grenade: Green Blast
create_blast(const Float riginF[3])
{
// Smallest ring
engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, originF, 0)
write_byte(TE_BEAMCYLINDER) // TE id
engfunc(EngFunc_WriteCoord, originF[0]) // x
engfunc(EngFunc_WriteCoord, originF[1]) // y
engfunc(EngFunc_WriteCoord, originF[2]) // z
engfunc(EngFunc_WriteCoord, originF[0]) // x axis
engfunc(EngFunc_WriteCoord, originF[1]) // y axis
engfunc(EngFunc_WriteCoord, originF[2]+385.0) // z axis
write_short(g_exploSpr) // sprite
write_byte(0) // startframe
write_byte(0) // framerate
write_byte(4) // life
write_byte(60) // width
write_byte(0) // noise
write_byte(0) // red
write_byte(200) // green
write_byte(0) // blue
write_byte(200) // brightness
write_byte(0) // speed
message_end()
// Medium ring
engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, originF, 0)
write_byte(TE_BEAMCYLINDER) // TE id
engfunc(EngFunc_WriteCoord, originF[0]) // x
engfunc(EngFunc_WriteCoord, originF[1]) // y
engfunc(EngFunc_WriteCoord, originF[2]) // z
engfunc(EngFunc_WriteCoord, originF[0]) // x axis
engfunc(EngFunc_WriteCoord, originF[1]) // y axis
engfunc(EngFunc_WriteCoord, originF[2]+470.0) // z axis
write_short(g_exploSpr) // sprite
write_byte(0) // startframe
write_byte(0) // framerate
write_byte(4) // life
write_byte(60) // width
write_byte(0) // noise
write_byte(0) // red
write_byte(200) // green
write_byte(0) // blue
write_byte(200) // brightness
write_byte(0) // speed
message_end()
// Largest ring
engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, originF, 0)
write_byte(TE_BEAMCYLINDER) // TE id
engfunc(EngFunc_WriteCoord, originF[0]) // x
engfunc(EngFunc_WriteCoord, originF[1]) // y
engfunc(EngFunc_WriteCoord, originF[2]) // z
engfunc(EngFunc_WriteCoord, originF[0]) // x axis
engfunc(EngFunc_WriteCoord, originF[1]) // y axis
engfunc(EngFunc_WriteCoord, originF[2]+555.0) // z axis
write_short(g_exploSpr) // sprite
write_byte(0) // startframe
write_byte(0) // framerate
write_byte(4) // life
write_byte(60) // width
write_byte(0) // noise
write_byte(0) // red
write_byte(200) // green
write_byte(0) // blue
write_byte(200) // brightness
write_byte(0) // speed
message_end()
}
// Fix Dead Attrib on scoreboard
FixDeadAttrib(id)
{
message_begin(MSG_BROADCAST, g_msgScoreAttrib)
write_byte(id) // id
write_byte(0) // attrib
message_end()
}
// Send Death Message for infections
SendDeathMsg(attacker, victim)
{
message_begin(MSG_BROADCAST, g_msgDeathMsg)
write_byte(attacker) // killer
write_byte(victim) // victim
write_byte(1) // headshot flag
write_string("infection") // killer's weapon
message_end()
}
// Update Player Frags and Deaths
UpdateFrags(attacker, victim, frags, deaths, scoreboard)
{
// Set attacker frags
set_pev(attacker, pev_frags, float(pev(attacker, pev_frags) + frags))
// Set victim deaths
fm_set_user_deaths(victim, fm_get_user_deaths(victim) + deaths)
// Update scoreboard with attacker and victim info
if (scoreboard)
{
message_begin(MSG_BROADCAST, g_msgScoreInfo)
write_byte(attacker) // id
write_short(pev(attacker, pev_frags)) // frags
write_short(fm_get_user_deaths(attacker)) // deaths
write_short(0) // class?
write_short(fm_get_user_team(attacker)) // team
message_end()
message_begin(MSG_BROADCAST, g_msgScoreInfo)
write_byte(victim) // id
write_short(pev(victim, pev_frags)) // frags
write_short(fm_get_user_deaths(victim)) // deaths
write_short(0) // class?
write_short(fm_get_user_team(victim)) // team
message_end()
}
}
can ?????
新手唔識 |
|