Raised This Month: $32 Target: $400
 8% 

zp_zclass_husk


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
MayroN
Senior Member
Join Date: Aug 2017
Location: Kyiv
Old 01-03-2020 , 16:35   zp_zclass_husk
Reply With Quote #1

Tell me, what's wrong here - does the Fireball ability not work for Bots ?

PHP Code:
// bot use skill
public bot_use_skill(taskid)
{
    new 
id ID_BOT_USE_SKILL
    
if (!is_user_bot(id)) return;

        if (
zp_get_user_zombie_class(id) == g_zclassdragon)

        
dragon_cmd(id)
        
    if (
task_exists(taskid)) remove_task(taskid)
    
set_task(float(random_num(5,15)), "bot_use_skill"id+TASK_BOT_USE_SKILL)

PHP Code:
#include <amxmodx>
#include <cstrike>
#include <engine>
#include <fun>
#include <fakemeta>
#include <hamsandwich>
#include <zombieplague>
#include <xs>

new const ball_name[] = "dragon_ball";
new const 
ball_model[] = "models/zombie_plague/husk_ball.mdl";
new const 
ball_firespritemdl[] = "sprites/flame2.spr";
new const 
ball_spriteexplodemdl[] = "sprites/zerogxplode.spr"

new const zclass_name[] = { "Слепой Палач" // name
new const zclass_info[] = { "Огненный Шар" // description
new const zclass_model[] = { "Effigy" // model
new const zclass_clawmodel[] = { "v_executioner_zombie.mdl" // claw model
const zclass_health 4800 // health
const zclass_speed 270 // speed
const Float:zclass_gravity 1.0 // gravity
const Float:zclass_knockback 0.6 // knockback

new sprFlamesprSmoke

enum 
(+= 100)
{
    
TASK_BOT_USE_SKILL
}

#define ID_BOT_USE_SKILL (taskid - TASK_BOT_USE_SKILL)

new g_zclassdragon
new cvar_dragondmg cvar_dragondelay cvar_dragonvelocity  cvar_dragonballhealth cvar_dragonballradius cvar_dragonballpower cvar_burndmg cvar_burntime cvar_burn
new g_msgScreenShake g_smoke ball_firesprite ball_spriteexplode g_explode[512] , g_can[33] , g_msgScoreInfo g_roundend bool:g_AlreadyBurn33 ] , Time33 ]

public 
plugin_init()
{
    
register_plugin("[ZP] Zombie Class: HUSK""0.1""=)")

    
cvar_dragondelay register_cvar("zp_classdragon_delay","25")
    
cvar_dragondmg register_cvar("zp_classdragonball_dmg","30.0")
    
cvar_dragonvelocity register_cvar("zp_classdragonball_velocity","400")
    
cvar_dragonballhealth register_cvar("zp_classdragonball_health","6")
    
cvar_dragonballradius register_cvar("zp_classdragonball_radius","300.0")
    
cvar_dragonballpower register_cvar "zp_classdragonball_power""800" )
    
cvar_burn register_cvar "zp_classdragonball_enable""1" )
    
cvar_burntime register_cvar "zp_classdragonball_burntime""10" )
    
cvar_burndmg register_cvar "zp_classdragonball_burndmg""2" )

    
register_touch(ball_name"worldspawn",            "touchWorld")
    
register_touch(ball_name"func_wall",            "touchWorld")
    
register_touch(ball_name"func_door",            "touchWorld")
    
register_touch(ball_name"func_door_rotating""touchWorld")
    
register_touch(ball_name"func_wall_toggle",    "touchWorld")
    
register_touch(ball_name"func_breakable",        "touchWorld")
    
register_think(ball_name,"ball_think")

    
register_forward(FM_PlayerPreThink"CmdStart")
    
register_event("HLTV""event_round_start""a""1=0""2=0")

    
RegisterHam(Ham_Killed"player""fw_PlayerKilled")

    
g_msgScoreInfo get_user_msgid("ScoreInfo")
    
g_msgScreenShake get_user_msgid("ScreenShake")

    
register_logevent("logevent_round_start",2"1=Round_Start")
}

public 
plugin_precache()
{
    
precache_model(ball_model)
    
g_smoke precache_model"sprites/steam1.spr" );
    
ball_firesprite precache_model(ball_firespritemdl)
    
ball_spriteexplode  precache_model(ball_spriteexplodemdl)

    
sprFlame precache_model"sprites/flame.spr" )
    
