From cc7c7bfaab4c8068d8c73c2588cbf81bff0a96f5 Mon Sep 17 00:00:00 2001 From: hubdom <26039831+hubdom@users.noreply.github.com> Date: Wed, 2 Dec 2020 16:10:16 +0100 Subject: [PATCH] season_xmas: update to latest version --- season_xmas/scripting/season_xmas.sp | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/season_xmas/scripting/season_xmas.sp b/season_xmas/scripting/season_xmas.sp index 93d2c398..6d601cf9 100644 --- a/season_xmas/scripting/season_xmas.sp +++ b/season_xmas/scripting/season_xmas.sp @@ -827,10 +827,23 @@ public void OnEntitySpawned(int Entity, const char[] sClassname) if (g_iCollected[iOwner] < g_hCVar_MilestoneGrenade.IntValue) return; - SetEntityRenderMode(Entity, RENDER_NONE); + RequestFrame(PostNadeSpawn, EntIndexToEntRef(Entity)); +} + + +//---------------------------------------------------------------------------------------------------- +// Purpose: +//---------------------------------------------------------------------------------------------------- +public void PostNadeSpawn(int iEntRef) +{ + int iEntity = EntRefToEntIndex(iEntRef); + if (!IsValidEntity(iEntity)) + return; + + SetEntityRenderMode(iEntity, RENDER_NONE); float fNadeOrigin[3]; - GetEntPropVector(Entity, Prop_Send, "m_vecOrigin", fNadeOrigin); + GetEntPropVector(iEntity, Prop_Send, "m_vecOrigin", fNadeOrigin); int iNadeProp = CreateEntityAtOrigin("prop_dynamic_override", fNadeOrigin); DispatchKeyFormat(iNadeProp, "targetname", "season_nade_prop_%d", g_iCounter); @@ -870,7 +883,7 @@ public void OnEntitySpawned(int Entity, const char[] sClassname) } SpawnAndActivate(iNadeProp); - ParentToEntity(iNadeProp, Entity); + ParentToEntity(iNadeProp, iEntity); } //----------------------------------------------------------------------------------------------------