Zplague
Gostaria de reagir a esta mensagem? Crie uma conta em poucos cliques ou inicie sessão para continuar.

Zplague Entrar

Seu portal de Zombie Plague no Brasil


description[AJUDA] Não Consigo Configurar O Boss Pra Da AP QUANTO PERDE SAGUE Empty[AJUDA] Não Consigo Configurar O Boss Pra Da AP QUANTO PERDE SAGUE

more_horiz
Bom Galera To Com um Boss Muito namoral tem como alguem me ajudar ae ele ta normal so nao da AP quando atira nele tem como alguem me ajudar a configura ae 
    

Código:

SMA DO BOSS

new const npc_mdl[] = "models/firemonster/firemonster.mdl"
new const npc_ball_mdl[] = "models/firemonster/fireball.mdl"
new const npc_ball_fire1[] = "sprites/firemonster/flame.spr"
new const hp_spr[] = "sprites/firemonster/firemonsterhp.spr"
new const npc_sound[15][] = {
   "firemonster/firemonster_zbs_death.wav",      
   "firemonster/firemonster_fireball_explode.wav",
   "firemonster/firemonster_zbs_attack4.wav",
   "firemonster/firemonster_zbs_attack5.wav",
   "firemonster/firemonster_zbs_fireball1.wav",
   "firemonster/firemonster_zbs_fireball2.wav",
   "firemonster/firemonster_scene_appear.wav",
   "firemonster/boss_footstep_1.wav",
   "firemonster/boss_footstep_2.wav",
   "firemonster/firemonster_zbs_dash_ready.wav",
   "firemonster/firemonster_zbs_burning2.wav",
   "firemonster/firemonster_zbs_idle1.wav",
   "firemonster/firemonster_zbs_attack1.wav",
   "firemonster/firemonster_zbs_fail.wav",
   "firemonster/firemonster_zbs_clear.wav"
}
#define npc_healthpoints 50000.0   // Firemonster health
#define npc_skill5 30.0         // Firemonster fireball damage
#define npc_skill5_radius 250.0      // Firemonster fireball explosion radius
#define npc_do_exp_radius 350.0      // Firemonster circle fire explosion radius
#define npc_skill3_damage 30.0      // Firemonster circle fire damage
#define npc_skill4_damage 40.0      // Firemonster dash damage
#define npc_simple_attack_damage 40.0   // Firemonster simple attack damage
#define npc_start_think 1
#define npc_clear 2
#define npc_agression 3
#define npc_restart 4
#define npc_create 5
#define npc_ability 6
#define npc_think_player 7
#define npc_brightning 8
#define npc_set_attack3 9
#define npc_idle 10
#define npc_reload_skill 11
#define npc_throw_ball1 12
#define npc_clear_ball0 13
#define npc_use_skill2 14
#define npc_clear_skill2 15
#define npc_ball_think1 16
#define npc_skill3 17
#define npc_run 18
#define npc_stop 19
#define npc_simple_attack 20
#define npc_simple_attack2 21
#define map_music 22
new y_constant, y_finder, y_ball1, y_ball2, y_ball3 , y_think, y_bleeding[2], y_run, y_hpbar
new y_npc_mdl, y_ball_ent[5], y_start_npc, y_npc_hp, y_start_thinking, y_agression
new Float:ball_position[3], Float:ball_position1[3], Float:ball_position2[3], Float:ball_position3[3]
new Float:HAngles[3], Float:VAngles[3], Float:y_spawn_points[3]
new hitflesh[1][] =
{
   "player/bhit_kevlar-1.wav"
}
new const map_sound[2][] = {
   "sound/firemonster/scenario_ready.mp3",
   "sound/firemonster/scenario_start.mp3"
}
#define PLUGIN "NPC Firemonster"   // Firemonster
#define VERSION "Public Final"
#define AUTHOR "Glamurnaya Kisa"
#include <amxmodx>
#include <engine>
#include <fakemeta>
#include <fakemeta_+>         // Fakemeta_Util + Sql
#include <hamsandwich>
#include < xs >
#include <cstrike>
public plugin_init()
{
   register_clcmd("get_position", "npc_position")
   register_clcmd("make_firemonster", "create_firemonster")
   register_clcmd("npc_attack4", "npc_attack4_ent")
   register_clcmd("npc_attack3", "npc_attack3_ent")
   register_clcmd("npc_attack2", "npc_attack2_ent")
   register_clcmd("npc_attack1", "npc_attack1_ent")
   register_think("npc_firemonster", "npc_firemonster_think")
   register_touch("npc_firemonster", "*", "npc_firemonster_touch")
   register_think("npc_ball", "npc_ball_think")
   register_touch("npc_ball", "*", "npc_ball_touch")
   register_think("npc_ball_fire1", "npc_ball_fire1_think")
   register_event("HLTV", "event_newround", "a", "1=0", "2=0")
   register_logevent("event_roundstart", 2, "1=Round_Start")
   register_logevent("event_roundend", 2, "1=Round_End")
   RegisterHam(Ham_Spawn, "player", "player_spawn", 1)
   register_plugin(PLUGIN, VERSION, AUTHOR)
}
public player_spawn(id)
{
   if(is_user_connected(id))
   {
      cs_set_user_money(id, 16000)
   }
}
public enemy_distance(entid)
{
   new Float:range2
   new Float:maxrange=2000.0
   new indexid=0
   for(new i=1;i<=get_maxplayers();i++)
   {
      if(is_user_alive(i) && is_valid_ent(i) && attacking1(entid, i))
      {
         range2 = entity_range(entid, i)
         if(range2 <= maxrange)
         {
            maxrange=range2
            indexid=i
         }
      }         
   }   
   return (indexid) ? indexid : 0
}
public follow_player(ent, Float:ent_place[3], target, Float:player_place[3])
{
   if(target)
   {
      new Float:newAngle[3]
      entity_get_vector(ent, EV_VEC_angles, newAngle)
      new Float:x = player_place[0] - ent_place[0]
      new Float:z = player_place[1] - ent_place[1]
      new Float:radians = floatatan(z/x, radian)
      newAngle[1] = radians * (180 / 3.14)
      if (player_place[0] < ent_place[0])
         newAngle[1] -= 180.0
            entity_set_vector(ent, EV_VEC_v_angle, newAngle)
      entity_set_vector(ent, EV_VEC_angles, newAngle)
   }
}
public bool:attacking1(entindex1, entindex2)
{
   if (!entindex1 || !entindex2)
      return false
   if (pev_valid(entindex1) && pev_valid(entindex1))
   {
      new flags = pev(entindex1, pev_flags)
      if (flags & EF_NODRAW || flags & FL_NOTARGET)
      {
         return false
      }
      new Float:lookerOrig[3]
      new Float:targetBaseOrig[3]
      new Float:targetOrig[3]
      new Float:temp[3]
      pev(entindex1, pev_origin, lookerOrig)
      pev(entindex1, pev_view_ofs, temp)
      lookerOrig[0] += temp[0]
      lookerOrig[1] += temp[1]
      lookerOrig[2] += temp[2]
      pev(entindex2, pev_origin, targetBaseOrig)
      pev(entindex2, pev_view_ofs, temp)
      targetOrig[0] = targetBaseOrig [0] + temp[0]
      targetOrig[1] = targetBaseOrig [1] + temp[1]
      targetOrig[2] = targetBaseOrig [2] + temp[2]
      engfunc(EngFunc_TraceLine, lookerOrig, targetOrig, 0, entindex1, 0)
      if (get_tr2(0, TraceResult:TR_InOpen) && get_tr2(0, TraceResult:TR_InWater))
      {
         return false
      }
      else
      {
         new Float:flFraction
         get_tr2(0, TraceResult:TR_flFraction, flFraction)
         if (flFraction == 1.0 || (get_tr2(0, TraceResult:TR_pHit) == entindex2))
         {
            return true
         }
         else
         {
            targetOrig[0] = targetBaseOrig [0]
            targetOrig[1] = targetBaseOrig [1]
            targetOrig[2] = targetBaseOrig [2]
            engfunc(EngFunc_TraceLine, lookerOrig, targetOrig, 0, entindex1, 0)
            get_tr2(0, TraceResult:TR_flFraction, flFraction)
            if (flFraction == 1.0 || (get_tr2(0, TraceResult:TR_pHit) == entindex2))
            {
               return true
            }
            else
            {
               targetOrig[0] = targetBaseOrig [0]
               targetOrig[1] = targetBaseOrig [1]
               targetOrig[2] = targetBaseOrig [2] - 17.0
               engfunc(EngFunc_TraceLine, lookerOrig, targetOrig, 0, entindex1, 0)
               get_tr2(0, TraceResult:TR_flFraction, flFraction)
               if (flFraction == 1.0 || (get_tr2(0, TraceResult:TR_pHit) == entindex2))
               {
                  return true
               }
            }
         }
      }
   }
   return false
}
public control_ai(ent, victim, Float:speed)
{
   static Float:fl_Velocity[3]
   static Float:VicOrigin[3], Float:EntOrigin[3]
   pev(ent, pev_origin, EntOrigin)
   pev(victim, pev_origin, VicOrigin)
   static Float:distance_f
   distance_f = get_distance_f(EntOrigin, VicOrigin)
   if (distance_f > 60.0)
   {
      new Float:fl_Time = distance_f / speed

      fl_Velocity[0] = (VicOrigin[0] - EntOrigin[0]) / fl_Time
      fl_Velocity[1] = (VicOrigin[1] - EntOrigin[1]) / fl_Time
      fl_Velocity[2] = 0.0
   } else
   {
      fl_Velocity[0] = 0.0
      fl_Velocity[1] = 0.0
      fl_Velocity[2] = 0.0
   }
   entity_set_vector(ent, EV_VEC_velocity, fl_Velocity)
}
public event_roundstart()
{
   client_cmd(0, "mp3 play %s", map_sound[1])
   set_task(0.0, "create_firemonster", npc_create)
   set_task(180.0, "replay_music", map_music)
   set_task(1.0, "player1", npc_think_player, _, _, "b")
}
public player1()
{
   static player[32], player_num
   get_players(player, player_num, "a")
   if(player_num <= 0)
   {
      client_cmd(0, "stopsound")   
      client_cmd(0, "spk %s", npc_sound[14])
      set_task(3.0, "replay_game")
      remove_task(npc_think_player)
   } else {
      if(pev_valid(y_think) && pev(y_think, pev_iuser3) == 1)
      {
         client_cmd(0, "stopsound")   
         client_cmd(0, "spk %s", npc_sound[13])
         set_task(3.0, "replay_game")
         remove_task(npc_think_player)
      }
   }
}
public replay_game()
{
   server_cmd("sv_restartround 10")
}
public event_roundend()
{
   client_cmd(0, "stopsound")   
   remove_task(map_music)
}
public replay_music()
{
   client_cmd(0, "mp3 play %s", map_sound[1])   
   set_task(180.0, "replay_music", map_music)
}
public event_newround()
{   
   if(pev_valid(y_think))
   {
      y_constant = 0
      remove_task(y_think+npc_run)
      remove_task(y_think+npc_stop)
      remove_task(y_think+npc_agression)
      remove_task(y_think+npc_brightning)
      remove_task(y_think+npc_set_attack3)
      remove_task(y_think+npc_reload_skill)      
      remove_task(y_think+npc_use_skill2)
      remove_task(y_think+npc_clear_skill2)   
      remove_task(y_think+npc_start_think)
      remove_task(y_think+npc_clear)   
      remove_task(y_think+npc_restart)
      delete_ball(y_think)
      remove_entity_name("npc_firemonster")   
   }
   remove_task(npc_create)
   remove_task(map_music)
   remove_task(npc_think_player)
   if(pev_valid(y_hpbar)) remove_entity(y_hpbar)
   for(new i = 0; i < sizeof(y_ball_ent); i++)
   {
      if(pev_valid(y_ball_ent[i]))
         remove_entity(y_ball_ent[i])
   }
   client_cmd(0, "mp3 play %s", map_sound[0])   
}
public npc_position(id)
{
   pev(id, pev_origin, HAngles)
   pev(id, pev_angles, VAngles)
   VAngles[0] = 0.0
}
public plugin_cfg()                  // Cvar's goes here
{
   server_cmd("mp_buytime 9999.0")
   server_cmd("mp_freezetime 20.0")
   server_cmd("sv_restartround 5")
   server_cmd("mp_timelimit 9999.0")
}
public plugin_precache()
{
   y_npc_hp = precache_model("sprites/zerogxplode.spr")
   y_npc_mdl = precache_model(npc_mdl)
   precache_model(npc_ball_mdl)
   precache_model(npc_ball_fire1)
   precache_model(hp_spr)
   for(new i = 0; i < sizeof(npc_sound); i++)
      precache_sound(npc_sound[i])
   for(new i=0; i<1; i++)
      precache_sound(hitflesh[i])
   for(new i = 0; i < sizeof(map_sound); i++)
      precache_generic(map_sound[i])   
   y_bleeding[0] = precache_model("sprites/blood.spr")
   y_bleeding[1] = precache_model("sprites/bloodspray.spr")   
   static mapname[64]
   get_mapname(mapname, sizeof(mapname))         // Firemonster spawn points
   if(equal(mapname, "zs_dangerous"))         // Can be added manually with waypoint util
   {
      y_spawn_points[0] = 243.0
      y_spawn_points[1] = 109.0
      y_spawn_points[2] = -412.0
   }
   if(equal(mapname, "zs_egypt"))
   {
      y_spawn_points[0] = 138.0
      y_spawn_points[1] = -263.0
      y_spawn_points[2] = 36.0
   }
   if(equal(mapname, "zs_construction"))
   {
      y_spawn_points[0] = -308.0
      y_spawn_points[1] = -168.0
      y_spawn_points[2] = 612.0
   }
   if(equal(mapname, "zs_behind"))
   {
      y_spawn_points[0] = 706.0
      y_spawn_points[1] = 1192.0
      y_spawn_points[2] = 120.0
   }
}
public fire_attack3(ent)
{
   ent -= npc_set_attack3
   if(!pev_valid(ent))
      return
   static Float:explosion[24][3], Float:ball_place[24][3]   
   explosion[0][0] = 200.0
   explosion[0][1] = 0.0
   explosion[0][2] = 500.0
   explosion[1][0] = 400.0
   explosion[1][1] = 0.0
   explosion[1][2] = 500.0
   explosion[2][0] = -200.0
   explosion[2][1] = 0.0
   explosion[2][2] = 500.0
   explosion[3][0] = -400.0
   explosion[3][1] = 0.0
   explosion[3][2] = 500.0
   explosion[4][0] = 0.0
   explosion[4][1] = 200.0
   explosion[4][2] = 500.0
   explosion[5][0] = 0.0
   explosion[5][1] = 400.0
   explosion[5][2] = 500.0
   explosion[6][0] = 0.0
   explosion[6][1] = -200.0
   explosion[6][2] = 500.0
   explosion[7][0] = 0.0
   explosion[7][1] = -400.0
   explosion[7][2] = 500.0
   explosion[8][0] = 200.0
   explosion[8][1] = 200.0
   explosion[8][2] = 500.0
   explosion[9][0] = 400.0
   explosion[9][1] = 400.0
   explosion[9][2] = 500.0
   explosion[10][0] = 200.0
   explosion[10][1] = 400.0
   explosion[10][2] = 500.0
   explosion[11][0] = 400.0
   explosion[11][1] = 200.0
   explosion[11][2] = 500.0
   explosion[12][0] = -200.0
   explosion[12][1] = 200.0
   explosion[12][2] = 500.0
   explosion[13][0] = -400.0
   explosion[13][1] = 400.0
   explosion[13][2] = 500.0
   explosion[14][0] = -200.0
   explosion[14][1] = 400.0
   explosion[14][2] = 500.0
   explosion[15][0] = -400.0
   explosion[15][1] = 200.0
   explosion[15][2] = 500.0
   explosion[16][0] = -200.0
   explosion[16][1] = -200.0
   explosion[17][2] = 500.0
   explosion[17][0] = -200.0
   explosion[17][1] = -200.0
   explosion[17][2] = 500.0
   explosion[18][0] = -200.0
   explosion[18][1] = -400.0
   explosion[18][2] = 500.0
   explosion[19][0] = -400.0
   explosion[19][1] = -200.0
   explosion[19][2] = 500.0
   explosion[20][0] = 200.0
   explosion[20][1] = -200.0
   explosion[20][2] = 500.0
   explosion[21][0] = 400.0
   explosion[21][1] = -400.0
   explosion[21][2] = 500.0
   explosion[22][0] = 200.0
   explosion[22][1] = -400.0
   explosion[22][2] = 500.0
   explosion[23][0] = 400.0
   explosion[23][1] = -200.0
   explosion[23][2] = 500.0
   for(new i = 0; i < sizeof(explosion); i++)
   {
      get_position(ent, explosion[i][0], explosion[i][1], explosion[i][2], ball_place[i])
      npc_fireball_big(ent, ball_place[i])
   }
   remove_task(ent+npc_brightning)
   set_task(1.0, "fire_attack3", ent+npc_set_attack3)
}
public npc_attack3_ent() npc_attack3(y_think)
public npc_attack4_ent() npc_attack4(y_think)
public npc_attack2_ent() npc_attack2(y_think)
public npc_attack1_ent() npc_attack1(y_think)
public npc_attack_simple(ent)
{
   y_start_thinking = 1
   anim(ent, 8)
   set_pev(ent, pev_movetype, MOVETYPE_NONE)   
   set_task(1.0, "firemonster_simple", ent+npc_simple_attack)
   set_task(2.0, "simple_attack_reload", ent+npc_simple_attack2)   
}
public simple_attack_reload(ent)
{
   ent -= npc_simple_attack2
   y_start_thinking = 0
}
public firemonster_simple(ent)
{
   ent -= npc_simple_attack
   emit_sound(ent, CHAN_BODY, npc_sound[12], 1.0, ATTN_NORM, 0, PITCH_NORM)
   for(new i = 0; i < get_maxplayers(); i++)
   {
      if(is_user_alive(i) && entity_range(ent, i) <= 300.0)
      {
         shake_screen(i)
         ScreenFade(i, 10, {255, 0, 0}, 120)
         ExecuteHam(Ham_TakeDamage, i, 0, i, npc_simple_attack_damage, DMG_SLASH)
      }
   }
}
public npc_attack4(ent)
{
   if(!pev_valid(ent) || y_start_thinking)
      return   
   y_start_thinking = 1
   y_run = 0
   anim(ent, 5)
   for(new i = 0; i < get_maxplayers(); i++)
   {
      if(is_user_alive(i) && entity_range(ent, i) <= 1000)
      {
         shake_screen(i)
      }
   }
   set_pev(ent, pev_movetype, MOVETYPE_NONE)
   set_task(1.5, "run_now", ent+npc_run)
   set_task(2.0, "stop_run", ent+npc_stop)
}
public run_now(ent)
{
   ent -= npc_run
   if(!pev_valid(ent))
      return      
   y_run = 1
   anim(ent, 6)
   set_pev(ent, pev_movetype, MOVETYPE_PUSHSTEP)
   static Float:Origin[3]
   get_position(ent, 1000.0, 0.0, 0.0, Origin)
   control_ai2(ent, Origin, 2000.0)
   for(new i = 0; i < get_maxplayers(); i++)
   {
      if(is_user_alive(i) && entity_range(ent, i) <= 1000)
      {
         shake_screen(i)
      }
   }
}
public npc_firemonster_touch(ent, id)
{
   if(!pev_valid(id))
      return
   if(!y_run)
      return
   y_run = 0
   remove_task(ent+npc_stop)
   set_task(0.1, "stop_run", ent+npc_stop)
   if(is_user_alive(id))
   {
      ExecuteHam(Ham_TakeDamage, id, 0, id, npc_skill4_damage, DMG_SLASH)
      shake_screen(id)
      ScreenFade(id, 10, {255, 0, 0}, 120)
      static Float:Velocity[3]
      Velocity[0] = random_float(1000.0, 2000.0)
      Velocity[1] = random_float(1000.0, 2000.0)
      Velocity[2] = random_float(1000.0, 2000.0)
      set_pev(id, pev_velocity, Velocity)
   }
}
public stop_run(ent)
{
   ent -= npc_stop
   y_run = 0
   y_start_thinking = 1
   anim(ent, 7)
   for(new i = 0; i < get_maxplayers(); i++)
   {
      if(is_user_alive(i) && entity_range(ent, i) <= 1000)
      {
         shake_screen(i)
      }
   }
   set_pev(ent, pev_movetype, MOVETYPE_NONE)
   set_task(0.5, "reload_run", ent)
}
public reload_run(ent)
{
   y_start_thinking = 0
   anim(ent, 2)
   entity_set_float(ent, EV_FL_nextthink, get_gametime() + 1.0)
}
public npc_attack3(ent)
{
   if(!pev_valid(ent) || y_start_thinking)
      return   
   y_start_thinking = 1
   anim(ent, 12)
   set_pev(ent, pev_movetype, MOVETYPE_NONE)
   static Float:Origin[3]
   get_position(ent, 150.0, 0.0, 50.0, Origin)
   emit_sound(ent, CHAN_BODY, npc_sound[3], 1.0, ATTN_NORM, 0, PITCH_NORM)
   for(new i = 0; i < get_maxplayers(); i++)
   {
      if(is_user_alive(i) && entity_range(ent, i) <= 4000)
      {
         shake_screen(i)
         ScreenFade(i, 10, {255, 0, 0}, 120)
      }
   }
   set_task(4.0, "fire_attack3", ent+npc_set_attack3)
   set_task(10.0, "remove_attack3", ent+npc_idle)
}
public npc_fireball_big(fireboss, Float:Origin[3])
{
   new ent = create_entity("info_target")
   static Float:Angles[3]
   pev(fireboss, pev_angles, Angles)
   entity_set_origin(ent, Origin)
   Angles[0] = -100.0
   entity_set_vector(ent, EV_VEC_angles, Angles)
   Angles[0] = 100.0
   entity_set_vector(ent, EV_VEC_v_angle, Angles)
   entity_set_string(ent, EV_SZ_classname, "npc_ball")
   entity_set_model(ent, npc_ball_mdl)
   entity_set_int(ent, EV_INT_solid, 2)
   entity_set_int(ent, EV_INT_movetype, MOVETYPE_FLY)
   new Float:maxs[3] = {15.0, 15.0, 15.0}
   new Float:mins[3] = {-15.0, -15.0, -15.0}
   entity_set_size(ent, mins, maxs)
   set_pev(ent, pev_owner, fireboss)
   static Float:Velocity[3]
   VelocityByAim(ent, random_num(250, 1000), Velocity)
   set_pev(ent, pev_light_level, 180)
   set_pev(ent, pev_rendermode, kRenderTransAdd)
   set_pev(ent, pev_renderamt, 255.0)   
   entity_set_vector(ent, EV_VEC_velocity, Velocity)
   burning(ent, 0.5)
}
public remove_attack3(ent)
{
   ent -= npc_idle
   if(!pev_valid(ent))
      return   
   remove_task(ent+npc_brightning)
   remove_task(ent+npc_set_attack3)
   set_task(2.0, "delete_attack3", ent+npc_reload_skill)
}
public delete_attack3(ent)
{
   ent -= npc_reload_skill
   anim(ent, 2)
   set_pev(ent, pev_movetype, MOVETYPE_NONE)
   y_start_thinking = 0
   set_pev(ent, pev_nextthink, get_gametime() + 2.0)
}
public brightning(ent)
{
   ent -= npc_brightning
   if(!pev_valid(ent))
   {
      remove_task(ent+npc_brightning)
      return
   }
   static Float:Origin[3]
   pev(ent, pev_origin, Origin)
   message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
   write_byte(27)
   engfunc(EngFunc_WriteCoord, Origin[0])
   engfunc(EngFunc_WriteCoord, Origin[1])
   engfunc(EngFunc_WriteCoord, Origin[2])
   write_byte(150)
   write_byte(255)
   write_byte(0)
   write_byte(0)
   write_byte(60)
   write_byte(0)
   message_end()   
}
public npc_attack2(ent)
{
   if(!pev_valid(ent) || y_start_thinking)
      return   
   y_start_thinking = 1
   y_constant = 3
   anim(ent, 11)
   set_pev(ent, pev_movetype, MOVETYPE_NONE)
   emit_sound(ent, CHAN_BODY, npc_sound[2], 1.0, ATTN_NORM, 0, PITCH_NORM)
   set_task(0.25, "create_attack2", ent+npc_use_skill2)
   set_task(0.5, "create_attack2", ent+npc_use_skill2)
   set_task(0.75, "create_attack2", ent+npc_use_skill2)
   set_task(2.0, "delete_attack2", ent+npc_clear_skill2)
}
public delete_attack2(ent)
{
   ent -= npc_clear_skill2
   y_start_thinking = 0
   y_constant = 0   
   anim(ent, 2)
   set_pev(ent, pev_movetype, MOVETYPE_NONE)
   set_pev(ent, pev_nextthink, get_gametime() + 1.0)
}
public create_attack2(ent)
{
   ent -= npc_use_skill2
   static Float:explosion[8][3], Float:ball_place[8][3]
   if(y_constant == 3)
   {
      explosion[0][0] = 100.0
      explosion[0][1] = 0.0
      explosion[0][2] = 0.0
      explosion[1][0] = 50.0
      explosion[1][1] = 50.0
      explosion[1][2] = 0.0
      explosion[2][0] = 0.0
      explosion[2][1] = 100.0
      explosion[2][2] = 0.0
      explosion[3][0] = -50.0
      explosion[3][1] = -100.0
      explosion[3][2] = 0.0
      explosion[4][0] = -100.0
      explosion[4][1] = 0.0
      explosion[4][2] = 0.0
      explosion[5][0] = -50.0
      explosion[5][1] = -50.0
      explosion[5][2] = 0.0
      explosion[6][0] = 0.0
      explosion[6][1] = -50.0
      explosion[6][2] = 0.0
      explosion[7][0] = 50.0
      explosion[7][1] = -50.0
      explosion[7][2] = 0.0
   } else if(y_constant == 2) {
      explosion[0][0] = 200.0
      explosion[0][1] = 0.0
      explosion[0][2] = 0.0
      explosion[1][0] = 100.0
      explosion[1][1] = 100.0
      explosion[1][2] = 0.0
      explosion[2][0] = 0.0
      explosion[2][1] = 200.0
      explosion[2][2] = 0.0
      explosion[3][0] = -100.0
      explosion[3][1] = -200.0
      explosion[3][2] = 0.0
      explosion[4][0] = -200.0
      explosion[4][1] = 0.0
      explosion[4][2] = 0.0
      explosion[5][0] = -100.0
      explosion[5][1] = -100.0
      explosion[5][2] = 0.0
      explosion[6][0] = 0.0
      explosion[6][1] = -100.0
      explosion[6][2] = 0.0
      explosion[7][0] = 100.0
      explosion[7][1] = -100.0
      explosion[7][2] = 0.0         
   } else if(y_constant == 1) {
      explosion[0][0] = 300.0
      explosion[0][1] = 0.0
      explosion[0][2] = 0.0
      explosion[1][0] = 150.0
      explosion[1][1] = 150.0
      explosion[1][2] = 0.0
      explosion[2][0] = 0.0
      explosion[2][1] = 300.0
      explosion[2][2] = 0.0
      explosion[3][0] = -150.0
      explosion[3][1] = -300.0
      explosion[3][2] = 0.0
      explosion[4][0] = -300.0
      explosion[4][1] = 0.0
      explosion[4][2] = 0.0
      explosion[5][0] = -150.0
      explosion[5][1] = -150.0
      explosion[5][2] = 0.0
      explosion[6][0] = 0.0
      explosion[6][1] = -150.0
      explosion[6][2] = 0.0
      explosion[7][0] = 150.0
      explosion[7][1] = -150.0
      explosion[7][2] = 0.0      
   }
   for(new i = 0; i < sizeof(explosion); i++)
   {
      get_position(ent, explosion[i][0], explosion[i][1], explosion[i][2], ball_place[i])
      bomb_explosion(ent, ball_place[i])
   }   
   y_constant--
}
public bomb_explosion(ent, Float:Origin[3])
{
   message_begin(MSG_BROADCAST ,SVC_TEMPENTITY)
   write_byte(TE_EXPLOSION)
   engfunc(EngFunc_WriteCoord, Origin[0])
   engfunc(EngFunc_WriteCoord, Origin[1])
   engfunc(EngFunc_WriteCoord, Origin[2])
   write_short(y_npc_hp)
   write_byte(10)
   write_byte(30)
   write_byte(4)
   message_end()   
   emit_sound(ent, CHAN_BODY, npc_sound[1], 1.0, ATTN_NORM, 0, PITCH_NORM)
   for(new i = 0; i < get_maxplayers(); i++)
   {
      if(is_user_alive(i))
      {
         static Float:Origin2[3], Float:distance
         pev(i, pev_origin, Origin2)
         distance = get_distance_f(Origin, Origin2)
         if(distance <= npc_do_exp_radius)
         {
            shake_screen(i)
            ExecuteHam(Ham_TakeDamage, i, 0, i, npc_skill3_damage, DMG_BURN)
            ScreenFade(i, 3, {255, 0, 0}, 120)
            static Float:Velocity[3]
            Velocity[0] = random_float(250.0, 750.0)
            Velocity[1] = random_float(250.0, 750.0)
            Velocity[2] = random_float(250.0, 750.0)
            set_pev(i, pev_velocity, Velocity)
         }
      }
   }
}
public npc_attack1(ent)
{
   if(!pev_valid(ent) || y_start_thinking)
      return
   delete_ball(ent)
   y_start_thinking = 1
   static random_mode
   random_mode = random_num(0, 1)
   switch(random_mode)
   {
      case 0: {
         anim(ent, 9)
         set_pev(ent, pev_movetype, MOVETYPE_NONE)
         set_task(1.0, "ball1_out", y_think+npc_ball_think1)   
         emit_sound(ent, CHAN_BODY, npc_sound[4], 1.0, ATTN_NORM, 0, PITCH_NORM)
      }
      case 1: {
         anim(ent, 10)
         set_pev(ent, pev_movetype, MOVETYPE_NONE)
         set_task(1.0, "ball_out2", y_think+npc_ball_think1)      
         emit_sound(ent, CHAN_BODY, npc_sound[5], 1.0, ATTN_NORM, 0, PITCH_NORM)
      }
   }
}
public delete_ball(ent)
{
   y_start_thinking = 0
   remove_task(ent+npc_ball_think1)
   remove_task(ent+npc_skill3)
   remove_entity_name("npc_ball")
}
public ball1_out(ent)
{
   ent -= npc_ball_think1
   static Float:Origin[3], ball_left, ball_right
   ball_position1[0] = 0.0
   ball_position1[1] = 0.0
   ball_position1[2] = 0.0      
   get_position(ent, 50.0, -25.0, 100.0, Origin)
   ball_left = make_ball(ent, Origin)   
   y_ball1 = 50
   set_pev(ball_left, pev_iuser4, 2)
   set_pev(ball_left, pev_nextthink, get_gametime() + 0.5)
   ball_position[0] = 0.0
   ball_position[1] = 0.0
   ball_position[2] = 0.0   
   get_position(ent, 50.0, 50.0, 100.0, Origin)   
   ball_right = make_ball(ent, Origin)
   y_finder = 50
   set_pev(ball_right, pev_iuser4, 1)
   set_pev(ball_right, pev_nextthink, get_gametime() + 0.7)
   set_task(1.5, "recharge", ent+npc_skill3)
}
public ball_out2(ent)
{
   ent -= npc_ball_think1
   static Float:Origin[3], ball_left, ball_right
   ball_position1[0] = 0.0
   ball_position1[1] = 0.0
   ball_position1[2] = 0.0      
   get_position(ent, 50.0, -25.0, 100.0, Origin)
   ball_left = make_ball(ent, Origin)   
   y_ball1 = 50
   set_pev(ball_left, pev_iuser4, 2)
   set_pev(ball_left, pev_nextthink, get_gametime() + 0.1)   
   ball_position[0] = 0.0
   ball_position[1] = 0.0
   ball_position[2] = 0.0   
   get_position(ent, 50.0, 50.0, 100.0, Origin)   
   ball_right = make_ball(ent, Origin)
   y_finder = 50
   set_pev(ball_right, pev_iuser4, 1)
   set_pev(ball_right, pev_nextthink, get_gametime() + 0.2)
   set_task(0.5, "ball_out3", ent)
   set_task(2.0, "recharge", ent+npc_skill3)
}
public ball_out3(ent)
{
   static Float:Origin[3],ball_left, ball_right
   ball_position3[0] = 0.0
   ball_position3[1] = 0.0
   ball_position3[2] = 0.0      
   get_position(ent, 50.0, -25.0, 100.0, Origin)
   ball_left = make_ball(ent, Origin)   
   y_ball3 = 50
   set_pev(ball_left, pev_iuser4, 4)
   set_pev(ball_left, pev_nextthink, get_gametime() + 0.1)   
   ball_position2[0] = 0.0
   ball_position2[1] = 0.0
   ball_position2[2] = 0.0   
   get_position(ent, 50.0, 50.0, 100.0, Origin)   
   ball_right = make_ball(ent, Origin)
   y_ball2 = 50
   set_pev(ball_right, pev_iuser4, 3)
   set_pev(ball_right, pev_nextthink, get_gametime() + 0.2)   
}
public recharge(ent)
{
   ent -= npc_skill3
   y_start_thinking = 0
   set_pev(ent, pev_nextthink, get_gametime() + 1.0)
}
public make_ball(fireboss, Float:Origin[3])
{
   new ent = create_entity("info_target")
   entity_set_origin(ent, Origin)
   entity_set_string(ent, EV_SZ_classname, "npc_ball")
   entity_set_model(ent, npc_ball_mdl)
   entity_set_int(ent, EV_INT_solid, 0)
   entity_set_int(ent, EV_INT_movetype, 0)
   new Float:maxs[3] = {15.0, 15.0, 15.0}
   new Float:mins[3] = {-15.0, -15.0, -15.0}
   entity_set_size(ent, mins, maxs)
   set_pev(ent, pev_owner, fireboss)
   set_pev(ent, pev_light_level, 180)
   set_pev(ent, pev_rendermode, kRenderTransAdd)
   set_pev(ent, pev_renderamt, 255.0)
   burning(ent, 0.5)
   return ent
}
public burning(ball, Float:size)
{
   static ent
   ent = create_entity("env_sprite")
   set_pev(ent, pev_takedamage, 0.0)
   set_pev(ent, pev_solid, SOLID_NOT)
   set_pev(ent, pev_movetype, MOVETYPE_NONE)
   set_pev(ent, pev_classname, "npc_ball_fire1")
   engfunc(EngFunc_SetModel, ent, npc_ball_fire1)
   set_pev(ent, pev_rendermode, kRenderTransAdd)
   set_pev(ent, pev_renderamt, 255.0)
   set_pev(ent, pev_light_level, 180)
   set_pev(ent, pev_scale, size)
   set_pev(ent, pev_owner, ball)
   set_pev(ent, pev_animtime, get_gametime())
   set_pev(ent, pev_framerate, 8.0)
   set_pev(ent, pev_frame, 0.1)
   set_pev(ent, pev_spawnflags, SF_SPRITE_STARTON)
   dllfunc(DLLFunc_Spawn, ent)
   npc_ball_fire1_think(ent)
   set_pev(ent, pev_nextthink, get_gametime() + 0.01)
   return ent
}
public npc_ball_fire1_think(ent)
{
   if(!pev_valid(ent))
      return
   if(!pev_valid(pev(ent, pev_owner)))
   {
      remove_entity(ent)
      return
   }
   static owner
   owner = pev(ent, pev_owner)
   static Float:Origin[3]
   pev(owner, pev_origin, Origin)
   Origin[2] += 25.0
   entity_set_origin(ent, Origin)
   set_pev(ent, pev_nextthink, get_gametime() + 0.01)
}
public npc_ball_think(ent)
{
   if(!pev_valid(ent))
      return
   if(y_finder > 0 && pev(ent, pev_iuser4) == 1)
   {   
      static Float:Origin[3]
      switch(y_finder)
      {
         case 35..40: {
            ball_position[2] += 0.5
            get_position(ent, ball_position[0], ball_position[1], ball_position[2], Origin)
            set_pev(ent, pev_origin, Origin)
            static owner
            owner = pev(ent, pev_owner)
            
            if(pev_valid(owner))
               player_follow2(owner)   
         }   
         case 20..34: {
            ball_position[0] += 0.1
            ball_position[1] += 0.25            
            get_position(ent, ball_position[0], ball_position[1], ball_position[2], Origin)
            set_pev(ent, pev_origin, Origin)
            static owner
            owner = pev(ent, pev_owner)
            if(pev_valid(owner))
               player_follow2(owner)   
         }   
         case 5..19: {
            ball_position[2] -= 0.5
            ball_position[1] -= 0.5
            ball_position[0] -= 0.1
            get_position(ent, ball_position[0], ball_position[1], ball_position[2], Origin)
            set_pev(ent, pev_origin, Origin)
            static owner
            owner = pev(ent, pev_owner)
            if(pev_valid(owner))
               player_follow2(owner)   
         }
         case 4: {
            static owner, Float:Velocity[3]
            owner = pev(ent, pev_owner)
            get_position(owner, 1000.0, 0.0, -100.0, Velocity)
            fm_get_aim_origin(owner, Velocity)
            entity_set_int(ent, EV_INT_solid, 2)
            set_pev(ent, pev_movetype, MOVETYPE_FLY)
            control_ai2(ent, Velocity, random_float(2000.0, 4000.0))
            y_finder = 0
         }
      }
      if(y_finder > 0)
      y_finder--
   }
   if(y_ball1 > 0 && pev(ent, pev_iuser4) == 2)
   {   
      static Float:Origin[3]
      switch(y_ball1)
      {
         case 35..40: {
            ball_position1[2] += 0.5
            get_position(ent, ball_position1[0], ball_position1[1], ball_position1[2], Origin)
            set_pev(ent, pev_origin, Origin)
            static owner
            owner = pev(ent, pev_owner)
            if(pev_valid(owner))
               player_follow2(owner)   
         }   
         case 20..34: {
            ball_position1[0] -= 0.1
            ball_position1[1] += 0.25   
            get_position(ent, ball_position1[0], ball_position1[1], ball_position1[2], Origin)
            set_pev(ent, pev_origin, Origin)
            static owner
            owner = pev(ent, pev_owner)
            if(pev_valid(owner))
               player_follow2(owner)   
         }   
         case 5..19: {
            ball_position1[2] -= 0.5
            ball_position1[1] -= 0.5
            ball_position1[0] += 0.1
            get_position(ent, ball_position1[0], ball_position1[1], ball_position1[2], Origin)
            set_pev(ent, pev_origin, Origin)
            static owner
            owner = pev(ent, pev_owner)
            if(pev_valid(owner))
               player_follow2(owner)   
         }
         case 4: {
            static owner, Float:Velocity[3]
            owner = pev(ent, pev_owner)
            get_position(owner, 1000.0, 0.0, -100.0, Velocity)
            fm_get_aim_origin(owner, Velocity)
            entity_set_int(ent, EV_INT_solid, 2)
            set_pev(ent, pev_movetype, MOVETYPE_FLY)
            control_ai2(ent, Velocity, random_float(2000.0, 4000.0))
            y_ball1 = 0
         }
      }
      if(y_ball1 > 0)
      y_ball1--
   }   
   if(y_ball2 > 0 && pev(ent, pev_iuser4) == 3)
   {   
      static Float:Origin[3]
      switch(y_ball2)
      {
         case 35..40: {
            ball_position2[2] += 0.5
            get_position(ent, ball_position2[0], ball_position2[1], ball_position2[2], Origin)
            set_pev(ent, pev_origin, Origin)
            static owner
            owner = pev(ent, pev_owner)
            if(pev_valid(owner))
               player_follow2(owner)   
         }   
         case 20..34: {
            ball_position2[0] += 0.1
            ball_position2[1] += 0.25            
            get_position(ent, ball_position2[0], ball_position2[1], ball_position2[2], Origin)
            set_pev(ent, pev_origin, Origin)
            static owner
            owner = pev(ent, pev_owner)
            if(pev_valid(owner))
               player_follow2(owner)   
         }   
         case 5..19: {
            ball_position2[2] -= 0.5
            ball_position2[1] -= 0.5
            ball_position2[0] -= 0.1
            get_position(ent, ball_position2[0], ball_position2[1], ball_position2[2], Origin)
            set_pev(ent, pev_origin, Origin)
            static owner
            owner = pev(ent, pev_owner)
            if(pev_valid(owner))
               player_follow2(owner)   
         }
         case 4: {
            static owner, Float:Velocity[3]
            owner = pev(ent, pev_owner)
            get_position(owner, 1000.0, 0.0, -100.0, Velocity)
            fm_get_aim_origin(owner, Velocity)
            entity_set_int(ent, EV_INT_solid, 2)
            set_pev(ent, pev_movetype, MOVETYPE_FLY)
            control_ai2(ent, Velocity, 2000.0)
            y_finder = 0
         }
      }
      if(y_ball2 > 0)
      y_ball2--
   }
   if(y_ball3 > 0 && pev(ent, pev_iuser4) == 4)
   {   
      static Float:Origin[3]
      switch(y_ball3)
      {
         case 35..40: {
            ball_position3[2] += 0.5
            get_position(ent, ball_position3[0], ball_position3[1], ball_position3[2], Origin)
            set_pev(ent, pev_origin, Origin)
            static owner
            owner = pev(ent, pev_owner)
            if(pev_valid(owner))
               player_follow2(owner)   
         }   
         case 20..34: {
            ball_position1[0] -= 0.1
            ball_position1[1] += 0.25   
            get_position(ent, ball_position3[0], ball_position3[1], ball_position3[2], Origin)
            set_pev(ent, pev_origin, Origin)
            static owner
            owner = pev(ent, pev_owner)
            if(pev_valid(owner))
               player_follow2(owner)   
         }   
         case 5..19: {
            ball_position3[2] -= 0.5
            ball_position3[1] -= 0.5
            ball_position3[0] += 0.1
            get_position(ent, ball_position3[0], ball_position3[1], ball_position3[2], Origin)
            set_pev(ent, pev_origin, Origin)
            static owner
            owner = pev(ent, pev_owner)
            if(pev_valid(owner))
               player_follow2(owner)               
         }
         case 4: {
            static owner, Float:Velocity[3]
            owner = pev(ent, pev_owner)
            get_position(owner, 1000.0, 0.0, -100.0, Velocity)
            fm_get_aim_origin(owner, Velocity)
            entity_set_int(ent, EV_INT_solid, 2)
            set_pev(ent, pev_movetype, MOVETYPE_FLY)
            control_ai2(ent, Velocity, 2000.0)
            y_ball3 = 0
         }
      }
      if(y_ball3 > 0)
      y_ball3--
   }      
   set_pev(ent, pev_nextthink, get_gametime() + 0.01)
}
public player_follow2(ent)
{
   static victim
   victim = pev(ent, pev_iuser4)
   if(!is_user_alive(victim))
      return
   new Float:ent_place[3], Float:player_place[3]
   pev(ent, pev_origin, ent_place)
   pev(victim, pev_origin, player_place)
   follow_player(ent, ent_place, victim, player_place)      
}
public npc_ball_touch(ent, id)
{
   if(!pev_valid(ent))
      return
   static Float:Origin[3]
   pev(ent, pev_origin, Origin)
   message_begin(MSG_BROADCAST ,SVC_TEMPENTITY)
   write_byte(TE_EXPLOSION)
   engfunc(EngFunc_WriteCoord, Origin[0])
   engfunc(EngFunc_WriteCoord, Origin[1])
   engfunc(EngFunc_WriteCoord, Origin[2])
   write_short(y_npc_hp)
   write_byte(10)
   write_byte(30)
   write_byte(4)
   message_end()   
   emit_sound(ent, CHAN_BODY, npc_sound[1], 1.0, ATTN_NORM, 0, PITCH_NORM)
   for(new i = 0; i < get_maxplayers(); i++)
   {
      if(is_user_alive(i) && entity_range(ent, i) <= npc_skill5_radius)
      {
         shake_screen(i)
         ExecuteHam(Ham_TakeDamage, i, 0, i, npc_skill5, DMG_BURN)
         ScreenFade(i, 3, {255, 0, 0}, 120)
      }
   }
   remove_entity(ent)
}
public create_firemonster()
{
   new ent = create_entity("info_target")
   y_think = ent
   static Float:Origin[3]
   Origin[0] = y_spawn_points[0]
   Origin[1] = y_spawn_points[1]
   Origin[2] = y_spawn_points[2]
   entity_set_origin(ent, Origin)
   entity_set_float(ent, EV_FL_takedamage, 1.0)
   entity_set_float(ent, EV_FL_health, npc_healthpoints + 1000.0)
   entity_set_string(ent, EV_SZ_classname, "npc_firemonster")
   entity_set_model(ent, npc_mdl)
   entity_set_int(ent, EV_INT_solid, SOLID_BBOX)
   entity_set_int(ent, EV_INT_movetype, MOVETYPE_PUSHSTEP)
   new Float:maxs[3] = {25.0, 50.0, 200.0}
   new Float:mins[3] = {-25.0, -50.0, -35.0}
   entity_set_size(ent, mins, maxs)
   entity_set_int(ent, EV_INT_modelindex, y_npc_mdl)
   anim(ent, 1)
   set_pev(ent, pev_movetype, MOVETYPE_NONE)
   set_task(14.0, "fireboss_done", ent+npc_start_think)         // Firemonster prepare time
   set_rendering(ent,kRenderFxNone,255,255,255,kRenderTransAdd,200)
   if(!y_start_npc)
   {
      y_start_npc = 1
      RegisterHamFromEntity(Ham_TakeDamage, ent, "firemonster_take_damage", 1)
   }
   y_constant = 0
   emit_sound(ent, CHAN_BODY, npc_sound[6], 1.0, ATTN_NORM, 0, PITCH_NORM)
   y_hpbar = create_entity("env_sprite")
   set_pev(y_hpbar, pev_scale, 0.4)
   set_pev(y_hpbar, pev_owner, ent)
   engfunc(EngFunc_SetModel, y_hpbar, hp_spr)   
   set_task(0.1, "fireboss_ready", ent+npc_restart, _, _, "b")
   set_task(random_float(7.0, 15.0), "punish", npc_ability)
   drop_to_floor(ent)
}
public punish()
{
   static ent
   ent = y_think
   if(!pev_valid(ent))
      return
   static victim
   victim = pev(ent, pev_iuser4)
   set_task(random_float(5.0, 15.0), "punish", npc_ability)
   if(!is_user_alive(victim))
      return
   static random_skill
   if(y_agression)
   {
      random_skill = random_num(0, 3)      
      switch(random_skill)
      {
         case 0: npc_attack1(ent)
         case 1: npc_attack2(ent)
         case 2: npc_attack3(ent)
         case 3: npc_attack4(ent)
      }
   } else {
      random_skill = random_num(0, 3)   
      switch(random_skill)
      {
         case 0: npc_attack1(ent)
         case 1: npc_attack2(ent)
         case 2: npc_attack4(ent)
      }   
   }
}
public fireboss_ready(ent)
{
   ent -= npc_restart
   if(!pev_valid(ent))
   {
      remove_task(ent+npc_restart)
      return
   }
   static Float:Origin[3], Float:firemonster_health
   pev(ent, pev_origin, Origin)
   Origin[2] += 250.0   
   engfunc(EngFunc_SetOrigin, y_hpbar, Origin)
   pev(ent, pev_health, firemonster_health)
   if(npc_healthpoints < (firemonster_health - 1000.0))
   {
      set_pev(y_hpbar, pev_frame, 100.0)
   }
   else
   {
      set_pev(y_hpbar, pev_frame, 0.0 + ((((firemonster_health - 1000.0) - 1 ) * 100) / npc_healthpoints))
   }      
}
public fireboss_done(ent)
{
   ent -= npc_start_think
   anim(ent, 2)
   set_pev(ent, pev_movetype, MOVETYPE_NONE)
   set_pev(ent, pev_nextthink, get_gametime() + 0.1)
}
public npc_firemonster_think(ent)
{
   if(!pev_valid(ent))
      return
   if(pev(ent, pev_iuser3))
      return
   if(pev(ent, pev_health) - 1000.0 < 0.0)
   {
      firemonster_death(ent)
      set_pev(ent, pev_iuser3, 1)
      return
   }
   
   if(!y_agression && (pev(ent, pev_health) - 1000.0) <= (npc_healthpoints / 2) && !y_start_thinking)
   {
      y_agression = 1
      y_start_thinking = 1
      agressive2(ent)
      return
   }
   if(!y_start_thinking)
   {
      static victim
      static Float:Origin[3], Float:VicOrigin[3], Float:distance
      victim = enemy_distance(ent)
      pev(ent, pev_origin, Origin)
      pev(victim, pev_origin, VicOrigin)
      distance = get_distance_f(Origin, VicOrigin)
      if(is_user_alive(victim))
      {
         if(distance <= 200.0)
         {
            npc_attack_simple(ent)
            set_pev(ent, pev_nextthink, get_gametime() + 2.5)
         } else {
            if(pev(ent, pev_sequence) != 4)
               anim(ent, 4)
            set_pev(ent, pev_movetype, MOVETYPE_PUSHSTEP)
            set_rendering (ent,kRenderFxNone,255,255,255,kRenderNormal,16)
            for(new i = 0; i < get_maxplayers(); i++)
            {
               if(is_user_alive(i) && entity_range(ent, i) <= 600)
               {
                  shake_screen(i)
               }
            }
            new Float:ent_place[3], Float:player_place[3]
            pev(ent, pev_origin, ent_place)
            pev(victim, pev_origin, player_place)
            follow_player(ent, ent_place, victim, player_place)
            control_ai(ent, victim, 200.0)
            if(pev(ent, pev_iuser4) != victim)
               set_pev(ent, pev_iuser4, victim)
            set_pev(ent, pev_nextthink, get_gametime() + 0.1)
         }
      } else {
         if(pev(ent, pev_sequence) != 2)
            anim(ent, 2)
         set_pev(ent, pev_nextthink, get_gametime() + 1.0)
      }      
   } else {
      set_pev(ent, pev_nextthink, get_gametime() + 2.0)
   }
   return
}
public agressive2(ent)
{
   anim(ent, 14)
   set_pev(ent, pev_movetype, MOVETYPE_NONE)
   set_rendering(ent,kRenderFxNone,255,255,255,kRenderTransAdd,200)
   for(new i = 0; i < get_maxplayers(); i++)
   {
      if(is_user_alive(i) && entity_range(ent, i) <= 4000)
      {
         shake_screen(i)
         ScreenFade(i, 15, {255, 0, 0}, 120)
      }
   }
   set_task(10.0, "off_agression2", ent+npc_agression)
}
public off_agression2(ent)
{
   ent -= npc_agression
   anim(ent, 2)
   set_pev(ent, pev_movetype, MOVETYPE_NONE)
   y_start_thinking = 0
   set_pev(ent, pev_nextthink, get_gametime() + 1.0)
}
public firemonster_death(ent)
{   
   anim(ent, 16)
   emit_sound(ent, CHAN_BODY, npc_sound[0], 1.0, ATTN_NORM, 0, PITCH_NORM)
        set_pev(ent, pev_movetype, MOVETYPE_FLY)
        set_pev(ent, pev_solid, SOLID_NOT)
        set_pev(ent, pev_velocity, {0.0, 0.0, 0.0})
        set_pev(ent, pev_deadflag, DEAD_DYING)
        remove_task(npc_ability)
   set_task(10.0, "delete_firemonster", ent)
        return HAM_SUPERCEDE   
}
public delete_firemonster(ent)
{
   remove_entity(ent)
   remove_entity(y_hpbar)
}
public firemonster_take_damage(victim, inflictor, attacker, Float:damage, damagebits)
{
   static Float:Origin[3]
   fm_get_aim_origin(attacker, Origin)
   create_blood(Origin)
   emit_sound(victim, CHAN_BODY, hitflesh[0], 1.0, ATTN_NORM, 0, PITCH_NORM)   
}
stock ScreenFade(id, Timer, Colors[3], Alpha) {   
   message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("ScreenFade"), _, id);
   write_short((1<<12) * Timer)
   write_short(1<<12)
   write_short(0)
   write_byte(Colors[0])
   write_byte(Colors[1])
   write_byte(Colors[2])
   write_byte(Alpha)
   message_end()
}
stock shake_screen(id)
{
   message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("ScreenShake"),{0,0,0}, id)
   write_short(1<<14)
   write_short(1<<13)
   write_short(1<<13)
   message_end()
}
stock anim(ent, sequence) {
        set_pev(ent, pev_sequence, sequence)
        set_pev(ent, pev_animtime, halflife_time())
        set_pev(ent, pev_framerate, 1.0)
}
stock control_ai2(ent, Float:VicOrigin[3], Float:speed)
{
   static Float:fl_Velocity[3]
   static Float:EntOrigin[3]
   pev(ent, pev_origin, EntOrigin)
   static Float:distance_f
   distance_f = get_distance_f(EntOrigin, VicOrigin)
   if (distance_f > 60.0)
   {
      new Float:fl_Time = distance_f / speed
      fl_Velocity[0] = (VicOrigin[0] - EntOrigin[0]) / fl_Time
      fl_Velocity[1] = (VicOrigin[1] - EntOrigin[1]) / fl_Time
      fl_Velocity[2] = (VicOrigin[2] - EntOrigin[2]) / fl_Time
   } else {
      fl_Velocity[0] = 0.0
      fl_Velocity[1] = 0.0
      fl_Velocity[2] = 0.0
   }
   entity_set_vector(ent, EV_VEC_velocity, fl_Velocity)
}
stock get_position(ent, Float:forw, Float:right, Float:up, Float:vStart[])
{
   new Float:vOrigin[3], Float:vAngle[3], Float:vForward[3], Float:vRight[3], Float:vUp[3]
   pev(ent, pev_origin, vOrigin)
   pev(ent, pev_view_ofs,vUp)
   xs_vec_add(vOrigin,vUp,vOrigin)
   pev(ent, pev_v_angle, vAngle)
   vAngle[0] = 0.0
   angle_vector(vAngle,ANGLEVECTOR_FORWARD,vForward)
   angle_vector(vAngle,ANGLEVECTOR_RIGHT,vRight)
   angle_vector(vAngle,ANGLEVECTOR_UP,vUp)
   vStart[0] = vOrigin[0] + vForward[0] * forw + vRight[0] * right + vUp[0] * up
   vStart[1] = vOrigin[1] + vForward[1] * forw + vRight[1] * right + vUp[1] * up
   vStart[2] = vOrigin[2] + vForward[2] * forw + vRight[2] * right + vUp[2] * up
}
stock create_blood(const Float:origin[3])
{
   message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
   write_byte(TE_BLOODSPRITE)
   engfunc(EngFunc_WriteCoord, origin[0])
   engfunc(EngFunc_WriteCoord, origin[1])
   engfunc(EngFunc_WriteCoord, origin[2])
   write_short(y_bleeding[1])
   write_short(y_bleeding[0])
   write_byte(75)
   write_byte(5)
   message_end()
}

