Mafia Connected support

This commit is contained in:
Vortrex
2021-08-14 20:49:47 -05:00
parent ebd8a91c87
commit 4fe9c45e0a
39 changed files with 2084 additions and 1669 deletions

View File

@@ -58,7 +58,6 @@ function addAllEventHandlers() {
function onResourceStart(event, resource) {
sendResourceStartedSignalToServer();
setUpInitialGame();
garbageCollectorInterval = setInterval(collectAllGarbage, 1000*60);
}

View File

@@ -19,10 +19,10 @@ let invalidValueColour = [200, 200, 200];
let focusedColourOffset = 50;
let windowAlpha = 185;
let windowTitleAlpha = 200;
let buttonAlpha = 200;
let textInputAlpha = 200;
let windowColour = (typeof gta == "undefined") ? [24, 24, 24, 150] : [0, 0, 0, 150];
let windowTitleAlpha = 180;
let buttonAlpha = 180;
let textInputAlpha = 180;
// ===========================================================================
@@ -156,7 +156,7 @@ function initGUI() {
logToConsole(LOG_DEBUG, `[VRR.GUI] Creating login GUI ...`);
login.window = mexui.window(game.width/2-150, game.height/2-129, 300, 258, 'LOGIN', {
main: {
backgroundColour: toColour(0, 0, 0, windowAlpha),
backgroundColour: toColour(windowColour[0], windowColour[1], windowColour[2], windowColour[3]),
transitionTime: 500,
},
title: {
@@ -235,7 +235,7 @@ function initGUI() {
logToConsole(LOG_DEBUG, `[VRR.GUI] Creating two factor auth GUI ...`);
twoFactorAuth.window = mexui.window(game.width/2-150, game.height/2-129, 300, 258, 'LOGIN', {
main: {
backgroundColour: toColour(0, 0, 0, windowAlpha),
backgroundColour: toColour(windowColour[0], windowColour[1], windowColour[2], windowColour[3]),
transitionTime: 500,
},
title: {
@@ -313,7 +313,7 @@ function initGUI() {
logToConsole(LOG_DEBUG, `[VRR.GUI] Creating new character GUI ...`);
newCharacter.window = mexui.window(game.width/2-130, game.height/2-100, 300, 200, 'Character Name', {
main: {
backgroundColour: toColour(0, 0, 0, windowAlpha),
backgroundColour: toColour(windowColour[0], windowColour[1], windowColour[2], windowColour[3]),
transitionTime: 500,
},
title: {
@@ -405,7 +405,7 @@ function initGUI() {
logToConsole(LOG_DEBUG, `[VRR.GUI] Creating register GUI ...`);
register.window = mexui.window(game.width/2-130, game.height/2-125, 300, 250, 'Register', {
main: {
backgroundColour: toColour(0, 0, 0, windowAlpha),
backgroundColour: toColour(windowColour[0], windowColour[1], windowColour[2], windowColour[3]),
transitionTime: 500,
},
title: {
@@ -472,7 +472,7 @@ function initGUI() {
},
placeholder: {
backgroundColour: toColour(0, 0, 0, 120),
textColour: toColour(150, 150, 150, 200),
textColour: toColour(200, 200, 200, 200),
textSize: 10.0,
textFont: robotoFont,
}
@@ -518,7 +518,7 @@ function initGUI() {
logToConsole(LOG_DEBUG, `[VRR.GUI] Creating error GUI ...`);
errorDialog.window = mexui.window(game.width/2-200, game.height/2-70, 500, 140, 'ERROR', {
main: {
backgroundColour: toColour(0, 0, 0, windowAlpha),
backgroundColour: toColour(windowColour[0], windowColour[1], windowColour[2], windowColour[3]),
transitionTime: 500,
},
title: {
@@ -564,7 +564,7 @@ function initGUI() {
logToConsole(LOG_DEBUG, `[VRR.GUI] Created prompt GUI ...`);
yesNoDialog.window = mexui.window(game.width/2-200, game.height/2-70, 400, 140, 'Question', {
main: {
backgroundColour: toColour(0, 0, 0, windowAlpha),
backgroundColour: toColour(windowColour[0], windowColour[1], windowColour[2], windowColour[3]),
transitionTime: 500,
},
title: {
@@ -623,7 +623,7 @@ function initGUI() {
logToConsole(LOG_DEBUG, `[VRR.GUI] Creating info dialog GUI ...`);
infoDialog.window = mexui.window(game.width/2-200, game.height/2-70, 400, 140, 'Information', {
main: {
backgroundColour: toColour(0, 0, 0, windowAlpha),
backgroundColour: toColour(windowColour[0], windowColour[1], windowColour[2], windowColour[3]),
},
title: {
textSize: 11.0,
@@ -668,7 +668,7 @@ function initGUI() {
logToConsole(LOG_DEBUG, `[VRR.GUI] Creating list dialog GUI ...`);
listDialog.window = mexui.window(game.width/2-200, game.height/2-70, 400, 500, 'List', {
main: {
backgroundColour: toColour(0, 0, 0, windowAlpha),
backgroundColour: toColour(windowColour[0], windowColour[1], windowColour[2], windowColour[3]),
},
title: {
textSize: 11.0,
@@ -699,7 +699,7 @@ function initGUI() {
listDialog.listGrid = listDialog.window.grid(5, 25, 390, 450, {
main: {
backgroundColour: toColour(0, 0, 0, windowAlpha),
backgroundColour: toColour(windowColour[0], windowColour[1], windowColour[2], windowColour[3]),
},
column: {
lineColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], windowTitleAlpha),
@@ -709,7 +709,7 @@ function initGUI() {
textColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], windowTitleAlpha),
},
cell: {
backgroundColour: toColour(0, 0, 0, windowAlpha),
backgroundColour: toColour(windowColour[0], windowColour[1], windowColour[2], windowColour[3]),
textColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], windowTitleAlpha),
},
row: {
@@ -726,7 +726,7 @@ function initGUI() {
logToConsole(LOG_DEBUG, `[VRR.GUI] Creating character select GUI ...`);
characterSelect.window = mexui.window(game.width/2-215, game.height/2-83, 430, 190, 'Select Character', {
main: {
backgroundColour: toColour(0, 0, 0, windowAlpha),
backgroundColour: toColour(windowColour[0], windowColour[1], windowColour[2], windowColour[3]),
},
title: {
textSize: 11.0,

View File

@@ -10,7 +10,7 @@
let itemActionDelayDuration = 0;
let itemActionDelayStart = 0;
let itemActionDelayEnabled = false;
let itemActionDelayPosition = toVector2(gta.width/2-100, gta.height-10);
let itemActionDelayPosition = toVector2(game.width/2-100, game.height-10);
let itemActionDelaySize = toVector2(200, 5);
// ===========================================================================

View File

@@ -37,28 +37,32 @@ function setLocalPlayerWorkingState(tempWorking) {
function showJobRouteStop() {
logToConsole(LOG_DEBUG, `[VRR.Job] Showing route stop`);
if(gta.game == GAME_GTA_SA) {
jobRouteStopSphere = gta.createPickup(1318, position, 1);
} else {
jobRouteStopSphere = gta.createSphere(position, 3);
jobRouteStopSphere.colour = colour;
}
if(getMultiplayerMod() == VRR_MPMOD_GTAC) {
if(gta.game == GAME_GTA_SA) {
jobRouteStopSphere = gta.createPickup(1318, position, 1);
} else {
jobRouteStopSphere = gta.createSphere(position, 3);
jobRouteStopSphere.colour = colour;
}
jobRouteStopBlip = gta.createBlip(position, 0, 2, colour);
jobRouteStopBlip = gta.createBlip(position, 0, 2, colour);
}
}
// ===========================================================================
function showJobRouteStop(position, colour) {
logToConsole(LOG_DEBUG, `[VRR.Job] Showing route stop`);
if(gta.game == GAME_GTA_SA) {
jobRouteStopSphere = gta.createPickup(1318, position, 1);
} else {
jobRouteStopSphere = gta.createSphere(position, 3);
jobRouteStopSphere.colour = colour;
}
if(getMultiplayerMod() == VRR_MPMOD_GTAC) {
if(gta.game == GAME_GTA_SA) {
jobRouteStopSphere = gta.createPickup(1318, position, 1);
} else {
jobRouteStopSphere = gta.createSphere(position, 3);
jobRouteStopSphere.colour = colour;
}
jobRouteStopBlip = gta.createBlip(position, 0, 2, colour);
jobRouteStopBlip = gta.createBlip(position, 0, 2, colour);
}
}
// ===========================================================================

View File

@@ -83,7 +83,7 @@ function renderPropertyEntranceLabel(name, position, locked, isBusiness, price,
tempPosition.z = tempPosition.z + propertyLabelHeight;
let screenPosition = getScreenFromWorldPosition(tempPosition);
if(screenPosition.x < 0 || screenPosition.x > gta.width) {
if(screenPosition.x < 0 || screenPosition.x > game.width) {
return false;
}
@@ -160,7 +160,7 @@ function renderPropertyExitLabel(position) {
tempPosition.z = tempPosition.z + propertyLabelHeight;
let screenPosition = getScreenFromWorldPosition(tempPosition);
if(screenPosition.x < 0 || screenPosition.x > gta.width) {
if(screenPosition.x < 0 || screenPosition.x > game.width) {
return false;
}
@@ -188,7 +188,7 @@ function renderJobLabel(name, position, jobType) {
tempPosition.z = tempPosition.z + propertyLabelHeight;
let screenPosition = getScreenFromWorldPosition(tempPosition);
if(screenPosition.x < 0 || screenPosition.x > gta.width) {
if(screenPosition.x < 0 || screenPosition.x > game.width) {
return false;
}
@@ -220,7 +220,7 @@ function renderJobLabel(name, position, jobType) {
// -------------------------------------------------------------------------
function processLabelRendering() {
if(renderLabels && gta.game != GAME_GTA_IV) {
if(renderLabels && areWorldLabelsSupported()) {
if(localPlayer != null) {
let pickups = getElementsByType(ELEMENT_PICKUP);
for(let i in pickups) {

View File

@@ -8,14 +8,14 @@
// ===========================================================================
let logoImage = null;
let logoPos = toVector2(gta.width-132, gta.height-132);
let logoPos = toVector2(game.width-132, game.height-132);
let logoSize = toVector2(128, 128);
// ===========================================================================
function initLogoScript() {
logToConsole(LOG_DEBUG, "[VRR.Logo]: Initializing logo script ...");
logoImage = loadLogoImage();
//logoImage = loadLogoImage();
logToConsole(LOG_DEBUG, "[VRR.Logo]: Logo script initialized!");
}
@@ -25,7 +25,7 @@ function loadLogoImage() {
let logoStream = openFile(mainLogoPath);
let tempLogoImage = null;
if(logoStream != null) {
tempLogoImage = drawing.loadPNG(logoStream);
tempLogoImage = graphics.loadPNG(logoStream);
logoStream.close();
}

View File

@@ -48,4 +48,6 @@ let enterPropertyKey = null;
let forcedAnimation = null;
let calledDeathEvent = false;
// ===========================================================================

View File

@@ -52,7 +52,7 @@ function processSmallGameMessageRendering() {
if(renderSmallGameMessage) {
if(smallGameMessageFont != null) {
if(smallGameMessageFont != "") {
smallGameMessageFont.render(smallGameMessageText, [0, gta.height-50], gta.width, 0.5, 0.0, smallGameMessageFont.size, smallGameMessageColour, true, true, false, true);
smallGameMessageFont.render(smallGameMessageText, [0, game.height-50], game.width, 0.5, 0.0, smallGameMessageFont.size, smallGameMessageColour, true, true, false, true);
}
}
}

View File

@@ -80,10 +80,14 @@ function drawNametag(x, y, health, armour, text, ping, alpha, distance, colour,
// -------------------------------------------
// Health Bar
if(gta.game == GAME_GTA_III) {
// Mickey Hamfists is ridiculously tall. Raise the nametag for him a bit
if(skin == 109) {
y -= 20;
if(getMultiplayerMod() == VRR_MPMOD_GTAC) {
if(gta.game == GAME_GTA_III) {
// Mickey Hamfists is ridiculously tall. Raise the nametag for him a bit
if(skin == 109) {
y -= 20;
} else {
y -= 5;
}
} else {
y -= 5;
}
@@ -199,9 +203,9 @@ function getClientFromPlayer(player) {
// ===========================================================================
function processNameTagRendering(event) {
if(gta.game >= GAME_GTA_IV) {
return false;
}
//if(gta.game >= GAME_GTA_IV) {
// return false;
//}
getElementsByType(ELEMENT_PLAYER).forEach(function(player) {
if(player != localPlayer) {

View File

@@ -10,7 +10,14 @@
function setUpInitialGame() {
if(mafia.game == GAME_MAFIA_ONE) {
mafia.mapEnabled = false;
mafia.setTrafficEnabled(false);
}
}
// ===========================================================================
addEventHandler("OnMapLoaded", function(event) {
initClientScripts();
});
// ===========================================================================

View File

@@ -129,7 +129,8 @@ function onServerSpawnedPlayer(state) {
logToConsole(LOG_DEBUG, `[VRR.Main] Setting spawned state to ${state}`);
isSpawned = state;
if(state) {
setUpInitialGame
setUpInitialGame();
calledDeathEvent = false;
}
}
@@ -154,7 +155,7 @@ function tellServerItemActionDelayComplete() {
// ===========================================================================
function sendServerClientInfo() {
triggerNetworkEvent("vrr.clientInfo", `${CLIENT_VERSION_MAJOR}.${CLIENT_VERSION_MINOR}.${CLIENT_VERSION_PATCH}.${CLIENT_VERSION_BUILD}`, gta.width, gta.height);
triggerNetworkEvent("vrr.clientInfo", `${CLIENT_VERSION_MAJOR}.${CLIENT_VERSION_MINOR}.${CLIENT_VERSION_PATCH}.${CLIENT_VERSION_BUILD}`, game.width, game.height);
}
// ===========================================================================

View File

@@ -63,21 +63,21 @@ function loadSkinSelectMessageFontBottom() {
function processSkinSelectKeyPress(keyCode) {
if(usingSkinSelector) {
if(keyCode == SDLK_RIGHT) {
if(allowedSkins[gta.game].length-1 == skinSelectorIndex) {
if(allowedSkins[game.game].length-1 == skinSelectorIndex) {
skinSelectorIndex = 0;
} else {
skinSelectorIndex++;
}
localPlayer.skin = allowedSkins[gta.game][skinSelectorIndex][0];
skinSelectMessageTextTop = allowedSkins[gta.game][skinSelectorIndex][1];
localPlayer.skin = allowedSkins[game.game][skinSelectorIndex][0];
skinSelectMessageTextTop = allowedSkins[game.game][skinSelectorIndex][1];
} else if(keyCode == SDLK_LEFT) {
if(skinSelectorIndex <= 0) {
skinSelectorIndex = allowedSkins[gta.game].length-1;
skinSelectorIndex = allowedSkins[game.game].length-1;
} else {
skinSelectorIndex--;
}
localPlayer.skin = allowedSkins[gta.game][skinSelectorIndex][0];
skinSelectMessageTextTop = allowedSkins[gta.game][skinSelectorIndex][1];
localPlayer.skin = allowedSkins[game.game][skinSelectorIndex][0];
skinSelectMessageTextTop = allowedSkins[game.game][skinSelectorIndex][1];
} else if(keyCode == SDLK_RETURN) {
triggerNetworkEvent("vrr.skinSelected", skinSelectorIndex);
} else if(keyCode == SDLK_BACKSPACE) {
@@ -91,16 +91,18 @@ function processSkinSelectKeyPress(keyCode) {
function processSkinSelectRendering() {
if(usingSkinSelector) {
if(skinSelectMessageFontTop != null && skinSelectMessageFontBottom != null) {
if(gta.game != GAME_GTA_VC) {
skinSelectMessageFontTop.render(skinSelectMessageTextTop, [0, gta.height-100], gta.width, 0.5, 0.0, skinSelectMessageFontTop.size, skinSelectMessageColourTop, true, true, false, true);
skinSelectMessageFontBottom.render(skinSelectMessageTextBottom, [0, gta.height-65], gta.width, 0.5, 0.0, skinSelectMessageFontBottom.size, skinSelectMessageColourBottom, true, true, false, true);
}
//if(gta.game != GAME_GTA_VC) {
skinSelectMessageFontTop.render(skinSelectMessageTextTop, [0, game.height-100], game.width, 0.5, 0.0, skinSelectMessageFontTop.size, skinSelectMessageColourTop, true, true, false, true);
skinSelectMessageFontBottom.render(skinSelectMessageTextBottom, [0, game.height-65], game.width, 0.5, 0.0, skinSelectMessageFontBottom.size, skinSelectMessageColourBottom, true, true, false, true);
//}
}
localPlayer.position = skinSelectPosition;
localPlayer.heading = skinSelectHeading;
if(gta.game == GAME_GTA_III || gta.game == GAME_GTA_VC) {
localPlayer.clearObjective();
if(getMultiplayerMod() == VRR_MPMOD_GTAC) {
if(gta.game == GAME_GTA_III || gta.game == GAME_GTA_VC) {
localPlayer.clearObjective();
}
}
}
}
@@ -110,14 +112,18 @@ function processSkinSelectRendering() {
function toggleSkinSelect(state) {
if(state) {
skinSelectorIndex = 0;
if(localPlayer.skin != allowedSkins[gta.game][skinSelectorIndex][0]) {
localPlayer.skin = allowedSkins[gta.game][skinSelectorIndex][0];
if(localPlayer.skin != allowedSkins[game.game][skinSelectorIndex][0]) {
localPlayer.skin = allowedSkins[game.game][skinSelectorIndex][0];
}
usingSkinSelector = true;
let tempPosition = localPlayer.position;
tempPosition.z += 0.5;
let frontCameraPosition = getPosInFrontOfPos(tempPosition, localPlayer.heading, 3);
gta.setCameraLookAt(frontCameraPosition, localPlayer.position, true);
if(isCustomCameraSupported()) {
game.setCameraLookAt(frontCameraPosition, localPlayer.position, true);
}
gui.showCursor(true, false);
localPlayer.invincible = true;
localPlayer.setProofs(true, true, true, true, true);

View File

@@ -9,27 +9,30 @@
function processSync(event, deltaTime) {
if(localPlayer != null) {
if(gta.game == GAME_GTA_IV) {
if(!doesGameHaveServerElements()) {
triggerNetworkEvent("vrr.player.position", localPlayer.position);
triggerNetworkEvent("vrr.player.heading", localPlayer.heading);
}
if(gta.game == GAME_GTA_SA) {
let lookAtPos = getLocalPlayerLookAtPosition();
triggerNetworkEvent("vrr.player.lookat", lookAtPos);
setEntityData(localPlayer, "vrr.headLook", lookAtPos);
let peds = getPeds();
for(let i in peds) {
if(doesEntityDataExist(peds[i], "vrr.headLook")) {
peds[i].lookAt(getEntityData(peds[i], "vrr.headLook"), 99999);
}
}
}
//if(gta.game == GAME_GTA_SA) {
// let lookAtPos = getLocalPlayerLookAtPosition();
// triggerNetworkEvent("vrr.player.lookat", lookAtPos);
// setEntityData(localPlayer, "vrr.headLook", lookAtPos);
// let peds = getPeds();
// for(let i in peds) {
// if(doesEntityDataExist(peds[i], "vrr.headLook")) {
// peds[i].lookAt(getEntityData(peds[i], "vrr.headLook"), 99999);
// }
// }
//}
if(localPlayer.health <= 0) {
logToConsole(LOG_DEBUG, `Local player died`);
localPlayer.clearWeapons();
triggerNetworkEvent("vrr.playerDeath", localPlayer.position);
if(!calledDeathEvent) {
logToConsole(LOG_DEBUG, `Local player died`);
localPlayer.clearWeapons();
calledDeathEvent = true;
triggerNetworkEvent("vrr.playerDeath");
}
}
if(streamingRadioElement) {

View File

@@ -194,8 +194,13 @@ function setLocalPlayerControlState(controlState, cursorState = false) {
// ===========================================================================
function fadeLocalCamera(state, time) {
logToConsole(LOG_DEBUG, `[VRR.Utilities] Fading camera ${(state)?"in":"out"} for ${time} seconds`);
gta.fadeCamera(state, time);
if(isFadeCameraSupported()) {
logToConsole(LOG_DEBUG, `[VRR.Utilities] Fading camera ${(state)?"in":"out"} for ${time} seconds`);
if(isFadeCameraSupported()) {
gta.fadeCamera(state, time);
}
}
}
// ===========================================================================
@@ -208,7 +213,9 @@ function removeLocalPlayerFromVehicle() {
function restoreLocalCamera() {
logToConsole(LOG_DEBUG, `[VRR.Utilities] Camera restored`);
gta.restoreCamera(true);
if(isCustomCameraSupported()) {
gta.restoreCamera(true);
}
};
// ===========================================================================
@@ -223,22 +230,27 @@ function clearLocalPlayerOwnedPeds() {
function setLocalCameraLookAt(cameraPosition, cameraLookAt) {
logToConsole(LOG_DEBUG, `[VRR.Utilities] Set camera to look at [${cameraLookAt.x}, ${cameraLookAt.y}, ${cameraLookAt.z}] from [${cameraPosition.x}, ${cameraPosition.y}, ${cameraPosition.z}]`);
gta.setCameraLookAt(cameraPosition, cameraLookAt, true);
if(isCustomCameraSupported()) {
gta.setCameraLookAt(cameraPosition, cameraLookAt, true);
}
}
// ===========================================================================
function setCityAmbienceState(state, clearElements = false) {
logToConsole(LOG_DEBUG, `[VRR.Utilities] Ambient civilians and traffic ${(state) ? "enabled" : "disabled"}`);
gta.setTrafficEnabled(state);
gta.setGenerateCarsAroundCamera(state);
if(gta.game != GAME_GTA_SA) {
gta.setCiviliansEnabled(state);
}
game.setTrafficEnabled(state);
if(clearElements) {
clearSelfOwnedPeds();
clearSelfOwnedVehicles();
if(getMultiplayerMod() == VRR_MPMOD_GTAC) {
gta.setGenerateCarsAroundCamera(state);
if(gta.game != GAME_GTA_SA) {
gta.setCiviliansEnabled(state);
}
if(clearElements) {
clearSelfOwnedPeds();
clearSelfOwnedVehicles();
}
}
}
@@ -321,8 +333,10 @@ function setLocalPlayerHeading(heading) {
function setLocalPlayerInterior(interior) {
logToConsole(LOG_DEBUG, `[VRR.Utilities] Setting interior to ${interior}`);
localPlayer.interior = interior;
gta.cameraInterior = interior;
if(getMultiplayerMod() == VRR_MPMOD_GTAC) {
localPlayer.interior = interior;
gta.cameraInterior = interior;
}
}
// ===========================================================================
@@ -351,7 +365,9 @@ function isSnowEnabled() {
function playPedSpeech(pedName, speechId) {
logToConsole(LOG_DEBUG, `[VRR.Utilities] Making ${pedName}'s ped talk (${speechId})`);
gta.SET_CHAR_SAY(int, int);
if(getMultiplayerMod() == VRR_MPMOD_GTAC) {
gta.SET_CHAR_SAY(int, int);
}
}
// ===========================================================================
@@ -364,23 +380,25 @@ function clearLocalPedState() {
// ===========================================================================
function getWeaponSlot(weaponId) {
return weaponSlots[gta.game][weaponId];
return weaponSlots[game.game][weaponId];
}
// ===========================================================================
function setLocalPlayerDrunkEffect(amount, duration) {
logToConsole(LOG_DEBUG, `[VRR.Utilities] Drunk effect set to ${amount} for ${duration}ms`);
drunkEffectAmount = 0;
drunkEffectDurationTimer = setInterval(function() {
drunkEffectAmount = drunkEffectAmount;
if(drunkEffectAmount > 0) {
gta.SET_MOTION_BLUR(drunkEffectAmount);
} else {
clearInterval(drunkEffectDurationTimer);
drunkEffectDurationTimer = null;
}
}, 1000);
if(getMultiplayerMod() == VRR_MPMOD_GTAC) {
logToConsole(LOG_DEBUG, `[VRR.Utilities] Drunk effect set to ${amount} for ${duration}ms`);
drunkEffectAmount = 0;
drunkEffectDurationTimer = setInterval(function() {
drunkEffectAmount = drunkEffectAmount;
if(drunkEffectAmount > 0) {
gta.SET_MOTION_BLUR(drunkEffectAmount);
} else {
clearInterval(drunkEffectDurationTimer);
drunkEffectDurationTimer = null;
}
}, 1000);
}
}
// ===========================================================================
@@ -456,7 +474,10 @@ function setLocalPlayerCash(amount) {
function removeWorldObject(model, position, range) {
if(isRemovingWorldObjectsSupported()) {
logToConsole(LOG_DEBUG, `[VRR.Utilities] Removing world object ${model} at X: ${position.x}, Y: ${position.x}, Z: ${position.x} with range of ${range}`);
gta.removeWorldObject(model, position, range);
if(getMultiplayerMod() == VRR_MPMOD_GTAC) {
game.removeWorldObject(model, position, range);
}
}
}
@@ -632,8 +653,8 @@ function getPosInFrontOfPos(pos, angle, distance) {
// ===========================================================================
function getAllowedSkinIndexBySkinId(skinId) {
for(let i in allowedSkins[gta.game]) {
if(skinId == allowedSkins[gta.game][i][0]) {
for(let i in allowedSkins[game.game]) {
if(skinId == allowedSkins[game.game][i][0]) {
return i;
}
}
@@ -644,7 +665,10 @@ function getAllowedSkinIndexBySkinId(skinId) {
function setMinuteDuration(minuteDuration) {
logToConsole(LOG_DEBUG, `[VRR.Utilities] Setting minute duration to ${minuteDuration}ms`);
gta.time.minuteDuration = minuteDuration;
if(isTimeSupported()) {
gta.time.minuteDuration = minuteDuration;
}
}
// ===========================================================================
@@ -657,7 +681,7 @@ function getStreamingRadioVolumeForPosition(position) {
function getLocalPlayerLookAtPosition() {
if(localPlayer != null) {
let centerCameraPos = getWorldFromScreenPosition(toVector3(gta.width/2, gta.height/2, 0));
return getWorldFromScreenPosition(toVector3(gta.width/2, gta.height/2, getDistance(centerCameraPos, localPlayer.position)+20));
let centerCameraPos = getWorldFromScreenPosition(toVector3(game.width/2, game.height/2, 0));
return getWorldFromScreenPosition(toVector3(game.width/2, game.height/2, getDistance(centerCameraPos, localPlayer.position)+20));
}
}