From 1992359c3c0ec5f1577bcab80db531dec1e22202 Mon Sep 17 00:00:00 2001 From: Suprise444 <80071391+Suprise444@users.noreply.github.com> Date: Mon, 2 May 2022 22:48:03 +0200 Subject: [PATCH 01/14] May 2, 2022 --- locale/polish.json | 74 +++++++++++++++++++++++----------------------- 1 file changed, 37 insertions(+), 37 deletions(-) diff --git a/locale/polish.json b/locale/polish.json index 02a57f7c..82bb663b 100644 --- a/locale/polish.json +++ b/locale/polish.json @@ -353,43 +353,43 @@ "VehicleForRent": "Ten {1} jest do wynajęcia za {2}! Użyj {3} jeżeli chcesz go wynająć", "ADDED-31JAN2022": "DO NOT TRANSLATE. This string is just a comment to separate newly added translations.", - "LoginFailedInvalidPassword": "Invalid password! {1} attempts remaining", - "LoginFailedNoPassword": "You must enter a password! ! {1} attempts remaining", - "RegistrationFailedNoPassword": "You must enter a password!", - "RegistrationFailedNoPasswordConfirm": "You must confirm the password!", - "RegistrationFailedNoEmail": "You must enter an email!", - "AccountNameAlreadyRegistered": "Your name is already registered!", - "AlreadyLoggedIn": "You are already logged in!", - "RegistrationFailedInvalidEmail": "That email is invalid!", - "RegistrationFailedPasswordMismatch": "The passwords don't match!", - "RegistrationFailedCreateError": "Your account couldn't be created!", - "RegistrationSuccess": "Your account has been created!", - "RegistrationEmailVerifyReminder": "Don't forget to verify your email! A verification code has been sent to you.", - "RegistrationCreateCharReminder": "To play on the server, you will need to make a character.", - "NoCharactersGUIMessage": "You have no characters. Would you like to make one?", - "NoCharactersGUIWindowTitle": "No characters", - "NoCharactersChatMessage": "You have no characters. Use {1} to make one.", - "NeedEmailFor2FA": "You need to add your email to your account to use two-factor authentication.", - "NeedEmailVerifiedFor2FA": "You need to verify your email to use two-factor authentication.", - "SetEmailHelpTip": "Use {1} to set your email.", - "VerifyEmailHelpTip": "Use {1} to verify your email.", + "LoginFailedInvalidPassword": "Nieprawidłowe hasło! Pozostało {1} prób", + "LoginFailedNoPassword": "Musisz podać hasło! ! Pozostało {1} prób", + "RegistrationFailedNoPassword": "Musisz podać hasło!", + "RegistrationFailedNoPasswordConfirm": "Musisz potwierdzić hasło!", + "RegistrationFailedNoEmail": "Musisz podać adres email!", + "AccountNameAlreadyRegistered": "Twoja nazwa jest już zarejestrowana!", + "AlreadyLoggedIn": "Jesteś już zalogowany!", + "RegistrationFailedInvalidEmail": "Nieprawidłowy adres email!", + "RegistrationFailedPasswordMismatch": "Hasła się nie zgadzają!", + "RegistrationFailedCreateError": "Nie udało się stworzyć twojego konta!", + "RegistrationSuccess": "Twoje konto zostało utworzone!", + "RegistrationEmailVerifyReminder": "Nie zapomnij zweryfikować swojego adresu email! Kod werifikacyjny został wysłany na twój adres email.", + "RegistrationCreateCharReminder": "Aby zagrać na serwerze, musisz stworzyć postać.", + "NoCharactersGUIMessage": "Nie masz postaci. Czy chciałbyś ją stworzyć?", + "NoCharactersGUIWindowTitle": "Brak postaci", + "NoCharactersChatMessage": "Nie masz postaci. Użyj {1} aby ją stworzyć.", + "NeedEmailFor2FA": "Musisz przypisać adres email do swojego konta, aby używać weryfikacji dwuetapowej.", + "NeedEmailVerifiedFor2FA": "Musisz zweryfikować swój adres email, aby używać weryfikacji dwuetapowej", + "SetEmailHelpTip": "Użyj {1} aby ustawić swój adres email.", + "VerifyEmailHelpTip": "Użyj {1} aby zweryfikować swój adres email.", "ADDED-13FEB2022": "DO NOT TRANSLATE. This string is just a comment to separate newly added translations.", - "NearbyRadio": "Nearby radio", - "FromRadio": "From radio", - "ToRadio": "To radio", - "NeedToEnterPropertyCommand": "You need to enter the {1} first! Use {2} to enter and exit", - "NeedToEnterPropertyKeyPress": "You need to enter the {1} first! Press {2} to enter and exit", - "InventoryFullCantCarry": "You don't have any space to carry this (full inventory)!", - "NotEnoughCashNeedAmountMore": "You don't have enough money! You need {1} more!", - "AmountMustBeMoreThan": "The amount must be more than {1}!", - "WeaponBanned": "You are not allowed to buy or use weapons!", - "TimeNotNumber": "The time must be a number", - "HeaderDefaultBusinessItemTypes": "Business Item Templates", - "FixingStuck": "Fixing your position and virtual world ...", - "CantUseCommandYet": "You must wait before you can use this command again!", - "NotATester": "You are not a tester!", - "AccessDenied": "AccessDenied", - "InvalidSkin": "That skin is invalid!", - "HeaderInteriorTypes": "Interiors" + "NearbyRadio": "Pobliskie radio", + "FromRadio": "Z radia", + "ToRadio": "Do radia", + "NeedToEnterPropertyCommand": "Musisz najpierw wejść do {1}! Użyj {2} aby wejść lub wyjść", + "NeedToEnterPropertyKeyPress": "Musisz najpierw wejść do {1}! Naciśnij {2} aby wejść lub wyjść", + "InventoryFullCantCarry": "Nie masz miejsca aby to podnieść (pełny ekwipunek)!", + "NotEnoughCashNeedAmountMore": "Nie masz wystarczająco miejsca! Potrzebujesz jeszcze {1}!", + "AmountMustBeMoreThan": "Wartość musi być większa od {1}!", + "WeaponBanned": "Nie możesz używać ani kupować broni!", + "TimeNotNumber": "Czas musi być numerem", + "HeaderDefaultBusinessItemTypes": "Wzory przedmiotów biznesowych", + "FixingStuck": "Naprawianie twojej pozycji i świata wirtualnego ...", + "CantUseCommandYet": "Musisz poczekać zanim znowu użyjesz tej komendy!", + "NotATester": "Nie jesteś testerem!", + "AccessDenied": "OdmowaDostępu", + "InvalidSkin": "Ta skórka jest nieprawidłowa!", + "HeaderInteriorTypes": "Wnętrza" } From 49d212b9fd799c308499c1f55f914505e295847e Mon Sep 17 00:00:00 2001 From: Vortrex <3858226+VortrexFTW@users.noreply.github.com> Date: Tue, 26 Jul 2022 02:18:13 -0500 Subject: [PATCH 02/14] Backup current script state --- scripts/client/netevents.js | 417 ++++++++++++ scripts/server/crime.js | 22 + scripts/server/forensics.js | 20 + scripts/server/gps.js | 148 +++++ scripts/server/insurance.js | 40 ++ scripts/server/netevents.js | 1235 +++++++++++++++++++++++++++++++++++ 6 files changed, 1882 insertions(+) create mode 100644 scripts/client/netevents.js create mode 100644 scripts/server/crime.js create mode 100644 scripts/server/forensics.js create mode 100644 scripts/server/gps.js create mode 100644 scripts/server/insurance.js create mode 100644 scripts/server/netevents.js diff --git a/scripts/client/netevents.js b/scripts/client/netevents.js new file mode 100644 index 00000000..0cadc35a --- /dev/null +++ b/scripts/client/netevents.js @@ -0,0 +1,417 @@ +// =========================================================================== +// Vortrex's Roleplay Resource +// https://github.com/VortrexFTW/gtac_roleplay +// =========================================================================== +// FILE: netevents.js +// DESC: Provides server communication and cross-endpoint network events +// TYPE: Client (JavaScript) +// =========================================================================== + +function initServerScript() { + logToConsole(LOG_DEBUG, "[VRR.Server]: Initializing server script ..."); + addAllNetworkHandlers(); + logToConsole(LOG_DEBUG, "[VRR.Server]: Server script initialized!"); +} + +// =========================================================================== + +function addAllNetworkHandlers() { + logToConsole(LOG_DEBUG, "[VRR.Server]: Adding network handlers ..."); + + // Chat history + addNetworkEventHandler("m", receiveChatBoxMessageFromServer); // Not prefixed with VRR to make it as small as possible + addNetworkEventHandler("vrr.chatScrollLines", setChatScrollLines); + addNetworkEventHandler("vrr.chatAutoHideDelay", setChatAutoHideDelay); + + // Messaging (like textdraws and stuff) + addNetworkEventHandler("vrr.smallGameMessage", showSmallGameMessage); + + // Job + addNetworkEventHandler("vrr.job", receiveJobFromServer); + addNetworkEventHandler("vrr.working", setLocalPlayerWorkingState); + addNetworkEventHandler("vrr.jobType", setLocalPlayerJobType); + addNetworkEventHandler("vrr.showJobRouteLocation", showJobRouteLocation); + addNetworkEventHandler("vrr.hideJobRouteLocation", hideJobRouteLocation); + + // Local player states and values + addNetworkEventHandler("vrr.restoreCamera", restoreLocalCamera); + addNetworkEventHandler("vrr.cameraLookAt", setLocalCameraLookAt); + addNetworkEventHandler("vrr.freeze", setLocalPlayerFrozenState); + addNetworkEventHandler("vrr.control", setLocalPlayerControlState); + addNetworkEventHandler("vrr.fadeCamera", fadeLocalCamera); + addNetworkEventHandler("vrr.removeFromVehicle", removeLocalPlayerFromVehicle); + addNetworkEventHandler("vrr.clearWeapons", clearLocalPlayerWeapons); + addNetworkEventHandler("vrr.giveWeapon", giveLocalPlayerWeapon); + addNetworkEventHandler("vrr.position", setLocalPlayerPosition); + addNetworkEventHandler("vrr.heading", setLocalPlayerHeading); + addNetworkEventHandler("vrr.interior", setLocalPlayerInterior); + addNetworkEventHandler("vrr.spawned", onServerSpawnedLocalPlayer); + addNetworkEventHandler("vrr.money", setLocalPlayerCash); + addNetworkEventHandler("vrr.armour", setLocalPlayerArmour); + addNetworkEventHandler("vrr.localPlayerSkin", setLocalPlayerSkin); + addNetworkEventHandler("vrr.pedSpeak", makeLocalPlayerPedSpeak); + addNetworkEventHandler("vrr.infiniteRun", setLocalPlayerInfiniteRun); + addNetworkEventHandler("vrr.playerCop", setLocalPlayerAsCopState); + addNetworkEventHandler("vrr.health", setLocalPlayerHealth); + addNetworkEventHandler("vrr.wantedLevel", setLocalPlayerWantedLevel); + addNetworkEventHandler("vrr.playerPedId", sendLocalPlayerNetworkIdToServer); + addNetworkEventHandler("vrr.ped", setLocalPlayerPedPartsAndProps); + addNetworkEventHandler("vrr.spawn", serverRequestedLocalPlayerSpawn); + addNetworkEventHandler("vrr.clearPedState", clearLocalPedState); + addNetworkEventHandler("vrr.drunkEffect", setLocalPlayerDrunkEffect); + addNetworkEventHandler("vrr.deleteLocalPlayerPed", deleteLocalPlayerPed); + + // Vehicle + addNetworkEventHandler("vrr.vehicle", receiveVehicleFromServer); + addNetworkEventHandler("vrr.veh.lights", setVehicleLights); + addNetworkEventHandler("vrr.veh.engine", setVehicleEngine); + addNetworkEventHandler("vrr.veh.repair", repairVehicle); + + // Radio + addNetworkEventHandler("vrr.radioStream", playStreamingRadio); + addNetworkEventHandler("vrr.audioFileStream", playAudioFile); + addNetworkEventHandler("vrr.stopRadioStream", stopStreamingRadio); + addNetworkEventHandler("vrr.radioVolume", setStreamingRadioVolume); + + // Key Bindings + addNetworkEventHandler("vrr.delKeyBind", unBindAccountKey); + addNetworkEventHandler("vrr.addKeyBind", bindAccountKey); + addNetworkEventHandler("vrr.clearKeyBinds", clearKeyBinds); + + // Weapon Damage + addNetworkEventHandler("vrr.weaponDamageEnabled", setPlayerWeaponDamageEnabled); + addNetworkEventHandler("vrr.weaponDamageEvent", setPlayerWeaponDamageEvent); + + // GUI + addNetworkEventHandler("vrr.showRegistration", showRegistrationGUI); + addNetworkEventHandler("vrr.showNewCharacter", showNewCharacterGUI); + addNetworkEventHandler("vrr.showLogin", showLoginGUI); + addNetworkEventHandler("vrr.2fa", showTwoFactorAuthGUI); + addNetworkEventHandler("vrr.showResetPasswordCodeInput", resetPasswordCodeInputGUI); + addNetworkEventHandler("vrr.showResetPasswordEmailInput", resetPasswordEmailInputGUI); + addNetworkEventHandler("vrr.showChangePassword", showChangePasswordGUI); + addNetworkEventHandler("vrr.showCharacterSelect", showCharacterSelectGUI); + addNetworkEventHandler("vrr.switchCharacterSelect", switchCharacterSelectGUI); + addNetworkEventHandler("vrr.showError", showErrorGUI); + addNetworkEventHandler("vrr.showInfo", showInfoGUI); + addNetworkEventHandler("vrr.showPrompt", showYesNoPromptGUI); + addNetworkEventHandler("vrr.loginSuccess", loginSuccess); + addNetworkEventHandler("vrr.characterSelectSuccess", characterSelectSuccess); + addNetworkEventHandler("vrr.loginFailed", loginFailed); + addNetworkEventHandler("vrr.registrationSuccess", registrationSuccess); + addNetworkEventHandler("vrr.registrationFailed", registrationFailed); + addNetworkEventHandler("vrr.newCharacterFailed", newCharacterFailed); + addNetworkEventHandler("vrr.changePassword", showChangePasswordGUI); + addNetworkEventHandler("vrr.showLocaleChooser", showLocaleChooserGUI); + addNetworkEventHandler("vrr.guiColour", setGUIColours); + + // Business + addNetworkEventHandler("vrr.business", receiveBusinessFromServer); + + // House + addNetworkEventHandler("vrr.house", receiveHouseFromServer); + + // GPS + addNetworkEventHandler("vrr.showGPSBlip", showGPSLocation); + + // Locale + addNetworkEventHandler("vrr.locale", setLocale); + addNetworkEventHandler("vrr.localeChooser", toggleLocaleChooserGUI); + + // Misc + addNetworkEventHandler("vrr.mouseCursor", toggleMouseCursor); + addNetworkEventHandler("vrr.mouseCamera", toggleMouseCamera); + addNetworkEventHandler("vrr.clearPeds", clearLocalPlayerOwnedPeds); + addNetworkEventHandler("vrr.passenger", enterVehicleAsPassenger); + addNetworkEventHandler("vrr.logo", setServerLogoRenderState); + addNetworkEventHandler("vrr.ambience", setCityAmbienceState); + addNetworkEventHandler("vrr.runCode", runClientCode); + addNetworkEventHandler("vrr.minuteDuration", setMinuteDuration); + addNetworkEventHandler("vrr.snow", setSnowState); + addNetworkEventHandler("vrr.enterPropertyKey", setEnterPropertyKey); + addNetworkEventHandler("vrr.skinSelect", toggleSkinSelect); + addNetworkEventHandler("vrr.hotbar", updatePlayerHotBar); + addNetworkEventHandler("vrr.showItemActionDelay", showItemActionDelay); + addNetworkEventHandler("vrr.set2DRendering", set2DRendering); + addNetworkEventHandler("vrr.mouseCameraForce", setMouseCameraState); + addNetworkEventHandler("vrr.logLevel", setLogLevel); + addNetworkEventHandler("vrr.hideAllGUI", hideAllGUI); + addNetworkEventHandler("vrr.nametag", updatePlayerNameTag); + addNetworkEventHandler("vrr.nametagDistance", setNameTagDistance); + addNetworkEventHandler("vrr.ping", updatePlayerPing); + addNetworkEventHandler("vrr.anim", makePedPlayAnimation); + addNetworkEventHandler("vrr.stopAnim", makePedStopAnimation); + addNetworkEventHandler("vrr.forceAnim", forcePedAnimation); + addNetworkEventHandler("vrr.clientInfo", serverRequestedClientInfo); + addNetworkEventHandler("vrr.interiorLights", updateInteriorLightsState); + addNetworkEventHandler("vrr.cutsceneInterior", setCutsceneInterior); + addNetworkEventHandler("vrr.syncElement", forceSyncElementProperties); + addNetworkEventHandler("vrr.elementPosition", setElementPosition); + addNetworkEventHandler("vrr.elementCollisions", setElementCollisionsEnabled); + addNetworkEventHandler("vrr.vehBuyState", setVehiclePurchaseState); + addNetworkEventHandler("vrr.holdObject", makePedHoldObject); +} + +// =========================================================================== + +function sendResourceReadySignalToServer() { + sendNetworkEventToServer("vrr.clientReady"); +} + +// =========================================================================== + +function sendResourceStartedSignalToServer() { + sendNetworkEventToServer("vrr.clientStarted"); +} + +// =========================================================================== + +function sendResourceStoppedSignalToServer() { + if (isConnected) { + sendNetworkEventToServer("vrr.clientStopped"); + } +} + +// =========================================================================== + +function set2DRendering(hudState, labelState, smallGameMessageState, scoreboardState, hotBarState, itemActionDelayState) { + logToConsole(LOG_DEBUG, `[VRR.Main] Updating render states (HUD: ${hudState}, Labels: ${labelState}, Bottom Text: ${smallGameMessageState}, Scoreboard: ${scoreboardState}, HotBar: ${hotBarState}, Item Action Delay: ${itemActionDelayState})`); + renderHUD = hudState; + + if (getGame() == VRR_GAME_GTA_IV) { + natives.displayCash(hudState); + natives.displayAmmo(hudState); + natives.displayHud(hudState); + natives.displayRadar(hudState); + natives.displayAreaName(hudState); + } else { + if (typeof setHUDEnabled != "undefined") { + setHUDEnabled(hudState); + } + } + + renderLabels = labelState; + renderSmallGameMessage = smallGameMessageState; + renderScoreBoard = scoreboardState; + renderHotBar = hotBarState; + renderItemActionDelay = itemActionDelayState; +} + +// =========================================================================== + +function onServerSpawnedLocalPlayer(state) { + logToConsole(LOG_DEBUG, `[VRR.Main] Setting spawned state to ${state}`); + isSpawned = state; + setUpInitialGame(); + if (state) { + setTimeout(function () { + calledDeathEvent = false; + }, 1000); + + getElementsByType(ELEMENT_PED).filter(ped => !ped.isType(ELEMENT_PLAYER)).forEach(ped => { + syncCivilianProperties(ped); + }); + + getElementsByType(ELEMENT_PLAYER).forEach(player => { + syncPlayerProperties(player); + }); + + getElementsByType(ELEMENT_VEHICLE).forEach(vehicle => { + syncVehicleProperties(vehicle); + }); + } +} + +// =========================================================================== + +function tellServerPlayerUsedKeyBind(key) { + sendNetworkEventToServer("vrr.useKeyBind", key); +} + +// =========================================================================== + +function tellServerPlayerArrivedAtJobRouteLocation() { + sendNetworkEventToServer("vrr.arrivedAtJobRouteLocation"); +} + +// =========================================================================== + +function tellServerItemActionDelayComplete() { + sendNetworkEventToServer("vrr.itemActionDelayComplete"); +} + +// =========================================================================== + +function sendServerClientInfo() { + let clientVersion = "0.0.0.0"; + if (typeof CLIENT_VERSION_MAJOR != "undefined") { + clientVersion = `${CLIENT_VERSION_MAJOR}.${CLIENT_VERSION_MINOR}.${CLIENT_VERSION_PATCH}.${CLIENT_VERSION_BUILD}`; + } + sendNetworkEventToServer("vrr.clientInfo", clientVersion, game.width, game.height); +} + +// =========================================================================== + +function sendServerNewAFKStatus(state) { + sendNetworkEventToServer("vrr.afk", state); +} + +// =========================================================================== + +function anchorBoat(vehicleId) { + +} + +// =========================================================================== + +function setEnterPropertyKey(key) { + enterPropertyKey = key; +} + +// =========================================================================== + +function serverRequestedClientInfo() { + sendServerClientInfo(); +} + +// =========================================================================== + +function updateInteriorLightsState(state) { + interiorLightsEnabled = state; +} + +// =========================================================================== + +function forceSyncElementProperties(elementId) { + if (getElementFromId(elementId) == null) { + return false; + } + + syncElementProperties(getElementFromId(elementId)); +} + +// =========================================================================== + +function setElementCollisionsEnabled(elementId, state) { + if (getElementFromId(elementId) == null) { + return false; + } + + getElementFromId(elementId).collisionsEnabled = state; +} + +// =========================================================================== + +function setLocalPlayerArmour(armour) { + if (typeof localPlayer.armour != "undefined") { + localPlayer.armour = armour; + } +} + +// =========================================================================== + +function setLocalPlayerWantedLevel(wantedLevel) { + forceWantedLevel = toInteger(wantedLevel); +} + +// =========================================================================== + +function setLogLevel(level) { + logLevel = level; +} + +// =========================================================================== + +function setLocalPlayerInfiniteRun(state) { + if (localPlayer != null) { + if (getGame() == VRR_GAME_GTA_III || getGame() == VRR_GAME_GTA_VC) { + game.SET_PLAYER_NEVER_GETS_TIRED(game.GET_PLAYER_ID(), boolToInt(state)); + } + } +} + +// =========================================================================== + +function setLocalPlayerSkin(skinId) { + logToConsole(LOG_INFO, `[VRR.Server] Setting locale player skin to ${skinId}`); + if (getGame() == VRR_GAME_GTA_IV) { + natives.changePlayerModel(natives.getPlayerId(), skinId); + } else { + localPlayer.skin = skinId; + } +} + +// =========================================================================== + +function makePedHoldObject(pedId, modelIndex) { + if (getGame() == VRR_GAME_GTA_IV) { + natives.givePedAmbientObject(natives.getPedFromNetworkId(pedId), getGameConfig().objects[getGame()][modelIndex][1]) + } +} + +// =========================================================================== + +function sendLocalPlayerNetworkIdToServer() { + sendNetworkEventToServer("vrr.playerPedId", natives.getNetworkIdFromPed(localPlayer)); +} + +// =========================================================================== + +function setCutsceneInterior(cutsceneName) { + if (getGame() == VRR_GAME_GTA_IV) { + if (cutsceneName == "") { + natives.clearCutscene(); + } else { + if (natives.isInteriorScene()) { + natives.clearCutscene(); + } + natives.initCutscene(cutsceneName); + } + } +} + +// =========================================================================== + +function makeLocalPlayerPedSpeak(speechName) { + if (getGame() == VRR_GAME_GTA_IV) { + // if player is in vehicle, allow megaphone (if last arg is "1", it will cancel megaphone echo) + // Only speeches with _MEGAPHONE will have the bullhorn effect + // Afaik it only works on police voices anyway + if (localPlayer.vehicle != null) { + natives.sayAmbientSpeech(localPlayer, speechName, true, false, 0); + } else { + natives.sayAmbientSpeech(localPlayer, speechName, true, false, 1); + } + } else if (getGame() == VRR_GAME_GTA_III || getGame() == VRR_GAME_GTA_VC) { + // Don't have a way to get the ped ref ID and can't use ped in arg + //game.SET_CHAR_SAY(game.GET_PLAYER_ID(), int); + } +} + +// =========================================================================== + +function setLocalPlayerAsCopState(state) { + if (getGame() == VRR_GAME_GTA_IV) { + natives.setPlayerAsCop(natives.getPlayerId(), state); + natives.setPoliceIgnorePlayer(natives.getPlayerId(), state); + } +} + +// =========================================================================== + +function serverRequestedLocalPlayerSpawn(skinId, position) { + if (getGame() == VRR_GAME_GTA_IV) { + natives.createPlayer(skinId, position); + //if(isCustomCameraSupported()) { + // game.restoreCamera(true); + //} + } +} + +// =========================================================================== + +function sendLocaleSelectToServer(localeId) { + sendNetworkEventToServer("vrr.localeSelect", localeId); +} + +// =========================================================================== \ No newline at end of file diff --git a/scripts/server/crime.js b/scripts/server/crime.js new file mode 100644 index 00000000..1df467c3 --- /dev/null +++ b/scripts/server/crime.js @@ -0,0 +1,22 @@ +// =========================================================================== +// Vortrex's Roleplay Resource +// https://github.com/VortrexFTW/gtac_roleplay +// =========================================================================== +// FILE: crime.js +// DESC: Provides crime data structures, functions, and operations +// TYPE: Server (JavaScript) +// =========================================================================== + +/** + * @class Representing a crime's data. Loaded and saved in the database + */ + class CrimeData { + constructor(suspectId, crimeType, reporterId = 0) { + this.crimeType = crimeType; + this.suspectId = suspectId; + this.reporterId = reporterId; + this.whenCommitted = 0; + this.whenReported = 0; + this.databaseId = 0; + } +}; \ No newline at end of file diff --git a/scripts/server/forensics.js b/scripts/server/forensics.js new file mode 100644 index 00000000..840a969f --- /dev/null +++ b/scripts/server/forensics.js @@ -0,0 +1,20 @@ +// =========================================================================== +// Vortrex's Roleplay Resource +// https://github.com/VortrexFTW/gtac_roleplay +// =========================================================================== +// FILE: forensics.js +// DESC: Provides forensics functions and commands (bullet casings, blood, etc) +// TYPE: Server (JavaScript) +// =========================================================================== + +// Forensic Types +const VRR_FORENSICS_NONE = 0; +const VRR_FORENSICS_BULLET = 1; // Bullet. The actual tip that hits a target. Has rifling and ballistics information of the weapon. +const VRR_FORENSICS_BLOOD = 2; // Blood. Automatically applied to ground and bullets that hit when somebody is shot +const VRR_FORENSICS_BODY = 3; // Body. A dead body lol +const VRR_FORENSICS_HAIR = 4; // Hair. Automatically applied to +const VRR_FORENSICS_SWEAT = 5; // Sweat. Automatically applied to clothing when worn +const VRR_FORENSICS_SALIVA = 6; // Saliva. Automatically applied to drinks when drank +const VRR_FORENSICS_BULLETCASINGS = 7; // Bullet casings. Automatically dropped when fired from a weapon except when used in a vehicle (driveby) + +// =========================================================================== \ No newline at end of file diff --git a/scripts/server/gps.js b/scripts/server/gps.js new file mode 100644 index 00000000..69d47321 --- /dev/null +++ b/scripts/server/gps.js @@ -0,0 +1,148 @@ +// =========================================================================== +// Vortrex's Roleplay Resource +// https://github.com/VortrexFTW/gtac_roleplay +// =========================================================================== +// FILE: gps.js +// DESC: Provides GPS functions and commands +// TYPE: Server (JavaScript) +// =========================================================================== + +// GPS State Types +const VRR_GPS_TYPE_NONE = 0; // None (invalid) +const VRR_GPS_TYPE_BUSINESS = 1; // Business +const VRR_GPS_TYPE_POLICE = 2; // Police Station +const VRR_GPS_TYPE_HOSPITAL = 3; // Hospital +const VRR_GPS_TYPE_JOB = 4; // Job +const VRR_GPS_TYPE_GAMELOC = 5; // Game Location + +// =========================================================================== + +function gpsCommand(command, params, client) { + messagePlayerNormal(client, makeChatBoxSectionHeader(getLocaleString(client, "HeaderBusinessList"))); + + let locationType = VRR_GPS_TYPE_NONE; + let useType = VRR_ITEM_USETYPE_NONE; + let blipColour = "white"; + + switch(toLowerCase(params)) { + case "police": + blipColour = "businessBlue" + locationType = VRR_GPS_TYPE_POLICE; + break; + + case "hospital": + blipColour = "businessBlue" + locationType = VRR_GPS_TYPE_HOSPITAL; + break; + + case "job": + blipColour = "businessBlue" + locationType = VRR_GPS_TYPE_JOB; + break; + + case "skin": + case "skins": + case "clothes": + case "player": + blipColour = "businessBlue" + locationType = VRR_GPS_TYPE_BUSINESS; + useType = VRR_ITEM_USETYPE_SKIN; + break; + + case "gun": + case "guns": + case "weapon": + case "weapons": + case "wep": + case "weps": + blipColour = "businessBlue" + locationType = VRR_GPS_TYPE_BUSINESS; + useType = VRR_ITEM_USETYPE_WEAPON; + break; + + case "food": + case "eat": + blipColour = "businessBlue" + locationType = VRR_GPS_TYPE_BUSINESS; + useType = VRR_ITEM_USETYPE_FOOD; + break; + + case "drink": + blipColour = "businessBlue" + locationType = VRR_GPS_TYPE_BUSINESS; + useType = VRR_ITEM_USETYPE_DRINK; + break; + + case "alcohol": + case "booze": + case "bar": + blipColour = "businessBlue" + locationType = VRR_GPS_TYPE_BUSINESS; + useType = VRR_ITEM_USETYPE_ALCOHOL; + break; + + case "repair": + case "carrepair": + case "vehrepair": + case "spray": + case "fix": + blipColour = "businessBlue" + locationType = VRR_GPS_TYPE_BUSINESS; + useType = VRR_ITEM_USETYPE_VEHREPAIR; + break; + + case "vehiclecolour": + case "vehcolour": + case "carcolour": + case "colour": + blipColour = "businessBlue" + locationType = VRR_GPS_TYPE_BUSINESS; + useType = VRR_ITEM_USETYPE_VEHCOLOUR; + break; + + default: { + let itemTypeId = getItemTypeFromParams(params); + if(getItemTypeData(itemTypeId) != false) { + locationType = VRR_GPS_TYPE_BUSINESS; + blipColour = "businessBlue"; + useType = getItemTypeData(itemTypeId).useType; + } else { + let gameLocationId = getGameLocationFromParams(params); + if(gameLocationId != false) { + position = getGameConfig().locations[getServerGame()][gameLocationId][1] + } + } + } + } + + if(locationType == VRR_GPS_TYPE_NONE) { + messagePlayerError(client, getLocaleString(client, "InvalidGPSLocation")); + return false; + } + + if(locationType == VRR_GPS_TYPE_BUSINESS) { + let businessId = getClosestBusinessWithBuyableItemOfUseType(useType); + if(!businessId) { + messagePlayerError(client, getLocaleString(client, "NoBusinessWithItemType")); + return false; + } + + if(!getBusinessData(businessId)) { + messagePlayerError(client, getLocaleString(client, "NoBusinessWithItemType")); + return false; + } + + hideAllBlipsForPlayerGPS(client); + blinkGenericGPSBlipForPlayer(client, getBusinessData(businessId).entrancePosition, getBusinessData(businessId).entranceBlipModel, getColourByType(blipColour), 10); + messagePlayerSuccess(client, "Look for the blinking icon on your mini map"); + } + + if(locationType == VRR_GPS_TYPE_GAMELOC) { + hideAllBlipsForPlayerGPS(client); + blinkGenericGPSBlipForPlayer(client, position, 0, getColourByType(blipColour), 10); + messagePlayerSuccess(client, "Look for the blinking icon on your mini map"); + return true; + } +} + +// =========================================================================== \ No newline at end of file diff --git a/scripts/server/insurance.js b/scripts/server/insurance.js new file mode 100644 index 00000000..35aee21f --- /dev/null +++ b/scripts/server/insurance.js @@ -0,0 +1,40 @@ +// =========================================================================== +// Vortrex's Roleplay Resource +// https://github.com/VortrexFTW/gtac_roleplay +// =========================================================================== +// FILE: insurance.js +// DESC: Provides insurance commands, functions, and usage +// TYPE: Server (JavaScript) +// =========================================================================== + +// Insurance Account Owner Types +const VRR_INS_ACCT_OWNER_NONE = 0; // None +const VRR_INS_ACCT_OWNER_PLAYER = 1; // Player owns insurance company +const VRR_INS_ACCT_OWNER_BIZ = 2; // Business owns insurance company +const VRR_INS_ACCT_OWNER_CLAN = 3; // Clan owns insurance company + +// =========================================================================== + +// Insurance Account Entity Types +const VRR_INS_ACCT_ENTITY_NONE = 0; // None +const VRR_INS_ACCT_ENTITY_PLAYER_HEALTH = 1; // Health Insurance +const VRR_INS_ACCT_ENTITY_PLAYER_LIFE = 2; // Life Insurance +const VRR_INS_ACCT_ENTITY_VEH = 3; // Vehicle Insurance +const VRR_INS_ACCT_ENTITY_BIZ = 4; // Business Insurance +const VRR_INS_ACCT_ENTITY_HOUSE = 5; // House Insurance + +// =========================================================================== + +// Insurance Account History Types +const VRR_INS_ACCT_HISTORY_NONE = 0; // None +const VRR_INS_ACCT_HISTORY_PLAYER_MEDICAL = 1; // Medical insurance was used (player disease/injury) +const VRR_INS_ACCT_HISTORY_PLAYER_DEATH = 2; // Life insurance was used (player death) +const VRR_INS_ACCT_HISTORY_VEH_DAMAGE = 3; // Vehicle was damaged, but not destroyed +const VRR_INS_ACCT_HISTORY_VEH_WRECKED = 4; // Vehicle was completely destroyed +const VRR_INS_ACCT_HISTORY_VEH_THEFT = 5; // Vehicle was stolen +const VRR_INS_ACCT_HISTORY_BIZ_DAMAGE = 6; // Business was damaged (broken items/window/door) +const VRR_INS_ACCT_HISTORY_BIZ_THEFT = 7; // Business was stolen from +const VRR_INS_ACCT_HISTORY_HOUSE_DAMAGE = 8; // House was damaged +const VRR_INS_ACCT_HISTORY_HOUSE_THEFT = 9; // House was stolen from + +// =========================================================================== \ No newline at end of file diff --git a/scripts/server/netevents.js b/scripts/server/netevents.js new file mode 100644 index 00000000..864f50e2 --- /dev/null +++ b/scripts/server/netevents.js @@ -0,0 +1,1235 @@ +// =========================================================================== +// Vortrex's Roleplay Resource +// https://github.com/VortrexFTW/gtac_roleplay +// =========================================================================== +// FILE: netevents.js +// DESC: Provides client communication and cross-endpoint network events +// TYPE: Server (JavaScript) +// =========================================================================== + +function initNetworkEventsScript() { + logToConsole(LOG_DEBUG, "[VRR.Client]: Initializing client script ..."); + addAllNetworkEventHandlers(); + logToConsole(LOG_DEBUG, "[VRR.Client]: Client script initialized!"); +} + +// =========================================================================== + +function addAllNetworkEventHandlers() { + logToConsole(LOG_DEBUG, "[VRR.Client]: Adding network handlers ..."); + + // KeyBind + addNetworkEventHandler("vrr.useKeyBind", playerUsedKeyBind); + + // GUI + addNetworkEventHandler("vrr.promptAnswerNo", playerPromptAnswerNo); + addNetworkEventHandler("vrr.promptAnswerYes", playerPromptAnswerYes); + addNetworkEventHandler("vrr.toggleGUI", playerToggledGUI); + addNetworkEventHandler("vrr.2fa", checkPlayerTwoFactorAuthentication); + + // AFK + addNetworkEventHandler("vrr.afk", playerChangeAFKState); + + // Event + addNetworkEventHandler("vrr.pickup", onPlayerNearPickup); + addNetworkEventHandler("vrr.enteredSphere", onPlayerEnteredSphere); + addNetworkEventHandler("vrr.exitedSphere", onPlayerExitedSphere); + addNetworkEventHandler("vrr.playerDeath", onPlayerDeath); + addNetworkEventHandler("vrr.onPlayerEnterVehicle", onPlayerEnteredVehicle); + addNetworkEventHandler("vrr.onPlayerExitVehicle", onPlayerExitedVehicle); + + // Job + addNetworkEventHandler("vrr.arrivedAtJobRouteLocation", playerArrivedAtJobRouteLocation); + + // Client + addNetworkEventHandler("vrr.clientReady", playerClientReady); + addNetworkEventHandler("vrr.guiReady", playerGUIReady); + addNetworkEventHandler("vrr.clientStarted", playerClientStarted); + addNetworkEventHandler("vrr.clientStopped", playerClientStopped); + + // Account + addNetworkEventHandler("vrr.checkLogin", checkLogin); + addNetworkEventHandler("vrr.checkRegistration", checkRegistration); + addNetworkEventHandler("vrr.checkResetPassword", checkAccountResetPasswordRequest); + addNetworkEventHandler("vrr.checkChangePassword", checkAccountChangePassword); + + // Developer + addNetworkEventHandler("vrr.runCodeSuccess", clientRunCodeSuccess); + addNetworkEventHandler("vrr.runCodeFail", clientRunCodeFail); + + // SubAccount + addNetworkEventHandler("vrr.checkNewCharacter", checkNewCharacter); + addNetworkEventHandler("vrr.nextCharacter", checkNextCharacter); + addNetworkEventHandler("vrr.previousCharacter", checkPreviousCharacter); + addNetworkEventHandler("vrr.selectCharacter", selectCharacter); + + // Item + addNetworkEventHandler("vrr.itemActionDelayComplete", playerItemActionDelayComplete); + addNetworkEventHandler("vrr.weaponDamage", playerDamagedByPlayer); + + // Locale + addNetworkEventHandler("vrr.localeSelect", playerSelectedNewLocale); + + // Misc + addNetworkEventHandler("vrr.plr.pos", updatePositionInPlayerData); + addNetworkEventHandler("vrr.plr.rot", updateHeadingInPlayerData); + addNetworkEventHandler("vrr.skinSelected", playerFinishedSkinSelection); + addNetworkEventHandler("vrr.clientInfo", updateConnectionLogOnClientInfoReceive); + addNetworkEventHandler("vrr.vehBuyState", receiveVehiclePurchaseStateUpdateFromClient); + addNetworkEventHandler("vrr.playerPedId", receivePlayerPedNetworkId); + addNetworkEventHandler("vrr.playerCop", setPlayerAsCopState); +} + +// =========================================================================== + +function updatePlayerNameTag(client) { + //logToConsole(LOG_DEBUG, `[VRR.Client] Sending ${getPlayerDisplayForConsole(client)}'s updated nametag to all players`); + sendNetworkEventToPlayer("vrr.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`); + let clients = getClients(); + for (let i in clients) { + updatePlayerNameTag(clients[i]); + } +} + +// =========================================================================== + +function updatePlayerPing(client) { + //logToConsole(LOG_DEBUG, `[VRR.Client] Sending ${getPlayerDisplayForConsole(client)}'s ping to all players`); + sendNetworkEventToPlayer("vrr.ping", null, getPlayerName(client), getPlayerPing(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])}`); + if (playerResourceStarted[client.index] == true) { + initClient(client); + } +} + +// =========================================================================== + +function playerGUIReady(client) { + playerGUI[client.index] = true; + logToConsole(LOG_DEBUG, `[VRR.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])}`); + if (playerResourceReady[client.index] == true) { + initClient(client); + } +} + +// =========================================================================== + +function playerClientStopped(client) { + logToConsole(LOG_DEBUG, `[VRR.Client] ${getPlayerDisplayForConsole(client)}'s client resources have stopped (possibly error?). Kicking them from the server ...`); + getPlayerData(targetClient).customDisconnectReason = `Kicked - Client script verification failed. Possible hacks.`; + disconnectPlayer(client); +} + +// =========================================================================== + +function showGameMessage(client, text, colour, duration, fontName = "Pricedown") { + logToConsole(LOG_DEBUG, `[VRR.Client] Showing game message to ${getPlayerDisplayForConsole(client)} (${text}) for ${duration} milliseconds`); + sendNetworkEventToPlayer("vrr.smallGameMessage", client, text, colour, duration, fontName); +} + +// =========================================================================== + +function enableCityAmbienceForPlayer(client, clearElements = false) { + //if(server.getCVar("civilians") == false) { + // return false; + //} + + //logToConsole(LOG_DEBUG, `[VRR.Client] Setting ${getPlayerDisplayForConsole(client)}'s city ambience to ${toUpperCase(getOnOffFromBool(false))}`); + //sendNetworkEventToPlayer("vrr.ambience", client, true); +} + +// =========================================================================== + +function disableCityAmbienceForPlayer(client, clearElements = false) { + //if(server.getCVar("civilians") == true) { + // return false; + //} + + //logToConsole(LOG_DEBUG, `[VRR.Client] Setting ${getPlayerDisplayForConsole(client)}'s city ambience to ${toUpperCase(getOnOffFromBool(false))}`); + //sendNetworkEventToPlayer("vrr.ambience", client, false, clearElements); +} + +// =========================================================================== + +function clearPlayerOwnedPeds(client) { + logToConsole(LOG_DEBUG, `[VRR.Client] Clearing peds owned by ${getPlayerDisplayForConsole(client)}`); + sendNetworkEventToPlayer("vrr.clearPeds", client); +} + +// =========================================================================== + +function updatePlayerSpawnedState(client, state) { + logToConsole(LOG_DEBUG, `[VRR.Client] Setting ${getPlayerDisplayForConsole(client)}'s spawned state ${toUpperCase(getOnOffFromBool(state))}`); + getPlayerData(client).spawned = true; + sendNetworkEventToPlayer("vrr.spawned", client, state); +} + +// =========================================================================== + +function setPlayerControlState(client, state) { + logToConsole(LOG_DEBUG, `[VRR.Client] Setting ${getPlayerDisplayForConsole(client)}'s control state ${toUpperCase(getOnOffFromBool(state))}`); + sendNetworkEventToPlayer("vrr.control", client, state, !state); +} + +// =========================================================================== + +function updatePlayerShowLogoState(client, state) { + logToConsole(LOG_DEBUG, `[VRR.Client] Setting ${getPlayerDisplayForConsole(client)}'s logo state ${toUpperCase(getOnOffFromBool(state))}`); + sendNetworkEventToPlayer("vrr.logo", client, state); +} + +// =========================================================================== + +function restorePlayerCamera(client) { + logToConsole(LOG_DEBUG, `[VRR.Client] Restoring ${getPlayerDisplayForConsole(client)}'s camera`); + sendNetworkEventToPlayer("vrr.restoreCamera", client); +} + +// =========================================================================== + +function setPlayer2DRendering(client, hudState = false, labelState = false, smallGameMessageState = false, scoreboardState = false, hotBarState = false, itemActionDelayState = false) { + sendNetworkEventToPlayer("vrr.set2DRendering", client, hudState, labelState, smallGameMessageState, scoreboardState, hotBarState, itemActionDelayState); +} + +// =========================================================================== + +function syncPlayerProperties(client) { + logToConsole(LOG_DEBUG, `[VRR.Client] Sending signal to sync ${getPlayerDisplayForConsole(client)}'s player ped properties`); + sendNetworkEventToPlayer("vrr.syncElement", null, getPlayerPed(client).id); +} + +// =========================================================================== + +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))})`); + sendNetworkEventToPlayer("vrr.snow", client, getServerConfig().fallingSnow, getServerConfig().groundSnow); + } +} + +// =========================================================================== + +function updatePlayerHotBar(client) { + logToConsole(LOG_DEBUG, `[VRR.Client] Sending updated hotbar data to ${getPlayerDisplayForConsole(client)}`); + let tempHotBarItems = []; + for (let i in getPlayerData(client).hotBarItems) { + let itemImage = ""; + let itemValue = 0; + let itemExists = false; + if (getPlayerData(client).hotBarItems[i] != -1) { + if (getItemData(getPlayerData(client).hotBarItems[i])) { + let itemData = getItemData(getPlayerData(client).hotBarItems[i]); + let itemTypeData = getItemTypeData(itemData.itemTypeIndex); + itemExists = true; + itemImage = itemTypeData.hotbarImage; + itemValue = itemData.value; + } + } + tempHotBarItems.push([i, itemExists, itemImage, itemValue]); + } + sendNetworkEventToPlayer("vrr.hotbar", client, getPlayerData(client).activeHotBarSlot, tempHotBarItems); +} + +// =========================================================================== + +function setPlayerWeaponDamageEnabled(client, state) { + logToConsole(LOG_DEBUG, `[VRR.Client] Sending weapon damage state for ${getPlayerDisplayForConsole(client)} to all players`); + sendNetworkEventToPlayer("vrr.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`); + sendNetworkEventToPlayer("vrr.weaponDamageEvent", null, getPlayerName(client), eventType); + getPlayerData(client).weaponDamageEvent = eventType; +} + +// =========================================================================== + +function sendJobRouteLocationToPlayer(client, position, colour) { + logToConsole(LOG_DEBUG, `[VRR.Client] Sending job route stop data to ${getPlayerDisplayForConsole(client)}`); + sendNetworkEventToPlayer("vrr.showJobRouteLocation", client, position, colour); +} + +// =========================================================================== + +function showPlayerLoginSuccessGUI(client) { + logToConsole(LOG_DEBUG, `[VRR.Client] Sending login success GUI signal to ${getPlayerDisplayForConsole(client)}`); + sendNetworkEventToPlayer("vrr.loginSuccess", client); +} + +// =========================================================================== + +function showPlayerLoginFailedGUI(client, errorMessage) { + logToConsole(LOG_DEBUG, `[VRR.Client] Sending login failed GUI signal to ${getPlayerDisplayForConsole(client)}`); + sendNetworkEventToPlayer("vrr.loginFailed", client, errorMessage); +} + +// =========================================================================== + +function showPlayerRegistrationSuccessGUI(client) { + logToConsole(LOG_DEBUG, `[VRR.Client] Sending registration success GUI signal to ${getPlayerDisplayForConsole(client)}`); + sendNetworkEventToPlayer("vrr.registrationSuccess", client); +} + +// =========================================================================== + +function showPlayerRegistrationFailedGUI(client, errorMessage) { + logToConsole(LOG_DEBUG, `[VRR.Client] Sending registration failed GUI signal to ${getPlayerDisplayForConsole(client)}`); + sendNetworkEventToPlayer("vrr.registrationFailed", client, errorMessage); +} + +// =========================================================================== + +function sendPlayerGUIColours(client) { + logToConsole(LOG_DEBUG, `[VRR.Client] Sending GUI colours to ${getPlayerDisplayForConsole(client)}`); + sendNetworkEventToPlayer("vrr.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)}`); + sendNetworkEventToPlayer("vrr.guiInit", client); +} + +// =========================================================================== + +function showPlayerLoginGUI(client, errorMessage = "") { + logToConsole(LOG_DEBUG, `[VRR.Client] Sending show login GUI signal to ${getPlayerDisplayForConsole(client)}`); + sendNetworkEventToPlayer("vrr.showLogin", client); +} + +// =========================================================================== + +function showPlayerRegistrationGUI(client, errorMessage = "") { + logToConsole(LOG_DEBUG, `[VRR.Client] Sending show registration GUI signal to ${getPlayerDisplayForConsole(client)}`); + sendNetworkEventToPlayer("vrr.showRegistration", client); +} + +// =========================================================================== + +function showPlayerNewCharacterGUI(client) { + logToConsole(LOG_DEBUG, `[VRR.Client] Sending show new character GUI signal to ${getPlayerDisplayForConsole(client)}`); + sendNetworkEventToPlayer("vrr.showNewCharacter", client); +} + +// =========================================================================== + +function showPlayerChangePasswordGUI(client, errorMessage = "") { + logToConsole(LOG_DEBUG, `[VRR.Client] Sending show change password GUI signal to ${getPlayerDisplayForConsole(client)}`); + sendNetworkEventToPlayer("vrr.showChangePassword", client, errorMessage); +} + +// =========================================================================== + +function showPlayerResetPasswordCodeInputGUI(client) { + logToConsole(LOG_DEBUG, `[VRR.Client] Sending show reset password code input GUI signal to ${getPlayerDisplayForConsole(client)}`); + sendNetworkEventToPlayer("vrr.showResetPasswordCodeInput", client); +} + +// =========================================================================== + +function showPlayerResetPasswordEmailInputGUI(client) { + logToConsole(LOG_DEBUG, `[VRR.Client] Sending show reset password email input GUI signal to ${getPlayerDisplayForConsole(client)}`); + sendNetworkEventToPlayer("vrr.showResetPasswordEmailInput", client); +} + +// =========================================================================== + +function showPlayerCharacterSelectGUI(client, firstName, lastName, cash, clan, lastPlayed, skin) { + logToConsole(LOG_DEBUG, `[VRR.Client] Sending character select GUI signal to ${getPlayerDisplayForConsole(client)}`); + sendNetworkEventToPlayer("vrr.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)}`); + sendNetworkEventToPlayer("vrr.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)}`); + sendNetworkEventToPlayer("vrr.characterSelectSuccess", client); +} + +// =========================================================================== + +function showPlayerCharacterSelectFailedGUI(client) { + logToConsole(LOG_DEBUG, `[VRR.Client] Sending character select failed GUI signal to ${getPlayerDisplayForConsole(client)}`); + sendNetworkEventToPlayer("vrr.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})`); + sendNetworkEventToPlayer("vrr.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})`); + sendNetworkEventToPlayer("vrr.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})`); + sendNetworkEventToPlayer("vrr.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})`); + sendNetworkEventToPlayer("vrr.runCode", client, code, getPlayerId(returnTo)); +} + +// =========================================================================== + +function sendPlayerWorkingState(client, state) { + logToConsole(LOG_DEBUG, `[VRR.Client] Sending working state (${toUpperCase(getYesNoFromBool(state))}) to ${getPlayerDisplayForConsole(client)}`); + sendNetworkEventToPlayer("vrr.working", client, state); +} + +// =========================================================================== + +function sendPlayerJobType(client, jobType) { + logToConsole(LOG_DEBUG, `[VRR.Client] Sending job type (${jobType}) to ${getPlayerDisplayForConsole(client)}`); + sendNetworkEventToPlayer("vrr.jobType", client, jobType); +} + +// =========================================================================== + +function sendPlayerStopJobRoute(client) { + logToConsole(LOG_DEBUG, `[VRR.Client] Sending signal to abort job route to ${getPlayerDisplayForConsole(client)}`); + sendNetworkEventToPlayer("vrr.hideJobRouteLocation", client); +} + +// =========================================================================== + +function sendPlayerMouseCameraToggle(client) { + logToConsole(LOG_DEBUG, `[VRR.Client] Sending signal to toggle mouse camera ${getPlayerDisplayForConsole(client)}`); + sendNetworkEventToPlayer("vrr.mouseCamera", client); +} + +// =========================================================================== + +function setPlayerMouseCameraState(client, state) { + logToConsole(LOG_DEBUG, `[VRR.Client] Sending signal to toggle mouse camera ${getPlayerDisplayForConsole(client)}`); + sendNetworkEventToPlayer("vrr.mouseCameraForce", client, state); +} + +// =========================================================================== + +function sendPlayerMouseCursorToggle(client) { + logToConsole(LOG_DEBUG, `[VRR.Client] Sending signal to toggle mouse cursor ${getPlayerDisplayForConsole(client)}`); + sendNetworkEventToPlayer("vrr.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"})`); + sendNetworkEventToPlayer("vrr.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"})`); + sendNetworkEventToPlayer("vrr.clearKeyBinds", client); +} + +// =========================================================================== + +function sendRemoveAccountKeyBindToClient(client, key) { + logToConsole(LOG_DEBUG, `[VRR.Client] Sending deleted keybind to ${getPlayerDisplayForConsole(client)} (Key: ${toUpperCase(getKeyNameFromId(key))})`); + sendNetworkEventToPlayer("vrr.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})`); + sendNetworkEventToPlayer("vrr.position", client, position); +} + +// =========================================================================== + +function sendPlayerSetHeading(client, heading) { + logToConsole(LOG_DEBUG, `[VRR.Client] Sending set heading signal to ${getPlayerDisplayForConsole(client)} (Heading: ${heading})`); + sendNetworkEventToPlayer("vrr.heading", client, heading); +} + +// =========================================================================== + +function sendPlayerSetInterior(client, interior) { + logToConsole(LOG_DEBUG, `[VRR.Client] Sending set interior signal to ${getPlayerDisplayForConsole(client)} (Interior: ${interior})`); + sendNetworkEventToPlayer("vrr.interior", client, interior); +} + +// =========================================================================== + +function sendPlayerFrozenState(client, state) { + logToConsole(LOG_DEBUG, `[VRR.Client] Sending set frozen signal to ${getPlayerDisplayForConsole(client)} (State: ${toUpperCase(getYesNoFromBool(state))})`); + sendNetworkEventToPlayer("vrr.frozen", client, state); +} + +// =========================================================================== + +function clearPlayerWeapons(client, clearData = true) { + logToConsole(LOG_DEBUG, `[VRR.Client] Sending signal to ${getPlayerDisplayForConsole(client)} to clear weapons`); + sendNetworkEventToPlayer("vrr.clearWeapons", client, clearData); +} + +// =========================================================================== + +function showPlayerNewCharacterFailedGUI(client, errorMessage) { + logToConsole(LOG_DEBUG, `[VRR.Client] Sending new character failed GUI signal to ${getPlayerDisplayForConsole(client)}`); + sendNetworkEventToPlayer("vrr.newCharacterFailed", client, errorMessage); +} + +// =========================================================================== + +function sendPlayerRemoveFromVehicle(client) { + logToConsole(LOG_DEBUG, `[VRR.Client] Sending remove from vehicle signal to ${getPlayerDisplayForConsole(client)}`); + sendNetworkEventToPlayer("vrr.removeFromVehicle", client); +} + +// =========================================================================== + +function sendChatBoxMessageToPlayer(client, messageText, colour) { + //messageClient(messageText, client, colour); + sendNetworkEventToPlayer("m", client, messageText, colour); +} + +// =========================================================================== + +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)`); + sendNetworkEventToPlayer("vrr.showItemActionDelay", client, delay); + } else { + logToConsole(LOG_DEBUG, `[VRR.Client] Showing item TAKE delay to ${getPlayerDisplayForConsole(client)} (instant)`); + playerItemActionDelayComplete(client); + } + } +} + +// =========================================================================== + +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)`); + sendNetworkEventToPlayer("vrr.showItemActionDelay", client, delay); + } else { + logToConsole(LOG_DEBUG, `[VRR.Client] Showing item USE delay to ${getPlayerDisplayForConsole(client)} (instant)`); + playerItemActionDelayComplete(client); + } + } +} + +// =========================================================================== + +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)`); + sendNetworkEventToPlayer("vrr.showItemActionDelay", client, delay); + } else { + logToConsole(LOG_DEBUG, `[VRR.Client] Showing item DROP delay to ${getPlayerDisplayForConsole(client)} (instant)`); + playerItemActionDelayComplete(client); + } + } +} + +// =========================================================================== + +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)`); + sendNetworkEventToPlayer("vrr.showItemActionDelay", client, delay); + } else { + logToConsole(LOG_DEBUG, `[VRR.Client] Showing item PICKUP delay to ${getPlayerDisplayForConsole(client)} (instant)`); + playerItemActionDelayComplete(client); + } + } +} + +// =========================================================================== + +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)`); + sendNetworkEventToPlayer("vrr.showItemActionDelay", client, delay); + } else { + logToConsole(LOG_DEBUG, `[VRR.Client] Showing item PUT delay to ${getPlayerDisplayForConsole(client)} (instant)`); + playerItemActionDelayComplete(client); + } + } +} + +// =========================================================================== + +function showPlayerItemSwitchDelay(client, itemSlot) { + if (itemSlot != -1) { + 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)`); + sendNetworkEventToPlayer("vrr.showItemActionDelay", client, delay); + } else { + logToConsole(LOG_DEBUG, `[VRR.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)`); + playerItemActionDelayComplete(client); + } + } else { + logToConsole(LOG_DEBUG, `[VRR.Client] Showing item switch delay to ${getPlayerDisplayForConsole(client)} (instant)`); + playerSwitchItem(client, itemSlot); + } +} + +// =========================================================================== + +function sendPlayerDrunkEffect(client, amount, duration) { + logToConsole(LOG_DEBUG, `[VRR.Client] Setting drunk effect for ${getPlayerDisplayForConsole(client)} to ${amount} for ${duration} milliseconds`); + sendNetworkEventToPlayer("vrr.drunkEffect", client, amount, duration); +} + +// =========================================================================== + +function sendPlayerClearPedState(client) { + logToConsole(LOG_DEBUG, `[VRR.Client] Clearing ped state for ${getPlayerDisplayForConsole(client)}`); + sendNetworkEventToPlayer("vrr.clearPedState", client); +} + +// =========================================================================== + +function playerDamagedByPlayer(client, damagerEntityName, weaponId, pedPiece, healthLoss) { + let damagerEntity = getPlayerFromParams(damagerEntityName); + + if (isNull(damagerEntity)) { + logToConsole(LOG_DEBUG, `[VRR.Client] ${getPlayerDisplayForConsole(client)}'s damager entity from ID is null`); + return false; + } + + logToConsole(LOG_DEBUG, `[VRR.Client] ${getPlayerDisplayForConsole(client)} was damaged by ${damagerEntity}`); + + if (isNull(damagerEntity)) { + logToConsole(LOG_DEBUG, `[VRR.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`); + return false; + } + + logToConsole(LOG_DEBUG, `[VRR.Client] ${getPlayerDisplayForConsole(client)}'s damager is ${getPlayerDisplayForConsole(damagerEntity)}`); + + switch (getPlayerData(damagerEntity).weaponDamageEvent) { + case VRR_WEAPON_DAMAGE_EVENT_TAZER: + logToConsole(LOG_DEBUG, `[VRR.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`); + meActionToNearbyPlayers(damagerEntity, `electrifies ${getCharacterFullName(client)} with their tazer`); + tazePlayer(client); + } + break; + + case VRR_WEAPON_DAMAGE_EVENT_EXTINGUISH: + break; + + case VRR_WEAPON_DAMAGE_EVENT_MACE: + break; + + case VRR_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)})`); + setPlayerHealth(client, getPlayerHealth(client) - (healthLoss * getPlayerData(client).incomingDamageMultiplier)); + break; + + default: + logToConsole(LOG_DEBUG, `[VRR.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; + } +} + +// =========================================================================== + +function setPlayerCameraLookAt(client, cameraPosition, lookAtPosition) { + sendNetworkEventToPlayer("vrr.cameraLookAt", client, cameraPosition, lookAtPosition); +} + +// =========================================================================== + +function sendTimeMinuteDurationToPlayer(client, minuteDuration) { + sendNetworkEventToPlayer("vrr.minuteDuration", client, minuteDuration); +} + +// =========================================================================== + +function updatePositionInPlayerData(client, position) { + getPlayerData(client).syncPosition = position; +} + +// =========================================================================== + +function updateHeadingInPlayerData(client, heading) { + getPlayerData(client).syncHeading = heading; +} + +// =========================================================================== + +function updatePositionInVehicleData(client, vehicle, position) { + getVehicleData(vehicle).syncPosition = position; +} + +// =========================================================================== + +function updateHeadingInVehicleData(client, vehicle, heading) { + getVehicleData(vehicle).syncHeading = heading; +} + +// =========================================================================== + +function forcePlayerIntoSkinSelect(client) { + if (typeof getGameConfig().skinChangePosition[getGame()] != "undefined") { + getPlayerData(client).returnToPosition = getPlayerPosition(client); + getPlayerData(client).returnToHeading = getPlayerHeading(client); + getPlayerData(client).returnToInterior = getPlayerInterior(client); + getPlayerData(client).returnToDimension = getPlayerDimension(client); + getPlayerData(client).returnToType = VRR_RETURNTO_TYPE_SKINSELECT; + + setPlayerPosition(client, getGameConfig().skinChangePosition[getGame()][0]); + setPlayerHeading(client, getGameConfig().skinChangePosition[getGame()][1]); + setPlayerInterior(client, getGameConfig().skinChangePosition[getGame()][2]); + setPlayerDimension(client, getPlayerId(client) + 500); + } + + sendNetworkEventToPlayer("vrr.skinSelect", client, true); +} + +// =========================================================================== + +function updatePlayerCash(client) { + sendNetworkEventToPlayer("vrr.money", client, getPlayerCurrentSubAccount(client).cash); +} + +// =========================================================================== + +function sendAllPoliceStationBlips(client) { + if (getGameConfig().blipSprites[getGame()].policeStation != -1) { + let tempBlips = []; + for (let i in getServerData().policeStations[getGame()]) { + tempBlips.push([ + getGameConfig().blipSprites[getGame()].policeStation, + getServerData().policeStations[getGame()][i].position.x, + getServerData().policeStations[getGame()][i].position.y, + getServerData().policeStations[getGame()][i].position.z, + 3, + getColourByName("policeBlue"), + ]); + } + sendNetworkEventToPlayer("vrr.blips", client, tempBlips); + } +} + +// =========================================================================== + +function sendAllFireStationBlips(client) { + if (getGameConfig().blipSprites[getGame()].fireStation != -1) { + let tempBlips = []; + for (let i in getServerData().fireStations[getGame()]) { + tempBlips.push([ + getGameConfig().blipSprites[getGame()].fireStation, + getServerData().fireStations[getGame()][i].position.x, + getServerData().fireStations[getGame()][i].position.y, + getServerData().fireStations[getGame()][i].position.z, + 3, + getColourByName("firefighterRed"), + ]); + } + sendNetworkEventToPlayer("vrr.blips", client, tempBlips); + } +} + +// =========================================================================== + +function sendAllHospitalBlips(client) { + if (getGameConfig().blipSprites[getGame()].hospital != -1) { + let tempBlips = []; + for (let i in getServerData().hospitals[getGame()]) { + tempBlips.push([ + getGameConfig().blipSprites[getGame()].hospital, + getServerData().hospitals[getGame()][i].position.x, + getServerData().hospitals[getGame()][i].position.y, + getServerData().hospitals[getGame()][i].position.z, + 3, + getColourByName("medicPink"), + ]); + } + sendNetworkEventToPlayer("vrr.blips", client, tempBlips); + } +} + +// =========================================================================== + +function sendAllAmmunationBlips(client) { + if (getGameConfig().blipSprites[getGame()].ammunation != -1) { + let tempBlips = []; + for (let i in getServerData().ammunations[getGame()]) { + tempBlips.push([ + getGameConfig().blipSprites[getGame()].ammunation, + getServerData().ammunations[getGame()][i].position.x, + getServerData().ammunations[getGame()][i].position.y, + getServerData().ammunations[getGame()][i].position.z, + 3, + 0 + ]); + } + sendNetworkEventToPlayer("vrr.blips", client, tempBlips); + } +} + +// =========================================================================== + +function sendAllPayAndSprayBlips(client) { + if (getGameConfig().blipSprites[getGame()].payAndSpray != -1) { + let tempBlips = []; + for (let i in getServerData().payAndSprays[getGame()]) { + tempBlips.push([ + getGameConfig().blipSprites[getGame()].payAndSpray, + getServerData().payAndSprays[getGame()][i].position.x, + getServerData().payAndSprays[getGame()][i].position.y, + getServerData().payAndSprays[getGame()][i].position.z, + 3, + 0 + ]); + } + sendNetworkEventToPlayer("vrr.blips", client, tempBlips); + } +} + +// =========================================================================== + +function sendAllFuelStationBlips(client) { + if (getGameConfig().blipSprites[getGame()].fuelStation != -1) { + let tempBlips = []; + for (let i in getServerData().fuelStations[getGame()]) { + tempBlips.push([ + getGameConfig().blipSprites[getGame()].fuelStation, + getServerData().fuelStations[getGame()][i].position.x, + getServerData().fuelStations[getGame()][i].position.y, + getServerData().fuelStations[getGame()][i].position.z, + 3, + getColourByName("burntOrange"), + ]); + } + sendNetworkEventToPlayer("vrr.blips", client, tempBlips); + } +} + +// =========================================================================== + +function sendPlayerSetHealth(client, health) { + sendNetworkEventToPlayer("vrr.health", client, toInteger(health)); +} + +// =========================================================================== + +function sendPlayerSetArmour(client, armour) { + sendNetworkEventToPlayer("vrr.armour", client, armour); +} + +// =========================================================================== + +function playerFinishedSkinSelection(client, allowedSkinIndex) { + sendNetworkEventToPlayer("vrr.skinSelect", client, false); + if (allowedSkinIndex == -1) { + messagePlayerAlert(client, "You canceled the skin change."); + restorePlayerCamera(client); + + if (getPlayerData(client).returnToPosition != null && getPlayerData(client).returnToType == VRR_RETURNTO_TYPE_SKINSELECT) { + setPlayerPosition(client, getPlayerData(client).returnToPosition); + setPlayerHeading(client, getPlayerData(client).returnToHeading); + setPlayerInterior(client, getPlayerData(client).returnToInterior); + setPlayerDimension(client, getPlayerData(client).returnToDimension); + + getPlayerData(client).returnToPosition = null; + getPlayerData(client).returnToHeading = null; + getPlayerData(client).returnToInterior = null; + getPlayerData(client).returnToDimension = null; + } + return false; + } else { + getPlayerCurrentSubAccount(client).skin = getSkinIndexFromModel(getServerData().allowedSkins[allowedSkinIndex][0]); + if (isPlayerWorking(client)) { + messagePlayerAlert(client, "Your new skin has been saved but won't be shown until you stop working."); + setPlayerSkin(client, getJobData(getPlayerCurrentSubAccount(client).job).uniforms[getPlayerData(client).jobUniform].skinId); + } else { + setPlayerSkin(client, getPlayerCurrentSubAccount(client).skin); + } + + if (getPlayerData(client).returnToPosition != null && getPlayerData(client).returnToType == VRR_RETURNTO_TYPE_SKINSELECT) { + setPlayerPosition(client, getPlayerData(client).returnToPosition); + setPlayerHeading(client, getPlayerData(client).returnToHeading); + setPlayerInterior(client, getPlayerData(client).returnToInterior); + setPlayerDimension(client, getPlayerData(client).returnToDimension); + + getPlayerData(client).returnToPosition = null; + getPlayerData(client).returnToHeading = null; + getPlayerData(client).returnToInterior = null; + getPlayerData(client).returnToDimension = null; + } + + restorePlayerCamera(client); + setPlayerControlState(client, true); + + deleteItem(getPlayerData(client).itemActionItem); + switchPlayerActiveHotBarSlot(client, -1); + cachePlayerHotBarItems(client); + + meActionToNearbyPlayers(client, `changes their skin to ${getServerData().allowedSkins[allowedSkinIndex][1]}`); + } +} + +// =========================================================================== + +function sendPlayerChatScrollLines(client, amount) { + sendNetworkEventToPlayer("vrr.chatScrollLines", client, amount); +} + +// =========================================================================== + +function sendPlayerChatAutoHideDelay(client, delay) { + sendNetworkEventToPlayer("vrr.chatAutoHideDelay", client, delay); +} + +// =========================================================================== + +function playRadioStreamForPlayer(client, streamURL, loop = true, volume = 0, element = false) { + logToConsole(LOG_DEBUG, `[VRR.Client] Forcing ${getPlayerDisplayForConsole(client)} to stream ${streamURL}`); + sendNetworkEventToPlayer("vrr.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}`); + sendNetworkEventToPlayer("vrr.audioFileStream", client, audioName, loop, volume); +} + +// =========================================================================== + +function stopRadioStreamForPlayer(client) { + logToConsole(LOG_DEBUG, `[VRR.Client] Forcing ${getPlayerDisplayForConsole(client)} to stop their radio stream`); + sendNetworkEventToPlayer("vrr.stopRadioStream", client); +} + +// =========================================================================== + +function setPlayerStreamingRadioVolume(client, volumeLevel, elementId = false) { + getPlayerData(client).accountData.streamingRadioVolume = volumeLevel; + getPlayerData(client).streamingRadioElement = elementId; + sendNetworkEventToPlayer("vrr.radioVolume", client, volumeLevel, elementId); +} + +// =========================================================================== + +function setVehicleLightsState(vehicle, state) { + setEntityData(vehicle, "vrr.lights", getVehicleData(vehicle).lights); + sendNetworkEventToPlayer("vrr.veh.lights", null, vehicle.id, state); +} + +// =========================================================================== + +function sendPlayerEnterPropertyKey(client, key) { + sendNetworkEventToPlayer("vrr.enterPropertyKey", client, key); +} + +// =========================================================================== + +function makePedPlayAnimation(ped, animationSlot, positionOffset) { + setEntityData(ped, "vrr.anim", animationSlot, true); + sendNetworkEventToPlayer("vrr.anim", null, getPedForNetworkEvent(ped), animationSlot, positionOffset); +} + +// =========================================================================== + +function makePedStopAnimation(ped) { + removeEntityData(ped, "vrr.anim"); + sendNetworkEventToPlayer("vrr.stopAnim", null, getPedForNetworkEvent(ped)); +} + +// =========================================================================== + +function forcePedAnimation(ped, animationSlot, positionOffset = 0) { + addEntityData(ped, "vrr.anim", animationSlot, true); + sendNetworkEventToPlayer("vrr.forceAnim", null, getPedForNetworkEvent(ped), animationSlot, positionOffset); +} + +// =========================================================================== + +function hideAllPlayerGUI(client) { + sendNetworkEventToPlayer("vrr.hideAllGUI", client); +} + +// =========================================================================== + +function requestClientInfo(client) { + sendNetworkEventToPlayer("vrr.clientInfo", client); +} + +// =========================================================================== + +function updateInteriorLightsForPlayer(client, state) { + sendNetworkEventToPlayer("vrr.interiorLights", client, state); +} + +// =========================================================================== + +function forcePlayerToSyncElementProperties(client, element) { + sendNetworkEventToPlayer("vrr.syncElement", client, element.id); +} + +// =========================================================================== + +function sendPlayerPedPartsAndProps(client) { + let bodyParts = getPlayerCurrentSubAccount(client).bodyParts; + let bodyProps = getPlayerCurrentSubAccount(client).bodyProps; + + sendNetworkEventToPlayer("vrr.ped", client, [bodyParts.hair, bodyParts.head, bodyParts.upper, bodyParts.lower], [bodyProps.hair, bodyProps.eyes, bodyProps.head, bodyProps.leftHand, bodyProps.rightHand, bodyProps.leftWrist, bodyProps.rightWrist, bodyParts.hip, bodyProps.leftFoot, bodyProps.rightFoot]); +} + +// =========================================================================== + +function onPlayerNearPickup(client, pickupId) { + getPlayerData(client).currentPickup = getElementFromId(pickupId); +} + +// =========================================================================== + +function updateAllInteriorVehiclesForPlayer(client, interior, dimension) { + for (let i in getServerData().vehicles) { + if (getServerData().vehicles[i].vehicle != false) { + if (getServerData().vehicles[i].interior == interior && getServerData().vehicles[i].dimension == dimension) { + forcePlayerToSyncElementProperties(client, getServerData().vehicles[i].vehicle); + } + } + } +} + +// =========================================================================== + +function setPlayerBuyingVehicleState(client, state, vehicleId, position) { + if (getGlobalConfig().useServerSideVehiclePurchaseCheck == false) { + sendNetworkEventToPlayer("vrr.vehBuyState", client, state, vehicleId, position); + } +} + +// ========================================================================== + +function receiveVehiclePurchaseStateUpdateFromClient(client, state) { + if (getGlobalConfig().useServerSideVehiclePurchaseCheck == false) { + checkVehiclePurchasing(client); + } +} + +// =========================================================================== + +function sendPlayerLogLevel(client, tempLogLevel = logLevel) { + sendNetworkEventToPlayer("vrr.logLevel", client, tempLogLevel); +} + +// ========================================================================== + +function setPlayerInfiniteRun(client, state) { + sendNetworkEventToPlayer("vrr.infiniteRun", client, state); +} + +// ========================================================================== + +function sendBusinessToPlayer(client, businessId, name, entrancePosition, blipModel, pickupModel, hasInterior, hasItems) { + sendNetworkEventToPlayer("vrr.business", client, businessId, name, entrancePosition, blipModel, pickupModel, hasInterior, hasItems); +} + +// ========================================================================== + +function sendHouseToPlayer(client, houseId, description, entrancePosition, blipModel, pickupModel, hasInterior) { + sendNetworkEventToPlayer("vrr.house", client, houseId, description, entrancePosition, blipModel, pickupModel, hasInterior); +} + +// ========================================================================== + +function sendJobToPlayer(client, jobId, jobLocationId, name, position) { + sendNetworkEventToPlayer("vrr.job", client, jobId, jobLocationId, name, position); +} + +// ========================================================================== + +function sendVehicleToPlayer(client, vehicleId, model, position, heading, colour1, colour2, colour3, colour4) { + sendNetworkEventToPlayer("vrr.vehicle", client, vehicleId, model, position, heading, colour1, colour2, colour3, colour4); +} + +// ========================================================================== + +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); + } +} + +// ========================================================================== + +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); + } +} + +// ========================================================================== + +function sendAllJobsToPlayer(client) { + let jobs = getServerData().jobs; + for (let i in jobs) { + for (let j in jobs[i].locations) { + sendJobToPlayer(client, jobs[i].index, jobs[i].locations[j].index, jobs[i].name, jobs[i].locations[j].position, jobs[i].blipModel); + } + } +} + +// ========================================================================== + +function sendAllVehiclesToPlayer(client) { + let vehicles = getServerData().vehicles; + for (let i in vehicles) { + sendVehicleToPlayer(client, vehicles[i].index, vehicles[i].model, vehicles[i].syncPosition, vehicles[i].syncHeading, vehicles[i].colour1, vehicles[i].colour2, vehicles[i].colour3, vehicles[i].colour4); + } +} + +// ========================================================================== + +function makePlayerHoldObjectModel(client, modelIndex) { + sendNetworkEventToPlayer("vrr.holdObject", client, getPlayerData(client).ped, modelIndex); +} + +// ========================================================================== + +function receivePlayerPedNetworkId(client, pedId) { + getPlayerData(client).ped = pedId; +} + +// ========================================================================== + +function requestPlayerPedNetworkId(client) { + sendNetworkEventToPlayer("vrr.playerPedId", client); +} + +// ========================================================================== + +function setPlayerInCutsceneInterior(client, cutsceneName) { + getPlayerData(client).interiorCutscene = cutsceneName; + sendNetworkEventToPlayer("vrr.cutsceneInterior", client, cutsceneName); +} + +// ========================================================================== + +function makePlayerPedSpeak(client, pedSpeechName) { + sendNetworkEventToPlayer("vrr.pedSpeak", client, pedSpeechName); +} + +// ========================================================================== + +function setPlayerAsCopState(client, state) { + sendNetworkEventToPlayer("vrr.playerCop", client, state); +} + +// ========================================================================== + +function tellPlayerToSpawn(client, skinId, position) { + sendNetworkEventToPlayer("vrr.spawn", client, skinId, position); +} + +// ========================================================================== + +function sendNameTagDistanceToClient(client, distance) { + sendNetworkEventToPlayer("vrr.nameTagDistance", client, distance); +} + +// ========================================================================== + +function sendGPSBlipToPlayer(client, position, colour) { + sendNetworkEventToPlayer("vrr.showGPSBlip", client, position, colour); +} + +// ========================================================================== + +function playerSelectedNewLocale(client, localeId) { + getPlayerData(client).locale = localeId; + sendPlayerLocaleId(client, localeId); +} + +// ========================================================================== + +function sendPlayerLocaleId(client, localeId) { + sendNetworkEventToPlayer("vrr.locale", client, localeId); +} + +// ========================================================================== + +function showLocaleChooserForPlayer(client) { + sendNetworkEventToPlayer("vrr.localeChooser", client); +} + +// ========================================================================== + +function sendPlayerLocaleStrings(client) { + let strings = getGlobalConfig().locale.sendStringsToClient; + for (let i in strings) { + sendNetworkEventToPlayer("vrr.localeString", client, strings[i], getLocaleString(client, strings[i])); + } +} + +// ========================================================================== \ No newline at end of file From d8f5b04df25f46be9b881e978975dd9668a75181 Mon Sep 17 00:00:00 2001 From: Vortrex <3858226+VortrexFTW@users.noreply.github.com> Date: Mon, 19 Dec 2022 10:36:10 -0600 Subject: [PATCH 03/14] Update README.md --- README.md | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 0daecd31..11bb1a2e 100644 --- a/README.md +++ b/README.md @@ -6,13 +6,13 @@ This is Vortrex's Roleplay Resource ## Setup * Download the server from the [downloads page](https://gtaconnected.com/downloads) of the GTA Connected website. * Download this resource via git clone or directly from GitHub with the green zip download button. -* Add this resource as-is into a resource folder of your choice inside the resources directory of your server. I named my resource folder "gtac_roleplay" +* Add this resource as-is into a resource folder of your choice inside the resources directory of your server. * Add the resource to the server config. You should also disable a lot of the cvars in the config too. I only have traffic, civilians, planes, and bigmap enabled. * Download the required modules and add them to your server config. See list of modules below. * Import the database to your MySQL server, and edit database.json in the resource's config folder with the info to connect to the database. * (Optional) Edit the email SMTP connection info. Without this, the email features will be disabled. * Start the server and connect. Register your account, make a character, and disconnect. -* Edit your account in the database (get your account ID from the acct_main table and then edit the four entries in acct_svr for your account, changing acct_svr_staff_flags to negative 1 (-1) ... **you must not be connected to the server when doing this** +* Edit your account in the database (get your account ID from the acct_main table and then edit the four entries in acct_svr for your account, changing `acct_svr_staff_flags` to negative 1 (-1) ... **you must not be connected to the server when doing this** * You now have full admin. Enjoy the resource! ## Modules @@ -31,20 +31,20 @@ This is Vortrex's Roleplay Resource * Keep opening curly brackets in-line. Don't linebreak before an opening curly brackets. * Use sentence case instead of adjacent uppercase letters in class/member names. (i.e. Id instead of ID) * Use generic, non-specific class member names wherever possible. (i.e. databaseId instead of accountId) -* All communications from server to client are handled in server-side `client.js` script file via utils -* All communications from client to server are handled in client-side `server.js` script file via utils -* All server events are handled in `event.js` script file, sometimes with utils. +* All communications from server <-> client are handled in each side's `netevents.js` script files via utils +* All server and client events are handled in each side's `event.js` script files, sometimes with utils. ### Database Style -* Always use lowercase. -* Shorten prefix names to four characters or less (i.e. acct=account, veh=vehicle) +* Always use lowercase names for tables and fields +* Try to shorten prefix names to four characters or less (i.e. acct=account, veh=vehicle) * Add an underscore between each word * Append _main to any tables that store primary data (i.e. acct_main, ban_main, etc) * Prefix field names with the table name, except for _main tables (i.e. acct_id, job_loc_id) -* Tables use primary index on their ID column. -* Tables use both secondary indexes & cascading foreign key links to any ID that points to another table +* Tables use primary key on their ID column +* Tables use both secondary keys & cascading foreign key links to any ID that points to another table ### Notes * The resource is designed to load the script files first, then initialize after that's done. * The IDEAS.md file is not a to-do list. It's just a random file to throw ideas into when they come to mind. -* Bitwise values are used for several different aspects related to permissions. The value of -1 is **always** used as "*all flags*" for that set. +* Bitwise values are used for several different aspects, mostly related to permissions. +* Bitwise value of -1 is **always** used as "*all flags*" for that set. For admin permissions, -1 is god-tier admin level From 6f04a6e2dd558ecaca52649d29364f2dca01f39c Mon Sep 17 00:00:00 2001 From: Vortrex <3858226+VortrexFTW@users.noreply.github.com> Date: Mon, 23 Jan 2023 13:27:37 -0600 Subject: [PATCH 04/14] Update IDEAS.md --- IDEAS.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/IDEAS.md b/IDEAS.md index 5c4236f2..f53332d8 100644 --- a/IDEAS.md +++ b/IDEAS.md @@ -1,7 +1,7 @@ # Ideas **NOTICE: Most of these ideas are totally random and some might be unrealistic. Every time I thought of something, I just immediately threw it into this file. I never checked to see if I had already added it, so there may be duplicates or similar entries spread out and unorganized.** - +--- ### Businesses *Inspiration from GTA Online* * Nightclubs @@ -12,7 +12,7 @@ * Garages * Casinos --- -### Interactive peds with each one having a background story, characteristics, certain people or groups they like/dislike +### Interactive peds with each one having a background story, characteristics, certain people or groups they like/dislike *Inspiration from Skyrim and many other RPGs* * Procedurally generated? @@ -477,4 +477,4 @@ In-world indicator too, when player gets close and is in line of sight ### Item/Object pickup and move *Inspiration from the 3D Fallout games* -Fallout 3 and New Vegas have a neat feature where you can "grab" an object and fling it around while the key is pressed. Could be implemented for items in GTACRP servers \ No newline at end of file +Fallout 3 and New Vegas have a neat feature where you can "grab" an object and fling it around while the key is pressed. Could be implemented for items in GTACRP servers From 821257db344ff989d8ca2f482d36ef172a729a5c Mon Sep 17 00:00:00 2001 From: Vortrex <3858226+VortrexFTW@users.noreply.github.com> Date: Mon, 23 Jan 2023 13:27:57 -0600 Subject: [PATCH 05/14] Update IDEAS.md --- IDEAS.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/IDEAS.md b/IDEAS.md index f53332d8..893e22e3 100644 --- a/IDEAS.md +++ b/IDEAS.md @@ -2,8 +2,9 @@ **NOTICE: Most of these ideas are totally random and some might be unrealistic. Every time I thought of something, I just immediately threw it into this file. I never checked to see if I had already added it, so there may be duplicates or similar entries spread out and unorganized.** --- -### Businesses +### Businesses *Inspiration from GTA Online* + * Nightclubs * Executive Offices * Warehouses From 139bb780644d42f3aa9cc3c11abb425db25449e6 Mon Sep 17 00:00:00 2001 From: Vortrex <3858226+VortrexFTW@users.noreply.github.com> Date: Mon, 23 Jan 2023 13:32:20 -0600 Subject: [PATCH 06/14] Create COMMANDS.md --- COMMANDS.md | 194 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 194 insertions(+) create mode 100644 COMMANDS.md diff --git a/COMMANDS.md b/COMMANDS.md new file mode 100644 index 00000000..4e046cdb --- /dev/null +++ b/COMMANDS.md @@ -0,0 +1,194 @@ +## Player Commands + +### Account + * /login + * /register + * /changepass + * /setemail + * /verifyemail + +### Character + * /newchar /usechar /switchchar + * /autolastchar + +### Settings + * /logo + * /gui + * /lang + * /notips + * /loginalert + * /scrolllines + * /chatautohide + * /chatfilter + * /chatemoji + * /chattime + +### Chat + * /me + * /do + * /s + * /shout + * /talk + * /local + * /l + * /w + * /whisper + * /clanchat + * /clan + * /c + * /m + * /dm + * /reply + +### Items + * /i + * /item + * /pickup + * /=--drop + * /put + * /take + * /use + * /inv + * /inventory + * /items + * /houseitems + * /bizstorage + * /bizfloor + * /buylist + * /power + * /freq + * /radio + * /r + +### Vehicle + * /nearveh + * /oldveh + * /lastveh + * /oldcar + * /lastcar + * /engine + * /siren + * /lights + * /vehclan + * /vehbiz + * /vehrank + * /vehinfo + * /vehrent + * /vehrentprice + * /vehbuyprice + * /vehstoprent + * /vehbuy + * /vehcolour + * /vehlivery + * /vehrepair + * /passenger + +### Business + * /bizbuy + * /bizfee + * /biztill + * /bizbalance + * /bizwithdraw + * /bizdeposit + * /buy + * /bizstock + * /bizstore + * /bizorder + * /bizitemprice + * /bizname + * /bizowner + * /bizrank + * /bizclan + * /bizbuyprice + * /bizinfo + * /bizflooritems + * /bizstorageitems + * /bizdealership + * /bizpaintball + +### Clan + * /clans + * /clanchat + * /c + * /clanranks + * /clanflags + * /clanaddrank + * /clandelrank + * /clansetrank + * /clanowner + * /clantag + * /clanranktag + * /clanmembertag + * /clanrankname + * /clanranklevel + * /clanmembertitle + * /clanaddrankflag + * /clanrankflags + * /clandelrankflag + * /clanaddmemberflag + * /clandelmemberflag + +### House + * /houseinfo + * /housebuy + * /houseclan + * /houseowner + * /housebuyprice + * /houserentprice + +### Keybinds + * /bindkey + * /unbindkey + * /keybinds + +### Misc + * /idea + * /bug + * /pos + * /enter + * /cursor + * /yes + * /no + * /help + * /suicide + * /lights + * /lock + * /admins + * /mousecam + * /cursor + * /speak + * /gps + * /stuck + +### Job + * /takejob + * /startwork + * /stopwork + * /startjob + * /stopjob + * /quitjob + * /uniform + * /equip + * /department + * /d + * /fare + * /detain + * /drag + * /search + * /startroute + * /stoproute + * /jobinfo + * /joblocinfo + +### Animation + * /anim + * /an + * /e + * /anims + * /animlist + * /stopanim + +### Radio + * /radiostation + * /radiostations + * /radiovolume From 761e6d00efeac935438e872210a1a477c131fccd Mon Sep 17 00:00:00 2001 From: Vortrex <3858226+VortrexFTW@users.noreply.github.com> Date: Sat, 28 Jan 2023 10:39:29 -0600 Subject: [PATCH 07/14] Update README.md --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index 11bb1a2e..f1543572 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,7 @@ This is Vortrex's Roleplay Resource * Add the resource to the server config. You should also disable a lot of the cvars in the config too. I only have traffic, civilians, planes, and bigmap enabled. * Download the required modules and add them to your server config. See list of modules below. * Import the database to your MySQL server, and edit database.json in the resource's config folder with the info to connect to the database. +* Edit `svr_main` table, and set the `svr_game` and `svr_port` to your server's info. Game ID numbers are found [here](https://wiki.gtaconnected.com/GameIdentifiers) * (Optional) Edit the email SMTP connection info. Without this, the email features will be disabled. * Start the server and connect. Register your account, make a character, and disconnect. * Edit your account in the database (get your account ID from the acct_main table and then edit the four entries in acct_svr for your account, changing `acct_svr_staff_flags` to negative 1 (-1) ... **you must not be connected to the server when doing this** @@ -42,9 +43,11 @@ This is Vortrex's Roleplay Resource * Prefix field names with the table name, except for _main tables (i.e. acct_id, job_loc_id) * Tables use primary key on their ID column * Tables use both secondary keys & cascading foreign key links to any ID that points to another table +* Prefix table names with func_ if they are a custom function or procedure ### Notes * The resource is designed to load the script files first, then initialize after that's done. +* The resource is designed to run on multiple servers. Each server needs a row in `svr_main` table with matching port and [game ID](https://wiki.gtaconnected.com/GameIdentifiers) * The IDEAS.md file is not a to-do list. It's just a random file to throw ideas into when they come to mind. * Bitwise values are used for several different aspects, mostly related to permissions. * Bitwise value of -1 is **always** used as "*all flags*" for that set. For admin permissions, -1 is god-tier admin level From 44b625cc296e5f88a52ce4447580377c72f217f0 Mon Sep 17 00:00:00 2001 From: Vortrex <3858226+VortrexFTW@users.noreply.github.com> Date: Sat, 28 Jan 2023 10:44:30 -0600 Subject: [PATCH 08/14] Update README.md --- README.md | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index f1543572..3ae14123 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,13 @@ ### Description This is Vortrex's Roleplay Resource +### Supported Games and Multiplayer Mods +* GTA III (on [GTA Connected](https://gtaconnected.com/)) +* GTA VC (on [GTA Connected](https://gtaconnected.com/)) +* GTA SA (on [GTA Connected](https://gtaconnected.com/)) +* GTA IV (on [GTA Connected](https://gtaconnected.com/)) +* Mafia: The City of Lost Heaven (on [Mafia Connected](https://mafiaconnected.com/)) + ## Setup * Download the server from the [downloads page](https://gtaconnected.com/downloads) of the GTA Connected website. * Download this resource via git clone or directly from GitHub with the green zip download button. @@ -10,7 +17,7 @@ This is Vortrex's Roleplay Resource * Add the resource to the server config. You should also disable a lot of the cvars in the config too. I only have traffic, civilians, planes, and bigmap enabled. * Download the required modules and add them to your server config. See list of modules below. * Import the database to your MySQL server, and edit database.json in the resource's config folder with the info to connect to the database. -* Edit `svr_main` table, and set the `svr_game` and `svr_port` to your server's info. Game ID numbers are found [here](https://wiki.gtaconnected.com/GameIdentifiers) +* Edit `svr_main` table, and set the `svr_game` and `svr_port` to your server's info. Game ID numbers are [here](https://wiki.gtaconnected.com/GameIdentifiers) * (Optional) Edit the email SMTP connection info. Without this, the email features will be disabled. * Start the server and connect. Register your account, make a character, and disconnect. * Edit your account in the database (get your account ID from the acct_main table and then edit the four entries in acct_svr for your account, changing `acct_svr_staff_flags` to negative 1 (-1) ... **you must not be connected to the server when doing this** From 6a5baf53d4bc55fc166021644071029a61370eac Mon Sep 17 00:00:00 2001 From: Vortrex <3858226+VortrexFTW@users.noreply.github.com> Date: Tue, 7 Feb 2023 15:10:17 -0600 Subject: [PATCH 09/14] Fix db defaults --- database.sql | 50 +++++++++++++++++++++++++------------------------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/database.sql b/database.sql index 800381b5..c9a2f316 100644 --- a/database.sql +++ b/database.sql @@ -358,7 +358,7 @@ CREATE TABLE IF NOT EXISTS `biz_main` ( `biz_till` int(11) NOT NULL DEFAULT '0', `biz_entrance_fee` int(11) NOT NULL DEFAULT '0', `biz_deleted` tinyint(1) NOT NULL DEFAULT '0', - `biz_who_deleted` int(11) NOT NULL DEFAULT '479', + `biz_who_deleted` int(11) NOT NULL DEFAULT '1', `biz_when_deleted` bigint(20) NOT NULL DEFAULT '0', `biz_has_interior` tinyint(1) NOT NULL DEFAULT '0', `biz_interior_lights` tinyint(4) NOT NULL DEFAULT '1', @@ -420,9 +420,9 @@ CREATE TABLE IF NOT EXISTS `clan_main` ( `clan_owner` int(11) NOT NULL DEFAULT '0', `clan_created` int(11) NOT NULL DEFAULT '0', `clan_deleted` tinyint(4) NOT NULL DEFAULT '0', - `clan_who_deleted` int(11) NOT NULL DEFAULT '479', + `clan_who_deleted` int(11) NOT NULL DEFAULT '1', `clan_when_deleted` bigint(20) NOT NULL DEFAULT '0', - `clan_who_added` int(11) NOT NULL DEFAULT '479', + `clan_who_added` int(11) NOT NULL DEFAULT '1', `clan_when_added` bigint(20) NOT NULL DEFAULT '0', `clan_motd` varchar(128) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', `clan_col_r` int(11) NOT NULL DEFAULT '255', @@ -634,7 +634,7 @@ CREATE TABLE IF NOT EXISTS `house_main` ( `house_custom_interior` tinyint(4) NOT NULL DEFAULT '0', `house_deleted` tinyint(4) NOT NULL DEFAULT '0', `house_when_deleted` bigint(20) NOT NULL DEFAULT '0', - `house_who_deleted` int(11) NOT NULL DEFAULT '479', + `house_who_deleted` int(11) NOT NULL DEFAULT '1', `house_tax_exempt` tinyint(4) NOT NULL DEFAULT '0', `house_radio_station` int(11) NOT NULL DEFAULT '0', PRIMARY KEY (`house_id`) USING BTREE, @@ -793,9 +793,9 @@ CREATE TABLE IF NOT EXISTS `item_main` ( `item_value` int(11) NOT NULL DEFAULT '0', `item_enabled` tinyint(4) NOT NULL DEFAULT '0', `item_deleted` tinyint(4) NOT NULL DEFAULT '0', - `item_who_deleted` int(11) NOT NULL DEFAULT '479', + `item_who_deleted` int(11) NOT NULL DEFAULT '1', `item_when_deleted` bigint(20) NOT NULL DEFAULT '0', - `item_who_added` int(11) NOT NULL DEFAULT '479', + `item_who_added` int(11) NOT NULL DEFAULT '1', `item_when_added` bigint(20) NOT NULL DEFAULT '0', PRIMARY KEY (`item_id`), KEY `item_server` (`item_server`), @@ -855,9 +855,9 @@ CREATE TABLE IF NOT EXISTS `item_type` ( `item_type_anim_put` varchar(64) COLLATE utf8_unicode_ci NOT NULL DEFAULT 'none', `item_type_anim_pickup` varchar(64) COLLATE utf8_unicode_ci NOT NULL DEFAULT 'none', `item_type_deleted` tinyint(4) NOT NULL DEFAULT '0', - `item_type_who_deleted` int(11) NOT NULL DEFAULT '479', + `item_type_who_deleted` int(11) NOT NULL DEFAULT '1', `item_type_when_deleted` bigint(20) NOT NULL DEFAULT '0', - `item_type_who_added` int(11) NOT NULL DEFAULT '479', + `item_type_who_added` int(11) NOT NULL DEFAULT '1', `item_type_when_added` bigint(20) NOT NULL DEFAULT '0', PRIMARY KEY (`item_type_id`), KEY `item_type_server` (`item_type_server`), @@ -2307,9 +2307,9 @@ CREATE TABLE IF NOT EXISTS `job_equip` ( `job_equip_name` varchar(50) COLLATE utf8_unicode_ci NOT NULL DEFAULT '0', `job_equip_enabled` tinyint(1) NOT NULL DEFAULT '1', `job_equip_deleted` tinyint(1) NOT NULL DEFAULT '1', - `job_equip_who_deleted` int(11) NOT NULL DEFAULT '479', + `job_equip_who_deleted` int(11) NOT NULL DEFAULT '1', `job_equip_when_deleted` bigint(20) NOT NULL DEFAULT '0', - `job_equip_who_added` int(11) NOT NULL DEFAULT '479', + `job_equip_who_added` int(11) NOT NULL DEFAULT '1', `job_equip_when_added` bigint(20) NOT NULL DEFAULT '0', PRIMARY KEY (`job_equip_id`), KEY `job_equip_job` (`job_equip_job`), @@ -2330,9 +2330,9 @@ CREATE TABLE IF NOT EXISTS `job_equip_item` ( `job_equip_item_value` int(11) NOT NULL DEFAULT '0', `job_equip_item_enabled` tinyint(1) NOT NULL DEFAULT '1', `job_equip_item_deleted` tinyint(1) NOT NULL DEFAULT '0', - `job_equip_item_who_deleted` int(11) NOT NULL DEFAULT '479', + `job_equip_item_who_deleted` int(11) NOT NULL DEFAULT '1', `job_equip_item_when_deleted` bigint(20) NOT NULL DEFAULT '0', - `job_equip_item_who_added` int(11) NOT NULL DEFAULT '479', + `job_equip_item_who_added` int(11) NOT NULL DEFAULT '1', `job_equip_item_when_added` bigint(20) NOT NULL DEFAULT '0', PRIMARY KEY (`job_equip_item_id`) USING BTREE, KEY `job_equip_item_equip` (`job_equip_item_equip`), @@ -2360,9 +2360,9 @@ CREATE TABLE IF NOT EXISTS `job_loc` ( `job_loc_vw` int(11) NOT NULL DEFAULT '0', `job_loc_name` varchar(64) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', `job_loc_deleted` tinyint(4) NOT NULL DEFAULT '0', - `job_loc_who_deleted` int(11) NOT NULL DEFAULT '479', + `job_loc_who_deleted` int(11) NOT NULL DEFAULT '1', `job_loc_when_deleted` bigint(20) NOT NULL DEFAULT '0', - `job_loc_who_added` int(11) NOT NULL DEFAULT '479', + `job_loc_who_added` int(11) NOT NULL DEFAULT '1', `job_loc_when_added` bigint(20) NOT NULL DEFAULT '0', PRIMARY KEY (`job_loc_id`), KEY `job_loc_job` (`job_loc_job`), @@ -2394,9 +2394,9 @@ CREATE TABLE IF NOT EXISTS `job_main` ( `job_wl` tinyint(4) NOT NULL DEFAULT '0', `job_bl` tinyint(4) NOT NULL DEFAULT '0', `job_deleted` tinyint(4) NOT NULL DEFAULT '0', - `job_who_deleted` int(11) NOT NULL DEFAULT '479', + `job_who_deleted` int(11) NOT NULL DEFAULT '1', `job_when_deleted` bigint(20) NOT NULL DEFAULT '0', - `job_who_added` int(11) NOT NULL DEFAULT '479', + `job_who_added` int(11) NOT NULL DEFAULT '1', `job_when_added` bigint(20) NOT NULL DEFAULT '0', PRIMARY KEY (`job_id`), KEY `job_server` (`job_server`), @@ -2421,9 +2421,9 @@ CREATE TABLE IF NOT EXISTS `job_rank` ( `job_rank_flags` int(11) NOT NULL DEFAULT '0', `job_rank_pay` int(11) NOT NULL DEFAULT '0', `job_rank_deleted` int(11) NOT NULL DEFAULT '0', - `job_rank_who_deleted` int(11) NOT NULL DEFAULT '479', + `job_rank_who_deleted` int(11) NOT NULL DEFAULT '1', `job_rank_when_deleted` bigint(20) NOT NULL DEFAULT '0', - `job_rank_who_added` int(11) NOT NULL DEFAULT '479', + `job_rank_who_added` int(11) NOT NULL DEFAULT '1', `job_rank_when_added` bigint(20) NOT NULL DEFAULT '0', PRIMARY KEY (`job_rank_id`), KEY `fk_job_rank_job` (`job_rank_job`), @@ -2452,9 +2452,9 @@ CREATE TABLE IF NOT EXISTS `job_route` ( `job_route_pay` int(11) NOT NULL DEFAULT '0', `job_route_enabled` tinyint(4) NOT NULL DEFAULT '1', `job_route_deleted` tinyint(4) NOT NULL DEFAULT '0', - `job_route_who_deleted` int(11) NOT NULL DEFAULT '479', + `job_route_who_deleted` int(11) NOT NULL DEFAULT '1', `job_route_when_deleted` bigint(20) NOT NULL DEFAULT '0', - `job_route_who_added` int(11) NOT NULL DEFAULT '479', + `job_route_who_added` int(11) NOT NULL DEFAULT '1', `job_route_when_added` bigint(20) NOT NULL DEFAULT '0', PRIMARY KEY (`job_route_id`), KEY `fk_job_route_job` (`job_route_job`), @@ -2481,9 +2481,9 @@ CREATE TABLE IF NOT EXISTS `job_route_loc` ( `job_route_loc_delay` int(11) NOT NULL DEFAULT '0', `job_route_loc_pay` int(11) NOT NULL DEFAULT '0', `job_route_loc_deleted` tinyint(4) NOT NULL DEFAULT '0', - `job_route_loc_who_deleted` int(11) NOT NULL DEFAULT '479', + `job_route_loc_who_deleted` int(11) NOT NULL DEFAULT '1', `job_route_loc_when_deleted` bigint(20) NOT NULL DEFAULT '0', - `job_route_loc_who_added` int(11) NOT NULL DEFAULT '479', + `job_route_loc_who_added` int(11) NOT NULL DEFAULT '1', `job_route_loc_when_added` bigint(20) NOT NULL DEFAULT '0', `job_route_loc_goto_msg` varchar(128) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', `job_route_loc_arrive_msg` varchar(128) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', @@ -2507,9 +2507,9 @@ CREATE TABLE IF NOT EXISTS `job_uniform` ( `job_uniform_minrank` int(11) NOT NULL DEFAULT '0', `job_uniform_name` varchar(50) COLLATE utf8_unicode_ci NOT NULL DEFAULT 'Unnamed', `job_uniform_deleted` tinyint(4) NOT NULL DEFAULT '0', - `job_uniform_who_deleted` int(11) NOT NULL DEFAULT '479', + `job_uniform_who_deleted` int(11) NOT NULL DEFAULT '1', `job_uniform_when_deleted` bigint(20) NOT NULL DEFAULT '0', - `job_uniform_who_added` int(11) NOT NULL DEFAULT '479', + `job_uniform_who_added` int(11) NOT NULL DEFAULT '1', `job_uniform_when_added` bigint(20) NOT NULL DEFAULT '0', PRIMARY KEY (`job_uniform_id`), KEY `job_uniform_job` (`job_uniform_job`), @@ -3119,7 +3119,7 @@ CREATE TABLE IF NOT EXISTS `veh_main` ( `veh_ins_acct` tinyint(1) NOT NULL DEFAULT '0', `veh_price` int(11) NOT NULL DEFAULT '0', `veh_deleted` tinyint(1) NOT NULL DEFAULT '0', - `veh_who_deleted` int(11) NOT NULL DEFAULT '479', + `veh_who_deleted` int(11) NOT NULL DEFAULT '1', `veh_when_deleted` bigint(20) NOT NULL DEFAULT '0', `veh_flags` int(11) NOT NULL DEFAULT '0', `veh_spawn_lock` tinyint(1) NOT NULL DEFAULT '0', From 30120d0640845276d1349d780052c47c0df93eba Mon Sep 17 00:00:00 2001 From: Vortrex <3858226+VortrexFTW@users.noreply.github.com> Date: Tue, 7 Feb 2023 15:10:23 -0600 Subject: [PATCH 10/14] Rename --- meta.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meta.xml b/meta.xml index 1ca42fd2..a61384ee 100644 --- a/meta.xml +++ b/meta.xml @@ -1,5 +1,5 @@ - +