Extend Death System; Add Revive-System

This commit is contained in:
VegaZ
2018-10-21 21:31:31 +02:00
parent 614ec855e9
commit a1feadfd5d
6 changed files with 54 additions and 16 deletions

View File

@@ -47,6 +47,21 @@ namespace reallife_gamemode.Server.Events
return;
}
using (var loginUser = new DatabaseContext())
{
var user = loginUser.Users.SingleOrDefault(b => b.Name == player.Name);
if(user.Dead == true)
{
player.TriggerEvent("startDeathTimer");
player.SetData("isDead", true);
}
else
{
player.SetData("isDead", false);
}
}
player.SetData("isLoggedIn", false);
player.Position = new Vector3(-1883.736, -781.4911, -10);
player.FreezePosition = true;

View File

@@ -22,7 +22,7 @@ namespace reallife_gamemode.Server.Events
[ServerEvent(Event.PlayerDeath)]
public void OnPlayerDeath(Client player, Client killer, uint reason)
{
player.SetData("isDead", true);
player.TriggerEvent("startDeathTimer");
//TODO: Zum Full Release entfernen
@@ -65,14 +65,9 @@ namespace reallife_gamemode.Server.Events
[RemoteEvent("RespawnPlayerAtHospital")]
public void RespawnPlayerAtHospital(Client player)
{
player.SetData("isDead", false);
player.RemoveAllWeapons();
NAPI.Player.SpawnPlayer(player, new Vector3(-495.45, -336.33, 34.5));
}
[RemoteEvent("RespawnPlayerAtDeathpoint")]
public void RespawnPlayerAtDeathpoint(Client player)
{
NAPI.Player.SpawnPlayer(player, player.Position);
}
}
}

View File

@@ -46,6 +46,7 @@ namespace reallife_gamemode.Server.Events
user.PositionX = player.Position.X;
user.PositionY = player.Position.Y;
user.PositionZ = player.Position.Z;
user.Dead = player.GetData("isDead");
saveUser.SaveChanges();
}
}