Вечер добрый, есть плагин Блокирующий шар, при соприкосновении которого зомби отталкивает в сторону, как его можно переделать, чтобы зомби могли в него заходить, но пока они в этом шаре, зомби значительно снижало скорость передвижения
Код:
#include <amxmodx>
#include <engine>
#include <hamsandwich>
#include <fun>
#include <fakemeta_util>
#include <zombieplague>
#include <colorchat>
#define ValidTouch(%1) (is_user_alive(%1) && (zp_get_user_zombie(%1) || zp_get_user_nemesis(%1)))
#define WEAPON_NAME "Shield Grenade"
#define WEAPON_COST 40
new const ZP_PREFIX[] = "ZP"
new const NADE_TYPE_SHIELDBOMB = 6545
#define WEAPON_MODEL_V "models/grenade/v_auragren2.mdl"
#define WEAPON_MODEL_P "models/grenade/p_auragren.mdl"
#define WEAPON_MODEL_W "models/grenade/w_aura.mdl"
new const model[] = "models/sf_pumpkin.mdl"
new const sprite_grenade_trail[] = "sprites/laserbeam.spr"
new const entclas[] = "campo_grenade_forze"
new g_trailSpr, cvar_push, g_itemID
new g_AllocString_V, g_AllocString_P, g_ShieldBomb[33]
public plugin_init()
{
register_plugin("[ZP] Extra Item: Force Field Grenade", "2.3", "1111");
RegisterHam(Ham_Think, "grenade", "fw_ThinkGrenade")
RegisterHam(Ham_Killed, "player", "fw_Killed_Post")
RegisterHam(Ham_Item_Deploy, "weapon_smokegrenade", "fw_Item_Deploy_Post", 1)
register_forward(FM_Touch, "fw_touch")
register_forward(FM_SetModel, "fw_SetModel")
register_event("HLTV", "event_round_start", "a", "1=0", "2=0")
g_itemID = zp_register_extra_item (WEAPON_NAME, WEAPON_COST, ZP_TEAM_HUMAN)
register_dictionary("zp_addon.txt")
cvar_push = register_cvar("zp_forze_push", "2.0")
}
public event_round_start(id)
{
remove_entity_name(entclas)
g_ShieldBomb[id] = 0
}
public client_disconnect(id)
g_ShieldBomb[id] = 0;
public fw_Killed_Post(id)
{
g_ShieldBomb[id] = 0;
}
public zp_user_infected_post(id)
g_ShieldBomb[id] = 0;
public plugin_precache()
{
g_trailSpr = engfunc(EngFunc_PrecacheModel, sprite_grenade_trail)
g_AllocString_V = engfunc(EngFunc_AllocString, WEAPON_MODEL_V);
g_AllocString_P = engfunc(EngFunc_AllocString, WEAPON_MODEL_P);
engfunc(EngFunc_PrecacheModel, WEAPON_MODEL_V);
engfunc(EngFunc_PrecacheModel, WEAPON_MODEL_P);
engfunc(EngFunc_PrecacheModel, WEAPON_MODEL_W);
engfunc(EngFunc_PrecacheModel, model)
}
public zp_extra_item_selected(iPlayer, itemid)
{
if(itemid == g_itemID)
{
if (g_ShieldBomb[iPlayer] >= 1)
{
client_print_color(iPlayer, print_team_default, "^x04[%s]^x01 %L", ZP_PREFIX, iPlayer, "GRENADE_SHIELD_LIMIT", g_ShieldBomb[iPlayer])
return ZP_PLUGIN_HANDLED;
}
g_ShieldBomb[iPlayer]++
if( !user_has_weapon(iPlayer, CSW_SMOKEGRENADE))
give_item(iPlayer,"weapon_smokegrenade")
client_print_color(iPlayer, print_team_default, "^x04[%s]^x01 %L", ZP_PREFIX, iPlayer, "GRENADE_SHIELD_BUY", g_ShieldBomb[iPlayer])
}
return PLUGIN_HANDLED;
}
public fw_ThinkGrenade(entity)
{
if(!pev_valid(entity)) return HAM_IGNORED
static Float:dmgtime
pev(entity, pev_dmgtime, dmgtime)
if (dmgtime > get_gametime())
return HAM_IGNORED
if(pev(entity, pev_flTimeStepSound) == NADE_TYPE_SHIELDBOMB)
crear_ent(entity)
return HAM_SUPERCEDE
}
public fw_SetModel(Entity, const Model[])
{
if (Entity < 0)
return FMRES_IGNORED;
if (pev(Entity, pev_dmgtime) == 0.0)
return FMRES_IGNORED;
new iOwner = entity_get_edict (Entity, EV_ENT_owner)
if (g_ShieldBomb[iOwner] >= 1 && equal (Model [7], "w_sm", 4))
{
fm_set_rendering(Entity, kRenderFxGlowShell, 000, 255, 255, kRenderNormal, 16)
message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
write_byte(TE_BEAMFOLLOW)
write_short(Entity) // entity
write_short(g_trailSpr) // sprite
write_byte(10) // life
write_byte(10) // width
write_byte(0) // r
write_byte(255) // g
write_byte(255) // b
write_byte(500) // brightness
message_end()
set_pev(Entity, pev_flTimeStepSound, NADE_TYPE_SHIELDBOMB)
set_task(6.0, "DeleteEntityGrenade", Entity)
g_ShieldBomb[iOwner]--
entity_set_model(Entity, WEAPON_MODEL_W)
// set_pev(Entity, pev_body, 2)
return FMRES_SUPERCEDE;
}
return FMRES_IGNORED;
}
public fw_Item_Deploy_Post(iItem)
{
static const m_pPlayer = 41;
static iPlayer; iPlayer = get_pdata_cbase(iItem, m_pPlayer, 4);
if(zp_get_user_zombie(iPlayer) || !g_ShieldBomb[iPlayer]) return;
set_pev_string(iPlayer, pev_viewmodel2, g_AllocString_V);
set_pev_string(iPlayer, pev_weaponmodel2, g_AllocString_P);
}
public DeleteEntityGrenade(Entity)
if(is_valid_ent(Entity))
remove_entity(Entity)
public crear_ent(id)
{
// Create entitity
new Entity = create_entity("info_target")
if(!is_valid_ent(Entity))
return PLUGIN_HANDLED
new Float: Origin[3]
entity_get_vector(id, EV_VEC_origin, Origin)
entity_set_string(Entity, EV_SZ_classname, entclas)
entity_set_vector(Entity,EV_VEC_origin, Origin)
entity_set_model(Entity,model)
entity_set_int(Entity, EV_INT_solid, SOLID_TRIGGER)
entity_set_size(Entity, Float: {-100.0, -100.0, -100.0}, Float: {100.0, 100.0, 100.0})
entity_set_int(Entity, EV_INT_renderfx, kRenderFxGlowShell)
entity_set_int(Entity, EV_INT_rendermode, kRenderTransAlpha)
entity_set_float(Entity, EV_FL_renderamt, 50.0)
if(is_valid_ent(Entity))
{
new Float:vColor[3]
for(new i; i < 3; i++)
vColor[i] = random_float(0.0, 255.0)
entity_set_vector(Entity, EV_VEC_rendercolor, vColor)
}
set_task(40.0, "DeleteEntityGrenade", Entity)
return PLUGIN_CONTINUE;
}
public fw_touch(Entity, touched)
{
if (!pev_valid(Entity)) return FMRES_IGNORED;
static entclass[32];
pev(Entity, pev_model, entclass, 31);
if (strcmp(entclass, model) == 0)
{
if(ValidTouch(touched))
{
new Float:pos_ptr[3], Float:pos_ptd[3], Float:push_power = get_pcvar_float(cvar_push)
pev(Entity, pev_origin, pos_ptr)
pev(touched, pev_origin, pos_ptd)
for(new i = 0; i < 3; i++)
{
pos_ptd[i] -= pos_ptr[i]
pos_ptd[i] *= push_power
}
set_pev(touched, pev_velocity, pos_ptd)
set_pev(touched, pev_impulse, pos_ptd)
}
}
return FMRES_HANDLED
}
public remove_ent()
{
remove_entity_name(entclas)
}