Spoiler
/* Plugin generated by AMXX-Studio */
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <codmod_frakcje>
#include <engine>
#include <fakemeta_util>
#include <hamsandwich>
new const nazwa[] = "Pilot Falcona";
new const opis[] = "Moze zrobic nalot statkiem MillenniumFalcon.";
new const bronie = (1<<CSW_P228)|(1<<CSW_MP5NAVY);
new const zdrowie = 0;
new const kondycja = 0;
new const inteligencja = 0;
new const wytrzymalosc = 0;
new const frakcja[] = "Strona";
new bool:ma_klase[33];
new sprite_blast;
new ilosc[33];
new PobraneOrigin[3], ZmienKilla[2];
public plugin_init()
{
register_plugin(nazwa, "1.0", "PatryK");
cod_register_class(nazwa, opis, bronie, zdrowie, kondycja, inteligencja, wytrzymalosc, frakcja);
register_event("CurWeapon", "ModelBroni_CurWeapon", "be", "1=1");
register_forward(FM_SetModel, "ModelBroni_fw_SetModel");
register_touch("bomb", "*", "touchedrocket");
RegisterHam(Ham_Spawn, "player", "Spawn", 1);
}
public plugin_precache()
{
sprite_blast = precache_model("sprites/dexplo.spr");
precache_model("models/p_hegrenade.mdl");
precache_model("models/Falcon.mdl");
precache_sound("mw/jet_fly1.wav");
precache_sound("mw/air_friend.wav");
precache_sound("mw/air_enemy.wav");
precache_sound("mw/air_give.wav");
precache_model("models/wars/p_scoutC.mdl");
precache_model("models/wars/v_scoutC.mdl");
precache_model("models/wars/p_deagleC.mdl");
precache_model("models/wars/v_deagleC.mdl");
}
public cod_class_enabled(id)
{
ma_klase[id] = true;
ilosc[id] = 1;
}
public cod_class_disabled(id)
{
ma_klase[id] = false;
ilosc[id] = 0;
}
public client_disconnect(id)
{
ma_klase[id] = false;
ilosc[id] = 0;
}
public cod_class_used(id)
{
if(!ilosc[id])
{
client_print(id, print_center, "Nie mozesz juz uzyc nalotu !");
return PLUGIN_CONTINUE;
}
else
{
if (is_user_alive(id))
{
ilosc[id]--;
CreateNalot(id);
}
}
return PLUGIN_CONTINUE;
}
public CreateNalot(id)
{
new num, players[32];
get_players(players, num, "gh");
for(new a = 0; a < num; a++)
{
new i = players[a];
if(get_user_team(id) != get_user_team(i))
client_cmd(i, "spk sound/mw/air_enemy.wav");
else
client_cmd(i, "spk sound/mw/air_friend.wav");
}
set_task(1.0, "CreateBombs", id+997, _, _, "a", 3);
CreatePlane(id);
}
public CreateBombs(taskid)
{
new id = (taskid-997);
new radlocation[3];
PobraneOrigin[0] += random_num(-300,300);
PobraneOrigin[1] += random_num(-300,300);
PobraneOrigin[2] += 50;
for(new i=0; i<15; i++)
{
radlocation[0] = PobraneOrigin[0]+1*random_num(-150,150);
radlocation[1] = PobraneOrigin[1]+1*random_num(-150,150);
radlocation[2] = PobraneOrigin[2];
new Float:LocVec[3];
IVecFVec(radlocation, LocVec);
create_ent(id, "bomb", "models/p_hegrenade.mdl", 2, 10, LocVec);
}
}
public CreatePlane(id)
{
new Float:Origin[3], Float:Angle[3], Float:Velocity[3], ent;
get_user_origin(id, PobraneOrigin, 3);
velocity_by_aim(id, 1000, Velocity);
entity_get_vector(id, EV_VEC_origin, Origin);
entity_get_vector(id, EV_VEC_v_angle, Angle);
Angle[0] = Velocity[2] = 0.0;
Origin[2] += 200.0;
create_ent(id, "samolot", "models/cod_plane.mdl", 2, 8, Origin, ent);
entity_set_vector(ent, EV_VEC_velocity, Velocity);
entity_set_vector(ent, EV_VEC_angles, Angle);
emit_sound(ent, CHAN_ITEM, "mw/jet_fly1.wav", 1.0, ATTN_NORM, 0, PITCH_NORM);
set_task(4.5, "del_plane", ent+5731);
}
public del_plane(taskid)
remove_entity(taskid-5731);
public touchedrocket(ent, id)
{
if(!is_valid_ent(ent))
return PLUGIN_CONTINUE;
bombs_explode(ent, 100.0, 150.0);
return PLUGIN_CONTINUE;
}
stock create_ent(id, szName[], szModel[], iSolid, iMovetype, Float:fOrigin[3], &ent=-1)
{
new ent1 = create_entity("info_target");
entity_set_string(ent1, EV_SZ_classname, szName);
entity_set_model(ent1, szModel);
entity_set_int(ent1, EV_INT_solid, iSolid);
entity_set_int(ent1, EV_INT_movetype, iMovetype);
entity_set_edict(ent1, EV_ENT_owner, id);
entity_set_origin(ent1, fOrigin);
if(ent != -1)
ent = ent1;
}
bombs_explode(ent, Float:zadaje, Float:promien)
{
if(!is_valid_ent(ent))
return;
new attacker = entity_get_edict(ent, EV_ENT_owner);
new Float:entOrigin[3], Float:fDamage, Float:Origin[3];
entity_get_vector(ent, EV_VEC_origin, entOrigin);
entOrigin[2] += 1.0;
new entlist[33];
new numfound = find_sphere_class(ent, "player", promien, entlist, 32);
for(new i=0; i < numfound; i++)
{
new victim = entlist[i];
if(!is_user_alive(victim) || get_user_team(attacker) == get_user_team(victim))
continue;
entity_get_vector(victim, EV_VEC_origin, Origin);
fDamage = zadaje - floatmul(zadaje, floatdiv(get_distance_f(Origin, entOrigin), promien));
fDamage *= estimate_take_hurt(entOrigin, victim, 0);
if(fDamage>0.0)
UTIL_Kill(attacker, victim, fDamage, DMG_BULLET);
}
Sprite_Blast(entOrigin);
remove_entity(ent);
}
stock Float:estimate_take_hurt(Float:fPoint[3], ent, ignored)
{
new Float:fFraction, Float:fOrigin[3], tr;
entity_get_vector(ent, EV_VEC_origin, fOrigin);
engfunc(EngFunc_TraceLine, fPoint, fOrigin, DONT_IGNORE_MONSTERS, ignored, tr);
get_tr2(tr, TR_flFraction, fFraction);
if(fFraction == 1.0 || get_tr2(tr, TR_pHit) == ent)
return 1.0;
return 0.6;
}
stock UTIL_Kill(atakujacy, obrywajacy, Float:damage, damagebits, ile=0)
{
ZmienKilla[ile] |= (1<<atakujacy);
ExecuteHam(Ham_TakeDamage, obrywajacy, atakujacy, atakujacy, damage, damagebits);
ZmienKilla[ile] &= ~(1<<atakujacy);
}
stock Sprite_Blast(Float:iOrigin[3])
{
message_begin(MSG_BROADCAST,SVC_TEMPENTITY);
write_byte(TE_EXPLOSION);
write_coord(floatround(iOrigin[0]));
write_coord(floatround(iOrigin[1]));
write_coord(floatround(iOrigin[2]));
write_short(sprite_blast);
write_byte(32);
write_byte(20);
write_byte(0);
message_end();
}
public Spawn(id)
{
if(!is_user_alive(id) || !is_user_connected(id))
return PLUGIN_CONTINUE;
if(ma_klase[id])
ilosc[id] = 1;
return PLUGIN_CONTINUE;
}
if(weapon == CSW_MP5NAVY)
{
set_pev(id, pev_viewmodel2, "models/wars/v_mp5C.mdl")
set_pev(id, pev_weaponmodel2, "models/wars/p_scoutC.mdl")
}
if(weapon == CSW_P228)
{
set_pev(id, pev_viewmodel2, "models/wars/v_p228C.mdl")
set_pev(id, pev_weaponmodel2, "models/wars/p_p228C.mdl")
}
}
}
public ModelBroni_fw_SetModel(entity, model[])
{
if(!pev_valid(entity))
return FMRES_IGNORED
if(!equali(model, "models/w_scout.mdl"))
return FMRES_IGNORED;
new entityowner = pev(entity, pev_owner);
if(!ma_klase[entityowner])
return FMRES_IGNORED;
engfunc(EngFunc_SetModel, entity, "")
return FMRES_SUPERCEDE
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1045\\ f0\\ fs16 \n\\ par }
*/
Mam problem z kompilacją tej klasy
Załączone pliki
-
codclass_AirStriker.sma 7,08 KB 62 Ilość pobrań
codclass_AirStriker.amxx


Dodatki SourceMod














