Converted Grom Nade for Humans

Zombies/Humans Extra-Items
Post Reply
User avatar
Mark
VIP
VIP
United States of America
Posts: 283
Joined: 5 years ago
Location: Des Moines/USA
Contact:

Grom Nade for Humans

#1

Post by Mark » 5 years ago

Grom Grenade
Description:
  • A new extra-item for Zombies, Grom Grenade
  • When thrown near humans it will pull them to the nade and blow them up. Try it its pretty kool :D
  • Code:

    1. new g_has_grenade[33],g_item_id,
    2. g_trail,g_ring,
    3. g_gibss,g_traser
    4.  
    5. #define NADE_ENTIY          "weapon_flashbang"
    6. #define NADE_CSW            CSW_FLASHBANG
    7. #define NADE_TYPE_GROM          382878
    8. #define NADE_EXPLODE_DAMAGE             1000.0
    9. #define NADE_RADIUS_HOOK            700.0
    10. #define NADE_RADIUS_EXPLODE         300.0
    11. #define NADE_SPEED                  130.0
    12. #define NADE_DURATION               4
    13. #define PLUGIN                      "Grom grenade"
    14. #define VERSION                     "1.0"
    15. #define AUTHOR                      "Mark"
    16. #define MAXPLAYERS     32
    17. #include <zombie_escape>
    18. #include <fakemeta_util>
    19.  
    20.  
    21. new const grenade_model_v [ ] = "models/csozz/v_zombibomb.mdl"
    22. new const grenade_model_p [ ] = "models/csozz/p_bomb.mdl"
    23. new const grenade_model_w [ ] = "models/csozz/w_zombibomb.mdl"
    24.  
    25. new const hud_spr[][] = {
    26.     "sprites/csozz/ionbeam.spr",
    27.     "sprites/csozz/lasthope_bflare.spr",
    28.     "sprites/shockwave.spr",
    29.     "sprites/laserbeam.spr",
    30.     "sprites/csozz/640hud65.spr",
    31.     "sprites/csozz/640hud64.spr",
    32.     "sprites/csozz/640hud7x.spr"
    33. }
    34. new const sound[][] = {
    35.     "city/other/beacon_attack.wav",
    36.     "city/other/beacon_beep.wav"
    37. }
    38. enum
    39. {
    40.     TRASER_STARTFRAME   = 0,
    41.     TRASER_FRAMERATE    = 0,
    42.     TRASER_LIFE         = 40,
    43.     TRASER_WEIGTH       = 180,
    44.     TRASER_NOISE        = 0,
    45.     TRASER_COLOR_RED    = 255,
    46.     TRASER_COLOR_GREEN  = 255,
    47.     TRASER_COLOR_BLUE   = 255,
    48.     TRASER_BRIGHTNESS   = 255,
    49.     TRASER_SPEED        = 0,
    50.     GIBS_COUNT      = 100,
    51.     GIBS_LIFE       = 90,
    52.     GIBS_SCALE      = 6,
    53.     GIBS_VELOSITY       = 50,
    54.     GIBS_RENDOM_OF_VELOSITY = 40,
    55.     RENDERING_RED       = 255,
    56.     RENDERING_GREEN     = 20,
    57.     RENDERING_BLUE      = 147,
    58.     TRAIL_LIFE      = 10,
    59.     TRAIL_WEIGTH        = 10,
    60.     TRAIL_RED       = 255,
    61.     TRAIL_GREEN     = 20,
    62.     TRAIL_BLUE      = 147,
    63.     TRAIL_BRIGHTNESS    = 255
    64. }
    65. new const wpnlist_txt_name[]    = "weapon_zombth_paxan"
    66.  
    67. public plugin_init() {
    68.     register_plugin(PLUGIN, VERSION, AUTHOR)
    69.     RegisterHam(Ham_Think,            "grenade",        "HAM_Think", false)
    70.     RegisterHam(Ham_Spawn,            "player",         "HAM_Spawn", false)
    71.     RegisterHam(Ham_Item_Deploy,      NADE_ENTIY,   "HAM_Deploy", true)
    72.     register_forward(FM_SetModel,               "FM_Set_Model", false)
    73.     g_item_id = ze_register_item("Grom", 40, 0)
    74. }
    75. public plugin_precache() {
    76.     new sFile[64];formatex(sFile, charsmax(sFile), "sprites/%s.txt", wpnlist_txt_name)
    77.     precache_generic(sFile)
    78.     precache_model(grenade_model_p)
    79.     precache_model(grenade_model_v)
    80.     precache_model(grenade_model_w)
    81.     for(new i;i<=charsmax(sound);i++)precache_sound(sound[i])
    82.     for(new i;i<=charsmax(hud_spr);i++) precache_generic(hud_spr[i])
    83.     g_trail = precache_model(hud_spr[3])
    84.     g_ring = precache_model(hud_spr[2])
    85.     g_gibss = precache_model(hud_spr[1])
    86.     g_traser = precache_model(hud_spr[0])
    87.     register_clcmd(wpnlist_txt_name, "Weapon_Hook_Select")
    88. }
    89. public ze_select_item_pre(id, itemid)
    90. {
    91.     // Return Available and we will block it in Post, So it dosen't affect other plugins
    92.     if (itemid != g_item_id)
    93.         return ZE_ITEM_AVAILABLE
    94.    
    95.     // Available for Zombies only, So don't show it for Humans
    96.     if(!ze_is_user_zombie(id))
    97.         return ZE_ITEM_DONT_SHOW
    98.    
    99.     return ZE_ITEM_AVAILABLE
    100. }
    101. public ze_select_item_post(id, itemid)
    102. {
    103.     if(itemid == g_item_id)
    104.     {
    105.         if(g_has_grenade[id] >= 1)
    106.         {
    107.             return PLUGIN_HANDLED;
    108.         }  
    109.         g_has_grenade[id] = true    
    110.         fm_give_item(id, NADE_ENTIY)    
    111.     }
    112.     return PLUGIN_HANDLED;
    113. }
    114. public ze_user_humanized(id)
    115. {
    116.     g_has_grenade[id] = 0;
    117. }
    118. public HAM_Deploy(ent){
    119.     if(!pev_valid(ent))return;
    120.     new id = get_pdata_cbase(ent, 41, 4)
    121.     if(!is_user_alive(id))return
    122.     if(g_has_grenade[id]){
    123.         set_pev(id, pev_viewmodel2, grenade_model_v)
    124.         set_pev(id, pev_weaponmodel2, grenade_model_p)
    125.     }
    126. }
    127. public HAM_Think(entity) {
    128.     if(!pev_valid(entity))return HAM_IGNORED;
    129.     static Float:flDmgTime, Float:flTime;
    130.     pev(entity, pev_dmgtime, flDmgTime);
    131.     flTime = get_gametime();
    132.     if( flDmgTime > flTime){
    133.         return HAM_IGNORED;
    134.     }  
    135.     if(pev(entity, pev_flTimeStepSound) == NADE_TYPE_GROM){
    136.         static duration;duration = pev(entity, pev_flSwimTime);
    137.         if (duration > 0){
    138.             new Float:originF[3]
    139.             pev(entity, pev_origin, originF);
    140.             if (duration == 1){
    141.                 remove_task(entity)
    142.                 EFFECKT_EXPLODE(originF, entity)
    143.                 engfunc(EngFunc_RemoveEntity, entity);
    144.                 return HAM_SUPERCEDE;
    145.             }
    146.             EFFECKT(originF, duration);
    147.             set_task(0.1, "HUMAN_HOOK", entity, _, _, "b");
    148.             if(duration == 2)
    149.             set_task(0.1, "BEEP_SOUNDS", entity, _, _, "b");    
    150.             else emit_sound(entity, CHAN_WEAPON, sound[1], 1.0, ATTN_NORM, 0, PITCH_HIGH);
    151.             set_pev(entity, pev_flSwimTime, --duration);
    152.             set_pev(entity, pev_dmgtime, flTime + 3.0);
    153.         } else if ((pev(entity, pev_flags) & FL_ONGROUND) && fm_get_speed(entity) < 10){
    154.             set_pev(entity, pev_flSwimTime, 1 + NADE_DURATION)/3
    155.             set_pev(entity, pev_dmgtime, flTime + 0.1)
    156.         } else set_pev(entity, pev_dmgtime, flTime + 0.5)
    157.     }
    158.     return HAM_IGNORED;
    159. }
    160. public FM_Set_Model(Entity, const Model[]) {
    161.     static owner
    162.     owner = pev(Entity, pev_owner)
    163.     if(!pev_valid(Entity))return FMRES_IGNORED
    164.     if (g_has_grenade [ owner ] >= 1 && equal ( Model [ 7 ], "w_fl", 4 ) ){
    165.         g_has_grenade[owner]--
    166.         message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
    167.         write_byte(TE_BEAMFOLLOW)
    168.         write_short(Entity)
    169.         write_short(g_trail)
    170.         write_byte(TRAIL_LIFE)  
    171.         write_byte(TRAIL_WEIGTH)
    172.         write_byte(TRAIL_RED)
    173.         write_byte(TRAIL_GREEN)  
    174.         write_byte(TRAIL_BLUE)
    175.         write_byte(TRAIL_BRIGHTNESS)
    176.         message_end()
    177.         set_pev(Entity, pev_flTimeStepSound, NADE_TYPE_GROM)
    178.         engfunc(EngFunc_SetModel, Entity, grenade_model_w)
    179.         fm_set_rendering(Entity, kRenderFxGlowShell, RENDERING_RED, RENDERING_GREEN, RENDERING_BLUE, kRenderNormal, 16)
    180.         return FMRES_SUPERCEDE
    181.     }
    182.     return FMRES_IGNORED
    183. }
    184. public BEEP_SOUNDS(entity) {
    185.     if (!pev_valid(entity)){
    186.         remove_task(entity);
    187.         return;
    188.     }
    189.     emit_sound(entity, CHAN_WEAPON, sound[1], 1.0, ATTN_NORM, 0, PITCH_HIGH);
    190. }
    191. public HUMAN_HOOK(entity){
    192.     if (!pev_valid(entity)){
    193.         remove_task(entity);
    194.         return;
    195.     }
    196.     static Float:originF[3], Float:radius, victim = -1;
    197.     radius = NADE_RADIUS_HOOK
    198.     pev(entity, pev_origin, originF);
    199.     while ((victim = engfunc(EngFunc_FindEntityInSphere, victim, originF, radius)) != 0){
    200.         if (!is_user_alive(victim) || ze_is_user_zombie(victim))
    201.         continue;
    202.         new Float:fl_Velocity[3];
    203.         new vicOrigin[3], originN[3];
    204.         get_user_origin(victim, vicOrigin);
    205.         originN[0] = floatround(originF[0]);
    206.         originN[1] = floatround(originF[1]);
    207.         originN[2] = floatround(originF[2]);
    208.         new distance = get_distance(originN, vicOrigin);
    209.         if (distance > 1){
    210.             new Float:fl_Time = distance / NADE_SPEED
    211.             fl_Velocity[0] = (originN[0] - vicOrigin[0]) / fl_Time;
    212.             fl_Velocity[1] = (originN[1] - vicOrigin[1]) / fl_Time;
    213.             fl_Velocity[2] = (originN[2] - vicOrigin[2]) / fl_Time;
    214.         }else{
    215.             fl_Velocity[0] = 0.0
    216.             fl_Velocity[1] = 0.0
    217.             fl_Velocity[2] = 0.0
    218.         }
    219.         fm_set_user_velocity(victim, fl_Velocity)
    220.         message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("ScreenShake"), _, victim)
    221.         write_short(1<<14) // amplitude
    222.         write_short(1<<14) // duration
    223.         write_short(1<<14) // frequency
    224.         message_end()
    225.     }
    226. }
    227. public EFFECKT(const Float:originF[3], duration)  {
    228.     engfunc(EngFunc_MessageBegin, MSG_PAS, SVC_TEMPENTITY, originF, 0);
    229.     write_byte(TE_DLIGHT);
    230.     engfunc(EngFunc_WriteCoord, originF[0]);
    231.     engfunc(EngFunc_WriteCoord, originF[1]);
    232.     engfunc(EngFunc_WriteCoord, originF[2]);
    233.     write_byte(5);
    234.     write_byte(255);
    235.     write_byte(20);
    236.     write_byte(147);
    237.     write_byte(51);
    238.     write_byte((duration < 2) ? 3 : 0);
    239.     message_end();
    240.     create_blast_effect(originF, 255, 20, 147, 200, 350.0);
    241.     create_blast_effect(originF, 255, 100, 147, 200, 450.0);
    242.     create_blast_effect(originF, 255, 220, 147, 200, 550.0);
    243. }
    244. public EFFECKT_EXPLODE(const Float:originF[3], ent) {
    245.     engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, originF, 0)
    246.     write_byte(TE_BEAMPOINTS)
    247.     engfunc(EngFunc_WriteCoord, originF[0])    
    248.     engfunc(EngFunc_WriteCoord, originF[1])    
    249.     engfunc(EngFunc_WriteCoord, originF[2])    
    250.     engfunc(EngFunc_WriteCoord, originF[0])    
    251.     engfunc(EngFunc_WriteCoord, originF[1])    
    252.     engfunc(EngFunc_WriteCoord, originF[2] + 900)
    253.     write_short(g_traser)
    254.     write_byte(TRASER_STARTFRAME)      
    255.     write_byte(TRASER_FRAMERATE)        
    256.     write_byte(TRASER_LIFE)    
    257.     write_byte(TRASER_WEIGTH)  
    258.     write_byte(TRASER_NOISE)        
    259.     write_byte(TRASER_COLOR_RED)        
    260.     write_byte(TRASER_COLOR_GREEN)      
    261.     write_byte(TRASER_COLOR_BLUE)      
    262.     write_byte(TRASER_BRIGHTNESS)      
    263.     write_byte(TRASER_SPEED)        
    264.     message_end()
    265.     engfunc(EngFunc_MessageBegin, MSG_PAS, SVC_TEMPENTITY, originF, 0);
    266.     write_byte( TE_SPRITETRAIL )
    267.     engfunc(EngFunc_WriteCoord, originF[ 0 ])
    268.     engfunc(EngFunc_WriteCoord, originF[ 1 ])
    269.     engfunc(EngFunc_WriteCoord, originF[ 2 ])
    270.     engfunc(EngFunc_WriteCoord, originF[ 0 ])
    271.     engfunc(EngFunc_WriteCoord, originF[ 1 ])
    272.     engfunc(EngFunc_WriteCoord, originF[ 2 ] + 200)
    273.     write_short(g_gibss)
    274.     write_byte(GIBS_COUNT)
    275.     write_byte(GIBS_LIFE)  
    276.     write_byte(GIBS_SCALE)  
    277.     write_byte(GIBS_VELOSITY)  
    278.     write_byte(GIBS_RENDOM_OF_VELOSITY)  
    279.     message_end()
    280.     engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, originF, 0)
    281.     write_byte(TE_PARTICLEBURST) // TE id
    282.     engfunc(EngFunc_WriteCoord, originF[0]) // x
    283.     engfunc(EngFunc_WriteCoord, originF[1]) // y
    284.     engfunc(EngFunc_WriteCoord, originF[2]) // z
    285.     write_short(600) // radius
    286.     write_byte(152) // color
    287.     write_byte(15) // duration (will be randomized a bit)
    288.     message_end()
    289.     emit_sound(ent, CHAN_WEAPON, sound[0], 1.0, ATTN_NORM, 0, PITCH_NORM)
    290.     static owner; owner = pev(ent, pev_owner)
    291.     new victim
    292.     while((victim=engfunc(EngFunc_FindEntityInSphere, victim, originF, NADE_RADIUS_EXPLODE))!=0) {  
    293.         if(pev(victim, pev_takedamage)!=DAMAGE_NO && pev(victim, pev_solid)!=SOLID_NOT) {
    294.             if(!is_user_alive(victim) || ze_is_user_zombie(victim))
    295.             continue
    296.             new victim_origin[3], distance, Float:distance_damage, floated_origin[3]
    297.             floated_origin[0] = floatround(originF[0]),floated_origin[1] = floatround(originF[1]),floated_origin[2] = floatround(originF[2])
    298.             get_user_origin(victim, victim_origin),distance = get_distance(victim_origin, floated_origin)
    299.             distance_damage = NADE_EXPLODE_DAMAGE - floatmul(NADE_EXPLODE_DAMAGE, floatdiv(float(distance), 500.0))
    300.             ExecuteHam(Ham_TakeDamage, victim, ent, owner, distance_damage, DMG_BULLET)
    301.         }
    302.     }
    303. }
    304.  
    305. stock create_blast_effect(const Float:originF[3], red, green, blue, brightness, Float:radius){
    306.     engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, originF, 0)
    307.     write_byte(TE_BEAMCYLINDER) // TE id: 21
    308.     engfunc(EngFunc_WriteCoord, originF[0]) // x
    309.     engfunc(EngFunc_WriteCoord, originF[1]) // y
    310.     engfunc(EngFunc_WriteCoord, originF[2]) // z
    311.     engfunc(EngFunc_WriteCoord, originF[0]) // x axis
    312.     engfunc(EngFunc_WriteCoord, originF[1]) // y axis
    313.     engfunc(EngFunc_WriteCoord, originF[2] + radius) // z axis
    314.     write_short(g_ring) // sprite
    315.     write_byte(0) // startframe
    316.     write_byte(0) // framerate
    317.     write_byte(7) // life
    318.     write_byte(50) // width
    319.     write_byte(0) // noise
    320.     write_byte(red) // red
    321.     write_byte(green) // green
    322.     write_byte(blue) // blue
    323.     write_byte(brightness) // brightness
    324.     write_byte(0) // speed
    325.     message_end()
    326. }
    327. public Weapon_Hook_Select(id){
    328.     engclient_cmd(id, NADE_ENTIY)
    329.     return PLUGIN_HANDLED
    330. }
    331. public HAM_Spawn(id)g_has_grenade[id] = false;
  • Images:
20180920183235_1.jpg
20180920183231_1.jpg

  • Download:
grom_grenade.rar
(682.73 KiB) Downloaded 631 times
grom_grenade.rar
(682.73 KiB) Downloaded 631 times

User avatar
Raheem
Mod Developer
Mod Developer
Posts: 2214
Joined: 7 years ago
Contact:

#2

Post by Raheem » 5 years ago

You are it's author or just converted?
He who fails to plan is planning to fail

czirimbolo
Veteran Member
Veteran Member
Poland
Posts: 598
Joined: 7 years ago
Contact:

#3

Post by czirimbolo » 5 years ago

Converted but some plugin blocks this item on my server
Image

User avatar
Mark
VIP
VIP
United States of America
Posts: 283
Joined: 5 years ago
Location: Des Moines/USA
Contact:

#4

Post by Mark » 5 years ago

Raheem wrote: 5 years ago You are it's author or just converted?
converted

czirimbolo
Veteran Member
Veteran Member
Poland
Posts: 598
Joined: 7 years ago
Contact:

#5

Post by czirimbolo » 5 years ago

Ok this item blocks this grom grenade:

Code: Select all

#include <zombie_escape>
#include <fakemeta_util>
#include <fun>
#include <engine>

#define PLUGIN "[ZE] Extra Item: Force Field Grenade"
#define VERSION "v2.3"
#define AUTHOR "lucas_7_94" // Thanks To Users in credits too!.

#define CAMPO_TIME_NAME "Force Shield"
#define ValidTouch(%1) ( is_user_alive(%1) && ( ze_is_user_zombie(%1) ) )

/*=============================[Plugin Customization]=============================*/
#define CAMPO_TASK

//#define RANDOM_COLOR
#define ONE_COLOR

new const NADE_TYPE_CAMPO = 6545

#if defined ONE_COLOR
new Float:CampoColors[ 3 ] = { 255.0 , 0.0 ,   0.0  }
#endif

new TrailColor[ 3 ] = { 000, 255, 255 }
new Float:Maxs[ 3 ] = { 100.0 , 100.0 , 100.0 }
new Float:Mins[ 3 ] = { -100.0, -100.0, -100.0 }

new const model_grenade[] = "models/zombie_escape/v_auragren.mdl"
new const model[] = "models/zombie_escape/aura8.mdl"
new const w_model[] = "models/zombie_escape/w_aura.mdl"
new const sprite_grenade_trail[] = "sprites/laserbeam.spr"
new const entclas[] = "campo_grenade_forze"

new g_trailSpr, g_SayText, g_itemID, Cvar_Shield_Time

new gBomb
const Float:Push = 15.0

const item_cost = 15
const iLimit = 0
/*=============================[End Customization]=============================*/

public plugin_natives()
{
	register_native("ze_have_shield_nade", "native_ze_have_shield_nade", 1)
}

public plugin_init()
{
	register_plugin(PLUGIN, VERSION, AUTHOR)
	
	RegisterHam(Ham_Think, "grenade", "fw_ThinkGrenade")
	
	RegisterHam(Ham_Killed, "player", "fw_PlayerKilled")
	
	register_forward(FM_SetModel, "fw_SetModel")
	
	RegisterHam(Ham_Item_Deploy, "weapon_smokegrenade", "shield_deploy", 1)
	
	register_event("HLTV", "event_round_start", "a", "1=0", "2=0")
	
	register_forward(FM_Touch, "fw_touch")
	
	g_SayText = get_user_msgid("SayText")
	
	register_cvar("ze_shield_creator", "lucas_7_94", FCVAR_SERVER|FCVAR_PROTECTED)

	g_itemID = ze_register_item(CAMPO_TIME_NAME, item_cost, iLimit)
	
	Cvar_Shield_Time = register_cvar("ze_shield_time", "7")
}

public event_round_start()
{
	gBomb = 0
}

public plugin_precache() {
	
	g_trailSpr = engfunc(EngFunc_PrecacheModel, sprite_grenade_trail)
	engfunc(EngFunc_PrecacheModel, model_grenade)
	engfunc(EngFunc_PrecacheModel, model)
	engfunc(EngFunc_PrecacheModel, w_model)
}

public client_disconnected(id){
	gBomb &= ~( 1 << ( id % 32 ) )
}
	
public ze_select_item_pre(id, itemid)
{
    // Return Available and we will block it in Post, So it dosen't affect other plugins
    if (itemid != g_itemID)
        return ZE_ITEM_AVAILABLE
   
    // Available for Humans only, So don't show it for zombies
    if (ze_is_user_zombie(id))
        return ZE_ITEM_DONT_SHOW
   
    return ZE_ITEM_AVAILABLE
}

public ze_select_item_post(player, itemid)
{
    if (itemid != g_itemID)
        return
	
    if( gBomb & ( 1 << ( player % 32 ) ) )
        Color(player, "!g[Shield]!y You already have a force field")
	else 
	{
		gBomb |= ( 1 << ( player % 32 ) )
			
		if( !user_has_weapon( player, CSW_SMOKEGRENADE ) )
			give_item(player,"weapon_smokegrenade")
			
		Color(player, "!y[!gShield!y] !tKupiles granat - pole silowe!y. !Trwa!y, !tono !g%i !tsekund!y!", get_pcvar_num(Cvar_Shield_Time))
	}
}

public fw_PlayerKilled(victim, attacker, shouldgib)
{
	if( ( 1 <= attacker <= 32 ) && ( gBomb & ( 1 << ( victim % 32 ) ) ) ) 
		gBomb &= ~( 1 << ( victim % 32 ) )
}

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_CAMPO)
		creat_ent(entity)
	
	return HAM_SUPERCEDE
}


public fw_SetModel(entity, const model[]) {	
	
	static Float:dmgtime
	pev(entity, pev_dmgtime, dmgtime)
	
	if (dmgtime == 0.0)
		return FMRES_IGNORED;
	
	if (equal(model[7], "w_sm", 4))
	{		
		new owner = pev(entity, pev_owner)		
		
		if( is_user_alive(owner) && !ze_is_user_zombie(owner) && ( gBomb & ( 1 << ( owner % 32 ) ) ) ) 
		{
			fm_set_rendering(entity, kRenderFxGlowShell, 000, 255, 255, kRenderNormal, 16)
			
			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(TrailColor[ 0 ]) // r
			write_byte(TrailColor[ 1 ]) // g
			write_byte(TrailColor[ 2 ]) // b
			write_byte(500) // brightness
			message_end()
			
			set_pev(entity, pev_flTimeStepSound, NADE_TYPE_CAMPO)
			
			set_task(6.0, "DeleteEntityGrenade" ,entity)
			set_task(0.1, "RestVar" , owner)

			entity_set_model(entity, w_model)
			return FMRES_SUPERCEDE
		}
	}
	return FMRES_IGNORED
	
}

public RestVar(owner)
{
	gBomb &= ~( 1 << ( owner % 32 ) )
}

public DeleteEntityGrenade(entity) 
	if( is_valid_ent( entity ) )
		remove_entity(entity)

