Member
|
11-29-2022
, 16:22
Drug grenade
|
#1
|
I have frost nade on my server + Impulse and I want to add this drug grenade plugin. How can I fix the interaction between them?
Description: When I throw frost/impulse nade, copies the trail and blast from drug grenade.
Also if I throw drug grenade, doesn't do anything, I only have trail and blast.
Code:
/*****************************************************************************************
#include <amxmodx>
#include <cstrike>
#include <hamsandwich>
#include <fakemeta_util>
new const PLUGIN[] = "Drug Grenade"
new const VERSION[] = "1.1"
new const AUTHOR[] = "Athix"
new g_trailSpr, g_exploSpr;
new gmsg_SetFOV;
new Pcvar_tRed;
new Pcvar_tGreen;
new Pcvar_tBlue;
new Pcvar_bRed;
new Pcvar_bGreen;
new Pcvar_bBlue;
new const spr_grenade_ring[] = { "sprites/shockwave.spr" }
new const spr_grenade_trail[] = { "sprites/plasma.spr" }
public plugin_init()
{
register_plugin( PLUGIN, VERSION, AUTHOR );
register_forward(FM_SetModel, "fw_SetModel")
RegisterHam(Ham_Think, "grenade", "fw_ThinkGrenade")
/* R-G-B Max 255 */
Pcvar_tRed = register_cvar("amx_trail_red", "0")
Pcvar_tGreen = register_cvar("amx_trail_green","255")
Pcvar_tBlue = register_cvar("amx_trail_blue", "255")
Pcvar_bRed = register_cvar("amx_blast_red", "255")
Pcvar_bGreen = register_cvar("amx_blast_green","0")
Pcvar_bBlue = register_cvar("amx_blast_blue", "0")
gmsg_SetFOV = get_user_msgid("SetFOV")
}
public plugin_precache()
{
g_exploSpr = engfunc(EngFunc_PrecacheModel, spr_grenade_ring)
g_trailSpr = engfunc(EngFunc_PrecacheModel, spr_grenade_trail)
}
public fw_ThinkGrenade(entity)
{
static Float:dmgtime
pev(entity, pev_dmgtime, dmgtime)
if (dmgtime > get_gametime())
return HAM_IGNORED;
fov_explode(entity)
return HAM_SUPERCEDE;
}
public fw_SetModel(entity, const model[])
{
if (equal(model[7], "w_he", 4))
{
fm_set_rendering(entity, kRenderFxGlowShell, 0, 200, 0, 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(get_pcvar_num(Pcvar_tRed)) // r /*
write_byte(get_pcvar_num(Pcvar_tGreen)) // g sky-blue
write_byte(get_pcvar_num(Pcvar_tBlue)) // b /*
write_byte(500) // brightness
message_end()
set_pev(entity, pev_flTimeStepSound, 1111)
}
}
fov_explode(ent)
{
static Float:originF[3]
pev(ent, pev_origin, originF)
create_blast(originF)
static attacker
attacker = pev(ent, pev_owner)
static victim
victim = -1
new Tvictim = get_user_team(victim)
new Tattacker = get_user_team(attacker)
while ((victim = engfunc(EngFunc_FindEntityInSphere, victim, originF, 240.0)) != 0)
{
if(Tattacker == 1 || Tattacker == 2) // is attacker team ct or t
{
if(Tvictim == 1 || Tvictim == 2) // is victim team ct or t
{
message_begin( MSG_ONE, gmsg_SetFOV, { 0, 0, 0 }, victim) // Drugs
write_byte( 180 )
message_end( )
}
}
}
engfunc(EngFunc_RemoveEntity, ent)
}
create_blast(const Float:originF[3])
{
new r = get_pcvar_num(Pcvar_bRed)
new g = get_pcvar_num(Pcvar_bGreen)
new b = get_pcvar_num(Pcvar_bBlue)
// Smallest ring
engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, originF, 0)
write_byte(TE_BEAMCYLINDER) // TE id
engfunc(EngFunc_WriteCoord, originF[0]) // x
engfunc(EngFunc_WriteCoord, originF[1]) // y
engfunc(EngFunc_WriteCoord, originF[2]) // z
engfunc(EngFunc_WriteCoord, originF[0]) // x axis
engfunc(EngFunc_WriteCoord, originF[1]) // y axis
engfunc(EngFunc_WriteCoord, originF[2]+385.0) // z axis
write_short(g_exploSpr) // sprite
write_byte(0) // startframe
write_byte(0) // framerate
write_byte(4) // life
write_byte(60) // width
write_byte(0) // noise
write_byte(r) // red
write_byte(g) // green
write_byte(b) // blue
write_byte(200) // brightness
write_byte(0) // speed
message_end()
// Medium ring
engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, originF, 0)
write_byte(TE_BEAMCYLINDER) // TE id
engfunc(EngFunc_WriteCoord, originF[0]) // x
engfunc(EngFunc_WriteCoord, originF[1]) // y
engfunc(EngFunc_WriteCoord, originF[2]) // z
engfunc(EngFunc_WriteCoord, originF[0]) // x axis
engfunc(EngFunc_WriteCoord, originF[1]) // y axis
engfunc(EngFunc_WriteCoord, originF[2]+470.0) // z axis
write_short(g_exploSpr) // sprite
write_byte(0) // startframe
write_byte(0) // framerate
write_byte(4) // life
write_byte(60) // width
write_byte(0) // noise
write_byte(r) // red
write_byte(g) // green
write_byte(b) // blue
write_byte(200) // brightness
write_byte(0) // speed
message_end()
// Largest ring
engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, originF, 0)
write_byte(TE_BEAMCYLINDER) // TE id
engfunc(EngFunc_WriteCoord, originF[0]) // x
engfunc(EngFunc_WriteCoord, originF[1]) // y
engfunc(EngFunc_WriteCoord, originF[2]) // z
engfunc(EngFunc_WriteCoord, originF[0]) // x axis
engfunc(EngFunc_WriteCoord, originF[1]) // y axis
engfunc(EngFunc_WriteCoord, originF[2]+555.0) // z axis
write_short(g_exploSpr) // sprite
write_byte(0) // startframe
write_byte(0) // framerate
write_byte(4) // life
write_byte(60) // width
write_byte(0) // noise
write_byte(r) // red
write_byte(g) // green
write_byte(b) // blue
write_byte(200) // brightness
write_byte(0) // speed
message_end()
}
Last edited by HundredEyes; 12-05-2022 at 16:47.
|
|