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

Subplugin Submission [ZP] Extra Item: Sand Bags BETA!


Post New Thread Reply   
 
Thread Tools Display Modes
vikasvishwakarma
Member
Join Date: Mar 2013
Old 12-08-2015 , 05:58   Re: [ZP] Extra Item: Sand Bags BETA!
Reply With Quote #101

Quote:
Originally Posted by Chihuahuax View Post
lol my bad sorry, it should be "false"
lol. anyway can you please fix it. even with false it dose not work. in first round i can plant 2 sandbag, but in second round the sandbag dose not decipher and if someone has broken the sandbag in first round it wont allow the player to place sandbag in second round it says Max sandbag limit reached!

I want it to be 2 sandbag per round per player...

Last edited by vikasvishwakarma; 12-08-2015 at 06:02.
vikasvishwakarma is offline
Krtola
Veteran Member
Join Date: Oct 2013
Location: Serbia
Old 12-09-2015 , 04:30   Re: [ZP] Extra Item: Sand Bags BETA!
Reply With Quote #102

Quote:
Originally Posted by vikasvishwakarma View Post
I want it to be 2 sandbag per round per player...
Try this:
PHP Code:
/*================================================================================
    
    -----------------------------------
    -*- [ZP] Sandbags -*-
    -----------------------------------
    
    ~~~~~~~~~~~~~~~
    - Description -
    ~~~~~~~~~~~~~~~
    
    Original by SAMURAI, Upgraded to zp by LARP
    [email protected] (Chile) Languaje spanish!
    
================================================================================*/


#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
#include <xs>
#include <fun>
#include <zombieplague.inc>

// The sizes of models
#define PALLET_MINS Float:{ -27.260000, -22.280001, -22.290001 }
#define PALLET_MAXS Float:{  27.340000,  26.629999,  29.020000 }


// from fakemeta util by VEN
#define fm_find_ent_by_class(%1,%2) engfunc(EngFunc_FindEntityByString, %1, "classname", %2)
#define fm_remove_entity(%1) engfunc(EngFunc_RemoveEntity, %1)
// this is mine
#define fm_drop_to_floor(%1) engfunc(EngFunc_DropToFloor,%1)

// cvars
new pnumpluginremove_nrndmaxpalletsphealth;

// num of pallets with bags
new palletscout 0;

/* Models for pallets with bags .
  Are available 2 models, will be set a random of them  */
new g_models[][] =
{
    
"models/pallet_with_bags2.mdl",
    
"models/pallet_with_bags.mdl"
}

new 
stuck[33]
new 
g_bolsas[33];
new 
cvar[3]

new const 
Float:size[][3] = {
    {
0.00.01.0}, {0.00.0, -1.0}, {0.01.00.0}, {0.0, -1.00.0}, {1.00.00.0}, {-1.00.00.0}, {-1.01.01.0}, {1.01.01.0}, {1.0, -1.01.0}, {1.01.0, -1.0}, {-1.0, -1.01.0}, {1.0, -1.0, -1.0}, {-1.01.0, -1.0}, {-1.0, -1.0, -1.0},
    {
0.00.02.0}, {0.00.0, -2.0}, {0.02.00.0}, {0.0, -2.00.0}, {2.00.00.0}, {-2.00.00.0}, {-2.02.02.0}, {2.02.02.0}, {2.0, -2.02.0}, {2.02.0, -2.0}, {-2.0, -2.02.0}, {2.0, -2.0, -2.0}, {-2.02.0, -2.0}, {-2.0, -2.0, -2.0},
    {
0.00.03.0}, {0.00.0, -3.0}, {0.03.00.0}, {0.0, -3.00.0}, {3.00.00.0}, {-3.00.00.0}, {-3.03.03.0}, {3.03.03.0}, {3.0, -3.03.0}, {3.03.0, -3.0}, {-3.0, -3.03.0}, {3.0, -3.0, -3.0}, {-3.03.0, -3.0}, {-3.0, -3.0, -3.0},
    {
0.00.04.0}, {0.00.0, -4.0}, {0.04.00.0}, {0.0, -4.00.0}, {4.00.00.0}, {-4.00.00.0}, {-4.04.04.0}, {4.04.04.0}, {4.0, -4.04.0}, {4.04.0, -4.0}, {-4.0, -4.04.0}, {4.0, -4.0, -4.0}, {-4.04.0, -4.0}, {-4.0, -4.0, -4.0},
    {
0.00.05.0}, {0.00.0, -5.0}, {0.05.00.0}, {0.0, -5.00.0}, {5.00.00.0}, {-5.00.00.0}, {-5.05.05.0}, {5.05.05.0}, {5.0, -5.05.0}, {5.05.0, -5.0}, {-5.0, -5.05.0}, {5.0, -5.0, -5.0}, {-5.05.0, -5.0}, {-5.0, -5.0, -5.0}
}

new const 
g_item_name[] = { "15 Sandbags" }
const 
g_item_bolsas 0
new g_itemid_bolsas
new ZPSTUCKg_BINDMODEg_MSGMODE

/*************************************************************
************************* AMXX PLUGIN *************************
**************************************************************/


public plugin_init() 
{
    
/* Register the plugin */
    //register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR)
    
    
register_plugin("[ZP] Extra: SandBags""1.1""LARP")

        
register_logevent("round_end"2"1=Round_End")

    
set_task(0.1,"checkstuck",0,"",0,"b")
    
g_itemid_bolsas zp_register_extra_item(g_item_nameg_item_bolsasZP_TEAM_HUMAN)
    
/* Register the cvars */
    
g_BINDMODE    register_cvar("zp_pb_bind","0");        //Auto bind L Key!
    
g_MSGMODE    register_cvar("zp_pb_msg","1");        //
    
ZPSTUCK register_cvar("zp_pb_stuck","1")
    
pnumplugin register_cvar("zp_pb_enable","1"); // 1 = ON ; 0 = OFF
    
remove_nrnd register_cvar("zp_pb_remround","1");
    
maxpallets register_cvar("zp_pb_limit","200"); // max number of pallets with bags
    
phealth register_cvar("zp_pb_health","200"); // set the health to a pallet with bags
    
    /* Game Events */
    
register_event("HLTV","event_newround""a","1=0""2=0"); // it's called every on new round
    
    /* This is for menuz: */
    
register_menucmd(register_menuid("\ySand Bags:"), 1023"menu_command" );
    
register_clcmd("say /pb","show_the_menu");
    
register_clcmd("/pb","show_the_menu");
    
//cvar[0] = register_cvar("zp_autounstuck","1")
    
cvar[1] = register_cvar("zp_pb_stuckeffects","1")
    
cvar[2] = register_cvar("zp_pb_stuckwait","7")

}


public 
plugin_precache()
{
    for(new 
i;sizeof g_models;i++)
        
engfunc(EngFunc_PrecacheModel,g_models[i]);
}

public 
show_the_menu(id,level,cid)
{
    
// check if user doesen't have admin 
    /*if( ! cmd_access( id,level, cid , 0 ))
        return PLUGIN_HANDLED;
    */
    
    // check if the plugin cvar is turned off
    
if( ! get_pcvar_numpnumplugin ) )
        return 
PLUGIN_HANDLED;
        
        
    
// check if user isn't alive
    
if( ! is_user_aliveid ) )
    {
        
client_printidprint_chat"" ); //msg muerto
        
