Raised This Month: $ Target: $400
 0% 

Solved Remove smoke from HE Grenade (Black Smoke)


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
ChillerX
Member
Join Date: Dec 2022
Old 01-11-2023 , 14:26   Remove smoke from HE Grenade (Black Smoke)
Reply With Quote #1

I am looking to remove the black smoke from HE grenade explosion.
If possible also remove the sound from explosion and a toggle so players can turn the plugin on and off.

If it can be added to this plugin that would be great:

https://forums.alliedmods.net/showthread.php?t=204759

If all of this is too hard then a simpler plugin for just the black smoke (uncache sprite) is ok too.

Thanks in advance

Last edited by ChillerX; 01-16-2023 at 12:02. Reason: Solved
ChillerX is offline
shayan123
BANNED
Join Date: Oct 2020
Location: GB
Old 01-13-2023 , 12:07   Re: Remove smoke from HE Grenade
Reply With Quote #2

Removing the black smoke from the HE grenade explosion can be done by uncaching the sprite that is used for the smoke effect. This can be done by calling the "precache_model" function with the path of the sprite, and then passing the "PRECACHE_MODEL_UNLOAD" flag to the "precache_model" function.

To remove the sound from the explosion, you can use the "engfunc(EngFunc_PrecacheEvent, index, soundfile)" function to precache the sound, and then use the "engfunc(EngFunc_KillEvents, index)" function to stop the sound from playing.

To add a toggle for players to turn the plugin on and off, you can create a cvar using the "register_cvar" function and then check the value of the cvar in your plugin code to determine whether or not to run the code for removing the smoke and sound.

To integrate this feature with the plugin you provided, you can add the code to remove the smoke and sound in the "pfn_Explode" function, where it checks the entity classname. If the classname is "hegrenade", it would run the code to remove the smoke and sound.

It's important to note that, changing the behavior of the game in this way may affect the gameplay and it's important to test the plugin before deploying it to a production environment, also it's important to note that some servers may not allow the use of plugins that alter the standard game behavior.
shayan123 is offline
Send a message via ICQ to shayan123 Send a message via AIM to shayan123 Send a message via Yahoo to shayan123 Send a message via Skype™ to shayan123
Siska1
Senior Member
Join Date: Feb 2020
Location: BedRock
Old 01-13-2023 , 17:09   Re: Remove smoke from HE Grenade
Reply With Quote #3

you can use unprecacher for a fraction of what you want
__________________
Siska1 is offline
Send a message via Skype™ to Siska1
deprale
Senior Member
Join Date: Oct 2018
Location: Leeds
Old 01-13-2023 , 18:16   Re: Remove smoke from HE Grenade
Reply With Quote #4

Quote:
Originally Posted by shayan123 View Post
Removing the black smoke from the HE grenade explosion can be done by uncaching the sprite that is used for the smoke effect. This can be done by calling the "precache_model" function with the path of the sprite, and then passing the "PRECACHE_MODEL_UNLOAD" flag to the "precache_model" function.

To remove the sound from the explosion, you can use the "engfunc(EngFunc_PrecacheEvent, index, soundfile)" function to precache the sound, and then use the "engfunc(EngFunc_KillEvents, index)" function to stop the sound from playing.

To add a toggle for players to turn the plugin on and off, you can create a cvar using the "register_cvar" function and then check the value of the cvar in your plugin code to determine whether or not to run the code for removing the smoke and sound.

To integrate this feature with the plugin you provided, you can add the code to remove the smoke and sound in the "pfn_Explode" function, where it checks the entity classname. If the classname is "hegrenade", it would run the code to remove the smoke and sound.

It's important to note that, changing the behavior of the game in this way may affect the gameplay and it's important to test the plugin before deploying it to a production environment, also it's important to note that some servers may not allow the use of plugins that alter the standard game behavior.


Bro just asked chatgpt and copy pasted the answer 💀💀💀
__________________
deprale is offline
ChillerX
Member
Join Date: Dec 2022
Old 01-13-2023 , 21:56   Re: Remove smoke from HE Grenade
Reply With Quote #5

