Raised This Month: $23 Target: $400
 5% 

Help / Support [Solved] ZP Extra Item Not working on zs_nightmare2 Dr.rex


Post New Thread Closed Thread   
 
Thread Tools Display Modes
Author Message
Kakarot47
Senior Member
Join Date: May 2015
Location: Pakistan
Old 06-12-2024 , 18:56   [Solved] ZP Extra Item Not working on zs_nightmare2 Dr.rex
#1

Hey

i have a problem with CSO Boss when i play the map zp mod is totally getting of and starting normal
i want to edit this for showing zp extra items showing in this map zs_nightmare2 CSO dr.rex mod
i shall be very thankfull
Help me to bring extra item menu on this map

PHP Code:
#include <amxmodx>
#include <engine>
#include <fakemeta>
#include <fakemeta_util>
#include <hamsandwich>
#include <cstrike>
#include <gamemaster>
#include <fun>

#define PLUGIN "[CSO] Boss: Dr.Rex"
#define VERSION "1.0"
#define AUTHOR "Dias"

#define EXHERO_PLUGIN "zombie_plague40.amxx"

#define GAMESTART_TIME 20
#define MAP "zs_nightmare2"

// Boss Rex
#define REX_MODEL "models/rex/rex.mdl"
#define REX_CLASSNAME "dr.rex"

#define HEALTH_OFFSET 10000.0
#define REX_HEALTH 50000.0

#define REX_MOVESPEED 300.0
#define REX_ATTACK_RANGE 180.0

new const RexSounds[17][] = 
{
    
"rex/appear.wav",
    
"rex/attack1.wav",
    
"rex/attack2.wav",
    
"rex/dash_start.wav",
    
"rex/dash_end.wav",
    
"rex/inhale.wav",
    
"rex/shield.wav",
    
"rex/skill1_1.wav",
    
"rex/skill1_2.wav",
    
"rex/skill2.wav",
    
"rex/skill3_start.wav",
    
"rex/skill4_a_start.wav",
    
"rex/skill4_a_end.wav",
    
"rex/skill5_end.wav",
    
"rex/walk.wav",
    
"rex/death.wav",
    
"rex/death2.wav"
}

enum
{
    
REX_DUMMY 0,
    
REX_APPEAR,
    
REX_IDLE,
    
REX_RUN,
    
REX_WALK,
    
REX_ATTACK1,
    
REX_ATTACK2,
    
REX_DASH_START,
    
REX_DASH_LOOP,
    
REX_DASH_END,
    
REX_SKILL1,
    
REX_SKILL2,
    
REX_SKILL3_START,
    
REX_SKILL3_LOOP,
    
REX_SKILL3_END,
    
REX_SKILL4A_START,
    
REX_SKILL4A_LOOP,
    
REX_SKILL4A_END,
    
REX_SKILL4B_START,
    
REX_SKILL4B_LOOP,
    
REX_SKILL4B_END,    
    
REX_SKILL5_START,
    
REX_SKILL5_LOOP,
    
REX_SKILL5_END,    
    
REX_DEATH,
    
REX_DEATH2
}

enum
{
    
REX_STATE_IDLE 0,
    
REX_STATE_SEARCHING_ENEMY,
    
REX_STATE_APPEAR,
    
REX_STATE_MOVE,
    
REX_STATE_ATTACK,
    
REX_STATE_DASH,
    
REX_STATE_SKILL1,
    
REX_STATE_SKILL2,
    
REX_STATE_SKILL3,
    
REX_STATE_SKILL4A,
    
REX_STATE_SKILL4B,
    
REX_STATE_SKILL4C,
    
REX_STATE_SKILL5,
    
REX_STATE_DEATH
}

// Dr.Rex & CutScenes
#define DRREX_MODEL "models/rex/dr_rex.mdl"
#define CUTSCENE1 "models/rex/cutscene/dr_rex_cutscene1.mdl"
#define CUTSCENE2 "models/rex/cutscene/dr_rex_cutscene2.mdl"
#define CUTSCENE3 "models/rex/cutscene/dr_rex_cutscene3.mdl"
#define CUTSCENE_SOUND "rex/cutscene/scene.wav"

// DOOR
#define DOOR_HEALTH 10000
new Door

// Music
#define PREPARE "rex/game/Scenario_Ready.mp3"
#define FIGHT "rex/game/Scenario_Rush.mp3"

// Etc
#define TASK_SCENE 1111
#define TASK_COUNTDOWN 1112
#define TASK_ATTACK 1113
#define TASK_DASH 1114
#define TASK_TENTACLE 1115
#define TASK_POISON 1116
#define TASK_CYCLONE 1117
#define TASK_HARDENING 1118
#define TASK_TELEPORT 1119

new g_BossStateFloat:Time1Float:Time2Float:Time3Float:Time4
new Rexg_RegHamm_iBlood[2]
new 
DrRex1Cut1Cut2Cut3Cut4g_StopTeleport
new g_MaxPlayersg_GameStartg_MsgScreenShakeg_MsgScreenFade
new g_Countdown

// =========================== SKILL ================================
// ==================================================================
#define ATTACK_MODEL "models/rex/effect/ef_rex_attack.mdl"
#define ATTACK_TENTACLE1 "models/rex/effect/ef_tentacle_sign.mdl"
#define ATTACK_TENTACLE2 "models/rex/effect/ef_tentacle.mdl"
#define ATTACK_TENTACLE "models/rex/rex_tentacle.mdl"

#define BLAST_SMALL "models/rex/effect/ef_skill2_zavist.mdl"
#define BLAST_BIG "models/rex/effect/ef_skill4.mdl"

#define POISON_MODEL "models/rex/effect/ef_poison01.mdl"
#define POISON_MODEL2 "models/rex/effect/ef_poison02.mdl"

#define POISON_SMOKE "sprites/rex/ef_smoke_poison.spr"
#define POISON_EFFECT "sprites/rex/ef_boomer_ex.spr"

#define CYCLONE_EFFECT1 "models/rex/effect/ef_inhale.mdl"
#define CYCLONE_EFFECT2 "models/rex/effect/ef_inhale2.mdl"

#define HARDENING_SHIELD "models/rex/effect/ef_shield.mdl"

#define TENTACLE_SOUND "rex/zbs_tentacle_pierce.wav"

new g_Poison_EffectId

public plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
register_event("HLTV""Event_NewRound""a""1=0""2=0")
    
register_logevent("Event_RoundStart"2"1=Round_Start")
    
    
RegisterHam(Ham_Spawn"player""fw_PlayerSpawn_Post"1)
    
    
register_think(REX_CLASSNAME"fw_Rex_Think")
    
register_think("attack_effect""fw_Effect1_Think")
    
register_think("earthhole""fw_EarthHole_Think")
    
register_think("tentacle""fw_Tentacle_Think")
    
register_think("blast""fw_Blast_Think")
    
register_think("poisonist""fw_Poison_Think")
    
register_think("poisonist2""fw_Poison2_Think")
    
register_think("cyclone""fw_Cyclone_Think")
    
register_touch("poisonist""*""fw_Poison_Touch")
    
register_touch(REX_CLASSNAME"player""fw_Rex_Touch")
    
    
// Find
    
Find_MainDoor()
    
Initialize_Door(1)
    
    
g_MsgScreenShake get_user_msgid("ScreenShake")
    
g_MsgScreenFade get_user_msgid("ScreenFade")
    
g_MaxPlayers get_maxplayers()
    
    
register_clcmd("Skill1""Skill1"ADMIN_KICK)
    
register_clcmd("Skill2""Skill2"ADMIN_KICK)    
    
register_clcmd("Skill3""Skill3"ADMIN_KICK)
    
register_clcmd("Skill4""Skill4"ADMIN_KICK)
    
register_clcmd("Skill5""Skill5"ADMIN_KICK)
    
register_clcmd("Skill6""Skill6"ADMIN_KICK)
    
    
GM_EndRound_Block(true)
}

public 
Skill1() Rex_Dashing(Rex)
public 
Skill2() Rex_Tentacle(Rex)
public 
Skill3() Rex_Poison(Rex)
public 
Skill4() Rex_Cyclone(Rex)
public 
Skill5() Rex_Teleport(Rex)
public 
Skill6(idExecuteHamB(Ham_CS_RoundRespawnid)

public 
GM_Time()
{
    if(!
g_GameStart) return
    
    new 
Num 
    
    
for(new 0g_MaxPlayersi++)
    {
        if(!
is_user_alive(i))
            continue 
            
        
Num++
    }
    
    if(!
Numset_task(10.0"ChangeMap")
}

public 
plugin_precache()
{
    static 
MapName[64]; get_mapname(MapName63)
    
    if(!
equal(MapNameMAP))
    {
        
formatexMapName,  63"[CSO] Dr.Rex: You must play in %s"MAP )
        
set_fail_stateMapName )
        
server_cmd("amxx unpause %s"EXHERO_PLUGIN)
        
        return
    } else {
        
server_cmd("mp_timelimit 9999")
        
server_cmd("amxx pause %s"EXHERO_PLUGIN);    
    } 
    
// Boss Rex
    
precache_model(REX_MODEL)
    
    
// Dr.Rex & Cutscenes
    
precache_model(DRREX_MODEL)
    
    
precache_model(CUTSCENE1)
    
precache_model(CUTSCENE2)
    
precache_model(CUTSCENE3)
    
precache_model("models/rpgrocket.mdl");
    
    
precache_sound(CUTSCENE_SOUND)
    
    
// Skill
    
precache_model(ATTACK_MODEL)
    
precache_model(ATTACK_TENTACLE)
    
precache_model(ATTACK_TENTACLE1)
    
precache_model(ATTACK_TENTACLE2)
    
    
precache_model(POISON_MODEL)
    
precache_model(POISON_MODEL2)
    
    
g_Poison_EffectId precache_model(POISON_SMOKE)
    
precache_model(POISON_EFFECT)
    
    
precache_model(CYCLONE_EFFECT1)
    
precache_model(CYCLONE_EFFECT2)
    
    
precache_model(HARDENING_SHIELD)
    
    
precache_sound(TENTACLE_SOUND)
    
    
// Blast
    
precache_model(BLAST_SMALL)
    
precache_model(BLAST_BIG)
    
    
// Sound
    
precache_sound(PREPARE)
    
precache_sound(FIGHT)
    
    for(new 
0sizeof(RexSounds); i++)
        
precache_sound(RexSounds[i])
    
    
m_iBlood[0] = precache_model("sprites/blood.spr")
    
m_iBlood[1] = precache_model("sprites/bloodspray.spr")    
}

