From 789e8d4bf35ee024204680b44ad32b466eb567e7 Mon Sep 17 00:00:00 2001 From: jenz Date: Sun, 11 Aug 2024 18:40:15 +0200 Subject: [PATCH] upload of the temporary solution for the missing forward --- OnEntitySpawned/scripting/OnEntitySpawned.sp | 56 ++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 OnEntitySpawned/scripting/OnEntitySpawned.sp diff --git a/OnEntitySpawned/scripting/OnEntitySpawned.sp b/OnEntitySpawned/scripting/OnEntitySpawned.sp new file mode 100644 index 00000000..190db402 --- /dev/null +++ b/OnEntitySpawned/scripting/OnEntitySpawned.sp @@ -0,0 +1,56 @@ +#pragma semicolon 1 +#pragma newdecls required + +#include +#include + +/* FORWARDS */ +GlobalForward g_hFwd_OnEntitySpawned; + +//---------------------------------------------------------------------------------------------------- +// Purpose: +//---------------------------------------------------------------------------------------------------- +public Plugin myinfo = +{ + name = "OnEntitySpawned Forward", + author = "zaCade", + description = "Temporary plugin to create OnEntitySpawned", + version = "1.0" +}; + +//---------------------------------------------------------------------------------------------------- +// Purpose: +//---------------------------------------------------------------------------------------------------- +public void OnPluginStart() +{ + g_hFwd_OnEntitySpawned = new GlobalForward("OnEntitySpawned", ET_Ignore, Param_Cell, Param_String); +} + +//---------------------------------------------------------------------------------------------------- +// Purpose: +//---------------------------------------------------------------------------------------------------- +public void OnEntityCreated(int entity, const char[] classname) +{ + if (!IsValidEntity(entity)) + return; + + SDKHook(entity, SDKHook_SpawnPost, SDKHook_OnEntitySpawnPost); +} + +//---------------------------------------------------------------------------------------------------- +// Purpose: +//---------------------------------------------------------------------------------------------------- +public void SDKHook_OnEntitySpawnPost(int entity) +{ + if (!IsValidEntity(entity)) + return; + + char classname[64]; + if (!GetEntityClassname(entity, classname, sizeof(classname))) + return; + + Call_StartForward(g_hFwd_OnEntitySpawned); + Call_PushCell(entity); + Call_PushString(classname); + Call_Finish(); +} \ No newline at end of file