forked from zonde306/l4d2sc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathedict_overflow_prevention.sp
47 lines (39 loc) · 1.19 KB
/
edict_overflow_prevention.sp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
/****************************************************************************************************
[ANY] EDICT OVERFLOW PREVENTION
*****************************************************************************************************/
#define PLUGIN_VERSION "2.9"
#include <sdktools>
#include <sdkhooks>
#pragma semicolon 1
#pragma newdecls required
public Plugin myinfo =
{
name = "实体字典溢出保护",
author = "SM9 (xCoderx)",
version = PLUGIN_VERSION,
url = "www.fragdeluxe.com"
};
public void OnPluginStart() {
CreateConVar("eop_version", PLUGIN_VERSION, "Edict Overflow Prevention", FCVAR_SPONLY|FCVAR_DONTRECORD|FCVAR_NOTIFY);
}
public void OnGameFrame()
{
for (int iEntity = 2044; iEntity <= 2048; iEntity++) {
if (!IsValidEntity(iEntity) || !IsValidEdict(iEntity)) {
continue;
}
AcceptEntityInput(iEntity, "Kill");
}
}
public void OnEntityCreated(int iEntity)
{
if(iEntity >= 2044) {
SDKHookEx(iEntity, SDKHook_Spawn, OnEntitySpawn);
}
}
public Action OnEntitySpawn(int iEntity) {
// AcceptEntityInput(iEntity, "Kill");
if(IsValidEntity(iEntity) && IsValidEdict(iEntity))
RemoveEntity(iEntity);
return Plugin_Handled;
}