mirror of
https://github.com/thegeneralist01/Scene-Manager-DevRepo
synced 2026-01-11 15:40:29 +01:00
Added new DismissOption enum for when a player enters a collected vehicle. Added null checking when deleting nearby vehicle from world.
This commit is contained in:
parent
822725ae2d
commit
5d1a17ed1f
1 changed files with 7 additions and 5 deletions
|
|
@ -13,7 +13,8 @@ namespace SceneManager
|
|||
FromPath = 0,
|
||||
FromWaypoint = 1,
|
||||
FromWorld = 2,
|
||||
FromDirect = 3
|
||||
FromDirect = 3,
|
||||
FromPlayer = 4
|
||||
}
|
||||
|
||||
static class PathMainMenu
|
||||
|
|
@ -296,17 +297,18 @@ namespace SceneManager
|
|||
else if(dismissDriver.Index == (int)DismissOption.FromWorld)
|
||||
{
|
||||
Game.LogTrivial($"Dismissed {nearbyVehicle.Model.Name} from the world");
|
||||
while (nearbyVehicle.HasOccupants)
|
||||
while (nearbyVehicle && nearbyVehicle.HasOccupants)
|
||||
{
|
||||
foreach (Ped occupant in nearbyVehicle.Occupants)
|
||||
{
|
||||
occupant.Dismiss();
|
||||
occupant.Delete();
|
||||
}
|
||||
GameFiber.Yield();
|
||||
}
|
||||
|
||||
nearbyVehicle.Delete();
|
||||
if (nearbyVehicle)
|
||||
{
|
||||
nearbyVehicle.Delete();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue