Skip to content

Commit

Permalink
Merge pull request #390 from zer0k-z/onentitycreated-optimize
Browse files Browse the repository at this point in the history
Reduce lag spikes upon player spawn
  • Loading branch information
zealain authored Oct 23, 2022
2 parents a3745f7 + b719918 commit bba9eef
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions addons/sourcemod/scripting/gokz-core.sp
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,13 @@ public Action OnNormalSound(int clients[MAXPLAYERS], int &numClients, char sampl

public void OnEntityCreated(int entity, const char[] classname)
{
// Don't react to player related entities
if (StrEqual(classname, "predicted_viewmodel") || StrEqual(classname, "item_assaultsuit")
|| StrEqual(classname, "cs_bot") || StrEqual(classname, "player")
|| StrContains(classname, "weapon") != -1)
{
return;
}
SDKHook(entity, SDKHook_Spawn, OnEntitySpawned);
SDKHook(entity, SDKHook_SpawnPost, OnEntitySpawnedPost);
OnEntityCreated_Triggerfix(entity, classname);
Expand Down

0 comments on commit bba9eef

Please sign in to comment.