Разработчик
Скриптер
Проверенный
- Сообщения
- 2,751
- Реакции
- 3,016
- Помог
- 61 раз(а)
#include <amxmodx>
#include <hamsandwich>
#include <fakemeta>
enum {
TEAM_UNASSIGNED,
TEAM_TERRORIST,
TEAM_CT,
TEAM_SPECTATOR
};
new HamHook:HamHostageUse;
public plugin_init() {
RegisterHam(Ham_Use, "hostage_entity", "HamHostageUse_Pre", false);
HamHostageUse = RegisterHam(Ham_Use, "hostage_entity", "HamHostageUse_Post", true);
DisableHamForward(HamHostageUse);
}
public HamHostageUse_Pre(const hostage, const caller, const activator) {
if (!is_user_connected(activator) || pev(activator, pev_deadflag) != DEAD_NO || pev(activator, pev_health) <= 0.0) {
return HAM_IGNORED;
}
if (get_ent_data(activator, "CBasePlayer", "m_iTeam") != TEAM_CT) {
return HAM_IGNORED;
}
if (get_gametime() >= get_ent_data_float(hostage, "CHostage", "m_flNextChange") && !get_ent_data(activator, "CHostage", "m_bTouched")) {
EnableHamForward(HamHostageUse);
}
return HAM_IGNORED;
}
public HamHostageUse_Post(const hostage, const caller, const activator) {
DisableHamForward(HamHostageUse);
// Do some stuff
}
#include <amxmodx>
#include <hamsandwich>
#include <fakemeta>
new HamHook:HamHostageUse;
public plugin_init() {
RegisterHam(Ham_Use, "hostage_entity", "HamHostageUse_Pre", false);
DisableHamForward(HamHostageUse = RegisterHam(Ham_Use, "hostage_entity", "HamHostageUse_Post", true));
}
public HamHostageUse_Pre(const hostage, const caller, const activator) {
if (
is_user_connected(activator) &&
pev(activator, pev_deadflag) == DEAD_NO &&
pev(activator, pev_health) > 0.0 &&
get_ent_data(activator, "CBasePlayer", "m_iTeam") == 2 /* TEAM_CT */ &&
get_gametime() >= get_ent_data_float(hostage, "CHostage", "m_flNextChange") &&
!get_ent_data(activator, "CHostage", "m_bTouched")
) {
EnableHamForward(HamHostageUse);
}
}
public HamHostageUse_Post(const hostage, const caller, const activator) {
DisableHamForward(HamHostageUse);
// Do some stuff
}