// --->> Тут можно сменить цвет лучей
#define COLOR_T {255, 0, 0, 255}
#define COLOR_CT {0, 0, 255, 255}
// --- <<
#include <sdktools_tempents>
#include <sdktools_tempents_stocks>
#include <sdktools_engine>
#define VICTIM 0
#define ATTACKER 1
new g_Laser;
new Handle: hCvar_type;
new Handle: hCvar_team;
//customize vars
new Handle: hCvar_time;
new Handle: hCvar_width;
new Handle: hCvar_endwidth;
new Handle: hCvar_fade;
new Handle: hCvar_amplitude;
public Plugin: myinfo =
{
name = "Death Beam",
author = "Danyas & Grey83",
version = "29.09.2k16",
url = "
SourceMod: Half-Life 2 Scripting"
};
public OnMapStart()
{
decl String:buffer[PLATFORM_MAX_PATH];
if(GameConfGetKeyValue(LoadGameConfigFile("funcommands.games"), "SpriteBeam", buffer, sizeof(buffer)) && buffer[0]) g_Laser = PrecacheModel(buffer);
}
public OnPluginStart()
{
hCvar_time = CreateConVar("sm_death_beam_time", "5.0", "Время жизни луча", _, true, 0.1);
hCvar_width = CreateConVar("sm_death_beam_width", "4.0", "Ширина луча (в начале)", _, true, 0.1);
hCvar_endwidth = CreateConVar("sm_death_beam_endwidth", "3.0", "Ширина луча (в конце)", _, true, 0.1);
hCvar_fade = CreateConVar("sm_death_beam_fade", "2", "Время затухания луча", _, true, 0.1);
hCvar_amplitude = CreateConVar("sm_death_beam_amplitude", "0.5", "Сила тряски луча", _, true, 0.0);
hCvar_type = CreateConVar("sm_death_beam_type", "0", "Кто видит луч смерти:\n-1 = никто; 0 = только жертва; 1 = только убийца; 2 = только жертва и убийца; 3 = все", _, true, -1.0, true, 3.0);
hCvar_team = CreateConVar("sm_death_beam_team", "0", "Показывать луч при убийстве союзником?", _, true, 0.0, true, 1.0);
AutoExecConfig(true, "death_beam");
HookEvent("player_death", player_death);
}
public player_death(Handle:event, const String:name[], bool:silent)
{
new type = GetConVarInt(hCvar_type);
if(type != -1)
{
new target[2];
target[ATTACKER] = GetClientOfUserId(GetEventInt(event, "attacker"));
if (target[ATTACKER] < 1) return;
target[VICTIM] = GetClientOfUserId(GetEventInt(event, "userid"));
if (target[VICTIM] == target[ATTACKER] && !GetConVarBool(hCvar_team)) return;
new killer_team = GetClientTeam(target[ATTACKER]);
if (GetClientTeam(target[VICTIM]) == killer_team) return;
new Float:Start[3], Float:End[3];
GetClientEyePosition(target[VICTIM], Start);
GetClientEyePosition(target[ATTACKER], End);
TE_SetupBeamPoints(Start, End, g_Laser, g_Laser, 0, 0, GetConVarFloat(hCvar_time), GetConVarFloat(hCvar_width), GetConVarFloat(hCvar_endwidth), GetConVarInt(hCvar_fade), GetConVarFloat(hCvar_amplitude), killer_team == 2 ? COLOR_T : COLOR_CT, 1);
switch (type)
{
case 3: TE_SendToAll();
case 2: TE_Send(target, 2);
default: TE_Send(target[type], 1);
}
}
}