Oberon NPC
#1
Buenas, alguien me puede ayudar? intente que al morir este npc suelte un regalito de kikizon, o que al que lo haya asesinado le de una especie de premio, dinero, ammopacks, lo que esa, pero no pude 
Código PHP:
#include <amxmodx> 
#include <engine> 
#include <fakemeta> 
#include <hamsandwich> 
#include <xs> 
#include <amxmisc>
#include <zombieplague>

#define OBERON_CLASSNAME "oberon" 
#define OBERON_HEALTH 235000.0 

#define TASK_SKILL 123123123 
#define TASK_HOOKINGUP 123312312 
#define TASK_HOOKINGDOWN 123312313 

new const oberon_model[] = "models/oberon/zbs_bossl_big02.mdl" 
new const oberon_knife_effect[] = "models/oberon/ef_knife.mdl" 
new const oberon_hole_effect[] = "models/oberon/ef_hole.mdl" 
new const oberon_bomb_model[] = "models/oberon/zbs_bossl_big02_bomb.mdl" 
new MDL[] = "models/regalito.mdl"


new SND[] = "regalitos_pickup.wav"
new const oberon_appear_sound[] = "oberon/appear.wav" 
new const oberon_death_sound[] = "oberon/death.wav" 
new const oberon_evolution_sound[] = "oberon/knife.wav" 
new const oberon_attack_sound[8][] =  

    "oberon/attack1.wav"
    "oberon/attack2.wav"
    "oberon/attack3_jump.wav"
    "oberon/attack3.wav"
    "oberon/knife_attack1.wav"
    "oberon/knife_attack2.wav"
    "oberon/knife_attack3_jump.wav"
    "oberon/knife_attack3.wav" 

new const 
oberon_hole_sound[] = "oberon/hole.wav" 
new const oberon_bomb_sound[] = "oberon/attack_bomb.wav" 


new TRAIL[] = "sprites/laserbeam.spr"

// Variables
new g_trailSprg_msgScreenFadeg_regalitos
new cvar_activadocvar_limitecvar_new_roundcvar_colors


