PHP Code:
public removeEntity(ent)
{
if (pev_valid(ent))
engfunc(EngFunc_RemoveEntity, g_chest_ent)
}
create_chest(origin[3])
{
g_chest_ent = create_entity("info_target")
set_pev(g_chest_ent, pev_classname, item_class_name)
engfunc(EngFunc_SetModel,g_chest_ent, g_models[random_num(0, sizeof g_models - 1)])
set_pev(g_chest_ent,pev_mins,Float:{-10.0,-10.0,0.0})
set_pev(g_chest_ent,pev_maxs,Float:{10.0,10.0,25.0})
set_pev(g_chest_ent,pev_size,Float:{-10.0,-10.0,0.0,10.0,10.0,25.0})
engfunc(EngFunc_SetSize,g_chest_ent,Float:{-10.0,-10.0,0.0},Float:{10.0,10.0,25.0})
set_pev(g_chest_ent,pev_solid,SOLID_BBOX)
set_pev(g_chest_ent,pev_movetype,MOVETYPE_FLY)
new Float:fOrigin[3]
IVecFVec(origin, fOrigin)
set_pev(g_chest_ent, pev_origin, fOrigin)
set_pev(g_chest_ent,pev_renderfx,kRenderFxGlowShell)
switch(random_num(1,4))
{
case 1: set_pev(g_chest_ent,pev_rendercolor,Float:{0.0,0.0,255.0})
case 2: set_pev(g_chest_ent,pev_rendercolor,Float:{0.0,255.0,0.0})
case 3: set_pev(g_chest_ent,pev_rendercolor,Float:{255.0,0.0,0.0})
case 4: set_pev(g_chest_ent,pev_rendercolor,Float:{255.0,255.0,255.0})
}
}
public fw_Touch(ent, toucher, touched)
{
// Get entity classname
static classname[12]
pev(touched, pev_classname, classname, 31)
if (!equal(classname, item_class_name))
// Valid user alive?
if (!is_user_alive(toucher)) return;
// Check entity type
if (equal(classname, "campo_grenade_forze"))
{
if(g_zombie[toucher]) // los nemesis y zombies no pueden pasar
{
new Float:pos_ptr[3], Float:pos_ptd[3], Float:push_power = get_pcvar_float(cvar_bubblepush) // intensidad de rechazo
pev(touched, pev_origin, pos_ptr) // nose que es
pev(toucher, pev_origin, pos_ptd) // nose que es
for(new i = 0; i < 3; i++)
{
pos_ptd[i] -= pos_ptr[i] // nose que es
pos_ptd[i] *= push_power // poder cuando lo tocamos y nos rechaza
}
set_pev(toucher, pev_velocity, pos_ptd) // velocidad del rechazo
set_pev(toucher, pev_impulse, pos_ptd) // impulso del rechazo
}
}
else if (equal(classname, "item_dm"))
{
// Give point random
new points
points = random_num(10, 15)
new i = random_num(0, (points ? 5 : 13))
switch (i)
{
case 0:
{
g_skill_points_type[toucher][0] += points
zp_colored_print(toucher, "^x04[ZA]^x01 Has recogido un cofre, obtienes %d PH!", points)
}
case 1:
{
g_skill_points_type[toucher][1] += points
zp_colored_print(toucher, "^x04[ZA]^x01 Has recogido un cofre, obtienes %d PZ!", points)
}
removeEntity()
}
}
}