mirror of
https://github.com/VCMP-SqMod/SqMod.git
synced 2024-11-08 00:37:15 +01:00
Also prevent the player entity instance from being destroyed in mid-destruction.
This commit is contained in:
parent
b877b1701b
commit
f5ec4e65ce
@ -1562,12 +1562,21 @@ void Core::DisconnectPlayer(Int32 id, Int32 header, Object & payload)
|
||||
// Retrieve the specified entity instance
|
||||
PlayerInst & inst = m_Players[id];
|
||||
// Make sure that the instance is even allocated
|
||||
if (INVALID_ENTITY(inst.mID))
|
||||
if (INVALID_ENTITY(inst.mID) || (inst.mFlags & ENF_LOCKED))
|
||||
{
|
||||
return; // Nothing to deallocate!
|
||||
}
|
||||
// Prevent further attempts to delete this entity
|
||||
const EntLockGuard elg(inst.mFlags);
|
||||
// Let the script callbacks know this entity should no longer be used
|
||||
EmitPlayerDestroyed(id, header, payload);
|
||||
try
|
||||
{
|
||||
EmitPlayerDestroyed(id, header, payload);
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
// The error was probably dealt with already
|
||||
}
|
||||
// Is there a manager instance associated with this entity?
|
||||
if (inst.mInst)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user