public ISharedEntity GetEntityById(ushort id) { unsafe { CheckIfCallIsValid(); var type = (byte)BaseObjectType.Undefined; var entityPointer = Library.Shared.Core_GetEntityById(NativePointer, id, &type); if (entityPointer == IntPtr.Zero) { return(null); } switch (type) { case (byte)BaseObjectType.Player: return(PlayerPool.Get(entityPointer)); case (byte)BaseObjectType.Vehicle: return(VehiclePool.Get(entityPointer)); default: return(null); } } }