Gotta see the positive side—free bump LD
ChillerX is offline
Th3822
Member
Join Date: Jan 2013
Location: Venezuela
Old 01-14-2023 , 16:00   Re: Remove smoke from HE Grenade
Reply With Quote #6

with reapi it's easy, hook RG_CGrenade_ExplodeHeGrenade as Post, then delete the grenade (you may need to clear the pfnThink of the grenade, it's doable with set_ent_data)
Th3822 is offline
ChillerX
Member
Join Date: Dec 2022
Old 01-15-2023 , 15:23   Re: Remove smoke from HE Grenade
Reply With Quote #7

Quote:
Originally Posted by Th3822 View Post
with reapi it's easy, hook RG_CGrenade_ExplodeHeGrenade as Post, then delete the grenade (you may need to clear the pfnThink of the grenade, it's doable with set_ent_data)
I am still quite unexperienced with pawn, would you mind writing that code for me?

I am pretty sure this would be a helpful plugin that will slightly reduce fps drops in cs 1.6 csdm and similar DM servers. Especially for players with older pc`s which are actually the majority still playing it.

Thanks in advance.
ChillerX is offline
Th3822
Member
Join Date: Jan 2013
Location: Venezuela
Old 01-15-2023 , 15:25   Re: Remove smoke from HE Grenade
Reply With Quote #8

Quote:
Originally Posted by ChillerX View Post
I am still quite unexperienced with pawn, would you mind writing that code for me?

I am pretty sure this would be a helpful plugin that will slightly reduce fps drops in cs 1.6 csdm and similar DM servers. Especially for players with older pc`s which are actually the majority still playing it.

Thanks in advance.
PHP Code:
#include <amxmodx>
#include <fakemeta>
#include <reapi>

public plugin_init()
{
    
register_plugin("No HE Smoke""0.1""Th3-822");
    
RegisterHookChain(RG_CGrenade_ExplodeHeGrenade"HE_Exploded"1);
}

public 
HE_Exploded(iEnt)
{
    
// Remove "smoke & remove" think
    
set_ent_data(iEnt"CBaseEntity""m_pfnThink"0);
    
// Remove grenade (yes, there are "better" methods to do this, but i'm lazy to add more lines)
    
engfunc(EngFunc_RemoveEntityiEnt);

Th3822 is offline
deprale
Senior Member
Join Date: Oct 2018
Location: Leeds
Old 01-15-2023 , 20:40   Re: Remove smoke from HE Grenade
Reply With Quote #9

Quote:
Originally Posted by Th3822 View Post
PHP Code:
#include <amxmodx>
#include <fakemeta>
#include <reapi>

public plugin_init()
{
    
register_plugin("No HE Smoke""0.1""Th3-822");
    
RegisterHookChain(RG_CGrenade_ExplodeHeGrenade"HE_Exploded"1);
}

public 
HE_Exploded(iEnt)
{
    
// Remove "smoke & remove" think
    
set_ent_data(iEnt"CBaseEntity""m_pfnThink"0);
    
// Remove grenade (yes, there are "better" methods to do this, but i'm lazy to add more lines)
    
engfunc(EngFunc_RemoveEntityiEnt);

This is actually sort of a really good thought process, I would have never thought of doing it this way lol.
I would have just unprecached black_smoke1,2,3,4.spr, but idk if its also used in clientside.
__________________
deprale is offline
Th3822
Member
Join Date: Jan 2013
Location: Venezuela
Old 01-15-2023 , 20:43   Re: Remove smoke from HE Grenade
Reply With Quote #10

Quote:
Originally Posted by deprale View Post
This is actually sort of a really good thought process, I would have never thought of doing it this way lol.
I would have just unprecached black_smoke1,2,3,4.spr, but idk if its also used in clientside.
just did a quick search on regamedll for the grenade and the explosion (regame has hooks for almost everything, but those are kinda new, they weren't in my old .inc) and found that the smoke was added totally after the explosion function and it was hookable
Th3822 is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 20:58.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode