Log deaths + wait for player ped
This commit is contained in:
@@ -420,6 +420,7 @@ function onPlayerDeath(client, position) {
|
|||||||
updatePlayerSpawnedState(client, true);
|
updatePlayerSpawnedState(client, true);
|
||||||
makePlayerStopAnimation(client);
|
makePlayerStopAnimation(client);
|
||||||
setPlayerControlState(client, true);
|
setPlayerControlState(client, true);
|
||||||
|
resetPlayerBlip(client);
|
||||||
} else {
|
} else {
|
||||||
let closestHospital = getClosestHospital(getPlayerPosition(client));
|
let closestHospital = getClosestHospital(getPlayerPosition(client));
|
||||||
despawnPlayer(client);
|
despawnPlayer(client);
|
||||||
@@ -443,6 +444,7 @@ function onPlayerDeath(client, position) {
|
|||||||
updatePlayerSpawnedState(client, true);
|
updatePlayerSpawnedState(client, true);
|
||||||
makePlayerStopAnimation(client);
|
makePlayerStopAnimation(client);
|
||||||
setPlayerControlState(client, true);
|
setPlayerControlState(client, true);
|
||||||
|
resetPlayerBlip(client);
|
||||||
}
|
}
|
||||||
}, 2000);
|
}, 2000);
|
||||||
}, 1000);
|
}, 1000);
|
||||||
@@ -455,7 +457,7 @@ function onPlayerDeath(client, position) {
|
|||||||
["log_death_pos_y", position.y],
|
["log_death_pos_y", position.y],
|
||||||
["log_death_pos_z", position.x],
|
["log_death_pos_z", position.x],
|
||||||
];
|
];
|
||||||
let queryString = createDatabaseInsertQuery("log_death", data);
|
let queryString = createDatabaseInsertQuery("log_death", queryData);
|
||||||
addToQueryQueue(queryString);
|
addToQueryQueue(queryString);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -470,15 +472,18 @@ function onPedSpawn(ped) {
|
|||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function onPlayerSpawn(client) {
|
async function onPlayerSpawn(client) {
|
||||||
logToConsole(LOG_DEBUG, `[VRR.Event] Checking for ${getPlayerDisplayForConsole(client)}'s player ped`);
|
//logToConsole(LOG_DEBUG, `[VRR.Event] Checking for ${getPlayerDisplayForConsole(client)}'s player ped`);
|
||||||
//if(getPlayerPed(client) == null) {
|
//if(getPlayerPed(client) == null) {
|
||||||
// logToConsole(LOG_DEBUG, `[VRR.Event] ${getPlayerDisplayForConsole(client)}'s player element not set yet. Rechecking ...`);
|
// logToConsole(LOG_DEBUG, `[VRR.Event] ${getPlayerDisplayForConsole(client)}'s player element not set yet. Rechecking ...`);
|
||||||
// setTimeout(onPlayerSpawn, 500, client);
|
// setTimeout(onPlayerSpawn, 500, client);
|
||||||
// return false;
|
// return false;
|
||||||
//}
|
//}
|
||||||
|
//logToConsole(LOG_DEBUG, `[VRR.Event] ${getPlayerDisplayForConsole(client)}'s player ped is valid. Continuing spawn processing ...`);
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[VRR.Event] ${getPlayerDisplayForConsole(client)}'s player ped is valid. Continuing spawn processing ...`);
|
if (areServerElementsSupported()) {
|
||||||
|
await waitUntil(() => client != null && getPlayerPed(client) != null);
|
||||||
|
}
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[VRR.Event] Checking ${getPlayerDisplayForConsole(client)}'s player data`);
|
logToConsole(LOG_DEBUG, `[VRR.Event] Checking ${getPlayerDisplayForConsole(client)}'s player data`);
|
||||||
if (!getPlayerData(client)) {
|
if (!getPlayerData(client)) {
|
||||||
@@ -531,6 +536,12 @@ function onPlayerSpawn(client) {
|
|||||||
//messagePlayerNormal(client, "This server is in early development and may restart at any time for updates.", getColourByName("orange"));
|
//messagePlayerNormal(client, "This server is in early development and may restart at any time for updates.", getColourByName("orange"));
|
||||||
//messagePlayerNormal(client, "Please report any bugs using /bug and suggestions using /idea", getColourByName("yellow"));
|
//messagePlayerNormal(client, "Please report any bugs using /bug and suggestions using /idea", getColourByName("yellow"));
|
||||||
|
|
||||||
|
if (getGame() == VRR_GAME_MAFIA_ONE) {
|
||||||
|
setPlayerPosition(client, getPlayerCurrentSubAccount(client).spawnPosition);
|
||||||
|
setPlayerHeading(client, getPlayerCurrentSubAccount(client).spawnHeading);
|
||||||
|
setPlayerDimension(client, getPlayerCurrentSubAccount(client).dimension);
|
||||||
|
}
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[VRR.Event] Setting player interior for ${getPlayerDisplayForConsole(client)} to ${getPlayerCurrentSubAccount(client).interior}`);
|
logToConsole(LOG_DEBUG, `[VRR.Event] Setting player interior for ${getPlayerDisplayForConsole(client)} to ${getPlayerCurrentSubAccount(client).interior}`);
|
||||||
setPlayerInterior(client, getPlayerCurrentSubAccount(client).interior);
|
setPlayerInterior(client, getPlayerCurrentSubAccount(client).interior);
|
||||||
|
|
||||||
@@ -638,6 +649,8 @@ function onPlayerSpawn(client) {
|
|||||||
|
|
||||||
getPlayerData(client).payDayTickStart = sdl.ticks;
|
getPlayerData(client).payDayTickStart = sdl.ticks;
|
||||||
|
|
||||||
|
sendPlayerLocaleStrings(client);
|
||||||
|
|
||||||
// Stop playing intro music and any other radio
|
// Stop playing intro music and any other radio
|
||||||
stopRadioStreamForPlayer(client);
|
stopRadioStreamForPlayer(client);
|
||||||
|
|
||||||
@@ -654,6 +667,8 @@ function onPlayerSpawn(client) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
resetPlayerBlip(client)
|
||||||
|
|
||||||
messageDiscordEventChannel(`🧍 ${getPlayerName(client)} spawned as ${getCharacterFullName(client)}`);
|
messageDiscordEventChannel(`🧍 ${getPlayerName(client)} spawned as ${getCharacterFullName(client)}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user