return PLUGIN_HANDLED;
    }
            
    if ( !
zp_get_user_zombie(id) )
    {        
        new 
szMenuBody[256];
        new 
keys;
        
        new 
nLen formatszMenuBody255"\ySand Bags:^n" );
        
nLen += formatszMenuBody[nLen], 255-nLen"^n\w1. Place a Sandbags (%i Remaining)"g_bolsas[id] );
        
//nLen += format( szMenuBody[nLen], 255-nLen, "^n\w2. Remove a pallet with bags" );
        
nLen += formatszMenuBody[nLen], 255-nLen"^n^n\w0. Exit" );

        
keys = (1<<0|1<<1|1<<2|1<<3|1<<4|1<<5|1<<6|1<<9)

        
show_menuidkeysszMenuBody, -);

        
// depends what you want, if is continue will appear on chat what the admin sayd
        
return PLUGIN_HANDLED;
    }
    
client_print(idprint_chat"[ZP] The zombies can not use this command!")
    return 
PLUGIN_HANDLED;
}


public 
menu_command(id,key,level,cid)
{
    
    switch( 
key )
    {
        
// place a pallet with bags
        
case 0
        {
            if ( !
zp_get_user_zombie(id) )
            {
                new 
money g_bolsas[id]
                if ( 
money )
                {
                    if ( 
get_pcvar_num(g_MSGMODE) == )
                        {
                            
set_hudmessage(001000.800.8006.02.01.01.0)
                            
show_hudmessage(id"You do not have to^nplace sandbags")
                            return 
PLUGIN_CONTINUE
                        
}
                    
client_print(idprint_chat"[ZP] You do not have to place sandbags!")
                    return 
PLUGIN_CONTINUE
                
}
                
g_bolsas[id]-= 1
                place_palletwbags
(id);
                
show_the_menu(id,level,cid);
                return 
PLUGIN_CONTINUE    
            
}
            
client_print(idprint_chat"[ZP] The zombies can not use this!!")
            return 
PLUGIN_CONTINUE    
        
}
        
        
// remove a pallet with bags
        /*case 1:
        {
            if ( !zp_get_user_zombie(id) )
            {
                new ent, body, class[32];
                get_user_aiming(id, ent, body);
                if (pev_valid(ent)) 
                {
                    pev(ent, pev_classname, class, 31);
                    
                    if (equal(class, "amxx_pallets")) 
                    {
                        g_bolsas[id]+= 1
                        fm_remove_entity(ent);
                    }
                    
                    else
                        client_print(id, print_chat, "[ZP] You are not aiming at a pallet with bags");
                }
                else
                    client_print(id, print_chat, "[ZP] You are not aiming at a valid entity !");
                    
                show_the_menu(id,level,cid);
            }
        }
        */
        
        // remove all pallets with bags
        /*case 2:
        {
            g_bolsas[id]= 0
            remove_allpalletswbags();
            client_print(id,print_chat,"[AMXX] You removed all pallets with bags !");
            show_the_menu(id,level,cid);
        }
            */
            
    
}
    
    return 
PLUGIN_HANDLED;
}



public 
place_palletwbags(id)
{
    
    if( 
palletscout == get_pcvar_num(maxpallets) )
    {
        
client_print(id,print_chat,"[ZP] For security reasons only allow %d Sandbags on the server!",get_pcvar_num(maxpallets));
        return 
PLUGIN_HANDLED;
    }
    
    
// create a new entity 
    
new ent engfunc(EngFunc_CreateNamedEntityengfunc(EngFunc_AllocString"func_wall"));
    
    
    
// set a name to the entity
    
set_pev(ent,pev_classname,"amxx_pallets");
    
    
// set model        
    
engfunc(EngFunc_SetModel,ent,g_models[random(sizeof g_models)]);
    
    
// register a new var. for origin
    
static Float:xorigin[3];
    
get_user_hitpoint(id,xorigin);
    
    
    
// check if user is aiming at the air 
    
if(engfunc(EngFunc_PointContents,xorigin) == CONTENTS_SKY)
    {
        
client_print(id,print_chat,"[ZP] You can not put sandbags in the sky!");
        return 
PLUGIN_HANDLED;
    }
    
    
    
// set sizes
    
static Float:p_mins[3], Float:p_maxs[3];
    
p_mins PALLET_MINS;
    
p_maxs PALLET_MAXS;
    
engfunc(EngFunc_SetSizeentp_minsp_maxs);
    
set_pev(entpev_minsp_mins);
    
set_pev(entpev_maxsp_maxs );
    
set_pev(entpev_absminp_mins);
    
set_pev(entpev_absmaxp_maxs );

    
    
// set the rock of origin where is user placed
    
engfunc(EngFunc_SetOriginentxorigin);
    
    
    
// make the rock solid
    
set_pev(ent,pev_solid,SOLID_BBOX); // touch on edge, block
    
    // set the movetype
    
set_pev(ent,pev_movetype,MOVETYPE_FLY); // no gravity, but still collides with stuff
    
    // now the damage stuff, to set to take it or no
    // if you set the cvar "pallets_wbags_health" 0, you can't destroy a pallet with bags
    // else, if you want to make it destroyable, just set the health > 0 and will be
    // destroyable.
    
new Float:p_cvar_health get_pcvar_float(phealth);
    switch(
p_cvar_health)
    {
        case 
0.0 :
        {
            
set_pev(ent,pev_takedamage,DAMAGE_NO);
        }
        
        default :
        {
            
set_pev(ent,pev_health,p_cvar_health);
            
set_pev(ent,pev_takedamage,DAMAGE_YES);
        }
    }
    
            
    static 
Float:rvec[3];
    
pev(id,pev_v_angle,rvec);
    
    
rvec[0] = 0.0;
    
    
set_pev(ent,pev_angles,rvec);
    
    
// drop entity to floor
    
fm_drop_to_floor(ent);
    
    
// num ..
    
palletscout++;
    
    
// confirm message
    
if ( get_pcvar_num(g_MSGMODE) == )
    {
        
set_hudmessage(001000.800.8006.02.01.01.0)
        
show_hudmessage(id"You placed a SandBag^n%i Remaining"g_bolsas[id])
        return 
PLUGIN_HANDLED
    
}
    
client_print(idprint_chat"[ZP] You have placed a Sandbag.")
    return 
PLUGIN_HANDLED;
}
    
/* ====================================================
get_user_hitpoin stock . Was maked by P34nut, and is 
like get_user_aiming but is with floats and better :o
====================================================*/    
stock get_user_hitpoint(idFloat:hOrigin[3]) 
{
    if ( ! 
is_user_aliveid ))
        return 
0;
    
    new 
Float:fOrigin[3], Float:fvAngle[3], Float:fvOffset[3], Float:fvOrigin[3], Float:feOrigin[3];
    new 
Float:fTemp[3];
    
    
pev(idpev_originfOrigin);
    
pev(idpev_v_anglefvAngle);
    
pev(idpev_view_ofsfvOffset);
    
    
xs_vec_add(fOriginfvOffsetfvOrigin);
    
    
engfunc(EngFunc_AngleVectorsfvAnglefeOriginfTempfTemp);
    
    
xs_vec_mul_scalar(feOrigin9999.9feOrigin);
    
xs_vec_add(fvOriginfeOriginfeOrigin);
    
    
engfunc(EngFunc_TraceLinefvOriginfeOrigin0id);
    
global_get(glb_trace_endposhOrigin);
    
    return 
1;



