Converted Grom Nade for Humans

Zombies/Humans Extra-Items
User avatar
Mark
Senior Member
Senior Member
United States of America
Posts: 279
Joined: 9 Months Ago
Location: Des Moines/USA
Donation: 1x donated in total €10.00
Has thanked: 6 times
Been thanked: 21 times
Age: 33
Contact:

Grom Nade for Humans

#1

Post by Mark » 9 Months 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 32 times
grom_grenade.rar
(682.73 KiB) Downloaded 32 times
These users thanked the author Mark for the post:
czirimbolo (9 Months Ago)

User avatar
Raheem
Mod Developer
Mod Developer
Egypt
Posts: 1793
Joined: 2 Years Ago
Location: Egypt
Has thanked: 31 times
Been thanked: 89 times
Age: 21
Contact:

#2

Post by Raheem » 9 Months Ago

You are it's author or just converted?
You don't know? Learn and you will know.

czirimbolo
Veteran Member
Veteran Member
Poland
Posts: 457
Joined: 2 Years Ago
Has thanked: 18 times
Been thanked: 1 time
Contact:

#3

Post by czirimbolo » 9 Months Ago

Converted but some plugin blocks this item on my server
Image

User avatar
Mark
Senior Member
Senior Member
United States of America
Posts: 279
Joined: 9 Months Ago
Location: Des Moines/USA
Donation: 1x donated in total €10.00
Has thanked: 6 times
Been thanked: 21 times
Age: 33
Contact:

#4

Post by Mark » 9 Months Ago

Raheem wrote:
9 Months Ago
You are it's author or just converted?
converted

czirimbolo
Veteran Member
Veteran Member
Poland
Posts: 457
Joined: 2 Years Ago
Has thanked: 18 times
Been thanked: 1 time
Contact:

#5

Post by czirimbolo » 8 Months 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
Senior Member
Senior Member
United States of America
Posts: 279
Joined: 9 Months Ago
Location: Des Moines/USA
Donation: 1x donated in total €10.00
Has thanked: 6 times
Been thanked: 21 times
Age: 33
Contact:

#6

Post by Mark » 8 Months Ago

czirimbolo wrote:
8 Months 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: 457
Joined: 2 Years Ago
Has thanked: 18 times
Been thanked: 1 time
Contact:

#7

Post by czirimbolo » 8 Months 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
Egypt
Posts: 1793
Joined: 2 Years Ago
Location: Egypt
Has thanked: 31 times
Been thanked: 89 times
Age: 21
Contact:

#8

Post by Raheem » 8 Months 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
You don't know? Learn and you will know.

czirimbolo
Veteran Member
Veteran Member
Poland
Posts: 457
Joined: 2 Years Ago
Has thanked: 18 times
Been thanked: 1 time
Contact:

#9

Post by czirimbolo » 8 Months Ago

Raheem wrote:
8 Months 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
Egypt
Posts: 1793
Joined: 2 Years Ago
Location: Egypt
Has thanked: 31 times
Been thanked: 89 times
Age: 21
Contact:

#10

Post by Raheem » 8 Months Ago

I don't understand it well sorry 😂😃😅

[ Post made via Nexus 7 ]
You don't know? Learn and you will know.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest