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

Solved Te_beamcylinder


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

Evening on Location)))
I ask for help to tell you what I did wrong here.
TE_BEAMCYLINDER should come from the already supine on Entity

And make a ban on raising the Model when the player has the maximum Health and Armor
PHP Code:
const LIMIT_HEALTH 300;
const 
LIMIT_ARMOR 250
Thanks

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

new const PLUGIN_NAME[ ]                 = "[ZP] Bonus Box";
new const 
PLUGIN_VERSION[ ]         = "0.0.2";
new const 
PLUGIN_AUTHOR[ ]         = "Shurik";

const 
MAX_CLIENTS  32;
const 
PDATA_SAFE 2;
const 
OFFSET_CSMONEY 115;
const 
OFFSET_LINUX 5;

new const 
g_szClassName[ ]     = "ZombiesBBox";

#define LIFE_TIME        25.0    //    Сколько секунд до исчезновения Мешка

#define STEP 10.0
#define VERTICAL_SPEED 20.0
#define HORISONTAL_SPEED 60.0

enum (+= 1) {
    
STATUS_NONE 0,
    
STATUS_EFFECT,
    
STATUS_KILL
}

const 
LIMIT_HEALTH 300;
const 
LIMIT_ARMOR 250;

#define ZombiesBBox      "models/zp_bonus_box/zp_bonus_box.mdl" 

new Money_Sound[] = "zp_bonus_box/zp_bonus_money.wav";
new 
Medkit_Sound[] = "zp_bonus_box/zp_bonus_medkit.wav"
new Armor_Sound[] = "zp_bonus_box/zp_bonus_armor.wav";

new 
Float:g_vecOriginMAX_CLIENTS ][ ];

new 
g_pEntityg_msgScreenFade

new g_hamczbotscvar_botquota;

new 
i_shockwave;

public 
plugin_precache( )
{
    
precache_model(ZombiesBBox);    
    
precache_sound(Money_Sound)
    
precache_sound(Medkit_Sound);
    
precache_sound(Armor_Sound);
    
i_shockwave precache_model("sprites/shockwave.spr");
}

public 
plugin_init( )
{
    
register_pluginPLUGIN_NAMEPLUGIN_VERSIONPLUGIN_AUTHOR );
    
    
register_event("HLTV""eventHLTV""a""1=0""2=0");
    
    
RegisterHamHam_Killed"player""CBasePlayer__Killed_Post", .Post true );
    
RegisterHamHam_Touch"info_target""CBaseEntity__Touch_Pre", .Post false );
    
register_think("ZombiesBBox""BoxThink")
    
register_think("ZombiesBBox""think_supply")
    
cvar_botquota get_cvar_pointer"bot_quota" );
    
g_msgScreenFade get_user_msgid("ScreenFade")
}

public 
eventHLTV( )    
{
    new 
entity = -1;
    
    while((
entity find_ent_by_class(entityg_szClassName)))
    {
        
remove_entity(entity);
    }
}

public 
CBasePlayer__Killed_PostpevVictim )
{
    if( !
zp_get_user_zombiepevVictim ) )
    {
        return 
HAM_IGNORED;
    }

    
pevpevVictimpev_origing_vecOriginpevVictim ] );

    
CreateBBox(  g_vecOriginpevVictim ] );

    return 
HAM_IGNORED;
}


public 
CreateBBoxFloat:vOrigin] )
{
    
g_pEntity engfuncEngFunc_CreateNamedEntity engfuncEngFunc_AllocString,"info_target" ) );

    if( !
pev_validg_pEntity ) )
    {
        return;
    }

    
set_pevg_pEntitypev_classnameg_szClassName );
    
set_pevg_pEntitypev_modelZombiesBBox );

    
engfuncEngFunc_SetModelg_pEntityZombiesBBox );
    
engfuncEngFunc_SetSizeg_pEntityFloat:{ -1.0, -1.0, -1.0}, Float:{  2.5,  2.5,  2.5 });
    
engfuncEngFunc_SetOriging_pEntityvOrigin );    

    new 
Float:velocity[3]

    
velocity[0] = random_float(50.0100.0)
    
velocity[1] = random_float(50.0100.0)
    
velocity[2] = random_float(200.0250.0)    
    
    
set_pevg_pEntitypev_velocityvelocity
    
    
set_pevg_pEntity pev_body random_num) )
    
    
set_pevg_pEntitypev_solidSOLID_TRIGGER);
    
set_pevg_pEntitypev_movetypeMOVETYPE_TOSS);
    
set_pevg_pEntitypev_sequence1);
    
set_pevg_pEntitypev_gaitsequence1);
    
set_pevg_pEntitypev_framerate1.0);
    
set_pevg_pEntitypev_frame0.0);
    
set_pevg_pEntitypev_rendermodekRenderFxNone);
    
set_pevg_pEntitypev_nextthinkget_gametime() + LIFE_TIME)

}

public 
think_supply(ent) {
    if(!
pev_valid(ent) && !drop_to_floor(ent))
        return
    
    new 
Float:o[3]
    
pev(entpev_origino)
        
    
engfunc(EngFunc_MessageBeginMSG_PVSSVC_TEMPENTITYo0)
    
write_byte(TE_BEAMCYLINDER// TE id
    
engfunc(EngFunc_WriteCoordo[0]) // x
    
engfunc(EngFunc_WriteCoordo[1]) // y
    
engfunc(EngFunc_WriteCoordo[2] + 1.0// z
    
engfunc(EngFunc_WriteCoordo[0] + 500.0// x axis
    
engfunc(EngFunc_WriteCoordo[1] + 500.0// y axis
    
engfunc(EngFunc_WriteCoordo[2] + 50.0// z axis
    
write_short(i_shockwave// sprite
    
write_byte(0// startframe
    
write_byte(0// framerate
    
write_byte(4// life (4)
    
write_byte(5// width (20)
    
write_byte(0// noise
    
write_byte(255// red
    
write_byte(255// green
    
write_byte(0// blue
    
write_byte(255// brightness
    
write_byte(0// speed
    
message_end()
        
    
set_pev(entpev_nextthinkget_gametime() + 3.0)
}

public 
CBaseEntity__Touch_PrepEntity pPlayer )
{
    if( !
pev_validpEntity ) || !is_user_alivepPlayer ) || !UTIL_get_user_humanpPlayer ) )
    {
        return 
HAM_IGNORED;
    }
    
    if ((
get_user_health(pPlayer) > LIMIT_HEALTH && get_user_armor(pPlayer) > LIMIT_ARMOR))
        return 
HAM_IGNORED;
    
    static 
zsClassname32 ];

    
pevpEntitypev_classnamezsClassnamecharsmaxzsClassname ) );
    
    if( !
equalzsClassnameg_szClassName ) )
    {
        return 
HAM_IGNORED;
    }

    switch ( 
pevpEntitypev_body) )
    {
        case 
0
        {
            
set_pevpPlayerpev_healthfloat(min(pev(pPlayerpev_health) + random_num(1550), LIMIT_HEALTH))); 
            
set_dhudmessage(25525500.160.9600.00.02.0);
            
show_dhudmessage(pPlayer"+ Здоровье");
            
screen_fade_medkit(pPlayer);
            
client_cmd(pPlayer,"spk %s",Medkit_Sound);
        }    
        case 
1
        { 
 
            
set_pevpPlayerpev_armorvaluefloat(min(pev(pPlayerpev_armorvalue) + random_num(1030), LIMIT_ARMOR)));
            
set_dhudmessage(0802550.360.9600.00.02.0);
            
show_dhudmessage(pPlayer"+ Броня");
            
screen_fade_armor(pPlayer);
            
client_cmd(pPlayer,"spk %s",Armor_Sound);
        }  
        case 
2
        {
            
zp_set_user_ammo_packspPlayer zp_get_user_ammo_packspPlayer ) + random_num(13));
            
set_dhudmessage(025500.900.8700.00.01.0);
            
show_dhudmessage(pPlayer"+ Деньги");
            
screen_fade_money(pPlayer);
            
client_cmd(pPlayer,"spk %s",Money_Sound);
        }           
    }

    
engfuncEngFunc_RemoveEntity pEntity );
    
    return 
HAM_IGNORED;
}

public 
BoxThink(ent)    {
    if (!
pev_valid(ent)) {
        return 
HAM_IGNORED;
    }
    
    switch(
pev(entpev_impulse))    {
        case 
STATUS_NONE:{
            
set_pev(entpev_movetypeMOVETYPE_FLY);
            
set_pev(entpev_solidSOLID_NOT);
            
set_pev(entpev_rendermodekRenderTransAlpha);
            
            
set_pev(entpev_renderamt100.0);
            
set_pev(entpev_velocityFloat:{0.00.0VERTICAL_SPEED});
            
set_pev(entpev_avelocityFloat:{0.0HORISONTAL_SPEED0.0})
            
set_pev(entpev_impulseSTATUS_EFFECT);        
        }
        case 
STATUS_EFFECT:    {
            if (
pev(entpev_renderamt) > 0.0) {
                
set_pev(entpev_renderamtfloatmax(0.0pev(entpev_renderamt) - STEP));
            } else {
                
set_pev(entpev_flagsFL_KILLME);
                
set_pev(entpev_impulseSTATUS_KILL);
            }
        }
    }
    
    
set_pev(ent,pev_nextthink,get_gametime() + 0.1)
    
    return 
HAM_SUPERCEDE;
}

public 
screen_fade_medkit(pPlayer) {
    
message_begin(MSG_ONEg_msgScreenFade, {0,0,0}, pPlayer
    
write_short(1<<10)
    
write_short(1<<10)
    
write_short(0x0000)
    
write_byte(255)
    
write_byte(150)
    
write_byte(0)
    
write_byte(75)
    
message_end()
}

public 
screen_fade_armor(pPlayer) {
    
message_begin(MSG_ONEg_msgScreenFade, {0,0,0}, pPlayer
    
write_short(1<<10)
    
write_short(1<<10)
    
write_short(0x0000)
    
write_byte(0)
    
write_byte(0)
    
write_byte(255)
    
write_byte(75)
    
message_end()
}

public 
screen_fade_money(pPlayer) {
    
message_begin(MSG_ONEg_msgScreenFade, {0,0,0}, pPlayer
    
write_short(1<<10)
    
write_short(1<<10)
    
write_short(0x0000)
    
write_byte(0)
    
write_byte(150)
    
write_byte(0)
    
write_byte(75)
    
message_end()
}    

stock UTIL_get_user_humanpPlayer )
{
    return ( !
zp_get_user_zombiepPlayer ) && !zp_get_user_nemesispPlayer ) && !zp_get_user_survivorpPlayer ) )
}

public 
register_ham_czbotspPlayer )
{
    if( 
g_hamczbots || !is_user_connectedpPlayer ) || !get_pcvar_numcvar_botquota ) ) 
    {
        return;
    }
    
    
RegisterHamFromEntityHam_KilledpPlayer"CBasePlayer__Killed_Post");

    
g_hamczbots true;
}

public 
client_putinserverpPlayer )
{
    if( 
is_user_botpPlayer ) && !g_hamczbots && cvar_botquota 
    {
        
set_task0.1"register_ham_czbots"pPlayer );
    }


Last edited by MayroN; 03-24-2020 at 13:38.
MayroN is offline
Send a message via ICQ to MayroN Send a message via Skype™ to MayroN
Reply


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 16:56.


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