Changes
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
{
|
||||
"host": "",
|
||||
"user": "",
|
||||
"host": "localhost",
|
||||
"user": "root",
|
||||
"pass": "",
|
||||
"name": "",
|
||||
"name": "gtac_roleplay",
|
||||
"port": 3306,
|
||||
"usePersistentConnection": true
|
||||
}
|
||||
@@ -109,11 +109,6 @@
|
||||
"keyName": "9",
|
||||
"commandString": "i 9",
|
||||
"keyState": 1
|
||||
},
|
||||
{
|
||||
"keyName": "e",
|
||||
"commandString": "action primary",
|
||||
"keyState": 3
|
||||
}
|
||||
]
|
||||
}
|
||||
7845
database.sql
Normal file
7845
database.sql
Normal file
File diff suppressed because it is too large
Load Diff
8
meta.xml
8
meta.xml
@@ -2,15 +2,15 @@
|
||||
<info author="Vortrex" version="1.0" description="Vortrex's Roleplay Resource" />
|
||||
|
||||
<!-- Shared -->
|
||||
<script src="scripts/shared/native.js" type="server" language="javascript" />
|
||||
<script src="scripts/shared/native.js" type="client" language="javascript" />
|
||||
<script src="scripts/shared/native/gtac.js" type="server" 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="client" language="javascript" />
|
||||
|
||||
<!-- Server -->
|
||||
<script src="scripts/server/class.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/ban.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/messaging.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/moderation.js" type="server" language="javascript" />
|
||||
<script src="scripts/server/radio.js" type="server" language="javascript" />
|
||||
|
||||
@@ -727,7 +727,7 @@ function checkLogin(client, password) {
|
||||
// ===========================================================================
|
||||
|
||||
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(getServerConfig().useGUI && doesPlayerHaveGUIEnabled(client)) {
|
||||
@@ -810,7 +810,10 @@ function checkRegistration(client, password, confirmPassword = "", emailAddress
|
||||
getPlayerData(client).loggedIn = true;
|
||||
|
||||
messagePlayerSuccess(client, "Your account has been created!");
|
||||
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.");
|
||||
|
||||
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");
|
||||
getPlayerData(client).promptType = VRR_PROMPT_CREATEFIRSTCHAR;
|
||||
|
||||
if(getEmailConfig().enabled) {
|
||||
if(checkForSMTPModule() && getEmailConfig().enabled) {
|
||||
let emailVerificationCode = generateEmailVerificationCode();
|
||||
setAccountEmailVerificationCode(getPlayerData(client).accountData, emailVerificationCode);
|
||||
sendEmailVerificationEmail(client, emailVerificationCode);
|
||||
|
||||
@@ -837,7 +837,7 @@ function getBusinessDataFromDatabaseId(databaseId) {
|
||||
|
||||
function getClosestBusinessEntrance(position) {
|
||||
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) {
|
||||
if(getDistance(position, businesses[i].locations[j].entrancePosition) <= getDistance(position, closest.entrancePosition)) {
|
||||
closest = getServerData().businesses[i].locations[j];
|
||||
|
||||
@@ -78,8 +78,7 @@ function initClassTable() {
|
||||
|
||||
if(dbAssoc) {
|
||||
this.databaseId = dbAssoc["svr_id"];
|
||||
this.name = dbAssoc["svr_name"];
|
||||
this.password = dbAssoc["svr_password"];
|
||||
console.log("1");
|
||||
this.newCharacter = {
|
||||
spawnPosition: toVector3(dbAssoc["svr_newchar_pos_x"], dbAssoc["svr_newchar_pos_y"], dbAssoc["svr_newchar_pos_z"]),
|
||||
spawnHeading: dbAssoc["svr_newchar_rot_z"],
|
||||
@@ -87,16 +86,16 @@ function initClassTable() {
|
||||
bank: dbAssoc["svr_newchar_bank"],
|
||||
skin: dbAssoc["svr_newchar_skin"],
|
||||
},
|
||||
|
||||
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.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.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.characterSelectInterior = toInteger(dbAssoc["svr_charselect_int"]);
|
||||
this.characterSelectDimension = toInteger(dbAssoc["svr_charselect_int"]);
|
||||
//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.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.characterSelectInterior = toInteger(dbAssoc["svr_charselect_int"]);
|
||||
//this.characterSelectDimension = toInteger(dbAssoc["svr_charselect_int"]);
|
||||
|
||||
this.hour = toInteger(dbAssoc["svr_start_time_hour"]);
|
||||
this.minute = toInteger(dbAssoc["svr_start_time_min"]);
|
||||
@@ -640,28 +639,28 @@ function initClassTable() {
|
||||
this.exitPickup = null;
|
||||
this.exitBlip = null;
|
||||
|
||||
if(houseAssoc != false) {
|
||||
this.databaseId = toInteger(houseAssoc["house_id"]);
|
||||
this.description = toString(houseAssoc["house_description"]);
|
||||
this.ownerType = toInteger(houseAssoc["house_owner_type"]);
|
||||
this.ownerId = toInteger(houseAssoc["house_owner_id"]);
|
||||
this.buyPrice = toInteger(houseAssoc["house_buy_price"]);
|
||||
this.locked = intToBool(toInteger(houseAssoc["house_locked"]));
|
||||
this.hasInterior = intToBool(toInteger(houseAssoc["house_has_interior"]));
|
||||
if(dbAssoc) {
|
||||
this.databaseId = toInteger(dbAssoc["house_id"]);
|
||||
this.description = toString(dbAssoc["house_description"]);
|
||||
this.ownerType = toInteger(dbAssoc["house_owner_type"]);
|
||||
this.ownerId = toInteger(dbAssoc["house_owner_id"]);
|
||||
this.buyPrice = toInteger(dbAssoc["house_buy_price"]);
|
||||
this.locked = intToBool(toInteger(dbAssoc["house_locked"]));
|
||||
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.entranceRotation = toFloat(houseAssoc["house_entrance_rot_z"]);
|
||||
this.entranceInterior = toInteger(houseAssoc["house_entrance_int"]);
|
||||
this.entranceDimension = toInteger(houseAssoc["house_entrance_vw"]);
|
||||
this.entrancePickupModel = toInteger(houseAssoc["house_entrance_pickup"]);
|
||||
this.entranceBlipModel = toInteger(houseAssoc["house_entrance_blip"]);
|
||||
this.entrancePosition = toVector3(toFloat(dbAssoc["house_entrance_pos_x"]), toFloat(dbAssoc["house_entrance_pos_y"]), toFloat(dbAssoc["house_entrance_pos_z"]));
|
||||
this.entranceRotation = toFloat(dbAssoc["house_entrance_rot_z"]);
|
||||
this.entranceInterior = toInteger(dbAssoc["house_entrance_int"]);
|
||||
this.entranceDimension = toInteger(dbAssoc["house_entrance_vw"]);
|
||||
this.entrancePickupModel = toInteger(dbAssoc["house_entrance_pickup"]);
|
||||
this.entranceBlipModel = toInteger(dbAssoc["house_entrance_blip"]);
|
||||
|
||||
this.exitPosition = toVector3(toFloat(houseAssoc["house_exit_pos_x"]), toFloat(houseAssoc["house_exit_pos_y"]), toFloat(houseAssoc["house_exit_pos_z"]));
|
||||
this.exitRotation = toFloat(houseAssoc["house_exit_rot_z"]);
|
||||
this.exitInterior = toInteger(houseAssoc["house_exit_int"]);
|
||||
this.exitDimension = toInteger(houseAssoc["house_exit_vw"]);
|
||||
this.exitPickupModel = toInteger(houseAssoc["house_exit_pickup"]);
|
||||
this.exitBlipModel = toInteger(houseAssoc["house_exit_blip"]);
|
||||
this.exitPosition = toVector3(toFloat(dbAssoc["house_exit_pos_x"]), toFloat(dbAssoc["house_exit_pos_y"]), toFloat(dbAssoc["house_exit_pos_z"]));
|
||||
this.exitRotation = toFloat(dbAssoc["house_exit_rot_z"]);
|
||||
this.exitInterior = toInteger(dbAssoc["house_exit_int"]);
|
||||
this.exitDimension = toInteger(dbAssoc["house_exit_vw"]);
|
||||
this.exitPickupModel = toInteger(dbAssoc["house_exit_pickup"]);
|
||||
this.exitBlipModel = toInteger(dbAssoc["house_exit_blip"]);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
@@ -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) {
|
||||
if(getPlayerData(client) != false) {
|
||||
if(!isPlayerLoggedIn(client)) {
|
||||
@@ -140,3 +148,33 @@ 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]);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -36,7 +36,7 @@ function initCommandScript() {
|
||||
// ===========================================================================
|
||||
|
||||
function loadCommands() {
|
||||
return {
|
||||
let tempCommands = {
|
||||
account: [
|
||||
commandData("login", loginCommand, "<password>", getStaffFlagValue("none"), false, false, "Login to 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),
|
||||
],
|
||||
};
|
||||
|
||||
return tempCommands;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
@@ -979,8 +979,8 @@ function loadServerConfigFromId(tempServerId) {
|
||||
// ===========================================================================
|
||||
|
||||
function applyConfigToServer(tempServerConfig) {
|
||||
server.name = tempServerConfig.name;
|
||||
server.password = tempServerConfig.password;
|
||||
//server.name = tempServerConfig.name;
|
||||
//server.password = tempServerConfig.password;
|
||||
gta.time.hour = tempServerConfig.hour;
|
||||
gta.time.minute = tempServerConfig.minute;
|
||||
gta.forceWeather(tempServerConfig.weather);
|
||||
|
||||
@@ -8,6 +8,10 @@
|
||||
// ===========================================================================
|
||||
|
||||
function initEmailScript() {
|
||||
if(!checkForSMTPModule()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
logToConsole(LOG_INFO, "[VRR.Email]: Initializing email script ...");
|
||||
emailConfig = loadEmailConfiguration();
|
||||
logToConsole(LOG_INFO, "[VRR.Email]: Email script initialized successfully!");
|
||||
@@ -16,6 +20,10 @@ function initEmailScript() {
|
||||
// ===========================================================================
|
||||
|
||||
function sendEmail(toEmail, toName, subject, body) {
|
||||
if(!checkForSMTPModule()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
module.smtp.send(
|
||||
getEmailConfig().smtp.host,
|
||||
getEmailConfig().smtp.port,
|
||||
|
||||
@@ -91,7 +91,7 @@ function onPlayerChat(event, client, messageText) {
|
||||
|
||||
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));
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
@@ -54,7 +54,11 @@ function loadHousesFromDatabase() {
|
||||
// ===========================================================================
|
||||
|
||||
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 dbConnection = connectToDatabase();
|
||||
@@ -84,12 +88,12 @@ function loadHouseLocationsFromDatabase(houseId) {
|
||||
|
||||
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));
|
||||
getServerData().houses.push(tempHouseData);
|
||||
let houseId = getServerData().houses.push(tempHouseData);
|
||||
|
||||
createHouseEntrancePickup(getServerData().houses.length-1);
|
||||
createHouseExitPickup(getServerData().houses.length-1);
|
||||
createHouseEntranceBlip(getServerData().houses.length-1);
|
||||
createHouseExitBlip(getServerData().houses.length-1);
|
||||
createHouseEntrancePickup(houseId);
|
||||
createHouseExitPickup(houseId);
|
||||
createHouseEntranceBlip(houseId);
|
||||
createHouseExitBlip(houseId);
|
||||
|
||||
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;
|
||||
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))}!`);
|
||||
}
|
||||
|
||||
@@ -122,7 +132,13 @@ function setHouseDescriptionCommand(command, params, client) {
|
||||
|
||||
let oldDescription = getHouseData(houseId).description;
|
||||
getHouseData(houseId).description = newHouseDescription;
|
||||
|
||||
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}`);
|
||||
}
|
||||
|
||||
@@ -218,79 +234,42 @@ function setHouseInteriorTypeCommand(command, params, client) {
|
||||
}
|
||||
|
||||
if(isNaN(typeParam)) {
|
||||
let tempHouseLocation = new serverClasses.houseLocationData(false);
|
||||
|
||||
if(toLowerCase(typeParam) == "none") {
|
||||
getHouseData(houseId).exitPosition = toVector3(0.0, 0.0, 0.0);
|
||||
getHouseData(houseId).exitInterior = -1;
|
||||
tempHouseLocation.exitPosition = toVector3(0.0, 0.0, 0.0);
|
||||
tempHouseLocation.exitInterior = -1;
|
||||
getHouseData(houseId).hasInterior = false;
|
||||
messageAdmins(`${getInlineChatColourByName("lightGrey")}${getPlayerName(client)} ${getInlineChatColourByName("white")}remove house ${getInlineChatColourByType("houseGreen")}${getHouseData(houseId).description} ${getInlineChatColourByName("white")}interior`);
|
||||
return false;
|
||||
}
|
||||
|
||||
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(", ")}`)
|
||||
return false;
|
||||
}
|
||||
|
||||
getHouseData(houseId).exitPosition = getGameConfig().interiorTemplates[getServerGame()][typeParam].exitPosition;
|
||||
getHouseData(houseId).exitInterior = getGameConfig().interiorTemplates[getServerGame()][typeParam].exitInterior;
|
||||
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);
|
||||
deleteHouseExitPickup(houseId);
|
||||
createHouseEntrancePickup(houseId);
|
||||
createHouseExitPickup(houseId);
|
||||
|
||||
getHouseData(houseId).locations = [];
|
||||
|
||||
tempHouseLocation.exitPosition = getGameConfig().interiorTemplates[getServerGame()][typeParam].exitPosition;
|
||||
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)}`);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
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) {
|
||||
let houseId = (isPlayerInAnyHouse(client)) ? getPlayerHouse(client) : getClosestHouseEntrance(getPlayerPosition(client)).house;
|
||||
|
||||
@@ -299,15 +278,14 @@ function moveHouseEntranceCommand(command, params, client) {
|
||||
return false;
|
||||
}
|
||||
|
||||
getHouseData(houseId).entrancePosition = getPlayerPosition(client);
|
||||
getHouseData(houseId).entranceDimension = getPlayerDimension(client);
|
||||
getHouseData(houseId).entranceInterior = getPlayerInterior(client);
|
||||
getHouseData(houseId).locations[0].entrancePosition = getPlayerPosition(client);
|
||||
getHouseData(houseId).locations[0].entranceDimension = getPlayerDimension(client);
|
||||
getHouseData(houseId).locations[0].entranceInterior = getPlayerInterior(client);
|
||||
|
||||
deleteHouseEntranceBlip(houseId);
|
||||
deleteHouseEntrancePickup(houseId);
|
||||
|
||||
createHouseEntranceBlip(houseId);
|
||||
createHouseEntrancePickup(houseId);
|
||||
deleteAllHouseBlips(houseId);
|
||||
deleteAllHousePickups(houseId);
|
||||
createAllHouseBlips(houseId);
|
||||
createAllHousePickups(houseId);
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
getHouseData(houseId).exitPosition = getPlayerPosition(client);
|
||||
getHouseData(houseId).exitDimension = getPlayerDimension(client);
|
||||
getHouseData(houseId).exitInterior = getPlayerInterior(client);
|
||||
getHouseData(houseId).locations = [];
|
||||
|
||||
deleteHouseExitBlip(houseId);
|
||||
deleteHouseExitPickup(houseId);
|
||||
getHouseData(houseId).locations[0].entrancePosition = getPlayerPosition(client);
|
||||
getHouseData(houseId).locations[0].entranceDimension = getPlayerDimension(client);
|
||||
getHouseData(houseId).locations[0].exitInterior = getPlayerInterior(client);
|
||||
|
||||
createHouseExitBlip(houseId);
|
||||
createHouseExitPickup(houseId);
|
||||
deleteAllHouseBlips(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`);
|
||||
}
|
||||
@@ -366,11 +345,8 @@ function deleteHouse(houseId, whoDeleted = 0) {
|
||||
disconnectFromDatabase(dbConnection);
|
||||
}
|
||||
|
||||
deleteHouseEntrancePickup(houseId);
|
||||
deleteHouseExitPickup(houseId);
|
||||
|
||||
deleteHouseEntranceBlip(houseId);
|
||||
deleteHouseExitBlip(houseId);
|
||||
deleteAllHouseBlips(houseId);
|
||||
deleteAllHousePickups(houseId);
|
||||
|
||||
removePlayersFromHouse(houseId);
|
||||
|
||||
@@ -391,19 +367,22 @@ function createHouse(description, entrancePosition, exitPosition, entrancePickup
|
||||
let tempHouseData = new serverClasses.houseData(false);
|
||||
tempHouseData.description = description;
|
||||
|
||||
tempHouseData.entrancePosition = entrancePosition;
|
||||
tempHouseData.entranceRotation = 0.0;
|
||||
tempHouseData.entrancePickupModel = entrancePickupModel;
|
||||
tempHouseData.entranceBlipModel = entranceBlipModel;
|
||||
tempHouseData.entranceInterior = entranceInteriorId;
|
||||
tempHouseData.entranceDimension = entranceVirtualWorld;
|
||||
let tempHouseLocation = new serverClasses.houseLocationData(false);
|
||||
tempHouseLocation.entrancePosition = entrancePosition;
|
||||
tempHouseLocation.entranceRotation = 0.0;
|
||||
tempHouseLocation.entrancePickupModel = entrancePickupModel;
|
||||
tempHouseLocation.entranceBlipModel = entranceBlipModel;
|
||||
tempHouseLocation.entranceInterior = entranceInteriorId;
|
||||
tempHouseLocation.entranceDimension = entranceVirtualWorld;
|
||||
|
||||
tempHouseData.exitPosition = exitPosition;
|
||||
tempHouseData.exitRotation = 0.0;
|
||||
tempHouseData.exitPickupModel = exitPickupModel;
|
||||
tempHouseData.exitBlipModel = exitBlipModel;
|
||||
tempHouseData.exitInterior = exitInteriorId;
|
||||
tempHouseData.exitDimension = exitVirtualWorld;
|
||||
tempHouseLocation.exitPosition = exitPosition;
|
||||
tempHouseLocation.exitRotation = 0.0;
|
||||
tempHouseLocation.exitPickupModel = exitPickupModel;
|
||||
tempHouseLocation.exitBlipModel = exitBlipModel;
|
||||
tempHouseLocation.exitInterior = exitInteriorId;
|
||||
tempHouseLocation.exitDimension = exitVirtualWorld;
|
||||
|
||||
tempHouseData.locations.push(tempHouseLocation);
|
||||
|
||||
return tempHouseData;
|
||||
}
|
||||
@@ -422,7 +401,7 @@ function getHouseDataFromDatabaseId(databaseId) {
|
||||
|
||||
function getClosestHouseEntrance(position) {
|
||||
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) {
|
||||
if(getDistance(position, houses[i].locations[j].entrancePosition) <= getDistance(position, closest.entrancePosition)) {
|
||||
closest = getServerData().houses[i].locations[j];
|
||||
|
||||
@@ -145,7 +145,7 @@ function addKeyBindCommand(command, params, client) {
|
||||
if(!keyId) {
|
||||
messagePlayerError(client, "The key ID or name you input is invalid!");
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -173,7 +173,7 @@ function removeKeyBindCommand(command, params, client) {
|
||||
if(!keyId) {
|
||||
messagePlayerError(client, "The key ID or name you input is invalid!");
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
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")}")}`);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
@@ -95,8 +95,7 @@ function checkForAllRequiredModules() {
|
||||
|
||||
if(!checkForSMTPModule()) {
|
||||
console.warn("[VRR.Startup]: SMTP Email module is not loaded!");
|
||||
console.warn("[VRR.Startup]: This resource will now shutdown.");
|
||||
thisResource.stop();
|
||||
console.warn("[VRR.Startup]: Email features will NOT be available!");
|
||||
}
|
||||
|
||||
logToConsole(LOG_DEBUG, "[VRR.Startup]: All required modules loaded!");
|
||||
|
||||
@@ -158,7 +158,7 @@ function toString(val) {
|
||||
// ===========================================================================
|
||||
|
||||
function toVector3(x, y, z) {
|
||||
return new Vec3(x, y, z);
|
||||
return new Vec3(toFloat(x), toFloat(y), toFloat(z));
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
Reference in New Issue
Block a user