/* ====================================================
This is called on every round, at start up,
with HLTV logevent. So if the "pallets_wbags_nroundrem"
cvar is set to 1, all placed pallets with bugs will be
removed.
====================================================*/
public event_newround()
{
    if( 
get_pcvar_num remove_nrnd ) == 1)
        
remove_allpalletswbags();
        
}


/* ====================================================
This is a stock to help for remove all pallets with
bags placed . Is called on new round if the cvar
"pallets_wbags_nroundrem" is set 1.
====================================================*/
stock remove_allpalletswbags()
{
    new 
pallets = -1;
    while((
pallets fm_find_ent_by_class(pallets"amxx_pallets")))
        
fm_remove_entity(pallets);
        
    
palletscout 0;
}

public 
round_end()
{
        
palletscout 0
}

public 
checkstuck() {
    if ( 
get_pcvar_num(ZPSTUCK) == )
    {
        static 
players[32], pnumplayer
        get_players
(playerspnum)
        static 
Float:origin[3]
        static 
Float:mins[3], hull
        
static Float:vec[3]
        static 
o,i
        
for(i=0i<pnumi++){
            
player players[i]
            if (
is_user_connected(player) && is_user_alive(player)) {
                
pev(playerpev_originorigin)
                
hull pev(playerpev_flags) & FL_DUCKING HULL_HEAD HULL_HUMAN
                
if (!is_hull_vacant(originhull,player) && !get_user_noclip(player) && !(pev(player,pev_solid) & SOLID_NOT)) {
                    ++
stuck[player]
                    if(
stuck[player] >= get_pcvar_num(cvar[2])) {
                        
pev(playerpev_minsmins)
                        
vec[2] = origin[2]
                        for (
o=0sizeof size; ++o) {
                            
vec[0] = origin[0] - mins[0] * size[o][0]
                            
vec[1] = origin[1] - mins[1] * size[o][1]
                            
vec[2] = origin[2] - mins[2] * size[o][2]
                            if (
is_hull_vacant(vechull,player)) {
                                
engfunc(EngFunc_SetOriginplayervec)
                                
effects(player)
                                
set_pev(player,pev_velocity,{0.0,0.0,0.0})
                                
sizeof size
                            
}
                        }
                    }
                }
                else
                {
                    
stuck[player] = 0
                
}
            }
        }
    
    }
    
}

stock bool:is_hull_vacant(const Float:origin[3], hull,id) {
    static 
tr
    engfunc
(EngFunc_TraceHulloriginorigin0hullidtr)
    if (!
get_tr2(trTR_StartSolid) || !get_tr2(trTR_AllSolid)) //get_tr2(tr, TR_InOpen))
        
return true
    
    
return false
}

public 
effects(id) {
    if(
get_pcvar_num(cvar[1])) {
        
set_hudmessage(255,150,50, -1.00.6506.01.5,0.1,0.7// HUDMESSAGE
        
show_hudmessage(id,"Automatic Unstuck!"// HUDMESSAGE
        
message_begin(MSG_ONE_UNRELIABLE,105,{0,0,0},id )      
        
write_short(1<<10)   // fade lasts this long duration
        
write_short(1<<10)   // fade lasts this long hold time
        
write_short(1<<1)   // fade type (in / out)
        
write_byte(20)            // fade red
        
write_byte(255)    // fade green
        
write_byte(255)        // fade blue
        
write_byte(255)    // fade alpha
        
message_end()
        
client_cmd(id,"spk fvox/blip.wav")
    }
}

public 
zp_extra_item_selected(playeritemid)
{
    if (
itemid == g_itemid_bolsas)
    {
        
g_bolsas[player]+= 15
        cmd_bind
(player)
        
set_task(0.3,"show_the_menu",player)
        if ( 
get_pcvar_num(g_MSGMODE) == )
        {
            
set_hudmessage(001000.800.8006.02.01.01.0)
            
show_hudmessage(player"Plugin By LARP^n    Chile 2008")
        }
    }

}

public 
cmd_bind(id)
{
    if ( 
get_pcvar_num(g_BINDMODE) == )
    {
        
client_print(idprint_chat"[ZP] You have %i sandbags, to use with the key 'L'"g_bolsas[id])
        
client_cmd(id,"bind l /pb")
        return 
PLUGIN_HANDLED
    
}
    
client_print(idprint_chat"[ZP] You have %i sandbags, to use type 'say /pb'"g_bolsas[id])
    return 
PLUGIN_HANDLED


Krtola is offline
Send a message via Skype™ to Krtola
Chihuahuax
Senior Member
Join Date: Oct 2014
Location: Malaysia
Old 12-09-2015 , 05:20   Re: [ZP] Extra Item: Sand Bags BETA!
Reply With Quote #103

here you go
Attached Files
File Type: sma Get Plugin or Get Source (sandbag.sma - 907 views - 17.5 KB)
Chihuahuax is offline
Send a message via Skype™ to Chihuahuax
vikasvishwakarma
Member
Join Date: Mar 2013
Old 12-10-2015 , 16:47   Re: [ZP] Extra Item: Sand Bags BETA!
Reply With Quote #104

thanks for the help
vikasvishwakarma is offline
Mihai94
Junior Member
Join Date: Feb 2018
Old 02-27-2018 , 11:10   Re: [ZP] Extra Item: Sand Bags BETA!
Reply With Quote #105

hello, can you make this sandbags plugin like when a smash breaks the bag to chat in on all the players who broke it?


PHP Code:
/*================================================================================
    
    -----------------------------------
    -*- [ZP] Sandbags -*-
    -----------------------------------
    
    ~~~~~~~~~~~~~~~
    - Description -
    ~~~~~~~~~~~~~~~
    
    Original by SAMURAI, Upgraded to zp by LARP
    [email protected] (Chile) Languaje spanish!
    
================================================================================*/


#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
#include <xs>
#include <fun>
#include <zombie_plague_special.inc>

// The sizes of models
#define PALLET_MINS Float:{ -27.260000, -22.280001, -22.290001 }
#define PALLET_MAXS Float:{  27.340000,  26.629999,  29.020000 }


// from fakemeta util by VEN
#define fm_find_ent_by_class(%1,%2) engfunc(EngFunc_FindEntityByString, %1, "classname", %2)
#define fm_remove_entity(%1) engfunc(EngFunc_RemoveEntity, %1)
// this is mine
#define fm_drop_to_floor(%1) engfunc(EngFunc_DropToFloor,%1)

// cvars
new pnumpluginremove_nrndmaxpalletsphealth;

// num of pallets with bags
new palletscout 0;

/* Models for pallets with bags .
  Are available 2 models, will be set a random of them  */
new g_models[][] =
{
    
"models/pallet_with_bags2.mdl",
    
"models/pallet_with_bags.mdl"
}

new 
stuck[33]
new 
g_bolsas[33];
new 
cvar[3]

new const 
Float:size[][3] = {
    {
0.00.01.0}, {0.00.0, -1.0}, {0.01.00.0}, {0.0, -1.00.0}, {1.00.00.0}, {-1.00.00.0}, {-1.01.01.0}, {1.01.01.0}, {1.0, -1.01.0}, {1.01.0, -1.0}, {-1.0, -1.01.0}, {1.0, -1.0, -1.0}, {-1.01.0, -1.0}, {-1.0, -1.0, -1.0},
    {
0.00.02.0}, {0.00.0, -2.0}, {0.02.00.0}, {0.0, -2.00.0}, {2.00.00.0}, {-2.00.00.0}, {-2.02.02.0}, {2.02.02.0}, {2.0, -2.02.0}, {2.02.0, -2.0}, {-2.0, -2.02.0}, {2.0, -2.0, -2.0}, {-2.02.0, -2.0}, {-2.0, -2.0, -2.0},
    {
0.00.03.0}, {0.00.0, -3.0}, {0.03.00.0}, {0.0, -3.00.0}, {3.00.00.0}, {-3.00.00.0}, {-3.03.03.0}, {3.03.03.0}, {3.0, -3.03.0}, {3.03.0, -3.0}, {-3.0, -3.03.0}, {3.0, -3.0, -3.0}, {-3.03.0, -3.0}, {-3.0, -3.0, -3.0},
    {
0.00.04.0}, {0.00.0, -4.0}, {0.04.00.0}, {0.0, -4.00.0}, {4.00.00.0}, {-4.00.00.0}, {-4.04.04.0}, {4.04.04.0}, {4.0, -4.04.0}, {4.04.0, -4.0}, {-4.0, -4.04.0}, {4.0, -4.0, -4.0}, {-4.04.0, -4.0}, {-4.0, -4.0, -4.0},
    {
0.00.05.0}, {0.00.0, -5.0}, {0.05.00.0}, {0.0, -5.00.0}, {5.00.00.0}, {-5.00.00.0}, {-5.05.05.0}, {5.05.05.0}, {5.0, -5.05.0}, {5.05.0, -5.0}, {-5.0, -5.05.0}, {5.0, -5.0, -5.0}, {-5.05.0, -5.0}, {-5.0, -5.0, -5.0}
}

new const 
g_item_name[] = { "Saci Baricada X10" }
const 
g_item_bolsas 35
new g_itemid_bolsas
new ZPSTUCKg_BINDMODEg_MSGMODE

/*************************************************************
************************* AMXX PLUGIN *************************
**************************************************************/


public plugin_init() 
{
    
/* Register the plugin */
    //register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR)
    
    
register_plugin("[ZP] Extra: Saci Baricada X10""1.1""LARP")
    
set_task(0.1,"checkstuck",0,"",0,"b")
    
g_itemid_bolsas zp_register_extra_item(g_item_nameg_item_bolsasZP_TEAM_HUMAN)
    
/* Register the cvars */
    
g_BINDMODE    register_cvar("zp_pb_bind","0");        //Auto bind L Key!
    
g_MSGMODE    register_cvar("zp_pb_msg","1");        //
    
ZPSTUCK register_cvar("zp_pb_stuck","1")
    
pnumplugin register_cvar("zp_pb_enable","1"); // 1 = ON ; 0 = OFF
    
remove_nrnd register_cvar("zp_pb_remround","1");
    
maxpallets register_cvar("zp_pb_limit","200"); // max number of pallets with bags
    
phealth register_cvar("zp_pb_health","150"); // set the health to a pallet with bags
    
    /* Game Events */
    
register_event("HLTV","event_newround""a","1=0""2=0"); // it's called every on new round
    
    /* This is for menuz: */
    
register_menucmd(register_menuid("\ySand Bags:"), 1023"menu_command" );
    
register_clcmd("say /pb","show_the_menu");
    
register_clcmd("/pb","show_the_menu");
    
//cvar[0] = register_cvar("zp_autounstuck","1")
    
cvar[1] = register_cvar("zp_pb_stuckeffects","1")
    
cvar[2] = register_cvar("zp_pb_stuckwait","7")

}


public 
plugin_precache()
{
    for(new 
i;sizeof g_models;i++)
        
engfunc(EngFunc_PrecacheModel,g_models[i]);
}

public 
show_the_menu(id,level,cid)
{
    
// check if user doesen't have admin 
    /*if( ! cmd_access( id,level, cid , 0 ))
        return PLUGIN_HANDLED;
    */
    
    // check if the plugin cvar is turned off
    
if( ! get_pcvar_numpnumplugin ) )
        return 
PLUGIN_HANDLED;
        
        
    
// check if user isn't alive
    
if( ! is_user_aliveid ) )
    {
        
client_printidprint_chat"" ); //msg muerto
        
return PLUGIN_HANDLED;
    }
            
    if ( !
zp_get_user_zombie(id) )
    {        
        new 
szMenuBody[256];
        new 
keys;
        
        new 
nLen formatszMenuBody255"\ySand Bags:^n" );
        
nLen += formatszMenuBody[nLen], 255-nLen"^n\w1. Place a Sandbags (%i Remaining)"g_bolsas[id] );
        