public 
plugin_cfg()
{
    
server_cmd("mp_freezetime 20")
    
server_cmd("mp_roundtime 10")
    
server_cmd("mp_timelimit 0")
    
    
Event_NewRound()
}

public 
Find_MainDoor()
{
    static 
Classname[32]
    
    for(new 
0entity_count(); i++)
    {
        if(!
pev_valid(i))
            continue
            
        
pev(ipev_classnameClassnamesizeof(Classname))
        if(!
equal(Classname"func_breakable"))
            continue
        
pev(ipev_targetnameClassnamesizeof(Classname))
        if(!
equal(Classname"door_brk"))
            continue
    
        
Door i
        server_print
("[CSO] Dr.Rex: Found Door (%i)"Door)
    }
}

public 
Event_NewRound()
{    
    
g_StopTeleport 0
    
    
if(pev_valid(Rex)) remove_entity(Rex)

    
remove_task(TASK_SCENE)
    
remove_task(TASK_COUNTDOWN)
    
remove_task(Rex+TASK_ATTACK)
    
remove_task(Rex+TASK_DASH)
    
remove_task(Rex+TASK_TENTACLE)
    
remove_task(Rex+TASK_POISON)
    
remove_task(Rex+TASK_CYCLONE)
    
remove_task(Rex+TASK_HARDENING)
    
    
set_task(0.1"Task_NewRound")
    
set_task(0.1"Create_DrRex")
    
    if(!
g_GameStart
    {
        
Start_Countdown()
        return
    }
    
    
PlaySound(0PREPARE)
}

public 
fw_PlayerSpawn_Post(id)
{
    if(!
is_user_alive(id)) return
    
    
cs_set_user_money(id16000)
    
set_user_health(id250)
}

public 
Event_RoundStart()
{
    if(!
g_GameStart) return
    
PlaySound(0FIGHT)
}

public 
Start_Countdown()
{
    
g_Countdown GAMESTART_TIME
    
    remove_task
(TASK_COUNTDOWN)
    
CountingDown()
}

public 
CountingDown()
{
    if(
g_GameStart)
        return

    if(
g_Countdown  <= 0)
    {
        
g_GameStart 1
        GM_TerminateRound
(1.0WINSTATUS_DRAW)
        
        return
    }
    
    
client_print(0print_center"Start Game in %i second(s)!"g_Countdown)
        
    
g_Countdown--
    
set_task(1.0"CountingDown"TASK_COUNTDOWN)
}

public 
Task_NewRound() 
{
    for(new 
0g_MaxPlayersi++)
    {
        if(!
is_user_connected(i))
            continue
            
        
attach_view(ii)
        
client_cmd(i"hud_draw 1")
    }
    
    if(
pev_valid(Cut1)) remove_entity(Cut1)
    if(
pev_valid(Cut2)) remove_entity(Cut2)
    if(
pev_valid(Cut3)) remove_entity(Cut3)
    if(
pev_valid(Cut4)) remove_entity(Cut4)
    if(
pev_valid(DrRex1)) remove_entity(DrRex1)
    
    if(
g_GameStartInitialize_Door(0)
}

public 
Initialize_Door(First)
{
    if(!
pev_valid(Door))
        return
        
    
set_pev(Doorpev_rendermodekRenderTransAdd)
    
set_pev(Doorpev_renderfxkRenderFxGlowShell)
    
set_pev(Doorpev_renderamt100.0)
    
    
set_pev(Doorpev_takedamageDAMAGE_YES)
    
set_pev(Doorpev_healthfloat(DOOR_HEALTH))
    
    if(
First
    {
        
RegisterHamFromEntity(Ham_TakeDamageDoor"fw_Door_TakeDamage")
        
RegisterHamFromEntity(Ham_TakeDamageDoor"fw_Door_TakeDamage_Post"1)
    }
}

public 
fw_Door_TakeDamage(VictimInflictorAttackerFloat:DamageDamageBits)
{
    if(!
g_GameStart) return HAM_SUPERCEDE
    
return HAM_IGNORED
}
        
public 
fw_Door_TakeDamage_Post(VictimInflictorAttackerFloat:DamageDamageBits)
{
    static 
Float:Healthpev(Victimpev_healthHealth)
    if(
Health <= 0.0
    {
        
Activate_Cutscene()
        return
    }
    
    
client_print(Attackerprint_center"Health: %i"floatround(Health))
}

public 
Create_DrRex()
{
    static 
Float:Origin[3], Float:Angles[3]
    
    
Origin[0] = 900.0
    Origin
[1] = 0.0
    Origin
[2] = 130.0
    
    Angles
[1] = 180.0
    
    
static EntEnt create_entity("info_target")
    if(!
pev_valid(Ent)) return
    
    
DrRex1 Ent
    
    set_pev
(Entpev_originOrigin)
    
set_pev(Entpev_anglesAngles)
        
    
set_pev(Entpev_classname"doctorrex")
    
engfunc(EngFunc_SetModelEntDRREX_MODEL)
    
    
set_pev(Entpev_minsFloat:{-36.0, -36.0, -66.0})
    
set_pev(Entpev_maxsFloat:{36.036.066.0})        
    
    
set_pev(Entpev_movetypeMOVETYPE_NONE)
    
set_pev(Entpev_solidSOLID_SLIDEBOX)
    
    
set_pev(Entpev_animtimeget_gametime())
    
set_pev(Entpev_framerate1.0)
    
set_pev(Entpev_sequence1)
}

public 
Activate_Cutscene()
{
    new 
Float:Origin[3], Float:Angles[3]
    
Origin[2] = 512.0
    
    
static Ent1Ent2Ent3
    
    
// Main Rex
    
Ent1 create_entity("info_target")
        
    
set_pev(Ent1pev_originOrigin)
    
    
set_pev(Ent1pev_classname"cut1")
    
engfunc(EngFunc_SetModelEnt1CUTSCENE1)
    
    
Cut1 Ent1
    
    
// Tentacle 1
    
Ent2 create_entity("info_target")
        
    
set_pev(Ent2pev_originOrigin)
    
    
set_pev(Ent1pev_classname"cut2")
    
engfunc(EngFunc_SetModelEnt2CUTSCENE2)
    
    
set_pev(Ent2pev_aimentEnt1)
    
set_pev(Ent2pev_movetypeMOVETYPE_FOLLOW)
    
set_pev(Ent2pev_solidSOLID_NOT)
    
    
Cut2 Ent2
    
    
// Tentacle 2
    
Ent3 create_entity("info_target")
        
    
set_pev(Ent3pev_originOrigin)
    
    
set_pev(Ent1pev_classname"cut3")
    
engfunc(EngFunc_SetModelEnt3CUTSCENE3)
    
    
set_pev(Ent3pev_aimentEnt1)
    
set_pev(Ent3pev_movetypeMOVETYPE_FOLLOW)
    
set_pev(Ent3pev_solidSOLID_NOT)
    
    
Cut3 Ent3
    
    
// Run Animation
    
set_pev(Ent1pev_animtimeget_gametime())
    
set_pev(Ent1pev_framerate1.0)
    
set_pev(Ent1pev_sequence0)
    
    
set_pev(Ent2pev_animtimeget_gametime())
    
set_pev(Ent2pev_framerate1.0)
    
set_pev(Ent2pev_sequence0)
    
    
set_pev(Ent3pev_animtimeget_gametime())
    
set_pev(Ent3pev_framerate1.0)
    
set_pev(Ent3pev_sequence0)
    
    
emit_sound(Ent1CHAN_BODYCUTSCENE_SOUND1.0ATTN_NORM0PITCH_NORM)
    
    
// Watching Ent
    
static WatchWatch create_entity("info_target")
    
    
Origin[0] = 100.0
    Origin
[1] = 0.0
    Origin
[2] = 610.0
    
    Angles
[1] = 180.0
    
    set_pev
(Watchpev_classname"cut4")
    
engfunc(EngFunc_SetModelWatch"models/rpgrocket.mdl")
    
    
set_pev(Watchpev_originOrigin)
    
set_pev(Watchpev_anglesAngles)
    
set_pev(Watchpev_v_angleAngles)
    
    
entity_set_int(WatchEV_INT_rendermodekRenderTransTexture);
    
entity_set_float(WatchEV_FL_renderamt0.0);
    
    
set_pev(Watchpev_solidSOLID_TRIGGER)
    
set_pev(Watchpev_movetypeMOVETYPE_FLY)
    
    
Cut4 Watch
    
    
for(new 0g_MaxPlayersi++)
    {
        if(!
is_user_connected(i))
            continue
            
        
attach_view(iWatch)
        
client_cmd(i"hud_draw 0")
    }
    
    
set_task(8.0"KickBack"TASK_SCENE)
    
set_task(9.0"End_Cutscene"TASK_SCENE)
}

public 
End_Cutscene()
{
    for(new 
0g_MaxPlayersi++)
    {
        if(!
is_user_connected(i))
            continue
            
        
attach_view(ii)
        
client_cmd(i"hud_draw 1")
    }
    
    if(
pev_valid(Cut1)) remove_entity(Cut1)
    if(
pev_valid(Cut2)) remove_entity(Cut2)
    if(
pev_valid(Cut3)) remove_entity(Cut3)
    if(
pev_valid(Cut4)) remove_entity(Cut4)
    if(
pev_valid(DrRex1)) remove_entity(DrRex1); remove_entity_name("doctorrex")
    
    
Create_BossRex()
}

public 
KickBack()
{
    static 
Float:Origin[3]
    
Origin[0] = 0.0
    Origin
[1] = 0.0
    Origin
[2] = 200.0

    Check_Knockback
(Origin0)
}

public 
Get(id)
{
    
/*
    static Float:Origin[3], Float:EntOrigin[3], Float:EntOrigin2[3]
    
    pev(id, pev_origin, Origin)
    //pev(Ent, pev_origin, EntOrigin2)
    get_position(Rex, 500.0, 0.0, 0.0, EntOrigin)
        
    client_print(id, print_chat, "%f", get_distance_f(Origin, EntOrigin))*/
}

public 
Create_BossRex()
{
    
Make()
}

public 
Make()
{
    if(
pev_valid(Rex)) engfunc(EngFunc_RemoveEntityRex)
    
    static 
Rex1Rex1 engfunc(EngFunc_CreateNamedEntityengfunc(EngFunc_AllocString"info_target"))
    if(!
pev_valid(Rex1)) return
    
    
Rex Rex1
    
    
// Set Origin & Angles
    
set_pev(Rexpev_origin, {0.00.0200.0})
    
    static 
Float:Angles[3]
    
Angles[1] = 180.0
    set_pev
(Rexpev_anglesAngles)
    
    
// Set Config
    
set_pev(Rexpev_classnameREX_CLASSNAME)
    
engfunc(EngFunc_SetModelRexREX_MODEL)
    
set_pev(Rexpev_modelindexengfunc(EngFunc_ModelIndexREX_MODEL))
        
    
set_pev(Rexpev_gamestate1)
    
set_pev(Rexpev_solidSOLID_SLIDEBOX)
    
set_pev(Rexpev_movetypeMOVETYPE_PUSHSTEP)
    
    
// Set Size
    
new Float:maxs[3] = {70.070.0140.0}
    new 
Float:mins[3] = {-70.0, -70.016.0}
    
engfunc(EngFunc_SetSizeRexminsmaxs)
    
    
// Set Life
    
set_pev(Rexpev_takedamageDAMAGE_YES)
    
set_pev(Rexpev_healthHEALTH_OFFSET REX_HEALTH)
    
    
// Set Config 2
    
Set_EntAnim(RexREX_APPEAR1.01)
    
g_BossState REX_STATE_APPEAR
    
    
//set_task(2.0, "Set_StartScene", MM+312)
    
set_pev(Rexpev_nextthinkget_gametime() + 1.0)
    
engfunc(EngFunc_DropToFloorRex)
    
    if(!
g_RegHam)
    {
        
g_RegHam 1
        RegisterHamFromEntity
(Ham_TraceAttackRex"fw_Rex_TraceAttack")
    }
    
    
engfunc(EngFunc_DropToFloorRex)
}

public 
fw_Rex_Think(ent)
{
    if(!
pev_valid(ent))
        return
    if(
g_BossState == REX_STATE_DEATH)
        return
    if((
pev(entpev_health) - HEALTH_OFFSET) <= 0.0)
    {
        
Rex_Death(ent)
        return
    }
    
    
// Set Next Think
    
set_pev(entpev_nextthinkget_gametime() + 0.01)
    
    if(
get_gametime() - Time4 Time3)
    {
        static 
RandomNumRandomNum random_num(04)
    
        switch(
RandomNum)
        {
            case 
0Rex_Dashing(Rex)
            case 
1Rex_Tentacle(Rex)
            case 
2Rex_Poison(Rex)
            case 
3Rex_Cyclone(Rex)
            case 
4Rex_Teleport(Rex)
            default: 
Rex_Dashing(Rex)
        }

        
Time4 random_float(5.015.0)
        
Time3 get_gametime()
    }
    
    switch(
g_BossState)
    {
        case 
REX_STATE_APPEAR:
        {
            
g_BossState REX_STATE_IDLE
            
            Make_PlayerShake
(0)
            static 
Float:Origin[3]; pev(entpev_originOrigin)
            
CreateBlast(1Origin)
            
            
set_pev(entpev_nextthinkget_gametime() + 3.5)
        }
        case 
REX_STATE_IDLE:
        {
            if(
get_gametime() - 5.0 Time1)
            {
                
Set_EntAnim(entREX_IDLE2.01)
                
Time1 get_gametime()
            }
            if(
get_gametime() - 1.0 Time2)
            {
                
g_BossState REX_STATE_SEARCHING_ENEMY
                Time2 
get_gametime()
            }
        }
        case 
REX_STATE_SEARCHING_ENEMY:
        {
            static 
VictimVictim FindClosetEnemy(ent1)
            
            if(
is_user_alive(Victim))
            {
                
set_pev(entpev_enemyVictim)
                
g_BossState REX_STATE_MOVE
            
} else {
                
set_pev(entpev_enemy0)
                
g_BossState REX_STATE_IDLE
            
}
        }
        case 
REX_STATE_MOVE:
        {
            static 
EnemyEnemy pev(entpev_enemy)
            static 
Float:EnemyOrigin[3]
            
pev(Enemypev_originEnemyOrigin)
            
            if(
is_user_alive(Enemy))
            {
                if(
entity_range(Enemyent) <= floatround(REX_ATTACK_RANGE))
                {
                    
g_BossState REX_STATE_ATTACK
                    
                    Aim_To
(entEnemyOrigin2.01
                    
                    if(
random_num(01) == 1Rex_StartAttack11(ent+TASK_ATTACK)
                    else 
Rex_StartAttack12(ent+TASK_ATTACK)
                } else {
                    if(
pev(entpev_movetype) == MOVETYPE_PUSHSTEP)
                    {
                        static 
Float:OriginAhead[3]
                        
get_position(ent300.00.00.0OriginAhead)
                        
                        
Aim_To(entEnemyOrigin1.01
                        
hook_ent2(entOriginAheadREX_MOVESPEED)
                        
                        
Set_EntAnim(entREX_RUN1.00)
                    } else {
                        
set_pev(entpev_movetypeMOVETYPE_PUSHSTEP)
                    }
                }
            } else {
                
g_BossState REX_STATE_SEARCHING_ENEMY
            
}
        }
        case 
REX_STATE_SKILL4A:
        {
            static 
EnemyEnemy pev(entpev_enemy)
            static 
Float:EnemyOrigin[3]
            
pev(Enemypev_originEnemyOrigin)
            
            if(
is_user_alive(Enemy))
            {
                
Aim_To(entEnemyOrigin2.00
            }
        }
        case 
REX_STATE_SKILL4B:
        {
            static 
VictimVictim pev(entpev_enemy)
            static 
Float:EnemyOrigin[3]
            
pev(Victimpev_originEnemyOrigin)
    
            if(
is_user_alive(Victim))
            {
                if(
entity_range(entVictim) < 175.0)
                {
                    
TeleportAttack(entVictim)
                } else {
                    
Set_EntAnim(entREX_SKILL4A_LOOP1.00)
                    
                    
Aim_To(entEnemyOrigin2.00
                    
                    static 
Float:Origin[3]; pev(Victimpev_originOrigin)
                    
hook_ent2(entOrigin1000.0)
                }
            } else {
                
Victim FindClosetEnemy(ent1)
                if(
is_user_alive(Victim))
                {
                    
Set_EntAnim(entREX_SKILL4A_LOOP1.00)
                    
                    
set_pev(entpev_enemyVictim)
                } else {
                    
set_pev(entpev_enemy0)
                    
Rex_StopTeleport(ent+TASK_TELEPORT)
                }
            }
        }    
    }    
}

public 
Rex_Death(Ent)
{
    if(!
pev_valid(Ent))
        return
    
    
g_BossState REX_STATE_DEATH

    set_pev
(Entpev_solidSOLID_NOT)
    
set_pev(Entpev_movetypeMOVETYPE_NONE)
    
    
set_task(0.1"Rex_Death2"Ent)
}

public 
Rex_Death2(Ent)
{
    
Set_EntAnim(EntREX_DEATH1.01)
    
set_task(8.0"Set_Death"Ent+TASK_SCENE)
}

public 
Set_Death(Ent)
{
    
Ent -= TASK_SCENE
    
if(!pev_valid(Ent))
        return
    
    
Set_EntAnim(EntREX_DEATH21.01)
    
    
set_task(10.0"ChangeMap")
}

public 
ChangeMap()
{
    
server_cmd("mp_timelimit 1")
}

public 
Rex_StartAttack11(ent)
{
    
ent -= TASK_ATTACK
    
if(!pev_valid(ent))
        return

    
set_pev(entpev_movetypeMOVETYPE_NONE)
    
set_pev(entpev_velocity, {0.00.00.0})    

    
set_task(0.1"Rex_StartAttack112"ent+TASK_ATTACK)
}

public 
Rex_StartAttack12(ent)
{
    
ent -= TASK_ATTACK
    
if(!pev_valid(ent))
        return
        
    
set_pev(entpev_movetypeMOVETYPE_NONE)
    
set_pev(entpev_velocity, {0.00.00.0})    

    
set_task(0.1"Rex_StartAttack122"ent+TASK_ATTACK)    
}

public 
Rex_StartAttack112(ent)
{
    
ent -= TASK_ATTACK
    
if(!pev_valid(ent))
        return

    
Set_EntAnim(entREX_ATTACK11.01)
    
    
set_task(0.5"Effect_Attack1"ent+TASK_ATTACK)
    
set_task(1.75"Done_Attack"ent+TASK_ATTACK)    
}

public 
Rex_StartAttack122(ent)
{
    
ent -= TASK_ATTACK
    
if(!pev_valid(ent))
        return

    
Set_EntAnim(entREX_ATTACK21.01)
    
    
set_task(0.5"Effect_Attack2"ent+TASK_ATTACK)
    
set_task(1.75"Done_Attack"ent+TASK_ATTACK)    
}

public 
Effect_Attack1(ent)
{
    
ent -= TASK_ATTACK
    
if(!pev_valid(ent))
        return
        
    static 
EntEnt engfunc(EngFunc_CreateNamedEntityengfunc(EngFunc_AllocString"info_target"))
    if(!
pev_valid(Ent)) return
        
    static 
Float:Vector[3]
    
    
pev(entpev_originVector); set_pev(Entpev_originVector)
    
pev(entpev_anglesVector); set_pev(Entpev_anglesVector)
    
    
// Set Config
    
set_pev(Entpev_classname"attack_effect")
    
engfunc(EngFunc_SetModelEntATTACK_MODEL)
        
    
set_pev(Entpev_movetypeMOVETYPE_FOLLOW)
    
set_pev(Entpev_aimentent)
    
    
// Set Size
    
new Float:maxs[3] = {1.01.01.0}
    new 
Float:mins[3] = {-1.0, -1.0, -1.0}
    
engfunc(EngFunc_SetSizeEntminsmaxs)
    
    
Set_EntAnim(Ent01.01)

    
Check_AttackDamge(Ent)
    
set_pev(Entpev_nextthinkget_gametime() + 1.0)
}

public 
Effect_Attack2(ent)
{
    
ent -= TASK_ATTACK
    
if(!pev_valid(ent))
        return
        
    static 
EntEnt engfunc(EngFunc_CreateNamedEntityengfunc(EngFunc_AllocString"info_target"))
    if(!
pev_valid(Ent)) return
        
    static 
Float:Vector[3]
    
    
pev(entpev_originVector); set_pev(Entpev_originVector)
    
pev(entpev_anglesVector); set_pev(Entpev_anglesVector)
    
    
// Set Config
    
set_pev(Entpev_classname"attack_effect")
    
engfunc(EngFunc_SetModelEntATTACK_MODEL)
        
    
set_pev(Entpev_movetypeMOVETYPE_FOLLOW)
    
set_pev(Entpev_aimentent)
    
    
// Set Size
    
new Float:maxs[3] = {1.01.01.0}
    new 
Float:mins[3] = {-1.0, -1.0, -1.0}
    
engfunc(EngFunc_SetSizeEntminsmaxs)
    
    
Set_EntAnim(Ent11.01)    
    
    
Check_AttackDamge(Ent)
    
set_pev(Entpev_nextthinkget_gametime() + 1.0)
}

public 
Check_AttackDamge(Ent)
{
    static 
Float:Origin[3]; get_position(Ent250.00.00.0Origin)
    static 
Float:POrigin[3]
    
    for(new 
0g_MaxPlayersi++)
    {
        if(!
is_user_alive(i))
            continue
            
        
pev(ipev_originPOrigin)
        if(
get_distance_f(OriginPOrigin) > 250.0)
            continue
            
        
ExecuteHamB(Ham_TakeDamagei0irandom_float(5.020.0), DMG_BLAST)
        
Make_PlayerShake(i)
    }
}

public 
fw_Effect1_Think(Ent)
{
    if(!
pev_valid(Ent))
        return
    
    
set_pev(Entpev_flagsFL_KILLME)
}

public 
Done_Attack(ent)
{
    
ent -= TASK_ATTACK
    
if(!pev_valid(ent))
        return
        
    
set_pev(entpev_movetypeMOVETYPE_PUSHSTEP)        
    
g_BossState REX_STATE_MOVE
}

public 
fw_Rex_TraceAttack(EntAttackerFloat:DamageFloat:Dir[3], ptrDamageType)
{
    if(!
is_valid_ent(Ent)) 
        return 
HAM_IGNORED
    
if(g_BossState == REX_STATE_SKILL5)
        return 
HAM_SUPERCEDE
     
    
static Classname[32]
    
pev(Entpev_classnameClassnamecharsmax(Classname)) 
         
    if(!
equal(ClassnameREX_CLASSNAME)) 
        return 
HAM_IGNORED
         
    
static Float:EndPos[3
    
get_tr2(ptrTR_vecEndPosEndPos)

    
create_blood(EndPos)
    if(
is_user_alive(Attacker)) client_print(Attackerprint_center"Health: %i"floatround(pev(Entpev_health) - HEALTH_OFFSET))

    return 
HAM_IGNORED
}

public 
Skill(id)
{
    
Rex_Teleport(Rex)
}

// ================= DASH ========================
public Rex_Dashing(Ent)
{
    if(!
pev_valid(Ent)) return
    
    if(
g_BossState == REX_STATE_IDLE || g_BossState == REX_STATE_MOVE)
    {
        
g_BossState REX_STATE_DASH
        
//set_pev(Ent, pev_movetype, MOVETYPE_NONE)
        
        
set_task(0.1"Rex_DashStart"Ent+TASK_DASH)    
    }
}

public 
Rex_DashStart(ent)
{
    
ent -= TASK_DASH
    
if(!pev_valid(ent))
        return    

    
Set_EntAnim(entREX_DASH_START1.01)
    
    
//set_pev(ent, pev_movetype, MOVETYPE_PUSHSTEP)
    
set_task(1.0"Rex_SDashing"ent+TASK_DASH)
    
set_task(1.0"DashingHandle"ent+TASK_DASH)
}

public 
Rex_SDashing(ent)
{
    
ent -= TASK_DASH
    
if(!pev_valid(ent))
        return    
        
    
Set_EntAnim(entREX_DASH_LOOP1.01)
    
    
set_task(2.0"Rex_Stop_Dashing"ent+TASK_DASH)
}

public 
DashingHandle(Ent)
{
    
Ent -= TASK_DASH
    
if(!pev_valid(Ent))
        return    
        
    static 
Float:OriginAhead[3]
    
get_position(Ent300.00.00.0OriginAhead)
    
    
hook_ent2(EntOriginAhead5000.0)
    
    
set_task(0.01"DashingHandle"Ent+TASK_DASH)
}

public 
Rex_Stop_Dashing(ent)
{
    
ent -= TASK_DASH
    
if(!pev_valid(ent))
        return    
    
    
remove_task(ent+TASK_DASH)
    
    
Set_EntAnim(entREX_DASH_END1.01)
    
set_task(1.0"Rex_End_Dashing"ent+TASK_DASH)
}

public 
Rex_End_Dashing(ent)
{
    
ent -= TASK_DASH
    
if(!pev_valid(ent))
        return    
        
    
set_pev(entpev_movetypeMOVETYPE_PUSHSTEP)        
    
g_BossState REX_STATE_SEARCHING_ENEMY
    
    set_pev
(entpev_nextthinkget_gametime() + 0.1)
}

// ==================== Tentacle 
public Rex_Tentacle(Ent)
{
    if(!
pev_valid(Ent)) return
    
    if(
g_BossState == REX_STATE_IDLE || g_BossState == REX_STATE_MOVE)
    {
        
g_BossState REX_STATE_SKILL1
        set_pev
(Entpev_movetypeMOVETYPE_NONE)
        
        
set_task(0.1"Rex_TentacleStart"Ent+TASK_TENTACLE)    
    }
}

public 
Rex_TentacleStart(Ent)
{
    
Ent -= TASK_TENTACLE
    
if(!pev_valid(Ent))
        return    
        
    
Set_EntAnim(EntREX_SKILL11.01)
    
    
set_task(3.75"Rex_TentacleEffect"Ent+TASK_TENTACLE)
    
set_task(4.0"Rex_TentacleActive"Ent+TASK_TENTACLE)
    
set_task(6.25"Rex_TentacleEnd"Ent+TASK_TENTACLE)
}

public 
Rex_TentacleEnd(Ent)
{
    
Ent -= TASK_TENTACLE
    
if(!pev_valid(Ent))
        return    
        
    
set_pev(Entpev_movetypeMOVETYPE_PUSHSTEP)        
    
g_BossState REX_STATE_SEARCHING_ENEMY
    
    set_pev
(Entpev_nextthinkget_gametime() + 0.1)
}

public 
Rex_TentacleEffect(Ent)
{
    
Ent -= TASK_TENTACLE
    
if(!pev_valid(Ent))
        return    
        
    static 
Float:Origin[3]
    
get_position(Ent120.0, -40.00.0Origin)
    
    
CreateBlast(0Origin)
    
Make_PlayerShake(0)
}

public 
Rex_TentacleActive(Ent)
{
    
Ent -= TASK_TENTACLE
    
if(!pev_valid(Ent))
        return    
        
    static 
Float:RanOrigin[16][3]
    
    for(new 
016i++)
    {
        
RanOrigin[i][0] = random_float(-700.0700.0)
        
RanOrigin[i][1] = random_float(-700.0700.0)
        
RanOrigin[i][2] = 97.5
        
        Create_Tentacle
(EntRanOrigin[i])
    }
}

public 
Create_Tentacle(BossFloat:Origin[3])
{
    static 
EarthHoleEarthHole engfunc(EngFunc_CreateNamedEntityengfunc(EngFunc_AllocString"env_sprite"))
    if(!
pev_valid(EarthHole)) return
        
    
engfunc(EngFunc_SetOriginEarthHoleOrigin)
        
    
// Set Config
    
set_pev(EarthHolepev_gamestate1)
    
set_pev(EarthHolepev_classname"earthhole")
    
engfunc(EngFunc_SetModelEarthHoleATTACK_TENTACLE1)
    
set_pev(EarthHolepev_solidSOLID_NOT)
    
set_pev(EarthHolepev_movetypeMOVETYPE_NONE)
    
    
// Set Size
    
new Float:maxs[3] = {0.00.00.0}
    new 
Float:mins[3] = {0.00.00.0}
    
entity_set_size(EarthHoleminsmaxs)
    
    
set_pev(EarthHolepev_iuser10)

    
fm_set_rendering(EarthHolekRenderFxNone000kRenderTransAdd100)
    
    
Set_EntAnim(EarthHole01.01)
    
set_pev(EarthHolepev_nextthinkget_gametime() + random_float(0.52.5))
}

public 
fw_EarthHole_Think(Ent)
{
    if(!
pev_valid(Ent))
        return
    if(
pev(Entpev_iuser1))
    {
        
set_pev(Entpev_flagsFL_KILLME)
        return
    }
    
    static 
Float:Origin[3]; pev(Entpev_originOrigin)
    
    
Create_Tentacle2(Origin)
    
engfunc(EngFunc_SetModelEntATTACK_TENTACLE2)
    
    
set_pev(Entpev_iuser11)
    
set_pev(Entpev_nextthinkget_gametime() + random_float(2.05.0))
}

public 
Create_Tentacle2(Float:Origin[3])
{
    static 
TentacleTentacle engfunc(EngFunc_CreateNamedEntityengfunc(EngFunc_AllocString"info_target"))
    if(!
pev_valid(Tentacle)) return
        
    
engfunc(EngFunc_SetOriginTentacleOrigin)
        
    
// Set Config
    
set_pev(Tentaclepev_gamestate1)
    
set_pev(Tentaclepev_classname"tentacle")
    
engfunc(EngFunc_SetModelTentacleATTACK_TENTACLE)
    
set_pev(Tentaclepev_solidSOLID_NOT)
    
set_pev(Tentaclepev_movetypeMOVETYPE_NONE)
    
    
// Set Size
    
new Float:maxs[3] = {0.00.00.0}
    new 
Float:mins[3] = {0.00.00.0}
    
entity_set_size(Tentacleminsmaxs)
    
Set_EntAnim(Tentacle11.01)
    
    static 
Float:POrigin[3]
    for(new 
0g_MaxPlayersi++)
    {
        if(!
is_user_alive(i))
            continue
        
        
pev(ipev_originPOrigin)
        
        if(
get_distance_f(POriginOrigin) < 250.0)
            
Make_PlayerShake(i)
        
        if(
get_distance_f(POriginOrigin) < 60.0)
        {
            
ExecuteHamB(Ham_TakeDamagei0irandom_float(35.050.0), DMG_BLAST)
            
            static 
Float:Velocity[3]
            
Velocity[0] = random_float(0.0200.0)
            
Velocity[1] = random_float(0.0200.0)
            
Velocity[2] = random_float(600.0900.0)
            
set_pev(ipev_velocityVelocity)
        }
    }
    
    
emit_sound(TentacleCHAN_BODYTENTACLE_SOUND1.0ATTN_NORM0PITCH_NORM)
    
set_pev(Tentaclepev_nextthinkget_gametime() + 1.0)
}

public 
fw_Tentacle_Think(Ent)
{
    if(!
pev_valid(Ent))
        return
    
    
set_pev(Entpev_flagsFL_KILLME)
}

// ==================== POISON
public Rex_Poison(Ent)
{
    if(!
pev_valid(Ent)) return
    
    if(
g_BossState == REX_STATE_IDLE || g_BossState == REX_STATE_MOVE)
    {
        
g_BossState REX_STATE_SKILL2
        set_pev
(Entpev_movetypeMOVETYPE_NONE)
        
        
set_task(0.1"Rex_PoisonStart"Ent+TASK_POISON)    
    }
}

public 
Rex_PoisonStart(Ent)
{
    
Ent -= TASK_POISON
    
if(!pev_valid(Ent))
        return    
        
    
Set_EntAnim(EntREX_SKILL21.01)
    
    
set_task(2.75"Rex_PoisonActive"Ent+TASK_POISON)
    
set_task(4.5"Rex_PoisonEnd"Ent+TASK_POISON)
}

public 
Rex_PoisonEnd(Ent)
{
    
Ent -= TASK_POISON
    
if(!pev_valid(Ent))
        return    
        
    
set_pev(Entpev_movetypeMOVETYPE_PUSHSTEP)        
    
g_BossState REX_STATE_SEARCHING_ENEMY
    
    set_pev
(Entpev_nextthinkget_gametime() + 0.1)    
}

public 
Rex_PoisonActive(Ent)
{
    
Ent -= TASK_POISON
    
if(!pev_valid(Ent))
        return    
        
    static 
Float:StartOrigin[12][3], Float:TargetOrigin[12][3]
    
    
get_position(Ent180.060.080.0StartOrigin[0]); get_position(Ent180.0 3.060.0 3.020.0TargetOrigin[0])
    
get_position(Ent180.040.080.0StartOrigin[1]); get_position(Ent180.0 3.040.0 3.010.0TargetOrigin[1])
    
get_position(Ent180.020.080.0StartOrigin[2]); get_position(Ent180.0 3.020.0 3.020.0TargetOrigin[2])
    
get_position(Ent180.0, -20.080.0StartOrigin[3]); get_position(Ent180.0 3.0, -20.0 3.010.0TargetOrigin[3])
    
get_position(Ent180.0, -40.080.0StartOrigin[4]); get_position(Ent180.0 3.0, -40.0 3.020.0TargetOrigin[4])
    
get_position(Ent180.0, -60.080.0StartOrigin[5]); get_position(Ent180.0 3.0, -60.0 3.010.0TargetOrigin[5])    
    
    
get_position(Ent200.090.0100.0StartOrigin[6]); get_position(Ent200.0 4.090.0 3.040.0TargetOrigin[6])
    
get_position(Ent200.060.0100.0StartOrigin[7]); get_position(Ent200.0 4.060.0 3.030.0TargetOrigin[7])
    
get_position(Ent200.030.0100.0StartOrigin[8]); get_position(Ent200.0 4.030.0 3.040.0TargetOrigin[8])
    
get_position(Ent200.0, -30.0100.0StartOrigin[9]); get_position(Ent200.0 4.0, -30.0 3.030.0TargetOrigin[9])
    
get_position(Ent200.0, -60.0100.0StartOrigin[10]); get_position(Ent200.0 4.0, -60.0 3.040.0TargetOrigin[10])
    
get_position(Ent200.0, -90.0100.0StartOrigin[11]); get_position(Ent200.0 4.0, -90.0 3.030.0TargetOrigin[11])    
    
    for(new 
012i++)
        
CreatePoison(EntStartOrigin[i], TargetOrigin[i])
}

public 
CreatePoison(EntFloat:Origin[3], Float:Target[3])
{
    static 
PoisonPoison engfunc(EngFunc_CreateNamedEntityengfunc(EngFunc_AllocString"env_sprite"))
    if(!
pev_valid(Poison)) return
        
    static 
Float:Vector[3]; pev(Entpev_anglesVector)
        
    
engfunc(EngFunc_SetOriginPoisonOrigin)
    
set_pev(Poisonpev_anglesVector)
        
    
// Set Config
    
set_pev(Poisonpev_gamestate1)
    
set_pev(Poisonpev_classname"poisonist")
    
    
engfunc(EngFunc_SetModelPoisonPOISON_MODEL)
    
    
set_pev(Poisonpev_solidSOLID_TRIGGER)
    
set_pev(Poisonpev_movetypeMOVETYPE_FLY)
    
    
// Set Size
    
new Float:maxs[3] = {5.05.05.0}
    new 
Float:mins[3] = {-5.0, -5.0, -5.0}
    
entity_set_size(Poisonminsmaxs)

    
fm_set_rendering(PoisonkRenderFxNone000kRenderTransAdd250)
    
set_pev(Poisonpev_nextthinkget_gametime() + 0.75)
    
    
// Target
    
hook_ent2(PoisonTarget5000.0)
    
Aim_To(PoisonTarget0.00)
    
    
set_pev(Poisonpev_nextthinkget_gametime() + random_float(2.03.0))
}

public 
fw_Poison_Think(Ent)
{
    if(!
pev_valid(Ent))
        return
        
    
set_pev(Entpev_flagsFL_KILLME)
}

public 
fw_Poison_Touch(EntId)
{
    if(!
pev_valid(Ent))
        return
        
    
set_pev(Entpev_solidSOLID_NOT)
    
set_pev(Entpev_movetypeMOVETYPE_NONE)
    
    
engfunc(EngFunc_SetModelEntPOISON_MODEL2)
    
    
set_pev(Entpev_angles, {0.00.00.0})
    
engfunc(EngFunc_DropToFloorEnt)
    
    static 
Float:Origin[3]; pev(Entpev_originOrigin)
    
Create_PoisonEffect(Origin)
}

public 
Create_PoisonEffect(Float:Origin[3])
{
    
message_begin(MSG_BROADCAST ,SVC_TEMPENTITY)
    
write_byte(TE_EXPLOSION)
    
engfunc(EngFunc_WriteCoordOrigin[0])
    
engfunc(EngFunc_WriteCoordOrigin[1])
    
engfunc(EngFunc_WriteCoordOrigin[2] - 10.0)
    
write_short(g_Poison_EffectId)    // sprite index
    
write_byte(20)    // scale in 0.1's
    
write_byte(3)    // framerate
    
write_byte(TE_EXPLFLAG_NODLIGHTS TE_EXPLFLAG_NOSOUND TE_EXPLFLAG_NOPARTICLES)
    
message_end()
    
    
Create_PoisonEffect2(Origin)
    
Check_DamagePoison(Origin)
}

public 
Create_PoisonEffect2(Float:Origin[3])
{
    static 
PoisonPoison engfunc(EngFunc_CreateNamedEntityengfunc(EngFunc_AllocString"env_sprite"))
    
    
set_pev(Poisonpev_originOrigin)
    
    
set_pev(Poisonpev_movetypeMOVETYPE_NONE)
    
set_pev(Poisonpev_rendermodekRenderTransAdd)
    
set_pev(Poisonpev_renderamt100.0)
    
set_pev(Poisonpev_scale0.1)
    
set_pev(Poisonpev_nextthinkget_gametime() + 0.05)
    
set_pev(Poisonpev_fuser1get_gametime() + 3.0)
    
    
set_pev(Poisonpev_classname"poisonist2")
    
engfunc(EngFunc_SetModelPoisonPOISON_EFFECT)
    
set_pev(Poisonpev_minsFloat:{-5.0, -5.0, -10.0})
    
set_pev(Poisonpev_maxsFloat:{5.05.010.0})

    
set_pev(Poisonpev_gravity1.0)
    
set_pev(Poisonpev_solidSOLID_TRIGGER)    
}

public 
Check_DamagePoison(Float:Origin[3])
{
    static 
Float:POrigin[3]
    for(new 
0g_MaxPlayersi++)
    {
        if(!
is_user_alive(i))
            continue
        
        
pev(ipev_originPOrigin)
        if(
get_distance_f(OriginPOrigin) > 120.0)
            continue
            
        
Make_PlayerShake(i)
        
ExecuteHamB(Ham_TakeDamagei0irandom_float(40.060.0), DMG_BLAST)
    }
}

public 
fw_Poison2_Think(iEnt)
{
    if(!
pev_valid(iEnt)) 
        return
    
    static 
Float:fScale
    pev
(iEntpev_scalefScale)

    
fScale += 0.05
    fScale 
floatmin(fScale2.0)

    
set_pev(iEntpev_scalefScale)
    
set_pev(iEntpev_nextthinkget_gametime() + 0.1)
    
    
// time remove
    
static Float:fTimeRemove
    pev
(iEntpev_fuser1fTimeRemove)
    if (
get_gametime() >= fTimeRemove)
    {
        static 
Float:fAmtpev(iEntpev_renderamtfAmt)
        
        if(
fAmt <= 0.0)
        {
            
set_pev(iEntpev_flagsFL_KILLME)
            return
        } else {
            
fAmt -= 10.0
            set_pev
(iEntpev_renderamtfAmt)
        }
    }    
}

// ====================== CYCLONE
public Rex_Cyclone(Ent)
{
    if(!
pev_valid(Ent)) return
    
    if(
g_BossState == REX_STATE_IDLE || g_BossState == REX_STATE_MOVE)
    {
        
g_BossState REX_STATE_SKILL3
        set_pev
(Entpev_movetypeMOVETYPE_NONE)
        
        
set_task(0.1"Rex_CycloneStart"Ent+TASK_CYCLONE)    
    }
}

public 
Rex_CycloneStart(ent)
{
    
ent -= TASK_CYCLONE
    
if(!pev_valid(ent))
        return    

    
Set_EntAnim(entREX_SKILL3_START1.01)
    
    
set_task(1.5"Rex_SCyclone"ent+TASK_CYCLONE)
}

public 
Rex_SCyclone(ent)
{
    
ent -= TASK_CYCLONE
    
if(!pev_valid(ent))
        return    
        
    
Set_EntAnim(entREX_SKILL3_LOOP1.01)
    
EmitSound(entCHAN_BODYRexSounds[5])
    
    
set_task(0.1"Rex_CycloneGet"ent+TASK_CYCLONE__"b")
    
set_task(5.0"Rex_Stop_Cyclone"ent+TASK_CYCLONE)
    
    
Create_CycloneEffect(ent)
}

public 
Rex_CycloneGet(Ent)
{
    
Ent -= TASK_CYCLONE
    
if(!pev_valid(Ent))
        return    
        
    static 
Float:Origin[3], Float:EntOrigin[3], Float:EntOrigin2[3]
    
    
pev(Entpev_originEntOrigin2)
    
get_position(Ent500.00.00.0EntOrigin)
        
    for(new 
0g_MaxPlayersi++)
    {
        if(!
is_user_alive(i))
            continue
            
        
pev(ipev_originOrigin)
        
        if(
get_distance_f(OriginEntOrigin2) <= 150.0)
        {
            
user_kill(i)
            continue
        }
        
        if(
get_distance_f(OriginEntOrigin) > 650.0)
            continue
        
/*
        if(get_distance_f(Origin, EntOrigin) <= 200.0)
        {
            Make_PlayerShake(i)
            hook_ent2(i, EntOrigin2, 500.0)
            continue
        }*/

        
Make_PlayerShake(i)
        
hook_ent2(iEntOrigin2500.0)
    }
}

public 
Rex_Stop_Cyclone(ent)
{
    
ent -= TASK_CYCLONE
    
if(!pev_valid(ent))
        return    
    
    
remove_task(ent+TASK_CYCLONE)
    
    static 
Float:Percent
    Percent 
= ((pev(entpev_health) - HEALTH_OFFSET) / REX_HEALTH) * 100.0

    
if(Percent >= 70.0)
    {
        
Set_EntAnim(entREX_SKILL3_END1.01)
        
set_task(1.0"Rex_End_Cyclone"ent+TASK_CYCLONE)
    } else {
        switch(
random_num(0100))
        {
            case 
0..50
            {
                
Rex_Hardening(ent)
            } 
            case 
51..100:
            {
                
Set_EntAnim(entREX_SKILL3_END1.01)
                
set_task(1.0"Rex_End_Cyclone"ent+TASK_CYCLONE)
            }
        }
    }
}

public 
Rex_End_Cyclone(ent)
{
    
ent -= TASK_CYCLONE
    
if(!pev_valid(ent))
        return    
        
    
set_pev(entpev_movetypeMOVETYPE_PUSHSTEP)        
    
g_BossState REX_STATE_SEARCHING_ENEMY
    
    set_pev
(entpev_nextthinkget_gametime() + 0.1)
}

public 
Create_CycloneEffect(Boss)
{
    static 
EntEnt engfunc(EngFunc_CreateNamedEntityengfunc(EngFunc_AllocString"info_target"))
    if(!
pev_valid(Ent)) return
        
    static 
Float:Vector[3]
    
    
pev(Bosspev_originVector); 
    
Vector[2] += 36.0
    set_pev
(Entpev_originVector)
    
pev(Bosspev_anglesVector); set_pev(Entpev_anglesVector)
    
    
// Set Config
    
set_pev(Entpev_classname"cyclone")
    
engfunc(EngFunc_SetModelEntCYCLONE_EFFECT1)
        
    
set_pev(Entpev_movetypeMOVETYPE_FOLLOW)
//    set_pev(Ent, pev_aiment, Boss)
    
    //set_pev(Ent, pev_rendermode, kRenderTransAdd)
    //set_pev(Ent, pev_renderamt, 250.0)    
    
    // Set Size
    
new Float:maxs[3] = {1.01.01.0}
    new 
Float:mins[3] = {-1.0, -1.0, -1.0}
    
engfunc(EngFunc_SetSizeEntminsmaxs)
    
    
Set_EntAnim(Ent01.01)
    
set_pev(Entpev_nextthinkget_gametime() + 5.0)
    
    
// Effect 2
    
static Ent2Ent2 engfunc(EngFunc_CreateNamedEntityengfunc(EngFunc_AllocString"info_target"))
    if(!
pev_valid(Ent2)) return
        
    
pev(Bosspev_originVector); 
    
    
Vector[2] += 36.0
    set_pev
(Ent2pev_originVector)
    
pev(Bosspev_anglesVector); set_pev(Ent2pev_anglesVector)
    
    
// Set Config
    
set_pev(Ent2pev_classname"cyclone")
    
engfunc(EngFunc_SetModelEnt2CYCLONE_EFFECT2)
        
    
set_pev(Ent2pev_movetypeMOVETYPE_FOLLOW)
    
//set_pev(Ent2, pev_aiment, Boss)
    
    //set_pev(Ent2, pev_rendermode, kRenderTransAdd)
    //set_pev(Ent2, pev_renderamt, 250.0)        
    
    // Set Size
    
engfunc(EngFunc_SetSizeEnt2minsmaxs)
    
    
Set_EntAnim(Ent201.01)
    
set_pev(Ent2pev_nextthinkget_gametime() + 5.0)
}

public 
fw_Cyclone_Think(Ent)
{
    if(!
pev_valid(Ent)) 
        return
    
    
set_pev(Entpev_nextthinkget_gametime() + 0.1)

    static 
Float:fAmtpev(Entpev_renderamtfAmt)
    if(
fAmt <= 0.0)
    {
        
set_pev(Entpev_flagsFL_KILLME)
        return
    } else {
        
fAmt -= 10.0
        set_pev
(Entpev_renderamtfAmt)
    }
}

// ====================== Hardening
public Rex_Hardening(Ent)
{
    if(!
pev_valid(Ent)) return
    
    if(
g_BossState == REX_STATE_SKILL3)
    {
        
g_BossState REX_STATE_SKILL5
        set_pev
(Entpev_movetypeMOVETYPE_NONE)
        
        
set_task(0.1"Rex_HardeningStart"Ent+TASK_HARDENING)    
    }
}

public 
Rex_HardeningStart(ent)
{
    
ent -= TASK_HARDENING
    
if(!pev_valid(ent))
        return    

    
// Effect
    
static Float:Origin[3];
    
pev(entpev_originOrigin)
        
    
Make_PlayerFade(0)
    
Make_PlayerShake(0)
    
CreateBlast(1Origin)
    
    
// Heal
    
static HealthHealth pev(entpev_health)
    
Health -= floatround(HEALTH_OFFSET)
    static 
NewHealthNewHealth min(floatround(REX_HEALTH), Health floatround(REX_HEALTH 4.0))
    
    
set_pev(entpev_healthfloat(NewHealth) + HEALTH_OFFSET)
    
    
// Shield
    
CreateShield(Origin)
    
    
Check_Knockback(Origin0)
    
    
// Continue
    
Set_EntAnim(entREX_SKILL5_START1.01)
    
set_task(0.5"Rex_SHardening"ent+TASK_HARDENING)
}

public 
Rex_SHardening(ent)
{
    
ent -= TASK_HARDENING
    
if(!pev_valid(ent))
        return    
        
    
Set_EntAnim(entREX_SKILL5_LOOP1.01)
    
set_task(5.0"Rex_StopHardening"ent+TASK_HARDENING)
}

public 
Rex_StopHardening(ent)
{
    
ent -= TASK_HARDENING
    
if(!pev_valid(ent))
        return    
    
    
remove_task(ent+TASK_HARDENING)
    
    static 
Float:Origin[3];
    
pev(entpev_originOrigin)
            
    
Make_PlayerFade(0)
    
Make_PlayerShake(0)
    
CreateBlast(1Origin)    
    
    
Check_Knockback(Origin1)
    
    
Set_EntAnim(entREX_SKILL5_END1.01)
    
set_task(2.0"Rex_EndHardening"ent+TASK_HARDENING)
}

public 
Rex_EndHardening(ent)
{
    
ent -= TASK_HARDENING
    
if(!pev_valid(ent))
        return    
        
    
set_pev(entpev_movetypeMOVETYPE_PUSHSTEP)        
    
g_BossState REX_STATE_SEARCHING_ENEMY
    
    set_pev
(entpev_nextthinkget_gametime() + 0.1)
}

public 
Check_Knockback(Float:Origin[3], Damage)
{
    for(new 
0g_MaxPlayersi++)
    {
        if(!
is_user_alive(i))
            continue
            
        
fuck_ent(iOrigin5000.0)
        if(
Damage
        {
            if(
entity_range(iRex) < 800.0)
            {
                
ExecuteHamB(Ham_TakeDamagei0i300.0DMG_BLAST)
            }
        }
    }
}

public 
CreateShield(Float:Origin[3])
{
    static 
EntEnt engfunc(EngFunc_CreateNamedEntityengfunc(EngFunc_AllocString"info_target"))
    if(!
pev_valid(Ent)) return
    
    
set_pev(Entpev_originOrigin)

    
// Set Config
    
set_pev(Entpev_classname"tentacle")
    
engfunc(EngFunc_SetModelEntHARDENING_SHIELD)
        
    
set_pev(Entpev_movetypeMOVETYPE_NONE)
    
set_pev(Entpev_solidSOLID_BBOX)
    
    
set_pev(Entpev_rendermodekRenderTransAdd)
    
set_pev(Entpev_renderfxkRenderFxGlowShell)
    
set_pev(Entpev_renderamt100.0)    
    
    
// Set Size
    
new Float:maxs[3] = {250.0250.0250.0}
    new 
Float:mins[3] = {-250.0, -250.0, -250.0}
    
engfunc(EngFunc_SetSizeEntminsmaxs)
    
    
Set_EntAnim(Ent01.01)
    
set_pev(Entpev_nextthinkget_gametime() + 6.0)
}
// ====================== Teleport
public Rex_Teleport(Ent)
{
    if(!
pev_valid(Ent)) return
    
    if(
g_BossState == REX_STATE_IDLE || g_BossState == REX_STATE_MOVE)
    {
        
g_BossState REX_STATE_SKILL4C
        
//set_pev(Ent, pev_movetype, MOVETYPE_NONE)
        
        
set_task(0.1"Rex_TeleportStart"Ent+TASK_TELEPORT)    
    }
}

public 
Rex_TeleportStart(ent)
{
    
ent -= TASK_TELEPORT
    
if(!pev_valid(ent))
        return    

    
g_StopTeleport 0    
        
    Set_EntAnim
(entREX_SKILL4A_START1.01)
    
    
//set_pev(ent, pev_movetype, MOVETYPE_PUSHSTEP)
    
set_task(1.0"Rex_STeleport"ent+TASK_TELEPORT)
    
set_task(0.85"TeleportHandle"ent+TASK_TELEPORT)
    
set_task(5.0"Rex_StopTeleportF"ent+TASK_TELEPORT)
}

public 
Rex_STeleport(ent)
{
    
ent -= TASK_TELEPORT
    
if(!pev_valid(ent))
        return    
        
    
Set_EntAnim(entREX_SKILL4A_LOOP1.01)
    
    
set_pev(entpev_rendermodekRenderTransAdd)
    
set_pev(entpev_renderfxkRenderFxGlowShell)
    
set_pev(entpev_renderamt200.0)        
}

public 
TeleportHandle(Ent)
{
    
Ent -= TASK_TELEPORT
    
if(!pev_valid(Ent))
        return    
        
    
set_pev(Entpev_rendermodekRenderTransAdd)
    
set_pev(Entpev_renderfxkRenderFxGlowShell)
    
set_pev(Entpev_renderamt200.0)
        
    
g_BossState REX_STATE_SKILL4B
}

public 
TeleportAttack(EntVictim)
{
    
g_BossState REX_STATE_SKILL4A
    
    set_pev
(Entpev_movetypeMOVETYPE_NONE)
    
    
set_task(0.5"TeleportAttackDMG"Ent+TASK_TELEPORT)
    
set_task(0.1"TeleportAttack2"Ent+TASK_TELEPORT)
}

public 
TeleportAttackDMG(Ent)
{
    
Ent -= TASK_TELEPORT
    
if(!pev_valid(Ent))
        return    
        
    
Check_AttackDamge(Ent)
}

public 
TeleportAttack2(Ent)
{
    
Ent -= TASK_TELEPORT
    
if(!pev_valid(Ent))
        return    
        
    
set_pev(Entpev_rendermodekRenderTransAlpha)
    
set_pev(Entpev_renderfxkRenderFxNone)
    
set_pev(Entpev_renderamt255.0)        
        
    
Set_EntAnim(EntREX_SKILL4A_END1.01)
    
    if(
g_StopTeleportset_task(1.0"Rex_StopTeleport"Ent+TASK_TELEPORT)
    else 
set_task(1.0"ContinueTeleport"Ent+TASK_TELEPORT)
}

public 
ContinueTeleport(Ent)
{
    
Ent -= TASK_TELEPORT
    
if(!pev_valid(Ent))
        return    
        
    
Set_EntAnim(EntREX_SKILL4B_START1.01)
    
    
set_pev(Entpev_movetypeMOVETYPE_PUSHSTEP)
    
set_task(0.15"TeleportHandle"Ent+TASK_TELEPORT)
}

public 
Rex_StopTeleportF(ent)
{
    
ent -= TASK_TELEPORT
    
if(!pev_valid(ent))
        return    
        
    
g_StopTeleport 1
}

public 
Rex_StopTeleport(ent)
{
    
ent -= TASK_TELEPORT
    
if(!pev_valid(ent))
        return    

    
g_BossState REX_STATE_SKILL4C
    
    remove_task
(ent+TASK_TELEPORT)
    
    
set_pev(entpev_rendermodekRenderTransAlpha)
    
set_pev(entpev_renderfxkRenderFxNone)
    
set_pev(entpev_renderamt255.0)    
    
    
set_task(0.75"Rex_EndTeleport"ent+TASK_TELEPORT)
}

public 
Rex_EndTeleport(ent)
{
    
ent -= TASK_TELEPORT
    
if(!pev_valid(ent))
        return    
            
    
set_pev(entpev_movetypeMOVETYPE_NONE)        
    
g_BossState REX_STATE_SEARCHING_ENEMY
    
    set_pev
(entpev_nextthinkget_gametime() + 0.1)
}

// ====================== BLAST
public CreateBlast(BigFloat:Origin[3])
{
    static 
BlastBlast engfunc(EngFunc_CreateNamedEntityengfunc(EngFunc_AllocString"env_sprite"))
    if(!
pev_valid(Blast)) return
        
    
Origin[2] -= 36.0
        
    engfunc
(EngFunc_SetOriginBlastOrigin)
        
    
// Set Config
    
set_pev(Blastpev_gamestate1)
    
set_pev(Blastpev_classname"blast")
    if(
Bigengfunc(EngFunc_SetModelBlastBLAST_BIG)
    else 
engfunc(EngFunc_SetModelBlastBLAST_SMALL)
    
set_pev(Blastpev_solidSOLID_NOT)
    
set_pev(Blastpev_movetypeMOVETYPE_NONE)
    
    
// Set Size
    
new Float:maxs[3] = {0.00.00.0}
    new 
Float:mins[3] = {0.00.00.0}
    
entity_set_size(Blastminsmaxs)
    
    if(
Big
    {
        
fm_set_rendering(BlastkRenderFxNone000kRenderTransAdd150)
        
Set_EntAnim(Blast00.451)
    } else {
        
Set_EntAnim(Blast00.51)
    }
    
    if(
Bigset_pev(Blastpev_nextthinkget_gametime() + 1.0)
    else 
set_pev(Blastpev_nextthinkget_gametime() + 0.75)
}

public 
fw_Blast_Think(Ent)
{
    if(!
pev_valid(Ent))
        return
        
    
set_pev(Entpev_flagsFL_KILLME)
}

public 
fw_Rex_Touch(EntId)
{
    if(!
pev_valid(Ent))
        return
    
    if(
g_BossState == REX_STATE_DASH)
    {
        if(
is_user_alive(Id))
        {
            
user_kill(Id)
            
Make_PlayerShake(Id)
        }
    }
}

public 
Make_PlayerShake(id)
{
    if(!
id
    {
        
message_begin(MSG_BROADCASTg_MsgScreenShake)
        
write_short(8<<12)
        
write_short(5<<12)
        
write_short(4<<12)
        
message_end()
    } else {
        if(!
is_user_connected(id))
            return
            
        
message_begin(MSG_BROADCASTg_MsgScreenShake_id)
        
write_short(8<<12)
        
write_short(5<<12)
        
write_short(4<<12)
        
message_end()
    }
}


public 
Make_PlayerFade(id)
{
    static 
Float:DurationDuration 0.25
    
if(!id
    {
        
message_begin(MSG_BROADCASTg_MsgScreenFade)
        
write_short(floatround(4096.0 Durationfloatround_round));
        
write_short(floatround(4096.0 Durationfloatround_round));
        
write_short(0x0000)
        
write_byte(255)
        
write_byte(255)
        
write_byte(255)
        
write_byte(255)
        
message_end();
    } else {
        if(!
is_user_connected(id))
            return
            
        
message_begin(MSG_BROADCASTg_MsgScreenFade_id)
        
write_short(floatround(4096.0 Durationfloatround_round));
        
write_short(floatround(4096.0 Durationfloatround_round));
        
write_short(0x0000)
        
write_byte(255)
        
write_byte(255)
        
write_byte(255)
        
write_byte(255)
        
message_end();
    }
}

public 
Aim_To(iEntFloat:vTargetOrigin[3], Float:flSpeedStyle)
{
    if(!
pev_valid(iEnt))    
        return
        
    if(!
Style)
    {
        static 
Float:Vec[3], Float:Angles[3]
        
pev(iEntpev_originVec)
        
        
Vec[0] = vTargetOrigin[0] - Vec[0]
        
Vec[1] = vTargetOrigin[1] - Vec[1]
        
Vec[2] = vTargetOrigin[2] - Vec[2]
        
engfunc(EngFunc_VecToAnglesVecAngles)
        
//Angles[0] = Angles[2] = 0.0 
        
        
set_pev(iEntpev_v_angleAngles)
        
set_pev(iEntpev_anglesAngles)
    } else {
        new 
Float:f1Float:f2Float:fAnglesFloat:vOrigin[3], Float:vAim[3], Float:vAngles[3];
        
pev(iEntpev_originvOrigin);
        
xs_vec_sub(vTargetOriginvOriginvOrigin);
        
xs_vec_normalize(vOriginvAim);
        
vector_to_angle(vAimvAim);
        
        if (
vAim[1] > 180.0vAim[1] -= 360.0;
        if (
vAim[1] < -180.0vAim[1] += 360.0;
        
        
fAngles vAim[1];
        
pev(iEntpev_anglesvAngles);
        
        if (
vAngles[1] > fAngles)
        {
            
f1 vAngles[1] - fAngles;
            
f2 360.0 vAngles[1] + fAngles;
            if (
f1 f2)
            {
                
vAngles[1] -= flSpeed;
                
vAngles[1] = floatmax(vAngles[1], fAngles);
            }
            else
            {
                
vAngles[1] += flSpeed;
                if (
vAngles[1] > 180.0vAngles[1] -= 360.0;
            }
        }
        else
        {
            
f1 fAngles vAngles[1];
            
f2 360.0 fAngles vAngles[1];
            if (
f1 f2)
            {
                
vAngles[1] += flSpeed;
                
vAngles[1] = floatmin(vAngles[1], fAngles);
            }
            else
            {
                
vAngles[1] -= flSpeed;
                if (
vAngles[1] < -180.0vAngles[1] += 360.0;
            }        
        }
    
        
set_pev(iEntpev_v_anglevAngles)
        
set_pev(iEntpev_anglesvAngles)
    }
}

public 
FindClosetEnemy(entcan_see)
{
    new 
Float:maxdistance 4980.0
    
new indexid 0    
    
new Float:current_dis maxdistance

    
for(new ;<= g_MaxPlayersi++)
    {
        if(
can_see)
        {
            if(
is_user_alive(i) && can_see_fm(enti) && entity_range(enti) < current_dis)
            {
                
current_dis entity_range(enti)
                
indexid i
            
}
        } else {
            if(
is_user_alive(i) && entity_range(enti) < current_dis)
            {
                
current_dis entity_range(enti)
                
indexid i
            
}            
        }
    }    
    
    return 
indexid
}

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
}

stock get_position(entFloat:forwFloat:rightFloat:upFloat:vStart[])
{
    if(!
pev_valid(ent))
        return
        
    static 
Float:vOrigin[3], Float:vAngle[3], Float:vForward[3], Float:vRight[3], Float:vUp[3]
    
    
pev(entpev_originvOrigin)
    
pev(entpev_view_ofs,vUp//for player
    
xs_vec_add(vOrigin,vUp,vOrigin)
    
pev(entpev_anglesvAngle// if normal entity ,use pev_angles
    
    
vAngle[0] = 0.0
    
    angle_vector
(vAngle,ANGLEVECTOR_FORWARD,vForward//or use EngFunc_AngleVectors
    
angle_vector(vAngle,ANGLEVECTOR_RIGHT,vRight)
    
angle_vector(vAngle,ANGLEVECTOR_UP,vUp)
    
    
vStart[0] = vOrigin[0] + vForward[0] * forw vRight[0] * right vUp[0] * up
    vStart
[1] = vOrigin[1] + vForward[1] * forw vRight[1] * right vUp[1] * up
    vStart
[2] = vOrigin[2] + vForward[2] * forw vRight[2] * right vUp[2] * up
}

stock hook_ent2(entFloat:VicOrigin[3], Float:speed)
{
    if(!
pev_valid(ent))
        return
    
    static 
Float:fl_Velocity[3], Float:EntOrigin[3], Float:distance_fFloat:fl_Time
    
    pev
(entpev_originEntOrigin)
    
    
distance_f get_distance_f(EntOriginVicOrigin)
    
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

    set_pev
(entpev_velocityfl_Velocity)
}

stock fuck_ent(entFloat:VicOrigin[3], Float:speed)
{
    if(!
pev_valid(ent))
        return
    
    static 
Float:fl_Velocity[3], Float:EntOrigin[3], Float:distance_fFloat:fl_Time
    
    pev
(entpev_originEntOrigin)
    
    
distance_f get_distance_f(EntOriginVicOrigin)
    
fl_Time distance_f speed
        
    fl_Velocity
[0] = (EntOrigin[0]- VicOrigin[0]) / fl_Time
    fl_Velocity
[1] = (EntOrigin[1]- VicOrigin[1]) / fl_Time
    fl_Velocity
[2] = (EntOrigin[2]- VicOrigin[2]) / fl_Time

    set_pev
(entpev_velocityfl_Velocity)
}


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 Set_EntAnim(entanimFloat:framerateresetframe)
{
    if(!
pev_valid(ent))
        return
    
    if(!
resetframe)
    {
        if(
pev(entpev_sequence) != anim)
        {
            
set_pev(entpev_animtimeget_gametime())
            
set_pev(entpev_framerateframerate)
            
set_pev(entpev_sequenceanim)
        }
    } else {
        
set_pev(entpev_animtimeget_gametime())
        
set_pev(entpev_framerateframerate)
        
set_pev(entpev_sequenceanim)
    }
}


























stock PlaySound(id, const sound[])
{
    if(
equal(sound[strlen(sound)-4], ".mp3")) client_cmd(id"mp3 play ^"sound/%s^""sound)
    else 
client_cmd(id"spk ^"%s^""sound)
}

stock StopSound(idclient_cmd(id"mp3 stop; stopsound")
stock EmitSound(idChannel, const Sound[]) emit_sound(idChannelSoundVOL_NORMATTN_NORM0PITCH_NORM)
stock client_printc(index, const text[], any:...)
{
    static 
szMsg[128]; vformat(szMsgsizeof(szMsg) - 1text3)

    
replace_all(szMsgsizeof(szMsg) - 1"!g""^x04")
    
replace_all(szMsgsizeof(szMsg) - 1"!n""^x01")
    
replace_all(szMsgsizeof(szMsg) - 1"!t""^x03")

    if(!
index)
    {
        for(new 
0g_MaxPlayersi++)
        {
            if(!
Get_BitVar(g_Connectedi))
                continue
                
            
message_begin(MSG_ONE_UNRELIABLEg_MsgSayText_i);
            
write_byte(i);
            
write_string(szMsg);
            
message_end();    
        }        
    } else {
        
message_begin(MSG_ONE_UNRELIABLEg_MsgSayText_index);
        
write_byte(index);
        
write_string(szMsg);
        
message_end();
    }

i'm using zp4.3 fix5a
Thanks

+ i have new issue in this file while running consol of server
Code:
L 06/13/2024 - 22:35:34: [AMXX] Plugin ("dr_rex_gameplay.amxx") is setting itself as failed.
L 06/13/2024 - 22:35:34: [AMXX] Plugin says: [Dr.Rex] No Vote
L 06/13/2024 - 22:35:34: [AMXX] Run time error 1 (plugin "dr_rex_gameplay.amxx") - forced exit
Source for it
PHP Code:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <gamemaster>

#define PLUGIN "[CSO] Dr.Rex - Gameplay"
#define VERSION "1.0"
#define AUTHOR "Dias Pendragon"

#define MAP "zs_nightmare2"

#define TIME_VOTE 5
#define TASK_VOTE 572014

new g_Menug_Vote
new Voting

public plugin_init()
{
    static 
Map[64]; get_mapname(Mapsizeof(Map))
    if(
equal(MapMAP)) set_fail_state("[Dr.Rex] No Vote")
    
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
// Menu
    
g_Menu menu_create("Fight Dr.Rex?""MenuHandle_Fight")

    
menu_additem(g_Menu"Yes, Let's fight him""yes")
    
menu_additem(g_Menu"No, Continue to play zombie""no")
}

public 
GM_Time() Check_RoundTime()

public 
Check_RoundTime()
{
    if(
Voting) return
    
    static 
TimeTime get_timeleft()
    static 
MinuteMinute Time 60

    
if(Minute TIME_VOTE)
    {
        
Voting 1
        g_Vote 
0
        
        Start_Voting
()
        
set_task(30.0"End_Vote"TASK_VOTE)
        
        
client_print(0print_chat"[Dr.Rex] Vote is Started!")
    }
}

public 
Start_Voting()
{
    for(new 
0get_maxplayers(); i++)
    {
        if(!
is_user_connected(i))
            continue
            
        
menu_display(ig_Menu0)
    }
}

public 
MenuHandle_Fight(idmenuitem
{
    if(!
is_user_connected(id))
        return 
PLUGIN_HANDLED
    
if(item == MENU_EXIT)
        return 
PLUGIN_HANDLED

    
new szData[6], szName[64], Name[64]
    new 
item_accessitem_callback;

    
menu_item_getinfo(menuitemitem_accessszData,charsmaxszData ), szName,charsmaxszName ), item_callback );
    
get_user_name(idNamesizeof(Name))
    
    if(
equal(szData"yes"))
    {
        
g_Vote++
        
client_print(0print_chat"[Dr.Rex] %s has voted 'Yes'"Name)
    } else if(
equal(szData"no")) {
        
g_Vote--
        
client_print(0print_chat"[Dr.Rex] %s has voted 'No'"Name)
    }
    
    return 
PLUGIN_HANDLED
}

public 
End_Vote()
{
    for(new 
0get_maxplayers(); i++)
    {
        if(!
is_user_connected(i))
            continue
            
        
menu_cancel(i)
    }
    
    
menu_destroy(g_Menu)
    
    if(
g_Vote <= 0// No
    
{
        
client_print(0print_chat"[Dr.Rex] Vote Result: No")
    } else { 
// Yes
        
set_task(5.0"ChangeTime"TASK_VOTE)
        
client_print(0print_chat"[Dr.Rex] Vote Result: Yes")
    }
}

public 
ChangeTime()
{
    
server_cmd("amx_map %s"MAP)

Solve my issue i request.
__________________



AssasinSniperNightmare ModArmageddon ModApolacyps Mod

Last edited by DarkDeviL; 06-20-2024 at 16:54. Reason: Restore to previous version.
Kakarot47 is offline
Send a message via Skype™ to Kakarot47
Closed Thread


Thread Tools
Display Modes

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 19:04.


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