I try with the sandbags of zombie plague but dont work well, the humans can transfer but the zombies too and the owner of sandbags cant transfer them, why dont work well?
code:
PHP Code:
public place_palletwbags(OwnerEnt)
{
if( palletscout == get_pcvar_num(maxpallets) )
{
client_print(OwnerEnt, 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_CreateNamedEntity, engfunc(EngFunc_AllocString, "func_wall"));
// set a name to the entity
set_pev(ent,pev_classname,"amxx_pallets");
entity_set_int(ent, EV_INT_iuser1, OwnerEnt)
// 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(OwnerEnt, xorigin);
// check if user is aiming at the air
if(engfunc(EngFunc_PointContents,xorigin) == CONTENTS_SKY)
{
client_print(OwnerEnt, 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_SetSize, ent, p_mins, p_maxs);
set_pev(ent, pev_mins, p_mins);
set_pev(ent, pev_maxs, p_maxs );
set_pev(ent, pev_absmin, p_mins);
set_pev(ent, pev_absmax, p_maxs );
// set the rock of origin where is user placed
engfunc(EngFunc_SetOrigin, ent, xorigin);
// 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(OwnerEnt, pev_v_angle, rvec);
rvec[0] = 0.0;
set_pev(ent, pev_angles, rvec);
set_pev(ent, pev_groupinfo, GROUP_T)
// drop entity to floor
fm_drop_to_floor(ent);
// num ..
palletscout++;
return PLUGIN_HANDLED;
}