Grenade Explode in Grenade Smoke
Grenade Explode in Grenade Smoke
I think why don't add grenade flare explode i mean grenade explode in grenade smoke
color trail is white + color explode is white + damage grenade
that is better idea
color trail is white + color explode is white + damage grenade
that is better idea
-
- Veteran Member
- Posts: 408
- Joined: 5 years ago
- Contact:
yeah me too i think he man thissPe3doN wrote: ↑4 years agoI think He mean to be like this
https://m.youtube.com/watch?v=vi1867RqC ... continue=1
try
Code: Select all
#include <zombie_escape>
// Settings file
new const ZE_SETTING_RESOURCES[] = "zombie_escape.ini"
// Default sounds
new const sound_grenade_flare_explode[][] = { "items/nvg_on.wav" }
#define MODEL_MAX_LENGTH 64
#define SOUND_MAX_LENGTH 64
#define SPRITE_MAX_LENGTH 64
// Models
new g_v_szModelFlareGrenade[MODEL_MAX_LENGTH] = "models/zombie_escape/v_grenade_explode.mdl"
new g_p_szModelFlareGrenade[MODEL_MAX_LENGTH] = "models/zombie_escape/p_grenade_explode.mdl"
// Sprites
new g_sprite_grenade_trail[SPRITE_MAX_LENGTH] = "sprites/laserbeam.spr"
new g_sprite_grenade_ring[SPRITE_MAX_LENGTH] = "sprites/shockwave.spr"
new g_sprite_grenade_explode[SPRITE_MAX_LENGTH] = "sprites/zerogxplode.spr"
new Array:g_sound_grenade_flare_explode
// HACK: pev_ field used to store custom nade types and their values
const PEV_NADE_TYPE = pev_flTimeStepSound
const NADE_TYPE_FLARE = 4444
new g_trailSpr, Expl, gSpriteCircle
public plugin_init()
{
register_plugin("[ZE] Explode Nade", ZE_VERSION, AUTHORS)
register_forward(FM_SetModel, "fw_SetModel")
RegisterHam(Ham_Think, "grenade", "fw_ThinkGrenade")
}
public plugin_precache()
{
// Initialize arrays
g_sound_grenade_flare_explode = ArrayCreate(SOUND_MAX_LENGTH, 1)
// Load from external file
amx_load_setting_string_arr(ZE_SETTING_RESOURCES, "Sounds", "GRENADE FLARE", g_sound_grenade_flare_explode)
// If we couldn't load custom sounds from file, use and save default ones
new index
if (ArraySize(g_sound_grenade_flare_explode) == 0)
{
for (index = 0; index < sizeof sound_grenade_flare_explode; index++)
ArrayPushString(g_sound_grenade_flare_explode, sound_grenade_flare_explode[index])
// Save to external file
amx_save_setting_string_arr(ZE_SETTING_RESOURCES, "Sounds", "GRENADE FLARE", g_sound_grenade_flare_explode)
}
// Load from external file, save if not found
if (!amx_load_setting_string(ZE_SETTING_RESOURCES, "Weapon Models", "GRENADE FLARE", g_v_szModelFlareGrenade, charsmax(g_v_szModelFlareGrenade)))
amx_save_setting_string(ZE_SETTING_RESOURCES, "Weapon Models", "GRENADE FLARE", g_v_szModelFlareGrenade)
if (!amx_load_setting_string(ZE_SETTING_RESOURCES, "Weapon Models", "GRENADE FLARE", g_p_szModelFlareGrenade, charsmax(g_p_szModelFlareGrenade)))
amx_save_setting_string(ZE_SETTING_RESOURCES, "Weapon Models", "GRENADE FLARE", g_p_szModelFlareGrenade)
if (!amx_load_setting_string(ZE_SETTING_RESOURCES, "Grenade Sprites", "TRAIL", g_sprite_grenade_trail, charsmax(g_sprite_grenade_trail)))
amx_save_setting_string(ZE_SETTING_RESOURCES, "Grenade Sprites", "TRAIL", g_sprite_grenade_trail)
if (!amx_load_setting_string(ZE_SETTING_RESOURCES, "Grenade Sprites", "RING", g_sprite_grenade_ring, charsmax(g_sprite_grenade_ring)))
amx_save_setting_string(ZE_SETTING_RESOURCES, "Grenade Sprites", "RING", g_sprite_grenade_ring)
if (!amx_load_setting_string(ZE_SETTING_RESOURCES, "Grenade Sprites", "EXPLODE", g_sprite_grenade_explode, charsmax(g_sprite_grenade_explode)))
amx_save_setting_string(ZE_SETTING_RESOURCES, "Grenade Sprites", "EXPLODE", g_sprite_grenade_explode)
new sound[SOUND_MAX_LENGTH]
for (index = 0; index < ArraySize(g_sound_grenade_flare_explode); index++)
{
ArrayGetString(g_sound_grenade_flare_explode, index, sound, charsmax(sound))
precache_sound(sound)
}
// Precache models
precache_model(g_v_szModelFlareGrenade)
precache_model(g_p_szModelFlareGrenade)
g_trailSpr = precache_model(g_sprite_grenade_trail)
Expl = precache_model("sprites/zerogxplode.spr")
gSpriteCircle = precache_model("sprites/shockwave.spr")
}
public ze_fw_core_cure_post(id, attacker)
{
// Set custom grenade model
cs_set_player_view_model(id, CSW_SMOKEGRENADE, g_v_szModelFlareGrenade)
cs_set_player_weap_model(id, CSW_SMOKEGRENADE, g_p_szModelFlareGrenade)
}
public ze_fw_core_infect(id, attacker)
{
// Remove custom grenade model
cs_reset_player_view_model(id, CSW_SMOKEGRENADE)
}
// Forward Set Model
public fw_SetModel(entity, const model[])
{
// We don't care
if (strlen(model) < 8)
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;
// Grenade's owner is zombie?
if (ze_is_user_zombie(pev(entity, pev_owner)))
return;
// Smoke Grenade
if (model[9] == 's' && model[10] == 'm')
{
// Give it a glow
fm_set_rendering(entity, kRenderFxGlowShell, 200, 200, 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(7) // width
write_byte(200) // r
write_byte(200) // 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_FLARE)
}
}
// Ham Grenade Think Forward
public fw_ThinkGrenade(entity)
{
// Invalid entity
if (!pev_valid(entity)) return HAM_IGNORED;
// Get damage time of grenade
static Float:dmgtime
pev(entity, pev_dmgtime, dmgtime)
new Float:current_time = get_gametime()
// Check if it's time to go off
if (dmgtime > current_time)
return HAM_IGNORED;
// Check if it's one of our custom nades
if (pev(entity, PEV_NADE_TYPE) != NADE_TYPE_FLARE)
return HAM_IGNORED;
flare_explode(entity)
// Get rid of the grenade
engfunc(EngFunc_RemoveEntity, entity)
return HAM_SUPERCEDE;
}
public flare_explode(entity)
{
static Float:origin[3] //
pev(entity, pev_origin, origin)
create_blast2(origin)
explode(entity, origin)
static attacker;
attacker = pev(entity, pev_owner)
static victim
victim = -1
while ((victim = engfunc(EngFunc_FindEntityInSphere, victim, origin, Float:260.0)) != 0)
{
// Only effect alive humans
if (!is_user_alive(victim) || !ze_is_user_zombie(victim))
continue;
static Float:orig[3], Float:dmg
pev(victim, pev_origin, orig)
dmg = 1267.0 - get_distance_f(origin, orig)
ExecuteHamB(Ham_TakeDamage, victim, entity, attacker, dmg, (1<<24))
static name[32]; get_user_name(victim, name, charsmax(name))
}
}
public explode(entiy, Float:origin[3])
{
message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
write_byte(TE_EXPLOSION)
engfunc(EngFunc_WriteCoord, origin[0])
engfunc(EngFunc_WriteCoord, origin[1])
engfunc(EngFunc_WriteCoord, origin[2])
write_short(Expl)
write_byte(60)
write_byte(15)
write_byte(0)
message_end()
}
// Fire Grenade: Fire Blast
create_blast2(const Float:origin[3])
{
// Smallest ring
engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, origin, 0)
write_byte(TE_BEAMCYLINDER) // TE id
engfunc(EngFunc_WriteCoord, origin[0]) // x
engfunc(EngFunc_WriteCoord, origin[1]) // y
engfunc(EngFunc_WriteCoord, origin[2]) // z
engfunc(EngFunc_WriteCoord, origin[0]) // x axis
engfunc(EngFunc_WriteCoord, origin[1]) // y axis
engfunc(EngFunc_WriteCoord, origin[2]+385.0) // z axis
write_short(gSpriteCircle) // sprite
write_byte(0) // startframe
write_byte(0) // framerate
write_byte(4) // life
write_byte(60) // width
write_byte(0) // noise
write_byte(200) // red
write_byte(200) // green
write_byte(200) // blue
write_byte(200) // brightness
write_byte(1) // speed
message_end()
// Medium ring
engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, origin, 0)
write_byte(TE_BEAMCYLINDER) // TE id
engfunc(EngFunc_WriteCoord, origin[0]) // x
engfunc(EngFunc_WriteCoord, origin[1]) // y
engfunc(EngFunc_WriteCoord, origin[2]) // z
engfunc(EngFunc_WriteCoord, origin[0]) // x axis
engfunc(EngFunc_WriteCoord, origin[1]) // y axis
engfunc(EngFunc_WriteCoord, origin[2]+470.0) // z axis
write_short(gSpriteCircle) // sprite
write_byte(0) // startframe
write_byte(0) // framerate
write_byte(4) // life
write_byte(60) // width
write_byte(0) // noise
write_byte(200) // red
write_byte(200) // green
write_byte(200) // blue
write_byte(200) // brightness
write_byte(1) // speed
message_end()
// Largest ring
engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, origin, 0)
write_byte(TE_BEAMCYLINDER) // TE id
engfunc(EngFunc_WriteCoord, origin[0]) // x
engfunc(EngFunc_WriteCoord, origin[1]) // y
engfunc(EngFunc_WriteCoord, origin[2]) // z
engfunc(EngFunc_WriteCoord, origin[0]) // x axis
engfunc(EngFunc_WriteCoord, origin[1]) // y axis
engfunc(EngFunc_WriteCoord, origin[2]+555.0) // z axis
write_short(gSpriteCircle) // sprite
write_byte(0) // startframe
write_byte(0) // framerate
write_byte(4) // life
write_byte(60) // width
write_byte(0) // noise
write_byte(200) // red
write_byte(200) // green
write_byte(200) // blue
write_byte(200) // brightness
write_byte(1) // speed
message_end()
}
// Set entity's rendering type (from fakemeta_util)
stock fm_set_rendering(entity, fx = kRenderFxNone, r = 255, g = 255, b = 255, render = kRenderNormal, amount = 16)
{
static 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)
set_pev(entity, pev_renderamt, float(amount))
}
// Get entity's speed (from fakemeta_util)
stock fm_get_speed(entity)
{
static Float:velocity[3]
pev(entity, pev_velocity, velocity)
return floatround(vector_length(velocity));
}
Last edited by sPe3doN 4 years ago, edited 1 time in total.
-
- Veteran Member
- Posts: 408
- Joined: 5 years ago
- Contact:
models ? sounds ? sprites ?sPe3doN wrote: ↑4 years ago tryCode: Select all
#include <zombie_escape> // Settings file new const ZE_SETTING_RESOURCES[] = "zombie_escape.ini" // Default sounds new const sound_grenade_flare_explode[][] = { "items/nvg_on.wav" } #define MODEL_MAX_LENGTH 64 #define SOUND_MAX_LENGTH 64 #define SPRITE_MAX_LENGTH 64 // Models new g_v_szModelFlareGrenade[MODEL_MAX_LENGTH] = "models/zombie_escape/v_grenade_explode.mdl" new g_p_szModelFlareGrenade[MODEL_MAX_LENGTH] = "models/zombie_escape/p_grenade_explode.mdl" // Sprites new g_sprite_grenade_trail[SPRITE_MAX_LENGTH] = "sprites/laserbeam.spr" new g_sprite_grenade_ring[SPRITE_MAX_LENGTH] = "sprites/shockwave.spr" new g_sprite_grenade_explode[SPRITE_MAX_LENGTH] = "sprites/zerogxplode.spr" new Array:g_sound_grenade_flare_explode // HACK: pev_ field used to store custom nade types and their values const PEV_NADE_TYPE = pev_flTimeStepSound const NADE_TYPE_FLARE = 4444 new g_trailSpr, Expl, gSpriteCircle public plugin_init() { register_plugin("[ZE] Frost Nade", ZE_VERSION, AUTHORS) register_forward(FM_SetModel, "fw_SetModel") RegisterHam(Ham_Think, "grenade", "fw_ThinkGrenade") } public plugin_precache() { // Initialize arrays g_sound_grenade_flare_explode = ArrayCreate(SOUND_MAX_LENGTH, 1) // Load from external file amx_load_setting_string_arr(ZE_SETTING_RESOURCES, "Sounds", "GRENADE FLARE", g_sound_grenade_flare_explode) // If we couldn't load custom sounds from file, use and save default ones new index if (ArraySize(g_sound_grenade_flare_explode) == 0) { for (index = 0; index < sizeof sound_grenade_flare_explode; index++) ArrayPushString(g_sound_grenade_flare_explode, sound_grenade_flare_explode[index]) // Save to external file amx_save_setting_string_arr(ZE_SETTING_RESOURCES, "Sounds", "GRENADE FLARE", g_sound_grenade_flare_explode) } // Load from external file, save if not found if (!amx_load_setting_string(ZE_SETTING_RESOURCES, "Weapon Models", "GRENADE FLARE", g_v_szModelFlareGrenade, charsmax(g_v_szModelFlareGrenade))) amx_save_setting_string(ZE_SETTING_RESOURCES, "Weapon Models", "GRENADE FLARE", g_v_szModelFlareGrenade) if (!amx_load_setting_string(ZE_SETTING_RESOURCES, "Weapon Models", "GRENADE FLARE", g_p_szModelFlareGrenade, charsmax(g_p_szModelFlareGrenade))) amx_save_setting_string(ZE_SETTING_RESOURCES, "Weapon Models", "GRENADE FLARE", g_p_szModelFlareGrenade) if (!amx_load_setting_string(ZE_SETTING_RESOURCES, "Grenade Sprites", "TRAIL", g_sprite_grenade_trail, charsmax(g_sprite_grenade_trail))) amx_save_setting_string(ZE_SETTING_RESOURCES, "Grenade Sprites", "TRAIL", g_sprite_grenade_trail) if (!amx_load_setting_string(ZE_SETTING_RESOURCES, "Grenade Sprites", "RING", g_sprite_grenade_ring, charsmax(g_sprite_grenade_ring))) amx_save_setting_string(ZE_SETTING_RESOURCES, "Grenade Sprites", "RING", g_sprite_grenade_ring) if (!amx_load_setting_string(ZE_SETTING_RESOURCES, "Grenade Sprites", "EXPLODE", g_sprite_grenade_explode, charsmax(g_sprite_grenade_explode))) amx_save_setting_string(ZE_SETTING_RESOURCES, "Grenade Sprites", "EXPLODE", g_sprite_grenade_explode) new sound[SOUND_MAX_LENGTH] for (index = 0; index < ArraySize(g_sound_grenade_flare_explode); index++) { ArrayGetString(g_sound_grenade_flare_explode, index, sound, charsmax(sound)) precache_sound(sound) } // Precache models precache_model(g_v_szModelFlareGrenade) precache_model(g_p_szModelFlareGrenade) g_trailSpr = precache_model(g_sprite_grenade_trail) Expl = precache_model("sprites/zerogxplode.spr") gSpriteCircle = precache_model("sprites/shockwave.spr") } public ze_fw_core_cure_post(id, attacker) { // Set custom grenade model cs_set_player_view_model(id, CSW_SMOKEGRENADE, g_v_szModelFlareGrenade) cs_set_player_weap_model(id, CSW_SMOKEGRENADE, g_p_szModelFlareGrenade) } public ze_fw_core_infect(id, attacker) { // Remove custom grenade model cs_reset_player_view_model(id, CSW_SMOKEGRENADE) } // Forward Set Model public fw_SetModel(entity, const model[]) { // We don't care if (strlen(model) < 8) 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; // Grenade's owner is zombie? if (ze_is_user_zombie(pev(entity, pev_owner))) return; // Smoke Grenade if (model[9] == 's' && model[10] == 'm') { // Give it a glow fm_set_rendering(entity, kRenderFxGlowShell, 200, 200, 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(7) // width write_byte(200) // r write_byte(200) // 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_FLARE) } } // Ham Grenade Think Forward public fw_ThinkGrenade(entity) { // Invalid entity if (!pev_valid(entity)) return HAM_IGNORED; // Get damage time of grenade static Float:dmgtime pev(entity, pev_dmgtime, dmgtime) new Float:current_time = get_gametime() // Check if it's time to go off if (dmgtime > current_time) return HAM_IGNORED; // Check if it's one of our custom nades if (pev(entity, PEV_NADE_TYPE) != NADE_TYPE_FLARE) return HAM_IGNORED; flare_explode(entity) // Get rid of the grenade engfunc(EngFunc_RemoveEntity, entity) return HAM_SUPERCEDE; } public flare_explode(entity) { static Float:origin[3] // pev(entity, pev_origin, origin) create_blast2(origin) explode(entity, origin) static attacker; attacker = pev(entity, pev_owner) static victim victim = -1 while ((victim = engfunc(EngFunc_FindEntityInSphere, victim, origin, Float:260.0)) != 0) { // Only effect alive humans if (!is_user_alive(victim) || !ze_is_user_zombie(victim)) continue; static Float:orig[3], Float:dmg pev(victim, pev_origin, orig) dmg = 1267.0 - get_distance_f(origin, orig) ExecuteHamB(Ham_TakeDamage, victim, entity, attacker, dmg, (1<<24)) static name[32]; get_user_name(victim, name, charsmax(name)) } } public explode(entiy, Float:origin[3]) { message_begin(MSG_BROADCAST, SVC_TEMPENTITY) write_byte(TE_EXPLOSION) engfunc(EngFunc_WriteCoord, origin[0]) engfunc(EngFunc_WriteCoord, origin[1]) engfunc(EngFunc_WriteCoord, origin[2]) write_short(Expl) write_byte(60) write_byte(15) write_byte(0) message_end() } // Fire Grenade: Fire Blast create_blast2(const Float:origin[3]) { // Smallest ring engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, origin, 0) write_byte(TE_BEAMCYLINDER) // TE id engfunc(EngFunc_WriteCoord, origin[0]) // x engfunc(EngFunc_WriteCoord, origin[1]) // y engfunc(EngFunc_WriteCoord, origin[2]) // z engfunc(EngFunc_WriteCoord, origin[0]) // x axis engfunc(EngFunc_WriteCoord, origin[1]) // y axis engfunc(EngFunc_WriteCoord, origin[2]+385.0) // z axis write_short(gSpriteCircle) // sprite write_byte(0) // startframe write_byte(0) // framerate write_byte(4) // life write_byte(60) // width write_byte(0) // noise write_byte(200) // red write_byte(200) // green write_byte(200) // blue write_byte(200) // brightness write_byte(1) // speed message_end() // Medium ring engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, origin, 0) write_byte(TE_BEAMCYLINDER) // TE id engfunc(EngFunc_WriteCoord, origin[0]) // x engfunc(EngFunc_WriteCoord, origin[1]) // y engfunc(EngFunc_WriteCoord, origin[2]) // z engfunc(EngFunc_WriteCoord, origin[0]) // x axis engfunc(EngFunc_WriteCoord, origin[1]) // y axis engfunc(EngFunc_WriteCoord, origin[2]+470.0) // z axis write_short(gSpriteCircle) // sprite write_byte(0) // startframe write_byte(0) // framerate write_byte(4) // life write_byte(60) // width write_byte(0) // noise write_byte(200) // red write_byte(200) // green write_byte(200) // blue write_byte(200) // brightness write_byte(1) // speed message_end() // Largest ring engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, origin, 0) write_byte(TE_BEAMCYLINDER) // TE id engfunc(EngFunc_WriteCoord, origin[0]) // x engfunc(EngFunc_WriteCoord, origin[1]) // y engfunc(EngFunc_WriteCoord, origin[2]) // z engfunc(EngFunc_WriteCoord, origin[0]) // x axis engfunc(EngFunc_WriteCoord, origin[1]) // y axis engfunc(EngFunc_WriteCoord, origin[2]+555.0) // z axis write_short(gSpriteCircle) // sprite write_byte(0) // startframe write_byte(0) // framerate write_byte(4) // life write_byte(60) // width write_byte(0) // noise write_byte(200) // red write_byte(200) // green write_byte(200) // blue write_byte(200) // brightness write_byte(1) // speed message_end() } // Set entity's rendering type (from fakemeta_util) stock fm_set_rendering(entity, fx = kRenderFxNone, r = 255, g = 255, b = 255, render = kRenderNormal, amount = 16) { static 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) set_pev(entity, pev_renderamt, float(amount)) } // Get entity's speed (from fakemeta_util) stock fm_get_speed(entity) { static Float:velocity[3] pev(entity, pev_velocity, velocity) return floatround(vector_length(velocity)); }
Sprits are already on orginal cs sprits file (so you dont need to download them again)Muhammet20 wrote: ↑4 years agomodels ? sounds ? sprites ?sPe3doN wrote: ↑4 years ago tryCode: Select all
#include <zombie_escape> // Settings file new const ZE_SETTING_RESOURCES[] = "zombie_escape.ini" // Default sounds new const sound_grenade_flare_explode[][] = { "items/nvg_on.wav" } #define MODEL_MAX_LENGTH 64 #define SOUND_MAX_LENGTH 64 #define SPRITE_MAX_LENGTH 64 // Models new g_v_szModelFlareGrenade[MODEL_MAX_LENGTH] = "models/zombie_escape/v_grenade_explode.mdl" new g_p_szModelFlareGrenade[MODEL_MAX_LENGTH] = "models/zombie_escape/p_grenade_explode.mdl" // Sprites new g_sprite_grenade_trail[SPRITE_MAX_LENGTH] = "sprites/laserbeam.spr" new g_sprite_grenade_ring[SPRITE_MAX_LENGTH] = "sprites/shockwave.spr" new g_sprite_grenade_explode[SPRITE_MAX_LENGTH] = "sprites/zerogxplode.spr" new Array:g_sound_grenade_flare_explode // HACK: pev_ field used to store custom nade types and their values const PEV_NADE_TYPE = pev_flTimeStepSound const NADE_TYPE_FLARE = 4444 new g_trailSpr, Expl, gSpriteCircle public plugin_init() { register_plugin("[ZE] Frost Nade", ZE_VERSION, AUTHORS) register_forward(FM_SetModel, "fw_SetModel") RegisterHam(Ham_Think, "grenade", "fw_ThinkGrenade") } public plugin_precache() { // Initialize arrays g_sound_grenade_flare_explode = ArrayCreate(SOUND_MAX_LENGTH, 1) // Load from external file amx_load_setting_string_arr(ZE_SETTING_RESOURCES, "Sounds", "GRENADE FLARE", g_sound_grenade_flare_explode) // If we couldn't load custom sounds from file, use and save default ones new index if (ArraySize(g_sound_grenade_flare_explode) == 0) { for (index = 0; index < sizeof sound_grenade_flare_explode; index++) ArrayPushString(g_sound_grenade_flare_explode, sound_grenade_flare_explode[index]) // Save to external file amx_save_setting_string_arr(ZE_SETTING_RESOURCES, "Sounds", "GRENADE FLARE", g_sound_grenade_flare_explode) } // Load from external file, save if not found if (!amx_load_setting_string(ZE_SETTING_RESOURCES, "Weapon Models", "GRENADE FLARE", g_v_szModelFlareGrenade, charsmax(g_v_szModelFlareGrenade))) amx_save_setting_string(ZE_SETTING_RESOURCES, "Weapon Models", "GRENADE FLARE", g_v_szModelFlareGrenade) if (!amx_load_setting_string(ZE_SETTING_RESOURCES, "Weapon Models", "GRENADE FLARE", g_p_szModelFlareGrenade, charsmax(g_p_szModelFlareGrenade))) amx_save_setting_string(ZE_SETTING_RESOURCES, "Weapon Models", "GRENADE FLARE", g_p_szModelFlareGrenade) if (!amx_load_setting_string(ZE_SETTING_RESOURCES, "Grenade Sprites", "TRAIL", g_sprite_grenade_trail, charsmax(g_sprite_grenade_trail))) amx_save_setting_string(ZE_SETTING_RESOURCES, "Grenade Sprites", "TRAIL", g_sprite_grenade_trail) if (!amx_load_setting_string(ZE_SETTING_RESOURCES, "Grenade Sprites", "RING", g_sprite_grenade_ring, charsmax(g_sprite_grenade_ring))) amx_save_setting_string(ZE_SETTING_RESOURCES, "Grenade Sprites", "RING", g_sprite_grenade_ring) if (!amx_load_setting_string(ZE_SETTING_RESOURCES, "Grenade Sprites", "EXPLODE", g_sprite_grenade_explode, charsmax(g_sprite_grenade_explode))) amx_save_setting_string(ZE_SETTING_RESOURCES, "Grenade Sprites", "EXPLODE", g_sprite_grenade_explode) new sound[SOUND_MAX_LENGTH] for (index = 0; index < ArraySize(g_sound_grenade_flare_explode); index++) { ArrayGetString(g_sound_grenade_flare_explode, index, sound, charsmax(sound)) precache_sound(sound) } // Precache models precache_model(g_v_szModelFlareGrenade) precache_model(g_p_szModelFlareGrenade) g_trailSpr = precache_model(g_sprite_grenade_trail) Expl = precache_model("sprites/zerogxplode.spr") gSpriteCircle = precache_model("sprites/shockwave.spr") } public ze_fw_core_cure_post(id, attacker) { // Set custom grenade model cs_set_player_view_model(id, CSW_SMOKEGRENADE, g_v_szModelFlareGrenade) cs_set_player_weap_model(id, CSW_SMOKEGRENADE, g_p_szModelFlareGrenade) } public ze_fw_core_infect(id, attacker) { // Remove custom grenade model cs_reset_player_view_model(id, CSW_SMOKEGRENADE) } // Forward Set Model public fw_SetModel(entity, const model[]) { // We don't care if (strlen(model) < 8) 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; // Grenade's owner is zombie? if (ze_is_user_zombie(pev(entity, pev_owner))) return; // Smoke Grenade if (model[9] == 's' && model[10] == 'm') { // Give it a glow fm_set_rendering(entity, kRenderFxGlowShell, 200, 200, 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(7) // width write_byte(200) // r write_byte(200) // 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_FLARE) } } // Ham Grenade Think Forward public fw_ThinkGrenade(entity) { // Invalid entity if (!pev_valid(entity)) return HAM_IGNORED; // Get damage time of grenade static Float:dmgtime pev(entity, pev_dmgtime, dmgtime) new Float:current_time = get_gametime() // Check if it's time to go off if (dmgtime > current_time) return HAM_IGNORED; // Check if it's one of our custom nades if (pev(entity, PEV_NADE_TYPE) != NADE_TYPE_FLARE) return HAM_IGNORED; flare_explode(entity) // Get rid of the grenade engfunc(EngFunc_RemoveEntity, entity) return HAM_SUPERCEDE; } public flare_explode(entity) { static Float:origin[3] // pev(entity, pev_origin, origin) create_blast2(origin) explode(entity, origin) static attacker; attacker = pev(entity, pev_owner) static victim victim = -1 while ((victim = engfunc(EngFunc_FindEntityInSphere, victim, origin, Float:260.0)) != 0) { // Only effect alive humans if (!is_user_alive(victim) || !ze_is_user_zombie(victim)) continue; static Float:orig[3], Float:dmg pev(victim, pev_origin, orig) dmg = 1267.0 - get_distance_f(origin, orig) ExecuteHamB(Ham_TakeDamage, victim, entity, attacker, dmg, (1<<24)) static name[32]; get_user_name(victim, name, charsmax(name)) } } public explode(entiy, Float:origin[3]) { message_begin(MSG_BROADCAST, SVC_TEMPENTITY) write_byte(TE_EXPLOSION) engfunc(EngFunc_WriteCoord, origin[0]) engfunc(EngFunc_WriteCoord, origin[1]) engfunc(EngFunc_WriteCoord, origin[2]) write_short(Expl) write_byte(60) write_byte(15) write_byte(0) message_end() } // Fire Grenade: Fire Blast create_blast2(const Float:origin[3]) { // Smallest ring engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, origin, 0) write_byte(TE_BEAMCYLINDER) // TE id engfunc(EngFunc_WriteCoord, origin[0]) // x engfunc(EngFunc_WriteCoord, origin[1]) // y engfunc(EngFunc_WriteCoord, origin[2]) // z engfunc(EngFunc_WriteCoord, origin[0]) // x axis engfunc(EngFunc_WriteCoord, origin[1]) // y axis engfunc(EngFunc_WriteCoord, origin[2]+385.0) // z axis write_short(gSpriteCircle) // sprite write_byte(0) // startframe write_byte(0) // framerate write_byte(4) // life write_byte(60) // width write_byte(0) // noise write_byte(200) // red write_byte(200) // green write_byte(200) // blue write_byte(200) // brightness write_byte(1) // speed message_end() // Medium ring engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, origin, 0) write_byte(TE_BEAMCYLINDER) // TE id engfunc(EngFunc_WriteCoord, origin[0]) // x engfunc(EngFunc_WriteCoord, origin[1]) // y engfunc(EngFunc_WriteCoord, origin[2]) // z engfunc(EngFunc_WriteCoord, origin[0]) // x axis engfunc(EngFunc_WriteCoord, origin[1]) // y axis engfunc(EngFunc_WriteCoord, origin[2]+470.0) // z axis write_short(gSpriteCircle) // sprite write_byte(0) // startframe write_byte(0) // framerate write_byte(4) // life write_byte(60) // width write_byte(0) // noise write_byte(200) // red write_byte(200) // green write_byte(200) // blue write_byte(200) // brightness write_byte(1) // speed message_end() // Largest ring engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, origin, 0) write_byte(TE_BEAMCYLINDER) // TE id engfunc(EngFunc_WriteCoord, origin[0]) // x engfunc(EngFunc_WriteCoord, origin[1]) // y engfunc(EngFunc_WriteCoord, origin[2]) // z engfunc(EngFunc_WriteCoord, origin[0]) // x axis engfunc(EngFunc_WriteCoord, origin[1]) // y axis engfunc(EngFunc_WriteCoord, origin[2]+555.0) // z axis write_short(gSpriteCircle) // sprite write_byte(0) // startframe write_byte(0) // framerate write_byte(4) // life write_byte(60) // width write_byte(0) // noise write_byte(200) // red write_byte(200) // green write_byte(200) // blue write_byte(200) // brightness write_byte(1) // speed message_end() } // Set entity's rendering type (from fakemeta_util) stock fm_set_rendering(entity, fx = kRenderFxNone, r = 255, g = 255, b = 255, render = kRenderNormal, amount = 16) { static 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) set_pev(entity, pev_renderamt, float(amount)) } // Get entity's speed (from fakemeta_util) stock fm_get_speed(entity) { static Float:velocity[3] pev(entity, pev_velocity, velocity) return floatround(vector_length(velocity)); }
Sounds it's using normal HE sounds (you can change it)
Model (use any model you want you can change it also)
-
- Veteran Member
- Posts: 408
- Joined: 5 years ago
- Contact:
okay thanks brosPe3doN wrote: ↑4 years agoSprits are already on orginal cs sprits file (so you dont need to download them again)Muhammet20 wrote: ↑4 years agomodels ? sounds ? sprites ?sPe3doN wrote: ↑4 years ago tryCode: Select all
#include <zombie_escape> // Settings file new const ZE_SETTING_RESOURCES[] = "zombie_escape.ini" // Default sounds new const sound_grenade_flare_explode[][] = { "items/nvg_on.wav" } #define MODEL_MAX_LENGTH 64 #define SOUND_MAX_LENGTH 64 #define SPRITE_MAX_LENGTH 64 // Models new g_v_szModelFlareGrenade[MODEL_MAX_LENGTH] = "models/zombie_escape/v_grenade_explode.mdl" new g_p_szModelFlareGrenade[MODEL_MAX_LENGTH] = "models/zombie_escape/p_grenade_explode.mdl" // Sprites new g_sprite_grenade_trail[SPRITE_MAX_LENGTH] = "sprites/laserbeam.spr" new g_sprite_grenade_ring[SPRITE_MAX_LENGTH] = "sprites/shockwave.spr" new g_sprite_grenade_explode[SPRITE_MAX_LENGTH] = "sprites/zerogxplode.spr" new Array:g_sound_grenade_flare_explode // HACK: pev_ field used to store custom nade types and their values const PEV_NADE_TYPE = pev_flTimeStepSound const NADE_TYPE_FLARE = 4444 new g_trailSpr, Expl, gSpriteCircle public plugin_init() { register_plugin("[ZE] Frost Nade", ZE_VERSION, AUTHORS) register_forward(FM_SetModel, "fw_SetModel") RegisterHam(Ham_Think, "grenade", "fw_ThinkGrenade") } public plugin_precache() { // Initialize arrays g_sound_grenade_flare_explode = ArrayCreate(SOUND_MAX_LENGTH, 1) // Load from external file amx_load_setting_string_arr(ZE_SETTING_RESOURCES, "Sounds", "GRENADE FLARE", g_sound_grenade_flare_explode) // If we couldn't load custom sounds from file, use and save default ones new index if (ArraySize(g_sound_grenade_flare_explode) == 0) { for (index = 0; index < sizeof sound_grenade_flare_explode; index++) ArrayPushString(g_sound_grenade_flare_explode, sound_grenade_flare_explode[index]) // Save to external file amx_save_setting_string_arr(ZE_SETTING_RESOURCES, "Sounds", "GRENADE FLARE", g_sound_grenade_flare_explode) } // Load from external file, save if not found if (!amx_load_setting_string(ZE_SETTING_RESOURCES, "Weapon Models", "GRENADE FLARE", g_v_szModelFlareGrenade, charsmax(g_v_szModelFlareGrenade))) amx_save_setting_string(ZE_SETTING_RESOURCES, "Weapon Models", "GRENADE FLARE", g_v_szModelFlareGrenade) if (!amx_load_setting_string(ZE_SETTING_RESOURCES, "Weapon Models", "GRENADE FLARE", g_p_szModelFlareGrenade, charsmax(g_p_szModelFlareGrenade))) amx_save_setting_string(ZE_SETTING_RESOURCES, "Weapon Models", "GRENADE FLARE", g_p_szModelFlareGrenade) if (!amx_load_setting_string(ZE_SETTING_RESOURCES, "Grenade Sprites", "TRAIL", g_sprite_grenade_trail, charsmax(g_sprite_grenade_trail))) amx_save_setting_string(ZE_SETTING_RESOURCES, "Grenade Sprites", "TRAIL", g_sprite_grenade_trail) if (!amx_load_setting_string(ZE_SETTING_RESOURCES, "Grenade Sprites", "RING", g_sprite_grenade_ring, charsmax(g_sprite_grenade_ring))) amx_save_setting_string(ZE_SETTING_RESOURCES, "Grenade Sprites", "RING", g_sprite_grenade_ring) if (!amx_load_setting_string(ZE_SETTING_RESOURCES, "Grenade Sprites", "EXPLODE", g_sprite_grenade_explode, charsmax(g_sprite_grenade_explode))) amx_save_setting_string(ZE_SETTING_RESOURCES, "Grenade Sprites", "EXPLODE", g_sprite_grenade_explode) new sound[SOUND_MAX_LENGTH] for (index = 0; index < ArraySize(g_sound_grenade_flare_explode); index++) { ArrayGetString(g_sound_grenade_flare_explode, index, sound, charsmax(sound)) precache_sound(sound) } // Precache models precache_model(g_v_szModelFlareGrenade) precache_model(g_p_szModelFlareGrenade) g_trailSpr = precache_model(g_sprite_grenade_trail) Expl = precache_model("sprites/zerogxplode.spr") gSpriteCircle = precache_model("sprites/shockwave.spr") } public ze_fw_core_cure_post(id, attacker) { // Set custom grenade model cs_set_player_view_model(id, CSW_SMOKEGRENADE, g_v_szModelFlareGrenade) cs_set_player_weap_model(id, CSW_SMOKEGRENADE, g_p_szModelFlareGrenade) } public ze_fw_core_infect(id, attacker) { // Remove custom grenade model cs_reset_player_view_model(id, CSW_SMOKEGRENADE) } // Forward Set Model public fw_SetModel(entity, const model[]) { // We don't care if (strlen(model) < 8) 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; // Grenade's owner is zombie? if (ze_is_user_zombie(pev(entity, pev_owner))) return; // Smoke Grenade if (model[9] == 's' && model[10] == 'm') { // Give it a glow fm_set_rendering(entity, kRenderFxGlowShell, 200, 200, 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(7) // width write_byte(200) // r write_byte(200) // 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_FLARE) } } // Ham Grenade Think Forward public fw_ThinkGrenade(entity) { // Invalid entity if (!pev_valid(entity)) return HAM_IGNORED; // Get damage time of grenade static Float:dmgtime pev(entity, pev_dmgtime, dmgtime) new Float:current_time = get_gametime() // Check if it's time to go off if (dmgtime > current_time) return HAM_IGNORED; // Check if it's one of our custom nades if (pev(entity, PEV_NADE_TYPE) != NADE_TYPE_FLARE) return HAM_IGNORED; flare_explode(entity) // Get rid of the grenade engfunc(EngFunc_RemoveEntity, entity) return HAM_SUPERCEDE; } public flare_explode(entity) { static Float:origin[3] // pev(entity, pev_origin, origin) create_blast2(origin) explode(entity, origin) static attacker; attacker = pev(entity, pev_owner) static victim victim = -1 while ((victim = engfunc(EngFunc_FindEntityInSphere, victim, origin, Float:260.0)) != 0) { // Only effect alive humans if (!is_user_alive(victim) || !ze_is_user_zombie(victim)) continue; static Float:orig[3], Float:dmg pev(victim, pev_origin, orig) dmg = 1267.0 - get_distance_f(origin, orig) ExecuteHamB(Ham_TakeDamage, victim, entity, attacker, dmg, (1<<24)) static name[32]; get_user_name(victim, name, charsmax(name)) } } public explode(entiy, Float:origin[3]) { message_begin(MSG_BROADCAST, SVC_TEMPENTITY) write_byte(TE_EXPLOSION) engfunc(EngFunc_WriteCoord, origin[0]) engfunc(EngFunc_WriteCoord, origin[1]) engfunc(EngFunc_WriteCoord, origin[2]) write_short(Expl) write_byte(60) write_byte(15) write_byte(0) message_end() } // Fire Grenade: Fire Blast create_blast2(const Float:origin[3]) { // Smallest ring engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, origin, 0) write_byte(TE_BEAMCYLINDER) // TE id engfunc(EngFunc_WriteCoord, origin[0]) // x engfunc(EngFunc_WriteCoord, origin[1]) // y engfunc(EngFunc_WriteCoord, origin[2]) // z engfunc(EngFunc_WriteCoord, origin[0]) // x axis engfunc(EngFunc_WriteCoord, origin[1]) // y axis engfunc(EngFunc_WriteCoord, origin[2]+385.0) // z axis write_short(gSpriteCircle) // sprite write_byte(0) // startframe write_byte(0) // framerate write_byte(4) // life write_byte(60) // width write_byte(0) // noise write_byte(200) // red write_byte(200) // green write_byte(200) // blue write_byte(200) // brightness write_byte(1) // speed message_end() // Medium ring engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, origin, 0) write_byte(TE_BEAMCYLINDER) // TE id engfunc(EngFunc_WriteCoord, origin[0]) // x engfunc(EngFunc_WriteCoord, origin[1]) // y engfunc(EngFunc_WriteCoord, origin[2]) // z engfunc(EngFunc_WriteCoord, origin[0]) // x axis engfunc(EngFunc_WriteCoord, origin[1]) // y axis engfunc(EngFunc_WriteCoord, origin[2]+470.0) // z axis write_short(gSpriteCircle) // sprite write_byte(0) // startframe write_byte(0) // framerate write_byte(4) // life write_byte(60) // width write_byte(0) // noise write_byte(200) // red write_byte(200) // green write_byte(200) // blue write_byte(200) // brightness write_byte(1) // speed message_end() // Largest ring engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, origin, 0) write_byte(TE_BEAMCYLINDER) // TE id engfunc(EngFunc_WriteCoord, origin[0]) // x engfunc(EngFunc_WriteCoord, origin[1]) // y engfunc(EngFunc_WriteCoord, origin[2]) // z engfunc(EngFunc_WriteCoord, origin[0]) // x axis engfunc(EngFunc_WriteCoord, origin[1]) // y axis engfunc(EngFunc_WriteCoord, origin[2]+555.0) // z axis write_short(gSpriteCircle) // sprite write_byte(0) // startframe write_byte(0) // framerate write_byte(4) // life write_byte(60) // width write_byte(0) // noise write_byte(200) // red write_byte(200) // green write_byte(200) // blue write_byte(200) // brightness write_byte(1) // speed message_end() } // Set entity's rendering type (from fakemeta_util) stock fm_set_rendering(entity, fx = kRenderFxNone, r = 255, g = 255, b = 255, render = kRenderNormal, amount = 16) { static 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) set_pev(entity, pev_renderamt, float(amount)) } // Get entity's speed (from fakemeta_util) stock fm_get_speed(entity) { static Float:velocity[3] pev(entity, pev_velocity, velocity) return floatround(vector_length(velocity)); }
Sounds it's using normal HE sounds (you can change it)
Model (use any model you want you can change it also)
Create an account or sign in to join the discussion
You need to be a member in order to post a reply
Create an account
Not a member? register to join our community
Members can start their own topics & subscribe to topics
It’s free and only takes a minute
Sign in
Who is online
Users browsing this forum: No registered users and 9 guests