description[AJUDA] Não Consigo Configurar O Boss Pra Da AP QUANTO PERDE SAGUE EmptyRe: [AJUDA] Não Consigo Configurar O Boss Pra Da AP QUANTO PERDE SAGUE

more_horiz
eu acho que ja existe esse mesmo boss que dá AmmoPacks Dps Dou Uma Procurada no meu outro pc  Zplague12  

description[AJUDA] Não Consigo Configurar O Boss Pra Da AP QUANTO PERDE SAGUE EmptyRe: [AJUDA] Não Consigo Configurar O Boss Pra Da AP QUANTO PERDE SAGUE

more_horiz
Testa ai:

Código:

new const npc_mdl[] = "models/firemonster/firemonster.mdl"
new const npc_ball_mdl[] = "models/firemonster/fireball.mdl"
new const npc_ball_fire1[] = "sprites/firemonster/flame.spr"
new const hp_spr[] = "sprites/firemonster/firemonsterhp.spr"
new const npc_sound[15][] = {
   "firemonster/firemonster_zbs_death.wav",      
   "firemonster/firemonster_fireball_explode.wav",
   "firemonster/firemonster_zbs_attack4.wav",
   "firemonster/firemonster_zbs_attack5.wav",
   "firemonster/firemonster_zbs_fireball1.wav",
   "firemonster/firemonster_zbs_fireball2.wav",
   "firemonster/firemonster_scene_appear.wav",
   "firemonster/boss_footstep_1.wav",
   "firemonster/boss_footstep_2.wav",
   "firemonster/firemonster_zbs_dash_ready.wav",
   "firemonster/firemonster_zbs_burning2.wav",
   "firemonster/firemonster_zbs_idle1.wav",
   "firemonster/firemonster_zbs_attack1.wav",
   "firemonster/firemonster_zbs_fail.wav",
   "firemonster/firemonster_zbs_clear.wav"
}
#define npc_healthpoints 50000.0   // Firemonster health
#define npc_skill5 30.0         // Firemonster fireball damage
#define npc_skill5_radius 250.0      // Firemonster fireball explosion radius
#define npc_do_exp_radius 350.0      // Firemonster circle fire explosion radius
#define npc_skill3_damage 30.0      // Firemonster circle fire damage
#define npc_skill4_damage 40.0      // Firemonster dash damage
#define npc_simple_attack_damage 40.0   // Firemonster simple attack damage
#define npc_start_think 1
#define npc_clear 2
#define npc_agression 3
#define npc_restart 4
#define npc_create 5
#define npc_ability 6
#define npc_think_player 7
#define npc_brightning 8
#define npc_set_attack3 9
#define npc_idle 10
#define npc_reload_skill 11
#define npc_throw_ball1 12
#define npc_clear_ball0 13
#define npc_use_skill2 14
#define npc_clear_skill2 15
#define npc_ball_think1 16
#define npc_skill3 17
#define npc_run 18
#define npc_stop 19
#define npc_simple_attack 20
#define npc_simple_attack2 21
#define map_music 22
new y_constant, y_finder, y_ball1, y_ball2, y_ball3 , y_think, y_bleeding[2], y_run, y_hpbar
new y_npc_mdl, y_ball_ent[5], y_start_npc, y_npc_hp, y_start_thinking, y_agression
new Float:ball_position[3], Float:ball_position1[3], Float:ball_position2[3], Float:ball_position3[3]
new Float:HAngles[3], Float:VAngles[3], Float:y_spawn_points[3]
new cvar_dmg_ap_allow, cvar_ammodamage, cvar_ammo_quantity, g_damagedealt[33], cvar_kill_rwd_ap
new hitflesh[1][] = 
{
"player/bhit_kevlar-1.wav"
}
new const map_sound[2][] = {
"sound/firemonster/scenario_ready.mp3",
"sound/firemonster/scenario_start.mp3"
}
#define PLUGIN "NPC Firemonster"   // Firemonster
#define VERSION "Public Final"
#define AUTHOR "Glamurnaya Kisa"
#include <amxmodx>
#include <engine>
#include <fakemeta_util>
#include <hamsandwich>
#include <  xs >
#include <zombieplague>
public plugin_init()
{
   register_plugin(PLUGIN, VERSION, AUTHOR)
   
   register_clcmd("get_position", "npc_position")
   register_clcmd("make_firemonster", "create_firemonster")
   register_clcmd("npc_attack4", "npc_attack4_ent")
   register_clcmd("npc_attack3", "npc_attack3_ent")
   register_clcmd("npc_attack2", "npc_attack2_ent")
   register_clcmd("npc_attack1", "npc_attack1_ent")
   register_think("npc_firemonster", "npc_firemonster_think")
   register_touch("npc_firemonster", "*", "npc_firemonster_touch")
   register_think("npc_ball", "npc_ball_think")
   register_touch("npc_ball", "*", "npc_ball_touch")
   register_think("npc_ball_fire1", "npc_ball_fire1_think")
   register_event("HLTV", "event_newround", "a", "1=0", "2=0")
   register_logevent("event_roundstart", 2, "1=Round_Start")
   register_logevent("event_roundend", 2, "1=Round_End")
   
   cvar_dmg_ap_allow = register_cvar("zp_firemonster_dmg_ap_reward_allow", "1")      // Ganhar Ammo Packs Por Dano
   cvar_ammodamage = register_cvar("zp_firemonster_dmg_for_reward", "250")       // Dmg Necessario Para Ganhar Ammo Packs
   cvar_ammo_quantity  = register_cvar("zp_firemonster_reward_ap_quantity", "2")    // Quantia de Ammo Packs que ira ganhar
   cvar_kill_rwd_ap = register_cvar("zp_firemonster_kill_ap_rwd", "100")    // Quantia de Ammo Packs que ira ganhar ao Matar o Fire Monster

public enemy_distance(entid)
{
   new Float:range2
   new Float:maxrange=2000.0
   new indexid=0
   for(new i=1;i<=get_maxplayers();i++)
   {
      if(is_user_alive(i) && is_valid_ent(i) && attacking1(entid, i))
      {
         range2 = entity_range(entid, i)
         if(range2 <= maxrange)
         {
            maxrange=range2
            indexid=i
         }
      }         
   }   
   return (indexid) ? indexid : 0
}
public follow_player(ent, Float:ent_place[3], target, Float:player_place[3]) 
{
   if(target) 
   {
      new Float:newAngle[3]
      entity_get_vector(ent, EV_VEC_angles, newAngle)
      new Float:x = player_place[0] - ent_place[0]
      new Float:z = player_place[1] - ent_place[1]
      new Float:radians = floatatan(z/x, radian)
      newAngle[1] = radians * (180 / 3.14)
      if (player_place[0] < ent_place[0])
      {
         newAngle[1] -= 180.0
         entity_set_vector(ent, EV_VEC_v_angle, newAngle)
         entity_set_vector(ent, EV_VEC_angles, newAngle)
      }
   }
}
public bool:attacking1(entindex1, entindex2)
{
   if (!entindex1 || !entindex2)
      return false
   if (pev_valid(entindex1) && pev_valid(entindex1))
   {
      new flags = pev(entindex1, pev_flags)
      if (flags & EF_NODRAW || flags & FL_NOTARGET)
      {
         return false
      }
      new Float:lookerOrig[3]
      new Float:targetBaseOrig[3]
      new Float:targetOrig[3]
      new Float:temp[3]
      pev(entindex1, pev_origin, lookerOrig)
      pev(entindex1, pev_view_ofs, temp)
      lookerOrig[0] += temp[0]
      lookerOrig[1] += temp[1]
      lookerOrig[2] += temp[2]
      pev(entindex2, pev_origin, targetBaseOrig)
      pev(entindex2, pev_view_ofs, temp)
      targetOrig[0] = targetBaseOrig [0] + temp[0]
      targetOrig[1] = targetBaseOrig [1] + temp[1]
      targetOrig[2] = targetBaseOrig [2] + temp[2]
      engfunc(EngFunc_TraceLine, lookerOrig, targetOrig, 0, entindex1, 0)
      if (get_tr2(0, TraceResult:TR_InOpen) && get_tr2(0, TraceResult:TR_InWater))
      {
         return false
      } 
      else 
      {
         new Float:flFraction
         get_tr2(0, TraceResult:TR_flFraction, flFraction)
         if (flFraction == 1.0 || (get_tr2(0, TraceResult:TR_pHit) == entindex2))
         {
            return true
         }
         else
         {
            targetOrig[0] = targetBaseOrig [0]
            targetOrig[1] = targetBaseOrig [1]
            targetOrig[2] = targetBaseOrig [2]
            engfunc(EngFunc_TraceLine, lookerOrig, targetOrig, 0, entindex1, 0)
            get_tr2(0, TraceResult:TR_flFraction, flFraction)
            if (flFraction == 1.0 || (get_tr2(0, TraceResult:TR_pHit) == entindex2))
            {
               return true
            }
            else
            {
               targetOrig[0] = targetBaseOrig [0]
               targetOrig[1] = targetBaseOrig [1]
               targetOrig[2] = targetBaseOrig [2] - 17.0
               engfunc(EngFunc_TraceLine, lookerOrig, targetOrig, 0, entindex1, 0)
               get_tr2(0, TraceResult:TR_flFraction, flFraction)
               if (flFraction == 1.0 || (get_tr2(0, TraceResult:TR_pHit) == entindex2))
               {
                  return true
               }
            }
         }
      }
   }
   return false
}
public control_ai(ent, victim, Float:speed)
{
   static Float:fl_Velocity[3]
   static Float:VicOrigin[3], Float:EntOrigin[3]
   pev(ent, pev_origin, EntOrigin)
   pev(victim, pev_origin, VicOrigin)
   static Float:distance_f
   distance_f = get_distance_f(EntOrigin, VicOrigin)
   if (distance_f > 60.0)
   {
      new Float:fl_Time = distance_f / speed
      
      fl_Velocity[0] = (VicOrigin[0] - EntOrigin[0]) / fl_Time
      fl_Velocity[1] = (VicOrigin[1] - EntOrigin[1]) / fl_Time
      fl_Velocity[2] = 0.0
   } 
   else
   {
      fl_Velocity[0] = 0.0
      fl_Velocity[1] = 0.0
      fl_Velocity[2] = 0.0
   }
   entity_set_vector(ent, EV_VEC_velocity, fl_Velocity)
}

public event_roundstart()
{
   client_cmd(0, "mp3 play %s", map_sound[1])
   set_task(0.0, "create_firemonster", npc_create)
   set_task(180.0, "replay_music", map_music)
   set_task(1.0, "player1", npc_think_player, _, _, "b")
}
public player1()
{
   static player[32], player_num
   get_players(player, player_num, "a")
   if(player_num <= 0)
   {
      client_cmd(0, "stopsound")   
      client_cmd(0, "spk %s", npc_sound[14])
      set_task(3.0, "replay_game")
      remove_task(npc_think_player)
      } else {
      if(pev_valid(y_think) && pev(y_think, pev_iuser3) == 1)
      {
         client_cmd(0, "stopsound")   
         client_cmd(0, "spk %s", npc_sound[13])
         set_task(3.0, "replay_game")
         remove_task(npc_think_player)
      }
   }
}
public replay_game() server_cmd("sv_restartround 10")

public event_roundend()
{
   client_cmd(0, "stopsound")   
   remove_task(map_music)
}
public replay_music()
{
   client_cmd(0, "mp3 play %s", map_sound[1])   
   set_task(180.0, "replay_music", map_music)
}
public event_newround()
{   
   if(pev_valid(y_think))
   {
      y_constant = 0
      remove_task(y_think+npc_run)
      remove_task(y_think+npc_stop)
      remove_task(y_think+npc_agression)
      remove_task(y_think+npc_brightning)
      remove_task(y_think+npc_set_attack3)
      remove_task(y_think+npc_reload_skill)      
      remove_task(y_think+npc_use_skill2)
      remove_task(y_think+npc_clear_skill2)   
      remove_task(y_think+npc_start_think)
      remove_task(y_think+npc_clear)   
      remove_task(y_think+npc_restart)
      delete_ball(y_think)
      remove_entity_name("npc_firemonster")   
   }
   remove_task(npc_create)
   remove_task(map_music)
   remove_task(npc_think_player)
   if(pev_valid(y_hpbar)) remove_entity(y_hpbar)
   for(new i = 0; i < sizeof(y_ball_ent); i++)
   {
      if(pev_valid(y_ball_ent[i]))
         remove_entity(y_ball_ent[i])
   }
   client_cmd(0, "mp3 play %s", map_sound[0])   
}
public npc_position(id)
{
   pev(id, pev_origin, HAngles)
   pev(id, pev_angles, VAngles)
   VAngles[0] = 0.0
}
public plugin_cfg()                  // Cvar's goes here
{
   server_cmd("mp_buytime 9999.0")
   server_cmd("mp_freezetime 20.0")
   server_cmd("sv_restartround 5")
   server_cmd("mp_timelimit 9999.0")
}
public plugin_precache()
{
   y_npc_hp = precache_model("sprites/zerogxplode.spr")
   y_npc_mdl = precache_model(npc_mdl)
   precache_model(npc_ball_mdl)
   precache_model(npc_ball_fire1)
   precache_model(hp_spr)
   for(new i = 0; i < sizeof(npc_sound); i++)
      precache_sound(npc_sound[i])
   for(new i=0; i<1; i++)
      precache_sound(hitflesh[i])
   for(new i = 0; i < sizeof(map_sound); i++)
      precache_generic(map_sound[i])   
   y_bleeding[0] = precache_model("sprites/blood.spr")
   y_bleeding[1] = precache_model("sprites/bloodspray.spr")   
   static mapname[64]
   get_mapname(mapname, sizeof(mapname))         // Firemonster spawn points 
   if(equal(mapname, "zs_dangerous"))         // Can be added manually with waypoint util
   {
      y_spawn_points[0] = 243.0
      y_spawn_points[1] = 109.0 
      y_spawn_points[2] = -412.0
   }
   if(equal(mapname, "zs_egypt"))
   {
      y_spawn_points[0] = 138.0
      y_spawn_points[1] = -263.0 
      y_spawn_points[2] = 36.0 
   }
   if(equal(mapname, "zs_construction"))
   {
      y_spawn_points[0] = -308.0
      y_spawn_points[1] = -168.0 
      y_spawn_points[2] = 612.0 
   }
   if(equal(mapname, "zs_behind"))
   {
      y_spawn_points[0] = 706.0
      y_spawn_points[1] = 1192.0 
      y_spawn_points[2] = 120.0 
   }
}
public fire_attack3(ent)
{
   ent -= npc_set_attack3
   if(!pev_valid(ent))
      return
   static Float:explosion[24][3], Float:ball_place[24][3]   
   explosion[0][0] = 200.0
   explosion[0][1] = 0.0
   explosion[0][2] = 500.0
   explosion[1][0] = 400.0
   explosion[1][1] = 0.0
   explosion[1][2] = 500.0
   explosion[2][0] = -200.0
   explosion[2][1] = 0.0
   explosion[2][2] = 500.0
   explosion[3][0] = -400.0
   explosion[3][1] = 0.0
   explosion[3][2] = 500.0
   explosion[4][0] = 0.0
   explosion[4][1] = 200.0
   explosion[4][2] = 500.0
   explosion[5][0] = 0.0
   explosion[5][1] = 400.0
   explosion[5][2] = 500.0
   explosion[6][0] = 0.0
   explosion[6][1] = -200.0
   explosion[6][2] = 500.0
   explosion[7][0] = 0.0
   explosion[7][1] = -400.0
   explosion[7][2] = 500.0
   explosion[8][0] = 200.0
   explosion[8][1] = 200.0
   explosion[8][2] = 500.0
   explosion[9][0] = 400.0
   explosion[9][1] = 400.0
   explosion[9][2] = 500.0
   explosion[10][0] = 200.0
   explosion[10][1] = 400.0
   explosion[10][2] = 500.0
   explosion[11][0] = 400.0
   explosion[11][1] = 200.0
   explosion[11][2] = 500.0
   explosion[12][0] = -200.0
   explosion[12][1] = 200.0
   explosion[12][2] = 500.0
   explosion[13][0] = -400.0
   explosion[13][1] = 400.0
   explosion[13][2] = 500.0
   explosion[14][0] = -200.0
   explosion[14][1] = 400.0
   explosion[14][2] = 500.0
   explosion[15][0] = -400.0
   explosion[15][1] = 200.0
   explosion[15][2] = 500.0
   explosion[16][0] = -200.0
   explosion[16][1] = -200.0
   explosion[17][2] = 500.0
   explosion[17][0] = -200.0
   explosion[17][1] = -200.0
   explosion[17][2] = 500.0
   explosion[18][0] = -200.0
   explosion[18][1] = -400.0
   explosion[18][2] = 500.0
   explosion[19][0] = -400.0
   explosion[19][1] = -200.0
   explosion[19][2] = 500.0
   explosion[20][0] = 200.0
   explosion[20][1] = -200.0
   explosion[20][2] = 500.0
   explosion[21][0] = 400.0
   explosion[21][1] = -400.0
   explosion[21][2] = 500.0
   explosion[22][0] = 200.0
   explosion[22][1] = -400.0
   explosion[22][2] = 500.0
   explosion[23][0] = 400.0
   explosion[23][1] = -200.0
   explosion[23][2] = 500.0
   for(new i = 0; i < sizeof(explosion); i++)
   {
      get_position(ent, explosion[i][0], explosion[i][1], explosion[i][2], ball_place[i])
      npc_fireball_big(ent, ball_place[i])
   }
   remove_task(ent+npc_brightning)
   set_task(1.0, "fire_attack3", ent+npc_set_attack3)
}
public npc_attack3_ent() npc_attack3(y_think)
public npc_attack4_ent() npc_attack4(y_think)
public npc_attack2_ent() npc_attack2(y_think)
public npc_attack1_ent() npc_attack1(y_think)
public npc_attack_simple(ent)
{
   y_start_thinking = 1
   anim(ent, 8)
   set_pev(ent, pev_movetype, MOVETYPE_NONE)   
   set_task(1.0, "firemonster_simple", ent+npc_simple_attack)
   set_task(2.0, "simple_attack_reload", ent+npc_simple_attack2)   
}
public simple_attack_reload(ent)
{
   ent -= npc_simple_attack2
   y_start_thinking = 0
}
public firemonster_simple(ent)
{
   ent -= npc_simple_attack
   emit_sound(ent, CHAN_BODY, npc_sound[12], 1.0, ATTN_NORM, 0, PITCH_NORM)
   for(new i = 0; i < get_maxplayers(); i++)
   {
      if(is_user_alive(i) && entity_range(ent, i) <= 300.0)
      {
         shake_screen(i)
         ScreenFade(i, 10, {255, 0, 0}, 120)
         ExecuteHam(Ham_TakeDamage, i, 0, i, npc_simple_attack_damage, DMG_SLASH)
      }
   }
}
public npc_attack4(ent)
{
   if(!pev_valid(ent) || y_start_thinking)
      return   
   y_start_thinking = 1
   y_run = 0
   anim(ent, 5)
   for(new i = 0; i < get_maxplayers(); i++)
   {
      if(is_user_alive(i) && entity_range(ent, i) <= 1000)
      {
         shake_screen(i)
      }
   }
   set_pev(ent, pev_movetype, MOVETYPE_NONE)
   set_task(1.5, "run_now", ent+npc_run)
   set_task(2.0, "stop_run", ent+npc_stop)
}
public run_now(ent)
{
   ent -= npc_run
   if(!pev_valid(ent))
      return      
   y_run = 1
   anim(ent, 6)
   set_pev(ent, pev_movetype, MOVETYPE_PUSHSTEP)
   static Float:Origin[3]
   get_position(ent, 1000.0, 0.0, 0.0, Origin)
   control_ai2(ent, Origin, 2000.0)
   for(new i = 0; i < get_maxplayers(); i++)
   {
      if(is_user_alive(i) && entity_range(ent, i) <= 1000)
      {
         shake_screen(i)
      }
   }
}
public npc_firemonster_touch(ent, id)
{
   if(!pev_valid(id))
      return
   if(!y_run)
      return
   y_run = 0
   remove_task(ent+npc_stop)
   set_task(0.1, "stop_run", ent+npc_stop)
   if(is_user_alive(id))
   {
      ExecuteHam(Ham_TakeDamage, id, 0, id, npc_skill4_damage, DMG_SLASH)
      shake_screen(id)
      ScreenFade(id, 10, {255, 0, 0}, 120)
      static Float:Velocity[3]
      Velocity[0] = random_float(1000.0, 2000.0)
      Velocity[1] = random_float(1000.0, 2000.0)
      Velocity[2] = random_float(1000.0, 2000.0)
      set_pev(id, pev_velocity, Velocity)
   }
}
public stop_run(ent)
{
   ent -= npc_stop
   y_run = 0
   y_start_thinking = 1
   anim(ent, 7)
   for(new i = 0; i < get_maxplayers(); i++)
   {
      if(is_user_alive(i) && entity_range(ent, i) <= 1000)
      {
         shake_screen(i)
      }
   }
   set_pev(ent, pev_movetype, MOVETYPE_NONE)
   set_task(0.5, "reload_run", ent)
}
public reload_run(ent)
{
   y_start_thinking = 0
   anim(ent, 2)
   entity_set_float(ent, EV_FL_nextthink, get_gametime() + 1.0)
}
public npc_attack3(ent)
{
   if(!pev_valid(ent) || y_start_thinking)
      return   
   y_start_thinking = 1
   anim(ent, 12)
   set_pev(ent, pev_movetype, MOVETYPE_NONE)
   static Float:Origin[3]
   get_position(ent, 150.0, 0.0, 50.0, Origin)
   emit_sound(ent, CHAN_BODY, npc_sound[3], 1.0, ATTN_NORM, 0, PITCH_NORM)
   for(new i = 0; i < get_maxplayers(); i++)
   {
      if(is_user_alive(i) && entity_range(ent, i) <= 4000)
      {
         shake_screen(i)
         ScreenFade(i, 10, {255, 0, 0}, 120)
      }
   }
   set_task(4.0, "fire_attack3", ent+npc_set_attack3)
   set_task(10.0, "remove_attack3", ent+npc_idle)
}
public npc_fireball_big(fireboss, Float:Origin[3])
{
   new ent = create_entity("info_target")
   static Float:Angles[3]
   pev(fireboss, pev_angles, Angles)
   entity_set_origin(ent, Origin)
   Angles[0] = -100.0
   entity_set_vector(ent, EV_VEC_angles, Angles)
   Angles[0] = 100.0
   entity_set_vector(ent, EV_VEC_v_angle, Angles)
   entity_set_string(ent, EV_SZ_classname, "npc_ball")
   entity_set_model(ent, npc_ball_mdl)
   entity_set_int(ent, EV_INT_solid, 2)
   entity_set_int(ent, EV_INT_movetype, MOVETYPE_FLY)
   new Float:maxs[3] = {15.0, 15.0, 15.0}
   new Float:mins[3] = {-15.0, -15.0, -15.0}
   entity_set_size(ent, mins, maxs)
   set_pev(ent, pev_owner, fireboss)
   static Float:Velocity[3]
   VelocityByAim(ent, random_num(250, 1000), Velocity)
   set_pev(ent, pev_light_level, 180)
   set_pev(ent, pev_rendermode, kRenderTransAdd)
   set_pev(ent, pev_renderamt, 255.0)   
   entity_set_vector(ent, EV_VEC_velocity, Velocity)
   burning(ent, 0.5)
}
public remove_attack3(ent)
{
   ent -= npc_idle
   if(!pev_valid(ent))
      return   
   remove_task(ent+npc_brightning)
   remove_task(ent+npc_set_attack3)
   set_task(2.0, "delete_attack3", ent+npc_reload_skill)
}
public delete_attack3(ent)
{
   ent -= npc_reload_skill
   anim(ent, 2)
   set_pev(ent, pev_movetype, MOVETYPE_NONE)
   y_start_thinking = 0
   set_pev(ent, pev_nextthink, get_gametime() + 2.0)
}
public brightning(ent)
{
   ent -= npc_brightning
   if(!pev_valid(ent))
   {
      remove_task(ent+npc_brightning)
      return
   }
   static Float:Origin[3]
   pev(ent, pev_origin, Origin)
   message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
   write_byte(27)
   engfunc(EngFunc_WriteCoord, Origin[0])
   engfunc(EngFunc_WriteCoord, Origin[1])
   engfunc(EngFunc_WriteCoord, Origin[2])
   write_byte(150)
   write_byte(255)
   write_byte(0)
   write_byte(0)
   write_byte(60)
   write_byte(0)
   message_end()   
}
public npc_attack2(ent)
{
   if(!pev_valid(ent) || y_start_thinking)
      return   
   y_start_thinking = 1
   y_constant = 3
   anim(ent, 11)
   set_pev(ent, pev_movetype, MOVETYPE_NONE)
   emit_sound(ent, CHAN_BODY, npc_sound[2], 1.0, ATTN_NORM, 0, PITCH_NORM)
   set_task(0.25, "create_attack2", ent+npc_use_skill2)
   set_task(0.5, "create_attack2", ent+npc_use_skill2)
   set_task(0.75, "create_attack2", ent+npc_use_skill2)
   set_task(2.0, "delete_attack2", ent+npc_clear_skill2)
}
public delete_attack2(ent)
{
   ent -= npc_clear_skill2
   y_start_thinking = 0
   y_constant = 0   
   anim(ent, 2)
   set_pev(ent, pev_movetype, MOVETYPE_NONE)
   set_pev(ent, pev_nextthink, get_gametime() + 1.0)
}
public create_attack2(ent)
{
   ent -= npc_use_skill2
   static Float:explosion[8][3], Float:ball_place[8][3]
   if(y_constant == 3)
   {
      explosion[0][0] = 100.0
      explosion[0][1] = 0.0
      explosion[0][2] = 0.0
      explosion[1][0] = 50.0
      explosion[1][1] = 50.0
      explosion[1][2] = 0.0
      explosion[2][0] = 0.0
      explosion[2][1] = 100.0
      explosion[2][2] = 0.0
      explosion[3][0] = -50.0
      explosion[3][1] = -100.0
      explosion[3][2] = 0.0
      explosion[4][0] = -100.0
      explosion[4][1] = 0.0
      explosion[4][2] = 0.0
      explosion[5][0] = -50.0
      explosion[5][1] = -50.0
      explosion[5][2] = 0.0
      explosion[6][0] = 0.0
      explosion[6][1] = -50.0
      explosion[6][2] = 0.0
      explosion[7][0] = 50.0
      explosion[7][1] = -50.0
      explosion[7][2] = 0.0
      } else if(y_constant == 2) {
      explosion[0][0] = 200.0
      explosion[0][1] = 0.0
      explosion[0][2] = 0.0
      explosion[1][0] = 100.0
      explosion[1][1] = 100.0
      explosion[1][2] = 0.0
      explosion[2][0] = 0.0
      explosion[2][1] = 200.0
      explosion[2][2] = 0.0
      explosion[3][0] = -100.0
      explosion[3][1] = -200.0
      explosion[3][2] = 0.0
      explosion[4][0] = -200.0
      explosion[4][1] = 0.0
      explosion[4][2] = 0.0
      explosion[5][0] = -100.0
      explosion[5][1] = -100.0
      explosion[5][2] = 0.0
      explosion[6][0] = 0.0
      explosion[6][1] = -100.0
      explosion[6][2] = 0.0
      explosion[7][0] = 100.0
      explosion[7][1] = -100.0
      explosion[7][2] = 0.0         
      } else if(y_constant == 1) {
      explosion[0][0] = 300.0
      explosion[0][1] = 0.0
      explosion[0][2] = 0.0
      explosion[1][0] = 150.0
      explosion[1][1] = 150.0
      explosion[1][2] = 0.0
      explosion[2][0] = 0.0
      explosion[2][1] = 300.0
      explosion[2][2] = 0.0
      explosion[3][0] = -150.0
      explosion[3][1] = -300.0
      explosion[3][2] = 0.0
      explosion[4][0] = -300.0
      explosion[4][1] = 0.0
      explosion[4][2] = 0.0
      explosion[5][0] = -150.0
      explosion[5][1] = -150.0
      explosion[5][2] = 0.0
      explosion[6][0] = 0.0
      explosion[6][1] = -150.0
      explosion[6][2] = 0.0
      explosion[7][0] = 150.0
      explosion[7][1] = -150.0
      explosion[7][2] = 0.0      
   }
   for(new i = 0; i < sizeof(explosion); i++)
   {
      get_position(ent, explosion[i][0], explosion[i][1], explosion[i][2], ball_place[i])
      bomb_explosion(ent, ball_place[i])
   }   
   y_constant--
}
public bomb_explosion(ent, Float:Origin[3])
{
   message_begin(MSG_BROADCAST ,SVC_TEMPENTITY)
   write_byte(TE_EXPLOSION)
   engfunc(EngFunc_WriteCoord, Origin[0])
   engfunc(EngFunc_WriteCoord, Origin[1])
   engfunc(EngFunc_WriteCoord, Origin[2])
   write_short(y_npc_hp)
   write_byte(10)
   write_byte(30)
   write_byte(4)
   message_end()   
   emit_sound(ent, CHAN_BODY, npc_sound[1], 1.0, ATTN_NORM, 0, PITCH_NORM)
   for(new i = 0; i < get_maxplayers(); i++)
   {
      if(is_user_alive(i))
      {
         static Float:Origin2[3], Float:distance
         pev(i, pev_origin, Origin2)
         distance = get_distance_f(Origin, Origin2)
         if(distance <= npc_do_exp_radius)
         {
            shake_screen(i)
            ExecuteHam(Ham_TakeDamage, i, 0, i, npc_skill3_damage, DMG_BURN)
            ScreenFade(i, 3, {255, 0, 0}, 120)
            static Float:Velocity[3]
            Velocity[0] = random_float(250.0, 750.0)
            Velocity[1] = random_float(250.0, 750.0)
            Velocity[2] = random_float(250.0, 750.0)
            set_pev(i, pev_velocity, Velocity)
         }
      }
   }
}
public npc_attack1(ent)
{
   if(!pev_valid(ent) || y_start_thinking)
      return
   delete_ball(ent)
   y_start_thinking = 1
   static random_mode
   random_mode = random_num(0, 1)
   switch(random_mode)
   {
      case 0: {
         anim(ent, 9)
         set_pev(ent, pev_movetype, MOVETYPE_NONE)
         set_task(1.0, "ball1_out", y_think+npc_ball_think1)   
         emit_sound(ent, CHAN_BODY, npc_sound[4], 1.0, ATTN_NORM, 0, PITCH_NORM)
      }
      case 1: {
         anim(ent, 10)
         set_pev(ent, pev_movetype, MOVETYPE_NONE)
         set_task(1.0, "ball_out2", y_think+npc_ball_think1)      
         emit_sound(ent, CHAN_BODY, npc_sound[5], 1.0, ATTN_NORM, 0, PITCH_NORM)
      }
   }
}
public delete_ball(ent)
{
   y_start_thinking = 0
   remove_task(ent+npc_ball_think1)
   remove_task(ent+npc_skill3)
   remove_entity_name("npc_ball")
}
public ball1_out(ent)
{
   ent -= npc_ball_think1
   static Float:Origin[3], ball_left, ball_right
   ball_position1[0] = 0.0
   ball_position1[1] = 0.0
   ball_position1[2] = 0.0      
   get_position(ent, 50.0, -25.0, 100.0, Origin)
   ball_left = make_ball(ent, Origin)   
   y_ball1 = 50
   set_pev(ball_left, pev_iuser4, 2)
   set_pev(ball_left, pev_nextthink, get_gametime() + 0.5)
   ball_position[0] = 0.0
   ball_position[1] = 0.0
   ball_position[2] = 0.0   
   get_position(ent, 50.0, 50.0, 100.0, Origin)   
   ball_right = make_ball(ent, Origin)
   y_finder = 50
   set_pev(ball_right, pev_iuser4, 1)
   set_pev(ball_right, pev_nextthink, get_gametime() + 0.7)
   set_task(1.5, "recharge", ent+npc_skill3)
}
public ball_out2(ent)
{
   ent -= npc_ball_think1
   static Float:Origin[3], ball_left, ball_right
   ball_position1[0] = 0.0
   ball_position1[1] = 0.0
   ball_position1[2] = 0.0      
   get_position(ent, 50.0, -25.0, 100.0, Origin)
   ball_left = make_ball(ent, Origin)   
   y_ball1 = 50
   set_pev(ball_left, pev_iuser4, 2)
   set_pev(ball_left, pev_nextthink, get_gametime() + 0.1)   
   ball_position[0] = 0.0
   ball_position[1] = 0.0
   ball_position[2] = 0.0   
   get_position(ent, 50.0, 50.0, 100.0, Origin)   
   ball_right = make_ball(ent, Origin)
   y_finder = 50
   set_pev(ball_right, pev_iuser4, 1)
   set_pev(ball_right, pev_nextthink, get_gametime() + 0.2)
   set_task(0.5, "ball_out3", ent)
   set_task(2.0, "recharge", ent+npc_skill3)
}
public ball_out3(ent)
{
   static Float:Origin[3],ball_left, ball_right
   ball_position3[0] = 0.0
   ball_position3[1] = 0.0
   ball_position3[2] = 0.0      
   get_position(ent, 50.0, -25.0, 100.0, Origin)
   ball_left = make_ball(ent, Origin)   
   y_ball3 = 50
   set_pev(ball_left, pev_iuser4, 4)
   set_pev(ball_left, pev_nextthink, get_gametime() + 0.1)   
   ball_position2[0] = 0.0
   ball_position2[1] = 0.0
   ball_position2[2] = 0.0   
   get_position(ent, 50.0, 50.0, 100.0, Origin)   
   ball_right = make_ball(ent, Origin)
   y_ball2 = 50
   set_pev(ball_right, pev_iuser4, 3)
   set_pev(ball_right, pev_nextthink, get_gametime() + 0.2)   
}
public recharge(ent)
{
   ent -= npc_skill3
   y_start_thinking = 0
   set_pev(ent, pev_nextthink, get_gametime() + 1.0)
}
public make_ball(fireboss, Float:Origin[3])
{
   new ent = create_entity("info_target")
   entity_set_origin(ent, Origin)
   entity_set_string(ent, EV_SZ_classname, "npc_ball")
   entity_set_model(ent, npc_ball_mdl)
   entity_set_int(ent, EV_INT_solid, 0)
   entity_set_int(ent, EV_INT_movetype, 0)
   new Float:maxs[3] = {15.0, 15.0, 15.0}
   new Float:mins[3] = {-15.0, -15.0, -15.0}
   entity_set_size(ent, mins, maxs)
   set_pev(ent, pev_owner, fireboss)
   set_pev(ent, pev_light_level, 180)
   set_pev(ent, pev_rendermode, kRenderTransAdd)
   set_pev(ent, pev_renderamt, 255.0)
   burning(ent, 0.5)
   return ent
}
public burning(ball, Float:size)
{
   static ent
   ent = create_entity("env_sprite")
   set_pev(ent, pev_takedamage, 0.0)
   set_pev(ent, pev_solid, SOLID_NOT)
   set_pev(ent, pev_movetype, MOVETYPE_NONE)
   set_pev(ent, pev_classname, "npc_ball_fire1")
   engfunc(EngFunc_SetModel, ent, npc_ball_fire1)
   set_pev(ent, pev_rendermode, kRenderTransAdd)
   set_pev(ent, pev_renderamt, 255.0)
   set_pev(ent, pev_light_level, 180)
   set_pev(ent, pev_scale, size)
   set_pev(ent, pev_owner, ball)
   set_pev(ent, pev_animtime, get_gametime())
   set_pev(ent, pev_framerate, 8.0)
   set_pev(ent, pev_frame, 0.1)
   set_pev(ent, pev_spawnflags, SF_SPRITE_STARTON)
   dllfunc(DLLFunc_Spawn, ent)
   npc_ball_fire1_think(ent)
   set_pev(ent, pev_nextthink, get_gametime() + 0.01)
   return ent
}
public npc_ball_fire1_think(ent)
{
   if(!pev_valid(ent))
      return
   if(!pev_valid(pev(ent, pev_owner)))
   {
      remove_entity(ent)
      return
   }
   static owner
   owner = pev(ent, pev_owner)
   static Float:Origin[3]
   pev(owner, pev_origin, Origin)
   Origin[2] += 25.0
   entity_set_origin(ent, Origin)
   set_pev(ent, pev_nextthink, get_gametime() + 0.01)
}
public npc_ball_think(ent)
{
   if(!pev_valid(ent))
      return
   if(y_finder > 0 && pev(ent, pev_iuser4) == 1)
   {   
      static Float:Origin[3]
      switch(y_finder)
      {
         case 35..40: {
            ball_position[2] += 0.5
            get_position(ent, ball_position[0], ball_position[1], ball_position[2], Origin)
            set_pev(ent, pev_origin, Origin)
            static owner
            owner = pev(ent, pev_owner)
            
            if(pev_valid(owner))
               player_follow2(owner)   
         }   
         case 20..34: {
            ball_position[0] += 0.1
            ball_position[1] += 0.25            
            get_position(ent, ball_position[0], ball_position[1], ball_position[2], Origin)
            set_pev(ent, pev_origin, Origin)
            static owner
            owner = pev(ent, pev_owner)
            if(pev_valid(owner))
               player_follow2(owner)   
         }   
         case 5..19: {
            ball_position[2] -= 0.5
            ball_position[1] -= 0.5
            ball_position[0] -= 0.1
            get_position(ent, ball_position[0], ball_position[1], ball_position[2], Origin)
            set_pev(ent, pev_origin, Origin)
            static owner
            owner = pev(ent, pev_owner)
            if(pev_valid(owner))
               player_follow2(owner)   
         }
         case 4: {
            static owner, Float:Velocity[3]
            owner = pev(ent, pev_owner)
            get_position(owner, 1000.0, 0.0, -100.0, Velocity)
            fm_get_aim_origin(owner, Velocity)
            entity_set_int(ent, EV_INT_solid, 2)
            set_pev(ent, pev_movetype, MOVETYPE_FLY)
            control_ai2(ent, Velocity, random_float(2000.0, 4000.0))
            y_finder = 0
         }
      }
      if(y_finder > 0)
         y_finder--
   }
   if(y_ball1 > 0 && pev(ent, pev_iuser4) == 2)
   {   
      static Float:Origin[3]
      switch(y_ball1)
      {
         case 35..40: {
            ball_position1[2] += 0.5
            get_position(ent, ball_position1[0], ball_position1[1], ball_position1[2], Origin)
            set_pev(ent, pev_origin, Origin)
            static owner
            owner = pev(ent, pev_owner)
            if(pev_valid(owner))
               player_follow2(owner)   
         }   
         case 20..34: {
            ball_position1[0] -= 0.1
            ball_position1[1] += 0.25   
            get_position(ent, ball_position1[0], ball_position1[1], ball_position1[2], Origin)
            set_pev(ent, pev_origin, Origin)
            static owner
            owner = pev(ent, pev_owner)
            if(pev_valid(owner))
               player_follow2(owner)   
         }   
         case 5..19: {
            ball_position1[2] -= 0.5
            ball_position1[1] -= 0.5
            ball_position1[0] += 0.1
            get_position(ent, ball_position1[0], ball_position1[1], ball_position1[2], Origin)
            set_pev(ent, pev_origin, Origin)
            static owner
            owner = pev(ent, pev_owner)
            if(pev_valid(owner))
               player_follow2(owner)   
         }
         case 4: {
            static owner, Float:Velocity[3]
            owner = pev(ent, pev_owner)
            get_position(owner, 1000.0, 0.0, -100.0, Velocity)
            fm_get_aim_origin(owner, Velocity)
            entity_set_int(ent, EV_INT_solid, 2)
            set_pev(ent, pev_movetype, MOVETYPE_FLY)
            control_ai2(ent, Velocity, random_float(2000.0, 4000.0))
            y_ball1 = 0
         }
      }
      if(y_ball1 > 0)
         y_ball1--
   }   
   if(y_ball2 > 0 && pev(ent, pev_iuser4) == 3)
   {   
      static Float:Origin[3]
      switch(y_ball2)
      {
         case 35..40: {
            ball_position2[2] += 0.5
            get_position(ent, ball_position2[0], ball_position2[1], ball_position2[2], Origin)
            set_pev(ent, pev_origin, Origin)
            static owner
            owner = pev(ent, pev_owner)
            if(pev_valid(owner))
               player_follow2(owner)   
         }   
         case 20..34: {
            ball_position2[0] += 0.1
            ball_position2[1] += 0.25            
            get_position(ent, ball_position2[0], ball_position2[1], ball_position2[2], Origin)
            set_pev(ent, pev_origin, Origin)
            static owner
            owner = pev(ent, pev_owner)
            if(pev_valid(owner))
               player_follow2(owner)   
         }   
         case 5..19: {
            ball_position2[2] -= 0.5
            ball_position2[1] -= 0.5
            ball_position2[0] -= 0.1
            get_position(ent, ball_position2[0], ball_position2[1], ball_position2[2], Origin)
            set_pev(ent, pev_origin, Origin)
            static owner
            owner = pev(ent, pev_owner)
            if(pev_valid(owner))
               player_follow2(owner)   
         }
         case 4: {
            static owner, Float:Velocity[3]
            owner = pev(ent, pev_owner)
            get_position(owner, 1000.0, 0.0, -100.0, Velocity)
            fm_get_aim_origin(owner, Velocity)
            entity_set_int(ent, EV_INT_solid, 2)
            set_pev(ent, pev_movetype, MOVETYPE_FLY)
            control_ai2(ent, Velocity, 2000.0)
            y_finder = 0
         }
      }
      if(y_ball2 > 0)
         y_ball2--
   }
   if(y_ball3 > 0 && pev(ent, pev_iuser4) == 4)
   {   
      static Float:Origin[3]
      switch(y_ball3)
      {
         case 35..40: {
            ball_position3[2] += 0.5
            get_position(ent, ball_position3[0], ball_position3[1], ball_position3[2], Origin)
            set_pev(ent, pev_origin, Origin)
            static owner
            owner = pev(ent, pev_owner)
            if(pev_valid(owner))
               player_follow2(owner)   
         }   
         case 20..34: {
            ball_position1[0] -= 0.1
            ball_position1[1] += 0.25   
            get_position(ent, ball_position3[0], ball_position3[1], ball_position3[2], Origin)
            set_pev(ent, pev_origin, Origin)
            static owner
            owner = pev(ent, pev_owner)
            if(pev_valid(owner))
               player_follow2(owner)   
         }   
         case 5..19: {
            ball_position3[2] -= 0.5
            ball_position3[1] -= 0.5
            ball_position3[0] += 0.1
            get_position(ent, ball_position3[0], ball_position3[1], ball_position3[2], Origin)
            set_pev(ent, pev_origin, Origin)
            static owner
            owner = pev(ent, pev_owner)
            if(pev_valid(owner))
               player_follow2(owner)               
         }
         case 4: {
            static owner, Float:Velocity[3]
            owner = pev(ent, pev_owner)
            get_position(owner, 1000.0, 0.0, -100.0, Velocity)
            fm_get_aim_origin(owner, Velocity)
            entity_set_int(ent, EV_INT_solid, 2)
            set_pev(ent, pev_movetype, MOVETYPE_FLY)
            control_ai2(ent, Velocity, 2000.0)
            y_ball3 = 0
         }
      }
      if(y_ball3 > 0)
         y_ball3--
   }      
   set_pev(ent, pev_nextthink, get_gametime() + 0.01)
}
public player_follow2(ent)
{
   static victim
   victim = pev(ent, pev_iuser4)
   if(!is_user_alive(victim))
      return
   new Float:ent_place[3], Float:player_place[3]
   pev(ent, pev_origin, ent_place)
   pev(victim, pev_origin, player_place)
   follow_player(ent, ent_place, victim, player_place)      
}
public npc_ball_touch(ent, id)
{
   if(!pev_valid(ent))
      return
   static Float:Origin[3]
   pev(ent, pev_origin, Origin)
   message_begin(MSG_BROADCAST ,SVC_TEMPENTITY)
   write_byte(TE_EXPLOSION)
   engfunc(EngFunc_WriteCoord, Origin[0])
   engfunc(EngFunc_WriteCoord, Origin[1])
   engfunc(EngFunc_WriteCoord, Origin[2])
   write_short(y_npc_hp)
   write_byte(10)
   write_byte(30)
   write_byte(4)
   message_end()   
   emit_sound(ent, CHAN_BODY, npc_sound[1], 1.0, ATTN_NORM, 0, PITCH_NORM)
   for(new i = 0; i < get_maxplayers(); i++)
   {
      if(is_user_alive(i) && entity_range(ent, i) <= npc_skill5_radius)
      {
         shake_screen(i)
         ExecuteHam(Ham_TakeDamage, i, 0, i, npc_skill5, DMG_BURN)
         ScreenFade(i, 3, {255, 0, 0}, 120)
      }
   }
   remove_entity(ent)
}
public create_firemonster()
{
   new ent = create_entity("info_target")
   y_think = ent
   static Float:Origin[3]
   Origin[0] = y_spawn_points[0]
   Origin[1] = y_spawn_points[1]
   Origin[2] = y_spawn_points[2]
   entity_set_origin(ent, Origin)
   entity_set_float(ent, EV_FL_takedamage, 1.0)
   entity_set_float(ent, EV_FL_health, npc_healthpoints + 1000.0)
   entity_set_string(ent, EV_SZ_classname, "npc_firemonster")
   entity_set_model(ent, npc_mdl)
   entity_set_int(ent, EV_INT_solid, SOLID_BBOX)
   entity_set_int(ent, EV_INT_movetype, MOVETYPE_PUSHSTEP)
   new Float:maxs[3] = {25.0, 50.0, 200.0}
   new Float:mins[3] = {-25.0, -50.0, -35.0}
   entity_set_size(ent, mins, maxs)
   entity_set_int(ent, EV_INT_modelindex, y_npc_mdl)
   anim(ent, 1)
   set_pev(ent, pev_movetype, MOVETYPE_NONE)
   set_task(14.0, "fireboss_done", ent+npc_start_think)         // Firemonster prepare time
   set_rendering(ent,kRenderFxNone,255,255,255,kRenderTransAdd,200)
   if(!y_start_npc)
   {
      y_start_npc = 1
      RegisterHamFromEntity(Ham_TakeDamage, ent, "firemonster_take_damage", 1)
      RegisterHamFromEntity(Ham_Killed, ent, "firemonster_killed_post")
   }
   y_constant = 0
   emit_sound(ent, CHAN_BODY, npc_sound[6], 1.0, ATTN_NORM, 0, PITCH_NORM)
   y_hpbar = create_entity("env_sprite")
   set_pev(y_hpbar, pev_scale, 0.4)
   set_pev(y_hpbar, pev_owner, ent)
   engfunc(EngFunc_SetModel, y_hpbar, hp_spr)   
   set_task(0.1, "fireboss_ready", ent+npc_restart, _, _, "b")
   set_task(random_float(7.0, 15.0), "punish", npc_ability)
   drop_to_floor(ent)
}

public firemonster_killed_post(ent, attacker)
{
   new name[32]; get_user_name(attacker, name, 31)
   client_printcolor(0, "!g[ZP Firemonster]!t O Jogador !g%s!t Ganhou !g%d!t Ammo Packs Por Matar o Boss", name, get_pcvar_num(cvar_kill_rwd_ap))
   zp_set_user_ammo_packs(attacker, zp_get_user_ammo_packs(attacker) + get_pcvar_num(cvar_kill_rwd_ap))
}
public punish()
{
   static ent
   ent = y_think
   if(!pev_valid(ent))
      return
   static victim
   victim = pev(ent, pev_iuser4)
   set_task(random_float(5.0, 15.0), "punish", npc_ability)
   if(!is_user_alive(victim))
      return
   static random_skill
   if(y_agression)
   {
      random_skill = random_num(0, 3)      
      switch(random_skill)
      {
         case 0: npc_attack1(ent)
            case 1: npc_attack2(ent)
            case 2: npc_attack3(ent)
            case 3: npc_attack4(ent)
         }
      } else {
      random_skill = random_num(0, 3)   
      switch(random_skill)
      {
         case 0: npc_attack1(ent)
            case 1: npc_attack2(ent)
            case 2: npc_attack4(ent)
         }   
   }
}
public fireboss_ready(ent)
{
   ent -= npc_restart
   if(!pev_valid(ent))
   {
      remove_task(ent+npc_restart)
      return
   }
   static Float:Origin[3], Float:firemonster_health
   pev(ent, pev_origin, Origin)
   Origin[2] += 250.0   
   engfunc(EngFunc_SetOrigin, y_hpbar, Origin)
   pev(ent, pev_health, firemonster_health)
   if(npc_healthpoints < (firemonster_health - 1000.0))
   {
      set_pev(y_hpbar, pev_frame, 100.0)
   }
   else
   {
      set_pev(y_hpbar, pev_frame, 0.0 + ((((firemonster_health - 1000.0) - 1 ) * 100) / npc_healthpoints))
   }      
}
public fireboss_done(ent)
{
   ent -= npc_start_think
   anim(ent, 2)
   set_pev(ent, pev_movetype, MOVETYPE_NONE)
   set_pev(ent, pev_nextthink, get_gametime() + 0.1)
}
public npc_firemonster_think(ent)
{
   if(!pev_valid(ent))
      return
   if(pev(ent, pev_iuser3))
      return
   if(pev(ent, pev_health) - 1000.0 < 0.0)
   {
      firemonster_death(ent)
      set_pev(ent, pev_iuser3, 1)
      return
   }
   
   if(!y_agression && (pev(ent, pev_health) - 1000.0) <= (npc_healthpoints / 2) && !y_start_thinking)
   {
      y_agression = 1
      y_start_thinking = 1
      agressive2(ent)
      return
   }
   if(!y_start_thinking)
   {
      static victim
      static Float:Origin[3], Float:VicOrigin[3], Float:distance
      victim = enemy_distance(ent)
      pev(ent, pev_origin, Origin)
      pev(victim, pev_origin, VicOrigin)
      distance = get_distance_f(Origin, VicOrigin)
      if(is_user_alive(victim))
      {
         if(distance <= 200.0)
         {
            npc_attack_simple(ent)
            set_pev(ent, pev_nextthink, get_gametime() + 2.5)
            } else {
            if(pev(ent, pev_sequence) != 4)
               anim(ent, 4)
            set_pev(ent, pev_movetype, MOVETYPE_PUSHSTEP)
            set_rendering (ent,kRenderFxNone,255,255,255,kRenderNormal,16)
            for(new i = 0; i < get_maxplayers(); i++)
            {
               if(is_user_alive(i) && entity_range(ent, i) <= 600)
               {
                  shake_screen(i)
               }
            }
            new Float:ent_place[3], Float:player_place[3]
            pev(ent, pev_origin, ent_place)
            pev(victim, pev_origin, player_place)
            follow_player(ent, ent_place, victim, player_place)
            control_ai(ent, victim, 200.0)
            if(pev(ent, pev_iuser4) != victim)
               set_pev(ent, pev_iuser4, victim)
            set_pev(ent, pev_nextthink, get_gametime() + 0.1)
         }
         } else {
         if(pev(ent, pev_sequence) != 2)
            anim(ent, 2)
         set_pev(ent, pev_nextthink, get_gametime() + 1.0)
      }      
      } else {
      set_pev(ent, pev_nextthink, get_gametime() + 2.0)
   }
   return
}
public agressive2(ent)
{
   anim(ent, 14)
   set_pev(ent, pev_movetype, MOVETYPE_NONE)
   set_rendering(ent,kRenderFxNone,255,255,255,kRenderTransAdd,200)
   for(new i = 0; i < get_maxplayers(); i++)
   {
      if(is_user_alive(i) && entity_range(ent, i) <= 4000)
      {
         shake_screen(i)
         ScreenFade(i, 15, {255, 0, 0}, 120)
      }
   }
   set_task(10.0, "off_agression2", ent+npc_agression)
}
public off_agression2(ent)
{
   ent -= npc_agression
   anim(ent, 2)
   set_pev(ent, pev_movetype, MOVETYPE_NONE)
   y_start_thinking = 0
   set_pev(ent, pev_nextthink, get_gametime() + 1.0)
}
public firemonster_death(ent)
{   
   anim(ent, 16)
   emit_sound(ent, CHAN_BODY, npc_sound[0], 1.0, ATTN_NORM, 0, PITCH_NORM)
   set_pev(ent, pev_movetype, MOVETYPE_FLY)
   set_pev(ent, pev_solid, SOLID_NOT)
   set_pev(ent, pev_velocity, {0.0, 0.0, 0.0})
   set_pev(ent, pev_deadflag, DEAD_DYING)
   remove_task(npc_ability)
   set_task(10.0, "delete_firemonster", ent)
   return HAM_SUPERCEDE   
}
public delete_firemonster(ent)
{
   remove_entity(ent)
   remove_entity(y_hpbar)
}
public firemonster_take_damage(victim, inflictor, attacker, Float:damage, damagebits)
{
   static Float:Origin[3]
   fm_get_aim_origin(attacker, Origin)
   create_blood(Origin)
   emit_sound(victim, CHAN_BODY, hitflesh[0], 1.0, ATTN_NORM, 0, PITCH_NORM)   
   
   if(get_pcvar_num(cvar_dmg_ap_allow))
   {
      // Store damage dealt
      g_damagedealt[attacker] += floatround(damage)
      
      // Reward ammo packs for every [ammo damage] dealt
      while (g_damagedealt[attacker] > get_pcvar_num(cvar_ammodamage))
      {
         g_damagedealt[attacker] -= get_pcvar_num(cvar_ammodamage)
         zp_set_user_ammo_packs(attacker, zp_get_user_ammo_packs(attacker) + get_pcvar_num(cvar_ammo_quantity)) 
      }
   }
}
stock ScreenFade(id, Timer, Colors[3], Alpha) {   
   message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("ScreenFade"), _, id);
   write_short((1<<12) * Timer)
   write_short(1<<12)
   write_short(0)
   write_byte(Colors[0])
   write_byte(Colors[1])
   write_byte(Colors[2])
   write_byte(Alpha)
   message_end()
}
stock shake_screen(id)
{
   message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("ScreenShake"),{0,0,0}, id)
   write_short(1<<14)
   write_short(1<<13)
   write_short(1<<13)
   message_end()
}
stock anim(ent, sequence) {
   set_pev(ent, pev_sequence, sequence)
   set_pev(ent, pev_animtime, halflife_time())
   set_pev(ent, pev_framerate, 1.0)
}
stock control_ai2(ent, Float:VicOrigin[3], Float:speed)
{
   static Float:fl_Velocity[3]
   static Float:EntOrigin[3]
   pev(ent, pev_origin, EntOrigin)
   static Float:distance_f
   distance_f = get_distance_f(EntOrigin, VicOrigin)
   if (distance_f > 60.0)
   {
      new Float:fl_Time = distance_f / speed
      fl_Velocity[0] = (VicOrigin[0] - EntOrigin[0]) / fl_Time
      fl_Velocity[1] = (VicOrigin[1] - EntOrigin[1]) / fl_Time
      fl_Velocity[2] = (VicOrigin[2] - EntOrigin[2]) / fl_Time
      } else {
      fl_Velocity[0] = 0.0
      fl_Velocity[1] = 0.0
      fl_Velocity[2] = 0.0
   }
   entity_set_vector(ent, EV_VEC_velocity, fl_Velocity)
}
stock get_position(ent, Float:forw, Float:right, Float:up, Float:vStart[])
{
   new Float:vOrigin[3], Float:vAngle[3], Float:vForward[3], Float:vRight[3], Float:vUp[3]
   pev(ent, pev_origin, vOrigin)
   pev(ent, pev_view_ofs,vUp)
   xs_vec_add(vOrigin,vUp,vOrigin)
   pev(ent, pev_v_angle, vAngle)
   vAngle[0] = 0.0
   angle_vector(vAngle,ANGLEVECTOR_FORWARD,vForward)
   angle_vector(vAngle,ANGLEVECTOR_RIGHT,vRight)
   angle_vector(vAngle,ANGLEVECTOR_UP,vUp)
   vStart[0] = vOrigin[0] + vForward[0] * forw + vRight[0] * right + vUp[0] * up
   vStart[1] = vOrigin[1] + vForward[1] * forw + vRight[1] * right + vUp[1] * up
   vStart[2] = vOrigin[2] + vForward[2] * forw + vRight[2] * right + vUp[2] * up
}
stock create_blood(const Float:origin[3])
{
   message_begin(MSG_BROADCAST, SVC_TEMPENTITY) 
   write_byte(TE_BLOODSPRITE)
   engfunc(EngFunc_WriteCoord, origin[0])
   engfunc(EngFunc_WriteCoord, origin[1])
   engfunc(EngFunc_WriteCoord, origin[2])
   write_short(y_bleeding[1])
   write_short(y_bleeding[0])
   write_byte(75)
   write_byte(5)
   message_end()
}

