diff --git a/.gitignore b/.gitignore
index 287764c4..9c1d929d 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,3 +3,5 @@
*.code-workspace
config/database.json
config/email.json
+config/discord.json
+locale/*
diff --git a/IDEAS.md b/IDEAS.md
index 555d241a..5375c289 100644
--- a/IDEAS.md
+++ b/IDEAS.md
@@ -373,4 +373,9 @@ Obviously this would still be using slashes for commands still. The way this wor
* Take item from vehicle trunk (grab crate from vehicle)
* Place item on ground (crate)
* Take second beer from crate
- * Store second beer in trunk
\ No newline at end of file
+ * Store second beer in trunk
+---
+### Animation/emote, action, and message menu wheels
+So with new Steam Deck being available now, and all the other attempts to use mobile devices that either emulate or stream the older GTA PC games, I figure we'd need a way for players to interact with each other using them. Roleplay is usually a very chat-oriented gamemode, but I can probably make things easier with simple controls. Also customizable messages, animations, and actions for each menu/wheel slot
+The inventory system is already planned to use a hotbar/wheel but I don't have all the images for it yet
+---
\ No newline at end of file
diff --git a/TODO.md b/TODO.md
index d07c17b1..d08be4d1 100644
--- a/TODO.md
+++ b/TODO.md
@@ -1,5 +1,23 @@
-* Finish auto-translate
-* Add /autotranslate to enable/disable automatic chat translations for all languages, or specific ones by short code (RU, ES, etc)
-* Finish working on the new job route system
+== TODO
+* Finish auto-translator
* Add ways to acquire drugs. Pot/coke plants, meth labs, etc
-* Finish setting up the persistent NPC system
\ No newline at end of file
+* Finish setting up the persistent NPC system
+* Add yes/no prompts for some important things like
+ * (Business owner) Setting item sell price below order price. Will result in losing money.
+ * Giving house, biz, or vehicle to clan. Clan leaders can revoke permissions and you may be screwed and not able to change it!
+ * Deleting character
+* Make game messages (big message, small message) into array of types
+ * Array of message types in shared
+ * Font, text, duration, etc arrays in client, indexed by type
+* Fix the item take/put system for items in vehicle trunks, other items, etc
+---
+== Planned Features
+* Named and scripted NPCs
+* Racing
+* Fishing
+* Stock Market
+* Mapped interiors for GTA 3
+* Drug growing/manufacturing
+---
+== Bug Fixes
+* Check natives for if player is console (getPlayerPosition, etc)
\ No newline at end of file
diff --git a/config/accents.json b/config/accents.json
index 2b5cb10f..63d53c11 100644
--- a/config/accents.json
+++ b/config/accents.json
@@ -22,5 +22,6 @@
"Estonian",
"Sicilian",
"Indian",
- "Rough"
+ "Rough",
+ "Swedish"
]
\ No newline at end of file
diff --git a/config/client/locale.json b/config/client/locale.json
new file mode 100644
index 00000000..62caa2db
--- /dev/null
+++ b/config/client/locale.json
@@ -0,0 +1,112 @@
+[
+ {
+ "id": 0,
+ "englishName": "English",
+ "stringsFile": "english.json",
+ "isoCode": "en",
+ "flagImageFile": "uk.png",
+ "countries": ["gb", "us", "au", "bz", "ca", "ie", "jm", "nz", "za", "tt"],
+ "requiresUnicode": false,
+ "contributor": "Vortrex"
+ },
+ {
+ "id": 1,
+ "englishName": "Russian",
+ "stringsFile": "russian.json",
+ "isoCode": "ru",
+ "flagImageFile": "ru.png",
+ "countries": ["ru", "ua"],
+ "requiresUnicode": false,
+ "contributor": "VNDTTS"
+ },
+ {
+ "id": 2,
+ "englishName": "Polish",
+ "stringsFile": "polish.json",
+ "isoCode": "pl",
+ "flagImageFile": "pl.png",
+ "countries": ["pl"],
+ "requiresUnicode": false,
+ "contributor": "Suprise444"
+ },
+ {
+ "id": 3,
+ "englishName": "Spanish",
+ "stringsFile": "spanish.json",
+ "isoCode": "es",
+ "flagImageFile": "es.png",
+ "countries": ["es", "ar", "bo", "cl", "co", "cr", "do", "ec", "sv", "gt", "hn", "mx", "ni", "pa", "py", "pe", "pr", "uy", "ve"],
+ "requiresUnicode": false,
+ "contributor": "PerikiyoXD"
+ },
+ {
+ "id": 4,
+ "englishName": "Chinese",
+ "stringsFile": "chinese.json",
+ "isoCode": "zh",
+ "flagImageFile": "cn.png",
+ "countries": ["cn", "hk", "sg", "tw"],
+ "requiresUnicode": true,
+ "contributor": "Renzuko_Ctone"
+ },
+ {
+ "id": 5,
+ "englishName": "Arabic",
+ "stringsFile": "arabic.json",
+ "isoCode": "ar",
+ "flagImageFile": "sa.png",
+ "countries": ["dz", "bh", "eg", "iq", "jo", "kw", "lb", "ly", "ma", "om", "qa", "sa", "sy", "tn", "ae", "ye"],
+ "requiresUnicode": true,
+ "contributor": "! KASIR"
+ },
+ {
+ "id": 6,
+ "englishName": "Slovak",
+ "stringsFile": "slovak.json",
+ "isoCode": "sk",
+ "flagImageFile": "sk.png",
+ "countries": ["sk"],
+ "requiresUnicode": false,
+ "contributor": "UAKLAUS"
+ },
+ {
+ "id": 7,
+ "englishName": "German",
+ "stringsFile": "german.json",
+ "isoCode": "de",
+ "flagImageFile": "de.png",
+ "countries": ["de", "at", "be", "ch", "li", "lu"],
+ "requiresUnicode": false,
+ "contributor": "Sladernimo"
+ },
+ {
+ "id": 8,
+ "englishName": "French",
+ "stringsFile": "french.json",
+ "isoCode": "fr",
+ "flagImageFile": "fr.png",
+ "countries": ["fr", "cd", "bj", "bf", "cd", "cg", "ga", "gn", "ml", "mc", "ne", "sn"],
+ "requiresUnicode": false,
+ "contributor": "Cocam"
+ },
+ {
+ "id": 9,
+ "englishName": "Japanese",
+ "stringsFile": "japanese.json",
+ "isoCode": "jp",
+ "flagImageFile": "jp.png",
+ "countries": ["jp"],
+ "requiresUnicode": true,
+ "contributor": "Cocam"
+ },
+ {
+ "id": 10,
+ "englishName": "Finnish",
+ "stringsFile": "finnish.json",
+ "isoCode": "fi",
+ "flagImageFile": "fi.png",
+ "countries": ["fi"],
+ "requiresUnicode": false,
+ "contributor": "SIMBA_MEOW"
+ }
+]
\ No newline at end of file
diff --git a/config/database.json b/config/database.json
deleted file mode 100644
index dd077d6d..00000000
--- a/config/database.json
+++ /dev/null
@@ -1,8 +0,0 @@
-{
- "host": "localhost",
- "user": "",
- "pass": "",
- "name": "",
- "port": 3306,
- "usePersistentConnection": true
-}
\ No newline at end of file
diff --git a/config/discord.json b/config/discord.json
new file mode 100644
index 00000000..3fe219f5
--- /dev/null
+++ b/config/discord.json
@@ -0,0 +1,13 @@
+{
+ "sendChat": false,
+ "sendEvents": false,
+ "sendConnectEvents": false,
+ "sendVehicleEvents": false,
+ "sendDeathEvents": false,
+ "sendAdmin": false,
+ "webhook": {
+ "enabled": false,
+ "webhookBaseURL": "http://127.0.0.1:8090/discord.php?message={0}&server={1}&type={2}&pass={3}",
+ "pass": "LWb7T3ZyCam7Nzen"
+ }
+}
\ No newline at end of file
diff --git a/config/email.json b/config/email.json
deleted file mode 100644
index 224bdb3d..00000000
--- a/config/email.json
+++ /dev/null
@@ -1,22 +0,0 @@
-{
- "enabled": "false",
- "smtp": {
- "host":"",
- "port":"",
- "username":"",
- "password":"",
- "from":"",
- "fromName":"",
- "useTLS":"true"
- },
- "bodyContent": {
- "confirmEmail": "Welcome to {SERVERNAME}!\nPlease confirm your email by using the command /verifyemail in-game.\n\nYour verification code is: {VERIFICATIONCODE}",
- "emailConfirmed": "Your email has been confirmed on {SERVERNAME}!\nYou may now use this email to reset your password, require two-factor authentication on login, receive offline notifications, and more!",
- "twoFactorAuthentication": "Please enter the following code to continue on {SERVERNAME} for {GAMENAME}: {2FACODE}",
- "accountAuthSuccessAlert": "You or someone else has successfully logged in to your account on {SERVERNAME} for {GAMENAME}.\n\nIP Address: {IPADDRESS}\nLocation: {LOCATION}\nTimestamp: {TIMESTAMP}\n\nIf you have two-factor authentication enabled (Using /2fa in-game), your account can't be accessed unless a correct 2FA code is entered.",
- "accountAuthFailAlert": "You or someone else has failed to login to your account on {SERVERNAME} for {GAMENAME}.\nIP Address: {IPADDRESS}\nLocation: {LOCATION}\nTimestamp: {TIMESTAMP}",
- "offlineMessageAlert": "You have received a private message on {SERVERNAME} for {GAMENAME}. \nYou are receiving this notification because you enabled email message notifications when you're not connected to the server.\nFrom: {FROMNAME}\nTimestamp: {TIMESTAMP}\nMessage: {MESSAGE}",
- "confirmPasswordReset": "You (or someone else) requested to reset your password on {SERVERNAME}!\nPlease confirm this request by entering the code below into the password reset window in-game.\n\nYour verification code is: {VERIFICATIONCODE}\n\n\nIf you did not request a password reset, then there's nothing to worry about since your password can only be reset with the code above.",
- "passwordChanged": "Your password on {SERVERNAME} has been changed successfully!"
- }
-}
\ No newline at end of file
diff --git a/config/locale.json b/config/locale.json
index 3eccf479..5a68a5de 100644
--- a/config/locale.json
+++ b/config/locale.json
@@ -1,10 +1,117 @@
{
"apiEmail": "example@example.com",
- "defaultLanguage": "en",
+ "defaultLanguageId": 0,
+ "translateURL": "http://api.mymemory.translated.net/get?de={3}&q={0}&langpair={1}|{2}",
"locales": [
- ["English", "english", "en"],
- ["Russian", "russian", "ru"],
- ["Polish", "polish", "pl"],
- ["Spanish", "spanish", "es"]
+ {
+ "id": 0,
+ "englishName": "English",
+ "stringsFile": "english.json",
+ "isoCode": "en",
+ "flagImageFile": "uk.png",
+ "countries": ["gb", "us", "au", "bz", "ca", "ie", "jm", "nz", "za", "tt"],
+ "requiresUnicode": false,
+ "contributor": "Vortrex"
+ },
+ {
+ "id": 1,
+ "englishName": "Russian",
+ "stringsFile": "russian.json",
+ "isoCode": "ru",
+ "flagImageFile": "ru.png",
+ "countries": ["ru", "ua"],
+ "requiresUnicode": false,
+ "contributor": "VNDTTS"
+ },
+ {
+ "id": 2,
+ "englishName": "Polish",
+ "stringsFile": "polish.json",
+ "isoCode": "pl",
+ "flagImageFile": "pl.png",
+ "countries": ["pl"],
+ "requiresUnicode": false,
+ "contributor": "Suprise444"
+ },
+ {
+ "id": 3,
+ "englishName": "Spanish",
+ "stringsFile": "spanish.json",
+ "isoCode": "es",
+ "flagImageFile": "es.png",
+ "countries": ["es", "ar", "bo", "cl", "co", "cr", "do", "ec", "sv", "gt", "hn", "mx", "ni", "pa", "py", "pe", "pr", "uy", "ve"],
+ "requiresUnicode": false,
+ "contributor": "PerikiyoXD"
+ },
+ {
+ "id": 4,
+ "englishName": "Chinese",
+ "stringsFile": "chinese.json",
+ "isoCode": "zh",
+ "flagImageFile": "cn.png",
+ "countries": ["cn", "hk", "sg", "tw"],
+ "requiresUnicode": true,
+ "contributor": "Renzuko_Ctone"
+ },
+ {
+ "id": 5,
+ "englishName": "Arabic",
+ "stringsFile": "arabic.json",
+ "isoCode": "ar",
+ "flagImageFile": "sa.png",
+ "countries": ["dz", "bh", "eg", "iq", "jo", "kw", "lb", "ly", "ma", "om", "qa", "sa", "sy", "tn", "ae", "ye"],
+ "requiresUnicode": true,
+ "contributor": "! KASIR"
+ },
+ {
+ "id": 6,
+ "englishName": "Slovak",
+ "stringsFile": "slovak.json",
+ "isoCode": "sk",
+ "flagImageFile": "sk.png",
+ "countries": ["sk"],
+ "requiresUnicode": false,
+ "contributor": "UAKLAUS"
+ },
+ {
+ "id": 7,
+ "englishName": "German",
+ "stringsFile": "german.json",
+ "isoCode": "de",
+ "flagImageFile": "de.png",
+ "countries": ["de", "at", "be", "ch", "li", "lu"],
+ "requiresUnicode": false,
+ "contributor": "Sladernimo"
+ },
+ {
+ "id": 8,
+ "englishName": "French",
+ "stringsFile": "french.json",
+ "isoCode": "fr",
+ "flagImageFile": "fr.png",
+ "countries": ["fr", "cd", "bj", "bf", "cd", "cg", "ga", "gn", "ml", "mc", "ne", "sn"],
+ "requiresUnicode": false,
+ "contributor": "Cocam"
+ },
+ {
+ "id": 9,
+ "englishName": "Japanese",
+ "stringsFile": "japanese.json",
+ "isoCode": "jp",
+ "flagImageFile": "jp.png",
+ "countries": ["jp"],
+ "requiresUnicode": true,
+ "contributor": "Cocam"
+ },
+ {
+ "id": 10,
+ "englishName": "Finnish",
+ "stringsFile": "finnish.json",
+ "isoCode": "fi",
+ "flagImageFile": "fi.png",
+ "countries": ["fi"],
+ "requiresUnicode": false,
+ "contributor": "SIMBA_MEOW"
+ }
]
}
\ No newline at end of file
diff --git a/documentation/gtac/client/gtaiv/Commands.xml b/documentation/gtac/client/gtaiv/Commands.xml
new file mode 100644
index 00000000..ca9a127e
--- /dev/null
+++ b/documentation/gtac/client/gtaiv/Commands.xml
@@ -0,0 +1,18 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/documentation/gtac/client/gtaiv/Defines.xml b/documentation/gtac/client/gtaiv/Defines.xml
new file mode 100644
index 00000000..24c48ded
--- /dev/null
+++ b/documentation/gtac/client/gtaiv/Defines.xml
@@ -0,0 +1,3542 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/documentation/gtac/client/gtaiv/Documentation.xml b/documentation/gtac/client/gtaiv/Documentation.xml
new file mode 100644
index 00000000..0cd15ac2
--- /dev/null
+++ b/documentation/gtac/client/gtaiv/Documentation.xml
@@ -0,0 +1,3159 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/documentation/gtac/client/gtaiv/EventTypes.xml b/documentation/gtac/client/gtaiv/EventTypes.xml
new file mode 100644
index 00000000..7f447490
--- /dev/null
+++ b/documentation/gtac/client/gtaiv/EventTypes.xml
@@ -0,0 +1,95 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/documentation/gtac/server/Commands.xml b/documentation/gtac/server/Commands.xml
new file mode 100644
index 00000000..9d51e79b
--- /dev/null
+++ b/documentation/gtac/server/Commands.xml
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/documentation/gtac/server/Defines.xml b/documentation/gtac/server/Defines.xml
new file mode 100644
index 00000000..f60fdcec
--- /dev/null
+++ b/documentation/gtac/server/Defines.xml
@@ -0,0 +1,1671 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/documentation/gtac/server/Documentation.xml b/documentation/gtac/server/Documentation.xml
new file mode 100644
index 00000000..7df381ed
--- /dev/null
+++ b/documentation/gtac/server/Documentation.xml
@@ -0,0 +1,439 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/documentation/gtac/server/EventTypes.xml b/documentation/gtac/server/EventTypes.xml
new file mode 100644
index 00000000..8de2c651
--- /dev/null
+++ b/documentation/gtac/server/EventTypes.xml
@@ -0,0 +1,47 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/documentation/mafiac/client/mafia1/Commands.xml b/documentation/mafiac/client/mafia1/Commands.xml
new file mode 100644
index 00000000..e255010a
--- /dev/null
+++ b/documentation/mafiac/client/mafia1/Commands.xml
@@ -0,0 +1,18 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/documentation/mafiac/client/mafia1/Defines.xml b/documentation/mafiac/client/mafia1/Defines.xml
new file mode 100644
index 00000000..4d559fa9
--- /dev/null
+++ b/documentation/mafiac/client/mafia1/Defines.xml
@@ -0,0 +1,577 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/documentation/mafiac/client/mafia1/Documentation.xml b/documentation/mafiac/client/mafia1/Documentation.xml
new file mode 100644
index 00000000..6a1303f5
--- /dev/null
+++ b/documentation/mafiac/client/mafia1/Documentation.xml
@@ -0,0 +1,459 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/documentation/mafiac/client/mafia1/EventTypes.xml b/documentation/mafiac/client/mafia1/EventTypes.xml
new file mode 100644
index 00000000..ea29b084
--- /dev/null
+++ b/documentation/mafiac/client/mafia1/EventTypes.xml
@@ -0,0 +1,103 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/documentation/mafiac/server/Commands.xml b/documentation/mafiac/server/Commands.xml
new file mode 100644
index 00000000..a1be49df
--- /dev/null
+++ b/documentation/mafiac/server/Commands.xml
@@ -0,0 +1,399 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/documentation/mafiac/server/Defines.xml b/documentation/mafiac/server/Defines.xml
new file mode 100644
index 00000000..7ae0532e
--- /dev/null
+++ b/documentation/mafiac/server/Defines.xml
@@ -0,0 +1,545 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/documentation/mafiac/server/Documentation.xml b/documentation/mafiac/server/Documentation.xml
new file mode 100644
index 00000000..32fc0abb
--- /dev/null
+++ b/documentation/mafiac/server/Documentation.xml
@@ -0,0 +1,424 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/documentation/mafiac/server/EventTypes.xml b/documentation/mafiac/server/EventTypes.xml
new file mode 100644
index 00000000..17bcf503
--- /dev/null
+++ b/documentation/mafiac/server/EventTypes.xml
@@ -0,0 +1,43 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/files/images/asshat-logo.png b/files/images/asshat-logo.png
new file mode 100644
index 00000000..0ac65cb9
Binary files /dev/null and b/files/images/asshat-logo.png differ
diff --git a/files/images/flags/cn.png b/files/images/flags/cn.png
new file mode 100644
index 00000000..e3ca7a04
Binary files /dev/null and b/files/images/flags/cn.png differ
diff --git a/files/images/flags/de.png b/files/images/flags/de.png
new file mode 100644
index 00000000..06add737
Binary files /dev/null and b/files/images/flags/de.png differ
diff --git a/files/images/flags/es.png b/files/images/flags/es.png
new file mode 100644
index 00000000..e0daa0ec
Binary files /dev/null and b/files/images/flags/es.png differ
diff --git a/files/images/flags/fi.png b/files/images/flags/fi.png
new file mode 100644
index 00000000..f7eb60dd
Binary files /dev/null and b/files/images/flags/fi.png differ
diff --git a/files/images/flags/fr.png b/files/images/flags/fr.png
new file mode 100644
index 00000000..4d38f9e0
Binary files /dev/null and b/files/images/flags/fr.png differ
diff --git a/files/images/flags/jp.png b/files/images/flags/jp.png
new file mode 100644
index 00000000..f66f64af
Binary files /dev/null and b/files/images/flags/jp.png differ
diff --git a/files/images/flags/pl.png b/files/images/flags/pl.png
new file mode 100644
index 00000000..d54aaff9
Binary files /dev/null and b/files/images/flags/pl.png differ
diff --git a/files/images/flags/ru.png b/files/images/flags/ru.png
new file mode 100644
index 00000000..733119fb
Binary files /dev/null and b/files/images/flags/ru.png differ
diff --git a/files/images/flags/sa.png b/files/images/flags/sa.png
new file mode 100644
index 00000000..d255f3b1
Binary files /dev/null and b/files/images/flags/sa.png differ
diff --git a/files/images/flags/sk.png b/files/images/flags/sk.png
new file mode 100644
index 00000000..71e27304
Binary files /dev/null and b/files/images/flags/sk.png differ
diff --git a/files/images/flags/uk.png b/files/images/flags/uk.png
new file mode 100644
index 00000000..4912cbd2
Binary files /dev/null and b/files/images/flags/uk.png differ
diff --git a/gtac_roleplay.code-workspace b/gtac_roleplay.code-workspace
deleted file mode 100644
index 876a1499..00000000
--- a/gtac_roleplay.code-workspace
+++ /dev/null
@@ -1,8 +0,0 @@
-{
- "folders": [
- {
- "path": "."
- }
- ],
- "settings": {}
-}
\ No newline at end of file
diff --git a/locale/chinese.json b/locale/chinese.json
deleted file mode 100644
index 5286e7db..00000000
--- a/locale/chinese.json
+++ /dev/null
@@ -1,397 +0,0 @@
-{
- "TranslationProvidedBy": "Renzuka Ctone",
- "LocaleEnglishName": "Chinese",
- "LocaleNativeName": "Chinese",
- "LocaleOffer": "This server is available in English. Use {1} to use it.",
- "LocaleChanged1": "Your language is now set to {1}",
- "LocaleChanged2": "The server will now display messages in {1}",
- "LocaleChangedNote": "This does not change messages from other players",
- "AccentsListHeader": "Accents",
- "HeaderHelpMainList": "Help Categories",
- "AccentNotFound": "Accent not found",
- "AccentSet": "You set your accent to {1}",
- "AnimationNotFound": "That animation doesn't exist",
- "AnimationCommandTip": "Use {1} to see a list of valid animations",
- "AnimationInvalidDistance": "The distance must be between 0 and 3",
- "AnimationStopCommandTip": "Use {1} to stop your animation",
- "CantBanClient": "You cannot ban this person",
- "PlayerAccountBanned": "{1} has been account banned",
- "ClanNotFound": "Clan not found",
- "ClanNameTaken": "A clan with that name already exists",
- "PlayerNotFound": "Player not found",
- "ClanCantRemoveRanks": "You can't remove clan ranks",
- "ClanCantAddRanks": "You can't add clan ranks",
- "ClanRankNotFound": "Clan rank not found",
- "ClanCantChangeMemberTag": "You can not change clan member's tags",
- "ClanPlayerNotInSameClan": "That player is not in your clan",
- "ClanCantChangeRankLevel": "You can not change clan rank's level",
- "ClanCantChangeRankTag": "You can not change clan rank's tags",
- "NameNotRegistered": "Your name is not registered! Use {1} to make an account.",
- "AutomaticLoginIPToggle": "Automatic login by IP is now {1}",
- "CouldNotRegisterAccount": "There was a problem creating your account. Please contact an admin.",
- "RandomTipsToggle": "Random tips are now {1}",
- "ActionTipsToggle": "Action tips are now {1}",
- "AutoSpawnLastCharToggle": "Automatic spawn as last used character is {1}",
- "AccountGUISettingToggle": "GUI is now {1}",
- "On": "On",
- "Off": "Off",
- "Yes": "Yes",
- "No": "No",
- "True": "True",
- "False": "False",
- "Locked": "Locked",
- "Unlocked": "Unlocked",
- "PasswordNotGoodEnough": "The new password must meet the requirements!",
- "PasswordNeedsBase": "Passwords must have at least {1}",
- "PasswordNeedsCapitals": "{1} capital letters",
- "PasswordNeedsNumbers": "{1} numbers",
- "PasswordNeedsSymbols": "{1} symbols",
- "PasswordsDontMatch": "The new password and confirm new password aren't the same!",
- "PasswordChanged": "Your password has been changed!",
- "AutoLoggedInIP": "You have been automatically logged in by IP!",
- "WelcomeBack": "Welcome back to {1}, {2}! Please {3} to continue.",
- "WelcomeNewPlayer": "Welcome to {1}, {2}! Please {3} to play.",
- "InvalidPlayer": "Player not found!",
- "InvalidBusiness": "Business not found!",
- "InvalidHouse": "House not found!",
- "InvalidVehicle": "Vehicle not found!",
- "InvalidClan": "Clan not found!",
- "InvalidClanRank": "Clan rank not found!",
- "InvalidJob": "Job not found!",
- "InvalidItem": "Item not found!",
- "InvalidItemType": "Item type not found!",
- "InvalidRadioStation": "Radio station not found!",
- "InvalidGate": "Gate not found!",
- "EntersProperty": "opens the door and enters the {1}",
- "ExitsProperty": "opens the door and exits the {1}",
- "EnterExitPropertyDoorLocked": "tries to open the {1} door but fails because it's locked",
- "PropertyNoInterior": "This {1} does not have an interior, but you can still use commands at the door icon.",
- "NoBusinessWithItemType": "There is no business with that item available",
- "HeaderKeyBinds": "Key Binds",
- "HeaderAccountHelp": "Account Help",
- "HeaderVehicleHelp": "Vehicle Help",
- "HeaderVehicleDealershipHelp": "Vehicle Dealership Help",
- "HeaderJobHelp": "Job Help",
- "HeaderChatHelp": "Chat Help",
- "HeaderServerRules": "Server Rules",
- "HeaderWebsiteInfo": "Website",
- "HeaderDiscordInfo": "Discord",
- "HeaderAnimationsList": "Animation List",
- "HeaderPayAndSprayHelp": "Pay and Spray Help",
- "HeaderAmmunationHelp": "Ammunation Help",
- "HeaderVehicleTuneupHelp": "Vehicle Tune Help",
- "HeaderBindableKeysHelp": "Bindable Keys",
- "HeaderSkinHelp": "Clothes/Skin Help",
- "HeaderBusinessHelp": "Business Help",
- "HeaderClanHelp": "Clan Help",
- "HeaderPlayerVehiclesList": "Player Vehicles ({1})",
- "HeaderPlayerBusinessesList": "Player Businesses ({1})",
- "HeaderClansList": "Clan List",
- "HeaderAdminsList": "Admin List",
- "HeaderBadgeInfo": "Badge Information",
- "HeaderAccentsList": "Accent List",
- "HeaderPlayerInfo": "Player Information ({1})",
- "HeaderWealthandTaxHelp": "Wealth and Tax Information",
- "HeaderCommandInfo": "Command Information ({1})",
- "HeaderRadioHelp": "Radio Help",
- "HeaderRadioStationsList": "Radio Stations",
- "HeaderKeyBindsList": "Key Binds List",
- "RadioVolumeChanged": "{1} You changed your streaming radio volume to {2}%",
- "VolumeLevelNotNumber": "The volume level must be a number",
- "RadioStationLocationInvalid": "You must be in a vehicle, house, or business or have a personal device to change the station!",
- "ActionBusinessRadioStationChange": "changes the business radio station to {1} ({2})",
- "ActionHouseRadioStationChange": "changes the house radio station to {1} ({2})",
- "ActionVehicleRadioStationChange": "changes the vehicle radio station to {1} ({2})",
- "ActionItemRadioStationChange": "changes the {1}'s station to {2} ({3})",
- "RandomVehicleCommandsDisabled": "This is a random traffic vehicle and commands can't be used for it.",
- "HouseDoorLock": "House {1} {2}!",
- "BusinessDoorLock": "Business {1} {2}!",
- "ServerGameModeRestarting": "The server game mode is restarting!",
- "HeaderSelfItemList": "Your Inventory",
- "HeaderPlayerItemList": "Player Inventory ({1})",
- "HeaderHouseItemList": "House Inventory",
- "HeaderBusinessFloorItemList": "Business Inventory (For Sale)",
- "HeaderBusinessStorageItemList": "Business Inventory (Storage)",
- "HeaderItemItemList": "{1}'s Inventory",
- "ItemSlotNotNumber": "The item slot must be a number",
- "ItemSlotMustBeBetween": "The item slot must be between {1} and {2}!",
- "UseItemBugged": "The item you're trying to use is bugged. A bug report has been sent to the server developers.",
- "PickupItemBugged": "The item you're trying to pickup is bugged. A bug report has been sent to the server developers.",
- "DropItemBugged": "The item you're trying to drop is bugged. A bug report has been sent to the server developers.",
- "HandsBusy": "Your hands are busy",
- "CantUseItemInSkinChange": "You can't use an item while customizing your appearance",
- "CantDropItemInSkinChange": "You can't drop an item while customizing your appearance",
- "CantPickupItemInSkinChange": "You can't pickup an item while customizing your appearance",
- "CantSwitchItemInSkinChange": "You can't switch an item while customizing your appearance",
- "CantGiveItemInSkinChange": "You can't give an item while customizing your appearance",
- "CantTakeItemInSkinChange": "You can't take an item while customizing your appearance",
- "ItemUnequippableNoAmmo": "The {1} in slot {2} has no ammo, and can't be equipped!",
- "NoSpaceSelfInventory": "You don't have any more space in your inventory",
- "Business": "business",
- "House": "house",
- "Clan": "clan",
- "Vehicle": "vehicle",
- "Item": "item",
- "ItemType": "item type",
- "Gate": "gate",
- "Door": "door",
- "ClanRank": "clan rank",
- "JobRank": "job rank",
- "RadioStation": "radio station",
- "Months": [
- "January",
- "February",
- "March",
- "April",
- "May",
- "June",
- "July",
- "August",
- "September",
- "October",
- "November",
- "December"
- ],
- "WeekDays": [
- "Sunday",
- "Monday",
- "Tuesday",
- "Wednesday",
- "Thursday",
- "Friday",
- "Saturday"
- ],
- "CardinalDirections": [
- "North",
- "Northeast",
- "East",
- "Southeast",
- "South",
- "Southwest",
- "West",
- "Northwest"
- ],
- "NewPlayerReadyToPlay": [
- "You have been given some cash. Use {1} to find places to buy items.",
- "If you need money, jobs are the yellow dots on the radar.",
- "For a car, visit the car dealership. You can also use a rental vehicle near spawn or take the train",
- "Be sure to read the {1} and use {2} for info."
- ],
- "YourCurrentVehicleDeleted": "The vehicle you were in was deleted.",
- "Distance": "Distance",
- "Meters": "Meters",
- "Feet": "Feet",
- "Kilometers": "Kilometers",
- "Miles": "Miles",
- "MustBeVehicleDriver": "You must be the driver of the vehicle!",
- "PlayerJoinedServer": "{1} has joined the game from {1}!",
- "PlayerLeftServer": "{1} has left the game! ({1})",
- "DisconnectReasons": [
- "Lost Connection",
- "Disconnected",
- "Unsupported Client",
- "Wrong Game",
- "Incorrect Password",
- "Unsupported Executable",
- "Disconnected",
- "Banned",
- "Failed",
- "Invalid Name",
- "Crashed"
- ],
- "TakeItemFromHouse": "takes a {1} from the house",
- "TakeItemFromBusinessStorage": "takes a {1} from the business storage",
- "TakeItemFromBusiness": "takes a {1} from the business",
- "TakeItemFromItem": "takes a {1} from the {2}",
- "TakeItemFromVehicleTrunk": "takes a {1} from the trunk",
- "TakeItemFromVehicleDash": "takes a {1} from the glove compartment",
- "JobEquipmentInventoryKeyBindTip": "The job equipment is in your inventory. Press {1} to see them.",
- "JobEquipmentInventoryCommandTip": "The job equipment is in your inventory. Use {1} to see them.",
- "AccountHelp": [
- "Do NOT share your password with anybody else. {1} staff will never ask you for your password",
- "Use {1} to change your password, and {2} if you forgot it",
- "Some settings you can use: {1}"
- ],
- "VehicleHelp": [
- "Your personal vehicles will save wherever you or somebody else leaves them!",
- "Visit dealerships to buy new vehicles (Use {1} for more information)",
- "Some commands: {1}",
- "Visit a mechanic garage to repair, colour, and tune up your car! {1} for info"
- ],
- "VehicleDealershipHelp": [
- "Visit a vehicle dealer to buy new vehicles. Use {1} to find one.",
- "At the dealer, enter a car you want to buy, and the price will be shown to you",
- "If you want to buy the vehicle, use {1} and you will be given keys to test drive it around the parking lot.",
- "Drive away from the dealership with the new vehicle to confirm the purchase."
- ],
- "JobHelp": [
- "Visit job locations to get a job and earn money. Look for yellow spots on the map",
- "At a job location, use {1} to get the job. Use {2} to quit your job",
- "Use {1} to begin working. You can also get a job {2} and {3}",
- "Most job vehicles are locked. Use {1} near one to enter it.",
- "When entering a job vehicle, information on how to do the job will be shown to you."
- ],
- "ChatHelp": [
- "There are two main types of chat: out-of-character (OOC) and in-character (IC)",
- "Mixing these two types is not proper roleplay. See {1} for info.",
- "Some chat commands: {1}",
- "Some have shorter names available ({1} to talk, {2} to shout, etc)"
- ],
- "ServerRulesHelp": [
- "Unrealistic actions (powergaming) are not allowed. You aren't superman.",
- "No terrorist or terrorism roleplay is allowed.",
- "Always follow instructions given by moderators and admins.",
- "Do not mix the chats (metagaming). You can't use info in IC that was received OOC",
- "Keep English in main chats. If you aren't good at English, use {1}"
- ],
- "AnimationHelp": [
- "Animations allow you to enhance roleplay with visual actions",
- "Use {1} or {2} with a name to use an animation.",
- "To see a list of animations, use {1}"
- ],
- "WeaponHelp": [
- "Visit an gun store to buy weapons. Use {1} to find one.",
- "Buying a weapon requires a weapon license.",
- "Weapon licenses are managed by the police department. Apply there to get one.",
- "Weapons can also be purchased illegally from some businesses, weapon dealers, and clans."
- ],
- "SkinHelp": [
- "At a clothing store, use {1} to purchase clothes",
- "When you have a clothing item, equip and use it like any other item to show the skin selection (check {1} to learn how to use items)",
- "Some skins are restricted to jobs, clans, or for other reasons."
- ],
- "KeyBindHelp": [
- "You can set your own key binds. Use {1} to see your binded keys.",
- "Use {1} to add a new keybind and {2} to remove one.",
- "Default keys are: {1} for vehicle engine, {1} for lights, and {3} for lock/unlock",
- "Press {1} to see your items and {2} to equip an item or {3} to unequip all.",
- "Press {1} to use the item you're holding, press {2} to drop it, or press {3} to pickup an item from the ground."
- ],
- "BusinessHelp": [
- "Use {1} to purchase items or {2} to see a list of what's for sale at any business",
- "Businesses are shown with blue names above the icon at their entrance.",
- "Business owner commands: {1}",
- "A new car for sale will appear when you drive away from the dealer."
- ],
- "ClanHelp": [
- "Ask an administrator to create a clan (Similar to factions/groups/families)",
- "Clan owners have full control over their clan once it's created",
- "Clan commands: {1}",
- "More clan commands: {1}"
- ],
- "RadioStationHelp": [
- "Use {1} to set the station for your vehicle, house, or business",
- "Use {2} to see a list of stations",
- "You can change your radio streaming volume using {1} with 0-100 as the percent"
- ],
- "WealthAndTaxHelp": [
- "Your taxes on payday are {1} percent of your calculated wealth.",
- "Your calculated wealth is a total sum based on how many vehicles, houses, and businesses you have.",
- "Each vehicle is {1}, each house is {2}, and each business is {3}",
- "Use {1} to see your current wealth, and {2} to see how much you'll pay in tax each payday"
- ],
- "MustBeInAVehicle": "You need to be in a vehicle!",
- "MustBeInOrNearVehicle": "You need to be in or near a vehicle!",
- "MustBeInVehicleFrontSeat": "You need to be in the vehicle front seats!",
- "MustBeInVehicleDriverSeat": "You need to be the driver!",
- "DontHaveVehicleKey": "You don't have a key for this vehicle!",
- "NoGateAccess": "You don't have access to this gate!",
- "GateBroken": "This gate is broken!",
- "GateHacked": "The gate does not respond!",
- "RadioJammed": "You hear only static from the radio.",
- "VehicleNotForSale": "This vehicle is not for sale!",
- "VehicleNotForRent": "This vehicle is not for rent!",
- "BusinessNotForSale": "This business is not for sale!",
- "BusinessNotForRent": "This business is not for rent!",
- "HouseNotForSale": "This house is not for sale!",
- "HouseNotForRent": "This house is not for rent!",
- "DealershipPurchaseTestDrive": "Drive the vehicle away from the dealership to buy it, or get out to cancel.",
- "DealershipPurchaseExitedVehicle": "You canceled the vehicle purchase by exiting the vehicle!",
- "VehiclePurchaseComplete": "This vehicle is now yours! It will save wherever you leave it.",
- "VehiclePurchaseNotEnoughMoney": "You don't have enough money to buy this vehicle!",
- "HousePurchaseNotEnoughMoney": "You don't have enough money to buy this house!",
- "BusinessPurchaseNotEnoughMoney": "You don't have enough money to buy this business!",
- "Locales": {
- "English": "English",
- "Russian": "Russian",
- "Spanish": "Spanish",
- "German": "German",
- "Dutch": "Dutch",
- "Polish": "Polish"
- },
-
- "ADDED-21JAN2022": "DO NOT TRANSLATE. This string is just a comment to separate newly added translations.",
- "HeaderPlayerHousesList": "Player Houses ({1})",
- "HeaderPlayerStaffFlagsList": "Player Staff Flags ({1})",
- "HeaderStaffFlagsList": "Staff Flags",
- "NonRPName": "Non-RP name! Choose a new one:",
- "InvalidStaffFlag": "Staff flag not found!",
- "InvalidClanFlag": "Clan flag not found!",
- "InvalidLocale": "Language not found!",
- "HeaderJobUniformList": "Job Uniforms ({1})",
- "HeaderJobEquipmentList": "Job Equipment ({1})",
- "InvalidJobUniform": "Job uniform not found!",
- "InvalidJobEquipment": "Job equipment not found!",
- "HeaderVehiclesInRangeList": "Vehicles within {1}",
- "NoVehiclesWithInRange": "There are no vehicles within {1}",
- "AmountNotNumber": "The amount must be a number!",
- "NeedToBeWorking": "You need to be working! Use {1} at a job location or near a job vehicle.",
- "NeedToBeOnJobRoute": "You need to be doing a job route! Use {1} in a job vehicle",
- "CurrentJobRouteDeleted": "The job route you were on has been deleted by an admin",
- "CurrentJobRouteVehicleColoursChanged": "Your job route's vehicle colours were changed by an admin",
- "NotYourJob": "This is not your job!",
- "JobPoints": "You can get a job by going the yellow points on the map.",
- "QuitJobToTakeAnother": "If you want this job, use {1} to quit your current job.",
- "NotAJobVehicle": "This is not a job vehicle!",
- "NotYourJobVehicle": "This is not your job's vehicle!",
- "JobRouteDisabled": "The job route you were on has been disabled by an admin",
- "HeaderPickupTypes": "Pickup Types",
- "HeaderBlipTypes": "Map Icon Types",
- "InvalidGPSLocation": "There are no locations with that name or type",
- "HeaderBusinessList": "Businesses",
- "VehicleForSale": "This {1} is buyable for {2}! Use {3} if you want to buy it",
- "VehicleForRent": "This {1} is rentable for {2}! Use {3} if you want to rent it",
-
- "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.",
-
- "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 List",
- "ViewInventoryKeyPressTip": "Press {1} to see your items",
- "ViewInventoryCommandTip": "Use {1} to see your items"
-}
diff --git a/locale/english.json b/locale/english.json
deleted file mode 100644
index 5f68c88e..00000000
--- a/locale/english.json
+++ /dev/null
@@ -1,397 +0,0 @@
-{
- "TranslationProvidedBy": "Vortrex",
- "LocaleEnglishName": "English",
- "LocaleNativeName": "English",
- "LocaleOffer": "This server is available in English. Use {1} to use it.",
- "LocaleChanged1": "Your language is now set to {1}",
- "LocaleChanged2": "The server will now display messages in {1}",
- "LocaleChangedNote": "This does not change messages from other players",
- "AccentsListHeader": "Accents",
- "HeaderHelpMainList": "Help Categories",
- "AccentNotFound": "Accent not found",
- "AccentSet": "You set your accent to {1}",
- "AnimationNotFound": "That animation doesn't exist",
- "AnimationCommandTip": "Use {1} to see a list of valid animations",
- "AnimationInvalidDistance": "The distance must be between 0 and 3",
- "AnimationStopCommandTip": "Use {1} to stop your animation",
- "CantBanClient": "You cannot ban this person",
- "PlayerAccountBanned": "{1} has been account banned",
- "ClanNotFound": "Clan not found",
- "ClanNameTaken": "A clan with that name already exists",
- "PlayerNotFound": "Player not found",
- "ClanCantRemoveRanks": "You can't remove clan ranks",
- "ClanCantAddRanks": "You can't add clan ranks",
- "ClanRankNotFound": "Clan rank not found",
- "ClanCantChangeMemberTag": "You can not change clan member's tags",
- "ClanPlayerNotInSameClan": "That player is not in your clan",
- "ClanCantChangeRankLevel": "You can not change clan rank's level",
- "ClanCantChangeRankTag": "You can not change clan rank's tags",
- "NameNotRegistered": "Your name is not registered! Use {1} to make an account.",
- "AutomaticLoginIPToggle": "Automatic login by IP is now {1}",
- "CouldNotRegisterAccount": "There was a problem creating your account. Please contact an admin.",
- "RandomTipsToggle": "Random tips are now {1}",
- "ActionTipsToggle": "Action tips are now {1}",
- "AutoSpawnLastCharToggle": "Automatic spawn as last used character is {1}",
- "AccountGUISettingToggle": "GUI is now {1}",
- "On": "On",
- "Off": "Off",
- "Yes": "Yes",
- "No": "No",
- "True": "True",
- "False": "False",
- "Locked": "Locked",
- "Unlocked": "Unlocked",
- "PasswordNotGoodEnough": "The new password must meet the requirements!",
- "PasswordNeedsBase": "Passwords must have at least {1}",
- "PasswordNeedsCapitals": "{1} capital letters",
- "PasswordNeedsNumbers": "{1} numbers",
- "PasswordNeedsSymbols": "{1} symbols",
- "PasswordsDontMatch": "The new password and confirm new password aren't the same!",
- "PasswordChanged": "Your password has been changed!",
- "AutoLoggedInIP": "You have been automatically logged in by IP!",
- "WelcomeBack": "Welcome back to {1}, {2}! Please {3} to continue.",
- "WelcomeNewPlayer": "Welcome to {1}, {2}! Please {3} to play.",
- "InvalidPlayer": "Player not found!",
- "InvalidBusiness": "Business not found!",
- "InvalidHouse": "House not found!",
- "InvalidVehicle": "Vehicle not found!",
- "InvalidClan": "Clan not found!",
- "InvalidClanRank": "Clan rank not found!",
- "InvalidJob": "Job not found!",
- "InvalidItem": "Item not found!",
- "InvalidItemType": "Item type not found!",
- "InvalidRadioStation": "Radio station not found!",
- "InvalidGate": "Gate not found!",
- "EntersProperty": "opens the door and enters the {1}",
- "ExitsProperty": "opens the door and exits the {1}",
- "EnterExitPropertyDoorLocked": "tries to open the {1} door but fails because it's locked",
- "PropertyNoInterior": "This {1} does not have an interior, but you can still use commands at the door icon.",
- "NoBusinessWithItemType": "There is no business with that item available",
- "HeaderKeyBinds": "Key Binds",
- "HeaderAccountHelp": "Account Help",
- "HeaderVehicleHelp": "Vehicle Help",
- "HeaderVehicleDealershipHelp": "Vehicle Dealership Help",
- "HeaderJobHelp": "Job Help",
- "HeaderChatHelp": "Chat Help",
- "HeaderServerRules": "Server Rules",
- "HeaderWebsiteInfo": "Website",
- "HeaderDiscordInfo": "Discord",
- "HeaderAnimationsList": "Animation List",
- "HeaderPayAndSprayHelp": "Pay and Spray Help",
- "HeaderAmmunationHelp": "Ammunation Help",
- "HeaderVehicleTuneupHelp": "Vehicle Tune Help",
- "HeaderBindableKeysHelp": "Bindable Keys",
- "HeaderSkinHelp": "Clothes/Skin Help",
- "HeaderBusinessHelp": "Business Help",
- "HeaderClanHelp": "Clan Help",
- "HeaderPlayerVehiclesList": "Player Vehicles ({1})",
- "HeaderPlayerBusinessesList": "Player Businesses ({1})",
- "HeaderClansList": "Clan List",
- "HeaderAdminsList": "Admin List",
- "HeaderBadgeInfo": "Badge Information",
- "HeaderAccentsList": "Accent List",
- "HeaderPlayerInfo": "Player Information ({1})",
- "HeaderWealthandTaxHelp": "Wealth and Tax Information",
- "HeaderCommandInfo": "Command Information ({1})",
- "HeaderRadioHelp": "Radio Help",
- "HeaderRadioStationsList": "Radio Stations",
- "HeaderKeyBindsList": "Key Binds List",
- "RadioVolumeChanged": "{1} You changed your streaming radio volume to {2}%",
- "VolumeLevelNotNumber": "The volume level must be a number",
- "RadioStationLocationInvalid": "You must be in a vehicle, house, or business or have a personal device to change the station!",
- "ActionBusinessRadioStationChange": "changes the business radio station to {1} ({2})",
- "ActionHouseRadioStationChange": "changes the house radio station to {1} ({2})",
- "ActionVehicleRadioStationChange": "changes the vehicle radio station to {1} ({2})",
- "ActionItemRadioStationChange": "changes the {1}'s station to {2} ({3})",
- "RandomVehicleCommandsDisabled": "This is a random traffic vehicle and commands can't be used for it.",
- "HouseDoorLock": "House {1} {2}!",
- "BusinessDoorLock": "Business {1} {2}!",
- "ServerGameModeRestarting": "The server game mode is restarting!",
- "HeaderSelfItemList": "Your Inventory",
- "HeaderPlayerItemList": "Player Inventory ({1})",
- "HeaderHouseItemList": "House Inventory",
- "HeaderBusinessFloorItemList": "Business Inventory (For Sale)",
- "HeaderBusinessStorageItemList": "Business Inventory (Storage)",
- "HeaderItemItemList": "{1}'s Inventory",
- "ItemSlotNotNumber": "The item slot must be a number",
- "ItemSlotMustBeBetween": "The item slot must be between {1} and {2}!",
- "UseItemBugged": "The item you're trying to use is bugged. A bug report has been sent to the server developers.",
- "PickupItemBugged": "The item you're trying to pickup is bugged. A bug report has been sent to the server developers.",
- "DropItemBugged": "The item you're trying to drop is bugged. A bug report has been sent to the server developers.",
- "HandsBusy": "Your hands are busy",
- "CantUseItemInSkinChange": "You can't use an item while customizing your appearance",
- "CantDropItemInSkinChange": "You can't drop an item while customizing your appearance",
- "CantPickupItemInSkinChange": "You can't pickup an item while customizing your appearance",
- "CantSwitchItemInSkinChange": "You can't switch an item while customizing your appearance",
- "CantGiveItemInSkinChange": "You can't give an item while customizing your appearance",
- "CantTakeItemInSkinChange": "You can't take an item while customizing your appearance",
- "ItemUnequippableNoAmmo": "The {1} in slot {2} has no ammo, and can't be equipped!",
- "NoSpaceSelfInventory": "You don't have any more space in your inventory",
- "Business": "business",
- "House": "house",
- "Clan": "clan",
- "Vehicle": "vehicle",
- "Item": "item",
- "ItemType": "item type",
- "Gate": "gate",
- "Door": "door",
- "ClanRank": "clan rank",
- "JobRank": "job rank",
- "RadioStation": "radio station",
- "Months": [
- "January",
- "February",
- "March",
- "April",
- "May",
- "June",
- "July",
- "August",
- "September",
- "October",
- "November",
- "December"
- ],
- "WeekDays": [
- "Sunday",
- "Monday",
- "Tuesday",
- "Wednesday",
- "Thursday",
- "Friday",
- "Saturday"
- ],
- "CardinalDirections": [
- "North",
- "Northeast",
- "East",
- "Southeast",
- "South",
- "Southwest",
- "West",
- "Northwest"
- ],
- "NewPlayerReadyToPlay": [
- "You have been given some cash. Use {1} to find places to buy items.",
- "If you need money, jobs are the yellow dots on the radar.",
- "For a car, visit the car dealership. You can also use a rental vehicle near spawn or take the train",
- "Be sure to read the {1} and use {2} for info."
- ],
- "YourCurrentVehicleDeleted": "The vehicle you were in was deleted.",
- "Distance": "Distance",
- "Meters": "Meters",
- "Feet": "Feet",
- "Kilometers": "Kilometers",
- "Miles": "Miles",
- "MustBeVehicleDriver": "You must be the driver of the vehicle!",
- "PlayerJoinedServer": "{1} has joined the game from {1}!",
- "PlayerLeftServer": "{1} has left the game! ({1})",
- "DisconnectReasons": [
- "Lost Connection",
- "Disconnected",
- "Unsupported Client",
- "Wrong Game",
- "Incorrect Password",
- "Unsupported Executable",
- "Disconnected",
- "Banned",
- "Failed",
- "Invalid Name",
- "Crashed"
- ],
- "TakeItemFromHouse": "takes a {1} from the house",
- "TakeItemFromBusinessStorage": "takes a {1} from the business storage",
- "TakeItemFromBusiness": "takes a {1} from the business",
- "TakeItemFromItem": "takes a {1} from the {2}",
- "TakeItemFromVehicleTrunk": "takes a {1} from the trunk",
- "TakeItemFromVehicleDash": "takes a {1} from the glove compartment",
- "JobEquipmentInventoryKeyBindTip": "The job equipment is in your inventory. Press {1} to see them.",
- "JobEquipmentInventoryCommandTip": "The job equipment is in your inventory. Use {1} to see them.",
- "AccountHelp": [
- "Do NOT share your password with anybody else. {1} staff will never ask you for your password",
- "Use {1} to change your password, and {2} if you forgot it",
- "Some settings you can use: {1}"
- ],
- "VehicleHelp": [
- "Your personal vehicles will save wherever you or somebody else leaves them!",
- "Visit dealerships to buy new vehicles (Use {1} for more information)",
- "Some commands: {1}",
- "Visit a mechanic garage to repair, colour, and tune up your car! {1} for info"
- ],
- "VehicleDealershipHelp": [
- "Visit a vehicle dealer to buy new vehicles. Use {1} to find one.",
- "At the dealer, enter a car you want to buy, and the price will be shown to you",
- "If you want to buy the vehicle, use {1} and you will be given keys to test drive it around the parking lot.",
- "Drive away from the dealership with the new vehicle to confirm the purchase."
- ],
- "JobHelp": [
- "Visit job locations to get a job and earn money. Look for yellow spots on the map",
- "At a job location, use {1} to get the job. Use {2} to quit your job",
- "Use {1} to begin working. You can also get a job {2} and {3}",
- "Most job vehicles are locked. Use {1} near one to enter it.",
- "When entering a job vehicle, information on how to do the job will be shown to you."
- ],
- "ChatHelp": [
- "There are two main types of chat: out-of-character (OOC) and in-character (IC)",
- "Mixing these two types is not proper roleplay. See {1} for info.",
- "Some chat commands: {1}",
- "Some have shorter names available ({1} to talk, {2} to shout, etc)"
- ],
- "ServerRulesHelp": [
- "Unrealistic actions (powergaming) are not allowed. You aren't superman.",
- "No terrorist or terrorism roleplay is allowed.",
- "Always follow instructions given by moderators and admins.",
- "Do not mix the chats (metagaming). You can't use info in IC that was received OOC",
- "Keep English in main chats. If you aren't good at English, use {1}"
- ],
- "AnimationHelp": [
- "Animations allow you to enhance roleplay with visual actions",
- "Use {1} or {2} with a name to use an animation.",
- "To see a list of animations, use {1}"
- ],
- "WeaponHelp": [
- "Visit an gun store to buy weapons. Use {1} to find one.",
- "Buying a weapon requires a weapon license.",
- "Weapon licenses are managed by the police department. Apply there to get one.",
- "Weapons can also be purchased illegally from some businesses, weapon dealers, and clans."
- ],
- "SkinHelp": [
- "At a clothing store, use {1} to purchase clothes",
- "When you have a clothing item, equip and use it like any other item to show the skin selection (check {1} to learn how to use items)",
- "Some skins are restricted to jobs, clans, or for other reasons."
- ],
- "KeyBindHelp": [
- "You can set your own key binds. Use {1} to see your binded keys.",
- "Use {1} to add a new keybind and {2} to remove one.",
- "Default keys are: {1} for vehicle engine, {1} for lights, and {3} for lock/unlock",
- "Press {1} to see your items and {2} to equip an item or {3} to unequip all.",
- "Press {1} to use the item you're holding, press {2} to drop it, or press {3} to pickup an item from the ground."
- ],
- "BusinessHelp": [
- "Use {1} to purchase items or {2} to see a list of what's for sale at any business",
- "Businesses are shown with blue names above the icon at their entrance.",
- "Business owner commands: {1}",
- "A new car for sale will appear when you drive away from the dealer."
- ],
- "ClanHelp": [
- "Ask an administrator to create a clan (Similar to factions/groups/families)",
- "Clan owners have full control over their clan once it's created",
- "Clan commands: {1}",
- "More clan commands: {1}"
- ],
- "RadioStationHelp": [
- "Use {1} to set the station for your vehicle, house, or business",
- "Use {2} to see a list of stations",
- "You can change your radio streaming volume using {1} with 0-100 as the percent"
- ],
- "WealthAndTaxHelp": [
- "Your taxes on payday are {1} percent of your calculated wealth.",
- "Your calculated wealth is a total sum based on how many vehicles, houses, and businesses you have.",
- "Each vehicle is {1}, each house is {2}, and each business is {3}",
- "Use {1} to see your current wealth, and {2} to see how much you'll pay in tax each payday"
- ],
- "MustBeInAVehicle": "You need to be in a vehicle!",
- "MustBeInOrNearVehicle": "You need to be in or near a vehicle!",
- "MustBeInVehicleFrontSeat": "You need to be in the vehicle front seats!",
- "MustBeInVehicleDriverSeat": "You need to be the driver!",
- "DontHaveVehicleKey": "You don't have a key for this vehicle!",
- "NoGateAccess": "You don't have access to this gate!",
- "GateBroken": "This gate is broken!",
- "GateHacked": "The gate does not respond!",
- "RadioJammed": "You hear only static from the radio.",
- "VehicleNotForSale": "This vehicle is not for sale!",
- "VehicleNotForRent": "This vehicle is not for rent!",
- "BusinessNotForSale": "This business is not for sale!",
- "BusinessNotForRent": "This business is not for rent!",
- "HouseNotForSale": "This house is not for sale!",
- "HouseNotForRent": "This house is not for rent!",
- "DealershipPurchaseTestDrive": "Drive the vehicle away from the dealership to buy it, or get out to cancel.",
- "DealershipPurchaseExitedVehicle": "You canceled the vehicle purchase by exiting the vehicle!",
- "VehiclePurchaseComplete": "This vehicle is now yours! It will save wherever you leave it.",
- "VehiclePurchaseNotEnoughMoney": "You don't have enough money to buy this vehicle!",
- "HousePurchaseNotEnoughMoney": "You don't have enough money to buy this house!",
- "BusinessPurchaseNotEnoughMoney": "You don't have enough money to buy this business!",
- "Locales": {
- "English": "English",
- "Russian": "Russian",
- "Spanish": "Spanish",
- "German": "German",
- "Dutch": "Dutch",
- "Polish": "Polish"
- },
-
- "ADDED-21JAN2022": "DO NOT TRANSLATE. This string is just a comment to separate newly added translations.",
- "HeaderPlayerHousesList": "Player Houses ({1})",
- "HeaderPlayerStaffFlagsList": "Player Staff Flags ({1})",
- "HeaderStaffFlagsList": "Staff Flags",
- "NonRPName": "Non-RP name! Choose a new one:",
- "InvalidStaffFlag": "Staff flag not found!",
- "InvalidClanFlag": "Clan flag not found!",
- "InvalidLocale": "Language not found!",
- "HeaderJobUniformList": "Job Uniforms ({1})",
- "HeaderJobEquipmentList": "Job Equipment ({1})",
- "InvalidJobUniform": "Job uniform not found!",
- "InvalidJobEquipment": "Job equipment not found!",
- "HeaderVehiclesInRangeList": "Vehicles within {1}",
- "NoVehiclesWithInRange": "There are no vehicles within {1}",
- "AmountNotNumber": "The amount must be a number!",
- "NeedToBeWorking": "You need to be working! Use {1} at a job location or near a job vehicle.",
- "NeedToBeOnJobRoute": "You need to be doing a job route! Use {1} in a job vehicle",
- "CurrentJobRouteDeleted": "The job route you were on has been deleted by an admin",
- "CurrentJobRouteVehicleColoursChanged": "Your job route's vehicle colours were changed by an admin",
- "NotYourJob": "This is not your job!",
- "JobPoints": "You can get a job by going the yellow points on the map.",
- "QuitJobToTakeAnother": "If you want this job, use {1} to quit your current job.",
- "NotAJobVehicle": "This is not a job vehicle!",
- "NotYourJobVehicle": "This is not your job's vehicle!",
- "JobRouteDisabled": "The job route you were on has been disabled by an admin",
- "HeaderPickupTypes": "Pickup Types",
- "HeaderBlipTypes": "Map Icon Types",
- "InvalidGPSLocation": "There are no locations with that name or type",
- "HeaderBusinessList": "Businesses",
- "VehicleForSale": "This {1} is buyable for {2}! Use {3} if you want to buy it",
- "VehicleForRent": "This {1} is rentable for {2}! Use {3} if you want to rent it",
-
- "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.",
-
- "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 List",
- "ViewInventoryKeyPressTip": "Press {1} to see your items",
- "ViewInventoryCommandTip": "Use {1} to see your items"
-}
diff --git a/locale/polish.json b/locale/polish.json
deleted file mode 100644
index e38d5e1f..00000000
--- a/locale/polish.json
+++ /dev/null
@@ -1,397 +0,0 @@
-{
- "TranslationProvidedBy": "Suprise444",
- "LocaleEnglishName": "Polish",
- "LocaleNativeName": "Polski",
- "LocaleOffer": "Ten serwer jest dostępny w języku Polskim. Użyj {1} aby go użyć.",
- "LocaleChanged1": "Twój język jest ustawiony na {1}",
- "LocaleChanged2": "Serwer będzie teraz pokazywał wiadomości w języku {1}",
- "LocaleChangedNote": "To nie zmienia wiadomości od innych graczy",
- "AccentsListHeader": "Akcenty",
- "HeaderHelpMainList": "Pomoc - Kategorie",
- "AccentNotFound": "Akcent nie znaleziony",
- "AccentSet": "Ustawiłeś swój akcent na {1}",
- "AnimationNotFound": "Ta animcja nie istnieje",
- "AnimationCommandTip": "Użyj {1} aby zobaczyć listę działających animacji",
- "AnimationInvalidDistance": "Dystans musi być między 0 i 3",
- "AnimationStopCommandTip": "Użyj {1} aby zatrzymać swoją animacje",
- "CantBanClient": "Nie możesz zbanować tej osoby",
- "PlayerAccountBanned": "{1} został zbanowany",
- "ClanNotFound": "Nie znaleziono klanu",
- "ClanNameTaken": "Klan z taką nazwą już istnieje",
- "PlayerNotFound": "Nie znaleziono gracza",
- "ClanCantRemoveRanks": "Nie możesz usuwać rang klanu",
- "ClanCantAddRanks": "Nie możesz dodawać rang klanu",
- "ClanRankNotFound": "Nie znaleziono rangi klanu",
- "ClanCantChangeMemberTag": "Nie możesz zmienić tagu członka klanu",
- "ClanPlayerNotInSameClan": "Ten gracz nie jest w twoim klanie",
- "ClanCantChangeRankLevel": "Nie możesz zmienić poziomu rangi klanu",
- "ClanCantChangeRankTag": "Nie możesz zmienić tagu rangi klanu",
- "NameNotRegistered": "Twoja nazwa nie jest zarejestrowana! Użyj {1} aby stworzyć konto.",
- "AutomaticLoginIPToggle": "Automatyczny login przez IP jest teraz {1}",
- "CouldNotRegisterAccount": "Napotkano problem podczas tworzenia twojego konta. Proszę skontaktuj się z administratorem.",
- "RandomTipsToggle": "Losowe wskazówki są teraz {1}",
- "ActionTipsToggle": "Wskazówki akcji są teraz {1}",
- "AutoSpawnLastCharToggle": "Automatyczny spawn jako ostatnia postać jest teraz {1}",
- "AccountGUISettingToggle": "GUI jest teraz {1}",
- "On": "Włączony",
- "Off": "Wyłączony",
- "Yes": "Tak",
- "No": "Nie",
- "True": "Prawda",
- "False": "Fałsz",
- "Locked": "Zamknięty",
- "Unlocked": "Otwarty",
- "PasswordNotGoodEnough": "Nowe hasło musi spełniać wymagania!",
- "PasswordNeedsBase": "Hasło musi mieć przynajmniej {1}",
- "PasswordNeedsCapitals": "{1} dużych liter",
- "PasswordNeedsNumbers": "{1} numerów",
- "PasswordNeedsSymbols": "{1} symboli",
- "PasswordsDontMatch": "Hasła nie są takie same!",
- "PasswordChanged": "Twoje hasło zostało zmienione!",
- "AutoLoggedInIP": "Zostałeś automatycznie zalogowany przez IP!",
- "WelcomeBack": "Witaj ponownie w {1}, {2}! Użyj {3} aby kontynuować.",
- "WelcomeNewPlayer": "Witaj w {1}, {2}! Użyj {3} aby zagrać.",
- "InvalidPlayer": "Praca nie znaleziona!",
- "InvalidBusiness": "Biznes nie znaleziony!",
- "InvalidHouse": "Mieszkanie nie znalezione!",
- "InvalidVehicle": "Pojazd nie znaleziony!",
- "InvalidClan": "Klan nie znaleziony!",
- "InvalidClanRank": "Ranga klanu nie znaleziona!",
- "InvalidJob": "Gracz nie znaleziony!",
- "InvalidItem": "Przedmiot nie znaleziony!",
- "InvalidItemType": "Rodzaj przedmiot nie znaleziony!",
- "InvalidRadioStation": "Stacja radiowa nie znaleziona!",
- "InvalidGate": "Brama nie znaleziona!",
- "EntersProperty": "otwiera drzwi i wchodzi do {1}",
- "ExitsProperty": "otwiera drzwi i wychodzi z {1}",
- "EnterExitPropertyDoorLocked": "próbuje otworzyć {1} drzwi, ale nie udaje się, ponieważ są zamknięte",
- "PropertyNoInterior": "Ten {1} nie ma wnętrza, ale dalej możesz używaj komend przy ikonie drzwi.",
- "NoBusinessWithItemType": "Nie ma biznesu, który posiada ten przedmiot",
- "HeaderKeyBinds": "Przypisania klawiszy",
- "HeaderAccountHelp": "Pomoc - Konto",
- "HeaderVehicleHelp": "Pomoc - Pojazd",
- "HeaderVehicleDealershipHelp": "Pomoc - Dealer Samochodów",
- "HeaderJobHelp": "Pomoc - Praca",
- "HeaderChatHelp": "Pomoc - Czat",
- "HeaderServerRules": "Zasady serwera",
- "HeaderWebsiteInfo": "Strona",
- "HeaderDiscordInfo": "Discord",
- "HeaderAnimationsList": "Lista Animacji",
- "HeaderPayAndSprayHelp": "Pomoc - Pay and Spray",
- "HeaderAmmunationHelp": "Pomoc - Ammunation",
- "HeaderVehicleTuneupHelp": "Pomoc - Ulepszanie Aut",
- "HeaderBindableKeysHelp": "Przypisywalne klawisze",
- "HeaderSkinHelp": "Pomoc - Ubrania/Skóra",
- "HeaderBusinessHelp": "Pomoc - Biznes",
- "HeaderClanHelp": "Pomoc - Klan",
- "HeaderPlayerVehiclesList": "Pojazdy Gracza ({1})",
- "HeaderPlayerBusinessesList": "Biznesy Gracza ({1})",
- "HeaderClansList": "Lista Klanów",
- "HeaderAdminsList": "Lista Administracji",
- "HeaderBadgeInfo": "Informacje o Odznace",
- "HeaderAccentsList": "Lista Akcentów",
- "HeaderPlayerInfo": "Informacje o Graczu ({1})",
- "HeaderWealthandTaxHelp": "Informacje o Bogactwach i Podatkach",
- "HeaderCommandInfo": "Informacje o Komendzie ({1})",
- "HeaderRadioHelp": "Pomoc - Radio",
- "HeaderRadioStationsList": "Stacje Radiowe",
- "HeaderKeyBindsList": "Lista przypisań klawiszy",
- "RadioVolumeChanged": "{1} Zmieniłeś głośność swojego radia na {2}%",
- "VolumeLevelNotNumber": "Poziom głośności musi być liczbą",
- "RadioStationLocationInvalid": "Musisz być w aucie, domu, biznesie lub mieć osobite urządzenie by zmienić stacje radiową!",
- "ActionBusinessRadioStationChange": "zmienia biznesową stacje radiową na {1} ({2})",
- "ActionHouseRadioStationChange": "zmienia domową stacje radiową na {1} ({2})",
- "ActionVehicleRadioStationChange": "zmienia samochodową stacje radiową na {1} ({2})",
- "ActionItemRadioStationChange": "zmienia stacje {1} na {2} ({3})",
- "RandomVehicleCommandsDisabled": "To losowy pojazd uliczny i komendy nie mogą być na nim użyte.",
- "HouseDoorLock": "Mieszkanie {1} {2}!",
- "BusinessDoorLock": "Biznes {1} {2}!",
- "ServerGameModeRestarting": "Tryb gry serwera się restartuje!",
- "HeaderSelfItemList": "Twój ekwipunek",
- "HeaderPlayerItemList": "Ekwipunek gracza ({1})",
- "HeaderHouseItemList": "Ekwipunek mieszkania",
- "HeaderBusinessFloorItemList": "Ekwipunek Bizneus (Na sprzedaż)",
- "HeaderBusinessStorageItemList": "Ekwipunek Bizenus (Magazyn)",
- "HeaderItemItemList": "Ekwipunek {1}",
- "ItemSlotNotNumber": "Slot przedmiotu musi być liczbą",
- "ItemSlotMustBeBetween": "Slot itemu musi być liczbą między {1} i {2}!",
- "UseItemBugged": "Przedmiot, który próbujesz użyć jest popsuty. Zgłoszenie zostało wysłane do deweloperów serwera.",
- "PickupItemBugged": "Przedmiot, który próbujesz podnieść jest popsuty. Zgłoszenie zostało wysłane do deweloperów serwera.",
- "DropItemBugged": "Przedmiot, który próbujesz upuścić jest popsuty. Zgłoszenie zostało wysłane do deweloperów serwera.",
- "HandsBusy": "Twoje ręce są zajęte",
- "CantUseItemInSkinChange": "Nie możesz użyć przedmiotu podczas zmieniania swojego wizerunku",
- "CantDropItemInSkinChange": "Nie możesz upuścić przedmiotu podczas zmieniania swojego wizerunku",
- "CantPickupItemInSkinChange": "Nie możesz podnieść przedmiotu podczas zmieniania swojego wizerunku",
- "CantSwitchItemInSkinChange": "Nie możesz zmienić przedmiotu podczas zmieniania swojego wizerunku",
- "CantGiveItemInSkinChange": "Nie możesz dać przedmiotu podczas zmieniania swojego wizerunku",
- "CantTakeItemInSkinChange": "Nie możesz wziąć przedmiotu podczas zmieniania swojego wizerunku",
- "ItemUnequippableNoAmmo": "{1} w slocie {2} nie ma amunicji i nie może zostać użyty!",
- "NoSpaceSelfInventory": "Nie masz już miesca w ekwipunku",
- "Business": "biznes",
- "House": "mieszkanie",
- "Clan": "klan",
- "Vehicle": "pojazd",
- "Item": "przedmiot",
- "ItemType": "rodzaj przedmiotu",
- "Gate": "brama",
- "Door": "drzwi",
- "ClanRank": "ranga klanu",
- "JobRank": "praca rangi",
- "RadioStation": "stacja radiowa",
- "Months": [
- "Styczeń",
- "Luty",
- "Marzec",
- "Kwiecień",
- "Maj",
- "Czerwiec",
- "Lipiec",
- "Sierpień",
- "Wrzesień",
- "Październik",
- "Listopad",
- "Grudzień"
- ],
- "WeekDays": [
- "Niedziela",
- "Poniedziałek",
- "Wtorek",
- "Środa",
- "Czwartek",
- "Piątek",
- "Sobota"
- ],
- "CardinalDirections": [
- "Północ",
- "Północny wschód",
- "Wschód",
- "Południowy zachód",
- "Południe",
- "Południowy wschód",
- "Zachód",
- "Północny zachód"
- ],
- "NewPlayerReadyToPlay": [
- "Dostałeś trochę pieniędzy. Użyj {1} aby znaleść miejsca do kupowania przedmiotów.",
- "Jeżeli potrzebujesz pieniędzy, żółte kropki na mapie to miejsca pracy.",
- "Aby zdobyć auto musisz odwiedzić dealera samochodów. Możesz też wypożyczyć samochód przy spawnie lub użyć pociągu",
- "Pamiętaj aby przeczytać {1} i użyć {2} aby zdobyć więcej informacji."
- ],
- "YourCurrentVehicleDeleted": "Samochód w którym przebywałeś został usunięty.",
- "Distance": "Odległość",
- "Meters": "Metry",
- "Feet": "Stopy",
- "Kilometers": "Kilometry",
- "Miles": "Mile",
- "MustBeVehicleDriver": "Musisz być kierowcą tego pojazdu!",
- "PlayerJoinedServer": "{1} dołączył do gry z {1}!",
- "PlayerLeftServer": "{1} wyszedł z gry! ({1})",
- "DisconnectReasons": [
- "Utracenie Połączenia",
- "Odłączenie",
- "Niewspierana Wersja",
- "Nieprawidłowa Gra",
- "Błędne Hasło",
- "Niewspierany Plik Wykonalny",
- "Odłączenie",
- "Zbanowany",
- "Nie udane",
- "Nieprawidłowa Nazwa",
- "Crashed"
- ],
- "TakeItemFromHouse": "bierze {1} z mieszkania",
- "TakeItemFromBusinessStorage": "bierze {1} z magazynu biznesu",
- "TakeItemFromBusiness": "bierze {1} z biznesu",
- "TakeItemFromItem": "bierze {1} z {2}",
- "TakeItemFromVehicleTrunk": "bierze {1} z bagażnika",
- "TakeItemFromVehicleDash": "bierze {1} ze schowka",
- "JobEquipmentInventoryKeyBindTip": "Wyposażenie służbowe jest w twoim ekwipunku. Naciśnij {1} aby je zobaczyć.",
- "JobEquipmentInventoryCommandTip": "Wyposażenie służbowe jest w twoim ekwipunku. Użyj {1} aby je zobaczyć.",
- "AccountHelp": [
- "NIE PODAWAJ nikomu swojego hasła. {1} nigdy nie zapyta cię o twoje hasło",
- "Użyj {1} aby zmienić swoje hasło i {2} jeżeli je zapomniałeś",
- "Kilka ustawień które możesz użyć: {1}"
- ],
- "VehicleHelp": [
- "Twoje osobiste auta zapisują się za każdym razem jak ktoś wyjdzie z gry!",
- "Odwiedź dealera samochodów, aby zakupić pojazd (Użyj {1} po więcej informacji)",
- "Kilka komend: {1}",
- "Odwiedź warsztat mechanika aby naprawić, pokolorować i/lub ulepszyć swój pojazd! {1} po więcej informacji"
- ],
- "VehicleDealershipHelp": [
- "Odwiedź dealera samochodów, aby zakupić nowy pojazd. Użyj {1} aby jednego zlokalizować.",
- "Przy dealerze samochodów, wejdź do auta, które chcesz kupić i ukaże ci się jego cena.",
- "Jeśli chcesz kupić pojazd, użyj {1} i dostanie kluczyki by przetestować je na parkingu.",
- "Odjedź od dealera samochodów, aby potwierdzić zakup pojazdu."
- ],
- "JobHelp": [
- "Odwiedzaj miejsca pracy aby zarabiać pieniądze. Szkuaj zółtych punktów na mapie",
- "Przy miejscu pracy, użyj {1} aby zdobyć prace. Użyj {2} by opuścić swoją pracę",
- "Użyj {1} aby zacząć pracę. Możesz też dostać pracę {2} i {3}",
- "Większość pojazdów służbowych jest zamknięta. Użyj {1} obok niego aby do niego wsiąść.",
- "Przy wsiadaniu do pojazdu służbowego, dostaniesz informacje jak wykonać podjętą pracę."
- ],
- "ChatHelp": [
- "Są 2 główne rodzaje chatów: Poza postacią (OOC) i w postaci (IC)",
- "Mieszanie tych 2 rodzajów jest nieprawidłowym roleplay'em. Zobacz {1} po więcej informacji.",
- "Kilka komend na chacie: {1}",
- "Niektóre mają dostępne krótsze nazwy ({1} by rozmawiać, {2} by krzyczeć, itp.)"
- ],
- "ServerRulesHelp": [
- "Nierealistyczne akcje (powergaming) są niedozwolone. Nie jesteś superman'em.",
- "Roleplay na tle terrorystycznym jest niedozowolony.",
- "Zawszę słuchaj się administracji.",
- "Nie mieszaj czatów (metagaming). Nie możesz używać informacji w postaci, jeżeli uzyskałeś je poza nią.",
- "Używaj języka angielskiego na głównych chatach. Jeżeli nie jestes dobry z angielskiego, użyj {1}"
- ],
- "AnimationHelp": [
- "Animacje pozwalają ci bardziej wczuć się w swoją role.",
- "Używaj {1} lub {2} z nazwą by użyć animacji.",
- "By zobaczyć liste animacji, użyj {1}"
- ],
- "WeaponHelp": [
- "Odwiedź sklep z bronią, aby kupić nową broń. Użyj {1} by znaleźć taki sklep.",
- "Musisz posiadać licenje na broń, aby takową kupić.",
- "Licencje broni są wydawanie przez policję. Zaaplikuj się tam, aby taką zdobyć.",
- "Bronie mogą być też kupowane nielegalnie od niektórych bizensów, dealerów broni i klanów."
- ],
- "SkinHelp": [
- "W sklepie z ubraniami, użyj {1} aby kupić ubrania.",
- "Kiedy masz ubrania, wyposaż się w nie i użyj je jak każdy inny przedmiot by ukazać modyfikacje postaci (sprawdź {1} aby zobaczyć jak używać itemy)",
- "Niektóre skiny są dostępne tylko dla niektórych osób, klanów lub z innych powodów."
- ],
- "KeyBindHelp": [
- "Możesz zmienić przypisania klawiszy. Użyj {1} aby zobaczyć twoje przypisane klawisze.",
- "Użyj {1} aby dodać nowe przypisanie i {2} aby je usunąć.",
- "Domyślnymi przyciskami są: {1} aby uruchomić pojazd, {1} aby użyć świateł, and {3} aby otworzyć/zamknąć pojazd",
- "Naciśnij {1} aby zobaczyć swoje itemy i {2} aby wyposażyć się w jakiś przedmiot lub {3} aby go schować.",
- "Naciśnij {1} aby użyć przedmiot, który trzymasz, naciśnij {2} aby go upuścić lub naciśnij {3} aby podnieść jakiś przedmiot z ziemi."
- ],
- "BusinessHelp": [
- "Użyj {1} aby kupować przedmioty lub {2} aby zobaczyć listę co jest na sprzedaż w jakimkolwiek bizensie.",
- "Biznesy mają niebieskie nazwy nad ikoną przy ich wejściu.",
- "Komendy właściciela biznesu: {1}",
- "Nowe auto na sprzedaż pojawi się po odjechaniu od dealera samochodów."
- ],
- "ClanHelp": [
- "Zapytaj administratora o stworzenie klanu (Podobne do fakcji/grup/rodzin)",
- "Właściciele klanu mają pełną kontrole over nad ich klanem od momentu gdy jest stworzony",
- "Komendy klanu: {1}",
- "Więcej komend klanu: {1}"
- ],
- "RadioStationHelp": [
- "Użyj {1} by ustawić stację twojego auta, mieszkania lub biznesu",
- "Użyj {2} by zobaczyć listę stacji",
- "Możesz zmienić głośność swojego radia używając {1} i liczbą od 0 do 100 jako procenty"
- ],
- "WealthAndTaxHelp": [
- "Twoje podatki przy wypłacie są {1} procentami twojego przeliczonego bogactwa.",
- "Twoja przeliczone bogactwo jest obliczone wliczając twoje pojazdy, mieszkania i biznesy, które posiadasz.",
- "Każdy pojazd jest {1}, każde mieszkanie jest {2} i każdy biznes jest {3}",
- "Użyj {1} aby zobaczyć swoje bogactow i {2} zobaczyć ile będziesz musiał zapłacić przy następnej wypłacie"
- ],
- "MustBeInAVehicle": "Musisz być w pojeździe!",
- "MustBeInOrNearVehicle": "Musisz być w lub obok pojazdu!",
- "MustBeInVehicleFrontSeat": "Musisz być w przednim siedzeniu pojazdu!",
- "MustBeInVehicleDriverSeat": "Musisz być kierowcą pojazdu!",
- "DontHaveVehicleKey": "Nie masz klucza do tego pojazdu!",
- "NoGateAccess": "Nie masz dostępu do tej bramy!",
- "GateBroken": "Ta brama jest popsuta!",
- "GateHacked": "Ta brama nie odpowiada!",
- "RadioJammed": "Słysysz tylko szumy z radia.",
- "VehicleNotForSale": "To auto nie jest na sprzedaż!",
- "VehicleNotForRent": "Tego pojazdu nie można wypożyczyć!",
- "BusinessNotForSale": "Ten biznes nie jest na sprzedaż!",
- "BusinessNotForRent": "Tego biznesu nie można wypożyczyć!",
- "HouseNotForSale": "This house is not for sale!",
- "HouseNotForRent": "Tego biznesu nie można wypożyczyć!",
- "DealershipPurchaseTestDrive": "Odjedź pojazdem od dealera samochodów aby go kupić, lub wysiądź aby anulować zakup.",
- "DealershipPurchaseExitedVehicle": "Anulowałeś kupno pojazdu, ponieważ wysiadłeś z pojazdu!",
- "VehiclePurchaseComplete": "Ten pojazd jest teraz twój, zapiszę się nieważne gdzie jest.",
- "VehiclePurchaseNotEnoughMoney": "Nie masz wystarczająco dużo funduszy aby kupić to auto!",
- "HousePurchaseNotEnoughMoney": "Nie masz wystarczająco dużo funduszy aby kupić to mieszkanie!",
- "BusinessPurchaseNotEnoughMoney": "Nie masz wystarczająco dużo funduszy aby kupić ten biznes!",
- "Locales": {
- "English": "Angielski",
- "Russian": "Rosyjski",
- "Spanish": "Hiszpański",
- "German": "Niemiecki",
- "Dutch": "Holenderski",
- "Polish": "Polski"
- },
-
- "ADDED-21JAN2022": "DO NOT TRANSLATE. This string is just a comment to separate newly added translations.",
- "HeaderPlayerHousesList": "Mieszkania Gracza ({1})",
- "HeaderPlayerStaffFlagsList": "Flagi Administracji ({1})",
- "HeaderStaffFlagsList": "Flagi Administracji",
- "NonRPName": "Nieprawidłowa nazwa roleplay! Wybierz nową:",
- "InvalidStaffFlag": "Flaga administracji nie znaleziona!",
- "InvalidClanFlag": "Flaga klanu nie znaleziona!",
- "InvalidLocale": "Język nie znaleziony!",
- "HeaderJobUniformList": "Mundury robocze ({1})",
- "HeaderJobEquipmentList": "Wyposażenie robocze ({1})",
- "InvalidJobUniform": "Mundur roboczy nie znaleziony!",
- "InvalidJobEquipment": "Wyposażenie robocze nie znalezione!",
- "HeaderVehiclesInRangeList": "Pojazdy w {1}",
- "NoVehiclesWithInRange": "Nie ma pojazdów w {1}",
- "AmountNotNumber": "Ilość musi być liczbą!",
- "NeedToBeWorking": "Musisz być w pracy! Użyj {1} w punkcie pracy lub obok pojazdu służbowego.",
- "NeedToBeOnJobRoute": "Musisz być w trasie! Użyj {1} w pojeździe służbowym",
- "CurrentJobRouteDeleted": "Trasa służbowa, którą jechałeś została usunięta przez Administratora",
- "CurrentJobRouteVehicleColoursChanged": "Kolory pojazdów na twojej trasie zostały zmienione przez Administratora.",
- "NotYourJob": "To nie twoja praca!",
- "JobPoints": "Możesz zdobyć pracę udając się do żółtych punktów na mapie.",
- "QuitJobToTakeAnother": "Jeżeli chcesz tą prace, użyj {1} aby opuścić swoją dotychczasową pracę.",
- "NotAJobVehicle": "To nie jest pojazd służbowy!",
- "NotYourJobVehicle": "To nie jest twój pojazd służbowy!",
- "JobRouteDisabled": "Trasa służbowa, którą jechałeś została usunięta przed Administratora",
- "HeaderPickupTypes": "Rodzaję Pickup'ów",
- "HeaderBlipTypes": "Rodzaje Ikon Mapy",
- "InvalidGPSLocation": "Nie ma lokalizacji z taką nazwą lub rodzajem",
- "HeaderBusinessList": "Biznesy",
- "VehicleForSale": "Ten {1} jest do kupienia za {2}! Użyj {3} jeżeli chcesz go kupić",
- "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.",
-
- "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 List",
- "ViewInventoryKeyPressTip": "Press {1} to see your items",
- "ViewInventoryCommandTip": "Use {1} to see your items"
-}
diff --git a/locale/russian.json b/locale/russian.json
deleted file mode 100644
index 82a535d2..00000000
--- a/locale/russian.json
+++ /dev/null
@@ -1,396 +0,0 @@
-{
- "TranslationProvidedBy": "VNDTTS",
- "LocaleEnglishName": "Russian",
- "LocaleNativeName": "Русский",
- "LocaleOffer": "Этот сервер доступен на русском. Используйте {1} чтобы его использовать.",
- "LocaleChanged1": "Ваш язык был установлен на {1}",
- "LocaleChanged2": "Этот сервер теперь будет показывать сообщения в {1}",
- "LocaleChangedNote": "Это не влияет на сообщения других игроков",
- "AccentsListHeader": "Акценты",
- "HeaderHelpMainList": "Помощь Категории",
- "AccentNotFound": "Не удалось найти акцент",
- "AccentSet": "Вы установили свой акцент на {1}",
- "AnimationNotFound": "Такой анимации не существует",
- "AnimationCommandTip": "Используйте {1} чтобы просмотреть список доступных анимаций",
- "AnimationInvalidDistance": "Дистанция должна быть между 0 и 3",
- "AnimationStopCommandTip": "Используйте {1} чтобы остановить анимацию",
- "CantBanClient": "Вы не можете забанить этого игрока",
- "PlayerAccountBanned": "Аккаунт {1} был заблокирован ",
- "ClanNotFound": "Не удалось найти клан",
- "ClanNameTaken": "Клан с таким именем уже существует",
- "PlayerNotFound": "Не удалось найти игрока",
- "ClanCantRemoveRanks": "Вы не можете убрать ранги клана",
- "ClanCantAddRanks": "Вы не можете добавить новые ранги клана",
- "ClanRankNotFound": "Не удалось найти ранг клана",
- "ClanCantChangeMemberTag": "Вы не можете изменить теги членов клана",
- "ClanPlayerNotInSameClan": "Игрок не в вашем клане",
- "ClanCantChangeRankLevel": "Вы не можете изменить уровень ранга клана",
- "ClanCantChangeRankTag": "Вы не можете изменить теги ранга клана",
- "NameNotRegistered": "Ваше имя не зарегестрировано! Используйте {1} чтобы создать аккаунт.",
- "AutomaticLoginIPToggle": "Автоматический вход по IP теперь {1}",
- "CouldNotRegisterAccount": "Возникла проблема при создании аккаунта. Пожалуйста свяжитесь с администратором.",
- "RandomTipsToggle": "Случайные подсказки теперь {1}",
- "ActionTipsToggle": "Местные подсказки теперь {1}",
- "AutoSpawnLastCharToggle": "Автоматическое возрождение как последний выбраный персонаж теперь {1}",
- "AccountGUISettingToggle": "GUI теперь {1}",
- "On": "Включен",
- "Off": "Выключен",
- "Yes": "Да",
- "No": "Нет",
- "True": "Верно",
- "False": "Неверно",
- "Locked": "Закрыто",
- "Unlocked": "Открыто",
- "PasswordNotGoodEnough": "Новый пароль должен соответсвовать требованиям !",
- "PasswordNeedsBase": "Пароль должен местить не меншьше {1}",
- "PasswordNeedsCapitals": "{1} Заглавные буквы",
- "PasswordNeedsNumbers": "{1} цифры",
- "PasswordNeedsSymbols": "{1} символы",
- "PasswordsDontMatch": "Новый пароль и его подтверджение не совпадают!",
- "PasswordChanged": "Ваш пароль был изменен!",
- "AutoLoggedInIP": "Вы автоматически войшли по IP!",
- "WelcomeBack": "Добро пожаловать {1}, {2}! Используйте {3} чтобы продолжить.",
- "WelcomeNewPlayer": "Добро пожаловать в {1}, {2}! Используйте {3} чтобы начать играть.",
- "InvalidPlayer": "Не удалось найти игрока!",
- "InvalidBusiness": "Не удалось найти бизнес!",
- "InvalidHouse": "Не удалось найти дом!",
- "InvalidVehicle": "Не удалось найти транспорт!",
- "InvalidClan": "Не удалось найти клан!",
- "InvalidClanRank": "Не удалось найти ранг клана!",
- "InvalidJob": "Не удалось найти работу!",
- "InvalidItem": "Не удалось найти предмет!",
- "InvalidItemType": "Не удалось найти предмет!",
- "InvalidRadioStation": "Не удалось найти радиостанцию!",
- "InvalidGate": "Не удалось найти ворота!",
- "EntersProperty": "открывает дверь и входит в {1}",
- "ExitsProperty": "открывает дверь и покидает {1}",
- "EnterExitPropertyDoorLocked": "пытаеться открыть двери {1} но у него не выходить потому-что двери закрыты",
- "PropertyNoInterior": "У {1} нет доступного интерьера, но вы все еще можете использовать комманды стоя на значке возле входа.",
- "NoBusinessWithItemType": "Нет бизнесов в которых этот предмет доступен",
- "HeaderKeyBinds": "Привязки",
- "HeaderAccountHelp": "Помощь Аккаунт",
- "HeaderVehicleHelp": "Помощь Транспорт",
- "HeaderVehicleDealershipHelp": "Помощь Автосалон",
- "HeaderJobHelp": "Помощь Работа",
- "HeaderChatHelp": "Помощь Чат",
- "HeaderServerRules": "Правила Сервера",
- "HeaderWebsiteInfo": "Сайт",
- "HeaderDiscordInfo": "Discord",
- "HeaderAnimationsList": "Список Анимаций",
- "HeaderPayAndSprayHelp": "Помощь Pay 'n' Spray",
- "HeaderAmmunationHelp": "Помощь Аммунация",
- "HeaderVehicleTuneupHelp": "Помощь Тюнинг Автомобиля",
- "HeaderBindableKeysHelp": "Кнопки которые можно привязать",
- "HeaderSkinHelp": "Помощь Одежда/Облик",
- "HeaderBusinessHelp": "Помощь Бизнес",
- "HeaderClanHelp": "Помощь Клан",
- "HeaderPlayerVehiclesList": "Транспорт Игрока ({1})",
- "HeaderPlayerBusinessesList": "Бизнесы Игрока ({1})",
- "HeaderClansList": "Список кланов",
- "HeaderAdminsList": "Список администраторов",
- "HeaderBadgeInfo": "Информация значка",
- "HeaderAccentsList": "Список акцентов",
- "HeaderPlayerInfo": "Информация об игроке ({1})",
- "HeaderWealthandTaxHelp": "Информация о достатке и налогах",
- "HeaderCommandInfo": "Информация о команде ({1})",
- "HeaderRadioHelp": "Помощь Радио",
- "HeaderRadioStationsList": "Радиостанции",
- "HeaderKeyBindsList": "Список привязок",
- "RadioVolumeChanged": "{1} Вы сменили громкость звука на {2}%",
- "VolumeLevelNotNumber": "Уровень звука должен быть в цифрах",
- "RadioStationLocationInvalid": "Вы должны находится в транспорте, доме, или бизнесе или иметь устройство чтобы сменить радиостанцию!",
- "ActionBusinessRadioStationChange": "меняет радиостанцию бизнеса на {1} ({2})",
- "ActionHouseRadioStationChange": "меняет радиостанцию дома на {1} ({2})",
- "ActionVehicleRadioStationChange": "меняет радиостанцию транспорта на {1} ({2})",
- "ActionItemRadioStationChange": "переключает станцию {1} на станцию {2} ({3})",
- "RandomVehicleCommandsDisabled": "Это случайная машина трафика, команды на нее не работают.",
- "HouseDoorLock": "Дом {1} {2}!",
- "BusinessDoorLock": "Бизнес {1} {2}!",
- "ServerGameModeRestarting": "Режим игры сервера перезапускается!",
- "HeaderSelfItemList": "Ваш инвентарь",
- "HeaderPlayerItemList": "Инвентарь игрока ({1})",
- "HeaderHouseItemList": "Инвентарь дома",
- "HeaderBusinessFloorItemList": "Инвентарь бизнеса (Продажа)",
- "HeaderBusinessStorageItemList": "Инвертарь бизнеса (Хранилище)",
- "HeaderItemItemList": "Инвентарь {1}",
- "ItemSlotNotNumber": "Слот предмета должен быть цифрой",
- "ItemSlotMustBeBetween": "Слот этого предмета должен находиться между {1} и {2}!",
- "UseItemBugged": "Предмет который вы пытаетесь использовать забагован. Баг репорт был послан разработчикам сервера.",
- "PickupItemBugged": "Предмет который вы пытаетесь поднять забагован. Баг репорт был послан разработчикам сервера.",
- "DropItemBugged": "Предмет который вы пытаетесь выкинуть забагован. Баг репорт был послан разработчикам сервера.",
- "HandsBusy": "Ваши руки заняты",
- "CantUseItemInSkinChange": "Вы не можете использовать предметы когда вы меняете свой облик",
- "CantDropItemInSkinChange": "Вы не можете кидать предметы когда вы меняете свой облик",
- "CantPickupItemInSkinChange": "Вы не можете подбирать предметы когда вы меняете свой облик",
- "CantSwitchItemInSkinChange": "Вы не можете переключать предметы когда вы меняете свой облик",
- "CantGiveItemInSkinChange": "Вы не можете давать предметы когда вы меняете свой облик",
- "CantTakeItemInSkinChange": "Вы не можете брать предметы когда вы меняете свой облик",
- "ItemUnequippableNoAmmo": "{1} на слоте {2} не имеет патронов и не может быть экипирован!",
- "NoSpaceSelfInventory": "У вас не осталось места в инвентаре",
- "Business": "бизнес",
- "House": "дом",
- "Clan": "клан",
- "Vehicle": "транспорт",
- "Item": "предмет",
- "ItemType": "тип предмета",
- "Gate": "ворота",
- "Door": "двери",
- "ClanRank": "Ранг клана",
- "JobRank": "Ранг работы",
- "RadioStation": "радиостанция",
- "Months": [
- "Январь",
- "Февраль",
- "Март",
- "Апрель",
- "Май",
- "Июнь",
- "Июль",
- "Август",
- "Сентябрь",
- "Октябрь",
- "Ноябрь",
- "Декабрь"
- ],
- "WeekDays": [
- "Воскресенье",
- "Понедельник",
- "Вторник",
- "Среда",
- "Четверг",
- "Пятница",
- "Субота"
- ],
- "CardinalDirections": [
- "Север",
- "Северо-восток",
- "Восток",
- "Юго-восток",
- "Юг",
- "Юго-запад",
- "Запад",
- "Северо-запад"
- ],
- "NewPlayerReadyToPlay": [
- "Вам было надано немного денег. Используйте {1} чтобы найти места в которых можно купить предметы.",
- "Если вам нужны деньги, желтые точки это места работы на карте.",
- "Если вам нужен транспорт, посетите автосалон. Вы также можете использовать орендовочный транспорт возле начальной зоны или сесть на поезд",
- "Не забудьте ознакомиться с {1} и использовать {2} для информации."
- ],
- "YourCurrentVehicleDeleted": "Транспорт в котором вы находились было удалено.",
- "Distance": "Дистанция",
- "Meters": "Метров",
- "Feet": "Футов",
- "Kilometers": "Километры",
- "Miles": "Мили",
- "MustBeVehicleDriver": "Вы можете быть только водителем!",
- "PlayerJoinedServer": "{1} присоеденился к игре из {1}!",
- "PlayerLeftServer": "{1} покинул игру! ({1})",
- "DisconnectReasons": [
- "Потеряно соединение",
- "Отключен",
- "Неподерживаемый клинт",
- "Неправильная игра",
- "Неправильный пароль",
- "Неподдерживаемый Exe",
- "Disconnected",
- "Забанен",
- "Не удалось",
- "Не правильное имя",
- "Вылетел"
- ],
- "TakeItemFromHouse": "Берет {1} из дома",
- "TakeItemFromBusinessStorage": "Берет {1} из хранилища",
- "TakeItemFromBusiness": "Берет {1} из бизнеса",
- "TakeItemFromItem": "Достает {1} из {2}",
- "TakeItemFromVehicleTrunk": "Достает {1} из багажника",
- "TakeItemFromVehicleDash": "Достает {1} из бардачка",
- "JobEquipmentInventoryKeyBindTip": "Рабочее снаряжение у вас в инвентаре. Нажмите {1} чтобы его просмотреть.",
- "JobEquipmentInventoryCommandTip": "Рабочее снаряжение у вас в инвентаре. Используйте {1} чтобы его просмотреть.",
- "AccountHelp": [
- "Не предоставляйте свой пароль никому. {1} персонал никогда не будет спрашивать у вас пароль ",
- "Используйте {1} чтобы изменить ваш пароль, и {2} если вы его забыли",
- "Некоторые опции: {1}"
- ],
- "VehicleHelp": [
- "Ваш личный транспорт будет сохранен в любом месте где вы, или кто-либо другой его оставит!",
- "Посетите автосалон чтобы приобрести новый транспорт (Используйте {1} чтобы увидеть больше информации)",
- "Некоторые комманды: {1}",
- "Посетите гараж механика чтобы починить, изменить цвет, и затюнинговать ваш автомобиль! {1} для информации"
- ],
- "VehicleDealershipHelp": [
- "Посетите автосалон чтобы приобрести новый транспорт. Используйте {1} чтобы найти его.",
- "Ввойдите в транспорт который вы хотите приобрести, и цена на него будет вам показана",
- "Если хотите приобрести транспорт, используйте {1} и вам дадут ключи чтобы провести тест-драйв на парковке.",
- "Покиньте автосалон на вашем новом транспорте чтобы подвердить покупку."
- ],
- "JobHelp": [
- "Посетите места работы, получите работу и зарабатывайте деньги. Ищите желтые точки на карте",
- "На месте работы, используйте {1} чтобы получить работу. Используйте {2} чтобы оставить работу",
- "Используйте {1} чтобы начать работать. Вы также можете получить работу {2} и {3}",
- "Большинство рабочего транспорта изначально закрыто. Используйте {1} находясь возле него чтобы войти.",
- "Во время входа в рабочий транспорт, информация о том, как работать будет вам предоставлена."
- ],
- "ChatHelp": [
- "Существуют два основных типов чата: внутри персонажа и вне его",
- "Смешивать их не считается полноценной ролевой игрой. Просмотрите {1} для информации.",
- "Некоторые комманды чата: {1}",
- "Некоторые имеют укороченые версии ({1} чтобы говорить, {2} чтобы выкрикивать, и так далее)"
- ],
- "ServerRulesHelp": [
- "Нереалистичные действия запрещены. Вы не супермен.",
- "Ролевая игра за террориста и терроризм запрещены.",
- "Всегда следуйте соблюдайте инструкии даные модератором или администратором.",
- "Вам не позволяется использовать информацию полученую вне персонажа, персонажем ",
- "Пожалуйста придерживаетесь английского в главном чате, если вы плохо знаете английский, используйте {1}"
- ],
- "AnimationHelp": [
- "Анимации позволяют вам улучшить составляющую ролевой игры с помощью визуальных действий",
- "Используте {1} или {2} с названием тобы применить анимацию.",
- "Чтобы просмотреть список доступных анимаций, используйте {1}"
- ],
- "WeaponHelp": [
- "Посетите магазин оружия что-бы приобрести оружие. Используйте {1} чтобы найти.",
- "Оружие невозможно купить без лицензии.",
- "Лицензиями на оружие занимается отделение полиции. Обратитесь туда чтобы заполучить лицензию.",
- "Оружие также может быть приобретено нелегально от некоторых бизнесов, торговцев оружием, и кланов."
- ],
- "SkinHelp": [
- "В магазине одежды используйте {1} чтобы купить одежду",
- "Когда у вас есть предмет одежды, экипируйте его и используйте его как любой другой предмет чтобы просмотреть меню выбора облика персонажа (Просмотрите {1} чтобы научиться использовать предметы)",
- "Некоторые облики ограничены только для некоторых работ, кланов, или по каким-то другим причинам."
- ],
- "KeyBindHelp": [
- "Вы можете сами создавать ваши привязки на кнопки. Используйте {1} чтобы просмотреть ваши привязки.",
- "Используйте {1} чтобы добавить новую приязку или {2} чтобы убрать ее.",
- "Стандартные привязки: {1} для мотора, {1} для фар, и {3} для открытия/закрытия",
- "Используйте {1} чтобы просмотреть ваши предметы {2} чтобы экипировать предмет или {3} чтобы убрать.",
- "Используйте {1} чтобы использвать предмет который вы держите в руках, используйте {2} чтобы его выбростить, или используйте {3} чтобы подобрать предмет."
- ],
- "BusinessHelp": [
- "Используйте {1} чтобы покупать предметы или {2} чтобы просмотреть список того, что продаеться в любом бизнесе",
- "Бизнесы имеют их названия синим цветом над иконкой возле входа.",
- "Комманды владельца бизнеса: {1}",
- "Новый автомобиль появится после того как вы уедете из автосалона."
- ],
- "ClanHelp": [
- "Попросите администратора чтобы основать клан",
- "Владельцы клана имеют полный контроль над ихним кланом после его основания",
- "Комманды клана: {1}",
- "Больше комманд клана: {1}"
- ],
- "RadioStationHelp": [
- "Используйте {1} чтобы выбрать радиостанцию для вашего траспорта, дома, или бизнеса",
- "Используйте {2} чтобы просмотреть список радиостанций",
- "Вы можете изменить громкость радио используя {1} с 0-100 в качестве процентов"
- ],
- "WealthAndTaxHelp": [
- "Вы платите {1} процентов от вашего расчетного уровня достатка.",
- "Ваш расчетный уровень достатка зависит от того, сколько вам принадлежит транспорта, домов и бизнесов.",
- "Каждый транспорт это {1}, каждый дом это {2}, И каждый бизнес это {3}",
- "Используйте {1} чтобы просмотреть ваш текущий достаток, и {2} чтобы просмотреть сколько вы платите налогов с каждой зарплаты"
- ],
- "MustBeInAVehicle": "Вы должны быть внутри транспорта!",
- "MustBeInOrNearVehicle": "Вы должны быть возле транспорта!",
- "MustBeInVehicleFrontSeat": "Вы можете сидеть только спереди!",
- "MustBeInVehicleDriverSeat": "Вы можете быть только водителем!",
- "DontHaveVehicleKey": "У вас нет ключей к этому транспорту!",
- "NoGateAccess": "У вас нет доступа к воротам!",
- "GateBroken": "Эти ворота сломаны!",
- "GateHacked": "Ворота не отвечают!",
- "RadioJammed": "Из радио доносится лишь шум.",
- "VehicleNotForSale": "Этот транспорт не продается!",
- "VehicleNotForRent": "Этот транспорт не сдается в оренду! ",
- "BusinessNotForSale": "Этот бизнес не продается!",
- "BusinessNotForRent": "Этот бизнес не сдается в оренду!",
- "HouseNotForSale": "Этот дом не продаеться!",
- "HouseNotForRent": "Этот дом не сдаеться в оренду!",
- "DealershipPurchaseTestDrive": "Уедьте из автосалона чтобы подтвердить покупку транспорта, или выйдете из него чтобы отменить.",
- "DealershipPurchaseExitedVehicle": "Вы отменили покупку транспорта покинув его!",
- "VehiclePurchaseComplete": "Этот транспорт теперь принадлежит вам! Он останется там где вы его оставили.",
- "VehiclePurchaseNotEnoughMoney": "у вас недостаточно денег для покупки этого транспорта!",
- "HousePurchaseNotEnoughMoney": "У вас недостаточно денег для покупки этого дома!",
- "BusinessPurchaseNotEnoughMoney": "У вас недостаточно денег для покупки этого бизнеса!",
- "Locales": {
- "English": "Английский",
- "Russian": "Русский",
- "Spanish": "Испанский",
- "German": "Немецкий",
- "Dutch": "Нидерландский"
- },
-
- "ADDED-21JAN2022": "DO NOT TRANSLATE. This string is just a comment to separate newly added translations.",
- "HeaderPlayerHousesList": "Дома Игрока ({1})",
- "HeaderPlayerStaffFlagsList": "Флаги игрока персонала ({1})",
- "HeaderStaffFlagsList": "Флаги персонала",
- "NonRPName": "Ваше имя не подходит для ролевой игры! Выберете другое:",
- "InvalidStaffFlag": "Не удалось найти флаг персонала!",
- "InvalidClanFlag": "Не удалось найти флаг клана!",
- "InvalidLocale": "Не удалось найти язык!",
- "HeaderJobUniformList": "Рабочие униформы ({1})",
- "HeaderJobEquipmentList": "Рабочие снаряжение ({1})",
- "InvalidJobUniform": "Не удалось найти рабочую униформу!",
- "InvalidJobEquipment": "Не удалось найти рабочее снаряжение!",
- "HeaderVehiclesInRangeList": "Транспорт в пределах {1}",
- "NoVehiclesWithInRange": "Нет транспорта в пределах {1}",
- "AmountNotNumber": "Количество должно быть введено цифрой!",
- "NeedToBeWorking": "Вы должны быть на работе! Используйте {1} на месте работы или возле рабочего транспорта.",
- "NeedToBeOnJobRoute": "Вы должны быть на рабочем маршруте! Используйте {1} в рабочем транспорте",
- "CurrentJobRouteDeleted": "Рабочий маршрут на котором вы находились был удален администратором",
- "CurrentJobRouteVehicleColoursChanged": "Цвет транспорта на маршруте был изменен администратором",
- "NotYourJob": "Это работа пренадлежит не вам!",
- "JobPoints": "Вы можете устроиться на работу ориентируясь по желтым значкам на карте.",
- "QuitJobToTakeAnother": "Если хотите покинуть работу, ипользуйте {1}.",
- "NotAJobVehicle": "Это не рабочий транспорт!",
- "NotYourJobVehicle": "Этот транспорт пренадлежит не вашей работе!",
- "JobRouteDisabled": "Рабочий маршрут на котором вы были был удален администратором",
- "HeaderPickupTypes": "Типы подбираемых предметов",
- "HeaderBlipTypes": "Типы иконок карты",
- "InvalidGPSLocation": "Не существует локаций с таки именем или такого типа",
- "HeaderBusinessList": "Бизнесы",
- "VehicleForSale": "Этот {1} можно купить за {2}! Используйте {3} если хотите его купить",
- "VehicleForRent": "Этот {1} может быть орендован за {2}! Используйте {3} если хотите его орендовать",
-
- "ADDED-31JAN2022": "DO NOT TRANSLATE. This string is just a comment to separate newly added translations.",
- "LoginFailedInvalidPassword": "Неправельный пароль! Осталось {1} попыток",
- "LoginFailedNoPassword": "Вы должны ввести пароль! Осталось {1} попыток",
- "RegistrationFailedNoPassword": "Вы должны ввести пароль!",
- "RegistrationFailedNoPasswordConfirm": "Вы должны подтвердить пароль!",
- "RegistrationFailedNoEmail": "Вы должны ввести адрес электронной почты!",
- "AccountNameAlreadyRegistered": "Ваше имя уже зарегистрировано!",
- "AlreadyLoggedIn": "Вы уже вошли!",
- "RegistrationFailedInvalidEmail": "Такого адреса не существует!",
- "RegistrationFailedPasswordMismatch": "Пароли не совпадают!",
- "RegistrationFailedCreateError": "Не удалось создать аккаунт!",
- "RegistrationSuccess": "Ваш аккаунт был успешно создан!",
- "RegistrationEmailVerifyReminder": "Не забудьте подтвердить ваш электронный адрес, код подверждения был послан вам на электронную почту.",
- "RegistrationCreateCharReminder": "Чтобы играть на сервере, вам нужно будет создать персонажа.",
- "NoCharactersGUIMessage": "У вас нет персонажей. Не хотите создать?",
- "NoCharactersGUIWindowTitle": "Нет персонажей",
- "NoCharactersChatMessage": "У вас нет персонажей. Используйте {1} чтобы создать.",
- "NeedEmailFor2FA": "Вам нужно добавить ваш адрес электронной почты чтобы использовать двухфакторную аунтентификацию.",
- "NeedEmailVerifiedFor2FA": "Вам нужно подтвердить вашу электронную почту чтобы использовать двухфакторную аунтентификацию.",
- "SetEmailHelpTip": "Используйте {1} чтобы установить ваш адрес электронной почты.",
- "VerifyEmailHelpTip": "Используйте {1} чтобы подтвердить ваш адрес электронной почты.",
-
- "ADDED-13FEB2022": "DO NOT TRANSLATE. This string is just a comment to separate newly added translations.",
- "NearbyRadio": "Ближайшее радио",
- "FromRadio": "Из радио",
- "ToRadio": "В радио",
- "NeedToEnterPropertyCommand": "Вам нужно сначало ввести {1}! Используйте {2} чтобы выйти",
- "NeedToEnterPropertyKeyPress": "Вам нужно сначало ввести {1}! Используйте {2} чтобы выйти",
- "InventoryFullCantCarry": "У вас недостаточно места в инвентаре(Инвентарь заполнен)!",
- "NotEnoughCashNeedAmountMore": "У вас недостаточно денег! У вас не хватает {1}!",
- "AmountMustBeMoreThan": "Количество должно быть больше {1}!",
- "WeaponBanned": "Вам нельзя покупать оружие!",
- "TimeNotNumber": "Время должно быть назначено цифрой",
- "HeaderDefaultBusinessItemTypes": "Шаблоны предметов бизнеса",
- "FixingStuck": "Исправляет вашу текущую позицию и виртуальный мир ...",
- "CantUseCommandYet": "Подождите некоторое время перед тем как использовать комманду снова!",
- "NotATester": "Вы не тестировщик!",
- "AccessDenied": "Доступ запрещен",
- "InvalidSkin": "That skin is invalid!",
- "HeaderInteriorTypes": "Interiors List",
- "ViewInventoryKeyPressTip": "Press {1} to see your items",
- "ViewInventoryCommandTip": "Use {1} to see your items"
-}
diff --git a/locale/spanish.json b/locale/spanish.json
deleted file mode 100644
index 7562b925..00000000
--- a/locale/spanish.json
+++ /dev/null
@@ -1,401 +0,0 @@
-{
- "TranslationProvidedBy": "PerikiyoXD",
- "LocaleEnglishName": "Español",
- "LocaleNativeName": "Inglés",
- "LocaleOffer": "Este servidor se encuentra disponible en Español. Utilice {1} para usarlo",
- "LocaleChanged1": "El idioma se ha configurado a {1}",
- "LocaleChanged2": "El servidor mostrará los mensajes en {1}",
- "LocaleChangedNote": "Esto no cambia los mensajes de otros jugadores",
- "AccentsListHeader": "Acentos",
- "HelpListHeader": "Categorías de ayuda",
- "HelpSkinHeader": "Ayuda de personajes",
- "HelpVehicleHeader": "Ayuda de vehículos",
- "HelpBusinessHeader": "Ayuda de negocios",
- "HelpHouseHeader": "Ayuda de casas",
- "HelpRadioHeader": "Ayuda de radio",
- "HelpAnimationHeader": "Ayuda de animaciones",
- "AccentNotFound": "Acento no encontrado",
- "AccentSet": "Acento establecido como {1}",
- "AnimationNotFound": "Esa animación no existe",
- "AnimationCommandTip": "Usa {1} para ver la lista de animaciones",
- "AnimationInvalidDistance": "La distancia debe ser un numero entre el 0 y el 3",
- "AnimationStopCommandTip": "Usa {1} para detener la animación actual",
- "CantBanClient": "No se puede vetar a esta persona",
- "PlayerAccountBanned": "La cuenta de {1} ha sido vetada",
- "ClanNotFound": "Clan no encontrado",
- "ClanNameTaken": "Ya existe un clan con ese nombre",
- "PlayerNotFound": "Jugador no encontrado",
- "ClanCantRemoveRanks": "No puedes eliminar rangos del clan",
- "ClanCantAddRanks": "No puedes añadir rangos del clan",
- "ClanRankNotFound": "No se encontró el rango del clan indicado",
- "ClanCantChangeMemberTag": "No puedes cambiar las etiquetas del miembro del clan",
- "ClanPlayerNotInSameClan": "El jugador indicado no está en tu clan",
- "ClanCantChangeRankLevel": "No puedes cambiar el nivel del rango del clan",
- "ClanCantChangeRankTag": "No puedes cambiar la etiqueta del rango del clan",
- "NameNotRegistered": "¡Tu nombre no está registrado! Usa {1} para crear una cuenta",
- "AutomaticLoginIPToggle": "Se ha {1} el inicio de sesión automático por IP",
- "CouldNotRegisterAccount": "Hubo un problema al crear su cuenta. Por favor, póngase en contacto con un administrador",
- "RandomTipsToggle": "Se han {1} los Consejos aleatorios",
- "ActionTipsToggle": "Se han {1} los Consejos de acción",
- "AutoSpawnLastCharToggle": "Se ha {1} reaparecer con el ultimo personaje usado",
- "AccountGUISettingToggle": "Se ha {1} la Interfaz de Usuario",
- "On": "Encendido",
- "Off": "Apagado",
- "Yes": "Si",
- "No": "No",
- "True": "True",
- "False": "False",
- "Locked": "Locked",
- "Unlocked": "Unlocked",
- "PasswordNotGoodEnough": "La nueva contraseña debe cumplir los requisitos",
- "PasswordNeedsBase": "Las contraseñas deben tener al menos {1}",
- "PasswordNeedsCapitals": "{1} letras mayúsculas",
- "PasswordNeedsNumbers": "{1} números",
- "PasswordNeedsSymbols": "{1} símbolos",
- "PasswordsDontMatch": "La nueva contraseña y la confirmación de la nueva contraseña no son iguales.",
- "PasswordChanged": "Su contraseña ha sido cambiada",
- "AutoLoggedInIP": "Ha iniciado la sesion automáticamente por su IP",
- "WelcomeBack": "¡Bienvenidos de nuevo a {1}, {2}! Por favor, {3} para continuar",
- "WelcomeNewPlayer": "¡Bienvenido a {1}, {2}! Por favor, {3} para jugar",
- "InvalidPlayer": "Jugador no encontrado",
- "InvalidBusiness": "Negocio no encontrada",
- "InvalidHouse": "Casa no encontrada",
- "InvalidVehicle": "Vehículo no encontrado",
- "InvalidClan": "Clan no encontrado",
- "InvalidClanRank": "Rango del clan no encontrado",
- "InvalidJob": "Trabajo no encontrado",
- "InvalidItem": "Objeto no encontrado",
- "InvalidItemType": "Tipo de objeto no encontrado",
- "InvalidRadioStation": "Estación de radio no encontrada",
- "InvalidGate": "Puerta no encontrada",
- "EntersProperty": "abre la puerta y entra en el {1}",
- "ExitsProperty": "abre la puerta y sale del {1}",
- "EnterExitPropertyDoorLocked": "intenta abrir la puerta {1} pero no lo consigue porque está cerrada",
- "PropertyNoInterior": "Este {1} no tiene un interior, pero todavía puede utilizar los comandos en el icono de la puerta",
- "NoBusinessWithItemType": "No hay ningun negocio con ese objeto disponible",
- "HeaderKeyBinds": "Atajos de teclado",
- "HeaderAccountHelp": "Account Help",
- "HeaderVehicleHelp": "Vehicle Help",
- "HeaderVehicleDealerships": "Ayuda del Concesionario de Vehiculos",
- "HeaderJobHelp": "Ayuda del Trabajo",
- "HeaderChatHelp": "Ayuda del Chat",
- "HeaderServerRules": "Reglas del Servidor",
- "HeaderWebsiteInfo": "Sitio Web",
- "HeaderDiscordInfo": "Discord",
- "HeaderAnimationsList": "Lista de animaciones",
- "HeaderPayAndSprayHelp": "Ayuda de 'Pay and Spray'",
- "HeaderAmmunationHelp": "Ayuda de 'Ammunation'",
- "HeaderVehicleTuneupHelp": "Ayuda de Puesta a punto del vehículo",
- "HeaderBindableKeysHelp": "Atajos de teclado",
- "HeaderSkinHelp": "Ayuda de Ropa/Personaje",
- "HeaderBusinessHelp": "Ayuda del negocio",
- "HeaderClanHelp": "Ayuda del clan",
- "HeaderPlayerVehiclesList": "Vehiculos del jugador ({1})",
- "HeaderPlayerBusinessesList": "Negocios del jugador ({1})",
- "HeaderClansList": "Lista de clanes",
- "HeaderAdminsList": "Lista de administradores",
- "HeaderBadgeInfo": "Información de la placa",
- "HeaderAccentsList": "Lista de acentos",
- "HeaderPlayerInfo": "Información del jugador ({1})",
- "HeaderWealthandTaxHelp": "Información sobre el patrimonio y los impuestos",
- "HeaderCommandInfo": "Información de comando ({1})",
- "HeaderRadioHelp": "Ayuda para la radio",
- "HeaderRadioStationsList": "Emisoras de radio",
- "HeaderKeyBindsList": "Lista de atajos de teclado",
- "RadioVolumeChanged": "{1} Has cambiado el volumen de tu radio en directo a {2}%",
- "VolumeLevelNotNumber": "El volumen debe ser un número",
- "RadioStationLocationInvalid": "Debe estar en un vehículo, casa o negocio o tener un dispositivo personal para cambiar la emisora",
- "ActionBusinessRadioStationChange": "cambia la emisora de la radio del negocio a {1} ({2})",
- "ActionHouseRadioStationChange": "cambia la emisora de la radio de la casa a {1} ({2})",
- "ActionVehicleRadioStationChange": "cambia la emisora de la radio del vehículo a {1} ({2})",
- "ActionItemRadioStationChange": "cambia la estación de {1} a {2} ({3})",
- "RandomVehicleCommandsDisabled": "Este es un vehículo de tráfico aleatorio y los comandos no se pueden utilizar en él",
- "HouseDoorLock": "Casa {1} {2}!",
- "BusinessDoorLock": "Negocio {1} {2}!",
- "ServerGameModeRestarting": "El modo de juego del servidor se reinicia",
- "HeaderSelfItemList": "Su inventario",
- "HeaderPlayerItemList": "Inventario del jugador ({1})",
- "HeaderHouseItemList": "Inventario de la casa",
- "HeaderBusinessFloorItemList": "Inventario del negocio (En venta)",
- "HeaderBusinessStorageItemList": "Inventario del negocio (Almacén)",
- "HeaderItemItemList": "Inventario de {1}",
- "ItemSlotNotNumber": "La ranura del objeto debe ser un número",
- "ItemSlotMustBeBetween": "La ranura del objeto debe ser un número entre {1} y {2}!",
- "UseItemBugged": "El objeto que intentas utilizar tiene un error. Se ha enviado un informe de error a los desarrolladores del servidor",
- "PickupItemBugged": "El objeto que intentas recoger tiene un error. Se ha enviado un informe de error a los desarrolladores del servidor",
- "DropItemBugged": "El objeto que intentas soltar tiene un error. Se ha enviado un informe de error a los desarrolladores del servidor",
- "HandsBusy": "Tus manos están ocupadas",
- "CantUseItemInSkinChange": "No puedes usar un objeto mientras personalizas tu apariencia",
- "CantDropItemInSkinChange": "No puedes soltar un objeto mientras personalizas tu apariencia",
- "CantPickupItemInSkinChange": "No puedes recoger un objeto mientras personalizas tu apariencia",
- "CantSwitchItemInSkinChange": "No puedes cambiar de objeto mientras se personaliza la apariencia",
- "CantGiveItemInSkinChange": "No puedes dar un objeto mientras personalizas tu apariencia",
- "CantTakeItemInSkinChange": "No puedes coger un objeto mientras personalizas tu apariencia",
- "ItemUnequippableNoAmmo": "{1} (ranura {2}) no tiene munición y no puede equiparse",
- "NoSpaceSelfInventory": "No tienes más espacio en tu inventario",
- "Business": "negocio",
- "House": "casa",
- "Clan": "clan",
- "Vehicle": "vehiculo",
- "Item": "objeto",
- "ItemType": "tipo de objeto",
- "Gate": "portón",
- "Door": "puerta",
- "ClanRank": "rango del clan",
- "JobRank": "rango del trabajo",
- "RadioStation": "estación de radio",
- "Months": [
- "Enero",
- "Febrero",
- "Marzo",
- "Abril",
- "Mayo",
- "Junio",
- "Julio",
- "Agosto",
- "Septiembre",
- "Octubre",
- "Noviembre",
- "Diciembre"
- ],
- "WeekDays": [
- "Domingo",
- "Lunes",
- "Martes",
- "Miércoles",
- "Jueves",
- "Viernes",
- "Sábado"
- ],
- "CardinalDirections": [
- "Norte",
- "Noreste",
- "Este",
- "Sureste",
- "Sur",
- "Suroeste",
- "Oeste",
- "Noroeste"
- ],
- "NewPlayerReadyToPlay": [
- "Te han dado algo de dinero. Usa {1} para encontrar lugares donde comprar artículos",
- "Si necesitas dinero, los trabajos son los puntos amarillos del radar",
- "Para conseguir un coche, visita el concesionario de coches. También puedes utilizar un vehículo de alquiler cerca del punto de aparición o tomar el tren",
- "Asegúrese de leer el {1} y utilizar el {2} para obtener información"
- ],
- "YourCurrentVehicleDeleted": "El vehículo en el que estabas fue eliminado",
- "Distance": "Distancia",
- "Meters": "Metros",
- "Feet": "Pies",
- "Kilometers": "Kilómetros",
- "Miles": "Millas",
- "MustBeVehicleDriver": "¡Debes ser el conductor del vehículo!",
- "PlayerJoinedServer": "¡{1} se unió al juego desde {1}!",
- "PlayerLeftServer": "¡{1} ha abandonado el juego! ({1})",
- "DisconnectReasons": [
- "Conexión perdida",
- "Desconectado",
- "Cliente no admitido",
- "Juego incorrecto",
- "Contraseña incorrecta",
- "Ejecutable no admitidos",
- "Desconectado",
- "Vetado",
- "Fallido",
- "Nombre inválido",
- "Fallo del programa"
- ],
- "TakeItemFromHouse": "saca {1} de la casa",
- "TakeItemFromBusinessStorage": "saca {1} del almacén del negocio",
- "TakeItemFromBusiness": "saca {1} del negocio",
- "TakeItemFromItem": "saca {1} del {2}",
- "TakeItemFromVehicleTrunk": "saca {1} del maletero",
- "TakeItemFromVehicleDash": "saca {1} de la guantera",
- "JobEquipmentInventoryKeyBindTip": "El equipo de trabajo está en su inventario. Pulse {1} para verlas",
- "JobEquipmentInventoryCommandTip": "El equipo de trabajo está en su inventario. Utilice {1} para verlos",
- "AccountHelp": [
- "NO comparta su contraseña con nadie más. El personal de {1} nunca le pedirá su contraseña",
- "Utilice {1} para cambiar su contraseña, y {2} si la ha olvidado",
- "Algunos comandos: {1}"
- ],
- "VehicleHelp": [
- "Sus vehículos personales se guardarán donde usted u otra persona los deje",
- "Visite un concesionario para comprar vehículos nuevos. {1} para más información)",
- "Algunos comandos: {1}",
- "Visita un taller mecánico para reparar, colorear y poner a punto tu coche. {1} para más información"
- ],
- "VehicleDealershipHelp": [
- "Visite un concesionario para comprar vehículos nuevos. {1} para encontrar uno",
- "En el concesionario, introduce el coche que quieres comprar, y se te mostrará el precio",
- "Si quieres comprar el vehículo, utiliza {1} y te darán las llaves para que lo pruebes en el aparcamiento",
- "Salga del concesionario con el vehículo nuevo para confirmar la compra"
- ],
- "JobHelp": [
- "Visita los lugares de trabajo para conseguir un empleo y ganar dinero. Busca puntos amarillos en el mapa",
- "En un lugar de trabajo, usa {1} para conseguir el trabajo. Utiliza {2} para dejar el trabajo",
- "Usa {1} para empezar a trabajar. También puedes conseguir un trabajo {2} y {3}",
- "La mayoría de los vehículos de trabajo están cerrados. Usa {1} cerca de uno para entrar en él",
- "Al entrar en un vehículo de trabajo, se le mostrará información sobre cómo hacer el trabajo"
- ],
- "ChatHelp": [
- "Hay dos tipos principales de chat: fuera del personaje (OOC) y dentro del personaje (IC)",
- "Mezclar estos dos tipos no resulta en un juego de rol apropiado. Vea {1} para más información",
- "Algunos comandos del chat: {1}",
- "Algunos tienen nombres más cortos disponibles ({1} para hablar, {2} para gritar, etc)"
- ],
- "ServerRulesHelp": [
- "Las acciones irreales (powergaming) no están permitidas. No eres Superman",
- "No se permite ningún juego de rol terrorista o de terrorismo",
- "Siga siempre las instrucciones de los moderadores y administradores",
- "No mezcles los chats (metagaming). No puedes usar información en IC que fue recibida OOC",
- "Mantén el inglés en los chats principales. Si no se te da bien el inglés, utiliza {1}"
- ],
- "AnimationHelp": [
- "Las animaciones permiten mejorar el juego de rol con acciones visuales",
- "Utilice {1} o {2} con un nombre para utilizar una animación",
- "Para ver una lista de animaciones, utilice {1}"
- ],
- "WeaponHelp": [
- "Visita una armería para comprar armas. Usa {1} para encontrar una",
- "La compra de un arma requiere una licencia de armas",
- "Las licencias de armas son gestionadas por el departamento de policía. Solicítela allí para obtenerla",
- "Las armas también pueden comprarse ilegalmente en algunos negocios, vendedores de armas y clanes"
- ],
- "SkinHelp": [
- "En una tienda de ropa, usa {1} para comprar ropa",
- "Cuando tengas un objeto de ropa, equípalo y úsalo como cualquier otro objeto para mostrar la selección de personajes (revisa {1} para aprender a usar objetos)",
- "Algunas pieles están restringidas a trabajos, clanes o por otras razones"
- ],
- "KeyBindHelp": [
- "Puedes establecer tus propias combinaciones de teclas. Utilice {1} para ver sus teclas vinculadas",
- "Utilice {1} para añadir una nueva combinación de teclas y {2} para eliminar una",
- "Las teclas por defecto son: {1} para el motor del vehículo, {1} para las luces y {3} para el bloqueo/desbloqueo",
- "Pulsa {1} para ver tus objetos y {2} para equipar un objeto o {3} para desequipar todos",
- "Pulsa {1} para usar el objeto que tienes en la mano, pulsa {2} para dejarlo caer o pulsa {3} para recoger un objeto del suelo"
- ],
- "BusinessHelp": [
- "Utilice {1} para comprar artículos o {2} para ver una lista de lo que está a la venta en cualquier negocio",
- "Las empresas aparecen con nombres azules sobre el icono de su entrada",
- "Comandos del dueño del negocio: {1}",
- "Un coche nuevo en venta aparecerá cuando salgas del concesionario"
- ],
- "ClanHelp": [
- "Pedir a un administrador que cree un clan (similar a las facciones/grupos/familias)",
- "Los propietarios de clanes tienen pleno control sobre su clan una vez creado",
- "Comandos de clan: {1}",
- "Más comandos del clan: {1}"
- ],
- "RadioStationHelp": [
- "Utilice {1} para fijar la estación de su vehículo, casa o negocio",
- "Utilice {2} para ver una lista de estaciones",
- "Puedes cambiar el volumen de tu radio usando {1} con 0-100 como porcentaje"
- ],
- "WealthAndTaxHelp": [
- "Sus impuestos en el día de pago son el {1} por ciento de su riqueza calculada",
- "Su riqueza calculada es una suma total basada en cuántos vehículos, casas y negocios tiene",
- "Cada vehículo es {1}, cada casa es {2}, y cada negocio es {3}",
- "Utilice {1} para ver su patrimonio actual, y {2} para ver cuánto pagará de impuestos cada día de pago"
- ],
- "MustBeInAVehicle": "Necesitas estar en un vehículo",
- "MustBeInOrNearVehicle": "Tienes que estar dentro o cerca de un vehículo",
- "MustBeInVehicleFrontSeat": "Tienes que estar en los asientos delanteros del vehículo",
- "MustBeInVehicleDriverSeat": "Tienes que ser el conductor",
- "DontHaveVehicleKey": "No tiene una llave para este vehículo",
- "NoGateAccess": "No tienes acceso a esta puerta",
- "GateBroken": "Esta puerta está rota",
- "GateHacked": "La puerta no funciona",
- "RadioJammed": "Sólo se oye la estática de la radio",
- "VehicleNotForSale": "Este vehículo no está en venta",
- "VehicleNotForRent": "Este vehículo no se alquila",
- "BusinessNotForSale": "Este negocio no está en venta",
- "BusinessNotForRent": "Este negocio no se alquila",
- "HouseNotForSale": "Esta casa no está en venta",
- "HouseNotForRent": "Esta casa no está en alquiler",
- "DealershipPurchaseTestDrive": "Conduzca fuera del concesionario para comprar el vehículo, o salga del vehículo para cancelar",
- "DealershipPurchaseExitedVehicle": "Has cancelado la compra del vehículo al salir de él",
- "VehiclePurchaseComplete": "¡Este vehículo es ahora tuyo! Se guardará donde quiera que lo dejes",
- "VehiclePurchaseNotEnoughMoney": "No tienes suficiente dinero para comprar este vehículo",
- "HousePurchaseNotEnoughMoney": "No tienes suficiente dinero para comprar esta casa",
- "BusinessPurchaseNotEnoughMoney": "No tienes suficiente dinero para comprar este negocio",
- "Locales": {
- "English": "Inglés",
- "Russian": "Ruso",
- "Spanish": "Español",
- "German": "Alemán",
- "Dutch": "Holandés",
- "Polish": "Polaco"
- },
- "HeaderPlayerHousesList": "Casas del jugador ({1})",
- "HeaderPlayerStaffFlagsList": "Banderas administrativas del jugador ({1})",
- "HeaderStaffFlagsList": "Banderas administrativas",
- "NonRPName": "¡Nombre no RP! Elige uno nuevo:",
- "InvalidStaffFlag": "Bandera administrativa no encontrada",
- "InvalidClanFlag": "Bandera del clan no encontrada",
- "InvalidLocale": "Language not found!",
- "HeaderJobUniformList": "Job Uniforms ({1})",
- "HeaderJobEquipmentList": "Job Equipment ({1})",
- "InvalidJobUniform": "Job uniform not found!",
- "InvalidJobEquipment": "Job equipment not found!",
- "HeaderVehiclesInRangeList": "Vehicles within {1}",
- "NoVehiclesWithInRange": "There are no vehicles within {1}",
- "AmountNotNumber": "The amount must be a number!",
- "NeedToBeWorking": "You need to be working! Use {1} at a job location or near a job vehicle.",
- "NeedToBeOnJobRoute": "You need to be doing a job route! Use {1} in a job vehicle",
- "CurrentJobRouteDeleted": "The job route you were on has been deleted by an admin",
- "CurrentJobRouteVehicleColoursChanged": "Your job route's vehicle colours were changed by an admin",
- "NotYourJob": "This is not your job!",
- "JobPoints": "You can get a job by going the yellow points on the map.",
- "QuitJobToTakeAnother": "If you want this job, use {1} to quit your current job.",
- "NotAJobVehicle": "This is not a job vehicle!",
- "NotYourJobVehicle": "This is not your job's vehicle!",
- "JobRouteDisabled": "The job route you were on has been disabled by an admin",
- "HeaderPickupTypes": "Pickup Types",
- "HeaderBlipTypes": "Map Icon Types",
- "InvalidGPSLocation": "There are no locations with that name or type",
- "HeaderBusinessList": "Businesses",
- "VehicleForSale": "This {1} is buyable for {2}! Use {3} if you want to buy it",
- "VehicleForRent": "This {1} is rentable for {2}! Use {3} if you want to rent it",
-
- "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.",
-
- "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 List",
- "ViewInventoryKeyPressTip": "Press {1} to see your items",
- "ViewInventoryCommandTip": "Use {1} to see your items"
-}
diff --git a/meta.xml b/meta.xml
index 372f2088..b471f228 100644
--- a/meta.xml
+++ b/meta.xml
@@ -9,8 +9,8 @@
-
+
@@ -47,9 +47,11 @@
-
+
+
+
@@ -82,9 +84,7 @@
-
-
-
+
@@ -99,8 +99,9 @@
-
+
+
@@ -109,23 +110,27 @@
+
+
+
-
+
+
diff --git a/scripts/client/afk.js b/scripts/client/afk.js
index 95cbd995..b0ca14e5 100644
--- a/scripts/client/afk.js
+++ b/scripts/client/afk.js
@@ -7,6 +7,7 @@
// TYPE: Client (JavaScript)
// ===========================================================================
+// Init AFK script
function initAFKScript() {
logToConsole(LOG_DEBUG, "[VRR.AFK]: Initializing AFK script ...");
logToConsole(LOG_DEBUG, "[VRR.AFK]: AFK script initialized!");
@@ -14,14 +15,16 @@ function initAFKScript() {
// ===========================================================================
+// Process stuff when game loses focus
function processLostFocusAFK(event) {
sendServerNewAFKStatus(true);
}
// ===========================================================================
+// Process stuff when game gains focus
function processFocusAFK(event) {
- sendServerNewAFKStatus(false);
+ sendServerNewAFKStatus(false);
}
// ===========================================================================
\ No newline at end of file
diff --git a/scripts/client/animation.js b/scripts/client/animation.js
index 2d5760e5..f62db4f7 100644
--- a/scripts/client/animation.js
+++ b/scripts/client/animation.js
@@ -7,69 +7,142 @@
// TYPE: Client (JavaScript)
// ===========================================================================
-function makePedPlayAnimation(pedId, animGroup, animId, animType, animSpeed, loop, loopNoControl, freezeLastFrame, returnToOriginalPosition, freezePlayer) {
- logToConsole(LOG_DEBUG, `[VRR.Animation] Playing animation ${animGroup}/${animId} for ped ${pedId}`);
- if(getGame() < VRR_GAME_GTA_IV) {
- if(animType == VRR_ANIMTYPE_NORMAL || animType == VRR_ANIMTYPE_SURRENDER) {
- if(getGame() == VRR_GAME_GTA_VC || getGame() == VRR_GAME_GTA_SA) {
- getElementFromId(pedId).clearAnimations();
- } else {
- getElementFromId(pedId).clearObjective();
- }
- getElementFromId(pedId).addAnimation(animGroup, animId);
+function makePedPlayAnimation(pedId, animationSlot, positionOffset) {
+ let ped = getElementFromId(pedId);
- if(getElementFromId(pedId) == localPlayer && freezePlayer == true) {
- inAnimation = true;
- setLocalPlayerControlState(false, false);
- localPlayer.collisionsEnabled = false;
- }
- } else if(animType == VRR_ANIMTYPE_BLEND) {
- getElementFromId(pedId).position = getElementFromId(pedId).position;
- getElementFromId(pedId).blendAnimation(animGroup, animId, animSpeed);
- }
- } else {
- natives.requestAnims(animGroup);
- natives.taskPlayAnimNonInterruptable(getElementFromId(pedId), animId, animGroup, animSpeed, loop, loopNoControl, freezeLastFrame, returnToOriginalPosition, -1);
- }
+ if(ped == null) {
+ return false;
+ }
+
+ let animationData = getAnimationData(animationSlot);
+ logToConsole(LOG_DEBUG, `[VRR.Animation] Playing animation ${animationData[0]} for ped ${pedId}`);
+
+ let freezePlayer = false;
+ switch(animationData.moveType) {
+ case VRR_ANIMMOVE_FORWARD: {
+ setElementCollisionsEnabled(ped, false);
+ if(ped.isSyncer) {
+ setElementPosition(ped, getPosInFrontOfPos(getElementPosition(pedId), fixAngle(getElementHeading(pedId)), positionOffset));
+ }
+ freezePlayer = true;
+ break;
+ }
+
+ case VRR_ANIMMOVE_BACK: {
+ setElementCollisionsEnabled(pedId, false);
+ if(ped.isSyncer) {
+ setElementPosition(pedId, getPosBehindPos(getElementPosition(pedId), fixAngle(getElementHeading(pedId)), positionOffset));
+ }
+ freezePlayer = true;
+ break;
+ }
+
+ case VRR_ANIMMOVE_LEFT: {
+ setElementCollisionsEnabled(pedId, false);
+ if(ped.isSyncer) {
+ setElementPosition(pedId, getPosToLeftOfPos(getElementPosition(pedId), fixAngle(getElementHeading(pedId)), positionOffset));
+ }
+ freezePlayer = true;
+ break;
+ }
+
+ case VRR_ANIMMOVE_RIGHT: {
+ setElementCollisionsEnabled(pedId, false);
+ if(ped.isSyncer) {
+ setElementPosition(pedId, getPosToRightOfPos(getElementPosition(pedId), fixAngle(getElementHeading(pedId)), positionOffset));
+ }
+ freezePlayer = true;
+ break;
+ }
+
+ default: {
+ break;
+ }
+ }
+
+ if(getGame() < VRR_GAME_GTA_IV) {
+ if(animationData.animType == VRR_ANIMTYPE_NORMAL || animationData.animType == VRR_ANIMTYPE_SURRENDER) {
+ if(getGame() == VRR_GAME_GTA_VC || getGame() == VRR_GAME_GTA_SA) {
+ ped.clearAnimations();
+ } else {
+ ped.clearObjective();
+ }
+ ped.addAnimation(animationData.groupId, animationData.animId);
+
+ if(ped == localPlayer && freezePlayer == true) {
+ inAnimation = true;
+ setLocalPlayerControlState(false, false);
+ localPlayer.collisionsEnabled = false;
+ }
+ } else if(animationData.animType == VRR_ANIMTYPE_BLEND) {
+ ped.position = ped.position;
+ ped.blendAnimation(animationData.groupId, animationData.animId, animationData.animSpeed);
+ }
+ } else {
+ natives.requestAnims(animationData.groupId);
+ natives.taskPlayAnimNonInterruptable(ped, animationData.groupId, animationData.animId, animationData.animSpeed, boolToInt(animationData.infiniteLoop), boolToInt(animationData.infiniteLoopNoMovement), boolToInt(animationData.dontReturnToStartCoords), boolToInt(animationData.freezeLastFrame), -1);
+ }
}
// ===========================================================================
-function forcePedAnimation(pedId, animGroup, animId, animType, animSpeed, loop, loopNoControl, freezeLastFrame, returnToOriginalPosition) {
- if(getGame() < VRR_GAME_GTA_IV) {
- forcedAnimation = [animGroup, animId];
- getElementFromId(pedId).position = getElementFromId(pedId).position;
- getElementFromId(pedId).addAnimation(animGroup, animId);
+function forcePedAnimation(pedId, animSlot) {
+ let ped = getElementFromId(pedId);
- if(getElementFromId(pedId) == localPlayer) {
- inAnimation = true;
- setLocalPlayerControlState(false, false);
- localPlayer.collisionsEnabled = false;
- }
- }
+ if(ped == null) {
+ return false;
+ }
+
+ let animationData = getAnimationData(animSlot);
+
+ if(getGame() < VRR_GAME_GTA_IV) {
+ ped.position = ped.position;
+ ped.addAnimation(animationData.groupId, animationData.animId);
+
+ if(ped == localPlayer) {
+ inAnimation = true;
+ setLocalPlayerControlState(false, false);
+ localPlayer.collisionsEnabled = false;
+ }
+ } else {
+ natives.requestAnims(animationData.groupId);
+ natives.taskPlayAnimNonInterruptable(ped, animationData.groupId, animationData.animId, animationData.animSpeed, boolToInt(animationData.infiniteLoop), boolToInt(animationData.infiniteLoopNoMovement), boolToInt(animationData.dontReturnToStartCoords), boolToInt(animationData.freezeLastFrame), -1);
+ }
}
// ===========================================================================
function makePedStopAnimation(pedId) {
- if(getElementFromId(pedId) == null) {
- return false;
- }
+ let ped = getElementFromId(pedId);
- if(getGame() != VRR_GAME_GTA_IV) {
- if(getGame() == VRR_GAME_GTA_VC || getGame() == VRR_GAME_GTA_SA) {
- getElementFromId(pedId).clearAnimations();
- } else {
- getElementFromId(pedId).clearObjective();
- }
- }
+ if(ped == null) {
+ return false;
+ }
- if(getElementFromId(pedId) == localPlayer) {
- if(getGame() != VRR_GAME_GTA_IV) {
- localPlayer.collisionsEnabled = true;
- }
- setLocalPlayerControlState(true, false);
- }
+ if(getGame() != VRR_GAME_GTA_IV) {
+ if(getGame() == VRR_GAME_GTA_VC || getGame() == VRR_GAME_GTA_SA) {
+ ped.clearAnimations();
+ } else {
+ ped.clearObjective();
+ }
+ }
+
+ if(ped == localPlayer) {
+ if(getGame() != VRR_GAME_GTA_IV) {
+ localPlayer.collisionsEnabled = true;
+ }
+ setLocalPlayerControlState(true, false);
+ }
+}
+
+// ===========================================================================
+
+/**
+ * @param {number} animationSlot - The slot index of the animation
+ * @return {AnimationData} The animation's data (array)
+ */
+ function getAnimationData(animationSlot, gameId = getGame()) {
+ return getGameConfig().animations[gameId][animationSlot];
}
// ===========================================================================
\ No newline at end of file
diff --git a/scripts/client/business.js b/scripts/client/business.js
index 69a73600..2c07f0de 100644
--- a/scripts/client/business.js
+++ b/scripts/client/business.js
@@ -8,85 +8,84 @@
// ===========================================================================
class BusinessData {
- constructor(businessId, name, entrancePosition, blipModel, pickupModel, hasInterior, hasItems) {
- this.index = -1;
- this.businessId = businessId;
- this.name = name;
- this.entrancePosition = entrancePosition;
- this.blipModel = blipModel;
- this.pickupModel = pickupModel;
- this.hasInterior = hasInterior;
- this.hasItems = hasItems;
- this.blipId = -1;
- }
+ constructor(businessId, name, entrancePosition, blipModel, pickupModel, hasInterior, hasItems) {
+ this.index = -1;
+ this.businessId = businessId;
+ this.name = name;
+ this.entrancePosition = entrancePosition;
+ this.blipModel = blipModel;
+ this.pickupModel = pickupModel;
+ this.hasInterior = hasInterior;
+ this.hasItems = hasItems;
+ this.blipId = -1;
+ this.labelInfoType = 0;
+ }
}
// ===========================================================================
function receiveBusinessFromServer(businessId, name, entrancePosition, blipModel, pickupModel, hasInterior, hasItems) {
- logToConsole(LOG_DEBUG, `[VRR.Business] Received business ${businessId} (${name}) from server`);
-
- if(getGame() == VRR_GAME_GTA_IV) {
- if(getBusinessData(businessId) != false) {
- let businessData = getBusinessData(businessId);
- businessData.name = name;
- businessData.entrancePosition = entrancePosition;
- businessData.blipModel = blipModel;
- businessData.pickupModel = pickupModel;
- businessData.hasInterior = hasInterior;
- businessData.hasItems = hasItems;
+ logToConsole(LOG_DEBUG, `[VRR.Business] Received business ${businessId} (${name}) from server`);
- logToConsole(LOG_DEBUG, `[VRR.Business] Business ${businessId} already exists. Checking blip ...`);
- if(blipModel == -1) {
- if(businessData.blipId != -1) {
- logToConsole(LOG_DEBUG, `[VRR.Business] Business ${businessId}'s blip has been removed by the server`);
- natives.removeBlipAndClearIndex(getBusinessData(businessId).blipId);
- businessData.blipId = -1;
- //businesses.splice(businessData.index, 1);
- //setAllBusinessDataIndexes();
- } else {
- logToConsole(LOG_DEBUG, `[VRR.Business] Business ${businessId}'s blip is unchanged`);
- }
- } else {
- if(businessData.blipId != -1) {
- logToConsole(LOG_DEBUG, `[VRR.Business] Business ${businessId}'s blip has been changed by the server`);
- natives.setBlipCoordinates(businessData.blipId, businessData.entrancePosition);
- natives.changeBlipSprite(businessData.blipId, businessData.blipModel);
- natives.setBlipMarkerLongDistance(businessData.blipId, false);
- natives.setBlipAsShortRange(tempBusinessData.blipId, true);
- natives.changeBlipNameFromAscii(businessData.blipId, `${businessData.name.substr(0, 24)}${(businessData.name.length > 24) ? " ...": ""}`);
- } else {
- let blipId = natives.addBlipForCoord(entrancePosition);
- if(blipId) {
- businessData.blipId = blipId;
- natives.changeBlipSprite(businessData.blipId, businessData.blipModel);
- natives.setBlipMarkerLongDistance(businessData.blipId, false);
- natives.setBlipAsShortRange(tempBusinessData.blipId, true);
- natives.changeBlipNameFromAscii(businessData.blipId, `${businessData.name.substr(0, 24)}${(businessData.name.length > 24) ? " ...": ""}`);
- }
- logToConsole(LOG_DEBUG, `[VRR.Business] Business ${businessId}'s blip has been added by the server (Model ${blipModel}, ID ${blipId})`);
- }
- }
- } else {
- logToConsole(LOG_DEBUG, `[VRR.Business] Business ${businessId} doesn't exist. Adding ...`);
- let tempBusinessData = new BusinessData(businessId, name, entrancePosition, blipModel, pickupModel, hasInterior, hasItems);
- if(blipModel != -1) {
- let blipId = natives.addBlipForCoord(entrancePosition);
- if(blipId) {
- tempBusinessData.blipId = blipId;
- natives.changeBlipSprite(tempBusinessData.blipId, blipModel);
- natives.setBlipMarkerLongDistance(tempBusinessData.blipId, false);
- natives.setBlipAsShortRange(tempBusinessData.blipId, true);
- natives.changeBlipNameFromAscii(tempBusinessData.blipId, `${name.substr(0, 24)}${(name.length > 24) ? " ...": ""}`);
- }
- logToConsole(LOG_DEBUG, `[VRR.Business] Business ${businessId}'s blip has been added by the server (Model ${blipModel}, ID ${blipId})`);
- } else {
- logToConsole(LOG_DEBUG, `[VRR.Business] Business ${businessId} has no blip.`);
- }
- businesses.push(tempBusinessData);
- setAllBusinessDataIndexes();
- }
- }
+ if(!areServerElementsSupported()) {
+ if(getBusinessData(businessId) != false) {
+ let businessData = getBusinessData(businessId);
+ businessData.name = name;
+ businessData.entrancePosition = entrancePosition;
+ businessData.blipModel = blipModel;
+ businessData.pickupModel = pickupModel;
+ businessData.hasInterior = hasInterior;
+ businessData.hasItems = hasItems;
+
+ logToConsole(LOG_DEBUG, `[VRR.Business] Business ${businessId} already exists. Checking blip ...`);
+ if(blipModel == -1) {
+ if(businessData.blipId != -1) {
+ logToConsole(LOG_DEBUG, `[VRR.Business] Business ${businessId}'s blip has been removed by the server`);
+ if(getGame() == VRR_GAME_GTA_IV) {
+ natives.removeBlipAndClearIndex(getBusinessData(businessId).blipId);
+ } else {
+ destroyElement(getElementFromId(blipId));
+ }
+ businessData.blipId = -1;
+ //businesses.splice(businessData.index, 1);
+ //setAllBusinessDataIndexes();
+ } else {
+ logToConsole(LOG_DEBUG, `[VRR.Business] Business ${businessId}'s blip is unchanged`);
+ }
+ } else {
+ if(businessData.blipId != -1) {
+ logToConsole(LOG_DEBUG, `[VRR.Business] Business ${businessId}'s blip has been changed by the server`);
+ if(getGame() == VRR_GAME_GTA_IV) {
+ natives.setBlipCoordinates(businessData.blipId, businessData.entrancePosition);
+ natives.changeBlipSprite(businessData.blipId, businessData.blipModel);
+ natives.setBlipMarkerLongDistance(businessData.blipId, false);
+ natives.setBlipAsShortRange(tempBusinessData.blipId, true);
+ natives.changeBlipNameFromAscii(businessData.blipId, `${businessData.name.substr(0, 24)}${(businessData.name.length > 24) ? " ...": ""}`);
+ }
+ } else {
+ let blipId = createGameBlip(tempBusinessData.blipModel, tempBusinessData.entrancePosition, tempBusinessData.name);
+ if(blipId != -1) {
+ tempBusinessData.blipId = blipId;
+ }
+ logToConsole(LOG_DEBUG, `[VRR.Business] Business ${businessId}'s blip has been added by the server (Model ${blipModel}, ID ${blipId})`);
+ }
+ }
+ } else {
+ logToConsole(LOG_DEBUG, `[VRR.Business] Business ${businessId} doesn't exist. Adding ...`);
+ let tempBusinessData = new BusinessData(businessId, name, entrancePosition, blipModel, pickupModel, hasInterior, hasItems);
+ if(blipModel != -1) {
+ let blipId = createGameBlip(tempBusinessData.blipModel, tempBusinessData.entrancePosition, tempBusinessData.name);
+ if(blipId != -1) {
+ tempBusinessData.blipId = blipId;
+ }
+ logToConsole(LOG_DEBUG, `[VRR.Business] Business ${businessId}'s blip has been added by the server (Model ${blipModel}, ID ${blipId})`);
+ } else {
+ logToConsole(LOG_DEBUG, `[VRR.Business] Business ${businessId} has no blip.`);
+ }
+ getServerData().businesses.push(tempBusinessData);
+ setAllBusinessDataIndexes();
+ }
+ }
}
// ===========================================================================
@@ -96,23 +95,26 @@ function receiveBusinessFromServer(businessId, name, entrancePosition, blipModel
* @return {BusinessData} The business's data (class instance)
*/
function getBusinessData(businessId) {
- //let tempBusinessData = businesses.find((b) => b.businessId == businessId);
- //return (typeof tempBusinessData != "undefined") ? tempBusinessData[0] : false;
- for(let i in businesses) {
- if(businesses[i].businessId == businessId) {
- return businesses[i];
- }
- }
+ //let tempBusinessData = businesses.find((b) => b.businessId == businessId);
+ //return (typeof tempBusinessData != "undefined") ? tempBusinessData[0] : false;
- return false;
+ let businesses = getServerData().businesses;
+
+ for(let i in businesses) {
+ if(businesses[i].businessId == businessId) {
+ return businesses[i];
+ }
+ }
+
+ return false;
}
// ===========================================================================
function setAllBusinessDataIndexes() {
- for(let i in businesses) {
- businesses[i].index = i;
- }
+ for(let i in getServerData().businesses) {
+ getServerData().businesses[i].index = i;
+ }
}
// ===========================================================================
\ No newline at end of file
diff --git a/scripts/client/chatbox.js b/scripts/client/chatbox.js
index 37526c4b..bc71ebf7 100644
--- a/scripts/client/chatbox.js
+++ b/scripts/client/chatbox.js
@@ -16,92 +16,156 @@ let maxChatBoxHistory = 500;
let scrollAmount = 1;
let maxChatBoxLines = 6;
+let chatAutoHideDelay = 0;
+let chatLastUse = 0;
+
let scrollUpKey = false;
let scrollDownKey = false;
// ===========================================================================
function initChatBoxScript() {
- logToConsole(LOG_DEBUG, "[VRR.ChatBox]: Initializing chatbox script ...");
- scrollUpKey = getKeyIdFromParams("pageup");
- scrollDownKey = getKeyIdFromParams("pagedown");
- bindChatBoxKeys();
- logToConsole(LOG_DEBUG, "[VRR.ChatBox]: Chatbox script initialized!");
+ logToConsole(LOG_DEBUG, "[VRR.ChatBox]: Initializing chatbox script ...");
+ scrollUpKey = getKeyIdFromParams("pageup");
+ scrollDownKey = getKeyIdFromParams("pagedown");
+ bindChatBoxKeys();
+ logToConsole(LOG_DEBUG, "[VRR.ChatBox]: Chatbox script initialized!");
}
// ===========================================================================
function bindChatBoxKeys() {
- bindKey(toInteger(scrollUpKey), KEYSTATE_DOWN, chatBoxScrollUp);
- bindKey(toInteger(scrollDownKey), KEYSTATE_DOWN, chatBoxScrollDown);
+ bindKey(toInteger(scrollUpKey), KEYSTATE_DOWN, chatBoxScrollUp);
+ bindKey(toInteger(scrollDownKey), KEYSTATE_DOWN, chatBoxScrollDown);
}
// ===========================================================================
function unBindChatBoxKeys() {
- unbindKey(toInteger(scrollUpKey));
- unbindKey(toInteger(scrollDownKey));
+ unbindKey(toInteger(scrollUpKey));
+ unbindKey(toInteger(scrollDownKey));
}
// ===========================================================================
function receiveChatBoxMessageFromServer(messageString, colour) {
- if(bottomMessageIndex => chatBoxHistory.length-1) {
- message(messageString, colour);
- bottomMessageIndex = chatBoxHistory.length-1;
- }
- addToChatBoxHistory(messageString, colour);
+ logToConsole(LOG_DEBUG, `[VRR.ChatBox]: Received chatbox message from server: ${messageString}`);
+
+ // Just in case it's hidden by auto hide
+ //setChatWindowEnabled(true);
+
+ let colouredString = replaceColoursInMessage(messageString);
+
+ logToConsole(LOG_DEBUG, `[VRR.ChatBox]: Changed colours in string: ${colouredString}`);
+
+ addToChatBoxHistory(colouredString, colour);
+ //if(bottomMessageIndex >= chatBoxHistory.length-1) {
+ message(colouredString, colour);
+ bottomMessageIndex = chatBoxHistory.length-1;
+ //}
+
+ chatLastUse = getCurrentUnixTimestamp();
}
// ===========================================================================
function setChatScrollLines(amount) {
- scrollAmount = amount;
+ scrollAmount = amount;
+}
+
+// ===========================================================================
+
+function setChatAutoHideDelay(delay) {
+ chatAutoHideDelay = delay*1000;
}
// ===========================================================================
function addToChatBoxHistory(messageString, colour) {
- chatBoxHistory.push([messageString, colour]);
+ chatBoxHistory.push([messageString, colour]);
}
// ===========================================================================
function chatBoxScrollUp() {
- if(bottomMessageIndex > maxChatBoxLines) {
- bottomMessageIndex = bottomMessageIndex-scrollAmount;
- updateChatBox();
- }
+ if(bottomMessageIndex > maxChatBoxLines) {
+ bottomMessageIndex = bottomMessageIndex-scrollAmount;
+ updateChatBox();
+ }
}
// ===========================================================================
function chatBoxScrollDown() {
- if(bottomMessageIndex < chatBoxHistory.length-1) {
- bottomMessageIndex = bottomMessageIndex+scrollAmount;
- updateChatBox();
- }
+ if(bottomMessageIndex < chatBoxHistory.length-1) {
+ bottomMessageIndex = bottomMessageIndex+scrollAmount;
+ updateChatBox();
+ }
}
// ===========================================================================
function clearChatBox() {
- for(let i = 0 ; i <= maxChatBoxLines ; i++) {
- message("", COLOUR_WHITE);
- }
+ for(let i = 0 ; i <= maxChatBoxLines ; i++) {
+ message("", COLOUR_WHITE);
+ }
}
// ===========================================================================
function updateChatBox() {
- clearChatBox();
- for(let i = bottomMessageIndex-maxChatBoxLines ; i <= bottomMessageIndex ; i++) {
- if(typeof chatBoxHistory[i] != "undefined") {
- message(chatBoxHistory[i][0], chatBoxHistory[i][1]);
- } else {
- message("", COLOUR_WHITE);
- }
- }
+ clearChatBox();
+ for(let i = bottomMessageIndex-maxChatBoxLines ; i <= bottomMessageIndex ; i++) {
+ if(typeof chatBoxHistory[i] != "undefined") {
+ message(chatBoxHistory[i][0], chatBoxHistory[i][1]);
+ } else {
+ message("", COLOUR_WHITE);
+ }
+ }
+ chatLastUse = getCurrentUnixTimestamp();
+}
+
+// ===========================================================================
+
+function processMouseWheelForChatBox(mouseId, deltaCoordinates, flipped) {
+ // There isn't a way to detect whether chat input is active, but mouse cursor is forced shown when typing so ¯\_(ツ)_/¯
+ if(!gui.cursorEnabled) {
+ return false;
+ }
+
+ if(!flipped) {
+ if(deltaCoordinates.y > 0) {
+ chatBoxScrollUp();
+ } else {
+ chatBoxScrollDown();
+ }
+ } else {
+ if(deltaCoordinates.y > 0) {
+ chatBoxScrollDown();
+ } else {
+ chatBoxScrollUp();
+ }
+ }
+}
+
+// ===========================================================================
+
+function checkChatAutoHide() {
+ return false;
+
+ // Make sure chat input isn't active
+ if(gui.cursorEnabled) {
+ return false;
+ }
+
+ // Don't process auto-hide if it's disabled
+ if(chatAutoHideDelay == 0) {
+ return false;
+ }
+
+ if(getCurrentUnixTimestamp()-chatLastUse >= chatAutoHideDelay) {
+ setChatWindowEnabled(false);
+ }
}
// ===========================================================================
\ No newline at end of file
diff --git a/scripts/client/content.js b/scripts/client/content.js
index 214655ea..bcae54d0 100644
--- a/scripts/client/content.js
+++ b/scripts/client/content.js
@@ -8,58 +8,58 @@
// ===========================================================================
function getCustomImage(imageName) {
- let contentResource = findResourceByName(getGameConfig().extraContentResource[getGame()]);
- if(contentResource != null) {
- if(contentResource.isStarted) {
- let image = contentResource.exports.getCustomImage(imageName);
- if(image != null) {
- return image;
- }
- }
- }
- return false;
+ let contentResource = findResourceByName(getGameConfig().extraContentResource[getGame()]);
+ if(contentResource != null) {
+ if(contentResource.isStarted) {
+ let image = contentResource.exports.getCustomImage(imageName);
+ if(image != null) {
+ return image;
+ }
+ }
+ }
+ return false;
}
// ===========================================================================
function getCustomFont(fontName) {
- let contentResource = findResourceByName(getGameConfig().extraContentResource[getGame()]);
- if(contentResource != null) {
- if(contentResource.isStarted) {
- let font = contentResource.exports.getCustomFont(fontName);
- if(font != null) {
- return font;
- }
- }
- }
- return false;
+ let contentResource = findResourceByName(getGameConfig().extraContentResource[getGame()]);
+ if(contentResource != null) {
+ if(contentResource.isStarted) {
+ let font = contentResource.exports.getCustomFont(fontName);
+ if(font != null) {
+ return font;
+ }
+ }
+ }
+ return false;
}
// ===========================================================================
function getCustomAudio(audioName) {
- let contentResource = findResourceByName(getGameConfig().extraContentResource[getGame()]);
- if(contentResource != null) {
- if(contentResource.isStarted) {
- let audioFile = contentResource.exports.getCustomAudio(audioName);
- if(audioFile != null) {
- return audioFile;
- }
- }
- }
- return false;
+ let contentResource = findResourceByName(getGameConfig().extraContentResource[getGame()]);
+ if(contentResource != null) {
+ if(contentResource.isStarted) {
+ let audioFile = contentResource.exports.getCustomAudio(audioName);
+ if(audioFile != null) {
+ return audioFile;
+ }
+ }
+ }
+ return false;
}
// ===========================================================================
function playCustomAudio(audioName, volume = 0.5, loop = false) {
- let contentResource = findResourceByName(getGameConfig().extraContentResource[getGame()]);
- if(contentResource != null) {
- if(contentResource.isStarted) {
- contentResource.exports.playCustomAudio(audioName, volume, loop);
- }
- }
- return false;
+ let contentResource = findResourceByName(getGameConfig().extraContentResource[getGame()]);
+ if(contentResource != null) {
+ if(contentResource.isStarted) {
+ contentResource.exports.playCustomAudio(audioName, volume, loop);
+ }
+ }
+ return false;
}
// ===========================================================================
\ No newline at end of file
diff --git a/scripts/client/event.js b/scripts/client/event.js
index bd589eb4..9343798b 100644
--- a/scripts/client/event.js
+++ b/scripts/client/event.js
@@ -8,222 +8,248 @@
// ===========================================================================
function initEventScript() {
- logToConsole(LOG_DEBUG, "[VRR.Event]: Initializing event script ...");
- addCustomEvents();
- addAllEventHandlers();
- logToConsole(LOG_DEBUG, "[VRR.Event]: Event script initialized!");
+ logToConsole(LOG_DEBUG, "[VRR.Event]: Initializing event script ...");
+ addCustomEvents();
+ addAllEventHandlers();
+ logToConsole(LOG_DEBUG, "[VRR.Event]: Event script initialized!");
}
// ===========================================================================
function addCustomEvents() {
- addEvent("OnLocalPlayerEnterSphere", 1);
- addEvent("OnLocalPlayerExitSphere", 1);
- addEvent("OnLocalPlayerEnteredVehicle", 1);
- addEvent("OnLocalPlayerExitedVehicle", 1);
- addEvent("OnLocalPlayerSwitchWeapon", 2);
+ addEvent("OnLocalPlayerEnterSphere", 1);
+ addEvent("OnLocalPlayerExitSphere", 1);
+ addEvent("OnLocalPlayerEnteredVehicle", 1);
+ addEvent("OnLocalPlayerExitedVehicle", 1);
+ addEvent("OnLocalPlayerSwitchWeapon", 2);
}
// ===========================================================================
function addAllEventHandlers() {
- bindEventHandler("OnResourceStart", thisResource, onResourceStart);
- bindEventHandler("OnResourceReady", thisResource, onResourceReady);
- bindEventHandler("OnResourceStop", thisResource, onResourceStop);
+ bindEventHandler("OnResourceStart", thisResource, onResourceStart);
+ bindEventHandler("OnResourceReady", thisResource, onResourceReady);
+ bindEventHandler("OnResourceStop", thisResource, onResourceStop);
- addEventHandler("OnProcess", onProcess);
- addEventHandler("OnKeyUp", onKeyUp);
- addEventHandler("OnDrawnHUD", onDrawnHUD);
+ addEventHandler("OnProcess", onProcess);
+ addEventHandler("OnKeyUp", onKeyUp);
+ addEventHandler("OnDrawnHUD", onDrawnHUD);
- addEventHandler("OnPedWasted", onPedWasted);
+ addEventHandler("OnPedWasted", onPedWasted);
- addEventHandler("OnElementStreamIn", onElementStreamIn);
+ addEventHandler("OnElementStreamIn", onElementStreamIn);
- addEventHandler("OnLocalPlayerEnteredVehicle", onLocalPlayerEnteredVehicle);
- addEventHandler("OnLocalPlayerExitedVehicle", onLocalPlayerExitedVehicle);
- addEventHandler("OnLocalPlayerEnterSphere", onLocalPlayerEnterSphere);
- addEventHandler("OnLocalPlayerExitSphere", onLocalPlayerExitSphere);
- addEventHandler("OnLocalPlayerSwitchWeapon", onLocalPlayerSwitchWeapon);
+ addEventHandler("OnLocalPlayerEnteredVehicle", onLocalPlayerEnteredVehicle);
+ addEventHandler("OnLocalPlayerExitedVehicle", onLocalPlayerExitedVehicle);
+ addEventHandler("OnLocalPlayerEnterSphere", onLocalPlayerEnterSphere);
+ addEventHandler("OnLocalPlayerExitSphere", onLocalPlayerExitSphere);
+ addEventHandler("OnLocalPlayerSwitchWeapon", onLocalPlayerSwitchWeapon);
- addEventHandler("OnPedInflictDamage", onPedInflictDamage);
+ addEventHandler("OnPedInflictDamage", onPedInflictDamage);
- addEventHandler("OnLostFocus", onLostFocus);
- addEventHandler("OnFocus", onFocus);
+ addEventHandler("OnLostFocus", onLostFocus);
+ addEventHandler("OnFocus", onFocus);
- addEventHandler("OnCameraProcess", onCameraProcess);
+ addEventHandler("OnCameraProcess", onCameraProcess);
+
+ addEventHandler("OnMouseWheel", onMouseWheel);
+
+ addEventHandler("OnEntityProcess", onEntityProcess);
}
// ===========================================================================
function onResourceStart(event, resource) {
- sendResourceStartedSignalToServer();
- setUpInitialGame();
- garbageCollectorInterval = setInterval(collectAllGarbage, 1000*60);
+ sendResourceStartedSignalToServer();
+ //garbageCollectorInterval = setInterval(collectAllGarbage, 1000*60);
}
// ===========================================================================
function onResourceStop(event, resource) {
- sendResourceStoppedSignalToServer();
+ sendResourceStoppedSignalToServer();
}
// ===========================================================================
function onResourceReady(event, resource) {
- sendResourceReadySignalToServer();
+ sendResourceReadySignalToServer();
}
// ===========================================================================
function onProcess(event, deltaTime) {
- if(localPlayer == null) {
- return false;
- }
+ if (localPlayer == null) {
+ return false;
+ }
- if(!isSpawned) {
- return false;
- }
+ if (!isSpawned) {
+ return false;
+ }
+
+ processSync();
+ processLocalPlayerControlState();
+ processLocalPlayerVehicleControlState();
+ processLocalPlayerSphereEntryExitHandling();
+ processLocalPlayerVehicleEntryExitHandling();
+ processJobRouteSphere();
+ forceLocalPlayerEquippedWeaponItem();
+ processWantedLevelReset();
+ processGameSpecifics();
+ processNearbyPickups();
+ processVehiclePurchasing();
+ processVehicleBurning();
+ //checkChatBoxAutoHide(); // Will be uncommented on 1.4.0 GTAC update
+ //processVehicleFires();
- processSync();
- processLocalPlayerControlState();
- processLocalPlayerVehicleControlState();
- processLocalPlayerSphereEntryExitHandling();
- processLocalPlayerVehicleEntryExitHandling();
- processJobRouteSphere();
- forceLocalPlayerEquippedWeaponItem();
- processWantedLevelReset();
- processGameSpecifics();
- processNearbyPickups();
- processVehiclePurchasing();
- //processVehicleFires();
}
// ===========================================================================
function onKeyUp(event, keyCode, scanCode, keyModifiers) {
- processSkinSelectKeyPress(keyCode);
- //processKeyDuringAnimation();
- processGUIKeyPress(keyCode);
- processToggleGUIKeyPress(keyCode);
+ processSkinSelectKeyPress(keyCode);
+ //processKeyDuringAnimation();
+ processGUIKeyPress(keyCode);
+ processToggleGUIKeyPress(keyCode);
}
// ===========================================================================
function onDrawnHUD(event) {
- if(!renderHUD) {
- return false;
- }
+ if (!renderHUD) {
+ return false;
+ }
- if(localPlayer == null) {
- return false;
- }
+ if (localPlayer == null) {
+ return false;
+ }
- processSmallGameMessageRendering();
- processScoreBoardRendering();
- processLabelRendering();
- processLogoRendering();
- processItemActionRendering();
- processSkinSelectRendering();
- processNameTagRendering();
- processInteriorLightsRendering();
+ processSmallGameMessageRendering();
+ processScoreBoardRendering();
+ processLabelRendering();
+ processLogoRendering();
+ processItemActionRendering();
+ processSkinSelectRendering();
+ processNameTagRendering();
+ processInteriorLightsRendering();
}
// ===========================================================================
function onPedWasted(event, wastedPed, killerPed, weapon, pedPiece) {
- logToConsole(LOG_DEBUG, `[VRR.Event] Ped ${wastedPed.name} died`);
- wastedPed.clearWeapons();
+ logToConsole(LOG_DEBUG, `[VRR.Event] Ped ${wastedPed.name} died`);
+ wastedPed.clearWeapons();
}
// ===========================================================================
function onElementStreamIn(event, element) {
- syncElementProperties(element);
+ syncElementProperties(element);
}
// ===========================================================================
function onLocalPlayerExitedVehicle(event, vehicle, seat) {
- logToConsole(LOG_DEBUG, `[VRR.Event] Local player exited vehicle`);
- sendNetworkEventToServer("vrr.onPlayerExitVehicle", getVehicleForNetworkEvent(vehicle), seat);
+ logToConsole(LOG_DEBUG, `[VRR.Event] Local player exited vehicle`);
+ sendNetworkEventToServer("vrr.onPlayerExitVehicle", getVehicleForNetworkEvent(vehicle), seat);
- if(inVehicleSeat) {
- parkedVehiclePosition = false;
- parkedVehicleHeading = false;
- }
+ if (inVehicleSeat) {
+ parkedVehiclePosition = false;
+ parkedVehicleHeading = false;
+ }
}
// ===========================================================================
function onLocalPlayerEnteredVehicle(event, vehicle, seat) {
- logToConsole(LOG_DEBUG, `[VRR.Event] Local player entered vehicle`);
+ logToConsole(LOG_DEBUG, `[VRR.Event] Local player entered vehicle`);
- sendNetworkEventToServer("vrr.onPlayerEnterVehicle", getVehicleForNetworkEvent(vehicle), seat);
+ sendNetworkEventToServer("vrr.onPlayerEnterVehicle", getVehicleForNetworkEvent(vehicle), seat);
- if(areServerElementsSupported()) {
- if(inVehicleSeat == 0) {
- inVehicle.engine = false;
- if(!inVehicle.engine) {
- parkedVehiclePosition = inVehicle.position;
- parkedVehicleHeading = inVehicle.heading;
- }
- }
- }
+ if (areServerElementsSupported()) {
+ //if(inVehicleSeat == 0) {
+ //setVehicleEngine(vehicle, false);
+ //if(!inVehicle.engine) {
+ // parkedVehiclePosition = inVehicle.position;
+ // parkedVehicleHeading = inVehicle.heading;
+ //}
+ //}
+ }
}
// ===========================================================================
function onPedInflictDamage(event, damagedEntity, damagerEntity, weaponId, healthLoss, pedPiece) {
- //let damagerEntityString = (!isNull(damagedEntity)) ? `${damagerEntity.name} (${damagerEntity.name}, ${damagerEntity.type} - ${typeof damagerEntity})` : `Unknown ped`;
- //let damagedEntityString = (!isNull(damagedEntity)) ? `${damagedEntity.name} (${damagedEntity.name}, ${damagedEntity.type} - ${typeof damagedEntity})` : `Unknown ped`;
- //logToConsole(LOG_DEBUG, `[VRR.Event] ${damagerEntityString} damaged ${damagedEntityString}'s '${pedPiece} with weapon ${weaponId}`);
- if(!isNull(damagedEntity) && !isNull(damagerEntity)) {
- if(damagedEntity.isType(ELEMENT_PLAYER)) {
- if(damagedEntity == localPlayer) {
- //if(!weaponDamageEnabled[damagerEntity.name]) {
- event.preventDefault();
- sendNetworkEventToServer("vrr.weaponDamage", damagerEntity.name, weaponId, pedPiece, healthLoss);
- //}
- }
- }
- }
+ //let damagerEntityString = (!isNull(damagedEntity)) ? `${damagerEntity.name} (${damagerEntity.name}, ${damagerEntity.type} - ${typeof damagerEntity})` : `Unknown ped`;
+ //let damagedEntityString = (!isNull(damagedEntity)) ? `${damagedEntity.name} (${damagedEntity.name}, ${damagedEntity.type} - ${typeof damagedEntity})` : `Unknown ped`;
+ //logToConsole(LOG_DEBUG, `[VRR.Event] ${damagerEntityString} damaged ${damagedEntityString}'s '${pedPiece} with weapon ${weaponId}`);
+ if (!isNull(damagedEntity) && !isNull(damagerEntity)) {
+ if (damagedEntity.isType(ELEMENT_PLAYER)) {
+ if (damagedEntity == localPlayer) {
+ //if(!weaponDamageEnabled[damagerEntity.name]) {
+ preventDefaultEventAction(event);
+ sendNetworkEventToServer("vrr.weaponDamage", damagerEntity.name, weaponId, pedPiece, healthLoss);
+ //}
+ }
+ }
+ }
}
// ===========================================================================
function onLocalPlayerEnterSphere(event, sphere) {
- logToConsole(LOG_DEBUG, `[VRR.Event] Local player entered sphere`);
- if(sphere == jobRouteLocationSphere) {
- enteredJobRouteSphere();
- }
+ logToConsole(LOG_DEBUG, `[VRR.Event] Local player entered sphere`);
+ if (sphere == jobRouteLocationSphere) {
+ enteredJobRouteSphere();
+ }
}
// ===========================================================================
function onLocalPlayerExitSphere(event, sphere) {
- logToConsole(LOG_DEBUG, `[VRR.Event] Local player exited sphere`);
+ logToConsole(LOG_DEBUG, `[VRR.Event] Local player exited sphere`);
}
// ===========================================================================
function onLostFocus(event) {
- processLostFocusAFK();
+ processLostFocusAFK();
}
// ===========================================================================
function onFocus(event) {
- processFocusAFK();
+ processFocusAFK();
}
// ===========================================================================
function onLocalPlayerSwitchWeapon(oldWeapon, newWeapon) {
+
}
// ===========================================================================
function onCameraProcess(event) {
+
+}
+
+// ===========================================================================
+
+function onMouseWheel(event, mouseId, deltaCoordinates, flipped) {
+ processMouseWheelForChatBox(mouseId, deltaCoordinates, flipped);
+}
+
+// ===========================================================================
+
+function onEntityProcess(event, entity) {
+ if (!isSpawned) {
+ return false;
+ }
+
+ //if(entity.isType(ELEMENT_PED) && !entity.isType(ELEMENT_PLAYER)) {
+ // processNPCMovement(entity);
+ //}
}
// ===========================================================================
\ No newline at end of file
diff --git a/scripts/client/gps.js b/scripts/client/gps.js
new file mode 100644
index 00000000..ee6415e9
--- /dev/null
+++ b/scripts/client/gps.js
@@ -0,0 +1,65 @@
+// ===========================================================================
+// Vortrex's Roleplay Resource
+// https://github.com/VortrexFTW/gtac_roleplay
+// ===========================================================================
+// FILE: gps.js
+// DESC: Provides GPS functions and usage
+// TYPE: Client (JavaScript)
+// ===========================================================================
+
+let gpsBlip = null;
+let gpsBlipBlinkTimes = 0;
+let gpsBlipBlinkAmount = 0;
+let gpsBlipBlinkInterval = 500;
+let gpsBlipBlinkTimer = null;
+
+// ===========================================================================
+
+function showGPSLocation(position, colour) {
+ logToConsole(LOG_DEBUG, `[VRR.GPS] Showing gps location`);
+ if(getMultiplayerMod() == VRR_MPMOD_GTAC) {
+ if(getGame() == VRR_GAME_GTA_SA) {
+ // Server-side spheres don't show in GTA SA for some reason.
+ gpsSphere = game.createPickup(1318, position, 1);
+ } else {
+ gpsSphere = game.createSphere(position, 3);
+ gpsSphere.colour = colour;
+ }
+
+ if(gpsBlip != null) {
+ destroyElement(gpsBlip);
+ }
+
+ // Blinking is bugged if player hit the spot before it stops blinking.
+ blinkGPSBlip(10, position, colour);
+ gpsBlip = game.createBlip(position, 0, 2, colour);
+ }
+}
+
+// ===========================================================================
+
+function blinkGPSBlip(times, position, colour) {
+ gpsBlipBlinkTimes = times;
+ gpsBlipBlinkTimer = setInterval(function() {
+ if(gpsBlip != null) {
+ destroyElement(gpsBlip);
+ gpsBlip = null;
+ } else {
+ gpsBlip = game.createBlip(position, 0, 2, colour);
+ }
+
+ if(gpsBlipBlinkAmount >= gpsBlipBlinkTimes) {
+ if(gpsBlip != null) {
+ destroyElement(gpsBlip);
+ gpsBlip = null;
+ }
+
+ gpsBlipBlinkAmount = 0;
+ gpsBlipBlinkTimes = 0;
+ gpsBlip = game.createBlip(position, 0, 2, colour);
+ clearInterval(gpsBlipBlinkTimer);
+ }
+ }, gpsBlipBlinkInterval);
+}
+
+// ===========================================================================
\ No newline at end of file
diff --git a/scripts/client/gui.js b/scripts/client/gui.js
index 86bd4cf3..7930102f 100644
--- a/scripts/client/gui.js
+++ b/scripts/client/gui.js
@@ -12,7 +12,7 @@ var app = {};
let mainFont = "Roboto"; // "Arial"
//let mainLogoPath = (typeof gta == "undefined") ? "files/images/mafiac-logo.png" : "files/images/gtac-logo.png";
-let mainLogoPath = "files/images/server-logo.png";
+let mainLogoPath = "files/images/asshat-logo.png";
let primaryColour = [200, 200, 200];
let secondaryColour = [16, 16, 16];
@@ -29,27 +29,6 @@ let textInputAlpha = 180;
let guiReady = false;
-let guiSubmitKey = false;
-let guiLeftKey = false;
-let guiRightKey = false;
-let guiUpKey = false;
-let guiDownKey = false;
-
-// ===========================================================================
-
-let placesOfOrigin = [
- "Liberty City",
- "Vice City",
- "Los Santos",
- "San Fierro",
- "Las Venturas",
- "San Andreas",
- "Blaine County",
- "Red County",
- "Bone County",
- "Other",
-];
-
// ===========================================================================
let characterData = [];
@@ -81,11 +60,19 @@ function initGUI() {
initListGUI();
initResetPasswordGUI();
initChangePasswordGUI();
+ initLocaleChooserGUI();
closeAllWindows();
guiReady = true;
logToConsole(LOG_DEBUG, `[VRR.GUI] All GUI created successfully!`);
+
+ loadLocaleConfig();
+ loadAllLocaleStrings();
+
+ resetGUIStrings();
+ resetLocaleChooserOptions();
+
sendNetworkEventToServer("vrr.guiReady", true);
};
@@ -102,9 +89,10 @@ function closeAllWindows() {
characterSelect.window.shown = false;
twoFactorAuth.window.shown = false;
listDialog.window.shown = false;
- resetPassword.window.shown = false;
+ passwordReset.window.shown = false;
passwordChange.window.shown = false;
-
+ localeChooser.window.shown = false;
+
mexui.setInput(false);
mexui.focusedControl = false;
@@ -113,56 +101,62 @@ function closeAllWindows() {
guiRightKey = false;
guiUpKey = false;
guiDownKey = false;
+
+ setChatWindowEnabled(true);
}
// ===========================================================================
function isAnyGUIActive() {
- if(!guiReady) {
+ if (!guiReady) {
return false;
}
- if(infoDialog.window.shown == true) {
+ if (infoDialog.window.shown == true) {
return true;
}
- if(yesNoDialog.window.shown == true) {
+ if (yesNoDialog.window.shown == true) {
return true;
}
- if(errorDialog.window.shown == true) {
+ if (errorDialog.window.shown == true) {
return true;
}
- if(register.window.shown == true) {
+ if (register.window.shown == true) {
return true;
}
- if(login.window.shown == true) {
+ if (login.window.shown == true) {
return true;
}
- if(newCharacter.window.shown == true) {
+ if (newCharacter.window.shown == true) {
return true;
}
- if(characterSelect.window.shown == true) {
+ if (characterSelect.window.shown == true) {
return true;
}
- if(twoFactorAuth.window.shown == true) {
+ if (twoFactorAuth.window.shown == true) {
return true;
}
- if(listDialog.window.shown == true) {
+ if (listDialog.window.shown == true) {
return true;
}
- if(resetPassword.window.shown == true) {
+ if (passwordReset.window.shown == true) {
return true;
}
- if(passwordChange.window.shown == true) {
+ if (passwordChange.window.shown == true) {
+ return true;
+ }
+
+ if (localeChooser.window.shown == true) {
return true;
}
@@ -171,150 +165,63 @@ function isAnyGUIActive() {
// ===========================================================================
-addNetworkEventHandler("vrr.showCharacterSelect", function(firstName, lastName, cash, clan, lastPlayed, skinId) {
- logToConsole(LOG_DEBUG, `[VRR.GUI] Received request from server to show character selection window`);
- showCharacterSelectGUI(firstName, lastName, cash, clan, lastPlayed, skinId);
-});
-
-// ===========================================================================
-
-addNetworkEventHandler("vrr.switchCharacterSelect", function(firstName, lastName, cash, clan, lastPlayed, skinId) {
- logToConsole(LOG_DEBUG, `[VRR.GUI] Received request from server to update character selection window with new info`);
- switchCharacterSelectGUI(firstName, lastName, cash, clan, lastPlayed, skinId);
-});
-
-// ===========================================================================
-
-addNetworkEventHandler("vrr.showError", function(errorMessage, errorTitle) {
- logToConsole(LOG_DEBUG, `[VRR.GUI] Received request from server to show error window`);
- showError(errorMessage, errorTitle);
-});
-
-// ===========================================================================
-
-addNetworkEventHandler("vrr.showPrompt", function(promptMessage, promptTitle) {
- logToConsole(LOG_DEBUG, `[VRR.GUI] Received request from server to show prompt window`);
- showYesNoPromptGUI(promptMessage, promptTitle);
-});
-
-// ===========================================================================
-
-addNetworkEventHandler("vrr.showInfo", function(infoMessage) {
- logToConsole(LOG_DEBUG, `[VRR.GUI] Received request from server to show info dialog`);
- showInfo(infoMessage);
-});
-
-// ===========================================================================
-
-addNetworkEventHandler("vrr.loginSuccess", function() {
- logToConsole(LOG_DEBUG, `[VRR.GUI] Received signal of successful login from server`);
- loginSuccess();
-});
-
-// ===========================================================================
-
-addNetworkEventHandler("vrr.characterSelectSuccess", function() {
- logToConsole(LOG_DEBUG, `[VRR.GUI] Received signal of successful character selection from server`);
- characterSelectSuccess();
- setChatWindowEnabled(true);
-});
-
-// ===========================================================================
-
-addNetworkEventHandler("vrr.loginFailed", function(remainingAttempts) {
- logToConsole(LOG_DEBUG, `[VRR.GUI] Received signal of failed login from server`);
- loginFailed(remainingAttempts);
-});
-
-// ===========================================================================
-
-addNetworkEventHandler("vrr.registrationSuccess", function() {
- logToConsole(LOG_DEBUG, `[VRR.GUI] Received signal of successful registration from server`);
- registrationSuccess();
-});
-
-// ===========================================================================
-
-addNetworkEventHandler("vrr.registrationFailed", function(errorMessage) {
- logToConsole(LOG_DEBUG, `[VRR.GUI] Received signal of failed registration from server`);
- registrationFailed(errorMessage);
-});
-
-// ===========================================================================
-
-addNetworkEventHandler("vrr.newCharacterFailed", function(errorMessage) {
- logToConsole(LOG_DEBUG, `[VRR.GUI] Received signal of failed registration from server`);
- newCharacterFailed(errorMessage);
-});
-
-// ===========================================================================
-
-addNetworkEventHandler("vrr.changePassword", function() {
- logToConsole(LOG_DEBUG, `[VRR.GUI] Received signal to change password from server`);
- showChangePasswordGUI();
-});
-
-// ===========================================================================
-
-addNetworkEventHandler("vrr.showResetPasswordCodeInput", function() {
- logToConsole(LOG_DEBUG, `[VRR.GUI] Received signal to input reset password code from server`);
- resetPasswordCodeInputGUI();
-});
-
-// ===========================================================================
-
-addNetworkEventHandler("vrr.guiColour", function(red1, green1, blue1, red2, green2, blue2, red3, green3, blue3) {
+function setGUIColours(red1, green1, blue1, red2, green2, blue2, red3, green3, blue3) {
logToConsole(LOG_DEBUG, `[VRR.GUI] Received new GUI colours from server: ${red1}, ${green1}, ${blue1} / ${red2}, ${green2}, ${blue2} / ${red3}, ${green3}, ${blue3}`);
primaryColour = [red1, green1, blue1];
secondaryColour = [red2, green2, blue2];
primaryTextColour = [red3, green3, blue3];
- focusedColour = [red1+focusedColourOffset, green1+focusedColourOffset, blue1+focusedColourOffset];
+ focusedColour = [red1 + focusedColourOffset, green1 + focusedColourOffset, blue1 + focusedColourOffset];
initGUI();
-});
-
-// ===========================================================================
-
-addNetworkEventHandler("vrr.guiInit", function() {
- logToConsole(LOG_DEBUG, `[VRR.GUI] Initializing MexUI app`);
- //initGUI();
- sendNetworkEventToServer("vrr.guiReady", true);
-});
+}
// ===========================================================================
function hideAllGUI() {
- closeAllWindows();
- setChatWindowEnabled(true);
+ closeAllWindows();
+ setChatWindowEnabled(true);
guiSubmitKey = false;
}
// ===========================================================================
function processGUIKeyPress(keyCode) {
- if(!isAnyGUIActive()) {
+ logToConsole(LOG_DEBUG, `[VRR.GUI] Processing key press: ${keyCode}`);
+
+ if (!isAnyGUIActive()) {
+ logToConsole(LOG_DEBUG, `[VRR.GUI] GUI is not active. Cancelling keypress processing.`);
return false;
}
- if(keyCode == SDLK_RETURN || keyCode == SDLK_RETURN2) {
- if(guiSubmitKey != false) {
- guiSubmitKey();
+ if (keyCode == SDLK_RETURN || keyCode == SDLK_RETURN2) {
+ logToConsole(LOG_DEBUG, `[VRR.GUI] Key press is submit (${guiSubmitKey})`);
+ if (guiSubmitKey != false) {
+ logToConsole(LOG_DEBUG, `[VRR.GUI] Calling submit key function`);
+ guiSubmitKey.call();
}
- } else if(keyCode == getKeyIdFromParams("left") || keyCode == getKeyIdFromParams("a")) {
- if(guiLeftKey != false) {
- guiLeftKey();
+ } else if (keyCode == getKeyIdFromParams("left") || keyCode == getKeyIdFromParams("a")) {
+ logToConsole(LOG_DEBUG, `[VRR.GUI] Key press is left (${guiLeftKey})`);
+ if (guiLeftKey != false) {
+ logToConsole(LOG_DEBUG, `[VRR.GUI] Calling left key function`);
+ guiLeftKey.call();
}
- } else if(keyCode == getKeyIdFromParams("right") || keyCode == getKeyIdFromParams("d")) {
- if(guiRightKey != false) {
- guiRightKey();
+ } else if (keyCode == getKeyIdFromParams("right") || keyCode == getKeyIdFromParams("d")) {
+ logToConsole(LOG_DEBUG, `[VRR.GUI] Key press is right (${guiRightKey})`);
+ if (guiRightKey != false) {
+ logToConsole(LOG_DEBUG, `[VRR.GUI] Calling right key function`);
+ guiRightKey.call();
}
- } else if(keyCode == getKeyIdFromParams("down") || keyCode == getKeyIdFromParams("s")) {
- if(guiDownKey != false) {
- guiDownKey();
+ } else if (keyCode == getKeyIdFromParams("down") || keyCode == getKeyIdFromParams("s")) {
+ logToConsole(LOG_DEBUG, `[VRR.GUI] Key press is down (${guiDownKey})`);
+ if (guiDownKey != false) {
+ logToConsole(LOG_DEBUG, `[VRR.GUI] Calling down key function`);
+ guiDownKey.call();
}
- } else if(keyCode == getKeyIdFromParams("up") || keyCode == getKeyIdFromParams("w")) {
- if(guiUpKey != false) {
- guiUpKey();
+ } else if (keyCode == getKeyIdFromParams("up") || keyCode == getKeyIdFromParams("w")) {
+ logToConsole(LOG_DEBUG, `[VRR.GUI] Key press is up (${guiUpKey})`);
+ if (guiUpKey != false) {
+ logToConsole(LOG_DEBUG, `[VRR.GUI] Calling up key function`);
+ guiUpKey.call();
}
}
}
@@ -322,9 +229,55 @@ function processGUIKeyPress(keyCode) {
// ===========================================================================
function processToggleGUIKeyPress(keyCode) {
- if(keyCode == disableGUIKey) {
+ if (keyCode == disableGUIKey) {
sendNetworkEventToServer("vrr.toggleGUI");
}
}
// ===========================================================================
+
+function resetGUIStrings() {
+ // Login GUI
+ login.messageLabel.text = getLocaleString("GUILoginWindowLabelEnterPassword");
+ login.passwordInput.placeholder = getLocaleString("GUILoginWindowPasswordPlaceholder");
+ login.loginButton.text = toUpperCase(getLocaleString("GUILoginWindowSubmitButton"));
+ login.forgotPasswordButton.text = toUpperCase(getLocaleString("GUILoginWindowResetPasswordButton"));
+ login.resetPasswordLabel.text = getLocaleString("GUILoginWindowForgotPasswordLabel");
+
+ // Register GUI
+ register.messageLabel.text = getLocaleString("GUIRegisterWindowLabelCreateAccount");
+ register.passwordInput.placeholder = getLocaleString("GUIRegisterWindowPasswordPlaceholder");
+ register.confirmPasswordInput.placeholder = getLocaleString("GUIRegisterWindowConfirmPasswordPlaceholder");
+ register.emailInput.placeholder = getLocaleString("GUIRegisterWindowEmailPlaceholder");
+ register.registerButton.text = toUpperCase(getLocaleString("GUIRegisterWindowSubmitButton"));
+
+ // Change Password GUI
+ passwordChange.window.title = toUpperCase(getLocaleString("GUIChangePasswordWindowTitle"));
+ passwordChange.messageLabel.text = getLocaleString("GUIChangePasswordPasswordLabel");
+ passwordChange.passwordInput.placeholder = getLocaleString("GUIChangePasswordPasswordPlaceholder");
+ passwordChange.confirmPasswordInput.placeholder = getLocaleString("GUIChangePasswordConfirmPasswordPlaceholder");
+ passwordChange.submitButton.text = toUpperCase(getLocaleString("GUIChangePasswordSubmitButton"));
+
+ // Reset Password GUI
+ passwordReset.messageLabel.text = toUpperCase(getLocaleString("GUIResetPasswordConfirmEmailLabel"));
+ passwordReset.emailInput.placeholder = getLocaleString("GUIResetPasswordEmailPlaceholder");
+ passwordReset.resetPasswordButton.text = toUpperCase(getLocaleString("GUIResetPasswordSubmitButton"));
+ passwordReset.backToLoginButton.text = toUpperCase(getLocaleString("GUIResetPasswordLoginButton"));
+ passwordReset.backToLoginLabel.text = getLocaleString("GUIResetPasswordRememberMessage");
+
+ // Character Selection GUI
+ characterSelect.window.title = toUpperCase(getLocaleString("GUICharacterSelectWindowTitle"));
+ characterSelect.cashText.text = getLocaleString("GUICharacterSelectMoneyLabel", "0");
+ characterSelect.clanText.text = getLocaleString("GUICharacterSelectClanLabel", "None");
+ characterSelect.lastPlayedText.text = getLocaleString("GUICharacterSelectLastPlayedLabel", "Never");
+ characterSelect.previousCharacterButton.text = toUpperCase(getLocaleString("GUIPreviousCharacterButton"));
+ characterSelect.nextCharacterButton.text = toUpperCase(getLocaleString("GUINextCharacterButton"));
+ characterSelect.selectCharacterButton.text = toUpperCase(getLocaleString("GUIPlayAsCharacterButton"));
+ characterSelect.newCharacterButton.text = toUpperCase(getLocaleString("GUINewCharacterButton"));
+
+ // Character Creation GUI
+ newCharacter.messageLabel.text = getLocaleString("GUINewCharacterMessageLabel");
+ newCharacter.firstNameInput.placeholder = getLocaleString("GUINewCharacterFirstNamePlaceholder");
+ newCharacter.lastNameInput.placeholder = getLocaleString("GUINewCharacterLastNamePlaceholder");
+ newCharacter.createCharacterButton.text = toUpperCase(getLocaleString("GUINewCharacterSubmitButton"));
+}
\ No newline at end of file
diff --git a/scripts/client/gui/changepass.js b/scripts/client/gui/changepass.js
index b95a4b22..c600245e 100644
--- a/scripts/client/gui/changepass.js
+++ b/scripts/client/gui/changepass.js
@@ -19,8 +19,8 @@ let passwordChange = {
// ===========================================================================
function initChangePasswordGUI() {
- logToConsole(LOG_DEBUG, `[VRR.GUI] Creating password change GUI ...`);
- passwordChange.window = mexui.window(game.width/2-130, game.height/2-125, 300, 250, 'Change Password', {
+ logToConsole(LOG_DEBUG, `[VRR.GUI] Creating password change GUI ...`);
+ passwordChange.window = mexui.window(game.width / 2 - 130, game.height / 2 - 125, 300, 250, 'Change Password', {
main: {
backgroundColour: toColour(secondaryColour[0], secondaryColour[1], secondaryColour[2], windowAlpha),
transitionTime: 500,
@@ -36,16 +36,17 @@ function initChangePasswordGUI() {
backgroundColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], windowTitleAlpha),
}
});
- passwordChange.window.titleBarIconSize = toVector2(0,0);
+ passwordChange.window.titleBarIconSize = toVector2(0, 0);
passwordChange.window.titleBarHeight = 0;
+ passwordChange.window.titleBarShown = false;
- passwordChange.window.image(85, -10, 140, 140, mainLogoPath, {
+ passwordChange.window.image(100, 20, 75, 75, mainLogoPath, {
focused: {
borderColour: toColour(0, 0, 0, 0),
},
});
- passwordChange.messageLabel = passwordChange.window.text(20, 75, 260, 20, 'Enter a new password', {
+ passwordChange.messageLabel = passwordChange.window.text(20, 95, 260, 20, 'Enter a new password', {
main: {
textSize: 10.0,
textAlign: 0.5,
@@ -132,14 +133,17 @@ function checkChangePassword() {
// ===========================================================================
-function showChangePasswordGUI() {
+function showChangePasswordGUI(errorMessage) {
logToConsole(LOG_DEBUG, `[VRR.GUI] Showing change password window`);
closeAllWindows();
setChatWindowEnabled(false);
mexui.setInput(true);
passwordChange.window.shown = true;
+ passwordChange.messageLabel = errorMessage;
mexui.focusedControl = passwordChange.passwordInput;
guiSubmitKey = checkChangePassword;
+
+ showLocaleChooserGUI(new Vec2(getScreenWidth() / 2 - (localeChooser.window.size.x / 2), passwordChange.window.position.y + passwordChange.window.size.y + 20));
}
// ===========================================================================
diff --git a/scripts/client/gui/charselect.js b/scripts/client/gui/charselect.js
index fb9b25fb..434e3a91 100644
--- a/scripts/client/gui/charselect.js
+++ b/scripts/client/gui/charselect.js
@@ -24,23 +24,26 @@ let characterSelect = {
function initCharacterSelectGUI() {
logToConsole(LOG_DEBUG, `[VRR.GUI] Creating character select GUI ...`);
- characterSelect.window = mexui.window(game.width/2-215, game.height/2-83, 430, 190, 'Select Character', {
+ characterSelect.window = mexui.window(game.width/2-215, game.height/2-83, 430, 190, 'SELECT CHARACTER', {
main: {
backgroundColour: toColour(secondaryColour[0], secondaryColour[1], secondaryColour[2], windowAlpha),
},
title: {
- textSize: 12.0,
- textColour: toColour(0, 0, 0, 0),
+ textSize: 12.0,
+ textFont: mainFont,
+ textColour: toColour(0, 0, 0, 255),
backgroundColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], windowTitleAlpha),
},
icon: {
- textSize: 12.0,
- textColour: toColour(0, 0, 0, 0),
+ textSize: 10.0,
+ textFont: mainFont,
+ textColour: toColour(0, 0, 0, 255),
backgroundColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], windowTitleAlpha),
}
});
- characterSelect.window.titleBarIconSize = toVector2(0,0);
- characterSelect.window.titleBarHeight = 0;
+ characterSelect.window.titleBarIconSize = toVector2(0, 0);
+ characterSelect.window.titleBarIconShown = false;
+ characterSelect.window.titleBarHeight = 30;
characterSelect.nameText = characterSelect.window.text(5, 40, 200, 25, 'Lastname, Firstname', {
main: {
@@ -163,6 +166,12 @@ function showCharacterSelectGUI(firstName, lastName, cash, clan, lastPlayed, ski
characterSelect.lastPlayedText.text = `Last Played: ${lastPlayed}`;
characterSelect.skinImage = characterSelect.window.image(310, 32, 100, 90, "files/images/skins/none.png");
characterSelect.window.shown = true;
+
+ guiSubmitKey = selectThisCharacter;
+ guiLeftKey = selectPreviousCharacter;
+ guiRightKey = selectNextCharacter;
+
+ showLocaleChooserGUI(new Vec2(getScreenWidth()/2-(localeChooser.window.size.x/2), characterSelect.window.position.y+characterSelect.window.size.y+20));
}
// ===========================================================================
@@ -211,6 +220,7 @@ function switchCharacterSelectGUI(firstName, lastName, cash, clan, lastPlayed, s
characterSelect.skinImage = (getGame() == VRR_GAME_GTA_III) ? characterSelect.window.image(310, 32, 100, 90, `files/images/skins/gta3/${getSkinImage(skinId)}.png`) : characterSelect.window.image(310, 32, 100, 90, "files/images/skins/none.png");
characterSelect.window.shown = true;
+
guiSubmitKey = selectThisCharacter;
guiLeftKey = selectPreviousCharacter;
guiRightKey = selectNextCharacter;
diff --git a/scripts/client/gui/clanmgr.js b/scripts/client/gui/clanmgr.js
index 631635dd..33348a65 100644
--- a/scripts/client/gui/clanmgr.js
+++ b/scripts/client/gui/clanmgr.js
@@ -8,13 +8,13 @@
// ===========================================================================
let clanManager = {
- window: null,
- generalTab: null,
- ranksTab: null,
- membersTab: null,
- vehiclesTab: null,
- businessesTab: null,
- housesTab: null,
+ window: null,
+ generalTab: null,
+ ranksTab: null,
+ membersTab: null,
+ vehiclesTab: null,
+ businessesTab: null,
+ housesTab: null,
};
// ===========================================================================
\ No newline at end of file
diff --git a/scripts/client/gui/error.js b/scripts/client/gui/error.js
index 25315568..360afa9e 100644
--- a/scripts/client/gui/error.js
+++ b/scripts/client/gui/error.js
@@ -16,59 +16,61 @@ let errorDialog = {
// ===========================================================================
function initErrorDialogGUI() {
- logToConsole(LOG_DEBUG, `[VRR.GUI] Creating error GUI ...`);
- errorDialog.window = mexui.window(game.width/2-200, game.height/2-70, 500, 140, 'ERROR', {
- main: {
- backgroundColour: toColour(secondaryColour[0], secondaryColour[1], secondaryColour[2], windowAlpha),
- transitionTime: 500,
- },
- title: {
- textSize: 11.0,
- textColour: toColour(primaryTextColour[0], primaryTextColour[1], primaryTextColour[2], 255),
- backgroundColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], windowTitleAlpha),
- },
- icon: {
- textSize: 0.0,
- textColour: toColour(0, 0, 0, 0),
- backgroundColour: toColour(0, 0, 0, 0),
- },
- });
+ logToConsole(LOG_DEBUG, `[VRR.GUI] Creating error GUI ...`);
+ errorDialog.window = mexui.window(getScreenWidth()/2-200, getScreenHeight()/2-70, 400, 140, 'ERROR', {
+ main: {
+ backgroundColour: toColour(secondaryColour[0], secondaryColour[1], secondaryColour[2], windowAlpha),
+ transitionTime: 500,
+ },
+ title: {
+ textSize: 11.0,
+ textColour: toColour(primaryTextColour[0], primaryTextColour[1], primaryTextColour[2], 255),
+ backgroundColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], windowTitleAlpha),
+ },
+ icon: {
+ textSize: 0.0,
+ textColour: toColour(0, 0, 0, 0),
+ backgroundColour: toColour(0, 0, 0, 0),
+ },
+ });
- errorDialog.messageLabel = errorDialog.window.text(15, 50, 470, 75, 'Error Message', {
- main: {
- textSize: 10.0,
- textAlign: 0.5,
- textColour: toColour(255, 255, 255, 255),
- textFont: mainFont,
- },
- focused: {
- borderColour: toColour(0, 0, 0, 0),
- },
- });
+ errorDialog.messageLabel = errorDialog.window.text(15, 50, 370, 20, 'Error Message', {
+ main: {
+ textSize: 10.0,
+ textAlign: 0.5,
+ textColour: toColour(255, 255, 255, 255),
+ textFont: mainFont,
+ },
+ focused: {
+ borderColour: toColour(0, 0, 0, 0),
+ },
+ });
- errorDialog.okayButton = errorDialog.window.button(5, 105, 390, 30, 'OK', {
- main: {
- backgroundColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], buttonAlpha),
- textColour: toColour(primaryTextColour[0], primaryTextColour[1], primaryTextColour[2], 255),
- textSize: 10.0,
- textFont: mainFont,
- textAlign: 0.5,
- },
- focused: {
- borderColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], 255),
- },
- }, closeErrorDialog);
- logToConsole(LOG_DEBUG, `[VRR.GUI] Created error GUI ...`);
+ errorDialog.okayButton = errorDialog.window.button(5, 105, 390, 30, 'OK', {
+ main: {
+ backgroundColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], buttonAlpha),
+ textColour: toColour(primaryTextColour[0], primaryTextColour[1], primaryTextColour[2], 255),
+ textSize: 10.0,
+ textFont: mainFont,
+ textAlign: 0.5,
+ },
+ focused: {
+ borderColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], 255),
+ },
+ }, closeErrorDialog);
+ logToConsole(LOG_DEBUG, `[VRR.GUI] Created error GUI ...`);
}
// ===========================================================================
-function showErrorGUI(errorMessage, errorTitle) {
+function showErrorGUI(errorMessage, errorTitle, buttonText) {
closeAllWindows();
logToConsole(LOG_DEBUG, `[VRR.GUI] Showing error window. Error: ${errorTitle} - ${errorMessage}`);
setChatWindowEnabled(false);
mexui.setInput(true);
errorDialog.messageLabel.text = errorMessage;
+ errorDialog.okayButton.text = buttonText;
+ errorDialog.window.title = errorTitle;
errorDialog.window.shown = true;
}
diff --git a/scripts/client/gui/info.js b/scripts/client/gui/info.js
index 7ecff81b..c6066df8 100644
--- a/scripts/client/gui/info.js
+++ b/scripts/client/gui/info.js
@@ -17,7 +17,7 @@ let infoDialog = {
function initInfoDialogGUI() {
logToConsole(LOG_DEBUG, `[VRR.GUI] Creating info dialog GUI ...`);
- infoDialog.window = mexui.window(game.width/2-200, game.height/2-70, 400, 140, 'Information', {
+ infoDialog.window = mexui.window(getScreenWidth()/2-200, getScreenHeight()/2-70, 400, 140, 'Information', {
main: {
backgroundColour: toColour(secondaryColour[0], secondaryColour[1], secondaryColour[2], windowAlpha),
},
@@ -70,11 +70,13 @@ function closeInfoDialog() {
// ===========================================================================
-function showInfo(infoMessage, infoTitle) {
+function showInfoGUI(infoMessage, infoTitle, buttonText) {
closeAllWindows();
logToConsole(LOG_DEBUG, `[VRR.GUI] Showing info dialog window. Info: ${infoTitle} - ${infoMessage}`);
mexui.setInput(true);
infoDialog.messageLabel.text = infoMessage;
+ infoDialog.okayButton.text = buttonText;
+ infoDialog.window.title = infoTitle;
infoDialog.window.shown = true;
}
diff --git a/scripts/client/gui/localechooser.js b/scripts/client/gui/localechooser.js
new file mode 100644
index 00000000..e0bdf063
--- /dev/null
+++ b/scripts/client/gui/localechooser.js
@@ -0,0 +1,116 @@
+// ===========================================================================
+// Vortrex's Roleplay Resource
+// https://github.com/VortrexFTW/gtac_roleplay
+// ===========================================================================
+// FILE: localechooser.js
+// DESC: Provides locale chooser GUI
+// TYPE: Client (JavaScript)
+// ===========================================================================
+
+let localeChooser = {
+ window: null,
+ flagImages: [],
+ activeRingImages: [],
+};
+
+let flagImageSize = toVector2(30, 30);
+let flagImageGap = toVector2(5, 5);
+
+// ===========================================================================
+
+function initLocaleChooserGUI() {
+ logToConsole(LOG_DEBUG, `[VRR.GUI] Creating locale chooser GUI ...`);
+ localeChooser.window = mexui.window(game.width/2-200, game.height-150, 60, 60, 'Choose a language', {
+ main: {
+ backgroundColour: toColour(secondaryColour[0], secondaryColour[1], secondaryColour[2], 0),
+ },
+ title: {
+ textSize: 11.0,
+ textColour: toColour(primaryTextColour[0], primaryTextColour[1], primaryTextColour[2], 255),
+ backgroundColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], windowTitleAlpha),
+ },
+ icon: {
+ textSize: 0.0,
+ textColour: toColour(0, 0, 0, 0),
+ backgroundColour: toColour(0, 0, 0, 0),
+ },
+ });
+ localeChooser.window.titleBarShown = false;
+
+ loadLocaleConfig();
+
+ logToConsole(LOG_DEBUG, `[VRR.GUI] Created locale chooser GUI`);
+}
+
+// ===========================================================================
+
+function closeLocaleChooserGUI() {
+ logToConsole(LOG_DEBUG, `[VRR.GUI] Closing locale chooser window`);
+ localeChooser.window.shown = false;
+ mexui.setInput(false);
+}
+
+// ===========================================================================
+
+function showLocaleChooserGUI(position = toVector2(0.0, 0.0)) {
+ if(position.x != 0.0 && position.y != 0.0) {
+ localeChooser.window.position = position;
+ } else {
+ localeChooser.window.position = toVector2((getScreenWidth()/2)-(localeChooser.window.size.x/2), getScreenHeight()-100);
+ }
+
+ //closeAllWindows();
+ logToConsole(LOG_DEBUG, `[VRR.GUI] Showing locale chooser window`);
+ mexui.setInput(true);
+ localeChooser.window.shown = true;
+}
+
+// ===========================================================================
+
+function toggleLocaleChooserGUI() {
+ if(localeChooser.window.shown) {
+ closeLocaleChooserGUI();
+ } else {
+ showLocaleChooserGUI();
+ }
+}
+
+// ===========================================================================
+
+function localeChooserSetLocale(localeId) {
+ logToConsole(LOG_DEBUG|LOG_WARN, `[VRR.GUI] Asking server to change locale to ${localeId}`);
+ sendLocaleSelectToServer(localeId);
+}
+
+// ===========================================================================
+
+function resetLocaleChooserOptions() {
+ logToConsole(LOG_DEBUG|LOG_WARN, `[VRR.GUI] Resetting locale chooser options`);
+
+ // let tempLocaleOptions = getServerData().localeOptions; // getAvailableLocaleOptions();
+ let tempLocaleOptions = getAvailableLocaleOptions();
+
+ localeChooser.window.size = toVector2((tempLocaleOptions.length*(flagImageSize.x+flagImageGap.x))+flagImageGap.x, flagImageSize.y+flagImageGap.y*2);
+ localeChooser.window.position = toVector2((getScreenWidth()/2)-(localeChooser.window.size.x/2), getScreenHeight()-100);
+
+ for(let i in localeChooser.flagImages) {
+ localeChooser.flagImages[i].remove();
+ }
+
+ for(let i in tempLocaleOptions) {
+ let imagePath = `files/images/flags/${tempLocaleOptions[i].flagImageFile}`;
+ localeChooser.flagImages[i] = localeChooser.window.image((i*(flagImageSize.x+flagImageGap.x))+flagImageGap.x, flagImageGap.y, flagImageSize.x, flagImageSize.y, imagePath, {
+ focused: {
+ borderColour: toColour(0, 0, 0, 0),
+ },
+ }, function() {
+ localeChooserSetLocale(tempLocaleOptions[i].id);
+ });
+
+ logToConsole(LOG_DEBUG|LOG_WARN, `[VRR.GUI] Created locale chooser option ${tempLocaleOptions[i].englishName} with image ${imagePath}`);
+
+ //localeChooser.activeRingImages.push(activeRingImage);
+ }
+}
+
+// ===========================================================================
\ No newline at end of file
diff --git a/scripts/client/gui/login.js b/scripts/client/gui/login.js
index 51b5fa03..e33ef2c2 100644
--- a/scripts/client/gui/login.js
+++ b/scripts/client/gui/login.js
@@ -11,7 +11,6 @@ let login = {
window: null,
logoImage: null,
messageLabel: null,
- passwordLabel: null,
passwordInput: null,
loginButton: null,
forgotPasswordButton: null,
@@ -20,9 +19,31 @@ let login = {
// ===========================================================================
+let loginHTML =
+`
+
+ Asshat Gaming Roleplay: Login
+
+
+
+
+`;
+
+// ===========================================================================
+
function initLoginGUI() {
logToConsole(LOG_DEBUG, `[VRR.GUI] Creating login GUI ...`);
- login.window = mexui.window(game.width/2-150, game.height/2-135, 300, 275, 'LOGIN', {
+ login.window = mexui.window(getScreenWidth()/2-150, getScreenHeight()/2-135, 300, 275, 'LOGIN', {
main: {
backgroundColour: toColour(secondaryColour[0], secondaryColour[1], secondaryColour[2], windowAlpha),
transitionTime: 500,
@@ -41,8 +62,9 @@ function initLoginGUI() {
});
login.window.titleBarIconSize = toVector2(0,0);
login.window.titleBarHeight = 0;
+ login.window.titleBarShown = false;
- login.logoImage = login.window.image(5, 20, 290, 100, mainLogoPath, {
+ login.logoImage = login.window.image(100, 20, 100, 100, mainLogoPath, {
focused: {
borderColour: toColour(0, 0, 0, 0),
},
@@ -96,7 +118,7 @@ function initLoginGUI() {
},
}, checkLogin);
- login.forgotPasswordButton = login.window.button(200, 240, 80, 15, 'RESET PASS', {
+ login.forgotPasswordButton = login.window.button(180, 240, 100, 15, 'RESET PASS', {
main: {
backgroundColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], buttonAlpha),
textColour: toColour(0, 0, 0, 255),
@@ -109,7 +131,7 @@ function initLoginGUI() {
},
}, switchToPasswordResetGUI);
- login.resetPasswordLabel = login.window.text(125, 240, 60, 15, 'Forgot your password?', {
+ login.resetPasswordLabel = login.window.text(110, 240, 60, 15, 'Forgot your password?', {
main: {
textSize: 8.0,
textAlign: 1.0,
@@ -134,6 +156,8 @@ function showLoginGUI() {
login.window.shown = true;
mexui.focusedControl = login.passwordInput;
guiSubmitKey = checkLogin;
+
+ showLocaleChooserGUI(new Vec2(getScreenWidth()/2-(localeChooser.window.size.x/2), login.window.position.y+login.window.size.y+20));
//showSmallGameMessage(`If you don't have a mouse cursor, press ${toUpperCase(getKeyNameFromId(disableGUIKey))} to disable GUI`, COLOUR_WHITE, 7500);
}
@@ -164,9 +188,10 @@ function loginSuccess() {
// ===========================================================================
function switchToPasswordResetGUI() {
- closeAllWindows();
- logToConsole(LOG_DEBUG, `[VRR.GUI] Showing password reset dialog window`);
- showResetPasswordGUI();
+ //closeAllWindows();
+ //logToConsole(LOG_DEBUG, `[VRR.GUI] Showing password reset dialog window`);
+ //showResetPasswordGUI();
+ sendNetworkEventToServer("vrr.checkResetPassword", "");
return false;
}
diff --git a/scripts/client/gui/newchar.js b/scripts/client/gui/newchar.js
index fa7ff169..5a13504a 100644
--- a/scripts/client/gui/newchar.js
+++ b/scripts/client/gui/newchar.js
@@ -9,106 +9,108 @@
let newCharacter = {
window: null,
+ messageLabel: null,
firstNameInput: null,
lastNameInput: null,
- skinDropDown: null,
- spawnAreaDropDown: null,
- createButton: null,
- mainLogoImage: null,
+ createCharacterButton: null,
+ mainLogoImage: null,
};
// ===========================================================================
function initNewCharacterGUI() {
- logToConsole(LOG_DEBUG, `[VRR.GUI] Creating new character GUI ...`);
- newCharacter.window = mexui.window(game.width/2-130, game.height/2-115, 300, 230, 'New Character', {
- main: {
- backgroundColour: toColour(secondaryColour[0], secondaryColour[1], secondaryColour[2], windowAlpha),
- transitionTime: 500,
- },
- title: {
- textSize: 0.0,
- textColour: toColour(0, 0, 0, 0),
- backgroundColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], windowTitleAlpha),
- },
- icon: {
- textSize: 0.0,
- textColour: toColour(0, 0, 0, 0),
- backgroundColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], windowTitleAlpha),
- }
- });
- newCharacter.window.titleBarIconSize = toVector2(0,0);
- newCharacter.window.titleBarHeight = 0;
+ logToConsole(LOG_DEBUG, `[VRR.GUI] Creating new character GUI ...`);
+ newCharacter.window = mexui.window(getScreenWidth()/2-130, getScreenHeight()/2-115, 300, 230, 'NEW CHARACTER', {
+ main: {
+ backgroundColour: toColour(secondaryColour[0], secondaryColour[1], secondaryColour[2], windowAlpha),
+ transitionTime: 500,
+ },
+ title: {
+ textSize: 12.0,
+ textFont: mainFont,
+ textColour: toColour(0, 0, 0, 0),
+ backgroundColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], windowTitleAlpha),
+ },
+ icon: {
+ textSize: 0.0,
+ textColour: toColour(0, 0, 0, 0),
+ backgroundColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], windowTitleAlpha),
+ }
+ });
+ newCharacter.window.titleBarIconSize = toVector2(0, 0);
+ newCharacter.window.titleBarIconShown = false;
+ newCharacter.window.titleBarShown = false;
+ newCharacter.window.titleBarHeight = 30;
- newCharacter.mainLogoImage = newCharacter.window.image(5, 20, 290, 80, mainLogoPath, {
- focused: {
- borderColour: toColour(0, 0, 0, 0),
- },
- });
+ newCharacter.mainLogoImage = newCharacter.window.image(80, 20, 80, 80, mainLogoPath, {
+ focused: {
+ borderColour: toColour(0, 0, 0, 0),
+ },
+ });
- newCharacter.messageLabel = newCharacter.window.text(20, 100, 260, 20, 'Name your character', {
- main: {
- textSize: 10.0,
- textAlign: 0.5,
- textColour: toColour(200, 200, 200, 255),
- textFont: mainFont,
- },
- focused: {
- borderColour: toColour(0, 0, 0, 0),
- },
- });
+ newCharacter.messageLabel = newCharacter.window.text(20, 100, 260, 20, 'Name your character', {
+ main: {
+ textSize: 10.0,
+ textAlign: 0.5,
+ textColour: toColour(200, 200, 200, 255),
+ textFont: mainFont,
+ },
+ focused: {
+ borderColour: toColour(0, 0, 0, 0),
+ },
+ });
- newCharacter.firstNameInput = newCharacter.window.textInput(20, 125, 260, 25, '', {
- main: {
- backgroundColour: toColour(0, 0, 0, 120),
- textColour: toColour(200, 200, 200, 255),
- textSize: 10.0,
- textFont: mainFont,
- },
- caret: {
- lineColour: toColour(255, 255, 255, 255),
- },
- placeholder: {
- backgroundColour: toColour(0, 0, 0, 120),
- textColour: toColour(200, 200, 200, 200),
- textSize: 10.0,
- textFont: mainFont,
- }
- });
- newCharacter.firstNameInput.placeholder = "First Name";
+ newCharacter.firstNameInput = newCharacter.window.textInput(20, 125, 260, 25, '', {
+ main: {
+ backgroundColour: toColour(0, 0, 0, 120),
+ textColour: toColour(200, 200, 200, 255),
+ textSize: 10.0,
+ textFont: mainFont,
+ },
+ caret: {
+ lineColour: toColour(255, 255, 255, 255),
+ },
+ placeholder: {
+ backgroundColour: toColour(0, 0, 0, 120),
+ textColour: toColour(200, 200, 200, 200),
+ textSize: 10.0,
+ textFont: mainFont,
+ }
+ });
+ newCharacter.firstNameInput.placeholder = "First Name";
- newCharacter.lastNameInput = newCharacter.window.textInput(20, 155, 260, 25, '', {
- main: {
- backgroundColour: toColour(0, 0, 0, 120),
- textColour: toColour(200, 200, 200, 255),
- textSize: 10.0,
- textFont: mainFont,
- },
- caret: {
- lineColour: toColour(255, 255, 255, 255),
- },
- placeholder: {
- backgroundColour: toColour(0, 0, 0, 120),
- textColour: toColour(150, 150, 150, 200),
- textSize: 10.0,
- textFont: mainFont,
- }
- });
- newCharacter.lastNameInput.placeholder = "Last Name";
+ newCharacter.lastNameInput = newCharacter.window.textInput(20, 155, 260, 25, '', {
+ main: {
+ backgroundColour: toColour(0, 0, 0, 120),
+ textColour: toColour(200, 200, 200, 255),
+ textSize: 10.0,
+ textFont: mainFont,
+ },
+ caret: {
+ lineColour: toColour(255, 255, 255, 255),
+ },
+ placeholder: {
+ backgroundColour: toColour(0, 0, 0, 120),
+ textColour: toColour(150, 150, 150, 200),
+ textSize: 10.0,
+ textFont: mainFont,
+ }
+ });
+ newCharacter.lastNameInput.placeholder = "Last Name";
- newCharacter.createCharacterButton = newCharacter.window.button(20, 185, 260, 25, 'CREATE CHARACTER', {
- main: {
- backgroundColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], buttonAlpha),
- textColour: toColour(255, 255, 255, 255),
- textSize: 10.0,
- textFont: mainFont,
- textAlign: 0.5,
- },
- focused: {
- borderColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], buttonAlpha),
- },
- }, checkNewCharacter);
- logToConsole(LOG_DEBUG, `[VRR.GUI] Created new character GUI`);
+ newCharacter.createCharacterButton = newCharacter.window.button(20, 185, 260, 25, 'CREATE CHARACTER', {
+ main: {
+ backgroundColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], buttonAlpha),
+ textColour: toColour(255, 255, 255, 255),
+ textSize: 10.0,
+ textFont: mainFont,
+ textAlign: 0.5,
+ },
+ focused: {
+ borderColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], buttonAlpha),
+ },
+ }, checkNewCharacter);
+ logToConsole(LOG_DEBUG, `[VRR.GUI] Created new character GUI`);
}
// ===========================================================================
@@ -133,8 +135,6 @@ function newCharacterFailed(errorMessage) {
function checkNewCharacter() {
logToConsole(LOG_DEBUG, `[VRR.GUI] Checking new character with server ...`);
- let skinId = false;
-
if(newCharacter.firstNameInput.lines[0].length < 2) {
return false;
}
@@ -157,8 +157,10 @@ function showNewCharacterGUI() {
setChatWindowEnabled(false);
mexui.setInput(true);
newCharacter.window.shown = true;
- mexui.focusedInput = newCharacter.firstNameInput;
- guiSubmitButton = checkNewCharacter;
+ mexui.focusedInput = newCharacter.firstNameInput;
+ guiSubmitKey = checkNewCharacter;
+
+ showLocaleChooserGUI(new Vec2(getScreenWidth()/2-(localeChooser.window.size.x/2), newCharacter.window.position.y+newCharacter.window.size.y+20));
}
// ===========================================================================
\ No newline at end of file
diff --git a/scripts/client/gui/register.js b/scripts/client/gui/register.js
index 1d1e0378..110e39e4 100644
--- a/scripts/client/gui/register.js
+++ b/scripts/client/gui/register.js
@@ -21,7 +21,7 @@ let register = {
function initRegisterGUI() {
logToConsole(LOG_DEBUG, `[VRR.GUI] Creating register GUI ...`);
- register.window = mexui.window(game.width/2-150, game.height/2-150, 300, 300, 'Register', {
+ register.window = mexui.window(getScreenWidth()/2-150, getScreenHeight()/2-150, 300, 300, 'Register', {
main: {
backgroundColour: toColour(secondaryColour[0], secondaryColour[1], secondaryColour[2], windowAlpha),
transitionTime: 500,
@@ -39,8 +39,9 @@ function initRegisterGUI() {
});
register.window.titleBarIconSize = toVector2(0,0);
register.window.titleBarHeight = 0;
+ register.window.titleBarShown = false;
- register.window.image(5, 20, 290, 80, mainLogoPath, {
+ register.window.image(100, 20, 100, 100, mainLogoPath, {
focused: {
borderColour: toColour(0, 0, 0, 0),
},
@@ -160,6 +161,9 @@ function showRegistrationGUI() {
register.window.shown = true;
mexui.focusedControl = register.passwordInput;
guiSubmitKey = checkRegistration;
+
+ showLocaleChooserGUI(new Vec2(getScreenWidth()/2-(localeChooser.window.size.x/2), register.window.position.y+register.window.size.y+20));
+
//showSmallGameMessage(`If you don't have a mouse cursor, press ${toUpperCase(getKeyNameFromId(disableGUIKey))} to disable GUI`, COLOUR_WHITE, 7500);
}
diff --git a/scripts/client/gui/resetpass.js b/scripts/client/gui/resetpass.js
index 433e0046..c04ebf17 100644
--- a/scripts/client/gui/resetpass.js
+++ b/scripts/client/gui/resetpass.js
@@ -7,11 +7,10 @@
// TYPE: Client (JavaScript)
// ===========================================================================
-let resetPassword = {
+let passwordReset = {
window: null,
logoImage: null,
messageLabel: null,
- emailLabel: null,
emailInput: null,
resetPasswordButton: null,
backToLoginButton: null,
@@ -21,8 +20,8 @@ let resetPassword = {
// ===========================================================================
function initResetPasswordGUI() {
- logToConsole(LOG_DEBUG, `[VRR.GUI] Creating password reset GUI ...`);
- resetPassword.window = mexui.window(game.width/2-150, game.height/2-130, 300, 260, 'RESET PASSWORD', {
+ logToConsole(LOG_DEBUG, `[VRR.GUI] Creating password reset GUI ...`);
+ passwordReset.window = mexui.window(getScreenWidth() / 2 - 150, getScreenHeight() / 2 - 135, 300, 275, 'RESET PASSWORD', {
main: {
backgroundColour: toColour(secondaryColour[0], secondaryColour[1], secondaryColour[2], windowAlpha),
transitionTime: 500,
@@ -39,16 +38,17 @@ function initResetPasswordGUI() {
borderColour: toColour(0, 0, 0, 0),
},
});
- resetPassword.window.titleBarIconSize = toVector2(0,0);
- resetPassword.window.titleBarHeight = 0;
+ passwordReset.window.titleBarIconSize = toVector2(0, 0);
+ passwordReset.window.titleBarHeight = 0;
+ passwordReset.window.titleBarShown = false;
- resetPassword.logoImage = resetPassword.window.image(5, 20, 290, 80, mainLogoPath, {
+ passwordReset.logoImage = passwordReset.window.image(100, 20, 100, 100, mainLogoPath, {
focused: {
borderColour: toColour(0, 0, 0, 0),
},
});
- resetPassword.messageLabel = resetPassword.window.text(20, 135, 260, 20, 'Please confirm your email', {
+ passwordReset.messageLabel = passwordReset.window.text(20, 135, 260, 20, 'Please confirm your email', {
main: {
textSize: 10.0,
textAlign: 0.5,
@@ -60,7 +60,7 @@ function initResetPasswordGUI() {
},
});
- resetPassword.emailInput = resetPassword.window.textInput(20, 170, 260, 25, '', {
+ passwordReset.emailInput = passwordReset.window.textInput(20, 170, 260, 25, '', {
main: {
backgroundColour: toColour(0, 0, 0, 120),
borderColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], textInputAlpha),
@@ -80,9 +80,9 @@ function initResetPasswordGUI() {
borderColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], 255),
},
});
- resetPassword.emailInput.placeholder = "Email";
+ passwordReset.emailInput.placeholder = "Email";
- resetPassword.resetPasswordButton = resetPassword.window.button(20, 205, 260, 30, 'RESET PASSWORD', {
+ passwordReset.resetPasswordButton = passwordReset.window.button(20, 205, 260, 30, 'RESET PASSWORD', {
main: {
backgroundColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], buttonAlpha),
textColour: toColour(primaryTextColour[0], primaryTextColour[1], primaryTextColour[2], 255),
@@ -95,7 +95,7 @@ function initResetPasswordGUI() {
},
}, checkResetPassword);
- resetPassword.backToLoginButton = resetPassword.window.button(200, 240, 80, 15, 'LOGIN', {
+ passwordReset.backToLoginButton = passwordReset.window.button(200, 240, 80, 15, 'LOGIN', {
main: {
backgroundColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], buttonAlpha),
textColour: toColour(primaryTextColour[0], primaryTextColour[1], primaryTextColour[2], 255),
@@ -108,7 +108,7 @@ function initResetPasswordGUI() {
},
}, switchToLoginGUI);
- resetPassword.backToLoginLabel = resetPassword.window.text(125, 240, 60, 15, 'Remember your password?', {
+ passwordReset.backToLoginLabel = passwordReset.window.text(110, 240, 60, 15, 'Remember your password?', {
main: {
textSize: 8.0,
textAlign: 1.0,
@@ -130,48 +130,66 @@ function showResetPasswordGUI() {
logToConsole(LOG_DEBUG, `[VRR.GUI] Showing password reset window`);
setChatWindowEnabled(false);
mexui.setInput(true);
- resetPassword.window.shown = true;
- mexui.focusedControl = resetPassword.emailInput;
- guiSubmitButton = checkResetPassword;
+ passwordReset.window.shown = true;
+ mexui.focusedControl = passwordReset.emailInput;
+ guiSubmitKey = checkResetPassword;
+
+ showLocaleChooserGUI(new Vec2(getScreenWidth() / 2 - (localeChooser.window.size.x / 2), passwordReset.window.position.y + passwordReset.window.size.y + 20));
//showSmallGameMessage(`If you don't have a mouse cursor, press ${toUpperCase(getKeyNameFromId(disableGUIKey))} to disable GUI`, COLOUR_WHITE, 7500);
}
// ===========================================================================
function checkResetPassword() {
- logToConsole(LOG_DEBUG, `[VRR.GUI] Checking password reset with server ...`);
- sendNetworkEventToServer("vrr.checkResetPassword", resetPassword.emailInput.lines[0]);
+ logToConsole(LOG_DEBUG, `[VRR.GUI] Checking password reset with server (${passwordReset.emailInput.lines[0]}) ...`);
+ sendNetworkEventToServer("vrr.checkResetPassword", passwordReset.emailInput.lines[0]);
}
// ===========================================================================
function resetPasswordFailed(errorMessage) {
logToConsole(LOG_DEBUG, `[VRR.GUI] Server reports password reset failed`);
- resetPassword.messageLabel.text = errorMessage;
- resetPassword.messageLabel.styles.main.textColour = toColour(180, 32, 32, 255);
- resetPassword.emailInput.text = "";
+ passwordReset.messageLabel.text = errorMessage;
+ passwordReset.messageLabel.styles.main.textColour = toColour(180, 32, 32, 255);
+ passwordReset.emailInput.text = "";
}
// ===========================================================================
function resetPasswordCodeInputGUI() {
- logToConsole(LOG_DEBUG, `[VRR.GUI] Server reports password reset was successful`);
-
- resetPassword.messageLabel.text = "Check your email for a verification code";
- resetPassword.messageLabel.styles.main.textColour = toColour(180, 32, 32, 255);
- resetPassword.emailInput.text = "";
- resetPassword.emailInput.placeholder = "Verification Code";
-
- guiSubmitButton = checkResetPassword;
+ logToConsole(LOG_DEBUG | LOG_WARN, `[VRR.GUI] Server reports password reset email confirmation was successful. Asking for code ...`);
closeAllWindows();
+
+ passwordReset.messageLabel.text = getLocaleString("GUIResetPasswordCodeInputLabel");
+ //passwordReset.messageLabel.styles.main.textColour = toColour(180, 32, 32, 255);
+ passwordReset.emailInput.lines[0] = "";
+ passwordReset.emailInput.placeholder = getLocaleString("GUIResetPasswordCodePlaceholder");
+
+ guiSubmitKey = checkResetPassword;
+ showResetPasswordGUI();
+}
+
+// ===========================================================================
+
+function resetPasswordEmailInputGUI() {
+ logToConsole(LOG_DEBUG | LOG_WARN, `[VRR.GUI] Server reports password reset request was approved. Asking for email ...`);
+ closeAllWindows();
+
+ passwordReset.messageLabel.text = getLocaleString("GUIResetPasswordConfirmEmailLabel");
+ //passwordReset.messageLabel.styles.main.textColour = toColour(180, 32, 32, 255);
+ passwordReset.emailInput.text = "";
+ passwordReset.emailInput.placeholder = getLocaleString("GUIResetPasswordEmailPlaceholder");
+
+ guiSubmitKey = checkResetPassword;
+ showResetPasswordGUI();
}
// ===========================================================================
function switchToLoginGUI() {
guiSubmitKey = false;
- closeAllWindows();
- showLoginGUI();
+ closeAllWindows();
+ showLoginGUI();
}
// ===========================================================================
\ No newline at end of file
diff --git a/scripts/client/gui/yesno.js b/scripts/client/gui/yesno.js
index a7ee4f32..8ba392d4 100644
--- a/scripts/client/gui/yesno.js
+++ b/scripts/client/gui/yesno.js
@@ -48,7 +48,7 @@ function initYesNoDialogGUI() {
},
});
- yesNoDialog.yesButton = yesNoDialog.window.button(5, 100, 197, 25, 'YES', {
+ yesNoDialog.yesButton = yesNoDialog.window.button(5, 105, 193, 30, 'YES', {
main: {
backgroundColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], buttonAlpha),
textColour: toColour(primaryTextColour[0], primaryTextColour[1], primaryTextColour[2], 255),
@@ -61,7 +61,7 @@ function initYesNoDialogGUI() {
},
}, yesNoDialogAnswerYes);
- yesNoDialog.noButton = yesNoDialog.window.button(202, 105, 197, 25, 'NO', {
+ yesNoDialog.noButton = yesNoDialog.window.button(203, 105, 192, 30, 'NO', {
main: {
backgroundColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], buttonAlpha),
textColour: toColour(primaryTextColour[0], primaryTextColour[1], primaryTextColour[2], 255),
@@ -78,11 +78,21 @@ function initYesNoDialogGUI() {
// ===========================================================================
-function showYesNoPromptGUI(promptMessage, promptTitle) {
+function showYesNoPromptGUI(promptMessage, promptTitle, yesButtonText, noButtonText) {
closeAllWindows();
logToConsole(LOG_DEBUG, `[VRR.GUI] Showing prompt window. Prompt: ${promptTitle} - ${promptMessage}`);
mexui.setInput(true);
+
+ yesNoDialog.messageLabel.text = "";
+ yesNoDialog.yesButton.text = "";
+ yesNoDialog.noButton.text = "";
+ yesNoDialog.window.title = "";
+
yesNoDialog.messageLabel.text = promptMessage;
+ yesNoDialog.yesButton.text = yesButtonText;
+ yesNoDialog.noButton.text = noButtonText;
+ yesNoDialog.window.title = promptTitle;
+
yesNoDialog.window.shown = true;
}
diff --git a/scripts/client/house.js b/scripts/client/house.js
index 19631aad..0eaa47e9 100644
--- a/scripts/client/house.js
+++ b/scripts/client/house.js
@@ -8,56 +8,79 @@
// ===========================================================================
class HouseData {
- constructor(houseId, entrancePosition, blipModel, pickupModel, hasInterior) {
- this.index = -1;
- this.houseId = houseId;
- this.entrancePosition = entrancePosition;
- this.blipModel = blipModel;
- this.pickupModel = pickupModel;
- this.hasInterior = hasInterior;
- this.blipId = -1;
- }
+ constructor(houseId, description, entrancePosition, blipModel, pickupModel, hasInterior) {
+ this.index = -1;
+ this.houseId = houseId;
+ this.description = description;
+ this.entrancePosition = entrancePosition;
+ this.blipModel = blipModel;
+ this.pickupModel = pickupModel;
+ this.hasInterior = hasInterior;
+ this.blipId = -1;
+ }
}
// ===========================================================================
-function receiveHouseFromServer(houseId, entrancePosition, blipModel, pickupModel, hasInterior) {
- if(getGame() == VRR_GAME_GTA_IV) {
- if(getHouseData(houseId) != false) {
- if(blipModel == -1) {
- natives.removeBlipAndClearIndex(getHouseData(houseId).blipId);
- getHouseData(houseId).blipId = -1;
- //houses.splice(getHouseData(houseId).index, 1);
- //setAllHouseDataIndexes();
- } else {
- if(getHouseData(houseId).blipId != -1) {
- natives.setBlipCoordinates(getHouseData(houseId).blipId, getHouseData(houseId).entrancePosition);
- natives.changeBlipSprite(getHouseData(houseId).blipId, getHouseData(houseId).blipModel);
- //natives.changeBlipNameFromAscii(getHouseData(houseId).blipId, `${name.substr(0, 24)}${(name.length > 24) ? " ...": ""}`);
- } else {
- let blipId = natives.addBlipForCoord(entrancePosition);
- if(blipId) {
- getHouseData(houseId).blipId = blipId;
- natives.changeBlipSprite(blipId, blipModel);
- natives.setBlipMarkerLongDistance(blipId, false);
- }
- }
- }
- } else {
- let tempHouseData = new HouseData(houseId, entrancePosition, blipModel, pickupModel, hasInterior, hasItems);
- if(blipModel != -1) {
- let blipId = natives.addBlipForCoord(entrancePosition);
- if(blipId) {
- tempHouseData.blipId = blipId;
- natives.changeBlipSprite(blipId, blipModel);
- natives.setBlipMarkerLongDistance(blipId, false);
- //natives.changeBlipNameFromAscii(blipId, `${name.substr(0, 24)}${(name.length > 24) ? " ...": ""}`);
- }
- }
- houses.push(tempHouseData);
- setAllHouseDataIndexes();
- }
- }
+function receiveHouseFromServer(houseId, description, entrancePosition, blipModel, pickupModel, hasInterior) {
+ logToConsole(LOG_DEBUG, `[VRR.House] Received house ${houseId} (${name}) from server`);
+
+ if(!areServerElementsSupported()) {
+ if(getHouseData(houseId) != false) {
+ let houseData = getHouseData(houseId);
+ houseData.description = description;
+ houseData.entrancePosition = entrancePosition;
+ houseData.blipModel = blipModel;
+ houseData.pickupModel = pickupModel;
+ houseData.hasInterior = hasInterior;
+
+ logToConsole(LOG_DEBUG, `[VRR.House] House ${houseId} already exists. Checking blip ...`);
+ if(blipModel == -1) {
+ if(houseData.blipId != -1) {
+ logToConsole(LOG_DEBUG, `[VRR.House] House ${houseId}'s blip has been removed by the server`);
+ if(getGame() == VRR_GAME_GTA_IV) {
+ natives.removeBlipAndClearIndex(getHouseData(houseId).blipId);
+ } else {
+ destroyElement(getElementFromId(blipId));
+ }
+ houseData.blipId = -1;
+ } else {
+ logToConsole(LOG_DEBUG, `[VRR.House] House ${houseId}'s blip is unchanged`);
+ }
+ } else {
+ if(houseData.blipId != -1) {
+ logToConsole(LOG_DEBUG, `[VRR.House] House ${houseId}'s blip has been changed by the server`);
+ if(getGame() == VRR_GAME_GTA_IV) {
+ natives.setBlipCoordinates(houseData.blipId, houseData.entrancePosition);
+ natives.changeBlipSprite(houseData.blipId, houseData.blipModel);
+ natives.setBlipMarkerLongDistance(houseData.blipId, false);
+ natives.setBlipAsShortRange(houseData.blipId, true);
+ natives.changeBlipNameFromAscii(houseData.blipId, `${houseData.name.substr(0, 24)}${(houseData.name.length > 24) ? " ...": ""}`);
+ }
+ } else {
+ let blipId = createGameBlip(houseData.blipModel, houseData.entrancePosition, houseData.name);
+ if(blipId != -1) {
+ houseData.blipId = blipId;
+ }
+ logToConsole(LOG_DEBUG, `[VRR.House] House ${houseId}'s blip has been added by the server (Model ${blipModel}, ID ${blipId})`);
+ }
+ }
+ } else {
+ logToConsole(LOG_DEBUG, `[VRR.House] House ${houseId} doesn't exist. Adding ...`);
+ let tempHouseData = new HouseData(houseId, description, entrancePosition, blipModel, pickupModel, hasInterior);
+ if(blipModel != -1) {
+ let blipId = createGameBlip(tempHouseData.blipModel, tempHouseData.entrancePosition, "House");
+ if(blipId != -1) {
+ tempHouseData.blipId = blipId;
+ }
+ logToConsole(LOG_DEBUG, `[VRR.House] House ${houseId}'s blip has been added by the server (Model ${blipModel}, ID ${blipId})`);
+ } else {
+ logToConsole(LOG_DEBUG, `[VRR.House] House ${houseId} has no blip.`);
+ }
+ getServerData().houses.push(tempHouseData);
+ setAllHouseDataIndexes();
+ }
+ }
}
// ===========================================================================
@@ -66,17 +89,23 @@ function receiveHouseFromServer(houseId, entrancePosition, blipModel, pickupMode
* @param {number} houseId - The ID of the house (initially provided by server)
* @return {HouseData} The house's data (class instance)
*/
-function getHouseData(houseId) {
- let tempHouseData = houses.find((h) => h.houseId == houseId);
- return (typeof tempHouseData != "undefined") ? tempHouseData : false;
+ function getHouseData(houseId) {
+ let houses = getServerData().houses;
+ for(let i in houses) {
+ if(houses[i].houseId == houseId) {
+ return houses[i];
+ }
+ }
+
+ return false;
}
// ===========================================================================
function setAllHouseDataIndexes() {
- for(let i in houses) {
- houses[i].index = i;
- }
+ for(let i in getServerData().houses) {
+ getServerData().houses[i].index = i;
+ }
}
// ===========================================================================
\ No newline at end of file
diff --git a/scripts/client/index.js b/scripts/client/index.js
deleted file mode 100644
index 4dd994ea..00000000
--- a/scripts/client/index.js
+++ /dev/null
@@ -1,34 +0,0 @@
-// For RAGEMP only
-
-// Shared Scripts
-require("../scripts/shared/const.js");
-require("../scripts/shared/utilities.js");
-require("../scripts/shared/gamedata.js");
-
-// Multiplayer Mod (Wrapped Natives)
-require("scripts/client/native/ragemp.js");
-
-// Client Scripts
-require("scripts/client/gui.js");
-require("scripts/client/main.js");
-require("scripts/client/nametag.js");
-require("scripts/client/sync.js");
-require("scripts/client/scoreboard.js");
-require("scripts/client/keybind.js");
-require("scripts/client/chatbox.js");
-require("scripts/client/label.js");
-require("scripts/client/skin-select.js");
-require("scripts/client/server.js");
-require("scripts/client/job.js");
-require("scripts/client/event.js");
-require("scripts/client/item.js");
-require("scripts/client/utilities.js");
-require("scripts/client/messaging.js");
-require("scripts/client/logo.js");
-require("scripts/client/afk.js");
-require("scripts/client/mousecam.js");
-require("scripts/client/radio.js");
-require("scripts/client/animation.js");
-
-// Startup
-require("scripts/client/startup.js");
\ No newline at end of file
diff --git a/scripts/client/item.js b/scripts/client/item.js
index a1735ae0..783426eb 100644
--- a/scripts/client/item.js
+++ b/scripts/client/item.js
@@ -23,40 +23,40 @@ function initItemScript() {
// ===========================================================================
function processItemActionRendering() {
- if(renderItemActionDelay) {
- if(itemActionDelayEnabled) {
- let finishTime = itemActionDelayStart+itemActionDelayDuration;
- if(sdl.ticks >= finishTime) {
- itemActionDelayEnabled = false;
- itemActionDelayDuration = 0;
- itemActionDelayStart = 0;
- tellServerItemActionDelayComplete();
- } else {
- let currentTick = sdl.ticks-itemActionDelayStart;
- let progressPercent = Math.ceil(currentTick*100/itemActionDelayDuration);
- let width = Math.ceil(getPercentage(itemActionDelaySize.x, progressPercent));
+ if(renderItemActionDelay) {
+ if(itemActionDelayEnabled) {
+ let finishTime = itemActionDelayStart+itemActionDelayDuration;
+ if(sdl.ticks >= finishTime) {
+ itemActionDelayEnabled = false;
+ itemActionDelayDuration = 0;
+ itemActionDelayStart = 0;
+ tellServerItemActionDelayComplete();
+ } else {
+ let currentTick = sdl.ticks-itemActionDelayStart;
+ let progressPercent = Math.ceil(currentTick*100/itemActionDelayDuration);
+ let width = Math.ceil(getPercentage(itemActionDelaySize.x, progressPercent));
- let backgroundColour = toColour(0, 0, 0, 255);
- graphics.drawRectangle(null, [itemActionDelayPosition.x-(itemActionDelaySize.x/2)-1, itemActionDelayPosition.y-(itemActionDelaySize.y/2)-1], [itemActionDelaySize.x+2, itemActionDelaySize.y+2], backgroundColour, backgroundColour, backgroundColour, backgroundColour);
- graphics.drawRectangle(null, [itemActionDelayPosition.x-(itemActionDelaySize.x/2), itemActionDelayPosition.y-(itemActionDelaySize.y/2)-2], [width, itemActionDelaySize.y], COLOUR_LIME, COLOUR_LIME, COLOUR_LIME, COLOUR_LIME);
- }
- }
- }
+ let backgroundColour = toColour(0, 0, 0, 255);
+ graphics.drawRectangle(null, [itemActionDelayPosition.x-(itemActionDelaySize.x/2)-1, itemActionDelayPosition.y-(itemActionDelaySize.y/2)-1], [itemActionDelaySize.x+2, itemActionDelaySize.y+2], backgroundColour, backgroundColour, backgroundColour, backgroundColour);
+ graphics.drawRectangle(null, [itemActionDelayPosition.x-(itemActionDelaySize.x/2), itemActionDelayPosition.y-(itemActionDelaySize.y/2)-2], [width, itemActionDelaySize.y], COLOUR_LIME, COLOUR_LIME, COLOUR_LIME, COLOUR_LIME);
+ }
+ }
+ }
}
// ===========================================================================
function updatePlayerHotBar(activeSlot, itemsArray) {
- logToConsole(LOG_DEBUG, `[VRR.Main] Updating hotbar`);
+ logToConsole(LOG_DEBUG, `[VRR.Main] Updating hotbar`);
}
// ===========================================================================
function showItemActionDelay(duration) {
- itemActionDelayDuration = duration;
- itemActionDelayStart = sdl.ticks;
- itemActionDelayEnabled = true;
- logToConsole(LOG_DEBUG, `Item action delay started. Duration: ${itemActionDelayDuration}, Start: ${itemActionDelayStart}, Rendering Enabled: ${renderItemActionDelay}`);
+ itemActionDelayDuration = duration;
+ itemActionDelayStart = sdl.ticks;
+ itemActionDelayEnabled = true;
+ logToConsole(LOG_DEBUG, `Item action delay started. Duration: ${itemActionDelayDuration}, Start: ${itemActionDelayStart}, Rendering Enabled: ${renderItemActionDelay}`);
}
// ===========================================================================
\ No newline at end of file
diff --git a/scripts/client/job.js b/scripts/client/job.js
index c993aa16..407d94df 100644
--- a/scripts/client/job.js
+++ b/scripts/client/job.js
@@ -12,6 +12,26 @@ let localPlayerWorking = false;
let jobRouteLocationBlip = null;
let jobRouteLocationSphere = null;
+let jobBlipBlinkAmount = 0;
+let jobBlipBlinkTimes = 10;
+let jobBlipBlinkInterval = 500;
+let jobBlipBlinkTimer = null;
+
+// ===========================================================================
+
+class JobData {
+ constructor(jobId, jobLocationId, name, position, blipModel, pickupModel) {
+ this.index = -1;
+ this.jobId = jobId;
+ this.jobLocationId = jobLocationId;
+ this.name = name;
+ this.position = position;
+ this.blipModel = blipModel;
+ this.pickupModel = pickupModel;
+ this.blipId = -1;
+ }
+}
+
// ===========================================================================
function initJobScript() {
@@ -22,74 +42,182 @@ function initJobScript() {
// ===========================================================================
function setLocalPlayerJobType(tempJobType) {
- logToConsole(LOG_DEBUG, `[VRR.Main] Set local player job type to ${tempJobType}`);
- localPlayerJobType = tempJobType;
+ logToConsole(LOG_DEBUG, `[VRR.Job] Set local player job type to ${tempJobType}`);
+ localPlayerJobType = tempJobType;
}
// ===========================================================================
function setLocalPlayerWorkingState(tempWorking) {
- logToConsole(LOG_DEBUG, `[VRR.Main] Setting working state to ${tempWorking}`);
- localPlayerWorking = tempWorking;
+ logToConsole(LOG_DEBUG, `[VRR.Job] Setting working state to ${tempWorking}`);
+ localPlayerWorking = tempWorking;
}
// ===========================================================================
function showJobRouteLocation(position, colour) {
- logToConsole(LOG_DEBUG, `[VRR.Job] Showing job route location`);
- if(getMultiplayerMod() == VRR_MPMOD_GTAC) {
- if(game.game == VRR_GAME_GTA_SA) {
- jobRouteLocationSphere = game.createPickup(1318, position, 1);
- } else {
- jobRouteLocationSphere = game.createSphere(position, 3);
- jobRouteLocationSphere.colour = colour;
- }
+ logToConsole(LOG_DEBUG, `[VRR.Job] Showing job route location`);
+ if(getMultiplayerMod() == VRR_MPMOD_GTAC) {
+ if(getGame() == VRR_GAME_GTA_SA) {
+ // Server-side spheres don't show in GTA SA for some reason.
+ jobRouteLocationSphere = game.createPickup(1318, position, 1);
+ } else {
+ jobRouteLocationSphere = game.createSphere(position, 3);
+ jobRouteLocationSphere.colour = colour;
+ }
- if(jobRouteLocationBlip != null) {
- destroyElement(jobRouteLocationBlip);
- }
+ if(jobRouteLocationBlip != null) {
+ destroyElement(jobRouteLocationBlip);
+ }
- blinkJobRouteLocationBlip(10, position, colour);
- }
+ // Blinking is bugged if player hit the spot before it stops blinking.
+ blinkJobRouteLocationBlip(10, position, colour);
+ jobRouteLocationBlip = game.createBlip(position, 0, 2, colour);
+ }
}
// ===========================================================================
function enteredJobRouteSphere() {
- logToConsole(LOG_DEBUG, `[VRR.Job] Entered job route sphere`);
- tellServerPlayerArrivedAtJobRouteLocation();
- destroyElement(jobRouteLocationSphere);
- destroyElement(jobRouteLocationBlip);
- jobRouteLocationSphere = null;
- jobRouteLocationBlip = null;
+ logToConsole(LOG_DEBUG, `[VRR.Job] Entered job route sphere`);
+
+ clearInterval(jobBlipBlinkTimer);
+ jobBlipBlinkAmount = 0;
+ jobBlipBlinkTimes = 0;
+
+ if(jobRouteLocationBlip != null) {
+ destroyElement(jobRouteLocationBlip);
+ jobRouteLocationBlip = null;
+ }
+
+ if(jobRouteLocationSphere != null) {
+ destroyElement(jobRouteLocationSphere);
+ jobRouteLocationSphere = null;
+ }
+
+ tellServerPlayerArrivedAtJobRouteLocation();
}
// ===========================================================================
function blinkJobRouteLocationBlip(times, position, colour) {
- for(let i = 1 ; i <= times ; i++) {
- setTimeout(function() {
- if(jobRouteLocationBlip != null) {
- destroyElement(jobRouteLocationBlip);
- jobRouteLocationBlip = null;
- } else {
- jobRouteLocationBlip = game.createBlip(position, 0, 2, colour);
- }
- }, 500*i);
- }
+ jobBlipBlinkTimes = times;
+ jobBlipBlinkTimer = setInterval(function() {
+ if(jobRouteLocationBlip != null) {
+ destroyElement(jobRouteLocationBlip);
+ jobRouteLocationBlip = null;
+ } else {
+ jobRouteLocationBlip = game.createBlip(position, 0, 2, colour);
+ }
- setTimeout(function() {
- jobRouteLocationBlip = game.createBlip(position, 0, 2, colour);
- }, 500*times+1);
+ if(jobBlipBlinkAmount >= jobBlipBlinkTimes) {
+ if(jobRouteLocationBlip != null) {
+ destroyElement(jobRouteLocationBlip);
+ jobRouteLocationBlip = null;
+ }
+
+ jobBlipBlinkAmount = 0;
+ jobBlipBlinkTimes = 0;
+ jobRouteLocationBlip = game.createBlip(position, 0, 2, colour);
+ clearInterval(jobBlipBlinkTimer);
+ }
+ }, jobBlipBlinkInterval);
}
// ===========================================================================
function hideJobRouteLocation() {
- destroyElement(jobRouteLocationSphere);
- destroyElement(jobRouteLocationBlip);
- jobRouteLocationSphere = null;
- jobRouteLocationBlip = null;
+ destroyElement(jobRouteLocationSphere);
+ destroyElement(jobRouteLocationBlip);
+ jobRouteLocationSphere = null;
+ jobRouteLocationBlip = null;
+}
+
+// ===========================================================================
+
+function receiveJobFromServer(jobId, jobLocationId, name, position, blipModel, pickupModel) {
+ logToConsole(LOG_DEBUG, `[VRR.Job] Received job ${jobId} (${name}) from server`);
+
+ if(getGame() == VRR_GAME_GTA_IV) {
+ if(getJobData(jobId) != false) {
+ let jobData = getJobData(jobId);
+ jobData.jobLocationId = jobLocationId;
+ jobData.name = name;
+ jobData.position = position;
+ jobData.blipModel = blipModel;
+ jobData.pickupModel = pickupModel;
+
+ logToConsole(LOG_DEBUG, `[VRR.Job] Job ${jobId} already exists. Checking blip ...`);
+ if(blipModel == -1) {
+ if(jobData.blipId != -1) {
+ logToConsole(LOG_DEBUG, `[VRR.Job] Job ${jobId}'s blip has been removed by the server`);
+ if(getGame() == VRR_GAME_GTA_IV) {
+ natives.removeBlipAndClearIndex(getJobData(jobId).blipId);
+ } else {
+ destroyElement(getElementFromId(blipId));
+ }
+ jobData.blipId = -1;
+ } else {
+ logToConsole(LOG_DEBUG, `[VRR.Job] Job ${jobId}'s blip is unchanged`);
+ }
+ } else {
+ if(jobData.blipId != -1) {
+ logToConsole(LOG_DEBUG, `[VRR.Job] Job ${jobId}'s blip has been changed by the server`);
+ if(getGame() == VRR_GAME_GTA_IV) {
+ natives.setBlipCoordinates(jobData.blipId, jobData.position);
+ natives.changeBlipSprite(jobData.blipId, jobData.blipModel);
+ natives.setBlipMarkerLongDistance(jobData.blipId, false);
+ natives.setBlipAsShortRange(jobData.blipId, true);
+ natives.changeBlipNameFromAscii(jobData.blipId, `${jobData.name.substr(0, 24)}${(jobData.name.length > 24) ? " ...": ""}`);
+ }
+ } else {
+ let blipId = createGameBlip(jobData.blipModel, jobData.position, jobData.name);
+ if(blipId != -1) {
+ jobData.blipId = blipId;
+ }
+ logToConsole(LOG_DEBUG, `[VRR.Job] Job ${jobId}'s blip has been added by the server (Model ${blipModel}, ID ${blipId})`);
+ }
+ }
+ } else {
+ logToConsole(LOG_DEBUG, `[VRR.Job] Job ${jobId} doesn't exist. Adding ...`);
+ let tempJobData = new JobData(jobId, jobLocationId, name, position, blipModel, pickupModel);
+ if(blipModel != -1) {
+ let blipId = createGameBlip(blipModel, tempJobData.position, tempJobData.name);
+ if(blipId != -1) {
+ tempJobData.blipId = blipId;
+ }
+ logToConsole(LOG_DEBUG, `[VRR.Job] Job ${jobId}'s blip has been added by the server (Model ${blipModel}, ID ${blipId})`);
+ } else {
+ logToConsole(LOG_DEBUG, `[VRR.Job] Job ${jobId} has no blip.`);
+ }
+ getServerData().jobs.push(tempJobData);
+ setAllJobDataIndexes();
+ }
+ }
+}
+
+// ===========================================================================
+
+/**
+ * @param {number} job - The ID of the job (initially provided by server)
+ * @return {JobData} The job's data (class instance)
+ */
+ function getJobData(jobId) {
+ for(let i in getServerData().jobs) {
+ if(getServerData().jobs[i].jobId == jobId) {
+ return getServerData().jobs[i];
+ }
+ }
+
+ return false;
+}
+
+// ===========================================================================
+
+function setAllJobDataIndexes() {
+ for(let i in getServerData().jobs) {
+ jobs[i].index = i;
+ }
}
// ===========================================================================
\ No newline at end of file
diff --git a/scripts/client/jsconfig.json b/scripts/client/jsconfig.json
index a5e369f2..7a0aa2fa 100644
--- a/scripts/client/jsconfig.json
+++ b/scripts/client/jsconfig.json
@@ -1,14 +1,14 @@
{
- "compilerOptions": {
- "module": "commonjs",
- "target": "es6",
- "moduleResolution": "classic"
- },
- "include": [
- "*.js",
- "gui/*.js",
- "native/*.js",
- "../shared/*.js",
- "../third-party/mexui/*"
- ]
+ "compilerOptions": {
+ "module": "commonjs",
+ "target": "es6",
+ "moduleResolution": "classic"
+ },
+ "include": [
+ "*.js",
+ "gui/*.js",
+ "native/*.js",
+ "../shared/*.js",
+ "../third-party/mexui/*"
+ ]
}
\ No newline at end of file
diff --git a/scripts/client/keybind.js b/scripts/client/keybind.js
index 4c8c2d9c..ecc4bcb8 100644
--- a/scripts/client/keybind.js
+++ b/scripts/client/keybind.js
@@ -23,71 +23,71 @@ function initKeyBindScript() {
// ===========================================================================
function bindAccountKey(key, keyState) {
- logToConsole(LOG_DEBUG, `[VRR.KeyBind]: Binded key ${toUpperCase(getKeyNameFromId(key))} (${key})`);
- keyBinds.push(toInteger(key));
- bindKey(toInteger(key), keyState, function(event) {
- if(isAnyGUIActive()) {
- return false;
- }
+ logToConsole(LOG_DEBUG, `[VRR.KeyBind]: Binded key ${toUpperCase(getKeyNameFromId(key))} (${key})`);
+ keyBinds.push(toInteger(key));
+ bindKey(toInteger(key), keyState, function(event) {
+ if(isAnyGUIActive()) {
+ return false;
+ }
- if(hasKeyBindDelayElapsed()) {
- if(canLocalPlayerUseKeyBinds()) {
- logToConsole(LOG_DEBUG, `[VRR.KeyBind]: Using keybind for key ${toUpperCase(getKeyNameFromId(key))} (${key})`);
- lastKeyBindUse = sdl.ticks;
- tellServerPlayerUsedKeyBind(key);
- } else {
- logToConsole(LOG_DEBUG, `[VRR.KeyBind]: Failed to use keybind for key ${toUpperCase(getKeyNameFromId(key))} (${key}) - Not allowed to use keybinds!`);
- }
- } else {
- logToConsole(LOG_DEBUG, `[VRR.KeyBind]: Failed to use keybind for key ${toUpperCase(getKeyNameFromId(key))} (${key}) - Not enough time has passed since last keybind use!`);
- }
- });
+ if(hasKeyBindDelayElapsed()) {
+ if(canLocalPlayerUseKeyBinds()) {
+ logToConsole(LOG_DEBUG, `[VRR.KeyBind]: Using keybind for key ${toUpperCase(getKeyNameFromId(key))} (${key})`);
+ lastKeyBindUse = sdl.ticks;
+ tellServerPlayerUsedKeyBind(key);
+ } else {
+ logToConsole(LOG_DEBUG, `[VRR.KeyBind]: Failed to use keybind for key ${toUpperCase(getKeyNameFromId(key))} (${key}) - Not allowed to use keybinds!`);
+ }
+ } else {
+ logToConsole(LOG_DEBUG, `[VRR.KeyBind]: Failed to use keybind for key ${toUpperCase(getKeyNameFromId(key))} (${key}) - Not enough time has passed since last keybind use!`);
+ }
+ });
}
// ===========================================================================
function unBindAccountKey(key) {
- logToConsole(LOG_DEBUG, `[VRR.KeyBind]: Unbinded key ${toUpperCase(getKeyNameFromId(key))} (${key})`);
- unbindKey(key);
- keyBinds.splice(keyBinds.indexOf(key), 1);
- return true;
+ logToConsole(LOG_DEBUG, `[VRR.KeyBind]: Unbinded key ${toUpperCase(getKeyNameFromId(key))} (${key})`);
+ unbindKey(key);
+ keyBinds.splice(keyBinds.indexOf(key), 1);
+ return true;
}
// ===========================================================================
function hasKeyBindDelayElapsed() {
- if(sdl.ticks-lastKeyBindUse >= keyBindDelayTime) {
- return true;
- }
+ if(sdl.ticks-lastKeyBindUse >= keyBindDelayTime) {
+ return true;
+ }
- return false;
+ return false;
}
// ===========================================================================
function canLocalPlayerUseKeyBinds() {
- if(isAnyGUIActive()) {
- return false;
- }
+ if(isAnyGUIActive()) {
+ return false;
+ }
- if(!isSpawned) {
- return false;
- }
+ if(!isSpawned) {
+ return false;
+ }
- if(itemActionDelayEnabled) {
- return false;
- }
+ if(itemActionDelayEnabled) {
+ return false;
+ }
- return true;
+ return true;
}
// ===========================================================================
function clearKeyBinds() {
- for(let i in keyBinds) {
- unbindKey(keyBinds[i]);
- }
- keyBinds = [];
+ for(let i in keyBinds) {
+ unbindKey(keyBinds[i]);
+ }
+ keyBinds = [];
}
// ===========================================================================
\ No newline at end of file
diff --git a/scripts/client/label.js b/scripts/client/label.js
index 4f20d67a..10a0c211 100644
--- a/scripts/client/label.js
+++ b/scripts/client/label.js
@@ -42,268 +42,343 @@ function initLabelScript() {
// ===========================================================================
function initLabelPropertyNameFont() {
- return lucasFont.createDefaultFont(16.0, "Roboto", "Regular");
+ return lucasFont.createDefaultFont(16.0, "Roboto", "Regular");
}
// ===========================================================================
function initLabelPropertyLockedFont() {
- return lucasFont.createDefaultFont(12.0, "Roboto", "Light");
+ return lucasFont.createDefaultFont(12.0, "Roboto", "Light");
}
// ===========================================================================
function initLabelJobNameFont() {
- return lucasFont.createDefaultFont(16.0, "Roboto", "Regular");
+ return lucasFont.createDefaultFont(16.0, "Roboto", "Regular");
}
// ===========================================================================
function initLabelJobHelpFont() {
- return lucasFont.createDefaultFont(10.0, "Roboto", "Light");
+ return lucasFont.createDefaultFont(10.0, "Roboto", "Light");
}
// ===========================================================================
function renderPropertyEntranceLabel(name, position, locked, isBusiness, price, rentPrice, labelInfoType) {
- if(localPlayer == null) {
- return false;
- }
+ if(localPlayer == null) {
+ return false;
+ }
if(propertyLabelNameFont == null) {
return false;
- }
+ }
if(propertyLabelLockedFont == null) {
return false;
- }
+ }
- let tempPosition = position;
- tempPosition.z = tempPosition.z + propertyLabelHeight;
- let screenPosition = getScreenFromWorldPosition(tempPosition);
+ if(getGame() == VRR_GAME_GTA_IV) {
+ if(!natives.doesViewportExist(natives.getGameViewportId())) {
+ logToConsole(LOG_INFO, "[VRR.Label]: Game viewport does not exist!");
+ return false;
+ }
- if(screenPosition.x < 0 || screenPosition.x > game.width) {
- return false;
- }
+ if(!natives.isViewportActive(natives.getGameViewportId())) {
+ logToConsole(LOG_INFO, "[VRR.Label]: Game viewport is not active!");
+ return false;
+ }
+ }
- let text = "";
- if(price > "0") {
- text = `For sale: $${price}`;
- let size = propertyLabelLockedFont.measure(text, game.width, 0.0, 0.0, propertyLabelLockedFont.size, true, true);
- propertyLabelLockedFont.render(text, [screenPosition.x-size[0]/2, screenPosition.y-size[1]/2], game.width, 0.0, 0.0, propertyLabelLockedFont.size, toColour(200, 200, 200, 255), false, true, false, true);
+ let tempPosition = position;
+ tempPosition.z = tempPosition.z + propertyLabelHeight;
+ let screenPosition = new Vec3(0.0, 0.0, 0.0);
+ if(getGame() == VRR_GAME_GTA_IV) {
+ screenPosition = natives.getViewportPositionOfCoord(tempPosition, natives.getGameViewportId());
+ } else {
+ screenPosition = getScreenFromWorldPosition(tempPosition);
+ }
- screenPosition.y -= propertyLabelPriceOffset;
- }
+ if(screenPosition.x < 0 || screenPosition.x > game.width) {
+ return false;
+ }
- text = "";
- if(rentPrice != "0") {
- text = `For rent: $${rentPrice} every payday`;
- let size = propertyLabelLockedFont.measure(text, game.width, 0.0, 0.0, propertyLabelLockedFont.size, true, true);
- propertyLabelLockedFont.render(text, [screenPosition.x-size[0]/2, screenPosition.y-size[1]/2], game.width, 0.0, 0.0, propertyLabelLockedFont.size, toColour(200, 200, 200, 255), false, true, false, true);
+ let text = "";
+ if(price > "0") {
+ text = getLocaleString("PropertyForSaleLabel", price);
+ let size = propertyLabelLockedFont.measure(text, game.width, 0.0, 0.0, propertyLabelLockedFont.size, true, true);
+ propertyLabelLockedFont.render(text, [screenPosition.x-size[0]/2, screenPosition.y-size[1]/2], game.width, 0.0, 0.0, propertyLabelLockedFont.size, toColour(200, 200, 200, 255), false, true, false, true);
- screenPosition.y -= propertyLabelPriceOffset;
- }
+ screenPosition.y -= propertyLabelPriceOffset;
+ }
+ text = "";
+ if(rentPrice != "0") {
+ text = getLocaleString("PropertyForRentLabel", rentPrice);
+ let size = propertyLabelLockedFont.measure(text, game.width, 0.0, 0.0, propertyLabelLockedFont.size, true, true);
+ propertyLabelLockedFont.render(text, [screenPosition.x-size[0]/2, screenPosition.y-size[1]/2], game.width, 0.0, 0.0, propertyLabelLockedFont.size, toColour(200, 200, 200, 255), false, true, false, true);
- if(isBusiness) {
- text = (locked) ? "CLOSED" : "OPEN";
- } else {
- text = (locked) ? "LOCKED" : "UNLOCKED";
- }
+ screenPosition.y -= propertyLabelPriceOffset;
+ }
- if(!locked && labelInfoType != VRR_PROPLABEL_INFO_NONE) {
- let infoText = "";
- switch(labelInfoType) {
- case VRR_PROPLABEL_INFO_ENTER:
- if(enterPropertyKey) {
- infoText = `Press ${toUpperCase(getKeyNameFromId(enterPropertyKey))} to enter`;
- } else {
- infoText = `Use /enter to enter`;
- }
- break;
+ if(isBusiness) {
+ text = (locked) ? toUpperCase(getLocaleString("Closed")) : toUpperCase(getLocaleString("Open"));
+ } else {
+ text = (locked) ? toUpperCase(getLocaleString("Locked")) : toUpperCase(getLocaleString("Unlocked"));
+ }
- case VRR_PROPLABEL_INFO_BUY:
- infoText = `Use /buy to purchase items`;
- break;
+ if(!locked && labelInfoType != VRR_PROPLABEL_INFO_NONE) {
+ let infoText = "";
+ switch(labelInfoType) {
+ case VRR_PROPLABEL_INFO_ENTER: {
+ if(enterPropertyKey) {
+ infoText = getLocaleString("PropertyEnterKeyPressLabel", toUpperCase(getKeyNameFromId(enterPropertyKey)));
+ } else {
+ infoText = getLocaleString("PropertyEnterCommandLabel", "/enter");
+ }
+ break;
+ }
- case VRR_PROPLABEL_INFO_BUYBIZ:
- infoText = `Use /buy to purchase items`;
- break;
+ case VRR_PROPLABEL_INFO_BUY: {
+ infoText = getLocaleString("BusinessBuyItemsLabel", "/buy");
+ break;
+ }
- //case VRR_PROPLABEL_INFO_RENTBIZ:
- // infoText = `Use /bizrent to buy this business`;
- // break;
+ case VRR_PROPLABEL_INFO_BUYBIZ: {
+ infoText = getLocaleString("BuyBusinessLabel", "/bizbuy");
+ break;
+ }
- case VRR_PROPLABEL_INFO_BUYHOUSE:
- infoText = `Use /housebuy to buy this house`;
- break;
+ case VRR_PROPLABEL_INFO_BUYHOUSE: {
+ infoText = getLocaleString("BuyHouseLabel", "/housebuy");
+ break;
+ }
- case VRR_PROPLABEL_INFO_RENTHOUSE:
- infoText = `Use /houserent to rent this house`;
- break;
+ case VRR_PROPLABEL_INFO_RENTHOUSE: {
+ infoText = getLocaleString("RentHouseLabel", "/houserent");
+ break;
+ }
- case VRR_PROPLABEL_INFO_ENTERVEH:
- infoText = "Enter a vehicle in the parking lot to buy it";
- break;
+ case VRR_PROPLABEL_INFO_ENTERVEHICLE: {
+ infoText = getLocaleString("VehicleDealershipLabel");
+ break;
+ }
- case VRR_PROPLABEL_INFO_NONE:
- default:
- infoText = "";
- break;
- }
- if(getDistance(localPlayer.position, position) <= renderLabelDistance-2) {
- let size = propertyLabelLockedFont.measure(infoText, game.width, 0.0, 0.0, propertyLabelLockedFont.size, true, true);
- propertyLabelLockedFont.render(infoText, [screenPosition.x-size[0]/2, screenPosition.y-size[1]/2], game.width, 0.0, 0.0, propertyLabelLockedFont.size, toColour(234, 198, 126, 255), false, true, false, true);
- screenPosition.y -= propertyLabelLockedOffset;
- }
- }
+ default: {
+ if(enterPropertyKey) {
+ infoText = getLocaleString("PropertyEnterKeyPressLabel", toUpperCase(getKeyNameFromId(enterPropertyKey)));
+ } else {
+ infoText = getLocaleString("PropertyEnterCommandLabel", "/enter");
+ }
+ break;
+ }
+ }
+ if(getDistance(localPlayer.position, position) <= renderLabelDistance-2) {
+ let size = propertyLabelLockedFont.measure(infoText, game.width, 0.0, 0.0, propertyLabelLockedFont.size, true, true);
+ propertyLabelLockedFont.render(infoText, [screenPosition.x-size[0]/2, screenPosition.y-size[1]/2], game.width, 0.0, 0.0, propertyLabelLockedFont.size, toColour(234, 198, 126, 255), false, true, false, true);
+ screenPosition.y -= propertyLabelLockedOffset;
+ }
+ }
- let size = propertyLabelLockedFont.measure(text, game.width, 0.0, 0.0, propertyLabelLockedFont.size, true, true);
- propertyLabelLockedFont.render(text, [screenPosition.x-size[0]/2, screenPosition.y-size[1]/2], game.width, 0.0, 0.0, propertyLabelLockedFont.size, (locked) ? lockedColour : unlockedColour, false, true, false, true);
+ let size = propertyLabelLockedFont.measure(text, game.width, 0.0, 0.0, propertyLabelLockedFont.size, true, true);
+ propertyLabelLockedFont.render(text, [screenPosition.x-size[0]/2, screenPosition.y-size[1]/2], game.width, 0.0, 0.0, propertyLabelLockedFont.size, (locked) ? lockedColour : unlockedColour, false, true, false, true);
- screenPosition.y -= propertyLabelNameOffset;
+ screenPosition.y -= propertyLabelNameOffset;
- text = name || " ";
- size = propertyLabelNameFont.measure(text, game.width, 0.0, 0.0, propertyLabelNameFont.size, true, true);
- propertyLabelNameFont.render(text, [screenPosition.x-size[0]/2, screenPosition.y-size[1]/2], game.width, 0.0, 0.0, propertyLabelNameFont.size, (isBusiness) ? toColour(0, 153, 255, 255) : toColour(17, 204, 17, 255), false, true, false, true);
+ text = name || " ";
+ size = propertyLabelNameFont.measure(text, game.width, 0.0, 0.0, propertyLabelNameFont.size, true, true);
+ propertyLabelNameFont.render(text, [screenPosition.x-size[0]/2, screenPosition.y-size[1]/2], game.width, 0.0, 0.0, propertyLabelNameFont.size, (isBusiness) ? toColour(0, 153, 255, 255) : toColour(17, 204, 17, 255), false, true, false, true);
}
// -------------------------------------------------------------------------
function renderPropertyExitLabel(position) {
- if(localPlayer == null) {
- return false;
- }
+ if(localPlayer == null) {
+ return false;
+ }
if(propertyLabelNameFont == null) {
return false;
- }
+ }
if(propertyLabelLockedFont == null) {
return false;
}
- let tempPosition = position;
- tempPosition.z = tempPosition.z + propertyLabelHeight;
- let screenPosition = getScreenFromWorldPosition(tempPosition);
+ if(getGame() == VRR_GAME_GTA_IV) {
+ if(!natives.doesViewportExist(natives.getGameViewportId())) {
+ logToConsole(LOG_INFO, "[VRR.Label]: Game viewport does not exist!");
+ return false;
+ }
- if(screenPosition.x < 0 || screenPosition.x > game.width) {
- return false;
- }
+ if(!natives.isViewportActive(natives.getGameViewportId())) {
+ logToConsole(LOG_INFO, "[VRR.Label]: Game viewport is not active!");
+ return false;
+ }
+ }
- let text = "EXIT";
- let size = propertyLabelNameFont.measure(text, game.width, 0.0, 0.0, propertyLabelNameFont.size, true, true);
- propertyLabelNameFont.render(text, [screenPosition.x-size[0]/2, screenPosition.y-size[1]/2], game.width, 0.0, 0.0, propertyLabelNameFont.size, COLOUR_WHITE, false, true, false, true);
+ let tempPosition = position;
+ tempPosition.z = tempPosition.z + propertyLabelHeight;
+ let screenPosition = new Vec3(0.0, 0.0, 0.0);
+ if(getGame() == VRR_GAME_GTA_IV) {
+ screenPosition = natives.getViewportPositionOfCoord(tempPosition, natives.getGameViewportId());
+ } else {
+ screenPosition = getScreenFromWorldPosition(tempPosition);
+ }
+
+ if(screenPosition.x < 0 || screenPosition.x > game.width) {
+ return false;
+ }
+
+ let text = "EXIT";
+ let size = propertyLabelNameFont.measure(text, game.width, 0.0, 0.0, propertyLabelNameFont.size, true, true);
+ propertyLabelNameFont.render(text, [screenPosition.x-size[0]/2, screenPosition.y-size[1]/2], game.width, 0.0, 0.0, propertyLabelNameFont.size, COLOUR_WHITE, false, true, false, true);
}
// -------------------------------------------------------------------------
function renderJobLabel(name, position, jobType) {
- if(localPlayer == null) {
- return false;
- }
+ if(localPlayer == null) {
+ return false;
+ }
if(jobNameLabelFont == null) {
return false;
- }
+ }
if(jobHelpLabelFont == null) {
return false;
}
- let tempPosition = position;
- tempPosition.z = tempPosition.z + propertyLabelHeight;
- let screenPosition = getScreenFromWorldPosition(tempPosition);
+ if(getGame() == VRR_GAME_GTA_IV) {
+ if(!natives.doesViewportExist(natives.getGameViewportId())) {
+ logToConsole(LOG_INFO, "[VRR.Label]: Game viewport does not exist!");
+ return false;
+ }
- if(screenPosition.x < 0 || screenPosition.x > game.width) {
- return false;
- }
+ if(!natives.isViewportActive(natives.getGameViewportId())) {
+ logToConsole(LOG_INFO, "[VRR.Label]: Game viewport is not active!");
+ return false;
+ }
+ }
- let text = "";
- if(jobType == localPlayerJobType) {
- if(localPlayerWorking) {
- text = "Use /uniform and /equip for job stuff, or /stopwork to go off duty";
- } else {
- text = "Use /startwork to go on duty";
- }
- } else {
- if(localPlayerJobType == 0) {
- text = "Use /takejob to work here";
- } else {
- text = "You already have a job. Use /quitjob if you want this one";
- }
- }
+ let tempPosition = position;
+ tempPosition.z = tempPosition.z + propertyLabelHeight;
+ let screenPosition = new Vec3(0.0, 0.0, 0.0);
+ if(getGame() == VRR_GAME_GTA_IV) {
+ screenPosition = natives.getViewportPositionOfCoord(tempPosition, natives.getGameViewportId());
+ } else {
+ screenPosition = getScreenFromWorldPosition(tempPosition);
+ }
- let size = jobHelpLabelFont.measure(text, game.width, 0.0, 0.0, jobHelpLabelFont.size, true, true);
- jobHelpLabelFont.render(text, [screenPosition.x-size[0]/2, screenPosition.y-size[1]/2], game.width, 0.0, 0.0, jobHelpLabelFont.size, COLOUR_YELLOW, false, true, false, true);
+ if(screenPosition.x < 0 || screenPosition.x > game.width) {
+ return false;
+ }
- screenPosition.y -= 18;
+ let text = "";
+ if(jobType == localPlayerJobType) {
+ if(localPlayerWorking) {
+ text = getLocaleString("JobEquipAndUniformLabel", "/equip", "/uniform", "/stopwork");
+ } else {
+ text = getLocaleString("StartWorkLabel", "/startwork");
+ }
+ } else {
+ if(localPlayerJobType == 0) {
+ text = getLocaleString("TakeJobLabel", "/takejob");
+ } else {
+ text = getLocaleString("NotYourJobLabel", "/quitjob");
+ }
+ }
- text = name + " Job";
- size = jobNameLabelFont.measure(text, game.width, 0.0, 0.0, jobNameLabelFont.size, true, true);
- jobNameLabelFont.render(text, [screenPosition.x-size[0]/2, screenPosition.y-size[1]/2], game.width, 0.0, 0.0, jobNameLabelFont.size, COLOUR_WHITE, false, true, false, true);
+ let size = jobHelpLabelFont.measure(text, game.width, 0.0, 0.0, jobHelpLabelFont.size, true, true);
+ jobHelpLabelFont.render(text, [screenPosition.x-size[0]/2, screenPosition.y-size[1]/2], game.width, 0.0, 0.0, jobHelpLabelFont.size, COLOUR_YELLOW, false, true, false, true);
+
+ screenPosition.y -= 18;
+
+ text = getLocaleString("JobLabel", name);
+ size = jobNameLabelFont.measure(text, game.width, 0.0, 0.0, jobNameLabelFont.size, true, true);
+ jobNameLabelFont.render(text, [screenPosition.x-size[0]/2, screenPosition.y-size[1]/2], game.width, 0.0, 0.0, jobNameLabelFont.size, COLOUR_WHITE, false, true, false, true);
}
// -------------------------------------------------------------------------
function processLabelRendering() {
- if(renderLabels) {
- if(!areServerElementsSupported()) {
- if(localPlayer != null) {
- for(let i in businesses) {
- if(getDistance(localPlayer.position, businesses[i].entrancePosition) <= 75.0) {
- natives.drawColouredCylinder(getPosBelowPos(businesses[i].entrancePosition, 1.0), 0.0, 0.0, 0, 153, 255, 255);
- }
- }
- }
- }
-
- if(areWorldLabelsSupported()) {
- if(localPlayer != null) {
- let pickups = getElementsByType(ELEMENT_PICKUP);
- for(let i in pickups) {
- if(pickups[i].getData("vrr.label.type") != null) {
- if(getDistance(localPlayer.position, pickups[i].position) <= renderLabelDistance) {
- if(!pickups[i].isOnScreen) {
- let price = "0";
- let rentPrice = "0";
- let labelInfoType = VRR_PROPLABEL_INFO_NONE;
- if(pickups[i].getData("vrr.label.price") != null) {
- price = makeLargeNumberReadable(pickups[i].getData("vrr.label.price"));
- }
-
- if(pickups[i].getData("vrr.label.rentprice") != null) {
- rentPrice = makeLargeNumberReadable(pickups[i].getData("vrr.label.rentprice"));
- }
-
- if(pickups[i].getData("vrr.label.help") != null) {
- labelInfoType = pickups[i].getData("vrr.label.help");
- }
-
- switch(pickups[i].getData("vrr.label.type")) {
- case VRR_LABEL_BUSINESS:
- renderPropertyEntranceLabel(pickups[i].getData("vrr.label.name"), pickups[i].position, pickups[i].getData("vrr.label.locked"), true, price, rentPrice, labelInfoType);
- break;
-
- case VRR_LABEL_HOUSE:
- renderPropertyEntranceLabel("House", pickups[i].position, pickups[i].getData("vrr.label.locked"), false, price, rentPrice, labelInfoType);
- break;
-
- case VRR_LABEL_JOB:
- renderJobLabel(pickups[i].getData("vrr.label.name"), pickups[i].position, pickups[i].getData("vrr.label.jobType"));
- break;
-
- case VRR_LABEL_EXIT:
- renderPropertyExitLabel(pickups[i].position);
- break;
- }
- }
- }
- }
- }
- }
- }
- }
+ if(renderLabels) {
+ if(!areServerElementsSupported()) {
+ if(localPlayer != null) {
+ getServerData().businesses.forEach((business) => {
+ if(getDistance(localPlayer.position, business.entrancePosition) <= 75.0) {
+ natives.drawColouredCylinder(getPosBelowPos(business.entrancePosition, 1.0), 0.0, 0.0, 0, 153, 255, 255);
+ //renderPropertyEntranceLabel(business.name, business.entrancePosition, business.locked, true, makeLargeNumberReadable(business.price), makeLargeNumberReadable(business.rentPrice), business.labelInfoType);
+ }
+ });
+
+ getServerData().houses.forEach((house) => {
+ if(getDistance(localPlayer.position, house.entrancePosition) <= 75.0) {
+ natives.drawColouredCylinder(getPosBelowPos(house.entrancePosition, 1.0), 0.0, 0.0, 0, 200, 0, 255);
+ //renderPropertyEntranceLabel("House", house.entrancePosition, house.locked, true, makeLargeNumberReadable(house.price), makeLargeNumberReadable(house.rentPrice), 0);
+ }
+ });
+
+ getServerData().jobs.forEach((job) => {
+ if(getDistance(localPlayer.position, job.position) <= 75.0) {
+ natives.drawColouredCylinder(getPosBelowPos(job.position, 1.0), 0.0, 0.0, 255, 255, 0, 255);
+ //renderJobLabel(job.name, job.position, job.jobType);
+ }
+ });
+ }
+ }
+
+ if(areWorldLabelsSupported()) {
+ if(localPlayer != null) {
+ let pickups = getElementsByType(ELEMENT_PICKUP);
+ for(let i in pickups) {
+ if(pickups[i].getData("vrr.label.type") != null) {
+ if(getDistance(localPlayer.position, pickups[i].position) <= renderLabelDistance) {
+ if(!pickups[i].isOnScreen) {
+ let price = "0";
+ let rentPrice = "0";
+ let labelInfoType = VRR_PROPLABEL_INFO_NONE;
+ if(pickups[i].getData("vrr.label.price") != null) {
+ price = makeLargeNumberReadable(pickups[i].getData("vrr.label.price"));
+ }
+
+ if(pickups[i].getData("vrr.label.rentprice") != null) {
+ rentPrice = makeLargeNumberReadable(pickups[i].getData("vrr.label.rentprice"));
+ }
+
+ if(pickups[i].getData("vrr.label.help") != null) {
+ labelInfoType = pickups[i].getData("vrr.label.help");
+ }
+
+ switch(pickups[i].getData("vrr.label.type")) {
+ case VRR_LABEL_BUSINESS: {
+ renderPropertyEntranceLabel(pickups[i].getData("vrr.label.name"), pickups[i].position, pickups[i].getData("vrr.label.locked"), true, price, rentPrice, labelInfoType);
+ break;
+ }
+
+ case VRR_LABEL_HOUSE: {
+ renderPropertyEntranceLabel(pickups[i].getData("vrr.label.name"), pickups[i].position, pickups[i].getData("vrr.label.locked"), false, price, rentPrice, labelInfoType);
+ break;
+ }
+
+ case VRR_LABEL_JOB: {
+ renderJobLabel(pickups[i].getData("vrr.label.name"), pickups[i].position, pickups[i].getData("vrr.label.jobType"));
+ break;
+ }
+
+ case VRR_LABEL_EXIT: {
+ renderPropertyExitLabel(pickups[i].position);
+ break;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
}
// -------------------------------------------------------------------------
\ No newline at end of file
diff --git a/scripts/client/locale.js b/scripts/client/locale.js
new file mode 100644
index 00000000..f8218340
--- /dev/null
+++ b/scripts/client/locale.js
@@ -0,0 +1,62 @@
+// ===========================================================================
+// Vortrex's Roleplay Resource
+// https://github.com/VortrexFTW/gtac_roleplay
+// ===========================================================================
+// FILE: locale.js
+// DESC: Provides locale functions and usage
+// TYPE: Client (JavaScript)
+// ===========================================================================
+
+function getLocaleString(stringName, ...args) {
+ if(typeof getServerData().localeStrings[localLocaleId][stringName] == undefined) {
+ return "";
+ }
+
+ let tempString = getServerData().localeStrings[localLocaleId][stringName];
+
+ if(tempString == "" || tempString == null || tempString == undefined) {
+ return "";
+ }
+
+ for(let i = 1; i <= args.length; i++) {
+ tempString = tempString.replace(`{${i}}`, args[i-1]);
+ }
+
+ return tempString;
+}
+
+// ===========================================================================
+
+function getAvailableLocaleOptions() {
+ return getServerData().localeOptions.filter(localeOption => localeOption.requiresUnicode == false);
+}
+
+// ===========================================================================
+
+function loadLocaleConfig() {
+ let configFile = loadTextFile("config/client/locale.json");
+ getServerData().localeOptions = JSON.parse(configFile);
+}
+
+// ===========================================================================
+
+function loadAllLocaleStrings() {
+ let localeOptions = getServerData().localeOptions;
+ for(let i in localeOptions) {
+ logToConsole(LOG_INFO, `[VRR.Locale] Loading locale strings for ${localeOptions[i].englishName} (${i})`);
+ let localeFile = loadTextFile(`locale/${localeOptions[i].stringsFile}`);
+ let localeData = JSON.parse(localeFile);
+
+ getServerData().localeStrings[i] = localeData;
+ }
+}
+
+// ===========================================================================
+
+function setLocale(tempLocaleId) {
+ logToConsole(LOG_DEBUG, `[VRR.Locale] Setting locale to ${tempLocaleId} (${getServerData().localeOptions[tempLocaleId].englishName})`);
+ localLocaleId = tempLocaleId;
+ resetGUIStrings();
+}
+
+// ===========================================================================
\ No newline at end of file
diff --git a/scripts/client/logo.js b/scripts/client/logo.js
index 286e38e1..9a23f20b 100644
--- a/scripts/client/logo.js
+++ b/scripts/client/logo.js
@@ -15,38 +15,38 @@ let logoSize = toVector2(128, 128);
function initLogoScript() {
logToConsole(LOG_DEBUG, "[VRR.Logo]: Initializing logo script ...");
- //logoImage = loadLogoImage();
+ //logoImage = loadLogoImage();
logToConsole(LOG_DEBUG, "[VRR.Logo]: Logo script initialized!");
}
// ===========================================================================
function loadLogoImage() {
- let logoStream = openFile(mainLogoPath);
- let tempLogoImage = null;
- if(logoStream != null) {
- tempLogoImage = graphics.loadPNG(logoStream);
- logoStream.close();
- }
+ let logoStream = openFile(mainLogoPath);
+ let tempLogoImage = null;
+ if(logoStream != null) {
+ tempLogoImage = graphics.loadPNG(logoStream);
+ logoStream.close();
+ }
- return tempLogoImage;
+ return tempLogoImage;
}
// ===========================================================================
function processLogoRendering() {
- if(renderLogo) {
- if(logoImage != null) {
- graphics.drawRectangle(logoImage, logoPos, logoSize);
- }
- }
+ if(renderLogo) {
+ if(logoImage != null) {
+ graphics.drawRectangle(logoImage, logoPos, logoSize);
+ }
+ }
}
// ===========================================================================
function setServerLogoRenderState(state) {
- logToConsole(LOG_DEBUG, `[VRR.Main] Server logo ${(state) ? "enabled" : "disabled"}`);
- renderLogo = state;
+ logToConsole(LOG_DEBUG, `[VRR.Main] Server logo ${(state) ? "enabled" : "disabled"}`);
+ renderLogo = state;
}
// ===========================================================================
\ No newline at end of file
diff --git a/scripts/client/main.js b/scripts/client/main.js
index e28117a2..7afcd3db 100644
--- a/scripts/client/main.js
+++ b/scripts/client/main.js
@@ -7,6 +7,9 @@
// TYPE: Client (JavaScript)
// ===========================================================================
+let resourceReady = false;
+let resourceStarted = false;
+
let inSphere = false;
let inVehicle = false;
let inVehicleSeat = false;
@@ -27,7 +30,7 @@ let renderHotBar = true;
let renderItemActionDelay = true;
let renderInteriorLights = true;
-let logLevel = LOG_ERROR|LOG_WARN|LOG_INFO;
+let logLevel = LOG_INFO|LOG_DEBUG|LOG_VERBOSE;
let weaponDamageEnabled = {};
let weaponDamageEvent = {};
@@ -66,12 +69,24 @@ let vehiclePurchasePosition = null;
let forceWantedLevel = 0;
+let guiSubmitKey = false;
+let guiLeftKey = false;
+let guiRightKey = false;
+let guiUpKey = false;
+let guiDownKey = false;
+
// Pre-cache all allowed skins
let allowedSkins = getAllowedSkins(getGame());
-let businesses = [];
-let houses = [];
-let jobs = [];
-let vehicles = [];
+let localLocaleId = 0;
-// ===========================================================================
\ No newline at end of file
+let serverData = {
+ houses: [],
+ businesses: [],
+ localeStrings: [],
+ localeOptions: [],
+ vehicles: [],
+ jobs: [],
+};
+
+// ===========================================================================
diff --git a/scripts/client/messaging.js b/scripts/client/messaging.js
index a2c97cfd..1bd288c3 100644
--- a/scripts/client/messaging.js
+++ b/scripts/client/messaging.js
@@ -7,7 +7,14 @@
// TYPE: Client (JavaScript)
// ===========================================================================
-let smallGameMessageFont = null;
+let bigGameMessageFonts = {};
+let bigGameMessageFontName = "";
+let bigGameMessageText = "";
+let bigGameMessageColour = COLOUR_WHITE;
+let bigGameMessageTimer = null;
+
+let smallGameMessageFonts = {};
+let smallGameMessageFontName = "";
let smallGameMessageText = "";
let smallGameMessageColour = COLOUR_WHITE;
let smallGameMessageTimer = null;
@@ -16,64 +23,73 @@ let smallGameMessageTimer = null;
function initMessagingScript() {
logToConsole(LOG_DEBUG, "[VRR.Messaging]: Initializing messaging script ...");
- smallGameMessageFont = loadSmallGameMessageFont();
+ smallGameMessageFonts = loadSmallGameMessageFonts();
+ bigGameMessageFonts = loadSmallGameMessageFonts();
logToConsole(LOG_DEBUG, "[VRR.Messaging]: Messaging script initialized!");
}
// ===========================================================================
-function loadSmallGameMessageFont() {
- let tempSmallGameMessageFont = null;
- let fontStream = openFile("files/fonts/pricedown.ttf");
- if(fontStream != null) {
- tempSmallGameMessageFont = lucasFont.createFont(fontStream, 20.0);
- fontStream.close();
- }
+function loadSmallGameMessageFonts() {
+ let tempSmallGameMessageFonts = {};
+ let fontStream = openFile("files/fonts/pricedown.ttf");
+ if(fontStream != null) {
+ tempSmallGameMessageFonts["Pricedown"] = lucasFont.createFont(fontStream, 20.0);
+ fontStream.close();
+ }
- return tempSmallGameMessageFont;
+ tempSmallGameMessageFonts["Roboto"] = lucasFont.createDefaultFont(20.0, "Roboto");
+ tempSmallGameMessageFonts["RobotoLight"] = lucasFont.createDefaultFont(20.0, "Roboto", "Light");
+
+ return tempSmallGameMessageFonts;
}
// ===========================================================================
function loadBigGameMessageFont() {
- let tempBigGameMessageFont = null;
- let fontStream = openFile("files/fonts/pricedown.ttf");
- if(fontStream != null) {
- tempBigGameMessageFont = lucasFont.createFont(fontStream, 28.0);
- fontStream.close();
- }
+ let tempBigGameMessageFonts = {};
+ let fontStream = openFile("files/fonts/pricedown.ttf");
+ if(fontStream != null) {
+ tempBigGameMessageFonts["Pricedown"] = lucasFont.createFont(fontStream, 28.0);
+ fontStream.close();
+ }
- return tempBigGameMessageFont;
+ tempBigGameMessageFonts["Roboto"] = lucasFont.createDefaultFont(28.0, "Roboto");
+ tempBigGameMessageFonts["RobotoLight"] = lucasFont.createDefaultFont(28.0, "Roboto", "Light");
+
+ return tempBigGameMessageFonts;
}
// ===========================================================================
function processSmallGameMessageRendering() {
- if(renderSmallGameMessage) {
- if(smallGameMessageFont != null) {
- if(smallGameMessageFont != "") {
- smallGameMessageFont.render(smallGameMessageText, [0, game.height-90], game.width, 0.5, 0.0, smallGameMessageFont.size, smallGameMessageColour, true, true, false, true);
- }
- }
- }
+ if(renderSmallGameMessage) {
+ if(smallGameMessageText != "") {
+ if(smallGameMessageFonts[smallGameMessageFontName] != null) {
+ smallGameMessageFonts[smallGameMessageFontName].render(smallGameMessageText, [0, game.height-90], game.width, 0.5, 0.0, smallGameMessageFonts[smallGameMessageFontName].size, smallGameMessageColour, true, true, false, true);
+ }
+ }
+ }
}
// ===========================================================================
-function showSmallGameMessage(text, colour, duration) {
- logToConsole(LOG_DEBUG, `[VRR.Messaging] Showing small game message '${text}' for ${duration}ms`);
- if(smallGameMessageText != "") {
- clearTimeout(smallGameMessageTimer);
- }
+function showSmallGameMessage(text, colour, duration, fontName) {
+ logToConsole(LOG_DEBUG, `[VRR.Messaging] Showing small game message '${text}' using font ${fontName} for ${duration}ms`);
+ if(smallGameMessageText != "") {
+ clearTimeout(smallGameMessageTimer);
+ }
- smallGameMessageColour = colour;
- smallGameMessageText = text;
+ smallGameMessageFontName = fontName;
+ smallGameMessageColour = colour;
+ smallGameMessageText = text;
- smallGameMessageTimer = setTimeout(function() {
- smallGameMessageText = "";
- smallGameMessageColour = COLOUR_WHITE;
- smallGameMessageTimer = null;
- }, duration);
+ smallGameMessageTimer = setTimeout(function() {
+ smallGameMessageText = "";
+ smallGameMessageColour = COLOUR_WHITE;
+ smallGameMessageTimer = null;
+ smallGameMessageFontName = "";
+ }, duration);
}
// ===========================================================================
\ No newline at end of file
diff --git a/scripts/client/mousecam.js b/scripts/client/mousecam.js
index cd4bfd7b..08889376 100644
--- a/scripts/client/mousecam.js
+++ b/scripts/client/mousecam.js
@@ -20,7 +20,7 @@ function SetStandardControlsEnabled(bEnabled)
if (game.standardControls === undefined)
{
- console.warn("game.standardControls not implemented");
+ logToConsole(LOG_WARN, "game.standardControls not implemented");
return;
}
game.standardControls = bEnabled;
@@ -93,7 +93,7 @@ function GetMouseSensitivity()
{
if (game.getMouseSensitivity === undefined)
{
- //console.error("game.getMouseSensitivity not implemented");
+ //logToConsole(LOG_ERROR, "game.getMouseSensitivity not implemented");
return [0.0025,0.003];
}
let MouseSensitivity = game.getMouseSensitivity();
@@ -124,7 +124,7 @@ function ProcessLineOfSight(vecStartX, vecStartY, vecStartZ, vecEndX, vecEndY, v
{
if (game.processLineOfSight === undefined)
{
- console.warn("game.processLineOfSight not implemented");
+ logToConsole(LOG_WARN, "game.processLineOfSight not implemented");
return [null];
}
let Result = game.processLineOfSight([vecStartX, vecStartY, vecStartZ], [vecEndX, vecEndY, vecEndZ], bCheckBuildings, bCheckVehicles, bCheckPeds, bCheckObjects, bCheckDummies, bCheckSeeThroughStuff, bIgnoreSomeObjectsForCamera);
@@ -632,10 +632,10 @@ function update()
addEventHandler("OnCameraProcess", (event) =>
{
- if(mouseCameraEnabled) {
- update();
- event.preventDefault();
- }
+ if(mouseCameraEnabled) {
+ update();
+ event.preventDefault();
+ }
});
function toggleMouseCamera() {
diff --git a/scripts/client/nametag.js b/scripts/client/nametag.js
index 7009f884..699b9bc6 100644
--- a/scripts/client/nametag.js
+++ b/scripts/client/nametag.js
@@ -48,11 +48,11 @@ function updatePlayerNameTag(clientName, characterName, colour, paused, ping) {
playerPaused[clientName] = paused;
playerPing[clientName] = ping;
- if(game.game == VRR_GAME_GTA_IV) {
+ if(getGame() == VRR_GAME_GTA_IV) {
let client = getPlayerFromParams(clientName);
if(client != false) {
- if(client.player != null) {
- client.player.setNametag(characterName, colour);
+ if(getPlayerPed(client) != null) {
+ getPlayerPed(client).setNametag(characterName, colour);
}
}
}
@@ -74,14 +74,14 @@ function drawNametag(x, y, health, armour, text, ping, alpha, distance, colour,
alpha *= 0.75;
let width = nametagWidth;
health = Math.max(0.0, Math.min(1.0, health));
- armour = Math.max(0.0, Math.min(1.0, armour));
+ armour = Math.max(0.0, Math.min(1.0, armour));
- // Starts at bottom and works it's way up
- // -------------------------------------------
- // Health Bar
+ // Starts at bottom and works it's way up
+ // -------------------------------------------
+ // Health Bar
if(getMultiplayerMod() == VRR_MPMOD_GTAC) {
- if(game.game == VRR_GAME_GTA_III) {
+ if(getGame() == VRR_GAME_GTA_III) {
// Mickey Hamfists is ridiculously tall. Raise the nametag for him a bit
if(skin == 109) {
y -= 20;
@@ -104,7 +104,7 @@ function drawNametag(x, y, health, armour, text, ping, alpha, distance, colour,
graphics.drawRectangle(null, [hx+2, hy+2], [(width-4)*health, 10-6], colour, colour, colour, colour);
}
- // Armour Bar
+ // Armour Bar
if (armour > 0.0)
{
// Go up 10 pixels to draw the next part
@@ -119,16 +119,16 @@ function drawNametag(x, y, health, armour, text, ping, alpha, distance, colour,
y -= 20;
- // Nametag
+ // Nametag
if(nametagFont != null) {
let size = nametagFont.measure(text, game.width, 0.0, 0.0, nametagFont.size, false, false);
nametagFont.render(text, [x-size[0]/2, y-size[1]/2], game.width, 0.0, 0.0, nametagFont.size, colour, false, false, false, true);
}
- // Go up another 10 pixels for the next part
- y -= 20;
+ // Go up another 10 pixels for the next part
+ y -= 20;
- // AFK Status
+ // AFK Status
if(afkStatusFont != null) {
if(afk) {
let size = afkStatusFont.measure("PAUSED", game.width, 0.0, 0.0, afkStatusFont.size, false, false);
@@ -139,7 +139,7 @@ function drawNametag(x, y, health, armour, text, ping, alpha, distance, colour,
// ===========================================================================
-function updateNametags(element) {
+function updateNametag(element) {
if(!areWorldLabelsSupported()) {
return false;
}
@@ -147,10 +147,11 @@ function updateNametags(element) {
if(localPlayer != null) {
let playerPos = localPlayer.position;
let elementPos = element.position;
- let client = getClientFromPlayerElement(element);
elementPos[2] += 0.9;
+ //if(typeof element.getComponentPosition()) {
+
let screenPos = getScreenFromWorldPosition(elementPos);
if (screenPos[2] >= 0.0) {
let health = element.health/100.0;
@@ -173,27 +174,29 @@ function updateNametags(element) {
}
if(element.type == ELEMENT_PLAYER) {
- let name = element.name;
- let colour = COLOUR_WHITE;
+ let name = element.name;
+ let colour = COLOUR_WHITE;
let paused = false;
let ping = -1;
- if(typeof playerNames[element.name] != "undefined") {
- name = playerNames[element.name];
- }
+ if(element.isType(ELEMENT_PLAYER)) {
+ if(typeof playerNames[element.name] != "undefined") {
+ name = playerNames[element.name];
+ }
- if(typeof playerPaused[element.name] != "undefined") {
- paused = playerPaused[element.name];
- }
+ if(typeof playerPaused[element.name] != "undefined") {
+ paused = playerPaused[element.name];
+ }
- if(typeof playerColours[element.name] != "undefined") {
- colour = playerColours[element.name];
+ if(typeof playerColours[element.name] != "undefined") {
+ colour = playerColours[element.name];
+ }
+
+ if(typeof playerPing[element.name] != "undefined") {
+ ping = playerPing[element.name];
+ }
}
- if(typeof playerPing[element.name] != "undefined") {
- ping = playerPing[element.name];
- }
-
drawNametag(screenPos[0], screenPos[1], health, armour, name, ping, 1.0-distance/nametagDistance, distance, colour, paused, element.skin);
}
}
@@ -205,7 +208,7 @@ function updateNametags(element) {
function getClientFromPlayer(player) {
getClients().forEach(function(client) {
- if(client.player == player) {
+ if(getPlayerPed(client) == player) {
return client;
}
});
@@ -214,13 +217,13 @@ function getClientFromPlayer(player) {
// ===========================================================================
function processNameTagRendering(event) {
- //if(game.game >= GAME_GTA_IV) {
+ //if(getGame() >= GAME_GTA_IV) {
// return false;
//}
- getElementsByType(ELEMENT_PLAYER).forEach(function(player) {
- if(player != localPlayer) {
- updateNametags(player);
+ getElementsByType(ELEMENT_PED).forEach(function(ped) {
+ if(ped != localPlayer) {
+ updateNametag(ped);
}
});
}
@@ -231,4 +234,10 @@ function createColour(alpha, red, green, blue) {
return alpha << 24 | red << 16 | green << 8 | blue;
}
+// ===========================================================================
+
+function setNameTagDistance(distance) {
+ nametagDistance = distance;
+}
+
// ===========================================================================
\ No newline at end of file
diff --git a/scripts/client/native/connected.js b/scripts/client/native/connected.js
index f62b24bc..1cea7b56 100644
--- a/scripts/client/native/connected.js
+++ b/scripts/client/native/connected.js
@@ -7,58 +7,89 @@
// TYPE: Server (JavaScript)
// ===========================================================================
+let disconnectReasons = [
+ "Lost Connection",
+ "Disconnected",
+ "Unsupported Client",
+ "Wrong Game",
+ "Incorrect Password",
+ "Unsupported Executable",
+ "Disconnected",
+ "Banned",
+ "Failed",
+ "Invalid Name",
+ "Crashed",
+ "Modified Game"
+];
+
+// ===========================================================================
+
function sendNetworkEventToPlayer(networkEvent, client, ...args) {
- triggerNetworkEvent.apply(null, networkEvent, client, args);
+ triggerNetworkEvent.apply(null, networkEvent, client, args);
}
// ===========================================================================
function getPlayerPosition() {
- return localPlayer.position;
+ return localPlayer.position;
}
// ===========================================================================
function setPlayerPosition(position) {
- localPlayer.position = position;
+ if(getGame() == VRR_GAME_GTA_IV) {
+ natives.setCharCoordinates(localPlayer, position);
+ } else {
+ localPlayer.position = position;
+ }
}
// ===========================================================================
-function getElementPosition(element) {
- return element.position;
+function getElementPosition(elementId) {
+ return getElementFromId(elementId).position;
}
// ===========================================================================
-function setElementPosition(element, position) {
- if(!element.isSyncer) {
- return false;
- }
-
- element.position = position;
+function getElementHeading(elementId) {
+ return getElementFromId(elementId).heading;
}
// ===========================================================================
-function deleteGameElement(element, position) {
- if(!element.isOwner) {
- return false;
- }
+function setElementPosition(elementId, position) {
+ if(getElementFromId(elementId) == null) {
+ return false;
+ }
- destroyGameElement(element);
+ if(!getElementFromId(elementId).isSyncer) {
+ return false;
+ }
+
+ getElementFromId(elementId).position = position;
+}
+
+// ===========================================================================
+
+function deleteGameElement(elementId, position) {
+ if(!getElementFromId(elementId).isOwner) {
+ return false;
+ }
+
+ destroyGameElement(getElementFromId(elementId));
}
// ===========================================================================
function createGameVehicle(modelIndex, position, heading) {
- return game.createVehicle(getGameConfig().vehicles[getGame()][modelIndex][0], position, heading);
+ return game.createVehicle(getGameConfig().vehicles[getGame()][modelIndex][0], position, heading);
}
// ===========================================================================
function addNetworkEventHandler(eventName, handlerFunction) {
- addNetworkHandler(eventName, handlerFunction);
+ addNetworkHandler(eventName, handlerFunction);
}
// ===========================================================================
@@ -101,7 +132,7 @@ function getClientsInRange(position, distance) {
// ===========================================================================
function getCiviliansInRange(position, distance) {
- return getElementsByType(ELEMENT_PED).filter(x => !x.isType(ELEMENT_PLAYER) && getElementPosition(x).position.distance(position) <= distance);
+ return getElementsByType(ELEMENT_PED).filter(x => !x.isType(ELEMENT_PLAYER) && x.position.distance(position) <= distance);
}
// ===========================================================================
@@ -113,7 +144,7 @@ function getPlayersInRange(position, distance) {
// ===========================================================================
function getElementsByTypeInRange(elementType, position, distance) {
- return getElementsByType(elementType).filter(x => getElementPosition(x).position.distance(position) <= distance);
+ return getElementsByType(elementType).filter(x => x.position.distance(position) <= distance);
}
// ===========================================================================
@@ -124,6 +155,12 @@ function getClosestCivilian(position) {
// ===========================================================================
+function getClosestPlayer(position) {
+ return getElementsByType(ELEMENT_PLAYER).reduce((i, j) => ((i.position.distance(position) <= j.position.distance(position)) ? i : j));
+}
+
+// ===========================================================================
+
function is2dPositionOnScreen(pos2d) {
return pos2d.x >= 0 && pos2d.y >= 0 && pos2d.x <= game.width && pos2d.y <= game.height;
}
@@ -141,4 +178,523 @@ function getVehiclesInRange(position, range) {
return inRangeVehicles;
}
+// ===========================================================================
+
+function createGameBlip(blipModel, position, name = "") {
+ if(getGame() == VRR_GAME_GTA_IV) {
+ let blipId = natives.addBlipForCoord(position);
+ if(blipId) {
+ natives.changeBlipSprite(blipId, blipModel);
+ natives.setBlipMarkerLongDistance(blipId, false);
+ natives.setBlipAsShortRange(blipId, true);
+ natives.changeBlipNameFromAscii(blipId, `${name.substr(0, 24)}${(name.length > 24) ? " ...": ""}`);
+ return blipId;
+ }
+ }
+
+ return -1;
+}
+
+// ===========================================================================
+
+function setEntityData(entity, dataName, dataValue, syncToClients = true) {
+ if(entity != null) {
+ return entity.setData(dataName, dataValue);
+ }
+}
+
+// ===========================================================================
+
+function setVehicleEngine(vehicleId, state) {
+ getElementFromId(vehicleId).engine = state;
+}
+
+// ===========================================================================
+
+function setVehicleLights(vehicleId, state) {
+ getElementFromId(vehicleId).lights = state;
+}
+
+// ===========================================================================
+
+function repairVehicle(syncId) {
+ getVehicleFromSyncId(syncId).fix();
+}
+
+// ===========================================================================
+
+function syncVehicleProperties(vehicle) {
+ if(doesEntityDataExist(vehicle, "vrr.lights")) {
+ let lightStatus = getEntityData(vehicle, "vrr.lights");
+ vehicle.lights = lightStatus;
+ }
+
+ if(doesEntityDataExist(vehicle, "vrr.invincible")) {
+ let invincible = getEntityData(vehicle, "vrr.invincible");
+ element.setProofs(invincible, invincible, invincible, invincible, invincible);
+ }
+
+ if(doesEntityDataExist(vehicle, "vrr.panelStatus")) {
+ let panelsStatus = getEntityData(vehicle, "vrr.panelStatus");
+ for(let i in panelsStatus) {
+ vehicle.setPanelStatus(i, panelsStatus[i]);
+ }
+ }
+
+ if(doesEntityDataExist(vehicle, "vrr.wheelStatus")) {
+ let wheelsStatus = getEntityData(vehicle, "vrr.wheelStatus");
+ for(let i in wheelsStatus) {
+ vehicle.setWheelStatus(i, wheelsStatus[i]);
+ }
+ }
+
+ if(doesEntityDataExist(vehicle, "vrr.lightStatus")) {
+ let lightStatus = getEntityData(vehicle, "vrr.lightStatus");
+ for(let i in lightStatus) {
+ vehicle.setLightStatus(i, lightStatus[i]);
+ }
+ }
+
+ if(doesEntityDataExist(vehicle, "vrr.suspensionHeight")) {
+ let suspensionHeight = getEntityData(vehicle, "vrr.suspensionHeight");
+ vehicle.setSuspensionHeight(suspensionHeight);
+ }
+
+ if(getGame() == VRR_GAME_GTA_SA) {
+ let allUpgrades = getGameConfig().vehicleUpgrades[getGame()];
+ for(let i in allUpgrades) {
+ vehicle.removeUpgrade(i);
+ }
+
+ if(doesEntityDataExist(vehicle, "vrr.upgrades")) {
+ let upgrades = getEntityData(vehicle, "vrr.upgrades");
+ for(let i in upgrades) {
+ if(upgrades[i] != 0) {
+ vehicle.addUpgrade(upgrades[i]);
+ }
+ }
+ }
+ }
+
+ if(getGame() == VRR_GAME_GTA_SA || getGame() == VRR_GAME_GTA_IV) {
+ if(doesEntityDataExist(vehicle, "vrr.livery")) {
+ let livery = getEntityData(vehicle, "vrr.livery");
+ if(getGame() == VRR_GAME_GTA_SA) {
+ vehicle.setPaintJob(livery);
+ } else if(getGame() == VRR_GAME_GTA_IV) {
+ vehicle.livery = livery;
+ }
+ }
+ }
+}
+
+// ===========================================================================
+
+function removeEntityData(entity, dataName) {
+ if(entity != null) {
+ return entity.removeData(dataName);
+ }
+ return null;
+}
+
+// ===========================================================================
+
+function doesEntityDataExist(entity, dataName) {
+ if(entity != null) {
+ return (entity.getData(dataName) != null);
+ }
+ return null;
+}
+
+// ===========================================================================
+
+function syncCivilianProperties(civilian) {
+ if(getGame() == VRR_GAME_GTA_III) {
+ if(doesEntityDataExist(civilian, "vrr.scale")) {
+ let scaleFactor = getEntityData(civilian, "vrr.scale");
+ let tempMatrix = civilian.matrix;
+ tempMatrix.setScale(toVector3(scaleFactor.x, scaleFactor.y, scaleFactor.z));
+ let tempPosition = civilian.position;
+ civilian.matrix = tempMatrix;
+ tempPosition.z += scaleFactor.z;
+ civilian.position = tempPosition;
+ }
+ }
+
+ if(getGame() == VRR_GAME_GTA_SA) {
+ if(doesEntityDataExist(civilian, "vrr.fightStyle")) {
+ let fightStyle = getEntityData(civilian, "vrr.fightStyle");
+ civilian.setFightStyle(fightStyle[0], fightStyle[1]);
+ }
+ }
+
+ if(getGame() == VRR_GAME_GTA_III) {
+ if(doesEntityDataExist(civilian, "vrr.walkStyle")) {
+ let walkStyle = getEntityData(civilian, "vrr.walkStyle");
+ civilian.walkStyle = walkStyle;
+ }
+ }
+
+ if(getGame() == VRR_GAME_GTA_IV) {
+ if(doesEntityDataExist(civilian, "vrr.bodyPropHair")) {
+ let bodyPropHair = getEntityData(civilian, "vrr.bodyPropHair");
+ civilian.changeBodyProp(0, bodyPropHair[0], bodyPropHair[1]);
+ }
+
+ if(doesEntityDataExist(civilian, "vrr.bodyPropHead")) {
+ let bodyPropHead = getEntityData(civilian, "vrr.bodyPropHead");
+ civilian.changeBodyProp(1, bodyPropHead[0], bodyPropHead[1]);
+ }
+
+ if(doesEntityDataExist(civilian, "vrr.bodyPropEyes")) {
+ let bodyPropEyes = getEntityData(civilian, "vrr.bodyPropEyes");
+ civilian.changeBodyProp(1, bodyPropEyes[0], bodyPropEyes[1]);
+ }
+
+ if(doesEntityDataExist(civilian, "vrr.bodyPropLeftHand")) {
+ let bodyPropLeftHand = getEntityData(civilian, "vrr.bodyPropLeftHand");
+ civilian.changeBodyProp(1, bodyPropLeftHand[0], bodyPropLeftHand[1]);
+ }
+
+ if(doesEntityDataExist(civilian, "vrr.bodyPropRightHand")) {
+ let bodyPropRightHand = getEntityData(civilian, "vrr.bodyPropRightHand");
+ civilian.changeBodyProp(1, bodyPropRightHand[0], bodyPropRightHand[1]);
+ }
+
+ if(doesEntityDataExist(civilian, "vrr.bodyPropLeftWrist")) {
+ let bodyPropLeftWrist = getEntityData(civilian, "vrr.bodyPropLeftWrist");
+ civilian.changeBodyProp(1, bodyPropLeftWrist[0], bodyPropLeftWrist[1]);
+ }
+
+ if(doesEntityDataExist(civilian, "vrr.bodyPropRightWrist")) {
+ let bodyPropRightWrist = getEntityData(civilian, "vrr.bodyPropRightWrist");
+ civilian.changeBodyProp(1, bodyPropRightWrist[0], bodyPropRightWrist[1]);
+ }
+
+ if(doesEntityDataExist(civilian, "vrr.bodyPropRightWrist")) {
+ let bodyPropRightWrist = getEntityData(civilian, "vrr.bodyPropRightWrist");
+ civilian.changeBodyProp(1, bodyPropRightWrist[0], bodyPropRightWrist[1]);
+ }
+
+ if(doesEntityDataExist(civilian, "vrr.bodyPropHip")) {
+ let bodyPropHip = getEntityData(civilian, "vrr.bodyPropHip");
+ civilian.changeBodyProp(1, bodyPropHip[0], bodyPropHip[1]);
+ }
+
+ if(doesEntityDataExist(civilian, "vrr.bodyPropLeftFoot")) {
+ let bodyPropLeftFoot = getEntityData(civilian, "vrr.bodyPropLeftFoot");
+ civilian.changeBodyProp(1, bodyPropLeftFoot[0], bodyPropLeftFoot[1]);
+ }
+
+ if(doesEntityDataExist(civilian, "vrr.bodyPropRightFoot")) {
+ let bodyPropRightFoot = getEntityData(civilian, "vrr.bodyPropRightFoot");
+ civilian.changeBodyProp(1, bodyPropRightFoot[0], bodyPropRightFoot[1]);
+ }
+ }
+
+ if(doesEntityDataExist(civilian, "vrr.anim")) {
+ let animData = getEntityData(vehicle, "vrr.anim");
+ civilian.addAnimation(animData[0], animData[1]);
+ }
+}
+
+// ===========================================================================
+
+function preventDefaultEventAction(event) {
+ event.preventDefault();
+}
+
+// ===========================================================================
+
+function syncPlayerProperties(player) {
+ if(getGame() == VRR_GAME_GTA_III) {
+ if(doesEntityDataExist(player, "vrr.scale")) {
+ let scaleFactor = getEntityData(player, "vrr.scale");
+ let tempMatrix = player.matrix;
+ tempMatrix.setScale(toVector3(scaleFactor.x, scaleFactor.y, scaleFactor.z));
+ let tempPosition = player.position;
+ player.matrix = tempMatrix;
+ tempPosition.z += scaleFactor.z;
+ player.position = tempPosition;
+ }
+ }
+
+ if(getGame() == VRR_GAME_GTA_SA) {
+ if(doesEntityDataExist(player, "vrr.fightStyle")) {
+ let fightStyle = getEntityData(player, "vrr.fightStyle");
+ player.setFightStyle(fightStyle[0], fightStyle[1]);
+ }
+ }
+
+ //if(getGame() == VRR_GAME_GTA_SA) {
+ // if(doesEntityDataExist(player, "vrr.walkStyle")) {
+ // let walkStyle = getEntityData(player, "vrr.walkStyle");
+ // player.walkStyle = walkStyle;
+ // }
+ //}
+
+ if(getGame() == VRR_GAME_GTA_IV) {
+ if(doesEntityDataExist(player, "vrr.bodyPartHair")) {
+ let bodyPartHead = getEntityData(player, "vrr.bodyPartHair");
+ player.changeBodyPart(0, bodyPartHead[0], bodyPartHair[1]);
+ }
+
+ if(doesEntityDataExist(player, "vrr.bodyPartHead")) {
+ let bodyPartHead = getEntityData(player, "vrr.bodyPartHead");
+ player.changeBodyPart(1, bodyPartHead[0], bodyPartHead[1]);
+ }
+
+ if(doesEntityDataExist(player, "vrr.bodyPartUpper")) {
+ let bodyPartUpper = getEntityData(player, "vrr.bodyPartUpper");
+ player.changeBodyPart(1, bodyPartUpper[0], bodyPartUpper[1]);
+ }
+
+ if(doesEntityDataExist(player, "vrr.bodyPartLower")) {
+ let bodyPartLower = getEntityData(player, "vrr.bodyPartLower");
+ player.changeBodyPart(1, bodyPartLower[0], bodyPartLower[1]);
+ }
+ }
+
+ if(getGame() == VRR_GAME_GTA_IV) {
+ if(doesEntityDataExist(player, "vrr.bodyPropHair")) {
+ let bodyPropHair = getEntityData(player, "vrr.bodyPropHair");
+ player.changeBodyProp(0, bodyPropHair[0], bodyPropHair[1]);
+ }
+
+ if(doesEntityDataExist(player, "vrr.bodyPropHead")) {
+ let bodyPropHead = getEntityData(player, "vrr.bodyPropHead");
+ player.changeBodyProp(1, bodyPropHead[0], bodyPropHead[1]);
+ }
+
+ if(doesEntityDataExist(player, "vrr.bodyPropEyes")) {
+ let bodyPropEyes = getEntityData(player, "vrr.bodyPropEyes");
+ player.changeBodyProp(1, bodyPropEyes[0], bodyPropEyes[1]);
+ }
+
+ if(doesEntityDataExist(player, "vrr.bodyPropLeftHand")) {
+ let bodyPropLeftHand = getEntityData(player, "vrr.bodyPropLeftHand");
+ player.changeBodyProp(1, bodyPropLeftHand[0], bodyPropLeftHand[1]);
+ }
+
+ if(doesEntityDataExist(player, "vrr.bodyPropRightHand")) {
+ let bodyPropRightHand = getEntityData(player, "vrr.bodyPropRightHand");
+ player.changeBodyProp(1, bodyPropRightHand[0], bodyPropRightHand[1]);
+ }
+
+ if(doesEntityDataExist(player, "vrr.bodyPropLeftWrist")) {
+ let bodyPropLeftWrist = getEntityData(player, "vrr.bodyPropLeftWrist");
+ player.changeBodyProp(1, bodyPropLeftWrist[0], bodyPropLeftWrist[1]);
+ }
+
+ if(doesEntityDataExist(player, "vrr.bodyPropRightWrist")) {
+ let bodyPropRightWrist = getEntityData(player, "vrr.bodyPropRightWrist");
+ player.changeBodyProp(1, bodyPropRightWrist[0], bodyPropRightWrist[1]);
+ }
+
+ if(doesEntityDataExist(player, "vrr.bodyPropRightWrist")) {
+ let bodyPropRightWrist = getEntityData(player, "vrr.bodyPropRightWrist");
+ player.changeBodyProp(1, bodyPropRightWrist[0], bodyPropRightWrist[1]);
+ }
+
+ if(doesEntityDataExist(player, "vrr.bodyPropHip")) {
+ let bodyPropHip = getEntityData(player, "vrr.bodyPropHip");
+ player.changeBodyProp(1, bodyPropHip[0], bodyPropHip[1]);
+ }
+
+ if(doesEntityDataExist(player, "vrr.bodyPropLeftFoot")) {
+ let bodyPropLeftFoot = getEntityData(player, "vrr.bodyPropLeftFoot");
+ player.changeBodyProp(1, bodyPropLeftFoot[0], bodyPropLeftFoot[1]);
+ }
+
+ if(doesEntityDataExist(player, "vrr.bodyPropRightFoot")) {
+ let bodyPropRightFoot = getEntityData(player, "vrr.bodyPropRightFoot");
+ player.changeBodyProp(1, bodyPropRightFoot[0], bodyPropRightFoot[1]);
+ }
+ }
+}
+
+// ===========================================================================
+
+function syncObjectProperties(object) {
+ if(getGame() == VRR_GAME_GTA_III || getGame() == VRR_GAME_GTA_VC) {
+ if(doesEntityDataExist(object, "vrr.scale")) {
+ let scaleFactor = getEntityData(object, "vrr.scale");
+ let tempMatrix = object.matrix;
+ tempMatrix.setScale(toVector3(scaleFactor.x, scaleFactor.y, scaleFactor.z));
+ let tempPosition = object.position;
+ object.matrix = tempMatrix;
+ tempPosition.z += scaleFactor.z;
+ object.position = tempPosition;
+ }
+ }
+}
+
+// ===========================================================================
+
+function consolePrint(text) {
+ console.log(text);
+}
+
+// ===========================================================================
+
+function consoleWarn(text) {
+ console.warn(text);
+}
+
+// ===========================================================================
+
+function consoleError(text) {
+ console.error(text);
+}
+
+// ===========================================================================
+
+function getPlayerName(client) {
+ return client.name;
+}
+
+// ===========================================================================
+
+function getGame() {
+ return game.game;
+}
+
+// ===========================================================================
+
+function getPlayerId(client) {
+ return client.index;
+}
+
+// ===========================================================================
+
+function syncElementProperties(element) {
+ if(doesEntityDataExist(element, "vrr.interior")) {
+ if(typeof element.interior != "undefined") {
+ element.interior = getEntityData(element, "vrr.interior");
+ }
+ }
+
+ switch(element.type) {
+ case ELEMENT_VEHICLE:
+ syncVehicleProperties(element);
+ break;
+
+ case ELEMENT_PED:
+ syncCivilianProperties(element);
+ break;
+
+ case ELEMENT_PLAYER:
+ syncPlayerProperties(element);
+ break;
+
+ case ELEMENT_OBJECT:
+ syncObjectProperties(element);
+ break;
+
+ default:
+ break;
+ }
+}
+
+// ===========================================================================
+
+function getPlayerPed(client) {
+ return client.player;
+}
+
+// ===========================================================================
+
+function getScreenWidth() {
+ return game.width;
+}
+
+// ===========================================================================
+
+function getScreenHeight() {
+ return game.height;
+}
+
+// ===========================================================================
+
+// ===========================================================================
+
+function openAllGarages() {
+ switch(getGame()) {
+ case VRR_GAME_GTA_III:
+ for(let i=0;i<=26;i++) {
+ openGarage(i);
+ game.NO_SPECIAL_CAMERA_FOR_THIS_GARAGE(i);
+ }
+ break;
+
+ case VRR_GAME_GTA_VC:
+ for(let i=0;i<=32;i++) {
+ openGarage(i);
+ game.NO_SPECIAL_CAMERA_FOR_THIS_GARAGE(i);
+ }
+ break;
+
+ case VRR_GAME_GTA_SA:
+ for(let i=0;i<=44;i++) {
+ openGarage(i);
+ }
+ break;
+
+ default:
+ break;
+ }
+}
+
+// ===========================================================================
+
+function closeAllGarages() {
+ switch(getGame()) {
+ case VRR_GAME_GTA_III:
+ for(let i=0;i<=26;i++) {
+ closeGarage(i);
+ game.NO_SPECIAL_CAMERA_FOR_THIS_GARAGE(i);
+ }
+ break;
+
+ case VRR_GAME_GTA_VC:
+ for(let i=0;i<=32;i++) {
+ closeGarage(i);
+ game.NO_SPECIAL_CAMERA_FOR_THIS_GARAGE(i);
+ }
+ break;
+
+ case VRR_GAME_GTA_SA:
+ for(let i=0;i<=44;i++) {
+ closeGarage(i);
+ }
+ break;
+
+ default:
+ break;
+ }
+}
+
+// ===========================================================================
+
+function setPedInvincible(ped, state) {
+ ped.invincible = state;
+}
+
+// ===========================================================================
+
+function setPedLookAt(ped, position) {
+ if(getGame() == VRR_GAME_GTA_SA) {
+ ped.lookAt(position, 10000);
+ return true;
+ } else {
+ setElementHeading(ped.id, getHeadingFromPosToPos(getElementPosition(ped.id), position));
+ }
+}
+
+// ===========================================================================
+
+function setElementHeading(elementId, heading) {
+ getElementFromId(elementId).heading = heading;
+}
+
// ===========================================================================
\ No newline at end of file
diff --git a/scripts/client/npc.js b/scripts/client/npc.js
new file mode 100644
index 00000000..5d823bf6
--- /dev/null
+++ b/scripts/client/npc.js
@@ -0,0 +1,19 @@
+// ===========================================================================
+// Vortrex's Roleplay Resource
+// https://github.com/VortrexFTW/gtac_roleplay
+// ===========================================================================
+// FILE: npc.js
+// DESC: Provides NPC functions and processing
+// TYPE: Client (JavaScript)
+// ===========================================================================
+
+function processNPCMovement(npc) {
+ //if(npc.isSyncer == true) {
+ if(getEntityData(npc, "vrr.lookAtClosestPlayer") == true) {
+ let closestPlayer = getClosestPlayer(getElementPosition(npc.id));
+ setPedLookAt(npc, getElementPosition(closestPlayer.id));
+ }
+ //}
+}
+
+// ===========================================================================
\ No newline at end of file
diff --git a/scripts/client/radio.js b/scripts/client/radio.js
index 2608e834..7cb04ae5 100644
--- a/scripts/client/radio.js
+++ b/scripts/client/radio.js
@@ -8,39 +8,39 @@
// ===========================================================================
function playStreamingRadio(url, loop, volume, element = false) {
- if(streamingRadio != null) {
- streamingRadio.stop();
- }
+ if(streamingRadio != null) {
+ streamingRadio.stop();
+ }
- streamingRadioVolume = volume;
+ streamingRadioVolume = volume;
- streamingRadio = audio.createSoundFromURL(url, loop);
- streamingRadio.volume = volume/100;
- streamingRadio.play();
+ streamingRadio = audio.createSoundFromURL(url, loop);
+ streamingRadio.volume = volume/100;
+ streamingRadio.play();
}
// ===========================================================================
function stopStreamingRadio() {
- if(streamingRadio != null) {
- streamingRadio.stop();
- }
- streamingRadio = null;
+ if(streamingRadio != null) {
+ streamingRadio.stop();
+ }
+ streamingRadio = null;
}
// ===========================================================================
function setStreamingRadioVolume(volume) {
- if(streamingRadio != null) {
- streamingRadioVolume = volume;
- streamingRadio.volume = volume/100;
- }
+ if(streamingRadio != null) {
+ streamingRadioVolume = volume;
+ streamingRadio.volume = volume/100;
+ }
}
// ===========================================================================
function playAudioFile(audioName, loop, volume) {
- playCustomAudio(audioName, volume/100, loop);
+ findResourceByName("connectedrp-extra").exports.playCustomAudio(audioName, volume/100, loop);
}
// ===========================================================================
\ No newline at end of file
diff --git a/scripts/client/scoreboard.js b/scripts/client/scoreboard.js
index 5007d78b..04dd9630 100644
--- a/scripts/client/scoreboard.js
+++ b/scripts/client/scoreboard.js
@@ -43,7 +43,7 @@ function processScoreBoardRendering() {
}
if(renderScoreBoard) {
- if(isKeyDown(SDLK_TAB)) {
+ if(isKeyDown(SDLK_TAB)) {
if(scoreBoardListFont != null && scoreBoardTitleFont != null) {
let scoreboardStart = (game.height/2)-(Math.floor(getClients().length/2)*20);
let titleSize = scoreBoardTitleFont.measure("PLAYERS", game.width, 0.0, 1.0, 10, false, false);
diff --git a/scripts/client/server.js b/scripts/client/server.js
index 5410a2fb..41bf72d6 100644
--- a/scripts/client/server.js
+++ b/scripts/client/server.js
@@ -8,197 +8,251 @@
// ===========================================================================
function initServerScript() {
- logToConsole(LOG_DEBUG, "[VRR.Server]: Initializing server script ...");
- addAllNetworkHandlers();
- logToConsole(LOG_DEBUG, "[VRR.Server]: Server script initialized!");
+ 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 ...");
+ logToConsole(LOG_DEBUG, "[VRR.Server]: Adding network handlers ...");
- addNetworkEventHandler("vrr.smallGameMessage", showSmallGameMessage);
- addNetworkEventHandler("vrr.working", setLocalPlayerWorkingState);
- addNetworkEventHandler("vrr.jobType", setLocalPlayerJobType);
- addNetworkEventHandler("vrr.passenger", enterVehicleAsPassenger);
+ // Chat history
+ addNetworkEventHandler("m", receiveChatBoxMessageFromServer); // Not prefixed with VRR to make it as small as possible
+ addNetworkEventHandler("vrr.chatScrollLines", setChatScrollLines);
+ addNetworkEventHandler("vrr.chatAutoHideDelay", setChatAutoHideDelay);
- addNetworkEventHandler("vrr.freeze", setLocalPlayerFrozenState);
- addNetworkEventHandler("vrr.control", setLocalPlayerControlState);
- addNetworkEventHandler("vrr.fadeCamera", fadeLocalCamera);
- addNetworkEventHandler("vrr.removeFromVehicle", removeLocalPlayerFromVehicle);
- addNetworkEventHandler("vrr.clearPeds", clearLocalPlayerOwnedPeds);
- addNetworkEventHandler("vrr.restoreCamera", restoreLocalCamera);
- addNetworkEventHandler("vrr.cameraLookAt", setLocalCameraLookAt);
- addNetworkEventHandler("vrr.logo", setServerLogoRenderState);
- addNetworkEventHandler("vrr.ambience", setCityAmbienceState);
- addNetworkEventHandler("vrr.runCode", runClientCode);
- addNetworkEventHandler("vrr.clearWeapons", clearLocalPlayerWeapons);
- addNetworkEventHandler("vrr.giveWeapon", giveLocalPlayerWeapon);
- addNetworkEventHandler("vrr.position", setLocalPlayerPosition);
- addNetworkEventHandler("vrr.heading", setLocalPlayerHeading);
- addNetworkEventHandler("vrr.interior", setLocalPlayerInterior);
- addNetworkEventHandler("vrr.minuteDuration", setMinuteDuration);
- addNetworkEventHandler("vrr.showJobRouteLocation", showJobRouteLocation);
- addNetworkEventHandler("vrr.hideJobRouteLocation", hideJobRouteLocation);
- addNetworkEventHandler("vrr.snow", setSnowState);
- addNetworkEventHandler("vrr.health", setLocalPlayerHealth);
- addNetworkEventHandler("vrr.enterPropertyKey", setEnterPropertyKey);
- addNetworkEventHandler("vrr.skinSelect", toggleSkinSelect);
- addNetworkEventHandler("vrr.hotbar", updatePlayerHotBar);
- addNetworkEventHandler("vrr.pedSpeech", playPedSpeech);
- addNetworkEventHandler("vrr.clearPedState", clearLocalPedState);
- addNetworkEventHandler("vrr.drunkEffect", setLocalPlayerDrunkEffect);
- addNetworkEventHandler("vrr.showItemActionDelay", showItemActionDelay);
- addNetworkEventHandler("vrr.set2DRendering", setPlayer2DRendering);
- addNetworkEventHandler("vrr.mouseCursor", toggleMouseCursor);
- addNetworkEventHandler("vrr.mouseCamera", toggleMouseCamera);
- addNetworkEventHandler("vrr.mouseCameraForce", setMouseCameraState);
- addNetworkEventHandler("vrr.weaponDamageEnabled", setPlayerWeaponDamageEnabled);
- addNetworkEventHandler("vrr.weaponDamageEvent", setPlayerWeaponDamageEvent);
- addNetworkEventHandler("vrr.spawned", onServerSpawnedPlayer);
- addNetworkEventHandler("vrr.money", setLocalPlayerCash);
- addNetworkEventHandler("vrr.armour", setLocalPlayerArmour);
- addNetworkEventHandler("vrr.wantedLevel", forceLocalPlayerWantedLevel);
+ // Messaging (like textdraws and stuff)
+ addNetworkEventHandler("vrr.smallGameMessage", showSmallGameMessage);
- addNetworkEventHandler("vrr.delKeyBind", unBindAccountKey);
- addNetworkEventHandler("vrr.addKeyBind", bindAccountKey);
- addNetworkEventHandler("vrr.clearKeyBinds", clearKeyBinds);
+ // Job
+ addNetworkEventHandler("vrr.job", receiveJobFromServer);
+ addNetworkEventHandler("vrr.working", setLocalPlayerWorkingState);
+ addNetworkEventHandler("vrr.jobType", setLocalPlayerJobType);
+ addNetworkEventHandler("vrr.showJobRouteLocation", showJobRouteLocation);
+ addNetworkEventHandler("vrr.hideJobRouteLocation", hideJobRouteLocation);
- addNetworkEventHandler("vrr.nametag", updatePlayerNameTag);
- addNetworkEventHandler("vrr.ping", updatePlayerPing);
+ // 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.m", receiveChatBoxMessageFromServer);
- addNetworkEventHandler("vrr.chatScrollLines", setChatScrollLines);
+ // Vehicle
+ addNetworkEventHandler("vrr.vehicle", receiveVehicleFromServer);
+ addNetworkEventHandler("vrr.veh.lights", setVehicleLights);
+ addNetworkEventHandler("vrr.veh.engine", setVehicleEngine);
+ addNetworkEventHandler("vrr.veh.repair", repairVehicle);
- addNetworkEventHandler("vrr.radioStream", playStreamingRadio);
- addNetworkEventHandler("vrr.audioFileStream", playAudioFile);
- addNetworkEventHandler("vrr.stopRadioStream", stopStreamingRadio);
- addNetworkEventHandler("vrr.radioVolume", setStreamingRadioVolume);
+ // Radio
+ addNetworkEventHandler("vrr.radioStream", playStreamingRadio);
+ addNetworkEventHandler("vrr.audioFileStream", playAudioFile);
+ addNetworkEventHandler("vrr.stopRadioStream", stopStreamingRadio);
+ addNetworkEventHandler("vrr.radioVolume", setStreamingRadioVolume);
- addNetworkEventHandler("vrr.veh.lights", setVehicleLights);
- addNetworkEventHandler("vrr.veh.engine", setVehicleEngine);
- addNetworkEventHandler("vrr.veh.repair", repairVehicle);
+ // Key Bindings
+ addNetworkEventHandler("vrr.delKeyBind", unBindAccountKey);
+ addNetworkEventHandler("vrr.addKeyBind", bindAccountKey);
+ addNetworkEventHandler("vrr.clearKeyBinds", clearKeyBinds);
- addNetworkEventHandler("vrr.pedAnim", makePedPlayAnimation);
- addNetworkEventHandler("vrr.pedStopAnim", makePedStopAnimation);
- addNetworkEventHandler("vrr.localPlayerSkin", setLocalPlayerSkin);
- addNetworkEventHandler("vrr.forcePedAnim", forcePedAnimation);
- addNetworkEventHandler("vrr.hideAllGUI", hideAllGUI);
- addNetworkEventHandler("vrr.clientInfo", serverRequestedClientInfo);
- addNetworkEventHandler("vrr.interiorLights", updateInteriorLightsState);
+ // Weapon Damage
+ addNetworkEventHandler("vrr.weaponDamageEnabled", setPlayerWeaponDamageEnabled);
+ addNetworkEventHandler("vrr.weaponDamageEvent", setPlayerWeaponDamageEvent);
- addNetworkEventHandler("vrr.syncElement", forceSyncElementProperties);
- addNetworkEventHandler("vrr.elementPosition", setElementPosition);
- addNetworkEventHandler("vrr.elementCollisions", setElementCollisionsEnabled);
+ // 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);
- addNetworkEventHandler("vrr.vehBuyState", setVehiclePurchaseState);
+ // Business
+ addNetworkEventHandler("vrr.business", receiveBusinessFromServer);
- addNetworkEventHandler("vrr.showRegistration", showRegistrationGUI);
- addNetworkEventHandler("vrr.showNewCharacter", showNewCharacterGUI);
- addNetworkEventHandler("vrr.showLogin", showLoginGUI);
+ // House
+ addNetworkEventHandler("vrr.house", receiveHouseFromServer);
- addNetworkEventHandler("vrr.logLevel", setLogLevel);
- addNetworkEventHandler("vrr.infiniteRun", setLocalPlayerInfiniteRun);
+ // GPS
+ addNetworkEventHandler("vrr.showGPSBlip", showGPSLocation);
- addNetworkEventHandler("vrr.business", receiveBusinessFromServer);
- addNetworkEventHandler("vrr.house", receiveHouseFromServer);
+ // Locale
+ addNetworkEventHandler("vrr.locale", setLocale);
+ addNetworkEventHandler("vrr.localeChooser", toggleLocaleChooserGUI);
- addNetworkEventHandler("vrr.holdObject", makePedHoldObject);
-
- addNetworkEventHandler("vrr.playerPedId", sendLocalPlayerNetworkIdToServer);
-
- addNetworkEventHandler("vrr.ped", setLocalPlayerPedPartsAndProps);
+ // 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");
+ sendNetworkEventToServer("vrr.clientReady");
}
// ===========================================================================
function sendResourceStartedSignalToServer() {
- sendNetworkEventToServer("vrr.clientStarted");
+ sendNetworkEventToServer("vrr.clientStarted");
}
// ===========================================================================
function sendResourceStoppedSignalToServer() {
- if(isConnected) {
- sendNetworkEventToServer("vrr.clientStopped");
- }
+ if(isConnected) {
+ sendNetworkEventToServer("vrr.clientStopped");
+ }
}
// ===========================================================================
-function setPlayer2DRendering(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;
+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);
- }
- }
+ 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;
+ renderLabels = labelState;
+ renderSmallGameMessage = smallGameMessageState;
+ renderScoreBoard = scoreboardState;
+ renderHotBar = hotBarState;
+ renderItemActionDelay = itemActionDelayState;
}
// ===========================================================================
-function onServerSpawnedPlayer(state) {
- logToConsole(LOG_DEBUG, `[VRR.Main] Setting spawned state to ${state}`);
- isSpawned = state;
- if(state) {
- setUpInitialGame();
- calledDeathEvent = false;
- }
+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);
+ sendNetworkEventToServer("vrr.useKeyBind", key);
}
// ===========================================================================
function tellServerPlayerArrivedAtJobRouteLocation() {
- sendNetworkEventToServer("vrr.arrivedAtJobRouteLocation");
+ sendNetworkEventToServer("vrr.arrivedAtJobRouteLocation");
}
// ===========================================================================
function tellServerItemActionDelayComplete() {
- sendNetworkEventToServer("vrr.itemActionDelayComplete");
+ 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);
+ 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);
+ sendNetworkEventToServer("vrr.afk", state);
}
// ===========================================================================
@@ -210,109 +264,153 @@ function anchorBoat(vehicleId) {
// ===========================================================================
function setEnterPropertyKey(key) {
- enterPropertyKey = key;
+ enterPropertyKey = key;
}
// ===========================================================================
function serverRequestedClientInfo() {
- sendServerClientInfo();
+ sendServerClientInfo();
}
// ===========================================================================
function updateInteriorLightsState(state) {
- interiorLightsEnabled = state;
+ interiorLightsEnabled = state;
}
// ===========================================================================
function forceSyncElementProperties(elementId) {
- if(getElementFromId(elementId) == null) {
- return false;
- }
+ if(getElementFromId(elementId) == null) {
+ return false;
+ }
- syncElementProperties(getElementFromId(elementId));
-}
-
-// ===========================================================================
-
-function setElementPosition(elementId, position) {
- if(getElementFromId(elementId) == null) {
- return false;
- }
-
- if(!getElementFromId(elementId).isSyncer) {
- return false;
- }
-
- getElementFromId(elementId).position = position;
+ syncElementProperties(getElementFromId(elementId));
}
// ===========================================================================
function setElementCollisionsEnabled(elementId, state) {
- if(getElementFromId(elementId) == null) {
- return false;
- }
+ if(getElementFromId(elementId) == null) {
+ return false;
+ }
- getElementFromId(elementId).collisionsEnabled = state;
+ getElementFromId(elementId).collisionsEnabled = state;
}
// ===========================================================================
function setLocalPlayerArmour(armour) {
- if(typeof localPlayer.armour != "undefined") {
- localPlayer.armour = armour;
- }
+ if(typeof localPlayer.armour != "undefined") {
+ localPlayer.armour = armour;
+ }
}
// ===========================================================================
-function forceLocalPlayerWantedLevel(wantedLevel) {
- forceWantedLevel = toInteger(wantedLevel);
+function setLocalPlayerWantedLevel(wantedLevel) {
+ forceWantedLevel = toInteger(wantedLevel);
}
// ===========================================================================
function setLogLevel(level) {
- logLevel = 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));
- }
- }
+ 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) {
- if(getGame() == VRR_GAME_GTA_IV) {
- natives.changePlayerModel(natives.getPlayerId(), skinId);
- //localPlayer.skin = allowedSkins[skinSelectorIndex][0];
- //localPlayer.modelIndex = allowedSkins[skinSelectorIndex][0];
- } else {
- localPlayer.skin = 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])
- }
+ if(getGame() == VRR_GAME_GTA_IV) {
+ natives.givePedAmbientObject(natives.getPedFromNetworkId(pedId), getGameConfig().objects[getGame()][modelIndex][1])
+ }
}
// ===========================================================================
function sendLocalPlayerNetworkIdToServer() {
- sendNetworkEventToServer("vrr.playerPedId", natives.getNetworkIdFromPed(localPlayer));
+ 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/client/skin-select.js b/scripts/client/skin-select.js
index 2b361383..bc0fd1e9 100644
--- a/scripts/client/skin-select.js
+++ b/scripts/client/skin-select.js
@@ -45,95 +45,111 @@ function loadSkinSelectMessageFontBottom() {
function processSkinSelectKeyPress(keyCode) {
if(usingSkinSelector) {
- if(keyCode == SDLK_PAGEUP) {
- if(skinSelectorIndex >= allowedSkins.length-1) {
- skinSelectorIndex = 1;
- } else {
- skinSelectorIndex = skinSelectorIndex + 1;
- }
- logToConsole(LOG_DEBUG, `Switching to skin ${allowedSkins[skinSelectorIndex][1]} (Index: ${skinSelectorIndex}, Skin: ${allowedSkins[skinSelectorIndex][0]})`);
- skinSelectMessageTextTop = allowedSkins[skinSelectorIndex][1];
- if(getGame() == VRR_GAME_GTA_IV) {
- //natives.changePlayerModel(natives.getPlayerId(), allowedSkins[skinSelectorIndex][0]);
- //localPlayer.skin = allowedSkins[skinSelectorIndex][0];
- //localPlayer.modelIndex = allowedSkins[skinSelectorIndex][0];
- } else {
- localPlayer.skin = allowedSkins[skinSelectorIndex][0];
- }
- } else if(keyCode == SDLK_PAGEDOWN) {
- if(skinSelectorIndex <= 0) {
- skinSelectorIndex = allowedSkins.length-1;
- } else {
- skinSelectorIndex = skinSelectorIndex - 1;
- }
- logToConsole(LOG_DEBUG, `Switching to skin ${allowedSkins[skinSelectorIndex][1]} (Index: ${skinSelectorIndex}, Skin: ${allowedSkins[skinSelectorIndex][0]})`);
- skinSelectMessageTextTop = allowedSkins[skinSelectorIndex][1];
- if(getGame() == VRR_GAME_GTA_IV) {
- //natives.changePlayerModel(natives.getPlayerId(), allowedSkins[skinSelectorIndex][0]);
- //localPlayer.skin = allowedSkins[skinSelectorIndex][0];
- //localPlayer.modelIndex = allowedSkins[skinSelectorIndex][0];
- } else {
- localPlayer.skin = allowedSkins[skinSelectorIndex][0];
- }
- } else if(keyCode == SDLK_RETURN) {
- sendNetworkEventToServer("vrr.skinSelected", skinSelectorIndex);
- toggleSkinSelect(false);
- return true;
- } else if(keyCode == SDLK_BACKSPACE) {
- sendNetworkEventToServer("vrr.skinSelected", -1);
- toggleSkinSelect(false);
- return true;
- }
- localPlayer.heading = skinSelectHeading;
- }
+ if(keyCode == SDLK_PAGEUP) {
+ if(skinSelectorIndex >= allowedSkins.length-1) {
+ skinSelectorIndex = 1;
+ } else {
+ skinSelectorIndex = skinSelectorIndex + 1;
+ }
+ logToConsole(LOG_DEBUG, `Switching to skin ${allowedSkins[skinSelectorIndex][1]} (Index: ${skinSelectorIndex}, Skin: ${allowedSkins[skinSelectorIndex][0]})`);
+ skinSelectMessageTextTop = allowedSkins[skinSelectorIndex][1];
+ if(getGame() == VRR_GAME_GTA_IV) {
+ let skinId = allowedSkins[skinSelectorIndex][0];
+ if(natives.isModelInCdimage(skinId)) {
+ natives.requestModel(skinId);
+ natives.loadAllObjectsNow();
+ if(natives.hasModelLoaded(skinId)) {
+ natives.changePlayerModel(natives.getPlayerId(), skinId);
+ }
+ }
+ } else {
+ localPlayer.skin = allowedSkins[skinSelectorIndex][0];
+ }
+ } else if(keyCode == SDLK_PAGEDOWN) {
+ if(skinSelectorIndex <= 0) {
+ skinSelectorIndex = allowedSkins.length-1;
+ } else {
+ skinSelectorIndex = skinSelectorIndex - 1;
+ }
+ logToConsole(LOG_DEBUG, `Switching to skin ${allowedSkins[skinSelectorIndex][1]} (Index: ${skinSelectorIndex}, Skin: ${allowedSkins[skinSelectorIndex][0]})`);
+ skinSelectMessageTextTop = allowedSkins[skinSelectorIndex][1];
+ if(getGame() == VRR_GAME_GTA_IV) {
+ let skinId = allowedSkins[skinSelectorIndex][0];
+ if(natives.isModelInCdimage(skinId)) {
+ natives.requestModel(skinId);
+ natives.loadAllObjectsNow();
+ if(natives.hasModelLoaded(skinId)) {
+ natives.changePlayerModel(natives.getPlayerId(), skinId);
+ }
+ }
+ } else {
+ localPlayer.skin = allowedSkins[skinSelectorIndex][0];
+ }
+ } else if(keyCode == SDLK_RETURN) {
+ sendNetworkEventToServer("vrr.skinSelected", skinSelectorIndex);
+ toggleSkinSelect(false);
+ return true;
+ } else if(keyCode == SDLK_BACKSPACE) {
+ sendNetworkEventToServer("vrr.skinSelected", -1);
+ toggleSkinSelect(false);
+ return true;
+ }
+ localPlayer.heading = skinSelectHeading;
+ }
}
// ===========================================================================
function processSkinSelectRendering() {
if(usingSkinSelector) {
- if(skinSelectMessageFontTop != null && skinSelectMessageFontBottom != null) {
- if(skinSelectMessageTextTop != "" && skinSelectMessageTextBottom != "") {
- skinSelectMessageFontTop.render(skinSelectMessageTextTop, [0, game.height-100], game.width, 0.5, 0.0, skinSelectMessageFontTop.size, skinSelectMessageColourTop, true, true, false, true);
- skinSelectMessageFontBottom.render(skinSelectMessageTextBottom, [0, game.height-65], game.width, 0.5, 0.0, skinSelectMessageFontBottom.size, skinSelectMessageColourBottom, true, true, false, true);
- }
- }
- }
+ if(skinSelectMessageFontTop != null && skinSelectMessageFontBottom != null) {
+ if(skinSelectMessageTextTop != "" && skinSelectMessageTextBottom != "") {
+ skinSelectMessageFontTop.render(skinSelectMessageTextTop, [0, game.height-100], game.width, 0.5, 0.0, skinSelectMessageFontTop.size, skinSelectMessageColourTop, true, true, false, true);
+ skinSelectMessageFontBottom.render(skinSelectMessageTextBottom, [0, game.height-65], game.width, 0.5, 0.0, skinSelectMessageFontBottom.size, skinSelectMessageColourBottom, true, true, false, true);
+ }
+ }
+ }
}
// ===========================================================================
function toggleSkinSelect(state) {
- if(state) {
- skinSelectorIndex = getAllowedSkinIndexFromSkin(localPlayer.skin);
- if(!skinSelectorIndex) {
- skinSelectorIndex = 0;
- }
+ if(state) {
+ skinSelectorIndex = getAllowedSkinIndexFromSkin(localPlayer.skin);
+ if(!skinSelectorIndex) {
+ skinSelectorIndex = 0;
+ }
- usingSkinSelector = true;
- skinSelectPosition = localPlayer.position;
- skinSelectHeading = localPlayer.heading;
+ usingSkinSelector = true;
+ skinSelectPosition = localPlayer.position;
+ skinSelectHeading = localPlayer.heading;
- if(isCustomCameraSupported()) {
- let tempPosition = localPlayer.position;
- tempPosition.z += 0.5;
- let frontCameraPosition = getPosInFrontOfPos(tempPosition, localPlayer.heading, 3);
- game.setCameraLookAt(frontCameraPosition, localPlayer.position, true);
- }
+ if(isCustomCameraSupported()) {
+ let tempPosition = localPlayer.position;
+ tempPosition.z += 0.5;
+ let frontCameraPosition = getPosInFrontOfPos(tempPosition, localPlayer.heading, 3);
+ game.setCameraLookAt(frontCameraPosition, localPlayer.position, true);
+ }
- if(getGame() == VRR_GAME_GTA_IV) {
- //natives.changePlayerModel(natives.getPlayerId(), allowedSkins[skinSelectorIndex][0]);
- localPlayer.skin = allowedSkins[skinSelectorIndex][0];
- } else {
- localPlayer.skin = allowedSkins[skinSelectorIndex][0];
- }
-
- skinSelectMessageTextTop = allowedSkins[skinSelectorIndex][1];
- setLocalPlayerControlState(false, false);
- } else {
- usingSkinSelector = false;
- setLocalPlayerControlState(false, false);
- }
+ if(getGame() == VRR_GAME_GTA_IV) {
+ let skinId = allowedSkins[skinSelectorIndex][0];
+ if(natives.isModelInCdimage(skinId)) {
+ natives.requestModel(skinId);
+ natives.loadAllObjectsNow();
+ if(natives.hasModelLoaded(skinId)) {
+ natives.changePlayerModel(natives.getPlayerId(), skinId);
+ }
+ }
+ } else {
+ localPlayer.skin = allowedSkins[skinSelectorIndex][0];
+ }
+
+ skinSelectMessageTextTop = allowedSkins[skinSelectorIndex][1];
+ setLocalPlayerControlState(false, false);
+ } else {
+ usingSkinSelector = false;
+ setLocalPlayerControlState(false, false);
+ }
}
// ===========================================================================
\ No newline at end of file
diff --git a/scripts/client/startup.js b/scripts/client/startup.js
index bd38327f..ce4b5c04 100644
--- a/scripts/client/startup.js
+++ b/scripts/client/startup.js
@@ -8,162 +8,192 @@
// ===========================================================================
function initClientScripts() {
- initGUIScript();
- initNameTagScript();
- initScoreBoardScript();
- initMessagingScript();
- initServerScript();
- initLogoScript();
- initLabelScript();
- initChatBoxScript();
- initAFKScript();
- initKeyBindScript();
- initEventScript();
- initSkinSelectScript();
+ initGUIScript();
+ initNameTagScript();
+ initScoreBoardScript();
+ initMessagingScript();
+ initServerScript();
+ initLogoScript();
+ initLabelScript();
+ initChatBoxScript();
+ initAFKScript();
+ initKeyBindScript();
+ initEventScript();
+ initSkinSelectScript();
}
// ===========================================================================
function setUpInitialGame() {
- if(getGame() == VRR_GAME_GTA_III) {
- game.SET_PLAYER_NEVER_GETS_TIRED(game.GET_PLAYER_ID(), 0);
- game.setGameStat(STAT_PROGRESSMADE, 9999);
- game.setGameStat(STAT_TOTALPROGRESSINGAME, 9999);
- game.SET_CAR_DENSITY_MULTIPLIER(3.0);
- game.SET_PED_DENSITY_MULTIPLIER(3.0);
- game.onMission = true;
- SetStandardControlsEnabled(true);
- return true;
- }
+ if(getGame() == VRR_GAME_GTA_III) {
+ logToConsole(LOG_DEBUG|LOG_WARN, "Setting up initial game stuff for GTA III ...");
- if(getGame() == VRR_GAME_GTA_VC) {
- game.SET_PLAYER_NEVER_GETS_TIRED(game.GET_PLAYER_ID(), 0);
- game.setGameStat(STAT_PROGRESSMADE, 9999);
- game.setGameStat(STAT_TOTALPROGRESSINGAME, 9999);
- game.SET_CAR_DENSITY_MULTIPLIER(3.0);
- game.SET_PED_DENSITY_MULTIPLIER(3.0);
+ // Turn off unlimited sprint
+ game.SET_PLAYER_NEVER_GETS_TIRED(game.GET_PLAYER_ID(), 0);
- game.REQUEST_ANIMATION("bikev");
- game.REQUEST_ANIMATION("bikeh");
- game.REQUEST_ANIMATION("biked");
- game.REQUEST_ANIMATION("knife");
- game.REQUEST_ANIMATION("python");
- game.REQUEST_ANIMATION("shotgun");
- game.REQUEST_ANIMATION("buddy");
- game.REQUEST_ANIMATION("tec");
- game.REQUEST_ANIMATION("uzi");
- game.REQUEST_ANIMATION("rifle");
- game.REQUEST_ANIMATION("m60");
- game.REQUEST_ANIMATION("sniper");
- game.REQUEST_ANIMATION("grenade");
- game.REQUEST_ANIMATION("flame");
- game.REQUEST_ANIMATION("medic");
- game.REQUEST_ANIMATION("sunbathe");
- //game.REQUEST_ANIMATION("playidles");
- game.REQUEST_ANIMATION("riot");
- game.REQUEST_ANIMATION("strip");
- game.REQUEST_ANIMATION("lance");
- game.REQUEST_ANIMATION("skate");
+ // Set completed game progress
+ game.setGameStat(STAT_PROGRESSMADE, 9999);
+ game.setGameStat(STAT_TOTALPROGRESSINGAME, 9999);
- game.LOAD_ALL_MODELS_NOW();
- game.onMission = true;
- SetStandardControlsEnabled(true);
- return true;
- }
+ // Traffic and ped density
+ //game.SET_CAR_DENSITY_MULTIPLIER(3.0); // No visual effect. Needs tweaking and testing.
+ //game.SET_PED_DENSITY_MULTIPLIER(3.0); // No visual effect. Needs tweaking and testing.
- if(getGame() == VRR_GAME_GTA_SA) {
- game.setGameStat(STAT_WEAPONTYPE_PISTOL_SKILL, 400);
- game.setGameStat(STAT_WEAPONTYPE_PISTOL_SILENCED_SKILL, 400);
- game.setGameStat(STAT_WEAPONTYPE_DESERT_EAGLE_SKILL, 400);
- game.setGameStat(STAT_WEAPONTYPE_SHOTGUN_SKILL, 400);
- game.setGameStat(STAT_WEAPONTYPE_SAWNOFF_SHOTGUN_SKILL, 400);
- game.setGameStat(STAT_WEAPONTYPE_SPAS12_SHOTGUN_SKILL, 400);
- game.setGameStat(STAT_WEAPONTYPE_MICRO_UZI_SKILL, 400);
- game.setGameStat(STAT_WEAPONTYPE_MP5_SKILL, 400);
- game.setGameStat(STAT_WEAPONTYPE_AK47_SKILL, 400);
- game.setGameStat(STAT_WEAPONTYPE_M4_SKILL, 400);
- game.setGameStat(STAT_DRIVING_SKILL, 9999);
- game.setGameStat(STAT_FAT, 9999);
- game.setGameStat(STAT_ENERGY, 9999);
- game.setGameStat(STAT_CYCLE_SKILL, 9999);
- game.setGameStat(STAT_BIKE_SKILL, 9999);
- game.setGameStat(STAT_GAMBLING, 9999);
- game.setGameStat(STAT_PROGRESS_MADE, 9999);
- game.setGameStat(STAT_RESPECT, 0);
- game.setGameStat(STAT_RESPECT_TOTAL, 0);
- game.setGameStat(STAT_SEX_APPEAL, 0);
- game.setGameStat(STAT_STAMINA, 9999);
- game.setGameStat(STAT_TOTAL_PROGRESS, 9999);
- game.setGameStat(STAT_UNDERWATER_STAMINA, 9999);
- game.setGameStat(STAT_BODY_MUSCLE, 9999);
+ // Disables taxi/vigilante/etc and other start mission triggers
+ game.onMission = true;
- game.setDefaultInteriors(false);
- game.onMission = true;
- return true;
- }
+ // Provided by mouse camera script (mousecam.js)
+ SetStandardControlsEnabled(true);
+ } else if(getGame() == VRR_GAME_GTA_VC) {
+ logToConsole(LOG_DEBUG|LOG_WARN, "Setting up initial game stuff for GTA Vice City ...");
- if(getGame() == VRR_GAME_GTA_IV) {
- natives.allowEmergencyServices(false);
- natives.setCreateRandomCops(true);
- natives.setMaxWantedLevel(0);
- natives.setWantedMultiplier(0.0);
- natives.allowPlayerToCarryNonMissionObjects(natives.getPlayerId(), true);
- natives.setPlayerTeam(natives.getPlayerId(), 0);
- natives.loadAllObjectsNow();
- natives.setCellphoneRanked(false);
- natives.setOverrideNoSprintingOnPhoneInMultiplayer(false);
- natives.setSyncWeatherAndGameTime(false);
- natives.usePlayerColourInsteadOfTeamColour(true);
- natives.disablePauseMenu(true);
- natives.allowReactionAnims(localPlayer, true);
- natives.allowGameToPauseForStreaming(false);
- natives.allowStuntJumpsToTrigger(false);
- natives.setPickupsFixCars(false);
+ // Turn off unlimited sprint
+ game.SET_PLAYER_NEVER_GETS_TIRED(game.GET_PLAYER_ID(), 0);
- // HUD and Display
- //natives.displayCash(false);
- //natives.displayAmmo(false);
- //natives.displayHud(false);
- //natives.displayRadar(false);
- //natives.displayAreaName(false);
- //natives.displayPlayerNames(false);
- natives.setPoliceRadarBlips(false);
- natives.removeTemporaryRadarBlipsForPickups();
- natives.displayNonMinigameHelpMessages(false);
- natives.setDisplayPlayerNameAndIcon(natives.getPlayerId(), false);
+ // Set completed game progress
+ game.setGameStat(STAT_PROGRESSMADE, 99999);
+ game.setGameStat(STAT_TOTALPROGRESSINGAME, 99999);
- // Item/Money Dropping
- natives.setMoneyCarriedByAllNewPeds(0);
- natives.setDeadPedsDropWeapons(false);
- natives.setPlayersDropMoneyInNetworkGame(false);
+ // Traffic and ped density
+ //game.SET_CAR_DENSITY_MULTIPLIER(3.0); // No visual effect. Needs tweaking and testing.
+ //game.SET_PED_DENSITY_MULTIPLIER(3.0); // No visual effect. Needs tweaking and testing.
- // Population
- //natives.dontSuppressAnyCarModels(5.0);
- //natives.dontSuppressAnyPedModels(5.0);
- //natives.forceGenerateParkedCarsTooCloseToOthers(true);
- //natives.setParkedCarDensityMultiplier(5.0);
- //natives.setRandomCarDensityMultiplier(5.0);
- //natives.setPedDensityMultiplier(5.0);
- //natives.setCarDensityMultiplier(5.0);
- //natives.setScenarioPedDensityMultiplier(5.0, 5.0);
- natives.switchRandomTrains(true);
- natives.switchRandomBoats(true);
- natives.switchAmbientPlanes(true);
- natives.switchMadDrivers(false);
+ // Load all anim libs
+ game.REQUEST_ANIMATION("bikev");
+ game.REQUEST_ANIMATION("bikeh");
+ game.REQUEST_ANIMATION("biked");
+ game.REQUEST_ANIMATION("knife");
+ game.REQUEST_ANIMATION("python");
+ game.REQUEST_ANIMATION("shotgun");
+ game.REQUEST_ANIMATION("buddy");
+ game.REQUEST_ANIMATION("tec");
+ game.REQUEST_ANIMATION("uzi");
+ game.REQUEST_ANIMATION("rifle");
+ game.REQUEST_ANIMATION("m60");
+ game.REQUEST_ANIMATION("sniper");
+ game.REQUEST_ANIMATION("grenade");
+ game.REQUEST_ANIMATION("flame");
+ game.REQUEST_ANIMATION("medic");
+ game.REQUEST_ANIMATION("sunbathe");
+ //game.REQUEST_ANIMATION("playidles");
+ game.REQUEST_ANIMATION("riot");
+ game.REQUEST_ANIMATION("strip");
+ game.REQUEST_ANIMATION("lance");
+ game.REQUEST_ANIMATION("skate");
- natives.requestAnims("DANCING");
- return true;
- }
+ //game.LOAD_ALL_MODELS_NOW();
+ // Disables taxi/vigilante/etc and other start mission triggers
+ game.onMission = true;
- if(getGame() == VRR_GAME_MAFIA_ONE) {
- game.mapEnabled = false;
- game.setTrafficEnabled(false);
- return true;
- }
+ // Provided by mouse camera script (mousecam.js)
+ SetStandardControlsEnabled(true);
+ } else if(getGame() == VRR_GAME_GTA_SA) {
+ logToConsole(LOG_DEBUG|LOG_WARN, "Setting up initial game stuff for GTA San Andreas ...");
+ // Turn weapon skills down a bit
+ game.setGameStat(STAT_WEAPONTYPE_PISTOL_SKILL, 400);
+ game.setGameStat(STAT_WEAPONTYPE_PISTOL_SILENCED_SKILL, 400);
+ game.setGameStat(STAT_WEAPONTYPE_DESERT_EAGLE_SKILL, 400);
+ game.setGameStat(STAT_WEAPONTYPE_SHOTGUN_SKILL, 400);
+ game.setGameStat(STAT_WEAPONTYPE_SAWNOFF_SHOTGUN_SKILL, 400);
+ game.setGameStat(STAT_WEAPONTYPE_SPAS12_SHOTGUN_SKILL, 400);
+ game.setGameStat(STAT_WEAPONTYPE_MICRO_UZI_SKILL, 400);
+ game.setGameStat(STAT_WEAPONTYPE_MP5_SKILL, 400);
+ game.setGameStat(STAT_WEAPONTYPE_AK47_SKILL, 400);
+ game.setGameStat(STAT_WEAPONTYPE_M4_SKILL, 400);
+
+ // Pro driving skill
+ game.setGameStat(STAT_DRIVING_SKILL, 9999);
+
+ // Only visual for CJ, but affects all peds fight speed, bicycle hop, etc
+ game.setGameStat(STAT_FAT, 9999);
+ game.setGameStat(STAT_ENERGY, 9999);
+ game.setGameStat(STAT_CYCLE_SKILL, 9999);
+ game.setGameStat(STAT_BIKE_SKILL, 9999);
+ game.setGameStat(STAT_GAMBLING, 9999);
+ game.setGameStat(STAT_PROGRESS_MADE, 9999);
+ game.setGameStat(STAT_RESPECT, 0);
+ game.setGameStat(STAT_RESPECT_TOTAL, 0);
+ game.setGameStat(STAT_SEX_APPEAL, 0);
+ game.setGameStat(STAT_STAMINA, 9999);
+ game.setGameStat(STAT_TOTAL_PROGRESS, 9999);
+ game.setGameStat(STAT_UNDERWATER_STAMINA, 9999);
+ game.setGameStat(STAT_BODY_MUSCLE, 9999);
+
+ // Disables default yellow cone at doors for entering places in singleplayer
+ game.setDefaultInteriors(false);
+
+ // Disables taxi/vigilante/etc and other start mission triggers
+ game.onMission = true;
+ } else if(getGame() == VRR_GAME_GTA_IV) {
+ natives.allowEmergencyServices(false);
+ natives.setCreateRandomCops(true);
+ natives.setMaxWantedLevel(0);
+ natives.setWantedMultiplier(0.0);
+ natives.allowPlayerToCarryNonMissionObjects(natives.getPlayerId(), true);
+ natives.setPlayerTeam(natives.getPlayerId(), 0);
+ natives.loadAllObjectsNow();
+ natives.setCellphoneRanked(false);
+ natives.setOverrideNoSprintingOnPhoneInMultiplayer(false);
+ natives.setSyncWeatherAndGameTime(false);
+ natives.usePlayerColourInsteadOfTeamColour(true);
+ natives.disablePauseMenu(true);
+ //natives.allowReactionAnims(localPlayer, false);
+ natives.allowGameToPauseForStreaming(false);
+ natives.allowStuntJumpsToTrigger(false);
+ natives.setPickupsFixCars(false);
+ natives.forceFullVoice(localPlayer);
+
+ // HUD and Display
+ //natives.displayCash(false);
+ //natives.displayAmmo(false);
+ //natives.displayHud(false);
+ //natives.displayRadar(false);
+ //natives.displayAreaName(false);
+ natives.displayPlayerNames(true);
+ natives.setPoliceRadarBlips(false);
+ natives.removeTemporaryRadarBlipsForPickups();
+ natives.displayNonMinigameHelpMessages(false);
+ natives.setDisplayPlayerNameAndIcon(natives.getPlayerId(), true);
+
+ // Item/Money Dropping
+ natives.setMoneyCarriedByAllNewPeds(0);
+ natives.setDeadPedsDropWeapons(false);
+ natives.setPlayersDropMoneyInNetworkGame(false);
+
+ // Population
+ //natives.dontSuppressAnyCarModels(5.0);
+ //natives.dontSuppressAnyPedModels(5.0);
+ //natives.forceGenerateParkedCarsTooCloseToOthers(true);
+ //natives.setParkedCarDensityMultiplier(5.0);
+ //natives.setRandomCarDensityMultiplier(5.0);
+ //natives.setPedDensityMultiplier(5.0);
+ //natives.setCarDensityMultiplier(5.0);
+ //natives.setScenarioPedDensityMultiplier(5.0, 5.0);
+ natives.switchRandomTrains(true);
+ natives.switchRandomBoats(true);
+ natives.switchAmbientPlanes(true);
+ natives.switchMadDrivers(false);
+
+ // Singleplayer Cellphone
+ //natives.requestScript("spcellphone");
+ //natives.startNewScript("spcellphone", 0);
+ // Script "v-blockedscripts" blocks the mpcellphone scripts
+ natives.setMessagesWaiting(false); // Seems to have no effect
+ natives.setMobilePhoneRadioState(false);
+
+ // Animation libraries
+ natives.requestAnims("DANCING");
+
+ // Some last steps
+ //natives.loadAllObjectsNow();
+ } else if(getGame() == VRR_GAME_MAFIA_ONE) {
+ game.mapEnabled = false;
+ game.setTrafficEnabled(false);
+ }
}
// ===========================================================================
initClientScripts();
-// ===========================================================================
\ No newline at end of file
+// ===========================================================================
diff --git a/scripts/client/sync.js b/scripts/client/sync.js
index 3a2a3704..4c727cec 100644
--- a/scripts/client/sync.js
+++ b/scripts/client/sync.js
@@ -8,430 +8,432 @@
// ===========================================================================
function processSync(event, deltaTime) {
- if(localPlayer != null) {
- if(!areServerElementsSupported()) {
- sendNetworkEventToServer("vrr.plr.pos", localPlayer.position);
- sendNetworkEventToServer("vrr.plr.rot", localPlayer.heading);
+ if(localPlayer != null) {
+ if(!areServerElementsSupported()) {
+ sendNetworkEventToServer("vrr.plr.pos", (localPlayer.vehicle != null) ? localPlayer.vehicle.position : localPlayer.position);
+ sendNetworkEventToServer("vrr.plr.rot", (localPlayer.vehicle != null) ? localPlayer.vehicle.heading : localPlayer.heading);
- //if(localPlayer.vehicle != null) {
- // sendNetworkEventToServer("vrr.veh.pos", getVehicleForNetworkEvent(localPlayer.vehicle), localPlayer.vehicle.position);
- // sendNetworkEventToServer("vrr.veh.rot", getVehicleForNetworkEvent(localPlayer.vehicle), localPlayer.vehicle.heading);
- //}
- }
+ //if(localPlayer.vehicle != null) {
+ // sendNetworkEventToServer("vrr.veh.pos", getVehicleForNetworkEvent(localPlayer.vehicle), localPlayer.vehicle.position);
+ // sendNetworkEventToServer("vrr.veh.rot", getVehicleForNetworkEvent(localPlayer.vehicle), localPlayer.vehicle.heading);
+ //}
+ }
- if(localPlayer.health <= 0) {
- if(!calledDeathEvent) {
- logToConsole(LOG_DEBUG, `Local player died`);
- localPlayer.clearWeapons();
- calledDeathEvent = true;
- sendNetworkEventToServer("vrr.playerDeath");
- }
- }
+ if(localPlayer.health <= 0) {
+ if(!calledDeathEvent) {
+ logToConsole(LOG_DEBUG, `Local player died`);
+ localPlayer.clearWeapons();
+ calledDeathEvent = true;
+ sendNetworkEventToServer("vrr.playerDeath");
+ }
+ }
+ }
- if(streamingRadioElement) {
- streamingRadio.position = getElementPosition(streamingRadioElement);
- //streamingRadio.volume = getStreamingRadioVolumeForPosition(streamingRadio.position);
- }
- }
+ if(localPlayer.health <= 0) {
+ if(!calledDeathEvent) {
+ logToConsole(LOG_DEBUG, `Local player died`);
+ localPlayer.clearWeapons();
+ calledDeathEvent = true;
+ sendNetworkEventToServer("vrr.playerDeath");
+ }
+ }
+
+ if(streamingRadioElement) {
+ streamingRadio.position = getElementPosition(streamingRadioElement.id);
+ //streamingRadio.volume = getStreamingRadioVolumeForPosition(streamingRadio.position);
+ }
}
// ===========================================================================
function setVehicleEngine(vehicleId, state) {
- getElementFromId(vehicleId).engine = state;
+ getElementFromId(vehicleId).engine = state;
}
// ===========================================================================
function setVehicleLights(vehicleId, state) {
-
-
- if(getGame() != VRR_GAME_MAFIA_ONE) {
- if(!state) {
- getElementFromId(vehicleId).lightStatus = 2;
- } else {
- getElementFromId(vehicleId).lightStatus = 1;
- }
- } else if(getGame() == VRR_GAME_GTA_IV) {
- if(!state) {
- natives.forceCarLights(natives.getVehicleFromNetworkId(vehicleId, 0));
- } else {
- natives.forceCarLights(natives.getVehicleFromNetworkId(vehicleId, 1));
- }
- } else {
- if(!state) {
- getElementFromId(vehicleId).lights = false;
- } else {
- getElementFromId(vehicleId).lights = true;
- }
- }
+ if(getGame() != VRR_GAME_MAFIA_ONE) {
+ if(!state) {
+ getElementFromId(vehicleId).lightStatus = 2;
+ } else {
+ getElementFromId(vehicleId).lightStatus = 1;
+ }
+ } else if(getGame() == VRR_GAME_GTA_IV) {
+ if(!state) {
+ natives.forceCarLights(natives.getVehicleFromNetworkId(vehicleId, 0));
+ } else {
+ natives.forceCarLights(natives.getVehicleFromNetworkId(vehicleId, 1));
+ }
+ } else {
+ if(!state) {
+ getElementFromId(vehicleId).lights = false;
+ } else {
+ getElementFromId(vehicleId).lights = true;
+ }
+ }
}
// ===========================================================================
function repairVehicle(syncId) {
- getVehicleFromSyncId(syncId).fix();
+ getVehicleFromSyncId(syncId).fix();
}
// ===========================================================================
function syncVehicleProperties(vehicle) {
- if(!areServerElementsSupported()) {
- return false;
- }
+ if(!areServerElementsSupported()) {
+ return false;
+ }
- if(doesEntityDataExist(vehicle, "vrr.lights")) {
- let lightStatus = getEntityData(vehicle, "vrr.lights");
- if(!lightStatus) {
- vehicle.lightStatus = 2;
- } else {
- vehicle.lightStatus = 1;
- }
- }
+ if(doesEntityDataExist(vehicle, "vrr.lights")) {
+ let lightStatus = getEntityData(vehicle, "vrr.lights");
+ if(!lightStatus) {
+ vehicle.lightStatus = 2;
+ } else {
+ vehicle.lightStatus = 1;
+ }
+ }
- if(doesEntityDataExist(vehicle, "vrr.invincible")) {
- let invincible = getEntityData(vehicle, "vrr.invincible");
- element.setProofs(invincible, invincible, invincible, invincible, invincible);
- }
+ if(doesEntityDataExist(vehicle, "vrr.invincible")) {
+ let invincible = getEntityData(vehicle, "vrr.invincible");
+ element.setProofs(invincible, invincible, invincible, invincible, invincible);
+ }
- if(doesEntityDataExist(vehicle, "vrr.panelStatus")) {
- let panelsStatus = getEntityData(vehicle, "vrr.panelStatus");
- for(let i in panelsStatus) {
- vehicle.setPanelStatus(i, panelsStatus[i]);
- }
- }
+ if(doesEntityDataExist(vehicle, "vrr.panelStatus")) {
+ let panelsStatus = getEntityData(vehicle, "vrr.panelStatus");
+ for(let i in panelsStatus) {
+ vehicle.setPanelStatus(i, panelsStatus[i]);
+ }
+ }
- if(doesEntityDataExist(vehicle, "vrr.wheelStatus")) {
- let wheelsStatus = getEntityData(vehicle, "vrr.wheelStatus");
- for(let i in wheelsStatus) {
- vehicle.setWheelStatus(i, wheelsStatus[i]);
- }
- }
+ if(doesEntityDataExist(vehicle, "vrr.wheelStatus")) {
+ let wheelsStatus = getEntityData(vehicle, "vrr.wheelStatus");
+ for(let i in wheelsStatus) {
+ vehicle.setWheelStatus(i, wheelsStatus[i]);
+ }
+ }
- if(doesEntityDataExist(vehicle, "vrr.lightStatus")) {
- let lightStatus = getEntityData(vehicle, "vrr.lightStatus");
- for(let i in lightStatus) {
- vehicle.setLightStatus(i, lightStatus[i]);
- }
- }
+ if(doesEntityDataExist(vehicle, "vrr.lightStatus")) {
+ let lightStatus = getEntityData(vehicle, "vrr.lightStatus");
+ for(let i in lightStatus) {
+ vehicle.setLightStatus(i, lightStatus[i]);
+ }
+ }
- if(doesEntityDataExist(vehicle, "vrr.suspensionHeight")) {
- let suspensionHeight = getEntityData(vehicle, "vrr.suspensionHeight");
- vehicle.setSuspensionHeight(suspensionHeight);
- }
+ if(doesEntityDataExist(vehicle, "vrr.suspensionHeight")) {
+ let suspensionHeight = getEntityData(vehicle, "vrr.suspensionHeight");
+ vehicle.setSuspensionHeight(suspensionHeight);
+ }
- if(getGame() == VRR_GAME_GTA_SA) {
- let allUpgrades = getGameConfig().vehicleUpgrades[getGame()];
- for(let i in allUpgrades) {
- vehicle.removeUpgrade(i);
- }
+ if(getGame() == VRR_GAME_GTA_SA) {
+ //let allUpgrades = getGameConfig().vehicleUpgrades[getGame()];
+ //for(let i in allUpgrades) {
+ // vehicle.removeUpgrade(i);
+ //}
- if(doesEntityDataExist(vehicle, "vrr.upgrades")) {
- let upgrades = getEntityData(vehicle, "vrr.upgrades");
- for(let i in upgrades) {
- if(upgrades[i] != 0) {
- vehicle.addUpgrade(upgrades[i]);
- }
- }
- }
- }
+ if(doesEntityDataExist(vehicle, "vrr.upgrades")) {
+ let upgrades = getEntityData(vehicle, "vrr.upgrades");
+ for(let i in upgrades) {
+ if(upgrades[i] != 0) {
+ vehicle.addUpgrade(upgrades[i]);
+ }
+ }
+ }
+ }
- if(getGame() == VRR_GAME_GTA_SA || getGame() == VRR_GAME_GTA_IV) {
- if(doesEntityDataExist(vehicle, "vrr.livery")) {
- let livery = getEntityData(vehicle, "vrr.livery");
- if(getGame() == VRR_GAME_GTA_SA) {
- vehicle.setPaintJob(livery);
- } else if(getGame() == VRR_GAME_GTA_IV) {
- vehicle.livery = livery;
- }
- }
- }
+ if(getGame() == VRR_GAME_GTA_SA || getGame() == VRR_GAME_GTA_IV) {
+ if(doesEntityDataExist(vehicle, "vrr.livery")) {
+ let livery = getEntityData(vehicle, "vrr.livery");
+ if(getGame() == VRR_GAME_GTA_SA) {
+ vehicle.setPaintJob(livery);
+ } else if(getGame() == VRR_GAME_GTA_IV) {
+ vehicle.livery = livery;
+ }
+ }
+ }
}
// ===========================================================================
function syncCivilianProperties(civilian) {
- if(!areServerElementsSupported()) {
- return false;
- }
+ if(!areServerElementsSupported()) {
+ return false;
+ }
- if(getGame() == VRR_GAME_GTA_III) {
- if(doesEntityDataExist(civilian, "vrr.scale")) {
- let scaleFactor = getEntityData(civilian, "vrr.scale");
- let tempMatrix = civilian.matrix;
- tempMatrix.setScale(toVector3(scaleFactor.x, scaleFactor.y, scaleFactor.z));
- let tempPosition = civilian.position;
- civilian.matrix = tempMatrix;
- tempPosition.z += scaleFactor.z;
- civilian.position = tempPosition;
- }
- }
+ if(getGame() == VRR_GAME_GTA_III) {
+ if(doesEntityDataExist(civilian, "vrr.scale")) {
+ let scaleFactor = getEntityData(civilian, "vrr.scale");
+ let tempMatrix = civilian.matrix;
+ tempMatrix.setScale(toVector3(scaleFactor.x, scaleFactor.y, scaleFactor.z));
+ let tempPosition = civilian.position;
+ civilian.matrix = tempMatrix;
+ tempPosition.z += scaleFactor.z;
+ civilian.position = tempPosition;
+ }
+ }
- if(getGame() == VRR_GAME_GTA_SA) {
- if(doesEntityDataExist(civilian, "vrr.fightStyle")) {
- let fightStyle = getEntityData(civilian, "vrr.fightStyle");
- civilian.setFightStyle(fightStyle[0], fightStyle[1]);
- }
- }
+ if(getGame() == VRR_GAME_GTA_SA) {
+ if(doesEntityDataExist(civilian, "vrr.fightStyle")) {
+ let fightStyle = getEntityData(civilian, "vrr.fightStyle");
+ civilian.setFightStyle(fightStyle[0], fightStyle[1]);
+ }
+ }
- if(getGame() == VRR_GAME_GTA_III) {
- if(doesEntityDataExist(civilian, "vrr.walkStyle")) {
- let walkStyle = getEntityData(civilian, "vrr.walkStyle");
- civilian.walkStyle = walkStyle;
- }
- }
+ if(getGame() == VRR_GAME_GTA_III) {
+ if(doesEntityDataExist(civilian, "vrr.walkStyle")) {
+ let walkStyle = getEntityData(civilian, "vrr.walkStyle");
+ civilian.walkStyle = walkStyle;
+ }
+ }
- if(getGame() == VRR_GAME_GTA_IV) {
- if(doesEntityDataExist(civilian, "vrr.bodyPropHair")) {
- let bodyPropHair = getEntityData(civilian, "vrr.bodyPropHair");
- civilian.changeBodyProp(0, bodyPropHair[0], bodyPropHair[1]);
- }
+ if(getGame() == VRR_GAME_GTA_IV) {
+ if(doesEntityDataExist(civilian, "vrr.bodyPropHair")) {
+ let bodyPropHair = getEntityData(civilian, "vrr.bodyPropHair");
+ civilian.changeBodyProp(0, bodyPropHair[0], bodyPropHair[1]);
+ }
- if(doesEntityDataExist(civilian, "vrr.bodyPropHead")) {
- let bodyPropHead = getEntityData(civilian, "vrr.bodyPropHead");
- civilian.changeBodyProp(1, bodyPropHead[0], bodyPropHead[1]);
- }
+ if(doesEntityDataExist(civilian, "vrr.bodyPropHead")) {
+ let bodyPropHead = getEntityData(civilian, "vrr.bodyPropHead");
+ civilian.changeBodyProp(1, bodyPropHead[0], bodyPropHead[1]);
+ }
- if(doesEntityDataExist(civilian, "vrr.bodyPropEyes")) {
- let bodyPropEyes = getEntityData(civilian, "vrr.bodyPropEyes");
- civilian.changeBodyProp(1, bodyPropEyes[0], bodyPropEyes[1]);
- }
+ if(doesEntityDataExist(civilian, "vrr.bodyPropEyes")) {
+ let bodyPropEyes = getEntityData(civilian, "vrr.bodyPropEyes");
+ civilian.changeBodyProp(1, bodyPropEyes[0], bodyPropEyes[1]);
+ }
- if(doesEntityDataExist(civilian, "vrr.bodyPropLeftHand")) {
- let bodyPropLeftHand = getEntityData(civilian, "vrr.bodyPropLeftHand");
- civilian.changeBodyProp(1, bodyPropLeftHand[0], bodyPropLeftHand[1]);
- }
+ if(doesEntityDataExist(civilian, "vrr.bodyPropLeftHand")) {
+ let bodyPropLeftHand = getEntityData(civilian, "vrr.bodyPropLeftHand");
+ civilian.changeBodyProp(1, bodyPropLeftHand[0], bodyPropLeftHand[1]);
+ }
- if(doesEntityDataExist(civilian, "vrr.bodyPropRightHand")) {
- let bodyPropRightHand = getEntityData(civilian, "vrr.bodyPropRightHand");
- civilian.changeBodyProp(1, bodyPropRightHand[0], bodyPropRightHand[1]);
- }
+ if(doesEntityDataExist(civilian, "vrr.bodyPropRightHand")) {
+ let bodyPropRightHand = getEntityData(civilian, "vrr.bodyPropRightHand");
+ civilian.changeBodyProp(1, bodyPropRightHand[0], bodyPropRightHand[1]);
+ }
- if(doesEntityDataExist(civilian, "vrr.bodyPropLeftWrist")) {
- let bodyPropLeftWrist = getEntityData(civilian, "vrr.bodyPropLeftWrist");
- civilian.changeBodyProp(1, bodyPropLeftWrist[0], bodyPropLeftWrist[1]);
- }
+ if(doesEntityDataExist(civilian, "vrr.bodyPropLeftWrist")) {
+ let bodyPropLeftWrist = getEntityData(civilian, "vrr.bodyPropLeftWrist");
+ civilian.changeBodyProp(1, bodyPropLeftWrist[0], bodyPropLeftWrist[1]);
+ }
- if(doesEntityDataExist(civilian, "vrr.bodyPropRightWrist")) {
- let bodyPropRightWrist = getEntityData(civilian, "vrr.bodyPropRightWrist");
- civilian.changeBodyProp(1, bodyPropRightWrist[0], bodyPropRightWrist[1]);
- }
+ if(doesEntityDataExist(civilian, "vrr.bodyPropRightWrist")) {
+ let bodyPropRightWrist = getEntityData(civilian, "vrr.bodyPropRightWrist");
+ civilian.changeBodyProp(1, bodyPropRightWrist[0], bodyPropRightWrist[1]);
+ }
- if(doesEntityDataExist(civilian, "vrr.bodyPropRightWrist")) {
- let bodyPropRightWrist = getEntityData(civilian, "vrr.bodyPropRightWrist");
- civilian.changeBodyProp(1, bodyPropRightWrist[0], bodyPropRightWrist[1]);
- }
+ if(doesEntityDataExist(civilian, "vrr.bodyPropRightWrist")) {
+ let bodyPropRightWrist = getEntityData(civilian, "vrr.bodyPropRightWrist");
+ civilian.changeBodyProp(1, bodyPropRightWrist[0], bodyPropRightWrist[1]);
+ }
- if(doesEntityDataExist(civilian, "vrr.bodyPropHip")) {
- let bodyPropHip = getEntityData(civilian, "vrr.bodyPropHip");
- civilian.changeBodyProp(1, bodyPropHip[0], bodyPropHip[1]);
- }
+ if(doesEntityDataExist(civilian, "vrr.bodyPropHip")) {
+ let bodyPropHip = getEntityData(civilian, "vrr.bodyPropHip");
+ civilian.changeBodyProp(1, bodyPropHip[0], bodyPropHip[1]);
+ }
- if(doesEntityDataExist(civilian, "vrr.bodyPropLeftFoot")) {
- let bodyPropLeftFoot = getEntityData(civilian, "vrr.bodyPropLeftFoot");
- civilian.changeBodyProp(1, bodyPropLeftFoot[0], bodyPropLeftFoot[1]);
- }
+ if(doesEntityDataExist(civilian, "vrr.bodyPropLeftFoot")) {
+ let bodyPropLeftFoot = getEntityData(civilian, "vrr.bodyPropLeftFoot");
+ civilian.changeBodyProp(1, bodyPropLeftFoot[0], bodyPropLeftFoot[1]);
+ }
- if(doesEntityDataExist(civilian, "vrr.bodyPropRightFoot")) {
- let bodyPropRightFoot = getEntityData(civilian, "vrr.bodyPropRightFoot");
- civilian.changeBodyProp(1, bodyPropRightFoot[0], bodyPropRightFoot[1]);
- }
- }
+ if(doesEntityDataExist(civilian, "vrr.bodyPropRightFoot")) {
+ let bodyPropRightFoot = getEntityData(civilian, "vrr.bodyPropRightFoot");
+ civilian.changeBodyProp(1, bodyPropRightFoot[0], bodyPropRightFoot[1]);
+ }
+ }
- if(doesEntityDataExist(civilian, "vrr.anim")) {
- let animData = getEntityData(vehicle, "vrr.anim");
- civilian.addAnimation(animData[0], animData[1]);
- }
+ if(doesEntityDataExist(civilian, "vrr.anim")) {
+ let animationSlot = getEntityData(civilian, "vrr.anim");
+ let animationData = getAnimationData(animationSlot);
+ civilian.addAnimation(animationData.groupId, animationData.animId);
+ }
}
// ===========================================================================
function syncPlayerProperties(player) {
- if(!areServerElementsSupported()) {
- return false;
- }
+ if(!areServerElementsSupported()) {
+ return false;
+ }
- if(getGame() == VRR_GAME_GTA_III) {
- if(doesEntityDataExist(player, "vrr.scale")) {
- let scaleFactor = getEntityData(player, "vrr.scale");
- let tempMatrix = player.matrix;
- tempMatrix.setScale(toVector3(scaleFactor.x, scaleFactor.y, scaleFactor.z));
- let tempPosition = player.position;
- player.matrix = tempMatrix;
- tempPosition.z += scaleFactor.z;
- player.position = tempPosition;
- }
- }
+ if(getGame() == VRR_GAME_GTA_III) {
+ if(doesEntityDataExist(player, "vrr.scale")) {
+ let scaleFactor = getEntityData(player, "vrr.scale");
+ let tempMatrix = player.matrix;
+ tempMatrix.setScale(toVector3(scaleFactor.x, scaleFactor.y, scaleFactor.z));
+ let tempPosition = player.position;
+ player.matrix = tempMatrix;
+ tempPosition.z += scaleFactor.z;
+ player.position = tempPosition;
+ }
+ }
- if(getGame() == VRR_GAME_GTA_SA) {
- if(doesEntityDataExist(player, "vrr.fightStyle")) {
- let fightStyle = getEntityData(player, "vrr.fightStyle");
- player.setFightStyle(fightStyle[0], fightStyle[1]);
- }
- }
+ if(getGame() == VRR_GAME_GTA_SA) {
+ if(doesEntityDataExist(player, "vrr.fightStyle")) {
+ let fightStyle = getEntityData(player, "vrr.fightStyle");
+ player.setFightStyle(fightStyle[0], fightStyle[1]);
+ }
+ }
- //if(getGame() == VRR_GAME_GTA_SA) {
- // if(doesEntityDataExist(player, "vrr.walkStyle")) {
- // let walkStyle = getEntityData(player, "vrr.walkStyle");
- // player.walkStyle = walkStyle;
- // }
- //}
+ //if(getGame() == VRR_GAME_GTA_SA) {
+ // if(doesEntityDataExist(player, "vrr.walkStyle")) {
+ // let walkStyle = getEntityData(player, "vrr.walkStyle");
+ // player.walkStyle = walkStyle;
+ // }
+ //}
- if(getGame() == VRR_GAME_GTA_IV) {
- if(doesEntityDataExist(player, "vrr.bodyPartHair")) {
- let bodyPartHead = getEntityData(player, "vrr.bodyPartHair");
- player.changeBodyPart(0, bodyPartHead[0], bodyPartHair[1]);
- }
+ if(getGame() == VRR_GAME_GTA_IV) {
+ if(doesEntityDataExist(player, "vrr.bodyPartHair")) {
+ let bodyPartHead = getEntityData(player, "vrr.bodyPartHair");
+ player.changeBodyPart(0, bodyPartHead[0], bodyPartHair[1]);
+ }
- if(doesEntityDataExist(player, "vrr.bodyPartHead")) {
- let bodyPartHead = getEntityData(player, "vrr.bodyPartHead");
- player.changeBodyPart(1, bodyPartHead[0], bodyPartHead[1]);
- }
+ if(doesEntityDataExist(player, "vrr.bodyPartHead")) {
+ let bodyPartHead = getEntityData(player, "vrr.bodyPartHead");
+ player.changeBodyPart(1, bodyPartHead[0], bodyPartHead[1]);
+ }
- if(doesEntityDataExist(player, "vrr.bodyPartUpper")) {
- let bodyPartUpper = getEntityData(player, "vrr.bodyPartUpper");
- player.changeBodyPart(1, bodyPartUpper[0], bodyPartUpper[1]);
- }
+ if(doesEntityDataExist(player, "vrr.bodyPartUpper")) {
+ let bodyPartUpper = getEntityData(player, "vrr.bodyPartUpper");
+ player.changeBodyPart(1, bodyPartUpper[0], bodyPartUpper[1]);
+ }
- if(doesEntityDataExist(player, "vrr.bodyPartLower")) {
- let bodyPartLower = getEntityData(player, "vrr.bodyPartLower");
- player.changeBodyPart(1, bodyPartLower[0], bodyPartLower[1]);
- }
- }
+ if(doesEntityDataExist(player, "vrr.bodyPartLower")) {
+ let bodyPartLower = getEntityData(player, "vrr.bodyPartLower");
+ player.changeBodyPart(1, bodyPartLower[0], bodyPartLower[1]);
+ }
+ }
- if(getGame() == VRR_GAME_GTA_IV) {
- if(doesEntityDataExist(player, "vrr.bodyPropHair")) {
- let bodyPropHair = getEntityData(player, "vrr.bodyPropHair");
- player.changeBodyProp(0, bodyPropHair[0], bodyPropHair[1]);
- }
+ if(getGame() == VRR_GAME_GTA_IV) {
+ if(doesEntityDataExist(player, "vrr.bodyPropHair")) {
+ let bodyPropHair = getEntityData(player, "vrr.bodyPropHair");
+ player.changeBodyProp(0, bodyPropHair[0], bodyPropHair[1]);
+ }
- if(doesEntityDataExist(player, "vrr.bodyPropHead")) {
- let bodyPropHead = getEntityData(player, "vrr.bodyPropHead");
- player.changeBodyProp(1, bodyPropHead[0], bodyPropHead[1]);
- }
+ if(doesEntityDataExist(player, "vrr.bodyPropHead")) {
+ let bodyPropHead = getEntityData(player, "vrr.bodyPropHead");
+ player.changeBodyProp(1, bodyPropHead[0], bodyPropHead[1]);
+ }
- if(doesEntityDataExist(player, "vrr.bodyPropEyes")) {
- let bodyPropEyes = getEntityData(player, "vrr.bodyPropEyes");
- player.changeBodyProp(1, bodyPropEyes[0], bodyPropEyes[1]);
- }
+ if(doesEntityDataExist(player, "vrr.bodyPropEyes")) {
+ let bodyPropEyes = getEntityData(player, "vrr.bodyPropEyes");
+ player.changeBodyProp(1, bodyPropEyes[0], bodyPropEyes[1]);
+ }
- if(doesEntityDataExist(player, "vrr.bodyPropLeftHand")) {
- let bodyPropLeftHand = getEntityData(player, "vrr.bodyPropLeftHand");
- player.changeBodyProp(1, bodyPropLeftHand[0], bodyPropLeftHand[1]);
- }
+ if(doesEntityDataExist(player, "vrr.bodyPropLeftHand")) {
+ let bodyPropLeftHand = getEntityData(player, "vrr.bodyPropLeftHand");
+ player.changeBodyProp(1, bodyPropLeftHand[0], bodyPropLeftHand[1]);
+ }
- if(doesEntityDataExist(player, "vrr.bodyPropRightHand")) {
- let bodyPropRightHand = getEntityData(player, "vrr.bodyPropRightHand");
- player.changeBodyProp(1, bodyPropRightHand[0], bodyPropRightHand[1]);
- }
+ if(doesEntityDataExist(player, "vrr.bodyPropRightHand")) {
+ let bodyPropRightHand = getEntityData(player, "vrr.bodyPropRightHand");
+ player.changeBodyProp(1, bodyPropRightHand[0], bodyPropRightHand[1]);
+ }
- if(doesEntityDataExist(player, "vrr.bodyPropLeftWrist")) {
- let bodyPropLeftWrist = getEntityData(player, "vrr.bodyPropLeftWrist");
- player.changeBodyProp(1, bodyPropLeftWrist[0], bodyPropLeftWrist[1]);
- }
+ if(doesEntityDataExist(player, "vrr.bodyPropLeftWrist")) {
+ let bodyPropLeftWrist = getEntityData(player, "vrr.bodyPropLeftWrist");
+ player.changeBodyProp(1, bodyPropLeftWrist[0], bodyPropLeftWrist[1]);
+ }
- if(doesEntityDataExist(player, "vrr.bodyPropRightWrist")) {
- let bodyPropRightWrist = getEntityData(player, "vrr.bodyPropRightWrist");
- player.changeBodyProp(1, bodyPropRightWrist[0], bodyPropRightWrist[1]);
- }
+ if(doesEntityDataExist(player, "vrr.bodyPropRightWrist")) {
+ let bodyPropRightWrist = getEntityData(player, "vrr.bodyPropRightWrist");
+ player.changeBodyProp(1, bodyPropRightWrist[0], bodyPropRightWrist[1]);
+ }
- if(doesEntityDataExist(player, "vrr.bodyPropRightWrist")) {
- let bodyPropRightWrist = getEntityData(player, "vrr.bodyPropRightWrist");
- player.changeBodyProp(1, bodyPropRightWrist[0], bodyPropRightWrist[1]);
- }
+ if(doesEntityDataExist(player, "vrr.bodyPropRightWrist")) {
+ let bodyPropRightWrist = getEntityData(player, "vrr.bodyPropRightWrist");
+ player.changeBodyProp(1, bodyPropRightWrist[0], bodyPropRightWrist[1]);
+ }
- if(doesEntityDataExist(player, "vrr.bodyPropHip")) {
- let bodyPropHip = getEntityData(player, "vrr.bodyPropHip");
- player.changeBodyProp(1, bodyPropHip[0], bodyPropHip[1]);
- }
+ if(doesEntityDataExist(player, "vrr.bodyPropHip")) {
+ let bodyPropHip = getEntityData(player, "vrr.bodyPropHip");
+ player.changeBodyProp(1, bodyPropHip[0], bodyPropHip[1]);
+ }
- if(doesEntityDataExist(player, "vrr.bodyPropLeftFoot")) {
- let bodyPropLeftFoot = getEntityData(player, "vrr.bodyPropLeftFoot");
- player.changeBodyProp(1, bodyPropLeftFoot[0], bodyPropLeftFoot[1]);
- }
+ if(doesEntityDataExist(player, "vrr.bodyPropLeftFoot")) {
+ let bodyPropLeftFoot = getEntityData(player, "vrr.bodyPropLeftFoot");
+ player.changeBodyProp(1, bodyPropLeftFoot[0], bodyPropLeftFoot[1]);
+ }
- if(doesEntityDataExist(player, "vrr.bodyPropRightFoot")) {
- let bodyPropRightFoot = getEntityData(player, "vrr.bodyPropRightFoot");
- player.changeBodyProp(1, bodyPropRightFoot[0], bodyPropRightFoot[1]);
- }
- }
-}
-
-// ===========================================================================
-
-function syncObjectProperties(object) {
- if(!areServerElementsSupported()) {
- return false;
- }
-
- if(getGame() == VRR_GAME_GTA_III || getGame() == VRR_GAME_GTA_VC) {
- if(doesEntityDataExist(object, "vrr.scale")) {
- let scaleFactor = getEntityData(object, "vrr.scale");
- let tempMatrix = object.matrix;
- tempMatrix.setScale(toVector3(scaleFactor.x, scaleFactor.y, scaleFactor.z));
- let tempPosition = object.position;
- object.matrix = tempMatrix;
- tempPosition.z += scaleFactor.z;
- object.position = tempPosition;
- }
- }
+ if(doesEntityDataExist(player, "vrr.bodyPropRightFoot")) {
+ let bodyPropRightFoot = getEntityData(player, "vrr.bodyPropRightFoot");
+ player.changeBodyProp(1, bodyPropRightFoot[0], bodyPropRightFoot[1]);
+ }
+ }
}
// ===========================================================================
function syncElementProperties(element) {
- if(!areServerElementsSupported()) {
- return false;
- }
+ if(!areServerElementsSupported()) {
+ return false;
+ }
- if(doesEntityDataExist(element, "vrr.interior")) {
- if(typeof element.interior != "undefined") {
- element.interior = getEntityData(element, "vrr.interior");
- }
- }
+ if(doesEntityDataExist(element, "vrr.interior")) {
+ if(typeof element.interior != "undefined") {
+ element.interior = getEntityData(element, "vrr.interior");
+ }
+ }
- switch(element.type) {
- case ELEMENT_VEHICLE:
- syncVehicleProperties(element);
- break;
+ if(getGame() == VRR_GAME_MAFIA_ONE) {
+ switch(element.type) {
+ case ELEMENT_VEHICLE:
+ syncVehicleProperties(element);
+ break;
- case ELEMENT_PED:
- syncCivilianProperties(element);
- break;
+ case ELEMENT_PED:
+ syncCivilianProperties(element);
+ break;
- case ELEMENT_PLAYER:
- syncPlayerProperties(element);
- break;
+ case ELEMENT_PLAYER:
+ syncPlayerProperties(element);
+ break;
- case ELEMENT_OBJECT:
- syncObjectProperties(element);
- break;
+ default:
+ break;
+ }
+ } else {
+ switch(element.type) {
+ case ELEMENT_VEHICLE:
+ syncVehicleProperties(element);
+ break;
+
+ case ELEMENT_PED:
+ syncCivilianProperties(element);
+ break;
+
+ case ELEMENT_PLAYER:
+ syncPlayerProperties(element);
+ break;
+
+ default:
+ break;
+ }
+ }
- default:
- break;
- }
}
-
-
// ===========================================================================
function receiveHouseFromServer(houseId, entrancePosition, blipModel, pickupModel, hasInterior) {
- if(getGame() == VRR_GAME_GTA_IV) {
-
- }
+ if(getGame() == VRR_GAME_GTA_IV) {
+
+ }
}
// ===========================================================================
function setLocalPlayerPedPartsAndProps(parts, props) {
- for(let i in parts) {
- localPlayer.changeBodyPart(parts[i][0], parts[i][1], parts[i][2]);
- }
+ for(let i in parts) {
+ localPlayer.changeBodyPart(parts[i][0], parts[i][1], parts[i][2]);
+ }
- for(let j in props) {
- localPlayer.changeBodyProp(props[j][0], props[j][1]);
- }
+ for(let j in props) {
+ localPlayer.changeBodyProp(props[j][0], props[j][1]);
+ }
}
// ===========================================================================
\ No newline at end of file
diff --git a/scripts/client/utilities.js b/scripts/client/utilities.js
index 7bb7a926..c692b6d5 100644
--- a/scripts/client/utilities.js
+++ b/scripts/client/utilities.js
@@ -7,254 +7,85 @@
// TYPE: Client (JavaScript)
// ===========================================================================
-let weaponSlots = [
- false,
- [
- 0,
- 1,
- 2,
- 3,
- 4,
- 5,
- 6,
- 7,
- 8,
- 9,
- 10,
- 11
- ],
- [
- 0,
- 0,
- 1,
- 1,
- 1,
- 1,
- 1,
- 1,
- 1,
- 1,
- 1,
- 1,
- 2,
- 2,
- 2,
- 2,
- 2,
- 3,
- 3,
- 4,
- 4,
- 4,
- 5,
- 5,
- 5,
- 5,
- 6,
- 6,
- 8,
- 8,
- 7,
- 7,
- 7,
- 7,
- 9,
- -1,
- 9,
- ],
- [
- 0,
- 1,
- 1,
- 1,
- 1,
- 1,
- 1,
- 1,
- 1,
- 1,
- 1,
- 1,
- 1,
- 1,
- 1,
- 1,
- 8,
- 8,
- 8,
- -1,
- -1,
- -1,
- 2,
- 2,
- 2,
- 3,
- 3,
- 3,
- 4,
- 4,
- 5,
- 5,
- 4,
- 6,
- 6,
- 7,
- 7,
- 7,
- 7,
- 8,
- 12,
- 9,
- 9,
- 9,
- 9,
- 9,
- 11,
- 9,
- 9,
- 9,
- ],
-];
-
-function openAllGarages() {
- switch(game.game) {
- case VRR_GAME_GTA_III:
- for(let i=0;i<=26;i++) {
- openGarage(i);
- game.NO_SPECIAL_CAMERA_FOR_THIS_GARAGE(i);
- }
- break;
-
- case VRR_GAME_GTA_VC:
- for(let i=0;i<=32;i++) {
- openGarage(i);
- game.NO_SPECIAL_CAMERA_FOR_THIS_GARAGE(i);
- }
- break;
-
- case VRR_GAME_GTA_SA:
- for(let i=0;i<=44;i++) {
- openGarage(i);
- }
- break;
-
- default:
- break;
- }
-}
-
-// ===========================================================================
-
-function closeAllGarages() {
- switch(game.game) {
- case VRR_GAME_GTA_III:
- for(let i=0;i<=26;i++) {
- closeGarage(i);
- game.NO_SPECIAL_CAMERA_FOR_THIS_GARAGE(i);
- }
- break;
-
- case VRR_GAME_GTA_VC:
- for(let i=0;i<=32;i++) {
- closeGarage(i);
- game.NO_SPECIAL_CAMERA_FOR_THIS_GARAGE(i);
- }
- break;
-
- case VRR_GAME_GTA_SA:
- for(let i=0;i<=44;i++) {
- closeGarage(i);
- }
- break;
-
- default:
- break;
- }
-}
-
-// ===========================================================================
-
function setLocalPlayerFrozenState(state) {
- logToConsole(LOG_DEBUG, `[VRR.Utilities] Setting frozen state to ${state}`);
- gui.showCursor(state, !state);
+ logToConsole(LOG_DEBUG, `[VRR.Utilities] Setting frozen state to ${state}`);
+ gui.showCursor(state, !state);
}
// ===========================================================================
function setLocalPlayerControlState(controlState, cursorState = false) {
- logToConsole(LOG_DEBUG, `[VRR.Utilities] Setting control state to ${controlState} (Cursor: ${cursorState})`);
- controlsEnabled = controlState;
- if(getGame() == VRR_GAME_GTA_III || getGame() == VRR_GAME_GTA_VC) {
- game.SET_PLAYER_CONTROL(localClient.index, boolToInt(controlState));
- }
-
- if(getGame() != VRR_GAME_GTA_IV) {
- localPlayer.collisionsEnabled = controlState;
- localPlayer.invincible = true;
- }
+ logToConsole(LOG_DEBUG, `[VRR.Utilities] Setting control state to ${controlState} (Cursor: ${cursorState})`);
+ controlsEnabled = controlState;
+ if (getGame() == VRR_GAME_GTA_III || getGame() == VRR_GAME_GTA_VC) {
+ game.SET_PLAYER_CONTROL(game.GET_PLAYER_ID(), boolToInt(controlState));
+ } else if (getGame() != VRR_GAME_GTA_IV) {
+ setElementCollisionsEnabled(localPlayer, controlState);
+ setPedInvincible(localPlayer, true);
+ }
}
// ===========================================================================
function fadeLocalCamera(state, time) {
- if(isFadeCameraSupported()) {
- logToConsole(LOG_DEBUG, `[VRR.Utilities] Fading camera ${(state)?"in":"out"} for ${time} seconds`);
+ if (isFadeCameraSupported()) {
+ logToConsole(LOG_DEBUG, `[VRR.Utilities] Fading camera ${(state) ? "in" : "out"} for ${time} seconds`);
- if(isFadeCameraSupported()) {
- game.fadeCamera(state, time);
- }
- }
+ if (isFadeCameraSupported()) {
+ game.fadeCamera(state, time);
+ }
+ }
}
// ===========================================================================
function removeLocalPlayerFromVehicle() {
- localPlayer.removeFromVehicle();
+ localPlayer.removeFromVehicle();
}
// ===========================================================================
function restoreLocalCamera() {
- logToConsole(LOG_DEBUG, `[VRR.Utilities] Camera restored`);
- if(isCustomCameraSupported()) {
- game.restoreCamera(true);
- }
+ logToConsole(LOG_DEBUG, `[VRR.Utilities] Camera restored`);
+ if (isCustomCameraSupported()) {
+ game.restoreCamera(true);
+ }
};
// ===========================================================================
function clearLocalPlayerOwnedPeds() {
- logToConsole(LOG_DEBUG, `[VRR.Utilities] Clearing all self-owned peds ...`);
- clearSelfOwnedPeds();
- logToConsole(LOG_DEBUG, `[VRR.Utilities] All self-owned peds cleared`);
+ logToConsole(LOG_DEBUG, `[VRR.Utilities] Clearing all self-owned peds ...`);
+ clearSelfOwnedPeds();
+ logToConsole(LOG_DEBUG, `[VRR.Utilities] All self-owned peds cleared`);
};
// ===========================================================================
function setLocalCameraLookAt(cameraPosition, cameraLookAt) {
- logToConsole(LOG_DEBUG, `[VRR.Utilities] Set camera to look at [${cameraLookAt.x}, ${cameraLookAt.y}, ${cameraLookAt.z}] from [${cameraPosition.x}, ${cameraPosition.y}, ${cameraPosition.z}]`);
- if(isCustomCameraSupported()) {
- game.setCameraLookAt(cameraPosition, cameraLookAt, true);
- }
+ logToConsole(LOG_DEBUG, `[VRR.Utilities] Set camera to look at [${cameraLookAt.x}, ${cameraLookAt.y}, ${cameraLookAt.z}] from [${cameraPosition.x}, ${cameraPosition.y}, ${cameraPosition.z}]`);
+ if (isCustomCameraSupported()) {
+ game.setCameraLookAt(cameraPosition, cameraLookAt, true);
+ }
}
// ===========================================================================
function setCityAmbienceState(state, clearElements = false) {
- logToConsole(LOG_DEBUG, `[VRR.Utilities] Ambient civilians and traffic ${(state) ? "enabled" : "disabled"}`);
- game.setTrafficEnabled(state);
+ logToConsole(LOG_DEBUG, `[VRR.Utilities] Ambient civilians and traffic ${(state) ? "enabled" : "disabled"}`);
+ game.setTrafficEnabled(state);
- if(getMultiplayerMod() == VRR_MPMOD_GTAC) {
- game.setGenerateCarsAroundCamera(state);
- if(game.game != VRR_GAME_GTA_SA) {
- game.setCiviliansEnabled(state);
- }
+ if (getMultiplayerMod() == VRR_MPMOD_GTAC) {
+ game.setGenerateCarsAroundCamera(state);
+ if (getGame() != VRR_GAME_GTA_SA) {
+ game.setCiviliansEnabled(state);
+ }
- if(clearElements) {
- clearSelfOwnedPeds();
- clearSelfOwnedVehicles();
- }
- }
+ if (clearElements) {
+ clearSelfOwnedPeds();
+ clearSelfOwnedVehicles();
+ }
+ }
}
// ===========================================================================
@@ -263,482 +94,485 @@ function runClientCode(code, returnTo) {
let returnValue = "Nothing";
try {
returnValue = eval("(" + code + ")");
- } catch(error) {
- sendNetworkEventToServer("vrr.runCodeFail", returnTo, code);
+ } catch (error) {
+ sendNetworkEventToServer("vrr.runCodeFail", returnTo, error.toString());
return false;
- }
- sendNetworkEventToServer("vrr.runCodeSuccess", returnTo, code, returnValue);
+ }
+ let returnValueString = returnValue;
+ if (returnValue != null && returnValue != undefined) {
+ returnValueString = `${returnValue.toString()} (${typeof returnValue})`;
+ } else {
+ returnValueString = "null/undefined";
+ }
+ sendNetworkEventToServer("vrr.runCodeSuccess", returnTo, returnValueString);
}
// ===========================================================================
function enterVehicleAsPassenger() {
- if(localPlayer.vehicle == null) {
+ if (localPlayer.vehicle == null) {
let tempVehicle = getClosestVehicle(localPlayer.position);
- if(getGame() != VRR_GAME_GTA_IV) {
- if(tempVehicle != null) {
- localPlayer.enterVehicle(tempVehicle, false);
- }
- } else {
- for(let i = 0 ; i <= natives.getMaximumNumberOfPassengers(tempVehicle); i++) {
- if(natives.isCarPassengerSeatFree(tempVehicle, i)) {
- natives.taskEnterCarAsPassenger(localPlayer, tempVehicle, i, 1);
- }
- }
- }
+ if (getGame() != VRR_GAME_GTA_IV) {
+ if (tempVehicle != null) {
+ localPlayer.enterVehicle(tempVehicle, false);
+ }
+ } else {
+ // Disable for now. GTA IV has built-in passenger entry
+
+ //for(let i = 0 ; i <= natives.getMaximumNumberOfPassengers(tempVehicle); i++) {
+ // if(natives.isCarPassengerSeatFree(tempVehicle, i)) {
+ // natives.taskEnterCarAsPassenger(localPlayer, tempVehicle, i, 10000);
+ // }
+ //}
+ }
}
}
// ===========================================================================
function giveLocalPlayerWeapon(weaponId, ammo, active) {
- logToConsole(LOG_DEBUG, `[VRR.Utilities] Giving weapon ${weaponId} with ${ammo} ammo`);
- forceWeapon = weaponId;
- if(getGame() == VRR_GAME_MAFIA_ONE) {
- localPlayer.giveWeapon(weaponId, 0, ammo);
- forceWeaponAmmo = 0;
- forceWeaponClipAmmo = ammo;
- } else {
- localPlayer.giveWeapon(weaponId, ammo, active);
- if(getGame() < VRR_GAME_GTA_IV) {
- forceWeaponAmmo = localPlayer.getWeaponAmmunition(getWeaponSlot(weaponId));
- forceWeaponClipAmmo = localPlayer.getWeaponClipAmmunition(getWeaponSlot(weaponId));
- } else {
- forceWeaponAmmo = ammo;
- forceWeaponClipAmmo = ammo;
- }
- }
+ logToConsole(LOG_DEBUG, `[VRR.Utilities] Giving weapon ${weaponId} with ${ammo} ammo`);
+ forceWeapon = weaponId;
+ if (getGame() == VRR_GAME_MAFIA_ONE) {
+ localPlayer.giveWeapon(weaponId, 0, ammo);
+ forceWeaponAmmo = 0;
+ forceWeaponClipAmmo = ammo;
+ } else {
+ localPlayer.giveWeapon(weaponId, ammo, active);
+ if (getGame() < VRR_GAME_GTA_IV) {
+ forceWeaponAmmo = localPlayer.getWeaponAmmunition(getWeaponSlot(weaponId));
+ forceWeaponClipAmmo = localPlayer.getWeaponClipAmmunition(getWeaponSlot(weaponId));
+ } else {
+ forceWeaponAmmo = ammo;
+ forceWeaponClipAmmo = ammo;
+ }
+ }
}
// ===========================================================================
-function clearLocalPlayerWeapons() {
- logToConsole(LOG_DEBUG, `[VRR.Utilities] Clearing weapons`);
- localPlayer.clearWeapons();
- forceWeapon = 0;
- forceWeaponAmmo = 0;
- forceWeaponClipAmmo = 0;
+function clearLocalPlayerWeapons(clearData) {
+ logToConsole(LOG_DEBUG, `[VRR.Utilities] Clearing weapons`);
+ localPlayer.clearWeapons();
+ if (clearData == true) {
+ forceWeapon = 0;
+ forceWeaponAmmo = 0;
+ forceWeaponClipAmmo = 0;
+ }
}
// ===========================================================================
function getClosestVehicle(pos) {
- return getElementsByType(ELEMENT_VEHICLE).reduce((i, j) => (i.position.distance(pos) < j.position.distance(pos)) ? i : j);
+ return getElementsByType(ELEMENT_VEHICLE).reduce((i, j) => (i.position.distance(pos) < j.position.distance(pos)) ? i : j);
}
// ===========================================================================
function setLocalPlayerPosition(position) {
- logToConsole(LOG_DEBUG, `[VRR.Utilities] Setting position to ${position.x}, ${position.y}, ${position.z}`);
- if(typeof localPlayer.velocity != "undefined") {
- localPlayer.velocity = toVector3(0.0, 0.0, 0.0);
- }
+ logToConsole(LOG_DEBUG, `[VRR.Utilities] Setting position to ${position.x}, ${position.y}, ${position.z}`);
+ if (typeof localPlayer.velocity != "undefined") {
+ localPlayer.velocity = toVector3(0.0, 0.0, 0.0);
+ }
- if(typeof localPlayer.position != "undefined") {
- localPlayer.position = position;
- }
+ if (typeof localPlayer.position != "undefined") {
+ localPlayer.position = position;
+ }
}
// ===========================================================================
function setLocalPlayerHeading(heading) {
- logToConsole(LOG_DEBUG, `[VRR.Utilities] Setting heading to ${heading}`);
- if(typeof localPlayer.heading != "undefined") {
- localPlayer.heading = heading;
- }
+ logToConsole(LOG_DEBUG, `[VRR.Utilities] Setting heading to ${heading}`);
+ if (typeof localPlayer.heading != "undefined") {
+ localPlayer.heading = heading;
+ }
}
// ===========================================================================
function setLocalPlayerInterior(interior) {
- logToConsole(LOG_DEBUG, `[VRR.Utilities] Setting interior to ${interior}`);
- if(getMultiplayerMod() == VRR_MPMOD_GTAC) {
- if(!isGTAIV()) {
- localPlayer.interior = interior;
- game.cameraInterior = interior;
- } else {
- let interiorId = natives.getInteriorAtCoords(localPlayer.position);
- natives.activateInterior(interiorId, true);
- }
- }
+ logToConsole(LOG_DEBUG, `[VRR.Utilities] Setting interior to ${interior}`);
+ if (getMultiplayerMod() == VRR_MPMOD_GTAC) {
+ if (!isGTAIV()) {
+ localPlayer.interior = interior;
+ game.cameraInterior = interior;
+ } //else {
+ //if(getGameConfig().mainWorldInterior != interior) {
+ // let interiorId = natives.getInteriorAtCoords(localPlayer.position);
+ // natives.activateInterior(interiorId, true);
+ // natives.loadAllObjectsNow();
+ //}
+ //let interiorId = natives.getInteriorAtCoords(localPlayer.position);
+ //natives.activateInterior(interiorId, true);
+ //}
+ }
- //let vehicles = getElementsByType(ELEMENT_VEHICLE);
- //for(let i in vehicles) {
- // if(getEntityData(vehicles[i], "vrr.interior")) {
- // vehicles[i].interior = getEntityData(vehicles[i], "vrr.interior");
- // }
- //}
+ if (areServerElementsSupported() && isGameFeatureSupported("interior")) {
+ let vehicles = getElementsByType(ELEMENT_VEHICLE);
+ for (let i in vehicles) {
+ if (getEntityData(vehicles[i], "vrr.interior")) {
+ vehicles[i].interior = getEntityData(vehicles[i], "vrr.interior");
+ }
+ }
+ }
}
// ===========================================================================
function setSnowState(falling, ground) {
- logToConsole(LOG_DEBUG, `[VRR.Utilities] Setting falling snow to ${falling} and ground snow to ${ground}`);
- snowing = falling;
- if(ground) {
- forceSnowing(false);
- forceSnowing(ground);
- }
+ logToConsole(LOG_DEBUG, `[VRR.Utilities] Setting falling snow to ${falling} and ground snow to ${ground}`);
+ snowing = falling;
+ if (ground) {
+ forceSnowing(false);
+ forceSnowing(ground);
+ }
}
// ===========================================================================
function setLocalPlayerHealth(health) {
- localPlayer.health = health;
-}
-
-// ===========================================================================
-
-function isSnowEnabled() {
- return (typeof snowing != "undefined");
+ localPlayer.health = health;
}
// ===========================================================================
function playPedSpeech(pedName, speechId) {
- logToConsole(LOG_DEBUG, `[VRR.Utilities] Making ${pedName}'s ped talk (${speechId})`);
- if(getMultiplayerMod() == VRR_MPMOD_GTAC) {
- game.SET_CHAR_SAY(int, int);
- }
+ logToConsole(LOG_DEBUG, `[VRR.Utilities] Making ${pedName}'s ped talk (${speechId})`);
+ if (getMultiplayerMod() == VRR_MPMOD_GTAC) {
+ game.SET_CHAR_SAY(int, int);
+ }
}
// ===========================================================================
function clearLocalPedState() {
- logToConsole(LOG_DEBUG, `[VRR.Utilities] Clearing local ped state`);
- localPlayer.clearObjective();
+ logToConsole(LOG_DEBUG, `[VRR.Utilities] Clearing local ped state`);
+ localPlayer.clearObjective();
}
// ===========================================================================
function getWeaponSlot(weaponId) {
- if(getGame() == VRR_GAME_GTA_IV) {
- return false;
- }
-
- return weaponSlots[getGame()][weaponId];
+ return getGameConfig().weaponSlots[getGame()][weaponId];
}
// ===========================================================================
function setLocalPlayerDrunkEffect(amount, duration) {
- if(getMultiplayerMod() == VRR_MPMOD_GTAC) {
- logToConsole(LOG_DEBUG, `[VRR.Utilities] Drunk effect set to ${amount} for ${duration}ms`);
- drunkEffectAmount = 0;
- drunkEffectDurationTimer = setInterval(function() {
- drunkEffectAmount = drunkEffectAmount;
- if(drunkEffectAmount > 0) {
- //game.SET_MOTION_BLUR(drunkEffectAmount);
- game.SET_PLAYER_DRUNKENNESS(drunkEffectAmount, duration);
- } else {
- clearInterval(drunkEffectDurationTimer);
- drunkEffectDurationTimer = null;
- }
- }, 1000);
- }
+ if (getMultiplayerMod() == VRR_MPMOD_GTAC) {
+ logToConsole(LOG_DEBUG, `[VRR.Utilities] Drunk effect set to ${amount} for ${duration} ms`);
+ drunkEffectAmount = 0;
+ drunkEffectDurationTimer = setInterval(function () {
+ drunkEffectAmount = drunkEffectAmount;
+ if (drunkEffectAmount > 0) {
+ //game.SET_MOTION_BLUR(drunkEffectAmount);
+ game.SET_PLAYER_DRUNKENNESS(drunkEffectAmount, duration);
+ } else {
+ clearInterval(drunkEffectDurationTimer);
+ drunkEffectDurationTimer = null;
+ }
+ }, 1000);
+ }
}
// ===========================================================================
function getLocalPlayerVehicleSeat() {
- for(let i = 0 ; i <= 4 ; i++) {
- if(localPlayer.vehicle.getOccupant(i) == localPlayer) {
- return i;
- }
- }
+ for (let i = 0; i <= 4; i++) {
+ if (localPlayer.vehicle.getOccupant(i) == localPlayer) {
+ return i;
+ }
+ }
}
// ===========================================================================
function clearSelfOwnedPeds() {
- logToConsole(LOG_DEBUG, `Clearing self-owned peds`);
- getElementsByType(ELEMENT_PED).forEach(function(ped) {
- //if(ped.isOwner) {
- destroyElement(ped);
- //}
- });
+ logToConsole(LOG_DEBUG, `Clearing self-owned peds`);
+ getElementsByType(ELEMENT_PED).forEach(function (ped) {
+ //if(ped.isOwner) {
+ destroyElement(ped);
+ //}
+ });
}
// ===========================================================================
function clearSelfOwnedVehicles() {
- logToConsole(LOG_DEBUG, `Clearing self-owned vehicles`);
- getElementsByType(ELEMENT_VEHICLE).forEach(function(vehicle) {
- //if(vehicle.isOwner) {
- destroyElement(vehicle);
- //}
- });
+ logToConsole(LOG_DEBUG, `Clearing self-owned vehicles`);
+ getElementsByType(ELEMENT_VEHICLE).forEach(function (vehicle) {
+ //if(vehicle.isOwner) {
+ destroyElement(vehicle);
+ //}
+ });
}
// ===========================================================================
function setMouseCameraState(state) {
- logToConsole(LOG_DEBUG, `[VRR.Utilities] ${(state)?"Enabled":"Disabled"} mouse camera`);
- mouseCameraEnabled = state;
- SetStandardControlsEnabled(!mouseCameraEnabled);
+ logToConsole(LOG_DEBUG, `[VRR.Utilities] ${(state) ? "Enabled" : "Disabled"} mouse camera`);
+ mouseCameraEnabled = state;
+ SetStandardControlsEnabled(!mouseCameraEnabled);
}
// ===========================================================================
function toggleMouseCursor() {
- logToConsole(LOG_DEBUG, `[VRR.Utilities] ${(!gui.cursorEnabled)?"Enabled":"Disabled"} mouse cursor`);
- gui.showCursor(!gui.cursorEnabled, gui.cursorEnabled);
+ logToConsole(LOG_DEBUG, `[VRR.Utilities] ${(!gui.cursorEnabled) ? "Enabled" : "Disabled"} mouse cursor`);
+ gui.showCursor(!gui.cursorEnabled, gui.cursorEnabled);
}
// ===========================================================================
function toggleMouseCursor() {
- logToConsole(LOG_DEBUG, `[VRR.Utilities] ${(!gui.cursorEnabled)?"Enabled":"Disabled"} mouse cursor`);
- setMouseCameraState(!mouseCameraEnabled);
+ logToConsole(LOG_DEBUG, `[VRR.Utilities] ${(!gui.cursorEnabled) ? "Enabled" : "Disabled"} mouse cursor`);
+ setMouseCameraState(!mouseCameraEnabled);
}
// ===========================================================================
function setPlayerWeaponDamageEvent(clientName, eventType) {
- logToConsole(LOG_DEBUG, `[VRR.Utilities] Set ${clientName} damage event type to ${eventType}`);
- weaponDamageEvent[clientName] = eventType;
+ logToConsole(LOG_DEBUG, `[VRR.Utilities] Set ${clientName} damage event type to ${eventType}`);
+ weaponDamageEvent[clientName] = eventType;
}
// ===========================================================================
function setPlayerWeaponDamageEnabled(clientName, state) {
- logToConsole(LOG_DEBUG, `[VRR.Utilities] ${(state)?"Enabled":"Disabled"} damage from ${clientName}`);
- weaponDamageEnabled[clientName] = state;
+ logToConsole(LOG_DEBUG, `[VRR.Utilities] ${(state) ? "Enabled" : "Disabled"} damage from ${clientName}`);
+ weaponDamageEnabled[clientName] = state;
}
// ===========================================================================
function setLocalPlayerCash(amount) {
- logToConsole(LOG_DEBUG, `[VRR.Utilities] Setting local player money`);
- if(typeof localPlayer.money != "undefined") {
- localPlayer.money = toInteger(amount);
- }
+ logToConsole(LOG_DEBUG, `[VRR.Utilities] Setting local player money`);
+ if (typeof localPlayer.money != "undefined") {
+ localPlayer.money = toInteger(amount);
+ }
- if(getGame() == VRR_GAME_GTA_IV) {
- natives.setMultiplayerHudCash(amount);
- }
+ if (getGame() == VRR_GAME_GTA_IV) {
+ natives.setMultiplayerHudCash(amount);
+ }
}
// ===========================================================================
function destroyAutoCreatedPickups() {
- if(typeof ELEMENT_PICKUP != "undefined") {
- getElementsByType(ELEMENT_PICKUP).forEach(function(pickup) {
- if(pickup.isOwner) {
- destroyElement(pickup);
- }
- });
- }
+ if (typeof ELEMENT_PICKUP != "undefined") {
+ getElementsByType(ELEMENT_PICKUP).forEach(function (pickup) {
+ if (pickup.isOwner) {
+ destroyElement(pickup);
+ }
+ });
+ }
}
// ===========================================================================
function processLocalPlayerControlState() {
- if(localPlayer == null) {
- return false;
- }
+ if (localPlayer == null) {
+ return false;
+ }
- if(isSpawned) {
- return false;
- }
+ if (isSpawned) {
+ return false;
+ }
- if(!controlsEnabled) {
- clearLocalPedState();
- }
+ if (!controlsEnabled) {
+ clearLocalPedState();
+ }
}
// ===========================================================================
function processWantedLevelReset() {
- if(localPlayer == null) {
- return false;
- }
+ if (localPlayer == null) {
+ return false;
+ }
- if(!isSpawned) {
- return false;
- }
+ if (!isSpawned) {
+ return false;
+ }
- if(typeof localPlayer.wantedLevel != "undefined") {
- localPlayer.wantedLevel = forceWantedLevel;
- }
+ if (typeof localPlayer.wantedLevel != "undefined") {
+ localPlayer.wantedLevel = forceWantedLevel;
+ }
}
// ===========================================================================
function processLocalPlayerVehicleControlState() {
- if(areServerElementsSupported()) {
- if(inVehicle && localPlayer.vehicle != null) {
- if(getEntityData(localPlayer.vehicle, "vrr.engine") == false) {
- localPlayer.vehicle.engine = false;
- }
+ if (areServerElementsSupported()) {
+ if (inVehicle && localPlayer.vehicle != null) {
+ if (doesEntityDataExist(localPlayer.vehicle, "vrr.engine")) {
+ if (getEntityData(localPlayer.vehicle, "vrr.engine") == false) {
+ localPlayer.vehicle.engine = false;
+ if (!localPlayer.vehicle.engine) {
+ if (typeof localPlayer.vehicle.velocity != "undefined") {
+ localPlayer.vehicle.velocity = toVector3(0.0, 0.0, 0.0);
+ localPlayer.vehicle.turnVelocity = toVector3(0.0, 0.0, 0.0);
+ }
- if(!localPlayer.vehicle.engine) {
- if(typeof localPlayer.vehicle.velocity != "undefined") {
- localPlayer.vehicle.velocity = toVector3(0.0, 0.0, 0.0);
- localPlayer.vehicle.turnVelocity = toVector3(0.0, 0.0, 0.0);
- }
-
- if(parkedVehiclePosition) {
- localPlayer.vehicle.position = parkedVehiclePosition;
- localPlayer.vehicle.heading = parkedVehicleHeading;
- }
- } else {
- if(parkedVehiclePosition) {
- parkedVehiclePosition = false;
- parkedVehicleHeading = false;
- }
- }
- }
- }
+ //if(parkedVehiclePosition) {
+ // localPlayer.vehicle.position = parkedVehiclePosition;
+ // localPlayer.vehicle.heading = parkedVehicleHeading;
+ //}
+ }
+ }
+ }
+ }
+ }
}
// ===========================================================================
function processLocalPlayerSphereEntryExitHandling() {
- let position = getLocalPlayerPosition();
+ let position = getLocalPlayerPosition();
- if(areMarkersSupported()) {
- getElementsByType(ELEMENT_MARKER).forEach(function(sphere) {
- if(getDistance(position, sphere.position) <= sphere.radius) {
- if(!inSphere) {
- inSphere = sphere;
- triggerEvent("OnLocalPlayerEnterSphere", null, sphere);
- }
- } else {
- if(inSphere) {
- inSphere = false;
- triggerEvent("OnLocalPlayerExitSphere", null, sphere);
- }
- }
- });
- }
+ if (areMarkersSupported()) {
+ getElementsByType(ELEMENT_MARKER).forEach(function (sphere) {
+ if (getDistance(position, sphere.position) <= sphere.radius) {
+ if (!inSphere) {
+ inSphere = sphere;
+ triggerEvent("OnLocalPlayerEnterSphere", null, sphere);
+ }
+ } else {
+ if (inSphere) {
+ inSphere = false;
+ triggerEvent("OnLocalPlayerExitSphere", null, sphere);
+ }
+ }
+ });
+ }
}
// ===========================================================================
function processJobRouteSphere() {
- if(game.game == VRR_GAME_GTA_SA) {
- let position = getLocalPlayerPosition();
- if(jobRouteLocationSphere != null) {
- if(getDistance(position, jobRouteLocationSphere.position) <= 2.0) {
- enteredJobRouteSphere();
- }
- }
- }
+ if (getGame() == VRR_GAME_GTA_SA) {
+ let position = getLocalPlayerPosition();
+ if (jobRouteLocationSphere != null) {
+ if (getDistance(position, jobRouteLocationSphere.position) <= 2.0) {
+ enteredJobRouteSphere();
+ }
+ }
+ }
}
// ===========================================================================
function forceLocalPlayerEquippedWeaponItem() {
- if(typeof localPlayer.weapon != "undefined") {
- if(forceWeapon != 0) {
- if(localPlayer.weapon != forceWeapon) {
- localPlayer.weapon = forceWeapon;
- if(getGame() < VRR_GAME_GTA_IV) {
- localPlayer.setWeaponClipAmmunition(getWeaponSlot(forceWeapon), forceWeaponClipAmmo);
- localPlayer.setWeaponAmmunition(getWeaponSlot(forceWeapon), forceWeaponAmmo);
- }
- } else {
- if(getGame() < VRR_GAME_GTA_IV) {
- forceWeaponClipAmmo = localPlayer.getWeaponClipAmmunition(getWeaponSlot(forceWeapon));
- forceWeaponAmmo = localPlayer.getWeaponAmmunition(getWeaponSlot(forceWeapon));
- }
- }
- } else {
- if(localPlayer.weapon > 0) {
- localPlayer.clearWeapons();
- }
- }
- }
+ if (typeof localPlayer.weapon != "undefined") {
+ if (forceWeapon != 0) {
+ if (localPlayer.weapon != forceWeapon) {
+ localPlayer.weapon = forceWeapon;
+ if (getGame() < VRR_GAME_GTA_IV) {
+ localPlayer.setWeaponClipAmmunition(getWeaponSlot(forceWeapon), forceWeaponClipAmmo);
+ localPlayer.setWeaponAmmunition(getWeaponSlot(forceWeapon), forceWeaponAmmo);
+ }
+ } else {
+ //if(getGame() < VRR_GAME_GTA_IV) {
+ // forceWeaponClipAmmo = localPlayer.getWeaponClipAmmunition(getWeaponSlot(forceWeapon));
+ // forceWeaponAmmo = localPlayer.getWeaponAmmunition(getWeaponSlot(forceWeapon));
+ //}
+ }
+ } else {
+ if (localPlayer.weapon > 0) {
+ localPlayer.clearWeapons();
+ }
+ }
+ }
}
// ===========================================================================
function getLocalPlayerPosition() {
- let position = localPlayer.position;
- if(localPlayer.vehicle) {
- position = localPlayer.vehicle.position;
- }
+ let position = localPlayer.position;
+ if (localPlayer.vehicle) {
+ position = localPlayer.vehicle.position;
+ }
- return position;
+ return position;
}
// ===========================================================================
function processLocalPlayerVehicleEntryExitHandling() {
- if(localPlayer.vehicle) {
- if(!inVehicle) {
- inVehicle = localPlayer.vehicle;
- inVehicleSeat = getLocalPlayerVehicleSeat();
- triggerEvent("OnLocalPlayerEnteredVehicle", inVehicle, inVehicleSeat);
- }
- } else {
- if(inVehicle) {
- triggerEvent("OnLocalPlayerExitedVehicle", inVehicle, inVehicleSeat);
- inVehicle = false;
- inVehicleSeat = false;
- }
- }
+ if (localPlayer.vehicle) {
+ if (!inVehicle) {
+ inVehicle = localPlayer.vehicle;
+ inVehicleSeat = getLocalPlayerVehicleSeat();
+ triggerEvent("OnLocalPlayerEnteredVehicle", inVehicle, inVehicleSeat);
+ }
+ } else {
+ if (inVehicle) {
+ triggerEvent("OnLocalPlayerExitedVehicle", inVehicle, inVehicleSeat);
+ inVehicle = false;
+ inVehicleSeat = false;
+ }
+ }
}
// ===========================================================================
function getVehicleForNetworkEvent(vehicle) {
- if(getGame() == VRR_GAME_GTA_IV) {
- return natives.getNetworkIdFromVehicle(vehicle);
- }
- return vehicle;
+ if (getGame() == VRR_GAME_GTA_IV) {
+ return natives.getNetworkIdFromVehicle(vehicle);
+ }
+ return vehicle.id;
}
// ===========================================================================
function setMinuteDuration(minuteDuration) {
- logToConsole(LOG_DEBUG, `[VRR.Utilities] Setting minute duration to ${minuteDuration}ms`);
+ logToConsole(LOG_DEBUG, `[VRR.Utilities] Setting minute duration to ${minuteDuration}ms`);
- if(isTimeSupported()) {
- game.time.minuteDuration = minuteDuration;
- }
+ if (isTimeSupported()) {
+ game.time.minuteDuration = minuteDuration;
+ }
}
// ===========================================================================
function getStreamingRadioVolumeForPosition(position) {
- return streamingRadioVolume;
+ return streamingRadioVolume;
}
// ===========================================================================
function getLocalPlayerLookAtPosition() {
- if(localPlayer != null) {
- let centerCameraPos = getWorldFromScreenPosition(toVector3(game.width/2, game.height/2, 0));
- return getWorldFromScreenPosition(toVector3(game.width/2, game.height/2, getDistance(centerCameraPos, localPlayer.position)+20));
+ if (localPlayer != null) {
+ let centerCameraPos = getWorldFromScreenPosition(toVector3(game.width / 2, game.height / 2, 0));
+ return getWorldFromScreenPosition(toVector3(game.width / 2, game.height / 2, getDistance(centerCameraPos, localPlayer.position) + 20));
}
}
// ===========================================================================
function processInteriorLightsRendering() {
- if(renderInteriorLights) {
- if(!interiorLightsEnabled) {
- graphics.drawRectangle(null, toVector2(0.0, 0.0), toVector2(game.width, game.height), interiorLightsColour, interiorLightsColour, interiorLightsColour, interiorLightsColour);
- }
- }
+ if (renderInteriorLights) {
+ if (!interiorLightsEnabled) {
+ graphics.drawRectangle(null, toVector2(0.0, 0.0), toVector2(game.width, game.height), interiorLightsColour, interiorLightsColour, interiorLightsColour, interiorLightsColour);
+ }
+ }
}
// ===========================================================================
function getPlayerFromParams(params) {
let clients = getClients();
- if(isNaN(params)) {
- for(let i in clients) {
- if(!clients[i].console) {
- if(toLowerCase(clients[i].name).indexOf(toLowerCase(params)) != -1) {
+ if (isNaN(params)) {
+ for (let i in clients) {
+ if (!clients[i].console) {
+ if (toLowerCase(clients[i].name).indexOf(toLowerCase(params)) != -1) {
return clients[i];
}
}
}
} else {
- if(typeof clients[toInteger(params)] != "undefined") {
+ if (typeof clients[toInteger(params)] != "undefined") {
return clients[toInteger(params)];
}
}
@@ -749,65 +583,35 @@ function getPlayerFromParams(params) {
// ===========================================================================
function processNearbyPickups() {
- if(typeof ELEMENT_PICKUP != "undefined") {
- let pickups = getElementsByType(ELEMENT_PICKUP);
- for(let i in pickups) {
- if(getDistance(pickups[i].position, localPlayer.position) < 5) {
- //if(pickups[i].interior == localPlayer.interior && pickups[i].dimension == localPlayer.dimension) {
- if(currentPickup != pickups[i]) {
- currentPickup = pickups[i];
- sendNetworkEventToServer("vrr.pickup", pickups[i].id);
- }
- //}
- }
- }
- }
+ if (typeof ELEMENT_PICKUP != "undefined") {
+ let pickups = getElementsByType(ELEMENT_PICKUP);
+ for (let i in pickups) {
+ if (getDistance(pickups[i].position, localPlayer.position) < 5) {
+ //if(pickups[i].interior == localPlayer.interior && pickups[i].dimension == localPlayer.dimension) {
+ if (currentPickup != pickups[i]) {
+ currentPickup = pickups[i];
+ sendNetworkEventToServer("vrr.pickup", pickups[i].id);
+ }
+ //}
+ }
+ }
+ }
}
// ===========================================================================
function processGameSpecifics() {
- if(game.game < VRR_GAME_GTA_IV) {
- game.clearMessages();
- }
+ if (getGame() < VRR_GAME_GTA_IV) {
+ game.clearMessages();
+ }
- destroyAutoCreatedPickups();
+ destroyAutoCreatedPickups();
}
// ===========================================================================
-function processVehiclePurchasing() {
- if(vehiclePurchaseState == VRR_VEHBUYSTATE_TESTDRIVE) {
- if(inVehicle == false) {
- vehiclePurchaseState = VRR_VEHBUYSTATE_EXITVEH;
- sendNetworkEventToServer("vrr.vehBuyState", VRR_VEHBUYSTATE_EXITVEH);
- return false;
- } else {
- if(vehiclePurchasing == inVehicle) {
- if(getDistance(inVehicle.position, vehiclePurchasePosition) >= 25) {
- vehiclePurchaseState = VRR_VEHBUYSTATE_FARENOUGH;
- sendNetworkEventToServer("vrr.vehBuyState", VRR_VEHBUYSTATE_FARENOUGH);
- }
- } else {
- vehiclePurchaseState = VRR_VEHBUYSTATE_WRONGVEH;
- sendNetworkEventToServer("vrr.vehBuyState", VRR_VEHBUYSTATE_WRONGVEH);
- }
- }
- }
-}
-
-// ===========================================================================
-
-function setVehiclePurchaseState(state, vehicleId, position) {
- vehiclePurchaseState = state;
-
- if(vehicleId != null) {
- vehiclePurchasing = getElementFromId(vehicleId);
- } else {
- vehiclePurchasing = null;
- }
-
- vehiclePurchasePosition = position;
+function getServerData() {
+ return serverData;
}
// ===========================================================================
\ No newline at end of file
diff --git a/scripts/client/vehicle.js b/scripts/client/vehicle.js
new file mode 100644
index 00000000..3011f195
--- /dev/null
+++ b/scripts/client/vehicle.js
@@ -0,0 +1,131 @@
+// ===========================================================================
+// Vortrex's Roleplay Resource
+// https://github.com/VortrexFTW/gtac_roleplay
+// ===========================================================================
+// FILE: vehicle.js
+// DESC: Provides vehicle functions and arrays with data
+// TYPE: Client (JavaScript)
+// ===========================================================================
+
+class VehicleData {
+ constructor(vehicleId, model, position, heading, colour1, colour2, colour3, colour4, locked, lights, engine, licensePlate) {
+ this.index = -1;
+ this.vehicleId = vehicleId;
+ this.model = model;
+ this.position = position;
+ this.heading = heading;
+ this.colour1 = colour1;
+ this.colour2 = colour2;
+ this.colour3 = colour3;
+ this.colour4 = colour4;
+ this.pickupModel = pickupModel;
+ this.locked = locked;
+ this.lights = lights;
+ this.engine = engine;
+ this.licensePlate = licensePlate;
+ this.ivNetworkId = -1;
+ }
+}
+
+// ===========================================================================
+
+function receiveVehicleFromServer(vehicleId, position, model, colour1, colour2, colour3 = 0, colour4 = 0, locked = false, lights = false, engine = false, licensePlate = "") {
+ logToConsole(LOG_DEBUG, `[VRR.Vehicle] Received vehicle ${vehicleId} (${getVehicleNameFromModel(model, getGame())}) from server`);
+
+ if(getGame() != VRR_GAME_GTA_IV) {
+ return false;
+ }
+
+ if(getVehicleData(vehicleId) != false) {
+ let vehicleData = getVehicleData(vehicleId);
+ //vehicleData.position = position;
+ //vehicleData.heading = heading;
+ //vehicleData.model
+ vehicleData.colour1 = colour1;
+ vehicleData.colour2 = colour2;
+ vehicleData.colour3 = colour3;
+ vehicleData.colour4 = colour4;
+ vehicleData.engine = engine;
+ vehicleData.lights = lights;
+ vehicleData.locked = locked;
+ vehicleData.licensePlate = "";
+
+ let vehicle = natives.getVehicleFromNetworkId(vehicleId.ivNetworkId);
+ } else {
+ //logToConsole(LOG_DEBUG, `[VRR.Vehicle] Vehicle ${vehicleId} doesn't exist. Adding ...`);
+ //let tempVehicleData = new VehicleData(vehicleId, name, position, blipModel, pickupModel);
+
+ //vehicles.push(tempVehicleData);
+ //setAllJobDataIndexes();
+ }
+}
+
+// ===========================================================================
+
+function processVehiclePurchasing() {
+ if(vehiclePurchaseState == VRR_VEHBUYSTATE_TESTDRIVE) {
+ if(getLocalPlayerVehicle() == false) {
+ vehiclePurchaseState = VRR_VEHBUYSTATE_EXITVEH;
+ sendNetworkEventToServer("vrr.vehBuyState", VRR_VEHBUYSTATE_EXITVEH);
+ return false;
+ } else {
+ if(vehiclePurchasing == getLocalPlayerVehicle()) {
+ if(getDistance(getLocalPlayerVehicle().position, vehiclePurchasePosition) >= 25) {
+ vehiclePurchaseState = VRR_VEHBUYSTATE_FARENOUGH;
+ sendNetworkEventToServer("vrr.vehBuyState", VRR_VEHBUYSTATE_FARENOUGH);
+ }
+ } else {
+ vehiclePurchaseState = VRR_VEHBUYSTATE_WRONGVEH;
+ sendNetworkEventToServer("vrr.vehBuyState", VRR_VEHBUYSTATE_WRONGVEH);
+ }
+ }
+ }
+}
+
+// ===========================================================================
+
+function processVehicleBurning() {
+ getElementsByType(ELEMENT_VEHICLE).filter(vehicle => vehicle.isSyncer && vehicle.health < 250).forEach((vehicle) => {
+ vehicle.health = 250;
+ });
+}
+
+// ===========================================================================
+
+function setVehiclePurchaseState(state, vehicleId, position) {
+ vehiclePurchaseState = state;
+
+ if(vehicleId != null) {
+ vehiclePurchasing = getElementFromId(vehicleId);
+ } else {
+ vehiclePurchasing = null;
+ }
+
+ vehiclePurchasePosition = position;
+}
+
+// ===========================================================================
+
+/**
+ * @param {number} vehicleId - The ID of the job (initially provided by server)
+ * @return {VehicleData} The vehicle's data (class instance)
+ */
+ function getVehicleData(vehicleId) {
+ for(let i in getServerData().vehicles) {
+ if(getServerData().vehicles[i].vehicleId == vehicleId) {
+ return getServerData().vehicles[i];
+ }
+ }
+
+ return false;
+}
+
+// ===========================================================================
+
+function setAllVehicleDataIndexes() {
+ for(let i in getServerData().vehicles) {
+ getServerData().vehicles[i].index = i;
+ }
+}
+
+// ===========================================================================
\ No newline at end of file
diff --git a/scripts/server/accent.js b/scripts/server/accent.js
index 41cea951..f5709db0 100644
--- a/scripts/server/accent.js
+++ b/scripts/server/accent.js
@@ -8,30 +8,30 @@
// ===========================================================================
function getPlayerAccentText(client) {
- return getPlayerCurrentSubAccount(client).accent;
+ return getPlayerCurrentSubAccount(client).accent;
}
// ===========================================================================
function setPlayerAccentText(client, text) {
- getPlayerCurrentSubAccount(client).accent = text;
+ getPlayerCurrentSubAccount(client).accent = text;
}
// ===========================================================================
function doesPlayerHaveAccent(client) {
- return (getPlayerCurrentSubAccount(client).accent != "");
+ return (getPlayerCurrentSubAccount(client).accent != "");
}
// ===========================================================================
function getPlayerAccentInlineOutput(client) {
- let outputText = "";
- if(doesPlayerHaveAccent(client)) {
- outputText = `[${getPlayerAccentText(client)}] `;
- }
+ let outputText = "";
+ if(doesPlayerHaveAccent(client)) {
+ outputText = `[${getPlayerAccentText(client)}] `;
+ }
- return outputText;
+ return outputText;
}
// ===========================================================================
@@ -63,7 +63,7 @@ function listAccentsCommand(command, params, client) {
let chunkedList = splitArrayIntoChunks(accentList, 8);
- messagePlayerInfo(client, makeChatBoxSectionHeader(getLocaleString(client, "AccentList")));
+ messagePlayerInfo(client, makeChatBoxSectionHeader(getLocaleString(client, "AccentsListHeader")));
for(let i in chunkedList) {
messagePlayerInfo(client, chunkedList[i].join(", "));
}
@@ -91,7 +91,7 @@ function getAccentFromParams(params) {
function reloadAccentConfigurationCommand(command, params, client) {
getGlobalConfig().accents = loadAccentConfig();
- messageAdmins(`${client.name} {MAINCOLOUR}has reloaded the accent list`);
+ messageAdmins(`{adminOrange}${getPlayerName(client)} {MAINCOLOUR}has reloaded the accent list`);
}
// ===========================================================================
@@ -111,7 +111,7 @@ function addAccentCommand(command, params, client) {
getGlobalConfig().accents.push(newAccentName);
saveAccentConfig();
- messageAdmins(`${client.name}{MAINCOLOUR} added a new accent: ${newAccentName}`);
+ messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} added a new accent: {ALTCOLOUR}${newAccentName}{MAINCOLOUR}`);
}
// ===========================================================================
@@ -131,7 +131,7 @@ function removeAccentCommand(command, params, client) {
getGlobalConfig().accents.push(newAccentName);
saveAccentConfig();
- messageAdmins(`${client.name}{MAINCOLOUR} added a new accent: ${newAccentName}`);
+ messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} removed an accent: {ALTCOLOUR}${newAccentName}{MAINCOLOUR}`);
}
// ===========================================================================
\ No newline at end of file
diff --git a/scripts/server/account.js b/scripts/server/account.js
index 7cfddb0d..e8a4dce4 100644
--- a/scripts/server/account.js
+++ b/scripts/server/account.js
@@ -200,12 +200,12 @@ function initAccountScript() {
// ===========================================================================
function loginCommand(command, params, client) {
- if(!isPlayerRegistered(client)) {
+ if (!isPlayerRegistered(client)) {
messagePlayerError(client, getLocaleString(client, "NameNotRegistered"));
return false;
}
- if(areParamsEmpty(params)) {
+ if (areParamsEmpty(params)) {
messagePlayerSyntax(client, getCommandSyntaxText(command));
return false;
}
@@ -219,7 +219,7 @@ function loginCommand(command, params, client) {
function toggleAutoLoginByIPCommand(command, params, client) {
let flagValue = getAccountSettingsFlagValue("AutoLoginIP");
- if(hasBitFlag(getPlayerData(client).accountData.settings, flagValue)) {
+ if (hasBitFlag(getPlayerData(client).accountData.settings, flagValue)) {
getPlayerData(client).accountData.settings = removeBitFlag(getPlayerData(client).accountData.settings, flagValue);
messagePlayerSuccess(client, getLocaleString(client, "AutomaticLoginIPToggle", `{softRed}${toUpperCase(getLocaleString(client, "Off"))}`));
} else {
@@ -234,7 +234,7 @@ function toggleAutoLoginByIPCommand(command, params, client) {
function toggleNoRandomTipsCommand(command, params, client) {
let flagValue = getAccountSettingsFlagValue("NoRandomTips");
- if(hasBitFlag(getPlayerData(client).accountData.settings, flagValue)) {
+ if (hasBitFlag(getPlayerData(client).accountData.settings, flagValue)) {
getPlayerData(client).accountData.settings = removeBitFlag(getPlayerData(client).accountData.settings, flagValue);
messagePlayerSuccess(client, getLocaleString(client, "RandomTipsToggle", `{softRed}${toUpperCase(getLocaleString(client, "Off"))}`));
} else {
@@ -249,7 +249,7 @@ function toggleNoRandomTipsCommand(command, params, client) {
function toggleNoActionTipsCommand(command, params, client) {
let flagValue = getAccountSettingsFlagValue("NoActionTips");
- if(hasBitFlag(getPlayerData(client).accountData.settings, flagValue)) {
+ if (hasBitFlag(getPlayerData(client).accountData.settings, flagValue)) {
getPlayerData(client).accountData.settings = removeBitFlag(getPlayerData(client).accountData.settings, flagValue);
messagePlayerSuccess(client, getLocaleString(client, "ActionTipsToggle", `{softRed}${toUpperCase(getLocaleString(client, "Off"))}`));
} else {
@@ -264,7 +264,7 @@ function toggleNoActionTipsCommand(command, params, client) {
function toggleAutoSelectLastCharacterCommand(command, params, client) {
let flagValue = getAccountSettingsFlagValue("AutoSelectLastCharacter");
- if(hasBitFlag(getPlayerData(client).accountData.settings, flagValue)) {
+ if (hasBitFlag(getPlayerData(client).accountData.settings, flagValue)) {
getPlayerData(client).accountData.settings = removeBitFlag(getPlayerData(client).accountData.settings, flagValue);
messagePlayerSuccess(client, getLocaleString(client, "AutoSpawnLastCharToggle", `{softRed}${toUpperCase(getLocaleString(client, "Off"))}`));
} else {
@@ -277,35 +277,36 @@ function toggleAutoSelectLastCharacterCommand(command, params, client) {
// ===========================================================================
function toggleAccountGUICommand(command, params, client) {
+ // Remember, the flag is BACKWARD. Enabled = NO GUI!
let flagValue = getAccountSettingsFlagValue("NoGUI");
- if(!doesPlayerHaveGUIEnabled(client)) {
- getPlayerData(client).accountData.settings = removeBitFlag(getPlayerData(client).accountData.settings, flagValue);
- messagePlayerNormal(client, getLocaleString(client, "GUIAccountSettingToggle", `{softRed}${toUpperCase(getLocaleString(client, "Off"))}`));
- logToConsole(LOG_DEBUG, `[VRR.Account] ${getPlayerDisplayForConsole(client)} has toggled GUI for their account ON.`);
- } else {
+ if (doesPlayerHaveGUIEnabled(client)) {
getPlayerData(client).accountData.settings = addBitFlag(getPlayerData(client).accountData.settings, flagValue);
- messagePlayerNormal(client, getLocaleString(client, "GUIAccountSettingToggle", `{softGreen}${toUpperCase(getLocaleString(client, "On"))}`));
+ messagePlayerNormal(client, getLocaleString(client, "GUIAccountSettingToggle", `{softRed}${toUpperCase(getLocaleString(client, "Off"))}{MAINCOLOUR}`));
+ logToConsole(LOG_DEBUG, `[VRR.Account] ${getPlayerDisplayForConsole(client)} has toggled GUI for their account OFF.`);
+ } else {
+ getPlayerData(client).accountData.settings = removeBitFlag(getPlayerData(client).accountData.settings, flagValue);
+ messagePlayerNormal(client, getLocaleString(client, "GUIAccountSettingToggle", `{softGreen}${toUpperCase(getLocaleString(client, "On"))}{MAINCOLOUR}`));
logToConsole(LOG_DEBUG, `[VRR.Account] ${getPlayerDisplayForConsole(client)} has toggled GUI for their account ON.`);
}
- if(!isPlayerLoggedIn(client)) {
- if(getPlayerData().accountData.databaseId != 0) {
- if(doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
+ if (!isPlayerLoggedIn(client)) {
+ if (getPlayerData().accountData.databaseId != 0) {
+ if (doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
showPlayerLoginGUI(client);
logToConsole(LOG_DEBUG, `[VRR.Account] ${getPlayerDisplayForConsole(client)} is being shown the login GUI`);
} else {
hideAllPlayerGUI(client);
- messagePlayerNormal(client, `👋 Welcome back to ${getServerName()}, ${getPlayerName(client)}! Please /login to continue.`, getColourByName("softGreen"));
+ messagePlayerNormal(client, getLocaleString(client, "WelcomeBack", getServerName(), getPlayerName(client), "{ALTCOLOUR}/login{MAINCOLOUR}"));
logToConsole(LOG_DEBUG, `[VRR.Account] ${getPlayerDisplayForConsole(client)} is being shown the login message (GUI disabled)`);
}
} else {
- if(doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
+ if (doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
showPlayerRegistrationGUI(client);
logToConsole(LOG_DEBUG, `[VRR.Account] ${getPlayerDisplayForConsole(client)} is being shown the register GUI`);
} else {
hideAllPlayerGUI(client);
- messagePlayerNormal(client, `👋 Welcome to ${getServerName()}, ${getPlayerName(client)}! Please /register to continue.`, getColourByName("softGreen"));
+ messagePlayerNormal(client, getLocaleString(client, "WelcomeNewPlayer", getServerName(), getPlayerName(client), "{ALTCOLOUR}/register{MAINCOLOUR}"));
logToConsole(LOG_DEBUG, `[VRR.Account] ${getPlayerDisplayForConsole(client)} is being shown the register message (GUI disabled)`);
}
}
@@ -318,13 +319,13 @@ function toggleAccountGUICommand(command, params, client) {
function toggleAccountLoginAttemptNotificationsCommand(command, params, client) {
let flagValue = getAccountSettingsFlagValue("AuthAttemptAlert");
- if(hasBitFlag(getPlayerData(client).accountData.settings, flagValue)) {
+ if (doesPlayerHaveLoginAlertsEnabled(client)) {
getPlayerData(client).accountData.settings = removeBitFlag(getPlayerData(client).accountData.settings, flagValue);
- messagePlayerNormal(client, `⚙️ You will ${getBoolRedGreenInlineColour(true)}now {MAINCOLOUR}be notified by email when somebody tries to login to your account`);
+ messagePlayerNormal(client, `⚙️ You turned ${getBoolRedGreenInlineColour(false)}OFF{MAINCOLOUR} notification by email when somebody tries to login to your account`);
logToConsole(LOG_DEBUG, `[VRR.Account] ${getPlayerDisplayForConsole(client)} has toggled the login attempt email notifications OFF for their account`);
} else {
getPlayerData(client).accountData.settings = addBitFlag(getPlayerData(client).accountData.settings, flagValue);
- messagePlayerNormal(client, `⚙️ You will ${getBoolRedGreenInlineColour(false)}not {MAINCOLOUR}be notified by email when somebody tries to login to your account`);
+ messagePlayerNormal(client, `⚙️ You turned ${getBoolRedGreenInlineColour(true)}ON{MAINCOLOUR} notification by email when somebody tries to login to your account`);
logToConsole(LOG_DEBUG, `[VRR.Account] ${getPlayerDisplayForConsole(client)} has toggled the login attempt email notifications OFF for their account`);
}
@@ -336,16 +337,16 @@ function toggleAccountLoginAttemptNotificationsCommand(command, params, client)
function toggleAccountServerLogoCommand(command, params, client) {
let flagValue = getAccountSettingsFlagValue("NoServerLogo");
- if(!doesPlayerHaveLogoEnabled(client)) {
+ if (!doesPlayerHaveLogoEnabled(client)) {
getPlayerData(client).accountData.settings = removeBitFlag(getPlayerData(client).accountData.settings, flagValue);
- messagePlayerNormal(client, `⚙️ You will ${getBoolRedGreenInlineColour(true)}now {MAINCOLOUR}be shown the server logo (if enabled on current server)`);
+ messagePlayerSuccess(client, getLocaleString(client, "AccountServerLogoSet", `${getBoolRedGreenInlineColour(true)}${getLocaleString(client, "On")}{MAINCOLOUR}`));
logToConsole(LOG_DEBUG, `[VRR.Account] ${getPlayerDisplayForConsole(client)} has toggled the server logo ON for their account`);
- if(getServerConfig().showLogo) {
+ if (getServerConfig().showLogo) {
updatePlayerShowLogoState(client, true);
}
} else {
getPlayerData(client).accountData.settings = addBitFlag(getPlayerData(client).accountData.settings, flagValue);
- messagePlayerNormal(client, `⚙️ You will ${getBoolRedGreenInlineColour(false)}not {MAINCOLOUR}be shown the server logo.`);
+ messagePlayerSuccess(client, getLocaleString(client, "AccountServerLogoSet", `${getBoolRedGreenInlineColour(false)}${getLocaleString(client, "Off")}{MAINCOLOUR}`));
logToConsole(LOG_DEBUG, `[VRR.Account] ${getPlayerDisplayForConsole(client)} has toggled the server logo OFF for their account`);
updatePlayerShowLogoState(client, false);
}
@@ -358,27 +359,27 @@ function toggleAccountServerLogoCommand(command, params, client) {
function toggleAccountTwoFactorAuthCommand(command, params, client) {
let flagValue = getAccountSettingsFlagValue("TwoStepAuth");
- if(getEmailConfig().enabled) {
- if(getPlayerData(client).accountData.emailAddress == "") {
+ if (getEmailConfig().enabled) {
+ if (getPlayerData(client).accountData.emailAddress == "") {
messagePlayerError(client, getLocaleString(client, "NeedEmailFor2FA"));
messagePlayerTip(client, getLocaleString(client, "SetEmailHelpTip", `{ALTCOLOUR}/setemail{MAINCOLOUR}`));
return false;
}
- if(!isAccountEmailVerified(getPlayerData(client).accountData)) {
+ if (!isAccountEmailVerified(getPlayerData(client).accountData)) {
messagePlayerError(client, getLocaleString(client, "NeedEmailVerifiedFor2FA"));
messagePlayerTip(client, getLocaleString(client, "VerifyEmailHelpTip", `{ALTCOLOUR}/verifyemail{MAINCOLOUR}`));
return false;
}
}
- if(!doesPlayerHaveTwoFactorAuthEnabled(client)) {
+ if (!doesPlayerHaveTwoFactorAuthEnabled(client)) {
getPlayerData(client).accountData.settings = addBitFlag(getPlayerData(client).accountData.settings, flagValue);
- messagePlayerSuccess(client, `{MAINCOLOUR}You have turned ${getBoolRedGreenInlineColour(false)}ON {MAINCOLOUR} two factor authentication!{ALTCOLOUR}${addtoAuthenticatorCode}`);
+ messagePlayerSuccess(client, getLocaleString(client, "TwoFactorAuthSet", `${getBoolRedGreenInlineColour(true)}${getLocaleString(client, "On")}{MAINCOLOUR}`));
logToConsole(LOG_DEBUG, `[VRR.Account] ${getPlayerDisplayForConsole(client)} has toggled two-factor authentication ON for their account`);
} else {
getPlayerData(client).accountData.settings = removeBitFlag(getPlayerData(client).accountData.settings, flagValue);
- messagePlayerSuccess(client, `You have turned ${getBoolRedGreenInlineColour(false)}OFF {MAINCOLOUR}two-factor authentication for login.`);
+ messagePlayerSuccess(client, getLocaleString(client, "TwoFactorAuthSet", `${getBoolRedGreenInlineColour(false)}${toUpperCase(getLocaleString(client, "Off"))}{MAINCOLOUR}`));
logToConsole(LOG_DEBUG, `[VRR.Account] ${getPlayerDisplayForConsole(client)} has toggled two-factor authentication OFF for their account`);
}
return true;
@@ -387,12 +388,12 @@ function toggleAccountTwoFactorAuthCommand(command, params, client) {
// ===========================================================================
function registerCommand(command, params, client) {
- if(isPlayerRegistered(client)) {
- messagePlayerError(client, `Your name is already registered!`);
+ if (isPlayerRegistered(client)) {
+ messagePlayerError(client, getLocaleString(client, "AccountNameAlreadyRegistered"));
return false;
}
- if(areParamsEmpty(params)) {
+ if (areParamsEmpty(params)) {
messagePlayerSyntax(client, getCommandSyntaxText(command));
return false;
}
@@ -406,7 +407,7 @@ function registerCommand(command, params, client) {
// ===========================================================================
function changeAccountPasswordCommand(command, params, client) {
- if(areParamsEmpty(params)) {
+ if (areParamsEmpty(params)) {
messagePlayerSyntax(client, getCommandSyntaxText(command));
return false;
}
@@ -414,14 +415,14 @@ function changeAccountPasswordCommand(command, params, client) {
let oldPassword = getParam(params, " ", 1);
let newPassword = getParam(params, " ", 2);
- if(isAccountPasswordCorrect(getPlayerData(client).accountData, hashAccountPassword(getPlayerData(client).accountData.name, oldPassword))) {
+ if (isAccountPasswordCorrect(getPlayerData(client).accountData, hashAccountPassword(getPlayerData(client).accountData.name, oldPassword))) {
messagePlayerError(client, `The old password is invalid!`);
return false;
}
- if(!doesPasswordMeetRequirements(newPassword)) {
- messagePlayerError(client, `The new password must meet the requirements!`);
- messagePlayerInfo(client, `Passwords must have at least one capital letter, one lowercase letter, and one number!`);
+ if (!doesPasswordMeetRequirements(newPassword)) {
+ messagePlayerError(client, getLocaleString(client, "PasswordNotGoodEnough"));
+ messagePlayerInfo(client, getLocaleString(client, "PasswordNeedsBase", `${getLocaleString(client, "PasswordNeedsCapitals", getGlobalConfig().passwordRequiredCapitals)}, ${getLocaleString(client, "PasswordNeedsSymbols", getGlobalConfig().passwordRequiredSymbols)}`));
return false;
}
@@ -432,18 +433,18 @@ function changeAccountPasswordCommand(command, params, client) {
// ===========================================================================
function setAccountChatScrollLinesCommand(command, params, client) {
- if(areParamsEmpty(params)) {
+ if (areParamsEmpty(params)) {
messagePlayerSyntax(client, getCommandSyntaxText(command));
return false;
}
- if(isNaN(params)) {
- messagePlayerError(client, `The line amount must be a number!`);
+ if (isNaN(params)) {
+ messagePlayerError(client, getLocaleString(client, "ChatScrollLinesNotNumber"));
return false;
}
- if(toInteger(params) < 1 || toInteger(params) > 6) {
- messagePlayerError(client, `The line amount must be between 1 and 6!`);
+ if (toInteger(params) < 1 || toInteger(params) > 6) {
+ messagePlayerError(client, getLocaleString(client, "ChatScrollLinesMustBeBetween", getGlobalConfig().minChatLines, getGlobalConfig().maxChatLines));
return false;
}
@@ -451,21 +452,41 @@ function setAccountChatScrollLinesCommand(command, params, client) {
getPlayerData(client).accountData.chatScrollLines = lines;
sendPlayerChatScrollLines(client, lines);
- messagePlayerSuccess(client, `Your chatbox will now scroll ${toInteger(lines)} lines at a time!`);
+ messagePlayerSuccess(client, getLocaleString(client, "ChatScrollLinesSet", lines));
+}
+
+// ===========================================================================
+
+function setAccountChatAutoHideDelayCommand(command, params, client) {
+ if (areParamsEmpty(params)) {
+ messagePlayerSyntax(client, getCommandSyntaxText(command));
+ return false;
+ }
+
+ if (isNaN(params)) {
+ messagePlayerError(client, `The delay time must be a number!`);
+ return false;
+ }
+
+ let delay = Math.ceil(toInteger(params));
+
+ getPlayerData(client).accountData.chatAutoHideDelay = delay;
+ sendPlayerChatAutoHideDelay(client, delay);
+ messagePlayerSuccess(client, `Your chatbox will now automatically hide after ${toInteger(delay)} seconds!`);
}
// ===========================================================================
function setAccountEmailCommand(command, params, client) {
- if(areParamsEmpty(params)) {
+ if (areParamsEmpty(params)) {
messagePlayerSyntax(client, getCommandSyntaxText(command));
return false;
}
let emailAddress = getParam(params, " ", 1);
- if(!isValidEmailAddress(emailAddress)) {
- messagePlayerError(client, `The email '${emailAddress} is not valid!`);
+ if (!isValidEmailAddress(emailAddress)) {
+ messagePlayerError(client, getLocaleString(client, "RegistrationFailedInvalidEmail"));
return false;
}
@@ -474,8 +495,8 @@ function setAccountEmailCommand(command, params, client) {
// return false;
//}
- if(getPlayerData(client).accountData.emailAddress != "" && isAccountEmailVerified(getPlayerData(client).accountData)) {
- messagePlayerError(client, `You already set your email and verified it!`);
+ if (getPlayerData(client).accountData.emailAddress != "" && isAccountEmailVerified(getPlayerData(client).accountData)) {
+ messagePlayerError(client, getLocaleString(client, "AccountEmailAlreadySetAndVerified"));
return false;
}
@@ -485,29 +506,29 @@ function setAccountEmailCommand(command, params, client) {
setAccountEmailVerificationCode(getPlayerData(client).accountData, emailVerificationCode);
sendEmailVerificationEmail(client, emailVerificationCode);
- messagePlayerSuccess(client, `Your email has been set!`);
- messagePlayerAlert(client, `Please verify your email to enable extra account security and recovery features.`);
- messagePlayerAlert(client, `A verification code and instructions have been sent to your email.`);
+ messagePlayerSuccess(client, getLocaleString(client, "EmailSet"));
+ messagePlayerAlert(client, getLocaleString(client, "RegistrationEmailVerifyReminder"));
+ messagePlayerAlert(client, getLocaleString(client, "EmailVerificationCodeSent"));
saveAccountToDatabase(getPlayerData(client).accountData);
}
// ===========================================================================
function verifyAccountEmailCommand(command, params, client) {
- if(areParamsEmpty(params)) {
+ if (areParamsEmpty(params)) {
messagePlayerSyntax(client, getCommandSyntaxText(command));
return false;
}
let verificationCode = getParam(params, " ", 1);
- if(isAccountEmailVerified(getPlayerData(client).accountData)) {
+ if (isAccountEmailVerified(getPlayerData(client).accountData)) {
messagePlayerError(client, `You already verified your email!`);
return false;
}
- if(module.hashing.sha512(verificationCode) != getPlayerData(client).accountData.emailVerificationCode) {
- messagePlayerError(client, `Invalid email verification code! A new one has been created and sent to your email.`);
+ if (module.hashing.sha512(verificationCode) != getPlayerData(client).accountData.emailVerificationCode) {
+ messagePlayerError(client, getLocaleString(client, "InvalidEmailVerificationCode"));
let emailVerificationCode = generateEmailVerificationCode();
setAccountEmailVerificationCode(getPlayerData(client).accountData, emailVerificationCode);
sendEmailVerificationEmail(client, emailVerificationCode);
@@ -517,8 +538,8 @@ function verifyAccountEmailCommand(command, params, client) {
getPlayerData(client).accountData.flags.moderation = addBitFlag(getPlayerData(client).accountData.flags.moderation, getModerationFlagValue("EmailVerified"));
getPlayerData(client).accountData.emailVerificationCode = "";
- messagePlayerSuccess(client, `Your email has been verified!`);
- messagePlayerAlert(client, `You can now use your email for password resets, two-factor authentication, alerts, and more!`);
+ messagePlayerSuccess(client, getLocaleString(client, "EmailVerified"));
+ messagePlayerAlert(client, getLocaleString(client, "EmailVerifiedTip"));
saveAccountToDatabase(getPlayerData(client).accountData);
}
@@ -558,14 +579,14 @@ function setAccountDiscordCommand(command, params, client) {
messagePlayerError(client, `This command is not yet finished and will be available soon!`);
return false;
- if(areParamsEmpty(params)) {
+ if (areParamsEmpty(params)) {
messagePlayerSyntax(client, getCommandSyntaxText(command));
return false;
}
let discordName = getParam(params, " ", 1);
- if(!isValidEmailAddress(emailAddress)) {
+ if (!isValidEmailAddress(emailAddress)) {
messagePlayerError(client, `The discord '${discordName} is not valid!`);
return false;
}
@@ -578,11 +599,11 @@ function setAccountDiscordCommand(command, params, client) {
// ===========================================================================
function isPlayerLoggedIn(client) {
- if(isConsole(client)) {
+ if (isConsole(client)) {
return true;
}
- if(getPlayerData(client) != null) {
+ if (getPlayerData(client) != null) {
return getPlayerData(client).loggedIn;
}
@@ -592,12 +613,12 @@ function isPlayerLoggedIn(client) {
// ===========================================================================
function isPlayerRegistered(client) {
- if(isConsole(client)) {
+ if (isConsole(client)) {
return true;
}
- if(getPlayerData(client).accountData != false) {
- if(getPlayerData(client).accountData.databaseId != 0) {
+ if (getPlayerData(client).accountData != false) {
+ if (getPlayerData(client).accountData.databaseId != 0) {
return true;
}
}
@@ -615,7 +636,7 @@ function doesPasswordMeetRequirements(password) {
// ===========================================================================
function isAccountPasswordCorrect(accountData, password) {
- if(accountData.password == password) {
+ if (accountData.password == password) {
return true;
}
@@ -626,15 +647,15 @@ function isAccountPasswordCorrect(accountData, password) {
function loadAccountFromName(accountName, fullLoad = false) {
let dbConnection = connectToDatabase();
- if(dbConnection) {
+ if (dbConnection) {
accountName = escapeDatabaseString(dbConnection, accountName);
let dbQueryString = `SELECT acct_main.*, acct_svr.* FROM acct_main INNER JOIN acct_svr ON acct_svr.acct_svr_acct = acct_main.acct_id AND acct_svr.acct_svr_svr = ${getServerId()} WHERE acct_name = '${accountName}' LIMIT 1;`;
let dbQuery = queryDatabase(dbConnection, dbQueryString);
- if(dbQuery) {
- if(dbQuery.numRows > 0) {
+ if (dbQuery) {
+ if (dbQuery.numRows > 0) {
let dbAssoc = fetchQueryAssoc(dbQuery);
let tempAccountData = new AccountData(dbAssoc);
- if(fullLoad) {
+ if (fullLoad) {
tempAccountData.messages = loadAccountMessagesFromDatabase(tempAccountData.databaseId);
tempAccountData.notes = loadAccountStaffNotesFromDatabase(tempAccountData.databaseId);
tempAccountData.contacts = loadAccountContactsFromDatabase(tempAccountData.databaseId);
@@ -653,14 +674,14 @@ function loadAccountFromName(accountName, fullLoad = false) {
function loadAccountFromId(accountId, fullLoad = false) {
let dbConnection = connectToDatabase();
- if(dbConnection) {
+ if (dbConnection) {
let dbQueryString = `SELECT *, acct_ip AS ipstring FROM acct_main WHERE acct_id = ${accountId} LIMIT 1;`;
let dbQuery = queryDatabase(dbConnection, dbQueryString);
- if(dbQuery) {
+ if (dbQuery) {
let dbAssoc = fetchQueryAssoc(dbQuery);
let tempAccountData = new AccountData(dbAssoc);
freeDatabaseQuery(dbQuery);
- if(fullLoad) {
+ if (fullLoad) {
tempAccountData.messages = loadAccountMessagesFromDatabase(tempAccountData.databaseId);
tempAccountData.notes = loadAccountStaffNotesFromDatabase(tempAccountData.databaseId);
tempAccountData.contacts = loadAccountContactsFromDatabase(tempAccountData.databaseId);
@@ -677,7 +698,7 @@ function loadAccountFromId(accountId, fullLoad = false) {
// ===========================================================================
function getAccountHashingFunction() {
- switch(toLowerCase(getGlobalConfig().accountPasswordHash)) {
+ switch (toLowerCase(getGlobalConfig().accountPasswordHash)) {
case "md5":
return module.hashing.md5;
@@ -717,7 +738,7 @@ function getAccountHashingFunction() {
function isNameRegistered(name) {
let accountData = loadAccountFromName(name, true);
- if(accountData.databaseId > 0) {
+ if (accountData.databaseId > 0) {
return true;
}
@@ -746,18 +767,19 @@ function loginSuccess(client) {
updateConnectionLogOnAuth(client, getPlayerData(client).accountData.databaseId);
- if(doesPlayerHaveStaffPermission(client, "Developer") || doesPlayerHaveStaffPermission(client, "ManageServer")) {
+ if (doesPlayerHaveStaffPermission(client, "Developer") || doesPlayerHaveStaffPermission(client, "ManageServer")) {
logToConsole(LOG_WARN, `[VRR.Account] ${getPlayerDisplayForConsole(client)} has needed permissions and is being given administrator access`);
- client.administrator = true;
+ setPlayerNativeAdminState(client, true);
}
- if(doesServerHaveTesterOnlyEnabled()) {
- if(!hasBitFlag(getPlayerData(client).accountData.flags.moderation, getModerationFlagValue("IsTester"))) {
- setTimeout(function() {
- client.disconnect();
+ if (doesServerHaveTesterOnlyEnabled()) {
+ if (!hasBitFlag(getPlayerData(client).accountData.flags.moderation, getModerationFlagValue("IsTester"))) {
+ setTimeout(function () {
+ getPlayerData(client).customDisconnectReason = "Kicked - Not a tester";
+ disconnectPlayer(client);
}, 3500);
- if(doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
+ if (doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
logToConsole(LOG_DEBUG, `[VRR.Account] ${getPlayerDisplayForConsole(client)} is being shown the error GUI (not a tester).`);
showPlayerErrorGUI(client, getLocaleString(client, "NotATester"), getLocaleString(client, "AccessDenied"));
return false;
@@ -765,13 +787,13 @@ function loginSuccess(client) {
logToConsole(LOG_DEBUG, `[VRR.Account] ${getPlayerDisplayForConsole(client)} is being shown the "not a tester" error message (GUI disabled).`);
messagePlayerError(client, getLocaleString(client, "NotATester"));
return false;
- }
+ }
}
}
- if(getPlayerData(client).subAccounts.length == 0) {
- if(doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
- showPlayerPromptGUI(client, getLocaleString(client, "NoCharactersGUIMessage"), getLocaleString(client, "NoCharactersGUIWindowTitle"));
+ if (getPlayerData(client).subAccounts.length == 0) {
+ if (doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
+ showPlayerPrompt(client, getLocaleString(client, "NoCharactersGUIMessage"), getLocaleString(client, "NoCharactersGUIWindowTitle"), getLocaleString(client, "Yes"), getLocaleString(client, "No"));
getPlayerData(client).promptType = VRR_PROMPT_CREATEFIRSTCHAR;
logToConsole(LOG_DEBUG, `[VRR.Account] ${getPlayerDisplayForConsole(client)} is being shown the no characters prompt GUI`);
} else {
@@ -782,18 +804,27 @@ function loginSuccess(client) {
showCharacterSelectToClient(client);
}
- getPlayerData(client).accountData.ipAddress = client.ip;
-
+ getPlayerData(client).accountData.ipAddress = getPlayerIP(client);
sendPlayerChatScrollLines(client, getPlayerData(client).accountData.chatScrollLines);
- messagePlayerNormal(null, `👋 ${getPlayerName(client)} has joined the server`, getColourByName("softYellow"));
+ messageDiscordChatChannel(`👋 ${getPlayerName(client)} has joined the server`);
+
+ //let countryName = "Unknown";
+ //if(getCountryNameFromIP(getPlayerIP(client))) {
+ // countryName = getCountryNameFromIP(getPlayerIP(client));
+ //}
+
+ //let clients = getClients();
+ //for(let i in clients) {
+ // messagePlayerNormal(clients[i], getLocaleString(clients[i], "PlayerJoinedServer", `{ALTCOLOUR}${getPlayerName(client)}{MAINCOLOUR}`, `{ALTCOLOUR}${countryName}{MAINCOLOUR}`), getColourByName("softYellow"));
+ //}
}
// ===========================================================================
function saveAccountToDatabase(accountData) {
let dbConnection = connectToDatabase();
- if(dbConnection) {
+ if (dbConnection) {
logToConsole(LOG_VERBOSE, `Escaping account data for ${accountData.name}`);
let safeAccountName = escapeDatabaseString(dbConnection, accountData.name);
logToConsole(LOG_VERBOSE, `${accountData.name}'s name escaped successfully`);
@@ -821,6 +852,7 @@ function saveAccountToDatabase(accountData) {
["acct_svr_staff_flags", accountData.flags.admin],
["acct_svr_mod_flags", accountData.flags.moderation],
["acct_svr_chat_scroll_lines", accountData.chatScrollLines],
+ ["acct_svr_chat_auto_hide_delay", accountData.chatAutoHideDelay],
];
let queryString1 = createDatabaseUpdateQuery("acct_main", data, `acct_id=${accountData.databaseId}`);
@@ -839,13 +871,13 @@ function saveAccountToDatabase(accountData) {
// ===========================================================================
function saveAccountKeyBindToDatabase(keyBindData) {
- if(keyBindData.databaseId == -1) {
+ if (keyBindData.databaseId == -1) {
// Keybind is a default or temporary keybind, don't save
return false;
}
let dbConnection = connectToDatabase();
- if(dbConnection) {
+ if (dbConnection) {
let safeCommandString = escapeDatabaseString(dbConnection, keyBindData.commandString);
let data = [
@@ -858,7 +890,7 @@ function saveAccountKeyBindToDatabase(keyBindData) {
];
let dbQuery = null;
- if(keyBindData.databaseId == 0) {
+ if (keyBindData.databaseId == 0) {
let queryString = createDatabaseInsertQuery("acct_hotkey", data);
dbQuery = queryDatabase(dbConnection, queryString);
keyBindData.databaseId = getDatabaseInsertId(dbConnection);
@@ -877,7 +909,7 @@ function saveAccountKeyBindToDatabase(keyBindData) {
function saveAccountStaffNotesDatabase(staffNoteData) {
let dbConnection = connectToDatabase();
- if(dbConnection) {
+ if (dbConnection) {
let safeNoteContent = escapeDatabaseString(dbConnection, staffNoteData.note);
let data = [
@@ -889,7 +921,7 @@ function saveAccountStaffNotesDatabase(staffNoteData) {
];
let dbQuery = null;
- if(staffNoteData.databaseId == 0) {
+ if (staffNoteData.databaseId == 0) {
let queryString = createDatabaseInsertQuery("acct_note", data);
dbQuery = queryDatabase(dbConnection, queryString);
staffNoteData.databaseId = getDatabaseInsertId(dbConnection);
@@ -932,13 +964,13 @@ function saveAccountContactsToDatabase(accountContactData) {
function createAccount(name, password, email = "") {
let dbConnection = connectToDatabase();
- if(dbConnection) {
+ if (dbConnection) {
let hashedPassword = hashAccountPassword(name, password);
let safeName = escapeDatabaseString(dbConnection, name);
let safeEmail = escapeDatabaseString(dbConnection, email);
let dbQuery = queryDatabase(dbConnection, `INSERT INTO acct_main (acct_name, acct_pass, acct_email, acct_when_registered) VALUES ('${safeName}', '${hashedPassword}', '${safeEmail}', CURRENT_TIMESTAMP())`);
- if(getDatabaseInsertId(dbConnection) > 0) {
+ if (getDatabaseInsertId(dbConnection) > 0) {
let tempAccountData = loadAccountFromId(getDatabaseInsertId(dbConnection), false);
createDefaultAccountServerData(tempAccountData.databaseId);
tempAccountData.messages = loadAccountMessagesFromDatabase(tempAccountData.databaseId);
@@ -954,15 +986,16 @@ function createAccount(name, password, email = "") {
// ===========================================================================
-function checkLogin(client, password) {
- getPlayerData(client).loginAttemptsRemaining = getPlayerData(client).loginAttemptsRemaining-1;
- if(getPlayerData(client).loginAttemptsRemaining <= 0) {
- client.disconnect();
+async function checkLogin(client, password) {
+ getPlayerData(client).loginAttemptsRemaining = getPlayerData(client).loginAttemptsRemaining - 1;
+ if (getPlayerData(client).loginAttemptsRemaining <= 0) {
+ getPlayerData(client).customDisconnectReason = "Kicked - Failed to login";
+ disconnectPlayer(client);
}
- if(isPlayerLoggedIn(client)) {
+ if (isPlayerLoggedIn(client)) {
logToConsole(LOG_WARN, `[VRR.Account] ${getPlayerDisplayForConsole(client)} attempted to login but is already logged in`);
- if(doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
+ if (doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
showPlayerLoginSuccessGUI(client);
} else {
messagePlayerError(client, "You are already logged in!");
@@ -971,9 +1004,9 @@ function checkLogin(client, password) {
return false;
}
- if(!isPlayerRegistered(client)) {
+ if (!isPlayerRegistered(client)) {
logToConsole(LOG_WARN, `[VRR.Account] ${getPlayerDisplayForConsole(client)} attempted to login but is not registered`);
- if(doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
+ if (doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
showPlayerRegistrationGUI(client);
logToConsole(LOG_DEBUG, `[VRR.Account] ${getPlayerDisplayForConsole(client)} is being shown the register GUI`);
} else {
@@ -983,9 +1016,9 @@ function checkLogin(client, password) {
return false;
}
- if(areParamsEmpty(password)) {
+ if (areParamsEmpty(password)) {
logToConsole(LOG_WARN, `[VRR.Account] ${getPlayerDisplayForConsole(client)} attempted to login but failed (empty password). ${getPlayerData(client).loginAttemptsRemaining} login attempts remaining`);
- if(doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
+ if (doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
showPlayerLoginFailedGUI(client, `Invalid password! ${getPlayerData(client).loginAttemptsRemaining} tries remaining.`);
logToConsole(LOG_DEBUG, `[VRR.Account] ${getPlayerDisplayForConsole(client)} is being shown the login GUI with ${getPlayerData(client).loginAttemptsRemaining} login attempts remaining alert.`);
} else {
@@ -993,15 +1026,16 @@ function checkLogin(client, password) {
logToConsole(LOG_DEBUG, `[VRR.Account] ${getPlayerDisplayForConsole(client)} is being shown the login message (GUI disabled) with ${getPlayerData(client).loginAttemptsRemaining} login attempts remaining alert.`);
}
- if(isAccountEmailVerified(getPlayerData(client).accountData) && isAccountSettingFlagEnabled(getPlayerData(client).accountData, getAccountSettingsFlagValue("AuthAttemptAlert"))) {
- sendAccountLoginFailedNotification(getPlayerData(client).accountData.emailAddress, client.name, client.ip, getServerGame());
- }
+ // Disabling email login alerts for now. It hangs the server for a couple seconds. Need a way to thread it.
+ //if (isAccountEmailVerified(getPlayerData(client).accountData) && !isAccountSettingFlagEnabled(getPlayerData(client).accountData, getAccountSettingsFlagValue("AuthAttemptAlert"))) {
+ // await sendAccountLoginFailedNotification(getPlayerData(client).accountData.emailAddress, getPlayerName(client), getPlayerIP(client), getGame());
+ //}
return false;
}
- if(!isAccountPasswordCorrect(getPlayerData(client).accountData, hashAccountPassword(getPlayerName(client), password))) {
+ if (!isAccountPasswordCorrect(getPlayerData(client).accountData, hashAccountPassword(getPlayerName(client), password))) {
logToConsole(LOG_WARN, `[VRR.Account] ${getPlayerDisplayForConsole(client)} attempted to login but failed (wrong password). ${getPlayerData(client).loginAttemptsRemaining} login attempts remaining`);
- if(doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
+ if (doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
showPlayerLoginFailedGUI(client, `Invalid password! ${getPlayerData(client).loginAttemptsRemaining} tries remaining.`);
logToConsole(LOG_DEBUG, `[VRR.Account] ${getPlayerDisplayForConsole(client)} is being shown the login GUI with ${getPlayerData(client).loginAttemptsRemaining} login attempts remaining alert.`);
} else {
@@ -1009,27 +1043,30 @@ function checkLogin(client, password) {
logToConsole(LOG_DEBUG, `[VRR.Account] ${getPlayerDisplayForConsole(client)} is being shown the login message (GUI disabled) with ${getPlayerData(client).loginAttemptsRemaining} login attempts remaining alert.`);
}
- if(isAccountEmailVerified(getPlayerData(client).accountData) && isAccountSettingFlagEnabled(getPlayerData(client).accountData, getAccountSettingsFlagValue("AuthAttemptAlert"))) {
- sendAccountLoginFailedNotification(getPlayerData(client).accountData.emailAddress, client.name, client.ip, getServerGame());
- }
+ // Disabling email login alerts for now. It hangs the server for a couple seconds. Need a way to thread it.
+ //if (isAccountEmailVerified(getPlayerData(client).accountData) && !isAccountSettingFlagEnabled(getPlayerData(client).accountData, getAccountSettingsFlagValue("AuthAttemptAlert"))) {
+ // await sendAccountLoginFailedNotification(getPlayerData(client).accountData.emailAddress, getPlayerName(client), getPlayerIP(client), getGame());
+ //}
return false;
}
- //if(doesPlayerHaveTwoFactorAuthEnabled(client)) {
- // getPlayerData(client).twoFactorAuthCode = toUpperCase(generateRandomString(6));
- // showPlayerTwoFactorAuthenticationGUI(client);
- // return true;
- //}
+ if (doesPlayerHaveTwoFactorAuthEnabled(client) && checkForSMTPModule() && getEmailConfig().enabled) {
+ getPlayerData(client).twoFactorAuthCode = toUpperCase(generateRandomString(6));
+ showPlayerTwoFactorAuthenticationGUI(client);
+ sendAccountTwoFactorAuthCode(getPlayerData(client).accountData.emailAddress, getPlayerName(client), getPlayerData(client).twoFactorAuthCode);
+ return true;
+ }
- if(doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
+ if (doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
showPlayerLoginSuccessGUI(client);
}
loginSuccess(client);
- if(isAccountEmailVerified(getPlayerData(client).accountData) && isAccountSettingFlagEnabled(getPlayerData(client).accountData, getAccountSettingsFlagValue("AuthAttemptAlert"))) {
- sendAccountLoginSuccessNotification(getPlayerData(client).accountData.emailAddress, client.name, client.ip, getServerGame());
- }
+ // Disabling email login alerts for now. It hangs the server for a couple seconds. Need a way to thread it.
+ //if (isAccountEmailVerified(getPlayerData(client).accountData) && !isAccountSettingFlagEnabled(getPlayerData(client).accountData, getAccountSettingsFlagValue("AuthAttemptAlert"))) {
+ // await sendAccountLoginSuccessNotification(getPlayerData(client).accountData.emailAddress, getPlayerName(client), getPlayerIP(client), getGame());
+ //}
}
// ===========================================================================
@@ -1037,8 +1074,8 @@ function checkLogin(client, password) {
function checkRegistration(client, password, confirmPassword = "", emailAddress = "") {
logToConsole(LOG_DEBUG, `[VRR.Account]: Checking registration for ${getPlayerName(client)}`);
- if(isPlayerRegistered(client)) {
- if(doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
+ if (isPlayerRegistered(client)) {
+ if (doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
showPlayerLoginGUI(client);
} else {
messagePlayerError(client, getLocaleString(client, "AlreadyRegistered"));
@@ -1047,8 +1084,8 @@ function checkRegistration(client, password, confirmPassword = "", emailAddress
return false;
}
- if(isPlayerLoggedIn(client)) {
- if(doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
+ if (isPlayerLoggedIn(client)) {
+ if (doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
showPlayerLoginSuccessGUI(client);
} else {
messagePlayerError(client, getLocaleString(client, "AlreadyLoggedIn"));
@@ -1057,8 +1094,8 @@ function checkRegistration(client, password, confirmPassword = "", emailAddress
return false;
}
- if(areParamsEmpty(password)) {
- if(doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
+ if (areParamsEmpty(password)) {
+ if (doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
showPlayerRegistrationFailedGUI(client, getLocaleString(client, "RegistrationFailedNoPassword"));
logToConsole(LOG_WARN, `${getPlayerDisplayForConsole(client)} failed to create an account (password is blank)`);
} else {
@@ -1068,51 +1105,51 @@ function checkRegistration(client, password, confirmPassword = "", emailAddress
return false;
}
- if(doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
- if(areParamsEmpty(confirmPassword)) {
+ if (doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
+ if (areParamsEmpty(confirmPassword)) {
showPlayerRegistrationFailedGUI(client, getLocaleString(client, "RegistrationFailedNoPasswordConfirm"));
logToConsole(LOG_WARN, `${getPlayerDisplayForConsole(client)} failed to create an account (password confirm is blank)`);
return false;
}
}
- if(doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
- if(areParamsEmpty(emailAddress)) {
+ if (doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
+ if (areParamsEmpty(emailAddress)) {
showPlayerRegistrationFailedGUI(client, getLocaleString(client, "RegistrationFailedNoEmail"));
logToConsole(LOG_WARN, `${getPlayerDisplayForConsole(client)} failed to create an account (email address is blank)`);
return false;
}
}
- if(doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
- if(password != confirmPassword) {
+ if (doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
+ if (password != confirmPassword) {
showPlayerRegistrationFailedGUI(client, getLocaleString(client, "RegistrationFailedPasswordMismatch"));
logToConsole(LOG_WARN, `${getPlayerDisplayForConsole(client)} failed to create an account (password and confirm don't match)`);
return false;
}
}
- if(!doesPasswordMeetRequirements(password)) {
- if(doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
+ if (!doesPasswordMeetRequirements(password)) {
+ if (doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
// Work on this later. Function should return true by default anyway for now.
showPlayerRegistrationFailedGUI(client, getLocaleString(client, "RegistrationFailedNoPasswordWeak"));
logToConsole(LOG_WARN, `${getPlayerDisplayForConsole(client)} failed to create an account (password doesn't meet requirements)`);
} else {
messagePlayerError(client, "Password doesn't meet requirements!");
}
- return false
+ return false;
}
- if(doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
- if(!isValidEmailAddress(emailAddress)) {
+ if (doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
+ if (!isValidEmailAddress(emailAddress)) {
showPlayerRegistrationFailedGUI(client, getLocaleString(client, "RegistrationFailedInvalidEmail"));
- return false
+ return false;
}
}
let accountData = createAccount(getPlayerName(client), password, emailAddress);
- if(!accountData) {
- if(doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
+ if (!accountData) {
+ if (doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
showPlayerRegistrationFailedGUI(client, getLocaleString(client, "RegistrationFailedCreateError"));
} else {
messagePlayerAlert(client, getLocaleString(client, "RegistrationFailedCreateError"));
@@ -1126,20 +1163,21 @@ function checkRegistration(client, password, confirmPassword = "", emailAddress
getPlayerData(client).loggedIn = true;
messagePlayerSuccess(client, getLocaleString(client, "RegistrationSuccess"));
- if(checkForSMTPModule() && getEmailConfig().enabled) {
+ if (checkForSMTPModule() && getEmailConfig().enabled) {
messagePlayerAlert(client, getLocaleString(client, "RegistrationEmailVerifyReminder"));
let emailVerificationCode = generateEmailVerificationCode();
setAccountEmailVerificationCode(getPlayerData(client).accountData, emailVerificationCode);
sendEmailVerificationEmail(client, emailVerificationCode);
logToConsole(LOG_WARN, `${getPlayerDisplayForConsole(client)} was sent a registration email verification code`);
- }
+ }
- if(doesServerHaveTesterOnlyEnabled() && !isPlayerATester(client)) {
- setTimeout(function() {
- client.disconnect();
+ if (doesServerHaveTesterOnlyEnabled() && !isPlayerATester(client)) {
+ setTimeout(function () {
+ getPlayerData(client).customDisconnectReason = "Kicked - Not a tester";
+ disconnectPlayer(client);
}, 5000);
- if(doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
+ if (doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
logToConsole(LOG_DEBUG, `[VRR.Account] ${getPlayerDisplayForConsole(client)} is being shown the error GUI (not a tester).`);
showPlayerErrorGUI(client, getLocaleString(client, "NotATester"), getLocaleString(client, "AccessDenied"));
return false;
@@ -1147,13 +1185,13 @@ function checkRegistration(client, password, confirmPassword = "", emailAddress
logToConsole(LOG_DEBUG, `[VRR.Account] ${getPlayerDisplayForConsole(client)} is being shown the "not a tester" error message (GUI disabled).`);
messagePlayerError(client, getLocaleString(client, "NotATester"));
return false;
- }
+ }
} else {
messagePlayerAlert(client, getLocaleString(client, "RegistrationCreateCharReminder"));
- if(doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
+ if (doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
showPlayerRegistrationSuccessGUI(client);
- showPlayerPromptGUI(client, getLocaleString(client, "NoCharactersMessage"), getLocaleString(client, "NoCharactersWindowTitle"), getLocaleString(client, "Yes"), getLocaleString(client, "No"));
+ showPlayerPrompt(client, getLocaleString(client, "NoCharactersMessage"), getLocaleString(client, "NoCharactersWindowTitle"), getLocaleString(client, "Yes"), getLocaleString(client, "No"));
getPlayerData(client).promptType = VRR_PROMPT_CREATEFIRSTCHAR;
} else {
messagePlayerAlert(client, getLocaleString(client, "NoCharactersChatMessage"), `{ALTCOLOUR}/newchar{MAINCOLOUR}`);
@@ -1164,27 +1202,53 @@ function checkRegistration(client, password, confirmPassword = "", emailAddress
// ===========================================================================
function checkAccountResetPasswordRequest(client, inputText) {
- if(getPlayerData(client).passwordResetState == VRR_RESETPASS_STATE_NONE) {
- if(toLowerCase(getPlayerData(client).accountData.emailAddress) != toLowerCase(inputText)) {
- logToConsole(LOG_DEBUG|LOG_WARN, `${getPlayerDisplayForConsole(client)} failed to reset their password (email not correct)`);
- return false;
+ if (!checkForSMTPModule() || !getEmailConfig().enabled) {
+ return false;
+ }
+
+ switch (getPlayerData(client).passwordResetState) {
+ case VRR_RESETPASS_STATE_EMAILCONFIRM: {
+ if (toLowerCase(getPlayerData(client).accountData.emailAddress) != toLowerCase(inputText)) {
+ logToConsole(LOG_INFO | LOG_WARN, `${getPlayerDisplayForConsole(client)} failed to reset their password (email not correct)`);
+ showPlayerErrorGUI(client, getLocaleString(client, "GUIErrorResetPasswordFailedInvalidEmail"), getLocaleString(client, "GUIErrorTitle"), getLocaleString(client, "GUIOkButton"));
+ return false;
+ }
+
+ let passwordResetCode = toUpperCase(generateEmailVerificationCode());
+ getPlayerData(client).passwordResetState = VRR_RESETPASS_STATE_CODEINPUT;
+ getPlayerData(client).passwordResetCode = passwordResetCode;
+ showPlayerResetPasswordCodeInputGUI(client);
+ sendPasswordResetEmail(client, passwordResetCode);
+ logToConsole(LOG_INFO, `${getPlayerDisplayForConsole(client)} submitted successful email for password reset. Sending email and awaiting verification code input (${passwordResetCode}) ...`);
+ break;
}
- let passwordResetCode = toUpperCase(generateEmailVerificationCode());
- getPlayerData(client).passwordResetState = VRR_RESETPASS_STATE_CODEINPUT;
- getPlayerData(client).passwordResetCode = passwordResetCode;
- sendPasswordResetEmail(client, passwordResetCode);
- showPlayerResetPasswordCodeInputGUI(client);
- logToConsole(LOG_DEBUG|LOG_WARN, `${getPlayerDisplayForConsole(client)} reset their password. Awaiting verification code input ...`);
- } else if(getPlayerData(client).passwordResetState == VRR_RESETPASS_STATE_CODEINPUT) {
- if(getPlayerData(client).passwordResetCode == toUpperCase(inputText)) {
- getPlayerData(client).passwordResetState = VRR_RESETPASS_STATE_SETPASS;
- showPlayerChangePasswordGUI(client);
- logToConsole(LOG_DEBUG, `${getPlayerDisplayForConsole(client)} entered the correct reset password verification code. Awaiting new password input ...`);
- } else {
- getPlayerData(client).passwordResetState = VRR_RESETPASS_STATE_NONE;
- client.disconnect();
- logToConsole(LOG_DEBUG|LOG_WARN, `${getPlayerDisplayForConsole(client)} failed to reset their password (verification code not correct)`);
+ case VRR_RESETPASS_STATE_CODEINPUT: {
+ logToConsole(LOG_INFO, `${getPlayerDisplayForConsole(client)} submitted code for password reset (${inputText}) ...`);
+ if (inputText != "") {
+ if (getPlayerData(client).passwordResetCode == toUpperCase(inputText)) {
+ getPlayerData(client).passwordResetState = VRR_RESETPASS_STATE_SETPASS;
+ showPlayerChangePasswordGUI(client);
+ logToConsole(LOG_INFO, `${getPlayerDisplayForConsole(client)} entered the correct reset password verification code. Awaiting new password input ...`);
+ } else {
+ getPlayerData(client).passwordResetAttemptsRemaining = getPlayerData(client).passwordResetAttemptsRemaining - 1;
+ logToConsole(LOG_INFO | LOG_WARN, `${getPlayerDisplayForConsole(client)} failed to reset their password (verification code not correct, ${getPlayerData(client).passwordResetAttemptsRemaining} attempts remaining)`);
+ if (getPlayerData(client).passwordResetAttemptsRemaining <= 0) {
+ logToConsole(LOG_INFO | LOG_WARN, `${getPlayerDisplayForConsole(client)} failed to reset their password (verification code not correct, no more attempts remaining, kicking ...)`);
+ getPlayerData(client).customDisconnectReason = "Kicked - Failed to login";
+ disconnectPlayer(client);
+ return false;
+ }
+ }
+ }
+ break;
+ }
+
+ case VRR_RESETPASS_STATE_NONE: {
+ logToConsole(LOG_INFO, `${getPlayerDisplayForConsole(client)} requested a password reset. Awaiting email input ...`);
+ showPlayerResetPasswordEmailInputGUI(client);
+ getPlayerData(client).passwordResetState = VRR_RESETPASS_STATE_EMAILCONFIRM;
+ break;
}
}
@@ -1194,11 +1258,11 @@ function checkAccountResetPasswordRequest(client, inputText) {
// ===========================================================================
function checkAccountChangePassword(client, newPassword, confirmNewPassword) {
- if(!isPlayerLoggedIn(client)) {
- if(getPlayerData(client).passwordResetState != VRR_RESETPASS_STATE_SETPASS) {
+ if (!isPlayerLoggedIn(client)) {
+ if (getPlayerData(client).passwordResetState != VRR_RESETPASS_STATE_SETPASS) {
//getPlayerData(client).passwordResetState = VRR_RESETPASS_STATE_NONE;
- //client.disconnect();
- logToConsole(LOG_DEBUG|LOG_WARN, `${getPlayerDisplayForConsole(client)} failed to change their password (not logged in or not using reset password)`);
+ //disconnectPlayer(client);
+ logToConsole(LOG_DEBUG | LOG_WARN, `${getPlayerDisplayForConsole(client)} failed to change their password (not logged in or not using reset password)`);
return false;
}
}
@@ -1208,7 +1272,7 @@ function checkAccountChangePassword(client, newPassword, confirmNewPassword) {
// return false;
//}
- if(!doesPasswordMeetRequirements(newPassword)) {
+ if (!doesPasswordMeetRequirements(newPassword)) {
let passwordRequirementsString = `${needsCapitals}, ${needsNumbers}, ${needsSymbols}`;
let needsCapitals = getLocaleString(client, "PasswordNeedsCapitals", "1");
let needsNumbers = getLocaleString(client, "PasswordNeedsNumbers", "1");
@@ -1216,13 +1280,13 @@ function checkAccountChangePassword(client, newPassword, confirmNewPassword) {
messagePlayerError(client, getLocaleString(client, "AccountPasswordNeedsImproved"));
messagePlayerInfo(client, getLocaleString(client, "PasswordNeedsBase", passwordRequirementsString));
- logToConsole(LOG_DEBUG|LOG_WARN, `${getPlayerDisplayForConsole(client)} failed to change their password (password doesn't mean requirements)`);
+ logToConsole(LOG_DEBUG | LOG_WARN, `${getPlayerDisplayForConsole(client)} failed to change their password (password doesn't mean requirements)`);
return false;
}
- if(newPassword != confirmNewPassword) {
+ if (newPassword != confirmNewPassword) {
messagePlayerError(client, getLocaleString(client, "PasswordsDontMatch"));
- logToConsole(LOG_DEBUG|LOG_WARN, `${getPlayerDisplayForConsole(client)} failed to change their password (password and confirm don't match)`);
+ logToConsole(LOG_DEBUG | LOG_WARN, `${getPlayerDisplayForConsole(client)} failed to change their password (password and confirm don't match)`);
return false;
}
@@ -1232,7 +1296,7 @@ function checkAccountChangePassword(client, newPassword, confirmNewPassword) {
saveAccountToDatabase(getPlayerData(client).accountData);
- if(getPlayerData(client).passwordResetState == VRR_RESETPASS_STATE_SETPASS) {
+ if (getPlayerData(client).passwordResetState == VRR_RESETPASS_STATE_SETPASS) {
getPlayerData(client).passwordResetState = VRR_RESETPASS_STATE_NONE;
}
@@ -1248,9 +1312,9 @@ function isValidEmailAddress(emailAddress) {
// ===========================================================================
-function saveAllClientsToDatabase() {
+function saveAllPlayersToDatabase() {
logToConsole(LOG_DEBUG, "[VRR.Account]: Saving all clients to database ...");
- getClients().forEach(function(client) {
+ getClients().forEach(function (client) {
savePlayerToDatabase(client);
});
logToConsole(LOG_DEBUG, "[VRR.Account]: All clients saved to database successfully!");
@@ -1259,22 +1323,22 @@ function saveAllClientsToDatabase() {
// ===========================================================================
function savePlayerToDatabase(client) {
- if(getPlayerData(client) == null) {
+ if (getPlayerData(client) == null) {
return false;
}
- if(!getPlayerData(client).loggedIn) {
+ if (!isPlayerLoggedIn(client)) {
return false;
}
logToConsole(LOG_DEBUG, `[VRR.Account]: Saving client ${getPlayerName(client)} to database ...`);
saveAccountToDatabase(getPlayerData(client).accountData);
- if(getPlayerData(client).currentSubAccount != -1) {
+ if (getPlayerData(client).currentSubAccount != -1) {
//let subAccountData = getPlayerCurrentSubAccount(client);
- if(client.player != null) {
- if(getPlayerData(client).returnToPosition != null) {
+ if (getPlayerPed(client) != null) {
+ if (getPlayerData(client).returnToPosition != null && getPlayerData(client).returnToType != VRR_RETURNTO_TYPE_ADMINGET) {
getPlayerCurrentSubAccount(client).spawnPosition = getPlayerData(client).returnToPosition;
getPlayerCurrentSubAccount(client).spawnHeading = getPlayerData(client).returnToHeading.z;
getPlayerCurrentSubAccount(client).interior = getPlayerData(client).returnToInterior;
@@ -1296,53 +1360,74 @@ function savePlayerToDatabase(client) {
// ===========================================================================
function initClient(client) {
- if(isConsole(client)) {
+ logToConsole(LOG_DEBUG, `[VRR.Account] Initializing client ${getPlayerDisplayForConsole(client)} ...`);
+
+ if (isConsole(client)) {
+ logToConsole(LOG_DEBUG | LOG_ERROR, `[VRR.Account] Client initialization failed for ${getPlayerDisplayForConsole(client)}! (is console client)`);
return false;
}
- if(client.getData("vrr.isInitialized") != null || client.getData("vrr.isInitialized") == true) {
+ logToConsole(LOG_DEBUG, `[VRR.Account] Initializing client ${getPlayerDisplayForConsole(client)} ...`);
+
+ if (playerInitialized[client.index] == true) {
+ logToConsole(LOG_DEBUG | LOG_ERROR, `[VRR.Account] Client initialization failed for ${getPlayerDisplayForConsole(client)}! (already initialized)`);
return false;
}
- client.setData("vrr.isInitialized", true, false);
+ setEntityData(client, "vrr.isInitialized", true, false);
sendPlayerGUIColours(client);
+
+ logToConsole(LOG_DEBUG, `[VRR.Account] Initializing GUI for ${getPlayerDisplayForConsole(client)} ...`);
sendPlayerGUIInit(client);
updatePlayerSnowState(client);
- showConnectCameraToPlayer(client);
+ //logToConsole(LOG_DEBUG, `[VRR.Account] Showing connect camera to ${getPlayerDisplayForConsole(client)} ...`);
+ //showConnectCameraToPlayer(client);
messageClient(`Please wait ...`, client, getColourByName("softGreen"));
- setTimeout(function() {
- if(client != null) {
-
+ logToConsole(LOG_DEBUG, `[VRR.Account] Waiting for 2.5 seconds to prevent race attack ...`);
+ setTimeout(function () {
+ if (client != null) {
clearChatBox(client);
+ logToConsole(LOG_DEBUG, `[VRR.Account] Loading account for ${getPlayerDisplayForConsole(client)}`);
let tempAccountData = loadAccountFromName(getPlayerName(client), true);
+
+ logToConsole(LOG_DEBUG, `[VRR.Account] Loading subaccounts for ${getPlayerDisplayForConsole(client)}`);
let tempSubAccounts = loadSubAccountsFromAccount(tempAccountData.databaseId);
- getServerData().clients[client.index] = new ClientData(client, tempAccountData, tempSubAccounts);
+ getServerData().clients[getPlayerId(client)] = new ClientData(client, tempAccountData, tempSubAccounts);
- getServerData().clients[client.index].sessionId = saveConnectionToDatabase(client);
- getServerData().clients[client.index].connectTime = getCurrentUnixTimestamp();
+ getServerData().clients[getPlayerId(client)].sessionId = saveConnectionToDatabase(client);
+ getServerData().clients[getPlayerId(client)].connectTime = getCurrentUnixTimestamp();
requestClientInfo(client);
- if(tempAccountData != false) {
- if(isAccountAutoIPLoginEnabled(tempAccountData) && getPlayerData(client).accountData.ipAddress == client.ip) {
+ if (tempAccountData != false) {
+ sendPlayerLocaleId(client, getPlayerData(client).accountData.locale);
+ if (isAccountAutoIPLoginEnabled(tempAccountData) && getPlayerData(client).accountData.ipAddress == getPlayerIP(client)) {
messagePlayerAlert(client, getLocaleString(client, "AutoLoggedInIP"));
loginSuccess(client);
+ playRadioStreamForPlayer(client, getServerIntroMusicURL(), true, getPlayerStreamingRadioVolume(client));
} else {
- if(doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
+ if (doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
logToConsole(LOG_DEBUG, `[VRR.Account] ${getPlayerDisplayForConsole(client)} is being shown the login GUI.`);
showPlayerLoginGUI(client);
} else {
logToConsole(LOG_DEBUG, `[VRR.Account] ${getPlayerDisplayForConsole(client)} is being shown the login message (GUI disabled).`);
- messagePlayerNormal(client, getLocaleString(client, "WelcomeBack", getServerName(), getPlayerName(client), "/login"),getColourByName("softGreen"));
+ messagePlayerNormal(client, getLocaleString(client, "WelcomeBack", getServerName(), getPlayerName(client), "/login"), getColourByName("softGreen"));
+
+ //if(checkForGeoIPModule()) {
+ // let iso = module.geoip.getCountryISO(getPlayerIP(client));
+ // let localeId = getLocaleFromCountryISO(iso);
+ //}
+ //showGameMessage(client, getLocaleString(client, "LocaleOffer", `/lang ${getLocaleData(localeId)[2]}`), getColourByName("white"), 10000, "Roboto");
}
playRadioStreamForPlayer(client, getServerIntroMusicURL(), true, getPlayerStreamingRadioVolume(client));
}
} else {
- if(doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
+ sendPlayerLocaleId(client, 0);
+ if (doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
logToConsole(LOG_DEBUG, `[VRR.Account] ${getPlayerDisplayForConsole(client)} is being shown the register GUI.`);
showPlayerRegistrationGUI(client);
} else {
@@ -1352,9 +1437,10 @@ function initClient(client) {
playRadioStreamForPlayer(client, getServerIntroMusicURL(), true, getPlayerStreamingRadioVolume(client));
}
- getServerData().clients[client.index].keyBinds = loadAccountKeybindsFromDatabase(getServerData().clients[client.index].accountData.databaseId);
+ getServerData().clients[getPlayerId(client)].keyBinds = loadAccountKeybindsFromDatabase(getServerData().clients[getPlayerId(client)].accountData.databaseId);
sendAccountKeyBindsToClient(client);
}
+
}, 2500);
}
@@ -1362,9 +1448,9 @@ function initClient(client) {
function saveConnectionToDatabase(client) {
let dbConnection = connectToDatabase();
- if(dbConnection) {
+ if (dbConnection) {
let safeName = escapeDatabaseString(dbConnection, getPlayerName(client));
- let dbQueryString = `INSERT INTO conn_main (conn_when_connect, conn_server, conn_script_version, conn_game_version, conn_client_version, conn_name, conn_ip) VALUES (NOW(), ${getServerConfig().databaseId}, '${scriptVersion}', '${client.gameVersion}', '0.0.0', '${safeName}', '${client.ip}')`;
+ let dbQueryString = `INSERT INTO conn_main (conn_when_connect, conn_server, conn_script_version, conn_game_version, conn_client_version, conn_name, conn_ip) VALUES (NOW(), ${getServerConfig().databaseId}, '${scriptVersion}', '${getPlayerGameVersion(client)}', '0.0.0', '${safeName}', '${getPlayerIP(client)}')`;
queryDatabase(dbConnection, dbQueryString);
return getDatabaseInsertId(dbConnection);
}
@@ -1374,7 +1460,7 @@ function saveConnectionToDatabase(client) {
// ===========================================================================
function createDefaultAccountServerData(accountDatabaseId) {
- for(let i = 1 ; i <= 5 ; i++) {
+ for (let i = 1; i <= 5; i++) {
let dbQueryString = `INSERT INTO acct_svr (acct_svr_acct, acct_svr_svr) VALUES (${accountDatabaseId}, ${i})`;
quickDatabaseQuery(dbQueryString);
}
@@ -1390,7 +1476,7 @@ function loadAccountKeybindsFromDatabase(accountDatabaseID) {
let dbQuery = null;
let dbAssoc;
- for(let i in getGlobalConfig().keyBind.defaultKeyBinds) {
+ for (let i in getGlobalConfig().keyBind.defaultKeyBinds) {
let tempKeyBindData = new KeyBindData(false);
tempKeyBindData.databaseId = -1;
tempKeyBindData.key = getKeyIdFromParams(getGlobalConfig().keyBind.defaultKeyBinds[i].keyName);
@@ -1399,12 +1485,12 @@ function loadAccountKeybindsFromDatabase(accountDatabaseID) {
tempAccountKeybinds.push(tempKeyBindData);
}
- if(accountDatabaseID != 0 && typeof accountDatabaseId != "undefined") {
- if(dbConnection) {
+ if (accountDatabaseID != 0 && typeof accountDatabaseId != "undefined") {
+ if (dbConnection) {
dbQuery = queryDatabase(dbConnection, `SELECT * FROM acct_hotkey WHERE acct_hotkey_enabled = 1 AND acct_hotkey_acct = ${accountDatabaseID} AND acct_hotkey_server = ${getServerId()}`);
- if(dbQuery) {
- if(dbQuery.numRows > 0) {
- while(dbAssoc = fetchQueryAssoc(dbQuery)) {
+ if (dbQuery) {
+ if (dbQuery.numRows > 0) {
+ while (dbAssoc = fetchQueryAssoc(dbQuery)) {
let tempAccountKeyBindData = new KeyBindData(dbAssoc);
tempAccountKeybinds.push(tempAccountKeyBindData);
logToConsole(LOG_DEBUG, `[VRR.Account]: Account keybind '${tempAccountKeyBindData.databaseId}' (Key ${tempAccountKeyBindData.key} '${toUpperCase(getKeyNameFromId(tempAccountKeyBindData.key))}') loaded from database successfully!`);
@@ -1430,11 +1516,11 @@ function loadAccountStaffNotesFromDatabase(accountDatabaseID) {
let dbQuery = null;
let dbAssoc;
- if(dbConnection) {
+ if (dbConnection) {
dbQuery = queryDatabase(dbConnection, "SELECT * FROM `acct_note` WHERE `acct_note_deleted` = 0 AND `acct_note_acct` = " + toString(accountDatabaseID));
- if(dbQuery) {
- if(dbQuery.numRows > 0) {
- while(dbAssoc = fetchQueryAssoc(dbQuery)) {
+ if (dbQuery) {
+ if (dbQuery.numRows > 0) {
+ while (dbAssoc = fetchQueryAssoc(dbQuery)) {
let tempAccountStaffNoteData = new AccountStaffNoteData(dbAssoc);
tempAccountStaffNotes.push(tempAccountStaffNoteData);
logToConsole(LOG_DEBUG, `[VRR.Account]: Account staff note '${tempAccountStaffNoteData.databaseId}' loaded from database successfully!`);
@@ -1459,11 +1545,11 @@ function loadAccountContactsFromDatabase(accountDatabaseID) {
let dbQuery = null;
let dbAssoc;
- if(dbConnection) {
+ if (dbConnection) {
dbQuery = queryDatabase(dbConnection, "SELECT * FROM `acct_contact` WHERE `acct_contact_deleted` = 0 AND `acct_contact_acct` = " + toString(accountDatabaseID));
- if(dbQuery) {
- if(dbQuery.numRows > 0) {
- while(dbAssoc = fetchQueryAssoc(dbQuery)) {
+ if (dbQuery) {
+ if (dbQuery.numRows > 0) {
+ while (dbAssoc = fetchQueryAssoc(dbQuery)) {
let tempAccountContactData = new AccountContactData(dbAssoc);
tempAccountContacts.push(tempAccountContactData);
logToConsole(LOG_DEBUG, `[VRR.Account]: Account contact '${tempAccountContactData.databaseId}' loaded from database successfully!`);
@@ -1488,11 +1574,11 @@ function loadAccountMessagesFromDatabase(accountDatabaseID) {
let dbQuery = null;
let dbAssoc;
- if(dbConnection) {
+ if (dbConnection) {
dbQuery = queryDatabase(dbConnection, "SELECT * FROM `acct_msg` WHERE `acct_msg_deleted` = 0 AND `acct_msg_acct` = " + toString(accountDatabaseID));
- if(dbQuery) {
- if(dbQuery.numRows > 0) {
- while(dbAssoc = fetchQueryAssoc(dbQuery)) {
+ if (dbQuery) {
+ if (dbQuery.numRows > 0) {
+ while (dbAssoc = fetchQueryAssoc(dbQuery)) {
let tempAccountMessageData = new AccountContactData(dbAssoc);
tempAccountMessages.push(tempAccountMessageData);
logToConsole(LOG_DEBUG, `[VRR.Account]: Account contact '${tempAccountMessageData.databaseId}' loaded from database successfully!`);
@@ -1551,14 +1637,14 @@ function isAccountEmailVerified(accountData) {
// ===========================================================================
-function isAccountTwoFactorAuthenticationVerified(accountData) {
- return hasBitFlag(accountData.flags.moderation, getModerationFlagValue("TwoFactorAuthVerified"));
+function doesPlayerHaveTwoFactorAuthEnabled(client) {
+ return hasBitFlag(getPlayerData(client).accountData.settings, getAccountSettingsFlagValue("TwoStepAuth"));
}
// ===========================================================================
-function doesPlayerHaveTwoFactorAuthEnabled(client) {
- return hasBitFlag(getPlayerData(client).accountData.flags.settings, getAccountSettingsFlagValue("TwoFactorAuth"));
+function doesPlayerHaveLoginAlertsEnabled(client) {
+ return hasBitFlag(getPlayerData(client).accountData.settings, getAccountSettingsFlagValue("AuthAttemptAlert"));
}
// ===========================================================================
@@ -1616,7 +1702,7 @@ function verifyAccountEmail(accountData, verificationCode) {
// ===========================================================================
-function sendAccountLoginFailedNotification(emailAddress, name, ip, game = getServerGame()) {
+function sendAccountLoginFailedNotification(emailAddress, name, ip, game = getGame()) {
let countryName = module.geoip.getCountryName(getGlobalConfig().geoIPCountryDatabaseFilePath, ip);
let subDivisionName = module.geoip.getSubdivisionName(getGlobalConfig().geoIPCityDatabaseFilePath, ip);
let cityName = module.geoip.getCityName(getGlobalConfig().geoIPCityDatabaseFilePath, ip);
@@ -1624,9 +1710,9 @@ function sendAccountLoginFailedNotification(emailAddress, name, ip, game = getSe
let emailBodyText = getEmailConfig().bodyContent.accountAuthFailAlert;
emailBodyText = emailBodyText.replace("{GAMENAME}", getGameName(game));
emailBodyText = emailBodyText.replace("{IPADDRESS}", ip);
- emailBodyText = emailBodyText.replace("{LOCATION}", `${cityName}, ${countryName}, ${countryName}`);
+ emailBodyText = emailBodyText.replace("{LOCATION}", `${cityName}, ${subDivisionName}, ${countryName}`);
emailBodyText = emailBodyText.replace("{SERVERNAME}", getServerName());
- emailBodyText = emailBodyText.replace("{TIMESTAMP}", date.toLocaleString('en-US'));
+ emailBodyText = emailBodyText.replace("{TIMESTAMP}", new Date().toLocaleString('en-US'));
sendEmail(emailAddress, name, `Login failed on ${getServerName()}`, emailBodyText);
return true;
@@ -1634,7 +1720,7 @@ function sendAccountLoginFailedNotification(emailAddress, name, ip, game = getSe
// ===========================================================================
-function sendAccountLoginSuccessNotification(emailAddress, name, ip, game = getServerGame()) {
+function sendAccountLoginSuccessNotification(emailAddress, name, ip, game = getGame()) {
let countryName = module.geoip.getCountryName(getGlobalConfig().geoIPCountryDatabaseFilePath, ip);
let subDivisionName = module.geoip.getSubdivisionName(getGlobalConfig().geoIPCityDatabaseFilePath, ip);
let cityName = module.geoip.getCityName(getGlobalConfig().geoIPCityDatabaseFilePath, ip);
@@ -1644,9 +1730,9 @@ function sendAccountLoginSuccessNotification(emailAddress, name, ip, game = getS
emailBodyText = emailBodyText.replace("{IPADDRESS}", ip);
emailBodyText = emailBodyText.replace("{LOCATION}", `${cityName}, ${subDivisionName}, ${countryName}`);
emailBodyText = emailBodyText.replace("{SERVERNAME}", getServerName());
- emailBodyText = emailBodyText.replace("{TIMESTAMP}", date.toLocaleString('en-US'));
+ emailBodyText = emailBodyText.replace("{TIMESTAMP}", new Date().toLocaleString('en-US'));
- sendEmail(emailAddress, name, `Login failed on ${getServerName()}`, emailBodyText);
+ sendEmail(emailAddress, name, `Login successful on ${getServerName()}`, emailBodyText);
return true;
}
@@ -1665,14 +1751,15 @@ function doesPlayerHaveRandomTipsDisabled(client) {
// ===========================================================================
function checkPlayerTwoFactorAuthentication(client, authCode) {
- if(getPlayerData(client).twoFactorAuthCode != "") {
- if(toUpperCase(getPlayerData(client).twoFactorAuthCode) == toUpperCase(authCode)) {
+ if (getPlayerData(client).twoFactorAuthCode != "") {
+ if (toUpperCase(getPlayerData(client).twoFactorAuthCode) == toUpperCase(authCode)) {
loginSuccess(client);
return true;
}
}
- client.disconnect();
+ getPlayerData(client).customDisconnectReason = "Kicked - Failed to login";
+ disconnectPlayer(client);
return false;
}
@@ -1682,4 +1769,16 @@ function isPlayerATester(client) {
}
+// ===========================================================================
+
+function sendAccountTwoFactorAuthCode(emailAddress, name, twoFactorAuthCode) {
+ let emailBodyText = getEmailConfig().bodyContent.twoFactorAuthentication;
+ emailBodyText = emailBodyText.replace("{2FACODE}", twoFactorAuthCode);
+ emailBodyText = emailBodyText.replace("{GAMENAME}", getGameName(getGame()));
+ emailBodyText = emailBodyText.replace("{SERVERNAME}", getServerName());
+
+ sendEmail(emailAddress, name, `Login code for ${getServerName()}`, emailBodyText);
+ return true;
+}
+
// ===========================================================================
\ No newline at end of file
diff --git a/scripts/server/animation.js b/scripts/server/animation.js
index 4c18f00f..6d722ef9 100644
--- a/scripts/server/animation.js
+++ b/scripts/server/animation.js
@@ -20,17 +20,17 @@ function playPlayerAnimationCommand(command, params, client) {
return false;
}
-let animationSlot = getAnimationFromParams(getParam(params, " ", 1));
- let animationPositionOffset = 1;
+ let animationSlot = getAnimationFromParams(getParam(params, " ", 1));
+ let animationPositionOffset = 1;
if(!animationSlot) {
- messagePlayerError(client, getLocaleString(client, "AnimationNotFound"));
- messagePlayerInfo(client, getLocaleString(client, "AnimationHelpTip"), `{ALTCOLOUR}/animlist{MAINCOLOUR}`);
+ messagePlayerError(client, getLocaleString(client, "InvalidAnimation"));
+ messagePlayerInfo(client, getLocaleString(client, "AnimationCommandTip", `{ALTCOLOUR}/animlist{MAINCOLOUR}`));
return false;
}
if(toInteger(animationPositionOffset) < 0 || toInteger(animationPositionOffset) > 3) {
- messagePlayerError(client, getLocaleString(client, "AnimationInvalidDistance"));
+ messagePlayerError(client, getLocaleString(client, "InvalidAnimationDistance"));
return false;
}
@@ -39,7 +39,7 @@ let animationSlot = getAnimationFromParams(getParam(params, " ", 1));
}
if(isPlayerHandCuffed(client) || isPlayerTazed(client) || isPlayerInForcedAnimation(client)) {
- messagePlayerError(client, `You aren't able to do that`);
+ messagePlayerError(client, getLocaleString(client, "UnableToDoThat"));
return false;
}
@@ -51,26 +51,26 @@ let animationSlot = getAnimationFromParams(getParam(params, " ", 1));
function stopPlayerAnimationCommand(command, params, client) {
if(isPlayerHandCuffed(client) || isPlayerTazed(client) || isPlayerInForcedAnimation(client)) {
- messagePlayerError(client, `You aren't able to do that`);
+ messagePlayerError(client, getLocaleString(client, "UnableToDoThat"));
return false;
}
setPlayerPosition(client, getPlayerData(client).currentAnimationPositionReturnTo);
- makePedStopAnimation(getPlayerData(client).ped);
+ makePedStopAnimation(getPlayerPed(client));
getPlayerData(client).currentAnimation = -1;
getPlayerData(client).currentAnimationPositionOffset = false;
getPlayerData(client).currentAnimationPositionReturnTo = false;
- getPlayerData(client).animationStart = 0;
+ getPlayerData(client).animationStart = 0;
getPlayerData(client).animationForced = false;
- setPlayerMouseCameraState(client, false);
+ //setPlayerMouseCameraState(client, false);
}
// ===========================================================================
function showAnimationListCommand(command, params, client) {
- let animList = getGameConfig().animations[getServerGame()].map(function(x) { return x[0]; });
+ let animList = getGameConfig().animations[getGame()].map(function(x) { return x.name; });
let chunkedList = splitArrayIntoChunks(animList, 10);
@@ -87,8 +87,8 @@ function showAnimationListCommand(command, params, client) {
* @param {number} animationSlot - The slot index of the animation
* @return {Array} The animation's data (array)
*/
-function getAnimationData(animationSlot, gameId = getServerGame()) {
- return getGameConfig().animations[gameId][animationSlot];
+function getAnimationData(animationSlot, gameId = getGame()) {
+ return getGameConfig().animations[gameId][animationSlot];
}
// ===========================================================================
@@ -100,14 +100,14 @@ function isPlayerInForcedAnimation(client) {
// ===========================================================================
function makePlayerPlayAnimation(client, animationSlot, offsetPosition = 1) {
- getPlayerData(client).currentAnimation = animationSlot;
+ getPlayerData(client).currentAnimation = animationSlot;
getPlayerData(client).currentAnimationPositionOffset = offsetPosition;
getPlayerData(client).currentAnimationPositionReturnTo = getPlayerPosition(client);
- getPlayerData(client).animationStart = getCurrentUnixTimestamp();
+ getPlayerData(client).animationStart = getCurrentUnixTimestamp();
getPlayerData(client).animationForced = false;
- makePedPlayAnimation(getPlayerData(client).ped, animationSlot, offsetPosition);
-
+ makePedPlayAnimation(getPlayerPed(client), animationSlot, offsetPosition);
+ setEntityData(getPlayerPed(client), "vrr.anim", animationSlot, true);
//if(getAnimationData(animationSlot)[9] != VRR_ANIMMOVE_NONE) {
// if(getGame() < VRR_GAME_GTA_SA) {
// setPlayerMouseCameraState(client, true);
@@ -118,40 +118,41 @@ function makePlayerPlayAnimation(client, animationSlot, offsetPosition = 1) {
// ===========================================================================
function forcePlayerPlayAnimation(client, animationSlot, offsetPosition = 1) {
- getPlayerData(client).currentAnimation = animationSlot;
+ getPlayerData(client).currentAnimation = animationSlot;
getPlayerData(client).currentAnimationPositionOffset = offsetPosition;
getPlayerData(client).currentAnimationPositionReturnTo = getPlayerPosition(client);
- getPlayerData(client).animationStart = getCurrentUnixTimestamp();
+ getPlayerData(client).animationStart = getCurrentUnixTimestamp();
getPlayerData(client).animationForced = true;
setPlayerControlState(client, false);
- forcePedAnimation(getPlayerData(client).ped, animationSlot, offsetPosition);
+ forcePedAnimation(getPlayerPed(client), animationSlot, offsetPosition);
}
// ===========================================================================
function makePlayerStopAnimation(client) {
//setPlayerPosition(client, getPlayerData(client).currentAnimationPositionReturnTo);
- makePedStopAnimation(getPlayerData(client).ped);
+ makePedStopAnimation(getPlayerPed(client));
getPlayerData(client).currentAnimation = -1;
getPlayerData(client).currentAnimationPositionOffset = false;
getPlayerData(client).currentAnimationPositionReturnTo = false;
- getPlayerData(client).animationStart = 0;
+ getPlayerData(client).animationStart = 0;
getPlayerData(client).animationForced = false;
}
// ===========================================================================
function getAnimationFromParams(params) {
+ let animations = getGameConfig().animations[getGame()];
if(isNaN(params)) {
- for(let i in getGameConfig().animations[getServerGame()]) {
- if(toLowerCase(getGameConfig().animations[getServerGame()][i][0]).indexOf(toLowerCase(params)) != -1) {
+ for(let i in animations) {
+ if(toLowerCase(animations[i].name).indexOf(toLowerCase(params)) != -1) {
return i;
}
}
} else {
- if(typeof getGameConfig().animations[getServerGame()][params] != "undefined") {
+ if(typeof getGameConfig().animations[getGame()][params] != "undefined") {
return toInteger(params);
}
}
diff --git a/scripts/server/anticheat.js b/scripts/server/anticheat.js
index 38ff2b63..9cf7fafb 100644
--- a/scripts/server/anticheat.js
+++ b/scripts/server/anticheat.js
@@ -8,14 +8,14 @@
// ===========================================================================
function initAntiCheatScript() {
- logToConsole(LOG_DEBUG, "[VRR.AntiCheat]: Initializing anticheat script ...");
+ logToConsole(LOG_DEBUG, "[VRR.AntiCheat]: Initializing anticheat script ...");
logToConsole(LOG_DEBUG, "[VRR.AntiCheat]: Anticheat script initialized!");
}
// ===========================================================================
function clearPlayerStateToEnterExitProperty(client) {
- if(getPlayerData(client).pedState != VRR_PEDSTATE_READY) {
+ if(getPlayerData(client).pedState != VRR_PEDSTATE_READY) {
if(getPlayerData(client).pedState == VRR_PEDSTATE_ENTERINGVEHICLE) {
sendPlayerClearPedState(client);
getPlayerData(client).pedState = VRR_PEDSTATE_READY;
diff --git a/scripts/server/ban.js b/scripts/server/ban.js
index badbe794..9c983e05 100644
--- a/scripts/server/ban.js
+++ b/scripts/server/ban.js
@@ -25,7 +25,7 @@ class BanData {
this.name = "";
this.reason = "";
- if(dbAssoc) {
+ if (dbAssoc) {
this.databaseId = toInteger(dbAssoc["ban_id"]);
this.type = dbAssoc["ban_type"];
this.detail = toInteger(dbAssoc["ban_detail"]);
@@ -38,291 +38,283 @@ class BanData {
// ===========================================================================
function initBanScript() {
- logToConsole(LOG_INFO, "[VRR.Ban]: Initializing ban script ...");
- logToConsole(LOG_INFO, "[VRR.Ban]: Ban script initialized!");
+ logToConsole(LOG_INFO, "[VRR.Ban]: Initializing ban script ...");
+ logToConsole(LOG_INFO, "[VRR.Ban]: Ban script initialized!");
}
// ===========================================================================
function accountBanCommand(command, params, client) {
- if(areParamsEmpty(params)) {
+ if (areParamsEmpty(params)) {
messagePlayerSyntax(client, getCommandSyntaxText(command));
return false;
}
- let splitParams = params.split(" ");
- let targetClient = getPlayerFromParams(getParam(params, " ", 1));
- let reason = splitParams.slice(1).join(" ");
+ let splitParams = params.split(" ");
+ let targetClient = getPlayerFromParams(getParam(params, " ", 1));
+ let reason = splitParams.slice(1).join(" ");
- if(!targetClient) {
- messagePlayerError(client, "That player is not connected!")
- return false;
- }
-
- // Prevent banning admins with really high permissions
- if(doesPlayerHaveStaffPermission(targetClient, "ManageServer") || doesPlayerHaveStaffPermission(targetClient, "Developer")) {
- messagePlayerError(client, getLocaleString(client, "CantBanPlayer"));
- return false;
+ if (!targetClient) {
+ messagePlayerError(client, "That player is not connected!")
+ return false;
}
- logToConsole(LOG_WARN, `[VRR.Ban]: ${getPlayerDisplayForConsole(targetClient)} (${getPlayerData(targetClient).accountData.name}) account was banned by ${getPlayerDisplayForConsole(client)}. Reason: ${reason}`);
+ // Prevent banning admins with really high permissions
+ if (doesPlayerHaveStaffPermission(targetClient, "ManageServer") || doesPlayerHaveStaffPermission(targetClient, "Developer")) {
+ messagePlayerError(client, getLocaleString(client, "CantBanPlayer"));
+ return false;
+ }
- messageAdminAction(`{ALTCOLOUR}${getPlayerData(targetClient).currentSubAccountData.name} {MAINCOLOUR}has been account banned.`);
+ logToConsole(LOG_WARN, `[VRR.Ban]: ${getPlayerDisplayForConsole(targetClient)} (${getPlayerData(targetClient).accountData.name}) account was banned by ${getPlayerDisplayForConsole(client)}. Reason: ${reason}`);
+
+ announceAdminAction(`PlayerAccountBanned`, `{ALTCOLOUR}${getPlayerName(targetClient)}{MAINCOLOUR}`);
banAccount(getPlayerData(targetClient).accountData.databaseId, getPlayerData(client).accountData.databaseId, reason);
- disconnectPlayer(client);
+
+ getPlayerData(targetClient).customDisconnectReason = `Banned - ${reason}`;
+ disconnectPlayer(targetClient);
}
// ===========================================================================
function subAccountBanCommand(command, params, client, fromDiscord) {
- if(areParamsEmpty(params)) {
+ if (areParamsEmpty(params)) {
messagePlayerSyntax(client, getCommandSyntaxText(command));
return false;
}
- let splitParams = params.split(" ");
- let targetClient = getPlayerFromParams(getParam(params, " ", 1));
- let reason = splitParams.slice(1).join(" ");
+ let splitParams = params.split(" ");
+ let targetClient = getPlayerFromParams(getParam(params, " ", 1));
+ let reason = splitParams.slice(1).join(" ");
- if(!targetClient) {
- messagePlayerError(client, "That player is not connected!")
- return false;
- }
+ if (!targetClient) {
+ messagePlayerError(client, "That player is not connected!")
+ return false;
+ }
// Prevent banning admins with really high permissions
- if(doesPlayerHaveStaffPermission(targetClient, "ManageServer") || doesPlayerHaveStaffPermission(targetClient, "Developer")) {
+ if (doesPlayerHaveStaffPermission(targetClient, "ManageServer") || doesPlayerHaveStaffPermission(targetClient, "Developer")) {
messagePlayerError(client, getLocaleString(client, "CantBanPlayer"));
return false;
- }
+ }
- logToConsole(LOG_WARN, `[VRR.Ban]: ${getPlayerDisplayForConsole(targetClient)} (${getPlayerData(targetClient).accountData.name})'s subaccount was banned by ${getPlayerDisplayForConsole(client)}. Reason: ${reason}`);
+ logToConsole(LOG_WARN, `[VRR.Ban]: ${getPlayerDisplayForConsole(targetClient)} (${getPlayerData(targetClient).accountData.name})'s subaccount was banned by ${getPlayerDisplayForConsole(client)}. Reason: ${reason}`);
- messageAdminAction(`{ALTCOLOUR}${getPlayerData(targetClient).currentSubAccountData.name} {MAINCOLOUR}has been character banned.`);
- banSubAccount(getPlayerData(targetClient).currentSubAccountData.databaseId, getPlayerData(client).accountData.databaseId, reason);
+ announceAdminAction(`PlayerCharacterBanned`, `{ALTCOLOUR}${getPlayerName(targetClient)}{MAINCOLOUR}`);
+ banSubAccount(getPlayerData(targetClient).currentSubAccountData.databaseId, getPlayerData(client).accountData.databaseId, reason);
- disconnectPlayer(client);
+ getPlayerData(targetClient).customDisconnectReason = `Banned - ${reason}`;
+ disconnectPlayer(targetClient);
}
// ===========================================================================
function ipBanCommand(command, params, client, fromDiscord) {
- if(areParamsEmpty(params)) {
+ if (areParamsEmpty(params)) {
messagePlayerSyntax(client, getCommandSyntaxText(command));
return false;
- }
+ }
- let splitParams = params.split(" ");
- let targetClient = getPlayerFromParams(getParam(params, " ", 1));
- let reason = splitParams.slice(1).join(" ");
+ let splitParams = params.split(" ");
+ let targetClient = getPlayerFromParams(getParam(params, " ", 1));
+ let reason = splitParams.slice(1).join(" ");
- if(!targetClient) {
- messagePlayerError(client, "That player is not connected!")
- return false;
- }
+ if (!targetClient) {
+ messagePlayerError(client, "That player is not connected!")
+ return false;
+ }
// Prevent banning admins with really high permissions
- if(doesPlayerHaveStaffPermission(targetClient, "ManageServer") || doesPlayerHaveStaffPermission(targetClient, "Developer")) {
+ if (doesPlayerHaveStaffPermission(targetClient, "ManageServer") || doesPlayerHaveStaffPermission(targetClient, "Developer")) {
messagePlayerError(client, getLocaleString(client, "CantBanPlayer"));
return false;
- }
+ }
- messageAdminAction(`{ALTCOLOUR}${getPlayerData(targetClient).currentSubAccountData.name} {MAINCOLOUR}has been IP banned.`);
- banIPAddress(targetClient.ip, getPlayerData(client).accountData.databaseId, reason);
+ announceAdminAction(`PlayerIPBanned`, `{ALTCOLOUR}${getPlayerName(targetClient)}{MAINCOLOUR}`);
+ banIPAddress(getPlayerIP(targetClient), getPlayerData(client).accountData.databaseId, reason);
- server.banIP(targetClient.ip);
- targetClient.disconnect();
+ getPlayerData(targetClient).customDisconnectReason = `IP Banned - ${reason}`;
+ serverBanIP(getPlayerIP(targetClient));
+ disconnectPlayer(targetClient);
}
// ===========================================================================
function subNetBanCommand(command, params, client, fromDiscord) {
- if(areParamsEmpty(params)) {
+ if (areParamsEmpty(params)) {
messagePlayerSyntax(client, getCommandSyntaxText(command));
return false;
- }
+ }
- let splitParams = params.split(" ");
- let targetClient = getPlayerFromParams(getParam(params, " ", 1));
- let octetAmount = Number(getParam(params, " ", 2));
- let reason = splitParams.slice(2).join(" ");
+ let splitParams = params.split(" ");
+ let targetClient = getPlayerFromParams(getParam(params, " ", 1));
+ let octetAmount = Number(getParam(params, " ", 2));
+ let reason = splitParams.slice(2).join(" ");
- if(!targetClient) {
- messagePlayerError(client, "That player is not connected!")
- return false;
- }
+ if (!targetClient) {
+ messagePlayerError(client, "That player is not connected!")
+ return false;
+ }
// Prevent banning admins with really high permissions
- if(doesPlayerHaveStaffPermission(targetClient, "ManageServer") || doesPlayerHaveStaffPermission(targetClient, "Developer")) {
+ if (doesPlayerHaveStaffPermission(targetClient, "ManageServer") || doesPlayerHaveStaffPermission(targetClient, "Developer")) {
messagePlayerError(client, getLocaleString(client, "CantBanPlayer"));
return false;
- }
+ }
- messageAdminAction(`{ALTCOLOUR}${getPlayerData(targetClient).currentSubAccountData.name} {MAINCOLOUR}has been subnet banned`);
- banSubNet(targetClient.ip, getSubNet(targetClient.ip, octetAmount), getPlayerData(client).accountData.databaseId, reason);
+ announceAdminAction(`PlayerSubNetBanned`, `{ALTCOLOUR}${getPlayerName(client)}{MAINCOLOUR}`);
+ banSubNet(getPlayerIP(targetClient), getSubNet(getPlayerIP(targetClient), octetAmount), getPlayerData(client).accountData.databaseId, reason);
- server.banIP(targetClient.ip);
+ getPlayerData(client).customDisconnectReason = `IP Subnet Banned - ${reason}`;
+ serverBanIP(getPlayerIP(targetClient));
}
// ===========================================================================
function banAccount(accountId, adminAccountId, reason) {
- let dbConnection = connectToDatabase();
- if(dbConnection) {
- let safeReason = dbConnection.escapetoString(reason);
- let dbQuery = queryDatabase(dbConnection, `INSERT INTO ban_main (ban_type, ban_detail, ban_who_banned, ban_reason) VALUES (${VRR_BANTYPE_ACCOUNT}, ${accountId}, ${adminAccountId}, '${safeReason}');`);
- freeDatabaseQuery(dbQuery);
- dbConnection.close();
- return true;
- }
+ let dbConnection = connectToDatabase();
+ if (dbConnection) {
+ let safeReason = dbConnection.escapetoString(reason);
+ let dbQuery = queryDatabase(dbConnection, `INSERT INTO ban_main (ban_type, ban_detail, ban_who_banned, ban_reason) VALUES (${VRR_BANTYPE_ACCOUNT}, ${accountId}, ${adminAccountId}, '${safeReason}');`);
+ freeDatabaseQuery(dbQuery);
+ dbConnection.close();
+ return true;
+ }
- return false;
+ return false;
}
// ===========================================================================
function banSubAccount(subAccountId, adminAccountId, reason) {
- let dbConnection = connectToDatabase();
- if(dbConnection) {
- let safeReason = dbConnection.escapetoString(reason);
- let dbQuery = queryDatabase(dbConnection, `INSERT INTO ban_main (ban_type, ban_detail, ban_who_banned, ban_reason) VALUES (${VRR_BANTYPE_SUBACCOUNT}, ${subAccountId}, ${adminAccountId}, '${safeReason}');`);
- freeDatabaseQuery(dbQuery);
- dbConnection.close();
- return true;
- }
+ let dbConnection = connectToDatabase();
+ if (dbConnection) {
+ let safeReason = dbConnection.escapetoString(reason);
+ let dbQuery = queryDatabase(dbConnection, `INSERT INTO ban_main (ban_type, ban_detail, ban_who_banned, ban_reason) VALUES (${VRR_BANTYPE_SUBACCOUNT}, ${subAccountId}, ${adminAccountId}, '${safeReason}');`);
+ freeDatabaseQuery(dbQuery);
+ dbConnection.close();
+ return true;
+ }
- return false;
+ return false;
}
// ===========================================================================
function banIPAddress(ipAddress, adminAccountId, reason) {
- let dbConnection = connectToDatabase();
- if(dbConnection) {
- let safeReason = dbConnection.escapetoString(reason);
- let dbQuery = queryDatabase(dbConnection, `INSERT INTO ban_main (ban_type, ban_detail, ban_who_banned, ban_reason) VALUES (${VRR_BANTYPE_IPADDRESS}, INET_ATON(${ipAddress}), ${adminAccountId}, '${safeReason}');`);
- freeDatabaseQuery(dbQuery);
- dbConnection.close();
- return true;
- }
+ let dbConnection = connectToDatabase();
+ if (dbConnection) {
+ let safeReason = dbConnection.escapetoString(reason);
+ let dbQuery = queryDatabase(dbConnection, `INSERT INTO ban_main (ban_type, ban_detail, ban_who_banned, ban_reason) VALUES (${VRR_BANTYPE_IPADDRESS}, INET_ATON(${ipAddress}), ${adminAccountId}, '${safeReason}');`);
+ freeDatabaseQuery(dbQuery);
+ dbConnection.close();
+ return true;
+ }
- return false;
+ return false;
}
// ===========================================================================
function banSubNet(ipAddressStart, ipAddressEnd, adminAccountId, reason) {
- let dbConnection = connectToDatabase();
- if(dbConnection) {
- let safeReason = dbConnection.escapetoString(reason);
- let dbQuery = queryDatabase(dbConnection, `INSERT INTO ban_main (ban_type, ban_ip_start, ban_ip_end, ban_who_banned, ban_reason) VALUES (${VRR_BANTYPE_SUBNET}, INET_ATON(${ipAddressStart}), INET_ATON(${ipAddressEnd}), ${adminAccountId}, '${safeReason}');`);
- freeDatabaseQuery(dbQuery);
- dbConnection.close();
- return true;
- }
+ let dbConnection = connectToDatabase();
+ if (dbConnection) {
+ let safeReason = dbConnection.escapetoString(reason);
+ let dbQuery = queryDatabase(dbConnection, `INSERT INTO ban_main (ban_type, ban_ip_start, ban_ip_end, ban_who_banned, ban_reason) VALUES (${VRR_BANTYPE_SUBNET}, INET_ATON(${ipAddressStart}), INET_ATON(${ipAddressEnd}), ${adminAccountId}, '${safeReason}');`);
+ freeDatabaseQuery(dbQuery);
+ dbConnection.close();
+ return true;
+ }
- return false;
+ return false;
}
// ===========================================================================
function unbanAccount(accountId, adminAccountId) {
- let dbConnection = connectToDatabase();
- if(dbConnection) {
- let dbQuery = queryDatabase(dbConnection, `UPDATE ban_main SET ban_who_removed=${adminAccountId}, ban_removed=1 WHERE ban_type=${VRR_BANTYPE_ACCOUNT} AND ban_detail=${accountId}`);
- freeDatabaseQuery(dbQuery);
- dbConnection.close();
- return true;
- }
+ let dbConnection = connectToDatabase();
+ if (dbConnection) {
+ let dbQuery = queryDatabase(dbConnection, `UPDATE ban_main SET ban_who_removed=${adminAccountId}, ban_removed=1 WHERE ban_type=${VRR_BANTYPE_ACCOUNT} AND ban_detail=${accountId}`);
+ freeDatabaseQuery(dbQuery);
+ dbConnection.close();
+ return true;
+ }
- return false;
+ return false;
}
// ===========================================================================
function unbanSubAccount(subAccountId, adminAccountId) {
- let dbConnection = connectToDatabase();
- if(dbConnection) {
- let dbQuery = queryDatabase(dbConnection, `UPDATE ban_main SET ban_who_removed=${adminAccountId}, ban_removed=1 WHERE ban_type=${VRR_BANTYPE_SUBACCOUNT} AND ban_detail=${subAccountId}`);
- freeDatabaseQuery(dbQuery);
- dbConnection.close();
- return true;
- }
+ let dbConnection = connectToDatabase();
+ if (dbConnection) {
+ let dbQuery = queryDatabase(dbConnection, `UPDATE ban_main SET ban_who_removed=${adminAccountId}, ban_removed=1 WHERE ban_type=${VRR_BANTYPE_SUBACCOUNT} AND ban_detail=${subAccountId}`);
+ freeDatabaseQuery(dbQuery);
+ dbConnection.close();
+ return true;
+ }
- return false;
+ return false;
}
// ===========================================================================
function unbanIPAddress(ipAddress, adminAccountId) {
- let dbConnection = connectToDatabase();
- if(dbConnection) {
- let dbQuery = queryDatabase(dbConnection, `UPDATE ban_main SET ban_who_removed=${adminAccountId}, ban_removed=1 WHERE ban_type=${VRR_BANTYPE_IPADDRESS} AND ban_detail=INET_ATON(${ipAddress})`);
- freeDatabaseQuery(dbQuery);
- dbConnection.close();
- return true;
- }
+ let dbConnection = connectToDatabase();
+ if (dbConnection) {
+ let dbQuery = queryDatabase(dbConnection, `UPDATE ban_main SET ban_who_removed=${adminAccountId}, ban_removed=1 WHERE ban_type=${VRR_BANTYPE_IPADDRESS} AND ban_detail=INET_ATON(${ipAddress})`);
+ freeDatabaseQuery(dbQuery);
+ dbConnection.close();
+ return true;
+ }
- return false;
+ return false;
}
// ===========================================================================
function unbanSubNet(ipAddressStart, ipAddressEnd, adminAccountId) {
- let dbConnection = connectToDatabase();
- if(dbConnection) {
- let dbQuery = queryDatabase(dbConnection, `UPDATE ban_main SET ban_who_removed=${adminAccountId}, ban_removed=1 WHERE ban_type=${VRR_BANTYPE_SUBNET} AND ban_ip_start=INET_ATON(${ipAddressStart}) AND ban_ip_end=INET_ATON(${ipAddressEnd})`);
- freeDatabaseQuery(dbQuery);
- dbConnection.close();
- return true;
- }
+ let dbConnection = connectToDatabase();
+ if (dbConnection) {
+ let dbQuery = queryDatabase(dbConnection, `UPDATE ban_main SET ban_who_removed=${adminAccountId}, ban_removed=1 WHERE ban_type=${VRR_BANTYPE_SUBNET} AND ban_ip_start=INET_ATON(${ipAddressStart}) AND ban_ip_end=INET_ATON(${ipAddressEnd})`);
+ freeDatabaseQuery(dbQuery);
+ dbConnection.close();
+ return true;
+ }
- return false;
+ return false;
}
// ===========================================================================
function isAccountBanned(accountId) {
- let bans = getServerData().bans;
- for(let i in bans) {
- if(bans[i].type == VRR_BANTYPE_ACCOUNT) {
- if(bans[i].detail == accountId) {
- return true;
- }
- }
- }
+ let bans = getServerData().bans.filter(ban => ban.type === VRR_BANTYPE_ACCOUNT && ban.detail === accountId);
+ if (bans.length > 0) {
+ return true;
+ }
- return false;
+ return false;
}
// ===========================================================================
function isSubAccountBanned(subAccountId) {
- let bans = getServerData().bans;
- for(let i in bans) {
- if(bans[i].type == VRR_BANTYPE_SUBACCOUNT) {
- if(bans[i].detail == subAccountId) {
- return true;
- }
- }
- }
+ let bans = getServerData().bans.filter(ban => ban.type === VRR_BANTYPE_SUBACCOUNT && ban.detail === subAccountId);
+ if (bans.length > 0) {
+ return true;
+ }
- return false;
+ return false;
}
// ===========================================================================
function isIpAddressBanned(ipAddress) {
- let bans = getServerData().bans;
- for(let i in bans) {
- if(bans[i].type == VRR_BANTYPE_IPADDRESS) {
- if(bans[i].detail == ipAddress) {
- return true;
- }
- }
- }
+ let bans = getServerData().bans.filter(ban => ban.type === VRR_BANTYPE_IPADDRESS && ban.detail === ipAddress);
+ if (bans.length > 0) {
+ return true;
+ }
- return false;
+ return false;
}
// ===========================================================================
-
diff --git a/scripts/server/bitflag.js b/scripts/server/bitflag.js
index b095c2e8..01085c73 100644
--- a/scripts/server/bitflag.js
+++ b/scripts/server/bitflag.js
@@ -7,8 +7,6 @@
// TYPE: Server (JavaScript)
// ===========================================================================
-// ===========================================================================
-
let serverBitFlags = {
staffFlags: {},
moderationFlags: {},
@@ -21,7 +19,6 @@ let serverBitFlags = {
npcTriggerTypeFlags: {},
npcTriggerConditionTypesFlags: {},
npcTriggerResponseTypeFlags: {},
- serverSettings: {}
};
// ===========================================================================
@@ -41,6 +38,8 @@ let serverBitFlagKeys = {
"ManageWorld",
"ManageAntiCheat",
"Developer",
+ "ManageNPCs",
+ "ManageRaces",
],
moderationFlagKeys: [
"None",
@@ -119,6 +118,8 @@ let serverBitFlagKeys = {
"NoRandomTips",
"NoActionTips",
],
+
+ // Not going to be used. Use trigger, condition, and response stuff in trigger.js
npcTriggerTypeKeys: [
"None",
"FarProximity", // Comes within a far distance of NPC
@@ -219,26 +220,6 @@ let serverBitFlagKeys = {
"ShowItemsAfterPurchase",
"BuyCommandAfterEnterBusiness",
],
- serverSettingsKeys: [
- "None",
- "GUI",
- "ServerLogo",
- "FallingSnow",
- "GroundSnow",
- "Anticheat",
- "CheckGameScripts",
- "GameScriptBlackList",
- "GameScriptWhiteList",
- "JobBlips",
- "JobPickups",
- "BusinessBlips",
- "BusinessPickups",
- "HouseBlips",
- "HousePickups",
- "DiscordBot",
- "RealTime",
- "Testing",
- ],
};
// ===========================================================================
@@ -255,47 +236,12 @@ function initBitFlagScript() {
serverBitFlags.npcTriggerTypes = createBitFlagTable(serverBitFlagKeys.npcTriggerTypeKeys);
serverBitFlags.npcTriggerConditionTypes = createBitFlagTable(serverBitFlagKeys.npcTriggerConditionTypeKeys);
serverBitFlags.npcTriggerResponseTypes = createBitFlagTable(serverBitFlagKeys.npcTriggerResponseTypeKeys);
- serverBitFlags.serverSettings = createBitFlagTable(serverBitFlagKeys.serverSettingsKeys);
logToConsole(LOG_INFO, "[VRR.BitFlag]: Bit flag script initialized successfully!");
return true;
}
// ===========================================================================
-function createBitFlagTable(keyNames) {
- let bitVal = 0;
- let bitTable = {};
- let incVal = 1;
-
- for(let i in keyNames) {
- let key = keyNames[i];
- bitTable[key] = bitVal;
- bitVal = 1 << incVal;
- incVal++;
- }
- return bitTable;
-}
-
-// ===========================================================================
-
-function hasBitFlag(allFlags, checkForFlag) {
- if(allFlags == 0) {
- return false;
- }
-
- if(allFlags == -1) {
- return true;
- }
-
- if((allFlags & checkForFlag) == checkForFlag) {
- return true;
- }
-
- return false;
-}
-
-// ===========================================================================
-
function doesPlayerHaveStaffPermission(client, requiredFlags) {
if(isConsole(client)) {
return true;
@@ -311,15 +257,15 @@ function doesPlayerHaveStaffPermission(client, requiredFlags) {
}
// -1 is automatic override (having -1 for staff flags is basically god mode admin level)
- if(staffFlags == getStaffFlagValue("All")) {
- return true;
- }
+ if(staffFlags == getStaffFlagValue("All")) {
+ return true;
+ }
- if(hasBitFlag(staffFlags, requiredFlags)) {
- return true;
- }
+ if(hasBitFlag(staffFlags, requiredFlags)) {
+ return true;
+ }
- return false;
+ return false;
}
// ===========================================================================
@@ -341,22 +287,22 @@ function doesPlayerHaveClanPermission(client, requiredFlags) {
clanFlags = getPlayerCurrentSubAccount(client).clanFlags | getClanRankFlags(getPlayerCurrentSubAccount(client).clanRank);
// -1 is automatic override (having -1 for staff flags is basically god mode admin level)
- if(clanFlags == getClanFlagValue("All")) {
- return true;
- }
+ if(clanFlags == getClanFlagValue("All")) {
+ return true;
+ }
- if(hasBitFlag(clanFlags, requiredFlags)) {
- return true;
- }
+ if(hasBitFlag(clanFlags, requiredFlags)) {
+ return true;
+ }
- return false;
+ return false;
}
// ===========================================================================
function getStaffFlagValue(flagName) {
- if(flagName == "All") {
- return -1;
+ if(flagName == "All") {
+ return -1;
}
if(typeof serverBitFlags.staffFlags[flagName] == "undefined") {
@@ -369,8 +315,8 @@ function getStaffFlagValue(flagName) {
// ===========================================================================
function getClanFlagValue(flagName) {
- if(flagName == "All") {
- return -1;
+ if(flagName == "All") {
+ return -1;
}
if(typeof getServerBitFlags().clanFlags[flagName] == "undefined") {
@@ -383,8 +329,8 @@ function getClanFlagValue(flagName) {
// ===========================================================================
function getAccountSettingsFlagValue(flagName) {
- if(flagName == "All") {
- return -1;
+ if(flagName == "All") {
+ return -1;
}
if(typeof serverBitFlags.accountSettingsFlags[flagName] == "undefined") {
@@ -397,8 +343,8 @@ function getAccountSettingsFlagValue(flagName) {
// ===========================================================================
function getModerationFlagValue(flagName) {
- if(flagName == "All") {
- return -1;
+ if(flagName == "All") {
+ return -1;
}
if(typeof serverBitFlags.moderationFlags[flagName] == "undefined") {
@@ -410,20 +356,6 @@ function getModerationFlagValue(flagName) {
// ===========================================================================
-function getServerSettingsFlagValue(flagName) {
- if(flagName == "All") {
- return -1;
- }
-
- if(typeof serverBitFlags.serverSettings[flagName] == "undefined") {
- return false;
- }
-
- return serverBitFlags.serverSettings[flagName];
-}
-
-// ===========================================================================
-
function givePlayerStaffFlag(client, flagName) {
if(!getStaffFlagValue(flagName)) {
return false;
@@ -447,18 +379,6 @@ function takePlayerStaffFlag(client, flagName) {
// ===========================================================================
-function addBitFlag(allFlags, flagValue) {
- return allFlags | flagValue;
-}
-
-// ===========================================================================
-
-function removeBitFlag(allFlags, flagValue) {
- return allFlags ^ flagValue;
-}
-
-// ===========================================================================
-
function takePlayerStaffFlag(client, flagName) {
if(!getStaffFlagValue(flagName)) {
return false;
@@ -487,20 +407,4 @@ function getServerBitFlagKeys() {
return serverBitFlagKeys;
}
-// ===========================================================================
-
-function createBitwiseTable(tableKeys) {
- let bitVal = 0;
- let bitTable = {};
- let incVal = 1;
-
- for(let i in tableKeys) {
- let key = tableKeys[i];
- bitTable[key] = bitVal;
- bitVal = 1 << incVal;
- incVal++;
- }
- return bitTable;
-}
-
// ===========================================================================
\ No newline at end of file
diff --git a/scripts/server/business.js b/scripts/server/business.js
index f12ca859..909289bf 100644
--- a/scripts/server/business.js
+++ b/scripts/server/business.js
@@ -38,7 +38,7 @@ const VRR_BIZOWNER_PUBLIC = 5; // Public Business. Used for go
/**
* @class Representing a businesses' data. Loaded and saved in the database
*/
- class BusinessData {
+class BusinessData {
constructor(dbAssoc = false) {
this.databaseId = 0;
this.name = "";
@@ -81,7 +81,7 @@ const VRR_BIZOWNER_PUBLIC = 5; // Public Business. Used for go
this.labelHelpType = VRR_PROPLABEL_INFO_NONE;
- if(dbAssoc) {
+ if (dbAssoc) {
this.databaseId = toInteger(dbAssoc["biz_id"]);
this.name = toString(dbAssoc["biz_name"]);
this.ownerType = toInteger(dbAssoc["biz_owner_type"]);
@@ -132,7 +132,7 @@ class BusinessLocationData {
this.interior = 0;
this.dimension = 0;
- if(dbAssoc) {
+ if (dbAssoc) {
this.databaseId = toInteger(dbAssoc["biz_loc_id"]);
this.name = toString(dbAssoc["biz_loc_name"]);
this.type = toInteger(dbAssoc["biz_loc_type"]);
@@ -159,7 +159,7 @@ class BusinessGameScriptData {
this.businessIndex = -1;
this.needsSaved = false;
- if(dbAssoc) {
+ if (dbAssoc) {
this.databaseId = toInteger(dbAssoc["biz_script_id"]);
this.name = toString(dbAssoc["biz_script_name"]);
this.state = toInteger(dbAssoc["biz_script_state"]);
@@ -172,14 +172,6 @@ class BusinessGameScriptData {
function initBusinessScript() {
logToConsole(LOG_INFO, "[VRR.Business]: Initializing business script ...");
- getServerData().businesses = loadBusinessesFromDatabase();
-
- createAllBusinessPickups();
- createAllBusinessBlips();
-
- setAllBusinessIndexes();
- cacheAllBusinessItems();
-
logToConsole(LOG_INFO, "[VRR.Business]: Business script initialized successfully!");
return true;
}
@@ -188,10 +180,10 @@ function initBusinessScript() {
function loadBusinessFromId(businessId) {
let dbConnection = connectToDatabase();
- if(dbConnection) {
+ if (dbConnection) {
let dbQueryString = `SELECT * FROM biz_main WHERE biz_id = ${businessId} LIMIT 1;`;
let dbQuery = queryDatabase(dbConnection, dbQueryString);
- if(dbQuery) {
+ if (dbQuery) {
let dbAssoc = fetchQueryAssoc(dbQuery);
freeDatabaseQuery(dbQuery);
return new BusinessData(dbAssoc);
@@ -212,16 +204,16 @@ function loadBusinessesFromDatabase() {
let dbQuery = null;
let dbAssoc;
- if(dbConnection) {
- dbQuery = queryDatabase(dbConnection, `SELECT * FROM biz_main WHERE biz_server = ${getServerId()}`);
- if(dbQuery) {
- if(dbQuery.numRows > 0) {
- while(dbAssoc = fetchQueryAssoc(dbQuery)) {
+ if (dbConnection) {
+ dbQuery = queryDatabase(dbConnection, `SELECT * FROM biz_main WHERE biz_deleted = 0 AND biz_server = ${getServerId()}`);
+ if (dbQuery) {
+ if (dbQuery.numRows > 0) {
+ while (dbAssoc = fetchQueryAssoc(dbQuery)) {
let tempBusinessData = new BusinessData(dbAssoc);
- tempBusinessData.locations = loadBusinessLocationsFromDatabase(tempBusinessData.databaseId);
+ //tempBusinessData.locations = loadBusinessLocationsFromDatabase(tempBusinessData.databaseId);
//tempBusinessData.gameScripts = loadBusinessGameScriptsFromDatabase(tempBusinessData.databaseId);
tempBusinesses.push(tempBusinessData);
- logToConsole(LOG_INFO, `[VRR.Business]: Business '${tempBusinessData.name}' (ID ${tempBusinessData.databaseId}) loaded from database successfully!`);
+ logToConsole(LOG_VERBOSE, `[VRR.Business]: Business '${tempBusinessData.name}' (ID ${tempBusinessData.databaseId}) loaded from database successfully!`);
}
}
freeDatabaseQuery(dbQuery);
@@ -244,12 +236,12 @@ function loadBusinessLocationsFromDatabase(businessId) {
let dbAssoc;
let dbQueryString = "";
- if(dbConnection) {
+ if (dbConnection) {
dbQueryString = `SELECT * FROM biz_loc WHERE biz_loc_biz = ${businessId}`;
dbQuery = queryDatabase(dbConnection, dbQueryString);
- if(dbQuery) {
- if(dbQuery.numRows > 0) {
- while(dbAssoc = fetchQueryAssoc(dbQuery)) {
+ if (dbQuery) {
+ if (dbQuery.numRows > 0) {
+ while (dbAssoc = fetchQueryAssoc(dbQuery)) {
let tempBusinessLocationData = new BusinessLocationData(dbAssoc);
tempBusinessLocations.push(tempBusinessLocationData);
logToConsole(LOG_VERBOSE, `[VRR.Business]: Location '${tempBusinessLocationData.name}' loaded from database successfully!`);
@@ -299,38 +291,46 @@ function loadBusinessGameScriptsFromDatabase(businessId) {
// ===========================================================================
+/**
+ * This is a command handler function.
+ *
+ * @param {string} command - The command name used by the player
+ * @param {string} params - The parameters/args string used with the command by the player
+ * @param {Client} client - The client/player that used the command
+ * @return {bool} Whether or not the command was successful
+ *
+ */
function createBusinessCommand(command, params, client) {
- let tempBusinessData = createBusiness(params, getPlayerPosition(client), toVector3(0.0, 0.0, 0.0), getGameConfig().pickupModels[getServerGame()].Business, getGameConfig().blipSprites[getServerGame()].Business, getPlayerInterior(client), getPlayerDimension(client));
- tempBusinessData.needsSaved = true;
- let businessId = getServerData().businesses.push(tempBusinessData);
- setAllBusinessIndexes();
+ createBusiness(params, getPlayerPosition(client), toVector3(0.0, 0.0, 0.0), getGameConfig().pickupModels[getGame()].Business, -1, getPlayerInterior(client), getPlayerDimension(client), getPlayerData(client).interiorCutscene);
- saveAllBusinessesToDatabase();
-
- createBusinessEntrancePickup(businessId-1);
- createBusinessExitPickup(businessId-1);
- createBusinessEntranceBlip(businessId-1);
- createBusinessExitBlip(businessId-1);
-
- messageAdmins(`{ALTCOLOUR}${getPlayerName(client)} {MAINCOLOUR}created business {businessBlue}${tempBusinessData.name}`);
+ messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} created business: {businessBlue}${params}`);
}
// ===========================================================================
+/**
+ * This is a command handler function.
+ *
+ * @param {string} command - The command name used by the player
+ * @param {string} params - The parameters/args string used with the command by the player
+ * @param {Client} client - The client/player that used the command
+ * @return {bool} Whether or not the command was successful
+ *
+ */
function createBusinessLocationCommand(command, params, client) {
- if(!isPlayerSpawned(client)) {
+ if (!isPlayerSpawned(client)) {
messagePlayerError(client, "You must be spawned to use this command!");
return false;
}
let locationType = toString(getParam(params, " ", 1));
- let businessId = (isPlayerInAnyBusiness(getParam(params, " ", 2))) ? getPlayerBusiness(client) : getClosestBusinessEntrance(getPlayerPosition(client));
+ let businessId = getPlayerBusiness(client);
- if(!areParamsEmpty(params)) {
+ if (!areParamsEmpty(params)) {
businessId = getBusinessFromParams(params);
}
- if(!getBusinessData(businessId)) {
+ if (!getBusinessData(businessId)) {
messagePlayerError(client, getLocaleString(client, "InvalidBusiness"));
return false;
}
@@ -338,12 +338,12 @@ function createBusinessLocationCommand(command, params, client) {
let tempBusinessLocationData = createBusinessLocation(locationType, businessId);
getServerData().businesses[businessId].push(tempBusinessLocationData);
- messageAdmins(`{ALTCOLOUR}${getPlayerName(client)} {MAINCOLOUR}created location {businessBlue}${params} {MAINCOLOUR}for business {businessBlue}${tempBusinessData.name}`);
+ messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} created location {businessBlue}${params}{MAINCOLOUR} for business {businessBlue}${tempBusinessData.name}`);
}
// ===========================================================================
-function createBusiness(name, entrancePosition, exitPosition, entrancePickupModel = -1, entranceBlipModel = -1, entranceInteriorId = 0, entranceVirtualWorld = 0, exitInteriorId = -1, exitVirtualWorld = -1, exitPickupModel = -1, exitBlipModel = -1) {
+function createBusiness(name, entrancePosition, exitPosition, entrancePickupModel = -1, entranceBlipModel = -1, entranceInterior = 0, entranceDimension = 0, entranceCutscene = -1) {
let tempBusinessData = new BusinessData(false);
tempBusinessData.name = name;
@@ -351,39 +351,67 @@ function createBusiness(name, entrancePosition, exitPosition, entrancePickupMode
tempBusinessData.entranceRotation = 0.0;
tempBusinessData.entrancePickupModel = entrancePickupModel;
tempBusinessData.entranceBlipModel = entranceBlipModel;
- tempBusinessData.entranceInterior = entranceInteriorId;
- tempBusinessData.entranceDimension = entranceVirtualWorld;
+ tempBusinessData.entranceInterior = entranceInterior;
+ tempBusinessData.entranceDimension = entranceDimension;
+ tempBusinessData.entranceCutscene = entranceCutscene;
tempBusinessData.exitPosition = exitPosition;
tempBusinessData.exitRotation = 0.0;
- tempBusinessData.exitPickupModel = exitPickupModel;
- tempBusinessData.exitBlipModel = exitBlipModel;
- tempBusinessData.exitInterior = exitInteriorId;
- tempBusinessData.exitDimension = exitVirtualWorld;
+ tempBusinessData.exitPickupModel = 0;
+ tempBusinessData.exitBlipModel = -1;
+ tempBusinessData.exitInterior = 0;
+ tempBusinessData.exitDimension = 0;
+ tempBusinessData.exitCutscene = -1;
+
+ tempBusinessData.needsSaved = true;
+ let businessId = getServerData().businesses.push(tempBusinessData);
+ setBusinessDataIndexes();
+ saveAllBusinessesToDatabase();
+
+ createBusinessPickups(businessId - 1);
+ createBusinessBlips(businessId - 1);
return tempBusinessData;
}
// ===========================================================================
+/**
+ * This is a command handler function.
+ *
+ * @param {string} command - The command name used by the player
+ * @param {string} params - The parameters/args string used with the command by the player
+ * @param {Client} client - The client/player that used the command
+ * @return {bool} Whether or not the command was successful
+ *
+ */
function deleteBusinessCommand(command, params, client) {
let businessId = getPlayerBusiness(client);
- if(!areParamsEmpty(params)) {
+ if (!areParamsEmpty(params)) {
businessId = getBusinessFromParams(params);
}
- if(!getBusinessData(businessId)) {
+ if (!getBusinessData(businessId)) {
messagePlayerError(client, getLocaleString(client, "InvalidBusiness"));
return false;
}
- messageAdmins(`{ALTCOLOUR}${getPlayerName(client)} {MAINCOLOUR}deleted business {businessBlue}${getBusinessData(businessId).name}`);
+ messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} deleted business {businessBlue}${getBusinessData(businessId).name}`);
deleteBusiness(businessId, getPlayerData(client).accountData.databaseId);
}
// ===========================================================================
+/**
+ * This is a command handler function.
+ *
+ * @param {string} command - The command name used by the player
+ * @param {string} params - The parameters/args string used with the command by the player
+ * @param {Client} client - The client/player that used the command
+ * @return {bool} Whether or not the command was successful
+ *
+ */
function deleteBusinessLocationCommand(command, params, client) {
//let businessId = toInteger(getParam(params, " ", 2));
//deleteBusinessLocation(businessId);
@@ -392,18 +420,27 @@ function deleteBusinessLocationCommand(command, params, client) {
// ===========================================================================
+/**
+ * This is a command handler function.
+ *
+ * @param {string} command - The command name used by the player
+ * @param {string} params - The parameters/args string used with the command by the player
+ * @param {Client} client - The client/player that used the command
+ * @return {bool} Whether or not the command was successful
+ *
+ */
function setBusinessNameCommand(command, params, client) {
let newBusinessName = toString(params);
let businessId = getPlayerBusiness(client);
- if(!getBusinessData(businessId)) {
+ if (!getBusinessData(businessId)) {
messagePlayerError(client, getLocaleString(client, "InvalidBusiness"));
return false;
}
- if(!canPlayerManageBusiness(client, businessId)) {
- messagePlayerError(client, "You can't change the name of this business!");
+ if (!canPlayerManageBusiness(client, businessId)) {
+ messagePlayerError(client, getLocaleString(client, "CantModifyBusiness"));
return false;
}
@@ -411,13 +448,22 @@ function setBusinessNameCommand(command, params, client) {
getBusinessData(businessId).name = newBusinessName;
setEntityData(getBusinessData(businessId).entrancePickup, "vrr.label.name", getBusinessData(businessId).name, true);
getBusinessData(businessId).needsSaved = true;
- messageAdmins(`{ALTCOLOUR}${getPlayerName(client)} {MAINCOLOUR}renamed business {businessBlue}${oldBusinessName} {MAINCOLOUR}to {businessBlue}${newBusinessName}`);
+ messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} renamed business {businessBlue}${oldBusinessName}{MAINCOLOUR} to {businessBlue}${newBusinessName}`);
}
// ===========================================================================
+/**
+ * This is a command handler function.
+ *
+ * @param {string} command - The command name used by the player
+ * @param {string} params - The parameters/args string used with the command by the player
+ * @param {Client} client - The client/player that used the command
+ * @return {bool} Whether or not the command was successful
+ *
+ */
function setBusinessOwnerCommand(command, params, client) {
- if(areParamsEmpty(params)) {
+ if (areParamsEmpty(params)) {
messagePlayerSyntax(client, getCommandSyntaxText(command));
return false;
}
@@ -425,18 +471,18 @@ function setBusinessOwnerCommand(command, params, client) {
let newBusinessOwner = getPlayerFromParams(params);
let businessId = getPlayerBusiness(client);
- if(!newBusinessOwner) {
+ if (!newBusinessOwner) {
messagePlayerError(client, getLocaleString(client, "InvalidPlayer"));
return false;
}
- if(!getBusinessData(businessId)) {
+ if (!getBusinessData(businessId)) {
messagePlayerError(client, getLocaleString(client, "InvalidBusiness"));
return false;
}
- if(!canPlayerManageBusiness(client, businessId)) {
- messagePlayerError(client, "You can't change the owner of this business!");
+ if (!canPlayerManageBusiness(client, businessId)) {
+ messagePlayerError(client, getLocaleString(client, "CantModifyBusiness"));
return false;
}
@@ -449,8 +495,17 @@ function setBusinessOwnerCommand(command, params, client) {
// ===========================================================================
+/**
+ * This is a command handler function.
+ *
+ * @param {string} command - The command name used by the player
+ * @param {string} params - The parameters/args string used with the command by the player
+ * @param {Client} client - The client/player that used the command
+ * @return {bool} Whether or not the command was successful
+ *
+ */
function setBusinessJobCommand(command, params, client) {
- if(areParamsEmpty(params)) {
+ if (areParamsEmpty(params)) {
messagePlayerSyntax(client, getCommandSyntaxText(command));
return false;
}
@@ -458,18 +513,18 @@ function setBusinessJobCommand(command, params, client) {
let jobId = getJobFromParams(params);
let businessId = getPlayerBusiness(client);
- if(!getJobData(jobId)) {
+ if (!getJobData(jobId)) {
messagePlayerError(client, getLocaleString(client, "InvalidJob"));
return false;
}
- if(!getBusinessData(businessId)) {
+ if (!getBusinessData(businessId)) {
messagePlayerError(client, getLocaleString(client, "InvalidBusiness"));
return false;
}
- if(!canPlayerManageBusiness(client, businessId)) {
- messagePlayerError(client, "You can't change the owner of this business!");
+ if (!canPlayerManageBusiness(client, businessId)) {
+ messagePlayerError(client, getLocaleString(client, "CantModifyBusiness"));
return false;
}
@@ -482,60 +537,84 @@ function setBusinessJobCommand(command, params, client) {
// ===========================================================================
+/**
+ * This is a command handler function.
+ *
+ * @param {string} command - The command name used by the player
+ * @param {string} params - The parameters/args string used with the command by the player
+ * @param {Client} client - The client/player that used the command
+ * @return {bool} Whether or not the command was successful
+ *
+ */
function setBusinessClanCommand(command, params, client) {
let businessId = getPlayerBusiness(client);
- if(!getBusinessData(businessId)) {
+ if (!getBusinessData(businessId)) {
messagePlayerError(getLocaleString(client, "InvalidBusiness"));
return false;
}
let clanId = getPlayerClan(client);
- if(!getClanData(clanId)) {
+ if (!getClanData(clanId)) {
messagePlayerError(client, getLocaleString(client, "InvalidClan"));
return false;
}
- if(!canPlayerManageBusiness(client, businessId)) {
- messagePlayerError(client, "You can't give this business to a clan!");
+ if (getBusinessData(business).ownerType != VRR_VEHOWNER_PLAYER) {
+ messagePlayerError(client, getLocaleString(client, "MustOwnBusiness"));
return false;
}
- getBusinessData(businessId).ownerType = VRR_BIZOWNER_CLAN;
- getBusinessData(businessId).ownerId = getClanData(clanId).databaseId;
- getBusinessData(businessId).needsSaved = true;
+ if (getBusinessData(business).ownerId != getPlayerCurrentSubAccount(client).databaseId) {
+ messagePlayerError(client, getLocaleString(client, "MustOwnBusiness"));
+ return false;
+ }
- messagePlayerSuccess(client, `{MAINCOLOUR}You gave business {businessBlue}${getBusinessData(businessId).name} {MAINCOLOUR}to the {clanOrange}${getClanData(clanId).name} {MAINCOLOUR}clan!`);
+ showPlayerPrompt(client, getLocaleString(client, "SetBusinessClanConfirmMessage"), getLocaleString(client, "SetBusinessClanConfirmTitle"), getLocaleString(client, "Yes"), getLocaleString(client, "No"));
+ getPlayerData(client).promptType = VRR_PROMPT_BIZGIVETOCLAN;
+
+ //getBusinessData(businessId).ownerType = VRR_BIZOWNER_CLAN;
+ //getBusinessData(businessId).ownerId = getClanData(clanId).databaseId;
+ //getBusinessData(businessId).needsSaved = true;
}
// ===========================================================================
+/**
+ * This is a command handler function.
+ *
+ * @param {string} command - The command name used by the player
+ * @param {string} params - The parameters/args string used with the command by the player
+ * @param {Client} client - The client/player that used the command
+ * @return {bool} Whether or not the command was successful
+ *
+ */
function setBusinessRankCommand(command, params, client) {
let businessId = getPlayerBusiness(client);
- if(!getBusinessData(businessId)) {
+ if (!getBusinessData(businessId)) {
messagePlayerError(getLocaleString(client, "InvalidBusiness"));
return false;
}
let rankId = params;
- if(!canPlayerManageBusiness(client, businessId)) {
- messagePlayerError(client, "You can't change this business rank level!");
+ if (!canPlayerManageBusiness(client, businessId)) {
+ messagePlayerError(client, getLocaleString(client, "CantModifyBusiness"));
return false;
}
- if(getVehicleData(vehicle).ownerType == VRR_VEHOWNER_CLAN) {
+ if (getVehicleData(vehicle).ownerType == VRR_VEHOWNER_CLAN) {
let clanId = getClanIdFromDatabaseId(getBusinessData(businessId).ownerId);
rankId = getClanRankFromParams(clanId, params);
- if(!getClanRankData(clanId, rankId)) {
+ if (!getClanRankData(clanId, rankId)) {
messagePlayerError(client, getLocaleString(client, "ClanRankInvalid"));
return false;
}
getBusinessData(businessId).rank = getClanRankData(clanId, rankId).databaseId;
messagePlayerSuccess(client, `{MAINCOLOUR}You set business {businessBlue}${getBusinessData(businessId).name} {MAINCOLOUR}rank to {ALTCOLOUR}${getClanRankData(clanId, rankId).name} {MAINCOLOUR}of the {clanOrange}${getClanData(clanId).name} {MAINCOLOUR}clan!`);
- } else if(getBusinessData(businessId).ownerType == VRR_VEHOWNER_JOB) {
+ } else if (getBusinessData(businessId).ownerType == VRR_VEHOWNER_JOB) {
getBusinessData(businessId).rank = rankId;
messagePlayerSuccess(client, `{MAINCOLOUR}You set business {businessBlue}${getBusinessData(businessId).name} {MAINCOLOUR}rank to {ALTCOLOUR}${rankId} {MAINCOLOUR}of the {jobYellow}${getJobData(getJobIdFromDatabaseId(getBusinessData(businessId).ownerId)).name} {MAINCOLOUR}job!`);
}
@@ -554,39 +633,39 @@ function setBusinessRankCommand(command, params, client) {
* @return {bool} Whether or not the command was successful
*
*/
- function setBusinessRankCommand(command, params, client) {
- if(areParamsEmpty(params)) {
+function setBusinessRankCommand(command, params, client) {
+ if (areParamsEmpty(params)) {
messagePlayerSyntax(client, getCommandSyntaxText(command));
return false;
}
let businessId = getPlayerBusiness(client);
- if(!getBusinessData(businessId)) {
+ if (!getBusinessData(businessId)) {
messagePlayerError(getLocaleString(client, "InvalidBusiness"));
return false;
}
let clanId = getPlayerClan(client);
- if(!getClanData(clanId)) {
+ if (!getClanData(clanId)) {
messagePlayerError(client, getLocaleString(client, "InvalidClan"));
return false;
}
let clanRankId = getClanRankFromParams(clanId, params);
- if(!getClanRankData(clanId, clanRankId)) {
+ if (!getClanRankData(clanId, clanRankId)) {
messagePlayerError(client, getLocaleString(client, "ClanRankInvalid"));
return false;
}
- if(!canPlayerManageBusiness(client, businessId)) {
- messagePlayerError(client, "You can't change this business rank!");
+ if (!canPlayerManageBusiness(client, businessId)) {
+ messagePlayerError(client, getLocaleString(client, "CantModifyBusiness"));
return false;
}
- if(getClanRankData(clanId, clanRankId).level > getPlayerCurrentSubAccount(client).clanRank) {
+ if (getClanRankData(clanId, clanRankId).level > getPlayerCurrentSubAccount(client).clanRank) {
messagePlayerError(client, "That rank is above your level!");
return false;
}
@@ -599,107 +678,6 @@ function setBusinessRankCommand(command, params, client) {
// ===========================================================================
-function setBusinessJobCommand(command, params, client) {
- let businessId = getPlayerBusiness(client);
-
- if(!areParamsEmpty(params)) {
- businessId = getBusinessFromParams(params);
- }
-
- let closestJobLocation = getClosestJobLocation(getVehiclePosition(vehicle));
- let jobId = closestJobLocation.job;
-
- if(!areParamsEmpty(params)) {
- jobId = getJobIdFromParams(params);
- }
-
- if(!getBusinessData(businessId)) {
- messagePlayerError(client, getLocaleString(client, "InvalidBusiness"));
- return false;
- }
-
- if(!getJobData(jobId)) {
- messagePlayerError(client, getLocaleString(client, "InvalidJob"));
- return false;
- }
-
- getBusinessData(businessId).ownerType = VRR_BIZOWNER_JOB;
- getBusinessData(businessId).ownerId = getJobData(jobId).databaseId;
-
- getBusinessData(businessId).needsSaved = true;
- messagePlayerSuccess(client, `{MAINCOLOUR}You set business {businessBlue}${getBusinessData(businessId).name} {MAINCOLOUR}owner to the {jobYellow}${getJobData(jobId).name} {MAINCOLOUR}job`);
-}
-
-// ===========================================================================
-
-function setBusinessPublicCommand(command, params, client) {
- let businessId = getPlayerBusiness(client);
-
- if(!areParamsEmpty(params)) {
- businessId = getBusinessFromParams(params);
- }
-
- if(!getBusinessData(businessId)) {
- messagePlayerError(client, getLocaleString(client, "InvalidBusiness"));
- return false;
- }
-
- getBusinessData(businessId).ownerType = VRR_BIZOWNER_PUBLIC;
- getBusinessData(businessId).ownerId = 0;
-
- getBusinessData(businessId).needsSaved = true;
- messagePlayerSuccess(client, `{MAINCOLOUR}You set business {businessBlue}${getBusinessData(businessId).name} {MAINCOLOUR}owner set to {ALTCOLOUR}public`);
-}
-
-// ===========================================================================
-
-function removeBusinessOwnerCommand(command, params, client) {
- let businessId = getPlayerBusiness(client);
-
- if(!areParamsEmpty(params)) {
- businessId = getBusinessFromParams(params);
- }
-
- if(!getBusinessData(businessId)) {
- messagePlayerError(client, getLocaleString(client, "InvalidBusiness"));
- return false;
- }
-
- getBusinessData(businessId).ownerType = VRR_BIZOWNER_NONE;
- getBusinessData(businessId).ownerId = -1;
-
- getBusinessData(businessId).needsSaved = true;
- messagePlayerSuccess(client, `{MAINCOLOUR}You removed business {businessBlue}${getBusinessData(businessId).name} {MAINCOLOUR}owner`);
-}
-
-// ===========================================================================
-
-function lockUnlockBusinessCommand(command, params, client) {
- let businessId = getPlayerBusiness(client);
-
- if(!areParamsEmpty(params)) {
- businessId = getBusinessFromParams(params);
- }
-
- if(!getBusinessData(businessId)) {
- messagePlayerError(client, getLocaleString(client, "InvalidBusiness"));
- return false;
- }
-
- if(!canPlayerManageBusiness(client, businessId)) {
- messagePlayerError(client, "You can't change this business rank!");
- return false;
- }
-
- getBusinessData(businessId).locked = !getBusinessData(businessId).locked;
- setEntityData(getBusinessData(businessId).entrancePickup, "vrr.label.locked", getBusinessData(businessId).locked, true);
-
- getBusinessData(businessId).needsSaved = true;
- messagePlayerSuccess(client, `${getLockedUnlockedEmojiFromBool((getBusinessData(businessId).locked))} Business {businessBlue}${getBusinessData(businessId).name} {MAINCOLOUR}${getLockedUnlockedFromBool((getBusinessData(businessId).locked))}!`);
-}
-
-// ===========================================================================
-
/**
* This is a command handler function.
*
@@ -709,15 +687,117 @@ function lockUnlockBusinessCommand(command, params, client) {
* @return {bool} Whether or not the command was successful
*
*/
- function toggleBusinessInteriorLightsCommand(command, params, client) {
+function setBusinessJobCommand(command, params, client) {
let businessId = getPlayerBusiness(client);
- if(!getBusinessData(businessId)) {
+ if (!areParamsEmpty(params)) {
+ businessId = getBusinessFromParams(params);
+ }
+
+ let closestJobLocation = getClosestJobLocation(getVehiclePosition(vehicle));
+ let jobId = closestJobLocation.job;
+
+ if (!areParamsEmpty(params)) {
+ jobId = getJobIdFromParams(params);
+ }
+
+ if (!getBusinessData(businessId)) {
messagePlayerError(client, getLocaleString(client, "InvalidBusiness"));
return false;
}
- if(!canPlayerManageBusiness(client, businessId)) {
+ if (!getJobData(jobId)) {
+ messagePlayerError(client, getLocaleString(client, "InvalidJob"));
+ return false;
+ }
+
+ getBusinessData(businessId).ownerType = VRR_BIZOWNER_JOB;
+ getBusinessData(businessId).ownerId = getJobData(jobId).databaseId;
+
+ getBusinessData(businessId).needsSaved = true;
+ messagePlayerSuccess(client, `{MAINCOLOUR}You set business {businessBlue}${getBusinessData(businessId).name} {MAINCOLOUR}owner to the {jobYellow}${getJobData(jobId).name} {MAINCOLOUR}job`);
+}
+
+// ===========================================================================
+
+/**
+ * This is a command handler function.
+ *
+ * @param {string} command - The command name used by the player
+ * @param {string} params - The parameters/args string used with the command by the player
+ * @param {Client} client - The client/player that used the command
+ * @return {bool} Whether or not the command was successful
+ *
+ */
+function setBusinessPublicCommand(command, params, client) {
+ let businessId = getPlayerBusiness(client);
+
+ if (!areParamsEmpty(params)) {
+ businessId = getBusinessFromParams(params);
+ }
+
+ if (!getBusinessData(businessId)) {
+ messagePlayerError(client, getLocaleString(client, "InvalidBusiness"));
+ return false;
+ }
+
+ getBusinessData(businessId).ownerType = VRR_BIZOWNER_PUBLIC;
+ getBusinessData(businessId).ownerId = 0;
+
+ getBusinessData(businessId).needsSaved = true;
+ messagePlayerSuccess(client, `{MAINCOLOUR}You set business {businessBlue}${getBusinessData(businessId).name} {MAINCOLOUR}owner set to {ALTCOLOUR}public`);
+}
+
+// ===========================================================================
+
+/**
+ * This is a command handler function.
+ *
+ * @param {string} command - The command name used by the player
+ * @param {string} params - The parameters/args string used with the command by the player
+ * @param {Client} client - The client/player that used the command
+ * @return {bool} Whether or not the command was successful
+ *
+ */
+function removeBusinessOwnerCommand(command, params, client) {
+ let businessId = getPlayerBusiness(client);
+
+ if (!areParamsEmpty(params)) {
+ businessId = getBusinessFromParams(params);
+ }
+
+ if (!getBusinessData(businessId)) {
+ messagePlayerError(client, getLocaleString(client, "InvalidBusiness"));
+ return false;
+ }
+
+ getBusinessData(businessId).ownerType = VRR_BIZOWNER_NONE;
+ getBusinessData(businessId).ownerId = -1;
+ getBusinessData(businessId).needsSaved = true;
+
+ messagePlayerSuccess(client, `{MAINCOLOUR}You removed business {businessBlue}${getBusinessData(businessId).name}'s{MAINCOLOUR} owner`);
+}
+
+// ===========================================================================
+
+/**
+ * This is a command handler function.
+ *
+ * @param {string} command - The command name used by the player
+ * @param {string} params - The parameters/args string used with the command by the player
+ * @param {Client} client - The client/player that used the command
+ * @return {bool} Whether or not the command was successful
+ *
+ */
+function toggleBusinessInteriorLightsCommand(command, params, client) {
+ let businessId = getPlayerBusiness(client);
+
+ if (!getBusinessData(businessId)) {
+ messagePlayerError(client, getLocaleString(client, "InvalidBusiness"));
+ return false;
+ }
+
+ if (!canPlayerManageBusiness(client, businessId)) {
messagePlayerError(client, "You can't change the interior lights for this business!");
return false;
}
@@ -731,17 +811,26 @@ function lockUnlockBusinessCommand(command, params, client) {
// ===========================================================================
+/**
+ * This is a command handler function.
+ *
+ * @param {string} command - The command name used by the player
+ * @param {string} params - The parameters/args string used with the command by the player
+ * @param {Client} client - The client/player that used the command
+ * @return {bool} Whether or not the command was successful
+ *
+ */
function setBusinessEntranceFeeCommand(command, params, client) {
let entranceFee = toInteger(getParam(params, " ", 1)) || 0;
let businessId = getPlayerBusiness(client);
- if(!getBusinessData(businessId)) {
+ if (!getBusinessData(businessId)) {
messagePlayerError(client, getLocaleString(client, "InvalidBusiness"));
return false;
}
- if(!canPlayerManageBusiness(client, businessId)) {
- messagePlayerError(client, "You can't change the entrance fee for this business!");
+ if (!canPlayerManageBusiness(client, businessId)) {
+ messagePlayerError(client, getLocaleString(client, "CantModifyBusiness"));
return false;
}
@@ -752,55 +841,107 @@ function setBusinessEntranceFeeCommand(command, params, client) {
// ===========================================================================
+/**
+ * This is a command handler function.
+ *
+ * @param {string} command - The command name used by the player
+ * @param {string} params - The parameters/args string used with the command by the player
+ * @param {Client} client - The client/player that used the command
+ * @return {bool} Whether or not the command was successful
+ *
+ */
function getBusinessInfoCommand(command, params, client) {
let businessId = getPlayerBusiness(client);
- if(!areParamsEmpty(params)) {
+ if (!areParamsEmpty(params)) {
businessId = getBusinessFromParams(params);
}
- if(!getBusinessData(businessId)) {
+ if (!getBusinessData(businessId)) {
messagePlayerError(client, getLocaleString(client, "InvalidBusiness"));
return false;
}
+ let businessData = getBusinessData(businessId);
+
let ownerName = "Unknown";
- switch(getBusinessData(businessId).ownerType) {
+ switch (businessData.ownerType) {
case VRR_BIZOWNER_CLAN:
- ownerName = getClanData(getBusinessData(businessId).ownerId).name;
+ ownerName = getClanData(businessData.ownerId).name;
break;
case VRR_BIZOWNER_JOB:
- ownerName = getJobData(getBusinessData(businessId).ownerId).name;
+ ownerName = getJobData(businessData.ownerId).name;
break;
case VRR_BIZOWNER_PLAYER:
- let subAccountData = loadSubAccountFromId(getBusinessData(businessId).ownerId);
+ let subAccountData = loadSubAccountFromId(businessData.ownerId);
ownerName = `${subAccountData.firstName} ${subAccountData.lastName} [${subAccountData.databaseId}]`;
break;
- case VRR_BIZOWNER_NONE:
- ownerName = "None";
- break;
-
case VRR_BIZOWNER_PUBLIC:
ownerName = "Public";
break;
+
+ case VRR_BIZOWNER_NONE:
+ //submitBugReport(client, `[AUTOMATED REPORT] getBusinessInfoCommand() - Invalid ownerType for business ${businessId}/${getBusinessData(businessId).databaseId}`);
+ ownerName = "None";
+ break;
+
+ default:
+ submitBugReport(client, `[AUTOMATED REPORT] getBusinessInfoCommand() - Invalid ownerType ${businessData.ownerType} for business ${businessId}/${getBusinessData(businessId).databaseId}`);
+ ownerName = "None";
+ break;
}
- messagePlayerInfo(client, `🏢 {businessBlue}[Business Info] {MAINCOLOUR}Name: {ALTCOLOUR}${getBusinessData(businessId).name}, {MAINCOLOUR}Owner: {ALTCOLOUR}${ownerName} (${getBusinessOwnerTypeText(getBusinessData(businessId).ownerType)}), {MAINCOLOUR}Locked: {ALTCOLOUR}${getYesNoFromBool(intToBool(getBusinessData(businessId).locked))}, {MAINCOLOUR}ID: {ALTCOLOUR}${businessId}/${getBusinessData(businessId).databaseId}`);
+
+ let tempStats = [
+ [`Name`, `${businessData.name}`],
+ [`ID`, `${businessData.index}/${businessData.databaseId}`],
+ [`Owner`, `${ownerName} (${getBusinessOwnerTypeText(businessData.ownerType)})`],
+ [`Locked`, `${getLockedUnlockedFromBool(businessData.locked)}`],
+ [`BuyPrice`, `$${businessData.buyPrice}`],
+ //[`RentPrice`, `${businessData.rentPrice}`],
+ [`HasInterior`, `${getYesNoFromBool(businessData.hasInterior)}`],
+ [`CustomInterior`, `${getYesNoFromBool(businessData.customInterior)}`],
+ [`HasBuyableItems`, `${getYesNoFromBool(doesBusinessHaveAnyItemsToBuy(businessId))}`],
+ [`EntranceFee`, `$${businessData.entranceFee}`],
+ [`InteriorLights`, `${getOnOffFromBool(businessData.interiorLights)}`],
+ [`Balance`, `$${businessData.till}`],
+ [`RadioStation`, `${businessData.streamingRadioStation}`],
+ [`LabelHelpType`, `${businessData.labelHelpType}`],
+ ];
+
+ let stats = tempStats.map(stat => `{MAINCOLOUR}${stat[0]}: {ALTCOLOUR}${stat[1]}{MAINCOLOUR}`);
+
+ messagePlayerNormal(client, makeChatBoxSectionHeader(getLocaleString(client, "HeaderBusinessInfo", businessData.name)));
+ let chunkedList = splitArrayIntoChunks(stats, 6);
+ for (let i in chunkedList) {
+ messagePlayerInfo(client, chunkedList[i].join(", "));
+ }
+
+ //messagePlayerInfo(client, `🏢 {businessBlue}[Business Info] {MAINCOLOUR}Name: {ALTCOLOUR}${getBusinessData(businessId).name}, {MAINCOLOUR}Owner: {ALTCOLOUR}${ownerName} (${getBusinessOwnerTypeText(getBusinessData(businessId).ownerType)}), {MAINCOLOUR}Locked: {ALTCOLOUR}${getYesNoFromBool(intToBool(getBusinessData(businessId).locked))}, {MAINCOLOUR}ID: {ALTCOLOUR}${businessId}/${getBusinessData(businessId).databaseId}`);
}
// ===========================================================================
+/**
+ * This is a command handler function.
+ *
+ * @param {string} command - The command name used by the player
+ * @param {string} params - The parameters/args string used with the command by the player
+ * @param {Client} client - The client/player that used the command
+ * @return {bool} Whether or not the command was successful
+ *
+ */
function getBusinessFloorItemsCommand(command, params, client) {
let businessId = getPlayerBusiness(client);
- if(!areParamsEmpty(params)) {
+ if (!areParamsEmpty(params)) {
businessId = getBusinessFromParams(params);
}
- if(!getBusinessData(businessId)) {
+ if (!getBusinessData(businessId)) {
messagePlayerError(client, getLocaleString(client, "InvalidBusiness"));
return false;
}
@@ -810,14 +951,23 @@ function getBusinessFloorItemsCommand(command, params, client) {
// ===========================================================================
+/**
+ * This is a command handler function.
+ *
+ * @param {string} command - The command name used by the player
+ * @param {string} params - The parameters/args string used with the command by the player
+ * @param {Client} client - The client/player that used the command
+ * @return {bool} Whether or not the command was successful
+ *
+ */
function getBusinessStorageItemsCommand(command, params, client) {
let businessId = getPlayerBusiness(client);
- if(!areParamsEmpty(params)) {
+ if (!areParamsEmpty(params)) {
businessId = getBusinessFromParams(params);
}
- if(!getBusinessData(businessId)) {
+ if (!getBusinessData(businessId)) {
messagePlayerError(client, getLocaleString(client, "InvalidBusiness"));
return false;
}
@@ -827,29 +977,38 @@ function getBusinessStorageItemsCommand(command, params, client) {
// ===========================================================================
+/**
+ * This is a command handler function.
+ *
+ * @param {string} command - The command name used by the player
+ * @param {string} params - The parameters/args string used with the command by the player
+ * @param {Client} client - The client/player that used the command
+ * @return {bool} Whether or not the command was successful
+ *
+ */
function setBusinessPickupCommand(command, params, client) {
let typeParam = getParam(params, " ", 1) || "business";
let businessId = getPlayerBusiness(client);
- if(!getBusinessData(businessId)) {
+ if (!getBusinessData(businessId)) {
messagePlayerError(client, getLocaleString(client, "InvalidBusiness"));
return false;
}
- if(isNaN(typeParam)) {
- if(isNull(getGameConfig().pickupModels[getServerGame()][typeParam])) {
+ if (isNaN(typeParam)) {
+ if (isNull(getGameConfig().pickupModels[getGame()][typeParam])) {
messagePlayerError(client, "Invalid pickup type! Use a pickup type name or a model ID");
- let pickupTypes = Object.keys(getGameConfig().pickupModels[getServerGame()]);
+ let pickupTypes = Object.keys(getGameConfig().pickupModels[getGame()]);
let chunkedList = splitArrayIntoChunks(pickupTypes, 10);
messagePlayerNormal(client, makeChatBoxSectionHeader(getLocaleString(client, "HeaderPickupTypes")));
- for(let i in chunkedList) {
+ for (let i in chunkedList) {
messagePlayerInfo(client, chunkedList[i].join(", "));
}
return false;
}
- getBusinessData(businessId).entrancePickupModel = getGameConfig().pickupModels[getServerGame()][typeParam];
+ getBusinessData(businessId).entrancePickupModel = getGameConfig().pickupModels[getGame()][typeParam];
} else {
getBusinessData(businessId).entrancePickupModel = toInteger(typeParam);
}
@@ -858,48 +1017,66 @@ function setBusinessPickupCommand(command, params, client) {
getBusinessData(businessId).needsSaved = true;
- messageAdmins(`{ALTCOLOUR}${getPlayerName(client)}{MAINCOLOUR} set business {businessBlue}${getBusinessData(businessId).name} {MAINCOLOUR}pickup display to {ALTCOLOUR}${typeParam}!`);
+ messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} set business {businessBlue}${getBusinessData(businessId).name}{MAINCOLOUR} pickup display to {ALTCOLOUR}${typeParam}!`);
}
// ===========================================================================
+/**
+ * This is a command handler function.
+ *
+ * @param {string} command - The command name used by the player
+ * @param {string} params - The parameters/args string used with the command by the player
+ * @param {Client} client - The client/player that used the command
+ * @return {bool} Whether or not the command was successful
+ *
+ */
function setBusinessInteriorTypeCommand(command, params, client) {
let typeParam = getParam(params, " ", 1) || "business";
let businessId = getPlayerBusiness(client);
- if(!getBusinessData(businessId)) {
+ if (!getBusinessData(businessId)) {
messagePlayerError(client, getLocaleString(client, "InvalidBusiness"));
return false;
}
- if(isNaN(typeParam)) {
- if(toLowerCase(typeParam) == "None") {
+ if (typeof getGameConfig().interiors[getGame()] == "undefined") {
+ messagePlayerError(client, `There are no interiors available for this game!`);
+ return false;
+ }
+
+ if (isNaN(typeParam)) {
+ if (toLowerCase(typeParam) == "None") {
getBusinessData(businessId).exitPosition = toVector3(0.0, 0.0, 0.0);
getBusinessData(businessId).exitDimension = 0;
getBusinessData(businessId).exitInterior = -1;
getBusinessData(businessId).hasInterior = false;
+ getBusinessData(businessId).interiorCutscene = "";
getBusinessData(businessId).exitPickupModel = -1;
- messageAdmins(`{ALTCOLOUR}${getPlayerName(client)} {MAINCOLOUR}removed business {businessBlue}${getBusinessData(businessId).name}{MAINCOLOUR} interior`);
+ getBusinessData(businessId).customInterior = false;
+ messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} removed business {businessBlue}${getBusinessData(businessId).name}{MAINCOLOUR} interior`);
return false;
}
- if(isNull(getGameConfig().interiors[getServerGame()][typeParam])) {
+ if (isNull(getGameConfig().interiors[getGame()][typeParam])) {
messagePlayerError(client, "Invalid interior type! Use an interior type name");
- let interiorTypesList = Object.keys(getGameConfig().interiors[getServerGame()]);
+ let interiorTypesList = Object.keys(getGameConfig().interiors[getGame()]);
let chunkedList = splitArrayIntoChunks(interiorTypesList, 10);
messagePlayerNormal(client, makeChatBoxSectionHeader(getLocaleString(client, "HeaderInteriorTypes")));
- for(let i in chunkedList) {
+ for (let i in chunkedList) {
messagePlayerInfo(client, chunkedList[i].join(", "));
}
return false;
}
- getBusinessData(businessId).exitPosition = getGameConfig().interiors[getServerGame()][typeParam][0];
- getBusinessData(businessId).exitInterior = getGameConfig().interiors[getServerGame()][typeParam][1];
- getBusinessData(businessId).exitDimension = getBusinessData(businessId).databaseId+getGlobalConfig().businessDimensionStart;
- getBusinessData(businessId).exitPickupModel = getGameConfig().pickupModels[getServerGame()].Exit;
+ getBusinessData(businessId).exitPosition = getGameConfig().interiors[getGame()][typeParam][0];
+ getBusinessData(businessId).exitInterior = getGameConfig().interiors[getGame()][typeParam][1];
+ getBusinessData(businessId).exitDimension = getBusinessData(businessId).databaseId + getGlobalConfig().businessDimensionStart;
+ getBusinessData(businessId).exitPickupModel = getGameConfig().pickupModels[getGame()].Exit;
getBusinessData(businessId).hasInterior = true;
+ getBusinessData(businessId).customInterior = getGameConfig().interiors[getGame()][typeParam][2];
+ getBusinessData(businessId).interiorCutscene = getGameConfig().interiors[getGame()][typeParam][3];
}
//deleteBusinessExitPickup(businessId);
@@ -911,35 +1088,103 @@ function setBusinessInteriorTypeCommand(command, params, client) {
getBusinessData(businessId).needsSaved = true;
- messageAdmins(`{ALTCOLOUR}${getPlayerName(client)}{MAINCOLOUR} set business {businessBlue}${getBusinessData(businessId).name}{MAINCOLOUR} interior type to {ALTCOLOUR}${typeParam}`);
+ messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} set business {businessBlue}${getBusinessData(businessId).name}{MAINCOLOUR} interior type to {ALTCOLOUR}${typeParam}`);
}
// ===========================================================================
-function setBusinessBlipCommand(command, params, client) {
- let typeParam = getParam(params, " ", 1) || "business";
+/**
+ * This is a command handler function.
+ *
+ * @param {string} command - The command name used by the player
+ * @param {string} params - The parameters/args string used with the command by the player
+ * @param {Client} client - The client/player that used the command
+ * @return {bool} Whether or not the command was successful
+ *
+ */
+function addBusinessPropertyTemplateEntities(command, params, client) {
+ let propertyTemplateParam = getParam(params, " ", 1) || "business";
let businessId = getPlayerBusiness(client);
- if(!getBusinessData(businessId)) {
+ if (!getBusinessData(businessId)) {
messagePlayerError(client, getLocaleString(client, "InvalidBusiness"));
return false;
}
- if(isNaN(typeParam)) {
- if(isNull(getGameConfig().blipSprites[getServerGame()][typeParam])) {
- messagePlayerError(client, "Invalid business type! Use a business type name or a blip image ID");
+ if (typeof getGameConfig().interiors[getGame()] == "undefined") {
+ messagePlayerError(client, `There are no property templates available for this game!`);
+ return false;
+ }
- let blipTypes = Object.keys(getGameConfig().blipSprites[getServerGame()]);
- let chunkedList = splitArrayIntoChunks(blipTypes, 10);
+ if (isNaN(propertyTemplateParam)) {
+ if (isNull(getGameConfig().interiors[getGame()][typeParam])) {
+ messagePlayerError(client, "Invalid interior type! Use an interior type name");
+ let interiorTypesList = Object.keys(getGameConfig().properties[getGame()]);
+ let chunkedList = splitArrayIntoChunks(interiorTypesList, 10);
- messagePlayerNormal(client, makeChatBoxSectionHeader(getLocaleString(client, "HeaderBlipTypes")));
- for(let i in chunkedList) {
+ messagePlayerNormal(client, makeChatBoxSectionHeader(getLocaleString(client, "HeaderPropertyTemplateTypes")));
+ for (let i in chunkedList) {
messagePlayerInfo(client, chunkedList[i].join(", "));
}
return false;
}
- getBusinessData(businessId).entranceBlipModel = getGameConfig().blipSprites[getServerGame()][typeParam];
+ getBusinessData(businessId).exitPosition = getGameConfig().interiors[getGame()][typeParam][0];
+ getBusinessData(businessId).exitInterior = getGameConfig().interiors[getGame()][typeParam][1];
+ getBusinessData(businessId).exitDimension = getBusinessData(businessId).databaseId + getGlobalConfig().businessDimensionStart;
+ getBusinessData(businessId).exitPickupModel = getGameConfig().pickupModels[getGame()].Exit;
+ getBusinessData(businessId).hasInterior = true;
+ getBusinessData(businessId).customInterior = getGameConfig().interiors[getGame()][typeParam][2];
+ getBusinessData(businessId).interiorCutscene = getGameConfig().interiors[getGame()][typeParam][3];
+ }
+
+ //deleteBusinessExitPickup(businessId);
+ //deleteBusinessExitBlip(businessId);
+ //createBusinessExitBlip(businessId);
+ //createBusinessExitPickup(businessId);
+
+ resetBusinessPickups(businessId);
+
+ getBusinessData(businessId).needsSaved = true;
+
+ messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} set business {businessBlue}${getBusinessData(businessId).name}{MAINCOLOUR} interior type to {ALTCOLOUR}${typeParam}`);
+}
+
+// ===========================================================================
+
+/**
+ * This is a command handler function.
+ *
+ * @param {string} command - The command name used by the player
+ * @param {string} params - The parameters/args string used with the command by the player
+ * @param {Client} client - The client/player that used the command
+ * @return {bool} Whether or not the command was successful
+ *
+ */
+function setBusinessBlipCommand(command, params, client) {
+ let typeParam = getParam(params, " ", 1) || "business";
+ let businessId = getPlayerBusiness(client);
+
+ if (!getBusinessData(businessId)) {
+ messagePlayerError(client, getLocaleString(client, "InvalidBusiness"));
+ return false;
+ }
+
+ if (isNaN(typeParam)) {
+ if (isNull(getGameConfig().blipSprites[getGame()][typeParam])) {
+ messagePlayerError(client, "Invalid business type! Use a business type name or a blip image ID");
+
+ let blipTypes = Object.keys(getGameConfig().blipSprites[getGame()]);
+ let chunkedList = splitArrayIntoChunks(blipTypes, 10);
+
+ messagePlayerNormal(client, makeChatBoxSectionHeader(getLocaleString(client, "HeaderBlipTypes")));
+ for (let i in chunkedList) {
+ messagePlayerInfo(client, chunkedList[i].join(", "));
+ }
+ return false;
+ }
+
+ getBusinessData(businessId).entranceBlipModel = getGameConfig().blipSprites[getGame()][typeParam];
} else {
getBusinessData(businessId).entranceBlipModel = toInteger(typeParam);
}
@@ -947,110 +1192,155 @@ function setBusinessBlipCommand(command, params, client) {
resetBusinessBlips(businessId);
getBusinessData(businessId).needsSaved = true;
- messageAdmins(`{ALTCOLOUR}${getPlayerName(client)} {MAINCOLOUR}set business {businessBlue}${getBusinessData(businessId).name}{MAINCOLOUR} blip display to {ALTCOLOUR}${typeParam}`);
+ messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} set business {businessBlue}${getBusinessData(businessId).name}{MAINCOLOUR} blip display to {ALTCOLOUR}${typeParam}`);
}
// ===========================================================================
+/**
+ * This is a command handler function.
+ *
+ * @param {string} command - The command name used by the player
+ * @param {string} params - The parameters/args string used with the command by the player
+ * @param {Client} client - The client/player that used the command
+ * @return {bool} Whether or not the command was successful
+ *
+ */
function giveDefaultItemsToBusinessCommand(command, params, client) {
let typeParam = getParam(params, " ", 1) || "business";
let businessId = getPlayerBusiness(client);
- if(!getBusinessData(businessId)) {
+ if (!getBusinessData(businessId)) {
messagePlayerError(client, getLocaleString(client, "InvalidBusiness"));
return false;
}
- if(!isNaN(typeParam)) {
+ if (!isNaN(typeParam)) {
messagePlayerError(client, getLocaleString(client, "InvalidBusiness"));
return false;
}
- if(isNull(getGameConfig().defaultBusinessItems[getServerGame()][typeParam])) {
+ if (isNull(getGameConfig().defaultBusinessItems[getGame()][typeParam])) {
messagePlayerError(client, "Invalid business items type! Use a business items type name");
- let businessItemTypes = Object.keys(getGameConfig().defaultBusinessItems[getServerGame()]);
+ let businessItemTypes = Object.keys(getGameConfig().defaultBusinessItems[getGame()]);
let chunkedList = splitArrayIntoChunks(businessItemTypes, 10);
messagePlayerNormal(client, makeChatBoxSectionHeader(getLocaleString(client, "HeaderDefaultBusinessItemTypes")));
- for(let i in chunkedList) {
+ for (let i in chunkedList) {
messagePlayerInfo(client, chunkedList[i].join(", "));
}
return false;
}
- for(let i in getGameConfig().defaultBusinessItems[getServerGame()][typeParam]) {
- let itemTypeId = getItemTypeFromParams(getGameConfig().defaultBusinessItems[getServerGame()][typeParam][i][0]);
+ for (let i in getGameConfig().defaultBusinessItems[getGame()][typeParam]) {
+ let itemTypeId = getItemTypeFromParams(getGameConfig().defaultBusinessItems[getGame()][typeParam][i][0]);
let itemTypeData = getItemTypeData(itemTypeId);
- if(itemTypeData) {
- let newItemIndex = createItem(itemTypeId, itemTypeData.orderValue, VRR_ITEM_OWNER_BIZFLOOR, getBusinessData(businessId).databaseId, getGameConfig().defaultBusinessItems[getServerGame()][typeParam][i][1]);
- getItemData(newItemIndex).buyPrice = applyServerInflationMultiplier(itemTypeData.orderPrice)*getGameConfig().defaultBusinessItems[getServerGame()][typeParam][i][2];
+ if (itemTypeData) {
+ let newItemIndex = createItem(itemTypeId, itemTypeData.orderValue, VRR_ITEM_OWNER_BIZFLOOR, getBusinessData(businessId).databaseId, getGameConfig().defaultBusinessItems[getGame()][typeParam][i][1]);
+ getItemData(newItemIndex).buyPrice = applyServerInflationMultiplier(itemTypeData.orderPrice) * getGameConfig().defaultBusinessItems[getGame()][typeParam][i][2];
}
}
cacheBusinessItems(businessId);
updateBusinessPickupLabelData(businessId);
- messageAdmins(`{ALTCOLOUR}${getPlayerName(client)} {MAINCOLOUR}gave business {businessBlue}${getBusinessData(businessId).name} {MAINCOLOUR}the default items for ${toLowerCase(typeParam)}`);
+ messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} gave business {businessBlue}${getBusinessData(businessId).name}{MAINCOLOUR} the default items for ${toLowerCase(typeParam)}`);
}
// ===========================================================================
+/**
+ * This is a command handler function.
+ *
+ * @param {string} command - The command name used by the player
+ * @param {string} params - The parameters/args string used with the command by the player
+ * @param {Client} client - The client/player that used the command
+ * @return {bool} Whether or not the command was successful
+ *
+ */
function setBusinessEntranceLabelToDealershipCommand(command, params, client) {
let businessId = getPlayerBusiness(client);
- if(!getBusinessData(businessId)) {
+ if (!getBusinessData(businessId)) {
messagePlayerError(client, getLocaleString(client, "InvalidBusiness"));
return false;
}
getBusinessData(businessId).labelHelpType == VRR_PROPLABEL_INFO_ENTERVEHICLE;
updateBusinessPickupLabelData(businessId);
- messageAdmins(`{ALTCOLOUR}${getPlayerName(client)} {MAINCOLOUR}set the business type of {businessBlue}${getBusinessData(businessId).name} {MAINCOLOUR}to dealership`);
+ messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} set the business type of {businessBlue}${getBusinessData(businessId).name}{MAINCOLOUR} to dealership`);
}
// ===========================================================================
+/**
+ * This is a command handler function.
+ *
+ * @param {string} command - The command name used by the player
+ * @param {string} params - The parameters/args string used with the command by the player
+ * @param {Client} client - The client/player that used the command
+ * @return {bool} Whether or not the command was successful
+ *
+ */
function deleteBusinessFloorItemsCommand(command, params, client) {
let businessId = getPlayerBusiness(client);
- if(!getBusinessData(businessId)) {
+ if (!getBusinessData(businessId)) {
messagePlayerError(client, getLocaleString(client, "InvalidBusiness"));
return false;
}
let tempCache = getBusinessData(businessId).floorItemCache;
- for(let i in tempCache) {
+ for (let i in tempCache) {
deleteItem(tempCache[i]);
}
cacheBusinessItems(businessId);
- messageAdmins(`{ALTCOLOUR}${getPlayerName(client)} {MAINCOLOUR}deleted all on-sale items for business {businessBlue}${getBusinessData(businessId).name}`);
+ messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} deleted all on-sale items for business {businessBlue}${getBusinessData(businessId).name}`);
}
// ===========================================================================
+/**
+ * This is a command handler function.
+ *
+ * @param {string} command - The command name used by the player
+ * @param {string} params - The parameters/args string used with the command by the player
+ * @param {Client} client - The client/player that used the command
+ * @return {bool} Whether or not the command was successful
+ *
+ */
function deleteBusinessStorageItemsCommand(command, params, client) {
let businessId = getPlayerBusiness(client);
- if(!getBusinessData(businessId)) {
+ if (!getBusinessData(businessId)) {
messagePlayerError(client, getLocaleString(client, "InvalidBusiness"));
return false;
}
let tempCache = getBusinessData(businessId).storageItemCache;
- for(let i in tempCache) {
+ for (let i in tempCache) {
deleteItem(tempCache[i]);
}
cacheBusinessItems(businessId);
- messageAdmins(`{ALTCOLOUR}${getPlayerName(client)} {MAINCOLOUR}deleted all stored items for business {businessBlue}${getBusinessData(businessId).name}`);
+ messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} deleted all stored items for business {businessBlue}${getBusinessData(businessId).name}`);
}
// ===========================================================================
+/**
+ * This is a command handler function.
+ *
+ * @param {string} command - The command name used by the player
+ * @param {string} params - The parameters/args string used with the command by the player
+ * @param {Client} client - The client/player that used the command
+ * @return {bool} Whether or not the command was successful
+ *
+ */
function withdrawFromBusinessCommand(command, params, client) {
- if(areParamsEmpty(params)) {
+ if (areParamsEmpty(params)) {
messagePlayerSyntax(client, getCommandSyntaxText(command));
return false;
}
@@ -1058,17 +1348,17 @@ function withdrawFromBusinessCommand(command, params, client) {
let amount = toInteger(getParam(params, " ", 1)) || 0;
let businessId = getPlayerBusiness(client);
- if(!getBusinessData(businessId)) {
+ if (!getBusinessData(businessId)) {
messagePlayerError(client, getLocaleString(client, "InvalidBusiness"));
return false;
}
- if(!canPlayerManageBusiness(client, businessId)) {
- messagePlayerError(client, "You can't withdraw cash from this business!");
+ if (!canPlayerManageBusiness(client, businessId)) {
+ messagePlayerError(client, getLocaleString(client, "CantModifyBusiness"));
return false;
}
- if(getBusinessData(businessId).till < amount) {
+ if (getBusinessData(businessId).till < amount) {
messagePlayerError(client, `Business {businessBlue}${tempBusinessData.name} doesn't have that much money! Use /bizbalance.`);
return false;
}
@@ -1083,8 +1373,17 @@ function withdrawFromBusinessCommand(command, params, client) {
// ===========================================================================
+/**
+ * This is a command handler function.
+ *
+ * @param {string} command - The command name used by the player
+ * @param {string} params - The parameters/args string used with the command by the player
+ * @param {Client} client - The client/player that used the command
+ * @return {bool} Whether or not the command was successful
+ *
+ */
function setBusinessBuyPriceCommand(command, params, client) {
- if(areParamsEmpty(params)) {
+ if (areParamsEmpty(params)) {
messagePlayerSyntax(client, getCommandSyntaxText(command));
return false;
}
@@ -1092,17 +1391,17 @@ function setBusinessBuyPriceCommand(command, params, client) {
let amount = toInteger(getParam(params, " ", 1)) || 0;
let businessId = getPlayerBusiness(client);
- if(!getBusinessData(businessId)) {
+ if (!getBusinessData(businessId)) {
messagePlayerError(client, getLocaleString(client, "InvalidBusiness"));
return false;
}
- if(!canPlayerManageBusiness(client, businessId)) {
- messagePlayerError(client, "You can't change the purchase price for this business!");
+ if (!canPlayerManageBusiness(client, businessId)) {
+ messagePlayerError(client, getLocaleString(client, "CantModifyBusiness"));
return false;
}
- if(amount < 0) {
+ if (amount < 0) {
messagePlayerError(client, `The amount can't be less than 0!`);
return false;
}
@@ -1116,8 +1415,17 @@ function setBusinessBuyPriceCommand(command, params, client) {
// ===========================================================================
+/**
+ * This is a command handler function.
+ *
+ * @param {string} command - The command name used by the player
+ * @param {string} params - The parameters/args string used with the command by the player
+ * @param {Client} client - The client/player that used the command
+ * @return {bool} Whether or not the command was successful
+ *
+ */
function depositIntoBusinessCommand(command, params, client) {
- if(areParamsEmpty(params)) {
+ if (areParamsEmpty(params)) {
messagePlayerSyntax(client, getCommandSyntaxText(command));
return false;
}
@@ -1125,7 +1433,7 @@ function depositIntoBusinessCommand(command, params, client) {
let amount = toInteger(getParam(params, " ", 1)) || 0;
let businessId = getPlayerBusiness(client);
- if(!getBusinessData(businessId)) {
+ if (!getBusinessData(businessId)) {
messagePlayerError(client, getLocaleString(client, "InvalidBusiness"));
return false;
}
@@ -1136,7 +1444,7 @@ function depositIntoBusinessCommand(command, params, client) {
// return false;
//}
- if(getPlayerCurrentSubAccount(client).cash < amount) {
+ if (getPlayerCurrentSubAccount(client).cash < amount) {
messagePlayerError(client, `You don't have that much money! You only have $${getPlayerCurrentSubAccount(client).cash}`);
return false;
}
@@ -1151,21 +1459,30 @@ function depositIntoBusinessCommand(command, params, client) {
// ===========================================================================
+/**
+ * This is a command handler function.
+ *
+ * @param {string} command - The command name used by the player
+ * @param {string} params - The parameters/args string used with the command by the player
+ * @param {Client} client - The client/player that used the command
+ * @return {bool} Whether or not the command was successful
+ *
+ */
function orderItemForBusinessCommand(command, params, client) {
- if(areParamsEmpty(params)) {
+ if (areParamsEmpty(params)) {
messagePlayerSyntax(client, getCommandSyntaxText(command));
return false;
}
- if(!areThereEnoughParams(params, 3, " ")) {
+ if (!areThereEnoughParams(params, 3, " ")) {
messagePlayerSyntax(client, getCommandSyntaxText(command));
return false;
}
let splitParams = params.split(" ");
- let itemType = getItemTypeFromParams(splitParams.slice(0,-2).join(" "));
+ let itemType = getItemTypeFromParams(splitParams.slice(0, -2).join(" "));
- if(!getItemTypeData(itemType)) {
+ if (!getItemTypeData(itemType)) {
messagePlayerError(client, `Invalid item type name or ID!`);
messagePlayerInfo(client, `Use {ALTCOLOUR}/itemtypes {MAINCOLOUR}for a list of items`);
return false;
@@ -1176,19 +1493,19 @@ function orderItemForBusinessCommand(command, params, client) {
let value = toInteger(splitParams.slice(-1)) || getItemTypeData(itemType).capacity;
let businessId = getPlayerBusiness(client);
- logToConsole(LOG_DEBUG, `[VRR.Business] ${getPlayerDisplayForConsole(client)} is ordering ${amount} ${splitParams.slice(0,-2).join(" ")} (${value})`);
+ logToConsole(LOG_DEBUG, `[VRR.Business] ${getPlayerDisplayForConsole(client)} is ordering ${amount} ${splitParams.slice(0, -2).join(" ")} (${value})`);
- if(!getBusinessData(businessId)) {
+ if (!getBusinessData(businessId)) {
messagePlayerError(client, getLocaleString(client, "InvalidBusiness"));
return false;
}
- if(!canPlayerManageBusiness(client, businessId)) {
- messagePlayerError(client, "You can't order items for this business!");
+ if (!canPlayerManageBusiness(client, businessId)) {
+ messagePlayerError(client, getLocaleString(client, "CantModifyBusiness"));
return false;
}
- let orderTotalCost = pricePerItem*amount;
+ let orderTotalCost = pricePerItem * amount;
//getPlayerData(client).promptType = VRR_PROMPT_BIZORDER;
getPlayerData(client).businessOrderAmount = amount;
@@ -1198,14 +1515,24 @@ function orderItemForBusinessCommand(command, params, client) {
getPlayerData(client).businessOrderCost = orderTotalCost;
getBusinessData(businessId).needsSaved = true;
- showPlayerPrompt(client, VRR_PROMPT_BIZORDER, `Ordering ${amount} ${getPluralForm(getItemTypeData(itemType).name)} (${getItemValueDisplay(itemType, value)}) at $${makeLargeNumberReadable(pricePerItem)} each will cost a total of $${makeLargeNumberReadable(orderTotalCost)}`, "Business Order Cost");
+ showPlayerPrompt(client, `Ordering ${amount} ${getPluralForm(getItemTypeData(itemType).name)} (${getItemValueDisplay(itemType, value)}) at $${makeLargeNumberReadable(pricePerItem)} each will cost a total of $${makeLargeNumberReadable(orderTotalCost)}`, "Business Order Cost");
+ getPlayerData(client).promptType = VRR_PROMPT_BIZORDER;
}
// ===========================================================================
+/**
+ * This is a command handler function.
+ *
+ * @param {string} command - The command name used by the player
+ * @param {string} params - The parameters/args string used with the command by the player
+ * @param {Client} client - The client/player that used the command
+ * @return {bool} Whether or not the command was successful
+ *
+ */
function orderItemForBusiness(businessId, itemType, amount) {
- if(getBusinessData(businessId).till < orderTotalCost) {
- let neededAmount = orderTotalCost-getBusinessData(businessId).till;
+ if (getBusinessData(businessId).till < orderTotalCost) {
+ let neededAmount = orderTotalCost - getBusinessData(businessId).till;
//messagePlayerError(client, `The business doesn't have enough money (needs {ALTCOLOUR}$${neededAmount} {MAINCOLOUR}more)! Use {ALTCOLOUR}/bizdeposit {MAINCOLOUR}to add money to the business.`);
return false;
}
@@ -1217,66 +1544,87 @@ function orderItemForBusiness(businessId, itemType, amount) {
// ===========================================================================
+/**
+ * This is a command handler function.
+ *
+ * @param {string} command - The command name used by the player
+ * @param {string} params - The parameters/args string used with the command by the player
+ * @param {Client} client - The client/player that used the command
+ * @return {bool} Whether or not the command was successful
+ *
+ */
function viewBusinessTillAmountCommand(command, params, client) {
let businessId = getPlayerBusiness(client);
- if(!areParamsEmpty(params)) {
+ if (!areParamsEmpty(params)) {
businessId = getBusinessFromParams(params);
}
- if(!getBusinessData(businessId)) {
+ if (!getBusinessData(businessId)) {
messagePlayerError(client, getLocaleString(client, "InvalidBusiness"));
return false;
}
- if(!canPlayerManageBusiness(client, businessId)) {
- messagePlayerError(client, "You can't see the till amount for this business!");
+ if (!canPlayerManageBusiness(client, businessId)) {
+ messagePlayerError(client, getLocaleString(client, "CantModifyBusiness"));
return false;
}
- messagePlayerSuccess(client, `Business {businessBlue}${getBusinessData(businessId).name} {MAINCOLOUR}till has {ALTCOLOUR}$${getBusinessData(businessId).till}`);
+ messagePlayerSuccess(client, `Business {businessBlue}${getBusinessData(businessId).name}{MAINCOLOUR} till has {ALTCOLOUR}$${getBusinessData(businessId).till}`);
}
// ===========================================================================
+/**
+ * This is a command handler function.
+ *
+ * @param {string} command - The command name used by the player
+ * @param {string} params - The parameters/args string used with the command by the player
+ * @param {Client} client - The client/player that used the command
+ * @return {bool} Whether or not the command was successful
+ *
+ */
function buyBusinessCommand(command, params, client) {
let businessId = getPlayerBusiness(client);
- if(!getBusinessData(businessId)) {
+ if (!getBusinessData(businessId)) {
messagePlayerError(client, getLocaleString(client, "InvalidBusiness"));
return false;
}
- if(getBusinessData(businessId).buyPrice <= 0) {
+ if (getBusinessData(businessId).buyPrice <= 0) {
messagePlayerError(client, getLocaleString(client, "BusinessNotForSale"));
return false;
}
- if(getPlayerCurrentSubAccount(client).cash < getBusinessData(businessId).buyPrice) {
+ if (getPlayerCurrentSubAccount(client).cash < getBusinessData(businessId).buyPrice) {
messagePlayerError(client, getLocaleString(client, "BusinessPurchaseNotEnoughMoney"));
return false;
}
- getBusinessData(businessId).ownerType = VRR_BIZOWNER_PLAYER;
- getBusinessData(businessId).ownerId = getPlayerCurrentSubAccount(client).databaseId;
- getBusinessData(businessId).buyPrice = 0;
-
- updateBusinessPickupLabelData(businessId);
- getBusinessData(businessId).needsSaved = true;
-
- messagePlayerSuccess(client, `You are now the owner of {businessBlue}${getBusinessData(businessId).name}`);
+ showPlayerPrompt(client, getLocaleString(client, "BuyBusinessConfirmMessage"), getLocaleString(client, "BuyBusinessConfirmTitle"), getLocaleString(client, "Yes"), getLocaleString(client, "No"));
+ getPlayerData(client).promptType = VRR_PROMPT_BIZBUY;
}
// ===========================================================================
+/**
+ * This is a command handler function.
+ *
+ * @param {string} command - The command name used by the player
+ * @param {string} params - The parameters/args string used with the command by the player
+ * @param {Client} client - The client/player that used the command
+ * @return {bool} Whether or not the command was successful
+ *
+ */
function moveBusinessEntranceCommand(command, params, client) {
let businessId = getPlayerBusiness(client);
- if(!areParamsEmpty(params)) {
+ if (!areParamsEmpty(params)) {
businessId = getBusinessFromParams(params);
}
- if(!getBusinessData(businessId)) {
+ if (!getBusinessData(businessId)) {
messagePlayerError(client, getLocaleString(client, "InvalidBusiness"));
return false;
}
@@ -1295,19 +1643,28 @@ function moveBusinessEntranceCommand(command, params, client) {
getBusinessData(businessId).needsSaved = true;
- messageAdmins(`{ALTCOLOUR}${getPlayerName(client)} {MAINCOLOUR}moved business {businessBlue}${getBusinessData(businessId).name} {MAINCOLOUR}entrance to their position`);
+ messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} moved business {businessBlue}${getBusinessData(businessId).name}{MAINCOLOUR} entrance to their position`);
}
// ===========================================================================
+/**
+ * This is a command handler function.
+ *
+ * @param {string} command - The command name used by the player
+ * @param {string} params - The parameters/args string used with the command by the player
+ * @param {Client} client - The client/player that used the command
+ * @return {bool} Whether or not the command was successful
+ *
+ */
function moveBusinessExitCommand(command, params, client) {
let businessId = getPlayerBusiness(client);
- if(!areParamsEmpty(params)) {
+ if (!areParamsEmpty(params)) {
businessId = getBusinessFromParams(params);
}
- if(!getBusinessData(businessId)) {
+ if (!getBusinessData(businessId)) {
messagePlayerError(client, getLocaleString(client, "InvalidBusiness"));
return false;
}
@@ -1324,14 +1681,14 @@ function moveBusinessExitCommand(command, params, client) {
getBusinessData(businessId).needsSaved = true;
- messageAdmins(`{ALTCOLOUR}${getPlayerName(client)} {MAINCOLOUR}moved business {businessBlue}${getBusinessData(businessId).name} {MAINCOLOUR}exit to their position`);
+ messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} moved business {businessBlue}${getBusinessData(businessId).name}{MAINCOLOUR}exit to their position`);
}
// ===========================================================================
function getBusinessDataFromDatabaseId(databaseId) {
let matchingBusinesses = getServerData().businesses.filter(b => b.databaseId == businessId)
- if(matchingBusinesses.length == 1) {
+ if (matchingBusinesses.length == 1) {
return matchingBusinesses[0];
}
return false;
@@ -1339,11 +1696,19 @@ function getBusinessDataFromDatabaseId(databaseId) {
// ===========================================================================
+/**
+ * Gets the closest business entrance to a position
+ *
+ * @param {Vector3} position - The position to check
+ * @param {Number} dimension - The dimension to check
+ * @return {Number} The data index of the business
+ *
+ */
function getClosestBusinessEntrance(position, dimension) {
let closest = 0;
- for(let i in getServerData().businesses) {
- if(getServerData().businesses[i].entranceDimension == dimension) {
- if(getDistance(position, getServerData().businesses[i].entrancePosition) <= getDistance(position, getServerData().businesses[closest].entrancePosition)) {
+ for (let i in getServerData().businesses) {
+ if (getServerData().businesses[i].entranceDimension == dimension) {
+ if (getDistance(position, getServerData().businesses[i].entrancePosition) <= getDistance(position, getServerData().businesses[closest].entrancePosition)) {
closest = i;
}
}
@@ -1353,11 +1718,19 @@ function getClosestBusinessEntrance(position, dimension) {
// ===========================================================================
+/**
+ * Gets the closest business exit to a position
+ *
+ * @param {Vector3} position - The position to check
+ * @param {Number} dimension - The dimension to check
+ * @return {Number} The data index of the business
+ *
+ */
function getClosestBusinessExit(position, dimension) {
let closest = 0;
- for(let i in getServerData().businesses) {
- if(getServerData().businesses[i].hasInterior && getServerData().businesses[i].exitDimension == dimension) {
- if(getDistance(position, getServerData().businesses[i].exitPosition) <= getDistance(position, getServerData().businesses[closest].exitPosition)) {
+ for (let i in getServerData().businesses) {
+ if (getServerData().businesses[i].hasInterior && getServerData().businesses[i].exitDimension == dimension) {
+ if (getDistance(position, getServerData().businesses[i].exitPosition) <= getDistance(position, getServerData().businesses[closest].exitPosition)) {
closest = i;
}
}
@@ -1367,9 +1740,16 @@ function getClosestBusinessExit(position, dimension) {
// ===========================================================================
+/**
+ * Gets whether or not a client is in a business
+ *
+ * @param {Client} client - The client to check whether or not is in a business
+ * @return {Boolean} Whether or not the client is in a business
+ *
+ */
function isPlayerInAnyBusiness(client) {
- for(let i in getServerData().businesses) {
- if(getServerData().businesses[i].hasInterior && getServerData().businesses[i].exitDimension == getPlayerDimension(client)) {
+ for (let i in getServerData().businesses) {
+ if (getServerData().businesses[i].hasInterior && getServerData().businesses[i].exitDimension == getPlayerDimension(client)) {
return i;
}
}
@@ -1379,43 +1759,79 @@ function isPlayerInAnyBusiness(client) {
// ===========================================================================
+/**
+ * Gets the data index of the business a client is in
+ *
+ * @param {Client} client - The client to check whether or not is in a business
+ * @return {Number} The data index of the business
+ *
+ */
function getPlayerBusiness(client) {
- let closestEntrance = getClosestBusinessEntrance(getPlayerPosition(client), getPlayerDimension(client));
- if(getDistance(getPlayerPosition(client), getBusinessData(closestEntrance).entrancePosition) <= getGlobalConfig().enterPropertyDistance) {
- return getBusinessData(closestEntrance).index;
+ if (getServerData().businesses.length == 0) {
+ return -1;
}
- for(let i in getServerData().businesses) {
- if(getServerData().businesses[i].hasInterior && getServerData().businesses[i].exitDimension == getPlayerDimension(client)) {
- return i;
+ if (getPlayerDimension(client) == getGameConfig().mainWorldDimension[getGame()]) {
+ let closestEntrance = getClosestBusinessEntrance(getPlayerPosition(client), getPlayerDimension(client));
+ if (getDistance(getPlayerPosition(client), getBusinessData(closestEntrance).entrancePosition) <= getGlobalConfig().enterPropertyDistance) {
+ return getBusinessData(closestEntrance).index;
+ }
+ } else {
+ let closestEntrance = getClosestBusinessEntrance(getPlayerPosition(client), getPlayerDimension(client));
+ if (getDistance(getPlayerPosition(client), getBusinessData(closestEntrance).entrancePosition) <= getGlobalConfig().enterPropertyDistance) {
+ return getBusinessData(closestEntrance).index;
+ }
+
+ for (let i in getServerData().businesses) {
+ if (getServerData().businesses[i].hasInterior && getServerData().businesses[i].exitDimension == getPlayerDimension(client)) {
+ return i;
+ }
}
}
-
return -1;
}
// ===========================================================================
+/**
+ * Saves all server businesses to the database
+ *
+ * @return {Boolean} Whether or not the businesses were saved
+ *
+ */
function saveAllBusinessesToDatabase() {
- for(let i in getServerData().businesses) {
- if(getServerData().businesses[i].needsSaved) {
+ if (getServerConfig().devServer) {
+ return false;
+ }
+
+ for (let i in getServerData().businesses) {
+ if (getServerData().businesses[i].needsSaved) {
saveBusinessToDatabase(i);
}
}
+
+ return true
}
// ===========================================================================
+/**
+ * Saves a server businesses to the database by data index
+ *
+ * @param {Number} businessId - The data index of the business to save
+ * @return {Boolean} Whether or not the business was saved
+ *
+ */
function saveBusinessToDatabase(businessId) {
let tempBusinessData = getServerData().businesses[businessId];
- if(!tempBusinessData.needsSaved) {
- return false;
- }
+ if (!tempBusinessData.needsSaved) {
+ return false;
+ }
logToConsole(LOG_DEBUG, `[VRR.Business]: Saving business '${tempBusinessData.name}' to database ...`);
let dbConnection = connectToDatabase();
- if(dbConnection) {
+ if (dbConnection) {
let safeBusinessName = escapeDatabaseString(dbConnection, tempBusinessData.name);
let data = [
@@ -1434,6 +1850,7 @@ function saveBusinessToDatabase(businessId) {
["biz_entrance_vw", tempBusinessData.entranceDimension],
["biz_entrance_pickup", tempBusinessData.entrancePickupModel],
["biz_entrance_blip", tempBusinessData.entranceBlipModel],
+ ["biz_entrance_cutscene", tempBusinessData.entranceCutscene],
["biz_exit_pos_x", tempBusinessData.exitPosition.x],
["biz_exit_pos_y", tempBusinessData.exitPosition.y],
["biz_exit_pos_z", tempBusinessData.exitPosition.z],
@@ -1442,14 +1859,18 @@ function saveBusinessToDatabase(businessId) {
["biz_exit_vw", tempBusinessData.exitDimension],
["biz_exit_pickup", tempBusinessData.exitPickupModel],
["biz_exit_blip", tempBusinessData.exitBlipModel],
+ ["biz_exit_cutscene", tempBusinessData.exitCutscene],
["biz_has_interior", boolToInt(tempBusinessData.hasInterior)],
["biz_interior_lights", boolToInt(tempBusinessData.interiorLights)],
["biz_label_help_type", tempBusinessData.labelHelpType],
["biz_radiostation", tempBusinessData.streamingRadioStation],
+ ["biz_custom_interior", boolToInt(tempBusinessData.customInterior)],
+ ["biz_buy_price", boolToInt(tempBusinessData.buyPrice)],
+ //["biz_rent_price", boolToInt(tempBusinessData.rentPrice)],
];
let dbQuery = null;
- if(tempBusinessData.databaseId == 0) {
+ if (tempBusinessData.databaseId == 0) {
let queryString = createDatabaseInsertQuery("biz_main", data);
dbQuery = queryDatabase(dbConnection, queryString);
getServerData().businesses[businessId].databaseId = getDatabaseInsertId(dbConnection);
@@ -1471,26 +1892,48 @@ function saveBusinessToDatabase(businessId) {
// ===========================================================================
+/**
+ * Creates all server pickups for all businesses
+ *
+ * @return {Boolean} Whether or not the server pickups were created
+ *
+ */
function createAllBusinessPickups() {
- if(!getServerConfig().createBusinessPickups) {
+ if (!getServerConfig().createBusinessPickups) {
return false;
}
- for(let i in getServerData().businesses) {
+ if (!isGameFeatureSupported("pickups")) {
+ return false;
+ }
+
+ for (let i in getServerData().businesses) {
createBusinessEntrancePickup(i);
createBusinessExitPickup(i);
updateBusinessPickupLabelData(i);
}
+
+ return true;
}
// ===========================================================================
+/**
+ * Creates all server blips for all businesses
+ *
+ * @return {Boolean} Whether or not the server blips were created
+ *
+ */
function createAllBusinessBlips() {
- if(!getServerConfig().createBusinessBlips) {
+ if (!getServerConfig().createBusinessBlips) {
return false;
}
- for(let i in getServerData().businesses) {
+ if (!isGameFeatureSupported("blips")) {
+ return false;
+ }
+
+ for (let i in getServerData().businesses) {
createBusinessEntranceBlip(i);
createBusinessExitBlip(i);
}
@@ -1498,182 +1941,364 @@ function createAllBusinessBlips() {
// ===========================================================================
-function createBusinessEntrancePickup(businessId) {
- if(!getServerConfig().createBusinessPickups) {
+/**
+ * Creates the entrance pickup for a business by data index
+ *
+ * @param {Number} businessId - The data index of the business to create the pickup for
+ * @return {Boolean} Whether or not the blip was created
+ *
+ */
+function createBusinessEntrancePickup(businessId) {
+ if (!areServerElementsSupported()) {
return false;
}
- if(getBusinessData(businessId).entrancePickupModel != -1) {
- let pickupModelId = getGameConfig().pickupModels[getServerGame()].Business;
+ if (!getServerConfig().createBusinessPickups) {
+ return false;
+ }
- if(getServerData().businesses[businessId].entrancePickupModel != 0) {
- pickupModelId = getBusinessData(businessId).entrancePickupModel;
- }
+ if (!isGameFeatureSupported("pickups")) {
+ return false;
+ }
- logToConsole(LOG_VERBOSE, `[VRR.Job]: Creating entrance pickup for business ${getBusinessData(businessId).name} (model ${pickupModelId})`);
-
- if(areServerElementsSupported()) {
- getBusinessData(businessId).entrancePickup = createGamePickup(pickupModelId, getBusinessData(businessId).entrancePosition, getGameConfig().pickupTypes[getServerGame()].business);
- setElementOnAllDimensions(getBusinessData(businessId).entrancePickup, false);
- setElementDimension(getBusinessData(businessId).entrancePickup, getBusinessData(businessId).entranceDimension);
+ let businessData = getBusinessData(businessId);
+
+ //if(businessData.hasInterior) {
+ // return false;
+ //}
+
+ if (businessData.entrancePickupModel == -1) {
+ return false;
+ }
+
+ let pickupModelId = getGameConfig().pickupModels[getGame()].Business;
+
+ if (businessData.entrancePickupModel != 0) {
+ pickupModelId = businessData.entrancePickupModel;
+ }
+
+ logToConsole(LOG_VERBOSE, `[VRR.Job]: Creating entrance pickup for business ${businessData.name} (model ${pickupModelId})`);
+
+ if (areServerElementsSupported()) {
+ let entrancePickup = createGamePickup(pickupModelId, businessData.entrancePosition, getGameConfig().pickupTypes[getGame()].business);
+ if (entrancePickup != null) {
+ if (businessData.entranceDimension != -1) {
+ setElementDimension(entrancePickup, businessData.entranceDimension);
+ setElementOnAllDimensions(entrancePickup, false);
+ } else {
+ setElementOnAllDimensions(entrancePickup, true);
+ }
+
+ if (getGlobalConfig().businessPickupStreamInDistance == -1 || getGlobalConfig().businessPickupStreamOutDistance == -1) {
+ entrancePickup.netFlags.distanceStreaming = false;
+ } else {
+ setElementStreamInDistance(entrancePickup, getGlobalConfig().businessPickupStreamInDistance);
+ setElementStreamOutDistance(entrancePickup, getGlobalConfig().businessPickupStreamOutDistance);
+ }
+ setElementTransient(entrancePickup, false);
+ getBusinessData(businessId).entrancePickup = entrancePickup;
updateBusinessPickupLabelData(businessId);
- addToWorld(getBusinessData(businessId).entrancePickup);
- } else {
- sendBusinessToPlayer(null, businessId, getBusinessData(businessId), getBusinessData(businessId).entrancePosition, getBusinessData(businessId).entranceBlipModel, getBusinessData(businessId).entrancePickupModel, getBusinessData(businessId).hasInterior, false);
}
+ } else {
+ let pickupModelId = getGameConfig().pickupModels[getGame()].Business;
+
+ if (businessData.entrancePickupModel != 0) {
+ pickupModelId = businessData.entrancePickupModel;
+ }
+ sendBusinessToPlayer(null, businessId, businessData.name, businessData.entrancePosition, blipModelId, pickupModelId, businessData.hasInterior, doesBusinessHaveAnyItemsToBuy(businessId));
}
+
+ return false;
}
// ===========================================================================
+/**
+ * Creates the entrance pickup for a business by data index
+ *
+ * @param {Number} businessId - The data index of the business to create the entrance pickup for
+ * @return {Boolean} Whether or not the blip was created
+ *
+ */
function createBusinessEntranceBlip(businessId) {
- if(!areServerElementsSupported()) {
+ if (!areServerElementsSupported()) {
return false;
}
- if(!getServerConfig().createBusinessBlips) {
+ if (!getServerConfig().createBusinessBlips) {
return false;
}
- if(getBusinessData(businessId).entranceBlipModel != -1) {
- let blipModelId = getGameConfig().blipSprites[getServerGame()].Business;
+ if (!isGameFeatureSupported("blips")) {
+ return false;
+ }
- if(getServerData().businesses[businessId].entranceBlipModel != 0) {
- blipModelId = getBusinessData(businessId).entranceBlipModel;
- }
+ let businessData = getBusinessData(businessId);
- logToConsole(LOG_VERBOSE, `[VRR.Job]: Creating entrance blip for business ${getBusinessData(businessId).name} (model ${blipModelId})`);
-
- if(areServerElementsSupported()) {
- getBusinessData(businessId).entranceBlip = createGameBlip(getBusinessData(businessId).entrancePosition, blipModelId, 1, getColourByName("businessBlue"));
- setElementOnAllDimensions(getBusinessData(businessId).entranceBlip, false);
- setElementDimension(getBusinessData(businessId).entranceBlip, getBusinessData(businessId).entranceDimension);
- addToWorld(getBusinessData(businessId).entranceBlip);
- } else {
- sendBusinessToPlayer(null, businessId, getBusinessData(businessId).name, getBusinessData(businessId).entrancePosition, blipModelId, getBusinessData(businessId).entrancePickupModel, getBusinessData(businessId).hasInterior, false);
+ //if(businessData.hasInterior) {
+ // return false;
+ //}
+
+ if (businessData.entranceBlipModel == -1) {
+ return false;
+ }
+
+ let blipModelId = getGameConfig().blipSprites[getGame()].Business;
+
+ if (businessData.entranceBlipModel != 0) {
+ blipModelId = businessData.entranceBlipModel;
+ }
+
+ logToConsole(LOG_VERBOSE, `[VRR.Job]: Creating entrance blip for business ${businessData.name} (model ${blipModelId})`);
+
+ if (areServerElementsSupported()) {
+ let entranceBlip = createGameBlip(businessData.entrancePosition, blipModelId, 1, getColourByType("businessBlue"));
+ if (entranceBlip != null) {
+ if (businessData.entranceDimension != -1) {
+ setElementDimension(entranceBlip, businessData.entranceDimension);
+ setElementOnAllDimensions(entranceBlip, false);
+ } else {
+ setElementOnAllDimensions(entranceBlip, true);
+ }
+
+ if (getGlobalConfig().businessBlipStreamInDistance == -1 || getGlobalConfig().businessBlipStreamOutDistance == -1) {
+ entranceBlip.netFlags.distanceStreaming = false;
+ } else {
+ setElementStreamInDistance(entranceBlip, getGlobalConfig().businessBlipStreamInDistance);
+ setElementStreamOutDistance(entranceBlip, getGlobalConfig().businessBlipStreamOutDistance);
+ }
+ setElementTransient(entranceBlip, false);
+ businessData.entranceBlip = entranceBlip;
}
}
}
// ===========================================================================
+/**
+ * Creates the exit pickup for a business by data index
+ *
+ * @param {Number} businessId - The data index of the business to create the exit pickup for
+ * @return {Boolean} Whether or not the pickup was created
+ *
+ */
function createBusinessExitPickup(businessId) {
- if(!getServerConfig().createBusinessPickups) {
+ if (!areServerElementsSupported()) {
return false;
}
- if(getBusinessData(businessId).hasInterior) {
- if(getBusinessData(businessId).exitPickupModel != -1) {
- let pickupModelId = getGameConfig().pickupModels[getServerGame()].Exit;
+ if (!getServerConfig().createBusinessPickups) {
+ return false;
+ }
- if(getServerData().businesses[businessId].exitPickupModel != 0) {
- pickupModelId = getBusinessData(businessId).exitPickupModel;
- }
+ if (!isGameFeatureSupported("pickups")) {
+ return false;
+ }
- logToConsole(LOG_VERBOSE, `[VRR.Job]: Creating exit pickup for business ${getBusinessData(businessId).name} (model ${pickupModelId})`);
-
- if(areServerElementsSupported()) {
- getBusinessData(businessId).exitPickup = createGamePickup(pickupModelId, getBusinessData(businessId).exitPosition, getGameConfig().pickupTypes[getServerGame()].business);
- setElementDimension(getBusinessData(businessId).exitPickup, getBusinessData(businessId).exitDimension);
- setElementOnAllDimensions(getBusinessData(businessId).exitPickup, false);
- updateBusinessPickupLabelData(businessId);
- addToWorld(getBusinessData(businessId).exitPickup);
- }
+ let businessData = getBusinessData(businessId);
+
+ //if(!businessData.hasInterior) {
+ // return false;
+ //}
+
+ if (businessData.exitPickupModel == -1) {
+ return false;
+ }
+
+ let pickupModelId = getGameConfig().pickupModels[getGame()].Exit;
+
+ if (businessData.exitPickupModel != 0) {
+ pickupModelId = businessData.exitPickupModel;
+ }
+
+ logToConsole(LOG_VERBOSE, `[VRR.Job]: Creating exit pickup for business ${businessData.name} (model ${pickupModelId})`);
+
+ let exitPickup = createGamePickup(pickupModelId, businessData.exitPosition, getGameConfig().pickupTypes[getGame()].business);
+ if (exitPickup != null) {
+ if (businessData.exitDimension != -1) {
+ setElementDimension(exitPickup, businessData.exitDimension);
+ setElementOnAllDimensions(exitPickup, false);
+ } else {
+ setElementOnAllDimensions(exitPickup, true);
}
+
+ if (getGlobalConfig().businessPickupStreamInDistance == -1 || getGlobalConfig().businessPickupStreamOutDistance == -1) {
+ exitPickup.netFlags.distanceStreaming = false;
+ } else {
+ setElementStreamInDistance(exitPickup, getGlobalConfig().businessPickupStreamInDistance);
+ setElementStreamOutDistance(exitPickup, getGlobalConfig().businessPickupStreamOutDistance);
+ }
+ setElementTransient(exitPickup, false);
+ getBusinessData(businessId).exitPickup = exitPickup;
+ updateBusinessPickupLabelData(businessId);
}
}
// ===========================================================================
+/**
+ * Creates the exit blip for a business by data index
+ *
+ * @param {Number} businessId - The data index of the business to create the exit blip for
+ * @return {Boolean} Whether or not the blip was created
+ *
+ */
function createBusinessExitBlip(businessId) {
- if(!getServerConfig().createBusinessBlips) {
+ if (!areServerElementsSupported()) {
return false;
}
- if(getBusinessData(businessId).hasInterior) {
- if(getBusinessData(businessId).exitBlipModel != -1) {
- let blipModelId = getGameConfig().blipSprites[getServerGame()].Business;
+ if (!getServerConfig().createBusinessBlips) {
+ return false;
+ }
- if(getServerData().businesses[businessId].exitBlipModel != 0) {
- blipModelId = getBusinessData(businessId).exitBlipModel;
- }
+ if (!isGameFeatureSupported("blips")) {
+ return false;
+ }
- if(areServerElementsSupported()) {
- logToConsole(LOG_VERBOSE, `[VRR.Job]: Creating exit blip for business ${getBusinessData(businessId).name} (model ${blipModelId})`);
+ let businessData = getBusinessData(businessId);
- getBusinessData(businessId).exitBlip = createGameBlip(getBusinessData(businessId).exitPosition, blipModelId, 1, getColourByName("businessBlue"));
- setElementDimension(getBusinessData(businessId).exitBlip, getBusinessData(businessId).entranceDimension);
- setElementOnAllDimensions(getBusinessData(businessId).exitBlip, false);
- //getBusinessData(businessId).exitBlip.interior = getBusinessData(businessId).exitInterior;
- //setEntityData(getBusinessData(businessId).exitBlip, "vrr.owner.type", VRR_BLIP_BUSINESS_EXIT, false);
- //setEntityData(getBusinessData(businessId).exitBlip, "vrr.owner.id", businessId, false);
- addToWorld(getBusinessData(businessId).exitBlip);
- }
+ //if(!businessData.hasInterior) {
+ // return false;
+ //}
+
+ if (businessData.exitBlipModel == -1) {
+ return false;
+ }
+
+ let blipModelId = getGameConfig().blipSprites[getGame()].Business;
+
+ if (businessData.exitBlipModel != 0) {
+ blipModelId = businessData.exitBlipModel;
+ }
+
+ logToConsole(LOG_VERBOSE, `[VRR.Job]: Creating exit blip for business ${businessData.name} (model ${blipModelId})`);
+
+ let exitBlip = createGameBlip(businessData.exitPosition, blipModelId, 1, getColourByName("businessBlue"));
+ if (exitBlip != null) {
+ if (businessData.exitDimension != -1) {
+ setElementDimension(exitBlip, businessData.exitDimension);
+ setElementOnAllDimensions(exitBlip, false);
+ } else {
+ setElementOnAllDimensions(exitBlip, true);
}
+
+ if (getGlobalConfig().businessBlipStreamInDistance == -1 || getGlobalConfig().businessBlipStreamOutDistance == -1) {
+ exitBlip.netFlags.distanceStreaming = false;
+ } else {
+ setElementStreamInDistance(exitBlip, getGlobalConfig().businessBlipStreamInDistance);
+ setElementStreamOutDistance(exitBlip, getGlobalConfig().businessBlipStreamOutDistance);
+ }
+ setElementTransient(exitBlip, false);
+ businessData.exitBlip = exitBlip;
}
}
// ===========================================================================
-function deleteBusiness(businessId, deletedBy = 0) {
+/**
+ * Deletes a business data and removes it from the database by data index
+ *
+ * @param {Number} businessId - The data index of the business to delete
+ * @return {Boolean} Whether or not the business was deleted
+ *
+ */
+function deleteBusiness(businessId, whoDeleted = 0) {
let tempBusinessData = getServerData().businesses[businessId];
let dbConnection = connectToDatabase();
let dbQuery = null;
- if(dbConnection) {
- dbQuery = queryDatabase(dbConnection, `DELETE FROM biz_main WHERE biz_id = ${tempBusinessData.databaseId}`);
- if(dbQuery) {
+ deleteBusinessBlips(businessId);
+ deleteBusinessPickups(businessId);
+
+ if (dbConnection) {
+ dbQuery = queryDatabase(dbConnection, `UPDATE biz_main WHERE biz_deleted = 1, biz_when_deleted = UNIX_TIMESTAMP(), biz_who_deleted = ${whoDeleted} WHERE biz_id ${tempBusinessData.databaseId}`);
+ if (dbQuery) {
freeDatabaseQuery(dbQuery);
}
disconnectFromDatabase(dbConnection);
}
- deleteBusinessBlips(businessId);
- deleteBusinessPickups(businessId);
-
removePlayersFromBusiness(businessId);
getServerData().businesses.splice(businessId, 1);
+
+ return true;
}
// ===========================================================================
+/**
+ * Forces all players to exit a business
+ *
+ * @param {Number} businessId - The data index of the business to force all players inside to exit from
+ * @return {Boolean} Whether or not the players were forced to exit
+ *
+ */
function removePlayersFromBusiness(businessId) {
- getClients().forEach(function(client) {
- if(doesBusinessHaveInterior(businessId)) {
- if(isPlayerInAnyBusiness(client)) {
- if(getPlayerBusiness(client) == businessId) {
- exitBusiness(client);
- }
+ getClients().forEach(function (client) {
+ if (doesBusinessHaveInterior(businessId)) {
+ if (getPlayerBusiness(client) == businessId) {
+ exitBusiness(client);
}
}
});
+
+ return true;
}
// ===========================================================================
-function removePlayerFromBusinesses(client) {
- if(isPlayerInAnyBusiness(client)) {
- exitBusiness(client);
- }
+/**
+ * Forces a player to exit a business
+ *
+ * @param {Client} client - The client to force to exit the business
+ * @return {Boolean} Whether or not the player was forced to exit
+ *
+ */
+function removePlayerFromBusiness(client) {
+ exitBusiness(client);
+ return false;
}
// ===========================================================================
+/**
+ * Handles a player exiting a business
+ *
+ * @param {Client} client - The client to force to exit the business
+ * @return {Boolean} Whether or not the player successfully exited the business
+ *
+ */
function exitBusiness(client) {
let businessId = getPlayerBusiness(client);
- if(isPlayerSpawned(client)) {
+
+ if (businessId == false) {
+ return false;
+ }
+
+ if (isPlayerSpawned(client)) {
setPlayerInterior(client, getServerData().businesses[businessId].entranceInterior);
setPlayerDimension(client, getServerData().businesses[businessId].entranceDimension);
setPlayerPosition(client, getServerData().businesses[businessId].entrancePosition);
+ return true;
}
+
+ return false;
}
// ===========================================================================
+/**
+ * Gets the name of the type of a business owner by type ID
+ *
+ * @param {Number} ownerType - The business owner type ID
+ * @return {String} Name of the business owner type
+ *
+ */
function getBusinessOwnerTypeText(ownerType) {
- switch(ownerType) {
+ switch (ownerType) {
case VRR_BIZOWNER_CLAN:
return "clan";
@@ -1699,7 +2324,7 @@ function getBusinessOwnerTypeText(ownerType) {
* @return {BusinessData} The business's data (class instance)
*/
function getBusinessData(businessId) {
- if(typeof getServerData().businesses[businessId] != null) {
+ if (typeof getServerData().businesses[businessId] != null) {
return getServerData().businesses[businessId];
}
return false;
@@ -1707,32 +2332,59 @@ function getBusinessData(businessId) {
// ===========================================================================
+/**
+ *
+ * @param {Number} businessId - The data index of the business
+ * @returns {Boolean} Whether or not the business has an interior
+ */
function doesBusinessHaveInterior(businessId) {
return getBusinessData(businessId).hasInterior;
}
// ===========================================================================
+/**
+ *
+ * @param {Number} businessId - The data index of the business
+ * @returns {Boolean} Whether or not the entrance pickup of the business was deleted
+ */
function deleteBusinessEntrancePickup(businessId) {
- if(!areServerElementsSupported()) {
+ if (!areServerElementsSupported()) {
return false;
}
- if(getBusinessData(businessId).entrancePickup != null) {
+ if (!isGameFeatureSupported("pickups")) {
+ return false;
+ }
+
+ if (getBusinessData(businessId).entrancePickup != null) {
//removeFromWorld(getBusinessData(businessId).entrancePickup);
deleteGameElement(getBusinessData(businessId).entrancePickup);
getBusinessData(businessId).entrancePickup = null;
+
+ return true;
}
+
+ return false;
}
// ===========================================================================
+/**
+ *
+ * @param {Number} businessId - The data index of the business
+ * @returns {Boolean} Whether or not the exit pickup of the business was deleted
+ */
function deleteBusinessExitPickup(businessId) {
- if(!areServerElementsSupported()) {
+ if (!areServerElementsSupported()) {
return false;
}
- if(getBusinessData(businessId).exitPickup != null) {
+ if (!isGameFeatureSupported("pickups")) {
+ return false;
+ }
+
+ if (getBusinessData(businessId).exitPickup != null) {
//removeFromWorld(getBusinessData(businessId).exitPickup);
deleteGameElement(getBusinessData(businessId).exitPickup);
getBusinessData(businessId).exitPickup = null;
@@ -1741,12 +2393,21 @@ function deleteBusinessExitPickup(businessId) {
// ===========================================================================
+/**
+ *
+ * @param {Number} businessId - The data index of the business
+ * @returns {Boolean} Whether or not the entrance blip of the business was deleted
+ */
function deleteBusinessEntranceBlip(businessId) {
- if(!areServerElementsSupported()) {
+ if (!areServerElementsSupported()) {
return false;
}
- if(getBusinessData(businessId).entranceBlip != null) {
+ if (!isGameFeatureSupported("blips")) {
+ return false;
+ }
+
+ if (getBusinessData(businessId).entranceBlip != null) {
//removeFromWorld(getBusinessData(businessId).entranceBlip);
deleteGameElement(getBusinessData(businessId).entranceBlip);
getBusinessData(businessId).entranceBlip = null;
@@ -1755,12 +2416,21 @@ function deleteBusinessEntranceBlip(businessId) {
// ===========================================================================
+/**
+ *
+ * @param {Number} businessId - The data index of the business
+ * @returns {Boolean} Whether or not the exit blip of the business was deleted
+ */
function deleteBusinessExitBlip(businessId) {
- if(!areServerElementsSupported()) {
+ if (!areServerElementsSupported()) {
return false;
}
- if(getBusinessData(businessId).exitBlip != null) {
+ if (!isGameFeatureSupported("blip")) {
+ return false;
+ }
+
+ if (getBusinessData(businessId).exitBlip != null) {
//removeFromWorld(getBusinessData(businessId).exitBlip);
deleteGameElement(getBusinessData(businessId).exitBlip);
getBusinessData(businessId).exitBlip = null;
@@ -1769,15 +2439,22 @@ function deleteBusinessExitBlip(businessId) {
// ===========================================================================
+/**
+ * This is a command handler function.
+ *
+ * @param {string} command - The command name used by the player
+ * @param {string} params - The parameters/args string used with the command by the player
+ * @param {Client} client - The client/player that used the command
+ * @return {bool} Whether or not the command was successful
+ *
+ */
function reloadAllBusinessesCommand(command, params, client) {
let clients = getClients();
- for(let i in clients) {
- if(isPlayerInAnyBusiness(clients[i])) {
- removePlayerFromBusinesses(clients[i]);
- }
+ for (let i in clients) {
+ removePlayerFromBusiness(clients[i]);
}
- for(let i in getServerData().businesses) {
+ for (let i in getServerData().businesses) {
deleteBusinessExitBlip(i);
deleteBusinessEntranceBlip(i);
deleteBusinessExitPickup(i);
@@ -1789,32 +2466,28 @@ function reloadAllBusinessesCommand(command, params, client) {
getServerData().businesses = loadBusinessesFromDatabase();
createAllBusinessPickups();
createAllBusinessBlips();
- setAllBusinessIndexes();
+ setBusinessDataIndexes();
cacheAllBusinessItems();
- messageAdminAction(`All businesses have been reloaded by an admin!`);
+ announceAdminAction(`AllBusinessesReloaded`);
}
// ===========================================================================
-function setAllBusinessIndexes() {
- for(let i in getServerData().businesses) {
+/**
+ * Sets the indexes of all businesses
+ *
+ * @returns {Boolean} Whether or not the exit blip of the business was deleted
+ */
+function setBusinessDataIndexes() {
+ for (let i in getServerData().businesses) {
getServerData().businesses[i].index = i;
-
- //for(let j in getServerData().businesses[i].locations) {
- // getServerData().businesses[i].locations[j].index = j;
- // getServerData().businesses[i].locations[j].businessIndex = i;
- //}
-
- //for(let j in getServerData().businesses[i].gameScripts) {
- // getServerData().businesses[i].gameScripts[j].index = j;
- // getServerData().businesses[i].gameScripts[j].businessIndex = i;
- //}
}
}
// ===========================================================================
+// Adds an item to a business inventory by item type, amount and buy price
function addToBusinessInventory(businessId, itemType, amount, buyPrice) {
let tempItemData = new ItemData(false);
tempItemData.amount = amount;
@@ -1827,34 +2500,43 @@ function addToBusinessInventory(businessId, itemType, amount, buyPrice) {
saveItemToDatabase(tempItemData);
getServerData().items.push(tempItemData);
- let index = getServerData().items.length-1;
+ let index = getServerData().items.length - 1;
getServerData().items[index].index = index;
}
// ===========================================================================
+/**
+ * This is a command handler function.
+ *
+ * @param {string} command - The command name used by the player
+ * @param {string} params - The parameters/args string used with the command by the player
+ * @param {Client} client - The client/player that used the command
+ * @return {bool} Whether or not the command was successful
+ *
+ */
function buyFromBusinessCommand(command, params, client) {
let businessId = getPlayerBusiness(client);
- if(areParamsEmpty(params)) {
+ if (areParamsEmpty(params)) {
showBusinessFloorInventoryToPlayer(client, businessId);
messagePlayerSyntax(client, getCommandSyntaxText(command));
return false;
}
- if(!getBusinessData(businessId)) {
+ if (!getBusinessData(businessId)) {
messagePlayerError(client, getLocaleString(client, "InvalidBusiness"));
return false;
}
- if(getBusinessData(businessId).locked) {
+ if (getBusinessData(businessId).locked) {
messagePlayerError(client, `This business is closed!`);
return false;
}
- if(getBusinessData(businessId).hasInterior) {
- if(!getPlayerBusiness(client)) {
- if(!doesPlayerHaveKeyBindsDisabled(client) && doesPlayerHaveKeyBindForCommand(client, "enter")) {
+ if (getBusinessData(businessId).hasInterior) {
+ if (!getPlayerBusiness(client)) {
+ if (!doesPlayerHaveKeyBindsDisabled(client) && doesPlayerHaveKeyBindForCommand(client, "enter")) {
messagePlayerTip(client, getLocaleString(client, "NeedToEnterPropertyKeyPress", "business", `{ALTCOLOUR}${toUpperCase(getKeyNameFromId(getPlayerKeyBindForCommand(client, "enter")).key)}{MAINCOLOUR}`));
} else {
messagePlayerNormal(client, getLocaleString(client, "NeedToEnterBusinessCommand", "business", "{ALTCOLOUR}/enter{MAINCOLOUR}"));
@@ -1865,57 +2547,57 @@ function buyFromBusinessCommand(command, params, client) {
let itemSlot = toInteger(getParam(params, " ", 1)) || 1;
- if(typeof getBusinessData(businessId).floorItemCache[itemSlot-1] == "undefined") {
+ if (typeof getBusinessData(businessId).floorItemCache[itemSlot - 1] == "undefined") {
messagePlayerError(client, `Item slot ${itemSlot} doesn't exist!`);
return false;
}
- if(getBusinessData(businessId).floorItemCache[itemSlot-1] == -1) {
+ if (getBusinessData(businessId).floorItemCache[itemSlot - 1] == -1) {
messagePlayerError(client, `Item slot ${itemSlot} slot is empty!`);
return false;
}
let amount = 1;
- if(areThereEnoughParams(params, 2, " ")) {
+ if (areThereEnoughParams(params, 2, " ")) {
amount = toInteger(getParam(params, " ", 2)) || 1;
- if(amount <= 0) {
+ if (amount <= 0) {
messagePlayerError(client, getLocaleString(client, "AmountMustBeMoreThan", "0"));
return false;
}
}
- if(getItemData(getBusinessData(businessId).floorItemCache[itemSlot-1]).amount < amount) {
- messagePlayerError(client, `There are only ${getItemData(getBusinessData(businessId).floorItemCache[itemSlot-1]).amount} ${getItemTypeData(getItemData(getBusinessData(businessId).floorItemCache[itemSlot-1]).itemTypeIndex).name} in slot ${itemSlot-1}`);
+ if (getItemData(getBusinessData(businessId).floorItemCache[itemSlot - 1]).amount < amount) {
+ messagePlayerError(client, `There are only ${getItemData(getBusinessData(businessId).floorItemCache[itemSlot - 1]).amount} ${getItemTypeData(getItemData(getBusinessData(businessId).floorItemCache[itemSlot - 1]).itemTypeIndex).name} in slot ${itemSlot - 1}`);
return false;
}
let firstSlot = getPlayerFirstEmptyHotBarSlot(client);
- if(firstSlot == -1) {
+ if (firstSlot == -1) {
messagePlayerError(client, messagePlayerError(client, getLocaleString(client, "InventoryFullCantCarry")));
return false;
}
- let totalCost = getItemData(getBusinessData(businessId).floorItemCache[itemSlot-1]).buyPrice*amount;
- let itemName = getItemTypeData(getItemData(getBusinessData(businessId).floorItemCache[itemSlot-1]).itemTypeIndex).name;
+ let totalCost = getItemData(getBusinessData(businessId).floorItemCache[itemSlot - 1]).buyPrice * amount;
+ let itemName = getItemTypeData(getItemData(getBusinessData(businessId).floorItemCache[itemSlot - 1]).itemTypeIndex).name;
- if(getPlayerCurrentSubAccount(client).cash < totalCost) {
- messagePlayerError(client, getLocaleString(client, "NotEnoughCashNeedAmountMore", `{ALTCOLOUR}${getBusinessData(businessId).floorItemCache[itemSlot-1].buyPrice*amount-getPlayerCurrentSubAccount(client).cash}{MAINCOLOUR}`));
+ if (getPlayerCurrentSubAccount(client).cash < totalCost) {
+ messagePlayerError(client, getLocaleString(client, "NotEnoughCashNeedAmountMore", `{ALTCOLOUR}${getBusinessData(businessId).floorItemCache[itemSlot - 1].buyPrice * amount - getPlayerCurrentSubAccount(client).cash}{MAINCOLOUR}`));
return false;
}
takePlayerCash(client, totalCost);
- createItem(getItemData(getBusinessData(businessId).floorItemCache[itemSlot-1]).itemTypeIndex, getItemData(getBusinessData(businessId).floorItemCache[itemSlot-1]).value, VRR_ITEM_OWNER_PLAYER, getPlayerCurrentSubAccount(client).databaseId, amount);
+ createItem(getItemData(getBusinessData(businessId).floorItemCache[itemSlot - 1]).itemTypeIndex, getItemData(getBusinessData(businessId).floorItemCache[itemSlot - 1]).value, VRR_ITEM_OWNER_PLAYER, getPlayerCurrentSubAccount(client).databaseId, amount);
cachePlayerHotBarItems(client);
getBusinessData(businessId).till = getBusinessData(businessId).till + totalCost;
- getItemData(getBusinessData(businessId).floorItemCache[itemSlot-1]).amount = getItemData(getBusinessData(businessId).floorItemCache[itemSlot-1]).amount - amount;
- if(getItemData(getBusinessData(businessId).floorItemCache[itemSlot-1]).amount == 0) {
- destroyItem(getBusinessData(businessId).floorItemCache[itemSlot-1]);
+ getItemData(getBusinessData(businessId).floorItemCache[itemSlot - 1]).amount = getItemData(getBusinessData(businessId).floorItemCache[itemSlot - 1]).amount - amount;
+ if (getItemData(getBusinessData(businessId).floorItemCache[itemSlot - 1]).amount == 0) {
+ destroyItem(getBusinessData(businessId).floorItemCache[itemSlot - 1]);
}
- let useType = getItemTypeData(getItemData(getBusinessData(businessId).floorItemCache[itemSlot-1]).itemTypeIndex).useType;
- if(useType == VRR_ITEM_USETYPE_WEAPON || VRR_ITEM_USETYPE_TAZER || useType == VRR_ITEM_USETYPE_AMMO_CLIP) {
- if(isPlayerWeaponBanned(client) && !isPlayerExemptFromAntiCheat(client)) {
+ let useType = getItemTypeData(getItemData(getBusinessData(businessId).floorItemCache[itemSlot - 1]).itemTypeIndex).useType;
+ if (useType == VRR_ITEM_USETYPE_WEAPON || VRR_ITEM_USETYPE_TAZER || useType == VRR_ITEM_USETYPE_AMMO_CLIP) {
+ if (isPlayerWeaponBanned(client) && !isPlayerExemptFromAntiCheat(client)) {
messagePlayerError(client, getLocaleString(client, "WeaponBanned"));
return false;
}
@@ -1924,147 +2606,165 @@ function buyFromBusinessCommand(command, params, client) {
//messagePlayerSuccess(client, `You bought ${amount} {ALTCOLOUR}${itemName} {MAINCOLOUR}for ${totalCost} ${priceEach}`);
meActionToNearbyPlayers(client, `buys a ${itemName}`);
- if(!doesPlayerHaveKeyBindsDisabled(client) && doesPlayerHaveKeyBindForCommand("inv")) {
+ if (doesPlayerHaveKeyBindsDisabled(client) && doesPlayerHaveKeyBindForCommand("inv")) {
let keyData = getPlayerKeyBindForCommand("inv");
- messagePlayerNewbieTip(client, getLocaleString(client, "ViewInventoryKeyPressTip"), `{ALTCOLOUR}${getKeyNameFromId(keyData.key)}{MAINCOLOUR}`);
+ messagePlayerNewbieTip(client, getLocaleString(client, "ViewInventoryKeyPressTip", `{ALTCOLOUR}${getKeyNameFromId(keyData.key)}{MAINCOLOUR}`));
} else {
- messagePlayerNewbieTip(client, getLocaleString(client, "ViewInventoryKeyPressTip"), `{ALTCOLOUR}/inv{MAINCOLOUR}`);
+ messagePlayerNewbieTip(client, getLocaleString(client, "ViewInventoryCommandTip", `{ALTCOLOUR}/inv{MAINCOLOUR}`));
}
}
// ===========================================================================
+/**
+ * This is a command handler function.
+ *
+ * @param {string} command - The command name used by the player
+ * @param {string} params - The parameters/args string used with the command by the player
+ * @param {Client} client - The client/player that used the command
+ * @return {bool} Whether or not the command was successful
+ *
+ */
function setBusinessItemSellPriceCommand(command, params, client) {
let businessId = getBusinessFromParams(getParam(params, " ", 3)) || getPlayerBusiness(client);
- if(!getBusinessData(businessId)) {
+ if (!getBusinessData(businessId)) {
messagePlayerError(client, getLocaleString(client, "InvalidBusiness"));
return false;
}
let itemSlot = toInteger(getParam(params, " ", 1)) || 0;
- if(typeof getBusinessData(businessId).floorItemCache[itemSlot-1] == "undefined") {
- messagePlayerError(client, `Item slot ${itemSlot-1} doesn't exist!`);
+ if (typeof getBusinessData(businessId).floorItemCache[itemSlot - 1] == "undefined") {
+ messagePlayerError(client, `Item slot ${itemSlot - 1} doesn't exist!`);
return false;
}
- if(getBusinessData(businessId).floorItemCache[itemSlot-1] == -1) {
- messagePlayerError(client, `Item slot ${itemSlot-1} slot is empty!`);
+ if (getBusinessData(businessId).floorItemCache[itemSlot - 1] == -1) {
+ messagePlayerError(client, `Item slot ${itemSlot - 1} slot is empty!`);
return false;
}
- let oldPrice = getBusinessData(businessId).floorItemCache[itemSlot-1].buyPrice;
+ let oldPrice = getBusinessData(businessId).floorItemCache[itemSlot - 1].buyPrice;
let newPrice = toInteger(getParam(params, " ", 2)) || oldPrice;
- if(newPrice < 0) {
+ if (newPrice < 0) {
messagePlayerError(client, "The price can't be negative!");
return false;
}
- getItemData(getBusinessData(businessId).floorItemCache[itemSlot-1]).buyPrice = newPrice;
+ getItemData(getBusinessData(businessId).floorItemCache[itemSlot - 1]).buyPrice = newPrice;
- messagePlayerSuccess(client, `You changed the price of the {ALTCOLOUR}${getItemTypeData(getItemData(getBusinessData(businessId).floorItemCache[itemSlot-1]).itemTypeIndex).name}'s {MAINCOLOUR}in slot {ALTCOLOUR}${itemSlot} {MAINCOLOUR}from $${makeLargeNumberReadable(oldPrice)} to $${makeLargeNumberReadable(newprice)}`);
+ messagePlayerSuccess(client, `You changed the price of the {ALTCOLOUR}${getItemTypeData(getItemData(getBusinessData(businessId).floorItemCache[itemSlot - 1]).itemTypeIndex).name}'s {MAINCOLOUR}in slot {ALTCOLOUR}${itemSlot} {MAINCOLOUR}from $${makeLargeNumberReadable(oldPrice)} to $${makeLargeNumberReadable(newprice)}`);
}
// ===========================================================================
+/**
+ * This is a command handler function.
+ *
+ * @param {string} command - The command name used by the player
+ * @param {string} params - The parameters/args string used with the command by the player
+ * @param {Client} client - The client/player that used the command
+ * @return {bool} Whether or not the command was successful
+ *
+ */
function storeItemInBusinessStorageCommand(command, params, client) {
let businessId = getBusinessFromParams(getParam(params, " ", 3)) || getPlayerBusiness(client);
- if(!getBusinessData(businessId)) {
+ if (!getBusinessData(businessId)) {
messagePlayerError(client, getLocaleString(client, "InvalidBusiness"));
return false;
}
let itemSlot = toInteger(getParam(params, " ", 1)) || 0;
- if(typeof getBusinessData(businessId).floorItemCache[itemSlot-1] == "undefined") {
+ if (typeof getBusinessData(businessId).floorItemCache[itemSlot - 1] == "undefined") {
messagePlayerError(client, `Item slot ${itemSlot} doesn't exist!`);
return false;
}
- if(getBusinessData(businessId).floorItemCache[itemSlot-1] == -1) {
+ if (getBusinessData(businessId).floorItemCache[itemSlot - 1] == -1) {
messagePlayerError(client, `Item slot ${itemSlot} slot is empty!`);
return false;
}
let firstSlot = getBusinessStorageFirstFreeItemSlot(businessId);
- if(firstSlot == -1) {
+ if (firstSlot == -1) {
messagePlayerError(client, `There isn't any room in this business storage`);
return false;
}
- getItemData(getBusinessData(businessId).floorItemCache[itemSlot-1]).ownerType = VRR_ITEM_OWNER_BIZSTORAGE;
- getBusinessData(businessId).storageItemCache[firstSlot] = getBusinessData(businessId).floorItemCache[itemSlot-1];
- getBusinessData(businessId).storageItemCache[itemSlot-1] = -1;
+ getItemData(getBusinessData(businessId).floorItemCache[itemSlot - 1]).ownerType = VRR_ITEM_OWNER_BIZSTORAGE;
+ getBusinessData(businessId).storageItemCache[firstSlot] = getBusinessData(businessId).floorItemCache[itemSlot - 1];
+ getBusinessData(businessId).storageItemCache[itemSlot - 1] = -1;
messagePlayerSuccess(client, `You moved the ${getItemTypeData(getItemData(getBusinessData(businessId).storageItemCache[firstSlot]).itemTypeIndex).name}s in slot ${itemSlot} to the business storage in slot ${firstSlot}`);
}
// ===========================================================================
+/**
+ * This is a command handler function.
+ *
+ * @param {string} command - The command name used by the player
+ * @param {string} params - The parameters/args string used with the command by the player
+ * @param {Client} client - The client/player that used the command
+ * @return {bool} Whether or not the command was successful
+ *
+ */
function stockItemOnBusinessFloorCommand(command, params, client) {
let businessId = getPlayerBusiness(client);
- if(!getBusinessData(businessId)) {
+ if (!getBusinessData(businessId)) {
messagePlayerError(client, getLocaleString(client, "InvalidBusiness"));
return false;
}
let itemSlot = toInteger(getParam(params, " ", 1)) || 0;
- if(typeof getBusinessData(businessId).storageItemCache[itemSlot-1] == "undefined") {
+ if (typeof getBusinessData(businessId).storageItemCache[itemSlot - 1] == "undefined") {
messagePlayerError(client, `Item slot ${itemSlot} doesn't exist!`);
return false;
}
- if(getBusinessData(businessId).storageItemCache[itemSlot-1] == -1) {
+ if (getBusinessData(businessId).storageItemCache[itemSlot - 1] == -1) {
messagePlayerError(client, `Item slot ${itemSlot} slot is empty!`);
return false;
}
let firstSlot = getBusinessFloorFirstFreeItemSlot(businessId);
- if(firstSlot == -1) {
+ if (firstSlot == -1) {
messagePlayerError(client, `There isn't any room in this business storage`);
return false;
}
- getItemData(getBusinessData(businessId).storageItemCache[itemSlot-1]).ownerType = VRR_ITEM_OWNER_BIZFLOOR;
- getBusinessData(businessId).floorItemCache[firstSlot] = getBusinessData(businessId).storageItemCache[itemSlot-1];
- getBusinessData(businessId).storageItemCache[itemSlot-1] = -1;
+ getItemData(getBusinessData(businessId).storageItemCache[itemSlot - 1]).ownerType = VRR_ITEM_OWNER_BIZFLOOR;
+ getBusinessData(businessId).floorItemCache[firstSlot] = getBusinessData(businessId).storageItemCache[itemSlot - 1];
+ getBusinessData(businessId).storageItemCache[itemSlot - 1] = -1;
messagePlayerSuccess(client, `You moved the ${getItemTypeData(getItemData(getBusinessData(businessId).storageItemCache[firstSlot]).itemTypeIndex).name}s in slot ${itemSlot} of the business storage to the business floor slot ${firstSlot}`);
}
// ===========================================================================
+// Gets the first free slot in a business's storage items
function getBusinessStorageFirstFreeItemSlot(businessId) {
- for(let i in getBusinessData(businessId).storageItemCache) {
- if(getBusinessData(businessId).storageItemCache[i] == -1) {
- return i;
- }
- }
-
- return -1;
+ return getBusinessData(businessId).storageItemCache.findIndex(item => item == -1);
}
// ===========================================================================
+// Gets the first free slot in a business's floor items
function getBusinessFloorFirstFreeItemSlot(businessId) {
- for(let i in getBusinessData(businessId).floorItemCache) {
- if(getBusinessData(businessId).floorItemCache[i] == -1) {
- return i;
- }
- }
-
- return -1;
+ return getBusinessData(businessId).floorItemCache.findIndex(item => item == -1);
}
// ===========================================================================
+// Caches all items for all businesses
function cacheAllBusinessItems() {
logToConsole(LOG_DEBUG, "[VRR.Business] Caching all business items ...");
- for(let i in getServerData().businesses) {
+ for (let i in getServerData().businesses) {
cacheBusinessItems(i);
}
logToConsole(LOG_DEBUG, "[VRR.Business] Cached all business items successfully!");
@@ -2072,88 +2772,88 @@ function cacheAllBusinessItems() {
// ===========================================================================
+// Caches all items for a business by businessId
function cacheBusinessItems(businessId) {
- getBusinessData(businessId).floorItemCache.splice(0, getBusinessData(businessId).floorItemCache.length);
- getBusinessData(businessId).storageItemCache.splice(0, getBusinessData(businessId).storageItemCache.length);
+ clearArray(getBusinessData(businessId).floorItemCache);
+ clearArray(getBusinessData(businessId).storageItemCache);
+
+ //let businessData = getBusinessData(businessId);
+ //logToConsole(LOG_VERBOSE, `[VRR.Business] Caching business items for business ${businessId} (${businessData.name}) ...`);
+ //getBusinessData(businessId).floorItemCache = getServerData().items.filter(item => item.ownerType == VRR_ITEM_OWNER_BIZFLOOR && item.ownerId == businessData.databaseId).map(i => i.index);
+ //getBusinessData(businessId).storageItemCache = getServerData().items.filter(item => item.ownerType == VRR_ITEM_OWNER_BIZSTORAGE && item.ownerId == businessData.databaseId);
logToConsole(LOG_VERBOSE, `[VRR.Business] Caching business items for business ${businessId} (${getBusinessData(businessId).name}) ...`);
- for(let i in getServerData().items) {
- if(getItemData(i).ownerType == VRR_ITEM_OWNER_BIZFLOOR && getItemData(i).ownerId == getBusinessData(businessId).databaseId) {
+ for (let i in getServerData().items) {
+ if (getItemData(i).ownerType == VRR_ITEM_OWNER_BIZFLOOR && getItemData(i).ownerId == getBusinessData(businessId).databaseId) {
getBusinessData(businessId).floorItemCache.push(i);
- } else if(getItemData(i).ownerType == VRR_ITEM_OWNER_BIZSTORAGE && getItemData(i).ownerId == getBusinessData(businessId).databaseId) {
+ } else if (getItemData(i).ownerType == VRR_ITEM_OWNER_BIZSTORAGE && getItemData(i).ownerId == getBusinessData(businessId).databaseId) {
getBusinessData(businessId).storageItemCache.push(i);
}
}
+
logToConsole(LOG_VERBOSE, `[VRR.Business] Successfully cached ${getBusinessData(businessId).floorItemCache.length} floor items and ${getBusinessData(businessId).storageItemCache} storage items for business ${businessId} (${getBusinessData(businessId).name})!`);
}
// ===========================================================================
+// Gets a business's data index from a business's databaseId
function getBusinessIdFromDatabaseId(databaseId) {
- for(let i in getServerData().businesses) {
- if(getBusinessData(i).databaseId == databaseId) {
- return i;
- }
- }
-
- return false;
+ return getServerData().businesses.findIndex(business => business.databaseId == databaseId);
}
// ===========================================================================
+// Updates all pickup data for a business by businessId
function updateBusinessPickupLabelData(businessId) {
- if(!areServerElementsSupported()) {
+ if (!areServerElementsSupported()) {
return false;
}
- if(getBusinessData(businessId).exitPickup != null) {
+ if (getBusinessData(businessId).exitPickup != null) {
setEntityData(getBusinessData(businessId).exitPickup, "vrr.owner.type", VRR_PICKUP_BUSINESS_EXIT, false);
setEntityData(getBusinessData(businessId).exitPickup, "vrr.owner.id", businessId, false);
setEntityData(getBusinessData(businessId).exitPickup, "vrr.label.type", VRR_LABEL_EXIT, true);
}
- if(getBusinessData(businessId).entrancePickup != null) {
+ if (getBusinessData(businessId).entrancePickup != null) {
setEntityData(getBusinessData(businessId).entrancePickup, "vrr.owner.type", VRR_PICKUP_BUSINESS_ENTRANCE, false);
setEntityData(getBusinessData(businessId).entrancePickup, "vrr.owner.id", businessId, false);
setEntityData(getBusinessData(businessId).entrancePickup, "vrr.label.type", VRR_LABEL_BUSINESS, true);
setEntityData(getBusinessData(businessId).entrancePickup, "vrr.label.name", getBusinessData(businessId).name, true);
setEntityData(getBusinessData(businessId).entrancePickup, "vrr.label.locked", getBusinessData(businessId).locked, true);
setEntityData(getBusinessData(businessId).entrancePickup, "vrr.label.help", VRR_PROPLABEL_INFO_NONE, true);
- if(getBusinessData(businessId).labelHelpType == VRR_PROPLABEL_INFO_ENTERVEHICLE) {
- setEntityData(getBusinessData(businessId).entrancePickup, "vrr.label.help", VRR_PROPLABEL_INFO_ENTERVEHICLE, true);
- } else if(getBusinessData(businessId).labelHelpType == VRR_PROPLABEL_INFO_ENTER) {
- setEntityData(getBusinessData(businessId).entrancePickup, "vrr.label.help", VRR_PROPLABEL_INFO_ENTER, true);
- } else if(getBusinessData(businessId).labelHelpType == VRR_PROPLABEL_INFO_REPAIR) {
- setEntityData(getBusinessData(businessId).entrancePickup, "vrr.label.help", VRR_PROPLABEL_INFO_REPAIR, true);
- } else {
- if(getBusinessData(businessId).buyPrice > 0) {
- setEntityData(getBusinessData(businessId).entrancePickup, "vrr.label.price", getBusinessData(businessId).buyPrice, true);
- setEntityData(getBusinessData(businessId).entrancePickup, "vrr.label.help", VRR_PROPLABEL_INFO_BUYBIZ, true);
- } else {
- if(getBusinessData(businessId).hasInterior) {
+
+ switch (getBusinessData(businessId).labelHelpType) {
+ case VRR_PROPLABEL_INFO_ENTERVEHICLE: {
+ setEntityData(getBusinessData(businessId).entrancePickup, "vrr.label.help", VRR_PROPLABEL_INFO_ENTERVEHICLE, true);
+ break;
+ }
+
+ case VRR_PROPLABEL_INFO_ENTER: {
+ setEntityData(getBusinessData(businessId).entrancePickup, "vrr.label.help", VRR_PROPLABEL_INFO_ENTER, true);
+ break;
+ }
+
+ case VRR_PROPLABEL_INFO_REPAIR: {
+ setEntityData(getBusinessData(businessId).entrancePickup, "vrr.label.help", VRR_PROPLABEL_INFO_REPAIR, true);
+ break;
+ }
+
+ default: {
+ if (getBusinessData(businessId).hasInterior) {
setEntityData(getBusinessData(businessId).entrancePickup, "vrr.label.help", VRR_PROPLABEL_INFO_ENTER, true);
} else {
- if(doesBusinessHaveAnyItemsToBuy(businessId)) {
+ if (doesBusinessHaveAnyItemsToBuy(businessId)) {
setEntityData(getBusinessData(businessId).entrancePickup, "vrr.label.help", VRR_PROPLABEL_INFO_BUY, true);
+ } else {
+ removeEntityData(getBusinessData(businessId).entrancePickup, "vrr.label.help");
}
}
+ break;
}
}
- if(getBusinessData(businessId).buyPrice > 0) {
- setEntityData(getBusinessData(businessId).entrancePickup, "vrr.label.price", getBusinessData(businessId).buyPrice, true);
- }
- }
-}
-
-// ===========================================================================
-
-function getBusinessIdFromDatabaseId(databaseId) {
- let businesses = getServerData().businesses;
- for(let i in businesses) {
- if(businesses[i].databaseId == databaseId) {
- return i;
- }
+ setEntityData(getBusinessData(businessId).entrancePickup, "vrr.label.price", getBusinessData(businessId).buyPrice, true);
}
}
@@ -2184,7 +2884,7 @@ function resetAllBusinessPickups(businessId) {
// ===========================================================================
function resetAllBusinessBlips() {
- for(let i in getServerData().businesses) {
+ for (let i in getServerData().businesses) {
deleteBusinessBlips(i);
createBusinessBlips(i);
}
@@ -2200,7 +2900,7 @@ function createBusinessBlips(businessId) {
// ===========================================================================
function resetAllBusinessPickups() {
- for(let i in getServerData().businesses) {
+ for (let i in getServerData().businesses) {
deleteBusinessPickups(i);
createBusinessPickups(i);
}
@@ -2239,8 +2939,8 @@ function doesBusinessHaveAnyItemsToBuy(businessId) {
function updateBusinessInteriorLightsForOccupants(businessId) {
let clients = getClients()
- for(let i in clients) {
- if(getPlayerBusiness(clients[i]) == businessId) {
+ for (let i in clients) {
+ if (getPlayerBusiness(clients[i]) == businessId) {
updateInteriorLightsForPlayer(clients[i], getBusinessData(businessId).interiorLights);
}
}
@@ -2249,16 +2949,16 @@ function updateBusinessInteriorLightsForOccupants(businessId) {
// ===========================================================================
function canPlayerWithdrawFromBusinessTill(client, businessId) {
- if(doesPlayerHaveStaffPermission(client, getStaffFlagValue("ManageBusinesses"))) {
+ if (doesPlayerHaveStaffPermission(client, getStaffFlagValue("ManageBusinesses"))) {
return true;
}
- if(getBusinessData(businessId).ownerType == VRR_BIZOWNER_PLAYER && getBusinessData(businessId).ownerId == getPlayerCurrentSubAccount(client).databaseId) {
+ if (getBusinessData(businessId).ownerType == VRR_BIZOWNER_PLAYER && getBusinessData(businessId).ownerId == getPlayerCurrentSubAccount(client).databaseId) {
return true;
}
- if(getBusinessData(businessId).ownerType == VRR_BIZOWNER_CLAN && getBusinessData(businessId).ownerId == getClanData(getPlayerClan(client)).databaseId) {
- if(doesPlayerHaveClanPermission(client, getClanFlagValue("ManageBusinesses"))) {
+ if (getBusinessData(businessId).ownerType == VRR_BIZOWNER_CLAN && getBusinessData(businessId).ownerId == getClanData(getPlayerClan(client)).databaseId) {
+ if (doesPlayerHaveClanPermission(client, getClanFlagValue("ManageBusinesses"))) {
return true;
}
}
@@ -2269,16 +2969,16 @@ function canPlayerWithdrawFromBusinessTill(client, businessId) {
// ===========================================================================
function canPlayerSetBusinessInteriorLights(client, businessId) {
- if(doesPlayerHaveStaffPermission(client, getStaffFlagValue("ManageBusinesses"))) {
+ if (doesPlayerHaveStaffPermission(client, getStaffFlagValue("ManageBusinesses"))) {
return true;
}
- if(getBusinessData(businessId).ownerType == VRR_BIZOWNER_PLAYER && getBusinessData(businessId).ownerId == getPlayerCurrentSubAccount(client).databaseId) {
+ if (getBusinessData(businessId).ownerType == VRR_BIZOWNER_PLAYER && getBusinessData(businessId).ownerId == getPlayerCurrentSubAccount(client).databaseId) {
return true;
}
- if(getBusinessData(businessId).ownerType == VRR_BIZOWNER_CLAN && getBusinessData(businessId).ownerId == getClanData(getPlayerClan(client)).databaseId) {
- if(doesPlayerHaveClanPermission(client, getClanFlagValue("ManageBusinesses"))) {
+ if (getBusinessData(businessId).ownerType == VRR_BIZOWNER_CLAN && getBusinessData(businessId).ownerId == getClanData(getPlayerClan(client)).databaseId) {
+ if (doesPlayerHaveClanPermission(client, getClanFlagValue("ManageBusinesses"))) {
return true;
}
}
@@ -2289,16 +2989,16 @@ function canPlayerSetBusinessInteriorLights(client, businessId) {
// ===========================================================================
function canPlayerLockUnlockBusiness(client, businessId) {
- if(doesPlayerHaveStaffPermission(client, getStaffFlagValue("ManageBusinesses"))) {
+ if (doesPlayerHaveStaffPermission(client, getStaffFlagValue("ManageBusinesses"))) {
return true;
}
- if(getBusinessData(businessId).ownerType == VRR_BIZOWNER_PLAYER && getBusinessData(businessId).ownerId == getPlayerCurrentSubAccount(client).databaseId) {
+ if (getBusinessData(businessId).ownerType == VRR_BIZOWNER_PLAYER && getBusinessData(businessId).ownerId == getPlayerCurrentSubAccount(client).databaseId) {
return true;
}
- if(getBusinessData(businessId).ownerType == VRR_BIZOWNER_CLAN && getBusinessData(businessId).ownerId == getClanData(getPlayerClan(client)).databaseId) {
- if(doesPlayerHaveClanPermission(client, getClanFlagValue("ManageBusinesses"))) {
+ if (getBusinessData(businessId).ownerType == VRR_BIZOWNER_CLAN && getBusinessData(businessId).ownerId == getClanData(getPlayerClan(client)).databaseId) {
+ if (doesPlayerHaveClanPermission(client, getClanFlagValue("ManageBusinesses"))) {
return true;
}
}
@@ -2309,19 +3009,19 @@ function canPlayerLockUnlockBusiness(client, businessId) {
// ===========================================================================
function canPlayerManageBusiness(client, businessId) {
- if(doesPlayerHaveStaffPermission(client, getStaffFlagValue("ManageBusinesses"))) {
+ if (doesPlayerHaveStaffPermission(client, getStaffFlagValue("ManageBusinesses"))) {
return true;
}
- if(getBusinessData(businessId).ownerType == VRR_BIZOWNER_PLAYER) {
- if(getBusinessData(businessId).ownerId == getPlayerCurrentSubAccount(client).databaseId) {
+ if (getBusinessData(businessId).ownerType == VRR_BIZOWNER_PLAYER) {
+ if (getBusinessData(businessId).ownerId == getPlayerCurrentSubAccount(client).databaseId) {
return true;
}
}
- if(getBusinessData(businessId).ownerType == VRR_BIZOWNER_CLAN) {
- if(getBusinessData(businessId).ownerId == getPlayerClan(client)) {
- if(doesPlayerHaveClanPermission(client, getClanFlagValue("ManageBusinesses"))) {
+ if (getBusinessData(businessId).ownerType == VRR_BIZOWNER_CLAN) {
+ if (getBusinessData(businessId).ownerId == getPlayerClan(client)) {
+ if (doesPlayerHaveClanPermission(client, getClanFlagValue("ManageBusinesses"))) {
return true;
}
@@ -2351,14 +3051,14 @@ function deleteBusinessPickups(business) {
// ===========================================================================
function getBusinessFromParams(params) {
- if(isNaN(params)) {
- for(let i in getServerData().businesses) {
- if(toLowerCase(getServerData().businesses[i].name).indexOf(toLowerCase(params)) != -1) {
+ if (isNaN(params)) {
+ for (let i in getServerData().businesses) {
+ if (toLowerCase(getServerData().businesses[i].name).indexOf(toLowerCase(params)) != -1) {
return i;
}
}
} else {
- if(typeof getServerData().businesses[params] != "undefined") {
+ if (typeof getServerData().businesses[params] != "undefined") {
return toInteger(params);
}
}
@@ -2368,17 +3068,73 @@ function getBusinessFromParams(params) {
// ===========================================================================
function deleteAllBusinessBlips() {
- for(let i in getServerData().businesses) {
- deleteBusinessBlips(i);
- }
+ for (let i in getServerData().businesses) {
+ deleteBusinessBlips(i);
+ }
}
// ===========================================================================
function deleteAllBusinessPickups() {
- for(let i in getServerData().businesses) {
- deleteBusinessPickups(i);
- }
+ for (let i in getServerData().businesses) {
+ deleteBusinessPickups(i);
+ }
+}
+
+// ===========================================================================
+
+function getBusinessFromInteriorAndDimension(dimension, interior) {
+ let businesses = getServerData().businesses;
+ for (let i in businesses) {
+ if (businesses[i].exitInterior == interior && businesses[i].exitDimension == dimension) {
+ return i;
+ }
+ }
+
+ return -1;
+}
+
+// ===========================================================================
+
+function getClosestBusinessWithBuyableItemOfUseType(position, useType) {
+ let availableBusinesses = getBusinessesWithBuyableItemOfUseType(useType);
+
+ let closestBusiness = 0;
+ for (let i in availableBusinesses) {
+ if (getDistance(position, getBusinessData(availableBusinesses[i]).entrancePosition) < getDistance(position, getBusinessData(availableBusinesses[closestBusiness]).entrancePosition)) {
+ closestBusiness = i;
+ }
+ }
+ return availableBusinesses[closestBusiness];
+}
+
+// ===========================================================================
+
+function getBusinessesWithBuyableItemOfUseType(useType) {
+ let businesses = getServerData().businesses;
+ for (let i in businesses) {
+ if (doesBusinessHaveBuyableItemOfUseType(i, useType)) {
+ availableBusinesses.push(i);
+ }
+ }
+
+ return availableBusinesses;
+}
+
+// ===========================================================================
+
+function doesBusinessHaveBuyableItemOfUseType(businessId, useType) {
+ let floorItems = getBusinessData(businessId).floorItemCache;
+ for (let i in floorItems) {
+ if (floorItems[i] != -1) {
+ if (getItemData(floorItems[i]) != false) {
+ if (getItemTypeData(getItemData(floorItems[i])).useType == useType) {
+ return true;
+ }
+ }
+ }
+ }
+ return false;
}
// ===========================================================================
\ No newline at end of file
diff --git a/scripts/server/chat.js b/scripts/server/chat.js
index 29678550..06a3f921 100644
--- a/scripts/server/chat.js
+++ b/scripts/server/chat.js
@@ -16,30 +16,36 @@ function initChatScript() {
// ===========================================================================
function processPlayerChat(client, messageText) {
- if(!getPlayerData(client)) {
- messagePlayerError(client, "You need to login before you can chat!");
- return false;
- }
+ if(!isConsole(client)) {
+ if(!getPlayerData(client)) {
+ messagePlayerError(client, getLocaleString(client, "MustBeLoggedInAndSpawnedToChat"));
+ return false;
+ }
- if(!isPlayerLoggedIn(client)) {
- messagePlayerError(client, "You need to login before you can chat!");
- return false;
- }
+ if(!isPlayerLoggedIn(client)) {
+ messagePlayerError(client, getLocaleString(client, "MustBeLoggedInAndSpawnedToChat"));
+ return false;
+ }
- if(!isPlayerSpawned(client)) {
- messagePlayerError(client, "You need to spawn before you can chat!");
- return false;
- }
+ if(!isPlayerSpawned(client)) {
+ messagePlayerError(client, getLocaleString(client, "MustBeLoggedInAndSpawnedToChat"));
+ return false;
+ }
- if(isPlayerMuted(client)) {
- messagePlayerError(client, "You are muted and can't chat!");
- return false;
- }
+ if(isPlayerMuted(client)) {
+ messagePlayerError(client, getLocaleString(client, "MutedCantChat"));
+ return false;
+ }
- messageText = messageText.substring(0, 128);
+ messageText = messageText.substring(0, 128);
+ messagePlayerNormal(null, `💬 ${getCharacterFullName(client)}: {MAINCOLOUR}${messageText}`, getPlayerColour(client));
+ messageDiscordChatChannel(`💬 ${getCharacterFullName(client)}: ${messageText}`);
+ } else {
+ messagePlayerNormal(null, `🛡️ (ADMIN) - ${messageText}`);
+ }
- /*
- let clients = getClients();
+ /*
+ let clients = getClients();
for(let i in clients) {
let translatedText;
translatedText = await translateMessage(messageText, getPlayerData(client).locale, getPlayerData(clients[i]).locale);
@@ -47,9 +53,9 @@ function processPlayerChat(client, messageText) {
let original = (getPlayerData(client).locale == getPlayerData(clients[i]).locale) ? `` : ` {ALTCOLOUR}(${messageText})`;
messagePlayerNormal(clients[i], `💬 ${getCharacterFullName(client)}: [#FFFFFF]${translatedText}${original}`, clients[i], getColourByName("mediumGrey"));
}
- */
- messagePlayerNormal(null, `💬 ${getCharacterFullName(client)}: ${messageText}`);
- //messageDiscordChatChannel(`💬 ${getCharacterFullName(client)}: ${messageText}`);
+ */
+
+ //messageDiscordChatChannel(`💬 ${getCharacterFullName(client)}: ${messageText}`);
}
// ===========================================================================
@@ -68,7 +74,7 @@ function meActionCommand(command, params, client) {
function doActionCommand(command, params, client) {
if(isPlayerMuted(client)) {
- messagePlayerError(client, "You are muted and can't chat!");
+ messagePlayerError(client, getLocaleString(client, "MutedCantChat"));
return false;
}
@@ -85,7 +91,7 @@ function doActionCommand(command, params, client) {
function shoutCommand(command, params, client) {
if(isPlayerMuted(client)) {
- messagePlayerError(client, "You are muted and can't chat!");
+ messagePlayerError(client, getLocaleString(client, "MutedCantChat"));
return false;
}
@@ -102,7 +108,7 @@ function shoutCommand(command, params, client) {
function megaphoneChatCommand(command, params, client) {
if(isPlayerMuted(client)) {
- messagePlayerError(client, "You are muted and can't chat!");
+ messagePlayerError(client, getLocaleString(client, "MutedCantChat"));
return false;
}
@@ -112,7 +118,7 @@ function megaphoneChatCommand(command, params, client) {
}
if(!canPlayerUseMegaphone(client)) {
- messagePlayerError(client, "You must have a megaphone item or be in an emergency vehicle!");
+ messagePlayerError(client, getLocaleString(client, "CantUseMegaphone"));
return false;
}
@@ -124,7 +130,7 @@ function megaphoneChatCommand(command, params, client) {
function talkCommand(command, params, client) {
if(isPlayerMuted(client)) {
- messagePlayerError(client, "You are muted and can't chat!");
+ messagePlayerError(client, getLocaleString(client, "MutedCantChat"));
return false;
}
@@ -141,7 +147,7 @@ function talkCommand(command, params, client) {
function whisperCommand(command, params, client) {
if(isPlayerMuted(client)) {
- messagePlayerError(client, "You are muted and can't chat!");
+ messagePlayerError(client, getLocaleString(client, "MutedCantChat"));
return false;
}
@@ -158,7 +164,7 @@ function whisperCommand(command, params, client) {
function adminChatCommand(command, params, client) {
if(isPlayerMuted(client)) {
- messagePlayerError(client, "You are muted and can't chat!");
+ messagePlayerError(client, getLocaleString(client, "MutedCantChat"));
return false;
}
@@ -167,14 +173,14 @@ function adminChatCommand(command, params, client) {
return false;
}
- messageAdmins(`{jobYellow}[Admin Chat] {ALTCOLOUR}${getPlayerName(client)} [#CCCCCC](${getPlayerStaffTitle(client)}){MAINCOLOUR}: ${params}`);
+ messageAdmins(`{jobYellow}[Admin Chat] {ALTCOLOUR}${getPlayerName(client)}: ${params}`);
}
// ===========================================================================
function clanChatCommand(command, params, client) {
if(isPlayerMuted(client)) {
- messagePlayerError(client, "You are muted and can't chat!");
+ messagePlayerError(client, getLocaleString(client, "MutedCantChat"));
return false;
}
diff --git a/scripts/server/clan.js b/scripts/server/clan.js
index 215b54cf..bab3ffdb 100644
--- a/scripts/server/clan.js
+++ b/scripts/server/clan.js
@@ -106,8 +106,6 @@ class ClanMemberData {
function initClanScript() {
logToConsole(LOG_INFO, "[VRR.Clan]: Initializing clans script ...");
- getServerData().clans = loadClansFromDatabase();
- setAllClanDataIndexes();
logToConsole(LOG_INFO, "[VRR.Clan]: Clan script initialized successfully!");
return true;
}
@@ -130,7 +128,7 @@ function loadClansFromDatabase() {
//tempClanData.members = loadClanMembersFromDatabase(tempClanData.databaseId);
tempClanData.ranks = loadClanRanksFromDatabase(tempClanData.databaseId);
tempClans.push(tempClanData);
- logToConsole(LOG_VERBOSE, `[VRR.Clan]: Clan '${tempClanData.name}' loaded from database successfully!`);
+ logToConsole(LOG_DEBUG, `[VRR.Clan]: Clan '${tempClanData.name}' loaded from database successfully!`);
}
}
freeDatabaseQuery(dbQuery);
@@ -211,7 +209,7 @@ function createClanRank(clanId, rankId, rankName) {
let rankIndex = getClanData(clanId).ranks.push(tempClanRankData);
setAllClanDataIndexes();
- saveAllClanRanksToDatabase(clanId);
+ saveClanRanksToDatabase(clanId);
return rankIndex;
}
@@ -223,7 +221,7 @@ function removeClanRank(clanId, rankId) {
return false;
}
- quickDatabaseQuery(`DELETE FROM clan_rank WHERE clan_rank_id = ${tempClanRankData.database}`);
+ quickDatabaseQuery(`UPDATE clan_rank SET clan_rank_deleted = 1, clan_rank_when_deleted = UNIX_TIMESTAMP(), clan_rank_who_deleted = ${getPlayerData(client).accountData.databaseId} WHERE biz_id ${tempClanRankData.database}`);
getClanData(clanId).ranks.splice(tempClanRankData.index, 1);
}
@@ -241,7 +239,7 @@ function listClansCommand(command, params, client) {
let chunkedList = splitArrayIntoChunks(nameList, 5);
- messagePlayerInfo(client, `{clanOrange}== {jobYellow}Clans {clanOrange}====================================`);
+ messagePlayerInfo(client, makeChatBoxSectionHeader(getLocaleString(client, "HeaderClansList")));
for(let i in chunkedList) {
messagePlayerInfo(client, chunkedList[i].join(", "));
@@ -268,7 +266,7 @@ function listClanRanksCommand(command, params, client) {
let chunkedList = splitArrayIntoChunks(rankNameList, 5);
- messagePlayerInfo(client, `{clanOrange}== {jobYellow}Clan Ranks (${getClanData(clanId).name}) {clanOrange}=====================`);
+ messagePlayerInfo(client, makeChatBoxSectionHeader(getLocaleString(client, "HeaderClanRanksList")));
for(let i in chunkedList) {
messagePlayerInfo(client, chunkedList[i].join(", "));
@@ -290,7 +288,7 @@ function createClanCommand(command, params, client) {
// Create clan without owner. Can set owner with /clanowner afterward
createClan(params);
- messageAdmins(`{ALTCOLOUR}${getPlayerName(client)} {MAINCOLOUR}created clan {clanOrange}${params}`);
+ messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} created clan {clanOrange}${params}`);
}
// ===========================================================================
@@ -308,8 +306,8 @@ function deleteClanCommand(command, params, client) {
return false;
}
- messageAdmins(`{ALTCOLOUR}${getPlayerName(client)} {MAINCOLOUR}deleted clan {clanOrange}${getClanData(clanId).name}`);
- deleteClan(clanId);
+ messageAdmins(`{adminOrange}${getPlayerName(client)} {MAINCOLOUR}deleted clan {clanOrange}${getClanData(clanId).name}`);
+ deleteClan(clanId, getPlayerData(client).accountData.databaseId);
}
// ===========================================================================
@@ -339,10 +337,13 @@ function setClanOwnerCommand(command, params, client) {
}
getClanData(clanId).owner = getPlayerCurrentSubAccount(targetClient).databaseId;
+ getClanData(clanId).needsSaved = true;
+
getPlayerCurrentSubAccount(targetClient).clan = getClanData(clanId).databaseId;
getPlayerCurrentSubAccount(targetClient).clanFlags = getClanFlagValue("All");
- messageAdmins(`{ALTCOLOUR}${getPlayerName(client)} {MAINCOLOUR}set clan {clanOrange}${getClanData(clanId).name} {MAINCOLOUR}owner to {ALTCOLOUR}${getCharacterFullName(targetClient)}`);
+ //messageAdmins(`{adminOrange}${getPlayerName(client)} {MAINCOLOUR}set clan {clanOrange}${getClanData(clanId).name} {MAINCOLOUR}owner to {ALTCOLOUR}${getCharacterFullName(targetClient)}`);
+ messagePlayerSuccess(client, `You changed the clan owner to {ALTCOLOUR}${getCharacterFullName(targetClient)}`);
}
// ===========================================================================
@@ -365,9 +366,11 @@ function setClanTagCommand(command, params, client) {
return false;
}
- getClanData(clanId).params = params;
+ getClanData(clanId).tag = params;
+ getClanData(clanId).needsSaved = true;
- messageAdmins(`{ALTCOLOUR}${getPlayerName(client)} {MAINCOLOUR}set clan {clanOrange}${getClanData(clanId).index} {MAINCOLOUR}tag to {ALTCOLOUR}${params}`);
+ //messageAdmins(`{adminOrange}${getPlayerName(client)} {MAINCOLOUR}set clan {clanOrange}${getClanData(clanId).index} {MAINCOLOUR}tag to {ALTCOLOUR}${params}`);
+ messagePlayerSuccess(client, `You changed the clan tag to {ALTCOLOUR}${params}`);
}
// ===========================================================================
@@ -391,8 +394,10 @@ function setClanNameCommand(command, params, client) {
}
getClanData(clanId).name = params;
+ getClanData(clanId).needsSaved = true;
- messageAdmins(`{ALTCOLOUR}${getPlayerName(client)} {MAINCOLOUR}set clan {clanOrange}${getClanData(clanId).index} {MAINCOLOUR}name to {ALTCOLOUR}${params}`);
+ //messageAdmins(`{adminOrange}${getPlayerName(client)} {MAINCOLOUR}set clan {clanOrange}${getClanData(clanId).index} {MAINCOLOUR}name to {ALTCOLOUR}${params}`);
+ messagePlayerSuccess(client, `You changed the clan name to {ALTCOLOUR}${params}`);
}
// ===========================================================================
@@ -453,8 +458,9 @@ function deleteClanRankCommand(command, params, client) {
}
removeClanRank(clanId, rankId);
+ getClanData(clanId).needsSaved = true;
- messagePlayerSuccess(client, `You removed the {ALTCOLOUR}${tempRankName} {MAINCOLOUR}rank`);
+ messagePlayerSuccess(client, `You removed the {ALTCOLOUR}${tempRankName}{MAINCOLOUR} rank`);
}
// ===========================================================================
@@ -496,7 +502,7 @@ function setClanMemberTagCommand(command, params, client) {
}
}
- getPlayerCurrentSubAccount(targetClient).ClanTag = getParam(params, " ", 2);
+ getPlayerCurrentSubAccount(targetClient).clanTag = getParam(params, " ", 2);
messagePlayerSuccess(client, `You set {ALTCOLOUR}${getCharacterFullName(targetClient)}'s {MAINCOLOUR}clan tag to {ALTCOLOUR}${getParam(params, " ", 2)}`);
messagePlayerAlert(client, `{ALTCOLOUR}${getCharacterFullName(targetClient)} {MAINCOLOUR}set your clan tag to {ALTCOLOUR}${getParam(params, " ", 2)}`);
@@ -530,7 +536,8 @@ function setClanRankTagCommand(command, params, client) {
}
}
- getServerData().clans[clanId].rankId[rankId].customTag = newTag;
+ getClanRankData(clanId, rankId).customTag = newTag;
+ getClanRankData(clanId, rankId).needsSaved = true;
}
// ===========================================================================
@@ -578,7 +585,8 @@ function setClanRankLevelCommand(command, params, client) {
return false;
}
- getServerData().clans[clanId].rankId[rankId].level = toInteger(newLevel);
+ getClanRankData(clanId, rankId).level = toInteger(newLevel);
+ getClanRankData(clanId, rankId).needsSaved = true;
}
// ===========================================================================
@@ -717,7 +725,8 @@ function addClanRankFlagCommand(command, params, client) {
let flagValue = getClanFlagValue(getParam(params, " ", 2));
- addBitFlag(getClanRankData(clanId, rankId).flags, flagValue);
+ getClanRankData(clanId, rankId).flags = addBitFlag(getClanRankData(clanId, rankId).flags, flagValue);
+ getClanRankData(clanId, rankId).needsSaved = true;
messagePlayerSuccess(client, `You added the {ALTCOLOUR}${getParam(params, " ", 2)} {MAINCOLOUR}clan flag to rank {ALTCOLOUR}${getClanRankData(clanId, rankId).name}`);
}
@@ -755,7 +764,8 @@ function removeClanRankFlagCommand(command, params, client) {
let flagValue = getClanFlagValue(getParam(params, " ", 2));
- removeBitFlag(getClanRankData(clanId, rankId).flags, flagValue);
+ getClanRankData(clanId, rankId).flags = removeBitFlag(getClanRankData(clanId, rankId).flags, flagValue);
+ getClanRankData(clanId, rankId).needsSaved = true;
messagePlayerSuccess(client, `You removed the {ALTCOLOUR}${getParam(params, " ", 2)} {MAINCOLOUR}clan flag from rank {ALTCOLOUR}${getClanRankData(clanId, rankId).name}`);
}
@@ -799,8 +809,7 @@ function showClanRankFlagsCommand(command, params, client) {
let chunkedList = splitArrayIntoChunks(flagList, 6);
- messagePlayerInfo(client, `{clanOrange}== {jobYellow}Clan Rank Flags (${getClanRankData(clanId, rankId).name}){clanOrange}===================`);
-
+ makeChatBoxSectionHeader(client, getLocaleString(client, "ClanRankFlags"), getClanRankData(clanId, rankId).name);
for(let i in chunkedList) {
messagePlayerInfo(client, chunkedList[i].join("{MAINCOLOUR}, "));
}
@@ -881,6 +890,7 @@ function setClanRankTitleCommand(command, params, client) {
let oldRankName = getClanRankData(clanId, rankId).name;
getClanRankData(clanId, rankId).name = getParam(params, " ", 2);
+ getClanRankData(clanId, rankId).needsSaved = true;
messagePlayerSuccess(client, `You changed the name of rank ${rankId} from {ALTCOLOUR}${oldRankName} {MAINCOLOUR}to {ALTCOLOUR}${params}`);
}
@@ -941,7 +951,7 @@ function setClanMemberRankCommand(command, params, client) {
let oldClanRank = getClanRankData(clanId, getPlayerClanRank(targetClient));
getPlayerCurrentSubAccount(targetClient).clanRank = getClanRankData(clanId, rankId).databaseId;
getPlayerCurrentSubAccount(targetClient).clanRankIndex = rankId;
- messagePlayerSuccess(client, `You changed {ALTCOLOUR}${getCharacterFullName(targetClient)}'s {MAINCOLOUR}rank from {ALTCOLOUR}${oldClanRank.name} {MAINCOLOUR}to {ALTCOLOUR}${getClanRankData(clanId, rankId).name}`);
+ messagePlayerSuccess(client, `You changed {ALTCOLOUR}${getCharacterFullName(targetClient)}'s{MAINCOLOUR} rank from {ALTCOLOUR}${oldClanRank.name}{MAINCOLOUR} to {ALTCOLOUR}${getClanRankData(clanId, rankId).name}`);
}
// ===========================================================================
@@ -966,12 +976,12 @@ function createClan(name) {
// ===========================================================================
-function deleteClan(clanId) {
- saveClansToDatabase();
+function deleteClan(clanId, whoDeleted = 0) {
+ //saveAllClansToDatabase();
let dbConnection = connectToDatabase();
if(dbConnection) {
- let dbQuery = queryDatabase(dbConnection, `UPDATE clan_main SET clan_deleted = 1 WHERE clan_id = ${clanId}`);
+ let dbQuery = queryDatabase(dbConnection, `UPDATE clan_main SET clan_deleted = 1, clan_when_deleted = UNIX_TIMESTAMP, clan_who_deleted = ${whoDeleted} WHERE clan_id = ${clanId}`);
freeDatabaseQuery(dbQuery);
disconnectFromDatabase(dbConnection);
@@ -1024,12 +1034,20 @@ function doesClanIdExist(clanId) {
// ===========================================================================
function reloadAllClans() {
+ if(getServerConfig().devServer) {
+ return false;
+ }
+
getServerData().clans = loadClansFromDatabase();
}
// ===========================================================================
-function saveAllClanRanksToDatabase(clanId) {
+function saveClanRanksToDatabase(clanId) {
+ if(getServerConfig().devServer) {
+ return false;
+ }
+
let ranks = getServerData().clans[clanId].ranks;
for(let i in ranks) {
saveClanRankToDatabase(clanId, i);
@@ -1045,9 +1063,13 @@ function saveClanToDatabase(clanId) {
return false;
}
- if(!tempClanData.needsSaved) {
- return false;
- }
+ if(tempClanData.databaseId == -1) {
+ return false;
+ }
+
+ if(!tempClanData.needsSaved) {
+ return false;
+ }
let dbConnection = connectToDatabase();
if(dbConnection) {
@@ -1079,7 +1101,7 @@ function saveClanToDatabase(clanId) {
disconnectFromDatabase(dbConnection);
}
- saveAllClanRanksToDatabase(clanId);
+ saveClanRanksToDatabase(clanId);
return true;
}
@@ -1091,41 +1113,41 @@ function saveClanToDatabase(clanId) {
function saveClanRankToDatabase(clanId, rankId) {
let tempClanRankData = getClanRankData(clanId, rankId);
- if(!tempClanRankData.needsSaved) {
- return false;
- }
+ if(!tempClanRankData.needsSaved) {
+ return false;
+ }
let dbConnection = connectToDatabase();
if(dbConnection) {
- let safeName = escapeDatabaseString(dbConnection, tempClanRankData.name);
- let safeTag = escapeDatabaseString(dbConnection, tempClanRankData.customTag);
- //let safeTitle = escapeDatabaseString(dbConnection, tempClanRankData.name);
+ let safeName = escapeDatabaseString(dbConnection, tempClanRankData.name);
+ let safeTag = escapeDatabaseString(dbConnection, tempClanRankData.customTag);
+ //let safeTitle = escapeDatabaseString(dbConnection, tempClanRankData.name);
- let data = [
- ["clan_rank_name", safeName],
- ["clan_rank_clan", tempClanRankData.clan],
- ["clan_rank_custom_tag", safeTag],
- //["clan_rank_title", safeTitle],
- ["clan_rank_flags", tempClanRankData.flags],
- ["clan_rank_level", tempClanRankData.level],
- ["clan_rank_enabled", boolToInt(tempClanRankData.enabled)],
- ];
+ let data = [
+ ["clan_rank_name", safeName],
+ ["clan_rank_clan", tempClanRankData.clan],
+ ["clan_rank_custom_tag", safeTag],
+ //["clan_rank_title", safeTitle],
+ ["clan_rank_flags", tempClanRankData.flags],
+ ["clan_rank_level", tempClanRankData.level],
+ ["clan_rank_enabled", boolToInt(tempClanRankData.enabled)],
+ ];
- let dbQuery = null;
- if(tempClanRankData.databaseId == 0) {
- let queryString = createDatabaseInsertQuery("clan_rank", data);
- dbQuery = queryDatabase(dbConnection, queryString);
- getClanRankData(clanId, rankId).databaseId = getDatabaseInsertId(dbConnection);
- getClanRankData(clanId, rankId).needsSaved = false;
- } else {
- let queryString = createDatabaseUpdateQuery("clan_rank", data, `clan_rank_id=${tempClanRankData.databaseId} LIMIT 1`);
- dbQuery = queryDatabase(dbConnection, queryString);
- getClanRankData(clanId, rankId).needsSaved = false;
- }
+ let dbQuery = null;
+ if(tempClanRankData.databaseId == 0) {
+ let queryString = createDatabaseInsertQuery("clan_rank", data);
+ dbQuery = queryDatabase(dbConnection, queryString);
+ getClanRankData(clanId, rankId).databaseId = getDatabaseInsertId(dbConnection);
+ getClanRankData(clanId, rankId).needsSaved = false;
+ } else {
+ let queryString = createDatabaseUpdateQuery("clan_rank", data, `clan_rank_id=${tempClanRankData.databaseId} LIMIT 1`);
+ dbQuery = queryDatabase(dbConnection, queryString);
+ getClanRankData(clanId, rankId).needsSaved = false;
+ }
- freeDatabaseQuery(dbQuery);
- disconnectFromDatabase(dbConnection);
- return true;
+ freeDatabaseQuery(dbQuery);
+ disconnectFromDatabase(dbConnection);
+ return true;
}
return false;
@@ -1169,6 +1191,10 @@ function setClanRankTitle(clanId, rankId, title) {
// ===========================================================================
function saveAllClansToDatabase() {
+ if(getServerConfig().devServer) {
+ return false;
+ }
+
for(let i in getServerData().clans) {
saveClanToDatabase(i);
}
@@ -1231,6 +1257,11 @@ function getClanRankIdFromDatabaseId(clanId, databaseId) {
// ===========================================================================
+/**
+ * @param {number} clanId - The data index of the clan
+ * @param {number} clanRankId - The data index of the clan rank
+ * @return {ClanRankData} The clan rank's data (class instance)
+ */
function getClanRankData(clanId, rankId) {
return getServerData().clans[clanId].ranks[rankId];
}
@@ -1287,7 +1318,7 @@ function showClanFlagListCommand(command, params, client) {
return false;
}
-let rankId = getClanRankFromParams(clanId, getParam(params, " ", 1));
+ let rankId = getClanRankFromParams(clanId, getParam(params, " ", 1));
if(!getClanRankData(clanId, rankId)) {
messagePlayerError(client, getLocaleString(client, "ClanRankInvalid"));
@@ -1310,6 +1341,12 @@ let rankId = getClanRankFromParams(clanId, getParam(params, " ", 1));
}
*/
+// ===========================================================================
+
+/**
+ * @param {String} params - The params to search for
+ * @return {Number} The data index of a matching clan
+ */
function getClanFromParams(params) {
if(isNaN(params)) {
for(let i in getServerData().clans) {
@@ -1328,6 +1365,11 @@ function getClanFromParams(params) {
// ===========================================================================
+/**
+ * @param {Number} clanId - The clan ID to search ranks for
+ * @param {String} params - The params to search for
+ * @return {Number} The data index of a matching clan
+ */
function getClanRankFromParams(clanId, params) {
if(isNaN(params)) {
for(let i in getClanData(clanId).ranks) {
diff --git a/scripts/server/client.js b/scripts/server/client.js
index 7533e9a5..23b8a608 100644
--- a/scripts/server/client.js
+++ b/scripts/server/client.js
@@ -122,104 +122,108 @@ const VRR_RETURNTO_TYPE_SKINSELECT = 2; // "Return to" data is from ski
// ===========================================================================
function initClientScript() {
- logToConsole(LOG_DEBUG, "[VRR.Client]: Initializing client script ...");
- addAllNetworkHandlers();
- logToConsole(LOG_DEBUG, "[VRR.Client]: Client script initialized!");
+ logToConsole(LOG_DEBUG, "[VRR.Client]: Initializing client script ...");
+ addAllNetworkHandlers();
+ logToConsole(LOG_DEBUG, "[VRR.Client]: Client script initialized!");
}
// ===========================================================================
function addAllNetworkHandlers() {
- logToConsole(LOG_DEBUG, "[VRR.Client]: Adding network handlers ...");
+ logToConsole(LOG_DEBUG, "[VRR.Client]: Adding network handlers ...");
- // KeyBind
- addNetworkEventHandler("vrr.useKeyBind", playerUsedKeyBind);
+ // KeyBind
+ addNetworkEventHandler("vrr.useKeyBind", playerUsedKeyBind);
- // GUI
- addNetworkEventHandler("vrr.promptAnswerNo", playerPromptAnswerNo);
- addNetworkEventHandler("vrr.promptAnswerYes", playerPromptAnswerYes);
- addNetworkEventHandler("vrr.toggleGUI", playerToggledGUI);
- addNetworkEventHandler("vrr.2fa", checkPlayerTwoFactorAuthentication);
+ // GUI
+ addNetworkEventHandler("vrr.promptAnswerNo", playerPromptAnswerNo);
+ addNetworkEventHandler("vrr.promptAnswerYes", playerPromptAnswerYes);
+ addNetworkEventHandler("vrr.toggleGUI", playerToggledGUI);
+ addNetworkEventHandler("vrr.2fa", checkPlayerTwoFactorAuthentication);
- // AFK
- addNetworkEventHandler("vrr.afk", playerChangeAFKState);
+ // 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);
+ // 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);
+ // Job
+ addNetworkEventHandler("vrr.arrivedAtJobRouteLocation", playerArrivedAtJobRouteLocation);
- // Client
- addNetworkEventHandler("vrr.clientReady", playerClientReady);
- addNetworkEventHandler("vrr.guiReady", playerGUIReady);
- addNetworkEventHandler("vrr.clientStarted", playerClientStarted);
- addNetworkEventHandler("vrr.clientStopped", playerClientStopped);
+ // 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);
+ // 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);
+ // 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);
+ // 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);
+ // Item
+ addNetworkEventHandler("vrr.itemActionDelayComplete", playerItemActionDelayComplete);
+ addNetworkEventHandler("vrr.weaponDamage", playerDamagedByPlayer);
- // 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);
+ // 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`);
+ //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]);
- }
+ 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), client.ping);
+ //logToConsole(LOG_DEBUG, `[VRR.Client] Sending ${getPlayerDisplayForConsole(client)}'s ping to all players`);
+ sendNetworkEventToPlayer("vrr.ping", null, getPlayerName(client), getPlayerPing(client));
}
// ===========================================================================
function playerClientReady(client) {
- setEntityData(client, "vrr.isReady", true, false);
- logToConsole(LOG_DEBUG, `${getPlayerDisplayForConsole(client)}'s client resources are downloaded and ready!`);
- if(client.getData("vrr.isStarted") == true) {
+ 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);
}
}
@@ -227,16 +231,16 @@ function playerClientReady(client) {
// ===========================================================================
function playerGUIReady(client) {
- setEntityData(client, "vrr.guiReady", true, false);
- logToConsole(LOG_DEBUG, `${getPlayerDisplayForConsole(client)}'s client GUI is initialized and ready!`);
+ playerGUI[client.index] = true;
+ logToConsole(LOG_DEBUG, `[VRR.Client] ${getPlayerDisplayForConsole(client)}'s client GUI is initialized and ready!`);
}
// ===========================================================================
function playerClientStarted(client) {
- setEntityData(client, "vrr.isStarted", true, false);
- logToConsole(LOG_DEBUG, `${getPlayerDisplayForConsole(client)}'s client resources are started and running!`);
- if(client.getData("vrr.isReady") == true) {
+ 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);
}
}
@@ -244,37 +248,38 @@ function playerClientStarted(client) {
// ===========================================================================
function playerClientStopped(client) {
- logToConsole(LOG_DEBUG, `${getPlayerDisplayForConsole(client)}'s client resources have stopped (possibly error?). Kicking them from the server ...`);
- client.disconnect();
+ 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) {
- logToConsole(LOG_DEBUG, `[VRR.Client] Showing game message to ${getPlayerDisplayForConsole(client)} (${text}) for ${duration} milliseconds`);
- sendNetworkEventToPlayer("vrr.smallGameMessage", client, text, colour, duration);
+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;
- //}
+ //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);
+ //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;
- //}
+ //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);
+ //logToConsole(LOG_DEBUG, `[VRR.Client] Setting ${getPlayerDisplayForConsole(client)}'s city ambience to ${toUpperCase(getOnOffFromBool(false))}`);
+ //sendNetworkEventToPlayer("vrr.ambience", client, false, clearElements);
}
// ===========================================================================
@@ -287,30 +292,30 @@ function clearPlayerOwnedPeds(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);
+ 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);
+ 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);
+ 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);
+ logToConsole(LOG_DEBUG, `[VRR.Client] Restoring ${getPlayerDisplayForConsole(client)}'s camera`);
+ sendNetworkEventToPlayer("vrr.restoreCamera", client);
}
// ===========================================================================
@@ -322,485 +327,485 @@ function setPlayer2DRendering(client, hudState = false, labelState = false, smal
// ===========================================================================
function syncPlayerProperties(client) {
- logToConsole(LOG_DEBUG, `[VRR.Client] Sending signal to sync ${getPlayerDisplayForConsole(client)}'s player ped properties`);
- sendNetworkEventToPlayer("vrr.player.sync", null, client.player);
+ 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(getServerGame())) {
- 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);
- }
+ 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);
+ 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);
+ 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;
+ 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 showPlayerChangePasswordGUI(client) {
- logToConsole(LOG_DEBUG, `[VRR.Client] Sending change password GUI signal to ${getPlayerDisplayForConsole(client)}`);
- sendNetworkEventToPlayer("vrr.changePassword", client);
+ 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);
+ 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);
+ 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);
+ 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);
+ 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)}`);
+ 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)}`);
+ 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);
+ 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);
+ 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);
+ 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);
+ 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 GUI signal to ${getPlayerDisplayForConsole(client)}`);
- sendNetworkEventToPlayer("vrr.showResetPasswordCodeInput", 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);
+ 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);
+ 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);
+ 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);
+ logToConsole(LOG_DEBUG, `[VRR.Client] Sending character select failed GUI signal to ${getPlayerDisplayForConsole(client)}`);
+ sendNetworkEventToPlayer("vrr.characterSelectFailed", client);
}
// ===========================================================================
-function showPlayerPromptGUI(client, promptMessage, promptTitle, yesButtonText, noButtonText) {
- logToConsole(LOG_DEBUG, `[VRR.Client] Sending show prompt GUI signal to ${getPlayerDisplayForConsole(client)} (Title: ${promptTitle}, Message: ${promptMessage})`);
- sendNetworkEventToPlayer("vrr.showPrompt", client, promptMessage, promptTitle, yesButtonText, noButtonText);
+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);
+ 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.showInfo", client, errorMessage, errorTitle, buttonText);
+ 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, 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);
+ 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);
+ 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);
+ 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);
+ 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);
+ 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);
+ 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);
+ 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);
+ 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));
+ 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);
+ 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);
+ 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);
+ 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);
+ logToConsole(LOG_DEBUG, `[VRR.Client] Sending set frozen signal to ${getPlayerDisplayForConsole(client)} (State: ${toUpperCase(getYesNoFromBool(state))})`);
+ sendNetworkEventToPlayer("vrr.frozen", client, state);
}
// ===========================================================================
-function clearPlayerWeapons(client) {
- logToConsole(LOG_DEBUG, `[VRR.Client] Sending signal to ${getPlayerDisplayForConsole(client)} to clear weapons`);
- sendNetworkEventToPlayer("vrr.clearWeapons", client);
+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);
+ 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);
+ logToConsole(LOG_DEBUG, `[VRR.Client] Sending remove from vehicle signal to ${getPlayerDisplayForConsole(client)}`);
+ sendNetworkEventToPlayer("vrr.removeFromVehicle", client);
}
// ===========================================================================
-function sendChatBoxMessageToPlayer(client, message, colour) {
- sendNetworkEventToPlayer("vrr.m", client, message, colour)
- //messageClient(message, client, colour);
+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);
- }
- }
+ 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);
- }
- }
+ 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);
- }
- }
+ 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);
- }
- }
+ 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);
- }
- }
+ 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);
- }
+ 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);
+ 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);
+ 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);
+ let damagerEntity = getPlayerFromParams(damagerEntityName);
- if(isNull(damagerEntity)) {
- logToConsole(LOG_DEBUG, `[VRR.Client] ${getPlayerDisplayForConsole(client)}'s damager entity from ID is null`);
- return false;
- }
+ 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}`);
+ 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 (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;
- }
+ 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)}`);
+ 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;
+ 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_EXTINGUISH:
+ break;
- case VRR_WEAPON_DAMAGE_EVENT_MACE:
- 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;
+ 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;
- }
+ 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;
+ }
}
// ===========================================================================
@@ -818,44 +823,44 @@ function sendTimeMinuteDurationToPlayer(client, minuteDuration) {
// ===========================================================================
function updatePositionInPlayerData(client, position) {
- getPlayerData(client).syncPosition = position;
+ getPlayerData(client).syncPosition = position;
}
// ===========================================================================
function updateHeadingInPlayerData(client, heading) {
- getPlayerData(client).syncHeading = heading;
+ getPlayerData(client).syncHeading = heading;
}
// ===========================================================================
function updatePositionInVehicleData(client, vehicle, position) {
- getVehicleData(vehicle).syncPosition = position;
+ getVehicleData(vehicle).syncPosition = position;
}
// ===========================================================================
function updateHeadingInVehicleData(client, vehicle, heading) {
- getVehicleData(vehicle).syncHeading = heading;
+ getVehicleData(vehicle).syncHeading = heading;
}
// ===========================================================================
function forcePlayerIntoSkinSelect(client) {
- if(getGameConfig().skinChangePosition[getServerGame()].length > 0) {
- 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;
+ 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[getServerGame()][0]);
- setPlayerHeading(client, getGameConfig().skinChangePosition[getServerGame()][1]);
- setPlayerInterior(client, getGameConfig().skinChangePosition[getServerGame()][2]);
- setPlayerDimension(client, client.index+500);
- }
+ 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);
+ sendNetworkEventToPlayer("vrr.skinSelect", client, true);
}
// ===========================================================================
@@ -867,14 +872,14 @@ function updatePlayerCash(client) {
// ===========================================================================
function sendAllPoliceStationBlips(client) {
- if(getGameConfig().blipSprites[getServerGame()].policeStation != -1) {
+ if (getGameConfig().blipSprites[getGame()].policeStation != -1) {
let tempBlips = [];
- for(let i in getServerData().policeStations[getServerGame()]) {
+ for (let i in getServerData().policeStations[getGame()]) {
tempBlips.push([
- getGameConfig().blipSprites[getServerGame()].policeStation,
- getServerData().policeStations[getServerGame()][i].position.x,
- getServerData().policeStations[getServerGame()][i].position.y,
- getServerData().policeStations[getServerGame()][i].position.z,
+ 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"),
]);
@@ -886,14 +891,14 @@ function sendAllPoliceStationBlips(client) {
// ===========================================================================
function sendAllFireStationBlips(client) {
- if(getGameConfig().blipSprites[getServerGame()].fireStation != -1) {
+ if (getGameConfig().blipSprites[getGame()].fireStation != -1) {
let tempBlips = [];
- for(let i in getServerData().fireStations[getServerGame()]) {
+ for (let i in getServerData().fireStations[getGame()]) {
tempBlips.push([
- getGameConfig().blipSprites[getServerGame()].fireStation,
- getServerData().fireStations[getServerGame()][i].position.x,
- getServerData().fireStations[getServerGame()][i].position.y,
- getServerData().fireStations[getServerGame()][i].position.z,
+ 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"),
]);
@@ -905,14 +910,14 @@ function sendAllFireStationBlips(client) {
// ===========================================================================
function sendAllHospitalBlips(client) {
- if(getGameConfig().blipSprites[getServerGame()].hospital != -1) {
+ if (getGameConfig().blipSprites[getGame()].hospital != -1) {
let tempBlips = [];
- for(let i in getServerData().hospitals[getServerGame()]) {
+ for (let i in getServerData().hospitals[getGame()]) {
tempBlips.push([
- getGameConfig().blipSprites[getServerGame()].hospital,
- getServerData().hospitals[getServerGame()][i].position.x,
- getServerData().hospitals[getServerGame()][i].position.y,
- getServerData().hospitals[getServerGame()][i].position.z,
+ 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"),
]);
@@ -924,14 +929,14 @@ function sendAllHospitalBlips(client) {
// ===========================================================================
function sendAllAmmunationBlips(client) {
- if(getGameConfig().blipSprites[getServerGame()].ammunation != -1) {
+ if (getGameConfig().blipSprites[getGame()].ammunation != -1) {
let tempBlips = [];
- for(let i in getServerData().ammunations[getServerGame()]) {
+ for (let i in getServerData().ammunations[getGame()]) {
tempBlips.push([
- getGameConfig().blipSprites[getServerGame()].ammunation,
- getServerData().ammunations[getServerGame()][i].position.x,
- getServerData().ammunations[getServerGame()][i].position.y,
- getServerData().ammunations[getServerGame()][i].position.z,
+ getGameConfig().blipSprites[getGame()].ammunation,
+ getServerData().ammunations[getGame()][i].position.x,
+ getServerData().ammunations[getGame()][i].position.y,
+ getServerData().ammunations[getGame()][i].position.z,
3,
0
]);
@@ -943,14 +948,14 @@ function sendAllAmmunationBlips(client) {
// ===========================================================================
function sendAllPayAndSprayBlips(client) {
- if(getGameConfig().blipSprites[getServerGame()].payAndSpray != -1) {
+ if (getGameConfig().blipSprites[getGame()].payAndSpray != -1) {
let tempBlips = [];
- for(let i in getServerData().payAndSprays[getServerGame()]) {
+ for (let i in getServerData().payAndSprays[getGame()]) {
tempBlips.push([
- getGameConfig().blipSprites[getServerGame()].payAndSpray,
- getServerData().payAndSprays[getServerGame()][i].position.x,
- getServerData().payAndSprays[getServerGame()][i].position.y,
- getServerData().payAndSprays[getServerGame()][i].position.z,
+ getGameConfig().blipSprites[getGame()].payAndSpray,
+ getServerData().payAndSprays[getGame()][i].position.x,
+ getServerData().payAndSprays[getGame()][i].position.y,
+ getServerData().payAndSprays[getGame()][i].position.z,
3,
0
]);
@@ -962,14 +967,14 @@ function sendAllPayAndSprayBlips(client) {
// ===========================================================================
function sendAllFuelStationBlips(client) {
- if(getGameConfig().blipSprites[getServerGame()].fuelStation != -1) {
+ if (getGameConfig().blipSprites[getGame()].fuelStation != -1) {
let tempBlips = [];
- for(let i in getServerData().fuelStations[getServerGame()]) {
+ for (let i in getServerData().fuelStations[getGame()]) {
tempBlips.push([
- getGameConfig().blipSprites[getServerGame()].fuelStation,
- getServerData().fuelStations[getServerGame()][i].position.x,
- getServerData().fuelStations[getServerGame()][i].position.y,
- getServerData().fuelStations[getServerGame()][i].position.z,
+ 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"),
]);
@@ -981,297 +986,364 @@ function sendAllFuelStationBlips(client) {
// ===========================================================================
function sendPlayerSetHealth(client, health) {
- sendNetworkEventToPlayer("vrr.health", client, health);
+ sendNetworkEventToPlayer("vrr.health", client, toInteger(health));
}
-
// ===========================================================================
function sendPlayerSetArmour(client, armour) {
- sendNetworkEventToPlayer("vrr.armour", 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);
+ 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);
+ 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(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);
- }
+ 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);
+ 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;
- }
+ getPlayerData(client).returnToPosition = null;
+ getPlayerData(client).returnToHeading = null;
+ getPlayerData(client).returnToInterior = null;
+ getPlayerData(client).returnToDimension = null;
+ }
- restorePlayerCamera(client);
- setPlayerControlState(client, true);
+ restorePlayerCamera(client);
+ setPlayerControlState(client, true);
- deleteItem(getPlayerData(client).itemActionItem);
- switchPlayerActiveHotBarSlot(client, -1);
- cachePlayerHotBarItems(client);
+ deleteItem(getPlayerData(client).itemActionItem);
+ switchPlayerActiveHotBarSlot(client, -1);
+ cachePlayerHotBarItems(client);
- meActionToNearbyPlayers(client, `changes their skin to ${allowedSkins[allowedSkinIndex][1]}`);
- }
+ meActionToNearbyPlayers(client, `changes their skin to ${getServerData().allowedSkins[allowedSkinIndex][1]}`);
+ }
}
// ===========================================================================
function sendPlayerChatScrollLines(client, amount) {
- sendNetworkEventToPlayer("vrr.chatScrollLines", 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);
+ 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);
+ 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);
+ 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);
+ 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);
+ sendNetworkEventToPlayer("vrr.veh.lights", null, vehicle.id, state);
}
// ===========================================================================
function sendPlayerEnterPropertyKey(client, key) {
- sendNetworkEventToPlayer("vrr.enterPropertyKey", client, key);
+ sendNetworkEventToPlayer("vrr.enterPropertyKey", client, key);
}
// ===========================================================================
function makePedPlayAnimation(ped, animationSlot, positionOffset) {
- let animationData = getAnimationData(animationSlot);
- let freezePlayer = false;
- //if(animationData[9] != VRR_ANIMMOVE_NONE) {
- switch(animationData[9]) {
- case VRR_ANIMMOVE_FORWARD:
- setElementCollisionsEnabled(ped, false);
- setElementPosition(ped, getPosInFrontOfPos(getElementPosition(ped), fixAngle(getElementHeading(ped)), positionOffset));
- freezePlayer = true;
- break;
-
- case VRR_ANIMMOVE_BACK:
- setElementCollisionsEnabled(ped, false);
- setElementPosition(ped, getPosBehindPos(getElementPosition(ped), fixAngle(getElementHeading(ped)), positionOffset));
- freezePlayer = true;
- break;
-
- case VRR_ANIMMOVE_LEFT:
- setElementCollisionsEnabled(ped, false);
- setElementPosition(ped, getPosToLeftOfPos(getElementPosition(ped), fixAngle(getElementHeading(ped)), positionOffset));
- freezePlayer = true;
- break;
-
- case VRR_ANIMMOVE_RIGHT:
- setElementCollisionsEnabled(ped, false);
- setElementPosition(ped, getPosToRightOfPos(getElementPosition(ped), fixAngle(getElementHeading(ped)), positionOffset));
- freezePlayer = true;
- break;
- }
- //}
- sendNetworkEventToPlayer("vrr.pedAnim", null, ped.id, animationData[1], animationData[2], animationData[3], animationData[4], animationData[5], positionOffset, freezePlayer);
+ setEntityData(ped, "vrr.anim", animationSlot, true);
+ sendNetworkEventToPlayer("vrr.anim", null, getPedForNetworkEvent(ped), animationSlot, positionOffset);
}
// ===========================================================================
-function makePedStopAnimation(pedId) {
- sendNetworkEventToPlayer("vrr.pedStopAnim", null, pedId);
+function makePedStopAnimation(ped) {
+ removeEntityData(ped, "vrr.anim");
+ sendNetworkEventToPlayer("vrr.stopAnim", null, getPedForNetworkEvent(ped));
}
// ===========================================================================
-function forcePedAnimation(ped, animationSlot) {
- let animationData = getAnimationData(animationSlot);
-
- sendNetworkEventToPlayer("vrr.forcePedAnim", null, ped.id, animationData[1], animationData[2], animationData[3], animationData[4]);
+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);
+ sendNetworkEventToPlayer("vrr.hideAllGUI", client);
}
// ===========================================================================
function requestClientInfo(client) {
- sendNetworkEventToPlayer("vrr.clientInfo", client);
+ sendNetworkEventToPlayer("vrr.clientInfo", client);
}
// ===========================================================================
function updateInteriorLightsForPlayer(client, state) {
- sendNetworkEventToPlayer("vrr.interiorLights", client, state);
+ sendNetworkEventToPlayer("vrr.interiorLights", client, state);
}
// ===========================================================================
function forcePlayerToSyncElementProperties(client, element) {
- sendNetworkEventToPlayer("vrr.syncElement", client, element.id);
+ sendNetworkEventToPlayer("vrr.syncElement", client, element.id);
}
// ===========================================================================
function sendPlayerPedPartsAndProps(client) {
- let bodyParts = getPlayerCurrentSubAccount(client).bodyParts;
- let bodyProps = getPlayerCurrentSubAccount(client).bodyProps;
+ 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 forcePlayerWantedLevel(client, wantedLevel) {
- sendNetworkEventToPlayer("vrr.wantedLevel", client, wantedLevel);
- return true;
+ 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);
+ 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);
- }
- }
- }
+ 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);
- }
+ if (getGlobalConfig().useServerSideVehiclePurchaseCheck == false) {
+ sendNetworkEventToPlayer("vrr.vehBuyState", client, state, vehicleId, position);
+ }
}
// ==========================================================================
function receiveVehiclePurchaseStateUpdateFromClient(client, state) {
- if(getGlobalConfig().useServerSideVehiclePurchaseCheck == false) {
- checkVehicleBuying(client);
- }
+ if (getGlobalConfig().useServerSideVehiclePurchaseCheck == false) {
+ checkVehiclePurchasing(client);
+ }
}
// ===========================================================================
function sendPlayerLogLevel(client, tempLogLevel = logLevel) {
- sendNetworkEventToPlayer("vrr.logLevel", client, tempLogLevel);
+ sendNetworkEventToPlayer("vrr.logLevel", client, tempLogLevel);
}
// ==========================================================================
function setPlayerInfiniteRun(client, state) {
- sendNetworkEventToPlayer("vrr.infiniteRun", 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);
+ sendNetworkEventToPlayer("vrr.business", client, businessId, name, entrancePosition, blipModel, pickupModel, hasInterior, hasItems);
}
// ==========================================================================
-function sendHouseToPlayer(client, houseId, entrancePosition, blipModel, pickupModel, hasInterior) {
- sendNetworkEventToPlayer("vrr.house", client, houseId, entrancePosition, blipModel, pickupModel, hasInterior);
+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);
- }
+ 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);
- }
+ 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);
+ sendNetworkEventToPlayer("vrr.holdObject", client, getPlayerData(client).ped, modelIndex);
}
// ==========================================================================
function receivePlayerPedNetworkId(client, pedId) {
- getPlayerData(client).ped = pedId;
+ getPlayerData(client).ped = pedId;
}
// ==========================================================================
function requestPlayerPedNetworkId(client) {
- sendNetworkEventToPlayer("vrr.playerPedId", 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
diff --git a/scripts/server/command.js b/scripts/server/command.js
index 3929b641..0507d944 100644
--- a/scripts/server/command.js
+++ b/scripts/server/command.js
@@ -7,11 +7,10 @@
// TYPE: Server (JavaScript)
// ===========================================================================
-
/**
* @class Representing a command's data. Loaded and saved in the database
*/
- class CommandData {
+class CommandData {
enable() {
this.enabled = true;
}
@@ -44,599 +43,710 @@ let serverCommands = [];
// ===========================================================================
let builtInCommands = [
- "refresh",
- "restart",
- "stop",
- "start",
- "reconnect",
- "setname",
- "connect",
- "disconnect",
- "say",
- "dumpdoc",
+ "refresh",
+ "restart",
+ "stop",
+ "start",
+ "reconnect",
+ "setname",
+ "connect",
+ "disconnect",
+ "say",
+ "dumpdoc",
];
// ===========================================================================
function initCommandScript() {
- logToConsole(LOG_INFO, "[VRR.Command]: Initializing commands script ...");
- serverCommands = loadCommands();
- //addAllCommandHandlers();
- logToConsole(LOG_INFO, "[VRR.Command]: Initialized commands script!");
+ logToConsole(LOG_INFO, "[VRR.Command]: Initializing commands script ...");
+ logToConsole(LOG_INFO, "[VRR.Command]: Initialized commands script!");
}
// ===========================================================================
function loadCommands() {
- let tempCommands = {
- accent: [
- commandData("accent", setAccentCommand, "", getStaffFlagValue("None"), false, false, "Sets your character's accent"),
- commandData("accents", listAccentsCommand, "", getStaffFlagValue("None"), false, false, "Shows a list of all available accents"),
- commandData("accentlist", listAccentsCommand, "", getStaffFlagValue("None"), false, false, "Shows a list of all available accents"),
- ],
- account: [
- commandData("login", loginCommand, "", getStaffFlagValue("None"), false, false, "Login to an account"),
- commandData("register", registerCommand, "", getStaffFlagValue("None"), false, false, "Creates an account"),
- commandData("changepass", changeAccountPasswordCommand, " ", getStaffFlagValue("None"), true, false, "Change an account password"),
- commandData("iplogin", toggleAutoLoginByIPCommand, "", getStaffFlagValue("None"), true, false, "Toggle whether to automatically login if you join with the same IP as your last join"),
- commandData("autolastchar", toggleAutoSelectLastCharacterCommand, "", getStaffFlagValue("None"), true, false, "Toggle whether to automatically spawn with the last character you played as"),
- commandData("gui", toggleAccountGUICommand, "", getStaffFlagValue("None"), false, false, "Toggle whether to use GUI. If GUI is disabled on the server, it won't show even if you have GUI enabled."),
- commandData("2fa", toggleAccountTwoFactorAuthCommand, "", getStaffFlagValue("None"), true, false, "Set up and use two-factor authentication."),
- commandData("setemail", setAccountEmailCommand, "", getStaffFlagValue("None"), true, false, "Sets your email. To reset your password, you must have a valid email set and verified."),
- commandData("verifyemail", verifyAccountEmailCommand, "", getStaffFlagValue("None"), true, false, "Confirms/verifies your email."),
- //commandData("setdiscord", setAccountDiscordCommand, "", getStaffFlagValue("None"), true, false, "Set up the integration for discord. Allows you to see info and use in-game commands on discord."),
- commandData("notips", toggleNoRandomTipsCommand, "", getStaffFlagValue("None"), true, false, "Turn on and off random tips"),
- commandData("loginalert", toggleAccountLoginAttemptNotificationsCommand, "", getStaffFlagValue("None"), true, false, "Turn on and off email notifications for attempts to login to your account"),
- commandData("scrolllines", setAccountChatScrollLinesCommand, "", getStaffFlagValue("None"), true, false, "Sets how many chatbox lines to scroll at a time when using pageup/pagedown"),
+ let tempCommands = {
+ accent: [
+ new CommandData("accent", setAccentCommand, "", getStaffFlagValue("None"), false, false, "Sets your character's accent"),
+ new CommandData("accents", listAccentsCommand, "", getStaffFlagValue("None"), false, false, "Shows a list of all available accents"),
+ new CommandData("accentlist", listAccentsCommand, "", getStaffFlagValue("None"), false, false, "Shows a list of all available accents"),
+ ],
+ account: [
+ new CommandData("login", loginCommand, "", getStaffFlagValue("None"), false, false, "Login to an account"),
+ new CommandData("register", registerCommand, "", getStaffFlagValue("None"), false, false, "Creates an account"),
+ new CommandData("changepass", changeAccountPasswordCommand, " ", getStaffFlagValue("None"), true, false, "Change an account password"),
+ new CommandData("iplogin", toggleAutoLoginByIPCommand, "", getStaffFlagValue("None"), true, false, "Toggle whether to automatically login if you join with the same IP as your last join"),
+ new CommandData("gui", toggleAccountGUICommand, "", getStaffFlagValue("None"), false, false, "Toggle whether to use GUI. If GUI is disabled on the server, it won't show even if you have GUI enabled."),
+ new CommandData("2fa", toggleAccountTwoFactorAuthCommand, "", getStaffFlagValue("None"), true, false, "Set up and use two-factor authentication."),
+ new CommandData("setemail", setAccountEmailCommand, "", getStaffFlagValue("None"), true, false, "Sets your email. To reset your password, you must have a valid email set and verified."),
+ new CommandData("verifyemail", verifyAccountEmailCommand, "", getStaffFlagValue("None"), true, false, "Confirms/verifies your email."),
+ //new CommandData("setdiscord", setAccountDiscordCommand, "", getStaffFlagValue("None"), true, false, "Set up the integration for discord. Allows you to see info and use in-game commands on discord."),
+ new CommandData("notips", toggleNoRandomTipsCommand, "", getStaffFlagValue("None"), true, false, "Turn on and off random tips"),
+ new CommandData("loginalert", toggleAccountLoginAttemptNotificationsCommand, "", getStaffFlagValue("None"), true, false, "Turn on and off email notifications for attempts to login to your account"),
+ new CommandData("scrolllines", setAccountChatScrollLinesCommand, "", getStaffFlagValue("None"), true, false, "Sets how many chatbox lines to scroll at a time when using pageup/pagedown"),
+ new CommandData("chatautohide", setAccountChatAutoHideDelayCommand, "