łap
/* Plugin generated by
AMXX-Studio */
#include <amxmodx>
#include <codmod>
#include <hamsandwich>
#include <engine>
#include <fakemeta>
#include <cstrike>
#define DMG_BULLET (1<<1)
#define SLASH 0
#define STAB 1
#define RedukcjaWProcentach 20
#define Redukcja ((100-RedukcjaWProcentach)/100.0)
new gKnifeattack[ 33 ];
new bool:ma_klase[33];
new bool:g_RestartAttempt[32+1]
new const nazwa[] = "Komandos Cienia";
new const opis[] = "Natychmiastowe zabicie z noza(PPM)";
new const bronie = 1<<CSW_DEAGLE;
new const zdrowie = 40;
new const kondycja = 80;
new const inteligencja = 5;
new const wytrzymalosc = 0;
public plugin_init()
{
register_plugin(nazwa, "1.0", "QTM_Peyote");
cod_register_class(nazwa, opis, bronie, zdrowie, kondycja, inteligencja, wytrzymalosc);
RegisterHam( Ham_Weapon_PrimaryAttack, "weapon_knife", "ham_AttackSlash");
RegisterHam( Ham_Weapon_SecondaryAttack, "weapon_knife", "ham_AttackStab");
RegisterHam(Ham_TakeDamage, "player", "TakeDamage");
register_forward(FM_TraceLine, "forward_traceline", 1);
register_event("TextMsg", "eRestartAttempt", "a", "2=#Game_will_restart_in")
}
public cod_class_enabled(id)
ma_klase[id] = true;
public cod_class_disabled(id)
ma_klase[id] = false;
public ham_AttackStab( entity )
{
gKnifeattack[ pev( entity, pev_owner ) ] = STAB;
return HAM_IGNORED;
}
public ham_AttackSlash( entity )
{
gKnifeattack[ pev( entity, pev_owner ) ] = SLASH;
return HAM_IGNORED;
}
public TakeDamage(this, idinflictor, idattacker, Float:damage, damagebits)
{
if(!is_user_connected(idattacker))
return HAM_IGNORED;
if(!ma_klase[idattacker])
return HAM_IGNORED;
if(!ma_klase[this]) //Odnosnie redukcji obrazen
return HAM_IGNORED;
SetHamParamFloat(4, damage*Redukcja); //Odnosnie redukcji obrazen
if( get_user_weapon( idattacker ) == CSW_KNIFE && ( damagebits & ( DMG_NEVERGIB | DMG_BULLET ) ) )
{
if( gKnifeattack[ idattacker ] == STAB )
{
cs_set_user_armor( this, 0, CS_ARMOR_NONE )
cod_inflict_damage(idattacker, this, float(get_user_health(this))-damage+1.0, 0.0, idinflictor, damagebits);
}
}
return HAM_IGNORED;
}
public eRestartAttempt()
{
new players[32], num;
get_players(players, num, "a");
for (new i; i < num; ++i)
{
g_RestartAttempt[players[i]] = true;
}
}
public forward_traceline(Float:v1[3], Float:v2[3], noMonsters, pentToSkip)
{
if(!is_user_alive(pentToSkip)) return FMRES_IGNORED
static entity2 ; entity2 = get_tr(TR_pHit)
if(!is_user_alive(entity2)) return FMRES_IGNORED
if(pentToSkip == entity2) return FMRES_IGNORED
if(get_tr(TR_iHitgroup) != 1)
{
set_tr(TR_flFraction,1.0)
return FMRES_SUPERCEDE
}
return FMRES_IGNORED
}