//nLen += format( szMenuBody[nLen], 255-nLen, "^n\w2. Remove a pallet with bags" );
        
nLen += formatszMenuBody[nLen], 255-nLen"^n^n\w0. Exit" );

        
keys = (1<<0|1<<1|1<<2|1<<3|1<<4|1<<5|1<<6|1<<9)

        
show_menuidkeysszMenuBody, -);

        
// depends what you want, if is continue will appear on chat what the admin sayd
        
return PLUGIN_HANDLED;
    }
    
client_print(idprint_chat"[ZP] The zombies can not use this command!")
    return 
PLUGIN_HANDLED;
}


public 
menu_command(id,key,level,cid)
{
    
    switch( 
key )
    {
        
// place a pallet with bags
        
case 0
        {
            if ( !
zp_get_user_zombie(id) )
            {
                new 
money g_bolsas[id]
                if ( 
money )
                {
                    if ( 
get_pcvar_num(g_MSGMODE) == )
                        {
                            
set_hudmessage(001000.800.8006.02.01.01.0)
                            
show_hudmessage(id"You do not have to^nplace sandbags")
                            return 
PLUGIN_CONTINUE
                        
}
                    
client_print(idprint_chat"[Saci Nisip] Nu Trebuie Sa Plasezi Saci De Nisip!")
                    return 
PLUGIN_CONTINUE
                
}
                
g_bolsas[id]-= 1
                place_palletwbags
(id);
                
show_the_menu(id,level,cid);
                return 
PLUGIN_CONTINUE    
            
}
            
client_print(idprint_chat"[Saci Nisip] Zombii Nu Pot Folosi Acest Item!!")
            return 
PLUGIN_CONTINUE    
        
}
        
        
// remove a pallet with bags
        /*case 1:
        {
            if ( !zp_get_user_zombie(id) )
            {
                new ent, body, class[32];
                get_user_aiming(id, ent, body);
                if (pev_valid(ent)) 
                {
                    pev(ent, pev_classname, class, 31);
                    
                    if (equal(class, "amxx_pallets")) 
                    {
                        g_bolsas[id]+= 1
                        fm_remove_entity(ent);
                    }
                    
                    else
                        client_print(id, print_chat, "[Saci Nisip] Zombi Au Ca Scop Acesti Saci Cu Paleti");
                }
                else
                    client_print(id, print_chat, "[Saci Nisip] Nu Au Ca Scop O Entitate Valida !");
                    
                show_the_menu(id,level,cid);
            }
        }
        */
        
        // remove all pallets with bags
        /*case 2:
        {
            g_bolsas[id]= 0
            remove_allpalletswbags();
            client_print(id,print_chat,"[AMXX Saci Nisip] Ati Scos Toate Tipurile De Paleti Cu Saci !");
            show_the_menu(id,level,cid);
        }
            */
            
    
}
    
    return 
PLUGIN_HANDLED;
}



