Tweaks for MafiaC compatibility
This commit is contained in:
@@ -390,6 +390,24 @@ function syncElementProperties(element) {
|
||||
}
|
||||
}
|
||||
|
||||
if(getGame() == VRR_GAME_MAFIA_ONE) {
|
||||
switch(element.type) {
|
||||
case ELEMENT_VEHICLE:
|
||||
syncVehicleProperties(element);
|
||||
break;
|
||||
|
||||
case ELEMENT_PED:
|
||||
syncCivilianProperties(element);
|
||||
break;
|
||||
|
||||
case ELEMENT_PLAYER:
|
||||
syncPlayerProperties(element);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
switch(element.type) {
|
||||
case ELEMENT_VEHICLE:
|
||||
syncVehicleProperties(element);
|
||||
@@ -410,6 +428,8 @@ function syncElementProperties(element) {
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -137,7 +137,7 @@ function playerClientStopped(client) {
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function showGameMessage(client, text, colour, duration) {
|
||||
function showGameMessage(client, text, colour, duration, fontName = "Pricedown") {
|
||||
logToConsole(LOG_DEBUG, `[VRR.Client] Showing game message to ${getPlayerDisplayForConsole(client)} (${text}) for ${duration} milliseconds`);
|
||||
sendNetworkEventToPlayer("vrr.smallGameMessage", client, text, colour, duration);
|
||||
}
|
||||
@@ -210,7 +210,7 @@ function setPlayer2DRendering(client, hudState = false, labelState = false, smal
|
||||
|
||||
function syncPlayerProperties(client) {
|
||||
logToConsole(LOG_DEBUG, `[VRR.Client] Sending signal to sync ${getPlayerDisplayForConsole(client)}'s player ped properties`);
|
||||
sendNetworkEventToPlayer("vrr.player.sync", null, client.player);
|
||||
sendNetworkEventToPlayer("vrr.syncElement", null, client.player.id);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
@@ -117,9 +117,8 @@ function onPlayerQuit(event, client, quitReasonId) {
|
||||
// ===========================================================================
|
||||
|
||||
async function onPlayerChat(event, client, messageText) {
|
||||
event.preventDefault();
|
||||
|
||||
processPlayerChat(client, messageText);
|
||||
event.preventDefault();
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -397,7 +396,16 @@ function onPlayerDeath(client, position) {
|
||||
client.despawnPlayer();
|
||||
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);
|
||||
@@ -410,7 +418,16 @@ function onPlayerDeath(client, position) {
|
||||
client.despawnPlayer();
|
||||
getPlayerCurrentSubAccount(client).interior = closestHospital.interior;
|
||||
getPlayerCurrentSubAccount(client).dimension = closestHospital.dimension;
|
||||
|
||||
if(isPlayerWorking(client)) {
|
||||
stopWorking(client);
|
||||
}
|
||||
|
||||
if(getGame() == VRR_GAME_MAFIA_ONE) {
|
||||
spawnPlayer(client, getGameConfig().skins[getGame()][getPlayerCurrentSubAccount(client).skin][0], closestHospital.position, closestHospital.heading);
|
||||
} else {
|
||||
spawnPlayer(client, closestHospital.position, closestHospital.heading, getGameConfig().skins[getGame()][getPlayerCurrentSubAccount(client).skin][0]);
|
||||
}
|
||||
|
||||
if(isFadeCameraSupported()) {
|
||||
fadeCamera(client, true, 1.0);
|
||||
@@ -603,3 +620,11 @@ function onPlayerSpawn(client) {
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function onPlayerCommand(event, client, command) {
|
||||
if(!doesCommandExist(command)) {
|
||||
processPlayerCommand(command, params, client);
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -275,7 +275,7 @@ function checkNewCharacter(client, firstName, lastName) {
|
||||
lastName = lastName.trim();
|
||||
|
||||
if(doesNameContainInvalidCharacters(firstName) || doesNameContainInvalidCharacters(lastName)) {
|
||||
logToConsole(LOG_WARN, `[VRR.Account] Subaccount ${firstName} ${lastName} could not be created (invalid characters in name)`);
|
||||
logToConsole(LOG_INFO|LOG_WARN, `[VRR.Account] Subaccount ${firstName} ${lastName} could not be created (invalid characters in name)`);
|
||||
showPlayerNewCharacterFailedGUI(client, "Invalid characters in name!");
|
||||
return false;
|
||||
}
|
||||
@@ -371,7 +371,7 @@ function selectCharacter(client, characterId = -1) {
|
||||
//setPlayerCameraLookAt(client, getPosBehindPos(spawnPosition, spawnHeading, 5), spawnPosition);
|
||||
getPlayerData(client).pedState = VRR_PEDSTATE_SPAWNING;
|
||||
|
||||
if(getGame() < VRR_GAME_GTA_IV) {
|
||||
if(getGame() <= VRR_GAME_GTA_SA) {
|
||||
spawnPlayer(client, spawnPosition, spawnHeading, getGameConfig().skins[getGame()][skin][0], spawnInterior, spawnDimension);
|
||||
} else if(getGame() == VRR_GAME_GTA_IV) {
|
||||
spawnPlayer(client, spawnPosition, spawnHeading, getGameConfig().skins[getGame()][skin][0], spawnInterior, spawnDimension);
|
||||
@@ -382,7 +382,9 @@ function selectCharacter(client, characterId = -1) {
|
||||
//setPlayerInterior(client, spawnInterior);
|
||||
//setPlayerDimension(client, spawnDimension);
|
||||
//restorePlayerCamera(client);
|
||||
} else if(getGame() >= VRR_GAME_MAFIA_ONE) {
|
||||
} else if(getGame() == VRR_GAME_MAFIA_ONE) {
|
||||
//spawnPlayer(client, spawnPosition, spawnHeading, getGameConfig().skins[getGame()][skin][0]);
|
||||
logToConsole(LOG_DEBUG, `[VRR.SubAccount] Spawning ${getPlayerDisplayForConsole(client)} as ${getGameConfig().skins[getGame()][skin][1]} (${getGameConfig().skins[getGame()][skin][0]})`);
|
||||
spawnPlayer(client, getGameConfig().skins[getGame()][skin][0], spawnPosition, spawnHeading);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user