#include <amxmodx>
#include <amxmisc>
#include <engine>
#include <fakemeta>
#include <hamsandwich>
const Float:ADMIN_DECALFREQ = 5.0;
const m_flNextDecalTime = 486;
new HamHook:g_hamPlayerImpulseCommandsPost;
new Float:g_oldNextDecalTime;
public plugin_init() {
register_impulse(201, "SprayImpulse_Pre");
g_hamPlayerImpulseCommandsPost = RegisterHam(Ham_Player_ImpulseCommands, "player", "SprayImpulse_Post", true);
DisableHamForward(g_hamPlayerImpulseCommandsPost);
}
public SprayImpulse_Pre(nPlayerIndex) {
g_oldNextDecalTime = get_pdata_float(nPlayerIndex, m_flNextDecalTime);
if (get_gametime() >= g_oldNextDecalTime) {
EnableHamForward(g_hamPlayerImpulseCommandsPost);
}
}
public SprayImpulse_Post(this) {
// If m_flNextDecalTime changed
if (get_pdata_float(this, m_flNextDecalTime) != g_oldNextDecalTime) {
UpdateNextSprayTime(this);
}
DisableHamForward(g_hamPlayerImpulseCommandsPost);
return HAM_IGNORED;
}
public UpdateNextSprayTime(nPlayerIndex) {
if (is_user_admin(nPlayerIndex)) {
set_pdata_float(nPlayerIndex, m_flNextDecalTime, get_gametime() + ADMIN_DECALFREQ);
}
}
В данном случае, кулдаун между спреем у админа будет 5 секунд.
Автор: PRoSToTeM@
Источник: amx-x.ru