Добавлено спустя 2 часа 33 минуты 28 секунд:
Добрый день, а можете сделать чтобы когда убиваешь игрока из флешки не выходил?в этом плагине->
- Код: Выделить всё
// Copyright © 2016 Vaqtincha
#define UNRELIABLE_MESSAGE
#include <amxmodx>
#include <reapi>
enum _:Cvars{ CVAR_COLORS_DEFAULT, CVAR_COLORS_HS_KILLER, CVAR_COLORS_HS_VICTIM }
enum Colors{ red, green, blue, alpha }
new g_iColors[Cvars][Colors], g_pFadeTime, g_pHoldTime, g_pColors[Cvars]
new g_iMsgIdScreenFade, Float:g_flFadeTime, Float:g_flHoldTime
public plugin_init()
{
register_plugin("[ReApi] Killer ScreenFade", "0.0.4", "Vaqtincha/MARSHO")
register_event("HLTV", "Event_NewRound", "a", "1=0", "2=0")
RegisterHookChain(RG_CBasePlayer_Killed, "CBasePlayer_Killed", .post = true)
g_iMsgIdScreenFade = get_user_msgid("ScreenFade")
g_pColors[CVAR_COLORS_DEFAULT] = register_cvar("ks_colors_default", "0 0 200 40")
g_pColors[CVAR_COLORS_HS_KILLER] = register_cvar("ks_colors_hs_killer", "0 200 0 40")
g_pColors[CVAR_COLORS_HS_VICTIM] = register_cvar("ks_colors_hs_victim", "200 0 0 40")
g_pFadeTime = register_cvar("ks_fadeouttime", "0.5") // плавное исчезновение
g_pHoldTime = register_cvar("ks_holdtime", "0.8") // продолжительность
Event_NewRound()
}
public Event_NewRound()
{
new szColors[16], szRed[4], szGreen[4], szBlue[4], szAlpha[4]
for(new i = 0; i < Cvars; i++)
{
get_pcvar_string(g_pColors[i], szColors, charsmax(szColors))
if(parse(szColors, szRed, charsmax(szRed), szGreen, charsmax(szGreen), szBlue, charsmax(szBlue), szAlpha, charsmax(szAlpha)) == 4)
{
g_iColors[i][red] = clamp(str_to_num(szRed), 0, 255)
g_iColors[i][green] = clamp(str_to_num(szGreen), 0, 255)
g_iColors[i][blue] = clamp(str_to_num(szBlue), 0, 255)
g_iColors[i][alpha] = clamp(str_to_num(szAlpha), 0, 255)
}
else
{
set_fail_state("Please check formatting on ^"ks_colors_*^" CVars!");
}
}
g_flFadeTime = get_pcvar_float(g_pFadeTime)
g_flHoldTime = get_pcvar_float(g_pHoldTime)
}
public CBasePlayer_Killed(id, killer)
{
if(id != killer)
{
if(get_member(id, m_bHeadshotKilled))
{
if(is_user_alive(killer) && !is_player_blinded(killer))
__UTIL_ScreenFade(killer, g_iColors[CVAR_COLORS_HS_KILLER], g_flFadeTime, g_flHoldTime)
if(is_user_connected(id) && !is_player_blinded(id))
__UTIL_ScreenFade(id, g_iColors[CVAR_COLORS_HS_VICTIM], g_flFadeTime, g_flHoldTime)
}
else
{
if(is_user_alive(killer) && !is_player_blinded(killer))
__UTIL_ScreenFade(killer, g_iColors[CVAR_COLORS_DEFAULT], g_flFadeTime, g_flHoldTime)
}
}
return HC_CONTINUE
}
stock __UTIL_ScreenFade(id, iColor[Colors] = {0, 0, 0, 0}, Float:flFxTime = 1.0, Float:flHoldTime = 1.0)
{
const FFADE_IN = 0x0000
#if defined UNRELIABLE_MESSAGE
message_begin(MSG_ONE_UNRELIABLE, g_iMsgIdScreenFade, .player = id)
#else
message_begin(MSG_ONE, g_iMsgIdScreenFade, .player = id)
#endif
write_short(FixedUnsigned16(flFxTime, 1<<12))
write_short(FixedUnsigned16(flHoldTime, 1<<12))
write_short(FFADE_IN)
write_byte(iColor[red])
write_byte(iColor[green])
write_byte(iColor[blue])
write_byte(iColor[alpha])
message_end()
}
stock FixedUnsigned16(Float:flValue, iScale)
{
new iOutput
iOutput = floatround(flValue * iScale)
if(iOutput < 0)
iOutput = 0
if(iOutput > 0xFFFF)
iOutput = 0xFFFF
return iOutput
}
stock bool:is_player_blinded(id)
{
return bool:(Float:get_member(id, m_blindStartTime) + Float:get_member(id, m_blindFadeTime) >= get_gametime())
// /* m 2.*/ return bool:(Float:get_member(id, m_blindStartTime) + Float:get_member(id, m_blindFadeTime) + Float:get_member(id, m_blindHoldTime) >= get_gametime())
}