public creat_ent(id) {
	
	// Create entitity
	new iEntity = create_entity("info_target")
	
	if(!is_valid_ent(iEntity))
		return PLUGIN_HANDLED
	
	new Float: Origin[3] 
	entity_get_vector(id, EV_VEC_origin, Origin) 
	
	entity_set_string(iEntity, EV_SZ_classname, entclas)
	
	entity_set_vector(iEntity,EV_VEC_origin, Origin)
	entity_set_model(iEntity,model)
	entity_set_int(iEntity, EV_INT_solid, SOLID_TRIGGER)
	entity_set_size(iEntity, Mins, Maxs )
	entity_set_int(iEntity, EV_INT_renderfx, kRenderFxGlowShell)
	entity_set_int(iEntity, EV_INT_rendermode, kRenderTransAlpha)
	entity_set_float(iEntity, EV_FL_renderamt, 50.0)
	
	#if defined RANDOM_COLOR
	if(is_valid_ent(iEntity))
	{
		new Float:vColor[3]
		
		for(new i; i < 3; i++)
			vColor[i] = random_float(0.0, 255.0)
		
		entity_set_vector(iEntity, EV_VEC_rendercolor, vColor)
	}
	#endif
	
	#if defined ONE_COLOR
	entity_set_vector(iEntity, EV_VEC_rendercolor, CampoColors)
	#endif
	
	#if defined CAMPO_TASK
	set_task(get_pcvar_float(Cvar_Shield_Time), "DeleteEntity", iEntity)
	#endif
	
	
	return PLUGIN_CONTINUE;
}

public ze_user_infected(infected, infector) 
	if ( gBomb & ( 1 << ( infected % 32 ) ) ) 
		gBomb &= ~( 1 << ( infected % 32 ) ) 

public fw_touch(ent, touched)
{
	if ( !pev_valid(ent) ) return FMRES_IGNORED;
	static entclass[32];
	pev(ent, pev_model, entclass, 31);
	
	if ( strcmp( entclass, model ) == 0 )
	{	
		if( ValidTouch(touched) )
		{
			static Float:pos_ptr[3], Float:pos_ptd[3]
			
			pev(ent, 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
			}
			set_pev(touched, pev_velocity, pos_ptd)
			set_pev(touched, pev_impulse, pos_ptd)
		}
	}
	return FMRES_HANDLED
}


public DeleteEntity( entity )
{
	if(is_valid_ent(entity)) 
	remove_entity( entity )
}

stock Color(const id, const input[], any:...)
{
	static msg[191]
	vformat(msg, 190, input, 3)
	
	replace_all(msg, 190, "!g", "^4")
	replace_all(msg, 190, "!y", "^1")
	replace_all(msg, 190, "!t", "^3")
	
	message_begin(MSG_ONE_UNRELIABLE, g_SayText, _, id)
	write_byte(id)
	write_string(msg)
	message_end()
}

public shield_deploy( shield_ent )
{
	if( pev_valid( shield_ent ) != 2 )
		return HAM_IGNORED;
	
	static const mPlayer = 41
	
	new id = get_pdata_cbase( shield_ent, mPlayer, 4 );
	
	if( ( gBomb & ( 1 << ( id % 32 ) ) ) && !ze_is_user_zombie( id ) )
		set_pev( id, pev_viewmodel2, model_grenade );
	
	return HAM_IGNORED;
}

public native_ze_have_shield_nade(id)
{
	if (gBomb & (1 << (id % 32)))
	{
		return true;
	}
	return false;
}
Moreover, when I turn off this force grenade, I have normal flashbangs on server, not frost nades. Can you fix this?
Image

User avatar
Mark
VIP
VIP
United States of America
Posts: 283
Joined: 5 years ago
Location: Des Moines/USA
Contact:

#6

Post by Mark » 5 years ago

czirimbolo wrote: 5 years ago Ok this item blocks this grom grenade:

Code: Select all

#include <zombie_escape>
#include <fakemeta_util>
#include <fun>
#include <engine>

#define PLUGIN "[ZE] Extra Item: Force Field Grenade"
#define VERSION "v2.3"
#define AUTHOR "lucas_7_94" // Thanks To Users in credits too!.

#define CAMPO_TIME_NAME "Force Shield"
#define ValidTouch(%1) ( is_user_alive(%1) && ( ze_is_user_zombie(%1) ) )

/*=============================[Plugin Customization]=============================*/
#define CAMPO_TASK

//#define RANDOM_COLOR
#define ONE_COLOR

new const NADE_TYPE_CAMPO = 6545

#if defined ONE_COLOR
new Float:CampoColors[ 3 ] = { 255.0 , 0.0 ,   0.0  }
#endif

new TrailColor[ 3 ] = { 000, 255, 255 }
new Float:Maxs[ 3 ] = { 100.0 , 100.0 , 100.0 }
new Float:Mins[ 3 ] = { -100.0, -100.0, -100.0 }

new const model_grenade[] = "models/zombie_escape/v_auragren.mdl"
new const model[] = "models/zombie_escape/aura8.mdl"
new const w_model[] = "models/zombie_escape/w_aura.mdl"
new const sprite_grenade_trail[] = "sprites/laserbeam.spr"
new const entclas[] = "campo_grenade_forze"

new g_trailSpr, g_SayText, g_itemID, Cvar_Shield_Time

new gBomb
const Float:Push = 15.0

const item_cost = 15
const iLimit = 0
/*=============================[End Customization]=============================*/

public plugin_natives()
{
	register_native("ze_have_shield_nade", "native_ze_have_shield_nade", 1)
}

public plugin_init()
{
	register_plugin(PLUGIN, VERSION, AUTHOR)
	
	RegisterHam(Ham_Think, "grenade", "fw_ThinkGrenade")
	
	RegisterHam(Ham_Killed, "player", "fw_PlayerKilled")
	
	register_forward(FM_SetModel, "fw_SetModel")
	
	RegisterHam(Ham_Item_Deploy, "weapon_smokegrenade", "shield_deploy", 1)
	
	register_event("HLTV", "event_round_start", "a", "1=0", "2=0")
	
	register_forward(FM_Touch, "fw_touch")
	
	g_SayText = get_user_msgid("SayText")
	
	register_cvar("ze_shield_creator", "lucas_7_94", FCVAR_SERVER|FCVAR_PROTECTED)

	g_itemID = ze_register_item(CAMPO_TIME_NAME, item_cost, iLimit)
	
	Cvar_Shield_Time = register_cvar("ze_shield_time", "7")
}

public event_round_start()
{
	gBomb = 0
}

public plugin_precache() {
	
	g_trailSpr = engfunc(EngFunc_PrecacheModel, sprite_grenade_trail)
	engfunc(EngFunc_PrecacheModel, model_grenade)
	engfunc(EngFunc_PrecacheModel, model)
	engfunc(EngFunc_PrecacheModel, w_model)
}

public client_disconnected(id){
	gBomb &= ~( 1 << ( id % 32 ) )
}
	
public ze_select_item_pre(id, itemid)
{
    // Return Available and we will block it in Post, So it dosen't affect other plugins
    if (itemid != g_itemID)
        return ZE_ITEM_AVAILABLE
   
    // Available for Humans only, So don't show it for zombies
    if (ze_is_user_zombie(id))
        return ZE_ITEM_DONT_SHOW
   
    return ZE_ITEM_AVAILABLE
}

public ze_select_item_post(player, itemid)
{
    if (itemid != g_itemID)
        return
	
    if( gBomb & ( 1 << ( player % 32 ) ) )
        Color(player, "!g[Shield]!y You already have a force field")
	else 
	{
		gBomb |= ( 1 << ( player % 32 ) )
			
		if( !user_has_weapon( player, CSW_SMOKEGRENADE ) )
			give_item(player,"weapon_smokegrenade")
			
		Color(player, "!y[!gShield!y] !tKupiles granat - pole silowe!y. !Trwa!y, !tono !g%i !tsekund!y!", get_pcvar_num(Cvar_Shield_Time))
	}
}

public fw_PlayerKilled(victim, attacker, shouldgib)
{
	if( ( 1 <= attacker <= 32 ) && ( gBomb & ( 1 << ( victim % 32 ) ) ) ) 
		gBomb &= ~( 1 << ( victim % 32 ) )
}

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_CAMPO)
		creat_ent(entity)
	
	return HAM_SUPERCEDE
}


public fw_SetModel(entity, const model[]) {	
	
	static Float:dmgtime
	pev(entity, pev_dmgtime, dmgtime)
	
	if (dmgtime == 0.0)
		return FMRES_IGNORED;
	
	if (equal(model[7], "w_sm", 4))
	{		
		new owner = pev(entity, pev_owner)		
		
		if( is_user_alive(owner) && !ze_is_user_zombie(owner) && ( gBomb & ( 1 << ( owner % 32 ) ) ) ) 
		{
			fm_set_rendering(entity, kRenderFxGlowShell, 000, 255, 255, kRenderNormal, 16)
			
			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(TrailColor[ 0 ]) // r
			write_byte(TrailColor[ 1 ]) // g
			write_byte(TrailColor[ 2 ]) // b
			write_byte(500) // brightness
			message_end()
			
			set_pev(entity, pev_flTimeStepSound, NADE_TYPE_CAMPO)
			
			set_task(6.0, "DeleteEntityGrenade" ,entity)
			set_task(0.1, "RestVar" , owner)

			entity_set_model(entity, w_model)
			return FMRES_SUPERCEDE
		}
	}
	return FMRES_IGNORED
	
}

public RestVar(owner)
{
	gBomb &= ~( 1 << ( owner % 32 ) )
}

public DeleteEntityGrenade(entity) 
	if( is_valid_ent( entity ) )
		remove_entity(entity)

public creat_ent(id) {
	
	// Create entitity
	new iEntity = create_entity("info_target")
	
	if(!is_valid_ent(iEntity))
		return PLUGIN_HANDLED
	
	new Float: Origin[3] 
	entity_get_vector(id, EV_VEC_origin, Origin) 
	
	entity_set_string(iEntity, EV_SZ_classname, entclas)
	
	entity_set_vector(iEntity,EV_VEC_origin, Origin)
	entity_set_model(iEntity,model)
	entity_set_int(iEntity, EV_INT_solid, SOLID_TRIGGER)
	entity_set_size(iEntity, Mins, Maxs )
	entity_set_int(iEntity, EV_INT_renderfx, kRenderFxGlowShell)
	entity_set_int(iEntity, EV_INT_rendermode, kRenderTransAlpha)
	entity_set_float(iEntity, EV_FL_renderamt, 50.0)
	
	#if defined RANDOM_COLOR
	if(is_valid_ent(iEntity))
	{
		new Float:vColor[3]
		
		for(new i; i < 3; i++)
			vColor[i] = random_float(0.0, 255.0)
		
		entity_set_vector(iEntity, EV_VEC_rendercolor, vColor)
	}
	#endif
	
	#if defined ONE_COLOR
	entity_set_vector(iEntity, EV_VEC_rendercolor, CampoColors)
	#endif
	
	#if defined CAMPO_TASK
	set_task(get_pcvar_float(Cvar_Shield_Time), "DeleteEntity", iEntity)
	#endif
	
	
	return PLUGIN_CONTINUE;
}

public ze_user_infected(infected, infector) 
	if ( gBomb & ( 1 << ( infected % 32 ) ) ) 
		gBomb &= ~( 1 << ( infected % 32 ) ) 

public fw_touch(ent, touched)
{
	if ( !pev_valid(ent) ) return FMRES_IGNORED;
	static entclass[32];
	pev(ent, pev_model, entclass, 31);
	
	if ( strcmp( entclass, model ) == 0 )
	{	
		if( ValidTouch(touched) )
		{
			static Float:pos_ptr[3], Float:pos_ptd[3]
			
			pev(ent, 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
			}
			set_pev(touched, pev_velocity, pos_ptd)
			set_pev(touched, pev_impulse, pos_ptd)
		}
	}
	return FMRES_HANDLED
}


public DeleteEntity( entity )
{
	if(is_valid_ent(entity)) 
	remove_entity( entity )
}

stock Color(const id, const input[], any:...)
{
	static msg[191]
	vformat(msg, 190, input, 3)
	
	replace_all(msg, 190, "!g", "^4")
	replace_all(msg, 190, "!y", "^1")
	replace_all(msg, 190, "!t", "^3")
	
	message_begin(MSG_ONE_UNRELIABLE, g_SayText, _, id)
	write_byte(id)
	write_string(msg)
	message_end()
}

public shield_deploy( shield_ent )
{
	if( pev_valid( shield_ent ) != 2 )
		return HAM_IGNORED;
	
	static const mPlayer = 41
	
	new id = get_pdata_cbase( shield_ent, mPlayer, 4 );
	
	if( ( gBomb & ( 1 << ( id % 32 ) ) ) && !ze_is_user_zombie( id ) )
		set_pev( id, pev_viewmodel2, model_grenade );
	
	return HAM_IGNORED;
}

