#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(); }