mirror of
https://github.com/VCMP-SqMod/SqMod.git
synced 2025-01-19 03:57:14 +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
|
// Retrieve the specified entity instance
|
||||||
PlayerInst & inst = m_Players[id];
|
PlayerInst & inst = m_Players[id];
|
||||||
// Make sure that the instance is even allocated
|
// 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!
|
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
|
// Let the script callbacks know this entity should no longer be used
|
||||||
|
try
|
||||||
|
{
|
||||||
EmitPlayerDestroyed(id, header, payload);
|
EmitPlayerDestroyed(id, header, payload);
|
||||||
|
}
|
||||||
|
catch (...)
|
||||||
|
{
|
||||||
|
// The error was probably dealt with already
|
||||||
|
}
|
||||||
// Is there a manager instance associated with this entity?
|
// Is there a manager instance associated with this entity?
|
||||||
if (inst.mInst)
|
if (inst.mInst)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user