Fix death process and remove debugging msg

This commit is contained in:
Vortrex
2020-12-14 10:46:17 -06:00
parent 48e1b510ce
commit 5b55022eb9

View File

@@ -680,7 +680,6 @@ function doesWordStartWithVowel(word) {
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
function getVehicleNameFromModelId(modelId) { function getVehicleNameFromModelId(modelId) {
console.log(modelId);
if(isGTAIV()) { if(isGTAIV()) {
for(let i in getGameData().gtaivVehicleModels) { for(let i in getGameData().gtaivVehicleModels) {
if(getGameData().gtaivVehicleModels[i][1] == modelId) { if(getGameData().gtaivVehicleModels[i][1] == modelId) {
@@ -1661,33 +1660,24 @@ function getClosestPoliceStation(position) {
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
function processPlayerDeath(client) { function processPlayerDeath(client) {
client.removeData("ag.spawned", true); removeEntityData(client.player, "ag.spawned", true);
if(isGTAIV()) {
triggerNetworkEvent("ag.iv.syncPosition", client, false);
}
let closestHospital = getClosestHospital(getPlayerPosition(client)); let closestHospital = getClosestHospital(getPlayerPosition(client));
triggerNetworkEvent("ag.control", client, false); triggerNetworkEvent("ag.control", client, false);
setTimeout(function() { setTimeout(function() {
triggerNetworkEvent("ag.fadeCamera", client, false, 1.0); triggerNetworkEvent("ag.fadeCamera", client, false, 1.0);
setTimeout(function() { setTimeout(function() {
if(!isGTAIV()) { client.despawnPlayer();
client.despawnPlayer();
}
if(getClientCurrentSubAccount(client).inJail) { if(getClientCurrentSubAccount(client).inJail) {
let closestJail = getClosestJail(getPlayerPosition(client)); let closestJail = getClosestJail(getPlayerPosition(client));
spawnPlayer(client, closestJail.position, closestJail.heading, getClientCurrentSubAccount(client).skin); spawnPlayer(client, closestJail.position, closestJail.heading, getClientCurrentSubAccount(client).skin);
} else { } else {
spawnPlayer(client, closestHospital.position, closestHospital.heading, getClientCurrentSubAccount(client).skin); spawnPlayer(client, closestHospital.position, closestHospital.heading, getClientCurrentSubAccount(client).skin);
} }
getEntityData(client, "ag.spawned", true, true);
setTimeout(function() { setTimeout(function() {
setEntityData(client.player, "ag.spawned", true, true);
triggerNetworkEvent("ag.fadeCamera", client, true, 1.0); triggerNetworkEvent("ag.fadeCamera", client, true, 1.0);
triggerNetworkEvent("ag.control", client, true); triggerNetworkEvent("ag.control", client, true);
if(isGTAIV()) {
triggerNetworkEvent("ag.iv.syncPosition", client, true);
}
}, 1000); }, 1000);
}, 2000); }, 2000);
}, 1000); }, 1000);