Code: Select all
/*
Plugin: HNS AntiFrag
Version: 1.1
Author: KoHb
Plugin Thread:
https://forums.alliedmods.net/showthread.php?t=301434
Description:
This plugin is special created for HNS (Hide and Seek) mod. It prevents seekers to frag hiders with knife double attack. When seeker hits hider his speed is changing to af_stop_speed (default: 100.0 units/sec) for af_stop_time (default: 4.0 sec) seconds. Plugin also prevents group attack on hider by blocking damage from others for af_stop_time after he got first hit.
Cvars:
af_stop_time - time in seconds how long slow down a seeker (default: 4.0 sec)
af_stop_speed - set seeker speed in units when he is slowed down (default: 100.0 units/sec)
Languages:
English [en] - KoHb
Polish [pl] - KoHb
Russian [ru] - KoHb
Installation:
1. Compile it locally with attached ColorChat include (colorchat.inc goes to addons/amxmodx/scripting/include)
2. Put hns_antifrag.amxx in addons/amxmodx/plugins folder
3. Open your plugins.ini file from addons/amxmodx/configs and add hns_antifrag.amxx where you want
4. Put hns_antifrag.txt in addons/amxmodx/data/lang
5. Set CVARs if you want different in your server.cfg or amxx.cfg
6. If you want freeze seeker instead of slowing him down set af_stop_speed 0.1
Credits:
OciXCrom - way to use HAM_SUPERCEDE taken from amxx-bg forum
Changelog:
[1.0]
- Initial release
[1.1]
- Added ML support
List to do:
- maybe you suggest smth?
*/
#include <amxmodx>
#include <fakemeta>
#include <fun>
#include <hamsandwich>
#if AMXX_VERSION_NUM < 183
#include <colorchat>
#endif
#define PLUGIN "HNS AntiFrag"
#define VERSION "1.1"
#define AUTHOR "KoHb"
new g_iLastHit[33]
new cvar_times
new cvar_speed
new Float:times
new Float:speed
public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR)
RegisterHam(Ham_TraceAttack, "player", "PrePlayerAttack",0)
RegisterHam(Ham_TakeDamage, "player", "player_damage",1)
cvar_times = register_cvar("af_stop_time","4.0")
cvar_speed = register_cvar("af_stop_speed","100.0")
register_dictionary("hns_antifrag.txt")
}
public client_putinserver(id)
{
g_iLastHit[id] = 0
}
public PrePlayerAttack(victim, attacker, Float:damage)
{
if(!is_user_connected(attacker) || victim == attacker || get_user_team(victim) != 1)
return HAM_IGNORED
return (get_systime() - g_iLastHit[victim] < times) ? HAM_SUPERCEDE : HAM_IGNORED
}
public player_damage(victim, weapon, attacker, Float:damage, bits)
{
if(!is_user_connected(victim) || !is_user_connected(attacker) || victim == attacker || !is_user_alive(victim))
return HAM_IGNORED
if(get_user_team(attacker) == 2 && get_user_team(victim) == 1)
{
new vName[32], aName[32]
get_user_name(attacker,aName,31)
get_user_name(victim,vName,31)
times = get_pcvar_float(cvar_times)
speed = get_pcvar_float(cvar_speed)
g_iLastHit[victim] = get_systime()
set_user_rendering(victim, kRenderFxGlowShell, 255, 0, 0, kRenderNormal, 0)
set_task(times,"cmdOffGlow",victim)
engfunc(EngFunc_SetClientMaxspeed,attacker,speed)
set_task(times,"cmdOffSlowspeed",attacker)
ColorChat(attacker, RED,"^3[HNS]^1 %L^1!",attacker,"HNSAF_GIVE_NSEC_TO_RUN",get_pcvar_num(cvar_times),vName)
ColorChat(victim, RED,"^3[HNS]^1 %L^1!",victim,"HNSAF_UHAVE_NSEC_TO_RUN",get_pcvar_num(cvar_times),aName)
}
return HAM_IGNORED
}
public client_disconnect(id)
{
remove_task(id)
}
public cmdOffGlow(id)
{
set_user_rendering(id, kRenderFxGlowShell, 0, 0, 0, kRenderTransAlpha, 255)
}
public cmdOffSlowspeed(id)
{
engfunc(EngFunc_SetClientMaxspeed,id,250.0)
}