This commit is contained in:
Vortrex
2021-06-21 15:06:38 -05:00
parent 853294eb67
commit 49dde311a2
18 changed files with 8020 additions and 152 deletions

View File

@@ -1,8 +1,8 @@
{ {
"host": "", "host": "localhost",
"user": "", "user": "root",
"pass": "", "pass": "",
"name": "", "name": "gtac_roleplay",
"port": 3306, "port": 3306,
"usePersistentConnection": true "usePersistentConnection": true
} }

View File

@@ -109,11 +109,6 @@
"keyName": "9", "keyName": "9",
"commandString": "i 9", "commandString": "i 9",
"keyState": 1 "keyState": 1
},
{
"keyName": "e",
"commandString": "action primary",
"keyState": 3
} }
] ]
} }

7845
database.sql Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -2,15 +2,15 @@
<info author="Vortrex" version="1.0" description="Vortrex's Roleplay Resource" /> <info author="Vortrex" version="1.0" description="Vortrex's Roleplay Resource" />
<!-- Shared --> <!-- Shared -->
<script src="scripts/shared/native.js" type="server" language="javascript" /> <script src="scripts/shared/native/gtac.js" type="server" language="javascript" />
<script src="scripts/shared/native.js" type="client" language="javascript" /> <script src="scripts/shared/native/gtac.js" type="client" language="javascript" />
<script src="scripts/shared/const.js" type="server" language="javascript" /> <script src="scripts/shared/const.js" type="server" language="javascript" />
<script src="scripts/shared/const.js" type="client" language="javascript" /> <script src="scripts/shared/const.js" type="client" language="javascript" />
<!-- Server --> <!-- Server -->
<script src="scripts/server/class.js" type="server" language="javascript" /> <script src="scripts/server/class.js" type="server" language="javascript" />
<script src="scripts/server/account.js" type="server" language="javascript" /> <script src="scripts/server/account.js" type="server" language="javascript" />
<script src="scripts/server/ammunation.js" type="server" language="javascript" /> <!--<script src="scripts/server/ammunation.js" type="server" language="javascript" />-->
<script src="scripts/server/anticheat.js" type="server" language="javascript" /> <script src="scripts/server/anticheat.js" type="server" language="javascript" />
<script src="scripts/server/ban.js" type="server" language="javascript" /> <script src="scripts/server/ban.js" type="server" language="javascript" />
<script src="scripts/server/bitflag.js" type="server" language="javascript" /> <script src="scripts/server/bitflag.js" type="server" language="javascript" />
@@ -36,7 +36,7 @@
<script src="scripts/server/locale.js" type="server" language="javascript" /> <script src="scripts/server/locale.js" type="server" language="javascript" />
<script src="scripts/server/messaging.js" type="server" language="javascript" /> <script src="scripts/server/messaging.js" type="server" language="javascript" />
<script src="scripts/server/misc.js" type="server" language="javascript" /> <script src="scripts/server/misc.js" type="server" language="javascript" />
<script src="scripts/server/native.js" type="server" language="javascript" /> <script src="scripts/server/native/gtac.js" type="server" language="javascript" />
<script src="scripts/server/npc.js" type="server" language="javascript" /> <script src="scripts/server/npc.js" type="server" language="javascript" />
<script src="scripts/server/moderation.js" type="server" language="javascript" /> <script src="scripts/server/moderation.js" type="server" language="javascript" />
<script src="scripts/server/radio.js" type="server" language="javascript" /> <script src="scripts/server/radio.js" type="server" language="javascript" />

View File

