Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* Plugin generated by AMXX-Studio */
- #include <amxmodx>
- #include <amxmisc>
- #include <cstrike>
- #include <codmod>
- #include <engine>
- #include <fakemeta_util>
- #include <hamsandwich>
- new bool:ma_perk[33];
- new sprite_blast;
- new ilosc[33];
- new PobraneOrigin[3], ZmienKilla[2];
- public plugin_init()
- {
- cod_register_perk("Airstrike", "You can call in an air raid on a round of time!");
- 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/cod_plane.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");
- }
- public cod_perk_enabled(id)
- {
- if(cod_get_user_level(id) > 100)
- return COD_STOP;
- ma_perk[id] = true;
- ilosc[id] = 1;
- return COD_CONTINUE;
- }
- public cod_perk_disabled(id)
- {
- ma_perk[id] = false;
- ilosc[id] = 0;
- }
- public client_disconnect(id)
- {
- ma_perk[id] = false;
- ilosc[id] = 0;
- }
- public cod_perk_used(id)
- {
- if(!ilosc[id])
- {
- client_print(id, print_center, "You can no longer use the perk!");
- 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_perk[id])
- ilosc[id] = 1;
- return PLUGIN_CONTINUE;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement