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

Solved remove entity when round start


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
lexzor
Veteran Member
Join Date: Nov 2020
Old 08-10-2021 , 10:23   remove entity when round start
Reply With Quote #1

hello. i have this code. can someone add remove entity function at round start ? i never played with ents also if someone can add a new bonus from box: max movement speed (with curweapon pls)

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

#define PLUGIN "BonusBox"
#define VERSION "1.0"
#define AUTHOR "SkepT Jr."

new const iTag[] = "^4[^3CSGO^4]^1"
new const ClassName [ ] = "BonusBox"
new models_box [] = {    
    
"models/csgoclassy_case/csgoclassy_case.mdl"
};


const 
UNIT_SEC 0x1000;
const 
FFADE 0x0000;

#define FFADE_IN        0x0000        
#define FFADE_OUT        0x0001        
#define FFADE_MODULATE        0x0002        
#define FFADE_STAYOUT        0x0004    
#define SPEEDBOX         600.0    

native set_user_scraps(idvalue)
    
native set_user_money(idvalue)
    
native set_user_keys(idvalue)
    
native set_user_cases(idvalue)
    
native get_user_scraps(id)
    
native get_user_money(id)
    
native get_user_keys(id)
    
native get_user_cases(id)
    
native is_user_logged(id)
    

public 
plugin_init ( ) {
    
    
register_plugin PLUGINVERSIONAUTHOR );
    
register_event "DeathMsg""eDeath""a" );
    
register_forward FM_PlayerPreThink"ForcePlayerSpeed" );
    
register_forward FM_Touch"Touch" );
    
    
register_clcmd("qwe""give_bonus2" )

    
    
register_event("HLTV""Event_HLTV_New_Round""a""1=0""2=0")
    
// Add your code here...
}

public 
Event_HLTV_New_Round()
{
    new 
ent = -1
    
while( (find_ent_by_class(entClassName)) > )
    {
        
remove_entity(ent)
    }
}

public 
plugin_precache() {
    for(new 
isizeof (models_box) ; i++)
        
precache_model(models_box)
}

public 
give_bonus2(id)
{
    
bonus_box(id)
}

public 
eDeath ( ) {
    
    new 
iKiller read_data (1);
    new 
iVictim read_data (2);
    new 
iRandom random_num(110)
    
    if ( 
iKiller == iVictim ) {
        
        return 
PLUGIN_HANDLED;
        
    }
    
    if(
iRandom >= 9)
    {
        
bonus_box iVictim );
    }
    else
        return 
PLUGIN_HANDLED
    
    
return PLUGIN_CONTINUE;
}



public 
bonus_box id ) {
    
    if ( 
is_user_connected id ) && cs_get_user_team id ) != CS_TEAM_SPECTATOR ) {
        
        new 
Ent fm_create_entity "info_target" );
        new 
Origin ];
        
get_user_origin idOrigin);
        
set_pev Entpev_classnameClassName )
        
        
engfunc EngFunc_SetModelEntmodels_box [0] );
        
        
set_pev Entpev_minsFloat: { -10.0,-10.0,0.0 } );
        
set_pev Entpev_maxsFloat: { 10.0,10.0,25.0 } );
        
set_pev Entpev_sizeFloat: { -10.0,-10.0,0.0,10.0,10.0,25.0 } ); 
        
engfunc EngFunc_SetSizeEntFloat: { -10.0, -10.00.0 }, Float: { 10.010.025.0 } );
        
        
set_pev Ent,pev_solidSOLID_BBOX );
        
set_pev Ent,pev_movetypeMOVETYPE_TOSS );
        
        new 
FloatfOrigin ];
        
IVecFVec OriginfOrigin );
        
set_pev Entpev_originfOrigin );
        
    }
    
}

public 
Touch touchertouched )
{
    
    if ( !
is_user_alivetoucher ) || !pev_validtouched ) )
        return 
FMRES_IGNORED;
    
    new 
classname 32 ];    
    
pevtouchedpev_classnameclassname31 );
    
    if (!
equalclassnameClassName ) )
        return 
FMRES_IGNORED;
    
    
set_pev touchedpev_effectsEF_NODRAW );
    