stock client_printcolor(const id,const input[], any:...)
{
    new msg[191], players[32], count = 1; vformat(msg,190,input,3);
    replace_all(msg,190,"!g","^4");    // green
    replace_all(msg,190,"!y","^1");    // normal
    replace_all(msg,190,"!t","^3");    // team
    
    if (id) players[0] = id; else get_players(players,count,"ch");
    
    for (new i=0;i<count;i++)
    {
        if (is_user_connected(players[i]))
        {
            message_begin(MSG_ONE_UNRELIABLE,get_user_msgid("SayText"),_,players[i]);
            write_byte(players[i]);
            write_string(msg);
            message_end();
        }
    }

description[AJUDA] Não Consigo Configurar O Boss Pra Da AP QUANTO PERDE SAGUE EmptyRe: [AJUDA] Não Consigo Configurar O Boss Pra Da AP QUANTO PERDE SAGUE

more_horiz
[P]erfec[T] [S]cr[@]s[H] escreveu:
Testa ai:

Código:

new const npc_mdl[] = "models/firemonster/firemonster.mdl"
new const npc_ball_mdl[] = "models/firemonster/fireball.mdl"
new const npc_ball_fire1[] = "sprites/firemonster/flame.spr"
new const hp_spr[] = "sprites/firemonster/firemonsterhp.spr"
new const npc_sound[15][] = {
   "firemonster/firemonster_zbs_death.wav",      
   "firemonster/firemonster_fireball_explode.wav",
   "firemonster/firemonster_zbs_attack4.wav",
   "firemonster/firemonster_zbs_attack5.wav",
   "firemonster/firemonster_zbs_fireball1.wav",
   "firemonster/firemonster_zbs_fireball2.wav",
   "firemonster/firemonster_scene_appear.wav",
   "firemonster/boss_footstep_1.wav",
   "firemonster/boss_footstep_2.wav",
   "firemonster/firemonster_zbs_dash_ready.wav",
   "firemonster/firemonster_zbs_burning2.wav",
   "firemonster/firemonster_zbs_idle1.wav",
   "firemonster/firemonster_zbs_attack1.wav",
   "firemonster/firemonster_zbs_fail.wav",
   "firemonster/firemonster_zbs_clear.wav"
}
#define npc_healthpoints 50000.0   // Firemonster health
#define npc_skill5 30.0         // Firemonster fireball damage
#define npc_skill5_radius 250.0      // Firemonster fireball explosion radius
#define npc_do_exp_radius 350.0      // Firemonster circle fire explosion radius
#define npc_skill3_damage 30.0      // Firemonster circle fire damage
#define npc_skill4_damage 40.0      // Firemonster dash damage
#define npc_simple_attack_damage 40.0   // Firemonster simple attack damage
#define npc_start_think 1
#define npc_clear 2
#define npc_agression 3
#define npc_restart 4
#define npc_create 5
#define npc_ability 6
#define npc_think_player 7
#define npc_brightning 8
#define npc_set_attack3 9
#define npc_idle 10
#define npc_reload_skill 11
#define npc_throw_ball1 12
#define npc_clear_ball0 13
#define npc_use_skill2 14
#define npc_clear_skill2 15
#define npc_ball_think1 16
#define npc_skill3 17
#define npc_run 18
#define npc_stop 19
#define npc_simple_attack 20
#define npc_simple_attack2 21
#define map_music 22
new y_constant, y_finder, y_ball1, y_ball2, y_ball3 , y_think, y_bleeding[2], y_run, y_hpbar
new y_npc_mdl, y_ball_ent[5], y_start_npc, y_npc_hp, y_start_thinking, y_agression
new Float:ball_position[3], Float:ball_position1[3], Float:ball_position2[3], Float:ball_position3[3]
new Float:HAngles[3], Float:VAngles[3], Float:y_spawn_points[3]
new cvar_dmg_ap_allow, cvar_ammodamage, cvar_ammo_quantity, g_damagedealt[33], cvar_kill_rwd_ap
new hitflesh[1][] = 
{
"player/bhit_kevlar-1.wav"
}
new const map_sound[2][] = {
"sound/firemonster/scenario_ready.mp3",
"sound/firemonster/scenario_start.mp3"
}
#define PLUGIN "NPC Firemonster"   // Firemonster
#define VERSION "Public Final"
#define AUTHOR "Glamurnaya Kisa"
#include <amxmodx>
#include <engine>
#include <fakemeta_util>
#include <hamsandwich>
#include <   xs >
#include <zombieplague>
public plugin_init()
{
   register_plugin(PLUGIN, VERSION, AUTHOR)
   
   register_clcmd("get_position", "npc_position")
   register_clcmd("make_firemonster", "create_firemonster")
   register_clcmd("npc_attack4", "npc_attack4_ent")
   register_clcmd("npc_attack3", "npc_attack3_ent")
   register_clcmd("npc_attack2", "npc_attack2_ent")
   register_clcmd("npc_attack1", "npc_attack1_ent")
   register_think("npc_firemonster", "npc_firemonster_think")
   register_touch("npc_firemonster", "*", "npc_firemonster_touch")
   register_think("npc_ball", "npc_ball_think")
   register_touch("npc_ball", "*", "npc_ball_touch")
   register_think("npc_ball_fire1", "npc_ball_fire1_think")
   register_event("HLTV", "event_newround", "a", "1=0", "2=0")
   register_logevent("event_roundstart", 2, "1=Round_Start")
   register_logevent("event_roundend", 2, "1=Round_End")
   
   cvar_dmg_ap_allow = register_cvar("zp_firemonster_dmg_ap_reward_allow", "1")      // Ganhar Ammo Packs Por Dano
   cvar_ammodamage = register_cvar("zp_firemonster_dmg_for_reward", "250")       // Dmg Necessario Para Ganhar Ammo Packs
   cvar_ammo_quantity  = register_cvar("zp_firemonster_reward_ap_quantity", "2")    // Quantia de Ammo Packs que ira ganhar
   cvar_kill_rwd_ap = register_cvar("zp_firemonster_kill_ap_rwd", "100")    // Quantia de Ammo Packs que ira ganhar ao Matar o Fire Monster

public enemy_distance(entid)
{
   new Float:range2
   new Float:maxrange=2000.0
   new indexid=0
   for(new i=1;i<=get_maxplayers();i++)
   {
      if(is_user_alive(i) && is_valid_ent(i) && attacking1(entid, i))
      {
         range2 = entity_range(entid, i)
         if(range2 <= maxrange)
         {
            maxrange=range2
            indexid=i
         }
      }         
   }   
   return (indexid) ? indexid : 0
}
public follow_player(ent, Float:ent_place[3], target, Float:player_place[3]) 
{
   if(target) 
   {
      new Float:newAngle[3]
      entity_get_vector(ent, EV_VEC_angles, newAngle)
      new Float:x = player_place[0] - ent_place[0]
      new Float:z = player_place[1] - ent_place[1]
      new Float:radians = floatatan(z/x, radian)
      newAngle[1] = radians * (180 / 3.14)
      if (player_place[0] < ent_place[0])
      {
         newAngle[1] -= 180.0
         entity_set_vector(ent, EV_VEC_v_angle, newAngle)
         entity_set_vector(ent, EV_VEC_angles, newAngle)
      }
   }
}
public bool:attacking1(entindex1, entindex2)
{
   if (!entindex1 || !entindex2)
      return false
   if (pev_valid(entindex1) && pev_valid(entindex1))
   {
      new flags = pev(entindex1, pev_flags)
      if (flags & EF_NODRAW || flags & FL_NOTARGET)
      {
         return false
      }
      new Float:lookerOrig[3]
      new Float:targetBaseOrig[3]
      new Float:targetOrig[3]
      new Float:temp[3]
      pev(entindex1, pev_origin, lookerOrig)
      pev(entindex1, pev_view_ofs, temp)
      lookerOrig[0] += temp[0]
      lookerOrig[1] += temp[1]
      lookerOrig[2] += temp[2]
      pev(entindex2, pev_origin, targetBaseOrig)
      pev(entindex2, pev_view_ofs, temp)
      targetOrig[0] = targetBaseOrig [0] + temp[0]
      targetOrig[1] = targetBaseOrig [1] + temp[1]
      targetOrig[2] = targetBaseOrig [2] + temp[2]
      engfunc(EngFunc_TraceLine, lookerOrig, targetOrig, 0, entindex1, 0)
      if (get_tr2(0, TraceResult:TR_InOpen) && get_tr2(0, TraceResult:TR_InWater))
      {
         return false
      } 
      else 
      {
         new Float:flFraction
         get_tr2(0, TraceResult:TR_flFraction, flFraction)
         if (flFraction == 1.0 || (get_tr2(0, TraceResult:TR_pHit) == entindex2))
         {
            return true
         }
         else
         {
            targetOrig[0] = targetBaseOrig [0]
            targetOrig[1] = targetBaseOrig [1]
            targetOrig[2] = targetBaseOrig [2]
            engfunc(EngFunc_TraceLine, lookerOrig, targetOrig, 0, entindex1, 0)
            get_tr2(0, TraceResult:TR_flFraction, flFraction)
            if (flFraction == 1.0 || (get_tr2(0, TraceResult:TR_pHit) == entindex2))
            {
               return true
            }
            else
            {
               targetOrig[0] = targetBaseOrig [0]
               targetOrig[1] = targetBaseOrig [1]
               targetOrig[2] = targetBaseOrig [2] - 17.0
               engfunc(EngFunc_TraceLine, lookerOrig, targetOrig, 0, entindex1, 0)
               get_tr2(0, TraceResult:TR_flFraction, flFraction)
               if (flFraction == 1.0 || (get_tr2(0, TraceResult:TR_pHit) == entindex2))
               {
                  return true
               }
            }
         }
      }
   }
   return false
}
public control_ai(ent, victim, Float:speed)
{
   static Float:fl_Velocity[3]
   static Float:VicOrigin[3], Float:EntOrigin[3]
   pev(ent, pev_origin, EntOrigin)
   pev(victim, pev_origin, VicOrigin)
   static Float:distance_f
   distance_f = get_distance_f(EntOrigin, VicOrigin)
   if (distance_f > 60.0)
   {
      new Float:fl_Time = distance_f / speed
      
      fl_Velocity[0] = (VicOrigin[0] - EntOrigin[0]) / fl_Time
      fl_Velocity[1] = (VicOrigin[1] - EntOrigin[1]) / fl_Time
      fl_Velocity[2] = 0.0
   } 
   else
   {
      fl_Velocity[0] = 0.0
      fl_Velocity[1] = 0.0
      fl_Velocity[2] = 0.0
   }
   entity_set_vector(ent, EV_VEC_velocity, fl_Velocity)
}

public event_roundstart()
{
   client_cmd(0, "mp3 play %s", map_sound[1])
   set_task(0.0, "create_firemonster", npc_create)
   set_task(180.0, "replay_music", map_music)
   set_task(1.0, "player1", npc_think_player, _, _, "b")
}
public player1()
{
   static player[32], player_num
   get_players(player, player_num, "a")
   if(player_num <= 0)
   {
      client_cmd(0, "stopsound")   
      client_cmd(0, "spk %s", npc_sound[14])
      set_task(3.0, "replay_game")
      remove_task(npc_think_player)
      } else {
      if(pev_valid(y_think) && pev(y_think, pev_iuser3) == 1)
      {
         client_cmd(0, "stopsound")   
         client_cmd(0, "spk %s", npc_sound[13])
         set_task(3.0, "replay_game")
         remove_task(npc_think_player)
      }
   }
}
public replay_game() server_cmd("sv_restartround 10")

public event_roundend()
{
   client_cmd(0, "stopsound")   
   remove_task(map_music)
}
public replay_music()
{
   client_cmd(0, "mp3 play %s", map_sound[1])   
   set_task(180.0, "replay_music", map_music)
}
public event_newround()
{   
   if(pev_valid(y_think))
   {
      y_constant = 0
      remove_task(y_think+npc_run)
      remove_task(y_think+npc_stop)
      remove_task(y_think+npc_agression)
      remove_task(y_think+npc_brightning)
      remove_task(y_think+npc_set_attack3)
      remove_task(y_think+npc_reload_skill)      
      remove_task(y_think+npc_use_skill2)
      remove_task(y_think+npc_clear_skill2)   
      remove_task(y_think+npc_start_think)
      remove_task(y_think+npc_clear)   
      remove_task(y_think+npc_restart)
      delete_ball(y_think)
      remove_entity_name("npc_firemonster")   
   }
   remove_task(npc_create)
   remove_task(map_music)
   remove_task(npc_think_player)
   if(pev_valid(y_hpbar)) remove_entity(y_hpbar)
   for(new i = 0; i < sizeof(y_ball_ent); i++)
   {
      if(pev_valid(y_ball_ent[i]))
         remove_entity(y_ball_ent[i])
   }
   client_cmd(0, "mp3 play %s", map_sound[0])   
}
public npc_position(id)
{
   pev(id, pev_origin, HAngles)
   pev(id, pev_angles, VAngles)
   VAngles[0] = 0.0
}
public plugin_cfg()                  // Cvar's goes here
{
   server_cmd("mp_buytime 9999.0")
   server_cmd("mp_freezetime 20.0")
   server_cmd("sv_restartround 5")
   server_cmd("mp_timelimit 9999.0")
}
public plugin_precache()
{
   y_npc_hp = precache_model("sprites/zerogxplode.spr")
   y_npc_mdl = precache_model(npc_mdl)
   precache_model(npc_ball_mdl)
   precache_model(npc_ball_fire1)
   precache_model(hp_spr)
   for(new i = 0; i < sizeof(npc_sound); i++)
      precache_sound(npc_sound[i])
   for(new i=0; i<1; i++)
      precache_sound(hitflesh[i])
   for(new i = 0; i < sizeof(map_sound); i++)
      precache_generic(map_sound[i])   
   y_bleeding[0] = precache_model("sprites/blood.spr")
   y_bleeding[1] = precache_model("sprites/bloodspray.spr")   
   static mapname[64]
   get_mapname(mapname, sizeof(mapname))         // Firemonster spawn points 
   if(equal(mapname, "zs_dangerous"))         // Can be added manually with waypoint util
   {
      y_spawn_points[0] = 243.0
      y_spawn_points[1] = 109.0 
      y_spawn_points[2] = -412.0
   }
   if(equal(mapname, "zs_egypt"))
   {
      y_spawn_points[0] = 138.0
      y_spawn_points[1] = -263.0 
      y_spawn_points[2] = 36.0 
   }
   if(equal(mapname, "zs_construction"))
   {
      y_spawn_points[0] = -308.0
      y_spawn_points[1] = -168.0 
      y_spawn_points[2] = 612.0 
   }
   if(equal(mapname, "zs_behind"))
   {
      y_spawn_points[0] = 706.0
      y_spawn_points[1] = 1192.0 
      y_spawn_points[2] = 120.0 
   }
}
public fire_attack3(ent)
{
   ent -= npc_set_attack3
   if(!pev_valid(ent))
      return
   static Float:explosion[24][3], Float:ball_place[24][3]   
   explosion[0][0] = 200.0
   explosion[0][1] = 0.0
   explosion[0][2] = 500.0
   explosion[1][0] = 400.0
   explosion[1][1] = 0.0
   explosion[1][2] = 500.0
   explosion[2][0] = -200.0
   explosion[2][1] = 0.0
   explosion[2][2] = 500.0
   explosion[3][0] = -400.0
   explosion[3][1] = 0.0
   explosion[3][2] = 500.0
   explosion[4][0] = 0.0
   explosion[4][1] = 200.0
   explosion[4][2] = 500.0
   explosion[5][0] = 0.0
   explosion[5][1] = 400.0
   explosion[5][2] = 500.0
   explosion[6][0] = 0.0
   explosion[6][1] = -200.0
   explosion[6][2] = 500.0
   explosion[7][0] = 0.0
   explosion[7][1] = -400.0
   explosion[7][2] = 500.0
   explosion[8][0] = 200.0
   explosion[8][1] = 200.0
   explosion[8][2] = 500.0
   explosion[9][0] = 400.0
   explosion[9][1] = 400.0
   explosion[9][2] = 500.0
   explosion[10][0] = 200.0
   explosion[10][1] = 400.0
   explosion[10][2] = 500.0
   explosion[11][0] = 400.0
   explosion[11][1] = 200.0
   explosion[11][2] = 500.0
   explosion[12][0] = -200.0
   explosion[12][1] = 200.0
   explosion[12][2] = 500.0
   explosion[13][0] = -400.0
   explosion[13][1] = 400.0
   explosion[13][2] = 500.0
   explosion[14][0] = -200.0
   explosion[14][1] = 400.0
   explosion[14][2] = 500.0
   explosion[15][0] = -400.0
   explosion[15][1] = 200.0
   explosion[15][2] = 500.0
   explosion[16][0] = -200.0
   explosion[16][1] = -200.0
   explosion[17][2] = 500.0
   explosion[17][0] = -200.0
   explosion[17][1] = -200.0
   explosion[17][2] = 500.0
   explosion[18][0] = -200.0
   explosion[18][1] = -400.0
   explosion[18][2] = 500.0
   explosion[19][0] = -400.0
   explosion[19][1] = -200.0
   explosion[19][2] = 500.0
   explosion[20][0] = 200.0
   explosion[20][1] = -200.0
   explosion[20][2] = 500.0
   explosion[21][0] = 400.0
   explosion[21][1] = -400.0
   explosion[21][2] = 500.0
   explosion[22][0] = 200.0
   explosion[22][1] = -400.0
   explosion[22][2] = 500.0
   explosion[23][0] = 400.0
   explosion[23][1] = -200.0
   explosion[23][2] = 500.0
   for(new i = 0; i < sizeof(explosion); i++)
   {
      get_position(ent, explosion[i][0], explosion[i][1], explosion[i][2], ball_place[i])
      npc_fireball_big(ent, ball_place[i])
   }
   remove_task(ent+npc_brightning)
   set_task(1.0, "fire_attack3", ent+npc_set_attack3)
}
public npc_attack3_ent() npc_attack3(y_think)
public npc_attack4_ent() npc_attack4(y_think)
public npc_attack2_ent() npc_attack2(y_think)
public npc_attack1_ent() npc_attack1(y_think)
public npc_attack_simple(ent)
{
   y_start_thinking = 1
   anim(ent, 8)
   set_pev(ent, pev_movetype, MOVETYPE_NONE)   
   set_task(1.0, "firemonster_simple", ent+npc_simple_attack)
   set_task(2.0, "simple_attack_reload", ent+npc_simple_attack2)   
}
public simple_attack_reload(ent)
{
   ent -= npc_simple_attack2
   y_start_thinking = 0
}
public firemonster_simple(ent)
{
   ent -= npc_simple_attack
   emit_sound(ent, CHAN_BODY, npc_sound[12], 1.0, ATTN_NORM, 0, PITCH_NORM)
   for(new i = 0; i < get_maxplayers(); i++)
   {
      if(is_user_alive(i) && entity_range(ent, i) <= 300.0)
      {
         shake_screen(i)
         ScreenFade(i, 10, {255, 0, 0}, 120)
         ExecuteHam(Ham_TakeDamage, i, 0, i, npc_simple_attack_damage, DMG_SLASH)
      }
   }
}
public npc_attack4(ent)
{
   if(!pev_valid(ent) || y_start_thinking)
      return   
   y_start_thinking = 1
   y_run = 0
   anim(ent, 5)
   for(new i = 0; i < get_maxplayers(); i++)
   {
      if(is_user_alive(i) && entity_range(ent, i) <= 1000)
      {
         shake_screen(i)
      }
   }
   set_pev(ent, pev_movetype, MOVETYPE_NONE)
   set_task(1.5, "run_now", ent+npc_run)
   set_task(2.0, "stop_run", ent+npc_stop)
}
public run_now(ent)
{
   ent -= npc_run
   if(!pev_valid(ent))
      return      
   y_run = 1
   anim(ent, 6)
   set_pev(ent, pev_movetype, MOVETYPE_PUSHSTEP)
   static Float:Origin[3]
   get_position(ent, 1000.0, 0.0, 0.0, Origin)
   control_ai2(ent, Origin, 2000.0)
   for(new i = 0; i < get_maxplayers(); i++)
   {
      if(is_user_alive(i) && entity_range(ent, i) <= 1000)
      {
         shake_screen(i)
      }
   }
}
public npc_firemonster_touch(ent, id)
{
   if(!pev_valid(id))
      return
   if(!y_run)
      return
   y_run = 0
   remove_task(ent+npc_stop)
   set_task(0.1, "stop_run", ent+npc_stop)
   if(is_user_alive(id))
   {
      ExecuteHam(Ham_TakeDamage, id, 0, id, npc_skill4_damage, DMG_SLASH)
      shake_screen(id)
      ScreenFade(id, 10, {255, 0, 0}, 120)
      static Float:Velocity[3]
      Velocity[0] = random_float(1000.0, 2000.0)
      Velocity[1] = random_float(1000.0, 2000.0)
      Velocity[2] = random_float(1000.0, 2000.0)
      set_pev(id, pev_velocity, Velocity)
   }
}
public stop_run(ent)
{
   ent -= npc_stop
   y_run = 0
   y_start_thinking = 1
   anim(ent, 7)
   for(new i = 0; i < get_maxplayers(); i++)
   {
      if(is_user_alive(i) && entity_range(ent, i) <= 1000)
      {
         shake_screen(i)
      }
   }
   set_pev(ent, pev_movetype, MOVETYPE_NONE)
   set_task(0.5, "reload_run", ent)
}
public reload_run(ent)
{
   y_start_thinking = 0
   anim(ent, 2)
   entity_set_float(ent, EV_FL_nextthink, get_gametime() + 1.0)
}
public npc_attack3(ent)
{
   if(!pev_valid(ent) || y_start_thinking)
      return   
   y_start_thinking = 1
   anim(ent, 12)
   set_pev(ent, pev_movetype, MOVETYPE_NONE)
   static Float:Origin[3]
   get_position(ent, 150.0, 0.0, 50.0, Origin)
   emit_sound(ent, CHAN_BODY, npc_sound[3], 1.0, ATTN_NORM, 0, PITCH_NORM)
   for(new i = 0; i < get_maxplayers(); i++)
   {
      if(is_user_alive(i) && entity_range(ent, i) <= 4000)
      {
         shake_screen(i)
         ScreenFade(i, 10, {255, 0, 0}, 120)
      }
   }
   set_task(4.0, "fire_attack3", ent+npc_set_attack3)
   set_task(10.0, "remove_attack3", ent+npc_idle)
}
public npc_fireball_big(fireboss, Float:Origin[3])
{
   new ent = create_entity("info_target")
   static Float:Angles[3]
   pev(fireboss, pev_angles, Angles)
   entity_set_origin(ent, Origin)
   Angles[0] = -100.0
   entity_set_vector(ent, EV_VEC_angles, Angles)
   Angles[0] = 100.0
   entity_set_vector(ent, EV_VEC_v_angle, Angles)
   entity_set_string(ent, EV_SZ_classname, "npc_ball")
   entity_set_model(ent, npc_ball_mdl)
   entity_set_int(ent, EV_INT_solid, 2)
   entity_set_int(ent, EV_INT_movetype, MOVETYPE_FLY)
   new Float:maxs[3] = {15.0, 15.0, 15.0}
   new Float:mins[3] = {-15.0, -15.0, -15.0}
   entity_set_size(ent, mins, maxs)
   set_pev(ent, pev_owner, fireboss)
   static Float:Velocity[3]
   VelocityByAim(ent, random_num(250, 1000), Velocity)
   set_pev(ent, pev_light_level, 180)
   set_pev(ent, pev_rendermode, kRenderTransAdd)
   set_pev(ent, pev_renderamt, 255.0)   
   entity_set_vector(ent, EV_VEC_velocity, Velocity)
   burning(ent, 0.5)
}
public remove_attack3(ent)
{
   ent -= npc_idle
   if(!pev_valid(ent))
      return   
   remove_task(ent+npc_brightning)
   remove_task(ent+npc_set_attack3)
   set_task(2.0, "delete_attack3", ent+npc_reload_skill)
}
public delete_attack3(ent)
{
   ent -= npc_reload_skill
   anim(ent, 2)
   set_pev(ent, pev_movetype, MOVETYPE_NONE)
   y_start_thinking = 0
   set_pev(ent, pev_nextthink, get_gametime() + 2.0)
}
public brightning(ent)
{
   ent -= npc_brightning
   if(!pev_valid(ent))
   {
      remove_task(ent+npc_brightning)
      return
   }
   static Float:Origin[3]
   pev(ent, pev_origin, Origin)
   message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
   write_byte(27)
   engfunc(EngFunc_WriteCoord, Origin[0])
   engfunc(EngFunc_WriteCoord, Origin[1])
   engfunc(EngFunc_WriteCoord, Origin[2])
   write_byte(150)
   write_byte(255)
   write_byte(0)
   write_byte(0)
   write_byte(60)
   write_byte(0)
   message_end()   
}
public npc_attack2(ent)
{
   if(!pev_valid(ent) || y_start_thinking)
      return   
   y_start_thinking = 1
   y_constant = 3
   anim(ent, 11)
   set_pev(ent, pev_movetype, MOVETYPE_NONE)
   emit_sound(ent, CHAN_BODY, npc_sound[2], 1.0, ATTN_NORM, 0, PITCH_NORM)
   set_task(0.25, "create_attack2", ent+npc_use_skill2)
   set_task(0.5, "create_attack2", ent+npc_use_skill2)
   set_task(0.75, "create_attack2", ent+npc_use_skill2)
   set_task(2.0, "delete_attack2", ent+npc_clear_skill2)
}
public delete_attack2(ent)
{
   ent -= npc_clear_skill2
   y_start_thinking = 0
   y_constant = 0   
   anim(ent, 2)
   set_pev(ent, pev_movetype, MOVETYPE_NONE)
   set_pev(ent, pev_nextthink, get_gametime() + 1.0)
}
public create_attack2(ent)
{
   ent -= npc_use_skill2
   static Float:explosion[8][3], Float:ball_place[8][3]
   if(y_constant == 3)
   {
      explosion[0][0] = 100.0
      explosion[0][1] = 0.0
      explosion[0][2] = 0.0
      explosion[1][0] = 50.0
      explosion[1][1] = 50.0
      explosion[1][2] = 0.0
      explosion[2][0] = 0.0
      explosion[2][1] = 100.0
      explosion[2][2] = 0.0
      explosion[3][0] = -50.0
      explosion[3][1] = -100.0
      explosion[3][2] = 0.0
      explosion[4][0] = -100.0
      explosion[4][1] = 0.0
      explosion[4][2] = 0.0
      explosion[5][0] = -50.0
      explosion[5][1] = -50.0
      explosion[5][2] = 0.0
      explosion[6][0] = 0.0
      explosion[6][1] = -50.0
      explosion[6][2] = 0.0
      explosion[7][0] = 50.0
      explosion[7][1] = -50.0
      explosion[7][2] = 0.0
      } else if(y_constant == 2) {
      explosion[0][0] = 200.0
      explosion[0][1] = 0.0
      explosion[0][2] = 0.0
      explosion[1][0] = 100.0
      explosion[1][1] = 100.0
      explosion[1][2] = 0.0
      explosion[2][0] = 0.0
      explosion[2][1] = 200.0
      explosion[2][2] = 0.0
      explosion[3][0] = -100.0
      explosion[3][1] = -200.0
      explosion[3][2] = 0.0
      explosion[4][0] = -200.0
      explosion[4][1] = 0.0
      explosion[4][2] = 0.0
      explosion[5][0] = -100.0
      explosion[5][1] = -100.0
      explosion[5][2] = 0.0
      explosion[6][0] = 0.0
      explosion[6][1] = -100.0
      explosion[6][2] = 0.0
      explosion[7][0] = 100.0
      explosion[7][1] = -100.0
      explosion[7][2] = 0.0         
      } else if(y_constant == 1) {
      explosion[0][0] = 300.0
      explosion[0][1] = 0.0
      explosion[0][2] = 0.0
      explosion[1][0] = 150.0
      explosion[1][1] = 150.0
      explosion[1][2] = 0.0
      explosion[2][0] = 0.0
      explosion[2][1] = 300.0
      explosion[2][2] = 0.0
      explosion[3][0] = -150.0
      explosion[3][1] = -300.0
      explosion[3][2] = 0.0
      explosion[4][0] = -300.0
      explosion[4][1] = 0.0
      explosion[4][2] = 0.0
      explosion[5][0] = -150.0
      explosion[5][1] = -150.0
      explosion[5][2] = 0.0
      explosion[6][0] = 0.0
      explosion[6][1] = -150.0
      explosion[6][2] = 0.0
      explosion[7][0] = 150.0
      explosion[7][1] = -150.0
      explosion[7][2] = 0.0      
   }
   for(new i = 0; i < sizeof(explosion); i++)
   {
      get_position(ent, explosion[i][0], explosion[i][1], explosion[i][2], ball_place[i])
      bomb_explosion(ent, ball_place[i])
   }   
   y_constant--
}
public bomb_explosion(ent, Float:Origin[3])
{
   message_begin(MSG_BROADCAST ,SVC_TEMPENTITY)
   write_byte(TE_EXPLOSION)
   engfunc(EngFunc_WriteCoord, Origin[0])
   engfunc(EngFunc_WriteCoord, Origin[1])
   engfunc(EngFunc_WriteCoord, Origin[2])
   write_short(y_npc_hp)
   write_byte(10)
   write_byte(30)
   write_byte(4)
   message_end()   
   emit_sound(ent, CHAN_BODY, npc_sound[1], 1.0, ATTN_NORM, 0, PITCH_NORM)
   for(new i = 0; i < get_maxplayers(); i++)
   {
      if(is_user_alive(i))
      {
         static Float:Origin2[3], Float:distance
         pev(i, pev_origin, Origin2)
         distance = get_distance_f(Origin, Origin2)
         if(distance <= npc_do_exp_radius)
         {
            shake_screen(i)
            ExecuteHam(Ham_TakeDamage, i, 0, i, npc_skill3_damage, DMG_BURN)
            ScreenFade(i, 3, {255, 0, 0}, 120)
            static Float:Velocity[3]
            Velocity[0] = random_float(250.0, 750.0)
            Velocity[1] = random_float(250.0, 750.0)
            Velocity[2] = random_float(250.0, 750.0)
            set_pev(i, pev_velocity, Velocity)
         }
      }
   }
}
public npc_attack1(ent)
{
   if(!pev_valid(ent) || y_start_thinking)
      return
   delete_ball(ent)
   y_start_thinking = 1
   static random_mode
   random_mode = random_num(0, 1)
   switch(random_mode)
   {
      case 0: {
         anim(ent, 9)
         set_pev(ent, pev_movetype, MOVETYPE_NONE)
         set_task(1.0, "ball1_out", y_think+npc_ball_think1)   
         emit_sound(ent, CHAN_BODY, npc_sound[4], 1.0, ATTN_NORM, 0, PITCH_NORM)
      }
      case 1: {
         anim(ent, 10)
         set_pev(ent, pev_movetype, MOVETYPE_NONE)
         set_task(1.0, "ball_out2", y_think+npc_ball_think1)      
         emit_sound(ent, CHAN_BODY, npc_sound[5], 1.0, ATTN_NORM, 0, PITCH_NORM)
      }
   }
}
public delete_ball(ent)
{
   y_start_thinking = 0
   remove_task(ent+npc_ball_think1)
   remove_task(ent+npc_skill3)
   remove_entity_name("npc_ball")
}
public ball1_out(ent)
{
   ent -= npc_ball_think1
   static Float:Origin[3], ball_left, ball_right
   ball_position1[0] = 0.0
   ball_position1[1] = 0.0
   ball_position1[2] = 0.0      
   get_position(ent, 50.0, -25.0, 100.0, Origin)
   ball_left = make_ball(ent, Origin)   
   y_ball1 = 50
   set_pev(ball_left, pev_iuser4, 2)
   set_pev(ball_left, pev_nextthink, get_gametime() + 0.5)
   ball_position[0] = 0.0
   ball_position[1] = 0.0
   ball_position[2] = 0.0   
   get_position(ent, 50.0, 50.0, 100.0, Origin)   
   ball_right = make_ball(ent, Origin)
   y_finder = 50
   set_pev(ball_right, pev_iuser4, 1)
   set_pev(ball_right, pev_nextthink, get_gametime() + 0.7)
   set_task(1.5, "recharge", ent+npc_skill3)
}
public ball_out2(ent)
{
   ent -= npc_ball_think1
   static Float:Origin[3], ball_left, ball_right
   ball_position1[0] = 0.0
   ball_position1[1] = 0.0
   ball_position1[2] = 0.0      
   get_position(ent, 50.0, -25.0, 100.0, Origin)
   ball_left = make_ball(ent, Origin)   
   y_ball1 = 50
   set_pev(ball_left, pev_iuser4, 2)
   set_pev(ball_left, pev_nextthink, get_gametime() + 0.1)   
   ball_position[0] = 0.0
   ball_position[1] = 0.0
   ball_position[2] = 0.0   
   get_position(ent, 50.0, 50.0, 100.0, Origin)   
   ball_right = make_ball(ent, Origin)
   y_finder = 50
   set_pev(ball_right, pev_iuser4, 1)
   set_pev(ball_right, pev_nextthink, get_gametime() + 0.2)
   set_task(0.5, "ball_out3", ent)
   set_task(2.0, "recharge", ent+npc_skill3)
}
public ball_out3(ent)
{
   static Float:Origin[3],ball_left, ball_right
   ball_position3[0] = 0.0
   ball_position3[1] = 0.0
   ball_position3[2] = 0.0      
   get_position(ent, 50.0, -25.0, 100.0, Origin)
   ball_left = make_ball(ent, Origin)   
   y_ball3 = 50
   set_pev(ball_left, pev_iuser4, 4)
   set_pev(ball_left, pev_nextthink, get_gametime() + 0.1)   
   ball_position2[0] = 0.0
   ball_position2[1] = 0.0
   ball_position2[2] = 0.0   
   get_position(ent, 50.0, 50.0, 100.0, Origin)   
   ball_right = make_ball(ent, Origin)
   y_ball2 = 50
   set_pev(ball_right, pev_iuser4, 3)
   set_pev(ball_right, pev_nextthink, get_gametime() + 0.2)   
}
public recharge(ent)
{
   ent -= npc_skill3
   y_start_thinking = 0
   set_pev(ent, pev_nextthink, get_gametime() + 1.0)
}
public make_ball(fireboss, Float:Origin[3])
{
   new ent = create_entity("info_target")
   entity_set_origin(ent, Origin)
   entity_set_string(ent, EV_SZ_classname, "npc_ball")
   entity_set_model(ent, npc_ball_mdl)
   entity_set_int(ent, EV_INT_solid, 0)
   entity_set_int(ent, EV_INT_movetype, 0)
   new Float:maxs[3] = {15.0, 15.0, 15.0}
   new Float:mins[3] = {-15.0, -15.0, -15.0}
   entity_set_size(ent, mins, maxs)
   set_pev(ent, pev_owner, fireboss)
   set_pev(ent, pev_light_level, 180)
   set_pev(ent, pev_rendermode, kRenderTransAdd)
   set_pev(ent, pev_renderamt, 255.0)
   burning(ent, 0.5)
   return ent
}
public burning(ball, Float:size)
{
   static ent
   ent = create_entity("env_sprite")
   set_pev(ent, pev_takedamage, 0.0)
   set_pev(ent, pev_solid, SOLID_NOT)
   set_pev(ent, pev_movetype, MOVETYPE_NONE)
   set_pev(ent, pev_classname, "npc_ball_fire1")
   engfunc(EngFunc_SetModel, ent, npc_ball_fire1)
   set_pev(ent, pev_rendermode, kRenderTransAdd)
   set_pev(ent, pev_renderamt, 255.0)
   set_pev(ent, pev_light_level, 180)
   set_pev(ent, pev_scale, size)
   set_pev(ent, pev_owner, ball)
   set_pev(ent, pev_animtime, get_gametime())
   set_pev(ent, pev_framerate, 8.0)
   set_pev(ent, pev_frame, 0.1)
   set_pev(ent, pev_spawnflags, SF_SPRITE_STARTON)
   dllfunc(DLLFunc_Spawn, ent)
   npc_ball_fire1_think(ent)
   set_pev(ent, pev_nextthink, get_gametime() + 0.01)
   return ent
}
public npc_ball_fire1_think(ent)
{
   if(!pev_valid(ent))
      return
   if(!pev_valid(pev(ent, pev_owner)))
   {
      remove_entity(ent)
      return
   }
   static owner
   owner = pev(ent, pev_owner)
   static Float:Origin[3]
   pev(owner, pev_origin, Origin)
   Origin[2] += 25.0
   entity_set_origin(ent, Origin)
   set_pev(ent, pev_nextthink, get_gametime() + 0.01)
}
public npc_ball_think(ent)
{
   if(!pev_valid(ent))
      return
   if(y_finder > 0 && pev(ent, pev_iuser4) == 1)
   {   
      static Float:Origin[3]
      switch(y_finder)
      {
         case 35..40: {
            ball_position[2] += 0.5
            get_position(ent, ball_position[0], ball_position[1], ball_position[2], Origin)
            set_pev(ent, pev_origin, Origin)
            static owner
            owner = pev(ent, pev_owner)
            
            if(pev_valid(owner))
               player_follow2(owner)   
         }   
         case 20..34: {
            ball_position[0] += 0.1
            ball_position[1] += 0.25            
            get_position(ent, ball_position[0], ball_position[1], ball_position[2], Origin)
            set_pev(ent, pev_origin, Origin)
            static owner
            owner = pev(ent, pev_owner)
            if(pev_valid(owner))
               player_follow2(owner)   
         }   
         case 5..19: {
            ball_position[2] -= 0.5
            ball_position[1] -= 0.5
            ball_position[0] -= 0.1
            get_position(ent, ball_position[0], ball_position[1], ball_position[2], Origin)
            set_pev(ent, pev_origin, Origin)
            static owner
            owner = pev(ent, pev_owner)
            if(pev_valid(owner))
               player_follow2(owner)   
         }
         case 4: {
            static owner, Float:Velocity[3]
            owner = pev(ent, pev_owner)
            get_position(owner, 1000.0, 0.0, -100.0, Velocity)
            fm_get_aim_origin(owner, Velocity)
            entity_set_int(ent, EV_INT_solid, 2)
            set_pev(ent, pev_movetype, MOVETYPE_FLY)
            control_ai2(ent, Velocity, random_float(2000.0, 4000.0))
            y_finder = 0
         }
      }
      if(y_finder > 0)
         y_finder--
   }
   if(y_ball1 > 0 && pev(ent, pev_iuser4) == 2)
   {   
      static Float:Origin[3]
      switch(y_ball1)
      {
         case 35..40: {
            ball_position1[2] += 0.5
            get_position(ent, ball_position1[0], ball_position1[1], ball_position1[2], Origin)
            set_pev(ent, pev_origin, Origin)
            static owner
            owner = pev(ent, pev_owner)
            if(pev_valid(owner))
               player_follow2(owner)   
         }   
         case 20..34: {
            ball_position1[0] -= 0.1
            ball_position1[1] += 0.25   
            get_position(ent, ball_position1[0], ball_position1[1], ball_position1[2], Origin)
            set_pev(ent, pev_origin, Origin)
            static owner
            owner = pev(ent, pev_owner)
            if(pev_valid(owner))
               player_follow2(owner)   
         }   
         case 5..19: {
            ball_position1[2] -= 0.5
            ball_position1[1] -= 0.5
            ball_position1[0] += 0.1
            get_position(ent, ball_position1[0], ball_position1[1], ball_position1[2], Origin)
            set_pev(ent, pev_origin, Origin)
            static owner
            owner = pev(ent, pev_owner)
            if(pev_valid(owner))
               player_follow2(owner)   
         }
         case 4: {
            static owner, Float:Velocity[3]
            owner = pev(ent, pev_owner)
            get_position(owner, 1000.0, 0.0, -100.0, Velocity)
            fm_get_aim_origin(owner, Velocity)
            entity_set_int(ent, EV_INT_solid, 2)
            set_pev(ent, pev_movetype, MOVETYPE_FLY)
            control_ai2(ent, Velocity, random_float(2000.0, 4000.0))
            y_ball1 = 0
         }
      }
      if(y_ball1 > 0)
         y_ball1--
   }   
   if(y_ball2 > 0 && pev(ent, pev_iuser4) == 3)
   {   
      static Float:Origin[3]
      switch(y_ball2)
      {
         case 35..40: {
            ball_position2[2] += 0.5
            get_position(ent, ball_position2[0], ball_position2[1], ball_position2[2], Origin)
            set_pev(ent, pev_origin, Origin)
            static owner
            owner = pev(ent, pev_owner)
            if(pev_valid(owner))
               player_follow2(owner)   
         }   
         case 20..34: {
            ball_position2[0] += 0.1
            ball_position2[1] += 0.25            
            get_position(ent, ball_position2[0], ball_position2[1], ball_position2[2], Origin)
            set_pev(ent, pev_origin, Origin)
            static owner
            owner = pev(ent, pev_owner)
            if(pev_valid(owner))
               player_follow2(owner)   
         }   
         case 5..19: {
            ball_position2[2] -= 0.5
            ball_position2[1] -= 0.5
            ball_position2[0] -= 0.1
            get_position(ent, ball_position2[0], ball_position2[1], ball_position2[2], Origin)
            set_pev(ent, pev_origin, Origin)
            static owner
            owner = pev(ent, pev_owner)
            if(pev_valid(owner))
               player_follow2(owner)   
         }
         case 4: {
            static owner, Float:Velocity[3]
            owner = pev(ent, pev_owner)
            get_position(owner, 1000.0, 0.0, -100.0, Velocity)
            fm_get_aim_origin(owner, Velocity)
            entity_set_int(ent, EV_INT_solid, 2)
            set_pev(ent, pev_movetype, MOVETYPE_FLY)
            control_ai2(ent, Velocity, 2000.0)
            y_finder = 0
         }
      }
      if(y_ball2 > 0)
         y_ball2--
   }
   if(y_ball3 > 0 && pev(ent, pev_iuser4) == 4)
   {   
      static Float:Origin[3]
      switch(y_ball3)
      {
         case 35..40: {
            ball_position3[2] += 0.5
            get_position(ent, ball_position3[0], ball_position3[1], ball_position3[2], Origin)
            set_pev(ent, pev_origin, Origin)
            static owner
            owner = pev(ent, pev_owner)
            if(pev_valid(owner))
               player_follow2(owner)   
         }   
         case 20..34: {
            ball_position1[0] -= 0.1
            ball_position1[1] += 0.25   
            get_position(ent, ball_position3[0], ball_position3[1], ball_position3[2], Origin)
            set_pev(ent, pev_origin, Origin)
            static owner
            owner = pev(ent, pev_owner)
            if(pev_valid(owner))
               player_follow2(owner)   
         }   
         case 5..19: {
            ball_position3[2] -= 0.5
            ball_position3[1] -= 0.5
            ball_position3[0] += 0.1
            get_position(ent, ball_position3[0], ball_position3[1], ball_position3[2], Origin)
            set_pev(ent, pev_origin, Origin)
            static owner
            owner = pev(ent, pev_owner)
            if(pev_valid(owner))
               player_follow2(owner)               
         }
         case 4: {
            static owner, Float:Velocity[3]
            owner = pev(ent, pev_owner)
            get_position(owner, 1000.0, 0.0, -100.0, Velocity)
            fm_get_aim_origin(owner, Velocity)
            entity_set_int(ent, EV_INT_solid, 2)
            set_pev(ent, pev_movetype, MOVETYPE_FLY)
            control_ai2(ent, Velocity, 2000.0)
            y_ball3 = 0
         }
      }
      if(y_ball3 > 0)
         y_ball3--
   }      
   set_pev(ent, pev_nextthink, get_gametime() + 0.01)
}
public player_follow2(ent)
{
   static victim
   victim = pev(ent, pev_iuser4)
   if(!is_user_alive(victim))
      return
   new Float:ent_place[3], Float:player_place[3]
   pev(ent, pev_origin, ent_place)
   pev(victim, pev_origin, player_place)
   follow_player(ent, ent_place, victim, player_place)      
}
public npc_ball_touch(ent, id)
{
   if(!pev_valid(ent))
      return
   static Float:Origin[3]
   pev(ent, pev_origin, Origin)
   message_begin(MSG_BROADCAST ,SVC_TEMPENTITY)
   write_byte(TE_EXPLOSION)
   engfunc(EngFunc_WriteCoord, Origin[0])
   engfunc(EngFunc_WriteCoord, Origin[1])
   engfunc(EngFunc_WriteCoord, Origin[2])
   write_short(y_npc_hp)
   write_byte(10)
   write_byte(30)
   write_byte(4)
   message_end()   
   emit_sound(ent, CHAN_BODY, npc_sound[1], 1.0, ATTN_NORM, 0, PITCH_NORM)
   for(new i = 0; i < get_maxplayers(); i++)
   {
      if(is_user_alive(i) && entity_range(ent, i) <= npc_skill5_radius)
      {
         shake_screen(i)
         ExecuteHam(Ham_TakeDamage, i, 0, i, npc_skill5, DMG_BURN)
         ScreenFade(i, 3, {255, 0, 0}, 120)
      }
   }
   remove_entity(ent)
}
public create_firemonster()
{
   new ent = create_entity("info_target")
   y_think = ent
   static Float:Origin[3]
   Origin[0] = y_spawn_points[0]
   Origin[1] = y_spawn_points[1]
   Origin[2] = y_spawn_points[2]
   entity_set_origin(ent, Origin)
   entity_set_float(ent, EV_FL_takedamage, 1.0)
   entity_set_float(ent, EV_FL_health, npc_healthpoints + 1000.0)
   entity_set_string(ent, EV_SZ_classname, "npc_firemonster")
   entity_set_model(ent, npc_mdl)
   entity_set_int(ent, EV_INT_solid, SOLID_BBOX)
   entity_set_int(ent, EV_INT_movetype, MOVETYPE_PUSHSTEP)
   new Float:maxs[3] = {25.0, 50.0, 200.0}
   new Float:mins[3] = {-25.0, -50.0, -35.0}
   entity_set_size(ent, mins, maxs)
   entity_set_int(ent, EV_INT_modelindex, y_npc_mdl)
   anim(ent, 1)
   set_pev(ent, pev_movetype, MOVETYPE_NONE)
   set_task(14.0, "fireboss_done", ent+npc_start_think)         // Firemonster prepare time
   set_rendering(ent,kRenderFxNone,255,255,255,kRenderTransAdd,200)
   if(!y_start_npc)
   {
      y_start_npc = 1
      RegisterHamFromEntity(Ham_TakeDamage, ent, "firemonster_take_damage", 1)
      RegisterHamFromEntity(Ham_Killed, ent, "firemonster_killed_post")
   }
   y_constant = 0
   emit_sound(ent, CHAN_BODY, npc_sound[6], 1.0, ATTN_NORM, 0, PITCH_NORM)
   y_hpbar = create_entity("env_sprite")
   set_pev(y_hpbar, pev_scale, 0.4)
   set_pev(y_hpbar, pev_owner, ent)
   engfunc(EngFunc_SetModel, y_hpbar, hp_spr)   
   set_task(0.1, "fireboss_ready", ent+npc_restart, _, _, "b")
   set_task(random_float(7.0, 15.0), "punish", npc_ability)
   drop_to_floor(ent)
}

public firemonster_killed_post(ent, attacker)
{
   new name[32]; get_user_name(attacker, name, 31)
   client_printcolor(0, "!g[ZP Firemonster]!t O Jogador !g%s!t Ganhou !g%d!t Ammo Packs Por Matar o Boss", name, get_pcvar_num(cvar_kill_rwd_ap))
   zp_set_user_ammo_packs(attacker, zp_get_user_ammo_packs(attacker) + get_pcvar_num(cvar_kill_rwd_ap))
}
public punish()
{
   static ent
   ent = y_think
   if(!pev_valid(ent))
      return
   static victim
   victim = pev(ent, pev_iuser4)
   set_task(random_float(5.0, 15.0), "punish", npc_ability)
   if(!is_user_alive(victim))
      return
   static random_skill
   if(y_agression)
   {
      random_skill = random_num(0, 3)      
      switch(random_skill)
      {
         case 0: npc_attack1(ent)
            case 1: npc_attack2(ent)
            case 2: npc_attack3(ent)
            case 3: npc_attack4(ent)
         }
      } else {
      random_skill = random_num(0, 3)   
      switch(random_skill)
      {
         case 0: npc_attack1(ent)
            case 1: npc_attack2(ent)
            case 2: npc_attack4(ent)
         }   
   }
}
public fireboss_ready(ent)
{
   ent -= npc_restart
   if(!pev_valid(ent))
   {
      remove_task(ent+npc_restart)
      return
   }
   static Float:Origin[3], Float:firemonster_health
   pev(ent, pev_origin, Origin)
   Origin[2] += 250.0   
   engfunc(EngFunc_SetOrigin, y_hpbar, Origin)
   pev(ent, pev_health, firemonster_health)
   if(npc_healthpoints < (firemonster_health - 1000.0))
   {
      set_pev(y_hpbar, pev_frame, 100.0)
   }
   else
   {
      set_pev(y_hpbar, pev_frame, 0.0 + ((((firemonster_health - 1000.0) - 1 ) * 100) / npc_healthpoints))
   }      
}
public fireboss_done(ent)
{
   ent -= npc_start_think
   anim(ent, 2)
   set_pev(ent, pev_movetype, MOVETYPE_NONE)
   set_pev(ent, pev_nextthink, get_gametime() + 0.1)
}
public npc_firemonster_think(ent)
{
   if(!pev_valid(ent))
      return
   if(pev(ent, pev_iuser3))
      return
   if(pev(ent, pev_health) - 1000.0 < 0.0)
   {
      firemonster_death(ent)
      set_pev(ent, pev_iuser3, 1)
      return
   }
   
   if(!y_agression && (pev(ent, pev_health) - 1000.0) <= (npc_healthpoints / 2) && !y_start_thinking)
   {
      y_agression = 1
      y_start_thinking = 1
      agressive2(ent)
      return
   }
   if(!y_start_thinking)
   {
      static victim
      static Float:Origin[3], Float:VicOrigin[3], Float:distance
      victim = enemy_distance(ent)
      pev(ent, pev_origin, Origin)
      pev(victim, pev_origin, VicOrigin)
      distance = get_distance_f(Origin, VicOrigin)
      if(is_user_alive(victim))
      {
         if(distance <= 200.0)
         {
            npc_attack_simple(ent)
            set_pev(ent, pev_nextthink, get_gametime() + 2.5)
            } else {
            if(pev(ent, pev_sequence) != 4)
               anim(ent, 4)
            set_pev(ent, pev_movetype, MOVETYPE_PUSHSTEP)
            set_rendering (ent,kRenderFxNone,255,255,255,kRenderNormal,16)
            for(new i = 0; i < get_maxplayers(); i++)
            {
               if(is_user_alive(i) && entity_range(ent, i) <= 600)
               {
                  shake_screen(i)
               }
            }
            new Float:ent_place[3], Float:player_place[3]
            pev(ent, pev_origin, ent_place)
            pev(victim, pev_origin, player_place)
            follow_player(ent, ent_place, victim, player_place)
            control_ai(ent, victim, 200.0)
            if(pev(ent, pev_iuser4) != victim)
               set_pev(ent, pev_iuser4, victim)
            set_pev(ent, pev_nextthink, get_gametime() + 0.1)
         }
         } else {
         if(pev(ent, pev_sequence) != 2)
            anim(ent, 2)
         set_pev(ent, pev_nextthink, get_gametime() + 1.0)
      }      
      } else {
      set_pev(ent, pev_nextthink, get_gametime() + 2.0)
   }
   return
}
public agressive2(ent)
{
   anim(ent, 14)
   set_pev(ent, pev_movetype, MOVETYPE_NONE)
   set_rendering(ent,kRenderFxNone,255,255,255,kRenderTransAdd,200)
   for(new i = 0; i < get_maxplayers(); i++)
   {
      if(is_user_alive(i) && entity_range(ent, i) <= 4000)
      {
         shake_screen(i)
         ScreenFade(i, 15, {255, 0, 0}, 120)
      }
   }
   set_task(10.0, "off_agression2", ent+npc_agression)
}
public off_agression2(ent)
{
   ent -= npc_agression
   anim(ent, 2)
   set_pev(ent, pev_movetype, MOVETYPE_NONE)
   y_start_thinking = 0
   set_pev(ent, pev_nextthink, get_gametime() + 1.0)
}
public firemonster_death(ent)
{   
   anim(ent, 16)
   emit_sound(ent, CHAN_BODY, npc_sound[0], 1.0, ATTN_NORM, 0, PITCH_NORM)
   set_pev(ent, pev_movetype, MOVETYPE_FLY)
   set_pev(ent, pev_solid, SOLID_NOT)
   set_pev(ent, pev_velocity, {0.0, 0.0, 0.0})
   set_pev(ent, pev_deadflag, DEAD_DYING)
   remove_task(npc_ability)
   set_task(10.0, "delete_firemonster", ent)
   return HAM_SUPERCEDE   
}
public delete_firemonster(ent)
{
   remove_entity(ent)
   remove_entity(y_hpbar)
}
public firemonster_take_damage(victim, inflictor, attacker, Float:damage, damagebits)
{
   static Float:Origin[3]
   fm_get_aim_origin(attacker, Origin)
   create_blood(Origin)
   emit_sound(victim, CHAN_BODY, hitflesh[0], 1.0, ATTN_NORM, 0, PITCH_NORM)   
   
   if(get_pcvar_num(cvar_dmg_ap_allow))
   {
      // Store damage dealt
      g_damagedealt[attacker] += floatround(damage)
      
      // Reward ammo packs for every [ammo damage] dealt
      while (g_damagedealt[attacker] > get_pcvar_num(cvar_ammodamage))
      {
         g_damagedealt[attacker] -= get_pcvar_num(cvar_ammodamage)
         zp_set_user_ammo_packs(attacker, zp_get_user_ammo_packs(attacker) + get_pcvar_num(cvar_ammo_quantity)) 
      }
   }
}
stock ScreenFade(id, Timer, Colors[3], Alpha) {   
   message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("ScreenFade"), _, id);
   write_short((1<<12) * Timer)
   write_short(1<<12)
   write_short(0)
   write_byte(Colors[0])
   write_byte(Colors[1])
   write_byte(Colors[2])
   write_byte(Alpha)
   message_end()
}
stock shake_screen(id)
{
   message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("ScreenShake"),{0,0,0}, id)
   write_short(1<<14)
   write_short(1<<13)
   write_short(1<<13)
   message_end()
}
stock anim(ent, sequence) {
   set_pev(ent, pev_sequence, sequence)
   set_pev(ent, pev_animtime, halflife_time())
   set_pev(ent, pev_framerate, 1.0)
}
stock control_ai2(ent, Float:VicOrigin[3], Float:speed)
{
   static Float:fl_Velocity[3]
   static Float:EntOrigin[3]
   pev(ent, pev_origin, EntOrigin)
   static Float:distance_f
   distance_f = get_distance_f(EntOrigin, VicOrigin)
   if (distance_f > 60.0)
   {
      new Float:fl_Time = distance_f / speed
      fl_Velocity[0] = (VicOrigin[0] - EntOrigin[0]) / fl_Time
      fl_Velocity[1] = (VicOrigin[1] - EntOrigin[1]) / fl_Time
      fl_Velocity[2] = (VicOrigin[2] - EntOrigin[2]) / fl_Time
      } else {
      fl_Velocity[0] = 0.0
      fl_Velocity[1] = 0.0
      fl_Velocity[2] = 0.0
   }
   entity_set_vector(ent, EV_VEC_velocity, fl_Velocity)
}
stock get_position(ent, Float:forw, Float:right, Float:up, Float:vStart[])
{
   new Float:vOrigin[3], Float:vAngle[3], Float:vForward[3], Float:vRight[3], Float:vUp[3]
   pev(ent, pev_origin, vOrigin)
   pev(ent, pev_view_ofs,vUp)
   xs_vec_add(vOrigin,vUp,vOrigin)
   pev(ent, pev_v_angle, vAngle)
   vAngle[0] = 0.0
   angle_vector(vAngle,ANGLEVECTOR_FORWARD,vForward)
   angle_vector(vAngle,ANGLEVECTOR_RIGHT,vRight)
   angle_vector(vAngle,ANGLEVECTOR_UP,vUp)
   vStart[0] = vOrigin[0] + vForward[0] * forw + vRight[0] * right + vUp[0] * up
   vStart[1] = vOrigin[1] + vForward[1] * forw + vRight[1] * right + vUp[1] * up
   vStart[2] = vOrigin[2] + vForward[2] * forw + vRight[2] * right + vUp[2] * up
}
stock create_blood(const Float:origin[3])
{
   message_begin(MSG_BROADCAST, SVC_TEMPENTITY) 
   write_byte(TE_BLOODSPRITE)
   engfunc(EngFunc_WriteCoord, origin[0])
   engfunc(EngFunc_WriteCoord, origin[1])
   engfunc(EngFunc_WriteCoord, origin[2])
   write_short(y_bleeding[1])
   write_short(y_bleeding[0])
   write_byte(75)
   write_byte(5)
   message_end()
}