public native_ze_have_shield_nade(id)
{
	if (gBomb & (1 << (id % 32)))
	{
		return true;
	}
	return false;
}
Moreover, when I turn off this force grenade, I have normal flashbangs on server, not frost nades. Can you fix this?
Trying fully shutting down your server and restarting it

czirimbolo
Veteran Member
Veteran Member
Poland
Posts: 598
Joined: 7 years ago
Contact:

#7

Post by czirimbolo » 5 years ago

Still doesnt work, I turned on force grenade to fix my frost nades. Also grom nade and force nade won't be working together. Any fix?
Image

User avatar
Raheem
Mod Developer
Mod Developer
Posts: 2214
Joined: 7 years ago
Contact:

#8

Post by Raheem » 5 years ago

Make the base for this grom nade HE Grenade (change those):
  • Code: Select all

    #define NADE_ENTIY          "weapon_hegrenade"
    #define NADE_CSW            CSW_HEGRENADE
He who fails to plan is planning to fail

czirimbolo
Veteran Member
Veteran Member
Poland
Posts: 598
Joined: 7 years ago
Contact:

#9

Post by czirimbolo » 5 years ago

Raheem wrote: 5 years ago Make the base for this grom nade HE Grenade (change those):
  • Code: Select all

    #define NADE_ENTIY          "weapon_hegrenade"
    #define NADE_CSW            CSW_HEGRENADE
still nothing, grom is for zombies and force is for humans
Image

User avatar
Raheem
Mod Developer
Mod Developer
Posts: 2214
Joined: 7 years ago
Contact:

#10

Post by Raheem » 5 years ago

I don't understand it well sorry 😂😃😅
He who fails to plan is planning to fail

User avatar
Mark
VIP
VIP
United States of America
Posts: 283
Joined: 5 years ago
Location: Des Moines/USA
Contact:

#11

Post by Mark » 5 years ago

czirimbolo wrote: 5 years ago
Raheem wrote: 5 years ago Make the base for this grom nade HE Grenade (change those):
  • Code: Select all

    #define NADE_ENTIY          "weapon_hegrenade"
    #define NADE_CSW            CSW_HEGRENADE
still nothing, grom is for zombies and force is for humans
Best thing i can tell you todo with this is put the Grom nade in your plugins-zombie_escape.ini above force_sheild grenade like this.
  1. ze_extra_zombie_gromgrenade.amxx debug
  2. force_shield_grenade.amxx

User avatar
Mark
VIP
VIP
United States of America
Posts: 283
Joined: 5 years ago
Location: Des Moines/USA
Contact:

#12

Post by Mark » 5 years ago

czirimbolo wrote: 5 years ago
Raheem wrote: 5 years ago Make the base for this grom nade HE Grenade (change those):
  • Code: Select all

    #define NADE_ENTIY          "weapon_hegrenade"
    #define NADE_CSW            CSW_HEGRENADE