@@ -727,7 +727,7 @@ function checkLogin(client, password) {
// =========================================================================== // ===========================================================================
function checkRegistration(client, password, confirmPassword = "", emailAddress = "") { function checkRegistration(client, password, confirmPassword = "", emailAddress = "") {
logToConsole(LOG_DEBUG, "[VRR.Account]: Checking registration for " + toString(getPlayerName(client))); logToConsole(LOG_DEBUG, `[VRR.Account]: Checking registration for ${getPlayerName(client)}`);
if(isPlayerRegistered(client)) { if(isPlayerRegistered(client)) {
if(getServerConfig().useGUI && doesPlayerHaveGUIEnabled(client)) { if(getServerConfig().useGUI && doesPlayerHaveGUIEnabled(client)) {
@@ -810,7 +810,10 @@ function checkRegistration(client, password, confirmPassword = "", emailAddress
getPlayerData(client).loggedIn = true; getPlayerData(client).loggedIn = true;
messagePlayerSuccess(client, "Your account has been created!"); messagePlayerSuccess(client, "Your account has been created!");
messagePlayerAlert(client, "Don't forget to verify your email! A verification code has been sent to you"); if(checkForSMTPModule() && getEmailConfig().enabled) {
messagePlayerAlert(client, "Don't forget to verify your email! A verification code has been sent to you");
return false;
}
messagePlayerAlert(client, "To play on the server, you will need to make a character."); messagePlayerAlert(client, "To play on the server, you will need to make a character.");
if(getServerConfig().useGUI && doesPlayerHaveGUIEnabled(client)) { if(getServerConfig().useGUI && doesPlayerHaveGUIEnabled(client)) {
@@ -818,7 +821,7 @@ function checkRegistration(client, password, confirmPassword = "", emailAddress
showPlayerPromptGUI(client, "You have no characters. Would you like to make one?", "No Characters"); showPlayerPromptGUI(client, "You have no characters. Would you like to make one?", "No Characters");
getPlayerData(client).promptType = VRR_PROMPT_CREATEFIRSTCHAR; getPlayerData(client).promptType = VRR_PROMPT_CREATEFIRSTCHAR;
if(getEmailConfig().enabled) { if(checkForSMTPModule() && getEmailConfig().enabled) {
let emailVerificationCode = generateEmailVerificationCode(); let emailVerificationCode = generateEmailVerificationCode();
setAccountEmailVerificationCode(getPlayerData(client).accountData, emailVerificationCode); setAccountEmailVerificationCode(getPlayerData(client).accountData, emailVerificationCode);
sendEmailVerificationEmail(client, emailVerificationCode); sendEmailVerificationEmail(client, emailVerificationCode);

View File

@@ -837,7 +837,7 @@ function getBusinessDataFromDatabaseId(databaseId) {
function getClosestBusinessEntrance(position) { function getClosestBusinessEntrance(position) {
let closest = getServerData().businesses[0].locations[0]; let closest = getServerData().businesses[0].locations[0];
for(let i in businesses) { for(let i in getServerData().businesses) {
for(let j in getServerData().businesses[i].locations) { for(let j in getServerData().businesses[i].locations) {
if(getDistance(position, businesses[i].locations[j].entrancePosition) <= getDistance(position, closest.entrancePosition)) { if(getDistance(position, businesses[i].locations[j].entrancePosition) <= getDistance(position, closest.entrancePosition)) {
closest = getServerData().businesses[i].locations[j]; closest = getServerData().businesses[i].locations[j];

View File

@@ -78,8 +78,7 @@ function initClassTable() {
if(dbAssoc) { if(dbAssoc) {
this.databaseId = dbAssoc["svr_id"]; this.databaseId = dbAssoc["svr_id"];
this.name = dbAssoc["svr_name"]; console.log("1");
this.password = dbAssoc["svr_password"];
this.newCharacter = { this.newCharacter = {
spawnPosition: toVector3(dbAssoc["svr_newchar_pos_x"], dbAssoc["svr_newchar_pos_y"], dbAssoc["svr_newchar_pos_z"]), spawnPosition: toVector3(dbAssoc["svr_newchar_pos_x"], dbAssoc["svr_newchar_pos_y"], dbAssoc["svr_newchar_pos_z"]),
spawnHeading: dbAssoc["svr_newchar_rot_z"], spawnHeading: dbAssoc["svr_newchar_rot_z"],
@@ -87,16 +86,16 @@ function initClassTable() {
bank: dbAssoc["svr_newchar_bank"], bank: dbAssoc["svr_newchar_bank"],
skin: dbAssoc["svr_newchar_skin"], skin: dbAssoc["svr_newchar_skin"],
}, },
this.connectCameraPosition = toVector3(dbAssoc["svr_connectcam_pos_x"], dbAssoc["svr_connectcam_pos_y"], dbAssoc["svr_connectcam_pos_z"]); this.connectCameraPosition = toVector3(dbAssoc["svr_connectcam_pos_x"], dbAssoc["svr_connectcam_pos_y"], dbAssoc["svr_connectcam_pos_z"]);
this.connectCameraLookAt = toVector3(dbAssoc["svr_connectcam_lookat_x"], dbAssoc["svr_connectcam_lookat_y"], dbAssoc["svr_connectcam_lookat_z"]); this.connectCameraLookAt = toVector3(dbAssoc["svr_connectcam_lookat_x"], dbAssoc["svr_connectcam_lookat_y"], dbAssoc["svr_connectcam_lookat_z"]);
this.characterSelectCameraPosition = toVector3(dbAssoc["svr_charselect_cam_pos_x"], dbAssoc["svr_charselect_cam_pos_y"], dbAssoc["svr_charselect_cam_pos_z"]); //this.characterSelectCameraPosition = toVector3(dbAssoc["svr_charselect_cam_pos_x"], dbAssoc["svr_charselect_cam_pos_y"], dbAssoc["svr_charselect_cam_pos_z"]);
this.characterSelectCameraLookAt = toVector3(dbAssoc["svr_charselect_cam_lookat_x"], dbAssoc["svr_charselect_cam_lookat_y"], dbAssoc["svr_charselect_cam_lookat_z"]); //this.characterSelectCameraLookAt = toVector3(dbAssoc["svr_charselect_cam_lookat_x"], dbAssoc["svr_charselect_cam_lookat_y"], dbAssoc["svr_charselect_cam_lookat_z"]);
this.characterSelectPedPosition = toVector3(dbAssoc["svr_charselect_ped_pos_x"], dbAssoc["svr_charselect_ped_pos_y"], dbAssoc["svr_charselect_ped_pos_z"]);
this.characterSelectPedHeading = toFloat(dbAssoc["svr_charselect_ped_rot_z"]); //this.characterSelectPedPosition = toVector3(dbAssoc["svr_charselect_ped_pos_x"], dbAssoc["svr_charselect_ped_pos_y"], dbAssoc["svr_charselect_ped_pos_z"]);
this.characterSelectInterior = toInteger(dbAssoc["svr_charselect_int"]); //this.characterSelectPedHeading = toFloat(dbAssoc["svr_charselect_ped_rot_z"]);
this.characterSelectDimension = toInteger(dbAssoc["svr_charselect_int"]); //this.characterSelectInterior = toInteger(dbAssoc["svr_charselect_int"]);
//this.characterSelectDimension = toInteger(dbAssoc["svr_charselect_int"]);
this.hour = toInteger(dbAssoc["svr_start_time_hour"]); this.hour = toInteger(dbAssoc["svr_start_time_hour"]);
this.minute = toInteger(dbAssoc["svr_start_time_min"]); this.minute = toInteger(dbAssoc["svr_start_time_min"]);
@@ -640,28 +639,28 @@ function initClassTable() {
this.exitPickup = null; this.exitPickup = null;
this.exitBlip = null; this.exitBlip = null;
if(houseAssoc != false) { if(dbAssoc) {
this.databaseId = toInteger(houseAssoc["house_id"]); this.databaseId = toInteger(dbAssoc["house_id"]);
this.description = toString(houseAssoc["house_description"]); this.description = toString(dbAssoc["house_description"]);
this.ownerType = toInteger(houseAssoc["house_owner_type"]); this.ownerType = toInteger(dbAssoc["house_owner_type"]);
this.ownerId = toInteger(houseAssoc["house_owner_id"]); this.ownerId = toInteger(dbAssoc["house_owner_id"]);
this.buyPrice = toInteger(houseAssoc["house_buy_price"]); this.buyPrice = toInteger(dbAssoc["house_buy_price"]);
this.locked = intToBool(toInteger(houseAssoc["house_locked"])); this.locked = intToBool(toInteger(dbAssoc["house_locked"]));
this.hasInterior = intToBool(toInteger(houseAssoc["house_has_interior"])); this.hasInterior = intToBool(toInteger(dbAssoc["house_has_interior"]));
this.entrancePosition = toVector3(toFloat(houseAssoc["house_entrance_pos_x"]), toFloat(houseAssoc["house_entrance_pos_y"]), toFloat(houseAssoc["house_entrance_pos_z"])); this.entrancePosition = toVector3(toFloat(dbAssoc["house_entrance_pos_x"]), toFloat(dbAssoc["house_entrance_pos_y"]), toFloat(dbAssoc["house_entrance_pos_z"]));
this.entranceRotation = toFloat(houseAssoc["house_entrance_rot_z"]); this.entranceRotation = toFloat(dbAssoc["house_entrance_rot_z"]);
this.entranceInterior = toInteger(houseAssoc["house_entrance_int"]); this.entranceInterior = toInteger(dbAssoc["house_entrance_int"]);
this.entranceDimension = toInteger(houseAssoc["house_entrance_vw"]); this.entranceDimension = toInteger(dbAssoc["house_entrance_vw"]);
this.entrancePickupModel = toInteger(houseAssoc["house_entrance_pickup"]); this.entrancePickupModel = toInteger(dbAssoc["house_entrance_pickup"]);
this.entranceBlipModel = toInteger(houseAssoc["house_entrance_blip"]); this.entranceBlipModel = toInteger(dbAssoc["house_entrance_blip"]);
this.exitPosition = toVector3(toFloat(houseAssoc["house_exit_pos_x"]), toFloat(houseAssoc["house_exit_pos_y"]), toFloat(houseAssoc["house_exit_pos_z"])); this.exitPosition = toVector3(toFloat(dbAssoc["house_exit_pos_x"]), toFloat(dbAssoc["house_exit_pos_y"]), toFloat(dbAssoc["house_exit_pos_z"]));
this.exitRotation = toFloat(houseAssoc["house_exit_rot_z"]); this.exitRotation = toFloat(dbAssoc["house_exit_rot_z"]);
this.exitInterior = toInteger(houseAssoc["house_exit_int"]); this.exitInterior = toInteger(dbAssoc["house_exit_int"]);
this.exitDimension = toInteger(houseAssoc["house_exit_vw"]); this.exitDimension = toInteger(dbAssoc["house_exit_vw"]);
this.exitPickupModel = toInteger(houseAssoc["house_exit_pickup"]); this.exitPickupModel = toInteger(dbAssoc["house_exit_pickup"]);
this.exitBlipModel = toInteger(houseAssoc["house_exit_blip"]); this.exitBlipModel = toInteger(dbAssoc["house_exit_blip"]);
} }
} }
}, },

View File

@@ -80,6 +80,14 @@ function getHexColourByName(colourName) {
// =========================================================================== // ===========================================================================
function getHexColourByType(colourName) {
let rgbaColour = getServerColours().byType[colourName];
let rgbaArray = rgbaArrayFromToColour(rgbaColour);
return rgbToHex(rgbaArray[0], rgbaArray[1], rgbaArray[2]);
}
// ===========================================================================
function getPlayerColour(client) { function getPlayerColour(client) {
if(getPlayerData(client) != false) { if(getPlayerData(client) != false) {
if(!isPlayerLoggedIn(client)) { if(!isPlayerLoggedIn(client)) {
@@ -139,4 +147,34 @@ function getRandomRGB() {
]); ]);
} }
// ===========================================================================
function getInlineChatColourByName(colourName) {
return `[${getHexColourByName(colourName)}]`;
}
// ===========================================================================
function getInlineChatColourByType(colourName) {
return `[${getHexColourByType(colourName)}]`;
}
// ===========================================================================
function rgbaArrayFromToColour(colour) {
return [
(colour >> 16) & 0xFF, // red
(colour >> 8) & 0xFF,
colour & 0xFF,
(colour >> 24) & 0xFF// alpha
];
}
// ===========================================================================
function hexFromToColour(colour) {
let rgba = rgbaArrayFromToColour(colour);
return rgbToHex(rgba[0], rgba[1], rgba[2]);
}
// =========================================================================== // ===========================================================================

View File

@@ -36,7 +36,7 @@ function initCommandScript() {
// =========================================================================== // ===========================================================================
function loadCommands() { function loadCommands() {
return { let tempCommands = {
account: [ account: [
commandData("login", loginCommand, "<password>", getStaffFlagValue("none"), false, false, "Login to an account"), commandData("login", loginCommand, "<password>", getStaffFlagValue("none"), false, false, "Login to an account"),
commandData("register", registerCommand, "<password>", getStaffFlagValue("none"), false, false, "Creates an account"), commandData("register", registerCommand, "<password>", getStaffFlagValue("none"), false, false, "Creates an account"),
@@ -375,6 +375,8 @@ function loadCommands() {
commandData("passenger", enterVehicleAsPassengerCommand, "", getStaffFlagValue("none"), true, true), commandData("passenger", enterVehicleAsPassengerCommand, "", getStaffFlagValue("none"), true, true),
], ],
}; };
return tempCommands;
} }
// =========================================================================== // ===========================================================================

View File

@@ -979,8 +979,8 @@ function loadServerConfigFromId(tempServerId) {
// =========================================================================== // ===========================================================================
function applyConfigToServer(tempServerConfig) { function applyConfigToServer(tempServerConfig) {
server.name = tempServerConfig.name; //server.name = tempServerConfig.name;
server.password = tempServerConfig.password; //server.password = tempServerConfig.password;
gta.time.hour = tempServerConfig.hour; gta.time.hour = tempServerConfig.hour;
gta.time.minute = tempServerConfig.minute; gta.time.minute = tempServerConfig.minute;
gta.forceWeather(tempServerConfig.weather); gta.forceWeather(tempServerConfig.weather);

View File

@@ -8,6 +8,10 @@
// =========================================================================== // ===========================================================================
function initEmailScript() { function initEmailScript() {
if(!checkForSMTPModule()) {
return false;
}
logToConsole(LOG_INFO, "[VRR.Email]: Initializing email script ..."); logToConsole(LOG_INFO, "[VRR.Email]: Initializing email script ...");
emailConfig = loadEmailConfiguration(); emailConfig = loadEmailConfiguration();
logToConsole(LOG_INFO, "[VRR.Email]: Email script initialized successfully!"); logToConsole(LOG_INFO, "[VRR.Email]: Email script initialized successfully!");
@@ -16,6 +20,10 @@ function initEmailScript() {
// =========================================================================== // ===========================================================================
function sendEmail(toEmail, toName, subject, body) { function sendEmail(toEmail, toName, subject, body) {
if(!checkForSMTPModule()) {
return false;
}
module.smtp.send( module.smtp.send(
getEmailConfig().smtp.host, getEmailConfig().smtp.host,
getEmailConfig().smtp.port, getEmailConfig().smtp.port,

View File

@@ -91,7 +91,7 @@ function onPlayerChat(event, client, messageText) {
messageText = messageText.substring(0, 128); messageText = messageText.substring(0, 128);
messagePlayerNormal(null, `${getCharacterFullName(client)}: ${getInlineChatColourByName("white")}${messageText}`, getPlayerColour(client)); messagePlayerNormal(null, `${getInlineChatColourByName("white")}💬 [${hexFromToColour(getPlayerColour(client))}]${getCharacterFullName(client)}: ${getInlineChatColourByName("white")}${messageText}`, getPlayerColour(client));
} }
// =========================================================================== // ===========================================================================

View File

@@ -54,7 +54,11 @@ function loadHousesFromDatabase() {
// =========================================================================== // ===========================================================================
function loadHouseLocationsFromDatabase(houseId) { function loadHouseLocationsFromDatabase(houseId) {
console.log(`[VRR.House]: Loading locations for business '${getBusinessData(businessId).name}' from database ...`); if(!getHouseData(houseId)) {
return false;
}
console.log(`[VRR.House]: Loading locations for house '${getHouseData(houseId).description}' from database ...`);
let tempHouseLocations = []; let tempHouseLocations = [];
let dbConnection = connectToDatabase(); let dbConnection = connectToDatabase();
@@ -84,12 +88,12 @@ function loadHouseLocationsFromDatabase(houseId) {
function createHouseCommand(command, params, client) { function createHouseCommand(command, params, client) {
let tempHouseData = createHouse(params, getPlayerPosition(client), toVector3(0.0, 0.0, 0.0), getGameConfig().pickupModels[getServerGame()].house, getGameConfig().blipSprites[getServerGame()].house, getPlayerInterior(client), getPlayerDimension(client)); let tempHouseData = createHouse(params, getPlayerPosition(client), toVector3(0.0, 0.0, 0.0), getGameConfig().pickupModels[getServerGame()].house, getGameConfig().blipSprites[getServerGame()].house, getPlayerInterior(client), getPlayerDimension(client));
getServerData().houses.push(tempHouseData); let houseId = getServerData().houses.push(tempHouseData);
createHouseEntrancePickup(getServerData().houses.length-1); createHouseEntrancePickup(houseId);
createHouseExitPickup(getServerData().houses.length-1); createHouseExitPickup(houseId);
createHouseEntranceBlip(getServerData().houses.length-1); createHouseEntranceBlip(houseId);
createHouseExitBlip(getServerData().houses.length-1); createHouseExitBlip(houseId);
messageAdmins(`${getInlineChatColourByName("lightGrey")}${getPlayerName(client)} ${getInlineChatColourByName("white")}created house ${getInlineChatColourByType("houseGreen")}${tempHouseData.description}`); messageAdmins(`${getInlineChatColourByName("lightGrey")}${getPlayerName(client)} ${getInlineChatColourByName("white")}created house ${getInlineChatColourByType("houseGreen")}${tempHouseData.description}`);
} }
@@ -104,7 +108,13 @@ function lockUnlockHouseCommand(command, params, client) {
} }
getHouseData(houseId).locked = !getHouseData(houseId).locked; getHouseData(houseId).locked = !getHouseData(houseId).locked;
setEntityData(getHouseData(houseId).entrancePickup, "ag.label.locked", getHouseData(houseId).locked, true);
for(let i in getHouseData(houseId).locations) {
if(getHouseData(houseId).locations[i].type == VRR_HOUSE_LOC_DOOR) {
setEntityData(getHouseData(houseId).locations[i].entrancePickup, "ag.label.locked", getHouseData(houseId).locked, true);
}
}
messagePlayerSuccess(client, `House '${getHouseData(houseId).description}' ${getLockedUnlockedTextFromBool((getHouseData(houseId).locked))}!`); messagePlayerSuccess(client, `House '${getHouseData(houseId).description}' ${getLockedUnlockedTextFromBool((getHouseData(houseId).locked))}!`);
} }
@@ -122,7 +132,13 @@ function setHouseDescriptionCommand(command, params, client) {
let oldDescription = getHouseData(houseId).description; let oldDescription = getHouseData(houseId).description;
getHouseData(houseId).description = newHouseDescription; getHouseData(houseId).description = newHouseDescription;
setEntityData(getHouseData(houseId).entrancePickup, "ag.label.name", getHouseData(houseId).description, true);
for(let i in getHouseData(houseId).locations) {
if(getHouseData(houseId).locations[i].type == VRR_HOUSE_LOC_DOOR) {
setEntityData(getHouseData(houseId).entrancePickup, "ag.label.name", getHouseData(houseId).description, true);
}
}
messageAdmins(`${getPlayerName(client)} renamed house ${getInlineChatColourByType("houseGreen")}${oldDescription} ${getInlineChatColourByName("white")}to ${getInlineChatColourByType("houseGreen")}${getHouseData(houseId).description}`); messageAdmins(`${getPlayerName(client)} renamed house ${getInlineChatColourByType("houseGreen")}${oldDescription} ${getInlineChatColourByName("white")}to ${getInlineChatColourByType("houseGreen")}${getHouseData(houseId).description}`);
} }
@@ -218,79 +234,42 @@ function setHouseInteriorTypeCommand(command, params, client) {
} }
if(isNaN(typeParam)) { if(isNaN(typeParam)) {
let tempHouseLocation = new serverClasses.houseLocationData(false);
if(toLowerCase(typeParam) == "none") { if(toLowerCase(typeParam) == "none") {
getHouseData(houseId).exitPosition = toVector3(0.0, 0.0, 0.0); tempHouseLocation.exitPosition = toVector3(0.0, 0.0, 0.0);
getHouseData(houseId).exitInterior = -1; tempHouseLocation.exitInterior = -1;
getHouseData(houseId).hasInterior = false; getHouseData(houseId).hasInterior = false;
messageAdmins(`${getInlineChatColourByName("lightGrey")}${getPlayerName(client)} ${getInlineChatColourByName("white")}remove house ${getInlineChatColourByType("houseGreen")}${getHouseData(houseId).description} ${getInlineChatColourByName("white")}interior`); messageAdmins(`${getInlineChatColourByName("lightGrey")}${getPlayerName(client)} ${getInlineChatColourByName("white")}remove house ${getInlineChatColourByType("houseGreen")}${getHouseData(houseId).description} ${getInlineChatColourByName("white")}interior`);
return false; return false;
} }
if(isNull(getGameConfig().interiorTemplates[getServerGame()][typeParam])) { if(isNull(getGameConfig().interiorTemplates[getServerGame()][typeParam])) {
messagePlayerError(client, "Invalid interior type! Use an interior type name or an existing house database ID"); messagePlayerError(client, "Invalid interior type! Use an interior type name");
messagePlayerInfo(client, `Interior Types: ${getInlineChatColourByName("lightGrey")}${Object.keys(getGameConfig().interiorTemplates[getServerGame()]).join(", ")}`) messagePlayerInfo(client, `Interior Types: ${getInlineChatColourByName("lightGrey")}${Object.keys(getGameConfig().interiorTemplates[getServerGame()]).join(", ")}`)
return false; return false;
} }
getHouseData(houseId).exitPosition = getGameConfig().interiorTemplates[getServerGame()][typeParam].exitPosition; deleteHouseEntrancePickup(houseId);
getHouseData(houseId).exitInterior = getGameConfig().interiorTemplates[getServerGame()][typeParam].exitInterior; deleteHouseExitPickup(houseId);
getHouseData(houseId).exitDimension = getHouseData(houseId).databaseId+getGlobalConfig().houseDimensionStart;
getHouseData(houseId).hasInterior = true;
} else {
if(!getHouseData(houseId)) {
messagePlayerError(client, "Business ID not found!");
return false;
}
getHouseData(houseId).exitPosition = getHouseData(houseId).exitPosition;
getHouseData(houseId).exitInterior = getHouseData(houseId).exitInterior;
getHouseData(houseId).exitDimension = getHouseData(houseId).databaseId+getGlobalConfig().houseDimensionStart;
getHouseData(houseId).hasInterior = true;
}
deleteHouseEntrancePickup(houseId); getHouseData(houseId).locations = [];
deleteHouseExitPickup(houseId);
createHouseEntrancePickup(houseId); tempHouseLocation.exitPosition = getGameConfig().interiorTemplates[getServerGame()][typeParam].exitPosition;
createHouseExitPickup(houseId); tempHouseLocation.exitInterior = getGameConfig().interiorTemplates[getServerGame()][typeParam].exitInterior;
tempHouseLocation.exitDimension = getHouseData(houseId).databaseId+getGlobalConfig().houseDimensionStart;
getHouseData(houseId).hasInterior = true;
getHouseData(houseId).locations.push(tempHouseLocation);
createHouseEntrancePickups(houseId);
createHouseExitPickups(houseId);
}
messageAdmins(`${getInlineChatColourByName("lightGrey")}${getPlayerName(client)} ${getInlineChatColourByName("white")}set house ${getInlineChatColourByType("houseGreen")}${getHouseData(houseId).description} ${getInlineChatColourByName("white")}interior type to ${getInlineChatColourByName("lightGrey")}${toLowerCase(typeParam)}`); messageAdmins(`${getInlineChatColourByName("lightGrey")}${getPlayerName(client)} ${getInlineChatColourByName("white")}set house ${getInlineChatColourByType("houseGreen")}${getHouseData(houseId).description} ${getInlineChatColourByName("white")}interior type to ${getInlineChatColourByName("lightGrey")}${toLowerCase(typeParam)}`);
} }
// =========================================================================== // ===========================================================================
function setHouseBlipCommand(command, params, client) {
let typeParam = params || "house";
let houseId = (isPlayerInAnyHouse(client)) ? getPlayerHouse(client) : getClosestHouseEntrance(getPlayerPosition(client)).house;
if(!getHouseData(houseId)) {
messagePlayerError(client, "House not found!");
return false;
}
let entranceBlipModel = getGameConfig().blipSprites[getServerGame()].house;
if(isNaN(typeParam)) {
if(isNull(getGameConfig().blipSprites[getServerGame()][typeParam])) {
messagePlayerError(client, "Invalid house type! Use a house type name or a blip image ID");
messagePlayerInfo(client, `Pickup Types: ${getInlineChatColourByName("lightGrey")}${Object.keys(getGameConfig().blipSprites[getServerGame()]).join(", ")}`)
return false;
}
entranceBlipModel = getGameConfig().blipSprites[getServerGame()][typeParam];
} else {
entranceBlipModel = toInteger(typeParam);
}
if(getHouseData(houseId).entranceBlipModel != -1) {
if(getHouseData(houseId).entranceBlip != null) {
deleteGameElement(getHouseData(houseId).entranceBlip);
}
}
messageAdmins(`${getInlineChatColourByName("lightGrey")}${getPlayerName(client)} ${getInlineChatColourByName("white")}set house ${getInlineChatColourByType("houseGreen")}${getHouseData(houseId).description} ${getInlineChatColourByName("white")}blip display to ${getInlineChatColourByName("lightGrey")}${entranceBlipModel}`);
}
// ===========================================================================
function moveHouseEntranceCommand(command, params, client) { function moveHouseEntranceCommand(command, params, client) {
let houseId = (isPlayerInAnyHouse(client)) ? getPlayerHouse(client) : getClosestHouseEntrance(getPlayerPosition(client)).house; let houseId = (isPlayerInAnyHouse(client)) ? getPlayerHouse(client) : getClosestHouseEntrance(getPlayerPosition(client)).house;
@@ -299,15 +278,14 @@ function moveHouseEntranceCommand(command, params, client) {
return false; return false;
} }
getHouseData(houseId).entrancePosition = getPlayerPosition(client); getHouseData(houseId).locations[0].entrancePosition = getPlayerPosition(client);
getHouseData(houseId).entranceDimension = getPlayerDimension(client); getHouseData(houseId).locations[0].entranceDimension = getPlayerDimension(client);
getHouseData(houseId).entranceInterior = getPlayerInterior(client); getHouseData(houseId).locations[0].entranceInterior = getPlayerInterior(client);
deleteHouseEntranceBlip(houseId); deleteAllHouseBlips(houseId);
deleteHouseEntrancePickup(houseId); deleteAllHousePickups(houseId);
createAllHouseBlips(houseId);
createHouseEntranceBlip(houseId); createAllHousePickups(houseId);
createHouseEntrancePickup(houseId);
messageAdmins(`${getInlineChatColourByName("lightGrey")}${getPlayerName(client)} ${getInlineChatColourByName("white")}moved house ${getInlineChatColourByType("houseGreen")}${getHouseData(houseId).description} ${getInlineChatColourByName("white")}entrance to their position`); messageAdmins(`${getInlineChatColourByName("lightGrey")}${getPlayerName(client)} ${getInlineChatColourByName("white")}moved house ${getInlineChatColourByType("houseGreen")}${getHouseData(houseId).description} ${getInlineChatColourByName("white")}entrance to their position`);
} }
@@ -322,15 +300,16 @@ function moveHouseExitCommand(command, params, client) {
return false; return false;
} }
getHouseData(houseId).exitPosition = getPlayerPosition(client); getHouseData(houseId).locations = [];
getHouseData(houseId).exitDimension = getPlayerDimension(client);
getHouseData(houseId).exitInterior = getPlayerInterior(client);
deleteHouseExitBlip(houseId); getHouseData(houseId).locations[0].entrancePosition = getPlayerPosition(client);
deleteHouseExitPickup(houseId); getHouseData(houseId).locations[0].entranceDimension = getPlayerDimension(client);
getHouseData(houseId).locations[0].exitInterior = getPlayerInterior(client);
createHouseExitBlip(houseId); deleteAllHouseBlips(houseId);
createHouseExitPickup(houseId); deleteAllHousePickups(houseId);
createAllHouseBlips(houseId);
createAllHousePickups(houseId);
messageAdmins(`${getInlineChatColourByName("lightGrey")}${getPlayerName(client)} ${getInlineChatColourByName("white")}moved house ${getInlineChatColourByType("houseGreen")}${getHouseData(houseId).description} ${getInlineChatColourByName("white")}exit to their position`); messageAdmins(`${getInlineChatColourByName("lightGrey")}${getPlayerName(client)} ${getInlineChatColourByName("white")}moved house ${getInlineChatColourByType("houseGreen")}${getHouseData(houseId).description} ${getInlineChatColourByName("white")}exit to their position`);
} }
@@ -366,11 +345,8 @@ function deleteHouse(houseId, whoDeleted = 0) {
disconnectFromDatabase(dbConnection); disconnectFromDatabase(dbConnection);
} }
deleteHouseEntrancePickup(houseId); deleteAllHouseBlips(houseId);
deleteHouseExitPickup(houseId); deleteAllHousePickups(houseId);
deleteHouseEntranceBlip(houseId);
deleteHouseExitBlip(houseId);
removePlayersFromHouse(houseId); removePlayersFromHouse(houseId);
@@ -391,19 +367,22 @@ function createHouse(description, entrancePosition, exitPosition, entrancePickup
let tempHouseData = new serverClasses.houseData(false); let tempHouseData = new serverClasses.houseData(false);
tempHouseData.description = description; tempHouseData.description = description;
tempHouseData.entrancePosition = entrancePosition; let tempHouseLocation = new serverClasses.houseLocationData(false);
tempHouseData.entranceRotation = 0.0; tempHouseLocation.entrancePosition = entrancePosition;
tempHouseData.entrancePickupModel = entrancePickupModel; tempHouseLocation.entranceRotation = 0.0;
tempHouseData.entranceBlipModel = entranceBlipModel; tempHouseLocation.entrancePickupModel = entrancePickupModel;
tempHouseData.entranceInterior = entranceInteriorId; tempHouseLocation.entranceBlipModel = entranceBlipModel;
tempHouseData.entranceDimension = entranceVirtualWorld; tempHouseLocation.entranceInterior = entranceInteriorId;
tempHouseLocation.entranceDimension = entranceVirtualWorld;
tempHouseData.exitPosition = exitPosition; tempHouseLocation.exitPosition = exitPosition;
tempHouseData.exitRotation = 0.0; tempHouseLocation.exitRotation = 0.0;
tempHouseData.exitPickupModel = exitPickupModel; tempHouseLocation.exitPickupModel = exitPickupModel;
tempHouseData.exitBlipModel = exitBlipModel; tempHouseLocation.exitBlipModel = exitBlipModel;
tempHouseData.exitInterior = exitInteriorId; tempHouseLocation.exitInterior = exitInteriorId;
tempHouseData.exitDimension = exitVirtualWorld; tempHouseLocation.exitDimension = exitVirtualWorld;
tempHouseData.locations.push(tempHouseLocation);
return tempHouseData; return tempHouseData;
} }
@@ -422,7 +401,7 @@ function getHouseDataFromDatabaseId(databaseId) {
function getClosestHouseEntrance(position) { function getClosestHouseEntrance(position) {
let closest = getServerData().houses[0].locations[0]; let closest = getServerData().houses[0].locations[0];
for(let i in houses) { for(let i in getServerData().houses) {
for(let j in getServerData().houses[i].locations) { for(let j in getServerData().houses[i].locations) {
if(getDistance(position, houses[i].locations[j].entrancePosition) <= getDistance(position, closest.entrancePosition)) { if(getDistance(position, houses[i].locations[j].entrancePosition) <= getDistance(position, closest.entrancePosition)) {
closest = getServerData().houses[i].locations[j]; closest = getServerData().houses[i].locations[j];

View File

@@ -145,7 +145,7 @@ function addKeyBindCommand(command, params, client) {
if(!keyId) { if(!keyId) {
messagePlayerError(client, "The key ID or name you input is invalid!"); messagePlayerError(client, "The key ID or name you input is invalid!");
messagePlayerTip(client, "Use simple key names, letters, or numbers. Don't add spaces."); messagePlayerTip(client, "Use simple key names, letters, or numbers. Don't add spaces.");
messagePlayerInfo(client, "Examples: ${getInlineChatColourByName("lightGrey")}1, 2, a, b, numplus, num1, f1, f2, pageup, delete, insert, rightshift, leftctrl"); messagePlayerInfo(client, `Examples: ${getInlineChatColourByName("lightGrey")}1, 2, a, b, numplus, num1, f1, f2, pageup, delete, insert, rightshift, leftctrl`);
return false; return false;
} }
@@ -173,7 +173,7 @@ function removeKeyBindCommand(command, params, client) {
if(!keyId) { if(!keyId) {
messagePlayerError(client, "The key ID or name you input is invalid!"); messagePlayerError(client, "The key ID or name you input is invalid!");
messagePlayerTip(client, "Use simple key names, letters, or numbers. Don't add spaces."); messagePlayerTip(client, "Use simple key names, letters, or numbers. Don't add spaces.");
messagePlayerInfo(client, "Examples: ${getInlineChatColourByName("lightGrey")}1, 2, a, b, numplus, num1, f1, f2, pageup, delete, insert, rightshift, leftctrl"); messagePlayerInfo(client, `Examples: ${getInlineChatColourByName("lightGrey")}1, 2, a, b, numplus, num1, f1, f2, pageup, delete, insert, rightshift, leftctrl`);
return false; return false;
} }

View File

@@ -659,7 +659,7 @@ function getStaffFlagsCommand(command, params, client) {
} }
} }
messagePlayerInfo(client, `${getInlineChatColourByName("white")}${targetgetPlayerName(client)}'s staff flags: ${getInlineChatColourByName("lightGrey")}${tempStaffFlags.join("${getInlineChatColourByName("white")}, ${getInlineChatColourByName("lightGrey")}")}`); messagePlayerInfo(client, `${getInlineChatColourByName("white")}${targetgetPlayerName(client)}'s staff flags: ${getInlineChatColourByName("lightGrey")}${tempStaffFlags.join(getInlineChatColourByName("white"))}, ${getInlineChatColourByName("lightGrey")}")}`);
} }
// =========================================================================== // ===========================================================================
@@ -679,7 +679,7 @@ function allStaffFlagsCommand(command, params, client) {
return false; return false;
} }
messagePlayerInfo(client, `${getInlineChatColourByName("white")}Staff flags: ${getInlineChatColourByName("lightGrey")}${getServerBitFlagKeys().join("${getInlineChatColourByName("white")}, ${getInlineChatColourByName("lightGrey")}")}`); messagePlayerInfo(client, `${getInlineChatColourByName("white")}Staff flags: ${getInlineChatColourByName("lightGrey")}${getServerBitFlagKeys().join(getInlineChatColourByName("white"))}, ${getInlineChatColourByName("lightGrey")}")}`);
} }
// =========================================================================== // ===========================================================================

View File

@@ -95,8 +95,7 @@ function checkForAllRequiredModules() {
if(!checkForSMTPModule()) { if(!checkForSMTPModule()) {
console.warn("[VRR.Startup]: SMTP Email module is not loaded!"); console.warn("[VRR.Startup]: SMTP Email module is not loaded!");
console.warn("[VRR.Startup]: This resource will now shutdown."); console.warn("[VRR.Startup]: Email features will NOT be available!");
thisResource.stop();
} }
logToConsole(LOG_DEBUG, "[VRR.Startup]: All required modules loaded!"); logToConsole(LOG_DEBUG, "[VRR.Startup]: All required modules loaded!");

View File

@@ -158,7 +158,7 @@ function toString(val) {
// =========================================================================== // ===========================================================================
function toVector3(x, y, z) { function toVector3(x, y, z) {
return new Vec3(x, y, z); return new Vec3(toFloat(x), toFloat(y), toFloat(z));
} }
// =========================================================================== // ===========================================================================