Fixes for IV

This commit is contained in:
Vortrex
2022-02-26 22:30:39 -06:00
parent a15b29e977
commit 8e225ed480
6 changed files with 43 additions and 16 deletions

View File

@@ -56,14 +56,18 @@ function makePedStopAnimation(pedId) {
return false;
}
if(getGame() == VRR_GAME_GTA_VC || getGame() == VRR_GAME_GTA_SA) {
getElementFromId(pedId).clearAnimations();
} else {
getElementFromId(pedId).clearObjective();
if(getGame() != VRR_GAME_GTA_IV) {
if(getGame() == VRR_GAME_GTA_VC || getGame() == VRR_GAME_GTA_SA) {
getElementFromId(pedId).clearAnimations();
} else {
getElementFromId(pedId).clearObjective();
}
}
if(getElementFromId(pedId) == localPlayer) {
localPlayer.collisionsEnabled = true;
if(getGame() != VRR_GAME_GTA_IV) {
localPlayer.collisionsEnabled = true;
}
setLocalPlayerControlState(true, false);
}
}

View File

@@ -82,6 +82,7 @@ function addAllNetworkHandlers() {
addNetworkEventHandler("vrr.pedAnim", makePedPlayAnimation);
addNetworkEventHandler("vrr.pedStopAnim", makePedStopAnimation);
addNetworkEventHandler("vrr.localPlayerSkin", setLocalPlayerSkin);
addNetworkEventHandler("vrr.forcePedAnim", forcePedAnimation);
addNetworkEventHandler("vrr.hideAllGUI", hideAllGUI);
addNetworkEventHandler("vrr.gameScript", setGameScriptState);
@@ -128,10 +129,12 @@ function setPlayer2DRendering(hudState, labelState, smallGameMessageState, score
logToConsole(LOG_DEBUG, `[VRR.Main] Updating render states (HUD: ${hudState}, Labels: ${labelState}, Bottom Text: ${smallGameMessageState}, Scoreboard: ${scoreboardState}, HotBar: ${hotBarState}, Item Action Delay: ${itemActionDelayState})`);
renderHUD = hudState;
if(typeof setHUDEnabled != "undefined") {
if(getGame() == VRR_GAME_GTA_IV) {
natives.displayHud(false);
} else {
if(getGame() == VRR_GAME_GTA_IV) {
natives.displayCash(hudState);
natives.displayAmmo(hudState);
natives.displayHud(hudState);
} else {
if(typeof setHUDEnabled != "undefined") {
setHUDEnabled(hudState);
}
}
@@ -298,3 +301,14 @@ function setLocalPlayerInfiniteRun(state) {
}
// ===========================================================================
function setLocalPlayerSkin(skinId) {
if(getGame() == VRR_GAME_GTA_IV) {
//natives.changePlayerModel(natives.getPlayerId(), skinId);
localPlayer.skin = allowedSkins[skinSelectorIndex][0];
} else {
localPlayer.skin = skinId;
}
}
// ===========================================================================

View File

@@ -54,7 +54,8 @@ function processSkinSelectKeyPress(keyCode) {
logToConsole(LOG_DEBUG, `Switching to skin ${allowedSkins[skinSelectorIndex][1]} (Index: ${skinSelectorIndex}, Skin: ${allowedSkins[skinSelectorIndex][0]})`);
skinSelectMessageTextTop = allowedSkins[skinSelectorIndex][1];
if(getGame() == VRR_GAME_GTA_IV) {
natives.changePlayerModel(natives.getPlayerId(), allowedSkins[skinSelectorIndex][0]);
//natives.changePlayerModel(natives.getPlayerId(), allowedSkins[skinSelectorIndex][0]);
localPlayer.skin = allowedSkins[skinSelectorIndex][0];
} else {
localPlayer.skin = allowedSkins[skinSelectorIndex][0];
}
@@ -67,7 +68,8 @@ function processSkinSelectKeyPress(keyCode) {
logToConsole(LOG_DEBUG, `Switching to skin ${allowedSkins[skinSelectorIndex][1]} (Index: ${skinSelectorIndex}, Skin: ${allowedSkins[skinSelectorIndex][0]})`);
skinSelectMessageTextTop = allowedSkins[skinSelectorIndex][1];
if(getGame() == VRR_GAME_GTA_IV) {
natives.changePlayerModel(natives.getPlayerId(), allowedSkins[skinSelectorIndex][0]);
//natives.changePlayerModel(natives.getPlayerId(), allowedSkins[skinSelectorIndex][0]);
localPlayer.skin = allowedSkins[skinSelectorIndex][0];
} else {
localPlayer.skin = allowedSkins[skinSelectorIndex][0];
}
@@ -118,7 +120,8 @@ function toggleSkinSelect(state) {
}
if(getGame() == VRR_GAME_GTA_IV) {
natives.changePlayerModel(natives.getPlayerId(), allowedSkins[skinSelectorIndex][0]);
//natives.changePlayerModel(natives.getPlayerId(), allowedSkins[skinSelectorIndex][0]);
localPlayer.skin = allowedSkins[skinSelectorIndex][0];
} else {
localPlayer.skin = allowedSkins[skinSelectorIndex][0];
}

View File

@@ -837,7 +837,7 @@ function setUpInitialGame() {
natives.setPlayersDropMoneyInNetworkGame(false);
natives.setSyncWeatherAndGameTime(false);
natives.usePlayerColourInsteadOfTeamColour(true);
natives.setDisplayPlayerNameAndIcon(false);
natives.setDisplayPlayerNameAndIcon(natives.getPlayerId(), false);
natives.removeTemporaryRadarBlipsForPickups();
natives.setPickupsFixCars(false);
natives.displayCash(true);

View File

@@ -196,7 +196,11 @@ function removePlayerFromVehicle(client) {
function setPlayerSkin(client, skinIndex) {
logToConsole(LOG_DEBUG, `Setting ${getPlayerDisplayForConsole(client)}'s skin to ${getGameData().skins[getGame()][skinIndex][0]} (Index: ${skinIndex}, Name: ${getGameData().skins[getGame()][skinIndex][1]})`);
client.player.modelIndex = getGameData().skins[getGame()][skinIndex][0];
if(getGame() == VRR_GAME_GTA_IV) {
triggerNetworkEvent("vrr.localPlayerSkin", client, getGameData().skins[getGame()][skinIndex][0]);
} else {
client.player.modelIndex = getGameData().skins[getGame()][skinIndex][0];
}
}
// ===========================================================================

View File

@@ -371,9 +371,11 @@ function selectCharacter(client, characterId = -1) {
//setPlayerCameraLookAt(client, getPosBehindPos(spawnPosition, spawnHeading, 5), spawnPosition);
getPlayerData(client).pedState = VRR_PEDSTATE_SPAWNING;
if(getGame() < VRR_GAME_MAFIA_ONE) {
if(getGame() < VRR_GAME_GTA_IV) {
spawnPlayer(client, spawnPosition, spawnHeading, getGameData().skins[getGame()][skin][0], spawnInterior, spawnDimension);
} else {
} else if(getGame() == VRR_GAME_GTA_IV) {
spawnPlayer(client, spawnPosition, spawnHeading, getGameData().skins[getGame()][skin][0], spawnInterior, spawnDimension);
} else if(getGame() >= VRR_GAME_MAFIA_ONE) {
spawnPlayer(client, getGameData().skins[getGame()][skin][0], spawnPosition, spawnHeading);
}