set_pev touchedpev_solidSOLID_NOT );
    
    if (!
remove_entitytouched ))
        return 
FMRES_IGNORED;
    
    if(
is_user_logged(toucher) == 1)
    {
        
give_bonustoucher );
    }
    else
    {
        
client_print_color(toucherprint_team_default"%s You have to be logged in to get this bonus!"iTag)
        
remove_entitytouched )
    }
    
    return 
FMRES_IGNORED;  
}

public 
give_bonus id )
{
    new 
iRandomiChance
    
    iRandom 
random_num(0,5)
    
    new 
iRandomBonusiMoney[MAX_PLAYERS 1], iCases[MAX_PLAYERS 1], iKeys[MAX_PLAYERS 1], iScraps[MAX_PLAYERS 1]
    
    switch(
iRandom)
    {
        case 
0:
        {
            
iMoney[id] = get_user_money(id)            
            
            
iChance random_num(0,10)
            
            
iRandomBonus random_num(0,5)
            
            if (
iChance >= && iRandomBonus != 0)
            {
                
iRandomBonus *= -1
            
}
            
            if (
iRandomBonus == 0)
            {
                
client_print_color(idprint_team_default"%s You didn't get anything!"iTagiRandomBonus)
                return 
PLUGIN_HANDLED
            
}
            else if (
iRandomBonus 0)
            {
                
iRandomBonus *= -1
                
                
if (iMoney[id] - iRandomBonus <= 0)
                {
                    
client_print_color(idprint_team_default"%s You haven't lost anything because you don't have enough^4 money^1."iTag)
                    return 
PLUGIN_HANDLED
                
}
                
                
set_user_money(idiMoney[id] - iRandomBonus)
                
client_print_color(idprint_team_default"%s You lost^4 %i dolar%s^1."iTagiRandomBonusiRandomBonus == "" "s")    
                return 
PLUGIN_HANDLED
            
}
            else if (
iRandomBonus 0)
            {
                
set_user_money(idiMoney[id] + iRandomBonus)
                
client_print_color(idprint_team_default"%s You got^4 %i dolar%s^1."iTagiRandomBonusiRandomBonus == "" "s")        
                return 
PLUGIN_HANDLED
            
}
        }
        
        case 
1:    
        {
            
iCases[id] = get_user_cases(id)
            
            
iChance random_num(0,10)
            
            
iRandomBonus random_num(0,3)
            
            if (
iChance >= && iRandomBonus != 0)
            {
                
iRandomBonus *= -1
            
}
            
            if (
iRandomBonus == 0)
            {
                
client_print_color(idprint_team_default"%s You didn't get anything!"iTagiRandomBonus)
                return 
PLUGIN_HANDLED
            
}
            else if (
iRandomBonus 0)
            {
                
                
iRandomBonus *= -1
                
                
if (iCases[id] - iRandomBonus <= 0)
                {
                    
client_print_color(idprint_team_default"%s You haven't lost anything because you don't have enough^4 cases^1."iTag)
                    return 
PLUGIN_HANDLED
                
}
                
                
set_user_cases(idiCases[id] - iRandomBonus)
                
client_print_color(idprint_team_default"%s You lost^4 %i case%s^1."iTagiRandomBonusiRandomBonus == "" "s")    
                return 
PLUGIN_HANDLED
            
}
            else if (
iRandomBonus 0)
            {
                
set_user_cases(idiCases[id] + iRandomBonus)
                
client_print_color(idprint_team_default"%s You got^4 %i case%s^1."iTagiRandomBonusiRandomBonus == "" "s")        
                return 
PLUGIN_HANDLED
            
}
        }
        
        case 
2:
        {
            
iKeys[id] = get_user_keys(id)
            
            
iChance random_num(0,10)
            
            
iRandomBonus random_num(0,5)
            
            if (
iChance >= && iRandomBonus != 0)
            {
                
iRandomBonus *= -1
            
}
            
            if (
iRandomBonus == 0)
            {
                
client_print_color(idprint_team_default"%s You didn't get anything!"iTagiRandomBonus)
                return 
PLUGIN_HANDLED
            
}
            else if (
iRandomBonus 0)
            {
                
iRandomBonus *= -1
                
                
if (iKeys[id] - iRandomBonus <= 0)
                {
                    
client_print_color(idprint_team_default"%s You haven't lost anything because you don't have enough^4 keys^1."iTag)
                    return 
PLUGIN_HANDLED
                
}
                
                
set_user_keys(idiKeys[id] - iRandomBonus)
                
client_print_color(idprint_team_default"%s You lost^4 %i key%s^1."iTagiRandomBonusiRandomBonus == "" "s")    
                return 
PLUGIN_HANDLED
            
}
            else if (
iRandomBonus 0)
            {
                
set_user_keys(idiKeys[id] + iRandomBonus)
                
client_print_color(idprint_team_default"%s You got^4 %i key%s^1."iTagiRandomBonusiRandomBonus == "" "s")        
                return 
PLUGIN_HANDLED
            
}
        }
        
        case 
3:
        {
            
iScraps[id] = get_user_scraps(id)
            
            
iChance random_num(0,10)
            
            
iRandomBonus random_num(0,8)
            
            if (
iChance >= && iRandomBonus != 0)
            {
                
iRandomBonus *= -1
            
}
            
            if (
iRandomBonus == 0)
            {
                
client_print_color(idprint_team_default"%s You didn't get anything!"iTagiRandomBonus)
                return 
PLUGIN_HANDLED
            
}
            else if (
iRandomBonus 0)
            {
                
iRandomBonus *= -1
                
                
if (iScraps[id] - iRandomBonus <= 0)
                {
                    
client_print_color(idprint_team_default"%s You haven't lost anything because you don't have enough^4 scraps^1."iTag)
                    return 
PLUGIN_HANDLED
                
}
                
                
set_user_scraps(idiScraps[id] - iRandomBonus)
                
client_print_color(idprint_team_default"%s You lost^4 %i scrap%s^1."iTagiRandomBonusiRandomBonus == "" "s")    
                return 
PLUGIN_HANDLED
            
}
            else if (
iRandomBonus 0)
            {
                
set_user_scraps(idiScraps[id] + iRandomBonus)
                
client_print_color(idprint_team_default"%s You got^4 %i scrap%s^1."iTagiRandomBonusiRandomBonus == "" "s")        
                return 
PLUGIN_HANDLED
            
}
        }
        
        case 
4:
        {
            if(
is_user_alive(id))
            {
                new 
iRandomHPiRandomAM
                
                iRandomHP 
random_num(1,20)
                
iRandomAM random_num(1,20)
                
                
set_user_health(idget_user_health(id) + iRandomHP)
                
set_user_armor(idget_user_armor(id) + iRandomAM)
                
                
client_print_color(idprint_team_default"%s You got^4 %i Health^1 and^4 %i Armor^1."iTag,iRandomHPiRandomAM)
            }
            else
                return 
PLUGIN_HANDLED
        
}
        
        case 
5
        {
            if(
is_user_alive(id))
            {
                
set_user_gravity(id0.6)
                
client_print_color(idprint_team_default"%s You got^4 lower gravity^1, but only for this round!"iTag)
            }
            else
                return 
PLUGIN_HANDLED
        
}
    }
    
    return 
PLUGIN_CONTINUE

thank you

Last edited by lexzor; 08-18-2021 at 11:37.
lexzor is offline
lexzor
Veteran Member
Join Date: Nov 2020
Old 08-16-2021 , 13:37   Re: remove entity when round start
Reply With Quote #2

someone who can help ?
lexzor is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 08-17-2021 , 00:12   Re: remove entity when round start
Reply With Quote #3

For removing the entities on roundstart replace this...
PHP Code:
public Event_HLTV_New_Round()
{
    new 
ent = -1
    
while( (find_ent_by_class(entClassName)) > )
    {
        
remove_entity(ent)
    }

With this....

PHP Code:
public Event_HLTV_New_Round()
{
    
remove_entity_name(ClassName);

__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !


Last edited by Natsheh; 08-17-2021 at 00:17.
Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
lexzor
Veteran Member
Join Date: Nov 2020
Old 08-18-2021 , 11:37   Re: remove entity when round start
Reply With Quote #4

thanks
lexzor is offline
Reply



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

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

Forum Jump


All times are GMT -4. The time now is 15:23.


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