public 
place_palletwbags(id)
{
    
    if( 
palletscout == get_pcvar_num(maxpallets) )
    {
        
client_print(id,print_chat,"[Saci Nisip] Ati Atins Limita Maxima De  %d Saci De Nisip Pe Server!",get_pcvar_num(maxpallets));
        return 
PLUGIN_HANDLED;
    }
    
    
// create a new entity 
    
new ent engfunc(EngFunc_CreateNamedEntityengfunc(EngFunc_AllocString"func_wall"));
    
    
    
// set a name to the entity
    
set_pev(ent,pev_classname,"amxx_pallets");
    
    
// set model        
    
engfunc(EngFunc_SetModel,ent,g_models[random(sizeof g_models)]);
    
    
// register a new var. for origin
    
static Float:xorigin[3];
    
get_user_hitpoint(id,xorigin);
    
    
    
// check if user is aiming at the air 
    
if(engfunc(EngFunc_PointContents,xorigin) == CONTENTS_SKY)
    {
        
client_print(id,print_chat,"[Saci Nisip] Nu Poti Pune Saci De Nisip Pe Cer!");
        return 
PLUGIN_HANDLED;
    }
    
    
    
// set sizes
    
static Float:p_mins[3], Float:p_maxs[3];
    
p_mins PALLET_MINS;
    
p_maxs PALLET_MAXS;
    
engfunc(EngFunc_SetSizeentp_minsp_maxs);
    
set_pev(entpev_minsp_mins);
    
set_pev(entpev_maxsp_maxs );
    
set_pev(entpev_absminp_mins);
    
set_pev(entpev_absmaxp_maxs );

    
    
// set the rock of origin where is user placed
    
engfunc(EngFunc_SetOriginentxorigin);
    
    
    
// make the rock solid
    
set_pev(ent,pev_solid,SOLID_BBOX); // touch on edge, block
    
    // set the movetype
    
set_pev(ent,pev_movetype,MOVETYPE_FLY); // no gravity, but still collides with stuff
    
    // now the damage stuff, to set to take it or no
    // if you set the cvar "pallets_wbags_health" 0, you can't destroy a pallet with bags
    // else, if you want to make it destroyable, just set the health > 0 and will be
    // destroyable.
    
new Float:p_cvar_health get_pcvar_float(phealth);
    switch(
p_cvar_health)
    {
        case 
0.0 :
        {
            
set_pev(ent,pev_takedamage,DAMAGE_NO);
        }
        
        default :
        {
            
set_pev(ent,pev_health,p_cvar_health);
            
set_pev(ent,pev_takedamage,DAMAGE_YES);
        }
    }
    
            
    static 
Float:rvec[3];
    
pev(id,pev_v_angle,rvec);
    
    
rvec[0] = 0.0;
    
    
set_pev(ent,pev_angles,rvec);
    
    
// drop entity to floor
    
fm_drop_to_floor(ent);
    
    
// num ..
    
palletscout++;
    
    
// confirm message
    
if ( get_pcvar_num(g_MSGMODE) == )
    {
        
set_hudmessage(001000.800.8006.02.01.01.0)
        
show_hudmessage(id"You placed a SandBag^n%i Remaining"g_bolsas[id])
        return 
PLUGIN_HANDLED
    
}
    
client_print(idprint_chat"[Saci Nisip] Ati Plasat Un Sac De Nisip.")
    return 
PLUGIN_HANDLED;
}
    
/* ====================================================
get_user_hitpoin stock . Was maked by P34nut, and is 
like get_user_aiming but is with floats and better :o
====================================================*/    
stock get_user_hitpoint(idFloat:hOrigin[3]) 
{
    if ( ! 
is_user_aliveid ))
        return 
0;
    
    new 
Float:fOrigin[3], Float:fvAngle[3], Float:fvOffset[3], Float:fvOrigin[3], Float:feOrigin[3];
    new 
Float:fTemp[3];
    
    
pev(idpev_originfOrigin);
    
pev(idpev_v_anglefvAngle);
    
pev(idpev_view_ofsfvOffset);
    
    
xs_vec_add(fOriginfvOffsetfvOrigin);
    
    
engfunc(EngFunc_AngleVectorsfvAnglefeOriginfTempfTemp);
    
    
xs_vec_mul_scalar(feOrigin9999.9feOrigin);
    
xs_vec_add(fvOriginfeOriginfeOrigin);
    
    
engfunc(EngFunc_TraceLinefvOriginfeOrigin0id);
    
global_get(glb_trace_endposhOrigin);
    
    return 
1;



/* ====================================================
This is called on every round, at start up,
with HLTV logevent. So if the "pallets_wbags_nroundrem"
cvar is set to 1, all placed pallets with bugs will be
removed.
====================================================*/
public event_newround()
{
    if( 
get_pcvar_num remove_nrnd ) == 1)
        
remove_allpalletswbags();
        
}


/* ====================================================
This is a stock to help for remove all pallets with
bags placed . Is called on new round if the cvar
"pallets_wbags_nroundrem" is set 1.
====================================================*/
stock remove_allpalletswbags()
{
    new 
pallets = -1;
    while((
pallets fm_find_ent_by_class(pallets"amxx_pallets")))
        
fm_remove_entity(pallets);
        
    
palletscout 0;
}

public 
checkstuck() {
    if ( 
get_pcvar_num(ZPSTUCK) == )
    {
        static 
players[32], pnumplayer
        get_players
(playerspnum)
        static 
Float:origin[3]
        static 
Float:mins[3], hull
        
static Float:vec[3]
        static 
o,i
        
for(i=0i<pnumi++){
            
player players[i]
            if (
is_user_connected(player) && is_user_alive(player)) {
                
pev(playerpev_originorigin)
                
hull pev(playerpev_flags) & FL_DUCKING HULL_HEAD HULL_HUMAN
                
if (!is_hull_vacant(originhull,player) && !get_user_noclip(player) && !(pev(player,pev_solid) & SOLID_NOT)) {
                    ++
stuck[player]
                    if(
stuck[player] >= get_pcvar_num(cvar[2])) {
                        
pev(playerpev_minsmins)
                        
vec[2] = origin[2]
                        for (
o=0sizeof size; ++o) {
                            
vec[0] = origin[0] - mins[0] * size[o][0]
                            
vec[1] = origin[1] - mins[1] * size[o][1]
                            
vec[2] = origin[2] - mins[2] * size[o][2]
                            if (
is_hull_vacant(vechull,player)) {
                                
engfunc(EngFunc_SetOriginplayervec)
                                
effects(player)
                                
set_pev(player,pev_velocity,{0.0,0.0,0.0})
                                
sizeof size
                            
}
                        }
                    }
                }
                else
                {
                    
stuck[player] = 0
                
}
            }
        }
    
    }
    
}

stock bool:is_hull_vacant(const Float:origin[3], hull,id) {
    static 
tr
    engfunc
(EngFunc_TraceHulloriginorigin0hullidtr)
    if (!
get_tr2(trTR_StartSolid) || !get_tr2(trTR_AllSolid)) //get_tr2(tr, TR_InOpen))
        
return true
    
    
return false
}

