Compare commits
36 Commits
non-server
...
separate-r
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d1b8b9524f | ||
|
|
48c9af3f52 | ||
|
|
e5375d09d7 | ||
|
|
3e4108f1ea | ||
|
|
04bd7609e1 | ||
|
|
a4fdbd1398 | ||
|
|
736b7b1e69 | ||
|
|
cb48f199c4 | ||
|
|
cd55f8dcb7 | ||
|
|
b95ca71a90 | ||
|
|
dbd8babf82 | ||
|
|
4082357026 | ||
|
|
d583d17ef8 | ||
|
|
5af8770b9c | ||
|
|
7a8bdcf0bd | ||
|
|
c9ea8fe444 | ||
|
|
93ead8d123 | ||
|
|
f14c51dba4 | ||
|
|
06409be232 | ||
|
|
c96f1063ad | ||
|
|
ac1de36123 | ||
|
|
f9d462bc07 | ||
|
|
bafacb0423 | ||
|
|
504fb46c28 | ||
|
|
1023345e01 | ||
|
|
b435043313 | ||
|
|
0f3eddecc0 | ||
|
|
27687c76e7 | ||
|
|
62d9118604 | ||
|
|
31dbde51bd | ||
|
|
fe17137940 | ||
|
|
cd322adeaa | ||
|
|
5f208c424b | ||
|
|
4f47b8f483 | ||
|
|
859ae28656 | ||
|
|
ef4a2877d0 |
@@ -1,112 +0,0 @@
|
||||
[
|
||||
{
|
||||
"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"
|
||||
}
|
||||
]
|
||||
@@ -1,117 +0,0 @@
|
||||
{
|
||||
"apiEmail": "example@example.com",
|
||||
"defaultLanguageId": 0,
|
||||
"translateURL": "http://api.mymemory.translated.net/get?de={3}&q={0}&langpair={1}|{2}",
|
||||
"locales": [
|
||||
{
|
||||
"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"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
Before Width: | Height: | Size: 35 KiB |
|
Before Width: | Height: | Size: 109 KiB |
|
Before Width: | Height: | Size: 76 KiB |
|
Before Width: | Height: | Size: 289 KiB |
|
Before Width: | Height: | Size: 76 KiB |
|
Before Width: | Height: | Size: 77 KiB |
|
Before Width: | Height: | Size: 101 KiB |
|
Before Width: | Height: | Size: 76 KiB |
|
Before Width: | Height: | Size: 75 KiB |
|
Before Width: | Height: | Size: 269 KiB |
|
Before Width: | Height: | Size: 117 KiB |
|
Before Width: | Height: | Size: 88 KiB |
|
Before Width: | Height: | Size: 23 KiB |
|
Before Width: | Height: | Size: 42 KiB |
|
Before Width: | Height: | Size: 56 KiB |
|
Before Width: | Height: | Size: 3.9 KiB |
133
meta.xml
@@ -15,7 +15,6 @@
|
||||
<script src="scripts/client/native/connected.js" type="client" language="javascript" />
|
||||
|
||||
<!-- Server Scripts -->
|
||||
<script src="scripts/server/class.js" type="server" language="javascript" />
|
||||
<script src="scripts/server/accent.js" type="server" language="javascript" />
|
||||
<script src="scripts/server/account.js" type="server" language="javascript" />
|
||||
<script src="scripts/server/animation.js" type="server" language="javascript" />
|
||||
@@ -25,8 +24,7 @@
|
||||
<script src="scripts/server/business.js" type="server" language="javascript" />
|
||||
<script src="scripts/server/chat.js" type="server" language="javascript" />
|
||||
<script src="scripts/server/clan.js" type="server" language="javascript" />
|
||||
<script src="scripts/server/client.js" type="server" language="javascript" />
|
||||
<script src="scripts/server/const.js" type="server" language="javascript" />
|
||||
<script src="scripts/server/crime.js" type="server" language="javascript" />
|
||||
<script src="scripts/server/database.js" type="server" language="javascript" />
|
||||
<script src="scripts/server/developer.js" type="server" language="javascript" />
|
||||
<script src="scripts/server/discord.js" type="server" language="javascript" />
|
||||
@@ -34,10 +32,13 @@
|
||||
<script src="scripts/server/email.js" type="server" language="javascript" />
|
||||
<script src="scripts/server/event.js" type="server" language="javascript" />
|
||||
<script src="scripts/server/fishing.js" type="server" language="javascript" />
|
||||
<script src="scripts/server/forensics.js" type="server" language="javascript" />
|
||||
<script src="scripts/server/gate.js" type="server" language="javascript" />
|
||||
<script src="scripts/server/gps.js" type="server" language="javascript" />
|
||||
<script src="scripts/server/gui.js" type="server" language="javascript" />
|
||||
<script src="scripts/server/help.js" type="server" language="javascript" />
|
||||
<script src="scripts/server/house.js" type="server" language="javascript" />
|
||||
<script src="scripts/server/insurance.js" type="server" language="javascript" />
|
||||
<script src="scripts/server/item.js" type="server" language="javascript" />
|
||||
<script src="scripts/server/job.js" type="server" language="javascript" />
|
||||
<script src="scripts/server/keybind.js" type="server" language="javascript" />
|
||||
@@ -45,9 +46,9 @@
|
||||
<script src="scripts/server/messaging.js" type="server" language="javascript" />
|
||||
<script src="scripts/server/misc.js" type="server" language="javascript" />
|
||||
<script src="scripts/server/npc.js" type="server" language="javascript" />
|
||||
<script src="scripts/server/netevents.js" type="server" language="javascript" />
|
||||
<script src="scripts/server/race.js" type="server" language="javascript" />
|
||||
<script src="scripts/server/radio.js" type="server" language="javascript" />
|
||||
<script src="scripts/server/radio.js" type="server" language="javascript" />
|
||||
<script src="scripts/server/security.js" type="server" language="javascript" />
|
||||
<script src="scripts/server/staff.js" type="server" language="javascript" />
|
||||
<script src="scripts/server/subaccount.js" type="server" language="javascript" />
|
||||
@@ -78,150 +79,28 @@
|
||||
<script src="scripts/server/item/rope.js" type="server" language="javascript" />
|
||||
<script src="scripts/server/item/tazer.js" type="server" language="javascript" />
|
||||
|
||||
<!-- Extra Client Files -->
|
||||
<file type="client" src="files/fonts/roboto-regular.ttf" />
|
||||
<file type="client" src="files/fonts/pricedown.ttf" />
|
||||
<file type="client" src="files/images/skins/none.png" />
|
||||
<file type="client" src="files/images/mafiac-logo.png" />
|
||||
<file type="client" src="files/images/gtac-logo.png" />
|
||||
<file type="client" src="files/images/asshat-logo.png" />
|
||||
|
||||
<!-- Locale Files -->
|
||||
<file type="client" src="config/client/locale.json" />
|
||||
<file type="client" src="locale/english.json" />
|
||||
<file type="client" src="locale/russian.json" />
|
||||
<file type="client" src="locale/polish.json" />
|
||||
<file type="client" src="locale/spanish.json" />
|
||||
<file type="client" src="locale/french.json" />
|
||||
<file type="client" src="locale/japanese.json" />
|
||||
<file type="client" src="locale/german.json" />
|
||||
<file type="client" src="locale/slovak.json" />
|
||||
<file type="client" src="locale/finnish.json" />
|
||||
<file type="client" src="locale/chinese.json" />
|
||||
<file type="client" src="locale/arabic.json" />
|
||||
|
||||
<!-- International Flag Images -->
|
||||
<file type="client" src="files/images/flags/uk.png" />
|
||||
<file type="client" src="files/images/flags/de.png" />
|
||||
<file type="client" src="files/images/flags/fr.png" />
|
||||
<file type="client" src="files/images/flags/pl.png" />
|
||||
<file type="client" src="files/images/flags/es.png" />
|
||||
<file type="client" src="files/images/flags/jp.png" />
|
||||
<file type="client" src="files/images/flags/sk.png" />
|
||||
<file type="client" src="files/images/flags/sa.png" />
|
||||
<file type="client" src="files/images/flags/cn.png" />
|
||||
<file type="client" src="files/images/flags/fi.png" />
|
||||
<file type="client" src="files/images/flags/ru.png" />
|
||||
|
||||
<!-- GUI -->
|
||||
<script src="scripts/client/gui/login.js" type="client" language="javascript" />
|
||||
<script src="scripts/client/gui/newchar.js" type="client" language="javascript" />
|
||||
<script src="scripts/client/gui/charselect.js" type="client" language="javascript" />
|
||||
<script src="scripts/client/gui/error.js" type="client" language="javascript" />
|
||||
<script src="scripts/client/gui/info.js" type="client" language="javascript" />
|
||||
<script src="scripts/client/gui/yesno.js" type="client" language="javascript" />
|
||||
<script src="scripts/client/gui/register.js" type="client" language="javascript" />
|
||||
<script src="scripts/client/gui/resetpass.js" type="client" language="javascript" />
|
||||
<script src="scripts/client/gui/changepass.js" type="client" language="javascript" />
|
||||
<script src="scripts/client/gui/clanmgr.js" type="client" language="javascript" />
|
||||
<script src="scripts/client/gui/housemgr.js" type="client" language="javascript" />
|
||||
<script src="scripts/client/gui/bizmgr.js" type="client" language="javascript" />
|
||||
<script src="scripts/client/gui/2fa.js" type="client" language="javascript" />
|
||||
<script src="scripts/client/gui/list.js" type="client" language="javascript" />
|
||||
<script src="scripts/client/gui/localechooser.js" type="client" language="javascript" />
|
||||
|
||||
<!-- Client Scripts -->
|
||||
<script src="scripts/client/afk.js" type="client" language="javascript" />
|
||||
<script src="scripts/client/animation.js" type="client" language="javascript" />
|
||||
<script src="scripts/client/business.js" type="client" language="javascript" />
|
||||
<script src="scripts/client/chatbox.js" type="client" language="javascript" />
|
||||
<script src="scripts/client/event.js" type="client" language="javascript" />
|
||||
<script src="scripts/client/gui.js" type="client" language="javascript" />
|
||||
<script src="scripts/client/gps.js" type="client" language="javascript" />
|
||||
<script src="scripts/client/house.js" type="client" language="javascript" />
|
||||
<script src="scripts/client/item.js" type="client" language="javascript" />
|
||||
<script src="scripts/client/job.js" type="client" language="javascript" />
|
||||
<script src="scripts/client/keybind.js" type="client" language="javascript" />
|
||||
<script src="scripts/client/label.js" type="client" language="javascript" />
|
||||
<script src="scripts/client/locale.js" type="client" language="javascript" />
|
||||
<script src="scripts/client/logo.js" type="client" language="javascript" />
|
||||
<script src="scripts/client/main.js" type="client" language="javascript" />
|
||||
<script src="scripts/client/messaging.js" type="client" language="javascript" />
|
||||
<script src="scripts/client/mousecam.js" type="client" language="javascript" />
|
||||
<script src="scripts/client/nametag.js" type="client" language="javascript" />
|
||||
<script src="scripts/client/npc.js" type="client" language="javascript" />
|
||||
<script src="scripts/client/radio.js" type="client" language="javascript" />
|
||||
<script src="scripts/client/scoreboard.js" type="client" language="javascript" />
|
||||
<script src="scripts/client/server.js" type="client" language="javascript" />
|
||||
<script src="scripts/client/netevents.js" type="client" language="javascript" />
|
||||
<script src="scripts/client/skin-select.js" type="client" language="javascript" />
|
||||
<script src="scripts/client/sync.js" type="client" language="javascript" />
|
||||
<script src="scripts/client/utilities.js" type="client" language="javascript" />
|
||||
<script src="scripts/client/vehicle.js" type="client" language="javascript" />
|
||||
|
||||
<!-- MexUI -->
|
||||
<file type="client" src="third-party/mexui/Images/down-arrow.png" />
|
||||
<script language="javascript" type="client" src="third-party/mexui/mexui.js" />
|
||||
<script language="javascript" type="client" src="third-party/mexui/Core/Native.js" />
|
||||
<script language="javascript" type="client" src="third-party/mexui/Core/Utility.js" />
|
||||
<script language="javascript" type="client" src="third-party/mexui/Core/Entity/Transition.js" />
|
||||
<script language="javascript" type="client" src="third-party/mexui/Core/Entity/StyleableEntity.js" />
|
||||
<script language="javascript" type="client" src="third-party/mexui/Core/Entity/Component.js" />
|
||||
<script language="javascript" type="client" src="third-party/mexui/Core/Component/Control.js" />
|
||||
<script language="javascript" type="client" src="third-party/mexui/Core/Component/Entry.js" />
|
||||
<script language="javascript" type="client" src="third-party/mexui/Core/Component/Event.js" />
|
||||
<script language="javascript" type="client" src="third-party/mexui/Core/Component/Window.js" />
|
||||
<script language="javascript" type="client" src="third-party/mexui/Core/Entity/ControlAxis.js" />
|
||||
<script language="javascript" type="client" src="third-party/mexui/Core/Entity/ControlWithEntries.js" />
|
||||
<script language="javascript" type="client" src="third-party/mexui/Core/Entry/DropDownItem.js" />
|
||||
<script language="javascript" type="client" src="third-party/mexui/Core/Entry/GridColumn.js" />
|
||||
<script language="javascript" type="client" src="third-party/mexui/Core/Entry/GridRow.js" />
|
||||
<script language="javascript" type="client" src="third-party/mexui/Core/Entry/ListRow.js" />
|
||||
<script language="javascript" type="client" src="third-party/mexui/Core/Entry/Tab.js" />
|
||||
<script language="javascript" type="client" src="third-party/mexui/Core/Entry/TreeRow.js" />
|
||||
<script language="javascript" type="client" src="third-party/mexui/Core/Control/Button.js" />
|
||||
<script language="javascript" type="client" src="third-party/mexui/Core/Control/CheckBox.js" />
|
||||
<script language="javascript" type="client" src="third-party/mexui/Core/Control/DropDown.js" />
|
||||
<script language="javascript" type="client" src="third-party/mexui/Core/Control/Grid.js" />
|
||||
<script language="javascript" type="client" src="third-party/mexui/Core/Control/Image.js" />
|
||||
<script language="javascript" type="client" src="third-party/mexui/Core/Control/Line.js" />
|
||||
<script language="javascript" type="client" src="third-party/mexui/Core/Control/List.js" />
|
||||
<script language="javascript" type="client" src="third-party/mexui/Core/Control/ProgressBar.js" />
|
||||
<script language="javascript" type="client" src="third-party/mexui/Core/Control/RadioButton.js" />
|
||||
<script language="javascript" type="client" src="third-party/mexui/Core/Control/Rectangle.js" />
|
||||
<script language="javascript" type="client" src="third-party/mexui/Core/Control/ScrollBar.js" />
|
||||
<script language="javascript" type="client" src="third-party/mexui/Core/Control/Slider.js" />
|
||||
<script language="javascript" type="client" src="third-party/mexui/Core/Control/TabPanel.js" />
|
||||
<script language="javascript" type="client" src="third-party/mexui/Core/Control/Text.js" />
|
||||
<script language="javascript" type="client" src="third-party/mexui/Core/Control/TextInput.js" />
|
||||
<script language="javascript" type="client" src="third-party/mexui/Core/Control/Tree.js" />
|
||||
<script language="javascript" type="client" src="third-party/mexui/Core/Control/Character.js" />
|
||||
<script language="javascript" type="client" src="third-party/mexui/Core/Control/Characters.js" />
|
||||
<script language="javascript" type="client" src="third-party/mexui/Core/Control/Day.js" />
|
||||
<script language="javascript" type="client" src="third-party/mexui/Core/Control/Date.js" />
|
||||
<script language="javascript" type="client" src="third-party/mexui/Core/Control/Digit.js" />
|
||||
<script language="javascript" type="client" src="third-party/mexui/Core/Control/Digits.js" />
|
||||
<script language="javascript" type="client" src="third-party/mexui/Core/Control/Hour.js" />
|
||||
<script language="javascript" type="client" src="third-party/mexui/Core/Control/Integer.js" />
|
||||
<script language="javascript" type="client" src="third-party/mexui/Core/Control/Letter.js" />
|
||||
<script language="javascript" type="client" src="third-party/mexui/Core/Control/LetterDigit.js" />
|
||||
<script language="javascript" type="client" src="third-party/mexui/Core/Control/Letters.js" />
|
||||
<script language="javascript" type="client" src="third-party/mexui/Core/Control/LettersDigits.js" />
|
||||
<script language="javascript" type="client" src="third-party/mexui/Core/Control/Minute.js" />
|
||||
<script language="javascript" type="client" src="third-party/mexui/Core/Control/Month.js" />
|
||||
<script language="javascript" type="client" src="third-party/mexui/Core/Control/Number.js" />
|
||||
<script language="javascript" type="client" src="third-party/mexui/Core/Control/Password.js" />
|
||||
<script language="javascript" type="client" src="third-party/mexui/Core/Control/PositiveInteger.js" />
|
||||
<script language="javascript" type="client" src="third-party/mexui/Core/Control/PositiveNumber.js" />
|
||||
<script language="javascript" type="client" src="third-party/mexui/Core/Control/RangedInteger.js" />
|
||||
<script language="javascript" type="client" src="third-party/mexui/Core/Control/RangedNumber.js" />
|
||||
<script language="javascript" type="client" src="third-party/mexui/Core/Control/Second.js" />
|
||||
<script language="javascript" type="client" src="third-party/mexui/Core/Control/TextArea.js" />
|
||||
<script language="javascript" type="client" src="third-party/mexui/Core/Control/Time.js" />
|
||||
<script language="javascript" type="client" src="third-party/mexui/Core/Control/Week.js" />
|
||||
<script language="javascript" type="client" src="third-party/mexui/Core/Control/WeekDay.js" />
|
||||
<script language="javascript" type="client" src="third-party/mexui/Core/Control/Year.js" />
|
||||
<script language="javascript" type="client" src="third-party/mexui/Core/Init.js" />
|
||||
|
||||
<!-- Startup -->
|
||||
<script src="scripts/server/startup.js" type="server" language="javascript" />
|
||||
<script src="scripts/client/startup.js" type="client" language="javascript" />
|
||||
|
||||
@@ -79,11 +79,11 @@ function onResourceReady(event, resource) {
|
||||
// ===========================================================================
|
||||
|
||||
function onProcess(event, deltaTime) {
|
||||
if(localPlayer == null) {
|
||||
if (localPlayer == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!isSpawned) {
|
||||
if (!isSpawned) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -109,28 +109,22 @@ function onProcess(event, deltaTime) {
|
||||
function onKeyUp(event, keyCode, scanCode, keyModifiers) {
|
||||
processSkinSelectKeyPress(keyCode);
|
||||
//processKeyDuringAnimation();
|
||||
processGUIKeyPress(keyCode);
|
||||
processToggleGUIKeyPress(keyCode);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function onDrawnHUD(event) {
|
||||
if(!renderHUD) {
|
||||
if (!renderHUD) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if(localPlayer == null) {
|
||||
if (localPlayer == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
processSmallGameMessageRendering();
|
||||
processScoreBoardRendering();
|
||||
processLabelRendering();
|
||||
processLogoRendering();
|
||||
processItemActionRendering();
|
||||
processSkinSelectRendering();
|
||||
processNameTagRendering();
|
||||
processInteriorLightsRendering();
|
||||
}
|
||||
|
||||
@@ -151,9 +145,9 @@ function onElementStreamIn(event, element) {
|
||||
|
||||
function onLocalPlayerExitedVehicle(event, vehicle, seat) {
|
||||
logToConsole(LOG_DEBUG, `[VRR.Event] Local player exited vehicle`);
|
||||
sendNetworkEventToServer("vrr.onPlayerExitVehicle", getVehicleForNetworkEvent(vehicle), seat);
|
||||
sendNetworkEventToServer("agrp.onPlayerExitVehicle", getVehicleForNetworkEvent(vehicle), seat);
|
||||
|
||||
if(inVehicleSeat) {
|
||||
if (inVehicleSeat) {
|
||||
parkedVehiclePosition = false;
|
||||
parkedVehicleHeading = false;
|
||||
}
|
||||
@@ -164,8 +158,9 @@ function onLocalPlayerExitedVehicle(event, vehicle, seat) {
|
||||
function onLocalPlayerEnteredVehicle(event, vehicle, seat) {
|
||||
logToConsole(LOG_DEBUG, `[VRR.Event] Local player entered vehicle`);
|
||||
|
||||
sendNetworkEventToServer("vrr.onPlayerEnterVehicle", getVehicleForNetworkEvent(vehicle), seat);
|
||||
sendNetworkEventToServer("agrp.onPlayerEnterVehicle", getVehicleForNetworkEvent(vehicle), seat);
|
||||
|
||||
//if (areServerElementsSupported()) {
|
||||
//if(inVehicleSeat == 0) {
|
||||
//setVehicleEngine(vehicle, false);
|
||||
//if(!inVehicle.engine) {
|
||||
@@ -173,6 +168,7 @@ function onLocalPlayerEnteredVehicle(event, vehicle, seat) {
|
||||
// parkedVehicleHeading = inVehicle.heading;
|
||||
//}
|
||||
//}
|
||||
//}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -181,12 +177,12 @@ function onPedInflictDamage(event, damagedEntity, damagerEntity, weaponId, healt
|
||||
//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 (!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);
|
||||
sendNetworkEventToServer("agrp.weaponDamage", damagerEntity.name, weaponId, pedPiece, healthLoss);
|
||||
//}
|
||||
}
|
||||
}
|
||||
@@ -197,7 +193,7 @@ function onPedInflictDamage(event, damagedEntity, damagerEntity, weaponId, healt
|
||||
|
||||
function onLocalPlayerEnterSphere(event, sphere) {
|
||||
logToConsole(LOG_DEBUG, `[VRR.Event] Local player entered sphere`);
|
||||
if(sphere == jobRouteLocationSphere) {
|
||||
if (sphere == jobRouteLocationSphere) {
|
||||
enteredJobRouteSphere();
|
||||
}
|
||||
}
|
||||
@@ -241,7 +237,7 @@ function onMouseWheel(event, mouseId, deltaCoordinates, flipped) {
|
||||
// ===========================================================================
|
||||
|
||||
function onEntityProcess(event, entity) {
|
||||
if(!isSpawned) {
|
||||
if (!isSpawned) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,283 +0,0 @@
|
||||
// ===========================================================================
|
||||
// Vortrex's Roleplay Resource
|
||||
// https://github.com/VortrexFTW/gtac_roleplay
|
||||
// ===========================================================================
|
||||
// FILE: gui.js
|
||||
// DESC: Provides GUI functionality and styles (using MexUI)
|
||||
// TYPE: Client (JavaScript)
|
||||
// ===========================================================================
|
||||
|
||||
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/asshat-logo.png";
|
||||
|
||||
let primaryColour = [200, 200, 200];
|
||||
let secondaryColour = [16, 16, 16];
|
||||
let primaryTextColour = [0, 0, 0];
|
||||
let focusedColour = [200, 200, 200];
|
||||
let invalidValueColour = [200, 200, 200];
|
||||
|
||||
let focusedColourOffset = 50;
|
||||
|
||||
let windowAlpha = 200;
|
||||
let windowTitleAlpha = 180;
|
||||
let buttonAlpha = 180;
|
||||
let textInputAlpha = 180;
|
||||
|
||||
let guiReady = false;
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
let characterData = [];
|
||||
let currentCharacter = 0;
|
||||
|
||||
let inCharacterSelectScreen = false;
|
||||
let creatingCharacter = false;
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function initGUIScript() {
|
||||
logToConsole(LOG_DEBUG, "[VRR.GUI]: Initializing GUI script ...");
|
||||
logToConsole(LOG_DEBUG, "[VRR.GUI]: GUI script initialized!");
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function initGUI() {
|
||||
logToConsole(LOG_DEBUG, `[VRR.GUI] Initializing GUI ...`);
|
||||
|
||||
initLoginGUI();
|
||||
initRegisterGUI();
|
||||
initNewCharacterGUI();
|
||||
initCharacterSelectGUI();
|
||||
initInfoDialogGUI();
|
||||
initErrorDialogGUI();
|
||||
initYesNoDialogGUI();
|
||||
initTwoFactorAuthenticationGUI();
|
||||
initListGUI();
|
||||
initResetPasswordGUI();
|
||||
initChangePasswordGUI();
|
||||
initLocaleChooserGUI();
|
||||
|
||||
closeAllWindows();
|
||||
guiReady = true;
|
||||
|
||||
logToConsole(LOG_DEBUG, `[VRR.GUI] All GUI created successfully!`);
|
||||
|
||||
loadLocaleConfig();
|
||||
loadAllLocaleStrings();
|
||||
|
||||
resetGUIStrings();
|
||||
resetLocaleChooserOptions();
|
||||
|
||||
sendNetworkEventToServer("vrr.guiReady", true);
|
||||
};
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function closeAllWindows() {
|
||||
logToConsole(LOG_DEBUG, `[VRR.GUI] Closing all GUI windows`);
|
||||
infoDialog.window.shown = false;
|
||||
yesNoDialog.window.shown = false;
|
||||
errorDialog.window.shown = false;
|
||||
register.window.shown = false;
|
||||
login.window.shown = false;
|
||||
newCharacter.window.shown = false;
|
||||
characterSelect.window.shown = false;
|
||||
twoFactorAuth.window.shown = false;
|
||||
listDialog.window.shown = false;
|
||||
passwordReset.window.shown = false;
|
||||
passwordChange.window.shown = false;
|
||||
localeChooser.window.shown = false;
|
||||
|
||||
mexui.setInput(false);
|
||||
mexui.focusedControl = false;
|
||||
|
||||
guiSubmitKey = false;
|
||||
guiLeftKey = false;
|
||||
guiRightKey = false;
|
||||
guiUpKey = false;
|
||||
guiDownKey = false;
|
||||
|
||||
setChatWindowEnabled(true);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function isAnyGUIActive() {
|
||||
if (!guiReady) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (infoDialog.window.shown == true) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (yesNoDialog.window.shown == true) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (errorDialog.window.shown == true) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (register.window.shown == true) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (login.window.shown == true) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (newCharacter.window.shown == true) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (characterSelect.window.shown == true) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (twoFactorAuth.window.shown == true) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (listDialog.window.shown == true) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (passwordReset.window.shown == true) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (passwordChange.window.shown == true) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (localeChooser.window.shown == true) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
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];
|
||||
|
||||
initGUI();
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function hideAllGUI() {
|
||||
closeAllWindows();
|
||||
setChatWindowEnabled(true);
|
||||
guiSubmitKey = false;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function processGUIKeyPress(keyCode) {
|
||||
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) {
|
||||
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")) {
|
||||
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")) {
|
||||
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")) {
|
||||
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")) {
|
||||
logToConsole(LOG_DEBUG, `[VRR.GUI] Key press is up (${guiUpKey})`);
|
||||
if (guiUpKey != false) {
|
||||
logToConsole(LOG_DEBUG, `[VRR.GUI] Calling up key function`);
|
||||
guiUpKey.call();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function processToggleGUIKeyPress(keyCode) {
|
||||
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"));
|
||||
}
|
||||
@@ -1,135 +0,0 @@
|
||||
// ===========================================================================
|
||||
// Vortrex's Roleplay Resource
|
||||
// https://github.com/VortrexFTW/gtac_roleplay
|
||||
// ===========================================================================
|
||||
// FILE: 2fa.js
|
||||
// DESC: Provides two factor authentication GUI
|
||||
// TYPE: Client (JavaScript)
|
||||
// ===========================================================================
|
||||
|
||||
let twoFactorAuth = {
|
||||
window: null,
|
||||
logoImage: null,
|
||||
qrCode: null,
|
||||
messageLabel: null,
|
||||
codeLabel: null,
|
||||
codeInput: null,
|
||||
submitButton: null,
|
||||
};
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function initTwoFactorAuthenticationGUI() {
|
||||
logToConsole(LOG_DEBUG, `[VRR.GUI] Creating two factor auth GUI ...`);
|
||||
twoFactorAuth.window = mexui.window(game.width/2-150, game.height/2-129, 300, 258, 'LOGIN', {
|
||||
main: {
|
||||
backgroundColour: toColour(secondaryColour[0], secondaryColour[1], secondaryColour[2], windowAlpha),
|
||||
transitionTime: 500,
|
||||
},
|
||||
title: {
|
||||
textSize: 0.0,
|
||||
textColour: toColour(0, 0, 0, 0),
|
||||
},
|
||||
icon: {
|
||||
textSize: 0.0,
|
||||
textColour: toColour(0, 0, 0, 0),
|
||||
},
|
||||
focused: {
|
||||
borderColour: toColour(0, 0, 0, 0),
|
||||
},
|
||||
});
|
||||
twoFactorAuth.window.titleBarIconSize = toVector2(0,0);
|
||||
twoFactorAuth.window.titleBarHeight = 0;
|
||||
|
||||
twoFactorAuth.qrCode = twoFactorAuth.window.image(100, 20, 100, 100, mainLogoPath, {
|
||||
focused: {
|
||||
borderColour: toColour(0, 0, 0, 0),
|
||||
},
|
||||
});
|
||||
|
||||
twoFactorAuth.codeLabel = twoFactorAuth.window.text(20, 135, 260, 20, 'Please enter the code sent to your email!', {
|
||||
main: {
|
||||
textSize: 10.0,
|
||||
textAlign: 0.5,
|
||||
textColour: toColour(200, 200, 200, 255),
|
||||
textFont: mainFont,
|
||||
},
|
||||
focused: {
|
||||
borderColour: toColour(0, 0, 0, 0),
|
||||
},
|
||||
});
|
||||
|
||||
twoFactorAuth.codeInput = twoFactorAuth.window.textInput(20, 170, 260, 25, '', {
|
||||
main: {
|
||||
backgroundColour: toColour(0, 0, 0, 120),
|
||||
borderColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], textInputAlpha),
|
||||
textColour: toColour(200, 200, 200, 255),
|
||||
textSize: 10.0,
|
||||
textFont: mainFont,
|
||||
},
|
||||
caret: {
|
||||
lineColour: toColour(255, 255, 255, 255),
|
||||
},
|
||||
placeholder: {
|
||||
textColour: toColour(200, 200, 200, 150),
|
||||
textSize: 10.0,
|
||||
textFont: mainFont,
|
||||
},
|
||||
focused: {
|
||||
borderColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], 255),
|
||||
},
|
||||
});
|
||||
twoFactorAuth.codeInput.placeholder = "Code";
|
||||
|
||||
twoFactorAuth.submitButton = twoFactorAuth.window.button(20, 205, 260, 30, 'SUBMIT', {
|
||||
main: {
|
||||
backgroundColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], buttonAlpha),
|
||||
textColour: toColour(0, 0, 0, 255),
|
||||
textSize: 10.0,
|
||||
textFont: mainFont,
|
||||
textAlign: 0.5,
|
||||
},
|
||||
focused: {
|
||||
borderColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], buttonAlpha),
|
||||
},
|
||||
}, checkTwoFactorAuth);
|
||||
|
||||
logToConsole(LOG_DEBUG, `[VRR.GUI] Created two factor auth GUI`);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function showTwoFactorAuthGUI() {
|
||||
closeAllWindows();
|
||||
logToConsole(LOG_DEBUG, `[VRR.GUI] Showing two-factor authentication window`);
|
||||
setChatWindowEnabled(false);
|
||||
mexui.setInput(true);
|
||||
twoFactorAuth.window.shown = true;
|
||||
mexui.focusedControl = twoFactorAuth.codeInput;
|
||||
guiSubmitKey = checkTwoFactorAuth;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function twoFactorAuthFailed(errorMessage) {
|
||||
logToConsole(LOG_DEBUG, `[VRR.GUI] Server reports two-factor authentication failed. Reason: ${errorMessage}`);
|
||||
twoFactorAuth.messageLabel.text = errorMessage;
|
||||
twoFactorAuth.messageLabel.styles.main.textColour = toColour(180, 32, 32, 255);
|
||||
twoFactorAuth.codeInput.text = "";
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function twoFactorAuthSuccess() {
|
||||
logToConsole(LOG_DEBUG, `[VRR.GUI] Server reports two-factor authentication was successful`);
|
||||
closeAllWindows();
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function checkTwoFactorAuth() {
|
||||
logToConsole(LOG_DEBUG, `[VRR.GUI] Checking two-factor authentication with server ...`);
|
||||
sendNetworkEventToServer("vrr.2fa", twoFactorAuth.codeInput.lines[0]);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -1,8 +0,0 @@
|
||||
// ===========================================================================
|
||||
// Vortrex's Roleplay Resource
|
||||
// https://github.com/VortrexFTW/gtac_roleplay
|
||||
// ===========================================================================
|
||||
// FILE: bizmgr.js
|
||||
// DESC: Provides business manager GUI
|
||||
// TYPE: Client (JavaScript)
|
||||
// ===========================================================================
|
||||
@@ -1,157 +0,0 @@
|
||||
// ===========================================================================
|
||||
// Vortrex's Roleplay Resource
|
||||
// https://github.com/VortrexFTW/gtac_roleplay
|
||||
// ===========================================================================
|
||||
// FILE: changepass.js
|
||||
// DESC: Provides change password GUI
|
||||
// TYPE: Client (JavaScript)
|
||||
// ===========================================================================
|
||||
|
||||
let passwordChange = {
|
||||
window: null,
|
||||
logoImage: null,
|
||||
messageLabel: null,
|
||||
passwordInput: null,
|
||||
confirmPasswordInput: null,
|
||||
submitButton: null,
|
||||
};
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
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', {
|
||||
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),
|
||||
}
|
||||
});
|
||||
passwordChange.window.titleBarIconSize = toVector2(0, 0);
|
||||
passwordChange.window.titleBarHeight = 0;
|
||||
passwordChange.window.titleBarShown = false;
|
||||
|
||||
passwordChange.window.image(100, 20, 75, 75, mainLogoPath, {
|
||||
focused: {
|
||||
borderColour: toColour(0, 0, 0, 0),
|
||||
},
|
||||
});
|
||||
|
||||
passwordChange.messageLabel = passwordChange.window.text(20, 95, 260, 20, 'Enter a new password', {
|
||||
main: {
|
||||
textSize: 10.0,
|
||||
textAlign: 0.5,
|
||||
textColour: toColour(200, 200, 200, 255),
|
||||
textFont: mainFont,
|
||||
},
|
||||
focused: {
|
||||
borderColour: toColour(0, 0, 0, 0),
|
||||
},
|
||||
});
|
||||
|
||||
passwordChange.passwordInput = passwordChange.window.textInput(20, 130, 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,
|
||||
}
|
||||
});
|
||||
passwordChange.passwordInput.masked = true;
|
||||
passwordChange.passwordInput.placeholder = "Password";
|
||||
|
||||
passwordChange.confirmPasswordInput = passwordChange.window.textInput(20, 160, 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,
|
||||
}
|
||||
});
|
||||
passwordChange.confirmPasswordInput.masked = true;
|
||||
passwordChange.confirmPasswordInput.placeholder = "Confirm password";
|
||||
|
||||
passwordChange.submitButton = passwordChange.window.button(20, 195, 260, 30, 'CHANGE PASSWORD', {
|
||||
main: {
|
||||
backgroundColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], buttonAlpha),
|
||||
textColour: toColour(255, 255, 255, 255),
|
||||
textSize: 12.0,
|
||||
textFont: mainFont,
|
||||
textAlign: 0.5,
|
||||
},
|
||||
focused: {
|
||||
borderColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], buttonAlpha),
|
||||
},
|
||||
}, checkChangePassword);
|
||||
logToConsole(LOG_DEBUG, `[VRR.GUI] Created change password GUI`);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function passwordChangeFailed(errorMessage) {
|
||||
logToConsole(LOG_DEBUG, `[VRR.GUI] Server reports change password failed. Reason: ${errorMessage}`);
|
||||
passwordChange.messageLabel.text = errorMessage;
|
||||
passwordChange.messageLabel.styles.main.textColour = toColour(180, 32, 32, 255);
|
||||
passwordChange.passwordInput.text = "";
|
||||
passwordChange.confirmPasswordInput.text = "";
|
||||
passwordChange.verificationCodeInput.text = "";
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function checkChangePassword() {
|
||||
logToConsole(LOG_DEBUG, `[VRR.GUI] Checking password change with server ...`);
|
||||
sendNetworkEventToServer("vrr.checkChangePassword", passwordChange.passwordInput.lines[0], passwordChange.confirmPasswordInput.lines[0]);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
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));
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function passwordChangeSuccess() {
|
||||
logToConsole(LOG_DEBUG, `[VRR.GUI] Server reports password change was successful`);
|
||||
guiSubmitKey = false;
|
||||
closeAllWindows();
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -1,248 +0,0 @@
|
||||
// ===========================================================================
|
||||
// Vortrex's Roleplay Resource
|
||||
// https://github.com/VortrexFTW/gtac_roleplay
|
||||
// ===========================================================================
|
||||
// FILE: charselect.js
|
||||
// DESC: Provides character select GUI
|
||||
// TYPE: Client (JavaScript)
|
||||
// ===========================================================================
|
||||
|
||||
let characterSelect = {
|
||||
window: null,
|
||||
skinImage: null,
|
||||
nameText: null,
|
||||
cashText: null,
|
||||
clanText: null,
|
||||
lastPlayedText: null,
|
||||
previousCharacterButton: null,
|
||||
nextCharacterButton: null,
|
||||
selectCharacterButton: null,
|
||||
newCharacterButton: null,
|
||||
};
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
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', {
|
||||
main: {
|
||||
backgroundColour: toColour(secondaryColour[0], secondaryColour[1], secondaryColour[2], windowAlpha),
|
||||
},
|
||||
title: {
|
||||
textSize: 12.0,
|
||||
textFont: mainFont,
|
||||
textColour: toColour(0, 0, 0, 255),
|
||||
backgroundColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], windowTitleAlpha),
|
||||
},
|
||||
icon: {
|
||||
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.titleBarIconShown = false;
|
||||
characterSelect.window.titleBarHeight = 30;
|
||||
|
||||
characterSelect.nameText = characterSelect.window.text(5, 40, 200, 25, 'Lastname, Firstname', {
|
||||
main: {
|
||||
textSize: 14.0,
|
||||
textAlign: 0.0,
|
||||
textColour: toColour(255, 255, 255, 220),
|
||||
textFont: mainFont,
|
||||
},
|
||||
focused: {
|
||||
borderColour: toColour(0, 0, 0, 0),
|
||||
}
|
||||
});
|
||||
|
||||
characterSelect.cashText = characterSelect.window.text(5, 65, 200, 25, 'Cash: $0', {
|
||||
main: {
|
||||
textSize: 9.0,
|
||||
textAlign: 0.0,
|
||||
textColour: toColour(255, 255, 255, 220),
|
||||
textFont: mainFont,
|
||||
},
|
||||
focused: {
|
||||
borderColour: toColour(0, 0, 0, 0),
|
||||
}
|
||||
});
|
||||
|
||||
characterSelect.clanText = characterSelect.window.text(5, 80, 200, 25, 'Clan: None', {
|
||||
main: {
|
||||
textSize: 9.0,
|
||||
textAlign: 0.0,
|
||||
textColour: toColour(255, 255, 255, 220),
|
||||
textFont: mainFont,
|
||||
},
|
||||
focused: {
|
||||
borderColour: toColour(0, 0, 0, 0),
|
||||
}
|
||||
});
|
||||
|
||||
characterSelect.lastPlayedText = characterSelect.window.text(5, 95, 200, 25, 'Last Played: Never', {
|
||||
main: {
|
||||
textSize: 9.0,
|
||||
textAlign: 0.0,
|
||||
textColour: toColour(255, 255, 255, 220),
|
||||
textFont: mainFont,
|
||||
},
|
||||
focused: {
|
||||
borderColour: toColour(0, 0, 0, 0),
|
||||
}
|
||||
});
|
||||
|
||||
characterSelect.selectCharacterButton = characterSelect.window.button(85, 130, 260, 25, 'PLAY', {
|
||||
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], buttonAlpha),
|
||||
}
|
||||
}, selectThisCharacter);
|
||||
|
||||
characterSelect.newCharacterButton = characterSelect.window.button(5, 160, 420, 25, 'NEW CHARACTER', {
|
||||
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], buttonAlpha),
|
||||
}
|
||||
}, showNewCharacter);
|
||||
|
||||
characterSelect.previousCharacterButton = characterSelect.window.button(5, 130, 75, 25, 'PREV', {
|
||||
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], buttonAlpha),
|
||||
}
|
||||
}, selectPreviousCharacter);
|
||||
|
||||
characterSelect.nextCharacterButton = characterSelect.window.button(350, 130, 75, 25, 'NEXT', {
|
||||
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], buttonAlpha),
|
||||
}
|
||||
}, selectNextCharacter);
|
||||
|
||||
characterSelect.skinImage = characterSelect.window.image(310, 32, 100, 90, "files/images/skins/none.png", {
|
||||
focused: {
|
||||
borderColour: toColour(0, 0, 0, 0),
|
||||
}
|
||||
});
|
||||
logToConsole(LOG_DEBUG, `[VRR.GUI] Created character select GUI`);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function showCharacterSelectGUI(firstName, lastName, cash, clan, lastPlayed, skinId) {
|
||||
closeAllWindows();
|
||||
logToConsole(LOG_DEBUG, `[VRR.GUI] Showing character selection window`);
|
||||
setChatWindowEnabled(false);
|
||||
mexui.setInput(true);
|
||||
characterSelect.nameText.text = `${firstName} ${lastName}`;
|
||||
characterSelect.cashText.text = `Money: $${cash}`;
|
||||
characterSelect.clanText.text = `Clan: ${clan}`;
|
||||
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));
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function showNewCharacter() {
|
||||
closeAllWindows();
|
||||
logToConsole(LOG_DEBUG, `[VRR.GUI] Showing new character dialog window`);
|
||||
showNewCharacterGUI();
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function selectNextCharacter() {
|
||||
logToConsole(LOG_DEBUG, `[VRR.GUI] Requesting next character info from server for character select window`);
|
||||
sendNetworkEventToServer("vrr.nextCharacter");
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function selectPreviousCharacter() {
|
||||
logToConsole(LOG_DEBUG, `[VRR.GUI] Requesting previous character info from server for character select window`);
|
||||
sendNetworkEventToServer("vrr.previousCharacter");
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function selectThisCharacter() {
|
||||
logToConsole(LOG_DEBUG, `[VRR.GUI] Tell server the current shown character was selected in character select window`);
|
||||
sendNetworkEventToServer("vrr.selectCharacter");
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function switchCharacterSelectGUI(firstName, lastName, cash, clan, lastPlayed, skinId) {
|
||||
logToConsole(LOG_DEBUG, `[VRR.GUI] Updating character info with data from server`);
|
||||
setChatWindowEnabled(false);
|
||||
characterSelect.window.shown = false;
|
||||
characterSelect.nameText.text = `${firstName} ${lastName}`;
|
||||
characterSelect.cashText.text = `Money: $${cash}`;
|
||||
characterSelect.clanText.text = `Clan: ${clan}`;
|
||||
characterSelect.lastPlayedText.text = `Last Played: ${lastPlayed}`;
|
||||
|
||||
if(characterSelect.skinImage != null) {
|
||||
characterSelect.skinImage.remove();
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function characterSelectSuccess() {
|
||||
logToConsole(LOG_DEBUG, `[VRR.GUI] Server reports character selection was successful`);
|
||||
closeAllWindows();
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function getSkinImage(skinId, gameId = getGame()) {
|
||||
if(skinId < 10) {
|
||||
return `Skin_00${skinId}.png`;
|
||||
} else if(skinId > 10 && skinId < 100) {
|
||||
return `Skin_0${skinId}.png`;
|
||||
} else if(skinId > 100) {
|
||||
return `Skin_${skinId}.png`;
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -1,20 +0,0 @@
|
||||
// ===========================================================================
|
||||
// Vortrex's Roleplay Resource
|
||||
// https://github.com/VortrexFTW/gtac_roleplay
|
||||
// ===========================================================================
|
||||
// FILE: clanmgr.js
|
||||
// DESC: Provides clan manager GUI
|
||||
// TYPE: Client (JavaScript)
|
||||
// ===========================================================================
|
||||
|
||||
let clanManager = {
|
||||
window: null,
|
||||
generalTab: null,
|
||||
ranksTab: null,
|
||||
membersTab: null,
|
||||
vehiclesTab: null,
|
||||
businessesTab: null,
|
||||
housesTab: null,
|
||||
};
|
||||
|
||||
// ===========================================================================
|
||||
@@ -1,85 +0,0 @@
|
||||
// ===========================================================================
|
||||
// Vortrex's Roleplay Resource
|
||||
// https://github.com/VortrexFTW/gtac_roleplay
|
||||
// ===========================================================================
|
||||
// FILE: error.js
|
||||
// DESC: Provides error box GUI
|
||||
// TYPE: Client (JavaScript)
|
||||
// ===========================================================================
|
||||
|
||||
let errorDialog = {
|
||||
window: null,
|
||||
messageLabel: null,
|
||||
okayButton: null,
|
||||
};
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function initErrorDialogGUI() {
|
||||
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, 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 ...`);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function closeErrorDialog() {
|
||||
logToConsole(LOG_DEBUG, `[VRR.GUI] Closing error dialog`);
|
||||
errorDialog.window.shown = false;
|
||||
mexui.setInput(false);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -1,8 +0,0 @@
|
||||
// ===========================================================================
|
||||
// Vortrex's Roleplay Resource
|
||||
// https://github.com/VortrexFTW/gtac_roleplay
|
||||
// ===========================================================================
|
||||
// FILE: housemgr.js
|
||||
// DESC: Provides house manager GUI
|
||||
// TYPE: Client (JavaScript)
|
||||
// ===========================================================================
|
||||
@@ -1,18 +0,0 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>Connected RP: Login</title>
|
||||
<style type="text/css" rel="stylesheet">
|
||||
.input-box
|
||||
{
|
||||
font-family: "Roboto";
|
||||
font-size: 14px;
|
||||
border-style: solid;
|
||||
border-colour: #0066AA;
|
||||
border-radius: 2px;
|
||||
color: #0066AA;
|
||||
};
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,83 +0,0 @@
|
||||
// ===========================================================================
|
||||
// Vortrex's Roleplay Resource
|
||||
// https://github.com/VortrexFTW/gtac_roleplay
|
||||
// ===========================================================================
|
||||
// FILE: info.js
|
||||
// DESC: Provides info dialog box GUI
|
||||
// TYPE: Client (JavaScript)
|
||||
// ===========================================================================
|
||||
|
||||
let infoDialog = {
|
||||
window: null,
|
||||
messageLabel: null,
|
||||
okayButton: null,
|
||||
};
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function initInfoDialogGUI() {
|
||||
logToConsole(LOG_DEBUG, `[VRR.GUI] Creating info dialog GUI ...`);
|
||||
infoDialog.window = mexui.window(getScreenWidth()/2-200, getScreenHeight()/2-70, 400, 140, 'Information', {
|
||||
main: {
|
||||
backgroundColour: toColour(secondaryColour[0], secondaryColour[1], secondaryColour[2], windowAlpha),
|
||||
},
|
||||
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),
|
||||
},
|
||||
});
|
||||
|
||||
infoDialog.messageLabel = infoDialog.window.text(15, 50, 370, 20, 'Information Message', {
|
||||
main: {
|
||||
textSize: 10.0,
|
||||
textAlign: 0.5,
|
||||
textColour: toColour(255, 255, 255, 220),
|
||||
textFont: mainFont,
|
||||
},
|
||||
focused: {
|
||||
borderColour: toColour(0, 0, 0, 0),
|
||||
},
|
||||
});
|
||||
|
||||
infoDialog.okayButton = infoDialog.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),
|
||||
},
|
||||
}, closeInfoDialog);
|
||||
logToConsole(LOG_DEBUG, `[VRR.GUI] Created info dialog GUI`);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function closeInfoDialog() {
|
||||
logToConsole(LOG_DEBUG, `[VRR.GUI] Closing info dialog`);
|
||||
infoDialog.window.shown = false;
|
||||
mexui.setInput(false);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -1,107 +0,0 @@
|
||||
// ===========================================================================
|
||||
// Vortrex's Roleplay Resource
|
||||
// https://github.com/VortrexFTW/gtac_roleplay
|
||||
// ===========================================================================
|
||||
// FILE: list.js
|
||||
// DESC: Provides simple list GUI
|
||||
// TYPE: Client (JavaScript)
|
||||
// ===========================================================================
|
||||
|
||||
let listDialog = {
|
||||
window: null,
|
||||
messageLabel: null,
|
||||
listGrid: null,
|
||||
};
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function initListGUI() {
|
||||
logToConsole(LOG_DEBUG, `[VRR.GUI] Creating list dialog GUI ...`);
|
||||
listDialog.window = mexui.window(game.width/2-200, game.height/2-70, 400, 500, 'List', {
|
||||
main: {
|
||||
backgroundColour: toColour(secondaryColour[0], secondaryColour[1], secondaryColour[2], windowAlpha),
|
||||
},
|
||||
title: {
|
||||
textSize: 11.0,
|
||||
textColour: toColour(primaryTextColour[0], primaryTextColour[1], primaryTextColour[2], 255),
|
||||
backgroundColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], windowTitleAlpha),
|
||||
},
|
||||
icon: {
|
||||
textSize: 11.0,
|
||||
textColour: toColour(255, 255, 255, 255),
|
||||
backgroundColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], windowTitleAlpha),
|
||||
hover: {
|
||||
backgroundColour: toColour(205, 60, 60, windowTitleAlpha),
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
listDialog.messageLabel = infoDialog.window.text(5, 5, 390, 20, 'Select one', {
|
||||
main: {
|
||||
textSize: 10.0,
|
||||
textAlign: 0.5,
|
||||
textColour: toColour(255, 255, 255, 220),
|
||||
textFont: mainFont,
|
||||
},
|
||||
focused: {
|
||||
borderColour: toColour(0, 0, 0, 0),
|
||||
},
|
||||
});
|
||||
|
||||
listDialog.listGrid = listDialog.window.grid(5, 25, 390, 450, {
|
||||
main: {
|
||||
backgroundColour: toColour(secondaryColour[0], secondaryColour[1], secondaryColour[2], windowAlpha),
|
||||
},
|
||||
column: {
|
||||
lineColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], windowTitleAlpha),
|
||||
},
|
||||
header: {
|
||||
backgroundColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], windowTitleAlpha-50),
|
||||
textColour: toColour(primaryTextColour[0], primaryTextColour[1], primaryTextColour[2], windowTitleAlpha),
|
||||
},
|
||||
cell: {
|
||||
backgroundColour: toColour(secondaryColour[0], secondaryColour[1], secondaryColour[2], windowAlpha),
|
||||
textColour: toColour(primaryTextColour[0], primaryTextColour[1], primaryTextColour[2], windowTitleAlpha),
|
||||
},
|
||||
row: {
|
||||
lineColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], windowTitleAlpha),
|
||||
hover: {
|
||||
backgroundColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], 120),
|
||||
}
|
||||
}
|
||||
});
|
||||
logToConsole(LOG_DEBUG, `[VRR.GUI] Created list dialog GUI`);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function showListGUI() {
|
||||
closeAllWindows();
|
||||
logToConsole(LOG_DEBUG, `[VRR.GUI] Showing login window`);
|
||||
setChatWindowEnabled(false);
|
||||
mexui.setInput(true);
|
||||
listDialog.window.shown = true;
|
||||
guiSubmitKey = checkListDialogSelection;
|
||||
guiUpKey = selectPreviousListItem;
|
||||
guiDownKey = selectNextListItem;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function checkListDialogSelection() {
|
||||
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function selectPreviousListItem() {
|
||||
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function selectNextListItem() {
|
||||
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -1,116 +0,0 @@
|
||||
// ===========================================================================
|
||||
// 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);
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -1,198 +0,0 @@
|
||||
// ===========================================================================
|
||||
// Vortrex's Roleplay Resource
|
||||
// https://github.com/VortrexFTW/gtac_roleplay
|
||||
// ===========================================================================
|
||||
// FILE: login.js
|
||||
// DESC: Provides login GUI
|
||||
// TYPE: Client (JavaScript)
|
||||
// ===========================================================================
|
||||
|
||||
let login = {
|
||||
window: null,
|
||||
logoImage: null,
|
||||
messageLabel: null,
|
||||
passwordInput: null,
|
||||
loginButton: null,
|
||||
forgotPasswordButton: null,
|
||||
resetPasswordLabel: null,
|
||||
};
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
let loginHTML =
|
||||
`<html>
|
||||
<head>
|
||||
<title>Asshat Gaming Roleplay: Login</title>
|
||||
<style type="text/css" rel="stylesheet">
|
||||
.input-box
|
||||
{
|
||||
font-family: "Roboto";
|
||||
font-size: 14px;
|
||||
border-style: solid;
|
||||
border-colour: #0066AA;
|
||||
border-radius: 2px;
|
||||
color: #0066AA;
|
||||
};
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
</body>
|
||||
</html>`;
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function initLoginGUI() {
|
||||
logToConsole(LOG_DEBUG, `[VRR.GUI] Creating login GUI ...`);
|
||||
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,
|
||||
},
|
||||
title: {
|
||||
textSize: 0.0,
|
||||
textColour: toColour(0, 0, 0, 0),
|
||||
},
|
||||
icon: {
|
||||
textSize: 0.0,
|
||||
textColour: toColour(0, 0, 0, 0),
|
||||
},
|
||||
focused: {
|
||||
borderColour: toColour(0, 0, 0, 0),
|
||||
},
|
||||
});
|
||||
login.window.titleBarIconSize = toVector2(0,0);
|
||||
login.window.titleBarHeight = 0;
|
||||
login.window.titleBarShown = false;
|
||||
|
||||
login.logoImage = login.window.image(100, 20, 100, 100, mainLogoPath, {
|
||||
focused: {
|
||||
borderColour: toColour(0, 0, 0, 0),
|
||||
},
|
||||
});
|
||||
|
||||
login.messageLabel = login.window.text(20, 135, 260, 20, 'Please enter your password!', {
|
||||
main: {
|
||||
textSize: 10.0,
|
||||
textAlign: 0.5,
|
||||
textColour: toColour(200, 200, 200, 255),
|
||||
textFont: mainFont,
|
||||
},
|
||||
focused: {
|
||||
borderColour: toColour(0, 0, 0, 0),
|
||||
},
|
||||
});
|
||||
|
||||
login.passwordInput = login.window.textInput(20, 170, 260, 25, '', {
|
||||
main: {
|
||||
backgroundColour: toColour(0, 0, 0, 120),
|
||||
borderColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], textInputAlpha),
|
||||
textColour: toColour(200, 200, 200, 255),
|
||||
textSize: 10.0,
|
||||
textFont: mainFont,
|
||||
},
|
||||
caret: {
|
||||
lineColour: toColour(255, 255, 255, 255),
|
||||
},
|
||||
placeholder: {
|
||||
textColour: toColour(200, 200, 200, 150),
|
||||
textSize: 10.0,
|
||||
textFont: mainFont,
|
||||
},
|
||||
focused: {
|
||||
borderColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], 255),
|
||||
},
|
||||
});
|
||||
login.passwordInput.masked = true;
|
||||
login.passwordInput.placeholder = "Password";
|
||||
|
||||
login.loginButton = login.window.button(20, 205, 260, 30, 'LOGIN', {
|
||||
main: {
|
||||
backgroundColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], buttonAlpha),
|
||||
textColour: toColour(0, 0, 0, 255),
|
||||
textSize: 12.0,
|
||||
textFont: mainFont,
|
||||
textAlign: 0.5,
|
||||
},
|
||||
focused: {
|
||||
borderColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], buttonAlpha),
|
||||
},
|
||||
}, checkLogin);
|
||||
|
||||
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),
|
||||
textSize: 8.0,
|
||||
textFont: mainFont,
|
||||
textAlign: 0.5,
|
||||
},
|
||||
focused: {
|
||||
borderColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], buttonAlpha),
|
||||
},
|
||||
}, switchToPasswordResetGUI);
|
||||
|
||||
login.resetPasswordLabel = login.window.text(110, 240, 60, 15, 'Forgot your password?', {
|
||||
main: {
|
||||
textSize: 8.0,
|
||||
textAlign: 1.0,
|
||||
textColour: toColour(180, 180, 180, 255),
|
||||
textFont: mainFont,
|
||||
},
|
||||
focused: {
|
||||
borderColour: toColour(0, 0, 0, 0),
|
||||
},
|
||||
});
|
||||
|
||||
logToConsole(LOG_DEBUG, `[VRR.GUI] Created login GUI`);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function showLoginGUI() {
|
||||
closeAllWindows();
|
||||
logToConsole(LOG_DEBUG, `[VRR.GUI] Showing login window`);
|
||||
setChatWindowEnabled(false);
|
||||
mexui.setInput(true);
|
||||
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);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function checkLogin() {
|
||||
logToConsole(LOG_DEBUG, `[VRR.GUI] Checking login with server ...`);
|
||||
sendNetworkEventToServer("vrr.checkLogin", login.passwordInput.lines[0]);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function loginFailed(errorMessage) {
|
||||
logToConsole(LOG_DEBUG, `[VRR.GUI] Server reports login failed`);
|
||||
login.messageLabel.text = errorMessage;
|
||||
login.messageLabel.styles.main.textColour = toColour(180, 32, 32, 255);
|
||||
login.passwordInput.text = "";
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function loginSuccess() {
|
||||
logToConsole(LOG_DEBUG, `[VRR.GUI] Server reports login was successful`);
|
||||
guiSubmitKey = false;
|
||||
closeAllWindows();
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function switchToPasswordResetGUI() {
|
||||
//closeAllWindows();
|
||||
//logToConsole(LOG_DEBUG, `[VRR.GUI] Showing password reset dialog window`);
|
||||
//showResetPasswordGUI();
|
||||
sendNetworkEventToServer("vrr.checkResetPassword", "");
|
||||
return false;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -1,166 +0,0 @@
|
||||
// ===========================================================================
|
||||
// Vortrex's Roleplay Resource
|
||||
// https://github.com/VortrexFTW/gtac_roleplay
|
||||
// ===========================================================================
|
||||
// FILE: newchar.js
|
||||
// DESC: Provides new character creation GUI
|
||||
// TYPE: Client (JavaScript)
|
||||
// ===========================================================================
|
||||
|
||||
let newCharacter = {
|
||||
window: null,
|
||||
messageLabel: null,
|
||||
firstNameInput: null,
|
||||
lastNameInput: null,
|
||||
createCharacterButton: null,
|
||||
mainLogoImage: null,
|
||||
};
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function initNewCharacterGUI() {
|
||||
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(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.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.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`);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function newCharacterFailed(errorMessage) {
|
||||
logToConsole(LOG_DEBUG, `[VRR.GUI] Server reports new character creation failed. Reason: ${errorMessage}`);
|
||||
newCharacter.messageLabel.text = errorMessage;
|
||||
newCharacter.messageLabel.styles.main.textColour = toColour(180, 32, 32, 255);
|
||||
newCharacter.firstNameInput.text = "";
|
||||
newCharacter.lastNameInput.text = "";
|
||||
|
||||
if(!newCharacter.window.shown) {
|
||||
closeAllWindows();
|
||||
setChatWindowEnabled(false);
|
||||
mexui.setInput(true);
|
||||
setHUDEnabled(false);
|
||||
newCharacter.window.shown = true;
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function checkNewCharacter() {
|
||||
logToConsole(LOG_DEBUG, `[VRR.GUI] Checking new character with server ...`);
|
||||
if(newCharacter.firstNameInput.lines[0].length < 2) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if(newCharacter.lastNameInput.lines[0].length < 2) {
|
||||
return false;
|
||||
}
|
||||
|
||||
sendNetworkEventToServer("vrr.checkNewCharacter",
|
||||
newCharacter.firstNameInput.lines[0],
|
||||
newCharacter.lastNameInput.lines[0],
|
||||
);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function showNewCharacterGUI() {
|
||||
logToConsole(LOG_DEBUG, `[VRR.GUI] Showing new character window`);
|
||||
closeAllWindows();
|
||||
setChatWindowEnabled(false);
|
||||
mexui.setInput(true);
|
||||
newCharacter.window.shown = true;
|
||||
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));
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -1,178 +0,0 @@
|
||||
// ===========================================================================
|
||||
// Vortrex's Roleplay Resource
|
||||
// https://github.com/VortrexFTW/gtac_roleplay
|
||||
// ===========================================================================
|
||||
// FILE: register.js
|
||||
// DESC: Provides account registration GUI
|
||||
// TYPE: Client (JavaScript)
|
||||
// ===========================================================================
|
||||
|
||||
let register = {
|
||||
window: null,
|
||||
logoImage: null,
|
||||
messageLabel: null,
|
||||
passwordInput: null,
|
||||
confirmPasswordInput: null,
|
||||
emailInput: null,
|
||||
registerButton: null,
|
||||
};
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function initRegisterGUI() {
|
||||
logToConsole(LOG_DEBUG, `[VRR.GUI] Creating register GUI ...`);
|
||||
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,
|
||||
},
|
||||
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),
|
||||
}
|
||||
});
|
||||
register.window.titleBarIconSize = toVector2(0,0);
|
||||
register.window.titleBarHeight = 0;
|
||||
register.window.titleBarShown = false;
|
||||
|
||||
register.window.image(100, 20, 100, 100, mainLogoPath, {
|
||||
focused: {
|
||||
borderColour: toColour(0, 0, 0, 0),
|
||||
},
|
||||
});
|
||||
|
||||
register.messageLabel = register.window.text(20, 125, 260, 20, 'Create an account', {
|
||||
main: {
|
||||
textSize: 10.0,
|
||||
textAlign: 0.5,
|
||||
textColour: toColour(200, 200, 200, 255),
|
||||
textFont: mainFont,
|
||||
},
|
||||
focused: {
|
||||
borderColour: toColour(0, 0, 0, 0),
|
||||
},
|
||||
});
|
||||
|
||||
register.passwordInput = register.window.textInput(20, 150, 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,
|
||||
}
|
||||
});
|
||||
register.passwordInput.masked = true;
|
||||
register.passwordInput.placeholder = "Password";
|
||||
|
||||
register.confirmPasswordInput = register.window.textInput(20, 180, 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,
|
||||
}
|
||||
});
|
||||
register.confirmPasswordInput.masked = true;
|
||||
register.confirmPasswordInput.placeholder = "Confirm password";
|
||||
|
||||
register.emailInput = register.window.textInput(20, 210, 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,
|
||||
}
|
||||
});
|
||||
register.emailInput.placeholder = "Email";
|
||||
|
||||
register.registerButton = register.window.button(20, 245, 260, 30, 'CREATE ACCOUNT', {
|
||||
main: {
|
||||
backgroundColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], buttonAlpha),
|
||||
textColour: toColour(255, 255, 255, 255),
|
||||
textSize: 12.0,
|
||||
textFont: mainFont,
|
||||
textAlign: 0.5,
|
||||
},
|
||||
focused: {
|
||||
borderColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], buttonAlpha),
|
||||
},
|
||||
}, checkRegistration);
|
||||
logToConsole(LOG_DEBUG, `[VRR.GUI] Created register GUI`);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function registrationFailed(errorMessage) {
|
||||
logToConsole(LOG_DEBUG, `[VRR.GUI] Server reports registration failed. Reason: ${errorMessage}`);
|
||||
register.messageLabel.text = errorMessage;
|
||||
register.messageLabel.styles.main.textColour = toColour(180, 32, 32, 255);
|
||||
register.passwordInput.text = "";
|
||||
register.confirmPasswordInput.text = "";
|
||||
register.emailInput.text = "";
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function checkRegistration() {
|
||||
logToConsole(LOG_DEBUG, `[VRR.GUI] Checking registration with server ...`);
|
||||
sendNetworkEventToServer("vrr.checkRegistration", register.passwordInput.lines[0], register.confirmPasswordInput.lines[0], register.emailInput.lines[0]);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function showRegistrationGUI() {
|
||||
logToConsole(LOG_DEBUG, `[VRR.GUI] Showing registration window`);
|
||||
closeAllWindows();
|
||||
setChatWindowEnabled(false);
|
||||
mexui.setInput(true);
|
||||
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);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function registrationSuccess() {
|
||||
logToConsole(LOG_DEBUG, `[VRR.GUI] Server reports registration was successful`);
|
||||
guiSubmitKey = false;
|
||||
closeAllWindows();
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -1,195 +0,0 @@
|
||||
// ===========================================================================
|
||||
// Vortrex's Roleplay Resource
|
||||
// https://github.com/VortrexFTW/gtac_roleplay
|
||||
// ===========================================================================
|
||||
// FILE: resetpass.js
|
||||
// DESC: Provides password reset GUI
|
||||
// TYPE: Client (JavaScript)
|
||||
// ===========================================================================
|
||||
|
||||
let passwordReset = {
|
||||
window: null,
|
||||
logoImage: null,
|
||||
messageLabel: null,
|
||||
emailInput: null,
|
||||
resetPasswordButton: null,
|
||||
backToLoginButton: null,
|
||||
backToLoginLabel: null,
|
||||
};
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function initResetPasswordGUI() {
|
||||
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,
|
||||
},
|
||||
title: {
|
||||
textSize: 0.0,
|
||||
textColour: toColour(0, 0, 0, 0),
|
||||
},
|
||||
icon: {
|
||||
textSize: 0.0,
|
||||
textColour: toColour(0, 0, 0, 0),
|
||||
},
|
||||
focused: {
|
||||
borderColour: toColour(0, 0, 0, 0),
|
||||
},
|
||||
});
|
||||
passwordReset.window.titleBarIconSize = toVector2(0, 0);
|
||||
passwordReset.window.titleBarHeight = 0;
|
||||
passwordReset.window.titleBarShown = false;
|
||||
|
||||
passwordReset.logoImage = passwordReset.window.image(100, 20, 100, 100, mainLogoPath, {
|
||||
focused: {
|
||||
borderColour: toColour(0, 0, 0, 0),
|
||||
},
|
||||
});
|
||||
|
||||
passwordReset.messageLabel = passwordReset.window.text(20, 135, 260, 20, 'Please confirm your email', {
|
||||
main: {
|
||||
textSize: 10.0,
|
||||
textAlign: 0.5,
|
||||
textColour: toColour(200, 200, 200, 255),
|
||||
textFont: mainFont,
|
||||
},
|
||||
focused: {
|
||||
borderColour: toColour(0, 0, 0, 0),
|
||||
},
|
||||
});
|
||||
|
||||
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),
|
||||
textColour: toColour(200, 200, 200, 255),
|
||||
textSize: 10.0,
|
||||
textFont: mainFont,
|
||||
},
|
||||
caret: {
|
||||
lineColour: toColour(255, 255, 255, 255),
|
||||
},
|
||||
placeholder: {
|
||||
textColour: toColour(200, 200, 200, 150),
|
||||
textSize: 10.0,
|
||||
textFont: mainFont,
|
||||
},
|
||||
focused: {
|
||||
borderColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], 255),
|
||||
},
|
||||
});
|
||||
passwordReset.emailInput.placeholder = "Email";
|
||||
|
||||
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),
|
||||
textSize: 12.0,
|
||||
textFont: mainFont,
|
||||
textAlign: 0.5,
|
||||
},
|
||||
focused: {
|
||||
borderColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], buttonAlpha),
|
||||
},
|
||||
}, checkResetPassword);
|
||||
|
||||
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),
|
||||
textSize: 8.0,
|
||||
textFont: mainFont,
|
||||
textAlign: 0.5,
|
||||
},
|
||||
focused: {
|
||||
borderColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], buttonAlpha),
|
||||
},
|
||||
}, switchToLoginGUI);
|
||||
|
||||
passwordReset.backToLoginLabel = passwordReset.window.text(110, 240, 60, 15, 'Remember your password?', {
|
||||
main: {
|
||||
textSize: 8.0,
|
||||
textAlign: 1.0,
|
||||
textColour: toColour(200, 200, 200, 255),
|
||||
textFont: mainFont,
|
||||
},
|
||||
focused: {
|
||||
borderColour: toColour(0, 0, 0, 0),
|
||||
},
|
||||
});
|
||||
|
||||
logToConsole(LOG_DEBUG, `[VRR.GUI] Created password reset GUI`);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function showResetPasswordGUI() {
|
||||
closeAllWindows();
|
||||
logToConsole(LOG_DEBUG, `[VRR.GUI] Showing password reset window`);
|
||||
setChatWindowEnabled(false);
|
||||
mexui.setInput(true);
|
||||
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 (${passwordReset.emailInput.lines[0]}) ...`);
|
||||
sendNetworkEventToServer("vrr.checkResetPassword", passwordReset.emailInput.lines[0]);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function resetPasswordFailed(errorMessage) {
|
||||
logToConsole(LOG_DEBUG, `[VRR.GUI] Server reports password reset failed`);
|
||||
passwordReset.messageLabel.text = errorMessage;
|
||||
passwordReset.messageLabel.styles.main.textColour = toColour(180, 32, 32, 255);
|
||||
passwordReset.emailInput.text = "";
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function resetPasswordCodeInputGUI() {
|
||||
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();
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -1,115 +0,0 @@
|
||||
// ===========================================================================
|
||||
// Vortrex's Roleplay Resource
|
||||
// https://github.com/VortrexFTW/gtac_roleplay
|
||||
// ===========================================================================
|
||||
// FILE: yesno.js
|
||||
// DESC: Provides yes/no prompt dialog GUI
|
||||
// TYPE: Client (JavaScript)
|
||||
// ===========================================================================
|
||||
|
||||
|
||||
let yesNoDialog = {
|
||||
window: null,
|
||||
messageLabel: null,
|
||||
yesButton: null,
|
||||
noButton: null,
|
||||
};
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function initYesNoDialogGUI() {
|
||||
logToConsole(LOG_DEBUG, `[VRR.GUI] Created prompt GUI ...`);
|
||||
yesNoDialog.window = mexui.window(game.width/2-200, game.height/2-70, 400, 140, 'Question', {
|
||||
main: {
|
||||
backgroundColour: toColour(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),
|
||||
},
|
||||
});
|
||||
|
||||
yesNoDialog.messageLabel = yesNoDialog.window.text(15, 50, 370, 20, 'Would you like to answer this question?', {
|
||||
main: {
|
||||
textSize: 10.0,
|
||||
textAlign: 0.5,
|
||||
textColour: toColour(255, 255, 255, 255),
|
||||
textFont: mainFont,
|
||||
},
|
||||
focused: {
|
||||
borderColour: toColour(0, 0, 0, 0),
|
||||
},
|
||||
});
|
||||
|
||||
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),
|
||||
textSize: 10.0,
|
||||
textFont: mainFont,
|
||||
textAlign: 0.5,
|
||||
},
|
||||
focused: {
|
||||
borderColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], 255),
|
||||
},
|
||||
}, yesNoDialogAnswerYes);
|
||||
|
||||
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),
|
||||
textSize: 10.0,
|
||||
textFont: mainFont,
|
||||
textAlign: 0.5,
|
||||
},
|
||||
focused: {
|
||||
borderColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], 255),
|
||||
},
|
||||
}, yesNoDialogAnswerNo);
|
||||
logToConsole(LOG_DEBUG, `[VRR.GUI] Created prompt GUI`);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function yesNoDialogAnswerNo() {
|
||||
logToConsole(LOG_DEBUG, `[VRR.GUI] Responding with answer NO to server prompt`);
|
||||
sendNetworkEventToServer("vrr.promptAnswerNo");
|
||||
closeAllWindows();
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function yesNoDialogAnswerYes() {
|
||||
logToConsole(LOG_DEBUG, `[VRR.GUI] Responding with answer YES to server prompt`);
|
||||
sendNetworkEventToServer("vrr.promptAnswerYes");
|
||||
closeAllWindows();
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -1,384 +0,0 @@
|
||||
// ===========================================================================
|
||||
// Vortrex's Roleplay Resource
|
||||
// https://github.com/VortrexFTW/gtac_roleplay
|
||||
// ===========================================================================
|
||||
// FILE: labels.js
|
||||
// DESC: Provides functionality for world labels (3D labels)
|
||||
// TYPE: Client (JavaScript)
|
||||
// ===========================================================================
|
||||
|
||||
let businessLabels = [];
|
||||
let houseLabels = [];
|
||||
let jobLabels = [];
|
||||
|
||||
let propertyLabelNameFont = null;
|
||||
let propertyLabelLockedFont = null;
|
||||
let propertyLabelHeight = 1.0;
|
||||
|
||||
let jobNameLabelFont = null;
|
||||
let jobHelpLabelFont = null;
|
||||
|
||||
let unlockedColour = toColour(50, 205, 50, 255);
|
||||
let lockedColour = toColour(205, 92, 92, 255);
|
||||
let jobHelpColour = toColour(234, 198, 126, 255);
|
||||
|
||||
let renderLabelDistance = 7.5;
|
||||
|
||||
let propertyLabelLockedOffset = 16;
|
||||
let propertyLabelNameOffset = 18;
|
||||
let propertyLabelPriceOffset = 16;
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function initLabelScript() {
|
||||
logToConsole(LOG_DEBUG, "[VRR.Label]: Initializing label script ...");
|
||||
propertyLabelNameFont = initLabelPropertyNameFont();
|
||||
propertyLabelLockedFont = initLabelPropertyLockedFont();
|
||||
jobNameLabelFont = initLabelJobNameFont();
|
||||
jobHelpLabelFont = initLabelJobHelpFont();
|
||||
logToConsole(LOG_DEBUG, "[VRR.Label]: Label script initialized!");
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function initLabelPropertyNameFont() {
|
||||
return lucasFont.createDefaultFont(16.0, "Roboto", "Regular");
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function initLabelPropertyLockedFont() {
|
||||
return lucasFont.createDefaultFont(12.0, "Roboto", "Light");
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function initLabelJobNameFont() {
|
||||
return lucasFont.createDefaultFont(16.0, "Roboto", "Regular");
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function initLabelJobHelpFont() {
|
||||
return lucasFont.createDefaultFont(10.0, "Roboto", "Light");
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function renderPropertyEntranceLabel(name, position, locked, isBusiness, price, rentPrice, labelInfoType) {
|
||||
if(localPlayer == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if(propertyLabelNameFont == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if(propertyLabelLockedFont == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if(getGame() == VRR_GAME_GTA_IV) {
|
||||
if(!natives.doesViewportExist(natives.getGameViewportId())) {
|
||||
logToConsole(LOG_INFO, "[VRR.Label]: Game viewport does not exist!");
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!natives.isViewportActive(natives.getGameViewportId())) {
|
||||
logToConsole(LOG_INFO, "[VRR.Label]: Game viewport is not active!");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
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 = "";
|
||||
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;
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
screenPosition.y -= propertyLabelPriceOffset;
|
||||
}
|
||||
|
||||
if(isBusiness) {
|
||||
text = (locked) ? toUpperCase(getLocaleString("Closed")) : toUpperCase(getLocaleString("Open"));
|
||||
} else {
|
||||
text = (locked) ? toUpperCase(getLocaleString("Locked")) : toUpperCase(getLocaleString("Unlocked"));
|
||||
}
|
||||
|
||||
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_BUY: {
|
||||
infoText = getLocaleString("BusinessBuyItemsLabel", "/buy");
|
||||
break;
|
||||
}
|
||||
|
||||
case VRR_PROPLABEL_INFO_BUYBIZ: {
|
||||
infoText = getLocaleString("BuyBusinessLabel", "/bizbuy");
|
||||
break;
|
||||
}
|
||||
|
||||
case VRR_PROPLABEL_INFO_BUYHOUSE: {
|
||||
infoText = getLocaleString("BuyHouseLabel", "/housebuy");
|
||||
break;
|
||||
}
|
||||
|
||||
case VRR_PROPLABEL_INFO_RENTHOUSE: {
|
||||
infoText = getLocaleString("RentHouseLabel", "/houserent");
|
||||
break;
|
||||
}
|
||||
|
||||
case VRR_PROPLABEL_INFO_ENTERVEHICLE: {
|
||||
infoText = getLocaleString("VehicleDealershipLabel");
|
||||
break;
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
function renderPropertyExitLabel(position) {
|
||||
if(localPlayer == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if(propertyLabelNameFont == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if(propertyLabelLockedFont == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if(getGame() == VRR_GAME_GTA_IV) {
|
||||
if(!natives.doesViewportExist(natives.getGameViewportId())) {
|
||||
logToConsole(LOG_INFO, "[VRR.Label]: Game viewport does not exist!");
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!natives.isViewportActive(natives.getGameViewportId())) {
|
||||
logToConsole(LOG_INFO, "[VRR.Label]: Game viewport is not active!");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
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(jobNameLabelFont == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if(jobHelpLabelFont == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if(getGame() == VRR_GAME_GTA_IV) {
|
||||
if(!natives.doesViewportExist(natives.getGameViewportId())) {
|
||||
logToConsole(LOG_INFO, "[VRR.Label]: Game viewport does not exist!");
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!natives.isViewportActive(natives.getGameViewportId())) {
|
||||
logToConsole(LOG_INFO, "[VRR.Label]: Game viewport is not active!");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
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 = "";
|
||||
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");
|
||||
}
|
||||
}
|
||||
|
||||
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) {
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
@@ -8,53 +8,32 @@
|
||||
// ===========================================================================
|
||||
|
||||
function getLocaleString(stringName, ...args) {
|
||||
if(typeof getServerData().localeStrings[localLocaleId][stringName] == undefined) {
|
||||
return "";
|
||||
}
|
||||
return findResourceByName("agrp_locale").exports.getLocaleString(localLocaleId, stringName, args);
|
||||
}
|
||||
|
||||
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 getGroupedLocaleString(stringName, index, ...args) {
|
||||
return findResourceByName("agrp_locale").exports.getGroupedLocaleString(localLocaleId, stringName, index, args);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function getAvailableLocaleOptions() {
|
||||
return getServerData().localeOptions.filter(localeOption => localeOption.requiresUnicode == false);
|
||||
return findResourceByName("agrp_locale").exports.getAvailableLocaleOptions();
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
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 getLocales() {
|
||||
return findResourceByName("agrp_locale").exports.getLocales();
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function setLocale(tempLocaleId) {
|
||||
logToConsole(LOG_DEBUG, `[VRR.Locale] Setting locale to ${tempLocaleId} (${getServerData().localeOptions[tempLocaleId].englishName})`);
|
||||
let locales = getLocales();
|
||||
logToConsole(LOG_DEBUG, `[VRR.Locale] Setting locale to ${tempLocaleId} (${locales[tempLocaleId].englishName})`);
|
||||
localLocaleId = tempLocaleId;
|
||||
resetGUIStrings();
|
||||
}
|
||||
|
||||
@@ -1,52 +0,0 @@
|
||||
// ===========================================================================
|
||||
// Vortrex's Roleplay Resource
|
||||
// https://github.com/VortrexFTW/gtac_roleplay
|
||||
// ===========================================================================
|
||||
// FILE: logo.js
|
||||
// DESC: Provides logo rendering functions
|
||||
// TYPE: Client (JavaScript)
|
||||
// ===========================================================================
|
||||
|
||||
let logoImage = null;
|
||||
let logoPos = toVector2(game.width-132, game.height-132);
|
||||
let logoSize = toVector2(128, 128);
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function initLogoScript() {
|
||||
logToConsole(LOG_DEBUG, "[VRR.Logo]: Initializing logo script ...");
|
||||
//logoImage = loadLogoImage();
|
||||
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();
|
||||
}
|
||||
|
||||
return tempLogoImage;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function processLogoRendering() {
|
||||
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;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -30,7 +30,7 @@ let renderHotBar = true;
|
||||
let renderItemActionDelay = true;
|
||||
let renderInteriorLights = true;
|
||||
|
||||
let logLevel = LOG_INFO|LOG_DEBUG|LOG_VERBOSE;
|
||||
let logLevel = LOG_INFO | LOG_DEBUG | LOG_VERBOSE;
|
||||
|
||||
let weaponDamageEnabled = {};
|
||||
let weaponDamageEvent = {};
|
||||
@@ -48,9 +48,6 @@ let streamingRadio = null;
|
||||
let streamingRadioVolume = 50;
|
||||
let streamingRadioElement = false;
|
||||
|
||||
let enterPropertyKey = null;
|
||||
let disableGUIKey = getKeyIdFromParams("insert");
|
||||
|
||||
let inAnimation = false;
|
||||
let forcedAnimation = null;
|
||||
|
||||
@@ -59,8 +56,6 @@ let calledDeathEvent = false;
|
||||
let interiorLightsEnabled = true;
|
||||
let interiorLightsColour = toColour(0, 0, 0, 150);
|
||||
|
||||
let mouseCameraEnabled = false;
|
||||
|
||||
let currentPickup = false;
|
||||
|
||||
let vehiclePurchaseState = VRR_VEHBUYSTATE_NONE;
|
||||
@@ -69,12 +64,6 @@ 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());
|
||||
|
||||
|
||||
@@ -1,643 +0,0 @@
|
||||
|
||||
// ===========================================================================
|
||||
// Asshat-Gaming Roleplay
|
||||
// https://github.com/VortrexFTW/gtac_asshat_rp
|
||||
// Copyright (c) 2020 Asshat-Gaming (https://asshatgaming.com)
|
||||
// ---------------------------------------------------------------------------
|
||||
// FILE: mouse-camera.js
|
||||
// DESC: Provides a freelook camera similar to SA for III and VC
|
||||
// TYPE: Client (JavaScript)
|
||||
// ===========================================================================
|
||||
|
||||
// CREDITS TO LUCASC190 FOR MAKING THE MOUSE CAMERA
|
||||
// WALKING CODE ADDED BY VORTREX
|
||||
|
||||
function SetStandardControlsEnabled(bEnabled)
|
||||
{
|
||||
if(typeof gta == "undefined") {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (game.standardControls === undefined)
|
||||
{
|
||||
logToConsole(LOG_WARN, "game.standardControls not implemented");
|
||||
return;
|
||||
}
|
||||
game.standardControls = bEnabled;
|
||||
}
|
||||
|
||||
function GetCurrentPlayerIndex()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
function GetPlayerPed(uiIndex)
|
||||
{
|
||||
if (uiIndex >= 1)
|
||||
throw new Error("player index out of range");
|
||||
return localPlayer;
|
||||
}
|
||||
|
||||
function GetPedVehicle(pPed)
|
||||
{
|
||||
return pPed.vehicle;
|
||||
}
|
||||
|
||||
let ENTITYTYPE_BUILDING = 1;
|
||||
let ENTITYTYPE_VEHICLE = 2;
|
||||
let ENTITYTYPE_PED = 3;
|
||||
let ENTITYTYPE_OBJECT = 4;
|
||||
let ENTITYTYPE_DUMMY = 5;
|
||||
|
||||
function GetEntityType(Entity)
|
||||
{
|
||||
if (Entity.isType(ELEMENT_BUILDING))
|
||||
return ENTITYTYPE_BUILDING;
|
||||
if (Entity.isType(ELEMENT_VEHICLE))
|
||||
return ENTITYTYPE_VEHICLE;
|
||||
if (Entity.isType(ELEMENT_PED))
|
||||
return ENTITYTYPE_PED;
|
||||
if (Entity.isType(ELEMENT_OBJECT))
|
||||
return ENTITYTYPE_OBJECT;
|
||||
//if (Entity.isType(ELEMENT_DUMMY))
|
||||
// return ENTITYTYPE_DUMMY;
|
||||
return undefined;
|
||||
}
|
||||
|
||||
function GetPlaceableMatrix(pPlaceable)
|
||||
{
|
||||
if (pPlaceable == GetCamera())
|
||||
return game.cameraMatrix;
|
||||
return pPlaceable.matrix;
|
||||
}
|
||||
|
||||
function GetEntityModel(pEntity)
|
||||
{
|
||||
return pEntity;
|
||||
}
|
||||
|
||||
function GetModelBoundingSphere(usModel)
|
||||
{
|
||||
return [usModel.boundingRadius, usModel.boundingCentre.x, usModel.boundingCentre.y, usModel.boundingCentre.z];
|
||||
}
|
||||
|
||||
function GetMouseSpeed()
|
||||
{
|
||||
if (gui.cursorEnabled)
|
||||
return [0,0];
|
||||
let MouseSpeed = game.getMouseSpeed();
|
||||
return [MouseSpeed.x,-MouseSpeed.y];
|
||||
}
|
||||
|
||||
function GetMouseSensitivity()
|
||||
{
|
||||
if (game.getMouseSensitivity === undefined)
|
||||
{
|
||||
//logToConsole(LOG_ERROR, "game.getMouseSensitivity not implemented");
|
||||
return [0.0025,0.003];
|
||||
}
|
||||
let MouseSensitivity = game.getMouseSensitivity();
|
||||
return [MouseSensitivity.x,MouseSensitivity.y];
|
||||
}
|
||||
|
||||
let GetCamera;
|
||||
{
|
||||
const Camera = Symbol();
|
||||
|
||||
GetCamera = function()
|
||||
{
|
||||
return Camera;
|
||||
}
|
||||
}
|
||||
|
||||
function AreEntityCollisionsEnabled(pEntity)
|
||||
{
|
||||
return pEntity.collisionsEnabled;
|
||||
}
|
||||
|
||||
function SetEntityCollisionsEnabled(pEntity, bCollisionsEnabled)
|
||||
{
|
||||
pEntity.collisionsEnabled = bCollisionsEnabled;
|
||||
}
|
||||
|
||||
function ProcessLineOfSight(vecStartX, vecStartY, vecStartZ, vecEndX, vecEndY, vecEndZ, bCheckBuildings, bCheckVehicles, bCheckPeds, bCheckObjects, bCheckDummies, bCheckSeeThroughStuff, bIgnoreSomeObjectsForCamera)
|
||||
{
|
||||
if (game.processLineOfSight === undefined)
|
||||
{
|
||||
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);
|
||||
if (Result == null)
|
||||
return [null];
|
||||
return [Result.position.x, Result.position.y ,Result.position.z, Result.normal.x, Result.normal.y ,Result.normal.z, Result.entity];
|
||||
}
|
||||
|
||||
function SetPlaceableMatrix(pPlaceable, mat)
|
||||
{
|
||||
if (pPlaceable == GetCamera())
|
||||
{
|
||||
game.setCameraMatrix(mat);
|
||||
return;
|
||||
}
|
||||
pPlaceable.matrix = mat;
|
||||
}
|
||||
|
||||
const UpdateCamera = game.updateCamera;
|
||||
|
||||
let GetTickCount;
|
||||
{
|
||||
let FrameCount = 0;
|
||||
|
||||
setInterval(() =>
|
||||
{
|
||||
++FrameCount;
|
||||
}, 0);
|
||||
|
||||
let GTAFrameCount = 0;
|
||||
|
||||
addEventHandler("OnProcess", (event, deltaTime) =>
|
||||
{
|
||||
++GTAFrameCount;
|
||||
});
|
||||
|
||||
GetTickCount = function(bGTA, bFrames)
|
||||
{
|
||||
if (bFrames)
|
||||
return bGTA ? GTAFrameCount : FrameCount;
|
||||
else
|
||||
return bGTA ? game.tickCount : sdl.ticks;
|
||||
}
|
||||
}
|
||||
|
||||
function easingSinusoidalInOut(t,b,c,d)//TODO: Move this to MathUtil.js
|
||||
{
|
||||
return -c/2 * (Math.cos((Math.PI)*t/d) - 1) + b;
|
||||
}
|
||||
|
||||
//TODO: extract
|
||||
|
||||
function applyMultiplierTimeStep(m,t)//TODO: Move this to MathUtil.js
|
||||
{
|
||||
return Math.max(Math.min(1.0-(1.0-m)*(t),1),0);
|
||||
}
|
||||
|
||||
//TODO: getOffset
|
||||
//TODO: round
|
||||
//TODO: getNumberBetween
|
||||
//TODO: split
|
||||
//TODO: isWhiteSpaceCharacter
|
||||
//TODO: isControlCharacter
|
||||
//TODO: alert
|
||||
//TODO: confirm
|
||||
|
||||
const identityMatrix = new Matrix4x4();
|
||||
if (identityMatrix.setIdentity === undefined)
|
||||
{
|
||||
identityMatrix.m11 = 1;
|
||||
identityMatrix.m12 = 0;
|
||||
identityMatrix.m13 = 0;
|
||||
identityMatrix.m14 = 0;
|
||||
identityMatrix.m21 = 0;
|
||||
identityMatrix.m22 = 1;
|
||||
identityMatrix.m23 = 0;
|
||||
identityMatrix.m24 = 0;
|
||||
identityMatrix.m31 = 0;
|
||||
identityMatrix.m32 = 0;
|
||||
identityMatrix.m33 = 1;
|
||||
identityMatrix.m34 = 0;
|
||||
identityMatrix.m41 = 0;
|
||||
identityMatrix.m42 = 0;
|
||||
identityMatrix.m43 = 0;
|
||||
identityMatrix.m44 = 1;
|
||||
}
|
||||
|
||||
const cameraIdentityMatrix = new Matrix4x4();
|
||||
cameraIdentityMatrix.m11 = -1;
|
||||
cameraIdentityMatrix.m12 = 0;
|
||||
cameraIdentityMatrix.m13 = 0;
|
||||
cameraIdentityMatrix.m14 = 0;
|
||||
cameraIdentityMatrix.m21 = 0;
|
||||
cameraIdentityMatrix.m22 = 1;
|
||||
cameraIdentityMatrix.m23 = 0;
|
||||
cameraIdentityMatrix.m24 = 0;
|
||||
cameraIdentityMatrix.m31 = 0;
|
||||
cameraIdentityMatrix.m32 = 0;
|
||||
cameraIdentityMatrix.m33 = 1;
|
||||
cameraIdentityMatrix.m34 = 0;
|
||||
cameraIdentityMatrix.m41 = 0;
|
||||
cameraIdentityMatrix.m42 = 0;
|
||||
cameraIdentityMatrix.m43 = 0;
|
||||
cameraIdentityMatrix.m44 = 1;
|
||||
|
||||
function createMultipliedMatrix()
|
||||
{
|
||||
let matrix = new Matrix4x4();
|
||||
matrix.setMultiply.apply(matrix, arguments);
|
||||
return matrix;
|
||||
}
|
||||
|
||||
function createXRotationMatrix(x)
|
||||
{
|
||||
let matrix = new Matrix4x4();
|
||||
matrix.setRotateX(x);
|
||||
return matrix;
|
||||
}
|
||||
|
||||
function createYRotationMatrix(x)
|
||||
{
|
||||
let matrix = new Matrix4x4();
|
||||
matrix.setRotateY(x);
|
||||
return matrix;
|
||||
}
|
||||
|
||||
function createZRotationMatrix(z)
|
||||
{
|
||||
let matrix = new Matrix4x4();
|
||||
matrix.setRotateZ(z);
|
||||
return matrix;
|
||||
}
|
||||
|
||||
function createTranslationMatrix(x,y,z)
|
||||
{
|
||||
let matrix = new Matrix4x4();
|
||||
matrix.setTranslate([x,y,z]);
|
||||
return matrix;
|
||||
}
|
||||
|
||||
//TODO: createScaleMatrix
|
||||
|
||||
function getDotProduct(x,y,z,x2,y2,z2)
|
||||
{
|
||||
return x*x2 + y*y2 + z*z2;
|
||||
}
|
||||
|
||||
function getCrossProduct(x,y,z,x2,y2,z2)
|
||||
{
|
||||
return [y*z2-z*y2, z*x2-x*z2, x*y2-y*x2];
|
||||
}
|
||||
|
||||
function getLength(x,y,z)
|
||||
{
|
||||
return Math.sqrt(getDotProduct(x,y,z,x,y,z));
|
||||
}
|
||||
|
||||
function normalise(x,y,z)
|
||||
{
|
||||
let length = getLength(x,y,z);
|
||||
if (length == 0)
|
||||
throw new Error("an attempt was made to normalise a three dimensional vector with a length of zero");
|
||||
return [x/length, y/length, z/length];
|
||||
}
|
||||
|
||||
function createLookAtLHMatrix(eyeX, eyeY, eyeZ, atX, atY, atZ, upX,upY,upZ)
|
||||
{
|
||||
let matrix = new Matrix4x4();
|
||||
let [lookX, lookY, lookZ] = normalise(atX-eyeX,atY-eyeY,atZ-eyeZ);
|
||||
let [rightX, rightY, rightZ] = normalise.apply(null,getCrossProduct(upX,upY,upZ,lookX, lookY, lookZ));
|
||||
[upX,upY,upZ] = getCrossProduct(lookX, lookY, lookZ,rightX, rightY, rightZ);
|
||||
matrix.m11 = rightX;
|
||||
matrix.m12 = rightY;
|
||||
matrix.m13 = rightZ;
|
||||
matrix.m14 = 0;
|
||||
|
||||
matrix.m21 = lookX;
|
||||
matrix.m22 = lookY;
|
||||
matrix.m23 = lookZ;
|
||||
matrix.m24 = 0;
|
||||
|
||||
matrix.m31 = upX;
|
||||
matrix.m32 = upY;
|
||||
matrix.m33 = upZ;
|
||||
matrix.m34 = 0;
|
||||
|
||||
matrix.m41 = eyeX;
|
||||
matrix.m42 = eyeY;
|
||||
matrix.m43 = eyeZ;
|
||||
matrix.m44 = 1;
|
||||
|
||||
matrix.m41 = eyeX;
|
||||
matrix.m42 = eyeY;
|
||||
matrix.m43 = eyeZ;
|
||||
matrix.m44 = 1;
|
||||
return matrix;
|
||||
}
|
||||
|
||||
function getDifferenceBetweenAngles(current,target)
|
||||
{
|
||||
let f = (((target-current)+Math.PI)/(Math.PI*2));
|
||||
return ((f-Math.floor(f))*(Math.PI*2))-Math.PI;
|
||||
}
|
||||
|
||||
let easeCamera = false;
|
||||
let easeStartTicks;
|
||||
let easeDuration;
|
||||
let easeStartPosX, easeStartPosY, easeStartPosZ;
|
||||
let easeStartLookX, easeStartLookY, easeStartLookZ;
|
||||
let easeStartUpX, easeStartUpY, easeStartUpZ;
|
||||
|
||||
function getCameraPositionInfo(matrix)
|
||||
{
|
||||
return [matrix.m41, matrix.m42, matrix.m43, matrix.m21, matrix.m22, matrix.m23, matrix.m31, matrix.m32, matrix.m33];
|
||||
}
|
||||
|
||||
function startCameraEase()
|
||||
{
|
||||
easeCamera = true;
|
||||
easeStartTicks = GetTickCount(true,false);
|
||||
easeDuration = 1000;
|
||||
let matrix = GetPlaceableMatrix(GetCamera());
|
||||
[easeStartPosX, easeStartPosY, easeStartPosZ, easeStartLookX, easeStartLookY, easeStartLookZ, easeStartUpX, easeStartUpY, easeStartUpZ] = getCameraPositionInfo(matrix);
|
||||
}
|
||||
|
||||
function applyCameraEase(matrix)
|
||||
{
|
||||
if (!easeCamera)
|
||||
return matrix;
|
||||
let ease = (GetTickCount(true,false)-easeStartTicks)/easeDuration;
|
||||
if (ease < 1)
|
||||
{
|
||||
ease = easingSinusoidalInOut(ease,0,1,1);
|
||||
let [newPosX, newPosY, newPosZ, newLookX, newLookY, newLookZ, newUpX, newUpY, newUpZ] = getCameraPositionInfo(matrix);
|
||||
let easePosX = easeStartPosX+(newPosX-easeStartPosX)*ease;
|
||||
let easePosY = easeStartPosY+(newPosY-easeStartPosY)*ease;
|
||||
let easePosZ = easeStartPosZ+(newPosZ-easeStartPosZ)*ease;
|
||||
let easeLookX = easeStartLookX+(newLookX-easeStartLookX)*ease;
|
||||
let easeLookY = easeStartLookY+(newLookY-easeStartLookY)*ease;
|
||||
let easeLookZ = easeStartLookZ+(newLookZ-easeStartLookZ)*ease;
|
||||
let easeUpX = easeStartUpX+(newUpX-easeStartUpX)*ease;
|
||||
let easeUpY = easeStartUpY+(newUpY-easeStartUpY)*ease;
|
||||
let easeUpZ = easeStartUpZ+(newUpZ-easeStartUpZ)*ease;
|
||||
return createLookAtLHMatrix(easePosX,easePosY,easePosZ,easePosX+easeLookX,easePosY+easeLookY,easePosZ+easeLookZ,easeUpX,easeUpY,easeUpZ);
|
||||
}
|
||||
return matrix;
|
||||
}
|
||||
|
||||
function isCameraEasing()
|
||||
{
|
||||
return easeCamera && GetTickCount(true,false) < (easeStartTicks+easeDuration);
|
||||
}
|
||||
|
||||
let oldCameraTarget = null;
|
||||
let OldPosition = null;//2019 Lucas was here!
|
||||
let cameraRotZ;
|
||||
let cameraRotY;
|
||||
|
||||
function getCameraTarget()
|
||||
{
|
||||
let playerPed = GetPlayerPed(GetCurrentPlayerIndex());
|
||||
let vehicle = GetPedVehicle(playerPed);
|
||||
if (vehicle != null)
|
||||
return vehicle;
|
||||
if (playerPed != null)
|
||||
{
|
||||
//if (playerPed.health <= 1)//Breaks because of fade//2019 Lucas was here!
|
||||
// return null;
|
||||
return playerPed;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
function isRelativeToTarget(target)
|
||||
{
|
||||
if (GetEntityType(target) == ENTITYTYPE_PED)
|
||||
return false;
|
||||
return false
|
||||
}
|
||||
|
||||
function isClipped(target)
|
||||
{
|
||||
if (GetEntityType(target) == ENTITYTYPE_PED)
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
|
||||
//2019 Lucas was here!
|
||||
function ShouldReturnToRestRotation(Target)
|
||||
{
|
||||
if (GetEntityType(Target) == ENTITYTYPE_PED)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
function getCameraRestRotation(target)
|
||||
{
|
||||
let targetMatrix = GetPlaceableMatrix(target);
|
||||
let rotZ;
|
||||
if (isRelativeToTarget(target))
|
||||
rotZ = 0;
|
||||
else
|
||||
rotZ = -Math.atan2(targetMatrix.m21,targetMatrix.m22);
|
||||
let rotY = -0.2;
|
||||
return [rotZ, rotY];
|
||||
}
|
||||
|
||||
function resetCameraRotation()
|
||||
{
|
||||
[cameraRotZ, cameraRotY] = getCameraRestRotation(getCameraTarget());
|
||||
}
|
||||
|
||||
//2019 Lucas was here!
|
||||
let DeltaTime = 0;
|
||||
addEventHandler("OnProcess", (event, deltaTime) =>
|
||||
{
|
||||
DeltaTime = deltaTime;
|
||||
if(!localPlayer) {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
let IdleTime = 0;//2019 Lucas was here!
|
||||
|
||||
function processReturnToRestRotation()
|
||||
{
|
||||
//resetCameraRotation();//2019 Lucas was here!
|
||||
|
||||
//2019 Lucas was here!
|
||||
let Target = getCameraTarget();
|
||||
if (!ShouldReturnToRestRotation(Target))
|
||||
return;
|
||||
IdleTime += DeltaTime;
|
||||
if (IdleTime > 1.5)
|
||||
{
|
||||
let Velocity = Target.velocity;
|
||||
let Matrix = Target.matrix;
|
||||
let Speed = getDotProduct(Velocity.x,Velocity.y,Velocity.z,Matrix.getElement(1*4+0),Matrix.getElement(1*4+1),Matrix.getElement(1*4+2));
|
||||
let AbsSpeed = Math.abs(Speed);
|
||||
let Multiplier = Math.min(AbsSpeed/0.75, 1);
|
||||
if (Multiplier != 0)
|
||||
{
|
||||
let [TargetCameraRotZ2, TargetCameraRotY2] = getCameraRestRotation(Target);
|
||||
if (Speed < 0)
|
||||
TargetCameraRotZ2 += Math.PI;
|
||||
let TimeStep = game.timeStep/50*60;
|
||||
cameraRotZ += getDifferenceBetweenAngles(cameraRotZ,TargetCameraRotZ2)*applyMultiplierTimeStep(1/20,TimeStep)*Multiplier;
|
||||
cameraRotY += getDifferenceBetweenAngles(cameraRotY,TargetCameraRotY2)*applyMultiplierTimeStep(1/20,TimeStep)*Multiplier;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function cancelReturnToRestRotation()
|
||||
{
|
||||
IdleTime = 0;//2019 Lucas was here!
|
||||
}
|
||||
|
||||
let distance;
|
||||
let zIncrease;
|
||||
|
||||
function getCameraOffsetInfo(target)
|
||||
{
|
||||
if (GetEntityType(target) == ENTITYTYPE_PED)
|
||||
{
|
||||
let distance = 4;
|
||||
let zIncrease = 0.8;
|
||||
let offsetX = 0;
|
||||
let offsetY = 0;
|
||||
let offsetZ = 0;
|
||||
return [distance, zIncrease, offsetX, offsetY, offsetZ];
|
||||
}
|
||||
let model = GetEntityModel(target);
|
||||
let [radius] = GetModelBoundingSphere(model);
|
||||
let minDistance;
|
||||
let maxDistance;
|
||||
let minZIncrease;
|
||||
let maxZIncrease;
|
||||
let minRadius;
|
||||
let maxRadius;
|
||||
let offsetX;
|
||||
let offsetY;
|
||||
let offsetZ;
|
||||
if (radius <= 3.0535011291504)
|
||||
{
|
||||
minDistance = 4;
|
||||
maxDistance = 8;
|
||||
minZIncrease = 0.5;
|
||||
maxZIncrease = 1;
|
||||
minRadius = 2;
|
||||
maxRadius = 3.0535011291504;
|
||||
}
|
||||
else
|
||||
{
|
||||
minDistance = 8;
|
||||
maxDistance = 16;
|
||||
minZIncrease = 1;
|
||||
maxZIncrease = 2;
|
||||
minRadius = 3.05350112915042;
|
||||
maxRadius = 6.3955960273743;
|
||||
}
|
||||
offsetX = 0;
|
||||
offsetY = 0;
|
||||
offsetZ = 0;
|
||||
distance = minDistance+(radius-minRadius)/(maxRadius-minRadius)*(maxDistance-minDistance);
|
||||
zIncrease = minZIncrease+(radius-minRadius)/(maxRadius-minRadius)*(maxZIncrease-minZIncrease);
|
||||
return [distance, zIncrease, offsetX, offsetY, offsetZ];
|
||||
}
|
||||
|
||||
function update()
|
||||
{
|
||||
let target = getCameraTarget();
|
||||
if (target != null)
|
||||
{
|
||||
if (oldCameraTarget != target)
|
||||
{
|
||||
//if (oldCameraTarget != null)//2019 Lucas was here!
|
||||
let Position = target.position;
|
||||
if (OldPosition == null || getLength(Position.x-OldPosition.x,Position.y-OldPosition.y,Position.z-OldPosition.z) < 10)
|
||||
startCameraEase()
|
||||
resetCameraRotation()
|
||||
}
|
||||
let [mouseSpeedX, mouseSpeedY] = GetMouseSpeed();
|
||||
let [mouseSensitivityX, mouseSensitivityY] = GetMouseSensitivity();
|
||||
mouseSpeedX = mouseSpeedX*mouseSensitivityX*2;
|
||||
mouseSpeedY = mouseSpeedY*mouseSensitivityY*2;
|
||||
if (mouseSpeedX == 0 && mouseSpeedY == 0)
|
||||
{
|
||||
processReturnToRestRotation();
|
||||
}
|
||||
else
|
||||
{
|
||||
cameraRotZ = cameraRotZ-mouseSpeedX;
|
||||
cameraRotY = cameraRotY-mouseSpeedY;
|
||||
cancelReturnToRestRotation();
|
||||
}
|
||||
cameraRotY = Math.max(cameraRotY,-Math.PI/2+0.01);
|
||||
if (GetEntityType(target) != ENTITYTYPE_PED)
|
||||
cameraRotY = Math.min(cameraRotY,Math.PI/8.5);//2019 Lucas was here!
|
||||
else
|
||||
cameraRotY = Math.min(cameraRotY,Math.PI/4);
|
||||
let camera = GetCamera();
|
||||
let targetMatrix = GetPlaceableMatrix(target);
|
||||
let [distance, zIncrease, offsetX, offsetY, offsetZ] = getCameraOffsetInfo(target);
|
||||
let offsetTranslationMatrix = createTranslationMatrix(offsetX, offsetY, offsetZ);
|
||||
targetMatrix = createMultipliedMatrix(offsetTranslationMatrix,targetMatrix);
|
||||
let targetPosX, targetPosY, targetPosZ;
|
||||
if (isRelativeToTarget(target))
|
||||
[targetPosX, targetPosY, targetPosZ] = [0,0,0];
|
||||
else
|
||||
[targetPosX, targetPosY, targetPosZ] = [targetMatrix.m41,targetMatrix.m42,targetMatrix.m43];
|
||||
let distanceTranslationMatrix = createTranslationMatrix(0,-distance,0);
|
||||
targetPosZ = targetPosZ+zIncrease;
|
||||
let targetTranslationMatrix = createTranslationMatrix(targetPosX, targetPosY, targetPosZ);
|
||||
let offsetRotationX = createXRotationMatrix(cameraRotY);
|
||||
let offsetRotationZ = createZRotationMatrix(cameraRotZ);
|
||||
let cameraMatrix = createMultipliedMatrix(cameraIdentityMatrix,distanceTranslationMatrix,offsetRotationX,offsetRotationZ,targetTranslationMatrix);
|
||||
if (isRelativeToTarget(target))
|
||||
{
|
||||
cameraMatrix = createMultipliedMatrix(cameraMatrix,targetMatrix);
|
||||
targetTranslationMatrix = createMultipliedMatrix(targetTranslationMatrix,targetMatrix);
|
||||
}
|
||||
if (isClipped(target))
|
||||
{
|
||||
let startX = targetTranslationMatrix.m41;
|
||||
let startY = targetTranslationMatrix.m42;
|
||||
let startZ = targetTranslationMatrix.m43;
|
||||
let endX = cameraMatrix.m41;
|
||||
let endY = cameraMatrix.m42;
|
||||
let endZ = cameraMatrix.m43;
|
||||
let checkBuildings = true;
|
||||
let checkVehicles = true;
|
||||
let checkPeds = true;
|
||||
let checkObjects = true;
|
||||
let checkDummies = false;
|
||||
let checkSeeThroughStuff = false;
|
||||
let ignoreSomeObjectsForCamera = true;
|
||||
let collisionsEnabled = AreEntityCollisionsEnabled(target);
|
||||
if (collisionsEnabled)
|
||||
SetEntityCollisionsEnabled(target,false);
|
||||
let [positionX,positionY,positionZ,normalX,normalY,normalZ,targetEntity] = ProcessLineOfSight(startX,startY,startZ,endX,endY,endZ,checkBuildings,checkVehicles,checkPeds,checkObjects,checkDummies,checkSeeThroughStuff,ignoreSomeObjectsForCamera);
|
||||
if (collisionsEnabled)
|
||||
SetEntityCollisionsEnabled(target,true);
|
||||
if (positionX != null)
|
||||
{
|
||||
//2019 Lucas was here!
|
||||
let Distance = 0.3;
|
||||
positionX += normalX*Distance;
|
||||
positionY += normalY*Distance;
|
||||
positionZ += normalZ*Distance;
|
||||
|
||||
cameraMatrix.m41 = positionX;
|
||||
cameraMatrix.m42 = positionY;
|
||||
cameraMatrix.m43 = positionZ;
|
||||
}
|
||||
}
|
||||
if (isCameraEasing())
|
||||
cameraMatrix = applyCameraEase(cameraMatrix);
|
||||
SetPlaceableMatrix(camera,cameraMatrix);
|
||||
UpdateCamera(camera);
|
||||
}
|
||||
oldCameraTarget = target;
|
||||
OldPosition = (target != null) ? target.position : null;//2019 Lucas was here!
|
||||
return target != null;
|
||||
}
|
||||
|
||||
addEventHandler("OnCameraProcess", (event) =>
|
||||
{
|
||||
if(mouseCameraEnabled) {
|
||||
update();
|
||||
event.preventDefault();
|
||||
}
|
||||
});
|
||||
|
||||
function toggleMouseCamera() {
|
||||
mouseCameraEnabled = !mouseCameraEnabled;
|
||||
}
|
||||
@@ -1,243 +0,0 @@
|
||||
// ===========================================================================
|
||||
// Vortrex's Roleplay Resource
|
||||
// https://github.com/VortrexFTW/gtac_roleplay
|
||||
// ===========================================================================
|
||||
// FILE: nametags.js
|
||||
// DESC: Provides nametag rendering
|
||||
// TYPE: Client (JavaScript)
|
||||
// ===========================================================================
|
||||
|
||||
// Configuration
|
||||
let nametagFont = null;
|
||||
let afkStatusFont = null;
|
||||
let pingFont = null;
|
||||
let nametagDistance = 50.0;
|
||||
let nametagWidth = 70;
|
||||
|
||||
let playerNames = {};
|
||||
let playerColours = {};
|
||||
let playerPaused = {};
|
||||
let playerPing = {};
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function initNameTagScript() {
|
||||
logToConsole(LOG_DEBUG, "[VRR.NameTag]: Initializing nametag script ...");
|
||||
nametagFont = loadNameTagFont();
|
||||
afkStatusFont = loadPausedStatusFont();
|
||||
logToConsole(LOG_DEBUG, "[VRR.NameTag]: Nametag script initialized!");
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function loadNameTagFont() {
|
||||
return lucasFont.createDefaultFont(12.0, "Roboto", "Light");
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function loadPausedStatusFont() {
|
||||
return lucasFont.createDefaultFont(18.0, "Roboto", "Light");
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function updatePlayerNameTag(clientName, characterName, colour, paused, ping) {
|
||||
playerNames[clientName] = characterName;
|
||||
playerColours[clientName] = colour;
|
||||
playerPaused[clientName] = paused;
|
||||
playerPing[clientName] = ping;
|
||||
|
||||
if(getGame() == VRR_GAME_GTA_IV) {
|
||||
let client = getPlayerFromParams(clientName);
|
||||
if(client != false) {
|
||||
if(getPlayerPed(client) != null) {
|
||||
getPlayerPed(client).setNametag(characterName, colour);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function updatePlayerPing(clientName, ping) {
|
||||
playerPing[clientName] = ping;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function drawNametag(x, y, health, armour, text, ping, alpha, distance, colour, afk, skin) {
|
||||
if(nametagFont == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
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));
|
||||
|
||||
// Starts at bottom and works it's way up
|
||||
// -------------------------------------------
|
||||
// Health Bar
|
||||
|
||||
if(getMultiplayerMod() == VRR_MPMOD_GTAC) {
|
||||
if(getGame() == VRR_GAME_GTA_III) {
|
||||
// Mickey Hamfists is ridiculously tall. Raise the nametag for him a bit
|
||||
if(skin == 109) {
|
||||
y -= 20;
|
||||
} else {
|
||||
y -= 5;
|
||||
}
|
||||
} else {
|
||||
y -= 5;
|
||||
}
|
||||
} else {
|
||||
y -= 5;
|
||||
}
|
||||
|
||||
if(health > 0.0) {
|
||||
let hx = x-width/2;
|
||||
let hy = y-10/2;
|
||||
let colourB = toColour(0, 0, 0, Math.floor(255.0*alpha)); // Background colour (black)
|
||||
graphics.drawRectangle(null, [hx, hy], [width, 8], colourB, colourB, colourB, colourB);
|
||||
let colour = toColour(Math.floor(255.0-(health*255.0)), Math.floor(health*255.0), 0, Math.floor(255.0*alpha)); // Health bar colour (varies, depending on health)
|
||||
graphics.drawRectangle(null, [hx+2, hy+2], [(width-4)*health, 10-6], colour, colour, colour, colour);
|
||||
}
|
||||
|
||||
// Armour Bar
|
||||
if (armour > 0.0)
|
||||
{
|
||||
// Go up 10 pixels to draw the next part
|
||||
y -= 10;
|
||||
let hx = x-width/2;
|
||||
let hy = y-10/2;
|
||||
let colourB = toColour(255, 0, 0, 0); // Background colour (black)
|
||||
graphics.drawRectangle(null, [hx, hy], [width, 8], colourB, colourB, colourB, colourB);
|
||||
let colour = toColour(255, 255, 255, 255); // Armour bar colour (white)
|
||||
graphics.drawRectangle(null, [hx+2, hy+2], [(width-4)*armour, 10-6], colour, colour, colour, colour);
|
||||
}
|
||||
|
||||
y -= 20;
|
||||
|
||||
// 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;
|
||||
|
||||
// AFK Status
|
||||
if(afkStatusFont != null) {
|
||||
if(afk) {
|
||||
let size = afkStatusFont.measure("PAUSED", game.width, 0.0, 0.0, afkStatusFont.size, false, false);
|
||||
afkStatusFont.render("PAUSED", [x-size[0]/2, y-size[1]/2], game.width, 0.0, 0.0, afkStatusFont.size, toColour(255, 0, 0, 255), false, false, false, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function updateNametag(element) {
|
||||
if(!areWorldLabelsSupported()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if(localPlayer != null) {
|
||||
let playerPos = localPlayer.position;
|
||||
let elementPos = element.position;
|
||||
|
||||
elementPos[2] += 0.9;
|
||||
|
||||
//if(typeof element.getComponentPosition()) {
|
||||
|
||||
let screenPos = getScreenFromWorldPosition(elementPos);
|
||||
if (screenPos[2] >= 0.0) {
|
||||
let health = element.health/100.0;
|
||||
if(health > 1.0) {
|
||||
health = 1.0;
|
||||
}
|
||||
|
||||
let armour = element.armour/100.0;
|
||||
if(armour > 1.0) {
|
||||
armour = 1.0;
|
||||
}
|
||||
|
||||
let distance = playerPos.distance(elementPos);
|
||||
if(distance <= nametagDistance) {
|
||||
if(typeof game.processLineOfSight != "undefined") {
|
||||
let losCheck = game.processLineOfSight(playerPos, elementPos, true, false, false, true, true, false, true, true);
|
||||
if(losCheck != null) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if(element.type == ELEMENT_PLAYER) {
|
||||
let name = element.name;
|
||||
let colour = COLOUR_WHITE;
|
||||
let paused = false;
|
||||
let ping = -1;
|
||||
|
||||
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 playerColours[element.name] != "undefined") {
|
||||
colour = playerColours[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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function getClientFromPlayer(player) {
|
||||
getClients().forEach(function(client) {
|
||||
if(getPlayerPed(client) == player) {
|
||||
return client;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function processNameTagRendering(event) {
|
||||
//if(getGame() >= GAME_GTA_IV) {
|
||||
// return false;
|
||||
//}
|
||||
|
||||
getElementsByType(ELEMENT_PED).forEach(function(ped) {
|
||||
if(ped != localPlayer) {
|
||||
updateNametag(ped);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function createColour(alpha, red, green, blue) {
|
||||
return alpha << 24 | red << 16 | green << 8 | blue;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function setNameTagDistance(distance) {
|
||||
nametagDistance = distance;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -37,7 +37,7 @@ function getPlayerPosition() {
|
||||
// ===========================================================================
|
||||
|
||||
function setPlayerPosition(position) {
|
||||
if(getGame() == VRR_GAME_GTA_IV) {
|
||||
if (getGame() == VRR_GAME_GTA_IV) {
|
||||
natives.setCharCoordinates(localPlayer, position);
|
||||
} else {
|
||||
localPlayer.position = position;
|
||||
@@ -59,11 +59,11 @@ function getElementHeading(elementId) {
|
||||
// ===========================================================================
|
||||
|
||||
function setElementPosition(elementId, position) {
|
||||
if(getElementFromId(elementId) == null) {
|
||||
if (getElementFromId(elementId) == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!getElementFromId(elementId).isSyncer) {
|
||||
if (!getElementFromId(elementId).isSyncer) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -73,7 +73,7 @@ function setElementPosition(elementId, position) {
|
||||
// ===========================================================================
|
||||
|
||||
function deleteGameElement(elementId, position) {
|
||||
if(!getElementFromId(elementId).isOwner) {
|
||||
if (!getElementFromId(elementId).isOwner) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -110,8 +110,8 @@ function getElementId(element) {
|
||||
|
||||
function getClientFromIndex(index) {
|
||||
let clients = getClients();
|
||||
for(let i in clients) {
|
||||
if(clients[i].index == index) {
|
||||
for (let i in clients) {
|
||||
if (clients[i].index == index) {
|
||||
return clients[i];
|
||||
}
|
||||
}
|
||||
@@ -170,8 +170,8 @@ function is2dPositionOnScreen(pos2d) {
|
||||
function getVehiclesInRange(position, range) {
|
||||
let vehicles = getElementsByType(ELEMENT_VEHICLE);
|
||||
let inRangeVehicles = [];
|
||||
for(let i in vehicles) {
|
||||
if(getDistance(position, vehicles[i].position) <= range) {
|
||||
for (let i in vehicles) {
|
||||
if (getDistance(position, vehicles[i].position) <= range) {
|
||||
inRangeVehicles.push(vehicles[i]);
|
||||
}
|
||||
}
|
||||
@@ -181,13 +181,13 @@ function getVehiclesInRange(position, range) {
|
||||
// ===========================================================================
|
||||
|
||||
function createGameBlip(blipModel, position, name = "") {
|
||||
if(getGame() == VRR_GAME_GTA_IV) {
|
||||
if (getGame() == VRR_GAME_GTA_IV) {
|
||||
let blipId = natives.addBlipForCoord(position);
|
||||
if(blipId) {
|
||||
if (blipId) {
|
||||
natives.changeBlipSprite(blipId, blipModel);
|
||||
natives.setBlipMarkerLongDistance(blipId, false);
|
||||
natives.setBlipAsShortRange(blipId, true);
|
||||
natives.changeBlipNameFromAscii(blipId, `${name.substr(0, 24)}${(name.length > 24) ? " ...": ""}`);
|
||||
natives.changeBlipNameFromAscii(blipId, `${name.substr(0, 24)}${(name.length > 24) ? " ..." : ""}`);
|
||||
return blipId;
|
||||
}
|
||||
}
|
||||
@@ -198,7 +198,7 @@ function createGameBlip(blipModel, position, name = "") {
|
||||
// ===========================================================================
|
||||
|
||||
function setEntityData(entity, dataName, dataValue, syncToClients = true) {
|
||||
if(entity != null) {
|
||||
if (entity != null) {
|
||||
return entity.setData(dataName, dataValue);
|
||||
}
|
||||
}
|
||||
@@ -224,64 +224,64 @@ function repairVehicle(syncId) {
|
||||
// ===========================================================================
|
||||
|
||||
function syncVehicleProperties(vehicle) {
|
||||
if(doesEntityDataExist(vehicle, "vrr.lights")) {
|
||||
let lightStatus = getEntityData(vehicle, "vrr.lights");
|
||||
if (doesEntityDataExist(vehicle, "agrp.lights")) {
|
||||
let lightStatus = getEntityData(vehicle, "agrp.lights");
|
||||
vehicle.lights = lightStatus;
|
||||
}
|
||||
|
||||
if(doesEntityDataExist(vehicle, "vrr.invincible")) {
|
||||
let invincible = getEntityData(vehicle, "vrr.invincible");
|
||||
if (doesEntityDataExist(vehicle, "agrp.invincible")) {
|
||||
let invincible = getEntityData(vehicle, "agrp.invincible");
|
||||
element.setProofs(invincible, invincible, invincible, invincible, invincible);
|
||||
}
|
||||
|
||||
if(doesEntityDataExist(vehicle, "vrr.panelStatus")) {
|
||||
let panelsStatus = getEntityData(vehicle, "vrr.panelStatus");
|
||||
for(let i in panelsStatus) {
|
||||
if (doesEntityDataExist(vehicle, "agrp.panelStatus")) {
|
||||
let panelsStatus = getEntityData(vehicle, "agrp.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) {
|
||||
if (doesEntityDataExist(vehicle, "agrp.wheelStatus")) {
|
||||
let wheelsStatus = getEntityData(vehicle, "agrp.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) {
|
||||
if (doesEntityDataExist(vehicle, "agrp.lightStatus")) {
|
||||
let lightStatus = getEntityData(vehicle, "agrp.lightStatus");
|
||||
for (let i in lightStatus) {
|
||||
vehicle.setLightStatus(i, lightStatus[i]);
|
||||
}
|
||||
}
|
||||
|
||||
if(doesEntityDataExist(vehicle, "vrr.suspensionHeight")) {
|
||||
let suspensionHeight = getEntityData(vehicle, "vrr.suspensionHeight");
|
||||
if (doesEntityDataExist(vehicle, "agrp.suspensionHeight")) {
|
||||
let suspensionHeight = getEntityData(vehicle, "agrp.suspensionHeight");
|
||||
vehicle.setSuspensionHeight(suspensionHeight);
|
||||
}
|
||||
|
||||
if(getGame() == VRR_GAME_GTA_SA) {
|
||||
if (getGame() == VRR_GAME_GTA_SA) {
|
||||
let allUpgrades = getGameConfig().vehicleUpgrades[getGame()];
|
||||
for(let i in allUpgrades) {
|
||||
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) {
|
||||
if (doesEntityDataExist(vehicle, "agrp.upgrades")) {
|
||||
let upgrades = getEntityData(vehicle, "agrp.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) {
|
||||
if (getGame() == VRR_GAME_GTA_SA || getGame() == VRR_GAME_GTA_IV) {
|
||||
if (doesEntityDataExist(vehicle, "agrp.livery")) {
|
||||
let livery = getEntityData(vehicle, "agrp.livery");
|
||||
if (getGame() == VRR_GAME_GTA_SA) {
|
||||
vehicle.setPaintJob(livery);
|
||||
} else if(getGame() == VRR_GAME_GTA_IV) {
|
||||
} else if (getGame() == VRR_GAME_GTA_IV) {
|
||||
vehicle.livery = livery;
|
||||
}
|
||||
}
|
||||
@@ -291,7 +291,7 @@ function syncVehicleProperties(vehicle) {
|
||||
// ===========================================================================
|
||||
|
||||
function removeEntityData(entity, dataName) {
|
||||
if(entity != null) {
|
||||
if (entity != null) {
|
||||
return entity.removeData(dataName);
|
||||
}
|
||||
return null;
|
||||
@@ -300,7 +300,7 @@ function removeEntityData(entity, dataName) {
|
||||
// ===========================================================================
|
||||
|
||||
function doesEntityDataExist(entity, dataName) {
|
||||
if(entity != null) {
|
||||
if (entity != null) {
|
||||
return (entity.getData(dataName) != null);
|
||||
}
|
||||
return null;
|
||||
@@ -309,9 +309,9 @@ function doesEntityDataExist(entity, dataName) {
|
||||
// ===========================================================================
|
||||
|
||||
function syncCivilianProperties(civilian) {
|
||||
if(getGame() == VRR_GAME_GTA_III) {
|
||||
if(doesEntityDataExist(civilian, "vrr.scale")) {
|
||||
let scaleFactor = getEntityData(civilian, "vrr.scale");
|
||||
if (getGame() == VRR_GAME_GTA_III) {
|
||||
if (doesEntityDataExist(civilian, "agrp.scale")) {
|
||||
let scaleFactor = getEntityData(civilian, "agrp.scale");
|
||||
let tempMatrix = civilian.matrix;
|
||||
tempMatrix.setScale(toVector3(scaleFactor.x, scaleFactor.y, scaleFactor.z));
|
||||
let tempPosition = civilian.position;
|
||||
@@ -321,79 +321,79 @@ function syncCivilianProperties(civilian) {
|
||||
}
|
||||
}
|
||||
|
||||
if(getGame() == VRR_GAME_GTA_SA) {
|
||||
if(doesEntityDataExist(civilian, "vrr.fightStyle")) {
|
||||
let fightStyle = getEntityData(civilian, "vrr.fightStyle");
|
||||
if (getGame() == VRR_GAME_GTA_SA) {
|
||||
if (doesEntityDataExist(civilian, "agrp.fightStyle")) {
|
||||
let fightStyle = getEntityData(civilian, "agrp.fightStyle");
|
||||
civilian.setFightStyle(fightStyle[0], fightStyle[1]);
|
||||
}
|
||||
}
|
||||
|
||||
if(getGame() == VRR_GAME_GTA_III) {
|
||||
if(doesEntityDataExist(civilian, "vrr.walkStyle")) {
|
||||
let walkStyle = getEntityData(civilian, "vrr.walkStyle");
|
||||
if (getGame() == VRR_GAME_GTA_III) {
|
||||
if (doesEntityDataExist(civilian, "agrp.walkStyle")) {
|
||||
let walkStyle = getEntityData(civilian, "agrp.walkStyle");
|
||||
civilian.walkStyle = walkStyle;
|
||||
}
|
||||
}
|
||||
|
||||
if(getGame() == VRR_GAME_GTA_IV) {
|
||||
if(doesEntityDataExist(civilian, "vrr.bodyPropHair")) {
|
||||
let bodyPropHair = getEntityData(civilian, "vrr.bodyPropHair");
|
||||
if (getGame() == VRR_GAME_GTA_IV) {
|
||||
if (doesEntityDataExist(civilian, "agrp.bodyPropHair")) {
|
||||
let bodyPropHair = getEntityData(civilian, "agrp.bodyPropHair");
|
||||
civilian.changeBodyProp(0, bodyPropHair[0], bodyPropHair[1]);
|
||||
}
|
||||
|
||||
if(doesEntityDataExist(civilian, "vrr.bodyPropHead")) {
|
||||
let bodyPropHead = getEntityData(civilian, "vrr.bodyPropHead");
|
||||
if (doesEntityDataExist(civilian, "agrp.bodyPropHead")) {
|
||||
let bodyPropHead = getEntityData(civilian, "agrp.bodyPropHead");
|
||||
civilian.changeBodyProp(1, bodyPropHead[0], bodyPropHead[1]);
|
||||
}
|
||||
|
||||
if(doesEntityDataExist(civilian, "vrr.bodyPropEyes")) {
|
||||
let bodyPropEyes = getEntityData(civilian, "vrr.bodyPropEyes");
|
||||
if (doesEntityDataExist(civilian, "agrp.bodyPropEyes")) {
|
||||
let bodyPropEyes = getEntityData(civilian, "agrp.bodyPropEyes");
|
||||
civilian.changeBodyProp(1, bodyPropEyes[0], bodyPropEyes[1]);
|
||||
}
|
||||
|
||||
if(doesEntityDataExist(civilian, "vrr.bodyPropLeftHand")) {
|
||||
let bodyPropLeftHand = getEntityData(civilian, "vrr.bodyPropLeftHand");
|
||||
if (doesEntityDataExist(civilian, "agrp.bodyPropLeftHand")) {
|
||||
let bodyPropLeftHand = getEntityData(civilian, "agrp.bodyPropLeftHand");
|
||||
civilian.changeBodyProp(1, bodyPropLeftHand[0], bodyPropLeftHand[1]);
|
||||
}
|
||||
|
||||
if(doesEntityDataExist(civilian, "vrr.bodyPropRightHand")) {
|
||||
let bodyPropRightHand = getEntityData(civilian, "vrr.bodyPropRightHand");
|
||||
if (doesEntityDataExist(civilian, "agrp.bodyPropRightHand")) {
|
||||
let bodyPropRightHand = getEntityData(civilian, "agrp.bodyPropRightHand");
|
||||
civilian.changeBodyProp(1, bodyPropRightHand[0], bodyPropRightHand[1]);
|
||||
}
|
||||
|
||||
if(doesEntityDataExist(civilian, "vrr.bodyPropLeftWrist")) {
|
||||
let bodyPropLeftWrist = getEntityData(civilian, "vrr.bodyPropLeftWrist");
|
||||
if (doesEntityDataExist(civilian, "agrp.bodyPropLeftWrist")) {
|
||||
let bodyPropLeftWrist = getEntityData(civilian, "agrp.bodyPropLeftWrist");
|
||||
civilian.changeBodyProp(1, bodyPropLeftWrist[0], bodyPropLeftWrist[1]);
|
||||
}
|
||||
|
||||
if(doesEntityDataExist(civilian, "vrr.bodyPropRightWrist")) {
|
||||
let bodyPropRightWrist = getEntityData(civilian, "vrr.bodyPropRightWrist");
|
||||
if (doesEntityDataExist(civilian, "agrp.bodyPropRightWrist")) {
|
||||
let bodyPropRightWrist = getEntityData(civilian, "agrp.bodyPropRightWrist");
|
||||
civilian.changeBodyProp(1, bodyPropRightWrist[0], bodyPropRightWrist[1]);
|
||||
}
|
||||
|
||||
if(doesEntityDataExist(civilian, "vrr.bodyPropRightWrist")) {
|
||||
let bodyPropRightWrist = getEntityData(civilian, "vrr.bodyPropRightWrist");
|
||||
if (doesEntityDataExist(civilian, "agrp.bodyPropRightWrist")) {
|
||||
let bodyPropRightWrist = getEntityData(civilian, "agrp.bodyPropRightWrist");
|
||||
civilian.changeBodyProp(1, bodyPropRightWrist[0], bodyPropRightWrist[1]);
|
||||
}
|
||||
|
||||
if(doesEntityDataExist(civilian, "vrr.bodyPropHip")) {
|
||||
let bodyPropHip = getEntityData(civilian, "vrr.bodyPropHip");
|
||||
if (doesEntityDataExist(civilian, "agrp.bodyPropHip")) {
|
||||
let bodyPropHip = getEntityData(civilian, "agrp.bodyPropHip");
|
||||
civilian.changeBodyProp(1, bodyPropHip[0], bodyPropHip[1]);
|
||||
}
|
||||
|
||||
if(doesEntityDataExist(civilian, "vrr.bodyPropLeftFoot")) {
|
||||
let bodyPropLeftFoot = getEntityData(civilian, "vrr.bodyPropLeftFoot");
|
||||
if (doesEntityDataExist(civilian, "agrp.bodyPropLeftFoot")) {
|
||||
let bodyPropLeftFoot = getEntityData(civilian, "agrp.bodyPropLeftFoot");
|
||||
civilian.changeBodyProp(1, bodyPropLeftFoot[0], bodyPropLeftFoot[1]);
|
||||
}
|
||||
|
||||
if(doesEntityDataExist(civilian, "vrr.bodyPropRightFoot")) {
|
||||
let bodyPropRightFoot = getEntityData(civilian, "vrr.bodyPropRightFoot");
|
||||
if (doesEntityDataExist(civilian, "agrp.bodyPropRightFoot")) {
|
||||
let bodyPropRightFoot = getEntityData(civilian, "agrp.bodyPropRightFoot");
|
||||
civilian.changeBodyProp(1, bodyPropRightFoot[0], bodyPropRightFoot[1]);
|
||||
}
|
||||
}
|
||||
|
||||
if(doesEntityDataExist(civilian, "vrr.anim")) {
|
||||
let animData = getEntityData(vehicle, "vrr.anim");
|
||||
if (doesEntityDataExist(civilian, "agrp.anim")) {
|
||||
let animData = getEntityData(vehicle, "agrp.anim");
|
||||
civilian.addAnimation(animData[0], animData[1]);
|
||||
}
|
||||
}
|
||||
@@ -407,9 +407,9 @@ function preventDefaultEventAction(event) {
|
||||
// ===========================================================================
|
||||
|
||||
function syncPlayerProperties(player) {
|
||||
if(getGame() == VRR_GAME_GTA_III) {
|
||||
if(doesEntityDataExist(player, "vrr.scale")) {
|
||||
let scaleFactor = getEntityData(player, "vrr.scale");
|
||||
if (getGame() == VRR_GAME_GTA_III) {
|
||||
if (doesEntityDataExist(player, "agrp.scale")) {
|
||||
let scaleFactor = getEntityData(player, "agrp.scale");
|
||||
let tempMatrix = player.matrix;
|
||||
tempMatrix.setScale(toVector3(scaleFactor.x, scaleFactor.y, scaleFactor.z));
|
||||
let tempPosition = player.position;
|
||||
@@ -419,95 +419,95 @@ function syncPlayerProperties(player) {
|
||||
}
|
||||
}
|
||||
|
||||
if(getGame() == VRR_GAME_GTA_SA) {
|
||||
if(doesEntityDataExist(player, "vrr.fightStyle")) {
|
||||
let fightStyle = getEntityData(player, "vrr.fightStyle");
|
||||
if (getGame() == VRR_GAME_GTA_SA) {
|
||||
if (doesEntityDataExist(player, "agrp.fightStyle")) {
|
||||
let fightStyle = getEntityData(player, "agrp.fightStyle");
|
||||
player.setFightStyle(fightStyle[0], fightStyle[1]);
|
||||
}
|
||||
}
|
||||
|
||||
//if(getGame() == VRR_GAME_GTA_SA) {
|
||||
// if(doesEntityDataExist(player, "vrr.walkStyle")) {
|
||||
// let walkStyle = getEntityData(player, "vrr.walkStyle");
|
||||
// if(doesEntityDataExist(player, "agrp.walkStyle")) {
|
||||
// let walkStyle = getEntityData(player, "agrp.walkStyle");
|
||||
// player.walkStyle = walkStyle;
|
||||
// }
|
||||
//}
|
||||
|
||||
if(getGame() == VRR_GAME_GTA_IV) {
|
||||
if(doesEntityDataExist(player, "vrr.bodyPartHair")) {
|
||||
let bodyPartHead = getEntityData(player, "vrr.bodyPartHair");
|
||||
if (getGame() == VRR_GAME_GTA_IV) {
|
||||
if (doesEntityDataExist(player, "agrp.bodyPartHair")) {
|
||||
let bodyPartHead = getEntityData(player, "agrp.bodyPartHair");
|
||||
player.changeBodyPart(0, bodyPartHead[0], bodyPartHair[1]);
|
||||
}
|
||||
|
||||
if(doesEntityDataExist(player, "vrr.bodyPartHead")) {
|
||||
let bodyPartHead = getEntityData(player, "vrr.bodyPartHead");
|
||||
if (doesEntityDataExist(player, "agrp.bodyPartHead")) {
|
||||
let bodyPartHead = getEntityData(player, "agrp.bodyPartHead");
|
||||
player.changeBodyPart(1, bodyPartHead[0], bodyPartHead[1]);
|
||||
}
|
||||
|
||||
if(doesEntityDataExist(player, "vrr.bodyPartUpper")) {
|
||||
let bodyPartUpper = getEntityData(player, "vrr.bodyPartUpper");
|
||||
if (doesEntityDataExist(player, "agrp.bodyPartUpper")) {
|
||||
let bodyPartUpper = getEntityData(player, "agrp.bodyPartUpper");
|
||||
player.changeBodyPart(1, bodyPartUpper[0], bodyPartUpper[1]);
|
||||
}
|
||||
|
||||
if(doesEntityDataExist(player, "vrr.bodyPartLower")) {
|
||||
let bodyPartLower = getEntityData(player, "vrr.bodyPartLower");
|
||||
if (doesEntityDataExist(player, "agrp.bodyPartLower")) {
|
||||
let bodyPartLower = getEntityData(player, "agrp.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");
|
||||
if (getGame() == VRR_GAME_GTA_IV) {
|
||||
if (doesEntityDataExist(player, "agrp.bodyPropHair")) {
|
||||
let bodyPropHair = getEntityData(player, "agrp.bodyPropHair");
|
||||
player.changeBodyProp(0, bodyPropHair[0], bodyPropHair[1]);
|
||||
}
|
||||
|
||||
if(doesEntityDataExist(player, "vrr.bodyPropHead")) {
|
||||
let bodyPropHead = getEntityData(player, "vrr.bodyPropHead");
|
||||
if (doesEntityDataExist(player, "agrp.bodyPropHead")) {
|
||||
let bodyPropHead = getEntityData(player, "agrp.bodyPropHead");
|
||||
player.changeBodyProp(1, bodyPropHead[0], bodyPropHead[1]);
|
||||
}
|
||||
|
||||
if(doesEntityDataExist(player, "vrr.bodyPropEyes")) {
|
||||
let bodyPropEyes = getEntityData(player, "vrr.bodyPropEyes");
|
||||
if (doesEntityDataExist(player, "agrp.bodyPropEyes")) {
|
||||
let bodyPropEyes = getEntityData(player, "agrp.bodyPropEyes");
|
||||
player.changeBodyProp(1, bodyPropEyes[0], bodyPropEyes[1]);
|
||||
}
|
||||
|
||||
if(doesEntityDataExist(player, "vrr.bodyPropLeftHand")) {
|
||||
let bodyPropLeftHand = getEntityData(player, "vrr.bodyPropLeftHand");
|
||||
if (doesEntityDataExist(player, "agrp.bodyPropLeftHand")) {
|
||||
let bodyPropLeftHand = getEntityData(player, "agrp.bodyPropLeftHand");
|
||||
player.changeBodyProp(1, bodyPropLeftHand[0], bodyPropLeftHand[1]);
|
||||
}
|
||||
|
||||
if(doesEntityDataExist(player, "vrr.bodyPropRightHand")) {
|
||||
let bodyPropRightHand = getEntityData(player, "vrr.bodyPropRightHand");
|
||||
if (doesEntityDataExist(player, "agrp.bodyPropRightHand")) {
|
||||
let bodyPropRightHand = getEntityData(player, "agrp.bodyPropRightHand");
|
||||
player.changeBodyProp(1, bodyPropRightHand[0], bodyPropRightHand[1]);
|
||||
}
|
||||
|
||||
if(doesEntityDataExist(player, "vrr.bodyPropLeftWrist")) {
|
||||
let bodyPropLeftWrist = getEntityData(player, "vrr.bodyPropLeftWrist");
|
||||
if (doesEntityDataExist(player, "agrp.bodyPropLeftWrist")) {
|
||||
let bodyPropLeftWrist = getEntityData(player, "agrp.bodyPropLeftWrist");
|
||||
player.changeBodyProp(1, bodyPropLeftWrist[0], bodyPropLeftWrist[1]);
|
||||
}
|
||||
|
||||
if(doesEntityDataExist(player, "vrr.bodyPropRightWrist")) {
|
||||
let bodyPropRightWrist = getEntityData(player, "vrr.bodyPropRightWrist");
|
||||
if (doesEntityDataExist(player, "agrp.bodyPropRightWrist")) {
|
||||
let bodyPropRightWrist = getEntityData(player, "agrp.bodyPropRightWrist");
|
||||
player.changeBodyProp(1, bodyPropRightWrist[0], bodyPropRightWrist[1]);
|
||||
}
|
||||
|
||||
if(doesEntityDataExist(player, "vrr.bodyPropRightWrist")) {
|
||||
let bodyPropRightWrist = getEntityData(player, "vrr.bodyPropRightWrist");
|
||||
if (doesEntityDataExist(player, "agrp.bodyPropRightWrist")) {
|
||||
let bodyPropRightWrist = getEntityData(player, "agrp.bodyPropRightWrist");
|
||||
player.changeBodyProp(1, bodyPropRightWrist[0], bodyPropRightWrist[1]);
|
||||
}
|
||||
|
||||
if(doesEntityDataExist(player, "vrr.bodyPropHip")) {
|
||||
let bodyPropHip = getEntityData(player, "vrr.bodyPropHip");
|
||||
if (doesEntityDataExist(player, "agrp.bodyPropHip")) {
|
||||
let bodyPropHip = getEntityData(player, "agrp.bodyPropHip");
|
||||
player.changeBodyProp(1, bodyPropHip[0], bodyPropHip[1]);
|
||||
}
|
||||
|
||||
if(doesEntityDataExist(player, "vrr.bodyPropLeftFoot")) {
|
||||
let bodyPropLeftFoot = getEntityData(player, "vrr.bodyPropLeftFoot");
|
||||
if (doesEntityDataExist(player, "agrp.bodyPropLeftFoot")) {
|
||||
let bodyPropLeftFoot = getEntityData(player, "agrp.bodyPropLeftFoot");
|
||||
player.changeBodyProp(1, bodyPropLeftFoot[0], bodyPropLeftFoot[1]);
|
||||
}
|
||||
|
||||
if(doesEntityDataExist(player, "vrr.bodyPropRightFoot")) {
|
||||
let bodyPropRightFoot = getEntityData(player, "vrr.bodyPropRightFoot");
|
||||
if (doesEntityDataExist(player, "agrp.bodyPropRightFoot")) {
|
||||
let bodyPropRightFoot = getEntityData(player, "agrp.bodyPropRightFoot");
|
||||
player.changeBodyProp(1, bodyPropRightFoot[0], bodyPropRightFoot[1]);
|
||||
}
|
||||
}
|
||||
@@ -516,9 +516,9 @@ function syncPlayerProperties(player) {
|
||||
// ===========================================================================
|
||||
|
||||
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");
|
||||
if (getGame() == VRR_GAME_GTA_III || getGame() == VRR_GAME_GTA_VC) {
|
||||
if (doesEntityDataExist(object, "agrp.scale")) {
|
||||
let scaleFactor = getEntityData(object, "agrp.scale");
|
||||
let tempMatrix = object.matrix;
|
||||
tempMatrix.setScale(toVector3(scaleFactor.x, scaleFactor.y, scaleFactor.z));
|
||||
let tempPosition = object.position;
|
||||
@@ -568,13 +568,13 @@ function getPlayerId(client) {
|
||||
// ===========================================================================
|
||||
|
||||
function syncElementProperties(element) {
|
||||
if(doesEntityDataExist(element, "vrr.interior")) {
|
||||
if(typeof element.interior != "undefined") {
|
||||
element.interior = getEntityData(element, "vrr.interior");
|
||||
if (doesEntityDataExist(element, "agrp.interior")) {
|
||||
if (typeof element.interior != "undefined") {
|
||||
element.interior = getEntityData(element, "agrp.interior");
|
||||
}
|
||||
}
|
||||
|
||||
switch(element.type) {
|
||||
switch (element.type) {
|
||||
case ELEMENT_VEHICLE:
|
||||
syncVehicleProperties(element);
|
||||
break;
|
||||
@@ -619,23 +619,23 @@ function getScreenHeight() {
|
||||
// ===========================================================================
|
||||
|
||||
function openAllGarages() {
|
||||
switch(getGame()) {
|
||||
switch (getGame()) {
|
||||
case VRR_GAME_GTA_III:
|
||||
for(let i=0;i<=26;i++) {
|
||||
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++) {
|
||||
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++) {
|
||||
for (let i = 0; i <= 44; i++) {
|
||||
openGarage(i);
|
||||
}
|
||||
break;
|
||||
@@ -648,23 +648,23 @@ function openAllGarages() {
|
||||
// ===========================================================================
|
||||
|
||||
function closeAllGarages() {
|
||||
switch(getGame()) {
|
||||
switch (getGame()) {
|
||||
case VRR_GAME_GTA_III:
|
||||
for(let i=0;i<=26;i++) {
|
||||
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++) {
|
||||
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++) {
|
||||
for (let i = 0; i <= 44; i++) {
|
||||
closeGarage(i);
|
||||
}
|
||||
break;
|
||||
@@ -683,7 +683,7 @@ function setPedInvincible(ped, state) {
|
||||
// ===========================================================================
|
||||
|
||||
function setPedLookAt(ped, position) {
|
||||
if(getGame() == VRR_GAME_GTA_SA) {
|
||||
if (getGame() == VRR_GAME_GTA_SA) {
|
||||
ped.lookAt(position, 10000);
|
||||
return true;
|
||||
} else {
|
||||
|
||||
385
scripts/client/netevents.js
Normal file
@@ -0,0 +1,385 @@
|
||||
// ===========================================================================
|
||||
// Vortrex's Roleplay Resource
|
||||
// https://github.com/VortrexFTW/gtac_roleplay
|
||||
// ===========================================================================
|
||||
// FILE: netevents.js
|
||||
// DESC: Provides server communication and cross-endpoint network events
|
||||
// TYPE: Client (JavaScript)
|
||||
// ===========================================================================
|
||||
|
||||
function initNetworkEventsScript() {
|
||||
logToConsole(LOG_DEBUG, "[VRR.Server]: Initializing server script ...");
|
||||
addAllNetworkEventHandlers();
|
||||
logToConsole(LOG_DEBUG, "[VRR.Server]: Server script initialized!");
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function addAllNetworkEventHandlers() {
|
||||
logToConsole(LOG_DEBUG, "[VRR.Server]: Adding network handlers ...");
|
||||
|
||||
// Chat history
|
||||
addNetworkEventHandler("m", receiveChatBoxMessageFromServer); // Not prefixed with VRR to make it as small as possible
|
||||
addNetworkEventHandler("agrp.chatScrollLines", setChatScrollLines);
|
||||
addNetworkEventHandler("agrp.chatAutoHideDelay", setChatAutoHideDelay);
|
||||
|
||||
// Messaging (like textdraws and stuff)
|
||||
addNetworkEventHandler("agrp.smallGameMessage", showSmallGameMessage);
|
||||
|
||||
// Job
|
||||
addNetworkEventHandler("agrp.job", receiveJobFromServer);
|
||||
addNetworkEventHandler("agrp.working", setLocalPlayerWorkingState);
|
||||
addNetworkEventHandler("agrp.jobType", setLocalPlayerJobType);
|
||||
addNetworkEventHandler("agrp.showJobRouteLocation", showJobRouteLocation);
|
||||
addNetworkEventHandler("agrp.hideJobRouteLocation", hideJobRouteLocation);
|
||||
|
||||
// Local player states and values
|
||||
addNetworkEventHandler("agrp.restoreCamera", restoreLocalCamera);
|
||||
addNetworkEventHandler("agrp.cameraLookAt", setLocalCameraLookAt);
|
||||
addNetworkEventHandler("agrp.freeze", setLocalPlayerFrozenState);
|
||||
addNetworkEventHandler("agrp.control", setLocalPlayerControlState);
|
||||
addNetworkEventHandler("agrp.fadeCamera", fadeLocalCamera);
|
||||
addNetworkEventHandler("agrp.removeFromVehicle", removeLocalPlayerFromVehicle);
|
||||
addNetworkEventHandler("agrp.clearWeapons", clearLocalPlayerWeapons);
|
||||
addNetworkEventHandler("agrp.giveWeapon", giveLocalPlayerWeapon);
|
||||
addNetworkEventHandler("agrp.position", setLocalPlayerPosition);
|
||||
addNetworkEventHandler("agrp.heading", setLocalPlayerHeading);
|
||||
addNetworkEventHandler("agrp.interior", setLocalPlayerInterior);
|
||||
addNetworkEventHandler("agrp.spawned", onServerSpawnedLocalPlayer);
|
||||
addNetworkEventHandler("agrp.money", setLocalPlayerCash);
|
||||
addNetworkEventHandler("agrp.armour", setLocalPlayerArmour);
|
||||
addNetworkEventHandler("agrp.localPlayerSkin", setLocalPlayerSkin);
|
||||
addNetworkEventHandler("agrp.pedSpeak", makeLocalPlayerPedSpeak);
|
||||
addNetworkEventHandler("agrp.infiniteRun", setLocalPlayerInfiniteRun);
|
||||
addNetworkEventHandler("agrp.playerCop", setLocalPlayerAsCopState);
|
||||
addNetworkEventHandler("agrp.health", setLocalPlayerHealth);
|
||||
addNetworkEventHandler("agrp.wantedLevel", setLocalPlayerWantedLevel);
|
||||
addNetworkEventHandler("agrp.playerPedId", sendLocalPlayerNetworkIdToServer);
|
||||
addNetworkEventHandler("agrp.ped", setLocalPlayerPedPartsAndProps);
|
||||
addNetworkEventHandler("agrp.spawn", serverRequestedLocalPlayerSpawn);
|
||||
addNetworkEventHandler("agrp.clearPedState", clearLocalPedState);
|
||||
addNetworkEventHandler("agrp.drunkEffect", setLocalPlayerDrunkEffect);
|
||||
|
||||
// Vehicle
|
||||
addNetworkEventHandler("agrp.vehicle", receiveVehicleFromServer);
|
||||
addNetworkEventHandler("agrp.veh.lights", setVehicleLights);
|
||||
addNetworkEventHandler("agrp.veh.engine", setVehicleEngine);
|
||||
addNetworkEventHandler("agrp.veh.repair", repairVehicle);
|
||||
|
||||
// Radio
|
||||
addNetworkEventHandler("agrp.radioStream", playStreamingRadio);
|
||||
addNetworkEventHandler("agrp.audioFileStream", playAudioFile);
|
||||
addNetworkEventHandler("agrp.stopRadioStream", stopStreamingRadio);
|
||||
addNetworkEventHandler("agrp.radioVolume", setStreamingRadioVolume);
|
||||
|
||||
// Key Bindings
|
||||
addNetworkEventHandler("agrp.delKeyBind", unBindAccountKey);
|
||||
addNetworkEventHandler("agrp.addKeyBind", bindAccountKey);
|
||||
addNetworkEventHandler("agrp.clearKeyBinds", clearKeyBinds);
|
||||
|
||||
// Weapon Damage
|
||||
addNetworkEventHandler("agrp.weaponDamageEnabled", setPlayerWeaponDamageEnabled);
|
||||
addNetworkEventHandler("agrp.weaponDamageEvent", setPlayerWeaponDamageEvent);
|
||||
|
||||
// Business
|
||||
addNetworkEventHandler("agrp.business", receiveBusinessFromServer);
|
||||
|
||||
// House
|
||||
addNetworkEventHandler("agrp.house", receiveHouseFromServer);
|
||||
|
||||
// GPS
|
||||
addNetworkEventHandler("agrp.showGPSBlip", showGPSLocation);
|
||||
|
||||
// Locale
|
||||
addNetworkEventHandler("agrp.locale", setLocale);
|
||||
|
||||
// Misc
|
||||
addNetworkEventHandler("agrp.mouseCursor", toggleMouseCursor);
|
||||
addNetworkEventHandler("agrp.clearPeds", clearLocalPlayerOwnedPeds);
|
||||
addNetworkEventHandler("agrp.passenger", enterVehicleAsPassenger);
|
||||
addNetworkEventHandler("agrp.ambience", setCityAmbienceState);
|
||||
addNetworkEventHandler("agrp.runCode", runClientCode);
|
||||
addNetworkEventHandler("agrp.minuteDuration", setMinuteDuration);
|
||||
addNetworkEventHandler("agrp.snow", setSnowState);
|
||||
addNetworkEventHandler("agrp.enterPropertyKey", setEnterPropertyKey);
|
||||
addNetworkEventHandler("agrp.skinSelect", toggleSkinSelect);
|
||||
addNetworkEventHandler("agrp.hotbar", updatePlayerHotBar);
|
||||
addNetworkEventHandler("agrp.showItemActionDelay", showItemActionDelay);
|
||||
addNetworkEventHandler("agrp.set2DRendering", set2DRendering);
|
||||
addNetworkEventHandler("agrp.logLevel", setLogLevel);
|
||||
addNetworkEventHandler("agrp.anim", makePedPlayAnimation);
|
||||
addNetworkEventHandler("agrp.stopAnim", makePedStopAnimation);
|
||||
addNetworkEventHandler("agrp.forceAnim", forcePedAnimation);
|
||||
addNetworkEventHandler("agrp.clientInfo", serverRequestedClientInfo);
|
||||
addNetworkEventHandler("agrp.interiorLights", updateInteriorLightsState);
|
||||
addNetworkEventHandler("agrp.cutsceneInterior", setCutsceneInterior);
|
||||
addNetworkEventHandler("agrp.syncElement", forceSyncElementProperties);
|
||||
addNetworkEventHandler("agrp.elementPosition", setElementPosition);
|
||||
addNetworkEventHandler("agrp.elementCollisions", setElementCollisionsEnabled);
|
||||
addNetworkEventHandler("agrp.vehBuyState", setVehiclePurchaseState);
|
||||
addNetworkEventHandler("agrp.holdObject", makePedHoldObject);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function sendResourceReadySignalToServer() {
|
||||
sendNetworkEventToServer("agrp.clientReady");
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function sendResourceStartedSignalToServer() {
|
||||
sendNetworkEventToServer("agrp.clientStarted");
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function sendResourceStoppedSignalToServer() {
|
||||
if (isConnected) {
|
||||
sendNetworkEventToServer("agrp.clientStopped");
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function set2DRendering(hudState, labelState, smallGameMessageState, scoreboardState, hotBarState, itemActionDelayState) {
|
||||
logToConsole(LOG_DEBUG, `[VRR.Main] Updating render states (HUD: ${hudState}, Labels: ${labelState}, Bottom Text: ${smallGameMessageState}, Scoreboard: ${scoreboardState}, HotBar: ${hotBarState}, Item Action Delay: ${itemActionDelayState})`);
|
||||
renderHUD = hudState;
|
||||
|
||||
if (getGame() == VRR_GAME_GTA_IV) {
|
||||
natives.displayCash(hudState);
|
||||
natives.displayAmmo(hudState);
|
||||
natives.displayHud(hudState);
|
||||
natives.displayRadar(hudState);
|
||||
natives.displayAreaName(hudState);
|
||||
} else {
|
||||
if (typeof setHUDEnabled != "undefined") {
|
||||
setHUDEnabled(hudState);
|
||||
}
|
||||
}
|
||||
|
||||
renderLabels = labelState;
|
||||
renderSmallGameMessage = smallGameMessageState;
|
||||
renderScoreBoard = scoreboardState;
|
||||
renderHotBar = hotBarState;
|
||||
renderItemActionDelay = itemActionDelayState;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function onServerSpawnedLocalPlayer(state) {
|
||||
logToConsole(LOG_DEBUG, `[VRR.Main] Setting spawned state to ${state}`);
|
||||
isSpawned = state;
|
||||
setUpInitialGame();
|
||||
if (state) {
|
||||
setTimeout(function () {
|
||||
calledDeathEvent = false;
|
||||
}, 1000);
|
||||
|
||||
getElementsByType(ELEMENT_PED).filter(ped => !ped.isType(ELEMENT_PLAYER)).forEach(ped => {
|
||||
syncCivilianProperties(ped);
|
||||
});
|
||||
|
||||
getElementsByType(ELEMENT_PLAYER).forEach(player => {
|
||||
syncPlayerProperties(player);
|
||||
});
|
||||
|
||||
getElementsByType(ELEMENT_VEHICLE).forEach(vehicle => {
|
||||
syncVehicleProperties(vehicle);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function tellServerPlayerUsedKeyBind(key) {
|
||||
sendNetworkEventToServer("agrp.useKeyBind", key);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function tellServerPlayerArrivedAtJobRouteLocation() {
|
||||
sendNetworkEventToServer("agrp.arrivedAtJobRouteLocation");
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function tellServerItemActionDelayComplete() {
|
||||
sendNetworkEventToServer("agrp.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("agrp.clientInfo", clientVersion, game.width, game.height);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function sendServerNewAFKStatus(state) {
|
||||
sendNetworkEventToServer("agrp.afk", state);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function anchorBoat(vehicleId) {
|
||||
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function setEnterPropertyKey(key) {
|
||||
enterPropertyKey = key;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function serverRequestedClientInfo() {
|
||||
sendServerClientInfo();
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function updateInteriorLightsState(state) {
|
||||
interiorLightsEnabled = state;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function forceSyncElementProperties(elementId) {
|
||||
if (getElementFromId(elementId) == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
syncElementProperties(getElementFromId(elementId));
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function setElementCollisionsEnabled(elementId, state) {
|
||||
if (getElementFromId(elementId) == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
getElementFromId(elementId).collisionsEnabled = state;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function setLocalPlayerArmour(armour) {
|
||||
if (typeof localPlayer.armour != "undefined") {
|
||||
localPlayer.armour = armour;
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function setLocalPlayerWantedLevel(wantedLevel) {
|
||||
forceWantedLevel = toInteger(wantedLevel);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function setLogLevel(level) {
|
||||
logLevel = level;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function setLocalPlayerInfiniteRun(state) {
|
||||
if (localPlayer != null) {
|
||||
if (getGame() == VRR_GAME_GTA_III || getGame() == VRR_GAME_GTA_VC) {
|
||||
game.SET_PLAYER_NEVER_GETS_TIRED(game.GET_PLAYER_ID(), boolToInt(state));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function setLocalPlayerSkin(skinId) {
|
||||
logToConsole(LOG_INFO, `[VRR.Server] Setting locale player skin to ${skinId}`);
|
||||
if (getGame() == VRR_GAME_GTA_IV) {
|
||||
natives.changePlayerModel(natives.getPlayerId(), skinId);
|
||||
} else {
|
||||
localPlayer.skin = skinId;
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function makePedHoldObject(pedId, modelIndex) {
|
||||
if (getGame() == VRR_GAME_GTA_IV) {
|
||||
natives.givePedAmbientObject(natives.getPedFromNetworkId(pedId), getGameConfig().objects[getGame()][modelIndex][1])
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function sendLocalPlayerNetworkIdToServer() {
|
||||
sendNetworkEventToServer("agrp.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("agrp.localeSelect", localeId);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
function processNPCMovement(npc) {
|
||||
//if(npc.isSyncer == true) {
|
||||
if(getEntityData(npc, "vrr.lookAtClosestPlayer") == true) {
|
||||
if (getEntityData(npc, "agrp.lookAtClosestPlayer") == true) {
|
||||
let closestPlayer = getClosestPlayer(getElementPosition(npc.id));
|
||||
setPedLookAt(npc, getElementPosition(closestPlayer.id));
|
||||
}
|
||||
|
||||
@@ -1,104 +0,0 @@
|
||||
// ===========================================================================
|
||||
// Vortrex's Roleplay Resource
|
||||
// https://github.com/VortrexFTW/gtac_roleplay
|
||||
// ===========================================================================
|
||||
// FILE: scoreboard.js
|
||||
// DESC: Provides scoreboard features and rendering
|
||||
// TYPE: Client (JavaScript)
|
||||
// ===========================================================================
|
||||
|
||||
let scoreBoardTitleFont = null;
|
||||
let scoreBoardListFont = null;
|
||||
|
||||
let pausedColour = COLOUR_RED;
|
||||
|
||||
let scoreboardKey = SDLK_TAB;
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function initScoreBoardScript() {
|
||||
logToConsole(LOG_DEBUG, "[VRR.ScoreBoard]: Initializing scoreboard script ...");
|
||||
scoreBoardTitleFont = initScoreBoardTitleFont();
|
||||
scoreBoardListFont = initScoreBoardListFont();
|
||||
logToConsole(LOG_DEBUG, "[VRR.ScoreBoard]: Scoreboard script initialized!");
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function initScoreBoardTitleFont() {
|
||||
return lucasFont.createDefaultFont(22.0, "Roboto", "Regular");
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function initScoreBoardListFont() {
|
||||
return lucasFont.createDefaultFont(12.0, "Roboto", "Light");
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function processScoreBoardRendering() {
|
||||
if(isAnyGUIActive()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if(renderScoreBoard) {
|
||||
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);
|
||||
scoreBoardTitleFont.render("PLAYERS", [game.width/2, scoreboardStart-50], 0, 0.5, 0.0, scoreBoardTitleFont.size, COLOUR_WHITE, false, false, false, true);
|
||||
|
||||
titleSize = scoreBoardTitleFont.measure("____________________________", game.width, 0.0, 1.0, 10, false, false);
|
||||
scoreBoardTitleFont.render("____________________________", [game.width/2, scoreboardStart-35], 0, 0.5, 0.0, scoreBoardTitleFont.size, COLOUR_WHITE, false, false, false, true);
|
||||
|
||||
let clients = getClients();
|
||||
for(let i in clients) {
|
||||
if(!clients[i].console) {
|
||||
let name = clients[i].name;
|
||||
let colour = COLOUR_WHITE;
|
||||
let paused = false;
|
||||
let ping = "-1";
|
||||
|
||||
if(typeof playerNames[clients[i].name] != "undefined") {
|
||||
name = playerNames[clients[i].name];
|
||||
}
|
||||
|
||||
if(typeof playerPaused[clients[i].name] != "undefined") {
|
||||
paused = playerPaused[clients[i].name];
|
||||
}
|
||||
|
||||
if(typeof playerColours[clients[i].name] != "undefined") {
|
||||
colour = playerColours[clients[i].name];
|
||||
}
|
||||
|
||||
if(typeof playerPing[clients[i].name] != "undefined") {
|
||||
ping = toString(playerPing[clients[i].name]);
|
||||
}
|
||||
|
||||
// Player ID
|
||||
let text = String(clients[i].index);
|
||||
let size = scoreBoardListFont.measure(text, 75, 0.0, 1.0, 10, false, false);
|
||||
scoreBoardListFont.render(text, [game.width/2-100, scoreboardStart + (i*20)], 0, 0.5, 0.0, scoreBoardListFont.size, COLOUR_WHITE, false, false, false, true);
|
||||
|
||||
// Player Name
|
||||
text = name;
|
||||
size = scoreBoardListFont.measure(text, 100, 0.0, 1.0, 10, false, false);
|
||||
scoreBoardListFont.render(text, [game.width/2, scoreboardStart + (i*20)], 0, 0.5, 0.0, scoreBoardListFont.size, colour, false, false, false, true);
|
||||
|
||||
// Ping
|
||||
text = ping;
|
||||
size = scoreBoardListFont.measure(ping, 75, 0.0, 1.0, 10, false, false);
|
||||
scoreBoardListFont.render(ping, [game.width/2+100, scoreboardStart + (i*20)], 0, 0.5, 0.0, scoreBoardListFont.size, COLOUR_WHITE, false, false, false, true);
|
||||
|
||||
// PAUSED Status (depends on resource "afk")
|
||||
if(paused == true) {
|
||||
size = scoreBoardListFont.measure("PAUSED", 100, 0.0, 1.0, 10, false, false);
|
||||
scoreBoardListFont.render("PAUSED", [game.width/2+200, scoreboardStart + (i*20)], 0, 0.5, 0.0, scoreBoardListFont.size, pausedColour, false, false, false, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,416 +0,0 @@
|
||||
// ===========================================================================
|
||||
// Vortrex's Roleplay Resource
|
||||
// https://github.com/VortrexFTW/gtac_roleplay
|
||||
// ===========================================================================
|
||||
// FILE: server.js
|
||||
// DESC: Provides server communication and cross-endpoint operations
|
||||
// TYPE: Client (JavaScript)
|
||||
// ===========================================================================
|
||||
|
||||
function initServerScript() {
|
||||
logToConsole(LOG_DEBUG, "[VRR.Server]: Initializing server script ...");
|
||||
addAllNetworkHandlers();
|
||||
logToConsole(LOG_DEBUG, "[VRR.Server]: Server script initialized!");
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function addAllNetworkHandlers() {
|
||||
logToConsole(LOG_DEBUG, "[VRR.Server]: Adding network handlers ...");
|
||||
|
||||
// Chat history
|
||||
addNetworkEventHandler("m", receiveChatBoxMessageFromServer); // Not prefixed with VRR to make it as small as possible
|
||||
addNetworkEventHandler("vrr.chatScrollLines", setChatScrollLines);
|
||||
addNetworkEventHandler("vrr.chatAutoHideDelay", setChatAutoHideDelay);
|
||||
|
||||
// Messaging (like textdraws and stuff)
|
||||
addNetworkEventHandler("vrr.smallGameMessage", showSmallGameMessage);
|
||||
|
||||
// Job
|
||||
addNetworkEventHandler("vrr.job", receiveJobFromServer);
|
||||
addNetworkEventHandler("vrr.working", setLocalPlayerWorkingState);
|
||||
addNetworkEventHandler("vrr.jobType", setLocalPlayerJobType);
|
||||
addNetworkEventHandler("vrr.showJobRouteLocation", showJobRouteLocation);
|
||||
addNetworkEventHandler("vrr.hideJobRouteLocation", hideJobRouteLocation);
|
||||
|
||||
// Local player states and values
|
||||
addNetworkEventHandler("vrr.restoreCamera", restoreLocalCamera);
|
||||
addNetworkEventHandler("vrr.cameraLookAt", setLocalCameraLookAt);
|
||||
addNetworkEventHandler("vrr.freeze", setLocalPlayerFrozenState);
|
||||
addNetworkEventHandler("vrr.control", setLocalPlayerControlState);
|
||||
addNetworkEventHandler("vrr.fadeCamera", fadeLocalCamera);
|
||||
addNetworkEventHandler("vrr.removeFromVehicle", removeLocalPlayerFromVehicle);
|
||||
addNetworkEventHandler("vrr.clearWeapons", clearLocalPlayerWeapons);
|
||||
addNetworkEventHandler("vrr.giveWeapon", giveLocalPlayerWeapon);
|
||||
addNetworkEventHandler("vrr.position", setLocalPlayerPosition);
|
||||
addNetworkEventHandler("vrr.heading", setLocalPlayerHeading);
|
||||
addNetworkEventHandler("vrr.interior", setLocalPlayerInterior);
|
||||
addNetworkEventHandler("vrr.spawned", onServerSpawnedLocalPlayer);
|
||||
addNetworkEventHandler("vrr.money", setLocalPlayerCash);
|
||||
addNetworkEventHandler("vrr.armour", setLocalPlayerArmour);
|
||||
addNetworkEventHandler("vrr.localPlayerSkin", setLocalPlayerSkin);
|
||||
addNetworkEventHandler("vrr.pedSpeak", makeLocalPlayerPedSpeak);
|
||||
addNetworkEventHandler("vrr.infiniteRun", setLocalPlayerInfiniteRun);
|
||||
addNetworkEventHandler("vrr.playerCop", setLocalPlayerAsCopState);
|
||||
addNetworkEventHandler("vrr.health", setLocalPlayerHealth);
|
||||
addNetworkEventHandler("vrr.wantedLevel", setLocalPlayerWantedLevel);
|
||||
addNetworkEventHandler("vrr.playerPedId", sendLocalPlayerNetworkIdToServer);
|
||||
addNetworkEventHandler("vrr.ped", setLocalPlayerPedPartsAndProps);
|
||||
addNetworkEventHandler("vrr.spawn", serverRequestedLocalPlayerSpawn);
|
||||
addNetworkEventHandler("vrr.clearPedState", clearLocalPedState);
|
||||
addNetworkEventHandler("vrr.drunkEffect", setLocalPlayerDrunkEffect);
|
||||
|
||||
// Vehicle
|
||||
addNetworkEventHandler("vrr.vehicle", receiveVehicleFromServer);
|
||||
addNetworkEventHandler("vrr.veh.lights", setVehicleLights);
|
||||
addNetworkEventHandler("vrr.veh.engine", setVehicleEngine);
|
||||
addNetworkEventHandler("vrr.veh.repair", repairVehicle);
|
||||
|
||||
// Radio
|
||||
addNetworkEventHandler("vrr.radioStream", playStreamingRadio);
|
||||
addNetworkEventHandler("vrr.audioFileStream", playAudioFile);
|
||||
addNetworkEventHandler("vrr.stopRadioStream", stopStreamingRadio);
|
||||
addNetworkEventHandler("vrr.radioVolume", setStreamingRadioVolume);
|
||||
|
||||
// Key Bindings
|
||||
addNetworkEventHandler("vrr.delKeyBind", unBindAccountKey);
|
||||
addNetworkEventHandler("vrr.addKeyBind", bindAccountKey);
|
||||
addNetworkEventHandler("vrr.clearKeyBinds", clearKeyBinds);
|
||||
|
||||
// Weapon Damage
|
||||
addNetworkEventHandler("vrr.weaponDamageEnabled", setPlayerWeaponDamageEnabled);
|
||||
addNetworkEventHandler("vrr.weaponDamageEvent", setPlayerWeaponDamageEvent);
|
||||
|
||||
// GUI
|
||||
addNetworkEventHandler("vrr.showRegistration", showRegistrationGUI);
|
||||
addNetworkEventHandler("vrr.showNewCharacter", showNewCharacterGUI);
|
||||
addNetworkEventHandler("vrr.showLogin", showLoginGUI);
|
||||
addNetworkEventHandler("vrr.2fa", showTwoFactorAuthGUI);
|
||||
addNetworkEventHandler("vrr.showResetPasswordCodeInput", resetPasswordCodeInputGUI);
|
||||
addNetworkEventHandler("vrr.showResetPasswordEmailInput", resetPasswordEmailInputGUI);
|
||||
addNetworkEventHandler("vrr.showChangePassword", showChangePasswordGUI);
|
||||
addNetworkEventHandler("vrr.showCharacterSelect", showCharacterSelectGUI);
|
||||
addNetworkEventHandler("vrr.switchCharacterSelect", switchCharacterSelectGUI);
|
||||
addNetworkEventHandler("vrr.showError", showErrorGUI);
|
||||
addNetworkEventHandler("vrr.showInfo", showInfoGUI);
|
||||
addNetworkEventHandler("vrr.showPrompt", showYesNoPromptGUI);
|
||||
addNetworkEventHandler("vrr.loginSuccess", loginSuccess);
|
||||
addNetworkEventHandler("vrr.characterSelectSuccess", characterSelectSuccess);
|
||||
addNetworkEventHandler("vrr.loginFailed", loginFailed);
|
||||
addNetworkEventHandler("vrr.registrationSuccess", registrationSuccess);
|
||||
addNetworkEventHandler("vrr.registrationFailed", registrationFailed);
|
||||
addNetworkEventHandler("vrr.newCharacterFailed", newCharacterFailed);
|
||||
addNetworkEventHandler("vrr.changePassword", showChangePasswordGUI);
|
||||
addNetworkEventHandler("vrr.showLocaleChooser", showLocaleChooserGUI);
|
||||
addNetworkEventHandler("vrr.guiColour", setGUIColours);
|
||||
|
||||
// Business
|
||||
addNetworkEventHandler("vrr.business", receiveBusinessFromServer);
|
||||
|
||||
// House
|
||||
addNetworkEventHandler("vrr.house", receiveHouseFromServer);
|
||||
|
||||
// GPS
|
||||
addNetworkEventHandler("vrr.showGPSBlip", showGPSLocation);
|
||||
|
||||
// Locale
|
||||
addNetworkEventHandler("vrr.locale", setLocale);
|
||||
addNetworkEventHandler("vrr.localeChooser", toggleLocaleChooserGUI);
|
||||
|
||||
// Misc
|
||||
addNetworkEventHandler("vrr.mouseCursor", toggleMouseCursor);
|
||||
addNetworkEventHandler("vrr.mouseCamera", toggleMouseCamera);
|
||||
addNetworkEventHandler("vrr.clearPeds", clearLocalPlayerOwnedPeds);
|
||||
addNetworkEventHandler("vrr.passenger", enterVehicleAsPassenger);
|
||||
addNetworkEventHandler("vrr.logo", setServerLogoRenderState);
|
||||
addNetworkEventHandler("vrr.ambience", setCityAmbienceState);
|
||||
addNetworkEventHandler("vrr.runCode", runClientCode);
|
||||
addNetworkEventHandler("vrr.minuteDuration", setMinuteDuration);
|
||||
addNetworkEventHandler("vrr.snow", setSnowState);
|
||||
addNetworkEventHandler("vrr.enterPropertyKey", setEnterPropertyKey);
|
||||
addNetworkEventHandler("vrr.skinSelect", toggleSkinSelect);
|
||||
addNetworkEventHandler("vrr.hotbar", updatePlayerHotBar);
|
||||
addNetworkEventHandler("vrr.showItemActionDelay", showItemActionDelay);
|
||||
addNetworkEventHandler("vrr.set2DRendering", set2DRendering);
|
||||
addNetworkEventHandler("vrr.mouseCameraForce", setMouseCameraState);
|
||||
addNetworkEventHandler("vrr.logLevel", setLogLevel);
|
||||
addNetworkEventHandler("vrr.hideAllGUI", hideAllGUI);
|
||||
addNetworkEventHandler("vrr.nametag", updatePlayerNameTag);
|
||||
addNetworkEventHandler("vrr.nametagDistance", setNameTagDistance);
|
||||
addNetworkEventHandler("vrr.ping", updatePlayerPing);
|
||||
addNetworkEventHandler("vrr.anim", makePedPlayAnimation);
|
||||
addNetworkEventHandler("vrr.stopAnim", makePedStopAnimation);
|
||||
addNetworkEventHandler("vrr.forceAnim", forcePedAnimation);
|
||||
addNetworkEventHandler("vrr.clientInfo", serverRequestedClientInfo);
|
||||
addNetworkEventHandler("vrr.interiorLights", updateInteriorLightsState);
|
||||
addNetworkEventHandler("vrr.cutsceneInterior", setCutsceneInterior);
|
||||
addNetworkEventHandler("vrr.syncElement", forceSyncElementProperties);
|
||||
addNetworkEventHandler("vrr.elementPosition", setElementPosition);
|
||||
addNetworkEventHandler("vrr.elementCollisions", setElementCollisionsEnabled);
|
||||
addNetworkEventHandler("vrr.vehBuyState", setVehiclePurchaseState);
|
||||
addNetworkEventHandler("vrr.holdObject", makePedHoldObject);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function sendResourceReadySignalToServer() {
|
||||
sendNetworkEventToServer("vrr.clientReady");
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function sendResourceStartedSignalToServer() {
|
||||
sendNetworkEventToServer("vrr.clientStarted");
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function sendResourceStoppedSignalToServer() {
|
||||
if(isConnected) {
|
||||
sendNetworkEventToServer("vrr.clientStopped");
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function set2DRendering(hudState, labelState, smallGameMessageState, scoreboardState, hotBarState, itemActionDelayState) {
|
||||
logToConsole(LOG_DEBUG, `[VRR.Main] Updating render states (HUD: ${hudState}, Labels: ${labelState}, Bottom Text: ${smallGameMessageState}, Scoreboard: ${scoreboardState}, HotBar: ${hotBarState}, Item Action Delay: ${itemActionDelayState})`);
|
||||
renderHUD = hudState;
|
||||
|
||||
if(getGame() == VRR_GAME_GTA_IV) {
|
||||
natives.displayCash(hudState);
|
||||
natives.displayAmmo(hudState);
|
||||
natives.displayHud(hudState);
|
||||
natives.displayRadar(hudState);
|
||||
natives.displayAreaName(hudState);
|
||||
} else {
|
||||
if(typeof setHUDEnabled != "undefined") {
|
||||
setHUDEnabled(hudState);
|
||||
}
|
||||
}
|
||||
|
||||
renderLabels = labelState;
|
||||
renderSmallGameMessage = smallGameMessageState;
|
||||
renderScoreBoard = scoreboardState;
|
||||
renderHotBar = hotBarState;
|
||||
renderItemActionDelay = itemActionDelayState;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function onServerSpawnedLocalPlayer(state) {
|
||||
logToConsole(LOG_DEBUG, `[VRR.Main] Setting spawned state to ${state}`);
|
||||
isSpawned = state;
|
||||
setUpInitialGame();
|
||||
if(state) {
|
||||
setTimeout(function() {
|
||||
calledDeathEvent = false;
|
||||
}, 1000);
|
||||
|
||||
getElementsByType(ELEMENT_PED).filter(ped => !ped.isType(ELEMENT_PLAYER)).forEach(ped => {
|
||||
syncCivilianProperties(ped);
|
||||
});
|
||||
|
||||
getElementsByType(ELEMENT_PLAYER).forEach(player => {
|
||||
syncPlayerProperties(player);
|
||||
});
|
||||
|
||||
getElementsByType(ELEMENT_VEHICLE).forEach(vehicle => {
|
||||
syncVehicleProperties(vehicle);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function tellServerPlayerUsedKeyBind(key) {
|
||||
sendNetworkEventToServer("vrr.useKeyBind", key);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function tellServerPlayerArrivedAtJobRouteLocation() {
|
||||
sendNetworkEventToServer("vrr.arrivedAtJobRouteLocation");
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function tellServerItemActionDelayComplete() {
|
||||
sendNetworkEventToServer("vrr.itemActionDelayComplete");
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function sendServerClientInfo() {
|
||||
let clientVersion = "0.0.0.0";
|
||||
if(typeof CLIENT_VERSION_MAJOR != "undefined") {
|
||||
clientVersion = `${CLIENT_VERSION_MAJOR}.${CLIENT_VERSION_MINOR}.${CLIENT_VERSION_PATCH}.${CLIENT_VERSION_BUILD}`;
|
||||
}
|
||||
sendNetworkEventToServer("vrr.clientInfo", clientVersion, game.width, game.height);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function sendServerNewAFKStatus(state) {
|
||||
sendNetworkEventToServer("vrr.afk", state);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function anchorBoat(vehicleId) {
|
||||
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function setEnterPropertyKey(key) {
|
||||
enterPropertyKey = key;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function serverRequestedClientInfo() {
|
||||
sendServerClientInfo();
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function updateInteriorLightsState(state) {
|
||||
interiorLightsEnabled = state;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function forceSyncElementProperties(elementId) {
|
||||
if(getElementFromId(elementId) == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
syncElementProperties(getElementFromId(elementId));
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function setElementCollisionsEnabled(elementId, state) {
|
||||
if(getElementFromId(elementId) == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
getElementFromId(elementId).collisionsEnabled = state;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function setLocalPlayerArmour(armour) {
|
||||
if(typeof localPlayer.armour != "undefined") {
|
||||
localPlayer.armour = armour;
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function setLocalPlayerWantedLevel(wantedLevel) {
|
||||
forceWantedLevel = toInteger(wantedLevel);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function setLogLevel(level) {
|
||||
logLevel = level;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function setLocalPlayerInfiniteRun(state) {
|
||||
if(localPlayer != null) {
|
||||
if(getGame() == VRR_GAME_GTA_III || getGame() == VRR_GAME_GTA_VC) {
|
||||
game.SET_PLAYER_NEVER_GETS_TIRED(game.GET_PLAYER_ID(), boolToInt(state));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function setLocalPlayerSkin(skinId) {
|
||||
logToConsole(LOG_INFO, `[VRR.Server] Setting locale player skin to ${skinId}`);
|
||||
if(getGame() == VRR_GAME_GTA_IV) {
|
||||
natives.changePlayerModel(natives.getPlayerId(), skinId);
|
||||
} else {
|
||||
localPlayer.skin = skinId;
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function makePedHoldObject(pedId, modelIndex) {
|
||||
if(getGame() == VRR_GAME_GTA_IV) {
|
||||
natives.givePedAmbientObject(natives.getPedFromNetworkId(pedId), getGameConfig().objects[getGame()][modelIndex][1])
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function sendLocalPlayerNetworkIdToServer() {
|
||||
sendNetworkEventToServer("vrr.playerPedId", natives.getNetworkIdFromPed(localPlayer));
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function setCutsceneInterior(cutsceneName) {
|
||||
if(getGame() == VRR_GAME_GTA_IV) {
|
||||
if(cutsceneName == "") {
|
||||
natives.clearCutscene();
|
||||
} else {
|
||||
if(natives.isInteriorScene()) {
|
||||
natives.clearCutscene();
|
||||
}
|
||||
natives.initCutscene(cutsceneName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function makeLocalPlayerPedSpeak(speechName) {
|
||||
if(getGame() == VRR_GAME_GTA_IV) {
|
||||
// if player is in vehicle, allow megaphone (if last arg is "1", it will cancel megaphone echo)
|
||||
// Only speeches with _MEGAPHONE will have the bullhorn effect
|
||||
// Afaik it only works on police voices anyway
|
||||
if(localPlayer.vehicle != null) {
|
||||
natives.sayAmbientSpeech(localPlayer, speechName, true, false, 0);
|
||||
} else {
|
||||
natives.sayAmbientSpeech(localPlayer, speechName, true, false, 1);
|
||||
}
|
||||
} else if(getGame() == VRR_GAME_GTA_III || getGame() == VRR_GAME_GTA_VC) {
|
||||
// Don't have a way to get the ped ref ID and can't use ped in arg
|
||||
//game.SET_CHAR_SAY(game.GET_PLAYER_ID(), int);
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function setLocalPlayerAsCopState(state) {
|
||||
if(getGame() == VRR_GAME_GTA_IV) {
|
||||
natives.setPlayerAsCop(natives.getPlayerId(), state);
|
||||
natives.setPoliceIgnorePlayer(natives.getPlayerId(), state);
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function serverRequestedLocalPlayerSpawn(skinId, position) {
|
||||
if(getGame() == VRR_GAME_GTA_IV) {
|
||||
natives.createPlayer(skinId, position);
|
||||
//if(isCustomCameraSupported()) {
|
||||
// game.restoreCamera(true);
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function sendLocaleSelectToServer(localeId) {
|
||||
sendNetworkEventToServer("vrr.localeSelect", localeId);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -44,53 +44,53 @@ function loadSkinSelectMessageFontBottom() {
|
||||
// ===========================================================================
|
||||
|
||||
function processSkinSelectKeyPress(keyCode) {
|
||||
if(usingSkinSelector) {
|
||||
if(keyCode == SDLK_PAGEUP) {
|
||||
if(skinSelectorIndex >= allowedSkins.length-1) {
|
||||
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) {
|
||||
if (getGame() == VRR_GAME_GTA_IV) {
|
||||
let skinId = allowedSkins[skinSelectorIndex][0];
|
||||
if(natives.isModelInCdimage(skinId)) {
|
||||
if (natives.isModelInCdimage(skinId)) {
|
||||
natives.requestModel(skinId);
|
||||
natives.loadAllObjectsNow();
|
||||
if(natives.hasModelLoaded(skinId)) {
|
||||
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 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) {
|
||||
if (getGame() == VRR_GAME_GTA_IV) {
|
||||
let skinId = allowedSkins[skinSelectorIndex][0];
|
||||
if(natives.isModelInCdimage(skinId)) {
|
||||
if (natives.isModelInCdimage(skinId)) {
|
||||
natives.requestModel(skinId);
|
||||
natives.loadAllObjectsNow();
|
||||
if(natives.hasModelLoaded(skinId)) {
|
||||
if (natives.hasModelLoaded(skinId)) {
|
||||
natives.changePlayerModel(natives.getPlayerId(), skinId);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
localPlayer.skin = allowedSkins[skinSelectorIndex][0];
|
||||
}
|
||||
} else if(keyCode == SDLK_RETURN) {
|
||||
sendNetworkEventToServer("vrr.skinSelected", skinSelectorIndex);
|
||||
} else if (keyCode == SDLK_RETURN) {
|
||||
sendNetworkEventToServer("agrp.skinSelected", skinSelectorIndex);
|
||||
toggleSkinSelect(false);
|
||||
return true;
|
||||
} else if(keyCode == SDLK_BACKSPACE) {
|
||||
sendNetworkEventToServer("vrr.skinSelected", -1);
|
||||
} else if (keyCode == SDLK_BACKSPACE) {
|
||||
sendNetworkEventToServer("agrp.skinSelected", -1);
|
||||
toggleSkinSelect(false);
|
||||
return true;
|
||||
}
|
||||
@@ -101,11 +101,11 @@ function processSkinSelectKeyPress(keyCode) {
|
||||
// ===========================================================================
|
||||
|
||||
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 (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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -114,9 +114,9 @@ function processSkinSelectRendering() {
|
||||
// ===========================================================================
|
||||
|
||||
function toggleSkinSelect(state) {
|
||||
if(state) {
|
||||
if (state) {
|
||||
skinSelectorIndex = getAllowedSkinIndexFromSkin(localPlayer.skin);
|
||||
if(!skinSelectorIndex) {
|
||||
if (!skinSelectorIndex) {
|
||||
skinSelectorIndex = 0;
|
||||
}
|
||||
|
||||
@@ -124,19 +124,19 @@ function toggleSkinSelect(state) {
|
||||
skinSelectPosition = localPlayer.position;
|
||||
skinSelectHeading = localPlayer.heading;
|
||||
|
||||
if(isCustomCameraSupported()) {
|
||||
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) {
|
||||
if (getGame() == VRR_GAME_GTA_IV) {
|
||||
let skinId = allowedSkins[skinSelectorIndex][0];
|
||||
if(natives.isModelInCdimage(skinId)) {
|
||||
if (natives.isModelInCdimage(skinId)) {
|
||||
natives.requestModel(skinId);
|
||||
natives.loadAllObjectsNow();
|
||||
if(natives.hasModelLoaded(skinId)) {
|
||||
if (natives.hasModelLoaded(skinId)) {
|
||||
natives.changePlayerModel(natives.getPlayerId(), skinId);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,13 +8,8 @@
|
||||
// ===========================================================================
|
||||
|
||||
function initClientScripts() {
|
||||
initGUIScript();
|
||||
initNameTagScript();
|
||||
initScoreBoardScript();
|
||||
initMessagingScript();
|
||||
initServerScript();
|
||||
initLogoScript();
|
||||
initLabelScript();
|
||||
initNetworkEventsScript();
|
||||
initChatBoxScript();
|
||||
initAFKScript();
|
||||
initKeyBindScript();
|
||||
@@ -25,8 +20,8 @@ function initClientScripts() {
|
||||
// ===========================================================================
|
||||
|
||||
function setUpInitialGame() {
|
||||
if(getGame() == VRR_GAME_GTA_III) {
|
||||
logToConsole(LOG_DEBUG|LOG_WARN, "Setting up initial game stuff for GTA III ...");
|
||||
if (getGame() == VRR_GAME_GTA_III) {
|
||||
logToConsole(LOG_DEBUG | LOG_WARN, "Setting up initial game stuff for GTA III ...");
|
||||
|
||||
// Turn off unlimited sprint
|
||||
game.SET_PLAYER_NEVER_GETS_TIRED(game.GET_PLAYER_ID(), 0);
|
||||
@@ -44,8 +39,8 @@ function setUpInitialGame() {
|
||||
|
||||
// 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 ...");
|
||||
} else if (getGame() == VRR_GAME_GTA_VC) {
|
||||
logToConsole(LOG_DEBUG | LOG_WARN, "Setting up initial game stuff for GTA Vice City ...");
|
||||
|
||||
// Turn off unlimited sprint
|
||||
game.SET_PLAYER_NEVER_GETS_TIRED(game.GET_PLAYER_ID(), 0);
|
||||
@@ -87,8 +82,8 @@ function setUpInitialGame() {
|
||||
|
||||
// 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 ...");
|
||||
} 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);
|
||||
@@ -124,7 +119,7 @@ function setUpInitialGame() {
|
||||
|
||||
// Disables taxi/vigilante/etc and other start mission triggers
|
||||
game.onMission = true;
|
||||
} else if(getGame() == VRR_GAME_GTA_IV) {
|
||||
} else if (getGame() == VRR_GAME_GTA_IV) {
|
||||
natives.allowEmergencyServices(false);
|
||||
natives.setCreateRandomCops(true);
|
||||
natives.setMaxWantedLevel(0);
|
||||
@@ -186,7 +181,7 @@ function setUpInitialGame() {
|
||||
|
||||
// Some last steps
|
||||
//natives.loadAllObjectsNow();
|
||||
} else if(getGame() == VRR_GAME_MAFIA_ONE) {
|
||||
} else if (getGame() == VRR_GAME_MAFIA_ONE) {
|
||||
game.mapEnabled = false;
|
||||
game.setTrafficEnabled(false);
|
||||
}
|
||||
|
||||
@@ -8,37 +8,37 @@
|
||||
// ===========================================================================
|
||||
|
||||
function processSync(event, deltaTime) {
|
||||
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 != null) {
|
||||
if (!areServerElementsSupported()) {
|
||||
sendNetworkEventToServer("agrp.plr.pos", (localPlayer.vehicle != null) ? localPlayer.vehicle.position : localPlayer.position);
|
||||
sendNetworkEventToServer("agrp.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);
|
||||
// sendNetworkEventToServer("agrp.veh.pos", getVehicleForNetworkEvent(localPlayer.vehicle), localPlayer.vehicle.position);
|
||||
// sendNetworkEventToServer("agrp.veh.rot", getVehicleForNetworkEvent(localPlayer.vehicle), localPlayer.vehicle.heading);
|
||||
//}
|
||||
}
|
||||
|
||||
if(localPlayer.health <= 0) {
|
||||
if(!calledDeathEvent) {
|
||||
if (localPlayer.health <= 0) {
|
||||
if (!calledDeathEvent) {
|
||||
logToConsole(LOG_DEBUG, `Local player died`);
|
||||
localPlayer.clearWeapons();
|
||||
calledDeathEvent = true;
|
||||
sendNetworkEventToServer("vrr.playerDeath");
|
||||
sendNetworkEventToServer("agrp.playerDeath");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(localPlayer.health <= 0) {
|
||||
if(!calledDeathEvent) {
|
||||
if (localPlayer.health <= 0) {
|
||||
if (!calledDeathEvent) {
|
||||
logToConsole(LOG_DEBUG, `Local player died`);
|
||||
localPlayer.clearWeapons();
|
||||
calledDeathEvent = true;
|
||||
sendNetworkEventToServer("vrr.playerDeath");
|
||||
sendNetworkEventToServer("agrp.playerDeath");
|
||||
}
|
||||
}
|
||||
|
||||
if(streamingRadioElement) {
|
||||
if (streamingRadioElement) {
|
||||
streamingRadio.position = getElementPosition(streamingRadioElement.id);
|
||||
//streamingRadio.volume = getStreamingRadioVolumeForPosition(streamingRadio.position);
|
||||
}
|
||||
@@ -53,20 +53,20 @@ function setVehicleEngine(vehicleId, state) {
|
||||
// ===========================================================================
|
||||
|
||||
function setVehicleLights(vehicleId, state) {
|
||||
if(getGame() != VRR_GAME_MAFIA_ONE) {
|
||||
if(!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) {
|
||||
} 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) {
|
||||
if (!state) {
|
||||
getElementFromId(vehicleId).lights = false;
|
||||
} else {
|
||||
getElementFromId(vehicleId).lights = true;
|
||||
@@ -83,72 +83,72 @@ function repairVehicle(syncId) {
|
||||
// ===========================================================================
|
||||
|
||||
function syncVehicleProperties(vehicle) {
|
||||
if(!areServerElementsSupported()) {
|
||||
if (!areServerElementsSupported()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if(doesEntityDataExist(vehicle, "vrr.lights")) {
|
||||
let lightStatus = getEntityData(vehicle, "vrr.lights");
|
||||
if(!lightStatus) {
|
||||
if (doesEntityDataExist(vehicle, "agrp.lights")) {
|
||||
let lightStatus = getEntityData(vehicle, "agrp.lights");
|
||||
if (!lightStatus) {
|
||||
vehicle.lightStatus = 2;
|
||||
} else {
|
||||
vehicle.lightStatus = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if(doesEntityDataExist(vehicle, "vrr.invincible")) {
|
||||
let invincible = getEntityData(vehicle, "vrr.invincible");
|
||||
if (doesEntityDataExist(vehicle, "agrp.invincible")) {
|
||||
let invincible = getEntityData(vehicle, "agrp.invincible");
|
||||
element.setProofs(invincible, invincible, invincible, invincible, invincible);
|
||||
}
|
||||
|
||||
if(doesEntityDataExist(vehicle, "vrr.panelStatus")) {
|
||||
let panelsStatus = getEntityData(vehicle, "vrr.panelStatus");
|
||||
for(let i in panelsStatus) {
|
||||
if (doesEntityDataExist(vehicle, "agrp.panelStatus")) {
|
||||
let panelsStatus = getEntityData(vehicle, "agrp.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) {
|
||||
if (doesEntityDataExist(vehicle, "agrp.wheelStatus")) {
|
||||
let wheelsStatus = getEntityData(vehicle, "agrp.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) {
|
||||
if (doesEntityDataExist(vehicle, "agrp.lightStatus")) {
|
||||
let lightStatus = getEntityData(vehicle, "agrp.lightStatus");
|
||||
for (let i in lightStatus) {
|
||||
vehicle.setLightStatus(i, lightStatus[i]);
|
||||
}
|
||||
}
|
||||
|
||||
if(doesEntityDataExist(vehicle, "vrr.suspensionHeight")) {
|
||||
let suspensionHeight = getEntityData(vehicle, "vrr.suspensionHeight");
|
||||
if (doesEntityDataExist(vehicle, "agrp.suspensionHeight")) {
|
||||
let suspensionHeight = getEntityData(vehicle, "agrp.suspensionHeight");
|
||||
vehicle.setSuspensionHeight(suspensionHeight);
|
||||
}
|
||||
|
||||
if(getGame() == VRR_GAME_GTA_SA) {
|
||||
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) {
|
||||
if (doesEntityDataExist(vehicle, "agrp.upgrades")) {
|
||||
let upgrades = getEntityData(vehicle, "agrp.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) {
|
||||
if (getGame() == VRR_GAME_GTA_SA || getGame() == VRR_GAME_GTA_IV) {
|
||||
if (doesEntityDataExist(vehicle, "agrp.livery")) {
|
||||
let livery = getEntityData(vehicle, "agrp.livery");
|
||||
if (getGame() == VRR_GAME_GTA_SA) {
|
||||
vehicle.setPaintJob(livery);
|
||||
} else if(getGame() == VRR_GAME_GTA_IV) {
|
||||
} else if (getGame() == VRR_GAME_GTA_IV) {
|
||||
vehicle.livery = livery;
|
||||
}
|
||||
}
|
||||
@@ -158,13 +158,13 @@ function syncVehicleProperties(vehicle) {
|
||||
// ===========================================================================
|
||||
|
||||
function syncCivilianProperties(civilian) {
|
||||
if(!areServerElementsSupported()) {
|
||||
if (!areServerElementsSupported()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if(getGame() == VRR_GAME_GTA_III) {
|
||||
if(doesEntityDataExist(civilian, "vrr.scale")) {
|
||||
let scaleFactor = getEntityData(civilian, "vrr.scale");
|
||||
if (getGame() == VRR_GAME_GTA_III) {
|
||||
if (doesEntityDataExist(civilian, "agrp.scale")) {
|
||||
let scaleFactor = getEntityData(civilian, "agrp.scale");
|
||||
let tempMatrix = civilian.matrix;
|
||||
tempMatrix.setScale(toVector3(scaleFactor.x, scaleFactor.y, scaleFactor.z));
|
||||
let tempPosition = civilian.position;
|
||||
@@ -174,79 +174,79 @@ function syncCivilianProperties(civilian) {
|
||||
}
|
||||
}
|
||||
|
||||
if(getGame() == VRR_GAME_GTA_SA) {
|
||||
if(doesEntityDataExist(civilian, "vrr.fightStyle")) {
|
||||
let fightStyle = getEntityData(civilian, "vrr.fightStyle");
|
||||
if (getGame() == VRR_GAME_GTA_SA) {
|
||||
if (doesEntityDataExist(civilian, "agrp.fightStyle")) {
|
||||
let fightStyle = getEntityData(civilian, "agrp.fightStyle");
|
||||
civilian.setFightStyle(fightStyle[0], fightStyle[1]);
|
||||
}
|
||||
}
|
||||
|
||||
if(getGame() == VRR_GAME_GTA_III) {
|
||||
if(doesEntityDataExist(civilian, "vrr.walkStyle")) {
|
||||
let walkStyle = getEntityData(civilian, "vrr.walkStyle");
|
||||
if (getGame() == VRR_GAME_GTA_III) {
|
||||
if (doesEntityDataExist(civilian, "agrp.walkStyle")) {
|
||||
let walkStyle = getEntityData(civilian, "agrp.walkStyle");
|
||||
civilian.walkStyle = walkStyle;
|
||||
}
|
||||
}
|
||||
|
||||
if(getGame() == VRR_GAME_GTA_IV) {
|
||||
if(doesEntityDataExist(civilian, "vrr.bodyPropHair")) {
|
||||
let bodyPropHair = getEntityData(civilian, "vrr.bodyPropHair");
|
||||
if (getGame() == VRR_GAME_GTA_IV) {
|
||||
if (doesEntityDataExist(civilian, "agrp.bodyPropHair")) {
|
||||
let bodyPropHair = getEntityData(civilian, "agrp.bodyPropHair");
|
||||
civilian.changeBodyProp(0, bodyPropHair[0], bodyPropHair[1]);
|
||||
}
|
||||
|
||||
if(doesEntityDataExist(civilian, "vrr.bodyPropHead")) {
|
||||
let bodyPropHead = getEntityData(civilian, "vrr.bodyPropHead");
|
||||
if (doesEntityDataExist(civilian, "agrp.bodyPropHead")) {
|
||||
let bodyPropHead = getEntityData(civilian, "agrp.bodyPropHead");
|
||||
civilian.changeBodyProp(1, bodyPropHead[0], bodyPropHead[1]);
|
||||
}
|
||||
|
||||
if(doesEntityDataExist(civilian, "vrr.bodyPropEyes")) {
|
||||
let bodyPropEyes = getEntityData(civilian, "vrr.bodyPropEyes");
|
||||
if (doesEntityDataExist(civilian, "agrp.bodyPropEyes")) {
|
||||
let bodyPropEyes = getEntityData(civilian, "agrp.bodyPropEyes");
|
||||
civilian.changeBodyProp(1, bodyPropEyes[0], bodyPropEyes[1]);
|
||||
}
|
||||
|
||||
if(doesEntityDataExist(civilian, "vrr.bodyPropLeftHand")) {
|
||||
let bodyPropLeftHand = getEntityData(civilian, "vrr.bodyPropLeftHand");
|
||||
if (doesEntityDataExist(civilian, "agrp.bodyPropLeftHand")) {
|
||||
let bodyPropLeftHand = getEntityData(civilian, "agrp.bodyPropLeftHand");
|
||||
civilian.changeBodyProp(1, bodyPropLeftHand[0], bodyPropLeftHand[1]);
|
||||
}
|
||||
|
||||
if(doesEntityDataExist(civilian, "vrr.bodyPropRightHand")) {
|
||||
let bodyPropRightHand = getEntityData(civilian, "vrr.bodyPropRightHand");
|
||||
if (doesEntityDataExist(civilian, "agrp.bodyPropRightHand")) {
|
||||
let bodyPropRightHand = getEntityData(civilian, "agrp.bodyPropRightHand");
|
||||
civilian.changeBodyProp(1, bodyPropRightHand[0], bodyPropRightHand[1]);
|
||||
}
|
||||
|
||||
if(doesEntityDataExist(civilian, "vrr.bodyPropLeftWrist")) {
|
||||
let bodyPropLeftWrist = getEntityData(civilian, "vrr.bodyPropLeftWrist");
|
||||
if (doesEntityDataExist(civilian, "agrp.bodyPropLeftWrist")) {
|
||||
let bodyPropLeftWrist = getEntityData(civilian, "agrp.bodyPropLeftWrist");
|
||||
civilian.changeBodyProp(1, bodyPropLeftWrist[0], bodyPropLeftWrist[1]);
|
||||
}
|
||||
|
||||
if(doesEntityDataExist(civilian, "vrr.bodyPropRightWrist")) {
|
||||
let bodyPropRightWrist = getEntityData(civilian, "vrr.bodyPropRightWrist");
|
||||
if (doesEntityDataExist(civilian, "agrp.bodyPropRightWrist")) {
|
||||
let bodyPropRightWrist = getEntityData(civilian, "agrp.bodyPropRightWrist");
|
||||
civilian.changeBodyProp(1, bodyPropRightWrist[0], bodyPropRightWrist[1]);
|
||||
}
|
||||
|
||||
if(doesEntityDataExist(civilian, "vrr.bodyPropRightWrist")) {
|
||||
let bodyPropRightWrist = getEntityData(civilian, "vrr.bodyPropRightWrist");
|
||||
if (doesEntityDataExist(civilian, "agrp.bodyPropRightWrist")) {
|
||||
let bodyPropRightWrist = getEntityData(civilian, "agrp.bodyPropRightWrist");
|
||||
civilian.changeBodyProp(1, bodyPropRightWrist[0], bodyPropRightWrist[1]);
|
||||
}
|
||||
|
||||
if(doesEntityDataExist(civilian, "vrr.bodyPropHip")) {
|
||||
let bodyPropHip = getEntityData(civilian, "vrr.bodyPropHip");
|
||||
if (doesEntityDataExist(civilian, "agrp.bodyPropHip")) {
|
||||
let bodyPropHip = getEntityData(civilian, "agrp.bodyPropHip");
|
||||
civilian.changeBodyProp(1, bodyPropHip[0], bodyPropHip[1]);
|
||||
}
|
||||
|
||||
if(doesEntityDataExist(civilian, "vrr.bodyPropLeftFoot")) {
|
||||
let bodyPropLeftFoot = getEntityData(civilian, "vrr.bodyPropLeftFoot");
|
||||
if (doesEntityDataExist(civilian, "agrp.bodyPropLeftFoot")) {
|
||||
let bodyPropLeftFoot = getEntityData(civilian, "agrp.bodyPropLeftFoot");
|
||||
civilian.changeBodyProp(1, bodyPropLeftFoot[0], bodyPropLeftFoot[1]);
|
||||
}
|
||||
|
||||
if(doesEntityDataExist(civilian, "vrr.bodyPropRightFoot")) {
|
||||
let bodyPropRightFoot = getEntityData(civilian, "vrr.bodyPropRightFoot");
|
||||
if (doesEntityDataExist(civilian, "agrp.bodyPropRightFoot")) {
|
||||
let bodyPropRightFoot = getEntityData(civilian, "agrp.bodyPropRightFoot");
|
||||
civilian.changeBodyProp(1, bodyPropRightFoot[0], bodyPropRightFoot[1]);
|
||||
}
|
||||
}
|
||||
|
||||
if(doesEntityDataExist(civilian, "vrr.anim")) {
|
||||
let animationSlot = getEntityData(civilian, "vrr.anim");
|
||||
if (doesEntityDataExist(civilian, "agrp.anim")) {
|
||||
let animationSlot = getEntityData(civilian, "agrp.anim");
|
||||
let animationData = getAnimationData(animationSlot);
|
||||
civilian.addAnimation(animationData.groupId, animationData.animId);
|
||||
}
|
||||
@@ -255,13 +255,13 @@ function syncCivilianProperties(civilian) {
|
||||
// ===========================================================================
|
||||
|
||||
function syncPlayerProperties(player) {
|
||||
if(!areServerElementsSupported()) {
|
||||
if (!areServerElementsSupported()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if(getGame() == VRR_GAME_GTA_III) {
|
||||
if(doesEntityDataExist(player, "vrr.scale")) {
|
||||
let scaleFactor = getEntityData(player, "vrr.scale");
|
||||
if (getGame() == VRR_GAME_GTA_III) {
|
||||
if (doesEntityDataExist(player, "agrp.scale")) {
|
||||
let scaleFactor = getEntityData(player, "agrp.scale");
|
||||
let tempMatrix = player.matrix;
|
||||
tempMatrix.setScale(toVector3(scaleFactor.x, scaleFactor.y, scaleFactor.z));
|
||||
let tempPosition = player.position;
|
||||
@@ -271,95 +271,95 @@ function syncPlayerProperties(player) {
|
||||
}
|
||||
}
|
||||
|
||||
if(getGame() == VRR_GAME_GTA_SA) {
|
||||
if(doesEntityDataExist(player, "vrr.fightStyle")) {
|
||||
let fightStyle = getEntityData(player, "vrr.fightStyle");
|
||||
if (getGame() == VRR_GAME_GTA_SA) {
|
||||
if (doesEntityDataExist(player, "agrp.fightStyle")) {
|
||||
let fightStyle = getEntityData(player, "agrp.fightStyle");
|
||||
player.setFightStyle(fightStyle[0], fightStyle[1]);
|
||||
}
|
||||
}
|
||||
|
||||
//if(getGame() == VRR_GAME_GTA_SA) {
|
||||
// if(doesEntityDataExist(player, "vrr.walkStyle")) {
|
||||
// let walkStyle = getEntityData(player, "vrr.walkStyle");
|
||||
// if(doesEntityDataExist(player, "agrp.walkStyle")) {
|
||||
// let walkStyle = getEntityData(player, "agrp.walkStyle");
|
||||
// player.walkStyle = walkStyle;
|
||||
// }
|
||||
//}
|
||||
|
||||
if(getGame() == VRR_GAME_GTA_IV) {
|
||||
if(doesEntityDataExist(player, "vrr.bodyPartHair")) {
|
||||
let bodyPartHead = getEntityData(player, "vrr.bodyPartHair");
|
||||
if (getGame() == VRR_GAME_GTA_IV) {
|
||||
if (doesEntityDataExist(player, "agrp.bodyPartHair")) {
|
||||
let bodyPartHead = getEntityData(player, "agrp.bodyPartHair");
|
||||
player.changeBodyPart(0, bodyPartHead[0], bodyPartHair[1]);
|
||||
}
|
||||
|
||||
if(doesEntityDataExist(player, "vrr.bodyPartHead")) {
|
||||
let bodyPartHead = getEntityData(player, "vrr.bodyPartHead");
|
||||
if (doesEntityDataExist(player, "agrp.bodyPartHead")) {
|
||||
let bodyPartHead = getEntityData(player, "agrp.bodyPartHead");
|
||||
player.changeBodyPart(1, bodyPartHead[0], bodyPartHead[1]);
|
||||
}
|
||||
|
||||
if(doesEntityDataExist(player, "vrr.bodyPartUpper")) {
|
||||
let bodyPartUpper = getEntityData(player, "vrr.bodyPartUpper");
|
||||
if (doesEntityDataExist(player, "agrp.bodyPartUpper")) {
|
||||
let bodyPartUpper = getEntityData(player, "agrp.bodyPartUpper");
|
||||
player.changeBodyPart(1, bodyPartUpper[0], bodyPartUpper[1]);
|
||||
}
|
||||
|
||||
if(doesEntityDataExist(player, "vrr.bodyPartLower")) {
|
||||
let bodyPartLower = getEntityData(player, "vrr.bodyPartLower");
|
||||
if (doesEntityDataExist(player, "agrp.bodyPartLower")) {
|
||||
let bodyPartLower = getEntityData(player, "agrp.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");
|
||||
if (getGame() == VRR_GAME_GTA_IV) {
|
||||
if (doesEntityDataExist(player, "agrp.bodyPropHair")) {
|
||||
let bodyPropHair = getEntityData(player, "agrp.bodyPropHair");
|
||||
player.changeBodyProp(0, bodyPropHair[0], bodyPropHair[1]);
|
||||
}
|
||||
|
||||
if(doesEntityDataExist(player, "vrr.bodyPropHead")) {
|
||||
let bodyPropHead = getEntityData(player, "vrr.bodyPropHead");
|
||||
if (doesEntityDataExist(player, "agrp.bodyPropHead")) {
|
||||
let bodyPropHead = getEntityData(player, "agrp.bodyPropHead");
|
||||
player.changeBodyProp(1, bodyPropHead[0], bodyPropHead[1]);
|
||||
}
|
||||
|
||||
if(doesEntityDataExist(player, "vrr.bodyPropEyes")) {
|
||||
let bodyPropEyes = getEntityData(player, "vrr.bodyPropEyes");
|
||||
if (doesEntityDataExist(player, "agrp.bodyPropEyes")) {
|
||||
let bodyPropEyes = getEntityData(player, "agrp.bodyPropEyes");
|
||||
player.changeBodyProp(1, bodyPropEyes[0], bodyPropEyes[1]);
|
||||
}
|
||||
|
||||
if(doesEntityDataExist(player, "vrr.bodyPropLeftHand")) {
|
||||
let bodyPropLeftHand = getEntityData(player, "vrr.bodyPropLeftHand");
|
||||
if (doesEntityDataExist(player, "agrp.bodyPropLeftHand")) {
|
||||
let bodyPropLeftHand = getEntityData(player, "agrp.bodyPropLeftHand");
|
||||
player.changeBodyProp(1, bodyPropLeftHand[0], bodyPropLeftHand[1]);
|
||||
}
|
||||
|
||||
if(doesEntityDataExist(player, "vrr.bodyPropRightHand")) {
|
||||
let bodyPropRightHand = getEntityData(player, "vrr.bodyPropRightHand");
|
||||
if (doesEntityDataExist(player, "agrp.bodyPropRightHand")) {
|
||||
let bodyPropRightHand = getEntityData(player, "agrp.bodyPropRightHand");
|
||||
player.changeBodyProp(1, bodyPropRightHand[0], bodyPropRightHand[1]);
|
||||
}
|
||||
|
||||
if(doesEntityDataExist(player, "vrr.bodyPropLeftWrist")) {
|
||||
let bodyPropLeftWrist = getEntityData(player, "vrr.bodyPropLeftWrist");
|
||||
if (doesEntityDataExist(player, "agrp.bodyPropLeftWrist")) {
|
||||
let bodyPropLeftWrist = getEntityData(player, "agrp.bodyPropLeftWrist");
|
||||
player.changeBodyProp(1, bodyPropLeftWrist[0], bodyPropLeftWrist[1]);
|
||||
}
|
||||
|
||||
if(doesEntityDataExist(player, "vrr.bodyPropRightWrist")) {
|
||||
let bodyPropRightWrist = getEntityData(player, "vrr.bodyPropRightWrist");
|
||||
if (doesEntityDataExist(player, "agrp.bodyPropRightWrist")) {
|
||||
let bodyPropRightWrist = getEntityData(player, "agrp.bodyPropRightWrist");
|
||||
player.changeBodyProp(1, bodyPropRightWrist[0], bodyPropRightWrist[1]);
|
||||
}
|
||||
|
||||
if(doesEntityDataExist(player, "vrr.bodyPropRightWrist")) {
|
||||
let bodyPropRightWrist = getEntityData(player, "vrr.bodyPropRightWrist");
|
||||
if (doesEntityDataExist(player, "agrp.bodyPropRightWrist")) {
|
||||
let bodyPropRightWrist = getEntityData(player, "agrp.bodyPropRightWrist");
|
||||
player.changeBodyProp(1, bodyPropRightWrist[0], bodyPropRightWrist[1]);
|
||||
}
|
||||
|
||||
if(doesEntityDataExist(player, "vrr.bodyPropHip")) {
|
||||
let bodyPropHip = getEntityData(player, "vrr.bodyPropHip");
|
||||
if (doesEntityDataExist(player, "agrp.bodyPropHip")) {
|
||||
let bodyPropHip = getEntityData(player, "agrp.bodyPropHip");
|
||||
player.changeBodyProp(1, bodyPropHip[0], bodyPropHip[1]);
|
||||
}
|
||||
|
||||
if(doesEntityDataExist(player, "vrr.bodyPropLeftFoot")) {
|
||||
let bodyPropLeftFoot = getEntityData(player, "vrr.bodyPropLeftFoot");
|
||||
if (doesEntityDataExist(player, "agrp.bodyPropLeftFoot")) {
|
||||
let bodyPropLeftFoot = getEntityData(player, "agrp.bodyPropLeftFoot");
|
||||
player.changeBodyProp(1, bodyPropLeftFoot[0], bodyPropLeftFoot[1]);
|
||||
}
|
||||
|
||||
if(doesEntityDataExist(player, "vrr.bodyPropRightFoot")) {
|
||||
let bodyPropRightFoot = getEntityData(player, "vrr.bodyPropRightFoot");
|
||||
if (doesEntityDataExist(player, "agrp.bodyPropRightFoot")) {
|
||||
let bodyPropRightFoot = getEntityData(player, "agrp.bodyPropRightFoot");
|
||||
player.changeBodyProp(1, bodyPropRightFoot[0], bodyPropRightFoot[1]);
|
||||
}
|
||||
}
|
||||
@@ -368,18 +368,18 @@ function syncPlayerProperties(player) {
|
||||
// ===========================================================================
|
||||
|
||||
function syncElementProperties(element) {
|
||||
if(!areServerElementsSupported()) {
|
||||
if (!areServerElementsSupported()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if(doesEntityDataExist(element, "vrr.interior")) {
|
||||
if(typeof element.interior != "undefined") {
|
||||
element.interior = getEntityData(element, "vrr.interior");
|
||||
if (doesEntityDataExist(element, "agrp.interior")) {
|
||||
if (typeof element.interior != "undefined") {
|
||||
element.interior = getEntityData(element, "agrp.interior");
|
||||
}
|
||||
}
|
||||
|
||||
if(getGame() == VRR_GAME_MAFIA_ONE) {
|
||||
switch(element.type) {
|
||||
if (getGame() == VRR_GAME_MAFIA_ONE) {
|
||||
switch (element.type) {
|
||||
case ELEMENT_VEHICLE:
|
||||
syncVehicleProperties(element);
|
||||
break;
|
||||
@@ -396,7 +396,7 @@ function syncElementProperties(element) {
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
switch(element.type) {
|
||||
switch (element.type) {
|
||||
case ELEMENT_VEHICLE:
|
||||
syncVehicleProperties(element);
|
||||
break;
|
||||
@@ -419,7 +419,7 @@ function syncElementProperties(element) {
|
||||
// ===========================================================================
|
||||
|
||||
function receiveHouseFromServer(houseId, entrancePosition, blipModel, pickupModel, hasInterior) {
|
||||
if(getGame() == VRR_GAME_GTA_IV) {
|
||||
if (getGame() == VRR_GAME_GTA_IV) {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -427,11 +427,11 @@ function receiveHouseFromServer(houseId, entrancePosition, blipModel, pickupMode
|
||||
// ===========================================================================
|
||||
|
||||
function setLocalPlayerPedPartsAndProps(parts, props) {
|
||||
for(let i in parts) {
|
||||
for (let i in parts) {
|
||||
localPlayer.changeBodyPart(parts[i][0], parts[i][1], parts[i][2]);
|
||||
}
|
||||
|
||||
for(let j in props) {
|
||||
for (let j in props) {
|
||||
localPlayer.changeBodyProp(props[j][0], props[j][1]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -95,7 +95,7 @@ function runClientCode(code, returnTo) {
|
||||
try {
|
||||
returnValue = eval("(" + code + ")");
|
||||
} catch (error) {
|
||||
sendNetworkEventToServer("vrr.runCodeFail", returnTo, error.toString());
|
||||
sendNetworkEventToServer("agrp.runCodeFail", returnTo, error.toString());
|
||||
return false;
|
||||
}
|
||||
let returnValueString = returnValue;
|
||||
@@ -104,7 +104,7 @@ function runClientCode(code, returnTo) {
|
||||
} else {
|
||||
returnValueString = "null/undefined";
|
||||
}
|
||||
sendNetworkEventToServer("vrr.runCodeSuccess", returnTo, returnValueString);
|
||||
sendNetworkEventToServer("agrp.runCodeSuccess", returnTo, returnValueString);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -211,8 +211,8 @@ function setLocalPlayerInterior(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");
|
||||
if (getEntityData(vehicles[i], "agrp.interior")) {
|
||||
vehicles[i].interior = getEntityData(vehicles[i], "agrp.interior");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -310,14 +310,6 @@ function clearSelfOwnedVehicles() {
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function setMouseCameraState(state) {
|
||||
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);
|
||||
@@ -406,8 +398,8 @@ function processWantedLevelReset() {
|
||||
function processLocalPlayerVehicleControlState() {
|
||||
if (areServerElementsSupported()) {
|
||||
if (inVehicle && localPlayer.vehicle != null) {
|
||||
if (doesEntityDataExist(localPlayer.vehicle, "vrr.engine")) {
|
||||
if (getEntityData(localPlayer.vehicle, "vrr.engine") == false) {
|
||||
if (doesEntityDataExist(localPlayer.vehicle, "agrp.engine")) {
|
||||
if (getEntityData(localPlayer.vehicle, "agrp.engine") == false) {
|
||||
localPlayer.vehicle.engine = false;
|
||||
if (!localPlayer.vehicle.engine) {
|
||||
if (typeof localPlayer.vehicle.velocity != "undefined") {
|
||||
@@ -590,7 +582,7 @@ function processNearbyPickups() {
|
||||
//if(pickups[i].interior == localPlayer.interior && pickups[i].dimension == localPlayer.dimension) {
|
||||
if (currentPickup != pickups[i]) {
|
||||
currentPickup = pickups[i];
|
||||
sendNetworkEventToServer("vrr.pickup", pickups[i].id);
|
||||
sendNetworkEventToServer("agrp.pickup", pickups[i].id);
|
||||
}
|
||||
//}
|
||||
}
|
||||
|
||||
@@ -32,11 +32,11 @@ class VehicleData {
|
||||
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) {
|
||||
if (getGame() != VRR_GAME_GTA_IV) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if(getVehicleData(vehicleId) != false) {
|
||||
if (getVehicleData(vehicleId) != false) {
|
||||
let vehicleData = getVehicleData(vehicleId);
|
||||
//vehicleData.position = position;
|
||||
//vehicleData.heading = heading;
|
||||
@@ -63,20 +63,20 @@ function receiveVehicleFromServer(vehicleId, position, model, colour1, colour2,
|
||||
// ===========================================================================
|
||||
|
||||
function processVehiclePurchasing() {
|
||||
if(vehiclePurchaseState == VRR_VEHBUYSTATE_TESTDRIVE) {
|
||||
if(getLocalPlayerVehicle() == false) {
|
||||
if (vehiclePurchaseState == VRR_VEHBUYSTATE_TESTDRIVE) {
|
||||
if (getLocalPlayerVehicle() == false) {
|
||||
vehiclePurchaseState = VRR_VEHBUYSTATE_EXITVEH;
|
||||
sendNetworkEventToServer("vrr.vehBuyState", VRR_VEHBUYSTATE_EXITVEH);
|
||||
sendNetworkEventToServer("agrp.vehBuyState", VRR_VEHBUYSTATE_EXITVEH);
|
||||
return false;
|
||||
} else {
|
||||
if(vehiclePurchasing == getLocalPlayerVehicle()) {
|
||||
if(getDistance(getLocalPlayerVehicle().position, vehiclePurchasePosition) >= 25) {
|
||||
if (vehiclePurchasing == getLocalPlayerVehicle()) {
|
||||
if (getDistance(getLocalPlayerVehicle().position, vehiclePurchasePosition) >= 25) {
|
||||
vehiclePurchaseState = VRR_VEHBUYSTATE_FARENOUGH;
|
||||
sendNetworkEventToServer("vrr.vehBuyState", VRR_VEHBUYSTATE_FARENOUGH);
|
||||
sendNetworkEventToServer("agrp.vehBuyState", VRR_VEHBUYSTATE_FARENOUGH);
|
||||
}
|
||||
} else {
|
||||
vehiclePurchaseState = VRR_VEHBUYSTATE_WRONGVEH;
|
||||
sendNetworkEventToServer("vrr.vehBuyState", VRR_VEHBUYSTATE_WRONGVEH);
|
||||
sendNetworkEventToServer("agrp.vehBuyState", VRR_VEHBUYSTATE_WRONGVEH);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -95,7 +95,7 @@ function processVehicleBurning() {
|
||||
function setVehiclePurchaseState(state, vehicleId, position) {
|
||||
vehiclePurchaseState = state;
|
||||
|
||||
if(vehicleId != null) {
|
||||
if (vehicleId != null) {
|
||||
vehiclePurchasing = getElementFromId(vehicleId);
|
||||
} else {
|
||||
vehiclePurchasing = null;
|
||||
@@ -110,9 +110,9 @@ function setVehiclePurchaseState(state, vehicleId, 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) {
|
||||
function getVehicleData(vehicleId) {
|
||||
for (let i in getServerData().vehicles) {
|
||||
if (getServerData().vehicles[i].vehicleId == vehicleId) {
|
||||
return getServerData().vehicles[i];
|
||||
}
|
||||
}
|
||||
@@ -123,7 +123,7 @@ function setVehiclePurchaseState(state, vehicleId, position) {
|
||||
// ===========================================================================
|
||||
|
||||
function setAllVehicleDataIndexes() {
|
||||
for(let i in getServerData().vehicles) {
|
||||
for (let i in getServerData().vehicles) {
|
||||
getServerData().vehicles[i].index = i;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,6 +7,191 @@
|
||||
// TYPE: Server (JavaScript)
|
||||
// ===========================================================================
|
||||
|
||||
// Account Contact Types
|
||||
const VRR_CONTACT_NONE = 0;
|
||||
const VRR_CONTACT_NEUTRAL = 1; // Contact is neutral. Used for general contacts with no special additional features
|
||||
const VRR_CONTACT_FRIEND = 2; // Contact is a friend. Shows when they're online.
|
||||
const VRR_CONTACT_BLOCKED = 3; // Contact is blocked. Prevents all communication to/from them except for RP
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
// Account Authentication Methods
|
||||
const VRR_ACCT_AUTHMETHOD_NONE = 0; // None
|
||||
const VRR_ACCT_AUTHMETHOD_EMAIL = 1; // Email
|
||||
const VRR_ACCT_AUTHMETHOD_PHONENUM = 2; // Phone number
|
||||
const VRR_ACCT_AUTHMETHOD_2FA = 3; // Two factor authentication app (authy, google authenticator, etc)
|
||||
const VRR_ACCT_AUTHMETHOD_PEBBLE = 4; // Pebble watch (this one's for Vortrex but anybody with a Pebble can use)
|
||||
const VRR_ACCT_AUTHMETHOD_PHONEAPP = 5; // The Android/iOS companion app (will initially be a web based thing until I can get the apps created)
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
// Two-Factor Authentication States
|
||||
const VRR_2FA_STATE_NONE = 0; // None
|
||||
const VRR_2FA_STATE_CODEINPUT = 1; // Waiting on player to enter code to play
|
||||
const VRR_2FA_STATE_SETUP_CODETOAPP = 2; // Providing player with a code to put in their auth app
|
||||
const VRR_2FA_STATE_SETUP_CODEFROMAPP = 3; // Waiting on player to enter code from auth app to set up
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
// Reset Password States
|
||||
const VRR_RESETPASS_STATE_NONE = 0; // None
|
||||
const VRR_RESETPASS_STATE_CODEINPUT = 1; // Waiting on player to enter code sent via email
|
||||
const VRR_RESETPASS_STATE_SETPASS = 2; // Waiting on player to enter new password
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
/**
|
||||
* @class Representing an account, loaded/saved in the database
|
||||
*/
|
||||
class AccountData {
|
||||
constructor(dbAssoc = false) {
|
||||
this.databaseId = 0;
|
||||
this.name = "";
|
||||
this.password = "";
|
||||
this.registerDate = 0;
|
||||
this.flags = {
|
||||
moderation: 0,
|
||||
admin: 0,
|
||||
};
|
||||
this.staffTitle = "";
|
||||
this.ircAccount = "";
|
||||
this.discordAccount = 0;
|
||||
this.settings = 0;
|
||||
this.emailAddress = "";
|
||||
this.ipAddress = 0;
|
||||
|
||||
this.notes = [];
|
||||
this.messages = [];
|
||||
this.contacts = [];
|
||||
this.subAccounts = [];
|
||||
|
||||
this.emailVerificationCode = "";
|
||||
this.twoFactorAuthVerificationCode = "";
|
||||
|
||||
this.chatScrollLines = 1;
|
||||
|
||||
this.streamingRadioVolume = 20;
|
||||
this.locale = 0;
|
||||
|
||||
if (dbAssoc) {
|
||||
this.databaseId = dbAssoc["acct_id"];
|
||||
this.name = dbAssoc["acct_name"];
|
||||
this.password = dbAssoc["acct_pass"];
|
||||
this.registerDate = dbAssoc["acct_when_made"];
|
||||
this.flags = {
|
||||
moderation: dbAssoc["acct_svr_mod_flags"],
|
||||
admin: dbAssoc["acct_svr_staff_flags"],
|
||||
};
|
||||
this.staffTitle = dbAssoc["acct_svr_staff_title"];
|
||||
this.ircAccount = dbAssoc["acct_irc"];
|
||||
this.discordAccount = dbAssoc["acct_discord"];
|
||||
this.settings = dbAssoc["acct_svr_settings"];
|
||||
this.emailAddress = dbAssoc["acct_email"];
|
||||
this.whenRegistered = dbAssoc["acct_when_registered"];
|
||||
this.ipAddress = dbAssoc["acct_ip"];
|
||||
|
||||
this.notes = [];
|
||||
this.messages = [];
|
||||
this.contacts = [];
|
||||
this.subAccounts = [];
|
||||
|
||||
this.emailVerificationCode = dbAssoc["acct_code_verifyemail"];
|
||||
this.twoFactorAuthVerificationCode = dbAssoc["acct_code_2fa"];
|
||||
this.chatScrollLines = toInteger(dbAssoc["acct_svr_chat_scroll_lines"]);
|
||||
this.streamingRadioVolume = toInteger(dbAssoc["acct_streaming_radio_volume"]);
|
||||
this.locale = toInteger(dbAssoc["acct_locale"]);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
/**
|
||||
* @class Representing an account's contact list, loaded/saved in the database
|
||||
*/
|
||||
class AccountContactData {
|
||||
constructor(dbAssoc = false) {
|
||||
this.databaseId = 0;
|
||||
this.accountId = 0;
|
||||
this.contactAccountId = 0;
|
||||
this.type = 0;
|
||||
this.whenAdded = 0;
|
||||
this.needsSaved = false;
|
||||
|
||||
if (dbAssoc) {
|
||||
this.databaseId = dbAssoc["acct_contact_id"];
|
||||
this.accountId = dbAssoc["acct_contact_acct"];
|
||||
this.contactAccountId = dbAssoc["acct_contact_contact"];
|
||||
this.type = dbAssoc["acct_contact_type"];
|
||||
this.whenAdded = dbAssoc["acct_contact_when_added"];
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
/**
|
||||
* @class Representing an account's messages, loaded/saved in the database
|
||||
*/
|
||||
class AccountMessageData {
|
||||
constructor(dbAssoc = false) {
|
||||
this.databaseId = 0;
|
||||
this.account = 0;
|
||||
this.whoSent = 0;
|
||||
this.whenSent = 0;
|
||||
this.whenRead = 0;
|
||||
this.deleted = false;
|
||||
this.whenDeleted = 0;
|
||||
this.folder = 0;
|
||||
this.message = "";
|
||||
this.needsSaved = false;
|
||||
|
||||
if (dbAssoc) {
|
||||
this.databaseId = dbAssoc["acct_msg_id"];
|
||||
this.account = dbAssoc["acct_msg_acct"];
|
||||
this.whoSent = dbAssoc["acct_msg_who_sent"];
|
||||
this.whenSent = dbAssoc["acct_msg_when_sent"];
|
||||
this.whenRead = dbAssoc["acct_msg_when_read"];
|
||||
this.deleted = intToBool(dbAssoc["acct_msg_deleted"]);
|
||||
this.whenDeleted = dbAssoc["acct_msg_when_deleted"];
|
||||
this.folder = dbAssoc["acct_msg_folder"];
|
||||
this.message = dbAssoc["acct_msg_message"];
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
/**
|
||||
* @class Representing an account's staff notes. Visible only to staff and loaded/saved in the database
|
||||
*/
|
||||
class AccountStaffNoteData {
|
||||
constructor(dbAssoc = false) {
|
||||
this.databaseId = 0;
|
||||
this.account = 0;
|
||||
this.whoAdded = 0;
|
||||
this.whenAdded = 0;
|
||||
this.deleted = false;
|
||||
this.whenDeleted = 0;
|
||||
this.serverId = 0;
|
||||
this.note = "";
|
||||
this.needsSaved = false;
|
||||
|
||||
if (dbAssoc) {
|
||||
this.databaseId = dbAssoc["acct_note_id"];
|
||||
this.account = dbAssoc["acct_note_acct"];
|
||||
this.whoAdded = dbAssoc["acct_note_who_added"];
|
||||
this.whenAdded = dbAssoc["acct_note_when_added"];
|
||||
this.deleted = intToBool(dbAssoc["acct_note_deleted"]);
|
||||
this.whenDeleted = dbAssoc["acct_note_when_deleted"];
|
||||
this.serverId = dbAssoc["acct_note_server"];
|
||||
this.note = dbAssoc["acct_note_message"];
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function initAccountScript() {
|
||||
logToConsole(LOG_DEBUG, "[VRR.Account]: Initializing account script ...");
|
||||
logToConsole(LOG_DEBUG, "[VRR.Account]: Account script initialized!");
|
||||
@@ -1189,7 +1374,7 @@ function initClient(client) {
|
||||
return false;
|
||||
}
|
||||
|
||||
setEntityData(client, "vrr.isInitialized", true, false);
|
||||
setEntityData(client, "agrp.isInitialized", true, false);
|
||||
|
||||
sendPlayerGUIColours(client);
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ function initAnimationScript() {
|
||||
// ===========================================================================
|
||||
|
||||
function playPlayerAnimationCommand(command, params, client) {
|
||||
if(areParamsEmpty(params)) {
|
||||
if (areParamsEmpty(params)) {
|
||||
messagePlayerSyntax(client, getCommandSyntaxText(command));
|
||||
return false;
|
||||
}
|
||||
@@ -23,22 +23,22 @@ function playPlayerAnimationCommand(command, params, client) {
|
||||
let animationSlot = getAnimationFromParams(getParam(params, " ", 1));
|
||||
let animationPositionOffset = 1;
|
||||
|
||||
if(!animationSlot) {
|
||||
if (!animationSlot) {
|
||||
messagePlayerError(client, getLocaleString(client, "InvalidAnimation"));
|
||||
messagePlayerInfo(client, getLocaleString(client, "AnimationCommandTip", `{ALTCOLOUR}/animlist{MAINCOLOUR}`));
|
||||
return false;
|
||||
}
|
||||
|
||||
if(toInteger(animationPositionOffset) < 0 || toInteger(animationPositionOffset) > 3) {
|
||||
if (toInteger(animationPositionOffset) < 0 || toInteger(animationPositionOffset) > 3) {
|
||||
messagePlayerError(client, getLocaleString(client, "InvalidAnimationDistance"));
|
||||
return false;
|
||||
}
|
||||
|
||||
if(getAnimationData(animationSlot)[3] == VRR_ANIMTYPE_SURRENDER) {
|
||||
if (getAnimationData(animationSlot)[3] == VRR_ANIMTYPE_SURRENDER) {
|
||||
getPlayerData(client).pedState = VRR_PEDSTATE_HANDSUP;
|
||||
}
|
||||
|
||||
if(isPlayerHandCuffed(client) || isPlayerTazed(client) || isPlayerInForcedAnimation(client)) {
|
||||
if (isPlayerHandCuffed(client) || isPlayerTazed(client) || isPlayerInForcedAnimation(client)) {
|
||||
messagePlayerError(client, getLocaleString(client, "UnableToDoThat"));
|
||||
return false;
|
||||
}
|
||||
@@ -50,7 +50,7 @@ function playPlayerAnimationCommand(command, params, client) {
|
||||
// ===========================================================================
|
||||
|
||||
function stopPlayerAnimationCommand(command, params, client) {
|
||||
if(isPlayerHandCuffed(client) || isPlayerTazed(client) || isPlayerInForcedAnimation(client)) {
|
||||
if (isPlayerHandCuffed(client) || isPlayerTazed(client) || isPlayerInForcedAnimation(client)) {
|
||||
messagePlayerError(client, getLocaleString(client, "UnableToDoThat"));
|
||||
return false;
|
||||
}
|
||||
@@ -70,13 +70,13 @@ function stopPlayerAnimationCommand(command, params, client) {
|
||||
// ===========================================================================
|
||||
|
||||
function showAnimationListCommand(command, params, client) {
|
||||
let animList = getGameConfig().animations[getGame()].map(function(x) { return x.name; });
|
||||
let animList = getGameConfig().animations[getGame()].map(function (x) { return x.name; });
|
||||
|
||||
let chunkedList = splitArrayIntoChunks(animList, 10);
|
||||
|
||||
messagePlayerInfo(client, makeChatBoxSectionHeader(getLocaleString(client, "HeaderAnimationsList")));
|
||||
|
||||
for(let i in chunkedList) {
|
||||
for (let i in chunkedList) {
|
||||
messagePlayerNormal(client, chunkedList[i].join(", "));
|
||||
}
|
||||
}
|
||||
@@ -107,7 +107,7 @@ function makePlayerPlayAnimation(client, animationSlot, offsetPosition = 1) {
|
||||
getPlayerData(client).animationForced = false;
|
||||
|
||||
makePedPlayAnimation(getPlayerPed(client), animationSlot, offsetPosition);
|
||||
setEntityData(getPlayerPed(client), "vrr.anim", animationSlot, true);
|
||||
setEntityData(getPlayerPed(client), "agrp.anim", animationSlot, true);
|
||||
//if(getAnimationData(animationSlot)[9] != VRR_ANIMMOVE_NONE) {
|
||||
// if(getGame() < VRR_GAME_GTA_SA) {
|
||||
// setPlayerMouseCameraState(client, true);
|
||||
@@ -145,14 +145,14 @@ function makePlayerStopAnimation(client) {
|
||||
|
||||
function getAnimationFromParams(params) {
|
||||
let animations = getGameConfig().animations[getGame()];
|
||||
if(isNaN(params)) {
|
||||
for(let i in animations) {
|
||||
if(toLowerCase(animations[i].name).indexOf(toLowerCase(params)) != -1) {
|
||||
if (isNaN(params)) {
|
||||
for (let i in animations) {
|
||||
if (toLowerCase(animations[i].name).indexOf(toLowerCase(params)) != -1) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if(typeof getGameConfig().animations[getGame()][params] != "undefined") {
|
||||
if (typeof getGameConfig().animations[getGame()][params] != "undefined") {
|
||||
return toInteger(params);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,6 +7,36 @@
|
||||
// TYPE: Server (JavaScript)
|
||||
// ===========================================================================
|
||||
|
||||
// Ban Types
|
||||
const VRR_BANTYPE_NONE = 0;
|
||||
const VRR_BANTYPE_ACCOUNT = 1;
|
||||
const VRR_BANTYPE_SUBACCOUNT = 2;
|
||||
const VRR_BANTYPE_IPADDRESS = 3;
|
||||
const VRR_BANTYPE_SUBNET = 4;
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
class BanData {
|
||||
constructor(dbAssoc = false) {
|
||||
this.databaseId = 0;
|
||||
this.type = VRR_BANTYPE_NONE;
|
||||
this.detail = "";
|
||||
this.ipAddress = "";
|
||||
this.name = "";
|
||||
this.reason = "";
|
||||
|
||||
if (dbAssoc) {
|
||||
this.databaseId = toInteger(dbAssoc["ban_id"]);
|
||||
this.type = dbAssoc["ban_type"];
|
||||
this.detail = toInteger(dbAssoc["ban_detail"]);
|
||||
this.ipAddress = toInteger(dbAssoc["ban_ip"]);
|
||||
this.reason = toInteger(dbAssoc["ban_reason"]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function initBanScript() {
|
||||
logToConsole(LOG_INFO, "[VRR.Ban]: Initializing ban script ...");
|
||||
logToConsole(LOG_INFO, "[VRR.Ban]: Ban script initialized!");
|
||||
|
||||
@@ -7,10 +7,171 @@
|
||||
// TYPE: Server (JavaScript)
|
||||
// ===========================================================================
|
||||
|
||||
// Business Types
|
||||
const VRR_BIZ_TYPE_NONE = 0; // None (invalid)
|
||||
const VRR_BIZ_TYPE_NORMAL = 1; // Normal business (sells items)
|
||||
const VRR_BIZ_TYPE_BANK = 2; // Bank
|
||||
const VRR_BIZ_TYPE_PUBLIC = 3; // Public business (Government, public service, etc)
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
// Business Location Types
|
||||
const VRR_BIZLOC_NONE = 0; // None
|
||||
const VRR_BIZLOC_GATE = 1; // Center of any moveable gate that belongs to the biz
|
||||
const VRR_BIZLOC_GARAGE = 2; // Location for attached garage (pos1 = outside, pos2 = inside). Use pos to teleport or spawn veh/ped
|
||||
const VRR_BIZLOC_FUEL = 3; // Fuel pump
|
||||
const VRR_BIZLOC_DRIVETHRU = 4; // Drivethrough
|
||||
const VRR_BIZLOC_VENDMACHINE = 5; // Vending machine
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
// Business Owner Types
|
||||
const VRR_BIZOWNER_NONE = 0; // Not owned
|
||||
const VRR_BIZOWNER_PLAYER = 1; // Owned by a player (character/subaccount)
|
||||
const VRR_BIZOWNER_JOB = 2; // Owned by a job
|
||||
const VRR_BIZOWNER_CLAN = 3; // Owned by a clan
|
||||
const VRR_BIZOWNER_FACTION = 4; // Owned by a faction (not used at the moment)
|
||||
const VRR_BIZOWNER_PUBLIC = 5; // Public Business. Used for goverment/official places like police, fire, city hall, DMV, etc
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
/**
|
||||
* @class Representing a businesses' data. Loaded and saved in the database
|
||||
*/
|
||||
class BusinessData {
|
||||
constructor(dbAssoc = false) {
|
||||
this.databaseId = 0;
|
||||
this.name = "";
|
||||
this.ownerType = VRR_BIZOWNER_NONE;
|
||||
this.ownerId = 0;
|
||||
this.buyPrice = 0;
|
||||
this.locked = false;
|
||||
this.hasInterior = false;
|
||||
this.index = -1;
|
||||
this.needsSaved = false;
|
||||
this.interiorLights = true;
|
||||
|
||||
this.floorItemCache = [];
|
||||
this.storageItemCache = [];
|
||||
this.locations = [];
|
||||
this.gameScripts = [];
|
||||
|
||||
this.entrancePosition = false;
|
||||
this.entranceRotation = 0.0;
|
||||
this.entranceInterior = 0;
|
||||
this.entranceDimension = 0;
|
||||
this.entrancePickupModel = -1;
|
||||
this.entranceBlipModel = -1;
|
||||
this.entrancePickup = null;
|
||||
this.entranceBlip = null;
|
||||
|
||||
this.exitPosition = false;
|
||||
this.exitRotation = 0.0;
|
||||
this.exitInterior = 0;
|
||||
this.exitDimension = 0;
|
||||
this.exitPickupModel = -1;
|
||||
this.exitBlipModel = -1;
|
||||
this.exitPickup = null;
|
||||
this.exitBlip = null;
|
||||
|
||||
this.entranceFee = 0;
|
||||
this.till = 0;
|
||||
|
||||
this.streamingRadioStation = -1;
|
||||
|
||||
this.labelHelpType = VRR_PROPLABEL_INFO_NONE;
|
||||
|
||||
if (dbAssoc) {
|
||||
this.databaseId = toInteger(dbAssoc["biz_id"]);
|
||||
this.name = toString(dbAssoc["biz_name"]);
|
||||
this.ownerType = toInteger(dbAssoc["biz_owner_type"]);
|
||||
this.ownerId = toInteger(dbAssoc["biz_owner_id"]);
|
||||
this.buyPrice = toInteger(dbAssoc["biz_buy_price"]);
|
||||
this.locked = intToBool(toInteger(dbAssoc["biz_locked"]));
|
||||
this.hasInterior = intToBool(toInteger(dbAssoc["biz_has_interior"]));
|
||||
this.interiorLights = intToBool(toInteger(dbAssoc["biz_interior_lights"]));
|
||||
|
||||
this.entrancePosition = toVector3(toFloat(dbAssoc["biz_entrance_pos_x"]), toFloat(dbAssoc["biz_entrance_pos_y"]), toFloat(dbAssoc["biz_entrance_pos_z"]));
|
||||
this.entranceRotation = toInteger(dbAssoc["biz_entrance_rot_z"]);
|
||||
this.entranceInterior = toInteger(dbAssoc["biz_entrance_int"]);
|
||||
this.entranceDimension = toInteger(dbAssoc["biz_entrance_vw"]);
|
||||
this.entrancePickupModel = toInteger(dbAssoc["biz_entrance_pickup"]);
|
||||
this.entranceBlipModel = toInteger(dbAssoc["biz_entrance_blip"]);
|
||||
|
||||
this.exitPosition = toVector3(dbAssoc["biz_exit_pos_x"], dbAssoc["biz_exit_pos_y"], dbAssoc["biz_exit_pos_z"]);
|
||||
this.exitRotation = toInteger(dbAssoc["biz_exit_rot_z"]);
|
||||
this.exitInterior = toInteger(dbAssoc["biz_exit_int"]);
|
||||
this.exitDimension = toInteger(dbAssoc["biz_exit_vw"]);
|
||||
this.exitPickupModel = toInteger(dbAssoc["biz_exit_pickup"]);
|
||||
this.exitBlipModel = toInteger(dbAssoc["biz_exit_blip"]);
|
||||
|
||||
this.entranceFee = toInteger(dbAssoc["biz_entrance_fee"]);
|
||||
this.till = toInteger(dbAssoc["biz_till"]);
|
||||
|
||||
this.labelHelpType = toInteger(dbAssoc["biz_label_help_type"]);
|
||||
this.streamingRadioStation = toInteger(dbAssoc["biz_radiostation"]);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* @class Representing a business's location data. Multiple can be used for a single business. Used for things like doors, fuel pumps, drive thru positions, etc. Loaded and saved in the database
|
||||
*/
|
||||
class BusinessLocationData {
|
||||
constructor(dbAssoc = false) {
|
||||
this.databaseId = 0;
|
||||
this.name = "";
|
||||
this.type = 0;
|
||||
this.business = 0;
|
||||
this.enabled = false;
|
||||
this.index = -1;
|
||||
this.businessIndex = -1;
|
||||
this.needsSaved = false;
|
||||
|
||||
this.position = toVector3(0.0, 0.0, 0.0);
|
||||
this.interior = 0;
|
||||
this.dimension = 0;
|
||||
|
||||
if (dbAssoc) {
|
||||
this.databaseId = toInteger(dbAssoc["biz_loc_id"]);
|
||||
this.name = toString(dbAssoc["biz_loc_name"]);
|
||||
this.type = toInteger(dbAssoc["biz_loc_type"]);
|
||||
this.business = toInteger(dbAssoc["biz_loc_biz"]);
|
||||
this.enabled = intToBool(toInteger(dbAssoc["biz_loc_enabled"]));
|
||||
|
||||
this.position = toVector3(toFloat(dbAssoc["biz_loc_pos_x"]), toFloat(dbAssoc["biz_loc_pos_y"]), toFloat(dbAssoc["biz_loc_pos_z"]));
|
||||
this.interior = toInteger(dbAssoc["biz_loc_int"]);
|
||||
this.dimension = toInteger(dbAssoc["biz_loc_vw"]);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @class Representing a business's game scripts. Multiple can be used for a single business. Used for things like bar and club NPCs and other actions
|
||||
*/
|
||||
class BusinessGameScriptData {
|
||||
constructor(dbAssoc = false) {
|
||||
this.databaseId = 0;
|
||||
this.name = "";
|
||||
this.business = 0;
|
||||
this.enabled = false;
|
||||
this.index = -1;
|
||||
this.businessIndex = -1;
|
||||
this.needsSaved = false;
|
||||
|
||||
if (dbAssoc) {
|
||||
this.databaseId = toInteger(dbAssoc["biz_script_id"]);
|
||||
this.name = toString(dbAssoc["biz_script_name"]);
|
||||
this.state = toInteger(dbAssoc["biz_script_state"]);
|
||||
this.business = toInteger(dbAssoc["biz_script_biz"]);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function initBusinessScript() {
|
||||
logToConsole(LOG_INFO, "[VRR.Business]: Initializing business script ...");
|
||||
|
||||
|
||||
logToConsole(LOG_INFO, "[VRR.Business]: Business script initialized successfully!");
|
||||
return true;
|
||||
}
|
||||
@@ -285,7 +446,7 @@ function setBusinessNameCommand(command, params, client) {
|
||||
|
||||
let oldBusinessName = getBusinessData(businessId).name;
|
||||
getBusinessData(businessId).name = newBusinessName;
|
||||
setEntityData(getBusinessData(businessId).entrancePickup, "vrr.label.name", getBusinessData(businessId).name, true);
|
||||
setEntityData(getBusinessData(businessId).entrancePickup, "agrp.label.name", getBusinessData(businessId).name, true);
|
||||
getBusinessData(businessId).needsSaved = true;
|
||||
messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} renamed business {businessBlue}${oldBusinessName}{MAINCOLOUR} to {businessBlue}${newBusinessName}`);
|
||||
}
|
||||
@@ -1246,7 +1407,7 @@ function setBusinessBuyPriceCommand(command, params, client) {
|
||||
}
|
||||
|
||||
getBusinessData(businessId).buyPrice = amount;
|
||||
setEntityData(getBusinessData(businessId).entrancePickup, "vrr.label.price", getBusinessData(businessId).buyPrice, true);
|
||||
setEntityData(getBusinessData(businessId).entrancePickup, "agrp.label.price", getBusinessData(businessId).buyPrice, true);
|
||||
|
||||
getBusinessData(businessId).needsSaved = true;
|
||||
messagePlayerSuccess(client, `{MAINCOLOUR}You set business {businessBlue}${getBusinessData(businessId).name}'s {MAINCOLOUR}for-sale price to {ALTCOLOUR}$${makeLargeNumberReadable(amount)}`);
|
||||
@@ -2649,50 +2810,50 @@ function updateBusinessPickupLabelData(businessId) {
|
||||
}
|
||||
|
||||
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);
|
||||
setEntityData(getBusinessData(businessId).exitPickup, "agrp.owner.type", VRR_PICKUP_BUSINESS_EXIT, false);
|
||||
setEntityData(getBusinessData(businessId).exitPickup, "agrp.owner.id", businessId, false);
|
||||
setEntityData(getBusinessData(businessId).exitPickup, "agrp.label.type", VRR_LABEL_EXIT, true);
|
||||
}
|
||||
|
||||
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);
|
||||
setEntityData(getBusinessData(businessId).entrancePickup, "agrp.owner.type", VRR_PICKUP_BUSINESS_ENTRANCE, false);
|
||||
setEntityData(getBusinessData(businessId).entrancePickup, "agrp.owner.id", businessId, false);
|
||||
setEntityData(getBusinessData(businessId).entrancePickup, "agrp.label.type", VRR_LABEL_BUSINESS, true);
|
||||
setEntityData(getBusinessData(businessId).entrancePickup, "agrp.label.name", getBusinessData(businessId).name, true);
|
||||
setEntityData(getBusinessData(businessId).entrancePickup, "agrp.label.locked", getBusinessData(businessId).locked, true);
|
||||
setEntityData(getBusinessData(businessId).entrancePickup, "agrp.label.help", VRR_PROPLABEL_INFO_NONE, true);
|
||||
|
||||
switch (getBusinessData(businessId).labelHelpType) {
|
||||
case VRR_PROPLABEL_INFO_ENTERVEHICLE: {
|
||||
setEntityData(getBusinessData(businessId).entrancePickup, "vrr.label.help", VRR_PROPLABEL_INFO_ENTERVEHICLE, true);
|
||||
setEntityData(getBusinessData(businessId).entrancePickup, "agrp.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);
|
||||
setEntityData(getBusinessData(businessId).entrancePickup, "agrp.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);
|
||||
setEntityData(getBusinessData(businessId).entrancePickup, "agrp.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);
|
||||
setEntityData(getBusinessData(businessId).entrancePickup, "agrp.label.help", VRR_PROPLABEL_INFO_ENTER, true);
|
||||
} else {
|
||||
if (doesBusinessHaveAnyItemsToBuy(businessId)) {
|
||||
setEntityData(getBusinessData(businessId).entrancePickup, "vrr.label.help", VRR_PROPLABEL_INFO_BUY, true);
|
||||
setEntityData(getBusinessData(businessId).entrancePickup, "agrp.label.help", VRR_PROPLABEL_INFO_BUY, true);
|
||||
} else {
|
||||
removeEntityData(getBusinessData(businessId).entrancePickup, "vrr.label.help");
|
||||
removeEntityData(getBusinessData(businessId).entrancePickup, "agrp.label.help");
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
setEntityData(getBusinessData(businessId).entrancePickup, "vrr.label.price", getBusinessData(businessId).buyPrice, true);
|
||||
setEntityData(getBusinessData(businessId).entrancePickup, "agrp.label.price", getBusinessData(businessId).buyPrice, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -7,6 +7,103 @@
|
||||
// TYPE: Server (JavaScript)
|
||||
// ===========================================================================
|
||||
|
||||
/**
|
||||
* @class Representing a clan's data. Loaded and saved in the database
|
||||
*/
|
||||
class ClanData {
|
||||
constructor(dbAssoc = false) {
|
||||
this.databaseId = 0;
|
||||
this.name = "";
|
||||
this.ownerId = 0;
|
||||
this.tag = "";
|
||||
this.enabled = false;
|
||||
this.index = -1;
|
||||
this.colour = COLOUR_WHITE;
|
||||
this.colours = [];
|
||||
this.initialRank = 0;
|
||||
this.members = [];
|
||||
this.ranks = [];
|
||||
this.needsSaved = false;
|
||||
this.motd = false;
|
||||
|
||||
if(dbAssoc) {
|
||||
this.databaseId = toInteger(dbAssoc["clan_id"]);
|
||||
this.name = dbAssoc["clan_name"];
|
||||
this.owner = toInteger(dbAssoc["clan_owner"]);
|
||||
this.tag = dbAssoc["clan_tag"];
|
||||
this.enabled = intToBool(toInteger(dbAssoc["clan_enabled"]));
|
||||
this.colour = toColour(toInteger(dbAssoc["clan_col_r"]), toInteger(dbAssoc["clan_col_g"]), toInteger(dbAssoc["clan_col_b"]));
|
||||
this.colours = [toInteger(dbAssoc["clan_col_r"]), toInteger(dbAssoc["clan_col_g"]), toInteger(dbAssoc["clan_col_b"])];
|
||||
this.motd = dbAssoc["clan_motd"];
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
/**
|
||||
* @class Representing a clan rank's data. Loaded and saved in the database
|
||||
*/
|
||||
class ClanRankData {
|
||||
constructor(dbAssoc = false) {
|
||||
this.databaseId = 0;
|
||||
this.clan = 0;
|
||||
this.name = "";
|
||||
this.level = 0;
|
||||
this.flags = 0;
|
||||
this.customTag = "";
|
||||
this.enabled = true;
|
||||
this.index = -1;
|
||||
this.clanIndex = -1;
|
||||
this.needsSaved = false;
|
||||
|
||||
if(dbAssoc) {
|
||||
this.databaseId = toInteger(dbAssoc["clan_rank_id"]);
|
||||
this.clan = toInteger(dbAssoc["clan_rank_clan"]);
|
||||
this.name = dbAssoc["clan_rank_name"];
|
||||
this.level = toInteger(dbAssoc["clan_rank_level"]);
|
||||
this.flags = toInteger(dbAssoc["clan_rank_flags"]);
|
||||
this.tag = dbAssoc["clan_rank_tag"];
|
||||
this.enabled = intToBool(toInteger(dbAssoc["clan_rank_enabled"]));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
/**
|
||||
* @class Representing a clan member's data. Loaded and saved in the database
|
||||
*/
|
||||
class ClanMemberData {
|
||||
constructor(dbAssoc = false) {
|
||||
this.databaseId = 0;
|
||||
this.clan = 0;
|
||||
this.subAccount = 0;
|
||||
this.flags = 0;
|
||||
this.customTitle = "";
|
||||
this.customTag = "";
|
||||
this.rank = 0;
|
||||
this.enabled = false;
|
||||
this.index = -1;
|
||||
this.clanIndex = -1;
|
||||
this.rankIndex = -1;
|
||||
this.needsSaved = false;
|
||||
|
||||
if(dbAssoc) {
|
||||
this.databaseId = toInteger(dbAssoc["clan_member_id"]);
|
||||
this.subAccount = toInteger(dbAssoc["clan_member_sacct"]);
|
||||
this.clan = toInteger(dbAssoc["clan_member_clan"]);
|
||||
this.name = dbAssoc["clan_member_name"];
|
||||
this.rank = toInteger(dbAssoc["clan_member_rank"]);
|
||||
this.flags = toInteger(dbAssoc["clan_member_flags"]);
|
||||
this.customTag = dbAssoc["clan_member_tag"];
|
||||
this.customTitle = dbAssoc["clan_member_title"];
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function initClanScript() {
|
||||
logToConsole(LOG_INFO, "[VRR.Clan]: Initializing clans script ...");
|
||||
logToConsole(LOG_INFO, "[VRR.Clan]: Clan script initialized successfully!");
|
||||
|
||||
@@ -7,6 +7,41 @@
|
||||
// TYPE: Server (JavaScript)
|
||||
// ===========================================================================
|
||||
|
||||
/**
|
||||
* @class Representing a command's data. Loaded and saved in the database
|
||||
*/
|
||||
class CommandData {
|
||||
enable() {
|
||||
this.enabled = true;
|
||||
}
|
||||
|
||||
disable() {
|
||||
this.enabled = false;
|
||||
}
|
||||
|
||||
toggleEnabled() {
|
||||
this.enabled = !this.enabled;
|
||||
}
|
||||
|
||||
constructor(command, handlerFunction, syntaxString, requiredStaffFlags, requireLogin, allowOnDiscord, helpDescription) {
|
||||
this.command = command;
|
||||
this.handlerFunction = handlerFunction;
|
||||
this.syntaxString = syntaxString;
|
||||
this.requiredStaffFlags = requiredStaffFlags;
|
||||
this.enabled = true;
|
||||
this.requireLogin = requireLogin;
|
||||
this.allowOnDiscord = allowOnDiscord;
|
||||
this.helpDescription = helpDescription;
|
||||
this.aliases = [];
|
||||
}
|
||||
};
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
let serverCommands = [];
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function initCommandScript() {
|
||||
logToConsole(LOG_INFO, "[VRR.Command]: Initializing commands script ...");
|
||||
logToConsole(LOG_INFO, "[VRR.Command]: Initialized commands script!");
|
||||
@@ -612,8 +647,8 @@ function loadCommands() {
|
||||
function addAllCommandHandlers() {
|
||||
let commandCount = 0;
|
||||
let commands = getCommands();
|
||||
for(let i in commands) {
|
||||
for(let j in commands[i]) {
|
||||
for (let i in commands) {
|
||||
for (let j in commands[i]) {
|
||||
logToConsole(LOG_DEBUG, `[VRR.Command] Adding command handler for ${i} - ${commands[i][j].command}`);
|
||||
addCommandHandler(commands[i][j].command, processPlayerCommand);
|
||||
commandCount++;
|
||||
@@ -627,10 +662,10 @@ function addAllCommandHandlers() {
|
||||
|
||||
function getCommand(command) {
|
||||
let commandGroups = getCommands()
|
||||
for(let i in commandGroups) {
|
||||
for (let i in commandGroups) {
|
||||
let commandGroup = commandGroups[i];
|
||||
for(let j in commandGroup) {
|
||||
if(toLowerCase(commandGroup[j].command) == toLowerCase(command)) {
|
||||
for (let j in commandGroup) {
|
||||
if (toLowerCase(commandGroup[j].command) == toLowerCase(command)) {
|
||||
return commandGroup[j];
|
||||
}
|
||||
}
|
||||
@@ -684,14 +719,14 @@ function isCommandAllowedOnDiscord(command) {
|
||||
// ===========================================================================
|
||||
|
||||
function disableCommand(command, params, client) {
|
||||
if(areParamsEmpty(params)) {
|
||||
if (areParamsEmpty(params)) {
|
||||
messagePlayerSyntax(client, getCommandSyntaxText(command));
|
||||
return false;
|
||||
}
|
||||
|
||||
params = toLowerCase(params);
|
||||
|
||||
if(!getCommand(params)) {
|
||||
if (!getCommand(params)) {
|
||||
messagePlayerError(client, `The command {ALTCOLOUR}/${params} {MAINCOLOUR} does not exist!`);
|
||||
return false;
|
||||
}
|
||||
@@ -704,14 +739,14 @@ function disableCommand(command, params, client) {
|
||||
// ===========================================================================
|
||||
|
||||
function enableCommand(command, params, client) {
|
||||
if(areParamsEmpty(params)) {
|
||||
if (areParamsEmpty(params)) {
|
||||
messagePlayerSyntax(client, getCommandSyntaxText(command));
|
||||
return false;
|
||||
}
|
||||
|
||||
params = toLowerCase(params);
|
||||
|
||||
if(!getCommand(params)) {
|
||||
if (!getCommand(params)) {
|
||||
messagePlayerError(client, `The command {ALTCOLOUR}/${params} {MAINCOLOUR} does not exist!`);
|
||||
return false;
|
||||
}
|
||||
@@ -724,19 +759,19 @@ function enableCommand(command, params, client) {
|
||||
// ===========================================================================
|
||||
|
||||
function disableAllCommandsByType(command, params, client) {
|
||||
if(areParamsEmpty(params)) {
|
||||
if (areParamsEmpty(params)) {
|
||||
messagePlayerSyntax(client, getCommandSyntaxText(command));
|
||||
return false;
|
||||
}
|
||||
|
||||
params = toLowerCase(params);
|
||||
|
||||
if(isNull(getServerData().commands[params])) {
|
||||
if (isNull(getServerData().commands[params])) {
|
||||
messagePlayerError(client, `Command type {ALTCOLOUR}${params} {MAINCOLOUR}does not exist!`);
|
||||
return false;
|
||||
}
|
||||
|
||||
for(let i in getServerData().commands[params]) {
|
||||
for (let i in getServerData().commands[params]) {
|
||||
getServerData().commands[params][i].enabled = false;
|
||||
}
|
||||
|
||||
@@ -747,19 +782,19 @@ function disableAllCommandsByType(command, params, client) {
|
||||
// ===========================================================================
|
||||
|
||||
function enableAllCommandsByType(command, params, client) {
|
||||
if(areParamsEmpty(params)) {
|
||||
if (areParamsEmpty(params)) {
|
||||
messagePlayerSyntax(client, getCommandSyntaxText(command));
|
||||
return false;
|
||||
}
|
||||
|
||||
params = toLowerCase(params);
|
||||
|
||||
if(isNull(getServerData().commands[params])) {
|
||||
if (isNull(getServerData().commands[params])) {
|
||||
messagePlayerError(client, `Command type {ALTCOLOUR}${params} {MAINCOLOUR}does not exist!`);
|
||||
return false;
|
||||
}
|
||||
|
||||
for(let i in getServerData().commands[params]) {
|
||||
for (let i in getServerData().commands[params]) {
|
||||
getServerData().commands[params][i].enabled = true;
|
||||
}
|
||||
|
||||
@@ -776,22 +811,22 @@ function enableAllCommandsByType(command, params, client) {
|
||||
// ===========================================================================
|
||||
|
||||
function processPlayerCommand(command, params, client) {
|
||||
if(builtInCommands.indexOf(toLowerCase(command)) != -1) {
|
||||
if (builtInCommands.indexOf(toLowerCase(command)) != -1) {
|
||||
return true;
|
||||
}
|
||||
|
||||
let commandData = getCommand(toLowerCase(command));
|
||||
|
||||
let paramsDisplay = params;
|
||||
if(areParamsEmpty(params)) {
|
||||
if (areParamsEmpty(params)) {
|
||||
paramsDisplay = "";
|
||||
}
|
||||
|
||||
if(!doesCommandExist(toLowerCase(command))) {
|
||||
if (!doesCommandExist(toLowerCase(command))) {
|
||||
logToConsole(LOG_WARN, `[VRR.Command] ${getPlayerDisplayForConsole(client)} attempted to use command, but failed (invalid command): /${command} ${paramsDisplay}`);
|
||||
|
||||
let possibleCommand = getCommandFromParams(command);
|
||||
if(possibleCommand != false && doesPlayerHaveStaffPermission(client, getCommandRequiredPermissions(toLowerCase(possibleCommand.command)))) {
|
||||
if (possibleCommand != false && doesPlayerHaveStaffPermission(client, getCommandRequiredPermissions(toLowerCase(possibleCommand.command)))) {
|
||||
messagePlayerError(client, getLocaleString(client, "InvalidCommandPossibleMatchTip", `{ALTCOLOUR}/${command}{MAINCOLOUR}`, `{ALTCOLOUR}${toLowerCase(possibleCommand.command)}{MAINCOLOUR}`));
|
||||
} else {
|
||||
messagePlayerError(client, getLocaleString(client, "InvalidCommandHelpTip", `{ALTCOLOUR}/${command}{MAINCOLOUR}`, `{ALTCOLOUR}/help{MAINCOLOUR}`));
|
||||
@@ -799,31 +834,31 @@ function processPlayerCommand(command, params, client) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!commandData.enabled) {
|
||||
if (!commandData.enabled) {
|
||||
logToConsole(LOG_WARN, `[VRR.Command] ${getPlayerDisplayForConsole(client)} attempted to use command, but failed (command is disabled): /${command} ${paramsDisplay}`);
|
||||
messagePlayerError(client, `The command {ALTCOLOUR}/${command}{MAINCOLOUR} is disabled!`);
|
||||
messagePlayerError(client, getLocaleString(client, "CommandDisabled", `{ALTCOLOUR}/${command}{MAINCOLOUR}`));
|
||||
return false;
|
||||
}
|
||||
|
||||
if(doesCommandRequireLogin(toLowerCase(command))) {
|
||||
if(!isPlayerLoggedIn(client)) {
|
||||
if (doesCommandRequireLogin(toLowerCase(command))) {
|
||||
if (!isPlayerLoggedIn(client)) {
|
||||
logToConsole(LOG_WARN, `[VRR.Command] ${getPlayerDisplayForConsole(client)} attempted to use command, but failed (requires login first): /${command} ${paramsDisplay}`);
|
||||
messagePlayerError(client, getLocaleString(client, "CommandRequiresLogin", `{ALTCOLOUR}/${command}{MAINCOLOUR}`));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if(isClientFromDiscord(client)) {
|
||||
if(!isCommandAllowedOnDiscord(command)) {
|
||||
if (isClientFromDiscord(client)) {
|
||||
if (!isCommandAllowedOnDiscord(command)) {
|
||||
logToConsole(LOG_WARN, `[VRR.Command] ${getPlayerDisplayForConsole(client)} attempted to use command from discord, but failed (not available on discord): /${command} ${paramsDisplay}`);
|
||||
messagePlayerError(client, `The {ALTCOLOUR}/${command}{MAINCOLOUR} command isn't available on discord!`);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if(!isConsole(client)) {
|
||||
if(!doesPlayerHaveStaffPermission(client, getCommandRequiredPermissions(toLowerCase(command)))) {
|
||||
if (!isConsole(client)) {
|
||||
if (!doesPlayerHaveStaffPermission(client, getCommandRequiredPermissions(toLowerCase(command)))) {
|
||||
logToConsole(LOG_WARN, `[VRR.Command] ${getPlayerDisplayForConsole(client)} attempted to use command, but failed (no permission): /${command} ${paramsDisplay}`);
|
||||
messagePlayerError(client, getLocaleString(client, "CommandNoPermissions", `{ALTCOLOUR}/${toLowerCase(command)}{MAINCOLOUR}`));
|
||||
return false;
|
||||
@@ -836,8 +871,8 @@ function processPlayerCommand(command, params, client) {
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
addCommandHandler("cmd", function(command, params, client) {
|
||||
if(!isConsole(client)) {
|
||||
addCommandHandler("cmd", function (command, params, client) {
|
||||
if (!isConsole(client)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -852,8 +887,8 @@ addCommandHandler("cmd", function(command, params, client) {
|
||||
|
||||
function listAllCommands() {
|
||||
let commands = getCommands();
|
||||
for(let i in commands) {
|
||||
for(let j in commands[i]) {
|
||||
for (let i in commands) {
|
||||
for (let j in commands[i]) {
|
||||
logToConsole(LOG_DEBUG, commands[i][j].command);
|
||||
}
|
||||
}
|
||||
@@ -864,8 +899,8 @@ function listAllCommands() {
|
||||
function getAllCommandsInSingleArray() {
|
||||
let tempCommands = [];
|
||||
let commands = getCommands();
|
||||
for(let i in commands) {
|
||||
for(let j in commands[i]) {
|
||||
for (let i in commands) {
|
||||
for (let j in commands[i]) {
|
||||
tempCommands.push(commands[i][j].command);
|
||||
}
|
||||
}
|
||||
@@ -878,8 +913,8 @@ function getAllCommandsInSingleArray() {
|
||||
function getAllCommandsInGroupInSingleArray(groupName, staffFlag = "None") {
|
||||
let tempCommands = [];
|
||||
let commands = getCommands();
|
||||
for(let i in commands[groupName]) {
|
||||
if(getCommandRequiredPermissions(commands[groupName][i].command) == 0) {
|
||||
for (let i in commands[groupName]) {
|
||||
if (getCommandRequiredPermissions(commands[groupName][i].command) == 0) {
|
||||
tempCommands.push(commands[groupName][i].command);
|
||||
}
|
||||
}
|
||||
@@ -892,10 +927,10 @@ function getAllCommandsInGroupInSingleArray(groupName, staffFlag = "None") {
|
||||
function getAllCommandsForStaffFlagInSingleArray(staffFlagName) {
|
||||
let tempCommands = [];
|
||||
let commands = getCommands();
|
||||
for(let i in commands) {
|
||||
for(let j in commands[i]) {
|
||||
if(getCommandRequiredPermissions(commands[i][j].command) != 0) {
|
||||
if(hasBitFlag(getCommandRequiredPermissions(commands[i][j].command), getStaffFlagValue(staffFlagName))) {
|
||||
for (let i in commands) {
|
||||
for (let j in commands[i]) {
|
||||
if (getCommandRequiredPermissions(commands[i][j].command) != 0) {
|
||||
if (hasBitFlag(getCommandRequiredPermissions(commands[i][j].command), getStaffFlagValue(staffFlagName))) {
|
||||
tempCommands.push(commands[i][j].command);
|
||||
}
|
||||
}
|
||||
@@ -908,7 +943,7 @@ function getAllCommandsForStaffFlagInSingleArray(staffFlagName) {
|
||||
// ===========================================================================
|
||||
|
||||
function doesCommandExist(command) {
|
||||
if(getCommandData(command)) {
|
||||
if (getCommandData(command)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -919,11 +954,11 @@ function doesCommandExist(command) {
|
||||
|
||||
function cacheAllCommandsAliases() {
|
||||
let commands = getCommands();
|
||||
for(let i in commands) {
|
||||
for(let j in commands[i]) {
|
||||
for(let k in commands) {
|
||||
for(let m in commands[k]) {
|
||||
if(commands[i][j].handlerFunction == commands[k][m].handlerFunction) {
|
||||
for (let i in commands) {
|
||||
for (let j in commands[i]) {
|
||||
for (let k in commands) {
|
||||
for (let m in commands[k]) {
|
||||
if (commands[i][j].handlerFunction == commands[k][m].handlerFunction) {
|
||||
commands[i][j].aliases.push(commands[k][m]);
|
||||
commands[k][m].aliases.push(commands[i][j]);
|
||||
}
|
||||
@@ -937,7 +972,7 @@ function cacheAllCommandsAliases() {
|
||||
|
||||
function getCommandAliasesNames(command) {
|
||||
let commandAliases = [];
|
||||
for(let i in command.aliases) {
|
||||
for (let i in command.aliases) {
|
||||
commandAliases.push(command.aliases[i].name);
|
||||
}
|
||||
|
||||
@@ -947,7 +982,7 @@ function getCommandAliasesNames(command) {
|
||||
// ===========================================================================
|
||||
|
||||
function areParamsEmpty(params) {
|
||||
if(!params || params == "" || params.length == 0 || typeof params == "undefined") {
|
||||
if (!params || params == "" || params.length == 0 || typeof params == "undefined") {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -969,16 +1004,16 @@ function areThereEnoughParams(params, requiredAmount, delimiter = " ") {
|
||||
// ===========================================================================
|
||||
|
||||
function getParam(params, delimiter, index) {
|
||||
return params.split(delimiter)[index-1];
|
||||
return params.split(delimiter)[index - 1];
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function getCommandFromParams(params) {
|
||||
let commands = getCommands();
|
||||
for(let i in commands) {
|
||||
for(let j in commands[i]) {
|
||||
if(toLowerCase(commands[i][j].command).indexOf(toLowerCase(params)) != -1) {
|
||||
for (let i in commands) {
|
||||
for (let j in commands[i]) {
|
||||
if (toLowerCase(commands[i][j].command).indexOf(toLowerCase(params)) != -1) {
|
||||
return commands[i][j];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,6 +7,127 @@
|
||||
// TYPE: Server (JavaScript)
|
||||
// ===========================================================================
|
||||
|
||||
/**
|
||||
* @class Representing data for server configuration
|
||||
*/
|
||||
class ServerConfigData {
|
||||
constructor(dbAssoc = false) {
|
||||
this.databaseId = 0;
|
||||
this.needsSaved = false;
|
||||
|
||||
this.newCharacter = {
|
||||
spawnPosition: toVector3(0.0, 0.0, 0.0),
|
||||
spawnHeading: 0.0,
|
||||
spawnInterior: 0,
|
||||
spawnDimension: 0,
|
||||
money: 0,
|
||||
bank: 0,
|
||||
skin: 0,
|
||||
};
|
||||
|
||||
this.connectCameraPosition = toVector3(0.0, 0.0, 0.0);
|
||||
this.connectCameraLookAt = toVector3(0.0, 0.0, 0.0);
|
||||
|
||||
this.characterSelectCameraPosition = toVector3(0.0, 0.0, 0.0);
|
||||
this.characterSelectCameraLookAt = toVector3(0.0, 0.0, 0.0);
|
||||
this.characterSelectPedPosition = toVector3(0.0, 0.0, 0.0);
|
||||
this.characterSelectPedHeading = 0.0;
|
||||
this.characterSelectInterior = 0;
|
||||
this.characterSelectDimension = 0;
|
||||
|
||||
this.hour = 0;
|
||||
this.minute = 0
|
||||
this.minuteDuration = 1000;
|
||||
this.weather = 0
|
||||
this.fallingSnow = false;
|
||||
this.groundSnow = false;
|
||||
this.useGUI = true;
|
||||
this.guiColourPrimary = [200, 200, 200];
|
||||
this.guiColourSecondary = [200, 200, 200];
|
||||
this.guiTextColourPrimary = [0, 0, 0];
|
||||
this.guiTextColourSecondary = [0, 0, 0];
|
||||
this.showLogo = true;
|
||||
this.inflationMultiplier = 1;
|
||||
this.testerOnly = false;
|
||||
this.settings = 0;
|
||||
|
||||
this.antiCheat = {
|
||||
enabled: false,
|
||||
//checkGameScripts: false,
|
||||
//gameScriptWhiteListEnabled: false,
|
||||
//gameScriptBlackListEnabled: false,
|
||||
//gameScriptWhiteList: [],
|
||||
//gameScriptBlackList: [],
|
||||
};
|
||||
|
||||
this.discordBotToken = "";
|
||||
this.discordEnabled = false;
|
||||
|
||||
this.createJobPickups = false;
|
||||
this.createBusinessPickups = false;
|
||||
this.createHousePickups = false;
|
||||
this.createJobBlips = false;
|
||||
this.createBusinessBlips = false;
|
||||
this.createHouseBlips = false;
|
||||
|
||||
this.introMusicURL = "";
|
||||
|
||||
this.pauseSavingToDatabase = false;
|
||||
|
||||
this.useRealTime = false;
|
||||
this.realTimeZone = 0;
|
||||
|
||||
this.discordConfig = {
|
||||
eventChannelWebHookURL: "",
|
||||
chatChannelWebHookURL: "",
|
||||
adminChannelWebHookURL: "",
|
||||
sendEvents: true,
|
||||
sendChat: true,
|
||||
sendAdminEvents: true,
|
||||
};
|
||||
|
||||
if (dbAssoc) {
|
||||
this.databaseId = dbAssoc["svr_id"];
|
||||
this.newCharacter = {
|
||||
spawnPosition: toVector3(dbAssoc["svr_newchar_pos_x"], dbAssoc["svr_newchar_pos_y"], dbAssoc["svr_newchar_pos_z"]),
|
||||
spawnHeading: dbAssoc["svr_newchar_rot_z"],
|
||||
money: dbAssoc["svr_newchar_money"],
|
||||
bank: dbAssoc["svr_newchar_bank"],
|
||||
skin: dbAssoc["svr_newchar_skin"],
|
||||
},
|
||||
this.settings = toInteger(dbAssoc["svr_settings"]);
|
||||
|
||||
this.connectCameraPosition = toVector3(dbAssoc["svr_connectcam_pos_x"], dbAssoc["svr_connectcam_pos_y"], dbAssoc["svr_connectcam_pos_z"]);
|
||||
this.connectCameraLookAt = toVector3(dbAssoc["svr_connectcam_lookat_x"], dbAssoc["svr_connectcam_lookat_y"], dbAssoc["svr_connectcam_lookat_z"]);
|
||||
|
||||
this.hour = toInteger(dbAssoc["svr_start_time_hour"]);
|
||||
this.minute = toInteger(dbAssoc["svr_start_time_min"]);
|
||||
this.minuteDuration = toInteger(dbAssoc["svr_time_min_duration"]);
|
||||
this.weather = toInteger(dbAssoc["svr_start_weather"]);
|
||||
this.guiColourPrimary = [toInteger(dbAssoc["svr_gui_col1_r"]), toInteger(dbAssoc["svr_gui_col1_g"]), toInteger(dbAssoc["svr_gui_col1_b"])];
|
||||
this.guiColourSecondary = [toInteger(dbAssoc["svr_gui_col2_r"]), toInteger(dbAssoc["svr_gui_col2_g"]), toInteger(dbAssoc["svr_gui_col2_b"])];
|
||||
this.guiTextColourPrimary = [toInteger(dbAssoc["svr_gui_textcol1_r"]), toInteger(dbAssoc["svr_gui_textcol1_g"]), toInteger(dbAssoc["svr_gui_textcol1_b"])];
|
||||
//this.guiTextColourSecondary = [toInteger(dbAssoc["svr_gui_textcol2_r"]), toInteger(dbAssoc["svr_gui_textcol2_g"]), toInteger(dbAssoc["svr_gui_textcol2_b"])];
|
||||
this.inflationMultiplier = toFloat(dbAssoc["svr_inflation_multiplier"]);
|
||||
|
||||
this.discordBotToken = intToBool(dbAssoc["svr_discord_bot_token"]);
|
||||
this.introMusicURL = dbAssoc["svr_intro_music"];
|
||||
this.realTimeZone = dbAssoc["svr_time_realtime_timezone"];
|
||||
|
||||
this.discordConfig = {
|
||||
eventChannelWebHookURL: dbAssoc["svr_discord_event_webhook"],
|
||||
chatChannelWebHookURL: dbAssoc["svr_discord_chat_webhook"],
|
||||
adminChannelWebHookURL: dbAssoc["svr_discord_admin_webhook"],
|
||||
sendEvents: true,
|
||||
sendChat: true,
|
||||
sendAdminEvents: true,
|
||||
};
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
let serverConfig = false;
|
||||
let gameConfig = false;
|
||||
|
||||
@@ -961,6 +1082,8 @@ function loadServerConfig() {
|
||||
logToConsole(LOG_ERROR, `[VRR.Config] Could not load server configuration for game ${getGame()} and port ${getServerPort}`);
|
||||
thisResource.stop();
|
||||
}
|
||||
|
||||
logToConsole(LOG_DEBUG | LOG_WARN, `Server ID: ${serverConfig.databaseId}`);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -1,371 +0,0 @@
|
||||
// ===========================================================================
|
||||
// Vortrex's Roleplay Resource
|
||||
// https://github.com/VortrexFTW/gtac_roleplay
|
||||
// ===========================================================================
|
||||
// FILE: const.js
|
||||
// DESC: Provides constants
|
||||
// TYPE: Server (JavaScript)
|
||||
// ===========================================================================
|
||||
|
||||
// Prompts (used for client GUI prompt responses)
|
||||
const VRR_PROMPT_NONE = 0;
|
||||
const VRR_PROMPT_CREATEFIRSTCHAR = 1;
|
||||
const VRR_PROMPT_BIZORDER = 2;
|
||||
const VRR_PROMPT_VEHGIVETOCLAN = 3;
|
||||
const VRR_PROMPT_HOUSEGIVETOCLAN = 4;
|
||||
const VRR_PROMPT_BIZGIVETOCLAN = 5;
|
||||
const VRR_PROMPT_HOUSEBUY = 6;
|
||||
const VRR_PROMPT_BIZBUY = 7;
|
||||
|
||||
// Job Types
|
||||
const VRR_JOB_NONE = 0;
|
||||
const VRR_JOB_POLICE = 1;
|
||||
const VRR_JOB_MEDICAL = 2;
|
||||
const VRR_JOB_FIRE = 3;
|
||||
const VRR_JOB_BUS = 4;
|
||||
const VRR_JOB_TAXI = 5;
|
||||
const VRR_JOB_GARBAGE = 6;
|
||||
const VRR_JOB_WEAPON = 7;
|
||||
const VRR_JOB_DRUG = 8;
|
||||
const VRR_JOB_PIZZA = 9;
|
||||
const VRR_JOB_GENERIC = 10;
|
||||
|
||||
// Pickup Types
|
||||
const VRR_PICKUP_NONE = 0;
|
||||
const VRR_PICKUP_JOB = 1;
|
||||
const VRR_PICKUP_BUSINESS_ENTRANCE = 2;
|
||||
const VRR_PICKUP_BUSINESS_EXIT = 3;
|
||||
const VRR_PICKUP_HOUSE_ENTRANCE = 4;
|
||||
const VRR_PICKUP_HOUSE_EXIT = 5;
|
||||
const VRR_PICKUP_EXIT = 6;
|
||||
|
||||
// Vehicle Owner Types
|
||||
const VRR_VEHOWNER_NONE = 0; // Not owned
|
||||
const VRR_VEHOWNER_PLAYER = 1; // Owned by a player (character/subaccount)
|
||||
const VRR_VEHOWNER_JOB = 2; // Owned by a job
|
||||
const VRR_VEHOWNER_CLAN = 3; // Owned by a clan
|
||||
const VRR_VEHOWNER_FACTION = 4; // Owned by a faction (not used at the moment)
|
||||
const VRR_VEHOWNER_PUBLIC = 5; // Public vehicle. Anybody can drive it.
|
||||
const VRR_VEHOWNER_BIZ = 6; // Owned by a business (also includes dealerships since they're businesses)
|
||||
|
||||
// Business Owner Types
|
||||
const VRR_BIZOWNER_NONE = 0; // Not owned
|
||||
const VRR_BIZOWNER_PLAYER = 1; // Owned by a player (character/subaccount)
|
||||
const VRR_BIZOWNER_JOB = 2; // Owned by a job
|
||||
const VRR_BIZOWNER_CLAN = 3; // Owned by a clan
|
||||
const VRR_BIZOWNER_FACTION = 4; // Owned by a faction (not used at the moment)
|
||||
const VRR_BIZOWNER_PUBLIC = 5; // Public Business. Used for goverment/official places like police, fire, city hall, DMV, etc
|
||||
|
||||
// House Owner Types
|
||||
const VRR_HOUSEOWNER_NONE = 0; // Not owned
|
||||
const VRR_HOUSEOWNER_PLAYER = 1; // Owner is a player (character/subaccount)
|
||||
const VRR_HOUSEOWNER_JOB = 2; // Owned by a job
|
||||
const VRR_HOUSEOWNER_CLAN = 3; // Owned by a clan
|
||||
const VRR_HOUSEOWNER_FACTION = 4; // Owned by a faction
|
||||
const VRR_HOUSEOWNER_PUBLIC = 5; // Is a public house. Technically not owned. This probably won't be used.
|
||||
const VRR_HOUSEOWNER_BIZ = 6; // Owned by a business. Used for apartment buildings where rent goes to business.
|
||||
|
||||
// Gate Owner Types
|
||||
const VRR_GATEOWNER_NONE = 0; // Not owned
|
||||
const VRR_GATEOWNER_PLAYER = 1; // Owner is a player (character/subaccount)
|
||||
const VRR_GATEOWNER_JOB = 2; // Owned by a job
|
||||
const VRR_GATEOWNER_CLAN = 3; // Owned by a clan
|
||||
const VRR_GATEOWNER_FACTION = 4; // Owned by a faction
|
||||
const VRR_GATEOWNER_PUBLIC = 5; // Public gate. Technically not owned. This probably won't be used.
|
||||
const VRR_GATEOWNER_BUSINESS = 6; // Owned by a business. Back lots, unloading areas, and other stuff like that
|
||||
const VRR_GATEOWNER_HOUSE = 7; // Owned by a house. Like for mansions with closed private areas.
|
||||
|
||||
// Business Location Types
|
||||
const VRR_BIZLOC_NONE = 0; // None
|
||||
const VRR_BIZLOC_GATE = 1; // Center of any moveable gate that belongs to the biz
|
||||
const VRR_BIZLOC_GARAGE = 2; // Location for attached garage (pos1 = outside, pos2 = inside). Use pos to teleport or spawn veh/ped
|
||||
const VRR_BIZLOC_FUEL = 3; // Fuel pump
|
||||
const VRR_BIZLOC_DRIVETHRU = 4; // Drivethrough
|
||||
const VRR_BIZLOC_VENDMACHINE = 5; // Vending machine
|
||||
|
||||
// House Location Types
|
||||
const VRR_HOUSELOC_NONE = 0; // None
|
||||
const VRR_HOUSELOC_GATE = 1; // Center of any moveable gate that belongs to the house
|
||||
const VRR_HOUSELOC_GARAGE = 2; // Location for garage (pos1 = outside, pos2 = inside). Use pos to teleport or spawn veh/ped
|
||||
|
||||
// Account Contact Types
|
||||
const VRR_CONTACT_NONE = 0;
|
||||
const VRR_CONTACT_NEUTRAL = 1; // Contact is neutral. Used for general contacts with no special additional features
|
||||
const VRR_CONTACT_FRIEND = 2; // Contact is a friend. Shows when they're online.
|
||||
const VRR_CONTACT_BLOCKED = 3; // Contact is blocked. Prevents all communication to/from them except for RP
|
||||
|
||||
// Job Work Types (Currently Unused)
|
||||
const VRR_JOBWORKTYPE_NONE = 0;
|
||||
const VRR_JOBWORKTYPE_ROUTE = 1; // Jobs that use routes. Bus, trash collector, mail, etc
|
||||
const VRR_JOBWORKTYPE_SELL = 2; // Jobs that sell items to other players and NPCs. Drugs, guns, etc
|
||||
const VRR_JOBWORKTYPE_SERVICE = 3; // Services to other players and NPCs. Taxi ride, mechanic fix, etc
|
||||
|
||||
// Vehicle Seats
|
||||
const VRR_VEHSEAT_DRIVER = 0;
|
||||
const VRR_VEHSEAT_FRONTPASSENGER = 1;
|
||||
const VRR_VEHSEAT_REARLEFTPASSENGER = 2;
|
||||
const VRR_VEHSEAT_REARRIGHTPASSENGER = 3;
|
||||
|
||||
// Ban Types
|
||||
const VRR_BANTYPE_NONE = 0;
|
||||
const VRR_BANTYPE_ACCOUNT = 1;
|
||||
const VRR_BANTYPE_SUBACCOUNT = 2;
|
||||
const VRR_BANTYPE_IPADDRESS = 3;
|
||||
const VRR_BANTYPE_SUBNET = 4;
|
||||
|
||||
// Blip Owner Types
|
||||
const VRR_BLIP_NONE = 0;
|
||||
const VRR_BLIP_JOB = 1;
|
||||
const VRR_BLIP_BUSINESS_ENTRANCE = 2;
|
||||
const VRR_BLIP_BUSINESS_EXIT = 3;
|
||||
const VRR_BLIP_HOUSE_ENTRANCE = 4;
|
||||
const VRR_BLIP_HOUSE_EXIT = 5;
|
||||
const VRR_BLIP_EXIT = 6;
|
||||
|
||||
// Insurance Account Owner Types
|
||||
const VRR_INS_ACCT_OWNER_NONE = 0; // None
|
||||
const VRR_INS_ACCT_OWNER_PLAYER = 1; // Player owns insurance company
|
||||
const VRR_INS_ACCT_OWNER_BIZ = 2; // Business owns insurance company
|
||||
const VRR_INS_ACCT_OWNER_CLAN = 3; // Clan owns insurance company
|
||||
|
||||
// Insurance Account Entity Types
|
||||
const VRR_INS_ACCT_ENTITY_NONE = 0; // None
|
||||
const VRR_INS_ACCT_ENTITY_PLAYER_HEALTH = 1; // Health Insurance
|
||||
const VRR_INS_ACCT_ENTITY_PLAYER_LIFE = 2; // Life Insurance
|
||||
const VRR_INS_ACCT_ENTITY_VEH = 3; // Vehicle Insurance
|
||||
const VRR_INS_ACCT_ENTITY_BIZ = 4; // Business Insurance
|
||||
const VRR_INS_ACCT_ENTITY_HOUSE = 5; // House Insurance
|
||||
|
||||
// Insurance Account History Types
|
||||
const VRR_INS_ACCT_HISTORY_NONE = 0; // None
|
||||
const VRR_INS_ACCT_HISTORY_PLAYER_MEDICAL = 1; // Medical insurance was used (player disease/injury)
|
||||
const VRR_INS_ACCT_HISTORY_PLAYER_DEATH = 2; // Life insurance was used (player death)
|
||||
const VRR_INS_ACCT_HISTORY_VEH_DAMAGE = 3; // Vehicle was damaged, but not destroyed
|
||||
const VRR_INS_ACCT_HISTORY_VEH_WRECKED = 4; // Vehicle was completely destroyed
|
||||
const VRR_INS_ACCT_HISTORY_VEH_THEFT = 5; // Vehicle was stolen
|
||||
const VRR_INS_ACCT_HISTORY_BIZ_DAMAGE = 6; // Business was damaged (broken items/window/door)
|
||||
const VRR_INS_ACCT_HISTORY_BIZ_THEFT = 7; // Business was stolen from
|
||||
const VRR_INS_ACCT_HISTORY_HOUSE_DAMAGE = 8; // House was damaged
|
||||
const VRR_INS_ACCT_HISTORY_HOUSE_THEFT = 9; // House was stolen from
|
||||
|
||||
// Islands
|
||||
const VRR_ISLAND_NONE = 0; // None
|
||||
const VRR_ISLAND_PORTLAND = 0; // Portland Island
|
||||
const VRR_ISLAND_STAUNTON = 1; // Staunton Island
|
||||
const VRR_ISLAND_SHORESIDEVALE = 2; // Shoreside Vale
|
||||
const VRR_ISLAND_VICEWEST = 0; // Western Island of VC
|
||||
const VRR_ISLAND_VICEEAST = 1; // Eastern Island of VC
|
||||
const VRR_ISLAND_LOSSANTOS = 0; // Los Santos
|
||||
const VRR_ISLAND_LASVENTURAS = 1; // Las Venturas
|
||||
const VRR_ISLAND_SANFIERRO = 2; // San Fierro
|
||||
const VRR_ISLAND_REDCOUNTYNORTH = 4; // Red County North (spans all the way from Palamino/shore on the east east to border of Flint County on the west)
|
||||
const VRR_ISLAND_BONECOUNTYNORTH = 5; // Bone County North (usually called Tierra Robada)
|
||||
const VRR_ISLAND_BONECOUNTYSOUTH = 6; // Bone County South
|
||||
|
||||
// Item Owners
|
||||
const VRR_ITEM_OWNER_NONE = 0; // None
|
||||
const VRR_ITEM_OWNER_PLAYER = 1; // Item is in a player's inventory
|
||||
const VRR_ITEM_OWNER_VEHTRUNK = 2; // Item is in a vehicle's trunk
|
||||
const VRR_ITEM_OWNER_VEHDASH = 3; // Item is in a vehicle's glove compartment
|
||||
const VRR_ITEM_OWNER_BIZFLOOR = 4; // Item is in the public area of a business (on the floor = ready to buy)
|
||||
const VRR_ITEM_OWNER_BIZSTORAGE = 5; // Item is in a business's storage area (stock room)
|
||||
const VRR_ITEM_OWNER_HOUSE = 6; // Item is in a house
|
||||
const VRR_ITEM_OWNER_SAFE = 7; // Item is in a safe (safes can be anywhere)
|
||||
const VRR_ITEM_OWNER_ITEM = 8; // Item is in another item (trashbag, briefcase, wallet, suitcase, crate/box, barrel, etc)
|
||||
const VRR_ITEM_OWNER_GROUND = 9; // Item is on the ground
|
||||
const VRR_ITEM_OWNER_JOBLOCKER = 10; // Item is in player's job locker
|
||||
const VRR_ITEM_OWNER_LOCKER = 10; // Item is in player's locker
|
||||
|
||||
// Item Use Types
|
||||
const VRR_ITEM_USETYPE_NONE = 0; // Has no effect
|
||||
const VRR_ITEM_USETYPE_WEAPON = 1; // Equips weapon
|
||||
const VRR_ITEM_USETYPE_AMMO_CLIP = 2; // Magazine for weapon. If in inventory, R will load it into gun
|
||||
const VRR_ITEM_USETYPE_PHONE = 3; // Pulls out phone
|
||||
const VRR_ITEM_USETYPE_GPS = 4; // Not sure how I want this to work yet
|
||||
const VRR_ITEM_USETYPE_MAP = 5; // Shows minimap on HUD
|
||||
const VRR_ITEM_USETYPE_SKIN = 6; // Changes skin (uses skin changer)
|
||||
const VRR_ITEM_USETYPE_PEDPART = 7; // Changes ped part (clothing, skin, hair, etc) (UNUSED)
|
||||
const VRR_ITEM_USETYPE_PEDPROP = 8; // Changes ped prop (watches, glasses, hats, etc) (UNUSED)
|
||||
const VRR_ITEM_USETYPE_STORAGE = 9; // Shows stored items. Backpack, crate, briefcase, wallet, etc
|
||||
const VRR_ITEM_USETYPE_VEHKEY = 10; // Locks/unlocks a vehicle and allows starting engine without hotwire
|
||||
const VRR_ITEM_USETYPE_BIZKEY = 11; // Locks/unlocks a business
|
||||
const VRR_ITEM_USETYPE_HOUSEKEY = 12; // Locks/unlocks a house
|
||||
const VRR_ITEM_USETYPE_SEED = 13; // Plants a seed
|
||||
const VRR_ITEM_USETYPE_WEED = 14; // Light drug effect (short term relief of addiction symptoms?)
|
||||
const VRR_ITEM_USETYPE_COKE = 15; // Medium drug effect (medium term relief of addiction symptoms?)
|
||||
const VRR_ITEM_USETYPE_METH = 16; // Heavy drug effect (extended term relief of addiction symptoms?)
|
||||
const VRR_ITEM_USETYPE_CIGAR = 17; // Just for appearance. Makes people look cool I guess
|
||||
const VRR_ITEM_USETYPE_WATER = 18; // Replenishes small amount of health
|
||||
const VRR_ITEM_USETYPE_FOOD = 19; // Eat food. Replenishes a small amount of health
|
||||
const VRR_ITEM_USETYPE_BEER = 20; // Subtle drunk effect. Replenishes small amount of health.
|
||||
const VRR_ITEM_USETYPE_WINE = 21; // Moderate drunk effect. Replenishes moderate amount of health.
|
||||
const VRR_ITEM_USETYPE_LIQUOR = 22; // Heavy drunk effect. Replenishes large amount of health.
|
||||
const VRR_ITEM_USETYPE_COFFEE = 23; // Replenishes moderate amount of health.
|
||||
const VRR_ITEM_USETYPE_AMMO_ROUND = 23; // Bullet. Loads into magazine. Not used at the moment
|
||||
const VRR_ITEM_USETYPE_HANDCUFF = 24; //
|
||||
const VRR_ITEM_USETYPE_ROPE = 25; //
|
||||
const VRR_ITEM_USETYPE_BLINDFOLD = 26; //
|
||||
const VRR_ITEM_USETYPE_TAZER = 27; //
|
||||
const VRR_ITEM_USETYPE_ARMOUR = 28; //
|
||||
const VRR_ITEM_USETYPE_HEALTH = 29; //
|
||||
const VRR_ITEM_USETYPE_AED = 30; //
|
||||
const VRR_ITEM_USETYPE_WALKIETALKIE = 31; //
|
||||
const VRR_ITEM_USETYPE_AREARADIO = 32; //
|
||||
const VRR_ITEM_USETYPE_PERSONALRADIO = 33; //
|
||||
const VRR_ITEM_USETYPE_BADGE = 34; //
|
||||
const VRR_ITEM_USETYPE_DRINK = 35; // Drinkable item. Action output shows "Player_Name drinks some (drink name)"
|
||||
const VRR_ITEM_USETYPE_EXTINGUISHER = 36; // Extinguisher item. Allows putting out fires
|
||||
const VRR_ITEM_USETYPE_SPRAYPAINT = 37; // Spraypaint item. Allows spraying custom clan tags on walls
|
||||
const VRR_ITEM_USETYPE_PEPPERSPRAY = 38; // Pepper spray item. Incapacitates nearby player
|
||||
const VRR_ITEM_USETYPE_FLASHLIGHT = 39; // Flashlight item. Unusable for now, but plan to cast a custom light beam
|
||||
const VRR_ITEM_USETYPE_AIRPLANETICKET = 40; // Airplane ticket. Allows a character to move to another server
|
||||
const VRR_ITEM_USETYPE_TRAINTICKET = 41; // Train ticket. Allows a character to move to another server
|
||||
const VRR_ITEM_USETYPE_VEHUPGRADE_PART = 42; // Vehicle update part item. Allows adding custom parts like spoilers, side skirts, roof scoops, etc
|
||||
const VRR_ITEM_USETYPE_VEHTIRE = 43; // Vehicle tire item. Allows changing the tire/rim types
|
||||
const VRR_ITEM_USETYPE_FUELCAN = 44; // Fuel can item. Allows refueling of a nearby vehicle anywhere
|
||||
const VRR_ITEM_USETYPE_VEHCOLOUR = 45; // Vehicle colour item. Changes primary and secondary vehicle colours
|
||||
const VRR_ITEM_USETYPE_VEHLIVERY = 46; // Vehicle livery/paintjob item. Applies decals and special paint jobs
|
||||
const VRR_ITEM_USETYPE_VEHREPAIR = 47; // Vehicle repair item. Much longer use time
|
||||
const VRR_ITEM_USETYPE_SMOKEDRUG = 48; // Smokable drug. Action output shows "Player_Name smokes some (drug)"
|
||||
const VRR_ITEM_USETYPE_SNORTDRUG = 49; // Snortable drug. Action output shows "Player_Name snorts some (drug)"
|
||||
const VRR_ITEM_USETYPE_PLANT = 50; // Plantable item. Pot plants, coke plants, etc
|
||||
const VRR_ITEM_USETYPE_MEGAPHONE = 51; // Megaphone item. Allows shouting over greater distances. Also called a bullhorn
|
||||
const VRR_ITEM_USETYPE_INJECTDRUG = 52; // Injectable drug. Action output shows "Player_Name injects some (drug)"
|
||||
const VRR_ITEM_USETYPE_ALCOHOL = 53; // Alcohol. Applies an intoxication/drunkness effect
|
||||
const VRR_ITEM_USETYPE_LOTTOTICKET = 54; // Lotto ticket. Allows a character to enter the lottery
|
||||
|
||||
// Item Drop Types
|
||||
const VRR_ITEM_DROPTYPE_NONE = 0; // Can't be dropped
|
||||
const VRR_ITEM_DROPTYPE_OBJECT = 1; // Drops as an object on the ground
|
||||
const VRR_ITEM_DROPTYPE_PICKUP = 2; // Drops as a pickup
|
||||
const VRR_ITEM_DROPTYPE_OBJECTLIGHT = 3; // Object that produces an area light effect (lamp, flashlight, etc)
|
||||
const VRR_ITEM_DROPTYPE_DESTROY = 4; // Will destroy the item on drop (keys mostly but for any tiny object)
|
||||
const VRR_ITEM_DROPTYPE_OBJECTSTACK = 5; // Stackable objects (crates and such). Will sit on top of closest other stackable
|
||||
|
||||
// Forensic Types
|
||||
const VRR_FORENSICS_NONE = 0;
|
||||
const VRR_FORENSICS_BULLET = 1; // Bullet. The actual tip that hits a target. Has rifling and ballistics information of the weapon.
|
||||
const VRR_FORENSICS_BLOOD = 2; // Blood. Automatically applied to ground and bullets that hit when somebody is shot
|
||||
const VRR_FORENSICS_BODY = 3; // Body. A dead body lol
|
||||
const VRR_FORENSICS_HAIR = 4; // Hair. Automatically applied to
|
||||
const VRR_FORENSICS_SWEAT = 5; // Sweat. Automatically applied to clothing when worn
|
||||
const VRR_FORENSICS_SALIVA = 6; // Saliva. Automatically applied to drinks when drank
|
||||
const VRR_FORENSICS_BULLETCASINGS = 7; // Bullet casings. Automatically dropped when fired from a weapon except when used in a vehicle (driveby)
|
||||
|
||||
// Account Authentication Methods
|
||||
const VRR_ACCT_AUTHMETHOD_NONE = 0; // None
|
||||
const VRR_ACCT_AUTHMETHOD_EMAIL = 1; // Email
|
||||
const VRR_ACCT_AUTHMETHOD_PHONENUM = 2; // Phone number
|
||||
const VRR_ACCT_AUTHMETHOD_2FA = 3; // Two factor authentication app (authy, google authenticator, etc)
|
||||
const VRR_ACCT_AUTHMETHOD_PEBBLE = 4; // Pebble watch (this one's for Vortrex but anybody with a Pebble can use)
|
||||
const VRR_ACCT_AUTHMETHOD_PHONEAPP = 5; // The Android/iOS companion app (will initially be a web based thing until I can get the apps created)
|
||||
|
||||
// Police Patrol Types
|
||||
const VRR_PATROLTYPE_NONE = 0; // None
|
||||
const VRR_PATROLTYPE_FOOT = 1; // Foot patrol. Officer takes a vehicle to get to their designated area and then walks a beat. More common in LC games
|
||||
const VRR_PATROLTYPE_VEHICLE = 2; // Vehicle patrol. More common in VC/LS/SF/LV cities.
|
||||
|
||||
// Job Route States
|
||||
const VRR_JOBROUTESTATE_NONE = 0; // None
|
||||
const VRR_JOBROUTESTATE_INPROGRESS = 1; // Route is in progress. Player is in between stops but not at the last one.
|
||||
const VRR_JOBROUTESTATE_LASTSTOP = 2; // Player is heading to the last stop on the route
|
||||
const VRR_JOBROUTESTATE_PAUSED = 3; // Route is paused for some reason. For police, this could be player accepted callout and once finished, patrol route will resume
|
||||
const VRR_JOBROUTESTATE_ATSTOP = 4; // For bus/trash stops that freeze player, this is the state when they're at one
|
||||
|
||||
// Item Occupied States
|
||||
const VRR_ITEM_ACTION_NONE = 0; // None
|
||||
const VRR_ITEM_ACTION_USE = 1; // Using item
|
||||
const VRR_ITEM_ACTION_PICKUP = 2; // Picking up item
|
||||
const VRR_ITEM_ACTION_DROP = 3; // Dropping item
|
||||
const VRR_ITEM_ACTION_SWITCH = 4; // Switching item
|
||||
const VRR_ITEM_ACTION_PUT = 5; // Putting item (into trunk, dash, crate, etc)
|
||||
const VRR_ITEM_ACTION_TAKE = 6; // Taking item (from trunk, dash, crate, etc)
|
||||
|
||||
// Ped States
|
||||
const VRR_PEDSTATE_NONE = 2; // None
|
||||
const VRR_PEDSTATE_READY = 1; // Ready
|
||||
const VRR_PEDSTATE_DRIVER = 2; // Driving a vehicle
|
||||
const VRR_PEDSTATE_PASSENGER = 3; // In a vehicle as passenger
|
||||
const VRR_PEDSTATE_DEAD = 4; // Dead
|
||||
const VRR_PEDSTATE_ENTERINGPROPERTY = 5; // Entering a property
|
||||
const VRR_PEDSTATE_EXITINGPROPERTY = 6; // Exiting a property
|
||||
const VRR_PEDSTATE_ENTERINGVEHICLE = 7; // Entering a vehicle
|
||||
const VRR_PEDSTATE_EXITINGVEHICLE = 8; // Exiting a vehicle
|
||||
const VRR_PEDSTATE_BINDED = 9; // Binded by rope or handcuffs
|
||||
const VRR_PEDSTATE_TAZED = 10; // Under incapacitating effect of tazer
|
||||
const VRR_PEDSTATE_INTRUNK = 11; // In vehicle trunk
|
||||
const VRR_PEDSTATE_INITEM = 12; // In item (crate, box, etc)
|
||||
const VRR_PEDSTATE_HANDSUP = 13; // Has hands up (surrendering)
|
||||
const VRR_PEDSTATE_SPAWNING = 14; // Spawning
|
||||
|
||||
// Two-Factor Authentication States
|
||||
const VRR_2FA_STATE_NONE = 0; // None
|
||||
const VRR_2FA_STATE_CODEINPUT = 1; // Waiting on player to enter code to play
|
||||
const VRR_2FA_STATE_SETUP_CODETOAPP = 2; // Providing player with a code to put in their auth app
|
||||
const VRR_2FA_STATE_SETUP_CODEFROMAPP = 3; // Waiting on player to enter code from auth app to set up
|
||||
|
||||
// Reset Password States
|
||||
const VRR_RESETPASS_STATE_NONE = 0; // None
|
||||
const VRR_RESETPASS_STATE_CODEINPUT = 1; // Waiting on player to enter code sent via email
|
||||
const VRR_RESETPASS_STATE_SETPASS = 2; // Waiting on player to enter new password
|
||||
const VRR_RESETPASS_STATE_EMAILCONFIRM = 3; // Waiting on player to enter their email to confirm it's correct
|
||||
|
||||
// NPC Trigger Condition Match Types
|
||||
const VRR_NPC_COND_MATCH_NONE = 0; // None (invalid)
|
||||
const VRR_NPC_COND_MATCH_EQ = 1; // Must be equal to
|
||||
const VRR_NPC_COND_MATCH_GT = 2; // Must be greater than
|
||||
const VRR_NPC_COND_MATCH_LT = 3; // Must be less than
|
||||
const VRR_NPC_COND_MATCH_GTEQ = 4; // Must be greater than or equal to
|
||||
const VRR_NPC_COND_MATCH_LTEQ = 5; // Must be less than or equal to
|
||||
const VRR_NPC_COND_MATCH_CONTAINS = 6; // Must contain string (case insensitive)
|
||||
const VRR_NPC_COND_MATCH_CONTAINS_CASE = 7; // Must contain string (case sensitive)
|
||||
const VRR_NPC_COND_MATCH_EXACT = 8; // Must match string exactly (case insensitive)
|
||||
const VRR_NPC_COND_MATCH_EXACT_CASE = 9; // Must match string exactly (case insensitive)
|
||||
|
||||
// Business Types
|
||||
const VRR_BIZ_TYPE_NONE = 0; // None (invalid)
|
||||
const VRR_BIZ_TYPE_NORMAL = 1; // Normal business (sells items)
|
||||
const VRR_BIZ_TYPE_BANK = 2; // Bank
|
||||
const VRR_BIZ_TYPE_PUBLIC = 3; // Public business (Government, public service, etc)
|
||||
|
||||
// Return-To types (for when a player is teleported)
|
||||
const VRR_RETURNTO_TYPE_NONE = 0; // "Return to" data is invalid
|
||||
const VRR_RETURNTO_TYPE_ADMINGET = 1; // "Return to" data is from admin teleporting
|
||||
const VRR_RETURNTO_TYPE_SKINSELECT = 2; // "Return to" data is from skin select
|
||||
|
||||
// Card Game Types
|
||||
const VRR_DECKCARD_GAME_NONE = 0; // None (invalid)
|
||||
const VRR_DECKCARD_GAME_BLACKJACK = 1; // Blackjack
|
||||
const VRR_DECKCARD_GAME_TEXASHOLDEM = 2; // Texas Hold-em
|
||||
const VRR_DECKCARD_GAME_FIVECARDDRAW = 3; // Five Card Draw
|
||||
const VRR_DECKCARD_GAME_FIVECARDSTUD = 4; // Five Card Stud
|
||||
const VRR_DECKCARD_GAME_HIGHLOW = 5; // High-Low (Also known as War)
|
||||
|
||||
// Card Suits
|
||||
const VRR_DECKCARD_SUIT_NONE = 0; // None (invalid)
|
||||
const VRR_DECKCARD_SUIT_SPADE = 1; // Spades
|
||||
const VRR_DECKCARD_SUIT_CLUB = 2; // Clubs
|
||||
const VRR_DECKCARD_SUIT_HEART = 3; // Hearts
|
||||
const VRR_DECKCARD_SUIT_DIAMOND = 4; // Diamonds
|
||||
|
||||
// GPS State Types
|
||||
const VRR_GPS_TYPE_NONE = 0; // None (invalid)
|
||||
const VRR_GPS_TYPE_BUSINESS = 1; // Business
|
||||
const VRR_GPS_TYPE_POLICE = 2; // Police Station
|
||||
const VRR_GPS_TYPE_HOSPITAL = 3; // Hospital
|
||||
const VRR_GPS_TYPE_JOB = 4; // Job
|
||||
const VRR_GPS_TYPE_GAMELOC = 5; // Game Location
|
||||
|
||||
// Discord Webhook Types
|
||||
const VRR_DISCORD_WEBHOOK_NONE = 0;
|
||||
const VRR_DISCORD_WEBHOOK_LOG = 1;
|
||||
const VRR_DISCORD_WEBHOOK_ADMIN = 2;
|
||||
|
||||
// NPC Owner Types
|
||||
const VRR_NPCOWNER_NONE = 0; // Not owned
|
||||
const VRR_NPCOWNER_PLAYER = 1; // Owned by a player (character/subaccount)
|
||||
const VRR_NPCOWNER_JOB = 2; // Owned by a job
|
||||
const VRR_NPCOWNER_CLAN = 3; // Owned by a clan
|
||||
const VRR_NPCOWNER_FACTION = 4; // Owned by a faction (not used at the moment)
|
||||
const VRR_NPCOWNER_PUBLIC = 5; // Public NPC. Anybody can do stuff with it.
|
||||
const VRR_NPCOWNER_BIZ = 6; // Owned by a business
|
||||
22
scripts/server/crime.js
Normal file
@@ -0,0 +1,22 @@
|
||||
// ===========================================================================
|
||||
// Vortrex's Roleplay Resource
|
||||
// https://github.com/VortrexFTW/gtac_roleplay
|
||||
// ===========================================================================
|
||||
// FILE: crime.js
|
||||
// DESC: Provides crime data structures, functions, and operations
|
||||
// TYPE: Server (JavaScript)
|
||||
// ===========================================================================
|
||||
|
||||
/**
|
||||
* @class Representing a crime's data. Loaded and saved in the database
|
||||
*/
|
||||
class CrimeData {
|
||||
constructor(suspectId, crimeType, reporterId = 0) {
|
||||
this.crimeType = crimeType;
|
||||
this.suspectId = suspectId;
|
||||
this.reporterId = reporterId;
|
||||
this.whenCommitted = 0;
|
||||
this.whenReported = 0;
|
||||
this.databaseId = 0;
|
||||
}
|
||||
};
|
||||
@@ -271,7 +271,7 @@ async function onPlayerEnteredVehicle(client, clientVehicle, seat) {
|
||||
return false;
|
||||
}
|
||||
|
||||
logToConsole(LOG_DEBUG, `[VRR.Event] ${getPlayerDisplayForConsole(client)} entered a ${getVehicleName(vehicle)} (ID: ${vehicle.getData("vrr.dataSlot")}, Database ID: ${getVehicleData(vehicle).databaseId})`);
|
||||
logToConsole(LOG_DEBUG, `[VRR.Event] ${getPlayerDisplayForConsole(client)} entered a ${getVehicleName(vehicle)} (ID: ${vehicle.getData("agrp.dataSlot")}, Database ID: ${getVehicleData(vehicle).databaseId})`);
|
||||
|
||||
getPlayerData(client).lastVehicle = vehicle;
|
||||
getVehicleData(vehicle).lastActiveTime = getCurrentUnixTimestamp();
|
||||
@@ -385,7 +385,7 @@ function onPlayerExitedVehicle(client, vehicle) {
|
||||
|
||||
getVehicleData(vehicle).lastActiveTime = getCurrentUnixTimestamp();
|
||||
|
||||
logToConsole(LOG_DEBUG, `[VRR.Event] ${getPlayerDisplayForConsole(client)} exited a ${getVehicleName(vehicle)} (ID: ${vehicle.getData("vrr.dataSlot")}, Database ID: ${getVehicleData(vehicle).databaseId})`);
|
||||
logToConsole(LOG_DEBUG, `[VRR.Event] ${getPlayerDisplayForConsole(client)} exited a ${getVehicleName(vehicle)} (ID: ${vehicle.getData("agrp.dataSlot")}, Database ID: ${getVehicleData(vehicle).databaseId})`);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -395,6 +395,7 @@ function onPlayerDeath(client, position) {
|
||||
getPlayerData(client).pedState = VRR_PEDSTATE_DEAD;
|
||||
updatePlayerSpawnedState(client, false);
|
||||
setPlayerControlState(client, false);
|
||||
setPlayerRenderLabelsState(client, false);
|
||||
setTimeout(function () {
|
||||
if (isFadeCameraSupported()) {
|
||||
fadeCamera(client, false, 1.0);
|
||||
@@ -423,6 +424,7 @@ function onPlayerDeath(client, position) {
|
||||
makePlayerStopAnimation(client);
|
||||
setPlayerControlState(client, true);
|
||||
resetPlayerBlip(client);
|
||||
setPlayerRenderLabelsState(client, true);
|
||||
} else {
|
||||
let closestHospital = getClosestHospital(getPlayerPosition(client));
|
||||
despawnPlayer(client);
|
||||
@@ -447,6 +449,7 @@ function onPlayerDeath(client, position) {
|
||||
makePlayerStopAnimation(client);
|
||||
setPlayerControlState(client, true);
|
||||
resetPlayerBlip(client);
|
||||
setPlayerRenderLabelsState(client, true);
|
||||
}
|
||||
}, 2000);
|
||||
}, 1000);
|
||||
@@ -515,12 +518,12 @@ async function onPlayerSpawn(client) {
|
||||
|
||||
if (getGame() == VRR_GAME_GTA_IV) {
|
||||
logToConsole(LOG_DEBUG, `[VRR.Event] Setting ${getPlayerDisplayForConsole(client)}'s ped body parts and props`);
|
||||
setEntityData(getPlayerPed(client), "vrr.bodyParts", getPlayerCurrentSubAccount(client).bodyParts, true);
|
||||
setEntityData(getPlayerPed(client), "vrr.bodyProps", getPlayerCurrentSubAccount(client).bodyProps, true);
|
||||
setEntityData(getPlayerPed(client), "agrp.bodyParts", getPlayerCurrentSubAccount(client).bodyParts, true);
|
||||
setEntityData(getPlayerPed(client), "agrp.bodyProps", getPlayerCurrentSubAccount(client).bodyProps, true);
|
||||
}
|
||||
|
||||
logToConsole(LOG_DEBUG, `[VRR.Event] Setting ${getPlayerDisplayForConsole(client)}'s ped scale (${getPlayerCurrentSubAccount(client).pedScale})`);
|
||||
setEntityData(getPlayerPed(client), "vrr.scale", getPlayerCurrentSubAccount(client).pedScale, true);
|
||||
setEntityData(getPlayerPed(client), "agrp.scale", getPlayerCurrentSubAccount(client).pedScale, true);
|
||||
|
||||
if (isPlayerSwitchingCharacter(client) || isPlayerCreatingCharacter(client)) {
|
||||
logToConsole(LOG_DEBUG, `[VRR.Event] ${getPlayerDisplayForConsole(client)}'s ped is being used for character selection/creation. No further spawn processing needed'`);
|
||||
@@ -576,7 +579,7 @@ async function onPlayerSpawn(client) {
|
||||
|
||||
if (areServerElementsSupported() && getGame() == VRR_GAME_GTA_SA) {
|
||||
logToConsole(LOG_DEBUG, `[VRR.Event] Setting player walk and fightstyle for ${getPlayerDisplayForConsole(client)}`);
|
||||
setEntityData(getPlayerPed(client), "vrr.walkStyle", getPlayerCurrentSubAccount(client).walkStyle, true);
|
||||
setEntityData(getPlayerPed(client), "agrp.walkStyle", getPlayerCurrentSubAccount(client).walkStyle, true);
|
||||
|
||||
setPlayerFightStyle(client, getPlayerCurrentSubAccount(client).fightStyle);
|
||||
}
|
||||
@@ -602,20 +605,20 @@ async function onPlayerSpawn(client) {
|
||||
}
|
||||
|
||||
//if(isGTAIV()) {
|
||||
// setEntityData(getPlayerPed(client), "vrr.bodyPartHair", getPlayerCurrentSubAccount(client).bodyParts.hair, true);
|
||||
// setEntityData(getPlayerPed(client), "vrr.bodyPartHead", getPlayerCurrentSubAccount(client).bodyParts.head, true);
|
||||
// setEntityData(getPlayerPed(client), "vrr.bodyPartUpper", getPlayerCurrentSubAccount(client).bodyParts.upper, true);
|
||||
// setEntityData(getPlayerPed(client), "vrr.bodyPartLower", getPlayerCurrentSubAccount(client).bodyParts.lower, true);
|
||||
// setEntityData(getPlayerPed(client), "vrr.bodyPropHair", getPlayerCurrentSubAccount(client).bodyProps.hair, true);
|
||||
// setEntityData(getPlayerPed(client), "vrr.bodyPropEyes", getPlayerCurrentSubAccount(client).bodyProps.eyes, true);
|
||||
// setEntityData(getPlayerPed(client), "vrr.bodyPartHead", getPlayerCurrentSubAccount(client).bodyProps.head, true);
|
||||
// setEntityData(getPlayerPed(client), "vrr.bodyPartLeftHand", getPlayerCurrentSubAccount(client).bodyProps.leftHand, true);
|
||||
// setEntityData(getPlayerPed(client), "vrr.bodyPartRightHand", getPlayerCurrentSubAccount(client).bodyProps.rightHand, true);
|
||||
// setEntityData(getPlayerPed(client), "vrr.bodyPartLeftWrist", getPlayerCurrentSubAccount(client).bodyProps.leftWrist, true);
|
||||
// setEntityData(getPlayerPed(client), "vrr.bodyPartRightWrist", getPlayerCurrentSubAccount(client).bodyProps.rightWrist, true);
|
||||
// setEntityData(getPlayerPed(client), "vrr.bodyPartHip", getPlayerCurrentSubAccount(client).bodyProps.hip, true);
|
||||
// setEntityData(getPlayerPed(client), "vrr.bodyPartLeftFoot", getPlayerCurrentSubAccount(client).bodyProps.leftFoot, true);
|
||||
// setEntityData(getPlayerPed(client), "vrr.bodyPartRightFoot", getPlayerCurrentSubAccount(client).bodyProps.rightFoot, true);
|
||||
// setEntityData(getPlayerPed(client), "agrp.bodyPartHair", getPlayerCurrentSubAccount(client).bodyParts.hair, true);
|
||||
// setEntityData(getPlayerPed(client), "agrp.bodyPartHead", getPlayerCurrentSubAccount(client).bodyParts.head, true);
|
||||
// setEntityData(getPlayerPed(client), "agrp.bodyPartUpper", getPlayerCurrentSubAccount(client).bodyParts.upper, true);
|
||||
// setEntityData(getPlayerPed(client), "agrp.bodyPartLower", getPlayerCurrentSubAccount(client).bodyParts.lower, true);
|
||||
// setEntityData(getPlayerPed(client), "agrp.bodyPropHair", getPlayerCurrentSubAccount(client).bodyProps.hair, true);
|
||||
// setEntityData(getPlayerPed(client), "agrp.bodyPropEyes", getPlayerCurrentSubAccount(client).bodyProps.eyes, true);
|
||||
// setEntityData(getPlayerPed(client), "agrp.bodyPartHead", getPlayerCurrentSubAccount(client).bodyProps.head, true);
|
||||
// setEntityData(getPlayerPed(client), "agrp.bodyPartLeftHand", getPlayerCurrentSubAccount(client).bodyProps.leftHand, true);
|
||||
// setEntityData(getPlayerPed(client), "agrp.bodyPartRightHand", getPlayerCurrentSubAccount(client).bodyProps.rightHand, true);
|
||||
// setEntityData(getPlayerPed(client), "agrp.bodyPartLeftWrist", getPlayerCurrentSubAccount(client).bodyProps.leftWrist, true);
|
||||
// setEntityData(getPlayerPed(client), "agrp.bodyPartRightWrist", getPlayerCurrentSubAccount(client).bodyProps.rightWrist, true);
|
||||
// setEntityData(getPlayerPed(client), "agrp.bodyPartHip", getPlayerCurrentSubAccount(client).bodyProps.hip, true);
|
||||
// setEntityData(getPlayerPed(client), "agrp.bodyPartLeftFoot", getPlayerCurrentSubAccount(client).bodyProps.leftFoot, true);
|
||||
// setEntityData(getPlayerPed(client), "agrp.bodyPartRightFoot", getPlayerCurrentSubAccount(client).bodyProps.rightFoot, true);
|
||||
//}
|
||||
|
||||
if (isGTAIV()) {
|
||||
@@ -659,6 +662,8 @@ async function onPlayerSpawn(client) {
|
||||
// Stop playing intro music and any other radio
|
||||
stopRadioStreamForPlayer(client);
|
||||
|
||||
setPlayerRenderLabelsState(client, true);
|
||||
|
||||
// Start playing business/house radio if in one
|
||||
let businessId = getPlayerBusiness(client);
|
||||
let houseId = getPlayerHouse(client);
|
||||
|
||||
20
scripts/server/forensics.js
Normal file
@@ -0,0 +1,20 @@
|
||||
// ===========================================================================
|
||||
// Vortrex's Roleplay Resource
|
||||
// https://github.com/VortrexFTW/gtac_roleplay
|
||||
// ===========================================================================
|
||||
// FILE: forensics.js
|
||||
// DESC: Provides forensics functions and commands (bullet casings, blood, etc)
|
||||
// TYPE: Server (JavaScript)
|
||||
// ===========================================================================
|
||||
|
||||
// Forensic Types
|
||||
const VRR_FORENSICS_NONE = 0;
|
||||
const VRR_FORENSICS_BULLET = 1; // Bullet. The actual tip that hits a target. Has rifling and ballistics information of the weapon.
|
||||
const VRR_FORENSICS_BLOOD = 2; // Blood. Automatically applied to ground and bullets that hit when somebody is shot
|
||||
const VRR_FORENSICS_BODY = 3; // Body. A dead body lol
|
||||
const VRR_FORENSICS_HAIR = 4; // Hair. Automatically applied to
|
||||
const VRR_FORENSICS_SWEAT = 5; // Sweat. Automatically applied to clothing when worn
|
||||
const VRR_FORENSICS_SALIVA = 6; // Saliva. Automatically applied to drinks when drank
|
||||
const VRR_FORENSICS_BULLETCASINGS = 7; // Bullet casings. Automatically dropped when fired from a weapon except when used in a vehicle (driveby)
|
||||
|
||||
// ===========================================================================
|
||||
@@ -7,6 +7,43 @@
|
||||
// TYPE: Server (JavaScript)
|
||||
// ===========================================================================
|
||||
|
||||
// Gate Owner Types
|
||||
const VRR_GATEOWNER_NONE = 0; // Not owned
|
||||
const VRR_GATEOWNER_PLAYER = 1; // Owner is a player (character/subaccount)
|
||||
const VRR_GATEOWNER_JOB = 2; // Owned by a job
|
||||
const VRR_GATEOWNER_CLAN = 3; // Owned by a clan
|
||||
const VRR_GATEOWNER_FACTION = 4; // Owned by a faction
|
||||
const VRR_GATEOWNER_PUBLIC = 5; // Public gate. Technically not owned. This probably won't be used.
|
||||
const VRR_GATEOWNER_BUSINESS = 6; // Owned by a business. Back lots, unloading areas, and other stuff like that
|
||||
const VRR_GATEOWNER_HOUSE = 7; // Owned by a house. Like for mansions with closed private areas.
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
class GateData {
|
||||
constructor(dbAssoc = false) {
|
||||
this.databaseId = 0;
|
||||
this.name = "";
|
||||
this.scriptName = "";
|
||||
this.enabled = false;
|
||||
this.position = toVector3(0.0, 0.0, 0.0);
|
||||
this.locked = true;
|
||||
this.ownerType = VRR_GATEOWNER_NONE;
|
||||
this.ownerId = 0;
|
||||
|
||||
if (dbAssoc) {
|
||||
this.databaseId = toInteger(dbAssoc["gate_id"]);
|
||||
this.name = toString(dbAssoc["gate_name"]);
|
||||
this.scriptName = toString(dbAssoc["gate_script_name"]);
|
||||
this.enabled = intToBool(toInteger(dbAssoc["gate_enabled"]));
|
||||
this.position = toVector3(toFloat(dbAssoc["gate_pos_x"]), toFloat(dbAssoc["gate_pos_y"]), toFloat(dbAssoc["gate_pos_z"]));
|
||||
this.ownerType = toInteger(dbAssoc["gate_owner_type"]);
|
||||
this.ownerId = toInteger(dbAssoc["gate_owner_id"]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function initGateScript() {
|
||||
logToConsole(LOG_INFO, `[VRR.Gate]: Initializing gate script ...`);
|
||||
logToConsole(LOG_INFO, `[VRR.Gate]: Gate script initialized successfully!`);
|
||||
@@ -17,66 +54,66 @@ function initGateScript() {
|
||||
function doesPlayerHaveGateKeys(client, vehicle) {
|
||||
let gateData = getGateData(vehicle);
|
||||
|
||||
if(gateData.ownerType == VRR_GATEOWNER_PUBLIC) {
|
||||
if (gateData.ownerType == VRR_GATEOWNER_PUBLIC) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if(gateData.ownerType == VRR_GATEOWNER_PLAYER) {
|
||||
if(gateData.ownerId == getPlayerCurrentSubAccount(client).databaseId) {
|
||||
if (gateData.ownerType == VRR_GATEOWNER_PLAYER) {
|
||||
if (gateData.ownerId == getPlayerCurrentSubAccount(client).databaseId) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if(gateData.ownerType == VRR_GATEOWNER_CLAN) {
|
||||
if(doesPlayerHaveStaffPermission(client, getStaffFlagValue("ManageClans"))) {
|
||||
if (gateData.ownerType == VRR_GATEOWNER_CLAN) {
|
||||
if (doesPlayerHaveStaffPermission(client, getStaffFlagValue("ManageClans"))) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if(gateData.ownerId == getPlayerCurrentSubAccount(client).clan) {
|
||||
if(gateData.clanRank <= getPlayerCurrentSubAccount(client).clanRank) {
|
||||
if (gateData.ownerId == getPlayerCurrentSubAccount(client).clan) {
|
||||
if (gateData.clanRank <= getPlayerCurrentSubAccount(client).clanRank) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(gateData.ownerType == VRR_GATEOWNER_FACTION) {
|
||||
if(doesPlayerHaveStaffPermission(client, getStaffFlagValue("ManageFactions"))) {
|
||||
if (gateData.ownerType == VRR_GATEOWNER_FACTION) {
|
||||
if (doesPlayerHaveStaffPermission(client, getStaffFlagValue("ManageFactions"))) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if(gateData.ownerId == getPlayerCurrentSubAccount(client).faction) {
|
||||
if(gateData.factionRank <= getPlayerCurrentSubAccount(client).factionRank) {
|
||||
if (gateData.ownerId == getPlayerCurrentSubAccount(client).faction) {
|
||||
if (gateData.factionRank <= getPlayerCurrentSubAccount(client).factionRank) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(gateData.ownerType == VRR_GATEOWNER_JOB) {
|
||||
if(doesPlayerHaveStaffPermission(client, getStaffFlagValue("ManageJobs"))) {
|
||||
if (gateData.ownerType == VRR_GATEOWNER_JOB) {
|
||||
if (doesPlayerHaveStaffPermission(client, getStaffFlagValue("ManageJobs"))) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if(gateData.ownerId == getPlayerCurrentSubAccount(client).job) {
|
||||
if (gateData.ownerId == getPlayerCurrentSubAccount(client).job) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if(gateData.ownerType == VRR_GATEOWNER_BUSINESS) {
|
||||
if(doesPlayerHaveStaffPermission(client, getStaffFlagValue("ManageBusinesses"))) {
|
||||
if (gateData.ownerType == VRR_GATEOWNER_BUSINESS) {
|
||||
if (doesPlayerHaveStaffPermission(client, getStaffFlagValue("ManageBusinesses"))) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if(canPlayerManageBusiness(client, getBusinessIdFromDatabaseId(gateData.ownerId))) {
|
||||
if (canPlayerManageBusiness(client, getBusinessIdFromDatabaseId(gateData.ownerId))) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if(gateData.ownerType == VRR_GATEOWNER_HOUSE) {
|
||||
if(doesPlayerHaveStaffPermission(client, getStaffFlagValue("ManageHouses"))) {
|
||||
if (gateData.ownerType == VRR_GATEOWNER_HOUSE) {
|
||||
if (doesPlayerHaveStaffPermission(client, getStaffFlagValue("ManageHouses"))) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if(canPlayerManageHouse(client, getHouseIdFromDatabaseId(gateData.ownerId))) {
|
||||
if (canPlayerManageHouse(client, getHouseIdFromDatabaseId(gateData.ownerId))) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -87,7 +124,7 @@ function doesPlayerHaveGateKeys(client, vehicle) {
|
||||
// ===========================================================================
|
||||
|
||||
function getGateData(gateId) {
|
||||
if(typeof getServerData().gates[gateId] != "undefined") {
|
||||
if (typeof getServerData().gates[gateId] != "undefined") {
|
||||
return getServerData().gates[gateId];
|
||||
}
|
||||
|
||||
@@ -98,8 +135,8 @@ function getGateData(gateId) {
|
||||
|
||||
function getClosestGate(position) {
|
||||
let closest = 0;
|
||||
for(let i in getServerData().gates[getGame()]) {
|
||||
if(getDistance(getServerData().gates[i].position, position) < getDistance(getServerData().gates[closest].position, position)) {
|
||||
for (let i in getServerData().gates[getGame()]) {
|
||||
if (getDistance(getServerData().gates[i].position, position) < getDistance(getServerData().gates[closest].position, position)) {
|
||||
closest = i;
|
||||
}
|
||||
}
|
||||
@@ -112,11 +149,11 @@ function getClosestGate(position) {
|
||||
function triggerGateCommand(command, params, client) {
|
||||
let closestGate = getClosestGate(getPlayerPosition(client));
|
||||
|
||||
if(!getGateData(closestGate)) {
|
||||
if (!getGateData(closestGate)) {
|
||||
messagePlayerError(client, getLocaleString(client, "InvalidGate"));
|
||||
}
|
||||
|
||||
if(!doesPlayerHaveGateKeys(client, closestGate)) {
|
||||
if (!doesPlayerHaveGateKeys(client, closestGate)) {
|
||||
messagePlayerError(client, getLocaleString(client, "NoGateAccess"));
|
||||
return false;
|
||||
}
|
||||
@@ -127,11 +164,11 @@ function triggerGateCommand(command, params, client) {
|
||||
// ===========================================================================
|
||||
|
||||
function saveAllGatesToDatabase() {
|
||||
if(getServerConfig().devServer) {
|
||||
if (getServerConfig().devServer) {
|
||||
return false;
|
||||
}
|
||||
|
||||
for(let i in getServerData().gates) {
|
||||
for (let i in getServerData().gates) {
|
||||
saveGateToDatabase(i);
|
||||
}
|
||||
}
|
||||
@@ -139,26 +176,26 @@ function saveAllGatesToDatabase() {
|
||||
// ===========================================================================
|
||||
|
||||
function saveGateToDatabase(gateId) {
|
||||
if(getGateData(gateId) == null) {
|
||||
if (getGateData(gateId) == null) {
|
||||
// Invalid gate data
|
||||
return false;
|
||||
}
|
||||
|
||||
let tempGateData = getGateData(gateId);
|
||||
|
||||
if(tempGateData.databaseId == -1) {
|
||||
if (tempGateData.databaseId == -1) {
|
||||
// Temp gate, no need to save
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!tempGateData.needsSaved) {
|
||||
if (!tempGateData.needsSaved) {
|
||||
// Gate hasn't changed. No need to save.
|
||||
return false;
|
||||
}
|
||||
|
||||
logToConsole(LOG_VERBOSE, `[VRR.Gate]: Saving gate ${tempGateData.databaseId} to database ...`);
|
||||
let dbConnection = connectToDatabase();
|
||||
if(dbConnection) {
|
||||
if (dbConnection) {
|
||||
let safeGateName = escapeDatabaseString(tempGateData.name);
|
||||
let safeGateScriptName = escapeDatabaseString(tempGateData.scriptName);
|
||||
|
||||
@@ -175,7 +212,7 @@ function saveGateToDatabase(gateId) {
|
||||
];
|
||||
|
||||
let dbQuery = null;
|
||||
if(tempGateData.databaseId == 0) {
|
||||
if (tempGateData.databaseId == 0) {
|
||||
let queryString = createDatabaseInsertQuery("gate_main", data);
|
||||
dbQuery = queryDatabase(dbConnection, queryString);
|
||||
tempGateData.databaseId = getDatabaseInsertId(dbConnection);
|
||||
@@ -204,11 +241,11 @@ function loadGatesFromDatabase() {
|
||||
let dbConnection = connectToDatabase();
|
||||
let dbAssoc;
|
||||
|
||||
if(dbConnection) {
|
||||
if (dbConnection) {
|
||||
let dbQuery = queryDatabase(dbConnection, `SELECT * FROM gate_main WHERE gate_server = ${getServerId()}`);
|
||||
if(dbQuery) {
|
||||
if(dbQuery.numRows > 0) {
|
||||
while(dbAssoc = fetchQueryAssoc(dbQuery)) {
|
||||
if (dbQuery) {
|
||||
if (dbQuery.numRows > 0) {
|
||||
while (dbAssoc = fetchQueryAssoc(dbQuery)) {
|
||||
let tempGateData = new GateData(dbAssoc);
|
||||
tempGates.push(tempGateData);
|
||||
logToConsole(LOG_DEBUG, `[VRR.Gate]: Gate '${tempGateData.name}' loaded from database successfully!`);
|
||||
|
||||
148
scripts/server/gps.js
Normal file
@@ -0,0 +1,148 @@
|
||||
// ===========================================================================
|
||||
// Vortrex's Roleplay Resource
|
||||
// https://github.com/VortrexFTW/gtac_roleplay
|
||||
// ===========================================================================
|
||||
// FILE: gps.js
|
||||
// DESC: Provides GPS functions and commands
|
||||
// TYPE: Server (JavaScript)
|
||||
// ===========================================================================
|
||||
|
||||
// GPS State Types
|
||||
const VRR_GPS_TYPE_NONE = 0; // None (invalid)
|
||||
const VRR_GPS_TYPE_BUSINESS = 1; // Business
|
||||
const VRR_GPS_TYPE_POLICE = 2; // Police Station
|
||||
const VRR_GPS_TYPE_HOSPITAL = 3; // Hospital
|
||||
const VRR_GPS_TYPE_JOB = 4; // Job
|
||||
const VRR_GPS_TYPE_GAMELOC = 5; // Game Location
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function gpsCommand(command, params, client) {
|
||||
messagePlayerNormal(client, makeChatBoxSectionHeader(getLocaleString(client, "HeaderBusinessList")));
|
||||
|
||||
let locationType = VRR_GPS_TYPE_NONE;
|
||||
let useType = VRR_ITEM_USETYPE_NONE;
|
||||
let blipColour = "white";
|
||||
|
||||
switch(toLowerCase(params)) {
|
||||
case "police":
|
||||
blipColour = "businessBlue"
|
||||
locationType = VRR_GPS_TYPE_POLICE;
|
||||
break;
|
||||
|
||||
case "hospital":
|
||||
blipColour = "businessBlue"
|
||||
locationType = VRR_GPS_TYPE_HOSPITAL;
|
||||
break;
|
||||
|
||||
case "job":
|
||||
blipColour = "businessBlue"
|
||||
locationType = VRR_GPS_TYPE_JOB;
|
||||
break;
|
||||
|
||||
case "skin":
|
||||
case "skins":
|
||||
case "clothes":
|
||||
case "player":
|
||||
blipColour = "businessBlue"
|
||||
locationType = VRR_GPS_TYPE_BUSINESS;
|
||||
useType = VRR_ITEM_USETYPE_SKIN;
|
||||
break;
|
||||
|
||||
case "gun":
|
||||
case "guns":
|
||||
case "weapon":
|
||||
case "weapons":
|
||||
case "wep":
|
||||
case "weps":
|
||||
blipColour = "businessBlue"
|
||||
locationType = VRR_GPS_TYPE_BUSINESS;
|
||||
useType = VRR_ITEM_USETYPE_WEAPON;
|
||||
break;
|
||||
|
||||
case "food":
|
||||
case "eat":
|
||||
blipColour = "businessBlue"
|
||||
locationType = VRR_GPS_TYPE_BUSINESS;
|
||||
useType = VRR_ITEM_USETYPE_FOOD;
|
||||
break;
|
||||
|
||||
case "drink":
|
||||
blipColour = "businessBlue"
|
||||
locationType = VRR_GPS_TYPE_BUSINESS;
|
||||
useType = VRR_ITEM_USETYPE_DRINK;
|
||||
break;
|
||||
|
||||
case "alcohol":
|
||||
case "booze":
|
||||
case "bar":
|
||||
blipColour = "businessBlue"
|
||||
locationType = VRR_GPS_TYPE_BUSINESS;
|
||||
useType = VRR_ITEM_USETYPE_ALCOHOL;
|
||||
break;
|
||||
|
||||
case "repair":
|
||||
case "carrepair":
|
||||
case "vehrepair":
|
||||
case "spray":
|
||||
case "fix":
|
||||
blipColour = "businessBlue"
|
||||
locationType = VRR_GPS_TYPE_BUSINESS;
|
||||
useType = VRR_ITEM_USETYPE_VEHREPAIR;
|
||||
break;
|
||||
|
||||
case "vehiclecolour":
|
||||
case "vehcolour":
|
||||
case "carcolour":
|
||||
case "colour":
|
||||
blipColour = "businessBlue"
|
||||
locationType = VRR_GPS_TYPE_BUSINESS;
|
||||
useType = VRR_ITEM_USETYPE_VEHCOLOUR;
|
||||
break;
|
||||
|
||||
default: {
|
||||
let itemTypeId = getItemTypeFromParams(params);
|
||||
if(getItemTypeData(itemTypeId) != false) {
|
||||
locationType = VRR_GPS_TYPE_BUSINESS;
|
||||
blipColour = "businessBlue";
|
||||
useType = getItemTypeData(itemTypeId).useType;
|
||||
} else {
|
||||
let gameLocationId = getGameLocationFromParams(params);
|
||||
if(gameLocationId != false) {
|
||||
position = getGameConfig().locations[getServerGame()][gameLocationId][1]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(locationType == VRR_GPS_TYPE_NONE) {
|
||||
messagePlayerError(client, getLocaleString(client, "InvalidGPSLocation"));
|
||||
return false;
|
||||
}
|
||||
|
||||
if(locationType == VRR_GPS_TYPE_BUSINESS) {
|
||||
let businessId = getClosestBusinessWithBuyableItemOfUseType(useType);
|
||||
if(!businessId) {
|
||||
messagePlayerError(client, getLocaleString(client, "NoBusinessWithItemType"));
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!getBusinessData(businessId)) {
|
||||
messagePlayerError(client, getLocaleString(client, "NoBusinessWithItemType"));
|
||||
return false;
|
||||
}
|
||||
|
||||
hideAllBlipsForPlayerGPS(client);
|
||||
blinkGenericGPSBlipForPlayer(client, getBusinessData(businessId).entrancePosition, getBusinessData(businessId).entranceBlipModel, getColourByType(blipColour), 10);
|
||||
messagePlayerSuccess(client, "Look for the blinking icon on your mini map");
|
||||
}
|
||||
|
||||
if(locationType == VRR_GPS_TYPE_GAMELOC) {
|
||||
hideAllBlipsForPlayerGPS(client);
|
||||
blinkGenericGPSBlipForPlayer(client, position, 0, getColourByType(blipColour), 10);
|
||||
messagePlayerSuccess(client, "Look for the blinking icon on your mini map");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -7,6 +7,13 @@
|
||||
// TYPE: Server (JavaScript)
|
||||
// ===========================================================================
|
||||
|
||||
// Prompts (used for client GUI prompt responses)
|
||||
const VRR_PROMPT_NONE = 0;
|
||||
const VRR_PROMPT_CREATEFIRSTCHAR = 1;
|
||||
const VRR_PROMPT_BIZORDER = 2;
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function initGUIScript() {
|
||||
logToConsole(LOG_INFO, "[VRR.GUI]: Initializing GUI script ...");
|
||||
logToConsole(LOG_INFO, "[VRR.GUI]: GUI script initialized successfully!");
|
||||
@@ -259,7 +266,7 @@ function playerToggledGUI(client) {
|
||||
// ===========================================================================
|
||||
|
||||
function showPlayerTwoFactorAuthenticationGUI(client) {
|
||||
sendNetworkEventToPlayer("vrr.2fa", client);
|
||||
sendNetworkEventToPlayer("agrp.2fa", client);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -7,6 +7,159 @@
|
||||
// TYPE: Server (JavaScript)
|
||||
// ===========================================================================
|
||||
|
||||
// House Location Types
|
||||
const VRR_HOUSELOC_NONE = 0; // None
|
||||
const VRR_HOUSELOC_GATE = 1; // Center of any moveable gate that belongs to the house
|
||||
const VRR_HOUSELOC_GARAGE = 2; // Location for garage (pos1 = outside, pos2 = inside). Use pos to teleport or spawn veh/ped
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
// House Owner Types
|
||||
const VRR_HOUSEOWNER_NONE = 0; // Not owned
|
||||
const VRR_HOUSEOWNER_PLAYER = 1; // Owner is a player (character/subaccount)
|
||||
const VRR_HOUSEOWNER_JOB = 2; // Owned by a job
|
||||
const VRR_HOUSEOWNER_CLAN = 3; // Owned by a clan
|
||||
const VRR_HOUSEOWNER_FACTION = 4; // Owned by a faction
|
||||
const VRR_HOUSEOWNER_PUBLIC = 5; // Is a public house. Technically not owned. This probably won't be used.
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
/**
|
||||
* @class Representing a house's data. Loaded and saved in the database
|
||||
*/
|
||||
class HouseData {
|
||||
constructor(dbAssoc = false) {
|
||||
this.databaseId = 0
|
||||
this.description = "";
|
||||
this.ownerType = VRR_HOUSEOWNER_NONE;
|
||||
this.ownerId = 0;
|
||||
this.buyPrice = 0;
|
||||
this.rentPrice = 0;
|
||||
this.renter = 0;
|
||||
this.locked = false;
|
||||
this.hasInterior = false;
|
||||
this.index = -1;
|
||||
this.needsSaved = false;
|
||||
this.interiorLights = true;
|
||||
|
||||
this.itemCache = [];
|
||||
this.locations = [];
|
||||
//this.gameScripts = [];
|
||||
|
||||
this.entrancePosition = false;
|
||||
this.entranceRotation = 0.0;
|
||||
this.entranceInterior = 0;
|
||||
this.entranceDimension = 0;
|
||||
this.entrancePickupModel = -1;
|
||||
this.entranceBlipModel = -1;
|
||||
this.entrancePickup = null;
|
||||
this.entranceBlip = null;
|
||||
|
||||
this.exitPosition = false;
|
||||
this.exitRotation = 0.0;
|
||||
this.exitInterior = 0;
|
||||
this.exitDimension = -1;
|
||||
this.exitPickupModel = -1;
|
||||
this.exitBlipModel = -1;
|
||||
this.exitPickup = null;
|
||||
this.exitBlip = null;
|
||||
|
||||
this.streamingRadioStation = -1;
|
||||
|
||||
if (dbAssoc) {
|
||||
this.databaseId = toInteger(dbAssoc["house_id"]);
|
||||
this.description = toString(dbAssoc["house_description"]);
|
||||
this.ownerType = toInteger(dbAssoc["house_owner_type"]);
|
||||
this.ownerId = toInteger(dbAssoc["house_owner_id"]);
|
||||
this.buyPrice = toInteger(dbAssoc["house_buy_price"]);
|
||||
this.rentPrice = toInteger(dbAssoc["house_rent_price"]);
|
||||
this.renter = toInteger(dbAssoc["house_renter"]);
|
||||
this.locked = intToBool(toInteger(dbAssoc["house_locked"]));
|
||||
this.hasInterior = intToBool(toInteger(dbAssoc["house_has_interior"]));
|
||||
this.interiorLights = intToBool(toInteger(dbAssoc["house_interior_lights"]));
|
||||
|
||||
this.entrancePosition = toVector3(toFloat(dbAssoc["house_entrance_pos_x"]), toFloat(dbAssoc["house_entrance_pos_y"]), toFloat(dbAssoc["house_entrance_pos_z"]));
|
||||
this.entranceRotation = toFloat(dbAssoc["house_entrance_rot_z"]);
|
||||
this.entranceInterior = toInteger(dbAssoc["house_entrance_int"]);
|
||||
this.entranceDimension = toInteger(dbAssoc["house_entrance_vw"]);
|
||||
this.entrancePickupModel = toInteger(dbAssoc["house_entrance_pickup"]);
|
||||
this.entranceBlipModel = toInteger(dbAssoc["house_entrance_blip"]);
|
||||
|
||||
this.exitPosition = toVector3(toFloat(dbAssoc["house_exit_pos_x"]), toFloat(dbAssoc["house_exit_pos_y"]), toFloat(dbAssoc["house_exit_pos_z"]));
|
||||
this.exitRotation = toFloat(dbAssoc["house_exit_rot_z"]);
|
||||
this.exitInterior = toInteger(dbAssoc["house_exit_int"]);
|
||||
this.exitDimension = toInteger(dbAssoc["house_exit_vw"]);
|
||||
this.exitPickupModel = toInteger(dbAssoc["house_exit_pickup"]);
|
||||
this.exitBlipModel = toInteger(dbAssoc["house_exit_blip"]);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
/**
|
||||
* @class Representing a houses's location data. Multiple can be used for a single house. Used for things like doors, garage entry/exit/vehspawn, gates, etc. Loaded and saved in the database
|
||||
*/
|
||||
class HouseLocationData {
|
||||
constructor(dbAssoc = false) {
|
||||
this.databaseId = 0;
|
||||
this.name = "";
|
||||
this.type = 0;
|
||||
this.house = 0;
|
||||
this.enabled = false;
|
||||
this.index = -1;
|
||||
this.houseIndex = -1;
|
||||
this.needsSaved = false;
|
||||
|
||||
this.position = toVector3(0.0, 0.0, 0.0);
|
||||
this.interior = 0;
|
||||
this.dimension = 0;
|
||||
|
||||
if (dbAssoc) {
|
||||
this.databaseId = toInteger(dbAssoc["house_loc_id"]);
|
||||
this.name = toString(dbAssoc["house_loc_name"]);
|
||||
this.type = toInteger(dbAssoc["house_loc_type"]);
|
||||
this.house = toInteger(dbAssoc["house_loc_house"]);
|
||||
this.enabled = intToBool(toInteger(dbAssoc["house_loc_enabled"]));
|
||||
this.index = -1;
|
||||
|
||||
this.position = toVector3(toFloat(dbAssoc["house_loc_pos_x"]), toFloat(dbAssoc["house_loc_pos_y"]), toFloat(dbAssoc["house_loc_pos_z"]));
|
||||
this.interior = toInteger(dbAssoc["house_loc_int"]);
|
||||
this.dimension = toInteger(dbAssoc["house_loc_vw"]);
|
||||
}
|
||||
};
|
||||
|
||||
//saveToDatabase = () => {
|
||||
// saveHouseLocationToDatabase(this.houseIndex, this.index);
|
||||
//}
|
||||
};
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
/**
|
||||
* @class Representing a house's game scripts. Multiple can be used for a single house
|
||||
*/
|
||||
class HouseGameScriptData {
|
||||
constructor(dbAssoc = false) {
|
||||
this.databaseId = 0;
|
||||
this.name = "";
|
||||
this.business = 0;
|
||||
this.state = false;
|
||||
this.index = -1;
|
||||
this.houseIndex = -1;
|
||||
this.needsSaved = false;
|
||||
|
||||
if (dbAssoc) {
|
||||
this.databaseId = toInteger(dbAssoc["house_script_id"]);
|
||||
this.name = toString(dbAssoc["house_script_name"]);
|
||||
this.state = toInteger(dbAssoc["house_script_state"]);
|
||||
this.business = toInteger(dbAssoc["house_script_biz"]);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function initHouseScript() {
|
||||
logToConsole(LOG_INFO, "[VRR.House]: Initializing house script ...");
|
||||
logToConsole(LOG_INFO, "[VRR.House]: House script initialized successfully!");
|
||||
@@ -111,7 +264,7 @@ function setHouseDescriptionCommand(command, params, client) {
|
||||
let oldDescription = getHouseData(houseId).description;
|
||||
getHouseData(houseId).description = newHouseDescription;
|
||||
|
||||
setEntityData(getHouseData(houseId).entrancePickup, "vrr.label.name", getHouseData(houseId).description, true);
|
||||
setEntityData(getHouseData(houseId).entrancePickup, "agrp.label.name", getHouseData(houseId).description, true);
|
||||
|
||||
getHouseData(houseId).needsSaved = true;
|
||||
|
||||
@@ -945,8 +1098,8 @@ function createHouseEntranceBlip(houseId) {
|
||||
setElementStreamOutDistance(entranceBlip, getGlobalConfig().houseBlipStreamOutDistance);
|
||||
}
|
||||
|
||||
setEntityData(entranceBlip, "vrr.owner.type", VRR_BLIP_HOUSE_ENTRANCE, false);
|
||||
setEntityData(entranceBlip, "vrr.owner.id", houseId, false);
|
||||
setEntityData(entranceBlip, "agrp.owner.type", VRR_BLIP_HOUSE_ENTRANCE, false);
|
||||
setEntityData(entranceBlip, "agrp.owner.id", houseId, false);
|
||||
|
||||
houseData.entranceBlip = entranceBlip;
|
||||
}
|
||||
@@ -1051,8 +1204,8 @@ function createHouseExitBlip(houseId) {
|
||||
setElementStreamOutDistance(exitBlip, getGlobalConfig().houseBlipStreamOutDistance);
|
||||
}
|
||||
setElementTransient(exitBlip, false);
|
||||
setEntityData(exitBlip, "vrr.owner.type", VRR_BLIP_HOUSE_EXIT, false);
|
||||
setEntityData(exitBlip, "vrr.owner.id", houseId, false);
|
||||
setEntityData(exitBlip, "agrp.owner.type", VRR_BLIP_HOUSE_EXIT, false);
|
||||
setEntityData(exitBlip, "agrp.owner.id", houseId, false);
|
||||
getHouseData(houseId).exitBlip = exitBlip;
|
||||
}
|
||||
}
|
||||
@@ -1594,26 +1747,26 @@ function updateHousePickupLabelData(houseId) {
|
||||
let houseData = getHouseData(houseId);
|
||||
|
||||
if (houseData.entrancePickup != null) {
|
||||
setEntityData(houseData.entrancePickup, "vrr.owner.type", VRR_PICKUP_HOUSE_ENTRANCE, false);
|
||||
setEntityData(houseData.entrancePickup, "vrr.owner.id", houseId, false);
|
||||
setEntityData(houseData.entrancePickup, "vrr.label.type", VRR_LABEL_HOUSE, true);
|
||||
setEntityData(houseData.entrancePickup, "vrr.label.name", houseData.description, true);
|
||||
setEntityData(houseData.entrancePickup, "vrr.label.locked", houseData.locked, true);
|
||||
setEntityData(houseData.entrancePickup, "agrp.owner.type", VRR_PICKUP_HOUSE_ENTRANCE, false);
|
||||
setEntityData(houseData.entrancePickup, "agrp.owner.id", houseId, false);
|
||||
setEntityData(houseData.entrancePickup, "agrp.label.type", VRR_LABEL_HOUSE, true);
|
||||
setEntityData(houseData.entrancePickup, "agrp.label.name", houseData.description, true);
|
||||
setEntityData(houseData.entrancePickup, "agrp.label.locked", houseData.locked, true);
|
||||
if (houseData.buyPrice > 0) {
|
||||
setEntityData(houseData.entrancePickup, "vrr.label.price", houseData.buyPrice, true);
|
||||
setEntityData(houseData.entrancePickup, "vrr.label.help", VRR_PROPLABEL_INFO_BUYHOUSE, true);
|
||||
setEntityData(houseData.entrancePickup, "agrp.label.price", houseData.buyPrice, true);
|
||||
setEntityData(houseData.entrancePickup, "agrp.label.help", VRR_PROPLABEL_INFO_BUYHOUSE, true);
|
||||
} else {
|
||||
if (houseData.rentPrice > 0) {
|
||||
setEntityData(houseData.entrancePickup, "vrr.label.rentprice", houseData.rentPrice, true);
|
||||
setEntityData(houseData.entrancePickup, "vrr.label.help", VRR_PROPLABEL_INFO_RENTHOUSE, true);
|
||||
setEntityData(houseData.entrancePickup, "agrp.label.rentprice", houseData.rentPrice, true);
|
||||
setEntityData(houseData.entrancePickup, "agrp.label.help", VRR_PROPLABEL_INFO_RENTHOUSE, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (houseData.exitPickup != null) {
|
||||
setEntityData(houseData.exitPickup, "vrr.owner.type", VRR_PICKUP_HOUSE_EXIT, false);
|
||||
setEntityData(houseData.exitPickup, "vrr.owner.id", houseId, false);
|
||||
setEntityData(houseData.exitPickup, "vrr.label.type", VRR_LABEL_EXIT, true);
|
||||
setEntityData(houseData.exitPickup, "agrp.owner.type", VRR_PICKUP_HOUSE_EXIT, false);
|
||||
setEntityData(houseData.exitPickup, "agrp.owner.id", houseId, false);
|
||||
setEntityData(houseData.exitPickup, "agrp.label.type", VRR_LABEL_EXIT, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
40
scripts/server/insurance.js
Normal file
@@ -0,0 +1,40 @@
|
||||
// ===========================================================================
|
||||
// Vortrex's Roleplay Resource
|
||||
// https://github.com/VortrexFTW/gtac_roleplay
|
||||
// ===========================================================================
|
||||
// FILE: insurance.js
|
||||
// DESC: Provides insurance commands, functions, and usage
|
||||
// TYPE: Server (JavaScript)
|
||||
// ===========================================================================
|
||||
|
||||
// Insurance Account Owner Types
|
||||
const VRR_INS_ACCT_OWNER_NONE = 0; // None
|
||||
const VRR_INS_ACCT_OWNER_PLAYER = 1; // Player owns insurance company
|
||||
const VRR_INS_ACCT_OWNER_BIZ = 2; // Business owns insurance company
|
||||
const VRR_INS_ACCT_OWNER_CLAN = 3; // Clan owns insurance company
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
// Insurance Account Entity Types
|
||||
const VRR_INS_ACCT_ENTITY_NONE = 0; // None
|
||||
const VRR_INS_ACCT_ENTITY_PLAYER_HEALTH = 1; // Health Insurance
|
||||
const VRR_INS_ACCT_ENTITY_PLAYER_LIFE = 2; // Life Insurance
|
||||
const VRR_INS_ACCT_ENTITY_VEH = 3; // Vehicle Insurance
|
||||
const VRR_INS_ACCT_ENTITY_BIZ = 4; // Business Insurance
|
||||
const VRR_INS_ACCT_ENTITY_HOUSE = 5; // House Insurance
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
// Insurance Account History Types
|
||||
const VRR_INS_ACCT_HISTORY_NONE = 0; // None
|
||||
const VRR_INS_ACCT_HISTORY_PLAYER_MEDICAL = 1; // Medical insurance was used (player disease/injury)
|
||||
const VRR_INS_ACCT_HISTORY_PLAYER_DEATH = 2; // Life insurance was used (player death)
|
||||
const VRR_INS_ACCT_HISTORY_VEH_DAMAGE = 3; // Vehicle was damaged, but not destroyed
|
||||
const VRR_INS_ACCT_HISTORY_VEH_WRECKED = 4; // Vehicle was completely destroyed
|
||||
const VRR_INS_ACCT_HISTORY_VEH_THEFT = 5; // Vehicle was stolen
|
||||
const VRR_INS_ACCT_HISTORY_BIZ_DAMAGE = 6; // Business was damaged (broken items/window/door)
|
||||
const VRR_INS_ACCT_HISTORY_BIZ_THEFT = 7; // Business was stolen from
|
||||
const VRR_INS_ACCT_HISTORY_HOUSE_DAMAGE = 8; // House was damaged
|
||||
const VRR_INS_ACCT_HISTORY_HOUSE_THEFT = 9; // House was stolen from
|
||||
|
||||
// ===========================================================================
|
||||
@@ -7,6 +7,229 @@
|
||||
// TYPE: Server (JavaScript)
|
||||
// ===========================================================================
|
||||
|
||||
// Item Owners
|
||||
const VRR_ITEM_OWNER_NONE = 0; // None
|
||||
const VRR_ITEM_OWNER_PLAYER = 1; // Item is in a player's inventory
|
||||
const VRR_ITEM_OWNER_VEHTRUNK = 2; // Item is in a vehicle's trunk
|
||||
const VRR_ITEM_OWNER_VEHDASH = 3; // Item is in a vehicle's glove compartment
|
||||
const VRR_ITEM_OWNER_BIZFLOOR = 4; // Item is in the public area of a business (on the floor = ready to buy)
|
||||
const VRR_ITEM_OWNER_BIZSTORAGE = 5; // Item is in a business's storage area (stock room)
|
||||
const VRR_ITEM_OWNER_HOUSE = 6; // Item is in a house
|
||||
const VRR_ITEM_OWNER_SAFE = 7; // Item is in a safe (safes can be anywhere)
|
||||
const VRR_ITEM_OWNER_ITEM = 8; // Item is in another item (trashbag, briefcase, wallet, suitcase, crate/box, barrel, etc)
|
||||
const VRR_ITEM_OWNER_GROUND = 9; // Item is on the ground
|
||||
const VRR_ITEM_OWNER_JOBLOCKER = 10; // Item is in player's job locker
|
||||
const VRR_ITEM_OWNER_LOCKER = 10; // Item is in player's locker
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
// Item Use Types
|
||||
const VRR_ITEM_USETYPE_NONE = 0; // Has no effect
|
||||
const VRR_ITEM_USETYPE_WEAPON = 1; // Equips weapon
|
||||
const VRR_ITEM_USETYPE_AMMO_CLIP = 2; // Magazine for weapon. If in inventory, R will load it into gun
|
||||
const VRR_ITEM_USETYPE_PHONE = 3; // Pulls out phone
|
||||
const VRR_ITEM_USETYPE_GPS = 4; // Not sure how I want this to work yet
|
||||
const VRR_ITEM_USETYPE_MAP = 5; // Shows minimap on HUD
|
||||
const VRR_ITEM_USETYPE_SKIN = 6; // Changes skin (uses skin changer)
|
||||
const VRR_ITEM_USETYPE_PEDPART = 7; // Changes ped part (clothing, skin, hair, etc) (UNUSED)
|
||||
const VRR_ITEM_USETYPE_PEDPROP = 8; // Changes ped prop (watches, glasses, hats, etc) (UNUSED)
|
||||
const VRR_ITEM_USETYPE_STORAGE = 9; // Shows stored items. Backpack, crate, briefcase, wallet, etc
|
||||
const VRR_ITEM_USETYPE_VEHKEY = 10; // Locks/unlocks a vehicle and allows starting engine without hotwire
|
||||
const VRR_ITEM_USETYPE_BIZKEY = 11; // Locks/unlocks a business
|
||||
const VRR_ITEM_USETYPE_HOUSEKEY = 12; // Locks/unlocks a house
|
||||
const VRR_ITEM_USETYPE_SEED = 13; // Plants a seed
|
||||
const VRR_ITEM_USETYPE_WEED = 14; // Light drug effect (short term relief of addiction symptoms?)
|
||||
const VRR_ITEM_USETYPE_COKE = 15; // Medium drug effect (medium term relief of addiction symptoms?)
|
||||
const VRR_ITEM_USETYPE_METH = 16; // Heavy drug effect (extended term relief of addiction symptoms?)
|
||||
const VRR_ITEM_USETYPE_CIGAR = 17; // Just for appearance. Makes people look cool I guess
|
||||
const VRR_ITEM_USETYPE_WATER = 18; // Replenishes small amount of health
|
||||
const VRR_ITEM_USETYPE_FOOD = 19; // Eat food. Replenishes a small amount of health
|
||||
const VRR_ITEM_USETYPE_BEER = 20; // Subtle drunk effect. Replenishes small amount of health.
|
||||
const VRR_ITEM_USETYPE_WINE = 21; // Moderate drunk effect. Replenishes moderate amount of health.
|
||||
const VRR_ITEM_USETYPE_LIQUOR = 22; // Heavy drunk effect. Replenishes large amount of health.
|
||||
const VRR_ITEM_USETYPE_COFFEE = 23; // Replenishes moderate amount of health.
|
||||
const VRR_ITEM_USETYPE_AMMO_ROUND = 23; // Bullet. Loads into magazine. Not used at the moment
|
||||
const VRR_ITEM_USETYPE_HANDCUFF = 24; //
|
||||
const VRR_ITEM_USETYPE_ROPE = 25; //
|
||||
const VRR_ITEM_USETYPE_BLINDFOLD = 26; //
|
||||
const VRR_ITEM_USETYPE_TAZER = 27; //
|
||||
const VRR_ITEM_USETYPE_ARMOUR = 28; //
|
||||
const VRR_ITEM_USETYPE_HEALTH = 29; //
|
||||
const VRR_ITEM_USETYPE_AED = 30; //
|
||||
const VRR_ITEM_USETYPE_WALKIETALKIE = 31; //
|
||||
const VRR_ITEM_USETYPE_BOOMBOX = 32; //
|
||||
const VRR_ITEM_USETYPE_EARBUDS = 33; //
|
||||
const VRR_ITEM_USETYPE_BADGE = 34; //
|
||||
const VRR_ITEM_USETYPE_DRINK = 35; // Drinkable item. Action output shows "Player_Name drinks some (drink name)"
|
||||
const VRR_ITEM_USETYPE_EXTINGUISHER = 36; // Extinguisher item. Allows putting out fires
|
||||
const VRR_ITEM_USETYPE_SPRAYPAINT = 37; // Spraypaint item. Allows spraying custom clan tags on walls
|
||||
const VRR_ITEM_USETYPE_PEPPERSPRAY = 38; // Pepper spray item. Incapacitates nearby player
|
||||
const VRR_ITEM_USETYPE_FLASHLIGHT = 39; // Flashlight item. Unusable for now, but plan to cast a custom light beam
|
||||
const VRR_ITEM_USETYPE_AIRPLANETICKET = 40; // Airplane ticket. Allows a character to move to another server
|
||||
const VRR_ITEM_USETYPE_TRAINTICKET = 41; // Train ticket. Allows a character to move to another server
|
||||
const VRR_ITEM_USETYPE_VEHUPGRADE_PART = 42; // Vehicle update part item. Allows adding custom parts like spoilers, side skirts, roof scoops, etc
|
||||
const VRR_ITEM_USETYPE_VEHTIRE = 43; // Vehicle tire item. Allows changing the tire/rim types
|
||||
const VRR_ITEM_USETYPE_FUELCAN = 44; // Fuel can item. Allows refueling of a nearby vehicle anywhere
|
||||
const VRR_ITEM_USETYPE_VEHCOLOUR = 45; // Vehicle colour item. Changes primary and secondary vehicle colours
|
||||
const VRR_ITEM_USETYPE_VEHLIVERY = 46; // Vehicle livery/paintjob item. Applies decals and special paint jobs
|
||||
const VRR_ITEM_USETYPE_VEHREPAIR = 47; // Vehicle repair item. Much longer use time
|
||||
const VRR_ITEM_USETYPE_SMOKEDRUG = 48; // Smokable drug. Action output shows "Player_Name smokes some (drug)"
|
||||
const VRR_ITEM_USETYPE_SNORTDRUG = 49; // Snortable drug. Action output shows "Player_Name snorts some (drug)"
|
||||
const VRR_ITEM_USETYPE_PLANT = 50; // Plantable item. Pot plants, coke plants, etc
|
||||
const VRR_ITEM_USETYPE_MEGAPHONE = 51; // Megaphone item. Allows shouting over greater distances. Also called a bullhorn
|
||||
const VRR_ITEM_USETYPE_INJECTDRUG = 52; // Injectable drug. Action output shows "Player_Name injects some (drug)"
|
||||
const VRR_ITEM_USETYPE_ALCOHOL = 53; // Alcohol. Applies an intoxication/drunkness effect
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
// Item Drop Types
|
||||
const VRR_ITEM_DROPTYPE_NONE = 0; // Can't be dropped
|
||||
const VRR_ITEM_DROPTYPE_OBJECT = 1; // Drops as an object on the ground
|
||||
const VRR_ITEM_DROPTYPE_PICKUP = 2; // Drops as a pickup
|
||||
const VRR_ITEM_DROPTYPE_OBJECTLIGHT = 3; // Object that produces an area light effect (lamp, flashlight, etc)
|
||||
const VRR_ITEM_DROPTYPE_DESTROY = 4; // Will destroy the item on drop (keys mostly but for any tiny object)
|
||||
const VRR_ITEM_DROPTYPE_OBJECTSTACK = 5; // Stackable objects (crates and such). Will sit on top of closest other stackable
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
// Item Occupied States
|
||||
const VRR_ITEM_ACTION_NONE = 0; // None
|
||||
const VRR_ITEM_ACTION_USE = 1; // Using item
|
||||
const VRR_ITEM_ACTION_PICKUP = 2; // Picking up item
|
||||
const VRR_ITEM_ACTION_DROP = 3; // Dropping item
|
||||
const VRR_ITEM_ACTION_SWITCH = 4; // Switching item
|
||||
const VRR_ITEM_ACTION_PUT = 5; // Putting item (into trunk, dash, crate, etc)
|
||||
const VRR_ITEM_ACTION_TAKE = 6; // Taking item (from trunk, dash, crate, etc)
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
class ItemData {
|
||||
constructor(dbAssoc = false) {
|
||||
this.databaseId = 0;
|
||||
this.index = 0;
|
||||
this.itemTypeIndex = 0;
|
||||
this.itemType = 0;
|
||||
this.ownerType = VRR_ITEM_OWNER_NONE;
|
||||
this.ownerId = 0;
|
||||
this.ownerIndex = -1;
|
||||
this.position = toVector3(0.0, 0.0, 0.0);
|
||||
this.interior = 0;
|
||||
this.dimension = 0;
|
||||
this.object = null;
|
||||
this.buyPrice = 0;
|
||||
this.needsSaved = false;
|
||||
this.amount = 0;
|
||||
this.value = 0;
|
||||
this.enabled = false;
|
||||
this.extra = false;
|
||||
|
||||
if (dbAssoc) {
|
||||
this.databaseId = toInteger(dbAssoc["item_id"]);
|
||||
this.index = 0;
|
||||
this.itemTypeIndex = 0;
|
||||
this.itemType = toInteger(dbAssoc["item_type"]);
|
||||
this.ownerType = toInteger(dbAssoc["item_owner_type"]);;
|
||||
this.ownerId = toInteger(dbAssoc["item_owner_id"]);
|
||||
this.position = toVector3(toFloat(dbAssoc["item_pos_x"]), toFloat(dbAssoc["item_pos_y"]), toFloat(dbAssoc["item_pos_z"]));
|
||||
this.interior = toInteger(dbAssoc["item_int"]);
|
||||
this.dimension = toInteger(dbAssoc["item_vw"]);
|
||||
this.buyPrice = toInteger(dbAssoc["item_buy_price"]);
|
||||
this.amount = toInteger(dbAssoc["item_amount"]);
|
||||
this.value = toInteger(dbAssoc["item_value"]);
|
||||
this.enabled = intToBool(toInteger(dbAssoc["item_enabled"]));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
class ItemTypeData {
|
||||
constructor(dbAssoc = false) {
|
||||
this.databaseId = 0;
|
||||
this.serverId = 0;
|
||||
this.index = 0;
|
||||
this.name = "Unknown";
|
||||
this.enabled = false;
|
||||
this.useType = VRR_ITEM_USETYPE_NONE;
|
||||
this.useId = 0;
|
||||
this.useValue = 0;
|
||||
this.maxValue = 0;
|
||||
this.dropType = VRR_ITEM_DROPTYPE_NONE;
|
||||
this.useId = 0;
|
||||
this.dropPosition = toVector3(0.0, 0.0, 0.0);
|
||||
this.dropRotation = toVector3(0.0, 0.0, 0.0);
|
||||
this.dropScale = toVector3(0.0, 0.0, 0.0);
|
||||
this.dropModel = 0;
|
||||
this.orderPrice = 0;
|
||||
this.orderValue = 0;
|
||||
this.demandMultiplier = 1;
|
||||
this.supplyMultiplier = 1;
|
||||
this.riskMultiplier = 1;
|
||||
this.needsSaved = false;
|
||||
this.useDelay = 0;
|
||||
this.switchDelay = 0;
|
||||
this.pickupDelay = 0;
|
||||
this.putDelay = 0;
|
||||
this.takeDelay = 0;
|
||||
this.giveDelay = 0;
|
||||
this.dropDelay = 0;
|
||||
this.useAnimationName = "";
|
||||
this.dropAnimationName = "";
|
||||
this.pickupAnimationName = "";
|
||||
this.giveAnimationName = "";
|
||||
this.putAnimationName = "";
|
||||
this.takeAnimationName = "";
|
||||
this.switchAnimationName = "";
|
||||
this.useAnimationIndex = false;
|
||||
this.dropAnimationIndex = false;
|
||||
this.pickupAnimationIndex = false;
|
||||
this.giveAnimationIndex = false;
|
||||
this.putAnimationIndex = false;
|
||||
this.takeAnimationIndex = false;
|
||||
this.switchAnimationIndex = false;
|
||||
|
||||
if (dbAssoc) {
|
||||
this.databaseId = toInteger(dbAssoc["item_type_id"]);
|
||||
this.serverId = toInteger(dbAssoc["item_type_server"]);
|
||||
this.name = dbAssoc["item_type_name"];
|
||||
this.enabled = intToBool(toInteger(dbAssoc["item_type_enabled"]));
|
||||
this.useType = toInteger(dbAssoc["item_type_use_type"]);
|
||||
this.dropType = toInteger(dbAssoc["item_type_drop_type"]);
|
||||
this.useId = toInteger(dbAssoc["item_type_use_id"]);
|
||||
this.dropPosition = toVector3(toFloat(dbAssoc["item_type_drop_pos_x"]), toFloat(dbAssoc["item_type_drop_pos_y"]), toFloat(dbAssoc["item_type_drop_pos_z"]));
|
||||
this.dropRotation = toVector3(toFloat(dbAssoc["item_type_drop_rot_x"]), toFloat(dbAssoc["item_type_drop_rot_y"]), toFloat(dbAssoc["item_type_drop_rot_z"]));
|
||||
this.dropScale = toVector3(toFloat(dbAssoc["item_type_drop_scale_x"]), toFloat(dbAssoc["item_type_drop_scale_y"]), toFloat(dbAssoc["item_type_drop_scale_z"]));
|
||||
this.dropModel = toInteger(dbAssoc["item_type_drop_model"]);
|
||||
this.useId = toInteger(dbAssoc["item_type_use_id"]);
|
||||
this.useValue = toInteger(dbAssoc["item_type_use_value"]);
|
||||
this.maxValue = toInteger(dbAssoc["item_type_max_value"]);
|
||||
this.orderPrice = toInteger(dbAssoc["item_type_order_price"]);
|
||||
this.orderValue = toInteger(dbAssoc["item_type_order_value"]);
|
||||
this.demandMultiplier = toFloat(dbAssoc["item_type_demand_multiplier"]);
|
||||
this.supplyMultiplier = toFloat(dbAssoc["item_type_supply_multiplier"]);
|
||||
this.riskMultiplier = toFloat(dbAssoc["item_type_risk_multiplier"]);
|
||||
this.size = toInteger(dbAssoc["item_type_size"]);
|
||||
this.capacity = toInteger(dbAssoc["item_type_capacity"]);
|
||||
this.useDelay = toInteger(dbAssoc["item_type_delay_use"]);
|
||||
this.switchDelay = toInteger(dbAssoc["item_type_delay_switch"]);
|
||||
this.pickupDelay = toInteger(dbAssoc["item_type_delay_pickup"]);
|
||||
this.putDelay = toInteger(dbAssoc["item_type_delay_put"]);
|
||||
this.takeDelay = toInteger(dbAssoc["item_type_delay_take"]);
|
||||
this.giveDelay = toInteger(dbAssoc["item_type_delay_give"]);
|
||||
this.dropDelay = toInteger(dbAssoc["item_type_delay_drop"]);
|
||||
this.useAnimationName = toInteger(dbAssoc["item_type_anim_use"]);
|
||||
this.switchAnimationName = toInteger(dbAssoc["item_type_anim_switch"]);
|
||||
this.pickupAnimationName = toInteger(dbAssoc["item_type_anim_pickup"]);
|
||||
this.putAnimationName = toInteger(dbAssoc["item_type_anim_put"]);
|
||||
this.takeAnimationName = toInteger(dbAssoc["item_type_anim_take"]);
|
||||
this.giveAnimationName = toInteger(dbAssoc["item_type_anim_give"]);
|
||||
this.dropAnimationName = toInteger(dbAssoc["item_type_anim_drop"]);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function initItemScript() {
|
||||
logToConsole(LOG_INFO, "[VRR.Item]: Initializing item script ...");
|
||||
logToConsole(LOG_INFO, "[VRR.Item]: Item script initialized successfully!");
|
||||
@@ -102,7 +325,7 @@ function createGroundItemObject(itemId) {
|
||||
setElementRotation(getItemData(itemId).object, getItemTypeData(getItemData(itemId).itemTypeIndex).dropRotation);
|
||||
setElementOnAllDimensions(getItemData(itemId).object, false);
|
||||
setElementDimension(getItemData(itemId).object, getItemData(itemId).dimension);
|
||||
//setEntityData(getItemData(itemId).object, "vrr.scale", getItemTypeData(getItemData(itemId).itemTypeIndex).dropScale, true);
|
||||
//setEntityData(getItemData(itemId).object, "agrp.scale", getItemTypeData(getItemData(itemId).itemTypeIndex).dropScale, true);
|
||||
addToWorld(getItemData(itemId).object);
|
||||
}
|
||||
|
||||
|
||||
@@ -7,6 +7,346 @@
|
||||
// TYPE: Server (JavaScript)
|
||||
// ===========================================================================
|
||||
|
||||
// Job Types
|
||||
const VRR_JOB_NONE = 0;
|
||||
const VRR_JOB_POLICE = 1;
|
||||
const VRR_JOB_MEDICAL = 2;
|
||||
const VRR_JOB_FIRE = 3;
|
||||
const VRR_JOB_BUS = 4;
|
||||
const VRR_JOB_TAXI = 5;
|
||||
const VRR_JOB_GARBAGE = 6;
|
||||
const VRR_JOB_WEAPON = 7;
|
||||
const VRR_JOB_DRUG = 8;
|
||||
const VRR_JOB_PIZZA = 9;
|
||||
const VRR_JOB_GENERIC = 10;
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
// Job Route States
|
||||
const VRR_JOBROUTESTATE_NONE = 0; // None
|
||||
const VRR_JOBROUTESTATE_INPROGRESS = 1; // Route is in progress. Player is in between stops but not at the last one.
|
||||
const VRR_JOBROUTESTATE_LASTSTOP = 2; // Player is heading to the last stop on the route
|
||||
const VRR_JOBROUTESTATE_PAUSED = 3; // Route is paused for some reason. For police, this could be player accepted callout and once finished, patrol route will resume
|
||||
const VRR_JOBROUTESTATE_ATSTOP = 4; // For bus/trash stops that freeze player, this is the state when they're at one
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
/**
|
||||
* @class Representing a job's data. Loaded and saved in the database
|
||||
*/
|
||||
class JobData {
|
||||
constructor(dbAssoc = false) {
|
||||
this.databaseId = 0;
|
||||
this.serverId = 0;
|
||||
this.type = VRR_JOB_NONE;
|
||||
this.name = "Unnamed";
|
||||
this.enabled = true;
|
||||
this.blipModel = -1
|
||||
this.pickupModel = -1
|
||||
this.colour = toColour(0, 0, 0, 255);
|
||||
this.whiteListEnabled = false;
|
||||
this.blackListEnabled = false;
|
||||
this.walkieTalkieFrequency = 0;
|
||||
this.index = -1;
|
||||
this.needsSaved = false;
|
||||
|
||||
this.equipment = [];
|
||||
this.uniforms = [];
|
||||
this.locations = [];
|
||||
this.whiteList = [];
|
||||
this.blackList = [];
|
||||
this.routes = [];
|
||||
|
||||
if (dbAssoc) {
|
||||
this.databaseId = dbAssoc["job_id"];
|
||||
this.serverId = dbAssoc["job_server"];
|
||||
this.type = dbAssoc["job_type"];
|
||||
this.name = dbAssoc["job_name"];
|
||||
this.enabled = dbAssoc["job_enabled"];
|
||||
this.blipModel = dbAssoc["job_blip"];
|
||||
this.pickupModel = dbAssoc["job_pickup"];
|
||||
this.colour = toColour(dbAssoc["job_colour_r"], dbAssoc["job_colour_g"], dbAssoc["job_colour_b"], 255);
|
||||
this.whiteListEnabled = dbAssoc["job_wl"];
|
||||
this.blackListEnabled = dbAssoc["job_bl"];
|
||||
this.walkieTalkieFrequency = dbAssoc["job_walkietalkiefreq"];
|
||||
|
||||
this.equipment = [];
|
||||
this.uniforms = [];
|
||||
this.locations = [];
|
||||
this.whiteList = [];
|
||||
this.blackList = [];
|
||||
this.routes = [];
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
class JobRouteData {
|
||||
constructor(dbAssoc = false) {
|
||||
this.databaseId = 0;
|
||||
this.name = "";
|
||||
this.jobId = 0;
|
||||
this.locationId = 0;
|
||||
this.enabled = false;
|
||||
this.index = -1;
|
||||
this.jobIndex = -1;
|
||||
this.locationIndex = -1;
|
||||
this.needsSaved = false;
|
||||
this.pay = 0;
|
||||
this.vehicleColour1 = 1;
|
||||
this.vehicleColour2 = 1;
|
||||
this.detail = 0;
|
||||
this.startMessage = "";
|
||||
this.finishMessage = "";
|
||||
this.locationArriveMessage = "";
|
||||
this.locationNextMessage = "";
|
||||
this.locations = [];
|
||||
|
||||
if (dbAssoc) {
|
||||
this.databaseId = toInteger(dbAssoc["job_route_id"]);
|
||||
this.name = toString(dbAssoc["job_route_name"]);
|
||||
this.jobId = toInteger(dbAssoc["job_route_job"]);
|
||||
this.locationId = toInteger(dbAssoc["job_route_job_loc"]);
|
||||
this.enabled = intToBool(toInteger(dbAssoc["job_route_enabled"]));
|
||||
this.pay = toInteger(dbAssoc["job_route_pay"]);
|
||||
this.startMessage = toString(dbAssoc["job_route_start_msg"]);
|
||||
this.finishMessage = toString(dbAssoc["job_route_finish_msg"]);
|
||||
this.locationArriveMessage = toString(dbAssoc["job_route_loc_arrive_msg"]);
|
||||
this.locationNextMessage = toString(dbAssoc["job_route_loc_next_msg"]);
|
||||
this.vehicleColour1 = toInteger(dbAssoc["job_route_veh_colour1"]);
|
||||
this.vehicleColour2 = toInteger(dbAssoc["job_route_veh_colour2"]);
|
||||
this.detail = toInteger(dbAssoc["job_route_detail"]);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
class JobRouteLocationData {
|
||||
constructor(dbAssoc = false) {
|
||||
this.databaseId = 0;
|
||||
this.name = "";
|
||||
this.routeId = 0;
|
||||
this.enabled = false;
|
||||
this.index = -1;
|
||||
this.jobIndex = -1;
|
||||
this.routeIndex = -1;
|
||||
this.needsSaved = false;
|
||||
this.position = toVector3(0.0, 0.0, 0.0);
|
||||
this.stopDelay = 0;
|
||||
this.pay = 0;
|
||||
|
||||
if (dbAssoc) {
|
||||
this.databaseId = toInteger(dbAssoc["job_route_loc_id"]);
|
||||
this.name = toString(dbAssoc["job_route_loc_name"]);
|
||||
this.routeId = toInteger(dbAssoc["job_route_loc_route"]);
|
||||
this.enabled = intToBool(toInteger(dbAssoc["job_route_loc_enabled"]));
|
||||
this.position = toVector3(toFloat(dbAssoc["job_route_loc_x"]), toFloat(dbAssoc["job_route_loc_y"]), toFloat(dbAssoc["job_route_loc_z"]));
|
||||
this.stopDelay = toInteger(dbAssoc["job_route_loc_delay"]);
|
||||
this.pay = toInteger(dbAssoc["job_route_loc_pay"]);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
/**
|
||||
* @class Representing a job equipment set's data. Loaded and saved in the database
|
||||
*/
|
||||
class JobEquipmentData {
|
||||
constructor(dbAssoc = false) {
|
||||
this.databaseId = 0;
|
||||
this.job = 0;
|
||||
this.name = "Unnamed";
|
||||
this.requiredRank = 0;
|
||||
this.enabled = false;
|
||||
this.index = -1;
|
||||
this.jobIndex = -1;
|
||||
this.needsSaved = false;
|
||||
this.items = [];
|
||||
|
||||
if (dbAssoc) {
|
||||
this.databaseId = dbAssoc["job_equip_id"];
|
||||
this.job = dbAssoc["job_equip_job"];
|
||||
this.name = dbAssoc["job_equip_name"];
|
||||
this.requiredRank = dbAssoc["job_equip_minrank"];
|
||||
this.enabled = dbAssoc["job_equip_enabled"];
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
/**
|
||||
* @class Representing a job equipment set item's data. Loaded and saved in the database
|
||||
*/
|
||||
class JobEquipmentItemData {
|
||||
constructor(dbAssoc = false) {
|
||||
this.databaseId = 0;
|
||||
this.equipmentId = 0;
|
||||
this.itemType = 0;
|
||||
this.value = 0;
|
||||
this.enabled = false;
|
||||
this.index = -1;
|
||||
this.jobIndex = -1;
|
||||
this.needsSaved = false;
|
||||
|
||||
if (dbAssoc) {
|
||||
this.databaseId = dbAssoc["job_equip_item_id"];
|
||||
this.equipmentId = dbAssoc["job_equip_item_equip"];
|
||||
this.itemType = dbAssoc["job_equip_item_type"];
|
||||
this.value = dbAssoc["job_equip_item_value"];
|
||||
this.enabled = dbAssoc["job_equip_item_enabled"];
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
/**
|
||||
* @class Representing a job uniform's data. Loaded and saved in the database
|
||||
*/
|
||||
class JobUniformData {
|
||||
constructor(dbAssoc = false) {
|
||||
this.databaseId = 0;
|
||||
this.job = 0;
|
||||
this.name = "Unnamed";
|
||||
this.requiredRank = 0
|
||||
this.skin = -1;
|
||||
this.enabled = false;
|
||||
this.index = -1;
|
||||
this.jobIndex = -1;
|
||||
this.needsSaved = false;
|
||||
|
||||
this.bodyParts = {
|
||||
hair: [0, 0],
|
||||
head: [0, 0],
|
||||
upper: [0, 0],
|
||||
lower: [0, 0],
|
||||
};
|
||||
|
||||
this.bodyProps = {
|
||||
hair: [0, 0],
|
||||
eyes: [0, 0],
|
||||
head: [0, 0],
|
||||
leftHand: [0, 0],
|
||||
rightHand: [0, 0],
|
||||
leftWrist: [0, 0],
|
||||
rightWrist: [0, 0],
|
||||
hip: [0, 0],
|
||||
leftFoot: [0, 0],
|
||||
rightFoot: [0, 0],
|
||||
};
|
||||
|
||||
if (dbAssoc) {
|
||||
this.databaseId = dbAssoc["job_uniform_id"];
|
||||
this.job = dbAssoc["job_uniform_job"];
|
||||
this.name = dbAssoc["job_uniform_name"];
|
||||
this.requiredRank = dbAssoc["job_uniform_minrank"];
|
||||
this.skin = dbAssoc["job_uniform_skin"];
|
||||
this.enabled = intToBool(dbAssoc["job_uniform_enabled"]);
|
||||
|
||||
this.bodyParts = {
|
||||
hair: [toInteger(dbAssoc["job_uniform_hd_part_hair_model"]) || 0, toInteger(dbAssoc["job_uniform_hd_part_hair_texture"]) || 0],
|
||||
head: [toInteger(dbAssoc["job_uniform_hd_part_head_model"]) || 0, toInteger(dbAssoc["job_uniform_hd_part_head_texture"]) || 0],
|
||||
upper: [toInteger(dbAssoc["job_uniform_hd_part_upper_model"]) || 0, toInteger(dbAssoc["job_uniform_hd_part_upper_texture"]) || 0],
|
||||
lower: [toInteger(dbAssoc["job_uniform_hd_part_lower_model"]) || 0, toInteger(dbAssoc["job_uniform_hd_part_lower_texture"]) || 0],
|
||||
};
|
||||
|
||||
this.bodyProps = {
|
||||
hair: [toInteger(dbAssoc["job_uniform_hd_prop_hair_model"]) || 0, toInteger(dbAssoc["job_uniform_hd_prop_hair_texture"]) || 0],
|
||||
eyes: [toInteger(dbAssoc["job_uniform_hd_prop_eyes_model"]) || 0, toInteger(dbAssoc["job_uniform_hd_prop_eyes_texture"]) || 0],
|
||||
head: [toInteger(dbAssoc["job_uniform_hd_prop_head_model"]) || 0, toInteger(dbAssoc["job_uniform_hd_prop_head_texture"]) || 0],
|
||||
leftHand: [toInteger(dbAssoc["job_uniform_hd_prop_lefthand_model"]) || 0, toInteger(dbAssoc["job_uniform_hd_prop_lefthand_texture"]) || 0],
|
||||
rightHand: [toInteger(dbAssoc["job_uniform_hd_prop_righthand_model"]) || 0, toInteger(dbAssoc["job_uniform_hd_prop_righthand_texture"]) || 0],
|
||||
leftWrist: [toInteger(dbAssoc["job_uniform_hd_prop_leftwrist_model"]) || 0, toInteger(dbAssoc["job_uniform_hd_prop_leftwrist_texture"]) || 0],
|
||||
rightWrist: [toInteger(dbAssoc["job_uniform_hd_prop_rightwrist_model"]) || 0, toInteger(dbAssoc["job_uniform_hd_prop_rightwrist_texture"]) || 0],
|
||||
hip: [toInteger(dbAssoc["job_uniform_hd_prop_hip_model"]) || 0, toInteger(dbAssoc["job_uniform_hd_prop_hip_texture"]) || 0],
|
||||
leftFoot: [toInteger(dbAssoc["job_uniform_hd_prop_leftfoot_model"]) || 0, toInteger(dbAssoc["job_uniform_hd_prop_leftfoot_texture"]) || 0],
|
||||
rightFoot: [toInteger(dbAssoc["job_uniform_hd_prop_rightfoot_model"]) || 0, toInteger(dbAssoc["job_uniform_hd_prop_rightfoot_texture"]) || 0],
|
||||
};
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
/**
|
||||
* @class JobLocationData Representing a job uniform's data. Loaded and saved in the database
|
||||
*/
|
||||
class JobLocationData {
|
||||
constructor(dbAssoc = false) {
|
||||
this.databaseId = 0;
|
||||
this.jobId = 0;
|
||||
this.position = toVector3(0.0, 0.0, 0.0);
|
||||
this.blip = false;
|
||||
this.pickup = false;
|
||||
this.enabled = false;
|
||||
this.interior = 0;
|
||||
this.dimension = 0;
|
||||
this.index = -1;
|
||||
this.jobIndex = -1;
|
||||
this.needsSaved = false;
|
||||
this.routeCache = [];
|
||||
|
||||
if (dbAssoc) {
|
||||
this.databaseId = dbAssoc["job_loc_id"];
|
||||
this.jobId = dbAssoc["job_loc_job"];
|
||||
this.position = toVector3(dbAssoc["job_loc_pos_x"], dbAssoc["job_loc_pos_y"], dbAssoc["job_loc_pos_z"]);
|
||||
this.blip = false;
|
||||
this.pickup = false;
|
||||
this.enabled = dbAssoc["job_loc_enabled"];
|
||||
this.interior = dbAssoc["job_loc_int"];
|
||||
this.dimension = dbAssoc["job_loc_vw"];
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
class JobWhiteListData {
|
||||
constructor(dbAssoc = false) {
|
||||
this.databaseId = 0;
|
||||
this.job = 0;
|
||||
this.subAccount = 0
|
||||
this.enabled = false;
|
||||
this.index = -1;
|
||||
this.jobIndex = -1;
|
||||
this.needsSaved = false;
|
||||
|
||||
if (dbAssoc) {
|
||||
this.databaseId = dbAssoc["job_wl_id"];
|
||||
this.job = dbAssoc["job_wl_job"];
|
||||
this.subAccount = dbAssoc["job_wl_sacct"]
|
||||
this.enabled = dbAssoc["job_wl_enabled"];
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
class JobBlackListData {
|
||||
constructor(dbAssoc = false) {
|
||||
this.databaseId = 0;
|
||||
this.job = 0;
|
||||
this.subAccount = 0
|
||||
this.enabled = false;
|
||||
this.index = -1;
|
||||
this.jobIndex = -1;
|
||||
this.needsSaved = false;
|
||||
|
||||
if (dbAssoc) {
|
||||
this.databaseId = dbAssoc["job_bl_id"];
|
||||
this.job = dbAssoc["job_bl_job"];
|
||||
this.subAccount = dbAssoc["job_bl_sacct"]
|
||||
this.enabled = dbAssoc["job_bl_enabled"];
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function initJobScript() {
|
||||
logToConsole(LOG_INFO, "[VRR.Job]: Initializing job script ...");
|
||||
logToConsole(LOG_INFO, "[VRR.Job]: Job script initialized successfully!");
|
||||
@@ -284,11 +624,11 @@ function createAllJobPickups() {
|
||||
for (let j in getServerData().jobs[i].locations) {
|
||||
pickupCount++;
|
||||
getServerData().jobs[i].locations[j].pickup = game.createPickup(getServerData().jobs[i].pickupModel, getServerData().jobs[i].locations[j].position);
|
||||
setEntityData(getServerData().jobs[i].locations[j].pickup, "vrr.owner.type", VRR_PICKUP_JOB, false);
|
||||
setEntityData(getServerData().jobs[i].locations[j].pickup, "vrr.owner.id", j, false);
|
||||
setEntityData(getServerData().jobs[i].locations[j].pickup, "vrr.label.type", VRR_LABEL_JOB, true);
|
||||
setEntityData(getServerData().jobs[i].locations[j].pickup, "vrr.label.name", getServerData().jobs[i].name, true);
|
||||
setEntityData(getServerData().jobs[i].locations[j].pickup, "vrr.label.jobType", getServerData().jobs[i].databaseId, true);
|
||||
setEntityData(getServerData().jobs[i].locations[j].pickup, "agrp.owner.type", VRR_PICKUP_JOB, false);
|
||||
setEntityData(getServerData().jobs[i].locations[j].pickup, "agrp.owner.id", j, false);
|
||||
setEntityData(getServerData().jobs[i].locations[j].pickup, "agrp.label.type", VRR_LABEL_JOB, true);
|
||||
setEntityData(getServerData().jobs[i].locations[j].pickup, "agrp.label.name", getServerData().jobs[i].name, true);
|
||||
setEntityData(getServerData().jobs[i].locations[j].pickup, "agrp.label.jobType", getServerData().jobs[i].databaseId, true);
|
||||
setElementOnAllDimensions(getServerData().jobs[i].locations[j].pickup, false);
|
||||
setElementDimension(getServerData().jobs[i].locations[j].pickup, getServerData().jobs[i].locations[j].dimension);
|
||||
addToWorld(getServerData().jobs[i].locations[j].pickup);
|
||||
@@ -2402,11 +2742,11 @@ function createJobLocationPickup(jobId, locationId) {
|
||||
tempJobData.locations[locationId].pickup = pickup;
|
||||
setElementDimension(pickup, tempJobData.locations[locationId].dimension);
|
||||
setElementOnAllDimensions(pickup, false);
|
||||
setEntityData(pickup, "vrr.owner.type", VRR_PICKUP_JOB, false);
|
||||
setEntityData(pickup, "vrr.owner.id", locationId, false);
|
||||
setEntityData(pickup, "vrr.label.type", VRR_LABEL_JOB, true);
|
||||
setEntityData(pickup, "vrr.label.name", tempJobData.name, true);
|
||||
setEntityData(pickup, "vrr.label.jobType", tempJobData.databaseId, true);
|
||||
setEntityData(pickup, "agrp.owner.type", VRR_PICKUP_JOB, false);
|
||||
setEntityData(pickup, "agrp.owner.id", locationId, false);
|
||||
setEntityData(pickup, "agrp.label.type", VRR_LABEL_JOB, true);
|
||||
setEntityData(pickup, "agrp.label.name", tempJobData.name, true);
|
||||
setEntityData(pickup, "agrp.label.jobType", tempJobData.databaseId, true);
|
||||
addToWorld(pickup);
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -8,6 +8,32 @@
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
class KeyBindData {
|
||||
constructor(dbAssoc = false, key = 0, commandString = "", keyState = VRR_KEYSTATE_UP) {
|
||||
this.databaseId = 0;
|
||||
this.key = key;
|
||||
this.account = 0;
|
||||
this.commandString = commandString;
|
||||
this.whenAdded = 0;
|
||||
this.enabled = true;
|
||||
this.keyState = false;
|
||||
this.index = -1;
|
||||
this.needsSaved = false;
|
||||
|
||||
if(dbAssoc) {
|
||||
this.databaseId = dbAssoc["acct_hotkey_id"];
|
||||
this.key = toInteger(dbAssoc["acct_hotkey_key"]);
|
||||
this.account = toInteger(dbAssoc["acct_hotkey_acct"]);
|
||||
this.commandString = dbAssoc["acct_hotkey_cmdstr"];
|
||||
this.whenAdded = dbAssoc["acct_hotkey_when_added"];
|
||||
this.enabled = intToBool(dbAssoc["acct_hotkey_enabled"]);
|
||||
this.keyState = intToBool(dbAssoc["acct_hotkey_down"]);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function initKeyBindScript() {
|
||||
logToConsole(LOG_INFO, "[VRR.KeyBind]: Initializing key bind script ...");
|
||||
logToConsole(LOG_INFO, "[VRR.KeyBind]: Key bind script initialized!");
|
||||
|
||||
@@ -15,76 +15,42 @@ function initLocaleScript() {
|
||||
// ===========================================================================
|
||||
|
||||
function getLocaleString(client, stringName, ...args) {
|
||||
let tempString = getRawLocaleString(stringName, getPlayerData(client).locale);
|
||||
if(tempString == "" || tempString == null || typeof tempString == "undefined") {
|
||||
logToConsole(LOG_WARN, `[VRR.Locale] Locale string missing for ${stringName} on language ${getLocaleData(getPlayerData(client).locale).englishName}`);
|
||||
let localeId = getPlayerData(client).locale;
|
||||
if (!findResourceByName("agrp_locale").exports.doesLocaleStringExist(localeId, stringName)) {
|
||||
submitBugReport(client, `(AUTOMATED REPORT) Locale string "${stringName}" is missing for "${getPlayerLocaleName(client)}"`);
|
||||
return "";
|
||||
}
|
||||
|
||||
for(let i = 1; i <= args.length; i++) {
|
||||
tempString = tempString.replace(`{${i}}`, args[i-1]);
|
||||
}
|
||||
|
||||
return tempString;
|
||||
return findResourceByName("agrp_locale").exports.getLocaleString(localeId, stringName, args);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function getLanguageLocaleString(localeId, stringName, ...args) {
|
||||
let tempString = getRawLocaleString(stringName, localeId);
|
||||
if(tempString == "" || tempString == null || typeof tempString == "undefined") {
|
||||
logToConsole(LOG_WARN, `[VRR.Locale] Locale string missing for ${stringName} on language ${getLocaleData(getPlayerData(client).locale).englishName}`);
|
||||
if (!findResourceByName("agrp_locale").exports.doesLocaleStringExist(localeId, stringName)) {
|
||||
submitBugReport(client, `(AUTOMATED REPORT) Locale string "${stringName}" is missing for "${getPlayerLocaleName(client)}"`);
|
||||
return "";
|
||||
}
|
||||
|
||||
for(let i = 1; i <= args.length; i++) {
|
||||
tempString = tempString.replace(`{${i}}`, args[i-1]);
|
||||
}
|
||||
|
||||
return tempString;
|
||||
return findResourceByName("agrp_locale").exports.getLocaleString(getPlayerData(client).locale, stringName, args);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function getGroupedLocaleString(client, stringName, index, ...args) {
|
||||
let tempString = getRawGroupedLocaleString(stringName, getPlayerData(client).locale, index);
|
||||
|
||||
for(let i = 1; i <= args.length; i++) {
|
||||
tempString = tempString.replace(`{${i}}`, args[i-1]);
|
||||
}
|
||||
|
||||
return tempString;
|
||||
return findResourceByName("agrp_locale").exports.getGroupedLocaleString(getPlayerData(client).locale, stringName, index, args);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function getRawLocaleString(stringName, localeId) {
|
||||
return getLocaleStrings()[localeId][stringName];
|
||||
|
||||
//if(findResourceByName("agrp_locale").exports.doesLocaleStringExist(localeId, stringName) == false) {
|
||||
// return "";
|
||||
//}
|
||||
|
||||
//let tempString = findResourceByName("agrp_locale").exports.getRawLocaleString(localeId, stringName);
|
||||
//if(tempString == "" || tempString == null || tempString == undefined) {
|
||||
// return "";
|
||||
//}
|
||||
return findResourceByName("agrp_locale").exports.getRawLocaleString(localeId, stringName);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function getRawGroupedLocaleString(stringName, localeId, index) {
|
||||
return getLocaleStrings()[localeId][stringName][index];
|
||||
|
||||
//if(findResourceByName("agrp_locale").exports.doesLocaleStringExist(localeId, stringName) == false) {
|
||||
// return "";
|
||||
//}
|
||||
|
||||
//let tempString = findResourceByName("agrp_locale").exports.getRawLocaleString(localeId, stringName);
|
||||
//if(tempString == "" || tempString == null || tempString == undefined) {
|
||||
// return "";
|
||||
//}
|
||||
return findResourceByName("agrp_locale").exports.getRawGroupedLocaleString(localeId, stringName, index);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -96,58 +62,24 @@ function getPlayerLocaleName(client) {
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function loadAllLocaleStrings() {
|
||||
let tempLocaleStrings = {};
|
||||
|
||||
let locales = getGlobalConfig().locale.locales;
|
||||
for(let i in locales) {
|
||||
let localeData = locales[i];
|
||||
let localeFile = JSON.parse(loadTextFile(`locale/${localeData.stringsFile}`));
|
||||
tempLocaleStrings[i] = localeFile;
|
||||
}
|
||||
|
||||
return tempLocaleStrings;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function getLocaleStrings() {
|
||||
return getServerData().localeStrings;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function getLocaleFromParams(params) {
|
||||
let locales = getLocales();
|
||||
if(isNaN(params)) {
|
||||
for(let i in locales) {
|
||||
if(toLowerCase(locales[i].isoCode).indexOf(toLowerCase(params)) != -1) {
|
||||
return i;
|
||||
}
|
||||
|
||||
if(toLowerCase(locales[i].englishName).indexOf(toLowerCase(params)) != -1) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
return findResourceByName("agrp_locale").exports.getLocaleFromParams(params);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function getLocales() {
|
||||
return getGlobalConfig().locale.locales;
|
||||
return findResourceByName("agrp_locale").exports.getLocales();
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function showLocaleListCommand(command, params, client) {
|
||||
let localeList = getLocales().map(function(x) { return x[0]; });
|
||||
let localeList = getLocales().map(function (x) { return x[0]; });
|
||||
let chunkedList = splitArrayIntoChunks(localeList, 10);
|
||||
|
||||
messagePlayerInfo(client, getLocaleString(client, "HeaderLocaleList"));
|
||||
for(let i in chunkedList) {
|
||||
for (let i in chunkedList) {
|
||||
messagePlayerInfo(client, chunkedList[i].join(", "));
|
||||
}
|
||||
}
|
||||
@@ -155,14 +87,14 @@ function showLocaleListCommand(command, params, client) {
|
||||
// ===========================================================================
|
||||
|
||||
function setLocaleCommand(command, params, client) {
|
||||
if(areParamsEmpty(params)) {
|
||||
if (areParamsEmpty(params)) {
|
||||
messagePlayerSyntax(client, getCommandSyntaxText(command));
|
||||
return false;
|
||||
}
|
||||
|
||||
let localeId = getLocaleFromParams(params);
|
||||
|
||||
if(!getLocaleData(localeId)) {
|
||||
if (!getLocaleData(localeId)) {
|
||||
messagePlayerInfo(client, getLocaleString(client, "InvalidLocale"));
|
||||
return false;
|
||||
}
|
||||
@@ -176,7 +108,7 @@ function setLocaleCommand(command, params, client) {
|
||||
// ===========================================================================
|
||||
|
||||
function getLocaleData(localeId) {
|
||||
if(typeof getLocales()[localeId] != "undefined") {
|
||||
if (typeof getLocales()[localeId] != "undefined") {
|
||||
return getLocales()[localeId];
|
||||
}
|
||||
|
||||
@@ -204,12 +136,12 @@ function reloadLocaleConfigurationCommand(command, params, client) {
|
||||
|
||||
async function translateMessage(messageText, translateFrom = getGlobalConfig().locale.defaultLanguageId, translateTo = getGlobalConfig().locale.defaultLanguageId) {
|
||||
return new Promise(resolve => {
|
||||
if(translateFrom == translateTo) {
|
||||
if (translateFrom == translateTo) {
|
||||
resolve(messageText);
|
||||
}
|
||||
|
||||
for(let i in cachedTranslations[translateFrom][translateTo]) {
|
||||
if(cachedTranslations[translateFrom][translateTo][i][0] == messageText) {
|
||||
for (let i in cachedTranslations[translateFrom][translateTo]) {
|
||||
if (cachedTranslations[translateFrom][translateTo][i][0] == messageText) {
|
||||
logToConsole(LOG_DEBUG, `[Translate]: Using existing translation for ${getGlobalConfig().locale.locales[translateFrom].englishName} to ${getGlobalConfig().locale.locales[translateTo].englishName} - (${messageText}), (${cachedTranslations[translateFrom][translateTo][i][1]})`);
|
||||
resolve(cachedTranslations[translateFrom][translateTo][i][1]);
|
||||
return true;
|
||||
@@ -220,13 +152,13 @@ async function translateMessage(messageText, translateFrom = getGlobalConfig().l
|
||||
httpGet(
|
||||
thisTranslationURL,
|
||||
"",
|
||||
function(data) {
|
||||
function (data) {
|
||||
data = ArrayBufferToString(data);
|
||||
let translationData = JSON.parse(data);
|
||||
cachedTranslations[translateFrom][translateTo].push([messageText, translationData.responseData.translatedText]);
|
||||
resolve(translationData.responseData.translatedText);
|
||||
},
|
||||
function(data) {
|
||||
function (data) {
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
@@ -7,6 +7,45 @@
|
||||
// TYPE: Server (JavaScript)
|
||||
// ===========================================================================
|
||||
|
||||
// Pickup Types
|
||||
const VRR_PICKUP_NONE = 0;
|
||||
const VRR_PICKUP_JOB = 1;
|
||||
const VRR_PICKUP_BUSINESS_ENTRANCE = 2;
|
||||
const VRR_PICKUP_BUSINESS_EXIT = 3;
|
||||
const VRR_PICKUP_HOUSE_ENTRANCE = 4;
|
||||
const VRR_PICKUP_HOUSE_EXIT = 5;
|
||||
const VRR_PICKUP_EXIT = 6;
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
// Blip Owner Types
|
||||
const VRR_BLIP_NONE = 0;
|
||||
const VRR_BLIP_JOB = 1;
|
||||
const VRR_BLIP_BUSINESS_ENTRANCE = 2;
|
||||
const VRR_BLIP_BUSINESS_EXIT = 3;
|
||||
const VRR_BLIP_HOUSE_ENTRANCE = 4;
|
||||
const VRR_BLIP_HOUSE_EXIT = 5;
|
||||
const VRR_BLIP_EXIT = 6;
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
// Ped States
|
||||
const VRR_PEDSTATE_NONE = 2; // None
|
||||
const VRR_PEDSTATE_READY = 1; // Ready
|
||||
const VRR_PEDSTATE_DRIVER = 2; // Driving a vehicle
|
||||
const VRR_PEDSTATE_PASSENGER = 3; // In a vehicle as passenger
|
||||
const VRR_PEDSTATE_DEAD = 4; // Dead
|
||||
const VRR_PEDSTATE_ENTERINGPROPERTY = 5; // Entering a property
|
||||
const VRR_PEDSTATE_EXITINGPROPERTY = 6; // Exiting a property
|
||||
const VRR_PEDSTATE_ENTERINGVEHICLE = 7; // Entering a vehicle
|
||||
const VRR_PEDSTATE_EXITINGVEHICLE = 8; // Exiting a vehicle
|
||||
const VRR_PEDSTATE_BINDED = 9; // Binded by rope or handcuffs
|
||||
const VRR_PEDSTATE_TAZED = 10; // Under incapacitating effect of tazer
|
||||
const VRR_PEDSTATE_INTRUNK = 11; // In vehicle trunk
|
||||
const VRR_PEDSTATE_INITEM = 12; // In item (crate, box, etc)
|
||||
const VRR_PEDSTATE_HANDSUP = 13; // Has hands up (surrendering)
|
||||
const VRR_PEDSTATE_SPAWNING = 14; // Spawning
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function initMiscScript() {
|
||||
@@ -129,8 +168,8 @@ function enterExitPropertyCommand(command, params, client) {
|
||||
return false;
|
||||
}
|
||||
|
||||
let ownerType = getEntityData(getPlayerData(client).currentPickup, "vrr.owner.type");
|
||||
let ownerId = getEntityData(getPlayerData(client).currentPickup, "vrr.owner.id");
|
||||
let ownerType = getEntityData(getPlayerData(client).currentPickup, "agrp.owner.type");
|
||||
let ownerId = getEntityData(getPlayerData(client).currentPickup, "agrp.owner.id");
|
||||
|
||||
switch (ownerType) {
|
||||
case VRR_PICKUP_BUSINESS_ENTRANCE:
|
||||
@@ -417,146 +456,6 @@ function listOnlineAdminsCommand(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 gpsCommand(command, params, client) {
|
||||
messagePlayerNormal(client, makeChatBoxSectionHeader(getLocaleString(client, "HeaderBusinessList")));
|
||||
|
||||
let locationType = VRR_GPS_TYPE_NONE;
|
||||
let useType = VRR_ITEM_USETYPE_NONE;
|
||||
let blipColour = "white";
|
||||
|
||||
switch (toLowerCase(params)) {
|
||||
case "police":
|
||||
case "policestation":
|
||||
blipColour = "mediumGrey"
|
||||
locationType = VRR_GPS_TYPE_POLICE;
|
||||
break;
|
||||
|
||||
case "hospital":
|
||||
blipColour = "mediumGrey"
|
||||
locationType = VRR_GPS_TYPE_HOSPITAL;
|
||||
break;
|
||||
|
||||
case "job":
|
||||
blipColour = "mediumGrey"
|
||||
locationType = VRR_GPS_TYPE_JOB;
|
||||
break;
|
||||
|
||||
case "skin":
|
||||
case "skins":
|
||||
case "clothes":
|
||||
case "player":
|
||||
blipColour = "mediumGrey"
|
||||
locationType = VRR_GPS_TYPE_BUSINESS;
|
||||
useType = VRR_ITEM_USETYPE_SKIN;
|
||||
break;
|
||||
|
||||
case "gun":
|
||||
case "guns":
|
||||
case "weapon":
|
||||
case "weapons":
|
||||
case "wep":
|
||||
case "weps":
|
||||
blipColour = "mediumGrey"
|
||||
locationType = VRR_GPS_TYPE_BUSINESS;
|
||||
useType = VRR_ITEM_USETYPE_WEAPON;
|
||||
break;
|
||||
|
||||
case "food":
|
||||
case "eat":
|
||||
blipColour = "mediumGrey"
|
||||
locationType = VRR_GPS_TYPE_BUSINESS;
|
||||
useType = VRR_ITEM_USETYPE_FOOD;
|
||||
break;
|
||||
|
||||
case "drink":
|
||||
blipColour = "mediumGrey"
|
||||
locationType = VRR_GPS_TYPE_BUSINESS;
|
||||
useType = VRR_ITEM_USETYPE_DRINK;
|
||||
break;
|
||||
|
||||
case "alcohol":
|
||||
case "booze":
|
||||
case "bar":
|
||||
blipColour = "mediumGrey"
|
||||
locationType = VRR_GPS_TYPE_BUSINESS;
|
||||
useType = VRR_ITEM_USETYPE_ALCOHOL;
|
||||
break;
|
||||
|
||||
case "repair":
|
||||
case "carrepair":
|
||||
case "vehrepair":
|
||||
case "spray":
|
||||
case "fix":
|
||||
blipColour = "mediumGrey"
|
||||
locationType = VRR_GPS_TYPE_BUSINESS;
|
||||
useType = VRR_ITEM_USETYPE_VEHREPAIR;
|
||||
break;
|
||||
|
||||
case "vehiclecolour":
|
||||
case "vehcolour":
|
||||
case "carcolour":
|
||||
case "colour":
|
||||
blipColour = "mediumGrey"
|
||||
locationType = VRR_GPS_TYPE_BUSINESS;
|
||||
useType = VRR_ITEM_USETYPE_VEHCOLOUR;
|
||||
break;
|
||||
|
||||
default: {
|
||||
let itemTypeId = getItemTypeFromParams(params);
|
||||
if (getItemTypeData(itemTypeId) != false) {
|
||||
locationType = VRR_GPS_TYPE_BUSINESS;
|
||||
blipColour = "mediumGrey";
|
||||
useType = getItemTypeData(itemTypeId).useType;
|
||||
} else {
|
||||
let gameLocationId = getGameLocationFromParams(params);
|
||||
if (gameLocationId != false) {
|
||||
position = getGameConfig().locations[getGame()][gameLocationId][1]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (locationType == VRR_GPS_TYPE_NONE) {
|
||||
messagePlayerError(client, getLocaleString(client, "InvalidGPSLocation"));
|
||||
return false;
|
||||
}
|
||||
|
||||
if (locationType == VRR_GPS_TYPE_BUSINESS) {
|
||||
let businessId = getClosestBusinessWithBuyableItemOfUseType(useType);
|
||||
if (!businessId) {
|
||||
messagePlayerError(client, getLocaleString(client, "NoBusinessWithItemType"));
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!getBusinessData(businessId)) {
|
||||
messagePlayerError(client, getLocaleString(client, "NoBusinessWithItemType"));
|
||||
return false;
|
||||
}
|
||||
|
||||
hideAllBlipsForPlayerGPS(client);
|
||||
blinkGenericGPSBlipForPlayer(client, getBusinessData(businessId).entrancePosition, getBusinessData(businessId).entranceBlipModel, getColourByType(blipColour), 10);
|
||||
messagePlayerSuccess(client, "Look for the blinking icon on your mini map");
|
||||
}
|
||||
|
||||
if (locationType == VRR_GPS_TYPE_GAMELOC) {
|
||||
hideAllBlipsForPlayerGPS(client);
|
||||
blinkGenericGPSBlipForPlayer(client, position, 0, getColourByType(blipColour), 10);
|
||||
messagePlayerSuccess(client, "Look for the blinking icon on your mini map");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
/**
|
||||
* This is a command handler function.
|
||||
*
|
||||
|
||||
@@ -181,7 +181,7 @@ function getVehicleHeading(vehicle) {
|
||||
|
||||
function setVehicleHeading(vehicle, heading) {
|
||||
if (getGame() == VRR_GAME_GTA_IV) {
|
||||
return sendNetworkEventToPlayer("vrr.vehPosition", null, getVehicleForNetworkEvent(vehicle), heading);
|
||||
return sendNetworkEventToPlayer("agrp.vehPosition", null, getVehicleForNetworkEvent(vehicle), heading);
|
||||
}
|
||||
return vehicle.heading = heading;
|
||||
}
|
||||
@@ -255,7 +255,7 @@ function removePlayerFromVehicle(client) {
|
||||
function setPlayerSkin(client, skinIndex) {
|
||||
logToConsole(LOG_DEBUG, `Setting ${getPlayerDisplayForConsole(client)}'s skin to ${getGameConfig().skins[getGame()][skinIndex][0]} (Index: ${skinIndex}, Name: ${getGameConfig().skins[getGame()][skinIndex][1]})`);
|
||||
if (getGame() == VRR_GAME_GTA_IV) {
|
||||
triggerNetworkEvent("vrr.localPlayerSkin", client, getGameConfig().skins[getGame()][skinIndex][0]);
|
||||
triggerNetworkEvent("agrp.localPlayerSkin", client, getGameConfig().skins[getGame()][skinIndex][0]);
|
||||
} else {
|
||||
getPlayerPed(client).modelIndex = getGameConfig().skins[getGame()][skinIndex][0];
|
||||
}
|
||||
@@ -547,15 +547,15 @@ function repairVehicle(vehicle) {
|
||||
// ===========================================================================
|
||||
|
||||
function setVehicleLights(vehicle, lights) {
|
||||
setEntityData(vehicle, "vrr.lights", lights, true);
|
||||
sendNetworkEventToPlayer("vrr.veh.lights", null, vehicle.id, lights);
|
||||
setEntityData(vehicle, "agrp.lights", lights, true);
|
||||
sendNetworkEventToPlayer("agrp.veh.lights", null, vehicle.id, lights);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function setVehicleEngine(vehicle, engine) {
|
||||
vehicle.engine = engine;
|
||||
setEntityData(vehicle, "vrr.engine", engine, true);
|
||||
setEntityData(vehicle, "agrp.engine", engine, true);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -688,7 +688,7 @@ function setPlayerFightStyle(client, fightStyleId) {
|
||||
return false;
|
||||
}
|
||||
|
||||
setEntityData(getPlayerElement(client), "vrr.fightStyle", [getGameConfig().fightStyles[getGame()][fightStyleId][1][0], getGameConfig().fightStyles[getGame()][fightStyleId][1][1]]);
|
||||
setEntityData(getPlayerElement(client), "agrp.fightStyle", [getGameConfig().fightStyles[getGame()][fightStyleId][1][0], getGameConfig().fightStyles[getGame()][fightStyleId][1][1]]);
|
||||
forcePlayerToSyncElementProperties(null, getPlayerElement(client));
|
||||
}
|
||||
|
||||
@@ -707,7 +707,7 @@ function getPlayerElement(client) {
|
||||
// ===========================================================================
|
||||
|
||||
function setElementPosition(element, position) {
|
||||
sendNetworkEventToPlayer("vrr.elementPosition", null, element.id, position);
|
||||
sendNetworkEventToPlayer("agrp.elementPosition", null, element.id, position);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -725,14 +725,14 @@ function getElementHeading(element) {
|
||||
// ===========================================================================
|
||||
|
||||
function setElementInterior(element, interior) {
|
||||
setEntityData(element, "vrr.interior", interior, true);
|
||||
setEntityData(element, "agrp.interior", interior, true);
|
||||
forcePlayerToSyncElementProperties(null, element);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function setElementCollisionsEnabled(element, state) {
|
||||
sendNetworkEventToPlayer("vrr.elementCollisions", null, element.id, state);
|
||||
sendNetworkEventToPlayer("agrp.elementCollisions", null, element.id, state);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -1142,13 +1142,13 @@ function setVehicleHealth(vehicle, health) {
|
||||
|
||||
function givePlayerWeapon(client, weaponId, ammo, active = true) {
|
||||
logToConsole(LOG_DEBUG, `[VRR.Client] Sending signal to ${getPlayerDisplayForConsole(client)} to give weapon (Weapon: ${weaponId}, Ammo: ${ammo})`);
|
||||
sendNetworkEventToPlayer("vrr.giveWeapon", client, weaponId, ammo, active);
|
||||
sendNetworkEventToPlayer("agrp.giveWeapon", client, weaponId, ammo, active);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function setPlayerWantedLevel(client, wantedLevel) {
|
||||
sendNetworkEventToPlayer("vrr.wantedLevel", client, wantedLevel);
|
||||
sendNetworkEventToPlayer("agrp.wantedLevel", client, wantedLevel);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1287,7 +1287,7 @@ function serverBanIP(ip) {
|
||||
// ===========================================================================
|
||||
|
||||
function setVehicleTrunkState(vehicle, trunkState) {
|
||||
sendNetworkEventToPlayer("vrr.veh.trunk", null, getVehicleForNetworkEvent(vehicle), trunkState);
|
||||
sendNetworkEventToPlayer("agrp.veh.trunk", null, getVehicleForNetworkEvent(vehicle), trunkState);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
@@ -40,10 +40,10 @@ let disconnectReasons = [
|
||||
// ===========================================================================
|
||||
|
||||
function getPlayerPosition(client) {
|
||||
if(!areServerElementsSupported()) {
|
||||
if (!areServerElementsSupported()) {
|
||||
return getPlayerData(client).syncPosition;
|
||||
} else {
|
||||
if(getPlayerPed(client) != null) {
|
||||
if (getPlayerPed(client) != null) {
|
||||
return getPlayerPed(client).position;
|
||||
}
|
||||
}
|
||||
@@ -59,10 +59,10 @@ function setPlayerPosition(client, position) {
|
||||
// ===========================================================================
|
||||
|
||||
function getPlayerHeading(client) {
|
||||
if(!areServerElementsSupported()) {
|
||||
if (!areServerElementsSupported()) {
|
||||
return getPlayerData(client).syncHeading;
|
||||
} else {
|
||||
if(getPlayerPed(client) != null) {
|
||||
if (getPlayerPed(client) != null) {
|
||||
return getPlayerPed(client).heading;
|
||||
}
|
||||
}
|
||||
@@ -78,10 +78,10 @@ function setPlayerHeading(client, heading) {
|
||||
// ===========================================================================
|
||||
|
||||
function getPlayerVehicle(client) {
|
||||
if(!areServerElementsSupported()) {
|
||||
if (!areServerElementsSupported()) {
|
||||
return getPlayerData().syncVehicle;
|
||||
} else {
|
||||
if(getPlayerPed(client).vehicle) {
|
||||
if (getPlayerPed(client).vehicle) {
|
||||
return getPlayerPed(client).vehicle;
|
||||
}
|
||||
}
|
||||
@@ -91,10 +91,10 @@ function getPlayerVehicle(client) {
|
||||
// ===========================================================================
|
||||
|
||||
function getPlayerDimension(client) {
|
||||
if(!areServerElementsSupported()) {
|
||||
if (!areServerElementsSupported()) {
|
||||
return getPlayerData(client).syncDimension;
|
||||
} else {
|
||||
if(getPlayerPed(client) != null) {
|
||||
if (getPlayerPed(client) != null) {
|
||||
return getPlayerPed(client).dimension;
|
||||
}
|
||||
}
|
||||
@@ -110,10 +110,10 @@ function getPlayerInterior(client) {
|
||||
|
||||
function setPlayerDimension(client, dimension) {
|
||||
logToConsole(LOG_VERBOSE, `Setting ${getPlayerDisplayForConsole(client)}'s dimension to ${dimension}`);
|
||||
if(!areServerElementsSupported()) {
|
||||
if (!areServerElementsSupported()) {
|
||||
getPlayerData(client).syncDimension = dimension;
|
||||
} else {
|
||||
if(getPlayerPed(client) != null) {
|
||||
if (getPlayerPed(client) != null) {
|
||||
getPlayerPed(client).dimension = dimension;
|
||||
}
|
||||
}
|
||||
@@ -124,7 +124,7 @@ function setPlayerDimension(client, dimension) {
|
||||
function setPlayerInterior(client, interior) {
|
||||
logToConsole(LOG_VERBOSE, `Setting ${getPlayerDisplayForConsole(client)}'s interior to ${interior}`);
|
||||
sendPlayerSetInterior(client, interior);
|
||||
if(isPlayerLoggedIn(client) && isPlayerSpawned(client)) {
|
||||
if (isPlayerLoggedIn(client) && isPlayerSpawned(client)) {
|
||||
getPlayerCurrentSubAccount(client).interior = interior;
|
||||
}
|
||||
}
|
||||
@@ -132,7 +132,7 @@ function setPlayerInterior(client, interior) {
|
||||
// ===========================================================================
|
||||
|
||||
function isPlayerInAnyVehicle(client) {
|
||||
if(!areServerElementsSupported()) {
|
||||
if (!areServerElementsSupported()) {
|
||||
return (getPlayerData().syncVehicle != null);
|
||||
} else {
|
||||
return (getPlayerPed(client).vehicle != null);
|
||||
@@ -142,15 +142,15 @@ function isPlayerInAnyVehicle(client) {
|
||||
// ===========================================================================
|
||||
|
||||
function getPlayerVehicleSeat(client) {
|
||||
if(!isPlayerInAnyVehicle(client)) {
|
||||
if (!isPlayerInAnyVehicle(client)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!areServerElementsSupported()) {
|
||||
if (!areServerElementsSupported()) {
|
||||
return getPlayerData().syncVehicleSeat;
|
||||
} else {
|
||||
for(let i = 0 ; i <= 8 ; i++) {
|
||||
if(getPlayerVehicle(client).getOccupant(i) == getPlayerPed(client)) {
|
||||
for (let i = 0; i <= 8; i++) {
|
||||
if (getPlayerVehicle(client).getOccupant(i) == getPlayerPed(client)) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
@@ -180,8 +180,8 @@ function getVehicleHeading(vehicle) {
|
||||
// ===========================================================================
|
||||
|
||||
function setVehicleHeading(vehicle, heading) {
|
||||
if(getGame() == VRR_GAME_GTA_IV) {
|
||||
return sendNetworkEventToPlayer("vrr.vehPosition", null, getVehicleForNetworkEvent(vehicle), heading);
|
||||
if (getGame() == VRR_GAME_GTA_IV) {
|
||||
return sendNetworkEventToPlayer("agrp.vehPosition", null, getVehicleForNetworkEvent(vehicle), heading);
|
||||
}
|
||||
return vehicle.heading = heading;
|
||||
}
|
||||
@@ -189,7 +189,7 @@ function setVehicleHeading(vehicle, heading) {
|
||||
// ===========================================================================
|
||||
|
||||
function getElementTransient(element) {
|
||||
if(typeof element.transient != "undefined") {
|
||||
if (typeof element.transient != "undefined") {
|
||||
return element.transient;
|
||||
}
|
||||
return false;
|
||||
@@ -198,7 +198,7 @@ function getElementTransient(element) {
|
||||
// ===========================================================================
|
||||
|
||||
function setElementTransient(element, state) {
|
||||
if(typeof element.transient != "undefined") {
|
||||
if (typeof element.transient != "undefined") {
|
||||
element.transient = state;
|
||||
return true;
|
||||
}
|
||||
@@ -214,8 +214,8 @@ function getVehicleSyncer(vehicle) {
|
||||
// ===========================================================================
|
||||
|
||||
function getVehicleForNetworkEvent(vehicle) {
|
||||
if(getGame() == VRR_GAME_GTA_IV) {
|
||||
if(getVehicleData(vehicle).ivNetworkId != -1) {
|
||||
if (getGame() == VRR_GAME_GTA_IV) {
|
||||
if (getVehicleData(vehicle).ivNetworkId != -1) {
|
||||
return getVehicleData(vehicle).ivNetworkId;
|
||||
}
|
||||
return -1;
|
||||
@@ -227,11 +227,11 @@ function getVehicleForNetworkEvent(vehicle) {
|
||||
|
||||
function deleteGameElement(element) {
|
||||
try {
|
||||
if(element != null) {
|
||||
if (element != null) {
|
||||
destroyElement(element);
|
||||
return true;
|
||||
}
|
||||
} catch(error) {
|
||||
} catch (error) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -254,8 +254,8 @@ function removePlayerFromVehicle(client) {
|
||||
|
||||
function setPlayerSkin(client, skinIndex) {
|
||||
logToConsole(LOG_DEBUG, `Setting ${getPlayerDisplayForConsole(client)}'s skin to ${getGameConfig().skins[getGame()][skinIndex][0]} (Index: ${skinIndex}, Name: ${getGameConfig().skins[getGame()][skinIndex][1]})`);
|
||||
if(getGame() == VRR_GAME_GTA_IV) {
|
||||
triggerNetworkEvent("vrr.localPlayerSkin", client, getGameConfig().skins[getGame()][skinIndex][0]);
|
||||
if (getGame() == VRR_GAME_GTA_IV) {
|
||||
triggerNetworkEvent("agrp.localPlayerSkin", client, getGameConfig().skins[getGame()][skinIndex][0]);
|
||||
} else {
|
||||
getPlayerPed(client).modelIndex = getGameConfig().skins[getGame()][skinIndex][0];
|
||||
}
|
||||
@@ -292,7 +292,7 @@ function setPlayerArmour(client, armour) {
|
||||
// ===========================================================================
|
||||
|
||||
function getPlayerArmour(client) {
|
||||
if(areServerElementsSupported(client)) {
|
||||
if (areServerElementsSupported(client)) {
|
||||
return getPlayerPed(client).armour;
|
||||
} else {
|
||||
return getPlayerData(client).syncArmour;
|
||||
@@ -302,11 +302,11 @@ function getPlayerArmour(client) {
|
||||
// ===========================================================================
|
||||
|
||||
function setPlayerCash(client, amount) {
|
||||
if(client == null) {
|
||||
if (client == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if(isNaN(amount)) {
|
||||
if (isNaN(amount)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -317,11 +317,11 @@ function setPlayerCash(client, amount) {
|
||||
// ===========================================================================
|
||||
|
||||
function givePlayerCash(client, amount) {
|
||||
if(client == null) {
|
||||
if (client == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if(isNaN(amount)) {
|
||||
if (isNaN(amount)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -332,11 +332,11 @@ function givePlayerCash(client, amount) {
|
||||
// ===========================================================================
|
||||
|
||||
function takePlayerCash(client, amount) {
|
||||
if(client == null) {
|
||||
if (client == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if(isNaN(amount)) {
|
||||
if (isNaN(amount)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -368,7 +368,7 @@ function getPlayerWeaponAmmo(client) {
|
||||
|
||||
function setPlayerVelocity(client, velocity) {
|
||||
logToConsole(LOG_DEBUG, `Setting ${getPlayerDisplayForConsole(client)}'s velocity to ${velocity.x}, ${velocity.y}, ${velocity.z}`);
|
||||
if(typeof getPlayerPed(client).velocity != "undefined") {
|
||||
if (typeof getPlayerPed(client).velocity != "undefined") {
|
||||
getPlayerPed(client).velocity = velocity;
|
||||
}
|
||||
}
|
||||
@@ -376,7 +376,7 @@ function setPlayerVelocity(client, velocity) {
|
||||
// ===========================================================================
|
||||
|
||||
function getPlayerVelocity(client) {
|
||||
if(typeof getPlayerPed(client).velocity != "undefined") {
|
||||
if (typeof getPlayerPed(client).velocity != "undefined") {
|
||||
return getPlayerPed(client).velocity;
|
||||
}
|
||||
return toVector3(0.0, 0.0, 0.0);
|
||||
@@ -385,7 +385,7 @@ function getPlayerVelocity(client) {
|
||||
// ===========================================================================
|
||||
|
||||
function getElementDimension(element) {
|
||||
if(typeof element.dimension != "undefined") {
|
||||
if (typeof element.dimension != "undefined") {
|
||||
return element.dimension;
|
||||
}
|
||||
return 0;
|
||||
@@ -394,7 +394,7 @@ function getElementDimension(element) {
|
||||
// ===========================================================================
|
||||
|
||||
function setElementDimension(element, dimension) {
|
||||
if(typeof element.dimension != "undefined") {
|
||||
if (typeof element.dimension != "undefined") {
|
||||
logToConsole(LOG_VERBOSE, `Setting element ${element} (${element.id}) dimension to ${dimension}`);
|
||||
element.dimension = dimension;
|
||||
return true;
|
||||
@@ -405,7 +405,7 @@ function setElementDimension(element, dimension) {
|
||||
// ===========================================================================
|
||||
|
||||
function setElementRotation(element, rotation) {
|
||||
if(typeof element.setRotation != "undefined") {
|
||||
if (typeof element.setRotation != "undefined") {
|
||||
element.setRotation(rotation);
|
||||
} else {
|
||||
return element.rotation = rotation;
|
||||
@@ -415,24 +415,24 @@ function setElementRotation(element, rotation) {
|
||||
// ===========================================================================
|
||||
|
||||
function givePlayerHealth(client, amount) {
|
||||
if(getPlayerHealth(client)+amount > 100) {
|
||||
if (getPlayerHealth(client) + amount > 100) {
|
||||
logToConsole(LOG_DEBUG, `Setting ${getPlayerDisplayForConsole(client)}'s health to 100`);
|
||||
setPlayerHealth(client, 100);
|
||||
} else {
|
||||
logToConsole(LOG_DEBUG, `Setting ${getPlayerDisplayForConsole(client)}'s health to ${getPlayerHealth(client)+amount}`);
|
||||
setPlayerHealth(client, getPlayerHealth(client)+amount);
|
||||
logToConsole(LOG_DEBUG, `Setting ${getPlayerDisplayForConsole(client)}'s health to ${getPlayerHealth(client) + amount}`);
|
||||
setPlayerHealth(client, getPlayerHealth(client) + amount);
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function givePlayerArmour(client, amount) {
|
||||
if(getPlayerArmour(client)+amount > 100) {
|
||||
if (getPlayerArmour(client) + amount > 100) {
|
||||
logToConsole(LOG_DEBUG, `Setting ${getPlayerDisplayForConsole(client)}'s armour to 100`);
|
||||
setPlayerArmour(client, 100);
|
||||
} else {
|
||||
logToConsole(LOG_DEBUG, `Setting ${getPlayerDisplayForConsole(client)}'s armour to ${getPlayerArmour(client)+amount}`);
|
||||
setPlayerArmour(client, getPlayerArmour(client)+amount);
|
||||
logToConsole(LOG_DEBUG, `Setting ${getPlayerDisplayForConsole(client)}'s armour to ${getPlayerArmour(client) + amount}`);
|
||||
setPlayerArmour(client, getPlayerArmour(client) + amount);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -469,7 +469,7 @@ function getServerName() {
|
||||
// ===========================================================================
|
||||
|
||||
function createGamePickup(modelIndex, position, type) {
|
||||
if(!isGameFeatureSupported("pickups")) {
|
||||
if (!isGameFeatureSupported("pickups")) {
|
||||
return false;
|
||||
}
|
||||
return game.createPickup(modelIndex, position, type);
|
||||
@@ -478,7 +478,7 @@ function createGamePickup(modelIndex, position, type) {
|
||||
// ===========================================================================
|
||||
|
||||
function createGameBlip(position, type = 0, colour = toColour(255, 255, 255, 255)) {
|
||||
if(!isGameFeatureSupported("blips")) {
|
||||
if (!isGameFeatureSupported("blips")) {
|
||||
return false;
|
||||
}
|
||||
return game.createBlip(type, position, 1, colour);
|
||||
@@ -487,7 +487,7 @@ function createGameBlip(position, type = 0, colour = toColour(255, 255, 255, 255
|
||||
// ===========================================================================
|
||||
|
||||
function createGameObject(modelIndex, position) {
|
||||
if(!isGameFeatureSupported("objects")) {
|
||||
if (!isGameFeatureSupported("objects")) {
|
||||
return false;
|
||||
}
|
||||
return game.createObject(getGameConfig().objects[getGame()][modelIndex][0], position);
|
||||
@@ -496,13 +496,13 @@ function createGameObject(modelIndex, position) {
|
||||
// ===========================================================================
|
||||
|
||||
function setElementOnAllDimensions(element, state) {
|
||||
if(!isNull(element) && element != false) {
|
||||
if(typeof element.netFlags != "undefined") {
|
||||
if(typeof element.netFlags.onAllDimensions != "undefined") {
|
||||
if (!isNull(element) && element != false) {
|
||||
if (typeof element.netFlags != "undefined") {
|
||||
if (typeof element.netFlags.onAllDimensions != "undefined") {
|
||||
element.netFlags.onAllDimensions = state;
|
||||
}
|
||||
} else {
|
||||
if(typeof element.onAllDimensions != "undefined") {
|
||||
if (typeof element.onAllDimensions != "undefined") {
|
||||
element.onAllDimensions = state;
|
||||
}
|
||||
}
|
||||
@@ -512,7 +512,7 @@ function setElementOnAllDimensions(element, state) {
|
||||
// ===========================================================================
|
||||
|
||||
function destroyGameElement(element) {
|
||||
if(!isNull(element) && element != false) {
|
||||
if (!isNull(element) && element != false) {
|
||||
destroyElement(element);
|
||||
}
|
||||
}
|
||||
@@ -532,7 +532,7 @@ function getPlayerLastVehicle(client) {
|
||||
// ===========================================================================
|
||||
|
||||
function isVehicleObject(vehicle) {
|
||||
if(vehicle == null || vehicle == undefined) {
|
||||
if (vehicle == null || vehicle == undefined) {
|
||||
return false;
|
||||
}
|
||||
return (vehicle.type == ELEMENT_VEHICLE);
|
||||
@@ -547,15 +547,15 @@ function repairVehicle(vehicle) {
|
||||
// ===========================================================================
|
||||
|
||||
function setVehicleLights(vehicle, lights) {
|
||||
setEntityData(vehicle, "vrr.lights", lights, true);
|
||||
sendNetworkEventToPlayer("vrr.veh.lights", null, vehicle.id, lights);
|
||||
setEntityData(vehicle, "agrp.lights", lights, true);
|
||||
sendNetworkEventToPlayer("agrp.veh.lights", null, vehicle.id, lights);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function setVehicleEngine(vehicle, engine) {
|
||||
vehicle.engine = engine;
|
||||
setEntityData(vehicle, "vrr.engine", engine, true);
|
||||
setEntityData(vehicle, "agrp.engine", engine, true);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -600,11 +600,11 @@ function setVehicleColours(vehicle, colour1, colour2, colour3 = -1, colour4 = -1
|
||||
vehicle.colour1 = colour1;
|
||||
vehicle.colour2 = colour2;
|
||||
|
||||
if(colour3 != -1) {
|
||||
if (colour3 != -1) {
|
||||
vehicle.colour3 = colour3;
|
||||
}
|
||||
|
||||
if(colour4 != -1) {
|
||||
if (colour4 != -1) {
|
||||
vehicle.colour4 = colour4;
|
||||
}
|
||||
}
|
||||
@@ -612,7 +612,7 @@ function setVehicleColours(vehicle, colour1, colour2, colour3 = -1, colour4 = -1
|
||||
// ===========================================================================
|
||||
|
||||
function createGameVehicle(modelIndex, position, heading) {
|
||||
if(areServerElementsSupported()) {
|
||||
if (areServerElementsSupported()) {
|
||||
return mp.vehicles.new(getGameConfig().vehicles[getGame()][modelIndex][0], position, {
|
||||
heading: heading,
|
||||
numberPlate: "",
|
||||
@@ -628,7 +628,7 @@ function createGameVehicle(modelIndex, position, heading) {
|
||||
// ===========================================================================
|
||||
|
||||
function createGameCivilian(modelIndex, position, heading) {
|
||||
if(areServerElementsSupported()) {
|
||||
if (areServerElementsSupported()) {
|
||||
return mp.peds.new(getGameConfig().skins[getGame()][modelIndex][1], position, heading, 0);
|
||||
}
|
||||
|
||||
@@ -644,7 +644,7 @@ function getIsland(position) {
|
||||
// ===========================================================================
|
||||
|
||||
function isValidVehicleModel(model) {
|
||||
if(getVehicleModelIndexFromModel(model) != false) {
|
||||
if (getVehicleModelIndexFromModel(model) != false) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -654,7 +654,7 @@ function isValidVehicleModel(model) {
|
||||
// ===========================================================================
|
||||
|
||||
function setGameTime(hour, minute, minuteDuration = 1000) {
|
||||
if(isTimeSupported()) {
|
||||
if (isTimeSupported()) {
|
||||
game.time.hour = hour;
|
||||
game.time.minute = minute;
|
||||
game.time.minuteDuration = minuteDuration;
|
||||
@@ -664,7 +664,7 @@ function setGameTime(hour, minute, minuteDuration = 1000) {
|
||||
// ===========================================================================
|
||||
|
||||
function setGameWeather(weather) {
|
||||
if(isWeatherSupported()) {
|
||||
if (isWeatherSupported()) {
|
||||
mp.world.weather = weather;
|
||||
}
|
||||
}
|
||||
@@ -690,7 +690,7 @@ function getPlayerElement(client) {
|
||||
// ===========================================================================
|
||||
|
||||
function setElementPosition(element, position) {
|
||||
sendNetworkEventToPlayer("vrr.elementPosition", null, element.id, position);
|
||||
sendNetworkEventToPlayer("agrp.elementPosition", null, element.id, position);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -714,13 +714,13 @@ function setElementInterior(element, interior) {
|
||||
// ===========================================================================
|
||||
|
||||
function setElementCollisionsEnabled(element, state) {
|
||||
//sendNetworkEventToPlayer("vrr.elementCollisions", null, element.id, state);
|
||||
//sendNetworkEventToPlayer("agrp.elementCollisions", null, element.id, state);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function isTaxiVehicle(vehicle) {
|
||||
if(getGameConfig().taxiModels[getGame()].indexOf(vehicle.modelIndex) != -1) {
|
||||
if (getGameConfig().taxiModels[getGame()].indexOf(vehicle.modelIndex) != -1) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -737,7 +737,7 @@ function getVehicleName(vehicle) {
|
||||
// ===========================================================================
|
||||
|
||||
function getElementModel(element) {
|
||||
if(typeof element.model != "undefined") {
|
||||
if (typeof element.model != "undefined") {
|
||||
return element.model;
|
||||
}
|
||||
}
|
||||
@@ -757,11 +757,11 @@ function getPlayerWeapon(client) {
|
||||
// ===========================================================================
|
||||
|
||||
function connectToDatabase() {
|
||||
if(getDatabaseConfig().usePersistentConnection) {
|
||||
if(persistentDatabaseConnection == null) {
|
||||
if (getDatabaseConfig().usePersistentConnection) {
|
||||
if (persistentDatabaseConnection == null) {
|
||||
logToConsole(LOG_DEBUG, `[VRR.Database] Initializing database connection ...`);
|
||||
persistentDatabaseConnection = module.mysql.connect(getDatabaseConfig().host, getDatabaseConfig().user, getDatabaseConfig().pass, getDatabaseConfig().name, getDatabaseConfig().port);
|
||||
if(persistentDatabaseConnection.error) {
|
||||
if (persistentDatabaseConnection.error) {
|
||||
logToConsole(LOG_ERROR, `[VRR.Database] Database connection error: ${persistentDatabaseConnection.error}`);
|
||||
persistentDatabaseConnection = null;
|
||||
return false;
|
||||
@@ -775,7 +775,7 @@ function connectToDatabase() {
|
||||
}
|
||||
} else {
|
||||
let databaseConnection = module.mysql.connect(getDatabaseConfig().host, getDatabaseConfig().user, getDatabaseConfig().pass, getDatabaseConfig().name, getDatabaseConfig().port);
|
||||
if(databaseConnection.error) {
|
||||
if (databaseConnection.error) {
|
||||
logToConsole(LOG_ERROR, `[VRR.Database] Database connection error: ${persistentDatabaseConnection.error}`);
|
||||
return false;
|
||||
} else {
|
||||
@@ -787,11 +787,11 @@ function connectToDatabase() {
|
||||
// ===========================================================================
|
||||
|
||||
function disconnectFromDatabase(dbConnection) {
|
||||
if(!getDatabaseConfig().usePersistentConnection) {
|
||||
if (!getDatabaseConfig().usePersistentConnection) {
|
||||
try {
|
||||
dbConnection.close();
|
||||
logToConsole(LOG_DEBUG, `[VRR.Database] Database connection closed successfully`);
|
||||
} catch(error) {
|
||||
} catch (error) {
|
||||
logToConsole(LOG_ERROR, `[VRR.Database] Database connection could not be closed! (Error: ${error})`);
|
||||
}
|
||||
}
|
||||
@@ -802,7 +802,7 @@ function disconnectFromDatabase(dbConnection) {
|
||||
|
||||
function queryDatabase(dbConnection, queryString, useThread = false) {
|
||||
logToConsole(LOG_DEBUG, `[VRR.Database] Query string: ${queryString}`);
|
||||
if(useThread == true) {
|
||||
if (useThread == true) {
|
||||
Promise.resolve().then(() => {
|
||||
let queryResult = dbConnection.query(queryString);
|
||||
return queryResult;
|
||||
@@ -815,11 +815,11 @@ function queryDatabase(dbConnection, queryString, useThread = false) {
|
||||
// ===========================================================================
|
||||
|
||||
function escapeDatabaseString(dbConnection, unsafeString = "") {
|
||||
if(!dbConnection) {
|
||||
if (!dbConnection) {
|
||||
dbConnection = connectToDatabase();
|
||||
}
|
||||
|
||||
if(typeof unsafeString == "string") {
|
||||
if (typeof unsafeString == "string") {
|
||||
return dbConnection.escapeString(unsafeString);
|
||||
}
|
||||
return unsafeString;
|
||||
@@ -846,7 +846,7 @@ function getDatabaseError(dbConnection) {
|
||||
// ===========================================================================
|
||||
|
||||
function freeDatabaseQuery(dbQuery) {
|
||||
if(dbQuery != null) {
|
||||
if (dbQuery != null) {
|
||||
dbQuery.free();
|
||||
}
|
||||
return;
|
||||
@@ -863,26 +863,26 @@ function fetchQueryAssoc(dbQuery) {
|
||||
function quickDatabaseQuery(queryString) {
|
||||
let dbConnection = connectToDatabase();
|
||||
let insertId = 0;
|
||||
if(dbConnection) {
|
||||
if (dbConnection) {
|
||||
//logToConsole(LOG_DEBUG, `[VRR.Database] Query string: ${queryString}`);
|
||||
let dbQuery = queryDatabase(dbConnection, queryString);
|
||||
if(getDatabaseInsertId(dbConnection)) {
|
||||
if (getDatabaseInsertId(dbConnection)) {
|
||||
insertId = getDatabaseInsertId(dbConnection);
|
||||
logToConsole(LOG_DEBUG, `[VRR.Database] Query returned insert id ${insertId}`);
|
||||
}
|
||||
|
||||
if(dbQuery) {
|
||||
if (dbQuery) {
|
||||
try {
|
||||
freeDatabaseQuery(dbQuery);
|
||||
logToConsole(LOG_DEBUG, `[VRR.Database] Query result free'd successfully`);
|
||||
} catch(error) {
|
||||
} catch (error) {
|
||||
logToConsole(LOG_ERROR, `[VRR.Database] Query result could not be free'd! (Error: ${error})`);
|
||||
}
|
||||
}
|
||||
|
||||
disconnectFromDatabase(dbConnection);
|
||||
|
||||
if(insertId != 0) {
|
||||
if (insertId != 0) {
|
||||
return insertId;
|
||||
}
|
||||
|
||||
@@ -915,8 +915,8 @@ function getElementId(element) {
|
||||
|
||||
function getClientFromIndex(index) {
|
||||
let clients = getClients();
|
||||
for(let i in clients) {
|
||||
if(clients[i].index == index) {
|
||||
for (let i in clients) {
|
||||
if (clients[i].index == index) {
|
||||
return clients[i];
|
||||
}
|
||||
}
|
||||
@@ -955,7 +955,7 @@ function getClosestCivilian(position) {
|
||||
// ===========================================================================
|
||||
|
||||
function getVehiclesInRange(position, range) {
|
||||
if(getGame() == VRR_GAME_GTA_IV) {
|
||||
if (getGame() == VRR_GAME_GTA_IV) {
|
||||
return getServerData().vehicles.reduce((i, j) => (getDistance(position, i.syncPosition) <= getDistance(position, j.syncPosition)) ? i : j);
|
||||
}
|
||||
return getElementsByTypeInRange(ELEMENT_VEHICLE, position, range);
|
||||
@@ -976,8 +976,8 @@ function getClosestElementByType(elementType, position) {
|
||||
// ===========================================================================
|
||||
|
||||
function getVehicleFirstEmptySeat(vehicle) {
|
||||
for(let i = 0; i <= 4; i++) {
|
||||
if(vehicle.getOccupant(i) == null) {
|
||||
for (let i = 0; i <= 4; i++) {
|
||||
if (vehicle.getOccupant(i) == null) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
@@ -1014,14 +1014,14 @@ function setVehicleHealth(vehicle, health) {
|
||||
|
||||
function givePlayerWeapon(client, weaponId, ammo, active = true) {
|
||||
//logToConsole(LOG_DEBUG, `[VRR.Client] Sending signal to ${getPlayerDisplayForConsole(client)} to give weapon (Weapon: ${weaponId}, Ammo: ${ammo})`);
|
||||
//sendNetworkEventToPlayer("vrr.giveWeapon", client, weaponId, ammo, active);
|
||||
//sendNetworkEventToPlayer("agrp.giveWeapon", client, weaponId, ammo, active);
|
||||
client.giveWeapon(weaponId, ammo);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function setPlayerWantedLevel(client, wantedLevel) {
|
||||
//sendNetworkEventToPlayer("vrr.wantedLevel", client, wantedLevel);
|
||||
//sendNetworkEventToPlayer("agrp.wantedLevel", client, wantedLevel);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1046,9 +1046,9 @@ function getPlayerPed(client) {
|
||||
// ===========================================================================
|
||||
|
||||
function setEntityData(entity, dataName, dataValue, syncToClients = true) {
|
||||
if(entity != null) {
|
||||
if(areServerElementsSupported()) {
|
||||
if(syncToClients) {
|
||||
if (entity != null) {
|
||||
if (areServerElementsSupported()) {
|
||||
if (syncToClients) {
|
||||
return entity.setVariable(dataName, dataValue);
|
||||
} else {
|
||||
return entity.setOwnVariable(dataName, dataValue);
|
||||
@@ -1061,8 +1061,8 @@ function setEntityData(entity, dataName, dataValue, syncToClients = true) {
|
||||
// ===========================================================================
|
||||
|
||||
function removeEntityData(entity, dataName) {
|
||||
if(entity != null) {
|
||||
if(areServerElementsSupported()) {
|
||||
if (entity != null) {
|
||||
if (areServerElementsSupported()) {
|
||||
return entity.setVariable(dataName, null);
|
||||
}
|
||||
}
|
||||
@@ -1072,8 +1072,8 @@ function removeEntityData(entity, dataName) {
|
||||
// ===========================================================================
|
||||
|
||||
function doesEntityDataExist(entity, dataName) {
|
||||
if(entity != null) {
|
||||
if(areServerElementsSupported()) {
|
||||
if (entity != null) {
|
||||
if (areServerElementsSupported()) {
|
||||
return (entity.getVariable(dataName) != null);
|
||||
} else {
|
||||
return false;
|
||||
@@ -1169,7 +1169,7 @@ function serverBanIP(ip) {
|
||||
// ===========================================================================
|
||||
|
||||
function setVehicleTrunkState(vehicle, trunkState) {
|
||||
//sendNetworkEventToPlayer("vrr.veh.trunk", null, getVehicleForNetworkEvent(vehicle), trunkState);
|
||||
//sendNetworkEventToPlayer("agrp.veh.trunk", null, getVehicleForNetworkEvent(vehicle), trunkState);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -1201,7 +1201,7 @@ function addAllEventHandlers() {
|
||||
// ===========================================================================
|
||||
|
||||
function addServerCommandHandler(command, handlerFunction) {
|
||||
mp.events.addCommand(command, function(client, ...args) {
|
||||
mp.events.addCommand(command, function (client, ...args) {
|
||||
handlerFunction.call(command, args.join(" "), client);
|
||||
});
|
||||
}
|
||||
@@ -1209,7 +1209,7 @@ function addServerCommandHandler(command, handlerFunction) {
|
||||
// ===========================================================================
|
||||
|
||||
function addServerEventHandler(eventName, handlerFunction) {
|
||||
mp.events.add(eventName, function(event, ...args) {
|
||||
mp.events.add(eventName, function (event, ...args) {
|
||||
let result = handlerFunction.apply(this, args);
|
||||
});
|
||||
}
|
||||
@@ -1217,7 +1217,7 @@ function addServerEventHandler(eventName, handlerFunction) {
|
||||
// ===========================================================================
|
||||
|
||||
function bindServerEventHandler(eventName, bindTo, handlerFunction) {
|
||||
mp.events.add(eventName, function(event, ...args) {
|
||||
mp.events.add(eventName, function (event, ...args) {
|
||||
let result = handlerFunction.apply(this, args);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -7,6 +7,198 @@
|
||||
// TYPE: Server (JavaScript)
|
||||
// ===========================================================================
|
||||
|
||||
// NPC Trigger Condition Match Types
|
||||
const VRR_NPC_COND_MATCH_NONE = 0; // None (invalid)
|
||||
const VRR_NPC_COND_MATCH_EQ = 1; // Must be equal to
|
||||
const VRR_NPC_COND_MATCH_GT = 2; // Must be greater than
|
||||
const VRR_NPC_COND_MATCH_LT = 3; // Must be less than
|
||||
const VRR_NPC_COND_MATCH_GTEQ = 4; // Must be greater than or equal to
|
||||
const VRR_NPC_COND_MATCH_LTEQ = 5; // Must be less than or equal to
|
||||
const VRR_NPC_COND_MATCH_CONTAINS = 6; // Must contain string (case insensitive)
|
||||
const VRR_NPC_COND_MATCH_CONTAINS_CASE = 7; // Must contain string (case sensitive)
|
||||
const VRR_NPC_COND_MATCH_EXACT = 8; // Must match string exactly (case insensitive)
|
||||
const VRR_NPC_COND_MATCH_EXACT_CASE = 9; // Must match string exactly (case insensitive)
|
||||
|
||||
// NPC Owner Types
|
||||
const VRR_NPC_OWNER_NONE = 0; // Not owned
|
||||
const VRR_NPC_OWNER_PLAYER = 1; // Owned by a player (character/subaccount)
|
||||
const VRR_NPC_OWNER_JOB = 2; // Owned by a job
|
||||
const VRR_NPC_OWNER_CLAN = 3; // Owned by a clan
|
||||
const VRR_NPC_OWNER_FACTION = 4; // Owned by a faction (not used at the moment)
|
||||
const VRR_NPC_OWNER_PUBLIC = 5; // Public NPC. Anybody can do stuff with it.
|
||||
const VRR_NPC_OWNER_BIZ = 6; // Owned by a business
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
class NPCData {
|
||||
constructor(dbAssoc = false) {
|
||||
this.databaseId = 0;
|
||||
this.serverId = 0;
|
||||
this.name = "NPC";
|
||||
this.skin = 0;
|
||||
this.cash = 0;
|
||||
this.position = toVector3(0.0, 0.0, 0.0);
|
||||
this.rotation = toVector3(0.0, 0.0, 0.0);
|
||||
this.scale = toVector3(1.0, 1.0, 1.0);
|
||||
this.heading = 0.0;
|
||||
this.clan = 0;
|
||||
this.isWorking = false;
|
||||
this.jobUniform = this.skin;
|
||||
this.lastJobVehicle = null;
|
||||
this.job = 0;
|
||||
this.weapons = [];
|
||||
this.interior = 0;
|
||||
this.dimension = 0;
|
||||
this.walkStyle = 0;
|
||||
this.fightStyle = 0;
|
||||
this.health = 100;
|
||||
this.armour = 100;
|
||||
this.currentAction = VRR_NPC_ACTION_NONE;
|
||||
this.triggers = [];
|
||||
this.typeFlags = 0;
|
||||
this.heedThreats = false;
|
||||
this.threats = 0;
|
||||
this.invincible = false;
|
||||
this.animationName = "";
|
||||
this.ownerType = VRR_NPC_OWNER_NONE;
|
||||
this.ownerId = 0;
|
||||
|
||||
this.bodyParts = {
|
||||
hair: [0, 0],
|
||||
head: [0, 0],
|
||||
upper: [0, 0],
|
||||
lower: [0, 0],
|
||||
};
|
||||
|
||||
this.bodyProps = {
|
||||
hair: [0, 0],
|
||||
eyes: [0, 0],
|
||||
head: [0, 0],
|
||||
leftHand: [0, 0],
|
||||
rightHand: [0, 0],
|
||||
leftWrist: [0, 0],
|
||||
rightWrist: [0, 0],
|
||||
hip: [0, 0],
|
||||
leftFoot: [0, 0],
|
||||
rightFoot: [0, 0],
|
||||
};
|
||||
|
||||
this.triggers = [];
|
||||
|
||||
if (dbAssoc) {
|
||||
this.databaseId = toInteger(dbAssoc["npc_id"]);
|
||||
this.serverId = toInteger(dbAssoc["npc_server"]);
|
||||
this.name = dbAssoc["npc_name"];
|
||||
this.skin = toInteger(dbAssoc["npc_skin"]);
|
||||
this.cash = toInteger(dbAssoc["npc_cash"]);
|
||||
this.position = toVector3(toFloat(dbAssoc["npc_pos_x"]), toFloat(dbAssoc["npc_pos_y"]), toFloat(dbAssoc["npc_pos_z"]));
|
||||
this.rotation = toVector3(toFloat(dbAssoc["npc_rot_x"]), toFloat(dbAssoc["npc_rot_y"]), toFloat(dbAssoc["npc_rot_z"]));
|
||||
this.scale = toVector3(toFloat(dbAssoc["npc_scale_x"]), toFloat(dbAssoc["npc_scale_y"]), toFloat(dbAssoc["npc_scale_z"]));
|
||||
this.heading = toFloat(dbAssoc["npc_rot_z"]);
|
||||
this.lastLogin = toInteger(dbAssoc["npc_when_lastlogin"]);
|
||||
this.rank = toInteger(dbAssoc["npc_rank"]);
|
||||
this.title = toInteger(dbAssoc["npc_title"]);
|
||||
this.job = toInteger(dbAssoc["npc_job"]);
|
||||
this.interior = toInteger(dbAssoc["npc_int"]);
|
||||
this.dimension = toInteger(dbAssoc["npc_vw"]);
|
||||
this.walkStyle = toInteger(dbAssoc["npc_walkstyle"]);
|
||||
this.fightStyle = toInteger(dbAssoc["npc_fightstyle"]);
|
||||
this.health = toInteger(dbAssoc["npc_health"]);
|
||||
this.armour = toInteger(dbAssoc["npc_armour"]);
|
||||
this.typeFlags = toInteger(dbAssoc["npc_type_flags"]);
|
||||
this.heedThreats = intToBool(dbAssoc["npc_headthreats"]);
|
||||
this.threats = toInteger(dbAssoc["npc_threats"]);
|
||||
this.invincible = intToBool(dbAssoc["npc_invincible"]);
|
||||
this.animationName = intToBool(dbAssoc["npc_animation"]);
|
||||
|
||||
this.bodyParts = {
|
||||
hair: [toInteger(dbAssoc["npc_hd_part_hair_model"]) || 0, toInteger(dbAssoc["npc_hd_part_hair_texture"]) || 0],
|
||||
head: [toInteger(dbAssoc["npc_hd_part_head_model"]) || 0, toInteger(dbAssoc["npc_hd_part_head_texture"]) || 0],
|
||||
upper: [toInteger(dbAssoc["npc_hd_part_upper_model"]) || 0, toInteger(dbAssoc["npc_hd_part_upper_texture"]) || 0],
|
||||
lower: [toInteger(dbAssoc["npc_hd_part_lower_model"]) || 0, toInteger(dbAssoc["npc_hd_part_lower_texture"]) || 0],
|
||||
};
|
||||
|
||||
this.bodyProps = {
|
||||
hair: [toInteger(dbAssoc["npc_hd_prop_hair_model"]) || 0, toInteger(dbAssoc["npc_hd_prop_hair_texture"]) || 0],
|
||||
eyes: [toInteger(dbAssoc["npc_hd_prop_eyes_model"]) || 0, toInteger(dbAssoc["npc_hd_prop_eyes_texture"]) || 0],
|
||||
head: [toInteger(dbAssoc["npc_hd_prop_head_model"]) || 0, toInteger(dbAssoc["npc_hd_prop_head_texture"]) || 0],
|
||||
leftHand: [toInteger(dbAssoc["npc_hd_prop_lefthand_model"]) || 0, toInteger(dbAssoc["npc_hd_prop_lefthand_texture"]) || 0],
|
||||
rightHand: [toInteger(dbAssoc["npc_hd_prop_righthand_model"]) || 0, toInteger(dbAssoc["npc_hd_prop_righthand_texture"]) || 0],
|
||||
leftWrist: [toInteger(dbAssoc["npc_hd_prop_leftwrist_model"]) || 0, toInteger(dbAssoc["npc_hd_prop_leftwrist_texture"]) || 0],
|
||||
rightWrist: [toInteger(dbAssoc["npc_hd_prop_rightwrist_model"]) || 0, toInteger(dbAssoc["npc_hd_prop_rightwrist_texture"]) || 0],
|
||||
hip: [toInteger(dbAssoc["npc_hd_prop_hip_model"]) || 0, toInteger(dbAssoc["npc_hd_prop_hip_texture"]) || 0],
|
||||
leftFoot: [toInteger(dbAssoc["npc_hd_prop_leftfoot_model"]) || 0, toInteger(dbAssoc["npc_hd_prop_leftfoot_texture"]) || 0],
|
||||
rightFoot: [toInteger(dbAssoc["npc_hd_prop_rightfoot_model"]) || 0, toInteger(dbAssoc["npc_hd_prop_rightfoot_texture"]) || 0],
|
||||
};
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
class NPCTriggerData {
|
||||
constructor(dbAssoc = false) {
|
||||
this.databaseId = 0;
|
||||
this.npcId = 0;
|
||||
this.index = 0;
|
||||
this.npc = 0;
|
||||
this.npcIndex = -1;
|
||||
this.triggerType = 0;
|
||||
this.conditions = [];
|
||||
this.responses = [];
|
||||
|
||||
if (dbAssoc) {
|
||||
this.databaseId = toInteger(dbAssoc["npc_trig_id"]);
|
||||
this.npc = toInteger(dbAssoc["npc_trig_npc"]);
|
||||
this.triggerType = toInteger(dbAssoc["npc_trig_type"]);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
class NPCTriggerConditionData {
|
||||
constructor(dbAssoc = false) {
|
||||
this.databaseId = 0;
|
||||
this.triggerId = 0;
|
||||
this.index = 0;
|
||||
this.triggerIndex = 0;
|
||||
this.conditionType = 0;
|
||||
this.conditionValue = false;
|
||||
this.matchType = false;
|
||||
|
||||
if (dbAssoc) {
|
||||
this.databaseId = toInteger(dbAssoc["npc_trig_cond_id"]);
|
||||
this.npc = toInteger(dbAssoc["npc_trig_cond_trig"]);
|
||||
this.conditionType = toInteger(dbAssoc["npc_trig_cond_type"]);
|
||||
this.conditionValue = toInteger(dbAssoc["npc_trig_cond_val"]);
|
||||
this.matchType = toInteger(dbAssoc["npc_trig_cond_val"]);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
class NPCTriggerResponseData {
|
||||
constructor(dbAssoc = false) {
|
||||
this.databaseId = 0;
|
||||
this.triggerId = 0;
|
||||
this.index = 0;
|
||||
this.triggerIndex = 0;
|
||||
this.responseType = 0;
|
||||
this.responseValue = false;
|
||||
|
||||
if (dbAssoc) {
|
||||
this.databaseId = toInteger(dbAssoc["npc_trig_resp_id"]);
|
||||
this.npc = toInteger(dbAssoc["npc_trig_resp_trig"]);
|
||||
this.responseType = toInteger(dbAssoc["npc_trig_resp_type"]);
|
||||
this.responseValue = toInteger(dbAssoc["npc_trig_resp_val"]);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function initNPCScript() {
|
||||
logToConsole(LOG_INFO, "[VRR.NPC]: Initializing NPC script ...");
|
||||
logToConsole(LOG_INFO, "[VRR.NPC]: NPC script initialized successfully!");
|
||||
@@ -274,11 +466,11 @@ function spawnNPC(npcIndex) {
|
||||
let ped = createGamePed(npcData.skin, npcData.position, npcData.rotation.z);
|
||||
if (ped) {
|
||||
getNPCData(npcIndex).ped = ped;
|
||||
setEntityData(ped, "vrr.dataIndex", npcIndex, false);
|
||||
setEntityData(ped, "agrp.dataIndex", npcIndex, false);
|
||||
if (npcData.animationName != "") {
|
||||
let animationId = getAnimationFromParams(npcData.animationName);
|
||||
if (animationId != false) {
|
||||
setEntityData(ped, "vrr.anim", animationId, true);
|
||||
setEntityData(ped, "agrp.anim", animationId, true);
|
||||
}
|
||||
}
|
||||
setElementDimension(ped, npcData.dimension);
|
||||
@@ -398,7 +590,7 @@ function toggleNPCLookAtClosestPlayerCommand(command, params, client) {
|
||||
|
||||
getNPCData(closestNPC).lookAtClosestPlayer = !getNPCData(closestNPC).lookAtClosestPlayer;
|
||||
getNPCData(closestNPC).needsSaved = true;
|
||||
setEntityData(getNPCData(closestNPC).ped, "vrr.lookAtClosestPlayer", getNPCData(closestNPC).lookAtClosestPlayer, true);
|
||||
setEntityData(getNPCData(closestNPC).ped, "agrp.lookAtClosestPlayer", getNPCData(closestNPC).lookAtClosestPlayer, true);
|
||||
forcePlayerToSyncElementProperties(null, getNPCData(closestNPC).ped);
|
||||
//messagePlayerSuccess(client, getLocaleString(client, "NPCLookAtClosestPlayerSet", `{ALTCOLOUR}${getNPCData(closestNPC).name}{MAINCOLOUR}));
|
||||
}
|
||||
@@ -423,28 +615,28 @@ function getNPCInfoCommand(command, params, client) {
|
||||
let ownerName = "Nobody";
|
||||
let ownerType = "None";
|
||||
switch (npcData.ownerType) {
|
||||
case VRR_NPCOWNER_CLAN:
|
||||
case VRR_NPC_OWNER_CLAN:
|
||||
ownerName = getClanData(getClanIdFromDatabaseId(npcData.ownerId)).name;
|
||||
ownerType = "clan";
|
||||
break;
|
||||
|
||||
case VRR_NPCOWNER_JOB:
|
||||
case VRR_NPC_OWNER_JOB:
|
||||
ownerName = getJobData(getJobIdFromDatabaseId(npcData.ownerId)).name;
|
||||
ownerType = "job";
|
||||
break;
|
||||
|
||||
case VRR_NPCOWNER_PLAYER:
|
||||
case VRR_NPC_OWNER_PLAYER:
|
||||
let subAccountData = loadSubAccountFromId(npcData.ownerId);
|
||||
ownerName = `${subAccountData.firstName} ${subAccountData.lastName} [${subAccountData.databaseId}]`;
|
||||
ownerType = "player";
|
||||
break;
|
||||
|
||||
case VRR_NPCOWNER_BIZ:
|
||||
case VRR_NPC_OWNER_BIZ:
|
||||
ownerName = getBusinessData(getBusinessIdFromDatabaseId(npcData.ownerId)).name;
|
||||
ownerType = "business";
|
||||
break;
|
||||
|
||||
case VRR_NPCOWNER_PUBLIC:
|
||||
case VRR_NPC_OWNER_PUBLIC:
|
||||
ownerName = "Nobody";
|
||||
ownerType = "public";
|
||||
break;
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
// ===========================================================================
|
||||
// Vortrex's Roleplay Resource
|
||||
// https://github.com/VortrexFTW/gtac_roleplay
|
||||
// ===========================================================================
|
||||
// FILE: biker.js
|
||||
// DESC: Provides biker NPC interaction and functionality
|
||||
// TYPE: Server (JavaScript)
|
||||
// ===========================================================================
|
||||
@@ -1,8 +0,0 @@
|
||||
// ===========================================================================
|
||||
// Vortrex's Roleplay Resource
|
||||
// https://github.com/VortrexFTW/gtac_roleplay
|
||||
// ===========================================================================
|
||||
// FILE: drugdealer.js
|
||||
// DESC: Provides drug dealer NPC interaction and functionality
|
||||
// TYPE: Server (JavaScript)
|
||||
// ===========================================================================
|
||||
@@ -1,8 +0,0 @@
|
||||
// ===========================================================================
|
||||
// Vortrex's Roleplay Resource
|
||||
// https://github.com/VortrexFTW/gtac_roleplay
|
||||
// ===========================================================================
|
||||
// FILE: firefighter.js
|
||||
// DESC: Provides firefighter NPC interaction and functionality
|
||||
// TYPE: Server (JavaScript)
|
||||
// ===========================================================================
|
||||
@@ -1,8 +0,0 @@
|
||||
// ===========================================================================
|
||||
// Vortrex's Roleplay Resource
|
||||
// https://github.com/VortrexFTW/gtac_roleplay
|
||||
// ===========================================================================
|
||||
// FILE: gangsta.js
|
||||
// DESC: Provides street gang/hoodlum NPC interaction and functionality
|
||||
// TYPE: Server (JavaScript)
|
||||
// ===========================================================================
|
||||
@@ -1,8 +0,0 @@
|
||||
// ===========================================================================
|
||||
// Vortrex's Roleplay Resource
|
||||
// https://github.com/VortrexFTW/gtac_roleplay
|
||||
// ===========================================================================
|
||||
// FILE: mafia.js
|
||||
// DESC: Provides mafia/mafioso NPC interaction and functionality
|
||||
// TYPE: Server (JavaScript)
|
||||
// ===========================================================================
|
||||
@@ -1,8 +0,0 @@
|
||||
// ===========================================================================
|
||||
// Vortrex's Roleplay Resource
|
||||
// https://github.com/VortrexFTW/gtac_roleplay
|
||||
// ===========================================================================
|
||||
// FILE: normal.js
|
||||
// DESC: Provides normal/generic civilian NPC interaction and functionality
|
||||
// TYPE: Server (JavaScript)
|
||||
// ===========================================================================
|
||||
@@ -1,8 +0,0 @@
|
||||
// ===========================================================================
|
||||
// Vortrex's Roleplay Resource
|
||||
// https://github.com/VortrexFTW/gtac_roleplay
|
||||
// ===========================================================================
|
||||
// FILE: paramedic.js
|
||||
// DESC: Provides paramedic NPC interaction and functionality
|
||||
// TYPE: Server (JavaScript)
|
||||
// ===========================================================================
|
||||
@@ -1,8 +0,0 @@
|
||||
// ===========================================================================
|
||||
// Vortrex's Roleplay Resource
|
||||
// https://github.com/VortrexFTW/gtac_roleplay
|
||||
// ===========================================================================
|
||||
// FILE: police.js
|
||||
// DESC: Provides police officer NPC interaction and functionality
|
||||
// TYPE: Server (JavaScript)
|
||||
// ===========================================================================
|
||||
@@ -1,28 +0,0 @@
|
||||
// ===========================================================================
|
||||
// Vortrex's Roleplay Resource
|
||||
// https://github.com/VortrexFTW/gtac_roleplay
|
||||
// ===========================================================================
|
||||
// FILE: taxi.js
|
||||
// DESC: Provides taxi driver NPC interaction and functionality
|
||||
// TYPE: Server (JavaScript)
|
||||
// ===========================================================================
|
||||
|
||||
function attemptToSignalToNearbyTaxi(client) {
|
||||
if(!isPlayerLoggedIn(client)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!isPlayerSpawned(client)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
let nearbyTaxis = getElementsByType(ELEMENT_VEHICLE).filter((v) > getPlayerPosition(client).distance(v.position) <= 15 && isTaxiVehicle(v));
|
||||
|
||||
let closestTaxi = nearbyTaxis.reduce((i, j) => (i.position.distance(pos) < j.position.distance(pos)) ? i : j);
|
||||
if(!closestTaxi.getOccupant(0).isType(ELEMENT_PLAYER)) {
|
||||
setVehicleCruiseSpeed(closestTaxi, 0.0);
|
||||
setVehicleLocked(closestTaxi, false);
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -7,6 +7,27 @@
|
||||
// TYPE: Server (JavaScript)
|
||||
// ===========================================================================
|
||||
|
||||
class RadioStationData {
|
||||
constructor(dbAssoc = false) {
|
||||
this.databaseId = 0;
|
||||
this.name = "";
|
||||
this.url = "";
|
||||
this.genre = "";
|
||||
this.codec = "";
|
||||
this.index = -1;
|
||||
|
||||
if (dbAssoc) {
|
||||
this.databaseId = dbAssoc["radio_id"];
|
||||
this.name = dbAssoc["radio_name"];
|
||||
this.url = dbAssoc["radio_url"];
|
||||
this.genre = dbAssoc["radio_genre"];
|
||||
this.codec = dbAssoc["radio_codec"];
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function initRadioScript() {
|
||||
logToConsole(LOG_INFO, "[VRR.Radio]: Initializing radio script ...");
|
||||
logToConsole(LOG_INFO, "[VRR.Radio]: Radio script initialized successfully!");
|
||||
@@ -20,11 +41,11 @@ function loadRadioStationsFromDatabase() {
|
||||
let dbConnection = connectToDatabase();
|
||||
let tempRadioStations = [];
|
||||
let dbAssoc;
|
||||
if(dbConnection) {
|
||||
if (dbConnection) {
|
||||
let dbQueryString = `SELECT * FROM radio_main`;
|
||||
let dbQuery = queryDatabase(dbConnection, dbQueryString);
|
||||
if(dbQuery) {
|
||||
while(dbAssoc = fetchQueryAssoc(dbQuery)) {
|
||||
if (dbQuery) {
|
||||
while (dbAssoc = fetchQueryAssoc(dbQuery)) {
|
||||
let tempRadioStationData = new RadioStationData(dbAssoc);
|
||||
tempRadioStations.push(tempRadioStationData);
|
||||
}
|
||||
@@ -49,7 +70,7 @@ function loadRadioStationsFromDatabase() {
|
||||
*
|
||||
*/
|
||||
function playStreamingRadioCommand(command, params, client) {
|
||||
if(areParamsEmpty(params)) {
|
||||
if (areParamsEmpty(params)) {
|
||||
messagePlayerSyntax(client, getCommandSyntaxText(command));
|
||||
messagePlayerInfo(client, "Use /radiostations for a list of available radio stations.");
|
||||
return false;
|
||||
@@ -57,96 +78,96 @@ function playStreamingRadioCommand(command, params, client) {
|
||||
|
||||
let radioStationId = getRadioStationFromParams(params);
|
||||
|
||||
if(radioStationId != 0 && typeof getServerData().radioStations[radioStationId-1] == "undefined") {
|
||||
if (radioStationId != 0 && typeof getServerData().radioStations[radioStationId - 1] == "undefined") {
|
||||
messagePlayerError(client, getLocaleString(client, "InvalidRadioStation"));
|
||||
return false;
|
||||
}
|
||||
|
||||
if(isPlayerInAnyVehicle(client)) {
|
||||
if (isPlayerInAnyVehicle(client)) {
|
||||
let vehicle = getPlayerVehicle(client);
|
||||
|
||||
if(!getVehicleData(vehicle)) {
|
||||
if (!getVehicleData(vehicle)) {
|
||||
messagePlayerError(client, getLocaleString(client, "RandomVehicleCommandsDisabled"));
|
||||
return false;
|
||||
}
|
||||
|
||||
if(radioStationId == 0) {
|
||||
if (radioStationId == 0) {
|
||||
getVehicleData(vehicle).streamingRadioStation = -1;
|
||||
getVehicleData(vehicle).needsSaved = true;
|
||||
getPlayerData(client).streamingRadioStation = -1;
|
||||
meActionToNearbyPlayers(client, `turns off their vehicle's radio`);
|
||||
|
||||
let clients = getClients();
|
||||
for(let i in clients) {
|
||||
if(getPlayerVehicle(client) == getPlayerVehicle(clients[i])) {
|
||||
for (let i in clients) {
|
||||
if (getPlayerVehicle(client) == getPlayerVehicle(clients[i])) {
|
||||
playRadioStreamForPlayer(clients[i], "");
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
getVehicleData(vehicle).streamingRadioStation = radioStationId-1;
|
||||
getPlayerData(client).streamingRadioStation = radioStationId-1;
|
||||
meActionToNearbyPlayers(client, getLocaleString(client, "ActionVehicleRadioStationChange", getRadioStationData(radioStationId-1).name, getRadioStationData(radioStationId-1).genre));
|
||||
getVehicleData(vehicle).streamingRadioStation = radioStationId - 1;
|
||||
getPlayerData(client).streamingRadioStation = radioStationId - 1;
|
||||
meActionToNearbyPlayers(client, getLocaleString(client, "ActionVehicleRadioStationChange", getRadioStationData(radioStationId - 1).name, getRadioStationData(radioStationId - 1).genre));
|
||||
|
||||
let clients = getClients();
|
||||
for(let i in clients) {
|
||||
if(vehicle == getPlayerVehicle(clients[i])) {
|
||||
playRadioStreamForPlayer(clients[i], getRadioStationData(radioStationId-1).url, true, getPlayerStreamingRadioVolume(client));
|
||||
for (let i in clients) {
|
||||
if (vehicle == getPlayerVehicle(clients[i])) {
|
||||
playRadioStreamForPlayer(clients[i], getRadioStationData(radioStationId - 1).url, true, getPlayerStreamingRadioVolume(client));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if(doesEntityDataExist(client, "vrr.inHouse")) {
|
||||
let houseId = getEntityData(client, "vrr.inHouse");
|
||||
if(radioStationId == 0) {
|
||||
if (doesEntityDataExist(client, "agrp.inHouse")) {
|
||||
let houseId = getEntityData(client, "agrp.inHouse");
|
||||
if (radioStationId == 0) {
|
||||
getHouseData(houseId).streamingRadioStation = -1;
|
||||
getHouseData(houseId).needsSaved = true;
|
||||
getPlayerData(client).streamingRadioStation = -1;
|
||||
meActionToNearbyPlayers(client, `turns off the house radio`);
|
||||
|
||||
let clients = getClients();
|
||||
for(let i in clients) {
|
||||
if(getEntityData(clients[i], "vrr.inHouse") == houseId) {
|
||||
for (let i in clients) {
|
||||
if (getEntityData(clients[i], "agrp.inHouse") == houseId) {
|
||||
playRadioStreamForPlayer(clients[i], "");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
getHouseData(houseId).streamingRadioStation = radioStationId-1;
|
||||
getHouseData(houseId).streamingRadioStation = radioStationId - 1;
|
||||
getHouseData(houseId).needsSaved = true;
|
||||
getPlayerData(client).streamingRadioStation = radioStationId-1;
|
||||
meActionToNearbyPlayers(client, getLocaleString(client, "ActionHouseRadioStationChange", getRadioStationData(radioStationId-1).name, getRadioStationData(radioStationId-1).genre));
|
||||
getPlayerData(client).streamingRadioStation = radioStationId - 1;
|
||||
meActionToNearbyPlayers(client, getLocaleString(client, "ActionHouseRadioStationChange", getRadioStationData(radioStationId - 1).name, getRadioStationData(radioStationId - 1).genre));
|
||||
|
||||
let clients = getClients();
|
||||
for(let i in clients) {
|
||||
if(getEntityData(clients[i], "vrr.inHouse") == houseId) {
|
||||
playRadioStreamForPlayer(clients[i], getRadioStationData(radioStationId-1).url, true, getPlayerStreamingRadioVolume(clients[i]));
|
||||
for (let i in clients) {
|
||||
if (getEntityData(clients[i], "agrp.inHouse") == houseId) {
|
||||
playRadioStreamForPlayer(clients[i], getRadioStationData(radioStationId - 1).url, true, getPlayerStreamingRadioVolume(clients[i]));
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if(isPlayerInAnyBusiness(client)) {
|
||||
} else if (isPlayerInAnyBusiness(client)) {
|
||||
let businessId = getPlayerBusiness(client);
|
||||
if(radioStationId == 0) {
|
||||
if (radioStationId == 0) {
|
||||
getBusinessData(businessId).streamingRadioStation = -1;
|
||||
getBusinessData(businessId).needsSaved = true;
|
||||
getPlayerData(client).streamingRadioStation = -1;
|
||||
meActionToNearbyPlayers(client, `turns off the business radio`);
|
||||
|
||||
let clients = getClients();
|
||||
for(let i in clients) {
|
||||
if(getPlayerBusiness(clients[i]) == businessId) {
|
||||
for (let i in clients) {
|
||||
if (getPlayerBusiness(clients[i]) == businessId) {
|
||||
stopRadioStreamForPlayer(clients[i]);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
getBusinessData(businessId).streamingRadioStation = radioStationId-1;
|
||||
getBusinessData(businessId).streamingRadioStation = radioStationId - 1;
|
||||
getBusinessData(businessId).needsSaved = true;
|
||||
getPlayerData(client).streamingRadioStation = radioStationId-1;
|
||||
meActionToNearbyPlayers(client, getLocaleString(client, "ActionBusinessRadioStationChange", getRadioStationData(radioStationId-1).name, getRadioStationData(radioStationId-1).genre));
|
||||
getPlayerData(client).streamingRadioStation = radioStationId - 1;
|
||||
meActionToNearbyPlayers(client, getLocaleString(client, "ActionBusinessRadioStationChange", getRadioStationData(radioStationId - 1).name, getRadioStationData(radioStationId - 1).genre));
|
||||
|
||||
let clients = getClients();
|
||||
for(let i in clients) {
|
||||
if(getPlayerBusiness(clients[i]) == businessId) {
|
||||
playRadioStreamForPlayer(clients[i], getRadioStationData(radioStationId-1).url, true, getPlayerStreamingRadioVolume(clients[i]));
|
||||
for (let i in clients) {
|
||||
if (getPlayerBusiness(clients[i]) == businessId) {
|
||||
playRadioStreamForPlayer(clients[i], getRadioStationData(radioStationId - 1).url, true, getPlayerStreamingRadioVolume(clients[i]));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -169,14 +190,14 @@ function playStreamingRadioCommand(command, params, client) {
|
||||
*
|
||||
*/
|
||||
function setStreamingRadioVolumeCommand(command, params, client) {
|
||||
if(areParamsEmpty(params)) {
|
||||
if (areParamsEmpty(params)) {
|
||||
messagePlayerSyntax(client, getCommandSyntaxText(command));
|
||||
return false;
|
||||
}
|
||||
|
||||
let volumeLevel = params;
|
||||
|
||||
if(isNaN(volumeLevel)) {
|
||||
if (isNaN(volumeLevel)) {
|
||||
messagePlayerError(client, getLocaleString(client, "RadioVolumeNotNumber"));
|
||||
return false;
|
||||
}
|
||||
@@ -184,13 +205,13 @@ function setStreamingRadioVolumeCommand(command, params, client) {
|
||||
setPlayerStreamingRadioVolume(client, toInteger(volumeLevel));
|
||||
getPlayerData(client).accountData.streamingRadioVolume = toInteger(volumeLevel);
|
||||
let volumeEmoji = '';
|
||||
if(volumeLevel >= 60) {
|
||||
if (volumeLevel >= 60) {
|
||||
volumeEmoji = '🔊';
|
||||
} else if(volumeLevel >= 30 && volumeLevel < 60) {
|
||||
} else if (volumeLevel >= 30 && volumeLevel < 60) {
|
||||
volumeEmoji = '🔉';
|
||||
} else if(volumeLevel > 0 && volumeLevel < 30) {
|
||||
} else if (volumeLevel > 0 && volumeLevel < 30) {
|
||||
volumeEmoji = '🔈';
|
||||
} else if(volumeLevel <= 0) {
|
||||
} else if (volumeLevel <= 0) {
|
||||
volumeEmoji = '🔇';
|
||||
}
|
||||
|
||||
@@ -200,7 +221,7 @@ function setStreamingRadioVolumeCommand(command, params, client) {
|
||||
// ===========================================================================
|
||||
|
||||
function getPlayerStreamingRadioVolume(client) {
|
||||
if(!getPlayerData(client) || !isPlayerLoggedIn(client) || !isPlayerSpawned(client)) {
|
||||
if (!getPlayerData(client) || !isPlayerLoggedIn(client) || !isPlayerSpawned(client)) {
|
||||
return 20;
|
||||
}
|
||||
return getPlayerData(client).accountData.streamingRadioVolume;
|
||||
@@ -218,13 +239,13 @@ function getPlayerStreamingRadioVolume(client) {
|
||||
*
|
||||
*/
|
||||
function showRadioStationListCommand(command, params, client) {
|
||||
let stationList = getServerData().radioStations.map(function(x) { return `{ALTCOLOUR}${toInteger(x.index)+1}: {MAINCOLOUR}${x.name}`; });
|
||||
let stationList = getServerData().radioStations.map(function (x) { return `{ALTCOLOUR}${toInteger(x.index) + 1}: {MAINCOLOUR}${x.name}`; });
|
||||
|
||||
let chunkedList = splitArrayIntoChunks(stationList, 4);
|
||||
|
||||
messagePlayerNormal(client, makeChatBoxSectionHeader(getLocaleString(client, "HeaderRadioStationsList")));
|
||||
|
||||
for(let i in chunkedList) {
|
||||
for (let i in chunkedList) {
|
||||
messagePlayerInfo(client, chunkedList[i].join(", "));
|
||||
}
|
||||
}
|
||||
@@ -232,7 +253,7 @@ function showRadioStationListCommand(command, params, client) {
|
||||
// ===========================================================================
|
||||
|
||||
function setAllRadioStationIndexes() {
|
||||
for(let i in getServerData().radioStations) {
|
||||
for (let i in getServerData().radioStations) {
|
||||
getServerData().radioStations[i].index = i;
|
||||
}
|
||||
}
|
||||
@@ -270,14 +291,14 @@ function reloadAllRadioStationsCommand(command, params, client) {
|
||||
// ===========================================================================
|
||||
|
||||
function getRadioStationFromParams(params) {
|
||||
if(isNaN(params)) {
|
||||
for(let i in getServerData().radioStations) {
|
||||
if(toLowerCase(getServerData().radioStations[i].name).indexOf(toLowerCase(params)) != -1) {
|
||||
if (isNaN(params)) {
|
||||
for (let i in getServerData().radioStations) {
|
||||
if (toLowerCase(getServerData().radioStations[i].name).indexOf(toLowerCase(params)) != -1) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if(typeof getServerData().radioStations[params] != "undefined") {
|
||||
if (typeof getServerData().radioStations[params] != "undefined") {
|
||||
return toInteger(params);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
function initServerScripts() {
|
||||
checkForAllRequiredModules();
|
||||
|
||||
initClassScript();
|
||||
initDatabaseScript();
|
||||
initConfigScript();
|
||||
initEmailScript();
|
||||
@@ -30,7 +29,7 @@ function initServerScripts() {
|
||||
initKeyBindScript();
|
||||
initEventScript();
|
||||
initAntiCheatScript();
|
||||
initClientScript();
|
||||
initNetworkEventsScript();
|
||||
initMessagingScript();
|
||||
initHelpScript();
|
||||
initFishingScript();
|
||||
@@ -117,19 +116,17 @@ function loadServerDataFromDatabase() {
|
||||
logToConsole(LOG_INFO, "[VRR.Config]: Loading server data ...");
|
||||
|
||||
// Always load these regardless of "test server" status
|
||||
getServerData().localeStrings = loadAllLocaleStrings();
|
||||
getServerData().allowedSkins = getAllowedSkins(getGame());
|
||||
|
||||
getServerData().itemTypes = loadItemTypesFromDatabase();
|
||||
|
||||
// Translation Cache
|
||||
getServerData().cachedTranslations = new Array(getGlobalConfig().locale.locales.length);
|
||||
getServerData().cachedTranslationFrom = new Array(getGlobalConfig().locale.locales.length);
|
||||
getServerData().cachedTranslationFrom.fill([]);
|
||||
getServerData().cachedTranslations.fill(getServerData().cachedTranslationFrom);
|
||||
//getServerData().cachedTranslations = new Array(getGlobalConfig().locale.locales.length);
|
||||
//getServerData().cachedTranslationFrom = new Array(getGlobalConfig().locale.locales.length);
|
||||
//getServerData().cachedTranslationFrom.fill([]);
|
||||
//getServerData().cachedTranslations.fill(getServerData().cachedTranslationFrom);
|
||||
|
||||
// Only load these if the server isn't a testing/dev server
|
||||
if (!getServerConfig().devServer) {
|
||||
if (!getServerConfig().devServer && server.getCVar("agrp_devserver") == 0) {
|
||||
getServerData().items = loadItemsFromDatabase();
|
||||
getServerData().businesses = loadBusinessesFromDatabase();
|
||||
getServerData().houses = loadHousesFromDatabase();
|
||||
|
||||
@@ -7,6 +7,116 @@
|
||||
// TYPE: Server (JavaScript)
|
||||
// ===========================================================================
|
||||
|
||||
|
||||
/**
|
||||
* @class Representing a character's (subaccount) data. Loaded and saved in the database
|
||||
*/
|
||||
class SubAccountData {
|
||||
constructor(dbAssoc = false) {
|
||||
this.databaseId = 0;
|
||||
this.serverId = 0;
|
||||
this.firstName = "John";
|
||||
this.lastName = "Doe";
|
||||
this.middleName = "Q";
|
||||
this.account = 0;
|
||||
this.skin = 0;
|
||||
this.cash = 0;
|
||||
this.spawnPosition = toVector3(0.0, 0.0, 0.0);
|
||||
this.spawnHeading = 0.0;
|
||||
this.lastLogin = 0;
|
||||
this.clan = 0;
|
||||
this.clanFlags = 0;
|
||||
this.clanRank = 0;
|
||||
this.clanTitle = 0;
|
||||
this.isWorking = false;
|
||||
this.jobUniform = this.skin;
|
||||
this.job = 0;
|
||||
this.jobRank = 0;
|
||||
this.weapons = [];
|
||||
this.inJail = false;
|
||||
this.interior = 0;
|
||||
this.dimension = 0;
|
||||
this.pedScale = toVector3(1.0, 1.0, 1.0);
|
||||
this.walkStyle = 0;
|
||||
this.fightStyle = 0;
|
||||
this.health = 100;
|
||||
this.armour = 100;
|
||||
this.inHouse = 0;
|
||||
this.inBusiness = 0;
|
||||
this.accent = "";
|
||||
|
||||
this.bodyParts = {
|
||||
hair: [0,0],
|
||||
head: [0,0],
|
||||
upper: [0,0],
|
||||
lower: [0,0],
|
||||
};
|
||||
|
||||
this.bodyProps = {
|
||||
hair: [0,0],
|
||||
eyes: [0,0],
|
||||
head: [0,0],
|
||||
leftHand: [0,0],
|
||||
rightHand: [0,0],
|
||||
leftWrist: [0,0],
|
||||
rightWrist: [0,0],
|
||||
hip: [0,0],
|
||||
leftFoot: [0,0],
|
||||
rightFoot: [0,0],
|
||||
};
|
||||
|
||||
if(dbAssoc) {
|
||||
this.databaseId = dbAssoc["sacct_id"];
|
||||
this.serverId = toInteger(dbAssoc["sacct_server"]);
|
||||
this.firstName = dbAssoc["sacct_name_first"];
|
||||
this.lastName = dbAssoc["sacct_name_last"];
|
||||
this.middleName = dbAssoc["sacct_name_middle"] || "";
|
||||
this.account = toInteger(dbAssoc["sacct_acct"]);
|
||||
this.skin = toInteger(dbAssoc["sacct_svr_skin"]);
|
||||
this.cash = toInteger(dbAssoc["sacct_cash"]);
|
||||
this.spawnPosition = toVector3(toFloat(dbAssoc["sacct_pos_x"]), toFloat(dbAssoc["sacct_pos_y"]), toFloat(dbAssoc["sacct_pos_z"]));
|
||||
this.spawnHeading = toFloat(dbAssoc["sacct_rot_z"]);
|
||||
this.lastLogin = toInteger(dbAssoc["sacct_when_lastlogin"]);
|
||||
this.clan = toInteger(dbAssoc["sacct_svr_clan"]);
|
||||
this.clanFlags = toInteger(dbAssoc["sacct_svr_clan_flags"]);
|
||||
this.clanRank = toInteger(dbAssoc["sacct_svr_clan_rank"]);
|
||||
this.clanTitle = toInteger(dbAssoc["sacct_svr_clan_title"]);
|
||||
this.job = toInteger(dbAssoc["sacct_svr_job"]);
|
||||
this.jobRank = toInteger(dbAssoc["sacct_svr_job_rank"]);
|
||||
this.interior = toInteger(dbAssoc["sacct_int"]);
|
||||
this.dimension = toInteger(dbAssoc["sacct_vw"]);
|
||||
this.pedScale = toVector3(toFloat(dbAssoc["sacct_svr_scale_x"]), toFloat(dbAssoc["sacct_svr_scale_y"]), toFloat(dbAssoc["sacct_svr_scale_z"]));
|
||||
this.walkStyle = toInteger(dbAssoc["sacct_svr_walkstyle"]);
|
||||
this.fightStyle = toInteger(dbAssoc["sacct_svr_fightstyle"]);
|
||||
this.health = toInteger(dbAssoc["sacct_health"]);
|
||||
this.armour = toInteger(dbAssoc["sacct_armour"]);
|
||||
this.inHouse = toInteger(dbAssoc["sacct_inhouse"]);
|
||||
this.inBusiness = toInteger(dbAssoc["sacct_inbusiness"]);
|
||||
this.accent = toString(dbAssoc["sacct_accent"]);
|
||||
|
||||
this.bodyParts = {
|
||||
hair: [toInteger(dbAssoc["sacct_svr_hd_part_hair_model"]) || 0, toInteger(dbAssoc["sacct_svr_hd_part_hair_texture"]) || 0],
|
||||
head: [toInteger(dbAssoc["sacct_svr_hd_part_head_model"]) || 0, toInteger(dbAssoc["sacct_svr_hd_part_head_texture"]) || 0],
|
||||
upper: [toInteger(dbAssoc["sacct_svr_hd_part_upper_model"]) || 0, toInteger(dbAssoc["sacct_svr_hd_part_upper_texture"]) || 0],
|
||||
lower: [toInteger(dbAssoc["sacct_svr_hd_part_lower_model"]) || 0, toInteger(dbAssoc["sacct_svr_hd_part_lower_texture"]) || 0],
|
||||
};
|
||||
|
||||
this.bodyProps = {
|
||||
hair: [toInteger(dbAssoc["sacct_svr_hd_prop_hair_model"]) || 0, toInteger(dbAssoc["sacct_svr_hd_prop_hair_texture"]) || 0],
|
||||
eyes: [toInteger(dbAssoc["sacct_svr_hd_prop_eyes_model"]) || 0, toInteger(dbAssoc["sacct_svr_hd_prop_eyes_texture"]) || 0],
|
||||
head: [toInteger(dbAssoc["sacct_svr_hd_prop_head_model"]) || 0, toInteger(dbAssoc["sacct_svr_hd_prop_head_texture"]) || 0],
|
||||
leftHand: [toInteger(dbAssoc["sacct_svr_hd_prop_lefthand_model"]) || 0, toInteger(dbAssoc["sacct_svr_hd_prop_lefthand_texture"]) || 0],
|
||||
rightHand: [toInteger(dbAssoc["sacct_svr_hd_prop_righthand_model"]) || 0, toInteger(dbAssoc["sacct_svr_hd_prop_righthand_texture"]) || 0],
|
||||
leftWrist: [toInteger(dbAssoc["sacct_svr_hd_prop_leftwrist_model"]) || 0, toInteger(dbAssoc["sacct_svr_hd_prop_leftwrist_texture"]) || 0],
|
||||
rightWrist: [toInteger(dbAssoc["sacct_svr_hd_prop_rightwrist_model"]) || 0, toInteger(dbAssoc["sacct_svr_hd_prop_rightwrist_texture"]) || 0],
|
||||
hip: [toInteger(dbAssoc["sacct_svr_hd_prop_hip_model"]) || 0, toInteger(dbAssoc["sacct_svr_hd_prop_hip_texture"]) || 0],
|
||||
leftFoot: [toInteger(dbAssoc["sacct_svr_hd_prop_leftfoot_model"]) || 0, toInteger(dbAssoc["sacct_svr_hd_prop_leftfoot_texture"]) || 0],
|
||||
rightFoot: [toInteger(dbAssoc["sacct_svr_hd_prop_rightfoot_model"]) || 0, toInteger(dbAssoc["sacct_svr_hd_prop_rightfoot_texture"]) || 0],
|
||||
};
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
function initSubAccountScript() {
|
||||
logToConsole(LOG_INFO, "[VRR.SubAccount]: Initializing subaccount script ...");
|
||||
logToConsole(LOG_INFO, "[VRR.SubAccount]: SubAccount script initialized!");
|
||||
|
||||
@@ -7,6 +7,164 @@
|
||||
// TYPE: Server (JavaScript)
|
||||
// ===========================================================================
|
||||
|
||||
// Vehicle Owner Types
|
||||
const VRR_VEHOWNER_NONE = 0; // Not owned
|
||||
const VRR_VEHOWNER_PLAYER = 1; // Owned by a player (character/subaccount)
|
||||
const VRR_VEHOWNER_JOB = 2; // Owned by a job
|
||||
const VRR_VEHOWNER_CLAN = 3; // Owned by a clan
|
||||
const VRR_VEHOWNER_FACTION = 4; // Owned by a faction (not used at the moment)
|
||||
const VRR_VEHOWNER_PUBLIC = 5; // Public vehicle. Anybody can drive it.
|
||||
const VRR_VEHOWNER_BIZ = 6; // Owned by a business (also includes dealerships since they're businesses)
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
// Vehicle Seats
|
||||
const VRR_VEHSEAT_DRIVER = 0;
|
||||
const VRR_VEHSEAT_FRONTPASSENGER = 1;
|
||||
const VRR_VEHSEAT_REARLEFTPASSENGER = 2;
|
||||
const VRR_VEHSEAT_REARRIGHTPASSENGER = 3;
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
/**
|
||||
* @class Representing a vehicle's data. Loaded and saved in the database
|
||||
*/
|
||||
class VehicleData {
|
||||
constructor(dbAssoc = false, vehicle = false) {
|
||||
// General Info
|
||||
this.databaseId = 0;
|
||||
this.serverId = getServerId();
|
||||
this.model = (vehicle != false) ? getVehicleModelIndexFromModel(vehicle.modelIndex) : 0;
|
||||
this.vehicle = vehicle;
|
||||
this.index = -1;
|
||||
this.needsSaved = false;
|
||||
|
||||
// GTA IV
|
||||
this.ivNetworkId = -1;
|
||||
this.syncPosition = toVector3(0.0, 0.0, 0.0);
|
||||
this.syncHeading = 0.0;
|
||||
|
||||
// Ownership
|
||||
this.ownerType = VRR_VEHOWNER_NONE;
|
||||
this.ownerId = 0;
|
||||
this.buyPrice = 0;
|
||||
this.rentPrice = 0;
|
||||
this.rentedBy = false;
|
||||
this.rentStart = 0;
|
||||
|
||||
// Position and Rotation
|
||||
this.spawnPosition = (vehicle) ? vehicle.position : toVector3(0.0, 0.0, 0.0);
|
||||
this.spawnRotation = (vehicle) ? vehicle.heading : 0.0;
|
||||
this.spawnLocked = false;
|
||||
this.interior = 0;
|
||||
this.dimension = 0;
|
||||
|
||||
// Colour Info
|
||||
this.colour1IsRGBA = 0;
|
||||
this.colour2IsRGBA = 0;
|
||||
this.colour3IsRGBA = 0;
|
||||
this.colour4IsRGBA = 0;
|
||||
this.colour1 = (vehicle) ? vehicle.colour1 : 1;
|
||||
this.colour2 = (vehicle) ? vehicle.colour2 : 1;
|
||||
this.colour3 = (vehicle) ? vehicle.colour3 : 1;
|
||||
this.colour4 = (vehicle) ? vehicle.colour4 : 1;
|
||||
this.livery = 3;
|
||||
|
||||
// Vehicle Attributes
|
||||
this.locked = false;
|
||||
this.engine = false;
|
||||
this.lights = false;
|
||||
this.health = 1000;
|
||||
this.engineDamage = 0;
|
||||
this.visualDamage = 0;
|
||||
this.dirtLevel = 0;
|
||||
|
||||
this.trunkItemCache = [];
|
||||
this.dashItemCache = [];
|
||||
|
||||
this.streamingRadioStation = -1;
|
||||
|
||||
// Other/Misc
|
||||
this.insuranceAccount = 0;
|
||||
this.fuel = 0;
|
||||
this.flags = 0;
|
||||
this.needsSaved = false;
|
||||
this.whoAdded = 0;
|
||||
this.whenAdded = 0;
|
||||
this.licensePlate = "";
|
||||
|
||||
this.lastActiveTime = false;
|
||||
|
||||
if (dbAssoc) {
|
||||
// General Info
|
||||
this.databaseId = toInteger(dbAssoc["veh_id"]);
|
||||
this.serverId = toInteger(dbAssoc["veh_server"]);
|
||||
this.model = toInteger(dbAssoc["veh_model"]);
|
||||
|
||||
// Ownership
|
||||
this.ownerType = toInteger(dbAssoc["veh_owner_type"]);
|
||||
this.ownerId = toInteger(dbAssoc["veh_owner_id"]);
|
||||
this.buyPrice = toInteger(dbAssoc["veh_buy_price"]);
|
||||
this.rentPrice = toInteger(dbAssoc["veh_rent_price"]);
|
||||
|
||||
// Position and Rotation
|
||||
this.spawnPosition = toVector3(dbAssoc["veh_pos_x"], dbAssoc["veh_pos_y"], dbAssoc["veh_pos_z"]);
|
||||
this.spawnRotation = toInteger(dbAssoc["veh_rot_z"]);
|
||||
this.spawnLocked = intToBool(toInteger(dbAssoc["veh_spawn_lock"]));
|
||||
this.interior = toInteger(dbAssoc["veh_int"]);
|
||||
this.dimension = toInteger(dbAssoc["veh_vw"]);
|
||||
|
||||
// Colour Info
|
||||
this.colour1IsRGBA = intToBool(toInteger(dbAssoc["veh_col1_isrgba"]));
|
||||
this.colour2IsRGBA = intToBool(toInteger(dbAssoc["veh_col2_isrgba"]));
|
||||
this.colour3IsRGBA = intToBool(toInteger(dbAssoc["veh_col3_isrgba"]));
|
||||
this.colour4IsRGBA = intToBool(toInteger(dbAssoc["veh_col4_isrgba"]));
|
||||
this.colour1 = toInteger(dbAssoc["veh_col1"]);
|
||||
this.colour2 = toInteger(dbAssoc["veh_col2"]);
|
||||
this.colour3 = toInteger(dbAssoc["veh_col3"]);
|
||||
this.colour4 = toInteger(dbAssoc["veh_col4"]);
|
||||
this.livery = toInteger(dbAssoc["veh_livery"]);
|
||||
|
||||
// Extras (components on SA, extras on IV+)
|
||||
this.extras = [
|
||||
toInteger(dbAssoc["veh_extra1"]),
|
||||
toInteger(dbAssoc["veh_extra2"]),
|
||||
toInteger(dbAssoc["veh_extra3"]),
|
||||
toInteger(dbAssoc["veh_extra4"]),
|
||||
toInteger(dbAssoc["veh_extra5"]),
|
||||
toInteger(dbAssoc["veh_extra6"]),
|
||||
toInteger(dbAssoc["veh_extra7"]),
|
||||
toInteger(dbAssoc["veh_extra8"]),
|
||||
toInteger(dbAssoc["veh_extra9"]),
|
||||
toInteger(dbAssoc["veh_extra10"]),
|
||||
toInteger(dbAssoc["veh_extra11"]),
|
||||
toInteger(dbAssoc["veh_extra12"]),
|
||||
toInteger(dbAssoc["veh_extra13"]),
|
||||
];
|
||||
|
||||
// Vehicle Attributes
|
||||
this.locked = intToBool(toInteger(dbAssoc["veh_locked"]));
|
||||
this.engine = intToBool(toInteger(dbAssoc["veh_engine"]));
|
||||
this.lights = intToBool(toInteger(dbAssoc["veh_lights"]));
|
||||
this.health = toInteger(dbAssoc["veh_damage_normal"]);
|
||||
this.engineDamage = toInteger(dbAssoc["veh_damage_engine"]);
|
||||
this.visualDamage = toInteger(dbAssoc["veh_damage_visual"]);
|
||||
this.dirtLevel = toInteger(dbAssoc["veh_dirt_level"]);
|
||||
|
||||
// Other/Misc
|
||||
this.insuranceAccount = toInteger(0);
|
||||
this.fuel = toInteger(0);
|
||||
this.flags = toInteger(0);
|
||||
this.needsSaved = false;
|
||||
this.whoAdded = toInteger(dbAssoc["veh_who_added"]);
|
||||
this.whenAdded = toInteger(dbAssoc["veh_when_added"]);
|
||||
this.licensePlate = toInteger(dbAssoc["veh_license_plate"]);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function initVehicleScript() {
|
||||
logToConsole(LOG_INFO, "[VRR.Vehicle]: Initializing vehicle script ...");
|
||||
logToConsole(LOG_INFO, "[VRR.Vehicle]: Vehicle script initialized successfully!");
|
||||
@@ -163,7 +321,7 @@ function spawnAllVehicles() {
|
||||
for (let i in getServerData().vehicles) {
|
||||
let vehicle = spawnVehicle(getServerData().vehicles[i]);
|
||||
getServerData().vehicles[i].vehicle = vehicle;
|
||||
setEntityData(vehicle, "vrr.dataSlot", i, false);
|
||||
setEntityData(vehicle, "agrp.dataSlot", i, false);
|
||||
setAllVehicleIndexes();
|
||||
}
|
||||
}
|
||||
@@ -177,13 +335,13 @@ function spawnAllVehicles() {
|
||||
function getVehicleData(vehicle) {
|
||||
if (getGame() != VRR_GAME_GTA_IV) {
|
||||
if (isVehicleObject(vehicle)) {
|
||||
let dataIndex = getEntityData(vehicle, "vrr.dataSlot");
|
||||
let dataIndex = getEntityData(vehicle, "agrp.dataSlot");
|
||||
if (typeof getServerData().vehicles[dataIndex] != "undefined") {
|
||||
return getServerData().vehicles[dataIndex];
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return getServerVehicles().find((v) => v.ivNetworkId == vehicle);
|
||||
return getServerData().vehicles.find((v) => v.ivNetworkId == vehicle);
|
||||
}
|
||||
|
||||
return false;
|
||||
@@ -343,7 +501,7 @@ function deleteVehicleCommand(command, params, client) {
|
||||
return false;
|
||||
}
|
||||
|
||||
let dataIndex = getEntityData(vehicle, "vrr.dataSlot");
|
||||
let dataIndex = getEntityData(vehicle, "agrp.dataSlot");
|
||||
let vehicleName = getVehicleName(vehicle);
|
||||
|
||||
quickDatabaseQuery(`UPDATE veh_main SET veh_deleted = 1 WHERE veh_id = ${getVehicleData(vehicle).databaseId}`);
|
||||
@@ -381,7 +539,7 @@ function vehicleEngineCommand(command, params, client) {
|
||||
|
||||
getVehicleData(vehicle).engine = !getVehicleData(vehicle).engine;
|
||||
vehicle.engine = getVehicleData(vehicle).engine;
|
||||
setEntityData(vehicle, "vrr.engine", getVehicleData(vehicle).engine, true);
|
||||
setEntityData(vehicle, "agrp.engine", getVehicleData(vehicle).engine, true);
|
||||
|
||||
getVehicleData(vehicle).needsSaved = true;
|
||||
|
||||
@@ -507,7 +665,7 @@ function vehicleAdminLiveryCommand(command, params, client) {
|
||||
getVehicleData(vehicle).livery = livery;
|
||||
getVehicleData(vehicle).needsSaved = true;
|
||||
|
||||
setEntityData(vehicle, "vrr.livery", livery, true);
|
||||
setEntityData(vehicle, "agrp.livery", livery, true);
|
||||
forcePlayerToSyncElementProperties(null, vehicle);
|
||||
|
||||
meActionToNearbyPlayers(client, `sets the ${getVehicleName(vehicle)}'s livery/paintjob'`);
|
||||
@@ -541,7 +699,7 @@ function buyVehicleCommand(command, params, client) {
|
||||
getPlayerData(client).buyingVehicle = vehicle;
|
||||
getVehicleData(vehicle).engine = true;
|
||||
vehicle.engine = true;
|
||||
setEntityData(vehicle, "vrr.engine", getVehicleData(vehicle).engine, true);
|
||||
setEntityData(vehicle, "agrp.engine", getVehicleData(vehicle).engine, true);
|
||||
|
||||
getVehicleData(vehicle).needsSaved = true;
|
||||
setPlayerBuyingVehicleState(client, VRR_VEHBUYSTATE_TESTDRIVE, vehicle.id, getVehiclePosition(vehicle));
|
||||
@@ -612,7 +770,7 @@ function rentVehicleCommand(command, params, client) {
|
||||
// ===========================================================================
|
||||
|
||||
function enterVehicleAsPassengerCommand(command, params, client) {
|
||||
sendNetworkEventToPlayer("vrr.passenger", client);
|
||||
sendNetworkEventToPlayer("agrp.passenger", client);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -1293,7 +1451,7 @@ function respawnVehicle(vehicle) {
|
||||
|
||||
let newVehicle = spawnVehicle(vehicles[i]);
|
||||
vehicles[i].vehicle = newVehicle;
|
||||
setEntityData(newVehicle, "vrr.dataSlot", i, false);
|
||||
setEntityData(newVehicle, "agrp.dataSlot", i, false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1345,10 +1503,10 @@ function spawnVehicle(vehicleData) {
|
||||
//setVehicleHealth(vehicle, 1000);
|
||||
repairVehicle(vehicle);
|
||||
|
||||
setEntityData(vehicle, "vrr.livery", vehicleData.livery, true);
|
||||
setEntityData(vehicle, "vrr.upgrades", vehicleData.extras, true);
|
||||
setEntityData(vehicle, "vrr.interior", vehicleData.interior, true);
|
||||
setEntityData(vehicle, "vrr.engine", vehicleData.engine, true);
|
||||
setEntityData(vehicle, "agrp.livery", vehicleData.livery, true);
|
||||
setEntityData(vehicle, "agrp.upgrades", vehicleData.extras, true);
|
||||
setEntityData(vehicle, "agrp.interior", vehicleData.interior, true);
|
||||
setEntityData(vehicle, "agrp.engine", vehicleData.engine, true);
|
||||
|
||||
forcePlayerToSyncElementProperties(null, vehicle);
|
||||
|
||||
@@ -1434,7 +1592,7 @@ function createNewDealershipVehicle(modelIndex, spawnPosition, spawnRotation, pr
|
||||
tempVehicleData.dimension = dimension;
|
||||
|
||||
let slot = getServerData().vehicles.push(tempVehicleData);
|
||||
setEntityData(vehicle, "vrr.dataSlot", slot - 1, false);
|
||||
setEntityData(vehicle, "agrp.dataSlot", slot - 1, false);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -1459,7 +1617,7 @@ function createTemporaryVehicle(modelIndex, position, heading, interior = 0, dim
|
||||
}
|
||||
|
||||
let slot = getServerData().vehicles.push(tempVehicleData);
|
||||
setEntityData(vehicle, "vrr.dataSlot", slot - 1, false);
|
||||
setEntityData(vehicle, "agrp.dataSlot", slot - 1, false);
|
||||
|
||||
return vehicle;
|
||||
}
|
||||
@@ -1487,7 +1645,7 @@ function createPermanentVehicle(modelIndex, position, heading, interior = 0, dim
|
||||
let slot = getServerData().vehicles.push(tempVehicleData);
|
||||
|
||||
if (areServerElementsSupported()) {
|
||||
setEntityData(vehicle, "vrr.dataSlot", slot - 1, false);
|
||||
setEntityData(vehicle, "agrp.dataSlot", slot - 1, false);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -97,6 +97,20 @@ const VRR_VEHBUYSTATE_EXITVEH = 2;
|
||||
const VRR_VEHBUYSTATE_FARENOUGH = 3;
|
||||
const VRR_VEHBUYSTATE_WRONGVEH = 4;
|
||||
|
||||
// Islands
|
||||
const VRR_ISLAND_NONE = 0; // None
|
||||
const VRR_ISLAND_PORTLAND = 0; // Portland Island
|
||||
const VRR_ISLAND_STAUNTON = 1; // Staunton Island
|
||||
const VRR_ISLAND_SHORESIDEVALE = 2; // Shoreside Vale
|
||||
const VRR_ISLAND_VICEWEST = 0; // Western Island of VC
|
||||
const VRR_ISLAND_VICEEAST = 1; // Eastern Island of VC
|
||||
const VRR_ISLAND_LOSSANTOS = 0; // Los Santos
|
||||
const VRR_ISLAND_LASVENTURAS = 1; // Las Venturas
|
||||
const VRR_ISLAND_SANFIERRO = 2; // San Fierro
|
||||
const VRR_ISLAND_REDCOUNTYNORTH = 4; // Red County North (spans all the way from Palamino/shore on the east east to border of Flint County on the west)
|
||||
const VRR_ISLAND_BONECOUNTYNORTH = 5; // Bone County North (usually called Tierra Robada)
|
||||
const VRR_ISLAND_BONECOUNTYSOUTH = 6; // Bone County South
|
||||
|
||||
// Body Parts for Skin Select (IV for now, but might do other games when I can add accessory objects)
|
||||
const VRR_SKINSELECT_NONE = 0;
|
||||
const VRR_SKINSELECT_SKIN = 1;
|
||||
|
||||
134
third-party/mexui/Core/Component/Control.js
vendored
@@ -1,134 +0,0 @@
|
||||
mexui.Component.Control = function(window, x, y, w, h, styles, callback)
|
||||
{
|
||||
mexui.Entity.Component.call(this, false);
|
||||
mexui.Entity.StyleableEntity.call(this, this.linkComponentStyles('Control', styles));
|
||||
|
||||
this.window = window;
|
||||
this.position = new Vec2(x, y);
|
||||
this.size = new Vec2(w, h);
|
||||
this.callback = callback;
|
||||
|
||||
this.boundTo = null;
|
||||
};
|
||||
mexui.util.extend(mexui.Component.Control, mexui.Entity.Component);
|
||||
|
||||
// default styles
|
||||
//mexui.Component.Control.defaultStyles = {};
|
||||
//mexui.Component.Control.defaultStyles.__proto__ = mexui.Entity.StyleableEntity.defaultStyles;
|
||||
|
||||
mexui.Component.Control.defaultStyles = mexui.util.linkStyles(mexui.Entity.StyleableEntity.defaultStyles, {});
|
||||
|
||||
// input
|
||||
mexui.Component.Control.prototype.onMouseDown = function(e)
|
||||
{
|
||||
if(e.button == 0)
|
||||
{
|
||||
var hit = this.isCursorOverControl();
|
||||
if(hit)
|
||||
{
|
||||
e.used = true;
|
||||
e.clickedAControl = true;
|
||||
mexui.focusedControl = this;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
mexui.Component.Control.prototype.onMouseUp = function(e)
|
||||
{
|
||||
};
|
||||
|
||||
mexui.Component.Control.prototype.onMouseMove = function(e, offset)
|
||||
{
|
||||
if(this.isCursorOverControl())
|
||||
{
|
||||
if(!this.isHovered())
|
||||
{
|
||||
mexui.setHoveredComponent(this);
|
||||
this.onMouseEnter();
|
||||
}
|
||||
e.used = true;
|
||||
}
|
||||
else if(e.wasHovered)
|
||||
{
|
||||
mexui.clearHoveredComponent();
|
||||
this.onMouseExit();
|
||||
}
|
||||
};
|
||||
|
||||
mexui.Component.Control.prototype.onMouseWheel = function(e, data)
|
||||
{
|
||||
};
|
||||
|
||||
mexui.Component.Control.prototype.onKeyDown = function(e, key, mods)
|
||||
{
|
||||
};
|
||||
|
||||
mexui.Component.Control.prototype.onCharacter = function(e, character)
|
||||
{
|
||||
};
|
||||
|
||||
// render
|
||||
mexui.Component.Control.prototype.render = function()
|
||||
{
|
||||
};
|
||||
|
||||
mexui.Component.Control.prototype.renderAfter = function()
|
||||
{
|
||||
};
|
||||
|
||||
// model
|
||||
mexui.Component.Control.prototype.checkToCallCallback = function()
|
||||
{
|
||||
if(this.callback)
|
||||
this.callback.call(this);
|
||||
};
|
||||
|
||||
mexui.Component.Control.prototype.getScreenPosition = function()
|
||||
{
|
||||
var pos = mexui.util.addVec2(this.window.position, this.position);
|
||||
if(this.boundTo)
|
||||
pos = mexui.util.addVec2(pos, new Vec2(-this.boundTo.axis.x.getScrolledOffsetFixedStart(), -this.boundTo.axis.y.getScrolledOffsetFixedStart()));
|
||||
return pos;
|
||||
};
|
||||
|
||||
mexui.Component.Control.prototype.isCursorOverControl = function()
|
||||
{
|
||||
return mexui.util.isCursorInRectangle(this.getScreenPosition(), this.getSizeForInput ? this.getSizeForInput() : this.size);
|
||||
};
|
||||
|
||||
mexui.Component.Control.prototype.isCursorOverItem = function()
|
||||
{
|
||||
return this.isCursorOverControl();
|
||||
};
|
||||
|
||||
mexui.Component.Control.prototype.isInsideBoundControl = function()
|
||||
{
|
||||
if(this.boundTo instanceof mexui.Entity.ControlWithEntries)
|
||||
return this.isInsideBoundControlEntries();
|
||||
else
|
||||
return mexui.util.isRectangleInsideRectangle(this.getScreenPosition(), this.size, this.boundTo.getScreenPosition(), this.boundTo.size);
|
||||
};
|
||||
|
||||
mexui.Component.Control.prototype.isInsideBoundControlEntries = function()
|
||||
{
|
||||
var boundToControlPosition = mexui.util.addVec2(this.boundTo.getScreenPosition(), this.boundTo.entriesPositionOffset);
|
||||
var boundToControlSize = new Vec2(this.boundTo.size.x, this.boundTo.axis.y.getDisplayedEntriesLength());
|
||||
return mexui.util.isRectangleInsideRectangle(this.getScreenPosition(), this.size, boundToControlPosition, boundToControlSize);
|
||||
};
|
||||
|
||||
// api
|
||||
mexui.Component.Control.prototype.remove = function()
|
||||
{
|
||||
this.window.controls.splice(this.window.controls.indexOf(this), 1);
|
||||
};
|
||||
|
||||
mexui.Component.Control.prototype.bindTo = function(control)
|
||||
{
|
||||
this.boundTo = control;
|
||||
};
|
||||
|
||||
mexui.Component.Control.prototype.unbind = function()
|
||||
{
|
||||
this.boundTo = null;
|
||||
};
|
||||
|
||||
32
third-party/mexui/Core/Component/Entry.js
vendored
@@ -1,32 +0,0 @@
|
||||
mexui.Component.Entry = function(control, axisIndex, text, styles)
|
||||
{
|
||||
mexui.Entity.Component.call(this, false);
|
||||
mexui.Entity.StyleableEntity.call(this, this.linkComponentStyles('Entry', styles));
|
||||
|
||||
this.control = control;
|
||||
this.axisIndex = axisIndex;
|
||||
this.text = text;
|
||||
};
|
||||
mexui.util.extend(mexui.Component.Entry, mexui.Entity.Component);
|
||||
|
||||
// default styles
|
||||
mexui.Component.Entry.defaultStyles = mexui.util.linkStyles(mexui.Entity.StyleableEntity.defaultStyles, {});
|
||||
|
||||
// model
|
||||
mexui.Component.Entry.prototype.getEntryIndex = function()
|
||||
{
|
||||
return this.control.axis[this.getAxisKey()].entries.indexOf(this);
|
||||
};
|
||||
|
||||
mexui.Component.Entry.prototype.getAxisKey = function()
|
||||
{
|
||||
return this.axisIndex == 0 ? 'x' : 'y';
|
||||
};
|
||||
|
||||
// api
|
||||
mexui.Component.Entry.prototype.remove = function()
|
||||
{
|
||||
this.control.axis[this.getAxisKey()].entries.splice(this.getEntryIndex(), 1);
|
||||
this.control.checkToShowScrollBars();
|
||||
};
|
||||
|
||||
6
third-party/mexui/Core/Component/Event.js
vendored
@@ -1,6 +0,0 @@
|
||||
mexui.Component.Event = function()
|
||||
{
|
||||
this.used = false;
|
||||
this.clickedAControl = false;
|
||||
};
|
||||
|
||||
389
third-party/mexui/Core/Component/Window.js
vendored
@@ -1,389 +0,0 @@
|
||||
mexui.Component.Window = function(x, y, w, h, title, styles)
|
||||
{
|
||||
mexui.Entity.Component.call(this, true);
|
||||
mexui.Entity.StyleableEntity.call(this, this.linkComponentStyles('Window', styles));
|
||||
|
||||
this.position = new Vec2(x, y);
|
||||
this.size = new Vec2(w, h);
|
||||
this.title = title || '';
|
||||
|
||||
this.controls = [];
|
||||
this.titleBarShown = true;
|
||||
this.titleBarHeight = 30;
|
||||
this.titleBarIconShown = true;
|
||||
this.titleBarIconSize = new Vec2(30, 30);
|
||||
};
|
||||
mexui.util.extend(mexui.Component.Window, mexui.Entity.Component);
|
||||
|
||||
// default styles
|
||||
mexui.Component.Window.defaultStyles = mexui.util.linkStyles(mexui.Entity.StyleableEntity.defaultStyles, {
|
||||
main:
|
||||
{
|
||||
backgroundColour: toColour(0, 0, 0, 190),
|
||||
textColour: toColour(255, 255, 255, 255),
|
||||
|
||||
hover:
|
||||
{
|
||||
backgroundColour: toColour(0, 0, 0, 170)
|
||||
}
|
||||
},
|
||||
title:
|
||||
{
|
||||
backgroundColour: toColour(79, 161, 246, 190),
|
||||
textColour: toColour(0, 0, 0, 255)
|
||||
},
|
||||
icon:
|
||||
{
|
||||
backgroundColour: toColour(245, 5, 5, 190),
|
||||
textColour: toColour(0, 0, 0, 255),
|
||||
textSize: 21,
|
||||
textAlign: 0.5,
|
||||
textIndent: 0
|
||||
}
|
||||
});
|
||||
|
||||
// input
|
||||
mexui.Component.Window.prototype.onMouseDown = function(e)
|
||||
{
|
||||
if(e.button == 0 && this.titleBarShown && this.titleBarIconShown && this.isCursorOverCloseIcon())
|
||||
{
|
||||
this.shown = false;
|
||||
mexui.setInput(false);
|
||||
e.used = true;
|
||||
return;
|
||||
}
|
||||
|
||||
if(this.isCursorOverWindow())
|
||||
{
|
||||
this.setTop();
|
||||
}
|
||||
|
||||
this.triggerEvent('onMouseDown', e);
|
||||
};
|
||||
|
||||
mexui.Component.Window.prototype.onMouseUp = function(e)
|
||||
{
|
||||
this.triggerEvent('onMouseUp', e);
|
||||
};
|
||||
|
||||
mexui.Component.Window.prototype.onMouseMove = function(e, offset)
|
||||
{
|
||||
//var wasHovered = this.isHovered();
|
||||
//e.wasHovered = wasHovered;
|
||||
|
||||
if(mexui.hoveredComponent && !mexui.hoveredComponent.isCursorOverItem())
|
||||
{
|
||||
mexui.hoveredComponent.onMouseExit();
|
||||
mexui.clearHoveredComponent();
|
||||
}
|
||||
|
||||
this.triggerEvent('onMouseMove', e, offset);
|
||||
|
||||
if(e.used)
|
||||
{
|
||||
/*
|
||||
if(wasHovered)
|
||||
{
|
||||
mexui.clearHoveredComponent();
|
||||
this.onMouseExit();
|
||||
}
|
||||
*/
|
||||
return;
|
||||
}
|
||||
|
||||
if(this.isCursorOverWindow())
|
||||
{
|
||||
if(!this.isHovered())
|
||||
{
|
||||
mexui.setHoveredComponent(this);
|
||||
this.onMouseEnter();
|
||||
}
|
||||
e.used = true;
|
||||
}
|
||||
/*
|
||||
else if(wasHovered)
|
||||
{
|
||||
mexui.clearHoveredComponent();
|
||||
this.onMouseExit();
|
||||
}
|
||||
*/
|
||||
};
|
||||
|
||||
mexui.Component.Window.prototype.onMouseWheel = function(e, data)
|
||||
{
|
||||
this.triggerEvent('onMouseWheel', e, data);
|
||||
};
|
||||
|
||||
mexui.Component.Window.prototype.onKeyDown = function(e, key, mods)
|
||||
{
|
||||
this.triggerEvent('onKeyDown', e, key, mods);
|
||||
};
|
||||
|
||||
mexui.Component.Window.prototype.onCharacter = function(e, character)
|
||||
{
|
||||
this.triggerEvent('onCharacter', e, character);
|
||||
};
|
||||
|
||||
// render
|
||||
mexui.Component.Window.prototype.render = function()
|
||||
{
|
||||
// window background
|
||||
mexui.native.drawRectangleBackground(this.position, this.size, this.getStyles('main'));
|
||||
|
||||
if(this.titleBarShown)
|
||||
{
|
||||
// window title bar
|
||||
mexui.native.drawRectangle(this.position, new Vec2(this.size.x, this.titleBarHeight), this.getStyles('title'));
|
||||
mexui.native.drawText(this.position, new Vec2(this.size.x, this.titleBarHeight), this.title, this.getStyles('title'));
|
||||
|
||||
if(this.titleBarIconShown)
|
||||
{
|
||||
// window title bar icons
|
||||
var iconPos = this.getCloseIconPosition();
|
||||
mexui.native.drawRectangle(iconPos, this.titleBarIconSize, this.getStyles('icon'));
|
||||
mexui.native.drawText(iconPos, this.titleBarIconSize, 'X', this.getStyles('icon'));
|
||||
}
|
||||
}
|
||||
|
||||
// window border
|
||||
mexui.native.drawRectangleBorder(this.position, this.size, this.getStyles('main'));
|
||||
|
||||
// window controls
|
||||
var show, control;
|
||||
for(var i in this.controls)
|
||||
{
|
||||
control = this.controls[i];
|
||||
show = false;
|
||||
|
||||
if(control.shown)
|
||||
{
|
||||
show = true;
|
||||
if(control.boundTo)
|
||||
{
|
||||
if(!control.isInsideBoundControl())
|
||||
show = false;
|
||||
}
|
||||
}
|
||||
|
||||
if(show)
|
||||
control.render.call(control);
|
||||
}
|
||||
};
|
||||
|
||||
mexui.Component.Window.prototype.renderAfter = function()
|
||||
{
|
||||
for(var i in this.controls)
|
||||
{
|
||||
if(this.controls[i].shown)
|
||||
{
|
||||
this.controls[i].renderAfter.call(this.controls[i]);
|
||||
|
||||
for(var i2 in this.controls[i].scrollBars)
|
||||
{
|
||||
if(this.controls[i].scrollBars[i2].shown)
|
||||
this.controls[i].scrollBars[i2].renderAfter(this.controls[i].scrollBars[i2]);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// model
|
||||
mexui.Component.Window.prototype.center = function()
|
||||
{
|
||||
this.position = mexui.util.getCenterPosition(mexui.util.getWindowSize(), this.size);
|
||||
};
|
||||
|
||||
mexui.Component.Window.prototype.setTop = function()
|
||||
{
|
||||
mexui.windows.splice(mexui.windows.indexOf(this), 1);
|
||||
mexui.windows.push(this);
|
||||
};
|
||||
|
||||
mexui.Component.Window.prototype.remove = function()
|
||||
{
|
||||
mexui.windows.splice(mexui.windows.indexOf(this), 1);
|
||||
};
|
||||
|
||||
mexui.Component.Window.prototype.isCursorOverCloseIcon = function()
|
||||
{
|
||||
return mexui.util.isCursorInRectangle(this.getCloseIconPosition(), this.titleBarIconSize);
|
||||
};
|
||||
|
||||
mexui.Component.Window.prototype.getCloseIconPosition = function()
|
||||
{
|
||||
return new Vec2(this.position.x + (this.size.x - this.titleBarIconSize.x), this.position.y);
|
||||
};
|
||||
|
||||
mexui.Component.Window.prototype.triggerEvent = function(eventName, e, data, callBaseMethodFirst)
|
||||
{
|
||||
for(var i in this.controls)
|
||||
{
|
||||
var control = this.controls[i];
|
||||
|
||||
if(!control.shown)
|
||||
continue;
|
||||
|
||||
if(callBaseMethodFirst)
|
||||
{
|
||||
if(mexui.Entity.Component.prototype[eventName])
|
||||
{
|
||||
mexui.Entity.Component.prototype[eventName].call(control, e, data);
|
||||
if(e.used)
|
||||
break;
|
||||
}
|
||||
|
||||
this.controls[i][eventName].call(control, e, data);
|
||||
if(e.used)
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.controls[i][eventName].call(control, e, data);
|
||||
if(e.used)
|
||||
{
|
||||
if(e.button == 0 && eventName == 'onMouseDown')
|
||||
{
|
||||
mexui.focusedControl = this.controls[i];
|
||||
e.clickedAControl = true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if(mexui.Entity.Component.prototype[eventName])
|
||||
{
|
||||
mexui.Entity.Component.prototype[eventName].call(control, e, data);
|
||||
if(e.used)
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
mexui.Component.Window.prototype.addControl = function(control)
|
||||
{
|
||||
this.controls.push(control);
|
||||
return control;
|
||||
};
|
||||
|
||||
mexui.Component.Window.prototype.setShown = function(shown)
|
||||
{
|
||||
//var anyWindowShownBefore = mexui.isAnyWindowShown();
|
||||
|
||||
this.shown = shown;
|
||||
|
||||
if(mexui.focusedControl && this.isControlInWindow(mexui.focusedControl))
|
||||
{
|
||||
if(!shown)
|
||||
{
|
||||
mexui.focusedControl = null;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
if(shown)
|
||||
{
|
||||
if(!anyWindowShownBefore)
|
||||
mexui.bindEvents();
|
||||
}
|
||||
else
|
||||
{
|
||||
if(!mexui.isAnyWindowShown())
|
||||
mexui.unbindEvents();
|
||||
}
|
||||
*/
|
||||
};
|
||||
|
||||
mexui.Component.Window.prototype.isShown = function()
|
||||
{
|
||||
return this.shown;
|
||||
};
|
||||
|
||||
mexui.Component.Window.prototype.isControlInWindow = function(control)
|
||||
{
|
||||
for(var i in this.controls)
|
||||
{
|
||||
if(control == this.controls[i])
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
mexui.Component.Window.prototype.isCursorOverWindow = function()
|
||||
{
|
||||
return mexui.util.isCursorInRectangle(this.position, this.size);
|
||||
};
|
||||
|
||||
mexui.Component.Window.prototype.isCursorOverItem = function()
|
||||
{
|
||||
return this.isCursorOverWindow();
|
||||
};
|
||||
|
||||
mexui.Component.Window.prototype.getScreenPosition = function()
|
||||
{
|
||||
return this.position;
|
||||
};
|
||||
|
||||
mexui.Component.Window.prototype.getFirstShownControl = function()
|
||||
{
|
||||
for(var i in this.controls)
|
||||
{
|
||||
if(this.controls[i].shown)
|
||||
return this.controls[i];
|
||||
}
|
||||
return null;
|
||||
};
|
||||
|
||||
mexui.Component.Window.prototype.getNextShownControl = function(afterControl)
|
||||
{
|
||||
var controlIndex = this.controls.indexOf(afterControl);
|
||||
|
||||
if(this.controls[controlIndex + 1])
|
||||
return this.controls[controlIndex + 1];
|
||||
else
|
||||
return null;
|
||||
};
|
||||
|
||||
// api
|
||||
mexui.Component.Window.prototype.button = function(x, y, w, h, text, styles, callback) { return this.addControl(new mexui.Control.Button(this, x, y, w, h, text, styles, callback)); };
|
||||
mexui.Component.Window.prototype.character = function(x, y, w, h, text, styles, callback) { return this.addControl(new mexui.Control.Character(this, x, y, w, h, text, styles, callback)); };
|
||||
mexui.Component.Window.prototype.characters = function(x, y, w, h, text, styles, callback) { return this.addControl(new mexui.Control.Characters(this, x, y, w, h, text, styles, callback)); };
|
||||
mexui.Component.Window.prototype.checkBox = function(x, y, w, h, text, styles, callback) { return this.addControl(new mexui.Control.CheckBox(this, x, y, w, h, text, styles, callback)); };
|
||||
mexui.Component.Window.prototype.day = function(x, y, w, h, text, styles, callback) { return this.addControl(new mexui.Control.Day(this, x, y, w, h, text, styles, callback)); };
|
||||
mexui.Component.Window.prototype.date = function(x, y, w, h, text, styles, callback) { return this.addControl(new mexui.Control.Date(this, x, y, w, h, text, styles, callback)); };
|
||||
mexui.Component.Window.prototype.digit = function(x, y, w, h, text, styles, callback) { return this.addControl(new mexui.Control.Digit(this, x, y, w, h, text, styles, callback)); };
|
||||
mexui.Component.Window.prototype.digits = function(x, y, w, h, text, styles, callback) { return this.addControl(new mexui.Control.Digits(this, x, y, w, h, text, styles, callback)); };
|
||||
mexui.Component.Window.prototype.dropDown = function(x, y, w, h, text, styles, callback) { return this.addControl(new mexui.Control.DropDown(this, x, y, w, h, text, styles, callback)); };
|
||||
mexui.Component.Window.prototype.grid = function(x, y, w, h, styles) { return this.addControl(new mexui.Control.Grid(this, x, y, w, h, styles)); };
|
||||
mexui.Component.Window.prototype.hour = function(x, y, w, h, text, styles, callback) { return this.addControl(new mexui.Control.Hour(this, x, y, w, h, text, styles, callback)); };
|
||||
mexui.Component.Window.prototype.image = function(x, y, w, h, filePath, styles, callback) { return this.addControl(new mexui.Control.Image(this, x, y, w, h, filePath, styles, callback)); };
|
||||
mexui.Component.Window.prototype.integer = function(x, y, w, h, text, styles, callback) { return this.addControl(new mexui.Control.Integer(this, x, y, w, h, text, styles, callback)); };
|
||||
mexui.Component.Window.prototype.letter = function(x, y, w, h, text, styles, callback) { return this.addControl(new mexui.Control.Letter(this, x, y, w, h, text, styles, callback)); };
|
||||
mexui.Component.Window.prototype.letters = function(x, y, w, h, text, styles, callback) { return this.addControl(new mexui.Control.Letters(this, x, y, w, h, text, styles, callback)); };
|
||||
mexui.Component.Window.prototype.letterDigit = function(x, y, w, h, text, styles, callback) { return this.addControl(new mexui.Control.LetterDigit(this, x, y, w, h, text, styles, callback)); };
|
||||
mexui.Component.Window.prototype.lettersDigits = function(x, y, w, h, text, styles, callback) { return this.addControl(new mexui.Control.LettersDigits(this, x, y, w, h, text, styles, callback)); };
|
||||
mexui.Component.Window.prototype.line = function(x, y, w, h, styles, callback) { return this.addControl(new mexui.Control.Line(this, x, y, w, h, styles, callback)); };
|
||||
mexui.Component.Window.prototype.list = function(x, y, w, h, styles, callback) { return this.addControl(new mexui.Control.List(this, x, y, w, h, styles, callback)); };
|
||||
mexui.Component.Window.prototype.minute = function(x, y, w, h, text, styles, callback) { return this.addControl(new mexui.Control.Minute(this, x, y, w, h, text, styles, callback)); };
|
||||
mexui.Component.Window.prototype.month = function(x, y, w, h, text, styles, callback) { return this.addControl(new mexui.Control.Month(this, x, y, w, h, text, styles, callback)); };
|
||||
mexui.Component.Window.prototype.number = function(x, y, w, h, text, styles, callback) { return this.addControl(new mexui.Control.Number(this, x, y, w, h, text, styles, callback)); };
|
||||
mexui.Component.Window.prototype.password = function(x, y, w, h, text, styles, callback) { return this.addControl(new mexui.Control.Password(this, x, y, w, h, text, styles, callback)); };
|
||||
mexui.Component.Window.prototype.positiveInteger = function(x, y, w, h, text, styles, callback) { return this.addControl(new mexui.Control.PositiveInteger(this, x, y, w, h, text, styles, callback)); };
|
||||
mexui.Component.Window.prototype.positiveNumber = function(x, y, w, h, text, styles, callback) { return this.addControl(new mexui.Control.PositiveNumber(this, x, y, w, h, text, styles, callback)); };
|
||||
mexui.Component.Window.prototype.progressBar = function(x, y, w, h, text, styles) { return this.addControl(new mexui.Control.ProgressBar(this, x, y, w, h, text, styles)); };
|
||||
mexui.Component.Window.prototype.radioButton = function(x, y, w, h, text, groupId, styles, callback) { return this.addControl(new mexui.Control.RadioButton(this, x, y, w, h, text, groupId, styles, callback)); };
|
||||
mexui.Component.Window.prototype.rangedInteger = function(x, y, w, h, text, min, max, styles, callback) { return this.addControl(new mexui.Control.RangedInteger(this, x, y, w, h, text, min, max, styles, callback)); };
|
||||
mexui.Component.Window.prototype.rangedNumber = function(x, y, w, h, text, min, max, styles, callback) { return this.addControl(new mexui.Control.RangedNumber(this, x, y, w, h, text, min, max, styles, callback)); };
|
||||
mexui.Component.Window.prototype.rectangle = function(x, y, w, h, styles, callback) { return this.addControl(new mexui.Control.Rectangle(this, x, y, w, h, styles, callback)); };
|
||||
mexui.Component.Window.prototype.scrollBar = function(x, y, w, h, isVertical, styles, callback) { return this.addControl(new mexui.Control.ScrollBar(this, x, y, w, h, isVertical, styles, callback)); };
|
||||
mexui.Component.Window.prototype.second = function(x, y, w, h, text, styles, callback) { return this.addControl(new mexui.Control.Second(this, x, y, w, h, text, styles, callback)); };
|
||||
mexui.Component.Window.prototype.slider = function(x, y, w, h, isVertical, text, minText, maxText, styles, callback) { return this.addControl(new mexui.Control.Slider(this, x, y, w, h, isVertical, text, minText, maxText, styles, callback)); };
|
||||
mexui.Component.Window.prototype.tabPanel = function(x, y, w, h, styles, callback) { return this.addControl(new mexui.Control.TabPanel(this, x, y, w, h, styles, callback)); };
|
||||
mexui.Component.Window.prototype.text = function(x, y, w, h, text, styles) { return this.addControl(new mexui.Control.Text(this, x, y, w, h, text, styles)); };
|
||||
mexui.Component.Window.prototype.textArea = function(x, y, w, h, text, styles, callback) { return this.addControl(new mexui.Control.TextArea(this, x, y, w, h, text, styles, callback)); };
|
||||
mexui.Component.Window.prototype.textInput = function(x, y, w, h, text, styles, callback) { return this.addControl(new mexui.Control.TextInput(this, x, y, w, h, text, styles, callback)); };
|
||||
mexui.Component.Window.prototype.time = function(x, y, w, h, text, styles, callback) { return this.addControl(new mexui.Control.Time(this, x, y, w, h, text, styles, callback)); };
|
||||
mexui.Component.Window.prototype.tree = function(x, y, w, h, styles, callback) { return this.addControl(new mexui.Control.Tree(this, x, y, w, h, styles, callback)); };
|
||||
mexui.Component.Window.prototype.week = function(x, y, w, h, text, styles, callback) { return this.addControl(new mexui.Control.Week(this, x, y, w, h, text, styles, callback)); };
|
||||
mexui.Component.Window.prototype.weekDay = function(x, y, w, h, text, styles, callback) { return this.addControl(new mexui.Control.WeekDay(this, x, y, w, h, text, styles, callback)); };
|
||||
mexui.Component.Window.prototype.year = function(x, y, w, h, text, styles, callback) { return this.addControl(new mexui.Control.Year(this, x, y, w, h, text, styles, callback)); };
|
||||
|
||||
40
third-party/mexui/Core/Control/Button.js
vendored
@@ -1,40 +0,0 @@
|
||||
mexui.util.createControlConstructor('Button', false, function(window, x, y, w, h, text, styles, callback)
|
||||
{
|
||||
mexui.Component.Control.call(this, window, x, y, w, h, this.linkControlStyles('Button', styles), callback);
|
||||
|
||||
this.text = text;
|
||||
});
|
||||
|
||||
// default styles
|
||||
mexui.util.linkBaseControlStyles('Button', {});
|
||||
|
||||
// input
|
||||
mexui.Control.Button.prototype.onMouseDown = function(e)
|
||||
{
|
||||
if(e.button == 0 && this.isCursorOverControl())
|
||||
{
|
||||
e.used = true;
|
||||
this.checkToCallCallback();
|
||||
}
|
||||
};
|
||||
|
||||
mexui.Control.Button.prototype.onKeyDown = function(e, key, mods)
|
||||
{
|
||||
if(this.isFocused() && (key == SDLK_RETURN || key == SDLK_RETURN2 || key == SDLK_KP_ENTER || key == SDLK_SPACE))
|
||||
{
|
||||
e.used = true;
|
||||
this.checkToCallCallback();
|
||||
}
|
||||
};
|
||||
|
||||
// render
|
||||
mexui.Control.Button.prototype.render = function()
|
||||
{
|
||||
var pos = this.getScreenPosition();
|
||||
|
||||
mexui.native.drawRectangle(pos, this.size, this.getStyles('main'));
|
||||
mexui.native.drawText(pos, this.size, this.text, this.getStyles('main'));
|
||||
|
||||
if(this.isFocused())
|
||||
mexui.native.drawRectangleBorder(mexui.util.subtractVec2(pos,new Vec2(2,2)), mexui.util.addVec2(this.size,new Vec2(3,3)), this.getStyles('focused'));
|
||||
};
|
||||