|
Member
Join Date: May 2011
Location: Venezuela xd
|

05-02-2013
, 17:31
Re: [ZP] Extra item sandbang
|
#15
|
Quote:
Que onda gente, me descarge e instale el extraitem sandbang que es de poner costales que tienen cierta vida digamos que le pongo 1000 de vida y pueden bloquear el paso a humanos/zombies a menos que sea destruido
Lo que quiero hacer y no lo logro esque solo se le este bajando la vida a ese saco si el atacante es un zombie osea if (zp_get_user_zombie(attacker)), Les dejo el code
Quote:
PHP Code:
public place_palletwbags(id)
{
// 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");
// set model
engfunc(EngFunc_SetModel,ent,g_models[random(sizeof g_models)]);
// register a new var. for origin
static Float origin[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,"[ZA] No puedes poner costales en el Cielo");
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) //si esta en 0 es indestrucctible el saco
{
case 0.0 :
{
set_pev(ent,pev_takedamage,DAMAGE_NO);
}
default : //si se le pone vida
{
set_pev(ent,pev_health,p_cvar_health);
set_pev(ent,pev_takedamage,DAMAGE_YES); //creo que es aqui pero no logro saver como
}
}
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) == 1 )
{
set_hudmessage(255, 0, 0, 0.80, 0.80, 0, 6.0, 2.0, 1.0, 1.0)
show_hudmessage(id, "[ZA] Has colocado un Costal")
return PLUGIN_HANDLED
}
client_print(id, print_chat, "[ZA] Usted ha colocado un costal.")
return PLUGIN_HANDLED;
}
/* ============================================= =======
get_user_hitpoin stock . Was maked by P34nut, and is
like get_user_aiming but is with floats and better 
============================================= =======*/
stock get_user_hitpoint(id, Float:hOrigin[3])
{
if ( ! is_user_alive( id ))
return 0;
new Float:fOrigin[3], Float:fvAngle[3], Float:fvOffset[3], Float:fvOrigin[3], Float:feOrigin[3];
new Float:fTemp[3];
pev(id, pev_origin, fOrigin);
pev(id, pev_v_angle, fvAngle);
pev(id, pev_view_ofs, fvOffset);
xs_vec_add(fOrigin, fvOffset, fvOrigin);
engfunc(EngFunc_AngleVectors, fvAngle, feOrigin, fTemp, fTemp);
xs_vec_mul_scalar(feOrigin, 9999.9, feOrigin);
xs_vec_add(fvOrigin, feOrigin, feOrigin);
engfunc(EngFunc_TraceLine, fvOrigin, feOrigin, 0, id);
global_get(glb_trace_endpos, hOrigin);
return 1;
}
|
|
men esto es el codigo para adaptarlo en el Zombie_apocalypse?
|
|