[CS 1.6] Как добавить P_, W_ модель гранат через мод ZP 4.3
Добавляем P_, W_ модели гранат через главный мод ZP 4.3
В этой статье я покажу вам как добавить P_ и W_ модели гранаты: огненной, заморозки, светящейся, вирус.
Для примера я буду использовать: чистый ZP 4.3.
Открываем наш исходник главного мода, жмем ctrl+f, и ищем:// Customization vars
Ниже ищем:model_grenade_fire[64], model_grenade_frost[64], model_grenade_flare[64],
И под ним добавляем:model_grenade_fire_p[64], model_grenade_frost_p[64], model_grenade_flare_p[64], model_grenade_infect_p[64],
model_grenade_fire_w[64], model_grenade_frost_w[64], model_grenade_flare_w[64], model_grenade_infect_w[64],
Должно быть так:// Customization vars
new g_access_flag[MAX_ACCESS_FLAGS], Array:model_nemesis, Array:model_survivor, Array:model_human,
Array:model_admin_zombie, Array:model_admin_human, Array:g_modelindex_human,
Array:g_modelindex_nemesis, Array:g_modelindex_survivor, g_same_models_for_all,
Array:g_modelindex_admin_zombie, Array:g_modelindex_admin_human, model_vknife_human[64],
model_vknife_nemesis[64], model_vm249_survivor[64], model_grenade_infect[64],
model_grenade_fire[64], model_grenade_frost[64], model_grenade_flare[64],
model_grenade_fire_p[64], model_grenade_frost_p[64], model_grenade_flare_p[64], model_grenade_infect_p[64],
model_grenade_fire_w[64], model_grenade_frost_w[64], model_grenade_flare_w[64], model_grenade_infect_w[64],
model_vknife_admin_human[64], model_vknife_admin_zombie[64],
sprite_grenade_trail[64], sprite_grenade_ring[64], sprite_grenade_fire[64],
sprite_grenade_smoke[64], sprite_grenade_glass[64], Array:sound_win_zombies,
Array:sound_win_humans, Array:sound_win_no_one, Array:zombie_infect, Array:zombie_idle,
Array:zombie_pain, Array:nemesis_pain, Array:zombie_die, Array:zombie_fall,
Array:zombie_miss_wall, Array:zombie_hit_normal, Array:zombie_hit_stab, g_ambience_rain,
Array:zombie_idle_last, Array:zombie_madness, Array:sound_nemesis, Array:sound_survivor,
Array:sound_swarm, Array:sound_multi, Array:sound_plague, Array:grenade_infect,
Array:grenade_infect_player, Array:grenade_fire, Array:grenade_fire_player,
Array:grenade_frost, Array:grenade_frost_player, Array:grenade_frost_break,
Array:grenade_flare, Array:sound_antidote, Array:sound_thunder, g_ambience_sounds[MAX_AMBIENCE_SOUNDS],
Array:sound_ambience1, Array:sound_ambience2, Array:sound_ambience3, Array:sound_ambience4,
Array:sound_ambience5, Array:sound_ambience1_duration, Array:sound_ambience2_duration,
Array:sound_ambience3_duration, Array:sound_ambience4_duration,
Array:sound_ambience5_duration, Array:sound_ambience1_ismp3, Array:sound_ambience2_ismp3,
Array:sound_ambience3_ismp3, Array:sound_ambience4_ismp3, Array:sound_ambience5_ismp3,
Array:g_primary_items, Array:g_secondary_items, Array:g_additional_items,
Array:g_primary_weaponids, Array:g_secondary_weaponids, Array:g_extraweapon_names,
Array:g_extraweapon_items, Array:g_extraweapon_costs, g_extra_costs2[EXTRA_WEAPONS_STARTID],
g_ambience_snow, g_ambience_fog, g_fog_density[10], g_fog_color[12], g_sky_enable,
Array:g_sky_names, Array:lights_thunder, Array:zombie_decals, Array:g_objective_ents,
Float:g_modelchange_delay, g_set_modelindex_offset, g_handle_models_on_separate_ent,
Float:kb_weapon_power[31] = { -1.0, ... }, Array:zombie_miss_slash, g_force_consistency
Дальше ищем:// Custom weapon models
И после:engfunc(EngFunc_PrecacheModel, model_grenade_fire)
engfunc(EngFunc_PrecacheModel, model_grenade_frost)
engfunc(EngFunc_PrecacheModel, model_grenade_flare)
Добавляем:engfunc(EngFunc_PrecacheModel, model_grenade_fire_p)
engfunc(EngFunc_PrecacheModel, model_grenade_frost_p)
engfunc(EngFunc_PrecacheModel, model_grenade_flare_p)
engfunc(EngFunc_PrecacheModel, model_grenade_infect_p)
engfunc(EngFunc_PrecacheModel, model_grenade_fire_w)
engfunc(EngFunc_PrecacheModel, model_grenade_frost_w)
engfunc(EngFunc_PrecacheModel, model_grenade_flare_w)
engfunc(EngFunc_PrecacheModel, model_grenade_infect_w)
Должно быть так:// Custom weapon models
engfunc(EngFunc_PrecacheModel, model_vknife_human)
engfunc(EngFunc_PrecacheModel, model_vknife_nemesis)
engfunc(EngFunc_PrecacheModel, model_vm249_survivor)
engfunc(EngFunc_PrecacheModel, model_grenade_infect)
engfunc(EngFunc_PrecacheModel, model_grenade_fire)
engfunc(EngFunc_PrecacheModel, model_grenade_frost)
engfunc(EngFunc_PrecacheModel, model_grenade_flare)
engfunc(EngFunc_PrecacheModel, model_grenade_fire_p)
engfunc(EngFunc_PrecacheModel, model_grenade_frost_p)
engfunc(EngFunc_PrecacheModel, model_grenade_flare_p)
engfunc(EngFunc_PrecacheModel, model_grenade_infect_p)
engfunc(EngFunc_PrecacheModel, model_grenade_fire_w)
engfunc(EngFunc_PrecacheModel, model_grenade_frost_w)
engfunc(EngFunc_PrecacheModel, model_grenade_flare_w)
engfunc(EngFunc_PrecacheModel, model_grenade_infect_w)
engfunc(EngFunc_PrecacheModel, model_vknife_admin_human)
engfunc(EngFunc_PrecacheModel, model_vknife_admin_zombie)
Дальше ищем:// Forward Set Model
И это:// 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, charsmax(classname))
// Check if it's a weapon box
if (equal(classname, "weaponbox"))
{
// They get automatically removed when thinking
set_pev(entity, pev_nextthink, get_gametime() + get_pcvar_float(cvar_removedropped))
return;
}
}
// Narrow down our matches a bit
if (model[7] != 'w' || model[8] != '_')
return;
// Get damage time of grenade
static 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 (g_zombie[pev(entity, pev_owner)])
{
if (model[9] == 'h' && model[10] == 'e' && get_pcvar_num(cvar_extrainfbomb)) // Infection Bomb
{
// Give it a glow
fm_set_rendering(entity, kRenderFxGlowShell, 0, 200, 0, kRenderNormal, 16);
// 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(0) // r
write_byte(200) // g
write_byte(0) // b
write_byte(200) // brightness
message_end()
// Set grenade type on the thrown grenade entity
set_pev(entity, PEV_NADE_TYPE, NADE_TYPE_INFECTION)
}
}
else if (model[9] == 'h' && model[10] == 'e' && get_pcvar_num(cvar_firegrenades)) // Napalm Grenade
{
// Give it a glow
fm_set_rendering(entity, kRenderFxGlowShell, 200, 0, 0, kRenderNormal, 16);
// 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(200) // r
write_byte(0) // g
write_byte(0) // b
write_byte(200) // brightness
message_end()
// Set grenade type on the thrown grenade entity
set_pev(entity, PEV_NADE_TYPE, NADE_TYPE_NAPALM)
}
else if (model[9] == 'f' && model[10] == 'l' && get_pcvar_num(cvar_frostgrenades)) // Frost Grenade
{
// Give it a glow
fm_set_rendering(entity, kRenderFxGlowShell, 0, 100, 200, kRenderNormal, 16);
// 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(0) // r
write_byte(100) // g
write_byte(200) // b
write_byte(200) // brightness
message_end()
// Set grenade type on the thrown grenade entity
set_pev(entity, PEV_NADE_TYPE, NADE_TYPE_FROST)
}
else if (model[9] == 's' && model[10] == 'm' && get_pcvar_num(cvar_flaregrenades)) // Flare
{
// Build flare's color
static rgb[3]
switch (get_pcvar_num(cvar_flarecolor))
{
case 0: // white
{
rgb[0] = 255 // r
rgb[1] = 255 // g
rgb[2] = 255 // b
}
case 1: // red
{
rgb[0] = random_num(50,255) // r
rgb[1] = 0 // g
rgb[2] = 0 // b
}
case 2: // green
{
rgb[0] = 0 // r
rgb[1] = random_num(50,255) // g
rgb[2] = 0 // b
}
case 3: // blue
{
rgb[0] = 0 // r
rgb[1] = 0 // g
rgb[2] = random_num(50,255) // b
}
case 4: // random (all colors)
{
rgb[0] = random_num(50,200) // r
rgb[1] = random_num(50,200) // g
rgb[2] = random_num(50,200) // b
}
case 5: // random (r,g,b)
{
switch (random_num(1, 3))
{
case 1: // red
{
rgb[0] = random_num(50,255) // r
rgb[1] = 0 // g
rgb[2] = 0 // b
}
case 2: // green
{
rgb[0] = 0 // r
rgb[1] = random_num(50,255) // g
rgb[2] = 0 // b
}
case 3: // blue
{
rgb[0] = 0 // r
rgb[1] = 0 // g
rgb[2] = random_num(50,255) // b
}
}
}
}
// Give it a glow
fm_set_rendering(entity, kRenderFxGlowShell, rgb[0], rgb[1], rgb[2], kRenderNormal, 16);
// 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(rgb[0]) // r
write_byte(rgb[1]) // g
write_byte(rgb[2]) // b
write_byte(200) // brightness
message_end()
// Set grenade type on the thrown grenade entity
set_pev(entity, PEV_NADE_TYPE, NADE_TYPE_FLARE)
// Set flare color on the thrown grenade entity
set_pev(entity, PEV_FLARE_COLOR, rgb)
}
}
Заменяем на:// Forward Set Model
public fw_SetModel(entity, const model[])
{
// We don't care
if (strlen(model) < 8)
return FMRES_IGNORED
// Remove weapons?
if (get_pcvar_float(cvar_removedropped) > 0.0)
{
// Get entity's classname
static classname[10]
pev(entity, pev_classname, classname, charsmax(classname))
// Check if it's a weapon box
if (equal(classname, "weaponbox"))
{
// They get automatically removed when thinking
set_pev(entity, pev_nextthink, get_gametime() + get_pcvar_float(cvar_removedropped))
return FMRES_IGNORED
}
}
// Narrow down our matches a bit
if (model[7] != 'w' || model[8] != '_')
return FMRES_IGNORED
// Get damage time of grenade
static Float:dmgtime
pev(entity, pev_dmgtime, dmgtime)
// Grenade not yet thrown
if (dmgtime == 0.0)
return FMRES_IGNORED
// Get whether grenade's owner is a zombie
if (g_zombie[pev(entity, pev_owner)])
{
if (model[9] == 'h' && model[10] == 'e' && get_pcvar_num(cvar_extrainfbomb)) // Infection Bomb
{
// Set w_ model
engfunc(EngFunc_SetModel, entity, model_grenade_infect_w)
// Give it a glow
fm_set_rendering(entity, kRenderFxGlowShell, 0, 200, 0, kRenderNormal, 16);
// 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(0) // r
write_byte(200) // g
write_byte(0) // b
write_byte(200) // brightness
message_end()
// Set grenade type on the thrown grenade entity
set_pev(entity, PEV_NADE_TYPE, NADE_TYPE_INFECTION)
}
return FMRES_SUPERCEDE
}
else if (model[9] == 'h' && model[10] == 'e' && get_pcvar_num(cvar_firegrenades)) // Napalm Grenade
{
// Set w_ model
engfunc(EngFunc_SetModel, entity, model_grenade_fire_w)
// Give it a glow
fm_set_rendering(entity, kRenderFxGlowShell, 200, 0, 0, kRenderNormal, 16);
// 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(200) // r
write_byte(0) // g
write_byte(0) // b
write_byte(200) // brightness
message_end()
// Set grenade type on the thrown grenade entity
set_pev(entity, PEV_NADE_TYPE, NADE_TYPE_NAPALM)
return FMRES_SUPERCEDE
}
else if (model[9] == 'f' && model[10] == 'l' && get_pcvar_num(cvar_frostgrenades)) // Frost Grenade
{
// Set w_ model
engfunc(EngFunc_SetModel, entity, model_grenade_frost_w)
// Give it a glow
fm_set_rendering(entity, kRenderFxGlowShell, 0, 100, 200, kRenderNormal, 16);
// 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(0) // r
write_byte(100) // g
write_byte(200) // b
write_byte(200) // brightness
message_end()
// Set grenade type on the thrown grenade entity
set_pev(entity, PEV_NADE_TYPE, NADE_TYPE_FROST)
return FMRES_SUPERCEDE
}
else if (model[9] == 's' && model[10] == 'm' && get_pcvar_num(cvar_flaregrenades)) // Flare
{
// Set w_ model
engfunc(EngFunc_SetModel, entity, model_grenade_flare_w)
// Build flare's color
static rgb[3]
switch (get_pcvar_num(cvar_flarecolor))
{
case 0: // white
{
rgb[0] = 255 // r
rgb[1] = 255 // g
rgb[2] = 255 // b
}
case 1: // red
{
rgb[0] = random_num(50,255) // r
rgb[1] = 0 // g
rgb[2] = 0 // b
}
case 2: // green
{
rgb[0] = 0 // r
rgb[1] = random_num(50,255) // g
rgb[2] = 0 // b
}
case 3: // blue
{
rgb[0] = 0 // r
rgb[1] = 0 // g
rgb[2] = random_num(50,255) // b
}
case 4: // random (all colors)
{
rgb[0] = random_num(50,200) // r
rgb[1] = random_num(50,200) // g
rgb[2] = random_num(50,200) // b
}
case 5: // random (r,g,b)
{
switch (random_num(1, 3))
{
case 1: // red
{
rgb[0] = random_num(50,255) // r
rgb[1] = 0 // g
rgb[2] = 0 // b
}
case 2: // green
{
rgb[0] = 0 // r
rgb[1] = random_num(50,255) // g
rgb[2] = 0 // b
}
case 3: // blue
{
rgb[0] = 0 // r
rgb[1] = 0 // g
rgb[2] = random_num(50,255) // b
}
}
}
}
// Give it a glow
fm_set_rendering(entity, kRenderFxGlowShell, rgb[0], rgb[1], rgb[2], kRenderNormal, 16);
// 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(rgb[0]) // r
write_byte(rgb[1]) // g
write_byte(rgb[2]) // b
write_byte(200) // brightness
message_end()
// Set grenade type on the thrown grenade entity
set_pev(entity, PEV_NADE_TYPE, NADE_TYPE_FLARE)
// Set flare color on the thrown grenade entity
set_pev(entity, PEV_FLARE_COLOR, rgb)
return FMRES_SUPERCEDE
}
return FMRES_IGNORED
}
Дальше ищем:case CSW_HEGRENADE: // Infection bomb or fire grenade
И это: case CSW_HEGRENADE: // Infection bomb or fire grenade
{
if (g_zombie[id])
set_pev(id, pev_viewmodel2, model_grenade_infect)
else
set_pev(id, pev_viewmodel2, model_grenade_fire)
}
case CSW_FLASHBANG: // Frost grenade
{
set_pev(id, pev_viewmodel2, model_grenade_frost)
}
case CSW_SMOKEGRENADE: // Flare grenade
{
set_pev(id, pev_viewmodel2, model_grenade_flare)
}
Заменяем на это: case CSW_HEGRENADE: // Infection bomb or fire grenade
{
if (g_zombie[id])
{
set_pev(id, pev_viewmodel2, model_grenade_infect)
set_pev(id, pev_weaponmodel2, model_grenade_infect_p)
}
else
{
set_pev(id, pev_viewmodel2, model_grenade_fire)
set_pev(id, pev_weaponmodel2, model_grenade_fire_p)
}
}
case CSW_FLASHBANG: // Frost grenade
{
set_pev(id, pev_viewmodel2, model_grenade_frost)
set_pev(id, pev_weaponmodel2, model_grenade_frost_p)
}
case CSW_SMOKEGRENADE: // Flare grenade
{
set_pev(id, pev_viewmodel2, model_grenade_flare)
set_pev(id, pev_weaponmodel2, model_grenade_flare_p)
}
Теперь нам нужно модели вывести в zombieplague.ini.
Для этого в исходнике главного мода мы ищем:case SECTION_WEAPON_MODELS:
И ниже добавляем:else if (equal(key, "GRENADE FIRE_P"))
copy(model_grenade_fire_p, charsmax(model_grenade_fire_p), value)
else if (equal(key, "GRENADE FROST_P"))
copy(model_grenade_frost_p, charsmax(model_grenade_frost_p), value)
else if (equal(key, "GRENADE FLARE_P"))
copy(model_grenade_flare_p, charsmax(model_grenade_flare_p), value)
else if (equal(key, "GRENADE INFECT_P"))
copy(model_grenade_infect_p, charsmax(model_grenade_infect_p), value)
else if (equal(key, "GRENADE FIRE_W"))
copy(model_grenade_fire_w, charsmax(model_grenade_fire_w), value)
else if (equal(key, "GRENADE FROST_W"))
copy(model_grenade_frost_w, charsmax(model_grenade_frost_w), value)
else if (equal(key, "GRENADE FLARE_W"))
copy(model_grenade_flare_w, charsmax(model_grenade_flare_w), value)
else if (equal(key, "GRENADE INFECT_W"))
copy(model_grenade_infect_w, charsmax(model_grenade_infect_w), value)
Должно быть так: case SECTION_WEAPON_MODELS:
{
if (equal(key, "V_KNIFE HUMAN"))
copy(model_vknife_human, charsmax(model_vknife_human), value)
else if (equal(key, "V_KNIFE NEMESIS"))
copy(model_vknife_nemesis, charsmax(model_vknife_nemesis), value)
else if (equal(key, "V_M249 SURVIVOR"))
copy(model_vm249_survivor, charsmax(model_vm249_survivor), value)
else if (equal(key, "GRENADE INFECT"))
copy(model_grenade_infect, charsmax(model_grenade_infect), value)
else if (equal(key, "GRENADE FIRE"))
copy(model_grenade_fire, charsmax(model_grenade_fire), value)
else if (equal(key, "GRENADE FROST"))
copy(model_grenade_frost, charsmax(model_grenade_frost), value)
else if (equal(key, "GRENADE FLARE"))
copy(model_grenade_flare, charsmax(model_grenade_flare), value)
else if (equal(key, "GRENADE FIRE_P"))
copy(model_grenade_fire_p, charsmax(model_grenade_fire_p), value)
else if (equal(key, "GRENADE FROST_P"))
copy(model_grenade_frost_p, charsmax(model_grenade_frost_p), value)
else if (equal(key, "GRENADE FLARE_P"))
copy(model_grenade_flare_p, charsmax(model_grenade_flare_p), value)
else if (equal(key, "GRENADE INFECT_P"))
copy(model_grenade_infect_p, charsmax(model_grenade_infect_p), value)
else if (equal(key, "GRENADE FIRE_W"))
copy(model_grenade_fire_w, charsmax(model_grenade_fire_w), value)
else if (equal(key, "GRENADE FROST_W"))
copy(model_grenade_frost_w, charsmax(model_grenade_frost_w), value)
else if (equal(key, "GRENADE FLARE_W"))
copy(model_grenade_flare_w, charsmax(model_grenade_flare_w), value)
else if (equal(key, "GRENADE INFECT_W"))
copy(model_grenade_infect_w, charsmax(model_grenade_infect_w), value)
else if (equal(key, "V_KNIFE ADMIN HUMAN"))
copy(model_vknife_admin_human, charsmax(model_vknife_admin_human), value)
else if (equal(key, "V_KNIFE ADMIN ZOMBIE"))
copy(model_vknife_admin_zombie, charsmax(model_vknife_admin_zombie), value)
}
И последнее, открываем наш zombieplague.ini и в нем ищем:[Weapon Models]
И добавляете:GRENADE INFECT_P = models/zombie_plague/p_название модели.mdl
GRENADE FIRE_P = models/zombie_plague/p_название модели.mdl
GRENADE FROST_P = models/zombie_plague/p_название модели.mdl
GRENADE FLARE_P = models/zombie_plague/p_название модели.mdl
GRENADE INFECT_W = models/zombie_plague/w_название модели.mdl
GRENADE FIRE_W = models/zombie_plague/w_название модели.mdl
GRENADE FROST_W = models/zombie_plague/w_название модели.mdl
GRENADE FLARE_W = models/zombie_plague/w_название модели.mdl
скачать dle 12.0