Raised This Month: $51 Target: $400
 12% 

[REQ] Help (PLZZZ)


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
NiceGuyx
Senior Member
Join Date: Nov 2011
Old 03-01-2012 , 11:00   [REQ] Help (PLZZZ)
Reply With Quote #1

Hello,
Please i'm using this plugin:
It's an NPC BOSS Plugin...
I want only to delete the NPC on round end:
PHP Code:
public round_end() 
I tried but it's not delete the NPC on round_end :s
Please help me i beg you!

PHP Code:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <engine>
#include <fakemeta>
#include <hamsandwich>
#include <xs>

#define OBERON_CLASSNAME "Oberon"
#define OBERON_HEALTH 60000.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 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 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]

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 /xy""get_origin")
        
register_clcmd("say /poberon""create_oberon")
        
register_clcmd("say /soberon""stop_oberon")
        
register_logevent("round_end"2"1=Round_End")
}

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")
}

public 
round_end()
{

        new 
iEnt = -1;
        
        while( ( 
iEnt find_ent_by_classiEnt"OBERON_CLASSNAME" ) ) )
        
remove_entityiEnt );
        
remove_task(iEnt+TASK_SKILL)

}

public 
event_newround()
{
    static 
ent
    ent 
find_ent_by_class(-1OBERON_CLASSNAME)
    
    if(
task_exists(ent+TASK_SKILL)) remove_task(ent+TASK_SKILL)
}

public 
stop_oberon()
{
       new 
iEnt = -1;
        
       while( ( 
iEnt find_ent_by_classiEnt"OBERON_CLASSNAME" ) ) )
       
remove_entityiEnt );
       
remove_task(iEnt+TASK_SKILL)
}

public 
get_origin(id)
{
    
pev(idpev_origing_cur_origin)
    
pev(idpev_anglesg_cur_angles)
    
pev(idpev_v_angleg_cur_v_angle)
}

public 
create_oberon(id)
{
    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_STEP)
    
    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(5.0"do_random_skill"ent__"b")
    
    if(!
g_reg)
    {
        
RegisterHamFromEntity(Ham_TakeDamageent"fw_takedmg"1)
        
RegisterHamFromEntity(Ham_Thinkent"fw_think")
        
g_reg 1
    
}    
    
    
g_evolution 0
    g_evoluting 
0
    g_doing_other 
0
    
    drop_to_floor
(ent)
    
emit_sound(entCHAN_BODYoberon_appear_sound1.0ATTN_NORM0PITCH_NORM)
}

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 1
        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 
4
                
} else {
                    
attack_anim 6
                    attack_sound 
0
                
}
                
                
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 
5
                
} else { 
                    
attack_anim 7
                    attack_sound 
1
                
}
                    
                
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 2
            
        
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 1
    
    
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 1
    
    
static bomb_anim
    
if(g_evolution)
        
bomb_anim 18
    
else
        
bomb_anim 9
        
    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 2
        
    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] = i
            
            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 
6
    
} else {
        
attack3_anim 8
        attack3_sound 
2
    
}    
    
    
g_attacking3 1
    
    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 0
        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 7
        
else
            
attack3_sound 3
        
        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 0
    g_evolution 
1
    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"Vie du Troll: %i HP."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
=i
                
                
return indexid
            
}
        }    
    }    
    return 
0
}

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 0
    entity_set_float
(entEV_FL_nextthinkget_gametime() + 0.1)

NiceGuyx is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 00:40.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode