upload of the temporary solution for the missing forward
This commit is contained in:
parent
a296dd400c
commit
789e8d4bf3
56
OnEntitySpawned/scripting/OnEntitySpawned.sp
Normal file
56
OnEntitySpawned/scripting/OnEntitySpawned.sp
Normal file
@ -0,0 +1,56 @@
|
||||
#pragma semicolon 1
|
||||
#pragma newdecls required
|
||||
|
||||
#include <sourcemod>
|
||||
#include <sdkhooks>
|
||||
|
||||
/* 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();
|
||||
}
|
Loading…
Reference in New Issue
Block a user