public 
effects(id) {
    if(
get_pcvar_num(cvar[1])) {
        
set_hudmessage(255,150,50, -1.00.6506.01.5,0.1,0.7// HUDMESSAGE
        
show_hudmessage(id,"Automatic Unstuck!"// HUDMESSAGE
        
message_begin(MSG_ONE_UNRELIABLE,105,{0,0,0},id )      
        
write_short(1<<10)   // fade lasts this long duration
        
write_short(1<<10)   // fade lasts this long hold time
        
write_short(1<<1)   // fade type (in / out)
        
write_byte(20)            // fade red
        
write_byte(255)    // fade green
        
write_byte(255)        // fade blue
        
write_byte(255)    // fade alpha
        
message_end()
        
client_cmd(id,"spk fvox/blip.wav")
    }
}

public 
zp_extra_item_selected(playeritemid)
{
    if (
itemid == g_itemid_bolsas)
    {
        
g_bolsas[player]+= 15
        cmd_bind
(player)
        
set_task(0.3,"show_the_menu",player)
        if ( 
get_pcvar_num(g_MSGMODE) == )
        {
            
set_hudmessage(001000.800.8006.02.01.01.0)
            
show_hudmessage(player"Plugin By LARP^n    Chile 2008")
        }
    }

}

public 
cmd_bind(id)
{
    if ( 
get_pcvar_num(g_BINDMODE) == )
    {
        
client_print(idprint_chat"[ZP] You have %i sandbags, to use with the key 'L'"g_bolsas[id])
        
client_cmd(id,"bind l /pb")
        return 
PLUGIN_HANDLED
    
}
    
client_print(idprint_chat"[ZP] You have %i sandbags, to use type 'say /pb'"g_bolsas[id])
    return 
PLUGIN_HANDLED



example: player Mihai destroyed Andrei's bag and received 3 ammo.
Mihai94 is offline
Mihai94
Junior Member
Join Date: Feb 2018
Old 03-01-2018 , 02:00   Re: [ZP] Extra Item: Sand Bags BETA!
Reply With Quote #106

up?
Mihai94 is offline
jievylook
Senior Member
Join Date: Sep 2018
Old 03-05-2019 , 12:43   Re: [ZP] Extra Item: Sand Bags BETA!
Reply With Quote #107

I urgently need someone to share the extra item of x2 sandbags, similar to the ones they have on the silentgamerz and lgz zombie plague servers.

I need that each player can only make 1 purchase of this extra item per round.

and that it changes color when the zombies are hitting the sandbags.
jievylook is offline
Krtola
Veteran Member
Join Date: Oct 2013
Location: Serbia
Old 04-25-2019 , 07:37   Re: [ZP] Extra Item: Sand Bags BETA!
Reply With Quote #108

With buy limit.

PHP Code:
/*================================================================================
    
    -----------------------------------
    -*- [ZP] Sandbags -*-
    -----------------------------------
    
    ~~~~~~~~~~~~~~~
    - Description -
    ~~~~~~~~~~~~~~~
    
    Original by SAMURAI, Upgraded to zp by LARP
    [email protected] (Chile) Languaje spanish!
    
================================================================================*/


#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
#include <xs>
#include <fun>
#include <zombieplague.inc>

// The sizes of models
#define PALLET_MINS Float:{ -27.260000, -22.280001, -22.290001 }
#define PALLET_MAXS Float:{  27.340000,  26.629999,  29.020000 }


// from fakemeta util by VEN
#define fm_find_ent_by_class(%1,%2) engfunc(EngFunc_FindEntityByString, %1, "classname", %2)
#define fm_remove_entity(%1) engfunc(EngFunc_RemoveEntity, %1)
// this is mine
#define fm_drop_to_floor(%1) engfunc(EngFunc_DropToFloor,%1)

// cvars
new pnumpluginremove_nrndmaxpalletsphealth;

// num of pallets with bags
new palletscout 0;

/* Models for pallets with bags .
  Are available 2 models, will be set a random of them  */
new g_models[][] =
{
    
"models/pallet_with_bags2.mdl",
    
"models/pallet_with_bags.mdl"
}

new 
stuck[33]
new 
g_bolsas[33];
new 
cvar[3]

new 
bool:g_just_one[33]

new const 
Float:size[][3] = {
    {
0.00.01.0}, {0.00.0, -1.0}, {0.01.00.0}, {0.0, -1.00.0}, {1.00.00.0}, {-1.00.00.0}, {-1.01.01.0}, {1.01.01.0}, {1.0, -1.01.0}, {1.01.0, -1.0}, {-1.0, -1.01.0}, {1.0, -1.0, -1.0}, {-1.01.0, -1.0}, {-1.0, -1.0, -1.0},
    {
0.00.02.0}, {0.00.0, -2.0}, {0.02.00.0}, {0.0, -2.00.0}, {2.00.00.0}, {-2.00.00.0}, {-2.02.02.0}, {2.02.02.0}, {2.0, -2.02.0}, {2.02.0, -2.0}, {-2.0, -2.02.0}, {2.0, -2.0, -2.0}, {-2.02.0, -2.0}, {-2.0, -2.0, -2.0},
    {
0.00.03.0}, {0.00.0, -3.0}, {0.03.00.0}, {0.0, -3.00.0}, {3.00.00.0}, {-3.00.00.0}, {-3.03.03.0}, {3.03.03.0}, {3.0, -3.03.0}, {3.03.0, -3.0}, {-3.0, -3.03.0}, {3.0, -3.0, -3.0}, {-3.03.0, -3.0}, {-3.0, -3.0, -3.0},
    {
0.00.04.0}, {0.00.0, -4.0}, {0.04.00.0}, {0.0, -4.00.0}, {4.00.00.0}, {-4.00.00.0}, {-4.04.04.0}, {4.04.04.0}, {4.0, -4.04.0}, {4.04.0, -4.0}, {-4.0, -4.04.0}, {4.0, -4.0, -4.0}, {-4.04.0, -4.0}, {-4.0, -4.0, -4.0},
    {
0.00.05.0}, {0.00.0, -5.0}, {0.05.00.0}, {0.0, -5.00.0}, {5.00.00.0}, {-5.00.00.0}, {-5.05.05.0}, {5.05.05.0}, {5.0, -5.05.0}, {5.05.0, -5.0}, {-5.0, -5.05.0}, {5.0, -5.0, -5.0}, {-5.05.0, -5.0}, {-5.0, -5.0, -5.0}
}

new const 
g_item_name[] = { "15 Sandbags" }
const 
g_item_bolsas 0
new g_itemid_bolsas
new ZPSTUCKg_BINDMODEg_MSGMODE

/*************************************************************
************************* AMXX PLUGIN *************************
**************************************************************/


public plugin_init() 
{
    
/* Register the plugin */
    //register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR)
    
    
register_plugin("[ZP] Extra: SandBags""1.1""LARP")
    
set_task(0.1,"checkstuck",0,"",0,"b")
    
g_itemid_bolsas zp_register_extra_item(g_item_nameg_item_bolsasZP_TEAM_HUMAN)
    
/* Register the cvars */
    
g_BINDMODE    register_cvar("zp_pb_bind","0");        //Auto bind L Key!
    
g_MSGMODE    register_cvar("zp_pb_msg","1");        //
    
ZPSTUCK register_cvar("zp_pb_stuck","1")
    
pnumplugin register_cvar("zp_pb_enable","1"); // 1 = ON ; 0 = OFF
    
remove_nrnd register_cvar("zp_pb_remround","1");
    
maxpallets register_cvar("zp_pb_limit","200"); // max number of pallets with bags
    
phealth register_cvar("zp_pb_health","200"); // set the health to a pallet with bags
    
    /* Game Events */
    
register_event("HLTV","event_newround""a","1=0""2=0"); // it's called every on new round
    
    /* This is for menuz: */
    
register_menucmd(register_menuid("\ySand Bags:"), 1023"menu_command" );
    
register_clcmd("say /pb","show_the_menu");
    
register_clcmd("/pb","show_the_menu");
    
//cvar[0] = register_cvar("zp_autounstuck","1")
    
cvar[1] = register_cvar("zp_pb_stuckeffects","1")
    
cvar[2] = register_cvar("zp_pb_stuckwait","7")

        
register_logevent("logevent_round_start"2"1=Round_Start")
        
register_logevent("round_end"2"1=Round_End")
}

public 
logevent_round_start()
{
    static 
id 

    
for(id 1id <= get_maxplayers() ; id++) 
    { 
        if(
g_just_one[id]) 
        {
            
g_just_one[id] = false
        
}
    }
}

public 
round_end()
{
    static 
id 

    
for(id 1id <= get_maxplayers() ; id++) 
    { 
        if(
g_just_one[id]) 
        {
            
g_just_one[id] = false
        
}
    }
}

public 
plugin_precache()
{
    for(new 
i;sizeof g_models;i++)
        
engfunc(EngFunc_PrecacheModel,g_models[i]);
}

public 
show_the_menu(id,level,cid)
{
    
// check if user doesen't have admin 
    /*if( ! cmd_access( id,level, cid , 0 ))
        return PLUGIN_HANDLED;
    */
    
    // check if the plugin cvar is turned off
    
if( ! get_pcvar_numpnumplugin ) )
        return 
PLUGIN_HANDLED;
        
        
    
// check if user isn't alive
    
if( ! is_user_aliveid ) )
    {
        
client_printidprint_chat"" ); //msg muerto
        
return PLUGIN_HANDLED;
    }
            
    if ( !
zp_get_user_zombie(id) )
    {        
        new 
szMenuBody[256];
        new 
keys;
        
        new 
nLen formatszMenuBody255"\ySand Bags:^n" );
        
nLen += formatszMenuBody[nLen], 255-nLen"^n\w1. Place a Sandbags (%i Remaining)"g_bolsas[id] );
        
