diff --git a/config/animations.json b/config/animations.json
new file mode 100644
index 00000000..1a9ad99a
--- /dev/null
+++ b/config/animations.json
@@ -0,0 +1,129 @@
+{
+ "gta:iii": [
+ ["walk", 0, 0, 1, 0.0, null, null, null, null, 0],
+ ["jog", 0, 1, 1, 0.0, null, null, null, null, 0],
+ ["look1", 0, 7, 1, 0.0, null, null, null, null, 0],
+ ["tired", 0, 9, 1, 0.0, null, null, null, null, 0],
+ ["raisegun", 0, 10, 1, 0.0, null, null, null, null, 0],
+ ["wave", 0, 12, 1, 0.0, null, null, null, null, 0],
+ ["talk", 0, 11, 1, 0.0, null, null, null, null, 0],
+ ["stomachhit", 0, 18, 1, 0.0, null, null, null, null, 0],
+ ["headhit", 0, 18, 1, 0.0, null, null, null, null, 0],
+ ["throw1", 0, 53, 1, 0.0, null, null, null, null, 0],
+ ["throw2", 0, 54, 1, 0.0, null, null, null, null, 0],
+ ["punch1", 0, 54, 1, 0.0, null, null, null, null, 0],
+ ["headbutt", 0, 70, 1, 0.0, null, null, null, null, 0],
+ ["kick", 0, 71, 1, 0.0, null, null, null, null, 0],
+ ["kneekick", 0, 72, 1, 0.0, null, null, null, null, 0],
+ ["punch2", 0, 73, 1, 0.0, null, null, null, null, 0],
+ ["flipkick", 0, 74, 1, 0.0, null, null, null, null, 0],
+ ["bow", 0, 126, 1, 0.0, null, null, null, null, 0],
+ ["opendoor1", 0, 127, 1, 0.0, null, null, null, null, 0],
+ ["opendoor2", 0, 128, 1, 0.0, null, null, null, null, 0],
+ ["falling", 0, 151, 1, 0.0, null, null, null, null, 0],
+ ["dive", 0, 156, 1, 0.0, null, null, null, null, 0],
+ ["headscratch", 0, 157, 1, 0.0, null, null, null, null, 0],
+ ["look2", 0, 158, 1, 0.0, null, null, null, null, 0],
+ ["plant", 0, 162, 1, 0.0, null, null, null, null, 0],
+ ["cower", 0, 163, 1, 0.0, null, null, null, null, 0],
+ ["aimdown", 0, 160, 1, 0.0, null, null, null, null, 0],
+ ["aimcrouch", 0, 165, 1, 0.0, null, null, null, null, 0],
+ ["throw3", 0, 166, 1, 0.0, null, null, null, null, 0],
+ ["handsup", 0, 167, 1, 0.0, null, null, null, null, 0]
+ ],
+ "gta:vc": [
+ ["walk", 0, 0, 1, 0.0, null, null, null, null, 0],
+ ["jog", 0, 1, 1, 0.0, null, null, null, null, 0],
+ ["handcuffs", 0, 7, 1, 0.0, null, null, null, null, 0],
+ ["tired", 0, 9, 1, 0.0, null, null, null, null, 0],
+ ["raisegun", 0, 10, 1, 0.0, null, null, null, null, 0],
+ ["wave", 0, 12, 1, 0.0, null, null, null, null, 0],
+ ["talk", 0, 11, 1, 0.0, null, null, null, null, 0],
+ ["stomachhit", 0, 18, 1, 0.0, null, null, null, null, 0],
+ ["headhit", 0, 18, 1, 0.0, null, null, null, null, 0],
+ ["headbutt", 0, 49, 1, 0.0, null, null, null, null, 0],
+ ["kick", 0, 50, 1, 0.0, null, null, null, null, 0],
+ ["kneekick", 0, 51, 1, 0.0, null, null, null, null, 0],
+ ["throw2", 0, 54, 1, 0.0, null, null, null, null, 0],
+ ["punch1", 0, 52, 1, 0.0, null, null, null, null, 0],
+ ["punch2", 0, 53, 1, 0.0, null, null, null, null, 0],
+ ["flipkick", 0, 54, 1, 0.0, null, null, null, null, 0],
+ ["headscratch", 0, 152, 1, 0.0, null, null, null, null, 0],
+ ["aimdown", 0, 155, 1, 0.0, null, null, null, null, 0],
+ ["look2", 0, 153, 1, 0.0, null, null, null, null, 0],
+ ["handsup", 0, 161, 1, 0.0, null, null, null, null, 0],
+ ["cower", 0, 162, 1, 0.0, null, null, null, null, 0],
+ ["fucku", 0, 163, 1, 0.0, null, null, null, null, 0],
+ ["phone", 0, 166, 1, 0.0, null, null, null, null, 0],
+ ["sit", 0, 169, 1, 1.0, null, null, null, null, 0],
+ ["atm", 0, 171, 1, 0.0, null, null, null, null, 0],
+ ["cpr", 24, 214, 1, 0.0, null, null, null, null, 0],
+ ["idle1", 26, 215, 1, 0.0, null, null, null, null, 0],
+ ["idle2", 26, 216, 1, 0.0, null, null, null, null, 0],
+ ["idle3", 26, 217, 1, 0.0, null, null, null, null, 0],
+ ["idle4", 26, 218, 1, 0.0, null, null, null, null, 0],
+ ["dance1", 28, 226, 1, 0.0, null, null, null, null, 0],
+ ["dance2", 28, 227, 1, 0.0, null, null, null, null, 0],
+ ["dance3", 28, 228, 1, 0.0, null, null, null, null, 0],
+ ["dance4", 28, 229, 1, 0.0, null, null, null, null, 0],
+ ["dance5", 28, 230, 1, 0.0, null, null, null, null, 0],
+ ["dance6", 28, 231, 1, 0.0, null, null, null, null, 0],
+ ["dance7", 28, 232, 1, 0.0, null, null, null, null, 0],
+ ["sitright", 0, 169, 1, 0.0, null, null, null, null, 4],
+ ["sitleft", 0, 169, 1, 0.0, null, null, null, null, 3],
+ ["sitforward", 0, 169, 1, 0.0, null, null, null, null, 1],
+ ["sitback", 0, 169, 1, 0.0, null, null, null, null, 2]
+ ],
+ "gta:sa":[
+ ["walk", 0, 0, 1, 0.0, null, null, null, null, 0],
+ ["jog", 0, 1, 1, 0.0, null, null, null, null, 0],
+ ["look1", 0, 4, 1, 0.0, null, null, null, null, 0],
+ ["holdrifle", 0, 11, 1, 0.0, null, null, null, null, 0],
+ ["talk1", 0, 12, 1, 0.0, null, null, null, null, 0],
+ ["wave1", 0, 13, 1, 0.0, null, null, null, null, 0],
+ ["swim1", 0, 14, 1, 0.0, null, null, null, null, 0],
+ ["die1", 0, 15, 1, 0.0, null, null, null, null, 0],
+ ["die2", 0, 16, 1, 0.0, null, null, null, null, 0],
+ ["diehead", 0, 19, 1, 0.0, null, null, null, null, 0],
+ ["diestomach", 0, 20, 1, 0.0, null, null, null, null, 0],
+ ["choke", 0, 21, 1, 0.0, null, null, null, null, 0],
+ ["remotepress", 0, 48, 1, 0.0, null, null, null, null, 0],
+ ["pickup1", 0, 99, 1, 0.0, null, null, null, null, 0],
+ ["pickup2", 0, 100, 1, 0.0, null, null, null, null, 0],
+ ["backhandright", 0, 103, 1, 0.0, null, null, null, null, 0],
+ ["backhandleft", 0, 104, 1, 0.0, null, null, null, null, 0],
+ ["knockback", 0, 105, 1, 0.0, null, null, null, null, 0],
+ ["idle1", 0, 135, 1, 0.0, null, null, null, null, 0],
+ ["knockback", 0, 105, 1, 0.0, null, null, null, null, 0],
+ ["cower", 0, 141, 1, 0.0, null, null, null, null, 0],
+ ["handsup", 0, 142, 1, 0.0, null, null, null, null, 0],
+ ["fucku", 0, 144, 1, 0.0, null, null, null, null, 0],
+ ["phoneout", 0, 145, 1, 0.0, null, null, null, null, 0],
+ ["phonein", 0, 146, 1, 0.0, null, null, null, null, 0],
+ ["phonetalk", 0, 146, 1, 0.0, null, null, null, null, 0],
+ ["sit1", 0, 150, 1, 0.0, null, null, null, null, 0],
+ ["atm", 0, 151, 1, 0.0, null, null, null, null, 0],
+ ["mindtrick", 0, 153, 1, 0.0, null, null, null, null, 0],
+ ["faceshocked", 0, 150, 1, 0.0, null, null, null, null, 0],
+ ["facesurprised", 0, 150, 1, 0.0, null, null, null, null, 0],
+ ["faceconfused", 0, 150, 1, 0.0, null, null, null, null, 0],
+ ["faceangry", 0, 159, 1, 0.0, null, null, null, null, 0],
+ ["facetalk1", 0, 160, 1, 0.0, null, null, null, null, 0],
+ ["look2", 0, 165, 1, 0.0, null, null, null, null, 0],
+ ["gestureno", 0, 166, 1, 0.0, null, null, null, null, 0],
+ ["gestureyes", 0, 167, 1, 0.0, null, null, null, null, 0],
+ ["wave2", 0, 168, 1, 0.0, null, null, null, null, 0],
+ ["snort", 0, 169, 1, 0.0, null, null, null, null, 0],
+ ["sitright", 0, 150, 1, 0.0, null, null, null, null, 4],
+ ["sitleft", 0, 150, 1, 0.0, null, null, null, null, 3],
+ ["sitforward", 0, 150, 1, 0.0, null, null, null, null, 1],
+ ["sitback", 0, 150, 1, 0.0, null, null, null, null, 2]
+ ],
+ "invalid1": [
+
+ ],
+ "gta:iv":
+ [
+ ["dance1", "DAN_LOOP_A", "DANCING", 1, 16.0, true, false, true, false, 0]
+ ]
+}
\ No newline at end of file
diff --git a/meta.xml b/meta.xml
index 2ffeb80f..dae4dbea 100644
--- a/meta.xml
+++ b/meta.xml
@@ -8,12 +8,12 @@
-
+
-
+
@@ -97,6 +97,19 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/scripts/client/event.js b/scripts/client/event.js
index 17ff4e58..5ad624bb 100644
--- a/scripts/client/event.js
+++ b/scripts/client/event.js
@@ -93,6 +93,7 @@ function onProcess(event, deltaTime) {
forceLocalPlayerEquippedWeaponItem();
processWantedLevelReset();
processGameSpecifics();
+ processNearbyPickups();
}
// ===========================================================================
diff --git a/scripts/client/gui.js b/scripts/client/gui.js
index c6f9847b..33b3b0d2 100644
--- a/scripts/client/gui.js
+++ b/scripts/client/gui.js
@@ -26,16 +26,7 @@ let textInputAlpha = 180;
let guiReady = false;
-// ===========================================================================
-
-let login = {
- window: null,
- logoImage: null,
- messageLabel: null,
- passwordLabel: null,
- passwordInput: null,
- loginButton: null,
-};
+//let mexui = findResourceByName("mexui").exports.getMexUI();
// ===========================================================================
@@ -51,45 +42,6 @@ let twoFactorAuth = {
// ===========================================================================
-let register = {
- window: null,
- logoImage: null,
- messageLabel: null,
- passwordInput: null,
- confirmPasswordInput: null,
- emailInput: null,
- registerButton: null,
-};
-
-// ===========================================================================
-
-let newCharacter = {
- window: null,
- firstNameInput: null,
- lastNameInput: null,
- skinDropDown: null,
- spawnAreaDropDown: null,
- createButton: null,
-};
-
-// ===========================================================================
-
-let errorDialog = {
- window: null,
- messageLabel: null,
- okayButton: null,
-};
-
-// ===========================================================================
-
-let infoDialog = {
- window: null,
- messageLabel: null,
- okayButton: null,
-};
-
-// ===========================================================================
-
let listDialog = {
window: null,
messageLabel: null,
@@ -98,30 +50,6 @@ let listDialog = {
// ===========================================================================
-let yesNoDialog = {
- window: null,
- messageLabel: null,
- yesButton: null,
- noButton: null,
-};
-
-// ===========================================================================
-
-let characterSelect = {
- window: null,
- skinImage: null,
- nameText: null,
- cashText: null,
- clanText: null,
- lastPlayedText: null,
- previousCharacterButton: null,
- nextCharacterButton: null,
- selectCharacterButton: null,
- newCharacterButton: null,
-};
-
-// ===========================================================================
-
let placesOfOrigin = [
"Liberty City",
"Vice City",
@@ -155,84 +83,14 @@ function initGUIScript() {
function initGUI() {
logToConsole(LOG_DEBUG, `[VRR.GUI] Initializing GUI ...`);
- logToConsole(LOG_DEBUG, `[VRR.GUI] Creating login GUI ...`);
- login.window = mexui.window(game.width/2-150, game.height/2-129, 300, 258, 'LOGIN', {
- main: {
- backgroundColour: toColour(windowColour[0], windowColour[1], windowColour[2], windowColour[3]),
- 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.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: robotoFont,
- },
- 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: robotoFont,
- },
- caret: {
- lineColour: toColour(255, 255, 255, 255),
- },
- placeholder: {
- textColour: toColour(200, 200, 200, 150),
- textSize: 10.0,
- textFont: robotoFont,
- },
- 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: 10.0,
- textFont: robotoFont,
- textAlign: 0.5,
- },
- focused: {
- borderColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], buttonAlpha),
- },
- }, checkLogin);
-
- logToConsole(LOG_DEBUG, `[VRR.GUI] Created login GUI`);
-
- // ===========================================================================
+ initLoginGUI();
+ initRegisterGUI();
+ initNewCharacterGUI();
+ initCharacterSelectGUI();
+ initInfoDialogGUI();
+ initErrorDialogGUI();
+ initYesNoDialogGUI();
+ //initResetPasswordGUI();
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', {
@@ -312,361 +170,6 @@ function initGUI() {
// ===========================================================================
- logToConsole(LOG_DEBUG, `[VRR.GUI] Creating new character GUI ...`);
- newCharacter.window = mexui.window(game.width/2-130, game.height/2-100, 300, 200, 'Character Name', {
- main: {
- backgroundColour: toColour(windowColour[0], windowColour[1], windowColour[2], windowColour[3]),
- transitionTime: 500,
- },
- title: {
- textSize: 0.0,
- textColour: toColour(0, 0, 0, 0),
- backgroundColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], windowTitleAlpha),
- },
- icon: {
- textSize: 0.0,
- textColour: toColour(0, 0, 0, 0),
- backgroundColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], windowTitleAlpha),
- }
- });
- newCharacter.window.titleBarIconSize = toVector2(0,0);
- newCharacter.window.titleBarHeight = 0;
-
- newCharacter.window.image(115, 10, 65, 65, mainLogoPath, {
- focused: {
- borderColour: toColour(0, 0, 0, 0),
- },
- });
-
- newCharacter.messageLabel = newCharacter.window.text(20, 75, 260, 20, 'Name your character', {
- main: {
- textSize: 10.0,
- textAlign: 0.5,
- textColour: toColour(200, 200, 200, 255),
- textFont: robotoFont,
- },
- focused: {
- borderColour: toColour(0, 0, 0, 0),
- },
- });
-
- newCharacter.firstNameInput = newCharacter.window.textInput(20, 100, 260, 25, '', {
- main: {
- backgroundColour: toColour(0, 0, 0, 120),
- textColour: toColour(200, 200, 200, 255),
- textSize: 10.0,
- textFont: robotoFont,
- },
- caret: {
- lineColour: toColour(255, 255, 255, 255),
- },
- placeholder: {
- backgroundColour: toColour(0, 0, 0, 120),
- textColour: toColour(200, 200, 200, 200),
- textSize: 10.0,
- textFont: robotoFont,
- }
- });
- newCharacter.firstNameInput.placeholder = "First Name";
-
- newCharacter.lastNameInput = newCharacter.window.textInput(20, 130, 260, 25, '', {
- main: {
- backgroundColour: toColour(0, 0, 0, 120),
- textColour: toColour(200, 200, 200, 255),
- textSize: 10.0,
- textFont: robotoFont,
- },
- caret: {
- lineColour: toColour(255, 255, 255, 255),
- },
- placeholder: {
- backgroundColour: toColour(0, 0, 0, 120),
- textColour: toColour(150, 150, 150, 200),
- textSize: 10.0,
- textFont: robotoFont,
- }
- });
- newCharacter.lastNameInput.placeholder = "Last Name";
-
- newCharacter.createCharacterButton = newCharacter.window.button(20, 160, 260, 25, 'CREATE CHARACTER', {
- main: {
- backgroundColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], buttonAlpha),
- textColour: toColour(255, 255, 255, 255),
- textSize: 12.0,
- textFont: robotoFont,
- textAlign: 0.5,
- },
- focused: {
- borderColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], buttonAlpha),
- },
- }, checkNewCharacter);
- logToConsole(LOG_DEBUG, `[VRR.GUI] Created new character GUI`);
-
- // ===========================================================================
-
- logToConsole(LOG_DEBUG, `[VRR.GUI] Creating register GUI ...`);
- register.window = mexui.window(game.width/2-130, game.height/2-125, 300, 250, 'Register', {
- main: {
- backgroundColour: toColour(windowColour[0], windowColour[1], windowColour[2], windowColour[3]),
- 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.image(115, 10, 65, 65, mainLogoPath, {
- focused: {
- borderColour: toColour(0, 0, 0, 0),
- },
- });
-
- register.messageLabel = register.window.text(20, 75, 260, 20, 'Create an account', {
- main: {
- textSize: 10.0,
- textAlign: 0.5,
- textColour: toColour(200, 200, 200, 255),
- textFont: robotoFont,
- },
- focused: {
- borderColour: toColour(0, 0, 0, 0),
- },
- });
-
- register.passwordInput = register.window.textInput(20, 100, 260, 25, '', {
- main: {
- backgroundColour: toColour(0, 0, 0, 120),
- textColour: toColour(200, 200, 200, 255),
- textSize: 10.0,
- textFont: robotoFont,
- },
- caret: {
- lineColour: toColour(255, 255, 255, 255),
- },
- placeholder: {
- backgroundColour: toColour(0, 0, 0, 120),
- textColour: toColour(200, 200, 200, 200),
- textSize: 10.0,
- textFont: robotoFont,
- }
- });
- register.passwordInput.masked = true;
- register.passwordInput.placeholder = "Password";
-
- register.confirmPasswordInput = register.window.textInput(20, 130, 260, 25, '', {
- main: {
- backgroundColour: toColour(0, 0, 0, 120),
- textColour: toColour(200, 200, 200, 255),
- textSize: 10.0,
- textFont: robotoFont,
- },
- caret: {
- lineColour: toColour(255, 255, 255, 255),
- },
- placeholder: {
- backgroundColour: toColour(0, 0, 0, 120),
- textColour: toColour(200, 200, 200, 200),
- textSize: 10.0,
- textFont: robotoFont,
- }
- });
- register.confirmPasswordInput.masked = true;
- register.confirmPasswordInput.placeholder = "Confirm password";
-
- register.emailInput = register.window.textInput(20, 160, 260, 25, '', {
- main: {
- backgroundColour: toColour(0, 0, 0, 120),
- textColour: toColour(200, 200, 200, 255),
- textSize: 10.0,
- textFont: robotoFont,
- },
- caret: {
- lineColour: toColour(255, 255, 255, 255),
- },
- placeholder: {
- backgroundColour: toColour(0, 0, 0, 120),
- textColour: toColour(200, 200, 200, 200),
- textSize: 10.0,
- textFont: robotoFont,
- }
- });
- register.emailInput.placeholder = "Email";
-
- register.registerButton = register.window.button(20, 195, 260, 30, 'CREATE ACCOUNT', {
- main: {
- backgroundColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], buttonAlpha),
- textColour: toColour(255, 255, 255, 255),
- textSize: 12.0,
- textFont: robotoFont,
- textAlign: 0.5,
- },
- focused: {
- borderColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], buttonAlpha),
- },
- }, checkRegistration);
- logToConsole(LOG_DEBUG, `[VRR.GUI] Created register GUI`);
-
- // ===========================================================================
-
- logToConsole(LOG_DEBUG, `[VRR.GUI] Creating error GUI ...`);
- errorDialog.window = mexui.window(game.width/2-200, game.height/2-70, 500, 140, 'ERROR', {
- main: {
- backgroundColour: toColour(windowColour[0], windowColour[1], windowColour[2], windowColour[3]),
- transitionTime: 500,
- },
- title: {
- textSize: 11.0,
- textColour: toColour(0, 0, 0, 255),
- backgroundColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], windowTitleAlpha),
- },
- icon: {
- textSize: 0.0,
- textColour: toColour(0, 0, 0, 0),
- backgroundColour: toColour(0, 0, 0, 0),
- },
- });
-
- errorDialog.messageLabel = errorDialog.window.text(15, 50, 470, 75, 'Error Message', {
- main: {
- textSize: 10.0,
- textAlign: 0.5,
- textColour: toColour(255, 255, 255, 255),
- textFont: robotoFont,
- },
- focused: {
- borderColour: toColour(0, 0, 0, 0),
- },
- });
-
- errorDialog.okayButton = errorDialog.window.button(20, 95, 360, 30, 'OK', {
- main: {
- backgroundColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], buttonAlpha),
- textColour: toColour(0, 0, 0, 255),
- textSize: 10.0,
- textFont: robotoFont,
- textAlign: 0.5,
- },
- focused: {
- borderColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], 255),
- },
- }, closeErrorDialog);
- logToConsole(LOG_DEBUG, `[VRR.GUI] Created error GUI ...`);
-
- // ===========================================================================
-
- 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(windowColour[0], windowColour[1], windowColour[2], windowColour[3]),
- transitionTime: 500,
- },
- title: {
- textSize: 11.0,
- textColour: toColour(0, 0, 0, 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: robotoFont,
- },
- focused: {
- borderColour: toColour(0, 0, 0, 0),
- },
- });
-
- yesNoDialog.yesButton = yesNoDialog.window.button(20, 95, 175, 30, 'YES', {
- main: {
- backgroundColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], buttonAlpha),
- textColour: toColour(0, 0, 0, 255),
- textSize: 10.0,
- textFont: robotoFont,
- textAlign: 0.5,
- },
- focused: {
- borderColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], 255),
- },
- }, yesNoDialogAnswerYes);
-
- yesNoDialog.noButton = yesNoDialog.window.button(205, 95, 175, 30, 'NO', {
- main: {
- backgroundColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], buttonAlpha),
- textColour: toColour(0, 0, 0, 255),
- textSize: 10.0,
- textFont: robotoFont,
- textAlign: 0.5,
- },
- focused: {
- borderColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], 255),
- },
- }, yesNoDialogAnswerNo);
- logToConsole(LOG_DEBUG, `[VRR.GUI] Created prompt GUI`);
-
- // ===========================================================================
-
- logToConsole(LOG_DEBUG, `[VRR.GUI] Creating info dialog GUI ...`);
- infoDialog.window = mexui.window(game.width/2-200, game.height/2-70, 400, 140, 'Information', {
- main: {
- backgroundColour: toColour(windowColour[0], windowColour[1], windowColour[2], windowColour[3]),
- },
- title: {
- textSize: 11.0,
- textColour: toColour(0, 0, 0, 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: robotoFont,
- },
- focused: {
- borderColour: toColour(0, 0, 0, 0),
- },
- });
-
- infoDialog.okayButton = infoDialog.window.button(20, 95, 360, 30, 'OK', {
- main: {
- backgroundColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], buttonAlpha),
- textColour: toColour(0, 0, 0, 255),
- textSize: 10.0,
- textFont: robotoFont,
- textAlign: 0.5,
- },
- focused: {
- borderColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], 255),
- },
- }, closeInfoDialog);
- logToConsole(LOG_DEBUG, `[VRR.GUI] Created info dialog GUI`);
-
-// ===========================================================================
-
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: {
@@ -725,132 +228,6 @@ function initGUI() {
// ===========================================================================
- logToConsole(LOG_DEBUG, `[VRR.GUI] Creating character select GUI ...`);
- characterSelect.window = mexui.window(game.width/2-215, game.height/2-83, 430, 190, 'Select Character', {
- main: {
- backgroundColour: toColour(windowColour[0], windowColour[1], windowColour[2], windowColour[3]),
- },
- title: {
- textSize: 11.0,
- textColour: toColour(0, 0, 0, 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),
- }
- });
-
- 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: robotoFont,
- },
- 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: robotoFont,
- },
- 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: robotoFont,
- },
- 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: robotoFont,
- },
- focused: {
- borderColour: toColour(0, 0, 0, 0),
- }
- });
-
- characterSelect.selectCharacterButton = characterSelect.window.button(85, 130, 260, 25, 'SELECT', {
- main: {
- backgroundColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], buttonAlpha),
- textColour: toColour(0, 0, 0, 255),
- textSize: 12.0,
- textFont: robotoFont,
- 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(0, 0, 0, 255),
- textSize: 12.0,
- textFont: robotoFont,
- 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(0, 0, 0, 255),
- textSize: 10.0,
- textFont: robotoFont,
- 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(0, 0, 0, 255),
- textSize: 10.0,
- textFont: robotoFont,
- 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`);
-
- // ===========================================================================
-
logToConsole(LOG_DEBUG, `[VRR.GUI] All GUI created successfully!`);
closeAllWindows();
@@ -859,92 +236,6 @@ function initGUI() {
// ===========================================================================
-let checkLogin = function() {
- logToConsole(LOG_DEBUG, `[VRR.GUI] Checking login with server ...`);
- triggerNetworkEvent("vrr.checkLogin", login.passwordInput.lines[0]);
-}
-
-// ===========================================================================
-
-let loginFailed = function(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 = "";
-}
-
-// ===========================================================================
-
-let loginSuccess = function() {
- logToConsole(LOG_DEBUG, `[VRR.GUI] Server reports login was successful`);
- closeAllWindows();
-}
-
-// ===========================================================================
-
-let checkRegistration = function() {
- logToConsole(LOG_DEBUG, `[VRR.GUI] Checking registration with server ...`);
- triggerNetworkEvent("vrr.checkRegistration", register.passwordInput.lines[0], register.confirmPasswordInput.lines[0], register.emailInput.lines[0]);
-}
-
-// ===========================================================================
-
-let checkNewCharacter = function() {
- logToConsole(LOG_DEBUG, `[VRR.GUI] Checking new character with server ...`);
- let skinId = false;
-
- if(newCharacter.firstNameInput.lines[0].length < 2) {
- return false;
- }
-
- if(newCharacter.lastNameInput.lines[0].length < 2) {
- return false;
- }
-
- triggerNetworkEvent("vrr.checkNewCharacter",
- newCharacter.firstNameInput.lines[0],
- newCharacter.lastNameInput.lines[0],
- );
-}
-
-// ===========================================================================
-
-let registrationFailed = function(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 = "";
-}
-
-// ===========================================================================
-
-let newCharacterFailed = function(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;
- }
-}
-
-// ===========================================================================
-
-let registrationSuccess = function() {
- logToConsole(LOG_DEBUG, `[VRR.GUI] Server reports registration was successful`);
- closeAllWindows();
-}
-
-// ===========================================================================
-
let twoFactorAuthFailed = function(errorMessage) {
logToConsole(LOG_DEBUG, `[VRR.GUI] Server reports two-factor authentication failed. Reason: ${errorMessage}`);
login.messageLabel.text = errorMessage;
@@ -968,29 +259,6 @@ let checkTwoFactorAuth = function() {
// ===========================================================================
-let characterSelectSuccess = function() {
- logToConsole(LOG_DEBUG, `[VRR.GUI] Server reports character selection was successful`);
- closeAllWindows();
-}
-
-// ===========================================================================
-
-let closeErrorDialog = function() {
- logToConsole(LOG_DEBUG, `[VRR.GUI] Closing error dialog`);
- errorDialog.window.shown = false;
- mexui.setInput(false);
-}
-
-// ===========================================================================
-
-let closeInfoDialog = function() {
- logToConsole(LOG_DEBUG, `[VRR.GUI] Closing info dialog`);
- infoDialog.window.shown = false;
- mexui.setInput(false);
-}
-
-// ===========================================================================
-
let closeAllWindows = function() {
logToConsole(LOG_DEBUG, `[VRR.GUI] Closing all GUI windows`);
infoDialog.window.shown = false;
@@ -1007,42 +275,6 @@ let closeAllWindows = function() {
// ===========================================================================
-let yesNoDialogAnswerNo = function() {
- logToConsole(LOG_DEBUG, `[VRR.GUI] Responding with answer NO to server prompt`);
- triggerNetworkEvent("vrr.promptAnswerNo");
- closeAllWindows();
-}
-
-// ===========================================================================
-
-let yesNoDialogAnswerYes = function() {
- logToConsole(LOG_DEBUG, `[VRR.GUI] Responding with answer YES to server prompt`);
- triggerNetworkEvent("vrr.promptAnswerYes");
- closeAllWindows();
-}
-
-// ===========================================================================
-
-let showRegistration = function() {
- logToConsole(LOG_DEBUG, `[VRR.GUI] Showing registration window`);
- closeAllWindows();
- setChatWindowEnabled(false);
- mexui.setInput(true);
- register.window.shown = true;
-}
-
-// ===========================================================================
-
-let showLogin = function() {
- closeAllWindows();
- logToConsole(LOG_DEBUG, `[VRR.GUI] Showing login window`);
- setChatWindowEnabled(false);
- mexui.setInput(true);
- login.window.shown = true;
-}
-
-// ===========================================================================
-
let showTwoFactorAuth = function() {
closeAllWindows();
logToConsole(LOG_DEBUG, `[VRR.GUI] Showing two-factor authentication window`);
@@ -1053,96 +285,6 @@ let showTwoFactorAuth = function() {
// ===========================================================================
-let showCharacterSelect = function(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;
-}
-
-// ===========================================================================
-
-let showError = function(errorMessage, errorTitle) {
- closeAllWindows();
- logToConsole(LOG_DEBUG, `[VRR.GUI] Showing error window. Error: ${errorTitle} - ${errorMessage}`);
- setChatWindowEnabled(false);
- mexui.setInput(true);
- errorDialog.messageLabel.text = errorMessage;
- errorDialog.window.shown = true;
-}
-
-// ===========================================================================
-
-let showYesNo = function(promptMessage, promptTitle) {
- closeAllWindows();
- logToConsole(LOG_DEBUG, `[VRR.GUI] Showing prompt window. Prompt: ${promptTitle} - ${promptMessage}`);
- mexui.setInput(true);
- yesNoDialog.messageLabel.text = promptMessage;
- yesNoDialog.window.shown = true;
-}
-
-// ===========================================================================
-
-let showInfo = function(infoMessage, infoTitle) {
- closeAllWindows();
- logToConsole(LOG_DEBUG, `[VRR.GUI] Showing info dialog window. Info: ${infoTitle} - ${infoMessage}`);
- mexui.setInput(true);
- infoDialog.messageLabel.text = infoMessage;
- infoDialog.window.shown = true;
-}
-
-// ===========================================================================
-
-let showNewCharacter = function() {
- closeAllWindows();
- logToConsole(LOG_DEBUG, `[VRR.GUI] Showing new character dialog window`);
- setChatWindowEnabled(false);
- mexui.setInput(true);
- setHUDEnabled(false);
- newCharacter.window.shown = true;
-}
-
-// ===========================================================================
-
-let selectNextCharacter = function() {
- logToConsole(LOG_DEBUG, `[VRR.GUI] Requesting next character info from server for character select window`);
- triggerNetworkEvent("vrr.nextCharacter");
-}
-
-// ===========================================================================
-
-let selectPreviousCharacter = function() {
- logToConsole(LOG_DEBUG, `[VRR.GUI] Requesting previous character info from server for character select window`);
- triggerNetworkEvent("vrr.previousCharacter");
-}
-
-// ===========================================================================
-
-let selectThisCharacter = function() {
- logToConsole(LOG_DEBUG, `[VRR.GUI] Tell server the current shown character was selected in character select window`);
- triggerNetworkEvent("vrr.selectCharacter");
-}
-
-// ===========================================================================
-
-let switchCharacterSelect = function(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}`;
- characterSelect.skinImage = characterSelect.window.image(310, 32, 100, 90, "files/images/skins/none.png");
- characterSelect.window.shown = true;
-}
-
let isAnyGUIActive = function() {
if(!guiReady) {
if(infoDialog.window.shown) {
@@ -1187,37 +329,16 @@ let isAnyGUIActive = function() {
// ===========================================================================
-addNetworkHandler("vrr.showLogin", function() {
- logToConsole(LOG_DEBUG, `[VRR.GUI] Received request from server to show login window`);
- showLogin();
-});
-
-// ===========================================================================
-
-addNetworkHandler("vrr.showRegistration", function() {
- logToConsole(LOG_DEBUG, `[VRR.GUI] Received request from server to show registration window`);
- showRegistration();
-});
-
-// ===========================================================================
-
-addNetworkHandler("vrr.showNewCharacter", function() {
- logToConsole(LOG_DEBUG, `[VRR.GUI] Received request from server to show new character window`);
- showNewCharacter();
-});
-
-// ===========================================================================
-
addNetworkHandler("vrr.showCharacterSelect", function(firstName, lastName, cash, clan, lastPlayed, skinId) {
logToConsole(LOG_DEBUG, `[VRR.GUI] Received request from server to show character selection window`);
- showCharacterSelect(firstName, lastName, cash, clan, lastPlayed, skinId);
+ showCharacterSelectGUI(firstName, lastName, cash, clan, lastPlayed, skinId);
});
// ===========================================================================
addNetworkHandler("vrr.switchCharacterSelect", function(firstName, lastName, cash, clan, lastPlayed, skinId) {
logToConsole(LOG_DEBUG, `[VRR.GUI] Received request from server to update character selection window with new info`);
- switchCharacterSelect(firstName, lastName, cash, clan, lastPlayed, skinId);
+ switchCharacterSelectGUI(firstName, lastName, cash, clan, lastPlayed, skinId);
});
// ===========================================================================
@@ -1231,7 +352,7 @@ addNetworkHandler("vrr.showError", function(errorMessage, errorTitle) {
addNetworkHandler("vrr.showPrompt", function(promptMessage, promptTitle) {
logToConsole(LOG_DEBUG, `[VRR.GUI] Received request from server to show prompt window`);
- showYesNo(promptMessage, promptTitle);
+ showYesNoPromptGUI(promptMessage, promptTitle);
});
// ===========================================================================
diff --git a/scripts/client/gui/bizmgr.js b/scripts/client/gui/bizmgr.js
new file mode 100644
index 00000000..e69de29b
diff --git a/scripts/client/gui/charselect.js b/scripts/client/gui/charselect.js
new file mode 100644
index 00000000..7d6ec112
--- /dev/null
+++ b/scripts/client/gui/charselect.js
@@ -0,0 +1,210 @@
+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(windowColour[0], windowColour[1], windowColour[2], windowColour[3]),
+ },
+ title: {
+ textSize: 11.0,
+ textColour: toColour(0, 0, 0, 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),
+ }
+ });
+
+ 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: robotoFont,
+ },
+ 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: robotoFont,
+ },
+ 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: robotoFont,
+ },
+ 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: robotoFont,
+ },
+ focused: {
+ borderColour: toColour(0, 0, 0, 0),
+ }
+ });
+
+ characterSelect.selectCharacterButton = characterSelect.window.button(85, 130, 260, 25, 'SELECT', {
+ main: {
+ backgroundColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], buttonAlpha),
+ textColour: toColour(0, 0, 0, 255),
+ textSize: 12.0,
+ textFont: robotoFont,
+ 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(0, 0, 0, 255),
+ textSize: 12.0,
+ textFont: robotoFont,
+ 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(0, 0, 0, 255),
+ textSize: 10.0,
+ textFont: robotoFont,
+ 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(0, 0, 0, 255),
+ textSize: 10.0,
+ textFont: robotoFont,
+ 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;
+}
+
+// ===========================================================================
+
+function showNewCharacter() {
+ closeAllWindows();
+ logToConsole(LOG_DEBUG, `[VRR.GUI] Showing new character dialog window`);
+ setChatWindowEnabled(false);
+ mexui.setInput(true);
+ setHUDEnabled(false);
+ newCharacter.window.shown = true;
+}
+
+// ===========================================================================
+
+function selectNextCharacter() {
+ logToConsole(LOG_DEBUG, `[VRR.GUI] Requesting next character info from server for character select window`);
+ triggerNetworkEvent("vrr.nextCharacter");
+}
+
+// ===========================================================================
+
+function selectPreviousCharacter() {
+ logToConsole(LOG_DEBUG, `[VRR.GUI] Requesting previous character info from server for character select window`);
+ triggerNetworkEvent("vrr.previousCharacter");
+}
+
+// ===========================================================================
+
+function selectThisCharacter() {
+ logToConsole(LOG_DEBUG, `[VRR.GUI] Tell server the current shown character was selected in character select window`);
+ triggerNetworkEvent("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}`;
+ characterSelect.skinImage = characterSelect.window.image(310, 32, 100, 90, "files/images/skins/none.png");
+ characterSelect.window.shown = true;
+}
+
+// ===========================================================================
+
+function characterSelectSuccess() {
+ logToConsole(LOG_DEBUG, `[VRR.GUI] Server reports character selection was successful`);
+ closeAllWindows();
+}
+
+// ===========================================================================
\ No newline at end of file
diff --git a/scripts/client/gui/clanmgr.js b/scripts/client/gui/clanmgr.js
new file mode 100644
index 00000000..e69de29b
diff --git a/scripts/client/gui/error.js b/scripts/client/gui/error.js
new file mode 100644
index 00000000..d4136512
--- /dev/null
+++ b/scripts/client/gui/error.js
@@ -0,0 +1,74 @@
+let errorDialog = {
+ window: null,
+ messageLabel: null,
+ okayButton: null,
+};
+
+// ===========================================================================
+
+function initErrorDialogGUI() {
+ logToConsole(LOG_DEBUG, `[VRR.GUI] Creating error GUI ...`);
+ errorDialog.window = mexui.window(game.width/2-200, game.height/2-70, 500, 140, 'ERROR', {
+ main: {
+ backgroundColour: toColour(windowColour[0], windowColour[1], windowColour[2], windowColour[3]),
+ transitionTime: 500,
+ },
+ title: {
+ textSize: 11.0,
+ textColour: toColour(0, 0, 0, 255),
+ backgroundColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], windowTitleAlpha),
+ },
+ icon: {
+ textSize: 0.0,
+ textColour: toColour(0, 0, 0, 0),
+ backgroundColour: toColour(0, 0, 0, 0),
+ },
+ });
+
+ errorDialog.messageLabel = errorDialog.window.text(15, 50, 470, 75, 'Error Message', {
+ main: {
+ textSize: 10.0,
+ textAlign: 0.5,
+ textColour: toColour(255, 255, 255, 255),
+ textFont: robotoFont,
+ },
+ focused: {
+ borderColour: toColour(0, 0, 0, 0),
+ },
+ });
+
+ errorDialog.okayButton = errorDialog.window.button(20, 95, 360, 30, 'OK', {
+ main: {
+ backgroundColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], buttonAlpha),
+ textColour: toColour(0, 0, 0, 255),
+ textSize: 10.0,
+ textFont: robotoFont,
+ 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) {
+ closeAllWindows();
+ logToConsole(LOG_DEBUG, `[VRR.GUI] Showing error window. Error: ${errorTitle} - ${errorMessage}`);
+ setChatWindowEnabled(false);
+ mexui.setInput(true);
+ errorDialog.messageLabel.text = errorMessage;
+ errorDialog.window.shown = true;
+}
+
+// ===========================================================================
+
+function closeErrorDialog() {
+ logToConsole(LOG_DEBUG, `[VRR.GUI] Closing error dialog`);
+ errorDialog.window.shown = false;
+ mexui.setInput(false);
+}
+
+// ===========================================================================
\ No newline at end of file
diff --git a/scripts/client/gui/housemgr.js b/scripts/client/gui/housemgr.js
new file mode 100644
index 00000000..e69de29b
diff --git a/scripts/client/gui/info.js b/scripts/client/gui/info.js
new file mode 100644
index 00000000..16517101
--- /dev/null
+++ b/scripts/client/gui/info.js
@@ -0,0 +1,72 @@
+let infoDialog = {
+ window: null,
+ messageLabel: null,
+ okayButton: null,
+};
+
+// ===========================================================================
+
+function initInfoDialogGUI() {
+ logToConsole(LOG_DEBUG, `[VRR.GUI] Creating info dialog GUI ...`);
+ infoDialog.window = mexui.window(game.width/2-200, game.height/2-70, 400, 140, 'Information', {
+ main: {
+ backgroundColour: toColour(windowColour[0], windowColour[1], windowColour[2], windowColour[3]),
+ },
+ title: {
+ textSize: 11.0,
+ textColour: toColour(0, 0, 0, 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: robotoFont,
+ },
+ focused: {
+ borderColour: toColour(0, 0, 0, 0),
+ },
+ });
+
+ infoDialog.okayButton = infoDialog.window.button(20, 95, 360, 30, 'OK', {
+ main: {
+ backgroundColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], buttonAlpha),
+ textColour: toColour(0, 0, 0, 255),
+ textSize: 10.0,
+ textFont: robotoFont,
+ 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 showInfo(infoMessage, infoTitle) {
+ closeAllWindows();
+ logToConsole(LOG_DEBUG, `[VRR.GUI] Showing info dialog window. Info: ${infoTitle} - ${infoMessage}`);
+ mexui.setInput(true);
+ infoDialog.messageLabel.text = infoMessage;
+ infoDialog.window.shown = true;
+}
+
+// ===========================================================================
\ No newline at end of file
diff --git a/scripts/client/gui/login.js b/scripts/client/gui/login.js
new file mode 100644
index 00000000..30eee515
--- /dev/null
+++ b/scripts/client/gui/login.js
@@ -0,0 +1,124 @@
+let login = {
+ window: null,
+ logoImage: null,
+ messageLabel: null,
+ passwordLabel: null,
+ passwordInput: null,
+ loginButton: null,
+};
+
+// ===========================================================================
+
+function initLoginGUI() {
+ logToConsole(LOG_DEBUG, `[VRR.GUI] Creating login GUI ...`);
+ login.window = mexui.window(game.width/2-150, game.height/2-129, 300, 258, 'LOGIN', {
+ main: {
+ backgroundColour: toColour(windowColour[0], windowColour[1], windowColour[2], windowColour[3]),
+ 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.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: robotoFont,
+ },
+ 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: robotoFont,
+ },
+ caret: {
+ lineColour: toColour(255, 255, 255, 255),
+ },
+ placeholder: {
+ textColour: toColour(200, 200, 200, 150),
+ textSize: 10.0,
+ textFont: robotoFont,
+ },
+ 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: 10.0,
+ textFont: robotoFont,
+ textAlign: 0.5,
+ },
+ focused: {
+ borderColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], buttonAlpha),
+ },
+ }, checkLogin);
+
+ 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;
+}
+
+// ===========================================================================
+
+function checkLogin() {
+ logToConsole(LOG_DEBUG, `[VRR.GUI] Checking login with server ...`);
+ triggerNetworkEvent("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`);
+ closeAllWindows();
+}
+
+// ===========================================================================
\ No newline at end of file
diff --git a/scripts/client/gui/newchar.js b/scripts/client/gui/newchar.js
new file mode 100644
index 00000000..485e6018
--- /dev/null
+++ b/scripts/client/gui/newchar.js
@@ -0,0 +1,152 @@
+let newCharacter = {
+ window: null,
+ firstNameInput: null,
+ lastNameInput: null,
+ skinDropDown: null,
+ spawnAreaDropDown: null,
+ createButton: null,
+};
+
+// ===========================================================================
+
+function initNewCharacterGUI() {
+ logToConsole(LOG_DEBUG, `[VRR.GUI] Creating new character GUI ...`);
+ newCharacter.window = mexui.window(game.width/2-130, game.height/2-100, 300, 200, 'Character Name', {
+ main: {
+ backgroundColour: toColour(windowColour[0], windowColour[1], windowColour[2], windowColour[3]),
+ transitionTime: 500,
+ },
+ title: {
+ textSize: 0.0,
+ textColour: toColour(0, 0, 0, 0),
+ backgroundColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], windowTitleAlpha),
+ },
+ icon: {
+ textSize: 0.0,
+ textColour: toColour(0, 0, 0, 0),
+ backgroundColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], windowTitleAlpha),
+ }
+ });
+ newCharacter.window.titleBarIconSize = toVector2(0,0);
+ newCharacter.window.titleBarHeight = 0;
+
+ newCharacter.window.image(115, 10, 65, 65, mainLogoPath, {
+ focused: {
+ borderColour: toColour(0, 0, 0, 0),
+ },
+ });
+
+ newCharacter.messageLabel = newCharacter.window.text(20, 75, 260, 20, 'Name your character', {
+ main: {
+ textSize: 10.0,
+ textAlign: 0.5,
+ textColour: toColour(200, 200, 200, 255),
+ textFont: robotoFont,
+ },
+ focused: {
+ borderColour: toColour(0, 0, 0, 0),
+ },
+ });
+
+ newCharacter.firstNameInput = newCharacter.window.textInput(20, 100, 260, 25, '', {
+ main: {
+ backgroundColour: toColour(0, 0, 0, 120),
+ textColour: toColour(200, 200, 200, 255),
+ textSize: 10.0,
+ textFont: robotoFont,
+ },
+ caret: {
+ lineColour: toColour(255, 255, 255, 255),
+ },
+ placeholder: {
+ backgroundColour: toColour(0, 0, 0, 120),
+ textColour: toColour(200, 200, 200, 200),
+ textSize: 10.0,
+ textFont: robotoFont,
+ }
+ });
+ newCharacter.firstNameInput.placeholder = "First Name";
+
+ newCharacter.lastNameInput = newCharacter.window.textInput(20, 130, 260, 25, '', {
+ main: {
+ backgroundColour: toColour(0, 0, 0, 120),
+ textColour: toColour(200, 200, 200, 255),
+ textSize: 10.0,
+ textFont: robotoFont,
+ },
+ caret: {
+ lineColour: toColour(255, 255, 255, 255),
+ },
+ placeholder: {
+ backgroundColour: toColour(0, 0, 0, 120),
+ textColour: toColour(150, 150, 150, 200),
+ textSize: 10.0,
+ textFont: robotoFont,
+ }
+ });
+ newCharacter.lastNameInput.placeholder = "Last Name";
+
+ newCharacter.createCharacterButton = newCharacter.window.button(20, 160, 260, 25, 'CREATE CHARACTER', {
+ main: {
+ backgroundColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], buttonAlpha),
+ textColour: toColour(255, 255, 255, 255),
+ textSize: 12.0,
+ textFont: robotoFont,
+ 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 ...`);
+ let skinId = false;
+
+ if(newCharacter.firstNameInput.lines[0].length < 2) {
+ return false;
+ }
+
+ if(newCharacter.lastNameInput.lines[0].length < 2) {
+ return false;
+ }
+
+ triggerNetworkEvent("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;
+}
+
+// ===========================================================================
\ No newline at end of file
diff --git a/scripts/client/gui/register.js b/scripts/client/gui/register.js
new file mode 100644
index 00000000..66b578eb
--- /dev/null
+++ b/scripts/client/gui/register.js
@@ -0,0 +1,161 @@
+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(game.width/2-130, game.height/2-125, 300, 250, 'Register', {
+ main: {
+ backgroundColour: toColour(windowColour[0], windowColour[1], windowColour[2], windowColour[3]),
+ 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.image(115, 10, 65, 65, mainLogoPath, {
+ focused: {
+ borderColour: toColour(0, 0, 0, 0),
+ },
+ });
+
+ register.messageLabel = register.window.text(20, 75, 260, 20, 'Create an account', {
+ main: {
+ textSize: 10.0,
+ textAlign: 0.5,
+ textColour: toColour(200, 200, 200, 255),
+ textFont: robotoFont,
+ },
+ focused: {
+ borderColour: toColour(0, 0, 0, 0),
+ },
+ });
+
+ register.passwordInput = register.window.textInput(20, 100, 260, 25, '', {
+ main: {
+ backgroundColour: toColour(0, 0, 0, 120),
+ textColour: toColour(200, 200, 200, 255),
+ textSize: 10.0,
+ textFont: robotoFont,
+ },
+ caret: {
+ lineColour: toColour(255, 255, 255, 255),
+ },
+ placeholder: {
+ backgroundColour: toColour(0, 0, 0, 120),
+ textColour: toColour(200, 200, 200, 200),
+ textSize: 10.0,
+ textFont: robotoFont,
+ }
+ });
+ register.passwordInput.masked = true;
+ register.passwordInput.placeholder = "Password";
+
+ register.confirmPasswordInput = register.window.textInput(20, 130, 260, 25, '', {
+ main: {
+ backgroundColour: toColour(0, 0, 0, 120),
+ textColour: toColour(200, 200, 200, 255),
+ textSize: 10.0,
+ textFont: robotoFont,
+ },
+ caret: {
+ lineColour: toColour(255, 255, 255, 255),
+ },
+ placeholder: {
+ backgroundColour: toColour(0, 0, 0, 120),
+ textColour: toColour(200, 200, 200, 200),
+ textSize: 10.0,
+ textFont: robotoFont,
+ }
+ });
+ register.confirmPasswordInput.masked = true;
+ register.confirmPasswordInput.placeholder = "Confirm password";
+
+ register.emailInput = register.window.textInput(20, 160, 260, 25, '', {
+ main: {
+ backgroundColour: toColour(0, 0, 0, 120),
+ textColour: toColour(200, 200, 200, 255),
+ textSize: 10.0,
+ textFont: robotoFont,
+ },
+ caret: {
+ lineColour: toColour(255, 255, 255, 255),
+ },
+ placeholder: {
+ backgroundColour: toColour(0, 0, 0, 120),
+ textColour: toColour(200, 200, 200, 200),
+ textSize: 10.0,
+ textFont: robotoFont,
+ }
+ });
+ register.emailInput.placeholder = "Email";
+
+ register.registerButton = register.window.button(20, 195, 260, 30, 'CREATE ACCOUNT', {
+ main: {
+ backgroundColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], buttonAlpha),
+ textColour: toColour(255, 255, 255, 255),
+ textSize: 12.0,
+ textFont: robotoFont,
+ 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 ...`);
+ triggerNetworkEvent("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;
+}
+
+// ===========================================================================
+
+function registrationSuccess() {
+ logToConsole(LOG_DEBUG, `[VRR.GUI] Server reports registration was successful`);
+ closeAllWindows();
+}
+
+// ===========================================================================
\ No newline at end of file
diff --git a/scripts/client/gui/resetpass.js b/scripts/client/gui/resetpass.js
new file mode 100644
index 00000000..e69de29b
diff --git a/scripts/client/gui/yesno.js b/scripts/client/gui/yesno.js
new file mode 100644
index 00000000..ea64f534
--- /dev/null
+++ b/scripts/client/gui/yesno.js
@@ -0,0 +1,95 @@
+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(windowColour[0], windowColour[1], windowColour[2], windowColour[3]),
+ transitionTime: 500,
+ },
+ title: {
+ textSize: 11.0,
+ textColour: toColour(0, 0, 0, 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: robotoFont,
+ },
+ focused: {
+ borderColour: toColour(0, 0, 0, 0),
+ },
+ });
+
+ yesNoDialog.yesButton = yesNoDialog.window.button(20, 95, 175, 30, 'YES', {
+ main: {
+ backgroundColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], buttonAlpha),
+ textColour: toColour(0, 0, 0, 255),
+ textSize: 10.0,
+ textFont: robotoFont,
+ textAlign: 0.5,
+ },
+ focused: {
+ borderColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], 255),
+ },
+ }, yesNoDialogAnswerYes);
+
+ yesNoDialog.noButton = yesNoDialog.window.button(205, 95, 175, 30, 'NO', {
+ main: {
+ backgroundColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], buttonAlpha),
+ textColour: toColour(0, 0, 0, 255),
+ textSize: 10.0,
+ textFont: robotoFont,
+ 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) {
+ closeAllWindows();
+ logToConsole(LOG_DEBUG, `[VRR.GUI] Showing prompt window. Prompt: ${promptTitle} - ${promptMessage}`);
+ mexui.setInput(true);
+ yesNoDialog.messageLabel.text = promptMessage;
+ yesNoDialog.window.shown = true;
+}
+
+// ===========================================================================
+
+function yesNoDialogAnswerNo() {
+ logToConsole(LOG_DEBUG, `[VRR.GUI] Responding with answer NO to server prompt`);
+ triggerNetworkEvent("vrr.promptAnswerNo");
+ closeAllWindows();
+}
+
+// ===========================================================================
+
+function yesNoDialogAnswerYes() {
+ logToConsole(LOG_DEBUG, `[VRR.GUI] Responding with answer YES to server prompt`);
+ triggerNetworkEvent("vrr.promptAnswerYes");
+ closeAllWindows();
+}
+
+// ===========================================================================
\ No newline at end of file
diff --git a/scripts/client/label.js b/scripts/client/label.js
index d2d1be1e..788f2c8a 100644
--- a/scripts/client/label.js
+++ b/scripts/client/label.js
@@ -113,7 +113,7 @@ function renderPropertyEntranceLabel(name, position, locked, isBusiness, price,
break;
case VRR_BIZLABEL_INFO_ENTERVEH:
- bizInfoText = "Enter a vehicle to purchase it";
+ bizInfoText = "Enter a vehicle to buy it";
break;
case VRR_BIZLABEL_INFO_NONE:
diff --git a/scripts/client/main.js b/scripts/client/main.js
index a8b93a66..93d64e79 100644
--- a/scripts/client/main.js
+++ b/scripts/client/main.js
@@ -55,6 +55,8 @@ let calledDeathEvent = false;
let interiorLightsEnabled = true;
let interiorLightsColour = toColour(0, 0, 0, 150);
-let mouseCameraEnabled = false
+let mouseCameraEnabled = false;
+
+let currentPickup = false;
// ===========================================================================
\ No newline at end of file
diff --git a/scripts/client/server.js b/scripts/client/server.js
index abe57e0e..2742b996 100644
--- a/scripts/client/server.js
+++ b/scripts/client/server.js
@@ -57,6 +57,7 @@ function addAllNetworkHandlers() {
addNetworkHandler("vrr.weaponDamageEvent", setPlayerWeaponDamageEvent);
addNetworkHandler("vrr.spawned", onServerSpawnedPlayer);
addNetworkHandler("vrr.money", setLocalPlayerCash);
+ addNetworkHandler("vrr.armour", setLocalPlayerArmour);
addNetworkHandler("vrr.excludeGroundSnow", excludeModelFromGroundSnow);
addNetworkHandler("vrr.removeWorldObject", removeWorldObject);
@@ -89,6 +90,10 @@ function addAllNetworkHandlers() {
addNetworkHandler("vrr.syncElement", forceSyncElementProperties);
addNetworkHandler("vrr.elementPosition", setElementPosition);
addNetworkHandler("vrr.elementCollisions", setElementCollisionsEnabled);
+
+ addNetworkHandler("vrr.showRegistration", showRegistrationGUI);
+ addNetworkHandler("vrr.showNewCharacter", showNewCharacterGUI);
+ addNetworkHandler("vrr.showLogin", showLoginGUI);
}
// ===========================================================================
@@ -334,4 +339,10 @@ function setLocalPlayerPedPartsAndProps(parts, props) {
}
}
+// ===========================================================================
+
+function setLocalPlayerArmour(armour) {
+ localPlayer.armour = armour;
+}
+
// ===========================================================================
\ No newline at end of file
diff --git a/scripts/client/utilities.js b/scripts/client/utilities.js
index 8e2612c0..15701dde 100644
--- a/scripts/client/utilities.js
+++ b/scripts/client/utilities.js
@@ -726,4 +726,20 @@ function getPlayerFromParams(params) {
return false;
}
+// ===========================================================================
+
+function processNearbyPickups() {
+ let pickups = getElementsByType(ELEMENT_PICKUP);
+ for(let i in pickups) {
+ if(getDistance(pickups[i].position, localPlayer.position) < 5) {
+ //if(pickups[i].interior == localPlayer.interior && pickups[i].dimension == localPlayer.dimension) {
+ if(currentPickup != pickups[i]) {
+ currentPickup = pickups[i];
+ triggerNetworkEvent("vrr.pickup", pickups[i].id);
+ }
+ //}
+ }
+ }
+}
+
// ===========================================================================
\ No newline at end of file
diff --git a/scripts/server/account.js b/scripts/server/account.js
index 8d035ca5..8837f0a9 100644
--- a/scripts/server/account.js
+++ b/scripts/server/account.js
@@ -46,6 +46,36 @@ function autoLoginByIPCommand(command, params, client) {
// ===========================================================================
+function toggleNoRandomTipsCommand(command, params, client) {
+ let flagValue = getAccountSettingsFlagValue("noTimedRandomTips");
+
+ if(isAccountAutoIPLoginEnabled(getPlayerData(client).accountData)) {
+ getPlayerData(client).accountData.settings = getPlayerData(client).accountData.settings & ~flagValue;
+ messagePlayerSuccess(client, `You will not receive random tips anymore.`);
+ } else {
+ getPlayerData(client).accountData.settings = getPlayerData(client).accountData.settings | flagValue;
+ messagePlayerSuccess(client, `You will now receive random tips every 15 minutes.`);
+ }
+ return true;
+}
+
+// ===========================================================================
+
+function toggleNoActionTipsCommand(command, params, client) {
+ let flagValue = getAccountSettingsFlagValue("noActionTips");
+
+ if(isAccountAutoIPLoginEnabled(getPlayerData(client).accountData)) {
+ getPlayerData(client).accountData.settings = getPlayerData(client).accountData.settings & ~flagValue;
+ messagePlayerSuccess(client, `You will not receive action-based tips anymore.`);
+ } else {
+ getPlayerData(client).accountData.settings = getPlayerData(client).accountData.settings | flagValue;
+ messagePlayerSuccess(client, `You will now receive tips for some actions and commands.`);
+ }
+ return true;
+}
+
+// ===========================================================================
+
function autoSelectLastCharacterCommand(command, params, client) {
let flagValue = getAccountSettingsFlagValue("autoSelectLastCharacter");
@@ -296,6 +326,37 @@ function verifyAccountEmailCommand(command, params, client) {
// ===========================================================================
+/*
+function resetAccountPasswordCommand(command, params, client) {
+ if(areParamsEmpty(params)) {
+ messagePlayerSyntax(client, getCommandSyntaxText(command));
+ return false;
+ }
+
+ let splitParams = params.split(" ");
+ let verificationCode = splitParams[0] || "";
+
+ if(!isAccountEmailVerified(getPlayerData(client).accountData)) {
+ messagePlayerError(client, `Your email is not verified. Your password will not be reset!`);
+ return false;
+ }
+
+ if(!areParamsEmpty(verificationCode)) {
+ if(module.hashing.sha512(verificationCode) != getPlayerData(client).accountData.resetPasswordVerificationCode) {
+ messagePlayerError(client, `Invalid reset password verification code! A new one has been created and sent to your email.`);
+ let resetPasswordVerificationCode = generateResetPasswordVerificationCode();
+ setAccountEmailVerificationCode(getPlayerData(client).accountData, emailVerificationCode);
+ sendEmailVerificationEmail(client, emailVerificationCode);
+ return false;
+ }
+ }
+
+ saveAccountToDatabase(getPlayerData(client).accountData);
+}
+*/
+
+// ===========================================================================
+
function setAccountDiscordCommand(command, params, client) {
messagePlayerError(client, `This command is not yet finished and will be available soon!`);
return false;
@@ -371,7 +432,7 @@ function loadAccountFromName(accountName, fullLoad = false) {
let dbConnection = connectToDatabase();
if(dbConnection) {
accountName = escapeDatabaseString(dbConnection, accountName);
- let dbQueryString = `SELECT acct_main.*, acct_svr.*, acct_main.acct_ip AS ipstring FROM acct_main INNER JOIN acct_svr ON acct_svr.acct_svr_acct = acct_main.acct_id AND acct_svr.acct_svr_svr = ${getServerId()} WHERE acct_name = '${accountName}' LIMIT 1;`;
+ let dbQueryString = `SELECT acct_main.*, acct_svr.* FROM acct_main INNER JOIN acct_svr ON acct_svr.acct_svr_acct = acct_main.acct_id AND acct_svr.acct_svr_svr = ${getServerId()} WHERE acct_name = '${accountName}' LIMIT 1;`;
let dbQuery = queryDatabase(dbConnection, dbQueryString);
if(dbQuery) {
if(dbQuery.numRows > 0) {
@@ -664,7 +725,7 @@ function createAccount(name, password, email = "") {
let safeName = escapeDatabaseString(dbConnection, name);
let safeEmail = escapeDatabaseString(dbConnection, email);
- let dbQuery = queryDatabase(dbConnection, `INSERT INTO acct_main (acct_name, acct_pass, acct_email, acct_when_registered) VALUES ('${safeName}', '${hashedPassword}', '${safeEmail}', UNIX_TIMESTAMP())`);
+ let dbQuery = queryDatabase(dbConnection, `INSERT INTO acct_main (acct_name, acct_pass, acct_email, acct_when_registered) VALUES ('${safeName}', '${hashedPassword}', '${safeEmail}', CURRENT_TIMESTAMP())`);
if(getDatabaseInsertId(dbConnection) > 0) {
let tempAccountData = loadAccountFromId(getDatabaseInsertId(dbConnection), false);
createDefaultAccountServerData(tempAccountData.databaseId);
diff --git a/scripts/server/animation.js b/scripts/server/animation.js
index 7d0e3fde..1793b2bb 100644
--- a/scripts/server/animation.js
+++ b/scripts/server/animation.js
@@ -40,8 +40,8 @@ function playPlayerAnimationCommand(command, params, client) {
getPlayerData(client).currentAnimationPositionReturnTo = getPlayerPosition(client);
getPlayerData(client).animationStart = getCurrentUnixTimestamp();
//setEntityData(getPlayerData(client).ped, "vrr.animation", animationSlot, true);
+ messagePlayerTip(client, `${getInlineChatColourByName("white")}Use ${getInlineChatColourByName("lightGrey")}/stopanim ${getInlineChatColourByName("white")}to stop your animation`);
makePedPlayAnimation(getPlayerData(client).ped, animationSlot, animationPositionOffset);
- setPlayerMouseCameraState(client, true);
}
// ===========================================================================
diff --git a/scripts/server/ban.js b/scripts/server/ban.js
index a36b287a..15e08e41 100644
--- a/scripts/server/ban.js
+++ b/scripts/server/ban.js
@@ -109,6 +109,8 @@ function subNetBanCommand(command, params, client, fromDiscord) {
messageAdminAction(`${targetgetPlayerName(client)} has been banned from the server (subnet ban).`);
banSubNet(targetClient.ip, getSubNet(targetClient.ip, octetAmount), getPlayerData(client).accountData.databaseId, reason);
+
+ server.banIP(targetClient.ip);
}
// ===========================================================================
diff --git a/scripts/server/bitflag.js b/scripts/server/bitflag.js
index a8b48329..543b244a 100644
--- a/scripts/server/bitflag.js
+++ b/scripts/server/bitflag.js
@@ -59,6 +59,7 @@ let serverBitFlagKeys = {
"characterNameNeedsStaffApproval",
"emailVerified",
"twoFactorAuthVerified",
+ "nonRoleplayCharacterName",
],
factionFlagKeys: [
"none",
diff --git a/scripts/server/business.js b/scripts/server/business.js
index 66508a8d..b7040ee4 100644
--- a/scripts/server/business.js
+++ b/scripts/server/business.js
@@ -273,17 +273,17 @@ function setBusinessOwnerCommand(command, params, client) {
return false;
}
- if(!doesPlayerHaveStaffPermission(client, getStaffFlagValue("manageBusinesses"))) {
- if(getBusinessData(businessId).ownerType == VRR_BIZOWNER_PLAYER && getBusinessData(businessId).ownerId == getPlayerCurrentSubAccount(client).databaseId) {
+ if(getBusinessData(businessId).ownerType != VRR_BIZOWNER_PLAYER || getBusinessData(businessId).ownerId != getPlayerCurrentSubAccount(client).databaseId) {
+ if(!doesPlayerHaveStaffPermission(client, getStaffFlagValue("manageBusinesses"))) {
messagePlayerError(client, "You don't own this business!");
- return false;
}
+ return false;
}
getBusinessData(businessId).ownerType = VRR_BIZOWNER_PLAYER;
- getBusinessData(businessId).ownerId = getServerData().clients[newBusinessOwner.index].accountData.databaseId;
-
+ getBusinessData(businessId).ownerId = getPlayerCurrentSubAccount(newBusinessOwner).databaseId;
getBusinessData(businessId).needsSaved = true;
+
messagePlayerSuccess(`${getInlineChatColourByName("white")}You gave business ${getInlineChatColourByType("businessBlue")}${getBusinessData(businessId).name} ${getInlineChatColourByName("white")}to ${getInlineChatColourByName("lightGrey")}${newBusinessOwner.name}`);
}
@@ -297,7 +297,7 @@ function setBusinessClanCommand(command, params, client) {
return false;
}
- let clanId = getPlayerClan(params);
+ let clanId = getPlayerClan(client);
if(!getClanData(clanId)) {
messagePlayerError(client, "Clan not found!");
@@ -305,7 +305,7 @@ function setBusinessClanCommand(command, params, client) {
}
if(!doesPlayerHaveStaffPermission(client, getStaffFlagValue("manageBusinesses"))) {
- if(getBusinessData(businessId).ownerType == VRR_BIZOWNER_PLAYER && getBusinessData(businessId).ownerId == getPlayerCurrentSubAccount(client).databaseId) {
+ if(getBusinessData(businessId).ownerType != VRR_BIZOWNER_PLAYER && getBusinessData(businessId).ownerId != getPlayerCurrentSubAccount(client).databaseId) {
messagePlayerError(client, "You don't own this business!");
return false;
}
@@ -313,8 +313,8 @@ function setBusinessClanCommand(command, params, client) {
getBusinessData(businessId).ownerType = VRR_BIZOWNER_CLAN;
getBusinessData(businessId).ownerId = getClanData(clanId).databaseId;
-
getBusinessData(businessId).needsSaved = true;
+
messagePlayerSuccess(`${getInlineChatColourByName("white")}You gave business ${getInlineChatColourByType("businessBlue")}${getBusinessData(businessId).name} ${getInlineChatColourByName("white")}to the ${getInlineChatColourByType("clanOrange")}${getClanData(clanId).name} ${getInlineChatColourByName("white")}clan!`);
}
@@ -337,7 +337,7 @@ function setBusinessClanCommand(command, params, client) {
return false;
}
- let clanId = getPlayerClan(params);
+ let clanId = getPlayerClan(client);
if(!getClanData(clanId)) {
messagePlayerError(client, "Clan not found!");
@@ -552,8 +552,9 @@ function getBusinessInfoCommand(command, params, client) {
function setBusinessPickupCommand(command, params, client) {
let splitParams = params.split(" ");
let typeParam = splitParams[0] || "business";
+ let businessId = getPlayerBusiness(client);
- if(!getBusinessnData(businessId)) {
+ if(!getBusinessData(businessId)) {
messagePlayerError(client, "Business not found!");
return false;
}
@@ -570,10 +571,7 @@ function setBusinessPickupCommand(command, params, client) {
getBusinessData(businessId).entrancePickupModel = toInteger(typeParam);
}
- deleteBusinessEntrancePickup(businessId);
- deleteBusinessExitPickup(businessId);
- createBusinessEntrancePickup(businessId);
- createBusinessExitPickup(businessId);
+ resetBusinessPickups(businessId);
getBusinessData(businessId).needsSaved = true;
@@ -650,7 +648,7 @@ function setBusinessBlipCommand(command, params, client) {
getBusinessData(businessId).entranceBlipModel = toInteger(typeParam);
}
- resetBusinessBlips();
+ resetBusinessBlips(businessId);
getBusinessData(businessId).needsSaved = true;
messageAdmins(`${getInlineChatColourByName("lightGrey")}${getPlayerName(client)} ${getInlineChatColourByName("white")}set business ${getInlineChatColourByType("businessBlue")}${getBusinessData(businessId).name} ${getInlineChatColourByName("white")}blip display to ${getInlineChatColourByName("lightGrey")}${toLowerCase(typeParam)}`);
@@ -694,6 +692,22 @@ function giveDefaultItemsToBusinessCommand(command, params, client) {
// ===========================================================================
+function setBusinessEntranceLabelToDealershipCommand(command, params, client) {
+ let splitParams = params.split(" ");
+
+ let businessId = getPlayerBusiness(client);
+
+ if(!getBusinessData(businessId)) {
+ messagePlayerError(client, "Business not found!");
+ return false;
+ }
+
+ updateBusinessPickupLabelData(businessId);
+ messageAdmins(`${getInlineChatColourByName("lightGrey")}${getPlayerName(client)} ${getInlineChatColourByName("white")}gave business ${getInlineChatColourByType("businessBlue")}${getBusinessData(businessId).name} ${getInlineChatColourByName("white")}the default items for ${toLowerCase(typeParam)}`);
+}
+
+// ===========================================================================
+
function deleteBusinessFloorItemsCommand(command, params, client) {
let splitParams = params.split(" ");
@@ -1142,6 +1156,7 @@ function createAllBusinessPickups() {
for(let i in getServerData().businesses) {
createBusinessEntrancePickup(i);
createBusinessExitPickup(i);
+ updateBusinessPickupLabelData(i);
}
}
@@ -1196,8 +1211,8 @@ function createBusinessEntranceBlip(businessId) {
//getBusinessData(businessId).entranceBlip.streamInDistance = 300;
//getBusinessData(businessId).entranceBlip.streamOutDistance = 350;
//getBusinessData(businessId).entranceBlip.interior = getBusinessData(businessId).entranceInterior;
- setEntityData(getBusinessData(businessId).entranceBlip, "vrr.owner.type", VRR_BLIP_BUSINESS_ENTRANCE, false);
- setEntityData(getBusinessData(businessId).entranceBlip, "vrr.owner.id", businessId, false);
+ //setEntityData(getBusinessData(businessId).entranceBlip, "vrr.owner.type", VRR_BLIP_BUSINESS_ENTRANCE, false);
+ //setEntityData(getBusinessData(businessId).entranceBlip, "vrr.owner.id", businessId, false);
addToWorld(getBusinessData(businessId).entranceBlip);
}
}
@@ -1220,7 +1235,10 @@ function createBusinessExitPickup(businessId) {
getBusinessData(businessId).exitPickup = createGamePickup(pickupModelId, getBusinessData(businessId).exitPosition, getGameConfig().pickupTypes[getServerGame()].business);
setElementDimension(getBusinessData(businessId).exitPickup, getBusinessData(businessId).exitDimension);
setElementOnAllDimensions(getBusinessData(businessId).exitPickup, false);
+ //setEntityData(getBusinessData(businessId).entranceBlip, "vrr.owner.type", VRR_PICKUP_BUSINESS_EXIT, false);
+ //setEntityData(getBusinessData(businessId).entranceBlip, "vrr.owner.id", businessId, false);
//getBusinessData(businessId).exitPickup.interior = getBusinessData(businessId).exitInterior;
+ updateBusinessPickupLabelData(businessId);
addToWorld(getBusinessData(businessId).exitPickup);
}
}
@@ -1245,8 +1263,8 @@ function createBusinessExitBlip(businessId) {
setElementDimension(getBusinessData(businessId).exitBlip, getBusinessData(businessId).entranceDimension);
setElementOnAllDimensions(getBusinessData(businessId).exitBlip, false);
//getBusinessData(businessId).exitBlip.interior = getBusinessData(businessId).exitInterior;
- setEntityData(getBusinessData(businessId).exitBlip, "vrr.owner.type", VRR_BLIP_BUSINESS_EXIT, false);
- setEntityData(getBusinessData(businessId).exitBlip, "vrr.owner.id", businessId, false);
+ //setEntityData(getBusinessData(businessId).exitBlip, "vrr.owner.type", VRR_BLIP_BUSINESS_EXIT, false);
+ //setEntityData(getBusinessData(businessId).exitBlip, "vrr.owner.id", businessId, false);
addToWorld(getBusinessData(businessId).exitBlip);
}
}
@@ -1304,13 +1322,12 @@ function removePlayerFromBusinesses(client) {
// ===========================================================================
function exitBusiness(client) {
- let businessId = getEntityData(client, "vrr.inBusiness");
+ let businessId = getPlayerBusiness(client);
if(isPlayerSpawned(client)) {
setPlayerInterior(client, getServerData().businesses[businessId].entranceInterior);
setPlayerDimension(client, client, getServerData().businesses[businessId].entranceDimension);
setPlayerPosition(client, client, getServerData().businesses[businessId].entrancePosition);
}
- removeEntityData(client, "vrr.inBusiness");
}
// ===========================================================================
@@ -1507,11 +1524,6 @@ function buyFromBusinessCommand(command, params, client) {
}
}
- if(getPlayerCurrentSubAccount(client).cash < getBusinessData(businessId).floorItemCache[itemSlot-1].buyPrice*amount) {
- messagePlayerError(client, `You don't have enough money! You need ${getInlineChatColourByName("lightGrey")}${getBusinessData(businessId).floorItemCache[itemSlot-1].buyPrice*amount-getPlayerCurrentSubAccount(client).cash} ${getInlineChatColourByName("white")}more!`);
- return false;
- }
-
if(getItemData(getBusinessData(businessId).floorItemCache[itemSlot-1]).amount < amount) {
messagePlayerError(client, `There are only ${getItemData(getBusinessData(businessId).floorItemCache[itemSlot-1]).amount} ${getItemTypeData(getItemData(getBusinessData(businessId).floorItemCache[itemSlot-1]).itemTypeIndex).name} in slot ${itemSlot-1}`);
return false;
@@ -1528,6 +1540,11 @@ function buyFromBusinessCommand(command, params, client) {
let itemName = getItemTypeData(getItemData(getBusinessData(businessId).floorItemCache[itemSlot-1]).itemTypeIndex).name;
let priceEach = (amount > 1) ? `($${individualCost} each)` : ``;
+ if(getPlayerCurrentSubAccount(client).cash < totalCost) {
+ messagePlayerError(client, `You don't have enough money! You need ${getInlineChatColourByName("lightGrey")}${getBusinessData(businessId).floorItemCache[itemSlot-1].buyPrice*amount-getPlayerCurrentSubAccount(client).cash} ${getInlineChatColourByName("white")}more!`);
+ return false;
+ }
+
takePlayerCash(client, totalCost);
createItem(getItemData(getBusinessData(businessId).floorItemCache[itemSlot-1]).itemTypeIndex, getItemData(getBusinessData(businessId).floorItemCache[itemSlot-1]).value, VRR_ITEM_OWNER_PLAYER, getPlayerCurrentSubAccount(client).databaseId, amount);
cachePlayerHotBarItems(client);
@@ -1722,27 +1739,39 @@ function getBusinessIdFromDatabaseId(databaseId) {
// ===========================================================================
function updateBusinessPickupLabelData(businessId) {
- 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_BIZLABEL_INFO_NONE, true);
- if(getBusinessData(businessId).hasInterior) {
- setEntityData(getBusinessData(businessId).entrancePickup, "vrr.label.help", VRR_BIZLABEL_INFO_ENTER, true);
- } else {
- if(doesBusinessHaveAnyItemsToBuy(businessId)) {
- setEntityData(getBusinessData(businessId).entrancePickup, "vrr.label.help", VRR_BIZLABEL_INFO_BUY, true);
+ if(getBusinessData(businessId).exitPickup != null) {
+ setEntityData(getBusinessData(businessId).exitPickup, "vrr.owner.type", VRR_PICKUP_BUSINESS_EXIT, false);
+ setEntityData(getBusinessData(businessId).exitPickup, "vrr.owner.id", businessId, false);
+ setEntityData(getBusinessData(businessId).exitPickup, "vrr.label.type", VRR_LABEL_EXIT, true);
+ }
+
+ if(getBusinessData(businessId).entrancePickup != null) {
+ 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_BIZLABEL_INFO_NONE, true);
+ if(getBusinessData(businessId).labelHelpType == VRR_BIZLABEL_ENTERVEHICLE) {
+ setEntityData(getBusinessData(businessId).entrancePickup, "vrr.label.help", VRR_BIZLABEL_INFO_ENTERVEHICLE, true);
+ } else if(getBusinessData(businessId).labelHelpType == VRR_BIZLABEL_INFO_REFUEL) {
+ setEntityData(getBusinessData(businessId).entrancePickup, "vrr.label.help", VRR_BIZLABEL_INFO_REFUEL, true);
+ } else if(getBusinessData(businessId).labelHelpType == VRR_BIZLABEL_INFO_REPAIR) {
+ setEntityData(getBusinessData(businessId).entrancePickup, "vrr.label.help", VRR_BIZLABEL_INFO_REPAIR, true);
+ } else {
+ if(getBusinessData(businessId).hasInterior) {
+ setEntityData(getBusinessData(businessId).entrancePickup, "vrr.label.help", VRR_BIZLABEL_INFO_ENTER, true);
+ } else {
+ if(doesBusinessHaveAnyItemsToBuy(businessId)) {
+ setEntityData(getBusinessData(businessId).entrancePickup, "vrr.label.help", VRR_BIZLABEL_INFO_BUY, true);
+ }
+ }
+ }
+
+ if(getBusinessData(businessId).buyPrice > 0) {
+ setEntityData(getBusinessData(businessId).entrancePickup, "vrr.label.price", getBusinessData(businessId).buyPrice, true);
}
}
-
- if(getBusinessData(businessId).buyPrice > 0) {
- setEntityData(getBusinessData(businessId).entrancePickup, "vrr.label.price", getBusinessData(businessId).buyPrice, true);
- }
-
- 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);
}
// ===========================================================================
diff --git a/scripts/server/clan.js b/scripts/server/clan.js
index 86b33899..b1d6e481 100644
--- a/scripts/server/clan.js
+++ b/scripts/server/clan.js
@@ -1059,4 +1059,61 @@ function getPlayerClanRankName(client) {
}
}
-// ===========================================================================
\ No newline at end of file
+// ===========================================================================
+
+function showClanFlagListCommand(command, params, client) {
+ let flagList = getServerBitFlagKeys().clanFlagKeys;
+
+ let chunkedList = splitArrayIntoChunks(flagList, 10);
+
+ messagePlayerInfo(client, `${getInlineChatColourByType("clanOrange")}== ${getInlineChatColourByType("jobYellow")}Clan Permissions List ${getInlineChatColourByType("clanOrange")}=====================`);
+
+ for(let i in chunkedList) {
+ messagePlayerInfo(client, chunkedList[i].join(", "));
+ }
+}
+
+// ===========================================================================
+
+/*
+function showClanFlagListCommand(command, params, client) {
+ if(!doesPlayerHaveClanPermission(client, getClanFlagValue("rankFlags"))) {
+ messagePlayerError(client, "You can not change a clan rank's permissions!");
+ return false;
+ }
+
+ if(areParamsEmpty(params)) {
+ messagePlayerSyntax(client, getCommandSyntaxText(command));
+ return false;
+ }
+
+ let clanId = getPlayerClan(client);
+
+ if(!getClanData(clanId)) {
+ messagePlayerError(client, "Clan not found!");
+ return false;
+ }
+
+ let splitParams = params.split(" ");
+ let rankId = getClanRankFromParams(clanId, splitParams[0]);
+
+ if(!getClanRankData(clanId, rankId)) {
+ messagePlayerError(client, "Clan rank not found!");
+ return false;
+ }
+
+ let tempClanRankData = getClanRankData(clanId, rankId).flags;
+ for(let i in tempClanRankData) {
+ if(getServerBitFlags().clanFlags.indexOf(tempClanRankData)))
+ }
+ let flagList = getServerBitFlag().clanFlags;
+
+ let chunkedList = splitArrayIntoChunks(flagList, 10);
+
+ messagePlayerInfo(client, `${getInlineChatColourByType("clanOrange")}== ${getInlineChatColourByType("jobYellow")}Clan Permissions List ${getInlineChatColourByType("clanOrange")}=====================`);
+
+ for(let i in chunkedList) {
+ messagePlayerInfo(client, chunkedList[i].join(", "));
+ }
+}
+*/
\ No newline at end of file
diff --git a/scripts/server/class.js b/scripts/server/class.js
index 9b8ded02..32dc8cda 100644
--- a/scripts/server/class.js
+++ b/scripts/server/class.js
@@ -20,7 +20,7 @@ function initClassScript() {
* @class Representing data for server configuration
*/
class ServerConfigData {
- constructor(dbAssoc) {
+ constructor(dbAssoc = false) {
this.databaseId = 0;
this.name = "";
this.password = "";
@@ -83,6 +83,15 @@ class ServerConfigData {
this.useRealTime = false;
this.realTimeZone = 0;
+ this.discordConfig = {
+ eventChannelWebHookURL: "",
+ chatChannelWebHookURL: "",
+ adminChannelWebHookURL: "",
+ sendEvents: true,
+ sendChat: true,
+ sendAdminEvents: true,
+ };
+
if(dbAssoc) {
this.databaseId = dbAssoc["svr_id"];
console.log("1");
@@ -137,6 +146,15 @@ class ServerConfigData {
this.introMusicURL = dbAssoc["svr_intro_music"];
this.useRealTime = intToBool(dbAssoc["svr_time_realtime_enabled"]);
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,
+ };
}
}
};
@@ -191,7 +209,6 @@ class ClientData {
this.alcoholLevel = 0;
this.pedState = VRR_PEDSTATE_NONE;
-
this.promptType = VRR_PROMPT_NONE;
this.businessOrderAmount = 0;
@@ -224,6 +241,10 @@ class ClientData {
this.returnToBusiness = null;
this.changingCharacterName = false;
+
+ this.currentPickup = false;
+
+ this.usingSkinSelect = false;
}
};
@@ -231,7 +252,7 @@ class ClientData {
* @class Representing an account, loaded/saved in the database
*/
class AccountData {
- constructor(dbAssoc) {
+ constructor(dbAssoc = false) {
this.databaseId = 0;
this.name = "";
this.password = "";
@@ -295,7 +316,7 @@ class AccountData {
* @class Representing an account's contact list, loaded/saved in the database
*/
class AccountContactData {
- constructor(dbAssoc) {
+ constructor(dbAssoc = false) {
this.databaseId = 0;
this.accountId = 0;
this.contactAccountId = 0;
@@ -317,7 +338,7 @@ class AccountContactData {
* @class Representing an account's messages, loaded/saved in the database
*/
class AccountMessageData {
- constructor(dbAssoc) {
+ constructor(dbAssoc = false) {
this.databaseId = 0;
this.account = 0;
this.whoSent = 0;
@@ -347,7 +368,7 @@ class AccountMessageData {
* @class Representing an account's staff notes. Visible only to staff and loaded/saved in the database
*/
class AccountStaffNoteData {
- constructor(dbAssoc) {
+ constructor(dbAssoc = false) {
this.databaseId = 0;
this.account = 0;
this.whoAdded = 0;
@@ -375,7 +396,7 @@ class AccountStaffNoteData {
* @class Representing a character's (subaccount) data. Loaded and saved in the database
*/
class SubAccountData {
- constructor(dbAssoc) {
+ constructor(dbAssoc = false) {
this.databaseId = 0;
this.server = 0;
this.firstName = "John";
@@ -481,7 +502,7 @@ class SubAccountData {
* @class Representing a businesses' data. Loaded and saved in the database
*/
class BusinessData {
- constructor(dbAssoc) {
+ constructor(dbAssoc = false) {
this.databaseId = 0;
this.name = "";
this.ownerType = VRR_BIZOWNER_NONE;
@@ -521,6 +542,8 @@ class BusinessData {
this.streamingRadioStation = -1;
+ this.labelHelpType = VRR_BIZLABEL_INFO_NONE;
+
if(dbAssoc) {
this.databaseId = toInteger(dbAssoc["biz_id"]);
this.name = toString(dbAssoc["biz_name"]);
@@ -547,15 +570,17 @@ class BusinessData {
this.entranceFee = toInteger(dbAssoc["biz_entrance_fee"]);
this.till = toInteger(dbAssoc["biz_till"]);
+
+ this.labelHelpType = toInteger(dbAssoc["biz_label_help_type"]);
}
- }
+ };
};
/**
* @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) {
+ constructor(dbAssoc = false) {
this.databaseId = 0;
this.name = "";
this.type = 0;
@@ -587,7 +612,7 @@ class BusinessLocationData {
* @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) {
+ constructor(dbAssoc = false) {
this.databaseId = 0;
this.name = "";
this.business = 0;
@@ -609,7 +634,7 @@ class BusinessGameScriptData {
* @class Representing a house's data. Loaded and saved in the database
*/
class HouseData {
- constructor(dbAssoc) {
+ constructor(dbAssoc = false) {
this.databaseId = 0
this.description = "";
this.ownerType = VRR_HOUSEOWNER_NONE;
@@ -680,7 +705,7 @@ class HouseData {
* @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) {
+ constructor(dbAssoc = false) {
this.databaseId = 0;
this.name = "";
this.type = 0;
@@ -717,7 +742,7 @@ class HouseLocationData {
* @class Representing a house's game scripts. Multiple can be used for a single house
*/
class HouseGameScriptData {
- constructor(dbAssoc) {
+ constructor(dbAssoc = false) {
this.databaseId = 0;
this.name = "";
this.business = 0;
@@ -739,7 +764,7 @@ class HouseGameScriptData {
* @class Representing a clan's data. Loaded and saved in the database
*/
class ClanData {
- constructor(dbAssoc) {
+ constructor(dbAssoc = false) {
this.databaseId = 0;
this.name = "";
this.ownerId = 0;
@@ -771,7 +796,7 @@ class ClanData {
* @class Representing a clan rank's data. Loaded and saved in the database
*/
class ClanRankData {
- constructor(dbAssoc) {
+ constructor(dbAssoc = false) {
this.databaseId = 0;
this.clan = 0;
this.name = "";
@@ -800,7 +825,7 @@ class ClanRankData {
* @class Representing a clan member's data. Loaded and saved in the database
*/
class ClanMemberData {
- constructor(dbAssoc) {
+ constructor(dbAssoc = false) {
this.databaseId = 0;
this.clan = 0;
this.subAccount = 0;
@@ -1334,7 +1359,7 @@ class InteriorTemplateData {
};
class RadioStationData {
- constructor(dbAssoc) {
+ constructor(dbAssoc = false) {
this.databaseId = 0;
this.name = "";
this.url = "";
@@ -1452,7 +1477,7 @@ class ItemTypeData {
}
};
class NPCData {
- constructor(dbAssoc) {
+ constructor(dbAssoc = false) {
this.databaseId = 0;
this.server = 0;
this.firstName = "John";
@@ -1546,7 +1571,7 @@ class NPCData {
};
class NPCTriggerData {
- constructor(dbAssoc) {
+ constructor(dbAssoc = false) {
this.databaseId = 0;
this.npcId = 0;
this.index = 0;
@@ -1564,7 +1589,7 @@ class NPCTriggerData {
};
class NPCTriggerConditionData {
- constructor(dbAssoc) {
+ constructor(dbAssoc = false) {
this.databaseId = 0;
this.triggerId = 0;
this.index = 0;
@@ -1583,7 +1608,7 @@ class NPCTriggerConditionData {
};
class NPCTriggerResponseData {
- constructor(dbAssoc) {
+ constructor(dbAssoc = false) {
this.databaseId = 0;
this.triggerId = 0;
this.index = 0;
@@ -1597,4 +1622,23 @@ class NPCTriggerResponseData {
this.responseValue = toInteger(dbAssoc["npc_trig_resp_val"]);
}
}
-};
\ No newline at end of file
+};
+
+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"]);
+ }
+ }
+}
\ No newline at end of file
diff --git a/scripts/server/client.js b/scripts/server/client.js
index 843f43a4..413b7776 100644
--- a/scripts/server/client.js
+++ b/scripts/server/client.js
@@ -29,6 +29,7 @@ function addAllNetworkHandlers() {
addNetworkHandler("vrr.afk", playerChangeAFKState);
// Event
+ addNetworkHandler("vrr.pickup", onPlayerNearPickup);
addNetworkHandler("vrr.enteredSphere", onPlayerEnteredSphere);
addNetworkHandler("vrr.exitedSphere", onPlayerExitedSphere);
addNetworkHandler("vrr.playerDeath", onPlayerDeath);
@@ -941,21 +942,25 @@ function makePedPlayAnimation(ped, animationSlot, positionOffset) {
setElementCollisionsEnabled(ped, false);
switch(animationData[9]) {
case VRR_ANIMMOVE_FORWARD:
- setElementPosition(ped, getPosInFrontOfPos(getElementPosition(ped), getElementHeading(ped), positionOffset));
+ setElementPosition(ped, getPosInFrontOfPos(getElementPosition(ped), fixAngle(getElementHeading(ped)), positionOffset));
break;
case VRR_ANIMMOVE_BACK:
- setElementPosition(ped, getPosBehindPos(getElementPosition(ped), getElementHeading(ped), positionOffset));
+ setElementPosition(ped, getPosBehindPos(getElementPosition(ped), fixAngle(getElementHeading(ped)), positionOffset));
break;
case VRR_ANIMMOVE_LEFT:
- setElementPosition(ped, getPosToLeftOfPos(getElementPosition(ped), getElementHeading(ped), positionOffset));
+ setElementPosition(ped, getPosToLeftOfPos(getElementPosition(ped), fixAngle(getElementHeading(ped)), positionOffset));
break;
case VRR_ANIMMOVE_RIGHT:
- setElementPosition(ped, getPosToRightOfPos(getElementPosition(ped), getElementHeading(ped), positionOffset));
+ setElementPosition(ped, getPosToRightOfPos(getElementPosition(ped), fixAngle(getElementHeading(ped)), positionOffset));
break;
}
+
+ if(getGame() < GAME_GTA_SA) {
+ setPlayerMouseCameraState(client, true);
+ }
}
triggerNetworkEvent("vrr.pedAnim", null, ped.id, animationData[1], animationData[2], animationData[3], animationData[4], animationData[5], positionOffset);
}
@@ -1018,4 +1023,17 @@ function sendPlayerPedPartsAndProps(client) {
triggerNetworkEvent("vrr.ped")
}
+// ===========================================================================
+
+function setPlayerVanillaRadioStation(client, radioStationId) {
+ triggerNetworkEvent("vrr.vanillaRadio", client, radioStationId);
+ return true;
+}
+
+// ===========================================================================
+
+function onPlayerNearPickup(client, pickupId) {
+ getPlayerData(client).currentPickup = getElementFromId(pickupId);
+}
+
// ===========================================================================
\ No newline at end of file
diff --git a/scripts/server/colour.js b/scripts/server/colour.js
index 98656ea9..d232859a 100644
--- a/scripts/server/colour.js
+++ b/scripts/server/colour.js
@@ -249,7 +249,7 @@ function getRandomRGB() {
*
*/
function getInlineChatColourByName(colourName) {
- return `[${getHexColourByName(colourName)}]`;
+ return `{${colourName}}`;
}
// ===========================================================================
@@ -262,7 +262,7 @@ function getInlineChatColourByName(colourName) {
*
*/
function getInlineChatColourByType(colourName) {
- return `[${getHexColourByType(colourName)}]`;
+ return `{${colourName}}`;
}
// ===========================================================================
@@ -296,4 +296,42 @@ function hexFromToColour(colour) {
return rgbToHex(rgba[0], rgba[1], rgba[2]);
}
+// ===========================================================================
+
+function replaceColoursInMessage(messageText) {
+ for(let i in getServerColours().hex.byName) {
+ let find = `{${i}}`;
+ let re = new RegExp(find, 'g');
+ messageText = messageText.replace(re, `[#${getServerColours().hex.byName[i]}]`);
+ }
+
+ for(let i in getServerColours().hex.byType) {
+ let find = `{${i}}`;
+ let re = new RegExp(find, 'g');
+ messageText = messageText.replace(re, `[#${getServerColours().hex.byType[i]}]`);
+ }
+
+ return messageText;
+}
+
+// ===========================================================================
+
+function removeColoursInMessage(messageText) {
+
+
+ for(let i in getServerColours().hex.byName) {
+ let find = `{${i}}`;
+ let re = new RegExp(find, 'g');
+ messageText = messageText.replace(re, ``);
+ }
+
+ for(let i in getServerColours().hex.byType) {
+ let find = `{${i}}`;
+ let re = new RegExp(find, 'g');
+ messageText = messageText.replace(re, ``);
+ }
+
+ return messageText;
+}
+
// ===========================================================================
\ No newline at end of file
diff --git a/scripts/server/command.js b/scripts/server/command.js
index 81f488bc..3a3a4ea0 100644
--- a/scripts/server/command.js
+++ b/scripts/server/command.js
@@ -40,14 +40,15 @@ function loadCommands() {
account: [
commandData("login", loginCommand, "", getStaffFlagValue("none"), false, false, "Login to an account"),
commandData("register", registerCommand, "", getStaffFlagValue("none"), false, false, "Creates an account"),
- commandData("changepass", changePasswordCommand, "", getStaffFlagValue("none"), true, false, "Change an account password"),
+ commandData("changepass", changePasswordCommand, " ", getStaffFlagValue("none"), true, false, "Change an account password"),
commandData("iplogin", autoLoginByIPCommand, "", getStaffFlagValue("none"), true, false, "Toggle whether to automatically login if you join with the same IP as your last join"),
commandData("autolastchar", autoSelectLastCharacterCommand, "", getStaffFlagValue("none"), true, false, "Toggle whether to automatically spawn with the last character you played as"),
commandData("gui", toggleAccountGUICommand, "", getStaffFlagValue("none"), false, false, "Toggle whether to use GUI. If GUI is disabled on the server, it won't show even if you have GUI enabled."),
commandData("2fa", toggleAccountTwoFactorAuthCommand, "", getStaffFlagValue("none"), true, false, "Set up and use two-factor authentication."),
commandData("setemail", setAccountEmailCommand, "", getStaffFlagValue("none"), true, false, "Sets your email. To reset your password, you must have a valid email set and verified."),
commandData("verifyemail", verifyAccountEmailCommand, "", getStaffFlagValue("none"), true, false, "Confirms/verifies your email."),
- commandData("setdiscord", setAccountDiscordCommand, "", getStaffFlagValue("none"), true, false, "Set up the integration for discord. Allows you to see info and use in-game commands on discord."),
+ //commandData("setdiscord", setAccountDiscordCommand, "", getStaffFlagValue("none"), true, false, "Set up the integration for discord. Allows you to see info and use in-game commands on discord."),
+ commandData("notips", toggleNoRandomTipsCommand, "", getStaffFlagValue("none"), true, false, "Turn on and off random tips"),
],
ammunation: [],
animation: [
@@ -109,6 +110,7 @@ function loadCommands() {
commandData("bizdefaultitems", giveDefaultItemsToBusinessCommand, "- ", getStaffFlagValue("manageItems"), true, true, "Gives the business the default items based on template name"),
commandData("bizdelflooritems", deleteBusinessFloorItemsCommand, "", getStaffFlagValue("manageItems"), true, true, "Destroys all items on the business floor (for-sale items)"),
commandData("bizdelstorageitems", deleteBusinessStorageItemsCommand, "", getStaffFlagValue("manageItems"), true, true, "Destroys all items in the business's storage"),
+ commandData("bizdealership", setBusinessEntranceLabelToDealershipCommand, "", getStaffFlagValue("manageBusinesses"), true, true, "Sets the business's door label to vehicle dealership"),
],
chat: [
commandData("me", meActionCommand, "", getStaffFlagValue("none"), true, false, "Shows a custom action message in chat"),
@@ -130,6 +132,7 @@ function loadCommands() {
clan: [
commandData("clans", listClansCommand, "[search text]", getStaffFlagValue("none"), true, true, "List clans (search by partial name, if provided)"),
commandData("clanranks", listClanRanksCommand, "[clan name]", getStaffFlagValue("none"), true, true, "Shows a list of a clan's ranks"),
+ commandData("clanflags", showClanFlagListCommand, "", getStaffFlagValue("none"), true, true, "Shows a list of clan permission flags"),
commandData("addclan", createClanCommand, "", getStaffFlagValue("manageClans"), true, true, "Creates an new empty, unowned clan."),
commandData("delclan", deleteClanCommand, "", getStaffFlagValue("manageClans"), true, true, "Deletes a clan by ID or name"),
@@ -147,6 +150,7 @@ function loadCommands() {
commandData("clanmembertitle", setClanMemberTitleCommand, " ", getStaffFlagValue("none"), true, true, "Sets a clan members's custom title"),
commandData("clanaddrankflag", addClanRankFlagCommand, " ", getStaffFlagValue("none"), true, true, "Gives a clan rank a clan permission."),
commandData("clandelrankflag", removeClanRankFlagCommand, " ", getStaffFlagValue("none"), true, true, "Takes a clan permission from a clan rank"),
+ //commandData("clanrankflags", listClanRankFlagsCommand, "", getStaffFlagValue("none"), true, true, "Shows a list of a clan rank's current permission flags"),
commandData("clanaddmemberflag", addClanMemberFlagCommand, " ", getStaffFlagValue("none"), true, true, "Gives a clan member a clan permission"),
commandData("clandelmemberflag", removeClanMemberFlagCommand, " ", getStaffFlagValue("none"), true, true, "Takes a clan permission from a clan member"),
],
@@ -192,6 +196,8 @@ function loadCommands() {
commandData("delloglvl", removeServerLogLevelCommand, "", getStaffFlagValue("developer"), true, true),
commandData("nosave", togglePauseSavingToDatabase, "", getStaffFlagValue("developer"), true, true),
+
+ //commandData("forceresetpass", forceAccountPasswordResetCommand, "", getStaffFlagValue("developer"), true, true),
//commandData("loglvl", getServerLogLevelCommand, "", getStaffFlagValue("developer"), true, true),
],
discord: [],
diff --git a/scripts/server/config.js b/scripts/server/config.js
index 156a53e2..d8286552 100644
--- a/scripts/server/config.js
+++ b/scripts/server/config.js
@@ -45,6 +45,7 @@ function loadGlobalConfig() {
phoneSpeakerDistance: 15,
phoneTalkDistance: 15,
tazerEffectDuration: 15000,
+ vehicleRepairDistance: 5,
weaponEquippableTypes: [
VRR_ITEM_USETYPE_WEAPON,
VRR_ITEM_USETYPE_TAZER,
@@ -52,12 +53,20 @@ function loadGlobalConfig() {
VRR_ITEM_USETYPE_SPRAYPAINT,
VRR_ITEM_USETYPE_PEPPERSPRAY,
],
+ onFootOnlyItems: [
+ VRR_ITEM_USETYPE_VEHREPAIR,
+ VRR_ITEM_USETYPE_VEHCOLOUR,
+ VRR_ITEM_USETYPE_VEHUPGRADE_PART,
+ VRR_ITEM_USETYPE_VEHLIVERY,
+ VRR_ITEM_USETYPE_VEHTIRE,
+ ],
itemActionStateReset: 5000,
subAccountNameAllowedCharacters: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",
emailValidationRegex: /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/,
itemActionDelayExtraTimeout: 1000,
geoIPCountryDatabaseFilePath: "geoip-country.mmdb",
geoIPCityDatabaseFilePath: "geoip-city.mmdb",
+ randomTipInterval: 600000,
};
}
diff --git a/scripts/server/const.js b/scripts/server/const.js
index b65da51b..1abec43a 100644
--- a/scripts/server/const.js
+++ b/scripts/server/const.js
@@ -31,7 +31,7 @@ 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 = 5;
+const VRR_PICKUP_EXIT = 6;
// Vehicle Owner Types
const VRR_VEHOWNER_NONE = 0; // Not owned
diff --git a/scripts/server/developer.js b/scripts/server/developer.js
index 2464bec4..4fc7b72b 100644
--- a/scripts/server/developer.js
+++ b/scripts/server/developer.js
@@ -293,6 +293,7 @@ function executeServerCodeCommand(command, params, client) {
messagePlayerSuccess(client, "Server code executed!");
messagePlayerNormal(client, `Code: ${params}`, COLOUR_YELLOW);
messagePlayerNormal(client, `Returns: ${returnValue}`, COLOUR_YELLOW);
+ console.log(returnValue);
return true;
}
@@ -392,7 +393,7 @@ function submitIdea(client, ideaText) {
let dbConnection = connectToDatabase();
if(dbConnection) {
let safeIdeaMessage = escapeDatabaseString(dbConnection, ideaText);
- queryDatabase(dbConnection, `INSERT INTO idea_main (idea_server, idea_script_ver, idea_who_added, idea_when_added, idea_message, idea_pos_x, idea_pos_y, idea_pos_z, idea_rot_z, idea_svr_start, idea_session) VALUES (${getServerId()}, '${scriptVersion}', ${databaseId}, UNIX_TIMESTAMP(), '${safeIdeaMessage}',${position.x}, ${position.y}, ${position.z}, ${heading}, ${serverStartTime}, ${session})`);
+ queryDatabase(dbConnection, `INSERT INTO idea_main (idea_server, idea_script_ver, idea_who_added, idea_when_added, idea_message, idea_pos_x, idea_pos_y, idea_pos_z, idea_rot_z, idea_svr_start, idea_session) VALUES (${getServerId()}, '${scriptVersion}', ${databaseId}, NOW(), '${safeIdeaMessage}',${position.x}, ${position.y}, ${position.z}, ${heading}, ${serverStartTime}, ${session})`);
}
}
@@ -413,7 +414,7 @@ function submitBugReport(client, bugText) {
let dbConnection = connectToDatabase();
if(dbConnection) {
let safeBugMessage = escapeDatabaseString(dbConnection, bugText);
- queryDatabase(dbConnection, `INSERT INTO bug_main (bug_server, bug_script_ver, bug_who_added, bug_when_added, bug_message, bug_pos_x, bug_pos_y, bug_pos_z, bug_rot_z, bug_svr_start, bug_session) VALUES (${getServerId()}, '${scriptVersion}', ${databaseId}, UNIX_TIMESTAMP(), '${safeBugMessage}', ${position.x}, ${position.y}, ${position.z}, ${heading}, ${serverStartTime}, ${session})`);
+ queryDatabase(dbConnection, `INSERT INTO bug_main (bug_server, bug_script_ver, bug_who_added, bug_when_added, bug_message, bug_pos_x, bug_pos_y, bug_pos_z, bug_rot_z, bug_svr_start, bug_session) VALUES (${getServerId()}, '${scriptVersion}', ${databaseId}, NOW(), '${safeBugMessage}', ${position.x}, ${position.y}, ${position.z}, ${heading}, ${serverStartTime}, ${session})`);
}
}
diff --git a/scripts/server/discord.js b/scripts/server/discord.js
index 81c6915e..653138a3 100644
--- a/scripts/server/discord.js
+++ b/scripts/server/discord.js
@@ -89,19 +89,52 @@ function getDiscordUserData(discordUserId) {
// ===========================================================================
function messageDiscordChatChannel(message) {
- let gameEmoji = getGameEmojiForDiscord(getServerGame());
+ if(!getServerConfig().discordConfig.sendChat) {
+ return false;
+ }
+
+ message = removeColoursInMessage(message);
+ console.warn(message);
+ let payloadData = {
+ "username": "Chat",
+ "content": message,
+ };
+
+ triggerWebHook(getServerConfig().discordConfig.chatChannelWebHookURL, JSON.stringify(payloadData));
}
// ===========================================================================
function messageDiscordAdminChannel(message) {
- let gameEmoji = getGameEmojiForDiscord(getServerGame());
+ if(!getServerConfig().discordConfig.sendAdminEvents) {
+ return false;
+ }
+
+ message = removeColoursInMessage(message);
+ console.warn(message);
+ let payloadData = {
+ "username": "Admin Event",
+ "content": message,
+ };
+
+ triggerWebHook(getServerConfig().discordConfig.adminChannelWebHookURL, JSON.stringify(payloadData));
}
// ===========================================================================
function messageDiscordEventChannel(message) {
- let gameEmoji = getGameEmojiForDiscord(getServerGame());
+ if(!getServerConfig().discordConfig.sendEvents) {
+ return false;
+ }
+
+ message = removeColoursInMessage(message);
+ console.warn(message);
+ let payloadData = {
+ "username": "Event",
+ "content": message,
+ };
+
+ triggerWebHook(getServerConfig().discordConfig.eventChannelWebHookURL, JSON.stringify(payloadData));
}
// ===========================================================================
\ No newline at end of file
diff --git a/scripts/server/event.js b/scripts/server/event.js
index 1c637334..d20dfad4 100644
--- a/scripts/server/event.js
+++ b/scripts/server/event.js
@@ -49,6 +49,8 @@ function onPlayerJoin(event, client) {
if(isFadeCameraSupported()) {
fadeCamera(client, true, 1.0);
}
+
+ messageDiscordEventChannel(`:waving: ${getPlayerDisplayForConsole(client)} has joined the server.`);
}
// ===========================================================================
@@ -76,6 +78,8 @@ function onPlayerQuit(event, client, quitReasonId) {
resetClientStuff(client);
getServerData().clients[client.index] = null;
}
+
+ messageDiscordEventChannel(`${getPlayerDisplayForConsole(client)} has left the server.`);
}
// ===========================================================================
@@ -104,8 +108,8 @@ function onPlayerChat(event, client, messageText) {
}
messageText = messageText.substring(0, 128);
-
- messagePlayerNormal(null, `${getInlineChatColourByName("white")}💬 [${hexFromToColour(getPlayerColour(client))}]${getCharacterFullName(client)}: ${getInlineChatColourByName("white")}${messageText}`, getPlayerColour(client));
+ messagePlayerNormal(null, replaceColoursInMessage(`${getInlineChatColourByName("white")}💬 [${hexFromToColour(getPlayerColour(client))}]${getCharacterFullName(client)}: ${getInlineChatColourByName("white")}${messageText}`), getPlayerColour(client));
+ messageDiscordChatChannel(`💬 ${getCharacterFullName(client)}: ${messageText}`);
}
// ===========================================================================
@@ -260,7 +264,7 @@ async function onPlayerEnteredVehicle(client, clientVehicle, seat) {
ownerType = toLowerCase(getVehicleOwnerTypeText(getVehicleData(vehicle).ownerType));
switch(getVehicleData(vehicle).ownerType) {
case VRR_VEHOWNER_CLAN:
- ownerName = getClanData(getVehicleData(vehicle).ownerId).name;
+ ownerName = getClanData(getClanIdFromDatabaseId(getVehicleData(vehicle).ownerId)).name;
ownerType = "clan";
break;
@@ -365,7 +369,7 @@ function onPlayerDeath(client, position) {
setTimeout(function() {
if(getPlayerCurrentSubAccount(client).inJail) {
let closestJail = getClosestJail(getPlayerPosition(client));
- //client.despawnPlayer();
+ client.despawnPlayer();
getPlayerCurrentSubAccount(client).interior = closestJail.interior;
getPlayerCurrentSubAccount(client).dimension = closestJail.dimension;
if(getServerGame() == GAME_GTA_IV) {
@@ -380,7 +384,7 @@ function onPlayerDeath(client, position) {
updatePlayerSpawnedState(client, true);
} else {
let closestHospital = getClosestHospital(getPlayerPosition(client));
- //client.despawnPlayer();
+ client.despawnPlayer();
getPlayerCurrentSubAccount(client).interior = closestHospital.interior;
getPlayerCurrentSubAccount(client).dimension = closestHospital.dimension;
if(getServerGame() == GAME_GTA_IV) {
@@ -566,16 +570,6 @@ function onPlayerSpawn(client) {
updatePlayerCash(client);
getPlayerData(client).payDayTickStart = sdl.ticks;
-
- if(getPlayerCurrentSubAccount(client).inBusiness > 0) {
- setEntityData(client.player, "vrr.inBusiness", getBusinessIdFromDatabaseId(getPlayerCurrentSubAccount(client).inBusiness), true);
- }
-
- if(getPlayerCurrentSubAccount(client).inHouse > 0) {
- setEntityData(client.player, "vrr.inHouse", getHouseIdFromDatabaseId(getPlayerCurrentSubAccount(client).inHouse), true);
- }
-
-
//}
}
diff --git a/scripts/server/help.js b/scripts/server/help.js
index cff3d8d3..68138212 100644
--- a/scripts/server/help.js
+++ b/scripts/server/help.js
@@ -254,7 +254,7 @@ function showWebsiteHelpMessage(client) {
function showDiscordHelpMessage(client) {
messagePlayerInfo(client, `${getInlineChatColourByType("clanOrange")}== ${getInlineChatColourByType("jobYellow")}Discord ${getInlineChatColourByType("clanOrange")}=============================`);
- messagePlayerNormal(client, `${getInlineChatColourByType("clanOrange")}• ${getInlineChatColourByName("white")}Discord coming soon!`);
+ messagePlayerNormal(client, `${getInlineChatColourByType("clanOrange")}• ${getInlineChatColourByName("white")}https://discord.gg/hA8GSdYyw6`);
}
// ===========================================================================
diff --git a/scripts/server/house.js b/scripts/server/house.js
index 1da10df7..148bcf43 100644
--- a/scripts/server/house.js
+++ b/scripts/server/house.js
@@ -455,8 +455,7 @@ function setHouseBlipCommand(command, params, client) {
deleteGameElement(getHouseData(houseId).entranceBlip);
}
- createHouseEntranceBlip(houseId);
-
+ resetHouseBlips(houseId);
getHouseData(houseId).needsSaved = true;
messageAdmins(`[#AAAAAA]${client.name} [#FFFFFF]set house [#11CC11]${getHouseData(houseId).description} [#FFFFFF]blip display to [#AAAAAA]${toLowerCase(typeParam)}`);
@@ -490,10 +489,8 @@ function moveHouseEntranceCommand(command, params, client) {
//createAllHouseBlips(houseId);
//createAllHousePickups(houseId);
- deleteHouseEntrancePickup(houseId);
- deleteHouseEntranceBlip(houseId);
- createHouseEntrancePickup(houseId);
- createHouseEntranceBlip(houseId);
+ resetHouseBlips();
+ resetHousePickups();
getHouseData(houseId).needsSaved = true;
@@ -1307,4 +1304,22 @@ function canPlayerLockUnlockHouse(client, houseId) {
return false;
}
+// ===========================================================================
+
+function resetHousePickups(houseId) {
+ deleteHouseEntrancePickup(houseId);
+ deleteHouseExitPickup(houseId);
+ createHouseEntrancePickup(houseId);
+ createHouseExitPickup(houseId);
+}
+
+// ===========================================================================
+
+function resetHouseBlips(houseId) {
+ deleteHouseEntranceBlip(houseId);
+ deleteHouseExitBlip(houseId);
+ createHouseEntranceBlip(houseId);
+ createHouseExitBlip(houseId);
+}
+
// ===========================================================================
\ No newline at end of file
diff --git a/scripts/server/item.js b/scripts/server/item.js
index 8c53b6d8..0f6a7145 100644
--- a/scripts/server/item.js
+++ b/scripts/server/item.js
@@ -107,9 +107,8 @@ function createGroundItemObject(itemId) {
setElementRotation(getItemData(itemId).object, getItemTypeData(getItemData(itemId).itemTypeIndex).dropRotation);
setElementOnAllDimensions(getItemData(itemId).object, false);
setElementDimension(getItemData(itemId).object, getItemData(itemId).dimension);
- //setEntityData(getItemData(itemId).object, "vrr.scale", getItemTypeData(getItemData(itemId).itemTypeIndex).dropScale, true);
+ setEntityData(getItemData(itemId).object, "vrr.scale", getItemTypeData(getItemData(itemId).itemTypeIndex).dropScale, true);
addToWorld(getItemData(itemId).object);
- //setEntityData(getItemData(itemId).object, "vrr.scale", getItemTypeData(getItemData(itemId).itemTypeIndex).dropScale, true);
getServerData().groundItemCache.push(itemId);
}
@@ -208,6 +207,11 @@ function useItemCommand(command, params, client) {
return false;
}
+ if(getPlayerData(client).usingSkinSelect) {
+ messagePlayerError(client, `Your can't use an item while customizing your appearance`);
+ return false;
+ }
+
getPlayerData(client).itemActionState = VRR_ITEM_ACTION_USE;
getPlayerData(client).itemActionItem = hotBarSlot;
showPlayerItemUseDelay(client, hotBarSlot);
@@ -272,6 +276,11 @@ function pickupItemCommand(command, params, client) {
return false;
}
+ if(getPlayerData(client).usingSkinSelect) {
+ messagePlayerError(client, `Your can't pick up an item while customizing your appearance`);
+ return false;
+ }
+
getPlayerData(client).itemActionState = VRR_ITEM_ACTION_PICKUP;
getPlayerData(client).itemActionItem = itemId;
showPlayerItemPickupDelay(client, itemId);
@@ -317,6 +326,11 @@ function dropItemCommand(command, params, client) {
return false;
}
+ if(getPlayerData(client).usingSkinSelect) {
+ messagePlayerError(client, `Your can't drop an item while customizing your appearance`);
+ return false;
+ }
+
getPlayerData(client).itemActionState = VRR_ITEM_ACTION_DROP;
getPlayerData(client).itemActionItem = hotBarSlot;
showPlayerItemDropDelay(client, hotBarSlot);
@@ -350,6 +364,11 @@ function putItemCommand(command, params, client) {
return false;
}
+ if(getPlayerData(client).usingSkinSelect) {
+ messagePlayerError(client, `Your can't store an item while customizing your appearance`);
+ return false;
+ }
+
getPlayerData(client).itemActionItem = hotBarSlot;
getPlayerData(client).itemActionState = VRR_ITEM_ACTION_PUT;
showPlayerItemPutDelay(client, hotBarSlot);
@@ -383,6 +402,11 @@ function takeItemCommand(command, params, client) {
return false;
}
+ if(getPlayerData(client).usingSkinSelect) {
+ messagePlayerError(client, `Your can't take an item while customizing your appearance`);
+ return false;
+ }
+
getPlayerData(client).itemActionItem = itemId;
getPlayerData(client).itemActionState = VRR_ITEM_ACTION_TAKE;
showPlayerItemTakeDelay(client, itemId);
@@ -627,6 +651,11 @@ function playerUseItem(client, hotBarSlot) {
if(getDistance(getPlayerPosition(client), getVehiclePosition(vehicle)) <= getGlobalConfig().vehicleRepairDistance) {
meActionToNearbyPlayers(client, `takes their repair kit and fixes the vehicle`);
repairVehicle(vehicle);
+
+ getItemData(itemIndex).value = getItemData(itemIndex).value - getItemTypeData(getItemData(itemIndex).itemTypeIndex).useValue;
+ if(getItemData(itemIndex).value == 0) {
+ destroyItem(itemIndex);
+ }
}
break;
@@ -916,7 +945,7 @@ function playerSwitchHotBarSlotCommand(command, params, client) {
}
if(getPlayerData(client).activeHotBarSlot == hotBarSlot) {
- return false;
+ hotBarSlot = -1;
}
if(getPlayerData(client).itemActionState != VRR_ITEM_ACTION_NONE) {
@@ -924,6 +953,11 @@ function playerSwitchHotBarSlotCommand(command, params, client) {
return false;
}
+ if(getPlayerData(client).usingSkinSelect) {
+ messagePlayerError(client, `Your can't switch items while customizing your appearance`);
+ return false;
+ }
+
switchPlayerActiveHotBarSlot(client, hotBarSlot);
}
diff --git a/scripts/server/messaging.js b/scripts/server/messaging.js
index 6016f360..f103d2de 100644
--- a/scripts/server/messaging.js
+++ b/scripts/server/messaging.js
@@ -19,39 +19,38 @@ function messageAdminAction(messageText) {
if(getServerConfig().discordEnabled) {
messageDiscord(`:warning: ${messageText}`);
}
- //logToConsole(LOG_INFO, `[VRR.Messaging] ADMIN: ${messageText}`);
}
// ===========================================================================
function messagePlayerNormal(client, messageText, colour = COLOUR_WHITE) {
if(isConsole(client)) {
+ console.log(messageText);
logToConsole(LOG_INFO, `[VRR.Messaging] ${messageText}`);
return true;
}
- sendChatBoxMessageToPlayer(client, `${messageText}`, colour);
-
- //if(!isClientFromDiscord(client)) {
- //
- //} else {
- // messageDiscordUser(client, `${messageText}`);
- //}
+ sendChatBoxMessageToPlayer(client, `${replaceColoursInMessage(messageText)}`, colour);
}
// ===========================================================================
function messageAdmins(messageText, colour = COLOUR_WHITE) {
+ let plainMessage = removeColoursInMessage(messageText);
+
let clients = getClients();
for(let i in clients) {
if(isConsole(clients[i])) {
- logToConsole(LOG_INFO, `[VRR.Messaging] ADMINS: ${messageText}`);
+ logToConsole(LOG_INFO, `[VRR.Messaging] ADMINS: ${plainMessage}`);
} else {
if(doesPlayerHaveStaffPermission(clients[i], getStaffFlagValue("basicModeration"))) {
- sendChatBoxMessageToPlayer(clients[i], `🛡️ ${messageText}`, getColourByName("softRed"));
+ messagePlayerNormal(clients[i], `🛡️ ${messageText}`, getColourByName("softRed"));
}
}
+ }
+ if(getServerConfig().discordConfig.sendAdminEvents) {
+ messageDiscordAdminChannel(plainMessage);
}
}
diff --git a/scripts/server/misc.js b/scripts/server/misc.js
index 9189d92c..39327d79 100644
--- a/scripts/server/misc.js
+++ b/scripts/server/misc.js
@@ -122,41 +122,69 @@ function submitBugReportCommand(command, params, client) {
// ===========================================================================
function enterExitPropertyCommand(command, params, client) {
- let closestBusinessEntrance = getClosestBusinessEntrance(getPlayerPosition(client), getPlayerDimension(client));
- let closestBusinessExit = getClosestBusinessExit(getPlayerPosition(client), getPlayerDimension(client));
- let closestHouseEntrance = getClosestHouseEntrance(getPlayerPosition(client), getPlayerDimension(client));
- let closestHouseExit = getClosestHouseExit(getPlayerPosition(client), getPlayerDimension(client));
+ //let closestBusinessEntrance = getClosestBusinessEntrance(getPlayerPosition(client), getPlayerDimension(client));
+ //let closestBusinessExit = getClosestBusinessExit(getPlayerPosition(client), getPlayerDimension(client));
+ //let closestHouseEntrance = getClosestHouseEntrance(getPlayerPosition(client), getPlayerDimension(client));
+ //let closestHouseExit = getClosestHouseExit(getPlayerPosition(client), getPlayerDimension(client));
- let closestEntrance = null;
- let closestExit = null;
let closestProperty = null;
let isEntrance = false;
let isBusiness = false;
- if(getDistance(getPlayerPosition(client), getBusinessData(closestBusinessEntrance).entrancePosition) <= getDistance(getPlayerPosition(client), getHouseData(closestHouseEntrance).entrancePosition)) {
- closestEntrance = getBusinessData(closestBusinessEntrance);
- } else {
- closestEntrance = getHouseData(closestHouseEntrance);
- }
+ //if(getDistance(getPlayerPosition(client), getBusinessData(closestBusinessEntrance).entrancePosition) <= getDistance(getPlayerPosition(client), getHouseData(closestHouseEntrance).entrancePosition)) {
+ // closestEntrance = getBusinessData(closestBusinessEntrance);
+ //} else {
+ // closestEntrance = getHouseData(closestHouseEntrance);
+ //}
- if(getDistance(getPlayerPosition(client), getBusinessData(closestBusinessExit).exitPosition) <= getDistance(getPlayerPosition(client), getHouseData(closestHouseExit).exitPosition)) {
- closestExit = getBusinessData(closestBusinessExit);
- } else {
- closestExit = getHouseData(closestHouseExit);
- }
+ //if(getDistance(getPlayerPosition(client), getBusinessData(closestBusinessExit).exitPosition) <= getDistance(getPlayerPosition(client), getHouseData(closestHouseExit).exitPosition)) {
+ // closestExit = getBusinessData(closestBusinessExit);
+ //} else {
+ // closestExit = getHouseData(closestHouseExit);
+ //}
- if(getDistance(getPlayerPosition(client), closestEntrance.entrancePosition) <= getDistance(getPlayerPosition(client), closestExit.exitPosition)) {
- closestProperty = closestEntrance;
- isEntrance = true;
- } else {
- closestProperty = closestExit;
- isEntrance = false;
- }
+ //if(getDistance(getPlayerPosition(client), closestEntrance.entrancePosition) <= getDistance(getPlayerPosition(client), closestExit.exitPosition)) {
+ // closestProperty = closestEntrance;
+ // isEntrance = true;
+ //} else {
+ // closestProperty = closestExit;
+ // isEntrance = false;
+ //}
- if(closestProperty instanceof HouseData) {
- isBusiness = false;
- } else {
- isBusiness = true;
+ if(getPlayerData(client).currentPickup != false) {
+ let ownerType = getEntityData(getPlayerData(client).currentPickup, "vrr.owner.type");
+ let ownerId = getEntityData(getPlayerData(client).currentPickup, "vrr.owner.id");
+
+ //logToConsole(LOG_DEBUG, `${getPlayerDisplayForConsole(client)} is near pickup for owner ID ${ownerId}`);
+
+ switch(ownerType) {
+ case VRR_PICKUP_BUSINESS_ENTRANCE:
+ isBusiness = true;
+ isEntrance = true;
+ closestProperty = getServerData().businesses[ownerId];
+ break;
+
+ case VRR_PICKUP_BUSINESS_EXIT:
+ isBusiness = true;
+ isEntrance = false;
+ closestProperty = getServerData().businesses[ownerId];
+ break;
+
+ case VRR_PICKUP_HOUSE_ENTRANCE:
+ isBusiness = false;
+ isEntrance = true;
+ closestProperty = getServerData().houses[ownerId];
+ break;
+
+ case VRR_PICKUP_HOUSE_EXIT:
+ isBusiness = false;
+ isEntrance = false;
+ closestProperty = getServerData().houses[ownerId];
+ break;
+
+ default:
+ return false;
+ }
}
logToConsole(LOG_DEBUG, `${getPlayerDisplayForConsole(client)}'s closest door is ${(isBusiness) ? closestProperty.name : closestProperty.description} ${(isEntrance) ? "entrance" : "exit"}`);
@@ -167,6 +195,12 @@ function enterExitPropertyCommand(command, params, client) {
meActionToNearbyPlayers(client, `tries to open the ${(isBusiness) ? "business" : "house"} door but fails because it's locked`);
return false;
}
+
+ if(!closestProperty.hasInterior) {
+ messagePlayerAlert(client, `This ${(isBusiness) ? "business" : "house"} does not have an interior, but you can still use commands at the door icon.`);
+ return false;
+ }
+
clearPlayerStateToEnterExitProperty(client);
getPlayerData(client).pedState = VRR_PEDSTATE_ENTERINGPROPERTY;
meActionToNearbyPlayers(client, `opens the door and enters the ${(isBusiness) ? "business" : "house"}`);
@@ -234,22 +268,6 @@ function enterExitPropertyCommand(command, params, client) {
// ===========================================================================
-function loadGameFixesResource() {
- //switch(getServerGame()) {
- // case GAME_GTA_III:
- // if(findResourceByName("asshat-gta3") != null) {
- // findResourceByName("asshat-gta3").start();
- // }
- // break;
- //
- // default:
- // break;
- //}
- return true;
-}
-
-// ===========================================================================
-
function getPlayerInfoCommand(command, params, client) {
if(areParamsEmpty(params)) {
return false;
diff --git a/scripts/server/moderation.js b/scripts/server/moderation.js
index 689aa708..0a68beb9 100644
--- a/scripts/server/moderation.js
+++ b/scripts/server/moderation.js
@@ -379,7 +379,8 @@ function gotoPositionCommand(command, params, client) {
return false;
}
- let splitParams = params.replace(",", "").split(" ");
+ params = params.replace(",", "");
+ splitParams = params.split(" ");
let x = splitParams[0] || getPlayerPosition(client).x;
let y = splitParams[1] || getPlayerPosition(client).y;
let z = splitParams[2] || getPlayerPosition(client).z;
@@ -407,9 +408,10 @@ function teleportForwardCommand(command, params, client) {
return false;
}
- setPlayerPosition(client, getPosInFrontOfPos(getPlayerPosition(client), getPlayerHeading(client), params));
+ let distance = toFloat(params) || 1;
+ setPlayerPosition(client, getPosInFrontOfPos(getPlayerPosition(client), getPlayerHeading(client), distance));
- messagePlayerSuccess(client, `You teleported forward ${params} meters`);
+ messagePlayerSuccess(client, `You teleported forward ${distance} meters`);
}
// ===========================================================================
@@ -420,9 +422,10 @@ function teleportBackwardCommand(command, params, client) {
return false;
}
- setPlayerPosition(client, getPosBehindPos(getPlayerPosition(client), getPlayerHeading(client), params));
+ let distance = toFloat(params) || 1;
+ setPlayerPosition(client, getPosBehindPos(getPlayerPosition(client), getPlayerHeading(client), distance));
- messagePlayerSuccess(client, `You teleported backward ${getInlineChatColourByName("lightGrey")}${params} ${getInlineChatColourByName("white")}meters`);
+ messagePlayerSuccess(client, `You teleported backward ${getInlineChatColourByName("lightGrey")}${distance} ${getInlineChatColourByName("white")}meters`);
}
// ===========================================================================
@@ -433,9 +436,10 @@ function teleportLeftCommand(command, params, client) {
return false;
}
- setPlayerPosition(client, getPosToLeftOfPos(getPlayerPosition(client), getPlayerHeading(client), params));
+ let distance = toFloat(params) || 1;
+ setPlayerPosition(client, getPosToLeftOfPos(getPlayerPosition(client), fixAngle(getPlayerHeading(client)), distance));
- messagePlayerSuccess(client, `You teleported left ${getInlineChatColourByName("lightGrey")}${params} ${getInlineChatColourByName("white")}meters`);
+ messagePlayerSuccess(client, `You teleported left ${getInlineChatColourByName("lightGrey")}${distance} ${getInlineChatColourByName("white")}meters`);
}
// ===========================================================================
@@ -446,9 +450,10 @@ function teleportUpCommand(command, params, client) {
return false;
}
- setPlayerPosition(client, getPosAbovePos(getPlayerPosition(client), params));
+ let distance = toFloat(params) || 1;
+ setPlayerPosition(client, getPosAbovePos(getPlayerPosition(client), distance));
- messagePlayerSuccess(client, `You teleported up ${getInlineChatColourByName("lightGrey")}${params} ${getInlineChatColourByName("white")}meters`);
+ messagePlayerSuccess(client, `You teleported up ${getInlineChatColourByName("lightGrey")}${distance} ${getInlineChatColourByName("white")}meters`);
}
// ===========================================================================
@@ -459,9 +464,10 @@ function teleportDownCommand(command, params, client) {
return false;
}
- setPlayerPosition(client, getPosBelowPos(getPlayerPosition(client), params));
+ let distance = toFloat(params) || 1;
+ setPlayerPosition(client, getPosBelowPos(getPlayerPosition(client), distance));
- messagePlayerSuccess(client, `You teleported down ${getInlineChatColourByName("lightGrey")}${params} ${getInlineChatColourByName("white")}meters`);
+ messagePlayerSuccess(client, `You teleported down ${getInlineChatColourByName("lightGrey")}${distance} ${getInlineChatColourByName("white")}meters`);
}
// ===========================================================================
@@ -472,9 +478,10 @@ function teleportRightCommand(command, params, client) {
return false;
}
- setPlayerPosition(client, getPosToRightOfPos(getPlayerPosition(client), getPlayerHeading(client), params));
+ let distance = toFloat(params) || 1;
+ setPlayerPosition(client, getPosToRightOfPos(getPlayerPosition(client), fixAngle(getPlayerHeading(client)), distance));
- messagePlayerSuccess(client, `You teleported right ${getInlineChatColourByName("lightGrey")}${params} ${getInlineChatColourByName("white")}meters`);
+ messagePlayerSuccess(client, `You teleported right ${getInlineChatColourByName("lightGrey")}${distance} ${getInlineChatColourByName("white")}meters`);
}
// ===========================================================================
@@ -549,11 +556,11 @@ function getPlayerCommand(command, params, client) {
//getPlayerData(targetClient).returnToInterior = getPlayerInterior(targetClient);
if(isPlayerInAnyHouse(targetClient)) {
- getPlayerData(targetClient).returnToHouse = getEntityData(client, "vrr.inHouse");
+ getPlayerData(targetClient).returnToHouse = getPlayerHouse(targetClient);
}
if(isPlayerInAnyBusiness(targetClient)) {
- getPlayerData(targetClient).returnToBusiness = getEntityData(client, "vrr.inBusiness");
+ getPlayerData(targetClient).returnToBusiness = getPlayerBusiness(targetClient);
}
setPlayerPosition(targetClient, getPosBehindPos(getPlayerPosition(client), getPlayerHeading(client), 2));
@@ -561,14 +568,6 @@ function getPlayerCommand(command, params, client) {
setPlayerInterior(targetClient, getPlayerInterior(client));
setPlayerDimension(targetClient, getPlayerDimension(client));
- if(isPlayerInAnyBusiness(client)) {
- setEntityData(client, "vrr.inBusiness", getPlayerBusiness(client), true);
- }
-
- if(isPlayerInAnyBusiness(client)) {
- setEntityData(client, "vrr.inHouse", getPlayerBusiness(client), true);
- }
-
messagePlayerSuccess(client, `You teleported ${getInlineChatColourByName("lightGrey")}${getPlayerName(targetClient)} ${getInlineChatColourByName("white")}to you.`);
messagePlayerAlert(targetClient, `An admin has teleported you to their location`);
}
@@ -599,14 +598,6 @@ function returnPlayerCommand(command, params, client) {
setPlayerInterior(targetClient, getPlayerData(targetClient).returnToInterior);
setPlayerDimension(targetClient, getPlayerData(targetClient).returnToDimension);
- if(getPlayerData(targetClient).returnToHouse != null) {
- setEntityData(client, "vrr.inHouse", getPlayerData(targetClient).returnToHouse, true);
- }
-
- if(getPlayerData(targetClient).returnToBusiness != null) {
- setEntityData(client, "vrr.inBusiness", getPlayerData(targetClient).returnToBusiness, true);
- }
-
getPlayerData(targetClient).returnToPosition = null;
getPlayerData(targetClient).returnToHeading = null;
getPlayerData(targetClient).returnToDimension = null;
@@ -798,7 +789,7 @@ function givePlayerMoneyCommand(command, params, client) {
return false;
}
- givePlayerMoney(client, toInteger(amount));
+ givePlayerCash(client, toInteger(amount));
updatePlayerCash(targetClient);
messagePlayerSuccess(client, `You gave ${getInlineChatColourByName("lightGrey")}$${amount} ${getInlineChatColourByName("white")}to ${getInlineChatColourByName("lightGrey")}${getCharacterFullName(targetClient)}`);
messagePlayerAlert(client, `An admin gave you ${getInlineChatColourByName("lightGrey")}$${amount}`);
diff --git a/scripts/server/native/gtac.js b/scripts/server/native/gtac.js
index a1f0f30a..fb8b2407 100644
--- a/scripts/server/native/gtac.js
+++ b/scripts/server/native/gtac.js
@@ -3133,12 +3133,12 @@ let gameData = {
ammunation: 20,
payAndSpray: 18,
vehicleDealership: 6,
- restaurant: -1,
- fastFood: -1,
+ restaurant: 0,
+ fastFood: 0,
bank: 0,
- fuelStation: -1,
- business: -1,
- house: -1,
+ fuelStation: 0,
+ business: 0,
+ house: 0,
},
{ // GTA VC
policeStation: 0,
@@ -3147,12 +3147,12 @@ let gameData = {
ammunation: 16,
payAndSpray: 27,
vehicleDealership: 7,
- restaurant: -1,
- fastFood: -1,
+ restaurant: 0,
+ fastFood: 0,
bank: 0,
- fuelStation: -1,
- business: -1,
- house: -1,
+ fuelStation: 0,
+ business: 0,
+ house: 0,
},
{ // GTA SA
policeStation: 30,
@@ -3164,14 +3164,14 @@ let gameData = {
airplaneDealership: 5,
boatDealership: 9,
restaurant: 50,
- fastFood: -1,
+ fastFood: 0,
clothes: 45,
pizza: 29,
chicken: 14,
burger: 10,
bank: 52,
gasStation: 17,
- business: -1,
+ business: 0,
house: 31,
bar: 49,
club: 48,
@@ -3182,32 +3182,21 @@ let gameData = {
job: 56,
},
{ // GTA UG
- policeStation: 8,
- fireStation: 9,
- hospital: 12,
- ammunation: 20,
- payAndSpray: 18,
- vehicleDealership: 6,
- restaurant: -1,
- fastFood: -1,
- bank: 52,
- fuelStation: 0,
- business: -1,
- house: -1,
+
},
{ // GTA IV
- policeStation: 8,
- fireStation: 9,
- hospital: 12,
- ammunation: 20,
+ policeStation: 60,
+ fireStation: 61,
+ hospital: 62,
+ ammunation: 59,
payAndSpray: 18,
vehicleDealership: 6,
- restaurant: -1,
- fastFood: -1,
+ restaurant: 57,
+ fastFood: 21,
bank: 52,
fuelStation: 0,
- business: -1,
- house: -1,
+ business: 0,
+ house: 29,
},
],
pickupModels: [
@@ -3502,6 +3491,27 @@ let gameData = {
["Hot Wings", 500, 2],
["Bottle of Soda", 500, 2],
],
+ coffeeDonutShop: [
+ ["Glazed Donut", 500, 2],
+ ["Frosted Donut", 500, 2],
+ ["Jelly Donut", 500, 2],
+ ["Cream-filled Donut", 500, 2],
+ ["Apple Fritter", 500, 2],
+ ["Pumpkin Spice Latte", 500, 2],
+ ["Mocha Latte", 500, 2],
+ ["Iced Coffee", 500, 2],
+ ["Large Coffee", 500, 2],
+ ["Small Coffee", 500, 2],
+ ],
+ vehicleRepairShop: [
+ ["Vehicle Repair Kit", 500, 2],
+ ["Vehicle Decal Kit", 500, 2],
+ ["Vehicle Primary Colour Kit", 500, 2],
+ ["Vehicle Secondary Colour Kit", 500, 2],
+ //["Vehicle NOS Kit", 500, 2],
+ //["Vehicle Hydraulics Kit", 500, 2],
+ //["Vehicle Body Part Kit", 500, 2],
+ ],
},
{
clothingStore: [
@@ -3615,6 +3625,27 @@ let gameData = {
["Hot Wings", 500, 2],
["Bottle of Soda", 500, 2],
],
+ coffeeDonutShop: [
+ ["Glazed Donut", 500, 2],
+ ["Frosted Donut", 500, 2],
+ ["Jelly Donut", 500, 2],
+ ["Cream-filled Donut", 500, 2],
+ ["Apple Fritter", 500, 2],
+ ["Pumpkin Spice Latte", 500, 2],
+ ["Mocha Latte", 500, 2],
+ ["Iced Coffee", 500, 2],
+ ["Large Coffee", 500, 2],
+ ["Small Coffee", 500, 2],
+ ],
+ vehicleRepairShop: [
+ ["Vehicle Repair Kit", 500, 2],
+ ["Vehicle Decal Kit", 500, 2],
+ ["Vehicle Primary Colour Kit", 500, 2],
+ ["Vehicle Secondary Colour Kit", 500, 2],
+ //["Vehicle NOS Kit", 500, 2],
+ //["Vehicle Hydraulics Kit", 500, 2],
+ //["Vehicle Body Part Kit", 500, 2],
+ ],
},
{
clothingStore: [
@@ -3735,6 +3766,28 @@ let gameData = {
["Hot Wings", 500, 2],
["Bottle of Soda", 500, 2],
],
+ coffeeDonutShop: [
+ ["Glazed Donut", 500, 2],
+ ["Frosted Donut", 500, 2],
+ ["Jelly Donut", 500, 2],
+ ["Cream-filled Donut", 500, 2],
+ ["Apple Fritter", 500, 2],
+ ["Pumpkin Spice Latte", 500, 2],
+ ["Mocha Latte", 500, 2],
+ ["Iced Coffee", 500, 2],
+ ["Apple Fritter", 500, 2],
+ ["Large Coffee", 500, 2],
+ ["Small Coffee", 500, 2],
+ ],
+ vehicleRepairShop: [
+ ["Vehicle Repair Kit", 500, 2],
+ ["Vehicle Decal Kit", 500, 2],
+ ["Vehicle Primary Colour Kit", 500, 2],
+ ["Vehicle Secondary Colour Kit", 500, 2],
+ //["Vehicle NOS Kit", 500, 2],
+ //["Vehicle Hydraulics Kit", 500, 2],
+ //["Vehicle Body Part Kit", 500, 2],
+ ],
}
],
interiorTemplates: [
@@ -4328,7 +4381,9 @@ function setPlayerDimension(client, dimension) {
function setPlayerInterior(client, interior) {
logToConsole(LOG_DEBUG, `Setting ${getPlayerDisplayForConsole(client)}'s interior to ${interior}`);
sendPlayerSetInterior(client, interior);
- getPlayerCurrentSubAccount(client).interior = interior;
+ if(isPlayerLoggedIn(client) && isPlayerSpawned(client)) {
+ getPlayerCurrentSubAccount(client).interior = interior;
+ }
}
// ===========================================================================
@@ -4402,6 +4457,7 @@ function getVehicleForNetworkEvent(vehicle) {
function deleteGameElement(element) {
logToConsole(LOG_DEBUG, `Destroying game element ${element.id} (Type: ${element.type})`);
if(element != null) {
+ //removeFromWorld(element);
destroyElement(element);
return true;
}
@@ -4464,7 +4520,11 @@ function getPlayerArmour(client) {
// ===========================================================================
function setPlayerCash(client, amount) {
- if(typeof amount != "number") {
+ if(client == null) {
+ return false;
+ }
+
+ if(isNan(amount)) {
return false;
}
@@ -4475,7 +4535,11 @@ function setPlayerCash(client, amount) {
// ===========================================================================
function givePlayerCash(client, amount) {
- if(typeof amount != "number") {
+ if(client == null) {
+ return false;
+ }
+
+ if(isNan(amount)) {
return false;
}
@@ -4486,7 +4550,11 @@ function givePlayerCash(client, amount) {
// ===========================================================================
function takePlayerCash(client, amount) {
- if(typeof amount != "number") {
+ if(client == null) {
+ return false;
+ }
+
+ if(isNan(amount)) {
return false;
}
diff --git a/scripts/server/radio.js b/scripts/server/radio.js
index b077d1eb..ea6126a4 100644
--- a/scripts/server/radio.js
+++ b/scripts/server/radio.js
@@ -82,6 +82,7 @@ function playStreamingRadioCommand(command, params, client) {
let clients = getClients();
for(let i in clients) {
if(getPlayerVehicle(client) == getPlayerVehicle(clients[i])) {
+ setPlayerVanillaRadioStation(clients[i], 0);
playRadioStreamForPlayer(clients[i], getRadioStationData(radioStationId-1).url, true, getPlayerStreamingRadioVolume(client));
}
}
@@ -107,12 +108,13 @@ function playStreamingRadioCommand(command, params, client) {
let clients = getClients();
for(let i in clients) {
if(getEntityData(clients[i], "vrr.inHouse") == houseId) {
+ setPlayerVanillaRadioStation(clients[i], 0);
playRadioStreamForPlayer(clients[i], getRadioStationData(radioStationId-1).url, true, getPlayerStreamingRadioVolume(clients[i]));
}
}
}
- } else if(doesEntityDataExist(client, "vrr.inBusiness")) {
- let businessId = getEntityData(client, "vrr.inBusiness");
+ } else if(isPlayerInAnyBusiness(client)) {
+ let businessId = getPlayerBusiness(client);
if(radioStationId == 0) {
getBusinessData(businessId).streamingRadioStation = -1;
getPlayerData(client).streamingRadioStation = -1;
@@ -120,8 +122,8 @@ function playStreamingRadioCommand(command, params, client) {
let clients = getClients();
for(let i in clients) {
- if(getEntityData(clients[i], "vrr.inBusiness") == businessId) {
- playRadioStreamForPlayer(clients[i], "");
+ if(getPlayerBusiness(clients[i]) == businessId) {
+ stopRadioStreamForPlayer(clients[i]);
}
}
} else {
@@ -131,7 +133,8 @@ function playStreamingRadioCommand(command, params, client) {
let clients = getClients();
for(let i in clients) {
- if(getEntityData(clients[i], "vrr.inBusiness") == businessId) {
+ if(getPlayerBusiness(clients[i]) == businessId) {
+ setPlayerVanillaRadioStation(clients[i], 0);
playRadioStreamForPlayer(clients[i], getRadioStationData(radioStationId-1).url, true, getPlayerStreamingRadioVolume(clients[i]));
}
}
diff --git a/scripts/server/startup.js b/scripts/server/startup.js
index 8147f6b8..5579e9ef 100644
--- a/scripts/server/startup.js
+++ b/scripts/server/startup.js
@@ -40,8 +40,6 @@ function initServerScripts() {
initTimers();
- loadGameFixesResource();
-
serverStartTime = getCurrentUnixTimestamp();
initCommandScript();
diff --git a/scripts/server/subaccount.js b/scripts/server/subaccount.js
index 5b4ccc6a..fcce63f7 100644
--- a/scripts/server/subaccount.js
+++ b/scripts/server/subaccount.js
@@ -201,7 +201,7 @@ function createSubAccount(accountId, firstName, lastName) {
let safeFirstName = escapeDatabaseString(dbConnection, firstName);
let safeLastName = escapeDatabaseString(dbConnection, lastName);
- dbQuery = queryDatabase(dbConnection, `INSERT INTO sacct_main (sacct_acct, sacct_name_first, sacct_name_last, sacct_pos_x, sacct_pos_y, sacct_pos_z, sacct_rot_z, sacct_cash, sacct_server, sacct_health, sacct_when_made, sacct_when_lastlogin) VALUES (${accountId}, '${safeFirstName}', '${safeLastName}', ${getServerConfig().newCharacter.spawnPosition.x}, ${getServerConfig().newCharacter.spawnPosition.y}, ${getServerConfig().newCharacter.spawnPosition.z}, ${getServerConfig().newCharacter.spawnHeading}, ${getServerConfig().newCharacter.money}, ${getServerId()}, 100, UNIX_TIMESTAMP(), 0)`);
+ dbQuery = queryDatabase(dbConnection, `INSERT INTO sacct_main (sacct_acct, sacct_name_first, sacct_name_last, sacct_pos_x, sacct_pos_y, sacct_pos_z, sacct_rot_z, sacct_cash, sacct_server, sacct_health, sacct_when_made, sacct_when_lastlogin) VALUES (${accountId}, '${safeFirstName}', '${safeLastName}', ${getServerConfig().newCharacter.spawnPosition.x}, ${getServerConfig().newCharacter.spawnPosition.y}, ${getServerConfig().newCharacter.spawnPosition.z}, ${getServerConfig().newCharacter.spawnHeading}, ${getServerConfig().newCharacter.money}, ${getServerId()}, 100, CURRENT_TIMESTAMP(), 0)`);
//if(dbQuery) {
if(getDatabaseInsertId(dbConnection) > 0) {
let dbInsertId = getDatabaseInsertId(dbConnection);
@@ -250,7 +250,7 @@ function showCharacterSelectToClient(client) {
messagePlayerNormal(client, `You have the following characters. Use /usechar to select one:`, getColourByName("teal"));
getPlayerData(client).subAccounts.forEach(function(subAccount, index) {
let tempSubAccount = getPlayerData(client).subAccounts[0];
- let clanName = (tempSubAccount.clan != 0) ? getClanData(tempSubAccount.clan).name : "None";
+ let clanName = (tempSubAccount.clan != 0) ? getClanData(getClanIdFromDatabaseId(tempSubAccount.clan)).name : "None";
let lastPlayedText = (tempSubAccount.lastLogin != 0) ? `${msToTime(getCurrentUnixTimestamp()-tempSubAccount.lastLogin)} ago` : "Never";
messagePlayerNormal(client, `${index+1} • [#BBBBBB]${subAccount.firstName} ${subAccount.lastName} ($${tempSubAccount.cash}, ${lastPlayedText})`);
});
@@ -320,7 +320,7 @@ function checkPreviousCharacter(client) {
let subAccountId = getPlayerData(client).currentSubAccount;
let tempSubAccount = getPlayerData(client).subAccounts[subAccountId];
- let clanName = (tempSubAccount.clan != 0) ? getClanData(tempSubAccount.clan).name : "None";
+ let clanName = (tempSubAccount.clan != 0) ? getClanData(getClanIdFromDatabaseId(tempSubAccount.clan)).name : "None";
let lastPlayedText = (tempSubAccount.lastLogin != 0) ? `${getTimeDifferenceDisplay(tempSubAccount.lastLogin, getCurrentUnixTimestamp())} ago` : "Never";
showPlayerCharacterSelectGUI(client, tempSubAccount.firstName, tempSubAccount.lastName, tempSubAccount.cash, clanName, lastPlayedText, tempSubAccount.skin);
@@ -341,7 +341,7 @@ function checkNextCharacter(client) {
let subAccountId = getPlayerData(client).currentSubAccount;
let tempSubAccount = getPlayerData(client).subAccounts[subAccountId];
- let clanName = (tempSubAccount.clan != 0) ? getClanData(tempSubAccount.clan).name : "None";
+ let clanName = (tempSubAccount.clan != 0) ? getClanData(getClanIdFromDatabaseId(tempSubAccount.clan)).name : "None";
let lastPlayedText = (tempSubAccount.lastLogin != 0) ? `${getTimeDifferenceDisplay(tempSubAccount.lastLogin, getCurrentUnixTimestamp())} ago` : "Never";
showPlayerCharacterSelectGUI(client, tempSubAccount.firstName, tempSubAccount.lastName, tempSubAccount.cash, clanName, lastPlayedText, tempSubAccount.skin);
diff --git a/scripts/server/timers.js b/scripts/server/timers.js
index 2f6f4228..bd1e7ea4 100644
--- a/scripts/server/timers.js
+++ b/scripts/server/timers.js
@@ -81,19 +81,36 @@ function saveAllServerDataToDatabase() {
function initTimers() {
//if(!isDevelopmentServer()) {
- serverTimers.saveDataIntervalTimer = setInterval(saveAllServerDataToDatabase, 600000);
- //serverTimers.updateTimeRuleTimer = setInterval(updateTimeRule, 60000);
serverTimers.updatePingsTimer = setInterval(updatePings, 5000);
- serverTimers.vehicleRentTimer = setInterval(vehicleRentCheck, 60000);
- serverTimers.garbageCollectorTimer = setInterval(collectAllGarbage, 60000);
- serverTimers.payDayTimer = setInterval(checkPayDays, 1800000);
- serverTimers.randomTipTimer = setInterval(showRandomTipToAllPlayers, 600000);
- serverTimers.gameTime = setInterval(checkServerGameTime, 60000);
+ serverTimers.oneMinuteTimer = setInterval(oneMinuteTimerFunction, 60000);
+ serverTimers.fifteenMinuteTimer = setInterval(tenMinuteTimerFunction, 600000);
+ serverTimers.thirtyMinuteTimer = setInterval(thirtyMinuteTimerFunction, 1800000);
//}
}
// ===========================================================================
+function oneMinuteTimerFunction() {
+ checkServerGameTime();
+ vehicleRentCheck();
+ collectAllGarbage();
+}
+
+// ===========================================================================
+
+function tenMinuteTimerFunction() {
+ showRandomTipToAllPlayers();
+ saveAllServerDataToDatabase();
+}
+
+// ===========================================================================
+
+function thirtyMinuteTimerFunction() {
+ checkPayDays();
+}
+
+// ===========================================================================
+
function vehicleRentCheck() {
for(let i in getServerData().vehicles) {
if(getServerData().vehicles[i] != null) {
diff --git a/scripts/server/utilities.js b/scripts/server/utilities.js
index 41ab5975..7878d9a9 100644
--- a/scripts/server/utilities.js
+++ b/scripts/server/utilities.js
@@ -1109,7 +1109,7 @@ function getPluralForm(name) {
// ===========================================================================
-function removeColoursFromString(str) {
+function removeHexColoursFromString(str) {
let matchRegex = /#([a-f0-9]{3}|[a-f0-9]{4}(?:[a-f0-9]{2}){0,2})\b/gi;
let matchedHexes = str.match(matchRegex);
for(let i in matchHex) {
@@ -1144,6 +1144,8 @@ function showConnectCameraToPlayer(client) {
}
if(isCustomCameraSupported()) {
+ //setPlayerInterior(client, 0);
+ //setPlayerDimension(client, 0);
setPlayerCameraLookAt(client, getServerConfig().connectCameraPosition, getServerConfig().connectCameraLookAt);
}
}
@@ -1587,4 +1589,31 @@ function getClientFromSyncerId(syncerId) {
return getClients().filter(c => c.index == syncerId)[0];
}
-// ===========================================================================
\ No newline at end of file
+// ===========================================================================
+
+function fixAngle(angle) {
+ angle = radToDeg(angle);
+ if(angle < 0)
+ {
+ angle = Math.abs(angle);
+ angle = ((180-angle+1)+180);
+ }
+ return degToRad(angle);
+}
+
+// ===========================================================================
+
+async function triggerWebHook(webHookURL, payloadData) {
+ return new Promise(resolve => {
+ //console.warn(webHookURL);
+ httpGet(
+ webHookURL,
+ `data=${payloadData}`,
+ function(data) {
+ //console.warn(JSON.parse(data));
+ },
+ function(data) {
+ }
+ );
+ });
+}
\ No newline at end of file
diff --git a/scripts/server/vehicle.js b/scripts/server/vehicle.js
index 034f5665..2117ee19 100644
--- a/scripts/server/vehicle.js
+++ b/scripts/server/vehicle.js
@@ -452,7 +452,7 @@ function vehicleColourCommand(command, params, client) {
}
if(getPlayerCurrentSubAccount(client).cash < getGlobalConfig().resprayVehicleCost) {
- messagePlayerError(client, `You don't have enough money to respray the vehicle (need $${getGlobalConfig().resprayVehicleCost-getPlayerCurrentSubAccount(client).cash} more!)`);
+ messagePlayerError(client, `You don't have enough money to respray the vehicle (need $${makeLargeNumberReadable(getGlobalConfig().resprayVehicleCost-getPlayerCurrentSubAccount(client).cash)} more!)`);
return false;
}
@@ -495,7 +495,7 @@ function vehicleRepairCommand(command, params, client) {
}
if(getPlayerCurrentSubAccount(client).cash < getGlobalConfig().repairVehicleCost) {
- messagePlayerError(client, `You don't have enough money to repair the vehicle (need $${getGlobalConfig().resprayVehicleCost-getPlayerCurrentSubAccount(client).cash} more!)`);
+ messagePlayerError(client, `You don't have enough money to repair the vehicle (need $${makeLargeNumberReadable(getGlobalConfig().resprayVehicleCost-getPlayerCurrentSubAccount(client).cash)} more!)`);
return false;
}
@@ -530,7 +530,7 @@ function vehicleLiveryCommand(command, params, client) {
}
if(getPlayerCurrentSubAccount(client).cash < getGlobalConfig().repairVehicleCost) {
- messagePlayerError(client, `You don't have enough money to change the vehicle's livery (need $${getGlobalConfig().resprayVehicleCost-getPlayerCurrentSubAccount(client).cash} more!)`);
+ messagePlayerError(client, `You don't have enough money to change the vehicle's livery (need $${makeLargeNumberReadable(getGlobalConfig().resprayVehicleCost-getPlayerCurrentSubAccount(client).cash)} more!)`);
return false;
}
@@ -571,7 +571,7 @@ function buyVehicleCommand(command, params, client) {
}
if(getPlayerCurrentSubAccount(client).cash < getVehicleData(vehicle).buyPrice) {
- messagePlayerError(client, `You don't have enough money to buy this vehicle (need $${getVehicleData(vehicle).buyPrice-getPlayerCurrentSubAccount(client).cash} more!)`);
+ messagePlayerError(client, `You don't have enough money to buy this vehicle (need $${makeLargeNumberReadable(getVehicleData(vehicle).buyPrice-getPlayerCurrentSubAccount(client).cash)} more!)`);
return false;
}
@@ -632,7 +632,7 @@ function rentVehicleCommand(command, params, client) {
getVehicleData(vehicle).needsSaved = true;
meActionToNearbyPlayers(client, `rents the ${getVehicleName(vehicle)} and receives a set of vehicle keys!`);
- messagePlayerAlert(client, `You will be charged $${getVehicleData(vehicle).rentPrice} per minute to use this vehicle. To stop renting this vehicle, use /vehrent again.`);
+ messagePlayerAlert(client, `You will be charged $${makeLargeNumberReadable(getVehicleData(vehicle).rentPrice)} per minute to use this vehicle. To stop renting this vehicle, use /vehrent again.`);
if(!getVehicleData(vehicle).engine) {
if(!doesPlayerHaveKeyBindsDisabled(client) && doesPlayerHaveKeyBindForCommand(client, "engine")) {
@@ -913,7 +913,7 @@ function setVehicleRentPriceCommand(command, params, client) {
getVehicleData(vehicle).rentPrice = amount;
- messageAdmins(`${getInlineChatColourByName("lightGrey")}${getPlayerName(client)} ${getInlineChatColourByName("white")}set their ${getInlineChatColourByType("vehiclePurple")}${getVehicleName(vehicle)} ${getInlineChatColourByName("white")}rent price to ${getInlineChatColourByName("lightGrey")}$${amount}`);
+ messageAdmins(`${getInlineChatColourByName("lightGrey")}${getPlayerName(client)} ${getInlineChatColourByName("white")}set their ${getInlineChatColourByType("vehiclePurple")}${getVehicleName(vehicle)} ${getInlineChatColourByName("white")}rent price to ${getInlineChatColourByName("lightGrey")}$${makeLargeNumberReadable(amount)}`);
getVehicleData(vehicle).needsSaved = true;
}
@@ -938,7 +938,7 @@ function setVehicleBuyPriceCommand(command, params, client) {
getVehicleData(vehicle).buyPrice = amount;
- messageAdmins(`${getInlineChatColourByName("lightGrey")}${getPlayerName(client)} ${getInlineChatColourByName("white")}set their ${getInlineChatColourByType("vehiclePurple")}${getVehicleName(vehicle)}'s ${getInlineChatColourByName("white")}buy price to ${getInlineChatColourByName("lightGrey")}$${amount}`);
+ messageAdmins(`${getInlineChatColourByName("lightGrey")}${getPlayerName(client)} ${getInlineChatColourByName("white")}set their ${getInlineChatColourByType("vehiclePurple")}${getVehicleName(vehicle)}'s ${getInlineChatColourByName("white")}buy price to ${getInlineChatColourByName("lightGrey")}$${makeLargeNumberReadable(amount)}`);
getVehicleData(vehicle).needsSaved = true;
}
diff --git a/scripts/shared/utilities.js b/scripts/shared/utilities.js
index 400576e6..5333f853 100644
--- a/scripts/shared/utilities.js
+++ b/scripts/shared/utilities.js
@@ -391,6 +391,10 @@ function getDistance(vec1, vec2) {
// ===========================================================================
function logToConsole(tempLogLevel, text) {
+ if(typeof server != "undefined") {
+ text = removeColoursInMessage(text);
+ }
+
if((logLevel & tempLogLevel) || logLevel == LOG_ALL) {
if(tempLogLevel == LOG_ERROR) {
console.error(text);