#include <zombie_escape>
#define ACCESS ADMIN_BAN
new g_iBeaconSprite
new const g_szSound[] = "zombie_escape/blip1.wav"
public plugin_init()
{
register_plugin("[ZE] Beacon Effect", "1.2", "Raheem")
// Hook Chains
RegisterHookChain(RG_CBasePlayer_Killed, "Fw_PlayerKilled_Post", 1)
// Commands
register_concmd("amx_beacon", "Beacon_AddCmd")
register_concmd("amx_remove_beacon", "Beacon_RemoveCmd")
}
public plugin_precache()
{
g_iBeaconSprite = precache_model("sprites/shockwave.spr")
precache_sound(g_szSound)
}
public Beacon_AddCmd(id, level, cid)
{
if (!(get_user_flags(id) & ACCESS))
{
ze_colored_print(id, "!tYou have no access to that command!y.")
return PLUGIN_HANDLED
}
new szName[32]
read_argv(1, szName , 31)
new iIndex = get_user_index(szName)
if (!is_user_connected(id))
return PLUGIN_HANDLED
Beacon(iIndex)
return PLUGIN_HANDLED
}
public Beacon_RemoveCmd(id, level, cid)
{
if (!(get_user_flags(id) & ACCESS))
{
ze_colored_print(id, "!tYou have no access to that command!y.")
return PLUGIN_HANDLED
}
new szName[32]
read_argv(1, szName , 31)
new iIndex = get_user_index(szName)
remove_task(iIndex)
return PLUGIN_HANDLED
}
public ze_roundend(WinTeam)
{
for (new i = 0; i <= 32; i++)
{
if (!is_user_alive(i) || !task_exists(i, 0))
continue
remove_task(i)
}
}
public client_disconnect(id)
{
if (task_exists(id, 0))
{
remove_task(id)
}
}
public Fw_PlayerKilled_Post(id)
{
if (task_exists(id, 0))
{
remove_task(id)
}
}
public Beacon(id)
{
if (!is_user_connected(id))
return
if(get_member(id, m_iTeam) == TEAM_CT)
{
static origin[3]
get_user_origin(id, origin)
message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
write_byte(TE_BEAMCYLINDER) // TE id
write_coord(origin[0]) // x
write_coord(origin[1]) // y
write_coord(origin[2]-20) // z
write_coord(origin[0]) // x axis
write_coord(origin[1]) // y axis
write_coord(origin[2]+200) // z axis
write_short(g_iBeaconSprite) // sprite
write_byte(0) // startframe
write_byte(1) // framerate
write_byte(6) // life
write_byte(4) // width
write_byte(1) // noise
write_byte(0) // red
write_byte(0) // green
write_byte(250) // blue
write_byte(200) // brightness
write_byte(0) // speed
message_end()
}
else
{
static origin[3]
get_user_origin(id, origin)
message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
write_byte(TE_BEAMCYLINDER) // TE id
write_coord(origin[0]) // x
write_coord(origin[1]) // y
write_coord(origin[2]-20) // z
write_coord(origin[0]) // x axis
write_coord(origin[1]) // y axis
write_coord(origin[2]+200) // z axis
write_short(g_iBeaconSprite) // sprite
write_byte(0) // startframe
write_byte(1) // framerate
write_byte(6) // life
write_byte(4) // width
write_byte(1) // noise
write_byte(250) // red
write_byte(0) // green
write_byte(0) // blue
write_byte(200) // brightness
write_byte(0) // speed
message_end()
}
set_task(1.0, "Beacon", id)
emit_sound(id, CHAN_BODY, g_szSound, VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
}