Change Order of events on Death.cs
This commit is contained in:
@@ -113,6 +113,33 @@ namespace ReallifeGamemode.Server.Events
|
||||
};
|
||||
dbContext.DeathLogs.Add(dead);
|
||||
|
||||
player.ClearAnimation();
|
||||
player.ClearAttachments();
|
||||
List<UserItem> fItem = dbContext.UserItems.Where(u => u.UserId == user.Id).ToList();
|
||||
foreach (var item in fItem)
|
||||
{
|
||||
IItem iItem = InventoryManager.GetItemById(item.ItemId);
|
||||
if (iItem is IWeaponDealItem obj)
|
||||
{
|
||||
int amount = item.Amount;
|
||||
|
||||
Vector3 dropPosition = PlayerExtension.GetPositionFromPlayer(player, 0.6f, 0);
|
||||
//new Vector3(player.Position.X, player.Position.Y, player.Position.Z - 0.8f);
|
||||
Random r = new Random();
|
||||
GTANetworkAPI.Object grndObject;
|
||||
Vector3 textPos = dropPosition;
|
||||
|
||||
dropPosition.Z -= 1.05f;
|
||||
grndObject = NAPI.Object.CreateObject(3666746839, dropPosition, new Vector3(0, 0, r.Next(0, 360)), 255, 0);
|
||||
|
||||
GroundItem grndItem = new GroundItem { ItemId = iItem.Id, Amount = amount, Position = dropPosition };
|
||||
TextLabel grndTxtLbl = NAPI.TextLabel.CreateTextLabel(iItem.Name + " ~s~(~y~" + amount + "~s~)", textPos, 5, 0.5f, 4, new Color(255, 255, 255), false, 0);
|
||||
GroundItem.AddGroundItem(grndItem, grndObject, grndTxtLbl);
|
||||
|
||||
dbContext.Remove(item);
|
||||
}
|
||||
}
|
||||
|
||||
bool copNearby = NAPI.Pools.GetAllPlayers().Any(u => u.IsDuty() && u.IsAlive() && u.Position.DistanceToSquared(player.Position) <= 100 * 100);
|
||||
|
||||
if (user.Wanteds > 0 && player.HasData("GotInsideOfTurf") && !player.GetData<bool>("GotInsideOfTurf"))
|
||||
@@ -165,83 +192,32 @@ namespace ReallifeGamemode.Server.Events
|
||||
}
|
||||
|
||||
//TODO PICTURE NOTIFICATION + SOUND für Medics
|
||||
|
||||
player.ClearAttachments();
|
||||
List<UserItem> fItem = dbContext.UserItems.Where(u => u.UserId == user.Id).ToList();
|
||||
foreach (var item in fItem)
|
||||
{
|
||||
IItem iItem = InventoryManager.GetItemById(item.ItemId);
|
||||
if (iItem is IWeaponDealItem obj)
|
||||
{
|
||||
int amount = item.Amount;
|
||||
|
||||
Vector3 dropPosition = PlayerExtension.GetPositionFromPlayer(player, 0.6f, 0);
|
||||
//new Vector3(player.Position.X, player.Position.Y, player.Position.Z - 0.8f);
|
||||
Random r = new Random();
|
||||
GTANetworkAPI.Object grndObject;
|
||||
Vector3 textPos = dropPosition;
|
||||
|
||||
dropPosition.Z -= 1.05f;
|
||||
grndObject = NAPI.Object.CreateObject(3666746839, dropPosition, new Vector3(0, 0, r.Next(0, 360)), 255, 0);
|
||||
|
||||
GroundItem grndItem = new GroundItem { ItemId = iItem.Id, Amount = amount, Position = dropPosition };
|
||||
TextLabel grndTxtLbl = NAPI.TextLabel.CreateTextLabel(iItem.Name + " ~s~(~y~" + amount + "~s~)", textPos, 5, 0.5f, 4, new Color(255, 255, 255), false, 0);
|
||||
GroundItem.AddGroundItem(grndItem, grndObject, grndTxtLbl);
|
||||
|
||||
player.ClearAnimation();
|
||||
|
||||
dbContext.Remove(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
Job.JobBase job = Managers.JobManager.GetJob(player.GetUser().JobId ?? -1);
|
||||
if (job != null)
|
||||
{
|
||||
//ChatService.SendMessage(player, "Debug1");
|
||||
if (job.GetUsersInJob().Contains(player))
|
||||
{
|
||||
//ChatService.SendMessage(player, "Debug2");
|
||||
if (player.Vehicle != null)
|
||||
{
|
||||
//ChatService.SendMessage(player, "Debug3");
|
||||
/*if (player.Vehicle.GetData<bool>("timerJobVehicleRespawn") == true)
|
||||
{*/
|
||||
if (player.Vehicle.GetServerVehicle() is JobVehicle vehJ)
|
||||
{
|
||||
//ChatService.SendMessage(player, "Debug4");
|
||||
player.Vehicle.ResetData("timerJobVehicleRespawn");
|
||||
ServerVehicle sVeh = Managers.VehicleManager.GetServerVehicleFromVehicle(player.Vehicle);
|
||||
ServerVehicleExtensions.Spawn(sVeh, player.Vehicle);
|
||||
}
|
||||
else
|
||||
{
|
||||
//ChatService.SendMessage(player, "Debug5");
|
||||
}
|
||||
//}
|
||||
}
|
||||
if (Managers.JobManager.playerTimersJobVehicleRespawn.ContainsKey(player))
|
||||
{
|
||||
//ChatService.SendMessage(player, "Debug6");
|
||||
Managers.JobManager.playerTimersJobVehicleRespawn[player].Stop();
|
||||
}
|
||||
//ChatService.SendMessage(player, "Debug7");
|
||||
player.ResetData("PilotenBase");
|
||||
job.StopJob(player);
|
||||
ChatService.SendMessage(player, $"~y~[JOB]~s~ Du hast deinen Job ~o~{job.Name}~s~ beendet.");
|
||||
if (player.GetData<bool>("HatRoute") == true)
|
||||
{
|
||||
//ChatService.SendMessage(player, "Debug8");
|
||||
CheckPointHandle.DeleteCheckpoints(player);
|
||||
player.ResetData("HatRoute");
|
||||
}
|
||||
else
|
||||
{
|
||||
//ChatService.SendMessage(player, "Debug9");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//ChatService.SendMessage(player, "Debug10");
|
||||
}
|
||||
}
|
||||
dbContext.SaveChanges();
|
||||
|
||||
Reference in New Issue
Block a user