Witam
klasa którą dołaczam nie odbija pocisków. Zgodnie z .sma powinna odbijać każdy pocisk.
Proszę o sprawdzenie kodu i ewentualną edycję.
#include <amxmodx>
#include <cstrike>
#include <colorchat>
#include <hamsandwich>
#include <codmod>
#include <engine>
new bool:ma_klase[33];
new sprite_blast, sprite_white;
#define DMG_BULLET (1<<1)
new const nazwa[] = "Security (Special)";
new const opis[] = "Tarcza SWAT, Ma 1/1 szansy na odbicie pociskow";
new const bronie = 1<<CSW_DEAGLE;
new const zdrowie = 0;
new const kondycja = 50;
new const inteligencja = 0;
new const wytrzymalosc = 100;
public plugin_init()
{
register_plugin(nazwa, "1.0", "QTM_Peyote");
cod_register_class(nazwa, opis, bronie, zdrowie, kondycja, inteligencja, wytrzymalosc);
RegisterHam(Ham_TakeDamage, "player", "TakeDamage");
register_event("DeathMsg", "DeathMsg", "a");
}
public cod_class_enabled(id)
{
if(!(get_user_flags(id) & ADMIN_IMMUNITY))
{
ColorChat(id, GREEN, "[Klasa Premium]^x01 Nie masz uprawnien, aby uzywac tej klasy.")
return COD_STOP;
}
ma_klase[id] = true;
cod_set_user_shield(id, 1);
return COD_CONTINUE;
}
public plugin_precache()
{
sprite_white = precache_model("sprites/white.spr");
sprite_blast = precache_model("sprites/dexplo.spr");
}
public DeathMsg()
{
new id = read_data(2);
if(!ma_klase[id])
return PLUGIN_CONTINUE;
new Float:fOrigin[3];
entity_get_vector(id, EV_VEC_origin, fOrigin);
new iOrigin[3];
for(new i=0;i<=2;i++)
iOrigin[i] = floatround(fOrigin[i]);
message_begin(MSG_BROADCAST,SVC_TEMPENTITY, iOrigin);
write_byte(TE_EXPLOSION);
write_coord(iOrigin[0]);
write_coord(iOrigin[1]);
write_coord(iOrigin[2]);
write_short(sprite_blast);
write_byte(32);
write_byte(20);
write_byte(0);
message_end();
message_begin( MSG_BROADCAST, SVC_TEMPENTITY, iOrigin );
write_byte( TE_BEAMCYLINDER );
write_coord( iOrigin[0] );
write_coord( iOrigin[1] );
write_coord( iOrigin[2] );
write_coord( iOrigin[0] );
write_coord( iOrigin[1] + 200 );
write_coord( iOrigin[2] + 200 );
write_short( sprite_white );
write_byte( 0 );
write_byte( 0 );
write_byte( 10 );
write_byte( 10 );
write_byte( 255 );
write_byte( 255 );
write_byte( 100 );
write_byte( 100 );
write_byte( 128 );
write_byte( 0 );
message_end();
new entlist[33];
new numfound = find_sphere_class(id, "player", 200.0 , entlist, 32);
for (new i=0; i<=numfound; i++)
{
new pid = entlist[i];
if (is_user_alive(pid) && get_user_team(id) != get_user_team(pid))
cod_inflict_damage(id, pid, float(get_user_health(pid)), 0.0);
}
return PLUGIN_CONTINUE;
}
public cod_class_disabled(id)
{
ma_klase[id] = false;
cod_set_user_shield(id, 0);
}
public TakeDamage(this, idinflictor, idattacker, Float:damage, damagebits)
{
if(!is_user_connected(idattacker))
return HAM_IGNORED;
if(!ma_klase[this] || random_num(1,1) == 1)
return HAM_IGNORED;
cod_inflict_damage(this, idattacker, damage, 0.0, idinflictor, damagebits);
return HAM_SUPERCEDE;
}