stock client_printcolor(const id,const input[], any:...)
{
    new msg[191], players[32], count = 1; vformat(msg,190,input,3);
    replace_all(msg,190,"!g","^4");    // green
    replace_all(msg,190,"!y","^1");    // normal
    replace_all(msg,190,"!t","^3");    // team
    
    if (id) players[0] = id; else get_players(players,count,"ch");
    
    for (new i=0;i<count;i++)
    {
        if (is_user_connected(players[i]))
        {
            message_begin(MSG_ONE_UNRELIABLE,get_user_msgid("SayText"),_,players[i]);
            write_byte(players[i]);
            write_string(msg);
            message_end();
        }
    }





VLW FUNFO VLW PELA AJUDA E LEK

description[AJUDA] Não Consigo Configurar O Boss Pra Da AP QUANTO PERDE SAGUE EmptyRe: [AJUDA] Não Consigo Configurar O Boss Pra Da AP QUANTO PERDE SAGUE

more_horiz
:D

description[AJUDA] Não Consigo Configurar O Boss Pra Da AP QUANTO PERDE SAGUE EmptyRe: [AJUDA] Não Consigo Configurar O Boss Pra Da AP QUANTO PERDE SAGUE

more_horiz
@Closed

description[AJUDA] Não Consigo Configurar O Boss Pra Da AP QUANTO PERDE SAGUE EmptyRe: [AJUDA] Não Consigo Configurar O Boss Pra Da AP QUANTO PERDE SAGUE

more_horiz
privacy_tip Permissões neste sub-fórum
Não podes responder a tópicos
power_settings_newInicie sessão para responder