View Single Post
Marttt
Veteran Member
Join Date: Jan 2019
Location: Brazil
Old 03-16-2022 , 06:36   Re: [TUT] SourcePawn Scripting - Tips, Basics to Advanced
Reply With Quote #59

Follow this events order as example:

OnEntityCreated -> PostSpawn -> RequestFrame -> CreateTimer(timerReadEnt) -> EntityDestroyed > timerReadEnt

in timerReadEnt you will get an exception if you use the entity index cause it's gone (or replaced by another entity with the same index).

Storing the entity as EntRef allow you to post-check if that entityRef has an INVALID_REFERENCE (with EntRefToEntIndex) before using it.

The logic is the same as what happens to the player. (GetClientUserId)
__________________

Last edited by Marttt; 03-16-2022 at 06:37.
Marttt is offline