Вписавал в public event_DeathMsg() if(round == MODE_NEMESIS || round == MODE_SURVIVOR)
Потом if(zp_get_user_zombie(victim) && !zp_get_user_nemesis(killer) && !zp_get_user_survivor(killer) && !slow_motion_event)
В итоге ничего не сработало. Помогите. Пожалуйста.
- Код: Выделить всё
#include <amxmodx>
#include <fakemeta>
#include <fun>
#include <hamsandwich>
#include <zombieplague>
new const slowmo_start[] = "zombie_plague/slowmo_start.wav"
new const slowmo_end[] = "zombie_plague/slowmo_end.wav"
new bool:slow_motion_event
new cvar_slowmo_speed, cvar_slowmo_duration, cvar_slowmo_rof
new Float:slowmo_speed, Float:slowmo_duration, Float:slowmo_rof
new g_iCurWeapon[33]
new g_iMaxPlayers
new g_bitConnectedPlayers, g_bitAlivePlayers
#define MarkUserConnected(%0) g_bitConnectedPlayers |= (1 << (%0 & 31))
#define ClearUserConnected(%0) g_bitConnectedPlayers &= ~(1 << (%0 & 31))
#define IsUserConnected(%0) g_bitConnectedPlayers & (1 << (%0 & 31))
#define MarkUserAlive(%0) g_bitAlivePlayers |= (1 << (%0 & 31))
#define ClearUserAlive(%0) g_bitAlivePlayers &= ~(1 << (%0 & 31))
#define IsUserAlive(%0) g_bitAlivePlayers & (1 << (%0 & 31))
public plugin_precache()
{
precache_sound(slowmo_start)
precache_sound(slowmo_end)
}
public plugin_init()
{
register_event("HLTV", "event_new_round", "a", "1=0", "2=0")
register_event("DeathMsg", "event_DeathMsg", "a", "1>0")
register_event("CurWeapon", "event_CurWeapon", "be", "1=1")
register_forward(FM_PlayerPreThink, "fw_PlayerPreThink")
RegisterHam(Ham_Spawn, "player", "fw_PlayerSpawn_Post", 1)
cvar_slowmo_speed = register_cvar("zp_slowmo_speed", "80.0")
cvar_slowmo_duration = register_cvar("zp_slowmo_duration", "2.5")
cvar_slowmo_rof = register_cvar("zp_slowmo_rateoffire", "3.0")
g_iMaxPlayers = get_maxplayers()
}
public client_putinserver(id)
{
MarkUserConnected(id)
}
public client_disconnect(id)
{
ClearUserConnected(id)
ClearUserAlive(id)
}
public event_new_round()
{
slowmo_speed = get_pcvar_float(cvar_slowmo_speed)
slowmo_duration = get_pcvar_float(cvar_slowmo_duration)
slowmo_rof = get_pcvar_float(cvar_slowmo_rof)
}
public event_DeathMsg()
{
static killer; killer = read_data(1)
static victim; victim = read_data(2)
ClearUserAlive(victim)
if(zp_get_user_zombie(victim) && !zp_get_user_zombie(killer) && !slow_motion_event)
{
slow_motion_event = true
client_cmd(0, "spk %s", slowmo_start)
set_task(slowmo_duration, "end_slowmo", 0)
}
}
public event_CurWeapon(id)
{
if(slow_motion_event)
{
g_iCurWeapon[id] = read_data(2)
if(slowmo_rof > 1.0)
{
static weapon[32], ent
get_weaponname(g_iCurWeapon[id], weapon, 31)
ent = fm_find_ent_by_owner(-1, weapon, id)
if(ent)
{
static Float:Delay, Float:M_Delay
Delay = get_pdata_float(ent, 46, 4) * slowmo_rof
M_Delay = get_pdata_float(ent, 47, 4) * slowmo_rof
if(Delay > 0.0)
{
set_pdata_float(ent, 46, Delay, 4)
set_pdata_float(ent, 47, M_Delay, 4)
}
}
}
}
}
public fw_PlayerPreThink(id)
{
if(slow_motion_event)
{
for (id = 1; id <= g_iMaxPlayers; id++)
{
if(IsUserConnected(id) && IsUserAlive(id))
{
set_user_maxspeed(id, slowmo_speed)
}
}
}
}
public fw_PlayerSpawn_Post(id)
{
if(is_user_alive(id))
{
MarkUserAlive(id)
}
}
public end_slowmo()
{
if(slow_motion_event)
{
slow_motion_event = false
client_cmd(0, "spk %s", slowmo_end)
}
}
stock fm_find_ent_by_owner(index, const classname[], owner, jghgtype = 0)
{
new strtype[11] = "classname", ent = index
switch (jghgtype)
{
case 1: strtype = "target"
case 2: strtype = "targetname"
}
while ((ent = engfunc(EngFunc_FindEntityByString, ent, strtype, classname)) && pev(ent, pev_owner) != owner)
{
return ent
}
return ent
}