* New script files to organize GUI * Added clientside pickup detection to reduce server load for enter/exit * Added notips command for players to toggle random tips * Select account last IP as part of wildcard (was separate due to old INT) * Save account registration with datetime instead of unix timestamp * Don't force mouse camera on moving anims in SA+ * Add IP ban to server runtime memory in subnet ban command * Add non-roleplay character name account moderation flag * Fix bizowner and bizclan commands * Fix bug that allowed buying items without having the needed cash * Fix set biz blip command * Add dealership help label type command * Added command to show all clan flag types * Added discord config and load from database * Fix angle for directional teleport and anim move directions * Use new colour structure in preparation for locale translations * Add on-foot only item usetype array to prevent using when in veh * Fix wrong const value for exit pickup type * Start using datetime in MySQL tables instead of unix timestamps * Start adding webhooks for discord (unfinished) * Added new discord URL to discord help category * Added house reset pickups/blips utils * Prevent using items when in skin selector * Fix get player command * Fix give player money command * Add coffee shop and vehicle repair shop default biz item templates * Remove old game fixes util (resource now in server config) * Fix bug where characters in clans wouldn't be shown in char select * Slimmed down the amount of timers * Made some potentially large numbers more readable (commas) * Remove colours in message for console output
210 lines
6.8 KiB
JavaScript
210 lines
6.8 KiB
JavaScript
let characterSelect = {
|
|
window: null,
|
|
skinImage: null,
|
|
nameText: null,
|
|
cashText: null,
|
|
clanText: null,
|
|
lastPlayedText: null,
|
|
previousCharacterButton: null,
|
|
nextCharacterButton: null,
|
|
selectCharacterButton: null,
|
|
newCharacterButton: null,
|
|
};
|
|
|
|
// ===========================================================================
|
|
|
|
function initCharacterSelectGUI() {
|
|
logToConsole(LOG_DEBUG, `[VRR.GUI] Creating character select GUI ...`);
|
|
characterSelect.window = mexui.window(game.width/2-215, game.height/2-83, 430, 190, 'Select Character', {
|
|
main: {
|
|
backgroundColour: toColour(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();
|
|
}
|
|
|
|
// ===========================================================================
|