Handle respawn for paintball (don't use normal death respawn)

This commit is contained in:
Vortrex
2022-06-17 13:08:30 -05:00
parent f1affc2f8f
commit 90face486b

View File

@@ -402,53 +402,57 @@ function onPlayerDeath(client, position) {
fadeCamera(client, false, 1.0); fadeCamera(client, false, 1.0);
} }
setTimeout(function () { setTimeout(function () {
if (getPlayerCurrentSubAccount(client).inJail) { if (isPlayerInPaintBall(client)) {
let closestJail = getClosestPoliceStation(getPlayerPosition(client)); respawnPlayerForPaintBall(client);
despawnPlayer(client);
getPlayerCurrentSubAccount(client).interior = closestJail.interior;
getPlayerCurrentSubAccount(client).dimension = closestJail.dimension;
if (isPlayerWorking(client)) {
stopWorking(client);
}
if (getGame() == VRR_GAME_MAFIA_ONE) {
spawnPlayer(client, getGameConfig().skins[getGame()][getPlayerCurrentSubAccount(client).skin][0], closestJail.position, closestJail.heading);
} else {
spawnPlayer(client, closestJail.position, closestJail.heading, getGameConfig().skins[getGame()][getPlayerCurrentSubAccount(client).skin][0]);
}
if (isFadeCameraSupported()) {
fadeCamera(client, true, 1.0);
}
updatePlayerSpawnedState(client, true);
makePlayerStopAnimation(client);
setPlayerControlState(client, true);
resetPlayerBlip(client);
} else { } else {
let closestHospital = getClosestHospital(getPlayerPosition(client)); if (getPlayerCurrentSubAccount(client).inJail) {
despawnPlayer(client); let closestJail = getClosestPoliceStation(getPlayerPosition(client));
getPlayerCurrentSubAccount(client).interior = closestHospital.interior; despawnPlayer(client);
getPlayerCurrentSubAccount(client).dimension = closestHospital.dimension; getPlayerCurrentSubAccount(client).interior = closestJail.interior;
getPlayerCurrentSubAccount(client).dimension = closestJail.dimension;
if (isPlayerWorking(client)) { if (isPlayerWorking(client)) {
stopWorking(client); stopWorking(client);
} }
if (getGame() == VRR_GAME_MAFIA_ONE) { if (getGame() == VRR_GAME_MAFIA_ONE) {
spawnPlayer(client, getGameConfig().skins[getGame()][getPlayerCurrentSubAccount(client).skin][0], closestHospital.position, closestHospital.heading); spawnPlayer(client, getGameConfig().skins[getGame()][getPlayerCurrentSubAccount(client).skin][0], closestJail.position, closestJail.heading);
} else {
spawnPlayer(client, closestJail.position, closestJail.heading, getGameConfig().skins[getGame()][getPlayerCurrentSubAccount(client).skin][0]);
}
if (isFadeCameraSupported()) {
fadeCamera(client, true, 1.0);
}
updatePlayerSpawnedState(client, true);
makePlayerStopAnimation(client);
setPlayerControlState(client, true);
resetPlayerBlip(client);
} else { } else {
spawnPlayer(client, closestHospital.position, closestHospital.heading, getGameConfig().skins[getGame()][getPlayerCurrentSubAccount(client).skin][0]); let closestHospital = getClosestHospital(getPlayerPosition(client));
} despawnPlayer(client);
getPlayerCurrentSubAccount(client).interior = closestHospital.interior;
getPlayerCurrentSubAccount(client).dimension = closestHospital.dimension;
if (isFadeCameraSupported()) { if (isPlayerWorking(client)) {
fadeCamera(client, true, 1.0); stopWorking(client);
} }
updatePlayerSpawnedState(client, true); if (getGame() == VRR_GAME_MAFIA_ONE) {
makePlayerStopAnimation(client); spawnPlayer(client, getGameConfig().skins[getGame()][getPlayerCurrentSubAccount(client).skin][0], closestHospital.position, closestHospital.heading);
setPlayerControlState(client, true); } else {
resetPlayerBlip(client); spawnPlayer(client, closestHospital.position, closestHospital.heading, getGameConfig().skins[getGame()][getPlayerCurrentSubAccount(client).skin][0]);
}
if (isFadeCameraSupported()) {
fadeCamera(client, true, 1.0);
}
updatePlayerSpawnedState(client, true);
makePlayerStopAnimation(client);
setPlayerControlState(client, true);
resetPlayerBlip(client);
}
} }
}, 2000); }, 2000);
}, 1000); }, 1000);