AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting (https://forums.alliedmods.net/forumdisplay.php?f=107)
-   -   Solved Deleting entities without crashing server (https://forums.alliedmods.net/showthread.php?t=323082)

Naleksuh 04-11-2020 19:47

Deleting entities without crashing server
 
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?

Lux 04-11-2020 20:00

Re: Deleting entities without crashing server
 
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

Bacardi 04-11-2020 22:49

Re: Deleting entities without crashing server
 
https://forums.alliedmods.net/showthread.php?t=191444

AcceptEntityInput "kill"

Lux 04-12-2020 00:28

Re: Deleting entities without crashing server
 
Quote:

Originally Posted by Bacardi (Post 2692644)

That thread you linked is about RemoveEdict().

AcceptEntityInput("Kill") and RemoveEntity() are the same.

Naleksuh 04-12-2020 01:09

Re: Deleting entities without crashing server
 
Quote:

Originally Posted by Lux (Post 2692670)
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.

Lux 04-12-2020 15:13

Re: Deleting entities without crashing server
 
Quote:

Originally Posted by Naleksuh (Post 2692674)
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.


All times are GMT -4. The time now is 11:48.

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