//nLen += format( szMenuBody[nLen], 255-nLen, "^n\w2. Remove a pallet with bags" );
        
nLen += formatszMenuBody[nLen], 255-nLen"^n^n\w0. Exit" );

        
keys = (1<<0|1<<1|1<<2|1<<3|1<<4|1<<5|1<<6|1<<9)

        
show_menuidkeysszMenuBody, -);

        
// depends what you want, if is continue will appear on chat what the admin sayd
        
return PLUGIN_HANDLED;
    }
    
client_print(idprint_chat"[ZP] The zombies can not use this command!")
    return 
PLUGIN_HANDLED;
}


public 
menu_command(id,key,level,cid)
{
    
    switch( 
key )
    {
        
// place a pallet with bags
        
case 0
        {
            if ( !
zp_get_user_zombie(id) )
            {
                new 
money g_bolsas[id]
                if ( 
money )
                {
                    if ( 
get_pcvar_num(g_MSGMODE) == )
                        {
                            
set_hudmessage(001000.800.8006.02.01.01.0)
                            
show_hudmessage(id"You do not have to^nplace sandbags")
                            return 
PLUGIN_CONTINUE
                        
}
                    
client_print(idprint_chat"[ZP] You do not have to place sandbags!")
                    return 
PLUGIN_CONTINUE
                
}
                
g_bolsas[id]-= 1
                place_palletwbags
(id);
                
show_the_menu(id,level,cid);
                return 
PLUGIN_CONTINUE    
            
}
            
client_print(idprint_chat"[ZP] The zombies can not use this!!")
            return 
PLUGIN_CONTINUE    
        
}
        
        
// remove a pallet with bags
        /*case 1:
        {
            if ( !zp_get_user_zombie(id) )
            {
                new ent, body, class[32];
                get_user_aiming(id, ent, body);
                if (pev_valid(ent)) 
                {
                    pev(ent, pev_classname, class, 31);
                    
                    if (equal(class, "amxx_pallets")) 
                    {
                        g_bolsas[id]+= 1
                        fm_remove_entity(ent);
                    }
                    
                    else
                        client_print(id, print_chat, "[ZP] You are not aiming at a pallet with bags");
                }
                else
                    client_print(id, print_chat, "[ZP] You are not aiming at a valid entity !");
                    
                show_the_menu(id,level,cid);
            }
        }
        */
        
        // remove all pallets with bags
        /*case 2:
        {
            g_bolsas[id]= 0
            remove_allpalletswbags();
            client_print(id,print_chat,"[AMXX] You removed all pallets with bags !");
            show_the_menu(id,level,cid);
        }
            */
            
    
}
    
    return 
PLUGIN_HANDLED;
}



public 
place_palletwbags(id)
{
    
    if( 
palletscout == get_pcvar_num(maxpallets) )
    {
        
client_print(id,print_chat,"[ZP] For security reasons only allow %d Sandbags on the server!",get_pcvar_num(maxpallets));
        return 
PLUGIN_HANDLED;
    }
    
    
// create a new entity 
    
new ent engfunc(EngFunc_CreateNamedEntityengfunc(EngFunc_AllocString"func_wall"));
    
    
    
// set a name to the entity
    
set_pev(ent,pev_classname,"amxx_pallets");
    
    
// set model        
    
engfunc(EngFunc_SetModel,ent,g_models[random(sizeof g_models)]);
    
    
// register a new var. for origin
    
static Float:xorigin[3];
    
get_user_hitpoint(id,xorigin);
    
    
    
// check if user is aiming at the air 
    
if(engfunc(EngFunc_PointContents,xorigin) == CONTENTS_SKY)
    {
        
client_print(id,print_chat,"[ZP] You can not put sandbags in the sky!");
        return 
PLUGIN_HANDLED;
    }
    
    
    
// set sizes
    
static Float:p_mins[3], Float:p_maxs[3];
    
p_mins PALLET_MINS;
    
p_maxs PALLET_MAXS;
    
engfunc(EngFunc_SetSizeentp_minsp_maxs);
    
set_pev(entpev_minsp_mins);
    
set_pev(entpev_maxsp_maxs );
    
set_pev(entpev_absminp_mins);
    
set_pev(entpev_absmaxp_maxs );

    
    
// set the rock of origin where is user placed
    
engfunc(EngFunc_SetOriginentxorigin);
    
    
    
// make the rock solid
    
set_pev(ent,pev_solid,SOLID_BBOX); // touch on edge, block
    
    // set the movetype
    
set_pev(ent,pev_movetype,MOVETYPE_FLY); // no gravity, but still collides with stuff
    
    // now the damage stuff, to set to take it or no
    // if you set the cvar "pallets_wbags_health" 0, you can't destroy a pallet with bags
    // else, if you want to make it destroyable, just set the health > 0 and will be
    // destroyable.
    
new Float:p_cvar_health get_pcvar_float(phealth);
    switch(
p_cvar_health)
    {
        case 
0.0 :
        {
            
set_pev(ent,pev_takedamage,DAMAGE_NO);
        }
        
        default :
        {
            
set_pev(ent,pev_health,p_cvar_health);
            
set_pev(ent,pev_takedamage,DAMAGE_YES);
        }
    }
    
            
    static 
Float:rvec[3];
    
pev(id,pev_v_angle,rvec);
    
    
rvec[0] = 0.0;
    
    
set_pev(ent,pev_angles,rvec);
    
    
// drop entity to floor
    
fm_drop_to_floor(ent);
    
    
// num ..
    
palletscout++;
    
    
// confirm message
    
if ( get_pcvar_num(g_MSGMODE) == )
    {
        
set_hudmessage(001000.800.8006.02.01.01.0)
        
show_hudmessage(id"You placed a SandBag^n%i Remaining"g_bolsas[id])
        return 
PLUGIN_HANDLED
    
}
    
client_print(idprint_chat"[ZP] You have placed a Sandbag.")
    return 
PLUGIN_HANDLED;
}
    
