Tweaks for MafiaC compatibility
This commit is contained in:
@@ -390,26 +390,46 @@ function syncElementProperties(element) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
switch(element.type) {
|
if(getGame() == VRR_GAME_MAFIA_ONE) {
|
||||||
case ELEMENT_VEHICLE:
|
switch(element.type) {
|
||||||
syncVehicleProperties(element);
|
case ELEMENT_VEHICLE:
|
||||||
break;
|
syncVehicleProperties(element);
|
||||||
|
break;
|
||||||
|
|
||||||
case ELEMENT_PED:
|
case ELEMENT_PED:
|
||||||
syncCivilianProperties(element);
|
syncCivilianProperties(element);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ELEMENT_PLAYER:
|
case ELEMENT_PLAYER:
|
||||||
syncPlayerProperties(element);
|
syncPlayerProperties(element);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ELEMENT_OBJECT:
|
default:
|
||||||
syncObjectProperties(element);
|
break;
|
||||||
break;
|
}
|
||||||
|
} else {
|
||||||
|
switch(element.type) {
|
||||||
|
case ELEMENT_VEHICLE:
|
||||||
|
syncVehicleProperties(element);
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
case ELEMENT_PED:
|
||||||
break;
|
syncCivilianProperties(element);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case ELEMENT_PLAYER:
|
||||||
|
syncPlayerProperties(element);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case ELEMENT_OBJECT:
|
||||||
|
syncObjectProperties(element);
|
||||||
|
break;
|
||||||
|
|
||||||
|
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`);
|
logToConsole(LOG_DEBUG, `[VRR.Client] Showing game message to ${getPlayerDisplayForConsole(client)} (${text}) for ${duration} milliseconds`);
|
||||||
sendNetworkEventToPlayer("vrr.smallGameMessage", client, text, colour, duration);
|
sendNetworkEventToPlayer("vrr.smallGameMessage", client, text, colour, duration);
|
||||||
}
|
}
|
||||||
@@ -210,7 +210,7 @@ function setPlayer2DRendering(client, hudState = false, labelState = false, smal
|
|||||||
|
|
||||||
function syncPlayerProperties(client) {
|
function syncPlayerProperties(client) {
|
||||||
logToConsole(LOG_DEBUG, `[VRR.Client] Sending signal to sync ${getPlayerDisplayForConsole(client)}'s player ped properties`);
|
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) {
|
async function onPlayerChat(event, client, messageText) {
|
||||||
event.preventDefault();
|
|
||||||
|
|
||||||
processPlayerChat(client, messageText);
|
processPlayerChat(client, messageText);
|
||||||
|
event.preventDefault();
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
@@ -397,7 +396,16 @@ function onPlayerDeath(client, position) {
|
|||||||
client.despawnPlayer();
|
client.despawnPlayer();
|
||||||
getPlayerCurrentSubAccount(client).interior = closestJail.interior;
|
getPlayerCurrentSubAccount(client).interior = closestJail.interior;
|
||||||
getPlayerCurrentSubAccount(client).dimension = closestJail.dimension;
|
getPlayerCurrentSubAccount(client).dimension = closestJail.dimension;
|
||||||
spawnPlayer(client, closestJail.position, closestJail.heading, getGameConfig().skins[getGame()][getPlayerCurrentSubAccount(client).skin][0]);
|
|
||||||
|
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()) {
|
if(isFadeCameraSupported()) {
|
||||||
fadeCamera(client, true, 1.0);
|
fadeCamera(client, true, 1.0);
|
||||||
@@ -410,7 +418,16 @@ function onPlayerDeath(client, position) {
|
|||||||
client.despawnPlayer();
|
client.despawnPlayer();
|
||||||
getPlayerCurrentSubAccount(client).interior = closestHospital.interior;
|
getPlayerCurrentSubAccount(client).interior = closestHospital.interior;
|
||||||
getPlayerCurrentSubAccount(client).dimension = closestHospital.dimension;
|
getPlayerCurrentSubAccount(client).dimension = closestHospital.dimension;
|
||||||
spawnPlayer(client, closestHospital.position, closestHospital.heading, getGameConfig().skins[getGame()][getPlayerCurrentSubAccount(client).skin][0]);
|
|
||||||
|
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()) {
|
if(isFadeCameraSupported()) {
|
||||||
fadeCamera(client, true, 1.0);
|
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();
|
lastName = lastName.trim();
|
||||||
|
|
||||||
if(doesNameContainInvalidCharacters(firstName) || doesNameContainInvalidCharacters(lastName)) {
|
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!");
|
showPlayerNewCharacterFailedGUI(client, "Invalid characters in name!");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -371,7 +371,7 @@ function selectCharacter(client, characterId = -1) {
|
|||||||
//setPlayerCameraLookAt(client, getPosBehindPos(spawnPosition, spawnHeading, 5), spawnPosition);
|
//setPlayerCameraLookAt(client, getPosBehindPos(spawnPosition, spawnHeading, 5), spawnPosition);
|
||||||
getPlayerData(client).pedState = VRR_PEDSTATE_SPAWNING;
|
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);
|
spawnPlayer(client, spawnPosition, spawnHeading, getGameConfig().skins[getGame()][skin][0], spawnInterior, spawnDimension);
|
||||||
} else if(getGame() == VRR_GAME_GTA_IV) {
|
} else if(getGame() == VRR_GAME_GTA_IV) {
|
||||||
spawnPlayer(client, spawnPosition, spawnHeading, getGameConfig().skins[getGame()][skin][0], spawnInterior, spawnDimension);
|
spawnPlayer(client, spawnPosition, spawnHeading, getGameConfig().skins[getGame()][skin][0], spawnInterior, spawnDimension);
|
||||||
@@ -382,7 +382,9 @@ function selectCharacter(client, characterId = -1) {
|
|||||||
//setPlayerInterior(client, spawnInterior);
|
//setPlayerInterior(client, spawnInterior);
|
||||||
//setPlayerDimension(client, spawnDimension);
|
//setPlayerDimension(client, spawnDimension);
|
||||||
//restorePlayerCamera(client);
|
//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);
|
spawnPlayer(client, getGameConfig().skins[getGame()][skin][0], spawnPosition, spawnHeading);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user