Rozšířit věty reklam náletu
děkuji
#include <amxmodx> #include <engine> #include <fakemeta> #include <hamsandwich> #define PLUGIN "KillStreak" #define VERSION "1.0" #define AUTHOR "cypis" new sprite_blast; new PobraneOrigin[3]; new g_bomby[15] new g_use public plugin_init() { register_plugin(PLUGIN, VERSION, AUTHOR) register_forward(FM_Touch, "fw_Touch"); register_logevent("RundStart", 2, "1=Round_Start"); register_clcmd("say /air", "CreateNalot") } public plugin_precache() { sprite_blast = precache_model("sprites/dexplo.spr") precache_model("models/p_hegrenade.mdl"); precache_model("models/Mig29.mdl"); precache_sound("mw/jet_fly1.wav"); } public RundStart() { client_print(0, print_chat, "You have the right to a Airstrikes"); g_use = 1 } public fw_Touch(ent, id) { if (!pev_valid(ent)) return FMRES_IGNORED new EntClassName[32] entity_get_string(ent, EV_SZ_classname, EntClassName, charsmax(EntClassName)) if(equal(EntClassName, "Bomb")) { bombs_explode(ent, 100, 150) remove_entity(ent) return FMRES_IGNORED } return FMRES_IGNORED } public CreateNalot(id) { if(!g_use) return; CreatePlane(id) set_task(1.0, "CreateBombs", id+997, "", 0, "a", 3) set_task(6.0, "remove_ent") g_use--; } public remove_ent() remove_entity_name("Samolot"); public CreatePlane(id){ new Float:Origin[3], Float: Velocity[3]; get_user_origin(id, PobraneOrigin, 3); entity_get_vector(id, EV_VEC_origin , Origin); Origin[2] = Origin[2] + 250; new Float: vAngle[3]; entity_get_vector(id, EV_VEC_v_angle, vAngle); vAngle[0] *= -1.0; new g_samolot = create_entity("info_target"); entity_set_string(g_samolot, EV_SZ_classname, "Samolot"); entity_set_int(g_samolot, EV_INT_solid, 2); entity_set_int(g_samolot, EV_INT_movetype, 8); entity_set_edict(g_samolot, EV_ENT_owner, id); entity_set_model(g_samolot, "models/Mig29.mdl"); entity_set_origin(g_samolot, Origin); entity_set_vector(g_samolot, EV_VEC_angles, vAngle); VelocityByAim(id, 1000 , Velocity); Velocity[2] = Origin[2]; entity_set_vector(g_samolot, EV_VEC_velocity ,Velocity); emit_sound(g_samolot, CHAN_ITEM, "mw/jet_fly1.wav", 1.0, ATTN_NORM, 0, PITCH_NORM); } public CreateBombs(taskid) { new id = (taskid-997) new radlocation[3]; new randomx; new randomy; PobraneOrigin[2] += 50; for(new i=0; i<15; i++) { randomx = random_num(-150,150); randomy = random_num(-150,150); radlocation[0] = PobraneOrigin[0]+1*randomx; radlocation[1] = PobraneOrigin[1]+1*randomy; radlocation[2] = PobraneOrigin[2]; new Float:LocVec[3]; IVecFVec(radlocation, LocVec); g_bomby[i] = create_entity("info_target"); entity_set_string(g_bomby[i], EV_SZ_classname, "Bomb"); entity_set_int(g_bomby[i], EV_INT_solid, 2); entity_set_int(g_bomby[i], EV_INT_movetype, 10); entity_set_edict(g_bomby[i], EV_ENT_owner, id); entity_set_model(g_bomby[i], "models/p_hegrenade.mdl"); entity_set_origin(g_bomby[i], LocVec); } } bombs_explode(ent, damage, radius) { if (!pev_valid(ent)) return; new attacker = pev(ent, pev_owner) new Float:entOrigin[3], Float:fDistance, Float:fDamage, Float:nade_damage, Float:nade_radius, Float:vOrigin[3] nade_damage = float(damage) nade_radius = float(radius) pev(ent, pev_origin, entOrigin) entOrigin[2] += 1.0 new victim = -1 while ((victim = engfunc(EngFunc_FindEntityInSphere, victim, entOrigin, nade_radius)) != 0) { if (attacker==victim || !pev_valid(victim)) continue; pev(victim, pev_origin, vOrigin) fDistance = get_distance_f(vOrigin, entOrigin) fDamage = nade_damage - floatmul(nade_damage, floatdiv(fDistance, nade_radius)) fDamage *= estimate_take_hurt(entOrigin, victim, 0) if(fDamage>0.0) { if(get_user_team(attacker)!=get_user_team(victim)) { if(pev(victim, pev_health)) ExecuteHam(Ham_TakeDamage, victim, ent, attacker, fDamage, DMG_BULLET) } } } message_begin(MSG_BROADCAST,SVC_TEMPENTITY); write_byte(TE_EXPLOSION); write_coord(floatround(entOrigin[0])); write_coord(floatround(entOrigin[1])); write_coord(floatround(entOrigin[2])); write_short(sprite_blast); write_byte(32); write_byte(20); write_byte(0); message_end(); } stock Float:estimate_take_hurt(Float:fPoint[3], ent, ignored) { new Float:fOrigin[3] new tr new Float:fFraction pev(ent, pev_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 }