/* ====================================================
get_user_hitpoin stock . Was maked by P34nut, and is 
like get_user_aiming but is with floats and better :o
====================================================*/    
stock get_user_hitpoint(idFloat:hOrigin[3]) 
{
    if ( ! 
is_user_aliveid ))
        return 
0;
    
    new 
Float:fOrigin[3], Float:fvAngle[3], Float:fvOffset[3], Float:fvOrigin[3], Float:feOrigin[3];
    new 
Float:fTemp[3];
    
    
pev(idpev_originfOrigin);
    
pev(idpev_v_anglefvAngle);
    
pev(idpev_view_ofsfvOffset);
    
    
xs_vec_add(fOriginfvOffsetfvOrigin);
    
    
engfunc(EngFunc_AngleVectorsfvAnglefeOriginfTempfTemp);
    
    
xs_vec_mul_scalar(feOrigin9999.9feOrigin);
    
xs_vec_add(fvOriginfeOriginfeOrigin);
    
    
engfunc(EngFunc_TraceLinefvOriginfeOrigin0id);
    
global_get(glb_trace_endposhOrigin);
    
    return 
1;



/* ====================================================
This is called on every round, at start up,
with HLTV logevent. So if the "pallets_wbags_nroundrem"
cvar is set to 1, all placed pallets with bugs will be
removed.
====================================================*/
public event_newround()
{
    if( 
get_pcvar_num remove_nrnd ) == 1)
        
remove_allpalletswbags();
        
}


/* ====================================================
This is a stock to help for remove all pallets with
bags placed . Is called on new round if the cvar
"pallets_wbags_nroundrem" is set 1.
====================================================*/
stock remove_allpalletswbags()
{
    new 
pallets = -1;
    while((
pallets fm_find_ent_by_class(pallets"amxx_pallets")))
        
fm_remove_entity(pallets);
        
    
palletscout 0;
}

public 
checkstuck() {
    if ( 
get_pcvar_num(ZPSTUCK) == )
    {
        static 
players[32], pnumplayer
        get_players
(playerspnum)
        static 
Float:origin[3]
        static 
Float:mins[3], hull
        
static Float:vec[3]
        static 
o,i
        
for(i=0i<pnumi++){
            
player players[i]
            if (
is_user_connected(player) && is_user_alive(player)) {
                
pev(playerpev_originorigin)
                
hull pev(playerpev_flags) & FL_DUCKING HULL_HEAD HULL_HUMAN
                
if (!is_hull_vacant(originhull,player) && !get_user_noclip(player) && !(pev(player,pev_solid) & SOLID_NOT)) {
                    ++
stuck[player]
                    if(
stuck[player] >= get_pcvar_num(cvar[2])) {
                        
pev(playerpev_minsmins)
                        
vec[2] = origin[2]
                        for (
o=0sizeof size; ++o) {
                            
vec[0] = origin[0] - mins[0] * size[o][0]
                            
vec[1] = origin[1] - mins[1] * size[o][1]
                            
vec[2] = origin[2] - mins[2] * size[o][2]
                            if (
is_hull_vacant(vechull,player)) {
                                
engfunc(EngFunc_SetOriginplayervec)
                                
effects(player)
                                
set_pev(player,pev_velocity,{0.0,0.0,0.0})
                                
sizeof size
                            
}
                        }
                    }
                }
                else
                {
                    
stuck[player] = 0
                
}
            }
        }
    
    }
    
}

stock bool:is_hull_vacant(const Float:origin[3], hull,id) {
    static 
tr
    engfunc
(EngFunc_TraceHulloriginorigin0hullidtr)
    if (!
get_tr2(trTR_StartSolid) || !get_tr2(trTR_AllSolid)) //get_tr2(tr, TR_InOpen))
        
return true
    
    
return false
}

public 
effects(id) {
    if(
get_pcvar_num(cvar[1])) {
        
set_hudmessage(255,150,50, -1.00.6506.01.5,0.1,0.7// HUDMESSAGE
        
show_hudmessage(id,"Automatic Unstuck!"// HUDMESSAGE
        
message_begin(MSG_ONE_UNRELIABLE,105,{0,0,0},id )      
        
write_short(1<<10)   // fade lasts this long duration
        
write_short(1<<10)   // fade lasts this long hold time
        
write_short(1<<1)   // fade type (in / out)
        
write_byte(20)            // fade red
        
write_byte(255)    // fade green
        
write_byte(255)        // fade blue
        
write_byte(255)    // fade alpha
        
message_end()
        
client_cmd(id,"spk fvox/blip.wav")
    }
}

public 
zp_extra_item_selected(playeritemid)
{
    if(
itemid == g_itemid_bolsas)
    {
                if(
g_just_one[player])
                { 
                     
client_print(playerprint_center"Buy limit activated. Try in next round.")
                     return 
PLUGIN_HANDLED
                
}

                
g_just_one[player] = true
        g_bolsas
[player]+= 15
        cmd_bind
(player)
        
set_task(0.3,"show_the_menu",player)

        if ( 
get_pcvar_num(g_MSGMODE) == )
        {
            
set_hudmessage(001000.800.8006.02.01.01.0)
            
show_hudmessage(player"Plugin By LARP^n    Chile 2008")
        }
    }
        return 
PLUGIN_CONTINUE

}

public 
cmd_bind(id)
{
    if ( 
get_pcvar_num(g_BINDMODE) == )
    {
        
client_print(idprint_chat"[ZP] You have %i sandbags, to use with the key 'L'"g_bolsas[id])
        
client_cmd(id,"bind l /pb")
        return 
PLUGIN_HANDLED
    
}
    
client_print(idprint_chat"[ZP] You have %i sandbags, to use type 'say /pb'"g_bolsas[id])
    return 
PLUGIN_HANDLED


__________________
Check my original plugins for cs 1.6 and subscribe on channel
Look at the video below to see blind grenade for zombies

https://www.youtube.com/watch?v=ORC7ZmoaipQ

Look at the video below to see Zombie Hide And Seek mode

https://www.youtube.com/watch?v=xpyYb65EgGs

Last edited by Krtola; 04-25-2019 at 07:39.
Krtola is offline
Send a message via Skype™ to Krtola
jievylook
Senior Member
Join Date: Sep 2018
Old 05-05-2019 , 11:20   Re: [ZP] Extra Item: Sand Bags BETA!
Reply With Quote #109

Quote:
Originally Posted by Chihuahuax View Post
here you go
Can you add a glow that changes health as the health is removed from the sandbag?
and you can put 2 sandbags with a single buy? and that the purchase is limited to a single purchase for each player per round

Also when a new round starts, remove all the sandbags that were placed in the previous round.

Last edited by jievylook; 05-05-2019 at 11:23.
jievylook is offline
DON KHAN 1
Senior Member
Join Date: Mar 2019
Location: Pakistan
Old 06-07-2019 , 00:58   Re: [ZP] Extra Item: Sand Bags BETA!
Reply With Quote #110

can anybody make it for vip?
i tried alot but got some bugs.
__________________
Facebook
My YouTube
Ro{Y}aL WarLanD CommuniTy
Selling Zombie CSO 4.3 Money System Mod
DON KHAN 1 is offline
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 12:56.


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