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

Solved Deleting entities without crashing server


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Naleksuh
Member
Join Date: Dec 2018
Old 04-11-2020 , 19:47   Deleting entities without crashing server
Reply With Quote #1

Hello. I attempt to delete all of a certain entity from a map, with something like this:

Code:
public void OnEntityCreated(int entity, const char[] classname){
  if(StrEqual(classname, "trigger_capture_area")){
    RemoveEntity(entity);
  }
}
However, when a server's map changes, this code is very likely to cause the server to crash during the map change. I have tried countless variations including round start, accepting Kill input, server commands, timer-based, and more. There seems to be no way to do this without risking a server crash (while having zero problems without this plugin).

Is there any good way to accomplish this?

Last edited by Naleksuh; 04-12-2020 at 20:26.
Naleksuh is offline
Lux
Veteran Member
Join Date: Jan 2015
Location: Cat
Old 04-11-2020 , 20:00   Re: Deleting entities without crashing server
Reply With Quote #2

Use a SDKHook, SDKHook_SpawnPost, SDKHook_Spawn or RequestFrame hook, this is what i had to do.

Stripper is likely safe since it never spawns if you filter it away.
https://forums.alliedmods.net/showthread.php?t=39439
__________________
Connect
My Plugins: KlickME
[My GitHub]

Commission me for L4D
Lux is offline
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 04-11-2020 , 22:49   Re: Deleting entities without crashing server
Reply With Quote #3

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

AcceptEntityInput "kill"
__________________
Do not Private Message @me
Bacardi is offline
Lux
Veteran Member
Join Date: Jan 2015
Location: Cat
Old 04-12-2020 , 00:28   Re: Deleting entities without crashing server
Reply With Quote #4

Quote:
Originally Posted by Bacardi View Post
That thread you linked is about RemoveEdict().

AcceptEntityInput("Kill") and RemoveEntity() are the same.
__________________
Connect
My Plugins: KlickME
[My GitHub]

Commission me for L4D
Lux is offline
Naleksuh
Member
Join Date: Dec 2018
Old 04-12-2020 , 01:09   Re: Deleting entities without crashing server
Reply With Quote #5

Quote:
Originally Posted by Lux View Post
That thread you linked is about RemoveEdict().

AcceptEntityInput("Kill") and RemoveEntity() are the same.
Not to mention that I specifically said I tried and that didn't work in the first post.

Anyway, your SDKHook_SpawnPost or whatever did work, so thanks for that.
Naleksuh is offline
Lux
Veteran Member
Join Date: Jan 2015
Location: Cat
Old 04-12-2020 , 15:13   Re: Deleting entities without crashing server
Reply With Quote #6

Quote:
Originally Posted by Naleksuh View Post
Not to mention that I specifically said I tried and that didn't work in the first post.

Anyway, your SDKHook_SpawnPost or whatever did work, so thanks for that.
Nice to hear, besure you mark the topic as solved so others having same problem can find it.
__________________
Connect
My Plugins: KlickME
[My GitHub]

Commission me for L4D
Lux 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 14:43.


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