Added ability to disable automatic respawn

Prepare for client side scripting.
This commit is contained in:
Sardelka
2022-05-31 02:16:12 -08:00
parent a33f839004
commit b863b7037a
8 changed files with 67 additions and 21 deletions

View File

@ -21,8 +21,7 @@ namespace RageCoop.Client
{
private bool _gameLoaded = false;
private static bool _isGoingToCar = false;
private bool _lastDead = false;
public static readonly string CurrentVersion = "V0_3";
public static int LocalPlayerID=0;
@ -108,11 +107,6 @@ namespace RageCoop.Client
CoopMenu.MenuPool.Process();
#endif
if (_isGoingToCar && Game.Player.Character.IsInVehicle())
{
_isGoingToCar = false;
}
DoQueuedActions();
if (!Networking.IsOnServer)
{
@ -162,9 +156,32 @@ namespace RageCoop.Client
MainChat.Tick();
PlayerList.Tick();
if (Settings.DisableAutoRespawn)
{
Function.Call(Hash.PAUSE_DEATH_ARREST_RESTART, true);
Function.Call(Hash.FORCE_GAME_STATE_PLAYING);
var P = Game.Player.Character;
if (P.IsDead)
{
Function.Call(Hash.TERMINATE_ALL_SCRIPTS_WITH_THIS_NAME, "respawn_controller");
Function.Call(Hash.SET_FADE_OUT_AFTER_DEATH, false);
if (P.Health!=1)
{
P.Health=1;
Game.Player.WantedLevel=0;
Main.Logger.Debug("Player died.");
}
GTA.UI.Screen.StopEffects();
}
else
{
Function.Call(Hash.DISPLAY_HUD, true);
}
_lastDead=P.IsDead;
}
Ticked++;
}