sprSmoke precache_model"sprites/black_smoke3.spr" )

    
g_zclassdragon zp_register_zombie_class(zclass_namezclass_infozclass_modelzclass_clawmodelzclass_healthzclass_speedzclass_gravityzclass_knockback)    
}

public 
logevent_round_start()
{
    for (new 
id=1id<33id++)
    {
        if (!
is_user_connected(id)) continue;
        if (
is_user_bot(id))
        {
            if (
task_exists(id+TASK_BOT_USE_SKILL)) remove_task(id+TASK_BOT_USE_SKILL)
            
set_task(float(random_num(5,15)), "bot_use_skill"id+TASK_BOT_USE_SKILL)
        }
    }
}

// bot use skill
public bot_use_skill(taskid)
{
    new 
id ID_BOT_USE_SKILL
    
if (!is_user_bot(id)) return;

        if (
zp_get_user_zombie_class(id) == g_zclassdragon)

        
dragon_cmd(id)
        
    if (
task_exists(taskid)) remove_task(taskid)
    
set_task(float(random_num(5,15)), "bot_use_skill"id+TASK_BOT_USE_SKILL)
}

public 
CmdStart(id)
{        
    new 
button pev(idpev_button)
    new 
oldbutton pev(idpev_oldbuttons)
    
    if (
zp_get_user_zombie(id) && !zp_get_user_nemesis(id) && (zp_get_user_zombie_class(id) == g_zclassdragon))
    {
        if(
oldbutton IN_USE && !(button IN_USE))
        {
            
dragon_cmd(id)
        }
    }
    return 
FMRES_IGNORED
}

public 
zp_user_infected_post (idinfector)    
{
        if ((
zp_get_user_zombie_class(id) == g_zclassdragon) && !zp_get_user_nemesis(id))
        {
        
print_chatColor(id"\g[ Зомби Чума ] \tБросок Огненного Шара - \gЕ")
        }
    
Timeid ] = 
    g_AlreadyBurn
id ] = false
    remove_task
(id)
}

public 
dragon_cmd(id)
{
    if( !
is_user_alive(id) || !zp_get_user_zombie(id) || zp_get_user_zombie_class(id) != g_zclassdragon || zp_get_user_nemesis(id))
        return 
PLUGIN_CONTINUE;

    if(
g_can[id]) 
    {
        
print_chatColor(id"\g[ Зомби Чума ] \tОсталось \g%d секунд(ы) \tдля повторного броска Шара",g_can[id])
        return 
PLUGIN_HANDLED;
    }

    static 
Float:origin[3], Float:angles[3], Float:v_forward[3], Float:v_right[3], Float:v_up[3], Float:gun_position[3], Float:player_origin[3], Float:player_view_offset[3];
    static 
Float:OriginX[3]
    
pev(idpev_v_angleangles);
    
pev(idpev_originOriginX);
    
engfunc(EngFunc_MakeVectorsangles);

    
global_get(glb_v_forwardv_forward);
    
global_get(glb_v_rightv_right);
    
global_get(glb_v_upv_up);

    
//m_pPlayer->GetGunPosition( ) = pev->origin + pev->view_ofs
    
pev(idpev_originplayer_origin);
    
pev(idpev_view_ofsplayer_view_offset);
    
xs_vec_add(player_originplayer_view_offsetgun_position);

    
xs_vec_mul_scalar(v_forward13.0v_forward);
    
xs_vec_mul_scalar(v_right0.0v_right);
    
xs_vec_mul_scalar(v_up5.0v_up);

    
xs_vec_add(gun_positionv_forwardorigin);
    
xs_vec_add(originv_rightorigin);
    
xs_vec_add(originv_uporigin);

    new 
Float:StartOrigin[3]
            
    
StartOrigin[0] = origin[0];
    
StartOrigin[1] = origin[1];
    
StartOrigin[2] = origin[2];


    new 
Float:fVelocity[3] , Float:flOrigin[3] , Float:flAngle[3]
    
pev(id,pev_origin,flOrigin)
    
pev(id,pev_angles,flAngle)

    new 
ball create_entity("info_target")
    
    if (!
ball) return PLUGIN_HANDLED

    g_explode
[ball] = 0
    
    entity_set_string
(ballEV_SZ_classnameball_name)
    
    
entity_set_model(ballball_model)
    
    
entity_set_origin(ballStartOrigin)
    
    
entity_set_vector(ballEV_VEC_anglesflAngle)
    
    new 
Float:MinBox[3] = {-1.0, -1.0, -1.0}
    new 
Float:MaxBox[3] = {1.01.01.0}
    
entity_set_vector(ballEV_VEC_minsMinBox)
    
entity_set_vector(ballEV_VEC_maxsMaxBox)
    
    
entity_set_int(ballEV_INT_solidSOLID_SLIDEBOX)
    
    
entity_set_int(ballEV_INT_movetypeMOVETYPE_BOUNCE)
    
    
entity_set_edict(ballEV_ENT_ownerid)
    
    
    
VelocityByAim(idget_pcvar_num(cvar_dragonvelocity ), fVelocity)
    
entity_set_vector(ball EV_VEC_velocityfVelocity)
    

    
UTIL_PlayPlayerAnimation(id,10)
    
UTIL_PlayWeaponAnimation(id,8)

    
g_can[id] = get_pcvar_num(cvar_dragondelay)
    
set_task(1.0,"ability_zero",id)

    
entity_set_float(ballEV_FL_health get_pcvar_float(cvar_dragonballhealth))

    
entity_set_float(ballEV_FL_nextthinkget_gametime() + 0.1
    
    return 
PLUGIN_HANDLED;
}

public 
touchWorld(ballworld) {

    new 
Float:v[3]
    
entity_get_vector(ballEV_VEC_velocityv)

    
v[0] = (v[0] * 0.85)
    
v[1] = (v[1] * 0.85)
    
v[2] = (v[2] * 0.85)
    
entity_set_vector(ballEV_VEC_velocityv)
    
    return 
PLUGIN_HANDLED
}

public 
event_round_start()
{
    new 
iEnt FM_NULLENT;
    while( (
iEnt engfunc(EngFunc_FindEntityByStringiEnt"classname"ball_name)) > )
    {
        
engfunc(EngFunc_RemoveEntity,iEnt)
    }    

    for(new 
i;i<=32;i++)
    {
        
remove_task(i)
        
g_can[i] = 0
        Time
] = 
        g_AlreadyBurn
i] = false
    
}

    
g_roundend 0
}

public 
ball_think(ball)
{
    if(!
is_valid_ent(ball))
        return;

    new 
Float:oldangles[3],Float:angles[3]
    
pev(ball,pev_angles,oldangles)
    
angles[0] = oldangles[0] + random_float(20.0,100.0)
    
angles[1] = oldangles[1] + random_float(10.0,80.0)
    
angles[2] = oldangles[2] + random_float(10.0,80.0)
    
set_pev(ball,pev_angles,angles)

    new 
Float:v[3]
    
entity_get_vector(ballEV_VEC_velocityv)

    if(
v[2] < 40.0 && v[1] < 40.0 && v[0] < 40.0
    {
        if(!
g_explode[ball])
        {
            
set_task(0.5,"firesprite_ball",ball)
            
g_explode[ball] = 1
        
}

        
entity_set_float(ballEV_FL_healthentity_get_float(ball,EV_FL_health) - 0.2

        if(
entity_get_float(ball,EV_FL_health) <= 0.0
        {
            
ball_explode(ball)
            
remove_entity(ball)
            
g_explode[ball] = 0
            
return;
        }
    }

    
entity_set_float(ballEV_FL_nextthinkget_gametime() + 0.1

}

public 
firesprite_ball(ball)
{
    if(!
is_valid_ent(ball))
        return;

    new 
Float:flOrigin[3]
    
pev(ball,pev_origin,flOrigin)

    
engfunc EngFunc_MessageBeginMSG_PVSSVC_TEMPENTITYflOrigin)
    
write_byte TE_SPRITE )
    
engfunc EngFunc_WriteCoordflOrigin ] )
    
engfunc EngFunc_WriteCoordflOrigin ] )
    
engfunc EngFunc_WriteCoordflOrigin ] + 45.0 )
    
write_short ball_firesprite )
    
write_byte )
    
write_byte 185 )
    
message_end ( )

    
message_beginMSG_BROADCASTSVC_TEMPENTITY );
    
write_byteTE_SMOKE );
    
engfunc EngFunc_WriteCoordflOrigin ] )
    
engfunc EngFunc_WriteCoordflOrigin ] )
    
engfunc EngFunc_WriteCoordflOrigin ] )
    
write_shortg_smoke );
    
write_byte10 );
    
write_byte10 );
    
message_end();

    if(
entity_get_float(ball,EV_FL_health) >= 1.0set_task(0.5,"firesprite_ball",ball)
}
public 
ball_explode Entity )
{
    if ( 
Entity )
        return
       
    static 
Float:flOrigin ]
    
pev Entitypev_originflOrigin )
       
    
message_begin(MSG_BROADCASTSVC_TEMPENTITY)
    
write_byte(TE_EXPLOSION// Temporary entity ID
    
engfunc(EngFunc_WriteCoordflOrigin[0]) // engfunc because float
    
engfunc(EngFunc_WriteCoordflOrigin[1])
    
engfunc(EngFunc_WriteCoordflOrigin[2])
    
write_short(ball_spriteexplode// Sprite index
    
write_byte(50// Scale
    
write_byte(15// Framerate
    
write_byte(0// Flags
    
message_end()
    
         new 
iOwner entity_get_edict EntityEV_ENT_owner )
       
          for ( new 
1<= 32 i++ )
    {
        if ( !
is_user_alive  ) || zp_get_user_zombie))
            continue
          
        new 
Float:flVictimOrigin ]
        
pev ipev_originflVictimOrigin )
           
        new 
Float:flDistance get_distance_f flOriginflVictimOrigin )   
           
        if ( 
flDistance <= get_pcvar_float(cvar_dragonballradius) )
        {
            static 
Float:flSpeed
            flSpeed 
get_pcvar_float cvar_dragonballpower )
               
            static 
Float:flNewSpeed
            flNewSpeed 
flSpeed * ( 1.0 - ( flDistance get_pcvar_float(cvar_dragonballradius) ) )
               
            static 
Float:flVelocity ]
            
get_speed_vector flOriginflVictimOriginflNewSpeedflVelocity )
               
            
set_pev ipev_velocity,flVelocity )

            
message_begin(MSG_ONEg_msgScreenShake, {0,0,0}, i)
            
write_short(1<<14// Amount
            
write_short(1<<14// Duration
            
write_short(1<<14// Frequency
            
message_end()

            
radius_damage_abflVictimOriginflOrigin iOwner)

            if(!
g_AlreadyBurn] && get_pcvar_num(cvar_burn ) == 
            {
                
// Burn / ON
                
g_AlreadyBurn] = true
        
                
// Set burn time
                
Time] = get_pcvar_num(cvar_burntime)
        
                
// Burn victim
                
Burn)
            }
        }
    }
}       

public 
radius_damage_ab(Float:originF[3] , Float:flOrigin[3] , iVictim iAttacker)
{
    if(
g_roundend || !is_user_connected(iAttacker) || !is_user_connected(iVictim))
        return;

    new 
Float:dist get_distance_f(originFflOrigin);
    new 
Float:dmg get_pcvar_float(cvar_dragondmg) - ( get_pcvar_float(cvar_dragondmg) / get_pcvar_float(cvar_dragonballradius) ) * dist;

    if(
pev(iVictim,pev_health) - dmg <= 0
    {
        new 
headshot
        
if(dist 20.0headshot 1
        
if(dist >= 20.0headshot 0
        message_begin
MSG_ALLget_user_msgid("DeathMsg"),{0,0,0},0)
        
write_byte(iAttacker)
        
write_byte(iVictim)
        
write_byte(headshot)
        
write_string("dragon")
        
message_end()

        
user_silentkill(iVictim)

        
set_pev(iAttackerpev_fragsfloat(pev(iAttackerpev_frags) + 1))
        
zp_set_user_ammo_packs(iAttackerzp_get_user_ammo_packs(iAttacker) + 1)
        
fm_cs_set_user_deaths(iVictimcs_get_user_deaths(iVictim) + 1)

        
message_begin(MSG_BROADCASTg_msgScoreInfo)
        
write_byte(iAttacker// id
        
write_short(pev(iAttackerpev_frags)) // frags
        
write_short(cs_get_user_deaths(iAttacker)) // deaths
        
write_short(0// class?
        
write_short(fm_cs_get_user_team(iAttacker)) // team
        
message_end()
        
        
message_begin(MSG_BROADCASTg_msgScoreInfo)
        
write_byte(iVictim// id
        
write_short(pev(iVictimpev_frags)) // frags
        
write_short(cs_get_user_deaths(iVictim)) // deaths
        
write_short(0// class?
        
write_short(fm_cs_get_user_team(iVictim)) // team
        
message_end()

    }else{
        if(
dmg 0set_pev(iVictim pev_health pev(iVictim,pev_health) - dmg)
        if(
dmg <= 0set_pev(iVictim pev_health pev(iVictim,pev_health) + dmg)
    }
}

public 
remove_values(id)
{
    
remove_task(id)
    
g_can[id] = 0
}

public 
ability_zero(id
{
    
g_can[id] -= 1
    
if(!g_can[id]) print_chatColor(id"\g[ Зомби Чума ] \tОгненный Шар \gГотов!")
    if(
g_can[id]) set_task(1.0,"ability_zero",id)
}

public 
Burnvictim )
{
    
// Get user origin
    
static Origin] ; get_user_originvictimOrigin )
    
    
// If burn time is over or victim are in water
    
if( Timevictim ] <= || get_entity_flagsvictim ) & FL_INWATER )
    {    
        
// Show Smoke sprite    
        
message_beginMSG_PVSSVC_TEMPENTITYOrigin )
        
write_byteTE_SMOKE // TE id
        
write_coordOrigin[0] ) // x
        
write_coordOrigin[1] ) // y
        
write_coordOrigin[2]-50 // z
        
write_shortsprSmoke // sprite
        
write_byterandom_num(1520) ) // scale
        
write_byterandom_num(1020) ) // framerate
        
message_end( )
        
        
// Delay to allow burn again
        
set_taskfloat(get_pcvar_num(cvar_burntime)), "Stop"victim )
        
        
// Exit
        
return
    }
    else
    {        
        
// Flame sprite    
        
message_beginMSG_PVSSVC_TEMPENTITYOrigin )
        
write_byteTE_SPRITE // TE id
        
write_coordOrigin[0]+random_num(-55) ) // x
        
write_coordOrigin[1]+random_num(-55) ) // y
        
write_coordOrigin[2]+random_num(-1010) ) // z
        
write_shortsprFlame // sprite
        
write_byterandom_num(510) ) // scale
        
write_byte200 // brightness
        
message_end( )
            
        
// Decrease Time
        
Timevictim ]--
        
        
// Decrease life (random)
        
if(get_user_health(victim) -  get_pcvar_num(cvar_burndmg) > 0set_user_healthvictimget_user_healthvictim ) -  get_pcvar_num(cvar_burndmg))
        
        
// Stop fire if health <= min health.
        
if( get_user_healthvictim ) <=  get_pcvar_num(cvar_burndmg))
        {
            
g_AlreadyBurnvictim ] = false
            
return
        }
        
        
// Repeat
        
set_task0.5"Burn"victim )
    }
}

public 
Stopvictim )
    
g_AlreadyBurnvictim ] = false // Allow burn again

public zp_user_humanized_post(idremove_values(id)
public 
fw_PlayerKilled(idattackershouldgibremove_values(id)
public 
client_connect(id)  remove_values(id)
public 
zp_round_ended() g_roundend 1

stock UTIL_PlayWeaponAnimation
(const Player, const Sequence)
{
    
set_pev(Playerpev_weaponanimSequence)
    
    
message_begin(MSG_ONE_UNRELIABLESVC_WEAPONANIM, .player Player)
    
write_byte(Sequence)
    
write_byte(pev(Playerpev_body))
    
message_end()
}

stock UTIL_PlayPlayerAnimation(const id, const Sequence Float:frame 1.0 Float:framerate 1.0)
{
    
entity_set_int(idEV_INT_sequenceSequence)
    
entity_set_int(idEV_INT_gaitsequence1)
    
entity_set_float(idEV_FL_frameframe)
    
entity_set_float(idEV_FL_framerateframerate)
}

stock get_speed_vector(const Float:origin1[3],const Float:origin2[3],Float:speedFloat:new_velocity[3])
{
    
new_velocity[0] = origin2[0] - origin1[0]
    
new_velocity[1] = origin2[1] - origin1[1]
    
new_velocity[2] = origin2[2] - origin1[2]
    new 
Float:num floatsqroot(speed*speed / (new_velocity[0]*new_velocity[0] + new_velocity[1]*new_velocity[1] + new_velocity[2]*new_velocity[2]))
    
new_velocity[0] *= num
    new_velocity
[1] *= num
    new_velocity
[2] *= num
       
    
return 1;


stock fm_cs_set_user_deaths(idvalue)
{
    
set_pdata_int(id444value5)
}

stock fm_cs_get_user_team(id)
{
    return 
get_pdata_int(id1145);
}

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

MayroN is offline
Send a message via ICQ to MayroN Send a message via Skype™ to MayroN
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 05:37.


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