Extend Death System; Add Revive-System
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user