still nothing, grom is for zombies and force is for humans
If you want to use the Grom Nade use this fire and frost and get rid of the shield one.
  1. #include <zombie_escape>
  2.  
  3. // Setting File
  4. new const ZE_SETTING_RESOURCES[] = "zombie_escape.ini"
  5.  
  6. // Defines
  7. #define MODEL_MAX_LENGTH 64
  8. #define SOUND_MAX_LENGTH 64
  9. #define SPRITE_MAX_LENGTH 64
  10. #define TASK_FROST_REMOVE 200
  11. #define ID_FROST_REMOVE (taskid - TASK_FROST_REMOVE)
  12. #define TASK_FREEZE 2018
  13.  
  14. // Default Sounds
  15. new const szFrostGrenadeExplodeSound[][] =
  16. {
  17.     "warcraft3/frostnova.wav"
  18. }
  19.  
  20. new const szFrostGrenadePlayerSound[][] =
  21. {
  22.     "warcraft3/impalehit.wav"
  23. }
  24.  
  25. new const szFrostGrenadeBreakSound[][] =
  26. {
  27.     "warcraft3/impalelaunch1.wav"
  28. }
  29.  
  30. // Default Models
  31. new g_v_szFrostGrenadeModel[MODEL_MAX_LENGTH] = "models/zombie_escape/v_grenade_frost.mdl"
  32. new g_p_szFrostGrenadeModel[MODEL_MAX_LENGTH] = "models/zombie_escape/p_grenade_frost.mdl"
  33. new g_w_szFrostGrenadeModel[MODEL_MAX_LENGTH] = "models/zombie_escape/w_grenade_frost.mdl"
  34.  
  35. // Default Sprites
  36. new g_szGrenadeTrailSprite[SPRITE_MAX_LENGTH] = "sprites/laserbeam.spr"
  37. new g_szGrenadeRingSprite[SPRITE_MAX_LENGTH] = "sprites/shockwave.spr"
  38. new g_szGrenadeGlassSprite[SPRITE_MAX_LENGTH] = "models/glassgibs.mdl"
  39.  
  40. // Dynamic Arrays
  41. new Array:g_szFrostGrenadeExplodeSound
  42. new Array:g_szFrostGrenadePlayerSound
  43. new Array:g_szFrostGrenadeBreakSound
  44.  
  45. // Forwards
  46. enum _:TOTAL_FORWARDS
  47. {
  48.     FW_USER_FREEZE_PRE = 0,
  49.     FW_USER_UNFROZEN
  50. }
  51.  
  52. new g_iForwards[TOTAL_FORWARDS]
  53. new g_iForwardReturn
  54.  
  55. // Variables
  56. new bool:g_bIsFrozen[33],
  57.     bool:g_bZombieReleased,
  58.     g_iFrozenRenderingFx[33],
  59.     Float:g_fFrozenRenderingColor[33][3],
  60.     g_iFrozenRenderingRender[33],
  61.     Float:g_fFrozenRenderingAmount[33],
  62.     g_iMaxClients
  63.  
  64. // Sprites
  65. new g_iTrailSpr,
  66.     g_iExplodeSpr,
  67.     g_iGlassSpr
  68.  
  69. // Cvar
  70. new g_pCvarFrostDuration,
  71.     g_pCvarFrostHudIcon,
  72.     g_pCvarFrozenDamage,
  73.     g_pCvarFrostRadius,
  74.     g_pCvarHitType
  75.  
  76. public plugin_init()
  77. {
  78.     register_plugin("[ZE] Frost Nade", ZE_VERSION, AUTHORS)
  79.    
  80.     // Hook Chains
  81.     RegisterHookChain(RG_CBasePlayer_TraceAttack, "Fw_TraceAttack_Pre", 0)
  82.     RegisterHookChain(RG_CBasePlayer_Killed, "Fw_PlayerKilled_Post", 1)
  83.     RegisterHookChain(RG_CBasePlayer_PreThink, "Fw_PreThink_Post", 1)
  84.    
  85.     // Events
  86.     register_event("HLTV", "New_Round", "a", "1=0", "2=0")
  87.    
  88.     // Hams
  89.     RegisterHam(Ham_Think, "grenade", "Fw_ThinkGrenade_Post", 1)   
  90.    
  91.     // Fakemeta
  92.     register_forward(FM_SetModel, "Fw_SetModel_Post", 1)
  93.    
  94.     // Forwards
  95.     g_iForwards[FW_USER_FREEZE_PRE] = CreateMultiForward("ze_frost_pre", ET_CONTINUE, FP_CELL)
  96.     g_iForwards[FW_USER_UNFROZEN] = CreateMultiForward("ze_frost_unfreeze", ET_IGNORE, FP_CELL)
  97.    
  98.     // Cvars
  99.     g_pCvarFrostDuration = register_cvar("ze_frost_duration", "3")
  100.     g_pCvarFrostHudIcon = register_cvar("ze_frost_hud_icon", "1")
  101.     g_pCvarFrozenDamage = register_cvar("ze_freeze_damage", "0")
  102.     g_pCvarFrostRadius = register_cvar("ze_freeze_radius", "240.0")
  103.     g_pCvarHitType = register_cvar("ze_freeze_hit_type", "0")
  104.    
  105.     // Static Values
  106.     g_iMaxClients = get_member_game(m_nMaxPlayers)
  107. }
  108.  
  109. public plugin_natives()
  110. {
  111.     register_native("ze_zombie_in_forst", "native_ze_zombie_in_forst", 1)
  112.     register_native("ze_set_frost_grenade", "native_ze_set_frost_grenade", 1)
  113. }
  114.  
  115. public native_ze_zombie_in_forst(id)
  116. {
  117.     if (!is_user_alive(id))
  118.     {
  119.         return -1
  120.     }
  121.    
  122.     return g_bIsFrozen[id]
  123. }
  124.  
  125. public native_ze_set_frost_grenade(id, set)
  126. {
  127.     if (!is_user_alive(id))
  128.     {
  129.         log_error(AMX_ERR_NATIVE, "[ZE] Invalid Player (%d)", id)
  130.         return -1;
  131.     }
  132.    
  133.     // Unfreeze
  134.     if (!set)
  135.     {
  136.         // Not frozen
  137.         if (!g_bIsFrozen[id])
  138.             return true
  139.        
  140.         // Remove freeze right away and stop the task
  141.         RemoveFreeze(id+TASK_FROST_REMOVE)
  142.         remove_task(id+TASK_FROST_REMOVE)
  143.         return true
  144.     }
  145.    
  146.     return set_freeze(id)
  147. }
  148.  
  149. public plugin_precache()
  150. {
  151.     // Initialize arrays
  152.     g_szFrostGrenadeExplodeSound = ArrayCreate(SOUND_MAX_LENGTH, 1)
  153.     g_szFrostGrenadePlayerSound = ArrayCreate(SOUND_MAX_LENGTH, 1)
  154.     g_szFrostGrenadeBreakSound = ArrayCreate(SOUND_MAX_LENGTH, 1)
  155.    
  156.     // Load from external file
  157.     amx_load_setting_string_arr(ZE_SETTING_RESOURCES, "Sounds", "FROST GRENADE EXPLODE", g_szFrostGrenadeExplodeSound)
  158.     amx_load_setting_string_arr(ZE_SETTING_RESOURCES, "Sounds", "FROST GRENADE PLAYER", g_szFrostGrenadePlayerSound)
  159.     amx_load_setting_string_arr(ZE_SETTING_RESOURCES, "Sounds", "FROST GRENADE BREAK", g_szFrostGrenadeBreakSound)
  160.    
  161.     // If we couldn't load custom sounds from file, use and save default ones
  162.    
  163.     new iIndex
  164.    
  165.     if (ArraySize(g_szFrostGrenadeExplodeSound) == 0)
  166.     {
  167.         for (iIndex = 0; iIndex < sizeof szFrostGrenadeExplodeSound; iIndex++)
  168.             ArrayPushString(g_szFrostGrenadeExplodeSound, szFrostGrenadeExplodeSound[iIndex])
  169.        
  170.         // Save to external file
  171.         amx_save_setting_string_arr(ZE_SETTING_RESOURCES, "Sounds", "FROST GRENADE EXPLODE", g_szFrostGrenadeExplodeSound)
  172.     }
  173.    
  174.     if (ArraySize(g_szFrostGrenadePlayerSound) == 0)
  175.     {
  176.         for (iIndex = 0; iIndex < sizeof szFrostGrenadePlayerSound; iIndex++)
  177.             ArrayPushString(g_szFrostGrenadePlayerSound, szFrostGrenadePlayerSound[iIndex])
  178.        
  179.         // Save to external file
  180.         amx_save_setting_string_arr(ZE_SETTING_RESOURCES, "Sounds", "FROST GRENADE PLAYER", g_szFrostGrenadePlayerSound)
  181.     }
  182.    
  183.     if (ArraySize(g_szFrostGrenadeBreakSound) == 0)
  184.     {
  185.         for (iIndex = 0; iIndex < sizeof szFrostGrenadeBreakSound; iIndex++)
  186.             ArrayPushString(g_szFrostGrenadeBreakSound, szFrostGrenadeBreakSound[iIndex])
  187.        
  188.         // Save to external file
  189.         amx_save_setting_string_arr(ZE_SETTING_RESOURCES, "Sounds", "FROST GRENADE BREAK", g_szFrostGrenadeBreakSound)
  190.     }
  191.    
  192.     // Load from external file, save if not found
  193.     if (!amx_load_setting_string(ZE_SETTING_RESOURCES, "Weapon Models", "V_GRENADE FROST", g_v_szFrostGrenadeModel, charsmax(g_v_szFrostGrenadeModel)))
  194.         amx_save_setting_string(ZE_SETTING_RESOURCES, "Weapon Models", "V_GRENADE FROST", g_v_szFrostGrenadeModel)
  195.     if (!amx_load_setting_string(ZE_SETTING_RESOURCES, "Weapon Models", "P_GRENADE FROST", g_p_szFrostGrenadeModel, charsmax(g_p_szFrostGrenadeModel)))
  196.         amx_save_setting_string(ZE_SETTING_RESOURCES, "Weapon Models", "P_GRENADE FROST", g_p_szFrostGrenadeModel)
  197.     if (!amx_load_setting_string(ZE_SETTING_RESOURCES, "Weapon Models", "W_GRENADE FROST", g_w_szFrostGrenadeModel, charsmax(g_w_szFrostGrenadeModel)))
  198.         amx_save_setting_string(ZE_SETTING_RESOURCES, "Weapon Models", "W_GRENADE FROST", g_w_szFrostGrenadeModel)
  199.     if (!amx_load_setting_string(ZE_SETTING_RESOURCES, "Grenade Sprites", "TRAIL", g_szGrenadeTrailSprite, charsmax(g_szGrenadeTrailSprite)))
  200.         amx_save_setting_string(ZE_SETTING_RESOURCES, "Grenade Sprites", "TRAIL", g_szGrenadeTrailSprite)
  201.     if (!amx_load_setting_string(ZE_SETTING_RESOURCES, "Grenade Sprites", "RING", g_szGrenadeRingSprite, charsmax(g_szGrenadeRingSprite)))
  202.         amx_save_setting_string(ZE_SETTING_RESOURCES, "Grenade Sprites", "RING", g_szGrenadeRingSprite)
  203.     if (!amx_load_setting_string(ZE_SETTING_RESOURCES, "Grenade Sprites", "GLASS", g_szGrenadeGlassSprite, charsmax(g_szGrenadeGlassSprite)))
  204.         amx_save_setting_string(ZE_SETTING_RESOURCES, "Grenade Sprites", "GLASS", g_szGrenadeGlassSprite)
  205.    
  206.     // Precache sounds
  207.    
  208.     new szSound[SOUND_MAX_LENGTH]
  209.    
  210.     for (iIndex = 0; iIndex < ArraySize(g_szFrostGrenadeExplodeSound); iIndex++)
  211.     {
  212.         ArrayGetString(g_szFrostGrenadeExplodeSound, iIndex, szSound, charsmax(szSound))
  213.         precache_sound(szSound)
  214.     }
  215.     for (iIndex = 0; iIndex < ArraySize(g_szFrostGrenadePlayerSound); iIndex++)
  216.     {
  217.         ArrayGetString(g_szFrostGrenadePlayerSound, iIndex, szSound, charsmax(szSound))
  218.         precache_sound(szSound)
  219.     }
  220.     for (iIndex = 0; iIndex < ArraySize(g_szFrostGrenadeBreakSound); iIndex++)
  221.     {
  222.         ArrayGetString(g_szFrostGrenadeBreakSound, iIndex, szSound, charsmax(szSound))
  223.         precache_sound(szSound)
  224.     }
  225.    
  226.     // Precache models
  227.     precache_model(g_v_szFrostGrenadeModel)
  228.     precache_model(g_p_szFrostGrenadeModel)
  229.     precache_model(g_w_szFrostGrenadeModel)
  230.    
  231.     // Precache sprites
  232.     g_iTrailSpr = precache_model(g_szGrenadeTrailSprite)
  233.     g_iExplodeSpr = precache_model(g_szGrenadeRingSprite)
  234.     g_iGlassSpr = precache_model(g_szGrenadeGlassSprite)
  235. }
  236.  
  237. public ze_user_humanized(id)
  238. {
  239.     // Set custom grenade model
  240.     cs_set_player_view_model(id, CSW_FLASHBANG, g_v_szFrostGrenadeModel)
  241.     cs_set_player_weap_model(id, CSW_FLASHBANG, g_p_szFrostGrenadeModel)
  242.     cs_set_player_view_model(id, CSW_SMOKEGRENADE, g_v_szFrostGrenadeModel)
  243.     cs_set_player_weap_model(id, CSW_SMOKEGRENADE, g_p_szFrostGrenadeModel)
  244.    
  245.     // If frozen, remove freeze after player is cured
  246.     if (g_bIsFrozen[id])
  247.     {
  248.         // Update rendering values first
  249.         ApplyFrozenRendering(id)
  250.        
  251.         // Remove freeze right away and stop the task
  252.         RemoveFreeze(id+TASK_FROST_REMOVE)
  253.         remove_task(id+TASK_FROST_REMOVE)
  254.     }
  255. }
  256.  
  257. public Fw_PreThink_Post(id)
  258. {
  259.     if (!ze_is_user_zombie(id))
  260.         return
  261.  
  262.     if (g_bIsFrozen[id] && g_bZombieReleased)
  263.     {
  264.         // Stop and Freeze Zombie
  265.         set_entvar(id, var_velocity, Float:{0.0,0.0,0.0})
  266.         set_entvar(id, var_maxspeed, 1.0)
  267.         ApplyFrozenRendering(id)
  268.     }
  269. }
  270.  
  271. public client_disconnected(id)
  272. {
  273.     g_bIsFrozen[id] = false
  274.     remove_task(id+TASK_FROST_REMOVE)
  275. }
  276.  
  277. public New_Round()
  278. {
  279.     remove_task(TASK_FREEZE)
  280.     g_bZombieReleased = false
  281.    
  282.     // Set w_ models for grenades on ground
  283.     new szModel[32], iEntity = -1;
  284.  
  285.     while((iEntity = rg_find_ent_by_class( iEntity, "armoury_entity")))
  286.     {
  287.         get_entvar(iEntity, var_model, szModel, charsmax(szModel))
  288.        
  289.         if (equali(szModel, "models/w_flashbang.mdl") || equali(szModel, "models/w_smokegrenade.mdl"))
  290.         {
  291.             engfunc(EngFunc_SetModel, iEntity, g_w_szFrostGrenadeModel)
  292.         }
  293.     }
  294. }
  295.  
  296. public Fw_TraceAttack_Pre(iVictim, iAttacker)
  297. {
  298.     // Block damage while frozen
  299.     if ((get_pcvar_num(g_pCvarFrozenDamage) == 0) && g_bIsFrozen[iVictim])
  300.         return HC_SUPERCEDE
  301.    
  302.     return HC_CONTINUE
  303. }
  304.  
  305. public Fw_PlayerKilled_Post(iVictim)
  306. {
  307.     // Frozen player being killed
  308.     if (g_bIsFrozen[iVictim])
  309.     {
  310.         // Remove freeze right away and stop the task
  311.         RemoveFreeze(iVictim+TASK_FROST_REMOVE)
  312.         remove_task(iVictim+TASK_FROST_REMOVE)
  313.     }
  314. }
  315.  
  316. public ze_zombie_release()
  317. {
  318.     g_bZombieReleased = true
  319. }
  320.  
  321. public Fw_SetModel_Post(entity, const model[])
  322. {
  323.     // We don't care
  324.     if (strlen(model) < 8)
  325.         return FMRES_IGNORED
  326.    
  327.     // Get damage time of grenade
  328.     static Float:dmgtime
  329.     get_entvar(entity, var_dmgtime, dmgtime)
  330.    
  331.     // Grenade not yet thrown
  332.     if (dmgtime == 0.0)
  333.         return FMRES_IGNORED
  334.    
  335.     // Grenade's owner is zombie?
  336.     if (ze_is_user_zombie(get_entvar(entity, var_owner)))
  337.         return FMRES_IGNORED
  338.  
  339.     // Flashbang or Smoke
  340.     if ((model[9] == 'f' && model[10] == 'l') || (model[9] == 's' && model[10] == 'm'))
  341.     {
  342.         // Give it a glow
  343.         Set_Rendering(entity, kRenderFxGlowShell, 0, 100, 200, kRenderNormal, 16);
  344.        
  345.         // And a colored trail
  346.         message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
  347.         write_byte(TE_BEAMFOLLOW) // TE id
  348.         write_short(entity) // entity
  349.         write_short(g_iTrailSpr) // sprite
  350.         write_byte(10) // life
  351.         write_byte(10) // width
  352.         write_byte(0) // r
  353.         write_byte(100) // g
  354.         write_byte(200) // b
  355.         write_byte(200) // brightness
  356.         message_end()
  357.        
  358.         // Set grenade type on the thrown grenade entity
  359.         set_entvar(entity, var_flTimeStepSound, 3333.0)
  360.     }
  361.    
  362.     // Set w_ model
  363.     if (equali(model, "models/w_flashbang.mdl") || equali(model, "models/w_smokegrenade.mdl"))
  364.     {
  365.         engfunc(EngFunc_SetModel, entity, g_w_szFrostGrenadeModel)
  366.         return FMRES_SUPERCEDE
  367.     }
  368.    
  369.     return FMRES_IGNORED
  370. }
  371.  
  372. public Fw_ThinkGrenade_Post(entity)
  373. {
  374.     // Invalid entity
  375.     if (!pev_valid(entity))
  376.         return HAM_IGNORED
  377.    
  378.     // Get damage time of grenade
  379.     static Float:dmgtime
  380.     get_entvar(entity, var_dmgtime, dmgtime)
  381.    
  382.     // Check if it's time to go off
  383.     if (dmgtime > get_gametime())
  384.         return HAM_IGNORED
  385.    
  386.     // Check if it's one of our custom nades
  387.     switch (get_entvar(entity, var_flTimeStepSound))
  388.     {
  389.         case 3333.0: // Frost Grenade
  390.         {
  391.             frost_explode(entity)
  392.             return HAM_SUPERCEDE
  393.         }
  394.     }
  395.     return HAM_IGNORED
  396. }
  397.  
  398. // Frost Grenade Explosion
  399. frost_explode(ent)
  400. {
  401.     // Get origin
  402.     static Float:origin[3]
  403.     get_entvar(ent, var_origin, origin)
  404.    
  405.     // Make the explosion
  406.     create_blast3(origin)
  407.    
  408.     // Frost nade explode sound
  409.     static sound[SOUND_MAX_LENGTH]
  410.     ArrayGetString(g_szFrostGrenadeExplodeSound, random_num(0, ArraySize(g_szFrostGrenadeExplodeSound) - 1), sound, charsmax(sound))
  411.     emit_sound(ent, CHAN_WEAPON, sound, 1.0, ATTN_NORM, 0, PITCH_NORM)
  412.    
  413.     // Collisions
  414.     if (!get_pcvar_num(g_pCvarHitType))
  415.     {
  416.         new victim = -1
  417.        
  418.         while ((victim = engfunc(EngFunc_FindEntityInSphere, victim, origin, get_pcvar_float(g_pCvarFrostRadius))) != 0)
  419.         {
  420.             // Only effect alive zombies, If player not released yet don't freeze him
  421.             if (!is_user_alive(victim) || !ze_is_user_zombie(victim) || !g_bZombieReleased)
  422.                 continue
  423.            
  424.             set_freeze(victim)
  425.         }
  426.     }
  427.     else
  428.     {
  429.         new Float:flNadeOrigin[3], Float:flVictimOrigin[3], Float:flDistance, tr = create_tr2(), Float:flFraction
  430.         get_entvar(ent, var_origin, flNadeOrigin)
  431.        
  432.         for(new iVictim = 1; iVictim <= g_iMaxClients; iVictim++)
  433.         {
  434.             if (!is_user_alive(iVictim) || !ze_is_user_zombie(iVictim) || !g_bZombieReleased)
  435.                 continue
  436.            
  437.             get_entvar(iVictim, var_origin, flVictimOrigin)
  438.            
  439.             // Get distance between nade and player
  440.             flDistance = vector_distance(flNadeOrigin, flVictimOrigin)
  441.            
  442.             if(flDistance > get_pcvar_float(g_pCvarFrostRadius))
  443.                 continue
  444.            
  445.             flNadeOrigin[2] += 2.0;
  446.             engfunc(EngFunc_TraceLine, flNadeOrigin, flVictimOrigin, DONT_IGNORE_MONSTERS, ent, tr);
  447.             flNadeOrigin[2] -= 2.0;
  448.            
  449.             get_tr2(tr, TR_flFraction, flFraction);
  450.            
  451.             if(flFraction != 1.0 && get_tr2(tr, TR_pHit) != iVictim)
  452.                 continue;
  453.            
  454.             set_freeze(iVictim)
  455.         }
  456.        
  457.         // Free the trace handler
  458.         free_tr2(tr);
  459.     }
  460.    
  461.     // Get rid of the grenade
  462.     engfunc(EngFunc_RemoveEntity, ent)
  463. }
  464.  
  465. set_freeze(victim)
  466. {
  467.     // Already frozen
  468.     if (g_bIsFrozen[victim])
  469.         return false
  470.    
  471.     // Allow other plugins to decide whether player should be frozen or not
  472.     ExecuteForward(g_iForwards[FW_USER_FREEZE_PRE], g_iForwardReturn, victim)
  473.    
  474.     if (g_iForwardReturn >= PLUGIN_HANDLED)
  475.     {
  476.         // Get player's origin
  477.         static origin2[3]
  478.         get_user_origin(victim, origin2)
  479.        
  480.         // Broken glass sound
  481.         static sound[SOUND_MAX_LENGTH]
  482.         ArrayGetString(g_szFrostGrenadeBreakSound, random_num(0, ArraySize(g_szFrostGrenadeBreakSound) - 1), sound, charsmax(sound))
  483.         emit_sound(victim, CHAN_BODY, sound, 1.0, ATTN_NORM, 0, PITCH_NORM)
  484.        
  485.         // Glass shatter
  486.         message_begin(MSG_PVS, SVC_TEMPENTITY, origin2)
  487.         write_byte(TE_BREAKMODEL) // TE id
  488.         write_coord(origin2[0]) // x
  489.         write_coord(origin2[1]) // y
  490.         write_coord(origin2[2]+24) // z
  491.         write_coord(16) // size x
  492.         write_coord(16) // size y
  493.         write_coord(16) // size z
  494.         write_coord(random_num(-50, 50)) // velocity x
  495.         write_coord(random_num(-50, 50)) // velocity y
  496.         write_coord(25) // velocity z
  497.         write_byte(10) // random velocity
  498.         write_short(g_iGlassSpr) // model
  499.         write_byte(10) // count
  500.         write_byte(25) // life
  501.         write_byte(0x01) // flags
  502.         message_end()
  503.        
  504.         return false
  505.     }
  506.    
  507.     // Freeze icon?
  508.     if (get_pcvar_num(g_pCvarFrostHudIcon))
  509.     {
  510.         message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("Damage"), _, victim)
  511.         write_byte(0) // damage save
  512.         write_byte(0) // damage take
  513.         write_long(DMG_DROWN) // damage type - DMG_FREEZE
  514.         write_coord(0) // x
  515.         write_coord(0) // y
  516.         write_coord(0) // z
  517.         message_end()
  518.     }
  519.    
  520.     // Set frozen flag
  521.     g_bIsFrozen[victim] = true
  522.    
  523.     // Freeze sound
  524.     static sound[SOUND_MAX_LENGTH]
  525.     ArrayGetString(g_szFrostGrenadePlayerSound, random_num(0, ArraySize(g_szFrostGrenadePlayerSound) - 1), sound, charsmax(sound))
  526.     emit_sound(victim, CHAN_BODY, sound, 1.0, ATTN_NORM, 0, PITCH_NORM)
  527.    
  528.     // Add a blue tint to their screen
  529.     message_begin(MSG_ONE, get_user_msgid("ScreenFade"), _, victim)
  530.     write_short(0) // duration
  531.     write_short(0) // hold time
  532.     write_short(0x0004) // fade type
  533.     write_byte(0) // red
  534.     write_byte(50) // green
  535.     write_byte(200) // blue
  536.     write_byte(100) // alpha
  537.     message_end()
  538.    
  539.     // Update player entity rendering
  540.     ApplyFrozenRendering(victim)
  541.    
  542.     // Set a task to remove the freeze
  543.     set_task(get_pcvar_float(g_pCvarFrostDuration), "RemoveFreeze", victim+TASK_FROST_REMOVE)
  544.     return true
  545. }
  546.  
  547. ApplyFrozenRendering(id)
  548. {
  549.     // Get current rendering
  550.     new rendering_fx = get_entvar(id, var_renderfx)
  551.     new Float:rendering_color[3]
  552.     get_entvar(id, var_rendercolor, rendering_color)
  553.     new rendering_render = get_entvar(id, var_rendermode)
  554.     new Float:rendering_amount
  555.     get_entvar(id, var_renderamt, rendering_amount)
  556.    
  557.     // Already set, no worries...
  558.     if (rendering_fx == kRenderFxGlowShell && rendering_color[0] == 0.0 && rendering_color[1] == 100.0
  559.         && rendering_color[2] == 200.0 && rendering_render == kRenderNormal && rendering_amount == 25.0)
  560.         return
  561.    
  562.     // Save player's old rendering
  563.     g_iFrozenRenderingFx[id] = get_entvar(id, var_renderfx)
  564.     get_entvar(id, var_rendercolor, g_fFrozenRenderingColor[id])
  565.     g_iFrozenRenderingRender[id] = get_entvar(id, var_rendermode)
  566.     get_entvar(id, var_renderamt, g_fFrozenRenderingAmount[id])
  567.    
  568.     // Light blue glow while frozen
  569.     Set_Rendering(id, kRenderFxGlowShell, 0, 100, 200, kRenderNormal, 25)
  570. }
  571.  
  572. // Remove freeze task
  573. public RemoveFreeze(taskid)
  574. {
  575.     // Remove frozen flag
  576.     g_bIsFrozen[ID_FROST_REMOVE] = false
  577.    
  578.     // Restore rendering
  579.     new iRed = floatround(g_fFrozenRenderingColor[ID_FROST_REMOVE][0]),
  580.     iGreen = floatround(g_fFrozenRenderingColor[ID_FROST_REMOVE][1]),
  581.     iBlue = floatround(g_fFrozenRenderingColor[ID_FROST_REMOVE][2])
  582.  
  583.     Set_Rendering(ID_FROST_REMOVE, g_iFrozenRenderingFx[ID_FROST_REMOVE], iRed, iGreen, iBlue, g_iFrozenRenderingRender[ID_FROST_REMOVE], floatround(g_fFrozenRenderingAmount[ID_FROST_REMOVE]))
  584.  
  585.     // Gradually remove screen's blue tint
  586.     message_begin(MSG_ONE, get_user_msgid("ScreenFade"), _, ID_FROST_REMOVE)
  587.     write_short((1<<12)) // duration
  588.     write_short(0) // hold time
  589.     write_short(0x0000) // fade type
  590.     write_byte(0) // red
  591.     write_byte(50) // green
  592.     write_byte(200) // blue
  593.     write_byte(100) // alpha
  594.     message_end()
  595.    
  596.     // Broken glass sound
  597.     static sound[SOUND_MAX_LENGTH]
  598.     ArrayGetString(g_szFrostGrenadeBreakSound, random_num(0, ArraySize(g_szFrostGrenadeBreakSound) - 1), sound, charsmax(sound))
  599.     emit_sound(ID_FROST_REMOVE, CHAN_BODY, sound, 1.0, ATTN_NORM, 0, PITCH_NORM)
  600.    
  601.     // Get player's origin
  602.     static origin[3]
  603.     get_user_origin(ID_FROST_REMOVE, origin)
  604.    
  605.     // Glass shatter
  606.     message_begin(MSG_PVS, SVC_TEMPENTITY, origin)
  607.     write_byte(TE_BREAKMODEL) // TE id
  608.     write_coord(origin[0]) // x
  609.     write_coord(origin[1]) // y
  610.     write_coord(origin[2]+24) // z
  611.     write_coord(16) // size x
  612.     write_coord(16) // size y
  613.     write_coord(16) // size z
  614.     write_coord(random_num(-50, 50)) // velocity x
  615.     write_coord(random_num(-50, 50)) // velocity y
  616.     write_coord(25) // velocity z
  617.     write_byte(10) // random velocity
  618.     write_short(g_iGlassSpr) // model
  619.     write_byte(10) // count
  620.     write_byte(25) // life
  621.     write_byte(BREAK_GLASS) // flags
  622.     message_end()
  623.    
  624.     ExecuteForward(g_iForwards[FW_USER_UNFROZEN], g_iForwardReturn, ID_FROST_REMOVE)
  625. }
  626.  
  627. // Frost Grenade: Freeze Blast
  628. create_blast3(const Float:originF[3])
  629. {
  630.     // Smallest ring
  631.     engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, originF, 0)
  632.     write_byte(TE_BEAMCYLINDER) // TE id
  633.     engfunc(EngFunc_WriteCoord, originF[0]) // x
  634.     engfunc(EngFunc_WriteCoord, originF[1]) // y
  635.     engfunc(EngFunc_WriteCoord, originF[2]) // z
  636.     engfunc(EngFunc_WriteCoord, originF[0]) // x axis
  637.     engfunc(EngFunc_WriteCoord, originF[1]) // y axis
  638.     engfunc(EngFunc_WriteCoord, originF[2]+385.0) // z axis
  639.     write_short(g_iExplodeSpr) // sprite
  640.     write_byte(0) // startframe
  641.     write_byte(0) // framerate
  642.     write_byte(4) // life
  643.     write_byte(60) // width
  644.     write_byte(0) // noise
  645.     write_byte(0) // red
  646.     write_byte(100) // green
  647.     write_byte(200) // blue
  648.     write_byte(200) // brightness
  649.     write_byte(0) // speed
  650.     message_end()
  651.    
  652.     // Medium ring
  653.     engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, originF, 0)
  654.     write_byte(TE_BEAMCYLINDER) // TE id
  655.     engfunc(EngFunc_WriteCoord, originF[0]) // x
  656.     engfunc(EngFunc_WriteCoord, originF[1]) // y
  657.     engfunc(EngFunc_WriteCoord, originF[2]) // z
  658.     engfunc(EngFunc_WriteCoord, originF[0]) // x axis
  659.     engfunc(EngFunc_WriteCoord, originF[1]) // y axis
  660.     engfunc(EngFunc_WriteCoord, originF[2]+470.0) // z axis
  661.     write_short(g_iExplodeSpr) // sprite
  662.     write_byte(0) // startframe
  663.     write_byte(0) // framerate
  664.     write_byte(4) // life
  665.     write_byte(60) // width
  666.     write_byte(0) // noise
  667.     write_byte(0) // red
  668.     write_byte(100) // green
  669.     write_byte(200) // blue
  670.     write_byte(200) // brightness
  671.     write_byte(0) // speed
  672.     message_end()
  673.    
  674.     // Largest ring
  675.     engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, originF, 0)
  676.     write_byte(TE_BEAMCYLINDER) // TE id
  677.     engfunc(EngFunc_WriteCoord, originF[0]) // x
  678.     engfunc(EngFunc_WriteCoord, originF[1]) // y
  679.     engfunc(EngFunc_WriteCoord, originF[2]) // z
  680.     engfunc(EngFunc_WriteCoord, originF[0]) // x axis
  681.     engfunc(EngFunc_WriteCoord, originF[1]) // y axis
  682.     engfunc(EngFunc_WriteCoord, originF[2]+555.0) // z axis
  683.     write_short(g_iExplodeSpr) // sprite
  684.     write_byte(0) // startframe
  685.     write_byte(0) // framerate
  686.     write_byte(4) // life
  687.     write_byte(60) // width
  688.     write_byte(0) // noise
  689.     write_byte(0) // red
  690.     write_byte(100) // green
  691.     write_byte(200) // blue
  692.     write_byte(200) // brightness
  693.     write_byte(0) // speed
  694.     message_end()
  695. }



  1. #include <zombie_escape>
  2.  
  3. // Setting File
  4. new const ZE_SETTING_RESOURCES[] = "zombie_escape.ini"
  5.  
  6. // Defines
  7. #define MODEL_MAX_LENGTH 64
  8. #define SOUND_MAX_LENGTH 64
  9. #define SPRITE_MAX_LENGTH 64
  10. #define TASK_BURN 100
  11. #define ID_BURN (taskid - TASK_BURN)
  12.  
  13. // Default Values
  14. new const szFireGrenadeExplodeSound[][] =
  15. {
  16.     "zombie_escape/grenade_explode.wav"
  17. }
  18.  
  19. new const szFireGrenadePlayerSound[][] =
  20. {
  21.     "zombie_escape/zombie_burn3.wav",
  22.     "zombie_escape/zombie_burn4.wav",
  23.     "zombie_escape/zombie_burn5.wav",
  24.     "zombie_escape/zombie_burn6.wav",
  25.     "zombie_escape/zombie_burn7.wav"
  26. }
  27.  
  28. new g_v_szModelFireGrenade[MODEL_MAX_LENGTH] = "models/zombie_escape/v_grenade_fire.mdl"
  29. new g_p_szModelFireGrenade[MODEL_MAX_LENGTH] = "models/zombie_escape/p_grenade_fire.mdl"
  30. new g_w_szModelFireGrenade[MODEL_MAX_LENGTH] = "models/zombie_escape/w_grenade_fire.mdl"
  31.  
  32. new g_szGrenadeTrailSprite[SPRITE_MAX_LENGTH] = "sprites/laserbeam.spr"
  33. new g_szGrenadeRingSprite[SPRITE_MAX_LENGTH] = "sprites/shockwave.spr"
  34. new g_szGrenadeFireSprite[SPRITE_MAX_LENGTH] = "sprites/flame.spr"
  35. new g_szGrenadeSmokeSprite[SPRITE_MAX_LENGTH] = "sprites/black_smoke3.spr"
  36.  
  37. // Dynamic Arrays
  38. new Array:g_szFireGrenadeExplodeSound
  39. new Array:g_szFireGrenadePlayerSound
  40.  
  41. // Forwards
  42. new g_iFwUserBurn,
  43.     g_iForwardReturn
  44.  
  45. // Variables
  46. new g_iBurningDuration[33],
  47.     g_iMaxClients
  48.  
  49. // Sprites
  50. new g_iTrailSpr,
  51.     g_iExplodeSpr,
  52.     g_iFlameSpr,
  53.     g_iSmokeSpr
  54.  
  55. //Cvars
  56. new g_pCvarFireDuration,
  57.     g_pCvarFireDamage,
  58.     g_pCvarFireHudIcon,
  59.     g_pCvarFireExplosion,
  60.     g_pCvarFireSlowDown,
  61.     g_pCvarFireRadius,
  62.     g_pCvarHitType
  63.  
  64. public plugin_init()
  65. {
  66.     register_plugin("[ZE] Fire Nade", ZE_VERSION, AUTHORS)
  67.    
  68.     // Hook Chains
  69.     RegisterHookChain(RG_CBasePlayer_Killed, "Fw_PlayerKilled_Post", 1)
  70.    
  71.     // Events
  72.     register_event("HLTV", "New_Round", "a", "1=0", "2=0")
  73.    
  74.     // Fakemeta
  75.     register_forward(FM_SetModel, "Fw_SetModel_Post")
  76.    
  77.     // Hams
  78.     RegisterHam(Ham_Think, "grenade", "Fw_ThinkGrenade_Post")
  79.    
  80.     // Forwards
  81.     g_iFwUserBurn = CreateMultiForward("ze_fire_pre", ET_CONTINUE, FP_CELL)
  82.    
  83.     // Cvars
  84.     g_pCvarFireDuration = register_cvar("ze_fire_duration", "6")
  85.     g_pCvarFireDamage = register_cvar("ze_fire_damage", "5")
  86.     g_pCvarFireHudIcon = register_cvar("ze_fire_hud_icon", "1")
  87.     g_pCvarFireExplosion = register_cvar("ze_fire_explosion", "0")
  88.     g_pCvarFireSlowDown = register_cvar("ze_fire_slowdown", "0.1")
  89.     g_pCvarFireRadius = register_cvar("ze_fire_radius", "240.0")
  90.     g_pCvarHitType = register_cvar("ze_fire_hit_type", "0")
  91.    
  92.     // Static Values
  93.     g_iMaxClients = get_member_game(m_nMaxPlayers)
  94. }
  95.  
  96. public plugin_precache()
  97. {
  98.     // Initialize arrays
  99.     g_szFireGrenadeExplodeSound = ArrayCreate(SOUND_MAX_LENGTH, 1)
  100.     g_szFireGrenadePlayerSound = ArrayCreate(SOUND_MAX_LENGTH, 1)
  101.    
  102.     // Load from external file
  103.     amx_load_setting_string_arr(ZE_SETTING_RESOURCES, "Sounds", "GRENADE FIRE EXPLODE", g_szFireGrenadeExplodeSound)
  104.     amx_load_setting_string_arr(ZE_SETTING_RESOURCES, "Sounds", "GRENADE FIRE PLAYER", g_szFireGrenadePlayerSound)
  105.    
  106.     // If we couldn't load custom sounds from file, use and save default ones
  107.    
  108.     new iIndex
  109.    
  110.     if (ArraySize(g_szFireGrenadeExplodeSound) == 0)
  111.     {
  112.         for (iIndex = 0; iIndex < sizeof szFireGrenadeExplodeSound; iIndex++)
  113.             ArrayPushString(g_szFireGrenadeExplodeSound, szFireGrenadeExplodeSound[iIndex])
  114.        
  115.         // Save to external file
  116.         amx_save_setting_string_arr(ZE_SETTING_RESOURCES, "Sounds", "GRENADE FIRE EXPLODE", g_szFireGrenadeExplodeSound)
  117.     }
  118.    
  119.     if (ArraySize(g_szFireGrenadePlayerSound) == 0)
  120.     {
  121.         for (iIndex = 0; iIndex < sizeof szFireGrenadePlayerSound; iIndex++)
  122.             ArrayPushString(g_szFireGrenadePlayerSound, szFireGrenadePlayerSound[iIndex])
  123.        
  124.         // Save to external file
  125.         amx_save_setting_string_arr(ZE_SETTING_RESOURCES, "Sounds", "GRENADE FIRE PLAYER", g_szFireGrenadePlayerSound)
  126.     }
  127.    
  128.     // Load from external file, save if not found
  129.     if (!amx_load_setting_string(ZE_SETTING_RESOURCES, "Weapon Models", "V_GRENADE FIRE", g_v_szModelFireGrenade, charsmax(g_v_szModelFireGrenade)))
  130.         amx_save_setting_string(ZE_SETTING_RESOURCES, "Weapon Models", "V_GRENADE FIRE", g_v_szModelFireGrenade)
  131.     if (!amx_load_setting_string(ZE_SETTING_RESOURCES, "Weapon Models", "P_GRENADE FIRE", g_p_szModelFireGrenade, charsmax(g_p_szModelFireGrenade)))
  132.         amx_save_setting_string(ZE_SETTING_RESOURCES, "Weapon Models", "P_GRENADE FIRE", g_p_szModelFireGrenade)
  133.     if (!amx_load_setting_string(ZE_SETTING_RESOURCES, "Weapon Models", "W_GRENADE FIRE", g_w_szModelFireGrenade, charsmax(g_w_szModelFireGrenade)))
  134.         amx_save_setting_string(ZE_SETTING_RESOURCES, "Weapon Models", "W_GRENADE FIRE", g_w_szModelFireGrenade)
  135.     if (!amx_load_setting_string(ZE_SETTING_RESOURCES, "Grenade Sprites", "TRAIL", g_szGrenadeTrailSprite, charsmax(g_szGrenadeTrailSprite)))
  136.         amx_save_setting_string(ZE_SETTING_RESOURCES, "Grenade Sprites", "TRAIL", g_szGrenadeTrailSprite)
  137.     if (!amx_load_setting_string(ZE_SETTING_RESOURCES, "Grenade Sprites", "RING", g_szGrenadeRingSprite, charsmax(g_szGrenadeRingSprite)))
  138.         amx_save_setting_string(ZE_SETTING_RESOURCES, "Grenade Sprites", "RING", g_szGrenadeRingSprite)
  139.     if (!amx_load_setting_string(ZE_SETTING_RESOURCES, "Grenade Sprites", "FIRE", g_szGrenadeFireSprite, charsmax(g_szGrenadeFireSprite)))
  140.         amx_save_setting_string(ZE_SETTING_RESOURCES, "Grenade Sprites", "FIRE", g_szGrenadeFireSprite)
  141.     if (!amx_load_setting_string(ZE_SETTING_RESOURCES, "Grenade Sprites", "SMOKE", g_szGrenadeSmokeSprite, charsmax(g_szGrenadeSmokeSprite)))
  142.         amx_save_setting_string(ZE_SETTING_RESOURCES, "Grenade Sprites", "SMOKE", g_szGrenadeSmokeSprite)
  143.    
  144.     // Precache sounds
  145.    
  146.     new szSound[SOUND_MAX_LENGTH]
  147.    
  148.     for (iIndex = 0; iIndex < ArraySize(g_szFireGrenadeExplodeSound); iIndex++)
  149.     {
  150.         ArrayGetString(g_szFireGrenadeExplodeSound, iIndex, szSound, charsmax(szSound))
  151.         precache_sound(szSound)
  152.     }
  153.     for (iIndex = 0; iIndex < ArraySize(g_szFireGrenadePlayerSound); iIndex++)
  154.     {
  155.         ArrayGetString(g_szFireGrenadePlayerSound, iIndex, szSound, charsmax(szSound))
  156.         precache_sound(szSound)
  157.     }
  158.    
  159.     // Precache Models
  160.     precache_model(g_v_szModelFireGrenade)
  161.     precache_model(g_p_szModelFireGrenade)
  162.     precache_model(g_w_szModelFireGrenade)
  163.    
  164.     // Precache Sprites
  165.     g_iTrailSpr = precache_model(g_szGrenadeTrailSprite)
  166.     g_iExplodeSpr = precache_model(g_szGrenadeRingSprite)
  167.     g_iFlameSpr = precache_model(g_szGrenadeFireSprite)
  168.     g_iSmokeSpr = precache_model(g_szGrenadeSmokeSprite)
  169. }
  170.  
  171. public plugin_natives()
  172. {
  173.     register_native("ze_zombie_in_fire", "native_ze_zombie_in_fire", 1)
  174.     register_native("ze_set_fire_grenade", "native_ze_set_fire_grenade", 1)
  175. }
  176.  
  177. public native_ze_zombie_in_fire(id)
  178. {
  179.     if (!is_user_alive(id))
  180.     {
  181.         return -1;
  182.     }
  183.    
  184.     return task_exists(id+TASK_BURN)
  185. }
  186.  
  187. public native_ze_set_fire_grenade(id, set)
  188. {
  189.     if (!is_user_alive(id))
  190.     {
  191.         log_error(AMX_ERR_NATIVE, "[ZE] Invalid Player (%d)", id)
  192.         return -1;
  193.     }
  194.    
  195.     if (!set)
  196.     {
  197.         if (!task_exists(id+TASK_BURN))
  198.             return true
  199.        
  200.         static origin[3]
  201.         get_user_origin(id, origin)
  202.        
  203.         message_begin(MSG_PVS, SVC_TEMPENTITY, origin)
  204.         write_byte(TE_SMOKE) // TE id
  205.         write_coord(origin[0]) // x
  206.         write_coord(origin[1]) // y
  207.         write_coord(origin[2]-50) // z
  208.         write_short(g_iSmokeSpr) // sprite
  209.         write_byte(random_num(15, 20)) // scale
  210.         write_byte(random_num(10, 20)) // framerate
  211.         message_end()
  212.        
  213.         remove_task(id+TASK_BURN)
  214.         return true
  215.     }
  216.    
  217.     return set_on_fire(id)
  218. }
  219.  
  220. public ze_user_humanized(id)
  221. {
  222.     // Stop burning
  223.     remove_task(id+TASK_BURN)
  224.     g_iBurningDuration[id] = 0
  225.    
  226.     cs_set_player_view_model(id, CSW_HEGRENADE, g_v_szModelFireGrenade)
  227.     cs_set_player_weap_model(id, CSW_HEGRENADE, g_p_szModelFireGrenade)
  228. }
  229.  
  230. public New_Round()
  231. {
  232.     // Set w_ models for grenades on ground
  233.     new szModel[32], iEntity = -1;
  234.  
  235.     while((iEntity = rg_find_ent_by_class( iEntity, "armoury_entity")))
  236.     {
  237.         get_entvar(iEntity, var_model, szModel, charsmax(szModel))
  238.        
  239.         if (equali(szModel, "models/w_hegrenade.mdl"))
  240.         {
  241.             engfunc(EngFunc_SetModel, iEntity, g_w_szModelFireGrenade)
  242.         }
  243.     }
  244. }
  245.  
  246. public Fw_PlayerKilled_Post(iVictim, iAttacker)
  247. {
  248.     remove_task(iVictim+TASK_BURN)
  249.     g_iBurningDuration[iVictim] = 0
  250. }
  251.  
  252. public client_disconnected(id)
  253. {
  254.     remove_task(id+TASK_BURN)
  255.     g_iBurningDuration[id] = 0
  256. }
  257.  
  258. public Fw_SetModel_Post(entity, const model[])
  259. {
  260.     if (strlen(model) < 8)
  261.         return FMRES_IGNORED
  262.    
  263.     static Float:dmgtime
  264.     get_entvar(entity, var_dmgtime, dmgtime)
  265.    
  266.     if (dmgtime == 0.0)
  267.         return FMRES_IGNORED
  268.    
  269.     if (ze_is_user_zombie(get_entvar(entity, var_owner)))
  270.         return FMRES_IGNORED
  271.    
  272.     if (model[9] == 'h' && model[10] == 'e')
  273.     {
  274.         Set_Rendering(entity, kRenderFxGlowShell, 200, 0, 0, kRenderNormal, 16)
  275.        
  276.         message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
  277.         write_byte(TE_BEAMFOLLOW) // TE id
  278.         write_short(entity) // entity
  279.         write_short(g_iTrailSpr) // sprite
  280.         write_byte(10) // life
  281.         write_byte(10) // width
  282.         write_byte(200) // r
  283.         write_byte(0) // g
  284.         write_byte(0) // b
  285.         write_byte(200) // brightness
  286.         message_end()
  287.        
  288.         set_entvar(entity, var_flTimeStepSound, 2222.0)
  289.     }
  290.    
  291.     // Set w_ model
  292.     if (equali(model, "models/w_hegrenade.mdl"))
  293.     {
  294.         engfunc(EngFunc_SetModel, entity, g_w_szModelFireGrenade)
  295.         return FMRES_SUPERCEDE
  296.     }
  297.    
  298.     return FMRES_IGNORED
  299. }
  300.  
  301. public Fw_ThinkGrenade_Post(entity)
  302. {
  303.     if (!pev_valid(entity)) return HAM_IGNORED
  304.    
  305.     static Float:dmgtime
  306.     get_entvar(entity, var_dmgtime, dmgtime)
  307.    
  308.     if (dmgtime > get_gametime())
  309.         return HAM_IGNORED
  310.    
  311.     if (get_entvar(entity, var_flTimeStepSound) != 2222.0)
  312.         return HAM_IGNORED
  313.    
  314.     fire_explode(entity)
  315.    
  316.     if (get_pcvar_num(g_pCvarFireExplosion) == 1)
  317.     {
  318.         set_entvar(entity, var_flTimeStepSound, 0.0)
  319.         return HAM_IGNORED
  320.     }
  321.    
  322.     engfunc(EngFunc_RemoveEntity, entity)
  323.     return HAM_SUPERCEDE
  324. }
  325.  
  326. fire_explode(ent)
  327. {
  328.     static Float:origin[3]
  329.     get_entvar(ent, var_origin, origin)
  330.    
  331.     if (get_pcvar_num(g_pCvarFireExplosion) == 0)
  332.     {
  333.         create_blast2(origin)
  334.        
  335.         // Fire nade explode sound
  336.         static szSound[SOUND_MAX_LENGTH]
  337.         ArrayGetString(g_szFireGrenadeExplodeSound, random_num(0, ArraySize(g_szFireGrenadeExplodeSound) - 1), szSound, charsmax(szSound))
  338.         emit_sound(ent, CHAN_WEAPON, szSound, 1.0, ATTN_NORM, 0, PITCH_NORM)
  339.     }
  340.    
  341.     if (!get_pcvar_num(g_pCvarHitType))
  342.     {
  343.         new victim = -1
  344.  
  345.         while ((victim = engfunc(EngFunc_FindEntityInSphere, victim, origin, get_pcvar_float(g_pCvarFireRadius))) != 0)
  346.         {
  347.             if (!is_user_alive(victim) || !ze_is_user_zombie(victim))
  348.                 continue
  349.            
  350.             set_on_fire(victim)
  351.         }
  352.     }
  353.     else
  354.     {
  355.         new Float:flNadeOrigin[3], Float:flVictimOrigin[3], Float:flDistance, tr = create_tr2(), Float:flFraction
  356.         get_entvar(ent, var_origin, flNadeOrigin)
  357.        
  358.         for(new iVictim = 1; iVictim <= g_iMaxClients; iVictim++)
  359.         {
  360.             if (!is_user_alive(iVictim) || !ze_is_user_zombie(iVictim))
  361.                 continue
  362.            
  363.             get_entvar(iVictim, var_origin, flVictimOrigin)
  364.            
  365.             // Get distance between nade and player
  366.             flDistance = vector_distance(flNadeOrigin, flVictimOrigin)
  367.            
  368.             if(flDistance > get_pcvar_float(g_pCvarFireRadius))
  369.                 continue
  370.            
  371.             flNadeOrigin[2] += 2.0;
  372.             engfunc(EngFunc_TraceLine, flNadeOrigin, flVictimOrigin, DONT_IGNORE_MONSTERS, ent, tr);
  373.             flNadeOrigin[2] -= 2.0;
  374.            
  375.             get_tr2(tr, TR_flFraction, flFraction);
  376.            
  377.             if(flFraction != 1.0 && get_tr2(tr, TR_pHit) != iVictim)
  378.                 continue;
  379.            
  380.             set_on_fire(iVictim)
  381.         }
  382.        
  383.         // Free the trace handler
  384.         free_tr2(tr);
  385.     }
  386. }
  387.  
  388. set_on_fire(victim)
  389. {
  390.     ExecuteForward(g_iFwUserBurn, g_iForwardReturn, victim)
  391.    
  392.     if (g_iForwardReturn >= PLUGIN_HANDLED)
  393.         return false;
  394.    
  395.     if (get_pcvar_num(g_pCvarFireHudIcon))
  396.     {
  397.         message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("Damage"), _, victim)
  398.         write_byte(0) // damage save
  399.         write_byte(0) // damage take
  400.         write_long(DMG_BURN) // damage type
  401.         write_coord(0) // x
  402.         write_coord(0) // y
  403.         write_coord(0) // z
  404.         message_end()
  405.     }
  406.    
  407.     g_iBurningDuration[victim] += get_pcvar_num(g_pCvarFireDuration) * 5
  408.    
  409.     remove_task(victim+TASK_BURN)
  410.     set_task(0.2, "burning_flame", victim+TASK_BURN, _, _, "b")
  411.     return true
  412. }
  413.  
  414. // Burning Flames
  415. public burning_flame(taskid)
  416. {
  417.     static origin[3]
  418.     get_user_origin(ID_BURN, origin)
  419.     new flags = get_entvar(ID_BURN, var_flags)
  420.    
  421.     if ((flags & FL_INWATER) || g_iBurningDuration[ID_BURN] < 1)
  422.     {
  423.         // Smoke sprite
  424.         message_begin(MSG_PVS, SVC_TEMPENTITY, origin)
  425.         write_byte(TE_SMOKE) // TE id
  426.         write_coord(origin[0]) // x
  427.         write_coord(origin[1]) // y
  428.         write_coord(origin[2]-50) // z
  429.         write_short(g_iSmokeSpr) // sprite
  430.         write_byte(random_num(15, 20)) // scale
  431.         write_byte(random_num(10, 20)) // framerate
  432.         message_end()
  433.        
  434.         // Task not needed anymore
  435.         remove_task(taskid)
  436.         return;
  437.     }
  438.    
  439.     // Randomly play burning zombie scream sounds
  440.     if (random_num(1, 20) == 1)
  441.     {
  442.         static szSound[SOUND_MAX_LENGTH]
  443.         ArrayGetString(g_szFireGrenadePlayerSound, random_num(0, ArraySize(g_szFireGrenadePlayerSound) - 1), szSound, charsmax(szSound))
  444.         emit_sound(ID_BURN, CHAN_VOICE, szSound, 1.0, ATTN_NORM, 0, PITCH_NORM)
  445.     }
  446.    
  447.     // Fire slow down
  448.     if ((flags & FL_ONGROUND) && get_pcvar_float(g_pCvarFireSlowDown) > 0.0)
  449.     {
  450.         static Float:fVelocity[3]
  451.         get_entvar(ID_BURN, var_velocity, fVelocity)
  452.         VecMulScalar(fVelocity, get_pcvar_float(g_pCvarFireSlowDown), fVelocity)
  453.         set_entvar(ID_BURN, var_velocity, fVelocity)
  454.     }
  455.    
  456.     new health = get_user_health(ID_BURN)
  457.    
  458.     if (health - floatround(get_pcvar_float(g_pCvarFireDamage), floatround_ceil) > 0)
  459.         set_entvar(ID_BURN, var_health, float(health - floatround(get_pcvar_float(g_pCvarFireDamage), floatround_ceil)))
  460.    
  461.     message_begin(MSG_PVS, SVC_TEMPENTITY, origin)
  462.     write_byte(TE_SPRITE) // TE id
  463.     write_coord(origin[0]+random_num(-5, 5)) // x
  464.     write_coord(origin[1]+random_num(-5, 5)) // y
  465.     write_coord(origin[2]+random_num(-10, 10)) // z
  466.     write_short(g_iFlameSpr) // sprite
  467.     write_byte(random_num(5, 10)) // scale
  468.     write_byte(200) // brightness
  469.     message_end()
  470.    
  471.     g_iBurningDuration[ID_BURN] --
  472. }
  473.  
  474. // Fire Grenade: Fire Blast
  475. create_blast2(const Float:origin[3])
  476. {
  477.     // Smallest ring
  478.     engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, origin, 0)
  479.     write_byte(TE_BEAMCYLINDER) // TE id
  480.     engfunc(EngFunc_WriteCoord, origin[0]) // x
  481.     engfunc(EngFunc_WriteCoord, origin[1]) // y
  482.     engfunc(EngFunc_WriteCoord, origin[2]) // z
  483.     engfunc(EngFunc_WriteCoord, origin[0]) // x axis
  484.     engfunc(EngFunc_WriteCoord, origin[1]) // y axis
  485.     engfunc(EngFunc_WriteCoord, origin[2]+385.0) // z axis
  486.     write_short(g_iExplodeSpr) // sprite
  487.     write_byte(0) // startframe
  488.     write_byte(0) // framerate
  489.     write_byte(4) // life
  490.     write_byte(60) // width
  491.     write_byte(0) // noise
  492.     write_byte(200) // red
  493.     write_byte(100) // green
  494.     write_byte(0) // blue
  495.     write_byte(200) // brightness
  496.     write_byte(0) // speed
  497.     message_end()
  498.    
  499.     // Medium ring
  500.     engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, origin, 0)
  501.     write_byte(TE_BEAMCYLINDER) // TE id
  502.     engfunc(EngFunc_WriteCoord, origin[0]) // x
  503.     engfunc(EngFunc_WriteCoord, origin[1]) // y
  504.     engfunc(EngFunc_WriteCoord, origin[2]) // z
  505.     engfunc(EngFunc_WriteCoord, origin[0]) // x axis
  506.     engfunc(EngFunc_WriteCoord, origin[1]) // y axis
  507.     engfunc(EngFunc_WriteCoord, origin[2]+470.0) // z axis
  508.     write_short(g_iExplodeSpr) // sprite
  509.     write_byte(0) // startframe
  510.     write_byte(0) // framerate
  511.     write_byte(4) // life
  512.     write_byte(60) // width
  513.     write_byte(0) // noise
  514.     write_byte(200) // red
  515.     write_byte(50) // green
  516.     write_byte(0) // blue
  517.     write_byte(200) // brightness
  518.     write_byte(0) // speed
  519.     message_end()
  520.    
  521.     // Largest ring
  522.     engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, origin, 0)
  523.     write_byte(TE_BEAMCYLINDER) // TE id
  524.     engfunc(EngFunc_WriteCoord, origin[0]) // x
  525.     engfunc(EngFunc_WriteCoord, origin[1]) // y
  526.     engfunc(EngFunc_WriteCoord, origin[2]) // z
  527.     engfunc(EngFunc_WriteCoord, origin[0]) // x axis
  528.     engfunc(EngFunc_WriteCoord, origin[1]) // y axis
  529.     engfunc(EngFunc_WriteCoord, origin[2]+555.0) // z axis
  530.     write_short(g_iExplodeSpr) // sprite
  531.     write_byte(0) // startframe
  532.     write_byte(0) // framerate
  533.     write_byte(4) // life
  534.     write_byte(60) // width
  535.     write_byte(0) // noise
  536.     write_byte(200) // red
  537.     write_byte(0) // green
  538.     write_byte(0) // blue
  539.     write_byte(200) // brightness
  540.     write_byte(0) // speed
  541.     message_end()
  542. }

OR use this!

viewtopic.php?f=15&t=3445

czirimbolo
Veteran Member
Veteran Member
Poland
Posts: 598
Joined: 7 years ago
Contact:

#13

Post by czirimbolo » 5 years ago

Best thing i can tell you todo with this is put the Grom nade in your plugins-zombie_escape.ini above force_sheild grenade like this.
  1. ze_extra_zombie_gromgrenade.amxx debug
  2. force_shield_grenade.amxx
This worked, thanks!
Image

User avatar
Crimson
Member
Member
Algeria
Posts: 7
Joined: 5 years ago
Contact:

#14

Post by Crimson » 3 years ago

why i get this problem only in this forum...(plugins)

L 05/03/2020 - 00:48:41: [AMXX] Load error 17 (invalid file format or version) (plugin "ze_fire.amxx")
L 05/03/2020 - 00:48:41: [AMXX] Load error 17 (invalid file format or version) (plugin "ze_frost.amxx")

Post Reply

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

Register

Sign in

Who is online

Users browsing this forum: No registered users and 6 guests