new oberon_model_idg_regm_iBlood[2], exp_spr_id 
new Float:g_cur_origin[3], Float:g_cur_angles[3], Float:g_cur_v_angle[3
new 
g_evolutiong_evolutingg_doing_otherg_attacking3Float:g_attacking3_origin[3
new 
bool:can_pickup[33]

public 
plugin_init() 

    register_plugin("[Dias's NPC] Oberon""1.0""Dias"
     
    register_event
("HLTV""event_newround""a""1=0""2=0"
    register_touch(OBERON_CLASSNAME"*""fw_touch"
     
    register_clcmd
("say /oberon_spawn""get_origin"
    register_clcmd("say /crear_oberon""create_oberon"
    
    
    register_forward
(FM_Touch"player_Touch")
    
    register_logevent("round_start"2"1=Round_Start")
    
    cvar_activado register_cvar("regalitos_activado","1"// Activar o desactivar el plugin
    cvar_new_round register_cvar("regalitos_remover","1"// Remover Regalitos en nueva ronda
    cvar_colors register_cvar("regalitos_colores","5"// Colores de Regalitos   ( 1=Blanco 2=Rojo 3=Verde 4=Azul 5=Random)
    cvar_limite register_cvar("regalitos_limite","100"// Limite de Regalitos
    
    set_task(58.3"anuncio"100_,_"b")
    set_task(1.0"check_status"20000_,_"b")
    
    g_msgScreenFade get_user_msgid("ScreenFade")


public 
plugin_precache() 

    oberon_model_id precache_model(oberon_model
    precache_model(oberon_knife_effect
    precache_model(oberon_hole_effect
    precache_model(oberon_bomb_model
     
    precache_sound
(oberon_appear_sound
    precache_sound(oberon_death_sound
    precache_sound(oberon_evolution_sound
    for(new 0sizeof(oberon_attack_sound); i++) 
    
        precache_sound(oberon_attack_sound[i]) 
    
    precache_sound(oberon_hole_sound
    precache_sound(oberon_bomb_sound
     
    m_iBlood
[0] = precache_model("sprites/blood.spr"
    m_iBlood[1] = precache_model("sprites/bloodspray.spr")     
    exp_spr_id 
precache_model("sprites/zerogxplode.spr"
    
    precache_model
(MDL)
    precache_sound(SND)
    g_trailSpr engfunc(EngFunc_PrecacheModelTRAIL)


public 
event_newround() 

    static ent 
    ent 
find_ent_by_class(-1OBERON_CLASSNAME
     
    
if(task_exists(ent+TASK_SKILL)) remove_task(ent+TASK_SKILL


public 
get_origin(id

    pev(idpev_origing_cur_origin
    pev(idpev_anglesg_cur_angles
    pev(idpev_v_angleg_cur_v_angle
     
    client_print
(idprint_chat"[Addon Por Dias] Ok, Aqui Aparecera El Oberon"


public 
create_oberon(id
{
    if (!is_user_admin(id)) return PLUGIN_HANDLED;
    new ent create_entity("info_target"
     
    entity_set_origin
(entg_cur_origin
    entity_set_vector(entEV_VEC_anglesg_cur_angles
    //entity_set_vector(ent, EV_VEC_v_angle, g_cur_v_angle) 
     
    entity_set_float
(entEV_FL_takedamage1.0
    entity_set_float(entEV_FL_healthOBERON_HEALTH 1000.0
     
    entity_set_string
(ent,EV_SZ_classnameOBERON_CLASSNAME
    entity_set_model(entoberon_model
    entity_set_int(entEV_INT_solidSOLID_SLIDEBOX
    entity_set_int(entEV_INT_movetypeMOVETYPE_PUSHSTEP
     
    
new Float:maxs[3] = {100.0100.0100.0
    new Float:mins[3] = {-100.0, -100.0, -30.0
    entity_set_size(entminsmaxs
    entity_set_int(entEV_INT_modelindexoberon_model_id
     
    set_entity_anim
(ent1
     
    set_pev
(entpev_iuser40
     
    entity_set_float
(entEV_FL_nextthinkhalflife_time() + 6.0
    set_task(5.0"start_oberon"ent
     
    set_task
(15.0"do_random_skill"ent__"b"
     
    
if(!g_reg
    
        RegisterHamFromEntity(Ham_TakeDamageent"fw_takedmg"1
        RegisterHamFromEntity(Ham_Thinkent"fw_think"
        g_reg 
    
}     
     
    g_evolution 

    g_evoluting 

    g_doing_other 

     
    drop_to_floor
(ent
    emit_sound(entCHAN_BODYoberon_appear_sound1.0ATTN_NORM0PITCH_NORM
    return PLUGIN_HANDLED;


public 
start_oberon(ent

    set_entity_anim(ent2


public 
fw_think(ent

    if(!is_valid_ent(ent)) 
        return HAM_IGNORED 
         
    
if(pev(entpev_iuser4) == 1// Oberon is dead 
        return HAM_IGNORED 
         
    
if(g_evoluting || g_doing_other
        return HAM_IGNORED 
         
    
if(pev(entpev_health) - 1000.0 <= 0.0
    
        set_pev(entpev_iuser41
        set_entity_anim(ent20
        set_task(15.0"move_entity"ent
        entity_set_int(entEV_INT_solidSOLID_NOT
        entity_set_float(entEV_FL_takedamage0.0
         
        emit_sound
(entCHAN_BODYoberon_death_sound1.0ATTN_NORM0PITCH_NORM
         
        
return HAM_IGNORED 
    

    if((pev(entpev_health) - 1000.0 <= OBERON_HEALTH 2.0) && !g_evolution
    
        g_evoluting 
        set_entity_anim
(ent11
         
        emit_sound
(entCHAN_BODYoberon_evolution_sound1.0ATTN_NORM0PITCH_NORM
        set_task(8.0"set_new_idle"ent
         
        
return HAM_IGNORED 
    
}     
     
    
static victim 
    
static Float:Origin[3], Float:VicOrigin[3], Float:distance 
     
    victim 
FindClosesEnemy(ent
    pev(entpev_originOrigin
    pev(victimpev_originVicOrigin
     
    distance 
get_distance_f(OriginVicOrigin
     
    
if(is_user_alive(victim)) 
    
        if(distance <= 250.0
        
            if(!is_valid_ent(ent)) 
                return FMRES_IGNORED     
         
            
new Float:Ent_Origin[3], Float:Vic_Origin[3
             
            pev
(entpev_originEnt_Origin
            pev(victimpev_originVic_Origin)             
         
            npc_turntotarget
(entEnt_OriginvictimVic_Origin
             
            
static Attack_Typeattack_animattack_sound 
            Attack_Type 
random_num(12
             
            
if(Attack_Type == 1
            
                if(g_evolution
                
                    attack_anim 14 
                    attack_sound 

                
} else { 
                    attack_anim 
                    attack_sound 

                

                 
                set_entity_anim
(entattack_anim
                emit_sound(entCHAN_BODYoberon_attack_sound[attack_sound], 1.0ATTN_NORM0PITCH_NORM
                 
                set_task
(1.0"do_takedmg"ent
                 
                entity_set_float
(entEV_FL_nextthinkget_gametime() + 3.0
            } else { 
                if(g_evolution
                
                    attack_anim 15 
                    attack_sound 

                
} else {  
                    attack_anim 

                    attack_sound 

                

                     
                set_entity_anim
(entattack_anim)     
                emit_sound
(entCHAN_BODYoberon_attack_sound[attack_sound], 1.0ATTN_NORM0PITCH_NORM
                 
                set_task
(0.5"do_takedmg"ent)             
                 
                entity_set_float
(entEV_FL_nextthinkget_gametime() + 3.0
            
             
        
} else { 
            static moving_anim 
             
            
if(g_evolution
                moving_anim 13 
            else  
                moving_anim 
3         
         
            
if(pev(entpev_sequence) != moving_anim
            
                entity_set_float(entEV_FL_animtimeget_gametime()) 
                entity_set_float(entEV_FL_framerate1.0
                entity_set_int(entEV_INT_sequencemoving_anim
            
                 
            
new Float:Ent_Origin[3], Float:Vic_Origin[3
             
            pev
(entpev_originEnt_Origin
            pev(victimpev_originVic_Origin
             
            npc_turntotarget
(entEnt_OriginvictimVic_Origin
            hook_ent(entvictim100.0
             
            entity_set_float
(entEV_FL_nextthinkget_gametime() + 0.1
        
    } else { 
        static idle_anim 
         
        
if(g_evolution
            idle_anim 12 
        else  
            idle_anim 

             
        
if(pev(entpev_sequence) != idle_anim
        
            set_entity_anim(entidle_anim
        }     
             
        entity_set_float
(entEV_FL_nextthinkget_gametime() + 1.0
    }     
         
    
return HAM_HANDLED 


public 
do_random_skill(ent

    if(!pev_valid(ent)) 
        return PLUGIN_HANDLED 
         
    
if(g_evoluting
        return PLUGIN_HANDLED 
         
    
if(pev(entpev_health) - 1000.0 <= 0.0
        return PLUGIN_HANDLED 
     
    
static random_skill 
    random_skill 
random_num(0100)  
     
    g_doing_other 

     
    
switch(random_skill
    
        case 0..37: { 
            do_attack3(ent
             
        

        case 38..72: { 
            do_hole(ent
        
        case 73..100: { 
            do_bomb(ent
        }         
    
}     
     
    
return PLUGIN_CONTINUE 


public 
do_bomb(oberon

    g_doing_other 
     
    
static bomb_anim 
    
if(g_evolution
        bomb_anim 18 
    
else 
        bomb_anim 
         
    set_entity_anim
(oberonbomb_anim
     
    set_task
(3.0"do_skill_bomb"oberon+2015__"b"
    set_task(10.0"stop_skill_bomb"oberon


public 
stop_skill_bomb(oberon

    remove_task(oberon+2015
     
    
static idle_anim 
     
    
if(g_evolution
        idle_anim 12 
    else  
        idle_anim 

         
    set_entity_anim
(oberonidle_anim
    set_task(2.0"reset_think"oberon


public 
do_skill_bomb(oberon

    oberon -= 2015 
    
static Float:StartOrigin[3], Float:TempOrigin[6][3], Float:VicOrigin[6][3], Float:Random1 
     
    pev
(oberonpev_originStartOrigin
    emit_sound(oberonCHAN_BODYoberon_bomb_sound1.0ATTN_NORM0PITCH_NORM
     
    
// 1st Bomb 
    Random1 random_float(100.0500.0
    VicOrigin[0][0] = StartOrigin[0] + Random1 
    VicOrigin
[0][1] = StartOrigin[1
    VicOrigin[0][2] = StartOrigin[2
     
    TempOrigin
[0][0] = VicOrigin[0][0] - (Random1 2.0
    TempOrigin[0][1] = VicOrigin[0][1
    TempOrigin[0][2] = VicOrigin[0][2] + 500.0 
     
    
// 2nd Bomb 
    Random1 random_float(100.0500.0
    VicOrigin[1][0] = StartOrigin[0
    VicOrigin[1][1] = StartOrigin[1] + Random1 
    VicOrigin
[1][2] = StartOrigin[2
     
    TempOrigin
[1][0] = VicOrigin[1][0
    TempOrigin[1][1] = VicOrigin[1][1] - (Random1 2.0
    TempOrigin[1][2] = VicOrigin[1][2] + 500.0     
     
    
// 3rd Bomb 
    Random1 random_float(100.0500.0
    VicOrigin[2][0] = StartOrigin[0] - Random1 
    VicOrigin
[2][1] = StartOrigin[1
    VicOrigin[2][2] = StartOrigin[2
     
    TempOrigin
[2][0] = VicOrigin[2][0] - (Random1 2.0
    TempOrigin[2][1] = VicOrigin[2][1
    TempOrigin[2][2] = VicOrigin[2][2] + 500.0     
     
    
// 4th Bomb 
    VicOrigin[3][0] = StartOrigin[0
    VicOrigin[3][1] = StartOrigin[1] - Random1 
    VicOrigin
[3][2] = StartOrigin[2
     
    TempOrigin
[3][0] = VicOrigin[3][0
    TempOrigin[3][1] = VicOrigin[3][1] - (Random1 2.0
    TempOrigin[3][2] = VicOrigin[3][2] + 500.0 
     
    
// 5th Bomb 
    VicOrigin[4][0] = StartOrigin[0] + Random1 
    VicOrigin
[4][1] = StartOrigin[1] + Random1 
    VicOrigin
[4][2] = StartOrigin[2
     
    TempOrigin
[4][0] = VicOrigin[4][0] - (Random1 2.0
    TempOrigin[4][1] = VicOrigin[4][1] - (Random1 2.0
    TempOrigin[4][2] = VicOrigin[4][2] + 500.0 
     
    
// 6th Bomb 
    VicOrigin[5][0] = StartOrigin[0] + Random1 
    VicOrigin
[5][1] = StartOrigin[1] - Random1 
    VicOrigin
[5][2] = StartOrigin[2
     
    TempOrigin
[5][0] = VicOrigin[5][0] + (Random1 2.0
    TempOrigin[5][1] = VicOrigin[5][1] - (Random1 2.0
    TempOrigin[5][2] = VicOrigin[5][2] + 500.0     
     
    
for(new 06i++) 
    
        make_bomb(StartOriginTempOrigin[i], VicOrigin[i]) 
    }     


public 
make_bomb(Float:StartOrigin[3], Float:TempOrigin[3], Float:VicOrigin[3]) 

    new ent create_entity("info_target"
     
    StartOrigin
[2] += 20.0 
     
    entity_set_origin
(entStartOrigin
     
    entity_set_string
(ent,EV_SZ_classname"oberon_bomb"
    entity_set_model(entoberon_bomb_model
    entity_set_int(entEV_INT_solidSOLID_NOT
    entity_set_int(entEV_INT_movetypeMOVETYPE_BOUNCE
     
    
new Float:maxs[3] = {10.0,10.0,10.0
    new Float:mins[3] = {-10.0,-10.0,-5.0
    entity_set_size(entminsmaxs
     
    entity_set_float
(entEV_FL_animtimeget_gametime()) 
    entity_set_float(entEV_FL_framerate1.0)     
    entity_set_int
(entEV_INT_sequence0)         
     
    
static arg[4], arg2[4
     
    arg
[0] = ent 
    arg
[1] = floatround(TempOrigin[0]) 
    arg[2] = floatround(TempOrigin[1]) 
    arg[3] = floatround(TempOrigin[2]) 

    arg2[0] = ent 
    arg2
[1] = floatround(VicOrigin[0]) 
    arg2[2] = floatround(VicOrigin[1]) 
    arg2[3] = floatround(VicOrigin[2])     
     
    set_task
(0.01"do_hook_bomb_up"TASK_HOOKINGUPargsizeof(arg), "b"
    set_task(1.0"do_hook_bomb_down"_arg2sizeof(arg2)) 
    set_task(2.0"bomb_explode"ent


public 
bomb_explode(ent

    remove_task(TASK_HOOKINGUP
    remove_task(TASK_HOOKINGDOWN
     
    
static Float:Origin[3
    pev(entpev_originOrigin
     
    message_begin
(MSG_BROADCAST ,SVC_TEMPENTITY
    write_byte(TE_EXPLOSION
    engfunc(EngFunc_WriteCoordOrigin[0]) 
    engfunc(EngFunc_WriteCoordOrigin[1]) 
    engfunc(EngFunc_WriteCoordOrigin[2]) 
    write_short(exp_spr_id)    // sprite index 
    write_byte(20)    // scale in 0.1's 
    write_byte(30)    // framerate 
    write_byte(0)    // flags 
    message_end()     
     
    
for(new 1get_maxplayers(); i++) 
    
        if(is_user_alive(i) && entity_range(ient) <= 300.0
        
            static Float:Damage 
            Damage 
random_float(10.030.0
             
            
if(g_evolution
                Damage *= 2.0 
                 
            ExecuteHam
(Ham_TakeDamagei0iDamageDMG_BLAST
            hit_screen(i
        
    }     
     
    remove_entity
(ent


public 
do_hook_bomb_down(arg[4]) 

    remove_task(TASK_HOOKINGUP
    set_task(0.01"do_hook_bomb_down2"TASK_HOOKINGDOWNargsizeof(arg), "b"


public 
do_hook_bomb_down2(arg[4]) 

    static entFloat:VicOrigin[3
     
    ent 
arg[0
    VicOrigin[0] = float(arg[1]) 
    VicOrigin[1] = float(arg[2]) 
    VicOrigin[2] = float(arg[3])     
     
    hook_ent2
(entVicOrigin500.0


public 
do_hook_bomb_up(arg[4]) 

    static entFloat:TempOrigin[3
     
    ent 
arg[0
    TempOrigin[0] = float(arg[1]) 
    TempOrigin[1] = float(arg[2]) 
    TempOrigin[2] = float(arg[3]) 
     
    hook_ent2
(entTempOrigin500.0


public 
do_hole(oberon

    static hole_anim 
     
    
if(g_evolution
        hole_anim 19 
    
else 
        hole_anim 10 
         
    set_entity_anim
(oberonhole_anim
    emit_sound(oberonCHAN_BODYoberon_hole_sound1.0ATTN_NORM0PITCH_NORM
     
    
new ent create_entity("info_target"
     
    
static Float:Origin[3
    pev(oberonpev_originOrigin
     
    Origin
[2] -= 10.0 
     
    entity_set_origin
(entOrigin
     
    entity_set_string
(ent,EV_SZ_classname"hole_hook"
    entity_set_model(entoberon_hole_effect
    entity_set_int(entEV_INT_solidSOLID_NOT
    entity_set_int(entEV_INT_movetypeMOVETYPE_NONE
     
    
new Float:maxs[3] = {1.0,1.0,1.0
    new Float:mins[3] = {-1.0,-1.0,-1.0
    entity_set_size(entminsmaxs
     
    entity_set_float
(entEV_FL_animtimeget_gametime()) 
    entity_set_float(entEV_FL_framerate1.0)     
    entity_set_int
(entEV_INT_sequence0)     
     
    set_pev
(entpev_rendermodekRenderTransAdd
    set_pev(entpev_renderamt255.0)     
     
    drop_to_floor
(ent
     
    
for(new 0get_maxplayers(); i++) 
    
        if(is_user_alive(i) && entity_range(oberoni) <= 1000.0
        
            static arg[2
            arg[0] = oberon 
            arg
[1] = 
             
            set_task
(0.01"do_hook_player"512512argsizeof(arg), "b"
        
    
     
    set_task
(5.0"stop_hook"oberon+2012)     


public 
do_hook_player(arg[2]) 

    static Float:Origin[3], Float:Speed 
    pev
(arg[0], pev_originOrigin
     
    Speed 
= (1000.0 entity_range(arg[0], arg[1])) * 75.0 
     
    hook_ent2
(arg[1], OriginSpeed


public 
stop_hook(oberon

    oberon -= 2012 
     
    
static ent 
    ent 
find_ent_by_class(-1"hole_hook"
     
    remove_entity
(ent
    remove_task(512512
     
    do_takedmg
(oberon
    set_task(1.0"reset_think"oberon


public 
do_attack3(ent

    static attack3_animattack3_sound 
     
    
if(g_evolution
    
        attack3_anim 16 
        attack3_sound 

    
} else { 
        attack3_anim 
        attack3_sound 

    
}     
     
    g_attacking3 

     
    set_entity_anim
(entattack3_anim
     
    emit_sound
(entCHAN_BODYoberon_attack_sound[attack3_sound], 1.0ATTN_NORM0PITCH_NORM
    set_task(0.1"attack3_jump"ent


public 
attack3_jump(ent

    set_task(0.01"hookingup"ent+TASK_HOOKINGUP__"b"
    set_task(1.0"hookingdown"ent+TASK_HOOKINGDOWN)     
     
    
static Enemy 
    Enemy 
FindClosesEnemy(ent)     
     
    pev
(Enemypev_origing_attacking3_origin


public 
hookingup(ent

    ent -= TASK_HOOKINGUP 
     
    
static Float:Origin[3
    pev(entpev_originOrigin
     
    Origin
[2] += 1000.0 
     
    hook_ent2
(entOrigin1000.0
     
    
static Enemy 
    Enemy 
FindClosesEnemy(ent)     
     
    
new Float:Ent_Origin[3], Float:Vic_Origin[3
     
    pev
(entpev_originEnt_Origin
    pev(Enemypev_originVic_Origin
     
    npc_turntotarget
(entEnt_OriginEnemyVic_Origin)     


public 
hookingdown(ent

    ent -= TASK_HOOKINGDOWN 
     
    remove_task
(ent+TASK_HOOKINGUP
    set_task(0.5"set_func1"ent
     
    set_task
(0.01"hookingdown2"ent+TASK_HOOKINGDOWN__"b"


public 
set_func1(ent

    set_pev(entpev_iuser31


public 
hookingdown2(ent

    ent -= TASK_HOOKINGDOWN 
     
    
static Enemy 
    Enemy 
FindClosesEnemy(ent
     
    hook_ent2
(entg_attacking3_origin1000.0
     
    
new Float:Ent_Origin[3], Float:Vic_Origin[3
     
    pev
(entpev_originEnt_Origin
    pev(Enemypev_originVic_Origin
     
    npc_turntotarget
(entEnt_OriginEnemyVic_Origin)         


public 
fw_touch(enttouch

    if(!pev_valid(ent)) 
        return FMRES_IGNORED 
         
    
if(g_attacking3 && pev(entpev_iuser3) == 1
    
        remove_task(ent+TASK_HOOKINGDOWN
         
        
if(is_user_alive(touch)) 
            user_kill(touch
             
        g_attacking3 

        set_pev
(entpev_iuser30
         
        set_task
(0.75"reset_think"ent
         
        
for(new 1get_maxplayers(); i++) 
        
            if(is_user_alive(i) && entity_range(enti) <= 300.0
            
                hit_screen(i
                 
                
static Float:Damage 
                Damage 
random_float(10.025.0
                 
                
if(g_evolution
                    Damage *= 1.5 
                 
                ExecuteHam
(Ham_TakeDamagei0iDamageDMG_BLAST
            
        }     
         
        
static attack3_sound 
        
if(g_evolution
            attack3_sound 
        
else 
            attack3_sound 
         
        emit_sound
(entCHAN_BODYoberon_attack_sound[attack3_sound], 1.0ATTN_NORM0PITCH_NORM)         
             
        drop_to_floor
(ent
    
         
    
return FMRES_HANDLED 


public 
do_takedmg(ent2

    if(g_evolution
    
        new ent create_entity("info_target"
     
        
static Float:Origin[3], Float:Angles[3
        pev(ent2pev_originOrigin
        pev(ent2pev_anglesAngles
         
        entity_set_origin
(entOrigin
        entity_set_vector(entEV_VEC_anglesAngles
         
        entity_set_string
(ent,EV_SZ_classname"knife_effect"
        entity_set_model(entoberon_knife_effect
        entity_set_int(entEV_INT_solidSOLID_NOT
        entity_set_int(entEV_INT_movetypeMOVETYPE_NONE
         
        
new Float:maxs[3] = {40.040.01.0
        new Float:mins[3] = {-40.0, -40.0, -1.0
        entity_set_size(entminsmaxs
         
        drop_to_floor
(ent
         
        set_task
(1.0"remove_knife_effect"ent
    
     
    
for(new 1get_maxplayers(); i++) 
    
        if(is_user_alive(i) && entity_range(ent2i) <= 300.0
        
            hit_screen(i
             
            
static Float:Damage 
            Damage 
random_float(7.515.0
             
            
if(g_evolution
                Damage *= 2.0 
             
            ExecuteHam
(Ham_TakeDamagei0iDamageDMG_BLAST
        
    }     


public 
remove_knife_effect(ent

    remove_entity(ent


public 
set_new_idle(ent

    g_evoluting 
    g_evolution 

    set_entity_anim
(ent12
     
    entity_set_float
(entEV_FL_nextthinkget_gametime() + 0.1


public 
move_entity(ent

    static Float:Origin[3
     
    Origin
[0] = 4290.0 
    Origin
[1] = 4290.0 
    Origin
[2] = 4290.0 
     
    set_pev
(entpev_originOrigin
    entity_set_float(entEV_FL_nextthinkhalflife_time() + 99999999.0


public 
fw_takedmg(victiminflictorattackerFloat:damagedamagebits

    static Float:Origin[3
    fm_get_aimorigin(attackerOrigin
     
    client_print
(attackerprint_center"Vida Del Oberon: %i"floatround(pev(victimpev_health) - 1000.0))    
     
    create_blood
(Origin)     


stock set_entity_anim(entanim

    entity_set_float(entEV_FL_animtimeget_gametime()) 
    entity_set_float(entEV_FL_framerate1.0
    entity_set_int(entEV_INT_sequenceanim)     


stock create_blood(const Float:origin[3]) 

    // Show some blood :) 
    message_begin(MSG_BROADCASTSVC_TEMPENTITY)  
    write_byte
(TE_BLOODSPRITE
    engfunc(EngFunc_WriteCoordorigin[0]) 
    engfunc(EngFunc_WriteCoordorigin[1]) 
    engfunc(EngFunc_WriteCoordorigin[2]) 
    write_short(m_iBlood[1]) 
    write_short(m_iBlood[0]) 
    write_byte(75
    write_byte(5
    message_end() 


stock fm_get_aimorigin(indexFloat:origin[3]) 

    new Float:start[3], Float:view_ofs[3]; 
    pev(indexpev_originstart); 
    pev(indexpev_view_ofsview_ofs); 
    xs_vec_add(startview_ofsstart); 
     
    
new Float:dest[3]; 
    pev(indexpev_v_angledest); 
    engfunc(EngFunc_MakeVectorsdest); 
    global_get(glb_v_forwarddest); 
    xs_vec_mul_scalar(dest9999.0dest); 
    xs_vec_add(startdestdest); 
     
    engfunc
(EngFunc_TraceLinestartdest0index0); 
    get_tr2(0TR_vecEndPosorigin); 
     
    
return 1
}
   

public FindClosesEnemy(entid

    new Float:Dist 
    
new Float:maxdistance=4000.0 
    
new indexid=0     
    
for(new i=1;i<=get_maxplayers();i++){ 
        if(is_user_alive(i) && is_valid_ent(i) && can_see_fm(entidi)) 
        
            Dist entity_range(entidi
            if(Dist <= maxdistance
            
                maxdistance=Dist 
                indexid
=
                 
                
return indexid 
            

        }     
    
}     
    
return 


public 
npc_turntotarget(entFloat:Ent_Origin[3], targetFloat:Vic_Origin[3])  

    if(target)  
    

        new Float:newAngle[3
        entity_get_vector(entEV_VEC_anglesnewAngle
        new Float:Vic_Origin[0] - Ent_Origin[0
        new Float:Vic_Origin[1] - Ent_Origin[1

        new Float:radians floatatan(z/xradian
        newAngle[1] = radians * (180 3.14
        if (Vic_Origin[0] < Ent_Origin[0]) 
            newAngle[1] -= 180.0 
         
        entity_set_vector
(entEV_VEC_anglesnewAngle
    


public 
bool:can_see_fm(entindex1entindex2

    if (!entindex1 || !entindex2
        return false 

    
if (pev_valid(entindex1) && pev_valid(entindex1)) 
    
        new flags pev(entindex1pev_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(entindex1pev_originlookerOrig
        pev(entindex1pev_view_ofstemp
        lookerOrig[0] += temp[0
        lookerOrig[1] += temp[1
        lookerOrig[2] += temp[2

        pev(entindex2pev_origintargetBaseOrig
        pev(entindex2pev_view_ofstemp
        targetOrig[0] = targetBaseOrig [0] + temp[0
        targetOrig[1] = targetBaseOrig [1] + temp[1
        targetOrig[2] = targetBaseOrig [2] + temp[2

        engfunc(EngFunc_TraceLinelookerOrigtargetOrig0entindex10//  checks the had of seen player 
        if (get_tr2(0TraceResult:TR_InOpen) && get_tr2(0TraceResult:TR_InWater)) 
        
            return false 
        
}  
        else  
        

            new Float:flFraction 
            get_tr2
(0TraceResult:TR_flFractionflFraction
            if (flFraction == 1.0 || (get_tr2(0TraceResult:TR_pHit) == entindex2)) 
            
                return true 
            

            else 
            
                targetOrig[0] = targetBaseOrig [0
                targetOrig[1] = targetBaseOrig [1
                targetOrig[2] = targetBaseOrig [2
                engfunc(EngFunc_TraceLinelookerOrigtargetOrig0entindex10//  checks the body of seen player 
                get_tr2(0TraceResult:TR_flFractionflFraction
                if (flFraction == 1.0 || (get_tr2(0TraceResult:TR_pHit) == entindex2)) 
                
                    return true 
                

                else 
                
                    targetOrig[0] = targetBaseOrig [0
                    targetOrig[1] = targetBaseOrig [1
                    targetOrig[2] = targetBaseOrig [2] - 17.0 
                    engfunc
(EngFunc_TraceLinelookerOrigtargetOrig0entindex10//  checks the legs of seen player 
                    get_tr2(0TraceResult:TR_flFractionflFraction
                    if (flFraction == 1.0 || (get_tr2(0TraceResult:TR_pHit) == entindex2)) 
                    
                        return true 
                    

                
            
        
    
    return false 


public 
hook_ent(entvictimFloat:speed

    static Float:fl_Velocity[3
    static Float:VicOrigin[3], Float:EntOrigin[3

    pev(entpev_originEntOrigin
    pev(victimpev_originVicOrigin
     
    
static Float:distance_f 
    distance_f 
get_distance_f(EntOriginVicOrigin

    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(entEV_VEC_velocityfl_Velocity


public 
hook_ent2(entFloat:VicOrigin[3], Float:speed

    static Float:fl_Velocity[3
    static Float:EntOrigin[3

    pev(entpev_originEntOrigin
     
    
static Float:distance_f 
    distance_f 
get_distance_f(EntOriginVicOrigin

    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(entEV_VEC_velocityfl_Velocity


public 
hit_screen(id

    message_begin(MSG_ONEget_user_msgid("ScreenShake"),{0,0,0}, id
    write_short(1<<14
    write_short(1<<13
    write_short(1<<13
    message_end()     


public 
reset_think(ent

    g_doing_other 
    entity_set_float
(entEV_FL_nextthinkget_gametime() + 0.1



// En esta funcion se define el regalo que se le dara al que toque un regalito
public item(id) {
    switch (
random_num(05)) {
        case 
0: {
            
client_print(idprint_center"+ 1 AP")
            
zp_set_user_ammo_packs(idzp_get_user_ammo_packs(id) + 1)
        }
        case 
1: {
            
client_print(idprint_center"+ 2 AP")
            
zp_set_user_ammo_packs(idzp_get_user_ammo_packs(id) + 2)
        }
        case 
2: {
            
client_print(idprint_center"+ 3 AP")
            
zp_set_user_ammo_packs(idzp_get_user_ammo_packs(id) + 3)
        }
        case 
3: {
            
client_print(idprint_center"+ 4 AP")
            
zp_set_user_ammo_packs(idzp_get_user_ammo_packs(id) + 4)
        }
        case 
4: {
            
client_print(idprint_center"+ 5 AP")
            
zp_set_user_ammo_packs(idzp_get_user_ammo_packs(id) + 5)
        }
        case 
5: {
            
client_print(idprint_center"+ 500 AP")
            
zp_set_user_ammo_packs(idzp_get_user_ammo_packs(id) + 500)
        }
    }
}

public 
client_putinserver(id
    
can_pickup[id] = true

public client_disconnect(id
    
can_pickup[id] = false

public round_start() {
    if(
get_pcvar_num(cvar_new_round))
        
remover()
}

public 
reset_pick(id
    
can_pickup[id] = true

public check_status() {    
    if(!
get_pcvar_num(cvar_activado)) 
        
remover()
}

public 
remover() {    
    new 
ent = -1
    
while ((ent engfunc(EngFunc_FindEntityByStringent"classname""regalitos_volando")) != 0) {
        
engfunc(EngFunc_RemoveEntityent)
        
g_regalitos 0
    
}
}
public 
show_menu_regalitos(id) {
    new 
Menu menu_create("\r[amxmodx-es.com] \yRegalitos","menu_regalitos")
    
    
menu_additem(Menu"Soltar regalitos :3""1")
    
menu_additem(Menu"Remover todos los regalitos""2")
    
menu_additem(Menu"Seleccionar color de trail""3")
    
    
menu_setprop(MenuMPROP_EXITMEXIT_NORMAL)
    
menu_display(idMenu0)
}
public 
menu_regalitos(idMenuitem) {
    if(
item == MENU_EXIT) {
        
menu_destroy(Menu)
        return 
PLUGIN_HANDLED
    
}
    
    switch(
item) {
        case 
0dropear(id), show_menu_regalitos(id)
        case 
1remover(), show_menu_regalitos(id)
        case 
2show_menu_colores(id)
    }
    return 
PLUGIN_HANDLED
}
public 
show_menu_colores(id) {
    new 
Menu menu_create("\r[amxmodx-es.com] \yColor de trail""menu_colores")
    
    
menu_additem(Menu"Blanco""1")
    
menu_additem(Menu"Rojo""2")
    
menu_additem(Menu"Verde""3")
    
menu_additem(Menu"Azul^n""4")
    
menu_additem(Menu"Random""5")
    
    
menu_setprop(MenuMPROP_EXITMEXIT_NORMAL)
    
menu_display(idMenu0)
}
public 
menu_colores(idMenuitem) {
    if(
item == MENU_EXIT) {
        
menu_destroy(Menu)
        return 
PLUGIN_HANDLED
    
}
    switch(
item) {
        case 
0server_cmd("regalitos_colores 1")
        case 
1server_cmd("regalitos_colores 2")
        case 
2server_cmd("regalitos_colores 3")
        case 
3server_cmd("regalitos_colores 4")
        case 
4server_cmd("regalitos_colores 5")
    }
    
show_menu_regalitos(id)
    return 
PLUGIN_HANDLED
}
public 
dropear(id) {
    if(!
is_user_alive(id)) return PLUGIN_HANDLED
    
    
if(g_regalitos >= get_pcvar_num(cvar_limite)) {
        
set_hudmessage(255000.00.8016.012.0)
        
show_hudmessage(id"Limite de regalitos alcanzado")
        return 
PLUGIN_HANDLED
    
}
    if(
can_pickup[id] != false) {
        
can_pickup[id] = false
        set_task
(0.1"reset_pick"id)
        
        new 
Float:Speed[3]
        
velocity_by_aim(id10 100Speed)
        
dropear2(idSpeed)
        
g_regalitos++
        
        
set_hudmessage(025500.00.8016.012.0)
        
show_hudmessage(id"Regalitos en mapa: %d"g_regalitos)
    }
    return 
PLUGIN_HANDLED
}
public 
dropear2(idFloat:Speed[]) {
    new 
ent engfunc(EngFunc_CreateNamedEntityengfunc(EngFunc_AllocString"info_target"))
    
    new 
Float:origin[3]
    
pev(idpev_originorigin)
    
set_pev(entpev_originorigin)
    
    
Speed[2] += 100.0
    set_pev
(entpev_velocitySpeed)
    
    new 
Float:angles[3]
    
pev(entpev_angles,angles)
    
angles[1] += random_num(1,360)
    
set_pev(entpev_anglesangles)
    
    
set_pev(entpev_classname"regalitos_volando")
    
engfunc(EngFunc_SetModelentMDL)
    
engfunc(EngFunc_SetSizeentFloat:{-2.79, -0.0, -6.14}, Float:{2.421.996.35})
    
set_pev(entpev_solidSOLID_TRIGGER)
    
set_pev(entpev_movetypeMOVETYPE_BOUNCE)
    
engfunc(EngFunc_DropToFloorent)
    
    
colores(ent)    
}
public 
colores(ent) {
    
set_pev(entpev_renderfxkRenderFxGlowShell)
    
    new 
cvar get_pcvar_num(cvar_colors)
    new 
rgb
    
    
if(cvar == 1) {
        
set_pev(entpev_rendercolorFloat:{255.0255.0255.0})
        
255
        g 
255
        b 
255
    
}
    else if(
cvar == 2) {
        
set_pev(entpev_rendercolorFloat:{255.0000.0000.0})
        
255
        g 
0
        b 
0
    
}
    else if(
cvar == 3) {
        
set_pev(entpev_rendercolorFloat:{000.0255.0000.0})
        
000
        g 
255
        b 
000
    
}
    else if(
cvar == 4) {
        
set_pev(entpev_rendercolorFloat:{000.0000.0255.0})
        
000
        g 
000
        b 
255
    
} else {
        switch (
random(4)) {    
            case 
0: {
                
set_pev(entpev_rendercolorFloat:{255.0255.0255.0})
                
255
                g 
255
                b 
255
            
}
            case 
1: {
                
set_pev(entpev_rendercolorFloat:{255.0000.0000.0})
                
255 
                g 
000
                b 
000
            
}
            case 
2:{
                
set_pev(entpev_rendercolorFloat:{000.0255.0000.0})
                
000
                g 
255
                b 
000
            
}
            case 
3: {
                
set_pev(entpev_rendercolorFloat:{000.0000.0255.0})
                
000
                g 
000
                b 
255
            
}
        }
    }    
    
message_begin(MSG_BROADCASTSVC_TEMPENTITY)
    
write_byte(TE_BEAMFOLLOW)
    
write_short(ent)
    
write_short(g_trailSpr)
    
write_byte(5)
    
write_byte(1)
    
write_byte(r)
    
write_byte(g)
    
write_byte(b)
    
write_byte(255)
    
message_end()
}
public 
screen_fade(id) {
    
message_begin(MSG_ONEg_msgScreenFade, {000}, id
    
write_short(1<<12)
    
write_short(1<<12)
    
write_short(1<<12)
    
write_byte(200)
    
write_byte(200)
    
write_byte(200)
    
write_byte(20)
    
message_end()
}
public 
player_Touch(entid) { 
    if(!
pev_valid(ent) || !is_user_alive(id) ||  !get_pcvar_num(cvar_activado) || !can_pickup[id]) return FMRES_IGNORED
    
    
new classname[32]
    
pev(entpev_classnameclassnamecharsmax(classname))
    
    if(
equali(classname"regalitos_volando")) {
        
g_regalitos--
        
item(id)
        
screen_fade(id)
        
emit_sound(idCHAN_AUTOSND1.0ATTN_NORM0PITCH_NORM)
        
        if(
pev_valid(ent)) {
            
engfunc(EngFunc_RemoveEntityent)    
        }
    }
    return 
FMRES_IGNORED
}
stock client_print_color(const id, const input[], any:...) {
    new 
count 1players[32]
    static 
msg[191]
    
vformat(msg190input3)
    
    
replace_all(msg190"!g""^4")
    
replace_all(msg190"!y""^1")
    
replace_all(msg190"!t""^3")
    
replace_all(msg190"!team2""^0")
    
    if(
id)
        
players[0] = id;
    else
        
get_players(playerscount"ch")
    
    for (new 
0counti++) {
        if(
is_user_connected(players[i])) {
            
message_begin(MSG_ONE_UNRELIABLEget_user_msgid("SayText"), _players[i])
            
write_byte(players[i]);
            
write_string(msg);
            
message_end();
        }
    }

Aporte(?
Discord: leo$#9073
Responder
#2
Aviso no testee
Código PHP:
#include <amxmodx> 
#include <engine> 
#include <fakemeta> 
#include <hamsandwich> 
#include <xs> 
#include <amxmisc>
#include <zombieplague>

#define OBERON_CLASSNAME "oberon" 
#define OBERON_HEALTH 235000.0 

#define TASK_SKILL 123123123 
#define TASK_HOOKINGUP 123312312 
#define TASK_HOOKINGDOWN 123312313

#if AMXX_VERSION_NUM < 183

#define client_disconnected(%1) client_disconnect(%1)

stock client_print_color(const id, const input[], any:...)
{
    new 
count 1players[32]
    static 
msg[191]
    
vformat(msg190input3)
    
    
replace_all(msg190"!g""^4")
    
replace_all(msg190"!y""^1")
    
replace_all(msg190"!t""^3")
    
replace_all(msg190"!team2""^0")
    
    if(
id)
        
players[0] = id;
    else
        
get_players(playerscount"ch")
    
    for (new 
0counti++) {
        if(
is_user_connected(players[i])) {
            
message_begin(MSG_ONE_UNRELIABLEget_user_msgid("SayText"), _players[i])
            
write_byte(players[i]);
            
write_string(msg);
            
message_end();
        }
    }
}

#endif

new const oberon_model[] = "models/oberon/zbs_bossl_big02.mdl" 
new const oberon_knife_effect[] = "models/oberon/ef_knife.mdl" 
new const oberon_hole_effect[] = "models/oberon/ef_hole.mdl" 
new const oberon_bomb_model[] = "models/oberon/zbs_bossl_big02_bomb.mdl" 
new MDL[] = "models/regalito.mdl"


new SND[] = "regalitos_pickup.wav"
new const oberon_appear_sound[] = "oberon/appear.wav" 
new const oberon_death_sound[] = "oberon/death.wav" 
new const oberon_evolution_sound[] = "oberon/knife.wav" 
new const oberon_attack_sound[8][] =  

    
"oberon/attack1.wav"
    
"oberon/attack2.wav"
    
"oberon/attack3_jump.wav"
    
"oberon/attack3.wav"
    
"oberon/knife_attack1.wav"
    
"oberon/knife_attack2.wav"
    
"oberon/knife_attack3_jump.wav"
    
"oberon/knife_attack3.wav" 

new const 
oberon_hole_sound[] = "oberon/hole.wav" 
new const oberon_bomb_sound[] = "oberon/attack_bomb.wav" 


new TRAIL[] = "sprites/laserbeam.spr"

// Variables
new g_trailSprg_msgScreenFadeg_regalitos
new cvar_activadocvar_limitecvar_new_roundcvar_colors


new oberon_model_idg_regm_iBlood[2], exp_spr_id 
new Float:g_cur_origin[3], Float:g_cur_angles[3], Float:g_cur_v_angle[3
new 
g_evolutiong_evolutingg_doing_otherg_attacking3Float:g_attacking3_origin[3
new 
bool:can_pickup[33]

public 
plugin_init() 

    
register_plugin("[Dias's NPC] Oberon""1.0""Dias"
     
    
register_event("HLTV""event_newround""a""1=0""2=0"
    
register_touch(OBERON_CLASSNAME"*""fw_touch"
     
    
register_clcmd("say /oberon_spawn""get_origin"
    
register_clcmd("say /crear_oberon""create_oberon"
    
    
    
register_forward(FM_Touch"player_Touch")
    
    
register_logevent("round_start"2"1=Round_Start")
    
    
cvar_activado register_cvar("regalitos_activado","1"// Activar o desactivar el plugin
    
cvar_new_round register_cvar("regalitos_remover","1"// Remover Regalitos en nueva ronda
    
cvar_colors register_cvar("regalitos_colores","5"// Colores de Regalitos   ( 1=Blanco 2=Rojo 3=Verde 4=Azul 5=Random)
    
cvar_limite register_cvar("regalitos_limite","100"// Limite de Regalitos
    
    
set_task(58.3"anuncio"100_,_"b")
    
set_task(1.0"check_status"20000_,_"b")
    
    
g_msgScreenFade get_user_msgid("ScreenFade")


public 
plugin_precache() 

    
oberon_model_id precache_model(oberon_model
    
precache_model(oberon_knife_effect
    
precache_model(oberon_hole_effect
    
precache_model(oberon_bomb_model
     
    
precache_sound(oberon_appear_sound
    
precache_sound(oberon_death_sound
    
precache_sound(oberon_evolution_sound
    for(new 
0sizeof(oberon_attack_sound); i++) 
    { 
        
precache_sound(oberon_attack_sound[i]) 
    } 
    
precache_sound(oberon_hole_sound
    
precache_sound(oberon_bomb_sound
     
    
m_iBlood[0] = precache_model("sprites/blood.spr"
    
m_iBlood[1] = precache_model("sprites/bloodspray.spr")     
    
exp_spr_id precache_model("sprites/zerogxplode.spr"
    
    
precache_model(MDL)
    
precache_sound(SND)
    
g_trailSpr engfunc(EngFunc_PrecacheModelTRAIL)


public 
event_newround() 

    static 
ent 
    ent 
find_ent_by_class(-1OBERON_CLASSNAME
     
    if(
task_exists(ent+TASK_SKILL)) remove_task(ent+TASK_SKILL


public 
get_origin(id

    
pev(idpev_origing_cur_origin
    
pev(idpev_anglesg_cur_angles
    
pev(idpev_v_angleg_cur_v_angle
     
    
client_print(idprint_chat"[Addon Por Dias] Ok, Aqui Aparecera El Oberon"


public 
create_oberon(id
{
    if (!
is_user_admin(id)) return PLUGIN_HANDLED;
    new 
ent create_entity("info_target"
     
    
entity_set_origin(entg_cur_origin
    
entity_set_vector(entEV_VEC_anglesg_cur_angles
    
//entity_set_vector(ent, EV_VEC_v_angle, g_cur_v_angle) 
     
    
entity_set_float(entEV_FL_takedamage1.0
    
entity_set_float(entEV_FL_healthOBERON_HEALTH 1000.0
     
    
entity_set_string(ent,EV_SZ_classnameOBERON_CLASSNAME
    
entity_set_model(entoberon_model
    
entity_set_int(entEV_INT_solidSOLID_SLIDEBOX
    
entity_set_int(entEV_INT_movetypeMOVETYPE_PUSHSTEP
     
    new 
Float:maxs[3] = {100.0100.0100.0
    new 
Float:mins[3] = {-100.0, -100.0, -30.0
    
entity_set_size(entminsmaxs
    
entity_set_int(entEV_INT_modelindexoberon_model_id
     
    
set_entity_anim(ent1
     
    
set_pev(entpev_iuser40
     
    
entity_set_float(entEV_FL_nextthinkhalflife_time() + 6.0
    
set_task(5.0"start_oberon"ent
     
    
set_task(15.0"do_random_skill"ent__"b"
     
    if(!
g_reg
    { 
        
RegisterHamFromEntity(Ham_TakeDamageent"fw_takedmg"1
        
RegisterHamFromEntity(Ham_Thinkent"fw_think")
        
RegisterHamFromEntity(Ham_Killedent"fw_killed")
        
g_reg 
    
}     
     
    
g_evolution 
    g_evoluting 

    g_doing_other 

     
    drop_to_floor
(ent
    
emit_sound(entCHAN_BODYoberon_appear_sound1.0ATTN_NORM0PITCH_NORM
    return 
PLUGIN_HANDLED;
}

public 
fw_killed(entattacker)
{
    if(!
is_valid_ent(ent))
        return 
HAM_IGNORED;

    new 
reward_kill_oberon 5000;
    new 
name[32];

    
get_user_name(attackernamesizeof name 1);
    
zp_set_user_ammo_packs(attackerzp_get_user_ammo_packs(attacker) + reward_kill_oberon);

    
client_print(attackerprint_chat"Felicitaciones ganaste %d APs por matar el oberon"reward_kill_oberon);
    
client_print(0print_chat"El jugador %s mato al oberon"name);

    return 
HAM_IGNORED;
}

public 
start_oberon(ent

    
set_entity_anim(ent2


public 
fw_think(ent

    if(!
is_valid_ent(ent)) 
        return 
HAM_IGNORED 
         
    
if(pev(entpev_iuser4) == 1// Oberon is dead 
        
return HAM_IGNORED 
         
    
if(g_evoluting || g_doing_other
        return 
HAM_IGNORED 
         
    
if(pev(entpev_health) - 1000.0 <= 0.0
    { 
        
set_pev(entpev_iuser41
        
set_entity_anim(ent20
        
set_task(15.0"move_entity"ent
        
entity_set_int(entEV_INT_solidSOLID_NOT
        
entity_set_float(entEV_FL_takedamage0.0
         
        
emit_sound(entCHAN_BODYoberon_death_sound1.0ATTN_NORM0PITCH_NORM
         
        return 
HAM_IGNORED 
    

    if((
pev(entpev_health) - 1000.0 <= OBERON_HEALTH 2.0) && !g_evolution
    { 
        
g_evoluting 
        set_entity_anim
(ent11
         
        
emit_sound(entCHAN_BODYoberon_evolution_sound1.0ATTN_NORM0PITCH_NORM
        
set_task(8.0"set_new_idle"ent
         
        return 
HAM_IGNORED 
    
}     
     
    static 
victim 
    
static Float:Origin[3], Float:VicOrigin[3], Float:distance 
     
    victim 
FindClosesEnemy(ent
    
pev(entpev_originOrigin
    
pev(victimpev_originVicOrigin
     
    
distance get_distance_f(OriginVicOrigin
     
    if(
is_user_alive(victim)) 
    { 
        if(
distance <= 250.0
        { 
            if(!
is_valid_ent(ent)) 
                return 
FMRES_IGNORED     
         
            
new Float:Ent_Origin[3], Float:Vic_Origin[3
             
            
pev(entpev_originEnt_Origin
            
pev(victimpev_originVic_Origin)             
         
            
npc_turntotarget(entEnt_OriginvictimVic_Origin
             
            static 
Attack_Typeattack_animattack_sound 
            Attack_Type 
random_num(12
             
            if(
Attack_Type == 1
            { 
                if(
g_evolution
                { 
                    
attack_anim 14 
                    attack_sound 

                
} else { 
                    
attack_anim 
                    attack_sound 

                

                 
                
set_entity_anim(entattack_anim
                
emit_sound(entCHAN_BODYoberon_attack_sound[attack_sound], 1.0ATTN_NORM0PITCH_NORM
                 
                
set_task(1.0"do_takedmg"ent
                 
                
entity_set_float(entEV_FL_nextthinkget_gametime() + 3.0
            } else { 
                if(
g_evolution
                { 
                    
attack_anim 15 
                    attack_sound 

                
} else {  
                    
attack_anim 
                    attack_sound 

                

                     
                
set_entity_anim(entattack_anim)     
                
emit_sound(entCHAN_BODYoberon_attack_sound[attack_sound], 1.0ATTN_NORM0PITCH_NORM
                 
                
set_task(0.5"do_takedmg"ent)             
                 
                
entity_set_float(entEV_FL_nextthinkget_gametime() + 3.0
            } 
             
        } else { 
            static 
moving_anim 
             
            
if(g_evolution
                
moving_anim 13 
            
else  
                
moving_anim 3         
         
            
if(pev(entpev_sequence) != moving_anim
            { 
                
entity_set_float(entEV_FL_animtimeget_gametime()) 
                
entity_set_float(entEV_FL_framerate1.0
                
entity_set_int(entEV_INT_sequencemoving_anim
            } 
                 
            new 
Float:Ent_Origin[3], Float:Vic_Origin[3
             
            
pev(entpev_originEnt_Origin
            
pev(victimpev_originVic_Origin
             
            
npc_turntotarget(entEnt_OriginvictimVic_Origin
            
hook_ent(entvictim100.0
             
            
entity_set_float(entEV_FL_nextthinkget_gametime() + 0.1
        } 
    } else { 
        static 
idle_anim 
         
        
if(g_evolution
            
idle_anim 12 
        
else  
            
idle_anim 
             
        
if(pev(entpev_sequence) != idle_anim
        { 
            
set_entity_anim(entidle_anim
        }     
             
        
entity_set_float(entEV_FL_nextthinkget_gametime() + 1.0
    }     
         
    return 
HAM_HANDLED 


public 
do_random_skill(ent

    if(!
pev_valid(ent)) 
        return 
PLUGIN_HANDLED 
         
    
if(g_evoluting
        return 
PLUGIN_HANDLED 
         
    
if(pev(entpev_health) - 1000.0 <= 0.0
        return 
PLUGIN_HANDLED 
     
    
static random_skill 
    random_skill 
random_num(0100)  
     
    
g_doing_other 
     
    
switch(random_skill
    { 
        case 
0..37: { 
            
do_attack3(ent
             
        } 
        case 
38..72: { 
            
do_hole(ent
        } 
        case 
73..100: { 
            
do_bomb(ent
        }         
    }     
     
    return 
PLUGIN_CONTINUE 


public 
do_bomb(oberon

    
g_doing_other 
     
    
static bomb_anim 
    
if(g_evolution
        
bomb_anim 18 
    
else 
        
bomb_anim 
         
    set_entity_anim
(oberonbomb_anim
     
    
set_task(3.0"do_skill_bomb"oberon+2015__"b"
    
set_task(10.0"stop_skill_bomb"oberon


public 
stop_skill_bomb(oberon

    
remove_task(oberon+2015
     
    static 
idle_anim 
     
    
if(g_evolution
        
idle_anim 12 
    
else  
        
idle_anim 
         
    set_entity_anim
(oberonidle_anim
    
set_task(2.0"reset_think"oberon


public 
do_skill_bomb(oberon

    
oberon -= 2015 
    
static Float:StartOrigin[3], Float:TempOrigin[6][3], Float:VicOrigin[6][3], Float:Random1 
     
    pev
(oberonpev_originStartOrigin
    
emit_sound(oberonCHAN_BODYoberon_bomb_sound1.0ATTN_NORM0PITCH_NORM
     
    
// 1st Bomb 
    
Random1 random_float(100.0500.0
    
VicOrigin[0][0] = StartOrigin[0] + Random1 
    VicOrigin
[0][1] = StartOrigin[1
    
VicOrigin[0][2] = StartOrigin[2
     
    
TempOrigin[0][0] = VicOrigin[0][0] - (Random1 2.0
    
TempOrigin[0][1] = VicOrigin[0][1
    
TempOrigin[0][2] = VicOrigin[0][2] + 500.0 
     
    
// 2nd Bomb 
    
Random1 random_float(100.0500.0
    
VicOrigin[1][0] = StartOrigin[0
    
VicOrigin[1][1] = StartOrigin[1] + Random1 
    VicOrigin
[1][2] = StartOrigin[2
     
    
TempOrigin[1][0] = VicOrigin[1][0
    
TempOrigin[1][1] = VicOrigin[1][1] - (Random1 2.0
    
TempOrigin[1][2] = VicOrigin[1][2] + 500.0     
     
    
// 3rd Bomb 
    
Random1 random_float(100.0500.0
    
VicOrigin[2][0] = StartOrigin[0] - Random1 
    VicOrigin
[2][1] = StartOrigin[1
    
VicOrigin[2][2] = StartOrigin[2
     
    
TempOrigin[2][0] = VicOrigin[2][0] - (Random1 2.0
    
TempOrigin[2][1] = VicOrigin[2][1
    
TempOrigin[2][2] = VicOrigin[2][2] + 500.0     
     
    
// 4th Bomb 
    
VicOrigin[3][0] = StartOrigin[0
    
VicOrigin[3][1] = StartOrigin[1] - Random1 
    VicOrigin
[3][2] = StartOrigin[2
     
    
TempOrigin[3][0] = VicOrigin[3][0
    
TempOrigin[3][1] = VicOrigin[3][1] - (Random1 2.0
    
TempOrigin[3][2] = VicOrigin[3][2] + 500.0 
     
    
// 5th Bomb 
    
VicOrigin[4][0] = StartOrigin[0] + Random1 
    VicOrigin
[4][1] = StartOrigin[1] + Random1 
    VicOrigin
[4][2] = StartOrigin[2
     
    
TempOrigin[4][0] = VicOrigin[4][0] - (Random1 2.0
    
TempOrigin[4][1] = VicOrigin[4][1] - (Random1 2.0
    
TempOrigin[4][2] = VicOrigin[4][2] + 500.0 
     
    
// 6th Bomb 
    
VicOrigin[5][0] = StartOrigin[0] + Random1 
    VicOrigin
[5][1] = StartOrigin[1] - Random1 
    VicOrigin
[5][2] = StartOrigin[2
     
    
TempOrigin[5][0] = VicOrigin[5][0] + (Random1 2.0
    
TempOrigin[5][1] = VicOrigin[5][1] - (Random1 2.0
    
TempOrigin[5][2] = VicOrigin[5][2] + 500.0     
     
    
for(new 06i++) 
    { 
        
make_bomb(StartOriginTempOrigin[i], VicOrigin[i]) 
    }     


public 
make_bomb(Float:StartOrigin[3], Float:TempOrigin[3], Float:VicOrigin[3]) 

    new 
ent create_entity("info_target"
     
    
StartOrigin[2] += 20.0 
     
    entity_set_origin
(entStartOrigin
     
    
entity_set_string(ent,EV_SZ_classname"oberon_bomb"
    
entity_set_model(entoberon_bomb_model
    
entity_set_int(entEV_INT_solidSOLID_NOT
    
entity_set_int(entEV_INT_movetypeMOVETYPE_BOUNCE
     
    new 
Float:maxs[3] = {10.0,10.0,10.0
    new 
Float:mins[3] = {-10.0,-10.0,-5.0
    
entity_set_size(entminsmaxs
     
    
entity_set_float(entEV_FL_animtimeget_gametime()) 
    
entity_set_float(entEV_FL_framerate1.0)     
    
entity_set_int(entEV_INT_sequence0)         
     
    static 
arg[4], arg2[4
     
    
arg[0] = ent 
    arg
[1] = floatround(TempOrigin[0]) 
    
arg[2] = floatround(TempOrigin[1]) 
    
arg[3] = floatround(TempOrigin[2]) 

    
arg2[0] = ent 
    arg2
[1] = floatround(VicOrigin[0]) 
    
arg2[2] = floatround(VicOrigin[1]) 
    
arg2[3] = floatround(VicOrigin[2])     
     
    
set_task(0.01"do_hook_bomb_up"TASK_HOOKINGUPargsizeof(arg), "b"
    
set_task(1.0"do_hook_bomb_down"_arg2sizeof(arg2)) 
    
set_task(2.0"bomb_explode"ent


public 
bomb_explode(ent

    
remove_task(TASK_HOOKINGUP
    
remove_task(TASK_HOOKINGDOWN
     
    static 
Float:Origin[3
    
pev(entpev_originOrigin
     
    
message_begin(MSG_BROADCAST ,SVC_TEMPENTITY
    
write_byte(TE_EXPLOSION
    
engfunc(EngFunc_WriteCoordOrigin[0]) 
    
engfunc(EngFunc_WriteCoordOrigin[1]) 
    
engfunc(EngFunc_WriteCoordOrigin[2]) 
    
write_short(exp_spr_id)    // sprite index 
    
write_byte(20)    // scale in 0.1's 
    
write_byte(30)    // framerate 
    
write_byte(0)    // flags 
    
message_end()     
     
    for(new 
1get_maxplayers(); i++) 
    { 
        if(
is_user_alive(i) && entity_range(ient) <= 300.0
        { 
            static 
Float:Damage 
            Damage 
random_float(10.030.0
             
            if(
g_evolution
                
Damage *= 2.0 
                 
            ExecuteHam
(Ham_TakeDamagei0iDamageDMG_BLAST
            
hit_screen(i
        } 
    }     
     
    
remove_entity(ent


public 
do_hook_bomb_down(arg[4]) 

    
remove_task(TASK_HOOKINGUP
    
set_task(0.01"do_hook_bomb_down2"TASK_HOOKINGDOWNargsizeof(arg), "b"


public 
do_hook_bomb_down2(arg[4]) 

    static 
entFloat:VicOrigin[3
     
    
ent arg[0
    
VicOrigin[0] = float(arg[1]) 
    
VicOrigin[1] = float(arg[2]) 
    
VicOrigin[2] = float(arg[3])     
     
    
hook_ent2(entVicOrigin500.0


public 
do_hook_bomb_up(arg[4]) 

    static 
entFloat:TempOrigin[3
     
    
ent arg[0
    
TempOrigin[0] = float(arg[1]) 
    
TempOrigin[1] = float(arg[2]) 
    
TempOrigin[2] = float(arg[3]) 
     
    
hook_ent2(entTempOrigin500.0


public 
do_hole(oberon

    static 
hole_anim 
     
    
if(g_evolution
        
hole_anim 19 
    
else 
        
hole_anim 10 
         
    set_entity_anim
(oberonhole_anim
    
emit_sound(oberonCHAN_BODYoberon_hole_sound1.0ATTN_NORM0PITCH_NORM
     
    new 
ent create_entity("info_target"
     
    static 
Float:Origin[3
    
pev(oberonpev_originOrigin
     
    
Origin[2] -= 10.0 
     
    entity_set_origin
(entOrigin
     
    
entity_set_string(ent,EV_SZ_classname"hole_hook"
    
entity_set_model(entoberon_hole_effect
    
entity_set_int(entEV_INT_solidSOLID_NOT
    
entity_set_int(entEV_INT_movetypeMOVETYPE_NONE
     
    new 
Float:maxs[3] = {1.0,1.0,1.0
    new 
Float:mins[3] = {-1.0,-1.0,-1.0
    
entity_set_size(entminsmaxs
     
    
entity_set_float(entEV_FL_animtimeget_gametime()) 
    
entity_set_float(entEV_FL_framerate1.0)     
    
entity_set_int(entEV_INT_sequence0)     
     
    
set_pev(entpev_rendermodekRenderTransAdd
    
set_pev(entpev_renderamt255.0)     
     
    
drop_to_floor(ent
     
    for(new 
0get_maxplayers(); i++) 
    { 
        if(
is_user_alive(i) && entity_range(oberoni) <= 1000.0
        { 
            static 
arg[2
            
arg[0] = oberon 
            arg
[1] = 
             
            set_task
(0.01"do_hook_player"512512argsizeof(arg), "b"
        } 
    } 
     
    
set_task(5.0"stop_hook"oberon+2012)     


public 
do_hook_player(arg[2]) 

    static 
Float:Origin[3], Float:Speed 
    pev
(arg[0], pev_originOrigin
     
    
Speed = (1000.0 entity_range(arg[0], arg[1])) * 75.0 
     
    hook_ent2
(arg[1], OriginSpeed


public 
stop_hook(oberon

    
oberon -= 2012 
     
    
static ent 
    ent 
find_ent_by_class(-1"hole_hook"
     
    
remove_entity(ent
    
remove_task(512512
     
    
do_takedmg(oberon
    
set_task(1.0"reset_think"oberon


public 
do_attack3(ent

    static 
attack3_animattack3_sound 
     
    
if(g_evolution
    { 
        
attack3_anim 16 
        attack3_sound 

    
} else { 
        
attack3_anim 
        attack3_sound 

    
}     
     
    
g_attacking3 
     
    set_entity_anim
(entattack3_anim
     
    
emit_sound(entCHAN_BODYoberon_attack_sound[attack3_sound], 1.0ATTN_NORM0PITCH_NORM
    
set_task(0.1"attack3_jump"ent


public 
attack3_jump(ent

    
set_task(0.01"hookingup"ent+TASK_HOOKINGUP__"b"
    
set_task(1.0"hookingdown"ent+TASK_HOOKINGDOWN)     
     
    static 
Enemy 
    Enemy 
FindClosesEnemy(ent)     
     
    
pev(Enemypev_origing_attacking3_origin


public 
hookingup(ent

    
ent -= TASK_HOOKINGUP 
     
    
static Float:Origin[3
    
pev(entpev_originOrigin
     
    
Origin[2] += 1000.0 
     
    hook_ent2
(entOrigin1000.0
     
    static 
Enemy 
    Enemy 
FindClosesEnemy(ent)     
     
    new 
Float:Ent_Origin[3], Float:Vic_Origin[3
     
    
pev(entpev_originEnt_Origin
    
pev(Enemypev_originVic_Origin
     
    
npc_turntotarget(entEnt_OriginEnemyVic_Origin)     


public 
hookingdown(ent

    
ent -= TASK_HOOKINGDOWN 
     
    remove_task
(ent+TASK_HOOKINGUP
    
set_task(0.5"set_func1"ent
     
    
set_task(0.01"hookingdown2"ent+TASK_HOOKINGDOWN__"b"


public 
set_func1(ent

    
set_pev(entpev_iuser31


public 
hookingdown2(ent

    
ent -= TASK_HOOKINGDOWN 
     
    
static Enemy 
    Enemy 
FindClosesEnemy(ent
     
    
hook_ent2(entg_attacking3_origin1000.0
     
    new 
Float:Ent_Origin[3], Float:Vic_Origin[3
     
    
pev(entpev_originEnt_Origin
    
pev(Enemypev_originVic_Origin
     
    
npc_turntotarget(entEnt_OriginEnemyVic_Origin)         


public 
fw_touch(enttouch

    if(!
pev_valid(ent)) 
        return 
FMRES_IGNORED 
         
    
if(g_attacking3 && pev(entpev_iuser3) == 1
    { 
        
remove_task(ent+TASK_HOOKINGDOWN
         
        if(
is_user_alive(touch)) 
            
user_kill(touch
             
        
g_attacking3 
        set_pev
(entpev_iuser30
         
        
set_task(0.75"reset_think"ent
         
        for(new 
1get_maxplayers(); i++) 
        { 
            if(
is_user_alive(i) && entity_range(enti) <= 300.0
            { 
                
hit_screen(i
                 
                static 
Float:Damage 
                Damage 
random_float(10.025.0
                 
                if(
g_evolution
                    
Damage *= 1.5 
                 
                ExecuteHam
(Ham_TakeDamagei0iDamageDMG_BLAST
            } 
        }     
         
        static 
attack3_sound 
        
if(g_evolution
            
attack3_sound 
        
else 
            
attack3_sound 
         
        emit_sound
(entCHAN_BODYoberon_attack_sound[attack3_sound], 1.0ATTN_NORM0PITCH_NORM)         
             
        
drop_to_floor(ent
    } 
         
    return 
FMRES_HANDLED 


public 
do_takedmg(ent2

    if(
g_evolution
    { 
        new 
ent create_entity("info_target"
     
        static 
Float:Origin[3], Float:Angles[3
        
pev(ent2pev_originOrigin
        
pev(ent2pev_anglesAngles
         
        
entity_set_origin(entOrigin
        
entity_set_vector(entEV_VEC_anglesAngles
         
        
entity_set_string(ent,EV_SZ_classname"knife_effect"
        
entity_set_model(entoberon_knife_effect
        
entity_set_int(entEV_INT_solidSOLID_NOT
        
entity_set_int(entEV_INT_movetypeMOVETYPE_NONE
         
        new 
Float:maxs[3] = {40.040.01.0
        new 
Float:mins[3] = {-40.0, -40.0, -1.0
        
entity_set_size(entminsmaxs
         
        
drop_to_floor(ent
         
        
set_task(1.0"remove_knife_effect"ent
    } 
     
    for(new 
1get_maxplayers(); i++) 
    { 
        if(
is_user_alive(i) && entity_range(ent2i) <= 300.0
        { 
            
hit_screen(i
             
            static 
Float:Damage 
            Damage 
random_float(7.515.0
             
            if(
g_evolution
                
Damage *= 2.0 
             
            ExecuteHam
(Ham_TakeDamagei0iDamageDMG_BLAST
        } 
    }     


public 
remove_knife_effect(ent

    
remove_entity(ent


public 
set_new_idle(ent

    
g_evoluting 
    g_evolution 

    set_entity_anim
(ent12
     
    
entity_set_float(entEV_FL_nextthinkget_gametime() + 0.1


public 
move_entity(ent

    static 
Float:Origin[3
     
    
Origin[0] = 4290.0 
    Origin
[1] = 4290.0 
    Origin
[2] = 4290.0 
     
    set_pev
(entpev_originOrigin
    
entity_set_float(entEV_FL_nextthinkhalflife_time() + 99999999.0


public 
fw_takedmg(victiminflictorattackerFloat:damagedamagebits

    static 
Float:Origin[3
    
fm_get_aimorigin(attackerOrigin
     
    
client_print(attackerprint_center"Vida Del Oberon: %i"floatround(pev(victimpev_health) - 1000.0))    
     
    
create_blood(Origin)     


stock set_entity_anim(entanim

    
entity_set_float(entEV_FL_animtimeget_gametime()) 
    
entity_set_float(entEV_FL_framerate1.0
    
entity_set_int(entEV_INT_sequenceanim)     


stock create_blood(const Float:origin[3]) 

    
// Show some blood :) 
    
message_begin(MSG_BROADCASTSVC_TEMPENTITY)  
    
write_byte(TE_BLOODSPRITE
    
engfunc(EngFunc_WriteCoordorigin[0]) 
    
engfunc(EngFunc_WriteCoordorigin[1]) 
    
engfunc(EngFunc_WriteCoordorigin[2]) 
    
write_short(m_iBlood[1]) 
    
write_short(m_iBlood[0]) 
    
write_byte(75
    
write_byte(5
    
message_end() 


stock fm_get_aimorigin(indexFloat:origin[3]) 

    new 
Float:start[3], Float:view_ofs[3]; 
    
pev(indexpev_originstart); 
    
pev(indexpev_view_ofsview_ofs); 
    
xs_vec_add(startview_ofsstart); 
     
    new 
Float:dest[3]; 
    
pev(indexpev_v_angledest); 
    
engfunc(EngFunc_MakeVectorsdest); 
    
global_get(glb_v_forwarddest); 
    
xs_vec_mul_scalar(dest9999.0dest); 
    
xs_vec_add(startdestdest); 
     
    
engfunc(EngFunc_TraceLinestartdest0index0); 
    
get_tr2(0TR_vecEndPosorigin); 
     
    return 
1
}   

public 
FindClosesEnemy(entid

    new 
Float:Dist 
    
new Float:maxdistance=4000.0 
    
new indexid=0     
    
for(new i=1;i<=get_maxplayers();i++){ 
        if(
is_user_alive(i) && is_valid_ent(i) && can_see_fm(entidi)) 
        { 
            
Dist entity_range(entidi
            if(
Dist <= maxdistance
            { 
                
maxdistance=Dist 
                indexid
=
                 
                
return indexid 
            

        }     
    }     
    return 



public 
npc_turntotarget(entFloat:Ent_Origin[3], targetFloat:Vic_Origin[3])  

    if(
target)  
    { 
        new 
Float:newAngle[3
        
entity_get_vector(entEV_VEC_anglesnewAngle
        new 
Float:Vic_Origin[0] - Ent_Origin[0
        new 
Float:Vic_Origin[1] - Ent_Origin[1

        new 
Float:radians floatatan(z/xradian
        
newAngle[1] = radians * (180 3.14
        if (
Vic_Origin[0] < Ent_Origin[0]) 
            
newAngle[1] -= 180.0 
         
        entity_set_vector
(entEV_VEC_anglesnewAngle
    } 


public 
bool:can_see_fm(entindex1entindex2

    if (!
entindex1 || !entindex2
        return 
false 

    
if (pev_valid(entindex1) && pev_valid(entindex1)) 
    { 
        new 
flags pev(entindex1pev_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(entindex1pev_originlookerOrig
        
pev(entindex1pev_view_ofstemp
        
lookerOrig[0] += temp[0
        
lookerOrig[1] += temp[1
        
lookerOrig[2] += temp[2

        
pev(entindex2pev_origintargetBaseOrig
        
pev(entindex2pev_view_ofstemp
        
targetOrig[0] = targetBaseOrig [0] + temp[0
        
targetOrig[1] = targetBaseOrig [1] + temp[1
        
targetOrig[2] = targetBaseOrig [2] + temp[2

        
engfunc(EngFunc_TraceLinelookerOrigtargetOrig0entindex10//  checks the had of seen player 
        
if (get_tr2(0TraceResult:TR_InOpen) && get_tr2(0TraceResult:TR_InWater)) 
        { 
            return 
false 
        
}  
        else  
        { 
            new 
Float:flFraction 
            get_tr2
(0TraceResult:TR_flFractionflFraction
            if (
flFraction == 1.0 || (get_tr2(0TraceResult:TR_pHit) == entindex2)) 
            { 
                return 
true 
            

            else 
            { 
                
targetOrig[0] = targetBaseOrig [0
                
targetOrig[1] = targetBaseOrig [1
                
targetOrig[2] = targetBaseOrig [2
                
engfunc(EngFunc_TraceLinelookerOrigtargetOrig0entindex10//  checks the body of seen player 
                
get_tr2(0TraceResult:TR_flFractionflFraction
                if (
flFraction == 1.0 || (get_tr2(0TraceResult:TR_pHit) == entindex2)) 
                { 
                    return 
true 
                

                else 
                { 
                    
targetOrig[0] = targetBaseOrig [0
                    
targetOrig[1] = targetBaseOrig [1
                    
targetOrig[2] = targetBaseOrig [2] - 17.0 
                    engfunc
(EngFunc_TraceLinelookerOrigtargetOrig0entindex10//  checks the legs of seen player 
                    
get_tr2(0TraceResult:TR_flFractionflFraction
                    if (
flFraction == 1.0 || (get_tr2(0TraceResult:TR_pHit) == entindex2)) 
                    { 
                        return 
true 
                    

                } 
            } 
        } 
    } 
    return 
false 


public 
hook_ent(entvictimFloat:speed

    static 
Float:fl_Velocity[3
    static 
Float:VicOrigin[3], Float:EntOrigin[3

    
pev(entpev_originEntOrigin
    
pev(victimpev_originVicOrigin
     
    static 
Float:distance_f 
    distance_f 
get_distance_f(EntOriginVicOrigin

    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(entEV_VEC_velocityfl_Velocity


public 
hook_ent2(entFloat:VicOrigin[3], Float:speed

    static 
Float:fl_Velocity[3
    static 
Float:EntOrigin[3

    
pev(entpev_originEntOrigin
     
    static 
Float:distance_f 
    distance_f 
get_distance_f(EntOriginVicOrigin

    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(entEV_VEC_velocityfl_Velocity


public 
hit_screen(id

    
message_begin(MSG_ONEget_user_msgid("ScreenShake"),{0,0,0}, id
    
write_short(1<<14
    
write_short(1<<13
    
write_short(1<<13
    
message_end()     


public 
reset_think(ent

    
g_doing_other 
    entity_set_float
(entEV_FL_nextthinkget_gametime() + 0.1



// En esta funcion se define el regalo que se le dara al que toque un regalito
public item(id) {
    switch (
random_num(05)) {
        case 
0: {
            
client_print(idprint_center"+ 1 AP")
            
zp_set_user_ammo_packs(idzp_get_user_ammo_packs(id) + 1)
        }
        case 
1: {
            
client_print(idprint_center"+ 2 AP")
            
zp_set_user_ammo_packs(idzp_get_user_ammo_packs(id) + 2)
        }
        case 
2: {
            
client_print(idprint_center"+ 3 AP")
            
zp_set_user_ammo_packs(idzp_get_user_ammo_packs(id) + 3)
        }
        case 
3: {
            
client_print(idprint_center"+ 4 AP")
            
zp_set_user_ammo_packs(idzp_get_user_ammo_packs(id) + 4)
        }
        case 
4: {
            
client_print(idprint_center"+ 5 AP")
            
zp_set_user_ammo_packs(idzp_get_user_ammo_packs(id) + 5)
        }
        case 
5: {
            
client_print(idprint_center"+ 500 AP")
            
zp_set_user_ammo_packs(idzp_get_user_ammo_packs(id) + 500)
        }
    }
}

public 
client_putinserver(id
    
can_pickup[id] = true

public client_disconnected(id
    
can_pickup[id] = false

public round_start() {
    if(
get_pcvar_num(cvar_new_round))
        
remover()
}

public 
reset_pick(id
    
can_pickup[id] = true

public check_status() {    
    if(!
get_pcvar_num(cvar_activado)) 
        
remover()
}

public 
remover() {    
    new 
ent = -1
    
while ((ent engfunc(EngFunc_FindEntityByStringent"classname""regalitos_volando")) != 0) {
        
engfunc(EngFunc_RemoveEntityent)
        
g_regalitos 0
    
}
}
public 
show_menu_regalitos(id) {
    new 
Menu menu_create("\r[amxmodx-es.com] \yRegalitos","menu_regalitos")
    
    
menu_additem(Menu"Soltar regalitos :3""1")
    
menu_additem(Menu"Remover todos los regalitos""2")
    
menu_additem(Menu"Seleccionar color de trail""3")
    
    
menu_setprop(MenuMPROP_EXITMEXIT_NORMAL)
    
menu_display(idMenu0)
}
public 
menu_regalitos(idMenuitem) {
    if(
item == MENU_EXIT) {
        
menu_destroy(Menu)
        return 
PLUGIN_HANDLED
    
}
    
    switch(
item) {
        case 
0dropear(id), show_menu_regalitos(id)
        case 
1remover(), show_menu_regalitos(id)
        case 
2show_menu_colores(id)
    }
    return 
PLUGIN_HANDLED
}
public 
show_menu_colores(id) {
    new 
Menu menu_create("\r[amxmodx-es.com] \yColor de trail""menu_colores")
    
    
menu_additem(Menu"Blanco""1")
    
menu_additem(Menu"Rojo""2")
    
menu_additem(Menu"Verde""3")
    
menu_additem(Menu"Azul^n""4")
    
menu_additem(Menu"Random""5")
    
    
menu_setprop(MenuMPROP_EXITMEXIT_NORMAL)
    
menu_display(idMenu0)
}
public 
menu_colores(idMenuitem) {
    if(
item == MENU_EXIT) {
        
menu_destroy(Menu)
        return 
PLUGIN_HANDLED
    
}
    switch(
item) {
        case 
0server_cmd("regalitos_colores 1")
        case 
1server_cmd("regalitos_colores 2")
        case 
2server_cmd("regalitos_colores 3")
        case 
3server_cmd("regalitos_colores 4")
        case 
4server_cmd("regalitos_colores 5")
    }
    
show_menu_regalitos(id)
    return 
PLUGIN_HANDLED
}
public 
dropear(id) {
    if(!
is_user_alive(id)) return PLUGIN_HANDLED
    
    
if(g_regalitos >= get_pcvar_num(cvar_limite)) {
        
set_hudmessage(255000.00.8016.012.0)
        
show_hudmessage(id"Limite de regalitos alcanzado")
        return 
PLUGIN_HANDLED
    
}
    if(
can_pickup[id] != false) {
        
can_pickup[id] = false
        set_task
(0.1"reset_pick"id)
        
        new 
Float:Speed[3]
        
velocity_by_aim(id10 100Speed)
        
dropear2(idSpeed)
        
g_regalitos++
        
        
set_hudmessage(025500.00.8016.012.0)
        
show_hudmessage(id"Regalitos en mapa: %d"g_regalitos)
    }
    return 
PLUGIN_HANDLED
}
public 
dropear2(idFloat:Speed[]) {
    new 
ent engfunc(EngFunc_CreateNamedEntityengfunc(EngFunc_AllocString"info_target"))
    
    new 
Float:origin[3]
    
pev(idpev_originorigin)
    
set_pev(entpev_originorigin)
    
    
Speed[2] += 100.0
    set_pev
(entpev_velocitySpeed)
    
    new 
Float:angles[3]
    
pev(entpev_angles,angles)
    
angles[1] += random_num(1,360)
    
set_pev(entpev_anglesangles)
    
    
set_pev(entpev_classname"regalitos_volando")
    
engfunc(EngFunc_SetModelentMDL)
    
engfunc(EngFunc_SetSizeentFloat:{-2.79, -0.0, -6.14}, Float:{2.421.996.35})
    
set_pev(entpev_solidSOLID_TRIGGER)
    
set_pev(entpev_movetypeMOVETYPE_BOUNCE)
    
engfunc(EngFunc_DropToFloorent)
    
    
colores(ent)    
}
public 
colores(ent) {
    
set_pev(entpev_renderfxkRenderFxGlowShell)
    
    new 
cvar get_pcvar_num(cvar_colors)
    new 
rgb
    
    
if(cvar == 1) {
        
set_pev(entpev_rendercolorFloat:{255.0255.0255.0})
        
255
        g 
255
        b 
255
    
}
    else if(
cvar == 2) {
        
set_pev(entpev_rendercolorFloat:{255.0000.0000.0})
        
255
        g 
0
        b 
0
    
}
    else if(
cvar == 3) {
        
set_pev(entpev_rendercolorFloat:{000.0255.0000.0})
        
000
        g 
255
        b 
000
    
}
    else if(
cvar == 4) {
        
set_pev(entpev_rendercolorFloat:{000.0000.0255.0})
        
000
        g 
000
        b 
255
    
} else {
        switch (
random(4)) {    
            case 
0: {
                
set_pev(entpev_rendercolorFloat:{255.0255.0255.0})
                
255
                g 
255
                b 
255
            
}
            case 
1: {
                
set_pev(entpev_rendercolorFloat:{255.0000.0000.0})
                
255 
                g 
000
                b 
000
            
}
            case 
2:{
                
set_pev(entpev_rendercolorFloat:{000.0255.0000.0})
                
000
                g 
255
                b 
000
            
}
            case 
3: {
                
set_pev(entpev_rendercolorFloat:{000.0000.0255.0})
                
000
                g 
000
                b 
255
            
}
        }
    }    
    
message_begin(MSG_BROADCASTSVC_TEMPENTITY)
    
write_byte(TE_BEAMFOLLOW)
    
write_short(ent)
    
write_short(g_trailSpr)
    
write_byte(5)
    
write_byte(1)
    
write_byte(r)
    
write_byte(g)
    
write_byte(b)
    
write_byte(255)
    
message_end()
}
public 
screen_fade(id) {
    
message_begin(MSG_ONEg_msgScreenFade, {000}, id
    
write_short(1<<12)
    
write_short(1<<12)
    
write_short(1<<12)
    
write_byte(200)
    
write_byte(200)
    
write_byte(200)
    
write_byte(20)
    
message_end()
}
public 
player_Touch(entid) { 
    if(!
pev_valid(ent) || !is_user_alive(id) ||  !get_pcvar_num(cvar_activado) || !can_pickup[id]) return FMRES_IGNORED
    
    
new classname[32]
    
pev(entpev_classnameclassnamecharsmax(classname))
    
    if(
equali(classname"regalitos_volando")) {
        
g_regalitos--
        
item(id)
        
screen_fade(id)
        
emit_sound(idCHAN_AUTOSND1.0ATTN_NORM0PITCH_NORM)
        
        if(
pev_valid(ent)) {
            
engfunc(EngFunc_RemoveEntityent)    
        }
    }
    return 
FMRES_IGNORED

“Quien te quiere en su vida, volverá a buscarte”
Qué frase más estúpida
Porque quien te quiere en su vida, jamás se iría.
Responder
#3
(27/05/2022, 09:27 PM)HK-416 escribió: Aviso no testee
Código PHP:
#include <amxmodx> 
#include <engine> 
#include <fakemeta> 
#include <hamsandwich> 
#include <xs> 
#include <amxmisc>
#include <zombieplague>

#define OBERON_CLASSNAME "oberon" 
#define OBERON_HEALTH 235000.0 

#define TASK_SKILL 123123123 
#define TASK_HOOKINGUP 123312312 
#define TASK_HOOKINGDOWN 123312313

#if AMXX_VERSION_NUM < 183

#define client_disconnected(%1) client_disconnect(%1)

stock client_print_color(const id, const input[], any:...)
{
    new count 1players[32]
    static msg[191]
    vformat(msg190input3)
    
    replace_all
(msg190"!g""^4")
    replace_all(msg190"!y""^1")
    replace_all(msg190"!t""^3")
    replace_all(msg190"!team2""^0")
    
    
if(id)
        players[0] = id;
    else
        get_players(playerscount"ch")
    
    
for (new 0counti++) {
        if(is_user_connected(players[i])) {
            message_begin(MSG_ONE_UNRELIABLEget_user_msgid("SayText"), _players[i])
            write_byte(players[i]);
            write_string(msg);
            message_end();
        }
    }
}

#endif

new const oberon_model[] = "models/oberon/zbs_bossl_big02.mdl" 
new const oberon_knife_effect[] = "models/oberon/ef_knife.mdl" 
new const oberon_hole_effect[] = "models/oberon/ef_hole.mdl" 
new const oberon_bomb_model[] = "models/oberon/zbs_bossl_big02_bomb.mdl" 
new MDL[] = "models/regalito.mdl"


new SND[] = "regalitos_pickup.wav"
new const oberon_appear_sound[] = "oberon/appear.wav" 
new const oberon_death_sound[] = "oberon/death.wav" 
new const oberon_evolution_sound[] = "oberon/knife.wav" 
new const oberon_attack_sound[8][] =  

    "oberon/attack1.wav"
    "oberon/attack2.wav"
    "oberon/attack3_jump.wav"
    "oberon/attack3.wav"
    "oberon/knife_attack1.wav"
    "oberon/knife_attack2.wav"
    "oberon/knife_attack3_jump.wav"
    "oberon/knife_attack3.wav" 

new const 
oberon_hole_sound[] = "oberon/hole.wav" 
new const oberon_bomb_sound[] = "oberon/attack_bomb.wav" 


new TRAIL[] = "sprites/laserbeam.spr"

// Variables
new g_trailSprg_msgScreenFadeg_regalitos
new cvar_activadocvar_limitecvar_new_roundcvar_colors


new oberon_model_idg_regm_iBlood[2], exp_spr_id 
new Float:g_cur_origin[3], Float:g_cur_angles[3], Float:g_cur_v_angle[3
new 
g_evolutiong_evolutingg_doing_otherg_attacking3Float:g_attacking3_origin[3
new 
bool:can_pickup[33]

public 
plugin_init() 

    register_plugin("[Dias's NPC] Oberon""1.0""Dias"
     
    register_event
("HLTV""event_newround""a""1=0""2=0"
    register_touch(OBERON_CLASSNAME"*""fw_touch"
     
    register_clcmd
("say /oberon_spawn""get_origin"
    register_clcmd("say /crear_oberon""create_oberon"
    
    
    register_forward
(FM_Touch"player_Touch")
    
    register_logevent
("round_start"2"1=Round_Start")
    
    cvar_activado 
register_cvar("regalitos_activado","1"// Activar o desactivar el plugin
    cvar_new_round register_cvar("regalitos_remover","1"// Remover Regalitos en nueva ronda
    cvar_colors register_cvar("regalitos_colores","5"// Colores de Regalitos   ( 1=Blanco 2=Rojo 3=Verde 4=Azul 5=Random)
    cvar_limite register_cvar("regalitos_limite","100"// Limite de Regalitos
    
    set_task
(58.3"anuncio"100_,_"b")
    set_task(1.0"check_status"20000_,_"b")
    
    g_msgScreenFade 
get_user_msgid("ScreenFade")


public 
plugin_precache() 

    oberon_model_id precache_model(oberon_model
    precache_model(oberon_knife_effect
    precache_model(oberon_hole_effect
    precache_model(oberon_bomb_model
     
    precache_sound
(oberon_appear_sound
    precache_sound(oberon_death_sound
    precache_sound(oberon_evolution_sound
    for(new 0sizeof(oberon_attack_sound); i++) 
    
        precache_sound(oberon_attack_sound[i]) 
    
    precache_sound(oberon_hole_sound
    precache_sound(oberon_bomb_sound
     
    m_iBlood
[0] = precache_model("sprites/blood.spr"
    m_iBlood[1] = precache_model("sprites/bloodspray.spr")     
    exp_spr_id 
precache_model("sprites/zerogxplode.spr"
    
    precache_model
(MDL)
    precache_sound(SND)
    g_trailSpr engfunc(EngFunc_PrecacheModelTRAIL)


public 
event_newround() 

    static ent 
    ent 
find_ent_by_class(-1OBERON_CLASSNAME
     
    
if(task_exists(ent+TASK_SKILL)) remove_task(ent+TASK_SKILL


public 
get_origin(id

    pev(idpev_origing_cur_origin
    pev(idpev_anglesg_cur_angles
    pev(idpev_v_angleg_cur_v_angle
     
    client_print
(idprint_chat"[Addon Por Dias] Ok, Aqui Aparecera El Oberon"


public 
create_oberon(id
{
    if (!is_user_admin(id)) return PLUGIN_HANDLED;
    new ent create_entity("info_target"
     
    entity_set_origin
(entg_cur_origin
    entity_set_vector(entEV_VEC_anglesg_cur_angles
    //entity_set_vector(ent, EV_VEC_v_angle, g_cur_v_angle) 
     
    entity_set_float
(entEV_FL_takedamage1.0
    entity_set_float(entEV_FL_healthOBERON_HEALTH 1000.0
     
    entity_set_string
(ent,EV_SZ_classnameOBERON_CLASSNAME
    entity_set_model(entoberon_model
    entity_set_int(entEV_INT_solidSOLID_SLIDEBOX
    entity_set_int(entEV_INT_movetypeMOVETYPE_PUSHSTEP
     
    
new Float:maxs[3] = {100.0100.0100.0
    new Float:mins[3] = {-100.0, -100.0, -30.0
    entity_set_size(entminsmaxs
    entity_set_int(entEV_INT_modelindexoberon_model_id
     
    set_entity_anim
(ent1
     
    set_pev
(entpev_iuser40
     
    entity_set_float
(entEV_FL_nextthinkhalflife_time() + 6.0
    set_task(5.0"start_oberon"ent
     
    set_task
(15.0"do_random_skill"ent__"b"
     
    
if(!g_reg
    
        RegisterHamFromEntity(Ham_TakeDamageent"fw_takedmg"1
        RegisterHamFromEntity(Ham_Thinkent"fw_think")
        RegisterHamFromEntity(Ham_Killedent"fw_killed")
        g_reg 
    
}     
     
    g_evolution 

    g_evoluting 

    g_doing_other 

     
    drop_to_floor
(ent
    emit_sound(entCHAN_BODYoberon_appear_sound1.0ATTN_NORM0PITCH_NORM
    return PLUGIN_HANDLED;
}

public 
fw_killed(entattacker)
{
    if(!
is_valid_ent(ent))
        return 
HAM_IGNORED;

    new 
reward_kill_oberon 5000;
    new 
name[32];

    
get_user_name(attackernamesizeof name 1);
    
zp_set_user_ammo_packs(attackerzp_get_user_ammo_packs(attacker) + reward_kill_oberon);

    
client_print(attackerprint_chat"Felicitaciones ganaste %d APs por matar el oberon"reward_kill_oberon);
    
client_print(0print_chat"El jugador %s mato al oberon"name);

    return 
HAM_IGNORED;
}

public 
start_oberon(ent

    set_entity_anim(ent2


public 
fw_think(ent

    if(!is_valid_ent(ent)) 
        return HAM_IGNORED 
         
    
if(pev(entpev_iuser4) == 1// Oberon is dead 
        return HAM_IGNORED 
         
    
if(g_evoluting || g_doing_other
        return HAM_IGNORED 
         
    
if(pev(entpev_health) - 1000.0 <= 0.0
    
        set_pev(entpev_iuser41
        set_entity_anim(ent20
        set_task(15.0"move_entity"ent
        entity_set_int(entEV_INT_solidSOLID_NOT
        entity_set_float(entEV_FL_takedamage0.0
         
        emit_sound
(entCHAN_BODYoberon_death_sound1.0ATTN_NORM0PITCH_NORM
         
        
return HAM_IGNORED 
    

    if((pev(entpev_health) - 1000.0 <= OBERON_HEALTH 2.0) && !g_evolution
    
        g_evoluting 
        set_entity_anim
(ent11
         
        emit_sound
(entCHAN_BODYoberon_evolution_sound1.0ATTN_NORM0PITCH_NORM
        set_task(8.0"set_new_idle"ent
         
        
return HAM_IGNORED 
    
}     
     
    
static victim 
    
static Float:Origin[3], Float:VicOrigin[3], Float:distance 
     
    victim 
FindClosesEnemy(ent
    pev(entpev_originOrigin
    pev(victimpev_originVicOrigin
     
    distance 
get_distance_f(OriginVicOrigin
     
    
if(is_user_alive(victim)) 
    
        if(distance <= 250.0
        
            if(!is_valid_ent(ent)) 
                return FMRES_IGNORED     
         
            
new Float:Ent_Origin[3], Float:Vic_Origin[3
             
            pev
(entpev_originEnt_Origin
            pev(victimpev_originVic_Origin)             
         
            npc_turntotarget
(entEnt_OriginvictimVic_Origin
             
            
static Attack_Typeattack_animattack_sound 
            Attack_Type 
random_num(12
             
            
if(Attack_Type == 1
            
                if(g_evolution
                
                    attack_anim 14 
                    attack_sound 

                
} else { 
                    attack_anim 
                    attack_sound 

                

                 
                set_entity_anim
(entattack_anim
                emit_sound(entCHAN_BODYoberon_attack_sound[attack_sound], 1.0ATTN_NORM0PITCH_NORM
                 
                set_task
(1.0"do_takedmg"ent
                 
                entity_set_float
(entEV_FL_nextthinkget_gametime() + 3.0
            } else { 
                if(g_evolution
                
                    attack_anim 15 
                    attack_sound 

                
} else {  
                    attack_anim 

                    attack_sound 

                

                     
                set_entity_anim
(entattack_anim)     
                emit_sound
(entCHAN_BODYoberon_attack_sound[attack_sound], 1.0ATTN_NORM0PITCH_NORM
                 
                set_task
(0.5"do_takedmg"ent)             
                 
                entity_set_float
(entEV_FL_nextthinkget_gametime() + 3.0
            
             
        
} else { 
            static moving_anim 
             
            
if(g_evolution
                moving_anim 13 
            else  
                moving_anim 
3         
         
            
if(pev(entpev_sequence) != moving_anim
            
                entity_set_float(entEV_FL_animtimeget_gametime()) 
                entity_set_float(entEV_FL_framerate1.0
                entity_set_int(entEV_INT_sequencemoving_anim
            
                 
            
new Float:Ent_Origin[3], Float:Vic_Origin[3
             
            pev
(entpev_originEnt_Origin
            pev(victimpev_originVic_Origin
             
            npc_turntotarget
(entEnt_OriginvictimVic_Origin
            hook_ent(entvictim100.0
             
            entity_set_float
(entEV_FL_nextthinkget_gametime() + 0.1
        
    } else { 
        static idle_anim 
         
        
if(g_evolution
            idle_anim 12 
        else  
            idle_anim 

             
        
if(pev(entpev_sequence) != idle_anim
        
            set_entity_anim(entidle_anim
        }     
             
        entity_set_float
(entEV_FL_nextthinkget_gametime() + 1.0
    }     
         
    
return HAM_HANDLED 


public 
do_random_skill(ent

    if(!pev_valid(ent)) 
        return PLUGIN_HANDLED 
         
    
if(g_evoluting
        return PLUGIN_HANDLED 
         
    
if(pev(entpev_health) - 1000.0 <= 0.0
        return PLUGIN_HANDLED 
     
    
static random_skill 
    random_skill 
random_num(0100)  
     
    g_doing_other 

     
    
switch(random_skill
    
        case 0..37: { 
            do_attack3(ent
             
        

        case 38..72: { 
            do_hole(ent
        
        case 73..100: { 
            do_bomb(ent
        }         
    
}     
     
    
return PLUGIN_CONTINUE 


public 
do_bomb(oberon

    g_doing_other 
     
    
static bomb_anim 
    
if(g_evolution
        bomb_anim 18 
    
else 
        bomb_anim 
         
    set_entity_anim
(oberonbomb_anim
     
    set_task
(3.0"do_skill_bomb"oberon+2015__"b"
    set_task(10.0"stop_skill_bomb"oberon


public 
stop_skill_bomb(oberon

    remove_task(oberon+2015
     
    
static idle_anim 
     
    
if(g_evolution
        idle_anim 12 
    else  
        idle_anim 

         
    set_entity_anim
(oberonidle_anim
    set_task(2.0"reset_think"oberon


public 
do_skill_bomb(oberon

    oberon -= 2015 
    
static Float:StartOrigin[3], Float:TempOrigin[6][3], Float:VicOrigin[6][3], Float:Random1 
     
    pev
(oberonpev_originStartOrigin
    emit_sound(oberonCHAN_BODYoberon_bomb_sound1.0ATTN_NORM0PITCH_NORM
     
    
// 1st Bomb 
    Random1 random_float(100.0500.0
    VicOrigin[0][0] = StartOrigin[0] + Random1 
    VicOrigin
[0][1] = StartOrigin[1
    VicOrigin[0][2] = StartOrigin[2
     
    TempOrigin
[0][0] = VicOrigin[0][0] - (Random1 2.0
    TempOrigin[0][1] = VicOrigin[0][1
    TempOrigin[0][2] = VicOrigin[0][2] + 500.0 
     
    
// 2nd Bomb 
    Random1 random_float(100.0500.0
    VicOrigin[1][0] = StartOrigin[0
    VicOrigin[1][1] = StartOrigin[1] + Random1 
    VicOrigin
[1][2] = StartOrigin[2
     
    TempOrigin
[1][0] = VicOrigin[1][0
    TempOrigin[1][1] = VicOrigin[1][1] - (Random1 2.0
    TempOrigin[1][2] = VicOrigin[1][2] + 500.0     
     
    
// 3rd Bomb 
    Random1 random_float(100.0500.0
    VicOrigin[2][0] = StartOrigin[0] - Random1 
    VicOrigin
[2][1] = StartOrigin[1
    VicOrigin[2][2] = StartOrigin[2
     
    TempOrigin
[2][0] = VicOrigin[2][0] - (Random1 2.0
    TempOrigin[2][1] = VicOrigin[2][1
    TempOrigin[2][2] = VicOrigin[2][2] + 500.0     
     
    
// 4th Bomb 
    VicOrigin[3][0] = StartOrigin[0
    VicOrigin[3][1] = StartOrigin[1] - Random1 
    VicOrigin
[3][2] = StartOrigin[2
     
    TempOrigin
[3][0] = VicOrigin[3][0
    TempOrigin[3][1] = VicOrigin[3][1] - (Random1 2.0
    TempOrigin[3][2] = VicOrigin[3][2] + 500.0 
     
    
// 5th Bomb 
    VicOrigin[4][0] = StartOrigin[0] + Random1 
    VicOrigin
[4][1] = StartOrigin[1] + Random1 
    VicOrigin
[4][2] = StartOrigin[2
     
    TempOrigin
[4][0] = VicOrigin[4][0] - (Random1 2.0
    TempOrigin[4][1] = VicOrigin[4][1] - (Random1 2.0
    TempOrigin[4][2] = VicOrigin[4][2] + 500.0 
     
    
// 6th Bomb 
    VicOrigin[5][0] = StartOrigin[0] + Random1 
    VicOrigin
[5][1] = StartOrigin[1] - Random1 
    VicOrigin
[5][2] = StartOrigin[2
     
    TempOrigin
[5][0] = VicOrigin[5][0] + (Random1 2.0
    TempOrigin[5][1] = VicOrigin[5][1] - (Random1 2.0
    TempOrigin[5][2] = VicOrigin[5][2] + 500.0     
     
    
for(new 06i++) 
    
        make_bomb(StartOriginTempOrigin[i], VicOrigin[i]) 
    }     


public 
make_bomb(Float:StartOrigin[3], Float:TempOrigin[3], Float:VicOrigin[3]) 

    new ent create_entity("info_target"
     
    StartOrigin
[2] += 20.0 
     
    entity_set_origin
(entStartOrigin
     
    entity_set_string
(ent,EV_SZ_classname"oberon_bomb"
    entity_set_model(entoberon_bomb_model
    entity_set_int(entEV_INT_solidSOLID_NOT
    entity_set_int(entEV_INT_movetypeMOVETYPE_BOUNCE
     
    
new Float:maxs[3] = {10.0,10.0,10.0
    new Float:mins[3] = {-10.0,-10.0,-5.0
    entity_set_size(entminsmaxs
     
    entity_set_float
(entEV_FL_animtimeget_gametime()) 
    entity_set_float(entEV_FL_framerate1.0)     
    entity_set_int
(entEV_INT_sequence0)         
     
    
static arg[4], arg2[4
     
    arg
[0] = ent 
    arg
[1] = floatround(TempOrigin[0]) 
    arg[2] = floatround(TempOrigin[1]) 
    arg[3] = floatround(TempOrigin[2]) 

    arg2[0] = ent 
    arg2
[1] = floatround(VicOrigin[0]) 
    arg2[2] = floatround(VicOrigin[1]) 
    arg2[3] = floatround(VicOrigin[2])     
     
    set_task
(0.01"do_hook_bomb_up"TASK_HOOKINGUPargsizeof(arg), "b"
    set_task(1.0"do_hook_bomb_down"_arg2sizeof(arg2)) 
    set_task(2.0"bomb_explode"ent


public 
bomb_explode(ent

    remove_task(TASK_HOOKINGUP
    remove_task(TASK_HOOKINGDOWN
     
    
static Float:Origin[3
    pev(entpev_originOrigin
     
    message_begin
(MSG_BROADCAST ,SVC_TEMPENTITY
    write_byte(TE_EXPLOSION
    engfunc(EngFunc_WriteCoordOrigin[0]) 
    engfunc(EngFunc_WriteCoordOrigin[1]) 
    engfunc(EngFunc_WriteCoordOrigin[2]) 
    write_short(exp_spr_id)    // sprite index 
    write_byte(20)    // scale in 0.1's 
    write_byte(30)    // framerate 
    write_byte(0)    // flags 
    message_end()     
     
    
for(new 1get_maxplayers(); i++) 
    
        if(is_user_alive(i) && entity_range(ient) <= 300.0
        
            static Float:Damage 
            Damage 
random_float(10.030.0
             
            
if(g_evolution
                Damage *= 2.0 
                 
            ExecuteHam
(Ham_TakeDamagei0iDamageDMG_BLAST
            hit_screen(i
        
    }     
     
    remove_entity
(ent


public 
do_hook_bomb_down(arg[4]) 

    remove_task(TASK_HOOKINGUP
    set_task(0.01"do_hook_bomb_down2"TASK_HOOKINGDOWNargsizeof(arg), "b"


public 
do_hook_bomb_down2(arg[4]) 

    static entFloat:VicOrigin[3
     
    ent 
arg[0
    VicOrigin[0] = float(arg[1]) 
    VicOrigin[1] = float(arg[2]) 
    VicOrigin[2] = float(arg[3])     
     
    hook_ent2
(entVicOrigin500.0


public 
do_hook_bomb_up(arg[4]) 

    static entFloat:TempOrigin[3
     
    ent 
arg[0
    TempOrigin[0] = float(arg[1]) 
    TempOrigin[1] = float(arg[2]) 
    TempOrigin[2] = float(arg[3]) 
     
    hook_ent2
(entTempOrigin500.0


public 
do_hole(oberon

    static hole_anim 
     
    
if(g_evolution
        hole_anim 19 
    
else 
        hole_anim 10 
         
    set_entity_anim
(oberonhole_anim
    emit_sound(oberonCHAN_BODYoberon_hole_sound1.0ATTN_NORM0PITCH_NORM
     
    
new ent create_entity("info_target"
     
    
static Float:Origin[3
    pev(oberonpev_originOrigin
     
    Origin
[2] -= 10.0 
     
    entity_set_origin
(entOrigin
     
    entity_set_string
(ent,EV_SZ_classname"hole_hook"
    entity_set_model(entoberon_hole_effect
    entity_set_int(entEV_INT_solidSOLID_NOT
    entity_set_int(entEV_INT_movetypeMOVETYPE_NONE
     
    
new Float:maxs[3] = {1.0,1.0,1.0
    new Float:mins[3] = {-1.0,-1.0,-1.0
    entity_set_size(entminsmaxs
     
    entity_set_float
(entEV_FL_animtimeget_gametime()) 
    entity_set_float(entEV_FL_framerate1.0)     
    entity_set_int
(entEV_INT_sequence0)     
     
    set_pev
(entpev_rendermodekRenderTransAdd
    set_pev(entpev_renderamt255.0)     
     
    drop_to_floor
(ent
     
    
for(new 0get_maxplayers(); i++) 
    
        if(is_user_alive(i) && entity_range(oberoni) <= 1000.0
        
            static arg[2
            arg[0] = oberon 
            arg
[1] = 
             
            set_task
(0.01"do_hook_player"512512argsizeof(arg), "b"
        
    
     
    set_task
(5.0"stop_hook"oberon+2012)     


public 
do_hook_player(arg[2]) 

    static Float:Origin[3], Float:Speed 
    pev
(arg[0], pev_originOrigin
     
    Speed 
= (1000.0 entity_range(arg[0], arg[1])) * 75.0 
     
    hook_ent2
(arg[1], OriginSpeed


public 
stop_hook(oberon

    oberon -= 2012 
     
    
static ent 
    ent 
find_ent_by_class(-1"hole_hook"
     
    remove_entity
(ent
    remove_task(512512
     
    do_takedmg
(oberon
    set_task(1.0"reset_think"oberon


public 
do_attack3(ent

    static attack3_animattack3_sound 
     
    
if(g_evolution
    
        attack3_anim 16 
        attack3_sound 

    
} else { 
        attack3_anim 
        attack3_sound 

    
}     
     
    g_attacking3 

     
    set_entity_anim
(entattack3_anim
     
    emit_sound
(entCHAN_BODYoberon_attack_sound[attack3_sound], 1.0ATTN_NORM0PITCH_NORM
    set_task(0.1"attack3_jump"ent


public 
attack3_jump(ent

    set_task(0.01"hookingup"ent+TASK_HOOKINGUP__"b"
    set_task(1.0"hookingdown"ent+TASK_HOOKINGDOWN)     
     
    
static Enemy 
    Enemy 
FindClosesEnemy(ent)     
     
    pev
(Enemypev_origing_attacking3_origin


public 
hookingup(ent

    ent -= TASK_HOOKINGUP 
     
    
static Float:Origin[3
    pev(entpev_originOrigin
     
    Origin
[2] += 1000.0 
     
    hook_ent2
(entOrigin1000.0
     
    
static Enemy 
    Enemy 
FindClosesEnemy(ent)     
     
    
new Float:Ent_Origin[3], Float:Vic_Origin[3
     
    pev
(entpev_originEnt_Origin
    pev(Enemypev_originVic_Origin
     
    npc_turntotarget
(entEnt_OriginEnemyVic_Origin)     


public 
hookingdown(ent

    ent -= TASK_HOOKINGDOWN 
     
    remove_task
(ent+TASK_HOOKINGUP
    set_task(0.5"set_func1"ent
     
    set_task
(0.01"hookingdown2"ent+TASK_HOOKINGDOWN__"b"


public 
set_func1(ent

    set_pev(entpev_iuser31


public 
hookingdown2(ent

    ent -= TASK_HOOKINGDOWN 
     
    
static Enemy 
    Enemy 
FindClosesEnemy(ent
     
    hook_ent2
(entg_attacking3_origin1000.0
     
    
new Float:Ent_Origin[3], Float:Vic_Origin[3
     
    pev
(entpev_originEnt_Origin
    pev(Enemypev_originVic_Origin
     
    npc_turntotarget
(entEnt_OriginEnemyVic_Origin)         


public 
fw_touch(enttouch

    if(!pev_valid(ent)) 
        return FMRES_IGNORED 
         
    
if(g_attacking3 && pev(entpev_iuser3) == 1
    
        remove_task(ent+TASK_HOOKINGDOWN
         
        
if(is_user_alive(touch)) 
            user_kill(touch
             
        g_attacking3 

        set_pev
(entpev_iuser30
         
        set_task
(0.75"reset_think"ent
         
        
for(new 1get_maxplayers(); i++) 
        
            if(is_user_alive(i) && entity_range(enti) <= 300.0
            
                hit_screen(i
                 
                
static Float:Damage 
                Damage 
random_float(10.025.0
                 
                
if(g_evolution
                    Damage *= 1.5 
                 
                ExecuteHam
(Ham_TakeDamagei0iDamageDMG_BLAST
            
        }     
         
        
static attack3_sound 
        
if(g_evolution
            attack3_sound 
        
else 
            attack3_sound 
         
        emit_sound
(entCHAN_BODYoberon_attack_sound[attack3_sound], 1.0ATTN_NORM0PITCH_NORM)         
             
        drop_to_floor
(ent
    
         
    
return FMRES_HANDLED 


public 
do_takedmg(ent2

    if(g_evolution
    
        new ent create_entity("info_target"
     
        
static Float:Origin[3], Float:Angles[3
        pev(ent2pev_originOrigin
        pev(ent2pev_anglesAngles
         
        entity_set_origin
(entOrigin
        entity_set_vector(entEV_VEC_anglesAngles
         
        entity_set_string
(ent,EV_SZ_classname"knife_effect"
        entity_set_model(entoberon_knife_effect
        entity_set_int(entEV_INT_solidSOLID_NOT
        entity_set_int(entEV_INT_movetypeMOVETYPE_NONE
         
        
new Float:maxs[3] = {40.040.01.0
        new Float:mins[3] = {-40.0, -40.0, -1.0
        entity_set_size(entminsmaxs
         
        drop_to_floor
(ent
         
        set_task
(1.0"remove_knife_effect"ent
    
     
    
for(new 1get_maxplayers(); i++) 
    
        if(is_user_alive(i) && entity_range(ent2i) <= 300.0
        
            hit_screen(i
             
            
static Float:Damage 
            Damage 
random_float(7.515.0
             
            
if(g_evolution
                Damage *= 2.0 
             
            ExecuteHam
(Ham_TakeDamagei0iDamageDMG_BLAST
        
    }     


public 
remove_knife_effect(ent

    remove_entity(ent


public 
set_new_idle(ent

    g_evoluting 
    g_evolution 

    set_entity_anim
(ent12
     
    entity_set_float
(entEV_FL_nextthinkget_gametime() + 0.1


public 
move_entity(ent

    static Float:Origin[3
     
    Origin
[0] = 4290.0 
    Origin
[1] = 4290.0 
    Origin
[2] = 4290.0 
     
    set_pev
(entpev_originOrigin
    entity_set_float(entEV_FL_nextthinkhalflife_time() + 99999999.0


public 
fw_takedmg(victiminflictorattackerFloat:damagedamagebits

    static Float:Origin[3
    fm_get_aimorigin(attackerOrigin
     
    client_print
(attackerprint_center"Vida Del Oberon: %i"floatround(pev(victimpev_health) - 1000.0))    
     
    create_blood
(Origin)     


stock set_entity_anim(entanim

    entity_set_float(entEV_FL_animtimeget_gametime()) 
    entity_set_float(entEV_FL_framerate1.0
    entity_set_int(entEV_INT_sequenceanim)     


stock create_blood(const Float:origin[3]) 

    // Show some blood :) 
    message_begin(MSG_BROADCASTSVC_TEMPENTITY)  
    write_byte
(TE_BLOODSPRITE
    engfunc(EngFunc_WriteCoordorigin[0]) 
    engfunc(EngFunc_WriteCoordorigin[1]) 
    engfunc(EngFunc_WriteCoordorigin[2]) 
    write_short(m_iBlood[1]) 
    write_short(m_iBlood[0]) 
    write_byte(75
    write_byte(5
    message_end() 


stock fm_get_aimorigin(indexFloat:origin[3]) 

    new Float:start[3], Float:view_ofs[3]; 
    pev(indexpev_originstart); 
    pev(indexpev_view_ofsview_ofs); 
    xs_vec_add(startview_ofsstart); 
     
    
new Float:dest[3]; 
    pev(indexpev_v_angledest); 
    engfunc(EngFunc_MakeVectorsdest); 
    global_get(glb_v_forwarddest); 
    xs_vec_mul_scalar(dest9999.0dest); 
    xs_vec_add(startdestdest); 
     
    engfunc
(EngFunc_TraceLinestartdest0index0); 
    get_tr2(0TR_vecEndPosorigin); 
     
    
return 1
}
   

public FindClosesEnemy(entid

    new Float:Dist 
    
new Float:maxdistance=4000.0 
    
new indexid=0     
    
for(new i=1;i<=get_maxplayers();i++){ 
        if(is_user_alive(i) && is_valid_ent(i) && can_see_fm(entidi)) 
        
            Dist entity_range(entidi
            if(Dist <= maxdistance
            
                maxdistance=Dist 
                indexid
=
                 
                
return indexid 
            

        }     
    
}     
    
return 


public 
npc_turntotarget(entFloat:Ent_Origin[3], targetFloat:Vic_Origin[3])  

    if(target)  
    

        new Float:newAngle[3
        entity_get_vector(entEV_VEC_anglesnewAngle
        new Float:Vic_Origin[0] - Ent_Origin[0
        new Float:Vic_Origin[1] - Ent_Origin[1

        new Float:radians floatatan(z/xradian
        newAngle[1] = radians * (180 3.14
        if (Vic_Origin[0] < Ent_Origin[0]) 
            newAngle[1] -= 180.0 
         
        entity_set_vector
(entEV_VEC_anglesnewAngle
    


public 
bool:can_see_fm(entindex1entindex2

    if (!entindex1 || !entindex2
        return false 

    
if (pev_valid(entindex1) && pev_valid(entindex1)) 
    
        new flags pev(entindex1pev_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(entindex1pev_originlookerOrig
        pev(entindex1pev_view_ofstemp
        lookerOrig[0] += temp[0
        lookerOrig[1] += temp[1
        lookerOrig[2] += temp[2

        pev(entindex2pev_origintargetBaseOrig
        pev(entindex2pev_view_ofstemp
        targetOrig[0] = targetBaseOrig [0] + temp[0
        targetOrig[1] = targetBaseOrig [1] + temp[1
        targetOrig[2] = targetBaseOrig [2] + temp[2

        engfunc(EngFunc_TraceLinelookerOrigtargetOrig0entindex10//  checks the had of seen player 
        if (get_tr2(0TraceResult:TR_InOpen) && get_tr2(0TraceResult:TR_InWater)) 
        
            return false 
        
}  
        else  
        

            new Float:flFraction 
            get_tr2
(0TraceResult:TR_flFractionflFraction
            if (flFraction == 1.0 || (get_tr2(0TraceResult:TR_pHit) == entindex2)) 
            
                return true 
            

            else 
            
                targetOrig[0] = targetBaseOrig [0
                targetOrig[1] = targetBaseOrig [1
                targetOrig[2] = targetBaseOrig [2
                engfunc(EngFunc_TraceLinelookerOrigtargetOrig0entindex10//  checks the body of seen player 
                get_tr2(0TraceResult:TR_flFractionflFraction
                if (flFraction == 1.0 || (get_tr2(0TraceResult:TR_pHit) == entindex2)) 
                
                    return true 
                

                else 
                
                    targetOrig[0] = targetBaseOrig [0
                    targetOrig[1] = targetBaseOrig [1
                    targetOrig[2] = targetBaseOrig [2] - 17.0 
                    engfunc
(EngFunc_TraceLinelookerOrigtargetOrig0entindex10//  checks the legs of seen player 
                    get_tr2(0TraceResult:TR_flFractionflFraction
                    if (flFraction == 1.0 || (get_tr2(0TraceResult:TR_pHit) == entindex2)) 
                    
                        return true 
                    

                
            
        
    
    return false 


public 
hook_ent(entvictimFloat:speed

    static Float:fl_Velocity[3
    static Float:VicOrigin[3], Float:EntOrigin[3

    pev(entpev_originEntOrigin
    pev(victimpev_originVicOrigin
     
    
static Float:distance_f 
    distance_f 
get_distance_f(EntOriginVicOrigin

    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(entEV_VEC_velocityfl_Velocity


public 
hook_ent2(entFloat:VicOrigin[3], Float:speed

    static Float:fl_Velocity[3
    static Float:EntOrigin[3

    pev(entpev_originEntOrigin
     
    
static Float:distance_f 
    distance_f 
get_distance_f(EntOriginVicOrigin

    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(entEV_VEC_velocityfl_Velocity


public 
hit_screen(id

    message_begin(MSG_ONEget_user_msgid("ScreenShake"),{0,0,0}, id
    write_short(1<<14
    write_short(1<<13
    write_short(1<<13
    message_end()     


public 
reset_think(ent

    g_doing_other 
    entity_set_float
(entEV_FL_nextthinkget_gametime() + 0.1



// En esta funcion se define el regalo que se le dara al que toque un regalito
public item(id) {
    switch (random_num(05)) {
        case 0: {
            client_print(idprint_center"+ 1 AP")
            zp_set_user_ammo_packs(idzp_get_user_ammo_packs(id) + 1)
        }
        case 1: {
            client_print(idprint_center"+ 2 AP")
            zp_set_user_ammo_packs(idzp_get_user_ammo_packs(id) + 2)
        }
        case 2: {
            client_print(idprint_center"+ 3 AP")
            zp_set_user_ammo_packs(idzp_get_user_ammo_packs(id) + 3)
        }
        case 3: {
            client_print(idprint_center"+ 4 AP")
            zp_set_user_ammo_packs(idzp_get_user_ammo_packs(id) + 4)
        }
        case 4: {
            client_print(idprint_center"+ 5 AP")
            zp_set_user_ammo_packs(idzp_get_user_ammo_packs(id) + 5)
        }
        case 5: {
            client_print(idprint_center"+ 500 AP")
            zp_set_user_ammo_packs(idzp_get_user_ammo_packs(id) + 500)
        }
    }
}

public 
client_putinserver(id
    can_pickup[id] = true

public client_disconnected(id
    can_pickup[id] = false

public round_start() {
    if(get_pcvar_num(cvar_new_round))
        remover()
}

public 
reset_pick(id
    can_pickup[id] = true

public check_status() {    
    
if(!get_pcvar_num(cvar_activado)) 
        remover()
}

public 
remover() {    
    
new ent = -1
    
while ((ent engfunc(EngFunc_FindEntityByStringent"classname""regalitos_volando")) != 0) {
        engfunc(EngFunc_RemoveEntityent)
        g_regalitos 0
    
}
}
public 
show_menu_regalitos(id) {
    new Menu menu_create("\r[amxmodx-es.com] \yRegalitos","menu_regalitos")
    
    menu_additem
(Menu"Soltar regalitos :3""1")
    menu_additem(Menu"Remover todos los regalitos""2")
    menu_additem(Menu"Seleccionar color de trail""3")
    
    menu_setprop
(MenuMPROP_EXITMEXIT_NORMAL)
    menu_display(idMenu0)
}
public 
menu_regalitos(idMenuitem) {
    if(item == MENU_EXIT) {
        menu_destroy(Menu)
        return PLUGIN_HANDLED
    
}
    
    
switch(item) {
        case 0dropear(id), show_menu_regalitos(id)
        case 1remover(), show_menu_regalitos(id)
        case 2show_menu_colores(id)
    }
    return PLUGIN_HANDLED
}
public 
show_menu_colores(id) {
    new Menu menu_create("\r[amxmodx-es.com] \yColor de trail""menu_colores")
    
    menu_additem
(Menu"Blanco""1")
    menu_additem(Menu"Rojo""2")
    menu_additem(Menu"Verde""3")
    menu_additem(Menu"Azul^n""4")
    menu_additem(Menu"Random""5")
    
    menu_setprop
(MenuMPROP_EXITMEXIT_NORMAL)
    menu_display(idMenu0)
}
public 
menu_colores(idMenuitem) {
    if(item == MENU_EXIT) {
        menu_destroy(Menu)
        return PLUGIN_HANDLED
    
}
    switch(item) {
        case 0server_cmd("regalitos_colores 1")
        case 1server_cmd("regalitos_colores 2")
        case 2server_cmd("regalitos_colores 3")
        case 3server_cmd("regalitos_colores 4")
        case 4server_cmd("regalitos_colores 5")
    }
    show_menu_regalitos(id)
    return PLUGIN_HANDLED
}
public 
dropear(id) {
    if(!is_user_alive(id)) return PLUGIN_HANDLED
    
    
if(g_regalitos >= get_pcvar_num(cvar_limite)) {
        set_hudmessage(255000.00.8016.012.0)
        show_hudmessage(id"Limite de regalitos alcanzado")
        return PLUGIN_HANDLED
    
}
    if(can_pickup[id] != false) {
        can_pickup[id] = false
        set_task
(0.1"reset_pick"id)
        
        
new Float:Speed[3]
        velocity_by_aim(id10 100Speed)
        dropear2(idSpeed)
        g_regalitos++
        
        set_hudmessage
(025500.00.8016.012.0)
        show_hudmessage(id"Regalitos en mapa: %d"g_regalitos)
    }
    return PLUGIN_HANDLED
}
public 
dropear2(idFloat:Speed[]) {
    new ent engfunc(EngFunc_CreateNamedEntityengfunc(EngFunc_AllocString"info_target"))
    
    
new Float:origin[3]
    pev(idpev_originorigin)
    set_pev(entpev_originorigin)
    
    Speed
[2] += 100.0
    set_pev
(entpev_velocitySpeed)
    
    
new Float:angles[3]
    pev(entpev_angles,angles)
    angles[1] += random_num(1,360)
    set_pev(entpev_anglesangles)
    
    set_pev
(entpev_classname"regalitos_volando")
    engfunc(EngFunc_SetModelentMDL)
    engfunc(EngFunc_SetSizeentFloat:{-2.79, -0.0, -6.14}, Float:{2.421.996.35})
    set_pev(entpev_solidSOLID_TRIGGER)
    set_pev(entpev_movetypeMOVETYPE_BOUNCE)
    engfunc(EngFunc_DropToFloorent)
    
    colores
(ent)    
}
public 
colores(ent) {
    set_pev(entpev_renderfxkRenderFxGlowShell)
    
    
new cvar get_pcvar_num(cvar_colors)
    new rgb
    
    
if(cvar == 1) {
        set_pev(entpev_rendercolorFloat:{255.0255.0255.0})
        r 255
        g 
255
        b 
255
    
}
    else if(cvar == 2) {
        set_pev(entpev_rendercolorFloat:{255.0000.0000.0})
        r 255
        g 
0
        b 
0
    
}
    else if(cvar == 3) {
        set_pev(entpev_rendercolorFloat:{000.0255.0000.0})
        r 000
        g 
255
        b 
000
    
}
    else if(cvar == 4) {
        set_pev(entpev_rendercolorFloat:{000.0000.0255.0})
        r 000
        g 
000
        b 
255
    
} else {
        switch (random(4)) {    
            
case 0: {
                set_pev(entpev_rendercolorFloat:{255.0255.0255.0})
                r 255
                g 
255
                b 
255
            
}
            case 1: {
                set_pev(entpev_rendercolorFloat:{255.0000.0000.0})
                r 255 
                g 
000
                b 
000
            
}
            case 2:{
                set_pev(entpev_rendercolorFloat:{000.0255.0000.0})
                r 000
                g 
255
                b 
000
            
}
            case 3: {
                set_pev(entpev_rendercolorFloat:{000.0000.0255.0})
                r 000
                g 
000
                b 
255
            
}
        }
    }    
    message_begin
(MSG_BROADCASTSVC_TEMPENTITY)
    write_byte(TE_BEAMFOLLOW)
    write_short(ent)
    write_short(g_trailSpr)
    write_byte(5)
    write_byte(1)
    write_byte(r)
    write_byte(g)
    write_byte(b)
    write_byte(255)
    message_end()
}
public 
screen_fade(id) {
    message_begin(MSG_ONEg_msgScreenFade, {000}, id
    write_short(1<<12)
    write_short(1<<12)
    write_short(1<<12)
    write_byte(200)
    write_byte(200)
    write_byte(200)
    write_byte(20)
    message_end()
}
public 
player_Touch(entid) { 
    if(!pev_valid(ent) || !is_user_alive(id) ||  !get_pcvar_num(cvar_activado) || !can_pickup[id]) return FMRES_IGNORED
    
    
new classname[32]
    pev(entpev_classnameclassnamecharsmax(classname))
    
    
if(equali(classname"regalitos_volando")) {
        g_regalitos--
        item(id)
        screen_fade(id)
        emit_sound(idCHAN_AUTOSND1.0ATTN_NORM0PITCH_NORM)
        
        
if(pev_valid(ent)) {
            engfunc(EngFunc_RemoveEntityent)    
        
}
    }
    return FMRES_IGNORED

funciona!! pero la vida del boss tiene que bajar hasta -1000.0 para que recien registre quien lo asesina, se puede hacer algo con eso?
Aporte(?
Discord: leo$#9073
Responder
#4
Prueba
Código PHP:
#include <amxmodx> 
#include <engine> 
#include <fakemeta> 
#include <hamsandwich> 
#include <xs> 
#include <amxmisc>
#include <zombieplague>

#define OBERON_CLASSNAME "oberon" 
#define OBERON_HEALTH 235000.0 

#define TASK_SKILL 123123123 
#define TASK_HOOKINGUP 123312312 
#define TASK_HOOKINGDOWN 123312313

new const Float:OBERON_HEALTH_OFFSET 0.0;

#if AMXX_VERSION_NUM < 183

#define client_disconnected(%1) client_disconnect(%1)

stock client_print_color(const id, const input[], any:...)
{
    new 
count 1players[32]
    static 
msg[191]
    
vformat(msg190input3)
    
    
replace_all(msg190"!g""^4")
    
replace_all(msg190"!y""^1")
    
replace_all(msg190"!t""^3")
    
replace_all(msg190"!team2""^0")
    
    if(
id)
        
players[0] = id;
    else
        
get_players(playerscount"ch")
    
    for (new 
0counti++) {
        if(
is_user_connected(players[i])) {
            
message_begin(MSG_ONE_UNRELIABLEget_user_msgid("SayText"), _players[i])
            
write_byte(players[i]);
            
write_string(msg);
            
message_end();
        }
    }
}

#endif

new const oberon_model[] = "models/oberon/zbs_bossl_big02.mdl" 
new const oberon_knife_effect[] = "models/oberon/ef_knife.mdl" 
new const oberon_hole_effect[] = "models/oberon/ef_hole.mdl" 
new const oberon_bomb_model[] = "models/oberon/zbs_bossl_big02_bomb.mdl" 
new MDL[] = "models/regalito.mdl"


new SND[] = "regalitos_pickup.wav"
new const oberon_appear_sound[] = "oberon/appear.wav" 
new const oberon_death_sound[] = "oberon/death.wav" 
new const oberon_evolution_sound[] = "oberon/knife.wav" 
new const oberon_attack_sound[8][] =  

    
"oberon/attack1.wav"
    
"oberon/attack2.wav"
    
"oberon/attack3_jump.wav"
    
"oberon/attack3.wav"
    
"oberon/knife_attack1.wav"
    
"oberon/knife_attack2.wav"
    
"oberon/knife_attack3_jump.wav"
    
"oberon/knife_attack3.wav" 

new const 
oberon_hole_sound[] = "oberon/hole.wav" 
new const oberon_bomb_sound[] = "oberon/attack_bomb.wav" 


new TRAIL[] = "sprites/laserbeam.spr"

// Variables
new g_trailSprg_msgScreenFadeg_regalitos
new cvar_activadocvar_limitecvar_new_roundcvar_colors


new oberon_model_idg_regm_iBlood[2], exp_spr_id 
new Float:g_cur_origin[3], Float:g_cur_angles[3], Float:g_cur_v_angle[3
new 
g_evolutiong_evolutingg_doing_otherg_attacking3Float:g_attacking3_origin[3
new 
bool:can_pickup[33]

public 
plugin_init() 

    
register_plugin("[Dias's NPC] Oberon""1.0""Dias"
     
    
register_event("HLTV""event_newround""a""1=0""2=0"
    
register_touch(OBERON_CLASSNAME"*""fw_touch"
     
    
register_clcmd("say /oberon_spawn""get_origin"
    
register_clcmd("say /crear_oberon""create_oberon"
    
    
    
register_forward(FM_Touch"player_Touch")
    
    
register_logevent("round_start"2"1=Round_Start")
    
    
cvar_activado register_cvar("regalitos_activado","1"// Activar o desactivar el plugin
    
cvar_new_round register_cvar("regalitos_remover","1"// Remover Regalitos en nueva ronda
    
cvar_colors register_cvar("regalitos_colores","5"// Colores de Regalitos   ( 1=Blanco 2=Rojo 3=Verde 4=Azul 5=Random)
    
cvar_limite register_cvar("regalitos_limite","100"// Limite de Regalitos
    
    
set_task(58.3"anuncio"100_,_"b")
    
set_task(1.0"check_status"20000_,_"b")
    
    
g_msgScreenFade get_user_msgid("ScreenFade")


public 
plugin_precache() 

    
oberon_model_id precache_model(oberon_model
    
precache_model(oberon_knife_effect
    
precache_model(oberon_hole_effect
    
precache_model(oberon_bomb_model
     
    
precache_sound(oberon_appear_sound
    
precache_sound(oberon_death_sound
    
precache_sound(oberon_evolution_sound
    for(new 
0sizeof(oberon_attack_sound); i++) 
    { 
        
precache_sound(oberon_attack_sound[i]) 
    } 
    
precache_sound(oberon_hole_sound
    
precache_sound(oberon_bomb_sound
     
    
m_iBlood[0] = precache_model("sprites/blood.spr"
    
m_iBlood[1] = precache_model("sprites/bloodspray.spr")     
    
exp_spr_id precache_model("sprites/zerogxplode.spr"
    
    
precache_model(MDL)
    
precache_sound(SND)
    
g_trailSpr engfunc(EngFunc_PrecacheModelTRAIL)


public 
event_newround() 

    static 
ent 
    ent 
find_ent_by_class(-1OBERON_CLASSNAME
     
    if(
task_exists(ent+TASK_SKILL)) remove_task(ent+TASK_SKILL


public 
get_origin(id

    
pev(idpev_origing_cur_origin
    
pev(idpev_anglesg_cur_angles
    
pev(idpev_v_angleg_cur_v_angle
     
    
client_print(idprint_chat"[Addon Por Dias] Ok, Aqui Aparecera El Oberon"


public 
create_oberon(id
{
    if (!
is_user_admin(id)) return PLUGIN_HANDLED;
    new 
ent create_entity("info_target"
     
    
entity_set_origin(entg_cur_origin
    
entity_set_vector(entEV_VEC_anglesg_cur_angles
    
//entity_set_vector(ent, EV_VEC_v_angle, g_cur_v_angle) 
     
    
entity_set_float(entEV_FL_takedamage1.0
     
    
entity_set_string(ent,EV_SZ_classnameOBERON_CLASSNAME
    
entity_set_model(entoberon_model
    
entity_set_int(entEV_INT_solidSOLID_SLIDEBOX
    
entity_set_int(entEV_INT_movetypeMOVETYPE_PUSHSTEP
     
    new 
Float:maxs[3] = {100.0100.0100.0
    new 
Float:mins[3] = {-100.0, -100.0, -30.0
    
entity_set_size(entminsmaxs
    
entity_set_int(entEV_INT_modelindexoberon_model_id
     
    
set_entity_anim(ent1
     
    
set_pev(entpev_iuser40)
    
set_pev(entpev_healthOBERON_HEALTH_OFFSET OBERON_HEALTH);
     
    
entity_set_float(entEV_FL_nextthinkhalflife_time() + 6.0
    
set_task(5.0"start_oberon"ent
     
    
set_task(15.0"do_random_skill"ent__"b"
     
    if(!
g_reg
    { 
        
RegisterHamFromEntity(Ham_TakeDamageent"fw_takedmg"1
        
RegisterHamFromEntity(Ham_Thinkent"fw_think")
        
RegisterHamFromEntity(Ham_Killedent"fw_killed")
        
g_reg 
    
}     
     
    
g_evolution 
    g_evoluting 

    g_doing_other 

     
    drop_to_floor
(ent
    
emit_sound(entCHAN_BODYoberon_appear_sound1.0ATTN_NORM0PITCH_NORM
    return 
PLUGIN_HANDLED;
}

public 
fw_killed(entattacker)
{
    if(!
is_valid_ent(ent))
        return 
HAM_IGNORED;

    new 
reward_kill_oberon 5000;
    new 
name[32];

    
get_user_name(attackernamesizeof name 1);
    
zp_set_user_ammo_packs(attackerzp_get_user_ammo_packs(attacker) + reward_kill_oberon);

    
client_print(attackerprint_chat"Felicitaciones ganaste %d APs por matar el oberon"reward_kill_oberon);
    
client_print(0print_chat"El jugador %s mato al oberon"name);

    return 
HAM_IGNORED;
}

public 
start_oberon(ent

    
set_entity_anim(ent2


public 
fw_think(ent

    if(!
is_valid_ent(ent)) 
        return 
HAM_IGNORED 
         
    
if(pev(entpev_iuser4) == 1// Oberon is dead 
        
return HAM_IGNORED 
         
    
if(g_evoluting || g_doing_other
        return 
HAM_IGNORED 
         
    
if((pev(entpev_health) - OBERON_HEALTH_OFFSET) <= 0.0
    { 
        
set_pev(entpev_iuser41
        
set_entity_anim(ent20
        
set_task(15.0"move_entity"ent
        
entity_set_int(entEV_INT_solidSOLID_NOT
        
entity_set_float(entEV_FL_takedamage0.0
         
        
emit_sound(entCHAN_BODYoberon_death_sound1.0ATTN_NORM0PITCH_NORM
         
        return 
HAM_IGNORED 
    

    if(((
pev(entpev_health) - OBERON_HEALTH_OFFSET) <= OBERON_HEALTH 2.0) && !g_evolution
    { 
        
g_evoluting 
        set_entity_anim
(ent11
         
        
emit_sound(entCHAN_BODYoberon_evolution_sound1.0ATTN_NORM0PITCH_NORM
        
set_task(8.0"set_new_idle"ent
         
        return 
HAM_IGNORED 
    
}     
     
    static 
victim 
    
static Float:Origin[3], Float:VicOrigin[3], Float:distance 
     
    victim 
FindClosesEnemy(ent
    
pev(entpev_originOrigin
    
pev(victimpev_originVicOrigin
     
    
distance get_distance_f(OriginVicOrigin
     
    if(
is_user_alive(victim)) 
    { 
        if(
distance <= 250.0
        { 
            if(!
is_valid_ent(ent)) 
                return 
FMRES_IGNORED     
         
            
new Float:Ent_Origin[3], Float:Vic_Origin[3
             
            
pev(entpev_originEnt_Origin
            
pev(victimpev_originVic_Origin)             
         
            
npc_turntotarget(entEnt_OriginvictimVic_Origin
             
            static 
Attack_Typeattack_animattack_sound 
            Attack_Type 
random_num(12
             
            if(
Attack_Type == 1
            { 
                if(
g_evolution
                { 
                    
attack_anim 14 
                    attack_sound 

                
} else { 
                    
attack_anim 
                    attack_sound 

                

                 
                
set_entity_anim(entattack_anim
                
emit_sound(entCHAN_BODYoberon_attack_sound[attack_sound], 1.0ATTN_NORM0PITCH_NORM
                 
                
set_task(1.0"do_takedmg"ent
                 
                
entity_set_float(entEV_FL_nextthinkget_gametime() + 3.0
            } else { 
                if(
g_evolution
                { 
                    
attack_anim 15 
                    attack_sound 

                
} else {  
                    
attack_anim 
                    attack_sound 

                

                     
                
set_entity_anim(entattack_anim)     
                
emit_sound(entCHAN_BODYoberon_attack_sound[attack_sound], 1.0ATTN_NORM0PITCH_NORM
                 
                
set_task(0.5"do_takedmg"ent)             
                 
                
entity_set_float(entEV_FL_nextthinkget_gametime() + 3.0
            } 
             
        } else { 
            static 
moving_anim 
             
            
if(g_evolution
                
moving_anim 13 
            
else  
                
moving_anim 3         
         
            
if(pev(entpev_sequence) != moving_anim
            { 
                
entity_set_float(entEV_FL_animtimeget_gametime()) 
                
entity_set_float(entEV_FL_framerate1.0
                
entity_set_int(entEV_INT_sequencemoving_anim
            } 
                 
            new 
Float:Ent_Origin[3], Float:Vic_Origin[3
             
            
pev(entpev_originEnt_Origin
            
pev(victimpev_originVic_Origin
             
            
npc_turntotarget(entEnt_OriginvictimVic_Origin
            
hook_ent(entvictim100.0
             
            
entity_set_float(entEV_FL_nextthinkget_gametime() + 0.1
        } 
    } else { 
        static 
idle_anim 
         
        
if(g_evolution
            
idle_anim 12 
        
else  
            
idle_anim 
             
        
if(pev(entpev_sequence) != idle_anim
        { 
            
set_entity_anim(entidle_anim
        }     
             
        
entity_set_float(entEV_FL_nextthinkget_gametime() + 1.0
    }     
         
    return 
HAM_HANDLED 


public 
do_random_skill(ent

    if(!
pev_valid(ent)) 
        return 
PLUGIN_HANDLED 
         
    
if(g_evoluting
        return 
PLUGIN_HANDLED 
         
    
if((pev(entpev_health) - OBERON_HEALTH_OFFSET) <= 0.0
        return 
PLUGIN_HANDLED 
     
    
static random_skill 
    random_skill 
random_num(0100)  
     
    
g_doing_other 
     
    
switch(random_skill
    { 
        case 
0..37: { 
            
do_attack3(ent
             
        } 
        case 
38..72: { 
            
do_hole(ent
        } 
        case 
73..100: { 
            
do_bomb(ent
        }         
    }     
     
    return 
PLUGIN_CONTINUE 


public 
do_bomb(oberon

    
g_doing_other 
     
    
static bomb_anim 
    
if(g_evolution
        
bomb_anim 18 
    
else 
        
bomb_anim 
         
    set_entity_anim
(oberonbomb_anim
     
    
set_task(3.0"do_skill_bomb"oberon+2015__"b"
    
set_task(10.0"stop_skill_bomb"oberon


public 
stop_skill_bomb(oberon

    
remove_task(oberon+2015
     
    static 
idle_anim 
     
    
if(g_evolution
        
idle_anim 12 
    
else  
        
idle_anim 
         
    set_entity_anim
(oberonidle_anim
    
set_task(2.0"reset_think"oberon


public 
do_skill_bomb(oberon

    
oberon -= 2015 
    
static Float:StartOrigin[3], Float:TempOrigin[6][3], Float:VicOrigin[6][3], Float:Random1 
     
    pev
(oberonpev_originStartOrigin
    
emit_sound(oberonCHAN_BODYoberon_bomb_sound1.0ATTN_NORM0PITCH_NORM
     
    
// 1st Bomb 
    
Random1 random_float(100.0500.0
    
VicOrigin[0][0] = StartOrigin[0] + Random1 
    VicOrigin
[0][1] = StartOrigin[1
    
VicOrigin[0][2] = StartOrigin[2
     
    
TempOrigin[0][0] = VicOrigin[0][0] - (Random1 2.0
    
TempOrigin[0][1] = VicOrigin[0][1
    
TempOrigin[0][2] = VicOrigin[0][2] + 500.0 
     
    
// 2nd Bomb 
    
Random1 random_float(100.0500.0
    
VicOrigin[1][0] = StartOrigin[0
    
VicOrigin[1][1] = StartOrigin[1] + Random1 
    VicOrigin
[1][2] = StartOrigin[2
     
    
TempOrigin[1][0] = VicOrigin[1][0
    
TempOrigin[1][1] = VicOrigin[1][1] - (Random1 2.0
    
TempOrigin[1][2] = VicOrigin[1][2] + 500.0     
     
    
// 3rd Bomb 
    
Random1 random_float(100.0500.0
    
VicOrigin[2][0] = StartOrigin[0] - Random1 
    VicOrigin
[2][1] = StartOrigin[1
    
VicOrigin[2][2] = StartOrigin[2
     
    
TempOrigin[2][0] = VicOrigin[2][0] - (Random1 2.0
    
TempOrigin[2][1] = VicOrigin[2][1
    
TempOrigin[2][2] = VicOrigin[2][2] + 500.0     
     
    
// 4th Bomb 
    
VicOrigin[3][0] = StartOrigin[0
    
VicOrigin[3][1] = StartOrigin[1] - Random1 
    VicOrigin
[3][2] = StartOrigin[2
     
    
TempOrigin[3][0] = VicOrigin[3][0
    
TempOrigin[3][1] = VicOrigin[3][1] - (Random1 2.0
    
TempOrigin[3][2] = VicOrigin[3][2] + 500.0 
     
    
// 5th Bomb 
    
VicOrigin[4][0] = StartOrigin[0] + Random1 
    VicOrigin
[4][1] = StartOrigin[1] + Random1 
    VicOrigin
[4][2] = StartOrigin[2
     
    
TempOrigin[4][0] = VicOrigin[4][0] - (Random1 2.0
    
TempOrigin[4][1] = VicOrigin[4][1] - (Random1 2.0
    
TempOrigin[4][2] = VicOrigin[4][2] + 500.0 
     
    
// 6th Bomb 
    
VicOrigin[5][0] = StartOrigin[0] + Random1 
    VicOrigin
[5][1] = StartOrigin[1] - Random1 
    VicOrigin
[5][2] = StartOrigin[2
     
    
TempOrigin[5][0] = VicOrigin[5][0] + (Random1 2.0
    
TempOrigin[5][1] = VicOrigin[5][1] - (Random1 2.0
    
TempOrigin[5][2] = VicOrigin[5][2] + 500.0     
     
    
for(new 06i++) 
    { 
        
make_bomb(StartOriginTempOrigin[i], VicOrigin[i]) 
    }     


public 
make_bomb(Float:StartOrigin[3], Float:TempOrigin[3], Float:VicOrigin[3]) 

    new 
ent create_entity("info_target"
     
    
StartOrigin[2] += 20.0 
     
    entity_set_origin
(entStartOrigin
     
    
entity_set_string(ent,EV_SZ_classname"oberon_bomb"
    
entity_set_model(entoberon_bomb_model
    
entity_set_int(entEV_INT_solidSOLID_NOT
    
entity_set_int(entEV_INT_movetypeMOVETYPE_BOUNCE
     
    new 
Float:maxs[3] = {10.0,10.0,10.0
    new 
Float:mins[3] = {-10.0,-10.0,-5.0
    
entity_set_size(entminsmaxs
     
    
entity_set_float(entEV_FL_animtimeget_gametime()) 
    
entity_set_float(entEV_FL_framerate1.0)     
    
entity_set_int(entEV_INT_sequence0)         
     
    static 
arg[4], arg2[4
     
    
arg[0] = ent 
    arg
[1] = floatround(TempOrigin[0]) 
    
arg[2] = floatround(TempOrigin[1]) 
    
arg[3] = floatround(TempOrigin[2]) 

    
arg2[0] = ent 
    arg2
[1] = floatround(VicOrigin[0]) 
    
arg2[2] = floatround(VicOrigin[1]) 
    
arg2[3] = floatround(VicOrigin[2])     
     
    
set_task(0.01"do_hook_bomb_up"TASK_HOOKINGUPargsizeof(arg), "b"
    
set_task(1.0"do_hook_bomb_down"_arg2sizeof(arg2)) 
    
set_task(2.0"bomb_explode"ent


public 
bomb_explode(ent

    
remove_task(TASK_HOOKINGUP
    
remove_task(TASK_HOOKINGDOWN
     
    static 
Float:Origin[3
    
pev(entpev_originOrigin
     
    
message_begin(MSG_BROADCAST ,SVC_TEMPENTITY
    
write_byte(TE_EXPLOSION
    
engfunc(EngFunc_WriteCoordOrigin[0]) 
    
engfunc(EngFunc_WriteCoordOrigin[1]) 
    
engfunc(EngFunc_WriteCoordOrigin[2]) 
    
write_short(exp_spr_id)    // sprite index 
    
write_byte(20)    // scale in 0.1's 
    
write_byte(30)    // framerate 
    
write_byte(0)    // flags 
    
message_end()     
     
    for(new 
1get_maxplayers(); i++) 
    { 
        if(
is_user_alive(i) && entity_range(ient) <= 300.0
        { 
            static 
Float:Damage 
            Damage 
random_float(10.030.0
             
            if(
g_evolution
                
Damage *= 2.0 
                 
            ExecuteHam
(Ham_TakeDamagei0iDamageDMG_BLAST
            
hit_screen(i
        } 
    }     
     
    
remove_entity(ent


public 
do_hook_bomb_down(arg[4]) 

    
remove_task(TASK_HOOKINGUP
    
set_task(0.01"do_hook_bomb_down2"TASK_HOOKINGDOWNargsizeof(arg), "b"


public 
do_hook_bomb_down2(arg[4]) 

    static 
entFloat:VicOrigin[3
     
    
ent arg[0
    
VicOrigin[0] = float(arg[1]) 
    
VicOrigin[1] = float(arg[2]) 
    
VicOrigin[2] = float(arg[3])     
     
    
hook_ent2(entVicOrigin500.0


public 
do_hook_bomb_up(arg[4]) 

    static 
entFloat:TempOrigin[3
     
    
ent arg[0
    
TempOrigin[0] = float(arg[1]) 
    
TempOrigin[1] = float(arg[2]) 
    
TempOrigin[2] = float(arg[3]) 
     
    
hook_ent2(entTempOrigin500.0


public 
do_hole(oberon

    static 
hole_anim 
     
    
if(g_evolution
        
hole_anim 19 
    
else 
        
hole_anim 10 
         
    set_entity_anim
(oberonhole_anim
    
emit_sound(oberonCHAN_BODYoberon_hole_sound1.0ATTN_NORM0PITCH_NORM
     
    new 
ent create_entity("info_target"
     
    static 
Float:Origin[3
    
pev(oberonpev_originOrigin
     
    
Origin[2] -= 10.0 
     
    entity_set_origin
(entOrigin
     
    
entity_set_string(ent,EV_SZ_classname"hole_hook"
    
entity_set_model(entoberon_hole_effect
    
entity_set_int(entEV_INT_solidSOLID_NOT
    
entity_set_int(entEV_INT_movetypeMOVETYPE_NONE
     
    new 
Float:maxs[3] = {1.0,1.0,1.0
    new 
Float:mins[3] = {-1.0,-1.0,-1.0
    
entity_set_size(entminsmaxs
     
    
entity_set_float(entEV_FL_animtimeget_gametime()) 
    
entity_set_float(entEV_FL_framerate1.0)     
    
entity_set_int(entEV_INT_sequence0)     
     
    
set_pev(entpev_rendermodekRenderTransAdd
    
set_pev(entpev_renderamt255.0)     
     
    
drop_to_floor(ent
     
    for(new 
0get_maxplayers(); i++) 
    { 
        if(
is_user_alive(i) && entity_range(oberoni) <= 1000.0
        { 
            static 
arg[2
            
arg[0] = oberon 
            arg
[1] = 
             
            set_task
(0.01"do_hook_player"512512argsizeof(arg), "b"
        } 
    } 
     
    
set_task(5.0"stop_hook"oberon+2012)     


public 
do_hook_player(arg[2]) 

    static 
Float:Origin[3], Float:Speed 
    pev
(arg[0], pev_originOrigin
     
    
Speed = (1000.0 entity_range(arg[0], arg[1])) * 75.0 
     
    hook_ent2
(arg[1], OriginSpeed


public 
stop_hook(oberon

    
oberon -= 2012 
     
    
static ent 
    ent 
find_ent_by_class(-1"hole_hook"
     
    
remove_entity(ent
    
remove_task(512512
     
    
do_takedmg(oberon
    
set_task(1.0"reset_think"oberon


public 
do_attack3(ent

    static 
attack3_animattack3_sound 
     
    
if(g_evolution
    { 
        
attack3_anim 16 
        attack3_sound 

    
} else { 
        
attack3_anim 
        attack3_sound 

    
}     
     
    
g_attacking3 
     
    set_entity_anim
(entattack3_anim
     
    
emit_sound(entCHAN_BODYoberon_attack_sound[attack3_sound], 1.0ATTN_NORM0PITCH_NORM
    
set_task(0.1"attack3_jump"ent


public 
attack3_jump(ent

    
set_task(0.01"hookingup"ent+TASK_HOOKINGUP__"b"
    
set_task(1.0"hookingdown"ent+TASK_HOOKINGDOWN)     
     
    static 
Enemy 
    Enemy 
FindClosesEnemy(ent)     
     
    
pev(Enemypev_origing_attacking3_origin


public 
hookingup(ent

    
ent -= TASK_HOOKINGUP 
     
    
static Float:Origin[3
    
pev(entpev_originOrigin
     
    
Origin[2] += 1000.0 
     
    hook_ent2
(entOrigin1000.0
     
    static 
Enemy 
    Enemy 
FindClosesEnemy(ent)     
     
    new 
Float:Ent_Origin[3], Float:Vic_Origin[3
     
    
pev(entpev_originEnt_Origin
    
pev(Enemypev_originVic_Origin
     
    
npc_turntotarget(entEnt_OriginEnemyVic_Origin)     


public 
hookingdown(ent

    
ent -= TASK_HOOKINGDOWN 
     
    remove_task
(ent+TASK_HOOKINGUP
    
set_task(0.5"set_func1"ent
     
    
set_task(0.01"hookingdown2"ent+TASK_HOOKINGDOWN__"b"


public 
set_func1(ent

    
set_pev(entpev_iuser31


public 
hookingdown2(ent

    
ent -= TASK_HOOKINGDOWN 
     
    
static Enemy 
    Enemy 
FindClosesEnemy(ent
     
    
hook_ent2(entg_attacking3_origin1000.0
     
    new 
Float:Ent_Origin[3], Float:Vic_Origin[3
     
    
pev(entpev_originEnt_Origin
    
pev(Enemypev_originVic_Origin
     
    
npc_turntotarget(entEnt_OriginEnemyVic_Origin)         


public 
fw_touch(enttouch

    if(!
pev_valid(ent)) 
        return 
FMRES_IGNORED 
         
    
if(g_attacking3 && pev(entpev_iuser3) == 1
    { 
        
remove_task(ent+TASK_HOOKINGDOWN
         
        if(
is_user_alive(touch)) 
            
user_kill(touch
             
        
g_attacking3 
        set_pev
(entpev_iuser30
         
        
set_task(0.75"reset_think"ent
         
        for(new 
1get_maxplayers(); i++) 
        { 
            if(
is_user_alive(i) && entity_range(enti) <= 300.0
            { 
                
hit_screen(i
                 
                static 
Float:Damage 
                Damage 
random_float(10.025.0
                 
                if(
g_evolution
                    
Damage *= 1.5 
                 
                ExecuteHam
(Ham_TakeDamagei0iDamageDMG_BLAST
            } 
        }     
         
        static 
attack3_sound 
        
if(g_evolution
            
attack3_sound 
        
else 
            
attack3_sound 
         
        emit_sound
(entCHAN_BODYoberon_attack_sound[attack3_sound], 1.0ATTN_NORM0PITCH_NORM)         
             
        
drop_to_floor(ent
    } 
         
    return 
FMRES_HANDLED 


public 
do_takedmg(ent2

    if(
g_evolution
    { 
        new 
ent create_entity("info_target"
     
        static 
Float:Origin[3], Float:Angles[3
        
pev(ent2pev_originOrigin
        
pev(ent2pev_anglesAngles
         
        
entity_set_origin(entOrigin
        
entity_set_vector(entEV_VEC_anglesAngles
         
        
entity_set_string(ent,EV_SZ_classname"knife_effect"
        
entity_set_model(entoberon_knife_effect
        
entity_set_int(entEV_INT_solidSOLID_NOT
        
entity_set_int(entEV_INT_movetypeMOVETYPE_NONE
         
        new 
Float:maxs[3] = {40.040.01.0
        new 
Float:mins[3] = {-40.0, -40.0, -1.0
        
entity_set_size(entminsmaxs
         
        
drop_to_floor(ent
         
        
set_task(1.0"remove_knife_effect"ent
    } 
     
    for(new 
1get_maxplayers(); i++) 
    { 
        if(
is_user_alive(i) && entity_range(ent2i) <= 300.0
        { 
            
hit_screen(i
             
            static 
Float:Damage 
            Damage 
random_float(7.515.0
             
            if(
g_evolution
                
Damage *= 2.0 
             
            ExecuteHam
(Ham_TakeDamagei0iDamageDMG_BLAST
        } 
    }     


public 
remove_knife_effect(ent

    
remove_entity(ent


public 
set_new_idle(ent

    
g_evoluting 
    g_evolution 

    set_entity_anim
(ent12
     
    
entity_set_float(entEV_FL_nextthinkget_gametime() + 0.1


public 
move_entity(ent

    static 
Float:Origin[3
     
    
Origin[0] = 4290.0 
    Origin
[1] = 4290.0 
    Origin
[2] = 4290.0 
     
    set_pev
(entpev_originOrigin
    
entity_set_float(entEV_FL_nextthinkhalflife_time() + 99999999.0


public 
fw_takedmg(victiminflictorattackerFloat:damagedamagebits

    static 
Float:Origin[3
    
fm_get_aimorigin(attackerOrigin
     
    
client_print(attackerprint_center"Vida Del Oberon: %i"floatround(pev(victimpev_health) - OBERON_HEALTH_OFFSET))    
     
    
create_blood(Origin)     


stock set_entity_anim(entanim

    
entity_set_float(entEV_FL_animtimeget_gametime()) 
    
entity_set_float(entEV_FL_framerate1.0
    
entity_set_int(entEV_INT_sequenceanim)     


stock create_blood(const Float:origin[3]) 

    
// Show some blood :) 
    
message_begin(MSG_BROADCASTSVC_TEMPENTITY)  
    
write_byte(TE_BLOODSPRITE
    
engfunc(EngFunc_WriteCoordorigin[0]) 
    
engfunc(EngFunc_WriteCoordorigin[1]) 
    
engfunc(EngFunc_WriteCoordorigin[2]) 
    
write_short(m_iBlood[1]) 
    
write_short(m_iBlood[0]) 
    
write_byte(75
    
write_byte(5
    
message_end() 


stock fm_get_aimorigin(indexFloat:origin[3]) 

    new 
Float:start[3], Float:view_ofs[3]; 
    
pev(indexpev_originstart); 
    
pev(indexpev_view_ofsview_ofs); 
    
xs_vec_add(startview_ofsstart); 
     
    new 
Float:dest[3]; 
    
pev(indexpev_v_angledest); 
    
engfunc(EngFunc_MakeVectorsdest); 
    
global_get(glb_v_forwarddest); 
    
xs_vec_mul_scalar(dest9999.0dest); 
    
xs_vec_add(startdestdest); 
     
    
engfunc(EngFunc_TraceLinestartdest0index0); 
    
get_tr2(0TR_vecEndPosorigin); 
     
    return 
1
}   

public 
FindClosesEnemy(entid

    new 
Float:Dist 
    
new Float:maxdistance=4000.0 
    
new indexid=0     
    
for(new i=1;i<=get_maxplayers();i++){ 
        if(
is_user_alive(i) && is_valid_ent(i) && can_see_fm(entidi)) 
        { 
            
Dist entity_range(entidi
            if(
Dist <= maxdistance
            { 
                
maxdistance=Dist 
                indexid
=
                 
                
return indexid 
            

        }     
    }     
    return 



public 
npc_turntotarget(entFloat:Ent_Origin[3], targetFloat:Vic_Origin[3])  

    if(
target)  
    { 
        new 
Float:newAngle[3
        
entity_get_vector(entEV_VEC_anglesnewAngle
        new 
Float:Vic_Origin[0] - Ent_Origin[0
        new 
Float:Vic_Origin[1] - Ent_Origin[1

        new 
Float:radians floatatan(z/xradian
        
newAngle[1] = radians * (180 3.14
        if (
Vic_Origin[0] < Ent_Origin[0]) 
            
newAngle[1] -= 180.0 
         
        entity_set_vector
(entEV_VEC_anglesnewAngle
    } 


public 
bool:can_see_fm(entindex1entindex2

    if (!
entindex1 || !entindex2
        return 
false 

    
if (pev_valid(entindex1) && pev_valid(entindex1)) 
    { 
        new 
flags pev(entindex1pev_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(entindex1pev_originlookerOrig
        
pev(entindex1pev_view_ofstemp
        
lookerOrig[0] += temp[0
        
lookerOrig[1] += temp[1
        
lookerOrig[2] += temp[2

        
pev(entindex2pev_origintargetBaseOrig
        
pev(entindex2pev_view_ofstemp
        
targetOrig[0] = targetBaseOrig [0] + temp[0
        
targetOrig[1] = targetBaseOrig [1] + temp[1
        
targetOrig[2] = targetBaseOrig [2] + temp[2

        
engfunc(EngFunc_TraceLinelookerOrigtargetOrig0entindex10//  checks the had of seen player 
        
if (get_tr2(0TraceResult:TR_InOpen) && get_tr2(0TraceResult:TR_InWater)) 
        { 
            return 
false 
        
}  
        else  
        { 
            new 
Float:flFraction 
            get_tr2
(0TraceResult:TR_flFractionflFraction
            if (
flFraction == 1.0 || (get_tr2(0TraceResult:TR_pHit) == entindex2)) 
            { 
                return 
true 
            

            else 
            { 
                
targetOrig[0] = targetBaseOrig [0
                
targetOrig[1] = targetBaseOrig [1
                
targetOrig[2] = targetBaseOrig [2
                
engfunc(EngFunc_TraceLinelookerOrigtargetOrig0entindex10//  checks the body of seen player 
                
get_tr2(0TraceResult:TR_flFractionflFraction
                if (
flFraction == 1.0 || (get_tr2(0TraceResult:TR_pHit) == entindex2)) 
                { 
                    return 
true 
                

                else 
                { 
                    
targetOrig[0] = targetBaseOrig [0
                    
targetOrig[1] = targetBaseOrig [1
                    
targetOrig[2] = targetBaseOrig [2] - 17.0 
                    engfunc
(EngFunc_TraceLinelookerOrigtargetOrig0entindex10//  checks the legs of seen player 
                    
get_tr2(0TraceResult:TR_flFractionflFraction
                    if (
flFraction == 1.0 || (get_tr2(0TraceResult:TR_pHit) == entindex2)) 
                    { 
                        return 
true 
                    

                } 
            } 
        } 
    } 
    return 
false 


public 
hook_ent(entvictimFloat:speed

    static 
Float:fl_Velocity[3
    static 
Float:VicOrigin[3], Float:EntOrigin[3

    
pev(entpev_originEntOrigin
    
pev(victimpev_originVicOrigin
     
    static 
Float:distance_f 
    distance_f 
get_distance_f(EntOriginVicOrigin

    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(entEV_VEC_velocityfl_Velocity


public 
hook_ent2(entFloat:VicOrigin[3], Float:speed

    static 
Float:fl_Velocity[3
    static 
Float:EntOrigin[3

    
pev(entpev_originEntOrigin
     
    static 
Float:distance_f 
    distance_f 
get_distance_f(EntOriginVicOrigin

    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(entEV_VEC_velocityfl_Velocity


public 
hit_screen(id

    
message_begin(MSG_ONEget_user_msgid("ScreenShake"),{0,0,0}, id
    
write_short(1<<14
    
write_short(1<<13
    
write_short(1<<13
    
message_end()     


public 
reset_think(ent

    
g_doing_other 
    entity_set_float
(entEV_FL_nextthinkget_gametime() + 0.1



// En esta funcion se define el regalo que se le dara al que toque un regalito
public item(id) {
    switch (
random_num(05)) {
        case 
0: {
            
client_print(idprint_center"+ 1 AP")
            
zp_set_user_ammo_packs(idzp_get_user_ammo_packs(id) + 1)
        }
        case 
1: {
            
client_print(idprint_center"+ 2 AP")
            
zp_set_user_ammo_packs(idzp_get_user_ammo_packs(id) + 2)
        }
        case 
2: {
            
client_print(idprint_center"+ 3 AP")
            
zp_set_user_ammo_packs(idzp_get_user_ammo_packs(id) + 3)
        }
        case 
3: {
            
client_print(idprint_center"+ 4 AP")
            
zp_set_user_ammo_packs(idzp_get_user_ammo_packs(id) + 4)
        }
        case 
4: {
            
client_print(idprint_center"+ 5 AP")
            
zp_set_user_ammo_packs(idzp_get_user_ammo_packs(id) + 5)
        }
        case 
5: {
            
client_print(idprint_center"+ 500 AP")
            
zp_set_user_ammo_packs(idzp_get_user_ammo_packs(id) + 500)
        }
    }
}

public 
client_putinserver(id
    
can_pickup[id] = true

public client_disconnected(id
    
can_pickup[id] = false

public round_start() {
    if(
get_pcvar_num(cvar_new_round))
        
remover()
}

public 
reset_pick(id
    
can_pickup[id] = true

public check_status() {    
    if(!
get_pcvar_num(cvar_activado)) 
        
remover()
}

public 
remover() {    
    new 
ent = -1
    
while ((ent engfunc(EngFunc_FindEntityByStringent"classname""regalitos_volando")) != 0) {
        
engfunc(EngFunc_RemoveEntityent)
        
g_regalitos 0
    
}
}
public 
show_menu_regalitos(id) {
    new 
Menu menu_create("\r[amxmodx-es.com] \yRegalitos","menu_regalitos")
    
    
menu_additem(Menu"Soltar regalitos :3""1")
    
menu_additem(Menu"Remover todos los regalitos""2")
    
menu_additem(Menu"Seleccionar color de trail""3")
    
    
menu_setprop(MenuMPROP_EXITMEXIT_NORMAL)
    
menu_display(idMenu0)
}
public 
menu_regalitos(idMenuitem) {
    if(
item == MENU_EXIT) {
        
menu_destroy(Menu)
        return 
PLUGIN_HANDLED
    
}
    
    switch(
item) {
        case 
0dropear(id), show_menu_regalitos(id)
        case 
1remover(), show_menu_regalitos(id)
        case 
2show_menu_colores(id)
    }
    return 
PLUGIN_HANDLED
}
public 
show_menu_colores(id) {
    new 
Menu menu_create("\r[amxmodx-es.com] \yColor de trail""menu_colores")
    
    
menu_additem(Menu"Blanco""1")
    
menu_additem(Menu"Rojo""2")
    
menu_additem(Menu"Verde""3")
    
menu_additem(Menu"Azul^n""4")
    
menu_additem(Menu"Random""5")
    
    
menu_setprop(MenuMPROP_EXITMEXIT_NORMAL)
    
menu_display(idMenu0)
}
public 
menu_colores(idMenuitem) {
    if(
item == MENU_EXIT) {
        
menu_destroy(Menu)
        return 
PLUGIN_HANDLED
    
}
    switch(
item) {
        case 
0server_cmd("regalitos_colores 1")
        case 
1server_cmd("regalitos_colores 2")
        case 
2server_cmd("regalitos_colores 3")
        case 
3server_cmd("regalitos_colores 4")
        case 
4server_cmd("regalitos_colores 5")
    }
    
show_menu_regalitos(id)
    return 
PLUGIN_HANDLED
}
public 
dropear(id) {
    if(!
is_user_alive(id)) return PLUGIN_HANDLED
    
    
if(g_regalitos >= get_pcvar_num(cvar_limite)) {
        
set_hudmessage(255000.00.8016.012.0)
        
show_hudmessage(id"Limite de regalitos alcanzado")
        return 
PLUGIN_HANDLED
    
}
    if(
can_pickup[id] != false) {
        
can_pickup[id] = false
        set_task
(0.1"reset_pick"id)
        
        new 
Float:Speed[3]
        
velocity_by_aim(id10 100Speed)
        
dropear2(idSpeed)
        
g_regalitos++
        
        
set_hudmessage(025500.00.8016.012.0)
        
show_hudmessage(id"Regalitos en mapa: %d"g_regalitos)
    }
    return 
PLUGIN_HANDLED
}
public 
dropear2(idFloat:Speed[]) {
    new 
ent engfunc(EngFunc_CreateNamedEntityengfunc(EngFunc_AllocString"info_target"))
    
    new 
Float:origin[3]
    
pev(idpev_originorigin)
    
set_pev(entpev_originorigin)
    
    
Speed[2] += 100.0
    set_pev
(entpev_velocitySpeed)
    
    new 
Float:angles[3]
    
pev(entpev_angles,angles)
    
angles[1] += random_num(1,360)
    
set_pev(entpev_anglesangles)
    
    
set_pev(entpev_classname"regalitos_volando")
    
engfunc(EngFunc_SetModelentMDL)
    
engfunc(EngFunc_SetSizeentFloat:{-2.79, -0.0, -6.14}, Float:{2.421.996.35})
    
set_pev(entpev_solidSOLID_TRIGGER)
    
set_pev(entpev_movetypeMOVETYPE_BOUNCE)
    
engfunc(EngFunc_DropToFloorent)
    
    
colores(ent)    
}
public 
colores(ent) {
    
set_pev(entpev_renderfxkRenderFxGlowShell)
    
    new 
cvar get_pcvar_num(cvar_colors)
    new 
rgb
    
    
if(cvar == 1) {
        
set_pev(entpev_rendercolorFloat:{255.0255.0255.0})
        
255
        g 
255
        b 
255
    
}
    else if(
cvar == 2) {
        
set_pev(entpev_rendercolorFloat:{255.0000.0000.0})
        
255
        g 
0
        b 
0
    
}
    else if(
cvar == 3) {
        
set_pev(entpev_rendercolorFloat:{000.0255.0000.0})
        
000
        g 
255
        b 
000
    
}
    else if(
cvar == 4) {
        
set_pev(entpev_rendercolorFloat:{000.0000.0255.0})
        
000
        g 
000
        b 
255
    
} else {
        switch (
random(4)) {    
            case 
0: {
                
set_pev(entpev_rendercolorFloat:{255.0255.0255.0})
                
255
                g 
255
                b 
255
            
}
            case 
1: {
                
set_pev(entpev_rendercolorFloat:{255.0000.0000.0})
                
255 
                g 
000
                b 
000
            
}
            case 
2:{
                
set_pev(entpev_rendercolorFloat:{000.0255.0000.0})
                
000
                g 
255
                b 
000
            
}
            case 
3: {
                
set_pev(entpev_rendercolorFloat:{000.0000.0255.0})
                
000
                g 
000
                b 
255
            
}
        }
    }    
    
message_begin(MSG_BROADCASTSVC_TEMPENTITY)
    
write_byte(TE_BEAMFOLLOW)
    
write_short(ent)
    
write_short(g_trailSpr)
    
write_byte(5)
    
write_byte(1)
    
write_byte(r)
    
write_byte(g)
    
write_byte(b)
    
write_byte(255)
    
message_end()
}
public 
screen_fade(id) {
    
message_begin(MSG_ONEg_msgScreenFade, {000}, id
    
write_short(1<<12)
    
write_short(1<<12)
    
write_short(1<<12)
    
write_byte(200)
    
write_byte(200)
    
write_byte(200)
    
write_byte(20)
    
message_end()
}
public 
player_Touch(entid) { 
    if(!
pev_valid(ent) || !is_user_alive(id) ||  !get_pcvar_num(cvar_activado) || !can_pickup[id]) return FMRES_IGNORED
    
    
new classname[32]
    
pev(entpev_classnameclassnamecharsmax(classname))
    
    if(
equali(classname"regalitos_volando")) {
        
g_regalitos--
        
item(id)
        
screen_fade(id)
        
emit_sound(idCHAN_AUTOSND1.0ATTN_NORM0PITCH_NORM)
        
        if(
pev_valid(ent)) {
            
engfunc(EngFunc_RemoveEntityent)    
        }
    }
    return 
FMRES_IGNORED

“Quien te quiere en su vida, volverá a buscarte”
Qué frase más estúpida
Porque quien te quiere en su vida, jamás se iría.
Responder
#5
(28/05/2022, 04:26 PM)HK-416 escribió: Prueba
Código PHP:
#include <amxmodx> 
#include <engine> 
#include <fakemeta> 
#include <hamsandwich> 
#include <xs> 
#include <amxmisc>
#include <zombieplague>

#define OBERON_CLASSNAME "oberon" 
#define OBERON_HEALTH 235000.0 

#define TASK_SKILL 123123123 
#define TASK_HOOKINGUP 123312312 
#define TASK_HOOKINGDOWN 123312313

new const Float:OBERON_HEALTH_OFFSET 0.0;

#if AMXX_VERSION_NUM < 183

#define client_disconnected(%1) client_disconnect(%1)

stock client_print_color(const id, const input[], any:...)
{
    new count 1players[32]
    static msg[191]
    vformat(msg190input3)
    
    replace_all
(msg190"!g""^4")
    replace_all(msg190"!y""^1")
    replace_all(msg190"!t""^3")
    replace_all(msg190"!team2""^0")
    
    
if(id)
        players[0] = id;
    else
        get_players(playerscount"ch")
    
    
for (new 0counti++) {
        if(is_user_connected(players[i])) {
            message_begin(MSG_ONE_UNRELIABLEget_user_msgid("SayText"), _players[i])
            write_byte(players[i]);
            write_string(msg);
            message_end();
        }
    }
}

#endif

new const oberon_model[] = "models/oberon/zbs_bossl_big02.mdl" 
new const oberon_knife_effect[] = "models/oberon/ef_knife.mdl" 
new const oberon_hole_effect[] = "models/oberon/ef_hole.mdl" 
new const oberon_bomb_model[] = "models/oberon/zbs_bossl_big02_bomb.mdl" 
new MDL[] = "models/regalito.mdl"


new SND[] = "regalitos_pickup.wav"
new const oberon_appear_sound[] = "oberon/appear.wav" 
new const oberon_death_sound[] = "oberon/death.wav" 
new const oberon_evolution_sound[] = "oberon/knife.wav" 
new const oberon_attack_sound[8][] =  

    "oberon/attack1.wav"
    "oberon/attack2.wav"
    "oberon/attack3_jump.wav"
    "oberon/attack3.wav"
    "oberon/knife_attack1.wav"
    "oberon/knife_attack2.wav"
    "oberon/knife_attack3_jump.wav"
    "oberon/knife_attack3.wav" 

new const 
oberon_hole_sound[] = "oberon/hole.wav" 
new const oberon_bomb_sound[] = "oberon/attack_bomb.wav" 


new TRAIL[] = "sprites/laserbeam.spr"

// Variables
new g_trailSprg_msgScreenFadeg_regalitos
new cvar_activadocvar_limitecvar_new_roundcvar_colors


new oberon_model_idg_regm_iBlood[2], exp_spr_id 
new Float:g_cur_origin[3], Float:g_cur_angles[3], Float:g_cur_v_angle[3
new 
g_evolutiong_evolutingg_doing_otherg_attacking3Float:g_attacking3_origin[3
new 
bool:can_pickup[33]

public 
plugin_init() 

    register_plugin("[Dias's NPC] Oberon""1.0""Dias"
     
    register_event
("HLTV""event_newround""a""1=0""2=0"
    register_touch(OBERON_CLASSNAME"*""fw_touch"
     
    register_clcmd
("say /oberon_spawn""get_origin"
    register_clcmd("say /crear_oberon""create_oberon"
    
    
    register_forward
(FM_Touch"player_Touch")
    
    register_logevent
("round_start"2"1=Round_Start")
    
    cvar_activado 
register_cvar("regalitos_activado","1"// Activar o desactivar el plugin
    cvar_new_round register_cvar("regalitos_remover","1"// Remover Regalitos en nueva ronda
    cvar_colors register_cvar("regalitos_colores","5"// Colores de Regalitos   ( 1=Blanco 2=Rojo 3=Verde 4=Azul 5=Random)
    cvar_limite register_cvar("regalitos_limite","100"// Limite de Regalitos
    
    set_task
(58.3"anuncio"100_,_"b")
    set_task(1.0"check_status"20000_,_"b")
    
    g_msgScreenFade 
get_user_msgid("ScreenFade")


public 
plugin_precache() 

    oberon_model_id precache_model(oberon_model
    precache_model(oberon_knife_effect
    precache_model(oberon_hole_effect
    precache_model(oberon_bomb_model
     
    precache_sound
(oberon_appear_sound
    precache_sound(oberon_death_sound
    precache_sound(oberon_evolution_sound
    for(new 0sizeof(oberon_attack_sound); i++) 
    
        precache_sound(oberon_attack_sound[i]) 
    
    precache_sound(oberon_hole_sound
    precache_sound(oberon_bomb_sound
     
    m_iBlood
[0] = precache_model("sprites/blood.spr"
    m_iBlood[1] = precache_model("sprites/bloodspray.spr")     
    exp_spr_id 
precache_model("sprites/zerogxplode.spr"
    
    precache_model
(MDL)
    precache_sound(SND)
    g_trailSpr engfunc(EngFunc_PrecacheModelTRAIL)


public 
event_newround() 

    static ent 
    ent 
find_ent_by_class(-1OBERON_CLASSNAME
     
    
if(task_exists(ent+TASK_SKILL)) remove_task(ent+TASK_SKILL


public 
get_origin(id

    pev(idpev_origing_cur_origin
    pev(idpev_anglesg_cur_angles
    pev(idpev_v_angleg_cur_v_angle
     
    client_print
(idprint_chat"[Addon Por Dias] Ok, Aqui Aparecera El Oberon"


public 
create_oberon(id
{
    if (!is_user_admin(id)) return PLUGIN_HANDLED;
    new ent create_entity("info_target"
     
    entity_set_origin
(entg_cur_origin
    entity_set_vector(entEV_VEC_anglesg_cur_angles
    //entity_set_vector(ent, EV_VEC_v_angle, g_cur_v_angle) 
     
    entity_set_float
(entEV_FL_takedamage1.0
     
    entity_set_string
(ent,EV_SZ_classnameOBERON_CLASSNAME
    entity_set_model(entoberon_model
    entity_set_int(entEV_INT_solidSOLID_SLIDEBOX
    entity_set_int(entEV_INT_movetypeMOVETYPE_PUSHSTEP
     
    
new Float:maxs[3] = {100.0100.0100.0
    new Float:mins[3] = {-100.0, -100.0, -30.0
    entity_set_size(entminsmaxs
    entity_set_int(entEV_INT_modelindexoberon_model_id
     
    set_entity_anim
(ent1
     
    set_pev
(entpev_iuser40)
    set_pev(entpev_healthOBERON_HEALTH_OFFSET OBERON_HEALTH);
     
    entity_set_float
(entEV_FL_nextthinkhalflife_time() + 6.0
    set_task(5.0"start_oberon"ent
     
    set_task
(15.0"do_random_skill"ent__"b"
     
    
if(!g_reg
    
        RegisterHamFromEntity(Ham_TakeDamageent"fw_takedmg"1
        RegisterHamFromEntity(Ham_Thinkent"fw_think")
        RegisterHamFromEntity(Ham_Killedent"fw_killed")
        g_reg 
    
}     
     
    g_evolution 

    g_evoluting 

    g_doing_other 

     
    drop_to_floor
(ent
    emit_sound(entCHAN_BODYoberon_appear_sound1.0ATTN_NORM0PITCH_NORM
    return PLUGIN_HANDLED;
}

public 
fw_killed(entattacker)
{
    if(!
is_valid_ent(ent))
        return 
HAM_IGNORED;

    new 
reward_kill_oberon 5000;
    new 
name[32];

    
get_user_name(attackernamesizeof name 1);
    
zp_set_user_ammo_packs(attackerzp_get_user_ammo_packs(attacker) + reward_kill_oberon);

    
client_print(attackerprint_chat"Felicitaciones ganaste %d APs por matar el oberon"reward_kill_oberon);
    
client_print(0print_chat"El jugador %s mato al oberon"name);

    return 
HAM_IGNORED;
}

public 
start_oberon(ent

    set_entity_anim(ent2


public 
fw_think(ent

    if(!is_valid_ent(ent)) 
        return HAM_IGNORED 
         
    
if(pev(entpev_iuser4) == 1// Oberon is dead 
        return HAM_IGNORED 
         
    
if(g_evoluting || g_doing_other
        return HAM_IGNORED 
         
    
if((pev(entpev_health) - OBERON_HEALTH_OFFSET) <= 0.0
    
        set_pev(entpev_iuser41
        set_entity_anim(ent20
        set_task(15.0"move_entity"ent
        entity_set_int(entEV_INT_solidSOLID_NOT
        entity_set_float(entEV_FL_takedamage0.0
         
        emit_sound
(entCHAN_BODYoberon_death_sound1.0ATTN_NORM0PITCH_NORM
         
        
return HAM_IGNORED 
    

    if(((pev(entpev_health) - OBERON_HEALTH_OFFSET) <= OBERON_HEALTH 2.0) && !g_evolution
    
        g_evoluting 
        set_entity_anim
(ent11
         
        emit_sound
(entCHAN_BODYoberon_evolution_sound1.0ATTN_NORM0PITCH_NORM
        set_task(8.0"set_new_idle"ent
         
        
return HAM_IGNORED 
    
}     
     
    
static victim 
    
static Float:Origin[3], Float:VicOrigin[3], Float:distance 
     
    victim 
FindClosesEnemy(ent
    pev(entpev_originOrigin
    pev(victimpev_originVicOrigin
     
    distance 
get_distance_f(OriginVicOrigin
     
    
if(is_user_alive(victim)) 
    
        if(distance <= 250.0
        
            if(!is_valid_ent(ent)) 
                return FMRES_IGNORED     
         
            
new Float:Ent_Origin[3], Float:Vic_Origin[3
             
            pev
(entpev_originEnt_Origin
            pev(victimpev_originVic_Origin)             
         
            npc_turntotarget
(entEnt_OriginvictimVic_Origin
             
            
static Attack_Typeattack_animattack_sound 
            Attack_Type 
random_num(12
             
            
if(Attack_Type == 1
            
                if(g_evolution
                
                    attack_anim 14 
                    attack_sound 

                
} else { 
                    attack_anim 
                    attack_sound 

                

                 
                set_entity_anim
(entattack_anim
                emit_sound(entCHAN_BODYoberon_attack_sound[attack_sound], 1.0ATTN_NORM0PITCH_NORM
                 
                set_task
(1.0"do_takedmg"ent
                 
                entity_set_float
(entEV_FL_nextthinkget_gametime() + 3.0
            } else { 
                if(g_evolution
                
                    attack_anim 15 
                    attack_sound 

                
} else {  
                    attack_anim 

                    attack_sound 

                

                     
                set_entity_anim
(entattack_anim)     
                emit_sound
(entCHAN_BODYoberon_attack_sound[attack_sound], 1.0ATTN_NORM0PITCH_NORM
                 
                set_task
(0.5"do_takedmg"ent)             
                 
                entity_set_float
(entEV_FL_nextthinkget_gametime() + 3.0
            
             
        
} else { 
            static moving_anim 
             
            
if(g_evolution
                moving_anim 13 
            else  
                moving_anim 
3         
         
            
if(pev(entpev_sequence) != moving_anim
            
                entity_set_float(entEV_FL_animtimeget_gametime()) 
                entity_set_float(entEV_FL_framerate1.0
                entity_set_int(entEV_INT_sequencemoving_anim
            
                 
            
new Float:Ent_Origin[3], Float:Vic_Origin[3
             
            pev
(entpev_originEnt_Origin
            pev(victimpev_originVic_Origin
             
            npc_turntotarget
(entEnt_OriginvictimVic_Origin
            hook_ent(entvictim100.0
             
            entity_set_float
(entEV_FL_nextthinkget_gametime() + 0.1
        
    } else { 
        static idle_anim 
         
        
if(g_evolution
            idle_anim 12 
        else  
            idle_anim 

             
        
if(pev(entpev_sequence) != idle_anim
        
            set_entity_anim(entidle_anim
        }     
             
        entity_set_float
(entEV_FL_nextthinkget_gametime() + 1.0
    }     
         
    
return HAM_HANDLED 


public 
do_random_skill(ent

    if(!pev_valid(ent)) 
        return PLUGIN_HANDLED 
         
    
if(g_evoluting
        return PLUGIN_HANDLED 
         
    
if((pev(entpev_health) - OBERON_HEALTH_OFFSET) <= 0.0
        return PLUGIN_HANDLED 
     
    
static random_skill 
    random_skill 
random_num(0100)  
     
    g_doing_other 

     
    
switch(random_skill
    
        case 0..37: { 
            do_attack3(ent
             
        

        case 38..72: { 
            do_hole(ent
        
        case 73..100: { 
            do_bomb(ent
        }         
    
}     
     
    
return PLUGIN_CONTINUE 


public 
do_bomb(oberon

    g_doing_other 
     
    
static bomb_anim 
    
if(g_evolution
        bomb_anim 18 
    
else 
        bomb_anim 
         
    set_entity_anim
(oberonbomb_anim
     
    set_task
(3.0"do_skill_bomb"oberon+2015__"b"
    set_task(10.0"stop_skill_bomb"oberon


public 
stop_skill_bomb(oberon

    remove_task(oberon+2015
     
    
static idle_anim 
     
    
if(g_evolution
        idle_anim 12 
    else  
        idle_anim 

         
    set_entity_anim
(oberonidle_anim
    set_task(2.0"reset_think"oberon


public 
do_skill_bomb(oberon

    oberon -= 2015 
    
static Float:StartOrigin[3], Float:TempOrigin[6][3], Float:VicOrigin[6][3], Float:Random1 
     
    pev
(oberonpev_originStartOrigin
    emit_sound(oberonCHAN_BODYoberon_bomb_sound1.0ATTN_NORM0PITCH_NORM
     
    
// 1st Bomb 
    Random1 random_float(100.0500.0
    VicOrigin[0][0] = StartOrigin[0] + Random1 
    VicOrigin
[0][1] = StartOrigin[1
    VicOrigin[0][2] = StartOrigin[2
     
    TempOrigin
[0][0] = VicOrigin[0][0] - (Random1 2.0
    TempOrigin[0][1] = VicOrigin[0][1
    TempOrigin[0][2] = VicOrigin[0][2] + 500.0 
     
    
// 2nd Bomb 
    Random1 random_float(100.0500.0
    VicOrigin[1][0] = StartOrigin[0
    VicOrigin[1][1] = StartOrigin[1] + Random1 
    VicOrigin
[1][2] = StartOrigin[2
     
    TempOrigin
[1][0] = VicOrigin[1][0
    TempOrigin[1][1] = VicOrigin[1][1] - (Random1 2.0
    TempOrigin[1][2] = VicOrigin[1][2] + 500.0     
     
    
// 3rd Bomb 
    Random1 random_float(100.0500.0
    VicOrigin[2][0] = StartOrigin[0] - Random1 
    VicOrigin
[2][1] = StartOrigin[1
    VicOrigin[2][2] = StartOrigin[2
     
    TempOrigin
[2][0] = VicOrigin[2][0] - (Random1 2.0
    TempOrigin[2][1] = VicOrigin[2][1
    TempOrigin[2][2] = VicOrigin[2][2] + 500.0     
     
    
// 4th Bomb 
    VicOrigin[3][0] = StartOrigin[0
    VicOrigin[3][1] = StartOrigin[1] - Random1 
    VicOrigin
[3][2] = StartOrigin[2
     
    TempOrigin
[3][0] = VicOrigin[3][0
    TempOrigin[3][1] = VicOrigin[3][1] - (Random1 2.0
    TempOrigin[3][2] = VicOrigin[3][2] + 500.0 
     
    
// 5th Bomb 
    VicOrigin[4][0] = StartOrigin[0] + Random1 
    VicOrigin
[4][1] = StartOrigin[1] + Random1 
    VicOrigin
[4][2] = StartOrigin[2
     
    TempOrigin
[4][0] = VicOrigin[4][0] - (Random1 2.0
    TempOrigin[4][1] = VicOrigin[4][1] - (Random1 2.0
    TempOrigin[4][2] = VicOrigin[4][2] + 500.0 
     
    
// 6th Bomb 
    VicOrigin[5][0] = StartOrigin[0] + Random1 
    VicOrigin
[5][1] = StartOrigin[1] - Random1 
    VicOrigin
[5][2] = StartOrigin[2
     
    TempOrigin
[5][0] = VicOrigin[5][0] + (Random1 2.0
    TempOrigin[5][1] = VicOrigin[5][1] - (Random1 2.0
    TempOrigin[5][2] = VicOrigin[5][2] + 500.0     
     
    
for(new 06i++) 
    
        make_bomb(StartOriginTempOrigin[i], VicOrigin[i]) 
    }     


public 
make_bomb(Float:StartOrigin[3], Float:TempOrigin[3], Float:VicOrigin[3]) 

    new ent create_entity("info_target"
     
    StartOrigin
[2] += 20.0 
     
    entity_set_origin
(entStartOrigin
     
    entity_set_string
(ent,EV_SZ_classname"oberon_bomb"
    entity_set_model(entoberon_bomb_model
    entity_set_int(entEV_INT_solidSOLID_NOT
    entity_set_int(entEV_INT_movetypeMOVETYPE_BOUNCE
     
    
new Float:maxs[3] = {10.0,10.0,10.0
    new Float:mins[3] = {-10.0,-10.0,-5.0
    entity_set_size(entminsmaxs
     
    entity_set_float
(entEV_FL_animtimeget_gametime()) 
    entity_set_float(entEV_FL_framerate1.0)     
    entity_set_int
(entEV_INT_sequence0)         
     
    
static arg[4], arg2[4
     
    arg
[0] = ent 
    arg
[1] = floatround(TempOrigin[0]) 
    arg[2] = floatround(TempOrigin[1]) 
    arg[3] = floatround(TempOrigin[2]) 

    arg2[0] = ent 
    arg2
[1] = floatround(VicOrigin[0]) 
    arg2[2] = floatround(VicOrigin[1]) 
    arg2[3] = floatround(VicOrigin[2])     
     
    set_task
(0.01"do_hook_bomb_up"TASK_HOOKINGUPargsizeof(arg), "b"
    set_task(1.0"do_hook_bomb_down"_arg2sizeof(arg2)) 
    set_task(2.0"bomb_explode"ent


public 
bomb_explode(ent

    remove_task(TASK_HOOKINGUP
    remove_task(TASK_HOOKINGDOWN
     
    
static Float:Origin[3
    pev(entpev_originOrigin
     
    message_begin
(MSG_BROADCAST ,SVC_TEMPENTITY
    write_byte(TE_EXPLOSION
    engfunc(EngFunc_WriteCoordOrigin[0]) 
    engfunc(EngFunc_WriteCoordOrigin[1]) 
    engfunc(EngFunc_WriteCoordOrigin[2]) 
    write_short(exp_spr_id)    // sprite index 
    write_byte(20)    // scale in 0.1's 
    write_byte(30)    // framerate 
    write_byte(0)    // flags 
    message_end()     
     
    
for(new 1get_maxplayers(); i++) 
    
        if(is_user_alive(i) && entity_range(ient) <= 300.0
        
            static Float:Damage 
            Damage 
random_float(10.030.0
             
            
if(g_evolution
                Damage *= 2.0 
                 
            ExecuteHam
(Ham_TakeDamagei0iDamageDMG_BLAST
            hit_screen(i
        
    }     
     
    remove_entity
(ent


public 
do_hook_bomb_down(arg[4]) 

    remove_task(TASK_HOOKINGUP
    set_task(0.01"do_hook_bomb_down2"TASK_HOOKINGDOWNargsizeof(arg), "b"


public 
do_hook_bomb_down2(arg[4]) 

    static entFloat:VicOrigin[3
     
    ent 
arg[0
    VicOrigin[0] = float(arg[1]) 
    VicOrigin[1] = float(arg[2]) 
    VicOrigin[2] = float(arg[3])     
     
    hook_ent2
(entVicOrigin500.0


public 
do_hook_bomb_up(arg[4]) 

    static entFloat:TempOrigin[3
     
    ent 
arg[0
    TempOrigin[0] = float(arg[1]) 
    TempOrigin[1] = float(arg[2]) 
    TempOrigin[2] = float(arg[3]) 
     
    hook_ent2
(entTempOrigin500.0


public 
do_hole(oberon

    static hole_anim 
     
    
if(g_evolution
        hole_anim 19 
    
else 
        hole_anim 10 
         
    set_entity_anim
(oberonhole_anim
    emit_sound(oberonCHAN_BODYoberon_hole_sound1.0ATTN_NORM0PITCH_NORM
     
    
new ent create_entity("info_target"
     
    
static Float:Origin[3
    pev(oberonpev_originOrigin
     
    Origin
[2] -= 10.0 
     
    entity_set_origin
(entOrigin
     
    entity_set_string
(ent,EV_SZ_classname"hole_hook"
    entity_set_model(entoberon_hole_effect
    entity_set_int(entEV_INT_solidSOLID_NOT
    entity_set_int(entEV_INT_movetypeMOVETYPE_NONE
     
    
new Float:maxs[3] = {1.0,1.0,1.0
    new Float:mins[3] = {-1.0,-1.0,-1.0
    entity_set_size(entminsmaxs
     
    entity_set_float
(entEV_FL_animtimeget_gametime()) 
    entity_set_float(entEV_FL_framerate1.0)     
    entity_set_int
(entEV_INT_sequence0)     
     
    set_pev
(entpev_rendermodekRenderTransAdd
    set_pev(entpev_renderamt255.0)     
     
    drop_to_floor
(ent
     
    
for(new 0get_maxplayers(); i++) 
    
        if(is_user_alive(i) && entity_range(oberoni) <= 1000.0
        
            static arg[2
            arg[0] = oberon 
            arg
[1] = 
             
            set_task
(0.01"do_hook_player"512512argsizeof(arg), "b"
        
    
     
    set_task
(5.0"stop_hook"oberon+2012)     


public 
do_hook_player(arg[2]) 

    static Float:Origin[3], Float:Speed 
    pev
(arg[0], pev_originOrigin
     
    Speed 
= (1000.0 entity_range(arg[0], arg[1])) * 75.0 
     
    hook_ent2
(arg[1], OriginSpeed


public 
stop_hook(oberon

    oberon -= 2012 
     
    
static ent 
    ent 
find_ent_by_class(-1"hole_hook"
     
    remove_entity
(ent
    remove_task(512512
     
    do_takedmg
(oberon
    set_task(1.0"reset_think"oberon


public 
do_attack3(ent

    static attack3_animattack3_sound 
     
    
if(g_evolution
    
        attack3_anim 16 
        attack3_sound 

    
} else { 
        attack3_anim 
        attack3_sound 

    
}     
     
    g_attacking3 

     
    set_entity_anim
(entattack3_anim
     
    emit_sound
(entCHAN_BODYoberon_attack_sound[attack3_sound], 1.0ATTN_NORM0PITCH_NORM
    set_task(0.1"attack3_jump"ent


public 
attack3_jump(ent

    set_task(0.01"hookingup"ent+TASK_HOOKINGUP__"b"
    set_task(1.0"hookingdown"ent+TASK_HOOKINGDOWN)     
     
    
static Enemy 
    Enemy 
FindClosesEnemy(ent)     
     
    pev
(Enemypev_origing_attacking3_origin


public 
hookingup(ent

    ent -= TASK_HOOKINGUP 
     
    
static Float:Origin[3
    pev(entpev_originOrigin
     
    Origin
[2] += 1000.0 
     
    hook_ent2
(entOrigin1000.0
     
    
static Enemy 
    Enemy 
FindClosesEnemy(ent)     
     
    
new Float:Ent_Origin[3], Float:Vic_Origin[3
     
    pev
(entpev_originEnt_Origin
    pev(Enemypev_originVic_Origin
     
    npc_turntotarget
(entEnt_OriginEnemyVic_Origin)     


public 
hookingdown(ent

    ent -= TASK_HOOKINGDOWN 
     
    remove_task
(ent+TASK_HOOKINGUP
    set_task(0.5"set_func1"ent
     
    set_task
(0.01"hookingdown2"ent+TASK_HOOKINGDOWN__"b"


public 
set_func1(ent

    set_pev(entpev_iuser31


public 
hookingdown2(ent

    ent -= TASK_HOOKINGDOWN 
     
    
static Enemy 
    Enemy 
FindClosesEnemy(ent
     
    hook_ent2
(entg_attacking3_origin1000.0
     
    
new Float:Ent_Origin[3], Float:Vic_Origin[3
     
    pev
(entpev_originEnt_Origin
    pev(Enemypev_originVic_Origin
     
    npc_turntotarget
(entEnt_OriginEnemyVic_Origin)         


public 
fw_touch(enttouch

    if(!pev_valid(ent)) 
        return FMRES_IGNORED 
         
    
if(g_attacking3 && pev(entpev_iuser3) == 1
    
        remove_task(ent+TASK_HOOKINGDOWN
         
        
if(is_user_alive(touch)) 
            user_kill(touch
             
        g_attacking3 

        set_pev
(entpev_iuser30
         
        set_task
(0.75"reset_think"ent
         
        
for(new 1get_maxplayers(); i++) 
        
            if(is_user_alive(i) && entity_range(enti) <= 300.0
            
                hit_screen(i
                 
                
static Float:Damage 
                Damage 
random_float(10.025.0
                 
                
if(g_evolution
                    Damage *= 1.5 
                 
                ExecuteHam
(Ham_TakeDamagei0iDamageDMG_BLAST
            
        }     
         
        
static attack3_sound 
        
if(g_evolution
            attack3_sound 
        
else 
            attack3_sound 
         
        emit_sound
(entCHAN_BODYoberon_attack_sound[attack3_sound], 1.0ATTN_NORM0PITCH_NORM)         
             
        drop_to_floor
(ent
    
         
    
return FMRES_HANDLED 


public 
do_takedmg(ent2

    if(g_evolution
    
        new ent create_entity("info_target"
     
        
static Float:Origin[3], Float:Angles[3
        pev(ent2pev_originOrigin
        pev(ent2pev_anglesAngles
         
        entity_set_origin
(entOrigin
        entity_set_vector(entEV_VEC_anglesAngles
         
        entity_set_string
(ent,EV_SZ_classname"knife_effect"
        entity_set_model(entoberon_knife_effect
        entity_set_int(entEV_INT_solidSOLID_NOT
        entity_set_int(entEV_INT_movetypeMOVETYPE_NONE
         
        
new Float:maxs[3] = {40.040.01.0
        new Float:mins[3] = {-40.0, -40.0, -1.0
        entity_set_size(entminsmaxs
         
        drop_to_floor
(ent
         
        set_task
(1.0"remove_knife_effect"ent
    
     
    
for(new 1get_maxplayers(); i++) 
    
        if(is_user_alive(i) && entity_range(ent2i) <= 300.0
        
            hit_screen(i
             
            
static Float:Damage 
            Damage 
random_float(7.515.0
             
            
if(g_evolution
                Damage *= 2.0 
             
            ExecuteHam
(Ham_TakeDamagei0iDamageDMG_BLAST
        
    }     


public 
remove_knife_effect(ent

    remove_entity(ent


public 
set_new_idle(ent

    g_evoluting 
    g_evolution 

    set_entity_anim
(ent12
     
    entity_set_float
(entEV_FL_nextthinkget_gametime() + 0.1


public 
move_entity(ent

    static Float:Origin[3
     
    Origin
[0] = 4290.0 
    Origin
[1] = 4290.0 
    Origin
[2] = 4290.0 
     
    set_pev
(entpev_originOrigin
    entity_set_float(entEV_FL_nextthinkhalflife_time() + 99999999.0


public 
fw_takedmg(victiminflictorattackerFloat:damagedamagebits

    static Float:Origin[3
    fm_get_aimorigin(attackerOrigin
     
    client_print
(attackerprint_center"Vida Del Oberon: %i"floatround(pev(victimpev_health) - OBERON_HEALTH_OFFSET))    
     
    create_blood
(Origin)     


stock set_entity_anim(entanim

    entity_set_float(entEV_FL_animtimeget_gametime()) 
    entity_set_float(entEV_FL_framerate1.0
    entity_set_int(entEV_INT_sequenceanim)     


stock create_blood(const Float:origin[3]) 

    // Show some blood :) 
    message_begin(MSG_BROADCASTSVC_TEMPENTITY)  
    write_byte
(TE_BLOODSPRITE
    engfunc(EngFunc_WriteCoordorigin[0]) 
    engfunc(EngFunc_WriteCoordorigin[1]) 
    engfunc(EngFunc_WriteCoordorigin[2]) 
    write_short(m_iBlood[1]) 
    write_short(m_iBlood[0]) 
    write_byte(75
    write_byte(5
    message_end() 


stock fm_get_aimorigin(indexFloat:origin[3]) 

    new Float:start[3], Float:view_ofs[3]; 
    pev(indexpev_originstart); 
    pev(indexpev_view_ofsview_ofs); 
    xs_vec_add(startview_ofsstart); 
     
    
new Float:dest[3]; 
    pev(indexpev_v_angledest); 
    engfunc(EngFunc_MakeVectorsdest); 
    global_get(glb_v_forwarddest); 
    xs_vec_mul_scalar(dest9999.0dest); 
    xs_vec_add(startdestdest); 
     
    engfunc
(EngFunc_TraceLinestartdest0index0); 
    get_tr2(0TR_vecEndPosorigin); 
     
    
return 1
}
   

public FindClosesEnemy(entid

    new Float:Dist 
    
new Float:maxdistance=4000.0 
    
new indexid=0     
    
for(new i=1;i<=get_maxplayers();i++){ 
        if(is_user_alive(i) && is_valid_ent(i) && can_see_fm(entidi)) 
        
            Dist entity_range(entidi
            if(Dist <= maxdistance
            
                maxdistance=Dist 
                indexid
=
                 
                
return indexid 
            

        }     
    
}     
    
return 


public 
npc_turntotarget(entFloat:Ent_Origin[3], targetFloat:Vic_Origin[3])  

    if(target)  
    

        new Float:newAngle[3
        entity_get_vector(entEV_VEC_anglesnewAngle
        new Float:Vic_Origin[0] - Ent_Origin[0
        new Float:Vic_Origin[1] - Ent_Origin[1

        new Float:radians floatatan(z/xradian
        newAngle[1] = radians * (180 3.14
        if (Vic_Origin[0] < Ent_Origin[0]) 
            newAngle[1] -= 180.0 
         
        entity_set_vector
(entEV_VEC_anglesnewAngle
    


public 
bool:can_see_fm(entindex1entindex2

    if (!entindex1 || !entindex2
        return false 

    
if (pev_valid(entindex1) && pev_valid(entindex1)) 
    
        new flags pev(entindex1pev_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(entindex1pev_originlookerOrig
        pev(entindex1pev_view_ofstemp
        lookerOrig[0] += temp[0
        lookerOrig[1] += temp[1
        lookerOrig[2] += temp[2

        pev(entindex2pev_origintargetBaseOrig
        pev(entindex2pev_view_ofstemp
        targetOrig[0] = targetBaseOrig [0] + temp[0
        targetOrig[1] = targetBaseOrig [1] + temp[1
        targetOrig[2] = targetBaseOrig [2] + temp[2

        engfunc(EngFunc_TraceLinelookerOrigtargetOrig0entindex10//  checks the had of seen player 
        if (get_tr2(0TraceResult:TR_InOpen) && get_tr2(0TraceResult:TR_InWater)) 
        
            return false 
        
}  
        else  
        

            new Float:flFraction 
            get_tr2
(0TraceResult:TR_flFractionflFraction
            if (flFraction == 1.0 || (get_tr2(0TraceResult:TR_pHit) == entindex2)) 
            
                return true 
            

            else 
            
                targetOrig[0] = targetBaseOrig [0
                targetOrig[1] = targetBaseOrig [1
                targetOrig[2] = targetBaseOrig [2
                engfunc(EngFunc_TraceLinelookerOrigtargetOrig0entindex10//  checks the body of seen player 
                get_tr2(0TraceResult:TR_flFractionflFraction
                if (flFraction == 1.0 || (get_tr2(0TraceResult:TR_pHit) == entindex2)) 
                
                    return true 
                

                else 
                
                    targetOrig[0] = targetBaseOrig [0
                    targetOrig[1] = targetBaseOrig [1
                    targetOrig[2] = targetBaseOrig [2] - 17.0 
                    engfunc
(EngFunc_TraceLinelookerOrigtargetOrig0entindex10//  checks the legs of seen player 
                    get_tr2(0TraceResult:TR_flFractionflFraction
                    if (flFraction == 1.0 || (get_tr2(0TraceResult:TR_pHit) == entindex2)) 
                    
                        return true 
                    

                
            
        
    
    return false 


public 
hook_ent(entvictimFloat:speed

    static Float:fl_Velocity[3
    static Float:VicOrigin[3], Float:EntOrigin[3

    pev(entpev_originEntOrigin
    pev(victimpev_originVicOrigin
     
    
static Float:distance_f 
    distance_f 
get_distance_f(EntOriginVicOrigin

    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(entEV_VEC_velocityfl_Velocity


public 
hook_ent2(entFloat:VicOrigin[3], Float:speed

    static Float:fl_Velocity[3
    static Float:EntOrigin[3

    pev(entpev_originEntOrigin
     
    
static Float:distance_f 
    distance_f 
get_distance_f(EntOriginVicOrigin

    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(entEV_VEC_velocityfl_Velocity


public 
hit_screen(id

    message_begin(MSG_ONEget_user_msgid("ScreenShake"),{0,0,0}, id
    write_short(1<<14
    write_short(1<<13
    write_short(1<<13
    message_end()     


public 
reset_think(ent

    g_doing_other 
    entity_set_float
(entEV_FL_nextthinkget_gametime() + 0.1



// En esta funcion se define el regalo que se le dara al que toque un regalito
public item(id) {
    switch (random_num(05)) {
        case 0: {
            client_print(idprint_center"+ 1 AP")
            zp_set_user_ammo_packs(idzp_get_user_ammo_packs(id) + 1)
        }
        case 1: {
            client_print(idprint_center"+ 2 AP")
            zp_set_user_ammo_packs(idzp_get_user_ammo_packs(id) + 2)
        }
        case 2: {
            client_print(idprint_center"+ 3 AP")
            zp_set_user_ammo_packs(idzp_get_user_ammo_packs(id) + 3)
        }
        case 3: {
            client_print(idprint_center"+ 4 AP")
            zp_set_user_ammo_packs(idzp_get_user_ammo_packs(id) + 4)
        }
        case 4: {
            client_print(idprint_center"+ 5 AP")
            zp_set_user_ammo_packs(idzp_get_user_ammo_packs(id) + 5)
        }
        case 5: {
            client_print(idprint_center"+ 500 AP")
            zp_set_user_ammo_packs(idzp_get_user_ammo_packs(id) + 500)
        }
    }
}

public 
client_putinserver(id
    can_pickup[id] = true

public client_disconnected(id
    can_pickup[id] = false

public round_start() {
    if(get_pcvar_num(cvar_new_round))
        remover()
}

public 
reset_pick(id
    can_pickup[id] = true

public check_status() {    
    
if(!get_pcvar_num(cvar_activado)) 
        remover()
}

public 
remover() {    
    
new ent = -1
    
while ((ent engfunc(EngFunc_FindEntityByStringent"classname""regalitos_volando")) != 0) {
        engfunc(EngFunc_RemoveEntityent)
        g_regalitos 0
    
}
}
public 
show_menu_regalitos(id) {
    new Menu menu_create("\r[amxmodx-es.com] \yRegalitos","menu_regalitos")
    
    menu_additem
(Menu"Soltar regalitos :3""1")
    menu_additem(Menu"Remover todos los regalitos""2")
    menu_additem(Menu"Seleccionar color de trail""3")
    
    menu_setprop
(MenuMPROP_EXITMEXIT_NORMAL)
    menu_display(idMenu0)
}
public 
menu_regalitos(idMenuitem) {
    if(item == MENU_EXIT) {
        menu_destroy(Menu)
        return PLUGIN_HANDLED
    
}
    
    
switch(item) {
        case 0dropear(id), show_menu_regalitos(id)
        case 1remover(), show_menu_regalitos(id)
        case 2show_menu_colores(id)
    }
    return PLUGIN_HANDLED
}
public 
show_menu_colores(id) {
    new Menu menu_create("\r[amxmodx-es.com] \yColor de trail""menu_colores")
    
    menu_additem
(Menu"Blanco""1")
    menu_additem(Menu"Rojo""2")
    menu_additem(Menu"Verde""3")
    menu_additem(Menu"Azul^n""4")
    menu_additem(Menu"Random""5")
    
    menu_setprop
(MenuMPROP_EXITMEXIT_NORMAL)
    menu_display(idMenu0)
}
public 
menu_colores(idMenuitem) {
    if(item == MENU_EXIT) {
        menu_destroy(Menu)
        return PLUGIN_HANDLED
    
}
    switch(item) {
        case 0server_cmd("regalitos_colores 1")
        case 1server_cmd("regalitos_colores 2")
        case 2server_cmd("regalitos_colores 3")
        case 3server_cmd("regalitos_colores 4")
        case 4server_cmd("regalitos_colores 5")
    }
    show_menu_regalitos(id)
    return PLUGIN_HANDLED
}
public 
dropear(id) {
    if(!is_user_alive(id)) return PLUGIN_HANDLED
    
    
if(g_regalitos >= get_pcvar_num(cvar_limite)) {
        set_hudmessage(255000.00.8016.012.0)
        show_hudmessage(id"Limite de regalitos alcanzado")
        return PLUGIN_HANDLED
    
}
    if(can_pickup[id] != false) {
        can_pickup[id] = false
        set_task
(0.1"reset_pick"id)
        
        
new Float:Speed[3]
        velocity_by_aim(id10 100Speed)
        dropear2(idSpeed)
        g_regalitos++
        
        set_hudmessage
(025500.00.8016.012.0)
        show_hudmessage(id"Regalitos en mapa: %d"g_regalitos)
    }
    return PLUGIN_HANDLED
}
public 
dropear2(idFloat:Speed[]) {
    new ent engfunc(EngFunc_CreateNamedEntityengfunc(EngFunc_AllocString"info_target"))
    
    
new Float:origin[3]
    pev(idpev_originorigin)
    set_pev(entpev_originorigin)
    
    Speed
[2] += 100.0
    set_pev
(entpev_velocitySpeed)
    
    
new Float:angles[3]
    pev(entpev_angles,angles)
    angles[1] += random_num(1,360)
    set_pev(entpev_anglesangles)
    
    set_pev
(entpev_classname"regalitos_volando")
    engfunc(EngFunc_SetModelentMDL)
    engfunc(EngFunc_SetSizeentFloat:{-2.79, -0.0, -6.14}, Float:{2.421.996.35})
    set_pev(entpev_solidSOLID_TRIGGER)
    set_pev(entpev_movetypeMOVETYPE_BOUNCE)
    engfunc(EngFunc_DropToFloorent)
    
    colores
(ent)    
}
public 
colores(ent) {
    set_pev(entpev_renderfxkRenderFxGlowShell)
    
    
new cvar get_pcvar_num(cvar_colors)
    new rgb
    
    
if(cvar == 1) {
        set_pev(entpev_rendercolorFloat:{255.0255.0255.0})
        r 255
        g 
255
        b 
255
    
}
    else if(cvar == 2) {
        set_pev(entpev_rendercolorFloat:{255.0000.0000.0})
        r 255
        g 
0
        b 
0
    
}
    else if(cvar == 3) {
        set_pev(entpev_rendercolorFloat:{000.0255.0000.0})
        r 000
        g 
255
        b 
000
    
}
    else if(cvar == 4) {
        set_pev(entpev_rendercolorFloat:{000.0000.0255.0})
        r 000
        g 
000
        b 
255
    
} else {
        switch (random(4)) {    
            
case 0: {
                set_pev(entpev_rendercolorFloat:{255.0255.0255.0})
                r 255
                g 
255
                b 
255
            
}
            case 1: {
                set_pev(entpev_rendercolorFloat:{255.0000.0000.0})
                r 255 
                g 
000
                b 
000
            
}
            case 2:{
                set_pev(entpev_rendercolorFloat:{000.0255.0000.0})
                r 000
                g 
255
                b 
000
            
}
            case 3: {
                set_pev(entpev_rendercolorFloat:{000.0000.0255.0})
                r 000
                g 
000
                b 
255
            
}
        }
    }    
    message_begin
(MSG_BROADCASTSVC_TEMPENTITY)
    write_byte(TE_BEAMFOLLOW)
    write_short(ent)
    write_short(g_trailSpr)
    write_byte(5)
    write_byte(1)
    write_byte(r)
    write_byte(g)
    write_byte(b)
    write_byte(255)
    message_end()
}
public 
screen_fade(id) {
    message_begin(MSG_ONEg_msgScreenFade, {000}, id
    write_short(1<<12)
    write_short(1<<12)
    write_short(1<<12)
    write_byte(200)
    write_byte(200)
    write_byte(200)
    write_byte(20)
    message_end()
}
public 
player_Touch(entid) { 
    if(!pev_valid(ent) || !is_user_alive(id) ||  !get_pcvar_num(cvar_activado) || !can_pickup[id]) return FMRES_IGNORED
    
    
new classname[32]
    pev(entpev_classnameclassnamecharsmax(classname))
    
    
if(equali(classname"regalitos_volando")) {
        g_regalitos--
        item(id)
        screen_fade(id)
        emit_sound(idCHAN_AUTOSND1.0ATTN_NORM0PITCH_NORM)
        
        
if(pev_valid(ent)) {
            engfunc(EngFunc_RemoveEntityent)    
        
}
    }
    return FMRES_IGNORED

ahora si desaparece pero quedan los efectos de los poderes que lanza
L 05/28/2022 - 16:37:30: [FAKEMETA] Invalid entity
L 05/28/2022 - 16:37:30: [AMXX] Run time error 10 (plugin "oberon.amxx") (native "pev") - debug not enabled!
Aporte(?
Discord: leo$#9073
Responder
#6
ese oberon de dias re bug, usa este es automatico y si no me equivoco tenia para dar ammopacks al que lo mata, pero tendras que adaptar algunas cosas vos.

https://amxmodx-es.com/showthread.php?tid=24521
Responder
#7
Yo creo recordar que removi unos task que era lo que arrojaba las habilidades, pero ese oberon "default" trae muchisimos errores, yo pase por eso cuando lo use.
[Imagen: zcsztw-4.png] [Imagen: 6u5fj2-4.png]
[Imagen: linkedin_thumb_image.png][Imagen: 76561198283253977.png][Imagen: linkedin_thumb_image.png]
Responder
#8
(28/05/2022, 09:08 PM)Nelo escribió: ese oberon de dias re bug, usa este es automatico y si no me equivoco tenia para dar ammopacks al que lo mata, pero tendras que adaptar algunas cosas vos.

https://amxmodx-es.com/showthread.php?tid=24521

Si lo vi pero no lo pude hacer funcionar como estan conectados por natives o algo asi por eso elegi este que era mas simple pero tiene varios bugs
Aporte(?
Discord: leo$#9073
Responder


Salto de foro:


Usuarios navegando en este tema: 1 invitado(s)