Raised This Month: $12 Target: $400
 3% 

Solved Removing Grenade Entity Before Explosion


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
hellmonja
Senior Member
Join Date: Oct 2015
Old 04-15-2022 , 14:16   Removing Grenade Entity Before Explosion
Reply With Quote #1

Is there any known bug with removing a grenade entity multiple times before it explodes, like making the game crash or something?

I'm working on this plugin where you can throw a camera like a grenade for recon. I take a smokegrenade and right before it detonates I remove it and place an entity there that acts as the camera and I see what it sees.

About several minutes into the game it sometimes crashes for no apparent reason. I was either shooting a bot or just walking around minutes away from the last cam I threw. I'm not sure which part is the problem since it doesn't create a log, only a minidump that I can't read. And my best bet is the removal of grenade entities. Anyone have relevant information would be much appreciated...
__________________

Last edited by hellmonja; 04-15-2022 at 15:44. Reason: Solved...
hellmonja is offline
Craxor
Veteran Member
Join Date: Jan 2016
Location: Romania
Old 04-15-2022 , 14:19   Re: Removing Grenade Entity Before Explosion
Reply With Quote #2

1. Don't you have log errors?
2. Search in my thread "help with okapi" ive maded something similar .
__________________
Project: Among Us

Last edited by Craxor; 04-15-2022 at 14:19.
Craxor is offline
Send a message via ICQ to Craxor
hellmonja
Senior Member
Join Date: Oct 2015
Old 04-15-2022 , 14:27   Re: Removing Grenade Entity Before Explosion
Reply With Quote #3

Quote:
Originally Posted by Craxor View Post
1. Don't you have log errors?
As I've said it only creates a minidump. No error logs...

I see how the thread can be related. But I only asked if anyone had an idea if removing grenades would cause the game to crash. The thing is 90% complete and I'm not too keen in converting the whole of it to Okapi. But you gave me an idea. I found the approved Teleport Nade plugin here and will try to emulate that instead, thank you...
__________________

Last edited by hellmonja; 04-15-2022 at 15:27.
hellmonja is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 04-15-2022 , 14:54   Re: Removing Grenade Entity Before Explosion
Reply With Quote #4

Show the code.
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !

Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
hellmonja
Senior Member
Join Date: Oct 2015
Old 04-15-2022 , 15:33   Re: Removing Grenade Entity Before Explosion
Reply With Quote #5

Quote:
Originally Posted by Natsheh View Post
Show the code.
Sorry. Not that I don't want to share, but the thing in embedded into a larger plugin. And I know you would like to have the whole thing but I doubt anyone would take the time to sift thru it.

I know, it seems dumb, asking for help without posting code. But I only asked if anyone had any idea if this would make the game crash. Nevertheless, Craxor gave me an idea for a possible solution so I think we're all good.

PS: If you're wondering about my code, the gist is it's hooked on FM_SetModel. Inside there's a timed task that removes the grenade entity with remove_entity(). And the timer is set a few milliseconds before detonation. I've also made liberal use of pev_valid...
__________________
hellmonja is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 04-15-2022 , 19:22   Re: Removing Grenade Entity Before Explosion
Reply With Quote #6

Alright, a solution don't use remove_entity, use instead the other method which is by setting an entity flags to FL_KILLME then call entity think, its more reliable safer way !
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !

Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
hellmonja
Senior Member
Join Date: Oct 2015
Old 04-16-2022 , 08:24   Re: Removing Grenade Entity Before Explosion
Reply With Quote #7

Quote:
Originally Posted by Natsheh View Post
Alright, a solution don't use remove_entity, use instead the other method which is by setting an entity flags to FL_KILLME then call entity think, its more reliable safer way !
That's definitely good to know, thanks. I'm familiar with FL_KILLME but it never worked for me. Probably because I'm unfamiliar with calling entity think and didn't know you had to do that.

I made this stock. Did I do it properly?...
PHP Code:
stock kill_entity(ent)
{
    
set_pev(entpev_flagspev(entpev_flags) | FL_KILLME);
    
set_pev(entpev_nextthinkget_gametime() + 0.01);
    
dllfunc(DLLFunc_Thinkent);

__________________
hellmonja is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 04-16-2022 , 13:04   Re: Removing Grenade Entity Before Explosion
Reply With Quote #8

Yes, but you don't need to set up next think

So basically remove this...

Code:
set_pev(ent, pev_nextthink, get_gametime() + 0.01);
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !


Last edited by Natsheh; 04-16-2022 at 13:05.
Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
hellmonja
Senior Member
Join Date: Oct 2015
Old 04-17-2022 , 02:23   Re: Removing Grenade Entity Before Explosion
Reply With Quote #9

Quote:
Originally Posted by Natsheh View Post
So basically remove this...

Code:
set_pev(ent, pev_nextthink, get_gametime() + 0.01);
Roger that. It's working now but I haven't had time to do an extensive so I don't know yet if it fixed the crashing. If it still does it's probably other stuff that's causing it. But it's good to know, I'll be using FL_KILLME instead remove_entity from now on, thank you very much!...
__________________
hellmonja is offline
Reply


Thread Tools
Display Modes

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 17:42.


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