Постараюсь быть максимально последовательным в своих действиях.
Начинаем)
1) Вставляю
- Код: Выделить всё
g_infect_gib
- Код: Выделить всё
new g_fire_explode, g_frost_explode, g_fire_gib, g_frost_gib, g_fire_trail, g_frost_trail, g_flare_trail, g_infect_gib;
2) Далее бросаю в прекеш
- Код: Выделить всё
g_infect_gib = precache_model ("sprites/zp_n_sprites/Infection_Effect.spr")
- Код: Выделить всё
public plugin_precache()
{
g_fire_explode = precache_model ("sprites/zp_n_sprites/fire_explode.spr")
g_frost_explode = precache_model ("sprites/zp_n_sprites/frost_explode.spr")
g_fire_gib = precache_model ("sprites/zp_n_sprites/fire_gib.spr")
g_frost_gib = precache_model ("sprites/zp_n_sprites/frost_gib.spr")
g_fire_trail = precache_model ("sprites/zp_n_sprites/fire_trail.spr")
g_frost_trail = precache_model ("sprites/zp_n_sprites/frost_trail.spr")
g_flare_trail = precache_model ("sprites/zp_n_sprites/flare_trail.spr")
g_infect_gib = precache_model ("sprites/zp_n_sprites/Infection_Effect.spr")
}
3) Далее в кейсе
- Код: Выделить всё
case NADE_TYPE_INFECTION: // Infection Bomb
вставляю ето
- Код: Выделить всё
/* case NADE_TYPE_INFECTION: // Infection Bomb
{
// Get origin
new Float:originF[3], origin[3];
pev(entity, pev_origin, originF)
FVecIVec(originF, origin)
remove_task(entity)
set_task(0.1, "fwTaskExplodeInfect", entity, origin, 3)
}*/
4) и потом уже регистр.
- Код: Выделить всё
public fwTaskExplodeInfect(const originF[3], const ent)
{
// TE_SPRITETRAIL
message_begin(MSG_BROADCAST ,SVC_TEMPENTITY, originF, 0)
write_byte(TE_SPRITETRAIL) // TE ID
write_coord(originF[0]) // x axis
write_coord(originF[1]) // y axis
write_coord(originF[2]+70) // z axis
write_coord(originF[0]) // x axis
write_coord(originF[1]) // y axis
write_coord(originF[2]) // z axis
write_short(g_frost_gib) // Sprite Index
write_byte(80) // Count
write_byte(20) // Life
write_byte(2) // Scale
write_byte(50) // Velocity Along Vector
write_byte(10) // Rendomness of Velocity
message_end();
// TE_EXPLOSION
message_begin(MSG_BROADCAST,SVC_TEMPENTITY, originF, 0)
write_byte(TE_EXPLOSION)
write_coord(originF[0]) // x axis
write_coord(originF[1]) // y axis
write_coord(originF[2]+75) // z axis
write_short(g_infect_gib)
write_byte(22)
write_byte(35)
write_byte(TE_EXPLFLAG_NOSOUND)
message_end()
}
На етом всё.И вроде правильно, - а в игре то нету еффекта...
Подскажите,что ещё нужно дописать?
Нуу очень Благодарю
Весь Код целиком ( по-умолчанию,без изминений )
- Код: Выделить всё
#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>
#include <zombieplague>
const PEV_NADE_TYPE = pev_flTimeStepSound
const NADE_TYPE_INFECTION = 1111
const NADE_TYPE_NAPALM = 2222
const NADE_TYPE_FROST = 3333
const NADE_TYPE_FLARE = 4444
const PEV_FLARE_COLOR = pev_punchangle
//const MODE_ASSASSIN = 8;
new g_fire_explode, g_frost_explode, g_fire_gib, g_frost_gib, g_fire_trail, g_frost_trail, g_flare_trail;
new cvar_removedropped, cvar_nvgcolor[3];//, g_assround, cvar_extrainfbomb, cvar_flarecolor, cvar_firegrenades, cvar_frostgrenades, cvar_flaregrenades, cvar_assnvgcolor[3]
public plugin_precache()
{
g_fire_explode = precache_model ("sprites/zp_n_sprites/fire_explode.spr")
g_frost_explode = precache_model ("sprites/zp_n_sprites/frost_explode.spr")
g_fire_gib = precache_model ("sprites/zp_n_sprites/fire_gib.spr")
g_frost_gib = precache_model ("sprites/zp_n_sprites/frost_gib.spr")
g_fire_trail = precache_model ("sprites/zp_n_sprites/fire_trail.spr")
g_frost_trail = precache_model ("sprites/zp_n_sprites/frost_trail.spr")
g_flare_trail = precache_model ("sprites/zp_n_sprites/flare_trail.spr")
}
public plugin_init()
{
register_plugin("ZP grenade effects", "0.0.1", "some noob")
//register_event("HLTV", "event_round_start", "a", "1=0", "2=0")
// we need post even so we can overwrite the default ZP trails
register_forward(FM_SetModel, "fw_SetModel", 1)
RegisterHam(Ham_Think, "grenade", "fw_ThinkGrenade")
}
public plugin_cfg()
{
cvar_removedropped = get_cvar_pointer("zp_remove_dropped");
/* cvar_extrainfbomb = get_cvar_pointer("zp_extra_infbomb");
cvar_flarecolor = get_cvar_pointer("zp_flare_color");
cvar_firegrenades = get_cvar_pointer("zp_fire_grenades");
cvar_frostgrenades = get_cvar_pointer("zp_frost_grenades");
cvar_flaregrenades = get_cvar_pointer("zp_flare_grenades");*/
cvar_nvgcolor[0] = get_cvar_pointer("zp_nvg_color_R");
cvar_nvgcolor[1] = get_cvar_pointer("zp_nvg_color_G");
cvar_nvgcolor[2] = get_cvar_pointer("zp_nvg_color_B");
/* cvar_assnvgcolor[0] = get_cvar_pointer("zpnm_nvg_ass_color_R");
cvar_assnvgcolor[1] = get_cvar_pointer("zpnm_nvg_ass_color_G");
cvar_assnvgcolor[2] = get_cvar_pointer("zpnm_nvg_ass_color_B");*/
// = get_cvar_pointer("");
}
/*
public event_round_start()
{
g_assround = 0;
}
public zp_round_started(iIDMode)
{
if (iIDMode == MODE_ASSASSIN)
g_assround = 1;
}*/
// Set entity's rendering type (from fakemeta_util)
stock fm_set_rendering(const entity, const fx = kRenderFxNone, const r = 255, const g = 255, const b = 255, const render = kRenderNormal, Float:amount = 19.0)
{
new Float:color[3]
color[0] = float(r)
color[1] = float(g)
color[2] = float(b)
set_pev(entity, pev_renderfx, fx)
set_pev(entity, pev_rendercolor, color)
set_pev(entity, pev_rendermode, render)
if (fx == kRenderFxNone && render == kRenderNormal)
amount = 0.0;
set_pev(entity, pev_renderamt, amount)
}
// Forward Set Model
public fw_SetModel(entity, const model[])
{
// We don't care
if (strlen(model) < 8)
return;
// Remove weapons?
if (get_pcvar_float(cvar_removedropped) > 0.0)
{
// Get entity's classname
static classname[10]
pev(entity, pev_classname, classname, 9)
// Check if it's a weapon box
if (equali(classname, "weaponbox"))
{
// They get automatically removed when thinking
return;
}
}
// Narrow down our matches a bit
if (model[7] != 'w' || model[8] != '_')
return;
// Get damage time of grenade
new Float:dmgtime
pev(entity, pev_dmgtime, dmgtime)
// Grenade not yet thrown
if (dmgtime == 0.0)
return;
/*
// Get whether grenade's owner is a zombie
if (zp_get_user_zombie(pev(entity, pev_owner)))
{
if (model[9] == 'h' && model[10] == 'e' && pev(entity, PEV_NADE_TYPE) == NADE_TYPE_INFECTION) // Infection Bomb
{
// Give it a glow
fm_set_rendering(entity, kRenderFxGlowShell, get_pcvar_num(cvar_nvgcolor[0]), get_pcvar_num(cvar_nvgcolor[1]), get_pcvar_num(cvar_nvgcolor[2]), kRenderNormal); //0, 200, 0
// Kill ZP's default grenade trail
message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
write_byte(TE_KILLBEAM)
write_short(entity)
message_end()
// And a colored trail
message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
write_byte(TE_BEAMFOLLOW) // TE id
write_short(entity) // entity
write_short(g_trailSpr) // sprite
write_byte(10) // life
write_byte(10) // width
write_byte(get_pcvar_num(cvar_nvgcolor[0])) // r-0
write_byte(get_pcvar_num(cvar_nvgcolor[1])) // g-200
write_byte(get_pcvar_num(cvar_nvgcolor[2])) // b-0
write_byte(200) // brightness
message_end()
}
}
else */if (model[9] == 'h' && model[10] == 'e' && pev(entity, PEV_NADE_TYPE) == NADE_TYPE_NAPALM) // Napalm Grenade
{
// Give it a glow
fm_set_rendering(entity, kRenderFxGlowShell, 200, 0, 0, kRenderNormal);
// Kill ZP's default grenade trail
message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
write_byte(TE_KILLBEAM)
write_short(entity)
message_end()
// And a colored trail
message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
write_byte(TE_BEAMFOLLOW) // TE id
write_short(entity) // entity
write_short(g_fire_trail) // sprite
write_byte(10) // life
write_byte(10) // width
write_byte(200) // r
write_byte(0) // g
write_byte(0) // b
write_byte(200) // brightness
message_end()
}
else if (model[9] == 'f' && model[10] == 'l' && pev(entity, PEV_NADE_TYPE) == NADE_TYPE_FROST) // Frost Grenade
{
// Give it a glow
fm_set_rendering(entity, kRenderFxGlowShell, 0, 100, 200, kRenderNormal);
// Kill ZP's default grenade trail
message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
write_byte(TE_KILLBEAM)
write_short(entity)
message_end()
// And a colored trail
message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
write_byte(TE_BEAMFOLLOW) // TE id
write_short(entity) // entity
write_short(g_frost_trail) // sprite
write_byte(10) // life
write_byte(10) // width
write_byte(0) // r
write_byte(100) // g
write_byte(200) // b
write_byte(200) // brightness
message_end()
}
else if (model[9] == 's' && model[10] == 'm' && pev(entity, PEV_NADE_TYPE) == NADE_TYPE_FLARE) // Flare
{
// Build flare's color
static rgb[11]
pev(entity, PEV_FLARE_COLOR, rgb)
// Give it a glow
fm_set_rendering(entity, kRenderFxGlowShell, rgb[0], rgb[1], rgb[2], kRenderNormal);
// Kill ZP's default grenade trail
message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
write_byte(TE_KILLBEAM)
write_short(entity)
message_end()
// And a colored trail
message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
write_byte(TE_BEAMFOLLOW) // TE id
write_short(entity) // entity
write_short(g_flare_trail) // sprite
write_byte(10) // life
write_byte(10) // width
write_byte(rgb[0]) // r
write_byte(rgb[1]) // g
write_byte(rgb[2]) // b
write_byte(200) // brightness
message_end()
}
}
//#include <D7Debug>
// Ham Grenade Think Forward
public fw_ThinkGrenade(const entity)
{
// Invalid entity
if (!pev_valid(entity)) return;
// Get damage time of grenade
new Float:dmgtime, Float:current_time
pev(entity, pev_dmgtime, dmgtime)
current_time = get_gametime()
//ftD7Log(_, _, "[fw_ThinkGrenade] entity: %d. triggered.", entity)
// Check if it's time to go off
if (dmgtime <= current_time)
return;
//ftD7Log(_, _, "[fw_ThinkGrenade] entity: %d. it's time to explode.", entity)
// Check if it's one of our custom nades
switch (pev(entity, PEV_NADE_TYPE))
{
/* case NADE_TYPE_INFECTION: // Infection Bomb
{
infection_explode(entity)
}*/
case NADE_TYPE_NAPALM: // Napalm Grenade
{
// Get origin
new Float:originF[3], origin[3];
pev(entity, pev_origin, originF)
FVecIVec(originF, origin)
remove_task(entity)
set_task(0.1, "fwTaskExplodeNapalm", entity, origin, 3)
}
case NADE_TYPE_FROST: // Frost Grenade
{
// Get origin
new Float:originF[3], origin[3];
pev(entity, pev_origin, originF)
FVecIVec(originF, origin)
remove_task(entity)
set_task(0.1, "fwTaskExplodeFrost", entity, origin, 3)
}
/* case NADE_TYPE_FLARE: // Flare
{
// Get its duration
new duration = pev(entity, PEV_FLARE_DURATION)
// Already went off, do lighting loop for the duration of PEV_FLARE_DURATION
if (duration > 0)
{
// Check whether this is the last loop
if (duration == 1)
{
// Get rid of the flare entity
engfunc(EngFunc_RemoveEntity, entity)
return HAM_SUPERCEDE;
}
// Light it up!
flare_lighting(entity, duration)
// Set time for next loop
set_pev(entity, PEV_FLARE_DURATION, --duration)
set_pev(entity, pev_dmgtime, current_time + 2.0)
}
// Light up when it's stopped on ground
else if ((pev(entity, pev_flags) & FL_ONGROUND) && fm_get_speed(entity) < 10)
{
// Flare sound
static sound[64]
ArrayGetString(grenade_flare, random_num(0, ArraySize(grenade_flare) - 1), sound, charsmax(sound))
emit_sound(entity, CHAN_WEAPON, sound, 1.0, ATTN_NORM, 0, PITCH_NORM)
// Set duration and start lightning loop on next think
set_pev(entity, PEV_FLARE_DURATION, 1 + get_pcvar_num(cvar_flareduration)/2)
set_pev(entity, pev_dmgtime, current_time + 0.1)
}
else
{
// Delay explosion until we hit ground
set_pev(entity, pev_dmgtime, current_time + 0.5)
}
}*/
}
//return HAM_IGNORED;
}
public fwTaskExplodeNapalm(const originF[3], const ent)
{
// TE_SPRITETRAIL
message_begin(MSG_BROADCAST ,SVC_TEMPENTITY, originF, 0)
write_byte(TE_SPRITETRAIL) // TE ID
write_coord(originF[0]) // x axis
write_coord(originF[1]) // y axis
write_coord(originF[2]+70) // z axis
write_coord(originF[0]) // x axis
write_coord(originF[1]) // y axis
write_coord(originF[2]) // z axis
write_short(g_fire_gib) // Sprite Index
write_byte(80) // Count
write_byte(20) // Life
write_byte(2) // Scale
write_byte(50) // Velocity Along Vector
write_byte(10) // Rendomness of Velocity
message_end();
// TE_EXPLOSION
message_begin(MSG_BROADCAST,SVC_TEMPENTITY, originF, 0)
write_byte(TE_EXPLOSION)
write_coord(originF[0]) // x axis
write_coord(originF[1]) // y axis
write_coord(originF[2]+75) // z axis
write_short(g_fire_explode)
write_byte(22)
write_byte(35)
write_byte(TE_EXPLFLAG_NOSOUND)
message_end()
}
public fwTaskExplodeFrost(const originF[3], const ent)
{
// TE_SPRITETRAIL
message_begin(MSG_BROADCAST ,SVC_TEMPENTITY, originF, 0)
write_byte(TE_SPRITETRAIL) // TE ID
write_coord(originF[0]) // x axis
write_coord(originF[1]) // y axis
write_coord(originF[2]+70) // z axis
write_coord(originF[0]) // x axis
write_coord(originF[1]) // y axis
write_coord(originF[2]) // z axis
write_short(g_frost_gib) // Sprite Index
write_byte(80) // Count
write_byte(20) // Life
write_byte(2) // Scale
write_byte(50) // Velocity Along Vector
write_byte(10) // Rendomness of Velocity
message_end();
// TE_EXPLOSION
message_begin(MSG_BROADCAST,SVC_TEMPENTITY, originF, 0)
write_byte(TE_EXPLOSION)
write_coord(originF[0]) // x axis
write_coord(originF[1]) // y axis
write_coord(originF[2]+75) // z axis
write_short(g_frost_explode)
write_byte(22)
write_byte(35)
write_byte(TE_EXPLFLAG_NOSOUND)
message_end()
}