From 4fe9c45e0af879e65173f77a1e204f873ceb79de Mon Sep 17 00:00:00 2001 From: Vortrex <3858226+VortrexFTW@users.noreply.github.com> Date: Sat, 14 Aug 2021 20:49:47 -0500 Subject: [PATCH] Mafia Connected support --- scripts/client/event.js | 1 - scripts/client/gui.js | 32 +- scripts/client/item.js | 2 +- scripts/client/job.js | 32 +- scripts/client/label.js | 8 +- scripts/client/logo.js | 6 +- scripts/client/main.js | 2 + scripts/client/messaging.js | 2 +- scripts/client/nametag.js | 18 +- scripts/client/native/mafiac.js | 7 + scripts/client/server.js | 5 +- scripts/client/skin-select.js | 36 +- scripts/client/sync.js | 33 +- scripts/client/utilities.js | 90 ++- scripts/server/account.js | 74 +- scripts/server/business.js | 18 +- scripts/server/clan.js | 14 +- scripts/server/class.js | 4 +- scripts/server/client.js | 37 +- scripts/server/command.js | 9 +- scripts/server/config.js | 863 +--------------------- scripts/server/core.js | 357 --------- scripts/server/database.js | 6 +- scripts/server/developer.js | 14 + scripts/server/event.js | 60 +- scripts/server/house.js | 119 ++- scripts/server/item.js | 117 +-- scripts/server/job.js | 4 +- scripts/server/misc.js | 62 +- scripts/server/moderation.js | 8 +- scripts/server/native/gtac.js | 1127 ++++++++++++++++++++++++++++- scripts/server/native/mafiac.js | 244 ++++++- scripts/server/subaccount.js | 140 ++-- scripts/server/timers.js | 4 +- scripts/server/utilities.js | 19 +- scripts/server/vehicle.js | 31 +- scripts/shared/native/gtac.js | 18 + scripts/shared/native/mafiac.js | 18 + third-party/mexui/Core/Utility.js | 112 +-- 39 files changed, 2084 insertions(+), 1669 deletions(-) diff --git a/scripts/client/event.js b/scripts/client/event.js index eb180e06..7a8bd575 100644 --- a/scripts/client/event.js +++ b/scripts/client/event.js @@ -58,7 +58,6 @@ function addAllEventHandlers() { function onResourceStart(event, resource) { sendResourceStartedSignalToServer(); setUpInitialGame(); - garbageCollectorInterval = setInterval(collectAllGarbage, 1000*60); } diff --git a/scripts/client/gui.js b/scripts/client/gui.js index 8048b33a..7279f16e 100644 --- a/scripts/client/gui.js +++ b/scripts/client/gui.js @@ -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, diff --git a/scripts/client/item.js b/scripts/client/item.js index 0d131063..a1735ae0 100644 --- a/scripts/client/item.js +++ b/scripts/client/item.js @@ -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); // =========================================================================== diff --git a/scripts/client/job.js b/scripts/client/job.js index 32a8ecf3..ba1f5293 100644 --- a/scripts/client/job.js +++ b/scripts/client/job.js @@ -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); + } } // =========================================================================== diff --git a/scripts/client/label.js b/scripts/client/label.js index 6b47843f..bfcc9d3a 100644 --- a/scripts/client/label.js +++ b/scripts/client/label.js @@ -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) { diff --git a/scripts/client/logo.js b/scripts/client/logo.js index 0219f0fd..286e38e1 100644 --- a/scripts/client/logo.js +++ b/scripts/client/logo.js @@ -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(); } diff --git a/scripts/client/main.js b/scripts/client/main.js index 43b43181..3cc12254 100644 --- a/scripts/client/main.js +++ b/scripts/client/main.js @@ -48,4 +48,6 @@ let enterPropertyKey = null; let forcedAnimation = null; +let calledDeathEvent = false; + // =========================================================================== \ No newline at end of file diff --git a/scripts/client/messaging.js b/scripts/client/messaging.js index aa686584..d4852642 100644 --- a/scripts/client/messaging.js +++ b/scripts/client/messaging.js @@ -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); } } } diff --git a/scripts/client/nametag.js b/scripts/client/nametag.js index 8d8c7d5e..6412eea7 100644 --- a/scripts/client/nametag.js +++ b/scripts/client/nametag.js @@ -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) { diff --git a/scripts/client/native/mafiac.js b/scripts/client/native/mafiac.js index 4ee99781..410260e3 100644 --- a/scripts/client/native/mafiac.js +++ b/scripts/client/native/mafiac.js @@ -10,7 +10,14 @@ function setUpInitialGame() { if(mafia.game == GAME_MAFIA_ONE) { mafia.mapEnabled = false; + mafia.setTrafficEnabled(false); } } +// =========================================================================== + +addEventHandler("OnMapLoaded", function(event) { + initClientScripts(); +}); + // =========================================================================== \ No newline at end of file diff --git a/scripts/client/server.js b/scripts/client/server.js index 874acadc..cd7563e2 100644 --- a/scripts/client/server.js +++ b/scripts/client/server.js @@ -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); } // =========================================================================== diff --git a/scripts/client/skin-select.js b/scripts/client/skin-select.js index 106fb215..343d1853 100644 --- a/scripts/client/skin-select.js +++ b/scripts/client/skin-select.js @@ -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); diff --git a/scripts/client/sync.js b/scripts/client/sync.js index ee8c195c..2abb343b 100644 --- a/scripts/client/sync.js +++ b/scripts/client/sync.js @@ -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) { diff --git a/scripts/client/utilities.js b/scripts/client/utilities.js index e68c3e3f..8e73b3a6 100644 --- a/scripts/client/utilities.js +++ b/scripts/client/utilities.js @@ -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)); } } \ No newline at end of file diff --git a/scripts/server/account.js b/scripts/server/account.js index 357d1645..6eeb2158 100644 --- a/scripts/server/account.js +++ b/scripts/server/account.js @@ -522,54 +522,48 @@ function loginSuccess(client) { function saveAccountToDatabase(accountData) { let dbConnection = connectToDatabase(); if(dbConnection) { - //logToConsole(LOG_VERBOSE, `Escaping account data for ${getPlayerDisplayForConsole(client)}`); + logToConsole(LOG_VERBOSE, `Escaping account data for ${accountData.name}`); + let safeAccountName = escapeDatabaseString(dbConnection, accountData.name); + logToConsole(LOG_VERBOSE, `${accountData.name}'s name escaped successfully`); let safePassword = escapeDatabaseString(dbConnection, accountData.password); - //logToConsole(LOG_VERBOSE, `${getPlayerDisplayForConsole(accountData.name)}'s password escaped successfully`); + logToConsole(LOG_VERBOSE, `${accountData.name}'s password escaped successfully`); let safeStaffTitle = escapeDatabaseString(dbConnection, accountData.staffTitle); - //logToConsole(LOG_VERBOSE, `${getPlayerDisplayForConsole(client)}'s staff title escaped successfully`); + logToConsole(LOG_VERBOSE, `${accountData.name}'s staff title escaped successfully`); let safeEmailAddress = escapeDatabaseString(dbConnection, accountData.emailAddress); - //logToConsole(LOG_VERBOSE, `${getPlayerDisplayForConsole(client)}'s email address escaped successfully`); + logToConsole(LOG_VERBOSE, `${accountData.name}'s email address escaped successfully`); - let dbQueryString = - `UPDATE acct_main SET - acct_email='${safeEmailAddress}', - acct_pass='${safePassword}', - acct_discord=${accountData.discordAccount}, - acct_ip=INET_ATON('${accountData.ipAddress}'), - acct_code_verifyemail='${accountData.emailVerificationCode}', - acct_streaming_radio_volume=${accountData.streamingRadioVolume} - WHERE acct_id=${accountData.databaseId}`; + let data = [ + ["acct_name", safeAccountName], + ["acct_pass", safePassword], + //["acct_staff_title", safeStaffTitle], + ["acct_email", safeEmailAddress], + //["acct_irc", safeIRC], + ["acct_discord", accountData.discordAccount], + ["acct_code_verifyemail", accountData.emailVerificationCode], + ["acct_streaming_radio_volume", accountData.streamingRadioVolume], + ["acct_ip", accountData.ipAddress], + ]; - /* - acct_settings=${accountData.settings}, - acct_staff_title='${safeStaffTitle}', - acct_staff_flags=${accountData.flags.admin}, - acct_mod_flags=${accountData.flags.moderation}, - */ - - //dbQueryString = dbQueryString.trim(); - dbQueryString = dbQueryString.replace(/(?:\r\n|\r|\n|\t)/g, ""); - - let dbQuery = queryDatabase(dbConnection, dbQueryString); + let dbQuery = null; + let queryString = createDatabaseUpdateQuery("acct_main", data, `acct_id=${accountData.databaseId}`); + dbQuery = queryDatabase(dbConnection, queryString); freeDatabaseQuery(dbQuery); + + let data2 = [ + ["acct_svr_settings", accountData.flags.settings], + ["acct_svr_staff_title", safeStaffTitle], + ["acct_svr_staff_flags", accountData.flags.admin], + ["acct_svr_mod_flags", accountData.flags.moderation], + ["acct_svr_chat_scroll_lines", accountData.chatScrollLines], + ]; + dbQuery = null; - - dbQueryString = - `UPDATE acct_svr SET - acct_svr_acct='${accountData.databaseId}', - acct_svr_settings=${accountData.flags.settings}, - acct_svr_staff_title='${safeStaffTitle}', - acct_svr_staff_flags=${accountData.flags.admin}, - acct_svr_mod_flags=${accountData.flags.moderation}, - acct_svr_chat_scroll_lines=${accountData.chatScrollLines} - WHERE acct_svr_acct=${accountData.databaseId} AND acct_svr_svr = ${getServerId()}`; - - //dbQueryString = dbQueryString.trim(); - dbQueryString = dbQueryString.replace(/(?:\r\n|\r|\n|\t)/g, ""); - - dbQuery = queryDatabase(dbConnection, dbQueryString); + queryString = ""; + queryString = createDatabaseUpdateQuery("acct_svr", data2, `acct_svr_acct=${accountData.databaseId} AND acct_svr_svr = ${getServerId()}`); + dbQuery = queryDatabase(dbConnection, queryString); freeDatabaseQuery(dbQuery); disconnectFromDatabase(dbConnection); + return true; } } @@ -974,7 +968,7 @@ function createDefaultKeybindsForAccount(accountDatabaseId) { // =========================================================================== function createDefaultAccountServerData(accountDatabaseId) { - for(let i = 1 ; i <= 4 ; i++) { + for(let i = 1 ; i <= 5 ; i++) { let dbQueryString = `INSERT INTO acct_svr (acct_svr_acct, acct_svr_svr) VALUES (${accountDatabaseId}, ${i})`; quickDatabaseQuery(dbQueryString); } diff --git a/scripts/server/business.js b/scripts/server/business.js index e8b1659b..1c80c621 100644 --- a/scripts/server/business.js +++ b/scripts/server/business.js @@ -773,13 +773,13 @@ function buyBusinessCommand(command, params, client) { return false; } - getBusinessData(client).ownerType = VRR_BIZOWNER_PLAYER; - getBusinessData(client).ownerId = getPlayerCurrentSubAccount(client).databaseId; - getBusinessData(client).buyPrice = 0; + getBusinessData(businessId).ownerType = VRR_BIZOWNER_PLAYER; + getBusinessData(businessId).ownerId = getPlayerCurrentSubAccount(client).databaseId; + getBusinessData(businessId).buyPrice = 0; updateBusinessPickupLabelData(businessId); - messagePlayerSuccess(client, `Business ${getInlineChatColourByType("businessBlue")}${getBusinessData(businessId).name} ${getInlineChatColourByName("white")}till has ${getInlineChatColourByName("lightGrey")}$${getBusinessData(businessId).till}`); + messagePlayerSuccess(client, `You are now the owner of ${getInlineChatColourByType("businessBlue")}${getBusinessData(businessId).name}`); } // =========================================================================== @@ -882,7 +882,9 @@ function getPlayerBusiness(client) { function saveAllBusinessesToDatabase() { for(let i in getServerData().businesses) { - saveBusinessToDatabase(i); + if(getServerData().businesses[i].needsSaved) { + saveBusinessToDatabase(i); + } } } @@ -904,7 +906,7 @@ function saveBusinessToDatabase(businessId) { ["biz_entrance_fee", tempBusinessData.entranceFee], ["biz_till", tempBusinessData.till], ["biz_entrance_pos_x", tempBusinessData.entrancePosition.x], - ["biz_entrance_pos_y", tempBusinessData.entrancePosition.x], + ["biz_entrance_pos_y", tempBusinessData.entrancePosition.y], ["biz_entrance_pos_z", tempBusinessData.entrancePosition.z], ["biz_entrance_rot_z", tempBusinessData.entranceRotation], ["biz_entrance_int", tempBusinessData.entranceInterior], @@ -928,10 +930,12 @@ function saveBusinessToDatabase(businessId) { dbQuery = queryDatabase(dbConnection, queryString); getServerData().businesses[businessId].databaseId = getDatabaseInsertId(dbConnection); } else { - let queryString = createDatabaseUpdateQuery("biz_main", data, `WHERE biz_id=${tempBusinessData.databaseId}`); + let queryString = createDatabaseUpdateQuery("biz_main", data, `biz_id=${tempBusinessData.databaseId}`); dbQuery = queryDatabase(dbConnection, queryString); } + getBusinessData(businessId).needsSaved = false; + freeDatabaseQuery(dbQuery); disconnectFromDatabase(dbConnection); return true; diff --git a/scripts/server/clan.js b/scripts/server/clan.js index 6c48756f..6cace7f1 100644 --- a/scripts/server/clan.js +++ b/scripts/server/clan.js @@ -618,6 +618,10 @@ function saveAllClanRanksToDatabase(clanId) { function saveClanToDatabase(clanId) { let tempClanData = getClanData(clanId); + if(!tempClanData) { + return false; + } + let dbConnection = connectToDatabase(); if(dbConnection) { if(tempClanData.needsSaved) { @@ -625,7 +629,7 @@ function saveClanToDatabase(clanId) { let safeTag = escapeDatabaseString(dbConnection, tempClanData.tag); let safeMOTD = escapeDatabaseString(dbConnection, tempClanData.motd); - let queryData = [ + let data = [ ["clan_main", safeName], ["clan_owner", tempClanData.ownerId], ["clan_tag", safeTag], @@ -639,7 +643,7 @@ function saveClanToDatabase(clanId) { getClanData(clanId).databaseId = getDatabaseInsertId(dbConnection); getClanData(clanId).needsSaved = false; } else { - let queryString = createDatabaseUpdateQuery("clan_main", data, `WHERE clan_id=${tempClanData.databaseId} LIMIT 1`); + let queryString = createDatabaseUpdateQuery("clan_main", data, `clan_id=${tempClanData.databaseId} LIMIT 1`); dbQuery = queryDatabase(dbConnection, queryString); getClanData(clanId).needsSaved = false; } @@ -667,7 +671,7 @@ function saveClanRankToDatabase(clanData, rankId) { let safeTag = escapeDatabaseString(dbConnection, tempClanRankData.customTag); let safeTitle = escapeDatabaseString(dbConnection, tempClanRankData.customTitle); - let queryData = [ + let data = [ ["clan_rank_name", safeName], ["clan_rank_clan", tempClanRankData.clanId], ["clan_rank_tag", safeTag], @@ -684,7 +688,7 @@ function saveClanRankToDatabase(clanData, rankId) { getClanRankData(clanId, rankId).databaseId = getDatabaseInsertId(dbConnection); getClanRankData(clanId, rankId).needsSaved = false; } else { - let queryString = createDatabaseUpdateQuery("clan_rank_main", data, `WHERE clan_rank_id=${tempClanRankData.databaseId} LIMIT 1`); + let queryString = createDatabaseUpdateQuery("clan_rank_main", data, `clan_rank_id=${tempClanRankData.databaseId} LIMIT 1`); dbQuery = queryDatabase(dbConnection, queryString); getClanRankData(clanId, rankId).needsSaved = false; } @@ -738,7 +742,7 @@ function setClanRankTitle(clanId, rankId, title) { function saveAllClansToDatabase() { for(let i in getServerData().clans) { - saveClanToDatabase(getServerData().clans[i]); + saveClanToDatabase(i); } } diff --git a/scripts/server/class.js b/scripts/server/class.js index 501fe962..19d52344 100644 --- a/scripts/server/class.js +++ b/scripts/server/class.js @@ -414,8 +414,9 @@ function initClassTable() { this.account = toInteger(dbAssoc["sacct_acct"]); this.skin = toInteger(dbAssoc["sacct_svr_skin"]); this.cash = toInteger(dbAssoc["sacct_cash"]); + console.log(dbAssoc["sacct_pos_x"]); this.spawnPosition = toVector3(toFloat(dbAssoc["sacct_pos_x"]), toFloat(dbAssoc["sacct_pos_y"]), toFloat(dbAssoc["sacct_pos_z"])); - this.spawnHeading = toFloat(dbAssoc["sacct_angle"]); + this.spawnHeading = toFloat(dbAssoc["sacct_rot_z"]); this.lastLogin = toInteger(dbAssoc["sacct_when_lastlogin"]); this.clan = toInteger(dbAssoc["sacct_svr_clan"]); this.clanFlags = toInteger(dbAssoc["sacct_svr_clan_flags"]); @@ -1267,6 +1268,7 @@ function initClassTable() { this.supplyMultiplier = 1; this.riskMultiplier = 1; this.needsSaved = false; + this.useDelay = 0; this.switchDelay = 0; this.pickupDelay = 0; this.putDelay = 0; diff --git a/scripts/server/client.js b/scripts/server/client.js index f1daf516..c34ed29e 100644 --- a/scripts/server/client.js +++ b/scripts/server/client.js @@ -522,12 +522,9 @@ function showPlayerItemTakeDelay(client, itemId) { if(delay > 0) { logToConsole(LOG_DEBUG, `[VRR.Client] Showing item TAKE delay to ${getPlayerDisplayForConsole(client)} (${delay} milliseconds)`); triggerNetworkEvent("vrr.showItemActionDelay", client, delay); - setTimeout(function() { - playerItemActionDelayComplete(client); - }, delay+getGlobalConfig().itemActionDelayExtraTimeout); } else { logToConsole(LOG_DEBUG, `[VRR.Client] Showing item TAKE delay to ${getPlayerDisplayForConsole(client)} (instant)`); - playerTakeItem(client, itemId); + playerItemActionDelayComplete(client); } } } @@ -540,12 +537,9 @@ function showPlayerItemUseDelay(client, itemSlot) { if(delay > 0) { logToConsole(LOG_DEBUG, `[VRR.Client] Showing item USE delay to ${getPlayerDisplayForConsole(client)} (${delay} milliseconds)`); triggerNetworkEvent("vrr.showItemActionDelay", client, delay); - setTimeout(function() { - playerItemActionDelayComplete(client); - }, delay+getGlobalConfig().itemActionDelayExtraTimeout); } else { logToConsole(LOG_DEBUG, `[VRR.Client] Showing item USE delay to ${getPlayerDisplayForConsole(client)} (instant)`); - playerUseItem(client, itemSlot); + playerItemActionDelayComplete(client); } } } @@ -558,12 +552,9 @@ function showPlayerItemDropDelay(client, itemSlot) { if(delay > 0) { logToConsole(LOG_DEBUG, `[VRR.Client] Showing item DROP delay to ${getPlayerDisplayForConsole(client)} (${delay} milliseconds)`); triggerNetworkEvent("vrr.showItemActionDelay", client, delay); - setTimeout(function() { - playerItemActionDelayComplete(client); - }, delay+getGlobalConfig().itemActionDelayExtraTimeout); } else { logToConsole(LOG_DEBUG, `[VRR.Client] Showing item DROP delay to ${getPlayerDisplayForConsole(client)} (instant)`); - playerDropItem(client, itemSlot); + playerItemActionDelayComplete(client); } } } @@ -576,12 +567,9 @@ function showPlayerItemPickupDelay(client, itemId) { if(delay > 0) { logToConsole(LOG_DEBUG, `[VRR.Client] Showing item PICKUP delay to ${getPlayerDisplayForConsole(client)} (${delay} milliseconds)`); triggerNetworkEvent("vrr.showItemActionDelay", client, delay); - setTimeout(function() { - playerItemActionDelayComplete(client); - }, delay+getGlobalConfig().itemActionDelayExtraTimeout); } else { logToConsole(LOG_DEBUG, `[VRR.Client] Showing item PICKUP delay to ${getPlayerDisplayForConsole(client)} (instant)`); - playerPickupItem(client, itemId); + playerItemActionDelayComplete(client); } } } @@ -594,12 +582,9 @@ function showPlayerItemPutDelay(client, itemSlot) { if(delay > 0) { logToConsole(LOG_DEBUG, `[VRR.Client] Showing item PUT delay to ${getPlayerDisplayForConsole(client)} (${delay} milliseconds)`); triggerNetworkEvent("vrr.showItemActionDelay", client, delay); - setTimeout(function() { - playerItemActionDelayComplete(client); - }, delay+getGlobalConfig().itemActionDelayExtraTimeout); } else { logToConsole(LOG_DEBUG, `[VRR.Client] Showing item PUT delay to ${getPlayerDisplayForConsole(client)} (instant)`); - playerPutItem(client, itemSlot); + playerItemActionDelayComplete(client); } } } @@ -610,14 +595,16 @@ function showPlayerItemSwitchDelay(client, itemSlot) { if(itemSlot != -1) { if(getPlayerData(client).hotBarItems[itemSlot] != -1) { let delay = getItemTypeData(getItemData(getPlayerData(client).hotBarItems[itemSlot]).itemTypeIndex).switchDelay; - logToConsole(LOG_DEBUG, `[VRR.Client] Showing item switch delay to ${getPlayerDisplayForConsole(client)} (${delay} milliseconds)`); - triggerNetworkEvent("vrr.showItemActionDelay", client, delay); - setTimeout(function() { + if(delay > 0) { + logToConsole(LOG_DEBUG, `[VRR.Client] Showing item switch delay to ${getPlayerDisplayForConsole(client)} (${delay} milliseconds)`); + triggerNetworkEvent("vrr.showItemActionDelay", client, delay); + } else{ + logToConsole(LOG_DEBUG, `[VRR.Client] Showing item switch delay to ${getPlayerDisplayForConsole(client)} (instant)`); playerItemActionDelayComplete(client); - }, delay+getGlobalConfig().itemActionDelayExtraTimeout); + } } else { logToConsole(LOG_DEBUG, `[VRR.Client] Showing item switch delay to ${getPlayerDisplayForConsole(client)} (instant)`); - playerSwitchItem(client, itemSlot); + playerItemActionDelayComplete(client); } } else { logToConsole(LOG_DEBUG, `[VRR.Client] Showing item switch delay to ${getPlayerDisplayForConsole(client)} (instant)`); diff --git a/scripts/server/command.js b/scripts/server/command.js index 81b1bcc4..f09c2269 100644 --- a/scripts/server/command.js +++ b/scripts/server/command.js @@ -196,11 +196,12 @@ function loadCommands() { commandData("housereloadall", reloadAllHousesCommand, "", getStaffFlagValue("manageHouses"), true, false), commandData("houseinfo", getHouseInfoCommand, "", getStaffFlagValue("none"), true, false), - commandData("housedesc", setHouseDescriptionCommand, "", getStaffFlagValue("none"), true, false), + commandData("housebuy", buyHouseCommand, "", getStaffFlagValue("none"), true, false), + commandData("housedesc", setHouseDescriptionCommand, "", getStaffFlagValue("manageHouses"), true, false), commandData("houselock", lockUnlockHouseCommand, "", getStaffFlagValue("none"), true, false), - commandData("houseowner", setHouseOwnerCommand, "", getStaffFlagValue("none"), true, false), - //commandData("housebuyprice", setHouseBuyPriceCommand, "", getStaffFlagValue("none"), true, false), - //commandData("houserentprice", setHouseRentPriceCommand, "", getStaffFlagValue("none"), true, false), + commandData("houseowner", setHouseOwnerCommand, "", getStaffFlagValue("manageHouses"), true, false), + commandData("housebuyprice", setHouseBuyPriceCommand, "", getStaffFlagValue("none"), true, false), + commandData("houserentprice", setHouseRentPriceCommand, "", getStaffFlagValue("none"), true, false), commandData("houseblip", setHouseBlipCommand, "", getStaffFlagValue("manageHouses"), true, true), commandData("housepickup", setHousePickupCommand, "", getStaffFlagValue("manageHouses"), true, true), commandData("houseentrance", moveHouseEntranceCommand, "", getStaffFlagValue("manageHouses"), true, true), diff --git a/scripts/server/config.js b/scripts/server/config.js index c2b6897f..e806bd58 100644 --- a/scripts/server/config.js +++ b/scripts/server/config.js @@ -62,868 +62,7 @@ function loadGlobalConfig() { // =========================================================================== function loadGameConfig() { - return { - blipSprites: [ - false, - { // GTA III - policeStation: 8, - fireStation: 9, - hospital: 12, - ammunation: 20, - payAndSpray: 18, - vehicleDealership: 6, - restaurant: -1, - fastFood: -1, - bank: 0, - fuelStation: -1, - business: -1, - house: -1, - }, - { // GTA VC - policeStation: 0, - fireStation: 0, - hospital: 0, - ammunation: 16, - payAndSpray: 27, - vehicleDealership: 7, - restaurant: -1, - fastFood: -1, - bank: 0, - fuelStation: -1, - business: -1, - house: -1, - }, - { // GTA SA - policeStation: 30, - fireStation: 20, - hospital: 22, - ammunation: 6, - payAndSpray: 63, - vehicleDealership: 55, - airplaneDealership: 5, - boatDealership: 9, - restaurant: 50, - fastFood: -1, - clothes: 45, - pizza: 29, - chicken: 14, - burger: 10, - bank: 52, - gasStation: 17, - business: -1, - house: 31, - bar: 49, - club: 48, - gym: 54, - repairGarage: 27, - trophy: 33, - race2: 53, - job: 56, - }, - { // GTA UG - policeStation: 8, - fireStation: 9, - hospital: 12, - ammunation: 20, - payAndSpray: 18, - vehicleDealership: 6, - restaurant: -1, - fastFood: -1, - bank: 52, - fuelStation: 0, - business: -1, - house: -1, - }, - { // GTA IV - policeStation: 8, - fireStation: 9, - hospital: 12, - ammunation: 20, - payAndSpray: 18, - vehicleDealership: 6, - restaurant: -1, - fastFood: -1, - bank: 52, - fuelStation: 0, - business: -1, - house: -1, - }, - ], - pickupModels: [ - {}, - - { // GTA 3 - policeStation: 1361, - fireStation: 1361, - hospital: 1361, - ammunation: 1361, - payAndSpray: 1361, - vehicleDealership: 1361, - restaurant: 1361, - fastFood: 1361, - bank: 1323, - fuelStation: 1361, - business: 1361, - house: 1361, - clothes: 1361, - misc: 1361, - exit: 1361 - }, - - { // GTA Vice City - policeStation: 375, - fireStation: 406, - hospital: 366, - ammunation: 406, - payAndSpray: 406, - vehicleDealership: 406, - restaurant: 406, - fastFood: 406, - bank: 408, - fuelStation: 406, - business: 406, - house: 407, - clothes: 409, - misc: 406, - exit: 406, - }, - - { // GTA San Andreas - policeStation: 1247, - fireStation: 1318, - hospital: 1240, - ammunation: 1239, - payAndSpray: 1239, - vehicleDealership: 1239, - restaurant: 1239, - fastFood: 1239, - bank: 1274, - fuelStation: 1239, - business: 1272, - house: 1273, - clothes: 1275, - misc: 1239, - exit: 1318, - } - ], - pickupTypes: [ - {}, - - { // GTA 3 - business: 0, - house: 0, - bank: 0, - clothes: 0, - info: 0, - job: 0, - }, - - { // GTA Vice City - business: 2, - house: 2, - bank: 2, - clothes: 2, - info: 2, - job: 2, - }, - - { // GTA San Andreas - business: 1, - house: 1, - bank: 1, - clothes: 1, - info: 1, - job: 1, - } - ], - - // THIS IS SCREEN HEIGHT, NOT ACTUAL DOOR POSITION IN THE WORLD - propertyLabelHeight: [ - false, - 85, - 85, - 85, - 85, - 85, - 85, - ], - - removedWorldObjects: [ - false, - - [ // GTA III - new serverClasses.removedWorldObjectData("fraightback04", toVector3(1229.88, -84.8012, 13.4004), 50.0), // Truck trailer in Easy Credit Autos dealership parking lot - new serverClasses.removedWorldObjectData("fraightback03", toVector3(1239.49, -68.0529, 11.6914), 50.0), // Truck trailer in Easy Credit Autos dealership parking lot - ], - - [ // GTA VC - - ], - - [ // GTA SA - - ], - - [ // GTA UG - - ], - - [ // GTA IV - - ], - ], - - excludedGroundSnowModels: [ - false, - - [ // GTA III - - ], - - [ // GTA VC - - ], - - [ // GTA SA - // Twin tunnels from Rodeo, Los Santos to/from Flint County - 13682, // TCElawcuntunb - 13680, // TCElawcuntunb - 13676, // TCElawcuntun1a_law2 - 13677, // TCElawcuntun1a_law2 - - // Los Santos - 6387, // century03_LAw2 (L.A. Century Plaza underground parking) - 17633, // lae2_ground08 - 4818, // TRNTRK8_LAS - 4884, // lastranentun1_LAS - 4885, // lastranentun4_LAS - - // Train Tunnel under Los Santos - 6248, // RailTunn01_LAw - 6249, // RailTunn02_LAw - 6250, // RailTunn03_LAw - 6251, // RailTunn04_LAw - 6252, // RailTunn05_LAw - 5772, // RailTunn01_LAwN (Market Station lower level) - 5773, // TrainStat01_LAwN (Market Station upper/ground level) - 6502, // RailTunn04_LAw2 - 6290, // RailTunn02_LAw2 - 6501, // RailTunn03_LAw2 - 6292, // RailTunn01_LAw2N - - 6966, // vegasNbank1 (L.V. north building underground parking, upper level) - 7245, // vegasNbank1ug (L.V. north building underground parking, lower level) - 7011, // courthse_vgn01 (L.V. courthouse parking structure) - 8390, // multicarpark01_lvS (Large parking structure next to pyramid) - - // Train tunnel next to Las Venturas - 6982, // vgsNtraintunnel01 - 6983, // vgsNtraintunnel02 - 6984, // vgsNtraintunnel03 - 6981, // vgsNtraintunnel04 - ], - - [ // GTA UG - - ], - - [ // GTA IV - - ], - ], - defaultBusinessItems: - [ - { - - }, - { - clothingStore: [ - ["Outfit", 500, 2] - ], - legalGunStore: [ - ["Colt 45", 500, 2], - ["Shotgun", 500, 2], - ["Baseball Bat", 500, 2] - ], - illegalGunStore: [ - ["Uzi", 500, 2], - ["AK-47", 500, 2], - ["M16", 500, 2], - ["Sniper Rifle", 500, 2] - ], - gasStation: [ - ["Bottle of Soda", 500, 2], - ["Can of Soda", 500, 2], - ["Slice of Pizza", 500, 2], - ["Bottle of Water", 500, 2], - ["Can of Beer", 500, 2], - ], - electronicsStore: [ - ["Phone", 500, 2], - ["Walkie Talkie", 500, 2], - ["Megaphone", 500, 2], - ["Tazer", 500, 2], - ["Camera", 500, 2], - ], - bar: [ - ["Bottle of Vodka", 500, 2], - ["Bottle of Whiskey", 500, 2], - ["Bottle of Soda", 500, 2], - ["Bottle of Wine", 500, 2], - ["Bottle of Bourbon", 500, 2], - ["Shot of Bourbon", 500, 2], - ["Shot of Vodka", 500, 2], - ["Shot of Whiskey", 500, 2], - ["Glass of Wine", 500, 2], - ], - club: [ - ["Bottle of Vodka", 500, 2], - ["Bottle of Whiskey", 500, 2], - ["Bottle of Soda", 500, 2], - ["Bottle of Wine", 500, 2], - ["Bottle of Bourbon", 500, 2], - ["Shot of Bourbon", 500, 2], - ["Shot of Vodka", 500, 2], - ["Shot of Whiskey", 500, 2], - ["Glass of Wine", 500, 2], - ], - chicken: [ - ["Bucket of Chicken", 500, 2], - ["Chicken Tenders Meal", 500, 2], - ["Large Fries", 500, 2], - ["Small Fries", 500, 2], - ["Bottle of Soda", 500, 2], - ], - burger: [ - ["Bacon Cheeseburger", 500, 2], - ["Double Cheeseburger", 500, 2], - ["Big Boy Burger", 500, 2], - ["Large Fries", 500, 2], - ["Small Fries", 500, 2], - ["Bottle of Soda", 500, 2], - ], - chinese: [ - ["Egg Roll", 500, 2], - ["Lo Mein", 500, 2], - ["Fried Rice", 500, 2], - ["Crab Rangoon", 500, 2], - ["Egg Drop Soup", 500, 2], - ["Moo Shu Pork", 500, 2], - ["Egg Foo Young", 500, 2], - ["Sesame Chicken", 500, 2], - ], - italian: [ - ["Bottle of Wine", 500, 2], - ["Glass of Wine", 500, 2], - ["Arancini", 500, 2], - ["Lasagne", 500, 2], - ["Chicken Alfredo", 500, 2], - ["Fettucine Alfredo", 500, 2], - ["Chicken Parmigiana", 500, 2], - ["Chicken Carbonara", 500, 2], - ["Sausage Rigatoni", 500, 2], - ["Chicken Salad", 500, 2], - ["Caesar Salad", 500, 2], - ], - mexican: [ - ["Crunchy Taco", 500, 2], - ["Beaf and Bean Burrito", 500, 2], - ["Burrito Supreme", 500, 2], - ["Cheesy Nachos", 500, 2], - ["Nacho Supreme", 500, 2], - ["Bottle of Soda", 500, 2], - ], - pizza: [ - ["Large Pizza", 500, 2], - ["Medium Pizza", 500, 2], - ["Small Pizza", 500, 2], - ["Buffalo Wings", 500, 2], - ["Hot Wings", 500, 2], - ["Bottle of Soda", 500, 2], - ], - }, - { - clothingStore: [ - ["Outfit", 500, 2] - ], - legalGunStore: [ - ["Colt .45", 500, 2], - ["Python", 500, 2], - ["Shotgun", 500, 2], - ["Stubby Shotgun", 500, 2], - ["Baseball Bat", 500, 2], - ["Brass Knuckles", 500, 2], - ], - illegalGunStore: [ - ["Uzi", 500, 2], - ["MP5", 500, 2], - ["Tec-9", 500, 2], - ["Ingram", 500, 2], - ["Ruger", 500, 2], - ["M4", 500, 2], - ["Sniper Rifle", 500, 2], - ["Laser Sniper", 500, 2], - ], - gasStation: [ - ["Bottle of Soda", 500, 2], - ["Can of Soda", 500, 2], - ["Slice of Pizza", 500, 2], - ["Bottle of Water", 500, 2], - ["Can of Beer", 500, 2] - ], - electronicsStore: [ - ["Phone", 500, 2], - ["Walkie Talkie", 500, 2], - ["Megaphone", 500, 2], - ["Tazer", 500, 2], - ["Camera", 500, 2] - ], - bar: [ - ["Bottle of Vodka", 500, 2], - ["Bottle of Whiskey", 500, 2], - ["Bottle of Soda", 500, 2], - ["Bottle of Wine", 500, 2], - ["Bottle of Bourbon", 500, 2], - ["Shot of Bourbon", 500, 2], - ["Shot of Vodka", 500, 2], - ["Shot of Whiskey", 500, 2], - ["Glass of Wine", 500, 2], - ], - club: [ - ["Bottle of Vodka", 500, 2], - ["Bottle of Whiskey", 500, 2], - ["Bottle of Soda", 500, 2], - ["Bottle of Wine", 500, 2], - ["Bottle of Bourbon", 500, 2], - ["Shot of Bourbon", 500, 2], - ["Shot of Vodka", 500, 2], - ["Shot of Whiskey", 500, 2], - ["Glass of Wine", 500, 2], - ], - chicken: [ - ["Bucket of Chicken", 500, 2], - ["Chicken Tenders Meal", 500, 2], - ["Large Fries", 500, 2], - ["Small Fries", 500, 2], - ["Bottle of Soda", 500, 2], - ], - burger: [ - ["Bacon Cheeseburger", 500, 2], - ["Double Cheeseburger", 500, 2], - ["Big Boy Burger", 500, 2], - ["Large Fries", 500, 2], - ["Small Fries", 500, 2], - ["Bottle of Soda", 500, 2], - ], - chinese: [ - ["Egg Roll", 500, 2], - ["Lo Mein", 500, 2], - ["Fried Rice", 500, 2], - ["Crab Rangoon", 500, 2], - ["Egg Drop Soup", 500, 2], - ["Moo Shu Pork", 500, 2], - ["Egg Foo Young", 500, 2], - ["Sesame Chicken", 500, 2], - ], - italian: [ - ["Bottle of Wine", 500, 2], - ["Glass of Wine", 500, 2], - ["Arancini", 500, 2], - ["Lasagne", 500, 2], - ["Chicken Alfredo", 500, 2], - ["Fettucine Alfredo", 500, 2], - ["Chicken Parmigiana", 500, 2], - ["Chicken Carbonara", 500, 2], - ["Sausage Rigatoni", 500, 2], - ["Chicken Salad", 500, 2], - ["Caesar Salad", 500, 2], - ], - mexican: [ - ["Crunchy Taco", 500, 2], - ["Beaf and Bean Burrito", 500, 2], - ["Burrito Supreme", 500, 2], - ["Cheesy Nachos", 500, 2], - ["Nacho Supreme", 500, 2], - ["Bottle of Soda", 500, 2], - ], - pizza: [ - ["Large Pizza", 500, 2], - ["Medium Pizza", 500, 2], - ["Small Pizza", 500, 2], - ["Buffalo Wings", 500, 2], - ["Hot Wings", 500, 2], - ["Bottle of Soda", 500, 2], - ], - }, - { - clothingStore: [ - ["Outfit", 500, 2] - ], - legalGunStore: [ - ["Baseball Bat", 500, 2], - ["Pepper Spray", 500, 2], - ["Brass Knuckles", 500, 2], - ["9mm", 500, 2], - ["Desert Eagle", 500, 2], - ["Shotgun", 500, 2], - ["Country Rifle", 500, 2] - ], - illegalGunStore: [ - ["Micro SMG/Uzi", 500, 2], - ["MP5", 500, 2], - ["Tec-9", 500, 2], - ["AK-47", 500, 2], - ["M4", 500, 2], - ["Combat Shotgun", 500, 2], - ["Sniper Rifle", 500, 2] - ], - sexShop: [ - ["Purple Dildo", 500, 2], - ["Dildo", 500, 2], - ["Vibrator", 500, 2], - ["Silver Vibrator", 500, 2], - ["Flowers", 500, 2] - ], - gasStation: [ - ["Bottle of Soda", 500, 2], - ["Can of Soda", 500, 2], - ["Slice of Pizza", 500, 2], - ["Bottle of Water", 500, 2], - ["Can of Beer", 500, 2] - ], - electronicsStore: [ - ["Phone", 500, 2], - ["Walkie Talkie", 500, 2], - ["Megaphone", 500, 2], - ["Tazer", 500, 2], - ["Camera", 500, 2] - ], - bar: [ - ["Bottle of Vodka", 500, 2], - ["Bottle of Whiskey", 500, 2], - ["Bottle of Soda", 500, 2], - ["Bottle of Wine", 500, 2], - ["Bottle of Bourbon", 500, 2], - ["Shot of Bourbon", 500, 2], - ["Shot of Vodka", 500, 2], - ["Shot of Whiskey", 500, 2], - ["Glass of Wine", 500, 2], - ], - club: [ - ["Bottle of Vodka", 500, 2], - ["Bottle of Whiskey", 500, 2], - ["Bottle of Soda", 500, 2], - ["Bottle of Wine", 500, 2], - ["Bottle of Bourbon", 500, 2], - ["Shot of Bourbon", 500, 2], - ["Shot of Vodka", 500, 2], - ["Shot of Whiskey", 500, 2], - ["Glass of Wine", 500, 2], - ], - chicken: [ - ["Bucket of Chicken", 500, 2], - ["Chicken Tenders Meal", 500, 2], - ["Large Fries", 500, 2], - ["Small Fries", 500, 2], - ["Bottle of Soda", 500, 2], - ], - burger: [ - ["Bacon Cheeseburger", 500, 2], - ["Double Cheeseburger", 500, 2], - ["Big Boy Burger", 500, 2], - ["Large Fries", 500, 2], - ["Small Fries", 500, 2], - ["Bottle of Soda", 500, 2], - ], - chinese: [ - ["Egg Roll", 500, 2], - ["Lo Mein", 500, 2], - ["Fried Rice", 500, 2], - ["Crab Rangoon", 500, 2], - ["Egg Drop Soup", 500, 2], - ["Moo Shu Pork", 500, 2], - ["Egg Foo Young", 500, 2], - ["Sesame Chicken", 500, 2], - ], - italian: [ - ["Bottle of Wine", 500, 2], - ["Glass of Wine", 500, 2], - ["Arancini", 500, 2], - ["Lasagne", 500, 2], - ["Chicken Alfredo", 500, 2], - ["Fettucine Alfredo", 500, 2], - ["Chicken Parmigiana", 500, 2], - ["Chicken Carbonara", 500, 2], - ["Sausage Rigatoni", 500, 2], - ["Chicken Salad", 500, 2], - ["Caesar Salad", 500, 2], - ], - mexican: [ - ["Crunchy Taco", 500, 2], - ["Beaf and Bean Burrito", 500, 2], - ["Burrito Supreme", 500, 2], - ["Cheesy Nachos", 500, 2], - ["Nacho Supreme", 500, 2], - ["Bottle of Soda", 500, 2], - ], - pizza: [ - ["Large Pizza", 500, 2], - ["Medium Pizza", 500, 2], - ["Small Pizza", 500, 2], - ["Buffalo Wings", 500, 2], - ["Hot Wings", 500, 2], - ["Bottle of Soda", 500, 2], - ], - } - ], - interiorTemplates: [ - false, - - { // GTA 3 - - }, - - { // GTA VC - mall: new serverClasses.interiorTemplateData(toVector3(379.62, 1007.00, 19.22), 4), - malibu: new serverClasses.interiorTemplateData(toVector3(489.83, -76.49, 11.48), 17), - vcpd: new serverClasses.interiorTemplateData(toVector3(396.38, -472.96, 12.34), 12), - apartment: new serverClasses.interiorTemplateData(toVector3(26.67, -1328.89, 13.00), 11), - hotelLobby: new serverClasses.interiorTemplateData(toVector3(228.53, -1277.12, 12.07), 1), - bikerBar: new serverClasses.interiorTemplateData(toVector3(-597.41, 651.84, 11.30), 11), - mansion: new serverClasses.interiorTemplateData(toVector3(-379.14, -551.65, 19.32), 2), - gunRange: new serverClasses.interiorTemplateData(toVector3(-667.79, 1217.51, 11.10), 10), - bank: new serverClasses.interiorTemplateData(toVector3(-894.52, -341.16, 13.45), 3), - stripClub: new serverClasses.interiorTemplateData(toVector3(97.53, -1472.06, 10.43), 5), - rosenberg: new serverClasses.interiorTemplateData(toVector3(120.82, -827.98, 10.62), 6), - arena: new serverClasses.interiorTemplateData(toVector3(-1080.49, 1331.16, 13.91), 15), - ghettoShack: new serverClasses.interiorTemplateData(toVector3(-962.74, 146.96, 9.40), 12), - hotelRoom: new serverClasses.interiorTemplateData(toVector3(226.47, -1274.98, 19.271), 2.933), - - }, - - { // GTA SA - lspd: new serverClasses.interiorTemplateData(toVector3(247.113, 62.929, 1003.64), 2), - lvpd: new serverClasses.interiorTemplateData(toVector3(288.82, 167.39, 1007.17), 3), - sfpd: new serverClasses.interiorTemplateData(toVector3(246.40, 110.84, 1003.22), 10), - reeceBarberShop: new serverClasses.interiorTemplateData(toVector3(411.62, -21.43, 1001.80), 2), - fourDragons: new serverClasses.interiorTemplateData(toVector3(2016.26, 1017.77, 996.87), 10), - caligula: new serverClasses.interiorTemplateData(toVector3(2233.8, 1712.23, 1011.76), 1), - genericCasino: new serverClasses.interiorTemplateData(toVector3(1118.88, -10.27, 1002.08), 12), - cluckinBell: new serverClasses.interiorTemplateData(toVector3(365.71, -9.88, 1001.85), 9), - pizzaStack: new serverClasses.interiorTemplateData(toVector3(372.35, -131.65, 1001.49), 5), - burgerShot: new serverClasses.interiorTemplateData(toVector3(375.96, -65.81, 1001.50), 10), - tattooParlor: new serverClasses.interiorTemplateData(toVector3(-203.07, -24.16, 1002.27), 16), - bank: new serverClasses.interiorTemplateData(toVector3(2305.14, -16.274, 26.74), 1), - gas1: new serverClasses.interiorTemplateData(toVector3(-25.88, -185.86, 1003.54), 17), - gas2: new serverClasses.interiorTemplateData(toVector3(6.09, -29.27, 1003.54), 10), - gas3: new serverClasses.interiorTemplateData(toVector3(-30.94, -89.60, 1003.54), 18), - gas4: new serverClasses.interiorTemplateData(toVector3(-25.13, -139.06, 1003.54), 16), - gas5: new serverClasses.interiorTemplateData(toVector3( -27.31, -29.27, 1003.54), 4), - gas6: new serverClasses.interiorTemplateData(toVector3(-26.69, -55.71, 1003.54), 6), - shamal: new serverClasses.interiorTemplateData(toVector3(2.38, 33.10, 1199.84), 1), - andromeda: new serverClasses.interiorTemplateData(toVector3(315.85, 1024.49, 1949.79), 9), - airportTickets: new serverClasses.interiorTemplateData(toVector3(-1827.14, 7.20, 1061.14), 14), - airportBaggage: new serverClasses.interiorTemplateData(toVector3(-1855.56, 41.26, 1061.14), 14), - ammu1: new serverClasses.interiorTemplateData(toVector3(286.14, -40.64, 1001.56), 1), - ammu2: new serverClasses.interiorTemplateData(toVector3(286.80, -82.54, 1001.53), 4), - ammu3: new serverClasses.interiorTemplateData(toVector3(296.91, -108.07, 1001.56), 6), - ammu4: new serverClasses.interiorTemplateData(toVector3(314.82, -141.43, 999.66), 7), - ammu5: new serverClasses.interiorTemplateData(toVector3(316.52, -167.70, 999.66), 6), - ammuBooth: new serverClasses.interiorTemplateData(toVector3(302.29, -143.13, 1004.06), 7), - ammuRange: new serverClasses.interiorTemplateData(toVector3(280.79, -135.20, 1004.06), 7), - house1: new serverClasses.interiorTemplateData(toVector3(235.51, 1189.17, 1080.34), 3), - house2: new serverClasses.interiorTemplateData(toVector3(225.76, 1240.00, 1082.15), 2), - house3: new serverClasses.interiorTemplateData(toVector3(223.04, 1289.26, 1082.20), 1), - house4: new serverClasses.interiorTemplateData(toVector3(225.63, 1022.48, 1084.07), 7), - house5: new serverClasses.interiorTemplateData(toVector3(295.14, 1474.47, 1080.52), 15), - house6: new serverClasses.interiorTemplateData(toVector3(328.49, 1480.59, 1084.45), 15), - house7: new serverClasses.interiorTemplateData(toVector3(385.80, 1471.77, 1080.21), 15), - atrium: new serverClasses.interiorTemplateData(toVector3(1726.18, -1641.00, 20.23), 18), - crackPalace: new serverClasses.interiorTemplateData(toVector3(2,567.52, -1294.59, 1063.25), 2), - bloodbowlStadium: new serverClasses.interiorTemplateData(toVector3(-1394.20, 987.62, 1023.96), 15), - burningDesireHouse: new serverClasses.interiorTemplateData(toVector3(2338.32, -1180.61, 1027.98), 5), - furhbergerHouse: new serverClasses.interiorTemplateData(toVector3(2807.63, -1170.15, 1025.57), 8), - dillimoreGas: new serverClasses.interiorTemplateData(toVector3(664.19, -570.73, 16.34), 0), - donutShop: new serverClasses.interiorTemplateData(toVector3(376.99, -191.21, 1000.63), 17), - airport: new serverClasses.interiorTemplateData(toVector3(-1830.81, 16.83, 1061.14), 14), - jeffersonMotel: new serverClasses.interiorTemplateData(toVector3(2220.26, -1,148.01, 1025.80), 15), - kickstartStadium: new serverClasses.interiorTemplateData(toVector3(-1410.72, 1,591.16, 1052.53), 14), - libertyCity: new serverClasses.interiorTemplateData(toVector3(-750.80, 491.00, 1371.70), 1), - lsxBaggageReclaim: new serverClasses.interiorTemplateData(toVector3(-1870.80, 59.81, 1056.25), 14), - jizzy: new serverClasses.interiorTemplateData(toVector3(-2637.69, 1404.24, 906.46), 3), - rcBattlefield: new serverClasses.interiorTemplateData(toVector3(-1079.99, 1061.58, 1343.04), 10), - ryderHouse: new serverClasses.interiorTemplateData(toVector3(2451.77, -1699.80, 1013.51), 2), - sfGarage: new serverClasses.interiorTemplateData(toVector3(-2042.42, 178.59, 28.84), 1), - sweetHouse: new serverClasses.interiorTemplateData(toVector3(2535.83, -1,674.32, 1015.50), 1), - katieHouse: new serverClasses.interiorTemplateData(toVector3(267.22, 304.71, 999.14), 2), - helenaHouse: new serverClasses.interiorTemplateData(toVector3(292.44, 308.77, 999.14), 3), - welcomePump: new serverClasses.interiorTemplateData(toVector3(681.66, -453.32, -25.61), 1), - woozieApartment: new serverClasses.interiorTemplateData(toVector3(-2158.72, 641.29, 1052.38), 1), - eightTrackStadium: new serverClasses.interiorTemplateData(toVector3(-1395.96, -208.20, 1051.17), 7), - dirtBikeStadium: new serverClasses.interiorTemplateData(toVector3(-1424.93, -664.59, 1059.86), 4), - crackDen: new serverClasses.interiorTemplateData(toVector3(318.57, 1115.21, 1082.98), 5), - motelRoom: new serverClasses.interiorTemplateData(toVector3(2251.85, -1138.16, 1050.63), 9), - hashburyHouse: new serverClasses.interiorTemplateData(toVector3(2260.76, -1210.45, 1049.02), 10), - cjHouse: new serverClasses.interiorTemplateData(toVector3(2496.65, -1696.55, 1014.74), 3), - maddDoggMansion: new serverClasses.interiorTemplateData(toVector3(1299.14, -794.77, 1084.00), 5), - motelRoom2: new serverClasses.interiorTemplateData(toVector3(2262.83, -1137.71, 1050.63), 10), - safeHouse1: new serverClasses.interiorTemplateData(toVector3(2365.42, -1131.85, 1050.88), 8), - safeHouse2: new serverClasses.interiorTemplateData(toVector3(2324.33, -1144.79, 1050.71), 12), - zeroStore: new serverClasses.interiorTemplateData(toVector3(-2240.00, 131.00, 1035.40), 6), - brothel1: new serverClasses.interiorTemplateData(toVector3(940.65, -18.48, 1000.93), 3), - brothel2: new serverClasses.interiorTemplateData(toVector3(967.53, -53.02, 1001.12), 3), - brothel3: new serverClasses.interiorTemplateData(toVector3(744.27, 1437.25, 1102.70), 6), - prolapsStore: new serverClasses.interiorTemplateData(toVector3(207.35, -138.00, 1003.31), 3), - victimStore: new serverClasses.interiorTemplateData(toVector3(221.33, -6.61, 1005.19), 5), - suburbanStore: new serverClasses.interiorTemplateData(toVector3(203.81, -46.53, 1001.80), 1), - sexShop: new serverClasses.interiorTemplateData(toVector3(-106.72, -19.64, 1000.71), 3), - bincoStore: new serverClasses.interiorTemplateData(toVector3(207.54, -109.00, 1005.13), 15), - wardrobe: new serverClasses.interiorTemplateData(toVector3(255.71, -41.13, 1002.02), 14), - cityHall: new serverClasses.interiorTemplateData(toVector3(389.538, 173.652, 1008.38), 3), - gantonGym: new serverClasses.interiorTemplateData(toVector3(772.2,-5.06,1000.73), 1), - kungFuGym: new serverClasses.interiorTemplateData(toVector3(774.21, -48.92, 1000.58), 6), - lvGym: new serverClasses.interiorTemplateData(toVector3(773.57, -77.09, 1000.65), 7), - insuranceCompany: new serverClasses.interiorTemplateData(toVector3(-2029.76, -119.624, 1035.17), 1), - stripClub1: new serverClasses.interiorTemplateData(toVector3(1204.80,-11.58,1000.92), 2), - stripClub1Private: new serverClasses.interiorTemplateData(toVector3(1204.80, 13.89, 1000.92), 2), - nightClub: new serverClasses.interiorTemplateData(toVector3(493.39,-22.72,1000.67), 17), - warehouse1: new serverClasses.interiorTemplateData(toVector3(1412.63, -1.78, 1000.92), 1), - warehouse2: new serverClasses.interiorTemplateData(toVector3(1302.51, -1.78, 1001.02), 18), - warehouse3: new serverClasses.interiorTemplateData(toVector3(76.63, -301.15, 1.57), 0), - warehouse4: new serverClasses.interiorTemplateData(toVector3(1059.89, 2081.68, 10.82), 0), - bikeSchool: new serverClasses.interiorTemplateData(toVector3(1494.32, 1304.94, 1093.28), 3), - bar1: new serverClasses.interiorTemplateData(toVector3(501.98,-69.15,998.75), 11), - diner1: new serverClasses.interiorTemplateData(toVector3(457.30, -88.42, 999.55), 4), - diner2: new serverClasses.interiorTemplateData(toVector3(454.97, -110.10, 1000.07), 4), - diner3: new serverClasses.interiorTemplateData(toVector3(435.27, -80.95, 999.55), 5), - smallPoliceStation: new serverClasses.interiorTemplateData(toVector3(322.19, 302.49, 999.14), 5), - }, - - { // GTA UG - - }, - - { // GTA IV - - }, - ], - skinChangePosition: [ - [], - [], - [], - [toVector3(258.14, -41.76, 1002.023), 1.322, 14], - [], - [], - ], - /* - animations: [ - false, - { - itemDrop: new serverClasses.animationData(), - itemPickup: new serverClasses.animationData(), - itemUse: new serverClasses.animationData(), - itemThrow: new serverClasses.animationData(), - itemPut: new serverClasses.animationData(), - itemTake: new serverClasses.animationData(), - itemGiveTake: new serverClasses.animationData(), - sit: new serverClasses.animationData(), - stand: new serverClasses.animationData(), - sitToStand: new serverClasses.animationData(), - standToSit: new serverClasses.animationData(), - standIdle: new serverClasses.animationData(), - talk: new serverClasses.animationData(), - wave: new serverClasses.animationData(), - greet: new serverClasses.animationData(), - handCuff: new serverClasses.animationData(), - handsUp: new serverClasses.animationData(), - }, - { - itemDrop: new serverClasses.animationData(), - itemPickup: new serverClasses.animationData(), - itemUse: new serverClasses.animationData(), - itemThrow: new serverClasses.animationData(), - itemPut: new serverClasses.animationData(), - itemTake: new serverClasses.animationData(), - itemGiveTake: new serverClasses.animationData(), - sit: new serverClasses.animationData(), - stand: new serverClasses.animationData(), - sitToStand: new serverClasses.animationData(), - standToSit: new serverClasses.animationData(), - standIdle: new serverClasses.animationData(), - talk: new serverClasses.animationData(), - wave: new serverClasses.animationData(), - greet: new serverClasses.animationData(), - handCuff: new serverClasses.animationData(), - handsUp: new serverClasses.animationData(), - }, - { - itemDrop: new serverClasses.animationData(), - itemPickup: new serverClasses.animationData(), - itemUse: new serverClasses.animationData(), - itemThrow: new serverClasses.animationData(), - itemPut: new serverClasses.animationData(), - itemTake: new serverClasses.animationData(), - itemGiveTake: new serverClasses.animationData(), - sit: new serverClasses.animationData(), - stand: new serverClasses.animationData(), - sitToStand: new serverClasses.animationData(), - standToSit: new serverClasses.animationData(), - standIdle: new serverClasses.animationData(), - talk: new serverClasses.animationData(), - wave: new serverClasses.animationData(), - greet: new serverClasses.animationData(), - handCuff: new serverClasses.animationData(), - handsUp: new serverClasses.animationData(), - }, - false, - { - itemDrop: new serverClasses.animationData(), - itemPickup: new serverClasses.animationData(), - itemUse: new serverClasses.animationData(), - itemThrow: new serverClasses.animationData(), - itemPut: new serverClasses.animationData(), - itemTake: new serverClasses.animationData(), - itemGiveTake: new serverClasses.animationData(), - sit: new serverClasses.animationData(), - stand: new serverClasses.animationData(), - sitToStand: new serverClasses.animationData(), - standToSit: new serverClasses.animationData(), - standIdle: new serverClasses.animationData(), - talk: new serverClasses.animationData(), - wave: new serverClasses.animationData(), - greet: new serverClasses.animationData(), - handCuff: new serverClasses.animationData(), - handsUp: new serverClasses.animationData(), - } - ], - tutorial: { - spawnPosition: [ - false, - new serverClasses.tutorialVehicleData(new Vec3(0.0, 0.0, 0.0), 0.0, 0, 0), - new serverClasses.tutorialVehicleData(new Vec3(0.0, 0.0, 0.0), 0.0, 0, 0), - new serverClasses.tutorialSpawnData(new Vec3(0.0, 0.0, 0.0), 0.0, 0, 0), - false, - new serverClasses.tutorialVehicleData(new Vec3(0.0, 0.0, 0.0), 0.0, 0, 0), - ], - vehicle: [ - false, - new serverClasses.tutorialVehicleData(111, new Vec3(0.0, 0.0, 0.0)), - new serverClasses.tutorialVehicleData(175, new Vec3(0.0, 0.0, 0.0), 0.0), - new serverClasses.tutorialVehicleData(445, new Vec3(0.0, 0.0, 0.0), 0.0), - false, - new serverClasses.tutorialVehicleData(0, new Vec3(0.0, 0.0, 0.0), 0.0), - ], - item: [ - false, - new serverClasses.tutorialItemData(new Vec3(0.0, 0.0, 0.0)), - new serverClasses.tutorialItemData(new Vec3(0.0, 0.0, 0.0), 0.0), - new serverClasses.tutorialItemData(new Vec3(0.0, 0.0, 0.0), 0.0), - false, - new serverClasses.tutorialItemData(new Vec3(0.0, 0.0, 0.0), 0.0), - ], - } - */ - } + return gameData; }; // =========================================================================== diff --git a/scripts/server/core.js b/scripts/server/core.js index 844f3543..1baae3e9 100644 --- a/scripts/server/core.js +++ b/scripts/server/core.js @@ -29,363 +29,6 @@ let serverData = { whiteListedGameScripts: [], blackListedGameScripts: [], }, - policeStations: [ - false, - [ // GTA 3 - { - position: toVector3(1143.875, -675.1875, 14.97), - heading: 1.5, - blip: false, - name: "Portland", - }, - { - position: toVector3(340.25, -1123.375, 25.98), - heading: 3.14, - blip: false, - name: "Staunton Island", - }, - { - position: toVector3(-1253.0, -138.1875, 58.75), - heading: 1.5, - blip: false, - name: "Shoreside Vale", - }, - ], - [ // GTA VC - { - position: toVector3(399.77, -468.90, 11.73), - heading: 0.0, - blip: false, - name: "Washington Beach", - }, - { - position: toVector3(508.96, 512.07, 12.10), - heading: 0.0, - blip: false, - name: "Vice Point", - }, - { - position: toVector3(-657.43, 762.31, 11.59), - heading: 0.0, - blip: false, - name: "Downtown", - }, - { - position: toVector3(-885.08, -470.44, 13.11), - heading: 0.0, - blip: false, - name: "Little Havana", - }, - ], - [ // GTA SA - { - position: toVector3(1545.53, -1675.64, 13.561), - heading: -1.575, - blip: false, - name: "Los Santos", - }, - - ], - [ // GTA UG - - ], - [ // GTA IV - - { - position: toVector3(894.99, -357.39, 18.185), - heading: 2.923, - blip: false, - name: "Broker", - }, - { - position: toVector3(435.40, 1592.29, 17.353), - heading: 3.087, - blip: false, - name: "South Bohan", - }, - { - position: toVector3(974.93, 1870.45, 23.073), - heading: -1.621, - blip: false, - name: "Northern Gardens", - }, - { - position: toVector3(1233.25, -89.13, 28.034), - heading: 1.568, - blip: false, - name: "South Slopes", - }, - { - position: toVector3(50.12, 679.88, 15.316), - heading: 1.569, - blip: false, - name: "Middle Park East", - }, - { - position: toVector3(85.21, 1189.82, 14.755), - heading: 3.127, - blip: false, - name: "East Holland", - }, - { - position: toVector3(2170.87, 448.87, 6.085), - heading: 1.501, - blip: false, - name: "Francis International Airport", - }, - { - position: toVector3(213.12, -211.70, 10.752), - heading: 0.200, - blip: false, - name: "Chinatown", - }, - { - position: toVector3(-1714.95, 276.31, 22.134), - heading: 1.127, - blip: false, - name: "Acter", - }, - { - position: toVector3(-1220.73, -231.53, 3.024), - heading: 2.210, - blip: false, - name: "Port Tudor", - }, - { - position: toVector3(-927.66, 1263.63, 24.587), - heading: -0.913, - blip: false, - name: "Leftwood", - }, - ] - ], - fireStations: [ - false, - [ // GTA 3 - { - position: toVector3(1103.70, -52.45, 7.49), - heading: 1.5, - blip: false, - name: "Portland", - }, - { - position: toVector3(-78.48, -436.80, 16.17), - heading: 3.14, - blip: false, - name: "Staunton Island", - }, - { - position: toVector3(-1202.10, -14.67, 53.20), - heading: 1.5, - blip: false, - name: "Shoreside Vale", - }, - ], - [ // GTA VC - - ], - [ // GTA SA - - ], - [ // GTA UG - - ], - [ // GTA IV - { - position: toVector3(953.13, 95.90, 35.004), - heading: 1.595, - blip: false, - name: "Broker", - }, - { - position: toVector3(-271.02, 1542.15, 20.420), - heading: -1.160, - blip: false, - name: "Northwood", - }, - { - position: toVector3(1120.47, 1712.36, 10.534), - heading: -0.682, - blip: false, - name: "Northern Gardens", - }, - { - position: toVector3(2364.87, 166.83, 5.813), - heading: 0.156, - blip: false, - name: "Francis International Airport", - }, - { - position: toVector3(295.40, -336.88, 4.963), - heading: 2.887, - blip: false, - name: "Chinatown", - }, - ] - ], - hospitals: [ - false, - [ // GTA 3 - { - position: toVector3(1144.25, -596.875, 14.97), - heading: 1.5, - blip: false, - name: "Portland", - }, - { - position: toVector3(183.5, -17.75, 16.21), - heading: 3.14, - blip: false, - name: "Staunton Island", - }, - { - position: toVector3(-1259.5, -44.5, 58.89), - heading: 1.5, - blip: false, - name: "Shoreside Vale", - }, - ], - [ // GTA VC - { - position: toVector3(493.14, 709.31, 11.80), - heading: 1.5, - blip: false, - name: "Unknown", - }, - { - position: toVector3(-826.06, 1144.41, 12.41), - heading: 1.5, - blip: false, - name: "Unknown", - }, - ], - [ // GTA SA - { - position: toVector3(1172.96, -1323.42, 15.40), - heading: 1.5, - blip: false, - name: "All Saints", - }, - { - position: toVector3(2034.04, -1405.07, 17.24), - heading: 1.5, - blip: false, - name: "County General", - }, - ], - [ // GTA UG - - ], - [ // GTA IV - { - position: toVector3(1199.59, 196.78, 33.554), - heading: 1.633, - blip: false, - name: "Schottler", - }, - { - position: toVector3(980.71, 1831.61, 23.898), - heading: -0.049, - blip: false, - name: "Northern Gardens", - }, - { - position: toVector3(-1317.27, 1277.20, 22.370), - heading: 2.246, - blip: false, - name: "Leftwood", - }, - { - position: toVector3(-1538.43, 344.58, 20.943), - heading: -0.156, - blip: false, - name: "Acter", - }, - ] - ], - payAndSprays: [ - false, - [ // GTA 3 - { - position: toVector3(925.4, -360.3, 10.83), - blip: false, - name: "Portland", - }, - { - position: toVector3(381.8, -493.8, 25.95), - blip: false, - name: "Staunton Island", - }, - { - position: toVector3(-1142.4, 35.01, 58.61), - blip: false, - name: "Shoreside Vale", - }, - ], - [ // GTA VC - - ], - [ // GTA SA - - ], - [ // GTA UG - - ], - [ // GTA IV - - ] - ], - - ammunations: [ - false, - [ // GTA 3 - { - position: toVector3(1068.3, -400.9, 15.24), - blip: false, - name: "Portland", - }, - { - position: toVector3(348.2, -717.9, 26.43), - blip: false, - name: "Staunton Island", - }, - ], - [ // GTA VC - - ], - [ // GTA SA - - ], - [ // GTA UG - - ], - [ // GTA IV - - ] - ], - fuelStations: [ - false, - [ // GTA 3 - - { - position: toVector3(1161.9, -76.73, 7.27), - blip: false, - name: "Portland", - }, - ], - [ // GTA VC - - ], - [ // GTA SA - - ], - [ // GTA UG - - ], - [ // GTA IV - - ] - ], }; // =========================================================================== diff --git a/scripts/server/database.js b/scripts/server/database.js index b6d023a5..e32f7c5e 100644 --- a/scripts/server/database.js +++ b/scripts/server/database.js @@ -199,7 +199,7 @@ function createDatabaseInsertQuery(tableName, data) { for(let i in data) { fields.push(data[i][0]); - if(typeof values[i][1] == "string") { + if(typeof data[i][1] == "string") { values.push(`'${data[i][1]}'`); } else { values.push(data[i][1]); @@ -216,14 +216,14 @@ function createDatabaseUpdateQuery(tableName, data, whereClause) { let values = []; for(let i in data) { - if(typeof values[i][1] == "string") { + if(typeof data[i][1] == "string") { values.push(`${data[i][0]}='${data[i][1]}'`); } else { values.push(`${data[i][0]}=${data[i][1]}`); } } - let queryString = `INSERT INTO ${tableName} SET ${values.join(", ")} WHERE ${whereClause}`; + let queryString = `UPDATE ${tableName} SET ${values.join(", ")} WHERE ${whereClause}`; return queryString; } diff --git a/scripts/server/developer.js b/scripts/server/developer.js index 9bf86f2a..2464bec4 100644 --- a/scripts/server/developer.js +++ b/scripts/server/developer.js @@ -468,4 +468,18 @@ function togglePauseSavingToDatabase() { getServerConfig().pauseSavingToDatabase = !getServerConfig().pauseSavingToDatabase; } +// =========================================================================== + +function createAccountDataForNewServer(serverId) { + let dbConnection = connectToDatabase(); + let dbQuery = false; + if(dbConnection) { + dbQuery = queryDatabase(dbConnection, `SELECT * FROM acct_main`); + if(dbQuery) { + let dbQueryString = `INSERT INTO acct_svr (acct_svr_acct, acct_svr_svr) VALUES (${accountDatabaseId}, ${serverId})`; + quickDatabaseQuery(dbQueryString); + } + } +} + // =========================================================================== \ No newline at end of file diff --git a/scripts/server/event.js b/scripts/server/event.js index 690e11e8..06c228be 100644 --- a/scripts/server/event.js +++ b/scripts/server/event.js @@ -46,7 +46,9 @@ function onPlayerConnect(event, ipAddress, port) { // =========================================================================== function onPlayerJoin(event, client) { - fadeCamera(client, true, 1.0); + if(isFadeCameraSupported()) { + fadeCamera(client, true, 1.0); + } } // =========================================================================== @@ -81,21 +83,24 @@ function onPlayerQuit(event, client, quitReasonId) { function onPlayerChat(event, client, messageText) { event.preventDefault(); - if(!isNull(getPlayerData(client))) { - if(!isPlayerLoggedIn(client)) { - messagePlayerError(client, "You need to login before you can chat!"); - return false; - } + if(!getPlayerData(client)) { + messagePlayerError(client, "You need to login before you can chat!"); + return false; + } - if(!isPlayerSpawned(client)) { - messagePlayerError(client, "You need to login before you can chat!"); - return false; - } + if(!isPlayerLoggedIn(client)) { + messagePlayerError(client, "You need to login before you can chat!"); + return false; + } - if(isPlayerMuted(client)) { - messagePlayerError(client, "You are muted and can't chat!"); - return false; - } + if(!isPlayerSpawned(client)) { + messagePlayerError(client, "You need to spawn before you can chat!"); + return false; + } + + if(isPlayerMuted(client)) { + messagePlayerError(client, "You are muted and can't chat!"); + return false; } messageText = messageText.substring(0, 128); @@ -320,11 +325,13 @@ function onPlayerDeath(client, position) { updatePlayerSpawnedState(client, false); setPlayerControlState(client, false); setTimeout(function() { - fadeCamera(client, false, 1.0); + if(isFadeCameraSupported()) { + fadeCamera(client, false, 1.0); + } setTimeout(function() { - client.despawnPlayer(); if(getPlayerCurrentSubAccount(client).inJail) { - let closestJail = getClosestJail(position); + let closestJail = getClosestJail(getPlayerPosition(client)); + client.despawnPlayer(); getPlayerCurrentSubAccount(client).interior = closestJail.interior; getPlayerCurrentSubAccount(client).dimension = closestJail.dimension; if(getServerGame() == GAME_GTA_IV) { @@ -333,19 +340,24 @@ function onPlayerDeath(client, position) { spawnPlayer(client, closestJail.position, closestJail.heading, getPlayerCurrentSubAccount(client).skin); } - fadeCamera(client, true, 1.0); + if(isFadeCameraSupported()) { + fadeCamera(client, true, 1.0); + } updatePlayerSpawnedState(client, true); } else { - let closestHospital = getClosestHospital(position); - getPlayerCurrentSubAccount(client).interior = 0; - getPlayerCurrentSubAccount(client).dimension = 0; + let closestHospital = getClosestHospital(getPlayerPosition(client)); + client.despawnPlayer(); + getPlayerCurrentSubAccount(client).interior = closestHospital.interior; + getPlayerCurrentSubAccount(client).dimension = closestHospital.dimension; if(getServerGame() == GAME_GTA_IV) { - spawnPlayer(client, closestHospital, 0.0, getPlayerCurrentSubAccount(client).skin); + spawnPlayer(client, closestHospital.position, closestHospital.heading, getPlayerCurrentSubAccount(client).skin); } else { - spawnPlayer(client, closestHospital, 0.0, getPlayerCurrentSubAccount(client).skin); + spawnPlayer(client, closestHospital.position, closestHospital.heading, getPlayerCurrentSubAccount(client).skin); } - fadeCamera(client, true, 1.0); + if(isFadeCameraSupported()) { + fadeCamera(client, true, 1.0); + } updatePlayerSpawnedState(client, true); } }, 2000); diff --git a/scripts/server/house.js b/scripts/server/house.js index aae50f86..82b6743d 100644 --- a/scripts/server/house.js +++ b/scripts/server/house.js @@ -63,6 +63,8 @@ function createHouseCommand(command, params, client) { createHouseEntranceBlip(houseId); createHouseExitBlip(houseId); + getHouseData(houseId).needsSaved = true; + messageAdmins(`${getInlineChatColourByName("lightGrey")}${getPlayerName(client)} ${getInlineChatColourByName("white")}created house ${getInlineChatColourByType("houseGreen")}${tempHouseData.description}`); } @@ -84,6 +86,8 @@ function lockUnlockHouseCommand(command, params, client) { } } + getHouseData(houseId).needsSaved = true; + messagePlayerSuccess(client, `House '${getHouseData(houseId).description}' ${getLockedUnlockedTextFromBool((getHouseData(houseId).locked))}!`); } @@ -108,6 +112,8 @@ function setHouseDescriptionCommand(command, params, client) { } } + getHouseData(houseId).needsSaved = true; + messageAdmins(`${getPlayerName(client)} renamed house ${getInlineChatColourByType("houseGreen")}${oldDescription} ${getInlineChatColourByName("white")}to ${getInlineChatColourByType("houseGreen")}${getHouseData(houseId).description}`); } @@ -127,6 +133,8 @@ function setHouseOwnerCommand(command, params, client) { return false; } + getHouseData(houseId).needsSaved = true; + getHouseData(houseId).ownerType = VRR_HOUSEOWNER_PLAYER; getHouseData(houseId).ownerId = getServerData().clients[newHouseOwner.index].accountData.databaseId; messageAdmins(`${getInlineChatColourByName("lightGrey")}${getPlayerName(client)} ${getInlineChatColourByName("white")}set house ${getInlineChatColourByType("houseGreen")}${getHouseData(houseId).description} ${getInlineChatColourByName("white")}owner to ${getInlineChatColourByName("lightGrey")}${newHouseOwner.name}`); @@ -149,6 +157,8 @@ function setHouseClanCommand(command, params, client) { return false; } + getHouseData(houseId).needsSaved = true; + getHouseData(houseId).ownerType = VRR_HOUSEOWNER_CLAN; getHouseData(houseId).ownerId = getClanData(clanId).databaseId; messageAdmins(`${getInlineChatColourByName("lightGrey")}${getPlayerName(client)} ${getInlineChatColourByName("white")}set house ${getInlineChatColourByType("houseGreen")}${getHouseData(houseId).description} ${getInlineChatColourByName("white")}owner to the ${getInlineChatColourByType("clanOrange")}${getClanData(clanId).name} ${getInlineChatColourByName("white")}clan!`); @@ -185,6 +195,8 @@ function setHousePickupCommand(command, params, client) { createHouseEntrancePickup(houseId); } + getHouseData(houseId).needsSaved = true; + messageAdmins(`[#AAAAAA]${client.name} [#FFFFFF]set house [#11CC11]${getHouseData(houseId).description} [#FFFFFF]pickup display to [#AAAAAA]${toLowerCase(typeParam)}`); } @@ -227,6 +239,8 @@ function setHouseInteriorTypeCommand(command, params, client) { createHouseEntrancePickup(houseId); createHouseExitPickup(houseId); + getHouseData(houseId).needsSaved = true; + messageAdmins(`[#AAAAAA]${client.name} [#FFFFFF]set house [#11CC11]${getHouseData(houseId).description} [#FFFFFF]interior type to [#AAAAAA]${toLowerCase(typeParam)}`); } @@ -261,6 +275,8 @@ function setHouseBlipCommand(command, params, client) { createHouseEntranceBlip(houseId); } + getHouseData(houseId).needsSaved = true; + messageAdmins(`[#AAAAAA]${client.name} [#FFFFFF]set house [#11CC11]${getHouseData(houseId).description} [#FFFFFF]blip display to [#AAAAAA]${toLowerCase(typeParam)}`); } @@ -283,6 +299,8 @@ function moveHouseEntranceCommand(command, params, client) { createAllHouseBlips(houseId); createAllHousePickups(houseId); + getHouseData(houseId).needsSaved = true; + messageAdmins(`${getInlineChatColourByName("lightGrey")}${getPlayerName(client)} ${getInlineChatColourByName("white")}moved house ${getInlineChatColourByType("houseGreen")}${getHouseData(houseId).description} ${getInlineChatColourByName("white")}entrance to their position`); } @@ -307,6 +325,8 @@ function moveHouseExitCommand(command, params, client) { createAllHouseBlips(houseId); createAllHousePickups(houseId); + getHouseData(houseId).needsSaved = true; + messageAdmins(`${getInlineChatColourByName("lightGrey")}${getPlayerName(client)} ${getInlineChatColourByName("white")}moved house ${getInlineChatColourByType("houseGreen")}${getHouseData(houseId).description} ${getInlineChatColourByName("white")}exit to their position`); } @@ -421,7 +441,9 @@ function getPlayerHouse(client) { function saveAllHousesToDatabase() { logToConsole(LOG_INFO, `[VRR.House]: Saving all server houses to database ...`); for(let i in getServerData().houses) { - saveHouseToDatabase(i); + if(getServerData().houses[i].needsSaved) { + saveHouseToDatabase(i); + } } logToConsole(LOG_INFO, `[VRR.House]: Saving all server houses to database ...`); } @@ -442,9 +464,9 @@ function saveHouseToDatabase(houseId) { ["house_owner_type", tempHouseData.ownerType], ["house_owner_id", tempHouseData.ownerId], ["house_locked", boolToInt(tempHouseData.locked)], - ["house_entrance_fee", tempHouseData.entranceFee], + //["house_entrance_fee", tempHouseData.entranceFee], ["house_entrance_pos_x", tempHouseData.entrancePosition.x], - ["house_entrance_pos_y", tempHouseData.entrancePosition.x], + ["house_entrance_pos_y", tempHouseData.entrancePosition.y], ["house_entrance_pos_z", tempHouseData.entrancePosition.z], ["house_entrance_rot_z", tempHouseData.entranceRotation], ["house_entrance_int", tempHouseData.entranceInterior], @@ -470,10 +492,11 @@ function saveHouseToDatabase(houseId) { dbQuery = queryDatabase(dbConnection, queryString); getServerData().houses[houseId].databaseId = getDatabaseInsertId(dbConnection); } else { - let queryString = createDatabaseUpdateQuery("house_main", data, `WHERE house_id=${tempHouseData.databaseId}`); + let queryString = createDatabaseUpdateQuery("house_main", data, `house_id=${tempHouseData.databaseId}`); dbQuery = queryDatabase(dbConnection, queryString); } + getHouseData(houseId).needsSaved = false; freeDatabaseQuery(dbQuery); disconnectFromDatabase(dbConnection); return true; @@ -673,6 +696,91 @@ function getHouseInfoCommand(command, params, client) { // =========================================================================== +function setHouseBuyPriceCommand(command, params, client) { + if(areParamsEmpty(params)) { + messagePlayerSyntax(client, getCommandSyntaxText(command)); + return false; + } + + let splitParams = params.split(" "); + + let amount = toInteger(splitParams[0]) || 0; + let houseId = (isPlayerInAnyHouse(client)) ? getPlayerHouse(client) : getClosestHouseEntrance(getPlayerPosition(client)); + + if(!getHouseData(houseId)) { + messagePlayerError(client, "Business not found!"); + return false; + } + + if(amount < 0) { + messagePlayerError(client, `The amount can't be less than 0!`); + return false; + } + + getHouseData(houseId).buyPrice = amount; + setEntityData(getHouseData(houseId).entrancePickup, "vrr.label.price", getHouseData(houseId).buyPrice, true); + messagePlayerSuccess(client, `${getInlineChatColourByName("white")}You set business ${getInlineChatColourByType("houseGreen")}${getHouseData(houseId).description}'s ${getInlineChatColourByName("white")}for-sale price to ${getInlineChatColourByName("lightGrey")}$${makeLargeNumberReadable(amount)}`); +} + +// =========================================================================== + +function setHouseRentPriceCommand(command, params, client) { + if(areParamsEmpty(params)) { + messagePlayerSyntax(client, getCommandSyntaxText(command)); + return false; + } + + let splitParams = params.split(" "); + + let amount = toInteger(splitParams[0]) || 0; + let houseId = (isPlayerInAnyHouse(client)) ? getPlayerHouse(client) : getClosestHouseEntrance(getPlayerPosition(client)); + + if(!getHouseData(houseId)) { + messagePlayerError(client, "Business not found!"); + return false; + } + + if(amount < 0) { + messagePlayerError(client, `The amount can't be less than 0!`); + return false; + } + + getHouseData(houseId).rentPrice = amount; + setEntityData(getHouseData(houseId).entrancePickup, "vrr.label.price", `Rent: ${getHouseData(houseId).rentPrice}`, true); + messagePlayerSuccess(client, `${getInlineChatColourByName("white")}You set business ${getInlineChatColourByType("houseGreen")}${getHouseData(houseId).description}'s ${getInlineChatColourByName("white")}rent price to ${getInlineChatColourByName("lightGrey")}$${makeLargeNumberReadable(amount)}`); +} + +// =========================================================================== + +function buyHouseCommand(command, params, client) { + let houseId = (isPlayerInAnyHouse(client)) ? getPlayerHouse(client) : getClosestHouseEntrance(getPlayerPosition(client)); + + if(!getHouseData(houseId)) { + messagePlayerError(client, "House not found!"); + return false; + } + + if(getHouseData(houseId).buyPrice <= 0) { + messagePlayerError(client, `${getInlineChatColourByType("houseGreen")}${getHouseData(houseId).description} ${getInlineChatColourByName("white")}is not for sale!`); + return false; + } + + if(getPlayerCurrentSubAccount(client).cash < getHouseData(houseId).buyPrice) { + messagePlayerError(client, `You don't have enough money to buy business ${getInlineChatColourByType("houseGreen")}${getHouseData(houseId).name}!`); + return false; + } + + getHouseData(houseId).ownerType = VRR_BIZOWNER_PLAYER; + getHouseData(houseId).ownerId = getPlayerCurrentSubAccount(client).databaseId; + getHouseData(houseId).buyPrice = 0; + + updateHousePickupLabelData(houseId); + + messagePlayerSuccess(client, `You are now the owner of ${getInlineChatColourByType("houseGreen")}${getHouseData(houseId).description}`); +} + +// =========================================================================== + function isPlayerInAnyHouse(client) { return doesEntityDataExist(client, "vrr.inHouse"); } @@ -807,4 +915,5 @@ function getHouseIdFromDatabaseId(databaseId) { } } -// =========================================================================== \ No newline at end of file +// =========================================================================== + diff --git a/scripts/server/item.js b/scripts/server/item.js index 2090d05c..b3eaa8bf 100644 --- a/scripts/server/item.js +++ b/scripts/server/item.js @@ -107,8 +107,9 @@ function createGroundItemObject(itemId) { setElementRotation(getItemData(itemId).object, getItemTypeData(getItemData(itemId).itemTypeIndex).dropRotation); setElementOnAllDimensions(getItemData(itemId).object, false); setElementDimension(getItemData(itemId).object, getItemData(itemId).dimension); - setEntityData(getItemData(itemId).object, "vrr.scale", getItemTypeData(getItemData(itemId).itemTypeIndex).dropScale, true); + //setEntityData(getItemData(itemId).object, "vrr.scale", getItemTypeData(getItemData(itemId).itemTypeIndex).dropScale, true); addToWorld(getItemData(itemId).object); + //setEntityData(getItemData(itemId).object, "vrr.scale", getItemTypeData(getItemData(itemId).itemTypeIndex).dropScale, true); getServerData().groundItemCache.push(itemId); } @@ -172,6 +173,8 @@ function createItemCommand(command, params, client) { // =========================================================================== function useItemCommand(command, params, client) { + clearPlayerItemActionState(client); + let hotBarSlot = getPlayerData(client).activeHotBarSlot; if(!areParamsEmpty(params)) { hotBarSlot = toInteger(params); @@ -196,11 +199,12 @@ function useItemCommand(command, params, client) { if(!getItemTypeData(getItemData(itemId).itemTypeIndex)) { messagePlayerError(client, `The item you're trying to use is bugged. A bug report has been sent to the server developers.`); - submitBugReport(client, `(AUTOMATED REPORT) Drop Item: Getting item type ${getItemData(itemId).itemType} data for item ${itemId}/${getItemData(itemId).databaseId} in player hotbar slot ${hotBarSlot} (cache ${getPlayerData(client).hotBarItems[hotBarSlot]}) returned false.`); + submitBugReport(client, `(AUTOMATED REPORT) Use Item: Getting item type ${getItemData(itemId).itemType} data for item ${itemId}/${getItemData(itemId).databaseId} in player hotbar slot ${hotBarSlot} (cache ${getPlayerData(client).hotBarItems[hotBarSlot]}) returned false.`); return false; } - if(getItemTypeData(getItemData(itemId).itemTypeIndex).useType == VRR_ITEM_USETYPE_NONE || getItemTypeData(getItemData(itemId).itemTypeIndex).useType == VRR_ITEM_USETYPE_WEAPON) { + if(getPlayerData(client).itemActionState != VRR_ITEM_ACTION_NONE) { + messagePlayerError(client, `Your hands are busy.`); return false; } @@ -208,7 +212,7 @@ function useItemCommand(command, params, client) { getPlayerData(client).itemActionItem = hotBarSlot; showPlayerItemUseDelay(client, hotBarSlot); - clearPlayerItemActionStateAfterDelay(client, getGlobalConfig().itemActionStateReset); + //clearPlayerItemActionStateAfterDelay(client, getGlobalConfig().itemActionStateReset); } // =========================================================================== @@ -236,6 +240,8 @@ function deleteGroundItemCommand(command, params, client) { // =========================================================================== function pickupItemCommand(command, params, client) { + clearPlayerItemActionState(client); + let itemId = getClosestItemOnGround(getPlayerPosition(client)); if(!getItemData(itemId)) { @@ -262,6 +268,7 @@ function pickupItemCommand(command, params, client) { } if(getPlayerData(client).itemActionState != VRR_ITEM_ACTION_NONE) { + messagePlayerError(client, `Your hands are busy.`); return false; } @@ -269,16 +276,18 @@ function pickupItemCommand(command, params, client) { getPlayerData(client).itemActionItem = itemId; showPlayerItemPickupDelay(client, itemId); - clearPlayerItemActionStateAfterDelay(client, getGlobalConfig().itemActionStateReset); + //clearPlayerItemActionStateAfterDelay(client, getGlobalConfig().itemActionStateReset); } // =========================================================================== function dropItemCommand(command, params, client) { - let hotBarSlot = getPlayerData(client).activeHotBarSlot; + clearPlayerItemActionState(client); + let hotBarSlot = getPlayerData(client).activeHotBarSlot; if(!areParamsEmpty(params)) { hotBarSlot = toInteger(params); + hotBarSlot = hotBarSlot-1; } if(hotBarSlot == -1) { @@ -286,7 +295,6 @@ function dropItemCommand(command, params, client) { } if(getPlayerData(client).hotBarItems[hotBarSlot] == -1) { - messagePlayerError(client, `Please equip an item or provide a slot ID to drop an item`); return false; } @@ -305,19 +313,22 @@ function dropItemCommand(command, params, client) { } if(getPlayerData(client).itemActionState != VRR_ITEM_ACTION_NONE) { + messagePlayerError(client, `Your hands are busy.`); return false; } - getPlayerData(client).itemActionItem = hotBarSlot; getPlayerData(client).itemActionState = VRR_ITEM_ACTION_DROP; - showPlayerItemDropDelay(client, itemId); + getPlayerData(client).itemActionItem = hotBarSlot; + showPlayerItemDropDelay(client, hotBarSlot); - clearPlayerItemActionStateAfterDelay(client, getGlobalConfig().itemActionStateReset); + //clearPlayerItemActionStateAfterDelay(client, getGlobalConfig().itemActionStateReset); } // =========================================================================== function putItemCommand(command, params, client) { + clearPlayerItemActionState(client); + let hotBarSlot = toInteger(params); let itemId = getPlayerData(client).hotBarItems[hotBarSlot]; @@ -335,6 +346,7 @@ function putItemCommand(command, params, client) { } if(getPlayerData(client).itemActionState != VRR_ITEM_ACTION_NONE) { + messagePlayerError(client, `Your hands are busy.`); return false; } @@ -342,12 +354,14 @@ function putItemCommand(command, params, client) { getPlayerData(client).itemActionState = VRR_ITEM_ACTION_PUT; showPlayerItemPutDelay(client, hotBarSlot); - clearPlayerItemActionStateAfterDelay(client, getGlobalConfig().itemActionStateReset); + //clearPlayerItemActionStateAfterDelay(client, getGlobalConfig().itemActionStateReset); } // =========================================================================== function takeItemCommand(command, params, client) { + clearPlayerItemActionState(client); + let firstSlot = getPlayerFirstEmptyHotBarSlot(client); if(firstSlot == -1) { messagePlayerError(client, `You don't have any space to hold another item (full inventory)!`); @@ -365,6 +379,7 @@ function takeItemCommand(command, params, client) { } if(getPlayerData(client).itemActionState != VRR_ITEM_ACTION_NONE) { + messagePlayerError(client, `Your hands are busy.`); return false; } @@ -372,7 +387,7 @@ function takeItemCommand(command, params, client) { getPlayerData(client).itemActionState = VRR_ITEM_ACTION_TAKE; showPlayerItemTakeDelay(client, itemId); - clearPlayerItemActionStateAfterDelay(client, getGlobalConfig().itemActionStateReset); + //clearPlayerItemActionStateAfterDelay(client, getGlobalConfig().itemActionStateReset); } // =========================================================================== @@ -692,6 +707,7 @@ function playerDropItem(client, hotBarSlot) { meActionToNearbyPlayers(client, `drops ${getProperDeterminerForName(getItemName(itemId))} ${getItemName(itemId)} on the ground`); resyncWeaponItemAmmo(client); + clearPlayerWeapons(client); getPlayerData(client).hotBarItems[hotBarSlot] = -1; updatePlayerHotBar(client); @@ -731,6 +747,7 @@ function playerPutItem(client, hotBarSlot) { } resyncWeaponItemAmmo(client); + clearPlayerWeapons(client); getItemData(itemId).ownerType = ownerType; getItemData(itemId).ownerId = ownerId; @@ -812,14 +829,15 @@ function playerSwitchItem(client, newHotBarSlot) { } resyncWeaponItemAmmo(client); + clearPlayerWeapons(client); - if(currentHotBarItem != -1) { - if(getItemData(currentHotBarItem)) { - if(getGlobalConfig().weaponEquippableTypes.indexOf(getItemTypeData(getItemData(currentHotBarItem).itemTypeIndex).useType) != -1) { - clearPlayerWeapons(client); - } - } - } + //if(currentHotBarItem != -1) { + // if(getItemData(currentHotBarItem)) { + // if(getGlobalConfig().weaponEquippableTypes.indexOf(getItemTypeData(getItemData(currentHotBarItem).itemTypeIndex).useType) != -1) { + // clearPlayerWeapons(client); + // } + // } + //} if(newHotBarItem != -1) { if(getItemData(newHotBarItem)) { @@ -865,6 +883,8 @@ function playerSwitchItem(client, newHotBarSlot) { // =========================================================================== function playerSwitchHotBarSlotCommand(command, params, client) { + clearPlayerItemActionState(client); + if(areParamsEmpty(params)) { messagePlayerSyntax(client, getCommandSyntaxText(command)); return false; @@ -888,6 +908,7 @@ function playerSwitchHotBarSlotCommand(command, params, client) { } if(getPlayerData(client).itemActionState != VRR_ITEM_ACTION_NONE) { + messagePlayerError(client, `Your hands are busy.`); return false; } @@ -1273,36 +1294,37 @@ function getItemTypeIndexFromDatabaseId(databaseId) { // =========================================================================== function playerItemActionDelayComplete(client) { - if(getPlayerData(client).itemActionState != VRR_ITEM_ACTION_NONE) { - switch(getPlayerData(client).itemActionState) { - case VRR_ITEM_ACTION_USE: - playerUseItem(client, getPlayerData(client).itemActionItem); - break; + logToConsole(LOG_VERBOSE, `[VRR.Item]: Player ${getPlayerDisplayForConsole(client)} item action delay complete (State: ${getPlayerData(client).itemActionState})`); + switch(getPlayerData(client).itemActionState) { + case VRR_ITEM_ACTION_USE: + playerUseItem(client, getPlayerData(client).itemActionItem); + break; - case VRR_ITEM_ACTION_DROP: - playerDropItem(client, getPlayerData(client).itemActionItem); - break; + case VRR_ITEM_ACTION_DROP: + playerDropItem(client, getPlayerData(client).itemActionItem); + break; - case VRR_ITEM_ACTION_TAKE: - playerTakeItem(client, getPlayerData(client).itemActionItem); - break; + case VRR_ITEM_ACTION_TAKE: + playerTakeItem(client, getPlayerData(client).itemActionItem); + break; - case VRR_ITEM_ACTION_PUT: - playerPutItem(client, getPlayerData(client).itemActionItem); - break; + case VRR_ITEM_ACTION_PUT: + playerPutItem(client, getPlayerData(client).itemActionItem); + break; - case VRR_ITEM_ACTION_PICKUP: - playerPickupItem(client, getPlayerData(client).itemActionItem); - break; + case VRR_ITEM_ACTION_PICKUP: + playerPickupItem(client, getPlayerData(client).itemActionItem); + break; - case VRR_ITEM_ACTION_SWITCH: - playerSwitchItem(client, getPlayerData(client).itemActionItem); - break; - } + case VRR_ITEM_ACTION_SWITCH: + playerSwitchItem(client, getPlayerData(client).itemActionItem); + break; + + default: + break; } - getPlayerData(client).itemActionState = VRR_ITEM_ACTION_NONE; - getPlayerData(client).itemActionItem = -1; + clearPlayerItemActionState(client); } // =========================================================================== @@ -1424,6 +1446,7 @@ function getOrderPriceForItemType(itemType) { function clearPlayerItemActionState(client) { getPlayerData(client).itemActionState = VRR_ITEM_ACTION_NONE; + getPlayerData(client).itemActionItem = -1; } // =========================================================================== @@ -1519,10 +1542,14 @@ function showPlayerInventoryToPlayer(client, targetClient) { resyncWeaponItemAmmo(targetClient); let itemDisplay = []; for(let i in getPlayerData(targetClient).hotBarItems) { + let colour = getInlineChatColourByName("lightGrey"); + if(getPlayerData(targetClient).activeHotBarSlot == i) { + colour = getInlineChatColourByName("yellow"); + } if(getPlayerData(targetClient).hotBarItems[i] == -1) { - itemDisplay.push(`[#CCCCCC]${toInteger(i)+1}: ${getInlineChatColourByName("lightGrey")}(Empty)`); + itemDisplay.push(`[#CCCCCC]${toInteger(i)+1}: ${colour}(Empty)`); } else { - itemDisplay.push(`[#CCCCCC]${toInteger(i)+1}: ${getInlineChatColourByName("lightGrey")}${getItemTypeData(getItemData(getPlayerData(targetClient).hotBarItems[i]).itemTypeIndex).name}[${getItemValueDisplayForItem(getPlayerData(targetClient).hotBarItems[i])}]`); + itemDisplay.push(`[#CCCCCC]${toInteger(i)+1}: ${colour}${getItemTypeData(getItemData(getPlayerData(targetClient).hotBarItems[i]).itemTypeIndex).name}[${getItemValueDisplayForItem(getPlayerData(targetClient).hotBarItems[i])}]`); } } @@ -1577,7 +1604,7 @@ function switchPlayerActiveHotBarSlot(client, slotId) { if(slotId != -1) { showPlayerItemSwitchDelay(client, slotId); } - clearPlayerItemActionStateAfterDelay(client, getGlobalConfig().itemActionStateReset); + //clearPlayerItemActionStateAfterDelay(client, getGlobalConfig().itemActionStateReset); } // =========================================================================== \ No newline at end of file diff --git a/scripts/server/job.js b/scripts/server/job.js index aeafa68b..59311a69 100644 --- a/scripts/server/job.js +++ b/scripts/server/job.js @@ -1589,8 +1589,8 @@ function createJobLocationPickup(jobId, locationId) { pickupModelId = getJobData(jobId).pickupModel; } - getJobData(jobId).locations[locationId].pickup = gta.createPickup(pickupModelId, getJobData(jobId).locations[locationId].position, getGameConfig().pickupTypes[getServerGame()].job); - getJobData(jobId).locations[locationId].pickup.dimension = getJobData(jobId).locations[locationId].dimension; + getJobData(jobId).locations[locationId].pickup = createGamePickup(pickupModelId, getJobData(jobId).locations[locationId].position, getGameConfig().pickupTypes[getServerGame()].job); + setElementDimension(getJobData(jobId).locations[locationId].pickup, getJobData(jobId).locations[locationId].dimension); setEntityData(getServerData().jobs[jobId].locations[locationId].pickup, "vrr.owner.type", VRR_PICKUP_JOB, false); setEntityData(getServerData().jobs[jobId].locations[locationId].pickup, "vrr.owner.id", locationId, false); setEntityData(getServerData().jobs[jobId].locations[locationId].pickup, "vrr.label.type", VRR_LABEL_JOB, true); diff --git a/scripts/server/misc.js b/scripts/server/misc.js index 85e19429..e733a938 100644 --- a/scripts/server/misc.js +++ b/scripts/server/misc.js @@ -129,7 +129,11 @@ function enterExitPropertyCommand(command, params, client) { clearPlayerStateToEnterExitProperty(client); getPlayerData(client).pedState = VRR_PEDSTATE_EXITINGPROPERTY; meActionToNearbyPlayers(client, "opens the door and exits the house"); - fadeCamera(client, false, 1.0); + + if(isFadeCameraSupported()) { + fadeCamera(client, false, 1.0); + } + disableCityAmbienceForPlayer(client, true); setTimeout(function() { setPlayerPosition(client, inHouse.entrancePosition); @@ -137,7 +141,9 @@ function enterExitPropertyCommand(command, params, client) { setPlayerDimension(client, inHouse.entranceDimension); setPlayerInterior(client, inHouse.entranceInterior); setTimeout(function() { - fadeCamera(client, true, 1.0); + if(isFadeCameraSupported()) { + fadeCamera(client, true, 1.0); + } setTimeout(function() { enableCityAmbienceForPlayer(client); clearPlayerOwnedPeds(client); @@ -163,7 +169,11 @@ function enterExitPropertyCommand(command, params, client) { getPlayerData(client).pedState = VRR_PEDSTATE_EXITINGPROPERTY; clearPlayerStateToEnterExitProperty(client) meActionToNearbyPlayers(client, "opens the door and exits the business"); - fadeCamera(client, false, 1.0); + + if(isFadeCameraSupported()) { + fadeCamera(client, false, 1.0); + } + disableCityAmbienceForPlayer(client, true); setTimeout(function() { setPlayerPosition(client, inBusiness.entrancePosition); @@ -171,7 +181,9 @@ function enterExitPropertyCommand(command, params, client) { setPlayerDimension(client, inBusiness.entranceDimension); setPlayerInterior(client, inBusiness.entranceInterior); setTimeout(function() { - fadeCamera(client, true, 1.0); + if(isFadeCameraSupported()) { + fadeCamera(client, true, 1.0); + } setTimeout(function() { enableCityAmbienceForPlayer(client); clearPlayerOwnedPeds(client); @@ -205,7 +217,9 @@ function enterExitPropertyCommand(command, params, client) { clearPlayerStateToEnterExitProperty(client) meActionToNearbyPlayers(client, "opens the door and enters the business"); getPlayerData(client).pedState = VRR_PEDSTATE_ENTERINGPROPERTY; - fadeCamera(client, false, 1.0); + if(isFadeCameraSupported()) { + fadeCamera(client, false, 1.0); + } disableCityAmbienceForPlayer(client); setTimeout(function() { setPlayerPosition(client, closestBusiness.exitPosition); @@ -213,7 +227,9 @@ function enterExitPropertyCommand(command, params, client) { setPlayerDimension(client, closestBusiness.exitDimension); setPlayerInterior(client, closestBusiness.exitInterior); setTimeout(function() { - fadeCamera(client, true, 1.0); + if(isFadeCameraSupported()) { + fadeCamera(client, true, 1.0); + } getPlayerData(client).pedState = VRR_PEDSTATE_READY; if(doesBusinessHaveAnyItemsToBuy(closestBusinessId)) { messagePlayerInfo(client, "Use /buy to purchase items from this business"); @@ -251,7 +267,9 @@ function enterExitPropertyCommand(command, params, client) { clearPlayerStateToEnterExitProperty(client) meActionToNearbyPlayers(client, "opens the door and enters the house"); getPlayerData(client).pedState = VRR_PEDSTATE_ENTERINGPROPERTY; - fadeCamera(client, false, 1.0); + if(isFadeCameraSupported()) { + fadeCamera(client, false, 1.0); + } disableCityAmbienceForPlayer(client); setTimeout(function() { setPlayerPosition(client, closestHouse.exitPosition); @@ -259,7 +277,9 @@ function enterExitPropertyCommand(command, params, client) { setPlayerDimension(client, closestHouse.exitDimension); setPlayerInterior(client, closestHouse.exitInterior); setTimeout(function() { - fadeCamera(client, true, 1.0); + if(isFadeCameraSupported()) { + fadeCamera(client, true, 1.0); + } getPlayerData(client).pedState = VRR_PEDSTATE_READY; setTimeout(function() { if(closestHouse.streamingRadioStation != -1) { @@ -281,16 +301,16 @@ function enterExitPropertyCommand(command, params, client) { // =========================================================================== function loadGameFixesResource() { - switch(getServerGame()) { - case GAME_GTA_III: - if(findResourceByName("asshat-gta3") != null) { - findResourceByName("asshat-gta3").start(); - } - break; - - default: - break; - } + //switch(getServerGame()) { + // case GAME_GTA_III: + // if(findResourceByName("asshat-gta3") != null) { + // findResourceByName("asshat-gta3").start(); + // } + // break; + // + // default: + // break; + //} return true; } @@ -361,8 +381,10 @@ function showPlayerPrompt(client, promptType, promptMessage, promptTitle) { // =========================================================================== function updateServerGameTime() { - gta.time.hour = getServerConfig().hour; - gta.time.minute = getServerConfig().minute; + if(isTimeSupported()) { + gta.time.hour = getServerConfig().hour; + gta.time.minute = getServerConfig().minute; + } } // =========================================================================== \ No newline at end of file diff --git a/scripts/server/moderation.js b/scripts/server/moderation.js index 9b5daa47..ee5f21e1 100644 --- a/scripts/server/moderation.js +++ b/scripts/server/moderation.js @@ -904,9 +904,9 @@ function getAllVehiclesOwnedByPlayerCommand(command, params, client) { let vehicles = getAllVehiclesOwnedByPlayer(targetClient); - messageClientInfo(client, `${getInlineChatColourByType("clanOrange")}== ${getInlineChatColourByType("jobYellow")}Player Houses ${getInlineChatColourByType("clanOrange")}==========================`); + messagePlayerInfo(client, `${getInlineChatColourByType("clanOrange")}== ${getInlineChatColourByType("jobYellow")}Player Vehicles ${getInlineChatColourByType("clanOrange")}==========================`); for(let i in vehicles) { - messagePlayerNormal(client, `🚗 ${getInlineChatColourByType("vehiclePurple")}[Vehicle Info] ${getInlineChatColourByName("white")}ID: ${getInlineChatColourByName("lightGrey")}${vehicles[i].vehicle.id}, ${getInlineChatColourByName("white")}DatabaseID: ${getInlineChatColourByName("lightGrey")}${vehicles[i].databaseId}, ${getInlineChatColourByName("white")}Type: ${getInlineChatColourByName("lightGrey")}${getVehicleName(vehicles[i].vehicle)}[${vehicles[i].model}], ${getInlineChatColourByName("white")}BuyPrice: ${getInlineChatColourByName("lightGrey")}${vehicles[i].buyPrice}, ${getInlineChatColourByName("white")}RentPrice: ${getInlineChatColourByName("lightGrey")}${vehicles[i].rentPrice}, ${getInlineChatColourByName("white")}Locked: ${getInlineChatColourByName("lightGrey")}${getYesNoFromBool(vehicles[i].locked)}, ${getInlineChatColourByName("white")}Engine: ${getInlineChatColourByName("lightGrey")}${getYesNoFromBool(vehicles[i].engine)}`); + messagePlayerNormal(client, `🚗 ${getInlineChatColourByType("vehiclePurple")}[Vehicle Info] ${getInlineChatColourByName("white")}ID: ${getInlineChatColourByName("lightGrey")}${vehicles[i].index}, ${getInlineChatColourByName("white")}DatabaseID: ${getInlineChatColourByName("lightGrey")}${vehicles[i].databaseId}, ${getInlineChatColourByName("white")}Type: ${getInlineChatColourByName("lightGrey")}${getVehicleName(vehicles[i].vehicle)}[${vehicles[i].model}], ${getInlineChatColourByName("white")}BuyPrice: ${getInlineChatColourByName("lightGrey")}${vehicles[i].buyPrice}, ${getInlineChatColourByName("white")}RentPrice: ${getInlineChatColourByName("lightGrey")}${vehicles[i].rentPrice}, ${getInlineChatColourByName("white")}Locked: ${getInlineChatColourByName("lightGrey")}${getYesNoFromBool(vehicles[i].locked)}, ${getInlineChatColourByName("white")}Engine: ${getInlineChatColourByName("lightGrey")}${getYesNoFromBool(vehicles[i].engine)}`); } } @@ -927,7 +927,7 @@ function getAllBusinessesOwnedByPlayerCommand(command, params, client) { let businesses = getAllBusinessesOwnedByPlayer(targetClient); - messageClientInfo(client, `${getInlineChatColourByType("clanOrange")}== ${getInlineChatColourByType("jobYellow")}Player Businesses ${getInlineChatColourByType("clanOrange")}========================`); + messagePlayerInfo(client, `${getInlineChatColourByType("clanOrange")}== ${getInlineChatColourByType("jobYellow")}Player Businesses ${getInlineChatColourByType("clanOrange")}========================`); for(let i in businesses) { messagePlayerNormal(client, `🏢 ${getInlineChatColourByType("businessBlue")}[Business Info] ${getInlineChatColourByName("white")}Name: ${getInlineChatColourByName("lightGrey")}${businesses[i].name}, ${getInlineChatColourByName("white")}Locked: ${getInlineChatColourByName("lightGrey")}${getYesNoFromBool(intToBool(businesses[i].locked))}, ${getInlineChatColourByName("white")}ID: ${getInlineChatColourByName("lightGrey")}${businesses[i].index}/${businesses[i].databaseId}`); } @@ -950,7 +950,7 @@ function getAllHousesOwnedByPlayerCommand(command, params, client) { let houses = getAllHousesOwnedByPlayer(targetClient); - messageClientInfo(client, `${getInlineChatColourByType("clanOrange")}== ${getInlineChatColourByType("jobYellow")}Player Houses ${getInlineChatColourByType("clanOrange")}============================`); + messagePlayerInfo(client, `${getInlineChatColourByType("clanOrange")}== ${getInlineChatColourByType("jobYellow")}Player Houses ${getInlineChatColourByType("clanOrange")}============================`); for(let i in houses) { messagePlayerNormal(client, `🏠 ${getInlineChatColourByType("houseGreen")}[House Info] ${getInlineChatColourByName("white")}Description: ${getInlineChatColourByName("lightGrey")}${houses[i].description}, ${getInlineChatColourByName("white")}Locked: ${getInlineChatColourByName("lightGrey")}${getYesNoFromBool(intToBool(houses[i].locked))}, ${getInlineChatColourByName("white")}ID: ${getInlineChatColourByName("lightGrey")}${houses[i].index}/${houses[i].databaseId}`); } diff --git a/scripts/server/native/gtac.js b/scripts/server/native/gtac.js index ed0ea243..1f5524bf 100644 --- a/scripts/server/native/gtac.js +++ b/scripts/server/native/gtac.js @@ -3073,7 +3073,1116 @@ let gameData = { [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11], [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15], [], - ] + ], + blipSprites: [ + false, + { // GTA III + policeStation: 8, + fireStation: 9, + hospital: 12, + ammunation: 20, + payAndSpray: 18, + vehicleDealership: 6, + restaurant: -1, + fastFood: -1, + bank: 0, + fuelStation: -1, + business: -1, + house: -1, + }, + { // GTA VC + policeStation: 0, + fireStation: 0, + hospital: 0, + ammunation: 16, + payAndSpray: 27, + vehicleDealership: 7, + restaurant: -1, + fastFood: -1, + bank: 0, + fuelStation: -1, + business: -1, + house: -1, + }, + { // GTA SA + policeStation: 30, + fireStation: 20, + hospital: 22, + ammunation: 6, + payAndSpray: 63, + vehicleDealership: 55, + airplaneDealership: 5, + boatDealership: 9, + restaurant: 50, + fastFood: -1, + clothes: 45, + pizza: 29, + chicken: 14, + burger: 10, + bank: 52, + gasStation: 17, + business: -1, + house: 31, + bar: 49, + club: 48, + gym: 54, + repairGarage: 27, + trophy: 33, + race2: 53, + job: 56, + }, + { // GTA UG + policeStation: 8, + fireStation: 9, + hospital: 12, + ammunation: 20, + payAndSpray: 18, + vehicleDealership: 6, + restaurant: -1, + fastFood: -1, + bank: 52, + fuelStation: 0, + business: -1, + house: -1, + }, + { // GTA IV + policeStation: 8, + fireStation: 9, + hospital: 12, + ammunation: 20, + payAndSpray: 18, + vehicleDealership: 6, + restaurant: -1, + fastFood: -1, + bank: 52, + fuelStation: 0, + business: -1, + house: -1, + }, + ], + pickupModels: [ + {}, + + { // GTA 3 + policeStation: 1361, + fireStation: 1361, + hospital: 1361, + ammunation: 1361, + payAndSpray: 1361, + vehicleDealership: 1361, + restaurant: 1361, + fastFood: 1361, + bank: 1323, + fuelStation: 1361, + business: 1361, + house: 1361, + clothes: 1361, + misc: 1361, + exit: 1361 + }, + + { // GTA Vice City + policeStation: 375, + fireStation: 406, + hospital: 366, + ammunation: 406, + payAndSpray: 406, + vehicleDealership: 406, + restaurant: 406, + fastFood: 406, + bank: 408, + fuelStation: 406, + business: 406, + house: 407, + clothes: 409, + misc: 406, + exit: 406, + }, + + { // GTA San Andreas + policeStation: 1247, + fireStation: 1318, + hospital: 1240, + ammunation: 1239, + payAndSpray: 1239, + vehicleDealership: 1239, + restaurant: 1239, + fastFood: 1239, + bank: 1274, + fuelStation: 1239, + business: 1272, + house: 1273, + clothes: 1275, + misc: 1239, + exit: 1318, + } + ], + pickupTypes: [ + {}, + + { // GTA 3 + business: 255, + house: 255, + bank: 255, + clothes: 255, + info: 255, + job: 255, + }, + + { // GTA Vice City + business: 2, + house: 2, + bank: 2, + clothes: 2, + info: 2, + job: 2, + }, + + { // GTA San Andreas + business: 1, + house: 1, + bank: 1, + clothes: 1, + info: 1, + job: 1, + } + ], + + // THIS IS SCREEN HEIGHT, NOT ACTUAL DOOR POSITION IN THE WORLD + propertyLabelHeight: [ + false, + 85, + 85, + 85, + 85, + 85, + 85, + ], + + removedWorldObjects: [ + false, + + [ // GTA III + ["fraightback04", toVector3(1229.88, -84.8012, 13.4004), 50.0], // Truck trailer in Easy Credit Autos dealership parking lot + ["fraightback03", toVector3(1239.49, -68.0529, 11.6914), 50.0], // Truck trailer in Easy Credit Autos dealership parking lot + ], + + [ // GTA VC + + ], + + [ // GTA SA + + ], + + [ // GTA UG + + ], + + [ // GTA IV + + ], + ], + + excludedGroundSnowModels: [ + false, + + [ // GTA III + + ], + + [ // GTA VC + + ], + + [ // GTA SA + // Twin tunnels from Rodeo, Los Santos to/from Flint County + 13682, // TCElawcuntunb + 13680, // TCElawcuntunb + 13676, // TCElawcuntun1a_law2 + 13677, // TCElawcuntun1a_law2 + + // Los Santos + 6387, // century03_LAw2 (L.A. Century Plaza underground parking) + 17633, // lae2_ground08 + 4818, // TRNTRK8_LAS + 4884, // lastranentun1_LAS + 4885, // lastranentun4_LAS + + // Train Tunnel under Los Santos + 6248, // RailTunn01_LAw + 6249, // RailTunn02_LAw + 6250, // RailTunn03_LAw + 6251, // RailTunn04_LAw + 6252, // RailTunn05_LAw + 5772, // RailTunn01_LAwN (Market Station lower level) + 5773, // TrainStat01_LAwN (Market Station upper/ground level) + 6502, // RailTunn04_LAw2 + 6290, // RailTunn02_LAw2 + 6501, // RailTunn03_LAw2 + 6292, // RailTunn01_LAw2N + + 6966, // vegasNbank1 (L.V. north building underground parking, upper level) + 7245, // vegasNbank1ug (L.V. north building underground parking, lower level) + 7011, // courthse_vgn01 (L.V. courthouse parking structure) + 8390, // multicarpark01_lvS (Large parking structure next to pyramid) + + // Train tunnel next to Las Venturas + 6982, // vgsNtraintunnel01 + 6983, // vgsNtraintunnel02 + 6984, // vgsNtraintunnel03 + 6981, // vgsNtraintunnel04 + ], + + [ // GTA UG + + ], + + [ // GTA IV + + ], + ], + defaultBusinessItems: + [ + { + + }, + { + clothingStore: [ + ["Outfit", 500, 2] + ], + legalGunStore: [ + ["Colt 45", 500, 2], + ["Shotgun", 500, 2], + ["Baseball Bat", 500, 2] + ], + illegalGunStore: [ + ["Uzi", 500, 2], + ["AK-47", 500, 2], + ["M16", 500, 2], + ["Sniper Rifle", 500, 2] + ], + gasStation: [ + ["Bottle of Soda", 500, 2], + ["Can of Soda", 500, 2], + ["Slice of Pizza", 500, 2], + ["Bottle of Water", 500, 2], + ["Can of Beer", 500, 2], + ], + electronicsStore: [ + ["Phone", 500, 2], + ["Walkie Talkie", 500, 2], + ["Megaphone", 500, 2], + ["Tazer", 500, 2], + ["Camera", 500, 2], + ], + bar: [ + ["Bottle of Vodka", 500, 2], + ["Bottle of Whiskey", 500, 2], + ["Bottle of Soda", 500, 2], + ["Bottle of Wine", 500, 2], + ["Bottle of Bourbon", 500, 2], + ["Shot of Bourbon", 500, 2], + ["Shot of Vodka", 500, 2], + ["Shot of Whiskey", 500, 2], + ["Glass of Wine", 500, 2], + ], + club: [ + ["Bottle of Vodka", 500, 2], + ["Bottle of Whiskey", 500, 2], + ["Bottle of Soda", 500, 2], + ["Bottle of Wine", 500, 2], + ["Bottle of Bourbon", 500, 2], + ["Shot of Bourbon", 500, 2], + ["Shot of Vodka", 500, 2], + ["Shot of Whiskey", 500, 2], + ["Glass of Wine", 500, 2], + ], + chicken: [ + ["Bucket of Chicken", 500, 2], + ["Chicken Tenders Meal", 500, 2], + ["Large Fries", 500, 2], + ["Small Fries", 500, 2], + ["Bottle of Soda", 500, 2], + ], + burger: [ + ["Bacon Cheeseburger", 500, 2], + ["Double Cheeseburger", 500, 2], + ["Big Boy Burger", 500, 2], + ["Large Fries", 500, 2], + ["Small Fries", 500, 2], + ["Bottle of Soda", 500, 2], + ], + chinese: [ + ["Egg Roll", 500, 2], + ["Lo Mein", 500, 2], + ["Fried Rice", 500, 2], + ["Crab Rangoon", 500, 2], + ["Egg Drop Soup", 500, 2], + ["Moo Shu Pork", 500, 2], + ["Egg Foo Young", 500, 2], + ["Sesame Chicken", 500, 2], + ], + italian: [ + ["Bottle of Wine", 500, 2], + ["Glass of Wine", 500, 2], + ["Arancini", 500, 2], + ["Lasagne", 500, 2], + ["Chicken Alfredo", 500, 2], + ["Fettucine Alfredo", 500, 2], + ["Chicken Parmigiana", 500, 2], + ["Chicken Carbonara", 500, 2], + ["Sausage Rigatoni", 500, 2], + ["Chicken Salad", 500, 2], + ["Caesar Salad", 500, 2], + ], + mexican: [ + ["Crunchy Taco", 500, 2], + ["Beaf and Bean Burrito", 500, 2], + ["Burrito Supreme", 500, 2], + ["Cheesy Nachos", 500, 2], + ["Nacho Supreme", 500, 2], + ["Bottle of Soda", 500, 2], + ], + pizza: [ + ["Large Pizza", 500, 2], + ["Medium Pizza", 500, 2], + ["Small Pizza", 500, 2], + ["Buffalo Wings", 500, 2], + ["Hot Wings", 500, 2], + ["Bottle of Soda", 500, 2], + ], + }, + { + clothingStore: [ + ["Outfit", 500, 2] + ], + legalGunStore: [ + ["Colt .45", 500, 2], + ["Python", 500, 2], + ["Shotgun", 500, 2], + ["Stubby Shotgun", 500, 2], + ["Baseball Bat", 500, 2], + ["Brass Knuckles", 500, 2], + ], + illegalGunStore: [ + ["Uzi", 500, 2], + ["MP5", 500, 2], + ["Tec-9", 500, 2], + ["Ingram", 500, 2], + ["Ruger", 500, 2], + ["M4", 500, 2], + ["Sniper Rifle", 500, 2], + ["Laser Sniper", 500, 2], + ], + gasStation: [ + ["Bottle of Soda", 500, 2], + ["Can of Soda", 500, 2], + ["Slice of Pizza", 500, 2], + ["Bottle of Water", 500, 2], + ["Can of Beer", 500, 2] + ], + electronicsStore: [ + ["Phone", 500, 2], + ["Walkie Talkie", 500, 2], + ["Megaphone", 500, 2], + ["Tazer", 500, 2], + ["Camera", 500, 2] + ], + bar: [ + ["Bottle of Vodka", 500, 2], + ["Bottle of Whiskey", 500, 2], + ["Bottle of Soda", 500, 2], + ["Bottle of Wine", 500, 2], + ["Bottle of Bourbon", 500, 2], + ["Shot of Bourbon", 500, 2], + ["Shot of Vodka", 500, 2], + ["Shot of Whiskey", 500, 2], + ["Glass of Wine", 500, 2], + ], + club: [ + ["Bottle of Vodka", 500, 2], + ["Bottle of Whiskey", 500, 2], + ["Bottle of Soda", 500, 2], + ["Bottle of Wine", 500, 2], + ["Bottle of Bourbon", 500, 2], + ["Shot of Bourbon", 500, 2], + ["Shot of Vodka", 500, 2], + ["Shot of Whiskey", 500, 2], + ["Glass of Wine", 500, 2], + ], + chicken: [ + ["Bucket of Chicken", 500, 2], + ["Chicken Tenders Meal", 500, 2], + ["Large Fries", 500, 2], + ["Small Fries", 500, 2], + ["Bottle of Soda", 500, 2], + ], + burger: [ + ["Bacon Cheeseburger", 500, 2], + ["Double Cheeseburger", 500, 2], + ["Big Boy Burger", 500, 2], + ["Large Fries", 500, 2], + ["Small Fries", 500, 2], + ["Bottle of Soda", 500, 2], + ], + chinese: [ + ["Egg Roll", 500, 2], + ["Lo Mein", 500, 2], + ["Fried Rice", 500, 2], + ["Crab Rangoon", 500, 2], + ["Egg Drop Soup", 500, 2], + ["Moo Shu Pork", 500, 2], + ["Egg Foo Young", 500, 2], + ["Sesame Chicken", 500, 2], + ], + italian: [ + ["Bottle of Wine", 500, 2], + ["Glass of Wine", 500, 2], + ["Arancini", 500, 2], + ["Lasagne", 500, 2], + ["Chicken Alfredo", 500, 2], + ["Fettucine Alfredo", 500, 2], + ["Chicken Parmigiana", 500, 2], + ["Chicken Carbonara", 500, 2], + ["Sausage Rigatoni", 500, 2], + ["Chicken Salad", 500, 2], + ["Caesar Salad", 500, 2], + ], + mexican: [ + ["Crunchy Taco", 500, 2], + ["Beaf and Bean Burrito", 500, 2], + ["Burrito Supreme", 500, 2], + ["Cheesy Nachos", 500, 2], + ["Nacho Supreme", 500, 2], + ["Bottle of Soda", 500, 2], + ], + pizza: [ + ["Large Pizza", 500, 2], + ["Medium Pizza", 500, 2], + ["Small Pizza", 500, 2], + ["Buffalo Wings", 500, 2], + ["Hot Wings", 500, 2], + ["Bottle of Soda", 500, 2], + ], + }, + { + clothingStore: [ + ["Outfit", 500, 2] + ], + legalGunStore: [ + ["Baseball Bat", 500, 2], + ["Pepper Spray", 500, 2], + ["Brass Knuckles", 500, 2], + ["9mm", 500, 2], + ["Desert Eagle", 500, 2], + ["Shotgun", 500, 2], + ["Country Rifle", 500, 2] + ], + illegalGunStore: [ + ["Micro SMG/Uzi", 500, 2], + ["MP5", 500, 2], + ["Tec-9", 500, 2], + ["AK-47", 500, 2], + ["M4", 500, 2], + ["Combat Shotgun", 500, 2], + ["Sniper Rifle", 500, 2] + ], + sexShop: [ + ["Purple Dildo", 500, 2], + ["Dildo", 500, 2], + ["Vibrator", 500, 2], + ["Silver Vibrator", 500, 2], + ["Flowers", 500, 2] + ], + gasStation: [ + ["Bottle of Soda", 500, 2], + ["Can of Soda", 500, 2], + ["Slice of Pizza", 500, 2], + ["Bottle of Water", 500, 2], + ["Can of Beer", 500, 2] + ], + electronicsStore: [ + ["Phone", 500, 2], + ["Walkie Talkie", 500, 2], + ["Megaphone", 500, 2], + ["Tazer", 500, 2], + ["Camera", 500, 2] + ], + bar: [ + ["Bottle of Vodka", 500, 2], + ["Bottle of Whiskey", 500, 2], + ["Bottle of Soda", 500, 2], + ["Bottle of Wine", 500, 2], + ["Bottle of Bourbon", 500, 2], + ["Shot of Bourbon", 500, 2], + ["Shot of Vodka", 500, 2], + ["Shot of Whiskey", 500, 2], + ["Glass of Wine", 500, 2], + ], + club: [ + ["Bottle of Vodka", 500, 2], + ["Bottle of Whiskey", 500, 2], + ["Bottle of Soda", 500, 2], + ["Bottle of Wine", 500, 2], + ["Bottle of Bourbon", 500, 2], + ["Shot of Bourbon", 500, 2], + ["Shot of Vodka", 500, 2], + ["Shot of Whiskey", 500, 2], + ["Glass of Wine", 500, 2], + ], + chicken: [ + ["Bucket of Chicken", 500, 2], + ["Chicken Tenders Meal", 500, 2], + ["Large Fries", 500, 2], + ["Small Fries", 500, 2], + ["Bottle of Soda", 500, 2], + ], + burger: [ + ["Bacon Cheeseburger", 500, 2], + ["Double Cheeseburger", 500, 2], + ["Big Boy Burger", 500, 2], + ["Large Fries", 500, 2], + ["Small Fries", 500, 2], + ["Bottle of Soda", 500, 2], + ], + chinese: [ + ["Egg Roll", 500, 2], + ["Lo Mein", 500, 2], + ["Fried Rice", 500, 2], + ["Crab Rangoon", 500, 2], + ["Egg Drop Soup", 500, 2], + ["Moo Shu Pork", 500, 2], + ["Egg Foo Young", 500, 2], + ["Sesame Chicken", 500, 2], + ], + italian: [ + ["Bottle of Wine", 500, 2], + ["Glass of Wine", 500, 2], + ["Arancini", 500, 2], + ["Lasagne", 500, 2], + ["Chicken Alfredo", 500, 2], + ["Fettucine Alfredo", 500, 2], + ["Chicken Parmigiana", 500, 2], + ["Chicken Carbonara", 500, 2], + ["Sausage Rigatoni", 500, 2], + ["Chicken Salad", 500, 2], + ["Caesar Salad", 500, 2], + ], + mexican: [ + ["Crunchy Taco", 500, 2], + ["Beaf and Bean Burrito", 500, 2], + ["Burrito Supreme", 500, 2], + ["Cheesy Nachos", 500, 2], + ["Nacho Supreme", 500, 2], + ["Bottle of Soda", 500, 2], + ], + pizza: [ + ["Large Pizza", 500, 2], + ["Medium Pizza", 500, 2], + ["Small Pizza", 500, 2], + ["Buffalo Wings", 500, 2], + ["Hot Wings", 500, 2], + ["Bottle of Soda", 500, 2], + ], + } + ], + interiorTemplates: [ + false, + + { // GTA 3 + + }, + + { // GTA VC + mall: [toVector3(379.62, 1007.00, 19.22), 4], + malibu: [toVector3(489.83, -76.49, 11.48), 17], + vcpd: [toVector3(396.38, -472.96, 12.34), 12], + apartment: [toVector3(26.67, -1328.89, 13.00), 11], + hotelLobby: [toVector3(228.53, -1277.12, 12.07), 1], + bikerBar: [toVector3(-597.41, 651.84, 11.30), 11], + mansion: [toVector3(-379.14, -551.65, 19.32), 2], + gunRange: [toVector3(-667.79, 1217.51, 11.10), 10], + bank: [toVector3(-894.52, -341.16, 13.45), 3], + stripClub: [toVector3(97.53, -1472.06, 10.43), 5], + rosenberg: [toVector3(120.82, -827.98, 10.62), 6], + arena: [toVector3(-1080.49, 1331.16, 13.91), 15], + ghettoShack: [toVector3(-962.74, 146.96, 9.40), 12], + hotelRoom: [toVector3(226.47, -1274.98, 19.271), 2.933], + + }, + + { // GTA SA + lspd: [toVector3(247.113, 62.929, 1003.64), 2], + lvpd: [toVector3(288.82, 167.39, 1007.17), 3], + sfpd: [toVector3(246.40, 110.84, 1003.22), 10], + reeceBarberShop: [toVector3(411.62, -21.43, 1001.80), 2], + fourDragons: [toVector3(2016.26, 1017.77, 996.87), 10], + caligula: [toVector3(2233.8, 1712.23, 1011.76), 1], + genericCasino: [toVector3(1118.88, -10.27, 1002.08), 12], + cluckinBell: [toVector3(365.71, -9.88, 1001.85), 9], + pizzaStack: [toVector3(372.35, -131.65, 1001.49), 5], + burgerShot: [toVector3(375.96, -65.81, 1001.50), 10], + tattooParlor: [toVector3(-203.07, -24.16, 1002.27), 16], + bank: [toVector3(2305.14, -16.274, 26.74), 1], + gas1: [toVector3(-25.88, -185.86, 1003.54), 17], + gas2: [toVector3(6.09, -29.27, 1003.54), 10], + gas3: [toVector3(-30.94, -89.60, 1003.54), 18], + gas4: [toVector3(-25.13, -139.06, 1003.54), 16], + gas5: [toVector3( -27.31, -29.27, 1003.54), 4], + gas6: [toVector3(-26.69, -55.71, 1003.54), 6], + shamal: [toVector3(2.38, 33.10, 1199.84), 1], + andromeda: [toVector3(315.85, 1024.49, 1949.79), 9], + airportTickets: [toVector3(-1827.14, 7.20, 1061.14), 14], + airportBaggage: [toVector3(-1855.56, 41.26, 1061.14), 14], + ammu1: [toVector3(286.14, -40.64, 1001.56), 1], + ammu2: [toVector3(286.80, -82.54, 1001.53), 4], + ammu3: [toVector3(296.91, -108.07, 1001.56), 6], + ammu4: [toVector3(314.82, -141.43, 999.66), 7], + ammu5: [toVector3(316.52, -167.70, 999.66), 6], + ammuBooth: [toVector3(302.29, -143.13, 1004.06), 7], + ammuRange: [toVector3(280.79, -135.20, 1004.06), 7], + house1: [toVector3(235.51, 1189.17, 1080.34), 3], + house2: [toVector3(225.76, 1240.00, 1082.15), 2], + house3: [toVector3(223.04, 1289.26, 1082.20), 1], + house4: [toVector3(225.63, 1022.48, 1084.07), 7], + house5: [toVector3(295.14, 1474.47, 1080.52), 15], + house6: [toVector3(328.49, 1480.59, 1084.45), 15], + house7: [toVector3(385.80, 1471.77, 1080.21), 15], + atrium: [toVector3(1726.18, -1641.00, 20.23), 18], + crackPalace: [toVector3(2,567.52, -1294.59, 1063.25), 2], + bloodbowlStadium: [toVector3(-1394.20, 987.62, 1023.96), 15], + burningDesireHouse: [toVector3(2338.32, -1180.61, 1027.98), 5], + furhbergerHouse: [toVector3(2807.63, -1170.15, 1025.57), 8], + dillimoreGas: [toVector3(664.19, -570.73, 16.34), 0], + donutShop: [toVector3(376.99, -191.21, 1000.63), 17], + airport: [toVector3(-1830.81, 16.83, 1061.14), 14], + jeffersonMotel: [toVector3(2220.26, -1,148.01, 1025.80), 15], + kickstartStadium: [toVector3(-1410.72, 1,591.16, 1052.53), 14], + libertyCity: [toVector3(-750.80, 491.00, 1371.70), 1], + lsxBaggageReclaim: [toVector3(-1870.80, 59.81, 1056.25), 14], + jizzy: [toVector3(-2637.69, 1404.24, 906.46), 3], + rcBattlefield: [toVector3(-1079.99, 1061.58, 1343.04), 10], + ryderHouse: [toVector3(2451.77, -1699.80, 1013.51), 2], + sfGarage: [toVector3(-2042.42, 178.59, 28.84), 1], + sweetHouse: [toVector3(2535.83, -1,674.32, 1015.50), 1], + katieHouse: [toVector3(267.22, 304.71, 999.14), 2], + helenaHouse: [toVector3(292.44, 308.77, 999.14), 3], + welcomePump: [toVector3(681.66, -453.32, -25.61), 1], + woozieApartment: [toVector3(-2158.72, 641.29, 1052.38), 1], + eightTrackStadium: [toVector3(-1395.96, -208.20, 1051.17), 7], + dirtBikeStadium: [toVector3(-1424.93, -664.59, 1059.86), 4], + crackDen: [toVector3(318.57, 1115.21, 1082.98), 5], + motelRoom: [toVector3(2251.85, -1138.16, 1050.63), 9], + hashburyHouse: [toVector3(2260.76, -1210.45, 1049.02), 10], + cjHouse: [toVector3(2496.65, -1696.55, 1014.74), 3], + maddDoggMansion: [toVector3(1299.14, -794.77, 1084.00), 5], + motelRoom2: [toVector3(2262.83, -1137.71, 1050.63), 10], + safeHouse1: [toVector3(2365.42, -1131.85, 1050.88), 8], + safeHouse2: [toVector3(2324.33, -1144.79, 1050.71), 12], + zeroStore: [toVector3(-2240.00, 131.00, 1035.40), 6], + brothel1: [toVector3(940.65, -18.48, 1000.93), 3], + brothel2: [toVector3(967.53, -53.02, 1001.12), 3], + brothel3: [toVector3(744.27, 1437.25, 1102.70), 6], + prolapsStore: [toVector3(207.35, -138.00, 1003.31), 3], + victimStore: [toVector3(221.33, -6.61, 1005.19), 5], + suburbanStore: [toVector3(203.81, -46.53, 1001.80), 1], + sexShop: [toVector3(-106.72, -19.64, 1000.71), 3], + bincoStore: [toVector3(207.54, -109.00, 1005.13), 15], + wardrobe: [toVector3(255.71, -41.13, 1002.02), 14], + cityHall: [toVector3(389.538, 173.652, 1008.38), 3], + gantonGym: [toVector3(772.2,-5.06,1000.73), 1], + kungFuGym: [toVector3(774.21, -48.92, 1000.58), 6], + lvGym: [toVector3(773.57, -77.09, 1000.65), 7], + insuranceCompany: [toVector3(-2029.76, -119.624, 1035.17), 1], + stripClub1: [toVector3(1204.80,-11.58,1000.92), 2], + stripClub1Private: [toVector3(1204.80, 13.89, 1000.92), 2], + nightClub: [toVector3(493.39,-22.72,1000.67), 17], + warehouse1: [toVector3(1412.63, -1.78, 1000.92), 1], + warehouse2: [toVector3(1302.51, -1.78, 1001.02), 18], + warehouse3: [toVector3(76.63, -301.15, 1.57), 0], + warehouse4: [toVector3(1059.89, 2081.68, 10.82), 0], + bikeSchool: [toVector3(1494.32, 1304.94, 1093.28), 3], + bar1: [toVector3(501.98,-69.15,998.75), 11], + diner1: [toVector3(457.30, -88.42, 999.55), 4], + diner2: [toVector3(454.97, -110.10, 1000.07), 4], + diner3: [toVector3(435.27, -80.95, 999.55), 5], + smallPoliceStation: [toVector3(322.19, 302.49, 999.14), 5], + }, + + { // GTA UG + + }, + + { // GTA IV + + }, + ], + skinChangePosition: [ + [], + [], + [], + [toVector3(258.14, -41.76, 1002.023), 1.322, 14], + [], + [], + ], + policeStations: [ + false, + [ // GTA 3 + { + position: toVector3(1143.875, -675.1875, 14.97), + heading: 1.5, + blip: false, + name: "Portland", + }, + { + position: toVector3(340.25, -1123.375, 25.98), + heading: 3.14, + blip: false, + name: "Staunton Island", + }, + { + position: toVector3(-1253.0, -138.1875, 58.75), + heading: 1.5, + blip: false, + name: "Shoreside Vale", + }, + ], + [ // GTA VC + { + position: toVector3(399.77, -468.90, 11.73), + heading: 0.0, + blip: false, + name: "Washington Beach", + }, + { + position: toVector3(508.96, 512.07, 12.10), + heading: 0.0, + blip: false, + name: "Vice Point", + }, + { + position: toVector3(-657.43, 762.31, 11.59), + heading: 0.0, + blip: false, + name: "Downtown", + }, + { + position: toVector3(-885.08, -470.44, 13.11), + heading: 0.0, + blip: false, + name: "Little Havana", + }, + ], + [ // GTA SA + { + position: toVector3(1545.53, -1675.64, 13.561), + heading: -1.575, + blip: false, + name: "Los Santos", + }, + + ], + [ // GTA UG + + ], + [ // GTA IV + + { + position: toVector3(894.99, -357.39, 18.185), + heading: 2.923, + blip: false, + name: "Broker", + }, + { + position: toVector3(435.40, 1592.29, 17.353), + heading: 3.087, + blip: false, + name: "South Bohan", + }, + { + position: toVector3(974.93, 1870.45, 23.073), + heading: -1.621, + blip: false, + name: "Northern Gardens", + }, + { + position: toVector3(1233.25, -89.13, 28.034), + heading: 1.568, + blip: false, + name: "South Slopes", + }, + { + position: toVector3(50.12, 679.88, 15.316), + heading: 1.569, + blip: false, + name: "Middle Park East", + }, + { + position: toVector3(85.21, 1189.82, 14.755), + heading: 3.127, + blip: false, + name: "East Holland", + }, + { + position: toVector3(2170.87, 448.87, 6.085), + heading: 1.501, + blip: false, + name: "Francis International Airport", + }, + { + position: toVector3(213.12, -211.70, 10.752), + heading: 0.200, + blip: false, + name: "Chinatown", + }, + { + position: toVector3(-1714.95, 276.31, 22.134), + heading: 1.127, + blip: false, + name: "Acter", + }, + { + position: toVector3(-1220.73, -231.53, 3.024), + heading: 2.210, + blip: false, + name: "Port Tudor", + }, + { + position: toVector3(-927.66, 1263.63, 24.587), + heading: -0.913, + blip: false, + name: "Leftwood", + }, + ] + ], + fireStations: [ + false, + [ // GTA 3 + { + position: toVector3(1103.70, -52.45, 7.49), + heading: 1.5, + blip: false, + name: "Portland", + }, + { + position: toVector3(-78.48, -436.80, 16.17), + heading: 3.14, + blip: false, + name: "Staunton Island", + }, + { + position: toVector3(-1202.10, -14.67, 53.20), + heading: 1.5, + blip: false, + name: "Shoreside Vale", + }, + ], + [ // GTA VC + + ], + [ // GTA SA + + ], + [ // GTA UG + + ], + [ // GTA IV + { + position: toVector3(953.13, 95.90, 35.004), + heading: 1.595, + blip: false, + name: "Broker", + }, + { + position: toVector3(-271.02, 1542.15, 20.420), + heading: -1.160, + blip: false, + name: "Northwood", + }, + { + position: toVector3(1120.47, 1712.36, 10.534), + heading: -0.682, + blip: false, + name: "Northern Gardens", + }, + { + position: toVector3(2364.87, 166.83, 5.813), + heading: 0.156, + blip: false, + name: "Francis International Airport", + }, + { + position: toVector3(295.40, -336.88, 4.963), + heading: 2.887, + blip: false, + name: "Chinatown", + }, + ] + ], + hospitals: [ + false, + [ // GTA 3 + { + position: toVector3(1144.25, -596.875, 14.97), + heading: 1.5, + blip: false, + name: "Portland", + }, + { + position: toVector3(183.5, -17.75, 16.21), + heading: 3.14, + blip: false, + name: "Staunton Island", + }, + { + position: toVector3(-1259.5, -44.5, 58.89), + heading: 1.5, + blip: false, + name: "Shoreside Vale", + }, + ], + [ // GTA VC + { + position: toVector3(493.14, 709.31, 11.80), + heading: 1.5, + blip: false, + name: "Unknown", + }, + { + position: toVector3(-826.06, 1144.41, 12.41), + heading: 1.5, + blip: false, + name: "Unknown", + }, + ], + [ // GTA SA + { + position: toVector3(1172.96, -1323.42, 15.40), + heading: 1.5, + blip: false, + name: "All Saints", + }, + { + position: toVector3(2034.04, -1405.07, 17.24), + heading: 1.5, + blip: false, + name: "County General", + }, + ], + [ // GTA UG + + ], + [ // GTA IV + { + position: toVector3(1199.59, 196.78, 33.554), + heading: 1.633, + blip: false, + name: "Schottler", + }, + { + position: toVector3(980.71, 1831.61, 23.898), + heading: -0.049, + blip: false, + name: "Northern Gardens", + }, + { + position: toVector3(-1317.27, 1277.20, 22.370), + heading: 2.246, + blip: false, + name: "Leftwood", + }, + { + position: toVector3(-1538.43, 344.58, 20.943), + heading: -0.156, + blip: false, + name: "Acter", + }, + ] + ], + payAndSprays: [ + false, + [ // GTA 3 + { + position: toVector3(925.4, -360.3, 10.83), + blip: false, + name: "Portland", + }, + { + position: toVector3(381.8, -493.8, 25.95), + blip: false, + name: "Staunton Island", + }, + { + position: toVector3(-1142.4, 35.01, 58.61), + blip: false, + name: "Shoreside Vale", + }, + ], + [ // GTA VC + + ], + [ // GTA SA + + ], + [ // GTA UG + + ], + [ // GTA IV + + ] + ], + + ammunations: [ + false, + [ // GTA 3 + { + position: toVector3(1068.3, -400.9, 15.24), + blip: false, + name: "Portland", + }, + { + position: toVector3(348.2, -717.9, 26.43), + blip: false, + name: "Staunton Island", + }, + ], + [ // GTA VC + + ], + [ // GTA SA + + ], + [ // GTA UG + + ], + [ // GTA IV + + ] + ], + fuelStations: [ + false, + [ // GTA 3 + + { + position: toVector3(1161.9, -76.73, 7.27), + blip: false, + name: "Portland", + }, + ], + [ // GTA VC + + ], + [ // GTA SA + + ], + [ // GTA UG + + ], + [ // GTA IV + + ] + ], }; // =========================================================================== @@ -3433,8 +4542,8 @@ function getServerName() { // =========================================================================== -function createGamePickup(model, position, type = 2) { - return gta.createPickup(model, position, type = 2); +function createGamePickup(model, position, type) { + return gta.createPickup(model, position, type); } // =========================================================================== @@ -3480,7 +4589,7 @@ function getPlayerLastVehicle(client) { // =========================================================================== function isVehicleObject(vehicle) { - return (vehicle instanceof Vehicle); + return (vehicle.type == ELEMENT_VEHICLE); } // =========================================================================== @@ -3523,7 +4632,7 @@ function setVehicleColours(vehicle, colour1, colour2) { // =========================================================================== function createGameVehicle(modelId, position, heading) { - gta.createVehicle(modelId, position, heading); + return gta.createVehicle(modelId, position, heading); } // =========================================================================== @@ -3672,9 +4781,11 @@ function getVehicleModelIdFromParams(params) { // =========================================================================== function setGameTime(hour, minute, minuteDuration = 1000) { - gta.time.hour = hour; - gta.time.minute = minute; - gta.time.minuteDuration = minuteDuration; + if(isTimeSupported()) { + gta.time.hour = hour; + gta.time.minute = minute; + gta.time.minuteDuration = minuteDuration; + } } // =========================================================================== \ No newline at end of file diff --git a/scripts/server/native/mafiac.js b/scripts/server/native/mafiac.js index dedeb925..c213a212 100644 --- a/scripts/server/native/mafiac.js +++ b/scripts/server/native/mafiac.js @@ -723,6 +723,9 @@ let gameData = { "UfoPanak", "invisible" ], + ], + objectModels: [ + ], weaponModels: [ [], @@ -775,7 +778,244 @@ let gameData = { meleeWeapons: [ [], [2, 3, 4], - ] + ], + excludedGroundSnowModels: [ + false, + [], + [], + [], + [], + ], + pickupModels: [ + {}, + + { // GTA 3 + policeStation: 1361, + fireStation: 1361, + hospital: 1361, + ammunation: 1361, + payAndSpray: 1361, + vehicleDealership: 1361, + restaurant: 1361, + fastFood: 1361, + bank: 1323, + fuelStation: 1361, + business: 1361, + house: 1361, + clothes: 1361, + misc: 1361, + exit: 1361 + }, + + { // GTA Vice City + policeStation: 375, + fireStation: 406, + hospital: 366, + ammunation: 406, + payAndSpray: 406, + vehicleDealership: 406, + restaurant: 406, + fastFood: 406, + bank: 408, + fuelStation: 406, + business: 406, + house: 407, + clothes: 409, + misc: 406, + exit: 406, + }, + + { // GTA San Andreas + policeStation: 1247, + fireStation: 1318, + hospital: 1240, + ammunation: 1239, + payAndSpray: 1239, + vehicleDealership: 1239, + restaurant: 1239, + fastFood: 1239, + bank: 1274, + fuelStation: 1239, + business: 1272, + house: 1273, + clothes: 1275, + misc: 1239, + exit: 1318, + } + ], + pickupTypes: [ + {}, + + { // GTA 3 + business: 255, + house: 255, + bank: 255, + clothes: 255, + info: 255, + job: 255, + }, + + { // GTA Vice City + business: 2, + house: 2, + bank: 2, + clothes: 2, + info: 2, + job: 2, + }, + + { // GTA San Andreas + business: 1, + house: 1, + bank: 1, + clothes: 1, + info: 1, + job: 1, + } + ], + + // THIS IS SCREEN HEIGHT, NOT ACTUAL DOOR POSITION IN THE WORLD + propertyLabelHeight: [ + false, + 85, + 85, + 85, + 85, + 85, + 85, + ], + + removedWorldObjects: [ + false, + + [ // Mafia 1 + //new serverClasses.removedWorldObjectData("fraightback04", toVector3(1229.88, -84.8012, 13.4004), 50.0), // Truck trailer in Easy Credit Autos dealership parking lot + ], + + [ // Mafia 2 + + ], + + [ // Mafia 3 + + ], + + [ // Mafia Definitive Edition + + ], + ], + defaultBusinessItems: + [ + { + + }, + { + clothingStore: [ + ["Outfit", 500, 2] + ], + legalGunStore: [ + ["Colt 45", 500, 2], + ["Shotgun", 500, 2], + ["Baseball Bat", 500, 2] + ], + illegalGunStore: [ + ["Uzi", 500, 2], + ["AK-47", 500, 2], + ["M16", 500, 2], + ["Sniper Rifle", 500, 2] + ], + gasStation: [ + ["Bottle of Soda", 500, 2], + ["Can of Soda", 500, 2], + ["Slice of Pizza", 500, 2], + ["Bottle of Water", 500, 2], + ["Can of Beer", 500, 2], + ], + electronicsStore: [ + ["Phone", 500, 2], + ["Walkie Talkie", 500, 2], + ["Megaphone", 500, 2], + ["Tazer", 500, 2], + ["Camera", 500, 2], + ], + bar: [ + ["Bottle of Vodka", 500, 2], + ["Bottle of Whiskey", 500, 2], + ["Bottle of Soda", 500, 2], + ["Bottle of Wine", 500, 2], + ["Bottle of Bourbon", 500, 2], + ["Shot of Bourbon", 500, 2], + ["Shot of Vodka", 500, 2], + ["Shot of Whiskey", 500, 2], + ["Glass of Wine", 500, 2], + ], + club: [ + ["Bottle of Vodka", 500, 2], + ["Bottle of Whiskey", 500, 2], + ["Bottle of Soda", 500, 2], + ["Bottle of Wine", 500, 2], + ["Bottle of Bourbon", 500, 2], + ["Shot of Bourbon", 500, 2], + ["Shot of Vodka", 500, 2], + ["Shot of Whiskey", 500, 2], + ["Glass of Wine", 500, 2], + ], + chicken: [ + ["Bucket of Chicken", 500, 2], + ["Chicken Tenders Meal", 500, 2], + ["Large Fries", 500, 2], + ["Small Fries", 500, 2], + ["Bottle of Soda", 500, 2], + ], + burger: [ + ["Bacon Cheeseburger", 500, 2], + ["Double Cheeseburger", 500, 2], + ["Big Boy Burger", 500, 2], + ["Large Fries", 500, 2], + ["Small Fries", 500, 2], + ["Bottle of Soda", 500, 2], + ], + chinese: [ + ["Egg Roll", 500, 2], + ["Lo Mein", 500, 2], + ["Fried Rice", 500, 2], + ["Crab Rangoon", 500, 2], + ["Egg Drop Soup", 500, 2], + ["Moo Shu Pork", 500, 2], + ["Egg Foo Young", 500, 2], + ["Sesame Chicken", 500, 2], + ], + italian: [ + ["Bottle of Wine", 500, 2], + ["Glass of Wine", 500, 2], + ["Arancini", 500, 2], + ["Lasagne", 500, 2], + ["Chicken Alfredo", 500, 2], + ["Fettucine Alfredo", 500, 2], + ["Chicken Parmigiana", 500, 2], + ["Chicken Carbonara", 500, 2], + ["Sausage Rigatoni", 500, 2], + ["Chicken Salad", 500, 2], + ["Caesar Salad", 500, 2], + ], + mexican: [ + ["Crunchy Taco", 500, 2], + ["Beaf and Bean Burrito", 500, 2], + ["Burrito Supreme", 500, 2], + ["Cheesy Nachos", 500, 2], + ["Nacho Supreme", 500, 2], + ["Bottle of Soda", 500, 2], + ], + pizza: [ + ["Large Pizza", 500, 2], + ["Medium Pizza", 500, 2], + ["Small Pizza", 500, 2], + ["Buffalo Wings", 500, 2], + ["Hot Wings", 500, 2], + ["Bottle of Soda", 500, 2], + ], + }, + ], }; // =========================================================================== @@ -1176,7 +1416,7 @@ function getPlayerLastVehicle(client) { // =========================================================================== function isVehicleObject(vehicle) { - return (vehicle instanceof Vehicle); + return (vehicle.type == ELEMENT_VEHICLE); } // =========================================================================== diff --git a/scripts/server/subaccount.js b/scripts/server/subaccount.js index c9459835..b679b8f2 100644 --- a/scripts/server/subaccount.js +++ b/scripts/server/subaccount.js @@ -89,77 +89,81 @@ function saveSubAccountToDatabase(subAccountData) { let safeLastName = escapeDatabaseString(dbConnection, subAccountData.lastName); let safeMiddleName = escapeDatabaseString(dbConnection, subAccountData.middleName); - let dbQueryString = ` - UPDATE sacct_main SET - sacct_name_first='${safeFirstName}', - sacct_name_last='${safeLastName}', - sacct_name_middle='${safeMiddleName}', - sacct_cash=${subAccountData.cash}, - sacct_when_lastlogin=${subAccountData.lastLogin}, - sacct_pos_x=${subAccountData.spawnPosition.x}, - sacct_pos_y=${subAccountData.spawnPosition.y}, - sacct_pos_z=${subAccountData.spawnPosition.z}, - sacct_angle=${subAccountData.spawnHeading}, - sacct_int=${subAccountData.interior}, - sacct_vw=${subAccountData.dimension}, - sacct_inhouse=${(subAccountData.inHouse != 0) ? getHouseData(subAccountData.inHouse).databaseId : 0}, - sacct_inbusiness=${(subAccountData.inBusiness != 0) ? getBusinessData(subAccountData.inBusiness).databaseId : 0}, - sacct_health=${subAccountData.health}, - sacct_armour=${subAccountData.armour} - WHERE sacct_id=${subAccountData.databaseId}`; + let data = [ + //["sacct_svr", getServerId()], + ["sacct_acct", subAccountData.account], + ["sacct_name_first", safeFirstName], + ["sacct_name_last", safeLastName], + ["sacct_name_middle", safeMiddleName], + ["sacct_cash", subAccountData.cash], + ["sacct_when_lastlogin", subAccountData.lastLogin], + ["sacct_pos_x", subAccountData.spawnPosition.x], + ["sacct_pos_y", subAccountData.spawnPosition.x], + ["sacct_pos_z", subAccountData.spawnPosition.z], + ["sacct_rot_z", subAccountData.spawnHeading], + ["sacct_int", subAccountData.interior], + ["sacct_vw", subAccountData.dimension], + ["sacct_inhouse", (subAccountData.inHouse != 0) ? getHouseData(subAccountData.inHouse).databaseId : 0], + ["sacct_inbusiness", (subAccountData.inBusiness != 0) ? getBusinessData(subAccountData.inBusiness).databaseId : 0], + ["sacct_health", subAccountData.health], + ["sacct_armour", subAccountData.armour], + ]; - //dbQueryString = dbQueryString.trim(); - dbQueryString = dbQueryString.replace(/(?:\r\n|\r|\n|\t)/g, ""); - let dbQuery = queryDatabase(dbConnection, dbQueryString); + let dbQuery = null; + let queryString = createDatabaseUpdateQuery("sacct_main", data, `sacct_id=${subAccountData.databaseId}`); + dbQuery = queryDatabase(dbConnection, queryString); freeDatabaseQuery(dbQuery); + + let data2 = [ + //["sacct_svr_svr", getServerId()], + ["sacct_svr_sacct", subAccountData.databaseId], + ["sacct_svr_job", subAccountData.job], + //["sacct_svr_job_rank", getServerId()], + ["sacct_svr_clan", subAccountData.clan], + ["sacct_svr_clan_rank", subAccountData.clanRank], + ["sacct_svr_clan_tag", safeClanTag], + ["sacct_svr_clan_title", safeClanTitle], + ["sacct_svr_clan_flags", subAccountData.clanFlags], + ["sacct_svr_scale_x", subAccountData.pedScale.x], + ["sacct_svr_scale_y", subAccountData.pedScale.y], + ["sacct_svr_scale_z", subAccountData.pedScale.z], + ["sacct_svr_skin", subAccountData.skin], + ["sacct_svr_fightstyle", subAccountData.fightStyle], + ["sacct_svr_walkstyle", subAccountData.walkStyle], + ["sacct_svr_hd_part_hair_model", subAccountData.bodyParts.hair[0]], + ["sacct_svr_hd_part_hair_texture", subAccountData.bodyParts.hair[1]], + ["sacct_svr_hd_part_head_model", subAccountData.bodyParts.head[0]], + ["sacct_svr_hd_part_head_texture", subAccountData.bodyParts.head[1]], + ["sacct_svr_hd_part_upper_model", subAccountData.bodyParts.upper[0]], + ["sacct_svr_hd_part_upper_texture", subAccountData.bodyParts.upper[1]], + ["sacct_svr_hd_part_lower_model", subAccountData.bodyParts.lower[0]], + ["sacct_svr_hd_part_lower_texture", subAccountData.bodyParts.lower[1]], + ["sacct_svr_hd_prop_hair_model", subAccountData.bodyProps.hair[0]], + ["sacct_svr_hd_prop_hair_texture", subAccountData.bodyProps.hair[1]], + ["sacct_svr_hd_prop_eyes_model", subAccountData.bodyProps.eyes[0]], + ["sacct_svr_hd_prop_eyes_texture", subAccountData.bodyProps.eyes[1]], + ["sacct_svr_hd_prop_head_model", subAccountData.bodyProps.head[0]], + ["sacct_svr_hd_prop_head_texture", subAccountData.bodyProps.head[1]], + ["sacct_svr_hd_prop_lefthand_model", subAccountData.bodyProps.leftHand[0]], + ["sacct_svr_hd_prop_lefthand_texture", subAccountData.bodyProps.leftHand[1]], + ["sacct_svr_hd_prop_righthand_model", subAccountData.bodyProps.rightHand[0]], + ["sacct_svr_hd_prop_righthand_texture", subAccountData.bodyProps.rightHand[1]], + ["sacct_svr_hd_prop_leftwrist_model", subAccountData.bodyProps.leftWrist[0]], + ["sacct_svr_hd_prop_leftwrist_texture", subAccountData.bodyProps.leftWrist[1]], + ["sacct_svr_hd_prop_rightwrist_model", subAccountData.bodyProps.rightWrist[0]], + ["sacct_svr_hd_prop_rightwrist_texture", subAccountData.bodyProps.rightWrist[1]], + ["sacct_svr_hd_prop_hip_model", subAccountData.bodyProps.hip[0]], + ["sacct_svr_hd_prop_hip_texture",subAccountData.bodyProps.hip[1]], + ["sacct_svr_hd_prop_leftfoot_model", subAccountData.bodyProps.leftFoot[0]], + ["sacct_svr_hd_prop_leftfoot_texture", subAccountData.bodyProps.leftFoot[1]], + ["sacct_svr_hd_prop_rightfoot_model", subAccountData.bodyProps.rightFoot[0]], + ["sacct_svr_hd_prop_rightfoot_texture", subAccountData.bodyProps.rightFoot[1]], + ]; + dbQuery = null; - - dbQueryString = ` - UPDATE sacct_svr SET - sacct_svr_job=${subAccountData.job}, - sacct_svr_clan=${subAccountData.clan}, - sacct_svr_clan_rank=${subAccountData.clanRank}, - sacct_svr_clan_tag='${safeClanTag}', - sacct_svr_clan_title='${safeClanTitle}', - sacct_svr_clan_flags=${subAccountData.clanFlags}, - sacct_svr_scale_x=${subAccountData.pedScale.x}, - sacct_svr_scale_y=${subAccountData.pedScale.y}, - sacct_svr_scale_z=${subAccountData.pedScale.z}, - sacct_svr_skin=${subAccountData.skin}, - sacct_svr_fightstyle=${subAccountData.fightStyle}, - sacct_svr_walkstyle=${subAccountData.walkStyle}, - sacct_svr_hd_part_hair_model=${subAccountData.bodyParts.hair[0]}, - sacct_svr_hd_part_hair_texture=${subAccountData.bodyParts.hair[1]}, - sacct_svr_hd_part_head_model=${subAccountData.bodyParts.head[0]}, - sacct_svr_hd_part_head_texture=${subAccountData.bodyParts.head[1]}, - sacct_svr_hd_part_upper_model=${subAccountData.bodyParts.upper[0]}, - sacct_svr_hd_part_upper_texture=${subAccountData.bodyParts.upper[1]}, - sacct_svr_hd_part_lower_model=${subAccountData.bodyParts.lower[0]}, - sacct_svr_hd_part_lower_texture=${subAccountData.bodyParts.lower[1]}, - sacct_svr_hd_prop_hair_model=${subAccountData.bodyProps.hair[0]}, - sacct_svr_hd_prop_hair_texture=${subAccountData.bodyProps.hair[1]}, - sacct_svr_hd_prop_eyes_model=${subAccountData.bodyProps.eyes[0]}, - sacct_svr_hd_prop_eyes_texture=${subAccountData.bodyProps.eyes[1]}, - sacct_svr_hd_prop_head_model=${subAccountData.bodyProps.head[0]}, - sacct_svr_hd_prop_head_texture=${subAccountData.bodyProps.head[1]}, - sacct_svr_hd_prop_lefthand_model=${subAccountData.bodyProps.leftHand[0]}, - sacct_svr_hd_prop_lefthand_texture=${subAccountData.bodyProps.leftHand[1]}, - sacct_svr_hd_prop_righthand_model=${subAccountData.bodyProps.rightHand[0]}, - sacct_svr_hd_prop_righthand_texture=${subAccountData.bodyProps.rightHand[1]}, - sacct_svr_hd_prop_leftwrist_model=${subAccountData.bodyProps.leftWrist[0]}, - sacct_svr_hd_prop_leftwrist_texture=${subAccountData.bodyProps.leftWrist[1]}, - sacct_svr_hd_prop_rightwrist_model=${subAccountData.bodyProps.rightWrist[0]}, - sacct_svr_hd_prop_rightwrist_texture=${subAccountData.bodyProps.rightWrist[1]}, - sacct_svr_hd_prop_hip_model=${subAccountData.bodyProps.hip[0]}, - sacct_svr_hd_prop_hip_texture=${subAccountData.bodyProps.hip[1]}, - sacct_svr_hd_prop_leftfoot_model=${subAccountData.bodyProps.leftFoot[0]}, - sacct_svr_hd_prop_leftfoot_texture=${subAccountData.bodyProps.leftFoot[1]}, - sacct_svr_hd_prop_rightfoot_model=${subAccountData.bodyProps.rightFoot[0]}, - sacct_svr_hd_prop_rightfoot_texture=${subAccountData.bodyProps.rightFoot[1]} - WHERE sacct_svr_sacct=${subAccountData.databaseId} AND sacct_svr_server = ${getServerId()}`; - - dbQueryString = dbQueryString.replace(/(?:\r\n|\r|\n|\t)/g, ""); - dbQuery = queryDatabase(dbConnection, dbQueryString); + queryString = ""; + queryString = createDatabaseUpdateQuery("sacct_svr", data2, `sacct_svr_sacct=${subAccountData.databaseId} AND sacct_svr_server = ${getServerId()}`); + dbQuery = queryDatabase(dbConnection, queryString); freeDatabaseQuery(dbQuery); disconnectFromDatabase(dbConnection); diff --git a/scripts/server/timers.js b/scripts/server/timers.js index ca3eab80..c3798634 100644 --- a/scripts/server/timers.js +++ b/scripts/server/timers.js @@ -12,7 +12,9 @@ let serverTimers = {}; // =========================================================================== function updateTimeRule() { - server.setRule("Time", makeReadableTime(gta.time.hour, gta.time.minute)); + if(isTimeSupported()) { + server.setRule("Time", makeReadableTime(gta.time.hour, gta.time.minute)); + } } // =========================================================================== diff --git a/scripts/server/utilities.js b/scripts/server/utilities.js index 86b89694..d4205451 100644 --- a/scripts/server/utilities.js +++ b/scripts/server/utilities.js @@ -918,7 +918,7 @@ function getSkinIdFromName(params, gameId = getServerGame()) { function getClosestHospital(position) { let closest = 0; for(let i in getGameData().hospitals[getServerGame()]) { - if(getDistance(getGameData().hospitals[getServerGame()][i], position) < getDistance(getGameData().hospitals[getServerGame()][closest], position)) { + if(getDistance(getGameData().hospitals[getServerGame()][i].position, position) < getDistance(getGameData().hospitals[getServerGame()][closest].position, position)) { closest = i; } } @@ -931,7 +931,7 @@ function getClosestHospital(position) { function getClosestPoliceStation(position) { let closest = 0; for(let i in getGameData().policeStations[getServerGame()]) { - if(getGameData().policeStations[getServerGame()][i].distance(position) < getGameData().policeStations[getServerGame()][closest]) { + if(getDistance(getGameData().policeStations[getServerGame()][i].position, position) < getDistance(getGameData().policeStations[getServerGame()][closest].position, position)) { closest = i; } } @@ -1119,8 +1119,13 @@ function checkPlayerPedStates() { // =========================================================================== function showConnectCameraToPlayer(client) { - fadeCamera(client, true, 1); - setPlayerCameraLookAt(client, getServerConfig().connectCameraPosition, getServerConfig().connectCameraLookAt); + if(isFadeCameraSupported()) { + fadeCamera(client, true, 1); + } + + if(isCustomCameraSupported()) { + setPlayerCameraLookAt(client, getServerConfig().connectCameraPosition, getServerConfig().connectCameraLookAt); + } } // =========================================================================== @@ -1515,19 +1520,19 @@ function splitArrayIntoChunks(originalArray, perChunk) { // =========================================================================== function getAllVehiclesOwnedByPlayer(client) { - return getServerData().vehicles.filter(v => v.ownerType == VRR_VEHOWNER_PLAYER && v.ownerId == getPlayerCurrentSubAccount(client)); + return getServerData().vehicles.filter((v) => v.ownerType == VRR_VEHOWNER_PLAYER && v.ownerId == getPlayerCurrentSubAccount(client).databaseId); } // =========================================================================== function getAllBusinessesOwnedByPlayer(client) { - return getServerData().businesses.filter(v => v.ownerType == VRR_BIZOWNER_PLAYER && v.ownerId == getPlayerCurrentSubAccount(client)); + return getServerData().businesses.filter((b) => b.ownerType == VRR_BIZOWNER_PLAYER && b.ownerId == getPlayerCurrentSubAccount(client).databaseId); } // =========================================================================== function getAllHousesOwnedByPlayer(client) { - return getServerData().houses.filter(v => v.ownerType == VRR_HOUSEOWNER_PLAYER && v.ownerId == getPlayerCurrentSubAccount(client)); + return getServerData().houses.filter((h) => h.ownerType == VRR_HOUSEOWNER_PLAYER && h.ownerId == getPlayerCurrentSubAccount(client).databaseId); } // =========================================================================== \ No newline at end of file diff --git a/scripts/server/vehicle.js b/scripts/server/vehicle.js index 1a82b584..5ef23b88 100644 --- a/scripts/server/vehicle.js +++ b/scripts/server/vehicle.js @@ -11,6 +11,7 @@ function initVehicleScript() { logToConsole(LOG_INFO, "[VRR.Vehicle]: Initializing vehicle script ..."); getServerData().vehicles = loadVehiclesFromDatabase(); spawnAllVehicles(); + setAllVehicleIndexes(); logToConsole(LOG_INFO, "[VRR.Vehicle]: Vehicle script initialized successfully!"); return true; } @@ -46,7 +47,7 @@ function saveAllVehiclesToDatabase() { let vehicles = getServerData().vehicles; for(let i in vehicles) { if(vehicles[i].needsSaved) { - saveVehicleToDatabase(vehicles[i]); + saveVehicleToDatabase(i); } } logToConsole(LOG_INFO, "[VRR.Vehicle]: Saved all vehicles to database!"); @@ -87,10 +88,10 @@ function saveVehicleToDatabase(vehicleDataId) { } } - let colour1RGBA = rgbaArrayFromToColour(vehicleData.colour1RGBA); - let colour2RGBA = rgbaArrayFromToColour(vehicleData.colour2RGBA); - let colour3RGBA = rgbaArrayFromToColour(vehicleData.colour3RGBA); - let colour4RGBA = rgbaArrayFromToColour(vehicleData.colour4RGBA); + let colour1RGBA = rgbaArrayFromToColour(tempVehicleData.colour1RGBA); + let colour2RGBA = rgbaArrayFromToColour(tempVehicleData.colour2RGBA); + let colour3RGBA = rgbaArrayFromToColour(tempVehicleData.colour3RGBA); + let colour4RGBA = rgbaArrayFromToColour(tempVehicleData.colour4RGBA); let data = [ ["veh_server", getServerId()], @@ -102,17 +103,17 @@ function saveVehicleToDatabase(vehicleDataId) { ["veh_buy_price", boolToInt(tempVehicleData.buyPrice)], ["veh_rent_price", boolToInt(tempVehicleData.rentPrice)], ["veh_pos_x", tempVehicleData.spawnPosition.x], - ["veh_pos_y", tempVehicleData.spawnPosition.x], + ["veh_pos_y", tempVehicleData.spawnPosition.y], ["veh_pos_z", tempVehicleData.spawnPosition.z], ["veh_rot_z", tempVehicleData.spawnRotation], ["veh_col1", tempVehicleData.spawnRotation], ["veh_col2", tempVehicleData.spawnRotation], ["veh_col3", tempVehicleData.spawnRotation], ["veh_col4", tempVehicleData.spawnRotation], - ["veh_col1_isrgba", tempVehicleData.colour1IsRGBA], - ["veh_col2_isrgba", tempVehicleData.colour1IsRGBA], - ["veh_col3_isrgba", tempVehicleData.colour1IsRGBA], - ["veh_col4_isrgba", tempVehicleData.colour1IsRGBA], + ["veh_col1_isrgb", tempVehicleData.colour1IsRGBA], + ["veh_col2_isrgb", tempVehicleData.colour1IsRGBA], + ["veh_col3_isrgb", tempVehicleData.colour1IsRGBA], + ["veh_col4_isrgb", tempVehicleData.colour1IsRGBA], ["veh_col1_r", colour1RGBA[0]], ["veh_col1_g", colour1RGBA[1]], ["veh_col1_b", colour1RGBA[2]], @@ -158,7 +159,7 @@ function saveVehicleToDatabase(vehicleDataId) { getServerData().vehicles[vehicleDataId].databaseId = getDatabaseInsertId(dbConnection); getServerData().vehicles[vehicleDataId].needsSaved = false; } else { - let queryString = createDatabaseUpdateQuery("veh_main", data, `WHERE veh_id=${tempVehicleData.databaseId}`); + let queryString = createDatabaseUpdateQuery("veh_main", data, `veh_id=${tempVehicleData.databaseId}`); dbQuery = queryDatabase(dbConnection, queryString); getServerData().vehicles[vehicleDataId].needsSaved = false; } @@ -1284,4 +1285,12 @@ function resetVehiclePosition(vehicle) { } } +// =========================================================================== + +function setAllVehicleIndexes() { + for(let i in getServerData().vehicles) { + getServerData().vehicles[i].index = i; + } +} + // =========================================================================== \ No newline at end of file diff --git a/scripts/shared/native/gtac.js b/scripts/shared/native/gtac.js index a1eb7156..eaf4c12e 100644 --- a/scripts/shared/native/gtac.js +++ b/scripts/shared/native/gtac.js @@ -1057,4 +1057,22 @@ function areBlipsSupported() { return true; } +// =========================================================================== + +function isFadeCameraSupported() { + return true; +} + +// =========================================================================== + +function isCustomCameraSupported() { + return true; +} + +// =========================================================================== + +function areWorldLabelsSupported() { + return false; +} + // =========================================================================== \ No newline at end of file diff --git a/scripts/shared/native/mafiac.js b/scripts/shared/native/mafiac.js index 04edfb72..c01c6f5f 100644 --- a/scripts/shared/native/mafiac.js +++ b/scripts/shared/native/mafiac.js @@ -367,4 +367,22 @@ function areBlipsSupported() { return false; } +// =========================================================================== + +function isFadeCameraSupported() { + return false; +} + +// =========================================================================== + +function isCustomCameraSupported() { + return false; +} + +// =========================================================================== + +function areWorldLabelsSupported() { + return false; +} + // =========================================================================== \ No newline at end of file diff --git a/third-party/mexui/Core/Utility.js b/third-party/mexui/Core/Utility.js index 25098920..32d4713c 100644 --- a/third-party/mexui/Core/Utility.js +++ b/third-party/mexui/Core/Utility.js @@ -15,7 +15,7 @@ mexui.util.isPointInRectangle = function(point, position, size) { if(!point) return false; // temp bug fix - + return point.x >= position.x && point.y >= position.y && point.x <= (position.x + size.x) && point.y <= (position.y + size.y); }; @@ -53,7 +53,7 @@ mexui.util.linkBaseControlStyles = function(controlName, derivedStyles) mexui.util.linkStyles = function(baseStyles, derivedStyles) { derivedStyles = derivedStyles || {}; - + for(var k in baseStyles) { switch(k) @@ -62,12 +62,12 @@ mexui.util.linkStyles = function(baseStyles, derivedStyles) case 'hover': continue; } - + if(!derivedStyles[k]) derivedStyles[k] = {}; if(!(derivedStyles[k].__proto__ instanceof Object)) derivedStyles[k].__proto__ = baseStyles[k]; - + /* var hoverBaseStyles = JSON.parse(JSON.stringify(baseStyles[k])); if(!derivedStyles[k].hover) @@ -76,7 +76,7 @@ mexui.util.linkStyles = function(baseStyles, derivedStyles) derivedStyles[k].hover.__proto__ = hoverBaseStyles; */ } - + return mexui.util.linkGlobalStyles(mexui.Entity.StyleableEntity.globalDefaultStyles, derivedStyles); //return derivedStyles; }; @@ -84,7 +84,7 @@ mexui.util.linkStyles = function(baseStyles, derivedStyles) mexui.util.linkGlobalStyles = function(baseStyles, derivedStyles) { derivedStyles = derivedStyles || {}; - + for(var k in derivedStyles) { switch(k) @@ -93,13 +93,13 @@ mexui.util.linkGlobalStyles = function(baseStyles, derivedStyles) case 'hover': continue; } - + if(!(derivedStyles[k].__proto__ instanceof Object)) { derivedStyles[k].__proto__ = baseStyles.all; } } - + for(var k in derivedStyles) { switch(k) @@ -108,7 +108,7 @@ mexui.util.linkGlobalStyles = function(baseStyles, derivedStyles) case 'hover': continue; } - + /* if(!derivedStyles[k].hasOwnProperty('hover')) { @@ -116,14 +116,14 @@ mexui.util.linkGlobalStyles = function(baseStyles, derivedStyles) derivedStyles[k].hover.__proto__ = derivedStyles[k]; } */ - + if(derivedStyles[k].focus) { if(!(derivedStyles[k].focus.__proto__ instanceof Object)) { derivedStyles[k].focus.__proto__ = baseStyles.all; } - + if(derivedStyles[k].focus.hover) { if(!(derivedStyles[k].focus.hover.__proto__ instanceof Object)) @@ -132,7 +132,7 @@ mexui.util.linkGlobalStyles = function(baseStyles, derivedStyles) } } } - + if(derivedStyles[k].hover) { if(!(derivedStyles[k].hover.__proto__ instanceof Object)) @@ -141,7 +141,7 @@ mexui.util.linkGlobalStyles = function(baseStyles, derivedStyles) } } } - + return derivedStyles; }; @@ -236,13 +236,13 @@ mexui.util.getCenterPosition = function(largerSize, smallerSize) mexui.util.getWindowSize = function() { - return new Vec2(gta.width, gta.height); + return new Vec2(game.width, game.height); }; mexui.util.isRectangleInsideRectangle = function(pos1, size1, pos2, size2) { - return !(pos2.x > (pos1.x + size1.x) || - (pos2.x + size2.x) < pos1.x || + return !(pos2.x > (pos1.x + size1.x) || + (pos2.x + size2.x) < pos1.x || pos2.y > (pos1.y + size1.y) || (pos2.y + size2.y) < pos1.y); }; @@ -257,38 +257,38 @@ mexui.util.mergeStyles = function(styles, pseudoPartNames) for(var i in pseudoPartNames) { var pseudoPartName = pseudoPartNames[i]; - + if(styles2[0] && styles2[0].hasOwnProperty(pseudoPartName)) styles2.push(styles2[0][pseudoPartName]); } - + for(var i=styles2.length-1; i>=0; i--) { if(styles2[i] == null) continue; - + for(var k in styles2[i]) { switch(k) { case 'focus': case 'hover': - + case 'transitionTime': case 'transitionDelay': - + case 'transitionDelayStartTime': case 'transitionStartTime': case 'transitionStarted': case 'transitionEnded': case 'transitionReverting': - + continue; } if(styles2[i].hasOwnProperty(k) && styles3[k] == null) { var styleValue = styles2[i][k]; - + /* if(i > 0 && (styles2[i].transitionTime != null || styles2[i].transitionDelay != null)) { @@ -301,7 +301,7 @@ mexui.util.mergeStyles = function(styles, pseudoPartNames) { styles2[i].transitionEnded = true; styleValue = styles2[0][k]; - + delete styles2[i].transitionDelayStartTime; delete styles2[i].transitionStartTime; delete styles2[i].transitionStarted; @@ -348,19 +348,19 @@ mexui.util.mergeStyles = function(styles, pseudoPartNames) } } */ - + styles3[k] = styleValue; } } } - + for(var i in styles2) { if(styles2[i]) styles2[i] = styles2[i].__proto__; } } - + return styles3; }; @@ -374,54 +374,54 @@ mexui.util.getTransitionStyles = function(styles, pseudoPartNames, progress) for(var i in pseudoPartNames) { var pseudoPartName = pseudoPartNames[i]; - + if(styles2[0] && styles2[0].hasOwnProperty(pseudoPartName)) styles2.push(styles2[0][pseudoPartName]); } - + for(var i=styles2.length-1; i>=0; i--) { if(styles2[i] == null) continue; - + for(var k in styles2[i]) { switch(k) { case 'focus': case 'hover': - + case 'transitionTime': case 'transitionDelay': - + continue; } if(styles2[i].hasOwnProperty(k) && styles3[k] == null) { var styleValue = styles2[i][k]; - + if(i > 0) { var mainStyleValue = styles2[0][k]; var pseudoStyleValue = styles2[i][k]; - + //console.log(mainStyleValue+' '+pseudoStyleValue); - + styleValue = mexui.util.interpolateStyle(k, progress, mainStyleValue, pseudoStyleValue); } - + styles3[k] = styleValue; } } } - + for(var i in styles2) { if(styles2[i]) styles2[i] = styles2[i].__proto__; } } - + return styles3; }; @@ -476,7 +476,7 @@ mexui.util.fromColour = function(colour) mexui.util.time = function() { - return gta.tickCount; + return sdl.tickCount; }; mexui.util.isIntChar = function(character) @@ -570,14 +570,14 @@ mexui.util.isDayId = function(text) { if(text.length == 2 && text.substr(0, 1) == '0') text = text.substr(1); - + if(mexui.util.isPositiveInt(text)) { var _int = parseInt(text); if(_int >= 1 && _int <= 31) return true; } - + return false; }; @@ -585,7 +585,7 @@ mexui.util.isDayIdWithOptionalSuffix = function(text) { if(mexui.util.isDayId(text)) return true; - + if(text.length > 2) { var last2Chars = text.substr(text.length - 2, 2); @@ -598,14 +598,14 @@ mexui.util.isDayIdWithOptionalSuffix = function(text) } } } - + return false; }; mexui.util.inArrayOrStartsWithInArray = function(text, arr, startsWithCharCount) { text = text.toLowerCase(); - + for(var i in arr) { if(text === arr[i]) @@ -613,7 +613,7 @@ mexui.util.inArrayOrStartsWithInArray = function(text, arr, startsWithCharCount) return true; } } - + if(text.length == startsWithCharCount) { for(var i in arr) @@ -624,7 +624,7 @@ mexui.util.inArrayOrStartsWithInArray = function(text, arr, startsWithCharCount) } } } - + return false; }; @@ -633,14 +633,14 @@ mexui.util.isMonthIdOrName = function(text) var text2 = text; if(text2.length == 2 && text2.substr(0, 1) == '0') text2 = text2.substr(1); - + if(mexui.util.isPositiveInt(text2)) { var _int = parseInt(text2); if(_int >= 1 && _int <= 12) return true; } - + return mexui.util.isMonthName(text); }; @@ -649,14 +649,14 @@ mexui.util.isWeekDayId = function(text) var text2 = text; if(text2.length == 2 && text2.substr(0, 1) == '0') text2 = text2.substr(1); - + if(mexui.util.isPositiveInt(text2)) { var _int = parseInt(text2); if(_int >= 1 && _int <= 7) return true; } - + return false; }; @@ -665,14 +665,14 @@ mexui.util.isWeekDayIdOrName = function(text) var text2 = text; if(text2.length == 2 && text2.substr(0, 1) == '0') text2 = text2.substr(1); - + if(mexui.util.isPositiveInt(text2)) { var _int = parseInt(text2); if(_int >= 1 && _int <= 7) return true; } - + return mexui.util.isWeekDayName(text); }; @@ -690,15 +690,15 @@ mexui.util.expand2DigitYear = function(year, twoDigitYearCapOffset) mexui.util.isYear = function(text, minYear, maxYear, twoDigitYearCapOffset) { var _int = parseInt(text); - + if(isNaN(_int)) return false; - + if(_int >= 0 && _int <= 99) _int = mexui.util.expand2DigitYear(_int, twoDigitYearCapOffset); - + if(_int < minYear || _int > maxYear) return false; - + return true; }; \ No newline at end of file