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

View file

@ -7,7 +7,7 @@
#include <sourcemod>
#include <sdktools>
//#include <sdkhooks>
#include <sdkhooks>
public Plugin myinfo =
{
@ -113,7 +113,7 @@ public void OnEntityCreated(int entity, const char[] classname) {
//If limiter turned on:
if(commonLimit != 0) {
if(iCurrentCommons > commonLimit) {
AcceptEntityInput(entity, "kill");
SDKHook(entity, SDKHook_SpawnPost, Hook_SpawnPost);
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) {
--iCurrentCommons;
}