diff --git a/scripts/server/netevents.js b/scripts/server/netevents.js index e9b25973..dfaa010e 100644 --- a/scripts/server/netevents.js +++ b/scripts/server/netevents.js @@ -9,14 +9,14 @@ // =========================================================================== function initNetworkEventsScript() { - logToConsole(LOG_DEBUG, "[VRR.NetEvents]: Initializing network events script ..."); - logToConsole(LOG_INFO, "[VRR.NetEvents]: Network events script initialized!"); + logToConsole(LOG_DEBUG, "[AGRP.NetEvents]: Initializing network events script ..."); + logToConsole(LOG_INFO, "[AGRP.NetEvents]: Network events script initialized!"); } // =========================================================================== function addAllNetworkEventHandlers() { - logToConsole(LOG_DEBUG, "[VRR.Client]: Adding network handlers ..."); + logToConsole(LOG_DEBUG, "[AGRP.Client]: Adding network handlers ..."); // KeyBind addNetworkEventHandler("agrp.useKeyBind", playerUsedKeyBind); @@ -74,19 +74,20 @@ function addAllNetworkEventHandlers() { addNetworkEventHandler("agrp.vehBuyState", receiveVehiclePurchaseStateUpdateFromClient); addNetworkEventHandler("agrp.playerPedId", receivePlayerPedNetworkId); addNetworkEventHandler("agrp.playerCop", setPlayerAsCopState); + addNetworkEventHandler("agrp.mapLoaded", playerMapLoaded); } // =========================================================================== function updatePlayerNameTag(client) { - //logToConsole(LOG_DEBUG, `[VRR.Client] Sending ${getPlayerDisplayForConsole(client)}'s updated nametag to all players`); + //logToConsole(LOG_DEBUG, `[AGRP.Client] Sending ${getPlayerDisplayForConsole(client)}'s updated nametag to all players`); sendNetworkEventToPlayer("agrp.nametag", null, getPlayerName(client), getPlayerNameForNameTag(client), getPlayerColour(client), getPlayerData(client).afk, getPlayerPing(client)); } // =========================================================================== function updateAllPlayerNameTags() { - logToConsole(LOG_DEBUG, `[VRR.Client] Sending updated nametags to all players`); + logToConsole(LOG_DEBUG, `[AGRP.Client] Sending updated nametags to all players`); let clients = getClients(); for (let i in clients) { updatePlayerNameTag(clients[i]); @@ -96,7 +97,7 @@ function updateAllPlayerNameTags() { // =========================================================================== function updatePlayerPing(client) { - //logToConsole(LOG_DEBUG, `[VRR.Client] Sending ${getPlayerDisplayForConsole(client)}'s ping to all players`); + //logToConsole(LOG_DEBUG, `[AGRP.Client] Sending ${getPlayerDisplayForConsole(client)}'s ping to all players`); sendNetworkEventToPlayer("agrp.ping", null, getPlayerName(client), getPlayerPing(client)); } @@ -104,7 +105,7 @@ function updatePlayerPing(client) { function playerClientReady(client) { playerResourceReady[client.index] = true; - logToConsole(LOG_DEBUG, `[VRR.Client] ${getPlayerDisplayForConsole(client)}'s client resources are downloaded and ready! Started: ${getYesNoFromBool(playerResourceStarted[client.index])}`); + logToConsole(LOG_DEBUG, `[AGRP.Client] ${getPlayerDisplayForConsole(client)}'s client resources are downloaded and ready! Started: ${getYesNoFromBool(playerResourceStarted[client.index])}`); if (playerResourceStarted[client.index] == true && playerInitialized[client.index] == false) { initClient(client); } @@ -114,14 +115,14 @@ function playerClientReady(client) { function playerGUIReady(client) { playerGUI[client.index] = true; - logToConsole(LOG_DEBUG, `[VRR.Client] ${getPlayerDisplayForConsole(client)}'s client GUI is initialized and ready!`); + logToConsole(LOG_DEBUG, `[AGRP.Client] ${getPlayerDisplayForConsole(client)}'s client GUI is initialized and ready!`); } // =========================================================================== function playerClientStarted(client) { playerResourceStarted[client.index] = true; - logToConsole(LOG_DEBUG, `[VRR.Client] ${getPlayerDisplayForConsole(client)}'s client resources are started and running! Ready: ${getYesNoFromBool(playerResourceReady[client.index])}`); + logToConsole(LOG_DEBUG, `[AGRP.Client] ${getPlayerDisplayForConsole(client)}'s client resources are started and running! Ready: ${getYesNoFromBool(playerResourceReady[client.index])}`); if (playerResourceReady[client.index] == true && playerInitialized[client.index] == false) { initClient(client); } @@ -130,7 +131,7 @@ function playerClientStarted(client) { // =========================================================================== function playerClientStopped(client) { - logToConsole(LOG_DEBUG, `[VRR.Client] ${getPlayerDisplayForConsole(client)}'s client resources have stopped (possibly error?). Kicking them from the server ...`); + logToConsole(LOG_DEBUG, `[AGRP.Client] ${getPlayerDisplayForConsole(client)}'s client resources have stopped (possibly error?). Kicking them from the server ...`); getPlayerData(client).customDisconnectReason = `Kicked - Client script verification failed.`; disconnectPlayer(client); } @@ -138,7 +139,7 @@ function playerClientStopped(client) { // =========================================================================== function showSmallGameMessage(client, text, colour, duration, fontName = "Pricedown") { - logToConsole(LOG_DEBUG, `[VRR.Client] Showing game message to ${getPlayerDisplayForConsole(client)} (${text}) for ${duration} milliseconds`); + logToConsole(LOG_DEBUG, `[AGRP.Client] Showing game message to ${getPlayerDisplayForConsole(client)} (${text}) for ${duration} milliseconds`); sendNetworkEventToPlayer("agrp.smallGameMessage", client, text, colour, duration, fontName); } @@ -149,7 +150,7 @@ function enableCityAmbienceForPlayer(client, clearElements = false) { // return false; //} - //logToConsole(LOG_DEBUG, `[VRR.Client] Setting ${getPlayerDisplayForConsole(client)}'s city ambience to ${toUpperCase(getOnOffFromBool(false))}`); + //logToConsole(LOG_DEBUG, `[AGRP.Client] Setting ${getPlayerDisplayForConsole(client)}'s city ambience to ${toUpperCase(getOnOffFromBool(false))}`); //sendNetworkEventToPlayer("agrp.ambience", client, true); } @@ -160,21 +161,21 @@ function disableCityAmbienceForPlayer(client, clearElements = false) { // return false; //} - //logToConsole(LOG_DEBUG, `[VRR.Client] Setting ${getPlayerDisplayForConsole(client)}'s city ambience to ${toUpperCase(getOnOffFromBool(false))}`); + //logToConsole(LOG_DEBUG, `[AGRP.Client] Setting ${getPlayerDisplayForConsole(client)}'s city ambience to ${toUpperCase(getOnOffFromBool(false))}`); //sendNetworkEventToPlayer("agrp.ambience", client, false, clearElements); } // =========================================================================== function clearPlayerOwnedPeds(client) { - logToConsole(LOG_DEBUG, `[VRR.Client] Clearing peds owned by ${getPlayerDisplayForConsole(client)}`); + logToConsole(LOG_DEBUG, `[AGRP.Client] Clearing peds owned by ${getPlayerDisplayForConsole(client)}`); sendNetworkEventToPlayer("agrp.clearPeds", client); } // =========================================================================== function updatePlayerSpawnedState(client, state) { - logToConsole(LOG_DEBUG, `[VRR.Client] Setting ${getPlayerDisplayForConsole(client)}'s spawned state ${toUpperCase(getOnOffFromBool(state))}`); + logToConsole(LOG_DEBUG, `[AGRP.Client] Setting ${getPlayerDisplayForConsole(client)}'s spawned state ${toUpperCase(getOnOffFromBool(state))}`); getPlayerData(client).spawned = true; sendNetworkEventToPlayer("agrp.spawned", client, state); } @@ -182,21 +183,21 @@ function updatePlayerSpawnedState(client, state) { // =========================================================================== function setPlayerControlState(client, state) { - logToConsole(LOG_DEBUG, `[VRR.Client] Setting ${getPlayerDisplayForConsole(client)}'s control state ${toUpperCase(getOnOffFromBool(state))}`); + logToConsole(LOG_DEBUG, `[AGRP.Client] Setting ${getPlayerDisplayForConsole(client)}'s control state ${toUpperCase(getOnOffFromBool(state))}`); sendNetworkEventToPlayer("agrp.control", client, state, !state); } // =========================================================================== function updatePlayerShowLogoState(client, state) { - logToConsole(LOG_DEBUG, `[VRR.Client] Setting ${getPlayerDisplayForConsole(client)}'s logo state ${toUpperCase(getOnOffFromBool(state))}`); + logToConsole(LOG_DEBUG, `[AGRP.Client] Setting ${getPlayerDisplayForConsole(client)}'s logo state ${toUpperCase(getOnOffFromBool(state))}`); sendNetworkEventToPlayer("agrp.logo", client, state); } // =========================================================================== function restorePlayerCamera(client) { - logToConsole(LOG_DEBUG, `[VRR.Client] Restoring ${getPlayerDisplayForConsole(client)}'s camera`); + logToConsole(LOG_DEBUG, `[AGRP.Client] Restoring ${getPlayerDisplayForConsole(client)}'s camera`); sendNetworkEventToPlayer("agrp.restoreCamera", client); } @@ -209,7 +210,7 @@ function setPlayer2DRendering(client, hudState = false, labelState = false, smal // =========================================================================== function syncPlayerProperties(client) { - logToConsole(LOG_DEBUG, `[VRR.Client] Sending signal to sync ${getPlayerDisplayForConsole(client)}'s player ped properties`); + logToConsole(LOG_DEBUG, `[AGRP.Client] Sending signal to sync ${getPlayerDisplayForConsole(client)}'s player ped properties`); sendNetworkEventToPlayer("agrp.syncElement", null, getPlayerPed(client).id); } @@ -217,7 +218,7 @@ function syncPlayerProperties(client) { function updatePlayerSnowState(client) { if (isSnowSupported(getGame())) { - logToConsole(LOG_DEBUG, `[VRR.Client] Setting ${getPlayerDisplayForConsole(client)}'s snow state (Falling: ${toUpperCase(getOnOffFromBool(getServerConfig().fallingSnow))}, Ground: ${toUpperCase(getOnOffFromBool(getServerConfig().groundSnow))})`); + logToConsole(LOG_DEBUG, `[AGRP.Client] Setting ${getPlayerDisplayForConsole(client)}'s snow state (Falling: ${toUpperCase(getOnOffFromBool(getServerConfig().fallingSnow))}, Ground: ${toUpperCase(getOnOffFromBool(getServerConfig().groundSnow))})`); sendNetworkEventToPlayer("agrp.snow", client, getServerConfig().fallingSnow, getServerConfig().groundSnow); } } @@ -225,7 +226,7 @@ function updatePlayerSnowState(client) { // =========================================================================== function updatePlayerHotBar(client) { - logToConsole(LOG_DEBUG, `[VRR.Client] Sending updated hotbar data to ${getPlayerDisplayForConsole(client)}`); + logToConsole(LOG_DEBUG, `[AGRP.Client] Sending updated hotbar data to ${getPlayerDisplayForConsole(client)}`); let tempHotBarItems = []; for (let i in getPlayerData(client).hotBarItems) { let itemImage = ""; @@ -248,14 +249,14 @@ function updatePlayerHotBar(client) { // =========================================================================== function setPlayerWeaponDamageEnabled(client, state) { - logToConsole(LOG_DEBUG, `[VRR.Client] Sending weapon damage state for ${getPlayerDisplayForConsole(client)} to all players`); + logToConsole(LOG_DEBUG, `[AGRP.Client] Sending weapon damage state for ${getPlayerDisplayForConsole(client)} to all players`); sendNetworkEventToPlayer("agrp.weaponDamageEnabled", null, getPlayerName(client), state); } // =========================================================================== function setPlayerWeaponDamageEvent(client, eventType) { - logToConsole(LOG_DEBUG, `[VRR.Client] Sending weapon damage event (${eventType}) for ${getPlayerDisplayForConsole(client)} to all players`); + logToConsole(LOG_DEBUG, `[AGRP.Client] Sending weapon damage event (${eventType}) for ${getPlayerDisplayForConsole(client)} to all players`); sendNetworkEventToPlayer("agrp.weaponDamageEvent", null, getPlayerName(client), eventType); getPlayerData(client).weaponDamageEvent = eventType; } @@ -263,259 +264,259 @@ function setPlayerWeaponDamageEvent(client, eventType) { // =========================================================================== function sendJobRouteLocationToPlayer(client, position, colour) { - logToConsole(LOG_DEBUG, `[VRR.Client] Sending job route location data to ${getPlayerDisplayForConsole(client)}`); + logToConsole(LOG_DEBUG, `[AGRP.Client] Sending job route location data to ${getPlayerDisplayForConsole(client)}`); sendNetworkEventToPlayer("agrp.showJobRouteLocation", client, position, colour); } // =========================================================================== function showPlayerLoginSuccessGUI(client) { - logToConsole(LOG_DEBUG, `[VRR.Client] Sending login success GUI signal to ${getPlayerDisplayForConsole(client)}`); + logToConsole(LOG_DEBUG, `[AGRP.Client] Sending login success GUI signal to ${getPlayerDisplayForConsole(client)}`); sendNetworkEventToPlayer("agrp.loginSuccess", client); } // =========================================================================== function showPlayerLoginFailedGUI(client, errorMessage) { - logToConsole(LOG_DEBUG, `[VRR.Client] Sending login failed GUI signal to ${getPlayerDisplayForConsole(client)}`); + logToConsole(LOG_DEBUG, `[AGRP.Client] Sending login failed GUI signal to ${getPlayerDisplayForConsole(client)}`); sendNetworkEventToPlayer("agrp.loginFailed", client, errorMessage); } // =========================================================================== function showPlayerRegistrationSuccessGUI(client) { - logToConsole(LOG_DEBUG, `[VRR.Client] Sending registration success GUI signal to ${getPlayerDisplayForConsole(client)}`); + logToConsole(LOG_DEBUG, `[AGRP.Client] Sending registration success GUI signal to ${getPlayerDisplayForConsole(client)}`); sendNetworkEventToPlayer("agrp.registrationSuccess", client); } // =========================================================================== function showPlayerRegistrationFailedGUI(client, errorMessage) { - logToConsole(LOG_DEBUG, `[VRR.Client] Sending registration failed GUI signal to ${getPlayerDisplayForConsole(client)}`); + logToConsole(LOG_DEBUG, `[AGRP.Client] Sending registration failed GUI signal to ${getPlayerDisplayForConsole(client)}`); sendNetworkEventToPlayer("agrp.registrationFailed", client, errorMessage); } // =========================================================================== function sendPlayerGUIColours(client) { - logToConsole(LOG_DEBUG, `[VRR.Client] Sending GUI colours to ${getPlayerDisplayForConsole(client)}`); + logToConsole(LOG_DEBUG, `[AGRP.Client] Sending GUI colours to ${getPlayerDisplayForConsole(client)}`); sendNetworkEventToPlayer("agrp.guiColour", client, getServerConfig().guiColourPrimary[0], getServerConfig().guiColourPrimary[1], getServerConfig().guiColourPrimary[2], getServerConfig().guiColourSecondary[0], getServerConfig().guiColourSecondary[1], getServerConfig().guiColourSecondary[2], getServerConfig().guiTextColourPrimary[0], getServerConfig().guiTextColourPrimary[1], getServerConfig().guiTextColourPrimary[2]); } // =========================================================================== function sendPlayerGUIInit(client) { - logToConsole(LOG_DEBUG, `[VRR.Client] Sending GUI init signal to ${getPlayerDisplayForConsole(client)}`); + logToConsole(LOG_DEBUG, `[AGRP.Client] Sending GUI init signal to ${getPlayerDisplayForConsole(client)}`); sendNetworkEventToPlayer("agrp.guiInit", client); } // =========================================================================== function showPlayerLoginGUI(client, errorMessage = "") { - logToConsole(LOG_DEBUG, `[VRR.Client] Sending show login GUI signal to ${getPlayerDisplayForConsole(client)}`); + logToConsole(LOG_DEBUG, `[AGRP.Client] Sending show login GUI signal to ${getPlayerDisplayForConsole(client)}`); sendNetworkEventToPlayer("agrp.showLogin", client); } // =========================================================================== function showPlayerRegistrationGUI(client, errorMessage = "") { - logToConsole(LOG_DEBUG, `[VRR.Client] Sending show registration GUI signal to ${getPlayerDisplayForConsole(client)}`); + logToConsole(LOG_DEBUG, `[AGRP.Client] Sending show registration GUI signal to ${getPlayerDisplayForConsole(client)}`); sendNetworkEventToPlayer("agrp.showRegistration", client); } // =========================================================================== function showPlayerNewCharacterGUI(client) { - logToConsole(LOG_DEBUG, `[VRR.Client] Sending show new character GUI signal to ${getPlayerDisplayForConsole(client)}`); + logToConsole(LOG_DEBUG, `[AGRP.Client] Sending show new character GUI signal to ${getPlayerDisplayForConsole(client)}`); sendNetworkEventToPlayer("agrp.showNewCharacter", client); } // =========================================================================== function showPlayerChangePasswordGUI(client, errorMessage = "") { - logToConsole(LOG_DEBUG, `[VRR.Client] Sending show change password GUI signal to ${getPlayerDisplayForConsole(client)}`); + logToConsole(LOG_DEBUG, `[AGRP.Client] Sending show change password GUI signal to ${getPlayerDisplayForConsole(client)}`); sendNetworkEventToPlayer("agrp.showChangePassword", client, errorMessage); } // =========================================================================== function showPlayerResetPasswordCodeInputGUI(client) { - logToConsole(LOG_DEBUG, `[VRR.Client] Sending show reset password code input GUI signal to ${getPlayerDisplayForConsole(client)}`); + logToConsole(LOG_DEBUG, `[AGRP.Client] Sending show reset password code input GUI signal to ${getPlayerDisplayForConsole(client)}`); sendNetworkEventToPlayer("agrp.showResetPasswordCodeInput", client); } // =========================================================================== function showPlayerResetPasswordEmailInputGUI(client) { - logToConsole(LOG_DEBUG, `[VRR.Client] Sending show reset password email input GUI signal to ${getPlayerDisplayForConsole(client)}`); + logToConsole(LOG_DEBUG, `[AGRP.Client] Sending show reset password email input GUI signal to ${getPlayerDisplayForConsole(client)}`); sendNetworkEventToPlayer("agrp.showResetPasswordEmailInput", client); } // =========================================================================== function showPlayerCharacterSelectGUI(client, firstName, lastName, cash, clan, lastPlayed, skin) { - logToConsole(LOG_DEBUG, `[VRR.Client] Sending character select GUI signal to ${getPlayerDisplayForConsole(client)}`); + logToConsole(LOG_DEBUG, `[AGRP.Client] Sending character select GUI signal to ${getPlayerDisplayForConsole(client)}`); sendNetworkEventToPlayer("agrp.showCharacterSelect", client, firstName, lastName, cash, clan, lastPlayed, skin); } // =========================================================================== function updatePlayerCharacterSelectGUI(client, firstName, lastName, cash, clan, lastPlayed, skin) { - logToConsole(LOG_DEBUG, `[VRR.Client] Sending update character select GUI signal to ${getPlayerDisplayForConsole(client)}`); + logToConsole(LOG_DEBUG, `[AGRP.Client] Sending update character select GUI signal to ${getPlayerDisplayForConsole(client)}`); sendNetworkEventToPlayer("agrp.switchCharacterSelect", client, firstName, lastName, cash, clan, lastPlayed, skin); } // =========================================================================== function showPlayerCharacterSelectSuccessGUI(client) { - logToConsole(LOG_DEBUG, `[VRR.Client] Sending character select success GUI signal to ${getPlayerDisplayForConsole(client)}`); + logToConsole(LOG_DEBUG, `[AGRP.Client] Sending character select success GUI signal to ${getPlayerDisplayForConsole(client)}`); sendNetworkEventToPlayer("agrp.characterSelectSuccess", client); } // =========================================================================== function showPlayerCharacterSelectFailedGUI(client) { - logToConsole(LOG_DEBUG, `[VRR.Client] Sending character select failed GUI signal to ${getPlayerDisplayForConsole(client)}`); + logToConsole(LOG_DEBUG, `[AGRP.Client] Sending character select failed GUI signal to ${getPlayerDisplayForConsole(client)}`); sendNetworkEventToPlayer("agrp.characterSelectFailed", client); } // =========================================================================== function showPlayerPromptGUI(client, promptMessage, promptTitle, yesButtonText = "Yes", noButtonText = "No") { - logToConsole(LOG_DEBUG, `[VRR.Client] Sending show prompt GUI signal to ${getPlayerDisplayForConsole(client)} (Title: ${promptTitle}, Message: ${promptMessage}, YesButton: ${yesButtonText}, NoButton: ${noButtonText})`); + logToConsole(LOG_DEBUG, `[AGRP.Client] Sending show prompt GUI signal to ${getPlayerDisplayForConsole(client)} (Title: ${promptTitle}, Message: ${promptMessage}, YesButton: ${yesButtonText}, NoButton: ${noButtonText})`); sendNetworkEventToPlayer("agrp.showPrompt", client, promptMessage, promptTitle, yesButtonText, noButtonText); } // =========================================================================== function showPlayerInfoGUI(client, infoMessage, infoTitle, buttonText = "OK") { - logToConsole(LOG_DEBUG, `[VRR.Client] Sending show info GUI signal to ${getPlayerDisplayForConsole(client)} (Title: ${infoTitle}, Message: ${infoMessage})`); + logToConsole(LOG_DEBUG, `[AGRP.Client] Sending show info GUI signal to ${getPlayerDisplayForConsole(client)} (Title: ${infoTitle}, Message: ${infoMessage})`); sendNetworkEventToPlayer("agrp.showInfo", client, infoMessage, infoTitle, buttonText); } // =========================================================================== function showPlayerErrorGUI(client, errorMessage, errorTitle, buttonText = "OK") { - logToConsole(LOG_DEBUG, `[VRR.Client] Sending show error GUI signal to ${getPlayerDisplayForConsole(client)} (Title: ${errorTitle}, Message: ${errorMessage})`); + logToConsole(LOG_DEBUG, `[AGRP.Client] Sending show error GUI signal to ${getPlayerDisplayForConsole(client)} (Title: ${errorTitle}, Message: ${errorMessage})`); sendNetworkEventToPlayer("agrp.showError", client, errorMessage, errorTitle, buttonText); } // =========================================================================== function sendRunCodeToClient(client, code, returnTo) { - logToConsole(LOG_DEBUG, `[VRR.Client] Sending runcode to ${getPlayerDisplayForConsole(client)} (returnTo: ${getPlayerDisplayForConsole(getClientFromIndex(returnTo))}, Code: ${code})`); + logToConsole(LOG_DEBUG, `[AGRP.Client] Sending runcode to ${getPlayerDisplayForConsole(client)} (returnTo: ${getPlayerDisplayForConsole(getClientFromIndex(returnTo))}, Code: ${code})`); sendNetworkEventToPlayer("agrp.runCode", client, code, getPlayerId(returnTo)); } // =========================================================================== function sendPlayerWorkingState(client, state) { - logToConsole(LOG_DEBUG, `[VRR.Client] Sending working state (${toUpperCase(getYesNoFromBool(state))}) to ${getPlayerDisplayForConsole(client)}`); + logToConsole(LOG_DEBUG, `[AGRP.Client] Sending working state (${toUpperCase(getYesNoFromBool(state))}) to ${getPlayerDisplayForConsole(client)}`); sendNetworkEventToPlayer("agrp.working", client, state); } // =========================================================================== function sendPlayerJobType(client, jobType) { - logToConsole(LOG_DEBUG, `[VRR.Client] Sending job type (${jobType}) to ${getPlayerDisplayForConsole(client)}`); + logToConsole(LOG_DEBUG, `[AGRP.Client] Sending job type (${jobType}) to ${getPlayerDisplayForConsole(client)}`); sendNetworkEventToPlayer("agrp.jobType", client, jobType); } // =========================================================================== function sendPlayerStopJobRoute(client) { - logToConsole(LOG_DEBUG, `[VRR.Client] Sending signal to abort job route to ${getPlayerDisplayForConsole(client)}`); + logToConsole(LOG_DEBUG, `[AGRP.Client] Sending signal to abort job route to ${getPlayerDisplayForConsole(client)}`); sendNetworkEventToPlayer("agrp.hideJobRouteLocation", client); } // =========================================================================== function sendPlayerMouseCameraToggle(client) { - logToConsole(LOG_DEBUG, `[VRR.Client] Sending signal to toggle mouse camera ${getPlayerDisplayForConsole(client)}`); + logToConsole(LOG_DEBUG, `[AGRP.Client] Sending signal to toggle mouse camera ${getPlayerDisplayForConsole(client)}`); sendNetworkEventToPlayer("agrp.mouseCamera", client); } // =========================================================================== function setPlayerMouseCameraState(client, state) { - logToConsole(LOG_DEBUG, `[VRR.Client] Sending signal to toggle mouse camera ${getPlayerDisplayForConsole(client)}`); + logToConsole(LOG_DEBUG, `[AGRP.Client] Sending signal to toggle mouse camera ${getPlayerDisplayForConsole(client)}`); sendNetworkEventToPlayer("agrp.mouseCameraForce", client, state); } // =========================================================================== function sendPlayerMouseCursorToggle(client) { - logToConsole(LOG_DEBUG, `[VRR.Client] Sending signal to toggle mouse cursor ${getPlayerDisplayForConsole(client)}`); + logToConsole(LOG_DEBUG, `[AGRP.Client] Sending signal to toggle mouse cursor ${getPlayerDisplayForConsole(client)}`); sendNetworkEventToPlayer("agrp.mouseCursor", client); } // =========================================================================== function sendAddAccountKeyBindToClient(client, key, keyState) { - logToConsole(LOG_DEBUG, `[VRR.Client] Sending added keybind to ${getPlayerDisplayForConsole(client)} (Key: ${toUpperCase(getKeyNameFromId(key))}, State: ${(keyState) ? "down" : "up"})`); + logToConsole(LOG_DEBUG, `[AGRP.Client] Sending added keybind to ${getPlayerDisplayForConsole(client)} (Key: ${toUpperCase(getKeyNameFromId(key))}, State: ${(keyState) ? "down" : "up"})`); sendNetworkEventToPlayer("agrp.addKeyBind", client, toInteger(key), (keyState) ? KEYSTATE_DOWN : KEYSTATE_UP); } // =========================================================================== function sendClearKeyBindsToClient(client, key, keyState) { - logToConsole(LOG_DEBUG, `[VRR.Client] Sending added keybind to ${getPlayerDisplayForConsole(client)} (Key: ${toUpperCase(getKeyNameFromId(key))}, State: ${(keyState) ? "down" : "up"})`); + logToConsole(LOG_DEBUG, `[AGRP.Client] Sending added keybind to ${getPlayerDisplayForConsole(client)} (Key: ${toUpperCase(getKeyNameFromId(key))}, State: ${(keyState) ? "down" : "up"})`); sendNetworkEventToPlayer("agrp.clearKeyBinds", client); } // =========================================================================== function sendRemoveAccountKeyBindToClient(client, key) { - logToConsole(LOG_DEBUG, `[VRR.Client] Sending deleted keybind to ${getPlayerDisplayForConsole(client)} (Key: ${toUpperCase(getKeyNameFromId(key))})`); + logToConsole(LOG_DEBUG, `[AGRP.Client] Sending deleted keybind to ${getPlayerDisplayForConsole(client)} (Key: ${toUpperCase(getKeyNameFromId(key))})`); sendNetworkEventToPlayer("agrp.delKeyBind", client, toInteger(key)); } // =========================================================================== function sendPlayerSetPosition(client, position) { - logToConsole(LOG_DEBUG, `[VRR.Client] Sending set position signal to ${getPlayerDisplayForConsole(client)} (Position: ${position.x}, ${position.y}, ${position.z})`); + logToConsole(LOG_DEBUG, `[AGRP.Client] Sending set position signal to ${getPlayerDisplayForConsole(client)} (Position: ${position.x}, ${position.y}, ${position.z})`); sendNetworkEventToPlayer("agrp.position", client, position); } // =========================================================================== function sendPlayerSetHeading(client, heading) { - logToConsole(LOG_DEBUG, `[VRR.Client] Sending set heading signal to ${getPlayerDisplayForConsole(client)} (Heading: ${heading})`); + logToConsole(LOG_DEBUG, `[AGRP.Client] Sending set heading signal to ${getPlayerDisplayForConsole(client)} (Heading: ${heading})`); sendNetworkEventToPlayer("agrp.heading", client, heading); } // =========================================================================== function sendPlayerSetInterior(client, interior) { - logToConsole(LOG_DEBUG, `[VRR.Client] Sending set interior signal to ${getPlayerDisplayForConsole(client)} (Interior: ${interior})`); + logToConsole(LOG_DEBUG, `[AGRP.Client] Sending set interior signal to ${getPlayerDisplayForConsole(client)} (Interior: ${interior})`); sendNetworkEventToPlayer("agrp.interior", client, interior); } // =========================================================================== function sendPlayerFrozenState(client, state) { - logToConsole(LOG_DEBUG, `[VRR.Client] Sending set frozen signal to ${getPlayerDisplayForConsole(client)} (State: ${toUpperCase(getYesNoFromBool(state))})`); + logToConsole(LOG_DEBUG, `[AGRP.Client] Sending set frozen signal to ${getPlayerDisplayForConsole(client)} (State: ${toUpperCase(getYesNoFromBool(state))})`); sendNetworkEventToPlayer("agrp.frozen", client, state); } // =========================================================================== function clearPlayerWeapons(client, clearData = true) { - logToConsole(LOG_DEBUG, `[VRR.Client] Sending signal to ${getPlayerDisplayForConsole(client)} to clear weapons`); + logToConsole(LOG_DEBUG, `[AGRP.Client] Sending signal to ${getPlayerDisplayForConsole(client)} to clear weapons`); sendNetworkEventToPlayer("agrp.clearWeapons", client, clearData); } // =========================================================================== function showPlayerNewCharacterFailedGUI(client, errorMessage) { - logToConsole(LOG_DEBUG, `[VRR.Client] Sending new character failed GUI signal to ${getPlayerDisplayForConsole(client)}`); + logToConsole(LOG_DEBUG, `[AGRP.Client] Sending new character failed GUI signal to ${getPlayerDisplayForConsole(client)}`); sendNetworkEventToPlayer("agrp.newCharacterFailed", client, errorMessage); } // =========================================================================== function sendPlayerRemoveFromVehicle(client) { - logToConsole(LOG_DEBUG, `[VRR.Client] Sending remove from vehicle signal to ${getPlayerDisplayForConsole(client)}`); + logToConsole(LOG_DEBUG, `[AGRP.Client] Sending remove from vehicle signal to ${getPlayerDisplayForConsole(client)}`); sendNetworkEventToPlayer("agrp.removeFromVehicle", client); } @@ -533,10 +534,10 @@ function showPlayerItemTakeDelay(client, itemId) { if (getItemData(itemId)) { let delay = getItemTypeData(getItemData(itemId).itemTypeIndex).pickupDelay; if (delay > 0) { - logToConsole(LOG_DEBUG, `[VRR.Client] Showing item TAKE delay to ${getPlayerDisplayForConsole(client)} (${delay} milliseconds)`); + logToConsole(LOG_DEBUG, `[AGRP.Client] Showing item TAKE delay to ${getPlayerDisplayForConsole(client)} (${delay} milliseconds)`); sendNetworkEventToPlayer("agrp.showItemActionDelay", client, delay); } else { - logToConsole(LOG_DEBUG, `[VRR.Client] Showing item TAKE delay to ${getPlayerDisplayForConsole(client)} (instant)`); + logToConsole(LOG_DEBUG, `[AGRP.Client] Showing item TAKE delay to ${getPlayerDisplayForConsole(client)} (instant)`); playerItemActionDelayComplete(client); } } @@ -548,10 +549,10 @@ function showPlayerItemUseDelay(client, itemSlot) { if (getItemData(getPlayerData(client).hotBarItems[itemSlot])) { let delay = getItemTypeData(getItemData(getPlayerData(client).hotBarItems[itemSlot]).itemTypeIndex).useDelay; if (delay > 0) { - logToConsole(LOG_DEBUG, `[VRR.Client] Showing item USE delay to ${getPlayerDisplayForConsole(client)} (${delay} milliseconds)`); + logToConsole(LOG_DEBUG, `[AGRP.Client] Showing item USE delay to ${getPlayerDisplayForConsole(client)} (${delay} milliseconds)`); sendNetworkEventToPlayer("agrp.showItemActionDelay", client, delay); } else { - logToConsole(LOG_DEBUG, `[VRR.Client] Showing item USE delay to ${getPlayerDisplayForConsole(client)} (instant)`); + logToConsole(LOG_DEBUG, `[AGRP.Client] Showing item USE delay to ${getPlayerDisplayForConsole(client)} (instant)`); playerItemActionDelayComplete(client); } } @@ -563,10 +564,10 @@ function showPlayerItemDropDelay(client, itemSlot) { if (getItemData(getPlayerData(client).hotBarItems[itemSlot])) { let delay = getItemTypeData(getItemData(getPlayerData(client).hotBarItems[itemSlot]).itemTypeIndex).dropDelay; if (delay > 0) { - logToConsole(LOG_DEBUG, `[VRR.Client] Showing item DROP delay to ${getPlayerDisplayForConsole(client)} (${delay} milliseconds)`); + logToConsole(LOG_DEBUG, `[AGRP.Client] Showing item DROP delay to ${getPlayerDisplayForConsole(client)} (${delay} milliseconds)`); sendNetworkEventToPlayer("agrp.showItemActionDelay", client, delay); } else { - logToConsole(LOG_DEBUG, `[VRR.Client] Showing item DROP delay to ${getPlayerDisplayForConsole(client)} (instant)`); + logToConsole(LOG_DEBUG, `[AGRP.Client] Showing item DROP delay to ${getPlayerDisplayForConsole(client)} (instant)`); playerItemActionDelayComplete(client); } } @@ -578,10 +579,10 @@ function showPlayerItemPickupDelay(client, itemId) { if (getItemData(itemId)) { let delay = getItemTypeData(getItemData(itemId).itemTypeIndex).pickupDelay; if (delay > 0) { - logToConsole(LOG_DEBUG, `[VRR.Client] Showing item PICKUP delay to ${getPlayerDisplayForConsole(client)} (${delay} milliseconds)`); + logToConsole(LOG_DEBUG, `[AGRP.Client] Showing item PICKUP delay to ${getPlayerDisplayForConsole(client)} (${delay} milliseconds)`); sendNetworkEventToPlayer("agrp.showItemActionDelay", client, delay); } else { - logToConsole(LOG_DEBUG, `[VRR.Client] Showing item PICKUP delay to ${getPlayerDisplayForConsole(client)} (instant)`); + logToConsole(LOG_DEBUG, `[AGRP.Client] Showing item PICKUP delay to ${getPlayerDisplayForConsole(client)} (instant)`); playerItemActionDelayComplete(client); } } @@ -593,10 +594,10 @@ function showPlayerItemPutDelay(client, itemSlot) { if (getItemData(getPlayerData(client).hotBarItems[itemSlot])) { let delay = getItemTypeData(getItemData(getPlayerData(client).hotBarItems[itemSlot]).itemTypeIndex).putDelay; if (delay > 0) { - logToConsole(LOG_DEBUG, `[VRR.Client] Showing item PUT delay to ${getPlayerDisplayForConsole(client)} (${delay} milliseconds)`); + logToConsole(LOG_DEBUG, `[AGRP.Client] Showing item PUT delay to ${getPlayerDisplayForConsole(client)} (${delay} milliseconds)`); sendNetworkEventToPlayer("agrp.showItemActionDelay", client, delay); } else { - logToConsole(LOG_DEBUG, `[VRR.Client] Showing item PUT delay to ${getPlayerDisplayForConsole(client)} (instant)`); + logToConsole(LOG_DEBUG, `[AGRP.Client] Showing item PUT delay to ${getPlayerDisplayForConsole(client)} (instant)`); playerItemActionDelayComplete(client); } } @@ -609,18 +610,18 @@ function showPlayerItemSwitchDelay(client, itemSlot) { if (getPlayerData(client).hotBarItems[itemSlot] != -1) { let delay = getItemTypeData(getItemData(getPlayerData(client).hotBarItems[itemSlot]).itemTypeIndex).switchDelay; if (delay > 0) { - logToConsole(LOG_DEBUG, `[VRR.Client] Showing item switch delay to ${getPlayerDisplayForConsole(client)} (${delay} milliseconds)`); + logToConsole(LOG_DEBUG, `[AGRP.Client] Showing item switch delay to ${getPlayerDisplayForConsole(client)} (${delay} milliseconds)`); sendNetworkEventToPlayer("agrp.showItemActionDelay", client, delay); } else { - logToConsole(LOG_DEBUG, `[VRR.Client] Showing item switch delay to ${getPlayerDisplayForConsole(client)} (instant)`); + logToConsole(LOG_DEBUG, `[AGRP.Client] Showing item switch delay to ${getPlayerDisplayForConsole(client)} (instant)`); playerItemActionDelayComplete(client); } } else { - logToConsole(LOG_DEBUG, `[VRR.Client] Showing item switch delay to ${getPlayerDisplayForConsole(client)} (instant)`); + logToConsole(LOG_DEBUG, `[AGRP.Client] Showing item switch delay to ${getPlayerDisplayForConsole(client)} (instant)`); playerItemActionDelayComplete(client); } } else { - logToConsole(LOG_DEBUG, `[VRR.Client] Showing item switch delay to ${getPlayerDisplayForConsole(client)} (instant)`); + logToConsole(LOG_DEBUG, `[AGRP.Client] Showing item switch delay to ${getPlayerDisplayForConsole(client)} (instant)`); playerSwitchItem(client, itemSlot); } } @@ -628,14 +629,14 @@ function showPlayerItemSwitchDelay(client, itemSlot) { // =========================================================================== function sendPlayerDrunkEffect(client, amount, duration) { - logToConsole(LOG_DEBUG, `[VRR.Client] Setting drunk effect for ${getPlayerDisplayForConsole(client)} to ${amount} for ${duration} milliseconds`); + logToConsole(LOG_DEBUG, `[AGRP.Client] Setting drunk effect for ${getPlayerDisplayForConsole(client)} to ${amount} for ${duration} milliseconds`); sendNetworkEventToPlayer("agrp.drunkEffect", client, amount, duration); } // =========================================================================== function sendPlayerClearPedState(client) { - logToConsole(LOG_DEBUG, `[VRR.Client] Clearing ped state for ${getPlayerDisplayForConsole(client)}`); + logToConsole(LOG_DEBUG, `[AGRP.Client] Clearing ped state for ${getPlayerDisplayForConsole(client)}`); sendNetworkEventToPlayer("agrp.clearPedState", client); } @@ -645,29 +646,29 @@ function playerDamagedByPlayer(client, damagerEntityName, weaponId, pedPiece, he let damagerEntity = getPlayerFromParams(damagerEntityName); if (isNull(damagerEntity)) { - logToConsole(LOG_DEBUG, `[VRR.Client] ${getPlayerDisplayForConsole(client)}'s damager entity from ID is null`); + logToConsole(LOG_DEBUG, `[AGRP.Client] ${getPlayerDisplayForConsole(client)}'s damager entity from ID is null`); return false; } - logToConsole(LOG_DEBUG, `[VRR.Client] ${getPlayerDisplayForConsole(client)} was damaged by ${damagerEntity}`); + logToConsole(LOG_DEBUG, `[AGRP.Client] ${getPlayerDisplayForConsole(client)} was damaged by ${damagerEntity}`); if (isNull(damagerEntity)) { - logToConsole(LOG_DEBUG, `[VRR.Client] ${getPlayerDisplayForConsole(client)}'s damager client is INVALID`); + logToConsole(LOG_DEBUG, `[AGRP.Client] ${getPlayerDisplayForConsole(client)}'s damager client is INVALID`); return false; } if (!getPlayerData(damagerEntity) || !getPlayerData(client)) { - logToConsole(LOG_DEBUG, `[VRR.Client] ${getPlayerDisplayForConsole(client)}'s damager's client data is INVALID`); + logToConsole(LOG_DEBUG, `[AGRP.Client] ${getPlayerDisplayForConsole(client)}'s damager's client data is INVALID`); return false; } - logToConsole(LOG_DEBUG, `[VRR.Client] ${getPlayerDisplayForConsole(client)}'s damager is ${getPlayerDisplayForConsole(damagerEntity)}`); + logToConsole(LOG_DEBUG, `[AGRP.Client] ${getPlayerDisplayForConsole(client)}'s damager is ${getPlayerDisplayForConsole(damagerEntity)}`); switch (getPlayerData(damagerEntity).weaponDamageEvent) { case AGRP_WEAPON_DAMAGE_EVENT_TAZER: - logToConsole(LOG_DEBUG, `[VRR.Client] ${getPlayerDisplayForConsole(client)}'s damager ${getPlayerDisplayForConsole(damagerEntity)} is using a tazer`); + logToConsole(LOG_DEBUG, `[AGRP.Client] ${getPlayerDisplayForConsole(client)}'s damager ${getPlayerDisplayForConsole(damagerEntity)} is using a tazer`); if (!isPlayerTazed(client) && !isPlayerHandCuffed(client) && !isPlayerInAnyVehicle(client)) { - logToConsole(LOG_DEBUG, `[VRR.Client] ${getPlayerDisplayForConsole(client)} was not previously tazed, binded, or in a vehicle. Taze successful`); + logToConsole(LOG_DEBUG, `[AGRP.Client] ${getPlayerDisplayForConsole(client)} was not previously tazed, binded, or in a vehicle. Taze successful`); meActionToNearbyPlayers(damagerEntity, `electrifies ${getCharacterFullName(client)} with their tazer`); tazePlayer(client); } @@ -680,10 +681,10 @@ function playerDamagedByPlayer(client, damagerEntityName, weaponId, pedPiece, he break; case AGRP_WEAPON_DAMAGE_EVENT_NORMAL: - logToConsole(LOG_DEBUG, `[VRR.Client] ${getPlayerDisplayForConsole(client)}'s damager ${getPlayerDisplayForConsole(damagerEntity)} caused ${healthLoss} damage (damage reduction makes it ${(healthLoss * getPlayerData(client).incomingDamageMultiplier)})`); + logToConsole(LOG_DEBUG, `[AGRP.Client] ${getPlayerDisplayForConsole(client)}'s damager ${getPlayerDisplayForConsole(damagerEntity)} caused ${healthLoss} damage (damage reduction makes it ${(healthLoss * getPlayerData(client).incomingDamageMultiplier)})`); let remainingDamage = healthLoss * getPlayerData(client).incomingDamageMultiplier; if (getPlayerArmour(client) > 0) { - //logToConsole(LOG_DEBUG, `[VRR.Client] ${getPlayerDisplayForConsole(client)}'s armour was ${getPlayerArmour(client)}, so it was reduced by ${healthLoss}`); + //logToConsole(LOG_DEBUG, `[AGRP.Client] ${getPlayerDisplayForConsole(client)}'s armour was ${getPlayerArmour(client)}, so it was reduced by ${healthLoss}`); if (getPlayerArmour(client) - remainingDamage < 0) { setPlayerArmour(client, 0); remainingDamage = remainingDamage - getPlayerArmour(client); @@ -695,7 +696,7 @@ function playerDamagedByPlayer(client, damagerEntityName, weaponId, pedPiece, he break; default: - logToConsole(LOG_DEBUG, `[VRR.Client] ${getPlayerDisplayForConsole(client)}'s damager ${getPlayerDisplayForConsole(damagerEntity)} caused ${healthLoss} damage (damage reduction makes it ${(healthLoss * getPlayerData(client).incomingDamageMultiplier)})`); + logToConsole(LOG_DEBUG, `[AGRP.Client] ${getPlayerDisplayForConsole(client)}'s damager ${getPlayerDisplayForConsole(damagerEntity)} caused ${healthLoss} damage (damage reduction makes it ${(healthLoss * getPlayerData(client).incomingDamageMultiplier)})`); setPlayerHealth(client, getPlayerHealth(client) - (healthLoss * getPlayerData(client).incomingDamageMultiplier)); break; } @@ -955,21 +956,21 @@ function sendPlayerChatAutoHideDelay(client, delay) { // =========================================================================== function playRadioStreamForPlayer(client, streamURL, loop = true, volume = 0, element = false) { - logToConsole(LOG_DEBUG, `[VRR.Client] Forcing ${getPlayerDisplayForConsole(client)} to stream ${streamURL}`); + logToConsole(LOG_DEBUG, `[AGRP.Client] Forcing ${getPlayerDisplayForConsole(client)} to stream ${streamURL}`); sendNetworkEventToPlayer("agrp.radioStream", client, streamURL, loop, volume, element); } // =========================================================================== function playAudioFileForPlayer(client, audioName, loop = true, volume = 0, element = false) { - logToConsole(LOG_DEBUG, `[VRR.Client] Forcing ${getPlayerDisplayForConsole(client)} to play audio ${audioName}`); + logToConsole(LOG_DEBUG, `[AGRP.Client] Forcing ${getPlayerDisplayForConsole(client)} to play audio ${audioName}`); sendNetworkEventToPlayer("agrp.audioFileStream", client, audioName, loop, volume); } // =========================================================================== function stopRadioStreamForPlayer(client) { - logToConsole(LOG_DEBUG, `[VRR.Client] Forcing ${getPlayerDisplayForConsole(client)} to stop their radio stream`); + logToConsole(LOG_DEBUG, `[AGRP.Client] Forcing ${getPlayerDisplayForConsole(client)} to stop their radio stream`); sendNetworkEventToPlayer("agrp.stopRadioStream", client); } @@ -1096,14 +1097,14 @@ function setPlayerInfiniteRun(client, state) { // ========================================================================== -function sendBusinessToPlayer(client, businessId, name, entrancePosition, blipModel, pickupModel, hasInterior, hasItems) { - sendNetworkEventToPlayer("agrp.business", client, businessId, name, entrancePosition, blipModel, pickupModel, hasInterior, hasItems); +function sendBusinessToPlayer(client, businessId, name, entrancePosition, blipModel, pickupModel, buyPrice, rentPrice, hasInterior, hasItems) { + sendNetworkEventToPlayer("agrp.business", client, businessId, name, entrancePosition, blipModel, pickupModel, buyPrice, rentPrice, hasInterior, hasItems); } // ========================================================================== -function sendHouseToPlayer(client, houseId, description, entrancePosition, blipModel, pickupModel, hasInterior) { - sendNetworkEventToPlayer("agrp.house", client, houseId, description, entrancePosition, blipModel, pickupModel, hasInterior); +function sendHouseToPlayer(client, houseId, description, entrancePosition, blipModel, pickupModel, buyPrice, rentPrice, hasInterior) { + sendNetworkEventToPlayer("agrp.house", client, houseId, description, entrancePosition, blipModel, pickupModel, buyPrice, rentPrice, hasInterior); } // ========================================================================== @@ -1123,7 +1124,7 @@ function sendVehicleToPlayer(client, vehicleId, model, position, heading, colour function sendAllBusinessesToPlayer(client) { let businesses = getServerData().businesses; for (let i in businesses) { - sendBusinessToPlayer(client, businesses[i].index, businesses[i].name, businesses[i].entrancePosition, businesses[i].entranceBlipModel, businesses[i].entrancePickupModel, businesses[i].hasInterior, false); + sendBusinessToPlayer(client, businesses[i].index, businesses[i].name, businesses[i].entrancePosition, businesses[i].entranceBlipModel, businesses[i].entrancePickupModel, businesses[i].buyPrice, businesses[i].rentPrice, businesses[i].hasInterior, doesBusinessHaveAnyItemsToBuy(i)); } } @@ -1132,7 +1133,7 @@ function sendAllBusinessesToPlayer(client) { function sendAllHousesToPlayer(client) { let houses = getServerData().houses; for (let i in houses) { - sendHouseToPlayer(client, houses[i].index, houses[i].entrancePosition, houses[i].entranceBlipModel, houses[i].entrancePickupModel, houses[i].hasInterior); + sendHouseToPlayer(client, houses[i].index, houses[i].entrancePosition, houses[i].entranceBlipModel, houses[i].entrancePickupModel, houses[i].buyPrice, houses[i].rentPrice, houses[i].hasInterior); } } @@ -1287,4 +1288,11 @@ function sendMapChangeWarningToPlayer(client, changingToNight) { sendNetworkEventToPlayer("agrp.mapChangingSoon", client, changingToNight); } +// ========================================================================== + +function playerMapLoaded(client, mapName) { + + //updateAllInteriorVehiclesForPlayer(client, propertyData.exitInterior, propertyData.exitDimension); +} + // ========================================================================== \ No newline at end of file