population_control: Fix the common limit crashing server

(I mean it did limit the commons...)
This commit is contained in:
Jackzie 2021-05-11 00:38:00 -05:00
parent 2e7715e72f
commit 761a21c22e
No known key found for this signature in database
GPG key ID: 1E834FE36520537A
2 changed files with 6 additions and 2 deletions

Binary file not shown.

View file

@ -7,7 +7,7 @@
#include <sourcemod> #include <sourcemod>
#include <sdktools> #include <sdktools>
//#include <sdkhooks> #include <sdkhooks>
public Plugin myinfo = public Plugin myinfo =
{ {
@ -113,7 +113,7 @@ public void OnEntityCreated(int entity, const char[] classname) {
//If limiter turned on: //If limiter turned on:
if(commonLimit != 0) { if(commonLimit != 0) {
if(iCurrentCommons > commonLimit) { if(iCurrentCommons > commonLimit) {
AcceptEntityInput(entity, "kill"); SDKHook(entity, SDKHook_SpawnPost, Hook_SpawnPost);
return; return;
} }
} }
@ -140,6 +140,10 @@ public void OnEntityCreated(int entity, const char[] classname) {
} }
} }
public Action Hook_SpawnPost(int entity) {
AcceptEntityInput(entity, "Kill");
}
public Action Event_InfectedDeath(Event event, const char[] name, bool dontBroadcast) { public Action Event_InfectedDeath(Event event, const char[] name, bool dontBroadcast) {
--iCurrentCommons; --iCurrentCommons;
} }