Witam,
Mam następujący problem iż w mojej klasie "Strzelec wyborowy" który posiada 1/5 na odbicie pocisku oraz nie traci hp przy upadku stało się tak iż odbija każdy cios.
#include <amxmodx>
#include <amxmisc>
#include <codmod>
#include <engine>
#include <hamsandwich>
#define FALL_VELOCITY 350.0
new const nazwa[] = "Strzelec";
new const opis[] = "Nie zabiera HP po upadku, 1/5 na odbicie pocisku.";
new const bronie = (1<<CSW_M4A1)|(1<<CSW_AK47);
new const zdrowie = 30;
new const kondycja = -5;
new const inteligencja = 0;
new const wytrzymalosc = 15;
new bool:ma_klase[33];
new bool:falling[33];
public plugin_init()
{
register_plugin(nazwa, "1.0", "xxx");
cod_register_class(nazwa, opis, bronie, zdrowie, kondycja, inteligencja, wytrzymalosc);
RegisterHam(Ham_TakeDamage, "player", "TakeDamage");
}
public client_PreThink(id) {
if(ma_klase[id] && is_user_alive(id) && is_user_connected(id))
}
if(entity_get_float(id, EV_FL_flFallVelocity) >= FALL_VELOCITY) {
falling[id] = true;
}
else
{
falling[id] = false;
}
public client_PostThink(id) {
if(ma_klase[id] && is_user_alive(id) && is_user_connected(id))
}
if(falling[id]) {
entity_set_int(id, EV_INT_watertype, -3);
}
public TakeDamage(this, idinflictor, idattacker, Float:damage,damagebits)
{
if(!is_user_connected(idattacker))
return HAM_IGNORED;
if(!ma_klase[this])
return HAM_IGNORED;
if(random(5))//tu zmieniasz 5 (teraz jest 1/5)
return HAM_IGNORED;
cod_inflict_damage(this, idattacker, damage, 0.0, idinflictor,
damagebits);
return HAM_SUPERCEDE;
}
Mógł by ktoś przerobić mi tak aby dana klasa miala to 1/5 na odbicie (lub nawet 1/10) i dalej posiada "Nie traci HP przy upadku?"
Za pomoc dziękuje ![]()


Dodatki SourceMod






codclass_Strzelec.amxx







